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