]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/TOFSectorEditor.cxx
Remove EVE/Reve/ sub-module.
[u/mrichter/AliRoot.git] / EVE / Alieve / TOFSectorEditor.cxx
1 // $Header$
2
3 #include "TOFSectorEditor.h"
4 #include <Alieve/TOFSector.h>
5
6 #include <TVirtualPad.h>
7 #include <TColor.h>
8 #include <TEveGValuators.h>
9
10 #include <TGLabel.h>
11 #include <TGButton.h>
12 #include <TGNumberEntry.h>
13 #include <TGColorSelect.h>
14 #include <TGSlider.h>
15 #include <TGDoubleSlider.h>
16 using namespace Alieve;
17
18 //______________________________________________________________________
19 // TOFSectorEditor
20 //
21
22 ClassImp(TOFSectorEditor)
23   
24   TOFSectorEditor::TOFSectorEditor(const TGWindow *p, Int_t width, Int_t height,
25                                    UInt_t options, Pixel_t back) :
26     TGedFrame(p, width, height, options | kVerticalFrame, back),
27     fM(0) ,
28     //fHMTrans   (0),
29     fSectorID  (0), fAutoTrans (0),
30     fPlate0(0x0), fPlate1(0x0), fPlate2(0x0), fPlate3(0x0), fPlate4(0x0),
31     fThreshold (0), fMaxVal    (0)
32     // fTime      (0)
33     // Initialize widget pointers to 0
34     //{
35     
36     /*
37       fHMTrans = new TEveTransSubEditor(this);
38       fHMTrans->Connect("UseTrans()",     "Alieve::TPCSectorVizEditor", this, "Update()");
39       fHMTrans->Connect("TransChanged()", "Alieve::TPCSectorVizEditor", this, "Update()");
40       AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
41       
42       MakeTitle("TPCSectorViz");*/
43 {
44   
45   fPlate = new TGCheckButton*[5];
46   for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton;
47   
48   //fPriority = 40;
49   MakeTitle("TOFSector");  
50
51   fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
52   fSectorID->SetLabelWidth(60);
53   fSectorID->SetShowSlider(kFALSE);
54   fSectorID->SetNELength(4);
55   fSectorID->Build();
56   fSectorID->SetLimits(0, 17);
57   fSectorID->SetToolTip("The 18 Tof Sector's");
58   fSectorID->Connect("ValueSet(Double_t)",
59                      "Alieve::TOFSectorEditor", this, "DoSectorID()");
60   // Reuse sectorID for auto-transformation button
61   fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
62   fAutoTrans->SetToolTipText("Automatically set transformation to true position");
63   fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
64   fAutoTrans->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoAutoTrans()");
65   AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
66   
67   // Create widgets
68   // fXYZZ = new TGSomeWidget(this, ...);
69   // AddFrame(fXYZZ, new TGLayoutHints(...));
70   // fXYZZ->Connect("SignalName()", "Alieve::TOFSectorEditor", this, "DoXYZZ()"); {
71     TGHorizontalFrame* f = new TGHorizontalFrame(this);
72
73     Int_t nPlate = 0;
74     fPlate0 = new TGCheckButton(f, "Plate0");
75     f->AddFrame(fPlate0, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
76     fPlate0->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate0()");
77     //fPlate0->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
78
79     nPlate = 1;
80     fPlate1 = new TGCheckButton(f, "Plate 1");
81     f->AddFrame(fPlate1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
82     fPlate1->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate1()");
83     //fPlate1->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
84
85     nPlate = 2;
86     fPlate2 = new TGCheckButton(f, "Plate 2");
87     f->AddFrame(fPlate2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
88     fPlate2->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate2()");
89     //fPlate2->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
90
91     nPlate = 3;
92     fPlate3 = new TGCheckButton(f, "Plate 3");
93     f->AddFrame(fPlate3, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
94     fPlate3->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate3()");
95     //fPlate3->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
96
97     nPlate = 4;
98     fPlate4 = new TGCheckButton(f, "Plate 4");
99     f->AddFrame(fPlate4, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
100     fPlate4->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate4()");
101     //fPlate4->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
102
103
104     fPlate[0] = fPlate0;
105     fPlate[1] = fPlate1;
106     fPlate[2] = fPlate2;
107     fPlate[3] = fPlate3;
108     fPlate[4] = fPlate4;
109
110     AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
111
112     fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
113     fThreshold->SetNELength(4);
114     fThreshold->SetLabelWidth(60);
115     fThreshold->Build();
116     fThreshold->GetSlider()->SetWidth(120);
117     fThreshold->SetLimits(0,250);
118     fThreshold->Connect("ValueSet(Double_t)",
119                         "Alieve::TOFSectorEditor", this, "DoThreshold()");
120     AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
121     
122     fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
123     fMaxVal->SetNELength(4);
124     fMaxVal->SetLabelWidth(60);
125     fMaxVal->Build();
126     fMaxVal->GetSlider()->SetWidth(60);
127     fMaxVal->SetLimits(0, 500);
128     fMaxVal->Connect("ValueSet(Double_t)",
129                      "Alieve::TOFSectorEditor", this, "DoMaxVal()");
130     AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
131     
132 }
133
134
135
136
137 TOFSectorEditor::~TOFSectorEditor()
138 {}
139
140 /**************************************************************************/
141
142 void TOFSectorEditor::SetModel(TObject* obj)
143 {
144   fM = dynamic_cast<TOFSector*>(obj);
145
146   fSectorID->SetValue(fM->GetSectorID());
147   fAutoTrans->SetState(fM->GetAutoTrans()  ? kButtonDown : kButtonUp);
148
149   fPlate0->SetState(fM->GetPlate(0) ? kButtonDown : kButtonUp);
150   fPlate1->SetState(fM->GetPlate(1) ? kButtonDown : kButtonUp);
151   fPlate2->SetState(fM->GetPlate(2) ? kButtonDown : kButtonUp);
152   fPlate3->SetState(fM->GetPlate(3) ? kButtonDown : kButtonUp);
153   fPlate4->SetState(fM->GetPlate(4) ? kButtonDown : kButtonUp);
154
155   // Set values of widgets
156   // fXYZZ->SetValue(fM->GetXYZZ());
157 }
158
159 /**************************************************************************/
160 void TOFSectorEditor::DoSectorID()
161 {
162   fM->SetSectorID((Int_t) fSectorID->GetValue());
163   Update();
164 }
165
166 void TOFSectorEditor::DoAutoTrans()
167 {
168   fM->SetAutoTrans(fAutoTrans->IsOn());
169   Update();
170 }
171
172 /**************************************************************************/
173
174 void TOFSectorEditor::DoPlate(Int_t nPlate)
175 {
176   fM->SetPlate(nPlate, fPlate[nPlate]->IsOn());
177   Update();
178 }
179
180 void TOFSectorEditor::DoPlate0()
181 {
182   fM->SetPlate(0, fPlate0->IsOn());
183   Update();
184 }
185
186 void TOFSectorEditor::DoPlate1()
187 {
188   fM->SetPlate(1, fPlate1->IsOn());
189   Update();
190 }
191
192 void TOFSectorEditor::DoPlate2()
193 {
194   fM->SetPlate(2, fPlate2->IsOn());
195   Update();
196 }
197 void TOFSectorEditor::DoPlate3()
198 {
199   fM->SetPlate(3, fPlate3->IsOn());
200   Update();
201 }
202
203 void TOFSectorEditor::DoPlate4()
204 {
205   fM->SetPlate(4, fPlate4->IsOn());
206   Update();
207 }
208
209
210 void TOFSectorEditor::DoThreshold()
211 {
212   fM->SetThreshold((Short_t) fThreshold->GetValue());
213   fThreshold->SetValue(fM->GetThreshold());
214   Update();
215 }
216
217 void TOFSectorEditor::DoMaxVal()
218 {
219   fM->SetMaxVal((Int_t) fMaxVal->GetValue());
220   fMaxVal->SetValue(fM->GetMaxVal());
221   Update();
222 }
223
224 /**************************************************************************/
225 /*
226 void TOFSectorEditor::DoTime()
227
228   fM->SetMinTime((Int_t) fTime->GetMin());
229   fM->SetMaxTime((Int_t) fTime->GetMax());
230   Update();
231 }
232 */
233
234 /**************************************************************************/
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252 // Implements callback/slot methods
253
254 // void TOFSectorEditor::DoXYZZ()
255 // {
256 //   fM->SetXYZZ(fXYZZ->GetValue());
257 //   Update();
258 // }