19#ifndef BmnFHCalAddress_H
20#define BmnFHCalAddress_H 1
39 static uint32_t
GetAddress(uint32_t ModuleType, uint32_t ModuleId, uint32_t SectionId, uint32_t ScintillatorId = 0)
41 assert((uint32_t)
kFHCAL <= fgkSystemIdLength);
42 assert(ModuleType <= fgkModTypeLength);
43 assert(ModuleId <= fgkModIdxLength);
44 assert(SectionId <= fgkSecIdxLength);
45 assert(ScintillatorId <= fgkScintIdxLength);
46 return ((((uint32_t)
kFHCAL) << fgkSystemIdShift) | (ModuleType << fgkModTypeShift)
47 | (ModuleId << fgkModIdxShift) | (SectionId << fgkSecIdxShift) | (ScintillatorId << fgkScintIdxShift));
57 std::ostringstream oss;
58 oss <<
"Address: " << address <<
", SystemId: " <<
GetSystemId(address)
71 return (address & (fgkSystemIdLength << fgkSystemIdShift)) >> fgkSystemIdShift;
81 return (address & (fgkModTypeLength << fgkModTypeShift)) >> fgkModTypeShift;
91 return (address & (fgkModIdxLength << fgkModIdxShift)) >> fgkModIdxShift;
101 return (address & (fgkSecIdxLength << fgkSecIdxShift)) >> fgkSecIdxShift;
111 return (address & (fgkScintIdxLength << fgkScintIdxShift)) >> fgkScintIdxShift;
119 static uint32_t
GetPhysicalAddress(uint32_t address) {
return address & ((1 << fgkScintIdxShift) - 1); }
123 static const uint32_t fgkSystemIdLength = 31;
124 static const uint32_t fgkModTypeLength = 3;
125 static const uint32_t fgkModIdxLength = 127;
126 static const uint32_t fgkSecIdxLength = 15;
127 static const uint32_t fgkScintIdxLength = 7;
130 static const uint32_t fgkSystemIdShift = 0;
131 static const uint32_t fgkModTypeShift = 5;
132 static const uint32_t fgkModIdxShift = 7;
133 static const uint32_t fgkSecIdxShift = 14;
134 static const uint32_t fgkScintIdxShift = 18;
BmnFHCal interface class to the unique address.
static uint32_t GetModuleId(uint32_t address)
Return Module id from address.
static uint32_t GetModuleType(uint32_t address)
Return Module id from address.
static std::string GetInfoString(uint32_t address)
Return a formatted string with all address components.
static uint32_t GetSectionId(uint32_t address)
Return Section id from address.
static uint32_t GetSystemId(uint32_t address)
Return System identifier from address.
static uint32_t GetPhysicalAddress(uint32_t address)
Return Physical address (w/o scintillator id) from address.
virtual ~BmnFHCalAddress()
static uint32_t GetAddress(uint32_t ModuleType, uint32_t ModuleId, uint32_t SectionId, uint32_t ScintillatorId=0)
Return address from system ID, Module type, Module ID, Section ID, Scintillator ID (optional).
static uint32_t GetScintillatorId(uint32_t address)
Return Scintillator id from address.
Defines unique identifiers (enum) for all BM@N detector systems.