3 #include "TPCSectorVizEditor.h"
4 #include <Alieve/TPCSectorViz.h>
6 #include <TEveGValuators.h>
7 #include <TEveTransEditor.h>
9 #include <TVirtualPad.h>
14 #include <TGNumberEntry.h>
15 #include <TGColorSelect.h>
17 #include <TGDoubleSlider.h>
18 using namespace Alieve;
20 //______________________________________________________________________
24 ClassImp(TPCSectorVizEditor)
26 TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p,
27 Int_t width, Int_t height,
28 UInt_t options, Pixel_t back) :
29 TGedFrame(p, width, height, options | kVerticalFrame, back),
32 fSectorID (0), fAutoTrans (0),
33 fRnrInn (0), fRnrOut1 (0), fRnrOut2(0),
34 fThreshold (0), fMaxVal (0),
41 MakeTitle("Transformation matrix");
43 fHMTrans = new TEveTransSubEditor(this);
44 fHMTrans->Connect("UseTrans()", "Alieve::TPCSectorVizEditor", this, "Update()");
45 fHMTrans->Connect("TransChanged()", "Alieve::TPCSectorVizEditor", this, "Update()");
46 AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
48 MakeTitle("TPCSectorViz");
50 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
51 fSectorID->SetLabelWidth(labelW);
52 fSectorID->SetShowSlider(kFALSE);
53 fSectorID->SetNELength(4);
55 fSectorID->SetLimits(0, 35);
56 fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
57 fSectorID->Connect("ValueSet(Double_t)",
58 "Alieve::TPCSectorVizEditor", this, "DoSectorID()");
59 // Reuse sectorID for auto-transformation button
60 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
61 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
62 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
63 fAutoTrans->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoAutoTrans()");
64 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
67 TGHorizontalFrame* f = new TGHorizontalFrame(this);
69 fRnrInn = new TGCheckButton(f, "Inner");
70 f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
71 fRnrInn->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrInn()");
73 fRnrOut1 = new TGCheckButton(f, "Outer 1");
74 f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
75 fRnrOut1->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut1()");
77 fRnrOut2 = new TGCheckButton(f, "Outer 2");
78 f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
79 fRnrOut2->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut2()");
81 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
84 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
85 fThreshold->SetNELength(4);
86 fThreshold->SetLabelWidth(labelW);
88 fThreshold->GetSlider()->SetWidth(120);
89 fThreshold->SetLimits(0,250);
90 fThreshold->Connect("ValueSet(Double_t)",
91 "Alieve::TPCSectorVizEditor", this, "DoThreshold()");
92 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
94 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
95 fMaxVal->SetNELength(4);
96 fMaxVal->SetLabelWidth(labelW);
98 fMaxVal->GetSlider()->SetWidth(120);
99 fMaxVal->SetLimits(0, 500);
100 fMaxVal->Connect("ValueSet(Double_t)",
101 "Alieve::TPCSectorVizEditor", this, "DoMaxVal()");
102 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
104 fTime = new TEveGDoubleValuator(this,"Time", 200, 0);
105 fTime->SetNELength(4);
106 fTime->SetLabelWidth(labelW);
108 fTime->GetSlider()->SetWidth(224);
109 fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger);
110 fTime->Connect("ValueSet()",
111 "Alieve::TPCSectorVizEditor", this, "DoTime()");
112 AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
115 TPCSectorVizEditor::~TPCSectorVizEditor()
118 /**************************************************************************/
120 void TPCSectorVizEditor::SetModel(TObject* obj)
122 fM = dynamic_cast<TPCSectorViz*>(obj);
124 fHMTrans->SetModel(&fM->fHMTrans);
126 fSectorID->SetValue(fM->fSectorID);
127 fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp);
129 fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
130 fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
131 fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
133 fThreshold->SetValue(fM->fThreshold);
134 fMaxVal->SetValue(fM->fMaxVal);
136 fTime->SetValues(fM->fMinTime, fM->fMaxTime);
139 /**************************************************************************/
141 void TPCSectorVizEditor::DoSectorID()
143 fM->SetSectorID((Int_t) fSectorID->GetValue());
147 void TPCSectorVizEditor::DoAutoTrans()
149 fM->SetAutoTrans(fAutoTrans->IsOn());
153 /**************************************************************************/
155 void TPCSectorVizEditor::DoRnrInn()
157 fM->SetRnrInn(fRnrInn->IsOn());
161 void TPCSectorVizEditor::DoRnrOut1()
163 fM->SetRnrOut1(fRnrOut1->IsOn());
167 void TPCSectorVizEditor::DoRnrOut2()
169 fM->SetRnrOut2(fRnrOut2->IsOn());
173 /**************************************************************************/
175 void TPCSectorVizEditor::DoThreshold()
177 fM->SetThreshold((Short_t) fThreshold->GetValue());
178 fThreshold->SetValue(fM->fThreshold);
182 void TPCSectorVizEditor::DoMaxVal()
184 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
185 fMaxVal->SetValue(fM->fMaxVal);
189 /**************************************************************************/
191 void TPCSectorVizEditor::DoTime()
193 fM->SetMinTime((Int_t) fTime->GetMin());
194 fM->SetMaxTime((Int_t) fTime->GetMax());