From b9a07fafb806fd7130d9afe85b518a4c856e1893 Mon Sep 17 00:00:00 2001 From: ecole41 Date: Fri, 6 Dec 2024 10:41:39 +0000 Subject: [PATCH] Added function to produce kinematics.yaml file and edited metadata, not sure on process type --- .../commondata/ATLAS_Z0_7TEV_46FB/filter.py | 19 +- .../ATLAS_Z0_7TEV_46FB/filter_utils.py | 44 +++ .../ATLAS_Z0_7TEV_46FB/kinematics_cc.yaml | 289 ++++++++++++++++++ .../ATLAS_Z0_7TEV_46FB/kinematics_cf.yaml | 181 +++++++++++ .../ATLAS_Z0_7TEV_46FB/metadata.yaml | 80 ++--- 5 files changed, 569 insertions(+), 44 deletions(-) create mode 100644 nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cc.yaml create mode 100644 nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cf.yaml diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter.py b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter.py index 1872fff1c6..3b46f76476 100644 --- a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter.py +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter.py @@ -4,23 +4,28 @@ """ 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) @@ -28,6 +33,12 @@ def filter_ATLAS_Z0_7TEV_46FB_data_central(): 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() diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter_utils.py b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter_utils.py index e351c8ad98..429d0d7299 100644 --- a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter_utils.py +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/filter_utils.py @@ -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() diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cc.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cc.yaml new file mode 100644 index 0000000000..68ab3822a8 --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cc.yaml @@ -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 diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cf.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cf.yaml new file mode 100644 index 0000000000..f4a5c43506 --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/kinematics_cf.yaml @@ -0,0 +1,181 @@ +bins: +- 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: 2.60000000e+00 + max: null + m_ll2: + min: null + mid: 8281 + max: null + sqrts: + min: null + mid: 7000.0 + max: null +- abs_eta: + min: null + mid: 3.0 + max: null + m_ll2: + min: null + mid: 8281 + max: null + sqrts: + min: null + mid: 7000.0 + max: null +- abs_eta: + min: null + mid: 3.40000000e+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.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 +- abs_eta: + min: null + mid: 2.60000000e+00 + max: null + m_ll2: + min: null + mid: 17689 + max: null + sqrts: + min: null + mid: 7000.0 + max: null +- abs_eta: + min: null + mid: 3.0 + max: null + m_ll2: + min: null + mid: 17689 + max: null + sqrts: + min: null + mid: 7000.0 + max: null +- abs_eta: + min: null + mid: 3.40000000e+00 + max: null + m_ll2: + min: null + mid: 17689 + max: null + sqrts: + min: null + mid: 7000.0 + max: null diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/metadata.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/metadata.yaml index 180b724837..46e75f62c2 100644 --- a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/metadata.yaml +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_46FB/metadata.yaml @@ -1,6 +1,6 @@ setname: ATLAS_Z0_7TEV_46FB -version: 1 -version_comment: Port of old commondata +version: 2 +version_comment: Reimplementation of old commondata nnpdf_metadata: nnpdf31_process: DY NC experiment: ATLAS @@ -18,12 +18,12 @@ implemented_observables: description: Drell-Yan Rapidity Distribution label: ATLAS $Z$ 7 TeV 2011 Central selection units: '' - process_type: EWK_RAP + process_type: DY_Z_Y #Not sure if this is correct tables: [11,12,13] npoints: [] ndata: 24 plotting: - kinematics_override: ewk_rap_sqrt_scale + kinematics_override: identity dataset_label: ATLAS $Z$ 7 TeV 2011 Central selection x_label: $\left\|\eta/y\right|$ y_label: $d\sigma/dy$ (fb) @@ -59,26 +59,26 @@ implemented_observables: - $Z_{high}$ - $Z_{high}$ - $Z_{high}$ - plot_x: k1 + plot_x: abs_eta kinematic_coverage: - - k1 - - k2 - - k3 + - abs_eta + - m_ll2 + - sqrts kinematics: variables: - k1: - description: Variable k1 - label: k1 + abs_eta: + description: Absolute dilepton rapidity + label: abs_eta units: '' - k2: - description: Variable k2 - label: k2 - units: '' - k3: - description: Variable k3 - label: k3 - units: '' - file: kinematics_CC-Y.yaml + m_ll2: + description: Squared dilepton mass + label: m_ll2 + units: 'GeV^2' + sqrts: + description: Square root of center of mass energy + label: sqrts + units: 'GeV' + file: kinematics_cc.yaml theory: conversion_factor: 1000.0 operation: 'null' @@ -89,19 +89,19 @@ implemented_observables: legacy: data_uncertainties: - uncertainties_legacy_CC-Y.yaml - data_central: data_legacy_CC-Y.yaml + data_central: data_cc.yaml ported_from: ATLASZRAP11CC - observable_name: CF-Y observable: description: Drell-Yan Rapidity Distribution label: ATLAS $W,Z$ 7 TeV 2011 Forward selection units: '' - process_type: EWK_RAP + process_type: DY_Z_Y #Not sure if this is correct tables: [14,15] npoints: [] ndata: 15 plotting: - kinematics_override: ewk_rap_sqrt_scale + kinematics_override: identity dataset_label: ATLAS $W,Z$ 7 TeV 2011 Forward selection x_label: $\left\|\eta/y\right|$ y_label: $d\sigma/dy$ (fb) @@ -128,26 +128,26 @@ implemented_observables: - $Z_{high}$ - $Z_{high}$ - $Z_{high}$ - plot_x: k1 + plot_x: abs_eta kinematic_coverage: - - k1 - - k2 - - k3 + - abs_eta + - m_ll2 + - sqrts kinematics: variables: - k1: - description: Variable k1 - label: k1 - units: '' - k2: - description: Variable k2 - label: k2 - units: '' - k3: - description: Variable k3 - label: k3 + abs_eta: + description: Absolute dilepton rapidity + label: abs_eta units: '' - file: kinematics_CF-Y.yaml + m_ll2: + description: Squared dilepton mass + label: m_ll2 + units: 'GeV^2' + sqrts: + description: Square root of center of mass energy + label: sqrts + units: 'GeV' + file: kinematics_cf.yaml theory: conversion_factor: 1000.0 operation: 'null' @@ -161,5 +161,5 @@ implemented_observables: legacy_DEC: data_uncertainties: - uncertainties_CF-Y_sys_DEC.yaml - data_central: data_legacy_CF-Y.yaml + data_central: data_cf.yaml ported_from: ATLASWZRAP11CF