-
Notifications
You must be signed in to change notification settings - Fork 1
/
ratio_plot.py
executable file
·60 lines (50 loc) · 1.36 KB
/
ratio_plot.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
#!/usr/bin/env python3
'''
Run this file with
python3 examples/ratio_plot.py
This script creates a plot with multi-dim formatting and a ratio subplot.
'''
import plot
import histograms
def ratio_plot():
hists = histograms.hists_mV_unfolding
hists_shape = (2, 2)
### Ratios ###
ratios = []
for i in range(0, len(hists), 2):
r = hists[i + 1].Clone()
r.Divide(hists[i])
ratios.append(r)
### Format and legend ###
plot.format(hists, hists_shape)
legend_hists = plot.reduced_legend_hists(hists_shape)
legend = [
(legend_hists[0], 'Diboson', 'L'),
(legend_hists[1], 'EFT c_{W}^{2}', 'L'),
(legend_hists[2], 'Fiducial', 'L'),
(legend_hists[3], 'Fid #cap Reco', 'L'),
]
### Plot ###
plot.plot_ratio(hists, ratios,
filename='ratio_plot',
### Text ###
title='ATLAS Dummy',
subtitle='#sqrt{s}=13 TeV, 139 fb^{-1}',
legend=legend,
ytitle='Events',
ytitle2='Efficiency',
xtitle='p_{T}(V) [GeV]',
### Style ###
height1=0.6,
logy=True,
opts='HIST',
markersize=0,
markersize2=0,
linecolor2=plot.colors.tableu,
### Range ###
x_range=[0, 2500],
y_range2=[0, 0.5],
)
if __name__ == "__main__":
plot.save_transparent = False
ratio_plot()