Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 08:29:20

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 //---------------------------------------------------------------------------
0030 //
0031 // ClassName:   PhysicsList
0032 //
0033 // Description: EM physics with a possibility to add transition radiation
0034 //
0035 // Author:      V.Ivanchenko 16.12.2015
0036 //
0037 //----------------------------------------------------------------------------
0038 //
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 #include "PhysicsList.hh"
0044 
0045 #include "DetectorConstruction.hh"
0046 #include "PhysicsListMessenger.hh"
0047 #include "StepMax.hh"
0048 #include "TransitionRadiationPhysics.hh"
0049 
0050 #include "G4DecayPhysics.hh"
0051 #include "G4EmLivermorePhysics.hh"
0052 #include "G4EmLowEPPhysics.hh"
0053 #include "G4EmParameters.hh"
0054 #include "G4EmPenelopePhysics.hh"
0055 #include "G4EmStandardPhysics.hh"
0056 #include "G4EmStandardPhysicsGS.hh"
0057 #include "G4EmStandardPhysicsSS.hh"
0058 #include "G4EmStandardPhysicsWVI.hh"
0059 #include "G4EmStandardPhysics_option1.hh"
0060 #include "G4EmStandardPhysics_option2.hh"
0061 #include "G4EmStandardPhysics_option3.hh"
0062 #include "G4EmStandardPhysics_option4.hh"
0063 #include "G4ProcessManager.hh"
0064 // #include "G4ParticleTypes.hh"
0065 // #include "G4ParticleTable.hh"
0066 #include "G4SystemOfUnits.hh"
0067 
0068 G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = nullptr;
0069 
0070 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0071 
0072 PhysicsList::PhysicsList(DetectorConstruction* ptr) : G4VModularPhysicsList(), fVerbose(1)
0073 {
0074   SetDefaultCutValue(1 * CLHEP::mm);
0075   SetVerboseLevel(fVerbose);
0076 
0077   fMessenger = new PhysicsListMessenger(this);
0078 
0079   // Decay Physics is always defined to define all particles
0080   fDecayPhysicsList = new G4DecayPhysics(fVerbose);
0081 
0082   // EM physics
0083   fEmName = G4String("emstandard_opt0");
0084   fEmPhysicsList = new G4EmStandardPhysics(fVerbose);
0085 
0086   // Transition radiation physics
0087   fXTRPhysicsList = new TransitionRadiationPhysics(fVerbose, ptr);
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0091 
0092 PhysicsList::~PhysicsList()
0093 {
0094   delete fMessenger;
0095   delete fDecayPhysicsList;
0096   delete fXTRPhysicsList;
0097   delete fEmPhysicsList;
0098 }
0099 
0100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0101 
0102 void PhysicsList::ConstructParticle()
0103 {
0104   fDecayPhysicsList->ConstructParticle();
0105 }
0106 
0107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0108 
0109 void PhysicsList::ConstructProcess()
0110 {
0111   AddTransportation();
0112   fEmPhysicsList->ConstructProcess();
0113   fDecayPhysicsList->ConstructProcess();
0114   fXTRPhysicsList->ConstructProcess();
0115   AddStepMax();
0116 }
0117 
0118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0119 
0120 void PhysicsList::AddPhysicsList(const G4String& name)
0121 {
0122   if (fVerbose > 1) {
0123     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0124   }
0125 
0126   if (name == fEmName) {
0127     return;
0128   }
0129   else if (name == "emstandard_opt0") {
0130     fEmName = name;
0131     delete fEmPhysicsList;
0132     fEmPhysicsList = new G4EmStandardPhysics(fVerbose);
0133   }
0134   else if (name == "emstandard_opt1") {
0135     fEmName = name;
0136     delete fEmPhysicsList;
0137     fEmPhysicsList = new G4EmStandardPhysics_option1(fVerbose);
0138   }
0139   else if (name == "emstandard_opt2") {
0140     fEmName = name;
0141     delete fEmPhysicsList;
0142     fEmPhysicsList = new G4EmStandardPhysics_option2(fVerbose);
0143   }
0144   else if (name == "emstandard_opt3") {
0145     fEmName = name;
0146     delete fEmPhysicsList;
0147     fEmPhysicsList = new G4EmStandardPhysics_option3(fVerbose);
0148   }
0149   else if (name == "emstandard_opt4") {
0150     fEmName = name;
0151     delete fEmPhysicsList;
0152     fEmPhysicsList = new G4EmStandardPhysics_option4(fVerbose);
0153   }
0154   else if (name == "emstandardWVI") {
0155     fEmName = name;
0156     delete fEmPhysicsList;
0157     fEmPhysicsList = new G4EmStandardPhysicsWVI(fVerbose);
0158   }
0159   else if (name == "emstandardSS") {
0160     fEmName = name;
0161     delete fEmPhysicsList;
0162     fEmPhysicsList = new G4EmStandardPhysicsSS(fVerbose);
0163   }
0164   else if (name == "emstandardGS") {
0165     fEmName = name;
0166     delete fEmPhysicsList;
0167     fEmPhysicsList = new G4EmStandardPhysicsGS(fVerbose);
0168   }
0169   else if (name == "emlivermore") {
0170     fEmName = name;
0171     delete fEmPhysicsList;
0172     fEmPhysicsList = new G4EmLivermorePhysics(fVerbose);
0173   }
0174   else if (name == "empenelope") {
0175     fEmName = name;
0176     delete fEmPhysicsList;
0177     fEmPhysicsList = new G4EmPenelopePhysics(fVerbose);
0178   }
0179   else if (name == "emlowenergy") {
0180     fEmName = name;
0181     delete fEmPhysicsList;
0182     fEmPhysicsList = new G4EmLowEPPhysics(fVerbose);
0183   }
0184   else {
0185     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0186            << " is not defined" << G4endl;
0187   }
0188 }
0189 
0190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0191 
0192 void PhysicsList::SetXTRModel(const G4String& name)
0193 {
0194   fXTRPhysicsList->SetXTRModel(name);
0195 }
0196 
0197 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0198 
0199 void PhysicsList::AddStepMax()
0200 {
0201   // Step limitation seen as a process
0202   fStepMaxProcess = new StepMax();
0203 
0204   auto particleIterator = GetParticleIterator();
0205   particleIterator->reset();
0206   while ((*particleIterator)()) {
0207     G4ParticleDefinition* particle = particleIterator->value();
0208     G4ProcessManager* pmanager = particle->GetProcessManager();
0209 
0210     if (fStepMaxProcess->IsApplicable(*particle)) {
0211       pmanager->AddDiscreteProcess(fStepMaxProcess);
0212     }
0213   }
0214 }
0215 
0216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......