bugfix
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHLTEventManagerHomer.cxx
index 338026ef5414e1f615e5145547c655adf06b8243..b54d8f4a970859f8fe575ee89450ff8909068545 100644 (file)
@@ -47,14 +47,43 @@ AliEveHLTEventManagerHomer::~AliEveHLTEventManagerHomer() {
 ///________________________________________________________________________________
 void AliEveHLTEventManagerHomer::NextEvent() {
   //See header file for documentation
-  TList * fEvent = static_cast<TList*>(fEventBuffer->NextEvent());
-  if(fEvent) {
-    cout << "Got the event " <<endl;
-    ProcessEvent(fEvent);
-    fEventBuffer->SetBusy(kFALSE);
+  if(fEventBuffer->GetBusy() ) {
+    cout << "event buffer already busy"<<endl;
+    return;
+  }else {
+    fEventBuffer->SetBusy(kTRUE);
+  }
+
+  TList * aSyncEvent = fEventBuffer->GetASyncEvent();
+  TList * event = static_cast<TList*>(fEventBuffer->NextEvent());
+  if(event) {
+    cout << "Got the event, reset the display " <<endl;
+    ResetDisplay();
+    cout << "Process event"<<endl;
+    ProcessEvent(event);
+    if(aSyncEvent) {
+      cout  << "Process asynchroneous event" << endl;
+      ProcessEvent(aSyncEvent);
+    }  else {
+      cout << "Could not get async event"<<endl;
+    }
+    
+    cout << "Upate the display"<<endl;
+    UpdateDisplay();
+  
   } else {
-    cout << "couldn't get the event"<<endl;
+    cout << "could't get the sync event"<<endl;
   }
+  
+  //  cout  << "doint async block"<<endl;
+  //  TList * async = static_cast<TList*>(fEventBuffer->GetAList());
+  //  if(async) {
+  //   ProcessEvent(async);
+  //   }  else {
+  //    cout << "No async bloc"<<endl;
+  // }
+
+  fEventBuffer->SetBusy(kFALSE);
 }