Logo ROOT  
Reference Guide
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:
29 enum EPType_e { kPT_Unknown, kPT_RPhi, kPT_RhoZ, kPT_3D, kPT_End }; // projection type
30 enum EPProc_e { kPP_Plane, kPP_Distort, kPP_Full }; // projection procedure
31 enum EGeoMode_e { kGM_Unknown, kGM_Polygons, kGM_Segments }; // strategy for geometry projections
32
34 {
38
40 fMin(0), fMax(0), fOffset(0), fScale(1) {}
42 fMin(min), fMax(max), fOffset(off), fScale(scale) {}
43
44 virtual ~PreScaleEntry_t() {}
45
47 };
48
49 typedef std::vector<PreScaleEntry_t> vPreScale_t;
50 typedef std::vector<PreScaleEntry_t>::iterator vPreScale_i;
51
52protected:
53 EPType_e fType; // type
54 EGeoMode_e fGeoMode; // strategy of polygon projection (what to try first)
55 TString fName; // name
56
57 TEveVector fCenter; // center of distortion
58
59 bool fDisplaceOrigin; // displace point before projection
60
61 Bool_t fUsePreScale; // use pre-scaling
62 vPreScale_t fPreScales[3]; // scaling before the distortion
63
64 Float_t fDistortion; // distortion
65 Float_t fFixR; // radius from which scaling remains constant
66 Float_t fFixZ; // z-coordinate from which scaling remains constant
67 Float_t fPastFixRFac; // relative scaling factor beyond fFixR as 10^x
68 Float_t fPastFixZFac; // relative scaling factor beyond fFixZ as 10^x
69 Float_t fScaleR; // scale factor to keep projected radius at fFixR fixed
70 Float_t fScaleZ; // scale factor to keep projected z-coordinate at fFixZ fixed
71 Float_t fPastFixRScale; // relative scaling beyond fFixR
72 Float_t fPastFixZScale; // relative scaling beyond fFixZ
73 Float_t fMaxTrackStep; // maximum distance between two points on a track
74
75 void PreScaleVariable(Int_t dim, Float_t& v);
76
77public:
79 virtual ~TEveProjection() {}
80
81 virtual Bool_t Is2D() const = 0;
82 virtual Bool_t Is3D() const = 0;
83
84 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e p = kPP_Full) = 0;
85
89
90 void ProjectPointfv(const TEveTrans* t, const Float_t* p, Float_t* v, Float_t d);
91 void ProjectPointdv(const TEveTrans* t, const Double_t* p, Double_t* v, Float_t d);
92 void ProjectVector(const TEveTrans* t, TEveVector& v, Float_t d);
93
94 const Char_t* GetName() const { return fName.Data(); }
95 void SetName(const Char_t* txt) { fName = txt; }
96
97 const TEveVector& RefCenter() const { return fCenter; }
98 virtual void SetCenter(TEveVector& v) { fCenter = v; }
99 virtual Float_t* GetProjectedCenter();
100
101 void SetDisplaceOrigin(bool);
103
104 void SetType(EPType_e t) { fType = t; }
105 EPType_e GetType() const { return fType; }
106
108 EGeoMode_e GetGeoMode() const { return fGeoMode; }
109
112
114 void PreScalePoint(Float_t& x, Float_t& y, Float_t& z);
115 void AddPreScaleEntry(Int_t coord, Float_t max_val, Float_t scale);
116 void ChangePreScaleEntry(Int_t coord, Int_t entry, Float_t new_scale);
117 void ClearPreScales();
118
119 void SetDistortion(Float_t d);
121 Float_t GetFixR() const { return fFixR; }
122 Float_t GetFixZ() const { return fFixZ; }
123 void SetFixR(Float_t x);
124 void SetFixZ(Float_t x);
131
132 virtual Bool_t HasSeveralSubSpaces() const { return kFALSE; }
133 virtual Bool_t AcceptSegment(TEveVector&, TEveVector&, Float_t /*tolerance*/) const { return kTRUE; }
134 virtual Int_t SubSpaceId(const TEveVector&) const { return 0; }
135 virtual Bool_t IsOnSubSpaceBoundrary(const TEveVector&) const { return kFALSE; }
136 virtual void BisectBreakPoint(TEveVector& vL, TEveVector& vR, Float_t eps_sqr);
137 virtual void BisectBreakPoint(TEveVector& vL, TEveVector& vR, Bool_t project_result=kFALSE, Float_t depth=0);
138 virtual void SetDirectionalVector(Int_t screenAxis, TEveVector& vec);
139
140 // utils to draw axis
142 virtual Float_t GetValForScreenPos(Int_t ax, Float_t value);
143 virtual Float_t GetScreenVal(Int_t ax, Float_t value);
144 Float_t GetScreenVal(Int_t i, Float_t x, TEveVector& dirVec, TEveVector& oCenter);
146
147
148 static Float_t fgEps; // resolution of projected points
149 static Float_t fgEpsSqr; // square of resolution of projected points
150
151 ClassDef(TEveProjection, 0); // Base for specific classes that implement non-linear projections.
152};
153
154
155//==============================================================================
156// TEveRhoZProjection
157//==============================================================================
158
160{
161private:
162 TEveVector fProjectedCenter; // projected center of distortion.
163
164public:
167
168 virtual Bool_t Is2D() const { return kTRUE; }
169 virtual Bool_t Is3D() const { return kFALSE; }
170
171 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
172
173 virtual void SetCenter(TEveVector& v);
175
176 virtual Bool_t HasSeveralSubSpaces() const { return kTRUE; }
177 virtual Bool_t AcceptSegment(TEveVector& v1, TEveVector& v2, Float_t tolerance) const;
178 virtual Int_t SubSpaceId(const TEveVector& v) const;
179 virtual Bool_t IsOnSubSpaceBoundrary(const TEveVector& v) const;
180 virtual void SetDirectionalVector(Int_t screenAxis, TEveVector& vec);
181
182 ClassDef(TEveRhoZProjection, 0); // Rho/Z non-linear projection.
183};
184
185
186//==============================================================================
187// TEveRPhiProjection
188//==============================================================================
189
191{
192public:
195
196 virtual Bool_t Is2D() const { return kTRUE; }
197 virtual Bool_t Is3D() const { return kFALSE; }
198
199 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
200
201 ClassDef(TEveRPhiProjection, 0); // XY non-linear projection.
202};
203
204
205//==============================================================================
206// TEve3DProjection
207//==============================================================================
208
210{
211public:
213 virtual ~TEve3DProjection() {}
214
215 virtual Bool_t Is2D() const { return kFALSE; }
216 virtual Bool_t Is3D() const { return kTRUE; }
217
218 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full);
219
220 ClassDef(TEve3DProjection, 0); // 3D scaling "projection"
221};
222
223// AMT: temporary workaround till root pactches are integrated in CMSSW
224#define TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
225
226#endif
#define d(i)
Definition: RSha256.hxx:102
int Int_t
Definition: RtypesCore.h:41
char Char_t
Definition: RtypesCore.h:29
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:326
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
Float_t fPastFixRScale
Float_t fPastFixZFac
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)
Float_t fMaxTrackStep
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
Float_t fPastFixRFac
Float_t fPastFixZScale
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:57
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
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)
Definition: TMathBase.h:212
PreScaleEntry_t(Float_t min, Float_t max, Float_t off, Float_t scale)
auto * m
Definition: textangle.C:8