BmnRoot
26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnRun8DM.h
Go to the documentation of this file.
1
/*
2
BM@N alignment routine
3
BM@N experiment at NICA complex, JINR, 2025
4
5
Department: Math & Soft Group of HEP lab
6
Author: Igor Polev, polev@jinr.int
7
8
BmnRun8DM class declaration
9
Run8 representation of detector elements via encoding
10
*/
11
12
#ifndef BMNRUN8DM_H
13
#define BMNRUN8DM_H
14
15
#include "
BmnDetectorList.h
"
16
#include "
BmnDetectorModel.h
"
17
18
#include <
TString.h
>
19
20
/*
21
* Detector elements enumeration scheme
22
*
23
* SystemID - fixed constatns defined in BmnDetectorList.h
24
* StationID - sequence across all systems starting from 0 or 1 (currently 1)
25
* ModuleID - separate sequence for each station starting from 0 or 1 (currently 1)
26
*
27
* CbmStsHit DetectorID layout:
28
*
29
* 27:24 ( 4 bit) System ID
30
* 23:16 ( 8 bit) Station number
31
* 15:4 (12 bit) Sector (module) number
32
* 3:1 ( 3 bit) Sensor number (not used, allways 0b001)
33
* 0:0 ( 1 bit) Unknown (not used, allways 0b0)
34
* --------------
35
* 28 bit in total
36
*
37
* See CbmStsHit.h and BmnToCbmHitConverter::Exec()
38
*/
39
40
class
BmnRun8DM
:
public
BmnDetectorModel
41
{
42
protected
:
43
Int_t
fSystem
{-1},
fStation
{-1},
fModule
{-1};
44
45
enum
46
{
47
kFirst
,
48
kLast
49
};
50
// Run8 configuration definition
51
constexpr
static
const
Int_t
SIL_SYSTEM_ID
{
DetectorId::kSILICON
},
GEM_SYSTEM_ID
{
DetectorId::kGEM
},
52
SIL_STATION_CNT
{4},
GEM_STATION_CNT
{7},
STA_NUM_START
{1},
// first station number (0 or 1)
53
MOD_NUM_START
{1},
// first module number for each station (0 or 1)
54
// stations have one common index range, silicons first, then GEMs
55
SIL_STATION_IDX
[2]{
STA_NUM_START
,
STA_NUM_START
+
SIL_STATION_CNT
- 1},
56
GEM_STATION_IDX
[2]{
SIL_STATION_IDX
[
kLast
] + 1,
SIL_STATION_IDX
[
kLast
] +
GEM_STATION_CNT
},
57
SIL_MODULES
[
SIL_STATION_CNT
]{6, 10, 14, 18},
GEM_MODULES
[
GEM_STATION_CNT
]{8, 8, 8, 8, 8, 8, 8};
58
// In GEM stations each second module is a "hot zone".
59
// Hot zones should not be aligned independently.
60
61
// module count of the station at the given 0-based station index
62
inline
Int_t
StationModules
(
Int_t
station)
const
noexcept
63
{
64
return
station <
SIL_STATION_CNT
?
SIL_MODULES
[station] :
GEM_MODULES
[station -
SIL_STATION_CNT
];
65
}
66
// of those, the ones aligned independently. This is the single per-station
67
// primitive Alignables() and MaxModulesInStation() are built from, so a
68
// model keeping fewer elements per station restates it here alone.
69
virtual
Int_t
StationAlignables
(
Int_t
station)
const
noexcept
70
{
71
return
station <
SIL_STATION_CNT
?
StationModules
(station) :
StationModules
(station) / 2;
// skip hot zones
72
}
73
// module number the station's alignable sequence starts at
74
virtual
Int_t
FirstModule
(
Int_t
/*station*/
)
const
noexcept
{
return
MOD_NUM_START
; }
75
// 0-based, inclusive index range of stations this model enumerates. A
76
// subsystem-restricted model narrows it (e.g. GEM-only starts past silicon),
77
// and Reset()/NextID()/Alignables()/Composites() all honour it.
78
virtual
Int_t
FirstStation
() const noexcept {
return
0; }
79
virtual
Int_t
LastStation
() const noexcept {
return
SIL_STATION_CNT
+
GEM_STATION_CNT
- 1; }
80
81
// detector modules enumeration: see base class
82
virtual
void
Reset
() noexcept
override
83
{
84
// must set iterator BEFORE the first module according to base class
85
// definition, stepping back over one full stride of the starting system
86
const
Int_t
station{
FirstStation
()};
87
fSystem
= station <
SIL_STATION_CNT
?
SIL_SYSTEM_ID
:
GEM_SYSTEM_ID
;
88
fStation
= station +
STA_NUM_START
;
89
fModule
=
FirstModule
(station) - (
fSystem
==
GEM_SYSTEM_ID
? 2 : 1);
90
}
91
92
virtual
Int_t
NextID
() noexcept
override
93
{
94
// out of range check
95
if
(-1 ==
fSystem
)
96
return
-1;
// EOF marker must be negative
97
98
// next module
99
const
Int_t
stride{
fSystem
==
GEM_SYSTEM_ID
? 2 : 1};
// skip hot zones in GEM stations
100
fModule
+= stride;
101
102
// Next station check. Alignable elements times the stride is the span of
103
// module numbers the station's own sequence covers, and it is counted off
104
// that sequence's first module - so the test holds for a model keeping
105
// only a part of the station just as well as for the full one.
106
const
Int_t
station{
fStation
-
STA_NUM_START
};
107
if
((
fModule
-
FirstModule
(station)) / (
StationAlignables
(station) * stride)) {
108
fStation
++;
109
// remember: stations has common enumeration across all systems
110
// currently only two systems are considered - silicon, then GEM
111
112
// EOF check
113
if
(
fStation
-
STA_NUM_START
>
LastStation
())
114
return
fSystem
= -1;
115
116
// next system check
117
if
(
fStation
>
SIL_STATION_IDX
[
kLast
])
118
fSystem
=
GEM_SYSTEM_ID
;
119
120
// recomputed, not the snapshot above: FirstModule() depends on the
121
// station, and fStation has just advanced
122
fModule
=
FirstModule
(
fStation
-
STA_NUM_START
);
123
}
124
125
return
(
fSystem
<< 24) | (
fStation
<< 16) | (
fModule
<< 4) | 0b0010;
126
// constant term 0b0010 is used to match CbmStsHit DetectorID encoding
127
}
128
129
public
:
130
virtual
Int_t
MaxModulesInStation
() const noexcept
override
131
{
132
Int_t
cnt{0};
133
for
(
Int_t
i
=
FirstStation
();
i
<=
LastStation
();
i
++)
134
if
(
StationAlignables
(
i
) > cnt)
135
cnt =
StationAlignables
(
i
);
136
return
cnt;
137
}
138
139
virtual
Int_t
Alignables
() const noexcept
override
140
{
141
Int_t
al{0};
142
for
(
Int_t
i
=
FirstStation
();
i
<=
LastStation
();
i
++)
143
al +=
StationAlignables
(
i
);
144
return
al;
145
}
146
147
// convertion from CbmStsHit DetectorID, see the layout above
148
virtual
Int_t
IDfromHit
(
Int_t
CbmDetectorID)
const
noexcept
override
149
{
150
constexpr
static
const
Int_t
MOD_NUM_START4{
MOD_NUM_START
<< 4}, ZERO_BIT4{0xFFFFFEF};
151
152
if
(
GEM_SYSTEM_ID
== (CbmDetectorID >> 24))
153
// to skip GEM hot zone modules we need to erase the first bit
154
// of module number if modules are enumerated from zero
155
return
((CbmDetectorID - MOD_NUM_START4) & ZERO_BIT4) + MOD_NUM_START4;
156
else
157
return
CbmDetectorID;
158
}
159
160
virtual
std::string
DecodeID
(
Int_t
id
)
const override
161
{
162
TString
system;
163
BmnDetectorList::GetSystemNameCaps
(
id
>> 24, system);
164
return
Form
(
"%-7s st %2d mod %2d"
, system.
Data
(), (
id
>> 16) & 0xFF, (
id
>> 4) & 0xFFF);
165
}
166
167
BmnRun8DM
() {
fDescription
=
"Run8 GEM and FSD all independent parts: 76 elements"
; }
168
virtual
~BmnRun8DM
()
override
;
// out-of-line vtable anchor
169
};
170
171
#endif
// BMNRUN8DM_H
BmnDetectorList.h
Defines unique identifiers (enum) for all BM@N detector systems.
kSILICON
@ kSILICON
Definition
BmnDetectorList.h:25
kGEM
@ kGEM
Definition
BmnDetectorList.h:15
BmnDetectorModel.h
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
TString.h
Form
char * Form(const char *fmt,...)
BmnDetectorList::GetSystemNameCaps
static void GetSystemNameCaps(DetectorId det, TString &name)
Get system name in capitals.
Definition
BmnDetectorList.cxx:103
BmnDetectorModel::BmnDetectorModel
BmnDetectorModel()=default
BmnDetectorModel::fDescription
std::string fDescription
Definition
BmnDetectorModel.h:57
BmnRun8DM::fSystem
Int_t fSystem
Definition
BmnRun8DM.h:43
BmnRun8DM::GEM_STATION_CNT
static constexpr const Int_t GEM_STATION_CNT
Definition
BmnRun8DM.h:52
BmnRun8DM::Reset
virtual void Reset() noexcept override
Definition
BmnRun8DM.h:82
BmnRun8DM::GEM_MODULES
static constexpr const Int_t GEM_MODULES[GEM_STATION_CNT]
Definition
BmnRun8DM.h:57
BmnRun8DM::DecodeID
virtual std::string DecodeID(Int_t id) const override
Definition
BmnRun8DM.h:160
BmnRun8DM::kFirst
@ kFirst
Definition
BmnRun8DM.h:47
BmnRun8DM::kLast
@ kLast
Definition
BmnRun8DM.h:48
BmnRun8DM::FirstStation
virtual Int_t FirstStation() const noexcept
Definition
BmnRun8DM.h:78
BmnRun8DM::SIL_STATION_IDX
static constexpr const Int_t SIL_STATION_IDX[2]
Definition
BmnRun8DM.h:55
BmnRun8DM::FirstModule
virtual Int_t FirstModule(Int_t) const noexcept
Definition
BmnRun8DM.h:74
BmnRun8DM::StationAlignables
virtual Int_t StationAlignables(Int_t station) const noexcept
Definition
BmnRun8DM.h:69
BmnRun8DM::MOD_NUM_START
static constexpr const Int_t MOD_NUM_START
Definition
BmnRun8DM.h:53
BmnRun8DM::fStation
Int_t fStation
Definition
BmnRun8DM.h:43
BmnRun8DM::fModule
Int_t fModule
Definition
BmnRun8DM.h:43
BmnRun8DM::BmnRun8DM
BmnRun8DM()
Definition
BmnRun8DM.h:167
BmnRun8DM::~BmnRun8DM
virtual ~BmnRun8DM() override
BmnRun8DM::STA_NUM_START
static constexpr const Int_t STA_NUM_START
Definition
BmnRun8DM.h:52
BmnRun8DM::SIL_STATION_CNT
static constexpr const Int_t SIL_STATION_CNT
Definition
BmnRun8DM.h:52
BmnRun8DM::MaxModulesInStation
virtual Int_t MaxModulesInStation() const noexcept override
Definition
BmnRun8DM.h:130
BmnRun8DM::IDfromHit
virtual Int_t IDfromHit(Int_t CbmDetectorID) const noexcept override
Definition
BmnRun8DM.h:148
BmnRun8DM::GEM_STATION_IDX
static constexpr const Int_t GEM_STATION_IDX[2]
Definition
BmnRun8DM.h:56
BmnRun8DM::LastStation
virtual Int_t LastStation() const noexcept
Definition
BmnRun8DM.h:79
BmnRun8DM::NextID
virtual Int_t NextID() noexcept override
Definition
BmnRun8DM.h:92
BmnRun8DM::GEM_SYSTEM_ID
static constexpr const Int_t GEM_SYSTEM_ID
Definition
BmnRun8DM.h:51
BmnRun8DM::SIL_SYSTEM_ID
static constexpr const Int_t SIL_SYSTEM_ID
Definition
BmnRun8DM.h:51
BmnRun8DM::Alignables
virtual Int_t Alignables() const noexcept override
Definition
BmnRun8DM.h:139
BmnRun8DM::StationModules
Int_t StationModules(Int_t station) const noexcept
Definition
BmnRun8DM.h:62
BmnRun8DM::SIL_MODULES
static constexpr const Int_t SIL_MODULES[SIL_STATION_CNT]
Definition
BmnRun8DM.h:57
TString
TString::Data
const char * Data() const
align_new
models
BmnRun8DM.h
Generated on
for BmnRoot by
1.17.0