Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file electromagnetic/TestEm7/src/PhysicsL << 23 // $Id: PhysicsList.cc,v 1.13 2005/03/16 13:10:37 maire Exp $ 27 /// \brief Implementation of the PhysicsList c << 24 // GEANT4 tag $Name: geant4-07-01 $ 28 // << 29 // 25 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 28 33 #include "PhysicsList.hh" 29 #include "PhysicsList.hh" >> 30 #include "PhysicsListMessenger.hh" 34 31 35 #include "PhysListEmStandard.hh" 32 #include "PhysListEmStandard.hh" 36 #include "PhysListEmStandardNR.hh" << 33 #include "PhysListEmG4v52.hh" 37 #include "PhysicsListMessenger.hh" << 34 #include "PhysListHadronElastic.hh" 38 #include "StepMax.hh" << 35 #include "PhysListBinaryCascade.hh" >> 36 #include "PhysListIonBinaryCascade.hh" 39 37 40 #include "G4BetheBlochIonGasModel.hh" << 41 #include "G4BraggIonGasModel.hh" << 42 #include "G4Decay.hh" << 43 #include "G4DecayPhysics.hh" << 44 #include "G4EmConfigurator.hh" << 45 #include "G4EmLivermorePhysics.hh" << 46 #include "G4EmLowEPPhysics.hh" << 47 #include "G4EmPenelopePhysics.hh" << 48 #include "G4EmStandardPhysics.hh" << 49 #include "G4EmStandardPhysicsGS.hh" << 50 #include "G4EmStandardPhysicsSS.hh" << 51 #include "G4EmStandardPhysicsWVI.hh" << 52 #include "G4EmStandardPhysics_option1.hh" << 53 #include "G4EmStandardPhysics_option2.hh" << 54 #include "G4EmStandardPhysics_option3.hh" << 55 #include "G4EmStandardPhysics_option4.hh" << 56 #include "G4HadronDElasticPhysics.hh" << 57 #include "G4HadronElasticPhysics.hh" << 58 #include "G4HadronHElasticPhysics.hh" << 59 #include "G4HadronInelasticQBBC.hh" << 60 #include "G4IonFluctuations.hh" << 61 #include "G4IonParametrisedLossModel.hh" << 62 #include "G4IonPhysics.hh" << 63 #include "G4LossTableManager.hh" 38 #include "G4LossTableManager.hh" 64 #include "G4PhysicalConstants.hh" << 65 #include "G4ProcessManager.hh" << 66 #include "G4SystemOfUnits.hh" << 67 #include "G4UnitsTable.hh" 39 #include "G4UnitsTable.hh" 68 #include "G4UniversalFluctuation.hh" << 69 40 70 //....oooOO0OOooo........oooOO0OOooo........oo 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 42 72 PhysicsList::PhysicsList() : G4VModularPhysics << 43 PhysicsList::PhysicsList() : G4VModularPhysicsList() 73 { 44 { 74 fHelIsRegisted = false; << 45 G4LossTableManager::Instance(); 75 fBicIsRegisted = false; << 46 defaultCutValue = 1.*mm; 76 fBiciIsRegisted = false; << 47 cutForGamma = defaultCutValue; >> 48 cutForElectron = defaultCutValue; >> 49 cutForPositron = defaultCutValue; 77 50 78 // protected member of the base class << 51 stepMaxProcess = 0; 79 verboseLevel = 1; << 80 52 81 fMessenger = new PhysicsListMessenger(this); << 53 pMessenger = new PhysicsListMessenger(this); >> 54 >> 55 SetVerboseLevel(1); 82 56 83 // EM physics 57 // EM physics 84 fEmName = G4String("emstandard_opt0"); << 58 emPhysicsList = new PhysListEmStandard(emName = "standard"); 85 fEmPhysicsList = new G4EmStandardPhysics(ver << 86 59 87 // Deacy physics and all particles << 88 fDecPhysicsList = new G4DecayPhysics(verbose << 89 } 60 } 90 61 91 //....oooOO0OOooo........oooOO0OOooo........oo 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 63 93 PhysicsList::~PhysicsList() 64 PhysicsList::~PhysicsList() 94 { 65 { 95 delete fMessenger; << 66 delete pMessenger; 96 delete fEmPhysicsList; << 67 delete emPhysicsList; 97 delete fDecPhysicsList; << 68 for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i]; 98 for (size_t i = 0; i < fHadronPhys.size(); i << 99 delete fHadronPhys[i]; << 100 } << 101 } 69 } 102 70 103 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 104 72 >> 73 // Bosons >> 74 #include "G4ChargedGeantino.hh" >> 75 #include "G4Geantino.hh" >> 76 #include "G4Gamma.hh" >> 77 #include "G4OpticalPhoton.hh" >> 78 >> 79 // leptons >> 80 #include "G4MuonPlus.hh" >> 81 #include "G4MuonMinus.hh" >> 82 #include "G4NeutrinoMu.hh" >> 83 #include "G4AntiNeutrinoMu.hh" >> 84 >> 85 #include "G4Electron.hh" >> 86 #include "G4Positron.hh" >> 87 #include "G4NeutrinoE.hh" >> 88 #include "G4AntiNeutrinoE.hh" >> 89 >> 90 // Mesons >> 91 #include "G4PionPlus.hh" >> 92 #include "G4PionMinus.hh" >> 93 #include "G4PionZero.hh" >> 94 #include "G4Eta.hh" >> 95 #include "G4EtaPrime.hh" >> 96 >> 97 #include "G4KaonPlus.hh" >> 98 #include "G4KaonMinus.hh" >> 99 #include "G4KaonZero.hh" >> 100 #include "G4AntiKaonZero.hh" >> 101 #include "G4KaonZeroLong.hh" >> 102 #include "G4KaonZeroShort.hh" >> 103 >> 104 // Baryons >> 105 #include "G4Proton.hh" >> 106 #include "G4AntiProton.hh" >> 107 #include "G4Neutron.hh" >> 108 #include "G4AntiNeutron.hh" >> 109 >> 110 // Nuclei >> 111 #include "G4Deuteron.hh" >> 112 #include "G4Triton.hh" >> 113 #include "G4Alpha.hh" >> 114 #include "G4GenericIon.hh" >> 115 >> 116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 117 105 void PhysicsList::ConstructParticle() 118 void PhysicsList::ConstructParticle() 106 { 119 { 107 fDecPhysicsList->ConstructParticle(); << 120 // pseudo-particles >> 121 G4Geantino::GeantinoDefinition(); >> 122 G4ChargedGeantino::ChargedGeantinoDefinition(); >> 123 >> 124 // gamma >> 125 G4Gamma::GammaDefinition(); >> 126 >> 127 // optical photon >> 128 G4OpticalPhoton::OpticalPhotonDefinition(); >> 129 >> 130 // leptons >> 131 G4Electron::ElectronDefinition(); >> 132 G4Positron::PositronDefinition(); >> 133 G4MuonPlus::MuonPlusDefinition(); >> 134 G4MuonMinus::MuonMinusDefinition(); >> 135 >> 136 G4NeutrinoE::NeutrinoEDefinition(); >> 137 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); >> 138 G4NeutrinoMu::NeutrinoMuDefinition(); >> 139 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); >> 140 >> 141 // mesons >> 142 G4PionPlus::PionPlusDefinition(); >> 143 G4PionMinus::PionMinusDefinition(); >> 144 G4PionZero::PionZeroDefinition(); >> 145 G4Eta::EtaDefinition(); >> 146 G4EtaPrime::EtaPrimeDefinition(); >> 147 G4KaonPlus::KaonPlusDefinition(); >> 148 G4KaonMinus::KaonMinusDefinition(); >> 149 G4KaonZero::KaonZeroDefinition(); >> 150 G4AntiKaonZero::AntiKaonZeroDefinition(); >> 151 G4KaonZeroLong::KaonZeroLongDefinition(); >> 152 G4KaonZeroShort::KaonZeroShortDefinition(); >> 153 >> 154 // barions >> 155 G4Proton::ProtonDefinition(); >> 156 G4AntiProton::AntiProtonDefinition(); >> 157 G4Neutron::NeutronDefinition(); >> 158 G4AntiNeutron::AntiNeutronDefinition(); >> 159 >> 160 // ions >> 161 G4Deuteron::DeuteronDefinition(); >> 162 G4Triton::TritonDefinition(); >> 163 G4Alpha::AlphaDefinition(); >> 164 G4GenericIon::GenericIonDefinition(); 108 } 165 } 109 166 110 //....oooOO0OOooo........oooOO0OOooo........oo 167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 111 168 >> 169 #include "G4ProcessManager.hh" >> 170 #include "G4Decay.hh" >> 171 112 void PhysicsList::ConstructProcess() 172 void PhysicsList::ConstructProcess() 113 { 173 { 114 // transportation 174 // transportation 115 // 175 // 116 AddTransportation(); 176 AddTransportation(); 117 << 177 118 // electromagnetic physics list 178 // electromagnetic physics list 119 // 179 // 120 fEmPhysicsList->ConstructProcess(); << 180 emPhysicsList->ConstructProcess(); 121 << 181 122 // decay physics list << 182 // hadronic physics lists >> 183 for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess(); >> 184 >> 185 // decay process 123 // 186 // 124 fDecPhysicsList->ConstructProcess(); << 187 G4Decay* fDecayProcess = new G4Decay(); 125 188 126 // hadronic physics lists << 189 theParticleIterator->reset(); 127 for (size_t i = 0; i < fHadronPhys.size(); i << 190 while( (*theParticleIterator)() ){ 128 fHadronPhys[i]->ConstructProcess(); << 191 G4ParticleDefinition* particle = theParticleIterator->value(); 129 } << 192 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 193 >> 194 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 130 195 >> 196 pmanager ->AddProcess(fDecayProcess); >> 197 >> 198 // set ordering for PostStepDoIt and AtRestDoIt >> 199 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); >> 200 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 201 >> 202 } >> 203 } >> 204 131 // step limitation (as a full process) 205 // step limitation (as a full process) 132 // << 206 // 133 AddStepMax(); 207 AddStepMax(); 134 } 208 } 135 209 136 //....oooOO0OOooo........oooOO0OOooo........oo 210 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 137 211 138 void PhysicsList::AddPhysicsList(const G4Strin 212 void PhysicsList::AddPhysicsList(const G4String& name) 139 { 213 { 140 if (verboseLevel > 1) { << 214 if (verboseLevel>-1) { 141 G4cout << "PhysicsList::AddPhysicsList: <" 215 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 142 } 216 } 143 217 144 if (name == fEmName) return; << 218 if (name == emName) return; >> 219 >> 220 if (name == "standard") { >> 221 >> 222 emName = name; >> 223 delete emPhysicsList; >> 224 emPhysicsList = new PhysListEmStandard(name); >> 225 >> 226 } else if (name == "g4v52") { >> 227 >> 228 emName = name; >> 229 delete emPhysicsList; >> 230 emPhysicsList = new PhysListEmG4v52(name); >> 231 >> 232 } else if (name == "elastic") { >> 233 >> 234 hadronPhys.push_back( new PhysListHadronElastic(name)); >> 235 >> 236 } else if (name == "binary") { >> 237 >> 238 hadronPhys.push_back( new PhysListBinaryCascade(name)); >> 239 >> 240 } else if (name == "binary_ion") { >> 241 >> 242 hadronPhys.push_back( new PhysListIonBinaryCascade(name)); >> 243 >> 244 } else { 145 245 146 if (name == "local") { << 147 fEmName = name; << 148 delete fEmPhysicsList; << 149 fEmPhysicsList = new PhysListEmStandard(na << 150 } << 151 else if (name == "emstandard_opt0") { << 152 fEmName = name; << 153 delete fEmPhysicsList; << 154 fEmPhysicsList = new G4EmStandardPhysics(v << 155 } << 156 else if (name == "emstandard_opt1") { << 157 fEmName = name; << 158 delete fEmPhysicsList; << 159 fEmPhysicsList = new G4EmStandardPhysics_o << 160 } << 161 else if (name == "emstandard_opt2") { << 162 fEmName = name; << 163 delete fEmPhysicsList; << 164 fEmPhysicsList = new G4EmStandardPhysics_o << 165 } << 166 else if (name == "emstandard_opt3") { << 167 fEmName = name; << 168 delete fEmPhysicsList; << 169 fEmPhysicsList = new G4EmStandardPhysics_o << 170 } << 171 else if (name == "emstandard_opt4") { << 172 fEmName = name; << 173 delete fEmPhysicsList; << 174 fEmPhysicsList = new G4EmStandardPhysics_o << 175 } << 176 else if (name == "ionGasModels") { << 177 AddPhysicsList("emstandard_opt0"); << 178 fEmName = name; << 179 AddIonGasModels(); << 180 } << 181 else if (name == "standardNR") { << 182 fEmName = name; << 183 delete fEmPhysicsList; << 184 fEmPhysicsList = new PhysListEmStandardNR( << 185 } << 186 else if (name == "emlivermore") { << 187 fEmName = name; << 188 delete fEmPhysicsList; << 189 fEmPhysicsList = new G4EmLivermorePhysics( << 190 } << 191 else if (name == "empenelope") { << 192 fEmName = name; << 193 delete fEmPhysicsList; << 194 fEmPhysicsList = new G4EmPenelopePhysics(v << 195 } << 196 else if (name == "emlowenergy") { << 197 fEmName = name; << 198 delete fEmPhysicsList; << 199 fEmPhysicsList = new G4EmLowEPPhysics(verb << 200 } << 201 else if (name == "emstandardSS") { << 202 fEmName = name; << 203 delete fEmPhysicsList; << 204 fEmPhysicsList = new G4EmStandardPhysicsSS << 205 } << 206 else if (name == "emstandardWVI") { << 207 fEmName = name; << 208 delete fEmPhysicsList; << 209 fEmPhysicsList = new G4EmStandardPhysicsWV << 210 } << 211 else if (name == "emstandardGS") { << 212 fEmName = name; << 213 delete fEmPhysicsList; << 214 fEmPhysicsList = new G4EmStandardPhysicsGS << 215 } << 216 else if (name == "elastic" && !fHelIsRegiste << 217 fHadronPhys.push_back(new G4HadronElasticP << 218 fHelIsRegisted = true; << 219 } << 220 else if (name == "DElastic" && !fHelIsRegist << 221 fHadronPhys.push_back(new G4HadronDElastic << 222 fHelIsRegisted = true; << 223 } << 224 else if (name == "HElastic" && !fHelIsRegist << 225 fHadronPhys.push_back(new G4HadronHElastic << 226 fHelIsRegisted = true; << 227 } << 228 else if (name == "binary" && !fBicIsRegisted << 229 fHadronPhys.push_back(new G4HadronInelasti << 230 fBicIsRegisted = true; << 231 } << 232 else if (name == "binary_ion" && !fBiciIsReg << 233 fHadronPhys.push_back(new G4IonPhysics(ver << 234 fBiciIsRegisted = true; << 235 } << 236 else { << 237 G4cout << "PhysicsList::AddPhysicsList: <" 246 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 238 << " is not defined" << G4endl; << 247 << " is not defined" >> 248 << G4endl; 239 } 249 } 240 } 250 } 241 251 242 //....oooOO0OOooo........oooOO0OOooo........oo 252 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 243 253 >> 254 #include "StepMax.hh" >> 255 244 void PhysicsList::AddStepMax() 256 void PhysicsList::AddStepMax() 245 { 257 { 246 // Step limitation seen as a process 258 // Step limitation seen as a process 247 fStepMaxProcess = new StepMax(); << 259 stepMaxProcess = new StepMax(); 248 << 249 auto particleIterator = GetParticleIterator( << 250 particleIterator->reset(); << 251 while ((*particleIterator)()) { << 252 G4ParticleDefinition* particle = particleI << 253 G4ProcessManager* pmanager = particle->Get << 254 260 255 if (fStepMaxProcess->IsApplicable(*particl << 261 theParticleIterator->reset(); 256 pmanager->AddDiscreteProcess(fStepMaxPro << 262 while ((*theParticleIterator)()){ 257 } << 263 G4ParticleDefinition* particle = theParticleIterator->value(); >> 264 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 265 >> 266 if (stepMaxProcess->IsApplicable(*particle)) >> 267 { >> 268 pmanager ->AddDiscreteProcess(stepMaxProcess); >> 269 } 258 } 270 } 259 } 271 } 260 272 261 //....oooOO0OOooo........oooOO0OOooo........oo 273 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 262 274 263 void PhysicsList::AddIonGasModels() << 275 #include "G4Gamma.hh" >> 276 #include "G4Electron.hh" >> 277 #include "G4Positron.hh" >> 278 >> 279 void PhysicsList::SetCuts() 264 { 280 { 265 G4EmConfigurator* em_config = G4LossTableMan << 281 266 auto particleIterator = GetParticleIterator( << 282 if (verboseLevel >0){ 267 particleIterator->reset(); << 283 G4cout << "PhysicsList::SetCuts:"; 268 while ((*particleIterator)()) { << 284 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 269 G4ParticleDefinition* particle = particleI << 270 G4String partname = particle->GetParticleN << 271 if (partname == "alpha" || partname == "He << 272 G4BraggIonGasModel* mod1 = new G4BraggIo << 273 G4BetheBlochIonGasModel* mod2 = new G4Be << 274 G4double eth = 2. * MeV * particle->GetP << 275 em_config->SetExtraEmModel(partname, "io << 276 em_config->SetExtraEmModel(partname, "io << 277 new G4Univers << 278 } << 279 } 285 } >> 286 >> 287 // set cut values for gamma at first and for e- second and next for e+, >> 288 // because some processes for e+/e- need cut values for gamma >> 289 SetCutValue(cutForGamma, "gamma"); >> 290 SetCutValue(cutForElectron, "e-"); >> 291 SetCutValue(cutForPositron, "e+"); >> 292 >> 293 if (verboseLevel>0) DumpCutValuesTable(); >> 294 } >> 295 >> 296 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 297 >> 298 void PhysicsList::SetCutForGamma(G4double cut) >> 299 { >> 300 cutForGamma = cut; >> 301 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 302 } >> 303 >> 304 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 305 >> 306 void PhysicsList::SetCutForElectron(G4double cut) >> 307 { >> 308 cutForElectron = cut; >> 309 SetParticleCuts(cutForElectron, G4Electron::Electron()); >> 310 } >> 311 >> 312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 313 >> 314 void PhysicsList::SetCutForPositron(G4double cut) >> 315 { >> 316 cutForPositron = cut; >> 317 SetParticleCuts(cutForPositron, G4Positron::Positron()); 280 } 318 } 281 319 282 //....oooOO0OOooo........oooOO0OOooo........oo 320 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 321 283 322