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