#include "TList.h"
#include "AliEveHOMERManager.h"
#include "TEveManager.h"
+#include "TTimer.h"
+#include "TGLOverlayButton.h"
+#include "TGLViewer.h"
ClassImp(AliEveHLTEventManagerHomer)
AliEveHLTEventManagerHomer::AliEveHLTEventManagerHomer() :
AliEveHLTEventManager(),
- fEventBuffer(NULL)
+ fEventBuffer(NULL),
+ fNextEventTimer(NULL),
+ fInfoButton(NULL)
{
// see header file for class documentation
- // or
- // refer to README to build package
- // or
- // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
fEventBuffer = new AliEveEventBufferHomer();
fEventBuffer->StartBufferMonitor();
- //AliEveHOMERManager * hm = fEventBuffer->GetHomerManager();
- //if(hm) GetEveManager()->AddToListTree(hm, kTRUE);
+
+ fNextEventTimer = new TTimer();
+ fNextEventTimer->Connect("Timeout()", "AliEveHLTEventManagerHomer", this, "TryNextEvent()" );
+
+ fInfoButton = new TGLOverlayButton(dynamic_cast<TGLViewerBase*>(gEve->GetDefaultGLViewer()), "", 0, 540, 210, 25);
+ fInfoButton->SetAlphaValues(0.0, 0.8);
+
}
UpdateDisplay();
}
-
-
+void AliEveHLTEventManagerHomer::NextEvent() {
+ fNextEventTimer->Start(1000);
+}
///________________________________________________________________________________
-void AliEveHLTEventManagerHomer::NextEvent() {
+void AliEveHLTEventManagerHomer::TryNextEvent() {
//See header file for documentation
- if(fEventBuffer->GetBusy() ) {
- cout << "event buffer already busy"<<endl;
+
+ if ( fEventBuffer->LockMutex() ) {
+ fInfoButton->SetAlphaValues(0.8, 0.8);
+ fInfoButton->SetText("Waiting for buffer...");
+ gEve->Redraw3D(kFALSE);
+ cout << "try again in 1 sec"<<endl;
return;
- }else {
- fEventBuffer->SetBusy(kTRUE);
}
+ fInfoButton->SetAlphaValues(0.8, 0.8);
+ fNextEventTimer->Stop();
+
+ cout << "Mutex is freeee!!"<<endl;
TList * aSyncEvent = fEventBuffer->GetASyncEvent();
TList * event = static_cast<TList*>(fEventBuffer->NextEvent());
if(event) {
cout << "Got the event, reset the display " <<endl;
+ fInfoButton->SetText("Reset display..");
ResetDisplay();
cout << "Process event"<<endl;
+ fInfoButton->SetText("Processing event..");
ProcessEvent(event);
if(aSyncEvent) {
cout << "Process asynchroneous event" << endl;
}
cout << "Upate the display"<<endl;
+ fInfoButton->SetText("Updating display...");
UpdateDisplay();
} else {
cout << "couldn't get the sync event"<<endl;
+ fInfoButton->SetAlphaValues(0.8, 0.8);
+ fInfoButton->SetText("Waiting for buffer...");
+ fEventBuffer->UnLockMutex();
+ fEventBuffer->CreateBufferThread();
+ fNextEventTimer->Start(3000);
+ return;
}
- // 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);
+ fInfoButton->SetAlphaValues(0.0, 0.0);
+ fInfoButton->SetText("Done..");
+ fEventBuffer->UnLockMutex();
+
}