5#include "TRestRawReadoutMetadata.h"
9const std::string unknownChannelType =
"unknown";
13void TRestRawReadoutMetadata::PrintMetadata()
const {
14 cout <<
"Number of channels: " << fChannelInfo.size() << endl;
15 map<string, int> typesCount;
16 for (
const auto& channel : fChannelInfo) {
17 const auto& info = channel.second;
18 typesCount[info.type]++;
20 cout <<
"Channel types: ";
21 for (
const auto& type : typesCount) {
22 cout << type.first <<
" (" << type.second <<
"), ";
26 for (
const auto& [channelDaqId, info] : fChannelInfo) {
27 cout <<
" - Channel DAQ ID: " << channelDaqId <<
", channel ID: " << info.channelId
28 <<
", type: " << info.type <<
", name: " << info.name << endl;
32std::string TRestRawReadoutMetadata::GetTypeForChannelDaqId(UShort_t channel)
const {
33 if (fChannelInfo.find(channel) == fChannelInfo.end()) {
34 return unknownChannelType;
36 return fChannelInfo.at(channel).type;
39std::string TRestRawReadoutMetadata::GetNameForChannelDaqId(UShort_t channel)
const {
40 if (fChannelInfo.find(channel) == fChannelInfo.end()) {
41 return unknownChannelType;
43 return fChannelInfo.at(channel).name;
46std::vector<UShort_t> TRestRawReadoutMetadata::GetChannelDaqIDsForType(
const std::string& type)
const {
47 std::vector<UShort_t> result;
48 for (
const auto& channel : fChannelInfo) {
49 if (channel.second.type == type) {
50 result.push_back(channel.first);