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 
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::nCategories_
const int nCategories_
Definition: AnyMVAEstimatorRun2Base.h:66
AnyMVAEstimatorRun2Base::AnyMVAEstimatorRun2Base
AnyMVAEstimatorRun2Base(const edm::ParameterSet &conf)
Definition: AnyMVAEstimatorRun2Base.h:14
mvaElectronID_Fall17_iso_V1_cff.mvaTag
mvaTag
Definition: mvaElectronID_Fall17_iso_V1_cff.py:16
PluginFactory.h
electrons_cff.bool
bool
Definition: electrons_cff.py:366
funct::false
false
Definition: Factorize.h:29
AnyMVAEstimatorRun2Base
Definition: AnyMVAEstimatorRun2Base.h:11
AnyMVAEstimatorRun2Base::mvaValue
float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables) const
Definition: AnyMVAEstimatorRun2Base.h:30
debug
#define debug
Definition: HDRShower.cc:19
AnyMVAEstimatorRun2Base::~AnyMVAEstimatorRun2Base
virtual ~AnyMVAEstimatorRun2Base()
Definition: AnyMVAEstimatorRun2Base.h:21
AnyMVAEstimatorRun2Base::findCategory
virtual int findCategory(const reco::Candidate *candidate) const =0
taus_updatedMVAIds_cff.mvaName
mvaName
Definition: taus_updatedMVAIds_cff.py:18
AnyMVAEstimatorRun2Base::isDebug
bool isDebug() const
Definition: AnyMVAEstimatorRun2Base.h:46
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edmplugin::PluginFactory
Definition: PluginFactory.h:34
createfilelist.int
int
Definition: createfilelist.py:10
AnyMVAEstimatorRun2Base::getNCategories
int getNCategories() const
Definition: AnyMVAEstimatorRun2Base.h:39
AnyMVAEstimatorRun2Base::AnyMVAEstimatorRun2Base
AnyMVAEstimatorRun2Base(const ::std::string &mvaName, const ::std::string &mvaTag, int nCategories, bool debug)
Definition: AnyMVAEstimatorRun2Base.h:19
AnyMVAEstimatorRun2Base::getTag
const std::string & getTag() const
Definition: AnyMVAEstimatorRun2Base.h:44
AnyMVAEstimatorRun2Base::debug_
const bool debug_
Definition: AnyMVAEstimatorRun2Base.h:68
mvaElectronID_Fall17_iso_V1_cff.nCategories
nCategories
Definition: mvaElectronID_Fall17_iso_V1_cff.py:86
reco::Candidate
Definition: Candidate.h:27
AnyMVAEstimatorRun2Base::tag_
const std::string tag_
Definition: AnyMVAEstimatorRun2Base.h:63
std
Definition: JetResolutionObject.h:76
AnyMVAEstimatorRun2Base::name_
const std::string name_
Definition: AnyMVAEstimatorRun2Base.h:58
AnyMVAEstimatorRun2Base::mvaValue
virtual float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables, int &iCategory) const =0
ConsumesCollector.h
Candidate.h
ParameterSet.h
AnyMVAEstimatorRun2Base::getName
const std::string & getName() const
Definition: AnyMVAEstimatorRun2Base.h:40