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 
8 
10 
12 
13  public:
14  // Constructor, destructor
17 
18  // Functions that must be provided in derived classes
19  // These function should work on electrons or photons
20  // of the reco or pat type
21 
22  virtual float mvaValue( const edm::Ptr<reco::Candidate>& particle, const edm::Event&) const = 0;
23 
24  // A specific implementation of MVA is expected to have data members
25  // that will contain particle's quantities on which the MVA operates.
26  // This function fill their value for a given particle.
27  virtual std::vector<float> fillMVAVariables(const edm::Ptr<reco::Candidate>& particle, const edm::Event&) const = 0;
28  // A specific implementation of MVA is expected to have one or more categories
29  // defined with respect to eta, pt, etc.
30  // This function determines the category for a given particle.
31  virtual int findCategory( const edm::Ptr<reco::Candidate>& particle) const = 0;
32  virtual int getNCategories() const = 0;
33  // The name is a unique name associated with a particular MVA implementation,
34  // it is found as a const data member in a derived class.
35  virtual const std::string& getName() const = 0;
36  // An extra variable string set during construction that can be used
37  // to distinguish different instances of the estimator configured with
38  // different weight files. The tag can be used to construct names of ValueMaps, etc.
39  virtual const std::string& getTag() const = 0;
40 
41  // fills a vector of floats in the order that arguments are provided
42  template<typename... Args>
43  std::vector<float> packMVAVariables(const Args... args) const {
44  return std::vector<float>({ args... });
45  }
46 
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  // DEPRECATED
55  // This method needs to be used only once after this MVA estimator is constructed
56  virtual void setConsumes(edm::ConsumesCollector &&cc) const {};
57  // This method needs to be called for each event
58  virtual void getEventContent(const edm::Event& iEvent) const final {};
59 
60  //
61  // Data members
62  //
63  // Configuration
65 
66 };
67 
68 // define the factory for this base class
72 
73 #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
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