BmnRoot
26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
CbmStsAddress.h
Go to the documentation of this file.
1
/** @file CbmStsAddress.h
2
** @author Volker Friese <v.friese@gsi.de>
3
** @date 17.05.2013
4
**/
5
6
#ifndef CBMSTSADDRESS_H
7
#define CBMSTSADDRESS_H 1
8
9
#include "CbmAddress.h"
10
#include "FairLogger.h"
11
#include "
Rtypes.h
"
12
13
#include <iomanip>
14
15
/** Enumerator for STS element levels
16
** If this is changed, the initialisation of the static members
17
** of CbmStsAddress must be changed accordingly!
18
**/
19
enum
StsElementLevel
20
{
21
kStsSystem
,
//!< System = STS
22
kStsStation
,
//!< Station
23
kStsLadder
,
//!< Ladder
24
kStsHalfLadder
,
//!< Halfladder
25
kStsModule
,
//!< Module
26
kStsSensor
,
//!< Sensor
27
kStsSide
,
//!< Side
28
kStsChannel
,
//!< Channel
29
kStsNofLevels
//!< Number of STS levels
30
};
31
32
/** @class CbmStsAddress
33
** @brief Interface class to unique address for the STS
34
** @author V.Friese <v.friese@gsi.de>
35
** @version 1.0
36
**
37
** The CbmStsAddress interprets and modifies the unique address
38
** for the STS by the proper bit operation on the address bit field.
39
**
40
** The current definition of the bit field for the STS is:
41
**
42
** 3 2 1
43
** Level Bits Max. Elements Shift 10987654321098765432109876543210 \n
44
** System (kSTS) 4 16 0 0000000000000000000000000000xxxx \n
45
** Station 4 16 4 000000000000000000000000xxxx0000 \n
46
** Ladder 4 16 8 00000000000000000000xxxx00000000 \n
47
** HalfLadder 1 2 12 0000000000000000000x000000000000 \n
48
** Module 3 8 13 0000000000000000xxx0000000000000 \n
49
** Sensor 2 4 16 00000000000000xx0000000000000000 \n
50
** Side 1 2 18 0000000000000x000000000000000000 \n
51
** Channel 13 8192 19 xxxxxxxxxxxxx0000000000000000000 \n
52
**/
53
class
CbmStsAddress
:
public
CbmAddress
54
{
55
56
public
:
57
/** Construct address
58
** @param station Station index
59
** @param ladder Ladder index in station
60
** @param halfladder Halfladder index in ladder
61
** @param module Module index within halfladder
62
** @param sensor Sensor index within module
63
** @param side Side (0=front, 1=back) of sensor
64
** @param channel Channel number
65
** @return Unique element address
66
**/
67
static
UInt_t
GetAddress
(
Int_t
station = 0,
68
Int_t
ladder = 0,
69
Int_t
halfladder = 0,
70
Int_t
module = 0,
71
Int_t
sensor = 0,
72
Int_t
side = 0,
73
Int_t
channel = 0);
74
75
static
UInt_t
GetAddress
(
Int_t
* elementIds);
76
77
/** Get the number of hierarchy levels
78
** For use in macros which do not include this header file.
79
** @return Number of hierarchy levels
80
**/
81
static
Int_t
GetNofLevels
() {
return
kStsNofLevels
; }
82
83
/** Get the number of bits for a given hierarchy level
84
** @param level Requested element level
85
** @return Number of bits in address field
86
**/
87
static
Int_t
GetNofBits
(
Int_t
level)
88
{
89
if
(level < 0 || level >=
kStsNofLevels
)
90
return
0;
91
return
fgkBits
[level];
92
}
93
94
/** Get the index of an element
95
** @param address Unique element address
96
** @param level Hierarchy level
97
** @return Element index
98
**/
99
static
Int_t
GetElementId
(
UInt_t
address,
Int_t
level)
100
{
101
if
(level < 0 || level >=
kStsNofLevels
)
102
return
-1;
103
return
(address & (
fgkMask
[level] <<
fgkShift
[level])) >>
fgkShift
[level];
104
}
105
106
/** Print information on the bit field **/
107
static
void
Print
();
108
109
/** Set the index of an element
110
** leaving the other element levels untouched
111
** @param address Unique element address
112
** @param level Hierarchy level
113
** @param newId New element index
114
** @return New address
115
**/
116
static
UInt_t
SetElementId
(
UInt_t
address,
Int_t
level,
Int_t
newId)
117
{
118
if
(level < 0 || level >=
kStsNofLevels
)
119
return
address;
120
if
(newId >= (1 <<
fgkBits
[level])) {
121
LOG(error) <<
"Id "
<< newId <<
" for STS level "
<< level <<
" exceeds maximum ("
122
<< (1 <<
fgkBits
[level]) - 1 <<
")"
;
123
return
0;
124
}
125
return
(address & (~(
fgkMask
[level] <<
fgkShift
[level]))) | (newId <<
fgkShift
[level]);
126
}
127
128
private
:
129
/** Number of bits for the different levels **/
130
static
const
Int_t
fgkBits
[
kStsNofLevels
];
131
132
/** Bit shifts for the different levels **/
133
static
const
Int_t
fgkShift
[
kStsNofLevels
];
134
135
/** Bit masks for the different levels **/
136
static
const
Int_t
fgkMask
[
kStsNofLevels
];
137
138
ClassDef
(
CbmStsAddress
, 1);
139
};
140
141
#endif
/* CBMSTSADDRESS_H */
StsElementLevel
StsElementLevel
Enumerator for STS element levels If this is changed, the initialisation of the static members of Cbm...
Definition
CbmStsAddress.h:20
kStsModule
@ kStsModule
Module.
Definition
CbmStsAddress.h:25
kStsStation
@ kStsStation
Station.
Definition
CbmStsAddress.h:22
kStsLadder
@ kStsLadder
Ladder.
Definition
CbmStsAddress.h:23
kStsSystem
@ kStsSystem
System = STS.
Definition
CbmStsAddress.h:21
kStsSide
@ kStsSide
Side.
Definition
CbmStsAddress.h:27
kStsNofLevels
@ kStsNofLevels
Number of STS levels.
Definition
CbmStsAddress.h:29
kStsHalfLadder
@ kStsHalfLadder
Halfladder.
Definition
CbmStsAddress.h:24
kStsSensor
@ kStsSensor
Sensor.
Definition
CbmStsAddress.h:26
kStsChannel
@ kStsChannel
Channel.
Definition
CbmStsAddress.h:28
Int_t
int Int_t
UInt_t
unsigned int UInt_t
Rtypes.h
ClassDef
#define ClassDef(name, id)
CbmAddress
CbmStsAddress
Interface class to unique address for the STS.
Definition
CbmStsAddress.h:54
CbmStsAddress::GetAddress
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)
Construct address.
Definition
CbmStsAddress.cxx:39
CbmStsAddress::fgkMask
static const Int_t fgkMask[kStsNofLevels]
Bit masks for the different levels.
Definition
CbmStsAddress.h:33
CbmStsAddress::Print
static void Print()
Print information on the bit field.
Definition
CbmStsAddress.cxx:104
CbmStsAddress::fgkShift
static const Int_t fgkShift[kStsNofLevels]
Bit shifts for the different levels.
Definition
CbmStsAddress.h:22
CbmStsAddress::GetElementId
static Int_t GetElementId(UInt_t address, Int_t level)
Get the index of an element.
Definition
CbmStsAddress.h:99
CbmStsAddress::fgkBits
static const Int_t fgkBits[kStsNofLevels]
Number of bits for the different levels.
Definition
CbmStsAddress.h:11
CbmStsAddress::GetNofBits
static Int_t GetNofBits(Int_t level)
Get the number of bits for a given hierarchy level.
Definition
CbmStsAddress.h:87
CbmStsAddress::SetElementId
static UInt_t SetElementId(UInt_t address, Int_t level, Int_t newId)
Set the index of an element leaving the other element levels untouched.
Definition
CbmStsAddress.h:116
CbmStsAddress::GetNofLevels
static Int_t GetNofLevels()
Get the number of hierarchy levels For use in macros which do not include this header file.
Definition
CbmStsAddress.h:81
detectors
sts
setup
CbmStsAddress.h
Generated on
for BmnRoot by
1.17.0