-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplement ATLAS Z0 7 TeV Low mass #2171
Open
comane
wants to merge
21
commits into
master
Choose a base branch
from
reimplement_ATLAS_Z0_7TEV_LOMASS
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
cb9ae42
rebase
comane 387d0d9
added url to inspire
comane c703b25
added no of hepdata table
comane e28ee7c
added hepdata
comane 41d597c
added systematics data from page 22 of preprint 1404.1212
comane 45461f0
added rawdata in csv format
comane f1dd687
added filter utils file
comane b51b884
added filter for data and kinematics
comane fc0abbb
added data.yaml
comane 555e3b3
added kinematics.yaml
comane 908e71d
added get sys to filter utils
comane 6585b31
uncertainties.yaml file
comane 552059d
written filter for systematics
comane 8e63c0c
removed legacy data central values are they are the same
comane 3577196
corrected csv dataset
comane 63e0e35
take stat uncertainty from the HEP data file
comane 890a34b
set stat unc to ADD
comane 5eb61fb
renamed kins, override -> id, process type -> DY_MLL
comane 610831a
removed legacy version
comane 5c11cb0
added back EICC rawdata
comane 60934c3
added legacy back
comane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
86 changes: 86 additions & 0 deletions
86
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/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,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() |
81 changes: 81 additions & 0 deletions
81
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/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,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 |
49 changes: 49 additions & 0 deletions
49
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/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,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 |
73 changes: 0 additions & 73 deletions
73
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/kinematics_M.yaml
This file was deleted.
Oops, something went wrong.
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
7 changes: 7 additions & 0 deletions
7
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/rawdata/ATLASLOMASSDY11EXT.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,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 |
16 changes: 16 additions & 0 deletions
16
nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_LOMASS/rawdata/ATLASLOMASSDY11EXT.data
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The filter doesn't seem to use this file, it uses the .csv instead. Is there any reason to keep both? |
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,16 @@ | ||
Mlow Mhigh y stat+ stat- sys_reco sys_trig sys_iso sys_mjet sys_pTsc sys_res sys_MC Lumi | ||
----------------------------------------------------------------------------------------------------------------------------- | ||
12.0 17.0 12.41 +0.52122 -0.52122 2.5 4.0 11.3 -3.0 -0.2 0.5 0.6 3.5 | ||
17.0 22.0 22.57 +0.69967 -0.69967 1.4 3.7 11.3 -2.8 0.1 0.3 0.3 3.5 | ||
22.0 28.0 14.64 +0.48312 -0.48312 0.9 3.6 8.5 -1.8 0.0 0.1 0.4 3.5 | ||
28.0 36.0 6.73 +0.26920 -0.26920 0.7 3.6 6.2 -1.6 -0.1 0.2 0.4 3.5 | ||
36.0 46.0 2.81 +0.14612 -0.14612 0.7 3.6 4.2 -1.3 -0.1 0.1 0.5 3.5 | ||
46.0 66.0 1.27 +0.05969 -0.05969 0.6 3.6 3.6 -0.7 -0.0 0.1 0.5 3.5 | ||
|
||
|
||
Path: /HepData/8644/d6-x1-y1 | ||
Born-level fiducial differential cross section dsigma/dm_ll [pb/GeV], with statistical, systematic and Lumi uncertainties | ||
Location: Table 6-7, Page 22 of preprint | ||
RE : P P --> MU+ MU- X | ||
SQRT(S) : 7000.0 GeV | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this file in the history, so it'd be better if you squash your commits and force push I think!