/[PAMELA software]/DarthVader/TrackerLevel2/inc/TrkStruct.h
ViewVC logotype

Contents of /DarthVader/TrackerLevel2/inc/TrkStruct.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.27 - (show annotations) (download)
Fri Aug 31 14:56:50 2007 UTC (17 years, 3 months ago) by pam-fi
Branch: MAIN
CVS Tags: v4r00
Changes since 1.26: +12 -0 lines
File MIME type: text/plain
new variables added to TrkTrack + other changes

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 Reset(){
55 for(int is=0; is<128; is++){
56 for(int ivk=0; ivk<24; ivk++){
57 for(int iv=0; iv<12; iv++){
58 pedestal[is][ivk][iv]=0.;
59 pedestal_t[is][ivk][iv]=0.;
60 sigma[is][ivk][iv]=0.;
61 sigma_t[is][ivk][iv]=0.;
62 bad[is][ivk][iv]=1;
63 }
64 }
65 }
66 }
67
68 /* void FillACalibFrom(TFile* , Int_t , Int_t ); */
69 /* void FillFCalibFrom(TFile* , Int_t , Int_t ); */
70 /* void FillTCalibFrom(TFile* , Int_t , Int_t ); */
71 /* void FillTCalibFrom(TString); */
72
73 };
74 // ==================================================================
75 /**
76 * \brief Struct to pass tracker LEVEL0 data to F77 routines
77 */
78 struct cTrkLevel0 {
79 int DAQmode[12];
80 int DSPnumber[12];
81 int DATAlength[12];
82 int eventn[12];
83 int nclust[12];
84 int cutc[12];
85 int cutcl[12];
86 int addrcluster[3][12];
87 int signcluster[3][12];
88 int fc[12];
89 int compressiontime[12];
90 int fl5[12];
91 int fl4[12];
92 int fl3[12];
93 int fl2[12];
94 int fl1[12];
95 int fl6[12];
96 int checksum[12];
97 int TOTDATAlength;
98 int datatracker[49152];
99 int pnum[12];
100 int cmdnum[12];
101 int bid[12];
102 int alarm[12];
103 int aswr[12];
104 int good0;
105 int crc[12];
106 };
107 // ==================================================================
108 /**
109 * \brief Struct to pass tracker LEVEL1 data to F77 routines
110 */
111 struct cTrkLevel1 {
112 // int good1;
113 int good[12];
114 int nclstr1;
115 int view[NCLMAX];
116 int ladder[NCLMAX];
117 int maxs[NCLMAX];
118 int mult[NCLMAX];
119 float dedx[NCLMAX];
120 int indstart[NCLMAX];
121 int indmax[NCLMAX];
122 int totCLlength;
123 float clsignal[NCLBUFF];
124 float clsigma[NCLBUFF];
125 int cladc[NCLBUFF];
126 int clbad[NCLBUFF];
127 float cnev[24][12];
128 int cnnev[24][12];
129 float cnrmsev[24][12];
130 int fshower[12];
131 int whichtrack[NCLMAX];
132
133 };
134 // ==================================================================
135 /**
136 * \brief Struct to pass tracker LEVEL2 data to F77 routines
137 */
138 struct cTrkLevel2 {
139 // int good2;
140 // int crc[12];
141 int good[12];
142 int vkflag[24][12];
143 // ----------------------------
144 int nclsx;
145 int planex[NSINGMAX];
146 float xs[NSINGMAX][2];
147 float signlxs[NSINGMAX];
148 int clsx[NSINGMAX];
149 // ----------------------------
150 int nclsy;
151 int planey[NSINGMAX];
152 float ys[NSINGMAX][2];
153 float signlys[NSINGMAX];
154 int clsy[NSINGMAX];
155 // ----------------------------
156 int ntrk;
157 int image[NTRKMAX];
158 float xm_nt[NTRKMAX][6];
159 float ym_nt[NTRKMAX][6];
160 float zm_nt[NTRKMAX][6];
161 float resx_nt[NTRKMAX][6];
162 float resy_nt[NTRKMAX][6];
163 float tailx[NTRKMAX][6];
164 float taily[NTRKMAX][6];
165 float al_nt[NTRKMAX][5];
166 float coval[NTRKMAX][5][5];
167 float chi2_nt[NTRKMAX];
168 int nstep_nt[NTRKMAX];
169 int xgood_nt[NTRKMAX][6];
170 int ygood_nt[NTRKMAX][6];
171 int ls[NTRKMAX][6];
172 int xbad[NTRKMAX][6];
173 int ybad[NTRKMAX][6];
174 float xv_nt[NTRKMAX][6];
175 float yv_nt[NTRKMAX][6];
176 float zv_nt[NTRKMAX][6];
177 float axv_nt[NTRKMAX][6];
178 float ayv_nt[NTRKMAX][6];
179 float dedx_x[NTRKMAX][6];
180 float dedx_y[NTRKMAX][6];
181 int cltrx[NTRKMAX][6];
182 int cltry[NTRKMAX][6];
183 int multmaxx[NTRKMAX][6];
184 int multmaxy[NTRKMAX][6];
185 float seedx[NTRKMAX][6];
186 float seedy[NTRKMAX][6];
187 float xpu[NTRKMAX][6];
188 float ypu[NTRKMAX][6];
189 // float bdl[NTRKMAX];
190
191 void InitcTrkLevel2(){
192
193 // good2 = 0;
194 for(Int_t i=0; i<12 ; i++){
195 good[i] = 0;
196 for(Int_t ii=0; ii<24 ; ii++)vkflag[ii][i]=0;
197 }
198 // ----------------------------
199 nclsx = 0;
200 nclsy = 0;
201 for(Int_t i=0; i<NSINGMAX ; i++){
202 planex[i] = 0;
203 xs[i][0] = 0;
204 xs[i][1] = 0;
205 signlxs[i] = 0;
206 planey[i] = 0;
207 ys[i][0] = 0;
208 ys[i][1] = 0;
209 signlys[i] = 0;
210 }
211 // ----------------------------
212 ntrk =0 ;
213
214 for(Int_t i=0; i<NTRKMAX ; i++){
215 image[i] = 0;
216 chi2_nt[i] = 0;
217 // bdl[i] = 0;
218
219 for(Int_t ii=0; ii<5 ; ii++){
220 al_nt[i][ii] = 0;
221 for(Int_t iii=0; iii<5 ; iii++)
222 coval[i][ii][iii] = 0;
223 }
224
225 for(Int_t ii=0; ii<6 ; ii++){
226 xm_nt[i][ii] = 0;
227 ym_nt[i][ii] = 0;
228 zm_nt[i][ii] = 0;
229 resx_nt[i][ii] = 0;
230 resy_nt[i][ii] = 0;
231 xgood_nt[i][ii] = 0;
232 ygood_nt[i][ii] = 0;
233 xv_nt[i][ii] = 0;
234 yv_nt[i][ii] = 0;
235 zv_nt[i][ii] = 0;
236 axv_nt[i][ii] = 0;
237 ayv_nt[i][ii] = 0;
238 dedx_x[i][ii] = 0;
239 dedx_y[i][ii] = 0;
240 multmaxx[i][ii] = 0;
241 multmaxy[i][ii] = 0;
242 seedx[i][ii] = 0;
243 seedy[i][ii] = 0;
244 xpu[i][ii] = 0;
245 ypu[i][ii] = 0;
246 }
247 }
248 }
249
250 };
251 // ==================================================================
252 /**
253 * \brief Struct to pass calibration/parameter file paths to F77 routines
254 */
255 struct cPath {
256 char path[256];
257 int pathlen;
258 int error;
259 /**
260 * Fill the struct variables from a TString object
261 */
262 void FillWith(TString s){
263 pathlen = s.Length();
264 const char *pc = s.Data();
265 for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++;
266 };
267
268 };
269
270 // ==================================================================
271 /* /\** */
272 /* * \brief Struct to pass magnetic-field file paths to F77 routines */
273 /* *\/ */
274 /* struct cBPath { */
275 /* char b_path[256]; */
276 /* int b_pathlen; */
277 /* int b_error; */
278 /* int b_loaded; */
279 /* /\** */
280 /* * Fill the struct variables from a TString object and set */
281 /* * the load flag to FALSE. */
282 /* *\/ */
283 /* void FillWith(TString s){ */
284 /* b_loaded = 0; */
285 /* b_pathlen = s.Length(); */
286 /* const char *pc = s.Data(); */
287 /* for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; */
288 /* }; */
289 /* /\** */
290 /* * Fill the struct variables from a TString object */
291 /* *\/ */
292 /* int BIsLoaded(){ return b_loaded; }; */
293
294 /* }; */
295
296 // ==================================================================
297 /**
298 * \brief Struct to set debug mode in F77 routines
299 */
300 struct cDbg {
301 int debug;
302 int verbose;
303 int warning;
304 // bool debug;
305 // bool verbose;
306 void SetNone() {debug=0; verbose=0; warning=0;};
307 void SetWarning(){debug=0; verbose=0; warning=1;};
308 void SetVerbose(){debug=0; verbose=1; warning=1;};
309 void SetDebug() {debug=1; verbose=1; warning=1;};
310 };
311
312
313 // ==================================================================
314 /**
315 * \brief Struct to pass mini2 track parameters to F77 routines
316 */
317 struct cMini2track {
318 double al[5];
319 double xm[NPLANE],ym[NPLANE],zm[NPLANE];
320 double xm_a[NPLANE],ym_a[NPLANE];
321 double xm_b[NPLANE],ym_b[NPLANE];
322 double resx[NPLANE],resy[NPLANE];
323 double tailx[NPLANE],taily[NPLANE];
324 double xgood[NPLANE],ygood[NPLANE];
325 double dedxtrk_x[NPLANE];
326 double dedxtrk_y[NPLANE];
327 double zini;
328 double pfixed;
329 double chi2;
330 double xv[NPLANE],yv[NPLANE],zv[NPLANE];
331 double axv[NPLANE],ayv[NPLANE];
332 double cov[5][5];
333 double fact;
334 int nstep;
335 int idcand;
336 int trackmode;
337 int istepmin;
338
339 /* cMini2track(){ */
340 /* // -------------------------- */
341 /* // fitting routine parameters */
342 /* // -------------------------- */
343 /* zini = 23.5; */
344 /* trackmode = 0; */
345 /* istepmin = 3; */
346 /* // -------------------------- */
347 /* pfixed = 0.; */
348 /* chi2 = 0; */
349 /* nstep = 0; */
350 /* for(int it1=0;it1<5;it1++){ */
351 /* al[it1] = 0; */
352 /* for(int it2=0;it2<5;it2++)cov[it1][it2] = 0; */
353 /* }; */
354 /* for(int ip=0;ip<6;ip++){ */
355 /* xgood[ip] = 0; */
356 /* ygood[ip] = 0; */
357 /* xm[ip] = 0; */
358 /* ym[ip] = 0; */
359 /* xm_a[ip] = 0; */
360 /* ym_a[ip] = 0; */
361 /* xm_b[ip] = 0; */
362 /* ym_b[ip] = 0; */
363 /* zm[ip] = 0; */
364 /* resx[ip] = 0; */
365 /* resy[ip] = 0; */
366 /* xv[ip] = 0; */
367 /* yv[ip] = 0; */
368 /* zv[ip] = 0; */
369 /* axv[ip] = 0; */
370 /* ayv[ip] = 0; */
371 /* dedxtrk_x[ip] = 0; */
372 /* dedxtrk_y[ip] = 0; */
373 /* }; */
374
375 /* } */
376
377
378 };
379 //
380 /**
381 * \Struct for the hough transform variables
382 */
383
384 struct cTrkHough {
385
386 int ndblt_nt;
387 float alfayz1_nt[NDBLT_MAX_NT];
388 float alfayz2_nt[NDBLT_MAX_NT];
389 int db_cloud_nt[NDBLT_MAX_NT];
390 int ntrpt_nt;
391 float alfaxz1_nt[NTRPT_MAX_NT];
392 float alfaxz2_nt[NTRPT_MAX_NT];
393 float alfaxz3_nt[NTRPT_MAX_NT];
394 int tr_cloud_nt[NTRPT_MAX_NT];
395 int nclouds_yz_nt;
396 float alfayz1_av_nt[NCLOYZ_MAX];
397 float alfayz2_av_nt[NCLOYZ_MAX];
398 int ptcloud_yz_nt[NCLOYZ_MAX];
399 int nclouds_xz_nt;
400 float alfaxz1_av_nt[NCLOXZ_MAX];
401 float alfaxz2_av_nt[NCLOXZ_MAX];
402 float alfaxz3_av_nt[NCLOXZ_MAX];
403 int ptcloud_xz_nt[NCLOXZ_MAX];
404 int nclstr;
405 float totaltime;
406 float houghtime;
407 float fittime;
408
409
410 void InitcTrkHough(){
411
412 ndblt_nt = 0;
413 ntrpt_nt = 0;
414 nclouds_yz_nt = 0;
415 nclouds_xz_nt = 0;
416 nclstr = 0;
417 totaltime = 0;
418 houghtime = 0;
419 fittime = 0;
420 for(int i=0;i<NDBLT_MAX_NT ;i++){
421 alfayz1_nt[i] = 0;
422 alfayz2_nt[i] = 0;
423 db_cloud_nt[i] = 0;
424 }
425 for(int i=0;i<NTRPT_MAX_NT ;i++){
426 alfaxz1_nt[i] = 0;
427 alfaxz2_nt[i] = 0;
428 alfaxz3_nt[i] = 0;
429 tr_cloud_nt[i] = 0;
430 }
431 for(int i=0;i<NCLOYZ_MAX ;i++){
432 alfayz1_av_nt[i] = 0;
433 alfayz2_av_nt[i] = 0;
434 ptcloud_yz_nt[i] = 0;
435 }
436 for(int i=0;i<NCLOXZ_MAX ;i++){
437 ptcloud_xz_nt[i] = 0;
438 alfaxz1_av_nt[i] = 0;
439 alfaxz2_av_nt[i] = 0;
440 alfaxz3_av_nt[i] = 0;
441 }
442 }
443
444 };
445
446 /**
447 * \brief Struct to pass VA1-mask to F77 routines
448 */
449 struct cTrkMask {
450
451 int mask_vk[NVK][NVIEW];
452 int mask_vk_run[NVK][NVIEW];
453
454 // void Set(TFile* , Int_t , Int_t );
455
456 void Reset(){
457 for(int ivk=0; ivk<NVK; ivk++){
458 for(int iv=0; iv<NVIEW; iv++){
459 // mask_vk[ivk][iv]=0;
460 mask_vk_run[ivk][iv]=0;
461 }
462 }
463 }
464
465 void Dump(){
466 }
467
468 };
469
470 /**
471 * \brief Struct for pfa parameters
472 */
473 struct cTrkETA {
474
475 int nangbin;
476 float angL[NANGMAX],angR[NANGMAX];
477 int netaval;
478 float eta2[NANGMAX][NETAVALMAX];
479 float feta2[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
480 float eta3[NANGMAX][NETAVALMAX];
481 float feta3[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
482 float eta4[NANGMAX][NETAVALMAX];
483 float feta4[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
484 float fcorr[NANGMAX][NLADDER][NVIEW];
485 float e234ax[6];//F77: e2fax,e2tax,e3fax,e3tax,e4fax,e4tax
486 float e234ay[6];//F77: e2fay,e2tay,e3fay,e3tay,e4fay,e4tay
487
488 };
489 /**
490 * \brief Struct to configure data reduction
491 */
492 struct cTrkSW{
493 int pfaid;
494 };
495
496 extern "C" {
497
498 extern struct cTrkCalib pedsigbad_;
499 extern struct cTrkMask mask_;
500 extern struct cTrkLevel0 level0event_;
501 extern struct cTrkLevel1 level1event_;
502 extern struct cTrkLevel2 level2event_;
503 extern struct cPath path_;
504 extern struct cDbg dbg_;
505 extern struct cTrkHough houghevent_;
506 extern struct cMini2track track_;
507 extern struct cTrkETA pfa_;
508 extern struct cTrkSW sw_;
509
510 void fillpedsigfromdefault_();
511 int readmipparam_();
512 int readchargeparam_();
513 int readvkmask_();
514 int readalignparam_();
515 int readetaparam_();
516 void reductionflight_(int*);
517 int analysisflight_();
518 int readb_();
519 void gufld_(float*, float*);
520 void xyzpam_(int*,int*,int*,int*,int*,float*,float*,float*,float*);
521 float riseta_(int*,float*);
522
523 }
524
525 #endif

  ViewVC Help
Powered by ViewVC 1.1.23