-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmass_hists.py
67 lines (53 loc) · 2.25 KB
/
mass_hists.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
import numpy as np
import matplotlib.pyplot as plt
def draw(nameAndLists, limits, fname):
fig = plt.figure()
ax = fig.add_subplot(111)
for name, li in nameAndLists:
if '30' in name:
if 'Untrim' in name:
cc = 'b00000'
else:
cc = 'ff7272'
else:
if 'Untrim' in name:
cc = '0000b0'
else:
cc = '7272ff'
cc = '#'+cc
hh, edges = np.histogram(li, limits[0], limits[1:3])
xs = (edges[0:-1] + edges[1:])/2.0
#ax.plot(xs, hh, 'o', label=name)
ax.errorbar(xs, hh, yerr=np.sqrt(hh), markeredgecolor=cc,markerfacecolor=cc,ecolor=cc, fmt='o', label=name)
ax.set_xlabel("Jet Mass (GeV)")
ax.set_ylabel("#Entries per %.1f GeV" % ((limits[2] - limits[1]+0.0)/limits[0]))
ax.set_ylim(0, 1.2*ax.get_ylim()[1])
plt.legend()
plt.savefig(fname)
#plt.show()
if __name__ == '__main__':
inpath='/u/eb/joshgc/mynfs/CSJets/'
nameAndLocations = [('Trimmed t mu=0' , 't_0_mass_trim_1.mass' ),
('Trimmed t mu=30' , 't_30_mass_trim_1.mass'),
('Untrimmed t mu=0' , 't_0_mass_trim_0.mass'),
('Untrimmed t mu=30', 't_30_mass_trim_0.mass'),
]
outname = 't_trimming.png'
limits = (40,50,250)
#nameAndLocations = [('Trimmed W mu=0' , 'w_0_mass_trim_1.mass' ),
# ('Trimmed W mu=30' , 'w_30_mass_trim_1.mass'),
# ('Untrimmed W mu=0' , 'w_0_mass_trim_0.mass'),
# ('Untrimmed W mu=30', 'w_30_mass_trim_0.mass'),
# ]
#outname = 'w_trimming.png'
#limits = (50, 0, 150)
nameAndLocations = [('Trimmed g mu=0' , 'g_0_mass_trim_1.mass' ),
('Trimmed g mu=30' , 'g_30_mass_trim_1.mass'),
('Untrimmed g mu=0' , 'g_0_mass_trim_0.mass'),
('Untrimmed g mu=30', 'g_30_mass_trim_0.mass'),
]
outname = 'g_trimming.png'
limits = (50, 0, 150)
nameAndLists = [(name, list(float(xx) for xx in open(inpath+loc)))
for name,loc in nameAndLocations]
draw(nameAndLists, limits,outname)