CMS 3D CMS Logo

VertexFitterManager.cc
Go to the documentation of this file.
5 
6 using namespace std;
7 
9  const string & name, std::function<AbstractConfFitter*()> o, const string & d )
10 {
11  theAbstractConfFitters[name]=o;
12  theDescription[name]=d;
13 
14  // every fitter registers as a reconstructor, also
16  //ReconstructorFromFitter clones the object passed
17  std::unique_ptr<AbstractConfFitter> t{o()};
18  return new ReconstructorFromFitter ( std::move(t) );},
19  d);
20 }
21 
23 {
24 }
25 
27 {
28  auto found = theDescription.find(d);
29  if(found == theDescription.end()) {
30  return std::string{};
31  }
32  return found->first;
33 }
34 
36 {
37  return new VertexFitterManager ( * this );
38 }
39 
41 {
42  std::cout << "[VertexFitterManager] copy constructor! Error!" << std::endl;
43  exit(0);
44  /*
45  for ( map < string, AbstractConfFitter * >::const_iterator i=o.theAbstractConfFitters.begin();
46  i!=o.theAbstractConfFitters.end() ; ++i )
47  {
48  theAbstractConfFitters[ i->first ] = i->second->clone();
49  }
50 
51  theIsEnabled=o.theIsEnabled;
52  */
53 }
54 
56 {
57  //The singleton's internal structure only changes while
58  // this library is being loaded. All other methods are const.
59 
61  return singleton;
62 }
63 
64 std::unique_ptr<AbstractConfFitter> VertexFitterManager::get ( const string & s ) const
65 {
66  auto found = theAbstractConfFitters.find(s);
67  if(found == theAbstractConfFitters.end()) {
68  return std::unique_ptr<AbstractConfFitter>{};
69  }
70  return std::unique_ptr<AbstractConfFitter>{found->second()};
71 }
72 
73 std::vector<std::string> VertexFitterManager::getNames() const
74 {
75  std::vector<std::string> ret;
76  ret.reserve(theAbstractConfFitters.size());
77 
78  for(const auto& i : theAbstractConfFitters) {
79  ret.push_back(i.first);
80  }
81  return ret;
82 }
83 
85 {}
static VertexRecoManager & Instance()
#define CMS_THREAD_SAFE
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
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
def move(src, dest)
Definition: eostools.py:510