LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ConfigurablePhysicsList.icc
Go to the documentation of this file.
1 
2 // Configurable Physics List Class
3 //
4 // Ben Jones, MIT, 24/06/09
5 //
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
8 // file.
9 //
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.
15 //
16 
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"
26 
27 #include "Geant4/G4MuonNuclearProcess.hh"
28 #include "Geant4/G4Material.hh"
29 #include "Geant4/G4MaterialTable.hh"
30 #include "Geant4/G4ios.hh"
31 #include <iomanip>
32 
33 #include "Geant4/G4DataQuestionaire.hh"
34 
35 #include "larsim/LArG4/CustomPhysicsTable.hh"
36 #include "larsim/LArG4/MuNuclearSplittingProcess.h"
37 #include "larsim/LArG4/MuNuclearSplittingProcessXSecBias.h"
38 #include "larsim/Simulation/LArG4Parameters.h"
39 
40 #include "messagefacility/MessageLogger/MessageLogger.h"
41 
42 namespace larg4 {
43 
44  static CustomPhysicsTable * TheCustomPhysicsTable;
45 
46 
47  template<class T> TConfigurablePhysicsList<T>::TConfigurablePhysicsList(G4int ver): T()
48  {
49 
50  mf::LogWarning("ConfigurablePhysics") <<"Setting up Configurable Physics List";
51 
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);
56 
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);
63  }
64  else{
65  mf::LogWarning("ConfigurablePhysics") <<"Custom physics list disabled - using"
66  <<" default QGSP_BERT configuration";
67  EnabledPhysics = GetDefaultSettings();
68  }
69 
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))
74  {
75  mf::LogWarning("ConfigurablePhysics") <<"ConfigurablePhysicsList Registering physics : "
76  << PhysicsName;
77  G4VPhysicsConstructor* g4v = TheCustomPhysicsTable->GetPhysicsConstructor(PhysicsName);
78  if (!PhysicsName.compare("SynchrotronAndGN"))
79  {
80  mf::LogWarning("ConfigurablePhysics") <<"ConfigurablePhysicsList : "
81  << PhysicsName
82  << ": Turning on GammaNuclear, Synchrotron.";
83  G4String on("on");
84  ((G4EmExtraPhysics*)g4v)->GammaNuclear(on);
85  ((G4EmExtraPhysics*)g4v)->Synch(on);
86 
87  // We want MuonNuclear off, since we're gonna activate it
88  // within a Wrapped Process. This would double count these evts.
89  // EC, 23-May-2011!
90  if (!lgp->K0Bias()) {
91  mf::LogWarning("ConfigurablePhysics") <<"ConfigurablePhysicsList : "
92  << PhysicsName
93  << ": Turning on MuNuclear.";
94  ((G4EmExtraPhysics*)g4v)->MuonNuclear(on);
95  }
96  }
97  this->RegisterPhysics(g4v);
98  }
99  else
100  {
101  mf::LogWarning("ConfigurablePhysics") <<"ConfigurablePhysicsList Error : "
102  << "Physics Module Unavailable - " << PhysicsName;
103  }
104  }
105  }
106 
107 
108  template<class T> TConfigurablePhysicsList<T>::~TConfigurablePhysicsList()
109  {
110  }
111 
112  template<class T> void TConfigurablePhysicsList<T>::SetCuts()
113  {
114  if(this->verboseLevel >1) G4cout << "ConfigurablePhysicsList::SetCuts:";
115  this->SetCutsWithDefault();
116 
117  }
118 
119 
120  template <class T> std::vector<std::string> TConfigurablePhysicsList<T>::GetDefaultSettings()
121  {
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");
132  return TheVector;
133  }
134 
135 
136 }
137 
138 // Sept 2009 - Ben Jones, MIT