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