/[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.29 - (show annotations) (download)
Tue Nov 27 11:43:49 2007 UTC (17 years ago) by pam-fi
Branch: MAIN
Changes since 1.28: +12 -0 lines
File MIME type: text/plain
implemented m.field deformation, for alignment purpouse

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 // ----------------------------
152 int nclsy;
153 int planey[NSINGMAX];
154 float ys[NSINGMAX][2];
155 float signlys[NSINGMAX];
156 int clsy[NSINGMAX];
157 // ----------------------------
158 int ntrk;
159 int image[NTRKMAX];
160 float xm_nt[NTRKMAX][6];
161 float ym_nt[NTRKMAX][6];
162 float zm_nt[NTRKMAX][6];
163 float resx_nt[NTRKMAX][6];
164 float resy_nt[NTRKMAX][6];
165 float tailx[NTRKMAX][6];
166 float taily[NTRKMAX][6];
167 float al_nt[NTRKMAX][5];
168 float coval[NTRKMAX][5][5];
169 float chi2_nt[NTRKMAX];
170 int nstep_nt[NTRKMAX];
171 int xgood_nt[NTRKMAX][6];
172 int ygood_nt[NTRKMAX][6];
173 int ls[NTRKMAX][6];
174 int xbad[NTRKMAX][6];
175 int ybad[NTRKMAX][6];
176 float xv_nt[NTRKMAX][6];
177 float yv_nt[NTRKMAX][6];
178 float zv_nt[NTRKMAX][6];
179 float axv_nt[NTRKMAX][6];
180 float ayv_nt[NTRKMAX][6];
181 float dedx_x[NTRKMAX][6];
182 float dedx_y[NTRKMAX][6];
183 int cltrx[NTRKMAX][6];
184 int cltry[NTRKMAX][6];
185 int multmaxx[NTRKMAX][6];
186 int multmaxy[NTRKMAX][6];
187 float seedx[NTRKMAX][6];
188 float seedy[NTRKMAX][6];
189 float xpu[NTRKMAX][6];
190 float ypu[NTRKMAX][6];
191 // float bdl[NTRKMAX];
192
193 void InitcTrkLevel2(){
194
195 // good2 = 0;
196 for(Int_t i=0; i<12 ; i++){
197 good[i] = 0;
198 for(Int_t ii=0; ii<24 ; ii++)vkflag[ii][i]=0;
199 }
200 // ----------------------------
201 nclsx = 0;
202 nclsy = 0;
203 for(Int_t i=0; i<NSINGMAX ; i++){
204 planex[i] = 0;
205 xs[i][0] = 0;
206 xs[i][1] = 0;
207 signlxs[i] = 0;
208 planey[i] = 0;
209 ys[i][0] = 0;
210 ys[i][1] = 0;
211 signlys[i] = 0;
212 }
213 // ----------------------------
214 ntrk =0 ;
215
216 for(Int_t i=0; i<NTRKMAX ; i++){
217 image[i] = 0;
218 chi2_nt[i] = 0;
219 // bdl[i] = 0;
220
221 for(Int_t ii=0; ii<5 ; ii++){
222 al_nt[i][ii] = 0;
223 for(Int_t iii=0; iii<5 ; iii++)
224 coval[i][ii][iii] = 0;
225 }
226
227 for(Int_t ii=0; ii<6 ; ii++){
228 xm_nt[i][ii] = 0;
229 ym_nt[i][ii] = 0;
230 zm_nt[i][ii] = 0;
231 resx_nt[i][ii] = 0;
232 resy_nt[i][ii] = 0;
233 xgood_nt[i][ii] = 0;
234 ygood_nt[i][ii] = 0;
235 xv_nt[i][ii] = 0;
236 yv_nt[i][ii] = 0;
237 zv_nt[i][ii] = 0;
238 axv_nt[i][ii] = 0;
239 ayv_nt[i][ii] = 0;
240 dedx_x[i][ii] = 0;
241 dedx_y[i][ii] = 0;
242 multmaxx[i][ii] = 0;
243 multmaxy[i][ii] = 0;
244 seedx[i][ii] = 0;
245 seedy[i][ii] = 0;
246 xpu[i][ii] = 0;
247 ypu[i][ii] = 0;
248 }
249 }
250 }
251
252 };
253 // ==================================================================
254 /**
255 * \brief Struct to pass calibration/parameter file paths to F77 routines
256 */
257 struct cPath {
258 char path[256];
259 int pathlen;
260 int error;
261 /**
262 * Fill the struct variables from a TString object
263 */
264 void FillWith(TString s){
265 pathlen = s.Length();
266 const char *pc = s.Data();
267 for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++;
268 };
269
270 };
271
272 // ==================================================================
273 /* /\** */
274 /* * \brief Struct to pass magnetic-field file paths to F77 routines */
275 /* *\/ */
276 /* struct cBPath { */
277 /* char b_path[256]; */
278 /* int b_pathlen; */
279 /* int b_error; */
280 /* int b_loaded; */
281 /* /\** */
282 /* * Fill the struct variables from a TString object and set */
283 /* * the load flag to FALSE. */
284 /* *\/ */
285 /* void FillWith(TString s){ */
286 /* b_loaded = 0; */
287 /* b_pathlen = s.Length(); */
288 /* const char *pc = s.Data(); */
289 /* for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; */
290 /* }; */
291 /* /\** */
292 /* * Fill the struct variables from a TString object */
293 /* *\/ */
294 /* int BIsLoaded(){ return b_loaded; }; */
295
296 /* }; */
297
298 // ==================================================================
299 /**
300 * \brief Struct to set debug mode in F77 routines
301 */
302 struct cDbg {
303 int debug;
304 int verbose;
305 int warning;
306 // bool debug;
307 // bool verbose;
308 void SetNone() {debug=0; verbose=0; warning=0;};
309 void SetWarning(){debug=0; verbose=0; warning=1;};
310 void SetVerbose(){debug=0; verbose=1; warning=1;};
311 void SetDebug() {debug=1; verbose=1; warning=1;};
312 };
313
314
315 // ==================================================================
316 /**
317 * \brief Struct to pass mini2 track parameters to F77 routines
318 */
319 struct cMini2track {
320 double al[5];
321 double xm[NPLANE],ym[NPLANE],zm[NPLANE];
322 double xm_a[NPLANE],ym_a[NPLANE];
323 double xm_b[NPLANE],ym_b[NPLANE];
324 double resx[NPLANE],resy[NPLANE];
325 double tailx[NPLANE],taily[NPLANE];
326 double xgood[NPLANE],ygood[NPLANE];
327 double dedxtrk_x[NPLANE];
328 double dedxtrk_y[NPLANE];
329 double zini;
330 double pfixed;
331 double chi2;
332 double xv[NPLANE],yv[NPLANE],zv[NPLANE];
333 double axv[NPLANE],ayv[NPLANE];
334 double cov[5][5];
335 double fact;
336 int nstep;
337 int idcand;
338 int trackmode;
339 int istepmin;
340
341 /* cMini2track(){ */
342 /* // -------------------------- */
343 /* // fitting routine parameters */
344 /* // -------------------------- */
345 /* zini = 23.5; */
346 /* trackmode = 0; */
347 /* istepmin = 3; */
348 /* // -------------------------- */
349 /* pfixed = 0.; */
350 /* chi2 = 0; */
351 /* nstep = 0; */
352 /* for(int it1=0;it1<5;it1++){ */
353 /* al[it1] = 0; */
354 /* for(int it2=0;it2<5;it2++)cov[it1][it2] = 0; */
355 /* }; */
356 /* for(int ip=0;ip<6;ip++){ */
357 /* xgood[ip] = 0; */
358 /* ygood[ip] = 0; */
359 /* xm[ip] = 0; */
360 /* ym[ip] = 0; */
361 /* xm_a[ip] = 0; */
362 /* ym_a[ip] = 0; */
363 /* xm_b[ip] = 0; */
364 /* ym_b[ip] = 0; */
365 /* zm[ip] = 0; */
366 /* resx[ip] = 0; */
367 /* resy[ip] = 0; */
368 /* xv[ip] = 0; */
369 /* yv[ip] = 0; */
370 /* zv[ip] = 0; */
371 /* axv[ip] = 0; */
372 /* ayv[ip] = 0; */
373 /* dedxtrk_x[ip] = 0; */
374 /* dedxtrk_y[ip] = 0; */
375 /* }; */
376
377 /* } */
378
379
380 };
381
382 // ==================================================================
383 /**
384 * \brief Struct to pass DELTAB parameters to F77 routines
385 */
386 struct cDeltaB {
387 double delta0;
388 double delta1;
389 };
390
391 //
392 /**
393 * \Struct for the hough transform variables
394 */
395
396 struct cTrkHough {
397
398 int ndblt_nt;
399 float alfayz1_nt[NDBLT_MAX_NT];
400 float alfayz2_nt[NDBLT_MAX_NT];
401 int db_cloud_nt[NDBLT_MAX_NT];
402 int ntrpt_nt;
403 float alfaxz1_nt[NTRPT_MAX_NT];
404 float alfaxz2_nt[NTRPT_MAX_NT];
405 float alfaxz3_nt[NTRPT_MAX_NT];
406 int tr_cloud_nt[NTRPT_MAX_NT];
407 int nclouds_yz_nt;
408 float alfayz1_av_nt[NCLOYZ_MAX];
409 float alfayz2_av_nt[NCLOYZ_MAX];
410 int ptcloud_yz_nt[NCLOYZ_MAX];
411 int nclouds_xz_nt;
412 float alfaxz1_av_nt[NCLOXZ_MAX];
413 float alfaxz2_av_nt[NCLOXZ_MAX];
414 float alfaxz3_av_nt[NCLOXZ_MAX];
415 int ptcloud_xz_nt[NCLOXZ_MAX];
416 int nclstr;
417 float totaltime;
418 float houghtime;
419 float fittime;
420
421
422 void InitcTrkHough(){
423
424 ndblt_nt = 0;
425 ntrpt_nt = 0;
426 nclouds_yz_nt = 0;
427 nclouds_xz_nt = 0;
428 nclstr = 0;
429 totaltime = 0;
430 houghtime = 0;
431 fittime = 0;
432 for(int i=0;i<NDBLT_MAX_NT ;i++){
433 alfayz1_nt[i] = 0;
434 alfayz2_nt[i] = 0;
435 db_cloud_nt[i] = 0;
436 }
437 for(int i=0;i<NTRPT_MAX_NT ;i++){
438 alfaxz1_nt[i] = 0;
439 alfaxz2_nt[i] = 0;
440 alfaxz3_nt[i] = 0;
441 tr_cloud_nt[i] = 0;
442 }
443 for(int i=0;i<NCLOYZ_MAX ;i++){
444 alfayz1_av_nt[i] = 0;
445 alfayz2_av_nt[i] = 0;
446 ptcloud_yz_nt[i] = 0;
447 }
448 for(int i=0;i<NCLOXZ_MAX ;i++){
449 ptcloud_xz_nt[i] = 0;
450 alfaxz1_av_nt[i] = 0;
451 alfaxz2_av_nt[i] = 0;
452 alfaxz3_av_nt[i] = 0;
453 }
454 }
455
456 };
457
458 /**
459 * \Struct for track candidates after hough transform
460 */
461 struct cTrkCandidates {
462 int ntracks;
463 float al[NTRACKSMAX][5];
464 float xm[NTRACKSMAX][NPLANE];
465 float ym[NTRACKSMAX][NPLANE];
466 float zm[NTRACKSMAX][NPLANE];
467 float resx[NTRACKSMAX][NPLANE];
468 float resy[NTRACKSMAX][NPLANE];
469 float xv[NTRACKSMAX][NPLANE];
470 float yv[NTRACKSMAX][NPLANE];
471 float zv[NTRACKSMAX][NPLANE];
472 float axv[NTRACKSMAX][NPLANE];
473 float ayv[NTRACKSMAX][NPLANE];
474 float xgood[NTRACKSMAX][NPLANE];
475 float ygood[NTRACKSMAX][NPLANE];
476 int cp[NTRACKSMAX][NPLANE];
477 int cls[NTRACKSMAX][NPLANE];
478 int sensor[NTRACKSMAX][NPLANE];
479 int ladder[NTRACKSMAX][NPLANE];
480 float bx[NTRACKSMAX][NPLANE];
481 float by[NTRACKSMAX][NPLANE];
482 float chi2[NTRACKSMAX];
483
484 void Init(){
485 ntracks=0;
486 for(int i=0; i<NTRACKSMAX; i++){
487 for(int ii=0; ii<5; ii++)al[i][ii]=0;
488 chi2[i]=0;
489 for(int ip=0; ip<NPLANE; ip++){
490 xm[i][ip]=0;
491 ym[i][ip]=0;
492 zm[i][ip]=0;
493 resx[i][ip]=0;
494 resy[i][ip]=0;
495 xv[i][ip]=0;
496 yv[i][ip]=0;
497 zv[i][ip]=0;
498 axv[i][ip]=0;
499 ayv[i][ip]=0;
500 xgood[i][ip]=0;
501 ygood[i][ip]=0;
502 cp[i][ip]=0;
503 cls[i][ip]=0;
504 sensor[i][ip]=0;
505 ladder[i][ip]=0;
506 bx[i][ip]=0;
507 by[i][ip]=0;
508 }
509 }
510
511 };
512
513
514 };
515
516 /**
517 * \brief Struct to pass VA1-mask to F77 routines
518 */
519 struct cTrkMask {
520
521 int mask_vk[NVK][NVIEW];
522 int mask_vk_run[NVK][NVIEW];
523
524 // void Set(TFile* , Int_t , Int_t );
525
526 void Reset(){
527 for(int ivk=0; ivk<NVK; ivk++){
528 for(int iv=0; iv<NVIEW; iv++){
529 // mask_vk[ivk][iv]=0;
530 mask_vk_run[ivk][iv]=0;
531 }
532 }
533 }
534
535 void Dump(){
536 }
537
538 };
539
540 /**
541 * \brief Struct for pfa parameters
542 */
543 struct cTrkETA {
544
545 int nangbin;
546 float angL[NANGMAX],angR[NANGMAX];
547 int netaval;
548 float eta2[NANGMAX][NETAVALMAX];
549 float feta2[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
550 float eta3[NANGMAX][NETAVALMAX];
551 float feta3[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
552 float eta4[NANGMAX][NETAVALMAX];
553 float feta4[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
554 float fcorr[NANGMAX][NLADDER][NVIEW];
555 float e234ax[6];//F77: e2fax,e2tax,e3fax,e3tax,e4fax,e4tax
556 float e234ay[6];//F77: e2fay,e2tay,e3fay,e3tay,e4fay,e4tay
557
558 };
559 /**
560 * \brief Struct to configure data reduction
561 */
562 struct cTrkSW{
563 int pfaid;
564 };
565
566 extern "C" {
567
568 extern struct cTrkCalib pedsigbad_;
569 extern struct cTrkMask mask_;
570 extern struct cTrkLevel0 level0event_;
571 extern struct cTrkLevel1 level1event_;
572 extern struct cTrkLevel2 level2event_;
573 extern struct cPath path_;
574 extern struct cDbg dbg_;
575 extern struct cTrkHough houghevent_;
576 extern struct cTrkCandidates trackcandidates_;
577 extern struct cMini2track track_;
578 extern struct cTrkETA pfa_;
579 extern struct cTrkSW sw_;
580 extern struct cDeltaB deltab_;
581
582 void fillpedsigfromdefault_();
583 int readmipparam_();
584 int readchargeparam_();
585 int readvkmask_();
586 int readalignparam_();
587 int readetaparam_();
588 void reductionflight_(int*);
589 int analysisflight_();
590 int readb_();
591 void gufld_(float*, float*);
592 void xyzpam_(int*,int*,int*,int*,int*,float*,float*,float*,float*);
593 float riseta_(int*,float*);
594 void chisq_(int*, int*);
595
596 }
597
598 #endif

  ViewVC Help
Powered by ViewVC 1.1.23