forked from steggema/cms-das-tau
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cms_style.py
110 lines (92 loc) · 2.77 KB
/
cms_style.py
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from ROOT import kBlack, TPaveText
def cms_style(style):
'''Applies CMS standard plot style settings to 'style'
style: a ROOT TStyle object, e.g. the default ROOT.gStyle
'''
style.SetCanvasColor(0)
style.SetCanvasBorderSize(10)
style.SetCanvasBorderMode(0)
style.SetCanvasDefH(700)
style.SetCanvasDefW(700)
style.SetCanvasDefX(100)
style.SetCanvasDefY(100)
# color palette for 2D temperature plots
# style.SetPalette(1)
# Pads
style.SetPadColor(0)
style.SetPadBorderSize(10)
style.SetPadBorderMode(0)
style.SetPadBottomMargin(0.16)
style.SetPadTopMargin(0.08)
style.SetPadLeftMargin(0.15)
style.SetPadRightMargin(0.05)
style.SetPadGridX(1)
style.SetPadGridY(1)
style.SetPadTickX(1)
style.SetPadTickY(1)
# Frames
style.SetLineWidth(3)
style.SetFrameFillStyle(0)
style.SetFrameFillColor(0)
style.SetFrameLineColor(1)
style.SetFrameLineStyle(0)
style.SetFrameLineWidth(2)
style.SetFrameBorderSize(10)
style.SetFrameBorderMode(0)
# Histograms
style.SetHistFillColor(2)
style.SetHistFillStyle(0)
style.SetHistLineColor(1)
style.SetHistLineStyle(0)
style.SetHistLineWidth(3)
style.SetNdivisions(505)
# Functions
style.SetFuncColor(1)
style.SetFuncStyle(0)
style.SetFuncWidth(2)
# Various
style.SetMarkerStyle(20)
style.SetMarkerColor(kBlack)
style.SetMarkerSize(1.4)
style.SetTitleBorderSize(0)
style.SetTitleFillColor(0)
style.SetTitleX(0.3)
style.SetTitleSize(0.055, "X")
style.SetTitleOffset(1.200, "X")
style.SetLabelOffset(0.005, "X")
style.SetLabelSize(0.050, "X")
style.SetLabelFont(42, "X")
style.SetStripDecimals(False)
style.SetLineStyleString(11, "20 10")
style.SetTitleSize(0.055, "Y")
style.SetTitleOffset(1.100, "Y")
style.SetLabelOffset(0.010, "Y")
style.SetLabelSize(0.050, "Y")
style.SetLabelFont(42, "Y")
style.SetTextSize(0.055)
style.SetTextFont(42)
style.SetStatFont(42)
style.SetTitleFont(42)
style.SetTitleFont(42, "X")
style.SetTitleFont(42, "Y")
style.SetOptStat(0)
def cms_prelim(dataset, channel, lowX, lowY):
'''Decorates plot with passed information
'''
cmsprel = TPaveText(lowX, lowY+0.06, lowX+0.30, lowY+0.16, "NDC")
cmsprel.SetBorderSize(0)
cmsprel.SetFillStyle(0)
cmsprel.SetTextAlign(12)
cmsprel.SetTextSize(0.04)
cmsprel.SetTextColor(1)
cmsprel.SetTextFont(62)
cmsprel.AddText(dataset)
chan = TPaveText(lowX+0.68, lowY+0.061, lowX+0.80, lowY+0.161, "NDC")
chan.SetBorderSize(0)
chan.SetFillStyle(0)
chan.SetTextAlign(12)
chan.SetTextSize(0.05)
chan.SetTextColor(1)
chan.SetTextFont(62)
chan.AddText(channel)
return cmsprel, chan