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