CustomPhysicsTable.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file CustomPhysicsTable.cxx
3 //
4 ////////////////////////////////////////////////////////////////////////
5 // See header file for full description
6 
8 
11 
12 #include "Geant4/G4VPhysicsConstructor.hh"
13 
14 namespace gar {
15  namespace garg4 {
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  //-----------------------------------------------------------------
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  MF_LOG_DEBUG("CustomPhysicsTable")<<"CustomPhysicsTable : Physics Table registering new physics "
73  << Factory->GetName();
74  }
75 
76  }
77 
78 } // gar
79 
80 //Ben Jones, MIT, Sept 2009
std::map< std::string, CustomPhysicsFactoryBase * > theTable
std::string string
Definition: nybbler.cc:12
intermediate_table::const_iterator const_iterator
virtual std::string GetName()=0
static CustomPhysicsTable * TheCustomPhysicsTable
General GArSoft Utilities.
void AddPhysics(CustomPhysicsFactoryBase *)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define MF_LOG_DEBUG(id)
G4VPhysicsConstructor * GetPhysicsConstructor(std::string)
std::vector< std::string > GetAvailablePhysicsList()