From 5a334e9df27361ba0e129277a75ad281a53527c8 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Sun, 18 Jan 2026 18:28:12 +0100 Subject: [PATCH] Fix vertexing for charm baryons to cascades --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 189 +++++++++--------- 1 file changed, 89 insertions(+), 100 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index af82614aa68..959fe8bb950 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -3324,7 +3324,7 @@ struct HfTrackIndexSkimCreatorLfCascades { Configurable massXiPiPiMax{"massXiPiPiMax", 2.8, "Invariant mass upper limit for xi pi pi decay channel"}; // DCAFitter settings - Configurable propagateToPCA{"propagateToPCA", false, "create tracks version propagated to PCA"}; + Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; Configurable useAbsDCA{"useAbsDCA", true, "Minimise abs. distance rather than chi2"}; Configurable useWeightedFinalPCA{"useWeightedFinalPCA", true, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"}; Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; @@ -3551,6 +3551,7 @@ struct HfTrackIndexSkimCreatorLfCascades { template bool isSelectedCandidateXic(const T1& pVecCand, const T2& secVtx, const T3& primVtx) { + // pT if (config.ptMinXicplusLfCasc > 0.f) { const auto pt = RecoDecay::pt(pVecCand); @@ -3706,34 +3707,27 @@ struct HfTrackIndexSkimCreatorLfCascades { } if (nVtxFrom2ProngFitterXiHyp > 0) { - - df2.propagateTracksToVertex(); - - if (df2.isPropagateTracksToVertexDone()) { - std::array pVecXi{}; - std::array pVecPion1XiHyp{}; - df2.getTrack(0).getPxPyPzGlo(pVecXi); - df2.getTrack(1).getPxPyPzGlo(pVecPion1XiHyp); - const float ptXic = RecoDecay::pt(pVecXi, pVecPion1XiHyp); - - const std::array arrMomToXi{pVecXi, pVecPion1XiHyp}; - const auto mass2ProngXiHyp = RecoDecay::m(arrMomToXi, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi]); - - if ((std::abs(casc.mXi() - MassXiMinus) < config.cascadeMassWindow) && (mass2ProngXiHyp >= config.massXiPiMin) && (mass2ProngXiHyp <= config.massXiPiMax)) { - registry.fill(HIST("hRejpTStatusXicZeroOmegacZeroToXiPi"), 0); - if (ptXic >= config.ptMinXicZeroOmegacZeroToXiPiLfCasc) { - SETBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi); - registry.fill(HIST("hRejpTStatusXicZeroOmegacZeroToXiPi"), 1); - } + std::array pVecXi{}; + std::array pVecPion1XiHyp{}; + df2.getTrack(0).getPxPyPzGlo(pVecXi); + df2.getTrack(1).getPxPyPzGlo(pVecPion1XiHyp); + const float ptXic = RecoDecay::pt(pVecXi, pVecPion1XiHyp); + + const std::array arrMomToXi{pVecXi, pVecPion1XiHyp}; + const auto mass2ProngXiHyp = RecoDecay::m(arrMomToXi, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi]); + + if ((std::abs(casc.mXi() - MassXiMinus) < config.cascadeMassWindow) && (mass2ProngXiHyp >= config.massXiPiMin) && (mass2ProngXiHyp <= config.massXiPiMax)) { + registry.fill(HIST("hRejpTStatusXicZeroOmegacZeroToXiPi"), 0); + if (ptXic >= config.ptMinXicZeroOmegacZeroToXiPiLfCasc) { + SETBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi); + registry.fill(HIST("hRejpTStatusXicZeroOmegacZeroToXiPi"), 1); } + } - // fill histograms - if (config.fillHistograms && (TESTBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi))) { - registry.fill(HIST("hMassXicZeroOmegacZeroToXiPi"), mass2ProngXiHyp); - registry.fill(HIST("hPtCutsXicZeroOmegacZeroToXiPi"), ptXic); - } - } else if (df2.isPropagationFailure()) { - LOGF(info, "Exception caught: failed to propagate tracks (2prong - xi) to charm baryon decay vtx"); + // fill histograms + if (config.fillHistograms && (TESTBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi))) { + registry.fill(HIST("hMassXicZeroOmegacZeroToXiPi"), mass2ProngXiHyp); + registry.fill(HIST("hPtCutsXicZeroOmegacZeroToXiPi"), ptXic); } } @@ -3753,50 +3747,43 @@ struct HfTrackIndexSkimCreatorLfCascades { if (nVtxFrom2ProngFitterOmegaHyp > 0) { - df2.propagateTracksToVertex(); - - if (df2.isPropagateTracksToVertexDone()) { - - std::array pVecOmega{}; - std::array pVecCharmBachelor1OmegaHyp{}; - df2.getTrack(0).getPxPyPzGlo(pVecOmega); - df2.getTrack(1).getPxPyPzGlo(pVecCharmBachelor1OmegaHyp); - const float ptOmegac = RecoDecay::pt(pVecOmega, pVecCharmBachelor1OmegaHyp); - - const std::array arrMomToOmega{pVecOmega, pVecCharmBachelor1OmegaHyp}; - const auto mass2ProngOmegaPiHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi]); - const auto mass2ProngOmegaKHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK]); - - if (std::abs(casc.mOmega() - MassOmegaMinus) < config.cascadeMassWindow) { - if ((mass2ProngOmegaPiHyp >= config.massOmegaCharmBachelorMin) && (mass2ProngOmegaPiHyp <= config.massOmegaCharmBachelorMax)) { - registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaPi"), 0); - if (ptOmegac >= config.ptMinOmegacZeroToOmegaPiLfCasc) { - SETBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi); - registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaPi"), 1); - } + std::array pVecOmega{}; + std::array pVecCharmBachelor1OmegaHyp{}; + df2.getTrack(0).getPxPyPzGlo(pVecOmega); + df2.getTrack(1).getPxPyPzGlo(pVecCharmBachelor1OmegaHyp); + const float ptOmegac = RecoDecay::pt(pVecOmega, pVecCharmBachelor1OmegaHyp); + + const std::array arrMomToOmega{pVecOmega, pVecCharmBachelor1OmegaHyp}; + const auto mass2ProngOmegaPiHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi]); + const auto mass2ProngOmegaKHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK]); + + if (std::abs(casc.mOmega() - MassOmegaMinus) < config.cascadeMassWindow) { + if ((mass2ProngOmegaPiHyp >= config.massOmegaCharmBachelorMin) && (mass2ProngOmegaPiHyp <= config.massOmegaCharmBachelorMax)) { + registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaPi"), 0); + if (ptOmegac >= config.ptMinOmegacZeroToOmegaPiLfCasc) { + SETBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi); + registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaPi"), 1); } - if ((mass2ProngOmegaKHyp >= config.massOmegaCharmBachelorMin) && (mass2ProngOmegaKHyp <= config.massOmegaCharmBachelorMax)) { - registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaKa"), 0); - if (ptOmegac >= config.ptMinOmegaczeroToOmegaKaLfCasc) { - SETBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK); - registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaKa"), 1); - } + } + if ((mass2ProngOmegaKHyp >= config.massOmegaCharmBachelorMin) && (mass2ProngOmegaKHyp <= config.massOmegaCharmBachelorMax)) { + registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaKa"), 0); + if (ptOmegac >= config.ptMinOmegaczeroToOmegaKaLfCasc) { + SETBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK); + registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaKa"), 1); } } + } - // fill histograms - if (config.fillHistograms) { - if (TESTBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi)) { - registry.fill(HIST("hMassOmegacZeroToOmegaPi"), mass2ProngOmegaPiHyp); - registry.fill(HIST("hPtCutsOmegacZeroToOmegaPi"), ptOmegac); - } - if (TESTBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK)) { - registry.fill(HIST("hMassOmegacZeroToOmegaK"), mass2ProngOmegaKHyp); - registry.fill(HIST("hPtCutsOmegacZeroToOmegaKa"), ptOmegac); - } + // fill histograms + if (config.fillHistograms) { + if (TESTBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi)) { + registry.fill(HIST("hMassOmegacZeroToOmegaPi"), mass2ProngOmegaPiHyp); + registry.fill(HIST("hPtCutsOmegacZeroToOmegaPi"), ptOmegac); + } + if (TESTBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK)) { + registry.fill(HIST("hMassOmegacZeroToOmegaK"), mass2ProngOmegaKHyp); + registry.fill(HIST("hPtCutsOmegacZeroToOmegaKa"), ptOmegac); } - } else if (df2.isPropagationFailure()) { - LOGF(info, "Exception caught: failed to propagate tracks (2prong - omega) to charm baryon decay vtx"); } } @@ -3859,43 +3846,45 @@ struct HfTrackIndexSkimCreatorLfCascades { } if (nVtxFrom3ProngFitterXiHyp > 0) { - df2.propagateTracksToVertex(); - if (df2.isPropagateTracksToVertexDone()) { - std::array pVecPi1{}; - std::array pVecPi2{}; - // get bachelor momenta at the Xic vertex - df2.getTrack(0).getPxPyPzGlo(pVecPi1); - df2.getTrack(1).getPxPyPzGlo(pVecPi2); - const auto pVecCand = RecoDecay::pVec(pVecCasc, pVecPi1, pVecPi2); - const auto ptCand = RecoDecay::pt(pVecCand); - const std::array primaryVertex{collision.posX(), collision.posY(), collision.posZ()}; // primary vertex - const auto& secondaryVertex = df2.getPCACandidate(); // secondary vertex - - registry.fill(HIST("hRejpTStatusXicPlusToXiPiPi"), 0); - if (ptCand >= config.ptMinXicplusLfCasc) { - registry.fill(HIST("hRejpTStatusXicPlusToXiPiPi"), 1); - } - - if (!isSelectedCandidateXic(pVecCand, secondaryVertex, primaryVertex)) { - continue; - } + std::array pVecPi1{}; + std::array pVecPi2{}; + // get bachelor momenta at the Xic vertex + df2.getTrack(0).getPxPyPzGlo(pVecPi1); + df2.getTrack(1).getPxPyPzGlo(pVecPi2); + // we propagate the cascade to the pipi vertex + trackParCovCascXi.setPID(o2::track::PID::XiMinus); + trackParCovCascXi.setAbsCharge(1); // to be sure + std::array dcaInfoXi; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovCascXi, 2.f, matCorr, &dcaInfoXi); + std::array pVecXiProp{}; + getPxPyPz(trackParCovCascXi, pVecXiProp); + const auto pVecCand = RecoDecay::pVec(pVecCasc, pVecPi1, pVecPi2); + const auto ptCand = RecoDecay::pt(pVecCand); + const std::array primaryVertex{collision.posX(), collision.posY(), collision.posZ()}; // primary vertex + const auto& secondaryVertex = df2.getPCACandidate(); // secondary vertex + + registry.fill(HIST("hRejpTStatusXicPlusToXiPiPi"), 0); + if (ptCand >= config.ptMinXicplusLfCasc) { + registry.fill(HIST("hRejpTStatusXicPlusToXiPiPi"), 1); + } - // fill histograms - if (config.fillHistograms) { - const std::array arr3Mom{pVecCasc, pVecPi1, pVecPi2}; - const auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi]); - registry.fill(HIST("hMassXicPlusToXiPiPi"), mass3Prong); - registry.fill(HIST("hPtCutsXicPlusToXiPiPi"), ptCand); - } + if (!isSelectedCandidateXic(pVecCand, secondaryVertex, primaryVertex)) { + continue; + } - // fill table row if a vertex was found - rowTrackIndexCasc3Prong(thisCollId, - casc.cascadeId(), - trackCharmBachelor1.globalIndex(), - trackCharmBachelor2.globalIndex()); - } else if (df2.isPropagationFailure()) { - LOGF(info, "Exception caught: failed to propagate tracks (3prong) to charm baryon decay vtx"); + // fill histograms + if (config.fillHistograms) { + const std::array arr3Mom{pVecCasc, pVecPi1, pVecPi2}; + const auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi]); + registry.fill(HIST("hMassXicPlusToXiPiPi"), mass3Prong); + registry.fill(HIST("hPtCutsXicPlusToXiPiPi"), ptCand); } + + // fill table row if a vertex was found + rowTrackIndexCasc3Prong(thisCollId, + casc.cascadeId(), + trackCharmBachelor1.globalIndex(), + trackCharmBachelor2.globalIndex()); } } // end 3prong loop } // end 3prong condition