Skip to content

Commit 08ec8e2

Browse files
committed
change the description of MC uncertainty
1 parent d09c9bc commit 08ec8e2

4 files changed

Lines changed: 53 additions & 30 deletions

File tree

nnpdf_data/nnpdf_data/commondata/ATLAS_Z0J_8TEV/filter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22

3+
from filter_decorr_unc import filter_unc_ATLAS_Z0J_8TEV
34
from filter_utils import Extractor
45
import numpy as np
56
import yaml
@@ -75,6 +76,9 @@ def check_dat_with_legacy(observable, rtol=1e-03):
7576
ATLAS_Z0J_8TEV_PT_M.generate_uncertainties('./rawdata/hepdata/unnormalized/output')
7677
ATLAS_Z0J_8TEV_PT_M.generate_uncertainties('./rawdata/hepdata/unnormalized/output', True)
7778

79+
filter_unc_ATLAS_Z0J_8TEV(MC=False)
80+
filter_unc_ATLAS_Z0J_8TEV(MC=True)
81+
7882
# Comparing new anf legacy uncertainties
7983
# Deprecated
8084
if CHECK:

nnpdf_data/nnpdf_data/commondata/ATLAS_Z0J_8TEV/filter_decorr_unc.py

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""
2-
This piece of code generates a simplified variant of the uncertainties.yaml
3-
files in which the 99 correlated systematic uncertainties of the legacy
2+
This piece of code generates a simplified variant of the uncertainties.yaml
3+
files in which the 99 correlated systematic uncertainties of the legacy
44
version are replaced with two systematic uncertainties, one that is uncorrelated
55
and that is correlated. Statistical, luminosity and )optional) Monte Carlo
66
uncertainties are as in the legacy version.
77
"""
88

99
import yaml
1010

11+
1112
def get_tables(observable):
1213
"""
1314
get the Hepdata tables, given the tables and version specified in metadata
@@ -26,14 +27,15 @@ def get_tables(observable):
2627
print("- ATLAS_Z0J_8TEV_PT-Y")
2728
print("- ATLAS_Z0J_8TEV_PT-M")
2829
exit()
29-
30+
3031
hepdata_tables = []
3132

3233
for table in tables:
3334
hepdata_tables.append(f"{prefix}{table}.yaml")
3435

3536
return hepdata_tables
3637

38+
3739
def get_uncertainties(observable):
3840
"""
3941
Returns uncertainties for dumping in the -yaml file
@@ -62,51 +64,68 @@ def get_uncertainties(observable):
6264

6365
return (data_central, uncertainties)
6466

67+
6568
def filter_unc_ATLAS_Z0J_8TEV(MC=False):
6669
"""
6770
Dumps uncertainties on .yaml files
6871
"""
69-
lumi_unc = 2.8 # %
70-
mc_unc = 1.0 # %
72+
lumi_unc = 2.8 # %
73+
mc_unc = 1.0 # %
7174
observables = ["PT-Y", "PT-M"]
7275
for observable in observables:
73-
if MC==False:
76+
if MC == False:
7477
unc_file = "uncertainties_decorr_" + observable + ".yaml"
7578
else:
76-
unc_file= "uncertainties_decorr_sys_10_" + observable + ".yaml"
79+
unc_file = "uncertainties_decorr_sys_10_" + observable + ".yaml"
7780
central_values, uncertainties = get_uncertainties(observable)
7881

7982
for i in range(len(central_values)):
8083
for k in uncertainties[i]:
81-
uncertainties[i][k] = float(uncertainties[i][k].replace("%",""))/100. * central_values[i] * 1000.
82-
uncertainties[i].update({"sys_lumi_corr": lumi_unc/100 * central_values[i] * 1000.})
83-
if(MC==True):
84-
uncertainties[i].update({"sys_mc_uncorr": mc_unc/100 * central_values[i] * 1000.})
85-
86-
treatment = {"stat": "ADD",
87-
"sys,Uncorrelated": "ADD",
88-
"sys,Correlated": "MULT",
89-
"sys_lumi_corr": "MULT",}
90-
correlation = {"stat": "UNCORR",
91-
"sys,Uncorrelated": "UNCORR",
92-
"sys,Correlated": "CORR",
93-
"sys_lumi_corr": "ATLASLUMI12",}
84+
uncertainties[i][k] = (
85+
float(uncertainties[i][k].replace("%", "")) / 100.0 * central_values[i] * 1000.0
86+
)
87+
uncertainties[i].update({"sys_lumi_corr": lumi_unc / 100 * central_values[i] * 1000.0})
88+
if MC == True:
89+
uncertainties[i].update(
90+
{"sys_mc_uncorr": mc_unc / 100 * central_values[i] * 1000.0}
91+
)
92+
93+
treatment = {
94+
"stat": "ADD",
95+
"sys,Uncorrelated": "ADD",
96+
"sys,Correlated": "MULT",
97+
"sys_lumi_corr": "MULT",
98+
}
99+
correlation = {
100+
"stat": "UNCORR",
101+
"sys,Uncorrelated": "UNCORR",
102+
"sys,Correlated": "CORR",
103+
"sys_lumi_corr": "ATLASLUMI12",
104+
}
94105
if MC == True:
95106
treatment.update({"sys_mc_uncorr": "ADD"})
96107
correlation.update({"sys_mc_uncorr": "UNCORR"})
97108

98109
definitions = {}
99-
for key,value in uncertainties[0].items():
100-
definition = {key :
101-
{"description": key + " unc. from HepData",
102-
"treatment": treatment[key],
103-
"type": correlation[key]}}
110+
for key, value in uncertainties[0].items():
111+
definition = {
112+
key: {
113+
"description": key + " unc. from HepData",
114+
"treatment": treatment[key],
115+
"type": correlation[key],
116+
}
117+
}
104118
definitions.update(definition)
105-
uncertainties_yaml = {"definitions": definitions,"bins": uncertainties}
106-
119+
uncertainties_yaml = {"definitions": definitions, "bins": uncertainties}
120+
121+
if MC:
122+
uncertainties_yaml["definitions"][key][
123+
"description"
124+
] = "extra Monte Carlo statistical uncertainty"
125+
107126
with open(unc_file, "w") as file:
108127
yaml.dump(uncertainties_yaml, file, sort_keys=False)
109-
128+
110129

111130
if __name__ == "__main__":
112131
filter_unc_ATLAS_Z0J_8TEV(MC=False)

nnpdf_data/nnpdf_data/commondata/ATLAS_Z0J_8TEV/uncertainties_decorr_sys_10_PT-M.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ definitions:
1616
treatment: MULT
1717
type: ATLASLUMI12
1818
sys_mc_uncorr:
19-
description: sys_mc_uncorr unc. from HepData
19+
description: extra Monte Carlo statistical uncertainty
2020
treatment: ADD
2121
type: UNCORR
2222
bins:

nnpdf_data/nnpdf_data/commondata/ATLAS_Z0J_8TEV/uncertainties_decorr_sys_10_PT-Y.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ definitions:
1616
treatment: MULT
1717
type: ATLASLUMI12
1818
sys_mc_uncorr:
19-
description: sys_mc_uncorr unc. from HepData
19+
description: extra Monte Carlo statistical uncertainty
2020
treatment: ADD
2121
type: UNCORR
2222
bins:

0 commit comments

Comments
 (0)