| 1 |
#ifndef DIGITIZER_H |
#ifndef DIGITIZER_H |
| 2 |
#define DIGITIZER_H |
#define DIGITIZER_H |
| 3 |
|
#define nspe 200 |
| 4 |
|
#define ntof 200 |
| 5 |
|
#define ncat 50 |
| 6 |
|
#define ncas 50 |
| 7 |
|
#define ncar 100 |
| 8 |
|
#define ncal 1000 |
| 9 |
|
#define nnd 200 |
| 10 |
|
#define nstr 1000 |
| 11 |
|
|
| 12 |
#include <iostream> |
#include <iostream> |
| 13 |
#include <fstream> |
#include <fstream> |
| 14 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
static const int fPSCUbuffer = 8; |
static const int fPSCUbuffer = 8; |
| 44 |
static const int fTRIGGERbuffer = 153; //(bytes) |
static const int fTRIGGERbuffer = 152; //(bytes) |
| 45 |
static const int fTOFbuffer = 276; //(bytes) |
static const int fTOFbuffer = 276; //(bytes) |
| 46 |
|
static const int fRunHeaderbuffer = 27; // ?? |
| 47 |
|
static const int fRunTrailerbuffer = 17; |
| 48 |
static const int fACbuffer = 128; |
static const int fACbuffer = 128; |
| 49 |
static const int fNDbuffer = 4; |
static const int fNDbuffer = 6; |
| 50 |
|
static const int fS4buffer = 3; |
| 51 |
static const int fPADbuffer = 64; // changed from 32! |
static const int fPADbuffer = 64; // changed from 32! |
| 52 |
static const int fCALObuffer = 10000; |
static const int fCALObuffer = 10000; |
| 53 |
static const float fCALOGeV2MIPratio = 0.0001059994; |
static const float fCALOGeV2MIPratio = 0.0001059994; |
| 74 |
static const float fAveSigmay = 8.; // to be adjusted |
static const float fAveSigmay = 8.; // to be adjusted |
| 75 |
static const float fSigmaSigmay =0.1; // to be adjusted |
static const float fSigmaSigmay =0.1; // to be adjusted |
| 76 |
static const float fSigmaCommon = 25.; // to be adjusted |
static const float fSigmaCommon = 25.; // to be adjusted |
|
static const float fMipCor = 1.; // to be adjusted |
|
| 77 |
|
|
| 78 |
|
|
| 79 |
// end dimensions of vectors and buffer, parameter for tracker |
// end dimensions of vectors and buffer, parameter for tracker |
| 80 |
|
|
| 81 |
UShort_t fDataPSCU[fPSCUbuffer]; |
UShort_t fDataPSCU[fPSCUbuffer]; |
| 82 |
UInt_t fCounter; |
UInt_t fCounter; |
| 83 |
|
UInt_t fCounterPhys; |
| 84 |
UInt_t fOBT; |
UInt_t fOBT; |
| 85 |
|
|
| 86 |
UShort_t fDataPadding[fPADbuffer]; |
UShort_t fDataPadding[fPADbuffer]; |
| 87 |
UInt_t fPadding; |
UInt_t fPadding; |
| 88 |
|
|
| 89 |
UChar_t fDataTrigger[fTRIGGERbuffer]; |
UShort_t fDataRunHeader[fRunHeaderbuffer]; |
| 90 |
|
UShort_t fDataRunTrailer[fRunTrailerbuffer]; |
| 91 |
|
|
| 92 |
|
UChar_t fDataTrigger[fTRIGGERbuffer]; |
| 93 |
UChar_t fDataTof[fTOFbuffer]; |
UChar_t fDataTof[fTOFbuffer]; |
| 94 |
|
|
| 95 |
UShort_t fDataAC[fACbuffer]; |
UShort_t fDataAC[fACbuffer]; |
| 96 |
UShort_t fDataND[fACbuffer]; |
UShort_t fDataND[fNDbuffer]; |
| 97 |
|
UShort_t fDataS4[fS4buffer]; |
| 98 |
UShort_t fDataDummy[fDummybuffer]; |
UShort_t fDataDummy[fDummybuffer]; |
| 99 |
|
|
| 100 |
UShort_t fDataCALO[fCALObuffer]; |
UShort_t fDataCALO[fCALObuffer]; |
| 115 |
|
|
| 116 |
char* fFilename; |
char* fFilename; |
| 117 |
UInt_t fLen; |
UInt_t fLen; |
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
// vectors, buffer, and variables for tracker |
// vectors, buffer, and variables for tracker |
| 123 |
UInt_t fTracklength; // Actual length of buffer |
UInt_t fTracklength; // Actual length of buffer |
| 124 |
Float_t fPedeTrack[fNviews][fNstrips_view]; |
Float_t fPedeTrack[fNviews][fNstrips_view]; |
| 125 |
Float_t fSigmaTrack[fNviews][fNstrips_view]; |
Float_t fSigmaTrack[fNviews][fNstrips_view]; |
| 126 |
|
// UShort_t fBadTrack[fNviews][fNstrips_view]; |
| 127 |
|
Float_t fMipCor[fNladder][fNviews] ; |
| 128 |
// end vectors, buffer, and variables for tracker |
// end vectors, buffer, and variables for tracker |
| 129 |
|
|
| 130 |
|
|
| 144 |
Float_t Phi; |
Float_t Phi; |
| 145 |
Float_t P0; |
Float_t P0; |
| 146 |
Int_t Nthtof; |
Int_t Nthtof; |
| 147 |
UChar_t Ipltof[100]; //[Nthtof] |
UChar_t Ipltof[ntof]; |
| 148 |
UChar_t Ipaddle[100]; //[Nthtof] |
UChar_t Ipaddle[ntof]; |
| 149 |
UChar_t Ipartof[100]; //[Nthtof] |
UChar_t Ipartof[ntof]; |
| 150 |
Float_t Xintof[100]; //[Nthtof] |
Float_t Xintof[ntof]; |
| 151 |
Float_t Yintof[100]; //[Nthtof] |
Float_t Yintof[ntof]; |
| 152 |
Float_t Zintof[100]; //[Nthtof] |
Float_t Zintof[ntof]; |
| 153 |
Float_t Xouttof[100]; //[Nthtof] |
Float_t Xouttof[ntof]; |
| 154 |
Float_t Youttof[100]; //[Nthtof] |
Float_t Youttof[ntof]; |
| 155 |
Float_t Zouttof[100]; //[Nthtof] |
Float_t Zouttof[ntof]; |
| 156 |
Float_t Ereltof[100]; //[Nthtof] |
Float_t Ereltof[ntof]; |
| 157 |
Float_t Timetof[100]; //[Nthtof] |
Float_t Timetof[ntof]; |
| 158 |
Float_t Pathtof[100]; //[Nthtof] |
Float_t Pathtof[ntof]; |
| 159 |
Float_t P0tof[100]; //[Nthtof] |
Float_t P0tof[ntof]; |
| 160 |
Int_t Nthcat; |
Int_t Nthcat; |
| 161 |
UChar_t Iparcat[50]; //[Nthcat] |
UChar_t Iparcat[ncat]; |
| 162 |
UChar_t Icat[50]; //[Nthcat] |
UChar_t Icat[ncat]; |
| 163 |
Float_t Xincat[50]; //[Nthcat] |
Float_t Xincat[ncat]; |
| 164 |
Float_t Yincat[50]; //[Nthcat] |
Float_t Yincat[ncat]; |
| 165 |
Float_t Zincat[50]; //[Nthcat] |
Float_t Zincat[ncat]; |
| 166 |
Float_t Xoutcat[50]; //[Nthcat] |
Float_t Xoutcat[ncat]; |
| 167 |
Float_t Youtcat[50]; //[Nthcat] |
Float_t Youtcat[ncat]; |
| 168 |
Float_t Zoutcat[50]; //[Nthcat] |
Float_t Zoutcat[ncat]; |
| 169 |
Float_t Erelcat[50]; //[Nthcat] |
Float_t Erelcat[ncat]; |
| 170 |
Float_t Timecat[50]; //[Nthcat] |
Float_t Timecat[ncat]; |
| 171 |
Float_t Pathcat[50]; //[Nthcat] |
Float_t Pathcat[ncat]; |
| 172 |
Float_t P0cat[50]; //[Nthcat] |
Float_t P0cat[ncat]; |
| 173 |
Int_t Nthcas; |
Int_t Nthcas; |
| 174 |
UChar_t Iparcas[50]; //[Nthcas] |
UChar_t Iparcas[ncas]; |
| 175 |
UChar_t Icas[50]; //[Nthcas] |
UChar_t Icas[ncas]; |
| 176 |
Float_t Xincas[50]; //[Nthcas] |
Float_t Xincas[ncas]; |
| 177 |
Float_t Yincas[50]; //[Nthcas] |
Float_t Yincas[ncas]; |
| 178 |
Float_t Zincas[50]; //[Nthcas] |
Float_t Zincas[ncas]; |
| 179 |
Float_t Xoutcas[50]; //[Nthcas] |
Float_t Xoutcas[ncas]; |
| 180 |
Float_t Youtcas[50]; //[Nthcas] |
Float_t Youtcas[ncas]; |
| 181 |
Float_t Zoutcas[50]; //[Nthcas] |
Float_t Zoutcas[ncas]; |
| 182 |
Float_t Erelcas[50]; //[Nthcas] |
Float_t Erelcas[ncas]; |
| 183 |
Float_t Timecas[50]; //[Nthcas] |
Float_t Timecas[ncas]; |
| 184 |
Float_t Pathcas[50]; //[Nthcas] |
Float_t Pathcas[ncas]; |
| 185 |
Float_t P0cas[50]; //[Nthcas] |
Float_t P0cas[ncas]; |
| 186 |
Int_t Nthspe; |
Int_t Nthspe; |
| 187 |
UChar_t Iparspe[100]; //[Nthspe] |
UChar_t Iparspe[nspe]; |
| 188 |
UChar_t Itrpb[100]; //[Nthspe] |
UChar_t Itrpb[nspe]; |
| 189 |
UChar_t Itrsl[100]; //[Nthspe] |
UChar_t Itrsl[nspe]; |
| 190 |
UChar_t Itspa[100]; //[Nthspe] |
UChar_t Itspa[nspe]; |
| 191 |
Float_t Xinspe[100]; //[Nthspe] |
Float_t Xinspe[nspe]; |
| 192 |
Float_t Yinspe[100]; //[Nthspe] |
Float_t Yinspe[nspe]; |
| 193 |
Float_t Zinspe[100]; //[Nthspe] |
Float_t Zinspe[nspe]; |
| 194 |
Float_t Xoutspe[100]; //[Nthspe] |
Float_t Xoutspe[nspe]; |
| 195 |
Float_t Youtspe[100]; //[Nthspe] |
Float_t Youtspe[nspe]; |
| 196 |
Float_t Zoutspe[100]; //[Nthspe] |
Float_t Zoutspe[nspe]; |
| 197 |
Float_t Xavspe[100]; //[Nthspe] |
Float_t Xavspe[nspe]; |
| 198 |
Float_t Yavspe[100]; //[Nthspe] |
Float_t Yavspe[nspe]; |
| 199 |
Float_t Zavspe[100]; //[Nthspe] |
Float_t Zavspe[nspe]; |
| 200 |
Float_t Erelspe[100]; //[Nthspe] |
Float_t Erelspe[nspe]; |
| 201 |
Float_t Pathspe[100]; //[Nthspe] |
Float_t Pathspe[nspe]; |
| 202 |
Float_t P0spe[100]; //[Nthspe] |
Float_t P0spe[nspe]; |
| 203 |
UChar_t Nxmult[100]; //[Nthspe] |
UChar_t Nxmult[nspe]; |
| 204 |
UChar_t Nymult[100]; //[Nthspe] |
UChar_t Nymult[nspe]; |
| 205 |
Int_t Nstrpx; |
Int_t Nstrpx; |
| 206 |
UChar_t Npstripx[1000]; //[Nstrpx] |
UChar_t Npstripx[nstr]; |
| 207 |
UChar_t Ntstripx[1000]; //[Nstrpx] |
UChar_t Ntstripx[nstr]; |
| 208 |
UShort_t Istripx[1000]; //[Nstrpx] |
UShort_t Istripx[nstr]; |
| 209 |
//UInt_t Istripx[1000]; //[Nstrpx] |
//UInt_t Istripx[nstr]; |
| 210 |
Float_t Qstripx[1000]; //[Nstrpx] |
Float_t Qstripx[nstr]; |
| 211 |
Float_t Xstripx[1000]; //[Nstrpx] |
Float_t Xstripx[nstr]; |
| 212 |
Int_t Nstrpy; |
Int_t Nstrpy; |
| 213 |
UChar_t Npstripy[1000]; //[Nstrpy] |
UChar_t Npstripy[nstr]; |
| 214 |
UChar_t Ntstripy[1000]; //[Nstrpy] |
UChar_t Ntstripy[nstr]; |
| 215 |
UShort_t Istripy[1000]; //[Nstrpy] |
UShort_t Istripy[nstr]; |
| 216 |
//UInt_t Istripy[1000]; //[Nstrpy] |
//UInt_t Istripy[nstr]; |
| 217 |
Float_t Qstripy[1000]; //[Nstrpy] |
Float_t Qstripy[nstr]; |
| 218 |
Float_t Ystripy[1000]; //[Nstrpy] |
Float_t Ystripy[nstr]; |
| 219 |
Int_t Nthcali; |
Int_t Nthcali; |
| 220 |
UChar_t Icaplane[4224]; //[Nthcali] |
UChar_t Icaplane[4224]; |
| 221 |
UChar_t Icastrip[4224]; //[Nthcali] |
UChar_t Icastrip[4224]; |
| 222 |
Int_t Icamod[4224]; //[Nthcali] |
Int_t Icamod[4224]; |
| 223 |
Float_t Enestrip[4224]; //[Nthcali] |
Float_t Enestrip[4224]; |
| 224 |
Int_t Nthcal; |
Int_t Nthcal; |
| 225 |
UChar_t Icapl[1000]; //[Nthcal] |
UChar_t Icapl[ncal]; |
| 226 |
UChar_t Icasi[1000]; //[Nthcal] |
UChar_t Icasi[ncal]; |
| 227 |
UChar_t Icast[1000]; //[Nthcal] |
UChar_t Icast[ncal]; |
| 228 |
Float_t Xincal[1000]; //[Nthcal] |
Float_t Xincal[ncal]; |
| 229 |
Float_t Yincal[1000]; //[Nthcal] |
Float_t Yincal[ncal]; |
| 230 |
Float_t Zincal[1000]; //[Nthcal] |
Float_t Zincal[ncal]; |
| 231 |
Float_t Erelcal[1000]; //[Nthcal] |
Float_t Erelcal[ncal]; |
| 232 |
Int_t Nthnd; |
Int_t Nthnd; |
| 233 |
UChar_t Itubend[200]; //[Nthnd] |
UChar_t Itubend[nnd]; |
| 234 |
UChar_t Iparnd[200]; //[Nthnd] |
UChar_t Iparnd[nnd]; |
| 235 |
Float_t Xinnd[200]; //[Nthnd] |
Float_t Xinnd[nnd]; |
| 236 |
Float_t Yinnd[200]; //[Nthnd] |
Float_t Yinnd[nnd]; |
| 237 |
Float_t Zinnd[200]; //[Nthnd] |
Float_t Zinnd[nnd]; |
| 238 |
Float_t Xoutnd[200]; //[Nthnd] |
Float_t Xoutnd[nnd]; |
| 239 |
Float_t Youtnd[200]; //[Nthnd] |
Float_t Youtnd[nnd]; |
| 240 |
Float_t Zoutnd[200]; //[Nthnd] |
Float_t Zoutnd[nnd]; |
| 241 |
Float_t Erelnd[200]; //[Nthnd] |
Float_t Erelnd[nnd]; |
| 242 |
Float_t Timend[200]; //[Nthnd] |
Float_t Timend[nnd]; |
| 243 |
Float_t Pathnd[200]; //[Nthnd] |
Float_t Pathnd[nnd]; |
| 244 |
Float_t P0nd[200]; //[Nthnd] |
Float_t P0nd[nnd]; |
| 245 |
Int_t Nthcard; |
Int_t Nthcard; |
| 246 |
UChar_t Iparcard[100]; //[Nthcard] |
UChar_t Iparcard[ncar]; |
| 247 |
UChar_t Icard[100]; //[Nthcard] |
UChar_t Icard[ncar]; |
| 248 |
Float_t Xincard[100]; //[Nthcard] |
Float_t Xincard[ncar]; |
| 249 |
Float_t Yincard[100]; //[Nthcard] |
Float_t Yincard[ncar]; |
| 250 |
Float_t Zincard[100]; //[Nthcard] |
Float_t Zincard[ncar]; |
| 251 |
Float_t Xoutcard[100]; //[Nthcard] |
Float_t Xoutcard[ncar]; |
| 252 |
Float_t Youtcard[100]; //[Nthcard] |
Float_t Youtcard[ncar]; |
| 253 |
Float_t Zoutcard[100]; //[Nthcard] |
Float_t Zoutcard[ncar]; |
| 254 |
Float_t Erelcard[100]; //[Nthcard] |
Float_t Erelcard[ncar]; |
| 255 |
Float_t Timecard[100]; //[Nthcard] |
Float_t Timecard[ncar]; |
| 256 |
Float_t Pathcard[100]; //[Nthcard] |
Float_t Pathcard[ncar]; |
| 257 |
Float_t P0card[100]; //[Nthcard] |
Float_t P0card[ncar]; |
| 258 |
|
|
| 259 |
// List of branches |
// List of branches |
| 260 |
TBranch *b_Irun; //! |
TBranch *b_Irun; //! |
| 383 |
Digitizer(TTree *tree, char* &file_raw); // constructor |
Digitizer(TTree *tree, char* &file_raw); // constructor |
| 384 |
|
|
| 385 |
void Close(); |
void Close(); |
|
|
|
| 386 |
void SetTree(TTree *tree) {fhBookTree = tree;}; |
void SetTree(TTree *tree) {fhBookTree = tree;}; |
|
|
|
|
|
|
| 387 |
void Loop(); // does the looping over events |
void Loop(); // does the looping over events |
| 388 |
|
|
| 389 |
|
void DigitizePSCU(UInt_t, UChar_t, UShort_t*); // digitizes the CPU header |
|
|
|
|
void DigitizePSCU(UInt_t, UChar_t); // digitizes the CPU header |
|
| 390 |
void AddPadding(); |
void AddPadding(); |
| 391 |
void DigitizeTRIGGER(); // digitizes the trigger |
void DigitizeRunHeader(); |
| 392 |
Int_t DigitizeTOF(); // digitizes the tof |
void DigitizeRunTrailer(); |
| 393 |
|
// void DigitizeTRIGGER(); // SO nov'07: included in DigitizeTOF |
| 394 |
|
void DigitizeTOF(int np,float *atte1,float *atte2,float *lambda1,float *lambda2); // digitizes the tof |
| 395 |
|
void LoadTOFCalib(int np,float *atte1,float *atte2,float *lambda1,float *lambda2); //load TOF calibration |
| 396 |
void DigitizeAC(); // digitizes the anti-counter |
void DigitizeAC(); // digitizes the anti-counter |
| 397 |
void DigitizeND(); // digitizes the ND |
void DigitizeND(); // digitizes the ND |
| 398 |
|
void DigitizeS4(); // digitizes the S4 |
| 399 |
void DigitizeCALO(); // digitizes the calorimeter |
void DigitizeCALO(); // digitizes the calorimeter |
| 400 |
void DigitizeCALOCALIB(); // digitizes the calorimeter calibration |
void DigitizeCALOCALIB(); // digitizes the calorimeter calibration |
| 401 |
void DigitizeCALORAW(); // digitizes the calorimeter |
void DigitizeCALORAW(); // digitizes the calorimeter |
| 414 |
void Paddle2Pmt(Int_t, Int_t, Int_t*, Int_t*); |
void Paddle2Pmt(Int_t, Int_t, Int_t*, Int_t*); |
| 415 |
//void Paddle2Pmt(Int_t, Int_t, Int_t &pmtleft, Int_t &pmtright); |
//void Paddle2Pmt(Int_t, Int_t, Int_t &pmtleft, Int_t &pmtright); |
| 416 |
UChar_t Bin2GrayTof(UChar_t, UChar_t); |
UChar_t Bin2GrayTof(UChar_t, UChar_t); |
| 417 |
|
void Crc8Tof(UChar_t*, UChar_t*); |
| 418 |
|
|
| 419 |
|
UChar_t EvaluateCrcTrigger(UChar_t*, Int_t); |
| 420 |
|
|
| 421 |
UShort_t* GetDataAC(){return(fDataAC);}; // retrieve AC data (not used right now) |
UShort_t* GetDataAC(){return(fDataAC);}; // retrieve AC data (not used right now) |
| 422 |
|
|
| 430 |
void LoadTrackCalib(); // load in memmory tracker calibration |
void LoadTrackCalib(); // load in memmory tracker calibration |
| 431 |
void CompressTrackData(Float_t AdcTrack[fNviews][fNstrips_view]); // Compress and Digitize data of one Ladder in turn |
void CompressTrackData(Float_t AdcTrack[fNviews][fNstrips_view]); // Compress and Digitize data of one Ladder in turn |
| 432 |
void LoadMipCor(); // Load the strip calibration in memory |
void LoadMipCor(); // Load the strip calibration in memory |
| 433 |
Float_t SaturationTrack(Float_t ADC); // Saturation simulation |
Float_t SaturationTrackx(Float_t ADC); // Saturation simulation |
| 434 |
|
Float_t SaturationTracky(Float_t ADC); // Saturation simulation |
| 435 |
// end methods for Tracker |
// end methods for Tracker |
| 436 |
|
|
| 437 |
|
void WriteRunHeader(); |
| 438 |
|
void WriteRunTrailer(); |
| 439 |
void WriteData(); // writes data to file |
void WriteData(); // writes data to file |
| 440 |
void ReadData(); |
void ReadData(); |
| 441 |
|
|