Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
THistPainter.h
Go to the documentation of this file.
1// @(#)root/histpainter:$Id$
2// Author: Rene Brun, Olivier Couet
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11#ifndef ROOT_THistPainter
12#define ROOT_THistPainter
13
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// THistPainter //
18// //
19// helper class to draw histograms //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23
24#include "TVirtualHistPainter.h"
25#include "TString.h"
26
27#include <vector>
28#include <utility>
29
30
31class TH1;
32class TAxis;
33class TCutG;
34class TGaxis;
36class TGraph2DPainter;
37class TPie;
38class TF3;
39
40const Int_t kMaxCuts = 16;
41
43{
44 std::pair<Int_t, Int_t> fPixelRange;
45 std::pair<Int_t, Int_t> fBinRange;
46};
47
48
50
51protected:
52 TH1 *fH; ///< Pointer to histogram to paint
53 TAxis *fXaxis; ///< Pointer to X axis
54 TAxis *fYaxis; ///< Pointer to Y axis
55 TAxis *fZaxis; ///< Pointer to Z axis
56 TList *fFunctions; ///< Pointer to histogram list of functions
57 TPainter3dAlgorithms *fLego; ///< Pointer to a TPainter3dAlgorithms object
58 TGraph2DPainter *fGraph2DPainter; ///< Pointer to a TGraph2DPainter object
59 TPie *fPie; ///< Pointer to a TPie in case of option PIE
60 Double_t *fXbuf; ///< X buffer coordinates
61 Double_t *fYbuf; ///< Y buffer coordinates
62 Int_t fNcuts; ///< Number of graphical cuts
63 Int_t fCutsOpt[kMaxCuts]; ///< Sign of each cut
64 TCutG *fCuts[kMaxCuts]; ///< Pointers to graphical cuts
65 TList *fStack; ///< Pointer to stack of histograms (if any)
66 Int_t fShowProjection; ///< True if a projection must be drawn
67 TString fShowOption; ///< Option to draw the projection
68 Int_t fXHighlightBin; ///< X highlight bin
69 Int_t fYHighlightBin; ///< Y highlight bin
70 TF3 *fCurrentF3; ///< Current TF3 function
71
72private:
74
75public:
77 virtual ~THistPainter();
78 virtual void DefineColorLevels(Int_t ndivz);
79 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
80 virtual void DrawPanel();
81 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
82 virtual TList *GetContourList(Double_t contour) const;
83 virtual char *GetObjectInfo(Int_t px, Int_t py) const;
84 virtual TList *GetStack() const {return fStack;}
85 virtual Int_t GetXHighlightBin() const { return fXHighlightBin; }
86 virtual Int_t GetYHighlightBin() const { return fYHighlightBin; }
87 virtual void HighlightBin(Int_t px, Int_t py);
88 virtual Bool_t IsInside(Int_t x, Int_t y);
90 virtual Int_t MakeChopt(Option_t *option);
91 virtual Int_t MakeCuts(char *cutsopt);
92 virtual void Paint(Option_t *option="");
93 virtual void PaintArrows(Option_t *option);
94 virtual void PaintAxis(Bool_t drawGridOnly=kFALSE);
95 virtual void PaintBar(Option_t *option);
96 virtual void PaintBarH(Option_t *option);
97 virtual void PaintBoxes(Option_t *option);
98 virtual void PaintCandlePlot(Option_t *option);
99 virtual void PaintColorLevels(Option_t *option);
100 virtual void PaintColorLevelsFast(Option_t *option);
101 virtual std::vector<THistRenderingRegion> ComputeRenderingRegions(TAxis *pAxis, Int_t nPixels, bool isLog);
102
103 virtual void PaintTH2PolyBins(Option_t *option);
104 virtual void PaintTH2PolyColorLevels(Option_t *option);
105 virtual void PaintTH2PolyScatterPlot(Option_t *option);
106 virtual void PaintTH2PolyText(Option_t *option);
107 virtual void PaintContour(Option_t *option);
108 virtual Int_t PaintContourLine(Double_t elev1, Int_t icont1, Double_t x1, Double_t y1,
109 Double_t elev2, Int_t icont2, Double_t x2, Double_t y2,
110 Double_t *xarr, Double_t *yarr, Int_t *itarr, Double_t *levels);
111 virtual void PaintErrors(Option_t *option);
112 virtual void Paint2DErrors(Option_t *option);
113 virtual void PaintFrame();
114 virtual void PaintFunction(Option_t *option);
115 virtual void PaintHighlightBin(Option_t *option="");
116 virtual void PaintHist(Option_t *option);
117 virtual void PaintH3(Option_t *option="");
118 virtual void PaintH3Box(Int_t iopt);
119 virtual void PaintH3BoxRaster();
120 virtual void PaintH3Iso();
121 virtual Int_t PaintInit();
122 virtual Int_t PaintInitH();
123 virtual void PaintLego(Option_t *option);
124 virtual void PaintLegoAxis(TGaxis *axis, Double_t ang);
125 virtual void PaintPalette();
126 virtual void PaintScatterPlot(Option_t *option);
127 virtual void PaintStat(Int_t dostat, TF1 *fit);
128 virtual void PaintStat2(Int_t dostat, TF1 *fit);
129 virtual void PaintStat3(Int_t dostat, TF1 *fit);
130 virtual void PaintSurface(Option_t *option);
131 virtual void PaintTriangles(Option_t *option);
132 virtual void PaintTable(Option_t *option);
133 virtual void PaintText(Option_t *option);
134 virtual void PaintTitle();
135 virtual void PaintTF3();
136 virtual void ProcessMessage(const char *mess, const TObject *obj);
141 virtual void RecalculateRange();
142 virtual void RecursiveRemove(TObject *) {;}
143 virtual void SetHighlight();
144 virtual void SetHistogram(TH1 *h);
145 virtual void SetStack(TList *stack) {fStack = stack;}
146 virtual void SetShowProjection(const char *option,Int_t nbins);
147 virtual void ShowProjectionX(Int_t px, Int_t py);
148 virtual void ShowProjectionY(Int_t px, Int_t py);
149 virtual void ShowProjection3(Int_t px, Int_t py);
150 virtual Int_t TableInit();
151
152 static const char *GetBestFormat(Double_t v, Double_t e, const char *f);
153 static void PaintSpecialObjects(const TObject *obj, Option_t *option);
154
155 ClassDef(THistPainter,0) //Helper class to draw histograms
156};
157
158#endif
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
static const double x2[5]
static const double x1[5]
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:101
bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
const Int_t kMaxCuts
Class to manage histogram axis.
Definition TAxis.h:30
Graphical cut class.
Definition TCutG.h:20
1-Dim function class
Definition TF1.h:213
A 3-Dim function with parameters.
Definition TF3.h:28
The axis painter class.
Definition TGaxis.h:23
The TGraphDelaunay painting class.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
The histogram painter class.
static Int_t ProjectSinusoidal2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function code from Ernst-Jan Buis.
virtual Bool_t IsInside(Int_t x, Int_t y)
Return kTRUE if the cell ix, iy is inside one of the graphical cuts.
TAxis * fYaxis
Pointer to Y axis.
Double_t * fXbuf
X buffer coordinates.
Int_t fXHighlightBin
X highlight bin.
TF3 * fCurrentF3
Current TF3 function.
virtual void DrawPanel()
Display a panel with all histogram drawing options.
virtual void PaintErrors(Option_t *option)
Draw 1D histograms error bars.
virtual TList * GetStack() const
virtual void SetHistogram(TH1 *h)
Set current histogram to h
virtual void PaintTF3()
Control function to draw a 3D implicit functions.
virtual void PaintStat(Int_t dostat, TF1 *fit)
Draw the statistics box for 1D and profile histograms.
virtual Int_t TableInit()
Initialize various options to draw 2D histograms.
virtual void PaintTH2PolyScatterPlot(Option_t *option)
Control function to draw a TH2Poly as a scatter plot.
static Int_t ProjectAitoff2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function.
virtual void PaintText(Option_t *option)
Control function to draw a 1D/2D histograms with the bin values.
virtual void PaintAxis(Bool_t drawGridOnly=kFALSE)
Draw axis (2D case) of an histogram.
virtual void PaintColorLevelsFast(Option_t *option)
[Rendering scheme for the COL2 and COLZ2 options] (HP14)
virtual Int_t PaintInit()
Compute histogram parameters used by the drawing routines.
virtual void Paint2DErrors(Option_t *option)
Draw 2D histograms errors.
Int_t fYHighlightBin
Y highlight bin.
virtual void PaintCandlePlot(Option_t *option)
Control function to draw a 2D histogram as a candle (box) plot or violin plot
virtual void PaintScatterPlot(Option_t *option)
Control function to draw a 2D histogram as a scatter plot.
virtual ~THistPainter()
Default destructor.
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Display the histogram info (bin number, contents, integral up to bin corresponding to cursor position...
virtual void PaintLego(Option_t *option)
Control function to draw a 2D histogram as a lego plot.
virtual void PaintH3(Option_t *option="")
Control function to draw a 3D histograms.
Int_t fNcuts
Number of graphical cuts.
TString fShowOption
Option to draw the projection.
virtual void PaintHighlightBin(Option_t *option="")
Paint highlight bin as TBox object.
virtual void PaintTH2PolyBins(Option_t *option)
Control function to draw a TH2Poly bins' contours.
virtual Int_t PaintContourLine(Double_t elev1, Int_t icont1, Double_t x1, Double_t y1, Double_t elev2, Int_t icont2, Double_t x2, Double_t y2, Double_t *xarr, Double_t *yarr, Int_t *itarr, Double_t *levels)
Fill the matrix xarr and yarr for Contour Plot.
Int_t fShowProjection
True if a projection must be drawn.
virtual void PaintLegoAxis(TGaxis *axis, Double_t ang)
Draw the axis for legos and surface plots.
virtual void PaintTriangles(Option_t *option)
Control function to draw a table using Delaunay triangles.
virtual void HighlightBin(Int_t px, Int_t py)
Check on highlight bin.
virtual void PaintH3Box(Int_t iopt)
Control function to draw a 3D histogram with boxes.
TList * fFunctions
Pointer to histogram list of functions.
static void PaintSpecialObjects(const TObject *obj, Option_t *option)
Static function to paint special objects like vectors and matrices.
virtual void PaintTitle()
Draw the histogram title.
virtual void PaintTH2PolyColorLevels(Option_t *option)
Control function to draw a TH2Poly as a color plot.
virtual void RecursiveRemove(TObject *)
Recursively remove this object from a list.
virtual std::vector< THistRenderingRegion > ComputeRenderingRegions(TAxis *pAxis, Int_t nPixels, bool isLog)
Returns the rendering regions for an axis to use in the COL2 option.
virtual void ShowProjectionX(Int_t px, Int_t py)
Show projection onto X.
virtual void PaintPalette()
Paint the color palette on the right side of the pad.
virtual void ProcessMessage(const char *mess, const TObject *obj)
Process message mess.
Double_t * fYbuf
Y buffer coordinates.
TAxis * fXaxis
Pointer to X axis.
virtual void PaintStat2(Int_t dostat, TF1 *fit)
Draw the statistics box for 2D histograms.
virtual void PaintArrows(Option_t *option)
Control function to draw a table as an arrow plot
virtual void RecalculateRange()
Recompute the histogram range following graphics operations.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance from the point px,py to a line.
static Int_t ProjectParabolic2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function code from Ernst-Jan Buis.
TPainter3dAlgorithms * fLego
Pointer to a TPainter3dAlgorithms object.
virtual void PaintBarH(Option_t *option)
Draw a bar char in a rotated pad (X vertical, Y horizontal)
virtual void PaintStat3(Int_t dostat, TF1 *fit)
Draw the statistics box for 3D histograms.
virtual void PaintSurface(Option_t *option)
Control function to draw a 2D histogram as a surface plot.
TList * fStack
Pointer to stack of histograms (if any)
TGraph2DPainter * fGraph2DPainter
Pointer to a TGraph2DPainter object.
TPie * fPie
Pointer to a TPie in case of option PIE.
THistPainter()
Default constructor.
TH1 * fH
Pointer to histogram to paint.
virtual void PaintTH2PolyText(Option_t *option)
Control function to draw a TH2Poly as a text plot.
virtual void ShowProjection3(Int_t px, Int_t py)
Show projection (specified by fShowProjection) of a TH3.
TAxis * fZaxis
Pointer to Z axis.
virtual void Paint(Option_t *option="")
Control routine to paint any kind of histograms
virtual void PaintFunction(Option_t *option)
[Paint functions associated to an histogram.](HP28")
virtual void PaintBar(Option_t *option)
Draw a bar-chart in a normal pad.
static Int_t ProjectMercator2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function.
virtual void PaintBoxes(Option_t *option)
Control function to draw a 2D histogram as a box plot
virtual Int_t MakeChopt(Option_t *option)
Decode string choptin and fill Hoption structure.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute the actions corresponding to event.
virtual void SetShowProjection(const char *option, Int_t nbins)
Set projection.
virtual void SetStack(TList *stack)
virtual void ShowProjectionY(Int_t px, Int_t py)
Show projection onto Y.
virtual void SetHighlight()
Set highlight (enable/disable) mode for fH.
static const char * GetBestFormat(Double_t v, Double_t e, const char *f)
This function returns the best format to print the error value (e) knowing the parameter value (v) an...
virtual void PaintContour(Option_t *option)
Control function to draw a 2D histogram as a contour plot.
TCutG * fCuts[kMaxCuts]
Pointers to graphical cuts.
virtual void PaintTable(Option_t *option)
Control function to draw 2D/3D histograms (tables).
virtual TList * GetContourList(Double_t contour) const
Get a contour (as a list of TGraphs) using the Delaunay triangulation.
virtual Int_t PaintInitH()
Compute histogram parameters used by the drawing routines for a rotated pad.
virtual void PaintFrame()
Calculate range and clear pad (canvas).
Int_t fCutsOpt[kMaxCuts]
Sign of each cut.
virtual Int_t GetYHighlightBin() const
virtual void PaintH3Iso()
Control function to draw a 3D histogram with Iso Surfaces.
virtual void PaintH3BoxRaster()
Control function to draw a 3D histogram with boxes.
virtual void PaintHist(Option_t *option)
Control routine to draw 1D histograms
virtual Int_t MakeCuts(char *cutsopt)
Decode string choptin and fill Graphical cuts structure.
virtual void DefineColorLevels(Int_t ndivz)
Define the color levels used to paint legos, surfaces etc..
TString fObjectInfo
virtual Int_t GetXHighlightBin() const
virtual void PaintColorLevels(Option_t *option)
Control function to draw a 2D histogram as a color plot.
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
The Legos and Surfaces painter class.
Draw a Pie Chart,.
Definition TPie.h:23
Basic string class.
Definition TString.h:136
Abstract interface to a histogram painter.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
std::pair< Int_t, Int_t > fBinRange
std::pair< Int_t, Int_t > fPixelRange
auto * l
Definition textangle.C:4