00001 // @(#)root/gl:$Id: TGL5D.h 29602 2009-07-28 10:23:20Z brun $ 00002 // Author: Timur Pocheptsov 2009 00003 /************************************************************************* 00004 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00005 * All rights reserved. * 00006 * * 00007 * For the licensing terms see $ROOTSYS/LICENSE. * 00008 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00009 *************************************************************************/ 00010 00011 #ifndef ROOT_TGL5D 00012 #define ROOT_TGL5D 00013 00014 #include <memory> 00015 #include <vector> 00016 00017 #ifndef ROOT_TGLHistPainter 00018 #include "TGLHistPainter.h" 00019 #endif 00020 #ifndef ROOT_TGLUtil 00021 #include "TGLUtil.h" 00022 #endif 00023 #ifndef ROOT_TNamed 00024 #include "TNamed.h" 00025 #endif 00026 #ifndef ROOT_TAxis 00027 #include "TAxis.h" 00028 #endif 00029 00030 class TGL5DPainter; 00031 class TTree; 00032 00033 //TGL5D is a class to setup TGL5DPainter from TTree, 00034 //hold data pointers, select required ranges, 00035 //convert them into unit cube. 00036 class TGL5DDataSet : public TNamed { 00037 friend class TGL5DPainter; 00038 private: 00039 enum Edefaults{ 00040 kDefaultNB = 50//Default number of bins along X,Y,Z axes. 00041 }; 00042 public: 00043 TGL5DDataSet(TTree *inputData); 00044 00045 //These are functions for TPad and 00046 //TPad's standard machinery (picking, painting). 00047 Int_t DistancetoPrimitive(Int_t px, Int_t py); 00048 void ExecuteEvent(Int_t event, Int_t px, Int_t py); 00049 char *GetObjectInfo(Int_t px, Int_t py) const; 00050 void Paint(Option_t *option); 00051 00052 //This is for editor. 00053 TGL5DPainter *GetRealPainter()const; 00054 00055 //Select points for iso-surface. 00056 void SelectPoints(Double_t v4Level, Double_t range); 00057 UInt_t SelectedSize()const; 00058 00059 //Take a point from selected sub-range (V1 == X, V2 == Y, V3 == Z for 3D). 00060 Double_t V1(UInt_t ind)const; 00061 Double_t V2(UInt_t ind)const; 00062 Double_t V3(UInt_t ind)const; 00063 00064 //Very similar to TH3's axes. 00065 TAxis *GetXAxis()const; 00066 TAxis *GetYAxis()const; 00067 TAxis *GetZAxis()const; 00068 00069 //Data ranges for V1, V2, V3, V4. 00070 const Rgl::Range_t &GetXRange()const; 00071 const Rgl::Range_t &GetYRange()const; 00072 const Rgl::Range_t &GetZRange()const; 00073 const Rgl::Range_t &GetV4Range()const; 00074 00075 private: 00076 //These three functions for TKDEFGT, 00077 //which will convert all point coordinates 00078 //into unit cube before density estimation. 00079 Double_t V1ToUnitCube(Double_t v1)const; 00080 Double_t V2ToUnitCube(Double_t v2)const; 00081 Double_t V3ToUnitCube(Double_t v3)const; 00082 00083 Long64_t fNP;//Number of entries. 00084 const Double_t *fV1;//V1. 00085 const Double_t *fV2;//V2. 00086 const Double_t *fV3;//V3. 00087 const Double_t *fV4;//V4. 00088 const Double_t *fV5;//V5. 00089 00090 //These are fixed ranges of the data set, 00091 //calculated during construction. 00092 Rgl::Range_t fV1MinMax;//V1 range. 00093 Double_t fV1Range;//max - min. 00094 Rgl::Range_t fV2MinMax;//V2 range. 00095 Double_t fV2Range;//max - min. 00096 Rgl::Range_t fV3MinMax;//V3 range. 00097 Double_t fV3Range;//max - min. 00098 Rgl::Range_t fV4MinMax;//V4 range. 00099 Rgl::Range_t fV5MinMax;//V5 range. 00100 00101 //This are ranges and bin numbers 00102 //for plot, inside fixed ranges. 00103 mutable TAxis fXAxis; 00104 mutable TAxis fYAxis; 00105 mutable TAxis fZAxis; 00106 //V4 can have a string type. 00107 Bool_t fV4IsString; 00108 //Painter to visualize dataset. 00109 std::auto_ptr<TGLHistPainter> fPainter; 00110 //Indices of points, selected for some iso-level. 00111 std::vector<UInt_t> fIndices; 00112 00113 TGL5DDataSet(const TGL5DDataSet &rhs); 00114 TGL5DDataSet &operator = (const TGL5DDataSet &rhs); 00115 00116 ClassDef(TGL5DDataSet, 0)//Class to read data from TTree and create TGL5DPainter. 00117 }; 00118 00119 #endif