CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SCEnergyCorrectorSemiParm Class Reference

#include <SCEnergyCorrectorSemiParm.h>

Classes

class  RegParam
 

Public Member Functions

std::pair< double, double > getCorrections (const reco::SuperCluster &sc) const
 
std::vector< float > getRegData (const reco::SuperCluster &sc) const
 
void modifyObject (reco::SuperCluster &sc) const
 
 SCEnergyCorrectorSemiParm ()
 
 SCEnergyCorrectorSemiParm (const edm::ParameterSet &iConfig, edm::ConsumesCollector cc)
 
void setEvent (const edm::Event &e)
 
void setEventSetup (const edm::EventSetup &es)
 
template<edm::Transition tr = edm::Transition::BeginLuminosityBlock>
void setTokens (const edm::ParameterSet &iConfig, edm::ConsumesCollector cc)
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &desc)
 
static edm::ParameterSetDescription makePSetDescription ()
 

Private Member Functions

std::vector< float > getRegDataECALHLTV1 (const reco::SuperCluster &sc) const
 
std::vector< float > getRegDataECALV1 (const reco::SuperCluster &sc) const
 
std::vector< float > getRegDataHGCALHLTV1 (const reco::SuperCluster &sc) const
 
std::vector< float > getRegDataHGCALV1 (const reco::SuperCluster &sc) const
 
const RegParamgetRegParam (const DetId &detId) const
 

Private Attributes

bool applySigmaIetaIphiBug_
 
const CaloGeometrycaloGeom_
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
caloGeomToken_
 
const CaloTopologycaloTopo_
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
caloTopoToken_
 
float hgcalCylinderR_
 
HGCalShowerShapeHelper hgcalShowerShapes_
 
float hitsEnergyThreshold_
 
bool isHLT_
 
bool isPhaseII_
 
int nHitsAboveThresholdEB_
 
int nHitsAboveThresholdEE_
 
int nHitsAboveThresholdHG_
 
edm::Handle< EcalRecHitCollectionrecHitsEB_
 
edm::Handle< EcalRecHitCollectionrecHitsEE_
 
edm::Handle
< reco::PFRecHitCollection
recHitsHgcal_
 
RegParam regParamBarrel_
 
RegParam regParamEndcap_
 
edm::EDGetTokenT
< EcalRecHitCollection
tokenEBRecHits_
 
edm::EDGetTokenT
< EcalRecHitCollection
tokenEERecHits_
 
edm::EDGetTokenT
< reco::PFRecHitCollection
tokenHgcalRecHits_
 
edm::EDGetTokenT
< reco::VertexCollection
tokenVertices_
 
edm::Handle
< reco::VertexCollection
vertices_
 

Detailed Description

Definition at line 37 of file SCEnergyCorrectorSemiParm.h.

Constructor & Destructor Documentation

SCEnergyCorrectorSemiParm::SCEnergyCorrectorSemiParm ( )
SCEnergyCorrectorSemiParm::SCEnergyCorrectorSemiParm ( const edm::ParameterSet iConfig,
edm::ConsumesCollector  cc 
)

Definition at line 61 of file SCEnergyCorrectorSemiParm.cc.

References setTokens().

63  setTokens(iConfig, cc);
64 }
void setTokens(const edm::ParameterSet &iConfig, edm::ConsumesCollector cc)

Member Function Documentation

void SCEnergyCorrectorSemiParm::fillPSetDescription ( edm::ParameterSetDescription desc)
static

Definition at line 66 of file SCEnergyCorrectorSemiParm.cc.

References edm::ParameterSetDescription::add(), HLT_FULL_cff::InputTag, EgammaHGCALIDParamDefaults::kRCylinder, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makePSetDescription().

66  {
67  desc.add<bool>("isHLT", false);
68  desc.add<bool>("isPhaseII", false);
69  desc.add<bool>("applySigmaIetaIphiBug", false);
70  desc.add<edm::InputTag>("ecalRecHitsEE", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
71  desc.add<edm::InputTag>("ecalRecHitsEB", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
72  desc.add<std::string>("regressionKeyEB", "pfscecal_EBCorrection_offline_v2");
73  desc.add<std::string>("regressionKeyEE", "pfscecal_EECorrection_offline_v2");
74  desc.add<std::string>("uncertaintyKeyEB", "pfscecal_EBUncertainty_offline_v2");
75  desc.add<std::string>("uncertaintyKeyEE", "pfscecal_EEUncertainty_offline_v2");
76  desc.add<double>("regressionMinEB", 0.2);
77  desc.add<double>("regressionMaxEB", 2.0);
78  desc.add<double>("regressionMinEE", 0.2);
79  desc.add<double>("regressionMaxEE", 2.0);
80  desc.add<double>("uncertaintyMinEB", 0.0002);
81  desc.add<double>("uncertaintyMaxEB", 0.5);
82  desc.add<double>("uncertaintyMinEE", 0.0002);
83  desc.add<double>("uncertaintyMaxEE", 0.5);
84  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("offlinePrimaryVertices"));
85  desc.add<double>("eRecHitThreshold", 1.);
86  desc.add<edm::InputTag>("hgcalRecHits", edm::InputTag());
87  desc.add<double>("hgcalCylinderR", EgammaHGCALIDParamDefaults::kRCylinder);
88 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::pair< double, double > SCEnergyCorrectorSemiParm::getCorrections ( const reco::SuperCluster sc) const

Definition at line 128 of file SCEnergyCorrectorSemiParm.cc.

References DetId::Ecal, EcalEndcap, getRegData(), getRegParam(), isHLT_, SiStripPI::mean, reco::SuperCluster::preshowerEnergy(), reco::SuperCluster::rawEnergy(), reco::SuperCluster::seed(), and DetId::subdetId().

Referenced by modifyObject().

128  {
129  std::pair<double, double> corrEnergyAndRes = {-1, -1};
130 
131  const auto regData = getRegData(sc);
132  if (regData.empty()) {
133  //supercluster has no valid regression, return default values
134  return corrEnergyAndRes;
135  }
136  DetId seedId = sc.seed()->seed();
137  const auto& regParam = getRegParam(seedId);
138 
139  double mean = regParam.mean(regData);
140  double sigma = regParam.sigma(regData);
141 
142  double energyCorr = mean * sc.rawEnergy();
143  if (isHLT_ && sc.seed()->seed().det() == DetId::Ecal && seedId.subdetId() == EcalEndcap) {
144  energyCorr += sc.preshowerEnergy();
145  }
146  double resolutionEst = sigma * energyCorr;
147 
148  corrEnergyAndRes.first = energyCorr;
149  corrEnergyAndRes.second = resolutionEst;
150 
151  return corrEnergyAndRes;
152 }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
std::vector< float > getRegData(const reco::SuperCluster &sc) const
Definition: DetId.h:17
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
const RegParam & getRegParam(const DetId &detId) const
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:61
std::vector< float > SCEnergyCorrectorSemiParm::getRegData ( const reco::SuperCluster sc) const

Definition at line 165 of file SCEnergyCorrectorSemiParm.cc.

References DetId::Ecal, EcalEndcap, Exception, getRegDataECALHLTV1(), getRegDataECALV1(), getRegDataHGCALHLTV1(), getRegDataHGCALV1(), DetId::HGCalEE, isHLT_, isPhaseII_, and reco::SuperCluster::seed().

Referenced by getCorrections(), and SCEnergyCorrectorProducer::produce().

165  {
166  switch (sc.seed()->seed().det()) {
167  case DetId::Ecal:
168  if (isPhaseII_ && sc.seed()->seed().subdetId() == EcalEndcap) {
169  throw cms::Exception("ConfigError") << " Error in SCEnergyCorrectorSemiParm: "
170  << " running over events with EcalEndcap clusters while enabling "
171  "isPhaseII, please set isPhaseII = False in regression config";
172  }
173  return isHLT_ ? getRegDataECALHLTV1(sc) : getRegDataECALV1(sc);
174  case DetId::HGCalEE:
175  if (!isPhaseII_) {
176  throw cms::Exception("ConfigError") << " Error in SCEnergyCorrectorSemiParm: "
177  << " running over PhaseII events without enabling isPhaseII, please set "
178  "isPhaseII = True in regression config";
179  }
180  return isHLT_ ? getRegDataHGCALHLTV1(sc) : getRegDataHGCALV1(sc);
181  default:
182  return std::vector<float>();
183  }
184 }
std::vector< float > getRegDataECALHLTV1(const reco::SuperCluster &sc) const
std::vector< float > getRegDataHGCALV1(const reco::SuperCluster &sc) const
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
std::vector< float > getRegDataECALV1(const reco::SuperCluster &sc) const
std::vector< float > getRegDataHGCALHLTV1(const reco::SuperCluster &sc) const
std::vector< float > SCEnergyCorrectorSemiParm::getRegDataECALHLTV1 ( const reco::SuperCluster sc) const
private

Definition at line 315 of file SCEnergyCorrectorSemiParm.cc.

References caloTopo_, reco::SuperCluster::clusters(), EcalBarrel, reco::CaloCluster::eta(), reco::CaloCluster::hitsAndFractions(), SiStripPI::max, nHitsAboveThresholdEB_, nHitsAboveThresholdEE_, reco::SuperCluster::phiWidth(), reco::SuperCluster::rawEnergy(), HLT_FULL_cff::recHits, recHitsEB_, recHitsEE_, reco::SuperCluster::seed(), and edm::PtrVectorBase::size().

Referenced by getRegData().

315  {
316  std::vector<float> eval(7, 0.);
317  auto maxDRNonSeedClus = getMaxDRNonSeedCluster(sc);
318  const float clusterMaxDR = maxDRNonSeedClus.first ? maxDRNonSeedClus.second : 999.;
319 
320  const reco::CaloCluster& seedCluster = *(sc.seed());
321  const bool iseb = seedCluster.hitsAndFractions()[0].first.subdetId() == EcalBarrel;
322  const EcalRecHitCollection* recHits = iseb ? recHitsEB_.product() : recHitsEE_.product();
323 
325  eval[1] = sc.eta();
326  eval[2] = sc.phiWidth();
327  eval[3] = EcalClusterTools::e3x3(seedCluster, recHits, caloTopo_) / sc.rawEnergy();
328  eval[4] = std::max(0, static_cast<int>(sc.clusters().size()) - 1);
329  eval[5] = clusterMaxDR;
330  eval[6] = sc.rawEnergy();
331 
332  return eval;
333 }
size_type size() const
Size of the RefVector.
Definition: PtrVectorBase.h:75
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:66
const CaloClusterPtrVector & clusters() const
const access to the cluster list itself
Definition: SuperCluster.h:80
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
edm::Handle< EcalRecHitCollection > recHitsEE_
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
edm::Handle< EcalRecHitCollection > recHitsEB_
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
std::vector< float > SCEnergyCorrectorSemiParm::getRegDataECALV1 ( const reco::SuperCluster sc) const
private

Definition at line 199 of file SCEnergyCorrectorSemiParm.cc.

References applySigmaIetaIphiBug_, caloTopo_, reco::SuperCluster::clusters(), reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), reco::deltaPhi(), reco::deltaR(), EcalBarrel, reco::CaloCluster::energy(), reco::CaloCluster::eta(), reco::SuperCluster::etaWidth(), reco::CaloCluster::hitsAndFractions(), EBDetId::ieta(), edm::isNotFinite(), EEDetId::ix(), SiStripPI::max, reco::SuperCluster::phiWidth(), reco::SuperCluster::rawEnergy(), HLT_FULL_cff::recHits, recHitsEB_, recHitsEE_, reco::SuperCluster::seed(), reco::CaloCluster::seed(), edm::PtrVectorBase::size(), mathSSE::sqrt(), and vertices_.

Referenced by getRegData().

199  {
200  std::vector<float> eval(30, 0.);
201 
202  const reco::CaloCluster& seedCluster = *(sc.seed());
203  const bool iseb = seedCluster.hitsAndFractions()[0].first.subdetId() == EcalBarrel;
204  const EcalRecHitCollection* recHits = iseb ? recHitsEB_.product() : recHitsEE_.product();
205 
206  const double raw_energy = sc.rawEnergy();
207  const int numberOfClusters = sc.clusters().size();
208 
209  const auto& localCovariances = EcalClusterTools::localCovariances(seedCluster, recHits, caloTopo_);
210 
211  const float eLeft = EcalClusterTools::eLeft(seedCluster, recHits, caloTopo_);
212  const float eRight = EcalClusterTools::eRight(seedCluster, recHits, caloTopo_);
213  const float eTop = EcalClusterTools::eTop(seedCluster, recHits, caloTopo_);
214  const float eBottom = EcalClusterTools::eBottom(seedCluster, recHits, caloTopo_);
215 
216  float sigmaIetaIeta = sqrt(localCovariances[0]);
217  float sigmaIetaIphi = std::numeric_limits<float>::max();
218  float sigmaIphiIphi = std::numeric_limits<float>::max();
219 
220  if (!edm::isNotFinite(localCovariances[2]))
221  sigmaIphiIphi = sqrt(localCovariances[2]);
222 
223  // extra shower shapes
224  const float see_by_spp = sigmaIetaIeta * (applySigmaIetaIphiBug_ ? std::numeric_limits<float>::max() : sigmaIphiIphi);
225  if (see_by_spp > 0) {
226  sigmaIetaIphi = localCovariances[1] / see_by_spp;
227  } else if (localCovariances[1] > 0) {
228  sigmaIetaIphi = 1.f;
229  } else {
230  sigmaIetaIphi = -1.f;
231  }
232 
233  // calculate sub-cluster variables
234  std::vector<float> clusterRawEnergy;
235  clusterRawEnergy.resize(std::max(3, numberOfClusters), 0);
236  std::vector<float> clusterDEtaToSeed;
237  clusterDEtaToSeed.resize(std::max(3, numberOfClusters), 0);
238  std::vector<float> clusterDPhiToSeed;
239  clusterDPhiToSeed.resize(std::max(3, numberOfClusters), 0);
240  float clusterMaxDR = 999.;
241  float clusterMaxDRDPhi = 999.;
242  float clusterMaxDRDEta = 999.;
243  float clusterMaxDRRawEnergy = 0.;
244 
245  size_t iclus = 0;
246  float maxDR = 0;
248  const edm::Ptr<reco::CaloCluster>& theseed = sc.seed();
249  // loop over all clusters that aren't the seed
250  auto clusend = sc.clustersEnd();
251  for (auto clus = sc.clustersBegin(); clus != clusend; ++clus) {
252  pclus = *clus;
253 
254  if (theseed == pclus)
255  continue;
256  clusterRawEnergy[iclus] = pclus->energy();
257  clusterDPhiToSeed[iclus] = reco::deltaPhi(pclus->phi(), theseed->phi());
258  clusterDEtaToSeed[iclus] = pclus->eta() - theseed->eta();
259 
260  // find cluster with max dR
261  const auto the_dr = reco::deltaR(*pclus, *theseed);
262  if (the_dr > maxDR) {
263  maxDR = the_dr;
264  clusterMaxDR = maxDR;
265  clusterMaxDRDPhi = clusterDPhiToSeed[iclus];
266  clusterMaxDRDEta = clusterDEtaToSeed[iclus];
267  clusterMaxDRRawEnergy = clusterRawEnergy[iclus];
268  }
269  ++iclus;
270  }
271 
272  eval[0] = vertices_->size();
273  eval[1] = raw_energy;
274  eval[2] = sc.etaWidth();
275  eval[3] = sc.phiWidth();
276  eval[4] = EcalClusterTools::e3x3(seedCluster, recHits, caloTopo_) / raw_energy;
277  eval[5] = seedCluster.energy() / raw_energy;
278  eval[6] = EcalClusterTools::eMax(seedCluster, recHits) / raw_energy;
279  eval[7] = EcalClusterTools::e2nd(seedCluster, recHits) / raw_energy;
280  eval[8] = (eLeft + eRight != 0.f ? (eLeft - eRight) / (eLeft + eRight) : 0.f);
281  eval[9] = (eTop + eBottom != 0.f ? (eTop - eBottom) / (eTop + eBottom) : 0.f);
282  eval[10] = sigmaIetaIeta;
283  eval[11] = sigmaIetaIphi;
284  eval[12] = sigmaIphiIphi;
285  eval[13] = std::max(0, numberOfClusters - 1);
286  eval[14] = clusterMaxDR;
287  eval[15] = clusterMaxDRDPhi;
288  eval[16] = clusterMaxDRDEta;
289  eval[17] = clusterMaxDRRawEnergy / raw_energy;
290  eval[18] = clusterRawEnergy[0] / raw_energy;
291  eval[19] = clusterRawEnergy[1] / raw_energy;
292  eval[20] = clusterRawEnergy[2] / raw_energy;
293  eval[21] = clusterDPhiToSeed[0];
294  eval[22] = clusterDPhiToSeed[1];
295  eval[23] = clusterDPhiToSeed[2];
296  eval[24] = clusterDEtaToSeed[0];
297  eval[25] = clusterDEtaToSeed[1];
298  eval[26] = clusterDEtaToSeed[2];
299  if (iseb) {
300  EBDetId ebseedid(seedCluster.seed());
301  eval[27] = ebseedid.ieta();
302  eval[28] = ebseedid.iphi();
303  } else {
304  EEDetId eeseedid(seedCluster.seed());
305  eval[27] = eeseedid.ix();
306  eval[28] = eeseedid.iy();
307  //seed cluster eta is only needed for the 106X Ultra Legacy regressions
308  //and was not used in the 74X regression however as its just an extra varaible
309  //at the end, its harmless to add for the 74X regression
310  eval[29] = seedCluster.eta();
311  }
312  return eval;
313 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
size_type size() const
Size of the RefVector.
Definition: PtrVectorBase.h:75
int ix() const
Definition: EEDetId.h:77
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:66
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
const CaloClusterPtrVector & clusters() const
const access to the cluster list itself
Definition: SuperCluster.h:80
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
double etaWidth() const
Definition: SuperCluster.h:67
T sqrt(T t)
Definition: SSEVec.h:19
edm::Handle< EcalRecHitCollection > recHitsEE_
double energy() const
cluster energy
Definition: CaloCluster.h:149
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:219
edm::Handle< EcalRecHitCollection > recHitsEB_
edm::Handle< reco::VertexCollection > vertices_
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:86
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:89
std::vector< float > SCEnergyCorrectorSemiParm::getRegDataHGCALHLTV1 ( const reco::SuperCluster sc) const
private

Definition at line 366 of file SCEnergyCorrectorSemiParm.cc.

References reco::SuperCluster::clusters(), HGCalShowerShapeHelper::createCalc(), reco::CaloCluster::eta(), hgcalCylinderR_, hgcalShowerShapes_, SiStripPI::max, nHitsAboveThresholdEB_, nHitsAboveThresholdHG_, reco::SuperCluster::phiWidth(), reco::SuperCluster::rawEnergy(), and edm::PtrVectorBase::size().

Referenced by getRegData().

366  {
367  std::vector<float> eval(7, 0.);
368  const float clusterMaxDR = getMaxDRNonSeedCluster(sc).second;
369 
370  auto ssCalc = hgcalShowerShapes_.createCalc(sc);
371 
372  eval[0] = sc.rawEnergy();
373  eval[1] = sc.eta();
374  eval[2] = sc.phiWidth();
375  eval[3] = std::max(0, static_cast<int>(sc.clusters().size()) - 1);
376  eval[4] = ssCalc.getRvar(hgcalCylinderR_);
377  eval[5] = clusterMaxDR;
379 
380  return eval;
381 }
HGCalShowerShapeHelper::ShowerShapeCalc createCalc(const std::vector< std::pair< DetId, float > > &hitsAndFracs, double rawEnergy, double minHitE=0, double minHitET=0, int minLayer=1, int maxLayer=-1, DetId::Detector subDet=DetId::HGCalEE) const
size_type size() const
Size of the RefVector.
Definition: PtrVectorBase.h:75
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:66
const CaloClusterPtrVector & clusters() const
const access to the cluster list itself
Definition: SuperCluster.h:80
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
HGCalShowerShapeHelper hgcalShowerShapes_
std::vector< float > SCEnergyCorrectorSemiParm::getRegDataHGCALV1 ( const reco::SuperCluster sc) const
private

Definition at line 335 of file SCEnergyCorrectorSemiParm.cc.

References reco::SuperCluster::clusters(), HGCalShowerShapeHelper::createCalc(), reco::deltaPhi(), reco::CaloCluster::eta(), reco::SuperCluster::etaWidth(), HGCalShowerShapeHelper::ShowerShapeCalc::getPCAWidths(), hgcalCylinderR_, hgcalShowerShapes_, reco::CaloCluster::hitsAndFractions(), nHitsAboveThresholdEB_, nHitsAboveThresholdHG_, reco::CaloCluster::phi(), reco::SuperCluster::phiWidth(), reco::SuperCluster::rawEnergy(), reco::SuperCluster::seed(), edm::PtrVectorBase::size(), and mathSSE::sqrt().

Referenced by getRegData().

335  {
336  std::vector<float> eval(17, 0.);
337 
338  auto ssCalc = hgcalShowerShapes_.createCalc(sc);
339  auto pcaWidths = ssCalc.getPCAWidths(hgcalCylinderR_);
340  auto energyHighestHits = ssCalc.getEnergyHighestHits(2);
341 
342  auto maxDRNonSeedClus = getMaxDRNonSeedCluster(sc);
343  const float clusterMaxDR = maxDRNonSeedClus.first ? maxDRNonSeedClus.second : 999.;
344 
345  eval[0] = sc.rawEnergy();
346  eval[1] = sc.eta();
347  eval[2] = sc.etaWidth();
348  eval[3] = sc.phiWidth();
349  eval[4] = sc.clusters().size();
350  eval[5] = sc.hitsAndFractions().size();
351  eval[6] = clusterMaxDR;
352  eval[7] = sc.eta() - sc.seed()->eta();
353  eval[8] = reco::deltaPhi(sc.phi(), sc.seed()->phi());
354  eval[9] = energyHighestHits[0] / sc.rawEnergy();
355  eval[10] = energyHighestHits[1] / sc.rawEnergy();
356  eval[11] = std::sqrt(pcaWidths.sigma2uu);
357  eval[12] = std::sqrt(pcaWidths.sigma2vv);
358  eval[13] = std::sqrt(pcaWidths.sigma2ww);
359  eval[14] = ssCalc.getRvar(hgcalCylinderR_, sc.rawEnergy());
360  eval[15] = sc.seed()->energy() / sc.rawEnergy();
362 
363  return eval;
364 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
HGCalShowerShapeHelper::ShowerShapeCalc createCalc(const std::vector< std::pair< DetId, float > > &hitsAndFracs, double rawEnergy, double minHitE=0, double minHitET=0, int minLayer=1, int maxLayer=-1, DetId::Detector subDet=DetId::HGCalEE) const
size_type size() const
Size of the RefVector.
Definition: PtrVectorBase.h:75
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:66
const CaloClusterPtrVector & clusters() const
const access to the cluster list itself
Definition: SuperCluster.h:80
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
double etaWidth() const
Definition: SuperCluster.h:67
ShowerWidths getPCAWidths(double cylinderR, bool useFractions=false) const
T sqrt(T t)
Definition: SSEVec.h:19
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
HGCalShowerShapeHelper hgcalShowerShapes_
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
const RegParam& SCEnergyCorrectorSemiParm::getRegParam ( const DetId detId) const
inlineprivate

Definition at line 100 of file SCEnergyCorrectorSemiParm.h.

References DetId::det(), DetId::Ecal, EcalBarrel, regParamBarrel_, regParamEndcap_, and DetId::subdetId().

Referenced by getCorrections().

100  {
101  return detId.det() == DetId::Ecal && detId.subdetId() == EcalBarrel ? regParamBarrel_ : regParamEndcap_;
102  }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
edm::ParameterSetDescription SCEnergyCorrectorSemiParm::makePSetDescription ( )
static
void SCEnergyCorrectorSemiParm::modifyObject ( reco::SuperCluster sc) const

Definition at line 154 of file SCEnergyCorrectorSemiParm.cc.

References getCorrections(), reco::CaloCluster::setCorrectedEnergy(), reco::CaloCluster::setCorrectedEnergyUncertainty(), and reco::CaloCluster::setEnergy().

Referenced by SCEnergyCorrectorProducer::produce().

154  {
155  std::pair<double, double> cor = getCorrections(sc);
156  if (cor.first < 0)
157  return;
158  sc.setEnergy(cor.first);
159  sc.setCorrectedEnergy(cor.first);
160  if (cor.second >= 0) {
161  sc.setCorrectedEnergyUncertainty(cor.second);
162  }
163 }
void setEnergy(double energy)
Definition: CaloCluster.h:136
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:137
void setCorrectedEnergyUncertainty(float energyerr)
Definition: CaloCluster.h:138
std::pair< double, double > getCorrections(const reco::SuperCluster &sc) const
void SCEnergyCorrectorSemiParm::setEvent ( const edm::Event e)

Definition at line 108 of file SCEnergyCorrectorSemiParm.cc.

References hgcalShowerShapes_, hitsEnergyThreshold_, HGCalShowerShapeHelper::initPerEvent(), isHLT_, isPhaseII_, nHitsAboveThresholdEB_, nHitsAboveThresholdEE_, nHitsAboveThresholdHG_, recHitsEB_, recHitsEE_, recHitsHgcal_, tokenEBRecHits_, tokenEERecHits_, tokenHgcalRecHits_, tokenVertices_, and vertices_.

Referenced by SCEnergyCorrectorProducer::produce().

108  {
109  event.getByToken(tokenEBRecHits_, recHitsEB_);
110  if (!isPhaseII_) {
111  event.getByToken(tokenEERecHits_, recHitsEE_);
112  } else {
113  event.getByToken(tokenHgcalRecHits_, recHitsHgcal_);
115  }
116  if (isHLT_ || isPhaseII_) {
117  //note countRecHits checks the validity of the handle and returns 0
118  //if invalid so its okay to call on all rec-hit collections here
122  }
123  if (!isHLT_) {
124  event.getByToken(tokenVertices_, vertices_);
125  }
126 }
edm::Handle< reco::PFRecHitCollection > recHitsHgcal_
edm::EDGetTokenT< EcalRecHitCollection > tokenEERecHits_
void initPerEvent(const std::vector< reco::PFRecHit > &recHits)
edm::Handle< EcalRecHitCollection > recHitsEE_
edm::EDGetTokenT< EcalRecHitCollection > tokenEBRecHits_
edm::Handle< EcalRecHitCollection > recHitsEB_
edm::Handle< reco::VertexCollection > vertices_
edm::EDGetTokenT< reco::PFRecHitCollection > tokenHgcalRecHits_
edm::EDGetTokenT< reco::VertexCollection > tokenVertices_
HGCalShowerShapeHelper hgcalShowerShapes_
void SCEnergyCorrectorSemiParm::setEventSetup ( const edm::EventSetup es)

Definition at line 96 of file SCEnergyCorrectorSemiParm.cc.

References caloGeom_, caloGeomToken_, caloTopo_, caloTopoToken_, edm::EventSetup::getData(), hgcalShowerShapes_, HGCalShowerShapeHelper::initPerSetup(), isPhaseII_, regParamBarrel_, regParamEndcap_, and SCEnergyCorrectorSemiParm::RegParam::setForests().

Referenced by SCEnergyCorrectorProducer::beginLuminosityBlock().

96  {
99 
102 
103  if (isPhaseII_) {
105  }
106 }
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopoToken_
void setForests(const edm::EventSetup &setup)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
void initPerSetup(const edm::EventSetup &iSetup)
HGCalShowerShapeHelper hgcalShowerShapes_
template<edm::Transition esTransition>
void SCEnergyCorrectorSemiParm::setTokens ( const edm::ParameterSet iConfig,
edm::ConsumesCollector  cc 
)

Definition at line 146 of file SCEnergyCorrectorSemiParm.h.

References applySigmaIetaIphiBug_, caloGeomToken_, caloTopoToken_, edm::ConsumesCollector::consumes(), edm::ConsumesCollector::esConsumes(), edm::ParameterSet::getParameter(), hgcalCylinderR_, hgcalShowerShapes_, hitsEnergyThreshold_, isHLT_, isPhaseII_, regParamBarrel_, regParamEndcap_, HGCalShowerShapeHelper::setTokens(), AlCaHLTBitMon_QueryRunRegistry::string, tokenEBRecHits_, tokenEERecHits_, tokenHgcalRecHits_, and tokenVertices_.

Referenced by SCEnergyCorrectorSemiParm().

146  {
147  isHLT_ = iConfig.getParameter<bool>("isHLT");
148  isPhaseII_ = iConfig.getParameter<bool>("isPhaseII");
149  applySigmaIetaIphiBug_ = iConfig.getParameter<bool>("applySigmaIetaIphiBug");
151  if (not isPhaseII_) {
153  } else {
155  hgcalCylinderR_ = iConfig.getParameter<double>("hgcalCylinderR");
156  hgcalShowerShapes_.setTokens<esTransition>(cc);
157  }
160 
161  regParamBarrel_ = RegParam(iConfig.getParameter<std::string>("regressionKeyEB"),
162  iConfig.getParameter<double>("regressionMinEB"),
163  iConfig.getParameter<double>("regressionMaxEB"),
164  iConfig.getParameter<std::string>("uncertaintyKeyEB"),
165  iConfig.getParameter<double>("uncertaintyMinEB"),
166  iConfig.getParameter<double>("uncertaintyMaxEB"));
167  regParamBarrel_.setTokens<esTransition>(cc);
168  regParamEndcap_ = RegParam(iConfig.getParameter<std::string>("regressionKeyEE"),
169  iConfig.getParameter<double>("regressionMinEE"),
170  iConfig.getParameter<double>("regressionMaxEE"),
171  iConfig.getParameter<std::string>("uncertaintyKeyEE"),
172  iConfig.getParameter<double>("uncertaintyMinEE"),
173  iConfig.getParameter<double>("uncertaintyMaxEE"));
174  regParamEndcap_.setTokens<esTransition>(cc);
175  hitsEnergyThreshold_ = iConfig.getParameter<double>("eRecHitThreshold");
176  if (not isHLT_) {
177  tokenVertices_ = cc.consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"));
178  }
179 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopoToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
edm::EDGetTokenT< EcalRecHitCollection > tokenEERecHits_
void setTokens(edm::ConsumesCollector cc)
edm::EDGetTokenT< EcalRecHitCollection > tokenEBRecHits_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void setTokens(edm::ConsumesCollector consumesCollector)
edm::EDGetTokenT< reco::PFRecHitCollection > tokenHgcalRecHits_
edm::EDGetTokenT< reco::VertexCollection > tokenVertices_
HGCalShowerShapeHelper hgcalShowerShapes_

Member Data Documentation

bool SCEnergyCorrectorSemiParm::applySigmaIetaIphiBug_
private

Definition at line 130 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegDataECALV1(), and setTokens().

const CaloGeometry* SCEnergyCorrectorSemiParm::caloGeom_
private

Definition at line 114 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEventSetup().

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> SCEnergyCorrectorSemiParm::caloGeomToken_
private

Definition at line 116 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEventSetup(), and setTokens().

const CaloTopology* SCEnergyCorrectorSemiParm::caloTopo_
private
edm::ESGetToken<CaloTopology, CaloTopologyRecord> SCEnergyCorrectorSemiParm::caloTopoToken_
private

Definition at line 115 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEventSetup(), and setTokens().

float SCEnergyCorrectorSemiParm::hgcalCylinderR_
private

Definition at line 135 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegDataHGCALHLTV1(), getRegDataHGCALV1(), and setTokens().

HGCalShowerShapeHelper SCEnergyCorrectorSemiParm::hgcalShowerShapes_
private
float SCEnergyCorrectorSemiParm::hitsEnergyThreshold_
private

Definition at line 134 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEvent(), and setTokens().

bool SCEnergyCorrectorSemiParm::isHLT_
private

Definition at line 128 of file SCEnergyCorrectorSemiParm.h.

Referenced by getCorrections(), getRegData(), setEvent(), and setTokens().

bool SCEnergyCorrectorSemiParm::isPhaseII_
private

Definition at line 129 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegData(), setEvent(), setEventSetup(), and setTokens().

int SCEnergyCorrectorSemiParm::nHitsAboveThresholdEB_
private
int SCEnergyCorrectorSemiParm::nHitsAboveThresholdEE_
private

Definition at line 132 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegDataECALHLTV1(), and setEvent().

int SCEnergyCorrectorSemiParm::nHitsAboveThresholdHG_
private

Definition at line 133 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegDataHGCALHLTV1(), getRegDataHGCALV1(), and setEvent().

edm::Handle<EcalRecHitCollection> SCEnergyCorrectorSemiParm::recHitsEB_
private

Definition at line 123 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegDataECALHLTV1(), getRegDataECALV1(), and setEvent().

edm::Handle<EcalRecHitCollection> SCEnergyCorrectorSemiParm::recHitsEE_
private

Definition at line 124 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegDataECALHLTV1(), getRegDataECALV1(), and setEvent().

edm::Handle<reco::PFRecHitCollection> SCEnergyCorrectorSemiParm::recHitsHgcal_
private

Definition at line 125 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEvent().

RegParam SCEnergyCorrectorSemiParm::regParamBarrel_
private

Definition at line 110 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegParam(), setEventSetup(), and setTokens().

RegParam SCEnergyCorrectorSemiParm::regParamEndcap_
private

Definition at line 111 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegParam(), setEventSetup(), and setTokens().

edm::EDGetTokenT<EcalRecHitCollection> SCEnergyCorrectorSemiParm::tokenEBRecHits_
private

Definition at line 118 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEvent(), and setTokens().

edm::EDGetTokenT<EcalRecHitCollection> SCEnergyCorrectorSemiParm::tokenEERecHits_
private

Definition at line 119 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEvent(), and setTokens().

edm::EDGetTokenT<reco::PFRecHitCollection> SCEnergyCorrectorSemiParm::tokenHgcalRecHits_
private

Definition at line 120 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEvent(), and setTokens().

edm::EDGetTokenT<reco::VertexCollection> SCEnergyCorrectorSemiParm::tokenVertices_
private

Definition at line 121 of file SCEnergyCorrectorSemiParm.h.

Referenced by setEvent(), and setTokens().

edm::Handle<reco::VertexCollection> SCEnergyCorrectorSemiParm::vertices_
private

Definition at line 126 of file SCEnergyCorrectorSemiParm.h.

Referenced by getRegDataECALV1(), and setEvent().