Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:08:34

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 //---------------------------------------------------------------------------
0030 //
0031 // ClassName:   PhysicsList
0032 //
0033 // Author:      V.Ivanchenko 14.10.2002
0034 //
0035 // Modified:
0036 // 17.11.06 Use components from physics_lists subdirectory (V.Ivanchenko)
0037 // 24.10.12 Migrated to new stopping and ion physics (A.Ribon)
0038 //
0039 //----------------------------------------------------------------------------
0040 //
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 
0045 #include "PhysicsList.hh"
0046 
0047 #include "PhysListEmStandard.hh"
0048 #include "PhysicsListMessenger.hh"
0049 #include "StepMax.hh"
0050 
0051 #include "G4DecayPhysics.hh"
0052 #include "G4Electron.hh"
0053 #include "G4EmExtraPhysics.hh"
0054 #include "G4EmLivermorePhysics.hh"
0055 #include "G4EmLowEPPhysics.hh"
0056 #include "G4EmPenelopePhysics.hh"
0057 #include "G4EmStandardPhysics.hh"
0058 #include "G4EmStandardPhysicsGS.hh"
0059 #include "G4EmStandardPhysicsSS.hh"
0060 #include "G4EmStandardPhysicsWVI.hh"
0061 #include "G4EmStandardPhysics_option1.hh"
0062 #include "G4EmStandardPhysics_option2.hh"
0063 #include "G4EmStandardPhysics_option3.hh"
0064 #include "G4EmStandardPhysics_option4.hh"
0065 #include "G4Gamma.hh"
0066 #include "G4HadronElasticPhysics.hh"
0067 #include "G4HadronInelasticQBBC.hh"
0068 #include "G4IonPhysics.hh"
0069 #include "G4LossTableManager.hh"
0070 #include "G4ParticleTable.hh"
0071 #include "G4ParticleTypes.hh"
0072 #include "G4Positron.hh"
0073 #include "G4ProcessManager.hh"
0074 #include "G4Proton.hh"
0075 #include "G4RegionStore.hh"
0076 #include "G4StoppingPhysics.hh"
0077 #include "G4SystemOfUnits.hh"
0078 #include "G4UnitsTable.hh"
0079 
0080 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0081 
0082 PhysicsList::PhysicsList()
0083   : G4VModularPhysicsList(),
0084     fEmPhysicsList(nullptr),
0085     fDecayPhysicsList(nullptr),
0086     fStepMaxProcess(nullptr),
0087     fMessenger(nullptr)
0088 {
0089   G4LossTableManager::Instance();
0090   SetDefaultCutValue(1 * mm);
0091 
0092   fMessenger = new PhysicsListMessenger(this);
0093   fStepMaxProcess = new StepMax();
0094 
0095   // Initilise flags
0096 
0097   SetVerboseLevel(1);
0098 
0099   fHelIsRegisted = false;
0100   fBicIsRegisted = false;
0101   fGnucIsRegisted = false;
0102   fStopIsRegisted = false;
0103 
0104   // EM physics
0105   fEmName = G4String("emstandard");
0106   fEmPhysicsList = new G4EmStandardPhysics();
0107 
0108   // Decay Physics is always defined
0109   fDecayPhysicsList = new G4DecayPhysics();
0110 }
0111 
0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0113 
0114 PhysicsList::~PhysicsList()
0115 {
0116   delete fMessenger;
0117   delete fDecayPhysicsList;
0118   delete fEmPhysicsList;
0119   delete fStepMaxProcess;
0120   for (size_t i = 0; i < fHadronPhys.size(); i++) {
0121     delete fHadronPhys[i];
0122   }
0123 }
0124 
0125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0126 
0127 void PhysicsList::ConstructParticle()
0128 {
0129   fDecayPhysicsList->ConstructParticle();
0130 }
0131 
0132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0133 
0134 void PhysicsList::ConstructProcess()
0135 {
0136   AddTransportation();
0137   fEmPhysicsList->ConstructProcess();
0138   fDecayPhysicsList->ConstructProcess();
0139   for (size_t i = 0; i < fHadronPhys.size(); ++i) {
0140     fHadronPhys[i]->ConstructProcess();
0141   }
0142   AddStepMax();
0143 }
0144 
0145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0146 
0147 void PhysicsList::AddPhysicsList(const G4String& name)
0148 {
0149   if (verboseLevel > 1) G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0150 
0151   if (name == fEmName) return;
0152 
0153   if (name == "emstandard") {
0154     fEmName = name;
0155     delete fEmPhysicsList;
0156     fEmPhysicsList = new G4EmStandardPhysics(verboseLevel);
0157     if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0158   }
0159   else if (name == "emstandard_opt1") {
0160     fEmName = name;
0161     delete fEmPhysicsList;
0162     fEmPhysicsList = new G4EmStandardPhysics_option1(verboseLevel);
0163     if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0164   }
0165   else if (name == "emstandard_opt2") {
0166     fEmName = name;
0167     delete fEmPhysicsList;
0168     fEmPhysicsList = new G4EmStandardPhysics_option2(verboseLevel);
0169     if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0170   }
0171   else if (name == "emstandard_opt3") {
0172     fEmName = name;
0173     delete fEmPhysicsList;
0174     fEmPhysicsList = new G4EmStandardPhysics_option3(verboseLevel);
0175     if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0176   }
0177   else if (name == "emstandard_opt4") {
0178     fEmName = name;
0179     delete fEmPhysicsList;
0180     fEmPhysicsList = new G4EmStandardPhysics_option4(verboseLevel);
0181     if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0182   }
0183   else if (name == "local") {
0184     fEmName = name;
0185     delete fEmPhysicsList;
0186     fEmPhysicsList = new PhysListEmStandard(verboseLevel);
0187     if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0188   }
0189   else if (name == "emlivermore") {
0190     fEmName = name;
0191     delete fEmPhysicsList;
0192     fEmPhysicsList = new G4EmLivermorePhysics(verboseLevel);
0193   }
0194   else if (name == "empenelope") {
0195     fEmName = name;
0196     delete fEmPhysicsList;
0197     fEmPhysicsList = new G4EmPenelopePhysics(verboseLevel);
0198   }
0199   else if (name == "emlowenergy") {
0200     fEmName = name;
0201     delete fEmPhysicsList;
0202     fEmPhysicsList = new G4EmLowEPPhysics(verboseLevel);
0203   }
0204   else if (name == "emstandardGS") {
0205     fEmName = name;
0206     delete fEmPhysicsList;
0207     fEmPhysicsList = new G4EmStandardPhysicsGS(verboseLevel);
0208   }
0209   else if (name == "emstandardSS") {
0210     fEmName = name;
0211     delete fEmPhysicsList;
0212     fEmPhysicsList = new G4EmStandardPhysicsSS(verboseLevel);
0213   }
0214   else if (name == "emstandardWVI") {
0215     fEmName = name;
0216     delete fEmPhysicsList;
0217     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0218   }
0219   else if (name == "elastic" && !fHelIsRegisted) {
0220     fHadronPhys.push_back(new G4HadronElasticPhysics());
0221     fHelIsRegisted = true;
0222     if (verboseLevel > 0) G4cout << "PhysicsList::Add hadron elastic physics" << G4endl;
0223   }
0224   else if (name == "binary" && !fBicIsRegisted) {
0225     fHadronPhys.push_back(new G4HadronInelasticQBBC());
0226     fHadronPhys.push_back(new G4IonPhysics());
0227     fBicIsRegisted = true;
0228     if (verboseLevel > 0)
0229       G4cout << "PhysicsList::Add hadron inelastic physics from <QBBC>" << G4endl;
0230   }
0231   else if (name == "gamma_nuc" && !fGnucIsRegisted) {
0232     fHadronPhys.push_back(new G4EmExtraPhysics());
0233     fGnucIsRegisted = true;
0234     if (verboseLevel > 0) G4cout << "PhysicsList::Add gamma- and electro-nuclear physics" << G4endl;
0235   }
0236   else if (name == "stopping" && !fStopIsRegisted) {
0237     fHadronPhys.push_back(new G4StoppingPhysics());
0238     fStopIsRegisted = true;
0239     if (verboseLevel > 0) G4cout << "PhysicsList::Add stopping physics" << G4endl;
0240   }
0241   else {
0242     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0243            << " is not defined" << G4endl;
0244   }
0245 }
0246 
0247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0248 
0249 void PhysicsList::AddStepMax()
0250 {
0251   // Step limitation seen as a process
0252 
0253   auto particleIterator = GetParticleIterator();
0254   particleIterator->reset();
0255   while ((*particleIterator)()) {
0256     G4ParticleDefinition* particle = particleIterator->value();
0257     G4ProcessManager* pmanager = particle->GetProcessManager();
0258 
0259     if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
0260       pmanager->AddDiscreteProcess(fStepMaxProcess);
0261     }
0262   }
0263 }
0264 
0265 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......