From aa6659c6e3d6446aeea020d1b65f26b42e4935f0 Mon Sep 17 00:00:00 2001 From: Ran Tu Date: Tue, 22 Sep 2026 15:59:35 +0200 Subject: [PATCH 1/2] add MCGen TTree --- PWGHF/D2H/Tasks/taskUpcLc.cxx | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskUpcLc.cxx b/PWGHF/D2H/Tasks/taskUpcLc.cxx index bb4785cf4e3..dc553e7e540 100644 --- a/PWGHF/D2H/Tasks/taskUpcLc.cxx +++ b/PWGHF/D2H/Tasks/taskUpcLc.cxx @@ -17,6 +17,7 @@ /// \author Ran Tu , Fudan University #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/AliasTables.h" @@ -28,10 +29,12 @@ #include "PWGUD/Core/SGSelector.h" #include "PWGUD/Core/UPCHelpers.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include +#include #include #include #include @@ -126,6 +129,10 @@ DECLARE_SOA_TABLE(HfUpcLcMcInfos, "AOD", "HFUPCLCMCINFO", full::FlagMcMatchRec, full::OriginMcRec, full::PtBhadMotherPart); +DECLARE_SOA_TABLE(HfUpcLcMcGen, "AOD", "HFUPCLCMCGEN", + full::Pt, + hf_cand_mc_flag::FlagMcMatchGen, + hf_cand_mc_flag::OriginMcGen); } // namespace o2::aod /// Λc± → p± K∓ π± analysis task @@ -134,12 +141,14 @@ struct HfTaskUpcLc { Produces rowCandUpc; Produces rowCandUpcMcBdt; Produces rowCandUpcMc; + Produces rowLcMcGen; Produces rowUpcQa; Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits"}; Configurable fillTreeOnlySingleGap{"fillTreeOnlySingleGap", false, "Only fill the tree for candidates that pass the single-gap UPC events"}; + Configurable fillMcGenLcTree{"fillMcGenLcTree", true, "Fill the generated Lc to p K pi tree"}; Configurable fillTreeUpcQa{"fillTreeUpcQa", false, "Fill Tree for UPC QA"}; Configurable fillHistQa{"fillHistQa", false, "Fill histograms for UPC detector QA"}; Configurable verticesWithUpc{"verticesWithUpc", false, "Consider vertices with UPC settings"}; @@ -211,10 +220,22 @@ struct HfTaskUpcLc { BCsType const& bcs, aod::FT0s const& ft0s, aod::FV0As const& fv0as, - aod::FDDs const& fdds - - ) + aod::FDDs const& fdds, + soa::Join const* mcParticles = nullptr) { + if constexpr (IsMc) { + if (fillMcGenLcTree) { + for (const auto& particle : *mcParticles) { + if (std::abs(particle.flagMcMatchGen()) != hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { + continue; + } + if (yCandRecoMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus)) > yCandRecoMax) { + continue; + } + rowLcMcGen(particle.pt(), particle.flagMcMatchGen(), particle.originMcGen()); + } + } + } for (const auto& collision : collisions) { float centrality{-1.f}; const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); @@ -397,13 +418,14 @@ struct HfTaskUpcLc { aod::BcFullInfos const& bcs, LcCandidatesMlMc const& selectedLcCandidatesMlMc, aod::McCollisions const&, + soa::Join const& mcParticles, 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); + runAnalysisPerCollisionWithUpc(collisions, selectedLcCandidatesMlMc, bcs, ft0s, fv0as, fdds, &mcParticles); } PROCESS_SWITCH(HfTaskUpcLc, processMcWithMlWithUpc, "Process MC with the ML method with UPC", false); @@ -411,13 +433,14 @@ struct HfTaskUpcLc { aod::BcFullInfos const& bcs, LcCandidatesMc const& selectedLcCandidatesMc, aod::McCollisions const&, + soa::Join const& mcParticles, 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); + runAnalysisPerCollisionWithUpc(collisions, selectedLcCandidatesMc, bcs, ft0s, fv0as, fdds, &mcParticles); } PROCESS_SWITCH(HfTaskUpcLc, processMcStdWithUpc, "Process MC with the standard method with UPC", false); }; From 0fa19dd4b91f3ddb443a90922efe0fa324f20396 Mon Sep 17 00:00:00 2001 From: Ran Tu Date: Tue, 22 Sep 2026 16:33:53 +0200 Subject: [PATCH 2/2] adjust default value --- PWGHF/D2H/Tasks/taskUpcLc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskUpcLc.cxx b/PWGHF/D2H/Tasks/taskUpcLc.cxx index dc553e7e540..d9be942e4e0 100644 --- a/PWGHF/D2H/Tasks/taskUpcLc.cxx +++ b/PWGHF/D2H/Tasks/taskUpcLc.cxx @@ -148,7 +148,7 @@ struct HfTaskUpcLc { Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits"}; Configurable fillTreeOnlySingleGap{"fillTreeOnlySingleGap", false, "Only fill the tree for candidates that pass the single-gap UPC events"}; - Configurable fillMcGenLcTree{"fillMcGenLcTree", true, "Fill the generated Lc to p K pi tree"}; + Configurable fillMcGenLcTree{"fillMcGenLcTree", false, "Fill the generated Lc to p K pi tree"}; Configurable fillTreeUpcQa{"fillTreeUpcQa", false, "Fill Tree for UPC QA"}; Configurable fillHistQa{"fillHistQa", false, "Fill histograms for UPC detector QA"}; Configurable verticesWithUpc{"verticesWithUpc", false, "Consider vertices with UPC settings"};