LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
CustomPhysicsTable.cxx
Go to the documentation of this file.
1 //
6 // See header file for full description
7 
9 
12 
13 #include "Geant4/G4VPhysicsConstructor.hh"
14 
15 namespace larg4 {
16 
18 
19  //-----------------------------------------------------------------
21  {
22  if(!TheCustomPhysicsTable){
23  TheCustomPhysicsTable = new CustomPhysicsTable;
24  TheCustomPhysicsTable->AddPhysics(Factory);
25  }
26  else{
27  TheCustomPhysicsTable->AddPhysics(Factory);
28  }
29  }
30 
31  //-----------------------------------------------------------------
33  {
34  std::vector<std::string> ReturnVector;
35  for(std::map<std::string,CustomPhysicsFactoryBase* >::const_iterator i = TheCustomPhysicsTable->theTable.begin(); i!=TheCustomPhysicsTable->theTable.end(); i++){
36  ReturnVector.push_back((*i).first);
37  }
38  return ReturnVector;
39  }
40 
41  //-----------------------------------------------------------------
42  bool CustomPhysicsTable::IsPhysicsAvailable(std::string PhysicsName)
43  {
44  if(!TheCustomPhysicsTable->theTable[PhysicsName])
45  return false;
46  else
47  return true;
48  }
49 
50  //-----------------------------------------------------------------
51  G4VPhysicsConstructor * CustomPhysicsTable::GetPhysicsConstructor(std::string PhysicsName)
52  {
53  if(IsPhysicsAvailable(PhysicsName)){
54  G4VPhysicsConstructor * G4VPC = TheCustomPhysicsTable->theTable[PhysicsName]->Build();
55  return G4VPC;
56  }
57  else{
58  G4VPhysicsConstructor * G4VPC=0;
59  return G4VPC;
60  }
61 
62  }
63 
64  //-----------------------------------------------------------------
66  {
67 
68  if(IsPhysicsAvailable(Factory->GetName()))
69  mf::LogWarning("CustomPhysicsTable") << "Physics constructor being overwritten"
70  << " in CustomPhysicsTable";
71  TheCustomPhysicsTable->theTable[Factory->GetName()]=Factory;
72  LOG_DEBUG("CustomPhysicsTable")<<"CustomPhysicsTable : Physics Table registering new physics "
73  << Factory->GetName();
74  }
75 
76 }
77 
78 
79 //Ben Jones, MIT, Sept 2009
Geant4 interface.
G4VPhysicsConstructor * GetPhysicsConstructor(std::string)
bool IsPhysicsAvailable(std::string)
std::map< std::string, CustomPhysicsFactoryBase * > theTable
intermediate_table::const_iterator const_iterator
virtual std::string GetName()=0
std::vector< std::string > GetAvailablePhysicsList()
void AddPhysics(CustomPhysicsFactoryBase *)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define LOG_DEBUG(id)
static CustomPhysicsTable * TheCustomPhysicsTable