]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding support for raw data events without subevent header
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 May 2005 11:37:24 +0000 (11:37 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 May 2005 11:37:24 +0000 (11:37 +0000)
RAW/AliRawReader.cxx
RAW/AliRawReader.h
RAW/AliRawReaderDate.cxx
RAW/AliRawReaderDate.h
RAW/AliRawReaderDateV3.cxx
RAW/AliRawReaderDateV3.h
RAW/AliRawReaderRoot.cxx

index ced8011bc65640fb6ac7dacabb624c5f4f84d5d5..7d91bc13bc80dc1621054a28bf6e66fc8058578d 100644 (file)
@@ -43,6 +43,7 @@ ClassImp(AliRawReader)
 
 
 AliRawReader::AliRawReader() :
+  fRequireHeader(kTRUE),
   fHeader(NULL),
   fCount(0),
   fSelectEquipmentType(-1),
@@ -58,6 +59,7 @@ AliRawReader::AliRawReader() :
 
 AliRawReader::AliRawReader(const AliRawReader& rawReader) :
   TObject(rawReader),
+  fRequireHeader(rawReader.fRequireHeader),
   fHeader(rawReader.fHeader),
   fCount(rawReader.fCount),
   fSelectEquipmentType(rawReader.fSelectEquipmentType),
index 7e35774cc4bde21996fcf37e0d52d51b8fe5fce3..f3a6f00ac561c2ca935b16fa80768b07cb70bd25 100644 (file)
@@ -30,6 +30,8 @@ class AliRawReader: public TObject {
     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;
@@ -102,6 +104,8 @@ class AliRawReader: public TObject {
 
     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
 
index 0a07ae290b8b108c0923c3373b91183684dc6723..64e760357cff1d2f430b18b1fb9a2b764bb00ee2 100644 (file)
@@ -39,7 +39,6 @@ AliRawReaderDate::AliRawReaderDate(
                                   void* /* event */
 #endif
                                   ) :
-  fRequireHeader(kTRUE),
   fFile(NULL),
   fEvent(NULL),
   fSubEvent(NULL),
@@ -64,7 +63,6 @@ AliRawReaderDate::AliRawReaderDate(
                                   Int_t /*eventNumber*/
 #endif
                                   ) :
-  fRequireHeader(kTRUE),
   fFile(NULL),
   fEvent(NULL),
   fSubEvent(NULL),
@@ -103,7 +101,6 @@ AliRawReaderDate::AliRawReaderDate(
 
 AliRawReaderDate::AliRawReaderDate(const AliRawReaderDate& rawReader) :
   AliRawReader(rawReader),
-  fRequireHeader(rawReader.fRequireHeader),
   fFile(rawReader.fFile),
   fEvent(rawReader.fEvent),
   fSubEvent(rawReader.fSubEvent),
@@ -575,25 +572,21 @@ Int_t AliRawReaderDate::CheckData() const
     // continue with the next sub event if no data left in the payload
     if (position >= end) continue;
 
+    if (fRequireHeader) {
     // check that there are enough bytes left for the data header
-    if (position + sizeof(AliRawDataHeader) > end) {
-      result |= kErrNoDataHeader;
-      position = end;
-      continue;
-    }
-
-    // check consistency of data size in the data header and in the sub event
-    AliRawDataHeader* header = (AliRawDataHeader*) position;
-    if (header->fSize != 0xFFFFFFFF) {
-      if (position + header->fSize > end) {
-       result |= kErrSize;
+      if (position + sizeof(AliRawDataHeader) > end) {
+       result |= kErrNoDataHeader;
        position = end;
-      } else {
-       position += header->fSize;
+       continue;
+      }
+
+      // check consistency of data size in the data header and in the sub event
+      AliRawDataHeader* header = (AliRawDataHeader*) position;
+      if (header->fSize != 0xFFFFFFFF) {
+       if (position + header->fSize > end) result |= kErrSize;
       }
-    } else {
-      position = end;
     }
+    position = end;
   };
 
 #endif
index 67564c54f2c2b25b45fe45f39b3eafc2f2dbeecc..d0a43158d2d252802fae5fff628521bec82a0e0c 100644 (file)
@@ -23,9 +23,6 @@ class AliRawReaderDate: public AliRawReader {
     AliRawReaderDate(const char* fileName, Int_t eventNumber = -1);
     virtual ~AliRawReaderDate();
 
-    void             RequireHeader(Bool_t required = kTRUE)
-      {fRequireHeader = required;};
-
     virtual UInt_t   GetType() const;
     virtual UInt_t   GetRunNumber() const;
     virtual const UInt_t* GetEventId() const;
@@ -55,8 +52,6 @@ class AliRawReaderDate: public AliRawReader {
   protected :
     virtual Bool_t   ReadNext(UChar_t* data, Int_t size);
 
-    Bool_t           fRequireHeader; // if false, data without header is accepted
-
     FILE*            fFile;         // DATE file
     eventHeaderStruct* fEvent;      // raw data super event
     eventHeaderStruct* fSubEvent;   // raw data sub event
index dd9e6e7bfe081d0192cb946b368c328d5c850f98..1efebe320aded7d4cc2a37fbdd8ac4bb5d351a74 100644 (file)
@@ -53,7 +53,6 @@ ClassImp(AliRawReaderDateV3)
 
 
 AliRawReaderDateV3::AliRawReaderDateV3(void* event) :
-  fRequireHeader(kTRUE),
   fFile(NULL),
   fEvent(NULL),
   fSubEvent(NULL),
@@ -67,7 +66,6 @@ AliRawReaderDateV3::AliRawReaderDateV3(void* event) :
 
 AliRawReaderDateV3::AliRawReaderDateV3(const char* fileName, 
                                       Int_t eventNumber) :
-  fRequireHeader(kTRUE),
   fFile(NULL),
   fEvent(NULL),
   fSubEvent(NULL),
@@ -100,7 +98,6 @@ AliRawReaderDateV3::AliRawReaderDateV3(const char* fileName,
 
 AliRawReaderDateV3::AliRawReaderDateV3(const AliRawReaderDateV3& rawReader) :
   AliRawReader(rawReader),
-  fRequireHeader(rawReader.fRequireHeader),
   fFile(rawReader.fFile),
   fEvent(rawReader.fEvent),
   fSubEvent(rawReader.fSubEvent),
index 9042fc98014c4cf5f1190c6aa6eac3e7b3f0b6d8..a1320762bab7b937c4d3319ca2faf0f0e019f951 100644 (file)
@@ -22,9 +22,6 @@ class AliRawReaderDateV3: public AliRawReader {
     AliRawReaderDateV3(const char* fileName, Int_t eventNumber = -1);
     virtual ~AliRawReaderDateV3();
 
-    void             RequireHeader(Bool_t required = kTRUE)
-      {fRequireHeader = required;};
-
     virtual UInt_t   GetType() const;
     virtual UInt_t   GetRunNumber() const;
     virtual const UInt_t* GetEventId() const;
@@ -54,8 +51,6 @@ class AliRawReaderDateV3: public AliRawReader {
   protected :
     virtual Bool_t   ReadNext(UChar_t* data, Int_t size);
 
-    Bool_t           fRequireHeader; // if false, data without header is accepted
-
     FILE*            fFile;         // DATE file
     eventHeaderStruct* fEvent;      // raw data super event
     eventHeaderStruct* fSubEvent;   // raw data sub event
index ed16d4b8191fbfa395e50a5c812dad0480c90515..84c10ce669b37ac196267e8c2024489bdf9d8c63 100644 (file)
@@ -352,20 +352,23 @@ Bool_t AliRawReaderRoot::ReadHeader()
     // continue with the next equipment if no data left in the payload
     if (fPosition >= fEnd) continue;
 
-    // check that there are enough bytes left for the data header
-    if (fPosition + sizeof(AliRawDataHeader) > fEnd) {
-      Error("ReadHeader", "could not read data header!");
-      Warning("ReadHeader", "skipping %d bytes", fEnd - fPosition);
-      fEquipment->GetEquipmentHeader()->Dump();
-      fCount = 0;
-      fPosition = fEnd;
-      fErrorCode = kErrNoDataHeader;
-      continue;
+    if (fRequireHeader) {
+      // check that there are enough bytes left for the data header
+      if (fPosition + sizeof(AliRawDataHeader) > fEnd) {
+       Error("ReadHeader", "could not read data header!");
+       Warning("ReadHeader", "skipping %d bytes", fEnd - fPosition);
+       fEquipment->GetEquipmentHeader()->Dump();
+       fCount = 0;
+       fPosition = fEnd;
+       fErrorCode = kErrNoDataHeader;
+       continue;
+      }
+
+      // "read" the data header
+      fHeader = (AliRawDataHeader*) fPosition;
+      fPosition += sizeof(AliRawDataHeader);
     }
 
-    // "read" the data header
-    fHeader = (AliRawDataHeader*) fPosition;
-    fPosition += sizeof(AliRawDataHeader);
     if (fHeader->fSize != 0xFFFFFFFF) {
       fCount = fHeader->fSize - sizeof(AliRawDataHeader);
     } else {
@@ -512,17 +515,19 @@ Int_t AliRawReaderRoot::CheckData() const
     // continue with the next sub event if no data left in the payload
     if (position >= end) continue;
 
+    if (fRequireHeader) {
     // check that there are enough bytes left for the data header
-    if (position + sizeof(AliRawDataHeader) > end) {
-      result |= kErrNoDataHeader;
-      continue;
-    }
+      if (position + sizeof(AliRawDataHeader) > end) {
+       result |= kErrNoDataHeader;
+       continue;
+      }
 
-    // check consistency of data size in the header and in the equipment
-    AliRawDataHeader* header = (AliRawDataHeader*) position;
-    if (header->fSize != 0xFFFFFFFF) {
-      if (position + header->fSize > end) {
-       result |= kErrSize;
+      // check consistency of data size in the header and in the equipment
+      AliRawDataHeader* header = (AliRawDataHeader*) position;
+      if (header->fSize != 0xFFFFFFFF) {
+       if (position + header->fSize > end) {
+         result |= kErrSize;
+       }
       }
     }
   };