23 fIsInitialized(kFALSE),
58 fVals =
new Float_t[73];
81 TFile *fgbr = TFile::Open(regweights.c_str(),
"READ");
99 Double_t ebcmax = -99.;
102 if (bc->
energy() > ebcmax && bc !=
b) {
110 Double_t ebcmin = 1e6;
113 if (bc->
energy() < ebcmin && bc !=
b) {
124 if (bc->
energy() < ebcmin && bc !=b && bc!=bclast) {
139 fVals[0] = s->rawEnergy();
145 fVals[6] = s->etaWidth();
146 fVals[7] = s->phiWidth();
150 double bemax = clustertools.eMax(*b);
151 double be2nd = clustertools.e2nd(*b);
152 double betop = clustertools.eTop(*b);
153 double bebottom = clustertools.eBottom(*b);
154 double beleft = clustertools.eLeft(*b);
155 double beright = clustertools.eRight(*b);
161 fVals[11] = clustertools.e3x3(*b)/b->
energy();
162 fVals[12] = clustertools.e5x5(*b)/b->
energy();
163 fVals[13] =
sqrt(clustertools.localCovariances(*b)[0]);
164 fVals[14] =
sqrt(clustertools.localCovariances(*b)[2]);
165 fVals[15] = clustertools.localCovariances(*b)[1];
166 fVals[16] = bemax/b->
energy();
167 fVals[17] =
log(be2nd/bemax);
168 fVals[18] =
log(betop/bemax);
169 fVals[19] =
log(bebottom/bemax);
170 fVals[20] =
log(beleft/bemax);
171 fVals[21] =
log(beright/bemax);
172 fVals[22] = (betop-bebottom)/(betop+bebottom);
173 fVals[23] = (beleft-beright)/(beleft+beright);
176 double bc2emax = hasbc2 ? clustertools.eMax(*b2) : 0.;
177 double bc2e2nd = hasbc2 ? clustertools.e2nd(*b2) : 0.;
178 double bc2etop = hasbc2 ? clustertools.eTop(*b2) : 0.;
179 double bc2ebottom = hasbc2 ? clustertools.eBottom(*b2) : 0.;
180 double bc2eleft = hasbc2 ? clustertools.eLeft(*b2) : 0.;
181 double bc2eright = hasbc2 ? clustertools.eRight(*b2) : 0.;
183 fVals[24] = hasbc2 ? (b2->
eta()-s->eta()) : 0.;
185 fVals[26] = hasbc2 ? b2->
energy()/s->rawEnergy() : 0.;
186 fVals[27] = hasbc2 ? clustertools.e3x3(*b2)/b2->
energy() : 0.;
187 fVals[28] = hasbc2 ? clustertools.e5x5(*b2)/b2->
energy() : 0.;
188 fVals[29] = hasbc2 ?
sqrt(clustertools.localCovariances(*b2)[0]) : 0.;
189 fVals[30] = hasbc2 ?
sqrt(clustertools.localCovariances(*b2)[2]) : 0.;
190 fVals[31] = hasbc2 ? clustertools.localCovariances(*b)[1] : 0.;
191 fVals[32] = hasbc2 ? bc2emax/b2->
energy() : 0.;
192 fVals[33] = hasbc2 ?
log(bc2e2nd/bc2emax) : 0.;
193 fVals[34] = hasbc2 ?
log(bc2etop/bc2emax) : 0.;
194 fVals[35] = hasbc2 ?
log(bc2ebottom/bc2emax) : 0.;
195 fVals[36] = hasbc2 ?
log(bc2eleft/bc2emax) : 0.;
196 fVals[37] = hasbc2 ?
log(bc2eright/bc2emax) : 0.;
197 fVals[38] = hasbc2 ? (bc2etop-bc2ebottom)/(bc2etop+bc2ebottom) : 0.;
198 fVals[39] = hasbc2 ? (bc2eleft-bc2eright)/(bc2eleft+bc2eright) : 0.;
200 fVals[40] = hasbclast ? (bclast->
eta()-s->eta()) : 0.;
202 fVals[42] = hasbclast ? bclast->
energy()/s->rawEnergy() : 0.;
203 fVals[43] = hasbclast ? clustertools.e3x3(*bclast)/bclast->
energy() : 0.;
204 fVals[44] = hasbclast ? clustertools.e5x5(*bclast)/bclast->
energy() : 0.;
205 fVals[45] = hasbclast ?
sqrt(clustertools.localCovariances(*bclast)[0]) : 0.;
206 fVals[46] = hasbclast ?
sqrt(clustertools.localCovariances(*bclast)[2]) : 0.;
207 fVals[47] = hasbclast ? clustertools.localCovariances(*bclast)[1] : 0.;
209 fVals[48] = hasbclast2 ? (bclast2->
eta()-s->eta()) : 0.;
211 fVals[50] = hasbclast2 ? bclast2->
energy()/s->rawEnergy() : 0.;
212 fVals[51] = hasbclast2 ? clustertools.e3x3(*bclast2)/bclast2->
energy() : 0.;
213 fVals[52] = hasbclast2 ? clustertools.e5x5(*bclast2)/bclast2->
energy() : 0.;
214 fVals[53] = hasbclast2 ?
sqrt(clustertools.localCovariances(*bclast2)[0]) : 0.;
215 fVals[54] = hasbclast2 ?
sqrt(clustertools.localCovariances(*bclast2)[2]) : 0.;
216 fVals[55] = hasbclast2 ? clustertools.localCovariances(*bclast2)[1] : 0.;
223 float betacry, bphicry, bthetatilt, bphitilt;
234 fVals[61] = biphi%20;
240 float bc2etacry, bc2phicry, bc2thetatilt, bc2phitilt;
241 int bc2ieta, bc2iphi;
243 bc2ieta,bc2iphi,bc2thetatilt,bc2phitilt );
245 fVals[64] = hasbc2 ? bc2ieta : 0.;
246 fVals[65] = hasbc2 ? bc2iphi : 0.;
247 fVals[66] = hasbc2 ? bc2ieta%5 : 0.;
248 fVals[67] = hasbc2 ? bc2iphi%2 : 0.;
250 fVals[69] = hasbc2 ? bc2iphi%20 : 0.;
251 fVals[70] = hasbc2 ? bc2etacry : 0.;
252 fVals[71] = hasbc2 ? bc2phicry : 0.;
254 fVals[72] = vtxcol.size();
258 fVals[0] = s->rawEnergy();
263 fVals[5] = s->etaWidth();
264 fVals[6] = s->phiWidth();
265 fVals[7] = vtxcol.size();
269 const Double_t varscale = 1.253;
274 den = s->rawEnergy();
279 den = s->rawEnergy() + s->preshowerEnergy();
289 return std::pair<double,double>(ecor,ecorerr);
307 Double_t ebcmax = -99.;
310 if (bc->
energy() > ebcmax && bc !=
b) {
317 Double_t ebcmin = 1e6;
320 if (bc->
energy() < ebcmin && bc !=
b) {
330 if (bc->
energy() < ebcmin && bc !=b && bc!=bclast) {
343 fVals[0] = s->rawEnergy();
344 fVals[1] = clustertools.e3x3(*b)/s->rawEnergy();
347 fVals[4] = clustertools.e5x5(*b)/s->rawEnergy();
349 fVals[6] = s->etaWidth();
350 fVals[7] = s->phiWidth();
353 double bemax = clustertools.eMax(*b);
354 double be2nd = clustertools.e2nd(*b);
355 double betop = clustertools.eTop(*b);
356 double bebottom = clustertools.eBottom(*b);
357 double beleft = clustertools.eLeft(*b);
358 double beright = clustertools.eRight(*b);
364 fVals[11] = clustertools.e3x3(*b)/b->
energy();
365 fVals[12] = clustertools.e5x5(*b)/b->
energy();
366 fVals[13] =
sqrt(clustertools.localCovariances(*b)[0]);
367 fVals[14] =
sqrt(clustertools.localCovariances(*b)[2]);
368 fVals[15] = clustertools.localCovariances(*b)[1];
369 fVals[16] = bemax/b->
energy();
370 fVals[17] =
log(be2nd/bemax);
371 fVals[18] =
log(betop/bemax);
372 fVals[19] =
log(bebottom/bemax);
373 fVals[20] =
log(beleft/bemax);
374 fVals[21] =
log(beright/bemax);
375 fVals[22] = (betop-bebottom)/(betop+bebottom);
376 fVals[23] = (beleft-beright)/(beleft+beright);
379 double bc2emax = hasbc2 ? clustertools.eMax(*b2) : 0.;
380 double bc2e2nd = hasbc2 ? clustertools.e2nd(*b2) : 0.;
381 double bc2etop = hasbc2 ? clustertools.eTop(*b2) : 0.;
382 double bc2ebottom = hasbc2 ? clustertools.eBottom(*b2) : 0.;
383 double bc2eleft = hasbc2 ? clustertools.eLeft(*b2) : 0.;
384 double bc2eright = hasbc2 ? clustertools.eRight(*b2) : 0.;
386 fVals[24] = hasbc2 ? (b2->
eta()-s->eta()) : 0.;
388 fVals[26] = hasbc2 ? b2->
energy()/s->rawEnergy() : 0.;
389 fVals[27] = hasbc2 ? clustertools.e3x3(*b2)/b2->
energy() : 0.;
390 fVals[28] = hasbc2 ? clustertools.e5x5(*b2)/b2->
energy() : 0.;
391 fVals[29] = hasbc2 ?
sqrt(clustertools.localCovariances(*b2)[0]) : 0.;
392 fVals[30] = hasbc2 ?
sqrt(clustertools.localCovariances(*b2)[2]) : 0.;
393 fVals[31] = hasbc2 ? clustertools.localCovariances(*b)[1] : 0.;
394 fVals[32] = hasbc2 ? bc2emax/b2->
energy() : 0.;
395 fVals[33] = hasbc2 ?
log(bc2e2nd/bc2emax) : 0.;
396 fVals[34] = hasbc2 ?
log(bc2etop/bc2emax) : 0.;
397 fVals[35] = hasbc2 ?
log(bc2ebottom/bc2emax) : 0.;
398 fVals[36] = hasbc2 ?
log(bc2eleft/bc2emax) : 0.;
399 fVals[37] = hasbc2 ?
log(bc2eright/bc2emax) : 0.;
400 fVals[38] = hasbc2 ? (bc2etop-bc2ebottom)/(bc2etop+bc2ebottom) : 0.;
401 fVals[39] = hasbc2 ? (bc2eleft-bc2eright)/(bc2eleft+bc2eright) : 0.;
403 fVals[40] = hasbclast ? (bclast->
eta()-s->eta()) : 0.;
405 fVals[42] = hasbclast ? bclast->
energy()/s->rawEnergy() : 0.;
406 fVals[43] = hasbclast ? clustertools.e3x3(*bclast)/bclast->
energy() : 0.;
407 fVals[44] = hasbclast ? clustertools.e5x5(*bclast)/bclast->
energy() : 0.;
408 fVals[45] = hasbclast ?
sqrt(clustertools.localCovariances(*bclast)[0]) : 0.;
409 fVals[46] = hasbclast ?
sqrt(clustertools.localCovariances(*bclast)[2]) : 0.;
410 fVals[47] = hasbclast ? clustertools.localCovariances(*bclast)[1] : 0.;
412 fVals[48] = hasbclast2 ? (bclast2->
eta()-s->eta()) : 0.;
414 fVals[50] = hasbclast2 ? bclast2->
energy()/s->rawEnergy() : 0.;
415 fVals[51] = hasbclast2 ? clustertools.e3x3(*bclast2)/bclast2->
energy() : 0.;
416 fVals[52] = hasbclast2 ? clustertools.e5x5(*bclast2)/bclast2->
energy() : 0.;
417 fVals[53] = hasbclast2 ?
sqrt(clustertools.localCovariances(*bclast2)[0]) : 0.;
418 fVals[54] = hasbclast2 ?
sqrt(clustertools.localCovariances(*bclast2)[2]) : 0.;
419 fVals[55] = hasbclast2 ? clustertools.localCovariances(*bclast2)[1] : 0.;
422 float betacry, bphicry, bthetatilt, bphitilt;
433 fVals[61] = biphi%20;
437 float bc2etacry, bc2phicry, bc2thetatilt, bc2phitilt;
438 int bc2ieta, bc2iphi;
440 bc2ieta,bc2iphi,bc2thetatilt,bc2phitilt );
442 fVals[64] = hasbc2 ? bc2ieta : 0.;
443 fVals[65] = hasbc2 ? bc2iphi : 0.;
444 fVals[66] = hasbc2 ? bc2ieta%5 : 0.;
445 fVals[67] = hasbc2 ? bc2iphi%2 : 0.;
447 fVals[69] = hasbc2 ? bc2iphi%20 : 0.;
448 fVals[70] = hasbc2 ? bc2etacry : 0.;
449 fVals[71] = hasbc2 ? bc2phicry : 0.;
451 fVals[72] = vtxcol.size();
455 fVals[0] = s->rawEnergy();
456 fVals[1] = clustertools.e3x3(*b)/s->rawEnergy();
459 fVals[4] = clustertools.e5x5(*b)/s->rawEnergy();
460 fVals[5] = s->etaWidth();
461 fVals[6] = s->phiWidth();
462 fVals[7] = vtxcol.size();
466 const Double_t varscale = 1.253;
471 den = s->rawEnergy();
476 den = s->rawEnergy() + s->preshowerEnergy();
486 return std::pair<double,double>(ecor,ecorerr);
499 fVals[0] = s->rawEnergy();
504 fVals[5] = s->etaWidth();
505 fVals[6] = s->phiWidth();
506 fVals[7] = s->clustersSize();
509 fVals[10] = vtxcol.size();
512 double bemax = clustertools.eMax(*b);
513 double be2nd = clustertools.e2nd(*b);
514 double betop = clustertools.eTop(*b);
515 double bebottom = clustertools.eBottom(*b);
516 double beleft = clustertools.eLeft(*b);
517 double beright = clustertools.eRight(*b);
519 double be2x5max = clustertools.e2x5Max(*b);
520 double be2x5top = clustertools.e2x5Top(*b);
521 double be2x5bottom = clustertools.e2x5Bottom(*b);
522 double be2x5left = clustertools.e2x5Left(*b);
523 double be2x5right = clustertools.e2x5Right(*b);
528 fVals[14] = clustertools.e3x3(*b)/b->
energy();
529 fVals[15] = clustertools.e5x5(*b)/b->
energy();
530 fVals[16] =
sqrt(clustertools.localCovariances(*b)[0]);
531 fVals[17] =
sqrt(clustertools.localCovariances(*b)[2]);
532 fVals[18] = clustertools.localCovariances(*b)[1];
533 fVals[19] = bemax/b->
energy();
534 fVals[20] = be2nd/b->
energy();
535 fVals[21] = betop/b->
energy();
536 fVals[22] = bebottom/b->
energy();
537 fVals[23] = beleft/b->
energy();
538 fVals[24] = beright/b->
energy();
539 fVals[25] = be2x5max/b->
energy();
540 fVals[26] = be2x5top/b->
energy();
541 fVals[27] = be2x5bottom/b->
energy();
542 fVals[28] = be2x5left/b->
energy();
543 fVals[29] = be2x5right/b->
energy();
549 float betacry, bphicry, bthetatilt, bphitilt;
560 fVals[35] = biphi%20;
567 fVals[30] = s->preshowerEnergy()/s->rawEnergy();
579 den = s->rawEnergy();
584 den = s->rawEnergy() + s->preshowerEnergy();
595 fVals[3] = 1.0045*p.
r9() +0.001;
596 fVals[5] = 1.04302*s->etaWidth() - 0.000618;
597 fVals[6] = 1.00002*s->phiWidth() - 0.000371;
598 fVals[14] = fVals[3]*s->rawEnergy()/b->
energy();
602 fVals[4] = fVals[15]*b->
energy()/s->rawEnergy();
604 fVals[16] = 0.891832*
sqrt(clustertools.localCovariances(*b)[0]) + 0.0009133;
605 fVals[17] = 0.993*
sqrt(clustertools.localCovariances(*b)[2]);
607 fVals[19] = 1.012*bemax/b->
energy();
608 fVals[20] = 1.0*be2nd/b->
energy();
609 fVals[21] = 0.94*betop/b->
energy();
610 fVals[22] = 0.94*bebottom/b->
energy();
611 fVals[23] = 0.94*beleft/b->
energy();
612 fVals[24] = 0.94*beright/b->
energy();
613 fVals[25] = 1.006*be2x5max/b->
energy();
614 fVals[26] = 1.09*be2x5top/b->
energy();
615 fVals[27] = 1.09*be2x5bottom/b->
energy();
616 fVals[28] = 1.09*be2x5left/b->
energy();
617 fVals[29] = 1.09*be2x5right/b->
energy();
621 fVals[3] = 1.0086*p.
r9() -0.0007;
623 fVals[5] = 0.903254*s->etaWidth() +0.001346;
624 fVals[6] = 0.99992*s->phiWidth() + 4.8e-07;
628 fVals[14] = fVals[3]*s->rawEnergy()/b->
energy();
630 fVals[16] = 0.9947*
sqrt(clustertools.localCovariances(*b)[0]) + 0.00003;
632 fVals[19] = 1.005*bemax/b->
energy();
633 fVals[20] = 1.02*be2nd/b->
energy();
634 fVals[21] = 0.96*betop/b->
energy();
635 fVals[22] = 0.96*bebottom/b->
energy();
636 fVals[23] = 0.96*beleft/b->
energy();
637 fVals[24] = 0.96*beright/b->
energy();
638 fVals[25] = 1.0075*be2x5max/b->
energy();
639 fVals[26] = 1.13*be2x5top/b->
energy();
640 fVals[27] = 1.13*be2x5bottom/b->
energy();
641 fVals[28] = 1.13*be2x5left/b->
energy();
642 fVals[29] = 1.13*be2x5right/b->
energy();
647 Double_t ecorerr = readervar->
GetResponse(fVals)*den;
651 return std::pair<double,double>(ecor,ecorerr);
663 fVals[0] = s->rawEnergy();
666 fVals[3] = clustertools.e3x3(*b)/s->rawEnergy();
667 fVals[4] = clustertools.e5x5(*b)/s->rawEnergy();
668 fVals[5] = s->etaWidth();
669 fVals[6] = s->phiWidth();
670 fVals[7] = s->clustersSize();
673 fVals[10] = vtxcol.size();
676 double bemax = clustertools.eMax(*b);
677 double be2nd = clustertools.e2nd(*b);
678 double betop = clustertools.eTop(*b);
679 double bebottom = clustertools.eBottom(*b);
680 double beleft = clustertools.eLeft(*b);
681 double beright = clustertools.eRight(*b);
683 double be2x5max = clustertools.e2x5Max(*b);
684 double be2x5top = clustertools.e2x5Top(*b);
685 double be2x5bottom = clustertools.e2x5Bottom(*b);
686 double be2x5left = clustertools.e2x5Left(*b);
687 double be2x5right = clustertools.e2x5Right(*b);
692 fVals[14] = clustertools.e3x3(*b)/b->
energy();
693 fVals[15] = clustertools.e5x5(*b)/b->
energy();
694 fVals[16] =
sqrt(clustertools.localCovariances(*b)[0]);
695 fVals[17] =
sqrt(clustertools.localCovariances(*b)[2]);
696 fVals[18] = clustertools.localCovariances(*b)[1];
697 fVals[19] = bemax/b->
energy();
698 fVals[20] = be2nd/b->
energy();
699 fVals[21] = betop/b->
energy();
700 fVals[22] = bebottom/b->
energy();
701 fVals[23] = beleft/b->
energy();
702 fVals[24] = beright/b->
energy();
703 fVals[25] = be2x5max/b->
energy();
704 fVals[26] = be2x5top/b->
energy();
705 fVals[27] = be2x5bottom/b->
energy();
706 fVals[28] = be2x5left/b->
energy();
707 fVals[29] = be2x5right/b->
energy();
713 float betacry, bphicry, bthetatilt, bphitilt;
724 fVals[35] = biphi%20;
731 fVals[30] = s->preshowerEnergy()/s->rawEnergy();
738 den = s->rawEnergy();
743 den = s->rawEnergy() + s->preshowerEnergy();
749 Double_t ecorerr = readervar->
GetResponse(fVals)*den;
753 return std::pair<double,double>(ecor,ecorerr);
double GetResponse(const float *vector) const
constexpr double deltaPhi(double phi1, double phi2)
void Initialize(const edm::EventSetup &iSetup, std::string regweights, bool weightsFromDB=false)
const GBRForest * fReaderee
const GBRForest * fReadereb
const GBRForest * fReaderebvariance
std::vector< Vertex > VertexCollection
collection of Vertex objects
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
double eta() const
pseudorapidity of cluster centroid
std::pair< double, double > CorrectedEnergyWithError(const reco::Photon &p, const reco::VertexCollection &vtxcol, EcalClusterLazyTools &clustertools, const edm::EventSetup &es)
float hcalOverEcal() const
double energy() const
cluster energy
float hadTowOverEm() const
the ration of hadronic energy in towers behind the BCs in the SC and the SC energy ...
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
float hcalOverEcalBc() const
bool isNonnull() const
Checks for non-null.
std::pair< double, double > CorrectedEnergyWithErrorV3(const reco::Photon &p, const reco::VertexCollection &vtxcol, double rho, EcalClusterLazyTools &clustertools, const edm::EventSetup &es, bool applyRescale=false)
const GBRForest * fReadereevariance
SuperClusterRef superCluster() const override
reference to a SuperCluster
double phi() const
azimuthal angle of cluster centroid
T const * product() const
bool ecalDrivenSeed() const