Skip to content

Commit f8b094d

Browse files
authored
U
1 parent 9b434cd commit f8b094d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ALICE3/Core/DelphesO2LutWriter.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,15 @@ void DelphesO2LutWriter::lutWrite(const char* filename, int pdg, float field, si
233233
lutHeader_t lutHeader;
234234
// pid
235235
lutHeader.pdg = pdg;
236-
lutHeader.mass = TDatabasePDG::Instance()->GetParticle(pdg)->Mass();
237-
const int q = std::abs(TDatabasePDG::Instance()->GetParticle(pdg)->Charge()) / 3;
236+
const TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(pdg);
237+
if (!particle) {
238+
LOG(fatal) << "Cannot find particle with PDG code " << pdg;
239+
return;
240+
}
241+
lutHeader.mass = particle->Mass();
242+
const int q = std::abs(particle->Charge()) / 3;
238243
if (q <= 0) {
239-
LOGF(info, "Negative or null charge (%f) for pdg code %i. Fix the charge!", TDatabasePDG::Instance()->GetParticle(pdg)->Charge(), pdg);
244+
LOGF(info, "Negative or null charge (%f) for pdg code %i. Fix the charge!", particle->Charge(), pdg);
240245
return;
241246
}
242247
lutHeader.field = field;

0 commit comments

Comments
 (0)