CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ElectronEnergyCalibrator Class Reference

#include <ElectronEnergyCalibrator.h>

Public Member Functions

void calibrate (SimpleElectron &electron, edm::StreamID const &)
 
void correctLinearity (SimpleElectron &electron)
 
 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)
 

Private Member Functions

void init ()
 
void splitString (const string &fullstr, vector< string > &elements, const string &delimiter)
 
double stringToDouble (const string &str)
 

Private Attributes

bool applyLinearityCorrection_
 
int correctionsType_
 
correctionValues corrValArray [100]
 
correctionValues corrValMC
 
std::string dataset_
 
bool isMC_
 
linearityCorrectionValues linCorrValArray [100]
 
double lumiRatio_
 
int nCorrValRaw
 
double newEnergy_
 
double newEnergyError_
 
int nLinCorrValRaw
 
std::string pathData_
 
std::string pathLinData_
 
bool synchronization_
 
bool updateEnergyErrors_
 
bool verbose_
 

Detailed Description

Definition at line 47 of file ElectronEnergyCalibrator.h.

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

References init().

60  :
61  pathData_(pathData),
62  pathLinData_(pathLinData),
63  dataset_(dataset),
64  correctionsType_(correctionsType),
65  applyLinearityCorrection_(applyLinearityCorrection),
66  lumiRatio_(lumiRatio),
67  isMC_(isMC),
68  updateEnergyErrors_(updateEnergyErrors),
69  verbose_(verbose),
70  synchronization_(synchronization)
71  {
72  init();
73  }
tuple dataset
Definition: dataset.py:393

Member Function Documentation

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

Definition at line 170 of file ElectronEnergyCalibrator.cc.

References gather_cfg::cout, eta(), edm::hlt::Exception, edm::RandomNumberGenerator::getEngine(), SimpleElectron::getEta(), SimpleElectron::getR9(), SimpleElectron::getRegEnergy(), SimpleElectron::getRegEnergyError(), SimpleElectron::getRunNumber(), SimpleElectron::getSCEnergy(), SimpleElectron::getSCEnergyError(), i, edm::Service< T >::isAvailable(), SimpleElectron::isEB(), pileupReCalc_HLTpaths::scale, SimpleElectron::setNewEnergy(), SimpleElectron::setNewEnergyError(), and mathSSE::sqrt().

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

Definition at line 457 of file ElectronEnergyCalibrator.cc.

References gather_cfg::cout, eta(), create_public_lumi_plots::exp, SimpleElectron::getCombinedMomentum(), SimpleElectron::getElClass(), SimpleElectron::getEta(), i, SimpleElectron::isEB(), AlCaHLTBitMon_ParallelJobs::p, RecoTauCleanerPlugins::pt, PtMinSelector_cfg::ptMin, SimpleElectron::setCombinedMomentum(), funct::sin(), and theta().

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

Definition at line 29 of file ElectronEnergyCalibrator.cc.

References gather_cfg::cout, edm::hlt::Exception, groupFilesInBlocks::fin, alignCSCRings::s, and splitString().

Referenced by ElectronEnergyCalibrator().

30 {
31  if ( !isMC_ ) // DATA
32  {
33  if ( verbose_ )
34  {
35  std::cout << "[ElectronEnergyCalibrator] Initialization in DATA mode" << std::endl;
36  }
37 
38  ifstream fin(pathData_.c_str());
39 
40  if (!fin){
41  throw cms::Exception("Configuration")
42  << "[ElectronEnergyCalibrator] Cannot open the file "
43  << pathData_ << "\n It is not found, missed or corrupted" ;
44  } else
45  {
46  if ( verbose_ )
47  {
48  std::cout << "[ElectronEnergyCalibrator] File "
49  << pathData_ << " succesfully opened" << std::endl;
50  }
51 
52  string s;
53  vector<string> selements;
54  string delimiter = ",";
55  nCorrValRaw = 0;
56 
57  while ( !fin.eof() )
58  {
59  getline(fin, s);
60  if ( !s.empty() )
61  {
62  splitString(s, selements, delimiter);
73 
74  nCorrValRaw++;
75 
76  selements.clear();
77  }
78  }
79 
80  fin.close();
81 
82  if ( verbose_ )
83  {
84  std::cout << "[ElectronEnergyCalibrator] File closed" << std::endl;
85  }
86 
87  }
88  // linearity corrections data
90  {
91  ifstream finlin(pathLinData_.c_str());
92 
93  if (!finlin)
94  {
95  throw cms::Exception("Configuration")
96  << "[ElectronEnergyCalibrator] Cannot open the file "<< pathLinData_ << "\n It is not found, missed or corrupted" ;
97  } else
98  {
99  if (verbose_)
100  {
101  std::cout<<"[ElectronEnergyCalibrator] File with Linearity Corrections "<<pathLinData_<<" succesfully opened"<<std::endl;
102  }
103 
104  string s;
105  vector<string> selements;
106  string delimiter = ",";
107  nLinCorrValRaw = 0;
108 
109  while ( !finlin.eof() )
110  {
111  getline(finlin, s);
112  if ( !s.empty() )
113  {
114  splitString(s, selements, delimiter);
115 
124 
125  nLinCorrValRaw++;
126 
127  selements.clear();
128  }
129  }
130 
131  finlin.close();
132 
133  if (verbose_)
134  {
135  std::cout<<"[ElectronEnergyCalibrator] File closed"<<std::endl;
136  }
137  }
138  }
139  } else // MC
140  {
141  if ( verbose_ )
142  {
143  std::cout << "[ElectronEnergyCalibrator] Initialization in MC mode" << std::endl;
144  }
145  }
146 }
correctionValues corrValArray[100]
void splitString(const string &fullstr, vector< string > &elements, const string &delimiter)
double stringToDouble(const string &str)
linearityCorrectionValues linCorrValArray[100]
tuple cout
Definition: gather_cfg.py:121
void ElectronEnergyCalibrator::splitString ( const string &  fullstr,
vector< string > &  elements,
const string &  delimiter 
)
private

Definition at line 148 of file ElectronEnergyCalibrator.cc.

149 {
150  string::size_type lastpos = fullstr.find_first_not_of(delimiter, 0);
151  string::size_type pos = fullstr.find_first_of(delimiter, lastpos);
152 
153  while ( ( string::npos != pos ) || ( string::npos != lastpos ) )
154  {
155  elements.push_back(fullstr.substr(lastpos, pos-lastpos));
156  lastpos = fullstr.find_first_not_of(delimiter, pos);
157  pos = fullstr.find_first_of(delimiter, lastpos);
158  }
159 }
list elements
Definition: asciidump.py:414
uint16_t size_type
double ElectronEnergyCalibrator::stringToDouble ( const string &  str)
private

Definition at line 161 of file ElectronEnergyCalibrator.cc.

162 {
163  istringstream stm;
164  double val = 0;
165  stm.str(str);
166  stm >> val;
167  return val;
168 }

Member Data Documentation

bool ElectronEnergyCalibrator::applyLinearityCorrection_
private

Definition at line 93 of file ElectronEnergyCalibrator.h.

int ElectronEnergyCalibrator::correctionsType_
private

Definition at line 92 of file ElectronEnergyCalibrator.h.

correctionValues ElectronEnergyCalibrator::corrValArray[100]
private

Definition at line 100 of file ElectronEnergyCalibrator.h.

correctionValues ElectronEnergyCalibrator::corrValMC
private

Definition at line 101 of file ElectronEnergyCalibrator.h.

std::string ElectronEnergyCalibrator::dataset_
private

Definition at line 91 of file ElectronEnergyCalibrator.h.

bool ElectronEnergyCalibrator::isMC_
private

Definition at line 95 of file ElectronEnergyCalibrator.h.

linearityCorrectionValues ElectronEnergyCalibrator::linCorrValArray[100]
private

Definition at line 102 of file ElectronEnergyCalibrator.h.

double ElectronEnergyCalibrator::lumiRatio_
private

Definition at line 94 of file ElectronEnergyCalibrator.h.

int ElectronEnergyCalibrator::nCorrValRaw
private

Definition at line 103 of file ElectronEnergyCalibrator.h.

double ElectronEnergyCalibrator::newEnergy_
private

Definition at line 86 of file ElectronEnergyCalibrator.h.

double ElectronEnergyCalibrator::newEnergyError_
private

Definition at line 87 of file ElectronEnergyCalibrator.h.

int ElectronEnergyCalibrator::nLinCorrValRaw
private

Definition at line 103 of file ElectronEnergyCalibrator.h.

std::string ElectronEnergyCalibrator::pathData_
private

Definition at line 89 of file ElectronEnergyCalibrator.h.

std::string ElectronEnergyCalibrator::pathLinData_
private

Definition at line 90 of file ElectronEnergyCalibrator.h.

bool ElectronEnergyCalibrator::synchronization_
private

Definition at line 98 of file ElectronEnergyCalibrator.h.

bool ElectronEnergyCalibrator::updateEnergyErrors_
private

Definition at line 96 of file ElectronEnergyCalibrator.h.

bool ElectronEnergyCalibrator::verbose_
private

Definition at line 97 of file ElectronEnergyCalibrator.h.