Logo ROOT  
Reference Guide
REveProjections.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, 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 ROOT7_REveProjections
13#define ROOT7_REveProjections
14
15#include <ROOT/REveVector.hxx>
16
17#include <vector>
18
19namespace ROOT {
20namespace Experimental {
21
22class REveTrans;
23
24///////////////////////////////////////////////////////////////////////////////
25/// REveProjection
26/// Base for specific classes that implement non-linear projections.
27///////////////////////////////////////////////////////////////////////////////
28
30public:
31 enum EPType_e { kPT_Unknown, kPT_RPhi, kPT_RhoZ, kPT_3D, kPT_End }; // projection type
32 enum EPProc_e { kPP_Plane, kPP_Distort, kPP_Full }; // projection procedure
33 enum EGeoMode_e { kGM_Unknown, kGM_Polygons, kGM_Segments }; // strategy for geometry projections
34
39
40 PreScaleEntry_t() = default;
41
43 : fMin(min), fMax(max), fOffset(off), fScale(scale)
44 {
45 }
46 };
47
48 typedef std::vector<PreScaleEntry_t> vPreScale_t;
49
50protected:
51 EPType_e fType; // type
52 EGeoMode_e fGeoMode; // strategy of polygon projection (what to try first)
53 std::string fName; // name
54
55 REveVector fCenter; // center of distortion
56
57 bool fDisplaceOrigin; // displace point before projection
58
59 Bool_t fUsePreScale; // use pre-scaling
60 vPreScale_t fPreScales[3]; // scaling before the distortion
61
62 Float_t fDistortion; // distortion
63 Float_t fFixR; // radius from which scaling remains constant
64 Float_t fFixZ; // z-coordinate from which scaling remains constant
65 Float_t fPastFixRFac; // relative scaling factor beyond fFixR as 10^x
66 Float_t fPastFixZFac; // relative scaling factor beyond fFixZ as 10^x
67 Float_t fScaleR; // scale factor to keep projected radius at fFixR fixed
68 Float_t fScaleZ; // scale factor to keep projected z-coordinate at fFixZ fixed
69 Float_t fPastFixRScale; // relative scaling beyond fFixR
70 Float_t fPastFixZScale; // relative scaling beyond fFixZ
71 Float_t fMaxTrackStep; // maximum distance between two points on a track
72
73 void PreScaleVariable(Int_t dim, Float_t &v);
74
75public:
77 virtual ~REveProjection() {}
78
79 virtual Bool_t Is2D() const = 0;
80 virtual Bool_t Is3D() const = 0;
81
82 virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e p = kPP_Full) = 0;
83
87
88 void ProjectPointfv(const REveTrans *t, const Float_t *p, Float_t *v, Float_t d);
89 void ProjectPointdv(const REveTrans *t, const Double_t *p, Double_t *v, Float_t d);
90 void ProjectVector(const REveTrans *t, REveVector &v, Float_t d);
91
92 const char *GetName() const { return fName.c_str(); }
93 void SetName(const char *txt) { fName = txt; }
94
95 const REveVector &RefCenter() const { return fCenter; }
96 virtual void SetCenter(REveVector &v) { fCenter = v; }
97 virtual Float_t *GetProjectedCenter();
98
99 void SetDisplaceOrigin(bool);
101
102 void SetType(EPType_e t) { fType = t; }
103 EPType_e GetType() const { return fType; }
104
106 EGeoMode_e GetGeoMode() const { return fGeoMode; }
107
110
112 void PreScalePoint(Float_t &x, Float_t &y, Float_t &z);
113 void AddPreScaleEntry(Int_t coord, Float_t max_val, Float_t scale);
114 void ChangePreScaleEntry(Int_t coord, Int_t entry, Float_t new_scale);
115 void ClearPreScales();
116
117 void SetDistortion(Float_t d);
119 Float_t GetFixR() const { return fFixR; }
120 Float_t GetFixZ() const { return fFixZ; }
121 void SetFixR(Float_t x);
122 void SetFixZ(Float_t x);
129
130 virtual Bool_t HasSeveralSubSpaces() const { return kFALSE; }
131 virtual Bool_t AcceptSegment(REveVector &, REveVector &, Float_t /*tolerance*/) const { return kTRUE; }
132 virtual Int_t SubSpaceId(const REveVector &) const { return 0; }
133 virtual Bool_t IsOnSubSpaceBoundrary(const REveVector &) const { return kFALSE; }
134 virtual void BisectBreakPoint(REveVector &vL, REveVector &vR, Float_t eps_sqr);
135 virtual void BisectBreakPoint(REveVector &vL, REveVector &vR, Bool_t project_result = kFALSE, Float_t depth = 0);
136 virtual void SetDirectionalVector(Int_t screenAxis, REveVector &vec);
137
138 // utils to draw axis
140 virtual Float_t GetValForScreenPos(Int_t ax, Float_t value);
141 virtual Float_t GetScreenVal(Int_t ax, Float_t value);
142 Float_t GetScreenVal(Int_t i, Float_t x, REveVector &dirVec, REveVector &oCenter);
144
145 static Float_t fgEps; // resolution of projected points
146 static Float_t fgEpsSqr; // square of resolution of projected points
147};
148
149//==============================================================================
150// REveRhoZProjection
151// Rho/Z non-linear projection.
152//==============================================================================
153
155private:
156 REveVector fProjectedCenter; // projected center of distortion.
157
158public:
161
162 Bool_t Is2D() const override { return kTRUE; }
163 Bool_t Is3D() const override { return kFALSE; }
164
165 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
166
167 void SetCenter(REveVector &v) override;
169
170 Bool_t HasSeveralSubSpaces() const override { return kTRUE; }
171 Bool_t AcceptSegment(REveVector &v1, REveVector &v2, Float_t tolerance) const override;
172 Int_t SubSpaceId(const REveVector &v) const override;
173 Bool_t IsOnSubSpaceBoundrary(const REveVector &v) const override;
174 void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override;
175};
176
177//==============================================================================
178// REveRPhiProjection
179// XY non-linear projection.
180//==============================================================================
181
183public:
186
187 Bool_t Is2D() const override { return kTRUE; }
188 Bool_t Is3D() const override { return kFALSE; }
189
190 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
191};
192
193//==============================================================================
194// REve3DProjection
195// 3D scaling "projection"
196//==============================================================================
197
199public:
201 virtual ~REve3DProjection() {}
202
203 Bool_t Is2D() const override { return kFALSE; }
204 Bool_t Is3D() const override { return kTRUE; }
205
206 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
207};
208
209} // namespace Experimental
210} // namespace ROOT
211
212#endif
#define d(i)
Definition: RSha256.hxx:102
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
bool Bool_t
Definition: RtypesCore.h:61
double Double_t
Definition: RtypesCore.h:57
float Float_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:89
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
REveProjection Base for specific classes that implement non-linear projections.
virtual Float_t GetValForScreenPos(Int_t ax, Float_t value)
Inverse projection.
virtual Float_t GetScreenVal(Int_t ax, Float_t value)
Project point on given axis and return projected value.
std::vector< PreScaleEntry_t > vPreScale_t
REveVector GetOrthogonalCenter(int idx, REveVector &out)
Get center ortogonal to given axis index.
void ProjectPointfv(Float_t *v, Float_t d)
Project float array.
virtual Bool_t Is3D() const =0
void ProjectPointdv(Double_t *v, Float_t d)
Project double array.
void ProjectVector(REveVector &v, Float_t d)
Project REveVector.
void PreScaleVariable(Int_t dim, Float_t &v)
Pre-scale single variable with pre-scale entry dim.
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e p=kPP_Full)=0
virtual void SetCenter(REveVector &v)
Float_t GetLimit(Int_t i, Bool_t pos)
virtual Bool_t Is2D() const =0
void SetDistortion(Float_t d)
Set distortion.
const REveVector & RefCenter() const
virtual void SetDirectionalVector(Int_t screenAxis, REveVector &vec)
Get vector for axis in a projected space.
void ChangePreScaleEntry(Int_t coord, Int_t entry, Float_t new_scale)
Change scale for given entry and coordinate.
virtual Bool_t HasSeveralSubSpaces() const
void PreScalePoint(Float_t &x, Float_t &y)
Pre-scale point (x, y) in projected coordinates for 2D projections:
void SetPastFixRFac(Float_t x)
Set 2's-exponent for relative scaling beyond FixR.
void AddPreScaleEntry(Int_t coord, Float_t max_val, Float_t scale)
Add new scaling range for given coordinate.
virtual Int_t SubSpaceId(const REveVector &) const
void SetFixZ(Float_t x)
Set fixed radius.
virtual Bool_t AcceptSegment(REveVector &, REveVector &, Float_t) const
void SetDisplaceOrigin(bool)
Set flag to displace for center.
virtual void BisectBreakPoint(REveVector &vL, REveVector &vR, Float_t eps_sqr)
Find break-point on both sides of the discontinuity.
virtual Float_t * GetProjectedCenter()
Get projected center.
virtual Bool_t IsOnSubSpaceBoundrary(const REveVector &) const
void SetPastFixZFac(Float_t x)
Set 2's-exponent for relative scaling beyond FixZ.
void SetFixR(Float_t x)
Set fixed radius.
void ClearPreScales()
Clear all pre-scaling information.
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Bool_t IsOnSubSpaceBoundrary(const REveVector &v) const override
Checks if point is on sub-space boundary.
Float_t * GetProjectedCenter() override
Get projected center.
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Int_t SubSpaceId(const REveVector &v) const override
Return sub-space id for the point.
Bool_t HasSeveralSubSpaces() const override
Bool_t AcceptSegment(REveVector &v1, REveVector &v2, Float_t tolerance) const override
Check if segment of two projected points is valid.
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21
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