Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f205bfe
First commit;
ecole41 Jun 20, 2025
bf1e7d8
data central
ecole41 Jun 23, 2025
68e203d
Added kinematics
ecole41 Jun 25, 2025
d1adbcc
Started uncertainties
ecole41 Jun 25, 2025
43cf998
Artificial uncertainties
ecole41 Jul 9, 2025
d8e6aec
fixes with utila nad metadata
ecole41 Jul 9, 2025
8ef8942
symmetrise errors
ecole41 Jul 10, 2025
0580b11
symmetrise errors
ecole41 Jul 10, 2025
15e98dd
Systematics
ecole41 Jul 10, 2025
dbef8c6
Fixed asymm errors
ecole41 Aug 4, 2025
3f24200
Separated into separate observables
ecole41 Aug 12, 2025
6bde456
Added kinematics labels to metadata
ecole41 Aug 22, 2025
cc395a8
Replaced Hepdata tables and updated metadata.yaml with optimal set of…
enocera Aug 27, 2025
421a5bb
Streamlined data and kinematic file generation
enocera Aug 27, 2025
6019a3a
Deleted redundant files: corrected Hepdata tables; restructured and s…
enocera Aug 27, 2025
109f27a
Corrected metadata syntax
enocera Aug 27, 2025
202b0e2
Corrected number of points
enocera Aug 27, 2025
2330693
First commit;
ecole41 Jun 20, 2025
52ebd23
data central
ecole41 Jun 23, 2025
7f15390
Added kinematics
ecole41 Jun 25, 2025
883bca9
Started uncertainties
ecole41 Jun 25, 2025
eb117c5
Artificial uncertainties
ecole41 Jul 9, 2025
64aba29
fixes with utila nad metadata
ecole41 Jul 9, 2025
5d820f2
symmetrise errors
ecole41 Jul 10, 2025
77b5b84
symmetrise errors
ecole41 Jul 10, 2025
665b6af
Systematics
ecole41 Jul 10, 2025
5430028
Fixed asymm errors
ecole41 Aug 4, 2025
21ff988
Separated into separate observables
ecole41 Aug 12, 2025
70f0be3
Added kinematics labels to metadata
ecole41 Aug 22, 2025
f6e22dd
Replaced Hepdata tables and updated metadata.yaml with optimal set of…
enocera Aug 27, 2025
f40ed74
Streamlined data and kinematic file generation
enocera Aug 27, 2025
2c870b6
Deleted redundant files: corrected Hepdata tables; restructured and s…
enocera Aug 27, 2025
0522fa7
Corrected metadata syntax
enocera Aug 27, 2025
9665cd0
Corrected number of points
enocera Aug 27, 2025
de68a7d
filter cleanup
enocera Aug 28, 2025
18eda5c
Cleanup filter
enocera Aug 28, 2025
3d6dce2
Corrected wrong luminosity label
enocera Oct 27, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
data_central:
- 12.27
- 11.57
- 10.41
- 9.09
- 6.85
- 11.87
- 11.55
- 10.09
- 8.6
- 6.25
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
data_central:
- 12.18
- 11.77
- 10.61
- 8.85
- 7.22
- 12.52
- 12.14
- 10.29
- 8.38
- 6.55
162 changes: 162 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/ATLAS_WCHARM_13TEV/filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
"""
This file contains the piece of code needed to implement the ATLAS W+charm
measurement at 13 TeV. The absolute distributions differential in the
pseudorapidity of the lepton are considered. Two datasets, corresponding to the
decay of a W^+- boson into a D or a Dstar meson, are implemented. The two
channels are largely independent. Correlations are implemented from the full
covariance matrix (Table 12 in the paper, Tables 16 and 18 on HepData),
after subtraction of the fully correlated luminosity covariance matrix.

"""

import yaml
import numpy as np
from nnpdf_data.filter_utils.utils import covmat_to_artunc

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

version = metadata["hepdata"]["version"]

if observable == "WMWP-D":
tables = metadata["implemented_observables"][0]["tables"]
elif observable == "WMWP-Dstar":
tables = metadata["implemented_observables"][1]["tables"]
else:
print("Observable not implemented.")
print("Choose one of the following observables:")
print("- WMWP-D")
print("- WMWP-Dstar")

hepdata_tables = []

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

return hepdata_tables

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

hepdata_tables = get_tables(observable)
data_tables = hepdata_tables[:-1]
for table in data_tables:
with open(table, 'r') as f:
input = yaml.safe_load(f)
# Central values
data_values = input["dependent_variables"][0]["values"]
for data_value in data_values:
data_central.append(data_value["value"])
# Kinematic bins
kin_values = input["independent_variables"][0]["values"]
for kin_value in kin_values:
kin = {
'abs_eta': {'min': kin_value['low'],
'mid': 0.5 * (kin_value['low'] + kin_value['high']),
'max': kin_value['high']},
'm_W2': {'min': None, 'mid': 6.46174823e+03, 'max': None},}
kinematics.append(kin)

ndata = len(data_central)

# Uncertainties
# Construct luminosity covariance matrix
lumi_unc = 0.83 #%
lumi_uncs = []
lumi_cov = []
tot_cov = []
for data in data_central:
lumi_uncs.append(data * lumi_unc / 100.)
for lumi_i in lumi_uncs:
for lumi_j in lumi_uncs:
lumi_cov.append(lumi_i * lumi_j)

# Read total covariance matrix
with open(hepdata_tables[2], 'r') as f:
input = yaml.safe_load(f)
cov_values = input["dependent_variables"][0]["values"]
for cov_value in cov_values:
tot_cov.append(cov_value["value"])

# Compute covariance matrix without luminosity uncertainty
partial_cov = np.subtract(tot_cov,lumi_cov)

# Generate artifical systematic uncertainties form partial_cov
art_unc = covmat_to_artunc(ndata, partial_cov, 0)

for i in range(len(art_unc)):
errors = art_unc[i]
uncertainty = {}
for j in range(len(errors)):
unc = {"art. sys. " + f"{j+1}" : errors[j]}
uncertainty.update(unc)

lumi_unc = {"luminosity": lumi_uncs[i] }
uncertainty.update(lumi_unc)
uncertainties.append(uncertainty)

return (data_central, kinematics, uncertainties)

def filter_ATLAS_WCHARM_13TEV(observable=None):
"""
Dumps data, kinematics, and uncertainties on .yaml files
"""
central_values, kinematics, uncertainties = get_all(observable)
# 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():
if key == "luminosity":
definition = {key :
{"description": key + " unc. from HepData",
"treatment": "MULT",
"type": "ATLASLUMIRUNII"}}
else:
definition = {key :
{"description": key + " unc. from HepData",
"treatment": "ADD",
"type": "CORR"}}
definitions.update(definition)
uncertainties_yaml = {"definitions": definitions,"bins": uncertainties}

with open("data_" + observable + ".yaml", "w") as file:
yaml.dump(data_central_yaml, file, sort_keys=False)
with open("kinematics_" + observable + ".yaml", "w") as file:
yaml.dump(kinematics_yaml, file, sort_keys=False)
with open("uncertainties_" + observable + ".yaml", "w") as file:
yaml.dump(uncertainties_yaml, file, sort_keys=False)

if __name__ == "__main__":
filter_ATLAS_WCHARM_13TEV("WMWP-D")
filter_ATLAS_WCHARM_13TEV("WMWP-Dstar")
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
bins:
- abs_eta:
min: 0.0
mid: 0.25
max: 0.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 0.5
mid: 0.75
max: 1.0
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 1.0
mid: 1.25
max: 1.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 1.5
mid: 1.75
max: 2.0
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 2.0
mid: 2.25
max: 2.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 0.0
mid: 0.25
max: 0.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 0.5
mid: 0.75
max: 1.0
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 1.0
mid: 1.25
max: 1.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 1.5
mid: 1.75
max: 2.0
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 2.0
mid: 2.25
max: 2.5
m_W2:
min: null
mid: 6461.74823
max: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
bins:
- abs_eta:
min: 0.0
mid: 0.25
max: 0.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 0.5
mid: 0.75
max: 1.0
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 1.0
mid: 1.25
max: 1.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 1.5
mid: 1.75
max: 2.0
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 2.0
mid: 2.25
max: 2.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 0.0
mid: 0.25
max: 0.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 0.5
mid: 0.75
max: 1.0
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 1.0
mid: 1.25
max: 1.5
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 1.5
mid: 1.75
max: 2.0
m_W2:
min: null
mid: 6461.74823
max: null
- abs_eta:
min: 2.0
mid: 2.25
max: 2.5
m_W2:
min: null
mid: 6461.74823
max: null
Loading
Loading