//
// The derived classes, which operate on concrete raw data formats,
// should implement
-// - ReadHeader to read the next (mini or equipment) header
+// - ReadHeader to read the next (data/equipment) header
// - ReadNextData to read the next raw data block (=1 DDL)
// - ReadNext to read a given number of bytes
// - several getters like GetType
AliRawReader::AliRawReader() :
- fMiniHeader(NULL),
+ fHeader(NULL),
fCount(0),
- fSelectDetectorID(-1),
- fSelectMinDDLID(-1),
- fSelectMaxDDLID(-1),
fSelectEquipmentType(-1),
fSelectMinEquipmentId(-1),
fSelectMaxEquipmentId(-1),
+ fSkipInvalid(kFALSE),
fErrorCode(0)
{
// default constructor: initialize data members
AliRawReader::AliRawReader(const AliRawReader& rawReader) :
TObject(rawReader),
- fMiniHeader(rawReader.fMiniHeader),
+ fHeader(rawReader.fHeader),
fCount(rawReader.fCount),
- fSelectDetectorID(rawReader.fSelectDetectorID),
- fSelectMinDDLID(rawReader.fSelectMinDDLID),
- fSelectMaxDDLID(rawReader.fSelectMaxDDLID),
fSelectEquipmentType(rawReader.fSelectEquipmentType),
fSelectMinEquipmentId(rawReader.fSelectMinEquipmentId),
fSelectMaxEquipmentId(rawReader.fSelectMaxEquipmentId),
+ fSkipInvalid(rawReader.fSkipInvalid),
fErrorCode(0)
{
// copy constructor
{
// assignment operator
- fMiniHeader = rawReader.fMiniHeader;
+ fHeader = rawReader.fHeader;
fCount = rawReader.fCount;
- fSelectDetectorID = rawReader.fSelectDetectorID;
- fSelectMinDDLID = rawReader.fSelectMinDDLID;
- fSelectMaxDDLID = rawReader.fSelectMaxDDLID;
+ fSelectEquipmentType = rawReader.fSelectEquipmentType;
+ fSelectMinEquipmentId = rawReader.fSelectMinEquipmentId;
+ fSelectMaxEquipmentId = rawReader.fSelectMaxEquipmentId;
+ fSkipInvalid = rawReader.fSkipInvalid;
fErrorCode = rawReader.fErrorCode;
// range of DDLs (minDDLID <= DDLID <= maxDDLID).
// no selection is applied if a value < 0 is used.
- fSelectDetectorID = detectorID;
- fSelectMinDDLID = minDDLID;
- fSelectMaxDDLID = maxDDLID;
+ fSelectEquipmentType = 0;
+ if (minDDLID < 0) minDDLID = 0;
+ fSelectMinEquipmentId = (detectorID << 8) + minDDLID;
+ if (maxDDLID < 0) maxDDLID = 0xFF;
+ fSelectMaxEquipmentId = (detectorID << 8) + maxDDLID;
}
void AliRawReader::SelectEquipment(Int_t equipmentType,
{
// apply the selection (if any)
- if (fSelectDetectorID >= 0) {
- if (!fMiniHeader) return kFALSE;
- if (fMiniHeader->fDetectorID != fSelectDetectorID) return kFALSE;
- if ((fSelectMinDDLID >= 0) && (fMiniHeader->fDDLID < fSelectMinDDLID))
- return kFALSE;
- if ((fSelectMaxDDLID >= 0) && (fMiniHeader->fDDLID > fSelectMaxDDLID))
- return kFALSE;
- }
+ if (fSkipInvalid && !IsValid()) return kFALSE;
if (fSelectEquipmentType >= 0) {
if (GetEquipmentType() != fSelectEquipmentType) return kFALSE;
}
-Bool_t AliRawReader::CheckMiniHeader(AliMiniHeader* miniHeader) const
-{
-// check the magic number of the mini header
-
- if (!miniHeader) miniHeader = fMiniHeader;
- if (!miniHeader) return kFALSE;
- UInt_t magicWord = miniHeader->fMagicWord[2]*65536 +
- miniHeader->fMagicWord[1]*256 + miniHeader->fMagicWord[0];
- if (magicWord != AliMiniHeader::kMagicWord) {
- return kFALSE;
- }
- return kTRUE;
-}
-
Bool_t AliRawReader::ReadNextInt(UInt_t& data)
{
// reads the next 4 bytes at the current position
}
printf("element size = %d\n", GetEquipmentElementSize());
- printf("mini header:\n"
- " size = %d detector = %d DDL = %d\n"
- " version = %d compression = %d\n",
- GetDataSize(), GetDetectorID(), GetDDLID(),
- GetVersion(), IsCompressed());
+ printf("data header:\n"
+ " size = %d version = %d valid = %d compression = %d\n",
+ GetDataSize(), GetVersion(), IsValid(), IsCompressed());
printf("\n");
if (limit == 0) continue;
* See cxx source for full Copyright notice */
#include <TObject.h>
-#include "AliMiniHeader.h"
+#include "AliRawDataHeader.h"
class AliRawReader: public TObject {
void SelectEquipment(Int_t equipmentType,
Int_t minEquipmentId = -1,
Int_t maxEquipmentId = -1);
+ void SkipInvalid(Bool_t skip = kTRUE)
+ {fSkipInvalid = skip;};
virtual UInt_t GetType() const = 0;
virtual UInt_t GetRunNumber() const = 0;
virtual const UInt_t* GetEquipmentAttributes() const = 0;
virtual Int_t GetEquipmentElementSize() const = 0;
+ Int_t GetDetectorID() const
+ {if (GetEquipmentId() >= 0) return (GetEquipmentId() >> 8); else return -1;};
+ Int_t GetDDLID() const
+ {if (GetEquipmentId() >= 0) return (GetEquipmentId() & 0xFF); else return -1;};
+
Int_t GetDataSize() const
- {if (fMiniHeader) return fMiniHeader->fSize;
+ {if (fHeader) return fHeader->fSize - sizeof(AliRawDataHeader);
else return GetEquipmentSize();};
- Int_t GetDetectorID() const
- {if (fMiniHeader) return fMiniHeader->fDetectorID; else return -1;};
- Int_t GetDDLID() const
- {if (fMiniHeader) return fMiniHeader->fDDLID; else return -1;};
Int_t GetVersion() const
- {if (fMiniHeader) return fMiniHeader->fVersion; else return -1;};
+ {if (fHeader) return fHeader->fVersion; else return -1;};
+ Bool_t IsValid() const
+ {if (fHeader) return fHeader->TestAttribute(0);
+ else return kFALSE;};
Bool_t IsCompressed() const
- {if (fMiniHeader) return fMiniHeader->fCompressionFlag != 0;
+ {if (fHeader) return fHeader->TestAttribute(1);
else return kFALSE;};
virtual Bool_t ReadHeader() = 0;
virtual Bool_t Reset() = 0;
- enum {kErrMagic=1, kErrNoMiniHeader=2, kErrMiniMagic=4,
- kErrSize=8, kErrOutOfBounds=16};
+ enum {kErrMagic=1, kErrNoDataHeader=2,
+ kErrSize=4, kErrOutOfBounds=8};
virtual Int_t CheckData() const;
Int_t GetErrorCode() {return fErrorCode;};
protected :
Bool_t IsSelected() const;
- Bool_t CheckMiniHeader(AliMiniHeader* miniHeader = NULL) const;
virtual Bool_t ReadNext(UChar_t* data, Int_t size) = 0;
- AliMiniHeader* fMiniHeader; // current mini header
+ AliRawDataHeader* fHeader; // current data header
Int_t fCount; // counter of bytes to be read for current DDL
- Int_t fSelectDetectorID; // id of selected detector (<0 = no selection)
- Int_t fSelectMinDDLID; // minimal index of selected DDLs (<0 = no selection)
- Int_t fSelectMaxDDLID; // maximal index of selected DDLs (<0 = no selection)
Int_t fSelectEquipmentType; // type of selected equipment (<0 = no selection)
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 fErrorCode; // code of last error
void* /* event */
#endif
) :
- fRequireMiniHeader(kTRUE),
+ fRequireHeader(kTRUE),
fEvent(NULL),
fSubEvent(NULL),
fEquipment(NULL),
Int_t /*eventNumber*/
#endif
) :
- fRequireMiniHeader(kTRUE),
+ fRequireHeader(kTRUE),
fEvent(NULL),
fSubEvent(NULL),
fEquipment(NULL),
AliRawReaderDate::AliRawReaderDate(const AliRawReaderDate& rawReader) :
AliRawReader(rawReader),
- fRequireMiniHeader(rawReader.fRequireMiniHeader),
+ fRequireHeader(rawReader.fRequireHeader),
fEvent(rawReader.fEvent),
fSubEvent(rawReader.fSubEvent),
fEquipment(rawReader.fEquipment),
Bool_t AliRawReaderDate::ReadHeader()
{
-// read a mini header at the current position
-// returns kFALSE if the mini header could not be read
+// read a data header at the current position
+// returns kFALSE if the data header could not be read
fErrorCode = 0;
// continue with the next sub event if no data left in the payload
if (fPosition >= fEnd) continue;
- fMiniHeader = NULL;
- if (fRequireMiniHeader) {
- // check that there are enough bytes left for the mini header
- if (fPosition + sizeof(AliMiniHeader) > fEnd) {
- Error("ReadHeader", "could not read mini header data!");
+ fHeader = NULL;
+ 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 data!");
Warning("ReadHeader", "skipping %d bytes\n"
" run: %d event: %d %d LDC: %d GDC: %d\n",
fEnd - fPosition, fSubEvent->eventRunNb,
fSubEvent->eventLdcId, fSubEvent->eventGdcId);
fCount = 0;
fPosition = fEnd;
- fErrorCode = kErrNoMiniHeader;
+ fErrorCode = kErrNoDataHeader;
continue;
}
- // "read" and check the mini header
- fMiniHeader = (AliMiniHeader*) fPosition;
- fPosition += sizeof(AliMiniHeader);
- if (!CheckMiniHeader()) {
- Error("ReadHeader", "wrong magic word in mini header!");
- Warning("ReadHeader", "skipping %d bytes\n"
- " run: %d event: %d %d LDC: %d GDC: %d\n",
- fEnd - fPosition, fSubEvent->eventRunNb,
- fSubEvent->eventId[0], fSubEvent->eventId[1],
- fSubEvent->eventLdcId, fSubEvent->eventGdcId);
- fCount = 0;
- fPosition = fEnd;
- fErrorCode = kErrMiniMagic;
- continue;
- }
-
- } else { // if mini header not required
- // assume there is a mini header if the magic word is correct
- if ((fPosition + sizeof(AliMiniHeader) <= fEnd) &&
- CheckMiniHeader((AliMiniHeader*) fPosition)) {
- fMiniHeader = (AliMiniHeader*) fPosition;
- fPosition += sizeof(AliMiniHeader);
- }
+ // "read" the data header
+ fHeader = (AliRawDataHeader*) fPosition;
+ fPosition += sizeof(AliRawDataHeader);
}
- if (fMiniHeader) {
- fCount = fMiniHeader->fSize;
+ if (fHeader && (fHeader->fSize != 0xFFFFFFFF)) {
+ fCount = fHeader->fSize - sizeof(AliRawDataHeader);
- // check consistency of data size in the mini header and in the sub event
+ // check consistency of data size in the header and in the sub event
if (fPosition + fCount > fEnd) {
- Error("ReadHeader", "size in mini header exceeds event size!");
+ Error("ReadHeader", "size in data header exceeds event size!");
Warning("ReadHeader", "skipping %d bytes\n"
" run: %d event: %d %d LDC: %d GDC: %d\n",
fEnd - fPosition, fSubEvent->eventRunNb,
// continue with the next sub event if no data left in the payload
if (position >= end) continue;
- // check that there are enough bytes left for the mini header
- if (position + sizeof(AliMiniHeader) > end) {
- result |= kErrNoMiniHeader;
+ // check that there are enough bytes left for the data header
+ if (position + sizeof(AliRawDataHeader) > end) {
+ result |= kErrNoDataHeader;
position = end;
continue;
}
- // "read" and check the mini header
- AliMiniHeader* miniHeader = (AliMiniHeader*) position;
- position += sizeof(AliMiniHeader);
- if (!CheckMiniHeader(miniHeader)){
- result |= kErrMiniMagic;
+ // check consistency of data size in the data header and in the sub event
+ AliRawDataHeader* header = (AliRawDataHeader*) position;
+ if (fHeader->fSize != 0xFFFFFFFF) {
+ if (position + header->fSize > end) {
+ result |= kErrSize;
+ position = end;
+ } else {
+ position += header->fSize;
+ }
+ } else {
position = end;
- continue;
}
-
- // check consistency of data size in the mini header and in the sub event
- if (position + miniHeader->fSize > end) result |= kErrSize;
- position += miniHeader->fSize;
};
#endif
AliRawReaderDate& operator = (const AliRawReaderDate& rawReader);
virtual ~AliRawReaderDate();
- void RequireMiniHeader(Bool_t required = kTRUE)
- {fRequireMiniHeader = required;};
+ void RequireHeader(Bool_t required = kTRUE)
+ {fRequireHeader = required;};
virtual UInt_t GetType() const;
virtual UInt_t GetRunNumber() const;
protected :
virtual Bool_t ReadNext(UChar_t* data, Int_t size);
- Bool_t fRequireMiniHeader; // if false, data without mini header is accepted
+ Bool_t fRequireHeader; // if false, data without header is accepted
eventHeaderStruct* fEvent; // raw data super event
eventHeaderStruct* fSubEvent; // raw data sub event
///////////////////////////////////////////////////////////////////////////////
#include "AliRawReaderFile.h"
+#include <TSystem.h>
ClassImp(AliRawReaderFile)
-AliRawReaderFile::AliRawReaderFile(const char* fileName, Bool_t addNumber)
+AliRawReaderFile::AliRawReaderFile(Int_t eventNumber) :
+ fDirName("raw"),
+ fDirectory(NULL),
+ fStream(NULL),
+ fEquipmentId(-1),
+ fBuffer(NULL),
+ fBufferSize(0)
{
-// create an object to read digits from the given input file(s)
-// if addNumber is true, a number starting at 1 is appended to the file name
+// create an object to read digits from the given event
- fFileName = fileName;
- if (!addNumber) {
- fFileNumber = -1;
-#ifndef __DECCXX
- fStream = new fstream(fileName, ios::binary|ios::in);
-#else
- fStream = new fstream(fileName, ios::in);
-#endif
- } else {
- fFileNumber = 0;
- fStream = NULL;
- OpenNextFile();
+ fDirName += eventNumber;
+ fDirectory = gSystem->OpenDirectory(fDirName);
+ if (!fDirectory) {
+ Error("AliRawReaderFile", "could not open directory %s", fDirName.Data());
+ }
+ OpenNextFile();
+ fHeader = new AliRawDataHeader;
+}
+
+AliRawReaderFile::AliRawReaderFile(const char* dirName) :
+ fDirName(dirName),
+ fDirectory(NULL),
+ fStream(NULL),
+ fEquipmentId(-1),
+ fBuffer(NULL),
+ fBufferSize(0)
+{
+// create an object to read digits from the given directory
+
+ fDirectory = gSystem->OpenDirectory(fDirName);
+ if (!fDirectory) {
+ Error("AliRawReaderFile", "could not open directory %s", fDirName.Data());
}
- fMiniHeader = new AliMiniHeader;
- fBuffer = NULL;
- fBufferSize = 0;
+ OpenNextFile();
+ fHeader = new AliRawDataHeader;
}
AliRawReaderFile::AliRawReaderFile(const AliRawReaderFile& rawReader) :
{
// close the input file
+ if (fDirectory) gSystem->FreeDirectory(fDirectory);
if (fStream) {
#if defined(__HP_aCC) || defined(__DECCXX)
if (fStream->rdbuf()->is_open()) fStream->close();
#endif
delete fStream;
}
- delete fMiniHeader;
+ delete fHeader;
if (fBuffer) delete[] fBuffer;
}
#endif
delete fStream;
fStream = NULL;
+ fEquipmentId = -1;
}
- if (fFileNumber < 0) return kFALSE;
- fFileNumber++;
- char fileName[256];
- sprintf(fileName, "%s%d", fFileName.Data(), fFileNumber);
+ if (!fDirectory) return kFALSE;
+ TString entry;
+ while (entry = gSystem->GetDirEntry(fDirectory)) {
+ if (entry.IsNull()) return kFALSE;
+ if (!entry.EndsWith(".ddl")) continue;
+ char* fileName = gSystem->ConcatFileName(fDirName, entry);
#ifndef __DECCXX
- fStream = new fstream(fileName, ios::binary|ios::in);
+ fStream = new fstream(fileName, ios::binary|ios::in);
#else
- fStream = new fstream(fileName, ios::in);
+ fStream = new fstream(fileName, ios::in);
#endif
+ break;
+ }
+
+ if (!fStream) return kFALSE;
+ entry.Remove(0, entry.Last('_')+1);
+ entry.Remove(entry.Length()-4);
+ fEquipmentId = atoi(entry.Data());
#if defined(__HP_aCC) || defined(__DECCXX)
return (fStream->rdbuf()->is_open());
#else
}
-Bool_t AliRawReaderFile::ReadMiniHeader()
+Bool_t AliRawReaderFile::ReadHeader()
{
-// read a mini header at the current stream position
+// read a data header at the current stream position
// returns kFALSE if the mini header could not be read
if (!fStream) return kFALSE;
do {
if (fCount > 0) fStream->seekg(Int_t(fStream->tellg()) + fCount);
- while (!fStream->read((char*) fMiniHeader, sizeof(AliMiniHeader))) {
+ while (!fStream->read((char*) fHeader, sizeof(AliRawDataHeader))) {
if (!OpenNextFile()) return kFALSE;
}
- CheckMiniHeader();
- fCount = fMiniHeader->fSize;
+ if (fHeader->fSize != 0xFFFFFFFF) {
+ fCount = fHeader->fSize - sizeof(AliRawDataHeader);
+ } else {
+ UInt_t currentPos = fStream->tellg();
+ fStream->seekg(0, ios::end);
+ fCount = UInt_t(fStream->tellg()) - currentPos;
+ fStream->seekg(currentPos);
+ }
} while (!IsSelected());
return kTRUE;
}
// returns kFALSE if the data could not be read
while (fCount == 0) {
- if (!ReadMiniHeader()) return kFALSE;
+ if (!ReadHeader()) return kFALSE;
}
if (fBufferSize < fCount) {
if (fBuffer) delete[] fBuffer;
{
// reset the current stream position to the beginning of the file
- if ((fFileNumber > 0) && fStream) {
+ void* directory = gSystem->OpenDirectory(fDirName);
+ if (!directory) {
+ Error("Reset", "could not open directory %s", fDirName.Data());
+ return kFALSE;
+ }
+
+ if (fStream) {
#if defined(__HP_aCC) || defined(__DECCXX)
if (fStream->rdbuf()->is_open()) fStream->close();
#else
#endif
delete fStream;
fStream = NULL;
- fFileNumber = 0;
}
- if (!fStream) {
- if (fFileNumber < 0) {
-#ifndef __DECCXX
- fStream = new fstream(fFileName, ios::binary|ios::in);
-#else
- fStream = new fstream(fFileName, ios::in);
-#endif
- } else {
- if (!OpenNextFile()) return kFALSE;
- }
- }
+ if (fDirectory) gSystem->FreeDirectory(fDirectory);
+ fDirectory = directory;
- if (!fStream || !fStream->rdbuf()->is_open()) return kFALSE;
- fStream->seekg(0);
+ OpenNextFile();
fCount = 0;
return kTRUE;
}
class AliRawReaderFile: public AliRawReader {
public :
- AliRawReaderFile(const char* fileName, Bool_t addNumber = kTRUE);
+ AliRawReaderFile(Int_t eventNumber);
+ AliRawReaderFile(const char* dirName);
AliRawReaderFile(const AliRawReaderFile& rawReader);
AliRawReaderFile& operator = (const AliRawReaderFile& rawReader);
virtual ~AliRawReaderFile();
virtual const UInt_t* GetTriggerPattern() const {return 0;};
virtual const UInt_t* GetDetectorPattern() const {return 0;};
virtual const UInt_t* GetAttributes() const {return 0;};
+ virtual UInt_t GetLDCId() const {return 0;};
virtual UInt_t GetGDCId() const {return 0;};
+ virtual Int_t GetEquipmentSize() const {return 0;};
+ virtual Int_t GetEquipmentType() const {return 0;};
+ virtual Int_t GetEquipmentId() const {return fEquipmentId;};
+ virtual const UInt_t* GetEquipmentAttributes() const {return NULL;};
+ virtual Int_t GetEquipmentElementSize() const {return 0;};
- virtual Bool_t ReadMiniHeader();
+ virtual Bool_t ReadHeader();
virtual Bool_t ReadNextData(UChar_t*& data);
virtual Bool_t Reset();
virtual Bool_t ReadNext(UChar_t* data, Int_t size);
- TString fFileName; // name of input files
- Int_t fFileNumber; // number of current input file
+ TString fDirName; // name of the input directory
+ void* fDirectory; // pointer to the input directory
fstream* fStream; // stream of raw digits
+ Int_t fEquipmentId; // equipment ID from file name
UChar_t* fBuffer; // buffer for payload
Int_t fBufferSize; // size of fBuffer in bytes
fSubEventIndex = 0;
fSubEvent = NULL;
fRawData = NULL;
- fMiniHeader = NULL;
+ fHeader = NULL;
fCount = 0;
fPosition = fEnd = NULL;
fSubEventIndex = 0;
fSubEvent = NULL;
fRawData = NULL;
- fMiniHeader = NULL;
+ fHeader = NULL;
fCount = 0;
fPosition = fEnd = NULL;
fSubEventIndex = rawReader.fSubEventIndex;
fSubEvent = rawReader.fSubEvent;
fRawData = rawReader.fRawData;
- fMiniHeader = rawReader.fMiniHeader;
+ fHeader = rawReader.fHeader;
fCount = rawReader.fCount;
fPosition = rawReader.fPosition;
Bool_t AliRawReaderRoot::ReadHeader()
{
-// read a mini header at the current position
-// returns kFALSE if the mini header could not be read
+// read a data header at the current position
+// returns kFALSE if the data header could not be read
fErrorCode = 0;
if (!fEvent) return kFALSE;
// continue with the next sub event if no data left in the payload
if (fPosition >= fEnd) continue;
- // check that there are enough bytes left for the mini header
- if (fPosition + sizeof(AliMiniHeader) > fEnd) {
- Error("ReadHeader", "could not read mini header data!");
+ // 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);
fSubEvent->GetHeader()->Dump();
fCount = 0;
fPosition = fEnd;
- fErrorCode = kErrNoMiniHeader;
+ fErrorCode = kErrNoDataHeader;
continue;
}
- // "read" and check the mini header
- fMiniHeader = (AliMiniHeader*) fPosition;
- fPosition += sizeof(AliMiniHeader);
- if (!CheckMiniHeader()) {
- Error("ReadHeader", "wrong magic word in mini header!");
- Warning("ReadHeader", "skipping %d bytes", fEnd - fPosition);
- fSubEvent->GetHeader()->Dump();
- fCount = 0;
- fPosition = fEnd;
- fErrorCode = kErrMiniMagic;
- continue;
+ // "read" the data header
+ fHeader = (AliRawDataHeader*) fPosition;
+ fPosition += sizeof(AliRawDataHeader);
+ if (fHeader->fSize != 0xFFFFFFFF) {
+ fCount = fHeader->fSize - sizeof(AliRawDataHeader);
+ } else {
+ fCount = fEnd - fPosition;
}
- fCount = fMiniHeader->fSize;
- // check consistency of data size in the mini header and in the sub event
+ // check consistency of data size in the header and in the sub event
if (fPosition + fCount > fEnd) {
- Error("ReadHeader", "size in mini header exceeds event size!");
+ Error("ReadHeader", "size in data header exceeds event size!");
Warning("ReadHeader", "skipping %d bytes", fEnd - fPosition);
fSubEvent->GetHeader()->Dump();
fCount = 0;
fSubEventIndex = 0;
fSubEvent = NULL;
fRawData = NULL;
- fMiniHeader = NULL;
+ fHeader = NULL;
fCount = 0;
fPosition = fEnd = NULL;
// continue with the next sub event if no data left in the payload
if (position >= end) continue;
- // check that there are enough bytes left for the mini header
- if (position + sizeof(AliMiniHeader) > end) {
- result |= kErrNoMiniHeader;
+ // check that there are enough bytes left for the data header
+ if (position + sizeof(AliRawDataHeader) > end) {
+ result |= kErrNoDataHeader;
position = end;
continue;
}
- // "read" and check the mini header
- AliMiniHeader* miniHeader = (AliMiniHeader*) position;
- position += sizeof(AliMiniHeader);
- if (!CheckMiniHeader(miniHeader)) {
- result |= kErrMiniMagic;
+ // check consistency of data size in the header and in the sub event
+ AliRawDataHeader* header = (AliRawDataHeader*) position;
+ if (fHeader->fSize != 0xFFFFFFFF) {
+ if (position + header->fSize > end) {
+ result |= kErrSize;
+ position = end;
+ } else {
+ position += header->fSize;
+ }
+ } else {
position = end;
- continue;
}
-
- // check consistency of data size in the mini header and in the sub event
- if (position + miniHeader->fSize > end) result |= kErrSize;
- position += miniHeader->fSize;
};
return result;