3 #include "TOFSectorEditor.h"
4 #include <Alieve/TOFSector.h>
6 #include <TVirtualPad.h>
8 #include <TEveGValuators.h>
12 #include <TGNumberEntry.h>
13 #include <TGColorSelect.h>
15 #include <TGDoubleSlider.h>
16 using namespace Alieve;
18 //______________________________________________________________________
22 ClassImp(TOFSectorEditor)
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),
29 fSectorID (0), fAutoTrans (0),
30 fPlate0(0x0), fPlate1(0x0), fPlate2(0x0), fPlate3(0x0), fPlate4(0x0),
31 fThreshold (0), fMaxVal (0)
33 // Initialize widget pointers to 0
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));
42 MakeTitle("TPCSectorViz");*/
45 fPlate = new TGCheckButton*[5];
46 for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton;
49 MakeTitle("TOFSector");
51 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
52 fSectorID->SetLabelWidth(60);
53 fSectorID->SetShowSlider(kFALSE);
54 fSectorID->SetNELength(4);
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));
68 // fXYZZ = new TGSomeWidget(this, ...);
69 // AddFrame(fXYZZ, new TGLayoutHints(...));
70 // fXYZZ->Connect("SignalName()", "Alieve::TOFSectorEditor", this, "DoXYZZ()"); {
71 TGHorizontalFrame* f = new TGHorizontalFrame(this);
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)");
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)");
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)");
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)");
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)");
110 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
112 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
113 fThreshold->SetNELength(4);
114 fThreshold->SetLabelWidth(60);
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));
122 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
123 fMaxVal->SetNELength(4);
124 fMaxVal->SetLabelWidth(60);
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));
137 TOFSectorEditor::~TOFSectorEditor()
140 /**************************************************************************/
142 void TOFSectorEditor::SetModel(TObject* obj)
144 fM = dynamic_cast<TOFSector*>(obj);
146 fSectorID->SetValue(fM->GetSectorID());
147 fAutoTrans->SetState(fM->GetAutoTrans() ? kButtonDown : kButtonUp);
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);
155 // Set values of widgets
156 // fXYZZ->SetValue(fM->GetXYZZ());
159 /**************************************************************************/
160 void TOFSectorEditor::DoSectorID()
162 fM->SetSectorID((Int_t) fSectorID->GetValue());
166 void TOFSectorEditor::DoAutoTrans()
168 fM->SetAutoTrans(fAutoTrans->IsOn());
172 /**************************************************************************/
174 void TOFSectorEditor::DoPlate(Int_t nPlate)
176 fM->SetPlate(nPlate, fPlate[nPlate]->IsOn());
180 void TOFSectorEditor::DoPlate0()
182 fM->SetPlate(0, fPlate0->IsOn());
186 void TOFSectorEditor::DoPlate1()
188 fM->SetPlate(1, fPlate1->IsOn());
192 void TOFSectorEditor::DoPlate2()
194 fM->SetPlate(2, fPlate2->IsOn());
197 void TOFSectorEditor::DoPlate3()
199 fM->SetPlate(3, fPlate3->IsOn());
203 void TOFSectorEditor::DoPlate4()
205 fM->SetPlate(4, fPlate4->IsOn());
210 void TOFSectorEditor::DoThreshold()
212 fM->SetThreshold((Short_t) fThreshold->GetValue());
213 fThreshold->SetValue(fM->GetThreshold());
217 void TOFSectorEditor::DoMaxVal()
219 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
220 fMaxVal->SetValue(fM->GetMaxVal());
224 /**************************************************************************/
226 void TOFSectorEditor::DoTime()
228 fM->SetMinTime((Int_t) fTime->GetMin());
229 fM->SetMaxTime((Int_t) fTime->GetMax());
234 /**************************************************************************/
252 // Implements callback/slot methods
254 // void TOFSectorEditor::DoXYZZ()
256 // fM->SetXYZZ(fXYZZ->GetValue());