Skip to content

Commit 2f06831

Browse files
committed
Updated LHC ZpT data 13 TeV. CMS: removed useless small pT bins; updated metadata information. ATLAS: implemented the correct electron-muon data set
1 parent fa407ba commit 2f06831

File tree

16 files changed

+719
-3173
lines changed

16 files changed

+719
-3173
lines changed

nnpdf_data/nnpdf_data/commondata/ATLAS_Z0J_13TEV_PT/data.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
data_central:
2+
- 0.0473835
3+
- 0.0405684
24
- 0.0343165
35
- 0.0291566
46
- 0.0248037
@@ -37,3 +39,4 @@ data_central:
3739
- 5.5219e-07
3840
- 2.01646e-07
3941
- 5.11526e-08
42+
- 2.51767e-06
Lines changed: 78 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,94 @@
11
"""
2-
2+
This file contains the piece of code needed to implement the ATLAS ZpT
3+
measurement at 13 TeV. We consider the combined electron-muon measurement, for
4+
which a total uncorrelated and a total correlated ucnertainties are given. The
5+
measurement is normalised to the fiducial cross section, therefore there is no
6+
luminosity ucnertainty. The first three bins in pT are cropped, because of
7+
the impossiblity of producing theoretical predictions.
38
"""
49

5-
from filter_utils import get_data_values, get_kinematics, get_systematics
610
import yaml
711

8-
UNCORRELATED_SYS = ["Stat (Data)", "Stat (MC)", "Efficiencies (Uncorellated)"]
9-
10-
11-
def filter_ATLAS_Z_13TEV_PT_data_kinetic():
12+
def get_tables():
1213
"""
13-
writes data central values and kinematics
14-
to respective .yaml file
14+
Get the Hepdata table
1515
"""
16-
with open("metadata.yaml", "r") as file:
17-
metadata = yaml.safe_load(file)
18-
19-
version = metadata["hepdata"]["version"]
20-
21-
# tables for Z->l+l- observable
22-
tables = metadata["implemented_observables"][0]["tables"]
16+
hepdata_tables = ["rawdata/HEPData-ins1768911-v3-Table_4a.yaml"]
2317

24-
kin = get_kinematics(tables, version)
25-
central_values = get_data_values(tables, version)
18+
return hepdata_tables
2619

20+
def get_all():
21+
"""
22+
Returns data, kinematics and uncertainties for dumping in the .yaml files
23+
"""
24+
data_central = []
25+
kinematics = []
26+
uncertainties = []
27+
28+
hepdata_tables = get_tables()
29+
for table in hepdata_tables:
30+
with open(table, 'r') as f:
31+
input = yaml.safe_load(f)
32+
33+
# Central values
34+
data_values = input["dependent_variables"][0]["values"]
35+
for data_value in data_values:
36+
data_central.append(data_value["value"])
37+
# Kinematic bins
38+
kin_values = input["independent_variables"][0]["values"]
39+
for kin_value in kin_values:
40+
kin = {
41+
'pT': {'min': kin_value['low'],
42+
'mid': 0.5 * (kin_value['low'] + kin_value['high']),
43+
'max': kin_value['high']},
44+
'm_Z2': {'min': 'null', 'mid': '8317.44', 'max': 'null'},
45+
'sqrts': {'min': 'null', 'mid': '13000', 'max': 'null'}}
46+
47+
kinematics.append(kin)
48+
# Uncertainties
49+
i = 0
50+
for data_value in data_values:
51+
errors = data_value["errors"]
52+
uncertainty = {}
53+
for error in errors:
54+
uncertainty[error["label"]] = float(error["symerror"].replace('%',''))*data_central[i]/100.
55+
uncertainty.update(uncertainty)
56+
57+
uncertainties.append(uncertainty)
58+
i = i+1
59+
60+
n=3
61+
return (data_central[n:], kinematics[n:], uncertainties[n:])
62+
63+
def filter_ATLAS_Z0J_13TEV_PT():
64+
"""
65+
Dumps data, kinematics, and uncertainties on .yaml files
66+
"""
67+
central_values, kinematics, uncertainties = get_all()
68+
# Central values
2769
data_central_yaml = {"data_central": central_values}
28-
kinematics_yaml = {"bins": kin}
70+
# Kinematics
71+
kinematics_yaml = {"bins": kinematics}
72+
# Uncertainties
73+
treatment = {"correlated uncertainty": "ADD",
74+
"uncorrelated uncertainty": "ADD",}
75+
correlation = {"correlated uncertainty": "CORR",
76+
"uncorrelated uncertainty": "UNCORR",}
77+
definitions = {}
78+
for key,value in uncertainties[0].items():
79+
definition = {key :
80+
{"description": key,
81+
"treatment": treatment[key],
82+
"type": correlation[key]}}
83+
definitions.update(definition)
84+
uncertainties_yaml = {"definitions": definitions,"bins": uncertainties}
2985

30-
# write central values and kinematics to yaml file
3186
with open("data.yaml", "w") as file:
3287
yaml.dump(data_central_yaml, file, sort_keys=False)
33-
3488
with open("kinematics.yaml", "w") as file:
3589
yaml.dump(kinematics_yaml, file, sort_keys=False)
36-
37-
38-
def filter_ATLAS_Z_13TEV_PT_uncertainties():
39-
"""
40-
writes uncertainties to respective .yaml file
41-
"""
42-
43-
with open("metadata.yaml", "r") as file:
44-
metadata = yaml.safe_load(file)
45-
46-
version = metadata["hepdata"]["version"]
47-
# tables for Z->l+l- observable
48-
tables = metadata["implemented_observables"][0]["tables"]
49-
50-
systematics_LL = get_systematics(tables, version)
51-
52-
systematics = {"LL": systematics_LL}
53-
54-
# error definition
55-
error_definitions = {}
56-
errors = {}
57-
58-
for obs in ["LL"]:
59-
60-
error_definitions[obs] = {}
61-
62-
for sys in systematics[obs]:
63-
64-
if sys[0]['name'] in UNCORRELATED_SYS:
65-
error_definitions[obs][sys[0]['name']] = {
66-
"description": f"{sys[0]['name']} from HEPDATA",
67-
"treatment": "ADD",
68-
"type": "UNCORR",
69-
}
70-
71-
else:
72-
error_definitions[obs][sys[0]['name']] = {
73-
"description": f"{sys[0]['name']} from HEPDATA",
74-
"treatment": "ADD",
75-
"type": "CORR",
76-
}
77-
78-
# TODO:
79-
# store error in dict
80-
errors[obs] = []
81-
82-
central_values = get_data_values(tables, version)
83-
84-
for i in range(len(central_values)):
85-
error_value = {}
86-
87-
for sys in systematics[obs]:
88-
error_value[sys[0]['name']] = float(sys[0]['values'][i])
89-
90-
errors[obs].append(error_value)
91-
92-
uncertainties_yaml = {"definitions": error_definitions[obs], "bins": errors[obs]}
93-
94-
# write uncertainties
95-
with open(f"uncertainties.yaml", 'w') as file:
96-
yaml.dump(uncertainties_yaml, file, sort_keys=False)
97-
98-
90+
with open("uncertainties.yaml", "w") as file:
91+
yaml.dump(uncertainties_yaml, file, sort_keys=False)
92+
9993
if __name__ == "__main__":
100-
filter_ATLAS_Z_13TEV_PT_data_kinetic()
101-
filter_ATLAS_Z_13TEV_PT_uncertainties()
94+
filter_ATLAS_Z0J_13TEV_PT()

nnpdf_data/nnpdf_data/commondata/ATLAS_Z0J_13TEV_PT/filter_utils.py

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)