Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:51

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/TestEm11/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 "PhysicsListMessenger.hh"
0037 
0038 #include "G4EmLivermorePhysics.hh"
0039 #include "G4EmLowEPPhysics.hh"
0040 #include "G4EmPenelopePhysics.hh"
0041 #include "G4EmStandardPhysics.hh"
0042 #include "G4EmStandardPhysicsGS.hh"
0043 #include "G4EmStandardPhysicsSS.hh"
0044 #include "G4EmStandardPhysicsWVI.hh"
0045 #include "G4EmStandardPhysics_option1.hh"
0046 #include "G4EmStandardPhysics_option2.hh"
0047 #include "G4EmStandardPhysics_option3.hh"
0048 #include "G4EmStandardPhysics_option4.hh"
0049 #include "G4LossTableManager.hh"
0050 #include "G4SystemOfUnits.hh"
0051 #include "G4UnitsTable.hh"
0052 
0053 // particles
0054 
0055 #include "StepMax.hh"
0056 
0057 #include "G4BaryonConstructor.hh"
0058 #include "G4BosonConstructor.hh"
0059 #include "G4Decay.hh"
0060 #include "G4GenericIon.hh"
0061 #include "G4IonConstructor.hh"
0062 #include "G4LeptonConstructor.hh"
0063 #include "G4MesonConstructor.hh"
0064 #include "G4NuclideTable.hh"
0065 #include "G4PhysicsListHelper.hh"
0066 #include "G4RadioactiveDecay.hh"
0067 #include "G4ShortLivedConstructor.hh"
0068 
0069 G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = nullptr;
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0072 
0073 PhysicsList::PhysicsList()
0074 {
0075   fMessenger = new PhysicsListMessenger(this);
0076 
0077   SetVerboseLevel(1);
0078 
0079   // EM physics
0080   fEmPhysicsList = new PhysListEmStandard(fEmName = "local");
0081 
0082   G4LossTableManager::Instance();
0083   SetDefaultCutValue(1. * mm);
0084 }
0085 
0086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0087 
0088 PhysicsList::~PhysicsList()
0089 {
0090   delete fMessenger;
0091   delete fEmPhysicsList;
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 void PhysicsList::ConstructParticle()
0097 {
0098   G4BosonConstructor pBosonConstructor;
0099   pBosonConstructor.ConstructParticle();
0100 
0101   G4LeptonConstructor pLeptonConstructor;
0102   pLeptonConstructor.ConstructParticle();
0103 
0104   G4MesonConstructor pMesonConstructor;
0105   pMesonConstructor.ConstructParticle();
0106 
0107   G4BaryonConstructor pBaryonConstructor;
0108   pBaryonConstructor.ConstructParticle();
0109 
0110   G4IonConstructor pIonConstructor;
0111   pIonConstructor.ConstructParticle();
0112 
0113   G4ShortLivedConstructor pShortLivedConstructor;
0114   pShortLivedConstructor.ConstructParticle();
0115 }
0116 
0117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0118 
0119 #include "G4ProcessManager.hh"
0120 
0121 void PhysicsList::ConstructProcess()
0122 {
0123   // transportation
0124   //
0125   AddTransportation();
0126 
0127   // electromagnetic physics list
0128   //
0129   fEmPhysicsList->ConstructProcess();
0130 
0131   // Em options
0132   //
0133   G4EmParameters* param = G4EmParameters::Instance();
0134   param->SetBuildCSDARange(true);
0135 
0136   // decay process
0137   //
0138   AddDecay();
0139 
0140   // radioactive decay Process
0141   //
0142   AddRadioactiveDecay();
0143 
0144   // step limitation (as a full process)
0145   //
0146   AddStepMax();
0147 }
0148 
0149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0150 
0151 void PhysicsList::AddPhysicsList(const G4String& name)
0152 {
0153   if (verboseLevel > -1) {
0154     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0155   }
0156 
0157   if (name == fEmName) return;
0158 
0159   if (name == "local") {
0160     fEmName = name;
0161     delete fEmPhysicsList;
0162     fEmPhysicsList = new PhysListEmStandard(name);
0163   }
0164   else if (name == "emstandard_opt0") {
0165     fEmName = name;
0166     delete fEmPhysicsList;
0167     fEmPhysicsList = new G4EmStandardPhysics();
0168   }
0169   else if (name == "emstandard_opt1") {
0170     fEmName = name;
0171     delete fEmPhysicsList;
0172     fEmPhysicsList = new G4EmStandardPhysics_option1();
0173   }
0174   else if (name == "emstandard_opt2") {
0175     fEmName = name;
0176     delete fEmPhysicsList;
0177     fEmPhysicsList = new G4EmStandardPhysics_option2();
0178   }
0179   else if (name == "emstandard_opt3") {
0180     fEmName = name;
0181     delete fEmPhysicsList;
0182     fEmPhysicsList = new G4EmStandardPhysics_option3();
0183   }
0184   else if (name == "emstandard_opt4") {
0185     fEmName = name;
0186     delete fEmPhysicsList;
0187     fEmPhysicsList = new G4EmStandardPhysics_option4();
0188   }
0189   else if (name == "emstandardSS") {
0190     fEmName = name;
0191     delete fEmPhysicsList;
0192     fEmPhysicsList = new G4EmStandardPhysicsSS();
0193   }
0194   else if (name == "emstandardGS") {
0195     fEmName = name;
0196     delete fEmPhysicsList;
0197     fEmPhysicsList = new G4EmStandardPhysicsGS();
0198   }
0199   else if (name == "emstandardWVI") {
0200     fEmName = name;
0201     delete fEmPhysicsList;
0202     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0203   }
0204   else if (name == "emlowenergy") {
0205     fEmName = name;
0206     delete fEmPhysicsList;
0207     fEmPhysicsList = new G4EmLowEPPhysics();
0208   }
0209   else if (name == "emlivermore") {
0210     fEmName = name;
0211     delete fEmPhysicsList;
0212     fEmPhysicsList = new G4EmLivermorePhysics();
0213   }
0214   else if (name == "empenelope") {
0215     fEmName = name;
0216     delete fEmPhysicsList;
0217     fEmPhysicsList = new G4EmPenelopePhysics();
0218   }
0219   else {
0220     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0221            << " is not defined" << G4endl;
0222   }
0223 }
0224 
0225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0226 
0227 void PhysicsList::AddDecay()
0228 {
0229   // decay process
0230   //
0231   G4Decay* decay = new G4Decay();
0232   G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
0233 
0234   auto particleIterator = GetParticleIterator();
0235   particleIterator->reset();
0236   while ((*particleIterator)()) {
0237     G4ParticleDefinition* particle = particleIterator->value();
0238     if (decay->IsApplicable(*particle) && !particle->IsShortLived()) {
0239       ph->RegisterProcess(decay, particle);
0240     }
0241   }
0242 }
0243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0244 
0245 void PhysicsList::AddRadioactiveDecay()
0246 {
0247   G4RadioactiveDecay* radioactiveDecay = new G4RadioactiveDecay();
0248 
0249   G4bool armFlag = false;
0250   radioactiveDecay->SetARM(armFlag);  // Atomic Rearangement
0251 
0252   // atomic de-excitation module, if needed
0253   if (armFlag) {
0254     G4EmParameters::Instance()->SetAuger(true);
0255     G4EmParameters::Instance()->SetDeexcitationIgnoreCut(true);
0256   }
0257 
0258   G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
0259   ph->RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon());
0260 
0261   // mandatory for G4NuclideTable
0262   //
0263   const G4double meanLife = 1 * picosecond, halfLife = meanLife * std::log(2);
0264   G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(halfLife);
0265 }
0266 
0267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0268 
0269 void PhysicsList::AddStepMax()
0270 {
0271   // Step limitation seen as a process
0272   fStepMaxProcess = new StepMax();
0273 
0274   auto particleIterator = GetParticleIterator();
0275   particleIterator->reset();
0276   while ((*particleIterator)()) {
0277     G4ParticleDefinition* particle = particleIterator->value();
0278     G4ProcessManager* pmanager = particle->GetProcessManager();
0279 
0280     if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
0281       pmanager->AddDiscreteProcess(fStepMaxProcess);
0282   }
0283 }
0284 
0285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......