Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TEveTrackEditor.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
12#include "TEveTrackEditor.h"
13#include "TEveTrack.h"
14#include "TEveTrackPropagator.h"
16#include "TEveManager.h"
17
18#include "TEveGValuators.h"
19
20#include "TGedEditor.h"
21#include "TAttMarkerEditor.h"
22#include "TGLabel.h"
23#include "TG3DLine.h"
24#include "TGButton.h"
25#include "TGDoubleSlider.h"
26
27/** \class TEveTrackEditor
28\ingroup TEve
29Editor for TEveTrack class.
30*/
31
32
33////////////////////////////////////////////////////////////////////////////////
34/// Constructor.
35
37 UInt_t options, Pixel_t back) :
38 TGedFrame(p, width, height, options | kVerticalFrame, back),
39 fM(nullptr),
40 fRSEditor(nullptr)
41{
42 MakeTitle("TEveTrack");
43
45
46 fRSEditor = new TGTextButton(f, "Edit Propagator");
47 fRSEditor->Connect("Clicked()", "TEveTrackEditor", this, "DoEditPropagator()");
48 f->AddFrame(fRSEditor, new TGLayoutHints(kLHintsLeft, 2, 1, 4, 4));
49
50 AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Set model object.
55
57{
58 fM = dynamic_cast<TEveTrack*>(obj);
59}
60
61////////////////////////////////////////////////////////////////////////////////
62/// Slot for EditPropagator.
63
65{
66 fGedEditor->SetModel(fGedEditor->GetPad(), fM->GetPropagator(), kButton1Down);
67}
68
69/** \class TEveTrackListEditor
70\ingroup TEve
71Editor for TEveTrackList class.
72*/
73
74
75////////////////////////////////////////////////////////////////////////////////
76/// Constructor.
77
79 Int_t width, Int_t height,
80 UInt_t options, Pixel_t back) :
81 TGedFrame(p, width, height, options | kVerticalFrame, back),
82
83 fTC (nullptr),
84 fPtRange (nullptr),
85 fPRange (nullptr),
86 fRSSubEditor(nullptr)
87{
88 {
90
91 fRnrPoints = new TGCheckButton(f, "Draw Marker");
92 f->AddFrame(fRnrPoints, new TGLayoutHints(kLHintsLeft, 2,1,0,0));
93 fRnrPoints->Connect("Toggled(Bool_t)", "TEveTrackListEditor", this, "DoRnrPoints()");
94
95 fRnrLine = new TGCheckButton(f, "Draw Line");
96 f->AddFrame(fRnrLine, new TGLayoutHints(kLHintsLeft, 1,2,0,0));
97 fRnrLine->Connect("Toggled(Bool_t)", "TEveTrackListEditor", this, "DoRnrLine()");
98
99 AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
100 }
101 { // --- Selectors
102 Int_t labelW = 51;
103 Int_t dbW = 210;
104
105 fPtRange = new TEveGDoubleValuator(this,"Pt rng:", 40, 0);
106 fPtRange->SetNELength(6);
107 fPtRange->SetLabelWidth(labelW);
108 fPtRange->Build();
109 fPtRange->GetSlider()->SetWidth(dbW);
110 fPtRange->SetLimits(0, 10, TGNumberFormat::kNESRealTwo);
111 fPtRange->Connect("ValueSet()",
112 "TEveTrackListEditor", this, "DoPtRange()");
113 AddFrame(fPtRange, new TGLayoutHints(kLHintsTop, 1, 1, 4, 1));
114
115 fPRange = new TEveGDoubleValuator(this,"P rng:", 40, 0);
116 fPRange->SetNELength(6);
117 fPRange->SetLabelWidth(labelW);
118 fPRange->Build();
119 fPRange->GetSlider()->SetWidth(dbW);
120 fPRange->SetLimits(0, 100, TGNumberFormat::kNESRealTwo);
121 fPRange->Connect("ValueSet()",
122 "TEveTrackListEditor", this, "DoPRange()");
123 AddFrame(fPRange, new TGLayoutHints(kLHintsTop, 1, 1, 4, 1));
124 }
125
126 MakeTitle("RenderStyle");
128 fRSSubEditor->Connect("Changed()", "TEveTrackListEditor", this, "Update()");
131}
132
133////////////////////////////////////////////////////////////////////////////////
134/// Create tab for control of path-mark display.
135
137{
139
140 TGCompositeFrame *title1 = new TGCompositeFrame(fRefs, 145, 10,
142 kFitWidth |
145 title1->AddFrame(new TGLabel(title1, "PathMarks"),
146 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
147 title1->AddFrame(new TGHorizontal3DLine(title1),
148 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
149 fRefs->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
150
151 // path marks
152 fRSSubEditor->CreateRefsContainer(fRefs);
153 fRSSubEditor->fPMAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
154 fRSSubEditor->fFVAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
155}
156
157////////////////////////////////////////////////////////////////////////////////
158/// Set model object.
159
161{
162 fTC = dynamic_cast<TEveTrackList*>(obj);
163 fRnrLine ->SetState(fTC->GetRnrLine() ? kButtonDown : kButtonUp);
164 fRnrPoints->SetState(fTC->GetRnrPoints() ? kButtonDown : kButtonUp);
165
166 Float_t llim;
167 fPtRange->SetValues(fTC->fMinPt, fTC->fMaxPt);
168 llim = fTC->fLimPt > 1 ? TMath::Log10(fTC->fLimPt) : 0;
169 fPtRange->SetLimits(0, fTC->fLimPt, llim < 2 ? TGNumberFormat::kNESRealTwo : (llim < 3 ? TGNumberFormat::kNESRealOne : TGNumberFormat::kNESInteger));
170 fPRange ->SetValues(fTC->fMinP, fTC->fMaxP);
171 llim = fTC->fLimP > 1 ? TMath::Log10(fTC->fLimP) : 0;
172 fPRange ->SetLimits(0, fTC->fLimP, llim < 2 ? TGNumberFormat::kNESRealTwo : (llim < 3 ? TGNumberFormat::kNESRealOne : TGNumberFormat::kNESInteger));
173
174 fRSSubEditor->SetModel(fTC->GetPropagator());
175}
176
177////////////////////////////////////////////////////////////////////////////////
178/// Slot for RnrLine.
179
181{
182 fTC->SetRnrLine(fRnrLine->IsOn());
183 Update();
184}
185
186////////////////////////////////////////////////////////////////////////////////
187/// Slot for RnrPoints.
188
190{
191 fTC->SetRnrPoints(fRnrPoints->IsOn());
192 Update();
193}
194
195////////////////////////////////////////////////////////////////////////////////
196/// Slot for PtRange.
197
199{
200 fTC->SelectByPt(fPtRange->GetMin(), fPtRange->GetMax());
201 Update();
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Slot for PRange.
206
208{
209 fTC->SelectByP(fPRange->GetMin(), fPRange->GetMax());
210 Update();
211}
212
@ kButton1Down
Definition Buttons.h:17
@ kVerticalFrame
Definition GuiTypes.h:382
@ kFixedWidth
Definition GuiTypes.h:388
@ kFitWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:383
@ kOwnBackground
Definition GuiTypes.h:392
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define f(i)
Definition RSha256.hxx:104
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
externTEveManager * gEve
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
Composite GUI element for selection of range (label, two number-entries and double-slider).
void DoEditPropagator()
Slot for EditPropagator.
TEveTrackEditor(const TEveTrackEditor &)
TGTextButton * fRSEditor
void SetModel(TObject *obj) override
Set model object.
void CreateRefsTab()
Create tab for control of path-mark display.
TEveTrackListEditor(const TEveTrackListEditor &)
void DoRnrPoints()
Slot for RnrPoints.
TEveGDoubleValuator * fPtRange
TGCheckButton * fRnrPoints
TGVerticalFrame * fRefs
TGCheckButton * fRnrLine
TEveGDoubleValuator * fPRange
void SetModel(TObject *obj) override
Set model object.
TEveTrackPropagatorSubEditor * fRSSubEditor
void DoRnrLine()
Slot for RnrLine.
void DoPRange()
Slot for PRange.
TEveTrackList * fTC
void DoPtRange()
Slot for PtRange.
A list of tracks supporting change of common attributes and selection based on track parameters.
Definition TEveTrack.h:140
Sub-editor for TEveTrackPropagator class.
Visual representation of a track.
Definition TEveTrack.h:33
Selects different options.
Definition TGButton.h:264
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
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
@ kNESRealOne
Fixed fraction real, one digit.
@ kNESInteger
Style of number entry field.
@ kNESRealTwo
Fixed fraction real, two digit.
Yield an action as soon as it is clicked.
Definition TGButton.h:142
ROOT GUI Window base class.
Definition TGWindow.h:23
TGedEditor * fGedEditor
manager of this frame
Definition TGedFrame.h:48
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
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:71
Mother of all ROOT objects.
Definition TObject.h:42
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition TMath.h:773