Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 08:27:35

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 "PhysicsListMessenger.hh"
0033 
0034 #include "G4EmLivermorePhysics.hh"
0035 #include "G4EmLowEPPhysics.hh"
0036 #include "G4EmPenelopePhysics.hh"
0037 #include "G4EmStandardPhysics.hh"
0038 #include "G4EmStandardPhysicsGS.hh"
0039 #include "G4EmStandardPhysicsSS.hh"
0040 #include "G4EmStandardPhysicsWVI.hh"
0041 #include "G4EmStandardPhysics_option1.hh"
0042 #include "G4EmStandardPhysics_option2.hh"
0043 #include "G4EmStandardPhysics_option3.hh"
0044 #include "G4EmStandardPhysics_option4.hh"
0045 #include "G4LossTableManager.hh"
0046 #include "G4SystemOfUnits.hh"
0047 #include "G4UnitsTable.hh"
0048 
0049 // particles
0050 
0051 #include "StepMax.hh"
0052 
0053 #include "G4BaryonConstructor.hh"
0054 #include "G4BosonConstructor.hh"
0055 #include "G4Decay.hh"
0056 #include "G4GenericIon.hh"
0057 #include "G4IonConstructor.hh"
0058 #include "G4LeptonConstructor.hh"
0059 #include "G4MesonConstructor.hh"
0060 #include "G4NuclideTable.hh"
0061 #include "G4PhysicsListHelper.hh"
0062 #include "G4RadioactiveDecay.hh"
0063 #include "G4ShortLivedConstructor.hh"
0064 
0065 G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = nullptr;
0066 
0067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0068 
0069 PhysicsList::PhysicsList()
0070 {
0071   fMessenger = new PhysicsListMessenger(this);
0072 
0073   SetVerboseLevel(1);
0074 
0075   // EM physics
0076   fEmPhysicsList = new PhysListEmStandard(fEmName = "local");
0077 
0078   G4LossTableManager::Instance();
0079   SetDefaultCutValue(1. * mm);
0080 }
0081 
0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0083 
0084 PhysicsList::~PhysicsList()
0085 {
0086   delete fMessenger;
0087   delete fEmPhysicsList;
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0091 
0092 void PhysicsList::ConstructParticle()
0093 {
0094   G4BosonConstructor pBosonConstructor;
0095   pBosonConstructor.ConstructParticle();
0096 
0097   G4LeptonConstructor pLeptonConstructor;
0098   pLeptonConstructor.ConstructParticle();
0099 
0100   G4MesonConstructor pMesonConstructor;
0101   pMesonConstructor.ConstructParticle();
0102 
0103   G4BaryonConstructor pBaryonConstructor;
0104   pBaryonConstructor.ConstructParticle();
0105 
0106   G4IonConstructor pIonConstructor;
0107   pIonConstructor.ConstructParticle();
0108 
0109   G4ShortLivedConstructor pShortLivedConstructor;
0110   pShortLivedConstructor.ConstructParticle();
0111 }
0112 
0113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0114 
0115 #include "G4ProcessManager.hh"
0116 
0117 void PhysicsList::ConstructProcess()
0118 {
0119   // transportation
0120   //
0121   AddTransportation();
0122 
0123   // electromagnetic physics list
0124   //
0125   fEmPhysicsList->ConstructProcess();
0126 
0127   // Em options
0128   //
0129   G4EmParameters* param = G4EmParameters::Instance();
0130   param->SetBuildCSDARange(true);
0131 
0132   // decay process
0133   //
0134   AddDecay();
0135 
0136   // radioactive decay Process
0137   //
0138   AddRadioactiveDecay();
0139 
0140   // step limitation (as a full process)
0141   //
0142   AddStepMax();
0143 }
0144 
0145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0146 
0147 void PhysicsList::AddPhysicsList(const G4String& name)
0148 {
0149   if (verboseLevel > -1) {
0150     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0151   }
0152 
0153   if (name == fEmName) return;
0154 
0155   if (name == "local") {
0156     fEmName = name;
0157     delete fEmPhysicsList;
0158     fEmPhysicsList = new PhysListEmStandard(name);
0159   }
0160   else if (name == "emstandard_opt0") {
0161     fEmName = name;
0162     delete fEmPhysicsList;
0163     fEmPhysicsList = new G4EmStandardPhysics();
0164   }
0165   else if (name == "emstandard_opt1") {
0166     fEmName = name;
0167     delete fEmPhysicsList;
0168     fEmPhysicsList = new G4EmStandardPhysics_option1();
0169   }
0170   else if (name == "emstandard_opt2") {
0171     fEmName = name;
0172     delete fEmPhysicsList;
0173     fEmPhysicsList = new G4EmStandardPhysics_option2();
0174   }
0175   else if (name == "emstandard_opt3") {
0176     fEmName = name;
0177     delete fEmPhysicsList;
0178     fEmPhysicsList = new G4EmStandardPhysics_option3();
0179   }
0180   else if (name == "emstandard_opt4") {
0181     fEmName = name;
0182     delete fEmPhysicsList;
0183     fEmPhysicsList = new G4EmStandardPhysics_option4();
0184   }
0185   else if (name == "emstandardSS") {
0186     fEmName = name;
0187     delete fEmPhysicsList;
0188     fEmPhysicsList = new G4EmStandardPhysicsSS();
0189   }
0190   else if (name == "emstandardGS") {
0191     fEmName = name;
0192     delete fEmPhysicsList;
0193     fEmPhysicsList = new G4EmStandardPhysicsGS();
0194   }
0195   else if (name == "emstandardWVI") {
0196     fEmName = name;
0197     delete fEmPhysicsList;
0198     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0199   }
0200   else if (name == "emlowenergy") {
0201     fEmName = name;
0202     delete fEmPhysicsList;
0203     fEmPhysicsList = new G4EmLowEPPhysics();
0204   }
0205   else if (name == "emlivermore") {
0206     fEmName = name;
0207     delete fEmPhysicsList;
0208     fEmPhysicsList = new G4EmLivermorePhysics();
0209   }
0210   else if (name == "empenelope") {
0211     fEmName = name;
0212     delete fEmPhysicsList;
0213     fEmPhysicsList = new G4EmPenelopePhysics();
0214   }
0215   else {
0216     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0217            << " is not defined" << G4endl;
0218   }
0219 }
0220 
0221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0222 
0223 void PhysicsList::AddDecay()
0224 {
0225   // decay process
0226   //
0227   G4Decay* decay = new G4Decay();
0228   G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
0229 
0230   auto particleIterator = GetParticleIterator();
0231   particleIterator->reset();
0232   while ((*particleIterator)()) {
0233     G4ParticleDefinition* particle = particleIterator->value();
0234     if (decay->IsApplicable(*particle) && !particle->IsShortLived()) {
0235       ph->RegisterProcess(decay, particle);
0236     }
0237   }
0238 }
0239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0240 
0241 void PhysicsList::AddRadioactiveDecay()
0242 {
0243   G4RadioactiveDecay* radioactiveDecay = new G4RadioactiveDecay();
0244 
0245   G4bool armFlag = false;
0246   radioactiveDecay->SetARM(armFlag);  // Atomic Rearangement
0247 
0248   // atomic de-excitation module, if needed
0249   if (armFlag) {
0250     G4EmParameters::Instance()->SetAuger(true);
0251     G4EmParameters::Instance()->SetDeexcitationIgnoreCut(true);
0252   }
0253 
0254   G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
0255   ph->RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon());
0256 
0257   // mandatory for G4NuclideTable
0258   //
0259   const G4double meanLife = 1 * picosecond, halfLife = meanLife * std::log(2);
0260   G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(halfLife);
0261 }
0262 
0263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0264 
0265 void PhysicsList::AddStepMax()
0266 {
0267   // Step limitation seen as a process
0268   fStepMaxProcess = new StepMax();
0269 
0270   auto particleIterator = GetParticleIterator();
0271   particleIterator->reset();
0272   while ((*particleIterator)()) {
0273     G4ParticleDefinition* particle = particleIterator->value();
0274     G4ProcessManager* pmanager = particle->GetProcessManager();
0275 
0276     if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
0277       pmanager->AddDiscreteProcess(fStepMaxProcess);
0278   }
0279 }
0280 
0281 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......