Skip to content

Commit ddf16a8

Browse files
author
Francesco Mazzaschi
committed
Fix MC information for primaries and secondaries
1 parent f8f8fbc commit ddf16a8

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx

Lines changed: 20 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,19 @@ struct nucleiSpectra {
10361035
}
10371036
}
10381037
}
1038+
}
1039+
else if (particle.has_mothers()) {
1040+
flags |= kIsSecondaryFromWeakDecay;
1041+
for (auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
1042+
motherPdgCode = motherparticle.pdgCode();
1043+
}
1044+
} else {
1045+
flags |= kIsSecondaryFromMaterial;
1046+
}
1047+
1048+
if (!isReconstructed[index] && (cfgTreeConfig->get(iS, 0u) || cfgTreeConfig->get(iS, 1u))) {
1049+
float absDecL = computeAbsoDecL(particle);
1050+
10391051
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);
10401052
}
10411053
break;

0 commit comments

Comments
 (0)