Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:33

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 // This example is provided by the Geant4-DNA collaboration
0027 // Any report or published results obtained using the Geant4-DNA software 
0028 // shall cite the following Geant4-DNA collaboration publication:
0029 // Med. Phys. 37 (2010) 4692-4708
0030 // The Geant4-DNA web site is available at http://geant4-dna.org
0031 // 
0032 // If you use this example, please cite the following publication:
0033 // Rad. Prot. Dos. 133 (2009) 2-11
0034 
0035 #include "PhysicsList.hh"
0036 #include "PhysicsListMessenger.hh"
0037 
0038 #include "G4SystemOfUnits.hh"
0039 #include "StepMax.hh"
0040 #include "G4EmStandardPhysics.hh"
0041 #include "G4EmStandardPhysics_option1.hh"
0042 #include "G4EmStandardPhysics_option2.hh"
0043 #include "G4EmStandardPhysics_option3.hh"
0044 #include "G4EmStandardPhysics_option4.hh"
0045 #include "G4EmLivermorePhysics.hh"
0046 #include "G4EmPenelopePhysics.hh"
0047 #include "G4DecayPhysics.hh"
0048 #include "G4ProcessManager.hh"
0049 #include "G4Gamma.hh"
0050 #include "G4Electron.hh"
0051 #include "G4Positron.hh"
0052 
0053 PhysicsList::PhysicsList() : G4VModularPhysicsList()
0054 {
0055   fMessenger = new PhysicsListMessenger(this);
0056 
0057   SetVerboseLevel(1);
0058 
0059   // EM physics
0060   fEmName = G4String("emlivermore");  
0061 
0062   fEmPhysicsList = new G4EmLivermorePhysics();
0063 
0064   // Deacy physics and all particles
0065   fDecPhysicsList = new G4DecayPhysics();
0066 }
0067 
0068 PhysicsList::~PhysicsList()
0069 {
0070   delete fMessenger;
0071   delete fEmPhysicsList;
0072   delete fDecPhysicsList;
0073 }
0074 
0075 void PhysicsList::ConstructParticle()
0076 {
0077   fDecPhysicsList->ConstructParticle();
0078 }
0079 
0080 void PhysicsList::ConstructProcess()
0081 {
0082   // transportation
0083   AddTransportation();
0084   
0085   // electromagnetic physics list
0086   fEmPhysicsList->ConstructProcess();
0087 
0088   // decay physics list
0089   fDecPhysicsList->ConstructProcess();
0090   
0091   // step limitation (as a full process)
0092   AddStepMax();  
0093   
0094 }
0095 
0096 void PhysicsList::AddPhysicsList(const G4String& name)
0097 {
0098   if (verboseLevel>1) {
0099     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0100   }
0101 
0102   if (name == fEmName) return;
0103 
0104   if (name == "emstandard_opt0") {
0105 
0106     fEmName = name;
0107     delete fEmPhysicsList;
0108     fEmPhysicsList = new G4EmStandardPhysics(1);
0109 
0110   } else if (name == "emstandard_opt1") {
0111 
0112     fEmName = name;
0113     delete fEmPhysicsList;
0114     fEmPhysicsList = new G4EmStandardPhysics_option1();
0115 
0116   } else if (name == "emstandard_opt2") {
0117 
0118     fEmName = name;
0119     delete fEmPhysicsList;
0120     fEmPhysicsList = new G4EmStandardPhysics_option2();
0121     
0122   } else if (name == "emstandard_opt3") {
0123 
0124     fEmName = name;
0125     delete fEmPhysicsList;
0126     fEmPhysicsList = new G4EmStandardPhysics_option3();    
0127 
0128   } else if (name == "emstandard_opt4") {
0129 
0130     fEmName = name;
0131     delete fEmPhysicsList;
0132     fEmPhysicsList = new G4EmStandardPhysics_option4();    
0133 
0134   } else if (name == "emlivermore") {
0135 
0136     fEmName = name;
0137     delete fEmPhysicsList;
0138     fEmPhysicsList = new G4EmLivermorePhysics();
0139 
0140   } else if (name == "empenelope") {
0141     
0142     fEmName = name;
0143     delete fEmPhysicsList;
0144     fEmPhysicsList = new G4EmPenelopePhysics();
0145 
0146   } 
0147 }
0148 
0149 void PhysicsList::AddStepMax()
0150 {
0151   // Step limitation seen as a process
0152   StepMax* stepMaxProcess = new StepMax(fMessenger);
0153 
0154   auto particleIterator=GetParticleIterator();
0155   particleIterator->reset();
0156   while ((*particleIterator)()){
0157     G4ParticleDefinition* particle = particleIterator->value();
0158     G4ProcessManager* pmanager = particle->GetProcessManager();
0159 
0160     if (stepMaxProcess->IsApplicable(*particle))
0161       {
0162         pmanager ->AddDiscreteProcess(stepMaxProcess);
0163       }
0164   }
0165 }