1 |
dhidas |
1.1 |
#include "TStyle.h"
|
2 |
|
|
from ROOT import TPad, TStyle, kWhite, kTRUE
|
3 |
|
|
|
4 |
|
|
# tdrGrid: Turns the grid lines on (true) or off (false)
|
5 |
|
|
|
6 |
|
|
def tdrGrid(tdrStyle, gridOn):
|
7 |
|
|
tdrStyle.SetPadGridX(gridOn);
|
8 |
|
|
tdrStyle.SetPadGridY(gridOn);
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
# fixOverlay: Redraws the axis
|
12 |
|
|
|
13 |
|
|
def fixOverlay():
|
14 |
|
|
gPad.RedrawAxis();
|
15 |
|
|
|
16 |
|
|
def setTDRStyle():
|
17 |
|
|
tdrStyle = TStyle("tdrStyle","Style for P-TDR");
|
18 |
|
|
|
19 |
|
|
# For the canvas:
|
20 |
|
|
tdrStyle.SetCanvasBorderMode(0);
|
21 |
|
|
tdrStyle.SetCanvasColor(kWhite);
|
22 |
|
|
tdrStyle.SetCanvasDefH(600); #Height of canvas
|
23 |
|
|
tdrStyle.SetCanvasDefW(600); #Width of canvas
|
24 |
|
|
tdrStyle.SetCanvasDefX(0); #POsition on screen
|
25 |
|
|
tdrStyle.SetCanvasDefY(0);
|
26 |
|
|
|
27 |
|
|
# For the Pad:
|
28 |
|
|
tdrStyle.SetPadBorderMode(0);
|
29 |
|
|
# tdrStyle.SetPadBorderSize(Width_t size = 1);
|
30 |
|
|
tdrStyle.SetPadColor(kWhite);
|
31 |
|
|
tdrStyle.SetPadGridX(False);
|
32 |
|
|
tdrStyle.SetPadGridY(False);
|
33 |
|
|
tdrStyle.SetGridColor(0);
|
34 |
|
|
tdrStyle.SetGridStyle(3);
|
35 |
|
|
tdrStyle.SetGridWidth(1);
|
36 |
|
|
|
37 |
|
|
# For the frame:
|
38 |
|
|
tdrStyle.SetFrameBorderMode(0);
|
39 |
|
|
tdrStyle.SetFrameBorderSize(1);
|
40 |
|
|
tdrStyle.SetFrameFillColor(0);
|
41 |
|
|
tdrStyle.SetFrameFillStyle(0);
|
42 |
|
|
tdrStyle.SetFrameLineColor(1);
|
43 |
|
|
tdrStyle.SetFrameLineStyle(1);
|
44 |
|
|
tdrStyle.SetFrameLineWidth(1);
|
45 |
|
|
|
46 |
|
|
# For the histo:
|
47 |
|
|
# tdrStyle.SetHistFillColor(1);
|
48 |
|
|
# tdrStyle.SetHistFillStyle(0);
|
49 |
|
|
tdrStyle.SetHistLineColor(1);
|
50 |
|
|
tdrStyle.SetHistLineStyle(0);
|
51 |
|
|
tdrStyle.SetHistLineWidth(1);
|
52 |
|
|
# tdrStyle.SetLegoInnerR(Float_t rad = 0.5);
|
53 |
|
|
# tdrStyle.SetNumberContours(Int_t number = 20);
|
54 |
|
|
|
55 |
|
|
tdrStyle.SetEndErrorSize(2);
|
56 |
|
|
# tdrStyle.SetErrorMarker(20);
|
57 |
|
|
tdrStyle.SetErrorX(0.);
|
58 |
|
|
|
59 |
|
|
tdrStyle.SetMarkerStyle(20);
|
60 |
|
|
|
61 |
|
|
#For the fit/function:
|
62 |
|
|
tdrStyle.SetOptFit(1);
|
63 |
|
|
tdrStyle.SetFitFormat("5.4g");
|
64 |
|
|
tdrStyle.SetFuncColor(2);
|
65 |
|
|
tdrStyle.SetFuncStyle(1);
|
66 |
|
|
tdrStyle.SetFuncWidth(1);
|
67 |
|
|
|
68 |
|
|
#For the date:
|
69 |
|
|
tdrStyle.SetOptDate(0);
|
70 |
|
|
# tdrStyle.SetDateX(Float_t x = 0.01);
|
71 |
|
|
# tdrStyle.SetDateY(Float_t y = 0.01);
|
72 |
|
|
|
73 |
|
|
# For the statistics box:
|
74 |
|
|
tdrStyle.SetOptFile(0);
|
75 |
|
|
tdrStyle.SetOptStat(0); # To display the mean and RMS: SetOptStat("mr");
|
76 |
|
|
tdrStyle.SetStatColor(kWhite);
|
77 |
|
|
tdrStyle.SetStatFont(42);
|
78 |
|
|
tdrStyle.SetStatFontSize(0.025);
|
79 |
|
|
tdrStyle.SetStatTextColor(1);
|
80 |
|
|
tdrStyle.SetStatFormat("6.4g");
|
81 |
|
|
tdrStyle.SetStatBorderSize(1);
|
82 |
|
|
tdrStyle.SetStatH(0.1);
|
83 |
|
|
tdrStyle.SetStatW(0.15);
|
84 |
|
|
# tdrStyle.SetStatStyle(Style_t style = 1001);
|
85 |
|
|
# tdrStyle.SetStatX(Float_t x = 0);
|
86 |
|
|
# tdrStyle.SetStatY(Float_t y = 0);
|
87 |
|
|
|
88 |
|
|
# Margins:
|
89 |
|
|
tdrStyle.SetPadTopMargin(0.05);
|
90 |
|
|
tdrStyle.SetPadBottomMargin(0.13);
|
91 |
|
|
tdrStyle.SetPadLeftMargin(0.16);
|
92 |
|
|
tdrStyle.SetPadRightMargin(0.02);
|
93 |
|
|
|
94 |
|
|
# For the Global title:
|
95 |
|
|
|
96 |
|
|
tdrStyle.SetOptTitle(0);
|
97 |
|
|
tdrStyle.SetTitleFont(42);
|
98 |
|
|
tdrStyle.SetTitleColor(1);
|
99 |
|
|
tdrStyle.SetTitleTextColor(1);
|
100 |
|
|
tdrStyle.SetTitleFillColor(10);
|
101 |
|
|
tdrStyle.SetTitleFontSize(0.05);
|
102 |
|
|
# tdrStyle.SetTitleH(0); # Set the height of the title box
|
103 |
|
|
# tdrStyle.SetTitleW(0); # Set the width of the title box
|
104 |
|
|
# tdrStyle.SetTitleX(0); # Set the position of the title box
|
105 |
|
|
# tdrStyle.SetTitleY(0.985); # Set the position of the title box
|
106 |
|
|
# tdrStyle.SetTitleStyle(Style_t style = 1001);
|
107 |
|
|
# tdrStyle.SetTitleBorderSize(2);
|
108 |
|
|
|
109 |
|
|
# For the axis titles:
|
110 |
|
|
|
111 |
|
|
tdrStyle.SetTitleColor(1, "XYZ");
|
112 |
|
|
tdrStyle.SetTitleFont(42, "XYZ");
|
113 |
|
|
tdrStyle.SetTitleSize(0.06, "XYZ");
|
114 |
|
|
# tdrStyle.SetTitleXSize(Float_t size = 0.02); # Another way to set the size?
|
115 |
|
|
# tdrStyle.SetTitleYSize(Float_t size = 0.02);
|
116 |
|
|
tdrStyle.SetTitleXOffset(0.9);
|
117 |
|
|
tdrStyle.SetTitleYOffset(1.25);
|
118 |
|
|
# tdrStyle.SetTitleOffset(1.1, "Y"); # Another way to set the Offset
|
119 |
|
|
|
120 |
|
|
# For the axis labels:
|
121 |
|
|
|
122 |
|
|
tdrStyle.SetLabelColor(1, "XYZ");
|
123 |
|
|
tdrStyle.SetLabelFont(42, "XYZ");
|
124 |
|
|
tdrStyle.SetLabelOffset(0.007, "XYZ");
|
125 |
|
|
tdrStyle.SetLabelSize(0.05, "XYZ");
|
126 |
|
|
|
127 |
|
|
# For the axis:
|
128 |
|
|
|
129 |
|
|
tdrStyle.SetAxisColor(1, "XYZ");
|
130 |
|
|
tdrStyle.SetStripDecimals(kTRUE);
|
131 |
|
|
tdrStyle.SetTickLength(0.03, "XYZ");
|
132 |
|
|
tdrStyle.SetNdivisions(510, "XYZ");
|
133 |
|
|
tdrStyle.SetPadTickX(1); # To get tick marks on the opposite side of the frame
|
134 |
|
|
tdrStyle.SetPadTickY(1);
|
135 |
|
|
|
136 |
|
|
# Change for log plots:
|
137 |
|
|
tdrStyle.SetOptLogx(0);
|
138 |
|
|
tdrStyle.SetOptLogy(0);
|
139 |
|
|
tdrStyle.SetOptLogz(0);
|
140 |
|
|
|
141 |
|
|
# Postscript options:
|
142 |
|
|
tdrStyle.SetPaperSize(20.,20.);
|
143 |
|
|
# tdrStyle.SetLineScalePS(Float_t scale = 3);
|
144 |
|
|
# tdrStyle.SetLineStyleString(Int_t i, const char* text);
|
145 |
|
|
# tdrStyle.SetHeaderPS(const char* header);
|
146 |
|
|
# tdrStyle.SetTitlePS(const char* pstitle);
|
147 |
|
|
|
148 |
|
|
# tdrStyle.SetBarOffset(Float_t baroff = 0.5);
|
149 |
|
|
# tdrStyle.SetBarWidth(Float_t barwidth = 0.5);
|
150 |
|
|
# tdrStyle.SetPaintTextFormat(const char* format = "g");
|
151 |
|
|
# tdrStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
|
152 |
|
|
# tdrStyle.SetTimeOffset(Double_t toffset);
|
153 |
|
|
# tdrStyle.SetHistMinimumZero(kTRUE);
|
154 |
|
|
|
155 |
|
|
tdrStyle.cd();
|
156 |
|
|
return tdrStyle
|