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