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