Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 08:28: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 "PhysicsListMessenger.hh"
0032 #include "StepMax.hh"
0033 
0034 #include "G4AnnihiToMuPair.hh"
0035 #include "G4DecayPhysics.hh"
0036 #include "G4Electron.hh"
0037 #include "G4EmLivermorePhysics.hh"
0038 #include "G4EmLowEPPhysics.hh"
0039 #include "G4EmPenelopePhysics.hh"
0040 #include "G4EmStandardPhysics.hh"
0041 #include "G4EmStandardPhysicsGS.hh"
0042 #include "G4EmStandardPhysicsSS.hh"
0043 #include "G4EmStandardPhysicsWVI.hh"
0044 #include "G4EmStandardPhysics_option1.hh"
0045 #include "G4EmStandardPhysics_option2.hh"
0046 #include "G4EmStandardPhysics_option3.hh"
0047 #include "G4EmStandardPhysics_option4.hh"
0048 #include "G4Gamma.hh"
0049 #include "G4GammaConversionToMuons.hh"
0050 #include "G4LossTableManager.hh"
0051 #include "G4ParticleDefinition.hh"
0052 #include "G4ParticleTable.hh"
0053 #include "G4Positron.hh"
0054 #include "G4ProcessManager.hh"
0055 #include "G4ProcessTable.hh"
0056 #include "G4SystemOfUnits.hh"
0057 #include "G4UnitsTable.hh"
0058 #include "G4eeToHadrons.hh"
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0061 
0062 PhysicsList::PhysicsList()
0063   : G4VModularPhysicsList(), fEmPhysicsList(0), fDecayPhysicsList(0), fStepMaxProcess(0), fMes(0)
0064 {
0065   G4LossTableManager::Instance()->SetVerbose(1);
0066 
0067   defaultCutValue = 1. * km;
0068   fMes = new PhysicsListMessenger(this);
0069 
0070   fStepMaxProcess = new StepMax();
0071 
0072   fDecayPhysicsList = new G4DecayPhysics();
0073 
0074   SetVerboseLevel(2);
0075 }
0076 
0077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0078 
0079 PhysicsList::~PhysicsList()
0080 {
0081   delete fMes;
0082   delete fDecayPhysicsList;
0083   delete fEmPhysicsList;
0084   delete fStepMaxProcess;
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 void PhysicsList::ConstructParticle()
0090 {
0091   fDecayPhysicsList->ConstructParticle();
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 void PhysicsList::ConstructProcess()
0097 {
0098   AddTransportation();
0099 
0100   if (fEmPhysicsList) fEmPhysicsList->ConstructProcess();
0101   fDecayPhysicsList->ConstructProcess();
0102 
0103   AddStepMax();
0104 
0105   ConstructHighEnergy();
0106 }
0107 
0108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0109 
0110 void PhysicsList::ConstructHighEnergy()
0111 {
0112   const G4ParticleDefinition* particle = G4Gamma::Gamma();
0113   G4ProcessManager* pmanager = particle->GetProcessManager();
0114 
0115   pmanager->AddDiscreteProcess(new G4GammaConversionToMuons);
0116 
0117   particle = G4Positron::Positron();
0118   pmanager = particle->GetProcessManager();
0119 
0120   pmanager->AddDiscreteProcess(new G4AnnihiToMuPair);
0121   pmanager->AddDiscreteProcess(new G4eeToHadrons);
0122 }
0123 
0124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0125 
0126 void PhysicsList::SetGammaToMuPairFac(G4double fac)
0127 {
0128   G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
0129   G4GammaConversionToMuons* gammaToMuPairProcess =
0130     (G4GammaConversionToMuons*)theProcessTable->FindProcess("GammaToMuPair", "gamma");
0131   if (gammaToMuPairProcess)
0132     gammaToMuPairProcess->SetCrossSecFactor(fac);
0133   else
0134     G4cout << "Warning. No process GammaToMuPair found, SetGammaToMuPairFac was ignored" << G4endl;
0135 }
0136 
0137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0138 
0139 void PhysicsList::SetAnnihiToMuPairFac(G4double fac)
0140 {
0141   G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
0142   G4AnnihiToMuPair* annihiToMuPairProcess =
0143     (G4AnnihiToMuPair*)theProcessTable->FindProcess("AnnihiToMuPair", "e+");
0144   if (annihiToMuPairProcess)
0145     annihiToMuPairProcess->SetCrossSecFactor(fac);
0146   else
0147     G4cout << "Warning. No process AnnihiToMuPair found, SetAnnihiToMuPairFac ignored" << G4endl;
0148 }
0149 
0150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0151 
0152 void PhysicsList::SetAnnihiToHadronFac(G4double fac)
0153 {
0154   G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
0155   G4eeToHadrons* eehadProcess = (G4eeToHadrons*)theProcessTable->FindProcess("ee2hadr", "e+");
0156   if (eehadProcess)
0157     eehadProcess->SetCrossSecFactor(fac);
0158   else
0159     G4cout << "Warning. No process ee2hadr found, SetAnnihiToHadronFac was ignored" << G4endl;
0160 }
0161 
0162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0163 
0164 void PhysicsList::AddPhysicsList(const G4String& name)
0165 {
0166   if (verboseLevel > 1) {
0167     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0168   }
0169 
0170   if (name == fEmName) {
0171     return;
0172   }
0173   else if (name == "emstandard_opt0") {
0174     fEmName = name;
0175     delete fEmPhysicsList;
0176     fEmPhysicsList = new G4EmStandardPhysics();
0177   }
0178   else if (name == "emstandard_opt1") {
0179     fEmName = name;
0180     delete fEmPhysicsList;
0181     fEmPhysicsList = new G4EmStandardPhysics_option1();
0182   }
0183   else if (name == "emstandard_opt2") {
0184     fEmName = name;
0185     delete fEmPhysicsList;
0186     fEmPhysicsList = new G4EmStandardPhysics_option2();
0187   }
0188   else if (name == "emstandard_opt3") {
0189     fEmName = name;
0190     delete fEmPhysicsList;
0191     fEmPhysicsList = new G4EmStandardPhysics_option3();
0192   }
0193   else if (name == "emstandard_opt4") {
0194     fEmName = name;
0195     delete fEmPhysicsList;
0196     fEmPhysicsList = new G4EmStandardPhysics_option4();
0197   }
0198   else if (name == "emlivermore") {
0199     fEmName = name;
0200     delete fEmPhysicsList;
0201     fEmPhysicsList = new G4EmLivermorePhysics();
0202   }
0203   else if (name == "empenelope") {
0204     fEmName = name;
0205     delete fEmPhysicsList;
0206     fEmPhysicsList = new G4EmPenelopePhysics();
0207   }
0208   else if (name == "emlowenergy") {
0209     fEmName = name;
0210     delete fEmPhysicsList;
0211     fEmPhysicsList = new G4EmLowEPPhysics();
0212   }
0213   else if (name == "emstandardGS") {
0214     fEmName = name;
0215     delete fEmPhysicsList;
0216     fEmPhysicsList = new G4EmStandardPhysicsGS();
0217   }
0218   else if (name == "emstandardSS") {
0219     fEmName = name;
0220     delete fEmPhysicsList;
0221     fEmPhysicsList = new G4EmStandardPhysicsSS();
0222   }
0223   else if (name == "emstandardWVI") {
0224     fEmName = name;
0225     delete fEmPhysicsList;
0226     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0227   }
0228   else {
0229     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0230            << " is not defined" << G4endl;
0231   }
0232 }
0233 
0234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0235 
0236 void PhysicsList::AddStepMax()
0237 {
0238   // Step limitation seen as a process
0239 
0240   auto particleIterator = GetParticleIterator();
0241   particleIterator->reset();
0242   while ((*particleIterator)()) {
0243     G4ParticleDefinition* particle = particleIterator->value();
0244     G4ProcessManager* pmanager = particle->GetProcessManager();
0245 
0246     if (fStepMaxProcess->IsApplicable(*particle)) {
0247       pmanager->AddDiscreteProcess(fStepMaxProcess);
0248     }
0249   }
0250 }
0251 
0252 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......