Logo ROOT   6.07/09
Reference Guide
TGLTH3Composition.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 07/08/2009
3 
4 #ifndef ROOT_TGLTH3Composition
5 #define ROOT_TGLTH3Composition
6 
7 #include <utility>
8 #include <memory>
9 #include <vector>
10 
11 #ifndef ROOT_TGLHistPainter
12 #include "TGLHistPainter.h"
13 #endif
14 #ifndef ROOT_TGLPlotPainter
15 #include "TGLPlotPainter.h"
16 #endif
17 #ifndef ROOT_TGLQuadric
18 #include "TGLQuadric.h"
19 #endif
20 #ifndef ROOT_TH3
21 #include "TH3.h"
22 #endif
23 
24 //
25 //Composition of TH3 objects. All TH3 must have the same axis range
26 //and the same number of bins. If this condition is violated,
27 //AddTH3 will throw.
28 //IMPORTANT: TGLTH3Composition does not own TH3 objects
29 //it contains.
30 //This class inherits TH3 - to re-use TH3 editor.
31 //I use TH3C to reduce memory usage.
32 //Slising is not implemeted yet.
33 //
34 
35 class TGLTH3Composition : public TH3C {
37 public:
38  TGLTH3Composition();//I need it only because of explicit private copy ctor.
39 
40  enum ETH3BinShape {
43  };
44 
45  void AddTH3(const TH3 *hist, ETH3BinShape shape = kBox);
46 
47  //These are functions for TPad and
48  //TPad's standard machinery (picking, painting).
50  void ExecuteEvent(Int_t event, Int_t px, Int_t py);
51  char *GetObjectInfo(Int_t px, Int_t py) const;
52  void Paint(Option_t *option);
53 
54 private:
55  void CheckRanges(const TH3 *hist);
56 
57  typedef std::pair<const TH3 *, ETH3BinShape> TH3Pair_t;
58 
59  std::vector<TH3Pair_t> fHists;
60  std::unique_ptr<TGLHistPainter> fPainter;
61 
64 
65  ClassDef(TGLTH3Composition, 0)//Composition of TH3 objects.
66 };
67 
68 //
69 //TGLTH3CompositionPainter class.
70 //
72 public:
74  TGLPlotCoordinates *coord);
75 
76  //TGLPlotPainter final-overriders.
77  char *GetPlotInfo(Int_t px, Int_t py);
78  Bool_t InitGeometry();
79  void StartPan(Int_t px, Int_t py);
80  void Pan(Int_t px, Int_t py);
81  void AddOption(const TString &option);
82  void ProcessEvent(Int_t event, Int_t px, Int_t py);
83 
84 private:
85  //TGLPlotPainter final-overriders.
86  void InitGL()const;
87  void DeInitGL()const;
88 
89  void DrawPlot()const;
90 
91  //Empty overriders.
92  void DrawSectionXOZ()const{}
93  void DrawSectionYOZ()const{}
94  void DrawSectionXOY()const{}
95 
96  void SetColor(Int_t color)const;
97 
99  std::pair<Double_t, Double_t> fMinMaxVal;
100 
102 
105 
106  ClassDef(TGLTH3CompositionPainter, 0)//Painter to draw several TH3.
107 };
108 
109 
110 #endif
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:21
TGLTH3Composition * fData
const char Option_t
Definition: RtypesCore.h:62
std::unique_ptr< TGLHistPainter > fPainter
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Wrapper class for GLU quadric shape drawing object.
Definition: TGLQuadric.h:29
TGLTH3Composition & operator=(const TGLTH3Composition &)
friend class TGLTH3CompositionPainter
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Check if "this" is under cursor.
#define ClassDef(name, id)
Definition: Rtypes.h:254
The 3-D histogram classes derived from the 1-D histogram classes.
Definition: TH3.h:35
void Paint(Option_t *option)
Paint a composition of 3d hists.
TGLTH3Composition()
I have to define it, since explicit copy ctor was declared.
std::pair< Double_t, Double_t > fMinMaxVal
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
std::vector< TH3Pair_t > fHists
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
char * GetObjectInfo(Int_t px, Int_t py) const
I cannot show bin content in a status bar - since there can be several bins in one.
std::pair< const TH3 *, ETH3BinShape > TH3Pair_t
tomato 3-D histogram with a byte per channel (see TH1 documentation)
Definition: TH3.h:162
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Mouse and keyboard events.
void AddTH3(const TH3 *hist, ETH3BinShape shape=kBox)
Add TH3 into collection.
void CheckRanges(const TH3 *hist)