]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveBase/AliEveJetPlaneEditor.cxx
We don't check the path to the raw-data file, it is done inside AliRawReader::Create...
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveJetPlaneEditor.cxx
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4673ff03 3
d810d0de 4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
9
10#include "AliEveJetPlaneEditor.h"
707b281a 11#include "AliEveJetPlane.h"
12
84aff7a4 13#include <TEveGValuators.h>
4673ff03 14
4673ff03 15#include <TGButton.h>
16#include <TGNumberEntry.h>
4673ff03 17#include <TGFrame.h>
18#include <TGTab.h>
d810d0de 19
a15e6d7d 20//==============================================================================
21//==============================================================================
22// AliEveJetPlaneEditor
23//==============================================================================
4673ff03 24
57ffa5fb 25//______________________________________________________________________________
4673ff03 26//
a15e6d7d 27// GUI editor for AliEveJetPlane class.
4673ff03 28
d810d0de 29AliEveJetPlaneEditor::StaticDataWindow* AliEveJetPlaneEditor::fgStaticWindow = 0;
4673ff03 30
d810d0de 31ClassImp(AliEveJetPlaneEditor)
4673ff03 32
d810d0de 33AliEveJetPlaneEditor::AliEveJetPlaneEditor(const TGWindow *p, Int_t width, Int_t height,
4673ff03 34 UInt_t options, Pixel_t back) :
35 TGedFrame(p, width, height, options | kVerticalFrame, back),
36 fM(0),
37 fRnrJets(0),
38 fRnrTracks(0),
39 fEnergyScale(0),
40 fEnergyColorScale(0),
a97abca8 41 fOneSelection(0), fTwoSelection(0),
4673ff03 42 fInformationSetup(0)
4673ff03 43{
a97abca8 44 // Constructor.
45
d810d0de 46 MakeTitle("AliEveJetPlane");
4673ff03 47 Int_t labelW = 67;
48
4673ff03 49 fRnrJets = new TGCheckButton(this, "Rnr Jets");
50 AddFrame(fRnrJets, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
d810d0de 51 fRnrJets->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrJets()");
4673ff03 52
53 fRnrTracks = new TGCheckButton(this, "Rnr Tracks");
54 AddFrame(fRnrTracks, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
d810d0de 55 fRnrTracks->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrTracks()");
4673ff03 56
84aff7a4 57 fEnergyScale = new TEveGValuator(this, "Length scale:", 110, 0);
4673ff03 58 fEnergyScale->SetLabelWidth(labelW);
59 fEnergyScale->SetNELength(6);
60 fEnergyScale->Build();
61 fEnergyScale->SetLimits(1, 500, 500, TGNumberFormat::kNESRealOne);
62 fEnergyScale->SetToolTip("Energy mapped to length of arrow.");
d810d0de 63 fEnergyScale->Connect("ValueSet(Double_t)", "AliEveJetPlaneEditor", this, "DoEnergyScale()");
4673ff03 64 AddFrame(fEnergyScale, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
65
84aff7a4 66 fEnergyColorScale = new TEveGValuator(this, "Color scale:", 110, 0);
4673ff03 67 fEnergyColorScale->SetLabelWidth(labelW);
68 fEnergyColorScale->SetNELength(6);
69 fEnergyColorScale->Build();
70 fEnergyColorScale->SetLimits(-2, 2, 100, TGNumberFormat::kNESRealOne);
71 fEnergyColorScale->SetToolTip("Energy mapped to highest palette color.");
d810d0de 72 fEnergyColorScale->Connect("ValueSet(Double_t)", "AliEveJetPlaneEditor", this, "DoEnergyColorScale()");
4673ff03 73 AddFrame(fEnergyColorScale, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
74
84aff7a4 75 fOneSelection = new TGRadioButton(this, "&One TEveTrack/Jet");
76 fTwoSelection = new TGRadioButton(this, "&Two TEveTrack/Jet");
4673ff03 77 AddFrame(fOneSelection, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
78 AddFrame(fTwoSelection, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
d810d0de 79 fOneSelection->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoOneSelection()");
80 fTwoSelection->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoTwoSelection()");
4673ff03 81
84aff7a4 82 // fInformationSetup = new TGTextButton(this, "TEveTrack/Jet Print");
4673ff03 83 // AddFrame(fInformationSetup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 0, 2, 2));
d810d0de 84 // fInformationSetup->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoStaticDataWindow()");
4673ff03 85}
86
57ffa5fb 87/******************************************************************************/
4673ff03 88
d810d0de 89void AliEveJetPlaneEditor::SetModel(TObject* obj)
4673ff03 90{
a97abca8 91 // Set model object.
92
d810d0de 93 fM = dynamic_cast<AliEveJetPlane*>(obj);
4673ff03 94
95 // Set values of widgets
96 // fXYZZ->SetValue(fM->GetXYZZ());
97 fRnrJets->SetState(fM->GetRnrJets() ? kButtonDown : kButtonUp);
98 fRnrTracks->SetState(fM->GetRnrTracks() ? kButtonDown : kButtonUp);
99 fEnergyScale->SetValue(fM->GetEnergyScale());
100 fEnergyColorScale->SetValue(fM->GetEnergyColorScale());
101 fOneSelection->SetState(fM->GetOneSelection() ? kButtonDown : kButtonUp);
102 fTwoSelection->SetState(fM->GetTwoSelection() ? kButtonDown : kButtonUp);
103}
104
57ffa5fb 105/******************************************************************************/
4673ff03 106
d810d0de 107void AliEveJetPlaneEditor::DoRnrJets()
4673ff03 108{
a97abca8 109 // Slot for RnrJets.
110
4673ff03 111 fM->SetRnrJets(fRnrJets->IsOn());
112 Update();
113}
114
d810d0de 115void AliEveJetPlaneEditor::DoRnrTracks()
4673ff03 116{
a97abca8 117 // Slot for RnrTracks.
118
4673ff03 119 fM->SetRnrTracks(fRnrTracks->IsOn());
120 Update();
121}
122
d810d0de 123void AliEveJetPlaneEditor::DoEnergyColorScale()
4673ff03 124{
a97abca8 125 // Slot for EnergyColorScale.
126
4673ff03 127 fM->SetEnergyColorScale(fEnergyColorScale->GetValue());
128 Update();
129}
130
d810d0de 131void AliEveJetPlaneEditor::DoEnergyScale()
4673ff03 132{
a97abca8 133 // Slot for EnergyScale.
134
4673ff03 135 fM->SetEnergyScale(fEnergyScale->GetValue());
136 Update();
137}
138
d810d0de 139void AliEveJetPlaneEditor::DoOneSelection()
4673ff03 140{
a97abca8 141 // Slot for OneSelection.
142
4673ff03 143 fTwoSelection->SetState(kButtonUp);
144 fM->SetOneSelection(fOneSelection->IsOn());
145 fM->SetTwoSelection(fTwoSelection->IsOn());
146 Update();
147}
148
d810d0de 149void AliEveJetPlaneEditor::DoTwoSelection()
4673ff03 150{
a97abca8 151 // Slot for TwoSelection.
152
4673ff03 153 fOneSelection->SetState(kButtonUp);
154 fM->SetOneSelection(fOneSelection->IsOn());
155 fM->SetTwoSelection(fTwoSelection->IsOn());
156 Update();
157}
158
d810d0de 159void AliEveJetPlaneEditor::DoStaticDataWindow()
51346b82 160{
a97abca8 161 // Slot for StaticDataWindow.
162
4673ff03 163 printf("\n Soon available ... \n");
164 if (fgStaticWindow == 0)
165 fgStaticWindow = new StaticDataWindow(gClient->GetRoot(), this, 400, 200);
166
167 // call fgStaticWindow->ReadValues(); // like setmodel
168
169 // position relative to the parent's window
170 fgStaticWindow->MapWindow();
171 fgStaticWindow->RaiseWindow();
172 fgStaticWindow->CenterOnParent();
173}
174
a97abca8 175
a15e6d7d 176//==============================================================================
177//==============================================================================
178// AliEveJetPlaneEditor::StaticDataWindow
179//==============================================================================
4673ff03 180
a97abca8 181//______________________________________________________________________________
182//
183// Common settings for all AliEveJetPlane objects.
a15e6d7d 184// Used as a pop-up from AliEveJetPlaneEditor.
a97abca8 185
d810d0de 186ClassImp(AliEveJetPlaneEditor::StaticDataWindow)
4673ff03 187
d810d0de 188AliEveJetPlaneEditor::StaticDataWindow::StaticDataWindow(const TGWindow *p, const TGWindow *main,
a97abca8 189 UInt_t w, UInt_t h, UInt_t options) :
4673ff03 190 TGTransientFrame(p, main, w, h, options),
fd31e9de 191 fFrame1(0), fF2(0),
192 fOkButton(0), fCancelButton(0),
193 fL1(0), fL2(0), fL3(0), fL5(0),
4673ff03 194 fTab(0),
fd31e9de 195 fChk1(0), fChk2(0), fChk3(0), fChk4(0), fChk5(0)
4673ff03 196{
a97abca8 197 // Constructor.
4673ff03 198 // Create a dialog window. A dialog window pops up with respect to its
199 // "main" window.
200
d810d0de 201 Connect("CloseWindow()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoClose()");
4673ff03 202 DontCallClose(); // to avoid double deletions.
203
204 // use hierarchical cleaning
205 SetCleanup(kDeepCleanup);
206
207 fFrame1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth);
208
209 fOkButton = new TGTextButton(fFrame1, "&Ok", 1);
d810d0de 210 fOkButton->Connect("Clicked()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoOK()");
4673ff03 211 fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2);
d810d0de 212 fCancelButton->Connect("Clicked()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoCancel()");
4673ff03 213
214 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,2, 2, 2, 2);
215 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1);
216
217 fFrame1->AddFrame(fOkButton, fL1);
218 fFrame1->AddFrame(fCancelButton, fL1);
219
220 fFrame1->Resize(150, fOkButton->GetDefaultHeight());
221 AddFrame(fFrame1, fL2);
222
223 // Tabs for one and two track information
224
225 fTab = new TGTab(this, 300, 300);
d810d0de 226 fTab->Connect("Selected(Int_t)", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoTab(Int_t)");
4673ff03 227
228 fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
229
84aff7a4 230 TGCompositeFrame *tf = fTab->AddTab("One TEveTrack/Jet");
4673ff03 231
232 // fF1 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
233 // fF1->AddFrame(new TGTextButton(fF1, "&Test button", 0), fL3);
234 // fF1->AddFrame(fTxt1 = new TGTextEntry(fF1, new TGTextBuffer(100)), fL3);
235 // fF1->AddFrame(fTxt2 = new TGTextEntry(fF1, new TGTextBuffer(100)), fL3);
236 // tf->AddFrame(fF1, fL3);
237 // fTxt1->Resize(150, fTxt1->GetDefaultHeight());
238 // fTxt2->Resize(150, fTxt2->GetDefaultHeight());
239 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2);
240 fF2 = new TGCompositeFrame(tf, 60, 60, kVerticalFrame);
241 fF2->AddFrame(fChk1 = new TGCheckButton(fF2, "4-Momentum: {pt, px, py, pz} "), fL1);
242 fF2->AddFrame(fChk2 = new TGCheckButton(fF2, "4-Momentum: {pt, Phi, Theta}"), fL1);
243 fF2->AddFrame(fChk3 = new TGCheckButton(fF2, "Pseudorapidity: Eta"), fL1);
244 fF2->AddFrame(fChk4 = new TGCheckButton(fF2, "Energy: E"), fL1);
245 fF2->AddFrame(fChk5 = new TGCheckButton(fF2, "Charge and Mass"), fL1);
246
247 tf = fTab->AddTab("Two Tracks/Jets");
248
249 tf->AddFrame(fF2, fL3);
250
251 // fBtn1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
252 // fBtn2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
253 // fChk1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
254 // fChk2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
255 // fRad1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
256 // fRad2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
257
258
9af86b69 259 fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 2, 2, 5, 1);
4673ff03 260 AddFrame(fTab, fL5);
261
262 MapSubwindows();
263 Resize();
264
84aff7a4 265 SetWindowName("TEveTrack/Jet Common Setup");
4673ff03 266}
267
d810d0de 268AliEveJetPlaneEditor::StaticDataWindow::~StaticDataWindow()
4673ff03 269{
a97abca8 270 // Destructor, deletes the window.
271
4673ff03 272 DeleteWindow();
273}
274
d810d0de 275void AliEveJetPlaneEditor::StaticDataWindow::DoClose()
4673ff03 276{
a97abca8 277 // Close the window.
278
4673ff03 279 UnmapWindow();
280}
281
d810d0de 282void AliEveJetPlaneEditor::StaticDataWindow::DoOK()
4673ff03 283{
d810d0de 284 // Read data from widgets, copy to static members of AliEveJetPlane
4673ff03 285
286 SendCloseMessage();
287}
288
d810d0de 289void AliEveJetPlaneEditor::StaticDataWindow::DoCancel()
4673ff03 290{
a97abca8 291 // Cancel, close the window.
292
4673ff03 293 SendCloseMessage();
294}
295
d810d0de 296void AliEveJetPlaneEditor::StaticDataWindow::DoTab(Int_t /*id*/)
4673ff03 297{
a97abca8 298 // Tab selected.
299
4673ff03 300 // printf("Tab item %d activated\n", id);
301}
302
303