]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliRawReader.h
create a new AliEn directory per day (like for the physical files in CASTOR),
[u/mrichter/AliRoot.git] / RAW / AliRawReader.h
1 #ifndef ALIRAWREADER_H
2 #define ALIRAWREADER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 #include <TObject.h>
7 #include "AliMiniHeader.h"
8
9
10 class AliRawReader: public TObject {
11   public :
12     AliRawReader();
13     AliRawReader(const AliRawReader& rawReader);
14     AliRawReader& operator = (const AliRawReader& rawReader);
15     virtual ~AliRawReader() {};
16
17     void             Select(Int_t detectorID, 
18                             Int_t minDDLID = -1, Int_t maxDDLID = -1);
19
20     virtual UInt_t   GetType() const = 0;
21     virtual UInt_t   GetRunNumber() const = 0;
22     virtual const UInt_t* GetEventId() const = 0;
23     virtual const UInt_t* GetTriggerPattern() const = 0;
24     virtual const UInt_t* GetDetectorPattern() const = 0;
25     virtual const UInt_t* GetAttributes() const = 0;
26     virtual UInt_t   GetGDCId() const = 0;
27
28     Int_t            GetDataSize() const {return fMiniHeader->fSize;};
29     Int_t            GetDetectorID() const {return fMiniHeader->fDetectorID;};
30     Int_t            GetDDLID() const {return fMiniHeader->fDDLID;};
31     Int_t            GetVersion() const {return fMiniHeader->fVersion;};
32     Bool_t           IsCompressed() const {return fMiniHeader->fCompressionFlag != 0;};
33
34     virtual Bool_t   ReadMiniHeader() = 0;
35     virtual Bool_t   ReadNextData(UChar_t*& data) = 0;
36     virtual Bool_t   ReadNextInt(UInt_t& data);
37     virtual Bool_t   ReadNextShort(UShort_t& data);
38     virtual Bool_t   ReadNextChar(UChar_t& data);
39
40     virtual Bool_t   Reset() = 0;
41
42     enum {kErrMagic=1, kErrNoMiniHeader=2, kErrMiniMagic=3, 
43           kErrSize=4, kErrOutOfBounds=5};
44     virtual Int_t    CheckData() const;
45     Int_t            GetErrorCode() {return fErrorCode;};
46
47   protected :
48     Bool_t           IsSelected() const;
49
50     Bool_t           CheckMiniHeader(AliMiniHeader* miniHeader = NULL) const;
51     virtual Bool_t   ReadNext(UChar_t* data, Int_t size) = 0;
52
53     AliMiniHeader*   fMiniHeader;  // current mini header
54     Int_t            fCount;       // counter of bytes to be read for current DDL
55
56     Int_t            fSelectDetectorID;  // id of selected detector (<0 = no selection)
57     Int_t            fSelectMinDDLID;    // minimal index of selected DDLs (<0 = no selection)
58     Int_t            fSelectMaxDDLID;    // maximal index of selected DDLs (<0 = no selection)
59
60     Int_t            fErrorCode;         // code of last error
61
62     ClassDef(AliRawReader, 0) // base class for reading raw digits
63 };
64
65 #endif