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 PhysicsList.cc << 26 /// \file electromagnetic/TestEm3/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id: PhysicsList.cc 67268 2013-02-13 11:38:40Z ihrivnac $ 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" >> 35 #include "PhysicsListMessenger.hh" 34 36 35 #include "PhysListEmStandard.hh" 37 #include "PhysListEmStandard.hh" 36 #include "PhysicsListMessenger.hh" << 38 #include "PhysListEmStandardWVI.hh" 37 #include "StepMax.hh" << 38 39 39 #include "G4DecayPhysics.hh" << 40 #include "G4EmDNAPhysics.hh" << 41 #include "G4EmDNAPhysics_option2.hh" << 42 #include "G4EmDNAPhysics_option4.hh" << 43 #include "G4EmDNAPhysics_option6.hh" << 44 #include "G4EmLivermorePhysics.hh" << 45 #include "G4EmLowEPPhysics.hh" << 46 #include "G4EmPenelopePhysics.hh" << 47 #include "G4EmStandardPhysics.hh" 40 #include "G4EmStandardPhysics.hh" 48 #include "G4EmStandardPhysicsGS.hh" << 49 #include "G4EmStandardPhysicsSS.hh" << 50 #include "G4EmStandardPhysicsWVI.hh" << 51 #include "G4EmStandardPhysics_option1.hh" 41 #include "G4EmStandardPhysics_option1.hh" 52 #include "G4EmStandardPhysics_option2.hh" 42 #include "G4EmStandardPhysics_option2.hh" 53 #include "G4EmStandardPhysics_option3.hh" 43 #include "G4EmStandardPhysics_option3.hh" 54 #include "G4EmStandardPhysics_option4.hh" 44 #include "G4EmStandardPhysics_option4.hh" 55 #include "G4HadronElasticPhysics.hh" << 45 #include "G4EmLivermorePhysics.hh" 56 #include "G4ParticleDefinition.hh" << 46 #include "G4EmPenelopePhysics.hh" 57 #include "G4ProcessManager.hh" << 58 #include "G4SystemOfUnits.hh" << 59 #include "G4UnitsTable.hh" << 60 << 61 // particles << 62 47 63 #include "G4BaryonConstructor.hh" << 48 #include "G4UnitsTable.hh" 64 #include "G4BosonConstructor.hh" << 49 #include "G4SystemOfUnits.hh" 65 #include "G4DNAGenericIonsManager.hh" << 66 #include "G4IonConstructor.hh" << 67 #include "G4LeptonConstructor.hh" << 68 #include "G4MesonConstructor.hh" << 69 #include "G4ShortLivedConstructor.hh" << 70 50 71 //....oooOO0OOooo........oooOO0OOooo........oo 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 52 73 PhysicsList::PhysicsList() << 53 PhysicsList::PhysicsList() : G4VModularPhysicsList(), >> 54 fEmPhysicsList(0), >> 55 fStepMaxProcess(0), >> 56 fMessenger(0) 74 { 57 { >> 58 fCurrentDefaultCut = 1.0*mm; >> 59 fCutForGamma = fCurrentDefaultCut; >> 60 fCutForElectron = fCurrentDefaultCut; >> 61 fCutForPositron = fCurrentDefaultCut; >> 62 75 fMessenger = new PhysicsListMessenger(this); 63 fMessenger = new PhysicsListMessenger(this); >> 64 76 SetVerboseLevel(1); 65 SetVerboseLevel(1); 77 66 78 // EM physics 67 // EM physics 79 fEmName = G4String("emstandard_opt4"); << 68 fEmName = G4String("local"); 80 fEmPhysicsList = new G4EmStandardPhysics_opt << 69 fEmPhysicsList = new PhysListEmStandard(fEmName); 81 70 82 // Decay physics << 83 fDecayPhysics = new G4DecayPhysics(1); << 84 << 85 SetDefaultCutValue(1 * mm); << 86 } 71 } 87 72 88 //....oooOO0OOooo........oooOO0OOooo........oo 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 89 74 90 PhysicsList::~PhysicsList() 75 PhysicsList::~PhysicsList() 91 { 76 { 92 delete fEmPhysicsList; << 93 delete fMessenger; 77 delete fMessenger; 94 } 78 } 95 79 96 //....oooOO0OOooo........oooOO0OOooo........oo 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 97 81 >> 82 // Bosons >> 83 #include "G4ChargedGeantino.hh" >> 84 #include "G4Geantino.hh" >> 85 #include "G4Gamma.hh" >> 86 #include "G4OpticalPhoton.hh" >> 87 >> 88 // leptons >> 89 #include "G4MuonPlus.hh" >> 90 #include "G4MuonMinus.hh" >> 91 #include "G4NeutrinoMu.hh" >> 92 #include "G4AntiNeutrinoMu.hh" >> 93 >> 94 #include "G4Electron.hh" >> 95 #include "G4Positron.hh" >> 96 #include "G4NeutrinoE.hh" >> 97 #include "G4AntiNeutrinoE.hh" >> 98 >> 99 // Mesons >> 100 #include "G4PionPlus.hh" >> 101 #include "G4PionMinus.hh" >> 102 #include "G4PionZero.hh" >> 103 #include "G4Eta.hh" >> 104 #include "G4EtaPrime.hh" >> 105 >> 106 #include "G4KaonPlus.hh" >> 107 #include "G4KaonMinus.hh" >> 108 #include "G4KaonZero.hh" >> 109 #include "G4AntiKaonZero.hh" >> 110 #include "G4KaonZeroLong.hh" >> 111 #include "G4KaonZeroShort.hh" >> 112 >> 113 // Baryons >> 114 #include "G4Proton.hh" >> 115 #include "G4AntiProton.hh" >> 116 #include "G4Neutron.hh" >> 117 #include "G4AntiNeutron.hh" >> 118 >> 119 // Nuclei >> 120 #include "G4Deuteron.hh" >> 121 #include "G4Triton.hh" >> 122 #include "G4Alpha.hh" >> 123 #include "G4GenericIon.hh" >> 124 98 void PhysicsList::ConstructParticle() 125 void PhysicsList::ConstructParticle() 99 { 126 { 100 G4BosonConstructor pBosonConstructor; << 127 // pseudo-particles 101 pBosonConstructor.ConstructParticle(); << 128 G4Geantino::GeantinoDefinition(); 102 << 129 G4ChargedGeantino::ChargedGeantinoDefinition(); 103 G4LeptonConstructor pLeptonConstructor; << 130 104 pLeptonConstructor.ConstructParticle(); << 131 // gamma 105 << 132 G4Gamma::GammaDefinition(); 106 G4MesonConstructor pMesonConstructor; << 133 107 pMesonConstructor.ConstructParticle(); << 134 // optical photon 108 << 135 G4OpticalPhoton::OpticalPhotonDefinition(); 109 G4BaryonConstructor pBaryonConstructor; << 136 110 pBaryonConstructor.ConstructParticle(); << 137 // leptons 111 << 138 G4Electron::ElectronDefinition(); 112 G4IonConstructor pIonConstructor; << 139 G4Positron::PositronDefinition(); 113 pIonConstructor.ConstructParticle(); << 140 G4MuonPlus::MuonPlusDefinition(); 114 << 141 G4MuonMinus::MuonMinusDefinition(); 115 G4ShortLivedConstructor sLivedConstructor; << 142 116 sLivedConstructor.ConstructParticle(); << 143 G4NeutrinoE::NeutrinoEDefinition(); 117 << 144 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 118 // Geant4-DNA << 145 G4NeutrinoMu::NeutrinoMuDefinition(); 119 << 146 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 120 G4DNAGenericIonsManager* genericIonsManager; << 147 121 genericIonsManager = G4DNAGenericIonsManager << 148 // mesons 122 genericIonsManager->GetIon("alpha++"); << 149 G4PionPlus::PionPlusDefinition(); 123 genericIonsManager->GetIon("alpha+"); << 150 G4PionMinus::PionMinusDefinition(); 124 genericIonsManager->GetIon("helium"); << 151 G4PionZero::PionZeroDefinition(); 125 genericIonsManager->GetIon("hydrogen"); << 152 G4Eta::EtaDefinition(); >> 153 G4EtaPrime::EtaPrimeDefinition(); >> 154 G4KaonPlus::KaonPlusDefinition(); >> 155 G4KaonMinus::KaonMinusDefinition(); >> 156 G4KaonZero::KaonZeroDefinition(); >> 157 G4AntiKaonZero::AntiKaonZeroDefinition(); >> 158 G4KaonZeroLong::KaonZeroLongDefinition(); >> 159 G4KaonZeroShort::KaonZeroShortDefinition(); >> 160 >> 161 // barions >> 162 G4Proton::ProtonDefinition(); >> 163 G4AntiProton::AntiProtonDefinition(); >> 164 G4Neutron::NeutronDefinition(); >> 165 G4AntiNeutron::AntiNeutronDefinition(); >> 166 >> 167 // ions >> 168 G4Deuteron::DeuteronDefinition(); >> 169 G4Triton::TritonDefinition(); >> 170 G4Alpha::AlphaDefinition(); >> 171 G4GenericIon::GenericIonDefinition(); 126 } 172 } 127 173 128 //....oooOO0OOooo........oooOO0OOooo........oo 174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 175 >> 176 #include "G4ProcessManager.hh" >> 177 #include "G4Decay.hh" >> 178 130 void PhysicsList::ConstructProcess() 179 void PhysicsList::ConstructProcess() 131 { 180 { 132 AddTransportation(); 181 AddTransportation(); >> 182 >> 183 // electromagnetic Physics List >> 184 // 133 fEmPhysicsList->ConstructProcess(); 185 fEmPhysicsList->ConstructProcess(); 134 fDecayPhysics->ConstructProcess(); << 135 if (fHadPhysicsList) { << 136 fHadPhysicsList->ConstructProcess(); << 137 } << 138 AddStepMax(); << 139 } << 140 186 141 //....oooOO0OOooo........oooOO0OOooo........oo << 187 // Add Decay Process >> 188 // >> 189 G4Decay* fDecayProcess = new G4Decay(); >> 190 >> 191 theParticleIterator->reset(); >> 192 while( (*theParticleIterator)() ){ >> 193 G4ParticleDefinition* particle = theParticleIterator->value(); >> 194 G4ProcessManager* pmanager = particle->GetProcessManager(); 142 195 143 void PhysicsList::AddStepMax() << 196 if (fDecayProcess->IsApplicable(*particle)) { 144 { << 145 // Step limitation seen as a process << 146 StepMax* stepMaxProcess = new StepMax(); << 147 197 148 auto particleIterator = GetParticleIterator( << 198 pmanager ->AddProcess(fDecayProcess); 149 particleIterator->reset(); << 199 150 while ((*particleIterator)()) { << 200 // set ordering for PostStepDoIt and AtRestDoIt 151 G4ParticleDefinition* particle = particleI << 201 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); 152 G4ProcessManager* pmanager = particle->Get << 202 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); 153 203 154 if (stepMaxProcess->IsApplicable(*particle << 155 pmanager->AddDiscreteProcess(stepMaxProc << 156 } 204 } 157 } 205 } >> 206 >> 207 // stepLimitation (as a full process) >> 208 // >> 209 AddStepMax(); 158 } 210 } 159 211 160 //....oooOO0OOooo........oooOO0OOooo........oo 212 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 161 213 162 void PhysicsList::AddPhysicsList(const G4Strin 214 void PhysicsList::AddPhysicsList(const G4String& name) 163 { 215 { 164 if (verboseLevel > -1) { << 216 if (verboseLevel>1) { 165 G4cout << "PhysicsList::AddPhysicsList: <" 217 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 166 } 218 } 167 219 168 if (name == fEmName) return; 220 if (name == fEmName) return; 169 221 170 if (name == "local") { 222 if (name == "local") { >> 223 171 fEmName = name; 224 fEmName = name; 172 delete fEmPhysicsList; 225 delete fEmPhysicsList; 173 fEmPhysicsList = new PhysListEmStandard(na 226 fEmPhysicsList = new PhysListEmStandard(name); 174 } << 227 175 else if (name == "emstandard_opt0") { << 228 } else if (name == "emstandard_opt0") { >> 229 176 fEmName = name; 230 fEmName = name; 177 delete fEmPhysicsList; 231 delete fEmPhysicsList; 178 fEmPhysicsList = new G4EmStandardPhysics() 232 fEmPhysicsList = new G4EmStandardPhysics(); 179 } << 233 180 else if (name == "emstandard_opt1") { << 234 } else if (name == "emstandard_opt1") { >> 235 181 fEmName = name; 236 fEmName = name; 182 delete fEmPhysicsList; 237 delete fEmPhysicsList; 183 fEmPhysicsList = new G4EmStandardPhysics_o 238 fEmPhysicsList = new G4EmStandardPhysics_option1(); 184 } << 239 185 else if (name == "emstandard_opt2") { << 240 } else if (name == "emstandard_opt2") { >> 241 186 fEmName = name; 242 fEmName = name; 187 delete fEmPhysicsList; 243 delete fEmPhysicsList; 188 fEmPhysicsList = new G4EmStandardPhysics_o 244 fEmPhysicsList = new G4EmStandardPhysics_option2(); 189 } << 245 190 else if (name == "emstandard_opt3") { << 246 } else if (name == "emstandard_opt3") { >> 247 191 fEmName = name; 248 fEmName = name; 192 delete fEmPhysicsList; 249 delete fEmPhysicsList; 193 fEmPhysicsList = new G4EmStandardPhysics_o 250 fEmPhysicsList = new G4EmStandardPhysics_option3(); 194 } << 251 195 else if (name == "emstandard_opt4") { << 252 } else if (name == "emstandard_opt4") { 196 fEmName = name; << 253 197 delete fEmPhysicsList; << 198 fEmPhysicsList = new G4EmStandardPhysics_o << 199 } << 200 else if (name == "emstandardSS") { << 201 fEmName = name; << 202 delete fEmPhysicsList; << 203 fEmPhysicsList = new G4EmStandardPhysicsSS << 204 } << 205 else if (name == "emstandardWVI") { << 206 fEmName = name; << 207 delete fEmPhysicsList; << 208 fEmPhysicsList = new G4EmStandardPhysicsWV << 209 } << 210 else if (name == "emstandardGS") { << 211 fEmName = name; << 212 delete fEmPhysicsList; << 213 fEmPhysicsList = new G4EmStandardPhysicsGS << 214 } << 215 else if (name == "empenelope") { << 216 fEmName = name; 254 fEmName = name; 217 delete fEmPhysicsList; 255 delete fEmPhysicsList; 218 fEmPhysicsList = new G4EmPenelopePhysics() << 256 fEmPhysicsList = new G4EmStandardPhysics_option4(); 219 } << 257 220 else if (name == "emlowenergy") { << 258 } else if (name == "standardWVI") { >> 259 221 fEmName = name; 260 fEmName = name; 222 delete fEmPhysicsList; 261 delete fEmPhysicsList; 223 fEmPhysicsList = new G4EmLowEPPhysics(); << 262 fEmPhysicsList = new PhysListEmStandardWVI(name); 224 } << 263 225 else if (name == "emlivermore") { << 264 } else if (name == "emlivermore") { >> 265 226 fEmName = name; 266 fEmName = name; 227 delete fEmPhysicsList; 267 delete fEmPhysicsList; 228 fEmPhysicsList = new G4EmLivermorePhysics( 268 fEmPhysicsList = new G4EmLivermorePhysics(); 229 } << 269 230 else if (name == "dna") { << 270 } else if (name == "empenelope") { 231 fEmName = name; << 271 232 delete fEmPhysicsList; << 233 fEmPhysicsList = new G4EmDNAPhysics(); << 234 } << 235 else if (name == "dna_opt2") { << 236 fEmName = name; << 237 delete fEmPhysicsList; << 238 fEmPhysicsList = new G4EmDNAPhysics_option << 239 } << 240 else if (name == "dna_opt4") { << 241 fEmName = name; << 242 delete fEmPhysicsList; << 243 fEmPhysicsList = new G4EmDNAPhysics_option << 244 } << 245 else if (name == "dna_opt6") { << 246 fEmName = name; 272 fEmName = name; 247 delete fEmPhysicsList; 273 delete fEmPhysicsList; 248 fEmPhysicsList = new G4EmDNAPhysics_option << 274 fEmPhysicsList = new G4EmPenelopePhysics(); 249 } << 275 250 else if (name == "had_elastic" && !fHadPhysi << 276 } else { 251 fHadPhysicsList = new G4HadronElasticPhysi << 277 252 } << 253 else { << 254 G4cout << "PhysicsList::AddPhysicsList: <" 278 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 255 << " is not defined" << G4endl; << 279 << " is not defined" >> 280 << G4endl; 256 } 281 } 257 } 282 } 258 283 259 //....oooOO0OOooo........oooOO0OOooo........oo 284 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 285 >> 286 #include "StepMax.hh" >> 287 >> 288 void PhysicsList::AddStepMax() >> 289 { >> 290 // Step limitation seen as a process >> 291 fStepMaxProcess = new StepMax(); >> 292 >> 293 theParticleIterator->reset(); >> 294 while ((*theParticleIterator)()){ >> 295 G4ParticleDefinition* particle = theParticleIterator->value(); >> 296 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 297 >> 298 if (fStepMaxProcess->IsApplicable(*particle)) >> 299 { >> 300 pmanager ->AddDiscreteProcess(fStepMaxProcess); >> 301 } >> 302 } >> 303 } >> 304 >> 305 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 306 >> 307 void PhysicsList::SetCuts() >> 308 { >> 309 if (verboseLevel >0) { >> 310 G4cout << "PhysicsList::SetCuts:"; >> 311 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; >> 312 } >> 313 >> 314 // set cut values for gamma at first and for e- second and next for e+, >> 315 // because some processes for e+/e- need cut values for gamma >> 316 SetCutValue(fCutForGamma, "gamma"); >> 317 SetCutValue(fCutForElectron, "e-"); >> 318 SetCutValue(fCutForPositron, "e+"); >> 319 >> 320 // Cut for proton not used in EM processes except single scattering >> 321 // so electron cut is used in this example >> 322 SetCutValue(fCutForElectron, "proton"); >> 323 >> 324 if (verboseLevel>0) DumpCutValuesTable(); >> 325 } >> 326 >> 327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 328 >> 329 void PhysicsList::SetCutForGamma(G4double cut) >> 330 { >> 331 fCutForGamma = cut; >> 332 SetParticleCuts(fCutForGamma, G4Gamma::Gamma()); >> 333 } >> 334 >> 335 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 336 >> 337 void PhysicsList::SetCutForElectron(G4double cut) >> 338 { >> 339 fCutForElectron = cut; >> 340 SetParticleCuts(fCutForElectron, G4Electron::Electron()); >> 341 } >> 342 >> 343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 344 >> 345 void PhysicsList::SetCutForPositron(G4double cut) >> 346 { >> 347 fCutForPositron = cut; >> 348 SetParticleCuts(fCutForPositron, G4Positron::Positron()); >> 349 } >> 350 >> 351 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 352 260 353