CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EGammaMvaEleEstimatorFWLite.cc
Go to the documentation of this file.
1 
6 
7 namespace heppy {
8 
9  EGammaMvaEleEstimatorFWLite::EGammaMvaEleEstimatorFWLite() : estimator_(nullptr), estimatorCSA14_(nullptr) {}
10 
12  delete estimator_;
13  delete estimatorCSA14_;
14  }
15 
17  MVAType type,
18  bool useBinnedVersion,
19  std::vector<std::string> weightsfiles) {
20  delete estimator_;
21  estimator_ = nullptr;
22  delete estimatorCSA14_;
23  estimatorCSA14_ = nullptr;
24  std::vector<std::string> weightspaths;
25  weightspaths.reserve(weightsfiles.size());
26  for (const std::string& s : weightsfiles) {
27  weightspaths.push_back(edm::FileInPath(s).fullPath());
28  }
29  switch (type) {
32  estimator_->initialize(methodName, EGammaMvaEleEstimator::kTrig, useBinnedVersion, weightspaths);
33  break;
36  estimator_->initialize(methodName, EGammaMvaEleEstimator::kTrigNoIP, useBinnedVersion, weightspaths);
37  break;
40  estimator_->initialize(methodName, EGammaMvaEleEstimator::kNonTrig, useBinnedVersion, weightspaths);
41  break;
44  estimatorCSA14_->initialize(methodName, EGammaMvaEleEstimatorCSA14::kTrig, useBinnedVersion, weightspaths);
45  break;
48  estimatorCSA14_->initialize(methodName, EGammaMvaEleEstimatorCSA14::kNonTrig, useBinnedVersion, weightspaths);
49  break;
53  methodName, EGammaMvaEleEstimatorCSA14::kNonTrigPhys14, useBinnedVersion, weightspaths);
54  break;
55  default:
56  return;
57  }
58  }
59 
61  const pat::Electron& ele, const reco::Vertex& vertex, double rho, bool full5x5, bool printDebug) {
62  if (estimator_)
63  return estimator_->mvaValue(ele, vertex, rho, full5x5, printDebug);
64  else if (estimatorCSA14_)
65  return estimatorCSA14_->mvaValue(ele, printDebug);
66  else
67  throw cms::Exception("LogicError", "You must call unitialize before mvaValue\n");
68  }
69 
70 } // namespace heppy
void initialize(std::string methodName, std::string weightsfile, EGammaMvaEleEstimatorCSA14::MVAType type)
Double_t mvaValue(const reco::GsfElectron &ele, const reco::Vertex &vertex, const TransientTrackBuilder &transientTrackBuilder, EcalClusterLazyTools const &myEcalCluster, bool printDebug=kFALSE)
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_
Analysis-level electron class.
Definition: Electron.h:51