Skip to content

Commit 1eca322

Browse files
authored
Refactor PDG mismatch handling for special cases
1 parent 7dd97f6 commit 1eca322

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

ALICE3/Core/DelphesO2TrackSmearer.cxx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,20 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
105105
mLUTHeader[ipdg] = nullptr;
106106
return false;
107107
}
108-
if (mLUTHeader[ipdg]->pdg != pdg) {
109-
// Special case: Allow Alpha particles to use He3 LUT
110-
if (pdg == o2::constants::physics::kAlpha && mLUTHeader[ipdg]->pdg == o2::constants::physics::kHelium3) {
108+
bool specialPdgCase = false;
109+
switch(mLUTHeader[ipdg]->pdg) { // Handle special cases
110+
case o2::constants::physics::kAlpha; // Special case: Allow Alpha particles to use He3 LUT
111+
specialPdgCase = (mLUTHeader[ipdg]->pdg == o2::constants::physics::kHelium3);
112+
if (specialPdgCase)
111113
LOG(info) << " --- Alpha particles (PDG " << pdg << ") will use He3 LUT data (PDG " << mLUTHeader[ipdg]->pdg << ")" << std::endl;
112-
} else {
113-
LOG(info) << " --- LUT header PDG mismatch: expected/detected = " << pdg << "/" << mLUTHeader[ipdg]->pdg << std::endl;
114-
delete mLUTHeader[ipdg];
115-
mLUTHeader[ipdg] = nullptr;
116-
return false;
117-
}
114+
break;
115+
default:
116+
}
117+
if (mLUTHeader[ipdg]->pdg != pdg && !specialPdgCase) {
118+
LOG(info) << " --- LUT header PDG mismatch: expected/detected = " << pdg << "/" << mLUTHeader[ipdg]->pdg << std::endl;
119+
delete mLUTHeader[ipdg];
120+
mLUTHeader[ipdg] = nullptr;
121+
return false;
118122
}
119123
const int nnch = mLUTHeader[ipdg]->nchmap.nbins;
120124
const int nrad = mLUTHeader[ipdg]->radmap.nbins;

0 commit comments

Comments
 (0)