Logo ROOT   master
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 
24 namespace ROOT {
25 namespace 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 
34 class REvePointSet : public REveElement,
35  public REveProjectable,
36  public TAttMarker,
37  public TAttBBox
38 {
39  friend class REvePointSetArray;
40 
41 private:
42  REvePointSet &operator=(const REvePointSet &) = delete;
43 
44 protected:
45  std::vector<REveVector> fPoints;
46  int fCapacity{0};
47  int fSize{0};
48 
49 public:
50  REvePointSet(const std::string& name="", const std::string& title="", Int_t n_points = 0);
51  REvePointSet(const REvePointSet &e);
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 &) = delete;
99 
100 protected:
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 
110 public:
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 {
149 private:
152 
153 protected:
154  void SetDepthLocal(Float_t d) override;
155 
156 public:
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
void RemoveElementsLocal() override
Virtual from REveElement, provide bin management.
REvePointSetArray(const REvePointSetArray &)=delete
void PointSelected(Int_t id)
Virtual method of base class TPointSet3D.
void SetMarkerStyle(Style_t mstyle=1) override
Set marker style, propagate to children.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Write core json.
void SetMarkerSize(Size_t msize=1) override
Set marker size, propagate to projecteds.
int SetNextPoint(float x, float y, float z)
int SetPoint(int n, float x, float y, float z)
void SetProjection(REveProjectionManager *proj, REveProjectable *model) override
Set projection manager and projection model.
void RemoveElementLocal(REveElement *el) override
Virtual from REveElement, provide bin management.
short Style_t
Definition: RtypesCore.h:78
Returns the available number of logical cores.
Definition: StringConv.hxx:21
Double_t fMin
Index of the last filled REvePointSet.
REveElement * GetProjectedAsElement() override
Returns this projected dynamic-casted to REveElement.
float Float_t
Definition: RtypesCore.h:55
float Size_t
Definition: RtypesCore.h:85
REvePointSetArray & operator=(const REvePointSetArray &)=delete
void SetMarkerStyle(Style_t mstyle=1) override
Set marker style, propagate to projecteds.
void SetMarkerSize(Size_t msize=1) override
Set marker size, propagate to children.
void BuildRenderData() override
Crates 3D point array for rendering.
Basic string class.
Definition: TString.h:131
void UpdateProjection() override
Re-apply the projection.
const REveVector & RefPoint(int n) const
int Int_t
Definition: RtypesCore.h:43
REvePointSet * CloneElement() const override
Clone the element via copy constructor.
void CloseBins()
Call this after all the points have been filled.
void InitBins(const std::string &quant_name, Int_t nbins, Double_t min, Double_t max)
Initialize internal point-sets with given binning parameters.
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
REvePointSet(const std::string &name="", const std::string &title="", Int_t n_points=0)
Constructor.
void PointSelected(Int_t id)
Virtual method of base class TPointSet3D.
REvePointSet * GetBin(Int_t bin) const
Marker Attributes class.
Definition: TAttMarker.h:19
virtual ~REvePointSetArray()
Destructor: deletes the fBins array.
Double_t x[n]
Definition: legend1.C:17
Int_t Size(Bool_t under=kFALSE, Bool_t over=kFALSE) const
Get the total number of filled points.
REveProjection Base for specific classes that implement non-linear projections.
short Color_t
Definition: RtypesCore.h:81
REvePointSetProjected & operator=(const REvePointSetProjected &)=delete
virtual void ClonePoints(const REvePointSet &e)
Clone points and all point-related information from point-set &#39;e&#39;.
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
virtual void SetMainColor(Color_t color)
Set main color of the element.
REveProjectionManager Manager class for steering of projections and managing projected objects...
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
REvePointSet & operator=(const REvePointSet &)=delete
const Bool_t kFALSE
Definition: RtypesCore.h:90
#define d(i)
Definition: RSha256.hxx:102
Int_t GrowFor(Int_t n_points)
Resizes internal array to allow additional n_points to be stored.
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REvePointSetProjected class.
void ComputeBBox() override
Compute bounding box.
Bool_t Fill(Double_t x, Double_t y, Double_t z, Double_t quant)
Add a new point.
virtual ~REvePointSet()
Destructor.
Double_t y[n]
Definition: legend1.C:17
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
void SetDepthLocal(Float_t d) override
Set depth (z-coordinate) of the projected points.
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
void SetRange(Double_t min, Double_t max)
Set active range of the separating quantity.
Helper for management of bounding-box information.
Definition: TAttBBox.h:17
basic_json<> json
Definition: REveElement.hxx:58
void SetMarkerColor(Color_t col) override
Set the marker color.
#define c(i)
Definition: RSha256.hxx:101
void SetMarkerColor(Color_t tcolor=1) override
Set marker color, propagate to children.
void Reset(Int_t n_points=0)
Drop all data and set-up the data structures to recive new data.
const Int_t n
Definition: legend1.C:16
std::vector< REveVector > fPoints
char name[80]
Definition: TGX11.cxx:109