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