CMS 3D CMS Logo

LowPtGsfElectronSeedHeavyObjectCache.cc
Go to the documentation of this file.
11 
12 #include <string>
13 
14 namespace lowptgsfeleseed {
15 
17  //
19  for (auto& name : conf.getParameter<std::vector<std::string> >("ModelNames")) {
20  names_.push_back(name);
21  }
22  for (auto& weights : conf.getParameter<std::vector<std::string> >("ModelWeights")) {
24  }
25  for (auto& thresh : conf.getParameter<std::vector<double> >("ModelThresholds")) {
26  thresholds_.push_back(thresh);
27  }
28  if (names_.size() != models_.size()) {
29  throw cms::Exception("Incorrect configuration")
30  << "'ModelNames' size (" << names_.size() << ") != 'ModelWeights' size (" << models_.size() << ").\n";
31  }
32  if (models_.size() != thresholds_.size()) {
33  throw cms::Exception("Incorrect configuration")
34  << "'ModelWeights' size (" << models_.size() << ") != 'ModelThresholds' size (" << thresholds_.size()
35  << ").\n";
36  }
37  }
38 
40  //
44  double rho,
45  const reco::BeamSpot& spot,
46  noZS::EcalClusterLazyTools& ecalTools) const {
47  std::vector<std::string>::const_iterator iter = std::find(names_.begin(), names_.end(), name);
48  if (iter != names_.end()) {
49  int index = std::distance(names_.begin(), iter);
50  std::vector<float> inputs = features(ecal, hcal, rho, spot, ecalTools);
51  float output = models_.at(index)->GetResponse(inputs.data());
52  bool pass = output > thresholds_.at(index);
53  ecal.setMVA(pass, output, index);
54  return pass;
55  } else {
56  throw cms::Exception("Unknown model name")
57  << "'Name given: '" << name << "'. Check against configuration file.\n";
58  }
59  }
60 
61 } // namespace lowptgsfeleseed
LowPtGsfElectronSeedHeavyObjectCache.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
hcal
Definition: ConfigurationDatabase.cc:13
GBRForestTools.h
createGBRForest
std::unique_ptr< const GBRForest > createGBRForest(const std::string &weightsFile)
Definition: GBRForestTools.cc:244
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
reco::PreId
Definition: PreId.h:13
FileInPath.h
PreId.h
edm::FileInPath
Definition: FileInPath.h:64
Track.h
TrackFwd.h
BeamSpot.h
LowPtGsfElectronFeatures.h
lowptgsfeleseed::HeavyObjectCache::names_
std::vector< std::string > names_
Definition: LowPtGsfElectronSeedHeavyObjectCache.h:30
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:95855
reco::BeamSpot
Definition: BeamSpot.h:21
PFCluster.h
lowptgsfeleseed::HeavyObjectCache::eval
bool eval(const std::string &name, reco::PreId &ecal, reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools) const
Definition: LowPtGsfElectronSeedHeavyObjectCache.cc:41
lowptgsfeleseed::features
std::vector< float > features(const reco::PreId &ecal, const reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools)
Definition: LowPtGsfElectronFeatures.cc:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalClusterLazyToolsT
Definition: EcalClusterLazyTools.h:135
edm::ParameterSet
Definition: ParameterSet.h:47
PFClusterFwd.h
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
lowptgsfeleseed::HeavyObjectCache::models_
std::vector< std::unique_ptr< const GBRForest > > models_
Definition: LowPtGsfElectronSeedHeavyObjectCache.h:31
lowptgsfeleseed::HeavyObjectCache::HeavyObjectCache
HeavyObjectCache(const edm::ParameterSet &)
Definition: LowPtGsfElectronSeedHeavyObjectCache.cc:18
GOODCOLL_filter_cfg.thresh
thresh
Definition: GOODCOLL_filter_cfg.py:74
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bsc_activity_cfg.ecal
ecal
Definition: bsc_activity_cfg.py:25
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
lowptgsfeleseed
Definition: LowPtGsfElectronFeatures.h:14
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7796
lowptgsfeleseed::HeavyObjectCache::thresholds_
std::vector< double > thresholds_
Definition: LowPtGsfElectronSeedHeavyObjectCache.h:32