]>
Commit | Line | Data |
---|---|---|
092578a7 | 1 | // $Header$ |
2 | ||
3 | #include "TPCSectorVizEditor.h" | |
4 | #include <Alieve/TPCSectorViz.h> | |
5 | ||
5987168b | 6 | #include <Reve/RGValuators.h> |
fbb1b08d | 7 | #include <Reve/ZTransEditor.h> |
5987168b | 8 | |
092578a7 | 9 | #include <TVirtualPad.h> |
10 | #include <TColor.h> | |
11 | ||
12 | #include <TGLabel.h> | |
13 | #include <TGButton.h> | |
14 | #include <TGNumberEntry.h> | |
15 | #include <TGColorSelect.h> | |
16 | #include <TGSlider.h> | |
17 | #include <TGDoubleSlider.h> | |
18 | ||
19 | using namespace Reve; | |
20 | using namespace Alieve; | |
21 | ||
22 | //______________________________________________________________________ | |
23 | // TPCSectorVizEditor | |
24 | // | |
25 | ||
26 | ClassImp(TPCSectorVizEditor) | |
27 | ||
a8600b56 | 28 | TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p, |
265ecb21 | 29 | Int_t width, Int_t height, |
30 | UInt_t options, Pixel_t back) : | |
a8600b56 | 31 | TGedFrame(p, width, height, options | kVerticalFrame, back), |
265ecb21 | 32 | fM(0), |
fbb1b08d | 33 | fHMTrans (0), |
34 | fSectorID (0), fAutoTrans (0), | |
35 | fRnrInn (0), fRnrOut1 (0), fRnrOut2(0), | |
36 | fThreshold (0), fMaxVal (0), | |
265ecb21 | 37 | fTime (0) |
092578a7 | 38 | { |
a8600b56 | 39 | fPriority = 40; |
092578a7 | 40 | |
5987168b | 41 | Int_t labelW = 60; |
092578a7 | 42 | |
fbb1b08d | 43 | MakeTitle("Transformation matrix"); |
44 | ||
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)); | |
49 | ||
50 | MakeTitle("TPCSectorViz"); | |
51 | ||
5987168b | 52 | fSectorID = new RGValuator(this, "SectorID", 110, 0); |
53 | fSectorID->SetLabelWidth(labelW); | |
54 | fSectorID->SetShowSlider(kFALSE); | |
55 | fSectorID->SetNELength(4); | |
56 | fSectorID->Build(); | |
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()"); | |
fbb1b08d | 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()"); | |
5987168b | 66 | AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); |
092578a7 | 67 | |
092578a7 | 68 | { |
69 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
70 | ||
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()"); | |
74 | ||
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()"); | |
78 | ||
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()"); | |
82 | ||
83 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
84 | } | |
5987168b | 85 | |
86 | fThreshold = new RGValuator(this, "Threshold", 200, 0); | |
87 | fThreshold->SetNELength(4); | |
88 | fThreshold->SetLabelWidth(labelW); | |
89 | fThreshold->Build(); | |
90 | fThreshold->GetSlider()->SetWidth(120); | |
a8600b56 | 91 | fThreshold->SetLimits(0,250); |
5987168b | 92 | fThreshold->Connect("ValueSet(Double_t)", |
93 | "Alieve::TPCSectorVizEditor", this, "DoThreshold()"); | |
94 | AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
95 | ||
96 | fMaxVal = new RGValuator(this,"MaxVal", 200, 0); | |
97 | fMaxVal->SetNELength(4); | |
98 | fMaxVal->SetLabelWidth(labelW); | |
99 | fMaxVal->Build(); | |
100 | fMaxVal->GetSlider()->SetWidth(120); | |
a8600b56 | 101 | fMaxVal->SetLimits(0, 500); |
5987168b | 102 | fMaxVal->Connect("ValueSet(Double_t)", |
103 | "Alieve::TPCSectorVizEditor", this, "DoMaxVal()"); | |
104 | AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
105 | ||
106 | fTime = new RGDoubleValuator(this,"Time", 200, 0); | |
107 | fTime->SetNELength(4); | |
108 | fTime->SetLabelWidth(labelW); | |
109 | fTime->Build(); | |
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)); | |
092578a7 | 115 | } |
116 | ||
117 | TPCSectorVizEditor::~TPCSectorVizEditor() | |
118 | {} | |
119 | ||
120 | /**************************************************************************/ | |
121 | ||
a8600b56 | 122 | void TPCSectorVizEditor::SetModel(TObject* obj) |
092578a7 | 123 | { |
a8600b56 | 124 | fM = dynamic_cast<TPCSectorViz*>(obj); |
092578a7 | 125 | |
fbb1b08d | 126 | fHMTrans->SetDataFromTrans(&fM->fHMTrans); |
127 | ||
5987168b | 128 | fSectorID->SetValue(fM->fSectorID); |
fbb1b08d | 129 | fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp); |
5987168b | 130 | |
131 | fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp); | |
092578a7 | 132 | fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp); |
133 | fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp); | |
092578a7 | 134 | |
5987168b | 135 | fThreshold->SetValue(fM->fThreshold); |
136 | fMaxVal->SetValue(fM->fMaxVal); | |
137 | ||
138 | fTime->SetValues(fM->fMinTime, fM->fMaxTime); | |
092578a7 | 139 | } |
140 | ||
141 | /**************************************************************************/ | |
142 | ||
143 | void TPCSectorVizEditor::DoSectorID() | |
144 | { | |
5987168b | 145 | fM->SetSectorID((Int_t) fSectorID->GetValue()); |
092578a7 | 146 | Update(); |
147 | } | |
148 | ||
fbb1b08d | 149 | void TPCSectorVizEditor::DoAutoTrans() |
02937761 | 150 | { |
fbb1b08d | 151 | fM->SetAutoTrans(fAutoTrans->IsOn()); |
02937761 | 152 | Update(); |
153 | } | |
154 | ||
092578a7 | 155 | /**************************************************************************/ |
156 | ||
157 | void TPCSectorVizEditor::DoRnrInn() | |
158 | { | |
159 | fM->SetRnrInn(fRnrInn->IsOn()); | |
160 | Update(); | |
161 | } | |
162 | ||
163 | void TPCSectorVizEditor::DoRnrOut1() | |
164 | { | |
165 | fM->SetRnrOut1(fRnrOut1->IsOn()); | |
166 | Update(); | |
167 | } | |
168 | ||
169 | void TPCSectorVizEditor::DoRnrOut2() | |
170 | { | |
171 | fM->SetRnrOut2(fRnrOut2->IsOn()); | |
172 | Update(); | |
173 | } | |
174 | ||
175 | /**************************************************************************/ | |
176 | ||
177 | void TPCSectorVizEditor::DoThreshold() | |
178 | { | |
5987168b | 179 | fM->SetThreshold((Short_t) fThreshold->GetValue()); |
a89f67d8 | 180 | fThreshold->SetValue(fM->fThreshold); |
092578a7 | 181 | Update(); |
182 | } | |
183 | ||
184 | void TPCSectorVizEditor::DoMaxVal() | |
185 | { | |
5987168b | 186 | fM->SetMaxVal((Int_t) fMaxVal->GetValue()); |
a89f67d8 | 187 | fMaxVal->SetValue(fM->fMaxVal); |
092578a7 | 188 | Update(); |
189 | } | |
190 | ||
191 | /**************************************************************************/ | |
192 | ||
092578a7 | 193 | void TPCSectorVizEditor::DoTime() |
194 | { | |
5987168b | 195 | fM->SetMinTime((Int_t) fTime->GetMin()); |
196 | fM->SetMaxTime((Int_t) fTime->GetMax()); | |
092578a7 | 197 | Update(); |
198 | } |