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/TestEm6/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 "G4AnnihiToMuPair.hh" 39 #include "G4DecayPhysics.hh" 40 #include "G4Electron.hh" 41 #include "G4EmLivermorePhysics.hh" 42 #include "G4EmLowEPPhysics.hh" 43 #include "G4EmPenelopePhysics.hh" 44 #include "G4EmStandardPhysics.hh" 45 #include "G4EmStandardPhysicsGS.hh" 46 #include "G4EmStandardPhysicsSS.hh" 47 #include "G4EmStandardPhysicsWVI.hh" 48 #include "G4EmStandardPhysics_option1.hh" 49 #include "G4EmStandardPhysics_option2.hh" 50 #include "G4EmStandardPhysics_option3.hh" 51 #include "G4EmStandardPhysics_option4.hh" 52 #include "G4Gamma.hh" 53 #include "G4GammaConversionToMuons.hh" 54 #include "G4LossTableManager.hh" 55 #include "G4ParticleDefinition.hh" 56 #include "G4ParticleTable.hh" 57 #include "G4Positron.hh" 58 #include "G4ProcessManager.hh" 59 #include "G4ProcessTable.hh" 60 #include "G4SystemOfUnits.hh" 61 #include "G4UnitsTable.hh" 62 #include "G4eeToHadrons.hh" 63 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 66 PhysicsList::PhysicsList() 67 : G4VModularPhysicsList(), fEmPhysicsList(0), fDecayPhysicsList(0), fStepMaxProcess(0), fMes(0) 68 { 69 G4LossTableManager::Instance()->SetVerbose(1); 70 71 defaultCutValue = 1. * km; 72 fMes = new PhysicsListMessenger(this); 73 74 fStepMaxProcess = new StepMax(); 75 76 fDecayPhysicsList = new G4DecayPhysics(); 77 78 SetVerboseLevel(2); 79 } 80 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 83 PhysicsList::~PhysicsList() 84 { 85 delete fMes; 86 delete fDecayPhysicsList; 87 delete fEmPhysicsList; 88 delete fStepMaxProcess; 89 } 90 91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 93 void PhysicsList::ConstructParticle() 94 { 95 fDecayPhysicsList->ConstructParticle(); 96 } 97 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 99 100 void PhysicsList::ConstructProcess() 101 { 102 AddTransportation(); 103 104 if (fEmPhysicsList) fEmPhysicsList->ConstructProcess(); 105 fDecayPhysicsList->ConstructProcess(); 106 107 AddStepMax(); 108 109 ConstructHighEnergy(); 110 } 111 112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 113 114 void PhysicsList::ConstructHighEnergy() 115 { 116 const G4ParticleDefinition* particle = G4Gamma::Gamma(); 117 G4ProcessManager* pmanager = particle->GetProcessManager(); 118 119 pmanager->AddDiscreteProcess(new G4GammaConversionToMuons); 120 121 particle = G4Positron::Positron(); 122 pmanager = particle->GetProcessManager(); 123 124 pmanager->AddDiscreteProcess(new G4AnnihiToMuPair); 125 pmanager->AddDiscreteProcess(new G4eeToHadrons); 126 } 127 128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 130 void PhysicsList::SetGammaToMuPairFac(G4double fac) 131 { 132 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 133 G4GammaConversionToMuons* gammaToMuPairProcess = 134 (G4GammaConversionToMuons*)theProcessTable->FindProcess("GammaToMuPair", "gamma"); 135 if (gammaToMuPairProcess) 136 gammaToMuPairProcess->SetCrossSecFactor(fac); 137 else 138 G4cout << "Warning. No process GammaToMuPair found, SetGammaToMuPairFac was ignored" << G4endl; 139 } 140 141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 143 void PhysicsList::SetAnnihiToMuPairFac(G4double fac) 144 { 145 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 146 G4AnnihiToMuPair* annihiToMuPairProcess = 147 (G4AnnihiToMuPair*)theProcessTable->FindProcess("AnnihiToMuPair", "e+"); 148 if (annihiToMuPairProcess) 149 annihiToMuPairProcess->SetCrossSecFactor(fac); 150 else 151 G4cout << "Warning. No process AnnihiToMuPair found, SetAnnihiToMuPairFac ignored" << G4endl; 152 } 153 154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 156 void PhysicsList::SetAnnihiToHadronFac(G4double fac) 157 { 158 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 159 G4eeToHadrons* eehadProcess = (G4eeToHadrons*)theProcessTable->FindProcess("ee2hadr", "e+"); 160 if (eehadProcess) 161 eehadProcess->SetCrossSecFactor(fac); 162 else 163 G4cout << "Warning. No process ee2hadr found, SetAnnihiToHadronFac was ignored" << G4endl; 164 } 165 166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 167 168 void PhysicsList::AddPhysicsList(const G4String& name) 169 { 170 if (verboseLevel > 1) { 171 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 172 } 173 174 if (name == fEmName) { 175 return; 176 } 177 else if (name == "emstandard_opt0") { 178 fEmName = name; 179 delete fEmPhysicsList; 180 fEmPhysicsList = new G4EmStandardPhysics(); 181 } 182 else if (name == "emstandard_opt1") { 183 fEmName = name; 184 delete fEmPhysicsList; 185 fEmPhysicsList = new G4EmStandardPhysics_option1(); 186 } 187 else if (name == "emstandard_opt2") { 188 fEmName = name; 189 delete fEmPhysicsList; 190 fEmPhysicsList = new G4EmStandardPhysics_option2(); 191 } 192 else if (name == "emstandard_opt3") { 193 fEmName = name; 194 delete fEmPhysicsList; 195 fEmPhysicsList = new G4EmStandardPhysics_option3(); 196 } 197 else if (name == "emstandard_opt4") { 198 fEmName = name; 199 delete fEmPhysicsList; 200 fEmPhysicsList = new G4EmStandardPhysics_option4(); 201 } 202 else if (name == "emlivermore") { 203 fEmName = name; 204 delete fEmPhysicsList; 205 fEmPhysicsList = new G4EmLivermorePhysics(); 206 } 207 else if (name == "empenelope") { 208 fEmName = name; 209 delete fEmPhysicsList; 210 fEmPhysicsList = new G4EmPenelopePhysics(); 211 } 212 else if (name == "emlowenergy") { 213 fEmName = name; 214 delete fEmPhysicsList; 215 fEmPhysicsList = new G4EmLowEPPhysics(); 216 } 217 else if (name == "emstandardGS") { 218 fEmName = name; 219 delete fEmPhysicsList; 220 fEmPhysicsList = new G4EmStandardPhysicsGS(); 221 } 222 else if (name == "emstandardSS") { 223 fEmName = name; 224 delete fEmPhysicsList; 225 fEmPhysicsList = new G4EmStandardPhysicsSS(); 226 } 227 else if (name == "emstandardWVI") { 228 fEmName = name; 229 delete fEmPhysicsList; 230 fEmPhysicsList = new G4EmStandardPhysicsWVI(); 231 } 232 else { 233 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 234 << " is not defined" << G4endl; 235 } 236 } 237 238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 239 240 void PhysicsList::AddStepMax() 241 { 242 // Step limitation seen as a process 243 244 auto particleIterator = GetParticleIterator(); 245 particleIterator->reset(); 246 while ((*particleIterator)()) { 247 G4ParticleDefinition* particle = particleIterator->value(); 248 G4ProcessManager* pmanager = particle->GetProcessManager(); 249 250 if (fStepMaxProcess->IsApplicable(*particle)) { 251 pmanager->AddDiscreteProcess(fStepMaxProcess); 252 } 253 } 254 } 255 256 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 257