CbmRoot
Loading...
Searching...
No Matches
CbmTofDetectorId_v14a.cxx
Go to the documentation of this file.
1/* Copyright (C) 2012-2015 PI-UHd, GSI
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig, Norbert Herrmann [committer], Pierre-Alain Loizeau */
4
5// -------------------------------------------------------------------------
6// ----- CbmTofDetectorId source file -----
7// ----- Created 20/11/12 by F. Uhlig -----
8// -------------------------------------------------------------------------
9
10
12
13const int32_t CbmTofDetectorId_v14a::shiftarray[] = {0, 4, 12, 16, 23, 24};
14const int32_t CbmTofDetectorId_v14a::bitarray[] = {4, 8, 4, 7, 1, 8};
15
16
17CbmTofDetectorId_v14a::CbmTofDetectorId_v14a() : CbmTofDetectorId(), result_array(), maskarray(), modulemask(0)
18{
19 for (int32_t i = 0; i < array_length; i++) {
20 maskarray[i] = (1 << bitarray[i]) - 1;
21 }
22
23 modulemask = ((maskarray[0] << shiftarray[0]) | (maskarray[1] << shiftarray[1]) | (maskarray[2] << shiftarray[2])
24 | (maskarray[3] << shiftarray[3]) | (0 << shiftarray[4]) | (maskarray[5] << shiftarray[5]));
25}
26
28{
29 for (int32_t i = 0; i < array_length; i++) {
30 result_array[i] = ((detectorId >> shiftarray[i]) & maskarray[i]);
31 }
32
34 result_array[5]);
35}
36
37int32_t CbmTofDetectorId_v14a::GetSystemId(int32_t detectorId) { return (detectorId & maskarray[0]); }
38
39//-----------------------------------------------------------
40
41int32_t CbmTofDetectorId_v14a::GetSMType(const int32_t detectorId)
42{
43 return ((detectorId >> shiftarray[2]) & maskarray[2]);
44}
45int32_t CbmTofDetectorId_v14a::GetModuleType(const int32_t detectorId) { return GetSMType(detectorId); }
46
47//-----------------------------------------------------------
48
49int32_t CbmTofDetectorId_v14a::GetSModule(const int32_t detectorId)
50{
51 return ((detectorId >> shiftarray[1]) & maskarray[1]);
52}
53int32_t CbmTofDetectorId_v14a::GetModuleId(const int32_t detectorId) { return GetSModule(detectorId); }
54
55//-----------------------------------------------------------
56
57int32_t CbmTofDetectorId_v14a::GetCounter(const int32_t detectorId)
58{
59 return ((detectorId >> shiftarray[3]) & maskarray[3]);
60}
61
62//-----------------------------------------------------------
63
64int32_t CbmTofDetectorId_v14a::GetSide(const int32_t detectorId)
65{
66 return ((detectorId >> shiftarray[4]) & maskarray[4]);
67}
68int32_t CbmTofDetectorId_v14a::GetGap(const int32_t detectorId) { return GetSide(detectorId); }
69
70//-----------------------------------------------------------
71
72int32_t CbmTofDetectorId_v14a::GetCell(const int32_t detectorId)
73{
74 return ((detectorId >> shiftarray[5]) & maskarray[5]);
75}
76
77int32_t CbmTofDetectorId_v14a::GetStrip(const int32_t detectorId) { return GetCell(detectorId); }
78
79//-----------------------------------------------------------
80
81int32_t CbmTofDetectorId_v14a::GetRegion(const int32_t /*detectorId*/) { return -1; }
82
83int32_t CbmTofDetectorId_v14a::GetCellId(const int32_t detectorId) { return (detectorId & modulemask); }
84
85//-----------------------------------------------------------
86
87int32_t CbmTofDetectorId_v14a ::SetDetectorInfo(const CbmTofDetectorInfo detInfo)
88{
89 return ((((detInfo.fDetectorSystem) & maskarray[0]) << shiftarray[0])
90 | (((detInfo.fSMtype) & maskarray[2]) << shiftarray[2])
91 | (((detInfo.fSModule) & maskarray[1]) << shiftarray[1])
92 | (((detInfo.fCounter) & maskarray[3]) << shiftarray[3]) | (((detInfo.fGap) & maskarray[4]) << shiftarray[4])
93 | (((detInfo.fCell) & maskarray[5]) << shiftarray[5]));
94}
int32_t GetCell(const int32_t detectorId)
int32_t GetSModule(const int32_t detectorId)
int32_t GetRegion(const int32_t detectorId)
static const int32_t bitarray[]
int32_t result_array[array_length]
int32_t GetSMType(const int32_t detectorId)
int32_t maskarray[array_length]
CbmTofDetectorInfo GetDetectorInfo(const int32_t detectorId)
int32_t GetSide(const int32_t detectorId)
int32_t GetModuleType(const int32_t detectorId)
int32_t GetGap(const int32_t detectorId)
static const int32_t shiftarray[]
int32_t GetCounter(const int32_t detectorId)
int32_t GetStrip(const int32_t detectorId)
int32_t GetCellId(const int32_t detectorId)
int32_t GetSystemId(int32_t detectorId)
int32_t GetModuleId(const int32_t detectorId)
static const int32_t array_length