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, edm::StreamID const &id, const EventType eventType) const
 
std::array< float, EGEnergySysIndex::kNrSysErrscalibrate (reco::GsfElectron &ele, const unsigned int runNumber, const EcalRecHitCollection *recHits, const float smearNrSigma, 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 41 of file ElectronEnergyCalibrator.h.

Member Enumeration Documentation

Enumerator
DATA 
MC 

Definition at line 27 of file ElectronEnergyCalibrator.h.

27  {
28  DATA,
29  MC,
30  };

Constructor & Destructor Documentation

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 44 of file ElectronEnergyCalibrator.h.

References csvReporter::delimiter, metsig::electron, allElectronIsolations_cfi::elements, init, CastorDbASCIIIO::splitString(), str, and AlCaHLTBitMon_QueryRunRegistry::string.

54  :
55  pathData_(pathData),
56  pathLinData_(pathLinData),
57  dataset_(dataset),
58  correctionsType_(correctionsType),
59  applyLinearityCorrection_(applyLinearityCorrection),
60  lumiRatio_(lumiRatio),
61  isMC_(isMC),
62  updateEnergyErrors_(updateEnergyErrors),
63  verbose_(verbose),
64  synchronization_(synchronization) {
65  init();
66  }
ElectronEnergyCalibrator::ElectronEnergyCalibrator ( )
inline
ElectronEnergyCalibrator::ElectronEnergyCalibrator ( const EpCombinationTool combinator,
const std::string &  correctionFile 
)

Definition at line 12 of file ElectronEnergyCalibrator.cc.

13  :
15  epCombinationTool_(&combinator),
16  rng_(nullptr),
17  minEt_(1.0)
18 {
19 
20 }
EnergyScaleCorrection correctionRetriever_
const EpCombinationTool * epCombinationTool_
ElectronEnergyCalibrator::~ElectronEnergyCalibrator ( )
inline

Definition at line 34 of file ElectronEnergyCalibrator.h.

References initPrivateRng().

34 {}

Member Function Documentation

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

Definition at line 181 of file ElectronEnergyCalibrator.cc.

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

Referenced by setEnergyAndSystVarations(), and setMinEt().

184 {
185  const float oldEcalEnergy = ele.ecalEnergy();
186  const float oldEcalEnergyErr = ele.ecalEnergyError();
187 
188  const auto oldP4 = ele.p4();
189  const float oldP4Err = ele.p4Error(reco::GsfElectron::P4_COMBINATION);
190  const float oldTrkMomErr = ele.trackMomentumError();
191 
192  setEcalEnergy(ele,scale,smear);
193  const auto& combinedMomentum = epCombinationTool_->combine(ele,oldEcalEnergyErr*scale);
194 
195  ele.setCorrectedEcalEnergy(oldEcalEnergy);
196  ele.setCorrectedEcalEnergyError(oldEcalEnergyErr);
197  ele.correctMomentum(oldP4,oldTrkMomErr,oldP4Err);
198 
199  return combinedMomentum;
200 }
float trackMomentumError() const
Definition: GsfElectron.h:836
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
void setEcalEnergy(reco::GsfElectron &ele, const float scale, const float smear) const
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
Definition: GsfElectron.h:858
void combine(SimpleElectron &mySimpleElectron) const
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:237
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:179
float ecalEnergyError() const
Definition: GsfElectron.h:849
float ecalEnergy() const
Definition: GsfElectron.h:848
const EpCombinationTool * epCombinationTool_
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:182
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 28 of file ElectronEnergyCalibrator.cc.

References calibrate(), and gauss().

33 {
34  return calibrate(ele,runNumber,recHits,gauss(id),eventType);
35 }
void calibrate(SimpleElectron &electron, edm::StreamID const &)
double gauss(edm::StreamID const &id) const
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 38 of file ElectronEnergyCalibrator.cc.

References funct::abs(), reco::GsfElectron::Corrections::combinedP4Error, correctionRetriever_, reco::GsfElectron::corrections(), DATA, defaultScaleCorr_, defaultSmearCorr_, reco::GsfElectron::ecalEnergy(), reco::GsfElectron::ecalEnergyError(), edm::SortedCollection< T, SORT >::end(), reco::LeafCandidate::energy(), stringResolutionProvider_cfi::et, edm::SortedCollection< T, SORT >::find(), 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_, EnergyScaleCorrection::ScaleCorrection::scale(), setEnergyAndSystVarations(), EnergyScaleCorrection::SmearCorrection::sigma(), and reco::GsfElectron::superCluster().

42 {
43  const float scEtaAbs = std::abs(ele.superCluster()->eta());
44  const float et = ele.ecalEnergy() / cosh(scEtaAbs);
45 
46  if (et < minEt_ || edm::isNotFinite(et) ) {
47  std::array<float,EGEnergySysIndex::kNrSysErrs> retVal;
48  retVal.fill(ele.energy());
49  retVal[EGEnergySysIndex::kScaleValue] = 1.0;
50  retVal[EGEnergySysIndex::kSmearValue] = 0.0;
51  retVal[EGEnergySysIndex::kSmearNrSigma] = smearNrSigma;
60  return retVal;
61  }
62 
63  const DetId seedDetId = ele.superCluster()->seed()->seed();
64  EcalRecHitCollection::const_iterator seedRecHit = recHits->find(seedDetId);
65  unsigned int gainSeedSC = 12;
66  if (seedRecHit != recHits->end()) {
67  if(seedRecHit->checkFlag(EcalRecHit::kHasSwitchToGain6)) gainSeedSC = 6;
68  if(seedRecHit->checkFlag(EcalRecHit::kHasSwitchToGain1)) gainSeedSC = 1;
69  }
70 
71  const EnergyScaleCorrection::ScaleCorrection* scaleCorr = correctionRetriever_.getScaleCorr(runNumber, et, scEtaAbs, ele.full5x5_r9(), gainSeedSC);
72  const EnergyScaleCorrection::SmearCorrection* smearCorr = correctionRetriever_.getSmearCorr(runNumber, et, scEtaAbs, ele.full5x5_r9(), gainSeedSC);
73  if(scaleCorr==nullptr) scaleCorr=&defaultScaleCorr_;
74  if(smearCorr==nullptr) smearCorr=&defaultSmearCorr_;
75 
76  std::array<float,EGEnergySysIndex::kNrSysErrs> uncertainties{};
77 
78  uncertainties[EGEnergySysIndex::kScaleValue] = scaleCorr->scale();
79  uncertainties[EGEnergySysIndex::kSmearValue] = smearCorr->sigma(et); //even though we use scale = 1.0, we still store the value returned for MC
80  uncertainties[EGEnergySysIndex::kSmearNrSigma] = smearNrSigma;
81  //MC central values are not scaled (scale = 1.0), data is not smeared (smearNrSigma = 0)
82  //the smearing (or resolution extra parameter as it might better be called)
83  //still has a second order effect on data as it enters the E/p combination as an adjustment
84  //to the estimate of the resolution contained in caloEnergyError
85  //MC gets all the scale systematics
86  if(eventType == EventType::DATA){
87  setEnergyAndSystVarations(scaleCorr->scale(),0.,et,*scaleCorr,*smearCorr,ele,uncertainties);
88  }else if(eventType == EventType::MC){
89  setEnergyAndSystVarations(1.0,smearNrSigma,et,*scaleCorr,*smearCorr,ele,uncertainties);
90  }
91 
92  return uncertainties;
93 
94 }
const Corrections & corrections() const
Definition: GsfElectron.h:841
EnergyScaleCorrection correctionRetriever_
std::vector< EcalRecHit >::const_iterator const_iterator
bool isNotFinite(T x)
Definition: isFinite.h:10
const ScaleCorrection * getScaleCorr(unsigned int runnr, double et, double eta, double r9, unsigned int gainSeed) const
double energy() const final
energy
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const SmearCorrection * getSmearCorr(unsigned int runnr, double et, double eta, double r9, unsigned int gainSeed) const
float ecalEnergyError() const
Definition: GsfElectron.h:849
float sigma(const float et, const float nrSigmaRho=0., const float nrSigmaPhi=0.) const
const_iterator end() const
Definition: DetId.h:18
et
define resolution functions of each parameter
float ecalEnergy() const
Definition: GsfElectron.h:848
static const EnergyScaleCorrection::SmearCorrection defaultSmearCorr_
float full5x5_r9() const
Definition: GsfElectron.h:463
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
static const EnergyScaleCorrection::ScaleCorrection defaultScaleCorr_
iterator find(key_type k)
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
void ElectronEnergyCalibrator::calibrate ( SimpleElectron electron,
edm::StreamID const &  streamID 
)

Definition at line 164 of file ElectronEnergyCalibrator.cc.

References correctionValues::corrCat0, correctionValues::corrCat1, correctionValues::corrCat2, correctionValues::corrCat3, correctionValues::corrCat4, correctionValues::corrCat5, correctionValues::corrCat6, correctionValues::corrCat7, correctionsType_, corrValArray, gather_cfg::cout, dataset_, PVValHelper::eta, Exception, edm::RandomNumberGenerator::getEngine(), SimpleElectron::getEta(), SimpleElectron::getR9(), SimpleElectron::getRegEnergy(), SimpleElectron::getRegEnergyError(), SimpleElectron::getRunNumber(), SimpleElectron::getSCEnergy(), SimpleElectron::getSCEnergyError(), mps_fire::i, edm::Service< T >::isAvailable(), SimpleElectron::isEB(), isMC_, lumiRatio_, nCorrValRaw, newEnergy_, newEnergyError_, electrons_cff::r9, Scenarios_cff::scale, SimpleElectron::setNewEnergy(), SimpleElectron::setNewEnergyError(), mathSSE::sqrt(), synchronization_, updateEnergyErrors_, and verbose_.

Referenced by calibrate(), initPrivateRng(), CalibratedElectronProducerT< T >::produce(), and setMinEt().

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

Definition at line 451 of file ElectronEnergyCalibrator.cc.

References applyLinearityCorrection_, linearityCorrectionValues::corrCat0, linearityCorrectionValues::corrCat1, linearityCorrectionValues::corrCat2, linearityCorrectionValues::corrCat3, linearityCorrectionValues::corrCat4, linearityCorrectionValues::corrCat5, gather_cfg::cout, PVValHelper::eta, JetChargeProducer_cfi::exp, SimpleElectron::getCombinedMomentum(), SimpleElectron::getElClass(), SimpleElectron::getEta(), mps_fire::i, SimpleElectron::isEB(), isMC_, linCorrValArray, nLinCorrValRaw, AlCaHLTBitMon_ParallelJobs::p, EnergyCorrector::pt, AlignmentTrackSelector_cfi::ptMax, ALCARECOTkAlBeamHalo_cff::ptMin, SimpleElectron::setCombinedMomentum(), funct::sin(), theta(), and verbose_.

452 {
454  {
455  bool isEB = electron.isEB();
456  double eta = electron.getEta();
457  double theta = 2*atan(exp(-eta));
458  double p = electron.getCombinedMomentum();
459  double pt = p * fabs(sin(theta));
460  int classification = electron.getElClass();
461  double linscale = 0.;
462 
463  for (int i=0; i < nLinCorrValRaw; i++)
464  {
465  if ((pt >= linCorrValArray[i].ptMin) && (pt <= linCorrValArray[i].ptMax))
466  {
467  if (isEB)
468  {
469  if (fabs(eta) < 1)
470  {
471  if (classification<2)
472  {
473  linscale = linCorrValArray[i].corrCat0;
474  } else
475  {
476  linscale = linCorrValArray[i].corrCat3;
477  }
478  } else
479  {
480  if (classification<2)
481  {
482  linscale = linCorrValArray[i].corrCat1;
483  } else
484  {
485  linscale = linCorrValArray[i].corrCat4;
486  }
487  }
488  } else // !isEB
489  {
490  if (classification<2)
491  {
492  linscale = linCorrValArray[i].corrCat2;
493  } else
494  {
495  linscale = linCorrValArray[i].corrCat5;
496  }
497  }
498  }
499  }
500  double newP = p/(1.+linscale);
501  if (verbose_)
502  {
503  std::cout << "[ElectronEnergyCalibrator] Applying a linearity correction of " << 1./(1.+linscale) << " to " << pt << " GeV in pt" << std::endl;
504  }
505  electron.setCombinedMomentum(newP);
506  if (verbose_)
507  {
508  std::cout << "[ElectronEnergyCalibrator] calibrated transverse momentum " << pt << " GeV recalibrated for linearity to momentum " << electron.getCombinedMomentum()*fabs(sin(theta)) << " GeV" << std::endl;
509  }
510  }
511 }
int getElClass() const
void setCombinedMomentum(double combinedMomentum)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
double getCombinedMomentum() const
double getEta() const
linearityCorrectionValues linCorrValArray[100]
bool isEB() const
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 203 of file ElectronEnergyCalibrator.cc.

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

Referenced by calibrate(), and setMinEt().

204 {
205  if (rng_) {
206  return rng_->Gaus();
207  } else {
209  if ( !rng.isAvailable() ) {
210  throw cms::Exception("Configuration")
211  << "XXXXXXX requires the RandomNumberGeneratorService\n"
212  "which is not present in the configuration file. You must add the service\n"
213  "in the configuration file or remove the modules that require it.";
214  }
215  CLHEP::RandGaussQ gaussDistribution(rng->getEngine(id), 0.0, 1.0);
216  return gaussDistribution.fire();
217  }
218 }
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
bool isAvailable() const
Definition: Service.h:46
void ElectronEnergyCalibrator::init ( void  )
private

Definition at line 23 of file ElectronEnergyCalibrator.cc.

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, csvReporter::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_.

24 {
25  if ( !isMC_ ) // DATA
26  {
27  if ( verbose_ )
28  {
29  std::cout << "[ElectronEnergyCalibrator] Initialization in DATA mode" << std::endl;
30  }
31 
32  std::ifstream fin(pathData_.c_str());
33 
34  if (!fin){
35  throw cms::Exception("Configuration")
36  << "[ElectronEnergyCalibrator] Cannot open the file "
37  << pathData_ << "\n It is not found, missed or corrupted" ;
38  } else
39  {
40  if ( verbose_ )
41  {
42  std::cout << "[ElectronEnergyCalibrator] File "
43  << pathData_ << " succesfully opened" << std::endl;
44  }
45 
46  std::string s;
47  std::vector<std::string> selements;
48  std::string delimiter = ",";
49  nCorrValRaw = 0;
50 
51  while ( !fin.eof() )
52  {
53  getline(fin, s);
54  if ( !s.empty() )
55  {
56  splitString(s, selements, delimiter);
67 
68  nCorrValRaw++;
69 
70  selements.clear();
71  }
72  }
73 
74  fin.close();
75 
76  if ( verbose_ )
77  {
78  std::cout << "[ElectronEnergyCalibrator] File closed" << std::endl;
79  }
80 
81  }
82  // linearity corrections data
84  {
85  std::ifstream finlin(pathLinData_.c_str());
86 
87  if (!finlin)
88  {
89  throw cms::Exception("Configuration")
90  << "[ElectronEnergyCalibrator] Cannot open the file "<< pathLinData_ << "\n It is not found, missed or corrupted" ;
91  } else
92  {
93  if (verbose_)
94  {
95  std::cout<<"[ElectronEnergyCalibrator] File with Linearity Corrections "<<pathLinData_<<" succesfully opened"<<std::endl;
96  }
97 
98  std::string s;
99  std::vector<std::string> selements;
100  std::string delimiter = ",";
101  nLinCorrValRaw = 0;
102 
103  while ( !finlin.eof() )
104  {
105  getline(finlin, s);
106  if ( !s.empty() )
107  {
108  splitString(s, selements, delimiter);
109 
118 
119  nLinCorrValRaw++;
120 
121  selements.clear();
122  }
123  }
124 
125  finlin.close();
126 
127  if (verbose_)
128  {
129  std::cout<<"[ElectronEnergyCalibrator] File closed"<<std::endl;
130  }
131  }
132  }
133  } else // MC
134  {
135  if ( verbose_ )
136  {
137  std::cout << "[ElectronEnergyCalibrator] Initialization in MC mode" << std::endl;
138  }
139  }
140 }
correctionValues corrValArray[100]
double stringToDouble(const std::string &str)
linearityCorrectionValues linCorrValArray[100]
void splitString(const std::string &fullstr, std::vector< std::string > &elements, const std::string &delimiter)
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 22 of file ElectronEnergyCalibrator.cc.

References calibrate(), and rng_.

Referenced by CalibratedElectronProducerT< T >::CalibratedElectronProducerT(), and ~ElectronEnergyCalibrator().

23 {
24  rng_ = rnd;
25 }
void ElectronEnergyCalibrator::setEcalEnergy ( reco::GsfElectron ele,
const float  scale,
const float  smear 
) const
private

Definition at line 171 of file ElectronEnergyCalibrator.cc.

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

Referenced by calCombinedMom(), setEnergyAndSystVarations(), and setMinEt().

174 {
175  const float oldEcalEnergy = ele.ecalEnergy();
176  const float oldEcalEnergyErr = ele.ecalEnergyError();
177  ele.setCorrectedEcalEnergy( oldEcalEnergy*scale );
178  ele.setCorrectedEcalEnergyError(std::hypot( oldEcalEnergyErr*scale, oldEcalEnergy*smear*scale ) );
179 }
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:179
float ecalEnergyError() const
Definition: GsfElectron.h:849
float ecalEnergy() const
Definition: GsfElectron.h:848
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:182
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 97 of file ElectronEnergyCalibrator.cc.

References calCombinedMom(), reco::GsfElectron::Corrections::combinedP4Error, corr, reco::GsfElectron::corrections(), reco::GsfElectron::correctMomentum(), reco::GsfElectron::ecalEnergy(), reco::GsfElectron::ecalEnergyError(), reco::LeafCandidate::energy(), 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(), EnergyScaleCorrection::ScaleCorrection::scaleErr(), EnergyScaleCorrection::ScaleCorrection::scaleErrGain(), EnergyScaleCorrection::ScaleCorrection::scaleErrStat(), EnergyScaleCorrection::ScaleCorrection::scaleErrSyst(), setEcalEnergy(), EnergyScaleCorrection::SmearCorrection::sigma(), and reco::GsfElectron::trackMomentumError().

Referenced by calibrate(), and setMinEt().

102 {
103 
104  const float smear = smearCorr.sigma(et);
105  const float smearRhoUp = smearCorr.sigma(et,1,0);
106  const float smearRhoDn = smearCorr.sigma(et,-1,0);
107  const float smearPhiUp = smearCorr.sigma(et,0,1);
108  const float smearPhiDn = smearCorr.sigma(et,0,-1);
109  const float smearUp = smearRhoUp;
110  const float smearDn = smearRhoDn;
111 
112  const float corr = scale + smear * smearNrSigma;
113  const float corrRhoUp = scale + smearRhoUp * smearNrSigma;
114  const float corrRhoDn = scale + smearRhoDn * smearNrSigma;
115  const float corrPhiUp = scale + smearPhiUp * smearNrSigma;
116  const float corrPhiDn = scale + smearPhiDn * smearNrSigma;
117  const float corrUp = corrRhoUp;
118  const float corrDn = corrRhoDn;
119 
120  const float corrScaleStatUp = corr+scaleCorr.scaleErrStat();
121  const float corrScaleStatDn = corr-scaleCorr.scaleErrStat();
122  const float corrScaleSystUp = corr+scaleCorr.scaleErrSyst();
123  const float corrScaleSystDn = corr-scaleCorr.scaleErrSyst();
124  const float corrScaleGainUp = corr+scaleCorr.scaleErrGain();
125  const float corrScaleGainDn = corr-scaleCorr.scaleErrGain();
126  const float corrScaleUp = corr+scaleCorr.scaleErr(EnergyScaleCorrection::kErrStatSystGain);
127  const float corrScaleDn = corr-scaleCorr.scaleErr(EnergyScaleCorrection::kErrStatSystGain);
128 
129  const math::XYZTLorentzVector oldP4 = ele.p4();
130  energyData[EGEnergySysIndex::kEcalTrkPreCorr] = ele.energy();
132  energyData[EGEnergySysIndex::kEcalPreCorr] = ele.ecalEnergy();
134 
135  energyData[EGEnergySysIndex::kScaleStatUp] = calCombinedMom(ele,corrScaleStatUp,smear).first;
136  energyData[EGEnergySysIndex::kScaleStatDown] = calCombinedMom(ele,corrScaleStatDn,smear).first;
137  energyData[EGEnergySysIndex::kScaleSystUp] = calCombinedMom(ele,corrScaleSystUp,smear).first;
138  energyData[EGEnergySysIndex::kScaleSystDown] = calCombinedMom(ele,corrScaleSystDn,smear).first;
139  energyData[EGEnergySysIndex::kScaleGainUp] = calCombinedMom(ele,corrScaleGainUp,smear).first;
140  energyData[EGEnergySysIndex::kScaleGainDown] = calCombinedMom(ele,corrScaleGainDn,smear).first;
141 
142  energyData[EGEnergySysIndex::kSmearRhoUp] = calCombinedMom(ele,corrRhoUp,smearRhoUp).first;
143  energyData[EGEnergySysIndex::kSmearRhoDown] = calCombinedMom(ele,corrRhoDn,smearRhoDn).first;
144  energyData[EGEnergySysIndex::kSmearPhiUp] = calCombinedMom(ele,corrPhiUp,smearPhiUp).first;
145  energyData[EGEnergySysIndex::kSmearPhiDown] = calCombinedMom(ele,corrPhiDn,smearPhiDn).first;
146 
147  energyData[EGEnergySysIndex::kScaleUp] = calCombinedMom(ele,corrScaleUp,smear).first;
148  energyData[EGEnergySysIndex::kScaleDown] = calCombinedMom(ele,corrScaleDn,smear).first;
149  energyData[EGEnergySysIndex::kSmearUp] = calCombinedMom(ele,corrUp,smearUp).first;
150  energyData[EGEnergySysIndex::kSmearDown] = calCombinedMom(ele,corrDn,smearDn).first;
151 
152  const std::pair<float, float> combinedMomentum = calCombinedMom(ele,corr,smear);
153  setEcalEnergy(ele,corr,smear);
154  const float energyCorr = combinedMomentum.first / oldP4.t();
155 
156  const math::XYZTLorentzVector newP4(oldP4.x() * energyCorr,
157  oldP4.y() * energyCorr,
158  oldP4.z() * energyCorr,
159  combinedMomentum.first);
160 
161  ele.correctMomentum(newP4, ele.trackMomentumError(), combinedMomentum.second);
162  energyData[EGEnergySysIndex::kEcalTrkPostCorr] = ele.energy();
164 
165  energyData[EGEnergySysIndex::kEcalPostCorr] = ele.ecalEnergy();
167 
168 }
float trackMomentumError() const
Definition: GsfElectron.h:836
const Corrections & corrections() const
Definition: GsfElectron.h:841
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
void setEcalEnergy(reco::GsfElectron &ele, const float scale, const float smear) const
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
Definition: GsfElectron.h:858
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double energy() const final
energy
float ecalEnergyError() const
Definition: GsfElectron.h:849
JetCorrectorParameters corr
Definition: classes.h:5
float scaleErr(const std::bitset< kErrNrBits > &uncBitMask) const
float sigma(const float et, const float nrSigmaRho=0., const float nrSigmaPhi=0.) const
et
define resolution functions of each parameter
float ecalEnergy() const
Definition: GsfElectron.h:848
std::pair< float, float > calCombinedMom(reco::GsfElectron &ele, const float scale, const float smear) const
void ElectronEnergyCalibrator::setMinEt ( float  val)
inline
void ElectronEnergyCalibrator::splitString ( const std::string &  fullstr,
std::vector< std::string > &  elements,
const std::string &  delimiter 
)
private

Definition at line 142 of file ElectronEnergyCalibrator.cc.

Referenced by init().

143 {
144  std::string::size_type lastpos = fullstr.find_first_not_of(delimiter, 0);
145  std::string::size_type pos = fullstr.find_first_of(delimiter, lastpos);
146 
147  while ( ( std::string::npos != pos ) || ( std::string::npos != lastpos ) )
148  {
149  elements.push_back(fullstr.substr(lastpos, pos-lastpos));
150  lastpos = fullstr.find_first_not_of(delimiter, pos);
151  pos = fullstr.find_first_of(delimiter, lastpos);
152  }
153 }
uint16_t size_type
double ElectronEnergyCalibrator::stringToDouble ( const std::string &  str)
private

Definition at line 155 of file ElectronEnergyCalibrator.cc.

References heppy_batch::val.

Referenced by init().

156 {
157  std::istringstream stm;
158  double val = 0;
159  stm.str(str);
160  stm >> val;
161  return val;
162 }
#define str(s)

Member Data Documentation

bool ElectronEnergyCalibrator::applyLinearityCorrection_
private

Definition at line 86 of file ElectronEnergyCalibrator.h.

Referenced by correctLinearity(), and init().

EnergyScaleCorrection ElectronEnergyCalibrator::correctionRetriever_
private

Definition at line 71 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

int ElectronEnergyCalibrator::correctionsType_
private

Definition at line 85 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

correctionValues ElectronEnergyCalibrator::corrValArray[100]
private

Definition at line 93 of file ElectronEnergyCalibrator.h.

Referenced by calibrate(), and init().

correctionValues ElectronEnergyCalibrator::corrValMC
private

Definition at line 94 of file ElectronEnergyCalibrator.h.

std::string ElectronEnergyCalibrator::dataset_
private

Definition at line 84 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

const EnergyScaleCorrection::ScaleCorrection ElectronEnergyCalibrator::defaultScaleCorr_
staticprivate

Definition at line 77 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

const EnergyScaleCorrection::SmearCorrection ElectronEnergyCalibrator::defaultSmearCorr_
staticprivate

Definition at line 78 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

const EpCombinationTool* ElectronEnergyCalibrator::epCombinationTool_
private

Definition at line 72 of file ElectronEnergyCalibrator.h.

Referenced by calCombinedMom().

bool ElectronEnergyCalibrator::isMC_
private

Definition at line 88 of file ElectronEnergyCalibrator.h.

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

linearityCorrectionValues ElectronEnergyCalibrator::linCorrValArray[100]
private

Definition at line 95 of file ElectronEnergyCalibrator.h.

Referenced by correctLinearity(), and init().

double ElectronEnergyCalibrator::lumiRatio_
private

Definition at line 87 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

float ElectronEnergyCalibrator::minEt_
private

Definition at line 74 of file ElectronEnergyCalibrator.h.

Referenced by calibrate(), and setMinEt().

int ElectronEnergyCalibrator::nCorrValRaw
private

Definition at line 96 of file ElectronEnergyCalibrator.h.

Referenced by calibrate(), and init().

double ElectronEnergyCalibrator::newEnergy_
private

Definition at line 79 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

double ElectronEnergyCalibrator::newEnergyError_
private

Definition at line 80 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

int ElectronEnergyCalibrator::nLinCorrValRaw
private

Definition at line 96 of file ElectronEnergyCalibrator.h.

Referenced by correctLinearity(), and init().

std::string ElectronEnergyCalibrator::pathData_
private

Definition at line 82 of file ElectronEnergyCalibrator.h.

Referenced by init().

std::string ElectronEnergyCalibrator::pathLinData_
private

Definition at line 83 of file ElectronEnergyCalibrator.h.

Referenced by init().

TRandom* ElectronEnergyCalibrator::rng_
private

Definition at line 73 of file ElectronEnergyCalibrator.h.

Referenced by gauss(), and initPrivateRng().

bool ElectronEnergyCalibrator::synchronization_
private

Definition at line 91 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

bool ElectronEnergyCalibrator::updateEnergyErrors_
private

Definition at line 89 of file ElectronEnergyCalibrator.h.

Referenced by calibrate().

bool ElectronEnergyCalibrator::verbose_
private

Definition at line 90 of file ElectronEnergyCalibrator.h.

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