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