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