Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file medical/electronScattering/src/Physi 26 /// \file medical/electronScattering/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id$ 29 // 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "PhysicsList.hh" 34 #include "PhysicsList.hh" 34 << 35 #include "PhysicsListMessenger.hh" 35 #include "PhysicsListMessenger.hh" 36 #include "StepMax.hh" << 37 36 38 #include "G4Decay.hh" << 37 #include "PhysListEmStandard.hh" >> 38 #include "PhysListEmStandardSS.hh" >> 39 #include "PhysListEmStandardGS.hh" >> 40 #include "PhysListEmStandardWVI.hh" >> 41 39 #include "G4EmStandardPhysics.hh" 42 #include "G4EmStandardPhysics.hh" 40 #include "G4EmStandardPhysicsGS.hh" << 41 #include "G4EmStandardPhysicsSS.hh" << 42 #include "G4EmStandardPhysicsWVI.hh" << 43 #include "G4EmStandardPhysics_option1.hh" 43 #include "G4EmStandardPhysics_option1.hh" 44 #include "G4EmStandardPhysics_option2.hh" 44 #include "G4EmStandardPhysics_option2.hh" 45 #include "G4EmStandardPhysics_option3.hh" 45 #include "G4EmStandardPhysics_option3.hh" 46 #include "G4EmStandardPhysics_option4.hh" << 46 >> 47 #include "G4UnitsTable.hh" >> 48 47 #include "G4ParticleDefinition.hh" 49 #include "G4ParticleDefinition.hh" 48 #include "G4ProcessManager.hh" 50 #include "G4ProcessManager.hh" 49 #include "G4UnitsTable.hh" << 50 51 51 // Bosons 52 // Bosons 52 #include "G4ChargedGeantino.hh" 53 #include "G4ChargedGeantino.hh" 53 #include "G4Gamma.hh" << 54 #include "G4Geantino.hh" 54 #include "G4Geantino.hh" >> 55 #include "G4Gamma.hh" 55 #include "G4OpticalPhoton.hh" 56 #include "G4OpticalPhoton.hh" 56 57 57 // leptons 58 // leptons 58 #include "G4AntiNeutrinoE.hh" << 59 #include "G4AntiNeutrinoMu.hh" << 60 #include "G4Electron.hh" << 61 #include "G4MuonMinus.hh" << 62 #include "G4MuonPlus.hh" 59 #include "G4MuonPlus.hh" 63 #include "G4NeutrinoE.hh" << 60 #include "G4MuonMinus.hh" 64 #include "G4NeutrinoMu.hh" 61 #include "G4NeutrinoMu.hh" >> 62 #include "G4AntiNeutrinoMu.hh" >> 63 >> 64 #include "G4Electron.hh" 65 #include "G4Positron.hh" 65 #include "G4Positron.hh" >> 66 #include "G4NeutrinoE.hh" >> 67 #include "G4AntiNeutrinoE.hh" 66 68 67 // Hadrons 69 // Hadrons >> 70 #include "G4MesonConstructor.hh" 68 #include "G4BaryonConstructor.hh" 71 #include "G4BaryonConstructor.hh" 69 #include "G4IonConstructor.hh" 72 #include "G4IonConstructor.hh" 70 #include "G4MesonConstructor.hh" << 73 71 #include "G4SystemOfUnits.hh" 74 #include "G4SystemOfUnits.hh" 72 75 73 //....oooOO0OOooo........oooOO0OOooo........oo 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 74 77 75 PhysicsList::PhysicsList() << 78 PhysicsList::PhysicsList() : G4VModularPhysicsList() 76 : G4VModularPhysicsList(), fMessenger(0), fE << 77 { 79 { 78 fMessenger = new PhysicsListMessenger(this); << 80 fMessenger = new PhysicsListMessenger(this); 79 << 81 80 // EM physics 82 // EM physics 81 fEmPhysicsList = new G4EmStandardPhysics(); << 83 fEmName = G4String("local"); >> 84 fEmPhysicsList = new PhysListEmStandard(fEmName); >> 85 >> 86 defaultCutValue = 1.*mm; >> 87 fCutForGamma = defaultCutValue; >> 88 fCutForElectron = defaultCutValue; >> 89 fCutForPositron = defaultCutValue; 82 90 83 SetDefaultCutValue(1. * mm); << 84 SetVerboseLevel(1); 91 SetVerboseLevel(1); 85 } 92 } 86 93 87 //....oooOO0OOooo........oooOO0OOooo........oo 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 88 95 89 PhysicsList::~PhysicsList() 96 PhysicsList::~PhysicsList() 90 { 97 { 91 delete fEmPhysicsList; 98 delete fEmPhysicsList; 92 delete fMessenger; << 99 delete fMessenger; 93 } 100 } 94 101 95 //....oooOO0OOooo........oooOO0OOooo........oo 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 96 103 97 void PhysicsList::ConstructParticle() 104 void PhysicsList::ConstructParticle() 98 { 105 { 99 // pseudo-particles << 106 // pseudo-particles 100 G4Geantino::GeantinoDefinition(); 107 G4Geantino::GeantinoDefinition(); 101 G4ChargedGeantino::ChargedGeantinoDefinition 108 G4ChargedGeantino::ChargedGeantinoDefinition(); 102 << 109 103 // gamma << 110 // gamma 104 G4Gamma::GammaDefinition(); 111 G4Gamma::GammaDefinition(); 105 << 112 106 // optical photon << 113 // optical photon 107 G4OpticalPhoton::OpticalPhotonDefinition(); 114 G4OpticalPhoton::OpticalPhotonDefinition(); 108 115 109 // leptons << 116 // leptons 110 G4Electron::ElectronDefinition(); 117 G4Electron::ElectronDefinition(); 111 G4Positron::PositronDefinition(); 118 G4Positron::PositronDefinition(); 112 G4MuonPlus::MuonPlusDefinition(); 119 G4MuonPlus::MuonPlusDefinition(); 113 G4MuonMinus::MuonMinusDefinition(); 120 G4MuonMinus::MuonMinusDefinition(); 114 121 115 G4NeutrinoE::NeutrinoEDefinition(); 122 G4NeutrinoE::NeutrinoEDefinition(); 116 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 123 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 117 G4NeutrinoMu::NeutrinoMuDefinition(); 124 G4NeutrinoMu::NeutrinoMuDefinition(); 118 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition() << 125 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 119 126 120 // mesons << 127 // mesons 121 G4MesonConstructor mConstructor; 128 G4MesonConstructor mConstructor; 122 mConstructor.ConstructParticle(); 129 mConstructor.ConstructParticle(); 123 130 124 // barions << 131 // barions 125 G4BaryonConstructor bConstructor; 132 G4BaryonConstructor bConstructor; 126 bConstructor.ConstructParticle(); 133 bConstructor.ConstructParticle(); 127 134 128 // ions << 135 // ions 129 G4IonConstructor iConstructor; 136 G4IonConstructor iConstructor; 130 iConstructor.ConstructParticle(); 137 iConstructor.ConstructParticle(); 131 } 138 } 132 139 133 //....oooOO0OOooo........oooOO0OOooo........oo 140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 141 135 void PhysicsList::ConstructProcess() 142 void PhysicsList::ConstructProcess() 136 { 143 { 137 AddTransportation(); 144 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); 145 fEmPhysicsList->ConstructProcess(); 139 AddDecay(); << 146 AddDecay(); 140 AddStepMax(); 147 AddStepMax(); 141 } 148 } 142 149 143 //....oooOO0OOooo........oooOO0OOooo........oo 150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 144 151 >> 152 #include "G4Decay.hh" >> 153 145 void PhysicsList::AddDecay() 154 void PhysicsList::AddDecay() 146 { 155 { 147 // Add Decay Process 156 // Add Decay Process 148 157 149 G4Decay* fDecayProcess = new G4Decay(); 158 G4Decay* fDecayProcess = new G4Decay(); 150 159 151 auto particleIterator = GetParticleIterator( << 160 theParticleIterator->reset(); 152 particleIterator->reset(); << 161 while( (*theParticleIterator)() ){ 153 while ((*particleIterator)()) { << 162 G4ParticleDefinition* particle = theParticleIterator->value(); 154 G4ParticleDefinition* particle = particleI << 155 G4ProcessManager* pmanager = particle->Get 163 G4ProcessManager* pmanager = particle->GetProcessManager(); 156 164 157 if (fDecayProcess->IsApplicable(*particle) << 165 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 158 pmanager->AddProcess(fDecayProcess); << 166 >> 167 pmanager ->AddProcess(fDecayProcess); 159 168 160 // set ordering for PostStepDoIt and AtR 169 // set ordering for PostStepDoIt and AtRestDoIt 161 pmanager->SetProcessOrdering(fDecayProce << 170 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); 162 pmanager->SetProcessOrdering(fDecayProce << 171 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 172 163 } 173 } 164 } 174 } 165 } 175 } 166 176 167 //....oooOO0OOooo........oooOO0OOooo........oo 177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 168 178 >> 179 #include "StepMax.hh" >> 180 169 void PhysicsList::AddStepMax() 181 void PhysicsList::AddStepMax() 170 { 182 { 171 // Step limitation seen as a process 183 // Step limitation seen as a process 172 StepMax* stepMaxProcess = new StepMax(); 184 StepMax* stepMaxProcess = new StepMax(); 173 185 174 auto particleIterator = GetParticleIterator( << 186 theParticleIterator->reset(); 175 particleIterator->reset(); << 187 while ((*theParticleIterator)()){ 176 while ((*particleIterator)()) { << 188 G4ParticleDefinition* particle = theParticleIterator->value(); 177 G4ParticleDefinition* particle = particleI << 189 G4ProcessManager* pmanager = particle->GetProcessManager(); 178 G4ProcessManager* pmanager = particle->Get << 190 179 << 191 if (stepMaxProcess->IsApplicable(*particle)) 180 if (stepMaxProcess->IsApplicable(*particle << 192 { 181 pmanager->AddDiscreteProcess(stepMaxProc << 193 pmanager ->AddDiscreteProcess(stepMaxProcess); 182 } << 194 } 183 } 195 } 184 } 196 } 185 197 186 //....oooOO0OOooo........oooOO0OOooo........oo 198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 187 199 188 void PhysicsList::AddPhysicsList(const G4Strin 200 void PhysicsList::AddPhysicsList(const G4String& name) 189 { 201 { 190 if (verboseLevel > -1) { << 202 if (verboseLevel>-1) { 191 G4cout << "PhysicsList::AddPhysicsList: <" 203 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 192 } 204 } 193 205 194 if (name == fEmName) return; 206 if (name == fEmName) return; 195 207 196 if (name == "emstandard_opt0") { << 208 if (name == "local") { >> 209 >> 210 fEmName = name; >> 211 delete fEmPhysicsList; >> 212 fEmPhysicsList = new PhysListEmStandard(name); >> 213 >> 214 } else if (name == "emstandard_opt0") { >> 215 197 fEmName = name; 216 fEmName = name; 198 delete fEmPhysicsList; 217 delete fEmPhysicsList; 199 fEmPhysicsList = new G4EmStandardPhysics() 218 fEmPhysicsList = new G4EmStandardPhysics(); 200 } << 219 201 else if (name == "emstandard_opt1") { << 220 } else if (name == "emstandard_opt1") { >> 221 202 fEmName = name; 222 fEmName = name; 203 delete fEmPhysicsList; 223 delete fEmPhysicsList; 204 fEmPhysicsList = new G4EmStandardPhysics_o 224 fEmPhysicsList = new G4EmStandardPhysics_option1(); 205 } << 225 206 else if (name == "emstandard_opt2") { << 226 } else if (name == "emstandard_opt2") { >> 227 207 fEmName = name; 228 fEmName = name; 208 delete fEmPhysicsList; 229 delete fEmPhysicsList; 209 fEmPhysicsList = new G4EmStandardPhysics_o 230 fEmPhysicsList = new G4EmStandardPhysics_option2(); 210 } << 231 211 else if (name == "emstandard_opt3") { << 232 } else if (name == "emstandard_opt3") { >> 233 212 fEmName = name; 234 fEmName = name; 213 delete fEmPhysicsList; 235 delete fEmPhysicsList; 214 fEmPhysicsList = new G4EmStandardPhysics_o 236 fEmPhysicsList = new G4EmStandardPhysics_option3(); 215 } << 237 216 else if (name == "emstandard_opt4") { << 238 } else if (name == "standardSS") { 217 fEmName = name; << 239 218 delete fEmPhysicsList; << 219 fEmPhysicsList = new G4EmStandardPhysics_o << 220 } << 221 else if (name == "standardSS") { << 222 fEmName = name; 240 fEmName = name; 223 delete fEmPhysicsList; 241 delete fEmPhysicsList; 224 fEmPhysicsList = new G4EmStandardPhysicsSS << 242 fEmPhysicsList = new PhysListEmStandardSS(name); 225 } << 243 226 else if (name == "standardGS") { << 244 } else if (name == "standardGS") { >> 245 227 fEmName = name; 246 fEmName = name; 228 delete fEmPhysicsList; 247 delete fEmPhysicsList; 229 fEmPhysicsList = new G4EmStandardPhysicsGS << 248 fEmPhysicsList = new PhysListEmStandardGS(name); 230 } << 249 231 else if (name == "standardWVI") { << 250 } else if (name == "standardWVI") { >> 251 232 fEmName = name; 252 fEmName = name; 233 delete fEmPhysicsList; 253 delete fEmPhysicsList; 234 fEmPhysicsList = new G4EmStandardPhysicsWV << 254 fEmPhysicsList = new PhysListEmStandardWVI(name); 235 } << 255 236 else { << 256 } else { >> 257 237 G4cout << "PhysicsList::AddPhysicsList: <" 258 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 238 << " is not defined" << G4endl; << 259 << " is not defined" >> 260 << G4endl; 239 } 261 } 240 } 262 } 241 263 242 //....oooOO0OOooo........oooOO0OOooo........oo 264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 265 >> 266 void PhysicsList::SetCuts() >> 267 { >> 268 >> 269 if (verboseLevel >0){ >> 270 G4cout << "PhysicsList::SetCuts:"; >> 271 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; >> 272 } >> 273 >> 274 // set cut values for gamma at first and for e- second and next for e+, >> 275 // because some processes for e+/e- need cut values for gamma >> 276 SetCutValue(fCutForGamma, "gamma"); >> 277 SetCutValue(fCutForElectron, "e-"); >> 278 SetCutValue(fCutForPositron, "e+"); >> 279 >> 280 if (verboseLevel>0) DumpCutValuesTable(); >> 281 } >> 282 >> 283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 284 >> 285 void PhysicsList::SetCutForGamma(G4double cut) >> 286 { >> 287 fCutForGamma = cut; >> 288 SetParticleCuts(fCutForGamma, G4Gamma::Gamma()); >> 289 } >> 290 >> 291 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 292 >> 293 void PhysicsList::SetCutForElectron(G4double cut) >> 294 { >> 295 fCutForElectron = cut; >> 296 SetParticleCuts(fCutForElectron, G4Electron::Electron()); >> 297 } >> 298 >> 299 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 300 >> 301 void PhysicsList::SetCutForPositron(G4double cut) >> 302 { >> 303 fCutForPositron = cut; >> 304 SetParticleCuts(fCutForPositron, G4Positron::Positron()); >> 305 } >> 306 >> 307 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 308 243 309