BmnRoot
Loading...
Searching...
No Matches
CbmStsAddress.h
Go to the documentation of this file.
1
6#ifndef CBMSTSADDRESS_H
7#define CBMSTSADDRESS_H 1
8
9#include <iomanip>
10#include "Rtypes.h"
11#include "FairLogger.h"
12#include "CbmAddress.h"
13
14
30
31
32
54class CbmStsAddress : public CbmAddress
55{
56
57 public:
58
69 static UInt_t GetAddress(Int_t station = 0,
70 Int_t ladder = 0,
71 Int_t halfladder = 0,
72 Int_t module = 0,
73 Int_t sensor = 0,
74 Int_t side = 0,
75 Int_t channel = 0);
76
77
78 static UInt_t GetAddress(Int_t* elementIds);
79
80
85 static Int_t GetNofLevels() { return kStsNofLevels; }
86
87
92 static Int_t GetNofBits(Int_t level) {
93 if ( level < 0 || level >= kStsNofLevels ) return 0;
94 return fgkBits[level];
95 }
96
97
103 static Int_t GetElementId(UInt_t address, Int_t level) {
104 if ( level < 0 || level >= kStsNofLevels ) return -1;
105 return ( address & ( fgkMask[level] << fgkShift[level] ) )
106 >> fgkShift[level];
107 }
108
109
111 static void Print();
112
113
121 static UInt_t SetElementId(UInt_t address, Int_t level, Int_t newId) {
122 if ( level < 0 || level >= kStsNofLevels ) return address;
123 if ( newId >= ( 1 << fgkBits[level]) ) {
124 LOG(error) << "Id " << newId << " for STS level " << level
125 << " exceeds maximum (" << (1 << fgkBits[level]) - 1
126 << ")";
127 return 0;
128 }
129 return ( address & (~ (fgkMask[level] << fgkShift[level]) ) )
130 | ( newId << fgkShift[level]);
131 }
132
133
134 private:
135
137 static const Int_t fgkBits[kStsNofLevels];
138
140 static const Int_t fgkShift[kStsNofLevels];
141
143 static const Int_t fgkMask[kStsNofLevels];
144
145
146 ClassDef(CbmStsAddress,1);
147};
148
149
150#endif /* CBMSTSADDRESS_H */
StsElementLevel
@ kStsModule
Module.
@ kStsStation
Station.
@ kStsLadder
Ladder.
@ kStsSystem
System = STS.
@ kStsSide
Side.
@ kStsNofLevels
Number of STS levels.
@ kStsHalfLadder
Halfladder.
@ kStsSensor
Sensor.
@ kStsChannel
Channel.
Interface class to unique address for the STS.
static UInt_t GetAddress(Int_t station=0, Int_t ladder=0, Int_t halfladder=0, Int_t module=0, Int_t sensor=0, Int_t side=0, Int_t channel=0)
static void Print()
static Int_t GetElementId(UInt_t address, Int_t level)
static Int_t GetNofBits(Int_t level)
static UInt_t SetElementId(UInt_t address, Int_t level, Int_t newId)
static Int_t GetNofLevels()