Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "TGLHistPainter.h"
12#include "TGLPlotPainter.h"
13#include "TGLQuadric.h"
14#include "TH3.h"
15
16//
17//Composition of TH3 objects. All TH3 must have the same axis range
18//and the same number of bins. If this condition is violated,
19//AddTH3 will throw.
20//IMPORTANT: TGLTH3Composition does not own TH3 objects
21//it contains.
22//This class inherits TH3 - to re-use TH3 editor.
23//I use TH3C to reduce memory usage.
24//Slising is not implemeted yet.
25//
26
27class TGLTH3Composition : public TH3C {
29public:
30 TGLTH3Composition();//I need it only because of explicit private copy ctor.
31
33// clang++ <v20 (-Wshadow) complains about shadowing Buttons.h global enum EEditMode. Let's silence warning:
34#if defined(__clang__) && __clang_major__ < 20
35#pragma clang diagnostic push
36#pragma clang diagnostic ignored "-Wshadow"
37#endif
39#if defined(__clang__) && __clang_major__ < 20
40#pragma clang diagnostic pop
41#endif
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).
49 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
50 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
51 char *GetObjectInfo(Int_t px, Int_t py) const override;
52 void Paint(Option_t *option) override;
53
54private:
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 ClassDefOverride(TGLTH3Composition, 0)//Composition of TH3 objects.
66};
67
68//
69//TGLTH3CompositionPainter class.
70//
72public:
75
76 //TGLPlotPainter final-overriders.
77 char *GetPlotInfo(Int_t px, Int_t py) override;
78 Bool_t InitGeometry() override;
79 void StartPan(Int_t px, Int_t py) override;
80 void Pan(Int_t px, Int_t py) override;
81 void AddOption(const TString &option) override;
82 void ProcessEvent(Int_t event, Int_t px, Int_t py) override;
83
84private:
85 //TGLPlotPainter final-overriders.
86 void InitGL()const override;
87 void DeInitGL()const override;
88
89 void DrawPlot()const override;
90
91 //Empty overriders.
92 void DrawSectionXOZ()const override {}
93 void DrawSectionYOZ()const override {}
94 void DrawSectionXOY()const override {}
95
96 void SetColor(Int_t color)const;
97
99 std::pair<Double_t, Double_t> fMinMaxVal;
100
102
105
106 ClassDefOverride(TGLTH3CompositionPainter, 0)//Painter to draw several TH3.
107};
108
109
110#endif
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
winID h TVirtualViewer3D TVirtualGLPainter char GetPlotInfo
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Camera for TGLPlotPainter and sub-classes.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
Wrapper class for GLU quadric shape drawing object.
Definition TGLQuadric.h:28
void ProcessEvent(Int_t event, Int_t px, Int_t py) override
Switch on/off box cut.
void StartPan(Int_t px, Int_t py) override
Move plot or box cut.
void DeInitGL() const override
Return back some gl state variables.
TGLTH3CompositionPainter(const TGLTH3CompositionPainter &)=delete
void Pan(Int_t px, Int_t py) override
User's moving mouse cursor, with middle mouse button pressed (for pad).
TGLTH3Composition * fData
void DrawSectionXOY() const override
void AddOption(const TString &option) override
No options for composition.
TGLTH3CompositionPainter & operator=(const TGLTH3CompositionPainter &)=delete
std::pair< Double_t, Double_t > fMinMaxVal
void DrawSectionXOZ() const override
void InitGL() const override
Initialize some gl state variables.
void SetColor(Int_t color) const
Set material.
void DrawSectionYOZ() const override
void DrawPlot() const override
Draw composition of TH3s.
TGLTH3CompositionPainter(TGLTH3Composition *data, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Ctor.
TGLTH3Composition & operator=(const TGLTH3Composition &)=delete
TGLTH3Composition(const TGLTH3Composition &)=delete
void AddTH3(const TH3 *hist, ETH3BinShape shape=kBox)
Add TH3 into collection.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Check if "this" is under cursor.
std::vector< TH3Pair_t > fHists
void Paint(Option_t *option) override
Paint a composition of 3d hists.
TGLTH3Composition()
I have to define it, since explicit copy ctor was declared.
char * GetObjectInfo(Int_t px, Int_t py) const override
I cannot show bin content in a status bar - since there can be several bins in one.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Mouse and keyboard events.
std::pair< const TH3 *, ETH3BinShape > TH3Pair_t
std::unique_ptr< TGLHistPainter > fPainter
void CheckRanges(const TH3 *hist)
3-D histogram with a byte per channel (see TH1 documentation)
Definition TH3.h:176
The 3-D histogram classes derived from the 1-D histogram classes.
Definition TH3.h:45
Basic string class.
Definition TString.h:138