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),
34 if(cfg.
exists(
"inputFileName")){
36 }
else throw cms::Exception(
"MVA input not defined") <<
"Requested to load tau MVA input from ROOT file but no file provided in cfg file";
98 throw cms::Exception(
"PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
99 <<
" Failed to load MVA = " << mvaName.data() <<
" from file " <<
" !!\n";
148 Float_t TauEtaAtEcalEntrance,
150 Float_t TauLeadChargedPFCandPt,
151 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
152 Float_t TauEmFraction,
153 Float_t TauLeadPFChargedHadrHoP,
154 Float_t TauLeadPFChargedHadrEoP,
155 Float_t TauVisMassIn,
156 Float_t TaudCrackEta,
157 Float_t TaudCrackPhi,
159 Int_t TauSignalPFGammaCandsIn,
160 Int_t TauSignalPFGammaCandsOut,
161 const std::vector<Float_t>& GammasdEtaInSigCone,
162 const std::vector<Float_t>& GammasdPhiInSigCone,
163 const std::vector<Float_t>& GammasPtInSigCone,
164 const std::vector<Float_t>& GammasdEtaOutSigCone,
165 const std::vector<Float_t>& GammasdPhiOutSigCone,
166 const std::vector<Float_t>& GammasPtOutSigCone,
169 Float_t ElecEtotOverPin,
170 Float_t ElecChi2NormGSF,
171 Float_t ElecChi2NormKF,
172 Float_t ElecGSFNumHits,
173 Float_t ElecKFNumHits,
174 Float_t ElecGSFTrackResol,
175 Float_t ElecGSFTracklnPt,
179 Float_t ElecDeltaEta,
180 Float_t ElecDeltaPhi,
181 Float_t ElecMvaInSigmaEtaEta,
182 Float_t ElecMvaInHadEnergy,
183 Float_t ElecMvaInDeltaEta)
189 for (
unsigned int i = 0 ;
i < GammasPtInSigCone.size() ; ++
i ) {
190 double pt_i = GammasPtInSigCone[
i];
191 double phi_i = GammasdPhiInSigCone[
i];
192 if ( GammasdPhiInSigCone[
i] >
M_PI ) phi_i = GammasdPhiInSigCone[
i] - 2*
M_PI;
193 else if ( GammasdPhiInSigCone[
i] < -M_PI ) phi_i = GammasdPhiInSigCone[
i] + 2*
M_PI;
194 double eta_i = GammasdEtaInSigCone[
i];
196 sumPt2 += (pt_i*pt_i);
197 dEta2 += (pt_i*eta_i*eta_i);
198 dPhi2 += (pt_i*phi_i*phi_i);
200 Float_t TauGammaEnFracIn = -99.;
202 TauGammaEnFracIn = sumPt/TauPt;
215 for (
unsigned int i = 0 ;
i < GammasPtOutSigCone.size() ; ++
i ) {
216 double pt_i = GammasPtOutSigCone[
i];
217 double phi_i = GammasdPhiOutSigCone[
i];
218 if ( GammasdPhiOutSigCone[
i] >
M_PI ) phi_i = GammasdPhiOutSigCone[
i] - 2*
M_PI;
219 else if ( GammasdPhiOutSigCone[
i] < -M_PI ) phi_i = GammasdPhiOutSigCone[
i] + 2*
M_PI;
220 double eta_i = GammasdEtaOutSigCone[
i];
222 sumPt2 += (pt_i*pt_i);
223 dEta2 += (pt_i*eta_i*eta_i);
224 dPhi2 += (pt_i*phi_i*phi_i);
226 Float_t TauGammaEnFracOut = sumPt/TauPt;
235 TauEtaAtEcalEntrance,
237 TauLeadChargedPFCandPt,
238 TauLeadChargedPFCandEtaAtEcalEntrance,
240 TauLeadPFChargedHadrHoP,
241 TauLeadPFChargedHadrEoP,
246 TauSignalPFGammaCandsIn,
247 TauSignalPFGammaCandsOut,
268 ElecMvaInSigmaEtaEta,
274 Float_t TauEtaAtEcalEntrance,
276 Float_t TauLeadChargedPFCandPt,
277 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
278 Float_t TauEmFraction,
279 Float_t TauLeadPFChargedHadrHoP,
280 Float_t TauLeadPFChargedHadrEoP,
281 Float_t TauVisMassIn,
282 Float_t TaudCrackEta,
283 Float_t TaudCrackPhi,
285 Int_t TauSignalPFGammaCandsIn,
286 Int_t TauSignalPFGammaCandsOut,
287 Float_t TauGammaEtaMomIn,
288 Float_t TauGammaEtaMomOut,
289 Float_t TauGammaPhiMomIn,
290 Float_t TauGammaPhiMomOut,
291 Float_t TauGammaEnFracIn,
292 Float_t TauGammaEnFracOut,
295 Float_t ElecEtotOverPin,
296 Float_t ElecChi2NormGSF,
297 Float_t ElecChi2NormKF,
298 Float_t ElecGSFNumHits,
299 Float_t ElecKFNumHits,
300 Float_t ElecGSFTrackResol,
301 Float_t ElecGSFTracklnPt,
305 Float_t ElecDeltaEta,
306 Float_t ElecDeltaPhi,
307 Float_t ElecMvaInSigmaEtaEta,
308 Float_t ElecMvaInHadEnergy,
309 Float_t ElecMvaInDeltaEta)
314 <<
" AntiElectronMVA not properly initialized !!\n";
317 double mvaValue = -99.;
319 const float ECALBarrelEndcapEtaBorder = 1.479;
320 float ElecDeltaPinPoutOverPin = (ElecPin > 0.0) ? (
std::abs(ElecPin - ElecPout)/ElecPin) : 1.0;
321 float ElecEecalOverPout = (ElecPout > 0.0) ? (ElecEecal/ElecPout) : 20.0;
322 float ElecNumHitsDiffOverSum = ((ElecGSFNumHits + ElecKFNumHits) > 0.0) ?
323 ((ElecGSFNumHits - ElecKFNumHits)/(ElecGSFNumHits + ElecKFNumHits)) : 1.0;
325 if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn == 0 && TauHasGsf < 0.5) {
326 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
351 else if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn > 0 && TauHasGsf < 0.5 ) {
352 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
393 else if ( TauSignalPFGammaCandsIn == 0 && TauHasGsf > 0.5 ) {
394 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
447 else if ( TauSignalPFGammaCandsIn > 0 && TauHasGsf > 0.5 ) {
448 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
525 float TauEtaAtEcalEntrance = -99.;
526 float sumEtaTimesEnergy = 0.;
527 float sumEnergy = 0.;
528 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
529 for (
const auto & pfCandidate : signalPFCands ) {
530 sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta()*pfCandidate->energy();
531 sumEnergy += pfCandidate->energy();
533 if ( sumEnergy > 0. ) {
534 TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
537 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
538 float TauLeadChargedPFCandPt = -99.;
539 for (
const auto & pfCandidate : signalPFCands ) {
541 if ( pfCandidate->trackRef().isNonnull() ) track = pfCandidate->trackRef().get();
542 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull() ) track = pfCandidate->muonRef()->innerTrack().get();
543 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull() ) track = pfCandidate->muonRef()->globalTrack().get();
544 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull() ) track = pfCandidate->muonRef()->outerTrack().get();
545 else if ( pfCandidate->gsfTrackRef().isNonnull() ) track = pfCandidate->gsfTrackRef().get();
547 if ( track->
pt() > TauLeadChargedPFCandPt ) {
548 TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().
eta();
549 TauLeadChargedPFCandPt = track->
pt();
554 Float_t TauPt = thePFTau.
pt();
556 Float_t TauLeadPFChargedHadrHoP = 0.;
557 Float_t TauLeadPFChargedHadrEoP = 0.;
563 std::vector<Float_t> GammasdEtaInSigCone;
564 std::vector<Float_t> GammasdPhiInSigCone;
565 std::vector<Float_t> GammasPtInSigCone;
566 std::vector<Float_t> GammasdEtaOutSigCone;
567 std::vector<Float_t> GammasdPhiOutSigCone;
568 std::vector<Float_t> GammasPtOutSigCone;
577 if (dR < signalrad) {
583 GammasdEtaInSigCone.push_back(
gamma->eta() - thePFTau.
eta());
584 GammasdPhiInSigCone.push_back(
gamma->phi() - thePFTau.
phi());
586 GammasPtInSigCone.push_back(
gamma->pt());
587 pfGammaSum +=
gamma->p4();
596 GammasdEtaOutSigCone.push_back(
gamma->eta() - thePFTau.
eta());
597 GammasdPhiOutSigCone.push_back(
gamma->phi() - thePFTau.
phi());
599 GammasPtOutSigCone.push_back(
gamma->pt());
608 if (dR < signalrad) {
609 pfChargedSum += charged->p4();
613 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
614 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
615 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
617 Float_t TauPhi = thePFTau.
phi();
618 float sumPhiTimesEnergy = 0.;
619 float sumEnergyPhi = 0.;
621 for (
const auto & pfc : signalPFCands ) {
622 sumPhiTimesEnergy += pfc->positionAtECALEntrance().phi()*pfc->energy();
623 sumEnergyPhi += pfc->energy();
628 for (
const auto & signalPFCand : signalPFCands ) {
630 float phi = thePFTau.
phi();
633 sumPhiTimesEnergy += phi*signalCand->
energy();
634 sumEnergy += signalCand->
energy();
637 if ( sumEnergyPhi > 0. ) {
638 TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
640 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
641 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
646 Float_t ElecEta = theGsfEle.
eta();
647 Float_t ElecPhi = theGsfEle.
phi();
651 Float_t ElecEgamma = 0.;
655 pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
656 double pfClusterEn = (*pfCluster)->energy();
657 if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
658 else ElecEgamma += pfClusterEn;
664 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
668 Float_t ElecMvaInSigmaEtaEta = (theGsfEle).mvaInput().sigmaEtaEta;
669 Float_t ElecMvaInHadEnergy = (theGsfEle).mvaInput().hadEnergy;
670 Float_t ElecMvaInDeltaEta = (theGsfEle).mvaInput().deltaEta;
673 Float_t ElecChi2NormGSF = -99.;
674 Float_t ElecGSFNumHits = -99.;
675 Float_t ElecGSFTrackResol = -99.;
676 Float_t ElecGSFTracklnPt = -99.;
678 ElecChi2NormGSF = (theGsfEle).gsfTrack()->normalizedChi2();
679 ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
680 if ( theGsfEle.
gsfTrack()->pt() > 0. ) {
681 ElecGSFTrackResol = theGsfEle.
gsfTrack()->ptError()/theGsfEle.
gsfTrack()->pt();
682 ElecGSFTracklnPt =
log(theGsfEle.
gsfTrack()->pt())*M_LN10;
687 Float_t ElecChi2NormKF = -99.;
688 Float_t ElecKFNumHits = -99.;
690 ElecChi2NormKF = (theGsfEle).closestCtfTrackRef()->normalizedChi2();
691 ElecKFNumHits = (theGsfEle).closestCtfTrackRef()->numberOfValidHits();
695 TauEtaAtEcalEntrance,
697 TauLeadChargedPFCandPt,
698 TauLeadChargedPFCandEtaAtEcalEntrance,
700 TauLeadPFChargedHadrHoP,
701 TauLeadPFChargedHadrEoP,
706 TauSignalPFGammaCandsIn,
707 TauSignalPFGammaCandsOut,
711 GammasdEtaOutSigCone,
712 GammasdPhiOutSigCone,
728 ElecMvaInSigmaEtaEta,
736 float TauEtaAtEcalEntrance = -99.;
737 float sumEtaTimesEnergy = 0.;
738 float sumEnergy = 0.;
739 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
740 for (
const auto & pfCandidate : signalPFCands ) {
741 sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta()*pfCandidate->energy();
742 sumEnergy += pfCandidate->energy();
744 if ( sumEnergy > 0. ) {
745 TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
748 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
749 float TauLeadChargedPFCandPt = -99.;
750 for (
const auto & pfCandidate : signalPFCands ) {
752 if ( pfCandidate->trackRef().isNonnull() ) track = pfCandidate->trackRef().get();
753 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull() ) track = pfCandidate->muonRef()->innerTrack().get();
754 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull() ) track = pfCandidate->muonRef()->globalTrack().get();
755 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull() ) track = pfCandidate->muonRef()->outerTrack().get();
756 else if ( pfCandidate->gsfTrackRef().isNonnull() ) track = pfCandidate->gsfTrackRef().get();
758 if ( track->
pt() > TauLeadChargedPFCandPt ) {
759 TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().
eta();
760 TauLeadChargedPFCandPt = track->
pt();
765 Float_t TauPt = thePFTau.
pt();
767 Float_t TauLeadPFChargedHadrHoP = 0.;
768 Float_t TauLeadPFChargedHadrEoP = 0.;
774 std::vector<Float_t> GammasdEtaInSigCone;
775 std::vector<Float_t> GammasdPhiInSigCone;
776 std::vector<Float_t> GammasPtInSigCone;
777 std::vector<Float_t> GammasdEtaOutSigCone;
778 std::vector<Float_t> GammasdPhiOutSigCone;
779 std::vector<Float_t> GammasPtOutSigCone;
788 if (dR < signalrad) {
794 GammasdEtaInSigCone.push_back(
gamma->eta() - thePFTau.
eta());
795 GammasdPhiInSigCone.push_back(
gamma->phi() - thePFTau.
phi());
797 GammasPtInSigCone.push_back(
gamma->pt());
798 pfGammaSum +=
gamma->p4();
807 GammasdEtaOutSigCone.push_back(
gamma->eta() - thePFTau.
eta());
808 GammasdPhiOutSigCone.push_back(
gamma->phi() - thePFTau.
phi());
810 GammasPtOutSigCone.push_back(
gamma->pt());
819 if (dR < signalrad) {
820 pfChargedSum += charged->p4();
824 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
825 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
826 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
828 Float_t TauPhi = thePFTau.
phi();
829 float sumPhiTimesEnergy = 0.;
830 float sumEnergyPhi = 0.;
832 for (
const auto & pfCandidate : signalPFCands ) {
833 sumPhiTimesEnergy += pfCandidate->positionAtECALEntrance().phi()*pfCandidate->energy();
834 sumEnergyPhi += pfCandidate->energy();
839 for (
const auto & signalPFCand : signalPFCands ) {
841 float phi = thePFTau.
phi();
844 sumPhiTimesEnergy += phi*signalCand->
energy();
845 sumEnergy += signalCand->
energy();
848 if ( sumEnergyPhi > 0. ) {
849 TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
851 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
852 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,
906 Float_t TauPt = theTau.
pt();
909 Float_t TauLeadPFChargedHadrHoP = 0.;
910 Float_t TauLeadPFChargedHadrEoP = 0.;
916 std::vector<Float_t> GammasdEtaInSigCone;
917 std::vector<Float_t> GammasdPhiInSigCone;
918 std::vector<Float_t> GammasPtInSigCone;
919 std::vector<Float_t> GammasdEtaOutSigCone;
920 std::vector<Float_t> GammasdPhiOutSigCone;
921 std::vector<Float_t> GammasPtOutSigCone;
926 for (
const auto &
gamma : signalGammaCands ) {
931 if (dR < signalrad) {
939 GammasdEtaInSigCone.push_back(
gamma->eta() - theTau.
eta());
940 GammasdPhiInSigCone.push_back(
gamma->phi() - theTau.
phi());
944 GammasPtInSigCone.push_back(
gamma->pt());
945 pfGammaSum +=
gamma->p4();
956 GammasdEtaOutSigCone.push_back(
gamma->eta() - theTau.
eta());
957 GammasdPhiOutSigCone.push_back(
gamma->phi() - theTau.
phi());
961 GammasPtOutSigCone.push_back(
gamma->pt());
966 for (
const auto & charged : signalChargedCands ) {
971 if (dR < signalrad) {
972 pfChargedSum += charged->p4();
976 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
977 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
978 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
979 Float_t TauPhi = -99.;
981 float sumPhiTimesEnergy = 0.;
982 float sumEnergy = 0.;
984 for (
const auto & signalCandPtr : signalCands ) {
989 sumPhiTimesEnergy += phi*signalCand->
energy();
990 sumEnergy += signalCand->
energy();
992 if ( sumEnergy > 0. ) {
993 TauPhi = sumPhiTimesEnergy/sumEnergy;
1000 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1001 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1003 Float_t TauHasGsf = 0;
1005 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) TauHasGsf = 1;
1008 Float_t ElecEta = theEle.
eta();
1009 Float_t ElecPhi = theEle.
phi();
1012 Float_t ElecEe = 0.;
1013 Float_t ElecEgamma = 0.;
1016 for (
reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin(); pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
1017 double pfClusterEn = (*pfCluster)->energy();
1018 if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
1019 else ElecEgamma += pfClusterEn;
1025 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
1029 Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
1030 Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
1031 Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
1034 Float_t ElecChi2NormGSF = -99.;
1035 Float_t ElecGSFNumHits = -99.;
1036 Float_t ElecGSFTrackResol = -99.;
1037 Float_t ElecGSFTracklnPt = -99.;
1039 ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
1040 ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1041 if ( theEle.
gsfTrack()->pt() > 0. ) {
1043 ElecGSFTracklnPt =
log(theEle.
gsfTrack()->pt())*M_LN10;
1048 Float_t ElecChi2NormKF = -99.;
1049 Float_t ElecKFNumHits = -99.;
1051 ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1052 ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1056 TauEtaAtEcalEntrance,
1058 TauLeadChargedPFCandPt,
1059 TauLeadChargedPFCandEtaAtEcalEntrance,
1061 TauLeadPFChargedHadrHoP,
1062 TauLeadPFChargedHadrEoP,
1067 TauSignalPFGammaCandsIn,
1068 TauSignalPFGammaCandsOut,
1069 GammasdEtaInSigCone,
1070 GammasdPhiInSigCone,
1072 GammasdEtaOutSigCone,
1073 GammasdPhiOutSigCone,
1089 ElecMvaInSigmaEtaEta,
1102 Float_t TauPt = theTau.
pt();
1105 Float_t TauLeadPFChargedHadrHoP = 0.;
1106 Float_t TauLeadPFChargedHadrEoP = 0.;
1112 std::vector<Float_t> GammasdEtaInSigCone;
1113 std::vector<Float_t> GammasdPhiInSigCone;
1114 std::vector<Float_t> GammasPtInSigCone;
1115 std::vector<Float_t> GammasdEtaOutSigCone;
1116 std::vector<Float_t> GammasdPhiOutSigCone;
1117 std::vector<Float_t> GammasPtOutSigCone;
1122 for (
const auto &
gamma : signalGammaCands ) {
1127 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();
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();
1176 if (
atECalEntrance(signalCand, aPos) ==
true ) phi = aPos.Phi();
1177 sumPhiTimesEnergy += phi*signalCand->
energy();
1178 sumEnergy += signalCand->
energy();
1180 if ( sumEnergy > 0. ) {
1181 TauPhi = sumPhiTimesEnergy/sumEnergy;
1188 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1189 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1191 Float_t TauHasGsf = 0;
1194 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) TauHasGsf = 1;
1197 Float_t dummyElecEta = 9.9;
1200 TauEtaAtEcalEntrance,
1202 TauLeadChargedPFCandPt,
1203 TauLeadChargedPFCandEtaAtEcalEntrance,
1205 TauLeadPFChargedHadrHoP,
1206 TauLeadPFChargedHadrEoP,
1211 TauSignalPFGammaCandsIn,
1212 TauSignalPFGammaCandsOut,
1213 GammasdEtaInSigCone,
1214 GammasdPhiInSigCone,
1216 GammasdEtaOutSigCone,
1217 GammasdPhiOutSigCone,
1247 std::array<double,18> fill_cPhi() {
1249 std::array<double,18> cPhi;
1252 for (
unsigned iCrack = 1; iCrack <= 17; ++iCrack ) {
1253 cPhi[iCrack] = cPhi[0] - 2.*iCrack*pi/18;
1258 const std::array<double,18> cPhi = fill_cPhi();
1271 double retVal = 99.;
1273 if ( eta >= -1.47464 && eta <= 1.47464 ) {
1276 if ( eta < 0. ) phi += delta_cPhi;
1279 if ( phi > pi ) phi -= 2.*
pi;
1280 if ( phi < -pi ) phi += 2.*
pi;
1282 if ( phi >= -pi && phi <= pi ) {
1285 if ( phi < cPhi[17] || phi >= cPhi[0] ) {
1286 if ( phi < 0. ) phi += 2.*
pi;
1287 retVal =
minimum(phi - cPhi[0], phi - cPhi[17] - 2.*pi);
1291 unsigned iCrack = 16;
1293 if ( phi < cPhi[iCrack] ) {
1294 retVal =
minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1316 double cracks[5] = { 0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00 };
1318 double retVal = 99.;
1320 for (
int iCrack = 0; iCrack < 5 ; ++iCrack ) {
1321 double d =
minimum(eta - cracks[iCrack], eta + cracks[iCrack]);
void setCharge(float q)
set the MEASURED charge
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
const PFCandidatePtr & leadPFChargedHadrCand() const
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
const std::vector< reco::PFCandidatePtr > & signalPFGammaCands() const
Gamma candidates in signal region.
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 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 &)
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
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
math::XYZVectorF trackMomentumOut() const
double pt() const
track transverse momentum
float ecalEnergyLeadChargedHadrCand() const
Abs< T >::type abs(const T &t)
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.
double deltaR(double eta1, double eta2, double phi1, double phi2)
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.
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
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...
const std::vector< reco::PFCandidatePtr > & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_