cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic 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 88 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 95 of file ROOTCanvas.h.

Member Function Documentation

◆ AddLegendEntry()

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

Definition at line 410 of file ROOTCanvas.h.

◆ GetLegend()

TLegend * GetLegend ( )

Definition at line 453 of file ROOTCanvas.h.

◆ Make()

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

Definition at line 477 of file ROOTCanvas.h.

◆ Place()

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

Definition at line 454 of file ROOTCanvas.h.

◆ Prettify() [1/3]

void Prettify ( TH1 *  obj)

Definition at line 108 of file ROOTCanvas.h.

◆ Prettify() [2/3]

void Prettify ( THStack *  hs)

Definition at line 188 of file ROOTCanvas.h.

◆ Prettify() [3/3]

void Prettify ( TMultiGraph *  mg)

Definition at line 205 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 289 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 239 of file ROOTCanvas.h.

◆ Save()

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

Definition at line 424 of file ROOTCanvas.h.

◆ SetGrid()

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

Definition at line 367 of file ROOTCanvas.h.

◆ SetLegendMode()

void SetLegendMode ( const std::string &  mode)

Definition at line 394 of file ROOTCanvas.h.

◆ SetLegendX1()

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

Definition at line 397 of file ROOTCanvas.h.

◆ SetLegendY1()

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

Definition at line 404 of file ROOTCanvas.h.

◆ SetLogx()

void SetLogx ( int  log = 1)

Definition at line 373 of file ROOTCanvas.h.

◆ SetLogy()

void SetLogy ( int  log = 1)

Definition at line 380 of file ROOTCanvas.h.

◆ SetLogz()

void SetLogz ( int  log = 1)

Definition at line 386 of file ROOTCanvas.h.

◆ SetSize()

void SetSize ( double  size = 600)

Definition at line 105 of file ROOTCanvas.h.

◆ SetTopLabel()

void SetTopLabel ( const std::string &  lab)

Definition at line 355 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 90 of file ROOTCanvas.h.