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),
42 fOneSelection(0), fTwoSelection(0),
47 MakeTitle("AliEveJetPlane");
50 fRnrJets = new TGCheckButton(this, "Rnr Jets");
51 AddFrame(fRnrJets, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
52 fRnrJets->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrJets()");
54 fRnrTracks = new TGCheckButton(this, "Rnr Tracks");
55 AddFrame(fRnrTracks, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
56 fRnrTracks->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrTracks()");
58 fEnergyScale = new TEveGValuator(this, "Length scale:", 110, 0);
59 fEnergyScale->SetLabelWidth(labelW);
60 fEnergyScale->SetNELength(6);
61 fEnergyScale->Build();
62 fEnergyScale->SetLimits(1, 200, 200, TGNumberFormat::kNESRealOne);
63 fEnergyScale->SetToolTip("Energy mapped to length of arrow.");
64 fEnergyScale->Connect("ValueSet(Double_t)", "AliEveJetPlaneEditor", this, "DoEnergyScale()");
65 AddFrame(fEnergyScale, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
67 fArrowJetScale = new TEveGValuator(this, "Jet scale:", 110, 0);
68 fArrowJetScale->SetLabelWidth(labelW);
69 fArrowJetScale->SetNELength(6);
70 fArrowJetScale->Build();
71 fArrowJetScale->SetLimits(0.1, 3, 100, TGNumberFormat::kNESRealOne);
72 fArrowJetScale->SetToolTip("Scale for jet arrow dimensions.");
73 fArrowJetScale->Connect("ValueSet(Double_t)", "AliEveJetPlaneEditor", this, "DoArrowJetScale()");
74 AddFrame(fArrowJetScale, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
76 fArrowTrackScale = new TEveGValuator(this, "Track scale:", 110, 0);
77 fArrowTrackScale->SetLabelWidth(labelW);
78 fArrowTrackScale->SetNELength(6);
79 fArrowTrackScale->Build();
80 fArrowTrackScale->SetLimits(0.1, 3, 100, TGNumberFormat::kNESRealOne);
81 fArrowTrackScale->SetToolTip("Scale for track arrow dimensions.");
82 fArrowTrackScale->Connect("ValueSet(Double_t)", "AliEveJetPlaneEditor", this, "DoArrowTrackScale()");
83 AddFrame(fArrowTrackScale, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
85 fOneSelection = new TGRadioButton(this, "&One AliEveTrack/Jet");
86 fTwoSelection = new TGRadioButton(this, "&Two AliEveTrack/Jet");
87 AddFrame(fOneSelection, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
88 AddFrame(fTwoSelection, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
89 fOneSelection->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoOneSelection()");
90 fTwoSelection->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoTwoSelection()");
92 // fInformationSetup = new TGTextButton(this, "AliEveTrack/Jet Print");
93 // AddFrame(fInformationSetup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 0, 2, 2));
94 // fInformationSetup->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoStaticDataWindow()");
97 /******************************************************************************/
99 void AliEveJetPlaneEditor::SetModel(TObject* obj)
103 fM = static_cast<AliEveJetPlane*>(obj);
105 // Set values of widgets
106 // fXYZZ->SetValue(fM->GetXYZZ());
107 fRnrJets->SetState(fM->GetRnrJets() ? kButtonDown : kButtonUp);
108 fRnrTracks->SetState(fM->GetRnrTracks() ? kButtonDown : kButtonUp);
109 fEnergyScale->SetValue(fM->GetEnergyScale());
110 fArrowJetScale->SetValue(fM->GetArrowJetScale());
111 fArrowTrackScale->SetValue(fM->GetArrowTrackScale());
112 fOneSelection->SetState(fM->GetOneSelection() ? kButtonDown : kButtonUp);
113 fTwoSelection->SetState(fM->GetTwoSelection() ? kButtonDown : kButtonUp);
116 /******************************************************************************/
118 void AliEveJetPlaneEditor::DoRnrJets()
122 fM->SetRnrJets(fRnrJets->IsOn());
126 void AliEveJetPlaneEditor::DoRnrTracks()
128 // Slot for RnrTracks.
130 fM->SetRnrTracks(fRnrTracks->IsOn());
134 void AliEveJetPlaneEditor::DoArrowJetScale()
136 // Slot for JetScale.
138 fM->SetArrowJetScale(fArrowJetScale->GetValue());
142 void AliEveJetPlaneEditor::DoArrowTrackScale()
144 // Slot for TrackScale.
146 fM->SetArrowTrackScale(fArrowTrackScale->GetValue());
150 void AliEveJetPlaneEditor::DoEnergyScale()
152 // Slot for EnergyScale.
154 fM->SetEnergyScale(fEnergyScale->GetValue());
158 void AliEveJetPlaneEditor::DoOneSelection()
160 // Slot for OneSelection.
162 fTwoSelection->SetState(kButtonUp);
163 fM->SetOneSelection(fOneSelection->IsOn());
164 fM->SetTwoSelection(fTwoSelection->IsOn());
168 void AliEveJetPlaneEditor::DoTwoSelection()
170 // Slot for TwoSelection.
172 fOneSelection->SetState(kButtonUp);
173 fM->SetOneSelection(fOneSelection->IsOn());
174 fM->SetTwoSelection(fTwoSelection->IsOn());
178 void AliEveJetPlaneEditor::DoStaticDataWindow()
180 // Slot for StaticDataWindow.
182 printf("\n Soon available ... \n");
183 if (fgStaticWindow == 0)
184 fgStaticWindow = new StaticDataWindow(gClient->GetRoot(), this, 400, 200);
186 // call fgStaticWindow->ReadValues(); // like setmodel
188 // position relative to the parent's window
189 fgStaticWindow->MapWindow();
190 fgStaticWindow->RaiseWindow();
191 fgStaticWindow->CenterOnParent();
195 //==============================================================================
196 //==============================================================================
197 // AliEveJetPlaneEditor::StaticDataWindow
198 //==============================================================================
200 //______________________________________________________________________________
202 // Common settings for all AliEveJetPlane objects.
203 // Used as a pop-up from AliEveJetPlaneEditor.
205 ClassImp(AliEveJetPlaneEditor::StaticDataWindow)
207 AliEveJetPlaneEditor::StaticDataWindow::StaticDataWindow(const TGWindow *p, const TGWindow *main,
208 UInt_t w, UInt_t h, UInt_t options) :
209 TGTransientFrame(p, main, w, h, options),
211 fOkButton(0), fCancelButton(0),
212 fL1(0), fL2(0), fL3(0), fL5(0),
214 fChk1(0), fChk2(0), fChk3(0), fChk4(0), fChk5(0)
217 // Create a dialog window. A dialog window pops up with respect to its
220 Connect("CloseWindow()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoClose()");
221 DontCallClose(); // to avoid double deletions.
223 // use hierarchical cleaning
224 SetCleanup(kDeepCleanup);
226 fFrame1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth);
228 fOkButton = new TGTextButton(fFrame1, "&Ok", 1);
229 fOkButton->Connect("Clicked()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoOK()");
230 fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2);
231 fCancelButton->Connect("Clicked()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoCancel()");
233 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,2, 2, 2, 2);
234 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1);
236 fFrame1->AddFrame(fOkButton, fL1);
237 fFrame1->AddFrame(fCancelButton, fL1);
239 fFrame1->Resize(150, fOkButton->GetDefaultHeight());
240 AddFrame(fFrame1, fL2);
242 // Tabs for one and two track information
244 fTab = new TGTab(this, 300, 300);
245 fTab->Connect("Selected(Int_t)", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoTab(Int_t)");
247 fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
249 TGCompositeFrame *tf = fTab->AddTab("One AliEveTrack/Jet");
251 // fF1 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
252 // fF1->AddFrame(new TGTextButton(fF1, "&Test button", 0), fL3);
253 // fF1->AddFrame(fTxt1 = new TGTextEntry(fF1, new TGTextBuffer(100)), fL3);
254 // fF1->AddFrame(fTxt2 = new TGTextEntry(fF1, new TGTextBuffer(100)), fL3);
255 // tf->AddFrame(fF1, fL3);
256 // fTxt1->Resize(150, fTxt1->GetDefaultHeight());
257 // fTxt2->Resize(150, fTxt2->GetDefaultHeight());
258 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2);
259 fF2 = new TGCompositeFrame(tf, 60, 60, kVerticalFrame);
260 fF2->AddFrame(fChk1 = new TGCheckButton(fF2, "4-Momentum: {pt, px, py, pz} "), fL1);
261 fF2->AddFrame(fChk2 = new TGCheckButton(fF2, "4-Momentum: {pt, Phi, Theta}"), fL1);
262 fF2->AddFrame(fChk3 = new TGCheckButton(fF2, "Pseudorapidity: Eta"), fL1);
263 fF2->AddFrame(fChk4 = new TGCheckButton(fF2, "Energy: E"), fL1);
264 fF2->AddFrame(fChk5 = new TGCheckButton(fF2, "Charge and Mass"), fL1);
266 tf = fTab->AddTab("Two Tracks/Jets");
268 tf->AddFrame(fF2, fL3);
270 // fBtn1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
271 // fBtn2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
272 // fChk1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
273 // fChk2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
274 // fRad1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
275 // fRad2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
278 fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 2, 2, 5, 1);
284 SetWindowName("AliEveTrack/Jet Common Setup");
287 AliEveJetPlaneEditor::StaticDataWindow::~StaticDataWindow()
289 // Destructor, deletes the window.
294 void AliEveJetPlaneEditor::StaticDataWindow::DoClose()
301 void AliEveJetPlaneEditor::StaticDataWindow::DoOK()
303 // Read data from widgets, copy to static members of AliEveJetPlane
308 void AliEveJetPlaneEditor::StaticDataWindow::DoCancel()
310 // Cancel, close the window.
315 void AliEveJetPlaneEditor::StaticDataWindow::DoTab(Int_t /*id*/)
319 // printf("Tab item %d activated\n", id);