Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:17:05

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 //
0027 //
0028 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0029 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0030 
0031 #include "PhysicsList.hh"
0032 
0033 #include "G4DecayPhysics.hh"
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 "G4HadronDElasticPhysics.hh"
0046 #include "G4HadronElasticPhysics.hh"
0047 #include "G4HadronHElasticPhysics.hh"
0048 #include "G4HadronInelasticQBBC.hh"
0049 #include "G4IonPhysics.hh"
0050 #include "G4ParticleDefinition.hh"
0051 #include "G4ProcessManager.hh"
0052 #include "G4StepLimiter.hh"
0053 #include "G4SystemOfUnits.hh"
0054 
0055 #include "PhysListEmStandard.hh"
0056 #include "PhysicsListMessenger.hh"
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 
0060 PhysicsList::PhysicsList() : G4VModularPhysicsList()
0061 {
0062   fHelIsRegisted = false;
0063   fBicIsRegisted = false;
0064   fBiciIsRegisted = false;
0065 
0066   fMessenger = new PhysicsListMessenger(this);
0067   SetVerboseLevel(1);
0068 
0069   // EM physics
0070   fEmName = G4String("emlivermore");
0071   fEmPhysics = new G4EmLivermorePhysics();
0072   //  fEmPhysicsList = new PhysListEmStandard();
0073   //  fEmName = G4String("local");
0074 
0075   // Decay physics
0076   fDecayPhysics = new G4DecayPhysics(1);
0077 
0078   //  SetDefaultCutValue(1*mm);
0079   SetDefaultCutValue(0.01 * um);
0080 }
0081 
0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0083 
0084 PhysicsList::~PhysicsList()
0085 {
0086   delete fMessenger;
0087   delete fEmPhysics;
0088   delete fDecayPhysics;
0089   for (size_t i = 0; i < fHadronPhysics.size(); i++) {
0090     delete fHadronPhysics[i];
0091   }
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 void PhysicsList::ConstructParticle()
0097 {
0098   fDecayPhysics->ConstructParticle();
0099 }
0100 
0101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0102 
0103 void PhysicsList::ConstructProcess()
0104 {
0105   // transportation
0106   //
0107   AddTransportation();
0108 
0109   // electromagnetic physics
0110   //
0111   fEmPhysics->ConstructProcess();
0112 
0113   // decay physics
0114   //
0115   fDecayPhysics->ConstructProcess();
0116 
0117   // hadronic physics
0118   for (size_t i = 0; i < fHadronPhysics.size(); i++) {
0119     fHadronPhysics[i]->ConstructProcess();
0120   }
0121 
0122   // step limitation (as a full process)
0123   //
0124   AddStepMax();
0125 }
0126 
0127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0128 
0129 void PhysicsList::AddStepMax()
0130 {
0131   auto fStepMaxProcess = new G4StepLimiter();
0132 
0133   auto particleIterator = GetParticleIterator();
0134 
0135   particleIterator->reset();
0136 
0137   while ((*particleIterator)()) {
0138     G4ParticleDefinition* particle = particleIterator->value();
0139     G4ProcessManager* pmanager = particle->GetProcessManager();
0140 
0141     if (fStepMaxProcess->IsApplicable(*particle)) {
0142       pmanager->AddDiscreteProcess(fStepMaxProcess);
0143     }
0144   }
0145 }
0146 
0147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0148 
0149 void PhysicsList::AddPhysicsList(const G4String& name)
0150 {
0151   if (verboseLevel > -1) {
0152     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0153   }
0154 
0155   if (name == fEmName) return;
0156 
0157   if (name == "local") {
0158     fEmName = name;
0159     delete fEmPhysics;
0160     fEmPhysics = new PhysListEmStandard(name);
0161   }
0162   else if (name == "emstandard_opt0") {
0163     fEmName = name;
0164     delete fEmPhysics;
0165     fEmPhysics = new G4EmStandardPhysics();
0166   }
0167   else if (name == "emstandard_opt1") {
0168     fEmName = name;
0169     delete fEmPhysics;
0170     fEmPhysics = new G4EmStandardPhysics_option1();
0171   }
0172   else if (name == "emstandard_opt2") {
0173     fEmName = name;
0174     delete fEmPhysics;
0175     fEmPhysics = new G4EmStandardPhysics_option2();
0176   }
0177   else if (name == "emstandard_opt3") {
0178     fEmName = name;
0179     delete fEmPhysics;
0180     fEmPhysics = new G4EmStandardPhysics_option3();
0181   }
0182   else if (name == "emstandard_opt4") {
0183     fEmName = name;
0184     delete fEmPhysics;
0185     fEmPhysics = new G4EmStandardPhysics_option4();
0186   }
0187   else if (name == "emstandardSS") {
0188     fEmName = name;
0189     delete fEmPhysics;
0190     fEmPhysics = new G4EmStandardPhysicsSS();
0191   }
0192   else if (name == "emstandardWVI") {
0193     fEmName = name;
0194     delete fEmPhysics;
0195     fEmPhysics = new G4EmStandardPhysicsWVI();
0196   }
0197   else if (name == "emstandardGS") {
0198     fEmName = name;
0199     delete fEmPhysics;
0200     fEmPhysics = new G4EmStandardPhysicsGS(verboseLevel);
0201   }
0202   else if (name == "empenelope") {
0203     fEmName = name;
0204     delete fEmPhysics;
0205     fEmPhysics = new G4EmPenelopePhysics();
0206   }
0207   else if (name == "emlowenergy") {
0208     fEmName = name;
0209     delete fEmPhysics;
0210     fEmPhysics = new G4EmLowEPPhysics();
0211   }
0212   else if (name == "emlivermore") {
0213     fEmName = name;
0214     delete fEmPhysics;
0215     fEmPhysics = new G4EmLivermorePhysics();
0216   }
0217   else if (name == "elastic" && !fHelIsRegisted) {
0218     fHadronPhysics.push_back(new G4HadronElasticPhysics(verboseLevel));
0219     fHelIsRegisted = true;
0220   }
0221   else if (name == "DElastic" && !fHelIsRegisted) {
0222     fHadronPhysics.push_back(new G4HadronDElasticPhysics(verboseLevel));
0223     fHelIsRegisted = true;
0224   }
0225   else if (name == "HElastic" && !fHelIsRegisted) {
0226     fHadronPhysics.push_back(new G4HadronHElasticPhysics(verboseLevel));
0227     fHelIsRegisted = true;
0228   }
0229   else if (name == "binary" && !fBicIsRegisted) {
0230     fHadronPhysics.push_back(new G4HadronInelasticQBBC(verboseLevel));
0231     fBicIsRegisted = true;
0232   }
0233   else if (name == "binary_ion" && !fBiciIsRegisted) {
0234     fHadronPhysics.push_back(new G4IonPhysics(verboseLevel));
0235     fBiciIsRegisted = true;
0236   }
0237   else {
0238     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0239            << " is not defined" << G4endl;
0240   }
0241 }
0242 
0243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......