diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index ef26c0f7b06..7dbef51d646 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -369,8 +369,6 @@ struct HyperkinkRecoTask { Service ccdb; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - std::vector mcPartIndices; - // Histograms are defined with HistogramRegistry HistogramRegistry registry{"registry", {}}; @@ -590,17 +588,17 @@ struct HyperkinkRecoTask { auto motherTrackPar = getTrackParCov(trackMoth); o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; std::array pMotherPv = {-999.f}; + std::array updatePMotherPv = {-999.f}; if (o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT)) { motherTrackPar.getPxPyPzGlo(pMotherPv); + if (motherTrackPar.update(primaryVtx)) { + motherTrackPar.getPxPyPzGlo(updatePMotherPv); + } } + hypkinkCand.momMothPV[0] = pMotherPv[0]; hypkinkCand.momMothPV[1] = pMotherPv[1]; hypkinkCand.momMothPV[2] = pMotherPv[2]; - - std::array updatePMotherPv = {-999.f}; - if (motherTrackPar.update(primaryVtx)) { - motherTrackPar.getPxPyPzGlo(updatePMotherPv); - } hypkinkCand.updateMomMothPV[0] = updatePMotherPv[0]; hypkinkCand.updateMomMothPV[1] = updatePMotherPv[1]; hypkinkCand.updateMomMothPV[2] = updatePMotherPv[2]; @@ -714,23 +712,27 @@ struct HyperkinkRecoTask { void processMC(MCLabeledCollisionsFull const& collisions, aod::KinkCands const& KinkCands, MCLabeledTracksIU const& tracks, aod::McParticles const& particlesMC, aod::McCollisions const& mcCollisions, aod::BCsWithTimestamps const&) { - mcPartIndices.clear(); std::vector mcPartIndices; setTrackIDForMC(mcPartIndices, particlesMC, tracks); + std::vector signalIndicesPool; std::vector isReconstructedMCCollisions(mcCollisions.size(), false); std::vector isSelectedMCCollisions(mcCollisions.size(), false); std::vector isGoodCollisions(collisions.size(), false); std::vector dauIDList(2, -1); for (const auto& collision : collisions) { - isReconstructedMCCollisions[collision.mcCollisionId()] = true; + if (collision.has_mcCollision()) { + isReconstructedMCCollisions[collision.mcCollisionId()] = true; + } registry.fill(HIST("hEventCounter"), 0); if (doEventCut && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || std::abs(collision.posZ()) > maxZVertex)) { continue; } registry.fill(HIST("hEventCounter"), 1); registry.fill(HIST("hVertexZCollision"), collision.posZ()); - isSelectedMCCollisions[collision.mcCollisionId()] = true; + if (collision.has_mcCollision()) { + isSelectedMCCollisions[collision.mcCollisionId()] = true; + } isGoodCollisions[collision.globalIndex()] = true; } @@ -883,7 +885,7 @@ struct HyperkinkRecoTask { hypkinkCand.isSignal = true; hypkinkCand.isSignalReco = true; fillCandidateMCInfo(hypkinkCand, mcMothTrack, mcDaugTrack, mcNeutTrack); - mcPartIndices.push_back(mcMothTrack.globalIndex()); + signalIndicesPool.push_back(mcMothTrack.globalIndex()); std::array dcaInfo; auto mcMothTrackPar = getTrackParFromMC(mcMothTrack, 2); @@ -934,7 +936,7 @@ struct HyperkinkRecoTask { continue; } - if (std::find(mcPartIndices.begin(), mcPartIndices.end(), mcparticle.globalIndex()) != mcPartIndices.end()) { + if (std::find(signalIndicesPool.begin(), signalIndicesPool.end(), mcparticle.globalIndex()) != signalIndicesPool.end()) { continue; } @@ -1243,13 +1245,16 @@ struct HyperkinkQa { setTrackIDForMC(mcPartIndices, particlesMC, tracks); std::vector isSelectedMCCollisions(mcCollisions.size(), false); std::vector dauIDList(2, -1); + for (const auto& collision : collisions) { genQAHist.fill(HIST("hCollCounter"), 0.5); if (doEventCut && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || std::abs(collision.posZ()) > maxZVertex)) { continue; } genQAHist.fill(HIST("hCollCounter"), 1.5); - isSelectedMCCollisions[collision.mcCollisionId()] = true; + if (collision.has_mcCollision()) { + isSelectedMCCollisions[collision.mcCollisionId()] = true; + } } for (const auto& mcCollision : mcCollisions) {