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 500 |
29 |
|
30 |
|
31 |
#include <CalibTrk1Event.h> |
32 |
#include <CalibTrk2Event.h> |
33 |
using namespace pamela; |
34 |
//#include <TrkCalib.h> |
35 |
|
36 |
#include <TString.h> |
37 |
#include <TFile.h> |
38 |
#include <TTree.h> |
39 |
|
40 |
|
41 |
#include <fstream> |
42 |
#include <iostream> |
43 |
/** |
44 |
* \brief Struct to pass calibration parameters to F77 routines |
45 |
*/ |
46 |
struct cTrkCalib { |
47 |
|
48 |
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 |
|
54 |
/* 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 |
|
59 |
}; |
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 |
// int good1; |
99 |
int good[12]; |
100 |
int nclstr1; |
101 |
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 |
int totCLlength; |
109 |
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 |
|
119 |
}; |
120 |
// ================================================================== |
121 |
/** |
122 |
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
123 |
*/ |
124 |
struct cTrkLevel2 { |
125 |
// int good2; |
126 |
// int crc[12]; |
127 |
int good[12]; |
128 |
// ---------------------------- |
129 |
int nclsx; |
130 |
int planex[NSINGMAX]; |
131 |
float xs[NSINGMAX][2]; |
132 |
float signlxs[NSINGMAX]; |
133 |
int clsx[NSINGMAX]; |
134 |
// ---------------------------- |
135 |
int nclsy; |
136 |
int planey[NSINGMAX]; |
137 |
float ys[NSINGMAX][2]; |
138 |
float signlys[NSINGMAX]; |
139 |
int clsy[NSINGMAX]; |
140 |
// ---------------------------- |
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 |
int nstep_nt[NTRKMAX]; |
152 |
int xgood_nt[NTRKMAX][6]; |
153 |
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 |
int cltrx[NTRKMAX][6]; |
162 |
int cltry[NTRKMAX][6]; |
163 |
// float bdl[NTRKMAX]; |
164 |
|
165 |
void InitcTrkLevel2(){ |
166 |
|
167 |
// good2 = 0; |
168 |
for(Int_t i=0; i<12 ; i++) |
169 |
// crc[i] = 0; |
170 |
good[i] = 0; |
171 |
// ---------------------------- |
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 |
// bdl[i] = 0; |
191 |
|
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 |
}; |
218 |
// ================================================================== |
219 |
/** |
220 |
* \brief Struct to pass calibration/parameter file paths to F77 routines |
221 |
*/ |
222 |
struct cPath { |
223 |
char path[256]; |
224 |
int pathlen; |
225 |
int error; |
226 |
/** |
227 |
* Fill the struct variables from a TString object |
228 |
*/ |
229 |
void FillWith(TString s){ |
230 |
pathlen = s.Length(); |
231 |
const char *pc = s.Data(); |
232 |
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
233 |
}; |
234 |
|
235 |
}; |
236 |
|
237 |
// ================================================================== |
238 |
/* /\** */ |
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 |
|
261 |
/* }; */ |
262 |
|
263 |
// ================================================================== |
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 |
|
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 |
int trackmode; |
302 |
|
303 |
}; |
304 |
// |
305 |
/** |
306 |
* \Struct for the hough transform variables |
307 |
*/ |
308 |
|
309 |
struct cTrkHough { |
310 |
|
311 |
int ndblt_nt; |
312 |
float alfayz1_nt[NDBLT_MAX_NT]; |
313 |
float alfayz2_nt[NDBLT_MAX_NT]; |
314 |
int db_cloud_nt[NDBLT_MAX_NT]; |
315 |
int ntrpt_nt; |
316 |
float alfaxz1_nt[NTRPT_MAX_NT]; |
317 |
float alfaxz2_nt[NTRPT_MAX_NT]; |
318 |
float alfaxz3_nt[NTRPT_MAX_NT]; |
319 |
int tr_cloud_nt[NTRPT_MAX_NT]; |
320 |
int nclouds_yz_nt; |
321 |
float alfayz1_av_nt[NCLOYZ_MAX]; |
322 |
float alfayz2_av_nt[NCLOYZ_MAX]; |
323 |
int ptcloud_yz_nt[NCLOYZ_MAX]; |
324 |
int nclouds_xz_nt; |
325 |
float alfaxz1_av_nt[NCLOXZ_MAX]; |
326 |
float alfaxz2_av_nt[NCLOXZ_MAX]; |
327 |
float alfaxz3_av_nt[NCLOXZ_MAX]; |
328 |
int ptcloud_xz_nt[NCLOXZ_MAX]; |
329 |
int nclstr; |
330 |
float totaltime; |
331 |
float houghtime; |
332 |
float fittime; |
333 |
|
334 |
|
335 |
void InitcTrkHough(){ |
336 |
|
337 |
ndblt_nt = 0; |
338 |
ntrpt_nt = 0; |
339 |
nclouds_yz_nt = 0; |
340 |
nclouds_xz_nt = 0; |
341 |
nclstr = 0; |
342 |
totaltime = 0; |
343 |
houghtime = 0; |
344 |
fittime = 0; |
345 |
for(int i=0;i<NDBLT_MAX_NT ;i++){ |
346 |
alfayz1_nt[i] = 0; |
347 |
alfayz2_nt[i] = 0; |
348 |
db_cloud_nt[i] = 0; |
349 |
} |
350 |
for(int i=0;i<NTRPT_MAX_NT ;i++){ |
351 |
alfaxz1_nt[i] = 0; |
352 |
alfaxz2_nt[i] = 0; |
353 |
alfaxz3_nt[i] = 0; |
354 |
tr_cloud_nt[i] = 0; |
355 |
} |
356 |
for(int i=0;i<NCLOYZ_MAX ;i++){ |
357 |
alfayz1_av_nt[i] = 0; |
358 |
alfayz2_av_nt[i] = 0; |
359 |
ptcloud_yz_nt[i] = 0; |
360 |
} |
361 |
for(int i=0;i<NCLOXZ_MAX ;i++){ |
362 |
ptcloud_xz_nt[i] = 0; |
363 |
alfaxz1_av_nt[i] = 0; |
364 |
alfaxz2_av_nt[i] = 0; |
365 |
alfaxz3_av_nt[i] = 0; |
366 |
} |
367 |
} |
368 |
|
369 |
}; |
370 |
|
371 |
/** |
372 |
* \brief Struct to pass VA1-mask to F77 routines |
373 |
*/ |
374 |
struct cTrkMask { |
375 |
|
376 |
int mask_vk[NVK][NVIEW]; |
377 |
int mask_vk_run[NVK][NVIEW]; |
378 |
|
379 |
// void Set(TFile* , Int_t , Int_t ); |
380 |
|
381 |
}; |
382 |
|
383 |
/** |
384 |
* \brief Struct for pfa parameters |
385 |
*/ |
386 |
struct cTrkETA { |
387 |
|
388 |
int nangbin; |
389 |
float angL[NANGMAX],angR[NANGMAX]; |
390 |
int netaval; |
391 |
float eta2[NANGMAX][NETAVALMAX]; |
392 |
float feta2[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
393 |
float eta3[NANGMAX][NETAVALMAX]; |
394 |
float feta3[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
395 |
float eta4[NANGMAX][NETAVALMAX]; |
396 |
float feta4[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
397 |
|
398 |
}; |
399 |
|
400 |
extern "C" { |
401 |
|
402 |
extern struct cTrkCalib pedsigbad_; |
403 |
extern struct cTrkMask mask_; |
404 |
extern struct cTrkLevel0 level0event_; |
405 |
extern struct cTrkLevel1 level1event_; |
406 |
extern struct cTrkLevel2 level2event_; |
407 |
extern struct cPath path_; |
408 |
extern struct cDbg dbg_; |
409 |
extern struct cTrkHough houghevent_; |
410 |
extern struct cMini2track track_; |
411 |
extern struct cTrkETA pfa_; |
412 |
|
413 |
void fillpedsigfromdefault_(); |
414 |
int readmipparam_(); |
415 |
int readchargeparam_(); |
416 |
int readvkmask_(); |
417 |
int readalignparam_(); |
418 |
int readetaparam_(); |
419 |
void reductionflight_(int*); |
420 |
int analysisflight_(int*); |
421 |
int readb_(); |
422 |
|
423 |
} |
424 |
|
425 |
#endif |