/[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.28 - (show annotations) (download)
Wed Nov 7 10:38:51 2007 UTC (17 years ago) by pam-fi
Branch: MAIN
Changes since 1.27: +61 -0 lines
File MIME type: text/plain
fixed bug on DB connection

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 * \Struct for the hough transform variables
384 */
385
386 struct cTrkHough {
387
388 int ndblt_nt;
389 float alfayz1_nt[NDBLT_MAX_NT];
390 float alfayz2_nt[NDBLT_MAX_NT];
391 int db_cloud_nt[NDBLT_MAX_NT];
392 int ntrpt_nt;
393 float alfaxz1_nt[NTRPT_MAX_NT];
394 float alfaxz2_nt[NTRPT_MAX_NT];
395 float alfaxz3_nt[NTRPT_MAX_NT];
396 int tr_cloud_nt[NTRPT_MAX_NT];
397 int nclouds_yz_nt;
398 float alfayz1_av_nt[NCLOYZ_MAX];
399 float alfayz2_av_nt[NCLOYZ_MAX];
400 int ptcloud_yz_nt[NCLOYZ_MAX];
401 int nclouds_xz_nt;
402 float alfaxz1_av_nt[NCLOXZ_MAX];
403 float alfaxz2_av_nt[NCLOXZ_MAX];
404 float alfaxz3_av_nt[NCLOXZ_MAX];
405 int ptcloud_xz_nt[NCLOXZ_MAX];
406 int nclstr;
407 float totaltime;
408 float houghtime;
409 float fittime;
410
411
412 void InitcTrkHough(){
413
414 ndblt_nt = 0;
415 ntrpt_nt = 0;
416 nclouds_yz_nt = 0;
417 nclouds_xz_nt = 0;
418 nclstr = 0;
419 totaltime = 0;
420 houghtime = 0;
421 fittime = 0;
422 for(int i=0;i<NDBLT_MAX_NT ;i++){
423 alfayz1_nt[i] = 0;
424 alfayz2_nt[i] = 0;
425 db_cloud_nt[i] = 0;
426 }
427 for(int i=0;i<NTRPT_MAX_NT ;i++){
428 alfaxz1_nt[i] = 0;
429 alfaxz2_nt[i] = 0;
430 alfaxz3_nt[i] = 0;
431 tr_cloud_nt[i] = 0;
432 }
433 for(int i=0;i<NCLOYZ_MAX ;i++){
434 alfayz1_av_nt[i] = 0;
435 alfayz2_av_nt[i] = 0;
436 ptcloud_yz_nt[i] = 0;
437 }
438 for(int i=0;i<NCLOXZ_MAX ;i++){
439 ptcloud_xz_nt[i] = 0;
440 alfaxz1_av_nt[i] = 0;
441 alfaxz2_av_nt[i] = 0;
442 alfaxz3_av_nt[i] = 0;
443 }
444 }
445
446 };
447
448 /**
449 * \Struct for track candidates after hough transform
450 */
451 struct cTrkCandidates {
452 int ntracks;
453 float al[NTRACKSMAX][5];
454 float xm[NTRACKSMAX][NPLANE];
455 float ym[NTRACKSMAX][NPLANE];
456 float zm[NTRACKSMAX][NPLANE];
457 float resx[NTRACKSMAX][NPLANE];
458 float resy[NTRACKSMAX][NPLANE];
459 float xv[NTRACKSMAX][NPLANE];
460 float yv[NTRACKSMAX][NPLANE];
461 float zv[NTRACKSMAX][NPLANE];
462 float axv[NTRACKSMAX][NPLANE];
463 float ayv[NTRACKSMAX][NPLANE];
464 float xgood[NTRACKSMAX][NPLANE];
465 float ygood[NTRACKSMAX][NPLANE];
466 int cp[NTRACKSMAX][NPLANE];
467 int cls[NTRACKSMAX][NPLANE];
468 int sensor[NTRACKSMAX][NPLANE];
469 int ladder[NTRACKSMAX][NPLANE];
470 float bx[NTRACKSMAX][NPLANE];
471 float by[NTRACKSMAX][NPLANE];
472 float chi2[NTRACKSMAX];
473
474 void Init(){
475 ntracks=0;
476 for(int i=0; i<NTRACKSMAX; i++){
477 for(int ii=0; ii<5; ii++)al[i][ii]=0;
478 chi2[i]=0;
479 for(int ip=0; ip<NPLANE; ip++){
480 xm[i][ip]=0;
481 ym[i][ip]=0;
482 zm[i][ip]=0;
483 resx[i][ip]=0;
484 resy[i][ip]=0;
485 xv[i][ip]=0;
486 yv[i][ip]=0;
487 zv[i][ip]=0;
488 axv[i][ip]=0;
489 ayv[i][ip]=0;
490 xgood[i][ip]=0;
491 ygood[i][ip]=0;
492 cp[i][ip]=0;
493 cls[i][ip]=0;
494 sensor[i][ip]=0;
495 ladder[i][ip]=0;
496 bx[i][ip]=0;
497 by[i][ip]=0;
498 }
499 }
500
501 };
502
503
504 };
505
506 /**
507 * \brief Struct to pass VA1-mask to F77 routines
508 */
509 struct cTrkMask {
510
511 int mask_vk[NVK][NVIEW];
512 int mask_vk_run[NVK][NVIEW];
513
514 // void Set(TFile* , Int_t , Int_t );
515
516 void Reset(){
517 for(int ivk=0; ivk<NVK; ivk++){
518 for(int iv=0; iv<NVIEW; iv++){
519 // mask_vk[ivk][iv]=0;
520 mask_vk_run[ivk][iv]=0;
521 }
522 }
523 }
524
525 void Dump(){
526 }
527
528 };
529
530 /**
531 * \brief Struct for pfa parameters
532 */
533 struct cTrkETA {
534
535 int nangbin;
536 float angL[NANGMAX],angR[NANGMAX];
537 int netaval;
538 float eta2[NANGMAX][NETAVALMAX];
539 float feta2[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
540 float eta3[NANGMAX][NETAVALMAX];
541 float feta3[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
542 float eta4[NANGMAX][NETAVALMAX];
543 float feta4[NANGMAX][NLADDER][NVIEW][NETAVALMAX];
544 float fcorr[NANGMAX][NLADDER][NVIEW];
545 float e234ax[6];//F77: e2fax,e2tax,e3fax,e3tax,e4fax,e4tax
546 float e234ay[6];//F77: e2fay,e2tay,e3fay,e3tay,e4fay,e4tay
547
548 };
549 /**
550 * \brief Struct to configure data reduction
551 */
552 struct cTrkSW{
553 int pfaid;
554 };
555
556 extern "C" {
557
558 extern struct cTrkCalib pedsigbad_;
559 extern struct cTrkMask mask_;
560 extern struct cTrkLevel0 level0event_;
561 extern struct cTrkLevel1 level1event_;
562 extern struct cTrkLevel2 level2event_;
563 extern struct cPath path_;
564 extern struct cDbg dbg_;
565 extern struct cTrkHough houghevent_;
566 extern struct cTrkCandidates trackcandidates_;
567 extern struct cMini2track track_;
568 extern struct cTrkETA pfa_;
569 extern struct cTrkSW sw_;
570
571 void fillpedsigfromdefault_();
572 int readmipparam_();
573 int readchargeparam_();
574 int readvkmask_();
575 int readalignparam_();
576 int readetaparam_();
577 void reductionflight_(int*);
578 int analysisflight_();
579 int readb_();
580 void gufld_(float*, float*);
581 void xyzpam_(int*,int*,int*,int*,int*,float*,float*,float*,float*);
582 float riseta_(int*,float*);
583
584 }
585
586 #endif

  ViewVC Help
Powered by ViewVC 1.1.23