bugfix
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHLTEventManagerEditor.cxx
CommitLineData
30e7579c 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
28ClassImp(AliEveHLTEventManagerEditor)
29
30AliEveHLTEventManagerEditor::AliEveHLTEventManagerEditor(const TGWindow *p, Int_t width, Int_t height,
31 UInt_t options, Pixel_t back) :
32
33TGedFrame(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),
8676f4b1 41//fBoxTriggerSelector(0),
30e7579c 42// fBoxEventLoopSpeed(0),
43 fButtonEventLoopText(0),
44 fButtonUpdateEvents(NULL),
45 fButtonEventLoop(0),
46 fEventLoopStarted(kFALSE)
47{
48
8676f4b1 49 MakeTitle("AliEveHLTEventManager");
50
8b515ee4 51 fButtonUpdateEvents = new TGTextButton(this, "- Fill buffer - ");
30e7579c 52 AddFrame(fButtonUpdateEvents); //, new TGLayoutHints(...));
53 fButtonUpdateEvents->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "PollEvents()");
54
30e7579c 55 // Create widgets
56 // fXYZZ = new TGSomeWidget(this, ...);
57 // AddFrame(fXYZZ, new TGLayoutHints(...));
58 // fXYZZ->Connect("SignalName()", "AliEveHLTEventManagerEditor", this, "DoXYZZ()");
59
8b515ee4 60 fButtonNextEvent = new TGTextButton(this, "- NextEvent -");
30e7579c 61 AddFrame(fButtonNextEvent); //, new TGLayoutHints(...));
62 fButtonNextEvent->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NextEvent()");
63
8b515ee4 64 fButtonNavigateBack = new TGTextButton(this, "- Navigate Back - ");
30e7579c 65 AddFrame(fButtonNavigateBack); //, new TGLayoutHints(...));
66 fButtonNavigateBack->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NavigateBack()");
67
8b515ee4 68 fButtonNavigateFwd = new TGTextButton(this, "- Navigate Fwd -");
30e7579c 69 AddFrame(fButtonNavigateFwd); //, new TGLayoutHints(...));
70 fButtonNavigateFwd->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NavigateFwd()");
71
72
8b515ee4 73 fButtonPrintScreens = new TGTextButton(this, "- Save Viewers - ");
30e7579c 74 AddFrame(fButtonPrintScreens); //, new TGLayoutHints(...));
75 fButtonPrintScreens->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "PrintScreens()");
8676f4b1 76
8b515ee4 77 fButtonWriteToFile = new TGTextButton(this, "- Write to file -");
8676f4b1 78 AddFrame(fButtonWriteToFile); //, new TGLayoutHints(...));
79 fButtonWriteToFile->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "WriteBlockListToFile()");
80
8b515ee4 81 fButtonConnect = new TGTextButton(this, "- Reconnect - ");
8676f4b1 82 AddFrame(fButtonConnect); //, new TGLayoutHints(...));
83 fButtonConnect->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "ConnectToHLT()");
84
85
86
30e7579c 87
88
8676f4b1 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);
30e7579c 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
110void AliEveHLTEventManagerEditor::SetModel(TObject* obj) {
111 fM = dynamic_cast<AliEveHLTEventManager*>(obj);
112}
113
114/******************************************************************************/
115
116void AliEveHLTEventManagerEditor::ConnectToHLT() {
117 // Connects to HOMER sources -> to HLT.
118 fM->ConnectEventBuffer();
119}
120
121void AliEveHLTEventManagerEditor::NextEvent() {
122 // call next event from AliEveHOMERManger
123 fM->NextEvent();
124}
125
126void AliEveHLTEventManagerEditor::WriteBlockListToFile() {
127 fM->SaveEveryThing();
128}
129
130
131void AliEveHLTEventManagerEditor::PrintScreens() {
132 //Print screens
133 fM->PrintScreens();
134}
135
136void AliEveHLTEventManagerEditor::NavigateFwd() {
137 // navigate forward
138 if ( !fEventLoopStarted ) {
139 fM->NavigateFwd();
140 }
141}
142
143void AliEveHLTEventManagerEditor::NavigateBack() {
144 // navigate back
145 if ( !fEventLoopStarted ) {
146 fM->NavigateBack();
147 }
148}
149
150void AliEveHLTEventManagerEditor::PollEvents() {
151 fM->StartBufferMonitor();
152}
153
8b515ee4 154
30e7579c 155void AliEveHLTEventManagerEditor::EventLoop() {
156 // Start/stop event loop
157 if ( !fEventLoopStarted ) {
158 fEventLoopStarted = kTRUE;
159 fButtonEventLoopText->SetText(" Stop Loop ");
160 fM->StartLoop();
161 } else {
162 fM->StopLoop();
163 fEventLoopStarted = kFALSE;
164 fButtonEventLoopText->SetText(" Loop Events ");
165 }
166}
167
168void AliEveHLTEventManagerEditor::SetTriggerString(int id) {
169
170 if (id < 0 || id > 4) {
171 return;
172 }
173
174 // TString tsa[4] = {"HLTGlobalTrigger",
175 // "BarrelMultiplicityTrigger",
176 // "PHOSgeomTrigger",
177 // "ALL"};
178
179
180 // fM->SetTriggerString(tsa[id]);
181
182}
183