14 #include <vdt/vdtMath.h> 33 std::vector<std::string>
mean;
63 ,
rhoToken_(cc.consumes<double>(conf.getParameter<
edm::InputTag>(
"rhoCollection")))
75 .sigma = electrons.
getParameter<std::vector<std::string> >(
"uncertaintyKey"),
78 unsigned int encor = eleCondNames_.mean.size();
85 .sigma = photons.
getParameter<std::vector<std::string> >(
"uncertaintyKey"),
88 unsigned int ncor = phoCondNames_.mean.size();
121 const int numberOfClusters = superClus->clusters().size();
122 const bool missing_clusters = !superClus->clusters()[numberOfClusters-1].
isAvailable();
123 if( missing_clusters )
return ;
129 const bool isEB = ele.
isEB();
131 std::array<float, 32> eval;
132 const double rawEnergy = superClus->rawEnergy();
133 const double raw_es_energy = superClus->preshowerEnergy();
136 float e5x5Inverse = full5x5_ess.
e5x5 != 0. ? vdt::fast_inv(full5x5_ess.e5x5) : 0.;
139 eval[1] = superClus->etaWidth();
140 eval[2] = superClus->phiWidth();
141 eval[3] = superClus->seed()->energy()/rawEnergy;
142 eval[4] = full5x5_ess.e5x5/rawEnergy;
145 eval[7] = seed->
eta() - superClus->position().Eta();
147 eval[9] = full5x5_ess.r9;
148 eval[10] = full5x5_ess.sigmaIetaIeta;
149 eval[11] = full5x5_ess.sigmaIetaIphi;
150 eval[12] = full5x5_ess.sigmaIphiIphi;
151 eval[13] = full5x5_ess.eMax*e5x5Inverse;
152 eval[14] = full5x5_ess.e2nd*e5x5Inverse;
153 eval[15] = full5x5_ess.eTop*e5x5Inverse;
154 eval[16] = full5x5_ess.eBottom*e5x5Inverse;
155 eval[17] = full5x5_ess.eLeft*e5x5Inverse;
156 eval[18] = full5x5_ess.eRight*e5x5Inverse;
157 eval[19] = full5x5_ess.e2x5Max*e5x5Inverse;
158 eval[20] = full5x5_ess.e2x5Left*e5x5Inverse;
159 eval[21] = full5x5_ess.e2x5Right*e5x5Inverse;
160 eval[22] = full5x5_ess.e2x5Top*e5x5Inverse;
161 eval[23] = full5x5_ess.e2x5Bottom*e5x5Inverse;
163 eval[25] =
std::max(0,numberOfClusters);
174 int signieta = ieta > 0 ? +1 : -1;
175 eval[28] = (ieta-signieta)%5;
176 eval[29] = (iphi-1)%2;
177 eval[30] = (
abs(ieta)<=25)*((ieta-signieta)) + (
abs(ieta)>25)*((ieta-26*signieta)%20);
178 eval[31] = (iphi-1)%20;
188 eval[28] = raw_es_energy/rawEnergy;
196 constexpr double meanoffset = meanlimlow + 0.5*(meanlimhigh-meanlimlow);
197 constexpr double meanscale = 0.5*(meanlimhigh-meanlimlow);
201 constexpr double sigmaoffset = sigmalimlow + 0.5*(sigmalimhigh-sigmalimlow);
202 constexpr double sigmascale = 0.5*(sigmalimhigh-sigmalimlow);
206 float rawPt = rawEnergy*superClus->position().rho()/superClus->position().r();
224 double mean = meanoffset + meanscale*vdt::fast_sin(rawmean);
225 double sigma = sigmaoffset + sigmascale*vdt::fast_sin(rawsigma);
230 if (mean < 0.) mean = 1.0;
232 const double ecor = mean*(rawEnergy + raw_es_energy);
233 const double sigmacor = sigma*ecor;
238 double combinedEnergy = ecor;
239 double combinedEnergyError = sigmacor;
242 const float trkMomentum = el_track->pMode();
243 const float trkEta = el_track->etaMode();
244 const float trkPhi = el_track->phiMode();
245 const float trkMomentumError =
std::abs(el_track->qoverpModeError())*trkMomentum*trkMomentum;
247 const float eOverP = (rawEnergy+raw_es_energy)*mean/trkMomentum;
248 const float fbrem = ele.
fbrem();
256 rawPt = ecor/cosh(trkEta);
267 eval[1] = sigma/
mean;
268 eval[2] = trkMomentumError/trkMomentum;
271 eval[5] = full5x5_ess.r9;
276 float ecalEnergyVar = (rawEnergy + raw_es_energy)*sigma;
277 float rawcombNormalization = (trkMomentumError*trkMomentumError + ecalEnergyVar*ecalEnergyVar);
278 float rawcomb = ( ecor*trkMomentumError*trkMomentumError + trkMomentum*ecalEnergyVar*ecalEnergyVar ) / rawcombNormalization;
281 double rawmean_trk =
eleForestsMean_[coridx]->GetResponse(eval.data());
285 double mean_trk = meanoffset + meanscale*vdt::fast_sin(rawmean_trk);
286 double sigma_trk = sigmaoffset + sigmascale*vdt::fast_sin(rawsigma_trk);
292 if (mean_trk < 0.) mean_trk = 1.0;
294 combinedEnergy = mean_trk*rawcomb;
295 combinedEnergyError = sigma_trk*rawcomb;
300 oldFourMomentum.y()*combinedEnergy/oldFourMomentum.t(),
301 oldFourMomentum.z()*combinedEnergy/oldFourMomentum.t(),
316 const int numberOfClusters = superClus->clusters().size();
317 const bool missing_clusters = !superClus->clusters()[numberOfClusters-1].
isAvailable();
318 if( missing_clusters )
return ;
320 const bool isEB = pho.
isEB();
322 std::array<float, 32> eval;
323 const double rawEnergy = superClus->rawEnergy();
324 const double raw_es_energy = superClus->preshowerEnergy();
327 float e5x5Inverse = full5x5_pss.
e5x5 != 0. ? vdt::fast_inv(full5x5_pss.e5x5) : 0.;
330 eval[1] = superClus->etaWidth();
331 eval[2] = superClus->phiWidth();
332 eval[3] = superClus->seed()->energy()/rawEnergy;
333 eval[4] = full5x5_pss.e5x5/rawEnergy;
336 eval[7] = seed->
eta() - superClus->position().Eta();
339 eval[10] = full5x5_pss.sigmaIetaIeta;
340 eval[11] = full5x5_pss.sigmaIetaIphi;
341 eval[12] = full5x5_pss.sigmaIphiIphi;
342 eval[13] = full5x5_pss.maxEnergyXtal*e5x5Inverse;
343 eval[14] = full5x5_pss.e2nd*e5x5Inverse;
344 eval[15] = full5x5_pss.eTop*e5x5Inverse;
345 eval[16] = full5x5_pss.eBottom*e5x5Inverse;
346 eval[17] = full5x5_pss.eLeft*e5x5Inverse;
347 eval[18] = full5x5_pss.eRight*e5x5Inverse;
348 eval[19] = full5x5_pss.e2x5Max*e5x5Inverse;
349 eval[20] = full5x5_pss.e2x5Left*e5x5Inverse;
350 eval[21] = full5x5_pss.e2x5Right*e5x5Inverse;
351 eval[22] = full5x5_pss.e2x5Top*e5x5Inverse;
352 eval[23] = full5x5_pss.e2x5Bottom*e5x5Inverse;
354 eval[25] =
std::max(0,numberOfClusters);
366 int signieta = ieta > 0 ? +1 : -1;
367 eval[28] = (ieta-signieta)%5;
368 eval[29] = (iphi-1)%2;
369 eval[30] = (
abs(ieta)<=25)*((ieta-signieta)) + (
abs(ieta)>25)*((ieta-26*signieta)%20);
370 eval[31] = (iphi-1)%20;
380 eval[28] = raw_es_energy/rawEnergy;
388 constexpr double meanoffset = meanlimlow + 0.5*(meanlimhigh-meanlimlow);
389 constexpr double meanscale = 0.5*(meanlimhigh-meanlimlow);
393 constexpr double sigmaoffset = sigmalimlow + 0.5*(sigmalimhigh-sigmalimlow);
394 constexpr double sigmascale = 0.5*(sigmalimhigh-sigmalimlow);
397 float rawPt = rawEnergy*superClus->position().rho()/superClus->position().r();
414 double mean = meanoffset + meanscale*vdt::fast_sin(rawmean);
415 double sigma = sigmaoffset + sigmascale*vdt::fast_sin(rawsigma);
420 if (mean < 0.) mean = 1.0;
422 const double ecor = mean*(rawEnergy + raw_es_energy);
423 const double sigmacor = sigma*ecor;
constexpr double deltaPhi(double phi1, double phi2)
T getParameter(std::string const &) const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Analysis-level Photon class.
float nSaturatedXtals() const
const double lowEnergyEcalOnlyThr_
float trackMomentumError() const
void setEventContent(const edm::EventSetup &) final
std::vector< std::string > mean
const LorentzVector & p4(P4Kind kind) const
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const double epSigEcalTrackThr_
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
void setEvent(const edm::Event &) final
void modifyObject(pat::Photon &pho) const final
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
double eta() const
pseudorapidity of cluster centroid
std::vector< std::string > sigma
std::vector< const GBRForestD * > phoForestsSigma_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void setCorrectedEcalEnergyError(float newEnergyError)
std::vector< const GBRForestD * > retrieveGBRForests(edm::EventSetup const &evs, std::vector< std::string > const &names)
void modifyObject(reco::GsfElectron &) const final
void modifyObject(pat::Electron &ele) const final
Abs< T >::type abs(const T &t)
const double eOverPEcalTrkThr_
std::vector< const GBRForestD * > phoForestsMean_
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
float hcalOverEcalBc() const
const double highEnergyEcalTrackThr_
DetId seed() const
return DetId of seed
EGRegressionModifierV2(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
const bool forceHighEnergyEcalTrainingIfSaturated_
const double lowEnergyEcalTrackThr_
Analysis-level electron class.
void setCorrectedEcalEnergy(float newEnergy)
edm::ESHandle< CaloGeometry > caloGeometry_
edm::EDGetTokenT< double > rhoToken_
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)
const ShowerShape & full5x5_showerShape() const
const ShowerShape & full5x5_showerShapeVariables() const
const double epDiffSigEcalTrackThr_
SuperClusterRef superCluster() const override
reference to a SuperCluster
#define DEFINE_EDM_PLUGIN(factory, type, name)
double phi() const
azimuthal angle of cluster centroid
std::vector< const GBRForestD * > eleForestsMean_
std::vector< const GBRForestD * > eleForestsSigma_
float nSaturatedXtals() const
bool ecalDrivenSeed() const
constexpr Detector det() const
get the detector field from this detid