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.5 2006/10/25 17:27:02 maire Exp $ 27 /// \brief Implementation of the PhysicsList c << 27 // GEANT4 tag $Name: geant4-08-02-patch-01-ref $ 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 "PhysListEmLivermore.hh" 37 #include "PhysicsListMessenger.hh" << 37 #include "PhysListEmPenelope.hh" 38 38 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" 39 #include "G4LossTableManager.hh" 59 #include "G4SystemOfUnits.hh" << 60 #include "G4UnitsTable.hh" 40 #include "G4UnitsTable.hh" 61 41 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 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 43 76 PhysicsList::PhysicsList() << 44 PhysicsList::PhysicsList() : G4VModularPhysicsList() 77 { 45 { 78 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); 79 55 80 SetVerboseLevel(1); 56 SetVerboseLevel(1); 81 57 82 // EM physics 58 // EM physics 83 fEmPhysicsList = new PhysListEmStandard(fEmN << 59 emPhysicsList = new PhysListEmStandard(emName = "standard"); 84 60 85 // Em options << 86 // << 87 G4EmParameters::Instance()->SetBuildCSDARang << 88 << 89 SetDefaultCutValue(1. * mm); << 90 } 61 } 91 62 92 //....oooOO0OOooo........oooOO0OOooo........oo 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 93 64 94 PhysicsList::~PhysicsList() 65 PhysicsList::~PhysicsList() 95 { 66 { 96 delete fMessenger; << 67 delete pMessenger; 97 delete fEmPhysicsList; << 68 delete emPhysicsList; 98 } 69 } 99 70 100 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 101 72 102 void PhysicsList::ConstructParticle() << 73 // Bosons 103 { << 74 #include "G4ChargedGeantino.hh" 104 G4BosonConstructor pBosonConstructor; << 75 #include "G4Geantino.hh" 105 pBosonConstructor.ConstructParticle(); << 76 #include "G4Gamma.hh" >> 77 #include "G4OpticalPhoton.hh" >> 78 >> 79 // leptons >> 80 #include "G4MuonPlus.hh" >> 81 #include "G4MuonMinus.hh" >> 82 #include "G4NeutrinoMu.hh" >> 83 #include "G4AntiNeutrinoMu.hh" >> 84 >> 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" 106 116 107 G4LeptonConstructor pLeptonConstructor; << 117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 108 pLeptonConstructor.ConstructParticle(); << 109 << 110 G4MesonConstructor pMesonConstructor; << 111 pMesonConstructor.ConstructParticle(); << 112 118 113 G4BaryonConstructor pBaryonConstructor; << 119 void PhysicsList::ConstructParticle() 114 pBaryonConstructor.ConstructParticle(); << 120 { 115 << 121 // pseudo-particles 116 G4IonConstructor pIonConstructor; << 122 G4Geantino::GeantinoDefinition(); 117 pIonConstructor.ConstructParticle(); << 123 G4ChargedGeantino::ChargedGeantinoDefinition(); 118 << 124 119 G4ShortLivedConstructor pShortLivedConstruct << 125 // gamma 120 pShortLivedConstructor.ConstructParticle(); << 126 G4Gamma::GammaDefinition(); 121 << 127 122 // DNA << 128 // optical photon 123 G4DNAGenericIonsManager* genericIonsManager; << 129 G4OpticalPhoton::OpticalPhotonDefinition(); 124 genericIonsManager = G4DNAGenericIonsManager << 130 125 genericIonsManager->GetIon("alpha++"); << 131 // leptons 126 genericIonsManager->GetIon("alpha+"); << 132 G4Electron::ElectronDefinition(); 127 genericIonsManager->GetIon("helium"); << 133 G4Positron::PositronDefinition(); 128 genericIonsManager->GetIon("hydrogen"); << 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(); 129 } 167 } 130 168 131 //....oooOO0OOooo........oooOO0OOooo........oo 169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 132 170 133 #include "G4ProcessManager.hh" 171 #include "G4ProcessManager.hh" >> 172 #include "G4EmProcessOptions.hh" 134 173 135 void PhysicsList::ConstructProcess() 174 void PhysicsList::ConstructProcess() 136 { 175 { 137 // transportation 176 // transportation 138 // 177 // 139 AddTransportation(); 178 AddTransportation(); 140 << 179 141 // electromagnetic physics list 180 // electromagnetic physics list 142 // 181 // 143 fEmPhysicsList->ConstructProcess(); << 182 emPhysicsList->ConstructProcess(); 144 << 183 >> 184 // Em options >> 185 // >> 186 G4EmProcessOptions emOptions; >> 187 emOptions.SetBuildCSDARange(true); >> 188 145 // decay process 189 // decay process 146 // 190 // 147 AddDecay(); 191 AddDecay(); 148 << 192 149 // step limitation (as a full process) 193 // step limitation (as a full process) 150 // << 194 // 151 AddStepMax(); 195 AddStepMax(); 152 } 196 } 153 197 154 //....oooOO0OOooo........oooOO0OOooo........oo 198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 199 156 void PhysicsList::AddPhysicsList(const G4Strin 200 void PhysicsList::AddPhysicsList(const G4String& name) 157 { 201 { 158 if (verboseLevel > -1) { << 202 if (verboseLevel>-1) { 159 G4cout << "PhysicsList::AddPhysicsList: <" 203 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 160 } 204 } 161 205 162 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 { 163 227 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: <" 228 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 271 << " is not defined" << G4endl; << 229 << " is not defined" >> 230 << G4endl; 272 } 231 } 273 G4EmParameters::Instance()->SetBuildCSDARang << 274 } 232 } 275 233 276 //....oooOO0OOooo........oooOO0OOooo........oo 234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 277 235 278 #include "G4Decay.hh" 236 #include "G4Decay.hh" 279 237 280 void PhysicsList::AddDecay() 238 void PhysicsList::AddDecay() 281 { 239 { 282 // decay process 240 // decay process 283 // 241 // 284 G4Decay* fDecayProcess = new G4Decay(); 242 G4Decay* fDecayProcess = new G4Decay(); 285 243 286 auto particleIterator = GetParticleIterator( << 244 theParticleIterator->reset(); 287 particleIterator->reset(); << 245 while( (*theParticleIterator)() ){ 288 while ((*particleIterator)()) { << 246 G4ParticleDefinition* particle = theParticleIterator->value(); 289 G4ParticleDefinition* particle = particleI << 290 G4ProcessManager* pmanager = particle->Get 247 G4ProcessManager* pmanager = particle->GetProcessManager(); 291 248 292 if (fDecayProcess->IsApplicable(*particle) << 249 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 293 pmanager->AddProcess(fDecayProcess); << 250 >> 251 pmanager ->AddProcess(fDecayProcess); 294 252 295 // set ordering for PostStepDoIt and AtR 253 // set ordering for PostStepDoIt and AtRestDoIt 296 pmanager->SetProcessOrdering(fDecayProce << 254 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); 297 pmanager->SetProcessOrdering(fDecayProce << 255 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 256 298 } 257 } 299 } 258 } 300 } 259 } 301 260 302 //....oooOO0OOooo........oooOO0OOooo........oo 261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 303 262 304 #include "StepMax.hh" 263 #include "StepMax.hh" 305 264 306 void PhysicsList::AddStepMax() 265 void PhysicsList::AddStepMax() 307 { 266 { 308 // Step limitation seen as a process 267 // Step limitation seen as a process 309 fStepMaxProcess = new StepMax(); << 268 stepMaxProcess = new StepMax(); 310 269 311 auto particleIterator = GetParticleIterator( << 270 theParticleIterator->reset(); 312 particleIterator->reset(); << 271 while ((*theParticleIterator)()){ 313 while ((*particleIterator)()) { << 272 G4ParticleDefinition* particle = theParticleIterator->value(); 314 G4ParticleDefinition* particle = particleI << 273 G4ProcessManager* pmanager = particle->GetProcessManager(); 315 G4ProcessManager* pmanager = particle->Get << 274 >> 275 if (stepMaxProcess->IsApplicable(*particle)) >> 276 { >> 277 pmanager ->AddDiscreteProcess(stepMaxProcess); >> 278 } >> 279 } >> 280 } 316 281 317 if (fStepMaxProcess->IsApplicable(*particl << 282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 318 pmanager->AddDiscreteProcess(fStepMaxPro << 283 319 } << 284 #include "G4Gamma.hh" >> 285 #include "G4Electron.hh" >> 286 #include "G4Positron.hh" >> 287 >> 288 void PhysicsList::SetCuts() >> 289 { >> 290 >> 291 if (verboseLevel >0){ >> 292 G4cout << "PhysicsList::SetCuts:"; >> 293 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 320 } 294 } >> 295 >> 296 // set cut values for gamma at first and for e- second and next for e+, >> 297 // because some processes for e+/e- need cut values for gamma >> 298 SetCutValue(cutForGamma, "gamma"); >> 299 SetCutValue(cutForElectron, "e-"); >> 300 SetCutValue(cutForPositron, "e+"); >> 301 >> 302 if (verboseLevel>0) DumpCutValuesTable(); >> 303 } >> 304 >> 305 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 306 >> 307 void PhysicsList::SetCutForGamma(G4double cut) >> 308 { >> 309 cutForGamma = cut; >> 310 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 311 } >> 312 >> 313 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 314 >> 315 void PhysicsList::SetCutForElectron(G4double cut) >> 316 { >> 317 cutForElectron = cut; >> 318 SetParticleCuts(cutForElectron, G4Electron::Electron()); 321 } 319 } 322 320 323 //....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 324 331