Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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,
33  public TEvePointSelectorConsumer,
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 
74  Int_t GetIntIdsPerPoint() const { return fIntIdsPerPoint; }
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 
107 class TEvePointSetArray : public TEveElement,
108  public TNamed,
109  public TAttMarker,
110  public TEvePointSelectorConsumer
111 {
112  friend class TEvePointSetArrayEditor;
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 
170 class TEvePointSetProjected : public TEvePointSet,
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:
181  TEvePointSetProjected();
182  virtual ~TEvePointSetProjected() {}
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