1 |
mocchiut |
1.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 |
pam-fi |
1.5 |
#define NCLMAX_VIEW 200 |
13 |
|
|
#define NCLSTR 19 |
14 |
|
|
#define NCLMAX (NCLMAX_VIEW*12) |
15 |
|
|
#define NCLBUFF (NCLMAX*NCLSTR) |
16 |
|
|
|
17 |
pam-fi |
1.2 |
#include <CalibTrk1Event.h> |
18 |
|
|
#include <CalibTrk2Event.h> |
19 |
|
|
|
20 |
mocchiut |
1.1 |
#include <TString.h> |
21 |
|
|
#include <TFile.h> |
22 |
pam-fi |
1.2 |
#include <TTree.h> |
23 |
mocchiut |
1.1 |
|
24 |
pam-fi |
1.2 |
#include <fstream> |
25 |
|
|
#include <iostream> |
26 |
mocchiut |
1.1 |
/** |
27 |
pam-fi |
1.2 |
* \brief Struct to pass calibration parameters to F77 routines |
28 |
mocchiut |
1.1 |
*/ |
29 |
pam-fi |
1.2 |
struct cTrkCalib { |
30 |
|
|
|
31 |
mocchiut |
1.1 |
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 |
pam-fi |
1.2 |
|
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 |
mocchiut |
1.1 |
}; |
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 nclstr1; |
83 |
pam-fi |
1.5 |
int view[NCLMAX]; |
84 |
|
|
int ladder[NCLMAX]; |
85 |
|
|
int maxs[NCLMAX]; |
86 |
|
|
int mult[NCLMAX]; |
87 |
|
|
float dedx[NCLMAX]; |
88 |
|
|
int indstart[NCLMAX]; |
89 |
|
|
int indmax[NCLMAX]; |
90 |
mocchiut |
1.1 |
int totCLlength; |
91 |
pam-fi |
1.5 |
float clsignal[NCLBUFF]; |
92 |
|
|
float clsigma[NCLBUFF]; |
93 |
|
|
int cladc[NCLBUFF]; |
94 |
|
|
int clbad[NCLBUFF]; |
95 |
|
|
float cnev[24][12]; |
96 |
|
|
int cnnev[24][12]; |
97 |
|
|
int fshower[12]; |
98 |
|
|
int whichtrack[NCLMAX]; |
99 |
mocchiut |
1.1 |
}; |
100 |
|
|
// ================================================================== |
101 |
|
|
/** |
102 |
|
|
* \brief Struct to pass tracker LEVEL2 data to F77 routines |
103 |
|
|
*/ |
104 |
|
|
struct cTrkLevel2 { |
105 |
|
|
int good2; |
106 |
|
|
int crc[12]; |
107 |
|
|
// ---------------------------- |
108 |
|
|
int nclsx; |
109 |
|
|
int planex[NSINGMAX]; |
110 |
|
|
float xs[NSINGMAX][2]; |
111 |
|
|
float signlxs[NSINGMAX]; |
112 |
pam-fi |
1.5 |
int clsx[NSINGMAX]; |
113 |
mocchiut |
1.1 |
// ---------------------------- |
114 |
|
|
int nclsy; |
115 |
|
|
int planey[NSINGMAX]; |
116 |
|
|
float ys[NSINGMAX][2]; |
117 |
|
|
float signlys[NSINGMAX]; |
118 |
pam-fi |
1.5 |
int clsy[NSINGMAX]; |
119 |
mocchiut |
1.1 |
// ---------------------------- |
120 |
|
|
int ntrk; |
121 |
|
|
int image[NTRKMAX]; |
122 |
|
|
float xm_nt[NTRKMAX][6]; |
123 |
|
|
float ym_nt[NTRKMAX][6]; |
124 |
|
|
float zm_nt[NTRKMAX][6]; |
125 |
|
|
float resx_nt[NTRKMAX][6]; |
126 |
|
|
float resy_nt[NTRKMAX][6]; |
127 |
|
|
float al_nt[NTRKMAX][5]; |
128 |
|
|
float coval[NTRKMAX][5][5]; |
129 |
|
|
float chi2_nt[NTRKMAX]; |
130 |
|
|
int xgood_nt[NTRKMAX][6]; |
131 |
|
|
int ygood_nt[NTRKMAX][6]; |
132 |
|
|
float xv_nt[NTRKMAX][6]; |
133 |
|
|
float yv_nt[NTRKMAX][6]; |
134 |
|
|
float zv_nt[NTRKMAX][6]; |
135 |
|
|
float axv_nt[NTRKMAX][6]; |
136 |
|
|
float ayv_nt[NTRKMAX][6]; |
137 |
|
|
float dedx_x[NTRKMAX][6]; |
138 |
|
|
float dedx_y[NTRKMAX][6]; |
139 |
pam-fi |
1.5 |
int cltrx[NTRKMAX][6]; |
140 |
|
|
int cltry[NTRKMAX][6]; |
141 |
|
|
// float bdl[NTRKMAX]; |
142 |
pam-fi |
1.3 |
|
143 |
|
|
void InitcTrkLevel2(){ |
144 |
|
|
|
145 |
|
|
good2 = 0; |
146 |
|
|
for(Int_t i=0; i<12 ; i++) |
147 |
|
|
crc[i] = 0; |
148 |
|
|
// ---------------------------- |
149 |
|
|
nclsx = 0; |
150 |
|
|
nclsy = 0; |
151 |
|
|
for(Int_t i=0; i<NSINGMAX ; i++){ |
152 |
|
|
planex[i] = 0; |
153 |
|
|
xs[i][0] = 0; |
154 |
|
|
xs[i][1] = 0; |
155 |
|
|
signlxs[i] = 0; |
156 |
|
|
planey[i] = 0; |
157 |
|
|
ys[i][0] = 0; |
158 |
|
|
ys[i][1] = 0; |
159 |
|
|
signlys[i] = 0; |
160 |
|
|
} |
161 |
|
|
// ---------------------------- |
162 |
|
|
ntrk =0 ; |
163 |
|
|
|
164 |
|
|
for(Int_t i=0; i<NTRKMAX ; i++){ |
165 |
|
|
image[i] = 0; |
166 |
|
|
chi2_nt[i] = 0; |
167 |
pam-fi |
1.5 |
// bdl[i] = 0; |
168 |
pam-fi |
1.3 |
|
169 |
|
|
for(Int_t ii=0; ii<5 ; ii++){ |
170 |
|
|
al_nt[i][ii] = 0; |
171 |
|
|
for(Int_t iii=0; iii<5 ; iii++) |
172 |
|
|
coval[i][ii][iii] = 0; |
173 |
|
|
} |
174 |
|
|
|
175 |
|
|
for(Int_t ii=0; ii<6 ; ii++){ |
176 |
|
|
xm_nt[i][ii] = 0; |
177 |
|
|
ym_nt[i][ii] = 0; |
178 |
|
|
zm_nt[i][ii] = 0; |
179 |
|
|
resx_nt[i][ii] = 0; |
180 |
|
|
resy_nt[i][ii] = 0; |
181 |
|
|
xgood_nt[i][ii] = 0; |
182 |
|
|
ygood_nt[i][ii] = 0; |
183 |
|
|
xv_nt[i][ii] = 0; |
184 |
|
|
yv_nt[i][ii] = 0; |
185 |
|
|
zv_nt[i][ii] = 0; |
186 |
|
|
axv_nt[i][ii] = 0; |
187 |
|
|
ayv_nt[i][ii] = 0; |
188 |
|
|
dedx_x[i][ii] = 0; |
189 |
|
|
dedx_y[i][ii] = 0; |
190 |
|
|
} |
191 |
|
|
} |
192 |
|
|
} |
193 |
|
|
|
194 |
mocchiut |
1.1 |
}; |
195 |
|
|
// ================================================================== |
196 |
|
|
/** |
197 |
|
|
* \brief Struct to pass calibration/parameter file paths to F77 routines |
198 |
|
|
*/ |
199 |
|
|
struct cPath { |
200 |
|
|
char path[80]; |
201 |
|
|
int pathlen; |
202 |
pam-fi |
1.2 |
int error; |
203 |
mocchiut |
1.1 |
/** |
204 |
|
|
* Fill the struct variables from a TString object |
205 |
|
|
*/ |
206 |
|
|
void FillWith(TString s){ |
207 |
pam-fi |
1.2 |
pathlen = s.Length(); |
208 |
|
|
const char *pc = s.Data(); |
209 |
|
|
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
210 |
mocchiut |
1.1 |
}; |
211 |
pam-fi |
1.2 |
|
212 |
|
|
|
213 |
mocchiut |
1.1 |
}; |
214 |
|
|
|
215 |
|
|
// ================================================================== |
216 |
|
|
/** |
217 |
|
|
* \brief Struct to pass magnetic-field file paths to F77 routines |
218 |
|
|
*/ |
219 |
|
|
struct cBPath { |
220 |
|
|
char b_path[80]; |
221 |
|
|
int b_pathlen; |
222 |
|
|
int b_error; |
223 |
|
|
int b_loaded; |
224 |
|
|
/** |
225 |
|
|
* Fill the struct variables from a TString object and set |
226 |
|
|
* the load flag to FALSE. |
227 |
|
|
*/ |
228 |
|
|
void FillWith(TString s){ |
229 |
|
|
b_loaded = 0; |
230 |
|
|
b_pathlen = s.Length(); |
231 |
|
|
const char *pc = s.Data(); |
232 |
|
|
for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; |
233 |
|
|
}; |
234 |
|
|
/** |
235 |
|
|
* Fill the struct variables from a TString object |
236 |
|
|
*/ |
237 |
|
|
int BIsLoaded(){ return b_loaded; }; |
238 |
|
|
|
239 |
|
|
}; |
240 |
|
|
|
241 |
pam-fi |
1.2 |
// ================================================================== |
242 |
|
|
/** |
243 |
|
|
* \brief Struct to set debug mode in F77 routines |
244 |
|
|
*/ |
245 |
|
|
struct cDbg { |
246 |
|
|
int debug; |
247 |
|
|
int verbose; |
248 |
|
|
int warning; |
249 |
|
|
// bool debug; |
250 |
|
|
// bool verbose; |
251 |
|
|
void SetNone() {debug=0; verbose=0; warning=0;}; |
252 |
|
|
void SetWarning(){debug=0; verbose=0; warning=1;}; |
253 |
|
|
void SetVerbose(){debug=0; verbose=1; warning=1;}; |
254 |
|
|
void SetDebug() {debug=1; verbose=1; warning=1;}; |
255 |
|
|
}; |
256 |
|
|
|
257 |
|
|
extern "C" { |
258 |
|
|
extern struct cTrkCalib pedsigbad_; |
259 |
|
|
extern struct cTrkLevel0 level0event_; |
260 |
|
|
extern struct cTrkLevel1 level1event_; |
261 |
|
|
extern struct cTrkLevel2 level2event_; |
262 |
|
|
extern struct cPath path_; |
263 |
|
|
extern struct cBPath bpath_; |
264 |
|
|
extern struct cDbg dbg_; |
265 |
|
|
void fillpedsigfromdefault_(); |
266 |
|
|
int readmipparam_(); |
267 |
|
|
int readchargeparam_(); |
268 |
|
|
int readvkmask_(); |
269 |
|
|
int readalignparam_(); |
270 |
|
|
int readetaparam_(); |
271 |
|
|
void reductionflight_(int*); |
272 |
|
|
int analysisflight_(); |
273 |
|
|
} |
274 |
|
|
|
275 |
mocchiut |
1.1 |
|
276 |
|
|
#endif |
277 |
|
|
|