CMS 3D CMS Logo

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

Read and get energy scale and smearings from .dat files. More...

#include <Calibration/ZFitter/src/EnergyScaleCorrection_class.cc>

Public Types

enum  fileFormat_t { UNKNOWN =0, GLOBE, ECALELF_TOY, ECALELF }
 
enum  paramSmear_t { kNone = 0, kRho, kPhi, kNParamSmear }
 

Public Member Functions

 EnergyScaleCorrection_class (std::string correctionFileName, unsigned int genSeed=0)
 
 EnergyScaleCorrection_class ()
 
float getSmearingRho (int runNumber, bool isEBEle, float R9Ele, float etaSCEle, float EtEle) const
 public for sigmaE estimate More...
 
float getSmearingSigma (int runNumber, bool isEBEle, float R9Ele, float etaSCEle, float EtEle, paramSmear_t par, float nSigma=0.) const
 
float getSmearingSigma (int runNumber, bool isEBEle, float R9Ele, float etaSCEle, float EtEle, float nSigma_rho, float nSigma_phi) const
 
float ScaleCorrection (unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
 method to get energy scale corrections More...
 
float ScaleCorrectionUncertainty (unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
 method to get scale correction uncertainties: it's stat+syst in eta x R9 categories More...
 
void SetSmearingType (fileFormat_t value)
 
 ~EnergyScaleCorrection_class (void)
 dummy constructor needed in ElectronEnergyCalibratorRun2 More...
 

Public Attributes

bool doScale
 
bool doSmearings
 

Private Member Functions

void AddScale (TString category_, int runMin_, int runMax_, double deltaP_, double err_deltaP_, double err_syst_deltaP)
 
void AddSmearing (TString category_, int runMin_, int runMax_, double rho, double err_rho, double phi, double err_phi, double Emean, double err_Emean)
 
correctionValue_class getScaleCorrection (unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
 returns the correction value class More...
 
float getScaleOffset (unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
 
float getScaleStatUncertainty (unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
 
float getScaleSystUncertainty (unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
 
void ReadFromFile (TString filename)
 category "runNumber" runMin runMax deltaP err_deltaP_per_bin err_deltaP_stat err_deltaP_syst More...
 
void ReadSmearingFromFile (TString filename)
 File structure: category constTerm alpha;. More...
 

Private Attributes

correction_map_t scales
 
correction_map_t scales_not_defined
 
correction_map_t smearings
 
correction_map_t smearings_not_defined
 
fileFormat_t smearingType_
 

Detailed Description

Read and get energy scale and smearings from .dat files.

Author
Shervin Nourbakhsh

Definition at line 131 of file EnergyScaleCorrection_class.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

EnergyScaleCorrection_class::EnergyScaleCorrection_class ( std::string  correctionFileName,
unsigned int  genSeed = 0 
)

Definition at line 19 of file EnergyScaleCorrection_class.cc.

References MessageLogger_cfi::cerr, cmsRelvalreport::exit, corrVsCorr::filename, ReadFromFile(), ReadSmearingFromFile(), scales, smearings, and AlCaHLTBitMon_QueryRunRegistry::string.

19  :
20  doScale(false), doSmearings(false),
22 {
23 
24  if(!correctionFileName.empty()) {
25  std::string filename = correctionFileName+"_scales.dat";
26  ReadFromFile(filename);
27  if(scales.empty()) {
28  std::cerr << "[ERROR] scale correction map empty" << std::endl;
29  exit(1);
30  }
31  }
32 
33  if(!correctionFileName.empty()) {
34  std::string filename = correctionFileName+"_smearings.dat";
35  ReadSmearingFromFile(filename);
36  if(smearings.empty()) {
37  std::cerr << "[ERROR] smearing correction map empty" << std::endl;
38  exit(1);
39  }
40  }
41 
42  return;
43 }
void ReadFromFile(TString filename)
category "runNumber" runMin runMax deltaP err_deltaP_per_bin err_deltaP_stat err_deltaP_syst ...
void ReadSmearingFromFile(TString filename)
File structure: category constTerm alpha;.
EnergyScaleCorrection_class::EnergyScaleCorrection_class ( )
inline
EnergyScaleCorrection_class::~EnergyScaleCorrection_class ( void  )

dummy constructor needed in ElectronEnergyCalibratorRun2

Definition at line 45 of file EnergyScaleCorrection_class.cc.

46 {
47  return;
48 }

Member Function Documentation

void EnergyScaleCorrection_class::AddScale ( TString  category_,
int  runMin_,
int  runMax_,
double  deltaP_,
double  err_deltaP_,
double  err_syst_deltaP 
)
private

Definition at line 193 of file EnergyScaleCorrection_class.cc.

References eostools::cat(), MessageLogger_cfi::cerr, corr, gather_cfg::cout, cmsRelvalreport::exit, correctionCategory_class::runmax, correctionCategory_class::runmin, correctionValue_class::scale, correctionValue_class::scale_err, correctionValue_class::scale_err_syst, and scales.

Referenced by ReadFromFile().

194 {
195 
196  correctionCategory_class cat(category_); // build the category from the string
197  cat.runmin = runMin_;
198  cat.runmax = runMax_;
199 
200  // the following check is not needed, can be removed
201  if(scales.count(cat) != 0) {
202  std::cerr << "[ERROR] Category already defined!" << std::endl;
203  std::cerr << " Adding category: " << cat << std::endl;
204  std::cerr << " Defined category: " << scales[cat] << std::endl;
205  exit(1);
206  }
207 
208  correctionValue_class corr; // define the correction values
209  corr.scale = deltaP_;
210  corr.scale_err = err_deltaP_;
211  corr.scale_err_syst = err_syst_deltaP;
212  scales[cat] = corr;
213 
214 #ifdef PEDANTIC_OUTPUT
215  std::cout << "[INFO:scale correction] " << cat << corr << std::endl;
216 #endif
217  return;
218 }
def cat(path)
Definition: eostools.py:400
JetCorrectorParameters corr
Definition: classes.h:5
void EnergyScaleCorrection_class::AddSmearing ( TString  category_,
int  runMin_,
int  runMax_,
double  rho,
double  err_rho,
double  phi,
double  err_phi,
double  Emean,
double  err_Emean 
)
private

Definition at line 221 of file EnergyScaleCorrection_class.cc.

References eostools::cat(), MessageLogger_cfi::cerr, corr, gather_cfg::cout, correctionValue_class::Emean, correctionValue_class::Emean_err, cmsRelvalreport::exit, phi, correctionValue_class::phi, correctionValue_class::phi_err, rho, correctionValue_class::rho, correctionValue_class::rho_err, correctionCategory_class::runmax, correctionCategory_class::runmin, and smearings.

Referenced by ReadSmearingFromFile().

224 {
225 
226  correctionCategory_class cat(category_);
227  cat.runmin = (runMin_ < 0) ? 0 : runMin_;
228  cat.runmax = runMax_;
229 
230  if(smearings.count(cat) != 0) {
231  std::cerr << "[ERROR] Smearing category already defined!" << std::endl;
232  std::cerr << " Adding category: " << cat << std::endl;
233  std::cerr << " Defined category: " << smearings[cat] << std::endl;
234  exit(1);
235  }
236 
238  corr.rho = rho;
239  corr.rho_err = err_rho;
240  corr.phi = phi;
241  corr.phi_err = err_phi;
242  corr.Emean = Emean;
243  corr.Emean_err = err_Emean;
244  smearings[cat] = corr;
245 
246 #ifdef PEDANTIC_OUTPUT
247 #ifndef CMSSW
248  std::cout << "[INFO:smearings] " << cat << corr << std::endl;
249 #else
250  edm::LogInfo("[INFO:smearings] ") << cat << corr;
251 #endif
252 #endif
253 
254  return;
255 }
def cat(path)
Definition: eostools.py:400
JetCorrectorParameters corr
Definition: classes.h:5
correctionValue_class EnergyScaleCorrection_class::getScaleCorrection ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const
private

returns the correction value class

Definition at line 86 of file EnergyScaleCorrection_class.cc.

References taus_updatedMVAIds_cff::category, gather_cfg::cout, and scales.

Referenced by getScaleStatUncertainty(), and getScaleSystUncertainty().

87 {
88  // buld the category based on the values of the object
89  correctionCategory_class category(runNumber, etaSCEle, R9Ele, EtEle);
90  correction_map_t::const_iterator corr_itr = scales.find(category); // find the correction value in the map that associates the category to the correction
91 
92  if(corr_itr == scales.end()) { // if not in the standard classes, add it in the list of not defined classes
93 
94  // this part is commented because it makes the method not constant
95  // if(scales_not_defined.count(category) == 0) {
96  // correctionValue_class corr;
97  // scales_not_defined[category] = corr;
98  // }
99  // corr_itr = scales_not_defined.find(category);
101  std::cout << "[ERROR] Scale category not found: " << std::endl;
102  std::cout << category << std::endl;
103  std::cout << "Returning uncorrected value." << std::endl;
104  // exit(1);
105  correctionValue_class nocorr;
106  std::cout << nocorr << std::endl;
107  return nocorr;
108  }
109 
110 #ifdef DEBUG
111  std::cout << "[DEBUG] Checking scale correction for category: " << category << std::endl;
112  std::cout << "[DEBUG] Correction is: " << corr_itr->second
113  << std::endl
114  << " given for category " << corr_itr->first << std::endl;;
115 #endif
116  return corr_itr->second;
117 }
float EnergyScaleCorrection_class::getScaleOffset ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const
private

Definition at line 119 of file EnergyScaleCorrection_class.cc.

References taus_updatedMVAIds_cff::category, gather_cfg::cout, correctionValue_class::scale, and scales.

Referenced by ScaleCorrection().

120 {
121  // buld the category based on the values of the object
122  correctionCategory_class category(runNumber, etaSCEle, R9Ele, EtEle);
123  correction_map_t::const_iterator corr_itr = scales.find(category); // find the correction value in the map that associates the category to the correction
124 
125  if(corr_itr == scales.end()) { // if not in the standard classes, add it in the list of not defined classes
126 
127  // this part is commented because it makes the method not constant
128  // if(scales_not_defined.count(category) == 0) {
129  // correctionValue_class corr;
130  // scales_not_defined[category] = corr;
131  // }
132  // corr_itr = scales_not_defined.find(category);
134  std::cout << "[ERROR] Scale offset category not found: " << std::endl;
135  std::cout << category << std::endl;
136  std::cout << "Returning uncorrected value." << std::endl;
137  // exit(1);
138  correctionValue_class nocorr;
139  return nocorr.scale;
140  }
141 
142 #ifdef DEBUG
143  std::cout << "[DEBUG] Checking scale offset correction for category: " << category << std::endl;
144  std::cout << "[DEBUG] Correction is: " << corr_itr->second
145  << std::endl
146  << " given for category " << corr_itr->first << std::endl;;
147 #endif
148 
149  return corr_itr->second.scale;
150 }
float EnergyScaleCorrection_class::getScaleStatUncertainty ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const
private

Definition at line 73 of file EnergyScaleCorrection_class.cc.

References getScaleCorrection(), and correctionValue_class::scale_err.

Referenced by ScaleCorrectionUncertainty().

75 {
76  return getScaleCorrection(runNumber, isEBEle, R9Ele, etaSCEle, EtEle).scale_err;
77 }
correctionValue_class getScaleCorrection(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
returns the correction value class
float EnergyScaleCorrection_class::getScaleSystUncertainty ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const
private

Definition at line 79 of file EnergyScaleCorrection_class.cc.

References getScaleCorrection(), and correctionValue_class::scale_err_syst.

Referenced by ScaleCorrectionUncertainty().

81 {
82  return getScaleCorrection(runNumber, isEBEle, R9Ele, etaSCEle, EtEle).scale_err_syst;
83 }
correctionValue_class getScaleCorrection(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
returns the correction value class
float EnergyScaleCorrection_class::getSmearingRho ( int  runNumber,
bool  isEBEle,
float  R9Ele,
float  etaSCEle,
float  EtEle 
) const

public for sigmaE estimate

Definition at line 396 of file EnergyScaleCorrection_class.cc.

References taus_updatedMVAIds_cff::category, smearings, and smearings_not_defined.

397 {
398 
399  correctionCategory_class category(runNumber, etaSCEle, R9Ele, EtEle);
400  correction_map_t::const_iterator corr_itr = smearings.find(category);
401  if(corr_itr == smearings.end()) { // if not in the standard classes, add it in the list of not defined classes
402  // if(smearings_not_defined.count(category) == 0) {
403  // correctionValue_class corr;
404  // smearings_not_defined[category] = corr;
405  // }
406  corr_itr = smearings_not_defined.find(category);
407  }
408 
409  return corr_itr->second.rho;
410 }
float EnergyScaleCorrection_class::getSmearingSigma ( int  runNumber,
bool  isEBEle,
float  R9Ele,
float  etaSCEle,
float  EtEle,
paramSmear_t  par,
float  nSigma = 0. 
) const

Definition at line 355 of file EnergyScaleCorrection_class.cc.

References kPhi, and kRho.

Referenced by PhotonEnergyCalibratorRun2::calibrate(), and ElectronEnergyCalibratorRun2::calibrate().

356 {
357  if (par == kRho) return getSmearingSigma(runNumber, isEBEle, R9Ele, etaSCEle, EtEle, nSigma, 0.);
358  if (par == kPhi) return getSmearingSigma(runNumber, isEBEle, R9Ele, etaSCEle, EtEle, 0., nSigma);
359  return getSmearingSigma(runNumber, isEBEle, R9Ele, etaSCEle, EtEle, 0., 0.);
360 }
float getSmearingSigma(int runNumber, bool isEBEle, float R9Ele, float etaSCEle, float EtEle, paramSmear_t par, float nSigma=0.) const
float EnergyScaleCorrection_class::getSmearingSigma ( int  runNumber,
bool  isEBEle,
float  R9Ele,
float  etaSCEle,
float  EtEle,
float  nSigma_rho,
float  nSigma_phi 
) const

Definition at line 362 of file EnergyScaleCorrection_class.cc.

References alpha, taus_updatedMVAIds_cff::category, MessageLogger_cfi::cerr, funct::cos(), gather_cfg::cout, phi, rho, funct::sin(), smearings, smearings_not_defined, and mathSSE::sqrt().

363 {
364 
365  correctionCategory_class category(runNumber, etaSCEle, R9Ele, EtEle);
366  correction_map_t::const_iterator corr_itr = smearings.find(category);
367  if(corr_itr == smearings.end()) { // if not in the standard classes, add it in the list of not defined classes
368  // the following commented part makes the method non const
369  // if(smearings_not_defined.count(category) == 0) {
370  // correctionValue_class corr;
371  // smearings_not_defined[category] = corr;
372  // }
373  corr_itr = smearings_not_defined.find(category);
374  std::cerr << "[WARNING] Smearing category not found: " << std::endl;
375  std::cerr << category << std::endl;
376  // exit(1);
377  }
378 
379 #ifdef DEBUG
380  std::cout << "[DEBUG] Checking smearing correction for category: " << category << std::endl;
381  std::cout << "[DEBUG] Correction is: " << corr_itr->second
382  << std::endl
383  << " given for category " << corr_itr->first;
384 #endif
385 
386  double rho = corr_itr->second.rho + corr_itr->second.rho_err * nSigma_rho;
387  double phi = corr_itr->second.phi + corr_itr->second.phi_err * nSigma_phi;
388 
389  double constTerm = rho * sin(phi);
390  double alpha = rho * corr_itr->second.Emean * cos( phi);
391 
392  return sqrt(constTerm * constTerm + alpha * alpha / EtEle);
393 
394 }
float alpha
Definition: AMPTWrapper.h:95
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void EnergyScaleCorrection_class::ReadFromFile ( TString  filename)
private

category "runNumber" runMin runMax deltaP err_deltaP_per_bin err_deltaP_stat err_deltaP_syst

Input file structure: category "runNumber" runMin runMax deltaP err_deltaP(stat on single bins) err_deltaP_stat(to be used) err_deltaP_syst(to be used)

Definition at line 158 of file EnergyScaleCorrection_class.cc.

References AddScale(), taus_updatedMVAIds_cff::category, MessageLogger_cfi::cerr, gather_cfg::cout, and cmsRelvalreport::exit.

Referenced by EnergyScaleCorrection_class().

159 {
160 #ifdef PEDANTIC_OUTPUT
161  std::cout << "[STATUS] Reading energy scale correction values from file: " << filename << std::endl;
162 #endif
163  std::cout << "[STATUS] Reading energy scale correction values from file: " << filename << std::endl;
164 
165  //std::ifstream Ccufile(edm::FileInPath(Ccufilename).fullPath().c_str(),std::ios::in);
166  std::ifstream f_in(edm::FileInPath(filename).fullPath().c_str());
167 
168  if(!f_in.good()) {
169  std::cerr << "[ERROR] file " << filename << " not readable" << std::endl;
170  exit(1);
171  return;
172  }
173 
174  int runMin, runMax;
175  TString category, region2;
176  double deltaP, err_deltaP, err_deltaP_stat, err_deltaP_syst;
177 
178 
179  for(f_in >> category; f_in.good(); f_in >> category) {
180  f_in >> region2
181  >> runMin >> runMax
182  >> deltaP >> err_deltaP >> err_deltaP_stat >> err_deltaP_syst;
183 
184  AddScale(category, runMin, runMax, deltaP, err_deltaP_stat, err_deltaP_syst);
185  }
186 
187  f_in.close();
188 
189  return;
190 }
void AddScale(TString category_, int runMin_, int runMax_, double deltaP_, double err_deltaP_, double err_syst_deltaP)
void EnergyScaleCorrection_class::ReadSmearingFromFile ( TString  filename)
private

File structure: category constTerm alpha;.

File structure: EBlowEtaBad8TeV 0 0.0 1.0 -999. 0.94 -999999 999999 6.73 0. 7.7e-3 6.32e-4 0.00 0.16 EBlowEtaGold8TeV 0 0.0 1.0 0.94 999. -999999 999999 6.60 0. 7.4e-3 6.50e-4 0.00 0.16 EBhighEtaBad8TeV 0 1.0 1.5 -999. 0.94 -999999 999999 6.73 0. 1.26e-2 1.03e-3 0.00 0.07 EBhighEtaGold8TeV 0 1.0 1.5 0.94 999. -999999 999999 6.52 0. 1.12e-2 1.32e-3 0.00 0.22

EElowEtaBad8TeV 0 1.5 2.0 -999. 0.94 -999999 999999 0. 0. 1.98e-2 3.03e-3 0. 0. EElowEtaGold8TeV 0 1.5 2.0 0.94 999. -999999 999999 0. 0. 1.63e-2 1.22e-3 0. 0. EEhighEtaBad8TeV 0 2.0 3.0 -999. 0.94 -999999 999999 0. 0. 1.92e-2 9.22e-4 0. 0. EEhighEtaGold8TeV 0 2.0 3.0 0.94 999. -999999 999999 0. 0. 1.86e-2 7.81e-4 0. 0.

Definition at line 272 of file EnergyScaleCorrection_class.cc.

References AddSmearing(), taus_updatedMVAIds_cff::category, MessageLogger_cfi::cerr, gather_cfg::cout, ECALELF, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, cmsRelvalreport::exit, GLOBE, M_PI_2, phi, photonValidator_cfi::r9Max, photonValidator_cfi::r9Min, rho, smearingType_, AlCaHLTBitMon_QueryRunRegistry::string, and UNKNOWN.

Referenced by EnergyScaleCorrection_class().

273 {
274 #ifdef PEDANTIC_OUTPUT
275  std::cout << "[STATUS] Reading smearing values from file: " << filename << std::endl;
276 #endif
277  //edm::FileInPath(Ccufilename).fullPath().c_str(),std::ios::in); .fullPath().c_str()
278  std::ifstream f_in(edm::FileInPath(filename).fullPath().c_str());
279  if(!f_in.good()) {
280  std::cerr << "[ERROR] file " << filename << " not readable" << std::endl;
281  exit(1);
282  }
283 
284  int runMin = 0, runMax = 900000;
285  int unused = 0;
286  TString category, region2;
287  //double smearing, err_smearing;
288  double rho, phi, Emean, err_rho, err_phi, err_Emean;
289  double etaMin, etaMax, r9Min, r9Max;
290  std::string phi_string, err_phi_string;
291 
292 
293  while(f_in.peek() != EOF && f_in.good()) {
294  if(f_in.peek() == 10) { // 10 = \n
295  f_in.get();
296  continue;
297  }
298 
299  if(f_in.peek() == 35) { // 35 = #
300  f_in.ignore(1000, 10); // ignore the rest of the line until \n
301  continue;
302  }
303 
304  if(smearingType_ == UNKNOWN) { // trying to guess: not recommended
305  std::cerr << "[ERROR] Not implemented" << std::endl;
306  assert(false);
307 
308  } else if(smearingType_ == GLOBE) {
309  f_in >> category >> unused >> etaMin >> etaMax >> r9Min >> r9Max >> runMin >> runMax >>
310  Emean >> err_Emean >>
311  rho >> err_rho >> phi >> err_phi;
312 
313  AddSmearing(category, runMin, runMax, rho, err_rho, phi, err_phi, Emean, err_Emean);
314 
315  } else if(smearingType_ == ECALELF) {
316  f_in >> category >>
317  Emean >> err_Emean >>
318  rho >> err_rho >> phi_string >> err_phi_string;
319 #ifdef DEBUG
320  std::cout << category
321  //<< "\t" << etaMin << "\t" << etaMax << "\t" << r9Min << "\t" << r9Max << "\t" << runMin << "\t" << runMax
322  << "\tEmean=" << Emean << "\t"
323  << rho << "\t" << err_rho << "\tphi_string="
324  << phi_string << "#\terr_phi_string=" << err_phi_string << std::endl;
325 #endif
326 
327  if(phi_string=="M_PI_2") phi=M_PI_2;
328  else phi = std::stod(phi_string);
329 
330  if(err_phi_string=="M_PI_2") err_phi=M_PI_2;
331  else err_phi = std::stod(err_phi_string);
332 
333 
334  AddSmearing(category, runMin, runMax, rho, err_rho, phi, err_phi, Emean, err_Emean);
335 
336  } else {
337  f_in >> category >> rho >> phi;
338  err_rho = err_phi = Emean = err_Emean = 0;
339  AddSmearing(category, runMin, runMax, rho, err_rho, phi, err_phi, Emean, err_Emean);
340  }
341 #ifdef DEBUG
342  std::cout << category << "\t" << etaMin << "\t" << etaMax << "\t" << r9Min << "\t" << r9Max << "\t" << runMin << "\t" << runMax << "\tEmean=" << Emean << "\t" << rho << "\t" << phi << std::endl;
343 #endif
344  }
345 
346  f_in.close();
347  // runCorrection_itr=runMin_map.begin();
348 
349 
350  return;
351 }
#define M_PI_2
void AddSmearing(TString category_, int runMin_, int runMax_, double rho, double err_rho, double phi, double err_phi, double Emean, double err_Emean)
float EnergyScaleCorrection_class::ScaleCorrection ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const

method to get energy scale corrections

Definition at line 52 of file EnergyScaleCorrection_class.cc.

References doScale, and getScaleOffset().

Referenced by PhotonEnergyCalibratorRun2::calibrate(), and ElectronEnergyCalibratorRun2::calibrate().

54 {
55  float correction = 1;
56  if(doScale) correction *= getScaleOffset(runNumber, isEBEle, R9Ele, etaSCEle, EtEle);
57 
58  return correction;
59 }
float getScaleOffset(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
float EnergyScaleCorrection_class::ScaleCorrectionUncertainty ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const

method to get scale correction uncertainties: it's stat+syst in eta x R9 categories

Definition at line 63 of file EnergyScaleCorrection_class.cc.

References getScaleStatUncertainty(), getScaleSystUncertainty(), and mathSSE::sqrt().

65 {
66  float statUncert = getScaleStatUncertainty(runNumber, isEBEle, R9Ele, etaSCEle, EtEle);
67  float systUncert = getScaleSystUncertainty(runNumber, isEBEle, R9Ele, etaSCEle, EtEle);
68 
69  return sqrt(statUncert * statUncert + systUncert * systUncert);
70 }
float getScaleSystUncertainty(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
T sqrt(T t)
Definition: SSEVec.h:18
float getScaleStatUncertainty(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
void EnergyScaleCorrection_class::SetSmearingType ( fileFormat_t  value)
inline

Definition at line 192 of file EnergyScaleCorrection_class.h.

References pat::UNKNOWN, and relativeConstraints::value.

193  {
194  if(value >= 0 && value <= 1) {
196  } else {
198  }
199  };
Definition: value.py:1

Member Data Documentation

bool EnergyScaleCorrection_class::doScale
bool EnergyScaleCorrection_class::doSmearings
correction_map_t EnergyScaleCorrection_class::scales
private
correction_map_t EnergyScaleCorrection_class::scales_not_defined
private

Definition at line 185 of file EnergyScaleCorrection_class.h.

correction_map_t EnergyScaleCorrection_class::smearings
private
correction_map_t EnergyScaleCorrection_class::smearings_not_defined
private

Definition at line 186 of file EnergyScaleCorrection_class.h.

Referenced by getSmearingRho(), and getSmearingSigma().

fileFormat_t EnergyScaleCorrection_class::smearingType_
private

Definition at line 183 of file EnergyScaleCorrection_class.h.

Referenced by ReadSmearingFromFile().