Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 08:37:22

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 PAI model
0034 //
0035 // Author:      V.Ivanchenko 01.09.2010
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 
0049 #include "G4DecayPhysics.hh"
0050 #include "G4Electron.hh"
0051 #include "G4EmConfigurator.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 "G4Gamma.hh"
0065 #include "G4LossTableManager.hh"
0066 #include "G4PAIModel.hh"
0067 #include "G4PAIPhotModel.hh"
0068 #include "G4ParticleTable.hh"
0069 #include "G4ParticleTypes.hh"
0070 #include "G4Positron.hh"
0071 #include "G4ProcessManager.hh"
0072 #include "G4ProductionCutsTable.hh"
0073 #include "G4Proton.hh"
0074 #include "G4SystemOfUnits.hh"
0075 #include "G4UnitsTable.hh"
0076 
0077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0078 
0079 PhysicsList::PhysicsList(DetectorConstruction* ptr) : fDetectorConstruction(ptr)
0080 {
0081   // set verbosity for zero to avoid double printout
0082   // on physics verbosity should be restored to 1 when cuts
0083   // are set
0084   G4EmParameters::Instance()->SetVerbose(0);
0085 
0086   SetDefaultCutValue(1 * mm);
0087 
0088   fMessenger = new PhysicsListMessenger(this);
0089 
0090   // Decay Physics is always defined
0091   fDecayPhysicsList = new G4DecayPhysics();
0092 
0093   // EM physics
0094   fEmName = G4String("emstandard_opt0");
0095   fEmPhysicsList = new G4EmStandardPhysics(0);
0096 
0097   SetVerboseLevel(1);
0098 }
0099 
0100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0101 
0102 PhysicsList::~PhysicsList()
0103 {
0104   delete fMessenger;
0105   delete fDecayPhysicsList;
0106   delete fEmPhysicsList;
0107 }
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0110 
0111 void PhysicsList::ConstructParticle()
0112 {
0113   fDecayPhysicsList->ConstructParticle();
0114 }
0115 
0116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0117 
0118 void PhysicsList::ConstructProcess()
0119 {
0120   AddTransportation();
0121   fEmPhysicsList->ConstructProcess();
0122   fDecayPhysicsList->ConstructProcess();
0123   AddStepMax();
0124 }
0125 
0126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0127 
0128 void PhysicsList::AddPhysicsList(const G4String& name)
0129 {
0130   if (verboseLevel > 1) {
0131     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0132   }
0133 
0134   if (name == fEmName) {
0135     return;
0136   }
0137   else if (name == "emstandard_opt0") {
0138     fEmName = name;
0139     delete fEmPhysicsList;
0140     fEmPhysicsList = new G4EmStandardPhysics(0);
0141   }
0142   else if (name == "emstandard_opt1") {
0143     fEmName = name;
0144     delete fEmPhysicsList;
0145     fEmPhysicsList = new G4EmStandardPhysics_option1(0);
0146   }
0147   else if (name == "emstandard_opt2") {
0148     fEmName = name;
0149     delete fEmPhysicsList;
0150     fEmPhysicsList = new G4EmStandardPhysics_option2(0);
0151   }
0152   else if (name == "emstandard_opt3") {
0153     fEmName = name;
0154     delete fEmPhysicsList;
0155     fEmPhysicsList = new G4EmStandardPhysics_option3(0);
0156   }
0157   else if (name == "emstandard_opt4") {
0158     fEmName = name;
0159     delete fEmPhysicsList;
0160     fEmPhysicsList = new G4EmStandardPhysics_option4(0);
0161   }
0162   else if (name == "emstandardWVI") {
0163     fEmName = name;
0164     delete fEmPhysicsList;
0165     fEmPhysicsList = new G4EmStandardPhysicsWVI(0);
0166   }
0167   else if (name == "emstandardSS") {
0168     fEmName = name;
0169     delete fEmPhysicsList;
0170     fEmPhysicsList = new G4EmStandardPhysicsSS(0);
0171   }
0172   else if (name == "emstandardGS") {
0173     fEmName = name;
0174     delete fEmPhysicsList;
0175     fEmPhysicsList = new G4EmStandardPhysicsGS(0);
0176   }
0177   else if (name == "pai") {
0178     G4EmParameters::Instance()->AddPAIModel("all", "world", "pai");
0179   }
0180   else if (name == "pai_photon") {
0181     G4EmParameters::Instance()->AddPAIModel("all", "world", "pai_photon");
0182   }
0183   else if (name == "emlivermore") {
0184     fEmName = name;
0185     delete fEmPhysicsList;
0186     fEmPhysicsList = new G4EmLivermorePhysics(0);
0187   }
0188   else if (name == "empenelope") {
0189     fEmName = name;
0190     delete fEmPhysicsList;
0191     fEmPhysicsList = new G4EmPenelopePhysics(0);
0192   }
0193   else if (name == "emlowenergy") {
0194     fEmName = name;
0195     delete fEmPhysicsList;
0196     fEmPhysicsList = new G4EmLowEPPhysics(0);
0197   }
0198   else {
0199     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0200            << " is not defined" << G4endl;
0201   }
0202 }
0203 
0204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0205 
0206 void PhysicsList::AddStepMax()
0207 {
0208   // Step limitation seen as a process
0209   StepMax* stepMaxProcess = new StepMax(fDetectorConstruction);
0210 
0211   auto particleIterator = GetParticleIterator();
0212   particleIterator->reset();
0213   while ((*particleIterator)()) {
0214     G4ParticleDefinition* particle = particleIterator->value();
0215     G4ProcessManager* pmanager = particle->GetProcessManager();
0216 
0217     if (stepMaxProcess->IsApplicable(*particle)) {
0218       pmanager->AddDiscreteProcess(stepMaxProcess);
0219     }
0220   }
0221 }
0222 
0223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0224 
0225 void PhysicsList::SetCuts()
0226 {
0227   G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(25. * eV, 1e5);
0228   if (verboseLevel > 0) {
0229     DumpCutValuesTable();
0230   }
0231 }
0232 
0233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......