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 118 of file EnergyScaleCorrection_class.h.

Member Enumeration Documentation

◆ fileFormat_t

◆ paramSmear_t

Constructor & Destructor Documentation

◆ EnergyScaleCorrection_class() [1/2]

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

Definition at line 19 of file EnergyScaleCorrection_class.cc.

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

20  : doScale(false), doSmearings(false), smearingType_(ECALELF) {
21  if (!correctionFileName.empty()) {
22  std::string filename = correctionFileName + "_scales.dat";
24  if (scales.empty()) {
25  std::cerr << "[ERROR] scale correction map empty" << std::endl;
26  exit(1);
27  }
28  }
29 
30  if (!correctionFileName.empty()) {
31  std::string filename = correctionFileName + "_smearings.dat";
33  if (smearings.empty()) {
34  std::cerr << "[ERROR] smearing correction map empty" << std::endl;
35  exit(1);
36  }
37  }
38 
39  return;
40 }
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;.
def exit(msg="")

◆ EnergyScaleCorrection_class() [2/2]

EnergyScaleCorrection_class::EnergyScaleCorrection_class ( )
inline

Definition at line 128 of file EnergyScaleCorrection_class.h.

128 {};

◆ ~EnergyScaleCorrection_class()

EnergyScaleCorrection_class::~EnergyScaleCorrection_class ( void  )

dummy constructor needed in ElectronEnergyCalibratorRun2

Definition at line 42 of file EnergyScaleCorrection_class.cc.

42 { return; }

Member Function Documentation

◆ AddScale()

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

Definition at line 175 of file EnergyScaleCorrection_class.cc.

References eostools::cat(), DMR_cfg::cerr, alignCSCRings::corr, gather_cfg::cout, beamvalidation::exit(), and scales.

Referenced by ReadFromFile().

176  {
177  correctionCategory_class cat(category_); // build the category from the string
178  cat.runmin = runMin_;
179  cat.runmax = runMax_;
180 
181  // the following check is not needed, can be removed
182  if (scales.count(cat) != 0) {
183  std::cerr << "[ERROR] Category already defined!" << std::endl;
184  std::cerr << " Adding category: " << cat << std::endl;
185  std::cerr << " Defined category: " << scales[cat] << std::endl;
186  exit(1);
187  }
188 
189  correctionValue_class corr; // define the correction values
190  corr.scale = deltaP_;
191  corr.scale_err = err_deltaP_;
192  corr.scale_err_syst = err_syst_deltaP;
193  scales[cat] = corr;
194 
195 #ifdef PEDANTIC_OUTPUT
196  std::cout << "[INFO:scale correction] " << cat << corr << std::endl;
197 #endif
198  return;
199 }
def cat(path)
Definition: eostools.py:401
dictionary corr
def exit(msg="")

◆ AddSmearing()

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 202 of file EnergyScaleCorrection_class.cc.

References eostools::cat(), DMR_cfg::cerr, alignCSCRings::corr, gather_cfg::cout, beamvalidation::exit(), phi, rho, and smearings.

Referenced by ReadSmearingFromFile().

210  {
211  correctionCategory_class cat(category_);
212  cat.runmin = (runMin_ < 0) ? 0 : runMin_;
213  cat.runmax = runMax_;
214 
215  if (smearings.count(cat) != 0) {
216  std::cerr << "[ERROR] Smearing category already defined!" << std::endl;
217  std::cerr << " Adding category: " << cat << std::endl;
218  std::cerr << " Defined category: " << smearings[cat] << std::endl;
219  exit(1);
220  }
221 
223  corr.rho = rho;
224  corr.rho_err = err_rho;
225  corr.phi = phi;
226  corr.phi_err = err_phi;
227  corr.Emean = Emean;
228  corr.Emean_err = err_Emean;
229  smearings[cat] = corr;
230 
231 #ifdef PEDANTIC_OUTPUT
232 #ifndef CMSSW
233  std::cout << "[INFO:smearings] " << cat << corr << std::endl;
234 #else
235  edm::LogInfo("[INFO:smearings] ") << cat << corr;
236 #endif
237 #endif
238 
239  return;
240 }
def cat(path)
Definition: eostools.py:401
dictionary corr
Log< level::Info, false > LogInfo
def exit(msg="")

◆ getScaleCorrection()

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 71 of file EnergyScaleCorrection_class.cc.

References validateAlignments::category, gather_cfg::cout, convertSQLiteXML::runNumber, and scales.

Referenced by getScaleStatUncertainty(), and getScaleSystUncertainty().

72  {
73  // buld the category based on the values of the object
74  correctionCategory_class category(runNumber, etaSCEle, R9Ele, EtEle);
75  correction_map_t::const_iterator corr_itr =
76  scales.find(category); // find the correction value in the map that associates the category to the correction
77 
78  if (corr_itr == scales.end()) { // if not in the standard classes, add it in the list of not defined classes
79 
80  // this part is commented because it makes the method not constant
81  // if(scales_not_defined.count(category) == 0) {
82  // correctionValue_class corr;
83  // scales_not_defined[category] = corr;
84  // }
85  // corr_itr = scales_not_defined.find(category);
87  std::cout << "[ERROR] Scale category not found: " << std::endl;
88  std::cout << category << std::endl;
89  std::cout << "Returning uncorrected value." << std::endl;
90  // exit(1);
91  correctionValue_class nocorr;
92  std::cout << nocorr << std::endl;
93  return nocorr;
94  }
95 
96 #ifdef DEBUG
97  std::cout << "[DEBUG] Checking scale correction for category: " << category << std::endl;
98  std::cout << "[DEBUG] Correction is: " << corr_itr->second << std::endl
99  << " given for category " << corr_itr->first << std::endl;
100  ;
101 #endif
102  return corr_itr->second;
103 }

◆ getScaleOffset()

float EnergyScaleCorrection_class::getScaleOffset ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const
private

Definition at line 105 of file EnergyScaleCorrection_class.cc.

References validateAlignments::category, gather_cfg::cout, convertSQLiteXML::runNumber, correctionValue_class::scale, and scales.

Referenced by ScaleCorrection().

106  {
107  // buld the category based on the values of the object
108  correctionCategory_class category(runNumber, etaSCEle, R9Ele, EtEle);
109  correction_map_t::const_iterator corr_itr =
110  scales.find(category); // find the correction value in the map that associates the category to the correction
111 
112  if (corr_itr == scales.end()) { // if not in the standard classes, add it in the list of not defined classes
113 
114  // this part is commented because it makes the method not constant
115  // if(scales_not_defined.count(category) == 0) {
116  // correctionValue_class corr;
117  // scales_not_defined[category] = corr;
118  // }
119  // corr_itr = scales_not_defined.find(category);
121  std::cout << "[ERROR] Scale offset category not found: " << std::endl;
122  std::cout << category << std::endl;
123  std::cout << "Returning uncorrected value." << std::endl;
124  // exit(1);
125  correctionValue_class nocorr;
126  return nocorr.scale;
127  }
128 
129 #ifdef DEBUG
130  std::cout << "[DEBUG] Checking scale offset correction for category: " << category << std::endl;
131  std::cout << "[DEBUG] Correction is: " << corr_itr->second << std::endl
132  << " given for category " << corr_itr->first << std::endl;
133  ;
134 #endif
135 
136  return corr_itr->second.scale;
137 }

◆ getScaleStatUncertainty()

float EnergyScaleCorrection_class::getScaleStatUncertainty ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const
private

Definition at line 61 of file EnergyScaleCorrection_class.cc.

References getScaleCorrection(), convertSQLiteXML::runNumber, and correctionValue_class::scale_err.

Referenced by ScaleCorrectionUncertainty().

62  {
63  return getScaleCorrection(runNumber, isEBEle, R9Ele, etaSCEle, EtEle).scale_err;
64 }
correctionValue_class getScaleCorrection(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
returns the correction value class

◆ getScaleSystUncertainty()

float EnergyScaleCorrection_class::getScaleSystUncertainty ( unsigned int  runNumber,
bool  isEBEle,
double  R9Ele,
double  etaSCEle,
double  EtEle 
) const
private

Definition at line 66 of file EnergyScaleCorrection_class.cc.

References getScaleCorrection(), convertSQLiteXML::runNumber, and correctionValue_class::scale_err_syst.

Referenced by ScaleCorrectionUncertainty().

67  {
68  return getScaleCorrection(runNumber, isEBEle, R9Ele, etaSCEle, EtEle).scale_err_syst;
69 }
correctionValue_class getScaleCorrection(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
returns the correction value class

◆ getSmearingRho()

float EnergyScaleCorrection_class::getSmearingRho ( int  runNumber,
bool  isEBEle,
float  R9Ele,
float  etaSCEle,
float  EtEle 
) const

public for sigmaE estimate

Definition at line 376 of file EnergyScaleCorrection_class.cc.

References validateAlignments::category, convertSQLiteXML::runNumber, smearings, and smearings_not_defined.

377  {
378  correctionCategory_class category(runNumber, etaSCEle, R9Ele, EtEle);
379  correction_map_t::const_iterator corr_itr = smearings.find(category);
380  if (corr_itr == smearings.end()) { // if not in the standard classes, add it in the list of not defined classes
381  // if(smearings_not_defined.count(category) == 0) {
382  // correctionValue_class corr;
383  // smearings_not_defined[category] = corr;
384  // }
385  corr_itr = smearings_not_defined.find(category);
386  }
387 
388  return corr_itr->second.rho;
389 }

◆ getSmearingSigma() [1/2]

float EnergyScaleCorrection_class::getSmearingSigma ( int  runNumber,
bool  isEBEle,
float  R9Ele,
float  etaSCEle,
float  EtEle,
paramSmear_t  par,
float  nSigma = 0. 
) const

Definition at line 336 of file EnergyScaleCorrection_class.cc.

References kPhi, kRho, HLTSiStripMonitoring_cff::nSigma, and convertSQLiteXML::runNumber.

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

337  {
338  if (par == kRho)
339  return getSmearingSigma(runNumber, isEBEle, R9Ele, etaSCEle, EtEle, nSigma, 0.);
340  if (par == kPhi)
341  return getSmearingSigma(runNumber, isEBEle, R9Ele, etaSCEle, EtEle, 0., nSigma);
342  return getSmearingSigma(runNumber, isEBEle, R9Ele, etaSCEle, EtEle, 0., 0.);
343 }
float getSmearingSigma(int runNumber, bool isEBEle, float R9Ele, float etaSCEle, float EtEle, paramSmear_t par, float nSigma=0.) const

◆ getSmearingSigma() [2/2]

float EnergyScaleCorrection_class::getSmearingSigma ( int  runNumber,
bool  isEBEle,
float  R9Ele,
float  etaSCEle,
float  EtEle,
float  nSigma_rho,
float  nSigma_phi 
) const

Definition at line 345 of file EnergyScaleCorrection_class.cc.

References simBeamSpotPI::alpha, validateAlignments::category, DMR_cfg::cerr, funct::cos(), gather_cfg::cout, phi, rho, convertSQLiteXML::runNumber, funct::sin(), smearings, smearings_not_defined, and mathSSE::sqrt().

346  {
347  correctionCategory_class category(runNumber, etaSCEle, R9Ele, EtEle);
348  correction_map_t::const_iterator corr_itr = smearings.find(category);
349  if (corr_itr == smearings.end()) { // if not in the standard classes, add it in the list of not defined classes
350  // the following commented part makes the method non const
351  // if(smearings_not_defined.count(category) == 0) {
352  // correctionValue_class corr;
353  // smearings_not_defined[category] = corr;
354  // }
355  corr_itr = smearings_not_defined.find(category);
356  std::cerr << "[WARNING] Smearing category not found: " << std::endl;
357  std::cerr << category << std::endl;
358  // exit(1);
359  }
360 
361 #ifdef DEBUG
362  std::cout << "[DEBUG] Checking smearing correction for category: " << category << std::endl;
363  std::cout << "[DEBUG] Correction is: " << corr_itr->second << std::endl
364  << " given for category " << corr_itr->first;
365 #endif
366 
367  double rho = corr_itr->second.rho + corr_itr->second.rho_err * nSigma_rho;
368  double phi = corr_itr->second.phi + corr_itr->second.phi_err * nSigma_phi;
369 
370  double constTerm = rho * sin(phi);
371  double alpha = rho * corr_itr->second.Emean * cos(phi);
372 
373  return sqrt(constTerm * constTerm + alpha * alpha / EtEle);
374 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22

◆ ReadFromFile()

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 144 of file EnergyScaleCorrection_class.cc.

References AddScale(), validateAlignments::category, DMR_cfg::cerr, gather_cfg::cout, beamvalidation::exit(), corrVsCorr::filename, contentValuesFiles::fullPath, test_db_connect::runMax, and test_db_connect::runMin.

Referenced by EnergyScaleCorrection_class().

144  {
145 #ifdef PEDANTIC_OUTPUT
146  std::cout << "[STATUS] Reading energy scale correction values from file: " << filename << std::endl;
147 #endif
148  std::cout << "[STATUS] Reading energy scale correction values from file: " << filename << std::endl;
149 
150  //std::ifstream Ccufile(edm::FileInPath(Ccufilename).fullPath().c_str(),std::ios::in);
151  std::ifstream f_in(edm::FileInPath(filename).fullPath().c_str());
152 
153  if (!f_in.good()) {
154  std::cerr << "[ERROR] file " << filename << " not readable" << std::endl;
155  exit(1);
156  return;
157  }
158 
159  int runMin, runMax;
160  TString category, region2;
161  double deltaP, err_deltaP, err_deltaP_stat, err_deltaP_syst;
162 
163  for (f_in >> category; f_in.good(); f_in >> category) {
164  f_in >> region2 >> runMin >> runMax >> deltaP >> err_deltaP >> err_deltaP_stat >> err_deltaP_syst;
165 
166  AddScale(category, runMin, runMax, deltaP, err_deltaP_stat, err_deltaP_syst);
167  }
168 
169  f_in.close();
170 
171  return;
172 }
void AddScale(TString category_, int runMin_, int runMax_, double deltaP_, double err_deltaP_, double err_syst_deltaP)
def exit(msg="")

◆ ReadSmearingFromFile()

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 257 of file EnergyScaleCorrection_class.cc.

References AddSmearing(), cms::cuda::assert(), validateAlignments::category, DMR_cfg::cerr, gather_cfg::cout, ECALELF, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, beamvalidation::exit(), corrVsCorr::filename, contentValuesFiles::fullPath, GLOBE, M_PI_2, phi, cosmicPhotonAnalyzer_cfi::r9Max, photonAnalyzer_cfi::r9Min, rho, test_db_connect::runMax, test_db_connect::runMin, smearingType_, AlCaHLTBitMon_QueryRunRegistry::string, and UNKNOWN.

Referenced by EnergyScaleCorrection_class().

257  {
258 #ifdef PEDANTIC_OUTPUT
259  std::cout << "[STATUS] Reading smearing values from file: " << filename << std::endl;
260 #endif
261  //edm::FileInPath(Ccufilename).fullPath().c_str(),std::ios::in); .fullPath().c_str()
262  std::ifstream f_in(edm::FileInPath(filename).fullPath().c_str());
263  if (!f_in.good()) {
264  std::cerr << "[ERROR] file " << filename << " not readable" << std::endl;
265  exit(1);
266  }
267 
268  int runMin = 0, runMax = 900000;
269  int unused = 0;
270  TString category, region2;
271  //double smearing, err_smearing;
272  double rho, phi, Emean, err_rho, err_phi, err_Emean;
273  double etaMin, etaMax, r9Min, r9Max;
274  std::string phi_string, err_phi_string;
275 
276  while (f_in.peek() != EOF && f_in.good()) {
277  if (f_in.peek() == 10) { // 10 = \n
278  f_in.get();
279  continue;
280  }
281 
282  if (f_in.peek() == 35) { // 35 = #
283  f_in.ignore(1000, 10); // ignore the rest of the line until \n
284  continue;
285  }
286 
287  if (smearingType_ == UNKNOWN) { // trying to guess: not recommended
288  std::cerr << "[ERROR] Not implemented" << std::endl;
289  assert(false);
290 
291  } else if (smearingType_ == GLOBE) {
292  f_in >> category >> unused >> etaMin >> etaMax >> r9Min >> r9Max >> runMin >> runMax >> Emean >> err_Emean >>
293  rho >> err_rho >> phi >> err_phi;
294 
295  AddSmearing(category, runMin, runMax, rho, err_rho, phi, err_phi, Emean, err_Emean);
296 
297  } else if (smearingType_ == ECALELF) {
298  f_in >> category >> Emean >> err_Emean >> rho >> err_rho >> phi_string >> err_phi_string;
299 #ifdef DEBUG
300  std::cout
301  << category
302  //<< "\t" << etaMin << "\t" << etaMax << "\t" << r9Min << "\t" << r9Max << "\t" << runMin << "\t" << runMax
303  << "\tEmean=" << Emean << "\t" << rho << "\t" << err_rho << "\tphi_string=" << phi_string
304  << "#\terr_phi_string=" << err_phi_string << std::endl;
305 #endif
306 
307  if (phi_string == "M_PI_2")
308  phi = M_PI_2;
309  else
310  phi = std::stod(phi_string);
311 
312  if (err_phi_string == "M_PI_2")
313  err_phi = M_PI_2;
314  else
315  err_phi = std::stod(err_phi_string);
316 
317  AddSmearing(category, runMin, runMax, rho, err_rho, phi, err_phi, Emean, err_Emean);
318 
319  } else {
320  f_in >> category >> rho >> phi;
321  err_rho = err_phi = Emean = err_Emean = 0;
322  AddSmearing(category, runMin, runMax, rho, err_rho, phi, err_phi, Emean, err_Emean);
323  }
324 #ifdef DEBUG
325  std::cout << category << "\t" << etaMin << "\t" << etaMax << "\t" << r9Min << "\t" << r9Max << "\t" << runMin
326  << "\t" << runMax << "\tEmean=" << Emean << "\t" << rho << "\t" << phi << std::endl;
327 #endif
328  }
329 
330  f_in.close();
331  // runCorrection_itr=runMin_map.begin();
332 
333  return;
334 }
#define M_PI_2
assert(be >=bs)
void AddSmearing(TString category_, int runMin_, int runMax_, double rho, double err_rho, double phi, double err_phi, double Emean, double err_Emean)
def exit(msg="")

◆ ScaleCorrection()

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 44 of file EnergyScaleCorrection_class.cc.

References pfMETCorrectionType0_cfi::correction, doScale, getScaleOffset(), and convertSQLiteXML::runNumber.

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

45  {
46  float correction = 1;
47  if (doScale)
48  correction *= getScaleOffset(runNumber, isEBEle, R9Ele, etaSCEle, EtEle);
49 
50  return correction;
51 }
float getScaleOffset(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const

◆ ScaleCorrectionUncertainty()

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 53 of file EnergyScaleCorrection_class.cc.

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

54  {
55  float statUncert = getScaleStatUncertainty(runNumber, isEBEle, R9Ele, etaSCEle, EtEle);
56  float systUncert = getScaleSystUncertainty(runNumber, isEBEle, R9Ele, etaSCEle, EtEle);
57 
58  return sqrt(statUncert * statUncert + systUncert * systUncert);
59 }
float getScaleStatUncertainty(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const
T sqrt(T t)
Definition: SSEVec.h:23
float getScaleSystUncertainty(unsigned int runNumber, bool isEBEle, double R9Ele, double etaSCEle, double EtEle) const

◆ SetSmearingType()

void EnergyScaleCorrection_class::SetSmearingType ( fileFormat_t  value)
inline

Member Data Documentation

◆ doScale

bool EnergyScaleCorrection_class::doScale

◆ doSmearings

bool EnergyScaleCorrection_class::doSmearings

◆ scales

correction_map_t EnergyScaleCorrection_class::scales
private

◆ scales_not_defined

correction_map_t EnergyScaleCorrection_class::scales_not_defined
private

Definition at line 180 of file EnergyScaleCorrection_class.h.

◆ smearings

correction_map_t EnergyScaleCorrection_class::smearings
private

◆ smearings_not_defined

correction_map_t EnergyScaleCorrection_class::smearings_not_defined
private

Definition at line 181 of file EnergyScaleCorrection_class.h.

Referenced by getSmearingRho(), and getSmearingSigma().

◆ smearingType_

fileFormat_t EnergyScaleCorrection_class::smearingType_
private

Definition at line 178 of file EnergyScaleCorrection_class.h.

Referenced by ReadSmearingFromFile(), and SetSmearingType().