Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGL5D.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 2009
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_TGL5D
12 #define ROOT_TGL5D
13 
14 #include "TGLHistPainter.h"
15 #include "TGLUtil.h"
16 #include "TNamed.h"
17 #include "TAxis.h"
18 
19 #include <memory>
20 #include <vector>
21 
22 class TGL5DPainter;
23 class TTree;
24 
25 //TGL5D is a class to setup TGL5DPainter from TTree,
26 //hold data pointers, select required ranges,
27 //convert them into unit cube.
28 class TGL5DDataSet : public TNamed {
29  friend class TGL5DPainter;
30 private:
31  enum Edefaults{
32  kDefaultNB = 50//Default number of bins along X,Y,Z axes.
33  };
34 public:
35  TGL5DDataSet(TTree *inputData);
36 
37  //These are functions for TPad and
38  //TPad's standard machinery (picking, painting).
39  Int_t DistancetoPrimitive(Int_t px, Int_t py);
40  void ExecuteEvent(Int_t event, Int_t px, Int_t py);
41  char *GetObjectInfo(Int_t px, Int_t py) const;
42  void Paint(Option_t *option);
43 
44  //This is for editor.
45  TGL5DPainter *GetRealPainter()const;
46 
47  //Select points for iso-surface.
48  void SelectPoints(Double_t v4Level, Double_t range);
49  UInt_t SelectedSize()const;
50 
51  //Take a point from selected sub-range (V1 == X, V2 == Y, V3 == Z for 3D).
52  Double_t V1(UInt_t ind)const;
53  Double_t V2(UInt_t ind)const;
54  Double_t V3(UInt_t ind)const;
55 
56  //Very similar to TH3's axes.
57  TAxis *GetXAxis()const;
58  TAxis *GetYAxis()const;
59  TAxis *GetZAxis()const;
60 
61  //Data ranges for V1, V2, V3, V4.
62  const Rgl::Range_t &GetXRange()const;
63  const Rgl::Range_t &GetYRange()const;
64  const Rgl::Range_t &GetZRange()const;
65  const Rgl::Range_t &GetV4Range()const;
66 
67 private:
68  //These three functions for TKDEFGT,
69  //which will convert all point coordinates
70  //into unit cube before density estimation.
71  Double_t V1ToUnitCube(Double_t v1)const;
72  Double_t V2ToUnitCube(Double_t v2)const;
73  Double_t V3ToUnitCube(Double_t v3)const;
74 
75  Long64_t fNP;//Number of entries.
76  const Double_t *fV1;//V1.
77  const Double_t *fV2;//V2.
78  const Double_t *fV3;//V3.
79  const Double_t *fV4;//V4.
80  const Double_t *fV5;//V5.
81 
82  //These are fixed ranges of the data set,
83  //calculated during construction.
84  Rgl::Range_t fV1MinMax;//V1 range.
85  Double_t fV1Range;//max - min.
86  Rgl::Range_t fV2MinMax;//V2 range.
87  Double_t fV2Range;//max - min.
88  Rgl::Range_t fV3MinMax;//V3 range.
89  Double_t fV3Range;//max - min.
90  Rgl::Range_t fV4MinMax;//V4 range.
91  Rgl::Range_t fV5MinMax;//V5 range.
92 
93  //This are ranges and bin numbers
94  //for plot, inside fixed ranges.
95  mutable TAxis fXAxis;
96  mutable TAxis fYAxis;
97  mutable TAxis fZAxis;
98  //V4 can have a string type.
99  Bool_t fV4IsString;
100  //Painter to visualize dataset.
101  std::unique_ptr<TGLHistPainter> fPainter;
102  //Indices of points, selected for some iso-level.
103  std::vector<UInt_t> fIndices;
104 
105  TGL5DDataSet(const TGL5DDataSet &rhs);
106  TGL5DDataSet &operator = (const TGL5DDataSet &rhs);
107 
108  ClassDef(TGL5DDataSet, 0)//Class to read data from TTree and create TGL5DPainter.
109 };
110 
111 #endif