]>
Commit | Line | Data |
---|---|---|
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 "AliEveHOMERManagerEditor.h" | |
11 | #include "AliEveHOMERManager.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 | // AliEveHOMERManagerEditor | |
26 | // | |
27 | ||
28 | ClassImp(AliEveHOMERManagerEditor) | |
29 | ||
30 | AliEveHOMERManagerEditor::AliEveHOMERManagerEditor(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 | fButtonWriteToFile(0), | |
36 | fButtonNextEvent(0), | |
37 | fButtonNavigateBack(0), | |
38 | fButtonNavigateFwd(0), | |
39 | fBoxTriggerSelector(0), | |
40 | fButtonEventLoopText(0), | |
41 | // fBoxEventLoopSpeed(0), | |
42 | fButtonEventLoop(0), | |
43 | ||
44 | fEventLoopStarted(kFALSE) | |
45 | { | |
46 | ||
47 | MakeTitle("AliEveHOMERManager"); | |
48 | ||
49 | // Create widgets | |
50 | // fXYZZ = new TGSomeWidget(this, ...); | |
51 | // AddFrame(fXYZZ, new TGLayoutHints(...)); | |
52 | // fXYZZ->Connect("SignalName()", "AliEveHOMERManagerEditor", this, "DoXYZZ()"); | |
53 | ||
54 | // fButtonConnect = new TGTextButton(this, " Connect to HLT "); | |
55 | // AddFrame(fButtonConnect); //, new TGLayoutHints(...)); | |
56 | // fButtonConnect->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "ConnectToHLT()"); | |
57 | ||
58 | fButtonWriteToFile = new TGTextButton(this, " Write to file "); | |
59 | AddFrame(fButtonWriteToFile); //, new TGLayoutHints(...)); | |
60 | fButtonWriteToFile->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "WriteBlockListToFile()"); | |
61 | ||
62 | ||
63 | fButtonNextEvent = new TGTextButton(this, " NextEvent "); | |
64 | AddFrame(fButtonNextEvent); //, new TGLayoutHints(...)); | |
65 | fButtonNextEvent->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "NextEvent()"); | |
66 | ||
67 | fButtonNavigateBack = new TGTextButton(this, " Navigate Back "); | |
68 | AddFrame(fButtonNavigateBack); //, new TGLayoutHints(...)); | |
69 | fButtonNavigateBack->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "NavigateBack()"); | |
70 | ||
71 | fButtonNavigateFwd = new TGTextButton(this, " Navigate Fwd "); | |
72 | AddFrame(fButtonNavigateFwd); //, new TGLayoutHints(...)); | |
73 | fButtonNavigateFwd->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "NavigateFwd()"); | |
74 | ||
75 | fBoxTriggerSelector = new TGComboBox(this, "Select Trigger"); | |
76 | fBoxTriggerSelector->AddEntry("HLT Global Trigger", 0); | |
77 | fBoxTriggerSelector->AddEntry("Barrel multiplicity trigger", 1); | |
78 | fBoxTriggerSelector->AddEntry("PHOS Geometry trigger", 2); | |
79 | fBoxTriggerSelector->AddEntry("No trigger selection", 3); | |
80 | fBoxTriggerSelector->Connect("Selected(Int_t)","AliEveHOMERManagerEditor", this, "SetTriggerString(int)"); | |
81 | fBoxTriggerSelector->SetWidth(150); | |
82 | fBoxTriggerSelector->SetHeight(25); | |
83 | AddFrame(fBoxTriggerSelector); | |
84 | ||
85 | fButtonEventLoopText = new TGTextButton(this, " Loop Events "); | |
86 | AddFrame(fButtonEventLoopText); //, new TGLayoutHints(...)); | |
87 | fButtonEventLoopText->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "EventLoop()"); | |
88 | ||
89 | fButtonEventLoop = new TGPictureButton(this, gClient->GetPicture("$ALICE_ROOT/EVE/hlt-macros/HLT-logo.png")); | |
90 | AddFrame(fButtonEventLoop); //, new TGLayoutHints(...)); | |
91 | fButtonEventLoop->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "EventLoop()"); | |
92 | } | |
93 | ||
94 | /******************************************************************************/ | |
95 | ||
96 | void AliEveHOMERManagerEditor::SetModel(TObject* obj) { | |
97 | fM = dynamic_cast<AliEveHOMERManager*>(obj); | |
98 | ||
99 | // Set values of widgets | |
100 | // fXYZZ->SetValue(fM->GetXYZZ()); | |
101 | } | |
102 | ||
103 | /******************************************************************************/ | |
104 | ||
105 | // void AliEveHOMERManagerEditor::ConnectToHLT() { | |
106 | // // Connects to HOMER sources -> to HLT. | |
107 | ||
108 | // fM->ConnectEVEtoHOMER(); | |
109 | // } | |
110 | ||
111 | void AliEveHOMERManagerEditor::NextEvent() { | |
112 | // call next event from AliEveHOMERManger | |
113 | fM->NextHOMEREvent(); | |
114 | } | |
115 | ||
116 | void AliEveHOMERManagerEditor::WriteBlockListToFile() { | |
117 | gROOT->ProcessLineFast("writeToFile();"); | |
118 | ||
119 | } | |
120 | ||
121 | void AliEveHOMERManagerEditor::NavigateFwd() { | |
122 | // navigate forward | |
123 | ||
124 | if ( !fEventLoopStarted ) { | |
125 | if ( fM->NavigateEventBufferFwd() == -1 ) | |
126 | return; | |
127 | ||
128 | fM->ProcessEvent(); | |
129 | // gROOT->ProcessLineFast("processEvent();"); | |
130 | } | |
131 | return; | |
132 | } | |
133 | ||
134 | void AliEveHOMERManagerEditor::NavigateBack() { | |
135 | // navigate back | |
136 | ||
137 | if ( !fEventLoopStarted ) { | |
138 | if ( fM->NavigateEventBufferBack() == -1 ) | |
139 | return; | |
140 | ||
141 | fM->ProcessEvent(); | |
142 | //gROOT->ProcessLineFast("processEvent();"); | |
143 | } | |
144 | return; | |
145 | } | |
146 | ||
147 | void AliEveHOMERManagerEditor::EventLoop() { | |
148 | // Start/stop event loop | |
149 | if ( !fEventLoopStarted ) { | |
150 | fEventLoopStarted = kTRUE; | |
151 | fButtonEventLoopText->SetText(" Stop Loop "); | |
152 | //fM->SetEventLoopStarted(kTRUE); | |
153 | fM->StartLoop(); | |
154 | ||
155 | // gROOT->ProcessLineFast("loopEvent();"); | |
156 | ||
157 | } else { | |
158 | ||
159 | //gROOT->ProcessLineFast("stopLoopEvent();"); | |
160 | fM->StopLoop(); | |
161 | fEventLoopStarted = kFALSE; | |
162 | //fM->SetEventLoopStarted(kFALSE); | |
163 | fButtonEventLoopText->SetText(" Loop Events "); | |
164 | } | |
165 | } | |
166 | ||
167 | void AliEveHOMERManagerEditor::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 |