forked from tklijnsma/differentialCombination2017
-
Notifications
You must be signed in to change notification settings - Fork 2
/
scalecorrelationmatrices.py
160 lines (136 loc) · 6.02 KB
/
scalecorrelationmatrices.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env python
"""
Thomas Klijnsma
"""
########################################
# Imports
########################################
from OptionHandler import flag_as_option, flag_as_parser_options
import differentials
import LatestPaths
import logging
import copy
import re
import random
random.seed(1002)
########################################
# Main
########################################
@flag_as_parser_options
def scalecorrelations_parser_options(parser):
parser.add_argument( '--theorybinning', action='store_true' )
parser.add_argument( '--writefiles', action='store_true' )
@flag_as_option
def top_central_values(args):
top_exp_binning = [ 0., 15., 30., 45., 80., 120., 200., 350., 600., 800. ]
sm = differentials.theory.theory_utils.FileFinder(
ct=1.0, cg=0.0, cb=1.0, muR=1.0, muF=1.0, Q=1.0,
directory=LatestPaths.theory.top.filedir
).get()[0]
print sm.file
xs = differentials.integral.Rebinner(sm.binBoundaries, sm.crosssection, top_exp_binning).rebin()
print xs
print ' '.join(['{0:.2g}'.format(v) for v in xs])
print ' & '.join([
re.sub(
r'e\-\d(\d)',
r'\\times 10^{-\1}',
'{0:.{ndec}{mode}}'.format(v, ndec = 1 if v < 0.1 else 2, mode = 'e' if v < 0.1 else 'f')
)
for v in xs ]) + ' \\\\'
@flag_as_option
def top_scalecorrelations(args):
variations = differentials.theory.theory_utils.FileFinder(
ct=1.0, cg=0.0, cb=1.0,
directory=LatestPaths.theory.top.filedir
).get()
sm = [v for v in variations if v.muR==1.0 and v.muF==1.0 and v.Q==1.0][0]
scalecorrelation = differentials.theory.scalecorrelation.ScaleCorrelation()
top_exp_binning = [ 0., 15., 30., 45., 80., 120., 200., 350., 600., 800. ]
if not sm.binBoundaries[-1] == top_exp_binning[-1]:
raise ValueError('Expected ends of pt binings do not match!')
scalecorrelation.set_bin_boundaries(top_exp_binning)
for variation in variations:
scalecorrelation.add_variation(
differentials.integral.Rebinner(variation.binBoundaries, variation.crosssection, top_exp_binning).rebin(),
{},
is_central=(variation is sm),
)
scalecorrelation.plot_correlation_matrix('tophighpt')
scalecorrelation.write_errors_to_texfile('tophighpt')
if args.writefiles:
scalecorrelation.make_scatter_plots(subdir='scatterplots_tophighpt')
scalecorrelation.write_correlation_matrix_to_file('tophighpt')
scalecorrelation.write_errors_to_file('tophighpt')
if args.theorybinning:
scalecorrelation_theory = differentials.theory.scalecorrelation.ScaleCorrelation()
scalecorrelation_theory.tags.append('theorybinning')
scalecorrelation_theory.set_bin_boundaries(sm.binBoundaries)
for variation in variations:
scalecorrelation_theory.add_variation(
variation.crosssection,
{},
is_central=(variation is sm),
)
scalecorrelation_theory.plot_correlation_matrix('tophighpt')
scalecorrelation_theory.write_errors_to_texfile('tophighpt')
if args.writefiles:
scalecorrelation_theory.make_scatter_plots(subdir='scatterplots_tophighpt_theorybinning')
scalecorrelation_theory.write_correlation_matrix_to_file('tophighpt')
scalecorrelation_theory.write_errors_to_file('tophighpt')
@flag_as_option
def yukawa_central_values(args):
yukawa_exp_binning = [0.0, 15., 30., 45., 80., 120.]
sm = differentials.theory.theory_utils.FileFinder(
kappab=1.0, kappac=1.0, muR=1.0, muF=1.0, Q=1.0,
directory='out/theories_Mar09_yukawa_summed/'
).get()[0]
print sm.file
xs = differentials.integral.Rebinner(sm.binBoundaries, sm.crosssection, yukawa_exp_binning).rebin()
print xs
print ' '.join(['{0:.2g}'.format(v) for v in xs])
print ' & '.join([
re.sub(
r'e\-\d(\d)',
r'\\times 10^{-\1}',
'{0:.{ndec}{mode}}'.format(v, ndec = 1 if v < 0.1 else 2, mode = 'e' if v < 0.1 else 'f')
)
for v in xs ]) + ' \\\\'
@flag_as_option
def yukawa_scalecorrelations(args):
variations = differentials.theory.theory_utils.FileFinder(
kappab=1.0, kappac=1.0,
directory='out/theories_Mar09_yukawa_summed/'
).get()
sm = [v for v in variations if v.muR==1.0 and v.muF==1.0 and v.Q==1.0][0]
scalecorrelation = differentials.theory.scalecorrelation.ScaleCorrelation()
yukawa_exp_binning = [0.0, 15., 30., 45., 80., 120.]
scalecorrelation.set_bin_boundaries(yukawa_exp_binning)
for variation in variations:
scalecorrelation.add_variation(
differentials.integral.Rebinner(variation.binBoundaries, variation.crosssection, yukawa_exp_binning).rebin(),
{},
is_central=(variation is sm),
)
scalecorrelation.plot_correlation_matrix('yukawa')
scalecorrelation.write_errors_to_texfile('yukawa')
if args.writefiles:
scalecorrelation.make_scatter_plots(subdir='scatterplots_yukawa')
scalecorrelation.write_correlation_matrix_to_file('yukawa')
scalecorrelation.write_errors_to_file('yukawa')
if args.theorybinning:
scalecorrelation_theory = differentials.theory.scalecorrelation.ScaleCorrelation()
scalecorrelation_theory.tags.append('theorybinning')
scalecorrelation_theory.set_bin_boundaries(sm.binBoundaries)
for variation in variations:
scalecorrelation_theory.add_variation(
variation.crosssection,
{},
is_central=(variation is sm),
)
scalecorrelation_theory.plot_correlation_matrix('yukawa')
scalecorrelation_theory.write_errors_to_texfile('yukawa')
if args.writefiles:
scalecorrelation_theory.make_scatter_plots(subdir='scatterplots_yukawa_theorybinning')
scalecorrelation_theory.write_correlation_matrix_to_file('yukawa')
scalecorrelation_theory.write_errors_to_file('yukawa')