SatAndLight  2.2.2-hubble
Simulation toolkit for space telescopes
Loading...
Searching...
No Matches
SatPlot Class Reference

Draw and print ROOT graphical objects. More...

#include <SatPlot.h>

Public Member Functions

int AddPad (const double aX0, const double aY0, const double aRx, const double aRy)
 Adds a new pad (up to SPL_NPADMAX).
 
void Clear (const int aPadIndex=0)
 Clears pad.
 
void Draw (TObject *aObj, const string aOptions="", const int aPadIndex=0)
 Draws a ROOT object.
 
double GetPadXmax (const int aPadIndex=0)
 Returns the maximum x-coordinate value visible on the pad.
 
double GetPadXmin (const int aPadIndex=0)
 Returns the minimum x-coordinate value visible on the pad.
 
double GetPadYmax (const int aPadIndex=0)
 Returns the maximum y-coordinate value visible on the pad.
 
double GetPadYmin (const int aPadIndex=0)
 Returns the minimum y-coordinate value visible on the pad.
 
void Print (const string aFileName, const double aScaleFactor=1.0)
 Prints current canvas in a file.
 
void ResizePad (const double aX0, const double aY0, const double aX1, const double aY1, const int aPadIndex=0)
 Resizes a pad.
 
void SetGridx (const int aValue=1, const int aPadIndex=0)
 Sets/Unsets grid for X.
 
void SetGridy (const int aValue=1, const int aPadIndex=0)
 Sets/Unsets grid for Y.
 
void SetLogx (const int aValue, const int aPadIndex=0)
 Sets Linear/Log scale for the X axis.
 
void SetLogy (const int aValue, const int aPadIndex=0)
 Sets Linear/Log scale for Y.
 
void SetLogz (const int aValue, const int aPadIndex=0)
 Sets Linear/Log scale for Z.
 
void UseCurrentStyle (const int aPadIndex=0)
 Force a copy of current style for all objects in canvas.
 
Constructors and destructors
 SatPlot (const string aName, const int aNx=800, const int aNy=494)
 Constructor of the SatPlot class.
 
virtual ~SatPlot (void)
 Destructor of the SatPlot class.
 

Private Member Functions

void SetStyle (void)
 Sets the plotting style.
 

Private Attributes

int npads
 number of working pads.
 
int randid
 random integer id.
 
string srandid
 random string id.
 
TCanvas * Wcan
 working canvas.
 
TPad * Wpad [SPL_NPADMAX]
 working pads.
 
TStyle * Wstyle
 working style.
 

Detailed Description

Draw and print ROOT graphical objects.

The SatPlot class provides a single interface to draw and print ROOT objects like histograms, graphs and so on. It also adopts a specific "hot" plotting style: black background, yellow lines and shades from red to yellow. This class mainly includes wrappers for ROOT drawing functions.

Author
Florent Robinet

Constructor & Destructor Documentation

◆ SatPlot()

SatPlot::SatPlot ( const string  aName,
const int  aNx = 800,
const int  aNy = 494 
)

Constructor of the SatPlot class.

The constructor is used to initiate the canvas to host the plots. It must be given a name and a size. By default, a single pad is drawn (pad index = 0).

Parameters
[in]aNameCanvas name.
[in]aNxHorizontal size: number of pixels in the X direction.
[in]aNyVertical size: number of pixels in the Y direction.

◆ ~SatPlot()

SatPlot::~SatPlot ( void  )
virtual

Destructor of the SatPlot class.

Member Function Documentation

◆ AddPad()

int SatPlot::AddPad ( const double  aX0,
const double  aY0,
const double  aRx,
const double  aRy 
)

Adds a new pad (up to SPL_NPADMAX).

Parameters
[in]aX0Upper-left corner X position (relative to canvas).
[in]aY0Upper-left corner Y position (relative to canvas).
[in]aRxSize in the X direction (relative to canvas).
[in]aRySize in the Y direction (relative to canvas).
Returns
The pad index. -1 is returned if the pad cannot be created.

◆ Clear()

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

Clears pad.

Parameters
[in]aPadIndexPad index.

◆ Draw()

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

Draws a ROOT object.

Parameters
[in]aObjPointer to the ROOT object to draw.
[in]aOptionsDrawing options (ROOT options).
[in]aPadIndexPad index.

◆ GetPadXmax()

double SatPlot::GetPadXmax ( const int  aPadIndex = 0)
inline

Returns the maximum x-coordinate value visible on the pad.

If log axis the returned value is in decades.

Parameters
[in]aPadIndexPad index.

◆ GetPadXmin()

double SatPlot::GetPadXmin ( const int  aPadIndex = 0)
inline

Returns the minimum x-coordinate value visible on the pad.

If log axis the returned value is in decades.

Parameters
[in]aPadIndexPad index.

◆ GetPadYmax()

double SatPlot::GetPadYmax ( const int  aPadIndex = 0)
inline

Returns the maximum y-coordinate value visible on the pad.

If log axis the returned value is in decades.

Parameters
[in]aPadIndexPad index.

◆ GetPadYmin()

double SatPlot::GetPadYmin ( const int  aPadIndex = 0)
inline

Returns the minimum y-coordinate value visible on the pad.

If log axis the returned value is in decades.

Parameters
[in]aPadIndexPad index.

◆ Print()

void SatPlot::Print ( const string  aFileName,
const double  aScaleFactor = 1.0 
)

Prints current canvas in a file.

Parameters
[in]aFileNameFile name to save the current canvas.
[in]aScaleFactorScaling factor: the width and height are rescaled by some given factor.

◆ ResizePad()

void SatPlot::ResizePad ( const double  aX0,
const double  aY0,
const double  aX1,
const double  aY1,
const int  aPadIndex = 0 
)
inline

Resizes a pad.

Parameters
[in]aX0New X0 position (relative to canvas).
[in]aY0New Y0 position (relative to canvas).
[in]aX1New X1 position (relative to canvas).
[in]aY1New Y1 position (relative to canvas).
[in]aPadIndexPad index.

◆ SetGridx()

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

Sets/Unsets grid for X.

Parameters
[in]aValue=1: the grid is drawn.
[in]aPadIndexPad index.

◆ SetGridy()

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

Sets/Unsets grid for Y.

Parameters
[in]aValue=1: the grid is drawn.
[in]aPadIndexPad index.

◆ SetLogx()

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

Sets Linear/Log scale for the X axis.

  • 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]aValueNew value.
[in]aPadIndexPad index.

◆ SetLogy()

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

Sets Linear/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
[in]aValueNew value.
[in]aPadIndexPad index.

◆ SetLogz()

void SatPlot::SetLogz ( const int  aValue,
const int  aPadIndex = 0 
)
inline

Sets Linear/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]aValueNew value.
[in]aPadIndexPad index.

◆ SetStyle()

void SatPlot::SetStyle ( void  )
private

Sets the plotting style.

◆ UseCurrentStyle()

void SatPlot::UseCurrentStyle ( const int  aPadIndex = 0)
inline

Force a copy of current style for all objects in canvas.

Parameters
[in]aPadIndexPad index.

Member Data Documentation

◆ npads

int SatPlot::npads
private

number of working pads.

◆ randid

int SatPlot::randid
private

random integer id.

◆ srandid

string SatPlot::srandid
private

random string id.

◆ Wcan

TCanvas* SatPlot::Wcan
private

working canvas.

◆ Wpad

TPad* SatPlot::Wpad[SPL_NPADMAX]
private

working pads.

◆ Wstyle

TStyle* SatPlot::Wstyle
private

working style.


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