18 : isInitialized_(
false),
19 mva_NoEleMatch_woGwoGSF_BL_(0),
20 mva_NoEleMatch_wGwoGSF_BL_(0),
23 mva_NoEleMatch_woGwoGSF_EC_(0),
24 mva_NoEleMatch_wGwoGSF_EC_(0),
30 if(cfg.
exists(
"inputFileName")){
32 }
else throw cms::Exception(
"MVA input not defined") <<
"Requested to load tau MVA input from ROOT file but no file provided in cfg file";
91 throw cms::Exception(
"PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
92 <<
" Failed to load MVA = " << mvaName.data() <<
" from file " <<
" !!\n";
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)
178 for (
unsigned int i = 0 ;
i < GammasPtInSigCone.size() ; ++
i ) {
179 double pt_i = GammasPtInSigCone[
i];
180 double phi_i = GammasdPhiInSigCone[
i];
181 if ( GammasdPhiInSigCone[
i] >
M_PI ) phi_i = GammasdPhiInSigCone[
i] - 2*
M_PI;
182 else if ( GammasdPhiInSigCone[
i] < -M_PI ) phi_i = GammasdPhiInSigCone[
i] + 2*
M_PI;
183 double eta_i = GammasdEtaInSigCone[
i];
185 sumPt2 += (pt_i*pt_i);
186 dEta2 += (pt_i*eta_i*eta_i);
187 dPhi2 += (pt_i*phi_i*phi_i);
189 Float_t TauGammaEnFracIn = -99.;
191 TauGammaEnFracIn = sumPt/TauPt;
204 for (
unsigned int i = 0 ;
i < GammasPtOutSigCone.size() ; ++
i ) {
205 double pt_i = GammasPtOutSigCone[
i];
206 double phi_i = GammasdPhiOutSigCone[
i];
207 if ( GammasdPhiOutSigCone[
i] >
M_PI ) phi_i = GammasdPhiOutSigCone[
i] - 2*
M_PI;
208 else if ( GammasdPhiOutSigCone[
i] < -M_PI ) phi_i = GammasdPhiOutSigCone[
i] + 2*
M_PI;
209 double eta_i = GammasdEtaOutSigCone[
i];
211 sumPt2 += (pt_i*pt_i);
212 dEta2 += (pt_i*eta_i*eta_i);
213 dPhi2 += (pt_i*phi_i*phi_i);
215 Float_t TauGammaEnFracOut = sumPt/TauPt;
224 TauEtaAtEcalEntrance,
226 TauLeadChargedPFCandPt,
227 TauLeadChargedPFCandEtaAtEcalEntrance,
229 TauLeadPFChargedHadrHoP,
230 TauLeadPFChargedHadrEoP,
235 TauSignalPFGammaCandsIn,
236 TauSignalPFGammaCandsOut,
257 ElecMvaInSigmaEtaEta,
263 Float_t TauEtaAtEcalEntrance,
265 Float_t TauLeadChargedPFCandPt,
266 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
267 Float_t TauEmFraction,
268 Float_t TauLeadPFChargedHadrHoP,
269 Float_t TauLeadPFChargedHadrEoP,
270 Float_t TauVisMassIn,
271 Float_t TaudCrackEta,
272 Float_t TaudCrackPhi,
274 Int_t TauSignalPFGammaCandsIn,
275 Int_t TauSignalPFGammaCandsOut,
276 Float_t TauGammaEtaMomIn,
277 Float_t TauGammaEtaMomOut,
278 Float_t TauGammaPhiMomIn,
279 Float_t TauGammaPhiMomOut,
280 Float_t TauGammaEnFracIn,
281 Float_t TauGammaEnFracOut,
284 Float_t ElecEtotOverPin,
285 Float_t ElecChi2NormGSF,
286 Float_t ElecChi2NormKF,
287 Float_t ElecGSFNumHits,
288 Float_t ElecKFNumHits,
289 Float_t ElecGSFTrackResol,
290 Float_t ElecGSFTracklnPt,
294 Float_t ElecDeltaEta,
295 Float_t ElecDeltaPhi,
296 Float_t ElecMvaInSigmaEtaEta,
297 Float_t ElecMvaInHadEnergy,
298 Float_t ElecMvaInDeltaEta)
303 <<
" 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)) : 1.0;
314 if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn == 0 && TauHasGsf < 0.5) {
315 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
340 else if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn > 0 && TauHasGsf < 0.5 ) {
341 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
382 else if ( TauSignalPFGammaCandsIn == 0 && TauHasGsf > 0.5 ) {
383 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
436 else if ( TauSignalPFGammaCandsIn > 0 && TauHasGsf > 0.5 ) {
437 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
514 float TauEtaAtEcalEntrance = -99.;
515 float sumEtaTimesEnergy = 0.;
516 float sumEnergy = 0.;
517 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
518 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
519 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
520 sumEtaTimesEnergy += (*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy();
521 sumEnergy += (*pfCandidate)->energy();
523 if ( sumEnergy > 0. ) {
524 TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
527 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
528 float TauLeadChargedPFCandPt = -99.;
529 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
530 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
532 if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
533 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
534 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
535 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
536 else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
538 if ( track->
pt() > TauLeadChargedPFCandPt ) {
539 TauLeadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().
eta();
540 TauLeadChargedPFCandPt = track->
pt();
545 Float_t TauPt = thePFTau.
pt();
547 Float_t TauLeadPFChargedHadrHoP = 0.;
548 Float_t TauLeadPFChargedHadrEoP = 0.;
554 std::vector<Float_t> GammasdEtaInSigCone;
555 std::vector<Float_t> GammasdPhiInSigCone;
556 std::vector<Float_t> GammasPtInSigCone;
557 std::vector<Float_t> GammasdEtaOutSigCone;
558 std::vector<Float_t> GammasdPhiOutSigCone;
559 std::vector<Float_t> GammasPtOutSigCone;
569 if (dR < signalrad) {
575 GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.
eta());
576 GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.
phi());
578 GammasPtInSigCone.push_back(gamma->pt());
579 pfGammaSum += gamma->p4();
588 GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.
eta());
589 GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.
phi());
591 GammasPtOutSigCone.push_back(gamma->pt());
601 if (dR < signalrad) {
602 pfChargedSum += charged->p4();
606 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
607 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
608 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
610 Float_t TauPhi = thePFTau.
phi();
611 float sumPhiTimesEnergy = 0.;
612 float sumEnergyPhi = 0.;
613 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
614 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
615 sumPhiTimesEnergy += (*pfCandidate)->positionAtECALEntrance().phi()*(*pfCandidate)->energy();
616 sumEnergyPhi += (*pfCandidate)->energy();
618 if ( sumEnergyPhi > 0. ) {
619 TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
621 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
622 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
627 Float_t ElecEta = theGsfEle.
eta();
628 Float_t ElecPhi = theGsfEle.
phi();
632 Float_t ElecEgamma = 0.;
636 pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
637 double pfClusterEn = (*pfCluster)->energy();
638 if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
639 else ElecEgamma += pfClusterEn;
645 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
649 Float_t ElecMvaInSigmaEtaEta = (theGsfEle).mvaInput().sigmaEtaEta;
650 Float_t ElecMvaInHadEnergy = (theGsfEle).mvaInput().hadEnergy;
651 Float_t ElecMvaInDeltaEta = (theGsfEle).mvaInput().deltaEta;
654 Float_t ElecChi2NormGSF = -99.;
655 Float_t ElecGSFNumHits = -99.;
656 Float_t ElecGSFTrackResol = -99.;
657 Float_t ElecGSFTracklnPt = -99.;
659 ElecChi2NormGSF = (theGsfEle).gsfTrack()->normalizedChi2();
660 ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
661 if ( theGsfEle.
gsfTrack()->pt() > 0. ) {
662 ElecGSFTrackResol = theGsfEle.
gsfTrack()->ptError()/theGsfEle.
gsfTrack()->pt();
663 ElecGSFTracklnPt =
log(theGsfEle.
gsfTrack()->pt())*M_LN10;
668 Float_t ElecChi2NormKF = -99.;
669 Float_t ElecKFNumHits = -99.;
671 ElecChi2NormKF = (theGsfEle).closestCtfTrackRef()->normalizedChi2();
672 ElecKFNumHits = (theGsfEle).closestCtfTrackRef()->numberOfValidHits();
676 TauEtaAtEcalEntrance,
678 TauLeadChargedPFCandPt,
679 TauLeadChargedPFCandEtaAtEcalEntrance,
681 TauLeadPFChargedHadrHoP,
682 TauLeadPFChargedHadrEoP,
687 TauSignalPFGammaCandsIn,
688 TauSignalPFGammaCandsOut,
692 GammasdEtaOutSigCone,
693 GammasdPhiOutSigCone,
709 ElecMvaInSigmaEtaEta,
717 float TauEtaAtEcalEntrance = -99.;
718 float sumEtaTimesEnergy = 0.;
719 float sumEnergy = 0.;
720 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
721 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
722 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
723 sumEtaTimesEnergy += (*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy();
724 sumEnergy += (*pfCandidate)->energy();
726 if ( sumEnergy > 0. ) {
727 TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
730 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
731 float TauLeadChargedPFCandPt = -99.;
732 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
733 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
735 if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
736 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
737 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
738 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
739 else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
741 if ( track->
pt() > TauLeadChargedPFCandPt ) {
742 TauLeadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().
eta();
743 TauLeadChargedPFCandPt = track->
pt();
748 Float_t TauPt = thePFTau.
pt();
750 Float_t TauLeadPFChargedHadrHoP = 0.;
751 Float_t TauLeadPFChargedHadrEoP = 0.;
757 std::vector<Float_t> GammasdEtaInSigCone;
758 std::vector<Float_t> GammasdPhiInSigCone;
759 std::vector<Float_t> GammasPtInSigCone;
760 std::vector<Float_t> GammasdEtaOutSigCone;
761 std::vector<Float_t> GammasdPhiOutSigCone;
762 std::vector<Float_t> GammasPtOutSigCone;
772 if (dR < signalrad) {
778 GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.
eta());
779 GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.
phi());
781 GammasPtInSigCone.push_back(gamma->pt());
782 pfGammaSum += gamma->p4();
791 GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.
eta());
792 GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.
phi());
794 GammasPtOutSigCone.push_back(gamma->pt());
804 if (dR < signalrad) {
805 pfChargedSum += charged->p4();
809 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
810 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
811 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
813 Float_t TauPhi = thePFTau.
phi();
814 float sumPhiTimesEnergy = 0.;
815 float sumEnergyPhi = 0.;
816 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
817 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
818 sumPhiTimesEnergy += (*pfCandidate)->positionAtECALEntrance().phi()*(*pfCandidate)->energy();
819 sumEnergyPhi += (*pfCandidate)->energy();
821 if ( sumEnergyPhi > 0. ) {
822 TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
824 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
825 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
830 Float_t dummyElecEta = 9.9;
833 TauEtaAtEcalEntrance,
835 TauLeadChargedPFCandPt,
836 TauLeadChargedPFCandEtaAtEcalEntrance,
838 TauLeadPFChargedHadrHoP,
839 TauLeadPFChargedHadrEoP,
844 TauSignalPFGammaCandsIn,
845 TauSignalPFGammaCandsOut,
849 GammasdEtaOutSigCone,
850 GammasdPhiOutSigCone,
879 Float_t TauPt = theTau.
pt();
882 Float_t TauLeadPFChargedHadrHoP = 0.;
883 Float_t TauLeadPFChargedHadrEoP = 0.;
889 std::vector<Float_t> GammasdEtaInSigCone;
890 std::vector<Float_t> GammasdPhiInSigCone;
891 std::vector<Float_t> GammasPtInSigCone;
892 std::vector<Float_t> GammasdEtaOutSigCone;
893 std::vector<Float_t> GammasdPhiOutSigCone;
894 std::vector<Float_t> GammasPtOutSigCone;
904 if (dR < signalrad) {
912 GammasdEtaInSigCone.push_back((*gamma)->eta() - theTau.
eta());
913 GammasdPhiInSigCone.push_back((*gamma)->phi() - theTau.
phi());
917 GammasPtInSigCone.push_back((*gamma)->pt());
918 pfGammaSum += (*gamma)->p4();
929 GammasdEtaOutSigCone.push_back((*gamma)->eta() - theTau.
eta());
930 GammasdPhiOutSigCone.push_back((*gamma)->phi() - theTau.
phi());
934 GammasPtOutSigCone.push_back((*gamma)->pt());
944 if (dR < signalrad) {
945 pfChargedSum += (*charged)->p4();
949 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
950 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
951 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
953 Float_t TauPhi = theTau.
phi();
958 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
959 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
961 Float_t TauHasGsf = 0;
964 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) TauHasGsf = 1;
967 Float_t ElecEta = theEle.
eta();
968 Float_t ElecPhi = theEle.
phi();
972 Float_t ElecEgamma = 0.;
975 for (
reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin(); pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
976 double pfClusterEn = (*pfCluster)->energy();
977 if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
978 else ElecEgamma += pfClusterEn;
984 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
988 Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
989 Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
990 Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
993 Float_t ElecChi2NormGSF = -99.;
994 Float_t ElecGSFNumHits = -99.;
995 Float_t ElecGSFTrackResol = -99.;
996 Float_t ElecGSFTracklnPt = -99.;
998 ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
999 ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1000 if ( theEle.
gsfTrack()->pt() > 0. ) {
1002 ElecGSFTracklnPt =
log(theEle.
gsfTrack()->pt())*M_LN10;
1007 Float_t ElecChi2NormKF = -99.;
1008 Float_t ElecKFNumHits = -99.;
1010 ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1011 ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1015 TauEtaAtEcalEntrance,
1017 TauLeadChargedPFCandPt,
1018 TauLeadChargedPFCandEtaAtEcalEntrance,
1020 TauLeadPFChargedHadrHoP,
1021 TauLeadPFChargedHadrEoP,
1026 TauSignalPFGammaCandsIn,
1027 TauSignalPFGammaCandsOut,
1028 GammasdEtaInSigCone,
1029 GammasdPhiInSigCone,
1031 GammasdEtaOutSigCone,
1032 GammasdPhiOutSigCone,
1048 ElecMvaInSigmaEtaEta,
1061 Float_t TauPt = theTau.
pt();
1064 Float_t TauLeadPFChargedHadrHoP = 0.;
1065 Float_t TauLeadPFChargedHadrEoP = 0.;
1071 std::vector<Float_t> GammasdEtaInSigCone;
1072 std::vector<Float_t> GammasdPhiInSigCone;
1073 std::vector<Float_t> GammasPtInSigCone;
1074 std::vector<Float_t> GammasdEtaOutSigCone;
1075 std::vector<Float_t> GammasdPhiOutSigCone;
1076 std::vector<Float_t> GammasPtOutSigCone;
1086 if (dR < signalrad) {
1092 GammasdEtaInSigCone.push_back((*gamma)->eta() - theTau.
eta());
1093 GammasdPhiInSigCone.push_back((*gamma)->phi() - theTau.
phi());
1095 GammasPtInSigCone.push_back((*gamma)->pt());
1096 pfGammaSum += (*gamma)->p4();
1105 GammasdEtaOutSigCone.push_back((*gamma)->eta() - theTau.
eta());
1106 GammasdPhiOutSigCone.push_back((*gamma)->phi() - theTau.
phi());
1108 GammasPtOutSigCone.push_back((*gamma)->pt());
1118 if (dR < signalrad) {
1119 pfChargedSum += (*charged)->p4();
1123 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
1124 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
1125 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
1127 Float_t TauPhi = theTau.
phi();
1132 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1133 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1135 Float_t TauHasGsf = 0;
1138 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) TauHasGsf = 1;
1141 Float_t dummyElecEta = 9.9;
1144 TauEtaAtEcalEntrance,
1146 TauLeadChargedPFCandPt,
1147 TauLeadChargedPFCandEtaAtEcalEntrance,
1149 TauLeadPFChargedHadrHoP,
1150 TauLeadPFChargedHadrEoP,
1155 TauSignalPFGammaCandsIn,
1156 TauSignalPFGammaCandsOut,
1157 GammasdEtaInSigCone,
1158 GammasdPhiInSigCone,
1160 GammasdEtaOutSigCone,
1161 GammasdPhiOutSigCone,
1191 std::array<double,18> fill_cPhi() {
1193 std::array<double,18> cPhi;
1196 for (
unsigned iCrack = 1; iCrack <= 17; ++iCrack )
1197 cPhi[iCrack] = cPhi[0] - 2.*iCrack*pi/18;
1201 static const std::array<double,18> cPhi = fill_cPhi();
1214 double retVal = 99.;
1216 if ( eta >= -1.47464 && eta <= 1.47464 ) {
1219 if ( eta < 0. ) phi += delta_cPhi;
1222 if ( phi > pi ) phi -= 2.*
pi;
1223 if ( phi < -pi ) phi += 2.*
pi;
1225 if ( phi >= -pi && phi <= pi ) {
1228 if ( phi < cPhi[17] || phi >= cPhi[0] ) {
1229 if ( phi < 0. ) phi += 2.*
pi;
1230 retVal =
minimum(phi - cPhi[0], phi - cPhi[17] - 2.*pi);
1234 unsigned iCrack = 16;
1236 if ( phi < cPhi[iCrack] ) {
1237 retVal =
minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1259 double cracks[5] = { 0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00 };
1261 double retVal = 99.;
1263 for (
int iCrack = 0; iCrack < 5 ; ++iCrack ) {
1264 double d =
minimum(eta - cracks[iCrack], eta + cracks[iCrack]);
T getParameter(std::string const &) const
double minimum(double a, double b)
std::string mvaName_woGwGSF_BL_
std::string mvaName_NoEleMatch_woGwoGSF_BL_
bool isNonnull() const
Checks for non-null.
const PFCandidatePtr & leadPFChargedHadrCand() const
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.
Float_t * Var_woGwGSF_Barrel_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
virtual double phi() const final
momentum azimuthal angle
double dCrackPhi(double phi, double eta)
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
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
TrackRef closestCtfTrackRef() const
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
const_iterator begin() const
std::vector< TFile * > inputFilesToDelete_
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
const GBRForest * mva_woGwGSF_EC_
double eta() const
pseudorapidity of momentum vector
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
reco::TrackRef closestCtfTrackRef() const
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
float deltaPhiSeedClusterTrackAtCalo() const
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
math::XYZVectorF trackMomentumOut() const
double pt() const
track transverse momentum
float ecalEnergyLeadChargedHadrCand() const
Abs< T >::type abs(const T &t)
const_iterator end() const
float phiAtEcalEntrance() const
return phiAtEcalEntrance
const reco::CandidatePtr leadChargedHadrCand() const
Analysis-level tau class.
std::string mvaName_wGwGSF_EC_
bool isNonnull() const
Checks for non-null.
double deltaR(double eta1, double eta2, double phi1, double phi2)
float ptLeadChargedCand() const
return pt from LeadChargedCand
std::pair< int, edm::FunctionWithDict > OK
double MVAValue(Float_t TauPt, Float_t TauEtaAtEcalEntrance, Float_t TauPhi, Float_t TauLeadChargedPFCandPt, Float_t TauLeadChargedPFCandEtaAtEcalEntrance, Float_t TauEmFraction, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauVisMassIn, Float_t TaudCrackEta, Float_t TaudCrackPhi, Float_t TauHasGsf, Int_t TauSignalPFGammaCandsIn, Int_t TauSignalPFGammaCandsOut, const std::vector< Float_t > &GammasdEtaInSigCone, const std::vector< Float_t > &GammasdPhiInSigCone, const std::vector< Float_t > &GammasPtInSigCone, const std::vector< Float_t > &GammasdEtaOutSigCone, const std::vector< Float_t > &GammasdPhiOutSigCone, const std::vector< Float_t > &GammasPtOutSigCone, Float_t ElecEta, Float_t ElecPhi, Float_t ElecEtotOverPin, Float_t ElecChi2NormGSF, Float_t ElecChi2NormKF, Float_t ElecGSFNumHits, Float_t ElecKFNumHits, Float_t ElecGSFTrackResol, Float_t ElecGSFTracklnPt, Float_t ElecPin, Float_t ElecPout, Float_t ElecEecal, Float_t ElecDeltaEta, Float_t ElecDeltaPhi, Float_t ElecMvaInSigmaEtaEta, Float_t ElecMvaInHadEnergy, Float_t ElecMvaInDeltaEta)
LocationCode location() const
Where was the file found?
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
T const * product() const
Analysis-level electron class.
const GBRForest * mva_wGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Geom::Phi< T > phi() const
float emFraction_MVA() const
return emFraction_MVA
float deltaEtaSeedClusterTrackAtCalo() const
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
Float_t * Var_wGwGSF_Endcap_
std::string mvaName_wGwGSF_BL_
std::string mvaName_NoEleMatch_wGwoGSF_BL_
reco::CandidatePtrVector signalChargedHadrCands() const
virtual double eta() const final
momentum pseudorapidity
volatile std::atomic< bool > shutdown_flag false
std::string fullPath() const
float etaAtEcalEntrance() const
return etaAtEcalEntrance
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
double dCrackEta(double eta)
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
virtual int pdgId() const
PDG identifier.
double GetClassifier(const float *vector) const
Float_t * Var_woGwGSF_Endcap_
std::string mvaName_woGwGSF_EC_
const std::vector< reco::PFCandidatePtr > & signalPFChargedHadrCands() const
Charged hadrons in signal region.
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
virtual double pt() const final
transverse momentum
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_