CbmRoot
CbmStsAddress.h
Go to the documentation of this file.
1 
6 #ifndef CBMSTSADDRESS_H
7 #define CBMSTSADDRESS_H 1
8 
9 #include <RtypesCore.h> // for Int_t, UInt_t
10 
11 #include <sstream> // for string
12 
13 #include "CbmDefs.h" // for ECbmModuleId
14 
25 };
26 
27 
45 namespace CbmStsAddress {
46 
47  const UInt_t kCurrentVersion = 1;
48 
49  // --- These values are not to be changed if backward compatibility
50  // --- shall be maintained.
51  const Int_t kVersionSize = 4; // Bits for version number
52  const Int_t kVersionShift = 28; // First bit for version number
53  const Int_t kVersionMask = (1 << kVersionSize) - 1;
54 
55 
66  Int_t GetAddress(UInt_t unit = 0,
67  UInt_t ladder = 0,
68  UInt_t halfladder = 0,
69  UInt_t module = 0,
70  UInt_t sensor = 0,
71  UInt_t side = 0,
72  UInt_t version = kCurrentVersion);
73 
74 
79  Int_t GetAddress(UInt_t* elementId, UInt_t version);
80 
81 
91  Int_t GetMotherAddress(Int_t address, Int_t level);
92 
93 
99  UInt_t GetElementId(Int_t address, Int_t level);
100 
101 
105  ECbmModuleId GetSystemId(Int_t address);
106 
107 
115  UInt_t GetVersion(Int_t address);
116 
117 
125  Int_t SetElementId(Int_t address, Int_t level, UInt_t newId);
126 
127 
131  std::string ToString(Int_t address);
132 
133 } // Namespace CbmStsAddress
134 
135 
136 #endif // CBMSTSADDRESS_H
kStsHalfLadder
@ kStsHalfLadder
Definition: CbmStsAddress.h:20
CbmStsAddress::GetAddress
Int_t GetAddress(UInt_t unit=0, UInt_t ladder=0, UInt_t halfladder=0, UInt_t module=0, UInt_t sensor=0, UInt_t side=0, UInt_t version=kCurrentVersion)
Construct address.
Definition: CbmStsAddress.cxx:90
CbmStsAddress::kVersionMask
const Int_t kVersionMask
Definition: CbmStsAddress.h:53
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmStsAddress::kCurrentVersion
const UInt_t kCurrentVersion
Definition: CbmStsAddress.h:47
kStsSystem
@ kStsSystem
Definition: CbmStsAddress.h:17
CbmStsAddress::GetSystemId
ECbmModuleId GetSystemId(Int_t address)
Get system Id (should be ECbmModuleId::kSts)
Definition: CbmStsAddress.cxx:190
kStsModule
@ kStsModule
Definition: CbmStsAddress.h:21
CbmStsAddress::SetElementId
Int_t SetElementId(Int_t address, Int_t level, UInt_t newId)
Set the index of an element, leaving the other element levels untouched.
Definition: CbmStsAddress.cxx:205
CbmStsAddress::GetElementId
UInt_t GetElementId(Int_t address, Int_t level)
Get the index of an element.
Definition: CbmStsAddress.cxx:180
CbmStsAddress
Functions to encode or decode the address field of STS data.
Definition: CbmStsAddress.cxx:15
kStsSide
@ kStsSide
Definition: CbmStsAddress.h:23
kStsNofLevels
@ kStsNofLevels
Definition: CbmStsAddress.h:24
kStsUnit
@ kStsUnit
Definition: CbmStsAddress.h:18
EStsElementLevel
EStsElementLevel
Definition: CbmStsAddress.h:16
kStsSensor
@ kStsSensor
Definition: CbmStsAddress.h:22
kStsLadder
@ kStsLadder
Definition: CbmStsAddress.h:19
CbmStsAddress::GetVersion
UInt_t GetVersion(Int_t address)
Extract version number.
Definition: CbmStsAddress.cxx:198
CbmStsAddress::kVersionShift
const Int_t kVersionShift
Definition: CbmStsAddress.h:52
CbmStsAddress::GetMotherAddress
Int_t GetMotherAddress(Int_t address, Int_t level)
Construct the address of an element from the address of a descendant element.
Definition: CbmStsAddress.cxx:168
CbmStsAddress::kVersionSize
const Int_t kVersionSize
Definition: CbmStsAddress.h:51
CbmStsAddress::ToString
std::string ToString(Int_t address)
String output.
Definition: CbmStsAddress.cxx:221
CbmDefs.h