forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TGLTH3Composition.h
110 lines (85 loc) · 2.87 KB
/
TGLTH3Composition.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// @(#)root/gl:$Id$
// Author: Timur Pocheptsov 07/08/2009
#ifndef ROOT_TGLTH3Composition
#define ROOT_TGLTH3Composition
#include <utility>
#include <memory>
#include <vector>
#ifndef ROOT_TGLHistPainter
#include "TGLHistPainter.h"
#endif
#ifndef ROOT_TGLPlotPainter
#include "TGLPlotPainter.h"
#endif
#ifndef ROOT_TGLQuadric
#include "TGLQuadric.h"
#endif
#ifndef ROOT_TH3
#include "TH3.h"
#endif
//
//Composition of TH3 objects. All TH3 must have the same axis range
//and the same number of bins. If this condition is violated,
//AddTH3 will throw.
//IMPORTANT: TGLTH3Composition does not own TH3 objects
//it contains.
//This class inherits TH3 - to re-use TH3 editor.
//I use TH3C to reduce memory usage.
//Slising is not implemeted yet.
//
class TGLTH3Composition : public TH3C {
friend class TGLTH3CompositionPainter;
public:
TGLTH3Composition();//I need it only because of explicit private copy ctor.
enum ETH3BinShape {
kBox,
kSphere
};
void AddTH3(const TH3 *hist, ETH3BinShape shape = kBox);
//These are functions for TPad and
//TPad's standard machinery (picking, painting).
Int_t DistancetoPrimitive(Int_t px, Int_t py);
void ExecuteEvent(Int_t event, Int_t px, Int_t py);
char *GetObjectInfo(Int_t px, Int_t py) const;
void Paint(Option_t *option);
private:
void CheckRanges(const TH3 *hist);
typedef std::pair<const TH3 *, ETH3BinShape> TH3Pair_t;
std::vector<TH3Pair_t> fHists;
std::unique_ptr<TGLHistPainter> fPainter;
TGLTH3Composition(const TGLTH3Composition &rhs);
TGLTH3Composition &operator = (const TGLTH3Composition &);
ClassDef(TGLTH3Composition, 0)//Composition of TH3 objects.
};
//
//TGLTH3CompositionPainter class.
//
class TGLTH3CompositionPainter: public TGLPlotPainter {
public:
TGLTH3CompositionPainter(TGLTH3Composition *data, TGLPlotCamera *camera,
TGLPlotCoordinates *coord);
//TGLPlotPainter final-overriders.
char *GetPlotInfo(Int_t px, Int_t py);
Bool_t InitGeometry();
void StartPan(Int_t px, Int_t py);
void Pan(Int_t px, Int_t py);
void AddOption(const TString &option);
void ProcessEvent(Int_t event, Int_t px, Int_t py);
private:
//TGLPlotPainter final-overriders.
void InitGL()const;
void DeInitGL()const;
void DrawPlot()const;
//Empty overriders.
void DrawSectionXOZ()const{}
void DrawSectionYOZ()const{}
void DrawSectionXOY()const{}
void SetColor(Int_t color)const;
TGLTH3Composition *fData;
std::pair<Double_t, Double_t> fMinMaxVal;
mutable TGLQuadric fQuadric;
TGLTH3CompositionPainter(const TGLTH3CompositionPainter &rhs);
TGLTH3CompositionPainter &operator = (const TGLTH3CompositionPainter &rhs);
ClassDef(TGLTH3CompositionPainter, 0)//Painter to draw several TH3.
};
#endif