-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plotter.h
54 lines (47 loc) · 1.43 KB
/
Plotter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "TCanvas.h"
#include "TH1.h"
#include "TLatex.h"
#include "TLegend.h"
#include "TLegendEntry.h"
#include "TROOT.h"
#include "TStyle.h"
#include "TText.h"
void SetBasicPlotStyle()
{
// Canvas Style
// Turning off statistics box
gStyle->SetOptStat(0);
// Turning off automatic histogram titles
gStyle->SetOptTitle(0);
// Padding and font sizes
gStyle->SetPadBottomMargin(0.15);
gStyle->SetPadLeftMargin(0.15);
gStyle->SetPadRightMargin(0.05);
gStyle->SetFrameLineWidth(2);
gStyle->SetTitleFont(22, "t");
gStyle->SetTitleSize(0.06, "t");
}
void SetPlotDirectory(std::string plotDirectory)
{
if (0 != system(Form("test -d %s", plotDirectory.c_str())))
system(Form("mkdir -m 755 -p %s", plotDirectory.c_str()));
}
void SetTitleStyles(TH1* histogram)
{
// X axis
histogram->GetXaxis()->CenterTitle(true);
histogram->GetXaxis()->SetTitleFont(22);
histogram->GetXaxis()->SetTitleSize(0.05);
histogram->GetXaxis()->SetLabelSize(0.04);
// Y axis
histogram->GetYaxis()->CenterTitle(true);
histogram->GetYaxis()->SetTitleFont(22);
histogram->GetYaxis()->SetTitleSize(0.05);
histogram->GetYaxis()->SetLabelSize(0.04);
histogram->GetYaxis()->SetMaxDigits(4);
// Z axis
histogram->GetZaxis()->CenterTitle(true);
histogram->GetZaxis()->SetTitleFont(22);
histogram->GetZaxis()->SetTitleSize(0.05);
histogram->GetZaxis()->SetLabelSize(0.04);
}