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.6 2008/11/16 21:51:43 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 "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 emOptions.SetDEDXBinningForCSDARange(8*20); >> 189 136 // decay process 190 // decay process 137 // 191 // 138 AddDecay(); 192 AddDecay(); 139 193 140 // radioactive decay Process << 141 // << 142 AddRadioactiveDecay(); << 143 << 144 // step limitation (as a full process) 194 // step limitation (as a full process) 145 // << 195 // 146 AddStepMax(); 196 AddStepMax(); 147 } 197 } 148 198 149 //....oooOO0OOooo........oooOO0OOooo........oo 199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 150 200 151 void PhysicsList::AddPhysicsList(const G4Strin 201 void PhysicsList::AddPhysicsList(const G4String& name) 152 { 202 { 153 if (verboseLevel > -1) { << 203 if (verboseLevel>-1) { 154 G4cout << "PhysicsList::AddPhysicsList: <" 204 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 155 } 205 } 156 206 157 if (name == fEmName) return; << 207 if (name == emName) return; >> 208 >> 209 if (name == "standard") { >> 210 >> 211 emName = name; >> 212 delete emPhysicsList; >> 213 emPhysicsList = new PhysListEmStandard(name); >> 214 >> 215 } else if (name == "livermore") { >> 216 >> 217 emName = name; >> 218 delete emPhysicsList; >> 219 emPhysicsList = new PhysListEmLivermore(name); >> 220 >> 221 } else if (name == "penelope") { >> 222 >> 223 emName = name; >> 224 delete emPhysicsList; >> 225 emPhysicsList = new PhysListEmPenelope(name); >> 226 >> 227 } else { 158 228 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: <" 229 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 221 << " is not defined" << G4endl; << 230 << " is not defined" >> 231 << G4endl; 222 } 232 } 223 } 233 } 224 234 225 //....oooOO0OOooo........oooOO0OOooo........oo 235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 226 236 >> 237 #include "G4Decay.hh" >> 238 227 void PhysicsList::AddDecay() 239 void PhysicsList::AddDecay() 228 { 240 { 229 // decay process 241 // decay process 230 // 242 // 231 G4Decay* decay = new G4Decay(); << 243 G4Decay* fDecayProcess = new G4Decay(); 232 G4PhysicsListHelper* ph = G4PhysicsListHelpe << 244 >> 245 theParticleIterator->reset(); >> 246 while( (*theParticleIterator)() ){ >> 247 G4ParticleDefinition* particle = theParticleIterator->value(); >> 248 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 249 >> 250 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { >> 251 >> 252 pmanager ->AddProcess(fDecayProcess); >> 253 >> 254 // set ordering for PostStepDoIt and AtRestDoIt >> 255 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); >> 256 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); 233 257 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 } 258 } 241 } 259 } 242 } 260 } >> 261 243 //....oooOO0OOooo........oooOO0OOooo........oo 262 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 244 263 245 void PhysicsList::AddRadioactiveDecay() << 264 #include "StepMax.hh" >> 265 >> 266 void PhysicsList::AddStepMax() 246 { 267 { 247 G4RadioactiveDecay* radioactiveDecay = new G << 268 // Step limitation seen as a process >> 269 stepMaxProcess = new StepMax(); >> 270 >> 271 theParticleIterator->reset(); >> 272 while ((*theParticleIterator)()){ >> 273 G4ParticleDefinition* particle = theParticleIterator->value(); >> 274 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 275 >> 276 if (stepMaxProcess->IsApplicable(*particle)) >> 277 { >> 278 pmanager ->AddDiscreteProcess(stepMaxProcess); >> 279 } >> 280 } >> 281 } >> 282 >> 283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 248 284 249 G4bool armFlag = false; << 285 #include "G4Gamma.hh" 250 radioactiveDecay->SetARM(armFlag); // Atomi << 286 #include "G4Electron.hh" >> 287 #include "G4Positron.hh" >> 288 >> 289 void PhysicsList::SetCuts() >> 290 { 251 291 252 // atomic de-excitation module, if needed << 292 if (verboseLevel >0){ 253 if (armFlag) { << 293 G4cout << "PhysicsList::SetCuts:"; 254 G4EmParameters::Instance()->SetAuger(true) << 294 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 255 G4EmParameters::Instance()->SetDeexcitatio << 256 } 295 } 257 296 258 G4PhysicsListHelper* ph = G4PhysicsListHelpe << 297 // set cut values for gamma at first and for e- second and next for e+, 259 ph->RegisterProcess(radioactiveDecay, G4Gene << 298 // because some processes for e+/e- need cut values for gamma >> 299 SetCutValue(cutForGamma, "gamma"); >> 300 SetCutValue(cutForElectron, "e-"); >> 301 SetCutValue(cutForPositron, "e+"); 260 302 261 // mandatory for G4NuclideTable << 303 if (verboseLevel>0) DumpCutValuesTable(); 262 // << 263 const G4double meanLife = 1 * picosecond, ha << 264 G4NuclideTable::GetInstance()->SetThresholdO << 265 } 304 } 266 305 267 //....oooOO0OOooo........oooOO0OOooo........oo 306 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 268 307 269 void PhysicsList::AddStepMax() << 308 void PhysicsList::SetCutForGamma(G4double cut) 270 { 309 { 271 // Step limitation seen as a process << 310 cutForGamma = cut; 272 fStepMaxProcess = new StepMax(); << 311 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 312 } 273 313 274 auto particleIterator = GetParticleIterator( << 314 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 275 particleIterator->reset(); << 276 while ((*particleIterator)()) { << 277 G4ParticleDefinition* particle = particleI << 278 G4ProcessManager* pmanager = particle->Get << 279 315 280 if (fStepMaxProcess->IsApplicable(*particl << 316 void PhysicsList::SetCutForElectron(G4double cut) 281 pmanager->AddDiscreteProcess(fStepMaxPro << 317 { 282 } << 318 cutForElectron = cut; >> 319 SetParticleCuts(cutForElectron, G4Electron::Electron()); 283 } 320 } 284 321 285 //....oooOO0OOooo........oooOO0OOooo........oo 322 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 323 >> 324 void PhysicsList::SetCutForPositron(G4double cut) >> 325 { >> 326 cutForPositron = cut; >> 327 SetParticleCuts(cutForPositron, G4Positron::Positron()); >> 328 } >> 329 >> 330 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 331 286 332