Logo ROOT   6.19/01
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 const Int_t kMaxCuts = 16;
39 
41 {
42  std::pair<Int_t, Int_t> fPixelRange;
43  std::pair<Int_t, Int_t> fBinRange;
44 };
45 
46 
48 
49 protected:
50  TH1 *fH; //pointer to histogram to paint
51  TAxis *fXaxis; //pointer to X axis
52  TAxis *fYaxis; //pointer to Y axis
53  TAxis *fZaxis; //pointer to Z axis
54  TList *fFunctions; //pointer to histogram list of functions
55  TPainter3dAlgorithms *fLego; //pointer to a TPainter3dAlgorithms object
56  TGraph2DPainter *fGraph2DPainter; //pointer to a TGraph2DPainter object
57  TPie *fPie; //pointer to a TPie in case of option PIE
58  Double_t *fXbuf; //X buffer coordinates
59  Double_t *fYbuf; //Y buffer coordinates
60  Int_t fNcuts; //Number of graphical cuts
61  Int_t fCutsOpt[kMaxCuts]; //sign of each cut
62  TCutG *fCuts[kMaxCuts]; //Pointers to graphical cuts
63  TList *fStack; //Pointer to stack of histograms (if any)
64  Int_t fShowProjection; //True if a projection must be drawn
65  TString fShowOption; //Option to draw the projection
66  Int_t fXHighlightBin; //X highlight bin
67  Int_t fYHighlightBin; //Y highlight bin
68 
69 private:
71 
72 public:
73  THistPainter();
74  virtual ~THistPainter();
75  virtual void DefineColorLevels(Int_t ndivz);
76  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
77  virtual void DrawPanel();
78  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
79  virtual TList *GetContourList(Double_t contour) const;
80  virtual char *GetObjectInfo(Int_t px, Int_t py) const;
81  virtual TList *GetStack() const {return fStack;}
82  virtual Int_t GetXHighlightBin() const { return fXHighlightBin; }
83  virtual Int_t GetYHighlightBin() const { return fYHighlightBin; }
84  virtual void HighlightBin(Int_t px, Int_t py);
85  virtual Bool_t IsInside(Int_t x, Int_t y);
86  virtual Bool_t IsInside(Double_t x, Double_t y);
87  virtual Int_t MakeChopt(Option_t *option);
88  virtual Int_t MakeCuts(char *cutsopt);
89  virtual void Paint(Option_t *option="");
90  virtual void PaintArrows(Option_t *option);
91  virtual void PaintAxis(Bool_t drawGridOnly=kFALSE);
92  virtual void PaintBar(Option_t *option);
93  virtual void PaintBarH(Option_t *option);
94  virtual void PaintBoxes(Option_t *option);
95  virtual void PaintCandlePlot(Option_t *option);
96  virtual void PaintColorLevels(Option_t *option);
97  virtual void PaintColorLevelsFast(Option_t *option);
98  virtual std::vector<THistRenderingRegion> ComputeRenderingRegions(TAxis *pAxis, Int_t nPixels, bool isLog);
99 
100  virtual void PaintTH2PolyBins(Option_t *option);
101  virtual void PaintTH2PolyColorLevels(Option_t *option);
102  virtual void PaintTH2PolyScatterPlot(Option_t *option);
103  virtual void PaintTH2PolyText(Option_t *option);
104  virtual void PaintContour(Option_t *option);
105  virtual Int_t PaintContourLine(Double_t elev1, Int_t icont1, Double_t x1, Double_t y1,
106  Double_t elev2, Int_t icont2, Double_t x2, Double_t y2,
107  Double_t *xarr, Double_t *yarr, Int_t *itarr, Double_t *levels);
108  virtual void PaintErrors(Option_t *option);
109  virtual void Paint2DErrors(Option_t *option);
110  virtual void PaintFrame();
111  virtual void PaintFunction(Option_t *option);
112  virtual void PaintHighlightBin(Option_t *option="");
113  virtual void PaintHist(Option_t *option);
114  virtual void PaintH3(Option_t *option="");
115  virtual void PaintH3Box(Int_t iopt);
116  virtual void PaintH3BoxRaster();
117  virtual void PaintH3Iso();
118  virtual Int_t PaintInit();
119  virtual Int_t PaintInitH();
120  virtual void PaintLego(Option_t *option);
121  virtual void PaintLegoAxis(TGaxis *axis, Double_t ang);
122  virtual void PaintPalette();
123  virtual void PaintScatterPlot(Option_t *option);
124  virtual void PaintStat(Int_t dostat, TF1 *fit);
125  virtual void PaintStat2(Int_t dostat, TF1 *fit);
126  virtual void PaintStat3(Int_t dostat, TF1 *fit);
127  virtual void PaintSurface(Option_t *option);
128  virtual void PaintTriangles(Option_t *option);
129  virtual void PaintTable(Option_t *option);
130  virtual void PaintText(Option_t *option);
131  virtual void PaintTitle();
132  virtual void PaintTF3();
133  virtual void ProcessMessage(const char *mess, const TObject *obj);
138  virtual void RecalculateRange();
139  virtual void RecursiveRemove(TObject *) {;}
140  virtual void SetHighlight();
141  virtual void SetHistogram(TH1 *h);
142  virtual void SetStack(TList *stack) {fStack = stack;}
143  virtual void SetShowProjection(const char *option,Int_t nbins);
144  virtual void ShowProjectionX(Int_t px, Int_t py);
145  virtual void ShowProjectionY(Int_t px, Int_t py);
146  virtual void ShowProjection3(Int_t px, Int_t py);
147  virtual Int_t TableInit();
148 
149  static const char *GetBestFormat(Double_t v, Double_t e, const char *f);
150  static void PaintSpecialObjects(const TObject *obj, Option_t *option);
151 
152  ClassDef(THistPainter,0) //Helper class to draw histograms
153 };
154 
155 #endif
Double_t * fYbuf
Definition: THistPainter.h:59
Int_t fYHighlightBin
Definition: THistPainter.h:67
virtual void PaintFrame()
Calculate range and clear pad (canvas).
virtual void PaintArrows(Option_t *option)
Control function to draw a table as an arrow plot
virtual void PaintStat2(Int_t dostat, TF1 *fit)
Draw the statistics box for 2D histograms.
virtual void PaintContour(Option_t *option)
Control function to draw a 2D histogram as a contour plot.
static Int_t ProjectAitoff2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function.
virtual void PaintH3Box(Int_t iopt)
Control function to draw a 3D histogram with boxes.
const Int_t kMaxCuts
Definition: THistPainter.h:38
virtual void PaintTH2PolyColorLevels(Option_t *option)
Control function to draw a TH2Poly as a color plot.
const char Option_t
Definition: RtypesCore.h:62
THistPainter()
Default constructor.
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 SetHistogram(TH1 *h)
Set current histogram to h
std::pair< Int_t, Int_t > fBinRange
Definition: THistPainter.h:43
virtual Int_t GetYHighlightBin() const
Definition: THistPainter.h:83
virtual void PaintTH2PolyBins(Option_t *option)
Control function to draw a TH2Poly bins&#39; contours.
Basic string class.
Definition: TString.h:131
virtual Int_t PaintInit()
Compute histogram parameters used by the drawing routines.
virtual void Paint2DErrors(Option_t *option)
Draw 2D histograms errors.
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TAxis * fYaxis
Definition: THistPainter.h:52
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.
static Int_t ProjectMercator2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function.
virtual Int_t GetXHighlightBin() const
Definition: THistPainter.h:82
virtual void PaintColorLevelsFast(Option_t *option)
Rendering scheme for the COL2 and COLZ2 options
virtual void PaintHist(Option_t *option)
Control routine to draw 1D histograms
virtual void PaintTriangles(Option_t *option)
Control function to draw a table using Delaunay triangles.
TString fObjectInfo
Definition: THistPainter.h:70
virtual void PaintPalette()
Paint the color palette on the right side of the pad.
static const double x2[5]
virtual void PaintBoxes(Option_t *option)
Control function to draw a 2D histogram as a box plot
Graphical cut class.
Definition: TCutG.h:20
Double_t x[n]
Definition: legend1.C:17
virtual void ProcessMessage(const char *mess, const TObject *obj)
Process message mess.
virtual void PaintCandlePlot(Option_t *option)
Control function to draw a 2D histogram as a candle (box) plot or violin plot
#define ClassDef(name, id)
Definition: Rtypes.h:326
TCutG * fCuts[kMaxCuts]
Definition: THistPainter.h:62
virtual void PaintSurface(Option_t *option)
Control function to draw a 2D histogram as a surface plot.
virtual void PaintStat(Int_t dostat, TF1 *fit)
Draw the statistics box for 1D and profile histograms.
Abstract interface to a histogram painter.
virtual Int_t MakeCuts(char *cutsopt)
Decode string choptin and fill Graphical cuts structure.
virtual Int_t MakeChopt(Option_t *option)
Decode string choptin and fill Hoption structure.
virtual void PaintH3(Option_t *option="")
Control function to draw a 3D histograms.
virtual void PaintColorLevels(Option_t *option)
Control function to draw a 2D histogram as a color plot.
virtual void RecursiveRemove(TObject *)
Recursively remove this object from a list.
Definition: THistPainter.h:139
TAxis * fZaxis
Definition: THistPainter.h:53
virtual Bool_t IsInside(Int_t x, Int_t y)
Return kTRUE if the cell ix, iy is inside one of the graphical cuts.
virtual void PaintHighlightBin(Option_t *option="")
Paint highlight bin as TBox object.
virtual void PaintTH2PolyScatterPlot(Option_t *option)
Control function to draw a TH2Poly as a scatter plot.
virtual void PaintTH2PolyText(Option_t *option)
Control function to draw a TH2Poly as a text plot.
TList * fFunctions
Definition: THistPainter.h:54
virtual void HighlightBin(Int_t px, Int_t py)
Check on highlight bin.
A doubly linked list.
Definition: TList.h:44
virtual Int_t PaintInitH()
Compute histogram parameters used by the drawing routines for a rotated pad.
virtual void RecalculateRange()
Recompute the histogram range following graphics operations.
virtual void SetStack(TList *stack)
Definition: THistPainter.h:142
virtual void PaintText(Option_t *option)
Control function to draw a 1D/2D histograms with the bin values.
virtual Int_t TableInit()
Initialize various options to draw 2D histograms.
Class to manage histogram axis.
Definition: TAxis.h:30
Int_t fShowProjection
Definition: THistPainter.h:64
virtual void PaintTF3()
Control function to draw a 3D implicit functions.
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 Paint(Option_t *option="")
Control routine to paint any kind of histograms
virtual TList * GetStack() const
Definition: THistPainter.h:81
virtual void PaintStat3(Int_t dostat, TF1 *fit)
Draw the statistics box for 3D histograms.
virtual void SetHighlight()
Set highlight (enable/disable) mode for fH.
virtual void PaintTable(Option_t *option)
Control function to draw 2D/3D histograms (tables).
TString fShowOption
Definition: THistPainter.h:65
virtual ~THistPainter()
Default destructor.
virtual void PaintH3Iso()
Control function to draw a 3D histogram with Iso Surfaces.
The axis painter class.
Definition: TGaxis.h:24
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute the actions corresponding to event.
virtual void PaintBar(Option_t *option)
Draw a bar-chart in a normal pad.
virtual void PaintFunction(Option_t *option)
Paint functions associated to an histogram.
#define h(i)
Definition: RSha256.hxx:106
virtual void PaintAxis(Bool_t drawGridOnly=kFALSE)
Draw axis (2D case) of an histogram.
virtual void PaintBarH(Option_t *option)
Draw a bar char in a rotated pad (X vertical, Y horizontal)
const Bool_t kFALSE
Definition: RtypesCore.h:88
The histogram painter class.
Definition: THistPainter.h:47
Int_t fCutsOpt[kMaxCuts]
Definition: THistPainter.h:61
virtual void PaintLegoAxis(TGaxis *axis, Double_t ang)
Draw the axis for legos and surface plots.
static const double x1[5]
double Double_t
Definition: RtypesCore.h:55
TGraph2DPainter * fGraph2DPainter
Definition: THistPainter.h:56
The Legos and Surfaces painter class.
virtual void ShowProjectionX(Int_t px, Int_t py)
Show projection onto X.
Double_t * fXbuf
Definition: THistPainter.h:58
Int_t fXHighlightBin
Definition: THistPainter.h:66
Double_t y[n]
Definition: legend1.C:17
The TH1 histogram class.
Definition: TH1.h:56
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
Draw a Pie Chart,.
Definition: TPie.h:23
virtual void PaintTitle()
Draw the histogram title.
virtual void SetShowProjection(const char *option, Int_t nbins)
Set projection.
virtual void PaintLego(Option_t *option)
Control function to draw a 2D histogram as a lego plot.
virtual void ShowProjectionY(Int_t px, Int_t py)
Show projection onto Y.
TList * fStack
Definition: THistPainter.h:63
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void DrawPanel()
Display a panel with all histogram drawing options.
static Int_t ProjectSinusoidal2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function code from Ernst-Jan Buis.
static Int_t ProjectParabolic2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
Static function code from Ernst-Jan Buis.
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.
TPainter3dAlgorithms * fLego
Definition: THistPainter.h:55
auto * l
Definition: textangle.C:4
virtual void ShowProjection3(Int_t px, Int_t py)
Show projection (specified by fShowProjection) of a TH3.
1-Dim function class
Definition: TF1.h:211
static void PaintSpecialObjects(const TObject *obj, Option_t *option)
Static function to paint special objects like vectors and matrices.
virtual void PaintErrors(Option_t *option)
Draw 1D histograms error bars.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance from the point px,py to a line.
virtual void PaintScatterPlot(Option_t *option)
Control function to draw a 2D histogram as a scatter plot.
The TGraphDelaunay painting class.
virtual TList * GetContourList(Double_t contour) const
Get a contour (as a list of TGraphs) using the Delaunay triangulation.
std::pair< Int_t, Int_t > fPixelRange
Definition: THistPainter.h:42
virtual void PaintH3BoxRaster()
Control function to draw a 3D histogram with boxes.
TAxis * fXaxis
Definition: THistPainter.h:51
virtual void DefineColorLevels(Int_t ndivz)
Define the color levels used to paint legos, surfaces etc..