337 LogDebug(
"discriminate") <<
" tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
338 LogDebug(
"discriminate") << *pfTau ;
341 std::vector<PFCandidatePtr> isoCharged_;
342 std::vector<PFCandidatePtr> isoNeutral_;
343 std::vector<PFCandidatePtr> isoPU_;
345 std::vector<PFCandidatePtr> chPV_;
346 isoCharged_.reserve(pfTau->isolationPFChargedHadrCands().size());
347 isoNeutral_.reserve(pfTau->isolationPFGammaCands().size());
349 isoNeutralWeight_.reserve(pfTau->isolationPFGammaCands().size());
359 LogTrace(
"discriminate") <<
"pv: x = " << pv->position().x() <<
", y = " << pv->position().y() <<
", z = " << pv->position().z() ;
361 LogTrace(
"discriminate") <<
"pv: N/A" ;
363 if ( pfTau->leadPFChargedHadrCand().
isNonnull() ) {
364 LogTrace(
"discriminate") <<
"leadPFChargedHadron:" 365 <<
" Pt = " << pfTau->leadPFChargedHadrCand()->pt() <<
"," 366 <<
" eta = " << pfTau->leadPFChargedHadrCand()->eta() <<
"," 367 <<
" phi = " << pfTau->leadPFChargedHadrCand()->phi() ;
369 LogTrace(
"discriminate") <<
"leadPFChargedHadron: N/A" ;
377 qcuts_->setLeadTrack(pfTau->leadPFChargedHadrCand());
388 for(
auto const &
cand : pfTau->isolationPFChargedHadrCands() ) {
390 LogTrace(
"discriminate") <<
"adding charged iso cand with pt " <<
cand->pt() ;
391 isoCharged_.push_back(
cand);
396 for(
auto const &
cand : pfTau->isolationPFGammaCands() ) {
398 LogTrace(
"discriminate") <<
"adding neutral iso cand with pt " <<
cand->pt() ;
399 isoNeutral_.push_back(
cand);
414 std::vector<PFCandidatePtr> allPU =
418 std::vector<PFCandidatePtr> allNPU =
421 LogTrace(
"discriminate") <<
"After track cuts: " << allPU.size() ;
425 std::vector<PFCandidatePtr> cleanPU =
428 std::vector<PFCandidatePtr> cleanNPU =
431 LogTrace(
"discriminate") <<
"After cleaning cuts: " << cleanPU.size() ;
435 for (
auto const &
cand : cleanPU ) {
436 if ( deltaBetaFilter(
cand) ) isoPU_.push_back(
cand);
439 for (
auto const &
cand : cleanNPU ) {
440 if ( deltaBetaFilter(
cand) ) chPV_.push_back(
cand);
442 LogTrace(
"discriminate") <<
"After cone cuts: " << isoPU_.size() <<
" " << chPV_.size() ;
450 for (
auto const & isoObject : isoNeutral_ ) {
451 if ( isoObject->charge() != 0 ) {
453 isoNeutralWeight_.push_back(*isoObject);
457 double eta = isoObject->eta();
458 double phi = isoObject->phi();
463 if ( (sumNPU + sumPU) > 0 ) neutral.
setP4(((sumNPU)/(sumNPU + sumPU))*neutral.
p4());
465 isoNeutralWeight_.push_back(neutral);
473 std::vector<PFCandidatePtr> isoCharged_filter;
474 std::vector<PFCandidatePtr> isoNeutral_filter;
477 for(
auto const & isoObject : isoCharged_ ) {
478 if (
filter(isoObject) ) isoCharged_filter.push_back(isoObject);
481 for(
auto const & isoObject : isoNeutral_ ) {
482 if (
filter(isoObject) ) isoNeutral_filter.push_back(isoObject);
484 isoNeutral_ = isoNeutral_filter;
486 for(
auto const & isoObject : isoNeutralWeight_){
487 if ( filter2(isoObject) ) isoNeutralWeight_filter.push_back(isoObject);
489 isoNeutralWeight_ = isoNeutralWeight_filter;
491 isoCharged_ = isoCharged_filter;
494 bool failsOccupancyCut =
false;
495 bool failsSumPtCut =
false;
496 bool failsRelativeSumPtCut =
false;
499 int neutrals = isoNeutral_.size();
504 if ( neutrals < 0 ) {
508 size_t nOccupants = isoCharged_.size() + neutrals;
512 double footprintCorrection_value = 0.;
516 if ( (*footprintCorrection)->selection_(*pfTau) ) {
517 footprintCorrection_value = (*footprintCorrection)->offset_(*pfTau);
526 double chargedPt = 0.;
527 double neutralPt = 0.;
528 double weightedNeutralPt = 0.;
529 for (
auto const & isoObject : isoCharged_ ) {
530 chargedPt += isoObject->pt();
533 for (
auto const & isoObject : isoNeutral_ ) {
534 neutralPt += isoObject->pt();
537 for (
auto const & isoObject : isoNeutralWeight_ ) {
538 weightedNeutralPt += isoObject.pt();
541 for (
auto const & isoObject : isoPU_ ) {
542 puPt += isoObject->pt();
544 LogTrace(
"discriminate") <<
"chargedPt = " << chargedPt ;
545 LogTrace(
"discriminate") <<
"neutralPt = " << neutralPt ;
546 LogTrace(
"discriminate") <<
"weighted neutral Pt = " << weightedNeutralPt ;
550 neutralPt = weightedNeutralPt;
558 neutralPt -= footprintCorrection_value;
565 if ( neutralPt < 0. ) {
578 bool failsPhotonPtSumOutsideSignalConeCut =
false;
579 double photonSumPt_outsideSignalCone = 0.;
581 const std::vector<reco::PFCandidatePtr>& signalPFGammas = pfTau->signalPFGammaCands();
582 for ( std::vector<reco::PFCandidatePtr>::const_iterator signalPFGamma = signalPFGammas.begin();
583 signalPFGamma != signalPFGammas.end(); ++signalPFGamma ) {
584 double dR =
deltaR(pfTau->eta(), pfTau->phi(), (*signalPFGamma)->eta(), (*signalPFGamma)->phi());
585 if ( dR > pfTau->signalConeSize() ) photonSumPt_outsideSignalCone += (*signalPFGamma)->pt();
588 failsPhotonPtSumOutsideSignalConeCut =
true;
613 return footprintCorrection_value;
615 return photonSumPt_outsideSignalCone;
617 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_
const LorentzVector & p4() const final
four-momentum Lorentz vector
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
uint32_t maximumOccupancy_
double maxRelPhotonSumPt_outsideSignalCone_
Particle reconstructed by the particle flow algorithm.
std::auto_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
double maxAbsPhotonSumPt_outsideSignalCone_
bool storeRawPhotonSumPt_outsideSignalCone_
void setP4(const LorentzVector &p4) final
set 4-momentum