--- PamelaDigitizer/Digitizer.h 2008/05/21 09:50:44 1.5 +++ PamelaDigitizer/Digitizer.h 2009/08/11 14:56:30 1.12 @@ -1,15 +1,8 @@ #ifndef DIGITIZER_H #define DIGITIZER_H -#define nspe 200 -#define ntof 200 -#define ncat 50 -#define ncas 50 -#define ncar 100 -#define ncal 1000 -#define nnd 200 -#define nstr 1000 #include +#include #include @@ -24,27 +17,39 @@ #include "TLeafI.h" #include "TH1.h" #include "TH2.h" +#include "TF1.h" #include "TMath.h" #include "TSQLServer.h" -// +#include "TGraph.h" +#include "GLTables.h" +#include "TSystem.h" +#include "TRandom.h" + #include "CRC.h" +#include +#include "CalibTrk1Event.h" +#include "CalibTrk2Event.h" class Digitizer{ - protected: // in and output data members TTree* fhBookTree; ofstream fOutputfile; - + int *nspe; + int *ntof; + int *ncat; + int *ncas; + int *ncar; + int *ncal; + int *nnd; + int *nstr; static const int fPSCUbuffer = 8; static const int fTRIGGERbuffer = 152; //(bytes) static const int fTOFbuffer = 276; //(bytes) - static const int fRunHeaderbuffer = 27; // ?? - static const int fRunTrailerbuffer = 17; static const int fACbuffer = 128; static const int fNDbuffer = 6; static const int fS4buffer = 3; @@ -86,9 +91,6 @@ UShort_t fDataPadding[fPADbuffer]; UInt_t fPadding; - UShort_t fDataRunHeader[fRunHeaderbuffer]; - UShort_t fDataRunTrailer[fRunTrailerbuffer]; - UChar_t fDataTrigger[fTRIGGERbuffer]; UChar_t fDataTof[fTOFbuffer]; @@ -144,117 +146,117 @@ Float_t Phi; Float_t P0; Int_t Nthtof; - UChar_t Ipltof[ntof]; - UChar_t Ipaddle[ntof]; - UChar_t Ipartof[ntof]; - Float_t Xintof[ntof]; - Float_t Yintof[ntof]; - Float_t Zintof[ntof]; - Float_t Xouttof[ntof]; - Float_t Youttof[ntof]; - Float_t Zouttof[ntof]; - Float_t Ereltof[ntof]; - Float_t Timetof[ntof]; - Float_t Pathtof[ntof]; - Float_t P0tof[ntof]; + UChar_t *Ipltof; + UChar_t *Ipaddle; + // UChar_t *Ipartof;//DPMJET + UShort_t *Ipartof; + Float_t *Xintof; + Float_t *Yintof; + Float_t *Zintof; + Float_t *Xouttof; + Float_t *Youttof; + Float_t *Zouttof; + Float_t *Ereltof; + Float_t *Timetof; + Float_t *Pathtof; + Float_t *P0tof; Int_t Nthcat; - UChar_t Iparcat[ncat]; - UChar_t Icat[ncat]; - Float_t Xincat[ncat]; - Float_t Yincat[ncat]; - Float_t Zincat[ncat]; - Float_t Xoutcat[ncat]; - Float_t Youtcat[ncat]; - Float_t Zoutcat[ncat]; - Float_t Erelcat[ncat]; - Float_t Timecat[ncat]; - Float_t Pathcat[ncat]; - Float_t P0cat[ncat]; + UChar_t *Iparcat; + UChar_t *Icat; + Float_t *Xincat; + Float_t *Yincat; + Float_t *Zincat; + Float_t *Xoutcat; + Float_t *Youtcat; + Float_t *Zoutcat; + Float_t *Erelcat; + Float_t *Timecat; + Float_t *Pathcat; + Float_t *P0cat; Int_t Nthcas; - UChar_t Iparcas[ncas]; - UChar_t Icas[ncas]; - Float_t Xincas[ncas]; - Float_t Yincas[ncas]; - Float_t Zincas[ncas]; - Float_t Xoutcas[ncas]; - Float_t Youtcas[ncas]; - Float_t Zoutcas[ncas]; - Float_t Erelcas[ncas]; - Float_t Timecas[ncas]; - Float_t Pathcas[ncas]; - Float_t P0cas[ncas]; + UChar_t *Iparcas; + UChar_t *Icas; + Float_t *Xincas; + Float_t *Yincas; + Float_t *Zincas; + Float_t *Xoutcas; + Float_t *Youtcas; + Float_t *Zoutcas; + Float_t *Erelcas; + Float_t *Timecas; + Float_t *Pathcas; + Float_t *P0cas; Int_t Nthspe; - UChar_t Iparspe[nspe]; - UChar_t Itrpb[nspe]; - UChar_t Itrsl[nspe]; - UChar_t Itspa[nspe]; - Float_t Xinspe[nspe]; - Float_t Yinspe[nspe]; - Float_t Zinspe[nspe]; - Float_t Xoutspe[nspe]; - Float_t Youtspe[nspe]; - Float_t Zoutspe[nspe]; - Float_t Xavspe[nspe]; - Float_t Yavspe[nspe]; - Float_t Zavspe[nspe]; - Float_t Erelspe[nspe]; - Float_t Pathspe[nspe]; - Float_t P0spe[nspe]; - UChar_t Nxmult[nspe]; - UChar_t Nymult[nspe]; + // UChar_t *Iparspe;//DPMJET + // UShort_t *Iparspe; + UChar_t *Itrpb; + UChar_t *Itrsl; + UChar_t *Itspa; + Float_t *Xinspe; + Float_t *Yinspe; + Float_t *Zinspe; + Float_t *Xoutspe; + Float_t *Youtspe; + Float_t *Zoutspe; + Float_t *Xavspe; + Float_t *Yavspe; + Float_t *Zavspe; + Float_t *Erelspe; + Float_t *Pathspe; + Float_t *P0spe; + UChar_t *Nxmult; + UChar_t *Nymult; Int_t Nstrpx; - UChar_t Npstripx[nstr]; - UChar_t Ntstripx[nstr]; - UShort_t Istripx[nstr]; - //UInt_t Istripx[nstr]; - Float_t Qstripx[nstr]; - Float_t Xstripx[nstr]; + UChar_t *Npstripx; + UChar_t *Ntstripx; + UShort_t *Istripx; + Float_t *Qstripx; + Float_t *Xstripx; Int_t Nstrpy; - UChar_t Npstripy[nstr]; - UChar_t Ntstripy[nstr]; - UShort_t Istripy[nstr]; - //UInt_t Istripy[nstr]; - Float_t Qstripy[nstr]; - Float_t Ystripy[nstr]; + UChar_t *Npstripy; + UChar_t *Ntstripy; + UShort_t *Istripy; + Float_t *Qstripy; + Float_t *Ystripy; Int_t Nthcali; UChar_t Icaplane[4224]; UChar_t Icastrip[4224]; Int_t Icamod[4224]; Float_t Enestrip[4224]; Int_t Nthcal; - UChar_t Icapl[ncal]; - UChar_t Icasi[ncal]; - UChar_t Icast[ncal]; - Float_t Xincal[ncal]; - Float_t Yincal[ncal]; - Float_t Zincal[ncal]; - Float_t Erelcal[ncal]; + UChar_t *Icapl; + UChar_t *Icasi; + UChar_t *Icast; + Float_t *Xincal; + Float_t *Yincal; + Float_t *Zincal; + Float_t *Erelcal; Int_t Nthnd; - UChar_t Itubend[nnd]; - UChar_t Iparnd[nnd]; - Float_t Xinnd[nnd]; - Float_t Yinnd[nnd]; - Float_t Zinnd[nnd]; - Float_t Xoutnd[nnd]; - Float_t Youtnd[nnd]; - Float_t Zoutnd[nnd]; - Float_t Erelnd[nnd]; - Float_t Timend[nnd]; - Float_t Pathnd[nnd]; - Float_t P0nd[nnd]; + UChar_t *Itubend; + UChar_t *Iparnd; + Float_t *Xinnd; + Float_t *Yinnd; + Float_t *Zinnd; + Float_t *Xoutnd; + Float_t *Youtnd; + Float_t *Zoutnd; + Float_t *Erelnd; + Float_t *Timend; + Float_t *Pathnd; + Float_t *P0nd; Int_t Nthcard; - UChar_t Iparcard[ncar]; - UChar_t Icard[ncar]; - Float_t Xincard[ncar]; - Float_t Yincard[ncar]; - Float_t Zincard[ncar]; - Float_t Xoutcard[ncar]; - Float_t Youtcard[ncar]; - Float_t Zoutcard[ncar]; - Float_t Erelcard[ncar]; - Float_t Timecard[ncar]; - Float_t Pathcard[ncar]; - Float_t P0card[ncar]; + UChar_t *Iparcard; + UChar_t *Icard; + Float_t *Xincard; + Float_t *Yincard; + Float_t *Zincard; + Float_t *Xoutcard; + Float_t *Youtcard; + Float_t *Zoutcard; + Float_t *Erelcard; + Float_t *Timecard; + Float_t *Pathcard; + Float_t *P0card; // List of branches TBranch *b_Irun; //! @@ -377,10 +379,10 @@ TBranch *b_Pathcard; //! TBranch *b_P0card; //! // - + TF1 *attenAC; public: - Digitizer(TTree *tree, char* &file_raw); // constructor + Digitizer(TTree*,char*&,int,int,int,int,int,int,int,int); // constructor void Close(); void SetTree(TTree *tree) {fhBookTree = tree;}; @@ -388,9 +390,6 @@ void DigitizePSCU(UInt_t, UChar_t, UShort_t*); // digitizes the CPU header void AddPadding(); - void DigitizeRunHeader(); - void DigitizeRunTrailer(); - // void DigitizeTRIGGER(); // SO nov'07: included in DigitizeTOF void DigitizeTOF(int np,float *atte1,float *atte2,float *lambda1,float *lambda2); // digitizes the tof void LoadTOFCalib(int np,float *atte1,float *atte2,float *lambda1,float *lambda2); //load TOF calibration void DigitizeAC(); // digitizes the anti-counter @@ -434,8 +433,6 @@ Float_t SaturationTracky(Float_t ADC); // Saturation simulation // end methods for Tracker - void WriteRunHeader(); - void WriteRunTrailer(); void WriteData(); // writes data to file void ReadData();