LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CustomPhysicsTable.cxx
Go to the documentation of this file.
1 //
6 // See header file for full description
7 
9 
12 
13 namespace larg4 {
14 
16 
17  //-----------------------------------------------------------------
19  {
20  if (!TheCustomPhysicsTable) {
23  }
24  else {
26  }
27  }
28 
29  //-----------------------------------------------------------------
31  {
32  std::vector<std::string> ReturnVector;
35  i != TheCustomPhysicsTable->theTable.end();
36  i++) {
37  ReturnVector.push_back((*i).first);
38  }
39  return ReturnVector;
40  }
41 
42  //-----------------------------------------------------------------
43  bool CustomPhysicsTable::IsPhysicsAvailable(std::string const& PhysicsName)
44  {
45  if (!TheCustomPhysicsTable->theTable[PhysicsName])
46  return false;
47  else
48  return true;
49  }
50 
51  //-----------------------------------------------------------------
52  G4VPhysicsConstructor* CustomPhysicsTable::GetPhysicsConstructor(std::string const& PhysicsName)
53  {
54  if (IsPhysicsAvailable(PhysicsName)) {
55  return TheCustomPhysicsTable->theTable[PhysicsName]->Build();
56  }
57 
58  return nullptr;
59  }
60 
61  //-----------------------------------------------------------------
63  {
64 
65  if (IsPhysicsAvailable(Factory->GetName()))
66  mf::LogWarning("CustomPhysicsTable") << "Physics constructor being overwritten"
67  << " in CustomPhysicsTable";
68  TheCustomPhysicsTable->theTable[Factory->GetName()] = Factory;
69  MF_LOG_DEBUG("CustomPhysicsTable")
70  << "CustomPhysicsTable : Physics Table registering new physics " << Factory->GetName();
71  }
72 
73 }
Geant4 interface.
intermediate_table::const_iterator const_iterator
G4VPhysicsConstructor * GetPhysicsConstructor(std::string const &physicsName)
std::vector< std::string > GetAvailablePhysicsList()
void AddPhysics(CustomPhysicsFactoryBase *)
std::map< std::string, CustomPhysicsFactoryBase * > theTable
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define MF_LOG_DEBUG(id)
CustomPhysicsTable * TheCustomPhysicsTable
bool IsPhysicsAvailable(std::string const &)
std::string const & GetName() const noexcept