BmnRoot
26.10.0-19-g6979a6c6
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnStripData.h
Go to the documentation of this file.
1
#ifndef BMNSTRIPDATA_H
2
#define BMNSTRIPDATA_H
3
4
#include <
TObject.h
>
5
#include <
TString.h
>
6
#include <iostream>
7
8
using
std::vector;
9
10
enum
StripLayerType
11
{
12
LowerStripLayer
= 0,
13
UpperStripLayer
14
};
15
enum
StripNumberingDirection
16
{
17
LeftToRight
,
18
RightToLeft
19
};
20
enum
StripBorderPoint
21
{
22
LeftTop
,
23
LeftBottom
,
24
RightTop
,
25
RightBottom
26
};
27
28
// Exeptions --------------------------------------------------------------------
29
class
StationSet_Exception
30
{
31
public
:
32
StationSet_Exception
(
TString
message) { std::cerr <<
"StationSet_Exception::"
<< message <<
"\n"
; }
33
};
34
35
class
Station_Exception
36
{
37
public
:
38
Station_Exception
(
TString
message) { std::cerr <<
"Station_Exception::"
<< message <<
"\n"
; }
39
};
40
//------------------------------------------------------------------------------
41
42
// Class: dead zone -------------------------------------------------------------
43
class
DeadZoneOfStripLayer
44
{
45
private
:
46
Int_t
NPoints
;
47
Double_t
*
XPoints
;
//[NPoints]
48
Double_t
*
YPoints
;
//[NPoints]
49
50
public
:
51
DeadZoneOfStripLayer
()
52
:
NPoints
(0)
53
,
XPoints
(nullptr)
54
,
YPoints
(nullptr)
55
{}
56
57
DeadZoneOfStripLayer
(
Int_t
n_points,
Double_t
* xpoints,
Double_t
* ypoints)
58
:
NPoints
(0)
59
,
XPoints
(0)
60
,
YPoints
(0)
61
{
62
if
(n_points > 2) {
63
NPoints
= n_points;
64
XPoints
=
new
Double_t
[
NPoints
];
65
YPoints
=
new
Double_t
[
NPoints
];
66
for
(
Int_t
i
= 0;
i
<
NPoints
; ++
i
) {
67
XPoints
[
i
] = xpoints[
i
];
68
YPoints
[
i
] = ypoints[
i
];
69
}
70
}
71
}
72
73
DeadZoneOfStripLayer
(
const
DeadZoneOfStripLayer
& obj)
74
{
75
NPoints
= obj.
NPoints
;
76
XPoints
=
new
Double_t
[
NPoints
];
77
YPoints
=
new
Double_t
[
NPoints
];
78
for
(
Int_t
i
= 0;
i
<
NPoints
; ++
i
) {
79
XPoints
[
i
] = obj.
XPoints
[
i
];
80
YPoints
[
i
] = obj.
YPoints
[
i
];
81
}
82
}
83
84
DeadZoneOfStripLayer
&
operator=
(
const
DeadZoneOfStripLayer
& obj)
85
{
86
if
(
XPoints
!=
nullptr
)
87
delete
[]
XPoints
;
88
if
(
YPoints
!=
nullptr
)
89
delete
[]
YPoints
;
90
NPoints
= obj.
NPoints
;
91
XPoints
=
new
Double_t
[
NPoints
];
92
YPoints
=
new
Double_t
[
NPoints
];
93
for
(
Int_t
i
= 0;
i
<
NPoints
; ++
i
) {
94
XPoints
[
i
] = obj.
XPoints
[
i
];
95
YPoints
[
i
] = obj.
YPoints
[
i
];
96
}
97
return
*
this
;
98
}
99
100
~DeadZoneOfStripLayer
()
101
{
102
if
(
XPoints
!=
nullptr
)
103
delete
[]
XPoints
;
104
if
(
YPoints
!=
nullptr
)
105
delete
[]
YPoints
;
106
}
107
108
// Set a new dead zone, the previous zone will be deleted
109
Bool_t
SetDeadZone
(
Int_t
n_points,
Double_t
* xpoints,
Double_t
* ypoints)
110
{
111
NPoints
= 0;
112
if
(
XPoints
!=
nullptr
) {
113
delete
[]
XPoints
;
114
XPoints
=
nullptr
;
115
}
116
if
(
YPoints
!=
nullptr
) {
117
delete
[]
YPoints
;
118
YPoints
=
nullptr
;
119
}
120
if
(n_points > 2) {
121
NPoints
= n_points;
122
XPoints
=
new
Double_t
[
NPoints
];
123
YPoints
=
new
Double_t
[
NPoints
];
124
for
(
Int_t
i
= 0;
i
<
NPoints
; ++
i
) {
125
XPoints
[
i
] = xpoints[
i
];
126
YPoints
[
i
] = ypoints[
i
];
127
}
128
return
true
;
129
}
else
{
130
return
false
;
131
}
132
}
133
134
Bool_t
IsInside
(
Double_t
x,
Double_t
y)
135
{
136
// crossing number (count) algorithm
137
if
(
NPoints
== 0)
138
return
false
;
139
Bool_t
check_flag =
false
;
140
for
(
int
i
= 0, j =
NPoints
- 1;
i
<
NPoints
; j =
i
++) {
141
142
if
((((
YPoints
[
i
] <= y) && (y <
YPoints
[j])) || ((
YPoints
[j] <= y) && (y <
YPoints
[
i
])))
143
&& (x > (
XPoints
[j] -
XPoints
[
i
]) * (y -
YPoints
[
i
]) / (
YPoints
[j] -
YPoints
[
i
]) +
XPoints
[
i
]))
144
check_flag = !check_flag;
145
}
146
return
check_flag;
147
}
148
149
Int_t
GetNPoints
() {
return
NPoints
; }
150
151
Double_t
GetXPoint
(
Int_t
index)
152
{
153
if
(index >= 0 && index <
NPoints
) {
154
return
XPoints
[index];
155
}
else
{
156
return
0.0;
157
// cerr << "\nWARNING:DeadZoneOfStripLayer: out of range (x)\n";
158
// throw;
159
}
160
}
161
162
Double_t
GetYPoint
(
Int_t
index)
163
{
164
if
(index >= 0 && index <
NPoints
) {
165
return
YPoints
[index];
166
}
else
{
167
return
0.0;
168
// cerr << "\nWARNING:DeadZoneOfStripLayer: out of range (y)\n";
169
// throw;
170
}
171
}
172
};
173
//------------------------------------------------------------------------------
174
175
// Class: strip cluster ---------------------------------------------------------
176
class
StripCluster
:
public
TObject
177
{
178
public
:
179
Double_t
OriginPosition
;
// origin position of the center point
180
Double_t
MeanPosition
;
// position of the cluster (after fitting)
181
Double_t
TotalSignal
;
// total signal of the cluster
182
Double_t
PositionResidual
;
// residual from the origin position
183
Bool_t
IsCorrect
;
// correct or incorrect cluster (status)
184
Int_t
Station
;
185
Int_t
Module
;
186
Int_t
Width
;
187
Double_t
Error
;
188
189
// Cluster type: 0 - lower, 1 - upper
190
Int_t
fType
;
191
192
vector<Int_t>
Strips
;
193
vector<Double_t>
Signals
;
194
195
StripCluster
()
196
:
TObject
()
197
{
198
OriginPosition
= 0.0;
199
MeanPosition
= 0.0;
200
TotalSignal
= 0.0;
201
PositionResidual
= 0.0;
202
IsCorrect
=
kFALSE
;
203
fType
= -1;
204
Station
= -1;
205
Module
= -1;
206
Width
= 0.0;
207
Error
= 0.0;
208
}
209
210
void
SetType
(
Int_t
type) {
fType
= type; }
211
Int_t
GetType
() {
return
fType
; }
212
Int_t
GetWidth
() {
return
Width
; }
213
void
SetWidth
(
Int_t
w) {
Width
= w; }
214
Int_t
GetStation
() {
return
Station
; }
215
void
SetStation
(
Int_t
st) {
Station
= st; }
216
Int_t
GetModule
() {
return
Module
; }
217
void
SetModule
(
Int_t
m
) {
Module
=
m
; }
218
void
SetError
(
Double_t
err) {
Error
= err; }
219
Double_t
GetError
() {
return
Error
; }
220
221
StripCluster
(
Double_t
orig_position,
Double_t
mean_position,
Double_t
total_signal)
222
:
TObject
()
223
,
OriginPosition
(orig_position)
224
,
MeanPosition
(mean_position)
225
,
TotalSignal
(total_signal)
226
{
227
PositionResidual
= 0.0;
228
IsCorrect
=
kFALSE
;
229
fType
= -1;
230
Station
= -1;
231
Module
= -1;
232
Width
= 0.0;
233
Error
= 0.0;
234
}
235
// Add new strip in ascending order of strip number (if cluster has strip with such number - add signal to that
236
// strip)
237
void
AddStrip
(
Int_t
strip_num,
Double_t
strip_signal)
238
{
239
Bool_t
StripNumExists =
false
;
240
size_t
index;
241
for
(index = 0; index <
Strips
.size(); ++index) {
242
if
(
Strips
[index] == strip_num) {
243
StripNumExists =
true
;
244
break
;
245
}
246
}
247
if
(StripNumExists)
248
Signals
[index] += strip_signal;
249
else
{
250
vector<Int_t>::iterator strip_iter =
Strips
.end();
251
vector<Double_t>::iterator signal_iter =
Signals
.end();
252
for
(
size_t
i
= 0;
i
<
Strips
.size(); ++
i
) {
253
if
(strip_num <
Strips
[
i
]) {
254
strip_iter =
Strips
.begin() +
i
;
255
signal_iter =
Signals
.begin() +
i
;
256
break
;
257
}
258
}
259
Strips
.insert(strip_iter, strip_num);
260
Signals
.insert(signal_iter, strip_signal);
261
}
262
}
263
264
void
Print
()
265
{
266
printf(
"\nCLUSTER INFORMATION (#%d)\n"
, this->
GetUniqueID
());
267
if
(fType == 0)
268
printf(
"TYPE: LOWER\n"
);
269
else
if
(
fType
== 1)
270
printf(
"TYPE: UPPER\n"
);
271
printf(
"Station: %d\n"
,
Station
);
272
printf(
"Module: %d\n"
,
Module
);
273
printf(
"Cluster width: %d\n"
,
Width
);
274
printf(
"Total cluster signal: %4.2f\n"
,
TotalSignal
);
275
printf(
"Strips: "
);
276
for
(
auto
it :
Strips
)
277
printf(
"%d "
, it);
278
printf(
"\nSignals: "
);
279
for
(
auto
it :
Signals
)
280
printf(
"%4.2f "
, it);
281
printf(
"\n"
);
282
}
283
284
void
Clear
()
285
{
286
Strips
.clear();
287
Signals
.clear();
288
OriginPosition
= 0.0;
289
MeanPosition
= 0.0;
290
TotalSignal
= 0.0;
291
PositionResidual
= 0.0;
292
IsCorrect
=
kFALSE
;
293
fType
= -1;
294
}
295
Int_t
GetClusterSize
() {
return
Strips
.size(); }
296
297
ClassDef
(
StripCluster
, 1);
298
};
299
300
#endif
/* BMNSTRIPDATA_H */
StripBorderPoint
StripBorderPoint
Definition
BmnStripData.h:21
LeftTop
@ LeftTop
Definition
BmnStripData.h:22
RightBottom
@ RightBottom
Definition
BmnStripData.h:25
LeftBottom
@ LeftBottom
Definition
BmnStripData.h:23
RightTop
@ RightTop
Definition
BmnStripData.h:24
StripNumberingDirection
StripNumberingDirection
Definition
BmnStripData.h:16
RightToLeft
@ RightToLeft
Definition
BmnStripData.h:18
LeftToRight
@ LeftToRight
Definition
BmnStripData.h:17
StripLayerType
StripLayerType
Definition
BmnStripData.h:11
UpperStripLayer
@ UpperStripLayer
Definition
BmnStripData.h:13
LowerStripLayer
@ LowerStripLayer
Definition
BmnStripData.h:12
i
int i
Definition
P4_F32vec4.h:22
m
__m128 m
Definition
P4_F32vec4.h:27
Bool_t
bool Bool_t
Int_t
int Int_t
kFALSE
constexpr Bool_t kFALSE
Double_t
double Double_t
ClassDef
#define ClassDef(name, id)
TObject.h
TString.h
DeadZoneOfStripLayer::SetDeadZone
Bool_t SetDeadZone(Int_t n_points, Double_t *xpoints, Double_t *ypoints)
Definition
BmnStripData.h:109
DeadZoneOfStripLayer::DeadZoneOfStripLayer
DeadZoneOfStripLayer(const DeadZoneOfStripLayer &obj)
Definition
BmnStripData.h:73
DeadZoneOfStripLayer::operator=
DeadZoneOfStripLayer & operator=(const DeadZoneOfStripLayer &obj)
Definition
BmnStripData.h:84
DeadZoneOfStripLayer::GetNPoints
Int_t GetNPoints()
Definition
BmnStripData.h:149
DeadZoneOfStripLayer::GetXPoint
Double_t GetXPoint(Int_t index)
Definition
BmnStripData.h:151
DeadZoneOfStripLayer::DeadZoneOfStripLayer
DeadZoneOfStripLayer(Int_t n_points, Double_t *xpoints, Double_t *ypoints)
Definition
BmnStripData.h:57
DeadZoneOfStripLayer::IsInside
Bool_t IsInside(Double_t x, Double_t y)
Definition
BmnStripData.h:134
DeadZoneOfStripLayer::YPoints
Double_t * YPoints
Definition
BmnStripData.h:48
DeadZoneOfStripLayer::~DeadZoneOfStripLayer
~DeadZoneOfStripLayer()
Definition
BmnStripData.h:100
DeadZoneOfStripLayer::XPoints
Double_t * XPoints
Definition
BmnStripData.h:47
DeadZoneOfStripLayer::NPoints
Int_t NPoints
Definition
BmnStripData.h:46
DeadZoneOfStripLayer::DeadZoneOfStripLayer
DeadZoneOfStripLayer()
Definition
BmnStripData.h:51
DeadZoneOfStripLayer::GetYPoint
Double_t GetYPoint(Int_t index)
Definition
BmnStripData.h:162
StationSet_Exception::StationSet_Exception
StationSet_Exception(TString message)
Definition
BmnStripData.h:32
Station_Exception::Station_Exception
Station_Exception(TString message)
Definition
BmnStripData.h:38
StripCluster
Definition
BmnStripData.h:177
StripCluster::Print
void Print()
Definition
BmnStripData.h:264
StripCluster::SetStation
void SetStation(Int_t st)
Definition
BmnStripData.h:215
StripCluster::TotalSignal
Double_t TotalSignal
Definition
BmnStripData.h:181
StripCluster::fType
Int_t fType
Definition
BmnStripData.h:190
StripCluster::StripCluster
StripCluster(Double_t orig_position, Double_t mean_position, Double_t total_signal)
Definition
BmnStripData.h:221
StripCluster::GetClusterSize
Int_t GetClusterSize()
Definition
BmnStripData.h:295
StripCluster::Strips
vector< Int_t > Strips
Definition
BmnStripData.h:192
StripCluster::GetType
Int_t GetType()
Definition
BmnStripData.h:211
StripCluster::MeanPosition
Double_t MeanPosition
Definition
BmnStripData.h:180
StripCluster::Error
Double_t Error
Definition
BmnStripData.h:187
StripCluster::Clear
void Clear()
Definition
BmnStripData.h:284
StripCluster::SetWidth
void SetWidth(Int_t w)
Definition
BmnStripData.h:213
StripCluster::AddStrip
void AddStrip(Int_t strip_num, Double_t strip_signal)
Definition
BmnStripData.h:237
StripCluster::SetType
void SetType(Int_t type)
Definition
BmnStripData.h:210
StripCluster::PositionResidual
Double_t PositionResidual
Definition
BmnStripData.h:182
StripCluster::Width
Int_t Width
Definition
BmnStripData.h:186
StripCluster::IsCorrect
Bool_t IsCorrect
Definition
BmnStripData.h:183
StripCluster::SetModule
void SetModule(Int_t m)
Definition
BmnStripData.h:217
StripCluster::GetModule
Int_t GetModule()
Definition
BmnStripData.h:216
StripCluster::GetWidth
Int_t GetWidth()
Definition
BmnStripData.h:212
StripCluster::GetStation
Int_t GetStation()
Definition
BmnStripData.h:214
StripCluster::SetError
void SetError(Double_t err)
Definition
BmnStripData.h:218
StripCluster::StripCluster
StripCluster()
Definition
BmnStripData.h:195
StripCluster::Signals
vector< Double_t > Signals
Definition
BmnStripData.h:193
StripCluster::OriginPosition
Double_t OriginPosition
Definition
BmnStripData.h:179
StripCluster::Station
Int_t Station
Definition
BmnStripData.h:184
StripCluster::GetError
Double_t GetError()
Definition
BmnStripData.h:219
StripCluster::Module
Int_t Module
Definition
BmnStripData.h:185
TObject::GetUniqueID
virtual UInt_t GetUniqueID() const
TObject::TObject
TObject()
TString
base
data
BmnStripData.h
Generated on
for BmnRoot by
1.17.0