]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawReaderRoot.cxx
New method to clone current raw-data event and create a single-event raw-reader....
[u/mrichter/AliRoot.git] / RAW / AliRawReaderRoot.cxx
index ec519f9f186290c413c2d7832f755bf6c79f3512..6cd69416364f7416310588ec3ea34f3902afe7df 100644 (file)
@@ -402,6 +402,10 @@ Bool_t AliRawReaderRoot::ReadHeader()
 
       // get the next equipment and raw data
       fCount = 0;
+      if (fEquipmentIndex >= fSubEvent->GetNEquipments()) {
+       fEquipment = NULL;
+       continue;
+      }
       fEquipment = fSubEvent->GetEquipment(fEquipmentIndex++);
       if (!fEquipment) continue;
       if (!IsSelected()) {
@@ -619,6 +623,10 @@ Int_t AliRawReaderRoot::CheckData() const
     }
 
     // get the next equipment and raw data
+    if (equipmentIndex >= subEvent->GetNEquipments()) {
+      equipment = NULL;
+      continue;
+    }
     equipment = subEvent->GetEquipment(equipmentIndex++);
     if (!equipment) continue;
     AliRawData* rawData = equipment->GetRawData();
@@ -652,3 +660,26 @@ Int_t AliRawReaderRoot::CheckData() const
 
   return result;
 }
+
+AliRawReader* AliRawReaderRoot::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)
+
+  if (GetEvent()) {
+    // Root formatted raw data
+    AliRawVEvent *gdcRootEvent = (AliRawVEvent*) GetEvent()->Clone();
+    for (Int_t ldcCounter=0; ldcCounter < gdcRootEvent->GetNSubEvents(); ldcCounter++) {
+      AliRawVEvent *ldcRootEvent = gdcRootEvent->GetSubEvent(ldcCounter);
+      for (Int_t eqCounter=0; eqCounter < ldcRootEvent->GetNEquipments(); eqCounter++) {
+       AliRawVEquipment *equipment=ldcRootEvent->GetEquipment(eqCounter);
+       equipment->CloneRawData();
+      }
+    }
+    return new AliRawReaderRoot(gdcRootEvent);
+  }
+  return NULL;
+}