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);
645 Float_t ElecEta = theGsfEle.
eta();
646 Float_t ElecPhi = theGsfEle.
phi();
650 Float_t ElecEgamma = 0.;
654 pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
655 double pfClusterEn = (*pfCluster)->energy();
656 if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
657 else 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,
735 float TauEtaAtEcalEntrance = -99.;
736 float sumEtaTimesEnergy = 0.;
737 float sumEnergy = 0.;
738 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
739 for (
const auto & pfCandidate : signalPFCands ) {
740 sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta()*pfCandidate->energy();
741 sumEnergy += pfCandidate->energy();
743 if ( sumEnergy > 0. ) {
744 TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
747 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
748 float TauLeadChargedPFCandPt = -99.;
749 for (
const auto & pfCandidate : signalPFCands ) {
751 if ( pfCandidate->trackRef().isNonnull() ) track = pfCandidate->trackRef().get();
752 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull() ) track = pfCandidate->muonRef()->innerTrack().get();
753 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull() ) track = pfCandidate->muonRef()->globalTrack().get();
754 else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull() ) track = pfCandidate->muonRef()->outerTrack().get();
755 else if ( pfCandidate->gsfTrackRef().isNonnull() ) track = pfCandidate->gsfTrackRef().get();
757 if ( track->
pt() > TauLeadChargedPFCandPt ) {
758 TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().
eta();
759 TauLeadChargedPFCandPt = track->
pt();
764 Float_t TauPt = thePFTau.
pt();
766 Float_t TauLeadPFChargedHadrHoP = 0.;
767 Float_t TauLeadPFChargedHadrEoP = 0.;
773 std::vector<Float_t> GammasdEtaInSigCone;
774 std::vector<Float_t> GammasdPhiInSigCone;
775 std::vector<Float_t> GammasPtInSigCone;
776 std::vector<Float_t> GammasdEtaOutSigCone;
777 std::vector<Float_t> GammasdPhiOutSigCone;
778 std::vector<Float_t> GammasPtOutSigCone;
787 if (dR < signalrad) {
793 GammasdEtaInSigCone.push_back(
gamma->eta() - thePFTau.
eta());
794 GammasdPhiInSigCone.push_back(
gamma->phi() - thePFTau.
phi());
796 GammasPtInSigCone.push_back(
gamma->pt());
797 pfGammaSum +=
gamma->p4();
806 GammasdEtaOutSigCone.push_back(
gamma->eta() - thePFTau.
eta());
807 GammasdPhiOutSigCone.push_back(
gamma->phi() - thePFTau.
phi());
809 GammasPtOutSigCone.push_back(
gamma->pt());
818 if (dR < signalrad) {
819 pfChargedSum += charged->p4();
823 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
824 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
825 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
827 Float_t TauPhi = thePFTau.
phi();
828 float sumPhiTimesEnergy = 0.;
829 float sumEnergyPhi = 0.;
831 for (
const auto & pfCandidate : signalPFCands ) {
832 sumPhiTimesEnergy += pfCandidate->positionAtECALEntrance().phi()*pfCandidate->energy();
833 sumEnergyPhi += pfCandidate->energy();
838 for (
const auto & signalPFCand : signalPFCands ) {
840 float phi = thePFTau.
phi();
843 sumPhiTimesEnergy += phi*signalCand->
energy();
844 sumEnergy += signalCand->
energy();
847 if ( sumEnergyPhi > 0. ) {
848 TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
850 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
851 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
856 Float_t dummyElecEta = 9.9;
859 TauEtaAtEcalEntrance,
861 TauLeadChargedPFCandPt,
862 TauLeadChargedPFCandEtaAtEcalEntrance,
864 TauLeadPFChargedHadrHoP,
865 TauLeadPFChargedHadrEoP,
870 TauSignalPFGammaCandsIn,
871 TauSignalPFGammaCandsOut,
875 GammasdEtaOutSigCone,
876 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) {
938 GammasdEtaInSigCone.push_back(
gamma->eta() - theTau.
eta());
939 GammasdPhiInSigCone.push_back(
gamma->phi() - theTau.
phi());
943 GammasPtInSigCone.push_back(
gamma->pt());
944 pfGammaSum +=
gamma->p4();
955 GammasdEtaOutSigCone.push_back(
gamma->eta() - theTau.
eta());
956 GammasdPhiOutSigCone.push_back(
gamma->phi() - theTau.
phi());
960 GammasPtOutSigCone.push_back(
gamma->pt());
965 for (
const auto & charged : signalChargedCands ) {
970 if (dR < signalrad) {
971 pfChargedSum += charged->p4();
975 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
976 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
977 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
978 Float_t TauPhi = -99.;
980 float sumPhiTimesEnergy = 0.;
981 float sumEnergy = 0.;
983 for (
const auto & signalCandPtr : signalCands ) {
988 sumPhiTimesEnergy += phi*signalCand->
energy();
989 sumEnergy += signalCand->
energy();
991 if ( sumEnergy > 0. ) {
992 TauPhi = sumPhiTimesEnergy/sumEnergy;
999 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1000 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1002 Float_t TauHasGsf = 0;
1004 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) TauHasGsf = 1;
1007 Float_t ElecEta = theEle.
eta();
1008 Float_t ElecPhi = theEle.
phi();
1011 Float_t ElecEe = 0.;
1012 Float_t ElecEgamma = 0.;
1015 for (
reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin(); pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
1016 double pfClusterEn = (*pfCluster)->energy();
1017 if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
1018 else ElecEgamma += pfClusterEn;
1024 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
1028 Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
1029 Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
1030 Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
1033 Float_t ElecChi2NormGSF = -99.;
1034 Float_t ElecGSFNumHits = -99.;
1035 Float_t ElecGSFTrackResol = -99.;
1036 Float_t ElecGSFTracklnPt = -99.;
1038 ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
1039 ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1040 if ( theEle.
gsfTrack()->pt() > 0. ) {
1042 ElecGSFTracklnPt =
log(theEle.
gsfTrack()->pt())*M_LN10;
1047 Float_t ElecChi2NormKF = -99.;
1048 Float_t ElecKFNumHits = -99.;
1050 ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1051 ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1055 TauEtaAtEcalEntrance,
1057 TauLeadChargedPFCandPt,
1058 TauLeadChargedPFCandEtaAtEcalEntrance,
1060 TauLeadPFChargedHadrHoP,
1061 TauLeadPFChargedHadrEoP,
1066 TauSignalPFGammaCandsIn,
1067 TauSignalPFGammaCandsOut,
1068 GammasdEtaInSigCone,
1069 GammasdPhiInSigCone,
1071 GammasdEtaOutSigCone,
1072 GammasdPhiOutSigCone,
1088 ElecMvaInSigmaEtaEta,
1101 Float_t TauPt = theTau.
pt();
1104 Float_t TauLeadPFChargedHadrHoP = 0.;
1105 Float_t TauLeadPFChargedHadrEoP = 0.;
1111 std::vector<Float_t> GammasdEtaInSigCone;
1112 std::vector<Float_t> GammasdPhiInSigCone;
1113 std::vector<Float_t> GammasPtInSigCone;
1114 std::vector<Float_t> GammasdEtaOutSigCone;
1115 std::vector<Float_t> GammasdPhiOutSigCone;
1116 std::vector<Float_t> GammasPtOutSigCone;
1121 for (
const auto &
gamma : signalGammaCands ) {
1126 if (dR < signalrad) {
1132 GammasdEtaInSigCone.push_back(
gamma->eta() - theTau.
eta());
1133 GammasdPhiInSigCone.push_back(
gamma->phi() - theTau.
phi());
1135 GammasPtInSigCone.push_back(
gamma->pt());
1136 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();
1175 if (
atECalEntrance(signalCand, aPos) ==
true ) phi = aPos.Phi();
1176 sumPhiTimesEnergy += phi*signalCand->
energy();
1177 sumEnergy += signalCand->
energy();
1179 if ( sumEnergy > 0. ) {
1180 TauPhi = sumPhiTimesEnergy/sumEnergy;
1187 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1188 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1190 Float_t TauHasGsf = 0;
1193 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) TauHasGsf = 1;
1196 Float_t dummyElecEta = 9.9;
1199 TauEtaAtEcalEntrance,
1201 TauLeadChargedPFCandPt,
1202 TauLeadChargedPFCandEtaAtEcalEntrance,
1204 TauLeadPFChargedHadrHoP,
1205 TauLeadPFChargedHadrEoP,
1210 TauSignalPFGammaCandsIn,
1211 TauSignalPFGammaCandsOut,
1212 GammasdEtaInSigCone,
1213 GammasdPhiInSigCone,
1215 GammasdEtaOutSigCone,
1216 GammasdPhiOutSigCone,
1246 std::array<double,18> fill_cPhi() {
1248 std::array<double,18> cPhi;
1251 for (
unsigned iCrack = 1; iCrack <= 17; ++iCrack ) {
1252 cPhi[iCrack] = cPhi[0] - 2.*iCrack*pi/18;
1257 const std::array<double,18> cPhi = fill_cPhi();
1270 double retVal = 99.;
1272 if ( eta >= -1.47464 && eta <= 1.47464 ) {
1275 if ( eta < 0. ) phi += delta_cPhi;
1278 if ( phi > pi ) phi -= 2.*
pi;
1279 if ( phi < -pi ) phi += 2.*
pi;
1281 if ( phi >= -pi && phi <= pi ) {
1284 if ( phi < cPhi[17] || phi >= cPhi[0] ) {
1285 if ( phi < 0. ) phi += 2.*
pi;
1286 retVal =
minimum(phi - cPhi[0], phi - cPhi[17] - 2.*pi);
1290 unsigned iCrack = 16;
1292 if ( phi < cPhi[iCrack] ) {
1293 retVal =
minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1315 double cracks[5] = { 0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00 };
1317 double retVal = 99.;
1319 for (
int iCrack = 0; iCrack < 5 ; ++iCrack ) {
1320 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_