]>
Commit | Line | Data |
---|---|---|
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 | |
4673ff03 | 15 | #include <TGButton.h> |
16 | #include <TGNumberEntry.h> | |
4673ff03 | 17 | #include <TGFrame.h> |
18 | #include <TGTab.h> | |
d810d0de | 19 | |
a15e6d7d | 20 | //============================================================================== |
21 | //============================================================================== | |
22 | // AliEveJetPlaneEditor | |
23 | //============================================================================== | |
4673ff03 | 24 | |
57ffa5fb | 25 | //______________________________________________________________________________ |
4673ff03 | 26 | // |
a15e6d7d | 27 | // GUI editor for AliEveJetPlane class. |
4673ff03 | 28 | |
d810d0de | 29 | AliEveJetPlaneEditor::StaticDataWindow* AliEveJetPlaneEditor::fgStaticWindow = 0; |
4673ff03 | 30 | |
d810d0de | 31 | ClassImp(AliEveJetPlaneEditor) |
4673ff03 | 32 | |
d810d0de | 33 | AliEveJetPlaneEditor::AliEveJetPlaneEditor(const TGWindow *p, Int_t width, Int_t height, |
4673ff03 | 34 | UInt_t options, Pixel_t back) : |
35 | TGedFrame(p, width, height, options | kVerticalFrame, back), | |
36 | fM(0), | |
37 | fRnrJets(0), | |
38 | fRnrTracks(0), | |
39 | fEnergyScale(0), | |
361f01a5 | 40 | fArrowJetScale(0), |
41 | fArrowTrackScale(0), | |
a97abca8 | 42 | fOneSelection(0), fTwoSelection(0), |
4673ff03 | 43 | fInformationSetup(0) |
4673ff03 | 44 | { |
a97abca8 | 45 | // Constructor. |
46 | ||
d810d0de | 47 | MakeTitle("AliEveJetPlane"); |
4673ff03 | 48 | Int_t labelW = 67; |
49 | ||
4673ff03 | 50 | fRnrJets = new TGCheckButton(this, "Rnr Jets"); |
51 | AddFrame(fRnrJets, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
d810d0de | 52 | fRnrJets->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrJets()"); |
4673ff03 | 53 | |
54 | fRnrTracks = new TGCheckButton(this, "Rnr Tracks"); | |
55 | AddFrame(fRnrTracks, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
d810d0de | 56 | fRnrTracks->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrTracks()"); |
4673ff03 | 57 | |
84aff7a4 | 58 | fEnergyScale = new TEveGValuator(this, "Length scale:", 110, 0); |
4673ff03 | 59 | fEnergyScale->SetLabelWidth(labelW); |
60 | fEnergyScale->SetNELength(6); | |
61 | fEnergyScale->Build(); | |
9b6216c0 | 62 | fEnergyScale->SetLimits(1, 200, 200, TGNumberFormat::kNESRealOne); |
4673ff03 | 63 | fEnergyScale->SetToolTip("Energy mapped to length of arrow."); |
d810d0de | 64 | fEnergyScale->Connect("ValueSet(Double_t)", "AliEveJetPlaneEditor", this, "DoEnergyScale()"); |
4673ff03 | 65 | AddFrame(fEnergyScale, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); |
66 | ||
361f01a5 | 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)); | |
75 | ||
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)); | |
84 | ||
85 | fOneSelection = new TGRadioButton(this, "&One AliEveTrack/Jet"); | |
0e33c639 | 86 | fTwoSelection = new TGRadioButton(this, "&Two AliEveTrack/Jet"); |
4673ff03 | 87 | AddFrame(fOneSelection, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); |
88 | AddFrame(fTwoSelection, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
d810d0de | 89 | fOneSelection->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoOneSelection()"); |
90 | fTwoSelection->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoTwoSelection()"); | |
4673ff03 | 91 | |
0e33c639 | 92 | // fInformationSetup = new TGTextButton(this, "AliEveTrack/Jet Print"); |
4673ff03 | 93 | // AddFrame(fInformationSetup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 0, 2, 2)); |
d810d0de | 94 | // fInformationSetup->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoStaticDataWindow()"); |
4673ff03 | 95 | } |
96 | ||
57ffa5fb | 97 | /******************************************************************************/ |
4673ff03 | 98 | |
d810d0de | 99 | void AliEveJetPlaneEditor::SetModel(TObject* obj) |
4673ff03 | 100 | { |
a97abca8 | 101 | // Set model object. |
102 | ||
d810d0de | 103 | fM = dynamic_cast<AliEveJetPlane*>(obj); |
4673ff03 | 104 | |
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()); | |
361f01a5 | 110 | fArrowJetScale->SetValue(fM->GetArrowJetScale()); |
111 | fArrowTrackScale->SetValue(fM->GetArrowTrackScale()); | |
112 | fOneSelection->SetState(fM->GetOneSelection() ? kButtonDown : kButtonUp); | |
4673ff03 | 113 | fTwoSelection->SetState(fM->GetTwoSelection() ? kButtonDown : kButtonUp); |
114 | } | |
115 | ||
57ffa5fb | 116 | /******************************************************************************/ |
4673ff03 | 117 | |
d810d0de | 118 | void AliEveJetPlaneEditor::DoRnrJets() |
4673ff03 | 119 | { |
a97abca8 | 120 | // Slot for RnrJets. |
121 | ||
4673ff03 | 122 | fM->SetRnrJets(fRnrJets->IsOn()); |
123 | Update(); | |
124 | } | |
125 | ||
d810d0de | 126 | void AliEveJetPlaneEditor::DoRnrTracks() |
4673ff03 | 127 | { |
a97abca8 | 128 | // Slot for RnrTracks. |
129 | ||
4673ff03 | 130 | fM->SetRnrTracks(fRnrTracks->IsOn()); |
131 | Update(); | |
132 | } | |
133 | ||
361f01a5 | 134 | void AliEveJetPlaneEditor::DoArrowJetScale() |
135 | { | |
136 | // Slot for JetScale. | |
137 | ||
138 | fM->SetArrowJetScale(fArrowJetScale->GetValue()); | |
139 | Update(); | |
140 | } | |
141 | ||
142 | void AliEveJetPlaneEditor::DoArrowTrackScale() | |
4673ff03 | 143 | { |
361f01a5 | 144 | // Slot for TrackScale. |
a97abca8 | 145 | |
361f01a5 | 146 | fM->SetArrowTrackScale(fArrowTrackScale->GetValue()); |
4673ff03 | 147 | Update(); |
148 | } | |
149 | ||
d810d0de | 150 | void AliEveJetPlaneEditor::DoEnergyScale() |
4673ff03 | 151 | { |
a97abca8 | 152 | // Slot for EnergyScale. |
153 | ||
4673ff03 | 154 | fM->SetEnergyScale(fEnergyScale->GetValue()); |
155 | Update(); | |
156 | } | |
157 | ||
d810d0de | 158 | void AliEveJetPlaneEditor::DoOneSelection() |
4673ff03 | 159 | { |
a97abca8 | 160 | // Slot for OneSelection. |
161 | ||
4673ff03 | 162 | fTwoSelection->SetState(kButtonUp); |
163 | fM->SetOneSelection(fOneSelection->IsOn()); | |
164 | fM->SetTwoSelection(fTwoSelection->IsOn()); | |
165 | Update(); | |
166 | } | |
167 | ||
d810d0de | 168 | void AliEveJetPlaneEditor::DoTwoSelection() |
4673ff03 | 169 | { |
a97abca8 | 170 | // Slot for TwoSelection. |
171 | ||
4673ff03 | 172 | fOneSelection->SetState(kButtonUp); |
173 | fM->SetOneSelection(fOneSelection->IsOn()); | |
174 | fM->SetTwoSelection(fTwoSelection->IsOn()); | |
175 | Update(); | |
176 | } | |
177 | ||
d810d0de | 178 | void AliEveJetPlaneEditor::DoStaticDataWindow() |
51346b82 | 179 | { |
a97abca8 | 180 | // Slot for StaticDataWindow. |
181 | ||
4673ff03 | 182 | printf("\n Soon available ... \n"); |
183 | if (fgStaticWindow == 0) | |
184 | fgStaticWindow = new StaticDataWindow(gClient->GetRoot(), this, 400, 200); | |
185 | ||
186 | // call fgStaticWindow->ReadValues(); // like setmodel | |
187 | ||
188 | // position relative to the parent's window | |
189 | fgStaticWindow->MapWindow(); | |
190 | fgStaticWindow->RaiseWindow(); | |
191 | fgStaticWindow->CenterOnParent(); | |
192 | } | |
193 | ||
a97abca8 | 194 | |
a15e6d7d | 195 | //============================================================================== |
196 | //============================================================================== | |
197 | // AliEveJetPlaneEditor::StaticDataWindow | |
198 | //============================================================================== | |
4673ff03 | 199 | |
a97abca8 | 200 | //______________________________________________________________________________ |
201 | // | |
202 | // Common settings for all AliEveJetPlane objects. | |
a15e6d7d | 203 | // Used as a pop-up from AliEveJetPlaneEditor. |
a97abca8 | 204 | |
d810d0de | 205 | ClassImp(AliEveJetPlaneEditor::StaticDataWindow) |
4673ff03 | 206 | |
d810d0de | 207 | AliEveJetPlaneEditor::StaticDataWindow::StaticDataWindow(const TGWindow *p, const TGWindow *main, |
a97abca8 | 208 | UInt_t w, UInt_t h, UInt_t options) : |
4673ff03 | 209 | TGTransientFrame(p, main, w, h, options), |
fd31e9de | 210 | fFrame1(0), fF2(0), |
211 | fOkButton(0), fCancelButton(0), | |
212 | fL1(0), fL2(0), fL3(0), fL5(0), | |
4673ff03 | 213 | fTab(0), |
fd31e9de | 214 | fChk1(0), fChk2(0), fChk3(0), fChk4(0), fChk5(0) |
4673ff03 | 215 | { |
a97abca8 | 216 | // Constructor. |
4673ff03 | 217 | // Create a dialog window. A dialog window pops up with respect to its |
218 | // "main" window. | |
219 | ||
d810d0de | 220 | Connect("CloseWindow()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoClose()"); |
4673ff03 | 221 | DontCallClose(); // to avoid double deletions. |
222 | ||
223 | // use hierarchical cleaning | |
224 | SetCleanup(kDeepCleanup); | |
225 | ||
226 | fFrame1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth); | |
227 | ||
228 | fOkButton = new TGTextButton(fFrame1, "&Ok", 1); | |
d810d0de | 229 | fOkButton->Connect("Clicked()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoOK()"); |
4673ff03 | 230 | fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2); |
d810d0de | 231 | fCancelButton->Connect("Clicked()", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoCancel()"); |
4673ff03 | 232 | |
233 | fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,2, 2, 2, 2); | |
234 | fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1); | |
235 | ||
236 | fFrame1->AddFrame(fOkButton, fL1); | |
237 | fFrame1->AddFrame(fCancelButton, fL1); | |
238 | ||
239 | fFrame1->Resize(150, fOkButton->GetDefaultHeight()); | |
240 | AddFrame(fFrame1, fL2); | |
241 | ||
242 | // Tabs for one and two track information | |
243 | ||
244 | fTab = new TGTab(this, 300, 300); | |
d810d0de | 245 | fTab->Connect("Selected(Int_t)", "AliEveJetPlaneEditor::StaticDataWindow", this, "DoTab(Int_t)"); |
4673ff03 | 246 | |
247 | fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5); | |
248 | ||
0e33c639 | 249 | TGCompositeFrame *tf = fTab->AddTab("One AliEveTrack/Jet"); |
4673ff03 | 250 | |
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); | |
265 | ||
266 | tf = fTab->AddTab("Two Tracks/Jets"); | |
267 | ||
268 | tf->AddFrame(fF2, fL3); | |
269 | ||
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()"); | |
276 | ||
277 | ||
9af86b69 | 278 | fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 2, 2, 5, 1); |
4673ff03 | 279 | AddFrame(fTab, fL5); |
280 | ||
281 | MapSubwindows(); | |
282 | Resize(); | |
283 | ||
0e33c639 | 284 | SetWindowName("AliEveTrack/Jet Common Setup"); |
4673ff03 | 285 | } |
286 | ||
d810d0de | 287 | AliEveJetPlaneEditor::StaticDataWindow::~StaticDataWindow() |
4673ff03 | 288 | { |
a97abca8 | 289 | // Destructor, deletes the window. |
290 | ||
4673ff03 | 291 | DeleteWindow(); |
292 | } | |
293 | ||
d810d0de | 294 | void AliEveJetPlaneEditor::StaticDataWindow::DoClose() |
4673ff03 | 295 | { |
a97abca8 | 296 | // Close the window. |
297 | ||
4673ff03 | 298 | UnmapWindow(); |
299 | } | |
300 | ||
d810d0de | 301 | void AliEveJetPlaneEditor::StaticDataWindow::DoOK() |
4673ff03 | 302 | { |
d810d0de | 303 | // Read data from widgets, copy to static members of AliEveJetPlane |
4673ff03 | 304 | |
305 | SendCloseMessage(); | |
306 | } | |
307 | ||
d810d0de | 308 | void AliEveJetPlaneEditor::StaticDataWindow::DoCancel() |
4673ff03 | 309 | { |
a97abca8 | 310 | // Cancel, close the window. |
311 | ||
4673ff03 | 312 | SendCloseMessage(); |
313 | } | |
314 | ||
d810d0de | 315 | void AliEveJetPlaneEditor::StaticDataWindow::DoTab(Int_t /*id*/) |
4673ff03 | 316 | { |
a97abca8 | 317 | // Tab selected. |
318 | ||
4673ff03 | 319 | // printf("Tab item %d activated\n", id); |
320 | } | |
321 | ||
322 |