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