CbmRoot
CbmTofDetectorId_v12b.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_v12b::shiftarray[] = {0, 5, 9, 17, 20, 24};
10 const Int_t CbmTofDetectorId_v12b::bitarray[] = {5, 4, 8, 3, 4, 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_v12b::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[1],
33  result_array[2],
34  result_array[3],
35  result_array[4],
36  result_array[5]);
37 }
38 
39 Int_t CbmTofDetectorId_v12b::GetSystemId(Int_t detectorId) {
40  return (detectorId & maskarray[0]);
41 }
42 
43 //-----------------------------------------------------------
44 
45 Int_t CbmTofDetectorId_v12b::GetSMType(const Int_t detectorId) {
46  return ((detectorId >> shiftarray[1]) & maskarray[1]);
47 }
48 
49 //-----------------------------------------------------------
50 
51 Int_t CbmTofDetectorId_v12b::GetSModule(const Int_t detectorId) {
52  return ((detectorId >> shiftarray[2]) & maskarray[2]);
53 }
54 
55 //-----------------------------------------------------------
56 
57 Int_t CbmTofDetectorId_v12b::GetCounter(const Int_t detectorId) {
58  return ((detectorId >> shiftarray[3]) & maskarray[3]);
59 }
60 
61 //-----------------------------------------------------------
62 
63 Int_t CbmTofDetectorId_v12b::GetGap(const Int_t detectorId) {
64  return ((detectorId >> shiftarray[4]) & maskarray[4]);
65 }
66 
67 //-----------------------------------------------------------
68 
69 Int_t CbmTofDetectorId_v12b::GetCell(const Int_t detectorId) {
70  return ((detectorId >> shiftarray[5]) & maskarray[5]);
71 }
72 
73 //-----------------------------------------------------------
74 
75 Int_t CbmTofDetectorId_v12b::GetRegion(const Int_t /*detectorId*/) {
76  return -1;
77 }
78 
79 Int_t CbmTofDetectorId_v12b::GetCellId(const Int_t detectorId) {
80  return (detectorId & modulemask);
81 }
82 
83 //-----------------------------------------------------------
84 
86  return ((detInfo.fDetectorSystem << shiftarray[0])
87  | (detInfo.fSMtype << shiftarray[1])
88  | (detInfo.fSModule << shiftarray[2])
89  | (detInfo.fCounter << shiftarray[3])
90  | (detInfo.fGap << shiftarray[4]) | (detInfo.fCell << shiftarray[5]));
91 }
CbmTofDetectorInfo::fGap
Int_t fGap
Definition: CbmTofDetectorId.h:61
CbmTofDetectorId_v12b::GetSModule
Int_t GetSModule(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:51
CbmTofDetectorInfo::fCell
Int_t fCell
Definition: CbmTofDetectorId.h:62
CbmTofDetectorId_v12b::GetSystemId
Int_t GetSystemId(Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:39
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmTofDetectorId_v12b::GetRegion
Int_t GetRegion(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:75
CbmTofDetectorId_v12b::CbmTofDetectorId_v12b
CbmTofDetectorId_v12b()
Definition: CbmTofDetectorId_v12b.cxx:13
CbmTofDetectorInfo::fDetectorSystem
Int_t fDetectorSystem
Definition: CbmTofDetectorId.h:55
CbmTofDetectorId_v12b::GetGap
Int_t GetGap(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:63
CbmTofDetectorId_v12b::maskarray
Int_t maskarray[array_length]
Definition: CbmTofDetectorId_v12b.h:86
CbmTofDetectorId_v12b::GetCellId
Int_t GetCellId(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:79
CbmTofDetectorId_v12b.h
CbmTofDetectorId_v12b::SetDetectorInfo
Int_t SetDetectorInfo(const CbmTofDetectorInfo detectorInfo)
Definition: CbmTofDetectorId_v12b.cxx:85
CbmTofDetectorId_v12b::bitarray
static const Int_t bitarray[]
Definition: CbmTofDetectorId_v12b.h:84
CbmTofDetectorInfo
Definition: CbmTofDetectorId.h:20
CbmTofDetectorId_v12b::result_array
Int_t result_array[array_length]
Definition: CbmTofDetectorId_v12b.h:85
CbmTofDetectorId_v12b::GetDetectorInfo
CbmTofDetectorInfo GetDetectorInfo(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:26
CbmTofDetectorInfo::fSModule
Int_t fSModule
Definition: CbmTofDetectorId.h:59
CbmTofDetectorId_v12b::array_length
static const Int_t array_length
Definition: CbmTofDetectorId_v12b.h:82
CbmTofDetectorInfo::fCounter
Int_t fCounter
Definition: CbmTofDetectorId.h:60
CbmTofDetectorId_v12b::GetCell
Int_t GetCell(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:69
CbmTofDetectorId_v12b::modulemask
Int_t modulemask
Definition: CbmTofDetectorId_v12b.h:87
CbmTofDetectorId
Definition: CbmTofDetectorId.h:66
CbmTofDetectorId_v12b::GetCounter
Int_t GetCounter(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:57
CbmTofDetectorInfo::fSMtype
Int_t fSMtype
Definition: CbmTofDetectorId.h:58
CbmTofDetectorId_v12b::GetSMType
Int_t GetSMType(const Int_t detectorId)
Definition: CbmTofDetectorId_v12b.cxx:45
CbmTofDetectorId_v12b::shiftarray
static const Int_t shiftarray[]
Definition: CbmTofDetectorId_v12b.h:83