From 7275a53cf2470ccc4c708be65f5251a2a77623f8 Mon Sep 17 00:00:00 2001 From: Ran Tu Date: Fri, 11 Sep 2026 09:28:51 +0200 Subject: [PATCH 1/2] update taskUpcLc file --- PWGHF/D2H/Tasks/taskUpcLc.cxx | 104 ++++++++++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 11 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskUpcLc.cxx b/PWGHF/D2H/Tasks/taskUpcLc.cxx index f8a4ffe91c1..e71be1a9871 100644 --- a/PWGHF/D2H/Tasks/taskUpcLc.cxx +++ b/PWGHF/D2H/Tasks/taskUpcLc.cxx @@ -79,6 +79,9 @@ DECLARE_SOA_COLUMN(AmpFT0A, ampFT0A, float); DECLARE_SOA_COLUMN(AmpFT0C, ampFT0C, float); DECLARE_SOA_COLUMN(ZdcTimeZNA, zdcTimeZNA, float); DECLARE_SOA_COLUMN(ZdcTimeZNC, zdcTimeZNC, float); +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); +DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); +DECLARE_SOA_COLUMN(PtBhadMotherPart, ptBhadMotherPart, float); } // namespace full DECLARE_SOA_TABLE(HfUpcQa, "AOD", "HFUPCQA", full::PvContributors, @@ -103,12 +106,33 @@ DECLARE_SOA_TABLE(HfUpcLcInfos, "AOD", "HFUPCLCINFOS", full::Chi2PCA, full::DecayLength, full::Cpa); +DECLARE_SOA_TABLE(HfUpcLcMcBdtInfos, "AOD", "HFUPCLCMCBDT", + full::M, + full::Pt, + full::BkgScore, + full::FlagMcMatchRec, + full::OriginMcRec, + full::PtBhadMotherPart); +DECLARE_SOA_TABLE(HfUpcLcMcInfos, "AOD", "HFUPCLCMCINFO", + full::M, + full::Pt, + full::PtProng0, + full::PtProng1, + full::PtProng2, + full::Chi2PCA, + full::DecayLength, + full::Cpa, + full::FlagMcMatchRec, + full::OriginMcRec, + full::PtBhadMotherPart); } // namespace o2::aod /// Λc± → p± K∓ π± analysis task struct HfTaskUpcLc { Produces rowCandUpcBdt; Produces rowCandUpc; + Produces rowCandUpcMcBdt; + Produces rowCandUpcMc; Produces rowUpcQa; Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; @@ -133,6 +157,8 @@ struct HfTaskUpcLc { using LcCandidates = soa::Filtered>; using LcCandidatesMl = soa::Filtered>; + using LcCandidatesMc = soa::Filtered>; + using LcCandidatesMlMc = soa::Filtered>; Filter filterSelectCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; Preslice candLcPerCollision = aod::hf_cand::collisionId; @@ -149,7 +175,7 @@ struct HfTaskUpcLc { void init(InitContext&) { - const std::array doprocess{doprocessDataWithMlWithUpc, doprocessDataStdWithUpc}; + const std::array doprocess{doprocessDataWithMlWithUpc, doprocessDataStdWithUpc, doprocessMcWithMlWithUpc, doprocessMcStdWithUpc}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "no or more than one process function enabled! Please check your configuration!"); } @@ -178,13 +204,13 @@ struct HfTaskUpcLc { return o2::hf_centrality::getCentralityColl(collision); } - template - void runAnalysisPerCollisionDataWithUpc(CollType const& collisions, - CandType const& candidates, - BCsType const& bcs, - aod::FT0s const& ft0s, - aod::FV0As const& fv0as, - aod::FDDs const& fdds + template + void runAnalysisPerCollisionWithUpc(CollType const& collisions, + CandType const& candidates, + BCsType const& bcs, + aod::FT0s const& ft0s, + aod::FV0As const& fv0as, + aod::FDDs const& fdds ) { @@ -244,7 +270,23 @@ struct HfTaskUpcLc { } registry.fill(HIST("Data/hUpcGapAfterSelection"), static_cast(gap)); } - const bool ignoreZdcTime = (zdcTimeThreshold < 0.f); + if constexpr (!IsMc) { + if (!hasZdc) { + continue; + } + } + if constexpr (IsMc) { + if (!hasZdc && fillHistQa) { + registry.fill(HIST("Data/fitInfo/ampFT0A_vs_ampFT0C"), fitInfo.ampFT0A, fitInfo.ampFT0C); + } + if (!hasZdc) { + registry.fill(HIST("Data/hUpcGapAfterSelection"), static_cast(gap)); + } + } + bool ignoreZdcTime = (zdcTimeThreshold < 0.f); + if constexpr (IsMc) { + ignoreZdcTime = ignoreZdcTime || !hasZdc; + } const auto multNTracksPV = collision.multNTracksPV(); const auto posZ = collision.posZ(); if (gap == o2::aod::sgselector::TrueGap::SingleGapA && (ignoreZdcTime || (std::abs(zdcTimeZNA) > zdcTimeThreshold && std::abs(zdcTimeZNC) < zdcTimeThreshold))) { @@ -289,6 +331,18 @@ struct HfTaskUpcLc { auto fillTHnData = [&](bool isPKPi) { const auto massLc = isPKPi ? HfHelper::invMassLcToPKPi(candidate) : HfHelper::invMassLcToPiKP(candidate); + if constexpr (IsMc) { + if constexpr (FillMl) { + const auto& mlProb = isPKPi ? candidate.mlProbLcToPKPi() : candidate.mlProbLcToPiKP(); + if (mlProb.size() == NumberOfMlClasses) { + outputBkg = mlProb[MlClassBackground]; /// bkg score + } + rowCandUpcMcBdt(massLc, pt, outputBkg, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.ptBhadMotherPart()); + } else { + rowCandUpcMc(massLc, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.ptBhadMotherPart()); + } + return; + } if constexpr (FillMl) { const auto& mlProb = isPKPi ? candidate.mlProbLcToPKPi() : candidate.mlProbLcToPiKP(); if (mlProb.size() == NumberOfMlClasses) { @@ -321,7 +375,7 @@ struct HfTaskUpcLc { aod::FDDs const& fdds, aod::Zdcs const& /*zdcs*/) { - runAnalysisPerCollisionDataWithUpc(collisions, selectedLcCandidatesMl, bcs, ft0s, fv0as, fdds); + runAnalysisPerCollisionWithUpc(collisions, selectedLcCandidatesMl, bcs, ft0s, fv0as, fdds); } PROCESS_SWITCH(HfTaskUpcLc, processDataWithMlWithUpc, "Process real data with the ML method with UPC", false); @@ -334,9 +388,37 @@ struct HfTaskUpcLc { aod::FDDs const& fdds, aod::Zdcs const& /*zdcs*/) { - runAnalysisPerCollisionDataWithUpc(collisions, selectedLcCandidates, bcs, ft0s, fv0as, fdds); + runAnalysisPerCollisionWithUpc(collisions, selectedLcCandidates, bcs, ft0s, fv0as, fdds); } PROCESS_SWITCH(HfTaskUpcLc, processDataStdWithUpc, "Process real data with the standard method with UPC", false); + + void processMcWithMlWithUpc(soa::Join const& collisions, + aod::BcFullInfos const& bcs, + LcCandidatesMlMc const& selectedLcCandidatesMlMc, + aod::McCollisions const&, + aod::TracksWMc const&, + aod::FT0s const& ft0s, + aod::FV0As const& fv0as, + aod::FDDs const& fdds, + aod::Zdcs const& /*zdcs*/) + { + runAnalysisPerCollisionWithUpc(collisions, selectedLcCandidatesMlMc, bcs, ft0s, fv0as, fdds); + } + PROCESS_SWITCH(HfTaskUpcLc, processMcWithMlWithUpc, "Process MC with the ML method with UPC", false); + + void processMcStdWithUpc(soa::Join const& collisions, + aod::BcFullInfos const& bcs, + LcCandidatesMc const& selectedLcCandidatesMc, + aod::McCollisions const&, + aod::TracksWMc const&, + aod::FT0s const& ft0s, + aod::FV0As const& fv0as, + aod::FDDs const& fdds, + aod::Zdcs const& /*zdcs*/) + { + runAnalysisPerCollisionWithUpc(collisions, selectedLcCandidatesMc, bcs, ft0s, fv0as, fdds); + } + PROCESS_SWITCH(HfTaskUpcLc, processMcStdWithUpc, "Process MC with the standard method with UPC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 298d0f8c70a5542a6802fe498302fcdee6fe2384 Mon Sep 17 00:00:00 2001 From: Rrantu <156880782+Rrantu@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:48:58 +0200 Subject: [PATCH 2/2] Add cstdint header for fixed-width integer types --- PWGHF/D2H/Tasks/taskUpcLc.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGHF/D2H/Tasks/taskUpcLc.cxx b/PWGHF/D2H/Tasks/taskUpcLc.cxx index e71be1a9871..bb4785cf4e3 100644 --- a/PWGHF/D2H/Tasks/taskUpcLc.cxx +++ b/PWGHF/D2H/Tasks/taskUpcLc.cxx @@ -47,6 +47,7 @@ #include #include +#include #include #include #include // std::vector