From 67d65a21c9396794b1c811209ebdd5f66686e446 Mon Sep 17 00:00:00 2001 From: pillot Date: Mon, 10 Feb 2025 15:17:07 +0100 Subject: [PATCH] new option to print the status map content --- Detectors/MUON/MCH/Status/CMakeLists.txt | 1 + .../Status/src/statusmap-to-rejectlist.cxx | 35 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Detectors/MUON/MCH/Status/CMakeLists.txt b/Detectors/MUON/MCH/Status/CMakeLists.txt index 02fd87c1e6e52..e664e92d4c05b 100644 --- a/Detectors/MUON/MCH/Status/CMakeLists.txt +++ b/Detectors/MUON/MCH/Status/CMakeLists.txt @@ -47,6 +47,7 @@ o2_add_executable( O2::DataFormatsMCH O2::Framework O2::MCHGlobalMapping + O2::MCHMappingImpl4 O2::MCHStatus ) diff --git a/Detectors/MUON/MCH/Status/src/statusmap-to-rejectlist.cxx b/Detectors/MUON/MCH/Status/src/statusmap-to-rejectlist.cxx index c50d7022ad1b6..b7d5d93676ff0 100644 --- a/Detectors/MUON/MCH/Status/src/statusmap-to-rejectlist.cxx +++ b/Detectors/MUON/MCH/Status/src/statusmap-to-rejectlist.cxx @@ -115,6 +115,35 @@ void printContent(const std::string inFile, const uint32_t mask) dataFile->Close(); } +//____________________________________________________________________________________ +void dumpContent(const std::string inFile, const size_t iTF, const uint32_t mask) +{ + /// print the content of the status map of the given TF with the given mask + + auto [dataFile, dataReader] = loadData(inFile); + TTreeReaderValue statusMap(*dataReader, "statusmaps"); + + if (dataReader->SetEntry(iTF) != TTreeReader::kEntryValid) { + LOGP(error, "invalid TF index {} (number of TFs = {})", iTF, dataReader->GetEntries()); + exit(3); + } + + LOGP(info, "status map content for TF {} with statusMask=0x{:x}:", iTF, mask); + + for (const auto& status : *statusMap) { + if ((mask & status.second) != 0) { + auto channel = status.first; + if (!channel.isValid()) { + LOGP(error, "invalid channel with status {}", status.second); + } else { + LOGP(info, "{} status {}", asString(channel), status.second); + } + } + } + + dataFile->Close(); +} + //____________________________________________________________________________________ BadChannelsVector statusMap2RejectList(const std::string inFile, const size_t iTF, const uint32_t mask) { @@ -174,6 +203,7 @@ int main(int argc, char** argv) size_t iTF; uint32_t mask; bool print; + bool dump; auto tnow = std::chrono::system_clock::now().time_since_epoch(); using namespace std::chrono_literals; @@ -193,6 +223,7 @@ int main(int argc, char** argv) ("tf,i", po::value(&iTF)->default_value(0), "index of the TF to process") ("mask,m", po::value(&mask)->default_value(defaultMask), "mask to apply to the statusMap to produce the RejectList") ("print,p",po::bool_switch(&print),"print the content of the input file without processing it") + ("dump,d",po::bool_switch(&dump),"dump the raw content of the input file without processing it") ; // clang-format on @@ -214,7 +245,9 @@ int main(int argc, char** argv) exit(1); } - if (print) { + if (dump) { + dumpContent(inFile, iTF, mask); + } else if (print) { printContent(inFile, mask); } else { auto bv = statusMap2RejectList(inFile, iTF, mask);