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