CMS 3D CMS Logo

AnyMVAEstimatorRun2Base.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_EgammaTools_AnyMVAEstimatorRun2Base_H
2 #define RecoEgamma_EgammaTools_AnyMVAEstimatorRun2Base_H
3 
4 // Note on Python/FWLite support: please forward declare as much as possible in
5 // this header, because there are usecases of generating the dictionaries for
6 // this class on the fly (see notes in ElectronMVAEstimatorRun2.h for more
7 // details).
8 
9 #include <string>
10 #include <vector>
11 
12 namespace edm {
13  class ParameterSet;
14 } // namespace edm
15 
16 namespace reco {
17  class Candidate;
18 } // namespace reco
19 
21 public:
22  // Constructor, destructor
24 
28 
29  // Functions that must be provided in derived classes
30  // These function should work on electrons or photons
31  // of the reco or pat type
32 
33  virtual float mvaValue(const reco::Candidate* candidate,
34  std::vector<float> const& auxVariables,
35  int& iCategory) const = 0;
36  float mvaValue(const reco::Candidate* candidate, std::vector<float> const& auxVariables) const {
37  int iCategory;
38  return mvaValue(candidate, auxVariables, iCategory);
39  };
40 
41  // A specific implementation of MVA is expected to have one or more categories
42  // defined with respect to eta, pt, etc.
43  // This function determines the category for a given candidate.
44  virtual int findCategory(const reco::Candidate* candidate) const = 0;
45  int getNCategories() const { return nCategories_; }
46  const std::string& getName() const { return name_; }
47  // An extra variable string set during construction that can be used
48  // to distinguish different instances of the estimator configured with
49  // different weight files. The tag can be used to construct names of ValueMaps, etc.
50  const std::string& getTag() const { return tag_; }
51 
52  bool isDebug() const { return debug_; }
53  //
54  // Extra event content - if needed.
55  //
56  // Some MVA implementation may require direct access to event content.
57  // Implement these methods only if needed in the derived classes (use "override"
58  // for certainty).
59 
60 private:
61  //
62  // Data members
63  //
65 
66  // MVA tag. This is an additional string variable to distinguish
67  // instances of the estimator of this class configured with different
68  // weight files.
70 
71  // The number of categories and number of variables per category
72  const int nCategories_;
73 
74  const bool debug_;
75 };
76 
77 #endif
AnyMVAEstimatorRun2Base(const edm::ParameterSet &conf)
float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables) const
AnyMVAEstimatorRun2Base(const ::std::string &mvaName, const ::std::string &mvaTag, int nCategories, bool debug)
virtual int findCategory(const reco::Candidate *candidate) const =0
const std::string & getTag() const
#define debug
Definition: HDRShower.cc:19
fixed size matrix
HLT enums.
virtual float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables, int &iCategory) const =0
const std::string & getName() const