cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches

A "prettified" generic figure canvas. More...

#include <CepGenAddOns/ROOTWrapper/ROOTCanvas.h>

+ Inheritance diagram for ROOTCanvas:
+ Collaboration diagram for ROOTCanvas:

Public Member Functions

 ROOTCanvas (const std::string &name, const std::string &title="", bool ratio=false)
 Build a canvas from its name, title, and attributes.
 
void SetSize (double size=600)
 Set horizontal canvas width.
 
void Prettify (TH1 *obj)
 Draw main plot attributes in a pretty manner.
 
void Prettify (THStack *hs)
 
void Prettify (TMultiGraph *mg)
 
std::vector< TH1 * > RatioPlot (TH1 *denom, const std::vector< TH1 * > &numers, double xmin=-999., double xmax=-999., double ymin=-999., double ymax=-999., Option_t *draw_style="hist")
 
std::vector< TGraphErrors * > RatioPlot (TGraphErrors *denom, const std::vector< TGraphErrors * > &numers, double xmin=-999., double xmax=-999., double ymin=-999., double ymax=-999.)
 
void SetTopLabel (const std::string &lab)
 Specify the text to show on top of the canvas.
 
void SetGrid (int x=1, int y=1)
 
void SetLogx (int log=1)
 
void SetLogy (int log=1)
 
void SetLogz (int log=1)
 
void SetLegendMode (const std::string &mode)
 Set the placement strategy for the legend.
 
void SetLegendX1 (double x)
 Set the horizontal coordinate of the low-left part of the legend object.
 
void SetLegendY1 (double y)
 Set the vertical coordinate of the low-left part of the legend object.
 
void AddLegendEntry (const TObject *obj, const std::string &title, Option_t *option="lpf")
 Add one new entry to the legend object.
 
void Save (const std::string &ext, const std::string &out_dir=".")
 Save the canvas in an external file.
 
TLegend * GetLegend ()
 Retrieve the legend object (if produced)
 
void Place (TLegend *leg, const Option_t *mode="lt")
 
template<typename T , typename... Args>
T * Make (Args &&... args)
 Garbage collector-like TObjects producer.
 

Static Public Attributes

static const std::vector< int > colours
 

Detailed Description

Definition at line 89 of file ROOTCanvas.h.

Constructor & Destructor Documentation

◆ ROOTCanvas()

ROOTCanvas ( const std::string &  name,
const std::string &  title = "",
bool  ratio = false 
)
explicit
Parameters
[in]nameCanvas name (and subsequently filename on save)
[in]ratioDivide the canvas into a main and ratio plots subparts?

Definition at line 96 of file ROOTCanvas.h.

Member Function Documentation

◆ AddLegendEntry()

void AddLegendEntry ( const TObject *  obj,
const std::string &  title,
Option_t *  option = "lpf" 
)

Definition at line 420 of file ROOTCanvas.h.

◆ GetLegend()

TLegend * GetLegend ( )

Definition at line 463 of file ROOTCanvas.h.

◆ Make()

template<typename T , typename... Args>
T * Make ( Args &&...  args)

Definition at line 487 of file ROOTCanvas.h.

◆ Place()

void Place ( TLegend *  leg,
const Option_t *  mode = "lt" 
)

Definition at line 464 of file ROOTCanvas.h.

◆ Prettify() [1/3]

void Prettify ( TH1 *  obj)

Definition at line 109 of file ROOTCanvas.h.

◆ Prettify() [2/3]

void Prettify ( THStack *  hs)

Definition at line 194 of file ROOTCanvas.h.

◆ Prettify() [3/3]

void Prettify ( TMultiGraph *  mg)

Definition at line 211 of file ROOTCanvas.h.

◆ RatioPlot() [1/2]

std::vector< TGraphErrors * > RatioPlot ( TGraphErrors *  denom,
const std::vector< TGraphErrors * > &  numers,
double  xmin = -999.,
double  xmax = -999.,
double  ymin = -999.,
double  ymax = -999. 
)

Definition at line 299 of file ROOTCanvas.h.

◆ RatioPlot() [2/2]

std::vector< TH1 * > RatioPlot ( TH1 *  denom,
const std::vector< TH1 * > &  numers,
double  xmin = -999.,
double  xmax = -999.,
double  ymin = -999.,
double  ymax = -999.,
Option_t *  draw_style = "hist" 
)

Definition at line 248 of file ROOTCanvas.h.

◆ Save()

void Save ( const std::string &  ext,
const std::string &  out_dir = "." 
)

Definition at line 434 of file ROOTCanvas.h.

◆ SetGrid()

void SetGrid ( int  x = 1,
int  y = 1 
)

Definition at line 377 of file ROOTCanvas.h.

◆ SetLegendMode()

void SetLegendMode ( const std::string &  mode)

Definition at line 404 of file ROOTCanvas.h.

◆ SetLegendX1()

void SetLegendX1 ( double  x)
Note
To be called before the first legend entry is added

Definition at line 407 of file ROOTCanvas.h.

◆ SetLegendY1()

void SetLegendY1 ( double  y)
Note
To be called before the first legend entry is added

Definition at line 414 of file ROOTCanvas.h.

◆ SetLogx()

void SetLogx ( int  log = 1)

Definition at line 383 of file ROOTCanvas.h.

◆ SetLogy()

void SetLogy ( int  log = 1)

Definition at line 390 of file ROOTCanvas.h.

◆ SetLogz()

void SetLogz ( int  log = 1)

Definition at line 396 of file ROOTCanvas.h.

◆ SetSize()

void SetSize ( double  size = 600)

Definition at line 106 of file ROOTCanvas.h.

◆ SetTopLabel()

void SetTopLabel ( const std::string &  lab)

Definition at line 365 of file ROOTCanvas.h.

Member Data Documentation

◆ colours

const std::vector< int > colours
static
Initial value:
= {
kBlack, kRed + 1, kBlue - 2, kGreen + 1, kOrange + 1, kAzure + 1, kMagenta + 1, kCyan + 3, kPink + 5}

Definition at line 91 of file ROOTCanvas.h.