2 |
#define DIGITIZER_H |
#define DIGITIZER_H |
3 |
|
|
4 |
#include <iostream> |
#include <iostream> |
5 |
|
#include <istream> |
6 |
#include <fstream> |
#include <fstream> |
7 |
|
|
8 |
|
|
17 |
#include "TLeafI.h" |
#include "TLeafI.h" |
18 |
#include "TH1.h" |
#include "TH1.h" |
19 |
#include "TH2.h" |
#include "TH2.h" |
20 |
|
#include "TF1.h" |
21 |
#include "TMath.h" |
#include "TMath.h" |
22 |
#include "TSQLServer.h" |
#include "TSQLServer.h" |
23 |
// |
#include "TGraph.h" |
24 |
|
#include "GLTables.h" |
25 |
|
#include "TSystem.h" |
26 |
|
#include "TRandom.h" |
27 |
|
|
28 |
#include "CRC.h" |
#include "CRC.h" |
29 |
|
#include <CalibCalPedEvent.h> |
30 |
|
#include "CalibTrk1Event.h" |
31 |
|
#include "CalibTrk2Event.h" |
32 |
|
|
33 |
class Digitizer{ |
class Digitizer{ |
34 |
|
|
|
|
|
35 |
protected: |
protected: |
36 |
|
|
37 |
// in and output data members |
// in and output data members |
38 |
|
|
39 |
TTree* fhBookTree; |
TTree* fhBookTree; |
40 |
ofstream fOutputfile; |
ofstream fOutputfile; |
41 |
int nspe; |
int *nspe; |
42 |
int ntof; |
int *ntof; |
43 |
int ncat; |
int *ncat; |
44 |
int ncas; |
int *ncas; |
45 |
int ncar; |
int *ncar; |
46 |
int ncal; |
int *ncal; |
47 |
int nnd; |
int *nnd; |
48 |
int nstr; |
int *nstr; |
49 |
int *ntf; |
int *comprcalomod; |
50 |
|
|
51 |
static const int fPSCUbuffer = 8; |
static const int fPSCUbuffer = 8; |
52 |
static const int fTRIGGERbuffer = 152; //(bytes) |
static const int fTRIGGERbuffer = 152; //(bytes) |
53 |
static const int fTOFbuffer = 276; //(bytes) |
static const int fTOFbuffer = 276; //(bytes) |
|
static const int fRunHeaderbuffer = 27; // ?? |
|
|
static const int fRunTrailerbuffer = 17; |
|
54 |
static const int fACbuffer = 128; |
static const int fACbuffer = 128; |
55 |
static const int fNDbuffer = 6; |
static const int fNDbuffer = 6; |
56 |
static const int fS4buffer = 3; |
static const int fS4buffer = 3; |
92 |
UShort_t fDataPadding[fPADbuffer]; |
UShort_t fDataPadding[fPADbuffer]; |
93 |
UInt_t fPadding; |
UInt_t fPadding; |
94 |
|
|
|
UShort_t fDataRunHeader[fRunHeaderbuffer]; |
|
|
UShort_t fDataRunTrailer[fRunTrailerbuffer]; |
|
|
|
|
95 |
UChar_t fDataTrigger[fTRIGGERbuffer]; |
UChar_t fDataTrigger[fTRIGGERbuffer]; |
96 |
UChar_t fDataTof[fTOFbuffer]; |
UChar_t fDataTof[fTOFbuffer]; |
97 |
|
|
104 |
UShort_t fSecCalo[4]; |
UShort_t fSecCalo[4]; |
105 |
UShort_t fSecCALOLength[4]; |
UShort_t fSecCALOLength[4]; |
106 |
UShort_t fCALOlength; |
UShort_t fCALOlength; |
107 |
UShort_t fModCalo; |
UShort_t fModCalo ; // 0 is RAW, 1 is COMPRESS, 2 is FULL |
108 |
Float_t fCalomip[2][22][96]; // ADC to MIP conversion values |
Float_t fCalomip[2][22][96]; // ADC to MIP conversion values |
109 |
Float_t fcalped[4][11][96]; // pedestals |
Float_t fcalped[4][11][96]; // pedestals |
110 |
Float_t fcalgood[4][11][96]; // used or not in the common noise calculation |
Float_t fcalgood[4][11][96]; // used or not in the common noise calculation |
119 |
char* fFilename; |
char* fFilename; |
120 |
UInt_t fLen; |
UInt_t fLen; |
121 |
|
|
122 |
|
UInt_t fEvent ; // cecilia, current evt nr |
123 |
|
|
124 |
|
|
125 |
// vectors, buffer, and variables for tracker |
// vectors, buffer, and variables for tracker |
150 |
Int_t Nthtof; |
Int_t Nthtof; |
151 |
UChar_t *Ipltof; |
UChar_t *Ipltof; |
152 |
UChar_t *Ipaddle; |
UChar_t *Ipaddle; |
153 |
// UChar_t *Ipartof;//DPMJET |
// UChar_t *Ipartof;//DPMJET |
154 |
UShort_t *Ipartof; |
UShort_t *Ipartof; |
155 |
Float_t *Xintof; |
Float_t *Xintof; |
156 |
Float_t *Yintof; |
Float_t *Yintof; |
190 |
Float_t *P0cas; |
Float_t *P0cas; |
191 |
Int_t Nthspe; |
Int_t Nthspe; |
192 |
// UChar_t *Iparspe;//DPMJET |
// UChar_t *Iparspe;//DPMJET |
193 |
UShort_t *Iparspe; |
// UShort_t *Iparspe; |
194 |
UChar_t *Itrpb; |
UChar_t *Itrpb; |
195 |
UChar_t *Itrsl; |
UChar_t *Itrsl; |
196 |
UChar_t *Itspa; |
UChar_t *Itspa; |
381 |
TBranch *b_Pathcard; //! |
TBranch *b_Pathcard; //! |
382 |
TBranch *b_P0card; //! |
TBranch *b_P0card; //! |
383 |
// |
// |
384 |
|
TF1 *attenAC; |
385 |
public: |
public: |
386 |
|
|
387 |
Digitizer(TTree *tree, char* &file_raw,int nspe=200,int ntof=200,int ncat=50,int ncas=50,int ncar=100,int ncal=1000,int nnd=200,int nstr=1000); // constructor |
Digitizer(TTree*,char*&,int,int,int,int,int,int,int,int,int); // constructor |
388 |
|
|
389 |
void Close(); |
void Close(); |
390 |
void SetTree(TTree *tree) {fhBookTree = tree;}; |
void SetTree(TTree *tree) {fhBookTree = tree;}; |
392 |
|
|
393 |
void DigitizePSCU(UInt_t, UChar_t, UShort_t*); // digitizes the CPU header |
void DigitizePSCU(UInt_t, UChar_t, UShort_t*); // digitizes the CPU header |
394 |
void AddPadding(); |
void AddPadding(); |
|
void DigitizeRunHeader(); |
|
|
void DigitizeRunTrailer(); |
|
|
// void DigitizeTRIGGER(); // SO nov'07: included in DigitizeTOF |
|
395 |
void DigitizeTOF(int np,float *atte1,float *atte2,float *lambda1,float *lambda2); // digitizes the tof |
void DigitizeTOF(int np,float *atte1,float *atte2,float *lambda1,float *lambda2); // digitizes the tof |
396 |
void LoadTOFCalib(int np,float *atte1,float *atte2,float *lambda1,float *lambda2); //load TOF calibration |
void LoadTOFCalib(int np,float *atte1,float *atte2,float *lambda1,float *lambda2); //load TOF calibration |
397 |
void DigitizeAC(); // digitizes the anti-counter |
void DigitizeAC(); // digitizes the anti-counter |
435 |
Float_t SaturationTracky(Float_t ADC); // Saturation simulation |
Float_t SaturationTracky(Float_t ADC); // Saturation simulation |
436 |
// end methods for Tracker |
// end methods for Tracker |
437 |
|
|
|
void WriteRunHeader(); |
|
|
void WriteRunTrailer(); |
|
438 |
void WriteData(); // writes data to file |
void WriteData(); // writes data to file |
439 |
void ReadData(); |
void ReadData(); |
440 |
|
|