Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:03

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