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 |
|
|
|
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 |
mocchiut |
1.1 |
#define NTRKMAX 10 |
22 |
pam-fi |
1.9 |
#define NSINGMAX NCLMAX //100 |
23 |
mocchiut |
1.1 |
|
24 |
pam-fi |
1.5 |
|
25 |
pam-fi |
1.8 |
|
26 |
pam-fi |
1.2 |
#include <CalibTrk1Event.h> |
27 |
|
|
#include <CalibTrk2Event.h> |
28 |
|
|
|
29 |
mocchiut |
1.1 |
#include <TString.h> |
30 |
|
|
#include <TFile.h> |
31 |
pam-fi |
1.2 |
#include <TTree.h> |
32 |
mocchiut |
1.1 |
|
33 |
pam-fi |
1.2 |
#include <fstream> |
34 |
|
|
#include <iostream> |
35 |
mocchiut |
1.1 |
/** |
36 |
pam-fi |
1.2 |
* \brief Struct to pass calibration parameters to F77 routines |
37 |
mocchiut |
1.1 |
*/ |
38 |
pam-fi |
1.2 |
struct cTrkCalib { |
39 |
|
|
|
40 |
mocchiut |
1.1 |
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 |
pam-fi |
1.2 |
|
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 |
mocchiut |
1.1 |
}; |
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 |
pam-fi |
1.6 |
// int good1; |
91 |
pam-fi |
1.8 |
int good[12]; |
92 |
mocchiut |
1.1 |
int nclstr1; |
93 |
pam-fi |
1.8 |
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 |
mocchiut |
1.1 |
int totCLlength; |
101 |
pam-fi |
1.8 |
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 |
mocchiut |
1.1 |
}; |
111 |
|
|
// ================================================================== |
112 |
|
|
/** |
113 |
|
|
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
114 |
|
|
*/ |
115 |
|
|
struct cTrkLevel2 { |
116 |
pam-fi |
1.6 |
// int good2; |
117 |
|
|
// int crc[12]; |
118 |
|
|
int good[12]; |
119 |
mocchiut |
1.1 |
// ---------------------------- |
120 |
|
|
int nclsx; |
121 |
|
|
int planex[NSINGMAX]; |
122 |
|
|
float xs[NSINGMAX][2]; |
123 |
|
|
float signlxs[NSINGMAX]; |
124 |
pam-fi |
1.8 |
int clsx[NSINGMAX]; |
125 |
mocchiut |
1.1 |
// ---------------------------- |
126 |
|
|
int nclsy; |
127 |
|
|
int planey[NSINGMAX]; |
128 |
|
|
float ys[NSINGMAX][2]; |
129 |
|
|
float signlys[NSINGMAX]; |
130 |
pam-fi |
1.8 |
int clsy[NSINGMAX]; |
131 |
mocchiut |
1.1 |
// ---------------------------- |
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 |
pam-fi |
1.8 |
int nstep_nt[NTRKMAX]; |
143 |
|
|
int xgood_nt[NTRKMAX][6]; |
144 |
mocchiut |
1.1 |
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 |
pam-fi |
1.8 |
int cltrx[NTRKMAX][6]; |
153 |
|
|
int cltry[NTRKMAX][6]; |
154 |
pam-fi |
1.5 |
// float bdl[NTRKMAX]; |
155 |
pam-fi |
1.3 |
|
156 |
|
|
void InitcTrkLevel2(){ |
157 |
|
|
|
158 |
pam-fi |
1.6 |
// good2 = 0; |
159 |
pam-fi |
1.3 |
for(Int_t i=0; i<12 ; i++) |
160 |
pam-fi |
1.6 |
// crc[i] = 0; |
161 |
|
|
good[i] = 0; |
162 |
pam-fi |
1.3 |
// ---------------------------- |
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 |
pam-fi |
1.5 |
// bdl[i] = 0; |
182 |
pam-fi |
1.3 |
|
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 |
mocchiut |
1.1 |
}; |
209 |
|
|
// ================================================================== |
210 |
|
|
/** |
211 |
|
|
* \brief Struct to pass calibration/parameter file paths to F77 routines |
212 |
|
|
*/ |
213 |
|
|
struct cPath { |
214 |
pam-fi |
1.8 |
char path[256]; |
215 |
mocchiut |
1.1 |
int pathlen; |
216 |
pam-fi |
1.2 |
int error; |
217 |
mocchiut |
1.1 |
/** |
218 |
|
|
* Fill the struct variables from a TString object |
219 |
|
|
*/ |
220 |
|
|
void FillWith(TString s){ |
221 |
pam-fi |
1.2 |
pathlen = s.Length(); |
222 |
|
|
const char *pc = s.Data(); |
223 |
|
|
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
224 |
mocchiut |
1.1 |
}; |
225 |
pam-fi |
1.11 |
|
226 |
mocchiut |
1.1 |
}; |
227 |
|
|
|
228 |
|
|
// ================================================================== |
229 |
pam-fi |
1.11 |
/* /\** */ |
230 |
|
|
/* * \brief Struct to pass magnetic-field file paths to F77 routines */ |
231 |
|
|
/* *\/ */ |
232 |
|
|
/* struct cBPath { */ |
233 |
|
|
/* char b_path[256]; */ |
234 |
|
|
/* int b_pathlen; */ |
235 |
|
|
/* int b_error; */ |
236 |
|
|
/* int b_loaded; */ |
237 |
|
|
/* /\** */ |
238 |
|
|
/* * Fill the struct variables from a TString object and set */ |
239 |
|
|
/* * the load flag to FALSE. */ |
240 |
|
|
/* *\/ */ |
241 |
|
|
/* void FillWith(TString s){ */ |
242 |
|
|
/* b_loaded = 0; */ |
243 |
|
|
/* b_pathlen = s.Length(); */ |
244 |
|
|
/* const char *pc = s.Data(); */ |
245 |
|
|
/* for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; */ |
246 |
|
|
/* }; */ |
247 |
|
|
/* /\** */ |
248 |
|
|
/* * Fill the struct variables from a TString object */ |
249 |
|
|
/* *\/ */ |
250 |
|
|
/* int BIsLoaded(){ return b_loaded; }; */ |
251 |
mocchiut |
1.1 |
|
252 |
pam-fi |
1.11 |
/* }; */ |
253 |
mocchiut |
1.1 |
|
254 |
pam-fi |
1.2 |
// ================================================================== |
255 |
|
|
/** |
256 |
|
|
* \brief Struct to set debug mode in F77 routines |
257 |
|
|
*/ |
258 |
|
|
struct cDbg { |
259 |
|
|
int debug; |
260 |
|
|
int verbose; |
261 |
|
|
int warning; |
262 |
|
|
// bool debug; |
263 |
|
|
// bool verbose; |
264 |
|
|
void SetNone() {debug=0; verbose=0; warning=0;}; |
265 |
|
|
void SetWarning(){debug=0; verbose=0; warning=1;}; |
266 |
|
|
void SetVerbose(){debug=0; verbose=1; warning=1;}; |
267 |
|
|
void SetDebug() {debug=1; verbose=1; warning=1;}; |
268 |
|
|
}; |
269 |
|
|
|
270 |
pam-fi |
1.8 |
|
271 |
|
|
// ================================================================== |
272 |
|
|
/** |
273 |
|
|
* \brief Struct to pass mini2 track parameters to F77 routines |
274 |
|
|
*/ |
275 |
|
|
struct cMini2track { |
276 |
|
|
double al[5]; |
277 |
|
|
double xm[NPLANE],ym[NPLANE],zm[NPLANE]; |
278 |
|
|
double xm_a[NPLANE],ym_a[NPLANE]; |
279 |
|
|
double xm_b[NPLANE],ym_b[NPLANE]; |
280 |
|
|
double resx[NPLANE],resy[NPLANE]; |
281 |
|
|
double xgood[NPLANE],ygood[NPLANE]; |
282 |
|
|
double dedxtrk_x[NPLANE]; |
283 |
|
|
double dedxtrk_y[NPLANE]; |
284 |
|
|
double zini; |
285 |
|
|
double pfixed; |
286 |
|
|
double chi2; |
287 |
|
|
double xv[NPLANE],yv[NPLANE],zv[NPLANE]; |
288 |
|
|
double axv[NPLANE],ayv[NPLANE]; |
289 |
|
|
double cov[5][5]; |
290 |
|
|
int nstep; |
291 |
|
|
int idcand; |
292 |
|
|
}; |
293 |
|
|
// |
294 |
pam-fi |
1.9 |
/** |
295 |
|
|
* \Struct for the hough transform variables |
296 |
|
|
*/ |
297 |
|
|
|
298 |
|
|
struct cTrkHough { |
299 |
|
|
|
300 |
pam-fi |
1.12 |
int ndblt_nt; |
301 |
|
|
float alfayz1_nt[NDBLT_MAX_NT]; |
302 |
|
|
float alfayz2_nt[NDBLT_MAX_NT]; |
303 |
|
|
int db_cloud_nt[NDBLT_MAX_NT]; |
304 |
|
|
int ntrpt_nt; |
305 |
|
|
float alfaxz1_nt[NTRPT_MAX_NT]; |
306 |
|
|
float alfaxz2_nt[NTRPT_MAX_NT]; |
307 |
|
|
float alfaxz3_nt[NTRPT_MAX_NT]; |
308 |
|
|
int tr_cloud_nt[NTRPT_MAX_NT]; |
309 |
|
|
int nclouds_yz_nt; |
310 |
|
|
float alfayz1_av_nt[NCLOYZ_MAX]; |
311 |
|
|
float alfayz2_av_nt[NCLOYZ_MAX]; |
312 |
|
|
int ptcloud_yz_nt[NCLOYZ_MAX]; |
313 |
|
|
int nclouds_xz_nt; |
314 |
|
|
float alfaxz1_av_nt[NCLOXZ_MAX]; |
315 |
|
|
float alfaxz2_av_nt[NCLOXZ_MAX]; |
316 |
|
|
float alfaxz3_av_nt[NCLOXZ_MAX]; |
317 |
|
|
int ptcloud_xz_nt[NCLOXZ_MAX]; |
318 |
pam-fi |
1.9 |
int nclstr; |
319 |
|
|
float totaltime; |
320 |
|
|
float houghtime; |
321 |
|
|
float fittime; |
322 |
|
|
|
323 |
|
|
|
324 |
|
|
void InitcTrkHough(){ |
325 |
|
|
|
326 |
pam-fi |
1.12 |
ndblt_nt = 0; |
327 |
|
|
ntrpt_nt = 0; |
328 |
|
|
nclouds_yz_nt = 0; |
329 |
|
|
nclouds_xz_nt = 0; |
330 |
pam-fi |
1.9 |
nclstr = 0; |
331 |
|
|
totaltime = 0; |
332 |
|
|
houghtime = 0; |
333 |
|
|
fittime = 0; |
334 |
|
|
for(int i=0;i<NDBLT_MAX_NT ;i++){ |
335 |
pam-fi |
1.12 |
alfayz1_nt[i] = 0; |
336 |
|
|
alfayz2_nt[i] = 0; |
337 |
|
|
db_cloud_nt[i] = 0; |
338 |
pam-fi |
1.9 |
} |
339 |
|
|
for(int i=0;i<NTRPT_MAX_NT ;i++){ |
340 |
pam-fi |
1.12 |
alfaxz1_nt[i] = 0; |
341 |
|
|
alfaxz2_nt[i] = 0; |
342 |
|
|
alfaxz3_nt[i] = 0; |
343 |
|
|
tr_cloud_nt[i] = 0; |
344 |
pam-fi |
1.9 |
} |
345 |
|
|
for(int i=0;i<NCLOYZ_MAX ;i++){ |
346 |
pam-fi |
1.12 |
alfayz1_av_nt[i] = 0; |
347 |
|
|
alfayz2_av_nt[i] = 0; |
348 |
|
|
ptcloud_yz_nt[i] = 0; |
349 |
pam-fi |
1.9 |
} |
350 |
|
|
for(int i=0;i<NCLOXZ_MAX ;i++){ |
351 |
pam-fi |
1.12 |
ptcloud_xz_nt[i] = 0; |
352 |
|
|
alfaxz1_av_nt[i] = 0; |
353 |
|
|
alfaxz2_av_nt[i] = 0; |
354 |
|
|
alfaxz3_av_nt[i] = 0; |
355 |
pam-fi |
1.9 |
} |
356 |
|
|
} |
357 |
|
|
|
358 |
|
|
}; |
359 |
pam-fi |
1.8 |
|
360 |
|
|
|
361 |
pam-fi |
1.2 |
extern "C" { |
362 |
pam-fi |
1.8 |
|
363 |
pam-fi |
1.9 |
extern struct cTrkCalib pedsigbad_; |
364 |
|
|
extern struct cTrkLevel0 level0event_; |
365 |
|
|
extern struct cTrkLevel1 level1event_; |
366 |
|
|
extern struct cTrkLevel2 level2event_; |
367 |
|
|
extern struct cPath path_; |
368 |
pam-fi |
1.11 |
/* extern struct cBPath bpath_; */ |
369 |
pam-fi |
1.9 |
extern struct cDbg dbg_; |
370 |
pam-fi |
1.12 |
extern struct cTrkHough houghevent_; |
371 |
pam-fi |
1.8 |
extern struct cMini2track track_; |
372 |
pam-fi |
1.7 |
|
373 |
pam-fi |
1.2 |
void fillpedsigfromdefault_(); |
374 |
|
|
int readmipparam_(); |
375 |
|
|
int readchargeparam_(); |
376 |
|
|
int readvkmask_(); |
377 |
|
|
int readalignparam_(); |
378 |
|
|
int readetaparam_(); |
379 |
|
|
void reductionflight_(int*); |
380 |
|
|
int analysisflight_(); |
381 |
|
|
} |
382 |
|
|
|
383 |
mocchiut |
1.1 |
|
384 |
|
|
#endif |
385 |
|
|
|