forked from sagittaeri/htt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnorm
More file actions
executable file
·65 lines (53 loc) · 1.68 KB
/
norm
File metadata and controls
executable file
·65 lines (53 loc) · 1.68 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python
from mva.cmd import get_parser
args = get_parser(actions=False).parse_args()
from mva.analysis import get_analysis
analysis = get_analysis(args)
from rootpy.plotting import Hist
from rootpy.stats import histfactory
from mva.plotting import draw_channel
from mva.categories import Category_Rest, Category_Preselection
from mva import norm_cache as cache
from mva.variables import VARIABLES
from mva import CONST_PARAMS
# reference category for initial normalization
#category = Category_Rest
category = Category_Preselection
# distribution to fit
field = 'dEta_tau1_tau2'
if args.year == 2011:
template = Hist(4, 0, 2)
else:
template = Hist(5, 0, 2)
qcd_scale, qcd_scale_error, \
ztt_scale, ztt_scale_error = analysis.fit_norms(
field, template, category, args.target_region)
# update the cache
cache.set_scales(
args.year,
category.name,
args.embedding,
field,
args.fakes_region,
qcd_scale=qcd_scale,
qcd_scale_error=qcd_scale_error,
qcd_data_scale=1.,
qcd_z_scale=1.,
qcd_others_scale=1.,
z_scale=ztt_scale,
z_scale_error=ztt_scale_error)
# draw post-fit plots
analysis.normalize(category)
channels = analysis.make_var_channels(
template, field, [category],
args.target_region,
include_signal=False)
draw_channel(channels[0], name=VARIABLES[field]['root'],
category=category,
output_name='{0}_postfit{1}'.format(field, analysis.get_suffix()),
output_dir='plots/normalization',
show_pvalue=True,
top_label="Fakes Model: {0}".format(analysis.fakes_region),
plot_label='After {0} fit'.format(VARIABLES[field]['root']),
data_info=analysis.data.info,
output_formats=('eps', 'png'))