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.5 2000/11/03 07:09:31 kurasige Exp $ >> 9 // GEANT4 tag $Name: geant4-03-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 thePILfactor(1.0), >> 38 verboseLevel(0) 48 { 39 { 49 pParticleChange = &aParticleChange; 40 pParticleChange = &aParticleChange; 50 fProcessTable = G4ProcessTable::GetProcessTa << 51 fProcessTable->RegisterProcess(this); << 52 } << 53 << 54 // ------------------------------------------- << 55 G4VProcess::G4VProcess() << 56 { << 57 } 41 } 58 42 59 // ------------------------------------------- << 60 G4VProcess::~G4VProcess() 43 G4VProcess::~G4VProcess() 61 { 44 { 62 fProcessTable->DeRegisterProcess(this); << 63 } 45 } 64 46 65 // ------------------------------------------- << 47 G4VProcess::G4VProcess(G4VProcess& right): 66 G4VProcess::G4VProcess(const G4VProcess& right << 48 pParticleChange(0), 67 : theProcessName(right.theProcessName), << 49 theProcessName(right.theProcessName), 68 theProcessType(right.theProcessType), << 50 theProcessType(right.theProcessType), 69 theProcessSubType(right.theProcessSubType) << 51 theNumberOfInteractionLengthLeft(-1.0), 70 verboseLevel(right.verboseLevel), << 52 thePILfactor(1.0), 71 enableAtRestDoIt(right.enableAtRestDoIt), << 53 currentInteractionLength(-1.0) 72 enableAlongStepDoIt(right.enableAlongStepD << 73 enablePostStepDoIt(right.enablePostStepDoI << 74 masterProcessShadow(right.masterProcessSha << 75 fProcessTable(right.fProcessTable) << 76 { 54 { 77 } 55 } 78 56 79 // ------------------------------------------- << 57 80 void G4VProcess::ResetNumberOfInteractionLengt << 58 void G4VProcess::SubtractNumberOfInteractionLengthLeft( >> 59 G4double previousStepSize ) 81 { 60 { 82 theNumberOfInteractionLengthLeft = -1.*G4Lo << 61 if (currentInteractionLength>0.0) { 83 theInitialNumberOfInteractionLength = theNum << 62 theNumberOfInteractionLengthLeft -= previousStepSize/currentInteractionLength; >> 63 } else { >> 64 #ifdef G4VERBOSE >> 65 if (verboseLevel>0) { >> 66 G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()"; >> 67 G4cerr << " [" << theProcessName << "]" <<G4endl; >> 68 G4cerr << " currentInteractionLength = " << currentInteractionLength/cm << " [cm]"; >> 69 G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]"; >> 70 G4cerr << G4endl; >> 71 } >> 72 #endif >> 73 G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft() negative currentInteractionLength" ); >> 74 } 84 } 75 } 85 76 86 // ------------------------------------------- << 77 void G4VProcess::StartTracking() 87 void G4VProcess::StartTracking(G4Track*) << 88 { 78 { 89 currentInteractionLength = -1.0; 79 currentInteractionLength = -1.0; 90 theNumberOfInteractionLengthLeft = -1.0; 80 theNumberOfInteractionLengthLeft = -1.0; 91 theInitialNumberOfInteractionLength = -1.0; << 92 #ifdef G4VERBOSE 81 #ifdef G4VERBOSE 93 if (verboseLevel>2) << 82 if (verboseLevel>2) { 94 { << 83 G4cout << "G4VProcess::StartTracking() [" << theProcessName << "]" <<G4endl; 95 G4cout << "G4VProcess::StartTracking() - [ << 96 << G4endl; << 97 } 84 } 98 #endif 85 #endif 99 } 86 } 100 87 101 // ------------------------------------------- << 102 void G4VProcess::EndTracking() 88 void G4VProcess::EndTracking() 103 { 89 { 104 #ifdef G4VERBOSE 90 #ifdef G4VERBOSE 105 if (verboseLevel>2) << 91 if (verboseLevel>2) { 106 { << 92 G4cout << "G4VProcess::EndTracking() [" << theProcessName << "]" <<G4endl; 107 G4cout << "G4VProcess::EndTracking() - [" << 108 << G4endl; << 109 } 93 } 110 #endif 94 #endif 111 theNumberOfInteractionLengthLeft = -1.0; 95 theNumberOfInteractionLengthLeft = -1.0; 112 currentInteractionLength = -1.0; 96 currentInteractionLength = -1.0; 113 theInitialNumberOfInteractionLength=-1.0; << 114 } 97 } 115 98 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 99 133 // ------------------------------------------- << 134 const G4String& G4VProcess::GetProcessTypeName 100 const G4String& G4VProcess::GetProcessTypeName(G4ProcessType aType ) 135 { 101 { 136 switch (aType) << 102 static G4String typeNotDefined= "NotDefined"; 137 { << 103 static G4String typeTransportation = "Transportation"; 138 case fNotDefined: return typeNotDe << 104 static G4String typeElectromagnetic = "Electromagnetic"; 139 case fTransportation: return typeTrans << 105 static G4String typeOptical = "Optical"; 140 case fElectromagnetic: return typeElect << 106 static G4String typeHadronic = "Hadronic"; 141 case fOptical: return typeOptic << 107 static G4String typePhotolepton_hadron = "Photolepton_hadron"; 142 case fHadronic: return typeHadro << 108 static G4String typeDecay = "Decay"; 143 case fPhotolepton_hadron: return typePhoto << 109 static G4String typeGeneral = "General"; 144 case fDecay: return typeDecay << 110 static G4String typeParameterisation = "Parameterisation"; 145 case fGeneral: return typeGener << 111 static G4String typeUserDefined = "UserDefined"; 146 case fParameterisation: return typeParam << 112 static G4String noType = "------"; // Do not modify this !!!! 147 case fUserDefined: return typeUserD << 113 148 case fPhonon: return typePhono << 114 if (aType == fNotDefined) { 149 default: ; << 115 return typeNotDefined; >> 116 } else if (aType == fTransportation ) { >> 117 return typeTransportation; >> 118 } else if (aType == fElectromagnetic ) { >> 119 return typeElectromagnetic; >> 120 } else if (aType == fOptical ) { >> 121 return typeOptical; >> 122 } else if (aType == fHadronic ) { >> 123 return typeHadronic; >> 124 } else if (aType == fPhotolepton_hadron ) { >> 125 return typePhotolepton_hadron; >> 126 } else if (aType == fDecay ) { >> 127 return typeDecay; >> 128 } else if (aType == fGeneral ) { >> 129 return typeGeneral; >> 130 } else if (aType == fParameterisation ) { >> 131 return typeParameterisation; >> 132 } else if (aType == fUserDefined ) { >> 133 return typeUserDefined; >> 134 } else { >> 135 return noType; 150 } 136 } 151 return noType; << 152 } 137 } 153 138 154 // ------------------------------------------- << 139 G4VProcess & G4VProcess::operator=(const G4VProcess &) 155 const G4VProcess* G4VProcess::GetCreatorProces << 156 { 140 { 157 return this; << 141 G4Exception("G4VProcess::assignment operator is called"); >> 142 return *this; 158 } 143 } 159 144 160 // ------------------------------------------- << 145 G4int G4VProcess::operator==(const G4VProcess &right) const 161 G4bool G4VProcess::operator==(const G4VProcess << 162 { 146 { 163 return (this == &right); 147 return (this == &right); 164 } 148 } 165 149 166 // ------------------------------------------- << 150 G4int G4VProcess::operator!=(const G4VProcess &right) const 167 G4bool G4VProcess::operator!=(const G4VProcess << 168 { 151 { 169 return (this != &right); 152 return (this != &right); 170 } 153 } 171 154 172 // ------------------------------------------- << 173 void G4VProcess::DumpInfo() const 155 void G4VProcess::DumpInfo() const 174 { 156 { 175 G4cout << "Process Name " << theProcessName << 157 G4cout << "Process Name " << theProcessName ; 176 G4cout << " : Type[" << GetProcessTypeName(t << 158 G4cout << " : Type[" << GetProcessTypeName(theProcessType) << "]"<< G4endl; 177 G4cout << " : SubType[" << theProcessSubType << 178 } 159 } 179 160 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 161 197 thePhysicsTableFileName = directory + "/"; << 198 thePhysicsTableFileName += tableName + "." + << 199 thePhysicsTableFileName += particle->GetPart << 200 + thePhysicsTableFi << 201 << 202 return thePhysicsTableFileName; << 203 } << 204 162 205 // ------------------------------------------- << 206 void G4VProcess::BuildWorkerPhysicsTable(const << 207 { << 208 BuildPhysicsTable(part); << 209 } << 210 163 211 // ------------------------------------------- << 212 void G4VProcess::PrepareWorkerPhysicsTable(con << 213 { << 214 PreparePhysicsTable(part); << 215 } << 216 164 217 // ------------------------------------------- << 165 218 void G4VProcess::SetMasterProcess(G4VProcess* << 166 219 { << 167 220 masterProcessShadow = masterP; << 168 221 } << 169 >> 170 >> 171 222 172