Skip to content

Commit aa618e8

Browse files
authored
[PWGLF] Fix MC information for primaries and secondaries (#11452)
1 parent b3abf9d commit aa618e8

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,16 +1017,15 @@ struct nucleiSpectra {
10171017
if (pdg != nuclei::codes[iS]) {
10181018
continue;
10191019
}
1020-
uint16_t flags{kIsPhysicalPrimary};
1021-
if (particle.isPhysicalPrimary()) {
1022-
if (particle.y() > cfgCutRapidityMin && particle.y() < cfgCutRapidityMax) {
1023-
nuclei::hGenNuclei[iS][particle.pdgCode() < 0]->Fill(1., particle.pt());
1024-
}
1020+
if (particle.y() < cfgCutRapidityMin || particle.y() > cfgCutRapidityMax) {
1021+
continue;
10251022
}
10261023

1027-
if (!isReconstructed[index] && (cfgTreeConfig->get(iS, 0u) || cfgTreeConfig->get(iS, 1u))) {
1028-
float absDecL = computeAbsoDecL(particle);
1029-
int motherPdgCode = 0;
1024+
uint16_t flags = 0;
1025+
int motherPdgCode = 0;
1026+
if (particle.isPhysicalPrimary()) {
1027+
flags |= kIsPhysicalPrimary;
1028+
nuclei::hGenNuclei[iS][particle.pdgCode() < 0]->Fill(1., particle.pt());
10301029
if (particle.has_mothers()) {
10311030
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
10321031
if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) {
@@ -1036,6 +1035,18 @@ struct nucleiSpectra {
10361035
}
10371036
}
10381037
}
1038+
} else if (particle.has_mothers()) {
1039+
flags |= kIsSecondaryFromWeakDecay;
1040+
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
1041+
motherPdgCode = motherparticle.pdgCode();
1042+
}
1043+
} else {
1044+
flags |= kIsSecondaryFromMaterial;
1045+
}
1046+
1047+
if (!isReconstructed[index] && (cfgTreeConfig->get(iS, 0u) || cfgTreeConfig->get(iS, 1u))) {
1048+
float absDecL = computeAbsoDecL(particle);
1049+
10391050
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);
10401051
}
10411052
break;

0 commit comments

Comments
 (0)