]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveTOFSectorEditor.cxx
Update master to aliroot
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTOFSectorEditor.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
3  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
4  * full copyright notice.                                                 *
5  **************************************************************************/
6
7 // $Id$
8 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
9
10 #include "AliEveTOFSectorEditor.h"
11 #include <AliEveTOFSector.h>
12
13 #include <TVirtualPad.h>
14 #include <TColor.h>
15 #include <TEveGValuators.h>
16
17 #include <TGLabel.h>
18 #include <TGButton.h>
19 #include <TGNumberEntry.h>
20 #include <TGColorSelect.h>
21 #include <TGSlider.h>
22 #include <TGDoubleSlider.h>
23
24
25 //______________________________________________________________________________
26 // AliEveTOFSectorEditor
27 //
28
29 ClassImp(AliEveTOFSectorEditor)
30
31 AliEveTOFSectorEditor::AliEveTOFSectorEditor(const TGWindow *p, 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   fSectorID  (0), fAutoTrans (0),
36   fPlate (0),
37   fPlate0(0), fPlate1(0), fPlate2(0), fPlate3(0), fPlate4(0),
38   fThreshold (0), fMaxVal(0)
39 {
40   //ctr
41
42   fPlate = new TGCheckButton*[5];
43   for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton;
44
45   //fPriority = 40;
46   MakeTitle("AliEveTOFSector");
47
48   fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
49   fSectorID->SetLabelWidth(60);
50   fSectorID->SetShowSlider(kFALSE);
51   fSectorID->SetNELength(4);
52   fSectorID->Build();
53   fSectorID->SetLimits(0, 17);
54   fSectorID->SetToolTip("The 18 Tof Sector's");
55   fSectorID->Connect("ValueSet(Double_t)",
56                      "AliEveTOFSectorEditor", this, "DoSectorID()");
57   // Reuse sectorID for auto-transformation button
58   fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
59   fAutoTrans->SetToolTipText("Automatically set transformation to true position");
60   fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
61   fAutoTrans->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoAutoTrans()");
62   AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
63
64   // Create widgets
65   // fXYZZ = new TGSomeWidget(this, ...);
66   // AddFrame(fXYZZ, new TGLayoutHints(...));
67   // fXYZZ->Connect("SignalName()", "AliEveTOFSectorEditor", this, "DoXYZZ()"); {
68   TGHorizontalFrame* f = new TGHorizontalFrame(this);
69
70   Int_t nPlate = 0;
71   fPlate0 = new TGCheckButton(f, "Plate0");
72   f->AddFrame(fPlate0, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
73   fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate0()");
74   //fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
75
76   nPlate = 1;
77   fPlate1 = new TGCheckButton(f, "Plate 1");
78   f->AddFrame(fPlate1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
79   fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate1()");
80   //fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
81
82   nPlate = 2;
83   fPlate2 = new TGCheckButton(f, "Plate 2");
84   f->AddFrame(fPlate2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
85   fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate2()");
86   //fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
87
88   nPlate = 3;
89   fPlate3 = new TGCheckButton(f, "Plate 3");
90   f->AddFrame(fPlate3, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
91   fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate3()");
92   //fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
93
94   nPlate = 4;
95   fPlate4 = new TGCheckButton(f, "Plate 4");
96   f->AddFrame(fPlate4, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
97   fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate4()");
98   //fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
99
100   fPlate[0] = fPlate0;
101   fPlate[1] = fPlate1;
102   fPlate[2] = fPlate2;
103   fPlate[3] = fPlate3;
104   fPlate[4] = fPlate4;
105
106   AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
107
108   fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
109   fThreshold->SetNELength(4);
110   fThreshold->SetLabelWidth(60);
111   fThreshold->Build();
112   fThreshold->GetSlider()->SetWidth(120);
113   fThreshold->SetLimits(0,250);
114   fThreshold->Connect("ValueSet(Double_t)",
115                       "AliEveTOFSectorEditor", this, "DoThreshold()");
116   AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
117
118   fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
119   fMaxVal->SetNELength(4);
120   fMaxVal->SetLabelWidth(60);
121   fMaxVal->Build();
122   fMaxVal->GetSlider()->SetWidth(60);
123   fMaxVal->SetLimits(0, 500);
124   fMaxVal->Connect("ValueSet(Double_t)",
125                    "AliEveTOFSectorEditor", this, "DoMaxVal()");
126   AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
127
128 }
129
130 /******************************************************************************/
131
132 AliEveTOFSectorEditor::~AliEveTOFSectorEditor()
133 {
134   //dtr
135
136   delete [] fPlate;
137 }
138
139 /******************************************************************************/
140
141 void AliEveTOFSectorEditor::SetModel(TObject* obj)
142 {
143   // Set object to monitor at visualization level
144
145   fM = static_cast<AliEveTOFSector*>(obj);
146
147   fSectorID->SetValue(fM->GetSectorID());
148   fAutoTrans->SetState(fM->GetAutoTrans()  ? kButtonDown : kButtonUp);
149
150   fPlate0->SetState(fM->GetPlate(0) ? kButtonDown : kButtonUp);
151   fPlate1->SetState(fM->GetPlate(1) ? kButtonDown : kButtonUp);
152   fPlate2->SetState(fM->GetPlate(2) ? kButtonDown : kButtonUp);
153   fPlate3->SetState(fM->GetPlate(3) ? kButtonDown : kButtonUp);
154   fPlate4->SetState(fM->GetPlate(4) ? kButtonDown : kButtonUp);
155 }
156
157 /******************************************************************************/
158 void AliEveTOFSectorEditor::DoSectorID()
159 {
160   fM->SetSectorID((Int_t) fSectorID->GetValue());
161   Update();
162 }
163
164 void AliEveTOFSectorEditor::DoAutoTrans()
165 {
166   fM->SetAutoTrans(fAutoTrans->IsOn());
167   Update();
168 }
169
170 /******************************************************************************/
171
172 void AliEveTOFSectorEditor::DoPlate(Int_t nPlate)
173 {
174   fM->SetPlate(nPlate, fPlate[nPlate]->IsOn());
175   Update();
176 }
177
178 void AliEveTOFSectorEditor::DoPlate0()
179 {
180   fM->SetPlate(0, fPlate0->IsOn());
181   Update();
182 }
183
184 void AliEveTOFSectorEditor::DoPlate1()
185 {
186   fM->SetPlate(1, fPlate1->IsOn());
187   Update();
188 }
189
190 void AliEveTOFSectorEditor::DoPlate2()
191 {
192   fM->SetPlate(2, fPlate2->IsOn());
193   Update();
194 }
195 void AliEveTOFSectorEditor::DoPlate3()
196 {
197   fM->SetPlate(3, fPlate3->IsOn());
198   Update();
199 }
200
201 void AliEveTOFSectorEditor::DoPlate4()
202 {
203   fM->SetPlate(4, fPlate4->IsOn());
204   Update();
205 }
206
207
208 void AliEveTOFSectorEditor::DoThreshold()
209 {
210   fM->SetThreshold((Short_t) fThreshold->GetValue());
211   fThreshold->SetValue(fM->GetThreshold());
212   Update();
213 }
214
215 void AliEveTOFSectorEditor::DoMaxVal()
216 {
217   fM->SetMaxVal((Int_t) fMaxVal->GetValue());
218   fMaxVal->SetValue(fM->GetMaxVal());
219   Update();
220 }
221
222 /*
223 void AliEveTOFSectorEditor::DoTime()
224
225   fM->SetMinTime((Int_t) fTime->GetMin());
226   fM->SetMaxTime((Int_t) fTime->GetMax());
227   Update();
228 }
229 */