22 : isInitialized_(
false),
23 mva_NoEleMatch_woGwoGSF_BL_(
nullptr),
24 mva_NoEleMatch_wGwoGSF_BL_(
nullptr),
27 mva_NoEleMatch_woGwoGSF_EC_(
nullptr),
28 mva_NoEleMatch_wGwoGSF_EC_(
nullptr),
33 if (cfg.
exists(
"inputFileName")) {
37 <<
"Requested to load tau MVA input from ROOT file but no file provided in cfg file";
94 throw cms::Exception(
"PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
95 <<
" Failed to load MVA = " << mvaName.data() <<
" from file " 121 throw cms::Exception(
"PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
144 Float_t TauEtaAtEcalEntrance,
146 Float_t TauLeadChargedPFCandPt,
147 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
148 Float_t TauEmFraction,
149 Float_t TauLeadPFChargedHadrHoP,
150 Float_t TauLeadPFChargedHadrEoP,
151 Float_t TauVisMassIn,
152 Float_t TaudCrackEta,
153 Float_t TaudCrackPhi,
155 Int_t TauSignalPFGammaCandsIn,
156 Int_t TauSignalPFGammaCandsOut,
157 const std::vector<Float_t>& GammasdEtaInSigCone,
158 const std::vector<Float_t>& GammasdPhiInSigCone,
159 const std::vector<Float_t>& GammasPtInSigCone,
160 const std::vector<Float_t>& GammasdEtaOutSigCone,
161 const std::vector<Float_t>& GammasdPhiOutSigCone,
162 const std::vector<Float_t>& GammasPtOutSigCone,
165 Float_t ElecEtotOverPin,
166 Float_t ElecChi2NormGSF,
167 Float_t ElecChi2NormKF,
168 Float_t ElecGSFNumHits,
169 Float_t ElecKFNumHits,
170 Float_t ElecGSFTrackResol,
171 Float_t ElecGSFTracklnPt,
175 Float_t ElecDeltaEta,
176 Float_t ElecDeltaPhi,
177 Float_t ElecMvaInSigmaEtaEta,
178 Float_t ElecMvaInHadEnergy,
179 Float_t ElecMvaInDeltaEta) {
184 for (
unsigned int i = 0;
i < GammasPtInSigCone.size(); ++
i) {
185 double pt_i = GammasPtInSigCone[
i];
186 double phi_i = GammasdPhiInSigCone[
i];
187 if (GammasdPhiInSigCone[
i] >
M_PI)
188 phi_i = GammasdPhiInSigCone[
i] - 2 *
M_PI;
189 else if (GammasdPhiInSigCone[
i] < -M_PI)
190 phi_i = GammasdPhiInSigCone[
i] + 2 *
M_PI;
191 double eta_i = GammasdEtaInSigCone[
i];
193 sumPt2 += (pt_i * pt_i);
194 dEta2 += (pt_i * eta_i * eta_i);
195 dPhi2 += (pt_i * phi_i * phi_i);
197 Float_t TauGammaEnFracIn = -99.;
199 TauGammaEnFracIn = sumPt / TauPt;
212 for (
unsigned int i = 0;
i < GammasPtOutSigCone.size(); ++
i) {
213 double pt_i = GammasPtOutSigCone[
i];
214 double phi_i = GammasdPhiOutSigCone[
i];
215 if (GammasdPhiOutSigCone[
i] >
M_PI)
216 phi_i = GammasdPhiOutSigCone[
i] - 2 *
M_PI;
217 else if (GammasdPhiOutSigCone[
i] < -M_PI)
218 phi_i = GammasdPhiOutSigCone[
i] + 2 *
M_PI;
219 double eta_i = GammasdEtaOutSigCone[
i];
221 sumPt2 += (pt_i * pt_i);
222 dEta2 += (pt_i * eta_i * eta_i);
223 dPhi2 += (pt_i * phi_i * phi_i);
225 Float_t TauGammaEnFracOut = sumPt / TauPt;
234 TauEtaAtEcalEntrance,
236 TauLeadChargedPFCandPt,
237 TauLeadChargedPFCandEtaAtEcalEntrance,
239 TauLeadPFChargedHadrHoP,
240 TauLeadPFChargedHadrEoP,
245 TauSignalPFGammaCandsIn,
246 TauSignalPFGammaCandsOut,
267 ElecMvaInSigmaEtaEta,
273 Float_t TauEtaAtEcalEntrance,
275 Float_t TauLeadChargedPFCandPt,
276 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
277 Float_t TauEmFraction,
278 Float_t TauLeadPFChargedHadrHoP,
279 Float_t TauLeadPFChargedHadrEoP,
280 Float_t TauVisMassIn,
281 Float_t TaudCrackEta,
282 Float_t TaudCrackPhi,
284 Int_t TauSignalPFGammaCandsIn,
285 Int_t TauSignalPFGammaCandsOut,
286 Float_t TauGammaEtaMomIn,
287 Float_t TauGammaEtaMomOut,
288 Float_t TauGammaPhiMomIn,
289 Float_t TauGammaPhiMomOut,
290 Float_t TauGammaEnFracIn,
291 Float_t TauGammaEnFracOut,
294 Float_t ElecEtotOverPin,
295 Float_t ElecChi2NormGSF,
296 Float_t ElecChi2NormKF,
297 Float_t ElecGSFNumHits,
298 Float_t ElecKFNumHits,
299 Float_t ElecGSFTrackResol,
300 Float_t ElecGSFTracklnPt,
304 Float_t ElecDeltaEta,
305 Float_t ElecDeltaPhi,
306 Float_t ElecMvaInSigmaEtaEta,
307 Float_t ElecMvaInHadEnergy,
308 Float_t ElecMvaInDeltaEta) {
310 throw cms::Exception(
"ClassNotInitialized") <<
" AntiElectronMVA not properly initialized !!\n";
313 double mvaValue = -99.;
315 const float ECALBarrelEndcapEtaBorder = 1.479;
316 float ElecDeltaPinPoutOverPin = (ElecPin > 0.0) ? (
std::abs(ElecPin - ElecPout) / ElecPin) : 1.0;
317 float ElecEecalOverPout = (ElecPout > 0.0) ? (ElecEecal / ElecPout) : 20.0;
318 float ElecNumHitsDiffOverSum = ((ElecGSFNumHits + ElecKFNumHits) > 0.0)
319 ? ((ElecGSFNumHits - ElecKFNumHits) / (ElecGSFNumHits + ElecKFNumHits))
322 if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn == 0 && TauHasGsf < 0.5) {
323 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
347 }
else if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn > 0 &&
349 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
389 }
else if (TauSignalPFGammaCandsIn == 0 && TauHasGsf > 0.5) {
390 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
442 }
else if (TauSignalPFGammaCandsIn > 0 && TauHasGsf > 0.5) {
443 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
519 float TauEtaAtEcalEntrance = -99.;
520 float sumEtaTimesEnergy = 0.;
521 float sumEnergy = 0.;
522 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
523 for (
const auto& pfCandidate : signalPFCands) {
524 sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta() * pfCandidate->energy();
525 sumEnergy += pfCandidate->energy();
527 if (sumEnergy > 0.) {
528 TauEtaAtEcalEntrance = sumEtaTimesEnergy / sumEnergy;
531 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
532 float TauLeadChargedPFCandPt = -99.;
533 for (
const auto& pfCandidate : signalPFCands) {
535 if (pfCandidate->trackRef().isNonnull())
536 track = pfCandidate->trackRef().get();
537 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull())
538 track = pfCandidate->muonRef()->innerTrack().get();
539 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull())
540 track = pfCandidate->muonRef()->globalTrack().get();
541 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull())
542 track = pfCandidate->muonRef()->outerTrack().get();
543 else if (pfCandidate->gsfTrackRef().isNonnull())
544 track = pfCandidate->gsfTrackRef().get();
546 if (track->
pt() > TauLeadChargedPFCandPt) {
547 TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().
eta();
548 TauLeadChargedPFCandPt = track->
pt();
553 Float_t TauPt = thePFTau.
pt();
555 Float_t TauLeadPFChargedHadrHoP = 0.;
556 Float_t TauLeadPFChargedHadrEoP = 0.;
562 std::vector<Float_t> GammasdEtaInSigCone;
563 std::vector<Float_t> GammasdPhiInSigCone;
564 std::vector<Float_t> GammasPtInSigCone;
565 std::vector<Float_t> GammasdEtaOutSigCone;
566 std::vector<Float_t> GammasdPhiOutSigCone;
567 std::vector<Float_t> GammasPtOutSigCone;
576 if (dR < signalrad) {
581 GammasdEtaInSigCone.push_back(
gamma->eta() - thePFTau.
eta());
582 GammasdPhiInSigCone.push_back(
gamma->phi() - thePFTau.
phi());
584 GammasPtInSigCone.push_back(
gamma->pt());
585 pfGammaSum +=
gamma->p4();
593 GammasdEtaOutSigCone.push_back(
gamma->eta() - thePFTau.
eta());
594 GammasdPhiOutSigCone.push_back(
gamma->phi() - thePFTau.
phi());
596 GammasPtOutSigCone.push_back(
gamma->pt());
605 if (dR < signalrad) {
606 pfChargedSum += charged->p4();
610 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
611 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
612 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
614 Float_t TauPhi = thePFTau.
phi();
615 float sumPhiTimesEnergy = 0.;
616 float sumEnergyPhi = 0.;
618 for (
const auto& pfc : signalPFCands) {
619 sumPhiTimesEnergy += pfc->positionAtECALEntrance().phi() * pfc->energy();
620 sumEnergyPhi += pfc->energy();
624 for (
const auto& signalPFCand : signalPFCands) {
626 float phi = thePFTau.
phi();
630 sumPhiTimesEnergy += phi * signalCand->
energy();
631 sumEnergy += signalCand->
energy();
634 if (sumEnergyPhi > 0.) {
635 TauPhi = sumPhiTimesEnergy / sumEnergyPhi;
637 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
638 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
642 Float_t ElecEta = theGsfEle.
eta();
643 Float_t ElecPhi = theGsfEle.
phi();
647 Float_t ElecEgamma = 0.;
651 pfCluster != pfSuperCluster->clustersEnd();
653 double pfClusterEn = (*pfCluster)->energy();
654 if (pfCluster == pfSuperCluster->clustersBegin())
655 ElecEe += pfClusterEn;
657 ElecEgamma += pfClusterEn;
663 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma) / ElecPin) : -0.1;
667 Float_t ElecMvaInSigmaEtaEta = (theGsfEle).mvaInput().sigmaEtaEta;
668 Float_t ElecMvaInHadEnergy = (theGsfEle).mvaInput().hadEnergy;
669 Float_t ElecMvaInDeltaEta = (theGsfEle).mvaInput().deltaEta;
672 Float_t ElecChi2NormGSF = -99.;
673 Float_t ElecGSFNumHits = -99.;
674 Float_t ElecGSFTrackResol = -99.;
675 Float_t ElecGSFTracklnPt = -99.;
677 ElecChi2NormGSF = (theGsfEle).gsfTrack()->normalizedChi2();
678 ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
679 if (theGsfEle.
gsfTrack()->pt() > 0.) {
680 ElecGSFTrackResol = theGsfEle.
gsfTrack()->ptError() / theGsfEle.
gsfTrack()->pt();
681 ElecGSFTracklnPt =
log(theGsfEle.
gsfTrack()->pt()) * M_LN10;
686 Float_t ElecChi2NormKF = -99.;
687 Float_t ElecKFNumHits = -99.;
689 ElecChi2NormKF = (theGsfEle).closestCtfTrackRef()->normalizedChi2();
690 ElecKFNumHits = (theGsfEle).closestCtfTrackRef()->numberOfValidHits();
694 TauEtaAtEcalEntrance,
696 TauLeadChargedPFCandPt,
697 TauLeadChargedPFCandEtaAtEcalEntrance,
699 TauLeadPFChargedHadrHoP,
700 TauLeadPFChargedHadrEoP,
705 TauSignalPFGammaCandsIn,
706 TauSignalPFGammaCandsOut,
710 GammasdEtaOutSigCone,
711 GammasdPhiOutSigCone,
727 ElecMvaInSigmaEtaEta,
734 float TauEtaAtEcalEntrance = -99.;
735 float sumEtaTimesEnergy = 0.;
736 float sumEnergy = 0.;
737 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
738 for (
const auto& pfCandidate : signalPFCands) {
739 sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta() * pfCandidate->energy();
740 sumEnergy += pfCandidate->energy();
742 if (sumEnergy > 0.) {
743 TauEtaAtEcalEntrance = sumEtaTimesEnergy / sumEnergy;
746 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
747 float TauLeadChargedPFCandPt = -99.;
748 for (
const auto& pfCandidate : signalPFCands) {
750 if (pfCandidate->trackRef().isNonnull())
751 track = pfCandidate->trackRef().get();
752 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull())
753 track = pfCandidate->muonRef()->innerTrack().get();
754 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull())
755 track = pfCandidate->muonRef()->globalTrack().get();
756 else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull())
757 track = pfCandidate->muonRef()->outerTrack().get();
758 else if (pfCandidate->gsfTrackRef().isNonnull())
759 track = pfCandidate->gsfTrackRef().get();
761 if (track->
pt() > TauLeadChargedPFCandPt) {
762 TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().
eta();
763 TauLeadChargedPFCandPt = track->
pt();
768 Float_t TauPt = thePFTau.
pt();
770 Float_t TauLeadPFChargedHadrHoP = 0.;
771 Float_t TauLeadPFChargedHadrEoP = 0.;
777 std::vector<Float_t> GammasdEtaInSigCone;
778 std::vector<Float_t> GammasdPhiInSigCone;
779 std::vector<Float_t> GammasPtInSigCone;
780 std::vector<Float_t> GammasdEtaOutSigCone;
781 std::vector<Float_t> GammasdPhiOutSigCone;
782 std::vector<Float_t> GammasPtOutSigCone;
791 if (dR < signalrad) {
796 GammasdEtaInSigCone.push_back(
gamma->eta() - thePFTau.
eta());
797 GammasdPhiInSigCone.push_back(
gamma->phi() - thePFTau.
phi());
799 GammasPtInSigCone.push_back(
gamma->pt());
800 pfGammaSum +=
gamma->p4();
808 GammasdEtaOutSigCone.push_back(
gamma->eta() - thePFTau.
eta());
809 GammasdPhiOutSigCone.push_back(
gamma->phi() - thePFTau.
phi());
811 GammasPtOutSigCone.push_back(
gamma->pt());
820 if (dR < signalrad) {
821 pfChargedSum += charged->p4();
825 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
826 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
827 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
829 Float_t TauPhi = thePFTau.
phi();
830 float sumPhiTimesEnergy = 0.;
831 float sumEnergyPhi = 0.;
833 for (
const auto& pfCandidate : signalPFCands) {
834 sumPhiTimesEnergy += pfCandidate->positionAtECALEntrance().phi() * pfCandidate->energy();
835 sumEnergyPhi += pfCandidate->energy();
839 for (
const auto& signalPFCand : signalPFCands) {
841 float phi = thePFTau.
phi();
845 sumPhiTimesEnergy += phi * signalCand->
energy();
846 sumEnergy += signalCand->
energy();
849 if (sumEnergyPhi > 0.) {
850 TauPhi = sumPhiTimesEnergy / sumEnergyPhi;
852 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
853 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
857 Float_t dummyElecEta = 9.9;
860 TauEtaAtEcalEntrance,
862 TauLeadChargedPFCandPt,
863 TauLeadChargedPFCandEtaAtEcalEntrance,
865 TauLeadPFChargedHadrHoP,
866 TauLeadPFChargedHadrEoP,
871 TauSignalPFGammaCandsIn,
872 TauSignalPFGammaCandsOut,
876 GammasdEtaOutSigCone,
877 GammasdPhiOutSigCone,
905 Float_t TauPt = theTau.
pt();
908 Float_t TauLeadPFChargedHadrHoP = 0.;
909 Float_t TauLeadPFChargedHadrEoP = 0.;
915 std::vector<Float_t> GammasdEtaInSigCone;
916 std::vector<Float_t> GammasdPhiInSigCone;
917 std::vector<Float_t> GammasPtInSigCone;
918 std::vector<Float_t> GammasdEtaOutSigCone;
919 std::vector<Float_t> GammasdPhiOutSigCone;
920 std::vector<Float_t> GammasPtOutSigCone;
925 for (
const auto&
gamma : signalGammaCands) {
930 if (dR < signalrad) {
937 GammasdEtaInSigCone.push_back(
gamma->eta() - theTau.
eta());
938 GammasdPhiInSigCone.push_back(
gamma->phi() - theTau.
phi());
942 GammasPtInSigCone.push_back(
gamma->pt());
943 pfGammaSum +=
gamma->p4();
953 GammasdEtaOutSigCone.push_back(
gamma->eta() - theTau.
eta());
954 GammasdPhiOutSigCone.push_back(
gamma->phi() - theTau.
phi());
958 GammasPtOutSigCone.push_back(
gamma->pt());
963 for (
const auto& charged : signalChargedCands) {
968 if (dR < signalrad) {
969 pfChargedSum += charged->p4();
973 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
974 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
975 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
976 Float_t TauPhi = -99.;
978 float sumPhiTimesEnergy = 0.;
979 float sumEnergy = 0.;
981 for (
const auto& signalCandPtr : signalCands) {
987 sumPhiTimesEnergy += phi * signalCand->
energy();
988 sumEnergy += signalCand->
energy();
990 if (sumEnergy > 0.) {
991 TauPhi = sumPhiTimesEnergy / sumEnergy;
997 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
998 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1000 Float_t TauHasGsf = 0;
1003 if (
abs(packedLeadTauCand->
pdgId()) == 11)
1007 Float_t ElecEta = theEle.
eta();
1008 Float_t ElecPhi = theEle.
phi();
1011 Float_t ElecEe = 0.;
1012 Float_t ElecEgamma = 0.;
1016 pfCluster != pfSuperCluster->clustersEnd();
1018 double pfClusterEn = (*pfCluster)->energy();
1019 if (pfCluster == pfSuperCluster->clustersBegin())
1020 ElecEe += pfClusterEn;
1022 ElecEgamma += pfClusterEn;
1028 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma) / ElecPin) : -0.1;
1032 Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
1033 Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
1034 Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
1037 Float_t ElecChi2NormGSF = -99.;
1038 Float_t ElecGSFNumHits = -99.;
1039 Float_t ElecGSFTrackResol = -99.;
1040 Float_t ElecGSFTracklnPt = -99.;
1042 ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
1043 ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1044 if (theEle.
gsfTrack()->pt() > 0.) {
1045 ElecGSFTrackResol = theEle.
gsfTrack()->ptError() / theEle.
gsfTrack()->pt();
1046 ElecGSFTracklnPt =
log(theEle.
gsfTrack()->pt()) * M_LN10;
1051 Float_t ElecChi2NormKF = -99.;
1052 Float_t ElecKFNumHits = -99.;
1054 ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1055 ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1059 TauEtaAtEcalEntrance,
1061 TauLeadChargedPFCandPt,
1062 TauLeadChargedPFCandEtaAtEcalEntrance,
1064 TauLeadPFChargedHadrHoP,
1065 TauLeadPFChargedHadrEoP,
1070 TauSignalPFGammaCandsIn,
1071 TauSignalPFGammaCandsOut,
1072 GammasdEtaInSigCone,
1073 GammasdPhiInSigCone,
1075 GammasdEtaOutSigCone,
1076 GammasdPhiOutSigCone,
1092 ElecMvaInSigmaEtaEta,
1104 Float_t TauPt = theTau.
pt();
1107 Float_t TauLeadPFChargedHadrHoP = 0.;
1108 Float_t TauLeadPFChargedHadrEoP = 0.;
1114 std::vector<Float_t> GammasdEtaInSigCone;
1115 std::vector<Float_t> GammasdPhiInSigCone;
1116 std::vector<Float_t> GammasPtInSigCone;
1117 std::vector<Float_t> GammasdEtaOutSigCone;
1118 std::vector<Float_t> GammasdPhiOutSigCone;
1119 std::vector<Float_t> GammasPtOutSigCone;
1124 for (
const auto&
gamma : signalGammaCands) {
1129 if (dR < signalrad) {
1134 GammasdEtaInSigCone.push_back(
gamma->eta() - theTau.
eta());
1135 GammasdPhiInSigCone.push_back(
gamma->phi() - theTau.
phi());
1137 GammasPtInSigCone.push_back(
gamma->pt());
1138 pfGammaSum +=
gamma->p4();
1146 GammasdEtaOutSigCone.push_back(
gamma->eta() - theTau.
eta());
1147 GammasdPhiOutSigCone.push_back(
gamma->phi() - theTau.
phi());
1149 GammasPtOutSigCone.push_back(
gamma->pt());
1154 for (
const auto& charged : signalChargedCands) {
1159 if (dR < signalrad) {
1160 pfChargedSum += charged->p4();
1164 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
1165 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
1166 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
1167 Float_t TauPhi = -99.;
1169 float sumPhiTimesEnergy = 0.;
1170 float sumEnergy = 0.;
1172 for (
const auto& signalCandPtr : signalCands) {
1174 float phi = theTau.
phi();
1178 sumPhiTimesEnergy += phi * signalCand->
energy();
1179 sumEnergy += signalCand->
energy();
1181 if (sumEnergy > 0.) {
1182 TauPhi = sumPhiTimesEnergy / sumEnergy;
1188 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1189 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1191 Float_t TauHasGsf = 0;
1195 if (
abs(packedLeadTauCand->
pdgId()) == 11)
1199 Float_t dummyElecEta = 9.9;
1202 TauEtaAtEcalEntrance,
1204 TauLeadChargedPFCandPt,
1205 TauLeadChargedPFCandEtaAtEcalEntrance,
1207 TauLeadPFChargedHadrHoP,
1208 TauLeadPFChargedHadrEoP,
1213 TauSignalPFGammaCandsIn,
1214 TauSignalPFGammaCandsOut,
1215 GammasdEtaInSigCone,
1216 GammasdPhiInSigCone,
1218 GammasdEtaOutSigCone,
1219 GammasdPhiOutSigCone,
1250 std::array<double, 18> fill_cPhi() {
1252 std::array<double, 18> cPhi;
1255 for (
unsigned iCrack = 1; iCrack <= 17; ++iCrack) {
1256 cPhi[iCrack] = cPhi[0] - 2. * iCrack * pi / 18;
1261 const std::array<double, 18> cPhi = fill_cPhi();
1273 double retVal = 99.;
1275 if (eta >= -1.47464 && eta <= 1.47464) {
1286 if (phi >= -pi && phi <= pi) {
1288 if (phi < cPhi[17] || phi >= cPhi[0]) {
1291 retVal =
minimum(phi - cPhi[0], phi - cPhi[17] - 2. * pi);
1295 unsigned iCrack = 16;
1297 if (phi < cPhi[iCrack]) {
1298 retVal =
minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1319 double cracks[5] = {0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00};
1321 double retVal = 99.;
1323 for (
int iCrack = 0; iCrack < 5; ++iCrack) {
1324 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_
virtual double pz() const =0
z coordinate of momentum vector
std::string mvaName_NoEleMatch_woGwoGSF_BL_
virtual TrackRef closestCtfTrackRef() const
bool isNonnull() const
Checks for non-null.
bool atECalEntrance(const reco::Candidate *part, math::XYZPoint &pos)
double eta() const final
momentum pseudorapidity
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
Global3DPoint GlobalPoint
Float_t * Var_woGwGSF_Barrel_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
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_
RawParticle const & particle() const
The particle being propagated.
Float_t * Var_wGwGSF_Barrel_
void beginEvent(const edm::Event &, const edm::EventSetup &)
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
reco::CandidatePtrVector signalGammaCands() const
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< TFile * > inputFilesToDelete_
virtual double energy() const =0
energy
virtual double py() const =0
y coordinate of momentum vector
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_
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
bool propagateToEcalEntrance(bool first=true)
bool isNonnull() const
Checks for non-null.
float ptLeadChargedCand() const
return pt from LeadChargedCand
const XYZTLorentzVector & vertex() const
the vertex fourvector
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)
XYZPointD XYZPoint
point in space with cartesian internal representation
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
virtual int charge() const =0
electric charge
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
virtual const Point & vertex() const =0
vertex position
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.
virtual double px() const =0
x coordinate of momentum vector
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_