Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Code developed by
0027 // Silvia Pozzi (1), silvia.pozzi@iss.it
0028 // Barbara Caccia (1), barbara.caccia@iss.it
0029 // Carlo Mancini Terracciano (2), carlo.mancini.terracciano@roma1.infn.it
0030 // (1) Istituto Superiore di Sanita' and INFN Roma, Italy
0031 // (2) Univ. La Sapienza and INFN Roma, Italy
0032 
0033 #include "PhysicsList.hh"
0034 #include "PhysicsListMessenger.hh"
0035 #include "StepMax.hh"
0036 
0037 #include <G4EmStandardPhysics.hh>
0038 #include <G4eBremsstrahlung.hh>
0039 
0040 #include <G4DecayPhysics.hh> 
0041 #include <G4ProductionCutsTable.hh>
0042 #include <G4SystemOfUnits.hh>
0043 
0044 #include "G4SystemOfUnits.hh"
0045 #include "G4VPhysicsConstructor.hh"
0046 
0047 // Physics lists
0048 #include "G4EmStandardPhysics_option4.hh"
0049 #include "G4EmStandardPhysics_option3.hh"
0050 #include "G4EmLivermorePhysics.hh"
0051 #include "G4EmPenelopePhysics.hh"
0052 #include "G4DecayPhysics.hh"
0053 #include "G4HadronElasticPhysics.hh"
0054 #include "G4HadronInelasticQBBC.hh"
0055 #include "G4IonBinaryCascadePhysics.hh"
0056 #include "G4Decay.hh"
0057 
0058 #include "G4UnitsTable.hh"
0059 #include "G4ProcessManager.hh"
0060 
0061 /////////////////////////////////////////////////////////////////////////////
0062 PhysicsList::PhysicsList() : G4VModularPhysicsList()
0063 {
0064     defaultCutValue = 1.*mm;
0065     helIsRegistered  = false;
0066     bicIsRegistered  = false;
0067     biciIsRegistered = false;
0068     locIonIonInelasticIsRegistered = false;
0069 
0070     stepMaxProcess = nullptr;
0071 
0072     pMessenger = new PhysicsListMessenger(this);
0073 
0074     SetVerboseLevel(1);
0075 
0076     // EM physics
0077     emPhysicsList = new G4EmStandardPhysics_option3(1);
0078     emName = G4String("emstandard_opt3");
0079 
0080     //  emPhysicsList = new G4EmLivermorePhysics();
0081     //  emName = G4String("LowE_Livermore");
0082 
0083     // Decay physics and all particles
0084     decPhysicsList = new G4DecayPhysics();
0085 }
0086 
0087 void PhysicsList::SetCuts()
0088 {
0089     G4VUserPhysicsList::SetVerboseLevel(2);
0090     G4VUserPhysicsList::SetCuts();
0091 }
0092 
0093 /////////////////////////////////////////////////////////////////////////////
0094 PhysicsList::~PhysicsList()
0095 {
0096     delete pMessenger;
0097     delete emPhysicsList;
0098     delete decPhysicsList;
0099     for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
0100 }
0101 
0102 void PhysicsList::ConstructParticle()
0103 {
0104     decPhysicsList->ConstructParticle();
0105 }
0106 
0107 void PhysicsList::ConstructProcess()
0108 {
0109     // transportation
0110     AddTransportation();
0111 
0112     // electromagnetic physics list
0113     emPhysicsList->ConstructProcess();
0114 
0115     // decay physics list
0116     decPhysicsList->ConstructProcess();
0117 
0118     // hadronic physics lists
0119     for(size_t i=0; i<hadronPhys.size(); i++)
0120     {
0121         hadronPhys[i]->ConstructProcess();
0122     }
0123 
0124     // step limitation (as a full process)
0125     AddStepMax();
0126 }
0127 
0128 void PhysicsList::AddPhysicsList(const G4String& name)
0129 {
0130     if (verboseLevel>1)
0131     {
0132         G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0133     }
0134     if (name == emName) return;
0135 
0136     //   Electromagnetic Models
0137     if (name == "standard_opt3")
0138     {
0139         emName = name;
0140         delete emPhysicsList;
0141         emPhysicsList = new G4EmStandardPhysics_option3();
0142         G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
0143                 << "G4EmStandardPhysics_option3" << G4endl;
0144     }
0145     else if (name == "standard_opt4")
0146     {
0147         emName = name;
0148         delete emPhysicsList;
0149         emPhysicsList = new G4EmStandardPhysics_option4();
0150         G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
0151                 << "G4EmStandardPhysics_option4" << G4endl;
0152     }
0153     else if (name == "LowE_Livermore")
0154     {
0155         emName = name;
0156         delete emPhysicsList;
0157         emPhysicsList = new G4EmLivermorePhysics();
0158         G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
0159                 << "G4EmLivermorePhysics" << G4endl;
0160     }
0161     else if (name == "LowE_Penelope")
0162     {
0163         emName = name;
0164         delete emPhysicsList;
0165         emPhysicsList = new G4EmPenelopePhysics();
0166         G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
0167                 << "G4EmLivermorePhysics" << G4endl;
0168 
0169     //   Hadronic Models
0170     }
0171     else if (name == "elastic" && !helIsRegistered)
0172     {
0173 
0174         hadronPhys.push_back( new G4HadronElasticPhysics());
0175         helIsRegistered = true;
0176         G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: "
0177                 << "G4HadronElasticPhysics()" << G4endl;
0178     }
0179     else if (name == "binary" && !bicIsRegistered)
0180     {
0181         hadronPhys.push_back(new G4HadronInelasticQBBC());
0182         bicIsRegistered = true;
0183         G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: "
0184                 << "G4HadronInelasticQBBC()" << G4endl;
0185     }
0186     else if (name == "binary_ion" && !biciIsRegistered)
0187     {
0188         hadronPhys.push_back(new G4IonBinaryCascadePhysics());
0189         biciIsRegistered = true;
0190     }
0191     else
0192     {
0193         G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0194                << " is not defined"
0195                << G4endl;
0196     }
0197 }
0198 
0199 void PhysicsList::AddStepMax()
0200 {
0201   // Step limitation seen as a process
0202     stepMaxProcess = new StepMax();
0203 
0204     auto particleIterator=GetParticleIterator();
0205     particleIterator->reset();
0206     while ((*particleIterator)())
0207     {
0208     G4ParticleDefinition* particle = particleIterator->value();
0209     G4ProcessManager* pmanager = particle->GetProcessManager();
0210 
0211     if (stepMaxProcess->IsApplicable(*particle) && pmanager)
0212     {
0213         pmanager ->AddDiscreteProcess(stepMaxProcess);
0214     }
0215   }
0216 }