CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFClusterEMEnergyCorrector Class Reference

#include <PFClusterEMEnergyCorrector.h>

Public Member Functions

void correctEnergies (const edm::Event &evt, const edm::EventSetup &es, const reco::PFCluster::EEtoPSAssociation &assoc, reco::PFClusterCollection &cs)
 
PFClusterEMEnergyCorrectoroperator= (const PFClusterEMEnergyCorrector &)=delete
 
 PFClusterEMEnergyCorrector (const edm::ParameterSet &conf, edm::ConsumesCollector &&cc)
 
 PFClusterEMEnergyCorrector (const PFClusterEMEnergyCorrector &)=delete
 

Private Member Functions

void getAssociatedPSEnergy (const size_t clusIdx, const reco::PFCluster::EEtoPSAssociation &assoc, float &e1, float &e2)
 

Private Attributes

bool applyCrackCorrections_
 
bool applyMVACorrections_
 
bool autoDetectBunchSpacing_
 
edm::EDGetTokenT< unsigned int > bunchSpacing_
 
int bunchSpacingManual_
 
std::unique_ptr< PFEnergyCalibrationcalibrator_
 
std::vector< std::string > condnames_mean_
 
std::vector< std::string > condnames_mean_25ns_
 
std::vector< std::string > condnames_mean_50ns_
 
std::vector< std::string > condnames_sigma_
 
std::vector< std::string > condnames_sigma_25ns_
 
std::vector< std::string > condnames_sigma_50ns_
 
edm::EDGetTokenT< EBSrFlagCollectionebSrFlagToken_
 
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
 
const EcalReadoutTools::ESGetTokens ecalReadoutToolsESGetTokens_
 
edm::EDGetTokenT< EESrFlagCollectioneeSrFlagToken_
 
double maxPtForMVAEvaluation_
 
double meanlimhighEB_
 
double meanlimhighEE_
 
double meanlimlowEB_
 
double meanlimlowEE_
 
double meanoffsetEB_
 
double meanoffsetEE_
 
double meanscaleEB_
 
double meanscaleEE_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsEB_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsEE_
 
bool setEnergyUncertainty_
 
double sigmalimhighEB_
 
double sigmalimhighEE_
 
double sigmalimlowEB_
 
double sigmalimlowEE_
 
double sigmaoffsetEB_
 
double sigmaoffsetEE_
 
double sigmascaleEB_
 
double sigmascaleEE_
 
bool srfAwareCorrection_
 

Detailed Description

Definition at line 26 of file PFClusterEMEnergyCorrector.h.

Constructor & Destructor Documentation

◆ PFClusterEMEnergyCorrector() [1/2]

PFClusterEMEnergyCorrector::PFClusterEMEnergyCorrector ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  cc 
)

Definition at line 14 of file PFClusterEMEnergyCorrector.cc.

18  applyCrackCorrections_ = conf.getParameter<bool>("applyCrackCorrections");
19  applyMVACorrections_ = conf.getParameter<bool>("applyMVACorrections");
20  srfAwareCorrection_ = conf.getParameter<bool>("srfAwareCorrection");
21  setEnergyUncertainty_ = conf.getParameter<bool>("setEnergyUncertainty");
22  maxPtForMVAEvaluation_ = conf.getParameter<double>("maxPtForMVAEvaluation");
23 
25  meanlimlowEB_ = -0.336;
26  meanlimhighEB_ = 0.916;
29 
30  meanlimlowEE_ = -0.336;
31  meanlimhighEE_ = 0.916;
34 
35  sigmalimlowEB_ = 0.001;
36  sigmalimhighEB_ = 0.4;
39 
40  sigmalimlowEE_ = 0.001;
41  sigmalimhighEE_ = 0.4;
44 
45  recHitsEB_ = cc.consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsEBLabel"));
46  recHitsEE_ = cc.consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsEELabel"));
47  autoDetectBunchSpacing_ = conf.getParameter<bool>("autoDetectBunchSpacing");
48 
50  bunchSpacing_ = cc.consumes<unsigned int>(edm::InputTag("bunchSpacingProducer"));
52  } else {
53  bunchSpacingManual_ = conf.getParameter<int>("bunchSpacing");
54  }
55 
57  {"ecalPFClusterCorV2_EB_pfSize1_mean_25ns",
58  "ecalPFClusterCorV2_EB_pfSize2_mean_25ns",
59  "ecalPFClusterCorV2_EB_pfSize3_ptbin1_mean_25ns",
60  "ecalPFClusterCorV2_EB_pfSize3_ptbin2_mean_25ns",
61  "ecalPFClusterCorV2_EB_pfSize3_ptbin3_mean_25ns",
62  "ecalPFClusterCorV2_EE_pfSize1_mean_25ns",
63  "ecalPFClusterCorV2_EE_pfSize2_mean_25ns",
64  "ecalPFClusterCorV2_EE_pfSize3_ptbin1_mean_25ns",
65  "ecalPFClusterCorV2_EE_pfSize3_ptbin2_mean_25ns",
66  "ecalPFClusterCorV2_EE_pfSize3_ptbin3_mean_25ns"});
68  {"ecalPFClusterCorV2_EB_pfSize1_sigma_25ns",
69  "ecalPFClusterCorV2_EB_pfSize2_sigma_25ns",
70  "ecalPFClusterCorV2_EB_pfSize3_ptbin1_sigma_25ns",
71  "ecalPFClusterCorV2_EB_pfSize3_ptbin2_sigma_25ns",
72  "ecalPFClusterCorV2_EB_pfSize3_ptbin3_sigma_25ns",
73  "ecalPFClusterCorV2_EE_pfSize1_sigma_25ns",
74  "ecalPFClusterCorV2_EE_pfSize2_sigma_25ns",
75  "ecalPFClusterCorV2_EE_pfSize3_ptbin1_sigma_25ns",
76  "ecalPFClusterCorV2_EE_pfSize3_ptbin2_sigma_25ns",
77  "ecalPFClusterCorV2_EE_pfSize3_ptbin3_sigma_25ns"});
79  {"ecalPFClusterCorV2_EB_pfSize1_mean_50ns",
80  "ecalPFClusterCorV2_EB_pfSize2_mean_50ns",
81  "ecalPFClusterCorV2_EB_pfSize3_ptbin1_mean_50ns",
82  "ecalPFClusterCorV2_EB_pfSize3_ptbin2_mean_50ns",
83  "ecalPFClusterCorV2_EB_pfSize3_ptbin3_mean_50ns",
84  "ecalPFClusterCorV2_EE_pfSize1_mean_50ns",
85  "ecalPFClusterCorV2_EE_pfSize2_mean_50ns",
86  "ecalPFClusterCorV2_EE_pfSize3_ptbin1_mean_50ns",
87  "ecalPFClusterCorV2_EE_pfSize3_ptbin2_mean_50ns",
88  "ecalPFClusterCorV2_EE_pfSize3_ptbin3_mean_50ns"});
90  {"ecalPFClusterCorV2_EB_pfSize1_sigma_50ns",
91  "ecalPFClusterCorV2_EB_pfSize2_sigma_50ns",
92  "ecalPFClusterCorV2_EB_pfSize3_ptbin1_sigma_50ns",
93  "ecalPFClusterCorV2_EB_pfSize3_ptbin2_sigma_50ns",
94  "ecalPFClusterCorV2_EB_pfSize3_ptbin3_sigma_50ns",
95  "ecalPFClusterCorV2_EE_pfSize1_sigma_50ns",
96  "ecalPFClusterCorV2_EE_pfSize2_sigma_50ns",
97  "ecalPFClusterCorV2_EE_pfSize3_ptbin1_sigma_50ns",
98  "ecalPFClusterCorV2_EE_pfSize3_ptbin2_sigma_50ns",
99  "ecalPFClusterCorV2_EE_pfSize3_ptbin3_sigma_50ns"});
100 
101  if (srfAwareCorrection_) {
102  sigmalimlowEE_ = 0.001;
103  sigmalimhighEE_ = 0.1;
106 
107  ebSrFlagToken_ = cc.consumes<EBSrFlagCollection>(conf.getParameter<edm::InputTag>("ebSrFlagLabel"));
108  eeSrFlagToken_ = cc.consumes<EESrFlagCollection>(conf.getParameter<edm::InputTag>("eeSrFlagLabel"));
109 
110  condnames_mean_.insert(condnames_mean_.end(),
111  {"ecalPFClusterCor2017V2_EB_ZS_mean_25ns",
112  "ecalPFClusterCor2017V2_EB_Full_ptbin1_mean_25ns",
113  "ecalPFClusterCor2017V2_EB_Full_ptbin2_mean_25ns",
114  "ecalPFClusterCor2017V2_EB_Full_ptbin3_mean_25ns",
115  "ecalPFClusterCor2017V2_EE_ZS_mean_25ns",
116  "ecalPFClusterCor2017V2_EE_Full_ptbin1_mean_25ns",
117  "ecalPFClusterCor2017V2_EE_Full_ptbin2_mean_25ns",
118  "ecalPFClusterCor2017V2_EE_Full_ptbin3_mean_25ns"});
119 
120  condnames_sigma_.insert(condnames_sigma_.end(),
121  {"ecalPFClusterCor2017V2_EB_ZS_sigma_25ns",
122  "ecalPFClusterCor2017V2_EB_Full_ptbin1_sigma_25ns",
123  "ecalPFClusterCor2017V2_EB_Full_ptbin2_sigma_25ns",
124  "ecalPFClusterCor2017V2_EB_Full_ptbin3_sigma_25ns",
125  "ecalPFClusterCor2017V2_EE_ZS_sigma_25ns",
126  "ecalPFClusterCor2017V2_EE_Full_ptbin1_sigma_25ns",
127  "ecalPFClusterCor2017V2_EE_Full_ptbin2_sigma_25ns",
128  "ecalPFClusterCor2017V2_EE_Full_ptbin3_sigma_25ns"});
129  }
130  }
131 }

References eostools::move().

◆ PFClusterEMEnergyCorrector() [2/2]

PFClusterEMEnergyCorrector::PFClusterEMEnergyCorrector ( const PFClusterEMEnergyCorrector )
delete

Member Function Documentation

◆ correctEnergies()

void PFClusterEMEnergyCorrector::correctEnergies ( const edm::Event evt,
const edm::EventSetup es,
const reco::PFCluster::EEtoPSAssociation assoc,
reco::PFClusterCollection cs 
)

a hit can be ZS or forced ZS. A hit can be in Full readout or Forced to be FULL readout if it is ZS, then clusFlag (in binary) = 0001 if it is forced ZS, then clusFlag (in binary) = 0101 if it is FR, then clusFlag (in binary) = 0011 if it is forced FR, then clusFlag (in binary) = 0111 i.e 3rd bit is set. Even if it is forced, we should mark it is as ZS or FR. To take care of it, just check the LSB and second LSB(SLSB)

it is clusFlag==1, 5

Definition at line 133 of file PFClusterEMEnergyCorrector.cc.

136  {
137  // First deal with pre-MVA corrections
138  // Kept for backward compatibility (and for HLT)
139  if (!applyMVACorrections_) {
140  for (unsigned int idx = 0; idx < cs.size(); ++idx) {
141  reco::PFCluster &cluster = cs[idx];
142  bool iseb = cluster.layer() == PFLayer::ECAL_BARREL;
143  float ePS1 = 0., ePS2 = 0.;
144  if (!iseb)
145  getAssociatedPSEnergy(idx, assoc, ePS1, ePS2);
146  double correctedEnergy = calibrator_->energyEm(cluster, ePS1, ePS2, applyCrackCorrections_);
147  cluster.setCorrectedEnergy(correctedEnergy);
148  }
149  return;
150  }
151 
152  // Common objects for SRF-aware and old style corrections
154  EcalReadoutTools readoutTool(evt, es, ecalReadoutToolsESGetTokens_);
155 
156  if (!srfAwareCorrection_) {
157  int bunchspacing = 450;
159  edm::Handle<unsigned int> bunchSpacingH;
160  evt.getByToken(bunchSpacing_, bunchSpacingH);
161  bunchspacing = *bunchSpacingH;
162  } else {
163  bunchspacing = bunchSpacingManual_;
164  }
165 
166  const std::vector<std::string> &condnames_mean = (bunchspacing == 25) ? condnames_mean_25ns_ : condnames_mean_50ns_;
167  const std::vector<std::string> &condnames_sigma =
168  (bunchspacing == 25) ? condnames_sigma_25ns_ : condnames_sigma_50ns_;
169  const unsigned int ncor = condnames_mean.size();
170  std::vector<edm::ESHandle<GBRForestD> > forestH_mean(ncor);
171  std::vector<edm::ESHandle<GBRForestD> > forestH_sigma(ncor);
172 
173  for (unsigned int icor = 0; icor < ncor; ++icor) {
174  es.get<GBRDWrapperRcd>().get(condnames_mean[icor], forestH_mean[icor]);
175  es.get<GBRDWrapperRcd>().get(condnames_sigma[icor], forestH_sigma[icor]);
176  }
177 
178  std::array<float, 5> eval;
179  for (unsigned int idx = 0; idx < cs.size(); ++idx) {
180  reco::PFCluster &cluster = cs[idx];
181  bool iseb = cluster.layer() == PFLayer::ECAL_BARREL;
182  float ePS1 = 0., ePS2 = 0.;
183  if (!iseb)
184  getAssociatedPSEnergy(idx, assoc, ePS1, ePS2);
185 
186  double e = cluster.energy();
187  double pt = cluster.pt();
188  double evale = e;
190  evale *= maxPtForMVAEvaluation_ / pt;
191  }
192  double invE = (e == 0.) ? 0. : 1. / e; //guard against dividing by 0.
193  int size = lazyTool.n5x5(cluster);
194 
195  int ietaix = 0;
196  int iphiiy = 0;
197  if (iseb) {
198  EBDetId ebseed(cluster.seed());
199  ietaix = ebseed.ieta();
200  iphiiy = ebseed.iphi();
201  } else {
202  EEDetId eeseed(cluster.seed());
203  ietaix = eeseed.ix();
204  iphiiy = eeseed.iy();
205  }
206 
207  //find index of corrections (0-4 for EB, 5-9 for EE, depending on cluster size and raw pt)
208  int coridx = std::min(size, 3) - 1;
209  if (coridx == 2) {
210  if (pt > 4.5) {
211  coridx += 1;
212  }
213  if (pt > 18.) {
214  coridx += 1;
215  }
216  }
217  if (!iseb) {
218  coridx += 5;
219  }
220 
221  const GBRForestD &meanforest = *forestH_mean[coridx].product();
222  const GBRForestD &sigmaforest = *forestH_sigma[coridx].product();
223 
224  //fill array for forest evaluation
225  eval[0] = evale;
226  eval[1] = ietaix;
227  eval[2] = iphiiy;
228  if (!iseb) {
229  eval[3] = ePS1 * invE;
230  eval[4] = ePS2 * invE;
231  }
232 
233  //these are the actual BDT responses
234  double rawmean = meanforest.GetResponse(eval.data());
235  double rawsigma = sigmaforest.GetResponse(eval.data());
236 
237  //apply transformation to limited output range (matching the training)
238  double mean = iseb ? meanoffsetEB_ + meanscaleEB_ * vdt::fast_sin(rawmean)
239  : meanoffsetEE_ + meanscaleEE_ * vdt::fast_sin(rawmean);
240  double sigma = iseb ? sigmaoffsetEB_ + sigmascaleEB_ * vdt::fast_sin(rawsigma)
241  : sigmaoffsetEE_ + sigmascaleEE_ * vdt::fast_sin(rawsigma);
242 
243  //regression target is ln(Etrue/Eraw)
244  //so corrected energy is ecor=exp(mean)*e, uncertainty is exp(mean)*eraw*sigma=ecor*sigma
245  double ecor = vdt::fast_exp(mean) * e;
246  double sigmacor = sigma * ecor;
247 
248  cluster.setCorrectedEnergy(ecor);
250  cluster.setCorrectedEnergyUncertainty(sigmacor);
251  else
252  cluster.setCorrectedEnergyUncertainty(0.);
253  }
254  return;
255  }
256 
257  // Selective Readout Flags
260  evt.getByToken(ebSrFlagToken_, ebSrFlags);
261  evt.getByToken(eeSrFlagToken_, eeSrFlags);
262  if (!ebSrFlags.isValid() || !eeSrFlags.isValid())
263  throw cms::Exception("PFClusterEMEnergyCorrector")
264  << "This version of PFCluster corrections requires the SrFlagCollection information to proceed!\n";
265 
266  const unsigned int ncor = condnames_mean_.size();
267 
268  std::vector<edm::ESHandle<GBRForestD> > forestH_mean(ncor);
269  std::vector<edm::ESHandle<GBRForestD> > forestH_sigma(ncor);
270 
271  for (unsigned int icor = 0; icor < ncor; ++icor) {
272  es.get<GBRDWrapperRcd>().get(condnames_mean_[icor], forestH_mean[icor]);
273  es.get<GBRDWrapperRcd>().get(condnames_sigma_[icor], forestH_sigma[icor]);
274  }
275 
276  std::array<float, 6> evalEB;
277  std::array<float, 5> evalEE;
278 
279  for (unsigned int idx = 0; idx < cs.size(); ++idx) {
280  reco::PFCluster &cluster = cs[idx];
281  bool iseb = cluster.layer() == PFLayer::ECAL_BARREL;
282  float ePS1 = 0., ePS2 = 0.;
283  if (!iseb)
284  getAssociatedPSEnergy(idx, assoc, ePS1, ePS2);
285 
286  double e = cluster.energy();
287  double pt = cluster.pt();
288  double evale = e;
290  evale *= maxPtForMVAEvaluation_ / pt;
291  }
292  double invE = (e == 0.) ? 0. : 1. / e; //guard against dividing by 0.
293  int size = lazyTool.n5x5(cluster);
294  int reducedHits = size;
295  if (size >= 3)
296  reducedHits = 3;
297 
298  int ietaix = 0;
299  int iphiiy = 0;
300  if (iseb) {
301  EBDetId ebseed(cluster.seed());
302  ietaix = ebseed.ieta();
303  iphiiy = ebseed.iphi();
304  } else {
305  EEDetId eeseed(cluster.seed());
306  ietaix = eeseed.ix();
307  iphiiy = eeseed.iy();
308  }
309 
310  // Hardcoded number are positions of modules boundaries of ECAL
311  int signeta = (ietaix > 0) ? 1 : -1;
312  int ietamod20 = (std::abs(ietaix) < 26) ? ietaix - signeta : (ietaix - 26 * signeta) % 20;
313  int iphimod20 = (iphiiy - 1) % 20;
314 
315  int clusFlag = 0;
316  if (iseb) {
317  auto ecalUnit = readoutTool.readOutUnitOf(static_cast<EBDetId>(cluster.seed()));
318  EBSrFlagCollection::const_iterator srf = ebSrFlags->find(ecalUnit);
319  if (srf != ebSrFlags->end())
320  clusFlag = srf->value();
321  else
322  clusFlag = 3;
323  } else {
324  auto ecalUnit = readoutTool.readOutUnitOf(static_cast<EEDetId>(cluster.seed()));
325  EESrFlagCollection::const_iterator srf = eeSrFlags->find(ecalUnit);
326  if (srf != eeSrFlags->end())
327  clusFlag = srf->value();
328  else
329  clusFlag = 3;
330  }
331 
332  //find index of corrections (0-3 for EB, 4-7 for EE, depending on cluster size and raw pt)
333  int coridx = 0;
334  int regind = 0;
335  if (!iseb)
336  regind = 4;
337 
347  int ZS_bit = clusFlag >> 0 & 1;
348  int FR_bit = clusFlag >> 1 & 1;
349 
350  if (ZS_bit != 0 && FR_bit == 0)
351  coridx = 0 + regind;
352  else {
353  if (pt < 2.5)
354  coridx = 1 + regind;
355  else if (pt >= 2.5 && pt < 6.)
356  coridx = 2 + regind;
357  else if (pt >= 6.)
358  coridx = 3 + regind;
359  }
360  if (ZS_bit == 0 || clusFlag > 7) {
361  edm::LogWarning("PFClusterEMEnergyCorrector")
362  << "We can only correct regions readout in ZS (flag 1,5) or FULL readout (flag 3,7). Flag " << clusFlag
363  << " is not recognized."
364  << "\n"
365  << "Assuming FULL readout and continuing";
366  }
367 
368  const GBRForestD &meanforest = *forestH_mean[coridx].product();
369  const GBRForestD &sigmaforest = *forestH_sigma[coridx].product();
370 
371  //fill array for forest evaluation
372  if (iseb) {
373  evalEB[0] = evale;
374  evalEB[1] = ietaix;
375  evalEB[2] = iphiiy;
376  evalEB[3] = ietamod20;
377  evalEB[4] = iphimod20;
378  evalEB[5] = reducedHits;
379  } else {
380  evalEE[0] = evale;
381  evalEE[1] = ietaix;
382  evalEE[2] = iphiiy;
383  evalEE[3] = (ePS1 + ePS2) * invE;
384  evalEE[4] = reducedHits;
385  }
386 
387  //these are the actual BDT responses
388  double rawmean = 1;
389  double rawsigma = 0;
390 
391  if (iseb) {
392  rawmean = meanforest.GetResponse(evalEB.data());
393  rawsigma = sigmaforest.GetResponse(evalEB.data());
394  } else {
395  rawmean = meanforest.GetResponse(evalEE.data());
396  rawsigma = sigmaforest.GetResponse(evalEE.data());
397  }
398 
399  //apply transformation to limited output range (matching the training)
400  //the training was done with different transformations for EB and EE (width only)
401  //makes a the code a bit more cumbersome, but it is not a problem per se
402  double mean = iseb ? meanoffsetEB_ + meanscaleEB_ * vdt::fast_sin(rawmean)
403  : meanoffsetEE_ + meanscaleEE_ * vdt::fast_sin(rawmean);
404  double sigma = iseb ? sigmaoffsetEB_ + sigmascaleEB_ * vdt::fast_sin(rawsigma)
405  : sigmaoffsetEE_ + sigmascaleEE_ * vdt::fast_sin(rawsigma);
406 
407  //regression target is ln(Etrue/Eraw)
408  //so corrected energy is ecor=exp(mean)*e, uncertainty is exp(mean)*eraw*sigma=ecor*sigma
409  double ecor = iseb ? vdt::fast_exp(mean) * e : vdt::fast_exp(mean) * (e + ePS1 + ePS2);
410  double sigmacor = sigma * ecor;
411 
412  LogDebug("PFClusterEMEnergyCorrector")
413  << "ieta : iphi : ietamod20 : iphimod20 : size : reducedHits = " << ietaix << " " << iphiiy << " " << ietamod20
414  << " " << iphimod20 << " " << size << " " << reducedHits << "\n"
415  << "isEB : eraw : ePS1 : ePS2 : (eps1+eps2)/raw : Flag = " << iseb << " " << evale << " " << ePS1 << " " << ePS2
416  << " " << (ePS1 + ePS2) / evale << " " << clusFlag << "\n"
417  << "response : correction = " << exp(mean) << " " << ecor;
418 
419  cluster.setCorrectedEnergy(ecor);
421  cluster.setCorrectedEnergyUncertainty(sigmacor);
422  else
423  cluster.setCorrectedEnergyUncertainty(0.);
424  }
425 }

References funct::abs(), applyCrackCorrections_, applyMVACorrections_, trackingPlots::assoc, autoDetectBunchSpacing_, bunchSpacing_, bunchSpacingManual_, calibrator_, condnames_mean_, condnames_mean_25ns_, condnames_mean_50ns_, condnames_sigma_, condnames_sigma_25ns_, condnames_sigma_50ns_, fwrapper::cs, MillePedeFileConverter_cfg::e, ebSrFlagToken_, PFLayer::ECAL_BARREL, ecalClusterToolsESGetTokens_, ecalReadoutToolsESGetTokens_, eeSrFlagToken_, edm::SortedCollection< T, SORT >::end(), reco::PFCluster::energy(), JetChargeProducer_cfi::exp, edm::SortedCollection< T, SORT >::find(), EcalClusterLazyToolsBase::ESGetTokens::get(), edm::EventSetup::get(), get, getAssociatedPSEnergy(), edm::Event::getByToken(), GBRForestD::GetResponse(), heavyIonCSV_trainingSettings::idx, EBDetId::ieta(), edm::HandleBase::isValid(), EEDetId::ix(), reco::PFCluster::layer(), LogDebug, maxPtForMVAEvaluation_, SiStripPI::mean, meanoffsetEB_, meanoffsetEE_, meanscaleEB_, meanscaleEE_, min(), DiDispStaMuonMonitor_cfi::pt, reco::PFCluster::pt(), recHitsEB_, recHitsEE_, reco::CaloCluster::seed(), reco::CaloCluster::setCorrectedEnergy(), reco::CaloCluster::setCorrectedEnergyUncertainty(), setEnergyUncertainty_, sigmaoffsetEB_, sigmaoffsetEE_, sigmascaleEB_, sigmascaleEE_, findQualityFiles::size, and srfAwareCorrection_.

◆ getAssociatedPSEnergy()

void PFClusterEMEnergyCorrector::getAssociatedPSEnergy ( const size_t  clusIdx,
const reco::PFCluster::EEtoPSAssociation assoc,
float &  e1,
float &  e2 
)
private

Definition at line 427 of file PFClusterEMEnergyCorrector.cc.

430  {
431  e1 = 0;
432  e2 = 0;
433  auto ee_key_val = std::make_pair(clusIdx, edm::Ptr<reco::PFCluster>());
434  const auto clustops = std::equal_range(assoc.begin(), assoc.end(), ee_key_val, sortByKey);
435  for (auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
436  edm::Ptr<reco::PFCluster> psclus(i_ps->second);
437  switch (psclus->layer()) {
438  case PFLayer::PS1:
439  e1 += psclus->energy();
440  break;
441  case PFLayer::PS2:
442  e2 += psclus->energy();
443  break;
444  default:
445  break;
446  }
447  }
448 }

References trackingPlots::assoc, StorageManager_cfg::e1, reco::PFCluster::energy(), reco::PFCluster::layer(), PFLayer::PS1, PFLayer::PS2, and sortByKey().

Referenced by correctEnergies().

◆ operator=()

PFClusterEMEnergyCorrector& PFClusterEMEnergyCorrector::operator= ( const PFClusterEMEnergyCorrector )
delete

Member Data Documentation

◆ applyCrackCorrections_

bool PFClusterEMEnergyCorrector::applyCrackCorrections_
private

Definition at line 60 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ applyMVACorrections_

bool PFClusterEMEnergyCorrector::applyMVACorrections_
private

Definition at line 61 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ autoDetectBunchSpacing_

bool PFClusterEMEnergyCorrector::autoDetectBunchSpacing_
private

Definition at line 64 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ bunchSpacing_

edm::EDGetTokenT<unsigned int> PFClusterEMEnergyCorrector::bunchSpacing_
private

Definition at line 46 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ bunchSpacingManual_

int PFClusterEMEnergyCorrector::bunchSpacingManual_
private

Definition at line 65 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ calibrator_

std::unique_ptr<PFEnergyCalibration> PFClusterEMEnergyCorrector::calibrator_
private

Definition at line 67 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_mean_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_mean_
private

Definition at line 51 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_mean_25ns_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_mean_25ns_
private

Definition at line 54 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_mean_50ns_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_mean_50ns_
private

Definition at line 56 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_sigma_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_sigma_
private

Definition at line 52 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_sigma_25ns_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_sigma_25ns_
private

Definition at line 55 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_sigma_50ns_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_sigma_50ns_
private

Definition at line 57 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ ebSrFlagToken_

edm::EDGetTokenT<EBSrFlagCollection> PFClusterEMEnergyCorrector::ebSrFlagToken_
private

Definition at line 40 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ ecalClusterToolsESGetTokens_

const EcalClusterLazyTools::ESGetTokens PFClusterEMEnergyCorrector::ecalClusterToolsESGetTokens_
private

Definition at line 48 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ ecalReadoutToolsESGetTokens_

const EcalReadoutTools::ESGetTokens PFClusterEMEnergyCorrector::ecalReadoutToolsESGetTokens_
private

Definition at line 49 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ eeSrFlagToken_

edm::EDGetTokenT<EESrFlagCollection> PFClusterEMEnergyCorrector::eeSrFlagToken_
private

Definition at line 41 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ maxPtForMVAEvaluation_

double PFClusterEMEnergyCorrector::maxPtForMVAEvaluation_
private

Definition at line 38 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ meanlimhighEB_

double PFClusterEMEnergyCorrector::meanlimhighEB_
private

Definition at line 74 of file PFClusterEMEnergyCorrector.h.

◆ meanlimhighEE_

double PFClusterEMEnergyCorrector::meanlimhighEE_
private

Definition at line 79 of file PFClusterEMEnergyCorrector.h.

◆ meanlimlowEB_

double PFClusterEMEnergyCorrector::meanlimlowEB_
private

Definition at line 73 of file PFClusterEMEnergyCorrector.h.

◆ meanlimlowEE_

double PFClusterEMEnergyCorrector::meanlimlowEE_
private

Definition at line 78 of file PFClusterEMEnergyCorrector.h.

◆ meanoffsetEB_

double PFClusterEMEnergyCorrector::meanoffsetEB_
private

Definition at line 75 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ meanoffsetEE_

double PFClusterEMEnergyCorrector::meanoffsetEE_
private

Definition at line 80 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ meanscaleEB_

double PFClusterEMEnergyCorrector::meanscaleEB_
private

Definition at line 76 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ meanscaleEE_

double PFClusterEMEnergyCorrector::meanscaleEE_
private

Definition at line 81 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ recHitsEB_

edm::EDGetTokenT<EcalRecHitCollection> PFClusterEMEnergyCorrector::recHitsEB_
private

Definition at line 44 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ recHitsEE_

edm::EDGetTokenT<EcalRecHitCollection> PFClusterEMEnergyCorrector::recHitsEE_
private

Definition at line 45 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ setEnergyUncertainty_

bool PFClusterEMEnergyCorrector::setEnergyUncertainty_
private

Definition at line 62 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ sigmalimhighEB_

double PFClusterEMEnergyCorrector::sigmalimhighEB_
private

Definition at line 84 of file PFClusterEMEnergyCorrector.h.

◆ sigmalimhighEE_

double PFClusterEMEnergyCorrector::sigmalimhighEE_
private

Definition at line 89 of file PFClusterEMEnergyCorrector.h.

◆ sigmalimlowEB_

double PFClusterEMEnergyCorrector::sigmalimlowEB_
private

Definition at line 83 of file PFClusterEMEnergyCorrector.h.

◆ sigmalimlowEE_

double PFClusterEMEnergyCorrector::sigmalimlowEE_
private

Definition at line 88 of file PFClusterEMEnergyCorrector.h.

◆ sigmaoffsetEB_

double PFClusterEMEnergyCorrector::sigmaoffsetEB_
private

Definition at line 85 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ sigmaoffsetEE_

double PFClusterEMEnergyCorrector::sigmaoffsetEE_
private

Definition at line 90 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ sigmascaleEB_

double PFClusterEMEnergyCorrector::sigmascaleEB_
private

Definition at line 86 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ sigmascaleEE_

double PFClusterEMEnergyCorrector::sigmascaleEE_
private

Definition at line 91 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ srfAwareCorrection_

bool PFClusterEMEnergyCorrector::srfAwareCorrection_
private

Definition at line 59 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

PFClusterEMEnergyCorrector::ecalClusterToolsESGetTokens_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
Definition: PFClusterEMEnergyCorrector.h:48
PFClusterEMEnergyCorrector::sigmalimhighEE_
double sigmalimhighEE_
Definition: PFClusterEMEnergyCorrector.h:89
EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
PFClusterEMEnergyCorrector::meanoffsetEE_
double meanoffsetEE_
Definition: PFClusterEMEnergyCorrector.h:80
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
GBRForestD::GetResponse
double GetResponse(const float *vector) const
Definition: GBRForestD.h:52
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
PFClusterEMEnergyCorrector::calibrator_
std::unique_ptr< PFEnergyCalibration > calibrator_
Definition: PFClusterEMEnergyCorrector.h:67
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:47
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
reco::PFCluster::layer
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:56
min
T min(T a, T b)
Definition: MathUtil.h:58
EBDetId
Definition: EBDetId.h:17
reco::CaloCluster::setCorrectedEnergy
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:137
PFClusterEMEnergyCorrector::sigmalimlowEB_
double sigmalimlowEB_
Definition: PFClusterEMEnergyCorrector.h:83
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
GBRDWrapperRcd
Definition: GBRDWrapperRcd.h:24
PFClusterEMEnergyCorrector::autoDetectBunchSpacing_
bool autoDetectBunchSpacing_
Definition: PFClusterEMEnergyCorrector.h:64
PFClusterEMEnergyCorrector::applyMVACorrections_
bool applyMVACorrections_
Definition: PFClusterEMEnergyCorrector.h:61
edm::SortedCollection< EcalRecHit >
PFClusterEMEnergyCorrector::getAssociatedPSEnergy
void getAssociatedPSEnergy(const size_t clusIdx, const reco::PFCluster::EEtoPSAssociation &assoc, float &e1, float &e2)
Definition: PFClusterEMEnergyCorrector.cc:427
PFClusterEMEnergyCorrector::meanlimlowEB_
double meanlimlowEB_
Definition: PFClusterEMEnergyCorrector.h:73
PFClusterEMEnergyCorrector::srfAwareCorrection_
bool srfAwareCorrection_
Definition: PFClusterEMEnergyCorrector.h:59
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
PFClusterEMEnergyCorrector::recHitsEB_
edm::EDGetTokenT< EcalRecHitCollection > recHitsEB_
Definition: PFClusterEMEnergyCorrector.h:44
PFClusterEMEnergyCorrector::meanscaleEE_
double meanscaleEE_
Definition: PFClusterEMEnergyCorrector.h:81
PFLayer::ECAL_BARREL
Definition: PFLayer.h:33
PFClusterEMEnergyCorrector::sigmalimlowEE_
double sigmalimlowEE_
Definition: PFClusterEMEnergyCorrector.h:88
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
trackingPlots.assoc
assoc
Definition: trackingPlots.py:184
PFClusterEMEnergyCorrector::meanscaleEB_
double meanscaleEB_
Definition: PFClusterEMEnergyCorrector.h:76
reco::PFCluster::energy
double energy() const
cluster energy
Definition: PFCluster.h:74
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
PFLayer::PS1
Definition: PFLayer.h:31
PFClusterEMEnergyCorrector::setEnergyUncertainty_
bool setEnergyUncertainty_
Definition: PFClusterEMEnergyCorrector.h:62
PFClusterEMEnergyCorrector::sigmascaleEB_
double sigmascaleEB_
Definition: PFClusterEMEnergyCorrector.h:86
PFEnergyCalibration
Definition: PFEnergyCalibration.h:42
GBRForestD
Definition: GBRForestD.h:27
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
PFClusterEMEnergyCorrector::bunchSpacing_
edm::EDGetTokenT< unsigned int > bunchSpacing_
Definition: PFClusterEMEnergyCorrector.h:46
EcalClusterLazyTools
EEDetId
Definition: EEDetId.h:14
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
PFClusterEMEnergyCorrector::condnames_mean_25ns_
std::vector< std::string > condnames_mean_25ns_
Definition: PFClusterEMEnergyCorrector.h:54
PFClusterEMEnergyCorrector::condnames_mean_50ns_
std::vector< std::string > condnames_mean_50ns_
Definition: PFClusterEMEnergyCorrector.h:56
PFClusterEMEnergyCorrector::ebSrFlagToken_
edm::EDGetTokenT< EBSrFlagCollection > ebSrFlagToken_
Definition: PFClusterEMEnergyCorrector.h:40
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
reco::CaloCluster::setCorrectedEnergyUncertainty
void setCorrectedEnergyUncertainty(float energyerr)
Definition: CaloCluster.h:138
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
PFClusterEMEnergyCorrector::meanlimhighEB_
double meanlimhighEB_
Definition: PFClusterEMEnergyCorrector.h:74
PFClusterEMEnergyCorrector::condnames_sigma_50ns_
std::vector< std::string > condnames_sigma_50ns_
Definition: PFClusterEMEnergyCorrector.h:57
PFClusterEMEnergyCorrector::sigmalimhighEB_
double sigmalimhighEB_
Definition: PFClusterEMEnergyCorrector.h:84
PFClusterEMEnergyCorrector::meanoffsetEB_
double meanoffsetEB_
Definition: PFClusterEMEnergyCorrector.h:75
get
#define get
cc
PFClusterEMEnergyCorrector::sigmaoffsetEE_
double sigmaoffsetEE_
Definition: PFClusterEMEnergyCorrector.h:90
reco::CaloCluster::seed
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:219
EcalClusterLazyToolsBase::ESGetTokens::get
ESData get(edm::EventSetup const &eventSetup) const
Definition: EcalClusterLazyTools.h:64
edm::Ptr< reco::PFCluster >
PFClusterEMEnergyCorrector::meanlimlowEE_
double meanlimlowEE_
Definition: PFClusterEMEnergyCorrector.h:78
PFClusterEMEnergyCorrector::ecalReadoutToolsESGetTokens_
const EcalReadoutTools::ESGetTokens ecalReadoutToolsESGetTokens_
Definition: PFClusterEMEnergyCorrector.h:49
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
eostools.move
def move(src, dest)
Definition: eostools.py:511
PFClusterEMEnergyCorrector::condnames_sigma_25ns_
std::vector< std::string > condnames_sigma_25ns_
Definition: PFClusterEMEnergyCorrector.h:55
PFClusterEMEnergyCorrector::recHitsEE_
edm::EDGetTokenT< EcalRecHitCollection > recHitsEE_
Definition: PFClusterEMEnergyCorrector.h:45
reco::PFCluster::pt
double pt() const
transverse momentum, massless approximation
Definition: PFCluster.h:110
PFClusterEMEnergyCorrector::applyCrackCorrections_
bool applyCrackCorrections_
Definition: PFClusterEMEnergyCorrector.h:60
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
PFClusterEMEnergyCorrector::condnames_mean_
std::vector< std::string > condnames_mean_
Definition: PFClusterEMEnergyCorrector.h:51
PFClusterEMEnergyCorrector::meanlimhighEE_
double meanlimhighEE_
Definition: PFClusterEMEnergyCorrector.h:79
PFClusterEMEnergyCorrector::sigmascaleEE_
double sigmascaleEE_
Definition: PFClusterEMEnergyCorrector.h:91
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
sortByKey
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
Definition: PFClusterMatchedToPhotonsSelector.cc:41
PFClusterEMEnergyCorrector::condnames_sigma_
std::vector< std::string > condnames_sigma_
Definition: PFClusterEMEnergyCorrector.h:52
cms::Exception
Definition: Exception.h:70
PFClusterEMEnergyCorrector::maxPtForMVAEvaluation_
double maxPtForMVAEvaluation_
Definition: PFClusterEMEnergyCorrector.h:38
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
PFClusterEMEnergyCorrector::sigmaoffsetEB_
double sigmaoffsetEB_
Definition: PFClusterEMEnergyCorrector.h:85
EcalReadoutTools
Definition: EcalReadoutTools.h:12
PFClusterEMEnergyCorrector::eeSrFlagToken_
edm::EDGetTokenT< EESrFlagCollection > eeSrFlagToken_
Definition: PFClusterEMEnergyCorrector.h:41
PFLayer::PS2
Definition: PFLayer.h:30
edm::InputTag
Definition: InputTag.h:15
PFClusterEMEnergyCorrector::bunchSpacingManual_
int bunchSpacingManual_
Definition: PFClusterEMEnergyCorrector.h:65
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37