GwollumPlot Class Reference

Interface to draw and print ROOT objects. More...

#include <GwollumPlot.h>

Inheritance diagram for GwollumPlot:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void AddLegendEntry (const TObject *aObj, const string aLabel, const string aStyle="LPF")
 Adds a legend entry.
void AddLegendHeader (const string aLabel)
 Adds a legend header.
void AddText (const string aText, const double aX, const double aY, const double aSize, const int aPadIndex=0)
 Adds text in the plot.
void DivideCanvas (const int aNx, const int aNy)
 Divides current canvas into sub-pads.
void DivideCanvas (const int aNpads)
 Divides current canvas into sub-pads.
void Draw (TObject *aObj, const string aOptions="", const int aPadIndex=0)
 Draws ROOT object.
void DrawLegend (void)
 Draws current legend box.
string GetCurrentStyle (void)
 Returns current style name.
void Print (const string aFileName, const double aScaleFactor)
 Prints current canvas in a file with a rescaling factor.
void Print (const string aFileName)
 Prints current canvas in a file.
void RedrawAxis (Option_t *option="", int aPadIndex=0)
 Redraw the frame axis.
void ResetLegend (void)
 Resets and removes current legend box.
void ResizePlot (const int aWidth, const int aHeight)
 Resizes the global canvas to new dimensions.
void SetGridx (const int aValue=1, const int aPadIndex=0)
 Set/Unset grid for X.
void SetGridy (const int aValue=1, const int aPadIndex=0)
 Set/Unset grid for Y.
void SetLogx (const int aValue, const int aPadIndex=0)
 Set Lin/Log scale for X.
void SetLogy (const int aValue, const int aPadIndex=0)
 Set Lin/Log scale for Y.
void SetLogz (const int aValue, const int aPadIndex=0)
 Set Lin/Log scale for Z.
void UpdateText (const string aText)
 Updates text in the plot.
Constructors and destructors



 GwollumPlot (const string aName, const string aStyleName="GWOLLUM")
 Constructor of the GwollumPlot class.
virtual ~GwollumPlot (void)
 Destructor of the GwollumPlot class.

Protected Attributes

int randid
 random integer id
string srandid
 random string id
string stylename
 style name
TCanvas * Wcan
 working canvas
TLegend * Wleg
 plot legends
TPad * Wpad
 working pad
TStyle * Wstyle
 working style
TText * Wtext
 add text

Detailed Description

Interface to draw and print ROOT objects.

The GwollumPlot class provides a single interface to draw and print ROOT objects like histograms, graphs and so on. It also includes different pre-defined plotting styles like the GWOLLUM style. This class mainly includes wrappers for ROOT drawing functions.

Several pre-defined styles are available. At any moment, you can switch from one style to the next.

Author:
Florent Robinet

Constructor & Destructor Documentation

GwollumPlot::GwollumPlot ( const string  aName,
const string  aStyleName = "GWOLLUM" 
)

Constructor of the GwollumPlot class.

A unique name must be provided with 'aName'. You can also choose a style between:

  • "GWOLLUM" (default)
  • "WHITEGWOLLUM"
  • "STANDARD"

This style can be changed later.

Parameters:
aName name to identify the canvas
aStyleName style name
GwollumPlot::~GwollumPlot ( void   )  [virtual]

Destructor of the GwollumPlot class.


Member Function Documentation

void GwollumPlot::AddLegendEntry ( const TObject *  aObj,
const string  aLabel,
const string  aStyle = "LPF" 
)

Adds a legend entry.

Parameters:
aObj pointer to ROOT object to which the legend entry applies
aLabel label of the legend entry
aStyle legend style "L" for line, "P" for point and "F" for fill
void GwollumPlot::AddLegendHeader ( const string  aLabel  ) 

Adds a legend header.

Parameters:
aLabel label of the legend header
void GwollumPlot::AddText ( const string  aText,
const double  aX,
const double  aY,
const double  aSize,
const int  aPadIndex = 0 
)

Adds text in the plot.

The position of the plot should be given in the pad coordinates (0-1).

Parameters:
aText text to add
aX X coordinate where to start the text
aY Y coordinate where to start the text
aSize text size
aPadIndex pad index when using subpads (see DivideCanvas())
void GwollumPlot::DivideCanvas ( const int  aNx,
const int  aNy 
) [inline]

Divides current canvas into sub-pads.

Parameters:
aNx number of columns
aNy number of rows
void GwollumPlot::DivideCanvas ( const int  aNpads  )  [inline]

Divides current canvas into sub-pads.

Parameters:
aNpads number of pads
void GwollumPlot::Draw ( TObject *  aObj,
const string  aOptions = "",
const int  aPadIndex = 0 
) [inline]

Draws ROOT object.

Parameters:
aObj pointer to ROOT object to be drawn
aOptions drawing options (ROOT options)
aPadIndex pad index when using subpads (see DivideCanvas())
void GwollumPlot::DrawLegend ( void   ) 

Draws current legend box.

string GwollumPlot::GetCurrentStyle ( void   )  [inline]

Returns current style name.

void GwollumPlot::Print ( const string  aFileName,
const double  aScaleFactor 
)

Prints current canvas in a file with a rescaling factor.

Typically this function is useful when one wants to produce thumbnails. The size of the working canvas is not changed, only the size of the printed object is modified. The width and height are rescaled by 'rescale'.

Parameters:
aFileName file name to save the current canvas
aScaleFactor scaling factor
void GwollumPlot::Print ( const string  aFileName  )  [inline]

Prints current canvas in a file.

Parameters:
aFileName file name to save the current canvas
void GwollumPlot::RedrawAxis ( Option_t *  option = "",
int  aPadIndex = 0 
) [inline]

Redraw the frame axis.

Parameters:
aPadIndex pad index when using subpads (see DivideCanvas())
void GwollumPlot::ResetLegend ( void   )  [inline]

Resets and removes current legend box.

void GwollumPlot::ResizePlot ( const int  aWidth,
const int  aHeight 
) [inline]

Resizes the global canvas to new dimensions.

Set Width and Height of canvas to aWidth and aHeight respectively. If aWidth and/or aHeight are greater than the current canvas window a scroll bar is automatically generated. Use this function to zoom in a canvas and navigate via the scroll bars.

Parameters:
aWidth new canvas width
aHeight new canvas height
void GwollumPlot::SetGridx ( const int  aValue = 1,
const int  aPadIndex = 0 
) [inline]

Set/Unset grid for X.

Parameters:
aValue 
aPadIndex pad index when using subpads (see DivideCanvas())
void GwollumPlot::SetGridy ( const int  aValue = 1,
const int  aPadIndex = 0 
) [inline]

Set/Unset grid for Y.

Parameters:
aValue 
aPadIndex pad index when using subpads (see DivideCanvas())
void GwollumPlot::SetLogx ( const int  aValue,
const int  aPadIndex = 0 
) [inline]

Set Lin/Log scale for X.

  • aValue = 0 X scale will be linear.
  • aValue = 1 X scale will be logarithmic (base 10).
  • aValue > 1 reserved for possible support of base e or otherSet logarithmic scale for x axis.
    Parameters:
    aValue 
    aPadIndex pad index when using subpads (see DivideCanvas())
void GwollumPlot::SetLogy ( const int  aValue,
const int  aPadIndex = 0 
) [inline]

Set Lin/Log scale for Y.

  • aValue = 0 Y scale will be linear.
  • aValue = 1 Y scale will be logarithmic (base 10).
  • aValue > 1 reserved for possible support of base e or otherSet logarithmic scale for y axis.
    Parameters:
    aValue 
    aPadIndex pad index when using subpads (see DivideCanvas())
void GwollumPlot::SetLogz ( const int  aValue,
const int  aPadIndex = 0 
) [inline]

Set Lin/Log scale for Z.

  • aValue = 0 Z scale will be linear.
  • aValue = 1 Z scale will be logarithmic (base 10).
  • aValue > 1 reserved for possible support of base e or otherSet logarithmic scale for z axis.
    Parameters:
    aValue 
    aPadIndex pad index when using subpads (see DivideCanvas())
void GwollumPlot::UpdateText ( const string  aText  ) 

Updates text in the plot.

See AddText().

Parameters:
aText updated text

Member Data Documentation

int GwollumPlot::randid [protected]

random integer id

string GwollumPlot::srandid [protected]

random string id

string GwollumPlot::stylename [protected]

style name

TCanvas* GwollumPlot::Wcan [protected]

working canvas

TLegend* GwollumPlot::Wleg [protected]

plot legends

TPad* GwollumPlot::Wpad [protected]

working pad

TStyle* GwollumPlot::Wstyle [protected]

working style

TText* GwollumPlot::Wtext [protected]

add text


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Friends Defines

Generated on 29 Sep 2016 by  doxygen 1.6.1