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