7 |
#define trkstruct_h |
#define trkstruct_h |
8 |
|
|
9 |
#define NPLANE 6 |
#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 |
#define NCLMAX_VIEW 200 //max n.clusters per view |
16 |
#define NCLSTR 20 //max n.strip per cluster |
#define NCLSTR 20 //max n.strip per cluster |
25 |
#define NTRKMAX 10 |
#define NTRKMAX 10 |
26 |
#define NSINGMAX NCLMAX //100 |
#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> |
#include <CalibTrk1Event.h> |
34 |
#include <CalibTrk2Event.h> |
#include <CalibTrk2Event.h> |
35 |
|
using namespace pamela; |
36 |
|
//#include <TrkCalib.h> |
37 |
|
|
38 |
#include <TString.h> |
#include <TString.h> |
39 |
#include <TFile.h> |
#include <TFile.h> |
40 |
#include <TTree.h> |
#include <TTree.h> |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
#include <fstream> |
#include <fstream> |
45 |
#include <iostream> |
#include <iostream> |
46 |
/** |
/** |
54 |
float sigma_t[128][24][12]; |
float sigma_t[128][24][12]; |
55 |
int bad[128][24][12]; |
int bad[128][24][12]; |
56 |
|
|
57 |
void FillACalibFrom(TFile* , Int_t , Int_t ); |
void Reset(){ |
58 |
void FillFCalibFrom(TFile* , Int_t , Int_t ); |
for(int is=0; is<128; is++){ |
59 |
void FillTCalibFrom(TFile* , Int_t , Int_t ); |
for(int ivk=0; ivk<24; ivk++){ |
60 |
void FillTCalibFrom(TString); |
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 |
// ================================================================== |
// ================================================================== |
132 |
float cnrmsev[24][12]; |
float cnrmsev[24][12]; |
133 |
int fshower[12]; |
int fshower[12]; |
134 |
int whichtrack[NCLMAX]; |
int whichtrack[NCLMAX]; |
135 |
|
|
136 |
}; |
}; |
137 |
// ================================================================== |
// ================================================================== |
138 |
/** |
/** |
141 |
struct cTrkLevel2 { |
struct cTrkLevel2 { |
142 |
// int good2; |
// int good2; |
143 |
// int crc[12]; |
// int crc[12]; |
144 |
int good[12]; |
int good[12]; |
145 |
|
int vkflag[24][12]; |
146 |
// ---------------------------- |
// ---------------------------- |
147 |
int nclsx; |
int nclsx; |
148 |
int planex[NSINGMAX]; |
int planex[NSINGMAX]; |
149 |
float xs[NSINGMAX][2]; |
float xs[NSINGMAX][2]; |
150 |
float signlxs[NSINGMAX]; |
float signlxs[NSINGMAX]; |
151 |
int clsx[NSINGMAX]; |
int clsx[NSINGMAX]; |
152 |
|
int sxbad[NSINGMAX]; |
153 |
|
int multmaxsx[NSINGMAX]; |
154 |
// ---------------------------- |
// ---------------------------- |
155 |
int nclsy; |
int nclsy; |
156 |
int planey[NSINGMAX]; |
int planey[NSINGMAX]; |
157 |
float ys[NSINGMAX][2]; |
float ys[NSINGMAX][2]; |
158 |
float signlys[NSINGMAX]; |
float signlys[NSINGMAX]; |
159 |
int clsy[NSINGMAX]; |
int clsy[NSINGMAX]; |
160 |
|
int sybad[NSINGMAX]; |
161 |
|
int multmaxsy[NSINGMAX]; |
162 |
// ---------------------------- |
// ---------------------------- |
163 |
int ntrk; |
int ntrk; |
164 |
int image[NTRKMAX]; |
int image[NTRKMAX]; |
167 |
float zm_nt[NTRKMAX][6]; |
float zm_nt[NTRKMAX][6]; |
168 |
float resx_nt[NTRKMAX][6]; |
float resx_nt[NTRKMAX][6]; |
169 |
float resy_nt[NTRKMAX][6]; |
float resy_nt[NTRKMAX][6]; |
170 |
|
float tailx[NTRKMAX][6]; |
171 |
|
float taily[NTRKMAX][6]; |
172 |
float al_nt[NTRKMAX][5]; |
float al_nt[NTRKMAX][5]; |
173 |
float coval[NTRKMAX][5][5]; |
float coval[NTRKMAX][5][5]; |
174 |
float chi2_nt[NTRKMAX]; |
float chi2_nt[NTRKMAX]; |
175 |
int nstep_nt[NTRKMAX]; |
int nstep_nt[NTRKMAX]; |
176 |
int xgood_nt[NTRKMAX][6]; |
int xgood_nt[NTRKMAX][6]; |
177 |
int ygood_nt[NTRKMAX][6]; |
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]; |
float xv_nt[NTRKMAX][6]; |
182 |
float yv_nt[NTRKMAX][6]; |
float yv_nt[NTRKMAX][6]; |
183 |
float zv_nt[NTRKMAX][6]; |
float zv_nt[NTRKMAX][6]; |
187 |
float dedx_y[NTRKMAX][6]; |
float dedx_y[NTRKMAX][6]; |
188 |
int cltrx[NTRKMAX][6]; |
int cltrx[NTRKMAX][6]; |
189 |
int cltry[NTRKMAX][6]; |
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]; |
// float bdl[NTRKMAX]; |
197 |
|
|
198 |
void InitcTrkLevel2(){ |
void InitcTrkLevel2(){ |
199 |
|
|
200 |
// good2 = 0; |
// good2 = 0; |
201 |
for(Int_t i=0; i<12 ; i++) |
for(Int_t i=0; i<12 ; i++){ |
202 |
// crc[i] = 0; |
good[i] = 0; |
203 |
good[i] = 0; |
for(Int_t ii=0; ii<24 ; ii++)vkflag[ii][i]=0; |
204 |
// ---------------------------- |
} |
205 |
nclsx = 0; |
// ---------------------------- |
206 |
nclsy = 0; |
nclsx = 0; |
207 |
for(Int_t i=0; i<NSINGMAX ; i++){ |
nclsy = 0; |
208 |
planex[i] = 0; |
for(Int_t i=0; i<NSINGMAX ; i++){ |
209 |
xs[i][0] = 0; |
planex[i] = 0; |
210 |
xs[i][1] = 0; |
xs[i][0] = 0; |
211 |
signlxs[i] = 0; |
xs[i][1] = 0; |
212 |
planey[i] = 0; |
signlxs[i] = 0; |
213 |
ys[i][0] = 0; |
clsx[i] = 0; |
214 |
ys[i][1] = 0; |
sxbad[i] = 0; |
215 |
signlys[i] = 0; |
planey[i] = 0; |
216 |
} |
ys[i][0] = 0; |
217 |
// ---------------------------- |
ys[i][1] = 0; |
218 |
ntrk =0 ; |
signlys[i] = 0; |
219 |
|
clsy[i] = 0; |
220 |
for(Int_t i=0; i<NTRKMAX ; i++){ |
sybad[i] = 0; |
221 |
image[i] = 0; |
} |
222 |
chi2_nt[i] = 0; |
// ---------------------------- |
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; |
// bdl[i] = 0; |
229 |
|
|
230 |
for(Int_t ii=0; ii<5 ; ii++){ |
for(Int_t ii=0; ii<5 ; ii++){ |
231 |
al_nt[i][ii] = 0; |
al_nt[i][ii] = 0; |
232 |
for(Int_t iii=0; iii<5 ; iii++) |
for(Int_t iii=0; iii<5 ; iii++) |
233 |
coval[i][ii][iii] = 0; |
coval[i][ii][iii] = 0; |
234 |
} |
} |
235 |
|
|
236 |
for(Int_t ii=0; ii<6 ; ii++){ |
for(Int_t ii=0; ii<6 ; ii++){ |
237 |
xm_nt[i][ii] = 0; |
xm_nt[i][ii] = 0; |
238 |
ym_nt[i][ii] = 0; |
ym_nt[i][ii] = 0; |
239 |
zm_nt[i][ii] = 0; |
zm_nt[i][ii] = 0; |
240 |
resx_nt[i][ii] = 0; |
resx_nt[i][ii] = 0; |
241 |
resy_nt[i][ii] = 0; |
resy_nt[i][ii] = 0; |
242 |
xgood_nt[i][ii] = 0; |
xgood_nt[i][ii] = 0; |
243 |
ygood_nt[i][ii] = 0; |
ygood_nt[i][ii] = 0; |
244 |
xv_nt[i][ii] = 0; |
xv_nt[i][ii] = 0; |
245 |
yv_nt[i][ii] = 0; |
yv_nt[i][ii] = 0; |
246 |
zv_nt[i][ii] = 0; |
zv_nt[i][ii] = 0; |
247 |
axv_nt[i][ii] = 0; |
axv_nt[i][ii] = 0; |
248 |
ayv_nt[i][ii] = 0; |
ayv_nt[i][ii] = 0; |
249 |
dedx_x[i][ii] = 0; |
dedx_x[i][ii] = 0; |
250 |
dedx_y[i][ii] = 0; |
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 |
/** |
/** |
328 |
struct cMini2track { |
struct cMini2track { |
329 |
double al[5]; |
double al[5]; |
330 |
double xm[NPLANE],ym[NPLANE],zm[NPLANE]; |
double xm[NPLANE],ym[NPLANE],zm[NPLANE]; |
331 |
double xm_a[NPLANE],ym_a[NPLANE]; |
double xm_a[NPLANE],ym_a[NPLANE],zm_a[NPLANE]; |
332 |
double xm_b[NPLANE],ym_b[NPLANE]; |
double xm_b[NPLANE],ym_b[NPLANE],zm_b[NPLANE]; |
333 |
double resx[NPLANE],resy[NPLANE]; |
double resx[NPLANE],resy[NPLANE]; |
334 |
|
double tailx[NPLANE],taily[NPLANE]; |
335 |
double xgood[NPLANE],ygood[NPLANE]; |
double xgood[NPLANE],ygood[NPLANE]; |
336 |
double dedxtrk_x[NPLANE]; |
double dedxtrk_x[NPLANE]; |
337 |
double dedxtrk_y[NPLANE]; |
double dedxtrk_y[NPLANE]; |
341 |
double xv[NPLANE],yv[NPLANE],zv[NPLANE]; |
double xv[NPLANE],yv[NPLANE],zv[NPLANE]; |
342 |
double axv[NPLANE],ayv[NPLANE]; |
double axv[NPLANE],ayv[NPLANE]; |
343 |
double cov[5][5]; |
double cov[5][5]; |
344 |
|
double fact; |
345 |
int nstep; |
int nstep; |
346 |
int idcand; |
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 |
* \Struct for the hough transform variables |
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" { |
extern "C" { |
590 |
|
|
591 |
extern struct cTrkCalib pedsigbad_; |
extern struct cTrkCalib pedsigbad_; |
592 |
|
extern struct cTrkMask mask_; |
593 |
extern struct cTrkLevel0 level0event_; |
extern struct cTrkLevel0 level0event_; |
594 |
extern struct cTrkLevel1 level1event_; |
extern struct cTrkLevel1 level1event_; |
595 |
extern struct cTrkLevel2 level2event_; |
extern struct cTrkLevel2 level2event_; |
596 |
extern struct cPath path_; |
extern struct cPath path_; |
|
/* extern struct cBPath bpath_; */ |
|
597 |
extern struct cDbg dbg_; |
extern struct cDbg dbg_; |
598 |
extern struct cTrkHough houghevent_; |
extern struct cTrkHough houghevent_; |
599 |
|
extern struct cTrkCandidates trackcandidates_; |
600 |
extern struct cMini2track track_; |
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_(); |
void fillpedsigfromdefault_(); |
607 |
int readmipparam_(); |
int readmipparam_(); |
611 |
int readetaparam_(); |
int readetaparam_(); |
612 |
void reductionflight_(int*); |
void reductionflight_(int*); |
613 |
int analysisflight_(); |
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 |
#endif |
|
|
|