CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SCRegressionCalculator< VarCalc > Class Template Reference

#include <SCRegressionCalculator.h>

Public Member Functions

float getCorrection (const reco::SuperCluster &) const
 
std::pair< float, float > getCorrectionWithErrors (const reco::SuperCluster &) const
 
 SCRegressionCalculator (const edm::ParameterSet &)
 
void update (const edm::EventSetup &)
 
std::unique_ptr< VarCalc > & varCalc ()
 

Private Attributes

edm::ESHandle< GBRForesteb_corr
 
std::string eb_corr_name
 
edm::ESHandle< GBRForesteb_err
 
std::string eb_err_name
 
edm::ESHandle< GBRForestee_corr
 
std::string ee_corr_name
 
edm::ESHandle< GBRForestee_err
 
std::string ee_err_name
 
const GBRWrapperRcdgbr_record
 
std::unique_ptr< VarCalc > var_calc
 

Detailed Description

template<class VarCalc>
class SCRegressionCalculator< VarCalc >

Definition at line 21 of file SCRegressionCalculator.h.

Constructor & Destructor Documentation

◆ SCRegressionCalculator()

template<class VarCalc >
SCRegressionCalculator< VarCalc >::SCRegressionCalculator ( const edm::ParameterSet conf)

Definition at line 39 of file SCRegressionCalculator.h.

References SCRegressionCalculator< VarCalc >::eb_corr_name, SCRegressionCalculator< VarCalc >::eb_err_name, SCRegressionCalculator< VarCalc >::ee_corr_name, SCRegressionCalculator< VarCalc >::ee_err_name, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and SCRegressionCalculator< VarCalc >::var_calc.

39  : gbr_record(nullptr) {
40  var_calc.reset(new VarCalc());
41  eb_corr_name = conf.getParameter<std::string>("regressionKeyEB");
42  ee_corr_name = conf.getParameter<std::string>("regressionKeyEE");
43  if (conf.existsAs<std::string>("uncertaintyKeyEB"))
44  eb_err_name = conf.getParameter<std::string>("uncertaintyKeyEB");
45  if (conf.existsAs<std::string>("uncertaintyKeyEE"))
46  ee_err_name = conf.getParameter<std::string>("uncertaintyKeyEE");
47 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
const GBRWrapperRcd * gbr_record
std::unique_ptr< VarCalc > var_calc

Member Function Documentation

◆ getCorrection()

template<class VarCalc >
float SCRegressionCalculator< VarCalc >::getCorrection ( const reco::SuperCluster sc) const

Definition at line 67 of file SCRegressionCalculator.h.

References EcalBarrel, EcalEndcap, PixelMapPlotter::inputs, and reco::SuperCluster::seed().

67  {
68  std::vector<float> inputs;
69  var_calc->set(sc, inputs);
70  switch (sc.seed()->seed().subdetId()) {
72  return eb_corr->GetResponse(inputs.data());
73  break;
75  return ee_corr->GetResponse(inputs.data());
76  break;
77  }
78  return -1.0f;
79 }
edm::ESHandle< GBRForest > eb_corr
edm::ESHandle< GBRForest > ee_corr
double GetResponse(const float *vector) const
Definition: GBRForest.h:48
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
std::unique_ptr< VarCalc > var_calc

◆ getCorrectionWithErrors()

template<class VarCalc >
std::pair< float, float > SCRegressionCalculator< VarCalc >::getCorrectionWithErrors ( const reco::SuperCluster sc) const

Definition at line 82 of file SCRegressionCalculator.h.

References EcalBarrel, EcalEndcap, f, PixelMapPlotter::inputs, and reco::SuperCluster::seed().

82  {
83  std::vector<float> inputs;
84  var_calc->set(sc, inputs);
85  switch (sc.seed()->seed().subdetId()) {
87  return std::make_pair(eb_corr->GetResponse(inputs.data()), eb_err->GetResponse(inputs.data()));
88  break;
90  return std::make_pair(ee_corr->GetResponse(inputs.data()), ee_err->GetResponse(inputs.data()));
91  break;
92  }
93  return std::make_pair(-1.0f, -1.0f);
94 }
edm::ESHandle< GBRForest > eb_corr
edm::ESHandle< GBRForest > ee_corr
double f[11][100]
edm::ESHandle< GBRForest > ee_err
double GetResponse(const float *vector) const
Definition: GBRForest.h:48
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
std::unique_ptr< VarCalc > var_calc
edm::ESHandle< GBRForest > eb_err

◆ update()

template<class VarCalc >
void SCRegressionCalculator< VarCalc >::update ( const edm::EventSetup es)

Definition at line 50 of file SCRegressionCalculator.h.

References edm::eventsetup::EventSetupRecord::cacheIdentifier(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), and edm::EventSetup::get().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

50  {
51  var_calc->update(es);
52  const GBRWrapperRcd& gbrfrom_es = es.get<GBRWrapperRcd>();
53  if (!gbr_record || gbrfrom_es.cacheIdentifier() != gbr_record->cacheIdentifier()) {
54  gbr_record = &gbrfrom_es;
57  if (!eb_err_name.empty()) {
58  gbr_record->get(eb_err_name.c_str(), eb_err);
59  }
60  if (!ee_err_name.empty()) {
61  gbr_record->get(ee_err_name.c_str(), ee_err);
62  }
63  }
64 }
edm::ESHandle< GBRForest > eb_corr
const GBRWrapperRcd * gbr_record
unsigned long long cacheIdentifier() const
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
edm::ESHandle< GBRForest > ee_corr
T get() const
Definition: EventSetup.h:82
edm::ESHandle< GBRForest > ee_err
std::unique_ptr< VarCalc > var_calc
edm::ESHandle< GBRForest > eb_err

◆ varCalc()

template<class VarCalc >
std::unique_ptr<VarCalc>& SCRegressionCalculator< VarCalc >::varCalc ( )
inline

Definition at line 26 of file SCRegressionCalculator.h.

References SCRegressionCalculator< VarCalc >::var_calc.

26 { return var_calc; }
std::unique_ptr< VarCalc > var_calc

Member Data Documentation

◆ eb_corr

template<class VarCalc >
edm::ESHandle<GBRForest> SCRegressionCalculator< VarCalc >::eb_corr
private

Definition at line 34 of file SCRegressionCalculator.h.

◆ eb_corr_name

template<class VarCalc >
std::string SCRegressionCalculator< VarCalc >::eb_corr_name
private

◆ eb_err

template<class VarCalc >
edm::ESHandle<GBRForest> SCRegressionCalculator< VarCalc >::eb_err
private

Definition at line 34 of file SCRegressionCalculator.h.

◆ eb_err_name

template<class VarCalc >
std::string SCRegressionCalculator< VarCalc >::eb_err_name
private

◆ ee_corr

template<class VarCalc >
edm::ESHandle<GBRForest> SCRegressionCalculator< VarCalc >::ee_corr
private

Definition at line 34 of file SCRegressionCalculator.h.

◆ ee_corr_name

template<class VarCalc >
std::string SCRegressionCalculator< VarCalc >::ee_corr_name
private

◆ ee_err

template<class VarCalc >
edm::ESHandle<GBRForest> SCRegressionCalculator< VarCalc >::ee_err
private

Definition at line 34 of file SCRegressionCalculator.h.

◆ ee_err_name

template<class VarCalc >
std::string SCRegressionCalculator< VarCalc >::ee_err_name
private

◆ gbr_record

template<class VarCalc >
const GBRWrapperRcd* SCRegressionCalculator< VarCalc >::gbr_record
private

Definition at line 33 of file SCRegressionCalculator.h.

◆ var_calc

template<class VarCalc >
std::unique_ptr<VarCalc> SCRegressionCalculator< VarCalc >::var_calc
private