BmnRoot
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
5// //
6// BmnSteering //
7// //
8// Mechanism of steering files to set an appropriate values of parameters //
9// //
11
12#include <cfloat>
13#include <vector>
14#include "BmnSteering.h"
15
18
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
30BmnSteering::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
48void BmnSteering::TestParsedInput() {
49 //Check for non-initialized elements of arrays
50 vector <Double_t> test1;
51 vector <Double_t> test2;
52
53 test1.resize(fNStatsInnerTracker);
54 test2.resize(fNStatsInnerTracker);
55
56 for (Int_t iEle = 0; iEle < fNStatsInnerTracker; iEle++) {
57 test1.clear();
58 test2.clear();
59
60 test1.push_back(fHitXCutMin[iEle]);
61 test1.push_back(fHitXCutMax[iEle]);
62 test1.push_back(fHitYCutMin[iEle]);
63 test1.push_back(fHitYCutMax[iEle]);
64 test1.push_back(fCellSlopeXZCutMin[iEle]);
65 test1.push_back(fCellSlopeXZCutMax[iEle]);
66 test1.push_back(fCellSlopeYZCutMin[iEle]);
67 test1.push_back(fCellSlopeYZCutMax[iEle]);
68
69 test2.push_back(Abs(fHitXCutMin[iEle] - fHitXCutMax[iEle]));
70 test2.push_back(Abs(fHitYCutMin[iEle] - fHitYCutMax[iEle]));
71 test2.push_back(Abs(fCellSlopeXZCutMin[iEle] - fCellSlopeXZCutMax[iEle]));
72 test2.push_back(Abs(fCellSlopeYZCutMin[iEle] - fCellSlopeYZCutMax[iEle]));
73
74 for (auto it : test1)
75 if (Abs(it - fMarkerValue) < DBL_EPSILON) {
76 cout << "Steering containes missing / incorrect elements!!!" << endl;
77 throw;
78 }
79
80 for (auto it : test2)
81 if (it <= DBL_EPSILON) {
82 cout << "Steering containes missing / incorrect elements!!!" << endl;
83 throw;
84 }
85 }
86
87 if (Abs(fDiffSlopeXZ0 - fMarkerValue) < DBL_EPSILON ||
88 Abs(fDiffSlopeYZ0 - fMarkerValue) < DBL_EPSILON ||
89 Abs(fDiffSlopeXZSlope - fMarkerValue) < DBL_EPSILON ||
90 Abs(fDiffSlopeYZSlope - fMarkerValue) < DBL_EPSILON ||
91 Abs(fChiSquareCut - fMarkerValue) < DBL_EPSILON) {
92 cout << "Steering containes missing / incorrect elements!!!" << endl;
93 throw;
94 }
95
96 if (fNIter == fMarkerValue || fNHitsCut == fMarkerValue ||
97 fNHitsCutTotal == fMarkerValue) {
98 cout << "Steering containes missing / incorrect elements!!!" << endl;
99 throw;
100 }
101}
102
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
150void BmnSteering::ParseSteerFile(TString fileName) {
151 TString gPathConfig = gSystem->Getenv("VMCWORKDIR");
152 TString gPathFull = gPathConfig + "/macro/steering/" + fileName;
153
154 TString tmp = "";
155 string line;
156 ifstream f(gPathFull.Data(), ios::in);
157
158 f >> tmp >> fNStatsInnerTracker;
159
160 fHitXCutMin = new Double_t[fNStatsInnerTracker];
161 fHitXCutMax = new Double_t[fNStatsInnerTracker];
162
163 fHitYCutMin = new Double_t[fNStatsInnerTracker];
164 fHitYCutMax = new Double_t[fNStatsInnerTracker];
165
166 fCellSlopeXZCutMin = new Double_t[fNStatsInnerTracker];
167 fCellSlopeXZCutMax = new Double_t[fNStatsInnerTracker];
168
169 fCellSlopeYZCutMin = new Double_t[fNStatsInnerTracker];
170 fCellSlopeYZCutMax = new Double_t[fNStatsInnerTracker];
171
172 for (Int_t iEle = 0; iEle < fNStatsInnerTracker; iEle++) {
173 fHitXCutMin[iEle] = fMarkerValue;
174 fHitXCutMax[iEle] = fMarkerValue;
175 fHitYCutMin[iEle] = fMarkerValue;
176 fHitYCutMax[iEle] = fMarkerValue;
177 fCellSlopeXZCutMin[iEle] = fMarkerValue;
178 fCellSlopeXZCutMax[iEle] = fMarkerValue;
179 fCellSlopeYZCutMin[iEle] = fMarkerValue;
180 fCellSlopeYZCutMax[iEle] = fMarkerValue;
181 }
182
183 getline(f, line);
184 f >> tmp;
185 for (Int_t iStat = 0; iStat < fNStatsInnerTracker; iStat++)
186 f >> fHitXCutMin[iStat];
187
188 getline(f, line);
189 f >> tmp;
190 for (Int_t iStat = 0; iStat < fNStatsInnerTracker; iStat++)
191 f >> fHitXCutMax[iStat];
192
193 getline(f, line);
194 f >> tmp;
195 for (Int_t iStat = 0; iStat < fNStatsInnerTracker; iStat++)
196 f >> fHitYCutMin[iStat];
197
198 getline(f, line);
199 f >> tmp;
200 for (Int_t iStat = 0; iStat < fNStatsInnerTracker; iStat++)
201 f >> fHitYCutMax[iStat];
202
203 getline(f, line);
204 f >> tmp;
205 for (Int_t iStat = 0; iStat < fNStatsInnerTracker; iStat++)
206 f >> fCellSlopeXZCutMin[iStat];
207
208 getline(f, line);
209 f >> tmp;
210 for (Int_t iStat = 0; iStat < fNStatsInnerTracker; iStat++)
211 f >> fCellSlopeXZCutMax[iStat];
212
213 getline(f, line);
214 f >> tmp;
215 for (Int_t iStat = 0; iStat < fNStatsInnerTracker; iStat++)
216 f >> fCellSlopeYZCutMin[iStat];
217
218 getline(f, line);
219 f >> tmp;
220 for (Int_t iStat = 0; iStat < fNStatsInnerTracker; iStat++)
221 f >> fCellSlopeYZCutMax[iStat];
222
223 getline(f, line);
224 f >> tmp >> fDiffSlopeXZ0;
225
226 getline(f, line);
227 f >> tmp >> fDiffSlopeXZSlope;
228
229 getline(f, line);
230 f >> tmp >> fDiffSlopeYZ0;
231
232 getline(f, line);
233 f >> tmp >> fDiffSlopeYZSlope;
234
235 getline(f, line);
236 f >> tmp >> fChiSquareCut;
237
238 getline(f, line);
239 f >> tmp >> fNIter;
240
241 getline(f, line);
242 f >> tmp >> fNHitsCut;
243
244 getline(f, line);
245 f >> tmp >> fNHitsCutTotal;
246}
247
float f
Definition P4_F32vec4.h:21
virtual ~BmnSteering()
void PrintParamTable()