2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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 **************************************************************************/
10 #include "AliEveJetPlaneEditor.h"
11 #include "AliEveJetPlane.h"
13 #include <TEveGValuators.h>
16 #include <TGNumberEntry.h>
20 //==============================================================================
21 //==============================================================================
22 // AliEveJetPlaneEditor
23 //==============================================================================
25 //______________________________________________________________________________
27 // GUI editor for AliEveJetPlane class.
29 AliEveJetPlaneEditor::StaticDataWindow* AliEveJetPlaneEditor::fgStaticWindow = 0;
31 ClassImp(AliEveJetPlaneEditor)
33 AliEveJetPlaneEditor::AliEveJetPlaneEditor(const TGWindow *p, Int_t width, Int_t height,
34 UInt_t options, Pixel_t back) :
35 TGedFrame(p, width, height, options | kVerticalFrame, back),
41 fOneSelection(0), fTwoSelection(0),
46 MakeTitle("AliEveJetPlane");
49 fRnrJets = new TGCheckButton(this, "Rnr Jets");
50 AddFrame(fRnrJets, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
51 fRnrJets->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrJets()");
53 fRnrTracks = new TGCheckButton(this, "Rnr Tracks");
54 AddFrame(fRnrTracks, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
55 fRnrTracks->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrTracks()");
57 fEnergyScale = new TEveGValuator(this, "Length scale:", 110, 0);
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.");
63 fEnergyScale->Connect("ValueSet(Double_t)", "AliEveJetPlaneEditor", this, "DoEnergyScale()");
64 AddFrame(fEnergyScale, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
66 fEnergyColorScale = new TEveGValuator(this, "Color scale:", 110, 0);
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.");
72 fEnergyColorScale->Connect("ValueSet(Double_t)", "AliEveJetPlaneEditor", this, "DoEnergyColorScale()");
73 AddFrame(fEnergyColorScale, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
75 fOneSelection = new TGRadioButton(this, "&One TEveTrack/Jet");
76 fTwoSelection = new TGRadioButton(this, "&Two TEveTrack/Jet");
77 AddFrame(fOneSelection, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
78 AddFrame(fTwoSelection, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
79 fOneSelection->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoOneSelection()");
80 fTwoSelection->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoTwoSelection()");
82 // fInformationSetup = new TGTextButton(this, "TEveTrack/Jet Print");
83 // AddFrame(fInformationSetup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 0, 2, 2));
84 // fInformationSetup->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoStaticDataWindow()");
87 /******************************************************************************/
89 void AliEveJetPlaneEditor::SetModel(TObject* obj)
93 fM = dynamic_cast<AliEveJetPlane*>(obj);
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);
105 /******************************************************************************/
107 void AliEveJetPlaneEditor::DoRnrJets()
111 fM->SetRnrJets(fRnrJets->IsOn());
115 void AliEveJetPlaneEditor::DoRnrTracks()
117 // Slot for RnrTracks.
119 fM->SetRnrTracks(fRnrTracks->IsOn());
123 void AliEveJetPlaneEditor::DoEnergyColorScale()
125 // Slot for EnergyColorScale.
127 fM->SetEnergyColorScale(fEnergyColorScale->GetValue());
131 void AliEveJetPlaneEditor::DoEnergyScale()
133 // Slot for EnergyScale.
135 fM->SetEnergyScale(fEnergyScale->GetValue());
139 void AliEveJetPlaneEditor::DoOneSelection()
141 // Slot for OneSelection.
143 fTwoSelection->SetState(kButtonUp);
144 fM->SetOneSelection(fOneSelection->IsOn());
145 fM->SetTwoSelection(fTwoSelection->IsOn());
149 void AliEveJetPlaneEditor::DoTwoSelection()
151 // Slot for TwoSelection.
153 fOneSelection->SetState(kButtonUp);
154 fM->SetOneSelection(fOneSelection->IsOn());
155 fM->SetTwoSelection(fTwoSelection->IsOn());
159 void AliEveJetPlaneEditor::DoStaticDataWindow()
161 // Slot for StaticDataWindow.
163 printf("\n Soon available ... \n");
164 if (fgStaticWindow == 0)
165 fgStaticWindow = new StaticDataWindow(gClient->GetRoot(), this, 400, 200);
167 // call fgStaticWindow->ReadValues(); // like setmodel
169 // position relative to the parent's window
170 fgStaticWindow->MapWindow();
171 fgStaticWindow->RaiseWindow();
172 fgStaticWindow->CenterOnParent();
176 //==============================================================================
177 //==============================================================================
178 // AliEveJetPlaneEditor::StaticDataWindow
179 //==============================================================================
181 //______________________________________________________________________________
183 // Common settings for all AliEveJetPlane objects.
184 // Used as a pop-up from AliEveJetPlaneEditor.
186 ClassImp(AliEveJetPlaneEditor::StaticDataWindow)
188 AliEveJetPlaneEditor::StaticDataWindow::StaticDataWindow(const TGWindow *p, const TGWindow *main,
189 UInt_t w, UInt_t h, UInt_t options) :
190 TGTransientFrame(p, main, w, h, options),
192 fOkButton(0), fCancelButton(0),
193 fL1(0), fL2(0), fL3(0), fL5(0),
195 fChk1(0), fChk2(0), fChk3(0), fChk4(0), fChk5(0)
198 // Create a dialog window. A dialog window pops up with respect to its
201 Connect("CloseWindow()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoClose()");
202 DontCallClose(); // to avoid double deletions.
204 // use hierarchical cleaning
205 SetCleanup(kDeepCleanup);
207 fFrame1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth);
209 fOkButton = new TGTextButton(fFrame1, "&Ok", 1);
210 fOkButton->Connect("Clicked()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoOK()");
211 fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2);
212 fCancelButton->Connect("Clicked()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoCancel()");
214 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,2, 2, 2, 2);
215 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1);
217 fFrame1->AddFrame(fOkButton, fL1);
218 fFrame1->AddFrame(fCancelButton, fL1);
220 fFrame1->Resize(150, fOkButton->GetDefaultHeight());
221 AddFrame(fFrame1, fL2);
223 // Tabs for one and two track information
225 fTab = new TGTab(this, 300, 300);
226 fTab->Connect("Selected(Int_t)", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoTab(Int_t)");
228 fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
230 TGCompositeFrame *tf = fTab->AddTab("One TEveTrack/Jet");
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);
247 tf = fTab->AddTab("Two Tracks/Jets");
249 tf->AddFrame(fF2, fL3);
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()");
259 TGLayoutHints *fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
260 kLHintsExpandY, 2, 2, 5, 1);
266 SetWindowName("TEveTrack/Jet Common Setup");
269 AliEveJetPlaneEditor::StaticDataWindow::~StaticDataWindow()
271 // Destructor, deletes the window.
276 void AliEveJetPlaneEditor::StaticDataWindow::DoClose()
283 void AliEveJetPlaneEditor::StaticDataWindow::DoOK()
285 // Read data from widgets, copy to static members of AliEveJetPlane
290 void AliEveJetPlaneEditor::StaticDataWindow::DoCancel()
292 // Cancel, close the window.
297 void AliEveJetPlaneEditor::StaticDataWindow::DoTab(Int_t /*id*/)
301 // printf("Tab item %d activated\n", id);