library: libHistPainter
#include "THistPainter.h"

THistPainter


class description - header file - source file
viewCVS header - viewCVS source

class THistPainter: public TVirtualHistPainter

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
THistPainter()
THistPainter(const THistPainter&)
virtual~THistPainter()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidDefineColorLevels(Int_t ndivz)
virtual voidTObject::Delete(Option_t* option = "")
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidDrawPanel()
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual voidFitPanel()
static const char*GetBestFormat(Double_t v, Double_t e, const char* f)
virtual TList*GetContourList(Double_t contour) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
virtual char*GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual TList*GetStack() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
static TVirtualHistPainter*TVirtualHistPainter::HistPainter(TH1* obj)
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
virtual Bool_tIsInside(Int_t x, Int_t y)
virtual Bool_tIsInside(Double_t x, Double_t y)
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
virtual Int_tMakeChopt(Option_t* option)
virtual Int_tMakeCuts(char* cutsopt)
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
THistPainter&operator=(const THistPainter&)
virtual voidPaint(Option_t* option = "")
virtual voidPaint2DErrors(Option_t* option)
virtual voidPaintArrows(Option_t* option)
virtual voidPaintAxis(Bool_t drawGridOnly = kFALSE)
virtual voidPaintBar(Option_t* option)
virtual voidPaintBarH(Option_t* option)
virtual voidPaintBoxes(Option_t* option)
virtual voidPaintColorLevels(Option_t* option)
virtual voidPaintContour(Option_t* option)
virtual Int_tPaintContourLine(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)
virtual voidPaintErrors(Option_t* option)
virtual voidPaintFrame()
virtual voidPaintFunction(Option_t* option)
virtual voidPaintH3(Option_t* option = "")
virtual voidPaintH3Iso()
virtual voidPaintHist(Option_t* option)
virtual Int_tPaintInit()
virtual Int_tPaintInitH()
virtual voidPaintLego(Option_t* option)
virtual voidPaintLegoAxis(TGaxis* axis, Double_t ang)
virtual voidPaintPalette()
virtual voidPaintScatterPlot(Option_t* option)
static voidPaintSpecialObjects(const TObject* obj, Option_t* option)
virtual voidPaintStat(Int_t dostat, TF1* fit)
virtual voidPaintStat2(Int_t dostat, TF1* fit)
virtual voidPaintStat3(Int_t dostat, TF1* fit)
virtual voidPaintSurface(Option_t* option)
virtual voidPaintTable(Option_t* option)
virtual voidPaintText(Option_t* option)
virtual voidPaintTF3()
virtual voidPaintTitle()
virtual voidPaintTriangles(Option_t* option)
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual voidProcessMessage(const char* mess, const TObject* obj)
static Int_tProjectAitoff2xy(Double_t l, Double_t b, Double_t& Al, Double_t& Ab)
static Int_tProjectMercator2xy(Double_t l, Double_t b, Double_t& Al, Double_t& Ab)
static Int_tProjectParabolic2xy(Double_t l, Double_t b, Double_t& Al, Double_t& Ab)
static Int_tProjectSinusoidal2xy(Double_t l, Double_t b, Double_t& Al, Double_t& Ab)
virtual Int_tTObject::Read(const char* name)
virtual voidRecalculateRange()
virtual voidRecursiveRemove(TObject*)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetHistogram(TH1* h)
static voidTObject::SetObjectStat(Bool_t stat)
static voidTVirtualHistPainter::SetPainter(const char* painter)
virtual voidSetShowProjection(const char* option, Int_t nbins)
virtual voidSetStack(TList* stack)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidShowProjection3(Int_t px, Int_t py)
virtual voidShowProjectionX(Int_t px, Int_t py)
virtual voidShowProjectionY(Int_t px, Int_t py)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
virtual Int_tTableInit()
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TH1*fHpointer to histogram to paint
TAxis*fXaxispointer to X axis
TAxis*fYaxispointer to Y axis
TAxis*fZaxispointer to Z axis
TList*fFunctionspointer to histogram list of functions
TPainter3dAlgorithms*fLegopointer to a TPainter3dAlgorithms object
TGraphPainter*fGraphPainterpointer to a fGraphPainter object
TPie*fPiepointer to a TPie in case of option PIE
Double_t*fXbufX buffer coordinates
Double_t*fYbufY buffer coordinates
Int_tfNcutsNumber of graphical cuts
Int_tfCutsOpt[16]sign of each cut
TCutG*fCuts[16]Pointers to graphical cuts
TList*fStackPointer to stack of histograms (if any)
Int_tfShowProjectionTrue if a projection must be drawn
TStringfShowOptionOption to draw the projection

Class Description

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

  Histograms are drawn via the THistPainter class. Each histogram has
  a pointer to its own painter (to be usable in a multithreaded program).
  When the canvas has to be redrawn, the Paint function of the objects
  in the pad is called. In case of histograms, TH1::Paint invokes directly
  THistPainter::Paint.

    See THistPainter::Paint for the list of drawing options
    and examples.
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
TList * GetContourList(Double_t contour)
 Get a contour (as a list of TGraphs) using the Delaunay triangulation
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
Bool_t IsInside(Int_t ix, Int_t iy)
 return kTRUE if the cell ix, iy is inside one of the graphical cuts
Bool_t IsInside(Double_t x, Double_t y)
 return kTRUE if the point x,y is inside one of the graphical cuts
Int_t MakeChopt(Option_t *choptin)
 Decode string chopt and fill Hoption structure.
Int_t MakeCuts(char *choptin)
 Decode string chopt and fill Graphical cuts structure.
void Paint(Option_t *option)
 Control routine to paint any kind of histograms.

 When you call the Draw method of a histogram for the first time (TH1::Draw),
 it creates a THistPainter object and saves a pointer to painter as a
 data member of the histogram.
 The THistPainter class specializes in the drawing of histograms. It is
 separate from the histogram so that one can have histograms without
 the graphics overhead, for example in a batch program. The choice
 to give each histogram have its own painter rather than a central
 singleton painter, allows two histograms to be drawn in two threads
 without overwriting the painter's values.

 When a displayed histogram is filled again you do not have to call the Draw
 method again. The image is refreshed the next time the pad is updated.
 A pad is updated after one of these three actions:::Paint
   - a carriage control on the ROOT command line
   - a click inside the pad
   - a call to TPad::Update

 By default a call to TH1::Draw clears the pad of all objects before drawing the
 new image of the histogram. You can use the "SAME" option to leave the previous
 display intact and superimpose the new histogram. The same histogram can be
 drawn with different graphics options in different pads.

 When a displayed histogram is deleted, its image is automatically removed from the pad.

 To create a copy of the histogram when drawing it, you can use TH1::DrawClone. This
 will clone the histogram and allow you to change and delete the original one
 without affecting the clone.

 Setting the Style
 =================
 Histograms use the current style (gStyle). When you change the current style and
 would like to propagate the change to the histogram you can call TH1::UseCurrentStyle.
 You will need to call UseCurrentStyle on each histogram.
 When reading many histograms from a file and you wish to update them to the current
 style you can use gROOT::ForceStyle and all histograms read after this call
 will be updated to use the current style.

  The following options are supported on all types:
  =================================================
    "AXIS"   : Draw only axis
    "AXIG"   : Draw only grid (if the grid is requested)
    "HIST"   : When an histogram has errors it is visualized by default with
               error bars. To visualize it without errors use the option HIST
               together with the required option (eg "hist same c").
               The "HIST" option can also be used to plot only the histogram
               and not the associated function(s).
    "SAME"   : Superimpose on previous picture in the same pad
    "CYL"    : Use Cylindrical coordinates. The X coordinate is mapped on
               the angle and the Y coordinate on the cylinder length.
    "POL"    : Use Polar coordinates. The X coordinate is mapped on the
               angle and the Y coordinate on the radius.
    "SPH"    : Use Spherical coordinates. The X coordinate is mapped on the
               latitude and the Y coordinate on the longitude.
    "PSR"    : Use PseudoRapidity/Phi coordinates. The X coordinate is
               mapped on Phi.
    "LEGO"   : Draw a lego plot with hidden line removal
    "LEGO1"  : Draw a lego plot with hidden surface removal
    "LEGO2"  : Draw a lego plot using colors to show the cell contents
    "SURF"   : Draw a surface plot with hidden line removal
    "SURF1"  : Draw a surface plot with hidden surface removal
    "SURF2"  : Draw a surface plot using colors to show the cell contents
    "SURF3"  : same as SURF with in addition a contour view drawn on the top
    "SURF4"  : Draw a surface using Gouraud shading
    "SURF5"  : Same as SURF3 but only the colored contour is drawn. Used with
               option CYL, SPH or PSR it allows to draw colored contours on a
               sphere, a cylinder or a in pseudo rapidy space. In cartesian
               or polar coordinates, option SURF3 is used.
    "X+"     : The X-axis is drawn on the top side of the plot.
    "Y+"     : The Y-axis is drawn on the right side of the plot.

  The following options are supported for 1-D types:
    "AH"     : Draw histogram without axis. "A" can be combined with any drawing option.
             : For instance, "AC" draws the histogram as a smooth Curve without axis.
    "]["     : When this option is selected the first and last vertical lines
             : of the histogram are not drawn.
    "B"      : Bar chart option
    "C"      : Draw a smooth Curve througth the histogram bins
    "E"      : Draw error bars
    "E0"     : Draw error bars including bins with o contents
    "E1"     : Draw error bars with perpendicular lines at the edges
    "E2"     : Draw error bars with rectangles
    "E3"     : Draw a fill area througth the end points of the vertical error bars
    "E4"     : Draw a smoothed filled area through the end points of the error bars
    "X0"     : When used with one of the "E" option, it suppress the error
               bar along X as gStyle->SetErrorX(0) would do.
    "L"      : Draw a line througth the bin contents
    "P"      : Draw current marker at each bin except empty bins
    "P0"     : Draw current marker at each bin including empty bins
    "PIE"    : Draw a Pie Chart.
    "*H"     : Draw histogram with a * at each bin
    "LF2"    : Draw histogram like with option "L" but with a fill area.
             : Note that "L" draws also a fill area if the hist fillcolor is set
             : but the fill area corresponds to the histogram contour.
    "9"      : Force histogram to be drawn in high resolution mode.
             : By default, the histogram is drawn in low resolution
             : in case the number of bins is greater than the number of pixels
             : in the current pad.


  The following options are supported for 2-D types:
    "ARR"    : arrow mode. Shows gradient between adjacent cells
    "BOX"    : a box is drawn for each cell with surface proportional to the
               content's absolute value. A negative content is marked with a X.
    "BOX1"   : a button is drawn for each cell with surface proportional to
               content's absolute value. A sunken button is drawn for negative values
               a raised one for positive.
    "COL"    : a box is drawn for each cell with a color scale varying with contents
    "COLZ"   : same as "COL". In addition the color palette is also drawn
    "CONT"   : Draw a contour plot (same as CONT0)
    "CONT0"  : Draw a contour plot using surface colors to distinguish contours
    "CONT1"  : Draw a contour plot using line styles to distinguish contours
    "CONT2"  : Draw a contour plot using the same line style for all contours
    "CONT3"  : Draw a contour plot using fill area colors
    "CONT4"  : Draw a contour plot using surface colors (SURF option at theta = 0)
    "CONT5"  : (TGraph2D only) Draw a contour plot using Delaunay triangles
    "LIST"   : Generate a list of TGraph objects for each contour
    "FB"     : With LEGO or SURFACE, suppress the Front-Box
    "BB"     : With LEGO or SURFACE, suppress the Back-Box
    "A"      : With LEGO or SURFACE, suppress the axis
    "SCAT"   : Draw a scatter-plot (default)
    "TEXT"   : Draw bin contents as text (format set via gStyle->SetPaintTextFormat)
    "TEXTnn" : Draw bin contents as text at angle nn (0 < nn < 90)
    "[cutg]" : Draw only the sub-range selected by the TCutG named "cutg"

 Most options can be concatenated without spaces or commas, for example:
        h->Draw("E1 SAME");

 The options are not case sensitive:
        h->Draw("e1 same");

 The options "BOX", "COL" or "COLZ", use the color palette
 defined in the current style (see TStyle::SeTPaletteAxis)

 The options "CONT" or "SURF" or "LEGO" have by default 20 equidistant contour
 levels, you can change the number of levels with TH1::SetContour or
 TStyle::SetNumberContours.

 You can also set the default drawing option with TH1::SetOption. To see the current
 option use TH1::GetOption.

 Setting line, fill, marker, and text attributes
 ===============================================
 The histogram classes inherit from the attribute classes:
    TAttLine, TAttFill, TAttMarker and TAttText.
 See the description of these classes for the list of options.


  Setting Tick marks on the histogram axis
  ========================================
 The TPad::SetTicks method specifies the type of tick marks on the axis.

 Assume tx = gPad->GetTickx() and ty = gPad->GetTicky().

    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
 By default only the left Y axis and X bottom axis are drawn (tx = ty = 0)

 Use TPad::SetTicks(tx,ty) to set these options
 See also The TAxis functions to set specific axis attributes.

  In case multiple collor filled histograms are drawn on the same pad, the fill
  area may hide the axis tick marks. One can force a redraw of the axis
  over all the histograms by calling:
    gPad->RedrawAxis();


  Giving titles to the X, Y and Z axis
  ====================================
    h->GetXaxis()->SetTitle("X axis title");
    h->GetYaxis()->SetTitle("Y axis title");
  The histogram title and the axis titles can be any TLatex string.
  The titles are part of the persistent histogram.


  Superimposing two histograms with different scales in the same pad
  ==================================================================
  The following script creates two histograms, the second histogram is
  the bins integral of the first one. It shows a procedure to
  draw the two histograms in the same pad and it draws the scale of
  the second histogram using a new vertical axis on the right side.
   (see also tutorial transpad.C for a variant of this example)

   void twoscales() {
    TCanvas *c1 = new TCanvas("c1","hists with different scales",600,400);

     //create/fill draw h1
     gStyle->SetOptStat(kFALSE);
     TH1F *h1 = new TH1F("h1","my histogram",100,-3,3);
     Int_t i;
     for (i=0;i<10000;i++) h1->Fill(gRandom->Gaus(0,1));
     h1->Draw();
     c1->Update();

     //create hint1 filled with the bins integral of h1
     TH1F *hint1 = new TH1F("hint1","h1 bins integral",100,-3,3);
     Float_t sum = 0;
     for (i=1;i<=100;i++) {
        sum += h1->GetBinContent(i);
        hint1->SetBinContent(i,sum);
     }

     //scale hint1 to the pad coordinates
     Float_t rightmax = 1.1*hint1->GetMaximum();
     Float_t scale = gPad->GetUymax()/rightmax;
     hint1->SetLineColor(kRed);
     hint1->Scale(scale);
     hint1->Draw("same");

     //draw an axis on the right side
     TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
           gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L");
     axis->SetLineColor(kRed);
     axis->SetTextColor(kRed);
     axis->Draw();
 }
/* */
void PaintArrows(Option_t *)
 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(Bool_t drawGridOnly)
  Draw axis (2D case) 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

   If drawGridOnly is TRUE, only the grid is painted (if needed). This
   allows to draw the grid and the axis separately. In THistPainter::Paint
   this feature is used to make sure that the grid is drawn in the background
   and the axis tick marks in the foreground of the pad.
void PaintBar(Option_t *)
  Draw a bar chart in a normal pad.
     (see PaintBarH to draw a bar chart in a rotated pad)

 This function is called by THistPainter::Paint when the option "bar"
 has been specified.

 A vertical bar is drawn for each bin.
 The bar is filled with the histogram fill color
 The left side of the bar is drawn with a light fill color
 The right side of the bar is drawn with a dark fill color
 The percentage of the bar drawn with either the light or dark color
   is  0 per cent for option "bar" or "bar0"
   is 10 per cent for option "bar1"
   is 20 per cent for option "bar2"
   is 30 per cent for option "bar3"
   is 40 per cent for option "bar4"

 Use TH1::SetBarWidth to control the bar width (default is the bin width)
 Use TH1::SetBarOffset to control the bar offset (default is 0)
   See example in $ROOTSYS/tutorials/hist/hbars.C
/* */
void PaintBarH(Option_t *)
 Draw a bar char in a rotated pad (X vertical, Y horizontal)
     (see PaintBar to draw a bar chart in a normal pad)

 This function is called by THistPainter::Paint when the option "hbar"
 has been specified.

 An horizontal bar is drawn for each bin.
 The bar is filled with the histogram fill color
 The bottom side of the bar is drawn with a light fill color
 The top side of the bar is drawn with a dark fill color
 The percentage of the bar drawn with either the light or dark color
   is  0 per cent for option "hbar" or "hbar0"
   is 10 per cent for option "hbar1"
   is 20 per cent for option "hbar2"
   is 30 per cent for option "hbar3"
   is 40 per cent for option "hbar4"

 Use TH1::SetBarWidth to control the bar width (default is the bin width)
 Use TH1::SetBarOffset to control the bar offset (default is 0)
   See example in $ROOTSYS/tutorials/hist/hbars.C
/* */
void PaintBoxes(Option_t *)
 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 absolute value of the cell content.
 The cells with a negative content draw with a X on top of the boxes.
/* */
void PaintColorLevels(Option_t *)
 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::SeTPaletteAxis.
/* */
void PaintContour(Option_t *option)
 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. ("cont")
       11  Use colour to distinguish contours. ("cont1")
       12  Use line style to distinguish contours. ("cont2")
       13  Line style and colour are the same for all contours. ("cont3")
       14  Same as 1 but uses the "SURF" algorithm ("cont4")
           see also options "AITOFF","MERCATOR",etc below
       15  Use Delaunay triangles to compute the contours

     When option "List" is specified together with option "cont",
     the points used to draw the contours are saved in the TGraph format
     and are accessible in the following way:
    TObjArray *contours =
            (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours")
    Int_t ncontours = contours->GetSize();
    TList *list = (TList*)contours->At(i); //where i is a contour number
    list contains a list of TGraph objects. For one given contour, more than
    one disjoint polyline may be generated. The number of TGraphs per
    countour is given by list->GetSize().
    Here we show only the case to access the first graph in the list.
       TGraph *gr1 = (TGraph*)list->First();


/* */
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 YARR for Contour Plot.
void PaintErrors(Option_t *)
 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.

      'X0' When used with one of the "E" option, it suppress the error
           bar along X as gStyle->SetErrorX(0) would do.

     Note that for all options, the line and fill attributes of the
     histogram are used for the errors or errors contours.

     Use gStyle->SetErrorX(dx) to control the size of the error along x.
     set dx = 0 to suppress the error along x.

     Use gStyle->SetEndErrorSize(np) to control the size of the lines
     at the end of the error bars (when option 1 is used).
     By default np=1. (np reprersents the number of pixels).
/* */
void Paint2DErrors(Option_t *)
 Draw 2D histograms errors
void PaintFrame()
 Calculate range and clear pad (canvas).
void PaintFunction(Option_t *)
 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);
        or
     h->GetListOfFunctions()->Add(f1,someoption);
   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(Option_t *)
 Control routine to draw an histogram.
void PaintH3(Option_t *option)
 Control function to draw a 3-D histogram.

  The following options are supported:

    "   "   : Draw a 3D scatter plot.
    "BOX"   : A box is drawn for each cell with volume proportional to the
              content's absolute value.
    "LEGO"  : Same as "BOX".
    "ISO"   : Draw an iso surface. (See: THistPainter::PaintH3Iso()).
    "FB"    : Suppress the Front-Box.
    "BB"    : Suppress the Back-Box.
    "A"     : Suppress the axis.
Int_t PaintInit()
 Compute histogram parameters used by the drawing routines.
Int_t PaintInitH()
    Compute histogram parameters used by the drawing routines
    for a rotated pad
void PaintH3Iso()
 Control function to draw a 3d histogram with Iso Surfaces.

 Thanks to the function IsoSurface of the TPainter3dAlgorithms class, this
 function paints a Gouraud shaded 3d iso surface though a 3d histogram.

 This first implementation paint one surface at the value computed as follow:
 SumOfWeights/(NbinsX*NbinsY*NbinsZ)

 Example:

  #include "TH3.h"
  #include "TRandom.h"

  void hist3d() {
     TH3F *h3 = new TH3F("h3","h3",20,-2,2,20,-2,2,20,0,4);
     Double_t x, y, z;
     for (Int_t i=0;i<10000;i++) {
        gRandom->Rannor(x, y);
        z = x*x + y*y;
        h3->Fill(x,y,z);
     }
     h3->Draw("iso");
  }

/* */
void PaintLego(Option_t *)
 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 TPainter3dAlgorithms for more examples of lego options.

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

/* */
void PaintLegoAxis(TGaxis *axis, Double_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(Option_t *option)
 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 kNMAX points per cell is drawn. If the maximum is above kNMAX
       contents are normalized to kNMAX. (kNMAX=2000)
       if option is of the form "scat=ff", (eg scat=1.8, scat=1e-3), then
       ff is used as a scale factor to compute the number of dots.
       "scat=1" is the default.
/* */
void PaintSpecialObjects(const TObject *obj, Option_t *option)
 Static function to paint special objects like vectors and matrices
 This function is called via gROOT->ProcessLine to paint these objects
 without having a direct dependency of the graphics or histogramming system
void PaintStat(Int_t dostat, TF1 *fit)
 Draw the statistics box for 1D and profile histograms
 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
    m = 2;  mean and mean error values printed
    r = 1;  rms printed
    r = 2;  rms and rms error printed
    u = 1;  number of underflows printed
    o = 1;  number of overflows printed
    i = 1;  integral of bins printed
    s = 1;  skewness printed
    s = 2;  skewness and skewness error printed
    k = 1;  kurtosis printed
    k = 2;  kurtosis and kurtosis error 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 gStyle->SetOptFit(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 degrees of freedom
    p = 1;  print Probability
    When "v"=1 is specified, only the non-fixed parameters are shown.
    When "v"=2 all parameters are shown.
  Example: gStyle->SetOptFit(1011);
           print fit probability, parameter names/values and errors.

  Note: gStyle->SetOptFit(1) means "default value", so it is equivalent to
        gStyle->SetOptFit(111)

  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 move a previous "stats" box to a new position
  Root > TPaveStats *st = (TPaveStats*)gPad->GetPrimitive("stats")
  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
    m = 2;  mean and mean error values printed
    r = 1;  rms printed
    r = 2;  rms and rms error printed
    u = 1;  number of underflows printed
    o = 1;  number of overflows printed
    i = 1;  integral of bins printed
    s = 1;  skewness printed
    s = 2;  skewness and skewness error printed
    k = 1;  kurtosis printed
    k = 2;  kurtosis and kurtosis error printed
  Example: gStyle->SetOptStat(11);
           print only name of histogram and number of entries.
void PaintStat3(Int_t dostat, TF1 *fit)
 Draw the statistics box for 3D 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
    m = 2;  mean and mean error values printed
    r = 1;  rms printed
    r = 2;  rms and rms error printed
    u = 1;  number of underflows printed
    o = 1;  number of overflows printed
    i = 1;  integral of bins printed
    s = 1;  skewness printed
    s = 2;  skewness and skewness error printed
    k = 1;  kurtosis printed
    k = 2;  kurtosis and kurtosis error printed
  Example: gStyle->SetOptStat(11);
           print only name of histogram and number of entries.
void PaintSurface(Option_t *)
 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::SeTPaletteAxis to change the color palette.
     It is suggested to use palette 1 via the call
     gStyle->SetColorPalette(1)

/* */
void PaintTriangles(Option_t *option)
 Control function to draw a table using Delaunay triangles.
void DefineColorLevels(Int_t ndivz)
 Define the color levels used to paint legos, surfaces etc..
void PaintTable(Option_t *option)
 Control function to draw 2-D/3-D tables
void PaintText(Option_t *)
  Control function to draw a histogram with the bin values

  For each bin the content is printed.

  The text attributes are:
      - text font  = current TStyle font
      - text size  = 0.02*padheight*markersize
      - text color = marker color

   By default the format "g" is used. This format can be redefined
   by calling gStyle->SetPaintTextFormat

   This method is called when Paint() is invoked with the option "TEXT".
   It is also possible to use "TEXTnn" in order to draw the text with the
   angle nn (0 < nn < 90).
/* */
void PaintTF3()
 Control function to draw a 3d implicit functions.

 Thanks to the function ImplicitFunction of the TPainter3dAlgorithms class,
 this function paints 3d representation of an implicit function.

 Example:

   TF3 *fun3 = new TF3("fun3","sin(x*x+y*y+z*z-36)",-2,2,-2,2,-2,2);
   fun3->Draw();

/* */
void PaintTitle()
 Draw the histogram title

 The title is drawn according to the title alignment returned by
 GetTitleAlign. It is a 2 digits integer): hv

 where "h" is the horizontal alignment and "v" is the vertical alignment.
 "h" can get the values 1 2 3 for left, center, and right
 "v" can get the values 1 2 3 for bottom, middle and top

 for instance the default alignment is: 13 (left top)
void ProcessMessage(const char *mess, const TObject *obj)
  Process message mess
Int_t ProjectAitoff2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
 Static function
 Convert Right Ascension, Declination to X,Y using an AITOFF projection.
 This procedure can be used to create an all-sky map in Galactic
 coordinates with an equal-area Aitoff projection.  Output map
 coordinates are zero longitude centered.
 Also called Hammer-Aitoff projection (first presented by Ernst von Hammer in 1892)
 source: GMT
 code from  Ernst-Jan Buis
Int_t ProjectMercator2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
 Static function
 Probably the most famous of the various map projections, the Mercator projection
 takes its name from Mercator who presented it in 1569. It is a cylindrical, conformal projection
 with no distortion along the equator.
 The Mercator projection has been used extensively for world maps in which the distortion towards
 the polar regions grows rather large, thus incorrectly giving the impression that, for example,
 Greenland is larger than South America. In reality, the latter is about eight times the size of
 Greenland. Also, the Former Soviet Union looks much bigger than Africa or South America. One may wonder
 whether this illusion has had any influence on U.S. foreign policy.' (Source: GMT)
 code from  Ernst-Jan Buis
Int_t ProjectSinusoidal2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
 Static function
 code from  Ernst-Jan Buis
Int_t ProjectParabolic2xy(Double_t l, Double_t b, Double_t &Al, Double_t &Ab)
 Static function
 code from  Ernst-Jan Buis
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.
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) and the format (f) used to print it.
void SetShowProjection(const char *option,Int_t nbins)
 Set projection.
void ShowProjectionX(Int_t /*px*/, Int_t py)
 Show projection onto X
void ShowProjectionY(Int_t px, Int_t /*py*/)
 Show projection onto Y
void ShowProjection3(Int_t px, Int_t py)
 Show projection (specified by fShowProjection) of a TH3
 The drawing option for the projection is in fShowOption.

 First implementation; R.Brun
 Full implementation: Tim Tran (timtran@jlab.org)  April 2006
THistPainter()
TList * GetStack()
{return fStack;}
void RecursiveRemove(TObject *)
{;}
void SetStack(TList *stack)
{fStack = stack;}

Author: Rene Brun 26/08/99
Last update: root/histpainter:$Name: $:$Id: THistPainter.cxx,v 1.278 2006/12/12 13:41:38 couet Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - 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.