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 // 27 // 28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 30 31 #include "PhysicsList.hh" 32 33 #include "G4DecayPhysics.hh" 34 #include "G4EmLivermorePhysics.hh" 35 #include "G4EmLowEPPhysics.hh" 36 #include "G4EmPenelopePhysics.hh" 37 #include "G4EmStandardPhysics.hh" 38 #include "G4EmStandardPhysicsGS.hh" 39 #include "G4EmStandardPhysicsSS.hh" 40 #include "G4EmStandardPhysicsWVI.hh" 41 #include "G4EmStandardPhysics_option1.hh" 42 #include "G4EmStandardPhysics_option2.hh" 43 #include "G4EmStandardPhysics_option3.hh" 44 #include "G4EmStandardPhysics_option4.hh" 45 #include "G4HadronDElasticPhysics.hh" 46 #include "G4HadronElasticPhysics.hh" 47 #include "G4HadronHElasticPhysics.hh" 48 #include "G4HadronInelasticQBBC.hh" 49 #include "G4IonPhysics.hh" 50 #include "G4ParticleDefinition.hh" 51 #include "G4ProcessManager.hh" 52 #include "G4StepLimiter.hh" 53 #include "G4SystemOfUnits.hh" 54 55 #include "PhysListEmStandard.hh" 56 #include "PhysicsListMessenger.hh" 57 58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 60 PhysicsList::PhysicsList() : G4VModularPhysicsList() 61 { 62 fHelIsRegisted = false; 63 fBicIsRegisted = false; 64 fBiciIsRegisted = false; 65 66 fMessenger = new PhysicsListMessenger(this); 67 SetVerboseLevel(1); 68 69 // EM physics 70 fEmName = G4String("emlivermore"); 71 fEmPhysics = new G4EmLivermorePhysics(); 72 // fEmPhysicsList = new PhysListEmStandard(); 73 // fEmName = G4String("local"); 74 75 // Decay physics 76 fDecayPhysics = new G4DecayPhysics(1); 77 78 // SetDefaultCutValue(1*mm); 79 SetDefaultCutValue(0.01 * um); 80 } 81 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 83 84 PhysicsList::~PhysicsList() 85 { 86 delete fMessenger; 87 delete fEmPhysics; 88 delete fDecayPhysics; 89 for (size_t i = 0; i < fHadronPhysics.size(); i++) { 90 delete fHadronPhysics[i]; 91 } 92 } 93 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 95 96 void PhysicsList::ConstructParticle() 97 { 98 fDecayPhysics->ConstructParticle(); 99 } 100 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 102 103 void PhysicsList::ConstructProcess() 104 { 105 // transportation 106 // 107 AddTransportation(); 108 109 // electromagnetic physics 110 // 111 fEmPhysics->ConstructProcess(); 112 113 // decay physics 114 // 115 fDecayPhysics->ConstructProcess(); 116 117 // hadronic physics 118 for (size_t i = 0; i < fHadronPhysics.size(); i++) { 119 fHadronPhysics[i]->ConstructProcess(); 120 } 121 122 // step limitation (as a full process) 123 // 124 AddStepMax(); 125 } 126 127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 128 129 void PhysicsList::AddStepMax() 130 { 131 auto fStepMaxProcess = new G4StepLimiter(); 132 133 auto particleIterator = GetParticleIterator(); 134 135 particleIterator->reset(); 136 137 while ((*particleIterator)()) { 138 G4ParticleDefinition* particle = particleIterator->value(); 139 G4ProcessManager* pmanager = particle->GetProcessManager(); 140 141 if (fStepMaxProcess->IsApplicable(*particle)) { 142 pmanager->AddDiscreteProcess(fStepMaxProcess); 143 } 144 } 145 } 146 147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 148 149 void PhysicsList::AddPhysicsList(const G4String& name) 150 { 151 if (verboseLevel > -1) { 152 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 153 } 154 155 if (name == fEmName) return; 156 157 if (name == "local") { 158 fEmName = name; 159 delete fEmPhysics; 160 fEmPhysics = new PhysListEmStandard(name); 161 } 162 else if (name == "emstandard_opt0") { 163 fEmName = name; 164 delete fEmPhysics; 165 fEmPhysics = new G4EmStandardPhysics(); 166 } 167 else if (name == "emstandard_opt1") { 168 fEmName = name; 169 delete fEmPhysics; 170 fEmPhysics = new G4EmStandardPhysics_option1(); 171 } 172 else if (name == "emstandard_opt2") { 173 fEmName = name; 174 delete fEmPhysics; 175 fEmPhysics = new G4EmStandardPhysics_option2(); 176 } 177 else if (name == "emstandard_opt3") { 178 fEmName = name; 179 delete fEmPhysics; 180 fEmPhysics = new G4EmStandardPhysics_option3(); 181 } 182 else if (name == "emstandard_opt4") { 183 fEmName = name; 184 delete fEmPhysics; 185 fEmPhysics = new G4EmStandardPhysics_option4(); 186 } 187 else if (name == "emstandardSS") { 188 fEmName = name; 189 delete fEmPhysics; 190 fEmPhysics = new G4EmStandardPhysicsSS(); 191 } 192 else if (name == "emstandardWVI") { 193 fEmName = name; 194 delete fEmPhysics; 195 fEmPhysics = new G4EmStandardPhysicsWVI(); 196 } 197 else if (name == "emstandardGS") { 198 fEmName = name; 199 delete fEmPhysics; 200 fEmPhysics = new G4EmStandardPhysicsGS(verboseLevel); 201 } 202 else if (name == "empenelope") { 203 fEmName = name; 204 delete fEmPhysics; 205 fEmPhysics = new G4EmPenelopePhysics(); 206 } 207 else if (name == "emlowenergy") { 208 fEmName = name; 209 delete fEmPhysics; 210 fEmPhysics = new G4EmLowEPPhysics(); 211 } 212 else if (name == "emlivermore") { 213 fEmName = name; 214 delete fEmPhysics; 215 fEmPhysics = new G4EmLivermorePhysics(); 216 } 217 else if (name == "elastic" && !fHelIsRegisted) { 218 fHadronPhysics.push_back(new G4HadronElasticPhysics(verboseLevel)); 219 fHelIsRegisted = true; 220 } 221 else if (name == "DElastic" && !fHelIsRegisted) { 222 fHadronPhysics.push_back(new G4HadronDElasticPhysics(verboseLevel)); 223 fHelIsRegisted = true; 224 } 225 else if (name == "HElastic" && !fHelIsRegisted) { 226 fHadronPhysics.push_back(new G4HadronHElasticPhysics(verboseLevel)); 227 fHelIsRegisted = true; 228 } 229 else if (name == "binary" && !fBicIsRegisted) { 230 fHadronPhysics.push_back(new G4HadronInelasticQBBC(verboseLevel)); 231 fBicIsRegisted = true; 232 } 233 else if (name == "binary_ion" && !fBiciIsRegisted) { 234 fHadronPhysics.push_back(new G4IonPhysics(verboseLevel)); 235 fBiciIsRegisted = true; 236 } 237 else { 238 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 239 << " is not defined" << G4endl; 240 } 241 } 242 243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 244