Skip to content

Commit

Permalink
Adapt protection against zero weights or pt for SV producer
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnikaStein committed Nov 17, 2022
1 parent 3e63290 commit ee30e5a
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -389,7 +389,7 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con
std::vector<edm::Ptr<reco::Candidate> >::const_iterator m;
for (m = constituents.begin(); m != constituents.end(); ++m) {
reco::CandidatePtr constit = *m;
if (constit->pt() == 0) {
if (constit.isNull() || constit->pt() <= std::numeric_limits<double>::epsilon()) {
edm::LogWarning("NullTransverseMomentum") << "dropping input candidate with pt=0";
continue;
}
Expand All @@ -399,8 +399,10 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con
<< "TemplatedSecondaryVertexProducer: No weights (e.g. PUPPI) given for weighted jet collection"
<< std::endl;
float w = (*weightsHandle)[constit];
fjInputs.push_back(
fastjet::PseudoJet(constit->px() * w, constit->py() * w, constit->pz() * w, constit->energy() * w));
if (w > 0) {
fjInputs.push_back(
fastjet::PseudoJet(constit->px() * w, constit->py() * w, constit->pz() * w, constit->energy() * w));
}
} else {
fjInputs.push_back(fastjet::PseudoJet(constit->px(), constit->py(), constit->pz(), constit->energy()));
}
Expand All @@ -413,7 +415,7 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con
std::vector<edm::Ptr<reco::Candidate> >::const_iterator m;
for (m = constituents.begin(); m != constituents.end(); ++m) {
reco::CandidatePtr constit = *m;
if (constit->pt() == 0) {
if (constit.isNull() || constit->pt() <= std::numeric_limits<double>::epsilon()) {
edm::LogWarning("NullTransverseMomentum") << "dropping input candidate with pt=0";
continue;
}
Expand All @@ -423,8 +425,10 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con
<< "TemplatedSecondaryVertexProducer: No weights (e.g. PUPPI) given for weighted jet collection"
<< std::endl;
float w = (*weightsHandle)[constit];
fjInputs.push_back(
fastjet::PseudoJet(constit->px() * w, constit->py() * w, constit->pz() * w, constit->energy() * w));
if (w > 0) {
fjInputs.push_back(
fastjet::PseudoJet(constit->px() * w, constit->py() * w, constit->pz() * w, constit->energy() * w));
}
} else {
fjInputs.push_back(fastjet::PseudoJet(constit->px(), constit->py(), constit->pz(), constit->energy()));
}
Expand Down

0 comments on commit ee30e5a

Please sign in to comment.