19 : isInitialized_(
false),
20 mva_NoEleMatch_woGwoGSF_BL_(
nullptr),
21 mva_NoEleMatch_wGwoGSF_BL_(
nullptr),
24 mva_NoEleMatch_woGwoGSF_EC_(
nullptr),
25 mva_NoEleMatch_wGwoGSF_EC_(
nullptr),
30 if (cfg.
exists(
"inputFileName")) {
34 <<
"Requested to load tau MVA input from ROOT file but no file provided in cfg file";
90 throw cms::Exception(
"PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
91 <<
" Failed to load MVA = " << mvaName.data() <<
" from file " 117 throw cms::Exception(
"PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
137 Float_t TauEtaAtEcalEntrance,
139 Float_t TauLeadChargedPFCandPt,
140 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
141 Float_t TauEmFraction,
142 Float_t TauLeadPFChargedHadrHoP,
143 Float_t TauLeadPFChargedHadrEoP,
144 Float_t TauVisMassIn,
145 Float_t TaudCrackEta,
146 Float_t TaudCrackPhi,
148 Int_t TauSignalPFGammaCandsIn,
149 Int_t TauSignalPFGammaCandsOut,
150 const std::vector<Float_t>& GammasdEtaInSigCone,
151 const std::vector<Float_t>& GammasdPhiInSigCone,
152 const std::vector<Float_t>& GammasPtInSigCone,
153 const std::vector<Float_t>& GammasdEtaOutSigCone,
154 const std::vector<Float_t>& GammasdPhiOutSigCone,
155 const std::vector<Float_t>& GammasPtOutSigCone,
158 Float_t ElecEtotOverPin,
159 Float_t ElecChi2NormGSF,
160 Float_t ElecChi2NormKF,
161 Float_t ElecGSFNumHits,
162 Float_t ElecKFNumHits,
163 Float_t ElecGSFTrackResol,
164 Float_t ElecGSFTracklnPt,
168 Float_t ElecDeltaEta,
169 Float_t ElecDeltaPhi,
170 Float_t ElecMvaInSigmaEtaEta,
171 Float_t ElecMvaInHadEnergy,
172 Float_t ElecMvaInDeltaEta) {
177 for (
unsigned int i = 0;
i < GammasPtInSigCone.size(); ++
i) {
178 double pt_i = GammasPtInSigCone[
i];
179 double phi_i = GammasdPhiInSigCone[
i];
180 if (GammasdPhiInSigCone[
i] >
M_PI)
181 phi_i = GammasdPhiInSigCone[
i] - 2 *
M_PI;
182 else if (GammasdPhiInSigCone[
i] < -M_PI)
183 phi_i = GammasdPhiInSigCone[
i] + 2 *
M_PI;
184 double eta_i = GammasdEtaInSigCone[
i];
186 sumPt2 += (pt_i * pt_i);
187 dEta2 += (pt_i * eta_i * eta_i);
188 dPhi2 += (pt_i * phi_i * phi_i);
190 Float_t TauGammaEnFracIn = -99.;
192 TauGammaEnFracIn = sumPt / TauPt;
205 for (
unsigned int i = 0;
i < GammasPtOutSigCone.size(); ++
i) {
206 double pt_i = GammasPtOutSigCone[
i];
207 double phi_i = GammasdPhiOutSigCone[
i];
208 if (GammasdPhiOutSigCone[
i] >
M_PI)
209 phi_i = GammasdPhiOutSigCone[
i] - 2 *
M_PI;
210 else if (GammasdPhiOutSigCone[
i] < -M_PI)
211 phi_i = GammasdPhiOutSigCone[
i] + 2 *
M_PI;
212 double eta_i = GammasdEtaOutSigCone[
i];
214 sumPt2 += (pt_i * pt_i);
215 dEta2 += (pt_i * eta_i * eta_i);
216 dPhi2 += (pt_i * phi_i * phi_i);
218 Float_t TauGammaEnFracOut = sumPt / TauPt;
227 TauEtaAtEcalEntrance,
229 TauLeadChargedPFCandPt,
230 TauLeadChargedPFCandEtaAtEcalEntrance,
232 TauLeadPFChargedHadrHoP,
233 TauLeadPFChargedHadrEoP,
238 TauSignalPFGammaCandsIn,
239 TauSignalPFGammaCandsOut,
260 ElecMvaInSigmaEtaEta,
266 Float_t TauEtaAtEcalEntrance,
268 Float_t TauLeadChargedPFCandPt,
269 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
270 Float_t TauEmFraction,
271 Float_t TauLeadPFChargedHadrHoP,
272 Float_t TauLeadPFChargedHadrEoP,
273 Float_t TauVisMassIn,
274 Float_t TaudCrackEta,
275 Float_t TaudCrackPhi,
277 Int_t TauSignalPFGammaCandsIn,
278 Int_t TauSignalPFGammaCandsOut,
279 Float_t TauGammaEtaMomIn,
280 Float_t TauGammaEtaMomOut,
281 Float_t TauGammaPhiMomIn,
282 Float_t TauGammaPhiMomOut,
283 Float_t TauGammaEnFracIn,
284 Float_t TauGammaEnFracOut,
287 Float_t ElecEtotOverPin,
288 Float_t ElecChi2NormGSF,
289 Float_t ElecChi2NormKF,
290 Float_t ElecGSFNumHits,
291 Float_t ElecKFNumHits,
292 Float_t ElecGSFTrackResol,
293 Float_t ElecGSFTracklnPt,
297 Float_t ElecDeltaEta,
298 Float_t ElecDeltaPhi,
299 Float_t ElecMvaInSigmaEtaEta,
300 Float_t ElecMvaInHadEnergy,
301 Float_t ElecMvaInDeltaEta) {
303 throw cms::Exception(
"ClassNotInitialized") <<
" AntiElectronMVA not properly initialized !!\n";
306 double mvaValue = -99.;
308 const float ECALBarrelEndcapEtaBorder = 1.479;
309 float ElecDeltaPinPoutOverPin = (ElecPin > 0.0) ? (
std::abs(ElecPin - ElecPout) / ElecPin) : 1.0;
310 float ElecEecalOverPout = (ElecPout > 0.0) ? (ElecEecal / ElecPout) : 20.0;
311 float ElecNumHitsDiffOverSum = ((ElecGSFNumHits + ElecKFNumHits) > 0.0)
312 ? ((ElecGSFNumHits - ElecKFNumHits) / (ElecGSFNumHits + ElecKFNumHits))
315 if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn == 0 && TauHasGsf < 0.5) {
316 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
340 }
else if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn > 0 &&
342 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
382 }
else if (TauSignalPFGammaCandsIn == 0 && TauHasGsf > 0.5) {
383 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
435 }
else if (TauSignalPFGammaCandsIn > 0 && TauHasGsf > 0.5) {
436 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
512 float TauEtaAtEcalEntrance = -99.;
513 float sumEtaTimesEnergy = 0.;
514 float sumEnergy = 0.;
515 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
516 for (
const auto& pfCandidate : signalPFCands) {
517 sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta() * pfCandidate->energy();
518 sumEnergy += pfCandidate->energy();
520 if (sumEnergy > 0.) {
521 TauEtaAtEcalEntrance = sumEtaTimesEnergy / sumEnergy;
524 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
525 float TauLeadChargedPFCandPt = -99.;
526 for (
const auto& pfCandidate : signalPFCands) {
528 if (pfCandidate->trackRef().isNonnull())
529 track = pfCandidate->trackRef().get();
530 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull())
531 track = pfCandidate->muonRef()->innerTrack().get();
532 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull())
533 track = pfCandidate->muonRef()->globalTrack().get();
534 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull())
535 track = pfCandidate->muonRef()->outerTrack().get();
536 else if (pfCandidate->gsfTrackRef().isNonnull())
537 track = pfCandidate->gsfTrackRef().get();
539 if (track->
pt() > TauLeadChargedPFCandPt) {
540 TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().
eta();
541 TauLeadChargedPFCandPt = track->
pt();
546 Float_t TauPt = thePFTau.
pt();
548 Float_t TauLeadPFChargedHadrHoP = 0.;
549 Float_t TauLeadPFChargedHadrEoP = 0.;
555 std::vector<Float_t> GammasdEtaInSigCone;
556 std::vector<Float_t> GammasdPhiInSigCone;
557 std::vector<Float_t> GammasPtInSigCone;
558 std::vector<Float_t> GammasdEtaOutSigCone;
559 std::vector<Float_t> GammasdPhiOutSigCone;
560 std::vector<Float_t> GammasPtOutSigCone;
569 if (dR < signalrad) {
574 GammasdEtaInSigCone.push_back(
gamma->eta() - thePFTau.
eta());
575 GammasdPhiInSigCone.push_back(
gamma->phi() - thePFTau.
phi());
577 GammasPtInSigCone.push_back(
gamma->pt());
578 pfGammaSum +=
gamma->p4();
586 GammasdEtaOutSigCone.push_back(
gamma->eta() - thePFTau.
eta());
587 GammasdPhiOutSigCone.push_back(
gamma->phi() - thePFTau.
phi());
589 GammasPtOutSigCone.push_back(
gamma->pt());
598 if (dR < signalrad) {
599 pfChargedSum += charged->p4();
603 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
604 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
605 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
607 Float_t TauPhi = thePFTau.
phi();
608 float sumPhiTimesEnergy = 0.;
609 float sumEnergyPhi = 0.;
611 for (
const auto& pfc : signalPFCands) {
612 sumPhiTimesEnergy += pfc->positionAtECALEntrance().phi() * pfc->energy();
613 sumEnergyPhi += pfc->energy();
617 for (
const auto& signalPFCand : signalPFCands) {
619 float phi = thePFTau.
phi();
625 sumPhiTimesEnergy += phi * signalCand->
energy();
626 sumEnergy += signalCand->
energy();
629 if (sumEnergyPhi > 0.) {
630 TauPhi = sumPhiTimesEnergy / sumEnergyPhi;
632 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
633 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
637 Float_t ElecEta = theGsfEle.
eta();
638 Float_t ElecPhi = theGsfEle.
phi();
642 Float_t ElecEgamma = 0.;
646 pfCluster != pfSuperCluster->clustersEnd();
648 double pfClusterEn = (*pfCluster)->energy();
649 if (pfCluster == pfSuperCluster->clustersBegin())
650 ElecEe += pfClusterEn;
652 ElecEgamma += pfClusterEn;
658 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma) / ElecPin) : -0.1;
662 Float_t ElecMvaInSigmaEtaEta = (theGsfEle).mvaInput().sigmaEtaEta;
663 Float_t ElecMvaInHadEnergy = (theGsfEle).mvaInput().hadEnergy;
664 Float_t ElecMvaInDeltaEta = (theGsfEle).mvaInput().deltaEta;
667 Float_t ElecChi2NormGSF = -99.;
668 Float_t ElecGSFNumHits = -99.;
669 Float_t ElecGSFTrackResol = -99.;
670 Float_t ElecGSFTracklnPt = -99.;
672 ElecChi2NormGSF = (theGsfEle).gsfTrack()->normalizedChi2();
673 ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
674 if (theGsfEle.
gsfTrack()->pt() > 0.) {
675 ElecGSFTrackResol = theGsfEle.
gsfTrack()->ptError() / theGsfEle.
gsfTrack()->pt();
676 ElecGSFTracklnPt =
log(theGsfEle.
gsfTrack()->pt()) * M_LN10;
681 Float_t ElecChi2NormKF = -99.;
682 Float_t ElecKFNumHits = -99.;
684 ElecChi2NormKF = (theGsfEle).closestCtfTrackRef()->normalizedChi2();
685 ElecKFNumHits = (theGsfEle).closestCtfTrackRef()->numberOfValidHits();
689 TauEtaAtEcalEntrance,
691 TauLeadChargedPFCandPt,
692 TauLeadChargedPFCandEtaAtEcalEntrance,
694 TauLeadPFChargedHadrHoP,
695 TauLeadPFChargedHadrEoP,
700 TauSignalPFGammaCandsIn,
701 TauSignalPFGammaCandsOut,
705 GammasdEtaOutSigCone,
706 GammasdPhiOutSigCone,
722 ElecMvaInSigmaEtaEta,
729 float TauEtaAtEcalEntrance = -99.;
730 float sumEtaTimesEnergy = 0.;
731 float sumEnergy = 0.;
732 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
733 for (
const auto& pfCandidate : signalPFCands) {
734 sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta() * pfCandidate->energy();
735 sumEnergy += pfCandidate->energy();
737 if (sumEnergy > 0.) {
738 TauEtaAtEcalEntrance = sumEtaTimesEnergy / sumEnergy;
741 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
742 float TauLeadChargedPFCandPt = -99.;
743 for (
const auto& pfCandidate : signalPFCands) {
745 if (pfCandidate->trackRef().isNonnull())
746 track = pfCandidate->trackRef().get();
747 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull())
748 track = pfCandidate->muonRef()->innerTrack().get();
749 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull())
750 track = pfCandidate->muonRef()->globalTrack().get();
751 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull())
752 track = pfCandidate->muonRef()->outerTrack().get();
753 else if (pfCandidate->gsfTrackRef().isNonnull())
754 track = pfCandidate->gsfTrackRef().get();
756 if (track->
pt() > TauLeadChargedPFCandPt) {
757 TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().
eta();
758 TauLeadChargedPFCandPt = track->
pt();
763 Float_t TauPt = thePFTau.
pt();
765 Float_t TauLeadPFChargedHadrHoP = 0.;
766 Float_t TauLeadPFChargedHadrEoP = 0.;
772 std::vector<Float_t> GammasdEtaInSigCone;
773 std::vector<Float_t> GammasdPhiInSigCone;
774 std::vector<Float_t> GammasPtInSigCone;
775 std::vector<Float_t> GammasdEtaOutSigCone;
776 std::vector<Float_t> GammasdPhiOutSigCone;
777 std::vector<Float_t> GammasPtOutSigCone;
786 if (dR < signalrad) {
791 GammasdEtaInSigCone.push_back(
gamma->eta() - thePFTau.
eta());
792 GammasdPhiInSigCone.push_back(
gamma->phi() - thePFTau.
phi());
794 GammasPtInSigCone.push_back(
gamma->pt());
795 pfGammaSum +=
gamma->p4();
803 GammasdEtaOutSigCone.push_back(
gamma->eta() - thePFTau.
eta());
804 GammasdPhiOutSigCone.push_back(
gamma->phi() - thePFTau.
phi());
806 GammasPtOutSigCone.push_back(
gamma->pt());
815 if (dR < signalrad) {
816 pfChargedSum += charged->p4();
820 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
821 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
822 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
824 Float_t TauPhi = thePFTau.
phi();
825 float sumPhiTimesEnergy = 0.;
826 float sumEnergyPhi = 0.;
828 for (
const auto& pfCandidate : signalPFCands) {
829 sumPhiTimesEnergy += pfCandidate->positionAtECALEntrance().phi() * pfCandidate->energy();
830 sumEnergyPhi += pfCandidate->energy();
834 for (
const auto& signalPFCand : signalPFCands) {
836 float phi = thePFTau.
phi();
842 sumPhiTimesEnergy += phi * signalCand->
energy();
843 sumEnergy += signalCand->
energy();
846 if (sumEnergyPhi > 0.) {
847 TauPhi = sumPhiTimesEnergy / sumEnergyPhi;
849 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
850 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
854 Float_t dummyElecEta = 9.9;
857 TauEtaAtEcalEntrance,
859 TauLeadChargedPFCandPt,
860 TauLeadChargedPFCandEtaAtEcalEntrance,
862 TauLeadPFChargedHadrHoP,
863 TauLeadPFChargedHadrEoP,
868 TauSignalPFGammaCandsIn,
869 TauSignalPFGammaCandsOut,
873 GammasdEtaOutSigCone,
874 GammasdPhiOutSigCone,
902 Float_t TauPt = theTau.
pt();
905 Float_t TauLeadPFChargedHadrHoP = 0.;
906 Float_t TauLeadPFChargedHadrEoP = 0.;
912 std::vector<Float_t> GammasdEtaInSigCone;
913 std::vector<Float_t> GammasdPhiInSigCone;
914 std::vector<Float_t> GammasPtInSigCone;
915 std::vector<Float_t> GammasdEtaOutSigCone;
916 std::vector<Float_t> GammasdPhiOutSigCone;
917 std::vector<Float_t> GammasPtOutSigCone;
922 for (
const auto&
gamma : signalGammaCands) {
927 if (dR < signalrad) {
934 GammasdEtaInSigCone.push_back(
gamma->eta() - theTau.
eta());
935 GammasdPhiInSigCone.push_back(
gamma->phi() - theTau.
phi());
939 GammasPtInSigCone.push_back(
gamma->pt());
940 pfGammaSum +=
gamma->p4();
950 GammasdEtaOutSigCone.push_back(
gamma->eta() - theTau.
eta());
951 GammasdPhiOutSigCone.push_back(
gamma->phi() - theTau.
phi());
955 GammasPtOutSigCone.push_back(
gamma->pt());
960 for (
const auto& charged : signalChargedCands) {
965 if (dR < signalrad) {
966 pfChargedSum += charged->p4();
970 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
971 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
972 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
973 Float_t TauPhi = -99.;
975 float sumPhiTimesEnergy = 0.;
976 float sumEnergy = 0.;
978 for (
const auto& signalCandPtr : signalCands) {
986 sumPhiTimesEnergy += phi * signalCand->
energy();
987 sumEnergy += signalCand->
energy();
989 if (sumEnergy > 0.) {
990 TauPhi = sumPhiTimesEnergy / sumEnergy;
996 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
997 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
999 Float_t TauHasGsf = 0;
1002 if (
abs(packedLeadTauCand->
pdgId()) == 11)
1006 Float_t ElecEta = theEle.
eta();
1007 Float_t ElecPhi = theEle.
phi();
1010 Float_t ElecEe = 0.;
1011 Float_t ElecEgamma = 0.;
1015 pfCluster != pfSuperCluster->clustersEnd();
1017 double pfClusterEn = (*pfCluster)->energy();
1018 if (pfCluster == pfSuperCluster->clustersBegin())
1019 ElecEe += pfClusterEn;
1021 ElecEgamma += pfClusterEn;
1027 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma) / ElecPin) : -0.1;
1031 Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
1032 Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
1033 Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
1036 Float_t ElecChi2NormGSF = -99.;
1037 Float_t ElecGSFNumHits = -99.;
1038 Float_t ElecGSFTrackResol = -99.;
1039 Float_t ElecGSFTracklnPt = -99.;
1041 ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
1042 ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1043 if (theEle.
gsfTrack()->pt() > 0.) {
1044 ElecGSFTrackResol = theEle.
gsfTrack()->ptError() / theEle.
gsfTrack()->pt();
1045 ElecGSFTracklnPt =
log(theEle.
gsfTrack()->pt()) * M_LN10;
1050 Float_t ElecChi2NormKF = -99.;
1051 Float_t ElecKFNumHits = -99.;
1053 ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1054 ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1058 TauEtaAtEcalEntrance,
1060 TauLeadChargedPFCandPt,
1061 TauLeadChargedPFCandEtaAtEcalEntrance,
1063 TauLeadPFChargedHadrHoP,
1064 TauLeadPFChargedHadrEoP,
1069 TauSignalPFGammaCandsIn,
1070 TauSignalPFGammaCandsOut,
1071 GammasdEtaInSigCone,
1072 GammasdPhiInSigCone,
1074 GammasdEtaOutSigCone,
1075 GammasdPhiOutSigCone,
1091 ElecMvaInSigmaEtaEta,
1103 Float_t TauPt = theTau.
pt();
1106 Float_t TauLeadPFChargedHadrHoP = 0.;
1107 Float_t TauLeadPFChargedHadrEoP = 0.;
1113 std::vector<Float_t> GammasdEtaInSigCone;
1114 std::vector<Float_t> GammasdPhiInSigCone;
1115 std::vector<Float_t> GammasPtInSigCone;
1116 std::vector<Float_t> GammasdEtaOutSigCone;
1117 std::vector<Float_t> GammasdPhiOutSigCone;
1118 std::vector<Float_t> GammasPtOutSigCone;
1123 for (
const auto&
gamma : signalGammaCands) {
1128 if (dR < signalrad) {
1133 GammasdEtaInSigCone.push_back(
gamma->eta() - theTau.
eta());
1134 GammasdPhiInSigCone.push_back(
gamma->phi() - theTau.
phi());
1136 GammasPtInSigCone.push_back(
gamma->pt());
1137 pfGammaSum +=
gamma->p4();
1145 GammasdEtaOutSigCone.push_back(
gamma->eta() - theTau.
eta());
1146 GammasdPhiOutSigCone.push_back(
gamma->phi() - theTau.
phi());
1148 GammasPtOutSigCone.push_back(
gamma->pt());
1153 for (
const auto& charged : signalChargedCands) {
1158 if (dR < signalrad) {
1159 pfChargedSum += charged->p4();
1163 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
1164 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
1165 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
1166 Float_t TauPhi = -99.;
1168 float sumPhiTimesEnergy = 0.;
1169 float sumEnergy = 0.;
1171 for (
const auto& signalCandPtr : signalCands) {
1173 float phi = theTau.
phi();
1179 sumPhiTimesEnergy += phi * signalCand->
energy();
1180 sumEnergy += signalCand->
energy();
1182 if (sumEnergy > 0.) {
1183 TauPhi = sumPhiTimesEnergy / sumEnergy;
1189 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1190 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1192 Float_t TauHasGsf = 0;
1196 if (
abs(packedLeadTauCand->
pdgId()) == 11)
1200 Float_t dummyElecEta = 9.9;
1203 TauEtaAtEcalEntrance,
1205 TauLeadChargedPFCandPt,
1206 TauLeadChargedPFCandEtaAtEcalEntrance,
1208 TauLeadPFChargedHadrHoP,
1209 TauLeadPFChargedHadrEoP,
1214 TauSignalPFGammaCandsIn,
1215 TauSignalPFGammaCandsOut,
1216 GammasdEtaInSigCone,
1217 GammasdPhiInSigCone,
1219 GammasdEtaOutSigCone,
1220 GammasdPhiOutSigCone,
1251 std::array<double, 18> fill_cPhi() {
1253 std::array<double, 18> cPhi;
1256 for (
unsigned iCrack = 1; iCrack <= 17; ++iCrack) {
1257 cPhi[iCrack] = cPhi[0] - 2. * iCrack * pi / 18;
1262 const std::array<double, 18> cPhi = fill_cPhi();
1274 double retVal = 99.;
1276 if (eta >= -1.47464 && eta <= 1.47464) {
1287 if (phi >= -pi && phi <= pi) {
1289 if (phi < cPhi[17] || phi >= cPhi[0]) {
1292 retVal =
minimum(phi - cPhi[0], phi - cPhi[17] - 2. * pi);
1296 unsigned iCrack = 16;
1298 if (phi < cPhi[iCrack]) {
1299 retVal =
minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1320 double cracks[5] = {0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00};
1322 double retVal = 99.;
1324 for (
int iCrack = 0; iCrack < 5; ++iCrack) {
1325 double d =
minimum(eta - cracks[iCrack], eta + cracks[iCrack]);
T getParameter(std::string const &) const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
double minimum(double a, double b)
std::string mvaName_woGwGSF_BL_
std::string mvaName_NoEleMatch_woGwoGSF_BL_
virtual TrackRef closestCtfTrackRef() const
bool isNonnull() const
Checks for non-null.
double eta() const final
momentum pseudorapidity
void beginEvent(const edm::EventSetup &)
int pdgId() const override
PDG identifier.
std::string mvaName_NoEleMatch_woGwoGSF_EC_
float hcalEnergyLeadChargedHadrCand() const
return hcal energy from LeadChargedHadrCand
T const * get() const
Returns C++ pointer to the item.
edm::FileInPath inputFileName_
AntiElectronIDMVA6(const edm::ParameterSet &)
const GBRForest * mva_wGwGSF_EC_
math::XYZVectorF trackMomentumAtVtx() const
Float_t * Var_woGwGSF_Barrel_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
const std::vector< reco::CandidatePtr > & signalGammaCands() const
Gamma candidates in signal region.
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
reco::CandidatePtrVector signalCands() const
std::string mvaName_NoEleMatch_wGwoGSF_EC_
Float_t * Var_wGwGSF_Barrel_
void beginEvent(const edm::Event &, const edm::EventSetup &)
PositionAtECalEntranceComputer positionAtECalEntrance_
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
reco::CandidatePtrVector signalGammaCands() const
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
std::vector< TFile * > inputFilesToDelete_
virtual double energy() const =0
energy
const GBRForest * mva_woGwGSF_EC_
bool usePhiAtEcalEntranceExtrapolation_
double eta() const
pseudorapidity of momentum vector
float deltaPhiSeedClusterTrackAtCalo() const
const CandidatePtr & leadChargedHadrCand() const
math::XYZVectorF trackMomentumOut() const
double pt() const
track transverse momentum
float ecalEnergyLeadChargedHadrCand() const
Abs< T >::type abs(const T &t)
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
float phiAtEcalEntrance() const
return phiAtEcalEntrance
const reco::CandidatePtr leadChargedHadrCand() const
LocationCode location() const
Where was the file found?
Analysis-level tau class.
std::string mvaName_wGwGSF_EC_
bool isNonnull() const
Checks for non-null.
float ptLeadChargedCand() const
return pt from LeadChargedCand
std::pair< int, edm::FunctionWithDict > OK
double MVAValue(Float_t TauPt, Float_t TauEtaAtEcalEntrance, Float_t TauPhi, Float_t TauLeadChargedPFCandPt, Float_t TauLeadChargedPFCandEtaAtEcalEntrance, Float_t TauEmFraction, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauVisMassIn, Float_t TaudCrackEta, Float_t TaudCrackPhi, Float_t TauHasGsf, Int_t TauSignalPFGammaCandsIn, Int_t TauSignalPFGammaCandsOut, const std::vector< Float_t > &GammasdEtaInSigCone, const std::vector< Float_t > &GammasdPhiInSigCone, const std::vector< Float_t > &GammasPtInSigCone, const std::vector< Float_t > &GammasdEtaOutSigCone, const std::vector< Float_t > &GammasdPhiOutSigCone, const std::vector< Float_t > &GammasPtOutSigCone, Float_t ElecEta, Float_t ElecPhi, Float_t ElecEtotOverPin, Float_t ElecChi2NormGSF, Float_t ElecChi2NormKF, Float_t ElecGSFNumHits, Float_t ElecKFNumHits, Float_t ElecGSFTrackResol, Float_t ElecGSFTracklnPt, Float_t ElecPin, Float_t ElecPout, Float_t ElecEecal, Float_t ElecDeltaEta, Float_t ElecDeltaPhi, Float_t ElecMvaInSigmaEtaEta, Float_t ElecMvaInHadEnergy, Float_t ElecMvaInDeltaEta)
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
Analysis-level electron class.
reco::TrackRef closestCtfTrackRef() const override
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
const GBRForest * mva_wGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
float emFraction_MVA() const
return emFraction_MVA
float deltaEtaSeedClusterTrackAtCalo() const
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
SuperClusterRef superCluster() const override
reference to a SuperCluster
Float_t * Var_wGwGSF_Endcap_
T get() const
get a component
std::string mvaName_wGwGSF_BL_
std::string mvaName_NoEleMatch_wGwoGSF_BL_
std::string fullPath() const
math::XYZPoint Point
point in the space
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
reco::CandidatePtrVector signalChargedHadrCands() const
const PFCandidatePtr leadPFChargedHadrCand() const
Getters for different PFCandidates for PFTaus made from PFCandidates.
float etaAtEcalEntrance() const
return etaAtEcalEntrance
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
double dCrackEta(double eta)
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
double GetClassifier(const float *vector) const
Float_t * Var_woGwGSF_Endcap_
double phi() const final
momentum azimuthal angle
T const * product() const
std::string mvaName_woGwGSF_EC_
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_