CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VertexFitterManager.cc
Go to the documentation of this file.
4 
5 using namespace std;
6 
8  const string & name, std::function<AbstractConfFitter*()> o, const string & d )
9 {
10  theAbstractConfFitters[name]=o;
11  theDescription[name]=d;
12 
13  // every fitter registers as a reconstructor, also
15  //ReconstructorFromFitter clones the object passed
16  std::unique_ptr<AbstractConfFitter> t{o()};
17  return new ReconstructorFromFitter ( std::move(t) );},
18  d);
19 }
20 
22 {
23 }
24 
26 {
27  auto found = theDescription.find(d);
28  if(found == theDescription.end()) {
29  return std::string{};
30  }
31  return found->first;
32 }
33 
35 {
36  return new VertexFitterManager ( * this );
37 }
38 
40 {
41  std::cout << "[VertexFitterManager] copy constructor! Error!" << std::endl;
42  exit(0);
43  /*
44  for ( map < string, AbstractConfFitter * >::const_iterator i=o.theAbstractConfFitters.begin();
45  i!=o.theAbstractConfFitters.end() ; ++i )
46  {
47  theAbstractConfFitters[ i->first ] = i->second->clone();
48  }
49 
50  theIsEnabled=o.theIsEnabled;
51  */
52 }
53 
55 {
56  static VertexFitterManager singleton;
57  return singleton;
58 }
59 
60 std::unique_ptr<AbstractConfFitter> VertexFitterManager::get ( const string & s ) const
61 {
62  auto found = theAbstractConfFitters.find(s);
63  if(found == theAbstractConfFitters.end()) {
64  return std::unique_ptr<AbstractConfFitter>{};
65  }
66  return std::unique_ptr<AbstractConfFitter>{found->second()};
67 }
68 
69 std::vector<std::string> VertexFitterManager::getNames() const
70 {
71  std::vector<std::string> ret;
72  ret.reserve(theAbstractConfFitters.size());
73 
74  for(const auto& i : theAbstractConfFitters) {
75  ret.push_back(i.first);
76  }
77  return ret;
78 }
79 
81 {}
int i
Definition: DBlmapReader.cc:9
static VertexRecoManager & Instance()
helper::RootFunctionHelper< F, args >::root_function function(F &f)
Definition: rootFunction.h:14
void registerFitter(const std::string &name, std::function< AbstractConfFitter *()> o, const std::string &description)
VertexFitterManager * clone() const
std::unique_ptr< AbstractConfFitter > get(const std::string &) const
tuple cout
Definition: gather_cfg.py:121
std::vector< std::string > getNames() const
void registerReconstructor(const std::string &name, std::function< AbstractConfReconstructor *()> o, const std::string &description)
static VertexFitterManager & Instance()
std::string describe(const std::string &) const