| 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 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> |
| 23 |
#include <TFile.h> |
| 24 |
#include <TTree.h> |
| 25 |
|
| 26 |
#include <fstream> |
| 27 |
#include <iostream> |
| 28 |
/** |
| 29 |
* \brief Struct to pass calibration parameters to F77 routines |
| 30 |
*/ |
| 31 |
struct cTrkCalib { |
| 32 |
|
| 33 |
float pedestal[128][24][12]; |
| 34 |
float pedestal_t[128][24][12]; |
| 35 |
float sigma[128][24][12]; |
| 36 |
float sigma_t[128][24][12]; |
| 37 |
int bad[128][24][12]; |
| 38 |
|
| 39 |
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 |
/** |
| 47 |
* \brief Struct to pass tracker LEVEL0 data to F77 routines |
| 48 |
*/ |
| 49 |
struct cTrkLevel0 { |
| 50 |
int DAQmode[12]; |
| 51 |
int DSPnumber[12]; |
| 52 |
int DATAlength[12]; |
| 53 |
int eventn[12]; |
| 54 |
int nclust[12]; |
| 55 |
int cutc[12]; |
| 56 |
int cutcl[12]; |
| 57 |
int addrcluster[3][12]; |
| 58 |
int signcluster[3][12]; |
| 59 |
int fc[12]; |
| 60 |
int compressiontime[12]; |
| 61 |
int fl5[12]; |
| 62 |
int fl4[12]; |
| 63 |
int fl3[12]; |
| 64 |
int fl2[12]; |
| 65 |
int fl1[12]; |
| 66 |
int fl6[12]; |
| 67 |
int checksum[12]; |
| 68 |
int TOTDATAlength; |
| 69 |
int datatracker[49152]; |
| 70 |
int pnum[12]; |
| 71 |
int cmdnum[12]; |
| 72 |
int bid[12]; |
| 73 |
int alarm[12]; |
| 74 |
int aswr[12]; |
| 75 |
int good0; |
| 76 |
int crc[12]; |
| 77 |
}; |
| 78 |
// ================================================================== |
| 79 |
/** |
| 80 |
* \brief Struct to pass tracker LEVEL1 data to F77 routines |
| 81 |
*/ |
| 82 |
struct cTrkLevel1 { |
| 83 |
// int good1; |
| 84 |
int good[12]; |
| 85 |
int nclstr1; |
| 86 |
int view[NCLMAX]; |
| 87 |
int ladder[NCLMAX]; |
| 88 |
int maxs[NCLMAX]; |
| 89 |
int mult[NCLMAX]; |
| 90 |
float dedx[NCLMAX]; |
| 91 |
int indstart[NCLMAX]; |
| 92 |
int indmax[NCLMAX]; |
| 93 |
int totCLlength; |
| 94 |
float clsignal[NCLBUFF]; |
| 95 |
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 |
| 107 |
*/ |
| 108 |
struct cTrkLevel2 { |
| 109 |
// int good2; |
| 110 |
// int crc[12]; |
| 111 |
int good[12]; |
| 112 |
// ---------------------------- |
| 113 |
int nclsx; |
| 114 |
int planex[NSINGMAX]; |
| 115 |
float xs[NSINGMAX][2]; |
| 116 |
float signlxs[NSINGMAX]; |
| 117 |
int clsx[NSINGMAX]; |
| 118 |
// ---------------------------- |
| 119 |
int nclsy; |
| 120 |
int planey[NSINGMAX]; |
| 121 |
float ys[NSINGMAX][2]; |
| 122 |
float signlys[NSINGMAX]; |
| 123 |
int clsy[NSINGMAX]; |
| 124 |
// ---------------------------- |
| 125 |
int ntrk; |
| 126 |
int image[NTRKMAX]; |
| 127 |
float xm_nt[NTRKMAX][6]; |
| 128 |
float ym_nt[NTRKMAX][6]; |
| 129 |
float zm_nt[NTRKMAX][6]; |
| 130 |
float resx_nt[NTRKMAX][6]; |
| 131 |
float resy_nt[NTRKMAX][6]; |
| 132 |
float al_nt[NTRKMAX][5]; |
| 133 |
float coval[NTRKMAX][5][5]; |
| 134 |
float chi2_nt[NTRKMAX]; |
| 135 |
int nstep_nt[NTRKMAX]; |
| 136 |
int xgood_nt[NTRKMAX][6]; |
| 137 |
int ygood_nt[NTRKMAX][6]; |
| 138 |
float xv_nt[NTRKMAX][6]; |
| 139 |
float yv_nt[NTRKMAX][6]; |
| 140 |
float zv_nt[NTRKMAX][6]; |
| 141 |
float axv_nt[NTRKMAX][6]; |
| 142 |
float ayv_nt[NTRKMAX][6]; |
| 143 |
float dedx_x[NTRKMAX][6]; |
| 144 |
float dedx_y[NTRKMAX][6]; |
| 145 |
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 |
| 205 |
*/ |
| 206 |
struct cPath { |
| 207 |
char path[256]; |
| 208 |
int pathlen; |
| 209 |
int error; |
| 210 |
/** |
| 211 |
* Fill the struct variables from a TString object |
| 212 |
*/ |
| 213 |
void FillWith(TString s){ |
| 214 |
pathlen = s.Length(); |
| 215 |
const char *pc = s.Data(); |
| 216 |
for(Int_t i=0; i<=pathlen; i++) path[i] = *pc++; |
| 217 |
}; |
| 218 |
|
| 219 |
|
| 220 |
}; |
| 221 |
|
| 222 |
// ================================================================== |
| 223 |
/** |
| 224 |
* \brief Struct to pass magnetic-field file paths to F77 routines |
| 225 |
*/ |
| 226 |
struct cBPath { |
| 227 |
char b_path[256]; |
| 228 |
int b_pathlen; |
| 229 |
int b_error; |
| 230 |
int b_loaded; |
| 231 |
/** |
| 232 |
* Fill the struct variables from a TString object and set |
| 233 |
* the load flag to FALSE. |
| 234 |
*/ |
| 235 |
void FillWith(TString s){ |
| 236 |
b_loaded = 0; |
| 237 |
b_pathlen = s.Length(); |
| 238 |
const char *pc = s.Data(); |
| 239 |
for(Int_t i=0; i<=b_pathlen; i++) b_path[i] = *pc++; |
| 240 |
}; |
| 241 |
/** |
| 242 |
* Fill the struct variables from a TString object |
| 243 |
*/ |
| 244 |
int BIsLoaded(){ return b_loaded; }; |
| 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 |
| 313 |
|