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: PhysicsList.cc 68393 2013-03-25 14:22:21Z maire $ 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 << 79 fMessenger(0), fEmName("local"), fEmPhysicsList(0) 77 { 80 { 78 fMessenger = new PhysicsListMessenger(this); << 81 fMessenger = new PhysicsListMessenger(this); 79 << 82 80 // EM physics 83 // EM physics 81 fEmPhysicsList = new G4EmStandardPhysics(); << 84 fEmName = G4String("local"); >> 85 fEmPhysicsList = new PhysListEmStandard(fEmName); >> 86 >> 87 defaultCutValue = 1.*mm; >> 88 fCutForGamma = defaultCutValue; >> 89 fCutForElectron = defaultCutValue; >> 90 fCutForPositron = defaultCutValue; 82 91 83 SetDefaultCutValue(1. * mm); << 84 SetVerboseLevel(1); 92 SetVerboseLevel(1); 85 } 93 } 86 94 87 //....oooOO0OOooo........oooOO0OOooo........oo 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 88 96 89 PhysicsList::~PhysicsList() 97 PhysicsList::~PhysicsList() 90 { 98 { 91 delete fEmPhysicsList; 99 delete fEmPhysicsList; 92 delete fMessenger; << 100 delete fMessenger; 93 } 101 } 94 102 95 //....oooOO0OOooo........oooOO0OOooo........oo 103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 96 104 97 void PhysicsList::ConstructParticle() 105 void PhysicsList::ConstructParticle() 98 { 106 { 99 // pseudo-particles << 107 // pseudo-particles 100 G4Geantino::GeantinoDefinition(); 108 G4Geantino::GeantinoDefinition(); 101 G4ChargedGeantino::ChargedGeantinoDefinition 109 G4ChargedGeantino::ChargedGeantinoDefinition(); 102 << 110 103 // gamma << 111 // gamma 104 G4Gamma::GammaDefinition(); 112 G4Gamma::GammaDefinition(); 105 << 113 106 // optical photon << 114 // optical photon 107 G4OpticalPhoton::OpticalPhotonDefinition(); 115 G4OpticalPhoton::OpticalPhotonDefinition(); 108 116 109 // leptons << 117 // leptons 110 G4Electron::ElectronDefinition(); 118 G4Electron::ElectronDefinition(); 111 G4Positron::PositronDefinition(); 119 G4Positron::PositronDefinition(); 112 G4MuonPlus::MuonPlusDefinition(); 120 G4MuonPlus::MuonPlusDefinition(); 113 G4MuonMinus::MuonMinusDefinition(); 121 G4MuonMinus::MuonMinusDefinition(); 114 122 115 G4NeutrinoE::NeutrinoEDefinition(); 123 G4NeutrinoE::NeutrinoEDefinition(); 116 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 124 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 117 G4NeutrinoMu::NeutrinoMuDefinition(); 125 G4NeutrinoMu::NeutrinoMuDefinition(); 118 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition() << 126 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 119 127 120 // mesons << 128 // mesons 121 G4MesonConstructor mConstructor; 129 G4MesonConstructor mConstructor; 122 mConstructor.ConstructParticle(); 130 mConstructor.ConstructParticle(); 123 131 124 // barions << 132 // barions 125 G4BaryonConstructor bConstructor; 133 G4BaryonConstructor bConstructor; 126 bConstructor.ConstructParticle(); 134 bConstructor.ConstructParticle(); 127 135 128 // ions << 136 // ions 129 G4IonConstructor iConstructor; 137 G4IonConstructor iConstructor; 130 iConstructor.ConstructParticle(); 138 iConstructor.ConstructParticle(); 131 } 139 } 132 140 133 //....oooOO0OOooo........oooOO0OOooo........oo 141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 142 135 void PhysicsList::ConstructProcess() 143 void PhysicsList::ConstructProcess() 136 { 144 { 137 AddTransportation(); 145 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); 146 fEmPhysicsList->ConstructProcess(); 139 AddDecay(); << 147 AddDecay(); 140 AddStepMax(); 148 AddStepMax(); 141 } 149 } 142 150 143 //....oooOO0OOooo........oooOO0OOooo........oo 151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 144 152 >> 153 #include "G4Decay.hh" >> 154 145 void PhysicsList::AddDecay() 155 void PhysicsList::AddDecay() 146 { 156 { 147 // Add Decay Process 157 // Add Decay Process 148 158 149 G4Decay* fDecayProcess = new G4Decay(); 159 G4Decay* fDecayProcess = new G4Decay(); 150 160 151 auto particleIterator = GetParticleIterator( << 161 theParticleIterator->reset(); 152 particleIterator->reset(); << 162 while( (*theParticleIterator)() ){ 153 while ((*particleIterator)()) { << 163 G4ParticleDefinition* particle = theParticleIterator->value(); 154 G4ParticleDefinition* particle = particleI << 155 G4ProcessManager* pmanager = particle->Get 164 G4ProcessManager* pmanager = particle->GetProcessManager(); 156 165 157 if (fDecayProcess->IsApplicable(*particle) << 166 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 158 pmanager->AddProcess(fDecayProcess); << 167 >> 168 pmanager ->AddProcess(fDecayProcess); 159 169 160 // set ordering for PostStepDoIt and AtR 170 // set ordering for PostStepDoIt and AtRestDoIt 161 pmanager->SetProcessOrdering(fDecayProce << 171 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); 162 pmanager->SetProcessOrdering(fDecayProce << 172 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 173 163 } 174 } 164 } 175 } 165 } 176 } 166 177 167 //....oooOO0OOooo........oooOO0OOooo........oo 178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 168 179 >> 180 #include "StepMax.hh" >> 181 169 void PhysicsList::AddStepMax() 182 void PhysicsList::AddStepMax() 170 { 183 { 171 // Step limitation seen as a process 184 // Step limitation seen as a process 172 StepMax* stepMaxProcess = new StepMax(); 185 StepMax* stepMaxProcess = new StepMax(); 173 186 174 auto particleIterator = GetParticleIterator( << 187 theParticleIterator->reset(); 175 particleIterator->reset(); << 188 while ((*theParticleIterator)()){ 176 while ((*particleIterator)()) { << 189 G4ParticleDefinition* particle = theParticleIterator->value(); 177 G4ParticleDefinition* particle = particleI << 190 G4ProcessManager* pmanager = particle->GetProcessManager(); 178 G4ProcessManager* pmanager = particle->Get << 191 179 << 192 if (stepMaxProcess->IsApplicable(*particle)) 180 if (stepMaxProcess->IsApplicable(*particle << 193 { 181 pmanager->AddDiscreteProcess(stepMaxProc << 194 pmanager ->AddDiscreteProcess(stepMaxProcess); 182 } << 195 } 183 } 196 } 184 } 197 } 185 198 186 //....oooOO0OOooo........oooOO0OOooo........oo 199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 187 200 188 void PhysicsList::AddPhysicsList(const G4Strin 201 void PhysicsList::AddPhysicsList(const G4String& name) 189 { 202 { 190 if (verboseLevel > -1) { << 203 if (verboseLevel>-1) { 191 G4cout << "PhysicsList::AddPhysicsList: <" 204 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 192 } 205 } 193 206 194 if (name == fEmName) return; 207 if (name == fEmName) return; 195 208 196 if (name == "emstandard_opt0") { << 209 if (name == "local") { >> 210 >> 211 fEmName = name; >> 212 delete fEmPhysicsList; >> 213 fEmPhysicsList = new PhysListEmStandard(name); >> 214 >> 215 } else if (name == "emstandard_opt0") { >> 216 197 fEmName = name; 217 fEmName = name; 198 delete fEmPhysicsList; 218 delete fEmPhysicsList; 199 fEmPhysicsList = new G4EmStandardPhysics() 219 fEmPhysicsList = new G4EmStandardPhysics(); 200 } << 220 201 else if (name == "emstandard_opt1") { << 221 } else if (name == "emstandard_opt1") { >> 222 202 fEmName = name; 223 fEmName = name; 203 delete fEmPhysicsList; 224 delete fEmPhysicsList; 204 fEmPhysicsList = new G4EmStandardPhysics_o 225 fEmPhysicsList = new G4EmStandardPhysics_option1(); 205 } << 226 206 else if (name == "emstandard_opt2") { << 227 } else if (name == "emstandard_opt2") { >> 228 207 fEmName = name; 229 fEmName = name; 208 delete fEmPhysicsList; 230 delete fEmPhysicsList; 209 fEmPhysicsList = new G4EmStandardPhysics_o 231 fEmPhysicsList = new G4EmStandardPhysics_option2(); 210 } << 232 211 else if (name == "emstandard_opt3") { << 233 } else if (name == "emstandard_opt3") { >> 234 212 fEmName = name; 235 fEmName = name; 213 delete fEmPhysicsList; 236 delete fEmPhysicsList; 214 fEmPhysicsList = new G4EmStandardPhysics_o 237 fEmPhysicsList = new G4EmStandardPhysics_option3(); 215 } << 238 216 else if (name == "emstandard_opt4") { << 239 } else if (name == "standardSS") { 217 fEmName = name; << 240 218 delete fEmPhysicsList; << 219 fEmPhysicsList = new G4EmStandardPhysics_o << 220 } << 221 else if (name == "standardSS") { << 222 fEmName = name; 241 fEmName = name; 223 delete fEmPhysicsList; 242 delete fEmPhysicsList; 224 fEmPhysicsList = new G4EmStandardPhysicsSS << 243 fEmPhysicsList = new PhysListEmStandardSS(name); 225 } << 244 226 else if (name == "standardGS") { << 245 } else if (name == "standardGS") { >> 246 227 fEmName = name; 247 fEmName = name; 228 delete fEmPhysicsList; 248 delete fEmPhysicsList; 229 fEmPhysicsList = new G4EmStandardPhysicsGS << 249 fEmPhysicsList = new PhysListEmStandardGS(name); 230 } << 250 231 else if (name == "standardWVI") { << 251 } else if (name == "standardWVI") { >> 252 232 fEmName = name; 253 fEmName = name; 233 delete fEmPhysicsList; 254 delete fEmPhysicsList; 234 fEmPhysicsList = new G4EmStandardPhysicsWV << 255 fEmPhysicsList = new PhysListEmStandardWVI(name); 235 } << 256 236 else { << 257 } else { >> 258 237 G4cout << "PhysicsList::AddPhysicsList: <" 259 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 238 << " is not defined" << G4endl; << 260 << " is not defined" >> 261 << G4endl; 239 } 262 } 240 } 263 } 241 264 242 //....oooOO0OOooo........oooOO0OOooo........oo 265 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 266 >> 267 void PhysicsList::SetCuts() >> 268 { >> 269 >> 270 if (verboseLevel >0){ >> 271 G4cout << "PhysicsList::SetCuts:"; >> 272 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; >> 273 } >> 274 >> 275 // set cut values for gamma at first and for e- second and next for e+, >> 276 // because some processes for e+/e- need cut values for gamma >> 277 SetCutValue(fCutForGamma, "gamma"); >> 278 SetCutValue(fCutForElectron, "e-"); >> 279 SetCutValue(fCutForPositron, "e+"); >> 280 >> 281 if (verboseLevel>0) DumpCutValuesTable(); >> 282 } >> 283 >> 284 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 285 >> 286 void PhysicsList::SetCutForGamma(G4double cut) >> 287 { >> 288 fCutForGamma = cut; >> 289 SetParticleCuts(fCutForGamma, G4Gamma::Gamma()); >> 290 } >> 291 >> 292 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 293 >> 294 void PhysicsList::SetCutForElectron(G4double cut) >> 295 { >> 296 fCutForElectron = cut; >> 297 SetParticleCuts(fCutForElectron, G4Electron::Electron()); >> 298 } >> 299 >> 300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 301 >> 302 void PhysicsList::SetCutForPositron(G4double cut) >> 303 { >> 304 fCutForPositron = cut; >> 305 SetParticleCuts(fCutForPositron, G4Positron::Positron()); >> 306 } >> 307 >> 308 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 309 243 310