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