AliRawReaderDate::AliRawReaderDate(
#ifdef ALI_DATE
- void* event
+ void* event, Bool_t owner
#else
- void* /* event */
+ void* /* event */, Bool_t owner
#endif
) :
fFile(NULL),
fSubEvent(NULL),
fEquipment(NULL),
fPosition(NULL),
- fEnd(NULL)
+ fEnd(NULL),
+ fOwner(owner)
{
// create an object to read digits from the given date event
fSubEvent(NULL),
fEquipment(NULL),
fPosition(NULL),
- fEnd(NULL)
+ fEnd(NULL),
+ fOwner(kTRUE)
{
// create an object to read digits from the given date event
fSubEvent(rawReader.fSubEvent),
fEquipment(rawReader.fEquipment),
fPosition(rawReader.fPosition),
- fEnd(rawReader.fEnd)
+ fEnd(rawReader.fEnd),
+ fOwner(rawReader.fOwner)
{
// copy constructor
// destructor
#ifdef ALI_DATE
+ if (fEvent && fOwner) delete[] fEvent;
if (fFile) {
- delete[] fEvent;
fclose(fFile);
}
#endif
// "read" the data header
fHeader = (AliRawDataHeader*) fPosition;
if ((fPosition + fHeader->fSize) != fEnd) {
- if (fHeader->fSize != 0xFFFFFFFF)
+ if ((fHeader->fSize != 0xFFFFFFFF) &&
+ (fEquipment->equipmentId != 4352))
Warning("ReadHeader",
"raw data size found in the header is wrong (%d != %d)! Using the equipment size instead !",
fHeader->fSize, fEnd - fPosition);
#endif
return 0;
}
+
+AliRawReader* AliRawReaderDate::CloneSingleEvent() const
+{
+ // Clones the current event and
+ // creates raw-reader for the cloned event
+ // Can be used in order to make asynchronious
+ // access to the current raw data within
+ // several threads (online event display/reco)
+
+#ifdef ALI_DATE
+ if (fEvent) {
+ UInt_t evSize = fEvent->eventSize;
+ if (evSize) {
+ UChar_t *newEvent = new UChar_t[evSize];
+ memcpy(newEvent,fEvent,evSize);
+ return new AliRawReaderDate((void *)newEvent,kTRUE);
+ }
+ }
+#else
+ Fatal("AliRawReaderDate", "this class was compiled without DATE");
+#endif
+ return NULL;
+}