GWOLLUM
4.2.0
Tools for gravitational-wave analyses
|
Interface to draw and print ROOT objects. More...
#include <GwollumPlot.h>
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... | |
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:
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:
[in] | aName | Name to identify the canvas. |
[in] | aStyleName | Style name. |
|
virtual |
Destructor of the GwollumPlot class.
void GwollumPlot::AddLegendEntry | ( | const TObject * | aObj, |
const string | aLabel, | ||
const string | aStyle = "LPF" |
||
) |
Adds a legend entry.
[in] | aObj | Pointer to ROOT object to which the legend entry applies. |
[in] | aLabel | Label of the legend entry. |
[in] | aStyle | Legend style "L" for line, "P" for point and "F" for fill. |
void GwollumPlot::AddLegendHeader | ( | const string | aLabel | ) |
Adds a legend header.
[in] | 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).
[in] | aText | Text to add. |
[in] | aX | X coordinate where to start the text. |
[in] | aY | Y coordinate where to start the text. |
[in] | aSize | Text size. |
[in] | aPadIndex | pad index when using subpads (see DivideCanvas()) |
|
inline |
Clear pad.
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
|
inline |
Divides current canvas into sub-pads.
[in] | aNpads | Number of pads. |
|
inline |
Divides current canvas into sub-pads.
[in] | aNx | Number of columns. |
[in] | aNy | Number of rows. |
|
inline |
Draws ROOT object.
[in] | aObj | Pointer to ROOT object to be drawn. |
[in] | aOptions | Drawing options (ROOT options). |
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
void GwollumPlot::DrawLegend | ( | void | ) |
Draws current legend box.
|
inline |
Returns color number i in current palette.
|
inline |
Returns current style name.
|
inline |
Returns the canvas height.
|
inline |
Returns the number of colors in current palette.
|
inline |
Returns the color index for the Ox style.
[in] | aColorType | Color type: 0=background, 1=middleground, 2=foreground, 3=grid. |
|
inline |
Returns the canvas width.
|
inline |
Prints current canvas in a file.
[in] | aFileName | File name to save the current canvas. |
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'.
[in] | aFileName | File name to save the current canvas. |
[in] | aScaleFactor | Scaling factor. |
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.
[in] | aFileName | File name to save the current canvas. |
[in] | aNewWidth | New canvas horizontal size. |
[in] | aNewHeight | New canvas vertical size. |
|
inline |
Redraw the frame axis.
[in] | option | Options. |
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
|
inline |
Resets and removes current legend box.
|
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.
[in] | aWidth | New canvas width. |
[in] | aHeight | New canvas height. |
|
private |
Sets FIRE style.
|
inline |
Set/Unset grid for X.
[in] | aValue | Value. |
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
|
inline |
Set/Unset grid for Y.
[in] | aValue | Value |
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
|
private |
Sets GWOLLUM style.
|
inline |
Set Lin/Log scale for X.
[in] | aValue | Value. |
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
|
inline |
Set Lin/Log scale for Y.
[in] | aValue | Value. |
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
|
inline |
Set Lin/Log scale for Z.
[in] | aValue | Value. |
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
|
private |
Sets OX style.
|
private |
Sets PINK style.
|
private |
Sets STANDARD style.
|
inline |
UnDraws a ROOT object.
[in] | aObj | Pointer to ROOT object to be remove. |
[in] | aPadIndex | Pad index when using subpads (see DivideCanvas()). |
void GwollumPlot::UnDrawLegend | ( | void | ) |
Removes the legend box from the pad.
void GwollumPlot::UpdateText | ( | const string | aText | ) |
|
protected |
Name.
|
protected |
TColor indices for Ox.
|
protected |
TColor for Ox. 0=background, 1=middleground/plots, 2=foreground, 3=grid.
|
protected |
Random integer id.
|
protected |
Random string id.
|
protected |
Style name.
|
protected |
Working canvas.
|
protected |
Plot legends.
|
protected |
Working pad.
|
protected |
Additional text.