diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index 712e3611013..551fbb56e6d 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,18 @@ 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;