304 LogDebug(
"discriminate") <<
" tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
308 std::vector<CandidatePtr> isoCharged_;
309 std::vector<CandidatePtr> isoNeutral_;
310 std::vector<CandidatePtr> isoPU_;
312 std::vector<CandidatePtr> chPV_;
313 isoCharged_.
reserve(pfTau->isolationChargedHadrCands().size());
314 isoNeutral_.reserve(pfTau->isolationGammaCands().size());
316 isoNeutralWeight_.
reserve(pfTau->isolationGammaCands().size());
326 LogTrace(
"discriminate") <<
"pv: x = " << pv->position().x() <<
", y = " << pv->position().y()
327 <<
", z = " << pv->position().z();
329 LogTrace(
"discriminate") <<
"pv: N/A";
331 if (pfTau->leadChargedHadrCand().
isNonnull()) {
332 LogTrace(
"discriminate") <<
"leadPFChargedHadron:" 333 <<
" Pt = " << pfTau->leadChargedHadrCand()->pt() <<
"," 334 <<
" eta = " << pfTau->leadChargedHadrCand()->eta() <<
"," 335 <<
" phi = " << pfTau->leadChargedHadrCand()->phi();
337 LogTrace(
"discriminate") <<
"leadPFChargedHadron: N/A";
346 qcuts_->setLeadTrack(*pfTau->leadChargedHadrCand());
357 for (
auto const&
cand : pfTau->isolationChargedHadrCands()) {
359 LogTrace(
"discriminate") <<
"adding charged iso cand with pt " <<
cand->pt();
360 isoCharged_.push_back(
cand);
365 for (
auto const&
cand : pfTau->isolationGammaCands()) {
367 LogTrace(
"discriminate") <<
"adding neutral iso cand with pt " <<
cand->pt();
368 isoNeutral_.push_back(
cand);
386 LogTrace(
"discriminate") <<
"After track cuts: " << allPU.size();
394 LogTrace(
"discriminate") <<
"After cleaning cuts: " << cleanPU.size();
398 for (
auto const&
cand : cleanPU) {
399 if (deltaBetaFilter(
cand))
400 isoPU_.push_back(
cand);
403 for (
auto const&
cand : cleanNPU) {
404 if (deltaBetaFilter(
cand))
405 chPV_.push_back(
cand);
407 LogTrace(
"discriminate") <<
"After cone cuts: " << isoPU_.size() <<
" " << chPV_.size();
415 for (
auto const& isoObject : isoNeutral_) {
416 if (isoObject->charge() != 0) {
422 double eta = isoObject->eta();
423 double phi = isoObject->phi();
428 if ((sumNPU + sumPU) > 0)
429 neutral.setP4(((sumNPU) / (sumNPU + sumPU)) * neutral.p4());
439 std::vector<CandidatePtr> isoCharged_filter;
440 std::vector<CandidatePtr> isoNeutral_filter;
443 for (
auto const& isoObject : isoCharged_) {
448 for (
auto const& isoObject : isoNeutral_) {
450 isoNeutral_filter.push_back(isoObject);
452 isoNeutral_ = isoNeutral_filter;
454 for (
auto const& isoObject : isoNeutralWeight_) {
455 if (filter2(isoObject))
456 isoNeutralWeight_filter.
push_back(isoObject);
458 isoNeutralWeight_ = isoNeutralWeight_filter;
460 isoCharged_ = isoCharged_filter;
463 bool failsOccupancyCut =
false;
464 bool failsSumPtCut =
false;
465 bool failsRelativeSumPtCut =
false;
468 int neutrals = isoNeutral_.
size();
477 size_t nOccupants = isoCharged_.size() + neutrals;
481 double footprintCorrection_value = 0.;
483 for (std::vector<std::unique_ptr<FootprintCorrection> >::const_iterator
footprintCorrection =
487 if ((*footprintCorrection)->selection_(*pfTau)) {
488 footprintCorrection_value = (*footprintCorrection)->offset_(*pfTau);
497 double chargedPt = 0.;
498 double neutralPt = 0.;
499 double weightedNeutralPt = 0.;
500 for (
auto const& isoObject : isoCharged_) {
501 chargedPt += isoObject->pt();
504 for (
auto const& isoObject : isoNeutral_) {
505 neutralPt += isoObject->pt();
508 for (
auto const& isoObject : isoNeutralWeight_) {
509 weightedNeutralPt += isoObject.pt();
512 for (
auto const& isoObject : isoPU_) {
513 puPt += isoObject->pt();
515 LogTrace(
"discriminate") <<
"chargedPt = " << chargedPt;
516 LogTrace(
"discriminate") <<
"neutralPt = " << neutralPt;
517 LogTrace(
"discriminate") <<
"weighted neutral Pt = " << weightedNeutralPt;
522 neutralPt = weightedNeutralPt;
530 neutralPt -= footprintCorrection_value;
537 if (neutralPt < 0.) {
550 bool failsPhotonPtSumOutsideSignalConeCut =
false;
551 double photonSumPt_outsideSignalCone = 0.;
553 const std::vector<reco::CandidatePtr>& signalGammas = pfTau->signalGammaCands();
554 for (std::vector<reco::CandidatePtr>::const_iterator signalGamma = signalGammas.begin();
555 signalGamma != signalGammas.end();
557 double dR =
deltaR(pfTau->eta(), pfTau->phi(), (*signalGamma)->eta(), (*signalGamma)->phi());
558 if (dR > pfTau->signalConeSize())
559 photonSumPt_outsideSignalCone += (*signalGamma)->pt();
563 failsPhotonPtSumOutsideSignalConeCut =
true;
589 return footprintCorrection_value;
591 return photonSumPt_outsideSignalCone;
593 return (fails ? 0. : 1.);
std::unique_ptr< tau::RecoTauQualityCuts > pileupQcutsGeneralQCuts_
bool isNonnull() const
Checks for non-null.
bool applyPhotonPtSumOutsideSignalConeCut_
double maximumRelativeSumPt_
bool applyRelativeSumPtCut_
double deltaBetaFactorThisEvent_
bool applyFootprintCorrection_
double offsetRelativeSumPt_
std::vector< std::unique_ptr< FootprintCorrection > > footprintCorrections_
bool storeRawFootprintCorrection_
double weightedSum(const std::vector< CandidatePtr > &inColl_, double eta, double phi) const
double deltaBetaCollectionCone_
std::vector< reco::CandidatePtr > chargedPFCandidatesInEvent_
uint32_t maximumOccupancy_
double maxRelPhotonSumPt_outsideSignalCone_
std::unique_ptr< tau::RecoTauQualityCuts > pileupQcutsPUTrackSelection_
double maxAbsPhotonSumPt_outsideSignalCone_
bool storeRawPhotonSumPt_outsideSignalCone_
std::unique_ptr< tau::RecoTauQualityCuts > qcuts_
std::unique_ptr< tau::RecoTauVertexAssociator > vertexAssociator_