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 52 of file LowPtGsfElectronSeedHeavyObjectCache.h.

Constructor & Destructor Documentation

◆ HeavyObjectCache()

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

Definition at line 111 of file LowPtGsfElectronSeedHeavyObjectCache.cc.

111  {
112  for (auto& name : conf.getParameter<std::vector<std::string> >("ModelNames")) {
113  names_.push_back(name);
114  }
115  for (auto& weights : conf.getParameter<std::vector<std::string> >("ModelWeights")) {
117  }
118  for (auto& thresh : conf.getParameter<std::vector<double> >("ModelThresholds")) {
119  thresholds_.push_back(thresh);
120  }
121  if (names_.size() != models_.size()) {
122  throw cms::Exception("Incorrect configuration")
123  << "'ModelNames' size (" << names_.size() << ") != 'ModelWeights' size (" << models_.size() << ").\n";
124  }
125  if (models_.size() != thresholds_.size()) {
126  throw cms::Exception("Incorrect configuration")
127  << "'ModelWeights' size (" << models_.size() << ") != 'ModelThresholds' size (" << thresholds_.size()
128  << ").\n";
129  }
130  }

References createGBRForest(), Exception, edm::ParameterSet::getParameter(), models_, Skims_PA_cff::name, names_, GOODCOLL_filter_cfg::thresh, thresholds_, and HLT_2018_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 134 of file LowPtGsfElectronSeedHeavyObjectCache.cc.

139  {
140  std::vector<std::string>::const_iterator iter = std::find(names_.begin(), names_.end(), name);
141  if (iter != names_.end()) {
142  int index = std::distance(names_.begin(), iter);
143  Features features;
144  features.set(ecal, hcal, rho, spot, ecalTools);
145  std::vector<float> inputs = features.get();
146  float output = models_.at(index)->GetResponse(inputs.data());
147  bool pass = output > thresholds_.at(index);
148  ecal.setMVA(pass, output, index);
149  return pass;
150  } else {
151  throw cms::Exception("Unknown model name")
152  << "'Name given: '" << name << "'. Check against configuration file.\n";
153  }
154  }

References HLT_2018_cff::distance, bsc_activity_cfg::ecal, Exception, postprocess-scan-build::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 56 of file LowPtGsfElectronSeedHeavyObjectCache.h.

56 { return names_; }

References names_.

Member Data Documentation

◆ models_

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

Definition at line 67 of file LowPtGsfElectronSeedHeavyObjectCache.h.

Referenced by eval(), and HeavyObjectCache().

◆ names_

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

Definition at line 66 of file LowPtGsfElectronSeedHeavyObjectCache.h.

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

◆ thresholds_

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

Definition at line 68 of file LowPtGsfElectronSeedHeavyObjectCache.h.

Referenced by eval(), and HeavyObjectCache().

HLT_2018_cff.weights
weights
Definition: HLT_2018_cff.py:87167
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
postprocess-scan-build.features
features
Definition: postprocess-scan-build.py:8
hcal
Definition: ConfigurationDatabase.cc:13
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
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:66
DDAxes::rho
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
lowptgsfeleseed::HeavyObjectCache::models_
std::vector< std::unique_ptr< const GBRForest > > models_
Definition: LowPtGsfElectronSeedHeavyObjectCache.h:67
GOODCOLL_filter_cfg.thresh
thresh
Definition: GOODCOLL_filter_cfg.py:74
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
bsc_activity_cfg.ecal
ecal
Definition: bsc_activity_cfg.py:25
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
lowptgsfeleseed::HeavyObjectCache::thresholds_
std::vector< double > thresholds_
Definition: LowPtGsfElectronSeedHeavyObjectCache.h:68