Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-12 07:40:29

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 "PhysListEmStandard.hh"
0032 #include "PhysicsListMessenger.hh"
0033 
0034 #include "G4EmStandardPhysicsGS.hh"
0035 #include "G4EmStandardPhysicsSS.hh"
0036 #include "G4EmStandardPhysicsWVI.hh"
0037 #include "G4EmStandardPhysics_option3.hh"
0038 #include "G4EmStandardPhysics_option4.hh"
0039 #include "G4LossTableManager.hh"
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4UnitsTable.hh"
0042 
0043 // Bosons
0044 #include "G4ChargedGeantino.hh"
0045 #include "G4Gamma.hh"
0046 #include "G4Geantino.hh"
0047 #include "G4OpticalPhoton.hh"
0048 
0049 // leptons
0050 #include "G4AntiNeutrinoE.hh"
0051 #include "G4AntiNeutrinoMu.hh"
0052 #include "G4Electron.hh"
0053 #include "G4MuonMinus.hh"
0054 #include "G4MuonPlus.hh"
0055 #include "G4NeutrinoE.hh"
0056 #include "G4NeutrinoMu.hh"
0057 #include "G4Positron.hh"
0058 
0059 // Mesons
0060 #include "G4AntiKaonZero.hh"
0061 #include "G4Eta.hh"
0062 #include "G4EtaPrime.hh"
0063 #include "G4KaonMinus.hh"
0064 #include "G4KaonPlus.hh"
0065 #include "G4KaonZero.hh"
0066 #include "G4KaonZeroLong.hh"
0067 #include "G4KaonZeroShort.hh"
0068 #include "G4PionMinus.hh"
0069 #include "G4PionPlus.hh"
0070 #include "G4PionZero.hh"
0071 
0072 // Baryons
0073 #include "G4AntiNeutron.hh"
0074 #include "G4AntiProton.hh"
0075 #include "G4Neutron.hh"
0076 #include "G4Proton.hh"
0077 
0078 // Nuclei
0079 #include "StepMax.hh"
0080 
0081 #include "G4Alpha.hh"
0082 #include "G4Deuteron.hh"
0083 #include "G4GenericIon.hh"
0084 #include "G4ProcessManager.hh"
0085 #include "G4Triton.hh"
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 PhysicsList::PhysicsList() : G4VModularPhysicsList(), fEmPhysicsList(0), fMessenger(0)
0090 {
0091   G4LossTableManager::Instance();
0092   SetDefaultCutValue(1 * mm);
0093 
0094   fMessenger = new PhysicsListMessenger(this);
0095 
0096   SetVerboseLevel(1);
0097 
0098   // EM physics
0099   fEmName = G4String("local");
0100   fEmPhysicsList = new PhysListEmStandard(fEmName);
0101 }
0102 
0103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0104 
0105 PhysicsList::~PhysicsList()
0106 {
0107   delete fMessenger;
0108 }
0109 
0110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0111 
0112 void PhysicsList::ConstructParticle()
0113 {
0114   // pseudo-particles
0115   G4Geantino::GeantinoDefinition();
0116   G4ChargedGeantino::ChargedGeantinoDefinition();
0117 
0118   // gamma
0119   G4Gamma::GammaDefinition();
0120 
0121   // optical photon
0122   G4OpticalPhoton::OpticalPhotonDefinition();
0123 
0124   // leptons
0125   G4Electron::ElectronDefinition();
0126   G4Positron::PositronDefinition();
0127   G4MuonPlus::MuonPlusDefinition();
0128   G4MuonMinus::MuonMinusDefinition();
0129 
0130   G4NeutrinoE::NeutrinoEDefinition();
0131   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
0132   G4NeutrinoMu::NeutrinoMuDefinition();
0133   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
0134 
0135   // mesons
0136   G4PionPlus::PionPlusDefinition();
0137   G4PionMinus::PionMinusDefinition();
0138   G4PionZero::PionZeroDefinition();
0139   G4Eta::EtaDefinition();
0140   G4EtaPrime::EtaPrimeDefinition();
0141   G4KaonPlus::KaonPlusDefinition();
0142   G4KaonMinus::KaonMinusDefinition();
0143   G4KaonZero::KaonZeroDefinition();
0144   G4AntiKaonZero::AntiKaonZeroDefinition();
0145   G4KaonZeroLong::KaonZeroLongDefinition();
0146   G4KaonZeroShort::KaonZeroShortDefinition();
0147 
0148   // barions
0149   G4Proton::ProtonDefinition();
0150   G4AntiProton::AntiProtonDefinition();
0151   G4Neutron::NeutronDefinition();
0152   G4AntiNeutron::AntiNeutronDefinition();
0153 
0154   // ions
0155   G4Deuteron::DeuteronDefinition();
0156   G4Triton::TritonDefinition();
0157   G4Alpha::AlphaDefinition();
0158   G4GenericIon::GenericIonDefinition();
0159 }
0160 
0161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0162 
0163 void PhysicsList::ConstructProcess()
0164 {
0165   // Transportation
0166   //
0167   AddTransportation();
0168 
0169   // Electromagnetic physics list
0170   //
0171   fEmPhysicsList->ConstructProcess();
0172 
0173   // Em options
0174   //
0175   G4EmParameters* param = G4EmParameters::Instance();
0176   param->SetIntegral(false);
0177   param->SetStepFunction(1., 1 * mm);
0178   param->SetLossFluctuations(false);
0179 
0180   // step limitation (as a full process)
0181   //
0182   AddStepMax();
0183 }
0184 
0185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0186 
0187 void PhysicsList::AddPhysicsList(const G4String& name)
0188 {
0189   if (verboseLevel > 0) {
0190     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0191   }
0192 
0193   if (name == fEmName) return;
0194 
0195   if (name == "local") {
0196     fEmName = name;
0197     delete fEmPhysicsList;
0198     fEmPhysicsList = new PhysListEmStandard(name);
0199   }
0200   else if (name == "emstandard_opt3") {
0201     fEmName = name;
0202     delete fEmPhysicsList;
0203     fEmPhysicsList = new G4EmStandardPhysics_option3();
0204   }
0205   else if (name == "emstandard_opt4") {
0206     fEmName = name;
0207     delete fEmPhysicsList;
0208     fEmPhysicsList = new G4EmStandardPhysics_option4();
0209   }
0210   else if (name == "emstandardSS") {
0211     fEmName = name;
0212     delete fEmPhysicsList;
0213     fEmPhysicsList = new G4EmStandardPhysicsSS();
0214   }
0215   else if (name == "emstandardWVI") {
0216     fEmName = name;
0217     delete fEmPhysicsList;
0218     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0219   }
0220   else if (name == "emstandardGS") {
0221     fEmName = name;
0222     delete fEmPhysicsList;
0223     fEmPhysicsList = new G4EmStandardPhysicsGS();
0224   }
0225   else {
0226     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0227            << " is not defined" << G4endl;
0228   }
0229 }
0230 
0231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0232 
0233 void PhysicsList::AddStepMax()
0234 {
0235   // Step limitation seen as a process
0236   StepMax* stepMaxProcess = new StepMax();
0237 
0238   auto particleIterator = GetParticleIterator();
0239   particleIterator->reset();
0240   while ((*particleIterator)()) {
0241     G4ParticleDefinition* particle = particleIterator->value();
0242     G4ProcessManager* pmanager = particle->GetProcessManager();
0243 
0244     if (stepMaxProcess->IsApplicable(*particle) && pmanager) {
0245       pmanager->AddDiscreteProcess(stepMaxProcess);
0246     }
0247   }
0248 }
0249 
0250 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......