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