Logo ROOT  
Reference Guide
REvePointSet.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_REvePointSet
13#define ROOT7_REvePointSet
14
15#include <ROOT/REveElement.hxx>
17#include <ROOT/REveVector.hxx>
18
19#include <TAttMarker.h>
20#include <TAttBBox.h>
21
22#include <cassert>
23
24namespace ROOT {
25namespace Experimental {
26
27////////////////////////////////////////////////////////////////////////////////
28// REvePointSet
29// Set of 3D points with same marker attributes;
30// optionally each point can be assigned an
31// external TRef or a number of integer indices.
32////////////////////////////////////////////////////////////////////////////////
33
35 public REveProjectable,
36 public TAttMarker,
37 public TAttBBox
38{
39 friend class REvePointSetArray;
40
41private:
42 REvePointSet &operator=(const REvePointSet &); // Not implemented
43
44protected:
45 std::vector<REveVector> fPoints;
46 int fCapacity{0};
47 int fSize{0};
48
49public:
50 REvePointSet(const std::string& name="", const std::string& title="", Int_t n_points = 0);
52 virtual ~REvePointSet();
53
54 REvePointSet *CloneElement() const override { return new REvePointSet(*this); }
55
56 virtual void ClonePoints(const REvePointSet &e);
57
58 void Reset(Int_t n_points = 0);
59 Int_t GrowFor(Int_t n_points);
60
61 int SetNextPoint(float x, float y, float z);
62 int SetPoint(int n, float x, float y, float z);
63
64 int GetCapacity() const { return fCapacity; }
65 int GetSize() const { return fSize; }
66
67 REveVector& RefPoint(int n) { assert (n < fSize); return fPoints[n]; }
68 const REveVector& RefPoint(int n) const { assert (n < fSize); return fPoints[n]; }
69
70 void SetMarkerColor(Color_t col) override { SetMainColor(col); }
71 void SetMarkerStyle(Style_t mstyle = 1) override;
72 void SetMarkerSize(Size_t msize = 1) override;
73
74 void CopyVizParams(const REveElement *el) override;
75 void WriteVizParams(std::ostream &out, const TString &var) override;
76
77 TClass* ProjectedClass(const REveProjection *p) const override;
78
79 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
80 void BuildRenderData()override;
81
82 void ComputeBBox() override;
83
84 void PointSelected(Int_t id); // *SIGNAL*
85};
86
87/******************************************************************************/
88// REvePointSetArray
89// Array of REvePointSet's filled via a common point-source; range of displayed REvePointSet's can be
90// controlled, based on a separating quantity provided on fill-time by a user.
91/******************************************************************************/
92
94 public REveProjectable,
95 public TAttMarker
96{
97 REvePointSetArray(const REvePointSetArray &); // Not implemented
98 REvePointSetArray &operator=(const REvePointSetArray &); // Not implemented
99
100protected:
101 REvePointSet **fBins{nullptr}; // Pointers to subjugated REvePointSet's.
102 Int_t fDefPointSetCapacity; // Default capacity of subjugated REvePointSet's.
103 Int_t fNBins; // Number of subjugated REvePointSet's.
104 Int_t fLastBin; //! Index of the last filled REvePointSet.
105 Double_t fMin, fCurMin; // Overall and current minimum value of the separating quantity.
106 Double_t fMax, fCurMax; // Overall and current maximum value of the separating quantity.
107 Double_t fBinWidth; // Separating quantity bin-width.
108 std::string fQuantName; // Name of the separating quantity.
109
110public:
111 REvePointSetArray(const std::string &name = "REvePointSetArray", const std::string &title = "");
112 virtual ~REvePointSetArray();
113
114 void RemoveElementLocal(REveElement *el) override;
115 void RemoveElementsLocal() override;
116
117 void SetMarkerColor(Color_t tcolor = 1) override;
118 void SetMarkerStyle(Style_t mstyle = 1) override;
119 void SetMarkerSize(Size_t msize = 1) override;
120
121 Int_t Size(Bool_t under = kFALSE, Bool_t over = kFALSE) const;
122
123 void InitBins(const std::string& quant_name, Int_t nbins, Double_t min, Double_t max);
125 void CloseBins();
126
129
130 Int_t GetNBins() const { return fNBins; }
131 REvePointSet *GetBin(Int_t bin) const { return fBins[bin]; }
132
133 Double_t GetMin() const { return fMin; }
134 Double_t GetCurMin() const { return fCurMin; }
135 Double_t GetMax() const { return fMax; }
136 Double_t GetCurMax() const { return fCurMax; }
137
138 void SetRange(Double_t min, Double_t max);
139};
140
141/******************************************************************************/
142// REvePointSetProjected
143// Projected copy of a REvePointSet.
144/******************************************************************************/
145
147 public REveProjected
148{
149private:
150 REvePointSetProjected(const REvePointSetProjected &); // Not implemented
152
153protected:
154 void SetDepthLocal(Float_t d) override;
155
156public:
159
160 void SetProjection(REveProjectionManager *proj, REveProjectable *model) override;
161 void UpdateProjection() override;
162 REveElement *GetProjectedAsElement() override { return this; }
163
164 void PointSelected(Int_t id);
165};
166
167} // namespace Experimental
168} // namespace ROOT
169
170#endif
#define d(i)
Definition: RSha256.hxx:102
#define c(i)
Definition: RSha256.hxx:101
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:41
float Size_t
Definition: RtypesCore.h:83
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
short Color_t
Definition: RtypesCore.h:79
short Style_t
Definition: RtypesCore.h:76
float Float_t
Definition: RtypesCore.h:53
char name[80]
Definition: TGX11.cxx:109
virtual void SetMainColor(Color_t color)
Set main color of the element.
Double_t fMin
Index of the last filled REvePointSet.
void CloseBins()
Call this after all the points have been filled.
REvePointSetArray(const REvePointSetArray &)
void SetMarkerSize(Size_t msize=1) override
Set marker size, propagate to children.
void SetMarkerColor(Color_t tcolor=1) override
Set marker color, propagate to children.
void RemoveElementsLocal() override
Virtual from REveElement, provide bin management.
void InitBins(const std::string &quant_name, Int_t nbins, Double_t min, Double_t max)
Initialize internal point-sets with given binning parameters.
Bool_t Fill(Double_t x, Double_t y, Double_t z, Double_t quant)
Add a new point.
REvePointSet * GetBin(Int_t bin) const
virtual ~REvePointSetArray()
Destructor: deletes the fBins array.
void SetRange(Double_t min, Double_t max)
Set active range of the separating quantity.
void RemoveElementLocal(REveElement *el) override
Virtual from REveElement, provide bin management.
void SetMarkerStyle(Style_t mstyle=1) override
Set marker style, propagate to children.
REvePointSetArray & operator=(const REvePointSetArray &)
Int_t Size(Bool_t under=kFALSE, Bool_t over=kFALSE) const
Get the total number of filled points.
void PointSelected(Int_t id)
Virtual method of base class TPointSet3D.
REvePointSetProjected(const REvePointSetProjected &)
void SetProjection(REveProjectionManager *proj, REveProjectable *model) override
Set projection manager and projection model.
REvePointSetProjected & operator=(const REvePointSetProjected &)
REveElement * GetProjectedAsElement() override
Returns this projected dynamic-casted to REveElement.
void UpdateProjection() override
Re-apply the projection.
void SetDepthLocal(Float_t d) override
Set depth (z-coordinate) of the projected points.
void PointSelected(Int_t id)
Virtual method of base class TPointSet3D.
virtual void ClonePoints(const REvePointSet &e)
Clone points and all point-related information from point-set 'e'.
REvePointSet * CloneElement() const override
Clone the element via copy constructor.
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
void SetMarkerColor(Color_t col) override
Set the marker color.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Write core json.
void ComputeBBox() override
Compute bounding box.
virtual ~REvePointSet()
Destructor.
void SetMarkerSize(Size_t msize=1) override
Set marker size, propagate to projecteds.
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
const REveVector & RefPoint(int n) const
REvePointSet(const std::string &name="", const std::string &title="", Int_t n_points=0)
Constructor.
std::vector< REveVector > fPoints
int SetPoint(int n, float x, float y, float z)
int SetNextPoint(float x, float y, float z)
void Reset(Int_t n_points=0)
Drop all data and set-up the data structures to recive new data.
void SetMarkerStyle(Style_t mstyle=1) override
Set marker style, propagate to projecteds.
void BuildRenderData() override
Crates 3D point array for rendering.
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REvePointSetProjected class.
Int_t GrowFor(Int_t n_points)
Resizes internal array to allow additional n_points to be stored.
REvePointSet & operator=(const REvePointSet &)
REveProjectionManager Manager class for steering of projections and managing projected objects.
REveProjection Base for specific classes that implement non-linear projections.
Helper for management of bounding-box information.
Definition: TAttBBox.h:18
Marker Attributes class.
Definition: TAttMarker.h:19
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
Basic string class.
Definition: TString.h:131
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
VSD Structures.
Definition: StringConv.hxx:21