File indexing completed on 2024-04-06 12:25:02
0001 #ifndef RecoEgamma_EgammaTools_PhotonEnergyCalibrator_h
0002 #define RecoEgamma_EgammaTools_PhotonEnergyCalibrator_h
0003
0004
0005
0006
0007
0008
0009
0010 #include "FWCore/Utilities/interface/StreamID.h"
0011 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0012 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0013 #include "RecoEgamma/EgammaTools/interface/EnergyScaleCorrection.h"
0014 #include "RecoEgamma/EgammaTools/interface/EGEnergySysIndex.h"
0015
0016 #include <TRandom.h>
0017
0018 #include <vector>
0019
0020 class PhotonEnergyCalibrator {
0021 public:
0022 enum class EventType {
0023 DATA,
0024 MC,
0025 };
0026
0027 PhotonEnergyCalibrator() {}
0028 PhotonEnergyCalibrator(const std::string& correctionFile);
0029 ~PhotonEnergyCalibrator() {}
0030
0031
0032
0033 void initPrivateRng(TRandom* rnd);
0034
0035
0036 void setMinEt(float val) { minEt_ = val; }
0037
0038
0039
0040 std::array<float, EGEnergySysIndex::kNrSysErrs> calibrate(reco::Photon& photon,
0041 const unsigned int runNumber,
0042 const EcalRecHitCollection* recHits,
0043 edm::StreamID const& id,
0044 const EventType eventType) const;
0045
0046 std::array<float, EGEnergySysIndex::kNrSysErrs> calibrate(reco::Photon& photon,
0047 const unsigned int runNumber,
0048 const EcalRecHitCollection* recHits,
0049 const float smearNrSigma,
0050 const EventType eventType) const;
0051
0052 private:
0053 void setEnergyAndSystVarations(const float scale,
0054 const float smearNrSigma,
0055 const float et,
0056 const EnergyScaleCorrection::ScaleCorrection& scaleCorr,
0057 const EnergyScaleCorrection::SmearCorrection& smearCorr,
0058 reco::Photon& photon,
0059 std::array<float, EGEnergySysIndex::kNrSysErrs>& energyData) const;
0060
0061
0062
0063
0064 double gauss(edm::StreamID const& id) const;
0065
0066
0067 EnergyScaleCorrection correctionRetriever_;
0068 TRandom* rng_;
0069 float minEt_;
0070
0071
0072 static const EnergyScaleCorrection::ScaleCorrection defaultScaleCorr_;
0073 static const EnergyScaleCorrection::SmearCorrection defaultSmearCorr_;
0074 };
0075
0076 #endif