Skip to content

Commit d223715

Browse files
authored
PWGHF: Add protection in RecoDecay before asking particle mass (#5296)
1 parent aca070f commit d223715

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Analysis/Core/include/AnalysisCore/RecoDecay.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,12 @@ class RecoDecay
501501
}
502502
}
503503
// Get the mass of the new particle and add it in the list.
504-
auto newMass = TDatabasePDG::Instance()->GetParticle(pdg)->Mass();
504+
const TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(pdg);
505+
if (!particle) { // Check that it's there
506+
LOGF(fatal, "Cannot find particle mass for PDG code %i", pdg);
507+
return 999.;
508+
}
509+
auto newMass = particle->Mass();
505510
mListMass.push_back(std::make_tuple(pdg, newMass));
506511
return newMass;
507512
}

0 commit comments

Comments
 (0)