Skip to content

Commit

Permalink
Added function to produce kinematics.yaml file and edited metadata, n…
Browse files Browse the repository at this point in the history
…ot sure on process type
  • Loading branch information
ecole41 committed Dec 6, 2024
1 parent 6e92dec commit b9a07fa
Show file tree
Hide file tree
Showing 5 changed files with 569 additions and 44 deletions.
19 changes: 15 additions & 4 deletions nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,41 @@
"""

import yaml
from filter_utils import get_data_values
from filter_utils import get_data_values, get_kinematics

from nnpdf_data.filter_utils.utils import prettify_float

yaml.add_representer(float, prettify_float)


def filter_ATLAS_Z0_7TEV_46FB_data_central():
def filter_ATLAS_Z0_7TEV_46FB_data_kinematic():
"""
This function writes the central values to yaml files.
This function writes the systematics to yaml files.
"""

central_values_cc, central_values_cf = get_data_values()

kin_cc, kin_cf = get_kinematics()

data_central_yaml_cc = {"data_central": central_values_cc}
data_central_yaml_cf = {"data_central": central_values_cf}

kinematics_yaml_cc = {"bins": kin_cc}
kinematics_yaml_cf = {"bins": kin_cf}

# write central values and kinematics to yaml file
with open("data_cc.yaml", "w") as file:
yaml.dump(data_central_yaml_cc, file, sort_keys=False)

with open("data_cf.yaml", "w") as file:
yaml.dump(data_central_yaml_cf, file, sort_keys=False)

with open("kinematics_cc.yaml", "w") as file:
yaml.dump(kinematics_yaml_cc, file, sort_keys=False)

with open("kinematics_cf.yaml", "w") as file:
yaml.dump(kinematics_yaml_cf, file, sort_keys=False)


if __name__ == "__main__":
filter_ATLAS_Z0_7TEV_46FB_data_central()
filter_ATLAS_Z0_7TEV_46FB_data_kinematic()
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,49 @@ def get_data_values():
return data_central_cc, data_central_cf


def get_kinematics():
"""
returns the kinematics in the form of a list of dictionaries.
"""
kin_cc = []
kin_cf = []
cc_tables = [11, 12, 13]
cf_tables = [14, 15]

# Define a mapping for table numbers to av_m_ll2 values
av_m_ll2_mapping = {11: 56**2, 12: 91**2, 13: 133**2, 14: 91**2, 15: 133**2}

for table in cc_tables:
hepdata_table = f"rawdata/HEPData-ins1502620-v1-Table_{table}.yaml"
av_m_ll2 = av_m_ll2_mapping[table]
with open(hepdata_table, 'r') as file:
input = yaml.safe_load(file)

for i, M in enumerate(input["independent_variables"][0]['values']):
kin_value = {
'abs_eta': {'min': None, 'mid': (0.5 * (M['low'] + M['high'])), 'max': None},
'm_ll2': {'min': None, 'mid': av_m_ll2, 'max': None},
'sqrts': {'min': None, 'mid': 7000.0, 'max': None},
}
kin_cc.append(kin_value)

for table in cf_tables:
hepdata_table = f"rawdata/HEPData-ins1502620-v1-Table_{table}.yaml"
av_m_ll2 = av_m_ll2_mapping[table]
with open(hepdata_table, 'r') as file:
input = yaml.safe_load(file)

for i, M in enumerate(input["independent_variables"][0]['values']):
kin_value = {
'abs_eta': {'min': None, 'mid': (0.5 * (M['low'] + M['high'])), 'max': None},
'm_ll2': {'min': None, 'mid': av_m_ll2, 'max': None},
'sqrts': {'min': None, 'mid': 7000.0, 'max': None},
}
kin_cf.append(kin_value)

return kin_cc, kin_cf


if __name__ == "__main__":
get_data_values()
get_kinematics()
289 changes: 289 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
bins:
- abs_eta:
min: null
mid: 0.2
max: null
m_ll2:
min: null
mid: 3136
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 6.00000000e-01
max: null
m_ll2:
min: null
mid: 3136
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.0
max: null
m_ll2:
min: null
mid: 3136
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.4
max: null
m_ll2:
min: null
mid: 3136
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.8
max: null
m_ll2:
min: null
mid: 3136
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 2.2
max: null
m_ll2:
min: null
mid: 3136
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 0.1
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 3.00000000e-01
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 0.5
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 0.7
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 0.9
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.1
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.30000000e+00
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.5
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.70000000e+00
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.9
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 2.1
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 2.3
max: null
m_ll2:
min: null
mid: 8281
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 0.2
max: null
m_ll2:
min: null
mid: 17689
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 6.00000000e-01
max: null
m_ll2:
min: null
mid: 17689
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.0
max: null
m_ll2:
min: null
mid: 17689
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.4
max: null
m_ll2:
min: null
mid: 17689
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 1.8
max: null
m_ll2:
min: null
mid: 17689
max: null
sqrts:
min: null
mid: 7000.0
max: null
- abs_eta:
min: null
mid: 2.2
max: null
m_ll2:
min: null
mid: 17689
max: null
sqrts:
min: null
mid: 7000.0
max: null
Loading

0 comments on commit b9a07fa

Please sign in to comment.