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