BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnSteering.cxx
Go to the documentation of this file.
1
// @(#)bmnroot/steering:$Id$
2
// Author: Pavel Batyuk <pavel.batyuk@jinr.ru> 2018-09-12
3
4
////////////////////////////////////////////////////////////////////////////////
5
// //
6
// BmnSteering //
7
// //
8
// Mechanism of steering files to set an appropriate values of parameters //
9
// //
10
////////////////////////////////////////////////////////////////////////////////
11
12
#include "
BmnSteering.h
"
13
14
#include <cfloat>
15
#include <vector>
16
17
BmnSteering::~BmnSteering
() {}
18
19
BmnSteering::BmnSteering
()
20
:
fHitXCutMin
(nullptr)
21
,
fHitXCutMax
(nullptr)
22
,
fHitYCutMin
(nullptr)
23
,
fHitYCutMax
(nullptr)
24
,
fCellSlopeXZCutMin
(nullptr)
25
,
fCellSlopeXZCutMax
(nullptr)
26
,
fCellSlopeYZCutMin
(nullptr)
27
,
fCellSlopeYZCutMax
(nullptr)
28
{}
29
30
BmnSteering::BmnSteering
(
TString
fileName)
31
:
fSteerFile
(fileName)
32
,
fMarkerValue
(-1000.)
33
{
34
fDiffSlopeXZ0
=
fMarkerValue
;
35
fDiffSlopeYZ0
=
fMarkerValue
;
36
fDiffSlopeXZSlope
=
fMarkerValue
;
37
fDiffSlopeYZSlope
=
fMarkerValue
;
38
fChiSquareCut
=
fMarkerValue
;
39
40
fNIter
=
fMarkerValue
;
41
fNHitsCut
=
fMarkerValue
;
42
fNHitsCutTotal
=
fMarkerValue
;
43
44
ParseSteerFile
(
fSteerFile
);
45
TestParsedInput
();
46
}
47
48
void
BmnSteering::TestParsedInput
()
49
{
50
// Check for non-initialized elements of arrays
51
vector<Double_t> test1;
52
vector<Double_t> test2;
53
54
test1.resize(
fNStatsInnerTracker
);
55
test2.resize(
fNStatsInnerTracker
);
56
57
for
(
Int_t
iEle = 0; iEle <
fNStatsInnerTracker
; iEle++) {
58
test1.clear();
59
test2.clear();
60
61
test1.push_back(
fHitXCutMin
[iEle]);
62
test1.push_back(
fHitXCutMax
[iEle]);
63
test1.push_back(
fHitYCutMin
[iEle]);
64
test1.push_back(
fHitYCutMax
[iEle]);
65
test1.push_back(
fCellSlopeXZCutMin
[iEle]);
66
test1.push_back(
fCellSlopeXZCutMax
[iEle]);
67
test1.push_back(
fCellSlopeYZCutMin
[iEle]);
68
test1.push_back(
fCellSlopeYZCutMax
[iEle]);
69
70
test2.push_back(
Abs
(
fHitXCutMin
[iEle] -
fHitXCutMax
[iEle]));
71
test2.push_back(
Abs
(
fHitYCutMin
[iEle] -
fHitYCutMax
[iEle]));
72
test2.push_back(
Abs
(
fCellSlopeXZCutMin
[iEle] -
fCellSlopeXZCutMax
[iEle]));
73
test2.push_back(
Abs
(
fCellSlopeYZCutMin
[iEle] -
fCellSlopeYZCutMax
[iEle]));
74
75
for
(
auto
it : test1)
76
if
(
Abs
(it -
fMarkerValue
) < DBL_EPSILON) {
77
cout <<
"Steering containes missing / incorrect elements!!!"
<< endl;
78
throw
;
79
}
80
81
for
(
auto
it : test2)
82
if
(it <= DBL_EPSILON) {
83
cout <<
"Steering containes missing / incorrect elements!!!"
<< endl;
84
throw
;
85
}
86
}
87
88
if
(
Abs
(
fDiffSlopeXZ0
-
fMarkerValue
) < DBL_EPSILON ||
Abs
(
fDiffSlopeYZ0
-
fMarkerValue
) < DBL_EPSILON
89
||
Abs
(
fDiffSlopeXZSlope
-
fMarkerValue
) < DBL_EPSILON ||
Abs
(
fDiffSlopeYZSlope
-
fMarkerValue
) < DBL_EPSILON
90
||
Abs
(
fChiSquareCut
-
fMarkerValue
) < DBL_EPSILON)
91
{
92
cout <<
"Steering containes missing / incorrect elements!!!"
<< endl;
93
throw
;
94
}
95
96
if
(
fNIter
==
fMarkerValue
||
fNHitsCut
==
fMarkerValue
||
fNHitsCutTotal
==
fMarkerValue
) {
97
cout <<
"Steering containes missing / incorrect elements!!!"
<< endl;
98
throw
;
99
}
100
}
101
102
void
BmnSteering::PrintParamTable
()
103
{
104
cout <<
"Steering file: "
<<
fSteerFile
<< endl;
105
106
cout <<
"fNStations = "
<<
fNStatsInnerTracker
<< endl;
107
108
cout <<
"hitXCutMin: "
<< endl;
109
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
110
cout << iStat <<
" "
<<
fHitXCutMin
[iStat] << endl;
111
112
cout <<
"hitXCutMax: "
<< endl;
113
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
114
cout << iStat <<
" "
<<
fHitXCutMax
[iStat] << endl;
115
116
cout <<
"hitYCutMin: "
<< endl;
117
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
118
cout << iStat <<
" "
<<
fHitYCutMin
[iStat] << endl;
119
120
cout <<
"hitYCutMax: "
<< endl;
121
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
122
cout << iStat <<
" "
<<
fHitYCutMax
[iStat] << endl;
123
124
cout <<
"cellSlopeXZCutMin: "
<< endl;
125
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
126
cout << iStat <<
" "
<<
fCellSlopeXZCutMin
[iStat] << endl;
127
128
cout <<
"cellSlopeXZCutMax: "
<< endl;
129
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
130
cout << iStat <<
" "
<<
fCellSlopeXZCutMax
[iStat] << endl;
131
132
cout <<
"cellSlopeYZCutMin: "
<< endl;
133
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
134
cout << iStat <<
" "
<<
fCellSlopeYZCutMin
[iStat] << endl;
135
136
cout <<
"cellSlopeYZCutMax: "
<< endl;
137
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
138
cout << iStat <<
" "
<<
fCellSlopeYZCutMax
[iStat] << endl;
139
140
cout <<
"diffSlopeXZ0 = "
<<
fDiffSlopeXZ0
<< endl;
141
cout <<
"diffSlopeXZSlope = "
<<
fDiffSlopeXZSlope
<< endl;
142
cout <<
"diffSlopeYZ0 = "
<<
fDiffSlopeYZ0
<< endl;
143
cout <<
"diffSlopeYZSlope = "
<<
fDiffSlopeYZSlope
<< endl;
144
cout <<
"chiSquareCut = "
<<
fChiSquareCut
<< endl;
145
cout <<
"nIter = "
<<
fNIter
<< endl;
146
cout <<
"nHitsCut = "
<<
fNHitsCut
<< endl;
147
cout <<
"nHitsCutTotal = "
<<
fNHitsCutTotal
<< endl;
148
}
149
150
void
BmnSteering::ParseSteerFile
(
TString
fileName)
151
{
152
TString
gPathConfig =
gSystem
->Getenv(
"VMCWORKDIR"
);
153
TString
gPathFull = gPathConfig +
"/macro/steering/"
+ fileName;
154
155
TString
tmp =
""
;
156
string
line;
157
ifstream f(gPathFull.
Data
(), ios::in);
158
159
f >> tmp >>
fNStatsInnerTracker
;
160
161
fHitXCutMin
=
new
Double_t
[
fNStatsInnerTracker
];
162
fHitXCutMax
=
new
Double_t
[
fNStatsInnerTracker
];
163
164
fHitYCutMin
=
new
Double_t
[
fNStatsInnerTracker
];
165
fHitYCutMax
=
new
Double_t
[
fNStatsInnerTracker
];
166
167
fCellSlopeXZCutMin
=
new
Double_t
[
fNStatsInnerTracker
];
168
fCellSlopeXZCutMax
=
new
Double_t
[
fNStatsInnerTracker
];
169
170
fCellSlopeYZCutMin
=
new
Double_t
[
fNStatsInnerTracker
];
171
fCellSlopeYZCutMax
=
new
Double_t
[
fNStatsInnerTracker
];
172
173
for
(
Int_t
iEle = 0; iEle <
fNStatsInnerTracker
; iEle++) {
174
fHitXCutMin
[iEle] =
fMarkerValue
;
175
fHitXCutMax
[iEle] =
fMarkerValue
;
176
fHitYCutMin
[iEle] =
fMarkerValue
;
177
fHitYCutMax
[iEle] =
fMarkerValue
;
178
fCellSlopeXZCutMin
[iEle] =
fMarkerValue
;
179
fCellSlopeXZCutMax
[iEle] =
fMarkerValue
;
180
fCellSlopeYZCutMin
[iEle] =
fMarkerValue
;
181
fCellSlopeYZCutMax
[iEle] =
fMarkerValue
;
182
}
183
184
getline(f, line);
185
f >> tmp;
186
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
187
f >>
fHitXCutMin
[iStat];
188
189
getline(f, line);
190
f >> tmp;
191
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
192
f >>
fHitXCutMax
[iStat];
193
194
getline(f, line);
195
f >> tmp;
196
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
197
f >>
fHitYCutMin
[iStat];
198
199
getline(f, line);
200
f >> tmp;
201
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
202
f >>
fHitYCutMax
[iStat];
203
204
getline(f, line);
205
f >> tmp;
206
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
207
f >>
fCellSlopeXZCutMin
[iStat];
208
209
getline(f, line);
210
f >> tmp;
211
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
212
f >>
fCellSlopeXZCutMax
[iStat];
213
214
getline(f, line);
215
f >> tmp;
216
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
217
f >>
fCellSlopeYZCutMin
[iStat];
218
219
getline(f, line);
220
f >> tmp;
221
for
(
Int_t
iStat = 0; iStat <
fNStatsInnerTracker
; iStat++)
222
f >>
fCellSlopeYZCutMax
[iStat];
223
224
getline(f, line);
225
f >> tmp >>
fDiffSlopeXZ0
;
226
227
getline(f, line);
228
f >> tmp >>
fDiffSlopeXZSlope
;
229
230
getline(f, line);
231
f >> tmp >>
fDiffSlopeYZ0
;
232
233
getline(f, line);
234
f >> tmp >>
fDiffSlopeYZSlope
;
235
236
getline(f, line);
237
f >> tmp >>
fChiSquareCut
;
238
239
getline(f, line);
240
f >> tmp >>
fNIter
;
241
242
getline(f, line);
243
f >> tmp >>
fNHitsCut
;
244
245
getline(f, line);
246
f >> tmp >>
fNHitsCutTotal
;
247
}
Int_t
int Int_t
Double_t
double Double_t
gSystem
R__EXTERN TSystem * gSystem
BmnSteering::fNHitsCutTotal
Int_t fNHitsCutTotal
Definition
BmnSteering.h:102
BmnSteering::fNHitsCut
Int_t fNHitsCut
Definition
BmnSteering.h:101
BmnSteering::fHitXCutMax
Double_t * fHitXCutMax
Definition
BmnSteering.h:81
BmnSteering::fDiffSlopeXZ0
Double_t fDiffSlopeXZ0
Definition
BmnSteering.h:92
BmnSteering::fCellSlopeYZCutMax
Double_t * fCellSlopeYZCutMax
Definition
BmnSteering.h:90
BmnSteering::fCellSlopeYZCutMin
Double_t * fCellSlopeYZCutMin
Definition
BmnSteering.h:89
BmnSteering::fCellSlopeXZCutMax
Double_t * fCellSlopeXZCutMax
Definition
BmnSteering.h:87
BmnSteering::fCellSlopeXZCutMin
Double_t * fCellSlopeXZCutMin
Definition
BmnSteering.h:86
BmnSteering::fDiffSlopeXZSlope
Double_t fDiffSlopeXZSlope
Definition
BmnSteering.h:95
BmnSteering::fHitYCutMin
Double_t * fHitYCutMin
Definition
BmnSteering.h:83
BmnSteering::ParseSteerFile
void ParseSteerFile(TString)
Definition
BmnSteering.cxx:150
BmnSteering::fHitYCutMax
Double_t * fHitYCutMax
Definition
BmnSteering.h:84
BmnSteering::~BmnSteering
virtual ~BmnSteering()
Definition
BmnSteering.cxx:17
BmnSteering::fNIter
Int_t fNIter
Definition
BmnSteering.h:99
BmnSteering::TestParsedInput
void TestParsedInput()
Definition
BmnSteering.cxx:48
BmnSteering::fHitXCutMin
Double_t * fHitXCutMin
Definition
BmnSteering.h:80
BmnSteering::fMarkerValue
Double_t fMarkerValue
Definition
BmnSteering.h:104
BmnSteering::fDiffSlopeYZSlope
Double_t fDiffSlopeYZSlope
Definition
BmnSteering.h:96
BmnSteering::fNStatsInnerTracker
Int_t fNStatsInnerTracker
Definition
BmnSteering.h:78
BmnSteering::fDiffSlopeYZ0
Double_t fDiffSlopeYZ0
Definition
BmnSteering.h:93
BmnSteering::fChiSquareCut
Double_t fChiSquareCut
Definition
BmnSteering.h:98
BmnSteering::PrintParamTable
void PrintParamTable()
Definition
BmnSteering.cxx:102
BmnSteering::BmnSteering
BmnSteering()
Definition
BmnSteering.cxx:19
BmnSteering::fSteerFile
TString fSteerFile
Definition
BmnSteering.h:76
TString
TString::Data
const char * Data() const
TMath::Abs
Double_t Abs(Double_t d)
BmnSteering.h
steering
BmnSteering.cxx
Generated on
for BmnRoot by
1.17.0