Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TEveTrackPropagatorEditor.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
13#include "TEveTrackPropagator.h"
14
15#include "TEveGValuators.h"
16#include "TEveManager.h"
17
18#include "TGLabel.h"
19#include "TG3DLine.h"
20#include "TGButton.h"
21#include "TGComboBox.h"
22#include "TAttMarkerEditor.h"
23
24/** \class TEveTrackPropagatorSubEditor
25\ingroup TEve
26Sub-editor for TEveTrackPropagator class.
27*/
28
29
30////////////////////////////////////////////////////////////////////////////////
31/// Constructor.
32
35 fM (nullptr),
36
37 fMaxR(nullptr), fMaxZ(nullptr), fMaxOrbits(nullptr), fMaxAng(nullptr), fDelta(nullptr),
38
39 fRefsCont(nullptr), fPMFrame(nullptr),
40 fFitDaughters(nullptr), fFitReferences(nullptr),
41 fFitDecay(nullptr),
42 fFitCluster2Ds(nullptr), fFitLineSegments(nullptr),
43 fRnrDaughters(nullptr), fRnrReferences(nullptr),
44 fRnrDecay(nullptr), fRnrCluster2Ds(nullptr),
45 fRnrFV(nullptr),
46 fPMAtt(nullptr), fFVAtt(nullptr),
47 fProjTrackBreaking(nullptr), fRnrPTBMarkers(nullptr), fPTBAtt(nullptr)
48{
49 Int_t labelW = 51;
50
51 // --- Limits
52 fMaxR = new TEveGValuator(this, "Max R:", 90, 0);
53 fMaxR->SetLabelWidth(labelW);
54 fMaxR->SetNELength(6);
55 fMaxR->Build();
57 fMaxR->SetToolTip("Maximum radius to which the tracks will be drawn.");
58 fMaxR->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxR()");
59 AddFrame(fMaxR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
60
61 fMaxZ = new TEveGValuator(this, "Max Z:", 90, 0);
62 fMaxZ->SetLabelWidth(labelW);
63 fMaxZ->SetNELength(6);
64 fMaxZ->Build();
66 fMaxZ->SetToolTip("Maximum z-coordinate to which the tracks will be drawn.");
67 fMaxZ->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxZ()");
68 AddFrame(fMaxZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
69
70 fMaxOrbits = new TEveGValuator(this, "Orbits:", 90, 0);
71 fMaxOrbits->SetLabelWidth(labelW);
72 fMaxOrbits->SetNELength(6);
73 fMaxOrbits->Build();
74 fMaxOrbits->SetLimits(0.1, 10, 101, TGNumberFormat::kNESRealOne);
75 fMaxOrbits->SetToolTip("Maximal angular path of tracks' orbits (1 ~ 2Pi).");
76 fMaxOrbits->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxOrbits()");
78
79 fMaxAng = new TEveGValuator(this, "Angle:", 90, 0);
80 fMaxAng->SetLabelWidth(labelW);
81 fMaxAng->SetNELength(6);
82 fMaxAng->Build();
83 fMaxAng->SetLimits(1, 160, 81, TGNumberFormat::kNESRealOne);
84 fMaxAng->SetToolTip("Maximal angular step between two helix points.");
85 fMaxAng->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxAng()");
86 AddFrame(fMaxAng, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
87
88 fDelta = new TEveGValuator(this, "Delta:", 90, 0);
89 fDelta->SetLabelWidth(labelW);
90 fDelta->SetNELength(6);
91 fDelta->Build();
92 fDelta->SetLimits(0.001, 10, 101, TGNumberFormat::kNESRealThree);
93 fDelta->SetToolTip("Maximal error at the mid-point of the line connecting to helix points.");
94 fDelta->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoDelta()");
95 AddFrame(fDelta, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Create a frame containing track-reference controls under parent frame p.
100
102{
103 fRefsCont = new TGCompositeFrame(p, 80, 20, kVerticalFrame);
105 // Rendering control.
106 {
107 TGGroupFrame* fitPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
109 fPMFrame->AddFrame( fitPM, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
110
111 TGMatrixLayout *ml = new TGMatrixLayout(fitPM, 0,1,6);
112 fitPM->SetLayoutManager(ml);
113
114 fFitDaughters = new TGCheckButton(fitPM, "Fit Daughters", TEvePathMark::kDaughter);
115 fFitReferences = new TGCheckButton(fitPM, "Fit Refs", TEvePathMark::kReference);
116 fFitDecay = new TGCheckButton(fitPM, "Fit Decay", TEvePathMark::kDecay);
117 fFitCluster2Ds = new TGCheckButton(fitPM, "Fit 2D Clusters", TEvePathMark::kCluster2D);
118 fFitLineSegments = new TGCheckButton(fitPM, "Fit Line Segments", TEvePathMark::kLineSegment);
119
120 fitPM->AddFrame(fFitDaughters);
121 fitPM->AddFrame(fFitReferences);
122 fitPM->AddFrame(fFitDecay);
123 fitPM->AddFrame(fFitCluster2Ds);
125
126 fFitDecay ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
127 fFitReferences ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
128 fFitDaughters ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
129 fFitCluster2Ds ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
130 fFitLineSegments->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
131 }
132 // Kinematics fitting.
133 {
134 TGGroupFrame* rnrPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
136 fPMFrame->AddFrame( rnrPM, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
137
138 TGMatrixLayout *ml = new TGMatrixLayout(rnrPM, 0, 1, 6);
139 rnrPM->SetLayoutManager(ml);
140
141 fRnrDaughters = new TGCheckButton(rnrPM, "Rnr Daughters", TEvePathMark::kDaughter);
142 fRnrReferences = new TGCheckButton(rnrPM, "Rnr Refs", TEvePathMark::kReference);
143 fRnrDecay = new TGCheckButton(rnrPM, "Rnr Decay", TEvePathMark::kDecay);
144 fRnrCluster2Ds = new TGCheckButton(rnrPM, "Rnr 2D Clusters", TEvePathMark::kCluster2D);
145
146 rnrPM->AddFrame(fRnrDaughters);
147 rnrPM->AddFrame(fRnrReferences);
148 rnrPM->AddFrame(fRnrDecay);
149 rnrPM->AddFrame(fRnrCluster2Ds);
150
151 fRnrDecay ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
152 fRnrReferences->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
153 fRnrDaughters ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
154 fRnrCluster2Ds->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
155
156 fRefsCont->AddFrame(fPMFrame, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
157 }
158 // Marker attributes.
159 {
161 TGFrameElement *el = (TGFrameElement*) fPMAtt->GetList()->First();
162 TGFrame *f = el->fFrame; fPMAtt->RemoveFrame(f);
163 f->DestroyWindow(); delete f;
164 fRefsCont->AddFrame(fPMAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
165 }
166 // First vertex.
167 {
170 vf->AddFrame(new TGLabel(vf, "FirstVertex"),
171 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
172 vf->AddFrame(new TGHorizontal3DLine(vf),
173 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
174 fRefsCont->AddFrame(vf, new TGLayoutHints(kLHintsTop, 0, 0, 4, 0));
175
176 fRnrFV = new TGCheckButton(fRefsCont, "Rnr");
177 fRnrFV->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrFV()");
178 fRefsCont->AddFrame(fRnrFV, new TGLayoutHints(kLHintsTop, 5, 1, 2, 0));
179 {
181 TGFrameElement *el = (TGFrameElement*) fFVAtt->GetList()->First();
182 TGFrame *f = el->fFrame; fFVAtt->RemoveFrame(f);
183 f->DestroyWindow(); delete f;
184 fRefsCont->AddFrame(fFVAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
185 }
186 }
187 // Break-points of projected tracks
188 {
191 vf->AddFrame(new TGLabel(vf, "BreakPoints"),
192 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
193 vf->AddFrame(new TGHorizontal3DLine(vf),
194 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
195 fRefsCont->AddFrame(vf, new TGLayoutHints(kLHintsTop, 0, 0, 4, 0));
196
197 {
198 UInt_t labelW = 40;
199 UInt_t labelH = 20;
201 // label
202 TGCompositeFrame *labfr = new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
203 TGLabel* label = new TGLabel(labfr, "Mode:");
204 labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
205 hf->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
206 // combo
208 fProjTrackBreaking->AddEntry("Break tracks", TEveTrackPropagator::kPTB_Break);
209 fProjTrackBreaking->AddEntry("First point position", TEveTrackPropagator::kPTB_UseFirstPointPos);
210 fProjTrackBreaking->AddEntry("Last point position", TEveTrackPropagator::kPTB_UseLastPointPos);
211 fProjTrackBreaking->Connect("Selected(Int_t)", "TEveTrackPropagatorSubEditor", this, "DoModePTB(UChar_t)");
212 fProjTrackBreaking->Resize(140, labelH);
214 fRefsCont->AddFrame(hf, new TGLayoutHints(kLHintsTop, 4, 1, 1, 1));
215 }
216
218 fRnrPTBMarkers->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPTB()");
219 fRefsCont->AddFrame(fRnrPTBMarkers, new TGLayoutHints(kLHintsTop, 5, 1, 2, 0));
220 {
222 TGFrameElement *el = (TGFrameElement*) fPTBAtt->GetList()->First();
223 TGFrame *f = el->fFrame; fPTBAtt->RemoveFrame(f);
224 f->DestroyWindow(); delete f;
225 fRefsCont->AddFrame(fPTBAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
226 }
227 }
228
230}
231
232////////////////////////////////////////////////////////////////////////////////
233/// Set model object.
234
236{
237 fM = m;
238
239 fMaxR->SetValue(fM->fMaxR);
240 fMaxZ->SetValue(fM->fMaxZ);
241 fMaxOrbits->SetValue(fM->fMaxOrbs);
242 fMaxAng->SetValue(fM->GetMaxAng());
243 fDelta->SetValue(fM->GetDelta());
244
245 if(fM->fEditPathMarks)
246 {
248 fRnrDaughters->SetState(fM->fRnrDaughters ? kButtonDown : kButtonUp);
249 fRnrReferences->SetState(fM->fRnrReferences ? kButtonDown : kButtonUp);
250 fRnrDecay->SetState(fM->fRnrDecay ? kButtonDown : kButtonUp);
251 fRnrCluster2Ds->SetState(fM->fRnrCluster2Ds ? kButtonDown : kButtonUp);
252
253 fFitDaughters->SetState(fM->fFitDaughters ? kButtonDown : kButtonUp);
254 fFitReferences->SetState(fM->fFitReferences ? kButtonDown : kButtonUp);
255 fFitDecay->SetState(fM->fFitDecay ? kButtonDown : kButtonUp);
256 fFitCluster2Ds->SetState(fM->fFitCluster2Ds ? kButtonDown : kButtonUp);
257 fFitLineSegments->SetState(fM->fFitLineSegments ? kButtonDown : kButtonUp);
258
259 fPMAtt->SetModel(&fM->fPMAtt);
260 }
261 else
262 {
263 fRefsCont->HideFrame(fPMFrame);
264 }
265
266 fRnrFV->SetState(fM->fRnrFV ? kButtonDown : kButtonUp);
267 fFVAtt->SetModel(&fM->fFVAtt);
268
269 fProjTrackBreaking->Select(fM->fProjTrackBreaking, kFALSE);
270 fRnrPTBMarkers->SetState(fM->fRnrPTBMarkers ? kButtonDown : kButtonUp);
271 fPTBAtt->SetModel(&fM->fPTBAtt);
272}
273
274////////////////////////////////////////////////////////////////////////////////
275/// Emit "Changed()" signal.
276
278{
279 Emit("Changed()");
280}
281
282////////////////////////////////////////////////////////////////////////////////
283/// Slot for MaxR.
284
286{
287 fM->SetMaxR(fMaxR->GetValue());
288 Changed();
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// Slot for MaxZ.
293
295{
296 fM->SetMaxZ(fMaxZ->GetValue());
297 Changed();
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Slot for MaxOrbits.
302
304{
305 fM->SetMaxOrbs(fMaxOrbits->GetValue());
306 Changed();
307}
308
309////////////////////////////////////////////////////////////////////////////////
310/// Slot for MaxAng.
311
313{
314 fM->SetMaxAng(fMaxAng->GetValue());
315 Changed();
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Slot for Delta.
320
322{
323 fM->SetDelta(fDelta->GetValue());
324 Changed();
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Slot for FitPM.
329
331{
334 Bool_t on = b->IsOn();
335
336 switch(type)
337 {
339 fM->SetFitDaughters(on);
340 break;
342 fM->SetFitReferences(on);
343 break;
345 fM->SetFitDecay(on);
346 break;
348 fM->SetFitCluster2Ds(on);
349 break;
351 fM->SetFitLineSegments(on);
352 break;
353
354 default:
355 break;
356 }
357 Changed();
358}
359
360////////////////////////////////////////////////////////////////////////////////
361/// Slot for RnrPM.
362
364{
367 Bool_t on = b->IsOn();
368 switch(type){
370 fM->SetRnrDaughters(on);
371 break;
373 fM->SetRnrReferences(on);
374 break;
376 fM->SetRnrDecay(on);
377 break;
379 fM->SetRnrCluster2Ds(on);
380 break;
381 default:
382 break;
383 }
384 Changed();
385}
386
387////////////////////////////////////////////////////////////////////////////////
388/// Slot for RnrFV.
389
391{
392 fM->SetRnrFV(fRnrFV->IsOn());
393 Changed();
394}
395
396////////////////////////////////////////////////////////////////////////////////
397/// Slot for PTBMode.
398
400{
401 fM->SetProjTrackBreaking(mode);
402 Changed();
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Slot for RnrPTBMarkers.
407
409{
410 fM->SetRnrPTBMarkers(fRnrPTBMarkers->IsOn());
411 Changed();
412}
413
414/** \class TEveTrackPropagatorEditor
415\ingroup TEve
416GUI editor for TEveTrackPropagator.
417It's only a wrapper around a TEveTrackPropagatorSubEditor that holds actual
418widgets.
419*/
420
421
422////////////////////////////////////////////////////////////////////////////////
423/// Constructor.
424
426 Int_t width, Int_t height,
427 UInt_t options, Pixel_t back) :
428 TGedFrame(p, width, height, options | kVerticalFrame, back),
429 fM(nullptr),
430 fRSSubEditor(nullptr)
431{
432 MakeTitle("RenderStyle");
433
435 fRSSubEditor->Connect("Changed()", "TEveTrackPropagatorEditor", this, "Update()");
437
438 TGVerticalFrame* refsFrame = CreateEditorTabSubFrame("Refs");
439 {
441 (refsFrame, 145, 10, kHorizontalFrame | kFitWidth | kFixedWidth | kOwnBackground);
442 cf->AddFrame(new TGLabel(cf, "PathMarks"),
443 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
444 cf->AddFrame(new TGHorizontal3DLine(cf),
445 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
446 refsFrame->AddFrame(cf, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
447 }
448
449 // path marks
450 fRSSubEditor->CreateRefsContainer(refsFrame);
451 fRSSubEditor->fPMAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
452 fRSSubEditor->fFVAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
453
454 fRSSubEditor->Connect("Changed()", "TEveTrackPropagatorEditor", this, "Update()");
455}
456
457////////////////////////////////////////////////////////////////////////////////
458/// Set model object.
459
461{
462 fM = dynamic_cast<TEveTrackPropagator*>(obj);
463 fRSSubEditor->SetModel(fM);
464}
@ kVerticalFrame
Definition GuiTypes.h:382
@ kFixedWidth
Definition GuiTypes.h:388
@ kFitWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:383
@ kFixedSize
Definition GuiTypes.h:391
@ kOwnBackground
Definition GuiTypes.h:392
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
Definition RtypesCore.h:52
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
externTEveManager * gEve
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
externvoid * gTQSender
Definition TQObject.h:46
Implements GUI for editing marker attributes.
Composite GUI element for single value selection (supports label, number-entry and slider).
TEveTrackPropagatorEditor(const TEveTrackPropagatorEditor &)
TEveTrackPropagatorSubEditor * fRSSubEditor
void SetModel(TObject *obj) override
Set model object.
Sub-editor for TEveTrackPropagator class.
void SetModel(TEveTrackPropagator *m)
Set model object.
void CreateRefsContainer(TGVerticalFrame *p)
Create a frame containing track-reference controls under parent frame p.
void DoModePTB(UChar_t mode)
Slot for PTBMode.
void DoRnrPTB()
Slot for RnrPTBMarkers.
void Changed()
Emit "Changed()" signal.
TEveTrackPropagatorSubEditor(const TEveTrackPropagatorSubEditor &)
Holding structure for a number of track rendering parameters.
static Double_t fgEditorMaxZ
static Double_t fgEditorMaxR
A button abstract base class.
Definition TGButton.h:68
Selects different options.
Definition TGButton.h:264
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:992
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
TGCompositeFrame(const TGCompositeFrame &)=delete
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1196
TGFrame * fFrame
Definition TGLayout.h:112
TGFrame(const TGFrame &)=delete
A composite frame with a border and a title.
Definition TGFrame.h:532
virtual void SetTitlePos(ETitlePos pos=kLeft)
Definition TGFrame.h:574
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
This layout managers does not make use of TGLayoutHints.
Definition TGLayout.h:269
@ kNESRealOne
Fixed fraction real, one digit.
@ kNESRealThree
Fixed fraction real, three digit.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
TGVerticalFrame(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Definition TGFrame.h:378
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
TGedFrame(const TGedFrame &)=delete
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:94
Mother of all ROOT objects.
Definition TObject.h:42
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
TMarker m
Definition textangle.C:8