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