Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/CMS_Z0J_13TEV/data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
data_central:
- 1.8444
- 1.7141
- 1.5243
- 1.329
- 1.1897
- 0.99489
- 0.75792
- 0.49533
- 0.26635
- 0.12569
- 0.046018
- 0.0091988
- 0.0011748
- 3.5385e-05
- 37.237
- 36.608
- 34.621
- 32.542
- 30.324
- 28.162
- 25.957
- 24.036
- 22.098
- 20.7
- 18.4
- 15.824
- 13.912
- 12.011
- 10.329
- 8.5419
- 7.0432
- 5.547
- 4.2406
- 3.0556
- 1.9436
- 1.0362
- 0.40703
- 0.14152
- 0.059995
- 0.032086
- 0.018046
- 0.0090947
- 0.0040887
- 0.0019895
- 0.0010353
- 0.0005749
- 8.2356e-05
- 0.81127
- 0.75465
- 0.67379
- 0.59073
- 0.52103
- 0.42299
- 0.32974
- 0.24939
- 0.17329
- 0.10268
- 0.046168
- 0.011162
- 0.0017995
- 6.0169e-05
- 0.090178
- 0.087088
- 0.082663
- 0.07576
- 0.065335
- 0.054814
- 0.046471
- 0.035346
- 0.020531
- 0.0043687
- 0.00010193
- 0.0069927
- 0.0068868
- 0.0061386
- 0.0060243
- 0.0052844
- 0.0051086
- 0.0045253
- 0.004045
- 0.0021176
- 0.00057801
- 2.4683e-05
130 changes: 130 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/CMS_Z0J_13TEV/filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
"""
This file contains the piece of code needed to implement the CMS ZpT measurement
at 13 TeV. Systematic uncertainties are implemented starting from the breakdown
available on HepData. The correlation treatment follows the approach mentioned
in the paper (see the lines immediately before Sect. 6): "The systematic
and statistical uncertainties are obtained using the linear combination method
described in Ref. [77], considering as fully correlated the uncertainties in
the jet energy scale and resolution, the pileup, the background subtraction,
b tagging, and the integrated luminosity. Other uncertainties are considered
as uncorrelated." Note that correlations are kept not only across different
pT(ll) bins, but also across different m(ll) bins. Covariance matrices, albeit
only for covariances across pT(ll) bins, are available on HepData. These are
disregarded, because they do not include any correlations in m(ll). Their
inspection confirms that indeed the aforementioned uncertainties are fully
correlated. The other uncertainties are weakly correlated or anti-correlated.
"""

import yaml, re

def get_tables():
"""
Get the Hepdata tables, given the tables and version specified in metadata
"""
prefix = "rawdata/HEPData-ins2079374"
with open("metadata.yaml", "r") as file:
metadata = yaml.safe_load(file)

version = metadata["hepdata"]["version"]
tables = metadata["implemented_observables"][0]["tables"]
hepdata_tables = []

for table in tables:
hepdata_tables.append(f"{prefix}-v{version}-pT_ll_mass_{table}.yaml")

return hepdata_tables

def get_all():
"""
Returns data, kinematics and uncertainties for dumping in the .yaml files
"""
data_central = []
kinematics = []
uncertainties = []

hepdata_tables = get_tables()
for table in hepdata_tables:
if (table=="rawdata/HEPData-ins2079374-v1-pT_ll_mass_76-106.yaml"):
n = 4
else:
n=2
with open(table, 'r') as f:
input = yaml.safe_load(f)
ranges = list(map(int, re.search(r"mass_(\d+)-(\d+)", table).groups()))

min_mll = ranges[0]
mid_mll = 0.5 * (ranges[0] + ranges[1])
max_mll = ranges[1]

# Central values
data_values = input["dependent_variables"][0]["values"]
for data_value in data_values[n:]:
data_central.append(data_value["value"])

# Kinematic bins
kin_values = input["independent_variables"][0]["values"]
for kin_value in kin_values[n:]:
kin = {
'pT': {'min': kin_value['low'],
'mid': 0.5 * (kin_value['low'] + kin_value['high']),
'max': kin_value['high']},
'm_ll': {'min': min_mll, 'mid': mid_mll, 'max': max_mll},}
kinematics.append(kin)
# Uncertainties
for data_value in data_values[n:]:
errors = data_value["errors"]
uncertainty = {}
for error in errors:
uncertainty[error["label"]] = error["symerror"]
uncertainty.update(uncertainty)

uncertainties.append(uncertainty)

return (data_central, kinematics, uncertainties)

def filter_CMS_Z0J_13TEV_PT():
"""
Dumps data, kinematics, and uncertainties on .yaml files
"""
central_values, kinematics, uncertainties = get_all()
# Central values
data_central_yaml = {"data_central": central_values}
# Kinematics
kinematics_yaml = {"bins": kinematics}
# Uncertainties
treatment = {"Data stat.": "ADD",
"Unfolding stat.": "ADD",
"Unfolding model": "ADD",
"Int. luminosity": "MULT",
"Lepton energy": "ADD",
"Efficiency": "ADD",
"Backgrounds": "MULT",
"Jet energy": "MULT",
"Others": "MULT"}
correlation = {"Data stat.": "UNCORR",
"Unfolding stat.": "UNCORR",
"Unfolding model": "UNCORR",
"Int. luminosity": "CMSLUMI16",
"Lepton energy": "UNCORR",
"Efficiency": "UNCORR",
"Backgrounds": "CORR",
"Jet energy": "CORR",
"Others": "CORR"}
definitions = {}
for key,value in uncertainties[0].items():
definition = {key :
{"description": key + " unc. from HepData",
"treatment": treatment[key],
"type": correlation[key]}}
definitions.update(definition)
uncertainties_yaml = {"definitions": definitions,"bins": uncertainties}

with open("data.yaml", "w") as file:
yaml.dump(data_central_yaml, file, sort_keys=False)
with open("kinematics.yaml", "w") as file:
yaml.dump(kinematics_yaml, file, sort_keys=False)
with open("uncertainties.yaml", "w") as file:
yaml.dump(uncertainties_yaml, file, sort_keys=False)

if __name__ == "__main__":
filter_CMS_Z0J_13TEV_PT()
Loading
Loading