diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index 6a26cbef2b4..b5dc7ca67f2 100644 --- a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx @@ -964,23 +964,26 @@ struct hyperRecoTask { // now we fill only the signal candidates that were not reconstructed for (const auto& mcPart : particlesMC) { - if (std::abs(mcPart.pdgCode()) != hyperPdg) + if (std::abs(mcPart.pdgCode()) != hyperPdg) { continue; - std::array secVtx; + } + std::array secVtx{0.f, 0.f, 0.f}; + std::array lastDaugVtx{0.f, 0.f, 0.f}; std::array primVtx = {mcPart.vx(), mcPart.vy(), mcPart.vz()}; std::array momMother = {mcPart.px(), mcPart.py(), mcPart.pz()}; - std::array momHe3; + std::array momHe3{0.f, 0.f, 0.f}; bool isHeFound = false; int mcProcess = {0}; for (const auto& mcDaught : mcPart.daughters_as()) { + if (mcDaught.pdgCode() != PDG_t::kElectron) { // we do not care about delta electrons + lastDaugVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()}; + mcProcess = mcDaught.getProcess(); + } if (std::abs(mcDaught.pdgCode()) == heDauPdg) { - secVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()}; + secVtx = lastDaugVtx; momHe3 = {mcDaught.px(), mcDaught.py(), mcDaught.pz()}; isHeFound = true; } - if (mcDaught.pdgCode() != PDG_t::kElectron) { // we do not care about delta electrons - mcProcess = mcDaught.getProcess(); - } } if (mcPart.pdgCode() > 0) { hIsMatterGen->Fill(0.); @@ -1005,7 +1008,7 @@ struct hyperRecoTask { hypCand.isSurvEvSelection = isSurvEvSelCollision[mcPart.mcCollisionId()]; int chargeFactor = -1 + 2 * (hypCand.pdgCode > 0); for (int i = 0; i < 3; i++) { - hypCand.gDecVtx[i] = secVtx[i] - primVtx[i]; + hypCand.gDecVtx[i] = (isHeFound ? secVtx[i] : lastDaugVtx[i]) - primVtx[i]; hypCand.gMom[i] = momMother[i]; hypCand.gMomHe3[i] = momHe3[i]; }