File indexing completed on 2024-04-06 12:10:16
0001 #ifndef ElectronEnergyCalibrator_H
0002 #define ElectronEnergyCalibrator_H
0003
0004 #include "EgammaAnalysis/ElectronTools/interface/SimpleElectron.h"
0005 #include <string>
0006 #include <vector>
0007 #include <fstream>
0008 #include <sstream>
0009 #include <iostream>
0010
0011 namespace edm {
0012 class StreamID;
0013 }
0014
0015 struct correctionValues {
0016 double nRunMin;
0017 double nRunMax;
0018 double corrCat0;
0019 double corrCat1;
0020 double corrCat2;
0021 double corrCat3;
0022 double corrCat4;
0023 double corrCat5;
0024 double corrCat6;
0025 double corrCat7;
0026 };
0027
0028 struct linearityCorrectionValues {
0029 double ptMin;
0030 double ptMax;
0031 double corrCat0;
0032 double corrCat1;
0033 double corrCat2;
0034 double corrCat3;
0035 double corrCat4;
0036 double corrCat5;
0037 };
0038
0039 class ElectronEnergyCalibrator {
0040 public:
0041 ElectronEnergyCalibrator(const std::string pathData,
0042 const std::string pathLinData,
0043 const std::string dataset,
0044 int correctionsType,
0045 bool applyLinearityCorrection,
0046 double lumiRatio,
0047 bool isMC,
0048 bool updateEnergyErrors,
0049 bool verbose,
0050 bool synchronization)
0051 : pathData_(pathData),
0052 pathLinData_(pathLinData),
0053 dataset_(dataset),
0054 correctionsType_(correctionsType),
0055 applyLinearityCorrection_(applyLinearityCorrection),
0056 lumiRatio_(lumiRatio),
0057 isMC_(isMC),
0058 updateEnergyErrors_(updateEnergyErrors),
0059 verbose_(verbose),
0060 synchronization_(synchronization) {
0061 init();
0062 }
0063
0064 void calibrate(SimpleElectron &electron, edm::StreamID const &);
0065 void correctLinearity(SimpleElectron &electron);
0066
0067 private:
0068 void init();
0069 void splitString(const std::string &fullstr, std::vector<std::string> &elements, const std::string &delimiter);
0070 double stringToDouble(const std::string &str);
0071
0072 double newEnergy_;
0073 double newEnergyError_;
0074
0075 std::string pathData_;
0076 std::string pathLinData_;
0077 std::string dataset_;
0078 int correctionsType_;
0079 bool applyLinearityCorrection_;
0080 double lumiRatio_;
0081 bool isMC_;
0082 bool updateEnergyErrors_;
0083 bool verbose_;
0084 bool synchronization_;
0085
0086 correctionValues corrValArray[100];
0087 correctionValues corrValMC;
0088 linearityCorrectionValues linCorrValArray[100];
0089 int nCorrValRaw, nLinCorrValRaw;
0090 };
0091
0092 #endif