From 10279d5d4091329f7236d74e60b9a0d82e61db07 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Wed, 28 May 2025 16:06:27 +0800 Subject: [PATCH 01/28] Add MLselection in candidateSelectorXic0ToXiPiKf.cxx --- .../candidateSelectorXic0ToXiPiKf.cxx | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 904b8c86b5b..afa4151bc38 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -12,6 +12,10 @@ /// \file candidateSelectorXic0ToXiPiKf.cxx /// \brief Xic0 → Xi Pi selection task /// \author Ran Tu , Fudan University +/// \author Tao Fang , Central China Normal University + +#include +#include #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" @@ -20,6 +24,9 @@ #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectorPID.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/HfMlResponseXicToXiPikf.h" + #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" @@ -39,6 +46,7 @@ enum PidInfoStored { /// Struct for applying Xic0 -> Xi pi selection cuts struct HfCandidateSelectorXic0ToXiPiKf { Produces hfSelToXiPi; + Produces hfMlToXiPi; // LF analysis selections Configurable radiusCascMin{"radiusCascMin", 0.5, "Min cascade radius"}; @@ -115,7 +123,26 @@ struct HfCandidateSelectorXic0ToXiPiKf { Configurable nClustersItsMin{"nClustersItsMin", 3, "Minimum number of ITS clusters requirement for pi <- charm baryon"}; Configurable nClustersItsInnBarrMin{"nClustersItsInnBarrMin", 1, "Minimum number of ITS clusters in inner barrel requirement for pi <- charm baryon"}; Configurable itsChi2PerClusterMax{"itsChi2PerClusterMax", 36, "Maximum value of chi2 fit over ITS clusters for pi <- charm baryon"}; - + + // ML inference + Configurable applyMl{"applyMl", true, "Flag to apply ML selections"}; + Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; + Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; + Configurable> cutsMl{"cutsMl", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; + + // CCDB configuration + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_XicToXipikf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; + + o2::analysis::HfMlResponseXicToXiPikf hfMlResponse; + std::vector outputMlXicToXiPi = {}; + o2::ccdb::CcdbApi ccdbApi; + TrackSelectorPr selectorProton; TrackSelectorPi selectorPion; @@ -176,6 +203,19 @@ struct HfCandidateSelectorXic0ToXiPiKf { registry.add("hSelMassCharmBaryon", "hSelMassCharmBaryon;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelDcaXYToPvV0Daughters", "hSelDcaXYToPvV0Daughters;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelDcaXYToPvPiFromCasc", "hSelDcaXYToPvPiFromCasc;status;entries", {HistType::kTH1D, {axisSel}}); + + if (applyMl) { + hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponse.setModelPathsLocal(onnxFileNames); + } + hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponse.init(); + } + } void process(aod::HfCandToXiPiKf const& candidates, @@ -185,6 +225,10 @@ struct HfCandidateSelectorXic0ToXiPiKf { // looping over charm baryon candidates for (const auto& candidate : candidates) { + + //auto ptCandXic = candidate.kfptXic(); + auto ptCand = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); + //pxCharmBaryon bool resultSelections = true; // True if the candidate passes all the selections, False otherwise @@ -503,6 +547,18 @@ struct HfCandidateSelectorXic0ToXiPiKf { registry.fill(HIST("hSelMassCharmBaryon"), 0); } + // ML selections + if (applyMl) { + bool isSelectedMlXic = false; + std::vector inputFeaturesXic = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackPiFromCasc, trackPiFromCharm); + isSelectedMlXic = hfMlResponse.isSelectedMl(inputFeaturesXic, ptCand, outputMlXicToXiPi); + hfMlToXiPi(outputMlXicToXiPi); + + if (!isSelectedMlXic) { + continue; + } + } + hfSelToXiPi(statusPidCharmBaryon, statusPidCascade, statusPidLambda, statusInvMassCharmBaryon, statusInvMassCascade, statusInvMassLambda, resultSelections, infoTpcStored, infoTofStored, trackPiFromCharm.tpcNSigmaPi(), trackPiFromCasc.tpcNSigmaPi(), trackPiFromLam.tpcNSigmaPi(), trackPrFromLam.tpcNSigmaPr(), trackPiFromCharm.tofNSigmaPi(), trackPiFromCasc.tofNSigmaPi(), trackPiFromLam.tofNSigmaPi(), trackPrFromLam.tofNSigmaPr()); From 30f25ca3f28302f07a234d0092fc8fafa840b897 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Wed, 28 May 2025 16:09:07 +0800 Subject: [PATCH 02/28] Add MLcore in CMakeLists.txt --- PWGHF/TableProducer/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index c74e876761e..2ec33b5d134 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -174,7 +174,7 @@ o2physics_add_dpl_workflow(candidate-selector-omegac0-to-omega-pi o2physics_add_dpl_workflow(candidate-selector-xic0-to-xi-pi-kf SOURCES candidateSelectorXic0ToXiPiKf.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-selector-to-xi-pi From 96938acc6dd4789c9079ea26f595c7bd8e1acaf7 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Wed, 28 May 2025 16:11:24 +0800 Subject: [PATCH 03/28] Add ML in CandidateSelectionTables.h --- PWGHF/DataModel/CandidateSelectionTables.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGHF/DataModel/CandidateSelectionTables.h b/PWGHF/DataModel/CandidateSelectionTables.h index ca58828bc0c..bd3e4353654 100644 --- a/PWGHF/DataModel/CandidateSelectionTables.h +++ b/PWGHF/DataModel/CandidateSelectionTables.h @@ -354,6 +354,7 @@ DECLARE_SOA_COLUMN(TofNSigmaPiFromLambda, tofNSigmaPiFromLambda, float); DECLARE_SOA_COLUMN(TofNSigmaPrFromLambda, tofNSigmaPrFromLambda, float); DECLARE_SOA_COLUMN(PidTpcInfoStored, pidTpcInfoStored, int); DECLARE_SOA_COLUMN(PidTofInfoStored, pidTofInfoStored, int); +DECLARE_SOA_COLUMN(MlProbToXiPi, mlProbToXiPi, std::vector); } // namespace hf_sel_toxipi DECLARE_SOA_TABLE(HfSelToXiPi, "AOD", "HFSELTOXIPI", @@ -370,6 +371,9 @@ DECLARE_SOA_TABLE(HfSelToXiPiKf, "AOD", "HFSELTOXIPIKF", hf_sel_toxipi::TpcNSigmaPiFromCharmBaryon, hf_sel_toxipi::TpcNSigmaPiFromCasc, hf_sel_toxipi::TpcNSigmaPiFromLambda, hf_sel_toxipi::TpcNSigmaPrFromLambda, hf_sel_toxipi::TofNSigmaPiFromCharmBaryon, hf_sel_toxipi::TofNSigmaPiFromCasc, hf_sel_toxipi::TofNSigmaPiFromLambda, hf_sel_toxipi::TofNSigmaPrFromLambda); +DECLARE_SOA_TABLE(HfMlToXiPikf, "AOD", "HFMLSELTOXIPIKF", + hf_sel_toxipi::MlProbToXiPi); + namespace hf_sel_toomegapi { DECLARE_SOA_COLUMN(StatusPidLambda, statusPidLambda, bool); From a17517d6d314d9a9567f728a4d358f5ffd784471 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Wed, 28 May 2025 16:13:10 +0800 Subject: [PATCH 04/28] Add HfMlResponseXictoXiPikf.h --- PWGHF/Core/HfMlResponseXicToXiPikf.h | 146 +++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 PWGHF/Core/HfMlResponseXicToXiPikf.h diff --git a/PWGHF/Core/HfMlResponseXicToXiPikf.h b/PWGHF/Core/HfMlResponseXicToXiPikf.h new file mode 100644 index 00000000000..fb7a9aae2ba --- /dev/null +++ b/PWGHF/Core/HfMlResponseXicToXiPikf.h @@ -0,0 +1,146 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file HfMlResponseXicToXiPikf.h +/// \brief Class to compute the ML response for Ξc^0 → Ξ∓ π± analysis selections +/// \author Tao Fang , Central China Normal University + +#ifndef PWGHF_CORE_HFMLRESPONSEXICTOXIPIKF_H_ +#define PWGHF_CORE_HFMLRESPONSEXICTOXIPIKF_H_ + +#include +#include +#include + +#include "PWGHF/Core/HfMlResponse.h" + +// Fill the map of available input features +// the key is the feature's name (std::string) +// the value is the corresponding value in EnumInputFeatures +#define FILL_MAP_XICTOXIPI(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesXicToXiPi::FEATURE) \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER from OBJECT +#define CHECK_AND_FILL_VEC_XICTOXIPI_FULL(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesXicToXiPi::FEATURE): { \ + inputFeatures.emplace_back(OBJECT.GETTER()); \ + break; \ + } + +// where OBJECT is named candidate and FEATURE = GETTER +#define CHECK_AND_FILL_VEC_XICTOXIPI(GETTER) \ + case static_cast(InputFeaturesXicToXiPi::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ + } + +namespace o2::analysis +{ + +enum class InputFeaturesXicToXiPi : uint8_t { + tpcNSigmaPiFromLambda, + tpcNSigmaPiFromCasc, + tpcNSigmaPiFromCharmBaryon, + dcaCascDau, + dcaCharmBaryonDau, + kfDcaXYPiFromXic, + kfDcaXYCascToPv, + cascChi2OverNdf, + xicChi2OverNdf, + cascldl, + chi2TopoCascToPv, + chi2TopoCascToXic, + cosPaCascToXic, + decayLenXYCasc +}; + +template +class HfMlResponseXicToXiPikf : public HfMlResponse +{ + public: + /// Default constructor + HfMlResponseXicToXiPikf() = default; + /// Default destructor + virtual ~HfMlResponseXicToXiPikf() = default; + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the Xic candidate + /// \return inputFeatures vector + template + //std::vector getInputFeatures(T1 const& candidate) + std::vector getInputFeatures(T1 const& candidate, T2 const& lamProngPi, T2 const& cascProngPi, T3 const& charmBaryonProngPi) + { + std::vector inputFeatures; + + for (const auto& idx : MlResponse::mCachedIndices) { + switch (idx) { + // PID variables + CHECK_AND_FILL_VEC_XICTOXIPI_FULL(lamProngPi, tpcNSigmaPiFromLambda, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XICTOXIPI_FULL(cascProngPi, tpcNSigmaPiFromCasc, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XICTOXIPI_FULL(charmBaryonProngPi, tpcNSigmaPiFromCharmBaryon, tpcNSigmaPi); + // DCA + CHECK_AND_FILL_VEC_XICTOXIPI(dcaCascDau) + CHECK_AND_FILL_VEC_XICTOXIPI(dcaCharmBaryonDau); + CHECK_AND_FILL_VEC_XICTOXIPI(kfDcaXYPiFromXic); + CHECK_AND_FILL_VEC_XICTOXIPI(kfDcaXYCascToPv); + // Chi2Geo + CHECK_AND_FILL_VEC_XICTOXIPI(cascChi2OverNdf); + CHECK_AND_FILL_VEC_XICTOXIPI(xicChi2OverNdf); + // ldl + CHECK_AND_FILL_VEC_XICTOXIPI(cascldl); + // Chi2Topo + CHECK_AND_FILL_VEC_XICTOXIPI(chi2TopoCascToPv); + CHECK_AND_FILL_VEC_XICTOXIPI(chi2TopoCascToXic); + // CosPa + CHECK_AND_FILL_VEC_XICTOXIPI(cosPaCascToXic); + // Decay length + CHECK_AND_FILL_VEC_XICTOXIPI(decayLenXYCasc); + } + } + + return inputFeatures; + } + + protected: + /// Method to fill the map of available input features + void setAvailableInputFeatures() + { + MlResponse::mAvailableInputFeatures = { + FILL_MAP_XICTOXIPI(tpcNSigmaPiFromLambda), + FILL_MAP_XICTOXIPI(tpcNSigmaPiFromCasc), + FILL_MAP_XICTOXIPI(tpcNSigmaPiFromCharmBaryon), + FILL_MAP_XICTOXIPI(dcaCascDau), + FILL_MAP_XICTOXIPI(dcaCharmBaryonDau), + FILL_MAP_XICTOXIPI(kfDcaXYPiFromXic), + FILL_MAP_XICTOXIPI(kfDcaXYCascToPv), + FILL_MAP_XICTOXIPI(cascChi2OverNdf), + FILL_MAP_XICTOXIPI(xicChi2OverNdf), + FILL_MAP_XICTOXIPI(cascldl), + FILL_MAP_XICTOXIPI(chi2TopoCascToPv), + FILL_MAP_XICTOXIPI(chi2TopoCascToXic), + FILL_MAP_XICTOXIPI(cosPaCascToXic), + FILL_MAP_XICTOXIPI(decayLenXYCasc), + }; + } +}; + +} // namespace o2::analysis + +#undef FILL_MAP_XICTOXIPI +#undef CHECK_AND_FILL_VEC_XICTOXIPI_FULL +#undef CHECK_AND_FILL_VEC_XICTOXIPI + +#endif // PWGHF_CORE_HFMLRESPONSEXICTOXIPIKF_H_ From 14f136d343f17f1fed68d807945d1484c5f06719 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Wed, 28 May 2025 16:15:15 +0800 Subject: [PATCH 05/28] Update candidateSelectorXic0ToXiPiKf.cxx --- PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index afa4151bc38..4e944db690b 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -226,9 +226,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { // looping over charm baryon candidates for (const auto& candidate : candidates) { - //auto ptCandXic = candidate.kfptXic(); auto ptCand = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); - //pxCharmBaryon bool resultSelections = true; // True if the candidate passes all the selections, False otherwise From 80d94fc98cdf611de50ccbdb62646aab82300b14 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Wed, 28 May 2025 16:25:15 +0800 Subject: [PATCH 06/28] Update candidateSelectorXic0ToXiPiKf.cxx --- PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 4e944db690b..efcd278e62e 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -123,7 +123,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { Configurable nClustersItsMin{"nClustersItsMin", 3, "Minimum number of ITS clusters requirement for pi <- charm baryon"}; Configurable nClustersItsInnBarrMin{"nClustersItsInnBarrMin", 1, "Minimum number of ITS clusters in inner barrel requirement for pi <- charm baryon"}; Configurable itsChi2PerClusterMax{"itsChi2PerClusterMax", 36, "Maximum value of chi2 fit over ITS clusters for pi <- charm baryon"}; - + // ML inference Configurable applyMl{"applyMl", true, "Flag to apply ML selections"}; Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; @@ -131,14 +131,14 @@ struct HfCandidateSelectorXic0ToXiPiKf { Configurable> cutsMl{"cutsMl", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; - + // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic"}, "Paths of models on CCDB"}; Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_XicToXipikf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - + o2::analysis::HfMlResponseXicToXiPikf hfMlResponse; std::vector outputMlXicToXiPi = {}; o2::ccdb::CcdbApi ccdbApi; @@ -203,7 +203,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { registry.add("hSelMassCharmBaryon", "hSelMassCharmBaryon;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelDcaXYToPvV0Daughters", "hSelDcaXYToPvV0Daughters;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelDcaXYToPvPiFromCasc", "hSelDcaXYToPvPiFromCasc;status;entries", {HistType::kTH1D, {axisSel}}); - + if (applyMl) { hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); if (loadModelsFromCCDB) { From a60600b7df52b9bf95d830872c55cd5dcdc40968 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 28 May 2025 08:25:42 +0000 Subject: [PATCH 07/28] Please consider the following formatting changes --- PWGHF/Core/HfMlResponseXicToXiPikf.h | 2 +- .../candidateSelectorXic0ToXiPiKf.cxx | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/PWGHF/Core/HfMlResponseXicToXiPikf.h b/PWGHF/Core/HfMlResponseXicToXiPikf.h index fb7a9aae2ba..e50b0f56639 100644 --- a/PWGHF/Core/HfMlResponseXicToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXicToXiPikf.h @@ -80,7 +80,7 @@ class HfMlResponseXicToXiPikf : public HfMlResponse /// \param candidate is the Xic candidate /// \return inputFeatures vector template - //std::vector getInputFeatures(T1 const& candidate) + // std::vector getInputFeatures(T1 const& candidate) std::vector getInputFeatures(T1 const& candidate, T2 const& lamProngPi, T2 const& cascProngPi, T3 const& charmBaryonProngPi) { std::vector inputFeatures; diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index efcd278e62e..a2c209783b0 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -123,26 +123,26 @@ struct HfCandidateSelectorXic0ToXiPiKf { Configurable nClustersItsMin{"nClustersItsMin", 3, "Minimum number of ITS clusters requirement for pi <- charm baryon"}; Configurable nClustersItsInnBarrMin{"nClustersItsInnBarrMin", 1, "Minimum number of ITS clusters in inner barrel requirement for pi <- charm baryon"}; Configurable itsChi2PerClusterMax{"itsChi2PerClusterMax", 36, "Maximum value of chi2 fit over ITS clusters for pi <- charm baryon"}; - + // ML inference Configurable applyMl{"applyMl", true, "Flag to apply ML selections"}; Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; - + // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic"}, "Paths of models on CCDB"}; Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_XicToXipikf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - + o2::analysis::HfMlResponseXicToXiPikf hfMlResponse; std::vector outputMlXicToXiPi = {}; o2::ccdb::CcdbApi ccdbApi; - + TrackSelectorPr selectorProton; TrackSelectorPi selectorPion; @@ -203,7 +203,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { registry.add("hSelMassCharmBaryon", "hSelMassCharmBaryon;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelDcaXYToPvV0Daughters", "hSelDcaXYToPvV0Daughters;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelDcaXYToPvPiFromCasc", "hSelDcaXYToPvPiFromCasc;status;entries", {HistType::kTH1D, {axisSel}}); - + if (applyMl) { hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); if (loadModelsFromCCDB) { @@ -215,7 +215,6 @@ struct HfCandidateSelectorXic0ToXiPiKf { hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); hfMlResponse.init(); } - } void process(aod::HfCandToXiPiKf const& candidates, @@ -225,7 +224,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { // looping over charm baryon candidates for (const auto& candidate : candidates) { - + auto ptCand = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); bool resultSelections = true; // True if the candidate passes all the selections, False otherwise @@ -556,7 +555,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { continue; } } - + hfSelToXiPi(statusPidCharmBaryon, statusPidCascade, statusPidLambda, statusInvMassCharmBaryon, statusInvMassCascade, statusInvMassLambda, resultSelections, infoTpcStored, infoTofStored, trackPiFromCharm.tpcNSigmaPi(), trackPiFromCasc.tpcNSigmaPi(), trackPiFromLam.tpcNSigmaPi(), trackPrFromLam.tpcNSigmaPr(), trackPiFromCharm.tofNSigmaPi(), trackPiFromCasc.tofNSigmaPi(), trackPiFromLam.tofNSigmaPi(), trackPrFromLam.tofNSigmaPr()); From e4d0c233a4118591b53add41d08579f5533123c4 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 00:13:57 +0800 Subject: [PATCH 08/28] Update and rename HfMlResponseXicToXiPikf.h to HfMlResponseXic0ToXiPikf.h --- ...cToXiPikf.h => HfMlResponseXic0ToXiPikf.h} | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) rename PWGHF/Core/{HfMlResponseXicToXiPikf.h => HfMlResponseXic0ToXiPikf.h} (63%) diff --git a/PWGHF/Core/HfMlResponseXicToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h similarity index 63% rename from PWGHF/Core/HfMlResponseXicToXiPikf.h rename to PWGHF/Core/HfMlResponseXic0ToXiPikf.h index e50b0f56639..2f82828c28f 100644 --- a/PWGHF/Core/HfMlResponseXicToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -13,8 +13,8 @@ /// \brief Class to compute the ML response for Ξc^0 → Ξ∓ π± analysis selections /// \author Tao Fang , Central China Normal University -#ifndef PWGHF_CORE_HFMLRESPONSEXICTOXIPIKF_H_ -#define PWGHF_CORE_HFMLRESPONSEXICTOXIPIKF_H_ +#ifndef PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ +#define PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ #include #include @@ -25,7 +25,7 @@ // Fill the map of available input features // the key is the feature's name (std::string) // the value is the corresponding value in EnumInputFeatures -#define FILL_MAP_XICTOXIPI(FEATURE) \ +#define FILL_MAP_XIC0TOXIPI(FEATURE) \ { \ #FEATURE, static_cast(InputFeaturesXicToXiPi::FEATURE) \ } @@ -34,14 +34,14 @@ // matches the entry in EnumInputFeatures associated to this FEATURE // if so, the inputFeatures vector is filled with the FEATURE's value // by calling the corresponding GETTER from OBJECT -#define CHECK_AND_FILL_VEC_XICTOXIPI_FULL(OBJECT, FEATURE, GETTER) \ +#define CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(OBJECT, FEATURE, GETTER) \ case static_cast(InputFeaturesXicToXiPi::FEATURE): { \ inputFeatures.emplace_back(OBJECT.GETTER()); \ break; \ } // where OBJECT is named candidate and FEATURE = GETTER -#define CHECK_AND_FILL_VEC_XICTOXIPI(GETTER) \ +#define CHECK_AND_FILL_VEC_XIC0TOXIPI(GETTER) \ case static_cast(InputFeaturesXicToXiPi::GETTER): { \ inputFeatures.emplace_back(candidate.GETTER()); \ break; \ @@ -88,26 +88,26 @@ class HfMlResponseXicToXiPikf : public HfMlResponse for (const auto& idx : MlResponse::mCachedIndices) { switch (idx) { // PID variables - CHECK_AND_FILL_VEC_XICTOXIPI_FULL(lamProngPi, tpcNSigmaPiFromLambda, tpcNSigmaPi); - CHECK_AND_FILL_VEC_XICTOXIPI_FULL(cascProngPi, tpcNSigmaPiFromCasc, tpcNSigmaPi); - CHECK_AND_FILL_VEC_XICTOXIPI_FULL(charmBaryonProngPi, tpcNSigmaPiFromCharmBaryon, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(lamProngPi, tpcNSigmaPiFromLambda, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(cascProngPi, tpcNSigmaPiFromCasc, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(charmBaryonProngPi, tpcNSigmaPiFromCharmBaryon, tpcNSigmaPi); // DCA - CHECK_AND_FILL_VEC_XICTOXIPI(dcaCascDau) - CHECK_AND_FILL_VEC_XICTOXIPI(dcaCharmBaryonDau); - CHECK_AND_FILL_VEC_XICTOXIPI(kfDcaXYPiFromXic); - CHECK_AND_FILL_VEC_XICTOXIPI(kfDcaXYCascToPv); + CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCascDau) + CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCharmBaryonDau); + CHECK_AND_FILL_VEC_XIC0TOXIPI(kfDcaXYPiFromXic); + CHECK_AND_FILL_VEC_XIC0TOXIPI(kfDcaXYCascToPv); // Chi2Geo - CHECK_AND_FILL_VEC_XICTOXIPI(cascChi2OverNdf); - CHECK_AND_FILL_VEC_XICTOXIPI(xicChi2OverNdf); + CHECK_AND_FILL_VEC_XIC0TOXIPI(cascChi2OverNdf); + CHECK_AND_FILL_VEC_XIC0TOXIPI(xicChi2OverNdf); // ldl - CHECK_AND_FILL_VEC_XICTOXIPI(cascldl); + CHECK_AND_FILL_VEC_XIC0TOXIPI(cascldl); // Chi2Topo - CHECK_AND_FILL_VEC_XICTOXIPI(chi2TopoCascToPv); - CHECK_AND_FILL_VEC_XICTOXIPI(chi2TopoCascToXic); + CHECK_AND_FILL_VEC_XIC0TOXIPI(chi2TopoCascToPv); + CHECK_AND_FILL_VEC_XIC0TOXIPI(chi2TopoCascToXic); // CosPa - CHECK_AND_FILL_VEC_XICTOXIPI(cosPaCascToXic); + CHECK_AND_FILL_VEC_XIC0TOXIPI(cosPaCascToXic); // Decay length - CHECK_AND_FILL_VEC_XICTOXIPI(decayLenXYCasc); + CHECK_AND_FILL_VEC_XIC0TOXIPI(decayLenXYCasc); } } @@ -119,28 +119,28 @@ class HfMlResponseXicToXiPikf : public HfMlResponse void setAvailableInputFeatures() { MlResponse::mAvailableInputFeatures = { - FILL_MAP_XICTOXIPI(tpcNSigmaPiFromLambda), - FILL_MAP_XICTOXIPI(tpcNSigmaPiFromCasc), - FILL_MAP_XICTOXIPI(tpcNSigmaPiFromCharmBaryon), - FILL_MAP_XICTOXIPI(dcaCascDau), - FILL_MAP_XICTOXIPI(dcaCharmBaryonDau), - FILL_MAP_XICTOXIPI(kfDcaXYPiFromXic), - FILL_MAP_XICTOXIPI(kfDcaXYCascToPv), - FILL_MAP_XICTOXIPI(cascChi2OverNdf), - FILL_MAP_XICTOXIPI(xicChi2OverNdf), - FILL_MAP_XICTOXIPI(cascldl), - FILL_MAP_XICTOXIPI(chi2TopoCascToPv), - FILL_MAP_XICTOXIPI(chi2TopoCascToXic), - FILL_MAP_XICTOXIPI(cosPaCascToXic), - FILL_MAP_XICTOXIPI(decayLenXYCasc), + FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromLambda), + FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromCasc), + FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromCharmBaryon), + FILL_MAP_XIC0TOXIPI(dcaCascDau), + FILL_MAP_XIC0TOXIPI(dcaCharmBaryonDau), + FILL_MAP_XIC0TOXIPI(kfDcaXYPiFromXic), + FILL_MAP_XIC0TOXIPI(kfDcaXYCascToPv), + FILL_MAP_XIC0TOXIPI(cascChi2OverNdf), + FILL_MAP_XIC0TOXIPI(xicChi2OverNdf), + FILL_MAP_XIC0TOXIPI(cascldl), + FILL_MAP_XIC0TOXIPI(chi2TopoCascToPv), + FILL_MAP_XIC0TOXIPI(chi2TopoCascToXic), + FILL_MAP_XIC0TOXIPI(cosPaCascToXic), + FILL_MAP_XIC0TOXIPI(decayLenXYCasc), }; } }; } // namespace o2::analysis -#undef FILL_MAP_XICTOXIPI -#undef CHECK_AND_FILL_VEC_XICTOXIPI_FULL -#undef CHECK_AND_FILL_VEC_XICTOXIPI +#undef FILL_MAP_XIC0TOXIPI +#undef CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL +#undef CHECK_AND_FILL_VEC_XIC0TOXIPI -#endif // PWGHF_CORE_HFMLRESPONSEXICTOXIPIKF_H_ +#endif // PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ From 060f72dce099585a52473909f0be83769a62da6e Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 00:14:43 +0800 Subject: [PATCH 09/28] Update candidateSelectorXic0ToXiPiKf.cxx --- PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index a2c209783b0..ead836390a7 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -24,7 +24,6 @@ #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectorPID.h" -#include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseXicToXiPikf.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" From bf315d3077da43c21ad3ab960cc36271e2a0470a Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 00:18:25 +0800 Subject: [PATCH 10/28] Update HfMlResponseXic0ToXiPikf.h --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index 2f82828c28f..c8272ff0d68 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -27,7 +27,7 @@ // the value is the corresponding value in EnumInputFeatures #define FILL_MAP_XIC0TOXIPI(FEATURE) \ { \ - #FEATURE, static_cast(InputFeaturesXicToXiPi::FEATURE) \ + #FEATURE, static_cast(InputFeaturesXic0ToXiPi::FEATURE) \ } // Check if the index of mCachedIndices (index associated to a FEATURE) @@ -35,14 +35,14 @@ // if so, the inputFeatures vector is filled with the FEATURE's value // by calling the corresponding GETTER from OBJECT #define CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(OBJECT, FEATURE, GETTER) \ - case static_cast(InputFeaturesXicToXiPi::FEATURE): { \ + case static_cast(InputFeaturesXic0ToXiPi::FEATURE): { \ inputFeatures.emplace_back(OBJECT.GETTER()); \ break; \ } // where OBJECT is named candidate and FEATURE = GETTER #define CHECK_AND_FILL_VEC_XIC0TOXIPI(GETTER) \ - case static_cast(InputFeaturesXicToXiPi::GETTER): { \ + case static_cast(InputFeaturesXic0ToXiPi::GETTER): { \ inputFeatures.emplace_back(candidate.GETTER()); \ break; \ } @@ -50,7 +50,7 @@ namespace o2::analysis { -enum class InputFeaturesXicToXiPi : uint8_t { +enum class InputFeaturesXic0ToXiPi : uint8_t { tpcNSigmaPiFromLambda, tpcNSigmaPiFromCasc, tpcNSigmaPiFromCharmBaryon, @@ -68,16 +68,16 @@ enum class InputFeaturesXicToXiPi : uint8_t { }; template -class HfMlResponseXicToXiPikf : public HfMlResponse +class HfMlResponseXic0ToXiPikf : public HfMlResponse { public: /// Default constructor - HfMlResponseXicToXiPikf() = default; + HfMlResponseXic0ToXiPikf() = default; /// Default destructor - virtual ~HfMlResponseXicToXiPikf() = default; + virtual ~HfMlResponseXic0ToXiPikf() = default; /// Method to get the input features vector needed for ML inference - /// \param candidate is the Xic candidate + /// \param candidate is the Xic0 candidate /// \return inputFeatures vector template // std::vector getInputFeatures(T1 const& candidate) @@ -92,7 +92,7 @@ class HfMlResponseXicToXiPikf : public HfMlResponse CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(cascProngPi, tpcNSigmaPiFromCasc, tpcNSigmaPi); CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(charmBaryonProngPi, tpcNSigmaPiFromCharmBaryon, tpcNSigmaPi); // DCA - CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCascDau) + CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCascDau); CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCharmBaryonDau); CHECK_AND_FILL_VEC_XIC0TOXIPI(kfDcaXYPiFromXic); CHECK_AND_FILL_VEC_XIC0TOXIPI(kfDcaXYCascToPv); From 1fe764504be3602ff268fa974a252d8baf298e1c Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 00:20:44 +0800 Subject: [PATCH 11/28] Update candidateSelectorXic0ToXiPiKf.cxx --- PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index ead836390a7..9240350814b 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -24,7 +24,7 @@ #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectorPID.h" -#include "PWGHF/Core/HfMlResponseXicToXiPikf.h" +#include "PWGHF/Core/HfMlResponseXic0ToXiPikf.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" From 330b607e861fe73093eaed10495e247449f24cda Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 00:49:31 +0800 Subject: [PATCH 12/28] Update candidateSelectorXic0ToXiPiKf.cxx --- .../candidateSelectorXic0ToXiPiKf.cxx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 9240350814b..f0f53c61d4f 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -133,13 +133,13 @@ struct HfCandidateSelectorXic0ToXiPiKf { // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic"}, "Paths of models on CCDB"}; - Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_XicToXipikf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic0"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_Xic0ToXipikf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - o2::analysis::HfMlResponseXicToXiPikf hfMlResponse; - std::vector outputMlXicToXiPi = {}; + o2::analysis::HfMlResponseXic0ToXiPikf hfMlResponse; + std::vector outputMlXic0ToXiPi = {}; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPr selectorProton; @@ -545,14 +545,15 @@ struct HfCandidateSelectorXic0ToXiPiKf { // ML selections if (applyMl) { - bool isSelectedMlXic = false; - std::vector inputFeaturesXic = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackPiFromCasc, trackPiFromCharm); - isSelectedMlXic = hfMlResponse.isSelectedMl(inputFeaturesXic, ptCand, outputMlXicToXiPi); - hfMlToXiPi(outputMlXicToXiPi); - - if (!isSelectedMlXic) { + bool isSelectedMlXic0 = false; + std::vector inputFeaturesXic0 = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackPiFromCasc, trackPiFromCharm); + isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPi); + + if (!isSelectedMlXic0) { continue; } + + hfMlToXiPi(outputMlXic0ToXiPi); } hfSelToXiPi(statusPidCharmBaryon, statusPidCascade, statusPidLambda, statusInvMassCharmBaryon, statusInvMassCascade, statusInvMassLambda, resultSelections, infoTpcStored, infoTofStored, From f928d5603742d442a424e2269c600b4ecf2678a2 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 00:50:48 +0800 Subject: [PATCH 13/28] Update HfMlResponseXic0ToXiPikf.h --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index c8272ff0d68..a15f7ac9500 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file HfMlResponseXicToXiPikf.h +/// \file HfMlResponseXic0ToXiPikf.h /// \brief Class to compute the ML response for Ξc^0 → Ξ∓ π± analysis selections /// \author Tao Fang , Central China Normal University From 79a0c6fbdafaf3e959d4c0d6083ac167dc614e17 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 01:01:37 +0800 Subject: [PATCH 14/28] Update candidateSelectorXic0ToXiPiKf.cxx From 6395aedbd5b287d6e3100115cb26c44f8e6ce418 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 01:09:57 +0800 Subject: [PATCH 15/28] Update candidateSelectorXic0ToXiPiKf.cxx --- PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index f0f53c61d4f..6ec56bc1c9e 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -548,11 +548,9 @@ struct HfCandidateSelectorXic0ToXiPiKf { bool isSelectedMlXic0 = false; std::vector inputFeaturesXic0 = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackPiFromCasc, trackPiFromCharm); isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPi); - if (!isSelectedMlXic0) { continue; } - hfMlToXiPi(outputMlXic0ToXiPi); } From fadc1822ccad9df0bebfc9a8a8a7038ff47de313 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 29 May 2025 17:10:25 +0000 Subject: [PATCH 16/28] Please consider the following formatting changes --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index a15f7ac9500..1727b9abd11 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -26,7 +26,7 @@ // the key is the feature's name (std::string) // the value is the corresponding value in EnumInputFeatures #define FILL_MAP_XIC0TOXIPI(FEATURE) \ - { \ + { \ #FEATURE, static_cast(InputFeaturesXic0ToXiPi::FEATURE) \ } @@ -36,15 +36,15 @@ // by calling the corresponding GETTER from OBJECT #define CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(OBJECT, FEATURE, GETTER) \ case static_cast(InputFeaturesXic0ToXiPi::FEATURE): { \ - inputFeatures.emplace_back(OBJECT.GETTER()); \ - break; \ + inputFeatures.emplace_back(OBJECT.GETTER()); \ + break; \ } // where OBJECT is named candidate and FEATURE = GETTER #define CHECK_AND_FILL_VEC_XIC0TOXIPI(GETTER) \ case static_cast(InputFeaturesXic0ToXiPi::GETTER): { \ - inputFeatures.emplace_back(candidate.GETTER()); \ - break; \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ } namespace o2::analysis From ddbe96792c3837a05a9bbe1bafcd1ba707081898 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 21:56:06 +0800 Subject: [PATCH 17/28] Update HfMlResponseXic0ToXiPikf.h --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 76 +++++++++++++-------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index 1727b9abd11..f04fd655863 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -25,24 +25,24 @@ // Fill the map of available input features // the key is the feature's name (std::string) // the value is the corresponding value in EnumInputFeatures -#define FILL_MAP_XIC0TOXIPI(FEATURE) \ +#define FILL_MAP_XIC0TOXIPIKF(FEATURE) \ { \ - #FEATURE, static_cast(InputFeaturesXic0ToXiPi::FEATURE) \ + #FEATURE, static_cast( InputFeaturesXic0ToXiPikf::FEATURE) \ } // Check if the index of mCachedIndices (index associated to a FEATURE) // matches the entry in EnumInputFeatures associated to this FEATURE // if so, the inputFeatures vector is filled with the FEATURE's value // by calling the corresponding GETTER from OBJECT -#define CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(OBJECT, FEATURE, GETTER) \ - case static_cast(InputFeaturesXic0ToXiPi::FEATURE): { \ +#define CHECK_AND_FILL_VEC_XIC0TOXIPIKF_FULL(OBJECT, FEATURE, GETTER) \ + case static_cast( InputFeaturesXic0ToXiPikf::FEATURE): { \ inputFeatures.emplace_back(OBJECT.GETTER()); \ break; \ } // where OBJECT is named candidate and FEATURE = GETTER -#define CHECK_AND_FILL_VEC_XIC0TOXIPI(GETTER) \ - case static_cast(InputFeaturesXic0ToXiPi::GETTER): { \ +#define CHECK_AND_FILL_VEC_XIC0TOXIPIKF(GETTER) \ + case static_cast( InputFeaturesXic0ToXiPikf::GETTER): { \ inputFeatures.emplace_back(candidate.GETTER()); \ break; \ } @@ -50,7 +50,7 @@ namespace o2::analysis { -enum class InputFeaturesXic0ToXiPi : uint8_t { +enum class InputFeaturesXic0ToXiPikf : uint8_t { tpcNSigmaPiFromLambda, tpcNSigmaPiFromCasc, tpcNSigmaPiFromCharmBaryon, @@ -88,26 +88,26 @@ class HfMlResponseXic0ToXiPikf : public HfMlResponse for (const auto& idx : MlResponse::mCachedIndices) { switch (idx) { // PID variables - CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(lamProngPi, tpcNSigmaPiFromLambda, tpcNSigmaPi); - CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(cascProngPi, tpcNSigmaPiFromCasc, tpcNSigmaPi); - CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(charmBaryonProngPi, tpcNSigmaPiFromCharmBaryon, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF_FULL(lamProngPi, tpcNSigmaPiFromLambda, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF_FULL(cascProngPi, tpcNSigmaPiFromCasc, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF_FULL(charmBaryonProngPi, tpcNSigmaPiFromCharmBaryon, tpcNSigmaPi); // DCA - CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCascDau); - CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCharmBaryonDau); - CHECK_AND_FILL_VEC_XIC0TOXIPI(kfDcaXYPiFromXic); - CHECK_AND_FILL_VEC_XIC0TOXIPI(kfDcaXYCascToPv); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(dcaCascDau); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(dcaCharmBaryonDau); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(kfDcaXYPiFromXic); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(kfDcaXYCascToPv); // Chi2Geo - CHECK_AND_FILL_VEC_XIC0TOXIPI(cascChi2OverNdf); - CHECK_AND_FILL_VEC_XIC0TOXIPI(xicChi2OverNdf); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(cascChi2OverNdf); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(xicChi2OverNdf); // ldl - CHECK_AND_FILL_VEC_XIC0TOXIPI(cascldl); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(cascldl); // Chi2Topo - CHECK_AND_FILL_VEC_XIC0TOXIPI(chi2TopoCascToPv); - CHECK_AND_FILL_VEC_XIC0TOXIPI(chi2TopoCascToXic); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(chi2TopoCascToPv); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(chi2TopoCascToXic); // CosPa - CHECK_AND_FILL_VEC_XIC0TOXIPI(cosPaCascToXic); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(cosPaCascToXic); // Decay length - CHECK_AND_FILL_VEC_XIC0TOXIPI(decayLenXYCasc); + CHECK_AND_FILL_VEC_XIC0TOXIPIKF(decayLenXYCasc); } } @@ -119,28 +119,28 @@ class HfMlResponseXic0ToXiPikf : public HfMlResponse void setAvailableInputFeatures() { MlResponse::mAvailableInputFeatures = { - FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromLambda), - FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromCasc), - FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromCharmBaryon), - FILL_MAP_XIC0TOXIPI(dcaCascDau), - FILL_MAP_XIC0TOXIPI(dcaCharmBaryonDau), - FILL_MAP_XIC0TOXIPI(kfDcaXYPiFromXic), - FILL_MAP_XIC0TOXIPI(kfDcaXYCascToPv), - FILL_MAP_XIC0TOXIPI(cascChi2OverNdf), - FILL_MAP_XIC0TOXIPI(xicChi2OverNdf), - FILL_MAP_XIC0TOXIPI(cascldl), - FILL_MAP_XIC0TOXIPI(chi2TopoCascToPv), - FILL_MAP_XIC0TOXIPI(chi2TopoCascToXic), - FILL_MAP_XIC0TOXIPI(cosPaCascToXic), - FILL_MAP_XIC0TOXIPI(decayLenXYCasc), + FILL_MAP_XIC0TOXIPIKF(tpcNSigmaPiFromLambda), + FILL_MAP_XIC0TOXIPIKF(tpcNSigmaPiFromCasc), + FILL_MAP_XIC0TOXIPIKF(tpcNSigmaPiFromCharmBaryon), + FILL_MAP_XIC0TOXIPIKF(dcaCascDau), + FILL_MAP_XIC0TOXIPIKF(dcaCharmBaryonDau), + FILL_MAP_XIC0TOXIPIKF(kfDcaXYPiFromXic), + FILL_MAP_XIC0TOXIPIKF(kfDcaXYCascToPv), + FILL_MAP_XIC0TOXIPIKF(cascChi2OverNdf), + FILL_MAP_XIC0TOXIPIKF(xicChi2OverNdf), + FILL_MAP_XIC0TOXIPIKF(cascldl), + FILL_MAP_XIC0TOXIPIKF(chi2TopoCascToPv), + FILL_MAP_XIC0TOXIPIKF(chi2TopoCascToXic), + FILL_MAP_XIC0TOXIPIKF(cosPaCascToXic), + FILL_MAP_XIC0TOXIPIKF(decayLenXYCasc), }; } }; } // namespace o2::analysis -#undef FILL_MAP_XIC0TOXIPI -#undef CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL -#undef CHECK_AND_FILL_VEC_XIC0TOXIPI +#undef FILL_MAP_XIC0TOXIPIKF +#undef CHECK_AND_FILL_VEC_XIC0TOXIPIKF_FULL +#undef CHECK_AND_FILL_VEC_XIC0TOXIPIKF #endif // PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ From 23ad59cbbbd013a77b3b3efebbfb9bda1f8ef70f Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 30 May 2025 21:57:32 +0800 Subject: [PATCH 18/28] Update candidateSelectorXic0ToXiPiKf.cxx --- PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 6ec56bc1c9e..98e815b8844 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -133,13 +133,13 @@ struct HfCandidateSelectorXic0ToXiPiKf { // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic0"}, "Paths of models on CCDB"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic0ToXipikf"}, "Paths of models on CCDB"}; Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_Xic0ToXipikf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; o2::analysis::HfMlResponseXic0ToXiPikf hfMlResponse; - std::vector outputMlXic0ToXiPi = {}; + std::vector outputMlXic0ToXiPikf = {}; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPr selectorProton; @@ -547,11 +547,11 @@ struct HfCandidateSelectorXic0ToXiPiKf { if (applyMl) { bool isSelectedMlXic0 = false; std::vector inputFeaturesXic0 = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackPiFromCasc, trackPiFromCharm); - isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPi); + isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPikf); if (!isSelectedMlXic0) { continue; } - hfMlToXiPi(outputMlXic0ToXiPi); + hfMlToXiPi(outputMlXic0ToXiPikf); } hfSelToXiPi(statusPidCharmBaryon, statusPidCascade, statusPidLambda, statusInvMassCharmBaryon, statusInvMassCascade, statusInvMassLambda, resultSelections, infoTpcStored, infoTofStored, From 6f591c4c29d2cf4716a1d585fdca85fb75812d4c Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 30 May 2025 13:57:59 +0000 Subject: [PATCH 19/28] Please consider the following formatting changes --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 16 ++++++++-------- .../candidateSelectorXic0ToXiPiKf.cxx | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index f04fd655863..03a7e6efd81 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -26,8 +26,8 @@ // the key is the feature's name (std::string) // the value is the corresponding value in EnumInputFeatures #define FILL_MAP_XIC0TOXIPIKF(FEATURE) \ - { \ - #FEATURE, static_cast( InputFeaturesXic0ToXiPikf::FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesXic0ToXiPikf::FEATURE) \ } // Check if the index of mCachedIndices (index associated to a FEATURE) @@ -35,16 +35,16 @@ // if so, the inputFeatures vector is filled with the FEATURE's value // by calling the corresponding GETTER from OBJECT #define CHECK_AND_FILL_VEC_XIC0TOXIPIKF_FULL(OBJECT, FEATURE, GETTER) \ - case static_cast( InputFeaturesXic0ToXiPikf::FEATURE): { \ - inputFeatures.emplace_back(OBJECT.GETTER()); \ - break; \ + case static_cast(InputFeaturesXic0ToXiPikf::FEATURE): { \ + inputFeatures.emplace_back(OBJECT.GETTER()); \ + break; \ } // where OBJECT is named candidate and FEATURE = GETTER #define CHECK_AND_FILL_VEC_XIC0TOXIPIKF(GETTER) \ - case static_cast( InputFeaturesXic0ToXiPikf::GETTER): { \ - inputFeatures.emplace_back(candidate.GETTER()); \ - break; \ + case static_cast(InputFeaturesXic0ToXiPikf::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ } namespace o2::analysis diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 98e815b8844..01387920b77 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -547,7 +547,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { if (applyMl) { bool isSelectedMlXic0 = false; std::vector inputFeaturesXic0 = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackPiFromCasc, trackPiFromCharm); - isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPikf); + isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPikf); if (!isSelectedMlXic0) { continue; } From 5f01df36ad12d0762032e4a9fda7671afef4033b Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Sat, 31 May 2025 15:08:00 +0800 Subject: [PATCH 20/28] Update HfMlResponseXic0ToXiPikf.h --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index 03a7e6efd81..de2432dc4ba 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -16,8 +16,6 @@ #ifndef PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ #define PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ -#include -#include #include #include "PWGHF/Core/HfMlResponse.h" From 0bcbba307f6fabae1293087fa3729c062bf7faea Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Sat, 31 May 2025 15:08:16 +0800 Subject: [PATCH 21/28] Update PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 01387920b77..292f81ea560 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -224,7 +224,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { // looping over charm baryon candidates for (const auto& candidate : candidates) { - auto ptCand = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); + auto ptCand = RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); bool resultSelections = true; // True if the candidate passes all the selections, False otherwise From b0c4a5f017dff8de0fc0af84798828883927602b Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Sat, 31 May 2025 17:07:13 +0800 Subject: [PATCH 22/28] Update HfMlResponseXic0ToXiPikf.h --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index de2432dc4ba..03a7e6efd81 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -16,6 +16,8 @@ #ifndef PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ #define PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ +#include +#include #include #include "PWGHF/Core/HfMlResponse.h" From 8b558b373dabd09f4d7090fadfe387d27945903e Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Sun, 1 Jun 2025 21:01:45 +0800 Subject: [PATCH 23/28] Update HfMlResponseXic0ToXiPikf.h --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index 03a7e6efd81..b8480646234 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file HfMlResponseXic0ToXiPikf.h -/// \brief Class to compute the ML response for Ξc^0 → Ξ∓ π± analysis selections +/// \brief Class to compute the ML response for Ξc^0 → Ξ∓ π± kf analysis selections /// \author Tao Fang , Central China Normal University #ifndef PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ From 3dbd992b546418b91bf3d19114682b9d8e3400d0 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:09:05 +0800 Subject: [PATCH 24/28] Update HfMlResponseXic0ToXiPikf.h --- PWGHF/Core/HfMlResponseXic0ToXiPikf.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h index b8480646234..08eb4f6aaf0 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPikf.h @@ -16,8 +16,6 @@ #ifndef PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ #define PWGHF_CORE_HFMLRESPONSEXIC0TOXIPIKF_H_ -#include -#include #include #include "PWGHF/Core/HfMlResponse.h" From a8801e63fe18696cb1d4df9e16b5aeb7f940a3e7 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:48:36 +0800 Subject: [PATCH 25/28] Update candidateSelectorXic0ToXiPiKf.cxx --- PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 292f81ea560..b362e149278 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -25,6 +25,7 @@ #include "Common/Core/TrackSelectorPID.h" #include "PWGHF/Core/HfMlResponseXic0ToXiPikf.h" +#include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" From 9b76aba65ba59b394fd7a47263a06c0373ff52bd Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Tue, 3 Jun 2025 15:37:33 +0800 Subject: [PATCH 26/28] Update and rename HfMlResponseXic0ToXiPikf.h to HfMlResponseXic0ToXiPiKf.h Switch Xic0ToXiPikf to Xic0ToXiPiKf --- ...Xic0ToXiPikf.h => HfMlResponseXic0ToXiPiKf.h} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename PWGHF/Core/{HfMlResponseXic0ToXiPikf.h => HfMlResponseXic0ToXiPiKf.h} (92%) diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h b/PWGHF/Core/HfMlResponseXic0ToXiPiKf.h similarity index 92% rename from PWGHF/Core/HfMlResponseXic0ToXiPikf.h rename to PWGHF/Core/HfMlResponseXic0ToXiPiKf.h index 08eb4f6aaf0..d75bdcc4c10 100644 --- a/PWGHF/Core/HfMlResponseXic0ToXiPikf.h +++ b/PWGHF/Core/HfMlResponseXic0ToXiPiKf.h @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file HfMlResponseXic0ToXiPikf.h +/// \file HfMlResponseXic0ToXiPiKf.h /// \brief Class to compute the ML response for Ξc^0 → Ξ∓ π± kf analysis selections /// \author Tao Fang , Central China Normal University @@ -25,7 +25,7 @@ // the value is the corresponding value in EnumInputFeatures #define FILL_MAP_XIC0TOXIPIKF(FEATURE) \ { \ - #FEATURE, static_cast(InputFeaturesXic0ToXiPikf::FEATURE) \ + #FEATURE, static_cast(InputFeaturesXic0ToXiPiKf::FEATURE) \ } // Check if the index of mCachedIndices (index associated to a FEATURE) @@ -33,14 +33,14 @@ // if so, the inputFeatures vector is filled with the FEATURE's value // by calling the corresponding GETTER from OBJECT #define CHECK_AND_FILL_VEC_XIC0TOXIPIKF_FULL(OBJECT, FEATURE, GETTER) \ - case static_cast(InputFeaturesXic0ToXiPikf::FEATURE): { \ + case static_cast(InputFeaturesXic0ToXiPiKf::FEATURE): { \ inputFeatures.emplace_back(OBJECT.GETTER()); \ break; \ } // where OBJECT is named candidate and FEATURE = GETTER #define CHECK_AND_FILL_VEC_XIC0TOXIPIKF(GETTER) \ - case static_cast(InputFeaturesXic0ToXiPikf::GETTER): { \ + case static_cast(InputFeaturesXic0ToXiPiKf::GETTER): { \ inputFeatures.emplace_back(candidate.GETTER()); \ break; \ } @@ -48,7 +48,7 @@ namespace o2::analysis { -enum class InputFeaturesXic0ToXiPikf : uint8_t { +enum class InputFeaturesXic0ToXiPiKf : uint8_t { tpcNSigmaPiFromLambda, tpcNSigmaPiFromCasc, tpcNSigmaPiFromCharmBaryon, @@ -66,13 +66,13 @@ enum class InputFeaturesXic0ToXiPikf : uint8_t { }; template -class HfMlResponseXic0ToXiPikf : public HfMlResponse +class HfMlResponseXic0ToXiPiKf : public HfMlResponse { public: /// Default constructor - HfMlResponseXic0ToXiPikf() = default; + HfMlResponseXic0ToXiPiKf() = default; /// Default destructor - virtual ~HfMlResponseXic0ToXiPikf() = default; + virtual ~HfMlResponseXic0ToXiPiKf() = default; /// Method to get the input features vector needed for ML inference /// \param candidate is the Xic0 candidate From 05ac90e54754afdfb2481043862c760cdf7625f5 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Tue, 3 Jun 2025 15:39:50 +0800 Subject: [PATCH 27/28] Update CandidateSelectionTables.h --- PWGHF/DataModel/CandidateSelectionTables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/DataModel/CandidateSelectionTables.h b/PWGHF/DataModel/CandidateSelectionTables.h index bd3e4353654..53517e19f9a 100644 --- a/PWGHF/DataModel/CandidateSelectionTables.h +++ b/PWGHF/DataModel/CandidateSelectionTables.h @@ -371,7 +371,7 @@ DECLARE_SOA_TABLE(HfSelToXiPiKf, "AOD", "HFSELTOXIPIKF", hf_sel_toxipi::TpcNSigmaPiFromCharmBaryon, hf_sel_toxipi::TpcNSigmaPiFromCasc, hf_sel_toxipi::TpcNSigmaPiFromLambda, hf_sel_toxipi::TpcNSigmaPrFromLambda, hf_sel_toxipi::TofNSigmaPiFromCharmBaryon, hf_sel_toxipi::TofNSigmaPiFromCasc, hf_sel_toxipi::TofNSigmaPiFromLambda, hf_sel_toxipi::TofNSigmaPrFromLambda); -DECLARE_SOA_TABLE(HfMlToXiPikf, "AOD", "HFMLSELTOXIPIKF", +DECLARE_SOA_TABLE(HfMlToXiPiKf, "AOD", "HFMLSELTOXIPIKF", hf_sel_toxipi::MlProbToXiPi); namespace hf_sel_toomegapi From af5d60242a9a2be7108d3b7e8ee24d2780445dc0 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Tue, 3 Jun 2025 15:42:24 +0800 Subject: [PATCH 28/28] Update candidateSelectorXic0ToXiPiKf.cxx --- .../candidateSelectorXic0ToXiPiKf.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index b362e149278..81327bb70e1 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -24,7 +24,7 @@ #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectorPID.h" -#include "PWGHF/Core/HfMlResponseXic0ToXiPikf.h" +#include "PWGHF/Core/HfMlResponseXic0ToXiPiKf.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" @@ -46,7 +46,7 @@ enum PidInfoStored { /// Struct for applying Xic0 -> Xi pi selection cuts struct HfCandidateSelectorXic0ToXiPiKf { Produces hfSelToXiPi; - Produces hfMlToXiPi; + Produces hfMlToXiPi; // LF analysis selections Configurable radiusCascMin{"radiusCascMin", 0.5, "Min cascade radius"}; @@ -134,13 +134,13 @@ struct HfCandidateSelectorXic0ToXiPiKf { // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic0ToXipikf"}, "Paths of models on CCDB"}; - Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_Xic0ToXipikf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic0ToXipiKf"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_Xic0ToXipiKf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - o2::analysis::HfMlResponseXic0ToXiPikf hfMlResponse; - std::vector outputMlXic0ToXiPikf = {}; + o2::analysis::HfMlResponseXic0ToXiPiKf hfMlResponse; + std::vector outputMlXic0ToXiPiKf = {}; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPr selectorProton; @@ -548,11 +548,11 @@ struct HfCandidateSelectorXic0ToXiPiKf { if (applyMl) { bool isSelectedMlXic0 = false; std::vector inputFeaturesXic0 = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackPiFromCasc, trackPiFromCharm); - isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPikf); + isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPiKf); if (!isSelectedMlXic0) { continue; } - hfMlToXiPi(outputMlXic0ToXiPikf); + hfMlToXiPi(outputMlXic0ToXiPiKf); } hfSelToXiPi(statusPidCharmBaryon, statusPidCascade, statusPidLambda, statusInvMassCharmBaryon, statusInvMassCascade, statusInvMassLambda, resultSelections, infoTpcStored, infoTofStored,