132 double workingPoint = 1.;
134 bool isGsfElectronMatched =
false;
136 float deltaRDummy = 9.9;
137 float mvaCutDummy = 999;
139 float tauEtaAtEcalEntrance = -99.;
140 float sumEtaTimesEnergy = 0.;
141 float sumEnergy = 0.;
142 const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTauRef->signalPFCands();
143 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
144 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
145 sumEtaTimesEnergy += ((*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy());
146 sumEnergy += (*pfCandidate)->energy();
148 if ( sumEnergy > 0. ) {
149 tauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
152 float leadChargedPFCandEtaAtEcalEntrance = -99.;
153 float leadChargedPFCandPt = -99.;
154 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
155 pfCandidate != signalPFCands.end(); ++pfCandidate ) {
157 if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
158 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
159 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
160 else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
161 else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
163 if ( track->
pt() > leadChargedPFCandPt ) {
164 leadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().
eta();
165 leadChargedPFCandPt = track->
pt();
170 if( (*thePFTauRef).leadPFChargedHadrCand().isNonnull()) {
171 for ( reco::GsfElectronCollection::const_iterator theGsfElectron =
gsfElectrons_->begin();
173 if ( theGsfElectron->pt() > 10. ) {
174 double deltaREleTau =
deltaR(theGsfElectron->p4(), thePFTauRef->p4());
175 deltaRDummy = deltaREleTau;
176 if ( deltaREleTau < 0.3 ) {
177 double mva_match =
mva_->
MVAValue(*thePFTauRef, *theGsfElectron);
178 double workingPoint_match = 0.;
179 size_t numSignalPFGammaCands = thePFTauRef->signalPFGammaCands().size();
180 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
197 double mvaCut = 999.;
198 if ( TMath::Abs(tauEtaAtEcalEntrance) < 1.479 ) {
199 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
202 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
205 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
208 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
213 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
216 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
219 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
222 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
227 workingPoint_match = (mva_match > mvaCut);
228 mvaCutDummy = mvaCut;
231 workingPoint =
TMath::Min(workingPoint, workingPoint_match);
232 isGsfElectronMatched =
true;
237 if ( !isGsfElectronMatched ) {
239 size_t numSignalPFGammaCands = thePFTauRef->signalPFGammaCands().size();
240 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
257 double mvaCut = 999.;
258 if ( TMath::Abs(tauEtaAtEcalEntrance) < 1.479 ) {
259 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
262 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
265 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
268 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
273 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
276 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
279 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
282 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
287 workingPoint = (mva > mvaCut);
288 mvaCutDummy = mvaCut;
294 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
"<PFRecoTauDiscriminationAgainstElectronMVA5::discriminate>:" ;
295 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" tau: Pt = " << thePFTauRef->pt() <<
", eta = " << thePFTauRef->eta() <<
", phi = " << thePFTauRef->phi() ;
296 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" mva = " << mva <<
", mvaCut = " << mvaCutDummy <<
", isGsfElectronMatched = " << isGsfElectronMatched ;
297 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" category = " << category <<
": workingPoint = " << workingPoint ;
298 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" deltaREleTau = " << deltaRDummy ;
299 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" charged hadron in tau: "<<(*thePFTauRef).leadPFChargedHadrCand().isNonnull() ;
300 edm::LogPrint(
"PFTauAgainstEleMVA5") <<
" Prongs in tau: " << thePFTauRef->signalPFChargedHadrCands().size() ;
double minMVANoEleMatchWgWOgsfBL_
double minMVANoEleMatchWgWOgsfEC_
double minMVANoEleMatchWOgWOgsfBL_
bool isNonnull() const
Checks for non-null.
double eta() const
pseudorapidity of momentum vector
AntiElectronIDMVA5GBR * mva_
double pt() const
track transverse momentum
double minMVANoEleMatchWOgWOgsfEC_
std::auto_ptr< PFTauDiscriminator > category_output_
double minMVANoEleMatchWgWgsfEC_
double deltaR(double eta1, double eta2, double phi1, double phi2)
double minMVANoEleMatchWOgWgsfEC_
bool isInEcalCrack(double) const
double minMVANoEleMatchWOgWgsfBL_
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)
double minMVANoEleMatchWgWgsfBL_
edm::InputTag TauProducer_