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