]>
Commit | Line | Data |
---|---|---|
6e994a7b | 1 | // $Id$ |
cce980ec | 2 | // Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch |
6e994a7b | 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 | ||
6e994a7b | 10 | #include "AliEveBeamsInfo.h" |
cce980ec | 11 | #include "AliEveBeamsInfoEditor.h" |
6e994a7b | 12 | |
13 | #include "TVirtualPad.h" | |
14 | #include "TColor.h" | |
6e994a7b | 15 | #include "TGButton.h" |
6e994a7b | 16 | #include "TGColorSelect.h" |
6e994a7b | 17 | #include "TGComboBox.h" |
cce980ec | 18 | #include "TGDoubleSlider.h" |
6e994a7b | 19 | #include "TGFrame.h" |
cce980ec | 20 | #include "TGLabel.h" |
21 | #include "TGNumberEntry.h" | |
22 | #include "TGString.h" | |
6e994a7b | 23 | |
24 | //______________________________________________________________________________ | |
25 | // GUI editor for AliEveBeamsInfo. | |
26 | // | |
27 | ||
28 | ClassImp(AliEveBeamsInfoEditor) | |
29 | ||
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), | |
34 | fM(0), | |
cce980ec | 35 | fIsMC(0), |
6e994a7b | 36 | fEventSelection(0), |
37 | fShowEvents(0), | |
38 | fSelect(0), | |
39 | fButtonPrev(0), | |
cce980ec | 40 | fButtonNext(0), |
41 | fSetAlpha(0), | |
42 | fAlpha(0) | |
6e994a7b | 43 | { |
44 | // Constructor. | |
45 | MakeTitle("AliEveBeamsInfo"); | |
46 | ||
cce980ec | 47 | // Events selection |
48 | fShowEvents = new TGCheckButton(this, new TGHotString("&Show information box")); | |
6e994a7b | 49 | fShowEvents->SetState(kButtonDown); |
50 | fShowEvents->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowEventSelection()"); | |
cce980ec | 51 | AddFrame(fShowEvents, new TGLayoutHints(kLHintsExpandX)); |
52 | ||
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)); | |
6e994a7b | 57 | |
cce980ec | 58 | fEventSelection = new TGGroupFrame(this, "Event filter:", kHorizontalFrame); |
6e994a7b | 59 | fSelect = new TGComboBox(fEventSelection,-1,kHorizontalFrame | kSunkenFrame | kDoubleBorder | kOwnBackground); |
cce980ec | 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); | |
6e994a7b | 65 | fSelect->Select(0); |
cce980ec | 66 | fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
6e994a7b | 67 | |
68 | fSelect->Connect("Selected(Int_t)", "AliEveBeamsInfoEditor", this, "SelectEventSelection(Int_t)"); | |
69 | ||
70 | AddFrame(fEventSelection, new TGLayoutHints(kLHintsExpandX)); | |
71 | ||
cce980ec | 72 | //------ |
6e994a7b | 73 | |
74 | TGHorizontalFrame *h = new TGHorizontalFrame(this); | |
75 | ||
76 | fButtonPrev = new TGTextButton(h, "Previous event"); | |
77 | h->AddFrame(fButtonPrev, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX)); | |
78 | fButtonPrev->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowPrevEvent()"); | |
79 | ||
80 | fButtonNext = new TGTextButton(h, "Next event"); | |
81 | h->AddFrame( fButtonNext, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsExpandX)); | |
82 | fButtonNext->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowNextEvent()"); | |
83 | ||
84 | AddFrame(h, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY)); | |
85 | ||
cce980ec | 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, | |
91 | 0, 1.5); | |
92 | fAlpha->Resize(120,22); | |
93 | fSetAlpha->AddFrame(fAlpha, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); | |
94 | fAlpha->Connect("ValueSet(Long_t)", "AliEveBeamsInfoEditor", this, "SetAlpha()"); | |
95 | ||
96 | AddFrame(fSetAlpha, new TGLayoutHints(kLHintsExpandX)); | |
6e994a7b | 97 | } |
98 | ||
99 | //______________________________________________________________________________ | |
100 | void AliEveBeamsInfoEditor::SetModel(TObject* obj) | |
101 | { | |
102 | // Set model object. | |
103 | fM = dynamic_cast<AliEveBeamsInfo*>(obj); | |
104 | } | |
105 | ||
106 | //______________________________________________________________________________ | |
107 | void AliEveBeamsInfoEditor::ShowEventSelection() | |
108 | { | |
cce980ec | 109 | // Show event selection |
110 | fM->ShowEventSelection(fShowEvents->IsOn()); | |
6e994a7b | 111 | } |
112 | ||
113 | //______________________________________________________________________________ | |
114 | void AliEveBeamsInfoEditor::SelectEventSelection(Int_t id) | |
115 | { | |
cce980ec | 116 | // Show event selection |
117 | fM->SelectEventSelection(id); | |
6e994a7b | 118 | } |
119 | ||
120 | //______________________________________________________________________________ | |
121 | void AliEveBeamsInfoEditor::ShowPrevEvent() | |
122 | { | |
cce980ec | 123 | // Show previous event |
6e994a7b | 124 | fM->ShowPrevEvent(); |
125 | } | |
126 | ||
127 | //______________________________________________________________________________ | |
128 | void AliEveBeamsInfoEditor::ShowNextEvent() | |
129 | { | |
cce980ec | 130 | // Show next event |
6e994a7b | 131 | fM->ShowNextEvent(); |
132 | } | |
133 | ||
cce980ec | 134 | //______________________________________________________________________________ |
135 | void AliEveBeamsInfoEditor::SwitchDataType() | |
136 | { | |
137 | // Show previous event | |
138 | fM->SwitchDataType(fIsMC->IsOn()); | |
139 | } | |
140 | ||
141 | //______________________________________________________________________________ | |
142 | void AliEveBeamsInfoEditor::SetAlpha() | |
143 | { | |
144 | // Set alpha | |
145 | fM->SetAlpha(fAlpha->GetNumber()); | |
146 | } | |
147 | ||
148 | ||
6e994a7b | 149 | /******************************************************************************/ |