14#include <fmt/format.h>
23 : mSolarId{solarId}, mElinkGroupId{elinkGroupId}, mElinkIndexInGroup{elinkIndex}
32 return ((
id.solarId() & 0xFFFF) << 16) |
33 ((
id.elinkGroupId() & 0xFF) << 8) |
34 ((
id.elinkIndexInGroup() & 0xFF) << 0);
39 uint16_t solarId = (code & 0xFFFF0000) >> 16;
41 uint8_t groupId = (code & 0xFF00) >> 8;
43 uint8_t
index = (code & 0xFF) >> 0;
56 std::istringstream is(rep);
58 std::vector<std::string> tokens;
59 while (getline(is, line,
'-')) {
60 tokens.emplace_back(line);
62 if (tokens.size() < 3) {
66 if (tokens[0].
empty() || tokens[0][0] !=
'S') {
70 if (tokens[1].
empty() || tokens[1][0] !=
'J') {
74 if (tokens[2].
size() < 3 || tokens[2][0] !=
'D' || tokens[2][1] !=
'S') {
78 uint16_t solarId = std::atoi(tokens[0].substr(1).c_str());
79 uint8_t groupId = std::atoi(tokens[1].substr(1).c_str());
80 uint8_t
index = std::atoi(tokens[2].substr(2).c_str());
87 if (!dsElecId.has_value()) {
91 std::istringstream is(rep);
93 std::vector<std::string> tokens;
94 while (getline(is, line,
'-')) {
95 tokens.emplace_back(line);
97 if (tokens.size() < 4) {
101 if (tokens[3].
size() < 3 || tokens[3][0] !=
'C' || tokens[3][1] !=
'H') {
105 auto chId = std::atoi(tokens[3].substr(2).c_str());
106 if (chId >= 0 && chId <= 63) {
114 std::cout << fmt::format(
"DsElecId(SOLAR=S{:4d} GROUP=J{:2d} INDEX=DS{:2d}) CODE={:8d}",
115 id.solarId(),
id.elinkGroupId(),
id.elinkIndexInGroup(),
encode(
id));
135 return elinkId - (elinkId / 5) * 5;
constexpr uint16_t solarId() const
solarId is an identifier that uniquely identify a solar board
DsElecId(uint16_t solarId, uint8_t elinkGroupId, uint8_t elinkIndex)
constexpr uint8_t elinkIndexInGroup() const
constexpr uint8_t elinkGroupId() const
int assertIsInRange(std::string what, uint64_t value, uint64_t min, uint64_t max)
std::optional< uint8_t > indexFromElinkId(uint8_t elinkId)
Extracts the index from the elinkId.
std::optional< uint8_t > decodeChannelId(std::string rep)
std::optional< uint8_t > groupFromElinkId(uint8_t elinkId)
Extracts the group from the elinkId.
std::string asString(const SampaCluster &sc)
std::optional< DsElecId > decodeDsElecId(uint32_t code)
uint32_t encode(const DsDetId &id)
Create an integer code for the given id.
std::ostream & operator<<(std::ostream &stream, o2::InteractionRecord const &ir)