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/TestEm8/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList class 28 // 29 // 30 //--------------------------------------------------------------------------- 31 // 32 // ClassName: PhysicsList 33 // 34 // Description: EM physics with a possibility to add PAI model 35 // 36 // Author: V.Ivanchenko 01.09.2010 37 // 38 //---------------------------------------------------------------------------- 39 // 40 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 44 #include "PhysicsList.hh" 45 46 #include "DetectorConstruction.hh" 47 #include "PhysicsListMessenger.hh" 48 #include "StepMax.hh" 49 50 #include "G4DecayPhysics.hh" 51 #include "G4Electron.hh" 52 #include "G4EmConfigurator.hh" 53 #include "G4EmLivermorePhysics.hh" 54 #include "G4EmLowEPPhysics.hh" 55 #include "G4EmParameters.hh" 56 #include "G4EmPenelopePhysics.hh" 57 #include "G4EmStandardPhysics.hh" 58 #include "G4EmStandardPhysicsGS.hh" 59 #include "G4EmStandardPhysicsSS.hh" 60 #include "G4EmStandardPhysicsWVI.hh" 61 #include "G4EmStandardPhysics_option1.hh" 62 #include "G4EmStandardPhysics_option2.hh" 63 #include "G4EmStandardPhysics_option3.hh" 64 #include "G4EmStandardPhysics_option4.hh" 65 #include "G4Gamma.hh" 66 #include "G4LossTableManager.hh" 67 #include "G4PAIModel.hh" 68 #include "G4PAIPhotModel.hh" 69 #include "G4ParticleTable.hh" 70 #include "G4ParticleTypes.hh" 71 #include "G4Positron.hh" 72 #include "G4ProcessManager.hh" 73 #include "G4ProductionCutsTable.hh" 74 #include "G4Proton.hh" 75 #include "G4SystemOfUnits.hh" 76 #include "G4UnitsTable.hh" 77 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 79 80 PhysicsList::PhysicsList(DetectorConstruction* ptr) : fDetectorConstruction(ptr) 81 { 82 // set verbosity for zero to avoid double printout 83 // on physics verbosity should be restored to 1 when cuts 84 // are set 85 G4EmParameters::Instance()->SetVerbose(0); 86 87 SetDefaultCutValue(1 * mm); 88 89 fMessenger = new PhysicsListMessenger(this); 90 91 // Decay Physics is always defined 92 fDecayPhysicsList = new G4DecayPhysics(); 93 94 // EM physics 95 fEmName = G4String("emstandard_opt0"); 96 fEmPhysicsList = new G4EmStandardPhysics(0); 97 98 SetVerboseLevel(1); 99 } 100 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 102 103 PhysicsList::~PhysicsList() 104 { 105 delete fMessenger; 106 delete fDecayPhysicsList; 107 delete fEmPhysicsList; 108 } 109 110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 111 112 void PhysicsList::ConstructParticle() 113 { 114 fDecayPhysicsList->ConstructParticle(); 115 } 116 117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 118 119 void PhysicsList::ConstructProcess() 120 { 121 AddTransportation(); 122 fEmPhysicsList->ConstructProcess(); 123 fDecayPhysicsList->ConstructProcess(); 124 AddStepMax(); 125 } 126 127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 128 129 void PhysicsList::AddPhysicsList(const G4String& name) 130 { 131 if (verboseLevel > 1) { 132 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 133 } 134 135 if (name == fEmName) { 136 return; 137 } 138 else if (name == "emstandard_opt0") { 139 fEmName = name; 140 delete fEmPhysicsList; 141 fEmPhysicsList = new G4EmStandardPhysics(0); 142 } 143 else if (name == "emstandard_opt1") { 144 fEmName = name; 145 delete fEmPhysicsList; 146 fEmPhysicsList = new G4EmStandardPhysics_option1(0); 147 } 148 else if (name == "emstandard_opt2") { 149 fEmName = name; 150 delete fEmPhysicsList; 151 fEmPhysicsList = new G4EmStandardPhysics_option2(0); 152 } 153 else if (name == "emstandard_opt3") { 154 fEmName = name; 155 delete fEmPhysicsList; 156 fEmPhysicsList = new G4EmStandardPhysics_option3(0); 157 } 158 else if (name == "emstandard_opt4") { 159 fEmName = name; 160 delete fEmPhysicsList; 161 fEmPhysicsList = new G4EmStandardPhysics_option4(0); 162 } 163 else if (name == "emstandardWVI") { 164 fEmName = name; 165 delete fEmPhysicsList; 166 fEmPhysicsList = new G4EmStandardPhysicsWVI(0); 167 } 168 else if (name == "emstandardSS") { 169 fEmName = name; 170 delete fEmPhysicsList; 171 fEmPhysicsList = new G4EmStandardPhysicsSS(0); 172 } 173 else if (name == "emstandardGS") { 174 fEmName = name; 175 delete fEmPhysicsList; 176 fEmPhysicsList = new G4EmStandardPhysicsGS(0); 177 } 178 else if (name == "pai") { 179 G4EmParameters::Instance()->AddPAIModel("all", "world", "pai"); 180 } 181 else if (name == "pai_photon") { 182 G4EmParameters::Instance()->AddPAIModel("all", "world", "pai_photon"); 183 } 184 else if (name == "emlivermore") { 185 fEmName = name; 186 delete fEmPhysicsList; 187 fEmPhysicsList = new G4EmLivermorePhysics(0); 188 } 189 else if (name == "empenelope") { 190 fEmName = name; 191 delete fEmPhysicsList; 192 fEmPhysicsList = new G4EmPenelopePhysics(0); 193 } 194 else if (name == "emlowenergy") { 195 fEmName = name; 196 delete fEmPhysicsList; 197 fEmPhysicsList = new G4EmLowEPPhysics(0); 198 } 199 else { 200 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 201 << " is not defined" << G4endl; 202 } 203 } 204 205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 206 207 void PhysicsList::AddStepMax() 208 { 209 // Step limitation seen as a process 210 StepMax* stepMaxProcess = new StepMax(fDetectorConstruction); 211 212 auto particleIterator = GetParticleIterator(); 213 particleIterator->reset(); 214 while ((*particleIterator)()) { 215 G4ParticleDefinition* particle = particleIterator->value(); 216 G4ProcessManager* pmanager = particle->GetProcessManager(); 217 218 if (stepMaxProcess->IsApplicable(*particle)) { 219 pmanager->AddDiscreteProcess(stepMaxProcess); 220 } 221 } 222 } 223 224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 225 226 void PhysicsList::SetCuts() 227 { 228 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(25. * eV, 1e5); 229 if (verboseLevel > 0) { 230 DumpCutValuesTable(); 231 } 232 } 233 234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 235