• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

beamtime/tof-tdctest/go4/MBSUNPACK/TMbsCrateEvent.h (r4864/r4267)

Go to the documentation of this file.
00001 #ifndef TMBSCRATEEVENT_H
00002 #define TMBSCRATEEVENT_H
00003 
00004 #include "TGo4EventElement.h"
00005 
00006 #include "T1290Data.h"
00007 
00008 #include <stdint.h>
00009 /*
00010  * Put all definitions here and use them in processor,
00011  * since they are necessary for data structure of event
00012  */
00013 
00014 #include "MbsCrateDefines.h"
00015 
00016 class MQDC_t: public TObject {
00017   public:
00018      enum {NumChan = 16 };
00019 
00020      Int_t charge[NumChan];
00021      Int_t range[NumChan];
00022      Int_t under[NumChan];
00023      Int_t over[NumChan];
00024 
00025      MQDC_t() : TObject() { Clear(); };
00026 
00027      void Clear(void);
00028 
00029      void Unpack(int* pdata, unsigned len, int expected_geo = 0);
00030 
00031      static int FindGeo(int* pdata, int *len, int *crate);
00032 
00033    ClassDef(MQDC_t, 1)
00034 };
00035 
00036 struct FPGA_TDC_hit {
00037    uint32_t ch_ix;
00038    uint32_t coarse_ct;
00039    uint32_t ch_tim;
00040    uint32_t future_bit;
00041    // default constructor
00042    FPGA_TDC_hit() : ch_ix(0), coarse_ct(0), ch_tim(0), future_bit(0) {}
00043 
00044    // copy constructor, used by vector to copy content
00045    FPGA_TDC_hit(const FPGA_TDC_hit& src) :
00046       ch_ix(src.ch_ix), coarse_ct(src.coarse_ct), ch_tim(src.ch_tim), future_bit(src.future_bit) {}
00047 
00048    // Define < operator for vector sorting
00049    Bool_t operator <( const FPGA_TDC_hit& rhs) const
00050    {
00051       if( rhs.coarse_ct < VFTX_COARSE_OVERFLW_CHK &&
00052             this->coarse_ct >= rhs.coarse_ct + VFTX_COARSE_OVERFLW_CHK )
00053          // Corse counter overflow between this hit and checked one
00054          // hit ... Ovflw ... rhs
00055          return kTRUE;
00056       else if( this->coarse_ct < VFTX_COARSE_OVERFLW_CHK &&
00057             this->coarse_ct + VFTX_COARSE_OVERFLW_CHK <= rhs.coarse_ct )
00058          // Corse counter overflow between checked hit and this one
00059          // rhs ... Ovflw ... hit
00060          return kFALSE;
00061       else if( this->coarse_ct < rhs.coarse_ct )
00062          // CT hit ... rhs
00063          return kTRUE;
00064       else if( this->coarse_ct > rhs.coarse_ct )
00065          // CT rhs ... hit
00066          return kFALSE;
00067       else if( this->ch_tim > rhs.ch_tim)
00068          // Comparator inverted as FineTime is counting
00069          // Backward from next epoch!!!!!
00070          // CT rhs = hit
00071          // FT hit ... rhs
00072          return kTRUE;
00073       // CT rhs = hit
00074       // FT rhs ... hit or rhs = hit
00075       else return kFALSE;
00076    }
00077 };
00078 
00079 
00080 struct FPGA_TDC_header {
00081    uint32_t mod_nr;
00082    uint32_t nr_data;
00083    uint32_t fpga_fifo_tt;
00084    uint32_t fpga_fifo_ct;
00085    uint32_t fpga_fifo_nd;
00086 
00087    // default constructor
00088    FPGA_TDC_header() : mod_nr(0), nr_data(0), fpga_fifo_tt(0), fpga_fifo_ct(0), fpga_fifo_nd(0) {}
00089 
00090    // copy constructor, used by vector to copy content
00091    FPGA_TDC_header(const FPGA_TDC_header& src) :
00092       mod_nr(src.mod_nr), nr_data(src.nr_data), fpga_fifo_tt(src.fpga_fifo_tt), fpga_fifo_ct(src.fpga_fifo_ct), fpga_fifo_nd(src.fpga_fifo_nd) {}
00093 };
00094 
00095 struct QFW_Data {
00096    uint32_t counters[4];
00097    uint32_t errcnt[4];
00098    uint32_t setup;
00099 
00100    QFW_Data()
00101    {
00102       for (int n=0;n<4;n++) { counters[n] = 0; errcnt[n] = 0; }
00103       setup = 0;
00104    }
00105 
00106    QFW_Data(const QFW_Data& src)
00107    {
00108       for (int n=0;n<4;n++) {
00109          counters[n] = src.counters[n];
00110          errcnt[n] = src.errcnt[n];
00111       }
00112       setup = src.setup;
00113    }
00114 };
00115 
00116 struct ScalOrMu_Data {
00117    UInt_t uScaler[SCALORMU_NB_SCAL];
00118    UInt_t uReferenceClock;
00119 
00120    ScalOrMu_Data()
00121    {
00122       for( Int_t iScalerInd=0; iScalerInd < SCALORMU_NB_SCAL; iScalerInd++)
00123          uScaler[iScalerInd] = 0;
00124       uReferenceClock = 0;
00125    }
00126 
00127    ScalOrMu_Data(const ScalOrMu_Data& src)
00128    {
00129       for( Int_t iScalerInd=0; iScalerInd < SCALORMU_NB_SCAL; iScalerInd++)
00130          uScaler[iScalerInd] = src.uScaler[iScalerInd];
00131       uReferenceClock = src.uReferenceClock;
00132    }
00133 };
00134 
00135 class TMbsCrateEvent : public TGo4EventElement {
00136 
00137    public:
00138 
00139       TMbsCrateEvent();
00140       TMbsCrateEvent(const char* name, Short_t id=0);
00141       virtual ~TMbsCrateEvent();
00142 
00144       virtual void Clear(Option_t *t="");
00145 
00146       /* Data of 1182 QDC*/
00147       UShort_t fData1182[MAX_1182][NUM_1182_CH];
00148 
00150       T1290Data fMtdc[MAX_1290];
00151 
00153       MQDC_t fMqdc[MAX_965];
00154 
00156       std::vector<FPGA_TDC_hit>  fFPGA[MAX_FPGA_TDC];
00157       
00159       std::vector<FPGA_TDC_header> fFPGAHEAD[MAX_FPGA_TDC];
00160 
00162       QFW_Data fQFW;
00163 
00165       ScalOrMu_Data fScalOrMu;
00166 
00167       /* Triglog input pattern*/
00168       UInt_t fTriglogInputPattern;
00169       /* Internal 781250 Hz reference clock for rates calculation */
00170       UInt_t fTriglogReferenceClock;
00171 
00172    ClassDef(TMbsCrateEvent,3)
00173 };
00174 
00175 #endif //TEVENT_H
00176 

Generated on Tue Dec 10 2013 04:52:17 for ROCsoft by  doxygen 1.7.1