/[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.31 - (show annotations) (download)
Wed Mar 5 17:00:18 2008 UTC (16 years, 9 months ago) by pam-fi
Branch: MAIN
CVS Tags: v5r00
Changes since 1.30: +8 -0 lines
File MIME type: text/plain
modified TrkSinglet, optimized DoTrack2, fixed bug in evaluation of effective angle

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

  ViewVC Help
Powered by ViewVC 1.1.23