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