Go to the documentation of this file.00001 #ifndef ElectronEnergyCalibrator_H
00002 #define ElectronEnergyCalibrator_H
00003
00004 #include "EgammaAnalysis/ElectronTools/interface/SimpleElectron.h"
00005 #include <string>
00006 #include <vector>
00007 #include <fstream>
00008 #include <sstream>
00009 #include <iostream>
00010
00011 using std::string;
00012 using std::vector;
00013 using std::ifstream;
00014 using std::istringstream;
00015 using std::cout;
00016
00017 struct correctionValues
00018 {
00019 double nRunMin;
00020 double nRunMax;
00021 double corrCat0;
00022 double corrCat1;
00023 double corrCat2;
00024 double corrCat3;
00025 double corrCat4;
00026 double corrCat5;
00027 double corrCat6;
00028 double corrCat7;
00029 };
00030
00031 struct linearityCorrectionValues
00032 {
00033 double ptMin;
00034 double ptMax;
00035 double corrCat0;
00036 double corrCat1;
00037 double corrCat2;
00038 double corrCat3;
00039 double corrCat4;
00040 double corrCat5;
00041 };
00042
00043 class ElectronEnergyCalibrator
00044 {
00045 public:
00046 ElectronEnergyCalibrator( const std::string pathData,
00047 const std::string pathLinData,
00048 const std::string dataset,
00049 int correctionsType,
00050 bool applyLinearityCorrection,
00051 double lumiRatio,
00052 bool isMC,
00053 bool updateEnergyErrors,
00054 bool verbose,
00055 bool synchronization
00056 ) :
00057 pathData_(pathData),
00058 pathLinData_(pathLinData),
00059 dataset_(dataset),
00060 correctionsType_(correctionsType),
00061 applyLinearityCorrection_(applyLinearityCorrection),
00062 lumiRatio_(lumiRatio),
00063 isMC_(isMC),
00064 updateEnergyErrors_(updateEnergyErrors),
00065 verbose_(verbose),
00066 synchronization_(synchronization)
00067 {
00068 init();
00069 }
00070
00071 void calibrate(SimpleElectron &electron);
00072 void correctLinearity(SimpleElectron &electron);
00073
00074 private:
00075 void init();
00076 void splitString( const string &fullstr,
00077 vector<string> &elements,
00078 const string &delimiter
00079 );
00080 double stringToDouble(const string &str);
00081
00082 double newEnergy_ ;
00083 double newEnergyError_ ;
00084
00085 std::string pathData_;
00086 std::string pathLinData_;
00087 std::string dataset_;
00088 int correctionsType_;
00089 bool applyLinearityCorrection_;
00090 double lumiRatio_;
00091 bool isMC_;
00092 bool updateEnergyErrors_;
00093 bool verbose_;
00094 bool synchronization_;
00095
00096 correctionValues corrValArray[100];
00097 correctionValues corrValMC;
00098 linearityCorrectionValues linCorrValArray[100];
00099 int nCorrValRaw, nLinCorrValRaw;
00100 };
00101
00102 #endif
00103