- // 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;
+#ifndef R__BYTESWAP
+ SwapData((void*) fHeader, (void*) fHeaderSwapped, sizeof(AliRawDataHeader));
+ fHeader=fHeaderSwapped;
+#endif
+ if ((fPosition + fHeader->fSize) != fEnd) {
+ if (fHeader->fSize != 0xFFFFFFFF)
+ Warning("ReadHeader",
+ "Equipment %d : raw data size found in the header is wrong (%d != %d)! Using the equipment size instead !",
+ fEquipment->GetEquipmentHeader()->GetId(),fHeader->fSize, fEnd - fPosition);
+ fHeader->fSize = fEnd - fPosition;
+ }
+ fPosition += sizeof(AliRawDataHeader);