92 bool isGsfElectronMatched =
false;
94 float deltaRDummy = 9.9;
96 const float ECALBarrelEndcapEtaBorder = 1.479;
97 float tauEtaAtEcalEntrance = -99.;
98 float sumEtaTimesEnergy = 0.;
100 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTauRef->signalPFCands();
101 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
102 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
103 sumEtaTimesEnergy += ((*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy());
104 sumEnergy += (*pfCandidate)->energy();
106 if ( sumEnergy > 0. ) {
107 tauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
110 float leadChargedPFCandEtaAtEcalEntrance = -99.;
111 float leadChargedPFCandPt = -99.;
112 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
113 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
115 if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
116 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
117 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
118 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
119 else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
121 if ( track->
pt() > leadChargedPFCandPt ) {
122 leadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().
eta();
123 leadChargedPFCandPt = track->
pt();
128 if( (*thePFTauRef).leadPFChargedHadrCand().isNonnull()) {
130 int numSignalPFGammaCandsInSigCone = 0;
131 const std::vector<reco::PFCandidatePtr>& signalPFGammaCands = thePFTauRef->signalPFGammaCands();
133 for ( std::vector<reco::PFCandidatePtr>::const_iterator
pfGamma = signalPFGammaCands.begin();
136 double dR =
deltaR((*pfGamma)->p4(), thePFTauRef->leadPFChargedHadrCand()->p4());
140 if (dR < signalrad) {
141 numSignalPFGammaCandsInSigCone += 1;
146 for ( reco::GsfElectronCollection::const_iterator theGsfElectron =
gsfElectrons_->begin();
148 if ( theGsfElectron->pt() > 10. ) {
149 double deltaREleTau =
deltaR(theGsfElectron->p4(), thePFTauRef->p4());
150 deltaRDummy = deltaREleTau;
151 if ( deltaREleTau < 0.3 ) {
153 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
155 hasGsfTrack = theGsfElectron->gsfTrack().isNonnull();
166 if (
std::abs(tauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
167 if ( numSignalPFGammaCandsInSigCone == 0 && hasGsfTrack ) {
170 else if ( numSignalPFGammaCandsInSigCone >= 1 && hasGsfTrack ) {
174 if ( numSignalPFGammaCandsInSigCone == 0 && hasGsfTrack ) {
177 else if ( numSignalPFGammaCandsInSigCone >= 1 && hasGsfTrack ) {
182 mvaValue =
std::min(mvaValue, mva_match);
183 isGsfElectronMatched =
true;
188 if ( !isGsfElectronMatched ) {
190 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
201 if (
std::abs(tauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
202 if ( numSignalPFGammaCandsInSigCone == 0 && !hasGsfTrack ) {
205 else if ( numSignalPFGammaCandsInSigCone >= 1 && !hasGsfTrack ) {
209 if ( numSignalPFGammaCandsInSigCone == 0 && !hasGsfTrack ) {
212 else if ( numSignalPFGammaCandsInSigCone >= 1 && !hasGsfTrack ) {
220 edm::LogPrint(
"PFTauAgainstEleMVA6") <<
"<PFRecoTauDiscriminationAgainstElectronMVA6::discriminate>:" ;
221 edm::LogPrint(
"PFTauAgainstEleMVA6") <<
" tau: Pt = " << thePFTauRef->pt() <<
", eta = " << thePFTauRef->eta() <<
", phi = " << thePFTauRef->phi();
222 edm::LogPrint(
"PFTauAgainstEleMVA6") <<
" deltaREleTau = " << deltaRDummy <<
", isGsfElectronMatched = " << isGsfElectronMatched;
223 edm::LogPrint(
"PFTauAgainstEleMVA6") <<
" #Prongs = " << thePFTauRef->signalPFChargedHadrCands().size();
bool isNonnull() const
Checks for non-null.
AntiElectronIDMVA6 * mva_
bool usePhiAtEcalEntranceExtrapolation_
bool isInEcalCrack(double) const
double eta() const
pseudorapidity of momentum vector
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::unique_ptr< PFTauDiscriminator > category_output_
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)
edm::Handle< reco::GsfElectronCollection > gsfElectrons_