CMS 3D CMS Logo

ElectronEnergyCalibrator.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_EgammaTools_ElectronEnergyCalibrator_h
2 #define RecoEgamma_EgammaTools_ElectronEnergyCalibrator_h
3 
4 //author: Alan Smithee
5 //description:
6 // this class allows the residual scale and smearing to be applied to electrons
7 // the scale and smearing is on the ecal part of the energy
8 // hence the E/p combination needs to be re-don, hence the E/p Combination Tools
9 // it re-applies the regression with the new corrected ecal energy
10 // returns a vector of calibrated energies and correction data, indexed by EGEnergySysIndex
11 // a port of EgammaAnalysis/ElectronTools/ElectronEnergyCalibratorRun2
12 
19 
20 #include <TRandom.h>
21 
22 #include <vector>
23 
25 {
26 public:
27  enum class EventType{
28  DATA,
29  MC,
30  };
31 
35 
38  void initPrivateRng(TRandom *rnd) ;
39 
40  //set the minimum et to apply the correction to
41  void setMinEt(float val){minEt_=val;}
42 
45  std::array<float,EGEnergySysIndex::kNrSysErrs>
46  calibrate(reco::GsfElectron &ele, const unsigned int runNumber,
47  const EcalRecHitCollection* recHits, edm::StreamID const & id,
48  const EventType eventType) const ;
49 
50  std::array<float,EGEnergySysIndex::kNrSysErrs>
51  calibrate(reco::GsfElectron &ele, const unsigned int runNumber,
52  const EcalRecHitCollection* recHits, const float smearNrSigma,
53  const EventType eventType) const ;
54 
55 private:
56  void setEnergyAndSystVarations(const float scale,const float smearNrSigma,const float et,
59  reco::GsfElectron& ele,
60  std::array<float,EGEnergySysIndex::kNrSysErrs>& energyData)const;
61 
62  void setEcalEnergy(reco::GsfElectron& ele,const float scale,const float smear)const;
63  std::pair<float,float> calCombinedMom(reco::GsfElectron& ele,const float scale,const float smear)const;
64 
68  double gauss(edm::StreamID const& id) const ;
69 
70  // whatever data will be needed
72  const EpCombinationTool *epCombinationTool_; //this is not owned
73  TRandom *rng_; //this is not owned
74  float minEt_;
75 
76  //default values to access if no correction available
79 
80 
81 };
82 
83 #endif
void setEcalEnergy(reco::GsfElectron &ele, const float scale, const float smear) const
EnergyScaleCorrection correctionRetriever_
void calibrate(SimpleElectron &electron, edm::StreamID const &)
double gauss(edm::StreamID const &id) const
et
define resolution functions of each parameter
static const EnergyScaleCorrection::SmearCorrection defaultSmearCorr_
const EpCombinationTool * epCombinationTool_
void setEnergyAndSystVarations(const float scale, const float smearNrSigma, const float et, const EnergyScaleCorrection::ScaleCorrection &scaleCorr, const EnergyScaleCorrection::SmearCorrection &smearCorr, reco::GsfElectron &ele, std::array< float, EGEnergySysIndex::kNrSysErrs > &energyData) const
static const EnergyScaleCorrection::ScaleCorrection defaultScaleCorr_
std::pair< float, float > calCombinedMom(reco::GsfElectron &ele, const float scale, const float smear) const