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, const char *calib);
35 
36  template <class T>
37  bool update(const edm::EventSetup &es) {
39  es.get<T>().get(handle);
40  return update(handle.product());
41  }
42 
43  template <class T>
44  bool update(const edm::EventSetup &es, const char *calib) {
46  es.get<T>().get(handle);
47  return update(handle.product(), calib);
48  }
49 
50  template <class T>
51  bool update(const char *label, const edm::EventSetup &es) {
53  es.get<T>().get(label, handle);
54  return update(handle.product());
55  }
56 
57  template <class T>
58  bool update(const char *label, const edm::EventSetup &es, const char *calib) {
60  es.get<T>().get(label, handle);
61  return update(handle.product(), calib);
62  }
63 
64  operator bool() const { return computer.get(); }
65 
66  MVAComputer &operator*() { return *computer; }
67  const MVAComputer &operator*() const { return *computer; }
68 
69  MVAComputer *operator->() { return computer.get(); }
70  const MVAComputer *operator->() const { return computer.get(); }
71 
72  MVAComputer *get() { return computer.get(); }
73  const MVAComputer *get() const { return computer.get(); }
74 
75  std::unique_ptr<MVAComputer> release();
76 
77  void reset() { computer.reset(); }
78 
79  private:
82  std::unique_ptr<MVAComputer> computer;
83  };
84 
85 } // namespace PhysicsTools
86 
87 #endif // PhysicsTools_MVAComputer_MVAComputerCache_h
const MVAComputer & operator*() const
Calibration::MVAComputer::CacheId computerCacheId
const MVAComputer * operator->() const
Calibration::MVAComputerContainer::CacheId containerCacheId
std::unique_ptr< MVAComputer > release()
char const * label
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:73
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