/[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.32 - (show annotations) (download)
Fri Apr 11 13:44:36 2008 UTC (16 years, 7 months ago) by pam-fi
Branch: MAIN
Changes since 1.31: +18 -3 lines
File MIME type: text/plain
...

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

  ViewVC Help
Powered by ViewVC 1.1.23