10#ifndef CBMSTSADDRESS_H
11#define CBMSTSADDRESS_H 1
20#include <xpu/defines.h>
106 {(1 <<
kBits[0][0]) - 1, (1 <<
kBits[0][1]) - 1, (1 <<
kBits[0][2]) - 1, (1 <<
kBits[0][3]) - 1,
107 (1 <<
kBits[0][4]) - 1, (1 <<
kBits[0][5]) - 1, (1 <<
kBits[0][6]) - 1},
109 {(1 <<
kBits[1][0]) - 1, (1 <<
kBits[1][1]) - 1, (1 <<
kBits[1][2]) - 1, (1 <<
kBits[1][3]) - 1,
110 (1 <<
kBits[1][4]) - 1, (1 <<
kBits[1][5]) - 1, (1 <<
kBits[1][6]) - 1}};
126 int32_t
GetAddress(uint32_t unit = 0, uint32_t ladder = 0, uint32_t halfladder = 0, uint32_t module = 0,
127 uint32_t sensor = 0, uint32_t side = 0, uint32_t version =
kCurrentVersion);
134 int32_t
GetAddress(uint32_t* elementId, uint32_t version);
180 int32_t
SetElementId(int32_t address, int32_t level, uint32_t newId);
188 using namespace Detail;
199 using namespace Detail;
204 int32_t ret = (address & kDMask) >> kShift[1][
kStsUnit];
209 LOG(error) <<
"Address " << address <<
" contains bits that are stripped by PackDigiAddress";
220 std::string
ToString(int32_t address);
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
@ kSts
Silicon Tracking System.
constexpr uint16_t kBits[kCurrentVersion+1][kStsNofLevels]
constexpr int32_t kMask[kCurrentVersion+1][kStsNofLevels]
constexpr int32_t kShift[kCurrentVersion+1][kStsNofLevels]
Functions to encode or decode the address field of STS data.
constexpr int32_t kVersionMask
uint32_t GetVersion(int32_t address)
Extract version number.
int32_t GetMotherAddress(int32_t address, int32_t level)
Construct the address of an element from the address of a descendant 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.
constexpr int32_t kVersionSize
int32_t GetAddress(uint32_t unit=0, uint32_t ladder=0, uint32_t halfladder=0, uint32_t module=0, uint32_t sensor=0, uint32_t side=0, uint32_t version=kCurrentVersion)
Construct address.
ECbmModuleId GetSystemId(int32_t address)
Get system Id (should be ECbmModuleId::kSts)
constexpr uint32_t kCurrentVersion
XPU_D int32_t PackDigiAddress(int32_t address)
Strip address to contain only unit, (half)ladder and module.
uint32_t GetElementId(int32_t address, int32_t level)
Get the index of an element.
constexpr int32_t kVersionShift
std::string ToString(int32_t address)
String output.
XPU_D int32_t UnpackDigiAddress(int32_t digiAddress)
Add version and system to compressed address that's stored in a digi.