3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
7 #include "AliRawDataHeader.h"
10 class AliRawReader: public TObject {
13 AliRawReader(const AliRawReader& rawReader);
14 AliRawReader& operator = (const AliRawReader& rawReader);
15 virtual ~AliRawReader() {};
17 void Select(Int_t detectorID,
18 Int_t minDDLID = -1, Int_t maxDDLID = -1);
19 void SelectEquipment(Int_t equipmentType,
20 Int_t minEquipmentId = -1,
21 Int_t maxEquipmentId = -1);
22 void SkipInvalid(Bool_t skip = kTRUE)
23 {fSkipInvalid = skip;};
25 virtual UInt_t GetType() const = 0;
26 virtual UInt_t GetRunNumber() const = 0;
27 virtual const UInt_t* GetEventId() const = 0;
28 virtual const UInt_t* GetTriggerPattern() const = 0;
29 virtual const UInt_t* GetDetectorPattern() const = 0;
30 virtual const UInt_t* GetAttributes() const = 0;
31 virtual UInt_t GetLDCId() const = 0;
32 virtual UInt_t GetGDCId() const = 0;
34 virtual Int_t GetEquipmentSize() const = 0;
35 virtual Int_t GetEquipmentType() const = 0;
36 virtual Int_t GetEquipmentId() const = 0;
37 virtual const UInt_t* GetEquipmentAttributes() const = 0;
38 virtual Int_t GetEquipmentElementSize() const = 0;
40 Int_t GetDetectorID() const
41 {if (GetEquipmentId() >= 0) return (GetEquipmentId() >> 8); else return -1;};
42 Int_t GetDDLID() const
43 {if (GetEquipmentId() >= 0) return (GetEquipmentId() & 0xFF); else return -1;};
45 Int_t GetDataSize() const
46 {if (fHeader) return fHeader->fSize - sizeof(AliRawDataHeader);
47 else return GetEquipmentSize();};
49 Int_t GetVersion() const
50 {if (fHeader) return fHeader->fVersion; else return -1;};
51 Bool_t IsValid() const
52 {if (fHeader) return fHeader->TestAttribute(0);
54 Bool_t IsCompressed() const
55 {if (fHeader) return fHeader->TestAttribute(1);
58 virtual Bool_t ReadHeader() = 0;
59 virtual Bool_t ReadNextData(UChar_t*& data) = 0;
60 virtual Bool_t ReadNextInt(UInt_t& data);
61 virtual Bool_t ReadNextShort(UShort_t& data);
62 virtual Bool_t ReadNextChar(UChar_t& data);
64 virtual Bool_t Reset() = 0;
66 enum {kErrMagic=1, kErrNoDataHeader=2,
67 kErrSize=4, kErrOutOfBounds=8};
68 virtual Int_t CheckData() const;
69 Int_t GetErrorCode() {return fErrorCode;};
71 void DumpData(Int_t limit = -1);
74 Bool_t IsSelected() const;
76 virtual Bool_t ReadNext(UChar_t* data, Int_t size) = 0;
78 AliRawDataHeader* fHeader; // current data header
79 Int_t fCount; // counter of bytes to be read for current DDL
81 Int_t fSelectEquipmentType; // type of selected equipment (<0 = no selection)
82 Int_t fSelectMinEquipmentId; // minimal index of selected equipment (<0 = no selection)
83 Int_t fSelectMaxEquipmentId; // maximal index of selected equipment (<0 = no selection)
84 Bool_t fSkipInvalid; // skip invalid data
86 Int_t fErrorCode; // code of last error
88 ClassDef(AliRawReader, 0) // base class for reading raw digits