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 
5 
8 
10 
12 
13  public:
14  // Constructor, destructor
16  : tag_ (conf.getParameter<std::string>("mvaTag"))
17  , nCategories_ (conf.getParameter<int>("nCategories"))
18  , debug_ (conf.getUntrackedParameter<bool>("debug", false))
19  {}
20 
23  int nCategories,
24  bool debug)
25  : name_ (mvaName)
26  , tag_ (mvaTag)
27  , nCategories_ (nCategories)
28  , debug_ (debug)
29  {}
31 
32  // Functions that must be provided in derived classes
33  // These function should work on electrons or photons
34  // of the reco or pat type
35 
36  virtual float mvaValue( const reco::Candidate* candidate, std::vector<float> const& auxVariables, int &iCategory) const = 0;
37  float mvaValue( const reco::Candidate* candidate, std::vector<float> const& auxVariables) const {
38  int iCategory;
39  return mvaValue(candidate, auxVariables, iCategory);
40  };
41 
42  // A specific implementation of MVA is expected to have one or more categories
43  // defined with respect to eta, pt, etc.
44  // This function determines the category for a given candidate.
45  virtual int findCategory( const reco::Candidate* candidate) const = 0;
46  int getNCategories() const { return nCategories_; }
47  const std::string& getName() const { return name_; }
48  // An extra variable string set during construction that can be used
49  // to distinguish different instances of the estimator configured with
50  // different weight files. The tag can be used to construct names of ValueMaps, etc.
51  const std::string& getTag() const { return tag_; }
52 
53  bool isDebug() const { return debug_; }
54  //
55  // Extra event content - if needed.
56  //
57  // Some MVA implementation may require direct access to event content.
58  // Implement these methods only if needed in the derived classes (use "override"
59  // for certainty).
60 
61  private:
62 
63  //
64  // Data members
65  //
67 
68  // MVA tag. This is an additional string variable to distinguish
69  // instances of the estimator of this class configured with different
70  // weight files.
72 
73  // The number of categories and number of variables per category
74  const int nCategories_;
75 
76  const bool debug_;
77 };
78 
79 // define the factory for this base class
83 
84 #endif
AnyMVAEstimatorRun2Base(const edm::ParameterSet &conf)
virtual float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables, int &iCategory) const =0
float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables) const
const std::string & getName() const
const std::string & getTag() const
virtual int findCategory(const reco::Candidate *candidate) const =0
AnyMVAEstimatorRun2Base(const ::std::string &mvaName, const ::std::string &mvaTag, int nCategories, bool debug)
#define debug
Definition: HDRShower.cc:19
edmplugin::PluginFactory< AnyMVAEstimatorRun2Base *(const edm::ParameterSet &) > AnyMVAEstimatorRun2Factory