]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawReaderDate.cxx
New method to clone current raw-data event and create a single-event raw-reader....
[u/mrichter/AliRoot.git] / RAW / AliRawReaderDate.cxx
index fa0ef4c6a39af68681a251af4833d6abd05c24ca..60dd68c1c0fb3669f4fcaa4d964588919d5979b7 100644 (file)
@@ -129,8 +129,8 @@ AliRawReaderDate::~AliRawReaderDate()
 // destructor
 
 #ifdef ALI_DATE
+  if (fEvent) delete[] fEvent;
   if (fFile) {
-    delete[] fEvent;
     fclose(fFile);
   }
 #endif
@@ -636,3 +636,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);
+    }
+  }
+#else
+  Fatal("AliRawReaderDate", "this class was compiled without DATE");
+#endif
+  return NULL;
+}