All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
larsim/larsim/EventWeight/Base/WeightCalcFactory.cxx
Go to the documentation of this file.
1 #include "WeightCalcFactory.h"
2 #include "WeightCalcCreator.h"
3 
4 namespace evwgh {
5 
6  WeightCalc* WeightCalcFactory::Create(const std::string& wghcalcname)
7  {
8  std::map<std::string, WeightCalcCreator*>::iterator i;
9  i = GetTable().find(wghcalcname);
10 
11  if (i != GetTable().end())
12  return i->second->Create();
13  else
14  return (WeightCalc*)NULL;
15  }
16 
17  void WeightCalcFactory::Register(const std::string& wghcalcname, WeightCalcCreator* creator)
18  {
19  GetTable()[wghcalcname] = creator;
20  }
21 
22  std::map<std::string, WeightCalcCreator*>& WeightCalcFactory::GetTable()
23  {
24  static std::map<std::string, WeightCalcCreator*> table;
25  return table;
26  }
27 
28 }
static WeightCalc * Create(const std::string &classname)
static std::map< std::string, WeightCalcCreator * > & GetTable()
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
static void Register(const std::string &wghcalcname, WeightCalcCreator *creator)