6 |
#ifndef trkstruct_h |
#ifndef trkstruct_h |
7 |
#define trkstruct_h |
#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 |
#define NTRKMAX 10 |
25 |
#define NSINGMAX 100 |
#define NSINGMAX NCLMAX //100 |
26 |
|
|
27 |
|
#define NANGMAX 21 |
28 |
|
#define NETAVALMAX 500 |
29 |
|
|
30 |
|
|
31 |
|
#include <CalibTrk1Event.h> |
32 |
|
#include <CalibTrk2Event.h> |
33 |
|
using namespace pamela; |
34 |
|
//#include <TrkCalib.h> |
35 |
|
|
36 |
#include <TString.h> |
#include <TString.h> |
37 |
#include <TFile.h> |
#include <TFile.h> |
38 |
|
#include <TTree.h> |
39 |
|
|
40 |
|
|
41 |
|
#include <fstream> |
42 |
|
#include <iostream> |
43 |
/** |
/** |
44 |
* \brief Struct to pass calibration data to F77 routines |
* \brief Struct to pass calibration parameters to F77 routines |
45 |
*/ |
*/ |
46 |
struct cTrkCalib { |
struct cTrkCalib { |
47 |
|
|
48 |
float pedestal[128][24][12]; |
float pedestal[128][24][12]; |
49 |
float pedestal_t[128][24][12]; |
float pedestal_t[128][24][12]; |
50 |
float sigma[128][24][12]; |
float sigma[128][24][12]; |
51 |
float sigma_t[128][24][12]; |
float sigma_t[128][24][12]; |
52 |
int bad[128][24][12]; |
int bad[128][24][12]; |
53 |
|
|
54 |
void FillFrom(TFile* , Int_t , Int_t ); |
/* void FillACalibFrom(TFile* , Int_t , Int_t ); */ |
55 |
|
/* void FillFCalibFrom(TFile* , Int_t , Int_t ); */ |
56 |
|
/* void FillTCalibFrom(TFile* , Int_t , Int_t ); */ |
57 |
|
/* void FillTCalibFrom(TString); */ |
58 |
|
|
59 |
}; |
}; |
60 |
// ================================================================== |
// ================================================================== |
61 |
/** |
/** |
95 |
* \brief Struct to pass tracker LEVEL1 data to F77 routines |
* \brief Struct to pass tracker LEVEL1 data to F77 routines |
96 |
*/ |
*/ |
97 |
struct cTrkLevel1 { |
struct cTrkLevel1 { |
98 |
int good1; |
// int good1; |
99 |
|
int good[12]; |
100 |
int nclstr1; |
int nclstr1; |
101 |
int view[500]; |
int view[NCLMAX]; |
102 |
int ladder[500]; |
int ladder[NCLMAX]; |
103 |
int maxs[500]; |
int maxs[NCLMAX]; |
104 |
int mult[500]; |
int mult[NCLMAX]; |
105 |
float dedx[500]; |
float dedx[NCLMAX]; |
106 |
int indstart[500]; |
int indstart[NCLMAX]; |
107 |
int indmax[500]; |
int indmax[NCLMAX]; |
108 |
int totCLlength; |
int totCLlength; |
109 |
float clsignal[8500]; |
float clsignal[NCLBUFF]; |
110 |
float cnev[24][12]; |
float clsigma[NCLBUFF]; |
111 |
|
int cladc[NCLBUFF]; |
112 |
|
int clbad[NCLBUFF]; |
113 |
|
float cnev[24][12]; |
114 |
|
int cnnev[24][12]; |
115 |
|
float cnrmsev[24][12]; |
116 |
|
int fshower[12]; |
117 |
|
int whichtrack[NCLMAX]; |
118 |
|
|
119 |
}; |
}; |
120 |
// ================================================================== |
// ================================================================== |
121 |
/** |
/** |
122 |
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
123 |
*/ |
*/ |
124 |
struct cTrkLevel2 { |
struct cTrkLevel2 { |
125 |
int good2; |
// int good2; |
126 |
int crc[12]; |
// int crc[12]; |
127 |
|
int good[12]; |
128 |
// ---------------------------- |
// ---------------------------- |
129 |
int nclsx; |
int nclsx; |
130 |
int planex[NSINGMAX]; |
int planex[NSINGMAX]; |
131 |
float xs[NSINGMAX][2]; |
float xs[NSINGMAX][2]; |
132 |
float signlxs[NSINGMAX]; |
float signlxs[NSINGMAX]; |
133 |
|
int clsx[NSINGMAX]; |
134 |
// ---------------------------- |
// ---------------------------- |
135 |
int nclsy; |
int nclsy; |
136 |
int planey[NSINGMAX]; |
int planey[NSINGMAX]; |
137 |
float ys[NSINGMAX][2]; |
float ys[NSINGMAX][2]; |
138 |
float signlys[NSINGMAX]; |
float signlys[NSINGMAX]; |
139 |
|
int clsy[NSINGMAX]; |
140 |
// ---------------------------- |
// ---------------------------- |
141 |
int ntrk; |
int ntrk; |
142 |
int image[NTRKMAX]; |
int image[NTRKMAX]; |
148 |
float al_nt[NTRKMAX][5]; |
float al_nt[NTRKMAX][5]; |
149 |
float coval[NTRKMAX][5][5]; |
float coval[NTRKMAX][5][5]; |
150 |
float chi2_nt[NTRKMAX]; |
float chi2_nt[NTRKMAX]; |
151 |
|
int nstep_nt[NTRKMAX]; |
152 |
int xgood_nt[NTRKMAX][6]; |
int xgood_nt[NTRKMAX][6]; |
153 |
int ygood_nt[NTRKMAX][6]; |
int ygood_nt[NTRKMAX][6]; |
154 |
float xv_nt[NTRKMAX][6]; |
float xv_nt[NTRKMAX][6]; |
158 |
float ayv_nt[NTRKMAX][6]; |
float ayv_nt[NTRKMAX][6]; |
159 |
float dedx_x[NTRKMAX][6]; |
float dedx_x[NTRKMAX][6]; |
160 |
float dedx_y[NTRKMAX][6]; |
float dedx_y[NTRKMAX][6]; |
161 |
float bdl[NTRKMAX]; |
int cltrx[NTRKMAX][6]; |
162 |
|
int cltry[NTRKMAX][6]; |
163 |
|
// float bdl[NTRKMAX]; |
164 |
|
|
165 |
|
void InitcTrkLevel2(){ |
166 |
|
|
167 |
|
// good2 = 0; |
168 |
|
for(Int_t i=0; i<12 ; i++) |
169 |
|
// crc[i] = 0; |
170 |
|
good[i] = 0; |
171 |
|
// ---------------------------- |
172 |
|
nclsx = 0; |
173 |
|
nclsy = 0; |
174 |
|
for(Int_t i=0; i<NSINGMAX ; i++){ |
175 |
|
planex[i] = 0; |
176 |
|
xs[i][0] = 0; |
177 |
|
xs[i][1] = 0; |
178 |
|
signlxs[i] = 0; |
179 |
|
planey[i] = 0; |
180 |
|
ys[i][0] = 0; |
181 |
|
ys[i][1] = 0; |
182 |
|
signlys[i] = 0; |
183 |
|
} |
184 |
|
// ---------------------------- |
185 |
|
ntrk =0 ; |
186 |
|
|
187 |
|
for(Int_t i=0; i<NTRKMAX ; i++){ |
188 |
|
image[i] = 0; |
189 |
|
chi2_nt[i] = 0; |
190 |
|
// bdl[i] = 0; |
191 |
|
|
192 |
|
for(Int_t ii=0; ii<5 ; ii++){ |
193 |
|
al_nt[i][ii] = 0; |
194 |
|
for(Int_t iii=0; iii<5 ; iii++) |
195 |
|
coval[i][ii][iii] = 0; |
196 |
|
} |
197 |
|
|
198 |
|
for(Int_t ii=0; ii<6 ; ii++){ |
199 |
|
xm_nt[i][ii] = 0; |
200 |
|
ym_nt[i][ii] = 0; |
201 |
|
zm_nt[i][ii] = 0; |
202 |
|
resx_nt[i][ii] = 0; |
203 |
|
resy_nt[i][ii] = 0; |
204 |
|
xgood_nt[i][ii] = 0; |
205 |
|
ygood_nt[i][ii] = 0; |
206 |
|
xv_nt[i][ii] = 0; |
207 |
|
yv_nt[i][ii] = 0; |
208 |
|
zv_nt[i][ii] = 0; |
209 |
|
axv_nt[i][ii] = 0; |
210 |
|
ayv_nt[i][ii] = 0; |
211 |
|
dedx_x[i][ii] = 0; |
212 |
|
dedx_y[i][ii] = 0; |
213 |
|
} |
214 |
|
} |
215 |
|
} |
216 |
|
|
217 |
}; |
}; |
218 |
// ================================================================== |
// ================================================================== |
219 |
/** |
/** |
220 |
* \brief Struct to pass calibration/parameter file paths to F77 routines |
* \brief Struct to pass calibration/parameter file paths to F77 routines |
221 |
*/ |
*/ |
222 |
struct cPath { |
struct cPath { |
223 |
char path[80]; |
char path[256]; |
224 |
int pathlen; |
int pathlen; |
225 |
int error; |
int error; |
|
int debug; |
|
226 |
/** |
/** |
227 |
* Fill the struct variables from a TString object |
* Fill the struct variables from a TString object |
228 |
*/ |
*/ |
229 |
void FillWith(TString s){ |
void FillWith(TString s){ |
230 |
pathlen = s.Length(); |
pathlen = s.Length(); |
231 |
const char *pc = s.Data(); |
const char *pc = s.Data(); |
232 |
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
233 |
}; |
}; |
234 |
|
|
235 |
void SetDebug(){ debug=1;}; |
}; |
236 |
|
|
237 |
|
// ================================================================== |
238 |
|
/* /\** */ |
239 |
|
/* * \brief Struct to pass magnetic-field file paths to F77 routines */ |
240 |
|
/* *\/ */ |
241 |
|
/* struct cBPath { */ |
242 |
|
/* char b_path[256]; */ |
243 |
|
/* int b_pathlen; */ |
244 |
|
/* int b_error; */ |
245 |
|
/* int b_loaded; */ |
246 |
|
/* /\** */ |
247 |
|
/* * Fill the struct variables from a TString object and set */ |
248 |
|
/* * the load flag to FALSE. */ |
249 |
|
/* *\/ */ |
250 |
|
/* void FillWith(TString s){ */ |
251 |
|
/* b_loaded = 0; */ |
252 |
|
/* b_pathlen = s.Length(); */ |
253 |
|
/* const char *pc = s.Data(); */ |
254 |
|
/* for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; */ |
255 |
|
/* }; */ |
256 |
|
/* /\** */ |
257 |
|
/* * Fill the struct variables from a TString object */ |
258 |
|
/* *\/ */ |
259 |
|
/* int BIsLoaded(){ return b_loaded; }; */ |
260 |
|
|
261 |
|
/* }; */ |
262 |
|
|
263 |
|
// ================================================================== |
264 |
|
/** |
265 |
|
* \brief Struct to set debug mode in F77 routines |
266 |
|
*/ |
267 |
|
struct cDbg { |
268 |
|
int debug; |
269 |
|
int verbose; |
270 |
|
int warning; |
271 |
|
// bool debug; |
272 |
|
// bool verbose; |
273 |
|
void SetNone() {debug=0; verbose=0; warning=0;}; |
274 |
|
void SetWarning(){debug=0; verbose=0; warning=1;}; |
275 |
|
void SetVerbose(){debug=0; verbose=1; warning=1;}; |
276 |
|
void SetDebug() {debug=1; verbose=1; warning=1;}; |
277 |
}; |
}; |
278 |
|
|
279 |
|
|
280 |
// ================================================================== |
// ================================================================== |
281 |
/** |
/** |
282 |
* \brief Struct to pass magnetic-field file paths to F77 routines |
* \brief Struct to pass mini2 track parameters to F77 routines |
283 |
*/ |
*/ |
284 |
struct cBPath { |
struct cMini2track { |
285 |
char b_path[80]; |
double al[5]; |
286 |
int b_pathlen; |
double xm[NPLANE],ym[NPLANE],zm[NPLANE]; |
287 |
int b_error; |
double xm_a[NPLANE],ym_a[NPLANE]; |
288 |
int b_debug; |
double xm_b[NPLANE],ym_b[NPLANE]; |
289 |
int b_loaded; |
double resx[NPLANE],resy[NPLANE]; |
290 |
|
double xgood[NPLANE],ygood[NPLANE]; |
291 |
|
double dedxtrk_x[NPLANE]; |
292 |
|
double dedxtrk_y[NPLANE]; |
293 |
|
double zini; |
294 |
|
double pfixed; |
295 |
|
double chi2; |
296 |
|
double xv[NPLANE],yv[NPLANE],zv[NPLANE]; |
297 |
|
double axv[NPLANE],ayv[NPLANE]; |
298 |
|
double cov[5][5]; |
299 |
|
int nstep; |
300 |
|
int idcand; |
301 |
|
|
302 |
|
}; |
303 |
|
// |
304 |
/** |
/** |
305 |
* Fill the struct variables from a TString object and set |
* \Struct for the hough transform variables |
|
* the load flag to FALSE. |
|
306 |
*/ |
*/ |
307 |
void FillWith(TString s){ |
|
308 |
b_loaded = 0; |
struct cTrkHough { |
309 |
b_pathlen = s.Length(); |
|
310 |
const char *pc = s.Data(); |
int ndblt_nt; |
311 |
for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; |
float alfayz1_nt[NDBLT_MAX_NT]; |
312 |
}; |
float alfayz2_nt[NDBLT_MAX_NT]; |
313 |
|
int db_cloud_nt[NDBLT_MAX_NT]; |
314 |
|
int ntrpt_nt; |
315 |
|
float alfaxz1_nt[NTRPT_MAX_NT]; |
316 |
|
float alfaxz2_nt[NTRPT_MAX_NT]; |
317 |
|
float alfaxz3_nt[NTRPT_MAX_NT]; |
318 |
|
int tr_cloud_nt[NTRPT_MAX_NT]; |
319 |
|
int nclouds_yz_nt; |
320 |
|
float alfayz1_av_nt[NCLOYZ_MAX]; |
321 |
|
float alfayz2_av_nt[NCLOYZ_MAX]; |
322 |
|
int ptcloud_yz_nt[NCLOYZ_MAX]; |
323 |
|
int nclouds_xz_nt; |
324 |
|
float alfaxz1_av_nt[NCLOXZ_MAX]; |
325 |
|
float alfaxz2_av_nt[NCLOXZ_MAX]; |
326 |
|
float alfaxz3_av_nt[NCLOXZ_MAX]; |
327 |
|
int ptcloud_xz_nt[NCLOXZ_MAX]; |
328 |
|
int nclstr; |
329 |
|
float totaltime; |
330 |
|
float houghtime; |
331 |
|
float fittime; |
332 |
|
|
333 |
|
|
334 |
|
void InitcTrkHough(){ |
335 |
|
|
336 |
|
ndblt_nt = 0; |
337 |
|
ntrpt_nt = 0; |
338 |
|
nclouds_yz_nt = 0; |
339 |
|
nclouds_xz_nt = 0; |
340 |
|
nclstr = 0; |
341 |
|
totaltime = 0; |
342 |
|
houghtime = 0; |
343 |
|
fittime = 0; |
344 |
|
for(int i=0;i<NDBLT_MAX_NT ;i++){ |
345 |
|
alfayz1_nt[i] = 0; |
346 |
|
alfayz2_nt[i] = 0; |
347 |
|
db_cloud_nt[i] = 0; |
348 |
|
} |
349 |
|
for(int i=0;i<NTRPT_MAX_NT ;i++){ |
350 |
|
alfaxz1_nt[i] = 0; |
351 |
|
alfaxz2_nt[i] = 0; |
352 |
|
alfaxz3_nt[i] = 0; |
353 |
|
tr_cloud_nt[i] = 0; |
354 |
|
} |
355 |
|
for(int i=0;i<NCLOYZ_MAX ;i++){ |
356 |
|
alfayz1_av_nt[i] = 0; |
357 |
|
alfayz2_av_nt[i] = 0; |
358 |
|
ptcloud_yz_nt[i] = 0; |
359 |
|
} |
360 |
|
for(int i=0;i<NCLOXZ_MAX ;i++){ |
361 |
|
ptcloud_xz_nt[i] = 0; |
362 |
|
alfaxz1_av_nt[i] = 0; |
363 |
|
alfaxz2_av_nt[i] = 0; |
364 |
|
alfaxz3_av_nt[i] = 0; |
365 |
|
} |
366 |
|
} |
367 |
|
|
368 |
|
}; |
369 |
|
|
370 |
/** |
/** |
371 |
* Fill the struct variables from a TString object |
* \brief Struct to pass VA1-mask to F77 routines |
372 |
*/ |
*/ |
373 |
int BIsLoaded(){ return b_loaded; }; |
struct cTrkMask { |
374 |
void SetDebug(){ b_debug=1; }; |
|
375 |
|
int mask_vk[NVK][NVIEW]; |
376 |
|
int mask_vk_run[NVK][NVIEW]; |
377 |
|
|
378 |
|
// void Set(TFile* , Int_t , Int_t ); |
379 |
|
|
380 |
}; |
}; |
381 |
|
|
382 |
|
/** |
383 |
|
* \brief Struct for pfa parameters |
384 |
|
*/ |
385 |
|
struct cTrkETA { |
386 |
|
|
387 |
|
int nangbin; |
388 |
|
float angL[NANGMAX],angR[NANGMAX]; |
389 |
|
int netaval; |
390 |
|
float eta2[NANGMAX][NETAVALMAX]; |
391 |
|
float feta2[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
392 |
|
float eta3[NANGMAX][NETAVALMAX]; |
393 |
|
float feta3[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
394 |
|
float eta4[NANGMAX][NETAVALMAX]; |
395 |
|
float feta4[NANGMAX][NLADDER][NVIEW][NETAVALMAX]; |
396 |
|
|
397 |
#endif |
}; |
398 |
|
|
399 |
|
extern "C" { |
400 |
|
|
401 |
|
extern struct cTrkCalib pedsigbad_; |
402 |
|
extern struct cTrkMask mask_; |
403 |
|
extern struct cTrkLevel0 level0event_; |
404 |
|
extern struct cTrkLevel1 level1event_; |
405 |
|
extern struct cTrkLevel2 level2event_; |
406 |
|
extern struct cPath path_; |
407 |
|
extern struct cDbg dbg_; |
408 |
|
extern struct cTrkHough houghevent_; |
409 |
|
extern struct cMini2track track_; |
410 |
|
extern struct cTrkETA pfa_; |
411 |
|
|
412 |
|
void fillpedsigfromdefault_(); |
413 |
|
int readmipparam_(); |
414 |
|
int readchargeparam_(); |
415 |
|
int readvkmask_(); |
416 |
|
int readalignparam_(); |
417 |
|
int readetaparam_(); |
418 |
|
void reductionflight_(int*); |
419 |
|
int analysisflight_(int*); |
420 |
|
int readb_(); |
421 |
|
|
422 |
|
} |
423 |
|
|
424 |
|
#endif |