Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:14

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 medical/electronScattering/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 "PhysicsListMessenger.hh"
0036 #include "StepMax.hh"
0037 
0038 #include "G4Decay.hh"
0039 #include "G4EmStandardPhysics.hh"
0040 #include "G4EmStandardPhysicsGS.hh"
0041 #include "G4EmStandardPhysicsSS.hh"
0042 #include "G4EmStandardPhysicsWVI.hh"
0043 #include "G4EmStandardPhysics_option1.hh"
0044 #include "G4EmStandardPhysics_option2.hh"
0045 #include "G4EmStandardPhysics_option3.hh"
0046 #include "G4EmStandardPhysics_option4.hh"
0047 #include "G4ParticleDefinition.hh"
0048 #include "G4ProcessManager.hh"
0049 #include "G4UnitsTable.hh"
0050 
0051 // Bosons
0052 #include "G4ChargedGeantino.hh"
0053 #include "G4Gamma.hh"
0054 #include "G4Geantino.hh"
0055 #include "G4OpticalPhoton.hh"
0056 
0057 // leptons
0058 #include "G4AntiNeutrinoE.hh"
0059 #include "G4AntiNeutrinoMu.hh"
0060 #include "G4Electron.hh"
0061 #include "G4MuonMinus.hh"
0062 #include "G4MuonPlus.hh"
0063 #include "G4NeutrinoE.hh"
0064 #include "G4NeutrinoMu.hh"
0065 #include "G4Positron.hh"
0066 
0067 // Hadrons
0068 #include "G4BaryonConstructor.hh"
0069 #include "G4IonConstructor.hh"
0070 #include "G4MesonConstructor.hh"
0071 #include "G4SystemOfUnits.hh"
0072 
0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0074 
0075 PhysicsList::PhysicsList()
0076   : G4VModularPhysicsList(), fMessenger(0), fEmName("emstandard_opt0"), fEmPhysicsList(0)
0077 {
0078   fMessenger = new PhysicsListMessenger(this);
0079 
0080   // EM physics
0081   fEmPhysicsList = new G4EmStandardPhysics();
0082 
0083   SetDefaultCutValue(1. * mm);
0084   SetVerboseLevel(1);
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 PhysicsList::~PhysicsList()
0090 {
0091   delete fEmPhysicsList;
0092   delete fMessenger;
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0096 
0097 void PhysicsList::ConstructParticle()
0098 {
0099   // pseudo-particles
0100   G4Geantino::GeantinoDefinition();
0101   G4ChargedGeantino::ChargedGeantinoDefinition();
0102 
0103   // gamma
0104   G4Gamma::GammaDefinition();
0105 
0106   // optical photon
0107   G4OpticalPhoton::OpticalPhotonDefinition();
0108 
0109   // leptons
0110   G4Electron::ElectronDefinition();
0111   G4Positron::PositronDefinition();
0112   G4MuonPlus::MuonPlusDefinition();
0113   G4MuonMinus::MuonMinusDefinition();
0114 
0115   G4NeutrinoE::NeutrinoEDefinition();
0116   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
0117   G4NeutrinoMu::NeutrinoMuDefinition();
0118   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
0119 
0120   // mesons
0121   G4MesonConstructor mConstructor;
0122   mConstructor.ConstructParticle();
0123 
0124   // barions
0125   G4BaryonConstructor bConstructor;
0126   bConstructor.ConstructParticle();
0127 
0128   // ions
0129   G4IonConstructor iConstructor;
0130   iConstructor.ConstructParticle();
0131 }
0132 
0133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0134 
0135 void PhysicsList::ConstructProcess()
0136 {
0137   AddTransportation();
0138   fEmPhysicsList->ConstructProcess();
0139   AddDecay();
0140   AddStepMax();
0141 }
0142 
0143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0144 
0145 void PhysicsList::AddDecay()
0146 {
0147   // Add Decay Process
0148 
0149   G4Decay* fDecayProcess = new G4Decay();
0150 
0151   auto particleIterator = GetParticleIterator();
0152   particleIterator->reset();
0153   while ((*particleIterator)()) {
0154     G4ParticleDefinition* particle = particleIterator->value();
0155     G4ProcessManager* pmanager = particle->GetProcessManager();
0156 
0157     if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
0158       pmanager->AddProcess(fDecayProcess);
0159 
0160       // set ordering for PostStepDoIt and AtRestDoIt
0161       pmanager->SetProcessOrdering(fDecayProcess, idxPostStep);
0162       pmanager->SetProcessOrdering(fDecayProcess, idxAtRest);
0163     }
0164   }
0165 }
0166 
0167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0168 
0169 void PhysicsList::AddStepMax()
0170 {
0171   // Step limitation seen as a process
0172   StepMax* stepMaxProcess = new StepMax();
0173 
0174   auto particleIterator = GetParticleIterator();
0175   particleIterator->reset();
0176   while ((*particleIterator)()) {
0177     G4ParticleDefinition* particle = particleIterator->value();
0178     G4ProcessManager* pmanager = particle->GetProcessManager();
0179 
0180     if (stepMaxProcess->IsApplicable(*particle)) {
0181       pmanager->AddDiscreteProcess(stepMaxProcess);
0182     }
0183   }
0184 }
0185 
0186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0187 
0188 void PhysicsList::AddPhysicsList(const G4String& name)
0189 {
0190   if (verboseLevel > -1) {
0191     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0192   }
0193 
0194   if (name == fEmName) return;
0195 
0196   if (name == "emstandard_opt0") {
0197     fEmName = name;
0198     delete fEmPhysicsList;
0199     fEmPhysicsList = new G4EmStandardPhysics();
0200   }
0201   else if (name == "emstandard_opt1") {
0202     fEmName = name;
0203     delete fEmPhysicsList;
0204     fEmPhysicsList = new G4EmStandardPhysics_option1();
0205   }
0206   else if (name == "emstandard_opt2") {
0207     fEmName = name;
0208     delete fEmPhysicsList;
0209     fEmPhysicsList = new G4EmStandardPhysics_option2();
0210   }
0211   else if (name == "emstandard_opt3") {
0212     fEmName = name;
0213     delete fEmPhysicsList;
0214     fEmPhysicsList = new G4EmStandardPhysics_option3();
0215   }
0216   else if (name == "emstandard_opt4") {
0217     fEmName = name;
0218     delete fEmPhysicsList;
0219     fEmPhysicsList = new G4EmStandardPhysics_option4();
0220   }
0221   else if (name == "standardSS") {
0222     fEmName = name;
0223     delete fEmPhysicsList;
0224     fEmPhysicsList = new G4EmStandardPhysicsSS();
0225   }
0226   else if (name == "standardGS") {
0227     fEmName = name;
0228     delete fEmPhysicsList;
0229     fEmPhysicsList = new G4EmStandardPhysicsGS();
0230   }
0231   else if (name == "standardWVI") {
0232     fEmName = name;
0233     delete fEmPhysicsList;
0234     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0235   }
0236   else {
0237     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0238            << " is not defined" << G4endl;
0239   }
0240 }
0241 
0242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......