2 // Author: Stefano Carrazza 2010
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 **************************************************************************/
10 #include "AliEveLegoEditor.h"
11 #include "AliEveLego.h"
13 #include "TVirtualPad.h"
18 #include "TGNumberEntry.h"
19 #include "TGColorSelect.h"
20 #include "TGDoubleSlider.h"
21 #include "TGButtonGroup.h"
23 #include "TGComboBox.h"
26 //______________________________________________________________________________
27 // GUI editor for AliEveLego.
30 ClassImp(AliEveLegoEditor)
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),
64 MakeTitle("AliEveLego");
67 fAllEventsButton = new TGTextButton(this, "Create lego of all events");
68 AddFrame(fAllEventsButton, new TGLayoutHints(kLHintsExpandX));
69 fAllEventsButton->Connect("Clicked()", "AliEveLegoEditor", this, "DoAllEvents()");
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)");
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)");
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));
93 fMaxPt = new TGNumberEntry(horz, 10000, 7, -1,
94 TGNumberFormat::kNESRealOne,
95 TGNumberFormat::kNEANonNegative,
96 TGNumberFormat::kNELLimitMinMax,
99 fMaxPt->Connect("ValueSet(Long_t)", "AliEveLegoEditor", this, "SetMaxPt()");
101 horz->AddFrame( fMaxPt, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY));
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));
108 fThreshold = new TGNumberEntry(horz1, 0, 7, -1,
109 TGNumberFormat::kNESRealOne,
110 TGNumberFormat::kNEANonNegative,
111 TGNumberFormat::kNELLimitMinMax,
114 fThreshold->Connect("ValueSet(Long_t)", "AliEveLegoEditor", this, "SetThreshold()");
115 horz1->AddFrame( fThreshold, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY));
122 fEventSelection = new TGGroupFrame(this, "Event selection:", kHorizontalFrame);
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));
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);
136 fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
138 fSelect->Connect("Selected(Int_t)", "AliEveLegoEditor", this, "SelectEventSelection(Int_t)");
140 AddFrame(fEventSelection, new TGLayoutHints(kLHintsExpandX));
144 TGHorizontalFrame *horz3 = new TGHorizontalFrame(this);
146 fButtonPrev = new TGTextButton(horz3, "Previous event");
147 horz3->AddFrame(fButtonPrev, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX));
148 fButtonPrev->Connect("Clicked()", "AliEveLegoEditor", this, "ShowPrevEvent()");
150 fButtonNext = new TGTextButton(horz3, "Next event");
151 horz3->AddFrame( fButtonNext, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsExpandX));
152 fButtonNext->Connect("Clicked()", "AliEveLegoEditor", this, "ShowNextEvent()");
154 AddFrame(horz3, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
161 /******************************************************************************/
163 //______________________________________________________________________________
164 void AliEveLegoEditor::SetModel(TObject* obj)
166 fM = dynamic_cast<AliEveLego*>(obj);
169 /******************************************************************************/
171 // Implements callback/slot methods
173 //______________________________________________________________________________
174 // void AliEveLegoEditor::DoXYZZ()
178 // fM->SetXYZZ(fXYZZ->GetValue());
182 //______________________________________________________________________________
183 void AliEveLegoEditor::DoAllEvents()
186 fAllEventsButton->SetEnabled(kFALSE);
187 CreateAllEventsEditor();
192 //______________________________________________________________________________
193 void AliEveLegoEditor::ShowByCharge(Int_t id)
198 //______________________________________________________________________________
199 void AliEveLegoEditor::ShowByChargeAE(Int_t id)
201 fM->SetAllEventsCharge(id);
204 //______________________________________________________________________________
205 void AliEveLegoEditor::SetMaxPt()
207 fM->SetMaxPt(fMaxPt->GetNumber());
210 //______________________________________________________________________________
211 void AliEveLegoEditor::SetMaxPtAE()
213 fM->SetMaxPtAE(fMaxPtAE->GetNumber());
216 //______________________________________________________________________________
217 void AliEveLegoEditor::SetThreshold()
219 fM->SetThreshold(fThreshold->GetNumber());
222 //______________________________________________________________________________
223 void AliEveLegoEditor::SetThresholdAE()
225 fM->SetThresholdAE(fThresholdAE->GetNumber());
228 //______________________________________________________________________________
229 void AliEveLegoEditor::ShowByTracks(Int_t id)
234 //______________________________________________________________________________
235 void AliEveLegoEditor::ShowByTracksAE(Int_t id)
240 //______________________________________________________________________________
241 void AliEveLegoEditor::ShowByEvents(Int_t id)
246 //______________________________________________________________________________
247 void AliEveLegoEditor::ShowEventSelection()
249 fM->SetEventSelection();
252 //______________________________________________________________________________
253 void AliEveLegoEditor::SelectEventSelection(Int_t id)
255 fM->SelectEventSelection(id);
258 //______________________________________________________________________________
259 void AliEveLegoEditor::CreateAllEventsEditor()
261 // create the GUI of all events
262 TGVerticalFrame *this2 = this->CreateEditorTabSubFrame("All events style");
264 TGLabel *ftitle = new TGLabel(this2, "AliLego all events ------");
265 this2->AddFrame(ftitle, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
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));
274 fParticlesBGAE->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByChargeAE(Int_t)");
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)");
285 TGHorizontalFrame *horzAE = new TGHorizontalFrame(this2);
287 fLabelAE = new TGLabel(horzAE, "Tracks maximum Pt (GeV): ");
288 horzAE->AddFrame(fLabelAE, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
290 fMaxPtAE = new TGNumberEntry(horzAE, 10000, 7, -1,
291 TGNumberFormat::kNESRealOne,
292 TGNumberFormat::kNEANonNegative,
293 TGNumberFormat::kNELLimitMinMax,
296 fMaxPtAE->Connect("ValueSet(Long_t)", "AliEveLegoEditor", this, "SetMaxPtAE()");
298 horzAE->AddFrame( fMaxPtAE, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY));
299 this2->AddFrame(horzAE, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
301 TGHorizontalFrame *horz1AE = new TGHorizontalFrame(this2);
303 fLabel1AE = new TGLabel(horz1AE, "Tracks threshold (GeV): ");
304 horz1AE->AddFrame(fLabel1AE, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
306 fThresholdAE = new TGNumberEntry(horz1AE, 0, 7, -1,
307 TGNumberFormat::kNESRealOne,
308 TGNumberFormat::kNEANonNegative,
309 TGNumberFormat::kNELLimitMinMax,
312 fThresholdAE->Connect("ValueSet(Long_t)", "AliEveLegoEditor", this, "SetThresholdAE()");
313 horz1AE->AddFrame( fThresholdAE, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY));
315 this2->AddFrame(horz1AE, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
319 //______________________________________________________________________________
320 void AliEveLegoEditor::ShowPrevEvent()
325 //______________________________________________________________________________
326 void AliEveLegoEditor::ShowNextEvent()