Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-08 07:52:57

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file PhysicsList.cc
0027 /// \brief Implementation of the PhysicsList class
0028 
0029 #include "PhysicsList.hh"
0030 
0031 #include "PhysListEmStandard.hh"
0032 #include "PhysListEmStandardSSM.hh"
0033 #include "PhysicsListMessenger.hh"
0034 
0035 #include "G4EmDNAPhysics.hh"
0036 #include "G4EmDNAPhysics_option1.hh"
0037 #include "G4EmDNAPhysics_option2.hh"
0038 #include "G4EmDNAPhysics_option3.hh"
0039 #include "G4EmDNAPhysics_option4.hh"
0040 #include "G4EmDNAPhysics_option5.hh"
0041 #include "G4EmDNAPhysics_option6.hh"
0042 #include "G4EmDNAPhysics_option7.hh"
0043 #include "G4EmLivermorePhysics.hh"
0044 #include "G4EmLowEPPhysics.hh"
0045 #include "G4EmPenelopePhysics.hh"
0046 #include "G4EmStandardPhysics.hh"
0047 #include "G4EmStandardPhysicsGS.hh"
0048 #include "G4EmStandardPhysicsSS.hh"
0049 #include "G4EmStandardPhysicsWVI.hh"
0050 #include "G4EmStandardPhysics_option1.hh"
0051 #include "G4EmStandardPhysics_option2.hh"
0052 #include "G4EmStandardPhysics_option3.hh"
0053 #include "G4EmStandardPhysics_option4.hh"
0054 #include "G4LossTableManager.hh"
0055 #include "G4SystemOfUnits.hh"
0056 #include "G4UnitsTable.hh"
0057 
0058 // particles
0059 
0060 #include "G4BaryonConstructor.hh"
0061 #include "G4BosonConstructor.hh"
0062 #include "G4DNAGenericIonsManager.hh"
0063 #include "G4IonConstructor.hh"
0064 #include "G4LeptonConstructor.hh"
0065 #include "G4MesonConstructor.hh"
0066 #include "G4ShortLivedConstructor.hh"
0067 
0068 G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = nullptr;
0069 
0070 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0071 
0072 PhysicsList::PhysicsList()
0073 {
0074   fMessenger = new PhysicsListMessenger(this);
0075 
0076   SetVerboseLevel(1);
0077 
0078   // EM physics
0079   fEmPhysicsList = new PhysListEmStandard(fEmName = "local");
0080 
0081   // Em options
0082   //
0083   G4EmParameters::Instance()->SetBuildCSDARange(true);
0084 
0085   SetDefaultCutValue(1. * mm);
0086 }
0087 
0088 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0089 
0090 PhysicsList::~PhysicsList()
0091 {
0092   delete fMessenger;
0093   delete fEmPhysicsList;
0094 }
0095 
0096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0097 
0098 void PhysicsList::ConstructParticle()
0099 {
0100   G4BosonConstructor pBosonConstructor;
0101   pBosonConstructor.ConstructParticle();
0102 
0103   G4LeptonConstructor pLeptonConstructor;
0104   pLeptonConstructor.ConstructParticle();
0105 
0106   G4MesonConstructor pMesonConstructor;
0107   pMesonConstructor.ConstructParticle();
0108 
0109   G4BaryonConstructor pBaryonConstructor;
0110   pBaryonConstructor.ConstructParticle();
0111 
0112   G4IonConstructor pIonConstructor;
0113   pIonConstructor.ConstructParticle();
0114 
0115   G4ShortLivedConstructor pShortLivedConstructor;
0116   pShortLivedConstructor.ConstructParticle();
0117 
0118   // DNA
0119   G4DNAGenericIonsManager* genericIonsManager;
0120   genericIonsManager = G4DNAGenericIonsManager::Instance();
0121   genericIonsManager->GetIon("alpha++");
0122   genericIonsManager->GetIon("alpha+");
0123   genericIonsManager->GetIon("helium");
0124   genericIonsManager->GetIon("hydrogen");
0125 }
0126 
0127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0128 
0129 #include "G4ProcessManager.hh"
0130 
0131 void PhysicsList::ConstructProcess()
0132 {
0133   // transportation
0134   //
0135   AddTransportation();
0136 
0137   // electromagnetic physics list
0138   //
0139   fEmPhysicsList->ConstructProcess();
0140 
0141   // decay process
0142   //
0143   AddDecay();
0144 
0145   // step limitation (as a full process)
0146   //
0147   AddStepMax();
0148 }
0149 
0150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0151 
0152 void PhysicsList::AddPhysicsList(const G4String& name)
0153 {
0154   if (verboseLevel > -1) {
0155     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0156   }
0157 
0158   if (name == fEmName) return;
0159 
0160   if (name == "local") {
0161     fEmName = name;
0162     delete fEmPhysicsList;
0163     fEmPhysicsList = new PhysListEmStandard(name);
0164   }
0165   else if (name == "emstandard_opt0") {
0166     fEmName = name;
0167     delete fEmPhysicsList;
0168     fEmPhysicsList = new G4EmStandardPhysics();
0169   }
0170   else if (name == "emstandard_opt1") {
0171     fEmName = name;
0172     delete fEmPhysicsList;
0173     fEmPhysicsList = new G4EmStandardPhysics_option1();
0174   }
0175   else if (name == "emstandard_opt2") {
0176     fEmName = name;
0177     delete fEmPhysicsList;
0178     fEmPhysicsList = new G4EmStandardPhysics_option2();
0179   }
0180   else if (name == "emstandard_opt3") {
0181     fEmName = name;
0182     delete fEmPhysicsList;
0183     fEmPhysicsList = new G4EmStandardPhysics_option3();
0184   }
0185   else if (name == "emstandard_opt4") {
0186     fEmName = name;
0187     delete fEmPhysicsList;
0188     fEmPhysicsList = new G4EmStandardPhysics_option4();
0189   }
0190   else if (name == "emstandardSS") {
0191     fEmName = name;
0192     delete fEmPhysicsList;
0193     fEmPhysicsList = new G4EmStandardPhysicsSS();
0194   }
0195   else if (name == "standardSSM") {
0196     fEmName = name;
0197     delete fEmPhysicsList;
0198     fEmPhysicsList = new PhysListEmStandardSSM(name);
0199   }
0200   else if (name == "emstandardWVI") {
0201     fEmName = name;
0202     delete fEmPhysicsList;
0203     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0204   }
0205   else if (name == "standardGS") {
0206     fEmName = name;
0207     delete fEmPhysicsList;
0208     fEmPhysicsList = new G4EmStandardPhysicsGS();
0209   }
0210   else if (name == "emlivermore") {
0211     fEmName = name;
0212     delete fEmPhysicsList;
0213     fEmPhysicsList = new G4EmLivermorePhysics();
0214   }
0215   else if (name == "empenelope") {
0216     fEmName = name;
0217     delete fEmPhysicsList;
0218     fEmPhysicsList = new G4EmPenelopePhysics();
0219   }
0220   else if (name == "emlowenergy") {
0221     fEmName = name;
0222     delete fEmPhysicsList;
0223     fEmPhysicsList = new G4EmLowEPPhysics();
0224   }
0225   else if (name == "dna") {
0226     fEmName = name;
0227     delete fEmPhysicsList;
0228     fEmPhysicsList = new G4EmDNAPhysics();
0229   }
0230   else if (name == "dna_opt1") {
0231     fEmName = name;
0232     delete fEmPhysicsList;
0233     fEmPhysicsList = new G4EmDNAPhysics_option1();
0234   }
0235   else if (name == "dna_opt2") {
0236     fEmName = name;
0237     delete fEmPhysicsList;
0238     fEmPhysicsList = new G4EmDNAPhysics_option2();
0239   }
0240   else if (name == "dna_opt3") {
0241     fEmName = name;
0242     delete fEmPhysicsList;
0243     fEmPhysicsList = new G4EmDNAPhysics_option3();
0244   }
0245   else if (name == "dna_opt4") {
0246     fEmName = name;
0247     delete fEmPhysicsList;
0248     fEmPhysicsList = new G4EmDNAPhysics_option4();
0249   }
0250   else if (name == "dna_opt5") {
0251     fEmName = name;
0252     delete fEmPhysicsList;
0253     fEmPhysicsList = new G4EmDNAPhysics_option5();
0254   }
0255   else if (name == "dna_opt6") {
0256     fEmName = name;
0257     delete fEmPhysicsList;
0258     fEmPhysicsList = new G4EmDNAPhysics_option6();
0259   }
0260   else if (name == "dna_opt7") {
0261     fEmName = name;
0262     delete fEmPhysicsList;
0263     fEmPhysicsList = new G4EmDNAPhysics_option7();
0264   }
0265   else {
0266     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0267            << " is not defined" << G4endl;
0268   }
0269   G4EmParameters::Instance()->SetBuildCSDARange(true);
0270 }
0271 
0272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0273 
0274 #include "G4Decay.hh"
0275 
0276 void PhysicsList::AddDecay()
0277 {
0278   // decay process
0279   //
0280   G4Decay* fDecayProcess = new G4Decay();
0281 
0282   auto particleIterator = GetParticleIterator();
0283   particleIterator->reset();
0284   while ((*particleIterator)()) {
0285     G4ParticleDefinition* particle = particleIterator->value();
0286     G4ProcessManager* pmanager = particle->GetProcessManager();
0287 
0288     if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
0289       pmanager->AddProcess(fDecayProcess);
0290 
0291       // set ordering for PostStepDoIt and AtRestDoIt
0292       pmanager->SetProcessOrdering(fDecayProcess, idxPostStep);
0293       pmanager->SetProcessOrdering(fDecayProcess, idxAtRest);
0294     }
0295   }
0296 }
0297 
0298 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0299 
0300 #include "StepMax.hh"
0301 
0302 void PhysicsList::AddStepMax()
0303 {
0304   // Step limitation seen as a process
0305   fStepMaxProcess = new StepMax();
0306 
0307   auto particleIterator = GetParticleIterator();
0308   particleIterator->reset();
0309   while ((*particleIterator)()) {
0310     G4ParticleDefinition* particle = particleIterator->value();
0311     G4ProcessManager* pmanager = particle->GetProcessManager();
0312 
0313     if (fStepMaxProcess->IsApplicable(*particle)) {
0314       pmanager->AddDiscreteProcess(fStepMaxProcess);
0315     }
0316   }
0317 }
0318 
0319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......