1 |
/** |
2 |
* \file TrkStruct.h |
3 |
* \author Elena Vannuccini |
4 |
* \date |
5 |
*/ |
6 |
#ifndef trkstruct_h |
7 |
#define trkstruct_h |
8 |
|
9 |
#define NPLANE 6 |
10 |
#define NVIEW 12 |
11 |
#define NVK 24 |
12 |
#define NLADDER 3 |
13 |
|
14 |
#define NCLMAX_VIEW 200 //max n.clusters per view |
15 |
#define NCLSTR 20 //max n.strip per cluster |
16 |
#define NCLMAX (NCLMAX_VIEW*12) //max n.clusters total |
17 |
#define NCLBUFF (NCLMAX*NCLSTR) |
18 |
|
19 |
#define NDBLT_MAX_NT 1000 // 0.2*ndblt_max |
20 |
#define NTRPT_MAX_NT 10000 // 0.2*ntrpt_max |
21 |
#define NCLOYZ_MAX 200 |
22 |
#define NCLOXZ_MAX 200 |
23 |
|
24 |
#define NTRKMAX 10 |
25 |
#define NSINGMAX NCLMAX //100 |
26 |
|
27 |
#define NANGMAX 21 |
28 |
#define NETAVALMAX 150 |
29 |
|
30 |
|
31 |
//#include <CalibTrk1Event.h> |
32 |
//#include <CalibTrk2Event.h> |
33 |
#include <TrkCalib.h> |
34 |
|
35 |
#include <TString.h> |
36 |
#include <TFile.h> |
37 |
#include <TTree.h> |
38 |
|
39 |
#include <fstream> |
40 |
#include <iostream> |
41 |
/** |
42 |
* \brief Struct to pass calibration parameters to F77 routines |
43 |
*/ |
44 |
struct cTrkCalib { |
45 |
|
46 |
float pedestal[128][24][12]; |
47 |
float pedestal_t[128][24][12]; |
48 |
float sigma[128][24][12]; |
49 |
float sigma_t[128][24][12]; |
50 |
int bad[128][24][12]; |
51 |
|
52 |
void FillACalibFrom(TFile* , Int_t , Int_t ); |
53 |
void FillFCalibFrom(TFile* , Int_t , Int_t ); |
54 |
void FillTCalibFrom(TFile* , Int_t , Int_t ); |
55 |
void FillTCalibFrom(TString); |
56 |
|
57 |
}; |
58 |
// ================================================================== |
59 |
/** |
60 |
* \brief Struct to pass tracker LEVEL0 data to F77 routines |
61 |
*/ |
62 |
struct cTrkLevel0 { |
63 |
int DAQmode[12]; |
64 |
int DSPnumber[12]; |
65 |
int DATAlength[12]; |
66 |
int eventn[12]; |
67 |
int nclust[12]; |
68 |
int cutc[12]; |
69 |
int cutcl[12]; |
70 |
int addrcluster[3][12]; |
71 |
int signcluster[3][12]; |
72 |
int fc[12]; |
73 |
int compressiontime[12]; |
74 |
int fl5[12]; |
75 |
int fl4[12]; |
76 |
int fl3[12]; |
77 |
int fl2[12]; |
78 |
int fl1[12]; |
79 |
int fl6[12]; |
80 |
int checksum[12]; |
81 |
int TOTDATAlength; |
82 |
int datatracker[49152]; |
83 |
int pnum[12]; |
84 |
int cmdnum[12]; |
85 |
int bid[12]; |
86 |
int alarm[12]; |
87 |
int aswr[12]; |
88 |
int good0; |
89 |
int crc[12]; |
90 |
}; |
91 |
// ================================================================== |
92 |
/** |
93 |
* \brief Struct to pass tracker LEVEL1 data to F77 routines |
94 |
*/ |
95 |
struct cTrkLevel1 { |
96 |
// int good1; |
97 |
int good[12]; |
98 |
int nclstr1; |
99 |
int view[NCLMAX]; |
100 |
int ladder[NCLMAX]; |
101 |
int maxs[NCLMAX]; |
102 |
int mult[NCLMAX]; |
103 |
float dedx[NCLMAX]; |
104 |
int indstart[NCLMAX]; |
105 |
int indmax[NCLMAX]; |
106 |
int totCLlength; |
107 |
float clsignal[NCLBUFF]; |
108 |
float clsigma[NCLBUFF]; |
109 |
int cladc[NCLBUFF]; |
110 |
int clbad[NCLBUFF]; |
111 |
float cnev[24][12]; |
112 |
int cnnev[24][12]; |
113 |
float cnrmsev[24][12]; |
114 |
int fshower[12]; |
115 |
int whichtrack[NCLMAX]; |
116 |
}; |
117 |
// ================================================================== |
118 |
/** |
119 |
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
120 |
*/ |
121 |
struct cTrkLevel2 { |
122 |
// int good2; |
123 |
// int crc[12]; |
124 |
int good[12]; |
125 |
// ---------------------------- |
126 |
int nclsx; |
127 |
int planex[NSINGMAX]; |
128 |
float xs[NSINGMAX][2]; |
129 |
float signlxs[NSINGMAX]; |
130 |
int clsx[NSINGMAX]; |
131 |
// ---------------------------- |
132 |
int nclsy; |
133 |
int planey[NSINGMAX]; |
134 |
float ys[NSINGMAX][2]; |
135 |
float signlys[NSINGMAX]; |
136 |
int clsy[NSINGMAX]; |
137 |
// ---------------------------- |
138 |
int ntrk; |
139 |
int image[NTRKMAX]; |
140 |
float xm_nt[NTRKMAX][6]; |
141 |
float ym_nt[NTRKMAX][6]; |
142 |
float zm_nt[NTRKMAX][6]; |
143 |
float resx_nt[NTRKMAX][6]; |
144 |
float resy_nt[NTRKMAX][6]; |
145 |
float al_nt[NTRKMAX][5]; |
146 |
float coval[NTRKMAX][5][5]; |
147 |
float chi2_nt[NTRKMAX]; |
148 |
int nstep_nt[NTRKMAX]; |
149 |
int xgood_nt[NTRKMAX][6]; |
150 |
int ygood_nt[NTRKMAX][6]; |
151 |
float xv_nt[NTRKMAX][6]; |
152 |
float yv_nt[NTRKMAX][6]; |
153 |
float zv_nt[NTRKMAX][6]; |
154 |
float axv_nt[NTRKMAX][6]; |
155 |
float ayv_nt[NTRKMAX][6]; |
156 |
float dedx_x[NTRKMAX][6]; |
157 |
float dedx_y[NTRKMAX][6]; |
158 |
int cltrx[NTRKMAX][6]; |
159 |
int cltry[NTRKMAX][6]; |
160 |
// float bdl[NTRKMAX]; |
161 |
|
162 |
void InitcTrkLevel2(){ |
163 |
|
164 |
// good2 = 0; |
165 |
for(Int_t i=0; i<12 ; i++) |
166 |
// crc[i] = 0; |
167 |
good[i] = 0; |
168 |
// ---------------------------- |
169 |
nclsx = 0; |
170 |
nclsy = 0; |
171 |
for(Int_t i=0; i<NSINGMAX ; i++){ |
172 |
planex[i] = 0; |
173 |
xs[i][0] = 0; |
174 |
xs[i][1] = 0; |
175 |
signlxs[i] = 0; |
176 |
planey[i] = 0; |
177 |
ys[i][0] = 0; |
178 |
ys[i][1] = 0; |
179 |
signlys[i] = 0; |
180 |
} |
181 |
// ---------------------------- |
182 |
ntrk =0 ; |
183 |
|
184 |
for(Int_t i=0; i<NTRKMAX ; i++){ |
185 |
image[i] = 0; |
186 |
chi2_nt[i] = 0; |
187 |
// bdl[i] = 0; |
188 |
|
189 |
for(Int_t ii=0; ii<5 ; ii++){ |
190 |
al_nt[i][ii] = 0; |
191 |
for(Int_t iii=0; iii<5 ; iii++) |
192 |
coval[i][ii][iii] = 0; |
193 |
} |
194 |
|
195 |
for(Int_t ii=0; ii<6 ; ii++){ |
196 |
xm_nt[i][ii] = 0; |
197 |
ym_nt[i][ii] = 0; |
198 |
zm_nt[i][ii] = 0; |
199 |
resx_nt[i][ii] = 0; |
200 |
resy_nt[i][ii] = 0; |
201 |
xgood_nt[i][ii] = 0; |
202 |
ygood_nt[i][ii] = 0; |
203 |
xv_nt[i][ii] = 0; |
204 |
yv_nt[i][ii] = 0; |
205 |
zv_nt[i][ii] = 0; |
206 |
axv_nt[i][ii] = 0; |
207 |
ayv_nt[i][ii] = 0; |
208 |
dedx_x[i][ii] = 0; |
209 |
dedx_y[i][ii] = 0; |
210 |
} |
211 |
} |
212 |
} |
213 |
|
214 |
}; |
215 |
// ================================================================== |
216 |
/** |
217 |
* \brief Struct to pass calibration/parameter file paths to F77 routines |
218 |
*/ |
219 |
struct cPath { |
220 |
char path[256]; |
221 |
int pathlen; |
222 |
int error; |
223 |
/** |
224 |
* Fill the struct variables from a TString object |
225 |
*/ |
226 |
void FillWith(TString s){ |
227 |
pathlen = s.Length(); |
228 |
const char *pc = s.Data(); |
229 |
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
230 |
}; |
231 |
|
232 |
}; |
233 |
|
234 |
// ================================================================== |
235 |
/* /\** */ |
236 |
/* * \brief Struct to pass magnetic-field file paths to F77 routines */ |
237 |
/* *\/ */ |
238 |
/* struct cBPath { */ |
239 |
/* char b_path[256]; */ |
240 |
/* int b_pathlen; */ |
241 |
/* int b_error; */ |
242 |
/* int b_loaded; */ |
243 |
/* /\** */ |
244 |
/* * Fill the struct variables from a TString object and set */ |
245 |
/* * the load flag to FALSE. */ |
246 |
/* *\/ */ |
247 |
/* void FillWith(TString s){ */ |
248 |
/* b_loaded = 0; */ |
249 |
/* b_pathlen = s.Length(); */ |
250 |
/* const char *pc = s.Data(); */ |
251 |
/* for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; */ |
252 |
/* }; */ |
253 |
/* /\** */ |
254 |
/* * Fill the struct variables from a TString object */ |
255 |
/* *\/ */ |
256 |
/* int BIsLoaded(){ return b_loaded; }; */ |
257 |
|
258 |
/* }; */ |
259 |
|
260 |
// ================================================================== |
261 |
/** |
262 |
* \brief Struct to set debug mode in F77 routines |
263 |
*/ |
264 |
struct cDbg { |
265 |
int debug; |
266 |
int verbose; |
267 |
int warning; |
268 |
// bool debug; |
269 |
// bool verbose; |
270 |
void SetNone() {debug=0; verbose=0; warning=0;}; |
271 |
void SetWarning(){debug=0; verbose=0; warning=1;}; |
272 |
void SetVerbose(){debug=0; verbose=1; warning=1;}; |
273 |
void SetDebug() {debug=1; verbose=1; warning=1;}; |
274 |
}; |
275 |
|
276 |
|
277 |
// ================================================================== |
278 |
/** |
279 |
* \brief Struct to pass mini2 track parameters to F77 routines |
280 |
*/ |
281 |
struct cMini2track { |
282 |
double al[5]; |
283 |
double xm[NPLANE],ym[NPLANE],zm[NPLANE]; |
284 |
double xm_a[NPLANE],ym_a[NPLANE]; |
285 |
double xm_b[NPLANE],ym_b[NPLANE]; |
286 |
double resx[NPLANE],resy[NPLANE]; |
287 |
double xgood[NPLANE],ygood[NPLANE]; |
288 |
double dedxtrk_x[NPLANE]; |
289 |
double dedxtrk_y[NPLANE]; |
290 |
double zini; |
291 |
double pfixed; |
292 |
double chi2; |
293 |
double xv[NPLANE],yv[NPLANE],zv[NPLANE]; |
294 |
double axv[NPLANE],ayv[NPLANE]; |
295 |
double cov[5][5]; |
296 |
int nstep; |
297 |
int idcand; |
298 |
|
299 |
}; |
300 |
// |
301 |
/** |
302 |
* \Struct for the hough transform variables |
303 |
*/ |
304 |
|
305 |
struct cTrkHough { |
306 |
|
307 |
int ndblt_nt; |
308 |
float alfayz1_nt[NDBLT_MAX_NT]; |
309 |
float alfayz2_nt[NDBLT_MAX_NT]; |
310 |
int db_cloud_nt[NDBLT_MAX_NT]; |
311 |
int ntrpt_nt; |
312 |
float alfaxz1_nt[NTRPT_MAX_NT]; |
313 |
float alfaxz2_nt[NTRPT_MAX_NT]; |
314 |
float alfaxz3_nt[NTRPT_MAX_NT]; |
315 |
int tr_cloud_nt[NTRPT_MAX_NT]; |
316 |
int nclouds_yz_nt; |
317 |
float alfayz1_av_nt[NCLOYZ_MAX]; |
318 |
float alfayz2_av_nt[NCLOYZ_MAX]; |
319 |
int ptcloud_yz_nt[NCLOYZ_MAX]; |
320 |
int nclouds_xz_nt; |
321 |
float alfaxz1_av_nt[NCLOXZ_MAX]; |
322 |
float alfaxz2_av_nt[NCLOXZ_MAX]; |
323 |
float alfaxz3_av_nt[NCLOXZ_MAX]; |
324 |
int ptcloud_xz_nt[NCLOXZ_MAX]; |
325 |
int nclstr; |
326 |
float totaltime; |
327 |
float houghtime; |
328 |
float fittime; |
329 |
|
330 |
|
331 |
void InitcTrkHough(){ |
332 |
|
333 |
ndblt_nt = 0; |
334 |
ntrpt_nt = 0; |
335 |
nclouds_yz_nt = 0; |
336 |
nclouds_xz_nt = 0; |
337 |
nclstr = 0; |
338 |
totaltime = 0; |
339 |
houghtime = 0; |
340 |
fittime = 0; |
341 |
for(int i=0;i<NDBLT_MAX_NT ;i++){ |
342 |
alfayz1_nt[i] = 0; |
343 |
alfayz2_nt[i] = 0; |
344 |
db_cloud_nt[i] = 0; |
345 |
} |
346 |
for(int i=0;i<NTRPT_MAX_NT ;i++){ |
347 |
alfaxz1_nt[i] = 0; |
348 |
alfaxz2_nt[i] = 0; |
349 |
alfaxz3_nt[i] = 0; |
350 |
tr_cloud_nt[i] = 0; |
351 |
} |
352 |
for(int i=0;i<NCLOYZ_MAX ;i++){ |
353 |
alfayz1_av_nt[i] = 0; |
354 |
alfayz2_av_nt[i] = 0; |
355 |
ptcloud_yz_nt[i] = 0; |
356 |
} |
357 |
for(int i=0;i<NCLOXZ_MAX ;i++){ |
358 |
ptcloud_xz_nt[i] = 0; |
359 |
alfaxz1_av_nt[i] = 0; |
360 |
alfaxz2_av_nt[i] = 0; |
361 |
alfaxz3_av_nt[i] = 0; |
362 |
} |
363 |
} |
364 |
|
365 |
}; |
366 |
|
367 |
/** |
368 |
* \brief Struct to pass VA1-mask to F77 routines |
369 |
*/ |
370 |
struct cTrkMask { |
371 |
|
372 |
int mask_vk[NVK][NVIEW]; |
373 |
int mask_vk_run[NVK][NVIEW]; |
374 |
|
375 |
void Set(TFile* , Int_t , Int_t ); |
376 |
|
377 |
}; |
378 |
|
379 |
/** |
380 |
* \brief Struct for pfa parameters |
381 |
*/ |
382 |
struct cTrkETA { |
383 |
|
384 |
int nangbin; |
385 |
float angL[NANGMAX],angR[NANGMAX]; |
386 |
int netaval; |
387 |
float eta2[NANGMAX][NETAVALMAX]; |
388 |
float feta2[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
389 |
float eta3[NANGMAX][NETAVALMAX]; |
390 |
float feta3[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
391 |
float eta4[NANGMAX][NETAVALMAX]; |
392 |
float feta4[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
393 |
|
394 |
}; |
395 |
|
396 |
extern "C" { |
397 |
|
398 |
extern struct cTrkCalib pedsigbad_; |
399 |
extern struct cTrkLevel0 level0event_; |
400 |
extern struct cTrkLevel1 level1event_; |
401 |
extern struct cTrkLevel2 level2event_; |
402 |
extern struct cPath path_; |
403 |
/* extern struct cBPath bpath_; */ |
404 |
extern struct cDbg dbg_; |
405 |
extern struct cTrkHough houghevent_; |
406 |
extern struct cMini2track track_; |
407 |
extern struct cTrkMask mask_; |
408 |
extern struct cTrkETA pfa_; |
409 |
|
410 |
void fillpedsigfromdefault_(); |
411 |
int readmipparam_(); |
412 |
int readchargeparam_(); |
413 |
int readvkmask_(); |
414 |
int readalignparam_(); |
415 |
int readetaparam_(); |
416 |
void reductionflight_(int*); |
417 |
int analysisflight_(); |
418 |
} |
419 |
|
420 |
|
421 |
#endif |
422 |
|