19 #include "Stl3Util/ftf/FtfPara.h"
20 #include "Stl3Util/ftf/FtfGeneral.h"
26 void FtfPara::read (
char* inputFile ) {
28 FILE* dataFile = fopen( inputFile,
"r");
29 if (dataFile == NULL) {
30 printf (
"FtfPara::write: Error opening input file %s \n", inputFile ) ;
34 char* name =
new char[100] ;
36 if ( fscanf ( dataFile,
"%s", name ) == EOF ) break ;
37 if ( !strncmp(name,
"infoLevel" ,8) ) {
38 fscanf ( dataFile,
"%d", &infoLevel ) ;
41 if ( !strncmp(name,
"segmentRowSearch",8) ) {
42 fscanf ( dataFile,
"%d", &segmentRowSearchRange ) ;
45 if ( !strncmp(name,
"trackRowSearch", 8) ) {
46 fscanf ( dataFile,
"%d", &trackRowSearchRange ) ;
49 if ( !strncmp(name,
"getErrors ", 8) ) {
50 fscanf ( dataFile,
"%d", &getErrors ) ;
53 if ( !strncmp(name,
"fillTracks ", 8) ) {
54 fscanf ( dataFile,
"%d", &fillTracks ) ;
57 if ( !strncmp(name,
"ghostFlag ", 8) ) {
58 fscanf ( dataFile,
"%d", &ghostFlag ) ;
61 if ( !strncmp(name,
"goBackwards ", 8) ) {
62 fscanf ( dataFile,
"%d", &goBackwards ) ;
65 if ( !strncmp(name,
"mergePrimaries", 8) ) {
66 fscanf ( dataFile,
"%d", &mergePrimaries ) ;
69 if ( !strncmp(name,
"minHitsPerTrack", 8) ) {
70 fscanf ( dataFile,
"%d", &minHitsPerTrack ) ;
73 if ( !strncmp(name,
"modRow", 6) ) {
74 fscanf ( dataFile,
"%d", &modRow ) ;
77 if ( !strncmp(name,
"nHitsForSegment", 8) ) {
78 fscanf ( dataFile,
"%d", &nHitsForSegment ) ;
81 if ( !strncmp(name,
"minHitsForFit", 8) ) {
82 fscanf ( dataFile,
"%d", &minHitsForFit ) ;
85 if ( !strncmp(name,
"nEtaTrack", 8) ) {
86 fscanf ( dataFile,
"%i", &nEtaTrack ) ;
89 if ( !strncmp(name,
"nEta", 4) ) {
90 fscanf ( dataFile,
"%d", &nEta ) ;
93 if ( !strncmp(name,
"nPhiTrack", 8) ) {
94 fscanf ( dataFile,
"%d", &nPhiTrack ) ;
97 if ( !strncmp(name,
"nPhi", 4) ) {
98 fscanf ( dataFile,
"%d", &nPhi ) ;
101 if ( !strncmp(name,
"detaMerge ", 8) ) {
102 fscanf ( dataFile,
"%e", &detaMerge ) ;
105 if ( !strncmp(name,
"deta ", 4) ) {
106 fscanf ( dataFile,
"%e", &deta ) ;
109 if ( !strncmp(name,
"dphiMerge ", 8) ) {
110 fscanf ( dataFile,
"%e", &dphiMerge ) ;
113 if ( !strncmp(name,
"dphi ", 4) ) {
114 fscanf ( dataFile,
"%e", &dphi ) ;
117 if ( !strncmp(name,
"etaMinTrack ", 8) ) {
118 fscanf ( dataFile,
"%e", &etaMinTrack ) ;
121 if ( !strncmp(name,
"etaMin", 6) ) {
122 fscanf ( dataFile,
"%e", &etaMin ) ;
125 if ( !strncmp(name,
"etaMaxTrack ", 8) ) {
126 fscanf ( dataFile,
"%e", &etaMaxTrack ) ;
129 if ( !strncmp(name,
"etaMax ", 6) ) {
130 fscanf ( dataFile,
"%e", &etaMax ) ;
133 if ( !strncmp(name,
"phiMinTrack ", 8) ) {
134 fscanf ( dataFile,
"%e", &phiMinTrack ) ;
137 if ( !strncmp(name,
"phiMin ", 6) ) {
138 fscanf ( dataFile,
"%e", &phiMin ) ;
141 if ( !strncmp(name,
"phiMaxTrack ", 8) ) {
142 fscanf ( dataFile,
"%e", &phiMaxTrack ) ;
145 if ( !strncmp(name,
"phiMax ", 6) ) {
146 fscanf ( dataFile,
"%e", &phiMax ) ;
149 if ( !strncmp(name,
"phiShift ", 8) ) {
150 fscanf ( dataFile,
"%e", &phiShift ) ;
153 if ( !strncmp(name,
"distanceMerge", 8) ) {
154 fscanf ( dataFile,
"%e", &distanceMerge ) ;
157 if ( !strncmp(name,
"nPrimaryPasses", 8) ) {
158 fscanf ( dataFile,
"%d", &nPrimaryPasses ) ;
161 if ( !strncmp(name,
"nSecondary", 8) ) {
162 fscanf ( dataFile,
"%d", &nSecondaryPasses ) ;
165 if ( !strncmp(name,
"vertexConstrainedFit", 8) ) {
166 fscanf ( dataFile,
"%d", &vertexConstrainedFit ) ;
169 if ( !strncmp(name,
"parameterLocation", 8) ) {
170 fscanf ( dataFile,
"%d", ¶meterLocation ) ;
173 if ( !strncmp(name,
"rowInnerMost", 8) ) {
174 fscanf ( dataFile,
"%d", &rowInnerMost ) ;
177 if ( !strncmp(name,
"rowOuterMost", 8) ) {
178 fscanf ( dataFile,
"%d", &rowOuterMost ) ;
181 if ( !strncmp(name,
"rowStart", 8) ) {
182 fscanf ( dataFile,
"%d", &rowStart ) ;
185 if ( !strncmp(name,
"rowEnd", 6) ) {
186 fscanf ( dataFile,
"%d", &rowEnd ) ;
189 if ( !strncmp(name,
"szFitFlag", 8) ) {
190 fscanf ( dataFile,
"%d", &szFitFlag ) ;
193 if ( !strncmp(name,
"bField", 6) ) {
194 fscanf ( dataFile,
"%e", &bField ) ;
197 if ( !strncmp(name,
"maxChi2Primary", 12) ) {
198 fscanf ( dataFile,
"%e", &maxChi2Primary ) ;
201 if ( !strncmp(name,
"hitChi2Cut", 8) ) {
202 fscanf ( dataFile,
"%e", &hitChi2Cut ) ;
205 if ( !strncmp(name,
"goodHitChi2", 8) ) {
206 fscanf ( dataFile,
"%e", &goodHitChi2 ) ;
209 if ( !strncmp(name,
"trackChi2Cut", 8) ) {
210 fscanf ( dataFile,
"%e", &trackChi2Cut ) ;
213 if ( !strncmp(name,
"goodDistance", 8) ) {
214 fscanf ( dataFile,
"%e", &goodDistance ) ;
217 if ( !strncmp(name,
"ptMinHelixFit", 8) ) {
218 fscanf ( dataFile,
"%e", &ptMinHelixFit ) ;
221 if ( !strncmp(name,
"maxDistanceSegment", 15) ) {
222 fscanf ( dataFile,
"%e", &maxDistanceSegment ) ;
225 if ( !strncmp(name,
"xyErrorScale", 10) ) {
226 fscanf ( dataFile,
"%e", &xyErrorScale ) ;
229 if ( !strncmp(name,
"szErrorScale", 10) ) {
230 fscanf ( dataFile,
"%e", &szErrorScale ) ;
233 if ( !strncmp(name,
"xVertex", 7) ) {
234 fscanf ( dataFile,
"%e", &xVertex ) ;
237 if ( !strncmp(name,
"yVertex", 7) ) {
238 fscanf ( dataFile,
"%e", &yVertex ) ;
241 if ( !strncmp(name,
"zVertex", 7) ) {
242 fscanf ( dataFile,
"%e", &zVertex ) ;
245 if ( !strncmp(name,
"dxVertex", 8) ) {
246 fscanf ( dataFile,
"%e", &dxVertex ) ;
249 if ( !strncmp(name,
"dyVertex", 8) ) {
250 fscanf ( dataFile,
"%e", &dyVertex ) ;
253 if ( !strncmp(name,
"xyWeightVertex", 8) ) {
254 fscanf ( dataFile,
"%e", &xyWeightVertex ) ;
257 if ( !strncmp(name,
"phiVertex", 8) ) {
258 fscanf ( dataFile,
"%e", &phiVertex ) ;
261 if ( !strncmp(name,
"rVertex", 7) ) {
262 fscanf ( dataFile,
"%e", &rVertex ) ;
265 if ( !strncmp(name,
"maxTime", 7) ) {
266 fscanf ( dataFile,
"%e", &maxTime ) ;
269 printf (
"FtfPara::read: parameter %s not found \n", name ) ;
271 fscanf ( dataFile,
"%e", &variable ) ;
275 fclose ( dataFile ) ;
279 void FtfPara::write (
char* outputFile ) {
280 FILE* dataFile = fopen( outputFile,
"w");
281 if (dataFile == NULL) {
282 printf (
"FtfPara::write: Error opening output file %s \n ", outputFile ) ;
286 fclose ( dataFile ) ;
289 void FtfPara::write ( FILE* dataFile ) {
291 fprintf ( dataFile,
"infoLevel %10d \n", infoLevel ) ;
292 fprintf ( dataFile,
"segmentRowSearch %10d \n", segmentRowSearchRange ) ;
293 fprintf ( dataFile,
"trackRowSearch %10d \n", trackRowSearchRange ) ;
294 fprintf ( dataFile,
"getErrors %10d \n", getErrors ) ;
295 fprintf ( dataFile,
"fillTracks %10d \n", fillTracks ) ;
296 fprintf ( dataFile,
"ghostFlag %10d \n", ghostFlag ) ;
297 fprintf ( dataFile,
"goBackwards %10d \n", goBackwards ) ;
298 fprintf ( dataFile,
"mergePrimaries %10d \n", mergePrimaries ) ;
299 fprintf ( dataFile,
"minHitsPerTrack %10d \n", minHitsPerTrack ) ;
300 fprintf ( dataFile,
"modRow %10d \n", modRow ) ;
301 fprintf ( dataFile,
"nHitsForSegment %10d \n", nHitsForSegment ) ;
303 fprintf ( dataFile,
"nEta %10d \n", nEta ) ;
304 fprintf ( dataFile,
"nPhi %10d \n", nPhi ) ;
305 fprintf ( dataFile,
"deta %10.2e\n", deta ) ;
306 fprintf ( dataFile,
"dphi %10.2e\n", dphi ) ;
307 fprintf ( dataFile,
"etaMin %10.2e\n", etaMin ) ;
308 fprintf ( dataFile,
"etaMax %10.2e\n", etaMax ) ;
309 fprintf ( dataFile,
"phiMin %10.2e\n", phiMin ) ;
310 fprintf ( dataFile,
"phiMax %10.2e\n", phiMax ) ;
311 fprintf ( dataFile,
"phiShift %10.2e\n", phiShift ) ;
312 fprintf ( dataFile,
"detaMerge %10.2e\n", detaMerge ) ;
313 fprintf ( dataFile,
"distanceMerge %10.2e\n", distanceMerge ) ;
314 fprintf ( dataFile,
"nEtaTrack %10d \n", nEtaTrack ) ;
315 fprintf ( dataFile,
"nPhiTrack %10d \n", nPhiTrack ) ;
316 fprintf ( dataFile,
"etaMinTrack %10.2e\n", etaMinTrack ) ;
317 fprintf ( dataFile,
"etaMaxTrack %10.2e\n", etaMaxTrack ) ;
318 fprintf ( dataFile,
"phiMinTrack %10.2e\n", phiMinTrack ) ;
319 fprintf ( dataFile,
"phiMaxTrack %10.2e\n", phiMaxTrack ) ;
320 fprintf ( dataFile,
"nPrimaryPasses %10d \n", nPrimaryPasses ) ;
321 fprintf ( dataFile,
"nSecondaryPasses %10d \n", nSecondaryPasses ) ;
322 fprintf ( dataFile,
"vertexConstrainedFit %10d \n", vertexConstrainedFit ) ;
323 fprintf ( dataFile,
"parameterLocation %10d \n", parameterLocation ) ;
324 fprintf ( dataFile,
"rowInnerMost %10d \n", rowInnerMost ) ;
325 fprintf ( dataFile,
"rowOuterMost %10d \n", rowOuterMost ) ;
326 fprintf ( dataFile,
"rowStart %10d \n", rowStart ) ;
327 fprintf ( dataFile,
"rowEnd %10d \n", rowEnd ) ;
328 fprintf ( dataFile,
"szFitFlag %10d \n", szFitFlag ) ;
329 fprintf ( dataFile,
"maxChi2Primary %10.2e\n", maxChi2Primary ) ;
330 fprintf ( dataFile,
"bField %10.2e\n", bField ) ;
331 fprintf ( dataFile,
"hitChi2Cut %10.2e\n", hitChi2Cut ) ;
332 fprintf ( dataFile,
"goodHitChi2 %10.2e\n", goodHitChi2 ) ;
333 fprintf ( dataFile,
"trackChi2Cut %10.2e\n", trackChi2Cut ) ;
334 fprintf ( dataFile,
"goodDistance %10.2e\n", goodDistance ) ;
335 fprintf ( dataFile,
"ptMinHelixFit %10.2e\n", ptMinHelixFit ) ;
336 fprintf ( dataFile,
"maxDistanceSegment %10.2e\n", maxDistanceSegment ) ;
337 fprintf ( dataFile,
"xyErrorScale %10.2e\n", xyErrorScale ) ;
338 fprintf ( dataFile,
"szErrorScale %10.2e\n", szErrorScale ) ;
339 fprintf ( dataFile,
"xVertex %10.2e\n", xVertex ) ;
340 fprintf ( dataFile,
"yVertex %10.2e\n", yVertex ) ;
341 fprintf ( dataFile,
"dxVertex %10.2e\n", dxVertex ) ;
342 fprintf ( dataFile,
"dyVertex %10.2e\n", dyVertex ) ;
343 fprintf ( dataFile,
"zVertex %10.2e\n", zVertex ) ;
344 fprintf ( dataFile,
"xyWeightVertex %10.2e\n", xyWeightVertex ) ;
345 fprintf ( dataFile,
"phiVertex %10.2e\n", phiVertex ) ;
346 fprintf ( dataFile,
"rVertex %10.2e\n", rVertex ) ;
347 fprintf ( dataFile,
"maxTime %10.2e\n", maxTime ) ;
350 void FtfPara::setDefaults (
void)
357 goodHitChi2 = 100.F ;
358 trackChi2Cut = 250.F ;
359 maxChi2Primary = 0. ;
360 segmentRowSearchRange = 1 ;
361 trackRowSearchRange = 3 ;
364 minHitsForDedx = 15 ;
365 dphi = 0.10F * modRow ;
366 deta = 0.10F * modRow ;
371 etaMinTrack = -2.2F ;
379 goodDistance = 1.F * modRow ;
382 parameterLocation = 1 ;
383 phiMin = (float)(-0.000001/toDeg) ;
384 phiMinTrack = (float)(-0.000001/toDeg) ;
385 phiMax = (float)(360.2/toDeg) ;
386 phiMaxTrack = (float)(360.2/toDeg) ;
387 maxDistanceSegment = 100.F * modRow ;
388 minHitsPerTrack = 5 ;
389 nHitsForSegment = 2 ;
395 nSecondaryPasses = 0 ;
396 vertexConstrainedFit = 0 ;
401 segmentMaxAngle = 10.F/toDeg ;
403 xyErrorScale = 1.0F ;
404 szErrorScale = 1.0F ;
409 ptMinHelixFit = 0.F ;