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 electromagnetic/TestEm12/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 "PhysListEmStandard.hh" 36 #include "PhysListEmStandardSSM.hh" 37 #include "PhysicsListMessenger.hh" 38 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" 59 #include "G4SystemOfUnits.hh" 60 #include "G4UnitsTable.hh" 61 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::fStepMaxProcess = nullptr; 73 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 76 PhysicsList::PhysicsList() 77 { 78 fMessenger = new PhysicsListMessenger(this); 79 80 SetVerboseLevel(1); 81 82 // EM physics 83 fEmPhysicsList = new PhysListEmStandard(fEmName = "local"); 84 85 // Em options 86 // 87 G4EmParameters::Instance()->SetBuildCSDARange(true); 88 89 SetDefaultCutValue(1. * mm); 90 } 91 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 93 94 PhysicsList::~PhysicsList() 95 { 96 delete fMessenger; 97 delete fEmPhysicsList; 98 } 99 100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 101 102 void PhysicsList::ConstructParticle() 103 { 104 G4BosonConstructor pBosonConstructor; 105 pBosonConstructor.ConstructParticle(); 106 107 G4LeptonConstructor pLeptonConstructor; 108 pLeptonConstructor.ConstructParticle(); 109 110 G4MesonConstructor pMesonConstructor; 111 pMesonConstructor.ConstructParticle(); 112 113 G4BaryonConstructor pBaryonConstructor; 114 pBaryonConstructor.ConstructParticle(); 115 116 G4IonConstructor pIonConstructor; 117 pIonConstructor.ConstructParticle(); 118 119 G4ShortLivedConstructor pShortLivedConstructor; 120 pShortLivedConstructor.ConstructParticle(); 121 122 // DNA 123 G4DNAGenericIonsManager* genericIonsManager; 124 genericIonsManager = G4DNAGenericIonsManager::Instance(); 125 genericIonsManager->GetIon("alpha++"); 126 genericIonsManager->GetIon("alpha+"); 127 genericIonsManager->GetIon("helium"); 128 genericIonsManager->GetIon("hydrogen"); 129 } 130 131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 132 133 #include "G4ProcessManager.hh" 134 135 void PhysicsList::ConstructProcess() 136 { 137 // transportation 138 // 139 AddTransportation(); 140 141 // electromagnetic physics list 142 // 143 fEmPhysicsList->ConstructProcess(); 144 145 // decay process 146 // 147 AddDecay(); 148 149 // step limitation (as a full process) 150 // 151 AddStepMax(); 152 } 153 154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 156 void PhysicsList::AddPhysicsList(const G4String& name) 157 { 158 if (verboseLevel > -1) { 159 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 160 } 161 162 if (name == fEmName) return; 163 164 if (name == "local") { 165 fEmName = name; 166 delete fEmPhysicsList; 167 fEmPhysicsList = new PhysListEmStandard(name); 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_option1(); 178 } 179 else if (name == "emstandard_opt2") { 180 fEmName = name; 181 delete fEmPhysicsList; 182 fEmPhysicsList = new G4EmStandardPhysics_option2(); 183 } 184 else if (name == "emstandard_opt3") { 185 fEmName = name; 186 delete fEmPhysicsList; 187 fEmPhysicsList = new G4EmStandardPhysics_option3(); 188 } 189 else if (name == "emstandard_opt4") { 190 fEmName = name; 191 delete fEmPhysicsList; 192 fEmPhysicsList = new G4EmStandardPhysics_option4(); 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(name); 203 } 204 else if (name == "emstandardWVI") { 205 fEmName = name; 206 delete fEmPhysicsList; 207 fEmPhysicsList = new G4EmStandardPhysicsWVI(); 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_option1(); 238 } 239 else if (name == "dna_opt2") { 240 fEmName = name; 241 delete fEmPhysicsList; 242 fEmPhysicsList = new G4EmDNAPhysics_option2(); 243 } 244 else if (name == "dna_opt3") { 245 fEmName = name; 246 delete fEmPhysicsList; 247 fEmPhysicsList = new G4EmDNAPhysics_option3(); 248 } 249 else if (name == "dna_opt4") { 250 fEmName = name; 251 delete fEmPhysicsList; 252 fEmPhysicsList = new G4EmDNAPhysics_option4(); 253 } 254 else if (name == "dna_opt5") { 255 fEmName = name; 256 delete fEmPhysicsList; 257 fEmPhysicsList = new G4EmDNAPhysics_option5(); 258 } 259 else if (name == "dna_opt6") { 260 fEmName = name; 261 delete fEmPhysicsList; 262 fEmPhysicsList = new G4EmDNAPhysics_option6(); 263 } 264 else if (name == "dna_opt7") { 265 fEmName = name; 266 delete fEmPhysicsList; 267 fEmPhysicsList = new G4EmDNAPhysics_option7(); 268 } 269 else { 270 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 271 << " is not defined" << G4endl; 272 } 273 G4EmParameters::Instance()->SetBuildCSDARange(true); 274 } 275 276 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 277 278 #include "G4Decay.hh" 279 280 void PhysicsList::AddDecay() 281 { 282 // decay process 283 // 284 G4Decay* fDecayProcess = new G4Decay(); 285 286 auto particleIterator = GetParticleIterator(); 287 particleIterator->reset(); 288 while ((*particleIterator)()) { 289 G4ParticleDefinition* particle = particleIterator->value(); 290 G4ProcessManager* pmanager = particle->GetProcessManager(); 291 292 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 293 pmanager->AddProcess(fDecayProcess); 294 295 // set ordering for PostStepDoIt and AtRestDoIt 296 pmanager->SetProcessOrdering(fDecayProcess, idxPostStep); 297 pmanager->SetProcessOrdering(fDecayProcess, idxAtRest); 298 } 299 } 300 } 301 302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 303 304 #include "StepMax.hh" 305 306 void PhysicsList::AddStepMax() 307 { 308 // Step limitation seen as a process 309 fStepMaxProcess = new StepMax(); 310 311 auto particleIterator = GetParticleIterator(); 312 particleIterator->reset(); 313 while ((*particleIterator)()) { 314 G4ParticleDefinition* particle = particleIterator->value(); 315 G4ProcessManager* pmanager = particle->GetProcessManager(); 316 317 if (fStepMaxProcess->IsApplicable(*particle)) { 318 pmanager->AddDiscreteProcess(fStepMaxProcess); 319 } 320 } 321 } 322 323 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 324