3 #include "TOFSectorEditor.h"
4 #include <Alieve/TOFSector.h>
6 #include <TVirtualPad.h>
8 #include <Reve/RGValuators.h>
12 #include <TGNumberEntry.h>
13 #include <TGColorSelect.h>
15 #include <TGDoubleSlider.h>
18 using namespace Alieve;
20 //______________________________________________________________________
24 ClassImp(TOFSectorEditor)
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),
31 fSectorID (0), fAutoTrans (0),
32 fPlate0(0x0), fPlate1(0x0), fPlate2(0x0), fPlate3(0x0), fPlate4(0x0),
33 fThreshold (0), fMaxVal (0)
35 // Initialize widget pointers to 0
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));
44 MakeTitle("TPCSectorViz");*/
47 fPlate = new TGCheckButton*[5];
48 for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton;
51 MakeTitle("TOFSector");
53 fSectorID = new RGValuator(this, "SectorID", 110, 0);
54 fSectorID->SetLabelWidth(60);
55 fSectorID->SetShowSlider(kFALSE);
56 fSectorID->SetNELength(4);
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));
70 // fXYZZ = new TGSomeWidget(this, ...);
71 // AddFrame(fXYZZ, new TGLayoutHints(...));
72 // fXYZZ->Connect("SignalName()", "Alieve::TOFSectorEditor", this, "DoXYZZ()"); {
73 TGHorizontalFrame* f = new TGHorizontalFrame(this);
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)");
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)");
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)");
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)");
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)");
112 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
114 fThreshold = new RGValuator(this, "Threshold", 200, 0);
115 fThreshold->SetNELength(4);
116 fThreshold->SetLabelWidth(60);
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));
124 fMaxVal = new RGValuator(this,"MaxVal", 200, 0);
125 fMaxVal->SetNELength(4);
126 fMaxVal->SetLabelWidth(60);
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));
139 TOFSectorEditor::~TOFSectorEditor()
142 /**************************************************************************/
144 void TOFSectorEditor::SetModel(TObject* obj)
146 fM = dynamic_cast<TOFSector*>(obj);
148 fSectorID->SetValue(fM->GetSectorID());
149 fAutoTrans->SetState(fM->GetAutoTrans() ? kButtonDown : kButtonUp);
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);
157 // Set values of widgets
158 // fXYZZ->SetValue(fM->GetXYZZ());
161 /**************************************************************************/
162 void TOFSectorEditor::DoSectorID()
164 fM->SetSectorID((Int_t) fSectorID->GetValue());
168 void TOFSectorEditor::DoAutoTrans()
170 fM->SetAutoTrans(fAutoTrans->IsOn());
174 /**************************************************************************/
176 void TOFSectorEditor::DoPlate(Int_t nPlate)
178 fM->SetPlate(nPlate, fPlate[nPlate]->IsOn());
182 void TOFSectorEditor::DoPlate0()
184 fM->SetPlate(0, fPlate0->IsOn());
188 void TOFSectorEditor::DoPlate1()
190 fM->SetPlate(1, fPlate1->IsOn());
194 void TOFSectorEditor::DoPlate2()
196 fM->SetPlate(2, fPlate2->IsOn());
199 void TOFSectorEditor::DoPlate3()
201 fM->SetPlate(3, fPlate3->IsOn());
205 void TOFSectorEditor::DoPlate4()
207 fM->SetPlate(4, fPlate4->IsOn());
212 void TOFSectorEditor::DoThreshold()
214 fM->SetThreshold((Short_t) fThreshold->GetValue());
215 fThreshold->SetValue(fM->GetThreshold());
219 void TOFSectorEditor::DoMaxVal()
221 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
222 fMaxVal->SetValue(fM->GetMaxVal());
226 /**************************************************************************/
228 void TOFSectorEditor::DoTime()
230 fM->SetMinTime((Int_t) fTime->GetMin());
231 fM->SetMaxTime((Int_t) fTime->GetMax());
236 /**************************************************************************/
254 // Implements callback/slot methods
256 // void TOFSectorEditor::DoXYZZ()
258 // fM->SetXYZZ(fXYZZ->GetValue());