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