-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheventnumbers
More file actions
executable file
·44 lines (33 loc) · 1.45 KB
/
eventnumbers
File metadata and controls
executable file
·44 lines (33 loc) · 1.45 KB
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
#!/usr/bin/env python
# get event numbers of embedding in the top 10 bins
from mva.cmd import get_parser
args = get_parser(actions=False).parse_args()
from mva.analysis import get_analysis
from mva.samples import Higgs
from rootpy.plotting import Hist
analysis = get_analysis(args)
target_region = args.target_region
ztt = analysis.ztautau
for category in analysis.iter_categories(
args.categories, args.controls, names=args.category_names):
if category.analysis_control:
continue
outfile = open('embedding_events_{0}.txt'.format(category.name), 'w')
clf = analysis.get_clf(category, load=True)
scores = ztt.scores(clf, category, target_region,
systematics=False)['NOMINAL'][0]
# determine top 10 bins
hist_template = Hist(category.limitbins, -1, 1, type='D')
edges = list(hist_template.xedges())[-11:]
# determine run/event numbers in each bin
table = ztt.merged_records(fields=['RunNumber', 'EventNumber'], category=category, region=target_region)
for ibin in xrange(10):
low, high = edges[ibin:ibin + 2]
outfile.write("BDT Score Range {0} - {1}\n".format(low, high))
scores_in_bin = (low <= scores) & (scores < high)
events_in_bin = table[scores_in_bin]
events_in_bin.sort(order=['RunNumber', 'EventNumber'])
for event in events_in_bin:
outfile.write("{0} {1}\n".format(event[0], event[1]))
outfile.write("\n")
outfile.close()