18 #include "FtfFinder.h"
21 void FtfPara::read (
char* inputFile ) {
23 FILE* dataFile = fopen( inputFile,
"r");
24 if (dataFile == NULL) {
25 printf (
"FtfPara::write: Error opening input file %s \n", inputFile ) ;
29 char* name =
new char[100] ;
31 if ( fscanf ( dataFile,
"%s", name ) == EOF ) break ;
32 if ( !strncmp(name,
"infoLevel" ,8) ) {
33 fscanf ( dataFile,
"%d", &infoLevel ) ;
36 if ( !strncmp(name,
"segmentRowSearch",8) ) {
37 fscanf ( dataFile,
"%d", &segmentRowSearchRange ) ;
40 if ( !strncmp(name,
"trackRowSearch", 8) ) {
41 fscanf ( dataFile,
"%d", &trackRowSearchRange ) ;
44 if ( !strncmp(name,
"getErrors ", 8) ) {
45 fscanf ( dataFile,
"%d", &getErrors ) ;
48 if ( !strncmp(name,
"fillTracks ", 8) ) {
49 fscanf ( dataFile,
"%d", &fillTracks ) ;
52 if ( !strncmp(name,
"ghostFlag ", 8) ) {
53 fscanf ( dataFile,
"%d", &ghostFlag ) ;
56 if ( !strncmp(name,
"goBackwards ", 8) ) {
57 fscanf ( dataFile,
"%d", &goBackwards ) ;
60 if ( !strncmp(name,
"mergePrimaries", 8) ) {
61 fscanf ( dataFile,
"%d", &mergePrimaries ) ;
64 if ( !strncmp(name,
"minHitsPerTrack", 8) ) {
65 fscanf ( dataFile,
"%d", &minHitsPerTrack ) ;
68 if ( !strncmp(name,
"modRow", 6) ) {
69 fscanf ( dataFile,
"%d", &modRow ) ;
72 if ( !strncmp(name,
"nHitsForSegment", 8) ) {
73 fscanf ( dataFile,
"%d", &nHitsForSegment ) ;
76 if ( !strncmp(name,
"minHitsForFit", 8) ) {
77 fscanf ( dataFile,
"%d", &minHitsForFit ) ;
80 if ( !strncmp(name,
"nEtaTrack", 8) ) {
81 fscanf ( dataFile,
"%i", &nEtaTrack ) ;
84 if ( !strncmp(name,
"nEta", 4) ) {
85 fscanf ( dataFile,
"%d", &nEta ) ;
88 if ( !strncmp(name,
"nPhiTrack", 8) ) {
89 fscanf ( dataFile,
"%d", &nPhiTrack ) ;
92 if ( !strncmp(name,
"nPhi", 4) ) {
93 fscanf ( dataFile,
"%d", &nPhi ) ;
96 if ( !strncmp(name,
"detaMerge ", 8) ) {
97 fscanf ( dataFile,
"%e", &detaMerge ) ;
100 if ( !strncmp(name,
"deta ", 4) ) {
101 fscanf ( dataFile,
"%e", &deta ) ;
104 if ( !strncmp(name,
"dphiMerge ", 8) ) {
105 fscanf ( dataFile,
"%e", &dphiMerge ) ;
108 if ( !strncmp(name,
"dphi ", 4) ) {
109 fscanf ( dataFile,
"%e", &dphi ) ;
112 if ( !strncmp(name,
"etaMinTrack ", 8) ) {
113 fscanf ( dataFile,
"%e", &etaMinTrack ) ;
116 if ( !strncmp(name,
"etaMin", 6) ) {
117 fscanf ( dataFile,
"%e", &etaMin ) ;
120 if ( !strncmp(name,
"etaMaxTrack ", 8) ) {
121 fscanf ( dataFile,
"%e", &etaMaxTrack ) ;
124 if ( !strncmp(name,
"etaMax ", 6) ) {
125 fscanf ( dataFile,
"%e", &etaMax ) ;
128 if ( !strncmp(name,
"phiMinTrack ", 8) ) {
129 fscanf ( dataFile,
"%e", &phiMinTrack ) ;
132 if ( !strncmp(name,
"phiMin ", 6) ) {
133 fscanf ( dataFile,
"%e", &phiMin ) ;
136 if ( !strncmp(name,
"phiMaxTrack ", 8) ) {
137 fscanf ( dataFile,
"%e", &phiMaxTrack ) ;
140 if ( !strncmp(name,
"phiMax ", 6) ) {
141 fscanf ( dataFile,
"%e", &phiMax ) ;
144 if ( !strncmp(name,
"phiShift ", 8) ) {
145 fscanf ( dataFile,
"%e", &phiShift ) ;
148 if ( !strncmp(name,
"distanceMerge", 8) ) {
149 fscanf ( dataFile,
"%e", &distanceMerge ) ;
152 if ( !strncmp(name,
"nPrimaryPasses", 8) ) {
153 fscanf ( dataFile,
"%d", &nPrimaryPasses ) ;
156 if ( !strncmp(name,
"nSecondary", 8) ) {
157 fscanf ( dataFile,
"%d", &nSecondaryPasses ) ;
160 if ( !strncmp(name,
"vertexConstrainedFit", 8) ) {
161 fscanf ( dataFile,
"%d", &vertexConstrainedFit ) ;
164 if ( !strncmp(name,
"parameterLocation", 8) ) {
165 fscanf ( dataFile,
"%d", ¶meterLocation ) ;
168 if ( !strncmp(name,
"rowInnerMost", 8) ) {
169 fscanf ( dataFile,
"%d", &rowInnerMost ) ;
172 if ( !strncmp(name,
"rowOuterMost", 8) ) {
173 fscanf ( dataFile,
"%d", &rowOuterMost ) ;
176 if ( !strncmp(name,
"rowStart", 8) ) {
177 fscanf ( dataFile,
"%d", &rowStart ) ;
180 if ( !strncmp(name,
"rowEnd", 6) ) {
181 fscanf ( dataFile,
"%d", &rowEnd ) ;
184 if ( !strncmp(name,
"szFitFlag", 8) ) {
185 fscanf ( dataFile,
"%d", &szFitFlag ) ;
188 if ( !strncmp(name,
"bField", 6) ) {
189 fscanf ( dataFile,
"%e", &bField ) ;
192 if ( !strncmp(name,
"maxChi2Primary", 12) ) {
193 fscanf ( dataFile,
"%e", &maxChi2Primary ) ;
196 if ( !strncmp(name,
"hitChi2Cut", 8) ) {
197 fscanf ( dataFile,
"%e", &hitChi2Cut ) ;
200 if ( !strncmp(name,
"goodHitChi2", 8) ) {
201 fscanf ( dataFile,
"%e", &goodHitChi2 ) ;
204 if ( !strncmp(name,
"trackChi2Cut", 8) ) {
205 fscanf ( dataFile,
"%e", &trackChi2Cut ) ;
208 if ( !strncmp(name,
"goodDistance", 8) ) {
209 fscanf ( dataFile,
"%e", &goodDistance ) ;
212 if ( !strncmp(name,
"ptMinHelixFit", 8) ) {
213 fscanf ( dataFile,
"%e", &ptMinHelixFit ) ;
216 if ( !strncmp(name,
"maxDistanceSegment", 15) ) {
217 fscanf ( dataFile,
"%e", &maxDistanceSegment ) ;
220 if ( !strncmp(name,
"xyErrorScale", 10) ) {
221 fscanf ( dataFile,
"%e", &xyErrorScale ) ;
224 if ( !strncmp(name,
"szErrorScale", 10) ) {
225 fscanf ( dataFile,
"%e", &szErrorScale ) ;
228 if ( !strncmp(name,
"xVertex", 7) ) {
229 fscanf ( dataFile,
"%e", &xVertex ) ;
232 if ( !strncmp(name,
"yVertex", 7) ) {
233 fscanf ( dataFile,
"%e", &yVertex ) ;
236 if ( !strncmp(name,
"zVertex", 7) ) {
237 fscanf ( dataFile,
"%e", &zVertex ) ;
240 if ( !strncmp(name,
"dxVertex", 8) ) {
241 fscanf ( dataFile,
"%e", &dxVertex ) ;
244 if ( !strncmp(name,
"dyVertex", 8) ) {
245 fscanf ( dataFile,
"%e", &dyVertex ) ;
248 if ( !strncmp(name,
"xyWeightVertex", 8) ) {
249 fscanf ( dataFile,
"%e", &xyWeightVertex ) ;
252 if ( !strncmp(name,
"phiVertex", 8) ) {
253 fscanf ( dataFile,
"%e", &phiVertex ) ;
256 if ( !strncmp(name,
"rVertex", 7) ) {
257 fscanf ( dataFile,
"%e", &rVertex ) ;
260 if ( !strncmp(name,
"maxTime", 7) ) {
261 fscanf ( dataFile,
"%e", &maxTime ) ;
264 printf (
"FtfPara::read: parameter %s not found \n", name ) ;
266 fscanf ( dataFile,
"%e", &variable ) ;
270 fclose ( dataFile ) ;
274 void FtfPara::write (
char* outputFile ) {
275 FILE* dataFile = fopen( outputFile,
"w");
276 if (dataFile == NULL) {
277 printf (
"FtfPara::write: Error opening output file %s \n ", outputFile ) ;
281 fclose ( dataFile ) ;
284 void FtfPara::write ( FILE* dataFile ) {
286 fprintf ( dataFile,
"infoLevel %10d \n", infoLevel ) ;
287 fprintf ( dataFile,
"segmentRowSearch %10d \n", segmentRowSearchRange ) ;
288 fprintf ( dataFile,
"trackRowSearch %10d \n", trackRowSearchRange ) ;
289 fprintf ( dataFile,
"getErrors %10d \n", getErrors ) ;
290 fprintf ( dataFile,
"fillTracks %10d \n", fillTracks ) ;
291 fprintf ( dataFile,
"ghostFlag %10d \n", ghostFlag ) ;
292 fprintf ( dataFile,
"goBackwards %10d \n", goBackwards ) ;
293 fprintf ( dataFile,
"mergePrimaries %10d \n", mergePrimaries ) ;
294 fprintf ( dataFile,
"minHitsPerTrack %10d \n", minHitsPerTrack ) ;
295 fprintf ( dataFile,
"modRow %10d \n", modRow ) ;
296 fprintf ( dataFile,
"nHitsForSegment %10d \n", nHitsForSegment ) ;
298 fprintf ( dataFile,
"nEta %10d \n", nEta ) ;
299 fprintf ( dataFile,
"nPhi %10d \n", nPhi ) ;
300 fprintf ( dataFile,
"deta %10.2e\n", deta ) ;
301 fprintf ( dataFile,
"dphi %10.2e\n", dphi ) ;
302 fprintf ( dataFile,
"etaMin %10.2e\n", etaMin ) ;
303 fprintf ( dataFile,
"etaMax %10.2e\n", etaMax ) ;
304 fprintf ( dataFile,
"phiMin %10.2e\n", phiMin ) ;
305 fprintf ( dataFile,
"phiMax %10.2e\n", phiMax ) ;
306 fprintf ( dataFile,
"phiShift %10.2e\n", phiShift ) ;
307 fprintf ( dataFile,
"detaMerge %10.2e\n", detaMerge ) ;
308 fprintf ( dataFile,
"distanceMerge %10.2e\n", distanceMerge ) ;
309 fprintf ( dataFile,
"nEtaTrack %10d \n", nEtaTrack ) ;
310 fprintf ( dataFile,
"nPhiTrack %10d \n", nPhiTrack ) ;
311 fprintf ( dataFile,
"etaMinTrack %10.2e\n", etaMinTrack ) ;
312 fprintf ( dataFile,
"etaMaxTrack %10.2e\n", etaMaxTrack ) ;
313 fprintf ( dataFile,
"phiMinTrack %10.2e\n", phiMinTrack ) ;
314 fprintf ( dataFile,
"phiMaxTrack %10.2e\n", phiMaxTrack ) ;
315 fprintf ( dataFile,
"nPrimaryPasses %10d \n", nPrimaryPasses ) ;
316 fprintf ( dataFile,
"nSecondaryPasses %10d \n", nSecondaryPasses ) ;
317 fprintf ( dataFile,
"vertexConstrainedFit %10d \n", vertexConstrainedFit ) ;
318 fprintf ( dataFile,
"parameterLocation %10d \n", parameterLocation ) ;
319 fprintf ( dataFile,
"rowInnerMost %10d \n", rowInnerMost ) ;
320 fprintf ( dataFile,
"rowOuterMost %10d \n", rowOuterMost ) ;
321 fprintf ( dataFile,
"rowStart %10d \n", rowStart ) ;
322 fprintf ( dataFile,
"rowEnd %10d \n", rowEnd ) ;
323 fprintf ( dataFile,
"szFitFlag %10d \n", szFitFlag ) ;
324 fprintf ( dataFile,
"maxChi2Primary %10.2e\n", maxChi2Primary ) ;
325 fprintf ( dataFile,
"bField %10.2e\n", bField ) ;
326 fprintf ( dataFile,
"hitChi2Cut %10.2e\n", hitChi2Cut ) ;
327 fprintf ( dataFile,
"goodHitChi2 %10.2e\n", goodHitChi2 ) ;
328 fprintf ( dataFile,
"trackChi2Cut %10.2e\n", trackChi2Cut ) ;
329 fprintf ( dataFile,
"goodDistance %10.2e\n", goodDistance ) ;
330 fprintf ( dataFile,
"ptMinHelixFit %10.2e\n", ptMinHelixFit ) ;
331 fprintf ( dataFile,
"maxDistanceSegment %10.2e\n", maxDistanceSegment ) ;
332 fprintf ( dataFile,
"xyErrorScale %10.2e\n", xyErrorScale ) ;
333 fprintf ( dataFile,
"szErrorScale %10.2e\n", szErrorScale ) ;
334 fprintf ( dataFile,
"xVertex %10.2e\n", xVertex ) ;
335 fprintf ( dataFile,
"yVertex %10.2e\n", yVertex ) ;
336 fprintf ( dataFile,
"dxVertex %10.2e\n", dxVertex ) ;
337 fprintf ( dataFile,
"dyVertex %10.2e\n", dyVertex ) ;
338 fprintf ( dataFile,
"zVertex %10.2e\n", zVertex ) ;
339 fprintf ( dataFile,
"xyWeightVertex %10.2e\n", xyWeightVertex ) ;
340 fprintf ( dataFile,
"phiVertex %10.2e\n", phiVertex ) ;
341 fprintf ( dataFile,
"rVertex %10.2e\n", rVertex ) ;
342 fprintf ( dataFile,
"maxTime %10.2e\n", maxTime ) ;
345 void FtfPara::setDefaults (
void)
352 goodHitChi2 = 100.F ;
353 trackChi2Cut = 250.F ;
354 maxChi2Primary = 0. ;
355 segmentRowSearchRange = 1 ;
356 trackRowSearchRange = 3 ;
359 minHitsForDedx = 15 ;
360 dphi = 0.10F * modRow ;
361 deta = 0.10F * modRow ;
366 etaMinTrack = -2.2F ;
374 goodDistance = 1.F * modRow ;
377 parameterLocation = 1 ;
378 phiMin = (float)(-0.000001/toDeg) ;
379 phiMinTrack = (float)(-0.000001/toDeg) ;
380 phiMax = (float)(360.2/toDeg) ;
381 phiMaxTrack = (float)(360.2/toDeg) ;
382 maxDistanceSegment = 100.F * modRow ;
383 minHitsPerTrack = 5 ;
384 nHitsForSegment = 2 ;
390 nSecondaryPasses = 0 ;
391 vertexConstrainedFit = 0 ;
396 segmentMaxAngle = 10.F/toDeg ;
398 xyErrorScale = 1.0F ;
399 szErrorScale = 1.0F ;
404 ptMinHelixFit = 0.F ;