]>
Commit | Line | Data |
---|---|---|
1 | // Author: 2010 Svein Lindal <slindal@fys.uio.no> * | |
2 | // for The ALICE HLT Project. * | |
3 | ||
4 | #include "AliHLTEveHLT.h" | |
5 | #include "AliHLTEvePhos.h" | |
6 | #include "AliHLTEveEmcal.h" | |
7 | ||
8 | ||
9 | #include "AliESDEvent.h" | |
10 | #include "AliEveHLTEventManager.h" | |
11 | #include "AliEveEventBufferOffline.h" | |
12 | #include "AliEveHLTEventManagerHomer.h" | |
13 | #include "TList.h" | |
14 | #include "AliEveHOMERManager.h" | |
15 | #include "TEveManager.h" | |
16 | #include "TTimer.h" | |
17 | #include "TGLOverlayButton.h" | |
18 | #include "TGLViewer.h" | |
19 | ||
20 | ClassImp(AliEveHLTEventManagerHomer) | |
21 | ||
22 | AliEveHLTEventManagerHomer::AliEveHLTEventManagerHomer() : | |
23 | AliEveHLTEventManager(), | |
24 | fEventBuffer(NULL), | |
25 | fNextEventTimer(NULL), | |
26 | fInfoButton(NULL) | |
27 | { | |
28 | // see header file for class documentation | |
29 | ||
30 | fEventBuffer = new AliEveEventBufferHomer(); | |
31 | fEventBuffer->StartBufferMonitor(); | |
32 | ||
33 | fNextEventTimer = new TTimer(); | |
34 | fNextEventTimer->Connect("Timeout()", "AliEveHLTEventManagerHomer", this, "TryNextEvent()" ); | |
35 | ||
36 | fInfoButton = new TGLOverlayButton(dynamic_cast<TGLViewerBase*>(gEve->GetDefaultGLViewer()), "", 0, 540, 210, 25); | |
37 | fInfoButton->SetAlphaValues(0.0, 0.8); | |
38 | ||
39 | ||
40 | ||
41 | } | |
42 | ||
43 | ||
44 | AliEveHLTEventManagerHomer::~AliEveHLTEventManagerHomer() { | |
45 | ||
46 | //DestroyElements(); | |
47 | //DestroyDetectorElements(); | |
48 | if(fEventBuffer) | |
49 | delete fEventBuffer; | |
50 | fEventBuffer = NULL; | |
51 | ||
52 | } | |
53 | ||
54 | ///________________________________________________________________________________ | |
55 | void AliEveHLTEventManagerHomer::ProcessList(TList * blockList) { | |
56 | ||
57 | ProcessEvent(blockList); | |
58 | UpdateDisplay(); | |
59 | ||
60 | } | |
61 | void AliEveHLTEventManagerHomer::NextEvent() { | |
62 | fNextEventTimer->Start(1000); | |
63 | } | |
64 | ||
65 | ///________________________________________________________________________________ | |
66 | void AliEveHLTEventManagerHomer::TryNextEvent() { | |
67 | //See header file for documentation | |
68 | ||
69 | if ( fEventBuffer->LockMutex() ) { | |
70 | fInfoButton->SetAlphaValues(0.8, 0.8); | |
71 | fInfoButton->SetText("Waiting for buffer..."); | |
72 | gEve->Redraw3D(kFALSE); | |
73 | cout << "try again in 1 sec"<<endl; | |
74 | return; | |
75 | } | |
76 | fInfoButton->SetAlphaValues(0.8, 0.8); | |
77 | ||
78 | fNextEventTimer->Stop(); | |
79 | ||
80 | cout << "Mutex is freeee!!"<<endl; | |
81 | TList * aSyncEvent = fEventBuffer->GetASyncEvent(); | |
82 | TList * event = static_cast<TList*>(fEventBuffer->NextEvent()); | |
83 | if(event) { | |
84 | cout << "Got the event, reset the display " <<endl; | |
85 | fInfoButton->SetText("Reset display.."); | |
86 | ResetDisplay(); | |
87 | cout << "Process event"<<endl; | |
88 | fInfoButton->SetText("Processing event.."); | |
89 | ProcessEvent(event); | |
90 | if(aSyncEvent) { | |
91 | cout << "Process asynchroneous event" << endl; | |
92 | ProcessEvent(aSyncEvent); | |
93 | } else { | |
94 | cout << "Could not get async event"<<endl; | |
95 | } | |
96 | ||
97 | cout << "Upate the display"<<endl; | |
98 | fInfoButton->SetText("Updating display..."); | |
99 | UpdateDisplay(); | |
100 | ||
101 | } else { | |
102 | cout << "couldn't get the sync event"<<endl; | |
103 | fInfoButton->SetAlphaValues(0.8, 0.8); | |
104 | fInfoButton->SetText("Waiting for buffer..."); | |
105 | fEventBuffer->UnLockMutex(); | |
106 | fEventBuffer->CreateBufferThread(); | |
107 | fNextEventTimer->Start(3000); | |
108 | return; | |
109 | } | |
110 | ||
111 | fInfoButton->SetAlphaValues(0.0, 0.0); | |
112 | fInfoButton->SetText("Done.."); | |
113 | fEventBuffer->UnLockMutex(); | |
114 | ||
115 | } | |
116 | ||
117 | ||
118 | ///____________________________________________________________________________________ | |
119 | void AliEveHLTEventManagerHomer::NavigateFwd() { | |
120 | //See header file for documentation | |
121 | TList * fEvent = dynamic_cast<TList*>(fEventBuffer->Fwd()); | |
122 | if(fEvent) { | |
123 | ResetDisplay(); | |
124 | ProcessEvent(fEvent); | |
125 | UpdateDisplay(); | |
126 | } else { | |
127 | cout << "couldn't get the fwd event"<<endl; | |
128 | } | |
129 | } | |
130 | ||
131 | ||
132 | ///______________________________________________________________________________________ | |
133 | void AliEveHLTEventManagerHomer::NavigateBack() { | |
134 | //See header file for documentation | |
135 | TList * fEvent = dynamic_cast<TList*>(fEventBuffer->Back()); | |
136 | if(fEvent) { | |
137 | ResetDisplay(); | |
138 | ProcessEvent(fEvent); | |
139 | UpdateDisplay(); | |
140 | } else { | |
141 | cout << "couldn't get the back event"<<endl; | |
142 | } | |
143 | } | |
144 |