CMS 3D CMS Logo

ElectronMVAEstimatorRun2.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_ElectronIdentification_ElectronMVAEstimatorRun2_H
2 #define RecoEgamma_ElectronIdentification_ElectronMVAEstimatorRun2_H
3 
9 
13 
14 #include <TMath.h>
15 
17 
18  public:
19 
20  // Constructor and destructor
23  // For use with FWLite/Python
25  const std::string& mvaName,
26  int nCategories,
28  const std::vector<std::string>& categoryCutStrings,
29  const std::vector<std::string> &weightFileNames,
30  bool debug=false );
31 
32  // For use with FWLite/Python
33  static std::vector<float> getExtraVars(double rho)
34  {
35  return std::vector<float>{static_cast<float>(rho)};
36  }
37 
38  // Calculation of the MVA value
39  float mvaValue( const reco::Candidate* candidate, std::vector<float> const& auxVariables, int &iCategory) const override;
40 
41  int findCategory( const reco::Candidate* candidate) const override;
42 
43  private:
44 
45  void init(const std::vector<std::string> &weightFileNames);
46 
47  int findCategory(reco::GsfElectron const& electron) const;
48 
49  std::vector<ThreadSafeStringCut<StringCutObjectSelector<reco::GsfElectron>, reco::GsfElectron>> categoryFunctions_;
50  std::vector<int> nVariables_;
51 
52  // Data members
53  std::vector< std::unique_ptr<const GBRForest> > gbrForests_;
54 
55 
56  // There might be different variables for each category, so the variables
57  // names vector is itself a vector of length nCategories
58  std::vector<std::vector<int>> variables_;
59 
61 
62 };
63 
64 #endif
MVAVariableManager< reco::GsfElectron > mvaVarMngr_
std::vector< ThreadSafeStringCut< StringCutObjectSelector< reco::GsfElectron >, reco::GsfElectron > > categoryFunctions_
float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables, int &iCategory) const override
ElectronMVAEstimatorRun2(const edm::ParameterSet &conf)
void init(const std::vector< std::string > &weightFileNames)
std::vector< std::vector< int > > variables_
std::vector< std::unique_ptr< const GBRForest > > gbrForests_
#define debug
Definition: HDRShower.cc:19
int findCategory(const reco::Candidate *candidate) const override
static std::vector< float > getExtraVars(double rho)