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