diff --git a/Tools/PIDML/pidMl.h b/Tools/PIDML/pidMl.h index 935440e26f7..cb45360052c 100644 --- a/Tools/PIDML/pidMl.h +++ b/Tools/PIDML/pidMl.h @@ -17,10 +17,14 @@ #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/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include + +#include namespace o2::aod { diff --git a/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx b/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx index 86adb2cf238..34ce845c79d 100644 --- a/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx +++ b/Tools/PIDML/pidMlBatchEffAndPurProducer.cxx @@ -16,22 +16,39 @@ /// \author Michał Olędzki /// \author Marek Mytkowski -#include -#include +#include "Tools/PIDML/pidOnnxModel.h" +#include "Tools/PIDML/pidUtils.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 -#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..1441718b336 100644 --- a/Tools/PIDML/pidMlEffAndPurProducer.cxx +++ b/Tools/PIDML/pidMlEffAndPurProducer.cxx @@ -15,16 +15,27 @@ /// \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/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; using namespace o2::framework; @@ -91,7 +102,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..332a2a8209b 100644 --- a/Tools/PIDML/pidMlProducer.cxx +++ b/Tools/PIDML/pidMlProducer.cxx @@ -15,18 +15,33 @@ /// \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 "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 "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 using namespace o2; using namespace o2::framework; diff --git a/Tools/PIDML/pidOnnxInterface.h b/Tools/PIDML/pidOnnxInterface.h index e97635468ee..6724e5c5167 100644 --- a/Tools/PIDML/pidOnnxInterface.h +++ b/Tools/PIDML/pidOnnxInterface.h @@ -17,14 +17,18 @@ #ifndef TOOLS_PIDML_PIDONNXINTERFACE_H_ #define TOOLS_PIDML_PIDONNXINTERFACE_H_ -#include -#include +#include "Tools/PIDML/pidOnnxModel.h" +// +#include +#include +#include + +#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 +114,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..4ee88106ab0 100644 --- a/Tools/PIDML/pidOnnxModel.h +++ b/Tools/PIDML/pidOnnxModel.h @@ -17,26 +17,31 @@ #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 -#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 +62,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 +82,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 +141,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 +160,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 +172,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..25fba1ee6a0 100644 --- a/Tools/PIDML/qaPid.cxx +++ b/Tools/PIDML/qaPid.cxx @@ -14,15 +14,29 @@ /// \author Łukasz Sawicki /// \since -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StaticFor.h" +#include "Common/DataModel/PIDResponseCombined.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -371,7 +385,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 +423,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..01fca6457e1 100644 --- a/Tools/PIDML/qaPidMl.cxx +++ b/Tools/PIDML/qaPidMl.cxx @@ -14,17 +14,28 @@ /// \author Łukasz Sawicki /// \since -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StaticFor.h" +#include "Tools/PIDML/pidOnnxModel.h" +// +#include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include -#include "Tools/PIDML/pidOnnxModel.h" + +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -311,7 +322,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..268b0609c25 100644 --- a/Tools/PIDML/simpleApplyPidOnnxInterface.cxx +++ b/Tools/PIDML/simpleApplyPidOnnxInterface.cxx @@ -14,16 +14,26 @@ /// /// \author Maja Kabus +#include "Tools/PIDML/pidOnnxInterface.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 "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..57316713f03 100644 --- a/Tools/PIDML/simpleApplyPidOnnxModel.cxx +++ b/Tools/PIDML/simpleApplyPidOnnxModel.cxx @@ -14,14 +14,23 @@ /// /// \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/PIDResponseTOF.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework;