CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AnyMVAEstimatorRun2Base.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_EgammaTools_AnyMVAEstimatorRun2Base_H
2 #define RecoEgamma_EgammaTools_AnyMVAEstimatorRun2Base_H
3 
5 
9 
11 
13 
14  public:
15  // Constructor, destructor
18 
19  // Functions that must be provided in derived classes
20  // These function should work on electrons or photons
21  // of the reco or pat type
22 
23  virtual float mvaValue( const edm::Ptr<reco::Candidate>& particle, const edm::Event&) const = 0;
24 
25  // A specific implementation of MVA is expected to have data members
26  // that will contain particle's quantities on which the MVA operates.
27  // This function fill their value for a given particle.
28  virtual std::vector<float> fillMVAVariables(const edm::Ptr<reco::Candidate>& particle, const edm::Event&) const = 0;
29  // A specific implementation of MVA is expected to have one or more categories
30  // defined with respect to eta, pt, etc.
31  // This function determines the category for a given particle.
32  virtual int findCategory( const edm::Ptr<reco::Candidate>& particle) const = 0;
33  virtual int getNCategories() const = 0;
34  // The name is a unique name associated with a particular MVA implementation,
35  // it is found as a const data member in a derived class.
36  virtual const std::string& getName() const = 0;
37  // An extra variable string set during construction that can be used
38  // to distinguish different instances of the estimator configured with
39  // different weight files. The tag can be used to construct names of ValueMaps, etc.
40  virtual const std::string& getTag() const = 0;
41 
42  // fills a vector of floats in the order that arguments are provided
43  template<typename... Args>
44  std::vector<float> packMVAVariables(const Args... args) const {
45  return std::vector<float>({ args... });
46  }
47 
48  //
49  // Extra event content - if needed.
50  //
51  // Some MVA implementation may require direct access to event content.
52  // Implement these methods only if needed in the derived classes (use "override"
53  // for certainty).
54 
55  // DEPRECATED
56  // This method needs to be used only once after this MVA estimator is constructed
57  virtual void setConsumes(edm::ConsumesCollector &&cc) const {};
58  // This method needs to be called for each event
59  virtual void getEventContent(const edm::Event& iEvent) const final {};
60 
61  //
62  // Data members
63  //
64  // Configuration
66 
67 };
68 
69 // define the factory for this base class
73 
74 #endif
const edm::ParameterSet _conf
AnyMVAEstimatorRun2Base(const edm::ParameterSet &conf)
virtual void setConsumes(edm::ConsumesCollector &&cc) const
virtual std::vector< float > fillMVAVariables(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const =0
virtual const std::string & getName() const =0
std::vector< float > packMVAVariables(const Args...args) const
int iEvent
Definition: GenABIO.cc:230
tuple conf
Definition: dbtoconf.py:185
virtual int getNCategories() const =0
virtual float mvaValue(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const =0
virtual const std::string & getTag() const =0
virtual void getEventContent(const edm::Event &iEvent) const final
edmplugin::PluginFactory< AnyMVAEstimatorRun2Base *(const edm::ParameterSet &) > AnyMVAEstimatorRun2Factory
virtual int findCategory(const edm::Ptr< reco::Candidate > &particle) const =0