19 : isInitialized_(
false),
20 mva_NoEleMatch_woGwoGSF_BL_(nullptr),
21 mva_NoEleMatch_wGwoGSF_BL_(nullptr),
22 mva_woGwGSF_BL_(nullptr),
23 mva_wGwGSF_BL_(nullptr),
24 mva_NoEleMatch_woGwoGSF_EC_(nullptr),
25 mva_NoEleMatch_wGwoGSF_EC_(nullptr),
26 mva_woGwGSF_EC_(nullptr),
27 mva_wGwGSF_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 "
100 return mva.product();
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() {
1252 constexpr
double pi =
M_PI;
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();
1269 constexpr
double pi =
M_PI;
1272 constexpr
double delta_cPhi = 0.00638;
1274 double retVal = 99.;
1276 if (
eta >= -1.47464 &&
eta <= 1.47464) {
1289 if (
phi < cPhi[17] ||
phi >= cPhi[0]) {
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) {