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/TestEm5/src/PhysicsL << 26 // $Id: PhysicsList.cc,v 1.42 2010-11-19 16:29:35 vnivanch Exp $ 27 /// \brief Implementation of the PhysicsList c << 27 // GEANT4 tag $Name: geant4-09-04-patch-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 "PhysListEmStandardSS.hh" 37 #include "StepMax.hh" << 37 #include "PhysListEmStandardGS.hh" >> 38 #include "PhysListEmStandardWVI.hh" 38 39 39 #include "G4DecayPhysics.hh" << 40 #include "G4EmDNAPhysics.hh" << 41 #include "G4EmDNAPhysics_option2.hh" << 42 #include "G4EmDNAPhysics_option4.hh" << 43 #include "G4EmDNAPhysics_option6.hh" << 44 #include "G4EmLivermorePhysics.hh" << 45 #include "G4EmLowEPPhysics.hh" << 46 #include "G4EmPenelopePhysics.hh" << 47 #include "G4EmStandardPhysics.hh" 40 #include "G4EmStandardPhysics.hh" 48 #include "G4EmStandardPhysicsGS.hh" << 49 #include "G4EmStandardPhysicsSS.hh" << 50 #include "G4EmStandardPhysicsWVI.hh" << 51 #include "G4EmStandardPhysics_option1.hh" 41 #include "G4EmStandardPhysics_option1.hh" 52 #include "G4EmStandardPhysics_option2.hh" 42 #include "G4EmStandardPhysics_option2.hh" 53 #include "G4EmStandardPhysics_option3.hh" 43 #include "G4EmStandardPhysics_option3.hh" 54 #include "G4EmStandardPhysics_option4.hh" << 44 #include "G4EmLivermorePhysics.hh" 55 #include "G4HadronElasticPhysics.hh" << 45 #include "G4EmPenelopePhysics.hh" >> 46 >> 47 #include "G4Decay.hh" >> 48 #include "StepMax.hh" >> 49 >> 50 #include "G4UnitsTable.hh" >> 51 56 #include "G4ParticleDefinition.hh" 52 #include "G4ParticleDefinition.hh" 57 #include "G4ProcessManager.hh" 53 #include "G4ProcessManager.hh" 58 #include "G4SystemOfUnits.hh" << 59 #include "G4UnitsTable.hh" << 60 54 61 // particles << 55 // Bosons >> 56 #include "G4ChargedGeantino.hh" >> 57 #include "G4Geantino.hh" >> 58 #include "G4Gamma.hh" >> 59 #include "G4OpticalPhoton.hh" >> 60 >> 61 // leptons >> 62 #include "G4MuonPlus.hh" >> 63 #include "G4MuonMinus.hh" >> 64 #include "G4NeutrinoMu.hh" >> 65 #include "G4AntiNeutrinoMu.hh" >> 66 >> 67 #include "G4Electron.hh" >> 68 #include "G4Positron.hh" >> 69 #include "G4NeutrinoE.hh" >> 70 #include "G4AntiNeutrinoE.hh" 62 71 >> 72 // Hadrons >> 73 #include "G4MesonConstructor.hh" 63 #include "G4BaryonConstructor.hh" 74 #include "G4BaryonConstructor.hh" 64 #include "G4BosonConstructor.hh" << 65 #include "G4DNAGenericIonsManager.hh" << 66 #include "G4IonConstructor.hh" 75 #include "G4IonConstructor.hh" 67 #include "G4LeptonConstructor.hh" << 68 #include "G4MesonConstructor.hh" << 69 #include "G4ShortLivedConstructor.hh" << 70 76 71 //....oooOO0OOooo........oooOO0OOooo........oo 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 78 73 PhysicsList::PhysicsList() << 79 PhysicsList::PhysicsList() : G4VModularPhysicsList() 74 { 80 { 75 fMessenger = new PhysicsListMessenger(this); << 81 pMessenger = new PhysicsListMessenger(this); 76 SetVerboseLevel(1); << 82 77 << 78 // EM physics 83 // EM physics 79 fEmName = G4String("emstandard_opt4"); << 84 emName = G4String("local"); 80 fEmPhysicsList = new G4EmStandardPhysics_opt << 85 emPhysicsList = new PhysListEmStandard(emName); 81 << 86 82 // Decay physics << 87 defaultCutValue = 1.*mm; 83 fDecayPhysics = new G4DecayPhysics(1); << 88 >> 89 cutForGamma = defaultCutValue; >> 90 cutForElectron = defaultCutValue; >> 91 cutForPositron = defaultCutValue; 84 92 85 SetDefaultCutValue(1 * mm); << 93 SetVerboseLevel(1); 86 } 94 } 87 95 88 //....oooOO0OOooo........oooOO0OOooo........oo 96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 89 97 90 PhysicsList::~PhysicsList() 98 PhysicsList::~PhysicsList() 91 { 99 { 92 delete fEmPhysicsList; << 100 delete emPhysicsList; 93 delete fMessenger; << 101 delete pMessenger; 94 } 102 } 95 103 96 //....oooOO0OOooo........oooOO0OOooo........oo 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 97 105 98 void PhysicsList::ConstructParticle() 106 void PhysicsList::ConstructParticle() 99 { 107 { 100 G4BosonConstructor pBosonConstructor; << 108 // pseudo-particles 101 pBosonConstructor.ConstructParticle(); << 109 G4Geantino::GeantinoDefinition(); >> 110 G4ChargedGeantino::ChargedGeantinoDefinition(); >> 111 >> 112 // gamma >> 113 G4Gamma::GammaDefinition(); >> 114 >> 115 // leptons >> 116 G4Electron::ElectronDefinition(); >> 117 G4Positron::PositronDefinition(); >> 118 G4MuonPlus::MuonPlusDefinition(); >> 119 G4MuonMinus::MuonMinusDefinition(); >> 120 >> 121 G4NeutrinoE::NeutrinoEDefinition(); >> 122 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); >> 123 G4NeutrinoMu::NeutrinoMuDefinition(); >> 124 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); >> 125 >> 126 // mesons >> 127 G4MesonConstructor mConstructor; >> 128 mConstructor.ConstructParticle(); >> 129 >> 130 // barions >> 131 G4BaryonConstructor bConstructor; >> 132 bConstructor.ConstructParticle(); >> 133 >> 134 // ions >> 135 G4IonConstructor iConstructor; >> 136 iConstructor.ConstructParticle(); >> 137 } 102 138 103 G4LeptonConstructor pLeptonConstructor; << 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 104 pLeptonConstructor.ConstructParticle(); << 105 140 106 G4MesonConstructor pMesonConstructor; << 141 void PhysicsList::ConstructProcess() 107 pMesonConstructor.ConstructParticle(); << 142 { >> 143 AddTransportation(); >> 144 emPhysicsList->ConstructProcess(); >> 145 AddDecay(); >> 146 AddStepMax(); >> 147 } 108 148 109 G4BaryonConstructor pBaryonConstructor; << 149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 110 pBaryonConstructor.ConstructParticle(); << 111 150 112 G4IonConstructor pIonConstructor; << 151 void PhysicsList::AddDecay() 113 pIonConstructor.ConstructParticle(); << 152 { >> 153 // Add Decay Process 114 154 115 G4ShortLivedConstructor sLivedConstructor; << 155 G4Decay* fDecayProcess = new G4Decay(); 116 sLivedConstructor.ConstructParticle(); << 117 156 118 // Geant4-DNA << 157 theParticleIterator->reset(); >> 158 while( (*theParticleIterator)() ){ >> 159 G4ParticleDefinition* particle = theParticleIterator->value(); >> 160 G4ProcessManager* pmanager = particle->GetProcessManager(); 119 161 120 G4DNAGenericIonsManager* genericIonsManager; << 162 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 121 genericIonsManager = G4DNAGenericIonsManager << 122 genericIonsManager->GetIon("alpha++"); << 123 genericIonsManager->GetIon("alpha+"); << 124 genericIonsManager->GetIon("helium"); << 125 genericIonsManager->GetIon("hydrogen"); << 126 } << 127 163 128 //....oooOO0OOooo........oooOO0OOooo........oo << 164 pmanager ->AddProcess(fDecayProcess); 129 165 130 void PhysicsList::ConstructProcess() << 166 // set ordering for PostStepDoIt and AtRestDoIt 131 { << 167 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); 132 AddTransportation(); << 168 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); 133 fEmPhysicsList->ConstructProcess(); << 169 134 fDecayPhysics->ConstructProcess(); << 170 } 135 if (fHadPhysicsList) { << 136 fHadPhysicsList->ConstructProcess(); << 137 } 171 } 138 AddStepMax(); << 139 } 172 } 140 173 141 //....oooOO0OOooo........oooOO0OOooo........oo 174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 175 143 void PhysicsList::AddStepMax() 176 void PhysicsList::AddStepMax() 144 { 177 { 145 // Step limitation seen as a process 178 // Step limitation seen as a process 146 StepMax* stepMaxProcess = new StepMax(); 179 StepMax* stepMaxProcess = new StepMax(); 147 180 148 auto particleIterator = GetParticleIterator( << 181 theParticleIterator->reset(); 149 particleIterator->reset(); << 182 while ((*theParticleIterator)()){ 150 while ((*particleIterator)()) { << 183 G4ParticleDefinition* particle = theParticleIterator->value(); 151 G4ParticleDefinition* particle = particleI << 184 G4ProcessManager* pmanager = particle->GetProcessManager(); 152 G4ProcessManager* pmanager = particle->Get << 185 153 << 186 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) 154 if (stepMaxProcess->IsApplicable(*particle << 187 { 155 pmanager->AddDiscreteProcess(stepMaxProc << 188 pmanager ->AddDiscreteProcess(stepMaxProcess); 156 } << 189 } 157 } 190 } 158 } 191 } 159 192 160 //....oooOO0OOooo........oooOO0OOooo........oo 193 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 161 194 162 void PhysicsList::AddPhysicsList(const G4Strin 195 void PhysicsList::AddPhysicsList(const G4String& name) 163 { 196 { 164 if (verboseLevel > -1) { << 197 if (verboseLevel>-1) { 165 G4cout << "PhysicsList::AddPhysicsList: <" 198 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 166 } 199 } 167 200 168 if (name == fEmName) return; << 201 if (name == emName) return; 169 202 170 if (name == "local") { 203 if (name == "local") { 171 fEmName = name; << 204 172 delete fEmPhysicsList; << 205 emName = name; 173 fEmPhysicsList = new PhysListEmStandard(na << 206 delete emPhysicsList; 174 } << 207 emPhysicsList = new PhysListEmStandard(name); 175 else if (name == "emstandard_opt0") { << 208 176 fEmName = name; << 209 } else if (name == "emstandard_opt0") { 177 delete fEmPhysicsList; << 210 178 fEmPhysicsList = new G4EmStandardPhysics() << 211 emName = name; 179 } << 212 delete emPhysicsList; 180 else if (name == "emstandard_opt1") { << 213 emPhysicsList = new G4EmStandardPhysics(); 181 fEmName = name; << 214 182 delete fEmPhysicsList; << 215 } else if (name == "emstandard_opt1") { 183 fEmPhysicsList = new G4EmStandardPhysics_o << 216 184 } << 217 emName = name; 185 else if (name == "emstandard_opt2") { << 218 delete emPhysicsList; 186 fEmName = name; << 219 emPhysicsList = new G4EmStandardPhysics_option1(); 187 delete fEmPhysicsList; << 220 188 fEmPhysicsList = new G4EmStandardPhysics_o << 221 } else if (name == "emstandard_opt2") { 189 } << 222 190 else if (name == "emstandard_opt3") { << 223 emName = name; 191 fEmName = name; << 224 delete emPhysicsList; 192 delete fEmPhysicsList; << 225 emPhysicsList = new G4EmStandardPhysics_option2(); 193 fEmPhysicsList = new G4EmStandardPhysics_o << 226 194 } << 227 } else if (name == "emstandard_opt3") { 195 else if (name == "emstandard_opt4") { << 228 196 fEmName = name; << 229 emName = name; 197 delete fEmPhysicsList; << 230 delete emPhysicsList; 198 fEmPhysicsList = new G4EmStandardPhysics_o << 231 emPhysicsList = new G4EmStandardPhysics_option3(); 199 } << 232 200 else if (name == "emstandardSS") { << 233 } else if (name == "standardSS") { 201 fEmName = name; << 234 202 delete fEmPhysicsList; << 235 emName = name; 203 fEmPhysicsList = new G4EmStandardPhysicsSS << 236 delete emPhysicsList; 204 } << 237 emPhysicsList = new PhysListEmStandardSS(name); 205 else if (name == "emstandardWVI") { << 238 206 fEmName = name; << 239 } else if (name == "standardWVI") { 207 delete fEmPhysicsList; << 240 208 fEmPhysicsList = new G4EmStandardPhysicsWV << 241 emName = name; 209 } << 242 delete emPhysicsList; 210 else if (name == "emstandardGS") { << 243 emPhysicsList = new PhysListEmStandardWVI(name); 211 fEmName = name; << 244 212 delete fEmPhysicsList; << 245 } else if (name == "standardGS") { 213 fEmPhysicsList = new G4EmStandardPhysicsGS << 246 214 } << 247 emName = name; 215 else if (name == "empenelope") { << 248 delete emPhysicsList; 216 fEmName = name; << 249 emPhysicsList = new PhysListEmStandardGS(name); 217 delete fEmPhysicsList; << 250 218 fEmPhysicsList = new G4EmPenelopePhysics() << 251 } else if (name == "empenelope"){ 219 } << 252 emName = name; 220 else if (name == "emlowenergy") { << 253 delete emPhysicsList; 221 fEmName = name; << 254 emPhysicsList = new G4EmPenelopePhysics(); 222 delete fEmPhysicsList; << 255 223 fEmPhysicsList = new G4EmLowEPPhysics(); << 256 } else if (name == "emlivermore"){ 224 } << 257 emName = name; 225 else if (name == "emlivermore") { << 258 delete emPhysicsList; 226 fEmName = name; << 259 emPhysicsList = new G4EmLivermorePhysics(); 227 delete fEmPhysicsList; << 260 228 fEmPhysicsList = new G4EmLivermorePhysics( << 261 } else { 229 } << 262 230 else if (name == "dna") { << 231 fEmName = name; << 232 delete fEmPhysicsList; << 233 fEmPhysicsList = new G4EmDNAPhysics(); << 234 } << 235 else if (name == "dna_opt2") { << 236 fEmName = name; << 237 delete fEmPhysicsList; << 238 fEmPhysicsList = new G4EmDNAPhysics_option << 239 } << 240 else if (name == "dna_opt4") { << 241 fEmName = name; << 242 delete fEmPhysicsList; << 243 fEmPhysicsList = new G4EmDNAPhysics_option << 244 } << 245 else if (name == "dna_opt6") { << 246 fEmName = name; << 247 delete fEmPhysicsList; << 248 fEmPhysicsList = new G4EmDNAPhysics_option << 249 } << 250 else if (name == "had_elastic" && !fHadPhysi << 251 fHadPhysicsList = new G4HadronElasticPhysi << 252 } << 253 else { << 254 G4cout << "PhysicsList::AddPhysicsList: <" 263 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 255 << " is not defined" << G4endl; << 264 << " is not defined" >> 265 << G4endl; 256 } 266 } >> 267 } >> 268 >> 269 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 270 >> 271 void PhysicsList::SetCuts() >> 272 { >> 273 if (verboseLevel >0){ >> 274 G4cout << "PhysicsList::SetCuts:"; >> 275 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; >> 276 } >> 277 >> 278 // set cut values for gamma at first and for e- second and next for e+, >> 279 // because some processes for e+/e- need cut values for gamma >> 280 SetCutValue(cutForGamma, "gamma"); >> 281 SetCutValue(cutForElectron, "e-"); >> 282 SetCutValue(cutForPositron, "e+"); >> 283 >> 284 if (verboseLevel>0) DumpCutValuesTable(); >> 285 } >> 286 >> 287 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 288 >> 289 void PhysicsList::SetCutForGamma(G4double cut) >> 290 { >> 291 cutForGamma = cut; >> 292 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 293 } >> 294 >> 295 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 296 >> 297 void PhysicsList::SetCutForElectron(G4double cut) >> 298 { >> 299 cutForElectron = cut; >> 300 SetParticleCuts(cutForElectron, G4Electron::Electron()); >> 301 } >> 302 >> 303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 304 >> 305 void PhysicsList::SetCutForPositron(G4double cut) >> 306 { >> 307 cutForPositron = cut; >> 308 SetParticleCuts(cutForPositron, G4Positron::Positron()); 257 } 309 } 258 310 259 //....oooOO0OOooo........oooOO0OOooo........oo 311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 260 312