309 LogDebug(
"discriminate") <<
" tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
313 std::vector<CandidatePtr> isoCharged_;
314 std::vector<CandidatePtr> isoNeutral_;
315 std::vector<CandidatePtr> isoPU_;
317 std::vector<CandidatePtr> chPV_;
318 isoCharged_.
reserve(pfTau->isolationChargedHadrCands().size());
319 isoNeutral_.reserve(pfTau->isolationGammaCands().size());
321 isoNeutralWeight_.
reserve(pfTau->isolationGammaCands().size());
330 if (
pv.isNonnull()) {
331 LogTrace(
"discriminate") <<
"pv: x = " <<
pv->position().x() <<
", y = " <<
pv->position().y()
332 <<
", z = " <<
pv->position().z();
334 LogTrace(
"discriminate") <<
"pv: N/A";
336 if (pfTau->leadChargedHadrCand().
isNonnull()) {
337 LogTrace(
"discriminate") <<
"leadPFChargedHadron:" 338 <<
" Pt = " << pfTau->leadChargedHadrCand()->pt() <<
"," 339 <<
" eta = " << pfTau->leadChargedHadrCand()->eta() <<
"," 340 <<
" phi = " << pfTau->leadChargedHadrCand()->phi();
342 LogTrace(
"discriminate") <<
"leadPFChargedHadron: N/A";
347 if (!(
pv.isNonnull() && pfTau->leadChargedHadrCand().
isNonnull()))
351 qcuts_->setLeadTrack(*pfTau->leadChargedHadrCand());
362 for (
auto const&
cand : pfTau->isolationChargedHadrCands()) {
364 LogTrace(
"discriminate") <<
"adding charged iso cand with pt " <<
cand->pt();
365 isoCharged_.push_back(
cand);
370 for (
auto const&
cand : pfTau->isolationGammaCands()) {
372 LogTrace(
"discriminate") <<
"adding neutral iso cand with pt " <<
cand->pt();
373 isoNeutral_.push_back(
cand);
391 LogTrace(
"discriminate") <<
"After track cuts: " << allPU.size();
399 LogTrace(
"discriminate") <<
"After cleaning cuts: " << cleanPU.size();
403 for (
auto const&
cand : cleanPU) {
404 if (deltaBetaFilter(
cand))
405 isoPU_.push_back(
cand);
408 for (
auto const&
cand : cleanNPU) {
409 if (deltaBetaFilter(
cand))
410 chPV_.push_back(
cand);
412 LogTrace(
"discriminate") <<
"After cone cuts: " << isoPU_.size() <<
" " << chPV_.size();
420 for (
auto const& isoObject : isoNeutral_) {
421 if (isoObject->charge() != 0) {
427 double eta = isoObject->eta();
428 double phi = isoObject->phi();
433 if ((sumNPU + sumPU) > 0)
434 neutral.setP4(((sumNPU) / (sumNPU + sumPU)) * neutral.p4());
444 std::vector<CandidatePtr> isoCharged_filter;
445 std::vector<CandidatePtr> isoNeutral_filter;
448 for (
auto const& isoObject : isoCharged_) {
453 for (
auto const& isoObject : isoNeutral_) {
455 isoNeutral_filter.push_back(isoObject);
457 isoNeutral_ = isoNeutral_filter;
459 for (
auto const& isoObject : isoNeutralWeight_) {
460 if (filter2(isoObject))
461 isoNeutralWeight_filter.
push_back(isoObject);
463 isoNeutralWeight_ = isoNeutralWeight_filter;
465 isoCharged_ = isoCharged_filter;
468 bool failsOccupancyCut =
false;
469 bool failsSumPtCut =
false;
470 bool failsRelativeSumPtCut =
false;
473 int neutrals = isoNeutral_.
size();
482 size_t nOccupants = isoCharged_.size() + neutrals;
486 double footprintCorrection_value = 0.;
488 for (
std::vector<std::unique_ptr<FootprintCorrection> >::const_iterator footprintCorrection =
491 ++footprintCorrection) {
492 if ((*footprintCorrection)->selection_(*pfTau)) {
493 footprintCorrection_value = (*footprintCorrection)->offset_(*pfTau);
502 double chargedPt = 0.;
503 double neutralPt = 0.;
504 double weightedNeutralPt = 0.;
505 for (
auto const& isoObject : isoCharged_) {
510 double trackPt = (isoObject->bestTrack()) ? isoObject->bestTrack()->pt() : 0.;
511 double pfCandPt = isoObject->pt();
514 neutralPt += pfCandPt -
trackPt;
516 chargedPt += isoObject->pt();
519 chargedPt += isoObject->pt();
524 for (
auto const& isoObject : isoNeutral_) {
525 neutralPt += isoObject->pt();
528 for (
auto const& isoObject : isoNeutralWeight_) {
529 weightedNeutralPt += isoObject.pt();
532 for (
auto const& isoObject : isoPU_) {
533 puPt += isoObject->pt();
535 LogTrace(
"discriminate") <<
"chargedPt = " << chargedPt;
536 LogTrace(
"discriminate") <<
"neutralPt = " << neutralPt;
537 LogTrace(
"discriminate") <<
"weighted neutral Pt = " << weightedNeutralPt;
542 neutralPt = weightedNeutralPt;
550 neutralPt -= footprintCorrection_value;
557 if (neutralPt < 0.) {
570 bool failsPhotonPtSumOutsideSignalConeCut =
false;
571 double photonSumPt_outsideSignalCone = 0.;
573 const std::vector<reco::CandidatePtr>& signalGammas = pfTau->signalGammaCands();
574 for (std::vector<reco::CandidatePtr>::const_iterator signalGamma = signalGammas.begin();
575 signalGamma != signalGammas.end();
577 double dR =
deltaR(pfTau->eta(), pfTau->phi(), (*signalGamma)->eta(), (*signalGamma)->phi());
578 if (
dR > pfTau->signalConeSize())
579 photonSumPt_outsideSignalCone += (*signalGamma)->pt();
583 failsPhotonPtSumOutsideSignalConeCut =
true;
609 return footprintCorrection_value;
611 return photonSumPt_outsideSignalCone;
613 return (fails ? 0. : 1.);
std::unique_ptr< tau::RecoTauQualityCuts > pileupQcutsGeneralQCuts_
bool enableHGCalWorkaround_
bool applyPhotonPtSumOutsideSignalConeCut_
bool isNonnull() const
Checks for non-null.
double maximumRelativeSumPt_
bool applyRelativeSumPtCut_
double deltaBetaFactorThisEvent_
bool applyFootprintCorrection_
double offsetRelativeSumPt_
std::vector< std::unique_ptr< FootprintCorrection > > footprintCorrections_
bool storeRawFootprintCorrection_
double deltaBetaCollectionCone_
std::vector< reco::CandidatePtr > chargedPFCandidatesInEvent_
double weightedSum(const std::vector< CandidatePtr > &inColl_, double eta, double phi) const
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_