Go to the documentation of this file.
10 #include <FairLogger.h>
68 {(1 <<
kBits[0][0]) - 1,
69 (1 <<
kBits[0][1]) - 1,
70 (1 <<
kBits[0][2]) - 1,
71 (1 <<
kBits[0][3]) - 1,
72 (1 <<
kBits[0][4]) - 1,
73 (1 <<
kBits[0][5]) - 1,
74 (1 <<
kBits[0][6]) - 1},
76 {(1 <<
kBits[1][0]) - 1,
77 (1 <<
kBits[1][1]) - 1,
78 (1 <<
kBits[1][2]) - 1,
79 (1 <<
kBits[1][3]) - 1,
80 (1 <<
kBits[1][4]) - 1,
81 (1 <<
kBits[1][5]) - 1,
82 (1 <<
kBits[1][6]) - 1}};
102 if (unit > maxUnit) {
103 LOG(error) <<
"Unit Id " << unit <<
" exceeds maximum " << maxUnit;
107 if (ladder > maxLadder) {
108 LOG(error) <<
"Ladder Id " << ladder <<
" exceeds maximum " << maxLadder;
112 if (halfladder > maxHalfLadder) {
113 LOG(error) <<
"HalfLadder Id " << halfladder <<
" exceeds maximum "
118 if (module > maxModule) {
119 LOG(error) <<
"Module Id " << module <<
" exceeds maximum " << maxModule;
123 if (sensor > maxSensor) {
124 LOG(error) <<
"Sensor Id " << sensor <<
" exceeds maximum " << maxSensor;
128 if (side > maxSide) {
129 LOG(error) <<
"Side Id " << side <<
" exceeds maximum " << maxSide;
152 UInt_t maxId = (1 <<
kBits[version][level]) - 1;
153 if (elementId[level] > maxId) {
154 LOG(error) <<
"Id " << elementId[level] <<
" for STS level " << level
155 <<
" exceeds maximum " << maxId;
158 address = address | (elementId[level] <<
kShift[version][level]);
172 Int_t motherAdd = (address & ((1 <<
kShift[version][level + 1]) - 1));
183 return (address & (
kMask[version][level] <<
kShift[version][level]))
184 >>
kShift[version][level];
208 UInt_t maxId = (1 <<
kBits[version][level]) - 1;
210 LOG(fatal) <<
"Id " << newId <<
" for STS level " << level
211 <<
" exceeds maximum " << maxId;
214 return (address & (~(
kMask[version][level] <<
kShift[version][level])))
215 | (newId <<
kShift[version][level]);
222 std::stringstream ss;
224 ss <<
"StsAddress: address " << address <<
" (version " <<
GetVersion(address)
Int_t GetAddress(UInt_t unit=0, UInt_t ladder=0, UInt_t halfladder=0, UInt_t module=0, UInt_t sensor=0, UInt_t side=0, UInt_t version=kCurrentVersion)
Construct address.
const UInt_t kCurrentVersion
const UShort_t kBits[kCurrentVersion+1][kStsNofLevels]
ECbmModuleId GetSystemId(Int_t address)
Get system Id (should be ECbmModuleId::kSts)
Int_t SetElementId(Int_t address, Int_t level, UInt_t newId)
Set the index of an element, leaving the other element levels untouched.
UInt_t GetElementId(Int_t address, Int_t level)
Get the index of an element.
Functions to encode or decode the address field of STS data.
const Int_t kMask[kCurrentVersion+1][kStsNofLevels]
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
UInt_t GetVersion(Int_t address)
Extract version number.
const Int_t kVersionShift
Int_t GetMotherAddress(Int_t address, Int_t level)
Construct the address of an element from the address of a descendant element.
@ kSts
Silicon Tracking System.
std::string ToString(Int_t address)
String output.
const Int_t kShift[kCurrentVersion+1][kStsNofLevels]