95 bool isGsfElectronMatched =
false;
97 float deltaRDummy = 9.9;
99 float tauEtaAtEcalEntrance = -99.;
100 float sumEtaTimesEnergy = 0.;
101 float sumEnergy = 0.;
102 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTauRef->signalPFCands();
103 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
104 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
105 sumEtaTimesEnergy += ((*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy());
106 sumEnergy += (*pfCandidate)->energy();
108 if ( sumEnergy > 0. ) {
109 tauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
112 float leadChargedPFCandEtaAtEcalEntrance = -99.;
113 float leadChargedPFCandPt = -99.;
114 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
115 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
117 if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
118 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
119 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
120 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
121 else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
123 if ( track->
pt() > leadChargedPFCandPt ) {
124 leadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().
eta();
125 leadChargedPFCandPt = track->
pt();
130 if( (*thePFTauRef).leadPFChargedHadrCand().isNonnull()) {
131 for ( reco::GsfElectronCollection::const_iterator theGsfElectron =
gsfElectrons_->begin();
133 if ( theGsfElectron->pt() > 10. ) {
134 double deltaREleTau =
deltaR(theGsfElectron->p4(), thePFTauRef->p4());
135 deltaRDummy = deltaREleTau;
136 if ( deltaREleTau < 0.3 ) {
137 double mva_match =
mva_->
MVAValue(*thePFTauRef, *theGsfElectron);
138 size_t numSignalPFGammaCands = thePFTauRef->signalPFGammaCands().size();
139 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
150 if (
TMath::Abs(tauEtaAtEcalEntrance) < 1.479 ) {
151 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
153 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
155 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
157 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
161 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
163 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
165 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
167 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
173 isGsfElectronMatched =
true;
178 if ( !isGsfElectronMatched ) {
180 size_t numSignalPFGammaCands = thePFTauRef->signalPFGammaCands().size();
181 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
192 if (
TMath::Abs(tauEtaAtEcalEntrance) < 1.479 ) {
193 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
195 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
197 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
199 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
203 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
205 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
207 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
209 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
217 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
"<PFRecoTauDiscriminationAgainstElectronMVA5::discriminate>:" ;
218 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" tau: Pt = " << thePFTauRef->pt() <<
", eta = " << thePFTauRef->eta() <<
", phi = " << thePFTauRef->phi();
219 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" deltaREleTau = " << deltaRDummy <<
", isGsfElectronMatched = " << isGsfElectronMatched;
220 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" #Prongs = " << thePFTauRef->signalChargedHadrCands().size();
bool isNonnull() const
Checks for non-null.
bool isInEcalCrack(double) const
AntiElectronIDMVA5 * mva_
double eta() const
pseudorapidity of momentum vector
double pt() const
track transverse momentum
std::unique_ptr< PFTauDiscriminator > category_output_
edm::Handle< reco::GsfElectronCollection > gsfElectrons_
double MVAValue(Float_t TauEtaAtEcalEntrance, Float_t TauPt, Float_t TauLeadChargedPFCandEtaAtEcalEntrance, Float_t TauLeadChargedPFCandPt, Float_t TaudCrackEta, Float_t TaudCrackPhi, Float_t TauEmFraction, Float_t TauSignalPFGammaCands, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauVisMass, Float_t TauHadrMva, const std::vector< Float_t > &GammasdEta, const std::vector< Float_t > &GammasdPhi, const std::vector< Float_t > &GammasPt, Float_t TauKFNumHits, Float_t TauGSFNumHits, Float_t TauGSFChi2, Float_t TauGSFTrackResol, Float_t TauGSFTracklnPt, Float_t TauGSFTrackEta, Float_t TauPhi, Float_t TauSignalPFChargedCands, Float_t TauHasGsf, Float_t ElecEta, Float_t ElecPhi, Float_t ElecPt, Float_t ElecEe, Float_t ElecEgamma, Float_t ElecPin, Float_t ElecPout, Float_t ElecFbrem, Float_t ElecChi2GSF, Float_t ElecGSFNumHits, Float_t ElecGSFTrackResol, Float_t ElecGSFTracklnPt, Float_t ElecGSFTrackEta)