Logo ROOT   6.08/07
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 #ifndef ROOT_TVirtualHistPainter
25 #include "TVirtualHistPainter.h"
26 #endif
27 #ifndef ROOT_TString
28 #include "TString.h"
29 #endif
30 
31 #include <vector>
32 #include <utility>
33 
34 
35 class TH1;
36 class TAxis;
37 class TCutG;
38 class TGaxis;
40 class TGraph2DPainter;
41 class TPie;
42 const Int_t kMaxCuts = 16;
43 
45 {
46  std::pair<Int_t, Int_t> fPixelRange;
47  std::pair<Int_t, Int_t> fBinRange;
48 };
49 
50 
52 
53 protected:
54  TH1 *fH; //pointer to histogram to paint
55  TAxis *fXaxis; //pointer to X axis
56  TAxis *fYaxis; //pointer to Y axis
57  TAxis *fZaxis; //pointer to Z axis
58  TList *fFunctions; //pointer to histogram list of functions
59  TPainter3dAlgorithms *fLego; //pointer to a TPainter3dAlgorithms object
60  TGraph2DPainter *fGraph2DPainter; //pointer to a TGraph2DPainter object
61  TPie *fPie; //pointer to a TPie in case of option PIE
62  Double_t *fXbuf; //X buffer coordinates
63  Double_t *fYbuf; //Y buffer coordinates
64  Int_t fNcuts; //Number of graphical cuts
65  Int_t fCutsOpt[kMaxCuts]; //sign of each cut
66  TCutG *fCuts[kMaxCuts]; //Pointers to graphical cuts
67  TList *fStack; //Pointer to stack of histograms (if any)
68  Int_t fShowProjection; //True if a projection must be drawn
69  TString fShowOption; //Option to draw the projection
70 
71 public:
72  THistPainter();
73  virtual ~THistPainter();
74  virtual void DefineColorLevels(Int_t ndivz);
75  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
76  virtual void DrawPanel();
77  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
78  virtual TList *GetContourList(Double_t contour) const;
79  virtual char *GetObjectInfo(Int_t px, Int_t py) const;
80  virtual TList *GetStack() const {return fStack;}
81  virtual Bool_t IsInside(Int_t x, Int_t y);
82  virtual Bool_t IsInside(Double_t x, Double_t y);
83  virtual Int_t MakeChopt(Option_t *option);
84  virtual Int_t MakeCuts(char *cutsopt);
85  virtual void Paint(Option_t *option="");
86  virtual void PaintArrows(Option_t *option);
87  virtual void PaintAxis(Bool_t drawGridOnly=kFALSE);
88  virtual void PaintBar(Option_t *option);
89  virtual void PaintBarH(Option_t *option);
90  virtual void PaintBoxes(Option_t *option);
91  virtual void PaintCandlePlot(Option_t *option);
92  virtual void PaintViolinPlot(Option_t *option);
93  virtual void PaintColorLevels(Option_t *option);
94  virtual void PaintColorLevelsFast(Option_t *option);
95  virtual std::vector<THistRenderingRegion> ComputeRenderingRegions(TAxis *pAxis, Int_t nPixels, bool isLog);
96 
97  virtual void PaintTH2PolyBins(Option_t *option);
98  virtual void PaintTH2PolyColorLevels(Option_t *option);
99  virtual void PaintTH2PolyScatterPlot(Option_t *option);
100  virtual void PaintTH2PolyText(Option_t *option);
101  virtual void PaintContour(Option_t *option);
102  virtual Int_t PaintContourLine(Double_t elev1, Int_t icont1, Double_t x1, Double_t y1,
103  Double_t elev2, Int_t icont2, Double_t x2, Double_t y2,
104  Double_t *xarr, Double_t *yarr, Int_t *itarr, Double_t *levels);
105  virtual void PaintErrors(Option_t *option);
106  virtual void Paint2DErrors(Option_t *option);
107  virtual void PaintFrame();
108  virtual void PaintFunction(Option_t *option);
109  virtual void PaintHist(Option_t *option);
110  virtual void PaintH3(Option_t *option="");
111  virtual void PaintH3Iso();
112  virtual Int_t PaintInit();
113  virtual Int_t PaintInitH();
114  virtual void PaintLego(Option_t *option);
115  virtual void PaintLegoAxis(TGaxis *axis, Double_t ang);
116  virtual void PaintPalette();
117  virtual void PaintScatterPlot(Option_t *option);
118  virtual void PaintStat(Int_t dostat, TF1 *fit);
119  virtual void PaintStat2(Int_t dostat, TF1 *fit);
120  virtual void PaintStat3(Int_t dostat, TF1 *fit);
121  virtual void PaintSurface(Option_t *option);
122  virtual void PaintTriangles(Option_t *option);
123  virtual void PaintTable(Option_t *option);
124  virtual void PaintText(Option_t *option);
125  virtual void PaintTitle();
126  virtual void PaintTF3();
127  virtual void ProcessMessage(const char *mess, const TObject *obj);
128  static Int_t ProjectAitoff2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab);
129  static Int_t ProjectMercator2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab);
130  static Int_t ProjectSinusoidal2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab);
131  static Int_t ProjectParabolic2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab);
132  virtual void RecalculateRange();
133  virtual void RecursiveRemove(TObject *) {;}
134  virtual void SetHistogram(TH1 *h);
135  virtual void SetStack(TList *stack) {fStack = stack;}
136  virtual void SetShowProjection(const char *option,Int_t nbins);
137  virtual void ShowProjectionX(Int_t px, Int_t py);
138  virtual void ShowProjectionY(Int_t px, Int_t py);
139  virtual void ShowProjection3(Int_t px, Int_t py);
140  virtual Int_t TableInit();
141 
142  static const char *GetBestFormat(Double_t v, Double_t e, const char *f);
143  static void PaintSpecialObjects(const TObject *obj, Option_t *option);
144 
145  ClassDef(THistPainter,0) //Helper class to draw histograms
146 };
147 
148 #endif
Double_t * fYbuf
Definition: THistPainter.h:63
const Int_t kMaxCuts
Definition: THistPainter.h:42
const char Option_t
Definition: RtypesCore.h:62
TH1 * h
Definition: legend2.C:5
std::pair< Int_t, Int_t > fBinRange
Definition: THistPainter.h:47
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
int nbins[3]
TAxis * fYaxis
Definition: THistPainter.h:56
static const double x2[5]
Graphical cut class.
Definition: TCutG.h:22
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
Abstract interface to a histogram painter.
virtual void RecursiveRemove(TObject *)
Recursively remove this object from a list.
Definition: THistPainter.h:133
TAxis * fZaxis
Definition: THistPainter.h:57
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
Definition: TMath.h:1043
TList * fFunctions
Definition: THistPainter.h:58
A doubly linked list.
Definition: TList.h:47
virtual void SetStack(TList *stack)
Definition: THistPainter.h:135
Class to manage histogram axis.
Definition: TAxis.h:36
Int_t fShowProjection
Definition: THistPainter.h:68
SVector< double, 2 > v
Definition: Dict.h:5
virtual TList * GetStack() const
Definition: THistPainter.h:80
TString fShowOption
Definition: THistPainter.h:69
TLine * l
Definition: textangle.C:4
The axis painter class.
Definition: TGaxis.h:30
The histogram painter class.
Definition: THistPainter.h:51
static const double x1[5]
double f(double x)
double Double_t
Definition: RtypesCore.h:55
TGraph2DPainter * fGraph2DPainter
Definition: THistPainter.h:60
The Legos and Surfaces painter class.
Double_t * fXbuf
Definition: THistPainter.h:62
Double_t y[n]
Definition: legend1.C:17
The TH1 histogram class.
Definition: TH1.h:80
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:31
TList * fStack
Definition: THistPainter.h:67
Mother of all ROOT objects.
Definition: TObject.h:37
TPainter3dAlgorithms * fLego
Definition: THistPainter.h:59
1-Dim function class
Definition: TF1.h:149
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
The TGraphDelaunay painting class.
std::pair< Int_t, Int_t > fPixelRange
Definition: THistPainter.h:46
TAxis * fXaxis
Definition: THistPainter.h:55