void* /* event */
#endif
) :
- fRequireHeader(kTRUE),
fFile(NULL),
fEvent(NULL),
fSubEvent(NULL),
Int_t /*eventNumber*/
#endif
) :
- fRequireHeader(kTRUE),
fFile(NULL),
fEvent(NULL),
fSubEvent(NULL),
AliRawReaderDate::AliRawReaderDate(const AliRawReaderDate& rawReader) :
AliRawReader(rawReader),
- fRequireHeader(rawReader.fRequireHeader),
fFile(rawReader.fFile),
fEvent(rawReader.fEvent),
fSubEvent(rawReader.fSubEvent),
Int_t AliRawReaderDate::GetEquipmentSize() const
{
-// get the size of the equipment
+// get the size of the equipment (including the header)
#ifdef ALI_DATE
if (!fEquipment) return 0;
- return fEquipment->equipmentSize;
+ if (fSubEvent->eventVersion <= 0x00030001) {
+ return fEquipment->equipmentSize + sizeof(equipmentHeaderStruct);
+ } else {
+ return fEquipment->equipmentSize;
+ }
#else
return 0;
#endif
#endif
}
+Int_t AliRawReaderDate::GetEquipmentHeaderSize() const
+{
+ // Get the equipment header size
+ // 28 bytes by default
+#ifdef ALI_DATE
+ return sizeof(equipmentHeaderStruct);
+#else
+ return 0;
+#endif
+}
Bool_t AliRawReaderDate::ReadHeader()
{
fCount = 0;
fPosition = ((UChar_t*)fEquipment) + sizeof(equipmentHeaderStruct);
- if (fSubEvent->eventVersion <= 0x00030002) {
+ if (fSubEvent->eventVersion <= 0x00030001) {
fEnd = fPosition + fEquipment->equipmentSize;
} else {
fEnd = ((UChar_t*)fEquipment) + fEquipment->equipmentSize;
// "read" the data header
fHeader = (AliRawDataHeader*) fPosition;
+ if ((fPosition + fHeader->fSize) != fEnd) {
+ Warning("ReadHeader",
+ "raw data size found in the header is wrong (%d != %d)! Using the equipment size instead !",
+ fHeader->fSize, fEnd - fPosition);
+ fHeader->fSize = fEnd - fPosition;
+ }
fPosition += sizeof(AliRawDataHeader);
}
// 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;
- }
+ 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) {
+ // check consistency of data size in the data header and in the sub event
+ AliRawDataHeader* header = (AliRawDataHeader*) position;
+ if ((position + header->fSize) != end) {
+ Warning("ReadHeader",
+ "raw data size found in the header is wrong (%d != %d)! Using the equipment size instead !",
+ header->fSize, end - position);
+ header->fSize = end - position;
result |= kErrSize;
- position = end;
- } else {
- position += header->fSize;
}
- } else {
- position = end;
}
+ position = end;
};
#endif