ElectronEnergyCalibrator

correctionValues

linearityCorrectionValues

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
#ifndef ElectronEnergyCalibrator_H
#define ElectronEnergyCalibrator_H

#include "EgammaAnalysis/ElectronTools/interface/SimpleElectron.h"
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include <iostream>

namespace edm {
  class StreamID;
}

struct correctionValues {
  double nRunMin;
  double nRunMax;
  double corrCat0;
  double corrCat1;
  double corrCat2;
  double corrCat3;
  double corrCat4;
  double corrCat5;
  double corrCat6;
  double corrCat7;
};

struct linearityCorrectionValues {
  double ptMin;
  double ptMax;
  double corrCat0;
  double corrCat1;
  double corrCat2;
  double corrCat3;
  double corrCat4;
  double corrCat5;
};

class ElectronEnergyCalibrator {
public:
  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)
      : pathData_(pathData),
        pathLinData_(pathLinData),
        dataset_(dataset),
        correctionsType_(correctionsType),
        applyLinearityCorrection_(applyLinearityCorrection),
        lumiRatio_(lumiRatio),
        isMC_(isMC),
        updateEnergyErrors_(updateEnergyErrors),
        verbose_(verbose),
        synchronization_(synchronization) {
    init();
  }

  void calibrate(SimpleElectron &electron, edm::StreamID const &);
  void correctLinearity(SimpleElectron &electron);

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

  double newEnergy_;
  double newEnergyError_;

  std::string pathData_;
  std::string pathLinData_;
  std::string dataset_;
  int correctionsType_;
  bool applyLinearityCorrection_;
  double lumiRatio_;
  bool isMC_;
  bool updateEnergyErrors_;
  bool verbose_;
  bool synchronization_;

  correctionValues corrValArray[100];
  correctionValues corrValMC;
  linearityCorrectionValues linCorrValArray[100];
  int nCorrValRaw, nLinCorrValRaw;
};

#endif