From ddf16a82a5cff0f5458e0672720b8f63a1aa3ee3 Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi Date: Tue, 3 Jun 2025 10:27:15 +0200 Subject: [PATCH 1/2] Fix MC information for primaries and secondaries --- PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx | 28 ++++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index 712e3611013..2c73839ae81 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx @@ -1017,16 +1017,15 @@ struct nucleiSpectra { if (pdg != nuclei::codes[iS]) { continue; } - uint16_t flags{kIsPhysicalPrimary}; - if (particle.isPhysicalPrimary()) { - if (particle.y() > cfgCutRapidityMin && particle.y() < cfgCutRapidityMax) { - nuclei::hGenNuclei[iS][particle.pdgCode() < 0]->Fill(1., particle.pt()); - } + if (particle.y() < cfgCutRapidityMin || particle.y() > cfgCutRapidityMax) { + continue; } - if (!isReconstructed[index] && (cfgTreeConfig->get(iS, 0u) || cfgTreeConfig->get(iS, 1u))) { - float absDecL = computeAbsoDecL(particle); - int motherPdgCode = 0; + uint16_t flags = 0; + int motherPdgCode = 0; + if (particle.isPhysicalPrimary()) { + flags |= kIsPhysicalPrimary; + nuclei::hGenNuclei[iS][particle.pdgCode() < 0]->Fill(1., particle.pt()); if (particle.has_mothers()) { for (auto& motherparticle : particle.mothers_as()) { if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) { @@ -1036,6 +1035,19 @@ struct nucleiSpectra { } } } + } + else if (particle.has_mothers()) { + flags |= kIsSecondaryFromWeakDecay; + for (auto& motherparticle : particle.mothers_as()) { + motherPdgCode = motherparticle.pdgCode(); + } + } else { + flags |= kIsSecondaryFromMaterial; + } + + if (!isReconstructed[index] && (cfgTreeConfig->get(iS, 0u) || cfgTreeConfig->get(iS, 1u))) { + float absDecL = computeAbsoDecL(particle); + nucleiTableMC(999., 999., 999., 0., 0., 999., 999., 999., -1, -1, -1, -1, flags, 0, 0, 0, 0, 0, 0, particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), motherPdgCode, goodCollisions[particle.mcCollisionId()], absDecL); } break; From f722d4597d48dccdb042be638b1eb6f2a7e7312d Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 3 Jun 2025 08:28:44 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index 2c73839ae81..551fbb56e6d 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx @@ -1035,8 +1035,7 @@ struct nucleiSpectra { } } } - } - else if (particle.has_mothers()) { + } else if (particle.has_mothers()) { flags |= kIsSecondaryFromWeakDecay; for (auto& motherparticle : particle.mothers_as()) { motherPdgCode = motherparticle.pdgCode();