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 // Code developed by 27 // Silvia Pozzi (1), silvia.pozzi@iss.it 28 // Barbara Caccia (1), barbara.caccia@iss.it 29 // Carlo Mancini Terracciano (2), carlo.mancini.terracciano@roma1.infn.it 30 // (1) Istituto Superiore di Sanita' and INFN Roma, Italy 31 // (2) Univ. La Sapienza and INFN Roma, Italy 32 33 #include "PhysicsList.hh" 34 #include "PhysicsListMessenger.hh" 35 #include "StepMax.hh" 36 37 #include <G4EmStandardPhysics.hh> 38 #include <G4eBremsstrahlung.hh> 39 40 #include <G4DecayPhysics.hh> 41 #include <G4ProductionCutsTable.hh> 42 #include <G4SystemOfUnits.hh> 43 44 #include "G4SystemOfUnits.hh" 45 #include "G4VPhysicsConstructor.hh" 46 47 // Physics lists 48 #include "G4EmStandardPhysics_option4.hh" 49 #include "G4EmStandardPhysics_option3.hh" 50 #include "G4EmLivermorePhysics.hh" 51 #include "G4EmPenelopePhysics.hh" 52 #include "G4DecayPhysics.hh" 53 #include "G4HadronElasticPhysics.hh" 54 #include "G4HadronInelasticQBBC.hh" 55 #include "G4IonBinaryCascadePhysics.hh" 56 #include "G4Decay.hh" 57 58 #include "G4UnitsTable.hh" 59 #include "G4ProcessManager.hh" 60 61 ///////////////////////////////////////////////////////////////////////////// 62 PhysicsList::PhysicsList() : G4VModularPhysicsList() 63 { 64 defaultCutValue = 1.*mm; 65 helIsRegistered = false; 66 bicIsRegistered = false; 67 biciIsRegistered = false; 68 locIonIonInelasticIsRegistered = false; 69 70 stepMaxProcess = nullptr; 71 72 pMessenger = new PhysicsListMessenger(this); 73 74 SetVerboseLevel(1); 75 76 // EM physics 77 emPhysicsList = new G4EmStandardPhysics_option3(1); 78 emName = G4String("emstandard_opt3"); 79 80 // emPhysicsList = new G4EmLivermorePhysics(); 81 // emName = G4String("LowE_Livermore"); 82 83 // Decay physics and all particles 84 decPhysicsList = new G4DecayPhysics(); 85 } 86 87 void PhysicsList::SetCuts() 88 { 89 G4VUserPhysicsList::SetVerboseLevel(2); 90 G4VUserPhysicsList::SetCuts(); 91 } 92 93 ///////////////////////////////////////////////////////////////////////////// 94 PhysicsList::~PhysicsList() 95 { 96 delete pMessenger; 97 delete emPhysicsList; 98 delete decPhysicsList; 99 for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];} 100 } 101 102 void PhysicsList::ConstructParticle() 103 { 104 decPhysicsList->ConstructParticle(); 105 } 106 107 void PhysicsList::ConstructProcess() 108 { 109 // transportation 110 AddTransportation(); 111 112 // electromagnetic physics list 113 emPhysicsList->ConstructProcess(); 114 115 // decay physics list 116 decPhysicsList->ConstructProcess(); 117 118 // hadronic physics lists 119 for(size_t i=0; i<hadronPhys.size(); i++) 120 { 121 hadronPhys[i]->ConstructProcess(); 122 } 123 124 // step limitation (as a full process) 125 AddStepMax(); 126 } 127 128 void PhysicsList::AddPhysicsList(const G4String& name) 129 { 130 if (verboseLevel>1) 131 { 132 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 133 } 134 if (name == emName) return; 135 136 // Electromagnetic Models 137 if (name == "standard_opt3") 138 { 139 emName = name; 140 delete emPhysicsList; 141 emPhysicsList = new G4EmStandardPhysics_option3(); 142 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: " 143 << "G4EmStandardPhysics_option3" << G4endl; 144 } 145 else if (name == "standard_opt4") 146 { 147 emName = name; 148 delete emPhysicsList; 149 emPhysicsList = new G4EmStandardPhysics_option4(); 150 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: " 151 << "G4EmStandardPhysics_option4" << G4endl; 152 } 153 else if (name == "LowE_Livermore") 154 { 155 emName = name; 156 delete emPhysicsList; 157 emPhysicsList = new G4EmLivermorePhysics(); 158 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: " 159 << "G4EmLivermorePhysics" << G4endl; 160 } 161 else if (name == "LowE_Penelope") 162 { 163 emName = name; 164 delete emPhysicsList; 165 emPhysicsList = new G4EmPenelopePhysics(); 166 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: " 167 << "G4EmLivermorePhysics" << G4endl; 168 169 // Hadronic Models 170 } 171 else if (name == "elastic" && !helIsRegistered) 172 { 173 174 hadronPhys.push_back( new G4HadronElasticPhysics()); 175 helIsRegistered = true; 176 G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: " 177 << "G4HadronElasticPhysics()" << G4endl; 178 } 179 else if (name == "binary" && !bicIsRegistered) 180 { 181 hadronPhys.push_back(new G4HadronInelasticQBBC()); 182 bicIsRegistered = true; 183 G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: " 184 << "G4HadronInelasticQBBC()" << G4endl; 185 } 186 else if (name == "binary_ion" && !biciIsRegistered) 187 { 188 hadronPhys.push_back(new G4IonBinaryCascadePhysics()); 189 biciIsRegistered = true; 190 } 191 else 192 { 193 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 194 << " is not defined" 195 << G4endl; 196 } 197 } 198 199 void PhysicsList::AddStepMax() 200 { 201 // Step limitation seen as a process 202 stepMaxProcess = new StepMax(); 203 204 auto particleIterator=GetParticleIterator(); 205 particleIterator->reset(); 206 while ((*particleIterator)()) 207 { 208 G4ParticleDefinition* particle = particleIterator->value(); 209 G4ProcessManager* pmanager = particle->GetProcessManager(); 210 211 if (stepMaxProcess->IsApplicable(*particle) && pmanager) 212 { 213 pmanager ->AddDiscreteProcess(stepMaxProcess); 214 } 215 } 216 } 217