Back to home page

EIC code displayed by LXR

 
 

    


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

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 publications:
0029 // Med. Phys. 45 (2018) e722-e739
0030 // Phys. Med. 31 (2015) 861-874
0031 // Med. Phys. 37 (2010) 4692-4708
0032 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
0033 // The Geant4-DNA web site is available at http://geant4-dna.org
0034 //
0035 /// \file PhysicsList.cc
0036 /// \brief Implementation of the PhysicsList class
0037 
0038 #include "PhysicsList.hh"
0039 
0040 #include "PhysicsListMessenger.hh"
0041 
0042 #include "G4BaryonConstructor.hh"
0043 #include "G4BosonConstructor.hh"
0044 #include "G4DNAGenericIonsManager.hh"
0045 #include "G4EmDNAPhysics.hh"
0046 #include "G4EmDNAPhysics_option1.hh"
0047 #include "G4EmDNAPhysics_option2.hh"
0048 #include "G4EmDNAPhysics_option3.hh"
0049 #include "G4EmDNAPhysics_option4.hh"
0050 #include "G4EmDNAPhysics_option5.hh"
0051 #include "G4EmDNAPhysics_option6.hh"
0052 #include "G4EmDNAPhysics_option7.hh"
0053 #include "G4EmDNAPhysics_option8.hh"
0054 #include "G4EmLivermorePhysics.hh"
0055 #include "G4EmPenelopePhysics.hh"
0056 #include "G4EmStandardPhysics_option4.hh"
0057 #include "G4IonConstructor.hh"
0058 #include "G4LeptonConstructor.hh"
0059 #include "G4MesonConstructor.hh"
0060 #include "G4ShortLivedConstructor.hh"
0061 #include "G4StepLimiter.hh"
0062 #include "G4UserSpecialCuts.hh"
0063 
0064 #include <memory>
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 
0068 PhysicsList::PhysicsList() : G4VModularPhysicsList()
0069 {
0070   fMessenger = std::make_unique<PhysicsListMessenger>(this);
0071   SetVerboseLevel(1);
0072   fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option2>();
0073 }
0074 
0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0076 
0077 PhysicsList::~PhysicsList() = default;
0078 
0079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0080 
0081 void PhysicsList::ConstructParticle()
0082 {
0083   G4BosonConstructor pBosonConstructor;
0084   pBosonConstructor.ConstructParticle();
0085 
0086   G4LeptonConstructor pLeptonConstructor;
0087   pLeptonConstructor.ConstructParticle();
0088 
0089   G4MesonConstructor pMesonConstructor;
0090   pMesonConstructor.ConstructParticle();
0091 
0092   G4BaryonConstructor pBaryonConstructor;
0093   pBaryonConstructor.ConstructParticle();
0094 
0095   G4IonConstructor pIonConstructor;
0096   pIonConstructor.ConstructParticle();
0097 
0098   G4ShortLivedConstructor pShortLivedConstructor;
0099   pShortLivedConstructor.ConstructParticle();
0100 
0101   G4DNAGenericIonsManager* genericIonsManager;
0102   genericIonsManager = G4DNAGenericIonsManager::Instance();
0103   genericIonsManager->GetIon("alpha++");
0104   genericIonsManager->GetIon("alpha+");
0105   genericIonsManager->GetIon("helium");
0106   genericIonsManager->GetIon("hydrogen");
0107 }
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0110 
0111 void PhysicsList::ConstructProcess()
0112 {
0113   // Transportation
0114   AddTransportation();
0115 
0116   // Electromagnetic physics list
0117   fEmPhysicsList->ConstructProcess();
0118 
0119   // Tracking cut
0120   AddTrackingCut();
0121 
0122   // Maximum step size
0123   AddMaxStepSize();
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) return;
0135 
0136   if (name == "dna") {
0137     fEmName = name;
0138     fEmPhysicsList = std::make_unique<G4EmDNAPhysics>();
0139   }
0140   else if (name == "dna_opt1") {
0141     fEmName = name;
0142     fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option1>();
0143   }
0144   else if (name == "dna_opt2") {
0145     fEmName = name;
0146     fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option2>();
0147   }
0148   else if (name == "dna_opt3") {
0149     fEmName = name;
0150     fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option3>();
0151   }
0152   else if (name == "dna_opt4") {
0153     fEmName = name;
0154     fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option4>();
0155   }
0156   else if (name == "dna_opt5") {
0157     fEmName = name;
0158     fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option5>();
0159   }
0160   else if (name == "dna_opt6") {
0161     fEmName = name;
0162     fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option6>();
0163   }
0164   else if (name == "dna_opt7") {
0165     fEmName = name;
0166     fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option7>();
0167   }
0168   else if (name == "dna_opt8") {
0169     fEmName = name;
0170     fEmPhysicsList = std::make_unique<G4EmDNAPhysics_option8>();
0171   }
0172   else if (name == "liv") {
0173     fEmName = name;
0174     fEmPhysicsList = std::make_unique<G4EmLivermorePhysics>();
0175   }
0176   else if (name == "pene") {
0177     fEmName = name;
0178     fEmPhysicsList = std::make_unique<G4EmPenelopePhysics>();
0179   }
0180   else if (name == "emstandard_opt4") {
0181     fEmName = name;
0182     fEmPhysicsList = std::make_unique<G4EmStandardPhysics_option4>();
0183   }
0184   else {
0185     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0186            << " is not defined" << G4endl;
0187   }
0188 }
0189 
0190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0191 
0192 void PhysicsList::AddTrackingCut()
0193 {
0194   G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
0195 
0196   auto particleIterator = GetParticleIterator();
0197   particleIterator->reset();
0198   while ((*particleIterator)()) {
0199     G4ParticleDefinition* particle = particleIterator->value();
0200     G4String particleName = particle->GetParticleName();
0201 
0202     if (particleName == "e-") {
0203       ph->RegisterProcess(new G4UserSpecialCuts(), particle);
0204     }
0205   }
0206 }
0207 
0208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0209 
0210 void PhysicsList::AddMaxStepSize()
0211 {
0212   G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
0213 
0214   auto particleIterator = GetParticleIterator();
0215   particleIterator->reset();
0216   while ((*particleIterator)()) {
0217     G4ParticleDefinition* particle = particleIterator->value();
0218     G4String particleName = particle->GetParticleName();
0219 
0220     if (particleName == "e-") {
0221       ph->RegisterProcess(new G4StepLimiter(), particle);
0222     }
0223   }
0224 }
0225 
0226 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......