Skip to content
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

fix: allow JetResolution to handle additional filename metadata #1240

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/coffea/jetmet_tools/JetResolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ def __init__(self, **kwargs):
)
)
info = name.split("_")
if len(info) != 5:
if len(info) > 6 or len(info) < 5:
raise Exception("Corrector name is not properly formatted!")
offset = len(info) - 5

campaign = _checkConsistency(campaign, info[0])
dataera = _checkConsistency(dataera, info[1])
datatype = _checkConsistency(datatype, info[2])
levels.append(info[3])
datatype = _checkConsistency(datatype, info[2 + offset])
levels.append(info[3 + offset])
funcs.append(func)
jettype = _checkConsistency(jettype, info[4])
jettype = _checkConsistency(jettype, info[4 + offset])

if campaign is None:
raise Exception("Unable to determine production campaign of JECs!")
Expand Down
1 change: 1 addition & 0 deletions src/coffea/lookup_tools/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"jec": convert_jec_txt_file,
"jersf": convert_jersf_txt_file,
"jr": convert_jr_txt_file,
"jer": convert_jr_txt_file,
"junc": convert_junc_txt_file,
"ea": convert_effective_area_file,
"pileup": convert_pileup_json_file,
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/test_jetmet_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def jetmet_evaluator():
"* * tests/samples/RegroupedV2_Fall17_17Nov2017_V32_MC_UncertaintySources_AK4PFchs.junc.txt.gz",
"* * tests/samples/Regrouped_Fall17_17Nov2017_V32_MC_UncertaintySources_AK4PFchs.junc.txt",
"* * tests/samples/Spring16_25nsV10_MC_PtResolution_AK4PFPuppi.jr.txt.gz",
"* * tests/samples/Summer23Prompt23_RunCv1234_JRV1_MC_PtResolution_AK4PFPuppi.jr.txt.gz",
"* * tests/samples/Spring16_25nsV10_MC_SF_AK4PFPuppi.jersf.txt.gz",
"* * tests/samples/Autumn18_V7_MC_SF_AK4PFchs.jersf.txt.gz",
]
Expand Down Expand Up @@ -312,6 +313,9 @@ def test_jet_resolution(optimization_enabled):
jer_names = ["Spring16_25nsV10_MC_PtResolution_AK4PFPuppi"]
reso = JetResolution(**{name: evaluator[name] for name in jer_names})

check2023_names = ["Summer23Prompt23_RunCv1234_JRV1_MC_PtResolution_AK4PFPuppi"]
_ = JetResolution(**{name: evaluator[name] for name in check2023_names})

print(reso)

resos = reso.getResolution(JetEta=test_eta, Rho=test_Rho, JetPt=test_pt)
Expand Down
Loading