BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
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
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
47
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
97 cout << "Steering containes missing / incorrect elements!!!" << endl;
98 throw;
99 }
100}
101
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
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
163
166
169
172
173 for (Int_t iEle = 0; iEle < fNStatsInnerTracker; iEle++) {
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 Int_t
double Double_t
R__EXTERN TSystem * gSystem
Int_t fNHitsCutTotal
Int_t fNHitsCut
Double_t * fHitXCutMax
Definition BmnSteering.h:81
Double_t fDiffSlopeXZ0
Definition BmnSteering.h:92
Double_t * fCellSlopeYZCutMax
Definition BmnSteering.h:90
Double_t * fCellSlopeYZCutMin
Definition BmnSteering.h:89
Double_t * fCellSlopeXZCutMax
Definition BmnSteering.h:87
Double_t * fCellSlopeXZCutMin
Definition BmnSteering.h:86
Double_t fDiffSlopeXZSlope
Definition BmnSteering.h:95
Double_t * fHitYCutMin
Definition BmnSteering.h:83
void ParseSteerFile(TString)
Double_t * fHitYCutMax
Definition BmnSteering.h:84
virtual ~BmnSteering()
void TestParsedInput()
Double_t * fHitXCutMin
Definition BmnSteering.h:80
Double_t fMarkerValue
Double_t fDiffSlopeYZSlope
Definition BmnSteering.h:96
Int_t fNStatsInnerTracker
Definition BmnSteering.h:78
Double_t fDiffSlopeYZ0
Definition BmnSteering.h:93
Double_t fChiSquareCut
Definition BmnSteering.h:98
void PrintParamTable()
TString fSteerFile
Definition BmnSteering.h:76
const char * Data() const
Double_t Abs(Double_t d)