2 // Configurable Physics List Class
4 // Ben Jones, MIT, 24/06/09
6 // Based on the QGSP_BERT physics list supplied with geant 4, but with
7 // options to switch on and off different physics processed from the config
10 // To include a new physics process, create a new physics builder registering
11 // the relevant particles and interactions. Then add the builder to the
12 // GetPhysicsBuilders and GetDefaultSettings functions in this class,
13 // using the name by which the builder will be referenced in the config
14 // file. Physics builders to be enabled are specified in the LArG4 config.
17 #include "Geant4/globals.hh"
18 #include "Geant4/G4ParticleDefinition.hh"
19 #include "Geant4/G4ParticleWithCuts.hh"
20 #include "Geant4/G4ProcessManager.hh"
21 #include "Geant4/G4ProcessVector.hh"
22 #include "Geant4/G4ParticleTypes.hh"
23 #include "Geant4/G4ParticleTable.hh"
24 #include "Geant4/G4EmExtraPhysics.hh"
25 #include "Geant4/G4ChargeExchangePhysics.hh"
27 #include "Geant4/G4MuonNuclearProcess.hh"
28 #include "Geant4/G4Material.hh"
29 #include "Geant4/G4MaterialTable.hh"
30 #include "Geant4/G4ios.hh"
33 #include "Geant4/G4DataQuestionaire.hh"
35 #include "larsim/LArG4/CustomPhysicsTable.hh"
36 #include "larsim/LArG4/MuNuclearSplittingProcess.h"
37 #include "larsim/LArG4/MuNuclearSplittingProcessXSecBias.h"
38 #include "larsim/Simulation/LArG4Parameters.h"
40 #include "messagefacility/MessageLogger/MessageLogger.h"
44 static CustomPhysicsTable * TheCustomPhysicsTable;
47 template<class T> TConfigurablePhysicsList<T>::TConfigurablePhysicsList(G4int ver): T()
50 mf::LogWarning("ConfigurablePhysics") <<"Setting up Configurable Physics List";
52 // note - not sure exact purpose of these commands, but left in from QGSP_BERT list
53 this->defaultCutValue = 0.7*CLHEP::mm;
54 this->SetVerboseLevel(ver);
55 G4DataQuestionaire it(photon);
57 art::ServiceHandle<sim::LArG4Parameters> lgp;
58 if(lgp->UseCustomPhysics()){
59 mf::LogWarning("ConfigurablePhysics") <<"Custom physics list enabled. Loading from config";
60 EnabledPhysics = lgp->EnabledPhysics();
61 for(std::vector<std::string>::const_iterator it=EnabledPhysics.begin(); it!=EnabledPhysics.end(); it++)
62 mf::LogWarning("ConfigurablePhysics")<<"Configurable Physics List enabling : "<< (*it);
65 mf::LogWarning("ConfigurablePhysics") <<"Custom physics list disabled - using"
66 <<" default QGSP_BERT configuration";
67 EnabledPhysics = GetDefaultSettings();
70 // loop through vector of enabled physics and switch on relevant processes
71 for(std::vector<std::string>::const_iterator it = EnabledPhysics.begin(); it!=EnabledPhysics.end(); it++){
72 std::string PhysicsName=(*it);
73 if(TheCustomPhysicsTable->IsPhysicsAvailable(PhysicsName))
75 mf::LogWarning("ConfigurablePhysics") <<"ConfigurablePhysicsList Registering physics : "
77 G4VPhysicsConstructor* g4v = TheCustomPhysicsTable->GetPhysicsConstructor(PhysicsName);
78 if (!PhysicsName.compare("SynchrotronAndGN"))
80 mf::LogWarning("ConfigurablePhysics") <<"ConfigurablePhysicsList : "
82 << ": Turning on GammaNuclear, Synchrotron.";
84 ((G4EmExtraPhysics*)g4v)->GammaNuclear(on);
85 ((G4EmExtraPhysics*)g4v)->Synch(on);
87 // We want MuonNuclear off, since we're gonna activate it
88 // within a Wrapped Process. This would double count these evts.
91 mf::LogWarning("ConfigurablePhysics") <<"ConfigurablePhysicsList : "
93 << ": Turning on MuNuclear.";
94 ((G4EmExtraPhysics*)g4v)->MuonNuclear(on);
97 this->RegisterPhysics(g4v);
101 mf::LogWarning("ConfigurablePhysics") <<"ConfigurablePhysicsList Error : "
102 << "Physics Module Unavailable - " << PhysicsName;
108 template<class T> TConfigurablePhysicsList<T>::~TConfigurablePhysicsList()
112 template<class T> void TConfigurablePhysicsList<T>::SetCuts()
114 if(this->verboseLevel >1) G4cout << "ConfigurablePhysicsList::SetCuts:";
115 this->SetCutsWithDefault();
120 template <class T> std::vector<std::string> TConfigurablePhysicsList<T>::GetDefaultSettings()
122 // Set default enabled physics processes (equivalent to QGSP_BERT physics list)
123 std::vector<std::string> TheVector;
124 TheVector.push_back("Em");
125 TheVector.push_back("SynchrotronAndGN");
126 TheVector.push_back("Decay");
127 TheVector.push_back("Hadron");
128 TheVector.push_back("HadronElastic");
129 TheVector.push_back("Stopping");
130 TheVector.push_back("Ion");
131 TheVector.push_back("NeutronTrackingCut");
138 // Sept 2009 - Ben Jones, MIT