Logo ROOT  
Reference Guide
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 
31 class TH1;
32 class TAxis;
33 class TCutG;
34 class TGaxis;
36 class TGraph2DPainter;
37 class TPie;
38 class TF3;
39 
40 const 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 
51 protected:
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 
72 private:
74 
75 public:
76  THistPainter();
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);
89  virtual Bool_t IsInside(Double_t x, Double_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
THistPainter::SetShowProjection
virtual void SetShowProjection(const char *option, Int_t nbins)
Set projection.
Definition: THistPainter.cxx:10610
THistPainter::SetHighlight
virtual void SetHighlight()
Set highlight (enable/disable) mode for fH.
Definition: THistPainter.cxx:3791
l
auto * l
Definition: textangle.C:4
THistPainter::PaintFunction
virtual void PaintFunction(Option_t *option)
Paint functions associated to an histogram.
Definition: THistPainter.cxx:6708
THistPainter::IsInside
virtual Bool_t IsInside(Int_t x, Int_t y)
Return kTRUE if the cell ix, iy is inside one of the graphical cuts.
Definition: THistPainter.cxx:3928
TAxis
Class to manage histogram axis.
Definition: TAxis.h:30
THistPainter::PaintFrame
virtual void PaintFrame()
Calculate range and clear pad (canvas).
Definition: THistPainter.cxx:6685
THistPainter::PaintColorLevelsFast
virtual void PaintColorLevelsFast(Option_t *option)
Rendering scheme for the COL2 and COLZ2 options
Definition: THistPainter.cxx:5481
e
#define e(i)
Definition: RSha256.hxx:121
THistPainter::GetBestFormat
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...
Definition: THistPainter.cxx:10558
THistPainter::fZaxis
TAxis * fZaxis
Definition: THistPainter.h:55
THistPainter::RecursiveRemove
virtual void RecursiveRemove(TObject *)
Recursively remove this object from a list.
Definition: THistPainter.h:142
f
#define f(i)
Definition: RSha256.hxx:122
THistPainter::ShowProjectionX
virtual void ShowProjectionX(Int_t px, Int_t py)
Show projection onto X.
Definition: THistPainter.cxx:10637
THistPainter::PaintHist
virtual void PaintHist(Option_t *option)
Control routine to draw 1D histograms
Definition: THistPainter.cxx:6748
THistPainter::PaintBoxes
virtual void PaintBoxes(Option_t *option)
Control function to draw a 2D histogram as a box plot
Definition: THistPainter.cxx:5082
THistPainter::SetStack
virtual void SetStack(TList *stack)
Definition: THistPainter.h:145
THistPainter
The histogram painter class. Implements all histograms' drawing's options.
Definition: THistPainter.h:49
THistPainter::fCutsOpt
Int_t fCutsOpt[kMaxCuts]
Definition: THistPainter.h:63
THistPainter::fObjectInfo
TString fObjectInfo
Definition: THistPainter.h:73
THistPainter::ProjectAitoff2xy
static Int_t ProjectAitoff2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function.
Definition: THistPainter.cxx:10186
THistPainter::fLego
TPainter3dAlgorithms * fLego
Definition: THistPainter.h:57
THistPainter::fCurrentF3
TF3 * fCurrentF3
Definition: THistPainter.h:70
THistPainter::ShowProjection3
virtual void ShowProjection3(Int_t px, Int_t py)
Show projection (specified by fShowProjection) of a TH3.
Definition: THistPainter.cxx:10808
TVirtualHistPainter.h
THistRenderingRegion
Definition: THistPainter.h:42
THistPainter::ProjectMercator2xy
static Int_t ProjectMercator2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function.
Definition: THistPainter.cxx:10221
THistPainter::PaintAxis
virtual void PaintAxis(Bool_t drawGridOnly=kFALSE)
Draw axis (2D case) of an histogram.
Definition: THistPainter.cxx:4679
Int_t
int Int_t
Definition: RtypesCore.h:45
x
Double_t x[n]
Definition: legend1.C:17
TPie
Definition: TPie.h:23
THistPainter::PaintErrors
virtual void PaintErrors(Option_t *option)
Draw 1D histograms error bars.
Definition: THistPainter.cxx:6231
THistPainter::PaintH3Box
virtual void PaintH3Box(Int_t iopt)
Control function to draw a 3D histogram with boxes.
Definition: THistPainter.cxx:7382
THistRenderingRegion::fBinRange
std::pair< Int_t, Int_t > fBinRange
Definition: THistPainter.h:45
THistPainter::fH
TH1 * fH
Definition: THistPainter.h:52
THistPainter::PaintStat2
virtual void PaintStat2(Int_t dostat, TF1 *fit)
Draw the statistics box for 2D histograms.
Definition: THistPainter.cxx:8672
THistPainter::fNcuts
Int_t fNcuts
Definition: THistPainter.h:62
THistPainter::fPie
TPie * fPie
Definition: THistPainter.h:59
THistPainter::PaintTH2PolyScatterPlot
virtual void PaintTH2PolyScatterPlot(Option_t *option)
Control function to draw a TH2Poly as a scatter plot.
Definition: THistPainter.cxx:9741
TString
Definition: TString.h:136
THistPainter::GetContourList
virtual TList * GetContourList(Double_t contour) const
Get a contour (as a list of TGraphs) using the Delaunay triangulation.
Definition: THistPainter.cxx:3635
THistPainter::PaintSurface
virtual void PaintSurface(Option_t *option)
Control function to draw a 2D histogram as a surface plot.
Definition: THistPainter.cxx:9104
THistPainter::PaintText
virtual void PaintText(Option_t *option)
Control function to draw a 1D/2D histograms with the bin values.
Definition: THistPainter.cxx:9912
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
THistPainter::THistPainter
THistPainter()
Default constructor.
Definition: THistPainter.cxx:3122
v
@ v
Definition: rootcling_impl.cxx:3635
THistPainter::Paint
virtual void Paint(Option_t *option="")
Control routine to paint any kind of histograms
Definition: THistPainter.cxx:4392
b
#define b(i)
Definition: RSha256.hxx:118
TString.h
THistPainter::PaintContourLine
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.
Definition: THistPainter.cxx:6174
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
THistPainter::fShowProjection
Int_t fShowProjection
Definition: THistPainter.h:66
THistPainter::GetXHighlightBin
virtual Int_t GetXHighlightBin() const
Definition: THistPainter.h:85
THistPainter::fShowOption
TString fShowOption
Definition: THistPainter.h:67
THistPainter::PaintLego
virtual void PaintLego(Option_t *option)
Control function to draw a 2D histogram as a lego plot.
Definition: THistPainter.cxx:7861
TVirtualHistPainter
Definition: TVirtualHistPainter.h:30
THistPainter::fXHighlightBin
Int_t fXHighlightBin
Definition: THistPainter.h:68
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
THistPainter::ProcessMessage
virtual void ProcessMessage(const char *mess, const TObject *obj)
Process message mess.
Definition: THistPainter.cxx:10166
THistPainter::PaintTH2PolyBins
virtual void PaintTH2PolyBins(Option_t *option)
Control function to draw a TH2Poly bins' contours.
Definition: THistPainter.cxx:9568
THistPainter::PaintInit
virtual Int_t PaintInit()
Compute histogram parameters used by the drawing routines.
Definition: THistPainter.cxx:6981
THistPainter::MakeChopt
virtual Int_t MakeChopt(Option_t *option)
Decode string choptin and fill Hoption structure.
Definition: THistPainter.cxx:3962
h
#define h(i)
Definition: RSha256.hxx:124
THistPainter::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute the actions corresponding to event.
Definition: THistPainter.cxx:3395
THistPainter::PaintColorLevels
virtual void PaintColorLevels(Option_t *option)
Control function to draw a 2D histogram as a color plot.
Definition: THistPainter.cxx:5670
THistPainter::ShowProjectionY
virtual void ShowProjectionY(Int_t px, Int_t py)
Show projection onto Y.
Definition: THistPainter.cxx:10720
THistPainter::PaintArrows
virtual void PaintArrows(Option_t *option)
Control function to draw a table as an arrow plot
Definition: THistPainter.cxx:4581
THistPainter::DrawPanel
virtual void DrawPanel()
Display a panel with all histogram drawing options.
Definition: THistPainter.cxx:3375
THistPainter::PaintStat3
virtual void PaintStat3(Int_t dostat, TF1 *fit)
Draw the statistics box for 3D histograms.
Definition: THistPainter.cxx:8889
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
THistPainter::PaintContour
virtual void PaintContour(Option_t *option)
Control function to draw a 2D histogram as a contour plot.
Definition: THistPainter.cxx:5833
THistPainter::PaintTable
virtual void PaintTable(Option_t *option)
Control function to draw 2D/3D histograms (tables).
Definition: THistPainter.cxx:9481
THistPainter::~THistPainter
virtual ~THistPainter()
Default destructor.
Definition: THistPainter.cxx:3173
THistPainter::PaintInitH
virtual Int_t PaintInitH()
Compute histogram parameters used by the drawing routines for a rotated pad.
Definition: THistPainter.cxx:7217
THistPainter::fXbuf
Double_t * fXbuf
Definition: THistPainter.h:60
THistPainter::GetStack
virtual TList * GetStack() const
Definition: THistPainter.h:84
THistPainter::fYaxis
TAxis * fYaxis
Definition: THistPainter.h:54
THistPainter::PaintCandlePlot
virtual void PaintCandlePlot(Option_t *option)
Control function to draw a 2D histogram as a candle (box) plot or violin plot
Definition: THistPainter.cxx:5267
TF3
Definition: TF3.h:28
THistPainter::HighlightBin
virtual void HighlightBin(Int_t px, Int_t py)
Check on highlight bin.
Definition: THistPainter.cxx:3807
y
Double_t y[n]
Definition: legend1.C:17
THistPainter::PaintPalette
virtual void PaintPalette()
Paint the color palette on the right side of the pad.
Definition: THistPainter.cxx:8262
THistPainter::PaintTH2PolyColorLevels
virtual void PaintTH2PolyColorLevels(Option_t *option)
Control function to draw a TH2Poly as a color plot.
Definition: THistPainter.cxx:9644
THistPainter::ProjectParabolic2xy
static Int_t ProjectParabolic2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function code from Ernst-Jan Buis.
Definition: THistPainter.cxx:10244
THistPainter::fCuts
TCutG * fCuts[kMaxCuts]
Definition: THistPainter.h:64
THistPainter::PaintTitle
virtual void PaintTitle()
Draw the histogram title.
Definition: THistPainter.cxx:10078
THistPainter::PaintSpecialObjects
static void PaintSpecialObjects(const TObject *obj, Option_t *option)
Static function to paint special objects like vectors and matrices.
Definition: THistPainter.cxx:8417
THistPainter::PaintBarH
virtual void PaintBarH(Option_t *option)
Draw a bar char in a rotated pad (X vertical, Y horizontal)
Definition: THistPainter.cxx:5005
Double_t
double Double_t
Definition: RtypesCore.h:59
THistPainter::ComputeRenderingRegions
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.
Definition: THistPainter.cxx:5376
kMaxCuts
const Int_t kMaxCuts
Definition: THistPainter.h:40
THistPainter::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance from the point px,py to a line.
Definition: THistPainter.cxx:3187
THistPainter::GetObjectInfo
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...
Definition: THistPainter.cxx:3663
TGaxis
Definition: TGaxis.h:23
THistPainter::fXaxis
TAxis * fXaxis
Definition: THistPainter.h:53
THistPainter::DefineColorLevels
virtual void DefineColorLevels(Int_t ndivz)
Define the color levels used to paint legos, surfaces etc..
Definition: THistPainter.cxx:9453
THistPainter::PaintScatterPlot
virtual void PaintScatterPlot(Option_t *option)
Control function to draw a 2D histogram as a scatter plot.
Definition: THistPainter.cxx:8301
THistPainter::TableInit
virtual Int_t TableInit()
Initialize various options to draw 2D histograms.
Definition: THistPainter.cxx:10380
TObject
Definition: TObject.h:37
THistPainter::PaintHighlightBin
virtual void PaintHighlightBin(Option_t *option="")
Paint highlight bin as TBox object.
Definition: THistPainter.cxx:3842
THistPainter::PaintStat
virtual void PaintStat(Int_t dostat, TF1 *fit)
Draw the statistics box for 1D and profile histograms.
Definition: THistPainter.cxx:8455
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TH1
Definition: TH1.h:57
THistPainter::SetHistogram
virtual void SetHistogram(TH1 *h)
Set current histogram to h
Definition: THistPainter.cxx:10366
THistRenderingRegion::fPixelRange
std::pair< Int_t, Int_t > fPixelRange
Definition: THistPainter.h:44
THistPainter::PaintH3Iso
virtual void PaintH3Iso()
Control function to draw a 3D histogram with Iso Surfaces.
Definition: THistPainter.cxx:7743
TCutG
Definition: TCutG.h:20
THistPainter::fGraph2DPainter
TGraph2DPainter * fGraph2DPainter
Definition: THistPainter.h:58
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TGraph2DPainter
The TGraphDelaunay painting class.
Definition: TGraph2DPainter.h:31
THistPainter::Paint2DErrors
virtual void Paint2DErrors(Option_t *option)
Draw 2D histograms errors.
Definition: THistPainter.cxx:6524
THistPainter::fFunctions
TList * fFunctions
Definition: THistPainter.h:56
TPainter3dAlgorithms
The Legos and Surfaces painter class.
Definition: TPainter3dAlgorithms.h:28
THistPainter::fStack
TList * fStack
Definition: THistPainter.h:65
THistPainter::PaintTF3
virtual void PaintTF3()
Control function to draw a 3D implicit functions.
Definition: THistPainter.cxx:10008
THistPainter::MakeCuts
virtual Int_t MakeCuts(char *cutsopt)
Decode string choptin and fill Graphical cuts structure.
Definition: THistPainter.cxx:4345
TF1
1-Dim function class
Definition: TF1.h:212
THistPainter::fYHighlightBin
Int_t fYHighlightBin
Definition: THistPainter.h:69
THistPainter::RecalculateRange
virtual void RecalculateRange()
Recompute the histogram range following graphics operations.
Definition: THistPainter.cxx:10255
THistPainter::PaintTriangles
virtual void PaintTriangles(Option_t *option)
Control function to draw a table using Delaunay triangles.
Definition: THistPainter.cxx:9353
THistPainter::PaintTH2PolyText
virtual void PaintTH2PolyText(Option_t *option)
Control function to draw a TH2Poly as a text plot.
Definition: THistPainter.cxx:9854
THistPainter::PaintH3BoxRaster
virtual void PaintH3BoxRaster()
Control function to draw a 3D histogram with boxes.
Definition: THistPainter.cxx:7557
THistPainter::PaintBar
virtual void PaintBar(Option_t *option)
Draw a bar-chart in a normal pad.
Definition: THistPainter.cxx:4956
THistPainter::PaintLegoAxis
virtual void PaintLegoAxis(TGaxis *axis, Double_t ang)
Draw the axis for legos and surface plots.
Definition: THistPainter.cxx:8078
TList
Definition: TList.h:44
THistPainter::ProjectSinusoidal2xy
static Int_t ProjectSinusoidal2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function code from Ernst-Jan Buis.
Definition: THistPainter.cxx:10233
THistPainter::GetYHighlightBin
virtual Int_t GetYHighlightBin() const
Definition: THistPainter.h:86
int
THistPainter::fYbuf
Double_t * fYbuf
Definition: THistPainter.h:61
THistPainter::PaintH3
virtual void PaintH3(Option_t *option="")
Control function to draw a 3D histograms.
Definition: THistPainter.cxx:6890