338 LogDebug(
"discriminate") <<
" tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
342 std::vector<CandidatePtr> isoCharged_;
343 std::vector<CandidatePtr> isoNeutral_;
344 std::vector<CandidatePtr> isoPU_;
345 std::vector<CandidatePtr> isoPUall_;
348 std::vector<CandidatePtr> chPV_;
349 std::vector<CandidatePtr> chPVall_;
350 isoCharged_.
reserve(pfTau->isolationChargedHadrCands().size());
351 isoNeutral_.reserve(pfTau->isolationGammaCands().size());
354 isoNeutralWeight_.
reserve(pfTau->isolationGammaCands().size());
355 isoNeutralWeight_UseAllPFCands_.
reserve(pfTau->isolationGammaCands().size());
366 LogTrace(
"discriminate") <<
"pv: x = " << pv->position().x() <<
", y = " << pv->position().y()
367 <<
", z = " << pv->position().z();
369 LogTrace(
"discriminate") <<
"pv: N/A";
371 if (pfTau->leadChargedHadrCand().
isNonnull()) {
372 LogTrace(
"discriminate") <<
"leadPFChargedHadron:"
373 <<
" Pt = " << pfTau->leadChargedHadrCand()->pt() <<
","
374 <<
" eta = " << pfTau->leadChargedHadrCand()->eta() <<
","
375 <<
" phi = " << pfTau->leadChargedHadrCand()->phi();
377 LogTrace(
"discriminate") <<
"leadPFChargedHadron: N/A";
386 qcuts_->setLeadTrack(*pfTau->leadChargedHadrCand());
397 for (
auto const& cand : pfTau->isolationChargedHadrCands()) {
398 if (
qcuts_->filterCandRef(cand)) {
399 LogTrace(
"discriminate") <<
"adding charged iso cand with pt " << cand->pt();
400 isoCharged_.push_back(cand);
405 for (
auto const& cand : pfTau->isolationGammaCands()) {
406 if (
qcuts_->filterCandRef(cand)) {
407 LogTrace(
"discriminate") <<
"adding neutral iso cand with pt " << cand->pt();
408 isoNeutral_.push_back(cand);
426 LogTrace(
"discriminate") <<
"After track cuts: " << allPU.size();
433 LogTrace(
"discriminate") <<
"After cleaning cuts: " << cleanPU.size();
437 for (
auto const& cand : cleanPU) {
438 if (deltaBetaFilter(cand))
439 isoPU_.push_back(cand);
442 for (
auto const& cand : cleanNPU) {
443 if (deltaBetaFilter(cand))
444 chPV_.push_back(cand);
446 LogTrace(
"discriminate") <<
"After cone cuts: " << isoPU_.size() <<
" " << chPV_.size();
452 for (
auto const& isoObject : isoNeutral_) {
453 if (isoObject->charge() != 0) {
456 isoNeutralWeight_UseAllPFCands_.
push_back(*isoObject);
460 double eta = isoObject->eta();
461 double phi = isoObject->phi();
467 if ((sumNPU + sumPU) > 0)
468 neutral.setP4(((sumNPU) / (sumNPU + sumPU)) * neutral.p4());
477 if ((sumNPU + sumPU) > 0)
478 neutral.setP4(((sumNPU) / (sumNPU + sumPU)) * neutral.p4());
480 isoNeutralWeight_UseAllPFCands_.
push_back(neutral);
489 std::vector<CandidatePtr> isoCharged_filter;
490 std::vector<CandidatePtr> isoNeutral_filter;
492 for (
auto const& isoObject : isoCharged_) {
494 isoCharged_filter.push_back(isoObject);
496 isoCharged_ = isoCharged_filter;
497 for (
auto const& isoObject : isoNeutral_) {
499 isoNeutral_filter.push_back(isoObject);
501 isoNeutral_ = isoNeutral_filter;
504 for (
auto const& isoObject : isoNeutralWeight_) {
505 if (filter2(isoObject))
506 isoNeutralWeight_filter.
push_back(isoObject);
508 isoNeutralWeight_ = isoNeutralWeight_filter;
512 for (
auto const& isoObject : isoNeutralWeight_UseAllPFCands_) {
513 if (filter2(isoObject))
514 isoNeutralWeight_filter.
push_back(isoObject);
516 isoNeutralWeight_UseAllPFCands_ = isoNeutralWeight_filter;
524 int neutrals = isoNeutral_.size();
533 int nOccupants = isoCharged_.size() + neutrals;
535 double footprintCorrection_value = 0.;
537 for (
std::vector<std::unique_ptr<FootprintCorrection>>::const_iterator footprintCorrection =
540 ++footprintCorrection) {
541 if ((*footprintCorrection)->selection_(*pfTau)) {
542 footprintCorrection_value = (*footprintCorrection)->offset_(*pfTau);
551 double chargedPt = 0.;
552 double neutralPt = 0.;
553 double weightedNeutralPt = 0.;
555 for (
auto const& isoObject : isoCharged_) {
556 chargedPt += isoObject->pt();
562 for (
auto const& isoObject : isoNeutralWeight_UseAllPFCands_) {
563 weightedNeutralPt += isoObject.pt();
566 for (
auto const& isoObject : isoNeutralWeight_) {
567 weightedNeutralPt += isoObject.pt();
571 for (
auto const& isoObject : isoNeutral_) {
572 neutralPt += isoObject->pt();
575 for (
auto const& isoObject : isoPU_) {
576 puPt += isoObject->pt();
578 LogTrace(
"discriminate") <<
"chargedPt = " << chargedPt;
579 LogTrace(
"discriminate") <<
"neutralPt = " << neutralPt;
580 LogTrace(
"discriminate") <<
"weighted neutral Pt = " << weightedNeutralPt;
585 neutralPt = weightedNeutralPt;
593 neutralPt -= footprintCorrection_value;
600 if (neutralPt < 0.) {
607 double photonSumPt_outsideSignalCone = 0.;
609 const std::vector<reco::CandidatePtr>& signalGammas = pfTau->signalGammaCands();
610 for (std::vector<reco::CandidatePtr>::const_iterator signalGamma = signalGammas.begin();
611 signalGamma != signalGammas.end();
613 double dR =
deltaR(pfTau->eta(), pfTau->phi(), (*signalGamma)->eta(), (*signalGamma)->phi());
614 if (dR > pfTau->signalConeSize())
615 photonSumPt_outsideSignalCone += (*signalGamma)->pt();
632 result.
rawValues.push_back(footprintCorrection_value);
634 result.
rawValues.push_back(photonSumPt_outsideSignalCone);
650 pass = rawValue <=
maxRelValue_[
i][
j] * (pfTau->pt() - offsetRelValue_[
i][
j]);
static std::vector< std::string > checklist log
bool isNonnull() const
Checks for non-null.
std::unique_ptr< tau::RecoTauQualityCuts > pileupQcutsGeneralQCuts_
std::vector< std::vector< double > > maxRelValue_
std::vector< bool > applyDeltaBetaCorrection_
std::vector< std::vector< double > > maxAbsValue_
std::unique_ptr< tau::RecoTauQualityCuts > pileupQcutsPUTrackSelection_
std::unique_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
std::vector< StoredRawType > storeRawValue_
double weightedSum(const std::vector< CandidatePtr > &inColl_, double eta, double phi) const
std::vector< std::unique_ptr< FootprintCorrection > > footprintCorrections_
std::vector< bool > workingPoints
std::vector< bool > calculateWeights_
std::vector< bool > includeGammas_
double deltaBetaFactorThisEvent_
double deltaBetaCollectionCone_
std::vector< bool > useAllPFCandsForWeights_
std::vector< std::vector< double > > offsetRelValue_
std::vector< std::vector< int > > rawValue_reference_
bool applyFootprintCorrection_
std::vector< reco::CandidatePtr > chargedPFCandidatesInEvent_
std::unique_ptr< tau::RecoTauQualityCuts > qcuts_
std::vector< bool > includeTracks_
std::vector< float > rawValues