]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTDDLDecoder.h
Effective c++, committed on behalf of �ystein Djuvsland
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTDDLDecoder.h
1 #ifndef ALIHLTDDLDECODER_H
2 #define ALIHLTDDLDECODER_H
3
4 #include "Rtypes.h"
5 #include <iostream>
6 //#include 
7
8 using  std::cout;
9 using  std::endl;
10
11 #define DDL_32BLOCK_SIZE 5
12
13
14 #include "AliHLTPHOSConstants.h"
15
16
17 using namespace PhosHLTConst;
18
19
20 class AliHLTAltroData;
21
22
23 class AliHLTDDLDecoder
24 {
25  public:
26   AliHLTDDLDecoder();
27   virtual ~AliHLTDDLDecoder();
28   bool CheckPayload();
29   bool Decode();
30   bool NextChannel(AliHLTAltroData *altroDataPtr);
31
32   //  bool NextBunch();
33
34   template<typename T> 
35   void  DumpData(T *array, int N, int nPerLine)
36   {
37     cout <<   "DumpData N=  " << N <<endl;
38     for(int i= 0; i< N; i++)
39       {
40         if((i%nPerLine == 0)  &&  (i != 0))
41           {
42             printf("\n");
43           }
44
45         cout << array[i]<< "\t";
46
47       }
48   }
49
50
51   void SetMemory(UChar_t  *dtaPtr, UInt_t size);
52   void SetNTrailerWords(int N);
53   void PrintInfo(AliHLTAltroData &altrodata, int n = 0, int nPerLine = 4);
54   float GetFailureRate();
55
56
57  private:
58   void DecodeDDLBlock();
59   void DecodeLastDDLBlock();
60   int GetMarker(UInt_t *buffer, int index);
61
62
63   //  void ReadAltroTrailer();
64
65   //  void ResetBuffer();
66
67   UInt_t  *f32DtaPtr;
68   UChar_t *f8DtaPtr;   
69   long int fN32HeaderWords;
70   long int fN32RcuTrailerWords;
71   unsigned int fNDDLBlocks;
72   long int fBufferPos;
73   unsigned long  fN40AltroWords;
74   unsigned long  fN40RcuAltroWords;
75   UInt_t  fSize;
76   unsigned int fSegmentation;
77   unsigned int f32LastDDLBlockSize;
78   UInt_t f32PayloadSize;
79   UInt_t fBufferIndex;
80   UInt_t fN10bitWords;
81   UInt_t fBuffer[N_FEECS*N_BRANCHES*8*N_ALTROCHANNELS*(ALTRO_MAX_SAMPLES + ALTRO_MAX_TRALER_SIZE)];  
82   UInt_t fDDLBlockDummy[DDL_BLOCK_SIZE];
83   UInt_t fDDLBlockCnt;
84   UInt_t fNAltro10bitWords;
85   UInt_t fNAltroLastSequence10bitWords;
86   UInt_t fHadd;
87   //  UInt_t f10Wc;
88   //  UInt_t fCnt;
89   UInt_t fI;
90
91   int fComplete;
92   int fInComplete;
93
94 };
95
96 #endif