diff --git a/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/data.yaml b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/data.yaml new file mode 100644 index 0000000000..37eadd5649 --- /dev/null +++ b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/data.yaml @@ -0,0 +1,8 @@ +data_central: +- 353.152 +- 345.985 +- 336.195 +- 322.483 +- 303.973 +- 273.198 +- 173.171 diff --git a/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/filter.py b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/filter.py new file mode 100644 index 0000000000..17f2c7c44a --- /dev/null +++ b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/filter.py @@ -0,0 +1,91 @@ + +import yaml +import numpy as np + +from filter_utils import get_kinematics, get_data_values, get_systematics + + +def filter_ATLAS_Z0_8TEV_data_kinetic(): + """ + writes data central values and kinematics + to respective .yaml file + """ + kin = get_kinematics() + central_values = 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_8TEV_uncertainties(): + """ + writes uncertainties to respective .yaml file + """ + systematics = get_systematics() + + # load correlation matrix from .txt file + corr_matrix = np.loadtxt("rawdata/zy.txt") + + # generate covariance matrix from correlation matrix + tot_systematics = np.array([syst[0]['value'] for syst in systematics['tot']]) + + # TODO: this should be done with utils.correlation_to_covariance once that is merged in master + cov_matrix_no_lumi = np.outer(tot_systematics, tot_systematics) * corr_matrix + + # add lumi uncertainty + lumi_unc = np.array([syst[0]['value'] for syst in systematics['lumi']]) + lumi_cov = lumi_unc[:, None] @ lumi_unc[:, None].T + + # add covariances + cov_matrix = cov_matrix_no_lumi + lumi_cov + + # compute decomposition of covariance matrix so as to get artificial systematics + # TODO: use utils once merged in master + lamb, mat = np.linalg.eig(cov_matrix) + art_sys = np.multiply(np.sqrt(lamb), mat) + + uncertainties = [] + + for i, unc in enumerate(art_sys.T): + + name = f"artificial_uncertainty_{i+1}" + values = [unc[i] for i in range(len(unc))] + uncertainties.append([{"name": name, "values": values}]) + + # error definition + error_definitions = {} + errors = [] + + for sys in uncertainties: + + error_definitions[sys[0]['name']] = { + "description": f"{sys[0]['name']}", + "treatment": "ADD", + "type": "CORR", + } + + for i in range(cov_matrix.shape[0]): + error_value = {} + + for sys in uncertainties: + 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_8TEV_data_kinetic() + filter_ATLAS_Z0_8TEV_uncertainties() \ No newline at end of file diff --git a/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/filter_utils.py b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/filter_utils.py new file mode 100644 index 0000000000..726b72d0e2 --- /dev/null +++ b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/filter_utils.py @@ -0,0 +1,108 @@ +import yaml + + +def get_kinematics(): + """ + returns the relevant kinematics values. + Parameters + ---------- + table : list + version : int + integer read from metadata.yaml that + indicated the version of the hepdata + tables + Returns + ------- + list + list containing the kinematic values for all + hepdata tables + """ + kin = [] + + hepdata_table = f"rawdata/HEPData-ins2698794-v1-Table_9.yaml" + + with open(hepdata_table, 'r') as file: + input = yaml.safe_load(file) + + for yll in input["independent_variables"][0]['values']: + kin_value = { + 'y': { + 'min': yll['low'], + 'mid': 0.5 * (yll['low'] + yll['high']), + 'max': yll['high'], + }, + 'm_Z2': {'min': None, 'mid': 8317.44, 'max': None}, + 'sqrts': {'min': None, 'mid': 8000.0, 'max': None}, + } + + kin.append(kin_value) + + return kin + + +def get_data_values(): + """ + returns the central data. + Parameters + ---------- + tables : list + list that enumerates the table number + version : int + integer read from metadata.yaml that + indicated the version of the hepdata + tables + Returns + ------- + list + list containing the central values for all + hepdata tables + """ + + data_central = [] + + hepdata_table = f"rawdata/HEPData-ins2698794-v1-Table_9.yaml" + + with open(hepdata_table, 'r') as file: + input = yaml.safe_load(file) + + values = input['dependent_variables'][0]['values'] + + for value in values: + data_central.append(value['value']) + + return data_central + + +def get_systematics(): + """ """ + tot_uncertainties = [] + lumi_uncertainties = [] + + hepdata_table = f"rawdata/HEPData-ins2698794-v1-Table_9.yaml" + + with open(hepdata_table, 'r') as file: + input = yaml.safe_load(file) + + dependent_vars = input['dependent_variables'][0] + + # skip 1st entry as these are central data values + for err_values in dependent_vars['values']: + + tot_uncertainties.append( + [ + { + "name": err_values['errors'][0]['label'], + "value": err_values['errors'][0]['symerror'], + } + ] + ) + lumi_uncertainties.append( + [ + { + "name": err_values['errors'][1]['label'], + "value": err_values['errors'][1]['symerror'], + } + ] + ) + + return {'tot': tot_uncertainties, 'lumi': lumi_uncertainties} diff --git a/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/kinematics.yaml b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/kinematics.yaml new file mode 100644 index 0000000000..2fc461bc35 --- /dev/null +++ b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/kinematics.yaml @@ -0,0 +1,85 @@ +bins: +- y: + min: 0.4 + mid: 0.6000000000000001 + max: 0.8 + m_Z2: + min: null + mid: 8317.44 + max: null + sqrts: + min: null + mid: 8000.0 + max: null +- y: + min: 0.8 + mid: 1.0 + max: 1.2 + m_Z2: + min: null + mid: 8317.44 + max: null + sqrts: + min: null + mid: 8000.0 + max: null +- y: + min: 1.2 + mid: 1.4 + max: 1.6 + m_Z2: + min: null + mid: 8317.44 + max: null + sqrts: + min: null + mid: 8000.0 + max: null +- y: + min: 1.6 + mid: 1.8 + max: 2 + m_Z2: + min: null + mid: 8317.44 + max: null + sqrts: + min: null + mid: 8000.0 + max: null +- y: + min: 2 + mid: 2.2 + max: 2.4 + m_Z2: + min: null + mid: 8317.44 + max: null + sqrts: + min: null + mid: 8000.0 + max: null +- y: + min: 2.4 + mid: 2.5999999999999996 + max: 2.8 + m_Z2: + min: null + mid: 8317.44 + max: null + sqrts: + min: null + mid: 8000.0 + max: null +- y: + min: 2.8 + mid: 3.2 + max: 3.6 + m_Z2: + min: null + mid: 8317.44 + max: null + sqrts: + min: null + mid: 8000.0 + max: null diff --git a/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/metadata.yaml b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/metadata.yaml new file mode 100644 index 0000000000..334c859db3 --- /dev/null +++ b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/metadata.yaml @@ -0,0 +1,59 @@ +# Generalia +setname: "ATLAS_Z0_8TEV_ZMASS" + +version: 1 + +version_comment: "Initial implementation" + +# References +arXiv: + url: "https://arxiv.org/pdf/2309.09318" +iNSPIRE: + url: "https://inspirehep.net/literature/2698794" +hepdata: + url: "https://www.hepdata.net/record/149333" + version: 1 + +nnpdf_metadata: + nnpdf31_process: "DY NC" + experiment: "ATLAS" + + +implemented_observables: + + - observable_name: "LL" + observable: + description: "ATLAS 8 TeV, Z boson rapidity distribution in full phase space of decay leptons" + label: r"$d\\sigma/d|\|y_{ll}||$" + units: "[pb]" + + ndata: 7 + + tables: [9] + process_type: DY_Z_Y + + plotting: + dataset_label: 'ATLAS 8 TeV $Z \to l^+ l^-$, absolute rapidity' + kinematics_override: identity + x_scale: linear + plot_x: y + + kinematic_coverage: [y, m_Z2, sqrts] + + kinematics: + variables: + y: {description: "Z > l+ l- absolute rapidity", label: '$|y_{ll}|$', units: ""} + m_Z2: {description: "Z boson mass squared", label: '$M_Z^2$', units: "GeV"} + sqrts: {description: "center of mass energy", label: '$\sqrt(s)$', units: "GeV"} + file: kinematics.yaml + + # Data + data_central: data.yaml + data_uncertainties: + - uncertainties.yaml + + # Theory + theory: + FK_tables: + - - ATLAS_Z0_8TEV_ZMASS + operation: 'null' \ No newline at end of file diff --git a/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/rawdata/HEPData-ins2698794-v1-Table_9.yaml b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/rawdata/HEPData-ins2698794-v1-Table_9.yaml new file mode 100644 index 0000000000..7e125d0135 --- /dev/null +++ b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/rawdata/HEPData-ins2698794-v1-Table_9.yaml @@ -0,0 +1,71 @@ +independent_variables: + - header: {name: '$|y|^{\ell\ell}$'} + values: + - {high: 0.8, low: 0.4} + - {high: 1.2, low: 0.8} + - {high: 1.6, low: 1.2} + - {high: 2, low: 1.6} + - {high: 2.4, low: 2} + - {high: 2.8, low: 2.4} + - {high: 3.6, low: 2.8} +dependent_variables: + - header: {name: '$d\sigma/d|y|^{\ell\ell}$ $\pm$ Total $\pm$ Luminosity', units: pb} + values: + - value: 353.152 + errors: + - {symerror: 0.612877, label: tot} + - {symerror: 6.35674, label: lumi} + - value: 345.985 + errors: + - {symerror: 0.614565, label: tot} + - {symerror: 6.22773, label: lumi} + - value: 336.195 + errors: + - {symerror: 0.631117, label: tot} + - {symerror: 6.05151, label: lumi} + - value: 322.483 + errors: + - {symerror: 0.867255, label: tot} + - {symerror: 5.80469, label: lumi} + - value: 303.973 + errors: + - {symerror: 1.2225, label: tot} + - {symerror: 5.47151, label: lumi} + - value: 273.198 + errors: + - {symerror: 1.47795, label: tot} + - {symerror: 4.91756, label: lumi} + - value: 173.171 + errors: + - {symerror: 1.44884, label: tot} + - {symerror: 3.11708, label: lumi} + - header: {name: 'N$^3$LO $\pm$ PDF $\pm$ scale var.', units: pb} + values: + - value: 343.835 + errors: + - {symerror: 5.0845, label: pdf} + - {symerror: 1.48899, label: scale} + - value: 337.198 + errors: + - {symerror: 4.9785, label: pdf} + - {symerror: 1.5366, label: scale} + - value: 327.154 + errors: + - {symerror: 4.8728, label: pdf} + - {symerror: 1.50239, label: scale} + - value: 312.773 + errors: + - {symerror: 4.6646, label: pdf} + - {symerror: 1.4265, label: scale} + - value: 292.641 + errors: + - {symerror: 4.3853, label: pdf} + - {symerror: 1.43681, label: scale} + - value: 260.733 + errors: + - {symerror: 4.0832, label: pdf} + - {symerror: 1.44803, label: scale} + - value: 168.482 + errors: + - {symerror: 3.1625, label: pdf} + - {symerror: 1.54132, label: scale} diff --git a/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/rawdata/zy.txt b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/rawdata/zy.txt new file mode 100644 index 0000000000..4fe1bc9d51 --- /dev/null +++ b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/rawdata/zy.txt @@ -0,0 +1,7 @@ +1.000000000000 0.771441698074 0.698377430439 0.470446109772 0.235730156302 0.135500997305 0.023962540552 +0.771441698074 1.000000000000 0.728683710098 0.490636169910 0.257601708174 0.143674910069 0.023399809375 +0.698377430439 0.728683710098 1.000000000000 0.524034738541 0.272780925035 0.151878938079 0.033453177661 +0.470446109772 0.490636169910 0.524034738541 0.999999940395 0.463345497847 0.285900026560 0.101109012961 +0.235730156302 0.257601708174 0.272780925035 0.463345497847 1.000000000000 0.564261615276 0.305788159370 +0.135500997305 0.143674910069 0.151878938079 0.285900026560 0.564261615276 1.000000119209 0.455123543739 +0.023962540552 0.023399809375 0.033453177661 0.101109012961 0.305788159370 0.455123543739 1.000000000000 diff --git a/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/uncertainties.yaml b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/uncertainties.yaml new file mode 100644 index 0000000000..31706ee588 --- /dev/null +++ b/nnpdf_data/nnpdf_data/new_commondata/ATLAS_Z0_8TEV_ZMASS/uncertainties.yaml @@ -0,0 +1,79 @@ +definitions: + artificial_uncertainty_1: + description: artificial_uncertainty_1 + treatment: ADD + type: CORR + artificial_uncertainty_2: + description: artificial_uncertainty_2 + treatment: ADD + type: CORR + artificial_uncertainty_3: + description: artificial_uncertainty_3 + treatment: ADD + type: CORR + artificial_uncertainty_4: + description: artificial_uncertainty_4 + treatment: ADD + type: CORR + artificial_uncertainty_5: + description: artificial_uncertainty_5 + treatment: ADD + type: CORR + artificial_uncertainty_6: + description: artificial_uncertainty_6 + treatment: ADD + type: CORR + artificial_uncertainty_7: + description: artificial_uncertainty_7 + treatment: ADD + type: CORR +bins: +- artificial_uncertainty_1: 6.360849092233548 + artificial_uncertainty_2: -0.43736014852425575 + artificial_uncertainty_3: -0.17081282174067292 + artificial_uncertainty_4: 0.1343303399845492 + artificial_uncertainty_5: 0.1506396770871814 + artificial_uncertainty_6: 0.17839551357478534 + artificial_uncertainty_7: -0.17417703394997616 +- artificial_uncertainty_1: 6.233875520247695 + artificial_uncertainty_2: -0.42939370572372393 + artificial_uncertainty_3: -0.1581186015151157 + artificial_uncertainty_4: 0.12091345356933662 + artificial_uncertainty_5: 0.140047777147049 + artificial_uncertainty_6: -0.22584792937770715 + artificial_uncertainty_7: -0.08053516734437347 +- artificial_uncertainty_1: 6.060113000362857 + artificial_uncertainty_2: -0.4123698461117033 + artificial_uncertainty_3: -0.14680060602839212 + artificial_uncertainty_4: 0.10112405423267312 + artificial_uncertainty_5: 0.0894931999659005 + artificial_uncertainty_6: 0.04486740555676256 + artificial_uncertainty_7: 0.28681853399599 +- artificial_uncertainty_1: 5.836824335315856 + artificial_uncertainty_2: -0.27502106473581056 + artificial_uncertainty_3: 0.03159277272608425 + artificial_uncertainty_4: -0.12119507917842083 + artificial_uncertainty_5: -0.5349848732266431 + artificial_uncertainty_6: -0.0007764604112265232 + artificial_uncertainty_7: -0.02250579775755823 +- artificial_uncertainty_1: 5.539243636415269 + artificial_uncertainty_2: 0.31344828703761407 + artificial_uncertainty_3: 0.4545302042514127 + artificial_uncertainty_4: -0.6463383504190422 + artificial_uncertainty_5: 0.16156289938315516 + artificial_uncertainty_6: 0.0018754281204069558 + artificial_uncertainty_7: -0.0009901510871859873 +- artificial_uncertainty_1: 5.00099551940249 + artificial_uncertainty_2: 0.9002405764173007 + artificial_uncertainty_3: 0.5616642244049272 + artificial_uncertainty_4: 0.48016500342015245 + artificial_uncertainty_5: -0.017766174135644974 + artificial_uncertainty_6: -0.00035256711006794806 + artificial_uncertainty_7: 0.0016258067952645042 +- artificial_uncertainty_1: 3.1715884625027186 + artificial_uncertainty_2: 1.0482636206034448 + artificial_uncertainty_3: -0.8037615168161861 + artificial_uncertainty_4: -0.1055372371812821 + artificial_uncertainty_5: -0.017988003826124054 + artificial_uncertainty_6: -0.000893499833004754 + artificial_uncertainty_7: 0.0001651328837651984