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