fix coding violation
[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),
30e7579c 41 fButtonEventLoopText(0),
42 fButtonUpdateEvents(NULL),
43 fButtonEventLoop(0),
11757805 44 fEventLoopStarted(kFALSE),
45 fBufferLoopStarted(kTRUE)
30e7579c 46{
47
8676f4b1 48 MakeTitle("AliEveHLTEventManager");
49
11757805 50 fButtonUpdateEvents = new TGTextButton(this, " Stop buffer loop ");
51 fButtonUpdateEvents->SetWidth(30);
30e7579c 52 AddFrame(fButtonUpdateEvents); //, new TGLayoutHints(...));
53 fButtonUpdateEvents->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "PollEvents()");
54
11757805 55 fButtonNextEvent = new TGTextButton(this, " NextEvent ");
30e7579c 56 AddFrame(fButtonNextEvent); //, new TGLayoutHints(...));
57 fButtonNextEvent->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NextEvent()");
58
11757805 59 fButtonNavigateBack = new TGTextButton(this, " Navigate Back ");
30e7579c 60 AddFrame(fButtonNavigateBack); //, new TGLayoutHints(...));
61 fButtonNavigateBack->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NavigateBack()");
62
11757805 63 fButtonNavigateFwd = new TGTextButton(this, " Navigate Fwd ");
30e7579c 64 AddFrame(fButtonNavigateFwd); //, new TGLayoutHints(...));
65 fButtonNavigateFwd->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "NavigateFwd()");
66
67
11757805 68 fButtonPrintScreens = new TGTextButton(this, " Save Viewers ");
30e7579c 69 AddFrame(fButtonPrintScreens); //, new TGLayoutHints(...));
70 fButtonPrintScreens->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "PrintScreens()");
8676f4b1 71
11757805 72 fButtonWriteToFile = new TGTextButton(this, " Save to file ");
8676f4b1 73 AddFrame(fButtonWriteToFile); //, new TGLayoutHints(...));
74 fButtonWriteToFile->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "WriteBlockListToFile()");
75
11757805 76 fButtonConnect = new TGTextButton(this, " Reconnect ");
8676f4b1 77 AddFrame(fButtonConnect); //, new TGLayoutHints(...));
78 fButtonConnect->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "ConnectToHLT()");
79
80
81
30e7579c 82
83
8676f4b1 84 // fBoxTriggerSelector = new TGComboBox(this, "Select Trigger");
85 // fBoxTriggerSelector->AddEntry("HLT Global Trigger", 0);
86 // fBoxTriggerSelector->AddEntry("Barrel multiplicity trigger", 1);
87 // fBoxTriggerSelector->AddEntry("PHOS Geometry trigger", 2);
88 // fBoxTriggerSelector->AddEntry("No trigger selection", 3);
89 // fBoxTriggerSelector->Connect("Selected(Int_t)","AliEveHLTEventManagerEditor", this, "SetTriggerString(int)");
90 // fBoxTriggerSelector->SetWidth(150);
91 // fBoxTriggerSelector->SetHeight(25);
92 // AddFrame(fBoxTriggerSelector);
30e7579c 93
94 fButtonEventLoopText = new TGTextButton(this, " Loop Events ");
95 AddFrame(fButtonEventLoopText); //, new TGLayoutHints(...));
96 fButtonEventLoopText->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "EventLoop()");
97
98 fButtonEventLoop = new TGPictureButton(this, gClient->GetPicture("$ALICE_ROOT/EVE/hlt-macros/HLT-logo.png"));
99 AddFrame(fButtonEventLoop); //, new TGLayoutHints(...));
100 fButtonEventLoop->Connect("Clicked()", "AliEveHLTEventManagerEditor", this, "EventLoop()");
101}
102
103/******************************************************************************/
104
105void AliEveHLTEventManagerEditor::SetModel(TObject* obj) {
106 fM = dynamic_cast<AliEveHLTEventManager*>(obj);
107}
108
109/******************************************************************************/
110
111void AliEveHLTEventManagerEditor::ConnectToHLT() {
112 // Connects to HOMER sources -> to HLT.
113 fM->ConnectEventBuffer();
114}
115
116void AliEveHLTEventManagerEditor::NextEvent() {
117 // call next event from AliEveHOMERManger
118 fM->NextEvent();
119}
120
121void AliEveHLTEventManagerEditor::WriteBlockListToFile() {
122 fM->SaveEveryThing();
123}
124
125
126void AliEveHLTEventManagerEditor::PrintScreens() {
127 //Print screens
128 fM->PrintScreens();
129}
130
131void AliEveHLTEventManagerEditor::NavigateFwd() {
132 // navigate forward
133 if ( !fEventLoopStarted ) {
134 fM->NavigateFwd();
135 }
136}
137
138void AliEveHLTEventManagerEditor::NavigateBack() {
139 // navigate back
140 if ( !fEventLoopStarted ) {
141 fM->NavigateBack();
142 }
143}
144
145void AliEveHLTEventManagerEditor::PollEvents() {
11757805 146 if(fBufferLoopStarted) {
147 fButtonUpdateEvents->SetText( " Start buffer loop ");
148 fBufferLoopStarted = kFALSE;
149 } else {
150 fButtonUpdateEvents->SetText("- Stop buffer loop - ");
151 fBufferLoopStarted = kTRUE;
152 }
153
30e7579c 154 fM->StartBufferMonitor();
155}
156
8b515ee4 157
30e7579c 158void AliEveHLTEventManagerEditor::EventLoop() {
159 // Start/stop event loop
160 if ( !fEventLoopStarted ) {
161 fEventLoopStarted = kTRUE;
11757805 162 fButtonEventLoopText->SetText(" Stop event Loop ");
30e7579c 163 fM->StartLoop();
164 } else {
165 fM->StopLoop();
166 fEventLoopStarted = kFALSE;
167 fButtonEventLoopText->SetText(" Loop Events ");
168 }
169}
170
171void AliEveHLTEventManagerEditor::SetTriggerString(int id) {
172
173 if (id < 0 || id > 4) {
174 return;
175 }
176
177 // TString tsa[4] = {"HLTGlobalTrigger",
178 // "BarrelMultiplicityTrigger",
179 // "PHOSgeomTrigger",
180 // "ALL"};
181
182
183 // fM->SetTriggerString(tsa[id]);
184
185}
186