330 LogDebug(
"discriminate") <<
" tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
331 LogDebug(
"discriminate") << *pfTau ;
334 std::vector<PFCandidatePtr> isoCharged_;
335 std::vector<PFCandidatePtr> isoNeutral_;
336 std::vector<PFCandidatePtr> isoPU_;
338 std::vector<PFCandidatePtr> chPV_;
339 isoCharged_.reserve(pfTau->isolationPFChargedHadrCands().size());
340 isoNeutral_.reserve(pfTau->isolationPFGammaCands().size());
342 isoNeutralWeight_.reserve(pfTau->isolationPFGammaCands().size());
352 LogTrace(
"discriminate") <<
"pv: x = " << pv->position().x() <<
", y = " << pv->position().y() <<
", z = " << pv->position().z() ;
354 LogTrace(
"discriminate") <<
"pv: N/A" ;
356 if ( pfTau->leadPFChargedHadrCand().
isNonnull() ) {
357 LogTrace(
"discriminate") <<
"leadPFChargedHadron:"
358 <<
" Pt = " << pfTau->leadPFChargedHadrCand()->pt() <<
","
359 <<
" eta = " << pfTau->leadPFChargedHadrCand()->eta() <<
","
360 <<
" phi = " << pfTau->leadPFChargedHadrCand()->phi() ;
362 LogTrace(
"discriminate") <<
"leadPFChargedHadron: N/A" ;
370 qcuts_->setLeadTrack(pfTau->leadPFChargedHadrCand());
381 for(
auto const & cand : pfTau->isolationPFChargedHadrCands() ) {
382 if (
qcuts_->filterCandRef(cand) ) {
383 LogTrace(
"discriminate") <<
"adding charged iso cand with pt " << cand->pt() ;
384 isoCharged_.push_back(cand);
389 for(
auto const & cand : pfTau->isolationPFGammaCands() ) {
390 if (
qcuts_->filterCandRef(cand) ) {
391 LogTrace(
"discriminate") <<
"adding neutral iso cand with pt " << cand->pt() ;
392 isoNeutral_.push_back(cand);
407 std::vector<PFCandidatePtr> allPU =
411 std::vector<PFCandidatePtr> allNPU =
414 LogTrace(
"discriminate") <<
"After track cuts: " << allPU.size() ;
418 std::vector<PFCandidatePtr> cleanPU =
421 std::vector<PFCandidatePtr> cleanNPU =
424 LogTrace(
"discriminate") <<
"After cleaning cuts: " << cleanPU.size() ;
428 for (
auto const & cand : cleanPU ) {
429 if ( deltaBetaFilter(cand) ) isoPU_.push_back(cand);
432 for (
auto const & cand : cleanNPU ) {
433 if ( deltaBetaFilter(cand) ) chPV_.push_back(cand);
435 LogTrace(
"discriminate") <<
"After cone cuts: " << isoPU_.size() <<
" " << chPV_.size() ;
443 for (
auto const & isoObject : isoNeutral_ ) {
444 if ( isoObject->charge() != 0 ) {
446 isoNeutralWeight_.push_back(*isoObject);
450 double eta = isoObject->eta();
451 double phi = isoObject->phi();
456 if ( (sumNPU + sumPU) > 0 ) neutral.
setP4(((sumNPU)/(sumNPU + sumPU))*neutral.
p4());
458 isoNeutralWeight_.push_back(neutral);
466 std::vector<PFCandidatePtr> isoCharged_filter;
467 std::vector<PFCandidatePtr> isoNeutral_filter;
470 for(
auto const & isoObject : isoCharged_ ) {
471 if (
filter(isoObject) ) isoCharged_filter.push_back(isoObject);
474 for(
auto const & isoObject : isoNeutral_ ) {
475 if (
filter(isoObject) ) isoNeutral_filter.push_back(isoObject);
477 isoNeutral_ = isoNeutral_filter;
479 for(
auto const & isoObject : isoNeutralWeight_){
480 if ( filter2(isoObject) ) isoNeutralWeight_filter.push_back(isoObject);
482 isoNeutralWeight_ = isoNeutralWeight_filter;
484 isoCharged_ = isoCharged_filter;
487 bool failsOccupancyCut =
false;
488 bool failsSumPtCut =
false;
489 bool failsRelativeSumPtCut =
false;
492 int neutrals = isoNeutral_.size();
497 if ( neutrals < 0 ) {
501 size_t nOccupants = isoCharged_.size() + neutrals;
505 double footprintCorrection_value = 0.;
509 if ( (*footprintCorrection)->selection_(*pfTau) ) {
510 footprintCorrection_value = (*footprintCorrection)->offset_(*pfTau);
519 double chargedPt = 0.;
520 double neutralPt = 0.;
521 double weightedNeutralPt = 0.;
522 for (
auto const & isoObject : isoCharged_ ) {
523 chargedPt += isoObject->pt();
526 for (
auto const & isoObject : isoNeutral_ ) {
527 neutralPt += isoObject->pt();
530 for (
auto const & isoObject : isoNeutralWeight_ ) {
531 weightedNeutralPt += isoObject.pt();
534 for (
auto const & isoObject : isoPU_ ) {
535 puPt += isoObject->pt();
537 LogTrace(
"discriminate") <<
"chargedPt = " << chargedPt ;
538 LogTrace(
"discriminate") <<
"neutralPt = " << neutralPt ;
539 LogTrace(
"discriminate") <<
"weighted neutral Pt = " << weightedNeutralPt ;
543 neutralPt = weightedNeutralPt;
551 neutralPt -= footprintCorrection_value;
558 if ( neutralPt < 0. ) {
562 totalPt = chargedPt + neutralPt;
571 bool failsPhotonPtSumOutsideSignalConeCut =
false;
572 double photonSumPt_outsideSignalCone = 0.;
574 const std::vector<reco::PFCandidatePtr>& signalPFGammas = pfTau->signalPFGammaCands();
575 for ( std::vector<reco::PFCandidatePtr>::const_iterator signalPFGamma = signalPFGammas.begin();
576 signalPFGamma != signalPFGammas.end(); ++signalPFGamma ) {
577 double dR =
deltaR(pfTau->eta(), pfTau->phi(), (*signalPFGamma)->eta(), (*signalPFGamma)->phi());
578 if ( dR > pfTau->signalConeSize() ) photonSumPt_outsideSignalCone += (*signalPFGamma)->pt();
581 failsPhotonPtSumOutsideSignalConeCut =
true;
606 return footprintCorrection_value;
608 return photonSumPt_outsideSignalCone;
610 return (fails ? 0. : 1.);
bool isNonnull() const
Checks for non-null.
std::auto_ptr< tau::RecoTauQualityCuts > pileupQcutsGeneralQCuts_
bool applyPhotonPtSumOutsideSignalConeCut_
double weightedSum(const std::vector< PFCandidatePtr > &inColl_, double eta, double phi) const
double maximumRelativeSumPt_
bool applyRelativeSumPtCut_
double deltaBetaFactorThisEvent_
bool applyFootprintCorrection_
double offsetRelativeSumPt_
std::vector< std::unique_ptr< FootprintCorrection > > footprintCorrections_
std::vector< reco::PFCandidatePtr > chargedPFCandidatesInEvent_
bool storeRawFootprintCorrection_
std::auto_ptr< tau::RecoTauQualityCuts > qcuts_
std::auto_ptr< tau::RecoTauQualityCuts > pileupQcutsPUTrackSelection_
double deltaR(double eta1, double eta2, double phi1, double phi2)
double deltaBetaCollectionCone_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
uint32_t maximumOccupancy_
double maxRelPhotonSumPt_outsideSignalCone_
Particle reconstructed by the particle flow algorithm.
tuple footprintCorrection
std::auto_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
double maxAbsPhotonSumPt_outsideSignalCone_
bool storeRawPhotonSumPt_outsideSignalCone_
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector