Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-31 07:49: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 "PhysListEmStandardNR.hh"
0033 #include "PhysicsListMessenger.hh"
0034 #include "StepMax.hh"
0035 
0036 #include "G4BetheBlochIonGasModel.hh"
0037 #include "G4BraggIonGasModel.hh"
0038 #include "G4Decay.hh"
0039 #include "G4DecayPhysics.hh"
0040 #include "G4EmConfigurator.hh"
0041 #include "G4EmLivermorePhysics.hh"
0042 #include "G4EmLowEPPhysics.hh"
0043 #include "G4EmPenelopePhysics.hh"
0044 #include "G4EmStandardPhysics.hh"
0045 #include "G4EmStandardPhysicsGS.hh"
0046 #include "G4EmStandardPhysicsSS.hh"
0047 #include "G4EmStandardPhysicsWVI.hh"
0048 #include "G4EmStandardPhysics_option1.hh"
0049 #include "G4EmStandardPhysics_option2.hh"
0050 #include "G4EmStandardPhysics_option3.hh"
0051 #include "G4EmStandardPhysics_option4.hh"
0052 #include "G4HadronDElasticPhysics.hh"
0053 #include "G4HadronElasticPhysics.hh"
0054 #include "G4HadronHElasticPhysics.hh"
0055 #include "G4HadronInelasticQBBC.hh"
0056 #include "G4IonFluctuations.hh"
0057 #include "G4IonParametrisedLossModel.hh"
0058 #include "G4IonPhysics.hh"
0059 #include "G4LossTableManager.hh"
0060 #include "G4PhysicalConstants.hh"
0061 #include "G4ProcessManager.hh"
0062 #include "G4SystemOfUnits.hh"
0063 #include "G4UnitsTable.hh"
0064 #include "G4UniversalFluctuation.hh"
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 
0068 PhysicsList::PhysicsList() : G4VModularPhysicsList(), fStepMaxProcess(nullptr)
0069 {
0070   fHelIsRegisted = false;
0071   fBicIsRegisted = false;
0072   fBiciIsRegisted = false;
0073 
0074   // protected member of the base class
0075   verboseLevel = 1;
0076 
0077   fMessenger = new PhysicsListMessenger(this);
0078 
0079   // EM physics
0080   fEmName = G4String("emstandard_opt0");
0081   fEmPhysicsList = new G4EmStandardPhysics(verboseLevel);
0082 
0083   // Deacy physics and all particles
0084   fDecPhysicsList = new G4DecayPhysics(verboseLevel);
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 PhysicsList::~PhysicsList()
0090 {
0091   delete fMessenger;
0092   delete fEmPhysicsList;
0093   delete fDecPhysicsList;
0094   for (size_t i = 0; i < fHadronPhys.size(); i++) {
0095     delete fHadronPhys[i];
0096   }
0097 }
0098 
0099 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0100 
0101 void PhysicsList::ConstructParticle()
0102 {
0103   fDecPhysicsList->ConstructParticle();
0104 }
0105 
0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0107 
0108 void PhysicsList::ConstructProcess()
0109 {
0110   // transportation
0111   //
0112   AddTransportation();
0113 
0114   // electromagnetic physics list
0115   //
0116   fEmPhysicsList->ConstructProcess();
0117 
0118   // decay physics list
0119   //
0120   fDecPhysicsList->ConstructProcess();
0121 
0122   // hadronic physics lists
0123   for (size_t i = 0; i < fHadronPhys.size(); i++) {
0124     fHadronPhys[i]->ConstructProcess();
0125   }
0126 
0127   // step limitation (as a full process)
0128   //
0129   AddStepMax();
0130 }
0131 
0132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0133 
0134 void PhysicsList::AddPhysicsList(const G4String& name)
0135 {
0136   if (verboseLevel > 1) {
0137     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0138   }
0139 
0140   if (name == fEmName) return;
0141 
0142   if (name == "local") {
0143     fEmName = name;
0144     delete fEmPhysicsList;
0145     fEmPhysicsList = new PhysListEmStandard(name);
0146   }
0147   else if (name == "emstandard_opt0") {
0148     fEmName = name;
0149     delete fEmPhysicsList;
0150     fEmPhysicsList = new G4EmStandardPhysics(verboseLevel);
0151   }
0152   else if (name == "emstandard_opt1") {
0153     fEmName = name;
0154     delete fEmPhysicsList;
0155     fEmPhysicsList = new G4EmStandardPhysics_option1(verboseLevel);
0156   }
0157   else if (name == "emstandard_opt2") {
0158     fEmName = name;
0159     delete fEmPhysicsList;
0160     fEmPhysicsList = new G4EmStandardPhysics_option2(verboseLevel);
0161   }
0162   else if (name == "emstandard_opt3") {
0163     fEmName = name;
0164     delete fEmPhysicsList;
0165     fEmPhysicsList = new G4EmStandardPhysics_option3(verboseLevel);
0166   }
0167   else if (name == "emstandard_opt4") {
0168     fEmName = name;
0169     delete fEmPhysicsList;
0170     fEmPhysicsList = new G4EmStandardPhysics_option4(verboseLevel);
0171   }
0172   else if (name == "ionGasModels") {
0173     AddPhysicsList("emstandard_opt0");
0174     fEmName = name;
0175     AddIonGasModels();
0176   }
0177   else if (name == "standardNR") {
0178     fEmName = name;
0179     delete fEmPhysicsList;
0180     fEmPhysicsList = new PhysListEmStandardNR(name);
0181   }
0182   else if (name == "emlivermore") {
0183     fEmName = name;
0184     delete fEmPhysicsList;
0185     fEmPhysicsList = new G4EmLivermorePhysics(verboseLevel);
0186   }
0187   else if (name == "empenelope") {
0188     fEmName = name;
0189     delete fEmPhysicsList;
0190     fEmPhysicsList = new G4EmPenelopePhysics(verboseLevel);
0191   }
0192   else if (name == "emlowenergy") {
0193     fEmName = name;
0194     delete fEmPhysicsList;
0195     fEmPhysicsList = new G4EmLowEPPhysics(verboseLevel);
0196   }
0197   else if (name == "emstandardSS") {
0198     fEmName = name;
0199     delete fEmPhysicsList;
0200     fEmPhysicsList = new G4EmStandardPhysicsSS(verboseLevel);
0201   }
0202   else if (name == "emstandardWVI") {
0203     fEmName = name;
0204     delete fEmPhysicsList;
0205     fEmPhysicsList = new G4EmStandardPhysicsWVI(verboseLevel);
0206   }
0207   else if (name == "emstandardGS") {
0208     fEmName = name;
0209     delete fEmPhysicsList;
0210     fEmPhysicsList = new G4EmStandardPhysicsGS(verboseLevel);
0211   }
0212   else if (name == "elastic" && !fHelIsRegisted) {
0213     fHadronPhys.push_back(new G4HadronElasticPhysics(verboseLevel));
0214     fHelIsRegisted = true;
0215   }
0216   else if (name == "DElastic" && !fHelIsRegisted) {
0217     fHadronPhys.push_back(new G4HadronDElasticPhysics(verboseLevel));
0218     fHelIsRegisted = true;
0219   }
0220   else if (name == "HElastic" && !fHelIsRegisted) {
0221     fHadronPhys.push_back(new G4HadronHElasticPhysics(verboseLevel));
0222     fHelIsRegisted = true;
0223   }
0224   else if (name == "binary" && !fBicIsRegisted) {
0225     fHadronPhys.push_back(new G4HadronInelasticQBBC(verboseLevel));
0226     fBicIsRegisted = true;
0227   }
0228   else if (name == "binary_ion" && !fBiciIsRegisted) {
0229     fHadronPhys.push_back(new G4IonPhysics(verboseLevel));
0230     fBiciIsRegisted = true;
0231   }
0232   else {
0233     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0234            << " is not defined" << G4endl;
0235   }
0236 }
0237 
0238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0239 
0240 void PhysicsList::AddStepMax()
0241 {
0242   // Step limitation seen as a process
0243   fStepMaxProcess = new StepMax();
0244 
0245   auto particleIterator = GetParticleIterator();
0246   particleIterator->reset();
0247   while ((*particleIterator)()) {
0248     G4ParticleDefinition* particle = particleIterator->value();
0249     G4ProcessManager* pmanager = particle->GetProcessManager();
0250 
0251     if (fStepMaxProcess->IsApplicable(*particle) && pmanager) {
0252       pmanager->AddDiscreteProcess(fStepMaxProcess);
0253     }
0254   }
0255 }
0256 
0257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0258 
0259 void PhysicsList::AddIonGasModels()
0260 {
0261   G4EmConfigurator* em_config = G4LossTableManager::Instance()->EmConfigurator();
0262   auto particleIterator = GetParticleIterator();
0263   particleIterator->reset();
0264   while ((*particleIterator)()) {
0265     G4ParticleDefinition* particle = particleIterator->value();
0266     G4String partname = particle->GetParticleName();
0267     if (partname == "alpha" || partname == "He3" || partname == "GenericIon") {
0268       G4BraggIonGasModel* mod1 = new G4BraggIonGasModel();
0269       G4BetheBlochIonGasModel* mod2 = new G4BetheBlochIonGasModel();
0270       G4double eth = 2. * MeV * particle->GetPDGMass() / proton_mass_c2;
0271       em_config->SetExtraEmModel(partname, "ionIoni", mod1, "", 0.0, eth, new G4IonFluctuations());
0272       em_config->SetExtraEmModel(partname, "ionIoni", mod2, "", eth, 100 * TeV,
0273                                  new G4UniversalFluctuation());
0274     }
0275   }
0276 }
0277 
0278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......