Skip to content

Commit

Permalink
Merge pull request #44266 from mbluj/CMSSW_14_1_X_updateHybrProd
Browse files Browse the repository at this point in the history
Reduce complexity of erasing elements from vectors in PATTauHybridProducer
  • Loading branch information
cmsbuild authored Mar 3, 2024
2 parents 76b5b17 + b8a0932 commit decad3d
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,10 @@ void PATTauHybridProducer::fillTauFromJet(reco::PFTau& pfTau, const reco::JetBas
}
}
// Clean isolation candidates from low-pt and leptonic ones
for (CandPtrs::iterator it = pfChs.begin(); it != pfChs.end();) {
if ((*it)->pt() < 0.5 || std::abs((*it)->pdgId()) != 211) {
it = pfChs.erase(it);
} else {
++it;
}
}
pfChs.erase(std::remove_if(pfChs.begin(),
pfChs.end(),
[](auto const& cand) { return cand->pt() < 0.5 || std::abs(cand->pdgId()) != 211; }),
pfChs.end());
// Set charged candidates
pfTau.setsignalChargedHadrCands(pfChsSig);
pfTau.setisolationChargedHadrCands(pfChs);
Expand All @@ -388,13 +385,8 @@ void PATTauHybridProducer::fillTauFromJet(reco::PFTau& pfTau, const reco::JetBas
pfGammas.erase(pfGammas.begin());
}
// Clean gamma candidates from low-pt ones
for (CandPtrs::iterator it = pfGammas.begin(); it != pfGammas.end();) {
if ((*it)->pt() < 0.5) {
it = pfGammas.erase(it);
} else {
++it;
}
}
pfGammas.erase(std::remove_if(pfGammas.begin(), pfGammas.end(), [](auto const& cand) { return cand->pt() < 0.5; }),
pfGammas.end());
// if decay mode with pi0s is expected look for signal gamma candidates
// within eta-phi strips around leading track
if (pfTau.decayMode() % 5 != 0 && pfTau.leadChargedHadrCand().isNonnull()) {
Expand Down

0 comments on commit decad3d

Please sign in to comment.