X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=RAW%2FAliRawReaderDate.cxx;h=8553e19aace7034412331a7cbee98c95f3184880;hp=6d414f67cbf12f0bc031a41ef28c0b55f1d5221a;hb=4b2bc572b7badd9eb57b3d261dd2d4aca087e897;hpb=a97af23da3dddf03f625c5f3e8872c74d7f2f7a2 diff --git a/RAW/AliRawReaderDate.cxx b/RAW/AliRawReaderDate.cxx index 6d414f67cbf..8553e19aace 100644 --- a/RAW/AliRawReaderDate.cxx +++ b/RAW/AliRawReaderDate.cxx @@ -34,9 +34,9 @@ ClassImp(AliRawReaderDate) AliRawReaderDate::AliRawReaderDate( #ifdef ALI_DATE - void* event + void* event, Bool_t owner #else - void* /* event */ + void* /* event */, Bool_t owner #endif ) : fFile(NULL), @@ -44,7 +44,8 @@ AliRawReaderDate::AliRawReaderDate( fSubEvent(NULL), fEquipment(NULL), fPosition(NULL), - fEnd(NULL) + fEnd(NULL), + fOwner(owner) { // create an object to read digits from the given date event @@ -68,7 +69,8 @@ AliRawReaderDate::AliRawReaderDate( fSubEvent(NULL), fEquipment(NULL), fPosition(NULL), - fEnd(NULL) + fEnd(NULL), + fOwner(kTRUE) { // create an object to read digits from the given date event @@ -107,7 +109,8 @@ AliRawReaderDate::AliRawReaderDate(const AliRawReaderDate& rawReader) : fSubEvent(rawReader.fSubEvent), fEquipment(rawReader.fEquipment), fPosition(rawReader.fPosition), - fEnd(rawReader.fEnd) + fEnd(rawReader.fEnd), + fOwner(rawReader.fOwner) { // copy constructor @@ -129,8 +132,8 @@ AliRawReaderDate::~AliRawReaderDate() // destructor #ifdef ALI_DATE + if (fEvent && fOwner) delete[] fEvent; if (fFile) { - delete[] fEvent; fclose(fFile); } #endif @@ -425,7 +428,8 @@ Bool_t AliRawReaderDate::ReadHeader() // "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); @@ -635,3 +639,26 @@ Int_t AliRawReaderDate::CheckData() const #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; +}