Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file electromagnetic/TestEm11/src/Physics << 23 // $Id: PhysicsList.cc,v 1.2 2005/10/05 11:57:57 maire Exp $ 27 /// \brief Implementation of the PhysicsList c << 24 // GEANT4 tag $Name: geant4-08-00 $ 28 // << 29 // 25 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 28 33 #include "PhysicsList.hh" 29 #include "PhysicsList.hh" >> 30 #include "PhysicsListMessenger.hh" 34 31 35 #include "PhysListEmStandard.hh" 32 #include "PhysListEmStandard.hh" 36 #include "PhysicsListMessenger.hh" << 33 #include "PhysListEmG4v52.hh" >> 34 #include "PhysListEmG4v71.hh" 37 35 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" 36 #include "G4LossTableManager.hh" 50 #include "G4SystemOfUnits.hh" << 51 #include "G4UnitsTable.hh" 37 #include "G4UnitsTable.hh" 52 38 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 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 40 73 PhysicsList::PhysicsList() << 41 PhysicsList::PhysicsList() : G4VModularPhysicsList() 74 { 42 { 75 fMessenger = new PhysicsListMessenger(this); << 43 G4LossTableManager::Instance(); >> 44 defaultCutValue = 1.*mm; >> 45 cutForGamma = defaultCutValue; >> 46 cutForElectron = defaultCutValue; >> 47 cutForPositron = defaultCutValue; >> 48 >> 49 stepMaxProcess = 0; >> 50 >> 51 pMessenger = new PhysicsListMessenger(this); 76 52 77 SetVerboseLevel(1); 53 SetVerboseLevel(1); 78 54 79 // EM physics 55 // EM physics 80 fEmPhysicsList = new PhysListEmStandard(fEmN << 56 emPhysicsList = new PhysListEmStandard(emName = "standard"); 81 57 82 G4LossTableManager::Instance(); << 83 SetDefaultCutValue(1. * mm); << 84 } 58 } 85 59 86 //....oooOO0OOooo........oooOO0OOooo........oo 60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 87 61 88 PhysicsList::~PhysicsList() 62 PhysicsList::~PhysicsList() 89 { 63 { 90 delete fMessenger; << 64 delete pMessenger; 91 delete fEmPhysicsList; << 65 delete emPhysicsList; 92 } 66 } 93 67 94 //....oooOO0OOooo........oooOO0OOooo........oo 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 95 69 96 void PhysicsList::ConstructParticle() << 70 // Bosons 97 { << 71 #include "G4ChargedGeantino.hh" 98 G4BosonConstructor pBosonConstructor; << 72 #include "G4Geantino.hh" 99 pBosonConstructor.ConstructParticle(); << 73 #include "G4Gamma.hh" 100 << 74 #include "G4OpticalPhoton.hh" 101 G4LeptonConstructor pLeptonConstructor; << 75 102 pLeptonConstructor.ConstructParticle(); << 76 // leptons 103 << 77 #include "G4MuonPlus.hh" 104 G4MesonConstructor pMesonConstructor; << 78 #include "G4MuonMinus.hh" 105 pMesonConstructor.ConstructParticle(); << 79 #include "G4NeutrinoMu.hh" 106 << 80 #include "G4AntiNeutrinoMu.hh" 107 G4BaryonConstructor pBaryonConstructor; << 81 108 pBaryonConstructor.ConstructParticle(); << 82 #include "G4Electron.hh" >> 83 #include "G4Positron.hh" >> 84 #include "G4NeutrinoE.hh" >> 85 #include "G4AntiNeutrinoE.hh" >> 86 >> 87 // Mesons >> 88 #include "G4PionPlus.hh" >> 89 #include "G4PionMinus.hh" >> 90 #include "G4PionZero.hh" >> 91 #include "G4Eta.hh" >> 92 #include "G4EtaPrime.hh" >> 93 >> 94 #include "G4KaonPlus.hh" >> 95 #include "G4KaonMinus.hh" >> 96 #include "G4KaonZero.hh" >> 97 #include "G4AntiKaonZero.hh" >> 98 #include "G4KaonZeroLong.hh" >> 99 #include "G4KaonZeroShort.hh" >> 100 >> 101 // Baryons >> 102 #include "G4Proton.hh" >> 103 #include "G4AntiProton.hh" >> 104 #include "G4Neutron.hh" >> 105 #include "G4AntiNeutron.hh" >> 106 >> 107 // Nuclei >> 108 #include "G4Alpha.hh" >> 109 #include "G4Deuteron.hh" >> 110 #include "G4Triton.hh" >> 111 #include "G4He3.hh" >> 112 #include "G4GenericIon.hh" 109 113 110 G4IonConstructor pIonConstructor; << 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 111 pIonConstructor.ConstructParticle(); << 112 115 113 G4ShortLivedConstructor pShortLivedConstruct << 116 void PhysicsList::ConstructParticle() 114 pShortLivedConstructor.ConstructParticle(); << 117 { >> 118 // pseudo-particles >> 119 G4Geantino::GeantinoDefinition(); >> 120 G4ChargedGeantino::ChargedGeantinoDefinition(); >> 121 >> 122 // gamma >> 123 G4Gamma::GammaDefinition(); >> 124 >> 125 // optical photon >> 126 G4OpticalPhoton::OpticalPhotonDefinition(); >> 127 >> 128 // leptons >> 129 G4Electron::ElectronDefinition(); >> 130 G4Positron::PositronDefinition(); >> 131 G4MuonPlus::MuonPlusDefinition(); >> 132 G4MuonMinus::MuonMinusDefinition(); >> 133 >> 134 G4NeutrinoE::NeutrinoEDefinition(); >> 135 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); >> 136 G4NeutrinoMu::NeutrinoMuDefinition(); >> 137 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); >> 138 >> 139 // mesons >> 140 G4PionPlus::PionPlusDefinition(); >> 141 G4PionMinus::PionMinusDefinition(); >> 142 G4PionZero::PionZeroDefinition(); >> 143 G4Eta::EtaDefinition(); >> 144 G4EtaPrime::EtaPrimeDefinition(); >> 145 G4KaonPlus::KaonPlusDefinition(); >> 146 G4KaonMinus::KaonMinusDefinition(); >> 147 G4KaonZero::KaonZeroDefinition(); >> 148 G4AntiKaonZero::AntiKaonZeroDefinition(); >> 149 G4KaonZeroLong::KaonZeroLongDefinition(); >> 150 G4KaonZeroShort::KaonZeroShortDefinition(); >> 151 >> 152 // barions >> 153 G4Proton::ProtonDefinition(); >> 154 G4AntiProton::AntiProtonDefinition(); >> 155 G4Neutron::NeutronDefinition(); >> 156 G4AntiNeutron::AntiNeutronDefinition(); >> 157 >> 158 // ions >> 159 G4Deuteron::DeuteronDefinition(); >> 160 G4Triton::TritonDefinition(); >> 161 G4He3::He3Definition(); >> 162 G4Alpha::AlphaDefinition(); >> 163 G4GenericIon::GenericIonDefinition(); 115 } 164 } 116 165 117 //....oooOO0OOooo........oooOO0OOooo........oo 166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 118 167 119 #include "G4ProcessManager.hh" 168 #include "G4ProcessManager.hh" >> 169 #include "G4Decay.hh" 120 170 121 void PhysicsList::ConstructProcess() 171 void PhysicsList::ConstructProcess() 122 { 172 { 123 // transportation 173 // transportation 124 // 174 // 125 AddTransportation(); 175 AddTransportation(); 126 << 176 127 // electromagnetic physics list 177 // electromagnetic physics list 128 // 178 // 129 fEmPhysicsList->ConstructProcess(); << 179 emPhysicsList->ConstructProcess(); 130 << 131 // Em options << 132 // << 133 G4EmParameters* param = G4EmParameters::Inst << 134 param->SetBuildCSDARange(true); << 135 180 136 // decay process 181 // decay process 137 // 182 // 138 AddDecay(); << 183 G4Decay* fDecayProcess = new G4Decay(); 139 184 140 // radioactive decay Process << 185 theParticleIterator->reset(); 141 // << 186 while( (*theParticleIterator)() ){ 142 AddRadioactiveDecay(); << 187 G4ParticleDefinition* particle = theParticleIterator->value(); >> 188 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 189 >> 190 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { >> 191 >> 192 pmanager ->AddProcess(fDecayProcess); 143 193 >> 194 // set ordering for PostStepDoIt and AtRestDoIt >> 195 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); >> 196 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 197 >> 198 } >> 199 } >> 200 144 // step limitation (as a full process) 201 // step limitation (as a full process) 145 // << 202 // 146 AddStepMax(); 203 AddStepMax(); 147 } 204 } 148 205 149 //....oooOO0OOooo........oooOO0OOooo........oo 206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 150 207 151 void PhysicsList::AddPhysicsList(const G4Strin 208 void PhysicsList::AddPhysicsList(const G4String& name) 152 { 209 { 153 if (verboseLevel > -1) { << 210 if (verboseLevel>-1) { 154 G4cout << "PhysicsList::AddPhysicsList: <" 211 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 155 } 212 } 156 213 157 if (name == fEmName) return; << 214 if (name == emName) return; >> 215 >> 216 if (name == "standard") { >> 217 >> 218 emName = name; >> 219 delete emPhysicsList; >> 220 emPhysicsList = new PhysListEmStandard(name); >> 221 >> 222 } else if (name == "g4v52") { >> 223 >> 224 emName = name; >> 225 delete emPhysicsList; >> 226 emPhysicsList = new PhysListEmG4v52(name); >> 227 >> 228 } else if (name == "g4v71") { >> 229 >> 230 emName = name; >> 231 delete emPhysicsList; >> 232 emPhysicsList = new PhysListEmG4v71(name); >> 233 >> 234 } else { 158 235 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: <" 236 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 221 << " is not defined" << G4endl; << 237 << " is not defined" >> 238 << G4endl; 222 } 239 } 223 } 240 } 224 241 225 //....oooOO0OOooo........oooOO0OOooo........oo 242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 226 243 227 void PhysicsList::AddDecay() << 244 #include "StepMax.hh" >> 245 >> 246 void PhysicsList::AddStepMax() 228 { 247 { 229 // decay process << 248 // Step limitation seen as a process 230 // << 249 stepMaxProcess = new StepMax(); 231 G4Decay* decay = new G4Decay(); << 232 G4PhysicsListHelper* ph = G4PhysicsListHelpe << 233 250 234 auto particleIterator = GetParticleIterator( << 251 theParticleIterator->reset(); 235 particleIterator->reset(); << 252 while ((*theParticleIterator)()){ 236 while ((*particleIterator)()) { << 253 G4ParticleDefinition* particle = theParticleIterator->value(); 237 G4ParticleDefinition* particle = particleI << 254 G4ProcessManager* pmanager = particle->GetProcessManager(); 238 if (decay->IsApplicable(*particle) && !par << 255 239 ph->RegisterProcess(decay, particle); << 256 if (stepMaxProcess->IsApplicable(*particle)) 240 } << 257 { >> 258 pmanager ->AddDiscreteProcess(stepMaxProcess); >> 259 } 241 } 260 } 242 } 261 } >> 262 243 //....oooOO0OOooo........oooOO0OOooo........oo 263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 244 264 245 void PhysicsList::AddRadioactiveDecay() << 265 #include "G4Gamma.hh" 246 { << 266 #include "G4Electron.hh" 247 G4RadioactiveDecay* radioactiveDecay = new G << 267 #include "G4Positron.hh" 248 268 249 G4bool armFlag = false; << 269 void PhysicsList::SetCuts() 250 radioactiveDecay->SetARM(armFlag); // Atomi << 270 { 251 271 252 // atomic de-excitation module, if needed << 272 if (verboseLevel >0){ 253 if (armFlag) { << 273 G4cout << "PhysicsList::SetCuts:"; 254 G4EmParameters::Instance()->SetAuger(true) << 274 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 255 G4EmParameters::Instance()->SetDeexcitatio << 256 } 275 } 257 276 258 G4PhysicsListHelper* ph = G4PhysicsListHelpe << 277 // set cut values for gamma at first and for e- second and next for e+, 259 ph->RegisterProcess(radioactiveDecay, G4Gene << 278 // because some processes for e+/e- need cut values for gamma >> 279 SetCutValue(cutForGamma, "gamma"); >> 280 SetCutValue(cutForElectron, "e-"); >> 281 SetCutValue(cutForPositron, "e+"); 260 282 261 // mandatory for G4NuclideTable << 283 if (verboseLevel>0) DumpCutValuesTable(); 262 // << 263 const G4double meanLife = 1 * picosecond, ha << 264 G4NuclideTable::GetInstance()->SetThresholdO << 265 } 284 } 266 285 267 //....oooOO0OOooo........oooOO0OOooo........oo 286 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 268 287 269 void PhysicsList::AddStepMax() << 288 void PhysicsList::SetCutForGamma(G4double cut) 270 { 289 { 271 // Step limitation seen as a process << 290 cutForGamma = cut; 272 fStepMaxProcess = new StepMax(); << 291 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 292 } 273 293 274 auto particleIterator = GetParticleIterator( << 294 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 275 particleIterator->reset(); << 276 while ((*particleIterator)()) { << 277 G4ParticleDefinition* particle = particleI << 278 G4ProcessManager* pmanager = particle->Get << 279 295 280 if (fStepMaxProcess->IsApplicable(*particl << 296 void PhysicsList::SetCutForElectron(G4double cut) 281 pmanager->AddDiscreteProcess(fStepMaxPro << 297 { 282 } << 298 cutForElectron = cut; >> 299 SetParticleCuts(cutForElectron, G4Electron::Electron()); 283 } 300 } 284 301 285 //....oooOO0OOooo........oooOO0OOooo........oo 302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 303 >> 304 void PhysicsList::SetCutForPositron(G4double cut) >> 305 { >> 306 cutForPositron = cut; >> 307 SetParticleCuts(cutForPositron, G4Positron::Positron()); >> 308 } >> 309 >> 310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 311 286 312