7 #include <CLHEP/Random/RandGaussQ.h> 13 correctionRetriever_(correctionFile),
37 const float smearNrSigma,
44 std::array<float,EGEnergySysIndex::kNrSysErrs> retVal;
61 unsigned int gainSeedSC = 12;
62 if (seedRecHit != recHits->
end()) {
73 std::array<float,EGEnergySysIndex::kNrSysErrs> uncertainties{};
97 std::array<float,EGEnergySysIndex::kNrSysErrs>& energyData)
const 100 const float smear = smearCorr.
sigma(et);
101 const float smearRhoUp = smearCorr.
sigma(et,1,0);
102 const float smearRhoDn = smearCorr.
sigma(et,-1,0);
103 const float smearPhiUp = smearCorr.
sigma(et,0,1);
104 const float smearPhiDn = smearCorr.
sigma(et,0,-1);
106 const float corr = scale + smear * smearNrSigma;
107 const float corrRhoUp = scale + smearRhoUp * smearNrSigma;
108 const float corrRhoDn = scale + smearRhoDn * smearNrSigma;
109 const float corrPhiUp = scale + smearPhiUp * smearNrSigma;
110 const float corrPhiDn = scale + smearPhiDn * smearNrSigma;
111 const float corrUp = corrRhoUp;
112 const float corrDn = corrRhoDn;
115 const double oldEcalEnergy = photon.
getCorrectedEnergy(reco::Photon::P4type::regression2);
121 const double newEcalEnergy = oldEcalEnergy *
corr;
122 const double newEcalEnergyError = std::hypot(oldEcalEnergyError * corr, smear * newEcalEnergy);
123 photon.
setCorrectedEnergy(reco::Photon::P4type::regression2, newEcalEnergy, newEcalEnergyError,
true);
156 <<
"XXXXXXX requires the RandomNumberGeneratorService\n" 157 "which is not present in the configuration file. You must add the service\n" 158 "in the configuration file or remove the modules that require it.";
160 CLHEP::RandGaussQ gaussDistribution(rng->
getEngine(
id), 0.0, 1.0);
161 return gaussDistribution.fire();
EnergyScaleCorrection correctionRetriever_
void initPrivateRng(TRandom *rnd)
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
constexpr bool isNotFinite(T x)
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