9 |
#define NTRKMAX 10 |
#define NTRKMAX 10 |
10 |
#define NSINGMAX 100 |
#define NSINGMAX 100 |
11 |
|
|
12 |
|
#define NCLMAX_VIEW 50 |
13 |
|
#define NCLSTR 20 |
14 |
|
#define NCLMAX (NCLMAX_VIEW*12) |
15 |
|
#define NCLBUFF (NCLMAX*NCLSTR) |
16 |
|
|
17 |
|
#define NPLANE 6 |
18 |
|
|
19 |
|
#include <CalibTrk1Event.h> |
20 |
|
#include <CalibTrk2Event.h> |
21 |
|
|
22 |
#include <TString.h> |
#include <TString.h> |
23 |
#include <TFile.h> |
#include <TFile.h> |
24 |
|
#include <TTree.h> |
25 |
|
|
26 |
|
#include <fstream> |
27 |
|
#include <iostream> |
28 |
/** |
/** |
29 |
* \brief Struct to pass calibration data to F77 routines |
* \brief Struct to pass calibration parameters to F77 routines |
30 |
*/ |
*/ |
31 |
struct cTrkCalib { |
struct cTrkCalib { |
32 |
|
|
33 |
float pedestal[128][24][12]; |
float pedestal[128][24][12]; |
34 |
float pedestal_t[128][24][12]; |
float pedestal_t[128][24][12]; |
35 |
float sigma[128][24][12]; |
float sigma[128][24][12]; |
36 |
float sigma_t[128][24][12]; |
float sigma_t[128][24][12]; |
37 |
int bad[128][24][12]; |
int bad[128][24][12]; |
38 |
|
|
39 |
void FillFrom(TFile* , Int_t , Int_t ); |
void FillACalibFrom(TFile* , Int_t , Int_t ); |
40 |
|
void FillFCalibFrom(TFile* , Int_t , Int_t ); |
41 |
|
void FillTCalibFrom(TFile* , Int_t , Int_t ); |
42 |
|
void FillTCalibFrom(TString); |
43 |
|
|
44 |
}; |
}; |
45 |
// ================================================================== |
// ================================================================== |
46 |
/** |
/** |
80 |
* \brief Struct to pass tracker LEVEL1 data to F77 routines |
* \brief Struct to pass tracker LEVEL1 data to F77 routines |
81 |
*/ |
*/ |
82 |
struct cTrkLevel1 { |
struct cTrkLevel1 { |
83 |
int good1; |
// int good1; |
84 |
|
int good[12]; |
85 |
int nclstr1; |
int nclstr1; |
86 |
int view[500]; |
int view[NCLMAX]; |
87 |
int ladder[500]; |
int ladder[NCLMAX]; |
88 |
int maxs[500]; |
int maxs[NCLMAX]; |
89 |
int mult[500]; |
int mult[NCLMAX]; |
90 |
float dedx[500]; |
float dedx[NCLMAX]; |
91 |
int indstart[500]; |
int indstart[NCLMAX]; |
92 |
int indmax[500]; |
int indmax[NCLMAX]; |
93 |
int totCLlength; |
int totCLlength; |
94 |
float clsignal[8500]; |
float clsignal[NCLBUFF]; |
95 |
float cnev[24][12]; |
float clsigma[NCLBUFF]; |
96 |
|
int cladc[NCLBUFF]; |
97 |
|
int clbad[NCLBUFF]; |
98 |
|
float cnev[24][12]; |
99 |
|
int cnnev[24][12]; |
100 |
|
float cnrmsev[24][12]; |
101 |
|
int fshower[12]; |
102 |
|
int whichtrack[NCLMAX]; |
103 |
}; |
}; |
104 |
// ================================================================== |
// ================================================================== |
105 |
/** |
/** |
106 |
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
107 |
*/ |
*/ |
108 |
struct cTrkLevel2 { |
struct cTrkLevel2 { |
109 |
int good2; |
// int good2; |
110 |
int crc[12]; |
// int crc[12]; |
111 |
|
int good[12]; |
112 |
// ---------------------------- |
// ---------------------------- |
113 |
int nclsx; |
int nclsx; |
114 |
int planex[NSINGMAX]; |
int planex[NSINGMAX]; |
115 |
float xs[NSINGMAX][2]; |
float xs[NSINGMAX][2]; |
116 |
float signlxs[NSINGMAX]; |
float signlxs[NSINGMAX]; |
117 |
|
int clsx[NSINGMAX]; |
118 |
// ---------------------------- |
// ---------------------------- |
119 |
int nclsy; |
int nclsy; |
120 |
int planey[NSINGMAX]; |
int planey[NSINGMAX]; |
121 |
float ys[NSINGMAX][2]; |
float ys[NSINGMAX][2]; |
122 |
float signlys[NSINGMAX]; |
float signlys[NSINGMAX]; |
123 |
|
int clsy[NSINGMAX]; |
124 |
// ---------------------------- |
// ---------------------------- |
125 |
int ntrk; |
int ntrk; |
126 |
int image[NTRKMAX]; |
int image[NTRKMAX]; |
132 |
float al_nt[NTRKMAX][5]; |
float al_nt[NTRKMAX][5]; |
133 |
float coval[NTRKMAX][5][5]; |
float coval[NTRKMAX][5][5]; |
134 |
float chi2_nt[NTRKMAX]; |
float chi2_nt[NTRKMAX]; |
135 |
|
int nstep_nt[NTRKMAX]; |
136 |
int xgood_nt[NTRKMAX][6]; |
int xgood_nt[NTRKMAX][6]; |
137 |
int ygood_nt[NTRKMAX][6]; |
int ygood_nt[NTRKMAX][6]; |
138 |
float xv_nt[NTRKMAX][6]; |
float xv_nt[NTRKMAX][6]; |
142 |
float ayv_nt[NTRKMAX][6]; |
float ayv_nt[NTRKMAX][6]; |
143 |
float dedx_x[NTRKMAX][6]; |
float dedx_x[NTRKMAX][6]; |
144 |
float dedx_y[NTRKMAX][6]; |
float dedx_y[NTRKMAX][6]; |
145 |
float bdl[NTRKMAX]; |
int cltrx[NTRKMAX][6]; |
146 |
|
int cltry[NTRKMAX][6]; |
147 |
|
// float bdl[NTRKMAX]; |
148 |
|
|
149 |
|
void InitcTrkLevel2(){ |
150 |
|
|
151 |
|
// good2 = 0; |
152 |
|
for(Int_t i=0; i<12 ; i++) |
153 |
|
// crc[i] = 0; |
154 |
|
good[i] = 0; |
155 |
|
// ---------------------------- |
156 |
|
nclsx = 0; |
157 |
|
nclsy = 0; |
158 |
|
for(Int_t i=0; i<NSINGMAX ; i++){ |
159 |
|
planex[i] = 0; |
160 |
|
xs[i][0] = 0; |
161 |
|
xs[i][1] = 0; |
162 |
|
signlxs[i] = 0; |
163 |
|
planey[i] = 0; |
164 |
|
ys[i][0] = 0; |
165 |
|
ys[i][1] = 0; |
166 |
|
signlys[i] = 0; |
167 |
|
} |
168 |
|
// ---------------------------- |
169 |
|
ntrk =0 ; |
170 |
|
|
171 |
|
for(Int_t i=0; i<NTRKMAX ; i++){ |
172 |
|
image[i] = 0; |
173 |
|
chi2_nt[i] = 0; |
174 |
|
// bdl[i] = 0; |
175 |
|
|
176 |
|
for(Int_t ii=0; ii<5 ; ii++){ |
177 |
|
al_nt[i][ii] = 0; |
178 |
|
for(Int_t iii=0; iii<5 ; iii++) |
179 |
|
coval[i][ii][iii] = 0; |
180 |
|
} |
181 |
|
|
182 |
|
for(Int_t ii=0; ii<6 ; ii++){ |
183 |
|
xm_nt[i][ii] = 0; |
184 |
|
ym_nt[i][ii] = 0; |
185 |
|
zm_nt[i][ii] = 0; |
186 |
|
resx_nt[i][ii] = 0; |
187 |
|
resy_nt[i][ii] = 0; |
188 |
|
xgood_nt[i][ii] = 0; |
189 |
|
ygood_nt[i][ii] = 0; |
190 |
|
xv_nt[i][ii] = 0; |
191 |
|
yv_nt[i][ii] = 0; |
192 |
|
zv_nt[i][ii] = 0; |
193 |
|
axv_nt[i][ii] = 0; |
194 |
|
ayv_nt[i][ii] = 0; |
195 |
|
dedx_x[i][ii] = 0; |
196 |
|
dedx_y[i][ii] = 0; |
197 |
|
} |
198 |
|
} |
199 |
|
} |
200 |
|
|
201 |
}; |
}; |
202 |
// ================================================================== |
// ================================================================== |
203 |
/** |
/** |
204 |
* \brief Struct to pass calibration/parameter file paths to F77 routines |
* \brief Struct to pass calibration/parameter file paths to F77 routines |
205 |
*/ |
*/ |
206 |
struct cPath { |
struct cPath { |
207 |
char path[80]; |
char path[256]; |
208 |
int pathlen; |
int pathlen; |
209 |
int error; |
int error; |
|
int debug; |
|
210 |
/** |
/** |
211 |
* Fill the struct variables from a TString object |
* Fill the struct variables from a TString object |
212 |
*/ |
*/ |
213 |
void FillWith(TString s){ |
void FillWith(TString s){ |
214 |
pathlen = s.Length(); |
pathlen = s.Length(); |
215 |
const char *pc = s.Data(); |
const char *pc = s.Data(); |
216 |
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
217 |
}; |
}; |
218 |
|
|
219 |
void SetDebug(){ debug=1;}; |
|
|
|
|
220 |
}; |
}; |
221 |
|
|
222 |
// ================================================================== |
// ================================================================== |
224 |
* \brief Struct to pass magnetic-field file paths to F77 routines |
* \brief Struct to pass magnetic-field file paths to F77 routines |
225 |
*/ |
*/ |
226 |
struct cBPath { |
struct cBPath { |
227 |
char b_path[80]; |
char b_path[256]; |
228 |
int b_pathlen; |
int b_pathlen; |
229 |
int b_error; |
int b_error; |
|
int b_debug; |
|
230 |
int b_loaded; |
int b_loaded; |
231 |
/** |
/** |
232 |
* Fill the struct variables from a TString object and set |
* Fill the struct variables from a TString object and set |
242 |
* Fill the struct variables from a TString object |
* Fill the struct variables from a TString object |
243 |
*/ |
*/ |
244 |
int BIsLoaded(){ return b_loaded; }; |
int BIsLoaded(){ return b_loaded; }; |
|
void SetDebug(){ b_debug=1; }; |
|
245 |
|
|
246 |
}; |
}; |
247 |
|
|
248 |
|
// ================================================================== |
249 |
|
/** |
250 |
|
* \brief Struct to set debug mode in F77 routines |
251 |
|
*/ |
252 |
|
struct cDbg { |
253 |
|
int debug; |
254 |
|
int verbose; |
255 |
|
int warning; |
256 |
|
// bool debug; |
257 |
|
// bool verbose; |
258 |
|
void SetNone() {debug=0; verbose=0; warning=0;}; |
259 |
|
void SetWarning(){debug=0; verbose=0; warning=1;}; |
260 |
|
void SetVerbose(){debug=0; verbose=1; warning=1;}; |
261 |
|
void SetDebug() {debug=1; verbose=1; warning=1;}; |
262 |
|
}; |
263 |
|
|
264 |
|
|
265 |
|
// ================================================================== |
266 |
|
/** |
267 |
|
* \brief Struct to pass mini2 track parameters to F77 routines |
268 |
|
*/ |
269 |
|
struct cMini2track { |
270 |
|
double al[5]; |
271 |
|
double xm[NPLANE],ym[NPLANE],zm[NPLANE]; |
272 |
|
double xm_a[NPLANE],ym_a[NPLANE]; |
273 |
|
double xm_b[NPLANE],ym_b[NPLANE]; |
274 |
|
double resx[NPLANE],resy[NPLANE]; |
275 |
|
double xgood[NPLANE],ygood[NPLANE]; |
276 |
|
double dedxtrk_x[NPLANE]; |
277 |
|
double dedxtrk_y[NPLANE]; |
278 |
|
double zini; |
279 |
|
double pfixed; |
280 |
|
double chi2; |
281 |
|
double xv[NPLANE],yv[NPLANE],zv[NPLANE]; |
282 |
|
double axv[NPLANE],ayv[NPLANE]; |
283 |
|
double cov[5][5]; |
284 |
|
int nstep; |
285 |
|
int idcand; |
286 |
|
}; |
287 |
|
// |
288 |
|
|
289 |
|
|
290 |
|
extern "C" { |
291 |
|
|
292 |
|
extern struct cTrkCalib pedsigbad_; |
293 |
|
extern struct cTrkLevel0 level0event_; |
294 |
|
extern struct cTrkLevel1 level1event_; |
295 |
|
extern struct cTrkLevel2 level2event_; |
296 |
|
extern struct cPath path_; |
297 |
|
extern struct cBPath bpath_; |
298 |
|
extern struct cDbg dbg_; |
299 |
|
extern struct cMini2track track_; |
300 |
|
|
301 |
|
void fillpedsigfromdefault_(); |
302 |
|
int readmipparam_(); |
303 |
|
int readchargeparam_(); |
304 |
|
int readvkmask_(); |
305 |
|
int readalignparam_(); |
306 |
|
int readetaparam_(); |
307 |
|
void reductionflight_(int*); |
308 |
|
int analysisflight_(); |
309 |
|
} |
310 |
|
|
311 |
|
|
312 |
#endif |
#endif |
313 |
|
|