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