9 |
#define NPLANE 6 |
#define NPLANE 6 |
10 |
#define NVIEW 12 |
#define NVIEW 12 |
11 |
#define NVK 24 |
#define NVK 24 |
12 |
|
#define NLADDER 3 |
13 |
|
|
14 |
#define NCLMAX_VIEW 200 //max n.clusters per view |
#define NCLMAX_VIEW 200 //max n.clusters per view |
15 |
#define NCLSTR 20 //max n.strip per cluster |
#define NCLSTR 20 //max n.strip per cluster |
24 |
#define NTRKMAX 10 |
#define NTRKMAX 10 |
25 |
#define NSINGMAX NCLMAX //100 |
#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> |
#include <CalibTrk1Event.h> |
33 |
//#include <CalibTrk2Event.h> |
#include <CalibTrk2Event.h> |
34 |
#include <TrkCalib.h> |
using namespace pamela; |
35 |
|
//#include <TrkCalib.h> |
36 |
|
|
37 |
#include <TString.h> |
#include <TString.h> |
38 |
#include <TFile.h> |
#include <TFile.h> |
39 |
#include <TTree.h> |
#include <TTree.h> |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
#include <fstream> |
#include <fstream> |
44 |
#include <iostream> |
#include <iostream> |
45 |
/** |
/** |
53 |
float sigma_t[128][24][12]; |
float sigma_t[128][24][12]; |
54 |
int bad[128][24][12]; |
int bad[128][24][12]; |
55 |
|
|
56 |
void FillACalibFrom(TFile* , Int_t , Int_t ); |
void Reset(){ |
57 |
void FillFCalibFrom(TFile* , Int_t , Int_t ); |
for(int is=0; is<128; is++){ |
58 |
void FillTCalibFrom(TFile* , Int_t , Int_t ); |
for(int ivk=0; ivk<24; ivk++){ |
59 |
void FillTCalibFrom(TString); |
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 |
// ================================================================== |
// ================================================================== |
131 |
float cnrmsev[24][12]; |
float cnrmsev[24][12]; |
132 |
int fshower[12]; |
int fshower[12]; |
133 |
int whichtrack[NCLMAX]; |
int whichtrack[NCLMAX]; |
134 |
|
|
135 |
}; |
}; |
136 |
// ================================================================== |
// ================================================================== |
137 |
/** |
/** |
140 |
struct cTrkLevel2 { |
struct cTrkLevel2 { |
141 |
// int good2; |
// int good2; |
142 |
// int crc[12]; |
// int crc[12]; |
143 |
int good[12]; |
int good[12]; |
144 |
|
int vkflag[24][12]; |
145 |
// ---------------------------- |
// ---------------------------- |
146 |
int nclsx; |
int nclsx; |
147 |
int planex[NSINGMAX]; |
int planex[NSINGMAX]; |
148 |
float xs[NSINGMAX][2]; |
float xs[NSINGMAX][2]; |
149 |
float signlxs[NSINGMAX]; |
float signlxs[NSINGMAX]; |
150 |
int clsx[NSINGMAX]; |
int clsx[NSINGMAX]; |
151 |
|
int sxbad[NSINGMAX]; |
152 |
|
int multmaxsx[NSINGMAX]; |
153 |
// ---------------------------- |
// ---------------------------- |
154 |
int nclsy; |
int nclsy; |
155 |
int planey[NSINGMAX]; |
int planey[NSINGMAX]; |
156 |
float ys[NSINGMAX][2]; |
float ys[NSINGMAX][2]; |
157 |
float signlys[NSINGMAX]; |
float signlys[NSINGMAX]; |
158 |
int clsy[NSINGMAX]; |
int clsy[NSINGMAX]; |
159 |
|
int sybad[NSINGMAX]; |
160 |
|
int multmaxsy[NSINGMAX]; |
161 |
// ---------------------------- |
// ---------------------------- |
162 |
int ntrk; |
int ntrk; |
163 |
int image[NTRKMAX]; |
int image[NTRKMAX]; |
166 |
float zm_nt[NTRKMAX][6]; |
float zm_nt[NTRKMAX][6]; |
167 |
float resx_nt[NTRKMAX][6]; |
float resx_nt[NTRKMAX][6]; |
168 |
float resy_nt[NTRKMAX][6]; |
float resy_nt[NTRKMAX][6]; |
169 |
|
float tailx[NTRKMAX][6]; |
170 |
|
float taily[NTRKMAX][6]; |
171 |
float al_nt[NTRKMAX][5]; |
float al_nt[NTRKMAX][5]; |
172 |
float coval[NTRKMAX][5][5]; |
float coval[NTRKMAX][5][5]; |
173 |
float chi2_nt[NTRKMAX]; |
float chi2_nt[NTRKMAX]; |
174 |
int nstep_nt[NTRKMAX]; |
int nstep_nt[NTRKMAX]; |
175 |
int xgood_nt[NTRKMAX][6]; |
int xgood_nt[NTRKMAX][6]; |
176 |
int ygood_nt[NTRKMAX][6]; |
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]; |
float xv_nt[NTRKMAX][6]; |
181 |
float yv_nt[NTRKMAX][6]; |
float yv_nt[NTRKMAX][6]; |
182 |
float zv_nt[NTRKMAX][6]; |
float zv_nt[NTRKMAX][6]; |
186 |
float dedx_y[NTRKMAX][6]; |
float dedx_y[NTRKMAX][6]; |
187 |
int cltrx[NTRKMAX][6]; |
int cltrx[NTRKMAX][6]; |
188 |
int cltry[NTRKMAX][6]; |
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]; |
// float bdl[NTRKMAX]; |
196 |
|
|
197 |
void InitcTrkLevel2(){ |
void InitcTrkLevel2(){ |
198 |
|
|
199 |
// good2 = 0; |
// good2 = 0; |
200 |
for(Int_t i=0; i<12 ; i++) |
for(Int_t i=0; i<12 ; i++){ |
201 |
// crc[i] = 0; |
good[i] = 0; |
202 |
good[i] = 0; |
for(Int_t ii=0; ii<24 ; ii++)vkflag[ii][i]=0; |
203 |
// ---------------------------- |
} |
204 |
nclsx = 0; |
// ---------------------------- |
205 |
nclsy = 0; |
nclsx = 0; |
206 |
for(Int_t i=0; i<NSINGMAX ; i++){ |
nclsy = 0; |
207 |
planex[i] = 0; |
for(Int_t i=0; i<NSINGMAX ; i++){ |
208 |
xs[i][0] = 0; |
planex[i] = 0; |
209 |
xs[i][1] = 0; |
xs[i][0] = 0; |
210 |
signlxs[i] = 0; |
xs[i][1] = 0; |
211 |
planey[i] = 0; |
signlxs[i] = 0; |
212 |
ys[i][0] = 0; |
clsx[i] = 0; |
213 |
ys[i][1] = 0; |
sxbad[i] = 0; |
214 |
signlys[i] = 0; |
planey[i] = 0; |
215 |
} |
ys[i][0] = 0; |
216 |
// ---------------------------- |
ys[i][1] = 0; |
217 |
ntrk =0 ; |
signlys[i] = 0; |
218 |
|
clsy[i] = 0; |
219 |
for(Int_t i=0; i<NTRKMAX ; i++){ |
sybad[i] = 0; |
220 |
image[i] = 0; |
} |
221 |
chi2_nt[i] = 0; |
// ---------------------------- |
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; |
// bdl[i] = 0; |
228 |
|
|
229 |
for(Int_t ii=0; ii<5 ; ii++){ |
for(Int_t ii=0; ii<5 ; ii++){ |
230 |
al_nt[i][ii] = 0; |
al_nt[i][ii] = 0; |
231 |
for(Int_t iii=0; iii<5 ; iii++) |
for(Int_t iii=0; iii<5 ; iii++) |
232 |
coval[i][ii][iii] = 0; |
coval[i][ii][iii] = 0; |
233 |
} |
} |
234 |
|
|
235 |
for(Int_t ii=0; ii<6 ; ii++){ |
for(Int_t ii=0; ii<6 ; ii++){ |
236 |
xm_nt[i][ii] = 0; |
xm_nt[i][ii] = 0; |
237 |
ym_nt[i][ii] = 0; |
ym_nt[i][ii] = 0; |
238 |
zm_nt[i][ii] = 0; |
zm_nt[i][ii] = 0; |
239 |
resx_nt[i][ii] = 0; |
resx_nt[i][ii] = 0; |
240 |
resy_nt[i][ii] = 0; |
resy_nt[i][ii] = 0; |
241 |
xgood_nt[i][ii] = 0; |
xgood_nt[i][ii] = 0; |
242 |
ygood_nt[i][ii] = 0; |
ygood_nt[i][ii] = 0; |
243 |
xv_nt[i][ii] = 0; |
xv_nt[i][ii] = 0; |
244 |
yv_nt[i][ii] = 0; |
yv_nt[i][ii] = 0; |
245 |
zv_nt[i][ii] = 0; |
zv_nt[i][ii] = 0; |
246 |
axv_nt[i][ii] = 0; |
axv_nt[i][ii] = 0; |
247 |
ayv_nt[i][ii] = 0; |
ayv_nt[i][ii] = 0; |
248 |
dedx_x[i][ii] = 0; |
dedx_x[i][ii] = 0; |
249 |
dedx_y[i][ii] = 0; |
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 |
/** |
/** |
330 |
double xm_a[NPLANE],ym_a[NPLANE]; |
double xm_a[NPLANE],ym_a[NPLANE]; |
331 |
double xm_b[NPLANE],ym_b[NPLANE]; |
double xm_b[NPLANE],ym_b[NPLANE]; |
332 |
double resx[NPLANE],resy[NPLANE]; |
double resx[NPLANE],resy[NPLANE]; |
333 |
|
double tailx[NPLANE],taily[NPLANE]; |
334 |
double xgood[NPLANE],ygood[NPLANE]; |
double xgood[NPLANE],ygood[NPLANE]; |
335 |
double dedxtrk_x[NPLANE]; |
double dedxtrk_x[NPLANE]; |
336 |
double dedxtrk_y[NPLANE]; |
double dedxtrk_y[NPLANE]; |
340 |
double xv[NPLANE],yv[NPLANE],zv[NPLANE]; |
double xv[NPLANE],yv[NPLANE],zv[NPLANE]; |
341 |
double axv[NPLANE],ayv[NPLANE]; |
double axv[NPLANE],ayv[NPLANE]; |
342 |
double cov[5][5]; |
double cov[5][5]; |
343 |
|
double fact; |
344 |
int nstep; |
int nstep; |
345 |
int idcand; |
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 |
* \Struct for the hough transform variables |
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 |
* \brief Struct to pass VA1-mask to F77 routines |
527 |
*/ |
*/ |
528 |
struct cTrkMask { |
struct cTrkMask { |
530 |
int mask_vk[NVK][NVIEW]; |
int mask_vk[NVK][NVIEW]; |
531 |
int mask_vk_run[NVK][NVIEW]; |
int mask_vk_run[NVK][NVIEW]; |
532 |
|
|
533 |
void Set(TFile* , Int_t , Int_t ); |
// 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" { |
extern "C" { |
576 |
|
|
577 |
extern struct cTrkCalib pedsigbad_; |
extern struct cTrkCalib pedsigbad_; |
578 |
|
extern struct cTrkMask mask_; |
579 |
extern struct cTrkLevel0 level0event_; |
extern struct cTrkLevel0 level0event_; |
580 |
extern struct cTrkLevel1 level1event_; |
extern struct cTrkLevel1 level1event_; |
581 |
extern struct cTrkLevel2 level2event_; |
extern struct cTrkLevel2 level2event_; |
582 |
extern struct cPath path_; |
extern struct cPath path_; |
|
/* extern struct cBPath bpath_; */ |
|
583 |
extern struct cDbg dbg_; |
extern struct cDbg dbg_; |
584 |
extern struct cTrkHough houghevent_; |
extern struct cTrkHough houghevent_; |
585 |
|
extern struct cTrkCandidates trackcandidates_; |
586 |
extern struct cMini2track track_; |
extern struct cMini2track track_; |
587 |
extern struct cTrkMask mask_; |
extern struct cTrkETA pfa_; |
588 |
|
extern struct cTrkSW sw_; |
589 |
|
extern struct cDeltaB deltab_; |
590 |
|
|
591 |
void fillpedsigfromdefault_(); |
void fillpedsigfromdefault_(); |
592 |
int readmipparam_(); |
int readmipparam_(); |
596 |
int readetaparam_(); |
int readetaparam_(); |
597 |
void reductionflight_(int*); |
void reductionflight_(int*); |
598 |
int analysisflight_(); |
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 |
#endif |
|
|
|