1 |
/** |
2 |
* \file TrkStruct.h |
3 |
* \author Elena Vannuccini |
4 |
* \date |
5 |
*/ |
6 |
#ifndef trkstruct_h |
7 |
#define trkstruct_h |
8 |
|
9 |
#define NTRKMAX 10 |
10 |
#define NSINGMAX 100 |
11 |
|
12 |
#define NCLMAX_VIEW 200 |
13 |
#define NCLSTR 19 |
14 |
#define NCLMAX (NCLMAX_VIEW*12) |
15 |
#define NCLBUFF (NCLMAX*NCLSTR) |
16 |
|
17 |
#include <CalibTrk1Event.h> |
18 |
#include <CalibTrk2Event.h> |
19 |
|
20 |
#include <TString.h> |
21 |
#include <TFile.h> |
22 |
#include <TTree.h> |
23 |
|
24 |
#include <fstream> |
25 |
#include <iostream> |
26 |
/** |
27 |
* \brief Struct to pass calibration parameters to F77 routines |
28 |
*/ |
29 |
struct cTrkCalib { |
30 |
|
31 |
float pedestal[128][24][12]; |
32 |
float pedestal_t[128][24][12]; |
33 |
float sigma[128][24][12]; |
34 |
float sigma_t[128][24][12]; |
35 |
int bad[128][24][12]; |
36 |
|
37 |
void FillACalibFrom(TFile* , Int_t , Int_t ); |
38 |
void FillFCalibFrom(TFile* , Int_t , Int_t ); |
39 |
void FillTCalibFrom(TFile* , Int_t , Int_t ); |
40 |
void FillTCalibFrom(TString); |
41 |
|
42 |
}; |
43 |
// ================================================================== |
44 |
/** |
45 |
* \brief Struct to pass tracker LEVEL0 data to F77 routines |
46 |
*/ |
47 |
struct cTrkLevel0 { |
48 |
int DAQmode[12]; |
49 |
int DSPnumber[12]; |
50 |
int DATAlength[12]; |
51 |
int eventn[12]; |
52 |
int nclust[12]; |
53 |
int cutc[12]; |
54 |
int cutcl[12]; |
55 |
int addrcluster[3][12]; |
56 |
int signcluster[3][12]; |
57 |
int fc[12]; |
58 |
int compressiontime[12]; |
59 |
int fl5[12]; |
60 |
int fl4[12]; |
61 |
int fl3[12]; |
62 |
int fl2[12]; |
63 |
int fl1[12]; |
64 |
int fl6[12]; |
65 |
int checksum[12]; |
66 |
int TOTDATAlength; |
67 |
int datatracker[49152]; |
68 |
int pnum[12]; |
69 |
int cmdnum[12]; |
70 |
int bid[12]; |
71 |
int alarm[12]; |
72 |
int aswr[12]; |
73 |
int good0; |
74 |
int crc[12]; |
75 |
}; |
76 |
// ================================================================== |
77 |
/** |
78 |
* \brief Struct to pass tracker LEVEL1 data to F77 routines |
79 |
*/ |
80 |
struct cTrkLevel1 { |
81 |
// int good1; |
82 |
int good[12]; |
83 |
int nclstr1; |
84 |
int view[NCLMAX]; |
85 |
int ladder[NCLMAX]; |
86 |
int maxs[NCLMAX]; |
87 |
int mult[NCLMAX]; |
88 |
float dedx[NCLMAX]; |
89 |
int indstart[NCLMAX]; |
90 |
int indmax[NCLMAX]; |
91 |
int totCLlength; |
92 |
float clsignal[NCLBUFF]; |
93 |
float clsigma[NCLBUFF]; |
94 |
int cladc[NCLBUFF]; |
95 |
int clbad[NCLBUFF]; |
96 |
float cnev[24][12]; |
97 |
int cnnev[24][12]; |
98 |
int fshower[12]; |
99 |
int whichtrack[NCLMAX]; |
100 |
}; |
101 |
// ================================================================== |
102 |
/** |
103 |
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
104 |
*/ |
105 |
struct cTrkLevel2 { |
106 |
// int good2; |
107 |
// int crc[12]; |
108 |
int good[12]; |
109 |
// ---------------------------- |
110 |
int nclsx; |
111 |
int planex[NSINGMAX]; |
112 |
float xs[NSINGMAX][2]; |
113 |
float signlxs[NSINGMAX]; |
114 |
int clsx[NSINGMAX]; |
115 |
// ---------------------------- |
116 |
int nclsy; |
117 |
int planey[NSINGMAX]; |
118 |
float ys[NSINGMAX][2]; |
119 |
float signlys[NSINGMAX]; |
120 |
int clsy[NSINGMAX]; |
121 |
// ---------------------------- |
122 |
int ntrk; |
123 |
int image[NTRKMAX]; |
124 |
float xm_nt[NTRKMAX][6]; |
125 |
float ym_nt[NTRKMAX][6]; |
126 |
float zm_nt[NTRKMAX][6]; |
127 |
float resx_nt[NTRKMAX][6]; |
128 |
float resy_nt[NTRKMAX][6]; |
129 |
float al_nt[NTRKMAX][5]; |
130 |
float coval[NTRKMAX][5][5]; |
131 |
float chi2_nt[NTRKMAX]; |
132 |
int nstep_nt[NTRKMAX]; |
133 |
int xgood_nt[NTRKMAX][6]; |
134 |
int ygood_nt[NTRKMAX][6]; |
135 |
float xv_nt[NTRKMAX][6]; |
136 |
float yv_nt[NTRKMAX][6]; |
137 |
float zv_nt[NTRKMAX][6]; |
138 |
float axv_nt[NTRKMAX][6]; |
139 |
float ayv_nt[NTRKMAX][6]; |
140 |
float dedx_x[NTRKMAX][6]; |
141 |
float dedx_y[NTRKMAX][6]; |
142 |
int cltrx[NTRKMAX][6]; |
143 |
int cltry[NTRKMAX][6]; |
144 |
// float bdl[NTRKMAX]; |
145 |
|
146 |
void InitcTrkLevel2(){ |
147 |
|
148 |
// good2 = 0; |
149 |
for(Int_t i=0; i<12 ; i++) |
150 |
// crc[i] = 0; |
151 |
good[i] = 0; |
152 |
// ---------------------------- |
153 |
nclsx = 0; |
154 |
nclsy = 0; |
155 |
for(Int_t i=0; i<NSINGMAX ; i++){ |
156 |
planex[i] = 0; |
157 |
xs[i][0] = 0; |
158 |
xs[i][1] = 0; |
159 |
signlxs[i] = 0; |
160 |
planey[i] = 0; |
161 |
ys[i][0] = 0; |
162 |
ys[i][1] = 0; |
163 |
signlys[i] = 0; |
164 |
} |
165 |
// ---------------------------- |
166 |
ntrk =0 ; |
167 |
|
168 |
for(Int_t i=0; i<NTRKMAX ; i++){ |
169 |
image[i] = 0; |
170 |
chi2_nt[i] = 0; |
171 |
// bdl[i] = 0; |
172 |
|
173 |
for(Int_t ii=0; ii<5 ; ii++){ |
174 |
al_nt[i][ii] = 0; |
175 |
for(Int_t iii=0; iii<5 ; iii++) |
176 |
coval[i][ii][iii] = 0; |
177 |
} |
178 |
|
179 |
for(Int_t ii=0; ii<6 ; ii++){ |
180 |
xm_nt[i][ii] = 0; |
181 |
ym_nt[i][ii] = 0; |
182 |
zm_nt[i][ii] = 0; |
183 |
resx_nt[i][ii] = 0; |
184 |
resy_nt[i][ii] = 0; |
185 |
xgood_nt[i][ii] = 0; |
186 |
ygood_nt[i][ii] = 0; |
187 |
xv_nt[i][ii] = 0; |
188 |
yv_nt[i][ii] = 0; |
189 |
zv_nt[i][ii] = 0; |
190 |
axv_nt[i][ii] = 0; |
191 |
ayv_nt[i][ii] = 0; |
192 |
dedx_x[i][ii] = 0; |
193 |
dedx_y[i][ii] = 0; |
194 |
} |
195 |
} |
196 |
} |
197 |
|
198 |
}; |
199 |
// ================================================================== |
200 |
/** |
201 |
* \brief Struct to pass calibration/parameter file paths to F77 routines |
202 |
*/ |
203 |
struct cPath { |
204 |
char path[80]; |
205 |
int pathlen; |
206 |
int error; |
207 |
/** |
208 |
* Fill the struct variables from a TString object |
209 |
*/ |
210 |
void FillWith(TString s){ |
211 |
pathlen = s.Length(); |
212 |
const char *pc = s.Data(); |
213 |
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
214 |
}; |
215 |
|
216 |
|
217 |
}; |
218 |
|
219 |
// ================================================================== |
220 |
/** |
221 |
* \brief Struct to pass magnetic-field file paths to F77 routines |
222 |
*/ |
223 |
struct cBPath { |
224 |
char b_path[80]; |
225 |
int b_pathlen; |
226 |
int b_error; |
227 |
int b_loaded; |
228 |
/** |
229 |
* Fill the struct variables from a TString object and set |
230 |
* the load flag to FALSE. |
231 |
*/ |
232 |
void FillWith(TString s){ |
233 |
b_loaded = 0; |
234 |
b_pathlen = s.Length(); |
235 |
const char *pc = s.Data(); |
236 |
for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; |
237 |
}; |
238 |
/** |
239 |
* Fill the struct variables from a TString object |
240 |
*/ |
241 |
int BIsLoaded(){ return b_loaded; }; |
242 |
|
243 |
}; |
244 |
|
245 |
// ================================================================== |
246 |
/** |
247 |
* \brief Struct to set debug mode in F77 routines |
248 |
*/ |
249 |
struct cDbg { |
250 |
int debug; |
251 |
int verbose; |
252 |
int warning; |
253 |
// bool debug; |
254 |
// bool verbose; |
255 |
void SetNone() {debug=0; verbose=0; warning=0;}; |
256 |
void SetWarning(){debug=0; verbose=0; warning=1;}; |
257 |
void SetVerbose(){debug=0; verbose=1; warning=1;}; |
258 |
void SetDebug() {debug=1; verbose=1; warning=1;}; |
259 |
}; |
260 |
|
261 |
extern "C" { |
262 |
extern struct cTrkCalib pedsigbad_; |
263 |
extern struct cTrkLevel0 level0event_; |
264 |
extern struct cTrkLevel1 level1event_; |
265 |
extern struct cTrkLevel2 level2event_; |
266 |
extern struct cPath path_; |
267 |
extern struct cBPath bpath_; |
268 |
extern struct cDbg dbg_; |
269 |
void fillpedsigfromdefault_(); |
270 |
int readmipparam_(); |
271 |
int readchargeparam_(); |
272 |
int readvkmask_(); |
273 |
int readalignparam_(); |
274 |
int readetaparam_(); |
275 |
void reductionflight_(int*); |
276 |
int analysisflight_(); |
277 |
} |
278 |
|
279 |
|
280 |
#endif |
281 |
|