BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
CbmStsDetectorId.h
Go to the documentation of this file.
1/** CbmStsDetectorId.h
2 **@author V.Friese <v.friese@gsi.de>
3 **@since 21.10.2009
4 **@version 1.0
5 **
6 ** Prescription for encoding / decoding the detector ID (integer)
7 ** from / to station nr., sector nr., side and channel nr.
8 **
9 ** Ranges:
10 ** - Station number 4 bits 1 - 15
11 ** - Sector number 8 bits 1 - 255 //AZ
12 ** - Side 1 bit 0 - 1
13 ** - Channel number 12 bits 1 - 4095 //AZ
14 **
15 ** The value 0 is reserved to denote the next higher hierarchy level,
16 ** i.e. station 3, sector 0 denotes the entire station 3, not a specific sector.
17 **
18 ** All data classes using this functionality have to inherit from
19 ** this class.
20 **/
21
22#ifndef CBMSTSDETECTORID_H
23#define CBMSTSDETECTORID_H 1
24
25#include "BmnDetectorList.h"
26
28{
29 public:
30 /** Constructor (empty) **/
32
33 /** Destructor (empty) **/
34 virtual ~CbmStsDetectorId() {}
35
36 /** Create unique detector ID
37 **@param station Station number (0 - 15)
38 **@param sector Sector number (0 - 255)
39 **@param side 0 = front side / 1 = back side
40 **@param channel channel number (0 - 4095)
41 **/
42 Int_t DetectorId(Int_t station, Int_t sector, Int_t side, Int_t channel) const
43 {
44 return (kGEM & 15) // System ID on bits 0-3
45 | ((station & fgkStatMask) << fgkStatShift) // Station number
46 | ((sector & fgkSectMask) << fgkSectShift) // Sector number
47 | ((side & fgkSideMask) << fgkSideShift) // Side on bit
48 | ((channel & fgkChanMask) << fgkChanShift); // Channel number
49 }
50
51 /** Get system identifier from detectorId **/
52 Int_t SystemId(Int_t detectorId) const { return (detectorId & 15); }
53
54 /** Get station number from detectorId **/
55 Int_t StationNr(Int_t detectorId) const { return ((detectorId >> fgkStatShift) & fgkStatMask); }
56
57 /** Get sector number from detectorId **/
58 Int_t SectorNr(Int_t detectorId) const { return ((detectorId >> fgkSectShift) & fgkSectMask); }
59
60 /** Get side from detectorId **/
61 Int_t Side(Int_t detectorId) const { return ((detectorId >> fgkSideShift) & fgkSideMask); }
62
63 /** Get channel number from detectorId **/
64 Int_t ChannelNr(Int_t detectorId) const { return ((detectorId >> fgkChanShift) & fgkChanMask); }
65
66 /** Number of bits for address fields (static) **/
67 static const Int_t fgkStatBits;
68 static const Int_t fgkSectBits;
69 static const Int_t fgkSideBits;
70 static const Int_t fgkChanBits;
71
72 private:
73 /** Bit shift for address fields (static) **/
74 static const Int_t fgkStatShift;
75 static const Int_t fgkSectShift;
76 static const Int_t fgkSideShift;
77 static const Int_t fgkChanShift;
78
79 /** Bit mask for address fields (static) **/
80 static const Int_t fgkStatMask;
81 static const Int_t fgkSectMask;
82 static const Int_t fgkSideMask;
83 static const Int_t fgkChanMask;
84
86};
87
88#endif
int Int_t
#define ClassDef(name, id)
@ kGEM
CbmStsDetectorId.h.
static const Int_t fgkSideBits
static const Int_t fgkStatBits
Number of bits for address fields (static).
Int_t StationNr(Int_t detectorId) const
Get station number from detectorId.
Int_t ChannelNr(Int_t detectorId) const
Get channel number from detectorId.
static const Int_t fgkSideMask
static const Int_t fgkSectMask
static const Int_t fgkChanShift
static const Int_t fgkSectShift
Int_t SystemId(Int_t detectorId) const
Get system identifier from detectorId.
virtual ~CbmStsDetectorId()
Destructor (empty).
Int_t Side(Int_t detectorId) const
Get side from detectorId.
Int_t SectorNr(Int_t detectorId) const
Get sector number from detectorId.
static const Int_t fgkSectBits
static const Int_t fgkChanBits
static const Int_t fgkStatShift
Bit shift for address fields (static).
static const Int_t fgkStatMask
Bit mask for address fields (static).
CbmStsDetectorId()
Constructor (empty).
static const Int_t fgkSideShift
static const Int_t fgkChanMask
Int_t DetectorId(Int_t station, Int_t sector, Int_t side, Int_t channel) const
Create unique detector ID.
Defines unique identifiers (enum) for all BM@N detector systems.