]>
Commit | Line | Data |
---|---|---|
a6e7b125 | 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 | ||
bea6b2a4 | 6 | /* $Id$ */ |
7 | ||
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | /// | |
10 | /// This is the base class for reading raw data. | |
11 | /// | |
12 | /////////////////////////////////////////////////////////////////////////////// | |
13 | ||
a6e7b125 | 14 | #include <TObject.h> |
39f9963f | 15 | #include "AliRawDataHeader.h" |
8de97894 | 16 | |
a6e7b125 | 17 | |
a6e7b125 | 18 | class AliRawReader: public TObject { |
19 | public : | |
8de97894 | 20 | AliRawReader(); |
42d20574 | 21 | AliRawReader(const AliRawReader& rawReader); |
22 | AliRawReader& operator = (const AliRawReader& rawReader); | |
23 | virtual ~AliRawReader() {}; | |
8de97894 | 24 | |
25 | void Select(Int_t detectorID, | |
26 | Int_t minDDLID = -1, Int_t maxDDLID = -1); | |
f224de6c | 27 | void SelectEquipment(Int_t equipmentType, |
28 | Int_t minEquipmentId = -1, | |
29 | Int_t maxEquipmentId = -1); | |
39f9963f | 30 | void SkipInvalid(Bool_t skip = kTRUE) |
31 | {fSkipInvalid = skip;}; | |
dd9a70fe | 32 | void SelectEvents(Int_t type); |
a6e7b125 | 33 | |
42d20574 | 34 | virtual UInt_t GetType() const = 0; |
35 | virtual UInt_t GetRunNumber() const = 0; | |
36 | virtual const UInt_t* GetEventId() const = 0; | |
37 | virtual const UInt_t* GetTriggerPattern() const = 0; | |
38 | virtual const UInt_t* GetDetectorPattern() const = 0; | |
39 | virtual const UInt_t* GetAttributes() const = 0; | |
e94ad92c | 40 | virtual const UInt_t* GetSubEventAttributes() const = 0; |
c946ab02 | 41 | virtual UInt_t GetLDCId() const = 0; |
42d20574 | 42 | virtual UInt_t GetGDCId() const = 0; |
04fa961a | 43 | |
c946ab02 | 44 | virtual Int_t GetEquipmentSize() const = 0; |
45 | virtual Int_t GetEquipmentType() const = 0; | |
46 | virtual Int_t GetEquipmentId() const = 0; | |
47 | virtual const UInt_t* GetEquipmentAttributes() const = 0; | |
48 | virtual Int_t GetEquipmentElementSize() const = 0; | |
a6e7b125 | 49 | |
39f9963f | 50 | Int_t GetDetectorID() const |
51 | {if (GetEquipmentId() >= 0) return (GetEquipmentId() >> 8); else return -1;}; | |
52 | Int_t GetDDLID() const | |
53 | {if (GetEquipmentId() >= 0) return (GetEquipmentId() & 0xFF); else return -1;}; | |
54 | ||
c946ab02 | 55 | Int_t GetDataSize() const |
527a1d3f | 56 | {if (fHeader) { |
57 | if (fHeader->fSize != 0xFFFFFFFF) return fHeader->fSize - sizeof(AliRawDataHeader); | |
58 | else return GetEquipmentSize() - sizeof(AliRawDataHeader); | |
59 | } else return GetEquipmentSize();}; | |
509a7696 | 60 | |
c946ab02 | 61 | Int_t GetVersion() const |
39f9963f | 62 | {if (fHeader) return fHeader->fVersion; else return -1;}; |
63 | Bool_t IsValid() const | |
64 | {if (fHeader) return fHeader->TestAttribute(0); | |
65 | else return kFALSE;}; | |
c946ab02 | 66 | Bool_t IsCompressed() const |
39f9963f | 67 | {if (fHeader) return fHeader->TestAttribute(1); |
c946ab02 | 68 | else return kFALSE;}; |
c3408d7d | 69 | Bool_t TestBlockAttribute(Int_t index) const |
70 | {if (fHeader) return fHeader->TestAttribute(index); | |
71 | else return kFALSE;}; | |
72 | UChar_t GetBlockAttributes() const | |
73 | {if (fHeader) return fHeader->GetAttributes(); | |
74 | else return 0;}; | |
f58b3254 | 75 | UInt_t GetStatusBits() const |
76 | {if (fHeader) return fHeader->GetStatus(); | |
77 | else return 0;}; | |
c3408d7d | 78 | const AliRawDataHeader* GetDataHeader() const |
79 | {return fHeader;} | |
c946ab02 | 80 | |
81 | virtual Bool_t ReadHeader() = 0; | |
8de97894 | 82 | virtual Bool_t ReadNextData(UChar_t*& data) = 0; |
83 | virtual Bool_t ReadNextInt(UInt_t& data); | |
84 | virtual Bool_t ReadNextShort(UShort_t& data); | |
85 | virtual Bool_t ReadNextChar(UChar_t& data); | |
86 | ||
87 | virtual Bool_t Reset() = 0; | |
a6e7b125 | 88 | |
dd9a70fe | 89 | virtual Bool_t NextEvent() = 0; |
90 | virtual Bool_t RewindEvents() = 0; | |
91 | ||
39f9963f | 92 | enum {kErrMagic=1, kErrNoDataHeader=2, |
93 | kErrSize=4, kErrOutOfBounds=8}; | |
b4857df7 | 94 | virtual Int_t CheckData() const; |
bea6b2a4 | 95 | Int_t GetErrorCode() const {return fErrorCode;}; |
b4857df7 | 96 | |
509a7696 | 97 | void DumpData(Int_t limit = -1); |
98 | ||
a6e7b125 | 99 | protected : |
42d20574 | 100 | Bool_t IsSelected() const; |
dd9a70fe | 101 | Bool_t IsEventSelected() const; |
a6e7b125 | 102 | |
8de97894 | 103 | virtual Bool_t ReadNext(UChar_t* data, Int_t size) = 0; |
a6e7b125 | 104 | |
39f9963f | 105 | AliRawDataHeader* fHeader; // current data header |
a6e7b125 | 106 | Int_t fCount; // counter of bytes to be read for current DDL |
107 | ||
f224de6c | 108 | Int_t fSelectEquipmentType; // type of selected equipment (<0 = no selection) |
109 | Int_t fSelectMinEquipmentId; // minimal index of selected equipment (<0 = no selection) | |
110 | Int_t fSelectMaxEquipmentId; // maximal index of selected equipment (<0 = no selection) | |
39f9963f | 111 | Bool_t fSkipInvalid; // skip invalid data |
dd9a70fe | 112 | Int_t fSelectEventType; // type of selected events (<0 = no selection) |
8de97894 | 113 | |
b4857df7 | 114 | Int_t fErrorCode; // code of last error |
115 | ||
a6e7b125 | 116 | ClassDef(AliRawReader, 0) // base class for reading raw digits |
117 | }; | |
118 | ||
119 | #endif |