CbmRoot
CbmTofDetectorId_v14a.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmTofDetectorId source file -----
3 // ----- Created 20/11/12 by F. Uhlig -----
4 // -------------------------------------------------------------------------
5 
6 
8 
9 const Int_t CbmTofDetectorId_v14a::shiftarray[] = {0, 4, 12, 16, 23, 24};
10 const Int_t CbmTofDetectorId_v14a::bitarray[] = {4, 8, 4, 7, 1, 8};
11 
12 
14  : CbmTofDetectorId(), result_array(), maskarray(), modulemask(0) {
15  for (Int_t i = 0; i < array_length; i++) {
16  maskarray[i] = (1 << bitarray[i]) - 1;
17  }
18 
19  modulemask =
20  ((maskarray[0] << shiftarray[0]) | (maskarray[1] << shiftarray[1])
21  | (maskarray[2] << shiftarray[2]) | (maskarray[3] << shiftarray[3])
22  | (0 << shiftarray[4]) | (maskarray[5] << shiftarray[5]));
23 }
24 
26 CbmTofDetectorId_v14a::GetDetectorInfo(const Int_t detectorId) {
27  for (Int_t i = 0; i < array_length; i++) {
28  result_array[i] = ((detectorId >> shiftarray[i]) & maskarray[i]);
29  }
30 
32  result_array[2],
33  result_array[1],
34  result_array[3],
35  result_array[4],
36  result_array[5]);
37 }
38 
39 Int_t CbmTofDetectorId_v14a::GetSystemId(Int_t detectorId) {
40  return (detectorId & maskarray[0]);
41 }
42 
43 //-----------------------------------------------------------
44 
45 Int_t CbmTofDetectorId_v14a::GetSMType(const Int_t detectorId) {
46  return ((detectorId >> shiftarray[2]) & maskarray[2]);
47 }
48 Int_t CbmTofDetectorId_v14a::GetModuleType(const Int_t detectorId) {
49  return GetSMType(detectorId);
50 }
51 
52 //-----------------------------------------------------------
53 
54 Int_t CbmTofDetectorId_v14a::GetSModule(const Int_t detectorId) {
55  return ((detectorId >> shiftarray[1]) & maskarray[1]);
56 }
57 Int_t CbmTofDetectorId_v14a::GetModuleId(const Int_t detectorId) {
58  return GetSModule(detectorId);
59 }
60 
61 //-----------------------------------------------------------
62 
63 Int_t CbmTofDetectorId_v14a::GetCounter(const Int_t detectorId) {
64  return ((detectorId >> shiftarray[3]) & maskarray[3]);
65 }
66 
67 //-----------------------------------------------------------
68 
69 Int_t CbmTofDetectorId_v14a::GetSide(const Int_t detectorId) {
70  return ((detectorId >> shiftarray[4]) & maskarray[4]);
71 }
72 Int_t CbmTofDetectorId_v14a::GetGap(const Int_t detectorId) {
73  return GetSide(detectorId);
74 }
75 
76 //-----------------------------------------------------------
77 
78 Int_t CbmTofDetectorId_v14a::GetCell(const Int_t detectorId) {
79  return ((detectorId >> shiftarray[5]) & maskarray[5]);
80 }
81 
82 Int_t CbmTofDetectorId_v14a::GetStrip(const Int_t detectorId) {
83  return GetCell(detectorId);
84 }
85 
86 //-----------------------------------------------------------
87 
88 Int_t CbmTofDetectorId_v14a::GetRegion(const Int_t /*detectorId*/) {
89  return -1;
90 }
91 
92 Int_t CbmTofDetectorId_v14a::GetCellId(const Int_t detectorId) {
93  return (detectorId & modulemask);
94 }
95 
96 //-----------------------------------------------------------
97 
99  const CbmTofDetectorInfo detInfo) {
100  return ((((detInfo.fDetectorSystem) & maskarray[0]) << shiftarray[0])
101  | (((detInfo.fSMtype) & maskarray[2]) << shiftarray[2])
102  | (((detInfo.fSModule) & maskarray[1]) << shiftarray[1])
103  | (((detInfo.fCounter) & maskarray[3]) << shiftarray[3])
104  | (((detInfo.fGap) & maskarray[4]) << shiftarray[4])
105  | (((detInfo.fCell) & maskarray[5]) << shiftarray[5]));
106 }
CbmTofDetectorId_v14a::GetSystemId
Int_t GetSystemId(Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:39
CbmTofDetectorInfo::fGap
Int_t fGap
Definition: CbmTofDetectorId.h:61
CbmTofDetectorId_v14a::maskarray
Int_t maskarray[array_length]
Definition: CbmTofDetectorId_v14a.h:96
CbmTofDetectorId_v14a::GetGap
Int_t GetGap(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:72
CbmTofDetectorId_v14a::GetCell
Int_t GetCell(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:78
CbmTofDetectorInfo::fCell
Int_t fCell
Definition: CbmTofDetectorId.h:62
CbmTofDetectorId_v14a::GetDetectorInfo
CbmTofDetectorInfo GetDetectorInfo(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:26
CbmTofDetectorId_v14a::CbmTofDetectorId_v14a
CbmTofDetectorId_v14a()
Definition: CbmTofDetectorId_v14a.cxx:13
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmTofDetectorId_v14a::GetSide
Int_t GetSide(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:69
CbmTofDetectorId_v14a::GetModuleId
Int_t GetModuleId(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:57
CbmTofDetectorId_v14a::bitarray
static const Int_t bitarray[]
Definition: CbmTofDetectorId_v14a.h:94
CbmTofDetectorId_v14a::SetDetectorInfo
Int_t SetDetectorInfo(const CbmTofDetectorInfo detectorInfo)
Definition: CbmTofDetectorId_v14a.cxx:98
CbmTofDetectorInfo::fDetectorSystem
Int_t fDetectorSystem
Definition: CbmTofDetectorId.h:55
CbmTofDetectorId_v14a::shiftarray
static const Int_t shiftarray[]
Definition: CbmTofDetectorId_v14a.h:93
CbmTofDetectorId_v14a.h
CbmTofDetectorId_v14a::GetCounter
Int_t GetCounter(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:63
CbmTofDetectorId_v14a::result_array
Int_t result_array[array_length]
Definition: CbmTofDetectorId_v14a.h:95
CbmTofDetectorId_v14a::GetSModule
Int_t GetSModule(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:54
CbmTofDetectorId_v14a::GetSMType
Int_t GetSMType(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:45
CbmTofDetectorInfo
Definition: CbmTofDetectorId.h:20
CbmTofDetectorId_v14a::GetModuleType
Int_t GetModuleType(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:48
CbmTofDetectorInfo::fSModule
Int_t fSModule
Definition: CbmTofDetectorId.h:59
CbmTofDetectorId_v14a::array_length
static const Int_t array_length
Definition: CbmTofDetectorId_v14a.h:92
CbmTofDetectorId_v14a::GetCellId
Int_t GetCellId(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:92
CbmTofDetectorInfo::fCounter
Int_t fCounter
Definition: CbmTofDetectorId.h:60
CbmTofDetectorId_v14a::GetStrip
Int_t GetStrip(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:82
CbmTofDetectorId
Definition: CbmTofDetectorId.h:66
CbmTofDetectorInfo::fSMtype
Int_t fSMtype
Definition: CbmTofDetectorId.h:58
CbmTofDetectorId_v14a::modulemask
Int_t modulemask
Definition: CbmTofDetectorId_v14a.h:97
CbmTofDetectorId_v14a::GetRegion
Int_t GetRegion(const Int_t detectorId)
Definition: CbmTofDetectorId_v14a.cxx:88