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