Back to home page

EIC code displayed by LXR

 
 

    


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

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