Added event id to frame
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHLTEventManagerEditor.cxx
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #include "AliEveHLTEventManagerEditor.h"
11 #include "AliEveHLTEventManager.h"
12
13 #include <TVirtualPad.h>
14 #include <TColor.h>
15 #include <TROOT.h>
16
17 #include <TGLabel.h>
18 #include <TGButton.h>
19 #include <TGNumberEntry.h>
20 #include <TGColorSelect.h>
21 #include <TGDoubleSlider.h>
22 #include <TGComboBox.h>
23
24 //______________________________________________________________________________
25 // AliEveHLTEventManagerEditor
26 //
27
28 ClassImp(AliEveHLTEventManagerEditor)
29
30 AliEveHLTEventManagerEditor::AliEveHLTEventManagerEditor(const TGWindow *p, Int_t width, Int_t height,
31              UInt_t options, Pixel_t back) :
32   
33 TGedFrame(p, width, height, options | kVerticalFrame, back),
34   fM(0),
35   fButtonConnect(NULL),
36   fButtonWriteToFile(0),
37   fButtonNextEvent(0),
38   fButtonNavigateBack(0),
39   fButtonNavigateFwd(0),
40   fButtonPrintScreens(NULL),
41 //fBoxTriggerSelector(0),
42 //  fBoxEventLoopSpeed(0),
43   fButtonEventLoopText(0),
44   fButtonUpdateEvents(NULL),
45   fButtonEventLoop(0),
46  fEventLoopStarted(kFALSE) 
47 {
48
49   MakeTitle("AliEveHLTEventManager");
50
51   fButtonUpdateEvents = new TGTextButton(this, " Fill buffer.. ");
52   AddFrame(fButtonUpdateEvents); //, new TGLayoutHints(...));
53   fButtonUpdateEvents->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "PollEvents()");
54
55   // Create widgets
56   // fXYZZ = new TGSomeWidget(this, ...);
57   // AddFrame(fXYZZ, new TGLayoutHints(...));
58   // fXYZZ->Connect("SignalName()", "AliEveHLTEventManagerEditor", this, "DoXYZZ()");
59
60   fButtonNextEvent = new TGTextButton(this, "  NextEvent  ");
61   AddFrame(fButtonNextEvent); //, new TGLayoutHints(...));
62   fButtonNextEvent->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NextEvent()");
63
64   fButtonNavigateBack = new TGTextButton(this, "  Navigate Back  ");
65   AddFrame(fButtonNavigateBack); //, new TGLayoutHints(...));
66   fButtonNavigateBack->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NavigateBack()");
67
68   fButtonNavigateFwd = new TGTextButton(this, "  Navigate Fwd  ");
69   AddFrame(fButtonNavigateFwd); //, new TGLayoutHints(...));
70   fButtonNavigateFwd->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NavigateFwd()");
71
72
73   fButtonPrintScreens = new TGTextButton(this, "  Save Viewers  ");
74   AddFrame(fButtonPrintScreens); //, new TGLayoutHints(...));
75   fButtonPrintScreens->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "PrintScreens()");
76   
77   fButtonWriteToFile = new TGTextButton(this, " Write to file  ");
78   AddFrame(fButtonWriteToFile); //, new TGLayoutHints(...));
79   fButtonWriteToFile->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "WriteBlockListToFile()");
80
81   fButtonConnect = new TGTextButton(this, " Reconnect ");
82   AddFrame(fButtonConnect); //, new TGLayoutHints(...));
83   fButtonConnect->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "ConnectToHLT()");
84
85  
86  
87
88
89   // fBoxTriggerSelector = new TGComboBox(this, "Select Trigger");
90   // fBoxTriggerSelector->AddEntry("HLT Global Trigger", 0);
91   // fBoxTriggerSelector->AddEntry("Barrel multiplicity trigger", 1);
92   // fBoxTriggerSelector->AddEntry("PHOS Geometry trigger", 2);
93   // fBoxTriggerSelector->AddEntry("No trigger selection", 3);
94   // fBoxTriggerSelector->Connect("Selected(Int_t)","AliEveHLTEventManagerEditor", this, "SetTriggerString(int)");
95   // fBoxTriggerSelector->SetWidth(150);
96   // fBoxTriggerSelector->SetHeight(25);
97   // AddFrame(fBoxTriggerSelector);
98
99   fButtonEventLoopText = new TGTextButton(this, "  Loop Events  ");
100   AddFrame(fButtonEventLoopText); //, new TGLayoutHints(...));
101   fButtonEventLoopText->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "EventLoop()");
102
103   fButtonEventLoop = new TGPictureButton(this, gClient->GetPicture("$ALICE_ROOT/EVE/hlt-macros/HLT-logo.png"));
104   AddFrame(fButtonEventLoop); //, new TGLayoutHints(...));
105   fButtonEventLoop->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "EventLoop()");
106 }
107
108 /******************************************************************************/
109
110 void AliEveHLTEventManagerEditor::SetModel(TObject* obj) {
111   fM = dynamic_cast<AliEveHLTEventManager*>(obj);
112 }
113
114 /******************************************************************************/
115
116 void AliEveHLTEventManagerEditor::ConnectToHLT() {
117    // Connects to HOMER sources -> to HLT.
118   fM->ConnectEventBuffer();
119 }
120
121 void AliEveHLTEventManagerEditor::NextEvent() {
122   // call next event from AliEveHOMERManger
123   fM->NextEvent();
124 }
125
126 void AliEveHLTEventManagerEditor::WriteBlockListToFile() {
127   fM->SaveEveryThing();
128 }
129
130
131 void AliEveHLTEventManagerEditor::PrintScreens() {
132   //Print screens
133   fM->PrintScreens();
134 }
135
136 void AliEveHLTEventManagerEditor::NavigateFwd() {
137   // navigate forward
138   if ( !fEventLoopStarted ) {
139     fM->NavigateFwd();
140   }
141 }
142
143 void AliEveHLTEventManagerEditor::NavigateBack() {
144   // navigate back
145   if ( !fEventLoopStarted ) {
146     fM->NavigateBack();
147   }
148 }
149
150 void AliEveHLTEventManagerEditor::PollEvents() {
151   fM->StartBufferMonitor();
152 }
153
154 void AliEveHLTEventManagerEditor::EventLoop() {
155   // Start/stop event loop
156   if ( !fEventLoopStarted ) {
157     fEventLoopStarted = kTRUE;
158     fButtonEventLoopText->SetText(" Stop Loop ");
159     fM->StartLoop();
160   } else {
161     fM->StopLoop();
162     fEventLoopStarted = kFALSE;
163     fButtonEventLoopText->SetText(" Loop Events ");
164   }
165 }
166
167 void AliEveHLTEventManagerEditor::SetTriggerString(int id) {
168
169   if (id < 0 || id > 4) {
170     return;
171   }
172   
173   // TString tsa[4] = {"HLTGlobalTrigger", 
174   //                "BarrelMultiplicityTrigger", 
175   //                "PHOSgeomTrigger",
176   //                "ALL"};
177    
178  
179   // fM->SetTriggerString(tsa[id]);
180     
181 }
182