From 8b548e677160af23d9f6456e4dcf47f15a42df4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Fri, 11 Jul 2025 20:14:35 +0200 Subject: [PATCH 1/2] Fix --- Tools/PIDML/pidMl.h | 6 ++-- Tools/PIDML/pidMlBatchEffAndPurProducer.cxx | 28 +++++++++-------- Tools/PIDML/pidMlEffAndPurProducer.cxx | 20 ++++++------ Tools/PIDML/pidMlProducer.cxx | 21 +++++++------ Tools/PIDML/pidOnnxInterface.h | 11 ++++--- Tools/PIDML/pidOnnxModel.h | 34 +++++++++++---------- Tools/PIDML/qaPid.cxx | 18 ++++++----- Tools/PIDML/qaPidMl.cxx | 23 ++++++++------ Tools/PIDML/simpleApplyPidOnnxInterface.cxx | 16 +++++----- Tools/PIDML/simpleApplyPidOnnxModel.cxx | 16 +++++----- 10 files changed, 107 insertions(+), 86 deletions(-) diff --git a/Tools/PIDML/pidMl.h b/Tools/PIDML/pidMl.h index 935440e26f7..3e1ad32674a 100644 --- a/Tools/PIDML/pidMl.h +++ b/Tools/PIDML/pidMl.h @@ -17,10 +17,12 @@ #ifndef TOOLS_PIDML_PIDML_H_ #define TOOLS_PIDML_PIDML_H_ -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include namespace o2::aod { diff --git a/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx b/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx index 86adb2cf238..ff20a4a0787 100644 --- a/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx +++ b/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx @@ -16,22 +16,24 @@ /// \author Michał Olędzki /// \author Marek Mytkowski -#include -#include +#include "Tools/PIDML/pidOnnxModel.h" +#include "Tools/PIDML/pidUtils.h" +// +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include + #include +#include +#include #include +#include #include -#include - -#include "Framework/AnalysisDataModel.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/StaticFor.h" -#include "CCDB/CcdbApi.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include "Tools/PIDML/pidOnnxModel.h" -#include "Tools/PIDML/pidUtils.h" using namespace o2; using namespace o2::framework; diff --git a/Tools/PIDML/pidMlEffAndPurProducer.cxx b/Tools/PIDML/pidMlEffAndPurProducer.cxx index e3c57763dbf..cae6babe8d0 100644 --- a/Tools/PIDML/pidMlEffAndPurProducer.cxx +++ b/Tools/PIDML/pidMlEffAndPurProducer.cxx @@ -15,16 +15,18 @@ /// \author Michał Olędzki /// \author Marek Mytkowski -#include - -#include "Framework/AnalysisDataModel.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "CCDB/CcdbApi.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" #include "Tools/PIDML/pidOnnxModel.h" #include "Tools/PIDML/pidUtils.h" +// +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; @@ -91,7 +93,7 @@ struct PidMlEffAndPurProducer { return nSigma; } - bool isNSigmaAccept(const BigTracks::iterator& track, nSigma_t& nSigma) + bool isNSigmaAccept(const BigTracks::iterator& track, const nSigma_t& nSigma) { // FIXME: for current particles it works, but there are some particles, // which can have different sign and pdgSign diff --git a/Tools/PIDML/pidMlProducer.cxx b/Tools/PIDML/pidMlProducer.cxx index de1d65622d0..db1c1fb47b3 100644 --- a/Tools/PIDML/pidMlProducer.cxx +++ b/Tools/PIDML/pidMlProducer.cxx @@ -15,18 +15,21 @@ /// \author Maja Kabus /// \author Marek Mytkowski -#include -#include -#include "Framework/AnalysisTask.h" -#include "Framework/StaticFor.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" +#include "Tools/PIDML/pidMl.h" +#include "Tools/PIDML/pidUtils.h" +// #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Tools/PIDML/pidMl.h" -#include "Tools/PIDML/pidUtils.h" + +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Tools/PIDML/pidOnnxInterface.h b/Tools/PIDML/pidOnnxInterface.h index e97635468ee..c049c4e2d5b 100644 --- a/Tools/PIDML/pidOnnxInterface.h +++ b/Tools/PIDML/pidOnnxInterface.h @@ -17,14 +17,15 @@ #ifndef TOOLS_PIDML_PIDONNXINTERFACE_H_ #define TOOLS_PIDML_PIDONNXINTERFACE_H_ -#include +#include "Tools/PIDML/pidOnnxModel.h" + +#include + #include #include +#include #include -#include "Framework/Array2D.h" -#include "Tools/PIDML/pidOnnxModel.h" - namespace pidml_pt_cuts { static constexpr int NPids = 6; @@ -110,7 +111,7 @@ struct PidONNXInterface { } std::vector> mModels; - std::size_t mNPids; + std::size_t mNPids{0}; o2::framework::LabeledArray mPLimits; }; #endif // TOOLS_PIDML_PIDONNXINTERFACE_H_ diff --git a/Tools/PIDML/pidOnnxModel.h b/Tools/PIDML/pidOnnxModel.h index 212f0ed8e9d..74105581724 100644 --- a/Tools/PIDML/pidOnnxModel.h +++ b/Tools/PIDML/pidOnnxModel.h @@ -17,26 +17,28 @@ #ifndef TOOLS_PIDML_PIDONNXMODEL_H_ #define TOOLS_PIDML_PIDONNXMODEL_H_ +#include "Tools/PIDML/pidUtils.h" + +#include #include -#include + +#include +#include +#include + #include +#include #include -#include #include +#include #include +#include +#include #include #include -#include #include #include -#include #include -#include - -#include "rapidjson/document.h" -#include "rapidjson/filereadstream.h" -#include "CCDB/CcdbApi.h" -#include "Tools/PIDML/pidUtils.h" enum PidMLDetector { kTPCOnly = 0, @@ -57,7 +59,7 @@ constexpr MomentumLimitsMatrix defaultModelPLimits({0.0, 0.5, 0.8}); // TODO: Copied from cefpTask, shall we put it in some common utils code? namespace { -bool readJsonFile(const std::string& config, rapidjson::Document& d) +bool readJsonFile(std::string const& config, rapidjson::Document& d) { FILE* fp = fopen(config.data(), "rb"); if (!fp) { @@ -77,7 +79,7 @@ bool readJsonFile(const std::string& config, rapidjson::Document& d) template struct PidONNXModel { public: - PidONNXModel(std::string& localPath, std::string& ccdbPath, bool useCCDB, o2::ccdb::CcdbApi& ccdbApi, uint64_t timestamp, + PidONNXModel(std::string const& localPath, std::string const& ccdbPath, bool useCCDB, o2::ccdb::CcdbApi const& ccdbApi, uint64_t timestamp, int pid, double minCertainty, const double* pLimits = &pidml_pt_cuts::defaultModelPLimits[0]) : mPid(pid), mMinCertainty(minCertainty), mPLimits(pLimits, pLimits + kNDetectors) { @@ -136,8 +138,8 @@ struct PidONNXModel { return getModelOutput(track) >= mMinCertainty; } - int mPid; - double mMinCertainty; + int mPid{0}; + double mMinCertainty{0}; private: void getModelPaths(std::string const& path, std::string& modelDir, std::string& modelFile, std::string& modelPath, int pid, std::string const& ext) @@ -155,7 +157,7 @@ struct PidONNXModel { modelPath = modelDir + "/" + modelFile; } - void downloadFromCCDB(o2::ccdb::CcdbApi& ccdbApi, std::string const& ccdbFile, uint64_t timestamp, std::string const& localDir, std::string const& localFile) + void downloadFromCCDB(o2::ccdb::CcdbApi const& ccdbApi, std::string const& ccdbFile, uint64_t timestamp, std::string const& localDir, std::string const& localFile) { std::map metadata; bool retrieveSuccess = ccdbApi.retrieveBlob(ccdbFile, localDir, metadata, timestamp, false, localFile); @@ -167,7 +169,7 @@ struct PidONNXModel { } } - void loadInputFiles(std::string const& localPath, std::string const& ccdbPath, bool useCCDB, o2::ccdb::CcdbApi& ccdbApi, uint64_t timestamp, int pid, std::string& modelPath) + void loadInputFiles(std::string const& localPath, std::string const& ccdbPath, bool useCCDB, o2::ccdb::CcdbApi const& ccdbApi, uint64_t timestamp, int pid, std::string& modelPath) { rapidjson::Document trainColumnsDoc; rapidjson::Document scalingParamsDoc; diff --git a/Tools/PIDML/qaPid.cxx b/Tools/PIDML/qaPid.cxx index 3480ad7c366..05c1cf29414 100644 --- a/Tools/PIDML/qaPid.cxx +++ b/Tools/PIDML/qaPid.cxx @@ -14,14 +14,16 @@ /// \author Łukasz Sawicki /// \since -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StaticFor.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/PIDResponse.h" -#include +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include + #include +#include using namespace o2; using namespace o2::framework; @@ -371,7 +373,7 @@ struct QaPid { for (int j = 0; j < kArrLen; ++j) { if (p < PSwitch[j]) { particleNSigma[j] = std::abs(tpcNSigmas[j]); - } else if (p >= PSwitch[j]) { + } else { particleNSigma[j] = combinedSignal(tpcNSigmas[j], tofNSigmas[j]); } } @@ -409,7 +411,7 @@ struct QaPid { for (int j = 0; j < kArrLen; ++j) { if (p < PSwitch[j]) { particleNSigma[j] = std::abs(tpcNSigmas[j]); - } else if (p >= PSwitch[j]) { + } else { particleNSigma[j] = combinedSignal(tpcNSigmas[j], tofNSigmas[j]); } } diff --git a/Tools/PIDML/qaPidMl.cxx b/Tools/PIDML/qaPidMl.cxx index 1fee5330de4..a88775a4186 100644 --- a/Tools/PIDML/qaPidMl.cxx +++ b/Tools/PIDML/qaPidMl.cxx @@ -14,17 +14,20 @@ /// \author Łukasz Sawicki /// \since -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StaticFor.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Tools/PIDML/pidOnnxModel.h" +// #include "Common/DataModel/PIDResponse.h" -#include +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include + #include -#include "Tools/PIDML/pidOnnxModel.h" +#include + +#include using namespace o2; using namespace o2::framework; @@ -311,7 +314,7 @@ struct QaPidMl { static constexpr float kCertaintyThreshold = 0.5f; - int getParticlePdg(float pidCertainties[]) + int getParticlePdg(const float pidCertainties[]) { // index of the biggest value in an array int index = 0; diff --git a/Tools/PIDML/simpleApplyPidOnnxInterface.cxx b/Tools/PIDML/simpleApplyPidOnnxInterface.cxx index bcfb83cf354..00982c1506c 100644 --- a/Tools/PIDML/simpleApplyPidOnnxInterface.cxx +++ b/Tools/PIDML/simpleApplyPidOnnxInterface.cxx @@ -14,16 +14,18 @@ /// /// \author Maja Kabus +#include "Tools/PIDML/pidOnnxInterface.h" +// +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include + #include #include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "CCDB/CcdbApi.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include "Tools/PIDML/pidOnnxInterface.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; diff --git a/Tools/PIDML/simpleApplyPidOnnxModel.cxx b/Tools/PIDML/simpleApplyPidOnnxModel.cxx index aab1a48fc28..892484a0ad8 100644 --- a/Tools/PIDML/simpleApplyPidOnnxModel.cxx +++ b/Tools/PIDML/simpleApplyPidOnnxModel.cxx @@ -14,14 +14,16 @@ /// /// \author Maja Kabus -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "CCDB/CcdbApi.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" #include "Tools/PIDML/pidOnnxModel.h" +// +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; From 3b402d65671684848ecd393d13d508fef5d23e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Fri, 11 Jul 2025 20:55:26 +0200 Subject: [PATCH 2/2] Fix includes --- Tools/PIDML/pidMl.h | 6 ++++-- Tools/PIDML/pidMlBatchEffAndPurProducer.cxx | 17 ++++++++++++++++- Tools/PIDML/pidMlEffAndPurProducer.cxx | 11 ++++++++++- Tools/PIDML/pidMlProducer.cxx | 16 ++++++++++++++-- Tools/PIDML/pidOnnxInterface.h | 7 +++++-- Tools/PIDML/pidOnnxModel.h | 7 +++++-- Tools/PIDML/qaPid.cxx | 16 ++++++++++++++-- Tools/PIDML/qaPidMl.cxx | 12 ++++++++++-- Tools/PIDML/simpleApplyPidOnnxInterface.cxx | 10 +++++++++- Tools/PIDML/simpleApplyPidOnnxModel.cxx | 9 ++++++++- 10 files changed, 95 insertions(+), 16 deletions(-) diff --git a/Tools/PIDML/pidMl.h b/Tools/PIDML/pidMl.h index 3e1ad32674a..cb45360052c 100644 --- a/Tools/PIDML/pidMl.h +++ b/Tools/PIDML/pidMl.h @@ -17,13 +17,15 @@ #ifndef TOOLS_PIDML_PIDML_H_ #define TOOLS_PIDML_PIDML_H_ -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include +#include + namespace o2::aod { namespace pidtracks diff --git a/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx b/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx index ff20a4a0787..34ce845c79d 100644 --- a/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx +++ b/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx @@ -19,18 +19,33 @@ #include "Tools/PIDML/pidOnnxModel.h" #include "Tools/PIDML/pidUtils.h" // -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include #include +#include #include +#include +#include +#include +#include +#include #include #include +#include + #include +#include +#include #include +#include +#include #include +#include +#include #include #include #include diff --git a/Tools/PIDML/pidMlEffAndPurProducer.cxx b/Tools/PIDML/pidMlEffAndPurProducer.cxx index cae6babe8d0..1441718b336 100644 --- a/Tools/PIDML/pidMlEffAndPurProducer.cxx +++ b/Tools/PIDML/pidMlEffAndPurProducer.cxx @@ -18,14 +18,23 @@ #include "Tools/PIDML/pidOnnxModel.h" #include "Tools/PIDML/pidUtils.h" // -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include #include #include +#include +#include +#include +#include +#include #include +#include +#include +#include #include using namespace o2; diff --git a/Tools/PIDML/pidMlProducer.cxx b/Tools/PIDML/pidMlProducer.cxx index db1c1fb47b3..332a2a8209b 100644 --- a/Tools/PIDML/pidMlProducer.cxx +++ b/Tools/PIDML/pidMlProducer.cxx @@ -18,17 +18,29 @@ #include "Tools/PIDML/pidMl.h" #include "Tools/PIDML/pidUtils.h" // -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include +#include #include +#include #include -#include +#include +#include +#include #include +#include +#include +#include + +#include +#include #include +#include #include using namespace o2; diff --git a/Tools/PIDML/pidOnnxInterface.h b/Tools/PIDML/pidOnnxInterface.h index c049c4e2d5b..6724e5c5167 100644 --- a/Tools/PIDML/pidOnnxInterface.h +++ b/Tools/PIDML/pidOnnxInterface.h @@ -18,10 +18,13 @@ #define TOOLS_PIDML_PIDONNXINTERFACE_H_ #include "Tools/PIDML/pidOnnxModel.h" - +// +#include #include +#include -#include +#include +#include #include #include #include diff --git a/Tools/PIDML/pidOnnxModel.h b/Tools/PIDML/pidOnnxModel.h index 74105581724..4ee88106ab0 100644 --- a/Tools/PIDML/pidOnnxModel.h +++ b/Tools/PIDML/pidOnnxModel.h @@ -18,16 +18,19 @@ #define TOOLS_PIDML_PIDONNXMODEL_H_ #include "Tools/PIDML/pidUtils.h" - +// #include #include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -35,8 +38,8 @@ #include #include #include +#include #include -#include #include #include diff --git a/Tools/PIDML/qaPid.cxx b/Tools/PIDML/qaPid.cxx index 05c1cf29414..25fba1ee6a0 100644 --- a/Tools/PIDML/qaPid.cxx +++ b/Tools/PIDML/qaPid.cxx @@ -14,16 +14,28 @@ /// \author Łukasz Sawicki /// \since -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseCombined.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" +#include +#include #include +#include +#include #include +#include #include #include +#include #include -#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Tools/PIDML/qaPidMl.cxx b/Tools/PIDML/qaPidMl.cxx index a88775a4186..01fca6457e1 100644 --- a/Tools/PIDML/qaPidMl.cxx +++ b/Tools/PIDML/qaPidMl.cxx @@ -16,18 +16,26 @@ #include "Tools/PIDML/pidOnnxModel.h" // -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/TrackSelectionTables.h" +#include +#include +#include #include +#include +#include #include +#include +#include #include #include #include -#include +#include #include +#include using namespace o2; using namespace o2::framework; diff --git a/Tools/PIDML/simpleApplyPidOnnxInterface.cxx b/Tools/PIDML/simpleApplyPidOnnxInterface.cxx index 00982c1506c..268b0609c25 100644 --- a/Tools/PIDML/simpleApplyPidOnnxInterface.cxx +++ b/Tools/PIDML/simpleApplyPidOnnxInterface.cxx @@ -16,13 +16,21 @@ #include "Tools/PIDML/pidOnnxInterface.h" // -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/TrackSelectionTables.h" #include +#include +#include +#include #include +#include +#include +#include +#include #include +#include #include #include diff --git a/Tools/PIDML/simpleApplyPidOnnxModel.cxx b/Tools/PIDML/simpleApplyPidOnnxModel.cxx index 892484a0ad8..57316713f03 100644 --- a/Tools/PIDML/simpleApplyPidOnnxModel.cxx +++ b/Tools/PIDML/simpleApplyPidOnnxModel.cxx @@ -16,13 +16,20 @@ #include "Tools/PIDML/pidOnnxModel.h" // -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/TrackSelectionTables.h" #include +#include +#include +#include #include +#include +#include +#include #include +#include #include using namespace o2;