Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 6 // * the Geant4 Collaboration. It is provided << 7 // * conditions of the Geant4 Software License << 8 // * LICENSE and available at http://cern.ch/ << 9 // * include a list of copyright holders. << 10 // * << 11 // * Neither the authors of this software syst << 12 // * institutes,nor the agencies providing fin << 13 // * work make any representation or warran << 14 // * regarding this software system or assum << 15 // * use. Please see the license in the file << 16 // * for the full disclaimer and the limitatio << 17 // * << 18 // * This code implementation is the result << 19 // * technical work of the GEANT4 collaboratio << 20 // * By using, copying, modifying or distri << 21 // * any work based on the software) you ag << 22 // * use in resulting scientific publicati << 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 // 7 // 26 // G4VProcess class implementation << 8 // $Id: G4VProcess.cc,v 1.4 1999/12/15 14:53:44 gunter Exp $ >> 9 // GEANT4 tag $Name: geant4-02-00 $ 27 // 10 // 28 // Authors: << 11 // 29 // - 2 December 1995, G.Cosmo - First implemen << 12 // -------------------------------------------------------------- 30 // - 18 December 1996, H.Kurashige - New Physi << 13 // GEANT 4 class implementation file 31 // ------------------------------------------- << 14 // 32 << 15 // For information related to this code contact: 33 #include "G4VProcess.hh" << 16 // CERN, CN Division, ASD Group 34 << 17 // History: first implementation, based on object model of 35 #include "G4PhysicalConstants.hh" << 18 // 2nd December 1995, G.Cosmo 36 #include "G4SystemOfUnits.hh" << 19 // -------------------------------------------------------------- >> 20 // New Physics scheme 8 Jan. 1997 H.Kurahige >> 21 // ------------------------------------------------------------ >> 22 // removed thePhysicsTable 02 Aug. 1998 H.Kurashige >> 23 // Modified DumpInfo 15 Aug. 1998 H.Kurashige 37 24 38 #include "G4ProcessTable.hh" << 39 #include "G4PhysicsTable.hh" 25 #include "G4PhysicsTable.hh" 40 #include "G4MaterialTable.hh" 26 #include "G4MaterialTable.hh" 41 #include "G4ElementTable.hh" 27 #include "G4ElementTable.hh" 42 #include "G4ElementVector.hh" 28 #include "G4ElementVector.hh" 43 #include "G4Log.hh" << 29 #include "G4VProcess.hh" 44 30 45 // ------------------------------------------- << 31 G4VProcess::G4VProcess(const G4String& aName, G4ProcessType aType ) 46 G4VProcess::G4VProcess(const G4String& aName, << 32 : theProcessName(aName), 47 : theProcessName(aName), theProcessType(aTyp << 33 theProcessType(aType), >> 34 pParticleChange(0), >> 35 theNumberOfInteractionLengthLeft(-1.0), >> 36 currentInteractionLength(-1.0), >> 37 verboseLevel(0) 48 { 38 { 49 pParticleChange = &aParticleChange; 39 pParticleChange = &aParticleChange; 50 fProcessTable = G4ProcessTable::GetProcessTa << 51 fProcessTable->RegisterProcess(this); << 52 } << 53 << 54 // ------------------------------------------- << 55 G4VProcess::G4VProcess() << 56 { << 57 } 40 } 58 41 59 // ------------------------------------------- << 60 G4VProcess::~G4VProcess() 42 G4VProcess::~G4VProcess() 61 { 43 { 62 fProcessTable->DeRegisterProcess(this); << 63 } 44 } 64 45 65 // ------------------------------------------- << 46 G4VProcess::G4VProcess(G4VProcess& right): 66 G4VProcess::G4VProcess(const G4VProcess& right << 47 pParticleChange(0), 67 : theProcessName(right.theProcessName), << 48 theProcessName(right.theProcessName), 68 theProcessType(right.theProcessType), << 49 theProcessType(right.theProcessType), 69 theProcessSubType(right.theProcessSubType) << 50 theNumberOfInteractionLengthLeft(-1.0), 70 verboseLevel(right.verboseLevel), << 51 currentInteractionLength(-1.0) 71 enableAtRestDoIt(right.enableAtRestDoIt), << 72 enableAlongStepDoIt(right.enableAlongStepD << 73 enablePostStepDoIt(right.enablePostStepDoI << 74 masterProcessShadow(right.masterProcessSha << 75 fProcessTable(right.fProcessTable) << 76 { 52 { 77 } 53 } 78 54 79 // ------------------------------------------- << 55 80 void G4VProcess::ResetNumberOfInteractionLengt << 56 void G4VProcess::SubtractNumberOfInteractionLengthLeft( >> 57 G4double previousStepSize ) 81 { 58 { 82 theNumberOfInteractionLengthLeft = -1.*G4Lo << 59 if (currentInteractionLength>0.0) { 83 theInitialNumberOfInteractionLength = theNum << 60 theNumberOfInteractionLengthLeft -= previousStepSize/currentInteractionLength; >> 61 } else { >> 62 #ifdef G4VERBOSE >> 63 if (verboseLevel>0) { >> 64 G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()"; >> 65 G4cerr << " [" << theProcessName << "]" <<G4endl; >> 66 G4cerr << " currentInteractionLength = " << currentInteractionLength/cm << " [cm]"; >> 67 G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]"; >> 68 G4cerr << G4endl; >> 69 } >> 70 #endif >> 71 G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft() negative currentInteractionLength" ); >> 72 } 84 } 73 } 85 74 86 // ------------------------------------------- << 75 void G4VProcess::StartTracking() 87 void G4VProcess::StartTracking(G4Track*) << 88 { 76 { 89 currentInteractionLength = -1.0; 77 currentInteractionLength = -1.0; 90 theNumberOfInteractionLengthLeft = -1.0; 78 theNumberOfInteractionLengthLeft = -1.0; 91 theInitialNumberOfInteractionLength = -1.0; << 92 #ifdef G4VERBOSE 79 #ifdef G4VERBOSE 93 if (verboseLevel>2) << 80 if (verboseLevel>2) { 94 { << 81 G4cout << "G4VProcess::StartTracking() [" << theProcessName << "]" <<G4endl; 95 G4cout << "G4VProcess::StartTracking() - [ << 96 << G4endl; << 97 } 82 } 98 #endif 83 #endif 99 } 84 } 100 85 101 // ------------------------------------------- << 102 void G4VProcess::EndTracking() 86 void G4VProcess::EndTracking() 103 { 87 { 104 #ifdef G4VERBOSE 88 #ifdef G4VERBOSE 105 if (verboseLevel>2) << 89 if (verboseLevel>2) { 106 { << 90 G4cout << "G4VProcess::EndTracking() [" << theProcessName << "]" <<G4endl; 107 G4cout << "G4VProcess::EndTracking() - [" << 108 << G4endl; << 109 } 91 } 110 #endif 92 #endif 111 theNumberOfInteractionLengthLeft = -1.0; 93 theNumberOfInteractionLengthLeft = -1.0; 112 currentInteractionLength = -1.0; 94 currentInteractionLength = -1.0; 113 theInitialNumberOfInteractionLength=-1.0; << 114 } 95 } 115 96 116 // ------------------------------------------- << 117 namespace << 118 { << 119 static const G4String typeNotDefined = "NotD << 120 static const G4String typeTransportation = " << 121 static const G4String typeElectromagnetic = << 122 static const G4String typeOptical = "Optical << 123 static const G4String typeHadronic = "Hadron << 124 static const G4String typePhotolepton_hadron << 125 static const G4String typeDecay = "Decay"; << 126 static const G4String typeGeneral = "General << 127 static const G4String typeParameterisation = << 128 static const G4String typeUserDefined = "Use << 129 static const G4String typePhonon = "Phonon"; << 130 static const G4String noType = "------"; << 131 } << 132 97 133 // ------------------------------------------- << 134 const G4String& G4VProcess::GetProcessTypeName 98 const G4String& G4VProcess::GetProcessTypeName(G4ProcessType aType ) 135 { 99 { 136 switch (aType) << 100 static G4String typeNotDefined= "NotDefined"; 137 { << 101 static G4String typeTransportation = "Transportation"; 138 case fNotDefined: return typeNotDe << 102 static G4String typeElectromagnetic = "Electromagnetic"; 139 case fTransportation: return typeTrans << 103 static G4String typeOptical = "Optical"; 140 case fElectromagnetic: return typeElect << 104 static G4String typeHadronic = "Hadronic"; 141 case fOptical: return typeOptic << 105 static G4String typePhotolepton_hadron = "Photolepton_hadron"; 142 case fHadronic: return typeHadro << 106 static G4String typeDecay = "Decay"; 143 case fPhotolepton_hadron: return typePhoto << 107 static G4String typeGeneral = "General"; 144 case fDecay: return typeDecay << 108 static G4String typeParameterisation = "Parameterisation"; 145 case fGeneral: return typeGener << 109 static G4String typeUserDefined = "UserDefined"; 146 case fParameterisation: return typeParam << 110 static G4String noType = "------"; // Do not modify this !!!! 147 case fUserDefined: return typeUserD << 111 148 case fPhonon: return typePhono << 112 if (aType == fNotDefined) { 149 default: ; << 113 return typeNotDefined; >> 114 } else if (aType == fTransportation ) { >> 115 return typeTransportation; >> 116 } else if (aType == fElectromagnetic ) { >> 117 return typeElectromagnetic; >> 118 } else if (aType == fOptical ) { >> 119 return typeOptical; >> 120 } else if (aType == fHadronic ) { >> 121 return typeHadronic; >> 122 } else if (aType == fPhotolepton_hadron ) { >> 123 return typePhotolepton_hadron; >> 124 } else if (aType == fDecay ) { >> 125 return typeDecay; >> 126 } else if (aType == fGeneral ) { >> 127 return typeGeneral; >> 128 } else if (aType == fParameterisation ) { >> 129 return typeParameterisation; >> 130 } else if (aType == fUserDefined ) { >> 131 return typeUserDefined; >> 132 } else { >> 133 return noType; 150 } 134 } 151 return noType; << 152 } 135 } 153 136 154 // ------------------------------------------- << 137 G4VProcess & G4VProcess::operator=(const G4VProcess &) 155 const G4VProcess* G4VProcess::GetCreatorProces << 156 { 138 { 157 return this; << 139 G4Exception("G4VProcess::assignment operator is called"); >> 140 return *this; 158 } 141 } 159 142 160 // ------------------------------------------- << 143 G4int G4VProcess::operator==(const G4VProcess &right) const 161 G4bool G4VProcess::operator==(const G4VProcess << 162 { 144 { 163 return (this == &right); 145 return (this == &right); 164 } 146 } 165 147 166 // ------------------------------------------- << 148 G4int G4VProcess::operator!=(const G4VProcess &right) const 167 G4bool G4VProcess::operator!=(const G4VProcess << 168 { 149 { 169 return (this != &right); 150 return (this != &right); 170 } 151 } 171 152 172 // ------------------------------------------- << 173 void G4VProcess::DumpInfo() const 153 void G4VProcess::DumpInfo() const 174 { 154 { 175 G4cout << "Process Name " << theProcessName << 155 G4cout << "Process Name " << theProcessName ; 176 G4cout << " : Type[" << GetProcessTypeName(t << 156 G4cout << " : Type[" << GetProcessTypeName(theProcessType) << "]"<< G4endl; 177 G4cout << " : SubType[" << theProcessSubType << 178 } 157 } 179 158 180 // ------------------------------------------- << 181 void G4VProcess::ProcessDescription(std::ostre << 182 { << 183 outFile << "This process has not yet been de << 184 } << 185 << 186 // ------------------------------------------- << 187 const G4String& G4VProcess:: << 188 GetPhysicsTableFileName( const G4ParticleDefin << 189 const G4String& direc << 190 const G4String& table << 191 G4bool ascii ) << 192 { << 193 G4String thePhysicsTableFileExt; << 194 if (ascii) thePhysicsTableFileExt = ".asc"; << 195 else thePhysicsTableFileExt = ".dat"; << 196 159 197 thePhysicsTableFileName = directory + "/"; << 198 thePhysicsTableFileName += tableName + "." + << 199 thePhysicsTableFileName += particle->GetPart << 200 + thePhysicsTableFi << 201 << 202 return thePhysicsTableFileName; << 203 } << 204 160 205 // ------------------------------------------- << 206 void G4VProcess::BuildWorkerPhysicsTable(const << 207 { << 208 BuildPhysicsTable(part); << 209 } << 210 161 211 // ------------------------------------------- << 212 void G4VProcess::PrepareWorkerPhysicsTable(con << 213 { << 214 PreparePhysicsTable(part); << 215 } << 216 162 217 // ------------------------------------------- << 163 218 void G4VProcess::SetMasterProcess(G4VProcess* << 164 219 { << 165 220 masterProcessShadow = masterP; << 166 221 } << 167 >> 168 >> 169 222 170