HyperPlot  v1
Bin and visualise multidimensional datasets
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RootPlotter Class Referenceabstract

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

Class to make plotting root histograms a little easier.

Definition at line 23 of file RootPlotter.h.

#include <RootPlotter.h>

Inheritance diagram for RootPlotter:
Plotter RootPlotter1D RootPlotter2D

Public Member Functions

void setXaxisName (TString name)
 
void setYaxisName (TString name)
 
virtual double getGlobalMax ()
 
virtual double getGlobalMin ()
 
 RootPlotter (TH1 *histogram, double width=300, double height=200)
 
TString & drawOptions (int i)
 
TString & objDrawOptions (int i)
 
void plotStacked (TPad *pad, double scaleFactor)
 
void plotSame (TPad *pad, TString plotOptions, double scaleFactor=1.0)
 
virtual void plot (TString plotDirectory, TString plotOptions="", TPad *pad=0, double scaleFactor=1.0)
 
void addText (TString text, double x, double y, int alignh=1, int alignv=2, double size=0.06, int ndc=true)
 
void drawLegend ()
 
virtual ~RootPlotter ()
 
- Public Member Functions inherited from Plotter
int getColor (int i)
 
void setColor (int i, int color)
 
void usePresetColours (bool val=true)
 
void allImageFormats (bool val=true)
 
void setHistogramOwnership (bool i=1)
 
void setObjectOwnership (bool i=1)
 
 Plotter (TString canvasName, double width, double height)
 
 Plotter (const Plotter &other)
 
void add (TObject *histogram)
 
void addDot (double xpos, double ypos, double size, int colour=1, TString shape="circle", double sizeY=0.0)
 
void logX (bool log=1)
 
void logY (bool log=1)
 
void logZ (bool log=1)
 
void addObject (TObject *obj)
 
int getNumObjects ()
 
void setImageFormat (TString format)
 
TPad * getCanvas ()
 
void scaleTextSize (double scale)
 
void scaleAxisTitleSize (double scale)
 
void scaleAxisTitleOffset (double scale)
 
void setXAxisLabelSize (double val)
 
void setYAxisLabelSize (double val)
 
void setXAxisTitleSize (double val)
 
void setYAxisTitleSize (double val)
 
void setXAxisLabelOffset (double val)
 
void setYAxisLabelOffset (double val)
 
void setXAxisTitleOffset (double val)
 
void setYAxisTitleOffset (double val)
 
void setXAxisTickLength (double val)
 
void setYAxisTickLength (double val)
 
void setPropertiesFromTH1 (TH1 *hist)
 
void setMin (double min)
 
void setMax (double max)
 
void setBMargin (double val)
 
void setLMargin (double val)
 
void setRMargin (double val)
 
void setTMargin (double val)
 

Protected Member Functions

virtual void setHistogramStyle (TH1 *histogram, bool setMinMax=1)=0
 
TH1 * getHistogram (int i)
 
- Protected Member Functions inherited from Plotter
virtual void setCanvasDefaults (TPad *pad)
 

Protected Attributes

TString _xAxisName
 
TString _yAxisName
 
std::vector< TString > _drawOptions
 
std::vector< TString > _objDrawOptions
 
- Protected Attributes inherited from Plotter
TPad * _canvas
 
TLegend * _legend
 
double _forcedMax
 
double _forcedMin
 
std::vector< TObject * > _objToPlot
 
std::vector< TObject * > _histograms
 
std::vector< int > _colours
 
double _lMargin
 
double _rMargin
 
double _tMargin
 
double _bMargin
 
double _xAxisTitleOffset
 
double _yAxisTitleOffset
 
double _xAxisLabelOffset
 
double _yAxisLabelOffset
 
double _xAxisTickLength
 
double _yAxisTickLength
 
double _xAxisLabelSize
 
double _yAxisLabelSize
 
double _xAxisTitleSize
 
double _yAxisTitleSize
 
bool _histogramOwnership
 
bool _objectOwnership
 
bool _usePresetColours
 
bool _allImageFormats
 

Additional Inherited Members

- Static Public Attributes inherited from Plotter
static TString s_imageformat = ".pdf"
 
static TString s_imageformat2 = ""
 
static TString s_legend_position = "RightTop"
 
static int s_plotterCount = 0
 
static double s_forcedMax = -999.999
 
static double s_forcedMin = -999.999
 

Constructor & Destructor Documentation

RootPlotter::RootPlotter ( TH1 *  histogram,
double  width = 300,
double  height = 200 
)

Construct a RootPlotter with one histogram on a canvas with specified width and height

Definition at line 4 of file RootPlotter.cpp.

RootPlotter::~RootPlotter ( )
virtual

Destructor.

Definition at line 209 of file RootPlotter.cpp.

Member Function Documentation

void RootPlotter::addText ( TString  text,
double  x,
double  y,
int  alignh = 1,
int  alignv = 2,
double  size = 0.06,
int  ndc = true 
)

Add a text string at a point (x,y) on the histogram

Definition at line 33 of file RootPlotter.cpp.

void RootPlotter::drawLegend ( )

Add a legend to the Canvas - not really tested

Definition at line 48 of file RootPlotter.cpp.

TString & RootPlotter::drawOptions ( int  i)

Get a reference to the draw options of histogram i - used for getting and setting

Definition at line 21 of file RootPlotter.cpp.

virtual double RootPlotter::getGlobalMax ( )
inlinevirtual

Get the minimum of all histograms added (or the forced min if set)

Reimplemented in RootPlotter1D, and RootPlotter2D.

Definition at line 44 of file RootPlotter.h.

virtual double RootPlotter::getGlobalMin ( )
inlinevirtual

Get the maximum of all histograms added (or the forced max if set)

Reimplemented in RootPlotter1D, and RootPlotter2D.

Definition at line 45 of file RootPlotter.h.

TH1 * RootPlotter::getHistogram ( int  i)
protected

Get one of the histograms that has been added to the plotter

Definition at line 16 of file RootPlotter.cpp.

TString & RootPlotter::objDrawOptions ( int  i)

Get a reference to the draw options of object i - used for getting and setting

Definition at line 27 of file RootPlotter.cpp.

void RootPlotter::plot ( TString  plotDirectory,
TString  plotOptions = "",
TPad *  pad = 0,
double  scaleFactor = 1.0 
)
virtual

Call this to save the canvas to a specific directory.

Implements Plotter.

Definition at line 183 of file RootPlotter.cpp.

void RootPlotter::plotSame ( TPad *  pad,
TString  plotOptions,
double  scaleFactor = 1.0 
)

plot with the option SAME

Definition at line 124 of file RootPlotter.cpp.

void RootPlotter::plotStacked ( TPad *  pad,
double  scaleFactor 
)

plot stacked

Definition at line 73 of file RootPlotter.cpp.

virtual void RootPlotter::setHistogramStyle ( TH1 *  histogram,
bool  setMinMax = 1 
)
protectedpure virtual

purely virtual function that sets the correct histogram style (different for TH1 and TH2)

Implemented in RootPlotter1D, and RootPlotter2D.

void RootPlotter::setXaxisName ( TString  name)
inline

Set the x-axis title name

Definition at line 41 of file RootPlotter.h.

void RootPlotter::setYaxisName ( TString  name)
inline

Set the y-axis title name

Definition at line 42 of file RootPlotter.h.

Member Data Documentation

std::vector<TString> RootPlotter::_drawOptions
protected

options passed to Root on how to draw each histogram added

Definition at line 30 of file RootPlotter.h.

std::vector<TString> RootPlotter::_objDrawOptions
protected

options passed to Root on how to draw each object added

Definition at line 31 of file RootPlotter.h.

TString RootPlotter::_xAxisName
protected

xAxis name - by default taken from the first histogram added

Definition at line 27 of file RootPlotter.h.

TString RootPlotter::_yAxisName
protected

yAxis name - by default taken from the first histogram added

Definition at line 28 of file RootPlotter.h.


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