forked from AliceO2Group/Run3AnalysisValidation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils_plot.h
More file actions
45 lines (41 loc) · 1.3 KB
/
utils_plot.h
File metadata and controls
45 lines (41 loc) · 1.3 KB
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
// Plotting utilities
void SetCanvas(TCanvas* can, int nPadsX, int nPadsY)
{
can->Divide(nPadsX, nPadsY, 0.005, 0.005);
}
void SetPad(TVirtualPad* pad, bool logScale)
{
pad->SetBottomMargin(0.11);
pad->SetLeftMargin(0.1);
pad->SetTopMargin(0.08);
pad->SetRightMargin(0.08);
if (logScale) {
pad->SetLogy();
}
}
void SetHistogram(TH1* his, Float_t yMin, Float_t yMax, Float_t marginLow, Float_t marginHigh, bool& logScale)
{
Float_t textsize = 0.05;
his->GetYaxis()->SetTitleSize(textsize);
his->GetXaxis()->SetTitleSize(textsize);
his->GetYaxis()->SetTitleOffset(1.0);
his->GetXaxis()->SetTitleOffset(1.0);
Float_t k = 1. - marginHigh - marginLow;
Float_t yRange;
if (logScale && yMin > 0 && yMax > 0) {
yRange = yMax / yMin;
his->GetYaxis()->SetRangeUser(yMin / std::pow(yRange, marginLow / k), yMax * std::pow(yRange, marginHigh / k));
} else {
logScale = false;
yRange = yMax - yMin;
his->GetYaxis()->SetRangeUser(yMin - marginLow / k * yRange, yMax + marginHigh / k * yRange);
}
}
void SetHistogramStyle(TH1* his, Int_t colour = 1, Int_t markerStyle = 1, Float_t markerSize = 1, Float_t lineWidth = 1)
{
his->SetLineColor(colour);
his->SetLineWidth(lineWidth);
his->SetMarkerColor(colour);
his->SetMarkerStyle(markerStyle);
his->SetMarkerSize(markerSize);
}