Skip to content

Commit ef43f9f

Browse files
authored
new option to print the status map content (#13951)
1 parent 84ba04a commit ef43f9f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

Detectors/MUON/MCH/Status/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ o2_add_executable(
4747
O2::DataFormatsMCH
4848
O2::Framework
4949
O2::MCHGlobalMapping
50+
O2::MCHMappingImpl4
5051
O2::MCHStatus
5152
)
5253

Detectors/MUON/MCH/Status/src/statusmap-to-rejectlist.cxx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,35 @@ void printContent(const std::string inFile, const uint32_t mask)
115115
dataFile->Close();
116116
}
117117

118+
//____________________________________________________________________________________
119+
void dumpContent(const std::string inFile, const size_t iTF, const uint32_t mask)
120+
{
121+
/// print the content of the status map of the given TF with the given mask
122+
123+
auto [dataFile, dataReader] = loadData(inFile);
124+
TTreeReaderValue<o2::mch::StatusMap> statusMap(*dataReader, "statusmaps");
125+
126+
if (dataReader->SetEntry(iTF) != TTreeReader::kEntryValid) {
127+
LOGP(error, "invalid TF index {} (number of TFs = {})", iTF, dataReader->GetEntries());
128+
exit(3);
129+
}
130+
131+
LOGP(info, "status map content for TF {} with statusMask=0x{:x}:", iTF, mask);
132+
133+
for (const auto& status : *statusMap) {
134+
if ((mask & status.second) != 0) {
135+
auto channel = status.first;
136+
if (!channel.isValid()) {
137+
LOGP(error, "invalid channel with status {}", status.second);
138+
} else {
139+
LOGP(info, "{} status {}", asString(channel), status.second);
140+
}
141+
}
142+
}
143+
144+
dataFile->Close();
145+
}
146+
118147
//____________________________________________________________________________________
119148
BadChannelsVector statusMap2RejectList(const std::string inFile, const size_t iTF, const uint32_t mask)
120149
{
@@ -174,6 +203,7 @@ int main(int argc, char** argv)
174203
size_t iTF;
175204
uint32_t mask;
176205
bool print;
206+
bool dump;
177207

178208
auto tnow = std::chrono::system_clock::now().time_since_epoch();
179209
using namespace std::chrono_literals;
@@ -193,6 +223,7 @@ int main(int argc, char** argv)
193223
("tf,i", po::value<size_t>(&iTF)->default_value(0), "index of the TF to process")
194224
("mask,m", po::value<uint32_t>(&mask)->default_value(defaultMask), "mask to apply to the statusMap to produce the RejectList")
195225
("print,p",po::bool_switch(&print),"print the content of the input file without processing it")
226+
("dump,d",po::bool_switch(&dump),"dump the raw content of the input file without processing it")
196227
;
197228
// clang-format on
198229

@@ -214,7 +245,9 @@ int main(int argc, char** argv)
214245
exit(1);
215246
}
216247

217-
if (print) {
248+
if (dump) {
249+
dumpContent(inFile, iTF, mask);
250+
} else if (print) {
218251
printContent(inFile, mask);
219252
} else {
220253
auto bv = statusMap2RejectList(inFile, iTF, mask);

0 commit comments

Comments
 (0)