CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EGammaMvaEleEstimatorFWLite.cc
Go to the documentation of this file.
1 
6 
7 namespace heppy {
8 
10  estimator_(0),
11  estimatorCSA14_(0)
12 {
13 }
14 
16 {
17  delete estimator_;
18  delete estimatorCSA14_;
19 }
20 
22  MVAType type,
23  bool useBinnedVersion,
24  std::vector<std::string> weightsfiles )
25 {
26  delete estimator_; estimator_ = 0;
27  delete estimatorCSA14_; estimatorCSA14_ = 0;
28  std::vector<std::string> weightspaths;
29  for (const std::string &s : weightsfiles) {
30  weightspaths.push_back( edm::FileInPath(s).fullPath() );
31  }
32  switch(type) {
35  estimator_->initialize(methodName, EGammaMvaEleEstimator::kTrig, useBinnedVersion, weightspaths);
36  break;
39  estimator_->initialize(methodName, EGammaMvaEleEstimator::kTrigNoIP, useBinnedVersion, weightspaths);
40  break;
43  estimator_->initialize(methodName, EGammaMvaEleEstimator::kNonTrig, useBinnedVersion, weightspaths);
44  break;
47  estimatorCSA14_->initialize(methodName, EGammaMvaEleEstimatorCSA14::kTrig, useBinnedVersion, weightspaths);
48  break;
51  estimatorCSA14_->initialize(methodName, EGammaMvaEleEstimatorCSA14::kNonTrig, useBinnedVersion, weightspaths);
52  break;
55  estimatorCSA14_->initialize(methodName, EGammaMvaEleEstimatorCSA14::kNonTrigPhys14, useBinnedVersion, weightspaths);
56  break;
57  default:
58  return;
59  }
60 }
61 
63  const reco::Vertex& vertex,
64  double rho,
65  bool full5x5,
66  bool printDebug)
67 {
68  if (estimator_) return estimator_->mvaValue(ele,vertex,rho,full5x5,printDebug);
69  else if (estimatorCSA14_) return estimatorCSA14_->mvaValue(ele,printDebug);
70  else throw cms::Exception("LogicError", "You must call unitialize before mvaValue\n");
71 }
72 
73 }
void initialize(std::string methodName, std::string weightsfile, EGammaMvaEleEstimatorCSA14::MVAType type)
type
Definition: HCALResponse.h:21
float mvaValue(const pat::Electron &ele, const reco::Vertex &vertex, double rho, bool full5x5, bool printDebug=false)
Double_t mvaValue(const reco::GsfElectron &ele, const reco::Vertex &vertex, const TransientTrackBuilder &transientTrackBuilder, noZS::EcalClusterLazyTools myEcalCluster, bool printDebug=kFALSE)
void initialize(std::string methodName, MVAType type, bool useBinnedVersion, std::vector< std::string > weightsfiles)
void initialize(std::string methodName, std::string weightsfile, EGammaMvaEleEstimator::MVAType type)
EGammaMvaEleEstimatorCSA14 * estimatorCSA14_
Double_t mvaValue(const reco::GsfElectron &ele, const reco::Vertex &vertex, const TransientTrackBuilder &transientTrackBuilder, EcalClusterLazyTools myEcalCluster, bool printDebug=kFALSE)
Analysis-level electron class.
Definition: Electron.h:52