fFile = fopen(fileName, "rb");
if (!fFile) {
Error("AliRawReaderDateV3", "could not open file %s", fileName);
+ fIsValid = kFALSE;
return;
}
if (eventNumber < 0) return;
while (fread(&header, 1, headerSize, fFile) == headerSize) {
if (eventNumber == 0) {
UChar_t* buffer = new UChar_t[header.size];
- fseek(fFile, -headerSize, SEEK_CUR);
+ fseek(fFile, -(long)headerSize, SEEK_CUR);
if (Int_t(fread(buffer, 1, header.size, fFile)) != header.size) break;
fEvent = (eventHeaderStruct*) buffer;
break;
return UInt_t(-1);
}
+UInt_t AliRawReaderDateV3::GetTimestamp() const
+{
+// get the timestamp from the event header
+
+ if (!fEvent) return 0;
+ return fEvent->time;
+}
Int_t AliRawReaderDateV3::GetEquipmentSize() const
{
return 0;
}
+Int_t AliRawReaderDateV3::GetEquipmentHeaderSize() const
+{
+// get the size of the equipment header
+
+ return 0;
+}
Bool_t AliRawReaderDateV3::ReadHeader()
{
// "read" the data header
fHeader = (AliRawDataHeader*) fPosition;
+ if ((fPosition + fHeader->fSize) != fEnd) {
+ if (fHeader->fSize != 0xFFFFFFFF)
+ 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;
}
UChar_t* buffer = new UChar_t[header.size];
- fseek(fFile, -headerSize, SEEK_CUR);
+ fseek(fFile, -(long)headerSize, SEEK_CUR);
if (Int_t(fread(buffer, 1, header.size, fFile)) != header.size) {
Error("NextEvent", "could not read event from file");
delete[] buffer;
break;
}
fEvent = (eventHeaderStruct*) buffer;
+ fEventNumber++;
return kTRUE;
};
if (!fFile) return kFALSE;
fseek(fFile, 0, SEEK_SET);
+ fEventNumber = -1;
return Reset();
}
// 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 + header->fSize) != end) {
+ if (header->fSize != 0xFFFFFFFF)
+ 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;