Skip to content

Commit f4bf03e

Browse files
committed
Add Pdg to SourceType mapping
1 parent 5dca4c1 commit f4bf03e

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

PWGHF/HFL/Tasks/taskSingleElectron.cxx

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -320,25 +320,24 @@ struct HfTaskSingleElectron {
320320
if (mctrack.size()) {
321321
auto const& grmothersIdsVec = mctrack.front().mothersIds();
322322
if (grmothersIdsVec.empty()) {
323-
if (motherPdg == kPi0) {
324-
return Pi0;
325-
} else if (motherPdg == kEta) {
326-
return Eta;
327-
} else if (motherPdg == kOmega) {
328-
return Omega;
329-
} else if (motherPdg == kPhi) {
330-
return Phi;
331-
} else if (motherPdg == kEtaPrime) {
332-
return EtaPrime;
333-
} else if (motherPdg == kRho770_0) {
334-
return Rho0;
335-
} else if (motherPdg == kKPlus) {
336-
return Ke3;
337-
} else if (motherPdg == kK0Long) {
338-
return K0l;
339-
} else {
340-
return Else;
341-
}
323+
324+
static const std::map<int, SourceType> PdgToSource = {
325+
{kPi0, Pi0},
326+
{kEta, Eta},
327+
{kOmega, Omega},
328+
{kPhi, Phi},
329+
{kEtaPrime, EtaPrime},
330+
{kRho770_0, Rho0},
331+
{kKPlus, Ke3},
332+
{kK0Long, K0l}
333+
};
334+
335+
auto it = PdgToSource.find(motherPdg);
336+
if (it != PdgToSource.end()) {
337+
return it->second;
338+
}
339+
return Else;
340+
342341
} else {
343342
if (motherPdg == kPi0) {
344343
grmotherPt = mctrack.front().pt();

0 commit comments

Comments
 (0)