CMS 3D CMS Logo

MVAComputerCache.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_MVAComputer_MVAComputerCache_h
2 #define PhysicsTools_MVAComputer_MVAComputerCache_h
3 // -*- C++ -*-
4 //
5 // Package: MVAComputerCache
6 // Class : MVAComputerCache
7 //
8 
9 //
10 // Author: Christophe Saout <christophe.saout@cern.ch>
11 // Created: Sat Feb 23 15:38 CEST 2007
12 //
13 
14 #include <memory>
15 
20 
21 namespace PhysicsTools {
22 
29  public:
32 
34  bool update(const Calibration::MVAComputerContainer *container,
35  const char *calib);
36 
37  template<class T>
38  bool update(const edm::EventSetup &es)
39  {
41  es.get<T>().get(handle);
42  return update(handle.product());
43  }
44 
45  template<class T>
46  bool update(const edm::EventSetup &es, const char *calib)
47  {
49  es.get<T>().get(handle);
50  return update(handle.product(), calib);
51  }
52 
53  template<class T>
54  bool update(const char *label, const edm::EventSetup &es)
55  {
57  es.get<T>().get(label, handle);
58  return update(handle.product());
59  }
60 
61  template<class T>
62  bool update(const char *label, const edm::EventSetup &es,
63  const char *calib)
64  {
66  es.get<T>().get(label, handle);
67  return update(handle.product(), calib);
68  }
69 
70  operator bool() const { return computer.get(); }
71 
73  const MVAComputer &operator * () const { return *computer; }
74 
75  MVAComputer *operator -> () { return computer.get(); }
76  const MVAComputer *operator -> () const { return computer.get(); }
77 
78  MVAComputer *get() { return computer.get(); }
79  const MVAComputer *get() const { return computer.get(); }
80 
81  std::unique_ptr<MVAComputer> release();
82 
83  void reset() { computer.reset(); }
84 
85  private:
88  std::unique_ptr<MVAComputer> computer;
89 };
90 
91 } // namespace PhysicsTools
92 
93 #endif // PhysicsTools_MVAComputer_MVAComputerCache_h
Calibration::MVAComputer::CacheId computerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
std::unique_ptr< MVAComputer > release()
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
Main interface class to the generic discriminator computer framework.
Definition: MVAComputer.h:39
bool update(const char *label, const edm::EventSetup &es, const char *calib)
std::unique_ptr< MVAComputer > computer
bool update(const Calibration::MVAComputer *computer)
bool update(const edm::EventSetup &es)
T get() const
Definition: EventSetup.h:62
bool update(const edm::EventSetup &es, const char *calib)
bool update(const char *label, const edm::EventSetup &es)
Creates and and MVAComputer from calibrations via EventSetup.
long double T
T const * product() const
Definition: ESHandle.h:86