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