CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
ElectronEnergyCalibrator Class Reference

#include <ElectronEnergyCalibrator.h>

Public Types

enum  EventType { EventType::DATA, EventType::MC }
 

Public Member Functions

std::array< float, EGEnergySysIndex::kNrSysErrscalibrate (reco::GsfElectron &ele, const unsigned int runNumber, const EcalRecHitCollection *recHits, const float smearNrSigma, const EventType eventType) const
 
std::array< float, EGEnergySysIndex::kNrSysErrscalibrate (reco::GsfElectron &ele, const unsigned int runNumber, const EcalRecHitCollection *recHits, edm::StreamID const &id, const EventType eventType) const
 
void calibrate (SimpleElectron &electron, edm::StreamID const &)
 
void correctLinearity (SimpleElectron &electron)
 
 ElectronEnergyCalibrator ()
 
 ElectronEnergyCalibrator (const EpCombinationTool &combinator, const std::string &correctionFile)
 
 ElectronEnergyCalibrator (const std::string pathData, const std::string pathLinData, const std::string dataset, int correctionsType, bool applyLinearityCorrection, double lumiRatio, bool isMC, bool updateEnergyErrors, bool verbose, bool synchronization)
 
void initPrivateRng (TRandom *rnd)
 
void setMinEt (float val)
 
 ~ElectronEnergyCalibrator ()
 

Private Member Functions

std::pair< float, float > calCombinedMom (reco::GsfElectron &ele, const float scale, const float smear) const
 
double gauss (edm::StreamID const &id) const
 
void init ()
 
void setEcalEnergy (reco::GsfElectron &ele, const float scale, const float smear) const
 
void setEnergyAndSystVarations (const float scale, const float smearNrSigma, const float et, const EnergyScaleCorrection::ScaleCorrection &scaleCorr, const EnergyScaleCorrection::SmearCorrection &smearCorr, reco::GsfElectron &ele, std::array< float, EGEnergySysIndex::kNrSysErrs > &energyData) const
 
void splitString (const std::string &fullstr, std::vector< std::string > &elements, const std::string &delimiter)
 
double stringToDouble (const std::string &str)
 

Private Attributes

bool applyLinearityCorrection_
 
EnergyScaleCorrection correctionRetriever_
 
int correctionsType_
 
correctionValues corrValArray [100]
 
correctionValues corrValMC
 
std::string dataset_
 
const EpCombinationToolepCombinationTool_
 
bool isMC_
 
linearityCorrectionValues linCorrValArray [100]
 
double lumiRatio_
 
float minEt_
 
int nCorrValRaw
 
double newEnergy_
 
double newEnergyError_
 
int nLinCorrValRaw
 
std::string pathData_
 
std::string pathLinData_
 
TRandom * rng_
 
bool synchronization_
 
bool updateEnergyErrors_
 
bool verbose_
 

Static Private Attributes

static const EnergyScaleCorrection::ScaleCorrection defaultScaleCorr_
 
static const EnergyScaleCorrection::SmearCorrection defaultSmearCorr_
 

Detailed Description

Definition at line 39 of file ElectronEnergyCalibrator.h.

Member Enumeration Documentation

◆ EventType

Enumerator
DATA 
MC 

Definition at line 26 of file ElectronEnergyCalibrator.h.

26  {
27  DATA,
28  MC,
29  };

Constructor & Destructor Documentation

◆ ElectronEnergyCalibrator() [1/3]

ElectronEnergyCalibrator::ElectronEnergyCalibrator ( const std::string  pathData,
const std::string  pathLinData,
const std::string  dataset,
int  correctionsType,
bool  applyLinearityCorrection,
double  lumiRatio,
bool  isMC,
bool  updateEnergyErrors,
bool  verbose,
bool  synchronization 
)
inline

Definition at line 41 of file ElectronEnergyCalibrator.h.

51  : pathData_(pathData),
52  pathLinData_(pathLinData),
57  isMC_(isMC),
58  updateEnergyErrors_(updateEnergyErrors),
61  init();
62  }

References init().

◆ ElectronEnergyCalibrator() [2/3]

ElectronEnergyCalibrator::ElectronEnergyCalibrator ( )
inline

Definition at line 31 of file ElectronEnergyCalibrator.h.

31 {}

◆ ElectronEnergyCalibrator() [3/3]

ElectronEnergyCalibrator::ElectronEnergyCalibrator ( const EpCombinationTool combinator,
const std::string &  correctionFile 
)

Definition at line 12 of file ElectronEnergyCalibrator.cc.

14  : correctionRetriever_(correctionFile), epCombinationTool_(&combinator), rng_(nullptr), minEt_(1.0) {}

◆ ~ElectronEnergyCalibrator()

ElectronEnergyCalibrator::~ElectronEnergyCalibrator ( )
inline

Definition at line 33 of file ElectronEnergyCalibrator.h.

33 {}

Member Function Documentation

◆ calCombinedMom()

std::pair< float, float > ElectronEnergyCalibrator::calCombinedMom ( reco::GsfElectron ele,
const float  scale,
const float  smear 
) const
private

Definition at line 170 of file ElectronEnergyCalibrator.cc.

172  {
173  const float oldEcalEnergy = ele.ecalEnergy();
174  const float oldEcalEnergyErr = ele.ecalEnergyError();
175 
176  const auto oldP4 = ele.p4();
177  const float oldP4Err = ele.p4Error(reco::GsfElectron::P4_COMBINATION);
178  const float oldTrkMomErr = ele.trackMomentumError();
179 
180  setEcalEnergy(ele, scale, smear);
181  const auto& combinedMomentum = epCombinationTool_->combine(ele, oldEcalEnergyErr * scale);
182 
183  ele.setCorrectedEcalEnergy(oldEcalEnergy);
184  ele.setCorrectedEcalEnergyError(oldEcalEnergyErr);
185  ele.correctMomentum(oldP4, oldTrkMomErr, oldP4Err);
186 
187  return combinedMomentum;
188 }

References EpCombinationTool::combine(), reco::GsfElectron::correctMomentum(), reco::GsfElectron::ecalEnergy(), reco::GsfElectron::ecalEnergyError(), epCombinationTool_, reco::GsfElectron::p4(), reco::GsfElectron::P4_COMBINATION, reco::GsfElectron::p4Error(), Scenarios_cff::scale, reco::GsfElectron::setCorrectedEcalEnergy(), reco::GsfElectron::setCorrectedEcalEnergyError(), setEcalEnergy(), and reco::GsfElectron::trackMomentumError().

Referenced by setEnergyAndSystVarations().

◆ calibrate() [1/3]

std::array< float, EGEnergySysIndex::kNrSysErrs > ElectronEnergyCalibrator::calibrate ( reco::GsfElectron ele,
const unsigned int  runNumber,
const EcalRecHitCollection recHits,
const float  smearNrSigma,
const EventType  eventType 
) const

Definition at line 27 of file ElectronEnergyCalibrator.cc.

32  {
33  const float scEtaAbs = std::abs(ele.superCluster()->eta());
34  const float et = ele.ecalEnergy() / cosh(scEtaAbs);
35 
36  if (et < minEt_ || edm::isNotFinite(et)) {
37  std::array<float, EGEnergySysIndex::kNrSysErrs> retVal;
38  retVal.fill(ele.energy());
39  retVal[EGEnergySysIndex::kScaleValue] = 1.0;
40  retVal[EGEnergySysIndex::kSmearValue] = 0.0;
41  retVal[EGEnergySysIndex::kSmearNrSigma] = smearNrSigma;
50  return retVal;
51  }
52 
53  const DetId seedDetId = ele.superCluster()->seed()->seed();
54  EcalRecHitCollection::const_iterator seedRecHit = recHits->find(seedDetId);
55  unsigned int gainSeedSC = 12;
56  if (seedRecHit != recHits->end()) {
57  if (seedRecHit->checkFlag(EcalRecHit::kHasSwitchToGain6))
58  gainSeedSC = 6;
59  if (seedRecHit->checkFlag(EcalRecHit::kHasSwitchToGain1))
60  gainSeedSC = 1;
61  }
62 
64  correctionRetriever_.getScaleCorr(runNumber, et, scEtaAbs, ele.full5x5_r9(), gainSeedSC);
66  correctionRetriever_.getSmearCorr(runNumber, et, scEtaAbs, ele.full5x5_r9(), gainSeedSC);
67  if (scaleCorr == nullptr)
68  scaleCorr = &defaultScaleCorr_;
69  if (smearCorr == nullptr)
70  smearCorr = &defaultSmearCorr_;
71 
72  std::array<float, EGEnergySysIndex::kNrSysErrs> uncertainties{};
73 
74  uncertainties[EGEnergySysIndex::kScaleValue] = scaleCorr->scale();
75  uncertainties[EGEnergySysIndex::kSmearValue] =
76  smearCorr->sigma(et); //even though we use scale = 1.0, we still store the value returned for MC
77  uncertainties[EGEnergySysIndex::kSmearNrSigma] = smearNrSigma;
78  //MC central values are not scaled (scale = 1.0), data is not smeared (smearNrSigma = 0)
79  //the smearing (or resolution extra parameter as it might better be called)
80  //still has a second order effect on data as it enters the E/p combination as an adjustment
81  //to the estimate of the resolution contained in caloEnergyError
82  //MC gets all the scale systematics
83  if (eventType == EventType::DATA) {
84  setEnergyAndSystVarations(scaleCorr->scale(), 0., et, *scaleCorr, *smearCorr, ele, uncertainties);
85  } else if (eventType == EventType::MC) {
86  setEnergyAndSystVarations(1.0, smearNrSigma, et, *scaleCorr, *smearCorr, ele, uncertainties);
87  }
88 
89  return uncertainties;
90 }

References funct::abs(), reco::GsfElectron::Corrections::combinedP4Error, correctionRetriever_, reco::GsfElectron::corrections(), DATA, defaultScaleCorr_, defaultSmearCorr_, reco::GsfElectron::ecalEnergy(), reco::GsfElectron::ecalEnergyError(), reco::LeafCandidate::energy(), EgHLTOffHistBins_cfi::et, hcalcalib_dqm_sourceclient-live_cfg::eventType, reco::GsfElectron::full5x5_r9(), EnergyScaleCorrection::getScaleCorr(), EnergyScaleCorrection::getSmearCorr(), edm::isNotFinite(), EGEnergySysIndex::kEcalErrPostCorr, EGEnergySysIndex::kEcalErrPreCorr, EGEnergySysIndex::kEcalPostCorr, EGEnergySysIndex::kEcalPreCorr, EGEnergySysIndex::kEcalTrkErrPostCorr, EGEnergySysIndex::kEcalTrkErrPreCorr, EGEnergySysIndex::kEcalTrkPostCorr, EGEnergySysIndex::kEcalTrkPreCorr, EcalRecHit::kHasSwitchToGain1, EcalRecHit::kHasSwitchToGain6, EGEnergySysIndex::kScaleValue, EGEnergySysIndex::kSmearNrSigma, EGEnergySysIndex::kSmearValue, MC, minEt_, FastTrackerRecHitMaskProducer_cfi::recHits, convertSQLiteXML::runNumber, EnergyScaleCorrection::ScaleCorrection::scale(), setEnergyAndSystVarations(), EnergyScaleCorrection::SmearCorrection::sigma(), and reco::GsfElectron::superCluster().

◆ calibrate() [2/3]

std::array< float, EGEnergySysIndex::kNrSysErrs > ElectronEnergyCalibrator::calibrate ( reco::GsfElectron ele,
const unsigned int  runNumber,
const EcalRecHitCollection recHits,
edm::StreamID const &  id,
const EventType  eventType 
) const

Correct this electron. StreamID is needed when used with CMSSW Random Number Generator

Definition at line 18 of file ElectronEnergyCalibrator.cc.

23  {
24  return calibrate(ele, runNumber, recHits, gauss(id), eventType);
25 }

References calibrate(), hcalcalib_dqm_sourceclient-live_cfg::eventType, gauss(), FastTrackerRecHitMaskProducer_cfi::recHits, and convertSQLiteXML::runNumber.

◆ calibrate() [3/3]

void ElectronEnergyCalibrator::calibrate ( SimpleElectron electron,
edm::StreamID const &  streamID 
)

Definition at line 144 of file ElectronEnergyCalibrator.cc.

145  {
146  double scale = 1.0;
147  double dsigMC = 0.;
148  double corrMC = 0.;
149  double run_ = electron.getRunNumber();
150  bool isEB = electron.isEB();
151  double eta = electron.getEta();
152  double r9 = electron.getR9();
153 
154  switch (correctionsType_) {
155  case 1:
156  if (verbose_) {
157  std::cout << "[ElectronEnergyCalibrator] Using regression energy for calibration" << std::endl;
158  }
159  newEnergy_ = electron.getRegEnergy();
160  newEnergyError_ = electron.getRegEnergyError();
161  break;
162  case 2:
163  if (verbose_) {
164  std::cout << "[ElectronEnergyCalibrator] Using scale corrections for new regression" << std::endl;
165  }
166  newEnergy_ = electron.getRegEnergy();
167  newEnergyError_ = electron.getRegEnergyError();
168  break;
169  case 3:
170  if (verbose_) {
171  std::cout << "[ElectronEnergyCalibrator] Using standard ecal energy for calibration" << std::endl;
172  }
173  newEnergy_ = electron.getSCEnergy();
174  newEnergyError_ = electron.getSCEnergyError();
175  break;
176  }
177 
179  if (!rng.isAvailable()) {
180  throw cms::Exception("Configuration")
181  << "XXXXXXX requires the RandomNumberGeneratorService\n"
182  "which is not present in the configuration file. You must add the service\n"
183  "in the configuration file or remove the modules that require it.";
184  }
185 
186  if (!isMC_) {
187  for (int i = 0; i < nCorrValRaw; i++) {
188  if ((run_ >= corrValArray[i].nRunMin) && (run_ <= corrValArray[i].nRunMax)) {
189  if (isEB) {
190  if (fabs(eta) < 1) {
191  if (r9 < 0.94) {
193  } else {
195  }
196  } else {
197  if (r9 < 0.94) {
199  } else {
201  }
202  }
203  } else {
204  if (fabs(eta) < 2) {
205  if (r9 < 0.94) {
207  } else {
209  }
210  } else {
211  if (r9 < 0.94) {
213  } else {
215  }
216  }
217  }
218  }
219  }
221  }
222 
223  switch (correctionsType_) {
224  case 1:
225  // Implementation of the MC smearing for regression energy type 1
226  if (dataset_ == "Summer12_DR53X_HCP2012" || dataset_ == "Moriond2013") {
227  if (!isMC_) {
228  if (run_ <= 203002) {
229  if (isEB && fabs(eta) < 1 && r9 < 0.94)
230  dsigMC = 0.0103;
231  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
232  dsigMC = 0.0090;
233  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
234  dsigMC = 0.0190;
235  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
236  dsigMC = 0.0156;
237  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
238  dsigMC = 0.0269;
239  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
240  dsigMC = 0.0287;
241  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
242  dsigMC = 0.0364;
243  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
244  dsigMC = 0.0321;
245  } else {
246  if (isEB && fabs(eta) < 1 && r9 < 0.94)
247  dsigMC = 0.0109;
248  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
249  dsigMC = 0.0099;
250  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
251  dsigMC = 0.0182;
252  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
253  dsigMC = 0.0200;
254  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
255  dsigMC = 0.0282;
256  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
257  dsigMC = 0.0309;
258  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
259  dsigMC = 0.0386;
260  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
261  dsigMC = 0.0359;
262  }
263  } else {
264  CLHEP::RandFlat flatRandom(rng->getEngine(streamID));
265  double rn = flatRandom.fire();
266  if (rn > lumiRatio_) {
267  if (isEB && fabs(eta) < 1 && r9 < 0.94)
268  dsigMC = 0.0109;
269  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
270  dsigMC = 0.0099;
271  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
272  dsigMC = 0.0182;
273  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
274  dsigMC = 0.0200;
275  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
276  dsigMC = 0.0282;
277  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
278  dsigMC = 0.0309;
279  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
280  dsigMC = 0.0386;
281  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
282  dsigMC = 0.0359;
283  } else {
284  if (isEB && fabs(eta) < 1 && r9 < 0.94)
285  dsigMC = 0.0103;
286  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
287  dsigMC = 0.0090;
288  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
289  dsigMC = 0.0190;
290  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
291  dsigMC = 0.0156;
292  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
293  dsigMC = 0.0269;
294  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
295  dsigMC = 0.0287;
296  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
297  dsigMC = 0.0364;
298  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
299  dsigMC = 0.0321;
300  }
301  if (lumiRatio_ == 0.0) {
302  if (isEB && fabs(eta) < 1 && r9 < 0.94)
303  dsigMC = 0.0103;
304  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
305  dsigMC = 0.0090;
306  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
307  dsigMC = 0.0190;
308  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
309  dsigMC = 0.0156;
310  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
311  dsigMC = 0.0269;
312  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
313  dsigMC = 0.0287;
314  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
315  dsigMC = 0.0364;
316  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
317  dsigMC = 0.0321;
318  }
319  if (lumiRatio_ == 1.0) {
320  if (isEB && fabs(eta) < 1 && r9 < 0.94)
321  dsigMC = 0.0109;
322  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
323  dsigMC = 0.0099;
324  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
325  dsigMC = 0.0182;
326  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
327  dsigMC = 0.0200;
328  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
329  dsigMC = 0.0282;
330  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
331  dsigMC = 0.0309;
332  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
333  dsigMC = 0.0386;
334  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
335  dsigMC = 0.0359;
336  }
337  }
338  }
339  break;
340 
341  case 2:
342  // Implementation of the MC smearing for regression energy type 2
343  if (dataset_ == "Summer12_LegacyPaper" || dataset_ == "22Jan2013ReReco") {
344  if (isEB && fabs(eta) < 1 && r9 < 0.94)
345  dsigMC = 0.0094;
346  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
347  dsigMC = 0.0092;
348  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
349  dsigMC = 0.0182;
350  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
351  dsigMC = 0.0139;
352  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
353  dsigMC = 0.0220;
354  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
355  dsigMC = 0.0229;
356  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
357  dsigMC = 0.0290;
358  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
359  dsigMC = 0.0234;
360  }
361  break;
362 
363  case 3:
364  // standard SC energy scale corrections implementation
365  if (dataset_ == "Summer11" ||
366  dataset_ == "ReReco") { // values from https://indico.cern.ch/conferenceDisplay.py?confId=146386
367  if (isEB && fabs(eta) < 1 && r9 < 0.94)
368  dsigMC = 0.01;
369  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
370  dsigMC = 0.0099;
371  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
372  dsigMC = 0.0217;
373  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
374  dsigMC = 0.0157;
375  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
376  dsigMC = 0.0326;
377  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
378  dsigMC = 0.0330;
379  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
380  dsigMC = 0.0331;
381  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
382  dsigMC = 0.0378;
383  } else if (dataset_ == "Fall11" ||
384  dataset_ ==
385  "Jan16ReReco") { // values from https://hypernews.cern.ch/HyperNews/CMS/get/higgs2g/634.html, consistant with Jan16ReReco corrections
386  if (isEB && fabs(eta) < 1 && r9 < 0.94)
387  dsigMC = 0.0096;
388  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
389  dsigMC = 0.0074;
390  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
391  dsigMC = 0.0196;
392  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
393  dsigMC = 0.0141;
394  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
395  dsigMC = 0.0279;
396  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
397  dsigMC = 0.0268;
398  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
399  dsigMC = 0.0301;
400  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
401  dsigMC = 0.0293;
402  } else if (dataset_ == "Summer12" ||
403  dataset_ ==
404  "ICHEP2012") { // new values from https://twiki.cern.ch/twiki/pub/CMS/EcalEnergyResolutionWithZee/oriented-ICHEP-scales_resolution.pdf
405  if (isEB && fabs(eta) < 1 && r9 < 0.94)
406  dsigMC = 0.0119;
407  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
408  dsigMC = 0.0107;
409  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
410  dsigMC = 0.0240;
411  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
412  dsigMC = 0.0149;
413  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
414  dsigMC = 0.0330;
415  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
416  dsigMC = 0.0375;
417  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
418  dsigMC = 0.0602;
419  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
420  dsigMC = 0.0607;
421  } else if (dataset_ == "Summer12_DR53X_HCP2012" || dataset_ == "Moriond2013") {
422  if (isEB && fabs(eta) < 1 && r9 < 0.94)
423  dsigMC = 0.0099;
424  if (isEB && fabs(eta) < 1 && r9 >= 0.94)
425  dsigMC = 0.0103;
426  if (isEB && fabs(eta) >= 1 && r9 < 0.94)
427  dsigMC = 0.0219;
428  if (isEB && fabs(eta) >= 1 && r9 >= 0.94)
429  dsigMC = 0.0158;
430  if (!isEB && fabs(eta) < 2 && r9 < 0.94)
431  dsigMC = 0.0222;
432  if (!isEB && fabs(eta) < 2 && r9 >= 0.94)
433  dsigMC = 0.0298;
434  if (!isEB && fabs(eta) >= 2 && r9 < 0.94)
435  dsigMC = 0.0318;
436  if (!isEB && fabs(eta) >= 2 && r9 >= 0.94)
437  dsigMC = 0.0302;
438  }
439  break;
440  }
441 
442  if (isMC_) {
443  CLHEP::RandGaussQ gaussDistribution(rng->getEngine(streamID), 1., dsigMC);
444  corrMC = gaussDistribution.fire();
445  if (verbose_) {
446  std::cout << "[ElectronEnergyCalibrator] unsmeared energy " << newEnergy_ << std::endl;
447  }
448  if (synchronization_) {
449  std::cout << "[ElectronEnergyCalibrator] "
450  << "======================= SYNCRONIZATION MODE! =======================" << std::endl;
451  newEnergy_ = newEnergy_ * (1 + dsigMC);
452  } else {
453  newEnergy_ = newEnergy_ * corrMC;
454  }
455  if (verbose_) {
456  std::cout << "[ElectronEnergyCalibrator] smeared energy " << newEnergy_ << std::endl;
457  }
458  }
459 
460  // correct energy error for MC and for data as error is obtained from (ideal) MC parametrisation
461  if (updateEnergyErrors_) {
463  }
464  if (verbose_) {
465  std::cout << "[ElectronEnergyCalibrator] initial energy " << electron.getRegEnergy() << " recalibrated energy "
466  << newEnergy_ << std::endl;
467  }
468  if (verbose_) {
469  std::cout << "[ElectronEnergyCalibrator] initial energy error " << electron.getRegEnergyError()
470  << " recalibrated energy error " << newEnergyError_ << std::endl;
471  }
472 
473  electron.setNewEnergy(newEnergy_);
474  electron.setNewEnergyError(newEnergyError_);

References correctionValues::corrCat0, correctionValues::corrCat1, correctionValues::corrCat2, correctionValues::corrCat3, correctionValues::corrCat4, correctionValues::corrCat5, correctionValues::corrCat6, correctionValues::corrCat7, correctionsType_, corrValArray, gather_cfg::cout, dataset_, HPSPFTauProducerPuppi_cfi::electron, PVValHelper::eta, Exception, edm::RandomNumberGenerator::getEngine(), mps_fire::i, edm::Service< T >::isAvailable(), isMC_, lumiRatio_, nCorrValRaw, newEnergy_, newEnergyError_, electrons_cff::r9, Scenarios_cff::scale, mathSSE::sqrt(), synchronization_, updateEnergyErrors_, and verbose_.

Referenced by calibrate().

◆ correctLinearity()

void ElectronEnergyCalibrator::correctLinearity ( SimpleElectron electron)

Definition at line 476 of file ElectronEnergyCalibrator.cc.

477  {
479  bool isEB = electron.isEB();
480  double eta = electron.getEta();
481  double theta = 2 * atan(exp(-eta));
482  double p = electron.getCombinedMomentum();
483  double pt = p * fabs(sin(theta));
484  int classification = electron.getElClass();
485  double linscale = 0.;
486 
487  for (int i = 0; i < nLinCorrValRaw; i++) {
488  if ((pt >= linCorrValArray[i].ptMin) && (pt <= linCorrValArray[i].ptMax)) {
489  if (isEB) {
490  if (fabs(eta) < 1) {
491  if (classification < 2) {
492  linscale = linCorrValArray[i].corrCat0;
493  } else {
494  linscale = linCorrValArray[i].corrCat3;
495  }
496  } else {
497  if (classification < 2) {
498  linscale = linCorrValArray[i].corrCat1;
499  } else {
500  linscale = linCorrValArray[i].corrCat4;
501  }
502  }
503  } else // !isEB
504  {
505  if (classification < 2) {
506  linscale = linCorrValArray[i].corrCat2;
507  } else {
508  linscale = linCorrValArray[i].corrCat5;
509  }
510  }
511  }
512  }
513  double newP = p / (1. + linscale);
514  if (verbose_) {
515  std::cout << "[ElectronEnergyCalibrator] Applying a linearity correction of " << 1. / (1. + linscale)
516  << " to " << pt << " GeV in pt" << std::endl;
517  }
518  electron.setCombinedMomentum(newP);
519  if (verbose_) {
520  std::cout << "[ElectronEnergyCalibrator] calibrated transverse momentum " << pt
521  << " GeV recalibrated for linearity to momentum " << electron.getCombinedMomentum() * fabs(sin(theta))
522  << " GeV" << std::endl;
523  }
524  }

References applyLinearityCorrection_, linearityCorrectionValues::corrCat0, linearityCorrectionValues::corrCat1, linearityCorrectionValues::corrCat2, linearityCorrectionValues::corrCat3, linearityCorrectionValues::corrCat4, linearityCorrectionValues::corrCat5, gather_cfg::cout, HPSPFTauProducerPuppi_cfi::electron, PVValHelper::eta, JetChargeProducer_cfi::exp, mps_fire::i, isMC_, linCorrValArray, nLinCorrValRaw, AlCaHLTBitMon_ParallelJobs::p, DiDispStaMuonMonitor_cfi::pt, AlignmentTrackSelector_cfi::ptMax, ptMin, funct::sin(), theta(), and verbose_.

◆ gauss()

double ElectronEnergyCalibrator::gauss ( edm::StreamID const &  id) const
private

Return a number distributed as a unit gaussian, drawn from the private RNG if initPrivateRng was called, or from the CMSSW RandomNumberGenerator service If synchronization is set to true, it returns a fixed number (1.0)

Definition at line 190 of file ElectronEnergyCalibrator.cc.

190  {
191  if (rng_) {
192  return rng_->Gaus();
193  } else {
195  if (!rng.isAvailable()) {
196  throw cms::Exception("Configuration")
197  << "XXXXXXX requires the RandomNumberGeneratorService\n"
198  "which is not present in the configuration file. You must add the service\n"
199  "in the configuration file or remove the modules that require it.";
200  }
201  CLHEP::RandGaussQ gaussDistribution(rng->getEngine(id), 0.0, 1.0);
202  return gaussDistribution.fire();
203  }
204 }

References Exception, edm::RandomNumberGenerator::getEngine(), edm::Service< T >::isAvailable(), and rng_.

Referenced by calibrate().

◆ init()

void ElectronEnergyCalibrator::init ( void  )
private

Definition at line 21 of file ElectronEnergyCalibrator.cc.

22  {
23  if (!isMC_) // DATA
24  {
25  if (verbose_) {
26  std::cout << "[ElectronEnergyCalibrator] Initialization in DATA mode" << std::endl;
27  }
28 
29  std::ifstream fin(pathData_.c_str());
30 
31  if (!fin) {
32  throw cms::Exception("Configuration") << "[ElectronEnergyCalibrator] Cannot open the file " << pathData_
33  << "\n It is not found, missed or corrupted";
34  } else {
35  if (verbose_) {
36  std::cout << "[ElectronEnergyCalibrator] File " << pathData_ << " succesfully opened" << std::endl;
37  }
38 
39  std::string s;
40  std::vector<std::string> selements;
41  std::string delimiter = ",";
42  nCorrValRaw = 0;
43 
44  while (!fin.eof()) {
45  getline(fin, s);
46  if (!s.empty()) {
47  splitString(s, selements, delimiter);
58 
59  nCorrValRaw++;
60 
61  selements.clear();
62  }
63  }
64 
65  fin.close();
66 
67  if (verbose_) {
68  std::cout << "[ElectronEnergyCalibrator] File closed" << std::endl;
69  }
70  }
71  // linearity corrections data
73  std::ifstream finlin(pathLinData_.c_str());
74 
75  if (!finlin) {
76  throw cms::Exception("Configuration") << "[ElectronEnergyCalibrator] Cannot open the file " << pathLinData_
77  << "\n It is not found, missed or corrupted";
78  } else {
79  if (verbose_) {
80  std::cout << "[ElectronEnergyCalibrator] File with Linearity Corrections " << pathLinData_
81  << " succesfully opened" << std::endl;
82  }
83 
84  std::string s;
85  std::vector<std::string> selements;
86  std::string delimiter = ",";
87  nLinCorrValRaw = 0;
88 
89  while (!finlin.eof()) {
90  getline(finlin, s);
91  if (!s.empty()) {
92  splitString(s, selements, delimiter);
93 
102 
103  nLinCorrValRaw++;
104 
105  selements.clear();
106  }
107  }
108 
109  finlin.close();
110 
111  if (verbose_) {
112  std::cout << "[ElectronEnergyCalibrator] File closed" << std::endl;
113  }
114  }
115  }
116  } else // MC
117  {
118  if (verbose_) {
119  std::cout << "[ElectronEnergyCalibrator] Initialization in MC mode" << std::endl;
120  }
121  }

References applyLinearityCorrection_, correctionValues::corrCat0, linearityCorrectionValues::corrCat0, correctionValues::corrCat1, linearityCorrectionValues::corrCat1, correctionValues::corrCat2, linearityCorrectionValues::corrCat2, correctionValues::corrCat3, linearityCorrectionValues::corrCat3, correctionValues::corrCat4, linearityCorrectionValues::corrCat4, correctionValues::corrCat5, linearityCorrectionValues::corrCat5, correctionValues::corrCat6, correctionValues::corrCat7, corrValArray, gather_cfg::cout, makeHLTPrescaleTable::delimiter, Exception, groupFilesInBlocks::fin, isMC_, linCorrValArray, nCorrValRaw, nLinCorrValRaw, correctionValues::nRunMax, correctionValues::nRunMin, pathData_, pathLinData_, linearityCorrectionValues::ptMax, linearityCorrectionValues::ptMin, alignCSCRings::s, splitString(), AlCaHLTBitMon_QueryRunRegistry::string, stringToDouble(), and verbose_.

Referenced by ElectronEnergyCalibrator().

◆ initPrivateRng()

void ElectronEnergyCalibrator::initPrivateRng ( TRandom *  rnd)

Initialize with a random number generator (if not done, it will use the CMSSW service) Caller code owns the TRandom.

Definition at line 16 of file ElectronEnergyCalibrator.cc.

16 { rng_ = rnd; }

References rng_.

Referenced by CalibratedElectronProducerT< T >::CalibratedElectronProducerT().

◆ setEcalEnergy()

void ElectronEnergyCalibrator::setEcalEnergy ( reco::GsfElectron ele,
const float  scale,
const float  smear 
) const
private

Definition at line 163 of file ElectronEnergyCalibrator.cc.

163  {
164  const float oldEcalEnergy = ele.ecalEnergy();
165  const float oldEcalEnergyErr = ele.ecalEnergyError();
166  ele.setCorrectedEcalEnergy(oldEcalEnergy * scale);
167  ele.setCorrectedEcalEnergyError(std::hypot(oldEcalEnergyErr * scale, oldEcalEnergy * smear * scale));
168 }

References reco::GsfElectron::ecalEnergy(), reco::GsfElectron::ecalEnergyError(), Scenarios_cff::scale, reco::GsfElectron::setCorrectedEcalEnergy(), and reco::GsfElectron::setCorrectedEcalEnergyError().

Referenced by calCombinedMom(), and setEnergyAndSystVarations().

◆ setEnergyAndSystVarations()

void ElectronEnergyCalibrator::setEnergyAndSystVarations ( const float  scale,
const float  smearNrSigma,
const float  et,
const EnergyScaleCorrection::ScaleCorrection scaleCorr,
const EnergyScaleCorrection::SmearCorrection smearCorr,
reco::GsfElectron ele,
std::array< float, EGEnergySysIndex::kNrSysErrs > &  energyData 
) const
private

Definition at line 92 of file ElectronEnergyCalibrator.cc.

99  {
100  const float smear = smearCorr.sigma(et);
101  const float smearRhoUp = smearCorr.sigma(et, 1, 0);
102  const float smearRhoDn = smearCorr.sigma(et, -1, 0);
103  const float smearPhiUp = smearCorr.sigma(et, 0, 1);
104  const float smearPhiDn = smearCorr.sigma(et, 0, -1);
105  const float smearUp = smearRhoUp;
106  const float smearDn = smearRhoDn;
107 
108  const float corr = scale + smear * smearNrSigma;
109  const float corrRhoUp = scale + smearRhoUp * smearNrSigma;
110  const float corrRhoDn = scale + smearRhoDn * smearNrSigma;
111  const float corrPhiUp = scale + smearPhiUp * smearNrSigma;
112  const float corrPhiDn = scale + smearPhiDn * smearNrSigma;
113  const float corrUp = corrRhoUp;
114  const float corrDn = corrRhoDn;
115 
116  const float corrScaleStatUp = corr + scaleCorr.scaleErrStat();
117  const float corrScaleStatDn = corr - scaleCorr.scaleErrStat();
118  const float corrScaleSystUp = corr + scaleCorr.scaleErrSyst();
119  const float corrScaleSystDn = corr - scaleCorr.scaleErrSyst();
120  const float corrScaleGainUp = corr + scaleCorr.scaleErrGain();
121  const float corrScaleGainDn = corr - scaleCorr.scaleErrGain();
122  const float corrScaleUp = corr + scaleCorr.scaleErr(EnergyScaleCorrection::kErrStatSystGain);
123  const float corrScaleDn = corr - scaleCorr.scaleErr(EnergyScaleCorrection::kErrStatSystGain);
124 
125  const math::XYZTLorentzVector oldP4 = ele.p4();
126  energyData[EGEnergySysIndex::kEcalTrkPreCorr] = ele.energy();
128  energyData[EGEnergySysIndex::kEcalPreCorr] = ele.ecalEnergy();
130 
131  energyData[EGEnergySysIndex::kScaleStatUp] = calCombinedMom(ele, corrScaleStatUp, smear).first;
132  energyData[EGEnergySysIndex::kScaleStatDown] = calCombinedMom(ele, corrScaleStatDn, smear).first;
133  energyData[EGEnergySysIndex::kScaleSystUp] = calCombinedMom(ele, corrScaleSystUp, smear).first;
134  energyData[EGEnergySysIndex::kScaleSystDown] = calCombinedMom(ele, corrScaleSystDn, smear).first;
135  energyData[EGEnergySysIndex::kScaleGainUp] = calCombinedMom(ele, corrScaleGainUp, smear).first;
136  energyData[EGEnergySysIndex::kScaleGainDown] = calCombinedMom(ele, corrScaleGainDn, smear).first;
137 
138  energyData[EGEnergySysIndex::kSmearRhoUp] = calCombinedMom(ele, corrRhoUp, smearRhoUp).first;
139  energyData[EGEnergySysIndex::kSmearRhoDown] = calCombinedMom(ele, corrRhoDn, smearRhoDn).first;
140  energyData[EGEnergySysIndex::kSmearPhiUp] = calCombinedMom(ele, corrPhiUp, smearPhiUp).first;
141  energyData[EGEnergySysIndex::kSmearPhiDown] = calCombinedMom(ele, corrPhiDn, smearPhiDn).first;
142 
143  energyData[EGEnergySysIndex::kScaleUp] = calCombinedMom(ele, corrScaleUp, smear).first;
144  energyData[EGEnergySysIndex::kScaleDown] = calCombinedMom(ele, corrScaleDn, smear).first;
145  energyData[EGEnergySysIndex::kSmearUp] = calCombinedMom(ele, corrUp, smearUp).first;
146  energyData[EGEnergySysIndex::kSmearDown] = calCombinedMom(ele, corrDn, smearDn).first;
147 
148  const std::pair<float, float> combinedMomentum = calCombinedMom(ele, corr, smear);
149  setEcalEnergy(ele, corr, smear);
150  const float energyCorr = combinedMomentum.first / oldP4.t();
151 
152  const math::XYZTLorentzVector newP4(
153  oldP4.x() * energyCorr, oldP4.y() * energyCorr, oldP4.z() * energyCorr, combinedMomentum.first);
154 
155  ele.correctMomentum(newP4, ele.trackMomentumError(), combinedMomentum.second);
156  energyData[EGEnergySysIndex::kEcalTrkPostCorr] = ele.energy();
158 
159  energyData[EGEnergySysIndex::kEcalPostCorr] = ele.ecalEnergy();
161 }

References calCombinedMom(), reco::GsfElectron::Corrections::combinedP4Error, alignCSCRings::corr, reco::GsfElectron::corrections(), reco::GsfElectron::correctMomentum(), reco::GsfElectron::ecalEnergy(), reco::GsfElectron::ecalEnergyError(), reco::LeafCandidate::energy(), EgHLTOffHistBins_cfi::et, EGEnergySysIndex::kEcalErrPostCorr, EGEnergySysIndex::kEcalErrPreCorr, EGEnergySysIndex::kEcalPostCorr, EGEnergySysIndex::kEcalPreCorr, EGEnergySysIndex::kEcalTrkErrPostCorr, EGEnergySysIndex::kEcalTrkErrPreCorr, EGEnergySysIndex::kEcalTrkPostCorr, EGEnergySysIndex::kEcalTrkPreCorr, EnergyScaleCorrection::kErrStatSystGain, EGEnergySysIndex::kScaleDown, EGEnergySysIndex::kScaleGainDown, EGEnergySysIndex::kScaleGainUp, EGEnergySysIndex::kScaleStatDown, EGEnergySysIndex::kScaleStatUp, EGEnergySysIndex::kScaleSystDown, EGEnergySysIndex::kScaleSystUp, EGEnergySysIndex::kScaleUp, EGEnergySysIndex::kSmearDown, EGEnergySysIndex::kSmearPhiDown, EGEnergySysIndex::kSmearPhiUp, EGEnergySysIndex::kSmearRhoDown, EGEnergySysIndex::kSmearRhoUp, EGEnergySysIndex::kSmearUp, reco::GsfElectron::p4(), Scenarios_cff::scale, EnergyScaleCorrection::ScaleCorrection::scaleErr(), EnergyScaleCorrection::ScaleCorrection::scaleErrGain(), EnergyScaleCorrection::ScaleCorrection::scaleErrStat(), EnergyScaleCorrection::ScaleCorrection::scaleErrSyst(), setEcalEnergy(), EnergyScaleCorrection::SmearCorrection::sigma(), and reco::GsfElectron::trackMomentumError().

Referenced by calibrate().

◆ setMinEt()

void ElectronEnergyCalibrator::setMinEt ( float  val)
inline

◆ splitString()

void ElectronEnergyCalibrator::splitString ( const std::string &  fullstr,
std::vector< std::string > &  elements,
const std::string &  delimiter 
)
private

Definition at line 123 of file ElectronEnergyCalibrator.cc.

126  {
127  std::string::size_type lastpos = fullstr.find_first_not_of(delimiter, 0);
128  std::string::size_type pos = fullstr.find_first_of(delimiter, lastpos);
129 
130  while ((std::string::npos != pos) || (std::string::npos != lastpos)) {
131  elements.push_back(fullstr.substr(lastpos, pos - lastpos));
132  lastpos = fullstr.find_first_not_of(delimiter, pos);
133  pos = fullstr.find_first_of(delimiter, lastpos);
134  }

References makeHLTPrescaleTable::delimiter, and bookConverter::elements.

Referenced by init().

◆ stringToDouble()

double ElectronEnergyCalibrator::stringToDouble ( const std::string &  str)
private

Definition at line 136 of file ElectronEnergyCalibrator.cc.

137  {
138  std::istringstream stm;
139  double val = 0;
140  stm.str(str);
141  stm >> val;
142  return val;

References str, and heppy_batch::val.

Referenced by init().

Member Data Documentation

◆ applyLinearityCorrection_

bool ElectronEnergyCalibrator::applyLinearityCorrection_
private

Definition at line 79 of file ElectronEnergyCalibrator.h.

Referenced by correctLinearity(), and init().

◆ correctionRetriever_

EnergyScaleCorrection ElectronEnergyCalibrator::correctionRetriever_
private

Definition at line 74 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ correctionsType_

int ElectronEnergyCalibrator::correctionsType_
private

Definition at line 78 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ corrValArray

correctionValues ElectronEnergyCalibrator::corrValArray[100]
private

Definition at line 86 of file ElectronEnergyCalibrator.h.

Referenced by calibrate(), and init().

◆ corrValMC

correctionValues ElectronEnergyCalibrator::corrValMC
private

Definition at line 87 of file ElectronEnergyCalibrator.h.

◆ dataset_

std::string ElectronEnergyCalibrator::dataset_
private

Definition at line 77 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ defaultScaleCorr_

const EnergyScaleCorrection::ScaleCorrection ElectronEnergyCalibrator::defaultScaleCorr_
staticprivate

Definition at line 80 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ defaultSmearCorr_

const EnergyScaleCorrection::SmearCorrection ElectronEnergyCalibrator::defaultSmearCorr_
staticprivate

Definition at line 81 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ epCombinationTool_

const EpCombinationTool* ElectronEnergyCalibrator::epCombinationTool_
private

Definition at line 75 of file ElectronEnergyCalibrator.h.

Referenced by calCombinedMom().

◆ isMC_

bool ElectronEnergyCalibrator::isMC_
private

Definition at line 81 of file ElectronEnergyCalibrator.h.

Referenced by calibrate(), correctLinearity(), and init().

◆ linCorrValArray

linearityCorrectionValues ElectronEnergyCalibrator::linCorrValArray[100]
private

Definition at line 88 of file ElectronEnergyCalibrator.h.

Referenced by correctLinearity(), and init().

◆ lumiRatio_

double ElectronEnergyCalibrator::lumiRatio_
private

Definition at line 80 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ minEt_

float ElectronEnergyCalibrator::minEt_
private

Definition at line 77 of file ElectronEnergyCalibrator.h.

Referenced by calibrate(), and setMinEt().

◆ nCorrValRaw

int ElectronEnergyCalibrator::nCorrValRaw
private

Definition at line 89 of file ElectronEnergyCalibrator.h.

Referenced by calibrate(), and init().

◆ newEnergy_

double ElectronEnergyCalibrator::newEnergy_
private

Definition at line 72 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ newEnergyError_

double ElectronEnergyCalibrator::newEnergyError_
private

Definition at line 73 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ nLinCorrValRaw

int ElectronEnergyCalibrator::nLinCorrValRaw
private

Definition at line 89 of file ElectronEnergyCalibrator.h.

Referenced by correctLinearity(), and init().

◆ pathData_

std::string ElectronEnergyCalibrator::pathData_
private

Definition at line 75 of file ElectronEnergyCalibrator.h.

Referenced by init().

◆ pathLinData_

std::string ElectronEnergyCalibrator::pathLinData_
private

Definition at line 76 of file ElectronEnergyCalibrator.h.

Referenced by init().

◆ rng_

TRandom* ElectronEnergyCalibrator::rng_
private

Definition at line 76 of file ElectronEnergyCalibrator.h.

Referenced by gauss(), and initPrivateRng().

◆ synchronization_

bool ElectronEnergyCalibrator::synchronization_
private

Definition at line 84 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ updateEnergyErrors_

bool ElectronEnergyCalibrator::updateEnergyErrors_
private

Definition at line 82 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

◆ verbose_

bool ElectronEnergyCalibrator::verbose_
private

Definition at line 83 of file ElectronEnergyCalibrator.h.

Referenced by calibrate(), correctLinearity(), and init().

electrons_cff.r9
r9
Definition: electrons_cff.py:366
calibratedElectrons_cfi.applyLinearityCorrection
applyLinearityCorrection
Definition: calibratedElectrons_cfi.py:43
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
reco::GsfElectron::Corrections::combinedP4Error
float combinedP4Error
Definition: GsfElectron.h:781
mps_fire.i
i
Definition: mps_fire.py:355
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
linearityCorrectionValues::corrCat0
double corrCat0
Definition: ElectronEnergyCalibrator.h:31
correctionValues::corrCat1
double corrCat1
Definition: ElectronEnergyCalibrator.h:19
correctionValues::corrCat7
double corrCat7
Definition: ElectronEnergyCalibrator.h:25
EcalRecHit::kHasSwitchToGain6
Definition: EcalRecHit.h:37
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
EGEnergySysIndex::kEcalTrkPostCorr
Definition: EGEnergySysIndex.h:37
reco::GsfElectron::correctMomentum
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
Definition: GsfElectron.h:829
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
ElectronEnergyCalibrator::defaultSmearCorr_
static const EnergyScaleCorrection::SmearCorrection defaultSmearCorr_
Definition: ElectronEnergyCalibrator.h:81
makeHLTPrescaleTable.delimiter
delimiter
Definition: makeHLTPrescaleTable.py:181
ElectronEnergyCalibrator::lumiRatio_
double lumiRatio_
Definition: ElectronEnergyCalibrator.h:80
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
linearityCorrectionValues::corrCat5
double corrCat5
Definition: ElectronEnergyCalibrator.h:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
linearityCorrectionValues::corrCat2
double corrCat2
Definition: ElectronEnergyCalibrator.h:33
ElectronEnergyCalibrator::nCorrValRaw
int nCorrValRaw
Definition: ElectronEnergyCalibrator.h:89
reco::GsfElectron::P4_COMBINATION
Definition: GsfElectron.h:769
EnergyScaleCorrection::SmearCorrection
Definition: EnergyScaleCorrection.h:57
EGEnergySysIndex::kSmearRhoDown
Definition: EGEnergySysIndex.h:21
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:153
reco::GsfElectron::p4Error
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:224
EGEnergySysIndex::kScaleGainUp
Definition: EGEnergySysIndex.h:18
ElectronEnergyCalibrator::synchronization_
bool synchronization_
Definition: ElectronEnergyCalibrator.h:84
EGEnergySysIndex::kEcalErrPostCorr
Definition: EGEnergySysIndex.h:34
EpCombinationTool::combine
void combine(SimpleElectron &mySimpleElectron) const
Definition: EpCombinationTool.cc:58
EGEnergySysIndex::kEcalTrkPreCorr
Definition: EGEnergySysIndex.h:35
correctionValues::corrCat2
double corrCat2
Definition: ElectronEnergyCalibrator.h:20
EGEnergySysIndex::kSmearRhoUp
Definition: EGEnergySysIndex.h:20
EnergyScaleCorrection::ScaleCorrection::scale
float scale() const
Definition: EnergyScaleCorrection.h:44
correctionValues::corrCat6
double corrCat6
Definition: ElectronEnergyCalibrator.h:24
ElectronEnergyCalibrator::stringToDouble
double stringToDouble(const std::string &str)
Definition: ElectronEnergyCalibrator.cc:136
ElectronEnergyCalibrator::splitString
void splitString(const std::string &fullstr, std::vector< std::string > &elements, const std::string &delimiter)
Definition: ElectronEnergyCalibrator.cc:123
ElectronEnergyCalibrator::verbose_
bool verbose_
Definition: ElectronEnergyCalibrator.h:83
linearityCorrectionValues::ptMax
double ptMax
Definition: ElectronEnergyCalibrator.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
EGEnergySysIndex::kScaleValue
Definition: EGEnergySysIndex.h:28
EGEnergySysIndex::kScaleStatDown
Definition: EGEnergySysIndex.h:15
convertSQLiteXML.runNumber
runNumber
Definition: convertSQLiteXML.py:91
EGEnergySysIndex::kSmearNrSigma
Definition: EGEnergySysIndex.h:30
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EGEnergySysIndex::kScaleGainDown
Definition: EGEnergySysIndex.h:19
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
EGEnergySysIndex::kScaleUp
Definition: EGEnergySysIndex.h:24
calibratedElectronsRun2_cfi.correctionFile
correctionFile
Definition: calibratedElectronsRun2_cfi.py:21
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
linearityCorrectionValues::corrCat4
double corrCat4
Definition: ElectronEnergyCalibrator.h:35
ElectronEnergyCalibrator::linCorrValArray
linearityCorrectionValues linCorrValArray[100]
Definition: ElectronEnergyCalibrator.h:88
AlignmentTrackSelector_cfi.ptMax
ptMax
Definition: AlignmentTrackSelector_cfi.py:12
groupFilesInBlocks.fin
fin
Definition: groupFilesInBlocks.py:94
ElectronEnergyCalibrator::applyLinearityCorrection_
bool applyLinearityCorrection_
Definition: ElectronEnergyCalibrator.h:79
correctionValues::corrCat3
double corrCat3
Definition: ElectronEnergyCalibrator.h:21
ElectronEnergyCalibrator::corrValArray
correctionValues corrValArray[100]
Definition: ElectronEnergyCalibrator.h:86
ElectronEnergyCalibrator::correctionRetriever_
EnergyScaleCorrection correctionRetriever_
Definition: ElectronEnergyCalibrator.h:74
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ElectronEnergyCalibrator::updateEnergyErrors_
bool updateEnergyErrors_
Definition: ElectronEnergyCalibrator.h:82
str
#define str(s)
Definition: TestProcessor.cc:48
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
EGEnergySysIndex::kEcalErrPreCorr
Definition: EGEnergySysIndex.h:32
correctionValues::nRunMin
double nRunMin
Definition: ElectronEnergyCalibrator.h:16
calibratedElectrons_cfi.synchronization
synchronization
Definition: calibratedElectrons_cfi.py:33
ElectronEnergyCalibrator::EventType::DATA
ElectronEnergyCalibrator::newEnergy_
double newEnergy_
Definition: ElectronEnergyCalibrator.h:72
EnergyScaleCorrection::getScaleCorr
const ScaleCorrection * getScaleCorr(unsigned int runnr, double et, double eta, double r9, unsigned int gainSeed) const
Definition: EnergyScaleCorrection.cc:77
ElectronEnergyCalibrator::pathLinData_
std::string pathLinData_
Definition: ElectronEnergyCalibrator.h:76
EGEnergySysIndex::kSmearDown
Definition: EGEnergySysIndex.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::GsfElectron::corrections
const Corrections & corrections() const
Definition: GsfElectron.h:813
EGEnergySysIndex::kEcalTrkErrPreCorr
Definition: EGEnergySysIndex.h:36
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
ElectronEnergyCalibrator::isMC_
bool isMC_
Definition: ElectronEnergyCalibrator.h:81
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
cscdqm::DATA
Definition: CSCDQM_Summary.h:47
ElectronEnergyCalibrator::init
void init()
Definition: ElectronEnergyCalibrator.cc:21
ElectronEnergyCalibrator::pathData_
std::string pathData_
Definition: ElectronEnergyCalibrator.h:75
reco::GsfElectron::setCorrectedEcalEnergyError
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:170
reco::GsfElectron::full5x5_r9
float full5x5_r9() const
Definition: GsfElectron.h:448
correctionValues::corrCat5
double corrCat5
Definition: ElectronEnergyCalibrator.h:23
ElectronEnergyCalibrator::rng_
TRandom * rng_
Definition: ElectronEnergyCalibrator.h:76
correctionValues::nRunMax
double nRunMax
Definition: ElectronEnergyCalibrator.h:17
edm::Service< edm::RandomNumberGenerator >
EnergyScaleCorrection::ScaleCorrection::scaleErrSyst
float scaleErrSyst() const
Definition: EnergyScaleCorrection.h:47
EnergyScaleCorrection::getSmearCorr
const SmearCorrection * getSmearCorr(unsigned int runnr, double et, double eta, double r9, unsigned int gainSeed) const
Definition: EnergyScaleCorrection.cc:106
correctionValues::corrCat0
double corrCat0
Definition: ElectronEnergyCalibrator.h:18
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
cmsdt::MC
Definition: constants.h:166
ElectronEnergyCalibrator::setEcalEnergy
void setEcalEnergy(reco::GsfElectron &ele, const float scale, const float smear) const
Definition: ElectronEnergyCalibrator.cc:163
EGEnergySysIndex::kScaleDown
Definition: EGEnergySysIndex.h:25
ElectronEnergyCalibrator::gauss
double gauss(edm::StreamID const &id) const
Definition: ElectronEnergyCalibrator.cc:190
linearityCorrectionValues::corrCat3
double corrCat3
Definition: ElectronEnergyCalibrator.h:34
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
EGEnergySysIndex::kEcalPostCorr
Definition: EGEnergySysIndex.h:33
reco::GsfElectron::p4
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:211
ElectronEnergyCalibrator::calCombinedMom
std::pair< float, float > calCombinedMom(reco::GsfElectron &ele, const float scale, const float smear) const
Definition: ElectronEnergyCalibrator.cc:170
ElectronEnergyCalibrator::nLinCorrValRaw
int nLinCorrValRaw
Definition: ElectronEnergyCalibrator.h:89
ElectronEnergyCalibrator::dataset_
std::string dataset_
Definition: ElectronEnergyCalibrator.h:77
hcalcalib_dqm_sourceclient-live_cfg.eventType
eventType
Definition: hcalcalib_dqm_sourceclient-live_cfg.py:205
EcalRecHit::kHasSwitchToGain1
Definition: EcalRecHit.h:38
bookConverter.elements
elements
Definition: bookConverter.py:147
calibratedElectrons_cfi.correctionsType
correctionsType
Definition: calibratedElectrons_cfi.py:40
heppy_batch.val
val
Definition: heppy_batch.py:351
EGEnergySysIndex::kEcalPreCorr
Definition: EGEnergySysIndex.h:31
EGEnergySysIndex::kSmearValue
Definition: EGEnergySysIndex.h:29
StandaloneTrackMonitor_cfi.isMC
isMC
Definition: StandaloneTrackMonitor_cfi.py:13
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
EGEnergySysIndex::kSmearUp
Definition: EGEnergySysIndex.h:26
EGEnergySysIndex::kSmearPhiDown
Definition: EGEnergySysIndex.h:23
Exception
Definition: hltDiff.cc:246
ElectronEnergyCalibrator::defaultScaleCorr_
static const EnergyScaleCorrection::ScaleCorrection defaultScaleCorr_
Definition: ElectronEnergyCalibrator.h:80
EGEnergySysIndex::kScaleSystUp
Definition: EGEnergySysIndex.h:16
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:163
reco::GsfElectron::ecalEnergyError
float ecalEnergyError() const
Definition: GsfElectron.h:821
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
EGEnergySysIndex::kScaleSystDown
Definition: EGEnergySysIndex.h:17
EGEnergySysIndex::kScaleStatUp
Definition: EGEnergySysIndex.h:14
ElectronEnergyCalibrator::setEnergyAndSystVarations
void setEnergyAndSystVarations(const float scale, const float smearNrSigma, const float et, const EnergyScaleCorrection::ScaleCorrection &scaleCorr, const EnergyScaleCorrection::SmearCorrection &smearCorr, reco::GsfElectron &ele, std::array< float, EGEnergySysIndex::kNrSysErrs > &energyData) const
Definition: ElectronEnergyCalibrator.cc:92
dataset
Definition: dataset.py:1
reco::GsfElectron::trackMomentumError
float trackMomentumError() const
Definition: GsfElectron.h:808
EnergyScaleCorrection::ScaleCorrection::scaleErr
float scaleErr(const std::bitset< kErrNrBits > &uncBitMask) const
Definition: EnergyScaleCorrection.cc:341
linearityCorrectionValues::ptMin
double ptMin
Definition: ElectronEnergyCalibrator.h:29
ElectronEnergyCalibrator::epCombinationTool_
const EpCombinationTool * epCombinationTool_
Definition: ElectronEnergyCalibrator.h:75
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
EnergyScaleCorrection::kErrStatSystGain
Definition: EnergyScaleCorrection.h:35
ElectronEnergyCalibrator::newEnergyError_
double newEnergyError_
Definition: ElectronEnergyCalibrator.h:73
EnergyScaleCorrection::ScaleCorrection::scaleErrGain
float scaleErrGain() const
Definition: EnergyScaleCorrection.h:48
EnergyScaleCorrection::ScaleCorrection
Definition: EnergyScaleCorrection.h:38
EGEnergySysIndex::kEcalTrkErrPostCorr
Definition: EGEnergySysIndex.h:38
reco::GsfElectron::setCorrectedEcalEnergy
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:174
ElectronEnergyCalibrator::EventType::MC
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
ElectronEnergyCalibrator::calibrate
void calibrate(SimpleElectron &electron, edm::StreamID const &)
Definition: ElectronEnergyCalibrator.cc:144
ElectronEnergyCalibrator::correctionsType_
int correctionsType_
Definition: ElectronEnergyCalibrator.h:78
EGEnergySysIndex::kSmearPhiUp
Definition: EGEnergySysIndex.h:22
ElectronEnergyCalibrator::minEt_
float minEt_
Definition: ElectronEnergyCalibrator.h:77
EnergyScaleCorrection::ScaleCorrection::scaleErrStat
float scaleErrStat() const
Definition: EnergyScaleCorrection.h:46
correctionValues::corrCat4
double corrCat4
Definition: ElectronEnergyCalibrator.h:22
EnergyScaleCorrection::SmearCorrection::sigma
float sigma(const float et, const float nrSigmaRho=0., const float nrSigmaPhi=0.) const
Definition: EnergyScaleCorrection.h:66
linearityCorrectionValues::corrCat1
double corrCat1
Definition: ElectronEnergyCalibrator.h:32
reco::GsfElectron::ecalEnergy
float ecalEnergy() const
Definition: GsfElectron.h:820
calibratedElectrons_cfi.lumiRatio
lumiRatio
Definition: calibratedElectrons_cfi.py:52