From 5da469a18b13b65f4ee4d8bfeb5bfda87616bb1f Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Wed, 12 Nov 2025 15:14:26 +0100 Subject: [PATCH 1/3] Separate flow task trees --- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 48 +++++++++++++----------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 4aa872b7e4e..e55b24ab551 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -69,12 +69,18 @@ DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) // ML scores DECLARE_SOA_COLUMN(MlScore0, mlScore0, float); //! ML score of the first configured index DECLARE_SOA_COLUMN(MlScore1, mlScore1, float); //! ML score of the second configured index +DECLARE_SOA_COLUMN(ScalarProd, scalarProd, float); //! Scalar product +DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality } // namespace full -DECLARE_SOA_TABLE(HfCandPtCent, "AOD", "HFCANDPTCENT", +DECLARE_SOA_TABLE(HfCandMassPts, "AOD", "HFCANDMASSPT", full::M, - full::Pt, + full::Pt); +DECLARE_SOA_TABLE(HfCandScores, "AOD", "HFCANDSCORE", full::MlScore0, full::MlScore1); +DECLARE_SOA_TABLE(HfCandSPCents, "AOD", "HFCANDSPCENT", + full::ScalarProd, + full::Cent); } // namespace o2::aod enum DecayChannel { DplusToPiKPi = 0, @@ -98,7 +104,9 @@ enum QvecEstimator { FV0A = 0, TPCTot }; struct HfTaskFlowCharmHadrons { - Produces rowCandidateMassPtMlScores; + Produces rowCandMassPt; + Produces rowCandMlScores; + Produces rowCandSpCent; Configurable harmonic{"harmonic", 2, "harmonic number"}; Configurable qvecDetector{"qvecDetector", 3, "Detector for Q vector estimation (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3, TPC Pos: 4, TPC Neg: 5, TPC Tot: 6)"}; @@ -108,7 +116,10 @@ struct HfTaskFlowCharmHadrons { Configurable centralityMax{"centralityMax", 100., "Maximum centrality accepted in SP/EP computation (not applied in resolution process)"}; Configurable storeEP{"storeEP", false, "Flag to store EP-related axis"}; Configurable storeMl{"storeMl", false, "Flag to store ML scores"}; - Configurable fillMassPtMlTree{"fillMassPtMlTree", false, "Flag to fill mass and pt tree"}; + Configurable fillMassPtTree{"fillMassPtTree", false, "Flag to fill mass and pt tree"}; + Configurable fillMlTree{"fillMlTree", false, "Flag to fill ML scores tree"}; + Configurable fillSpCentTree{"fillSpCentTree", false, "Flag to fill SP and centrality tree"}; + Configurable fillSparse{"fillSparse", true, "Flag to fill sparse"}; Configurable downSampleFactor{"downSampleFactor", 1., "Fraction of candidates to keep in TTree"}; Configurable ptDownSampleMax{"ptDownSampleMax", 10., "Maximum pt for the application of the downsampling factor"}; Configurable storeResoOccu{"storeResoOccu", false, "Flag to store Occupancy in resolution ThnSparse"}; @@ -297,20 +308,6 @@ struct HfTaskFlowCharmHadrons { } }; // end init - /// Fill the mass, pt and ML scores of a candidate - /// \param mass is the candidate mass - /// \param pt is the candidate transverse momentum - /// \param mlscore0 is the first ML score - /// \param mlscore1 is the second ML score - void fillMassPt(const float mass, const float pt, const float mlscore0, const float mlscore1) - { - rowCandidateMassPtMlScores( - mass, - pt, - mlscore0, - mlscore1); - } - /// Compute the Q vector for the candidate's tracks /// \param cand is the candidate /// \param tracksQx is the X component of the Q vector for the tracks @@ -698,15 +695,24 @@ struct HfTaskFlowCharmHadrons { float const scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec; float const cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl)); - if (fillMassPtMlTree && storeMl) { + if (fillMassPtTree || fillMlTree || fillSpCentTree) { if (downSampleFactor < 1.) { float const pseudoRndm = ptCand * 1000. - static_cast(ptCand * 1000); if (ptCand < ptDownSampleMax && pseudoRndm >= downSampleFactor) { continue; } } - fillMassPt(massCand, ptCand, outputMl[0], outputMl[1]); - } else { + if (fillMassPtTree) { + rowCandMassPt(massCand, ptCand); + } + if (fillMlTree) { + rowCandMlScores(outputMl[0], outputMl[1]); + } + if (fillSpCentTree) { + rowCandSpCent(scalprodCand, cent); + } + } + if (fillSparse) { fillThn(massCand, ptCand, cent, cosNPhi, sinNPhi, cosDeltaPhi, scalprodCand, outputMl, occupancy, hfevflag); } } From 16ff2cb580d8c84fb89997570d06832ffb1b97a6 Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Wed, 12 Nov 2025 17:58:21 +0100 Subject: [PATCH 2/3] Reduce number of trees --- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 36 +++++++++++------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index e55b24ab551..1903b78e727 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -66,19 +66,22 @@ namespace full { DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) -// ML scores DECLARE_SOA_COLUMN(MlScore0, mlScore0, float); //! ML score of the first configured index DECLARE_SOA_COLUMN(MlScore1, mlScore1, float); //! ML score of the second configured index DECLARE_SOA_COLUMN(ScalarProd, scalarProd, float); //! Scalar product DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality } // namespace full -DECLARE_SOA_TABLE(HfCandMassPts, "AOD", "HFCANDMASSPT", +DECLARE_SOA_TABLE(HfCandMPtInfos, "AOD", "HFCANDMPTINFO", full::M, - full::Pt); -DECLARE_SOA_TABLE(HfCandScores, "AOD", "HFCANDSCORE", + full::Pt, full::MlScore0, full::MlScore1); -DECLARE_SOA_TABLE(HfCandSPCents, "AOD", "HFCANDSPCENT", + +DECLARE_SOA_TABLE(HfCandFlowInfos, "AOD", "HFCANDFLOWINFO", + full::M, + full::Pt, + full::MlScore0, + full::MlScore1, full::ScalarProd, full::Cent); } // namespace o2::aod @@ -104,9 +107,8 @@ enum QvecEstimator { FV0A = 0, TPCTot }; struct HfTaskFlowCharmHadrons { - Produces rowCandMassPt; - Produces rowCandMlScores; - Produces rowCandSpCent; + Produces rowCandMassPtMl; + Produces rowCandMassPtMlSpCent; Configurable harmonic{"harmonic", 2, "harmonic number"}; Configurable qvecDetector{"qvecDetector", 3, "Detector for Q vector estimation (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3, TPC Pos: 4, TPC Neg: 5, TPC Tot: 6)"}; @@ -116,9 +118,8 @@ struct HfTaskFlowCharmHadrons { Configurable centralityMax{"centralityMax", 100., "Maximum centrality accepted in SP/EP computation (not applied in resolution process)"}; Configurable storeEP{"storeEP", false, "Flag to store EP-related axis"}; Configurable storeMl{"storeMl", false, "Flag to store ML scores"}; - Configurable fillMassPtTree{"fillMassPtTree", false, "Flag to fill mass and pt tree"}; - Configurable fillMlTree{"fillMlTree", false, "Flag to fill ML scores tree"}; - Configurable fillSpCentTree{"fillSpCentTree", false, "Flag to fill SP and centrality tree"}; + Configurable fillMassPtMlTree{"fillMassPtMlTree", false, "Flag to fill mass, pt and ML scores tree"}; + Configurable fillMassPtMlSpCentTree{"fillMassPtMlSpCentTree", false, "Flag to fill mass, pt, ML scores, SP and centrality tree"}; Configurable fillSparse{"fillSparse", true, "Flag to fill sparse"}; Configurable downSampleFactor{"downSampleFactor", 1., "Fraction of candidates to keep in TTree"}; Configurable ptDownSampleMax{"ptDownSampleMax", 10., "Maximum pt for the application of the downsampling factor"}; @@ -695,21 +696,18 @@ struct HfTaskFlowCharmHadrons { float const scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec; float const cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl)); - if (fillMassPtTree || fillMlTree || fillSpCentTree) { + if (fillMassPtMlTree || fillMassPtMlSpCentTree) { if (downSampleFactor < 1.) { float const pseudoRndm = ptCand * 1000. - static_cast(ptCand * 1000); if (ptCand < ptDownSampleMax && pseudoRndm >= downSampleFactor) { continue; } } - if (fillMassPtTree) { - rowCandMassPt(massCand, ptCand); - } - if (fillMlTree) { - rowCandMlScores(outputMl[0], outputMl[1]); + if (fillMassPtMlTree) { + rowCandMassPtMl(massCand, ptCand, outputMl[0], outputMl[1]); } - if (fillSpCentTree) { - rowCandSpCent(scalprodCand, cent); + if (fillMassPtMlSpCentTree) { + rowCandMassPtMlSpCent(massCand, ptCand, outputMl[0], outputMl[1], scalprodCand, cent); } } if (fillSparse) { From 7e3376e54086ee25c72b8b01b6ebd545bf694bf7 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 12 Nov 2025 16:59:19 +0000 Subject: [PATCH 3/3] Please consider the following formatting changes --- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 1903b78e727..c4a9694ed5c 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -69,7 +69,7 @@ DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) DECLARE_SOA_COLUMN(MlScore0, mlScore0, float); //! ML score of the first configured index DECLARE_SOA_COLUMN(MlScore1, mlScore1, float); //! ML score of the second configured index DECLARE_SOA_COLUMN(ScalarProd, scalarProd, float); //! Scalar product -DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality +DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality } // namespace full DECLARE_SOA_TABLE(HfCandMPtInfos, "AOD", "HFCANDMPTINFO", full::M,