]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliAltroRawStream.h
Huffman TPC compression removed. New version of the base altro raw stream reader...
[u/mrichter/AliRoot.git] / RAW / AliAltroRawStream.h
1 #ifndef ALIALTRORAWSTREAM_H
2 #define ALIALTRORAWSTREAM_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 ///
10 /// This is a base class for reading raw data digits in Altro format
11 ///
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include <TObject.h>
15
16 class AliRawReader;
17
18 class AliAltroRawStream: public TObject {
19   public :
20     AliAltroRawStream(AliRawReader* rawReader);
21     virtual ~AliAltroRawStream();
22
23     virtual void             Reset();
24     virtual Bool_t           Next();
25
26     inline Int_t GetSector()     const { return fSector; }     // Provide index of current sector
27     inline Int_t GetPrevSector() const { return fPrevSector; } // Provide index of previous sector
28     inline Bool_t  IsNewSector() const {return fSector != fPrevSector;};
29     inline Int_t GetRow()        const { return fRow; }        // Provide index of current row
30     inline Int_t GetPrevRow()    const { return fPrevRow; }    // Provide index of previous row
31     inline Bool_t     IsNewRow() const {return (fRow != fPrevRow) || IsNewSector();};
32     inline Int_t GetPad()        const { return fPad; }        // Provide index of current pad
33     inline Int_t GetPrevPad()    const { return fPrevPad; }    // Provide index of previous pad
34     inline Bool_t     IsNewPad() const {return (fPad != fPrevPad) || IsNewRow();};
35     inline Int_t GetHWAddress()  const { return fHWAddress; }  // Provide current hardware address
36     inline Int_t GetPrevHWAddress() const { return fPrevHWAddress; }  // Provide previous hardware address
37     inline Int_t GetTime()       const { return fTime; }       // Provide index of current time bin
38     inline Int_t GetSignal()     const { return fSignal; }     // Provide signal in ADC counts
39     inline Int_t GetTimeLength() const { return fTimeBunch; }  // Provide total length of current time bunch
40
41   protected:
42     AliAltroRawStream(const AliAltroRawStream& stream);
43     AliAltroRawStream& operator = (const AliAltroRawStream& stream);
44
45     virtual void             ApplyAltroMapping() { fSector = fRow = fPad = -1; }
46
47     Int_t            fSector;       // index of current sector
48     Int_t            fPrevSector;   // index of previous sector
49     Int_t            fRow;          // index of current row
50     Int_t            fPrevRow;      // index of previous row
51     Int_t            fPad;          // index of current pad
52     Int_t            fPrevPad;      // index of previous pad
53     Short_t          fHWAddress;    // current hardware address
54     Short_t          fPrevHWAddress;// previous hardware address
55     Int_t            fTime;         // index of current time bin
56     Int_t            fSignal;       // signal in ADC counts
57     Int_t            fTimeBunch;    // total length of the current time bunch
58
59     AliRawReader*    fRawReader;    // object for reading the raw data
60
61     UChar_t*         fData;         // raw data
62
63     Bool_t           fNoAltroMapping; // temporary flag in case of no altro mapping is provided
64
65   private :
66
67     UShort_t         GetNextWord();
68     Bool_t           ReadTrailer();
69     Bool_t           ReadDummyTrailer();
70     void             ReadBunch();
71     void             ReadAmplitude();
72     Int_t            GetPosition();
73
74     Int_t            fPosition;     // current (10 bit) position in fData
75     Int_t            fCount;        // counter of words to be read for current trailer
76     Int_t            fBunchLength;  // remaining number of signal bins in the current bunch
77
78     ClassDef(AliAltroRawStream, 0)  // base class for reading Altro raw digits
79 };
80
81 #endif