Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 /// \file medical/electronScattering/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList class 28 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 #include "PhysicsList.hh" 34 35 #include "PhysicsListMessenger.hh" 36 #include "StepMax.hh" 37 38 #include "G4Decay.hh" 39 #include "G4EmStandardPhysics.hh" 40 #include "G4EmStandardPhysicsGS.hh" 41 #include "G4EmStandardPhysicsSS.hh" 42 #include "G4EmStandardPhysicsWVI.hh" 43 #include "G4EmStandardPhysics_option1.hh" 44 #include "G4EmStandardPhysics_option2.hh" 45 #include "G4EmStandardPhysics_option3.hh" 46 #include "G4EmStandardPhysics_option4.hh" 47 #include "G4ParticleDefinition.hh" 48 #include "G4ProcessManager.hh" 49 #include "G4UnitsTable.hh" 50 51 // Bosons 52 #include "G4ChargedGeantino.hh" 53 #include "G4Gamma.hh" 54 #include "G4Geantino.hh" 55 #include "G4OpticalPhoton.hh" 56 57 // leptons 58 #include "G4AntiNeutrinoE.hh" 59 #include "G4AntiNeutrinoMu.hh" 60 #include "G4Electron.hh" 61 #include "G4MuonMinus.hh" 62 #include "G4MuonPlus.hh" 63 #include "G4NeutrinoE.hh" 64 #include "G4NeutrinoMu.hh" 65 #include "G4Positron.hh" 66 67 // Hadrons 68 #include "G4BaryonConstructor.hh" 69 #include "G4IonConstructor.hh" 70 #include "G4MesonConstructor.hh" 71 #include "G4SystemOfUnits.hh" 72 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 74 75 PhysicsList::PhysicsList() 76 : G4VModularPhysicsList(), fMessenger(0), fEmName("emstandard_opt0"), fEmPhysicsList(0) 77 { 78 fMessenger = new PhysicsListMessenger(this); 79 80 // EM physics 81 fEmPhysicsList = new G4EmStandardPhysics(); 82 83 SetDefaultCutValue(1. * mm); 84 SetVerboseLevel(1); 85 } 86 87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 88 89 PhysicsList::~PhysicsList() 90 { 91 delete fEmPhysicsList; 92 delete fMessenger; 93 } 94 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 96 97 void PhysicsList::ConstructParticle() 98 { 99 // pseudo-particles 100 G4Geantino::GeantinoDefinition(); 101 G4ChargedGeantino::ChargedGeantinoDefinition(); 102 103 // gamma 104 G4Gamma::GammaDefinition(); 105 106 // optical photon 107 G4OpticalPhoton::OpticalPhotonDefinition(); 108 109 // leptons 110 G4Electron::ElectronDefinition(); 111 G4Positron::PositronDefinition(); 112 G4MuonPlus::MuonPlusDefinition(); 113 G4MuonMinus::MuonMinusDefinition(); 114 115 G4NeutrinoE::NeutrinoEDefinition(); 116 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 117 G4NeutrinoMu::NeutrinoMuDefinition(); 118 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 119 120 // mesons 121 G4MesonConstructor mConstructor; 122 mConstructor.ConstructParticle(); 123 124 // barions 125 G4BaryonConstructor bConstructor; 126 bConstructor.ConstructParticle(); 127 128 // ions 129 G4IonConstructor iConstructor; 130 iConstructor.ConstructParticle(); 131 } 132 133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 135 void PhysicsList::ConstructProcess() 136 { 137 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); 139 AddDecay(); 140 AddStepMax(); 141 } 142 143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 144 145 void PhysicsList::AddDecay() 146 { 147 // Add Decay Process 148 149 G4Decay* fDecayProcess = new G4Decay(); 150 151 auto particleIterator = GetParticleIterator(); 152 particleIterator->reset(); 153 while ((*particleIterator)()) { 154 G4ParticleDefinition* particle = particleIterator->value(); 155 G4ProcessManager* pmanager = particle->GetProcessManager(); 156 157 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 158 pmanager->AddProcess(fDecayProcess); 159 160 // set ordering for PostStepDoIt and AtRestDoIt 161 pmanager->SetProcessOrdering(fDecayProcess, idxPostStep); 162 pmanager->SetProcessOrdering(fDecayProcess, idxAtRest); 163 } 164 } 165 } 166 167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 168 169 void PhysicsList::AddStepMax() 170 { 171 // Step limitation seen as a process 172 StepMax* stepMaxProcess = new StepMax(); 173 174 auto particleIterator = GetParticleIterator(); 175 particleIterator->reset(); 176 while ((*particleIterator)()) { 177 G4ParticleDefinition* particle = particleIterator->value(); 178 G4ProcessManager* pmanager = particle->GetProcessManager(); 179 180 if (stepMaxProcess->IsApplicable(*particle)) { 181 pmanager->AddDiscreteProcess(stepMaxProcess); 182 } 183 } 184 } 185 186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 187 188 void PhysicsList::AddPhysicsList(const G4String& name) 189 { 190 if (verboseLevel > -1) { 191 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 192 } 193 194 if (name == fEmName) return; 195 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_option1(); 205 } 206 else if (name == "emstandard_opt2") { 207 fEmName = name; 208 delete fEmPhysicsList; 209 fEmPhysicsList = new G4EmStandardPhysics_option2(); 210 } 211 else if (name == "emstandard_opt3") { 212 fEmName = name; 213 delete fEmPhysicsList; 214 fEmPhysicsList = new G4EmStandardPhysics_option3(); 215 } 216 else if (name == "emstandard_opt4") { 217 fEmName = name; 218 delete fEmPhysicsList; 219 fEmPhysicsList = new G4EmStandardPhysics_option4(); 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 G4EmStandardPhysicsWVI(); 235 } 236 else { 237 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 238 << " is not defined" << G4endl; 239 } 240 } 241 242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 243