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  //The singleton's internal structure only changes while
57  // this library is being loaded. All other methods are const.
58 
59  [[cms::thread_safe]] static VertexFitterManager singleton;
60  return singleton;
61 }
62 
63 std::unique_ptr<AbstractConfFitter> VertexFitterManager::get ( const string & s ) const
64 {
65  auto found = theAbstractConfFitters.find(s);
66  if(found == theAbstractConfFitters.end()) {
67  return std::unique_ptr<AbstractConfFitter>{};
68  }
69  return std::unique_ptr<AbstractConfFitter>{found->second()};
70 }
71 
72 std::vector<std::string> VertexFitterManager::getNames() const
73 {
74  std::vector<std::string> ret;
75  ret.reserve(theAbstractConfFitters.size());
76 
77  for(const auto& i : theAbstractConfFitters) {
78  ret.push_back(i.first);
79  }
80  return ret;
81 }
82 
84 {}
tuple t
Definition: tree.py:139
int i
Definition: DBlmapReader.cc:9
static VertexRecoManager & Instance()
tuple d
Definition: ztail.py:151
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