Logo ROOT   6.08/07
Reference Guide
TEvePointSet.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_TEvePointSet
13 #define ROOT_TEvePointSet
14 
15 #include "TEveElement.h"
16 #include "TEveProjectionBases.h"
17 #include "TEveTreeTools.h"
18 
19 #include "TArrayI.h"
20 #include "TPointSet3D.h"
21 #include "TQObject.h"
22 
23 class TTree;
24 class TF3;
25 class TGListTreeItem;
26 
27 /******************************************************************************/
28 // TEvePointSet
29 /******************************************************************************/
30 
31 class TEvePointSet : public TEveElement,
32  public TPointSet3D,
34  public TEveProjectable,
35  public TQObject
36 {
37  friend class TEvePointSetArray;
38 
39 private:
40  TEvePointSet& operator=(const TEvePointSet&); // Not implemented
41 
42 protected:
43  TString fTitle; // Title/tooltip of the TEvePointSet.
44  TArrayI *fIntIds; // Optional array of integer ideices.
45  Int_t fIntIdsPerPoint; // Number of integer indices assigned to each point.
46 
47  void AssertIntIdsSize();
48 
49 public:
50  TEvePointSet(Int_t n_points=0, ETreeVarType_e tv_type=kTVT_XYZ);
51  TEvePointSet(const char* name, Int_t n_points=0, ETreeVarType_e tv_type=kTVT_XYZ);
52  TEvePointSet(const TEvePointSet& e);
53  virtual ~TEvePointSet();
54 
55  virtual TObject* GetObject(const TEveException&) const
56  { const TObject* obj = this; return const_cast<TObject*>(obj); }
57 
58  virtual TEvePointSet* CloneElement() const { return new TEvePointSet(*this); }
59 
60  virtual void ClonePoints(const TEvePointSet& e);
61 
62  void Reset(Int_t n_points=0, Int_t n_int_ids=0);
63  Int_t GrowFor(Int_t n_points);
64 
65  virtual const char* GetTitle() const { return fTitle; }
66  virtual const char* GetElementName() const { return TPointSet3D::GetName(); }
67  virtual const char* GetElementTitle() const { return fTitle; }
68  virtual void SetElementName (const char* n) { fName = n; NameTitleChanged(); }
69  virtual void SetTitle(const char* t) { fTitle = t; NameTitleChanged(); }
70  virtual void SetElementTitle(const char* t) { fTitle = t; NameTitleChanged(); }
71  virtual void SetElementNameTitle(const char* n, const char* t)
72  { fName = n; fTitle = t; NameTitleChanged(); }
73 
75  Int_t* GetPointIntIds(Int_t p) const;
76  Int_t GetPointIntId(Int_t p, Int_t i) const;
77 
78  void SetPointIntIds(Int_t* ids);
79  void SetPointIntIds(Int_t n, Int_t* ids);
80 
81  virtual void SetMarkerColor(Color_t col) { SetMainColor(col); }
82  virtual void SetMarkerStyle(Style_t mstyle=1);
83  virtual void SetMarkerSize(Size_t msize=1);
84 
85  virtual void Paint(Option_t* option="");
86 
87  virtual void InitFill(Int_t subIdNum);
88  virtual void TakeAction(TEvePointSelector*);
89 
90  virtual void PointSelected(Int_t id); // *SIGNAL*
91 
92  virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE);
93 
94  virtual void CopyVizParams(const TEveElement* el);
95  virtual void WriteVizParams(std::ostream& out, const TString& var);
96 
97  virtual TClass* ProjectedClass(const TEveProjection* p) const;
98 
99  ClassDef(TEvePointSet, 0); // Set of 3D points with same marker attributes; optionally each point can be assigned an external TRef or a number of integer indices.
100 };
101 
102 
103 /******************************************************************************/
104 // TEvePointSetArray
105 /******************************************************************************/
106 
108  public TNamed,
109  public TAttMarker,
111 {
113 
114  TEvePointSetArray(const TEvePointSetArray&); // Not implemented
115  TEvePointSetArray& operator=(const TEvePointSetArray&); // Not implemented
116 
117 protected:
118  TEvePointSet **fBins; // Pointers to subjugated TEvePointSet's.
119  Int_t fDefPointSetCapacity; // Default capacity of subjugated TEvePointSet's.
120  Int_t fNBins; // Number of subjugated TEvePointSet's.
121  Int_t fLastBin; //! Index of the last filled TEvePointSet.
122  Double_t fMin, fCurMin; // Overall and current minimum value of the separating quantity.
123  Double_t fMax, fCurMax; // Overall and current maximum value of the separating quantity.
124  Double_t fBinWidth; // Separating quantity bin-width.
125  TString fQuantName; // Name of the separating quantity.
126 
127 public:
128  TEvePointSetArray(const char* name="TEvePointSetArray", const char* title="");
129  virtual ~TEvePointSetArray();
130 
131  virtual void RemoveElementLocal(TEveElement* el);
132  virtual void RemoveElementsLocal();
133 
134  virtual void SetMarkerColor(Color_t tcolor=1);
135  virtual void SetMarkerStyle(Style_t mstyle=1);
136  virtual void SetMarkerSize(Size_t msize=1);
137 
138  virtual void TakeAction(TEvePointSelector*);
139 
140  virtual Int_t Size(Bool_t under=kFALSE, Bool_t over=kFALSE) const;
141 
142  void InitBins(const char* quant_name, Int_t nbins, Double_t min, Double_t max);
143  Bool_t Fill(Double_t x, Double_t y, Double_t z, Double_t quant);
144  void SetPointId(TObject* id);
145  void CloseBins();
146 
147  void SetOwnIds(Bool_t o);
148 
149  Int_t GetDefPointSetCapacity() const { return fDefPointSetCapacity; }
150  void SetDefPointSetCapacity(Int_t c) { fDefPointSetCapacity = c; }
151 
152  Int_t GetNBins() const { return fNBins; }
153  TEvePointSet* GetBin(Int_t bin) const { return fBins[bin]; }
154 
155  Double_t GetMin() const { return fMin; }
156  Double_t GetCurMin() const { return fCurMin; }
157  Double_t GetMax() const { return fMax; }
158  Double_t GetCurMax() const { return fCurMax; }
159 
160  void SetRange(Double_t min, Double_t max);
161 
162  ClassDef(TEvePointSetArray, 0); // Array of TEvePointSet's filled via a common point-source; range of displayed TEvePointSet's can be controlled, based on a separating quantity provided on fill-time by a user.
163 };
164 
165 
166 /******************************************************************************/
167 // TEvePointSetProjected
168 /******************************************************************************/
169 
171  public TEveProjected
172 {
173 private:
174  TEvePointSetProjected(const TEvePointSetProjected&); // Not implemented
175  TEvePointSetProjected& operator=(const TEvePointSetProjected&); // Not implemented
176 
177 protected:
178  virtual void SetDepthLocal(Float_t d);
179 
180 public:
183 
184  virtual void SetProjection(TEveProjectionManager* proj, TEveProjectable* model);
185  virtual void UpdateProjection();
186  virtual TEveElement* GetProjectedAsElement() { return this; }
187 
188  virtual void PointSelected(Int_t id);
189 
190 
191  ClassDef(TEvePointSetProjected, 0); // Projected copy of a TEvePointSet.
192 };
193 
194 #endif
Abstract base class for classes that hold results of a non-linear projection transformation.
virtual const TGPicture * GetListTreeIcon(Bool_t open=kFALSE)
Return pointset icon.
Int_t fDefPointSetCapacity
Definition: TEvePointSet.h:119
short Style_t
Definition: RtypesCore.h:76
Int_t fIntIdsPerPoint
Definition: TEvePointSet.h:45
float Float_t
Definition: RtypesCore.h:53
float Size_t
Definition: RtypesCore.h:83
TEvePointSet * GetBin(Int_t bin) const
Definition: TEvePointSet.h:153
return c
const char Option_t
Definition: RtypesCore.h:62
virtual void NameTitleChanged()
Virtual function called when a name or title of the element has been changed.
Double_t GetCurMin() const
Definition: TEvePointSet.h:156
virtual void SetElementNameTitle(const char *n, const char *t)
Virtual function for setting of name and title of render element.
Definition: TEvePointSet.h:71
virtual void RemoveElementLocal(TEveElement *el)
Perform additional local removal of el.
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:53
Basic string class.
Definition: TString.h:137
virtual void ClonePoints(const TEvePointSet &e)
Clone points and all point-related information from point-set &#39;e&#39;.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void SetMarkerStyle(Style_t mstyle=1)
Set marker style, propagate to projecteds.
int nbins[3]
virtual TEvePointSet * CloneElement() const
Clone the element via copy constructor.
Definition: TEvePointSet.h:58
virtual const char * GetElementName() const
Virtual function for retrieving name of the element.
Definition: TEvePointSet.h:66
virtual void SetTitle(const char *t)
Definition: TEvePointSet.h:69
An array of point-sets with each point-set playing a role of a bin in a histogram.
Definition: TEvePointSet.h:107
Array of integers (32 bits per element).
Definition: TArrayI.h:29
virtual void RemoveElementsLocal()
Perform additional local removal of all elements.
Marker Attributes class.
Definition: TAttMarker.h:24
virtual TClass * ProjectedClass(const TEveProjection *p) const
Virtual from TEveProjectable, returns TEvePointSetProjected class.
Double_t x[n]
Definition: legend1.C:17
Projected copy of a TEvePointSet.
Definition: TEvePointSet.h:170
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual const char * GetTitle() const
Returns title of object.
Definition: TEvePointSet.h:65
void SetPointId(TObject *id)
Set id of last point.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual ~TEvePointSet()
Destructor.
virtual void SetMarkerColor(Color_t col)
Set the marker color.
Definition: TEvePointSet.h:81
Base-class for non-linear projections.
Double_t GetMax() const
Definition: TEvePointSet.h:157
void SetOwnIds(Bool_t o)
Definition: TPointSet3D.h:56
virtual void SetMarkerSize(Size_t msize=1)
Set marker size, propagate to projecteds.
Manager class for steering of projections and managing projected objects.
short Color_t
Definition: RtypesCore.h:79
TEvePointSelectorConsumer is a virtual base for classes that can be filled from TTree data via the TE...
Definition: TEveTreeTools.h:45
virtual void CopyVizParams(const TEveElement *el)
Copy visualization parameters from element el.
Abstract base-class for non-linear projectable objects.
A 3-Dim function with parameters.
Definition: TF3.h:30
Int_t GetNBins() const
Definition: TEvePointSet.h:152
TEvePointSet & operator=(const TEvePointSet &)
TEvePointSet is a render-element holding a collection of 3D points with optional per-point TRef and a...
Definition: TEvePointSet.h:31
Int_t GetIntIdsPerPoint() const
Definition: TEvePointSet.h:74
virtual ~TEvePointSetProjected()
Definition: TEvePointSet.h:182
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
virtual void SetElementName(const char *n)
Virtual function for setting of name of an element.
Definition: TEvePointSet.h:68
virtual void SetElementTitle(const char *t)
Virtual function for setting of title of an element.
Definition: TEvePointSet.h:70
virtual void Paint(Option_t *option="")
Paint point-set.
virtual void SetMainColor(Color_t color)
Set main color of the element.
virtual void TakeAction(TEvePointSelector *)
Called from TEvePointSelector when internal arrays of the tree-selector are filled up and need to be ...
void AssertIntIdsSize()
Assert that size of IntId array is compatible with the size of the point array.
virtual void PointSelected(Int_t id)
Virtual method of base class TPointSet3D.
virtual const char * GetElementTitle() const
Virtual function for retrieving title of the render-element.
Definition: TEvePointSet.h:67
Double_t GetCurMax() const
Definition: TEvePointSet.h:158
virtual void InitFill(Int_t subIdNum)
Initialize point-set for new filling.
Int_t GrowFor(Int_t n_points)
Resizes internal array to allow additional n_points to be stored.
Int_t GetPointIntId(Int_t p, Int_t i) const
Return i-th integer id of point with index p.
double Double_t
Definition: RtypesCore.h:55
TArrayI * fIntIds
Definition: TEvePointSet.h:44
virtual TEveElement * GetProjectedAsElement()
Returns this projected dynamic-casted to TEveElement.
Definition: TEvePointSet.h:186
virtual const char * GetName() const
Returns name of object.
Definition: TPolyMarker3D.h:65
Double_t y[n]
Definition: legend1.C:17
virtual void WriteVizParams(std::ostream &out, const TString &var)
Write visualization parameters.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
void SetPointIntIds(Int_t *ids)
Set integer ids for the last point that was registered (most probably via TPolyMarker3D::SetNextPoint...
TEvePointSet ** fBins
Definition: TEvePointSet.h:118
void Reset(Int_t n_points=0, Int_t n_int_ids=0)
Drop all data and set-up the data structures to recive new data.
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
friend class TEvePointSetArray
Definition: TEvePointSet.h:37
Int_t GetDefPointSetCapacity() const
Definition: TEvePointSet.h:149
void SetDefPointSetCapacity(Int_t c)
Definition: TEvePointSet.h:150
Exception class thrown by TEve classes and macros.
Definition: TEveUtil.h:102
A TTree object has a header with a name and a title.
Definition: TTree.h:98
TEvePointSet(Int_t n_points=0, ETreeVarType_e tv_type=kTVT_XYZ)
Constructor.
Int_t * GetPointIntIds(Int_t p) const
Return a pointer to integer ids of point with index p.
TPolyMarker3D using TPointSet3DGL for direct OpenGL rendering.
Definition: TPointSet3D.h:25
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
const Int_t n
Definition: legend1.C:16
Editor for TEvePointSetArray class.
virtual Int_t Size() const
Definition: TPolyMarker3D.h:81
char name[80]
Definition: TGX11.cxx:109
virtual TObject * GetObject(const TEveException &) const
Get a TObject associated with this render-element.
Definition: TEvePointSet.h:55
TEvePointSelector is a sub-class of TSelectorDraw for direct extraction of point-like data from a Tre...
Definition: TEveTreeTools.h:66
TString fTitle
Definition: TEvePointSet.h:43
Double_t GetMin() const
Definition: TEvePointSet.h:155
Double_t fMin
Index of the last filled TEvePointSet.
Definition: TEvePointSet.h:122