-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2178 from NNPDF/reimplement_ATLAS_Z0_7TEV_49FB_HI…
…MASS Reimplement ATLAS_Z0_7TEV_49FB_HIMASS
- Loading branch information
Showing
13 changed files
with
665 additions
and
30 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_49FB/data.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
data_central: | ||
- 224.0 | ||
- 102.0 | ||
- 51.2 | ||
- 2.84000000e+01 | ||
- 1.87000000e+01 | ||
- 10.7 | ||
- 8.23000000e+00 | ||
- 4.66 | ||
- 1.7 | ||
- 0.474 | ||
- 0.146 | ||
- 2.21000000e-02 | ||
- 2.88000000e-03 |
94 changes: 94 additions & 0 deletions
94
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_49FB/filter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
""" | ||
filter.py module for ATLAS_Z0_7TEV_49FB dataset | ||
When running `python filter.py` the relevant data yaml | ||
file will be created in the `nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS` directory. | ||
""" | ||
|
||
import yaml | ||
from filter_utils import get_data_values, get_kinematics, get_systematics | ||
from nnpdf_data.filter_utils.utils import prettify_float | ||
|
||
yaml.add_representer(float, prettify_float) | ||
|
||
|
||
def filter_ATLAS_Z0_7TEV_49FB_data_kinetic(): | ||
""" | ||
This function writes the central values to yaml files. | ||
""" | ||
central_values = list(get_data_values()) | ||
|
||
kin = get_kinematics() | ||
|
||
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_49FB_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'] == 'Nbkg_stat') or (sys[0]['name'] == 'CDY_stat'): | ||
error_definitions[sys[0]['name']] = { | ||
"description": f"{sys[0]['name']}", | ||
"treatment": "MULT", | ||
"type": "UNCORR", | ||
} | ||
|
||
elif sys[0]['name'] == 'Lumi': | ||
error_definitions[sys[0]['name']] = { | ||
"description": f"{sys[0]['name']}", | ||
"treatment": "MULT", | ||
"type": "ATLASLUMI11", | ||
} | ||
|
||
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_49FB_data_kinetic() | ||
filter_ATLAS_Z0_7TEV_49FB_systematics() |
83 changes: 83 additions & 0 deletions
83
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_49FB/filter_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
""" | ||
This module contains helper functions that are used to extract the data values | ||
from the rawdata files. | ||
""" | ||
|
||
import yaml | ||
import pandas as pd | ||
import numpy as np | ||
|
||
|
||
def get_data_values(): | ||
""" | ||
returns the central data values in the form of a list. | ||
""" | ||
|
||
data_central = [] | ||
|
||
hepdata_table = f"rawdata/HEPData-ins1234228-v1-Table_1.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_kinematics(): | ||
""" | ||
returns the kinematics in the form of a list of dictionaries. | ||
""" | ||
kin = [] | ||
|
||
hepdata_table = f"rawdata/HEPData-ins1234228-v1-Table_1.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': None, 'mid': (0.5 * (M['low'] + M['high'])), 'max': None}} | ||
|
||
kin.append(kin_value) | ||
|
||
return kin | ||
|
||
|
||
def get_systematics_dataframe(): | ||
""" | ||
returns the absolute systematic uncertainties in the form of a pandas dataframe. | ||
""" | ||
sys_rawdata_path = "rawdata/ATLAS-49fb-Zhighmass.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[2:] * 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 | ||
|
||
|
||
if __name__ == "__main__": | ||
get_data_values() | ||
get_systematics_dataframe() |
53 changes: 53 additions & 0 deletions
53
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_49FB/kinematics.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
bins: | ||
- m_ll: | ||
min: null | ||
mid: 123.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 140.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 160.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 180.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 200.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 220.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 240.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 275.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 350.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 450.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 600.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 850.0 | ||
max: null | ||
- m_ll: | ||
min: null | ||
mid: 1250.0 | ||
max: null |
45 changes: 18 additions & 27 deletions
45
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_49FB/metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,52 @@ | ||
setname: ATLAS_Z0_7TEV_49FB | ||
version: 1 | ||
version_comment: Port of old commondata | ||
version: 2 | ||
version_comment: Reimplementation of old commondata | ||
nnpdf_metadata: | ||
nnpdf31_process: DY NC | ||
experiment: ATLAS | ||
arXiv: | ||
url: https://arxiv.org/abs/1305.4192 | ||
journal: Phys.Lett. B725 (2013) 223 | ||
iNSPIRE: | ||
url: '' | ||
url: 'https://inspirehep.net/literature/1234228' | ||
hepdata: | ||
url: 10.17182/hepdata.61422.v1/t1 | ||
url: https://www.hepdata.net/record/ins1234228 | ||
version: -1 | ||
implemented_observables: | ||
- observable_name: HIMASS | ||
observable: | ||
description: Drell-Yan Mass Distribution | ||
label: ATLAS HM DY 7 TeV | ||
units: '' | ||
process_type: EWK_MLL | ||
tables: [] | ||
process_type: "DY_MLL" | ||
tables: [1] | ||
npoints: [] | ||
ndata: 13 | ||
plotting: | ||
kinematics_override: ewk_mll_sqrt_scale | ||
kinematics_override: identity | ||
dataset_label: ATLAS HM DY 7 TeV | ||
y_label: $d\sigma_{Z/\gamma^{*}}/dM_{ll}$ (fb) | ||
y_scale: log | ||
plot_x: k2 | ||
plot_x: m_ll | ||
kinematic_coverage: | ||
- k1 | ||
- k2 | ||
- k3 | ||
- m_ll | ||
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_HIMASS.yaml | ||
m_ll: | ||
description: Mass of lepton pair | ||
label: "$m_{ll}$" | ||
units: 'GeV' | ||
file: kinematics.yaml | ||
theory: | ||
conversion_factor: 1000.0 | ||
operation: 'null' | ||
FK_tables: | ||
- - ATLAS_DY_7TEV_49FB_HIMASS | ||
data_uncertainties: [] | ||
data_uncertainties: | ||
- uncertainties.yaml | ||
variants: | ||
legacy: | ||
data_uncertainties: | ||
- uncertainties_legacy_HIMASS.yaml | ||
data_central: data_legacy_HIMASS.yaml | ||
- uncertainties.yaml | ||
data_central: data.yaml | ||
ported_from: ATLASZHIGHMASS49FB |
14 changes: 14 additions & 0 deletions
14
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_49FB/rawdata/ATLAS-49fb-Zhighmass.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
mee_xmin,mee_xmax,Stat,Nbkg_stat,CDY_stat,Nbkg,Reco,Id,Energy_scale_res,Unfolding,Trigger,MC_Modelling,Theoretical,Lumi | ||
116,130,1.1,0.1,0.7,1.3,1.6,2.3,2.1,1.5,0.8,0.2,0.3,1.8 | ||
130,150,1.4,0.2,0.7,1.8,1.6,2.3,1.7,1.5,0.8,0.5,0.2,1.8 | ||
150,170,2.0,0.3,1.0,2.5,1.6,2.3,1.6,1.5,0.8,0.2,0.2,1.8 | ||
170,190,2.7,0.4,1.3,2.8,1.6,2.3,1.0,1.5,0.8,0.2,0.2,1.8 | ||
190,210,3.0,0.5,1.7,3.4,1.6,2.4,1.5,1.5,0.8,0.3,0.4,1.8 | ||
210,230,4.4,0.9,2.0,4.1,1.6,2.4,2.0,1.5,0.8,0.8,0.5,1.8 | ||
230,250,5.2,0.9,2.4,3.8,1.6,2.4,1.2,1.5,0.8,0.2,0.3,1.8 | ||
250,300,4.3,0.7,0.9,4.1,1.6,2.4,1.7,1.5,0.8,0.2,0.2,1.8 | ||
300,400,5.1,0.9,1.0,4.4,1.6,2.5,1.7,1.5,0.8,0.3,0.3,1.8 | ||
400,500,9.4,2.0,0.9,4.0,1.6,2.6,2.3,1.5,0.8,0.5,0.4,1.8 | ||
500,700,11,2.0,0.8,3.1,1.6,2.6,2.4,1.5,0.8,0.2,0.3,1.8 | ||
700,1000,24,4.0,0.6,4.3,1.6,2.6,2.8,1.5,0.8,0.2,0.4,1.8 | ||
1000,1500,50,7.6,0.4,3.1,1.7,2.5,3.3,1.5,0.8,0.3,0.4,1.8 |
19 changes: 19 additions & 0 deletions
19
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_49FB/rawdata/ATLAS-49fb-Zhighmass.sys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Born level | ||
============================================================================================================ | ||
mee mee Stat. Nbkg CDY Nbkg Reco. Id. Energy Unfolding Trigger MC Theoretical Lumi | ||
xmin xmax stat. stat. scale&res modelling | ||
GeV <-uncorrelated (%)-> <---------------------bin-to-bin correlated (%)---------------------> | ||
============================================================================================================ | ||
116 130 1.1 0.1 0.7 1.3 1.6 2.3 2.1 1.5 0.8 0.2 0.3 1.8 | ||
130 150 1.4 0.2 0.7 1.8 1.6 2.3 1.7 1.5 0.8 0.5 0.2 1.8 | ||
150 170 2.0 0.3 1.0 2.5 1.6 2.3 1.6 1.5 0.8 0.2 0.2 1.8 | ||
170 190 2.7 0.4 1.3 2.8 1.6 2.3 1.0 1.5 0.8 0.2 0.2 1.8 | ||
190 210 3.0 0.5 1.7 3.4 1.6 2.4 1.5 1.5 0.8 0.3 0.4 1.8 | ||
210 230 4.4 0.9 2.0 4.1 1.6 2.4 2.0 1.5 0.8 0.8 0.5 1.8 | ||
230 250 5.2 0.9 2.4 3.8 1.6 2.4 1.2 1.5 0.8 0.2 0.3 1.8 | ||
250 300 4.3 0.7 0.9 4.1 1.6 2.4 1.7 1.5 0.8 0.2 0.2 1.8 | ||
300 400 5.1 0.9 1.0 4.4 1.6 2.5 1.7 1.5 0.8 0.3 0.3 1.8 | ||
400 500 9.4 2.0 0.9 4.0 1.6 2.6 2.3 1.5 0.8 0.5 0.4 1.8 | ||
500 700 11 2.0 0.8 3.1 1.6 2.6 2.4 1.5 0.8 0.2 0.3 1.8 | ||
700 1000 24 4.0 0.6 4.3 1.6 2.6 2.8 1.5 0.8 0.2 0.4 1.8 | ||
1000 1500 50 7.6 0.4 3.1 1.7 2.5 3.3 1.5 0.8 0.3 0.4 1.8 |
Oops, something went wrong.