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