NAGASH 0.9.8
Next Generation Analysis System
|
Figure class for TPad. This is the class for drawing all the other elements(histograms, graphs, function, etc.) in a figure. More...
#include "NAGASH/FigureTool.h"
Public Member Functions | |
virtual | ~FigurePad () |
std::shared_ptr< FigurePad > | BookPad (const TString &padname, int lbx, int lby, int rtx, int rty, std::function< void(TPad *)> optionfunc=[](TPad *) {}) |
Book a new pad in this pad. | |
virtual void | CD () override |
void | DrawATLASLabel (const TString &content, double posx, double poxy, Color_t color=1, double space=-1) |
Draw a "ATLAS" plus the given content like ATLAS Internal, the ATLAS text will be drawn slanted. | |
virtual void | DrawElement () override |
int | GetNColoredObjects () |
TString | GetXTitle () |
double | GetXTitleOffset () |
TString | GetYTitle () |
double | GetYTitleOffset () |
TString | GetZTitle () |
double | GetZTitleOffset () |
bool | NeedBottomMargin () |
bool | NeedLeftMargin () |
bool | NeedRightMargin () |
void | Norm (const TString &, const TString &, double xmin=0, double xmax=0) |
Normalize one element to another. | |
void | SetAxisStyle (std::function< void(TAxis *, TAxis *, TAxis *)>) |
Set the style of the axis manually. | |
void | SetAxisTitle (const TString &xname="UNKNOWN", const TString &yname="UNKNOWN", const TString &zname="UNKNOWN") |
Set the axis title. | |
void | SetAxisTitleOffset (double off_x=1.4, double off_y=1.4, double off_z=1) |
Set the offset of the axis title manually. | |
void | SetGridx (bool gridx=true) |
Draw grids on x axis. | |
void | SetGridy (bool gridy=true) |
Draw grids on y axis. | |
std::shared_ptr< FigureHStack > | SetHStack (const TString &elementname, const std::vector< TString > &linkinfo, const TString &option) |
Book a new THStack on this pad, note that only one NAGASH::FigureHStack can be booked in a pad. | |
std::shared_ptr< FigureFunc1D > | SetInputFunc1D (const TString &elementname, TF1 *func, const TString &option, std::function< void(TF1 *)> optionfunc=[](TF1 *) {}) |
Book a new FigureFunc1D on this pad. | |
std::shared_ptr< FigureGraph1D > | SetInputGraph1D (const TString &elementname, TGraph *graph, const TString &option, std::function< void(TGraph *)> optionfunc=[](TGraph *) {}) |
Book a new FigureGraph1D on this pad. | |
std::shared_ptr< FigureHist1D > | SetInputHist1D (const TString &elementname, const TString &linkinfo, const TString &option, std::function< void(TH1D *)> optionfunc=[](TH1D *) {}) |
Book a FigureHist1D on this pad, the histogram is generated from other FigureHist1D you passed to the FigureTool. | |
std::shared_ptr< FigureHist1D > | SetInputHist1D (const TString &elementname, TH1D *hist, const TString &option, std::function< void(TH1D *)> optionfunc=[](TH1D *) {}) |
Book a FigureHist1D on this pad. | |
std::shared_ptr< FigureHist1D > | SetInputHist1DGraph (const TString &elementname, const TString &linkinfo, const TString &option, std::function< void(TGraph *)> optionfunc=[](TGraph *) {}) |
Book a FigureHist1D on this pad, the histogram is generated from other FigureHist1D you passed to the FigureTool. The new histogram will be converted to a TGraphErrors object when drawing. | |
std::shared_ptr< FigureHist1D > | SetInputHist1DGraph (const TString &elementname, TH1D *hist, const TString &option, std::function< void(TGraph *)> optionfunc=[](TGraph *) {}) |
Book a FigureHist1D on this pad, the histogram will be converted to a TGraphErrors object when drawing. | |
std::shared_ptr< FigureHist2D > | SetInputHist2D (const TString &elementname, TH2D *hist, const TString &option, std::function< void(TH2D *)> optionfunc=[](TH2D *) {}) |
Book a new FigureHist2D on this pad. | |
void | SetLatex (const TString &content, double posx, double poxy, Color_t color=1, std::function< void(TLatex *)> optionfunc=[](TLatex *) {}) |
Book a new FigureLatex on this pad. | |
void | SetLegend (const TString &header, const TString &option, double, double, double, double) |
Set the legend of this pad with manually set position. | |
void | SetLegend (const TString &header="", const TString &option="") |
Set the legend of this pad. | |
void | SetLegendColumn (int) |
Set the column number of the legend. | |
void | SetLegendEntries (const std::vector< TString > &entries, const std::vector< TString > &options) |
Set the entries passed to the legend, if this function is not called, all the elements in the pad will be drawn in the legend. | |
void | SetLogx (int value=1) |
Set x-axis to be drawn in logarithmic scale. | |
void | SetLogy (int value=1) |
Set y-axis to be drawn in logarithmic scale. | |
void | SetLogz (int value=1) |
Set z-axis to be drawn in logarithmic scale. | |
virtual void | SetStyle () override |
void | SetXaxisRange (double min, double max) |
Set the range of the x-axis to be drawn. | |
void | SetYaxisRange (double min, double max) |
Set the range of the y-axis to be drawn. | |
void | SetZaxisRange (double min, double max) |
Set the range of the z-axis to be drawn. | |
Public Member Functions inherited from NAGASH::FigureElement | |
FigureElement (std::shared_ptr< MSGTool > MSG, std::shared_ptr< FigureStyleHelper > shelper, const TString &elementname, const TString &tyname, FigureElement *mother=0) | |
void | Draw () |
std::shared_ptr< FigureElement > | FindLinkElement (const TString &name) |
std::shared_ptr< FigureElement > | GetLinkElement (int index) |
int | GetLinkIndex (const TString &name) |
FigureElement * | GetMotherElement () |
TString | GetName () |
int | GetNLinkElement () |
FigureElement * | GetRootElement () |
TString | GetTypeName () |
bool | IsType (const TString &tyname) |
std::shared_ptr< FigureElement > | TraceElement (const TString &name) |
Private Member Functions | |
FigurePad (std::shared_ptr< MSGTool > MSG, std::shared_ptr< FigureStyleHelper > shelper, const TString &elementname, int lbx, int lby, int rtx, int rty, FigureElement *mother, std::function< void(TPad *)> optionfunc=[](TPad *) {}) | |
TPad * | GetPad () |
Private Attributes | |
std::function< void(TAxis *, TAxis *, TAxis *)> | AxisOptionFunc |
bool | hashstack = false |
TLegend * | legend = nullptr |
int | legend_column = 1 |
std::vector< TString > | legend_entries |
TString | legend_header |
TString | legend_header_option |
std::vector< TString > | legend_options |
double | legend_xmax = 0 |
double | legend_xmin = 0 |
double | legend_ymax = 0 |
double | legend_ymin = 0 |
double | max_xaxis = 0 |
double | max_yaxis = 0 |
double | max_zaxis = 0 |
double | min_xaxis = 0 |
double | min_yaxis = 0 |
double | min_zaxis = 0 |
TPad * | mypad = nullptr |
int | n_colored_objects = 0 |
std::function< void(TPad *)> | OptionFunc |
bool | plot_legend = false |
bool | user_set_legend_position = false |
bool | user_set_rangex = false |
bool | user_set_rangey = false |
bool | user_set_rangez = false |
bool | user_set_title_offset = false |
bool | waitforfirstlink = true |
double | xoffset = 4.2 |
TString | xtitle = "UNKNOWN" |
double | yoffset = 4.5 |
TString | ytitle = "UNKNOWN" |
double | zoffset = 1 |
TString | ztitle = "UNKNOWN" |
Friends | |
class | FigureCanvas |
class | FigureStyleHelper |
Additional Inherited Members | |
Public Attributes inherited from NAGASH::FigureElement | |
FigureSquareRange | Range_Total |
Protected Member Functions inherited from NAGASH::FigureElement | |
bool | CheckDuplicate (const TString &name) |
bool | Contain (FigureSquareRange A, FigureSquareRange SubA) |
bool | Contain (std::shared_ptr< FigureElement > subelement) |
std::shared_ptr< MSGTool > | MSGUser () |
std::shared_ptr< FigureStyleHelper > | StyleUser () |
Protected Attributes inherited from NAGASH::FigureElement | |
std::deque< std::shared_ptr< FigureElement > > | LinkedElement |
std::map< TString, uint64_t > | MapLinkedElement |
FigureElement * | MotherElement |
std::vector< FigureSquareRange > | Range_vec |
Figure class for TPad. This is the class for drawing all the other elements(histograms, graphs, function, etc.) in a figure.
Definition at line 328 of file FigureTool.h.
|
virtual |
Definition at line 1861 of file FigureTool.cxx.
|
private |
Definition at line 1741 of file FigureTool.cxx.
std::shared_ptr< FigurePad > FigurePad::BookPad | ( | const TString & | padname, |
int | lbx, | ||
int | lby, | ||
int | rtx, | ||
int | rty, | ||
std::function< void(TPad *)> | optionfunc = [](TPad *) {} |
||
) |
Book a new pad in this pad.
padname | name of the new pad. |
lbx | x value of the left bottom of the new pad. |
lby | y value of the left bottom of the new pad. |
rtx | x value of the right top of the new pad. |
rty | y value of the right top of the new pad. |
optionfunc | user-defined function for adjusting the style of the new pad. |
Definition at line 1874 of file FigureTool.cxx.
|
overridevirtual |
Reimplemented from NAGASH::FigureElement.
Definition at line 1856 of file FigureTool.cxx.
void FigurePad::DrawATLASLabel | ( | const TString & | content, |
double | posx, | ||
double | posy, | ||
Color_t | color = 1 , |
||
double | space = -1 |
||
) |
Draw a "ATLAS" plus the given content like ATLAS Internal, the ATLAS text will be drawn slanted.
content | extra content after the "ATLAS" text |
posx | relative x positon of the label(0 to 1). |
posy | relative y positon of the label(0 to 1). |
color | color of the extra text. |
space | space between "ATLAS" and the other content |
Definition at line 2113 of file FigureTool.cxx.
|
overridevirtual |
Reimplemented from NAGASH::FigureElement.
Definition at line 1759 of file FigureTool.cxx.
|
inline |
Definition at line 453 of file FigureTool.h.
|
inlineprivate |
Definition at line 452 of file FigureTool.h.
|
inline |
Definition at line 446 of file FigureTool.h.
|
inline |
Definition at line 449 of file FigureTool.h.
|
inline |
Definition at line 447 of file FigureTool.h.
|
inline |
Definition at line 450 of file FigureTool.h.
|
inline |
Definition at line 448 of file FigureTool.h.
|
inline |
Definition at line 451 of file FigureTool.h.
|
inline |
Definition at line 445 of file FigureTool.h.
|
inline |
Definition at line 443 of file FigureTool.h.
|
inline |
Definition at line 444 of file FigureTool.h.
void FigurePad::Norm | ( | const TString & | elemname1, |
const TString & | elemname2, | ||
double | xmin = 0 , |
||
double | xmax = 0 |
||
) |
Normalize one element to another.
elemname1 | name of the element to be scaled. |
elemname2 | name of the element to be scaled to. |
xmin | start point of calculating the normalized value. |
xmax | end point of calculating the normalized value. |
Definition at line 2129 of file FigureTool.cxx.
|
inline |
Set the style of the axis manually.
func | function to set the style of the axis, which takes the pointer of the x,y,z TAxis as input. |
Definition at line 480 of file FigureTool.h.
|
inline |
Set the axis title.
xname | axis title for the x-axis. |
yname | axis title for the y-axis. |
zname | axis title for the z-axis. |
Definition at line 471 of file FigureTool.h.
|
inline |
Set the offset of the axis title manually.
off_x | offset of the x-axis title. |
off_y | offset of the y-axis title. |
off_z | offset of the z-axis title. |
Definition at line 459 of file FigureTool.h.
void FigurePad::SetGridx | ( | bool | gridx = true | ) |
Draw grids on x axis.
Definition at line 2232 of file FigureTool.cxx.
void FigurePad::SetGridy | ( | bool | gridy = true | ) |
Draw grids on y axis.
Definition at line 2241 of file FigureTool.cxx.
std::shared_ptr< FigureHStack > FigurePad::SetHStack | ( | const TString & | elementname, |
const std::vector< TString > & | linkinfo, | ||
const TString & | option | ||
) |
Book a new THStack on this pad, note that only one NAGASH::FigureHStack can be booked in a pad.
elementname | name of the THStack to be drawn, can be used in the links and legend. |
linkinfo | a vector of TString containing all names of histograms you want to use constucting the new THStack. |
option | Draw options, passed to THStack::Draw(). |
Definition at line 1994 of file FigureTool.cxx.
std::shared_ptr< FigureFunc1D > FigurePad::SetInputFunc1D | ( | const TString & | elementname, |
TF1 * | func, | ||
const TString & | option, | ||
std::function< void(TF1 *)> | optionfunc = [](TF1 *) {} |
||
) |
Book a new FigureFunc1D on this pad.
elementname | name of the function to be drawn, can be used in the legend. |
func | pointer to the TF1. |
option | draw options, passed to TF1::Draw(). |
optionfunc | user-defined function for adjusting the style of the TF1, can override the default style. |
Definition at line 2048 of file FigureTool.cxx.
std::shared_ptr< FigureGraph1D > FigurePad::SetInputGraph1D | ( | const TString & | elementname, |
TGraph * | graph, | ||
const TString & | option, | ||
std::function< void(TGraph *)> | optionfunc = [](TGraph *) {} |
||
) |
Book a new FigureGraph1D on this pad.
elementname | name of the graph to be drawn, can be used in the legend. |
graph | pointer to the TGraph. |
option | draw options, passed to TGraph::Draw(). |
optionfunc | user-defined function for adjusting the style of the TGraph, can override the default style. |
Definition at line 2023 of file FigureTool.cxx.
std::shared_ptr< FigureHist1D > FigurePad::SetInputHist1D | ( | const TString & | elementname, |
const TString & | linkinfo, | ||
const TString & | option, | ||
std::function< void(TH1D *)> | optionfunc = [](TH1D *) {} |
||
) |
Book a FigureHist1D on this pad, the histogram is generated from other FigureHist1D you passed to the FigureTool.
elementname | name of the TH1D to be drawn. |
linkinfo | input string for controling the generation of the new histogram. The syntax is "(link type)/(linked histogram one)/(linked histogram two)/(plot type)". possible options for the link type are: RATIO , PULL , DELTA and CHI2 . possible options for the value type are: VAL (value), ERR (error), TOPERR (only use the error of the first one), BOTTOMERR (only use the error of the second one). You can combine them such as "VALERR". |
option | Draw options, passed to TH1D::Draw(). |
optionfunc | user-defined function for adjusting the style of the TH1D, can override the default style. |
Definition at line 1920 of file FigureTool.cxx.
std::shared_ptr< FigureHist1D > FigurePad::SetInputHist1D | ( | const TString & | elementname, |
TH1D * | hist, | ||
const TString & | option, | ||
std::function< void(TH1D *)> | optionfunc = [](TH1D *) {} |
||
) |
Book a FigureHist1D on this pad.
elementname | name of the TH1D to be drawn, used in the links and legend. |
hist | pointer to the TH1D. |
option | draw options, passed to TH1D::Draw(). |
optionfunc | user-defined function for adjusting the style of the TH1D, can override the default style. |
Definition at line 1893 of file FigureTool.cxx.
std::shared_ptr< FigureHist1D > FigurePad::SetInputHist1DGraph | ( | const TString & | elementname, |
const TString & | linkinfo, | ||
const TString & | option, | ||
std::function< void(TGraph *)> | optionfunc = [](TGraph *) {} |
||
) |
Book a FigureHist1D on this pad, the histogram is generated from other FigureHist1D you passed to the FigureTool. The new histogram will be converted to a TGraphErrors object when drawing.
elementname | name of the TH1D to be drawn. |
linkinfo | input string for controling the generation of the new histogram. The syntax is "(link type)/(linked histogram one)/(linked histogram two)/(plot type)". possible options for the link type are: RATIO , PULL , DELTA and CHI2 . possible options for the value type are: VAL (value), ERR (error), TOPERR (only use the error of the first one), BOTTOMERR (only use the error of the second one). You can combine them such as "VALERR". |
option | Draw options, passed to TGraph::Draw(). |
optionfunc | user-defined function for adjusting the style of the TGraph, can override the default style. |
Definition at line 1971 of file FigureTool.cxx.
std::shared_ptr< FigureHist1D > FigurePad::SetInputHist1DGraph | ( | const TString & | elementname, |
TH1D * | hist, | ||
const TString & | option, | ||
std::function< void(TGraph *)> | optionfunc = [](TGraph *) {} |
||
) |
Book a FigureHist1D on this pad, the histogram will be converted to a TGraphErrors object when drawing.
elementname | name of the element. |
hist | pointer to the TH1D. |
option | draw options, passed to TGraph::Draw(). |
optionfunc | user-defined function for adjusting the style of the TGraph, can override the default style. |
Definition at line 1944 of file FigureTool.cxx.
std::shared_ptr< FigureHist2D > FigurePad::SetInputHist2D | ( | const TString & | elementname, |
TH2D * | hist, | ||
const TString & | option, | ||
std::function< void(TH2D *)> | optionfunc = [](TH2D *) {} |
||
) |
Book a new FigureHist2D on this pad.
elementname | name of the histogram to be drawn, can be used in the legend. |
hist | pointer to the TH2D. |
option | draw options, passed to TH2D::Draw(). |
optionfunc | user-defined function for adjusting the style of the TH2D, can override the default style. |
Definition at line 2073 of file FigureTool.cxx.
void FigurePad::SetLatex | ( | const TString & | content, |
double | posx, | ||
double | poxy, | ||
Color_t | color = 1 , |
||
std::function< void(TLatex *)> | optionfunc = [](TLatex *) {} |
||
) |
Book a new FigureLatex on this pad.
content | content of the text you want to draw. |
posx | relative x value of the text(0 to 1). |
poxy | relative y value of the text(0 to 1). |
color | color of the text. |
optionfunc | user-defined function for adjusting the style of the TLatex, can override the default style. |
Definition at line 2097 of file FigureTool.cxx.
void FigurePad::SetLegend | ( | const TString & | header, |
const TString & | option, | ||
double | xmin, | ||
double | ymin, | ||
double | xmax, | ||
double | ymax | ||
) |
Set the legend of this pad with manually set position.
header | header of the legend, if given an empty string, no header will be drawn. |
option | option to draw the legend, passed to TLegend::Draw(). |
xmin | left-bottom x position of the legend. |
ymin | left-bottom y position of the legend. |
xmax | right-top x position of the legend. |
ymax | right-top y position of the legend. |
Definition at line 2197 of file FigureTool.cxx.
void FigurePad::SetLegend | ( | const TString & | header = "" , |
const TString & | option = "" |
||
) |
Set the legend of this pad.
header | header of the legend, if given an empty string, no header will be drawn. |
option | options to draw the legend, passed to TLegend::Draw(). |
Definition at line 2182 of file FigureTool.cxx.
void FigurePad::SetLegendColumn | ( | int | column | ) |
Set the column number of the legend.
column | number of the columns. |
Definition at line 2212 of file FigureTool.cxx.
void FigurePad::SetLegendEntries | ( | const std::vector< TString > & | entries, |
const std::vector< TString > & | options | ||
) |
Set the entries passed to the legend, if this function is not called, all the elements in the pad will be drawn in the legend.
entries | vector of names of the elements to be drawn in the legend. |
options | vector of options for each element to be drawn to the legend, the default one is "lpfe". |
Definition at line 2220 of file FigureTool.cxx.
void FigurePad::SetLogx | ( | int | value = 1 | ) |
Set x-axis to be drawn in logarithmic scale.
Definition at line 2250 of file FigureTool.cxx.
void FigurePad::SetLogy | ( | int | value = 1 | ) |
Set y-axis to be drawn in logarithmic scale.
Definition at line 2256 of file FigureTool.cxx.
void FigurePad::SetLogz | ( | int | value = 1 | ) |
Set z-axis to be drawn in logarithmic scale.
Definition at line 2262 of file FigureTool.cxx.
|
overridevirtual |
Reimplemented from NAGASH::FigureElement.
Definition at line 1766 of file FigureTool.cxx.
void FigurePad::SetXaxisRange | ( | double | min, |
double | max | ||
) |
Set the range of the x-axis to be drawn.
min | minimum value of the x-axis. |
max | maximum value of the x-axis. |
Definition at line 2270 of file FigureTool.cxx.
void FigurePad::SetYaxisRange | ( | double | min, |
double | max | ||
) |
Set the range of the y-axis to be drawn.
min | minimum value of the y-axis. |
max | maximum value of the y-axis. |
Definition at line 2280 of file FigureTool.cxx.
void FigurePad::SetZaxisRange | ( | double | min, |
double | max | ||
) |
Set the range of the z-axis to be drawn.
min | minimum value of the z-axis. |
max | maximum value of the z-axis. |
Definition at line 2290 of file FigureTool.cxx.
|
friend |
Definition at line 331 of file FigureTool.h.
|
friend |
Definition at line 330 of file FigureTool.h.
|
private |
Definition at line 402 of file FigureTool.h.
|
private |
Definition at line 405 of file FigureTool.h.
|
private |
Definition at line 429 of file FigureTool.h.
|
private |
Definition at line 440 of file FigureTool.h.
|
private |
Definition at line 431 of file FigureTool.h.
|
private |
Definition at line 433 of file FigureTool.h.
|
private |
Definition at line 434 of file FigureTool.h.
|
private |
Definition at line 432 of file FigureTool.h.
|
private |
Definition at line 438 of file FigureTool.h.
|
private |
Definition at line 436 of file FigureTool.h.
|
private |
Definition at line 439 of file FigureTool.h.
|
private |
Definition at line 437 of file FigureTool.h.
|
private |
Definition at line 421 of file FigureTool.h.
|
private |
Definition at line 423 of file FigureTool.h.
|
private |
Definition at line 425 of file FigureTool.h.
|
private |
Definition at line 422 of file FigureTool.h.
|
private |
Definition at line 424 of file FigureTool.h.
|
private |
Definition at line 426 of file FigureTool.h.
|
private |
Definition at line 398 of file FigureTool.h.
|
private |
Definition at line 415 of file FigureTool.h.
|
private |
Definition at line 401 of file FigureTool.h.
|
private |
Definition at line 430 of file FigureTool.h.
|
private |
Definition at line 435 of file FigureTool.h.
|
private |
Definition at line 417 of file FigureTool.h.
|
private |
Definition at line 418 of file FigureTool.h.
|
private |
Definition at line 419 of file FigureTool.h.
|
private |
Definition at line 406 of file FigureTool.h.
|
private |
Definition at line 404 of file FigureTool.h.
|
private |
Definition at line 411 of file FigureTool.h.
|
private |
Definition at line 407 of file FigureTool.h.
|
private |
Definition at line 412 of file FigureTool.h.
|
private |
Definition at line 408 of file FigureTool.h.
|
private |
Definition at line 413 of file FigureTool.h.
|
private |
Definition at line 409 of file FigureTool.h.