BmnRoot
Loading...
Searching...
No Matches
BmnHodoAddress.h
Go to the documentation of this file.
1
18#ifndef BmnHodoAddress_H
19#define BmnHodoAddress_H 1
20
21#include "BmnDetectorList.h" // for kHodo
22
23#include <cassert> // for assert
24
26{
27 public:
35 static uint32_t GetAddress(uint32_t StripId, uint32_t StripSide, uint32_t Gain)
36 {
37 assert((uint32_t)kHODO <= fgkSystemIdLength);
38 assert(StripId <= fgkStripIdLength);
39 assert(StripSide <= fgkStripSideLength);
40 assert(Gain <= fgkGainLength);
41 return ((((uint32_t)kHODO) << fgkSystemIdShift) | (StripId << fgkStripIdShift)
42 | (StripSide << fgkStripSideShift) | (Gain << fgkGainShift));
43 }
44
50 static uint32_t GetSystemId(uint32_t address)
51 {
52 return (address & (fgkSystemIdLength << fgkSystemIdShift)) >> fgkSystemIdShift;
53 }
54
60 static uint32_t GetStripId(uint32_t address)
61 {
62 return (address & (fgkStripIdLength << fgkStripIdShift)) >> fgkStripIdShift;
63 }
64
70 static uint32_t GetStripSide(uint32_t address)
71 {
72 return (address & (fgkStripSideLength << fgkStripSideShift)) >> fgkStripSideShift;
73 }
74
80 static uint32_t GetGain(uint32_t address) { return (address & (fgkGainLength << fgkGainShift)) >> fgkGainShift; }
81
82 private:
83 // Length of the index of the corresponding volume
84 static const uint32_t fgkSystemIdLength = 31; // 2^5 - 1
85 static const uint32_t fgkStripIdLength = 31; // 2^5 - 1
86 static const uint32_t fgkStripSideLength = 1; // 2^1 - 1
87 static const uint32_t fgkGainLength = 1; // 2^1 - 1
88
89 // Number of a start bit for each volume
90 static const uint32_t fgkSystemIdShift = 0;
91 static const uint32_t fgkStripIdShift = 6;
92 static const uint32_t fgkStripSideShift = 11;
93 static const uint32_t fgkGainShift = 12;
94};
95
96#endif
@ kHODO
BmnHodo interface class to the unique address.
static uint32_t GetStripSide(uint32_t address)
Return Strip side from address.
static uint32_t GetStripId(uint32_t address)
Return Strip id from address.
static uint32_t GetAddress(uint32_t StripId, uint32_t StripSide, uint32_t Gain)
Return address from system ID, StripId, StripSide, Gain.
static uint32_t GetSystemId(uint32_t address)
Return System identifier from address.
static uint32_t GetGain(uint32_t address)
Return Gain from address.
Defines unique identifiers (enum) for all BM@N detector systems.