336 LogDebug(
"discriminate") <<
" tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
340 std::vector<CandidatePtr> isoCharged_;
341 std::vector<CandidatePtr> isoNeutral_;
342 std::vector<CandidatePtr> isoPU_;
343 std::vector<CandidatePtr> isoPUall_;
346 std::vector<CandidatePtr> chPV_;
347 std::vector<CandidatePtr> chPVall_;
348 isoCharged_.
reserve(pfTau->isolationChargedHadrCands().size());
349 isoNeutral_.reserve(pfTau->isolationGammaCands().size());
352 isoNeutralWeight_.
reserve(pfTau->isolationGammaCands().size());
353 isoNeutralWeight_UseAllPFCands_.
reserve(pfTau->isolationGammaCands().size());
363 if (
pv.isNonnull()) {
364 LogTrace(
"discriminate") <<
"pv: x = " <<
pv->position().x() <<
", y = " <<
pv->position().y()
365 <<
", z = " <<
pv->position().z();
367 LogTrace(
"discriminate") <<
"pv: N/A";
369 if (pfTau->leadChargedHadrCand().
isNonnull()) {
370 LogTrace(
"discriminate") <<
"leadPFChargedHadron:"
371 <<
" Pt = " << pfTau->leadChargedHadrCand()->pt() <<
","
372 <<
" eta = " << pfTau->leadChargedHadrCand()->eta() <<
","
373 <<
" phi = " << pfTau->leadChargedHadrCand()->phi();
375 LogTrace(
"discriminate") <<
"leadPFChargedHadron: N/A";
380 if (!(
pv.isNonnull() && pfTau->leadChargedHadrCand().
isNonnull()))
384 qcuts_->setLeadTrack(*pfTau->leadChargedHadrCand());
395 for (
auto const&
cand : pfTau->isolationChargedHadrCands()) {
397 LogTrace(
"discriminate") <<
"adding charged iso cand with pt " <<
cand->pt();
398 isoCharged_.push_back(
cand);
403 for (
auto const&
cand : pfTau->isolationGammaCands()) {
405 LogTrace(
"discriminate") <<
"adding neutral iso cand with pt " <<
cand->pt();
406 isoNeutral_.push_back(
cand);
424 LogTrace(
"discriminate") <<
"After track cuts: " << allPU.size();
431 LogTrace(
"discriminate") <<
"After cleaning cuts: " << cleanPU.size();
435 for (
auto const&
cand : cleanPU) {
436 if (deltaBetaFilter(
cand))
437 isoPU_.push_back(
cand);
440 for (
auto const&
cand : cleanNPU) {
441 if (deltaBetaFilter(
cand))
442 chPV_.push_back(
cand);
444 LogTrace(
"discriminate") <<
"After cone cuts: " << isoPU_.size() <<
" " << chPV_.size();
450 for (
auto const& isoObject : isoNeutral_) {
451 if (isoObject->charge() != 0) {
454 isoNeutralWeight_UseAllPFCands_.
push_back(*isoObject);
458 double eta = isoObject->eta();
459 double phi = isoObject->phi();
465 if ((sumNPU + sumPU) > 0)
466 neutral.setP4(((sumNPU) / (sumNPU + sumPU)) * neutral.p4());
475 if ((sumNPU + sumPU) > 0)
476 neutral.setP4(((sumNPU) / (sumNPU + sumPU)) * neutral.p4());
478 isoNeutralWeight_UseAllPFCands_.
push_back(neutral);
487 std::vector<CandidatePtr> isoCharged_filter;
488 std::vector<CandidatePtr> isoNeutral_filter;
490 for (
auto const& isoObject : isoCharged_) {
492 isoCharged_filter.push_back(isoObject);
494 isoCharged_ = isoCharged_filter;
495 for (
auto const& isoObject : isoNeutral_) {
497 isoNeutral_filter.push_back(isoObject);
499 isoNeutral_ = isoNeutral_filter;
502 for (
auto const& isoObject : isoNeutralWeight_) {
503 if (filter2(isoObject))
504 isoNeutralWeight_filter.
push_back(isoObject);
506 isoNeutralWeight_ = isoNeutralWeight_filter;
510 for (
auto const& isoObject : isoNeutralWeight_UseAllPFCands_) {
511 if (filter2(isoObject))
512 isoNeutralWeight_filter.
push_back(isoObject);
514 isoNeutralWeight_UseAllPFCands_ = isoNeutralWeight_filter;
522 int neutrals = isoNeutral_.size();
531 int nOccupants = isoCharged_.size() + neutrals;
533 double footprintCorrection_value = 0.;
535 for (std::vector<std::unique_ptr<FootprintCorrection>>::const_iterator footprintCorrection =
538 ++footprintCorrection) {
539 if ((*footprintCorrection)->selection_(*pfTau)) {
540 footprintCorrection_value = (*footprintCorrection)->offset_(*pfTau);
549 double chargedPt = 0.;
550 double neutralPt = 0.;
551 double weightedNeutralPt = 0.;
553 for (
auto const& isoObject : isoCharged_) {
554 chargedPt += isoObject->pt();
560 for (
auto const& isoObject : isoNeutralWeight_UseAllPFCands_) {
561 weightedNeutralPt += isoObject.pt();
564 for (
auto const& isoObject : isoNeutralWeight_) {
565 weightedNeutralPt += isoObject.pt();
569 for (
auto const& isoObject : isoNeutral_) {
570 neutralPt += isoObject->pt();
573 for (
auto const& isoObject : isoPU_) {
574 puPt += isoObject->pt();
576 LogTrace(
"discriminate") <<
"chargedPt = " << chargedPt;
577 LogTrace(
"discriminate") <<
"neutralPt = " << neutralPt;
578 LogTrace(
"discriminate") <<
"weighted neutral Pt = " << weightedNeutralPt;
583 neutralPt = weightedNeutralPt;
591 neutralPt -= footprintCorrection_value;
598 if (neutralPt < 0.) {
605 double photonSumPt_outsideSignalCone = 0.;
607 const std::vector<reco::CandidatePtr>& signalGammas = pfTau->signalGammaCands();
608 for (std::vector<reco::CandidatePtr>::const_iterator signalGamma = signalGammas.begin();
609 signalGamma != signalGammas.end();
611 double dR =
deltaR(pfTau->eta(), pfTau->phi(), (*signalGamma)->eta(), (*signalGamma)->phi());
612 if (
dR > pfTau->signalConeSize())
613 photonSumPt_outsideSignalCone += (*signalGamma)->pt();
619 result.rawValues.push_back(totalPt);
622 result.rawValues.push_back(puPt);
626 result.rawValues.push_back(0.);
628 result.rawValues.push_back(nOccupants);
630 result.rawValues.push_back(footprintCorrection_value);
632 result.rawValues.push_back(photonSumPt_outsideSignalCone);
653 result.workingPoints.push_back(pass);