6 #include <CLHEP/Random/RandGaussQ.h> 12 correctionRetriever_(correctionFile),
36 const float smearNrSigma,
43 std::array<float,EGEnergySysIndex::kNrSysErrs> retVal;
60 unsigned int gainSeedSC = 12;
61 if (seedRecHit != recHits->
end()) {
72 std::array<float,EGEnergySysIndex::kNrSysErrs> uncertainties{};
96 std::array<float,EGEnergySysIndex::kNrSysErrs>& energyData)
const 99 const float smear = smearCorr.
sigma(et);
100 const float smearRhoUp = smearCorr.
sigma(et,1,0);
101 const float smearRhoDn = smearCorr.
sigma(et,-1,0);
102 const float smearPhiUp = smearCorr.
sigma(et,0,1);
103 const float smearPhiDn = smearCorr.
sigma(et,0,-1);
105 const float corr = scale + smear * smearNrSigma;
106 const float corrRhoUp = scale + smearRhoUp * smearNrSigma;
107 const float corrRhoDn = scale + smearRhoDn * smearNrSigma;
108 const float corrPhiUp = scale + smearPhiUp * smearNrSigma;
109 const float corrPhiDn = scale + smearPhiDn * smearNrSigma;
110 const float corrUp = corrRhoUp;
111 const float corrDn = corrRhoDn;
114 const double oldEcalEnergy = photon.
getCorrectedEnergy(reco::Photon::P4type::regression2);
120 const double newEcalEnergy = oldEcalEnergy *
corr;
121 const double newEcalEnergyError = std::hypot(oldEcalEnergyError * corr, smear * newEcalEnergy);
122 photon.
setCorrectedEnergy(reco::Photon::P4type::regression2, newEcalEnergy, newEcalEnergyError,
true);
155 <<
"XXXXXXX requires the RandomNumberGeneratorService\n" 156 "which is not present in the configuration file. You must add the service\n" 157 "in the configuration file or remove the modules that require it.";
159 CLHEP::RandGaussQ gaussDistribution(rng->
getEngine(
id), 0.0, 1.0);
160 return gaussDistribution.fire();
EnergyScaleCorrection correctionRetriever_
void initPrivateRng(TRandom *rnd)
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
std::vector< EcalRecHit >::const_iterator const_iterator
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
float scaleErrGain() const
const ScaleCorrection * getScaleCorr(unsigned int runnr, double et, double eta, double r9, unsigned int gainSeed) const
Abs< T >::type abs(const T &t)
const SmearCorrection * getSmearCorr(unsigned int runnr, double et, double eta, double r9, unsigned int gainSeed) const
static const EnergyScaleCorrection::ScaleCorrection defaultScaleCorr_
static const EnergyScaleCorrection::SmearCorrection defaultSmearCorr_
float getCorrectedEnergyError(P4type type) const
float scaleErr(const std::bitset< kErrNrBits > &uncBitMask) const
float sigma(const float et, const float nrSigmaRho=0., const float nrSigmaPhi=0.) const
const_iterator end() const
et
define resolution functions of each parameter
float getCorrectedEnergy(P4type type) const
double gauss(edm::StreamID const &id) const
iterator find(key_type k)
float scaleErrSyst() const
void setEnergyAndSystVarations(const float scale, const float smearNrSigma, const float et, const EnergyScaleCorrection::ScaleCorrection &scaleCorr, const EnergyScaleCorrection::SmearCorrection &smearCorr, reco::Photon &photon, std::array< float, EGEnergySysIndex::kNrSysErrs > &energyData) const
float scaleErrStat() const
std::array< float, EGEnergySysIndex::kNrSysErrs > calibrate(reco::Photon &photon, const unsigned int runNumber, const EcalRecHitCollection *recHits, edm::StreamID const &id, const EventType eventType) const