Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TEveProjectionManagerEditor.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
14#include "TEveGValuators.h"
15
16#include "TGComboBox.h"
17#include "TGLabel.h"
18
19/** \class TEveProjectionManagerEditor
20\ingroup TEve
21GUI editor for TEveProjectionManager class.
22*/
23
24
25////////////////////////////////////////////////////////////////////////////////
26/// Constructor.
27
29 Int_t width, Int_t height,
30 UInt_t options, Pixel_t back) :
31 TGedFrame(p, width, height, options | kVerticalFrame, back),
32 fM(nullptr),
33
34 fType(nullptr),
35 fDistortion(nullptr),
36 fFixR(nullptr), fFixZ(nullptr),
37 fPastFixRFac(nullptr), fPastFixZFac(nullptr),
38 fCurrentDepth(nullptr),
39 fMaxTrackStep(nullptr),
40
41 fCenterX(nullptr),
42 fCenterY(nullptr),
43 fCenterZ(nullptr)
44{
45 MakeTitle("TEveProjection");
46 {
48 TGLabel* lab = new TGLabel(f, "Type");
49 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 31, 1, 2));
50 fType = new TGComboBox(f);
51 fType->AddEntry("RhoZ", TEveProjection::kPT_RhoZ);
52 fType->AddEntry("RPhi", TEveProjection::kPT_RPhi);
53 fType->AddEntry("XZ", TEveProjection::kPT_XZ);
54 fType->AddEntry("YZ", TEveProjection::kPT_YZ);
55 fType->AddEntry("ZX", TEveProjection::kPT_ZX);
56 fType->AddEntry("ZY", TEveProjection::kPT_ZY);
57 fType->AddEntry("3D", TEveProjection::kPT_3D);
58 TGListBox* lb = fType->GetListBox();
59 lb->Resize(lb->GetWidth(), 2*18);
60 fType->Resize(80, 20);
61 fType->Connect("Selected(Int_t)", "TEveProjectionManagerEditor",
62 this, "DoType(Int_t)");
63 f->AddFrame(fType, new TGLayoutHints(kLHintsTop, 1, 1, 2, 4));
64 AddFrame(f);
65 }
66
67 Int_t nel = 6;
68 Int_t labelW = 60;
69 fDistortion = new TEveGValuator(this, "Distortion:", 90, 0);
70 fDistortion->SetNELength(nel);
71 fDistortion->SetLabelWidth(labelW);
72 fDistortion->Build();
73 fDistortion->SetLimits(0, 50, 101, TGNumberFormat::kNESRealTwo);
74 fDistortion->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
75 this, "DoDistortion()");
77
78
79 fFixR = new TEveGValuator(this, "FixedR:", 90, 0);
80 fFixR->SetNELength(nel);
81 fFixR->SetLabelWidth(labelW);
82 fFixR->Build();
83 fFixR->SetLimits(0, 1000, 101, TGNumberFormat::kNESRealOne);
84 fFixR->SetToolTip("Radius after which scale is kept constant.");
85 fFixR->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
86 this, "DoFixR()");
87 AddFrame(fFixR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
88
89 fFixZ = new TEveGValuator(this, "FixedZ:", 90, 0);
90 fFixZ->SetNELength(nel);
91 fFixZ->SetLabelWidth(labelW);
92 fFixZ->Build();
93 fFixZ->SetLimits(0, 1000, 101, TGNumberFormat::kNESRealOne);
94 fFixZ->SetToolTip("Z-coordinate after which scale is kept constant.");
95 fFixZ->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
96 this, "DoFixZ()");
97 AddFrame(fFixZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
98
99 fPastFixRFac = new TEveGValuator(this, "ScaleR:", 90, 0);
100 fPastFixRFac->SetNELength(nel);
101 fPastFixRFac->SetLabelWidth(labelW);
102 fPastFixRFac->Build();
103 fPastFixRFac->SetLimits(-2, 2, 101, TGNumberFormat::kNESRealTwo);
104 fPastFixRFac->SetToolTip("Relative R-scale beyond FixedR.\nExpressed as 10^x.");
105 fPastFixRFac->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
106 this, "DoPastFixRFac()");
108
109 fPastFixZFac = new TEveGValuator(this, "ScaleZ:", 90, 0);
110 fPastFixZFac->SetNELength(nel);
111 fPastFixZFac->SetLabelWidth(labelW);
112 fPastFixZFac->Build();
113 fPastFixZFac->SetLimits(-2, 2, 101, TGNumberFormat::kNESRealTwo);
114 fPastFixZFac->SetToolTip("Relative Z-scale beyond FixedZ.\nExpressed as 10^x.");
115 fPastFixZFac->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
116 this, "DoPastFixZFac()");
118
119 fCurrentDepth = new TEveGValuator(this, "CurrentZ:", 90, 0);
120 fCurrentDepth->SetNELength(nel);
121 fCurrentDepth->SetLabelWidth(labelW);
122 fCurrentDepth->Build();
123 fCurrentDepth->SetLimits(-300, 300, 601, TGNumberFormat::kNESRealTwo);
124 fCurrentDepth->SetToolTip("Z coordinate of incoming projected object.");
125 fCurrentDepth->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
126 this, "DoCurrentDepth()");
128
129 fMaxTrackStep = new TEveGValuator(this, "TrackStep:", 90, 0);
130 fMaxTrackStep->SetNELength(nel);
131 fMaxTrackStep->SetLabelWidth(labelW);
132 fMaxTrackStep->Build();
133 fMaxTrackStep->SetLimits(1, 100, 100, TGNumberFormat::kNESRealOne);
134 fMaxTrackStep->SetToolTip("Maximum step between two consecutive track-points to avoid artefacts due to projective distortions.\nTaken into account automatically during projection procedure.");
135 fMaxTrackStep->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
136 this, "DoMaxTrackStep()");
138
139 // --------------------------------
140
141 MakeTitle("Distortion centre");
142 fCenterFrame = new TGVerticalFrame(this);
143
144 fCenterX = new TEveGValuator(fCenterFrame, "CenterX:", 90, 0);
145 fCenterX->SetNELength(nel);
146 fCenterX->SetLabelWidth(labelW);
147 fCenterX->Build();
148 fCenterX->SetLimits(-5, 5, 501, TGNumberFormat::kNESRealThree);
149 fCenterX->SetToolTip("Origin of the projection.");
150 fCenterX->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
151 this, "DoCenter()");
152 fCenterFrame->AddFrame(fCenterX, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
153
154 fCenterY = new TEveGValuator(fCenterFrame, "CenterY:", 90, 0);
155 fCenterY->SetNELength(nel);
156 fCenterY->SetLabelWidth(labelW);
157 fCenterY->Build();
158 fCenterY->SetLimits(-5, 5, 501, TGNumberFormat::kNESRealThree);
159 fCenterY->SetToolTip("Origin of the projection.");
160 fCenterY->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
161 this, "DoCenter()");
162 fCenterFrame->AddFrame(fCenterY, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
163
164 fCenterZ = new TEveGValuator(fCenterFrame, "CenterZ:", 90, 0);
165 fCenterZ->SetNELength(nel);
166 fCenterZ->SetLabelWidth(labelW);
167 fCenterZ->Build();
168 fCenterZ->SetLimits(-25, 25, 501, TGNumberFormat::kNESRealThree);
169 fCenterZ->SetToolTip("Origin of the projection.");
170 fCenterZ->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
171 this, "DoCenter()");
172 fCenterFrame->AddFrame(fCenterZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
173
175}
176
177////////////////////////////////////////////////////////////////////////////////
178/// Set model object.
179
181{
182 fM = dynamic_cast<TEveProjectionManager*>(obj);
183
184 fType->Select(fM->GetProjection()->GetType(), kFALSE);
185 fDistortion->SetValue(1000.0f * fM->GetProjection()->GetDistortion());
186 fFixR->SetValue(fM->GetProjection()->GetFixR());
187 fFixZ->SetValue(fM->GetProjection()->GetFixZ());
188 fPastFixRFac->SetValue(fM->GetProjection()->GetPastFixRFac());
189 fPastFixZFac->SetValue(fM->GetProjection()->GetPastFixZFac());
190 fCurrentDepth->SetValue(fM->GetCurrentDepth());
191 fMaxTrackStep->SetValue(fM->GetProjection()->GetMaxTrackStep());
192
193 fCenterX->SetValue(fM->GetCenter().fX);
194 fCenterY->SetValue(fM->GetCenter().fY);
195 fCenterZ->SetValue(fM->GetCenter().fZ);
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Slot for setting of projection type.
200
202{
203 try
204 {
205 fM->SetProjection((TEveProjection::EPType_e)type);
206 fM->ProjectChildren();
207 Update();
208 }
209 catch (...)
210 {
211 SetModel(fM);
212 throw;
213 }
214}
215
216////////////////////////////////////////////////////////////////////////////////
217/// Slot for setting distortion.
218
220{
221 fM->GetProjection()->SetDistortion(0.001f * fDistortion->GetValue());
222 fM->UpdateName();
223 fM->ProjectChildren();
224 Update();
225}
226
227////////////////////////////////////////////////////////////////////////////////
228/// Slot for setting fixed radius.
229
231{
232 fM->GetProjection()->SetFixR(fFixR->GetValue());
233 fM->ProjectChildren();
234 Update();
235}
236
237////////////////////////////////////////////////////////////////////////////////
238/// Slot for setting fixed z-coordinate.
239
241{
242 fM->GetProjection()->SetFixZ(fFixZ->GetValue());
243 fM->ProjectChildren();
244 Update();
245}
246
247////////////////////////////////////////////////////////////////////////////////
248/// Slot for setting fixed radius.
249
251{
252 fM->GetProjection()->SetPastFixRFac(fPastFixRFac->GetValue());
253 fM->ProjectChildren();
254 Update();
255}
256
257////////////////////////////////////////////////////////////////////////////////
258/// Slot for setting fixed z-coordinate.
259
261{
262 fM->GetProjection()->SetPastFixZFac(fPastFixZFac->GetValue());
263 fM->ProjectChildren();
264 Update();
265}
266
267////////////////////////////////////////////////////////////////////////////////
268/// Slot for setting current depth.
269
271{
272 fM->SetCurrentDepth(fCurrentDepth->GetValue());
273 fM->ProjectChildren();
274 Update();
275}
276
277////////////////////////////////////////////////////////////////////////////////
278/// Slot for setting fixed z-coordinate.
279
281{
282 fM->GetProjection()->SetMaxTrackStep(fMaxTrackStep->GetValue());
283 fM->ProjectChildren();
284 Update();
285}
286
287////////////////////////////////////////////////////////////////////////////////
288/// Slot for setting center of distortion.
289
291{
292 fM->SetCenter(fCenterX->GetValue(), fCenterY->GetValue(), fCenterZ->GetValue());
293 Update();
294}
295
@ kVerticalFrame
Definition GuiTypes.h:382
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
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
Composite GUI element for single value selection (supports label, number-entry and slider).
void DoPastFixZFac()
Slot for setting fixed z-coordinate.
void SetModel(TObject *obj) override
Set model object.
void DoCurrentDepth()
Slot for setting current depth.
void DoType(Int_t type)
Slot for setting of projection type.
TEveProjectionManagerEditor(const TEveProjectionManagerEditor &)
void DoMaxTrackStep()
Slot for setting fixed z-coordinate.
void DoCenter()
Slot for setting center of distortion.
void DoDistortion()
Slot for setting distortion.
void DoFixZ()
Slot for setting fixed z-coordinate.
void DoFixR()
Slot for setting fixed radius.
void DoPastFixRFac()
Slot for setting fixed radius.
Manager class for steering of projections and managing projected objects.
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 AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
UInt_t GetWidth() const
Definition TGFrame.h:226
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
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
@ kNESRealOne
Fixed fraction real, one digit.
@ kNESRealThree
Fixed fraction real, three digit.
@ kNESRealTwo
Fixed fraction real, two digit.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
ROOT GUI Window base class.
Definition TGWindow.h:23
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