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