Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/extended/medical/electronScattering/src/PhysicsList.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 #include "PhysicsList.hh"
0030 
0031 #include "PhysicsListMessenger.hh"
0032 #include "StepMax.hh"
0033 
0034 #include "G4Decay.hh"
0035 #include "G4EmStandardPhysics.hh"
0036 #include "G4EmStandardPhysicsGS.hh"
0037 #include "G4EmStandardPhysicsSS.hh"
0038 #include "G4EmStandardPhysicsWVI.hh"
0039 #include "G4EmStandardPhysics_option1.hh"
0040 #include "G4EmStandardPhysics_option2.hh"
0041 #include "G4EmStandardPhysics_option3.hh"
0042 #include "G4EmStandardPhysics_option4.hh"
0043 #include "G4ParticleDefinition.hh"
0044 #include "G4ProcessManager.hh"
0045 #include "G4UnitsTable.hh"
0046 
0047 // Bosons
0048 #include "G4ChargedGeantino.hh"
0049 #include "G4Gamma.hh"
0050 #include "G4Geantino.hh"
0051 #include "G4OpticalPhoton.hh"
0052 
0053 // leptons
0054 #include "G4AntiNeutrinoE.hh"
0055 #include "G4AntiNeutrinoMu.hh"
0056 #include "G4Electron.hh"
0057 #include "G4MuonMinus.hh"
0058 #include "G4MuonPlus.hh"
0059 #include "G4NeutrinoE.hh"
0060 #include "G4NeutrinoMu.hh"
0061 #include "G4Positron.hh"
0062 
0063 // Hadrons
0064 #include "G4BaryonConstructor.hh"
0065 #include "G4IonConstructor.hh"
0066 #include "G4MesonConstructor.hh"
0067 #include "G4SystemOfUnits.hh"
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 
0071 PhysicsList::PhysicsList()
0072   : G4VModularPhysicsList(), fMessenger(0), fEmName("emstandard_opt0"), fEmPhysicsList(0)
0073 {
0074   fMessenger = new PhysicsListMessenger(this);
0075 
0076   // EM physics
0077   fEmPhysicsList = new G4EmStandardPhysics();
0078 
0079   SetDefaultCutValue(1. * mm);
0080   SetVerboseLevel(1);
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0084 
0085 PhysicsList::~PhysicsList()
0086 {
0087   delete fEmPhysicsList;
0088   delete fMessenger;
0089 }
0090 
0091 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0092 
0093 void PhysicsList::ConstructParticle()
0094 {
0095   // pseudo-particles
0096   G4Geantino::GeantinoDefinition();
0097   G4ChargedGeantino::ChargedGeantinoDefinition();
0098 
0099   // gamma
0100   G4Gamma::GammaDefinition();
0101 
0102   // optical photon
0103   G4OpticalPhoton::OpticalPhotonDefinition();
0104 
0105   // leptons
0106   G4Electron::ElectronDefinition();
0107   G4Positron::PositronDefinition();
0108   G4MuonPlus::MuonPlusDefinition();
0109   G4MuonMinus::MuonMinusDefinition();
0110 
0111   G4NeutrinoE::NeutrinoEDefinition();
0112   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
0113   G4NeutrinoMu::NeutrinoMuDefinition();
0114   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
0115 
0116   // mesons
0117   G4MesonConstructor mConstructor;
0118   mConstructor.ConstructParticle();
0119 
0120   // barions
0121   G4BaryonConstructor bConstructor;
0122   bConstructor.ConstructParticle();
0123 
0124   // ions
0125   G4IonConstructor iConstructor;
0126   iConstructor.ConstructParticle();
0127 }
0128 
0129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0130 
0131 void PhysicsList::ConstructProcess()
0132 {
0133   AddTransportation();
0134   fEmPhysicsList->ConstructProcess();
0135   AddDecay();
0136   AddStepMax();
0137 }
0138 
0139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0140 
0141 void PhysicsList::AddDecay()
0142 {
0143   // Add Decay Process
0144 
0145   G4Decay* fDecayProcess = new G4Decay();
0146 
0147   auto particleIterator = GetParticleIterator();
0148   particleIterator->reset();
0149   while ((*particleIterator)()) {
0150     G4ParticleDefinition* particle = particleIterator->value();
0151     G4ProcessManager* pmanager = particle->GetProcessManager();
0152 
0153     if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
0154       pmanager->AddProcess(fDecayProcess);
0155 
0156       // set ordering for PostStepDoIt and AtRestDoIt
0157       pmanager->SetProcessOrdering(fDecayProcess, idxPostStep);
0158       pmanager->SetProcessOrdering(fDecayProcess, idxAtRest);
0159     }
0160   }
0161 }
0162 
0163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0164 
0165 void PhysicsList::AddStepMax()
0166 {
0167   // Step limitation seen as a process
0168   StepMax* stepMaxProcess = new StepMax();
0169 
0170   auto particleIterator = GetParticleIterator();
0171   particleIterator->reset();
0172   while ((*particleIterator)()) {
0173     G4ParticleDefinition* particle = particleIterator->value();
0174     G4ProcessManager* pmanager = particle->GetProcessManager();
0175 
0176     if (stepMaxProcess->IsApplicable(*particle)) {
0177       pmanager->AddDiscreteProcess(stepMaxProcess);
0178     }
0179   }
0180 }
0181 
0182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0183 
0184 void PhysicsList::AddPhysicsList(const G4String& name)
0185 {
0186   if (verboseLevel > -1) {
0187     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0188   }
0189 
0190   if (name == fEmName) return;
0191 
0192   if (name == "emstandard_opt0") {
0193     fEmName = name;
0194     delete fEmPhysicsList;
0195     fEmPhysicsList = new G4EmStandardPhysics();
0196   }
0197   else if (name == "emstandard_opt1") {
0198     fEmName = name;
0199     delete fEmPhysicsList;
0200     fEmPhysicsList = new G4EmStandardPhysics_option1();
0201   }
0202   else if (name == "emstandard_opt2") {
0203     fEmName = name;
0204     delete fEmPhysicsList;
0205     fEmPhysicsList = new G4EmStandardPhysics_option2();
0206   }
0207   else if (name == "emstandard_opt3") {
0208     fEmName = name;
0209     delete fEmPhysicsList;
0210     fEmPhysicsList = new G4EmStandardPhysics_option3();
0211   }
0212   else if (name == "emstandard_opt4") {
0213     fEmName = name;
0214     delete fEmPhysicsList;
0215     fEmPhysicsList = new G4EmStandardPhysics_option4();
0216   }
0217   else if (name == "standardSS") {
0218     fEmName = name;
0219     delete fEmPhysicsList;
0220     fEmPhysicsList = new G4EmStandardPhysicsSS();
0221   }
0222   else if (name == "standardGS") {
0223     fEmName = name;
0224     delete fEmPhysicsList;
0225     fEmPhysicsList = new G4EmStandardPhysicsGS();
0226   }
0227   else if (name == "standardWVI") {
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......