2 // Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
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 "AliEveBeamsInfo.h"
11 #include "AliEveBeamsInfoEditor.h"
13 #include "TVirtualPad.h"
16 #include "TGColorSelect.h"
17 #include "TGComboBox.h"
18 #include "TGDoubleSlider.h"
21 #include "TGNumberEntry.h"
24 //______________________________________________________________________________
25 // GUI editor for AliEveBeamsInfo.
28 ClassImp(AliEveBeamsInfoEditor)
30 //______________________________________________________________________________
31 AliEveBeamsInfoEditor::AliEveBeamsInfoEditor(const TGWindow *p, Int_t width, Int_t height,
32 UInt_t options, Pixel_t back) :
33 TGedFrame(p, width, height, options | kVerticalFrame, back),
45 MakeTitle("AliEveBeamsInfo");
48 fShowEvents = new TGCheckButton(this, new TGHotString("&Show information box"));
49 fShowEvents->SetState(kButtonDown);
50 fShowEvents->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowEventSelection()");
51 AddFrame(fShowEvents, new TGLayoutHints(kLHintsExpandX));
53 fIsMC = new TGCheckButton(this, new TGHotString("&Data is from simulation (MC)"));
54 fIsMC->SetState(kButtonUp);
55 fIsMC->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "SwitchDataType()");
56 AddFrame(fIsMC, new TGLayoutHints(kLHintsExpandX));
58 fEventSelection = new TGGroupFrame(this, "Event filter:", kHorizontalFrame);
59 fSelect = new TGComboBox(fEventSelection,-1,kHorizontalFrame | kSunkenFrame | kDoubleBorder | kOwnBackground);
60 fSelect->AddEntry("Show all events",0);
61 fSelect->AddEntry("Only Beam 1 events",1);
62 fSelect->AddEntry("Only Beam 2 events",2);
63 fSelect->AddEntry("Beams 1 & 2 events",3);
64 fSelect->Resize(120,22);
66 fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
68 fSelect->Connect("Selected(Int_t)", "AliEveBeamsInfoEditor", this, "SelectEventSelection(Int_t)");
70 AddFrame(fEventSelection, new TGLayoutHints(kLHintsExpandX));
74 TGHorizontalFrame *h = new TGHorizontalFrame(this);
76 fButtonPrev = new TGTextButton(h, "Previous event");
77 h->AddFrame(fButtonPrev, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX));
78 fButtonPrev->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowPrevEvent()");
80 fButtonNext = new TGTextButton(h, "Next event");
81 h->AddFrame( fButtonNext, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsExpandX));
82 fButtonNext->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowNextEvent()");
84 AddFrame(h, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
86 fSetAlpha = new TGGroupFrame(this, "Transparency value:", kHorizontalFrame);
87 fAlpha = new TGNumberEntry(fSetAlpha, 1.5, 7, -1,
88 TGNumberFormat::kNESRealOne,
89 TGNumberFormat::kNEANonNegative,
90 TGNumberFormat::kNELLimitMinMax,
92 fAlpha->Resize(120,22);
93 fSetAlpha->AddFrame(fAlpha, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
94 fAlpha->Connect("ValueSet(Long_t)", "AliEveBeamsInfoEditor", this, "SetAlpha()");
96 AddFrame(fSetAlpha, new TGLayoutHints(kLHintsExpandX));
99 //______________________________________________________________________________
100 void AliEveBeamsInfoEditor::SetModel(TObject* obj)
103 fM = dynamic_cast<AliEveBeamsInfo*>(obj);
106 //______________________________________________________________________________
107 void AliEveBeamsInfoEditor::ShowEventSelection()
109 // Show event selection
110 fM->ShowEventSelection(fShowEvents->IsOn());
113 //______________________________________________________________________________
114 void AliEveBeamsInfoEditor::SelectEventSelection(Int_t id)
116 // Show event selection
117 fM->SelectEventSelection(id);
120 //______________________________________________________________________________
121 void AliEveBeamsInfoEditor::ShowPrevEvent()
123 // Show previous event
127 //______________________________________________________________________________
128 void AliEveBeamsInfoEditor::ShowNextEvent()
134 //______________________________________________________________________________
135 void AliEveBeamsInfoEditor::SwitchDataType()
137 // Show previous event
138 fM->SwitchDataType(fIsMC->IsOn());
141 //______________________________________________________________________________
142 void AliEveBeamsInfoEditor::SetAlpha()
145 fM->SetAlpha(fAlpha->GetNumber());
149 /******************************************************************************/