CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
lowptgsfeleseed::HeavyObjectCache Class Reference

#include <LowPtGsfElectronSeedHeavyObjectCache.h>

Public Member Functions

bool eval (const std::string &name, reco::PreId &ecal, reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools) const
 
 HeavyObjectCache (const edm::ParameterSet &)
 
std::vector< std::string > modelNames () const
 

Private Attributes

std::vector< std::unique_ptr< const GBRForest > > models_
 
std::vector< std::string > names_
 
std::vector< double > thresholds_
 

Detailed Description

Definition at line 16 of file LowPtGsfElectronSeedHeavyObjectCache.h.

Constructor & Destructor Documentation

◆ HeavyObjectCache()

lowptgsfeleseed::HeavyObjectCache::HeavyObjectCache ( const edm::ParameterSet conf)

Definition at line 18 of file LowPtGsfElectronSeedHeavyObjectCache.cc.

18  {
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  }

References createGBRForest(), Exception, edm::ParameterSet::getParameter(), models_, Skims_PA_cff::name, names_, GOODCOLL_filter_cfg::thresh, thresholds_, and HLT_FULL_cff::weights.

Member Function Documentation

◆ eval()

bool lowptgsfeleseed::HeavyObjectCache::eval ( const std::string &  name,
reco::PreId ecal,
reco::PreId hcal,
double  rho,
const reco::BeamSpot spot,
noZS::EcalClusterLazyTools ecalTools 
) const

Definition at line 41 of file LowPtGsfElectronSeedHeavyObjectCache.cc.

46  {
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  }

References HLT_FULL_cff::distance, bsc_activity_cfg::ecal, Exception, lowptgsfeleseed::features(), spr::find(), PixelMapPlotter::inputs, models_, Skims_PA_cff::name, names_, convertSQLitetoXML_cfg::output, and thresholds_.

◆ modelNames()

std::vector<std::string> lowptgsfeleseed::HeavyObjectCache::modelNames ( ) const
inline

Definition at line 20 of file LowPtGsfElectronSeedHeavyObjectCache.h.

20 { return names_; }

References names_.

Member Data Documentation

◆ models_

std::vector<std::unique_ptr<const GBRForest> > lowptgsfeleseed::HeavyObjectCache::models_
private

Definition at line 31 of file LowPtGsfElectronSeedHeavyObjectCache.h.

Referenced by eval(), and HeavyObjectCache().

◆ names_

std::vector<std::string> lowptgsfeleseed::HeavyObjectCache::names_
private

Definition at line 30 of file LowPtGsfElectronSeedHeavyObjectCache.h.

Referenced by eval(), HeavyObjectCache(), and modelNames().

◆ thresholds_

std::vector<double> lowptgsfeleseed::HeavyObjectCache::thresholds_
private

Definition at line 32 of file LowPtGsfElectronSeedHeavyObjectCache.h.

Referenced by eval(), and HeavyObjectCache().

convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
hcal
Definition: ConfigurationDatabase.cc:13
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
edm::FileInPath
Definition: FileInPath.h:64
lowptgsfeleseed::HeavyObjectCache::names_
std::vector< std::string > names_
Definition: LowPtGsfElectronSeedHeavyObjectCache.h:30
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99178
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
DDAxes::rho
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
lowptgsfeleseed::HeavyObjectCache::models_
std::vector< std::unique_ptr< const GBRForest > > models_
Definition: LowPtGsfElectronSeedHeavyObjectCache.h:31
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
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
lowptgsfeleseed::HeavyObjectCache::thresholds_
std::vector< double > thresholds_
Definition: LowPtGsfElectronSeedHeavyObjectCache.h:32