diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/data_legacy_M.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/data.yaml similarity index 100% rename from nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/data_legacy_M.yaml rename to nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/data.yaml diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/filter.py b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/filter.py new file mode 100644 index 0000000000..4fc870bcca --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/filter.py @@ -0,0 +1,86 @@ +""" +filter.py module for ATLAS_Z0_7TEV_LOMASS dataset + +When running `python filter.py` the relevant uncertainties , data and kinematics yaml +file will be created in the `nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS` directory. +""" + +import yaml +from filter_utils import get_kinematics, get_data_values, get_systematics + + +def filter_ATLAS_Z0_7TEV_LOMASS_data_kinetic(): + """ + This function writes the central values and kinematics to yaml files. + """ + + kin = get_kinematics() + central_values = list(get_data_values()) + + data_central_yaml = {"data_central": central_values} + + kinematics_yaml = {"bins": kin} + + # write central values and kinematics to yaml file + 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) + + +def filter_ATLAS_Z0_7TEV_LOMASS_systematics(): + """ + This function writes the systematics to a yaml file. + """ + + with open("metadata.yaml", "r") as file: + metadata = yaml.safe_load(file) + + systematics = get_systematics() + + # error definition + error_definitions = {} + errors = [] + + for sys in systematics: + if sys[0]['name'] == 'stat': + error_definitions[sys[0]['name']] = { + "description": f"{sys[0]['name']}", + "treatment": "ADD", + "type": "UNCORR", + } + + elif (sys[0]['name'] == 'sys_res') or (sys[0]['name'] == 'sys_MC'): + error_definitions[sys[0]['name']] = { + "description": f"{sys[0]['name']}", + "treatment": "MULT", + "type": "UNCORR", + } + + else: + error_definitions[sys[0]['name']] = { + "description": f"{sys[0]['name']}", + "treatment": "MULT", + "type": "CORR", + } + + # + for i in range(metadata['implemented_observables'][0]['ndata']): + error_value = {} + + for sys in systematics: + error_value[sys[0]['name']] = float(sys[0]['values'][i]) + + errors.append(error_value) + + uncertainties_yaml = {"definitions": error_definitions, "bins": errors} + + # write uncertainties + with open(f"uncertainties.yaml", 'w') as file: + yaml.dump(uncertainties_yaml, file, sort_keys=False) + + +if __name__ == "__main__": + filter_ATLAS_Z0_7TEV_LOMASS_data_kinetic() + filter_ATLAS_Z0_7TEV_LOMASS_systematics() diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/filter_utils.py b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/filter_utils.py new file mode 100644 index 0000000000..ef0d2a2205 --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/filter_utils.py @@ -0,0 +1,81 @@ +""" +This module contains helper functions that are used to extract the uncertainties, kinematics and data values +from the rawdata files. +""" + +import yaml +import pandas as pd +import numpy as np + + +def get_kinematics(): + """ + returns the kinematics in the form of a list of dictionaries. + """ + kin = [] + + hepdata_table = f"rawdata/HEPData-ins1288706-v1-Table_6.yaml" + + with open(hepdata_table, 'r') as file: + input = yaml.safe_load(file) + + for i, M in enumerate(input["independent_variables"][0]['values']): + + kin_value = { + 'm_ll': {'min': M['low'], 'mid': (0.5 * (M['low'] + M['high'])), 'max': M['high']}, + 'sqrts': {'min': None, 'mid': 7000.0, 'max': None}, + } + + kin.append(kin_value) + + return kin + + +def get_data_values(): + """ + returns the central data values in the form of a list. + """ + + data_central = [] + + hepdata_table = f"rawdata/HEPData-ins1288706-v1-Table_6.yaml" + + with open(hepdata_table, 'r') as file: + input = yaml.safe_load(file) + + values = input['dependent_variables'][0]['values'] + + for value in values: + # store data central and convert the units + data_central.append(value['value'] * 1000) + + return data_central + + +def get_systematics_dataframe(): + """ + returns the absolute systematic uncertainties in the form of a pandas dataframe. + """ + sys_rawdata_path = "rawdata/ATLASLOMASSDY11EXT.csv" + + df = pd.read_csv(sys_rawdata_path) + data_central = np.array(get_data_values()) + + # convert (MULT) percentage unc to absolute unc + abs_unc_df = (df.T[3:] * data_central).T / 100 + + return abs_unc_df + + +def get_systematics(): + """ """ + abs_unc_df = get_systematics_dataframe() + + uncertainties = [] + + for i, unc_dp in enumerate(abs_unc_df.values.T): + name = f"{abs_unc_df.columns[i]}" + values = [unc_dp[j] for j in range(len(unc_dp))] + uncertainties.append([{"name": name, "values": values}]) + + return uncertainties diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/kinematics.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/kinematics.yaml new file mode 100644 index 0000000000..6fbaee161f --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/kinematics.yaml @@ -0,0 +1,49 @@ +bins: +- m_ll: + min: 12.0 + mid: 14.5 + max: 17.0 + sqrts: + min: null + mid: 7000.0 + max: null +- m_ll: + min: 17.0 + mid: 19.5 + max: 22.0 + sqrts: + min: null + mid: 7000.0 + max: null +- m_ll: + min: 22.0 + mid: 25.0 + max: 28.0 + sqrts: + min: null + mid: 7000.0 + max: null +- m_ll: + min: 28.0 + mid: 32.0 + max: 36.0 + sqrts: + min: null + mid: 7000.0 + max: null +- m_ll: + min: 36.0 + mid: 41.0 + max: 46.0 + sqrts: + min: null + mid: 7000.0 + max: null +- m_ll: + min: 46.0 + mid: 56.0 + max: 66.0 + sqrts: + min: null + mid: 7000.0 + max: null diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/kinematics_M.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/kinematics_M.yaml deleted file mode 100644 index 9df86c00fb..0000000000 --- a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/kinematics_M.yaml +++ /dev/null @@ -1,73 +0,0 @@ -bins: -- k1: - min: null - mid: 14.5 - max: null - k2: - min: null - mid: 210.25 - max: null - k3: - min: null - mid: 7000.0 - max: null -- k1: - min: null - mid: 19.5 - max: null - k2: - min: null - mid: 380.25 - max: null - k3: - min: null - mid: 7000.0 - max: null -- k1: - min: null - mid: 25.0 - max: null - k2: - min: null - mid: 625.0 - max: null - k3: - min: null - mid: 7000.0 - max: null -- k1: - min: null - mid: 32.0 - max: null - k2: - min: null - mid: 1024.0 - max: null - k3: - min: null - mid: 7000.0 - max: null -- k1: - min: null - mid: 41.0 - max: null - k2: - min: null - mid: 1681.0 - max: null - k3: - min: null - mid: 7000.0 - max: null -- k1: - min: null - mid: 56.0 - max: null - k2: - min: null - mid: 3136.0 - max: null - k3: - min: null - mid: 7000.0 - max: null diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/metadata.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/metadata.yaml index 3959282c5c..94ff3b421e 100644 --- a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/metadata.yaml +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/metadata.yaml @@ -1,6 +1,6 @@ setname: ATLAS_Z0_7TEV_LOMASS version: 1 -version_comment: Port of old commondata +version_comment: "First implementation" nnpdf_metadata: nnpdf31_process: DY NC experiment: ATLAS @@ -8,53 +8,49 @@ arXiv: url: https://arxiv.org/abs/1404.1212 journal: JHEP 06 (2014) 112 iNSPIRE: - url: '' + url: 'https://inspirehep.net/literature/1288706' hepdata: - url: 10.17182/hepdata.64183.v1/t6 - version: -1 + url: 'https://www.hepdata.net/record/ins1288706' + version: 1 implemented_observables: - observable_name: M observable: description: Drell-Yan Mass Distribution label: ATLAS low-mass DY 2011 units: '' - process_type: EWK_MLL - tables: [] - npoints: [] + process_type: DY_MLL + tables: [6] + npoints: [6] ndata: 6 plotting: - kinematics_override: ewk_mll_sqrt_scale + kinematics_override: identity dataset_label: ATLAS low-mass DY 2011 y_label: $d\sigma_{Z/\gamma^{*}}/dM_{ll}$ (fb) - plot_x: k2 + plot_x: m_ll kinematic_coverage: - - k1 - - k2 - - k3 + - m_ll + - sqrts kinematics: variables: - k1: - description: Variable k1 - label: k1 - units: '' - k2: - description: Variable k2 - label: k2 - units: '' - k3: - description: Variable k3 - label: k3 - units: '' - file: kinematics_M.yaml + m_ll: + description: dilepton mass + label: '$m_{ll}$' + units: 'GeV' + sqrts: + description: center of mass energy + label: sqrts + units: 'GeV' + file: kinematics.yaml theory: conversion_factor: 1000.0 operation: 'null' FK_tables: - - ATLAS_DY_7TEV_LOMASS_EXT - data_uncertainties: [] + data_uncertainties: + - uncertainties.yaml variants: legacy: data_uncertainties: - uncertainties_legacy_M.yaml - data_central: data_legacy_M.yaml + data_central: data.yaml ported_from: ATLASLOMASSDY11EXT diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/rawdata/ATLASLOMASSDY11EXT.csv b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/rawdata/ATLASLOMASSDY11EXT.csv new file mode 100644 index 0000000000..aa00fd105d --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/rawdata/ATLASLOMASSDY11EXT.csv @@ -0,0 +1,7 @@ +Mlow, Mhigh,y,stat,sys_reco,sys_trig,sys_iso,sys_mjet,sys_pTsc,sys_res,sys_MC,lumi +12.0,17,12.41,4.2,2.5,4.0,11.3,-3.0,-0.2,0.5,0.6,3.5 +17.0,22.0,22.57,3.1,1.4,3.7,11.3,-2.8,0.1,0.3,0.3,3.5 +22.0,28.0,14.64,3.3,0.9,3.6,8.5,-1.8,0.0,0.1,0.4,3.5 +28.0,36.0,6.73,4.0,0.7,3.6,6.2,-1.6,-0.1,0.2,0.4,3.5 +36.0,46.0,2.81,5.2,0.7,3.6,4.2,-1.3,-0.1,0.1,0.5,3.5 +46.0,66.0,1.27,4.7,0.6,3.6,3.6,-0.7,0.0,0.1,0.5,3.5 \ No newline at end of file diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/rawdata/HEPData-ins1288706-v1-Table_6.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/rawdata/HEPData-ins1288706-v1-Table_6.yaml new file mode 100644 index 0000000000..636c071777 --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/rawdata/HEPData-ins1288706-v1-Table_6.yaml @@ -0,0 +1,116 @@ +dependent_variables: +- header: {name: D(SIG)/DM, units: PB/GEV} + qualifiers: + - {name: RE, value: P P --> MU+ MU- X} + - {name: SQRT(S), units: GeV, value: '7000.0'} + values: + - errors: + - {label: stat, symerror: 4.2%} + - {label: sys, symerror: 12.6%} + value: 12.41 + - errors: + - {label: stat, symerror: 3.1%} + - {label: sys, symerror: 12.3%} + value: 22.57 + - errors: + - {label: stat, symerror: 3.3%} + - {label: sys, symerror: 9.5%} + value: 14.64 + - errors: + - {label: stat, symerror: 4.0%} + - {label: sys, symerror: 7.4%} + value: 6.73 + - errors: + - {label: stat, symerror: 5.2%} + - {label: sys, symerror: 5.7%} + value: 2.81 + - errors: + - {label: stat, symerror: 4.7%} + - {label: sys, symerror: 5.2%} + value: 1.27 +- header: {name: TOTAL ERROR, units: PCT} + qualifiers: + - {name: RE, value: P P --> MU+ MU- X} + - {name: SQRT(S), units: GeV, value: '7000.0'} + values: + - {value: 13.3} + - {value: 12.7} + - {value: 10.0} + - {value: 8.5} + - {value: 7.8} + - {value: 7.1} +- header: {name: D} + qualifiers: + - {name: RE, value: P P --> MU+ MU- X} + - {name: SQRT(S), units: GeV, value: '7000.0'} + values: + - {value: 1.0} + - {value: 0.98} + - {value: 0.98} + - {value: 0.99} + - {value: 1.02} + - {value: 1.16} +- header: {name: A} + qualifiers: + - {name: RE, value: P P --> MU+ MU- X} + - {name: SQRT(S), units: GeV, value: '7000.0'} + values: + - {value: 0.04} + - {value: 0.2} + - {value: 0.3} + - {value: 0.35} + - {value: 0.39} + - {value: 0.43} +- header: {name: delta(A)_scale down, units: PCT} + qualifiers: + - {name: RE, value: P P --> MU+ MU- X} + - {name: SQRT(S), units: GeV, value: '7000.0'} + values: + - {value: 7.1} + - {value: 3.7} + - {value: 0.4} + - {value: 0.3} + - {value: 0.3} + - {value: 0.4} +- header: {name: delta(A)_scale up, units: PCT} + qualifiers: + - {name: RE, value: P P --> MU+ MU- X} + - {name: SQRT(S), units: GeV, value: '7000.0'} + values: + - {value: 7.5} + - {value: 4.2} + - {value: 0.8} + - {value: 0.3} + - {value: 0.4} + - {value: 0.7} +- header: {name: delta(A)_pdf_alpha_s down, units: PCT} + qualifiers: + - {name: RE, value: P P --> MU+ MU- X} + - {name: SQRT(S), units: GeV, value: '7000.0'} + values: + - {value: 4.1} + - {value: 3.0} + - {value: 2.3} + - {value: 1.8} + - {value: 1.3} + - {value: 1.0} +- header: {name: delta(A)_pdf_alpha_s up, units: PCT} + qualifiers: + - {name: RE, value: P P --> MU+ MU- X} + - {name: SQRT(S), units: GeV, value: '7000.0'} + values: + - {value: 2.7} + - {value: 2.0} + - {value: 1.6} + - {value: 1.2} + - {value: 0.9} + - {value: 0.6} +independent_variables: +- header: {name: M, units: GEV} + values: + - {high: 17.0, low: 12.0} + - {high: 22.0, low: 17.0} + - {high: 28.0, low: 22.0} + - {high: 36.0, low: 28.0} + - {high: 46.0, low: 36.0} + - {high: 66.0, low: 46.0} diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/uncertainties.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/uncertainties.yaml new file mode 100644 index 0000000000..f3963dca27 --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/uncertainties.yaml @@ -0,0 +1,92 @@ +definitions: + stat: + description: stat + treatment: ADD + type: UNCORR + sys_reco: + description: sys_reco + treatment: MULT + type: CORR + sys_trig: + description: sys_trig + treatment: MULT + type: CORR + sys_iso: + description: sys_iso + treatment: MULT + type: CORR + sys_mjet: + description: sys_mjet + treatment: MULT + type: CORR + sys_pTsc: + description: sys_pTsc + treatment: MULT + type: CORR + sys_res: + description: sys_res + treatment: MULT + type: UNCORR + sys_MC: + description: sys_MC + treatment: MULT + type: UNCORR + lumi: + description: lumi + treatment: MULT + type: CORR +bins: +- stat: 521.22 + sys_reco: 310.25 + sys_trig: 496.4 + sys_iso: 1402.33 + sys_mjet: -372.3 + sys_pTsc: -24.82 + sys_res: 62.05 + sys_MC: 74.46 + lumi: 434.35 +- stat: 699.67 + sys_reco: 315.97999999999996 + sys_trig: 835.09 + sys_iso: 2550.4100000000003 + sys_mjet: -631.9599999999999 + sys_pTsc: 22.57 + sys_res: 67.71 + sys_MC: 67.71 + lumi: 789.95 +- stat: 483.12 + sys_reco: 131.76 + sys_trig: 527.04 + sys_iso: 1244.4 + sys_mjet: -263.52 + sys_pTsc: 0.0 + sys_res: 14.64 + sys_MC: 58.56 + lumi: 512.4 +- stat: 269.2 + sys_reco: 47.11 + sys_trig: 242.28 + sys_iso: 417.26 + sys_mjet: -107.68 + sys_pTsc: -6.73 + sys_res: 13.46 + sys_MC: 26.92 + lumi: 235.55 +- stat: 146.12 + sys_reco: 19.669999999999998 + sys_trig: 101.16 + sys_iso: 118.02 + sys_mjet: -36.53 + sys_pTsc: -2.81 + sys_res: 2.81 + sys_MC: 14.05 + lumi: 98.35 +- stat: 59.69 + sys_reco: 7.62 + sys_trig: 45.72 + sys_iso: 45.72 + sys_mjet: -8.89 + sys_pTsc: 0.0 + sys_res: 1.27 + sys_MC: 6.35 + lumi: 44.45