-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint-limits
More file actions
executable file
·26 lines (24 loc) · 1016 Bytes
/
print-limits
File metadata and controls
executable file
·26 lines (24 loc) · 1016 Bytes
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
#!/usr/bin/env python
import sys
import os
from rootpy.io import root_open as ropen
with ropen(sys.argv[1]) as f:
for path, dirs, objects in f.walk(class_pattern="TH1*"):
print r"\begin{tabular}{l|c}"
for hist_name in sorted(objects):
if not hist_name.endswith('limit'):
continue
hist = f.Get(os.path.join(path, hist_name))
print r"{\bf %s} & " % hist.name.replace(
'_', ' ').replace('workspace', '').replace(
'category',
'').replace('limit', '').upper(),
hist_dict = {}
for i, limit in enumerate(hist):
hist_dict[hist.xaxis.GetBinLabel(i + 1)] = limit
print '$%.2f^{+%.2f}_{-%.2f}$\\\\' % (
hist_dict['Expected'],
abs(hist_dict['+1sigma'] - hist_dict['Expected']),
abs(hist_dict['-1sigma'] - hist_dict['Expected']))
print
print r"\end{tabular}"