Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveProjections.h
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#ifndef ROOT_TEveProjections
13#define ROOT_TEveProjections
14
15#include "TEveVector.h"
16#include "TString.h"
17
18#include <vector>
19
20class TEveTrans;
21
22//==============================================================================
23// TEveProjection
24//==============================================================================
25
27{
28public:
30 kPT_XZ, kPT_YZ, kPT_ZX, kPT_ZY, kPT_3D, kPT_End }; // projection type
31 enum EPProc_e { kPP_Plane, kPP_Distort, kPP_Full }; // projection procedure
32 enum EGeoMode_e { kGM_Unknown, kGM_Polygons, kGM_Segments }; // strategy for geometry projections
33
35 {
39
41 fMin(0), fMax(0), fOffset(0), fScale(1) {}
43 fMin(min), fMax(max), fOffset(off), fScale(scale) {}
44
45 virtual ~PreScaleEntry_t() {}
46
48 };
49
50 typedef std::vector<PreScaleEntry_t> vPreScale_t;
51 typedef std::vector<PreScaleEntry_t>::iterator vPreScale_i;
52
53protected:
54 EPType_e fType; // type
55 EGeoMode_e fGeoMode; // strategy of polygon projection (what to try first)
56 TString fName; // name
57
58 TEveVector fCenter; // center of distortion
59
60 bool fDisplaceOrigin; // displace point before projection
61
62 Bool_t fUsePreScale; // use pre-scaling
63 vPreScale_t fPreScales[3]; // scaling before the distortion
64
65 Float_t fDistortion; // distortion
66 Float_t fFixR; // radius from which scaling remains constant
67 Float_t fFixZ; // z-coordinate from which scaling remains constant
68 Float_t fPastFixRFac; // relative scaling factor beyond fFixR as 10^x
69 Float_t fPastFixZFac; // relative scaling factor beyond fFixZ as 10^x
70 Float_t fScaleR; // scale factor to keep projected radius at fFixR fixed
71 Float_t fScaleZ; // scale factor to keep projected z-coordinate at fFixZ fixed
72 Float_t fPastFixRScale; // relative scaling beyond fFixR
73 Float_t fPastFixZScale; // relative scaling beyond fFixZ
74 Float_t fMaxTrackStep; // maximum distance between two points on a track
75
76 void PreScaleVariable(Int_t dim, Float_t& v);
77
78public:
80 virtual ~TEveProjection() {}
81
82 virtual Bool_t Is2D() const = 0;
83 virtual Bool_t Is3D() const = 0;
84
86
90
91 void ProjectPointfv(const TEveTrans* t, const Float_t* p, Float_t* v, Float_t d);
92 void ProjectPointdv(const TEveTrans* t, const Double_t* p, Double_t* v, Float_t d);
93 void ProjectVector(const TEveTrans* t, TEveVector& v, Float_t d);
94
95 const Char_t* GetName() const { return fName.Data(); }
96 void SetName(const Char_t* txt) { fName = txt; }
97
98 const TEveVector& RefCenter() const { return fCenter; }
99 virtual void SetCenter(TEveVector& v) { fCenter = v; }
100 virtual Float_t* GetProjectedCenter();
101
102 void SetDisplaceOrigin(bool);
104
105 void SetType(EPType_e t) { fType = t; }
106 EPType_e GetType() const { return fType; }
107
109 EGeoMode_e GetGeoMode() const { return fGeoMode; }
110
113
115 void PreScalePoint(Float_t& x, Float_t& y, Float_t& z);
116 void AddPreScaleEntry(Int_t coord, Float_t max_val, Float_t scale);
117 void ChangePreScaleEntry(Int_t coord, Int_t entry, Float_t new_scale);
118 void ClearPreScales();
119
120 void SetDistortion(Float_t d);
122 Float_t GetFixR() const { return fFixR; }
123 Float_t GetFixZ() const { return fFixZ; }
124 void SetFixR(Float_t x);
125 void SetFixZ(Float_t x);
132
133 virtual Bool_t HasSeveralSubSpaces() const { return kFALSE; }
134 virtual Bool_t AcceptSegment(TEveVector&, TEveVector&, Float_t /*tolerance*/) const { return kTRUE; }
135 virtual Int_t SubSpaceId(const TEveVector&) const { return 0; }
136 virtual Bool_t IsOnSubSpaceBoundrary(const TEveVector&) const { return kFALSE; }
137 virtual void BisectBreakPoint(TEveVector& vL, TEveVector& vR, Float_t eps_sqr);
138 virtual void BisectBreakPoint(TEveVector& vL, TEveVector& vR, Bool_t project_result=kFALSE, Float_t depth=0);
139 virtual void SetDirectionalVector(Int_t screenAxis, TEveVector& vec);
140
141 // utils to draw axis
145 Float_t GetScreenVal(Int_t i, Float_t x, TEveVector& dirVec, TEveVector& oCenter);
147
148
149 static Float_t fgEps; // resolution of projected points
150 static Float_t fgEpsSqr; // square of resolution of projected points
151
152 ClassDef(TEveProjection, 0); // Base for specific classes that implement non-linear projections.
153};
154
155
156//==============================================================================
157// TEveRhoZProjection
158//==============================================================================
159
161{
162private:
163 TEveVector fProjectedCenter; // projected center of distortion.
164
165public:
168
169 Bool_t Is2D() const override { return kTRUE; }
170 Bool_t Is3D() const override { return kFALSE; }
171
172 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
173
174 void SetCenter(TEveVector& v) override;
176
177 Bool_t HasSeveralSubSpaces() const override { return kTRUE; }
178 Bool_t AcceptSegment(TEveVector& v1, TEveVector& v2, Float_t tolerance) const override;
179 Int_t SubSpaceId(const TEveVector& v) const override;
180 Bool_t IsOnSubSpaceBoundrary(const TEveVector& v) const override;
181 void SetDirectionalVector(Int_t screenAxis, TEveVector& vec) override;
182
183 ClassDefOverride(TEveRhoZProjection, 0); // Rho/Z non-linear projection.
184};
185
186
187//==============================================================================
188// TEveRPhiProjection
189//==============================================================================
190
192{
193public:
196
197 Bool_t Is2D() const override { return kTRUE; }
198 Bool_t Is3D() const override { return kFALSE; }
199
200 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
201
202 ClassDefOverride(TEveRPhiProjection, 0); // XY non-linear projection.
203};
204
205
206//==============================================================================
207// TEveXZProjection
208//==============================================================================
209
211{
212private:
213 TEveVector fProjectedCenter; // projected center of distortion.
214
215public:
217 ~TEveXZProjection() override {}
218
219 Bool_t Is2D() const override { return kTRUE; }
220 Bool_t Is3D() const override { return kFALSE; }
221
222 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
223
224 void SetCenter(TEveVector& v) override;
226
227 void SetDirectionalVector(Int_t screenAxis, TEveVector& vec) override;
228
229 ClassDefOverride(TEveXZProjection, 0); // XZ non-linear projection.
230};
231
232
233//==============================================================================
234// TEveYZProjection
235//==============================================================================
236
238{
239private:
240 TEveVector fProjectedCenter; // projected center of distortion.
241
242public:
244 ~TEveYZProjection() override {}
245
246 Bool_t Is2D() const override { return kTRUE; }
247 Bool_t Is3D() const override { return kFALSE; }
248
249 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
250
251 void SetCenter(TEveVector& v) override;
253
254 void SetDirectionalVector(Int_t screenAxis, TEveVector& vec) override;
255
256 ClassDefOverride(TEveYZProjection, 0); // XY non-linear projection.
257};
258
259
260//==============================================================================
261// TEveZXProjection
262//==============================================================================
263
265{
266private:
267 TEveVector fProjectedCenter; // projected center of distortion.
268
269public:
271 ~TEveZXProjection() override {}
272
273 Bool_t Is2D() const override { return kTRUE; }
274 Bool_t Is3D() const override { return kFALSE; }
275
276 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
277
278 void SetCenter(TEveVector& v) override;
280
281 void SetDirectionalVector(Int_t screenAxis, TEveVector& vec) override;
282
283 ClassDefOverride(TEveZXProjection, 0); // XZ non-linear projection.
284};
285
286
287//==============================================================================
288// TEveZYProjection
289//==============================================================================
290
292{
293private:
294 TEveVector fProjectedCenter; // projected center of distortion.
295
296public:
298 ~TEveZYProjection() override {}
299
300 Bool_t Is2D() const override { return kTRUE; }
301 Bool_t Is3D() const override { return kFALSE; }
302
303 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
304
305 void SetCenter(TEveVector& v) override;
307
308 void SetDirectionalVector(Int_t screenAxis, TEveVector& vec) override;
309
310 ClassDefOverride(TEveZYProjection, 0); // XY non-linear projection.
311};
312
313
314//==============================================================================
315// TEve3DProjection
316//==============================================================================
317
319{
320public:
322 ~TEve3DProjection() override {}
323
324 Bool_t Is2D() const override { return kFALSE; }
325 Bool_t Is3D() const override { return kTRUE; }
326
327 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
328
329 ClassDefOverride(TEve3DProjection, 0); // 3D scaling "projection"
330};
331
332// AMT: temporary workaround till root pactches are integrated in CMSSW
333#define TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
334
335#endif
#define d(i)
Definition RSha256.hxx:102
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
char Char_t
Definition RtypesCore.h:37
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDef(name, id)
Definition Rtypes.h:337
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
3D scaling projection.
~TEve3DProjection() override
Bool_t Is2D() const override
Bool_t Is3D() const override
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
TEve3DProjection()
Constructor.
Base-class for non-linear projections.
virtual void SetCenter(TEveVector &v)
virtual Int_t SubSpaceId(const TEveVector &) const
const TEveVector & RefCenter() const
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e p=kPP_Full)=0
static Float_t fgEpsSqr
void SetType(EPType_e t)
void SetDistortion(Float_t d)
Set distortion.
static Float_t fgEps
Float_t GetLimit(Int_t i, Bool_t pos)
Method previously used by TEveProjectionAxesGL. Now obsolete.
void AddPreScaleEntry(Int_t coord, Float_t max_val, Float_t scale)
Add new scaling range for given coordinate.
virtual Float_t GetValForScreenPos(Int_t ax, Float_t value)
Inverse projection.
void SetPastFixRFac(Float_t x)
Set 2's-exponent for relative scaling beyond FixR.
virtual Float_t GetScreenVal(Int_t ax, Float_t value)
Project point on given axis and return projected value.
Float_t GetFixZ() const
Float_t GetFixR() const
vPreScale_t fPreScales[3]
void SetName(const Char_t *txt)
EGeoMode_e GetGeoMode() const
virtual void SetDirectionalVector(Int_t screenAxis, TEveVector &vec)
Get vector for axis in a projected space.
virtual void BisectBreakPoint(TEveVector &vL, TEveVector &vR, Float_t eps_sqr)
Find break-point on both sides of the discontinuity.
EGeoMode_e fGeoMode
void SetFixR(Float_t x)
Set fixed radius.
TEveVector GetOrthogonalCenter(int idx, TEveVector &out)
Get center ortogonal to given axis index.
Bool_t GetDisplaceOrigin() const
virtual Bool_t Is2D() const =0
void ProjectPointfv(Float_t *v, Float_t d)
Project float array.
virtual ~TEveProjection()
void SetPastFixZFac(Float_t x)
Set 2's-exponent for relative scaling beyond FixZ.
Bool_t GetUsePreScale() const
void ChangePreScaleEntry(Int_t coord, Int_t entry, Float_t new_scale)
Change scale for given entry and coordinate.
TEveVector fCenter
virtual Bool_t HasSeveralSubSpaces() const
void SetGeoMode(EGeoMode_e m)
void SetDisplaceOrigin(bool)
Set flag to displace for center.
std::vector< PreScaleEntry_t > vPreScale_t
void PreScalePoint(Float_t &x, Float_t &y)
Pre-scale point (x, y) in projected coordinates for 2D projections:
virtual Bool_t Is3D() const =0
std::vector< PreScaleEntry_t >::iterator vPreScale_i
void SetMaxTrackStep(Float_t x)
TEveProjection()
Constructor.
Float_t GetPastFixRFac() const
void ProjectVector(TEveVector &v, Float_t d)
Project TEveVector.
EPType_e GetType() const
void ProjectPointdv(Double_t *v, Float_t d)
Project double array.
virtual Bool_t IsOnSubSpaceBoundrary(const TEveVector &) const
Float_t GetDistortion() const
void SetUsePreScale(Bool_t x)
Float_t GetPastFixZFac() const
void SetFixZ(Float_t x)
Set fixed radius.
void ClearPreScales()
Clear all pre-scaling information.
const Char_t * GetName() const
Float_t GetMaxTrackStep() const
void PreScaleVariable(Int_t dim, Float_t &v)
Pre-scale single variable with pre-scale entry dim.
virtual Bool_t AcceptSegment(TEveVector &, TEveVector &, Float_t) const
virtual Float_t * GetProjectedCenter()
Get projected center.
XY projection with distortion around given center.
~TEveRPhiProjection() override
TEveRPhiProjection()
Constructor.
Bool_t Is2D() const override
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Bool_t Is3D() const override
Transformation from 3D to 2D.
Bool_t IsOnSubSpaceBoundrary(const TEveVector &v) const override
Checks if point is on sub-space boundary.
Bool_t HasSeveralSubSpaces() const override
TEveVector fProjectedCenter
Float_t * GetProjectedCenter() override
Get projected center.
void SetDirectionalVector(Int_t screenAxis, TEveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
TEveRhoZProjection()
Constructor.
~TEveRhoZProjection() override
Int_t SubSpaceId(const TEveVector &v) const override
Return sub-space id for the point.
Bool_t Is3D() const override
Bool_t AcceptSegment(TEveVector &v1, TEveVector &v2, Float_t tolerance) const override
Check if segment of two projected points is valid.
Bool_t Is2D() const override
void SetCenter(TEveVector &v) override
Set center of distortion (virtual method).
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Definition TEveTrans.h:27
const TT * Arr() const
Definition TEveVector.h:58
XZ projection with distortion around given center.
void SetCenter(TEveVector &v) override
Set center of distortion (virtual method).
Bool_t Is3D() const override
void SetDirectionalVector(Int_t screenAxis, TEveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
Float_t * GetProjectedCenter() override
Get projected center.
Bool_t Is2D() const override
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
TEveXZProjection()
Constructor.
~TEveXZProjection() override
TEveVector fProjectedCenter
YZ projection with distortion around given center.
Float_t * GetProjectedCenter() override
Get projected center.
void SetCenter(TEveVector &v) override
Set center of distortion (virtual method).
Bool_t Is2D() const override
TEveVector fProjectedCenter
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
void SetDirectionalVector(Int_t screenAxis, TEveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
TEveYZProjection()
Constructor.
~TEveYZProjection() override
Bool_t Is3D() const override
ZX projection with distortion around given center.
void SetDirectionalVector(Int_t screenAxis, TEveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
void SetCenter(TEveVector &v) override
Set center of distortion (virtual method).
TEveZXProjection()
Constructor.
Bool_t Is2D() const override
TEveVector fProjectedCenter
~TEveZXProjection() override
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Bool_t Is3D() const override
Float_t * GetProjectedCenter() override
Get projected center.
ZY projection with distortion around given center.
Bool_t Is2D() const override
TEveZYProjection()
Constructor.
void SetCenter(TEveVector &v) override
Set center of distortion (virtual method).
~TEveZYProjection() override
void SetDirectionalVector(Int_t screenAxis, TEveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
Float_t * GetProjectedCenter() override
Get projected center.
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Bool_t Is3D() const override
TEveVector fProjectedCenter
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:250
PreScaleEntry_t(Float_t min, Float_t max, Float_t off, Float_t scale)
TMarker m
Definition textangle.C:8