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