CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: MVAComputerCache.h,v 1.1 2008/02/23 16:35:17 saout Exp $
13 //
14 
15 #include <memory>
16 
21 
22 namespace PhysicsTools {
23 
30  public:
33 
35  bool update(const Calibration::MVAComputerContainer *container,
36  const char *calib);
37 
38  template<class T>
39  bool update(const edm::EventSetup &es)
40  {
42  es.get<T>().get(handle);
43  return update(handle.product());
44  }
45 
46  template<class T>
47  bool update(const edm::EventSetup &es, const char *calib)
48  {
50  es.get<T>().get(handle);
51  return update(handle.product(), calib);
52  }
53 
54  template<class T>
55  bool update(const char *label, const edm::EventSetup &es)
56  {
58  es.get<T>().get(label, handle);
59  return update(handle.product());
60  }
61 
62  template<class T>
63  bool update(const char *label, const edm::EventSetup &es,
64  const char *calib)
65  {
67  es.get<T>().get(label, handle);
68  return update(handle.product(), calib);
69  }
70 
71  operator bool() const { return computer.get(); }
72 
74  const MVAComputer &operator * () const { return *computer; }
75 
76  MVAComputer *operator -> () { return computer.get(); }
77  const MVAComputer *operator -> () const { return computer.get(); }
78 
79  MVAComputer *get() { return computer.get(); }
80  const MVAComputer *get() const { return computer.get(); }
81 
82  std::auto_ptr<MVAComputer> release();
83 
84  void reset() { computer.reset(); }
85 
86  private:
89  std::auto_ptr<MVAComputer> computer;
90 };
91 
92 } // namespace PhysicsTools
93 
94 #endif // PhysicsTools_MVAComputer_MVAComputerCache_h
std::auto_ptr< MVAComputer > release()
Calibration::MVAComputer::CacheId computerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
Main interface class to the generic discriminator computer framework.
Definition: MVAComputer.h:40
tuple handle
Definition: patZpeak.py:22
bool update(const char *label, const edm::EventSetup &es, const char *calib)
bool update(const Calibration::MVAComputer *computer)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool update(const edm::EventSetup &es)
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
std::auto_ptr< MVAComputer > computer