X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=RAW%2FAliRawReader.h;h=3c98c38365f1bf10e55e7741d9fedd84902ab7f6;hb=4e99539f8a2c076f9b0375e2fbfc6584ce0f3919;hp=c80814201d19b68e9f6e25f831ab472bfd6dd7e6;hpb=f58b3254edad4427b32df489b23a9bf37ccd3a6b;p=u%2Fmrichter%2FAliRoot.git diff --git a/RAW/AliRawReader.h b/RAW/AliRawReader.h index c80814201d1..3c98c38365f 100644 --- a/RAW/AliRawReader.h +++ b/RAW/AliRawReader.h @@ -12,24 +12,35 @@ /////////////////////////////////////////////////////////////////////////////// #include +#include +#include + +#include "AliRawDataErrorLog.h" #include "AliRawDataHeader.h" +class AliRawEventHeaderBase; class AliRawReader: public TObject { public : AliRawReader(); AliRawReader(const AliRawReader& rawReader); AliRawReader& operator = (const AliRawReader& rawReader); - virtual ~AliRawReader() {}; + virtual ~AliRawReader(); void Select(Int_t detectorID, Int_t minDDLID = -1, Int_t maxDDLID = -1); + void Select(const char *detectorName, + Int_t minDDLID = -1, Int_t maxDDLID = -1); void SelectEquipment(Int_t equipmentType, Int_t minEquipmentId = -1, Int_t maxEquipmentId = -1); void SkipInvalid(Bool_t skip = kTRUE) {fSkipInvalid = skip;}; void SelectEvents(Int_t type); + virtual void RequireHeader(Bool_t required) + {fRequireHeader = required;}; + + virtual const AliRawEventHeaderBase* GetEventHeader() const {return NULL;}; virtual UInt_t GetType() const = 0; virtual UInt_t GetRunNumber() const = 0; @@ -37,41 +48,54 @@ class AliRawReader: public TObject { virtual const UInt_t* GetTriggerPattern() const = 0; virtual const UInt_t* GetDetectorPattern() const = 0; virtual const UInt_t* GetAttributes() const = 0; + virtual const UInt_t* GetSubEventAttributes() const = 0; virtual UInt_t GetLDCId() const = 0; virtual UInt_t GetGDCId() const = 0; virtual Int_t GetEquipmentSize() const = 0; virtual Int_t GetEquipmentType() const = 0; virtual Int_t GetEquipmentId() const = 0; + Int_t GetMappedEquipmentId() const; + Bool_t LoadEquipmentIdsMap(const char *fileName); virtual const UInt_t* GetEquipmentAttributes() const = 0; virtual Int_t GetEquipmentElementSize() const = 0; + virtual Int_t GetEquipmentHeaderSize() const = 0; - Int_t GetDetectorID() const - {if (GetEquipmentId() >= 0) return (GetEquipmentId() >> 8); else return -1;}; - Int_t GetDDLID() const - {if (GetEquipmentId() >= 0) return (GetEquipmentId() & 0xFF); else return -1;}; + Int_t GetDetectorID() const; + Int_t GetDDLID() const; Int_t GetDataSize() const - {if (fHeader) return fHeader->fSize - sizeof(AliRawDataHeader); - else return GetEquipmentSize();}; + {if (fHeader) { + if (fHeader->fSize != 0xFFFFFFFF) return fHeader->fSize - sizeof(AliRawDataHeader); + else return GetEquipmentSize() - GetEquipmentHeaderSize() - sizeof(AliRawDataHeader); + } else return GetEquipmentSize() - GetEquipmentHeaderSize();}; Int_t GetVersion() const - {if (fHeader) return fHeader->fVersion; else return -1;}; + {if (fHeader) return fHeader->GetVersion(); else return -1;}; Bool_t IsValid() const {if (fHeader) return fHeader->TestAttribute(0); else return kFALSE;}; Bool_t IsCompressed() const {if (fHeader) return fHeader->TestAttribute(1); else return kFALSE;}; + Bool_t TestBlockAttribute(Int_t index) const + {if (fHeader) return fHeader->TestAttribute(index); + else return kFALSE;}; + UChar_t GetBlockAttributes() const + {if (fHeader) return fHeader->GetAttributes(); + else return 0;}; UInt_t GetStatusBits() const {if (fHeader) return fHeader->GetStatus(); else return 0;}; + const AliRawDataHeader* GetDataHeader() const + {return fHeader;} virtual Bool_t ReadHeader() = 0; virtual Bool_t ReadNextData(UChar_t*& data) = 0; virtual Bool_t ReadNextInt(UInt_t& data); virtual Bool_t ReadNextShort(UShort_t& data); virtual Bool_t ReadNextChar(UChar_t& data); + virtual Bool_t ReadNext(UChar_t* data, Int_t size) = 0; virtual Bool_t Reset() = 0; @@ -85,22 +109,49 @@ class AliRawReader: public TObject { void DumpData(Int_t limit = -1); + void AddErrorLog(AliRawDataErrorLog::ERawDataErrorLevel level, + Int_t code, + const char *message = NULL); + void AddMinorErrorLog(Int_t code, + const char *message = NULL) { + return AddErrorLog(AliRawDataErrorLog::kMinor,code,message); + } + void AddMajorErrorLog(Int_t code, + const char *message = NULL) { + return AddErrorLog(AliRawDataErrorLog::kMajor,code,message); + } + void AddFatalErrorLog(Int_t code, + const char *message = NULL) { + return AddErrorLog(AliRawDataErrorLog::kFatal,code,message); + } + Int_t GetNumberOfErrorLogs() const { return fErrorLogs.GetEntriesFast(); } + const TClonesArray &GetAllErrorLogs() const { return fErrorLogs; } + AliRawDataErrorLog *GetErrorLog(Int_t i) const { + return (AliRawDataErrorLog *)fErrorLogs.UncheckedAt(i); + } + protected : Bool_t IsSelected() const; Bool_t IsEventSelected() const; - virtual Bool_t ReadNext(UChar_t* data, Int_t size) = 0; + TArrayI *fEquipmentIdsIn; // array of equipment Ids to be mapped + TArrayI *fEquipmentIdsOut; // array of mapped equipment Ids - AliRawDataHeader* fHeader; // current data header - Int_t fCount; // counter of bytes to be read for current DDL + Bool_t fRequireHeader; // if false, data without header is accepted + + AliRawDataHeader* fHeader; // current data header + Int_t fCount; // counter of bytes to be read for current DDL Int_t fSelectEquipmentType; // type of selected equipment (<0 = no selection) Int_t fSelectMinEquipmentId; // minimal index of selected equipment (<0 = no selection) Int_t fSelectMaxEquipmentId; // maximal index of selected equipment (<0 = no selection) - Bool_t fSkipInvalid; // skip invalid data - Int_t fSelectEventType; // type of selected events (<0 = no selection) + Bool_t fSkipInvalid; // skip invalid data + Int_t fSelectEventType; // type of selected events (<0 = no selection) + + Int_t fErrorCode; // code of last error - Int_t fErrorCode; // code of last error + Int_t fEventNumber; // current event number + TClonesArray fErrorLogs; // raw data decoding errors ClassDef(AliRawReader, 0) // base class for reading raw digits };