From 19ba4f15d1881783232d9d2bb62cae3b1f39d6df Mon Sep 17 00:00:00 2001 From: Andreas Molander Date: Wed, 21 Sep 2022 11:32:07 +0200 Subject: [PATCH 1/2] FIT: Change data type of FIT DCS CCDB objects Make the map key a string instead of a DataPointIdentifier. This way the DP type is not needed when getting the map value for a DP alias key. --- .../FIT/common/src/DataFormatsFITLinkDef.h | 2 ++ .../include/FITDCSMonitoring/FITDCSDataReader.h | 4 ++-- .../common/dcsmonitoring/src/FITDCSDataReader.cxx | 13 +++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h index 32360d6d13ca9..abd02f30c5ea8 100644 --- a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h +++ b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h @@ -29,4 +29,6 @@ // TODO AM: Set this here when unused class warning is solved. // #pragma link C++ class std::unordered_map < o2::dcs::DataPointIdentifier, o2::fit::DCSDPValues> + ; +#pragma link C++ class std::unordered_map< std::string, o2::fit::DCSDPValues > + ; + #endif diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSDataReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSDataReader.h index 3a793466fc8a5..bc6c440861db0 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSDataReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSDataReader.h @@ -52,7 +52,7 @@ class FITDCSDataReader uint64_t processFlags(uint64_t flag, const char* pid); void updateCcdbObjectInfo(); - const std::unordered_map& getDpData() const; + const std::unordered_map& getDpData() const; void resetDpData(); const std::string& getCcdbPath() const; void setCcdbPath(const std::string& ccdbPath); @@ -68,7 +68,7 @@ class FITDCSDataReader void setVerboseMode(bool verboseMode = true); private: - std::unordered_map mDpData; // the object that will go to the CCDB + std::unordered_map mDpData; // the object that will go to the CCDB std::unordered_map mPids; // contains all PIDs for the processor, the bool // will be true if the DP was processed at least once std::unordered_map mDpsMap; // this is the map that will hold the DPs diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSDataReader.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDCSDataReader.cxx index ea32114e46c33..b5ed991237126 100644 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSDataReader.cxx +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSDataReader.cxx @@ -38,7 +38,7 @@ void FITDCSDataReader::init(const std::vector& pids) // Fill the array of sub-detector specific DPIDs that will be processed for (const auto& it : pids) { mPids[it] = false; - mDpData[it].makeEmpty(); + mDpData[it.get_alias()].makeEmpty(); } } @@ -85,6 +85,7 @@ int FITDCSDataReader::processDP(const DPCOM& dpcom) { // Processing a single DP const auto& dpid = dpcom.id; + const auto& dpAlias = dpid.get_alias(); const auto& type = dpid.get_type(); const auto& val = dpcom.data; @@ -99,12 +100,12 @@ int FITDCSDataReader::processDP(const DPCOM& dpcom) auto flags = val.get_flags(); if (processFlags(flags, dpid.get_alias()) == 0) { // Store all DP values - if (mDpData[dpid].values.empty() || val.get_epoch_time() > mDpData[dpid].values.back().first) { + if (mDpData[dpAlias].values.empty() || val.get_epoch_time() > mDpData[dpAlias].values.back().first) { dpValueConverter.raw_data = val.payload_pt1; if (type == DPVAL_DOUBLE) { - mDpData[dpid].add(val.get_epoch_time(), lround(dpValueConverter.double_value * 1000)); // store as nA + mDpData[dpAlias].add(val.get_epoch_time(), lround(dpValueConverter.double_value * 1000)); // store as nA } else if (type == DPVAL_UINT) { - mDpData[dpid].add(val.get_epoch_time(), dpValueConverter.uint_value); + mDpData[dpAlias].add(val.get_epoch_time(), dpValueConverter.uint_value); } } } @@ -176,7 +177,7 @@ void FITDCSDataReader::updateCcdbObjectInfo() // if (dp.second.values.empty()) { // continue; // } - LOG(info) << "PID = " << dp.first.get_alias(); + LOG(info) << "DP = " << dp.first; dp.second.print(); } } @@ -187,7 +188,7 @@ void FITDCSDataReader::updateCcdbObjectInfo() return; } -const std::unordered_map& FITDCSDataReader::getDpData() const { return mDpData; } +const std::unordered_map& FITDCSDataReader::getDpData() const { return mDpData; } void FITDCSDataReader::resetDpData() { From 3cf82976e73b6186d70bf9bda5e24bdc47cc0230 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 21 Sep 2022 09:40:47 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h index abd02f30c5ea8..8c74527a2080a 100644 --- a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h +++ b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h @@ -29,6 +29,6 @@ // TODO AM: Set this here when unused class warning is solved. // #pragma link C++ class std::unordered_map < o2::dcs::DataPointIdentifier, o2::fit::DCSDPValues> + ; -#pragma link C++ class std::unordered_map< std::string, o2::fit::DCSDPValues > + ; +#pragma link C++ class std::unordered_map < std::string, o2::fit::DCSDPValues> + ; #endif