Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:01

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/TestEm6/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 "G4AnnihiToMuPair.hh"
0039 #include "G4DecayPhysics.hh"
0040 #include "G4Electron.hh"
0041 #include "G4EmLivermorePhysics.hh"
0042 #include "G4EmLowEPPhysics.hh"
0043 #include "G4EmPenelopePhysics.hh"
0044 #include "G4EmStandardPhysics.hh"
0045 #include "G4EmStandardPhysicsGS.hh"
0046 #include "G4EmStandardPhysicsSS.hh"
0047 #include "G4EmStandardPhysicsWVI.hh"
0048 #include "G4EmStandardPhysics_option1.hh"
0049 #include "G4EmStandardPhysics_option2.hh"
0050 #include "G4EmStandardPhysics_option3.hh"
0051 #include "G4EmStandardPhysics_option4.hh"
0052 #include "G4Gamma.hh"
0053 #include "G4GammaConversionToMuons.hh"
0054 #include "G4LossTableManager.hh"
0055 #include "G4ParticleDefinition.hh"
0056 #include "G4ParticleTable.hh"
0057 #include "G4Positron.hh"
0058 #include "G4ProcessManager.hh"
0059 #include "G4ProcessTable.hh"
0060 #include "G4SystemOfUnits.hh"
0061 #include "G4UnitsTable.hh"
0062 #include "G4eeToHadrons.hh"
0063 
0064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0065 
0066 PhysicsList::PhysicsList()
0067   : G4VModularPhysicsList(), fEmPhysicsList(0), fDecayPhysicsList(0), fStepMaxProcess(0), fMes(0)
0068 {
0069   G4LossTableManager::Instance()->SetVerbose(1);
0070 
0071   defaultCutValue = 1. * km;
0072   fMes = new PhysicsListMessenger(this);
0073 
0074   fStepMaxProcess = new StepMax();
0075 
0076   fDecayPhysicsList = new G4DecayPhysics();
0077 
0078   SetVerboseLevel(2);
0079 }
0080 
0081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0082 
0083 PhysicsList::~PhysicsList()
0084 {
0085   delete fMes;
0086   delete fDecayPhysicsList;
0087   delete fEmPhysicsList;
0088   delete fStepMaxProcess;
0089 }
0090 
0091 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0092 
0093 void PhysicsList::ConstructParticle()
0094 {
0095   fDecayPhysicsList->ConstructParticle();
0096 }
0097 
0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0099 
0100 void PhysicsList::ConstructProcess()
0101 {
0102   AddTransportation();
0103 
0104   if (fEmPhysicsList) fEmPhysicsList->ConstructProcess();
0105   fDecayPhysicsList->ConstructProcess();
0106 
0107   AddStepMax();
0108 
0109   ConstructHighEnergy();
0110 }
0111 
0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0113 
0114 void PhysicsList::ConstructHighEnergy()
0115 {
0116   const G4ParticleDefinition* particle = G4Gamma::Gamma();
0117   G4ProcessManager* pmanager = particle->GetProcessManager();
0118 
0119   pmanager->AddDiscreteProcess(new G4GammaConversionToMuons);
0120 
0121   particle = G4Positron::Positron();
0122   pmanager = particle->GetProcessManager();
0123 
0124   pmanager->AddDiscreteProcess(new G4AnnihiToMuPair);
0125   pmanager->AddDiscreteProcess(new G4eeToHadrons);
0126 }
0127 
0128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0129 
0130 void PhysicsList::SetGammaToMuPairFac(G4double fac)
0131 {
0132   G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
0133   G4GammaConversionToMuons* gammaToMuPairProcess =
0134     (G4GammaConversionToMuons*)theProcessTable->FindProcess("GammaToMuPair", "gamma");
0135   if (gammaToMuPairProcess)
0136     gammaToMuPairProcess->SetCrossSecFactor(fac);
0137   else
0138     G4cout << "Warning. No process GammaToMuPair found, SetGammaToMuPairFac was ignored" << G4endl;
0139 }
0140 
0141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0142 
0143 void PhysicsList::SetAnnihiToMuPairFac(G4double fac)
0144 {
0145   G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
0146   G4AnnihiToMuPair* annihiToMuPairProcess =
0147     (G4AnnihiToMuPair*)theProcessTable->FindProcess("AnnihiToMuPair", "e+");
0148   if (annihiToMuPairProcess)
0149     annihiToMuPairProcess->SetCrossSecFactor(fac);
0150   else
0151     G4cout << "Warning. No process AnnihiToMuPair found, SetAnnihiToMuPairFac ignored" << G4endl;
0152 }
0153 
0154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0155 
0156 void PhysicsList::SetAnnihiToHadronFac(G4double fac)
0157 {
0158   G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
0159   G4eeToHadrons* eehadProcess = (G4eeToHadrons*)theProcessTable->FindProcess("ee2hadr", "e+");
0160   if (eehadProcess)
0161     eehadProcess->SetCrossSecFactor(fac);
0162   else
0163     G4cout << "Warning. No process ee2hadr found, SetAnnihiToHadronFac was ignored" << G4endl;
0164 }
0165 
0166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0167 
0168 void PhysicsList::AddPhysicsList(const G4String& name)
0169 {
0170   if (verboseLevel > 1) {
0171     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0172   }
0173 
0174   if (name == fEmName) {
0175     return;
0176   }
0177   else if (name == "emstandard_opt0") {
0178     fEmName = name;
0179     delete fEmPhysicsList;
0180     fEmPhysicsList = new G4EmStandardPhysics();
0181   }
0182   else if (name == "emstandard_opt1") {
0183     fEmName = name;
0184     delete fEmPhysicsList;
0185     fEmPhysicsList = new G4EmStandardPhysics_option1();
0186   }
0187   else if (name == "emstandard_opt2") {
0188     fEmName = name;
0189     delete fEmPhysicsList;
0190     fEmPhysicsList = new G4EmStandardPhysics_option2();
0191   }
0192   else if (name == "emstandard_opt3") {
0193     fEmName = name;
0194     delete fEmPhysicsList;
0195     fEmPhysicsList = new G4EmStandardPhysics_option3();
0196   }
0197   else if (name == "emstandard_opt4") {
0198     fEmName = name;
0199     delete fEmPhysicsList;
0200     fEmPhysicsList = new G4EmStandardPhysics_option4();
0201   }
0202   else if (name == "emlivermore") {
0203     fEmName = name;
0204     delete fEmPhysicsList;
0205     fEmPhysicsList = new G4EmLivermorePhysics();
0206   }
0207   else if (name == "empenelope") {
0208     fEmName = name;
0209     delete fEmPhysicsList;
0210     fEmPhysicsList = new G4EmPenelopePhysics();
0211   }
0212   else if (name == "emlowenergy") {
0213     fEmName = name;
0214     delete fEmPhysicsList;
0215     fEmPhysicsList = new G4EmLowEPPhysics();
0216   }
0217   else if (name == "emstandardGS") {
0218     fEmName = name;
0219     delete fEmPhysicsList;
0220     fEmPhysicsList = new G4EmStandardPhysicsGS();
0221   }
0222   else if (name == "emstandardSS") {
0223     fEmName = name;
0224     delete fEmPhysicsList;
0225     fEmPhysicsList = new G4EmStandardPhysicsSS();
0226   }
0227   else if (name == "emstandardWVI") {
0228     fEmName = name;
0229     delete fEmPhysicsList;
0230     fEmPhysicsList = new G4EmStandardPhysicsWVI();
0231   }
0232   else {
0233     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0234            << " is not defined" << G4endl;
0235   }
0236 }
0237 
0238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0239 
0240 void PhysicsList::AddStepMax()
0241 {
0242   // Step limitation seen as a process
0243 
0244   auto particleIterator = GetParticleIterator();
0245   particleIterator->reset();
0246   while ((*particleIterator)()) {
0247     G4ParticleDefinition* particle = particleIterator->value();
0248     G4ProcessManager* pmanager = particle->GetProcessManager();
0249 
0250     if (fStepMaxProcess->IsApplicable(*particle)) {
0251       pmanager->AddDiscreteProcess(fStepMaxProcess);
0252     }
0253   }
0254 }
0255 
0256 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......