3 #include "TPCSectorVizEditor.h"
4 #include <Alieve/TPCSectorViz.h>
6 #include <Reve/RGValuators.h>
7 #include <Reve/ZTransEditor.h>
9 #include <TVirtualPad.h>
14 #include <TGNumberEntry.h>
15 #include <TGColorSelect.h>
17 #include <TGDoubleSlider.h>
20 using namespace Alieve;
22 //______________________________________________________________________
26 ClassImp(TPCSectorVizEditor)
28 TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p,
29 Int_t width, Int_t height,
30 UInt_t options, Pixel_t back) :
31 TGedFrame(p, width, height, options | kVerticalFrame, back),
34 fSectorID (0), fAutoTrans (0),
35 fRnrInn (0), fRnrOut1 (0), fRnrOut2(0),
36 fThreshold (0), fMaxVal (0),
43 MakeTitle("Transformation matrix");
45 fHMTrans = new ZTransSubEditor(this);
46 fHMTrans->Connect("UseTrans()", "Alieve::TPCSectorVizEditor", this, "Update()");
47 fHMTrans->Connect("TransChanged()", "Alieve::TPCSectorVizEditor", this, "Update()");
48 AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
50 MakeTitle("TPCSectorViz");
52 fSectorID = new RGValuator(this, "SectorID", 110, 0);
53 fSectorID->SetLabelWidth(labelW);
54 fSectorID->SetShowSlider(kFALSE);
55 fSectorID->SetNELength(4);
57 fSectorID->SetLimits(0, 35);
58 fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
59 fSectorID->Connect("ValueSet(Double_t)",
60 "Alieve::TPCSectorVizEditor", this, "DoSectorID()");
61 // Reuse sectorID for auto-transformation button
62 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
63 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
64 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
65 fAutoTrans->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoAutoTrans()");
66 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
69 TGHorizontalFrame* f = new TGHorizontalFrame(this);
71 fRnrInn = new TGCheckButton(f, "Inner");
72 f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
73 fRnrInn->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrInn()");
75 fRnrOut1 = new TGCheckButton(f, "Outer 1");
76 f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
77 fRnrOut1->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut1()");
79 fRnrOut2 = new TGCheckButton(f, "Outer 2");
80 f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
81 fRnrOut2->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut2()");
83 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
86 fThreshold = new RGValuator(this, "Threshold", 200, 0);
87 fThreshold->SetNELength(4);
88 fThreshold->SetLabelWidth(labelW);
90 fThreshold->GetSlider()->SetWidth(120);
91 fThreshold->SetLimits(0,250);
92 fThreshold->Connect("ValueSet(Double_t)",
93 "Alieve::TPCSectorVizEditor", this, "DoThreshold()");
94 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
96 fMaxVal = new RGValuator(this,"MaxVal", 200, 0);
97 fMaxVal->SetNELength(4);
98 fMaxVal->SetLabelWidth(labelW);
100 fMaxVal->GetSlider()->SetWidth(120);
101 fMaxVal->SetLimits(0, 500);
102 fMaxVal->Connect("ValueSet(Double_t)",
103 "Alieve::TPCSectorVizEditor", this, "DoMaxVal()");
104 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
106 fTime = new RGDoubleValuator(this,"Time", 200, 0);
107 fTime->SetNELength(4);
108 fTime->SetLabelWidth(labelW);
110 fTime->GetSlider()->SetWidth(224);
111 fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger);
112 fTime->Connect("ValueSet()",
113 "Alieve::TPCSectorVizEditor", this, "DoTime()");
114 AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
117 TPCSectorVizEditor::~TPCSectorVizEditor()
120 /**************************************************************************/
122 void TPCSectorVizEditor::SetModel(TObject* obj)
124 fM = dynamic_cast<TPCSectorViz*>(obj);
126 fHMTrans->SetDataFromTrans(&fM->fHMTrans);
128 fSectorID->SetValue(fM->fSectorID);
129 fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp);
131 fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
132 fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
133 fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
135 fThreshold->SetValue(fM->fThreshold);
136 fMaxVal->SetValue(fM->fMaxVal);
138 fTime->SetValues(fM->fMinTime, fM->fMaxTime);
141 /**************************************************************************/
143 void TPCSectorVizEditor::DoSectorID()
145 fM->SetSectorID((Int_t) fSectorID->GetValue());
149 void TPCSectorVizEditor::DoAutoTrans()
151 fM->SetAutoTrans(fAutoTrans->IsOn());
155 /**************************************************************************/
157 void TPCSectorVizEditor::DoRnrInn()
159 fM->SetRnrInn(fRnrInn->IsOn());
163 void TPCSectorVizEditor::DoRnrOut1()
165 fM->SetRnrOut1(fRnrOut1->IsOn());
169 void TPCSectorVizEditor::DoRnrOut2()
171 fM->SetRnrOut2(fRnrOut2->IsOn());
175 /**************************************************************************/
177 void TPCSectorVizEditor::DoThreshold()
179 fM->SetThreshold((Short_t) fThreshold->GetValue());
180 fThreshold->SetValue(fM->fThreshold);
184 void TPCSectorVizEditor::DoMaxVal()
186 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
187 fMaxVal->SetValue(fM->fMaxVal);
191 /**************************************************************************/
193 void TPCSectorVizEditor::DoTime()
195 fM->SetMinTime((Int_t) fTime->GetMin());
196 fM->SetMaxTime((Int_t) fTime->GetMax());