]>
Commit | Line | Data |
---|---|---|
5a5a1232 | 1 | // $Header$ |
2 | ||
3 | #include "TrackEditors.h" | |
4 | #include <Reve/Track.h> | |
5 | ||
a3912979 | 6 | #include <Reve/RGValuators.h> |
7 | ||
5a5a1232 | 8 | #include <TVirtualPad.h> |
9 | #include <TColor.h> | |
10 | ||
11 | #include <TGLabel.h> | |
12 | #include <TGButton.h> | |
13 | #include <TGNumberEntry.h> | |
14 | #include <TGColorSelect.h> | |
15 | #include <TGDoubleSlider.h> | |
2074deef | 16 | #include "TGComboBox.h" |
5a5a1232 | 17 | |
18 | using namespace Reve; | |
19 | ||
20 | //______________________________________________________________________ | |
21 | // TrackListEditor | |
22 | // | |
23 | ||
24 | ClassImp(TrackListEditor) | |
25 | ||
f1d52824 | 26 | TrackListEditor::TrackListEditor(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), | |
265ecb21 | 30 | |
f1d52824 | 31 | fTC (0), |
265ecb21 | 32 | |
f1d52824 | 33 | fMaxR(0), |
34 | fMaxZ(0), | |
35 | fMaxOrbits(0), | |
36 | fMinAng(0), | |
37 | fDelta(0), | |
265ecb21 | 38 | |
f1d52824 | 39 | fRnrTracks(0), |
40 | fRnrMarkers(0), | |
265ecb21 | 41 | |
f1d52824 | 42 | fFitDaughters(0), |
43 | fFitDecay(0), | |
265ecb21 | 44 | |
f1d52824 | 45 | fPtRange(0) |
5a5a1232 | 46 | { |
5a5a1232 | 47 | MakeTitle("TrackList"); |
f1d52824 | 48 | Int_t labelW = 67; |
49 | ||
50 | // --- Limits | |
51 | ||
52 | fMaxR = new RGValuator(this, "Max R:", 110, 0); | |
53 | fMaxR->SetLabelWidth(labelW); | |
54 | fMaxR->SetNELength(6); | |
55 | fMaxR->Build(); | |
56 | fMaxR->SetLimits(0.1, 1000, 100, TGNumberFormat::kNESRealOne); | |
57 | fMaxR->SetToolTip("Maximum radius to which the tracks will be drawn."); | |
58 | fMaxR->Connect("ValueSet(Double_t)", "Reve::TrackListEditor", this, "DoMaxR()"); | |
59 | AddFrame(fMaxR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
60 | ||
61 | fMaxZ = new RGValuator(this, "Max Z:", 110, 0); | |
62 | fMaxZ->SetLabelWidth(labelW); | |
63 | fMaxZ->SetNELength(6); | |
64 | fMaxZ->Build(); | |
65 | fMaxZ->SetLimits(0.1, 2000, 100, TGNumberFormat::kNESRealOne); | |
66 | fMaxZ->SetToolTip("Maximum z-coordinate to which the tracks will be drawn."); | |
67 | fMaxZ->Connect("ValueSet(Double_t)", "Reve::TrackListEditor", this, "DoMaxZ()"); | |
68 | AddFrame(fMaxZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
5a5a1232 | 69 | |
70 | { | |
71 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
72 | TGLabel *l = new TGLabel(f, "Max Orbits:"); | |
73 | f->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsCenterY, 0, 2, 1, 1)); | |
74 | fMaxOrbits = new TGNumberEntry(f, 0., 6, -1, | |
75 | TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive, | |
76 | TGNumberFormat::kNELLimitMinMax, 0.1, 100.0); | |
77 | fMaxOrbits->GetNumberEntry()->SetToolTipText("Maximal angular path of tracks' orbits (1 ~ 2Pi)."); | |
78 | f->AddFrame(fMaxOrbits, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); | |
79 | fMaxOrbits->Associate(f); | |
80 | fMaxOrbits->Connect("ValueSet(Long_t)", "Reve::TrackListEditor", this, "DoMaxOrbits()"); | |
81 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
82 | } | |
83 | ||
84 | { | |
85 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
86 | TGLabel *l = new TGLabel(f, "Min Angle:"); | |
87 | f->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsCenterY, 3, 2, 1, 1)); | |
88 | fMinAng = new TGNumberEntry(f, 0., 6, -1, | |
89 | TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive, | |
90 | TGNumberFormat::kNELLimitMinMax, 1, 180.0); | |
91 | fMinAng->GetNumberEntry()->SetToolTipText("Minimal angular step between two helix points."); | |
92 | f->AddFrame(fMinAng, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); | |
93 | fMinAng->Associate(f); | |
94 | fMinAng->Connect("ValueSet(Long_t)", "Reve::TrackListEditor", this, "DoMinAng()"); | |
95 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
96 | } | |
97 | ||
98 | { | |
99 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
100 | TGLabel *l = new TGLabel(f, "Delta:"); | |
101 | f->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsCenterY, 32, 2, 1, 1)); | |
102 | fDelta = new TGNumberEntry(f, 0., 6, -1, | |
f1d52824 | 103 | TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive, |
104 | TGNumberFormat::kNELLimitMinMax, 0.001, 100.0); | |
5a5a1232 | 105 | fDelta->GetNumberEntry()->SetToolTipText("Maximal error at the mid-point of the line connecting to helix points."); |
106 | f->AddFrame(fDelta, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); | |
107 | fDelta->Associate(f); | |
108 | fDelta->Connect("ValueSet(Long_t)", "Reve::TrackListEditor", this, "DoDelta()"); | |
109 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
110 | } | |
111 | ||
112 | // --- Rendering control | |
113 | ||
2074deef | 114 | { |
115 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
116 | fRnrTracks = new TGCheckButton(f, "Render tracks"); | |
117 | f->AddFrame(fRnrTracks, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 0)); | |
118 | fRnrTracks->Connect | |
119 | ("Toggled(Bool_t)", "Reve::TrackListEditor", this, "DoRnrTracks()"); | |
120 | fWidthCombo = new TGLineWidthComboBox(f); | |
121 | fWidthCombo->Resize(80, 18); | |
122 | f->AddFrame(fWidthCombo, new TGLayoutHints(kLHintsLeft, 8, 1, 0, 0)); | |
123 | ||
124 | fWidthCombo->Connect | |
125 | ("Selected(Int_t)", "Reve::TrackListEditor", this, "DoLineWidth(Int_t)"); | |
126 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 3, 0)); | |
127 | } | |
5a5a1232 | 128 | |
129 | fRnrMarkers = new TGCheckButton(this, "Render markers"); | |
2074deef | 130 | AddFrame(fRnrMarkers, new TGLayoutHints(kLHintsTop, 3, 1, 2, 0)); |
5a5a1232 | 131 | fRnrMarkers->Connect |
132 | ("Toggled(Bool_t)", | |
133 | "Reve::TrackListEditor", this, "DoRnrMarkers()"); | |
134 | ||
135 | // --- Kinematics fitting | |
136 | ||
137 | fFitDaughters = new TGCheckButton(this, "Fit daughters"); | |
2074deef | 138 | AddFrame(fFitDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 2, 0)); |
5a5a1232 | 139 | fFitDaughters->Connect("Toggled(Bool_t)","Reve::TrackListEditor", this, "DoFitDaughters()"); |
140 | ||
141 | fFitDecay = new TGCheckButton(this, "Fit decay"); | |
2074deef | 142 | AddFrame(fFitDecay, new TGLayoutHints(kLHintsTop, 3, 1, 2, 0)); |
5a5a1232 | 143 | fFitDecay->Connect("Toggled(Bool_t)","Reve::TrackListEditor", this, "DoFitDecay()"); |
144 | ||
145 | // --- Selectors | |
146 | ||
a3912979 | 147 | fPtRange = new RGDoubleValuator(this,"Pt Range", 200, 0); |
148 | fPtRange->SetNELength(6); | |
149 | fPtRange->Build(); | |
150 | fPtRange->GetSlider()->SetWidth(224); | |
151 | fPtRange->SetLimits(0.1, 10, TGNumberFormat::kNESRealTwo); | |
152 | fPtRange->Connect("ValueSet()", | |
153 | "Reve::TrackListEditor", this, "DoPtRange()"); | |
154 | AddFrame(fPtRange, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
5a5a1232 | 155 | } |
156 | ||
157 | TrackListEditor::~TrackListEditor() | |
158 | {} | |
159 | ||
160 | /**************************************************************************/ | |
161 | ||
a8600b56 | 162 | void TrackListEditor::SetModel(TObject* obj) |
5a5a1232 | 163 | { |
a8600b56 | 164 | fTC = dynamic_cast<TrackList*>(obj); |
5a5a1232 | 165 | |
f1d52824 | 166 | fMaxR->SetValue(fTC->GetMaxR()); |
167 | fMaxZ->SetValue(fTC->GetMaxZ()); | |
5a5a1232 | 168 | fMaxOrbits->SetNumber(fTC->GetMaxOrbs()); |
169 | fMinAng->SetNumber(fTC->GetMinAng()); | |
170 | fDelta->SetNumber(fTC->GetDelta()); | |
171 | ||
2074deef | 172 | fWidthCombo->Select(fTC->GetWidth()); |
173 | ||
5a5a1232 | 174 | fRnrTracks->SetState(fTC->GetRnrTracks() ? kButtonDown : kButtonUp); |
175 | fRnrMarkers->SetState(fTC->GetRnrMarkers() ? kButtonDown : kButtonUp); | |
176 | ||
177 | fFitDaughters->SetState(fTC->GetFitDaughters() ? kButtonDown : kButtonUp); | |
178 | fFitDecay->SetState(fTC->GetFitDecay() ? kButtonDown : kButtonUp); | |
179 | ||
a3912979 | 180 | fPtRange->SetValues(0.1, 10); |
5a5a1232 | 181 | } |
182 | ||
183 | /**************************************************************************/ | |
184 | ||
185 | void TrackListEditor::DoMaxR() | |
186 | { | |
f1d52824 | 187 | fTC->SetMaxR(fMaxR->GetValue()); |
5a5a1232 | 188 | Update(); |
189 | } | |
190 | ||
191 | void TrackListEditor::DoMaxZ() | |
192 | { | |
f1d52824 | 193 | fTC->SetMaxZ(fMaxZ->GetValue()); |
5a5a1232 | 194 | Update(); |
195 | } | |
196 | ||
197 | void TrackListEditor::DoMaxOrbits() | |
198 | { | |
199 | fTC->SetMaxOrbs(fMaxOrbits->GetNumber()); | |
200 | Update(); | |
201 | } | |
202 | ||
203 | void TrackListEditor::DoMinAng() | |
204 | { | |
205 | fTC->SetMinAng(fMinAng->GetNumber()); | |
206 | Update(); | |
207 | } | |
208 | ||
209 | void TrackListEditor::DoDelta() | |
210 | { | |
211 | fTC->SetDelta(fDelta->GetNumber()); | |
212 | Update(); | |
213 | } | |
214 | ||
215 | /**************************************************************************/ | |
216 | ||
2074deef | 217 | void TrackListEditor::DoLineWidth(Int_t width) |
218 | { | |
219 | fTC->SetWidth(width); | |
220 | Update(); | |
221 | } | |
222 | ||
223 | /**************************************************************************/ | |
224 | ||
5a5a1232 | 225 | void TrackListEditor::DoRnrTracks() |
226 | { | |
227 | fTC->SetRnrTracks(fRnrTracks->IsOn()); | |
228 | Update(); | |
229 | } | |
230 | ||
231 | void TrackListEditor::DoRnrMarkers() | |
232 | { | |
233 | fTC->SetRnrMarkers(fRnrMarkers->IsOn()); | |
234 | Update(); | |
235 | } | |
236 | ||
237 | /**************************************************************************/ | |
238 | ||
239 | void TrackListEditor::DoFitDaughters() | |
240 | { | |
241 | fTC->SetFitDaughters(fFitDaughters->IsOn()); | |
242 | Update(); | |
243 | } | |
244 | ||
245 | void TrackListEditor::DoFitDecay() | |
246 | { | |
247 | fTC->SetFitDecay(fFitDecay->IsOn()); | |
248 | Update(); | |
249 | } | |
250 | ||
251 | /**************************************************************************/ | |
252 | ||
a3912979 | 253 | void TrackListEditor::DoPtRange() |
5a5a1232 | 254 | { |
a3912979 | 255 | fTC->SelectByPt(fPtRange->GetMin(), fPtRange->GetMax()); |
a8600b56 | 256 | Update(); |
5a5a1232 | 257 | } |