]>
Commit | Line | Data |
---|---|---|
3d94b490 | 1 | // $Id$ |
2 | // Author: Stefano Carrazza 2010 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
9 | ||
10 | #include "AliEveLegoEditor.h" | |
11 | #include "AliEveLego.h" | |
12 | ||
13 | #include "TVirtualPad.h" | |
14 | #include "TColor.h" | |
15 | ||
16 | #include "TGLabel.h" | |
17 | #include "TGButton.h" | |
18 | #include "TGNumberEntry.h" | |
19 | #include "TGColorSelect.h" | |
20 | #include "TGDoubleSlider.h" | |
21 | #include "TGButtonGroup.h" | |
22 | #include "TGString.h" | |
23 | #include "TGComboBox.h" | |
24 | #include "TGFrame.h" | |
25 | ||
26 | //______________________________________________________________________________ | |
27 | // GUI editor for AliEveLego. | |
28 | // | |
29 | ||
30 | ClassImp(AliEveLegoEditor) | |
31 | ||
32 | //______________________________________________________________________________ | |
33 | AliEveLegoEditor::AliEveLegoEditor(const TGWindow *p, Int_t width, Int_t height, | |
34 | UInt_t options, Pixel_t back) : | |
35 | TGedFrame(p, width, height, options | kVerticalFrame, back), | |
36 | fM(0), | |
37 | ||
38 | fAllEventsButton(0), | |
39 | fParticlesBG(0), | |
40 | fTrackSelection(0), | |
41 | fEventSelection(0), | |
42 | fRevents(0), | |
43 | fLabel(0), | |
44 | fLabel1(0), | |
45 | fThreshold(0), | |
46 | fMaxPt(0), | |
47 | fSelect(0), | |
48 | fButtonPrev(0), | |
49 | fButtonNext(0), | |
50 | ||
51 | fParticlesBGAE(0), | |
52 | fTrackSelectionAE(0), | |
53 | fEventSelectionAE(0), | |
54 | fReventsAE(0), | |
55 | fLabelAE(0), | |
56 | fLabel1AE(0), | |
57 | fThresholdAE(0), | |
58 | fMaxPtAE(0), | |
59 | fSelectAE(0), | |
60 | fButtonPrevAE(0), | |
61 | fButtonNextAE(0) | |
62 | { | |
63 | // Constructor. | |
64 | MakeTitle("AliEveLego"); | |
65 | ||
66 | // Create widgets | |
67 | fAllEventsButton = new TGTextButton(this, "Create lego of all events"); | |
68 | AddFrame(fAllEventsButton, new TGLayoutHints(kLHintsExpandX)); | |
69 | fAllEventsButton->Connect("Clicked()", "AliEveLegoEditor", this, "DoAllEvents()"); | |
70 | ||
71 | fParticlesBG = new TGButtonGroup(this, "Charge selection:", kVerticalFrame); | |
72 | fRcharge[0] = new TGRadioButton(fParticlesBG, new TGHotString("&Positive and negative")); | |
73 | fRcharge[1] = new TGRadioButton(fParticlesBG, new TGHotString("&Only positive")); | |
74 | fRcharge[2] = new TGRadioButton(fParticlesBG, new TGHotString("&Only negative")); | |
75 | fRcharge[0]->SetState(kButtonDown); | |
76 | AddFrame(fParticlesBG, new TGLayoutHints(kLHintsExpandX)); | |
77 | fParticlesBG->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByCharge(Int_t)"); | |
78 | ||
79 | fTrackSelection = new TGButtonGroup(this, "Track selection:", kHorizontalFrame); | |
80 | fRtracks[0] = new TGRadioButton(fTrackSelection, new TGHotString("&All tracks ")); | |
81 | fRtracks[1] = new TGRadioButton(fTrackSelection, new TGHotString("&Primary tracks")); | |
82 | fRtracks[0]->SetState(kButtonDown); | |
83 | AddFrame(fTrackSelection, new TGLayoutHints(kLHintsExpandX)); | |
84 | fTrackSelection->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByTracks(Int_t)"); | |
85 | ||
86 | //************** | |
87 | ||
88 | TGHorizontalFrame *horz = new TGHorizontalFrame(this); | |
89 | AddFrame(horz, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY)); | |
90 | fLabel = new TGLabel(horz, "Tracks maximum Pt (GeV): "); | |
91 | horz->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY)); | |
92 | ||
93 | fMaxPt = new TGNumberEntry(horz, 10000, 7, -1, | |
94 | TGNumberFormat::kNESRealOne, | |
95 | TGNumberFormat::kNEANonNegative, | |
96 | TGNumberFormat::kNELLimitMinMax, | |
97 | 0, 10000); | |
98 | ||
99 | fMaxPt->Connect("ValueSet(Long_t)", "AliEveLegoEditor", this, "SetMaxPt()"); | |
100 | ||
101 | horz->AddFrame( fMaxPt, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY)); | |
102 | ||
103 | TGHorizontalFrame *horz1 = new TGHorizontalFrame(this); | |
104 | AddFrame(horz1, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY)); | |
105 | fLabel1 = new TGLabel(horz1, "Tracks threshold (GeV): "); | |
106 | horz1->AddFrame(fLabel1, new TGLayoutHints(kLHintsLeft | kLHintsCenterY)); | |
107 | ||
108 | fThreshold = new TGNumberEntry(horz1, 0, 7, -1, | |
109 | TGNumberFormat::kNESRealOne, | |
110 | TGNumberFormat::kNEANonNegative, | |
111 | TGNumberFormat::kNELLimitMinMax, | |
112 | 0, 10000); | |
113 | ||
114 | fThreshold->Connect("ValueSet(Long_t)", "AliEveLegoEditor", this, "SetThreshold()"); | |
115 | horz1->AddFrame( fThreshold, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY)); | |
116 | ||
117 | ||
118 | ||
119 | //*************** | |
120 | ||
121 | // Events selection | |
122 | fEventSelection = new TGGroupFrame(this, "Event selection:", kHorizontalFrame); | |
123 | ||
124 | fRevents = new TGCheckButton(fEventSelection, new TGHotString("&Show info ")); | |
125 | fRevents->SetState(kButtonUp); | |
126 | fRevents->Connect("Clicked()", "AliEveLegoEditor", this, "ShowEventSelection()"); | |
127 | fEventSelection->AddFrame(fRevents, new TGLayoutHints(kLHintsLeft | kLHintsTop)); | |
128 | ||
129 | fSelect = new TGComboBox(fEventSelection,-1,kHorizontalFrame | kSunkenFrame | kDoubleBorder | kOwnBackground); | |
130 | fSelect->AddEntry("All events",0); | |
131 | fSelect->AddEntry("Beam 1",1); | |
132 | fSelect->AddEntry("Beam 2",2); | |
133 | fSelect->AddEntry("Beams 1 & 2",3); | |
134 | fSelect->Resize(102,22); | |
135 | fSelect->Select(0); | |
136 | fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsRight | kLHintsExpandX)); | |
137 | ||
138 | fSelect->Connect("Selected(Int_t)", "AliEveLegoEditor", this, "SelectEventSelection(Int_t)"); | |
139 | ||
140 | AddFrame(fEventSelection, new TGLayoutHints(kLHintsExpandX)); | |
141 | ||
142 | //********** | |
143 | ||
144 | TGHorizontalFrame *horz3 = new TGHorizontalFrame(this); | |
145 | ||
146 | fButtonPrev = new TGTextButton(horz3, "Previous event"); | |
147 | horz3->AddFrame(fButtonPrev, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX)); | |
148 | fButtonPrev->Connect("Clicked()", "AliEveLegoEditor", this, "ShowPrevEvent()"); | |
149 | ||
150 | fButtonNext = new TGTextButton(horz3, "Next event"); | |
151 | horz3->AddFrame( fButtonNext, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsExpandX)); | |
152 | fButtonNext->Connect("Clicked()", "AliEveLegoEditor", this, "ShowNextEvent()"); | |
153 | ||
154 | AddFrame(horz3, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY)); | |
155 | ||
156 | //********** | |
157 | ||
158 | ||
159 | } | |
160 | ||
161 | /******************************************************************************/ | |
162 | ||
163 | //______________________________________________________________________________ | |
164 | void AliEveLegoEditor::SetModel(TObject* obj) | |
165 | { | |
166 | fM = dynamic_cast<AliEveLego*>(obj); | |
167 | } | |
168 | ||
169 | /******************************************************************************/ | |
170 | ||
171 | // Implements callback/slot methods | |
172 | ||
173 | //______________________________________________________________________________ | |
174 | // void AliEveLegoEditor::DoXYZZ() | |
175 | // { | |
176 | // // Slot for XYZZ. | |
177 | // | |
178 | // fM->SetXYZZ(fXYZZ->GetValue()); | |
179 | // Update(); | |
180 | // } | |
181 | ||
182 | //______________________________________________________________________________ | |
183 | void AliEveLegoEditor::DoAllEvents() | |
184 | { | |
185 | // Slot for XYZZ. | |
186 | fAllEventsButton->SetEnabled(kFALSE); | |
187 | CreateAllEventsEditor(); | |
188 | fM->LoadAllEvents(); | |
189 | ||
190 | } | |
191 | ||
192 | //______________________________________________________________________________ | |
193 | void AliEveLegoEditor::ShowByCharge(Int_t id) | |
194 | { | |
195 | fM->SetCharge(id); | |
196 | } | |
197 | ||
198 | //______________________________________________________________________________ | |
199 | void AliEveLegoEditor::ShowByChargeAE(Int_t id) | |
200 | { | |
201 | fM->SetAllEventsCharge(id); | |
202 | } | |
203 | ||
204 | //______________________________________________________________________________ | |
205 | void AliEveLegoEditor::SetMaxPt() | |
206 | { | |
207 | fM->SetMaxPt(fMaxPt->GetNumber()); | |
208 | } | |
209 | ||
210 | //______________________________________________________________________________ | |
211 | void AliEveLegoEditor::SetMaxPtAE() | |
212 | { | |
213 | fM->SetMaxPtAE(fMaxPtAE->GetNumber()); | |
214 | } | |
215 | ||
216 | //______________________________________________________________________________ | |
217 | void AliEveLegoEditor::SetThreshold() | |
218 | { | |
219 | fM->SetThreshold(fThreshold->GetNumber()); | |
220 | } | |
221 | ||
222 | //______________________________________________________________________________ | |
223 | void AliEveLegoEditor::SetThresholdAE() | |
224 | { | |
225 | fM->SetThresholdAE(fThresholdAE->GetNumber()); | |
226 | } | |
227 | ||
228 | //______________________________________________________________________________ | |
229 | void AliEveLegoEditor::ShowByTracks(Int_t id) | |
230 | { | |
231 | fM->SetTracks(id); | |
232 | } | |
233 | ||
234 | //______________________________________________________________________________ | |
235 | void AliEveLegoEditor::ShowByTracksAE(Int_t id) | |
236 | { | |
237 | fM->SetTracksAE(id); | |
238 | } | |
239 | ||
240 | //______________________________________________________________________________ | |
241 | void AliEveLegoEditor::ShowByEvents(Int_t id) | |
242 | { | |
243 | fM->SetEvents(id); | |
244 | } | |
245 | ||
246 | //______________________________________________________________________________ | |
247 | void AliEveLegoEditor::ShowEventSelection() | |
248 | { | |
249 | fM->SetEventSelection(); | |
250 | } | |
251 | ||
252 | //______________________________________________________________________________ | |
253 | void AliEveLegoEditor::SelectEventSelection(Int_t id) | |
254 | { | |
255 | fM->SelectEventSelection(id); | |
256 | } | |
257 | ||
258 | //______________________________________________________________________________ | |
259 | void AliEveLegoEditor::CreateAllEventsEditor() | |
260 | { | |
4171aa4e | 261 | // create the GUI of all events |
3d94b490 | 262 | TGVerticalFrame *this2 = this->CreateEditorTabSubFrame("All events style"); |
263 | ||
264 | TGLabel *ftitle = new TGLabel(this2, "AliLego all events ------"); | |
265 | this2->AddFrame(ftitle, new TGLayoutHints(kLHintsLeft | kLHintsCenterY)); | |
266 | ||
267 | fParticlesBGAE = new TGButtonGroup(this2, "Charge selection:", kVerticalFrame); | |
268 | fRchargeAE[0] = new TGRadioButton(fParticlesBGAE, new TGHotString("&Positive and negative")); | |
269 | fRchargeAE[1] = new TGRadioButton(fParticlesBGAE, new TGHotString("&Only positive")); | |
270 | fRchargeAE[2] = new TGRadioButton(fParticlesBGAE, new TGHotString("&Only negative")); | |
271 | fRchargeAE[0]->SetState(kButtonDown); | |
272 | this2->AddFrame(fParticlesBGAE, new TGLayoutHints(kLHintsExpandX)); | |
273 | ||
274 | fParticlesBGAE->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByChargeAE(Int_t)"); | |
275 | ||
276 | fTrackSelectionAE = new TGButtonGroup(this2, "Track selection:", kHorizontalFrame); | |
277 | fRtracksAE[0] = new TGRadioButton(fTrackSelectionAE, new TGHotString("&All tracks ")); | |
278 | fRtracksAE[1] = new TGRadioButton(fTrackSelectionAE, new TGHotString("&Primary tracks")); | |
279 | fRtracksAE[0]->SetState(kButtonDown); | |
280 | this2->AddFrame(fTrackSelectionAE, new TGLayoutHints(kLHintsExpandX)); | |
281 | fTrackSelectionAE->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByTracksAE(Int_t)"); | |
282 | ||
283 | //************** | |
284 | ||
285 | TGHorizontalFrame *horzAE = new TGHorizontalFrame(this2); | |
286 | ||
287 | fLabelAE = new TGLabel(horzAE, "Tracks maximum Pt (GeV): "); | |
288 | horzAE->AddFrame(fLabelAE, new TGLayoutHints(kLHintsLeft | kLHintsCenterY)); | |
289 | ||
290 | fMaxPtAE = new TGNumberEntry(horzAE, 10000, 7, -1, | |
291 | TGNumberFormat::kNESRealOne, | |
292 | TGNumberFormat::kNEANonNegative, | |
293 | TGNumberFormat::kNELLimitMinMax, | |
294 | 0, 10000); | |
295 | ||
296 | fMaxPtAE->Connect("ValueSet(Long_t)", "AliEveLegoEditor", this, "SetMaxPtAE()"); | |
297 | ||
298 | horzAE->AddFrame( fMaxPtAE, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY)); | |
299 | this2->AddFrame(horzAE, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY)); | |
300 | ||
301 | TGHorizontalFrame *horz1AE = new TGHorizontalFrame(this2); | |
302 | ||
303 | fLabel1AE = new TGLabel(horz1AE, "Tracks threshold (GeV): "); | |
304 | horz1AE->AddFrame(fLabel1AE, new TGLayoutHints(kLHintsLeft | kLHintsCenterY)); | |
305 | ||
306 | fThresholdAE = new TGNumberEntry(horz1AE, 0, 7, -1, | |
307 | TGNumberFormat::kNESRealOne, | |
308 | TGNumberFormat::kNEANonNegative, | |
309 | TGNumberFormat::kNELLimitMinMax, | |
310 | 0, 10000); | |
311 | ||
312 | fThresholdAE->Connect("ValueSet(Long_t)", "AliEveLegoEditor", this, "SetThresholdAE()"); | |
313 | horz1AE->AddFrame( fThresholdAE, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY)); | |
314 | ||
315 | this2->AddFrame(horz1AE, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY)); | |
316 | ||
317 | } | |
318 | ||
319 | //______________________________________________________________________________ | |
320 | void AliEveLegoEditor::ShowPrevEvent() | |
321 | { | |
322 | fM->ShowPrevEvent(); | |
323 | } | |
324 | ||
325 | //______________________________________________________________________________ | |
326 | void AliEveLegoEditor::ShowNextEvent() | |
327 | { | |
328 | fM->ShowNextEvent(); | |
329 | } | |
330 |