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