GWOLLUM  4.2.0
Tools for gravitational-wave analyses
GwollumPlot Class Reference

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

#include <GwollumPlot.h>

Inheritance diagram for GwollumPlot:

Public Member Functions

void AddLegendEntry (const TObject *aObj, const string aLabel, const string aStyle="LPF")
 Adds a legend entry. More...
 
void AddLegendHeader (const string aLabel)
 Adds a legend header. More...
 
void AddText (const string aText, const double aX, const double aY, const double aSize, const int aPadIndex=0)
 Adds text in the plot. More...
 
void Clear (const int aPadIndex=0)
 Clear pad. More...
 
void DivideCanvas (const unsigned int aNpads)
 Divides current canvas into sub-pads. More...
 
void DivideCanvas (const unsigned int aNx, const unsigned int aNy)
 Divides current canvas into sub-pads. More...
 
void Draw (TObject *aObj, const string aOptions="", const int aPadIndex=0)
 Draws ROOT object. More...
 
void DrawLegend (void)
 Draws current legend box. More...
 
unsigned int GetColorPalette (const unsigned int i)
 Returns color number i in current palette. More...
 
string GetCurrentStyle (void)
 Returns current style name. More...
 
int GetHeight (void)
 Returns the canvas height. More...
 
unsigned int GetNumberOfColors (void)
 Returns the number of colors in current palette. More...
 
int GetOxColorIndex (unsigned int aColorType)
 Returns the color index for the Ox style. More...
 
int GetWidth (void)
 Returns the canvas width. More...
 
void Print (const string aFileName)
 Prints current canvas in a file. More...
 
void Print (const string aFileName, const double aScaleFactor)
 Prints current canvas in a file with a rescaling factor. More...
 
void Print (const string aFileName, const unsigned int aNewWidth, const unsigned int aNewHeight)
 Prints current canvas in a file with a new size. More...
 
void RedrawAxis (Option_t *option="", int aPadIndex=0)
 Redraw the frame axis. More...
 
void ResetLegend (void)
 Resets and removes current legend box. More...
 
void ResizePlot (const unsigned int aWidth, const unsigned int aHeight)
 Resizes the global canvas to new dimensions. More...
 
void SetGridx (const int aValue=1, const int aPadIndex=0)
 Set/Unset grid for X. More...
 
void SetGridy (const int aValue=1, const int aPadIndex=0)
 Set/Unset grid for Y. More...
 
void SetLogx (const int aValue, const int aPadIndex=0)
 Set Lin/Log scale for X. More...
 
void SetLogy (const int aValue, const int aPadIndex=0)
 Set Lin/Log scale for Y. More...
 
void SetLogz (const int aValue, const int aPadIndex=0)
 Set Lin/Log scale for Z. More...
 
void UnDraw (TObject *aObj, const int aPadIndex=0)
 UnDraws a ROOT object. More...
 
void UnDrawLegend (void)
 Removes the legend box from the pad. More...
 
void UpdateText (const string aText)
 Updates text in the plot. More...
 
Constructors and destructors
 GwollumPlot (const string aName, const string aStyleName="GWOLLUM")
 Constructor of the GwollumPlot class. More...
 
virtual ~GwollumPlot (void)
 Destructor of the GwollumPlot class. More...
 

Protected Attributes

string name
 Name. More...
 
int oxcolindex [4]
 TColor indices for Ox. More...
 
TColor * oxcolor [4]
 TColor for Ox. 0=background, 1=middleground/plots, 2=foreground, 3=grid. More...
 
int randid
 Random integer id. More...
 
string srandid
 Random string id. More...
 
string stylename
 Style name. More...
 
TCanvas * Wcan
 Working canvas. More...
 
TLegend * Wleg
 Plot legends. More...
 
TPad * Wpad
 Working pad. More...
 
TText * Wtext
 Additional text. More...
 

Private Member Functions

void SetFireStyle (void)
 Sets FIRE style. More...
 
void SetGwollumStyle (void)
 Sets GWOLLUM style. More...
 
void SetOxStyle (void)
 Sets OX style. More...
 
void SetPinkStyle (void)
 Sets PINK style. More...
 
void SetStandardStyle (void)
 Sets STANDARD style. More...
 

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. This class mainly includes wrappers for ROOT drawing functions. Supported styles:

  • "GWOLLUM" (default): This is the full GWOLLUM style. Backgrounds are black and deep-blue sea markings are used.
  • "PINK": Backgrounds are black and pink markings are used.
  • "FIRE": This style is convenient for black and white printing.
  • "STANDARD": This is the standard ROOT style.
  • "OX": This is the Omicron-X analysis style.
Author
Florent Robinet

Constructor & Destructor Documentation

◆ GwollumPlot()

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): This is the full GWOLLUM style. Backgrounds are black and deep-blue sea markings are used.
  • "PINK": Backgrounds are black and pink markings are used.
  • "FIRE": This style is convenient for black and white printing.
  • "STANDARD": This is the standard ROOT style.
  • "OX": This is the Omicron-X analysis style.
Parameters
[in]aNameName to identify the canvas.
[in]aStyleNameStyle name.

◆ ~GwollumPlot()

GwollumPlot::~GwollumPlot ( void  )
virtual

Destructor of the GwollumPlot class.

Member Function Documentation

◆ AddLegendEntry()

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

Adds a legend entry.

Parameters
[in]aObjPointer to ROOT object to which the legend entry applies.
[in]aLabelLabel of the legend entry.
[in]aStyleLegend style "L" for line, "P" for point and "F" for fill.

◆ AddLegendHeader()

void GwollumPlot::AddLegendHeader ( const string  aLabel)

Adds a legend header.

Parameters
[in]aLabelLabel of the legend header.

◆ AddText()

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
[in]aTextText to add.
[in]aXX coordinate where to start the text.
[in]aYY coordinate where to start the text.
[in]aSizeText size.
[in]aPadIndexpad index when using subpads (see DivideCanvas())

◆ Clear()

void GwollumPlot::Clear ( const int  aPadIndex = 0)
inline

Clear pad.

Parameters
[in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ DivideCanvas() [1/2]

void GwollumPlot::DivideCanvas ( const unsigned int  aNpads)
inline

Divides current canvas into sub-pads.

Parameters
[in]aNpadsNumber of pads.

◆ DivideCanvas() [2/2]

void GwollumPlot::DivideCanvas ( const unsigned int  aNx,
const unsigned int  aNy 
)
inline

Divides current canvas into sub-pads.

Parameters
[in]aNxNumber of columns.
[in]aNyNumber of rows.

◆ Draw()

void GwollumPlot::Draw ( TObject *  aObj,
const string  aOptions = "",
const int  aPadIndex = 0 
)
inline

Draws ROOT object.

Parameters
[in]aObjPointer to ROOT object to be drawn.
[in]aOptionsDrawing options (ROOT options).
[in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ DrawLegend()

void GwollumPlot::DrawLegend ( void  )

Draws current legend box.

◆ GetColorPalette()

unsigned int GwollumPlot::GetColorPalette ( const unsigned int  i)
inline

Returns color number i in current palette.

◆ GetCurrentStyle()

string GwollumPlot::GetCurrentStyle ( void  )
inline

Returns current style name.

◆ GetHeight()

int GwollumPlot::GetHeight ( void  )
inline

Returns the canvas height.

◆ GetNumberOfColors()

unsigned int GwollumPlot::GetNumberOfColors ( void  )
inline

Returns the number of colors in current palette.

◆ GetOxColorIndex()

int GwollumPlot::GetOxColorIndex ( unsigned int  aColorType)
inline

Returns the color index for the Ox style.

Parameters
[in]aColorTypeColor type: 0=background, 1=middleground, 2=foreground, 3=grid.

◆ GetWidth()

int GwollumPlot::GetWidth ( void  )
inline

Returns the canvas width.

◆ Print() [1/3]

void GwollumPlot::Print ( const string  aFileName)
inline

Prints current canvas in a file.

Parameters
[in]aFileNameFile name to save the current canvas.

◆ Print() [2/3]

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
[in]aFileNameFile name to save the current canvas.
[in]aScaleFactorScaling factor.

◆ Print() [3/3]

void GwollumPlot::Print ( const string  aFileName,
const unsigned int  aNewWidth,
const unsigned int  aNewHeight 
)

Prints current canvas in a file with a new size.

The size of the working canvas is not changed, only the size of the printed object is modified.

Parameters
[in]aFileNameFile name to save the current canvas.
[in]aNewWidthNew canvas horizontal size.
[in]aNewHeightNew canvas vertical size.

◆ RedrawAxis()

void GwollumPlot::RedrawAxis ( Option_t *  option = "",
int  aPadIndex = 0 
)
inline

Redraw the frame axis.

Parameters
[in]optionOptions.
[in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ ResetLegend()

void GwollumPlot::ResetLegend ( void  )
inline

Resets and removes current legend box.

◆ ResizePlot()

void GwollumPlot::ResizePlot ( const unsigned int  aWidth,
const unsigned 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
[in]aWidthNew canvas width.
[in]aHeightNew canvas height.

◆ SetFireStyle()

void GwollumPlot::SetFireStyle ( void  )
private

Sets FIRE style.

◆ SetGridx()

void GwollumPlot::SetGridx ( const int  aValue = 1,
const int  aPadIndex = 0 
)
inline

Set/Unset grid for X.

Parameters
[in]aValueValue.
[in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ SetGridy()

void GwollumPlot::SetGridy ( const int  aValue = 1,
const int  aPadIndex = 0 
)
inline

Set/Unset grid for Y.

Parameters
[in]aValueValue
[in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ SetGwollumStyle()

void GwollumPlot::SetGwollumStyle ( void  )
private

Sets GWOLLUM style.

◆ SetLogx()

void GwollumPlot::SetLogx ( const int  aValue,
const int  aPadIndex = 0 
)
inline

Set Lin/Log scale for X.

  • aValue = 0 X scale is linear.
  • aValue = 1 X scale is logarithmic (base 10).
  • aValue > 1 reserved for possible support of base e or otherSet logarithmic scale for x axis.
    Parameters
    [in]aValueValue.
    [in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ SetLogy()

void GwollumPlot::SetLogy ( const int  aValue,
const int  aPadIndex = 0 
)
inline

Set Lin/Log scale for Y.

  • aValue = 0 Y scale is linear.
  • aValue = 1 Y scale is logarithmic (base 10).
  • aValue > 1 reserved for possible support of base e or otherSet logarithmic scale for y axis.
    Parameters
    [in]aValueValue.
    [in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ SetLogz()

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
    [in]aValueValue.
    [in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ SetOxStyle()

void GwollumPlot::SetOxStyle ( void  )
private

Sets OX style.

◆ SetPinkStyle()

void GwollumPlot::SetPinkStyle ( void  )
private

Sets PINK style.

◆ SetStandardStyle()

void GwollumPlot::SetStandardStyle ( void  )
private

Sets STANDARD style.

◆ UnDraw()

void GwollumPlot::UnDraw ( TObject *  aObj,
const int  aPadIndex = 0 
)
inline

UnDraws a ROOT object.

Parameters
[in]aObjPointer to ROOT object to be remove.
[in]aPadIndexPad index when using subpads (see DivideCanvas()).

◆ UnDrawLegend()

void GwollumPlot::UnDrawLegend ( void  )

Removes the legend box from the pad.

◆ UpdateText()

void GwollumPlot::UpdateText ( const string  aText)

Updates text in the plot.

See also
AddText().
Parameters
[in]aTextUpdated text.

Member Data Documentation

◆ name

string GwollumPlot::name
protected

Name.

◆ oxcolindex

int GwollumPlot::oxcolindex[4]
protected

TColor indices for Ox.

◆ oxcolor

TColor* GwollumPlot::oxcolor[4]
protected

TColor for Ox. 0=background, 1=middleground/plots, 2=foreground, 3=grid.

◆ randid

int GwollumPlot::randid
protected

Random integer id.

◆ srandid

string GwollumPlot::srandid
protected

Random string id.

◆ stylename

string GwollumPlot::stylename
protected

Style name.

◆ Wcan

TCanvas* GwollumPlot::Wcan
protected

Working canvas.

◆ Wleg

TLegend* GwollumPlot::Wleg
protected

Plot legends.

◆ Wpad

TPad* GwollumPlot::Wpad
protected

Working pad.

◆ Wtext

TText* GwollumPlot::Wtext
protected

Additional text.


The documentation for this class was generated from the following files: