8#include <TGraphErrors.h>
72 const TString title =
"");
79 const TString title =
"");
86 const TString title =
"");
99 const TString title =
"");
112 const TString title =
"");
126 const TString title =
"");
139 const TString title =
"");
178 static void SaveFigure(TCanvas *canvas, TString output_filename,
179 TString output_subdirectory =
"",
224 const std::vector<TGraph *> &component_graphs,
225 Float_t fit_range_low, Float_t fit_range_high,
226 const TString &output_name,
227 const TString &output_subdirectory =
"fits",
228 const TString &label =
"", Bool_t logy = kTRUE);
244 static TLegend *
AddLegend(Double_t x1 = 0.7, Double_t x2 = 0.9,
245 Double_t y1 = 0.7, Double_t y2 = 0.9);
260 static TLatex *
AddText(
const TString label, Double_t x = 0.9,
261 Double_t y = 0.85, Double_t angle = 0);
283 static Bool_t preferences_set_;
284 static Width_t line_width_;
285 static TString plots_base_dir_;
286 static void SetTurboPalette();
287 static void WarnIfNotConfigured(
const TString method_name);
288 static void PlotPullHistogram(TGraph *residuals,
const TString &output_name,
289 const TString &output_subdirectory);
PlotSaveOptions
Which axis scalings SaveFigure() should write out.
@ kBOTH
Both, as two separate files.
@ kLOG
Logarithmic y only, written with a log_ filename prefix.
PlotSaveFormat
Output file format for saved figures.
@ kPNG
PNG raster output; line width 2.
@ kPDF
PDF vector output; line width 1.
All-static helpers for publication-quality ROOT graphics.
static TLatex * AddText(const TString label, Double_t x=0.9, Double_t y=0.85, Double_t angle=0)
Create and draw a text annotation on the current pad.
static void ConfigureAndDrawGraph(TGraph *graph, Int_t color, const TString title="")
ConfigureGraph() followed by Draw().
static TLegend * AddLegend(Double_t x1=0.7, Double_t x2=0.9, Double_t y1=0.7, Double_t y2=0.9)
Create, style and draw a legend on the current pad.
static void SaveFigure(TCanvas *canvas, TString output_filename, TString output_subdirectory="", PlotSaveOptions save_options=PlotSaveOptions::kBOTH)
Write a canvas to disk under the configured plots base directory.
static void SetPlotsBaseDir(const TString &dir)
Set the base directory that saved figures are written under.
static TString GetRandomName()
Generate a name unlikely to collide with existing ROOT objects.
static void ConfigureGraph(TGraph *graph, Int_t color, const TString title="")
Apply the house style to a graph without drawing it.
static void SetStylePreferences(PlotSaveFormat save_format=PlotSaveFormat::kPNG)
Install the global ROOT style and choose the output format.
static void Configure2DHistogram(TH2 *hist, TCanvas *canvas, const TString title="")
Apply the house style to a 2-D histogram and its canvas.
static void ConfigureAndDrawHistogram(TH1 *hist, Int_t color, const TString title="")
ConfigureHistogram() followed by Draw("HIST").
static void ConfigureHistogram(TH1 *hist, Int_t color, const TString title="")
Apply the house style to a 1-D histogram without drawing it.
static TCanvas * GetConfiguredCanvas(Bool_t logy=kFALSE)
Create a 1200x800 canvas with grid and ticks already set up.
static Width_t GetLineWidth()
Line width the Configure* methods apply.
static void PlotFitWithResiduals(TH1 *hist, TGraph *total_graph, const std::vector< TGraph * > &component_graphs, Float_t fit_range_low, Float_t fit_range_high, const TString &output_name, const TString &output_subdirectory="fits", const TString &label="", Bool_t logy=kTRUE)
Draw a fit over its data with a residual panel and save it.
static std::vector< Int_t > GetDefaultColors()
A palette of visually distinct ROOT colour indices.
static void ConfigureAndDraw2DHistogram(TH2 *hist, TCanvas *canvas, const TString title="")
Configure2DHistogram() followed by Draw("COLZ").
static TString GetPlotsBaseDir()
Current base directory for saved figures, without trailing slash.