THistPainter


class description - source file - inheritance tree

class THistPainter : public TVirtualHistPainter


    public:
THistPainter THistPainter() THistPainter THistPainter(THistPainter&) virtual void ~THistPainter() TClass* Class() virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) virtual void DrawPanel() virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) virtual void FitPanel() virtual char* GetObjectInfo(Int_t px, Int_t py) virtual TClass* IsA() const virtual Int_t MakeChopt(Option_t* option) virtual void Paint(Option_t* option) virtual void PaintArrows() virtual void PaintAxis() virtual void PaintBoxes() virtual void PaintColorLevels() virtual void PaintContour() virtual Int_t PaintContourLine(Float_t elev1, Int_t icont1, Float_t x1, Float_t y1, Float_t elev2, Int_t icont2, Float_t x2, Float_t y2, Float_t* xarr, Float_t* yarr, Int_t* itarr) virtual void PaintErrors() virtual void PaintFrame() virtual void PaintFunction() virtual void PaintH3(Option_t* option) virtual void PaintHist() virtual Int_t PaintInit() virtual void PaintLego() virtual void PaintLegoAxis(TGaxis* axis, Float_t ang) virtual void PaintPalette() virtual void PaintScatterPlot() virtual void PaintStat(Int_t dostat, TF1* fit) virtual void PaintStat2(Int_t dostat, TF1* fit) virtual void PaintSurface() virtual void PaintTable() virtual void PaintText() virtual void PaintTitle() virtual void RecalculateRange() virtual void SetHistogram(TH1* h) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) virtual Int_t TableInit()

Data Members

protected:
TH1* fH pointer to histogram to paint TAxis* fXaxis pointer to X axis TAxis* fYaxis pointer to Y axis TAxis* fZaxis pointer to Z axis TList* fFunctions pointer to histogram list of functions TLego* fLego pointer to a TLego object Float_t* fXbuf X buffer coodinates Float_t* fYbuf Y buffer coodinates Int_t fNIDS Number of stacked histograms

Class Description

   The histogram painter class
   ===========================


THistPainter()
*-*-*-*-*-*-*-*-*-*-*Histogram default constructor*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  =============================

~THistPainter()
*-*-*-*-*-*-*-*-*-*-*Histogram default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  ============================

Int_t DistancetoPrimitive(Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a line*-*-*-*-*-*
*-*                  ===========================================
*-*  Compute the closest distance of approach from point px,py to elements
*-*  of an histogram.
*-*  The distance is computed in pixels units.
*-*
*-*  Algorithm:
*-*  Currently, this simple model computes the distance from the mouse
*-*  to the histogram contour only.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void DrawPanel()
*-*-*-*-*-*-*Display a panel with all histogram drawing options*-*-*-*-*-*
*-*          ==================================================
*-*
*-*   See class TDrawPanelHist for example

void ExecuteEvent(Int_t event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
*-*                  =========================================
*-*  This member function is called when a histogram is clicked with the locator
*-*
*-*  If Left button clicked on the bin top value, then the content of this bin
*-*  is modified according to the new position of the mouse when it is released.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void FitPanel()
*-*-*-*-*-*-*Display a panel with all histogram fit options*-*-*-*-*-*
*-*          ==============================================
*-*
*-*   See class TFitPanel for example

char* GetObjectInfo(Int_t px, Int_t py)
   Redefines TObject::GetObjectInfo.
   Displays the histogram info (bin number, contents, integral up to bin
   corresponding to cursor position px,py


Int_t MakeChopt(Option_t *choptin)
*-*-*-*-*-*-*-*-*Decode string chopt and fill Hoption structure*-*-*-*-*-*-*
*-*              ==============================================

void Paint(Option_t *option)
*-*-*-*-*-*-*-*-*Control routine to paint any kind of histograms*-*-*-*-*-*-*
*-*              ===============================================

  This function is automatically called by TCanvas::Update.
  (see THistPainter::Draw for the list of options)

void PaintArrows()
*-*-*-*-*-*-*-*Control function to draw a table as an arrow plot*-*-*-*-*-*
*-*            =================================================
*-*
*-*    For each cell (i,j) an arrow is drawn
*-*    The orientation of the arrow follows the cell gradient

/*

*/

*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void PaintAxis()
*-*-*-*-*-*-*-*-*-*-*-*Draw axis of an histogram*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                    =========================

   Assume tx = gPad->GetTickx() and ty = gPad->GetTicky()
   by default only the left Y axis and X bottom axis are drawn (tx = ty = 0)
    tx = 1 ;  tick marks on top side are drawn (inside)
    tx = 2;   tick marks and labels on top side are drawn
    ty = 1;   tick marks on right side are drawn (inside)
    ty = 2;   tick marks and labels on right side are drawn
       Use TPad::SetTicks(tx,ty) to set these options

void PaintBoxes()
*-*-*-*-*-*-*-*Control function to draw a table as a box plot*-*-*-*-*-*
*-*            ==============================================
*-*
*-*    For each cell (i,j) a box is drawn.
*-*    The size of the box is proportional to the cell content.

/*

*/

*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void PaintColorLevels()
*-*-*-*-*-*-*-*Control function to draw a table as a color plot*-*-*-*-*-*
*-*            ================================================
*-*
*-*    For each cell (i,j) a box is drawn with a color proportional
*-*    to the cell content.
*-*    The color table used is defined in the current style (gStyle).
*-*    The color palette in TStyle can be modified via TStyle::SetPalette.

/*

*/

*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void PaintContour()
*-*-*-*-*-*-*-*Control function to draw a table as a contour plot*-*-*-*-*-*
*-*            =================================================
*-*  Hoption.Contour may have the following values:
*-*     1  The contour is drawn with filled colour levels.
*-*        The levels are equidistant.
*-*    11  Use colour to distinguish contours.
*-*    12  Use line style to distinguish contours.
*-*    13  Line style and colour are the same for all contours.

/*

*/

*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Int_t PaintContourLine(Float_t elev1, Int_t icont1, Float_t x1, Float_t y1, Float_t elev2, Int_t icont2, Float_t x2, Float_t y2, Float_t *xarr, Float_t *yarr, Int_t *itarr)
*-*-*-*-*-*-*-*Fill the matrix XARR YARR for Contour Plot*-*-*-*-*-*-*-*
*-*            ==========================================
*-*

void PaintErrors()
*-*-*-*-*-*-*-*-*-*-*Draw histogram error bars*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-
*-*-   Draws error bars for the current histogram. The current polymarker
*-*-   is drawn at the centre of the errors according to CHOPT:
*-*-
*-*-   ' ' Coordinates are expressed in histogram coordinates
*-*-       (of the last drawn histogram). Error bars are drawn.
*-*-   '1' Small lines are drawn at the end of the error bars.
*-*-   '2' Error rectangles are drawn.
*-*-   '3' A filled area is drawn through the end points of the vertical
*-*-       error bars.
*-*-   '4' A smoothed filled area is drawn through the end points of the
*-*-       vertical error bars.
*-*-   '0' Turn off the symbols clipping.

/*

*/

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void PaintFrame()
*-*-*-*-*-*-*-*-*-*Calculate range and clear pad (canvas)*-*-*-*-*-*-*-*-*-*
*-*                ======================================

void PaintFunction()
*-*-*-*-*-*-*-*-*-*-*Paint functions associated to an histogram*-*-*-*-*-*-*
*-*                  ==========================================

   An associated function is created by THistPainter::Fit. Note that more than
   on fitted function can be associated with one histogram (see THistPainter::Fit).

   A TF1 object can be added to the list of associated functions directly
   by a user without calling THistPainter::Fit.
   To add a new function to the list of associated functions, do
     h->GetListOfFunctions()->Add(f1);
   To retrieve a function by name from this list, do:
     TF1 *f1 = (TF1*)h->GetListOfFunctions()->FindObject(name);
   or
     TF1 *f1 = h->GetFunction(name);


void PaintHist()
*-*-*-*-*-*-*-*-*-*Control routine to draw an histogram*-*-*-*-*-*-*-*-*-*-*
*-*                ====================================

void PaintH3(Option_t *option)
*-*-*-*-*-*-*-*-*-*Control function to draw a 3-D histogram*-*-*-*-*-*-*-*-*
*-*                ========================================

Int_t PaintInit()
*-*-*-*-*-*-*Compute histogram parameters used by the drawing routines*-*-*-*
*-*          =========================================================

void PaintLego()
*-*-*-*-*-*-*-*Control function to draw a table as a lego plot*-*-*-*-*-*
*-*            ===============================================
*-*
*-*     In a lego plot, cell contents are represented as 3-d boxes.
*-*     The height of the box is proportional to the cell content.
*-*
*-*    A lego plot can be represented in several coordinate systems.
*-*    Default system is Cartesian coordinates.
*-*    Possible systems are CYL,POL,SPH,PSR.
*-*
*-*   See THistPainter::Draw for the list of Lego options.
*-*   See TLego for more examples of lego options.

      See TStyle::SetPalette to change the color palette.
      It is suggested to use palette 1 via the call
      gStyle->SetColorPalette(1)


/*

*/

*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void PaintLegoAxis(TGaxis *axis, Float_t ang)
*-*-*-*-*-*-*Draw the axis for legos and surface plots*-*-*-*-*-*-*-*-*-*
*-*          =========================================
*-*

void PaintPalette()
*-*-*-*-*-*-*-*Paint the color palette on the right side of the pad*-*-*-*-*
*-*            ====================================================

void PaintScatterPlot()
*-*-*-*-*-*-*-*Control function to draw a table as a scatter plot*-*-*-*-*
*-*            ==================================================
*-*
*-*    For each cell (i,j) a number of points proportional to the cell
*-*    content is drawn.
*-*    A maximum of 500 points per cell is drawn. If the maximum is above 500
*-*    contents are normalized to 500.

/*

*/

*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void PaintStat(Int_t dostat, TF1 *fit)
*-*-*-*-*-*-*-*-*-*-*-*Draw the statistics box*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                    =======================
 The type of information printed in the histogram statistics box
  can be selected via gStyle->SetOptStat(mode).
  The parameter mode can be = iourmen  (default = 0001111)
    n = 1;  name of histogram is printed
    e = 1;  number of entries printed
    m = 1;  mean value printed
    r = 1;  rms printed
    u = 1;  number of underflows printed
    o = 1;  number of overflows printed
    i = 1;  integral of bins printed
  Example: gStyle->SetOptStat(11);
           print only name of histogram and number of entries.

 The type of information about fit parameters printed in the histogram
 statistics box can be selected via the parameter mode.
  The parameter mode can be = pcev  (default = 0111)
    v = 1;  print name/values of parameters
    e = 1;  print errors (if e=1, v must be 1)
    c = 1;  print Chisquare/Number of degress of freedom
    p = 1;  print Probability
  Example: gStyle->SetOptFit(1011);
           print fit probability, parameter names/values and errors.


  When option "same" is specified, the statistic box is not drawn.
  Specify option "sames" to force painting statistics with option "same"
  When option "sames" is given, one can use the following technique
  to rename a previous "stats" box and/or change its position
  Root > TPaveStats *st = (TPaveStats*)gPad->GetPrimitive("stats")
  Root > st->SetName(newname)
  Root > st->SetX1NDC(newx1); //new x start position
  Root > st->SetX2NDC(newx2); //new x end position
  Root > newhist->Draw("sames")

void PaintStat2(Int_t dostat, TF1 *fit)
 Draw the statistics box for 2D histogram.
 The type of information printed in the histogram statistics box
 can be selected via gStyle->SetOptStat(mode).
 The parameter mode can be = ourmen  (default = 001111)
    n = 1;  name of histogram is printed
    e = 1;  number of entries printed
    m = 1;  mean value printed
    r = 1;  rms printed
    u = 1;  number of underflows printed
    o = 1;  number of overflows printed
    i = 1;  integral of bins printed
  Example: gStyle->SetOptStat(11);
           print only name of histogram and number of entries.

void PaintSurface()
*-*-*-*-*-*-*-*Control function to draw a table as a surface plot*-*-*-*-*-*
*-*            ==================================================
*-*
*-*     In a surface plot, cell contents are represented as a mesh.
*-*     The height of the mesh is proportional to the cell content.
*-*
*-*    A surface plot can be represented in several coordinate systems.
*-*    Default system is Cartesian coordinates.
*-*    Possible systems are CYL,POL,SPH,PSR.
*-*
*-*   See THistPainter::Draw for a list of Surface options
*-*  The following picture is generated with option SURF1.

      See TStyle::SetPalette to change the color palette.
      It is suggested to use palette 1 via the call
      gStyle->SetColorPalette(1)


/*

*/

*-*  The following picture is generated with option SURF3.

/*

*/

*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void PaintTable()
*-*-*-*-*-*-*-*-*-*Control function to draw 2-D/3-D tables*-*-*-*-*-*-*-*
*-*                =======================================

void PaintText()
*-*-*-*-*-*Control function to draw a table with the bin values*-*-*-*-*-*
*-*        ====================================================
*-*
*-*    For each cell (i,j) the cell content is printed.
*-*    The text attributes are:
*_*      - text font = current TStyle font
*-*      - text size = 0.02*padheight*markersize
*-*      - text color= marker color

/*

*/

*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void PaintTitle()
*-*-*-*-*-*-*-*-*-*-*-*Draw the histogram title*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                    ========================

void RecalculateRange()
*-*-*-*-*-*Recompute the histogram range following graphics operations*-*-*
*-*        ===========================================================

void SetHistogram(TH1 *h)
  set current histogram to h

Int_t TableInit()
*-*-*-*-*-*-*-*-*Initialize various options to draw tables*-*-*-*-*-*-*-*
*-*              =========================================



Inline Functions


             TClass* Class()
             TClass* IsA() const
                void ShowMembers(TMemberInspector& insp, char* parent)
                void Streamer(TBuffer& b)
        THistPainter THistPainter(THistPainter&)


Author: Rene Brun 26/08/99
Last update: 2.23/12 26/01/2000 09.56.06 by Rene Brun
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.