Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect against particles with zero weight and pt being given to njettiness [12_5_X] #40092

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions RecoBTag/SecondaryVertex/plugins/BoostedDoubleSVProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,7 @@ void BoostedDoubleSVProducer::calcNsubjettiness(const reco::JetBaseRef& jet,
// loop over subjet constituents and push them in the vector of FastJet constituents
for (size_t i = 0; i < daughter->numberOfDaughters(); ++i) {
const reco::CandidatePtr& constit = subjet->daughterPtr(i);

if (constit.isNonnull()) {
if (constit.isNonnull() && constit->pt() > std::numeric_limits<double>::epsilon()) {
// Check if any values were nan or inf
float valcheck = constit->px() + constit->py() + constit->pz() + constit->energy();
if (edm::isNotFinite(valcheck)) {
Expand All @@ -679,10 +678,13 @@ void BoostedDoubleSVProducer::calcNsubjettiness(const reco::JetBaseRef& jet,
<< "BoostedDoubleSVProducer: No weights (e.g. PUPPI) given for weighted jet collection"
<< std::endl;
}
fjParticles.push_back(
fastjet::PseudoJet(constit->px() * w, constit->py() * w, constit->pz() * w, constit->energy() * w));
} else
if (w > 0) {
fjParticles.push_back(
fastjet::PseudoJet(constit->px() * w, constit->py() * w, constit->pz() * w, constit->energy() * w));
}
} else {
fjParticles.push_back(fastjet::PseudoJet(constit->px(), constit->py(), constit->pz(), constit->energy()));
}
} else
edm::LogWarning("MissingJetConstituent")
<< "Jet constituent required for N-subjettiness computation is missing!";
Expand All @@ -703,10 +705,13 @@ void BoostedDoubleSVProducer::calcNsubjettiness(const reco::JetBaseRef& jet,
throw cms::Exception("MissingConstituentWeight")
<< "BoostedDoubleSVProducer: No weights (e.g. PUPPI) given for weighted jet collection" << std::endl;
}
fjParticles.push_back(
fastjet::PseudoJet(daughter->px() * w, daughter->py() * w, daughter->pz() * w, daughter->energy() * w));
} else
if (w > 0 && daughter->pt() > std::numeric_limits<double>::epsilon()) {
fjParticles.push_back(
fastjet::PseudoJet(daughter->px() * w, daughter->py() * w, daughter->pz() * w, daughter->energy() * w));
}
} else {
fjParticles.push_back(fastjet::PseudoJet(daughter->px(), daughter->py(), daughter->pz(), daughter->energy()));
}
}
} else
edm::LogWarning("MissingJetConstituent") << "Jet constituent required for N-subjettiness computation is missing!";
Expand Down