]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawReader.h
Possibility to overload SetY and SetZ
[u/mrichter/AliRoot.git] / RAW / AliRawReader.h
index c3316a889c2b7bfffded314ced94e5f073c8892f..d07e9101c5d15e35e0e94108ff362fb859111128 100644 (file)
@@ -3,6 +3,14 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// This is the base class for reading raw data.
+///
+///////////////////////////////////////////////////////////////////////////////
+
 #include <TObject.h>
 #include "AliRawDataHeader.h"
 
@@ -21,6 +29,9 @@ class AliRawReader: public TObject {
                                     Int_t maxEquipmentId = -1);
     void             SkipInvalid(Bool_t skip = kTRUE)
       {fSkipInvalid = skip;};
+    void             SelectEvents(Int_t type);
+    void             RequireHeader(Bool_t required = kTRUE)
+      {fRequireHeader = required;};
 
     virtual UInt_t   GetType() const = 0;
     virtual UInt_t   GetRunNumber() const = 0;
@@ -28,6 +39,7 @@ 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;
 
@@ -43,8 +55,10 @@ class AliRawReader: public TObject {
       {if (GetEquipmentId() >= 0) return (GetEquipmentId() & 0xFF); else return -1;};
 
     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() - sizeof(AliRawDataHeader);
+      } else return GetEquipmentSize();};
 
     Int_t            GetVersion() const 
       {if (fHeader) return fHeader->fVersion; else return -1;};
@@ -54,26 +68,42 @@ class AliRawReader: public TObject {
     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;
 
+    virtual Bool_t   NextEvent() = 0;
+    virtual Bool_t   RewindEvents() = 0;
+
     enum {kErrMagic=1, kErrNoDataHeader=2, 
          kErrSize=4, kErrOutOfBounds=8};
     virtual Int_t    CheckData() const;
-    Int_t            GetErrorCode() {return fErrorCode;};
+    Int_t            GetErrorCode() const {return fErrorCode;};
 
     void             DumpData(Int_t limit = -1);
 
   protected :
     Bool_t           IsSelected() const;
+    Bool_t           IsEventSelected() const;
 
-    virtual Bool_t   ReadNext(UChar_t* data, Int_t size) = 0;
+    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
@@ -82,6 +112,7 @@ class AliRawReader: public TObject {
     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)
 
     Int_t            fErrorCode;         // code of last error