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 virtual Bool_t Is2D() const { return kTRUE; }
170 virtual Bool_t Is3D() const { return kFALSE; }
171
172 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
173
174 virtual void SetCenter(TEveVector& v);
176
177 virtual Bool_t HasSeveralSubSpaces() const { return kTRUE; }
178 virtual Bool_t AcceptSegment(TEveVector& v1, TEveVector& v2, Float_t tolerance) const;
179 virtual Int_t SubSpaceId(const TEveVector& v) const;
180 virtual Bool_t IsOnSubSpaceBoundrary(const TEveVector& v) const;
181 virtual void SetDirectionalVector(Int_t screenAxis, TEveVector& vec);
182
183 ClassDef(TEveRhoZProjection, 0); // Rho/Z non-linear projection.
184};
185
186
187//==============================================================================
188// TEveRPhiProjection
189//==============================================================================
190
192{
193public:
196
197 virtual Bool_t Is2D() const { return kTRUE; }
198 virtual Bool_t Is3D() const { return kFALSE; }
199
200 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
201
202 ClassDef(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 virtual ~TEveXZProjection() {}
218
219 virtual Bool_t Is2D() const { return kTRUE; }
220 virtual Bool_t Is3D() const { return kFALSE; }
221
222 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
223
224 virtual void SetCenter(TEveVector& v);
226
227 virtual void SetDirectionalVector(Int_t screenAxis, TEveVector& vec);
228
229 ClassDef(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 virtual ~TEveYZProjection() {}
245
246 virtual Bool_t Is2D() const { return kTRUE; }
247 virtual Bool_t Is3D() const { return kFALSE; }
248
249 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
250
251 virtual void SetCenter(TEveVector& v);
253
254 virtual void SetDirectionalVector(Int_t screenAxis, TEveVector& vec);
255
256 ClassDef(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 virtual ~TEveZXProjection() {}
272
273 virtual Bool_t Is2D() const { return kTRUE; }
274 virtual Bool_t Is3D() const { return kFALSE; }
275
276 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
277
278 virtual void SetCenter(TEveVector& v);
280
281 virtual void SetDirectionalVector(Int_t screenAxis, TEveVector& vec);
282
283 ClassDef(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 virtual ~TEveZYProjection() {}
299
300 virtual Bool_t Is2D() const { return kTRUE; }
301 virtual Bool_t Is3D() const { return kFALSE; }
302
303 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
304
305 virtual void SetCenter(TEveVector& v);
307
308 virtual void SetDirectionalVector(Int_t screenAxis, TEveVector& vec);
309
310 ClassDef(TEveZYProjection, 0); // XY non-linear projection.
311};
312
313
314//==============================================================================
315// TEve3DProjection
316//==============================================================================
317
319{
320public:
322 virtual ~TEve3DProjection() {}
323
324 virtual Bool_t Is2D() const { return kFALSE; }
325 virtual Bool_t Is3D() const { return kTRUE; }
326
327 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
328
329 ClassDef(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
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.
virtual ~TEve3DProjection()
virtual Bool_t Is2D() const
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full)
Project point.
virtual Bool_t Is3D() const
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.
virtual ~TEveRPhiProjection()
TEveRPhiProjection()
Constructor.
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full)
Project point.
virtual Bool_t Is3D() const
virtual Bool_t Is2D() const
Transformation from 3D to 2D.
TEveVector fProjectedCenter
virtual ~TEveRhoZProjection()
virtual Bool_t IsOnSubSpaceBoundrary(const TEveVector &v) const
Checks if point is on sub-space boundary.
virtual Bool_t AcceptSegment(TEveVector &v1, TEveVector &v2, Float_t tolerance) const
Check if segment of two projected points is valid.
virtual void SetDirectionalVector(Int_t screenAxis, TEveVector &vec)
Get direction in the unprojected space for axis index in the projected space.
TEveRhoZProjection()
Constructor.
virtual void SetCenter(TEveVector &v)
Set center of distortion (virtual method).
virtual Float_t * GetProjectedCenter()
Get projected center.
virtual Int_t SubSpaceId(const TEveVector &v) const
Return sub-space id for the point.
virtual Bool_t Is2D() const
virtual Bool_t Is3D() const
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full)
Project point.
virtual Bool_t HasSeveralSubSpaces() const
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.
virtual Bool_t Is3D() const
TEveXZProjection()
Constructor.
virtual ~TEveXZProjection()
TEveVector fProjectedCenter
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full)
Project point.
virtual void SetDirectionalVector(Int_t screenAxis, TEveVector &vec)
Get direction in the unprojected space for axis index in the projected space.
virtual void SetCenter(TEveVector &v)
Set center of distortion (virtual method).
virtual Float_t * GetProjectedCenter()
Get projected center.
virtual Bool_t Is2D() const
YZ projection with distortion around given center.
TEveVector fProjectedCenter
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full)
Project point.
virtual void SetDirectionalVector(Int_t screenAxis, TEveVector &vec)
Get direction in the unprojected space for axis index in the projected space.
virtual Float_t * GetProjectedCenter()
Get projected center.
virtual Bool_t Is3D() const
TEveYZProjection()
Constructor.
virtual Bool_t Is2D() const
virtual void SetCenter(TEveVector &v)
Set center of distortion (virtual method).
virtual ~TEveYZProjection()
ZX projection with distortion around given center.
virtual Float_t * GetProjectedCenter()
Get projected center.
TEveZXProjection()
Constructor.
virtual void SetDirectionalVector(Int_t screenAxis, TEveVector &vec)
Get direction in the unprojected space for axis index in the projected space.
virtual Bool_t Is3D() const
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full)
Project point.
virtual void SetCenter(TEveVector &v)
Set center of distortion (virtual method).
TEveVector fProjectedCenter
virtual ~TEveZXProjection()
virtual Bool_t Is2D() const
ZY projection with distortion around given center.
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full)
Project point.
virtual ~TEveZYProjection()
virtual Bool_t Is2D() const
TEveZYProjection()
Constructor.
virtual Float_t * GetProjectedCenter()
Get projected center.
virtual void SetDirectionalVector(Int_t screenAxis, TEveVector &vec)
Get direction in the unprojected space for axis index in the projected space.
virtual void SetCenter(TEveVector &v)
Set center of distortion (virtual method).
TEveVector fProjectedCenter
virtual Bool_t Is3D() const
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:380
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