25 using namespace Detail;
31 LOG(error) <<
"Unit Id " <<
Unit <<
" exceeds maximum "
36 LOG(error) <<
"Module Id " <<
Module <<
" exceeds maximum "
41 LOG(error) <<
"PhotoDetector Id " <<
PhotoDet <<
" exceeds maximum "
57 using namespace Detail;
60 throw std::out_of_range(std::string(
"CbmFsdAddress: Illegal element level ") + std::to_string(level));
65 int32_t motherAdd = (address & ((1 << kShift[version][level + 1]) - 1));
75 using namespace Detail;
78 throw std::out_of_range(std::string(
"CbmFsdAddress: Illegal element level ") + std::to_string(level));
82 return (address & (kMask[version][level] << kShift[version][level])) >> kShift[version][level];
106 using namespace Detail;
109 throw std::out_of_range(std::string(
"CbmFsdAddress: Illegal element level ") + std::to_string(level));
113 uint32_t maxId = (1 << kBits[version][level]) - 1;
115 LOG(fatal) <<
"Id " << newId <<
" for FSD level " << level <<
" exceeds maximum " << maxId;
118 return (address & (~(kMask[version][level] << kShift[version][level]))) | (newId << kShift[version][level]);
125 std::stringstream ss;
127 ss <<
"FsdAddress: address " << address <<
" (version " <<
GetVersion(address) <<
")"
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
@ kFsd
Forward spectator detector.
uint32_t GetSystemId(int32_t address)
Get system Id (should be integer value of ECbmModuleId::kFsd)
int32_t GetAddress(uint32_t Unit=0, uint32_t Module=0, uint32_t PhotoDet=0, uint32_t Version=kCurrentVersion)
Construct address.
uint32_t GetVersion(int32_t address)
Extract version number.
constexpr int32_t kVersionShift
uint32_t GetElementId(int32_t address, int32_t level)
Get the index of an element.
int32_t SetElementId(int32_t address, int32_t level, uint32_t newId)
Set the index of an element, leaving the other element levels untouched.
int32_t GetMotherAddress(int32_t address, int32_t level)
Construct the address of an element from the address of a descendant element.
constexpr uint32_t kCurrentVersion
constexpr int32_t kVersionMask
std::string ToString(int32_t address)
String output.