CbmRoot
Loading...
Searching...
No Matches
CbmTofDetectorId_v12b.cxx
Go to the documentation of this file.
1/* Copyright (C) 2012-2015 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmTofDetectorId source file -----
7// ----- Created 20/11/12 by F. Uhlig -----
8// -------------------------------------------------------------------------
9
10
12
13const int32_t CbmTofDetectorId_v12b::shiftarray[] = {0, 5, 9, 17, 20, 24};
14const int32_t CbmTofDetectorId_v12b::bitarray[] = {5, 4, 8, 3, 4, 8};
15
16
17CbmTofDetectorId_v12b::CbmTofDetectorId_v12b() : 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_v12b::GetSystemId(int32_t detectorId) { return (detectorId & maskarray[0]); }
38
39//-----------------------------------------------------------
40
41int32_t CbmTofDetectorId_v12b::GetSMType(const int32_t detectorId)
42{
43 return ((detectorId >> shiftarray[1]) & maskarray[1]);
44}
45
46//-----------------------------------------------------------
47
48int32_t CbmTofDetectorId_v12b::GetSModule(const int32_t detectorId)
49{
50 return ((detectorId >> shiftarray[2]) & maskarray[2]);
51}
52
53//-----------------------------------------------------------
54
55int32_t CbmTofDetectorId_v12b::GetCounter(const int32_t detectorId)
56{
57 return ((detectorId >> shiftarray[3]) & maskarray[3]);
58}
59
60//-----------------------------------------------------------
61
62int32_t CbmTofDetectorId_v12b::GetGap(const int32_t detectorId)
63{
64 return ((detectorId >> shiftarray[4]) & maskarray[4]);
65}
66
67//-----------------------------------------------------------
68
69int32_t CbmTofDetectorId_v12b::GetCell(const int32_t detectorId)
70{
71 return ((detectorId >> shiftarray[5]) & maskarray[5]);
72}
73
74//-----------------------------------------------------------
75
76int32_t CbmTofDetectorId_v12b::GetRegion(const int32_t /*detectorId*/) { return -1; }
77
78int32_t CbmTofDetectorId_v12b::GetCellId(const int32_t detectorId) { return (detectorId & modulemask); }
79
80//-----------------------------------------------------------
81
83{
84 return ((detInfo.fDetectorSystem << shiftarray[0]) | (detInfo.fSMtype << shiftarray[1])
85 | (detInfo.fSModule << shiftarray[2]) | (detInfo.fCounter << shiftarray[3]) | (detInfo.fGap << shiftarray[4])
86 | (detInfo.fCell << shiftarray[5]));
87}
static const int32_t shiftarray[]
int32_t GetCellId(const int32_t detectorId)
int32_t GetCounter(const int32_t detectorId)
int32_t GetSystemId(int32_t detectorId)
int32_t GetGap(const int32_t detectorId)
int32_t maskarray[array_length]
int32_t GetSModule(const int32_t detectorId)
int32_t GetSMType(const int32_t detectorId)
int32_t SetDetectorInfo(const CbmTofDetectorInfo detectorInfo)
static const int32_t bitarray[]
int32_t GetRegion(const int32_t detectorId)
int32_t result_array[array_length]
static const int32_t array_length
CbmTofDetectorInfo GetDetectorInfo(const int32_t detectorId)
int32_t GetCell(const int32_t detectorId)