CbmRoot
CbmTofAddress.h
Go to the documentation of this file.
1 
31 #ifndef CBMTOFADDRESS_H
32 #define CBMTOFADDRESS_H 1
33 
34 #include "CbmAddress.h" // for CbmAddress, CbmAddress::fgkSystem...
35 #include "CbmDefs.h" // for kTof
36 #include "CbmTofDetectorId.h" // for CbmTofDetectorInfo
37 #include "CbmTofDetectorId_v12b.h" // for CbmTofDetectorId_v12b
38 #include <RtypesCore.h> // for Int_t, UInt_t, Bool_t, kFALSE, kTRUE
39 
40 class CbmTofAddress : public CbmAddress {
41 public:
44 
46  virtual ~CbmTofAddress() {};
47 
52  static Int_t GetNofSmIdBits() { return fgkSmIdBits; };
56  static Int_t GetNofSmTypeBits() { return fgkSmTypeBits; };
60  static Int_t GetNofRpcIdBits() { return fgkRpcIdBits; };
64  static Int_t GetNofChannelIdBits() { return fgkChannelIdBits; };
68  static Int_t GetNofChSideBits() { return fgkChannelSideBits; };
69 
75  static Int_t GetSmId(UInt_t address) {
76  return ((address >> fgkSmIdOffset) & ((1 << fgkSmIdBits) - 1));
77  };
82  static Int_t GetSmType(UInt_t address) {
83  return ((address >> fgkSmTypeOffset) & ((1 << fgkSmTypeBits) - 1));
84  };
89  static Int_t GetRpcId(UInt_t address) {
90  return ((address >> fgkRpcIdOffset) & ((1 << fgkRpcIdBits) - 1));
91  };
96  static Int_t GetChannelId(UInt_t address) {
97  return ((address >> fgkChannelIdOffset) & ((1 << fgkChannelIdBits) - 1));
98  };
103  static Int_t GetChannelSide(UInt_t address) {
104  return ((address >> fgkChannelSideOffset)
105  & ((1 << fgkChannelSideBits) - 1));
106  };
111  static Int_t GetModFullId(UInt_t address) {
112  return (address & fgkiModFullIdMask);
113  };
114 
124  static UInt_t GetUniqueAddress(UInt_t Sm,
125  UInt_t Rpc,
126  UInt_t Channel,
127  UInt_t Side = 0,
128  UInt_t SmType = 0) {
129  return (UInt_t)(
131  + ((Sm & ((1 << fgkSmIdBits) - 1)) << fgkSmIdOffset)
132  + ((SmType & ((1 << fgkSmTypeBits) - 1)) << fgkSmTypeOffset)
133  + ((Side & ((1 << fgkChannelSideBits) - 1)) << fgkChannelSideOffset)
134  + ((Rpc & ((1 << fgkRpcIdBits) - 1)) << fgkRpcIdOffset)
135  + ((Channel & ((1 << fgkChannelIdBits) - 1)) << fgkChannelIdOffset));
136  };
137 
138  static Bool_t SameModule(UInt_t addressA, UInt_t addressB) {
139  return (GetModFullId(addressA) == GetModFullId(addressB)) ? kTRUE : kFALSE;
140  };
141 
143  // For now assume that the system ID will always be correct
144  // Otherwise would need including CbmDetectorList.h
145  // if( kTof != infoInput.fDetectorSystem)
146  // return 0;
147 
148  return GetUniqueAddress(infoInput.fSModule,
149  infoInput.fCounter,
150  infoInput.fCell,
151  0,
152  infoInput.fSMtype);
153  };
154  static UInt_t ConvertCbmTofDetectorId(Int_t detIdInput) {
155  // For now assume that the system ID will always be correct
156  // Otherwise would need including CbmDetectorList.h
157  // if( kTof != CbmTofDetectorId::GetSystemId( detIdInput ) )
158  // return 0;
159  CbmTofDetectorId_v12b detId;
160  return GetUniqueAddress(detId.GetSModule(detIdInput),
161  detId.GetCounter(detIdInput),
162  detId.GetCell(detIdInput),
163  0,
164  detId.GetSMType(detIdInput));
165  };
166 
167 private:
175  static const Int_t fgkSmIdBits = 8;
177  static const Int_t fgkSmTypeBits = 4;
179  static const Int_t fgkRpcIdBits = 7;
181  static const Int_t fgkChannelSideBits = 1;
183  static const Int_t fgkChannelIdBits = 8;
184 
192  static const Int_t fgkSmIdOffset;
194  static const Int_t fgkSmTypeOffset;
196  static const Int_t fgkChannelSideOffset;
198  static const Int_t fgkRpcIdOffset;
200  static const Int_t fgkChannelIdOffset;
201 
205  static const Int_t fgkiModFullIdMask;
206 };
207 
208 #endif // CBMTOFADDRESS_H
CbmTofAddress::GetNofChSideBits
static Int_t GetNofChSideBits()
Definition: CbmTofAddress.h:68
CbmTofAddress::fgkChannelIdOffset
static const Int_t fgkChannelIdOffset
Definition: CbmTofAddress.h:200
CbmTofDetectorId.h
CbmTofAddress::fgkSmIdBits
static const Int_t fgkSmIdBits
Definition: CbmTofAddress.h:175
CbmTofAddress::GetSmType
static Int_t GetSmType(UInt_t address)
Definition: CbmTofAddress.h:82
CbmAddress::fgkSystemBits
static const Int_t fgkSystemBits
Definition: CbmAddress.h:50
CbmTofDetectorId_v12b::GetSModule
Int_t GetSModule(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:51
CbmTofDetectorInfo::fCell
Int_t fCell
Definition: CbmTofDetectorId.h:62
CbmTofAddress::GetNofRpcIdBits
static Int_t GetNofRpcIdBits()
Definition: CbmTofAddress.h:60
CbmTofAddress::GetRpcId
static Int_t GetRpcId(UInt_t address)
Definition: CbmTofAddress.h:89
CbmTofAddress::CbmTofAddress
CbmTofAddress()
Definition: CbmTofAddress.h:43
CbmTofDetectorId_v12b
Definition: CbmTofDetectorId_v12b.h:33
CbmTofAddress::ConvertCbmTofDetectorInfo
static UInt_t ConvertCbmTofDetectorInfo(CbmTofDetectorInfo infoInput)
Definition: CbmTofAddress.h:142
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
CbmTofAddress::GetNofChannelIdBits
static Int_t GetNofChannelIdBits()
Definition: CbmTofAddress.h:64
CbmTofAddress::GetSmId
static Int_t GetSmId(UInt_t address)
Definition: CbmTofAddress.h:75
CbmAddress
Base class for interfaces to the unique address.
Definition: CbmAddress.h:23
CbmTofAddress::ConvertCbmTofDetectorId
static UInt_t ConvertCbmTofDetectorId(Int_t detIdInput)
Definition: CbmTofAddress.h:154
CbmTofAddress
CBM ToF interface class to the unique address.
Definition: CbmTofAddress.h:40
CbmTofAddress::GetChannelSide
static Int_t GetChannelSide(UInt_t address)
Definition: CbmTofAddress.h:103
CbmTofDetectorId_v12b.h
CbmTofAddress::GetChannelId
static Int_t GetChannelId(UInt_t address)
Definition: CbmTofAddress.h:96
CbmTofAddress::fgkRpcIdOffset
static const Int_t fgkRpcIdOffset
Definition: CbmTofAddress.h:198
CbmTofAddress::~CbmTofAddress
virtual ~CbmTofAddress()
Definition: CbmTofAddress.h:46
CbmTofAddress::fgkRpcIdBits
static const Int_t fgkRpcIdBits
Definition: CbmTofAddress.h:179
CbmTofAddress::GetNofSmTypeBits
static Int_t GetNofSmTypeBits()
Definition: CbmTofAddress.h:56
CbmTofDetectorInfo
Definition: CbmTofDetectorId.h:20
CbmTofAddress::fgkSmTypeBits
static const Int_t fgkSmTypeBits
Definition: CbmTofAddress.h:177
CbmTofDetectorInfo::fSModule
Int_t fSModule
Definition: CbmTofDetectorId.h:59
CbmTofAddress::GetNofSmIdBits
static Int_t GetNofSmIdBits()
Definition: CbmTofAddress.h:52
CbmTofAddress::fgkSmTypeOffset
static const Int_t fgkSmTypeOffset
Definition: CbmTofAddress.h:194
CbmAddress.h
CbmTofAddress::fgkChannelSideBits
static const Int_t fgkChannelSideBits
Definition: CbmTofAddress.h:181
ToIntegralType
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Definition: CbmDefs.h:24
CbmTofAddress::SameModule
static Bool_t SameModule(UInt_t addressA, UInt_t addressB)
Definition: CbmTofAddress.h:138
CbmTofDetectorInfo::fCounter
Int_t fCounter
Definition: CbmTofDetectorId.h:60
CbmTofAddress::fgkChannelSideOffset
static const Int_t fgkChannelSideOffset
Definition: CbmTofAddress.h:196
CbmTofDetectorId_v12b::GetCell
Int_t GetCell(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:69
CbmTofAddress::GetUniqueAddress
static UInt_t GetUniqueAddress(UInt_t Sm, UInt_t Rpc, UInt_t Channel, UInt_t Side=0, UInt_t SmType=0)
Definition: CbmTofAddress.h:124
CbmTofAddress::fgkiModFullIdMask
static const Int_t fgkiModFullIdMask
Definition: CbmTofAddress.h:205
CbmTofDetectorId_v12b::GetCounter
Int_t GetCounter(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:57
CbmTofDetectorInfo::fSMtype
Int_t fSMtype
Definition: CbmTofDetectorId.h:58
CbmTofAddress::fgkSmIdOffset
static const Int_t fgkSmIdOffset
Definition: CbmTofAddress.h:192
CbmTofDetectorId_v12b::GetSMType
Int_t GetSMType(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:45
CbmTofAddress::GetModFullId
static Int_t GetModFullId(UInt_t address)
Definition: CbmTofAddress.h:111
CbmDefs.h
CbmTofAddress::fgkChannelIdBits
static const Int_t fgkChannelIdBits
Definition: CbmTofAddress.h:183