Back to home page

EIC code displayed by LXR

 
 

    


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

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/TestEm12/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 "PhysListEmStandardSSM.hh"
0037 #include "PhysicsListMessenger.hh"
0038 
0039 #include "G4EmDNAPhysics.hh"
0040 #include "G4EmDNAPhysics_option1.hh"
0041 #include "G4EmDNAPhysics_option2.hh"
0042 #include "G4EmDNAPhysics_option3.hh"
0043 #include "G4EmDNAPhysics_option4.hh"
0044 #include "G4EmDNAPhysics_option5.hh"
0045 #include "G4EmDNAPhysics_option6.hh"
0046 #include "G4EmDNAPhysics_option7.hh"
0047 #include "G4EmLivermorePhysics.hh"
0048 #include "G4EmLowEPPhysics.hh"
0049 #include "G4EmPenelopePhysics.hh"
0050 #include "G4EmStandardPhysics.hh"
0051 #include "G4EmStandardPhysicsGS.hh"
0052 #include "G4EmStandardPhysicsSS.hh"
0053 #include "G4EmStandardPhysicsWVI.hh"
0054 #include "G4EmStandardPhysics_option1.hh"
0055 #include "G4EmStandardPhysics_option2.hh"
0056 #include "G4EmStandardPhysics_option3.hh"
0057 #include "G4EmStandardPhysics_option4.hh"
0058 #include "G4LossTableManager.hh"
0059 #include "G4SystemOfUnits.hh"
0060 #include "G4UnitsTable.hh"
0061 
0062 // particles
0063 
0064 #include "G4BaryonConstructor.hh"
0065 #include "G4BosonConstructor.hh"
0066 #include "G4DNAGenericIonsManager.hh"
0067 #include "G4IonConstructor.hh"
0068 #include "G4LeptonConstructor.hh"
0069 #include "G4MesonConstructor.hh"
0070 #include "G4ShortLivedConstructor.hh"
0071 
0072 G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = nullptr;
0073 
0074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0075 
0076 PhysicsList::PhysicsList()
0077 {
0078   fMessenger = new PhysicsListMessenger(this);
0079 
0080   SetVerboseLevel(1);
0081 
0082   // EM physics
0083   fEmPhysicsList = new PhysListEmStandard(fEmName = "local");
0084 
0085   // Em options
0086   //
0087   G4EmParameters::Instance()->SetBuildCSDARange(true);
0088 
0089   SetDefaultCutValue(1. * mm);
0090 }
0091 
0092 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0093 
0094 PhysicsList::~PhysicsList()
0095 {
0096   delete fMessenger;
0097   delete fEmPhysicsList;
0098 }
0099 
0100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0101 
0102 void PhysicsList::ConstructParticle()
0103 {
0104   G4BosonConstructor pBosonConstructor;
0105   pBosonConstructor.ConstructParticle();
0106 
0107   G4LeptonConstructor pLeptonConstructor;
0108   pLeptonConstructor.ConstructParticle();
0109 
0110   G4MesonConstructor pMesonConstructor;
0111   pMesonConstructor.ConstructParticle();
0112 
0113   G4BaryonConstructor pBaryonConstructor;
0114   pBaryonConstructor.ConstructParticle();
0115 
0116   G4IonConstructor pIonConstructor;
0117   pIonConstructor.ConstructParticle();
0118 
0119   G4ShortLivedConstructor pShortLivedConstructor;
0120   pShortLivedConstructor.ConstructParticle();
0121 
0122   // DNA
0123   G4DNAGenericIonsManager* genericIonsManager;
0124   genericIonsManager = G4DNAGenericIonsManager::Instance();
0125   genericIonsManager->GetIon("alpha++");
0126   genericIonsManager->GetIon("alpha+");
0127   genericIonsManager->GetIon("helium");
0128   genericIonsManager->GetIon("hydrogen");
0129 }
0130 
0131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0132 
0133 #include "G4ProcessManager.hh"
0134 
0135 void PhysicsList::ConstructProcess()
0136 {
0137   // transportation
0138   //
0139   AddTransportation();
0140 
0141   // electromagnetic physics list
0142   //
0143   fEmPhysicsList->ConstructProcess();
0144 
0145   // decay process
0146   //
0147   AddDecay();
0148 
0149   // step limitation (as a full process)
0150   //
0151   AddStepMax();
0152 }
0153 
0154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0155 
0156 void PhysicsList::AddPhysicsList(const G4String& name)
0157 {
0158   if (verboseLevel > -1) {
0159     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0160   }
0161 
0162   if (name == fEmName) return;
0163 
0164   if (name == "local") {
0165     fEmName = name;
0166     delete fEmPhysicsList;
0167     fEmPhysicsList = new PhysListEmStandard(name);
0168   }
0169   else if (name == "emstandard_opt0") {
0170     fEmName = name;
0171     delete fEmPhysicsList;
0172     fEmPhysicsList = new G4EmStandardPhysics();
0173   }
0174   else if (name == "emstandard_opt1") {
0175     fEmName = name;
0176     delete fEmPhysicsList;
0177     fEmPhysicsList = new G4EmStandardPhysics_option1();
0178   }
0179   else if (name == "emstandard_opt2") {
0180     fEmName = name;
0181     delete fEmPhysicsList;
0182     fEmPhysicsList = new G4EmStandardPhysics_option2();
0183   }
0184   else if (name == "emstandard_opt3") {
0185     fEmName = name;
0186     delete fEmPhysicsList;
0187     fEmPhysicsList = new G4EmStandardPhysics_option3();
0188   }
0189   else if (name == "emstandard_opt4") {
0190     fEmName = name;
0191     delete fEmPhysicsList;
0192     fEmPhysicsList = new G4EmStandardPhysics_option4();
0193   }
0194   else if (name == "emstandardSS") {
0195     fEmName = name;
0196     delete fEmPhysicsList;
0197     fEmPhysicsList = new G4EmStandardPhysicsSS();
0198   }
0199   else if (name == "standardSSM") {
0200     fEmName = name;
0201     delete fEmPhysicsList;
0202     fEmPhysicsList = new PhysListEmStandardSSM(name);
0203   }
0204   else if (name == "emstandardWVI") {
0205     fEmName = name;
0206     delete fEmPhysicsList;
0207     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0208   }
0209   else if (name == "standardGS") {
0210     fEmName = name;
0211     delete fEmPhysicsList;
0212     fEmPhysicsList = new G4EmStandardPhysicsGS();
0213   }
0214   else if (name == "emlivermore") {
0215     fEmName = name;
0216     delete fEmPhysicsList;
0217     fEmPhysicsList = new G4EmLivermorePhysics();
0218   }
0219   else if (name == "empenelope") {
0220     fEmName = name;
0221     delete fEmPhysicsList;
0222     fEmPhysicsList = new G4EmPenelopePhysics();
0223   }
0224   else if (name == "emlowenergy") {
0225     fEmName = name;
0226     delete fEmPhysicsList;
0227     fEmPhysicsList = new G4EmLowEPPhysics();
0228   }
0229   else if (name == "dna") {
0230     fEmName = name;
0231     delete fEmPhysicsList;
0232     fEmPhysicsList = new G4EmDNAPhysics();
0233   }
0234   else if (name == "dna_opt1") {
0235     fEmName = name;
0236     delete fEmPhysicsList;
0237     fEmPhysicsList = new G4EmDNAPhysics_option1();
0238   }
0239   else if (name == "dna_opt2") {
0240     fEmName = name;
0241     delete fEmPhysicsList;
0242     fEmPhysicsList = new G4EmDNAPhysics_option2();
0243   }
0244   else if (name == "dna_opt3") {
0245     fEmName = name;
0246     delete fEmPhysicsList;
0247     fEmPhysicsList = new G4EmDNAPhysics_option3();
0248   }
0249   else if (name == "dna_opt4") {
0250     fEmName = name;
0251     delete fEmPhysicsList;
0252     fEmPhysicsList = new G4EmDNAPhysics_option4();
0253   }
0254   else if (name == "dna_opt5") {
0255     fEmName = name;
0256     delete fEmPhysicsList;
0257     fEmPhysicsList = new G4EmDNAPhysics_option5();
0258   }
0259   else if (name == "dna_opt6") {
0260     fEmName = name;
0261     delete fEmPhysicsList;
0262     fEmPhysicsList = new G4EmDNAPhysics_option6();
0263   }
0264   else if (name == "dna_opt7") {
0265     fEmName = name;
0266     delete fEmPhysicsList;
0267     fEmPhysicsList = new G4EmDNAPhysics_option7();
0268   }
0269   else {
0270     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0271            << " is not defined" << G4endl;
0272   }
0273   G4EmParameters::Instance()->SetBuildCSDARange(true);
0274 }
0275 
0276 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0277 
0278 #include "G4Decay.hh"
0279 
0280 void PhysicsList::AddDecay()
0281 {
0282   // decay process
0283   //
0284   G4Decay* fDecayProcess = new G4Decay();
0285 
0286   auto particleIterator = GetParticleIterator();
0287   particleIterator->reset();
0288   while ((*particleIterator)()) {
0289     G4ParticleDefinition* particle = particleIterator->value();
0290     G4ProcessManager* pmanager = particle->GetProcessManager();
0291 
0292     if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
0293       pmanager->AddProcess(fDecayProcess);
0294 
0295       // set ordering for PostStepDoIt and AtRestDoIt
0296       pmanager->SetProcessOrdering(fDecayProcess, idxPostStep);
0297       pmanager->SetProcessOrdering(fDecayProcess, idxAtRest);
0298     }
0299   }
0300 }
0301 
0302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0303 
0304 #include "StepMax.hh"
0305 
0306 void PhysicsList::AddStepMax()
0307 {
0308   // Step limitation seen as a process
0309   fStepMaxProcess = new StepMax();
0310 
0311   auto particleIterator = GetParticleIterator();
0312   particleIterator->reset();
0313   while ((*particleIterator)()) {
0314     G4ParticleDefinition* particle = particleIterator->value();
0315     G4ProcessManager* pmanager = particle->GetProcessManager();
0316 
0317     if (fStepMaxProcess->IsApplicable(*particle)) {
0318       pmanager->AddDiscreteProcess(fStepMaxProcess);
0319     }
0320   }
0321 }
0322 
0323 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......