BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnHodoAddress.h
Go to the documentation of this file.
1/** \class BmnHodoAddress
2 ** \brief BmnHodo interface class to the unique address
3 ** \author Nikolay Karpushkin <karpushkin@inr.ru>
4 ** \version 1.0
5 **
6 ** BmnHodoAddress is the class for the concrete interfaces to the unique address,
7 ** which is encoded in a 32-bit field (uint32_t), for the Hodo detector elements.
8 **
9 ** 3 2 1 0 Shift Bits Values
10 ** Current definition: 10987654321098765432109876543210
11 ** System id on bits 0- 4 00000000000000000000000000011111 << 0 5 31
12 ** Strip idx on bits 6-10 00000000000000000000011111000000 << 6 5 31
13 ** Strip side on bits 11-11 00000000000000000000100000000000 <<11 1 1
14 ** Gain on bits 12-12 00000000000000000001000000000000 <<12 1 1
15 **
16 **/
17
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:
28 /**
29 * \brief Return address from system ID, StripId, StripSide, Gain.
30 * \param[in] StripId Strip id.
31 * \param[in] StripSide Strip side.
32 * \param[in] Gain Gain.
33 * \return Address from system ID, StripId, StripSide, Gain.
34 **/
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
45 /**
46 * \brief Return System identifier from address.
47 * \param[in] address Unique channel address.
48 * \return System identifier from address.
49 **/
50 static uint32_t GetSystemId(uint32_t address)
51 {
52 return (address & (fgkSystemIdLength << fgkSystemIdShift)) >> fgkSystemIdShift;
53 }
54
55 /**
56 * \brief Return Strip id from address.
57 * \param[in] address Unique channel address.
58 * \return Strip id from address.
59 **/
60 static uint32_t GetStripId(uint32_t address)
61 {
62 return (address & (fgkStripIdLength << fgkStripIdShift)) >> fgkStripIdShift;
63 }
64
65 /**
66 * \brief Return Strip side from address.
67 * \param[in] address Unique channel address.
68 * \return Strip side from address.
69 **/
70 static uint32_t GetStripSide(uint32_t address)
71 {
73 }
74
75 /**
76 * \brief Return Gain from address.
77 * \param[in] address Unique channel address.
78 * \return Gain from address.
79 **/
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 const uint32_t fgkStripSideShift
static const uint32_t fgkStripIdShift
static const uint32_t fgkStripSideLength
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 const uint32_t fgkGainShift
static uint32_t GetAddress(uint32_t StripId, uint32_t StripSide, uint32_t Gain)
Return address from system ID, StripId, StripSide, Gain.
static const uint32_t fgkSystemIdShift
static const uint32_t fgkStripIdLength
static const uint32_t fgkSystemIdLength
static uint32_t GetSystemId(uint32_t address)
Return System identifier from address.
static const uint32_t fgkGainLength
static uint32_t GetGain(uint32_t address)
Return Gain from address.
Defines unique identifiers (enum) for all BM@N detector systems.