]>
Commit | Line | Data |
---|---|---|
1 | // $Id$ | |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, 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 "AliEveTPCSectorVizEditor.h" | |
11 | #include <EveDet/AliEveTPCSectorViz.h> | |
12 | ||
13 | #include <TEveGValuators.h> | |
14 | ||
15 | #include <TVirtualPad.h> | |
16 | ||
17 | #include <TGButton.h> | |
18 | #include <TGNumberEntry.h> | |
19 | #include <TGSlider.h> | |
20 | #include <TGDoubleSlider.h> | |
21 | ||
22 | ||
23 | //______________________________________________________________________________ | |
24 | // | |
25 | // Editor for AliEveTPCSectorViz. | |
26 | ||
27 | ClassImp(AliEveTPCSectorVizEditor) | |
28 | ||
29 | AliEveTPCSectorVizEditor::AliEveTPCSectorVizEditor(const TGWindow *p, | |
30 | Int_t width, Int_t height, | |
31 | UInt_t options, Pixel_t back) : | |
32 | TGedFrame(p, width, height, options | kVerticalFrame, back), | |
33 | fM(0), | |
34 | fSectorID (0), fAutoTrans (0), | |
35 | fRnrInn (0), fRnrOut1 (0), fRnrOut2(0), | |
36 | fThreshold (0), fMaxVal (0), | |
37 | fTime (0) | |
38 | { | |
39 | // Constructor. | |
40 | ||
41 | fPriority = 40; | |
42 | ||
43 | Int_t labelW = 60; | |
44 | ||
45 | MakeTitle("AliEveTPCSectorViz"); | |
46 | ||
47 | fSectorID = new TEveGValuator(this, "SectorID", 110, 0); | |
48 | fSectorID->SetLabelWidth(labelW); | |
49 | fSectorID->SetShowSlider(kFALSE); | |
50 | fSectorID->SetNELength(4); | |
51 | fSectorID->Build(); | |
52 | fSectorID->SetLimits(0, 35); | |
53 | fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate"); | |
54 | fSectorID->Connect("ValueSet(Double_t)", | |
55 | "AliEveTPCSectorVizEditor", this, "DoSectorID()"); | |
56 | // Reuse sectorID for auto-transformation button | |
57 | fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans"); | |
58 | fAutoTrans->SetToolTipText("Automatically set transformation to true position"); | |
59 | fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0)); | |
60 | fAutoTrans->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoAutoTrans()"); | |
61 | AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
62 | ||
63 | { | |
64 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
65 | ||
66 | fRnrInn = new TGCheckButton(f, "Inner"); | |
67 | f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
68 | fRnrInn->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrInn()"); | |
69 | ||
70 | fRnrOut1 = new TGCheckButton(f, "Outer 1"); | |
71 | f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
72 | fRnrOut1->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut1()"); | |
73 | ||
74 | fRnrOut2 = new TGCheckButton(f, "Outer 2"); | |
75 | f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
76 | fRnrOut2->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut2()"); | |
77 | ||
78 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
79 | } | |
80 | ||
81 | fThreshold = new TEveGValuator(this, "Threshold", 200, 0); | |
82 | fThreshold->SetNELength(4); | |
83 | fThreshold->SetLabelWidth(labelW); | |
84 | fThreshold->Build(); | |
85 | fThreshold->GetSlider()->SetWidth(120); | |
86 | fThreshold->SetLimits(0,250); | |
87 | fThreshold->Connect("ValueSet(Double_t)", | |
88 | "AliEveTPCSectorVizEditor", this, "DoThreshold()"); | |
89 | AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
90 | ||
91 | fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0); | |
92 | fMaxVal->SetNELength(4); | |
93 | fMaxVal->SetLabelWidth(labelW); | |
94 | fMaxVal->Build(); | |
95 | fMaxVal->GetSlider()->SetWidth(120); | |
96 | fMaxVal->SetLimits(0, 500); | |
97 | fMaxVal->Connect("ValueSet(Double_t)", | |
98 | "AliEveTPCSectorVizEditor", this, "DoMaxVal()"); | |
99 | AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
100 | ||
101 | fTime = new TEveGDoubleValuator(this,"Time", 200, 0); | |
102 | fTime->SetNELength(4); | |
103 | fTime->SetLabelWidth(labelW); | |
104 | fTime->Build(); | |
105 | fTime->GetSlider()->SetWidth(224); | |
106 | fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger); | |
107 | fTime->Connect("ValueSet()", | |
108 | "AliEveTPCSectorVizEditor", this, "DoTime()"); | |
109 | AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
110 | } | |
111 | ||
112 | /******************************************************************************/ | |
113 | ||
114 | void AliEveTPCSectorVizEditor::SetModel(TObject* obj) | |
115 | { | |
116 | // Set model object. | |
117 | ||
118 | fM = dynamic_cast<AliEveTPCSectorViz*>(obj); | |
119 | ||
120 | fSectorID->SetValue(fM->fSectorID); | |
121 | fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp); | |
122 | ||
123 | fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp); | |
124 | fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp); | |
125 | fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp); | |
126 | ||
127 | fThreshold->SetValue(fM->fThreshold); | |
128 | fMaxVal->SetValue(fM->fMaxVal); | |
129 | ||
130 | fTime->SetValues(fM->fMinTime, fM->fMaxTime); | |
131 | } | |
132 | ||
133 | /******************************************************************************/ | |
134 | ||
135 | void AliEveTPCSectorVizEditor::DoSectorID() | |
136 | { | |
137 | // Slot for SectorID. | |
138 | ||
139 | fM->SetSectorID((Int_t) fSectorID->GetValue()); | |
140 | Update(); | |
141 | } | |
142 | ||
143 | void AliEveTPCSectorVizEditor::DoAutoTrans() | |
144 | { | |
145 | // Slot for AutoTrans. | |
146 | ||
147 | fM->SetAutoTrans(fAutoTrans->IsOn()); | |
148 | Update(); | |
149 | } | |
150 | ||
151 | /******************************************************************************/ | |
152 | ||
153 | void AliEveTPCSectorVizEditor::DoRnrInn() | |
154 | { | |
155 | // Slot for RnrInn. | |
156 | ||
157 | fM->SetRnrInn(fRnrInn->IsOn()); | |
158 | Update(); | |
159 | } | |
160 | ||
161 | void AliEveTPCSectorVizEditor::DoRnrOut1() | |
162 | { | |
163 | // Slot for RnrOut1. | |
164 | ||
165 | fM->SetRnrOut1(fRnrOut1->IsOn()); | |
166 | Update(); | |
167 | } | |
168 | ||
169 | void AliEveTPCSectorVizEditor::DoRnrOut2() | |
170 | { | |
171 | // Slot for RnrOut2. | |
172 | ||
173 | fM->SetRnrOut2(fRnrOut2->IsOn()); | |
174 | Update(); | |
175 | } | |
176 | ||
177 | /******************************************************************************/ | |
178 | ||
179 | void AliEveTPCSectorVizEditor::DoThreshold() | |
180 | { | |
181 | // Slot for Threshold. | |
182 | ||
183 | fM->SetThreshold((Short_t) fThreshold->GetValue()); | |
184 | fThreshold->SetValue(fM->fThreshold); | |
185 | Update(); | |
186 | } | |
187 | ||
188 | void AliEveTPCSectorVizEditor::DoMaxVal() | |
189 | { | |
190 | // Slot for MaxVal. | |
191 | ||
192 | fM->SetMaxVal((Int_t) fMaxVal->GetValue()); | |
193 | fMaxVal->SetValue(fM->fMaxVal); | |
194 | Update(); | |
195 | } | |
196 | ||
197 | /******************************************************************************/ | |
198 | ||
199 | void AliEveTPCSectorVizEditor::DoTime() | |
200 | { | |
201 | // Slot for time-range. | |
202 | ||
203 | fM->SetMinTime((Int_t) fTime->GetMin()); | |
204 | fM->SetMaxTime((Int_t) fTime->GetMax()); | |
205 | Update(); | |
206 | } |