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";
96 throw cms::Exception(
"PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
97 <<
" Failed to load MVA = " << mvaName.data() <<
" from file " <<
" !!\n";
146 Float_t TauEtaAtEcalEntrance,
148 Float_t TauLeadChargedPFCandPt,
149 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
150 Float_t TauEmFraction,
151 Float_t TauLeadPFChargedHadrHoP,
152 Float_t TauLeadPFChargedHadrEoP,
153 Float_t TauVisMassIn,
154 Float_t TaudCrackEta,
155 Float_t TaudCrackPhi,
157 Int_t TauSignalPFGammaCandsIn,
158 Int_t TauSignalPFGammaCandsOut,
159 const std::vector<Float_t>& GammasdEtaInSigCone,
160 const std::vector<Float_t>& GammasdPhiInSigCone,
161 const std::vector<Float_t>& GammasPtInSigCone,
162 const std::vector<Float_t>& GammasdEtaOutSigCone,
163 const std::vector<Float_t>& GammasdPhiOutSigCone,
164 const std::vector<Float_t>& GammasPtOutSigCone,
167 Float_t ElecEtotOverPin,
168 Float_t ElecChi2NormGSF,
169 Float_t ElecChi2NormKF,
170 Float_t ElecGSFNumHits,
171 Float_t ElecKFNumHits,
172 Float_t ElecGSFTrackResol,
173 Float_t ElecGSFTracklnPt,
177 Float_t ElecDeltaEta,
178 Float_t ElecDeltaPhi,
179 Float_t ElecMvaInSigmaEtaEta,
180 Float_t ElecMvaInHadEnergy,
181 Float_t ElecMvaInDeltaEta)
187 for (
unsigned int i = 0 ;
i < GammasPtInSigCone.size() ; ++
i ) {
188 double pt_i = GammasPtInSigCone[
i];
189 double phi_i = GammasdPhiInSigCone[
i];
190 if ( GammasdPhiInSigCone[
i] >
M_PI ) phi_i = GammasdPhiInSigCone[
i] - 2*
M_PI;
191 else if ( GammasdPhiInSigCone[
i] < -M_PI ) phi_i = GammasdPhiInSigCone[
i] + 2*
M_PI;
192 double eta_i = GammasdEtaInSigCone[
i];
194 sumPt2 += (pt_i*pt_i);
195 dEta2 += (pt_i*eta_i*eta_i);
196 dPhi2 += (pt_i*phi_i*phi_i);
198 Float_t TauGammaEnFracIn = -99.;
200 TauGammaEnFracIn = sumPt/TauPt;
213 for (
unsigned int i = 0 ;
i < GammasPtOutSigCone.size() ; ++
i ) {
214 double pt_i = GammasPtOutSigCone[
i];
215 double phi_i = GammasdPhiOutSigCone[
i];
216 if ( GammasdPhiOutSigCone[
i] >
M_PI ) phi_i = GammasdPhiOutSigCone[
i] - 2*
M_PI;
217 else if ( GammasdPhiOutSigCone[
i] < -M_PI ) phi_i = GammasdPhiOutSigCone[
i] + 2*
M_PI;
218 double eta_i = GammasdEtaOutSigCone[
i];
220 sumPt2 += (pt_i*pt_i);
221 dEta2 += (pt_i*eta_i*eta_i);
222 dPhi2 += (pt_i*phi_i*phi_i);
224 Float_t TauGammaEnFracOut = sumPt/TauPt;
233 TauEtaAtEcalEntrance,
235 TauLeadChargedPFCandPt,
236 TauLeadChargedPFCandEtaAtEcalEntrance,
238 TauLeadPFChargedHadrHoP,
239 TauLeadPFChargedHadrEoP,
244 TauSignalPFGammaCandsIn,
245 TauSignalPFGammaCandsOut,
266 ElecMvaInSigmaEtaEta,
272 Float_t TauEtaAtEcalEntrance,
274 Float_t TauLeadChargedPFCandPt,
275 Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
276 Float_t TauEmFraction,
277 Float_t TauLeadPFChargedHadrHoP,
278 Float_t TauLeadPFChargedHadrEoP,
279 Float_t TauVisMassIn,
280 Float_t TaudCrackEta,
281 Float_t TaudCrackPhi,
283 Int_t TauSignalPFGammaCandsIn,
284 Int_t TauSignalPFGammaCandsOut,
285 Float_t TauGammaEtaMomIn,
286 Float_t TauGammaEtaMomOut,
287 Float_t TauGammaPhiMomIn,
288 Float_t TauGammaPhiMomOut,
289 Float_t TauGammaEnFracIn,
290 Float_t TauGammaEnFracOut,
293 Float_t ElecEtotOverPin,
294 Float_t ElecChi2NormGSF,
295 Float_t ElecChi2NormKF,
296 Float_t ElecGSFNumHits,
297 Float_t ElecKFNumHits,
298 Float_t ElecGSFTrackResol,
299 Float_t ElecGSFTracklnPt,
303 Float_t ElecDeltaEta,
304 Float_t ElecDeltaPhi,
305 Float_t ElecMvaInSigmaEtaEta,
306 Float_t ElecMvaInHadEnergy,
307 Float_t ElecMvaInDeltaEta)
312 <<
" AntiElectronMVA not properly initialized !!\n";
315 double mvaValue = -99.;
317 const float ECALBarrelEndcapEtaBorder = 1.479;
318 float ElecDeltaPinPoutOverPin = (ElecPin > 0.0) ? (
std::abs(ElecPin - ElecPout)/ElecPin) : 1.0;
319 float ElecEecalOverPout = (ElecPout > 0.0) ? (ElecEecal/ElecPout) : 20.0;
320 float ElecNumHitsDiffOverSum = ((ElecGSFNumHits + ElecKFNumHits) > 0.0) ?
321 ((ElecGSFNumHits - ElecKFNumHits)/(ElecGSFNumHits + ElecKFNumHits)) : 1.0;
323 if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn == 0 && TauHasGsf < 0.5) {
324 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
349 else if (
deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn > 0 && TauHasGsf < 0.5 ) {
350 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
391 else if ( TauSignalPFGammaCandsIn == 0 && TauHasGsf > 0.5 ) {
392 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
445 else if ( TauSignalPFGammaCandsIn > 0 && TauHasGsf > 0.5 ) {
446 if (
std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
523 float TauEtaAtEcalEntrance = -99.;
524 float sumEtaTimesEnergy = 0.;
525 float sumEnergy = 0.;
526 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
527 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
528 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
529 sumEtaTimesEnergy += (*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy();
530 sumEnergy += (*pfCandidate)->energy();
532 if ( sumEnergy > 0. ) {
533 TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
536 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
537 float TauLeadChargedPFCandPt = -99.;
538 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
539 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
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;
578 if (dR < signalrad) {
584 GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.
eta());
585 GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.
phi());
587 GammasPtInSigCone.push_back(gamma->pt());
588 pfGammaSum += gamma->p4();
597 GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.
eta());
598 GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.
phi());
600 GammasPtOutSigCone.push_back(gamma->pt());
610 if (dR < signalrad) {
611 pfChargedSum += charged->p4();
615 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
616 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
617 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
619 Float_t TauPhi = thePFTau.
phi();
620 float sumPhiTimesEnergy = 0.;
621 float sumEnergyPhi = 0.;
622 if ( !usePhiAtEcalEntranceExtrapolation ){
623 for (
auto const& pfc : signalPFCands){
624 sumPhiTimesEnergy += pfc->positionAtECALEntrance().phi()*pfc->energy();
625 sumEnergyPhi += pfc->energy();
630 for (
unsigned int o = 0;
o < signalPFCands.size(); ++
o ) {
632 float phi = thePFTau.
phi();
635 sumPhiTimesEnergy += phi*signalCand->
energy();
636 sumEnergy += signalCand->
energy();
639 if ( sumEnergyPhi > 0. ) {
640 TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
642 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
643 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
648 Float_t ElecEta = theGsfEle.
eta();
649 Float_t ElecPhi = theGsfEle.
phi();
653 Float_t ElecEgamma = 0.;
657 pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
658 double pfClusterEn = (*pfCluster)->energy();
659 if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
660 else ElecEgamma += pfClusterEn;
666 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
670 Float_t ElecMvaInSigmaEtaEta = (theGsfEle).mvaInput().sigmaEtaEta;
671 Float_t ElecMvaInHadEnergy = (theGsfEle).mvaInput().hadEnergy;
672 Float_t ElecMvaInDeltaEta = (theGsfEle).mvaInput().deltaEta;
675 Float_t ElecChi2NormGSF = -99.;
676 Float_t ElecGSFNumHits = -99.;
677 Float_t ElecGSFTrackResol = -99.;
678 Float_t ElecGSFTracklnPt = -99.;
680 ElecChi2NormGSF = (theGsfEle).gsfTrack()->normalizedChi2();
681 ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
682 if ( theGsfEle.
gsfTrack()->pt() > 0. ) {
683 ElecGSFTrackResol = theGsfEle.
gsfTrack()->ptError()/theGsfEle.
gsfTrack()->pt();
684 ElecGSFTracklnPt =
log(theGsfEle.
gsfTrack()->pt())*M_LN10;
689 Float_t ElecChi2NormKF = -99.;
690 Float_t ElecKFNumHits = -99.;
692 ElecChi2NormKF = (theGsfEle).closestCtfTrackRef()->normalizedChi2();
693 ElecKFNumHits = (theGsfEle).closestCtfTrackRef()->numberOfValidHits();
697 TauEtaAtEcalEntrance,
699 TauLeadChargedPFCandPt,
700 TauLeadChargedPFCandEtaAtEcalEntrance,
702 TauLeadPFChargedHadrHoP,
703 TauLeadPFChargedHadrEoP,
708 TauSignalPFGammaCandsIn,
709 TauSignalPFGammaCandsOut,
713 GammasdEtaOutSigCone,
714 GammasdPhiOutSigCone,
730 ElecMvaInSigmaEtaEta,
738 float TauEtaAtEcalEntrance = -99.;
739 float sumEtaTimesEnergy = 0.;
740 float sumEnergy = 0.;
741 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.
signalPFCands();
742 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
743 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
744 sumEtaTimesEnergy += (*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy();
745 sumEnergy += (*pfCandidate)->energy();
747 if ( sumEnergy > 0. ) {
748 TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
751 float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
752 float TauLeadChargedPFCandPt = -99.;
753 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
754 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
756 if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
757 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
758 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
759 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
760 else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
762 if ( track->
pt() > TauLeadChargedPFCandPt ) {
763 TauLeadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().
eta();
764 TauLeadChargedPFCandPt = track->
pt();
769 Float_t TauPt = thePFTau.
pt();
771 Float_t TauLeadPFChargedHadrHoP = 0.;
772 Float_t TauLeadPFChargedHadrEoP = 0.;
778 std::vector<Float_t> GammasdEtaInSigCone;
779 std::vector<Float_t> GammasdPhiInSigCone;
780 std::vector<Float_t> GammasPtInSigCone;
781 std::vector<Float_t> GammasdEtaOutSigCone;
782 std::vector<Float_t> GammasdPhiOutSigCone;
783 std::vector<Float_t> GammasPtOutSigCone;
793 if (dR < signalrad) {
799 GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.
eta());
800 GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.
phi());
802 GammasPtInSigCone.push_back(gamma->pt());
803 pfGammaSum += gamma->p4();
812 GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.
eta());
813 GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.
phi());
815 GammasPtOutSigCone.push_back(gamma->pt());
825 if (dR < signalrad) {
826 pfChargedSum += charged->p4();
830 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
831 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
832 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
834 Float_t TauPhi = thePFTau.
phi();
835 float sumPhiTimesEnergy = 0.;
836 float sumEnergyPhi = 0.;
837 if ( !usePhiAtEcalEntranceExtrapolation ){
838 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
839 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
840 sumPhiTimesEnergy += (*pfCandidate)->positionAtECALEntrance().phi()*(*pfCandidate)->energy();
841 sumEnergyPhi += (*pfCandidate)->energy();
846 for (
unsigned int o = 0;
o < signalPFCands.size();
o++ ) {
848 float phi = thePFTau.
phi();
851 sumPhiTimesEnergy += phi*signalCand->
energy();
852 sumEnergy += signalCand->
energy();
855 if ( sumEnergyPhi > 0. ) {
856 TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
858 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
859 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
864 Float_t dummyElecEta = 9.9;
867 TauEtaAtEcalEntrance,
869 TauLeadChargedPFCandPt,
870 TauLeadChargedPFCandEtaAtEcalEntrance,
872 TauLeadPFChargedHadrHoP,
873 TauLeadPFChargedHadrEoP,
878 TauSignalPFGammaCandsIn,
879 TauSignalPFGammaCandsOut,
883 GammasdEtaOutSigCone,
884 GammasdPhiOutSigCone,
913 Float_t TauPt = theTau.
pt();
916 Float_t TauLeadPFChargedHadrHoP = 0.;
917 Float_t TauLeadPFChargedHadrEoP = 0.;
923 std::vector<Float_t> GammasdEtaInSigCone;
924 std::vector<Float_t> GammasdPhiInSigCone;
925 std::vector<Float_t> GammasPtInSigCone;
926 std::vector<Float_t> GammasdEtaOutSigCone;
927 std::vector<Float_t> GammasdPhiOutSigCone;
928 std::vector<Float_t> GammasPtOutSigCone;
938 if (dR < signalrad) {
946 GammasdEtaInSigCone.push_back((*gamma)->eta() - theTau.
eta());
947 GammasdPhiInSigCone.push_back((*gamma)->phi() - theTau.
phi());
951 GammasPtInSigCone.push_back((*gamma)->pt());
952 pfGammaSum += (*gamma)->p4();
963 GammasdEtaOutSigCone.push_back((*gamma)->eta() - theTau.
eta());
964 GammasdPhiOutSigCone.push_back((*gamma)->phi() - theTau.
phi());
968 GammasPtOutSigCone.push_back((*gamma)->pt());
978 if (dR < signalrad) {
979 pfChargedSum += (*charged)->p4();
983 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
984 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
985 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
986 Float_t TauPhi = -99.;
987 if ( usePhiAtEcalEntranceExtrapolation ) {
988 float sumPhiTimesEnergy = 0.;
989 float sumEnergy = 0.;
991 for (
unsigned int o = 0;
o < signalCands.
size();
o++ ) {
996 sumPhiTimesEnergy += phi*signalCand->
energy();
997 sumEnergy += signalCand->
energy();
999 if ( sumEnergy > 0. ) {
1000 TauPhi = sumPhiTimesEnergy/sumEnergy;
1007 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1008 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1010 Float_t TauHasGsf = 0;
1012 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) TauHasGsf = 1;
1015 Float_t ElecEta = theEle.
eta();
1016 Float_t ElecPhi = theEle.
phi();
1019 Float_t ElecEe = 0.;
1020 Float_t ElecEgamma = 0.;
1023 for (
reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin(); pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
1024 double pfClusterEn = (*pfCluster)->energy();
1025 if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
1026 else ElecEgamma += pfClusterEn;
1032 Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
1036 Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
1037 Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
1038 Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
1041 Float_t ElecChi2NormGSF = -99.;
1042 Float_t ElecGSFNumHits = -99.;
1043 Float_t ElecGSFTrackResol = -99.;
1044 Float_t ElecGSFTracklnPt = -99.;
1046 ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
1047 ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1048 if ( theEle.
gsfTrack()->pt() > 0. ) {
1050 ElecGSFTracklnPt =
log(theEle.
gsfTrack()->pt())*M_LN10;
1055 Float_t ElecChi2NormKF = -99.;
1056 Float_t ElecKFNumHits = -99.;
1058 ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1059 ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1063 TauEtaAtEcalEntrance,
1065 TauLeadChargedPFCandPt,
1066 TauLeadChargedPFCandEtaAtEcalEntrance,
1068 TauLeadPFChargedHadrHoP,
1069 TauLeadPFChargedHadrEoP,
1074 TauSignalPFGammaCandsIn,
1075 TauSignalPFGammaCandsOut,
1076 GammasdEtaInSigCone,
1077 GammasdPhiInSigCone,
1079 GammasdEtaOutSigCone,
1080 GammasdPhiOutSigCone,
1096 ElecMvaInSigmaEtaEta,
1109 Float_t TauPt = theTau.
pt();
1112 Float_t TauLeadPFChargedHadrHoP = 0.;
1113 Float_t TauLeadPFChargedHadrEoP = 0.;
1119 std::vector<Float_t> GammasdEtaInSigCone;
1120 std::vector<Float_t> GammasdPhiInSigCone;
1121 std::vector<Float_t> GammasPtInSigCone;
1122 std::vector<Float_t> GammasdEtaOutSigCone;
1123 std::vector<Float_t> GammasdPhiOutSigCone;
1124 std::vector<Float_t> GammasPtOutSigCone;
1134 if (dR < signalrad) {
1140 GammasdEtaInSigCone.push_back((*gamma)->eta() - theTau.
eta());
1141 GammasdPhiInSigCone.push_back((*gamma)->phi() - theTau.
phi());
1143 GammasPtInSigCone.push_back((*gamma)->pt());
1144 pfGammaSum += (*gamma)->p4();
1153 GammasdEtaOutSigCone.push_back((*gamma)->eta() - theTau.
eta());
1154 GammasdPhiOutSigCone.push_back((*gamma)->phi() - theTau.
phi());
1156 GammasPtOutSigCone.push_back((*gamma)->pt());
1166 if (dR < signalrad) {
1167 pfChargedSum += (*charged)->p4();
1171 Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
1172 Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
1173 Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).
mass();
1174 Float_t TauPhi = -99.;
1175 if ( usePhiAtEcalEntranceExtrapolation ) {
1176 float sumPhiTimesEnergy = 0.;
1177 float sumEnergy = 0.;
1179 for (
unsigned int o = 0;
o < signalCands.
size();
o++ ) {
1181 float phi = theTau.
phi();
1183 if (
atECalEntrance(signalCand, aPos) ==
true ) phi = aPos.Phi();
1184 sumPhiTimesEnergy += phi*signalCand->
energy();
1185 sumEnergy += signalCand->
energy();
1187 if ( sumEnergy > 0. ) {
1188 TauPhi = sumPhiTimesEnergy/sumEnergy;
1195 Float_t TaudCrackPhi =
dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1196 Float_t TaudCrackEta =
dCrackEta(TauEtaAtEcalEntrance);
1198 Float_t TauHasGsf = 0;
1201 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) TauHasGsf = 1;
1204 Float_t dummyElecEta = 9.9;
1207 TauEtaAtEcalEntrance,
1209 TauLeadChargedPFCandPt,
1210 TauLeadChargedPFCandEtaAtEcalEntrance,
1212 TauLeadPFChargedHadrHoP,
1213 TauLeadPFChargedHadrEoP,
1218 TauSignalPFGammaCandsIn,
1219 TauSignalPFGammaCandsOut,
1220 GammasdEtaInSigCone,
1221 GammasdPhiInSigCone,
1223 GammasdEtaOutSigCone,
1224 GammasdPhiOutSigCone,
1254 std::array<double,18> fill_cPhi() {
1256 std::array<double,18> cPhi;
1259 for (
unsigned iCrack = 1; iCrack <= 17; ++iCrack )
1260 cPhi[iCrack] = cPhi[0] - 2.*iCrack*pi/18;
1264 const std::array<double,18> cPhi = fill_cPhi();
1277 double retVal = 99.;
1279 if ( eta >= -1.47464 && eta <= 1.47464 ) {
1282 if ( eta < 0. ) phi += delta_cPhi;
1285 if ( phi > pi ) phi -= 2.*
pi;
1286 if ( phi < -pi ) phi += 2.*
pi;
1288 if ( phi >= -pi && phi <= pi ) {
1291 if ( phi < cPhi[17] || phi >= cPhi[0] ) {
1292 if ( phi < 0. ) phi += 2.*
pi;
1293 retVal =
minimum(phi - cPhi[0], phi - cPhi[17] - 2.*pi);
1297 unsigned iCrack = 16;
1299 if ( phi < cPhi[iCrack] ) {
1300 retVal =
minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1322 double cracks[5] = { 0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00 };
1324 double retVal = 99.;
1326 for (
int iCrack = 0; iCrack < 5 ; ++iCrack ) {
1327 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)
usePhiAtEcalEntranceExtrapolation
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.
size_type size() const
Size of the RefVector.
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_
const_iterator begin() const
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_
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)
const_iterator end() 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.
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_