CbmRoot
CbmTofDetectorId_v07a.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 #include <FairLogger.h> // for LOG, Logger
10 
11 const Int_t CbmTofDetectorId_v07a::shiftarray[] = {0, 5, 9, 19, 23};
12 const Int_t CbmTofDetectorId_v07a::bitarray[] = {5, 4, 10, 4, 9};
13 
14 // 3 2 1 shift length
24  : CbmTofDetectorId(), result_array(), maskarray(), modulemask(0) {
25  for (Int_t i = 0; i < array_length; i++) {
26  maskarray[i] = (1 << bitarray[i]) - 1;
27  }
28 
29  modulemask =
30  ((maskarray[0] << shiftarray[0]) | (maskarray[1] << shiftarray[1])
31  | (maskarray[2] << shiftarray[2]) | (0 << shiftarray[3])
32  | (maskarray[4] << shiftarray[4]));
33 }
34 
36 CbmTofDetectorId_v07a::GetDetectorInfo(const Int_t detectorId) {
37  for (Int_t i = 0; i < array_length; i++) {
38  result_array[i] = ((detectorId >> shiftarray[i]) & maskarray[i]);
39  }
41  result_array[1],
42  0,
43  result_array[2],
44  result_array[3],
45  result_array[4]);
46 }
47 
48 Int_t CbmTofDetectorId_v07a::GetSystemId(Int_t detectorId) {
49  return (detectorId & maskarray[0]);
50 }
51 
52 //-----------------------------------------------------------
53 
54 Int_t CbmTofDetectorId_v07a::GetSMType(const Int_t detectorId) {
55  return ((detectorId >> shiftarray[1]) & maskarray[1]);
56 }
57 
58 //-----------------------------------------------------------
59 
60 Int_t CbmTofDetectorId_v07a::GetSModule(const Int_t detectorId) {
61  return ((detectorId >> shiftarray[2]) & maskarray[2]);
62 }
63 
64 //-----------------------------------------------------------
65 
66 Int_t CbmTofDetectorId_v07a::GetCounter(const Int_t /*detectorId*/) {
67  return -1;
68 }
69 
70 //-----------------------------------------------------------
71 
72 Int_t CbmTofDetectorId_v07a::GetGap(const Int_t detectorId) {
73  return ((detectorId >> shiftarray[3]) & maskarray[3]);
74 }
75 
76 //-----------------------------------------------------------
77 
78 Int_t CbmTofDetectorId_v07a::GetCell(const Int_t detectorId) {
79  return ((detectorId >> shiftarray[4]) & maskarray[4]);
80 }
81 
82 //-----------------------------------------------------------
83 
84 Int_t CbmTofDetectorId_v07a::GetRegion(const Int_t /*detectorId*/) {
85  return -1;
86 }
87 
88 Int_t CbmTofDetectorId_v07a::GetCellId(const Int_t detectorId) {
89  return (detectorId & modulemask);
90 }
91 
92 //-----------------------------------------------------------
93 
95 
96  LOG(debug2) << "Det System: " << detInfo.fDetectorSystem;
97  LOG(debug2) << "SMtype: " << detInfo.fSMtype;
98  LOG(debug2) << "SModule: " << detInfo.fSModule;
99  LOG(debug2) << "Counter: " << detInfo.fCounter;
100  LOG(debug2) << "Gap: " << detInfo.fGap;
101  LOG(debug2) << "Cell: " << detInfo.fCell;
102 
103  return ((detInfo.fDetectorSystem << shiftarray[0])
104  | (detInfo.fSMtype << shiftarray[1])
105  | (detInfo.fCounter << shiftarray[2])
106  | (detInfo.fGap << shiftarray[3]) | (detInfo.fCell << shiftarray[4]));
107 }
CbmTofDetectorInfo::fGap
Int_t fGap
Definition: CbmTofDetectorId.h:61
CbmTofDetectorId_v07a::GetCellId
Int_t GetCellId(const Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:88
CbmTofDetectorId_v07a::CbmTofDetectorId_v07a
CbmTofDetectorId_v07a()
Definition: CbmTofDetectorId_v07a.cxx:23
CbmTofDetectorId_v07a::GetSystemId
Int_t GetSystemId(Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:48
CbmTofDetectorInfo::fCell
Int_t fCell
Definition: CbmTofDetectorId.h:62
CbmTofDetectorId_v07a::GetCounter
Int_t GetCounter(const Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:66
CbmTofDetectorId_v07a::result_array
Int_t result_array[array_length]
Definition: CbmTofDetectorId_v07a.h:85
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmTofDetectorId_v07a::GetSModule
Int_t GetSModule(const Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:60
CbmTofDetectorId_v07a::shiftarray
static const Int_t shiftarray[]
Definition: CbmTofDetectorId_v07a.h:83
CbmTofDetectorId_v07a.h
CbmTofDetectorId_v07a::maskarray
Int_t maskarray[array_length]
Definition: CbmTofDetectorId_v07a.h:86
CbmTofDetectorInfo::fDetectorSystem
Int_t fDetectorSystem
Definition: CbmTofDetectorId.h:55
CbmTofDetectorId_v07a::GetRegion
Int_t GetRegion(const Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:84
CbmTofDetectorInfo
Definition: CbmTofDetectorId.h:20
CbmTofDetectorInfo::fSModule
Int_t fSModule
Definition: CbmTofDetectorId.h:59
CbmTofDetectorId_v07a::modulemask
Int_t modulemask
Definition: CbmTofDetectorId_v07a.h:87
CbmTofDetectorId_v07a::GetCell
Int_t GetCell(const Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:78
CbmTofDetectorInfo::fCounter
Int_t fCounter
Definition: CbmTofDetectorId.h:60
CbmTofDetectorId_v07a::GetDetectorInfo
CbmTofDetectorInfo GetDetectorInfo(const Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:36
CbmTofDetectorId_v07a::GetGap
Int_t GetGap(const Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:72
CbmTofDetectorId
Definition: CbmTofDetectorId.h:66
CbmTofDetectorId_v07a::GetSMType
Int_t GetSMType(const Int_t detectorId)
Definition: CbmTofDetectorId_v07a.cxx:54
CbmTofDetectorId_v07a::array_length
static const Int_t array_length
Definition: CbmTofDetectorId_v07a.h:82
CbmTofDetectorInfo::fSMtype
Int_t fSMtype
Definition: CbmTofDetectorId.h:58
CbmTofDetectorId_v07a::bitarray
static const Int_t bitarray[]
Definition: CbmTofDetectorId_v07a.h:84
CbmTofDetectorId_v07a::SetDetectorInfo
Int_t SetDetectorInfo(const CbmTofDetectorInfo detectorInfo)
Definition: CbmTofDetectorId_v07a.cxx:94