forked from sagittaeri/htt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot-pruning
More file actions
executable file
·48 lines (41 loc) · 2.28 KB
/
plot-pruning
File metadata and controls
executable file
·48 lines (41 loc) · 2.28 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
45
46
47
48
#!/usr/bin/env python
import os
import pickle
from rootpy.plotting import Graph, Canvas, Legend, set_style
from rootpy.plotting.utils import draw
import ROOT
ROOT.gROOT.SetBatch()
set_style('ATLAS')
chi2_thresh = [0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 0.96, 0.97, 0.98, 0.99, 1]
def get_sig(path, analysis='mva'):
basepath = 'workspaces/pruning_{0}'.format(analysis)
with open(os.path.join(basepath, path), 'r') as pickle_file:
sig_dict = pickle.load(pickle_file)
return sig_dict['combined']
for analysis in ('mva', 'cuts'):
for mass in range(100, 155, 5):
baseline = get_sig('hh_combination_{0}_fixed/measurement_hh_combination_{0}.pickle'.format(mass))
graph_symm = Graph(len(chi2_thresh), color='red', title='Full Symmetrization',
drawstyle='P', legendstyle='P', markerstyle='o',
markersize=3)
graph_part_symm = graph_symm.Clone(color='blue', title='Partial Symmetrization', markerstyle='o', markersize=2)
graph_nosymm = graph_symm.Clone(color='black', title='No Symmetrization', markerstyle='circle', markersize=1)
for i, thresh in enumerate(chi2_thresh):
thresh_str = '1' if thresh == 1 else '%1.2f' % thresh
sig = get_sig('hh_combination_{1}_chi2_{0}_sym/measurement_hh_combination_{1}.pickle'.format(thresh_str, mass))
graph_symm.SetPoint(i, thresh, (sig - baseline) / sig)
sig = get_sig('hh_combination_{1}_chi2_{0}_part_sym/measurement_hh_combination_{1}.pickle'.format(thresh_str, mass))
graph_part_symm.SetPoint(i, thresh, (sig - baseline) / sig)
sig = get_sig('hh_combination_{1}_chi2_{0}/measurement_hh_combination_{1}.pickle'.format(thresh_str, mass))
graph_nosymm.SetPoint(i, thresh, (sig - baseline) / sig)
c = Canvas()
draw([graph_symm, graph_part_symm, graph_nosymm], pad=c,
xtitle='#chi^{2} threshold',
ytitle='(#sigma^{pruned} - #sigma) / #sigma',
ypadding=(0.45, 0.2),
xpadding=(0.1, 0))
legend = Legend([graph_symm, graph_part_symm, graph_nosymm], pad=c,
leftmargin=0.02,
rightmargin=0.45)
legend.Draw()
c.SaveAs('pruning_{0}_{1}.png'.format(analysis, mass))