From 1ec336de21682598dafb96261dac54939842cd35 Mon Sep 17 00:00:00 2001 From: Lindsey Gray Date: Wed, 8 Jan 2025 09:33:36 -0600 Subject: [PATCH] allow JetResolution to handle additional filename metadata --- src/coffea/jetmet_tools/JetResolution.py | 9 +++++---- src/coffea/lookup_tools/extractor.py | 1 + ...234_JRV1_MC_PtResolution_AK4PFPuppi.jr.txt.gz | Bin 0 -> 3480 bytes tests/test_jetmet_tools.py | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 tests/samples/Summer23Prompt23_RunCv1234_JRV1_MC_PtResolution_AK4PFPuppi.jr.txt.gz diff --git a/src/coffea/jetmet_tools/JetResolution.py b/src/coffea/jetmet_tools/JetResolution.py index 59c5c4bd4..da07c26cf 100644 --- a/src/coffea/jetmet_tools/JetResolution.py +++ b/src/coffea/jetmet_tools/JetResolution.py @@ -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!") diff --git a/src/coffea/lookup_tools/extractor.py b/src/coffea/lookup_tools/extractor.py index 7b217601f..364ced315 100644 --- a/src/coffea/lookup_tools/extractor.py +++ b/src/coffea/lookup_tools/extractor.py @@ -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, diff --git a/tests/samples/Summer23Prompt23_RunCv1234_JRV1_MC_PtResolution_AK4PFPuppi.jr.txt.gz b/tests/samples/Summer23Prompt23_RunCv1234_JRV1_MC_PtResolution_AK4PFPuppi.jr.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..c22e9ef6ff7d07f9d4fb7a9b77ab7beee936667b GIT binary patch literal 3480 zcmXYydpOhm|Hp^BP;MrNxSh|H+MK?3Ls(39Z$gVXG`5_Q+j-`&977snXszUsQ|xvY zl?h4AF=XUaD$FUZ(8R*;({=s+_*~cX`Tjhv_w|0gUx&9!x`;^Iy|`;2q06MeK%X!J zLx-^7z>shQLp+8QWEG)rU}%I#VX*r6i&l7taEuQzIDiy>Jvaz|9&O}s!GRPKavc&L z6%J}En8{SIm+aw2r?uG%D(}Wbfr6e}&R%HwsbMWBDyf=&J2@)Szo#%XetdEAf0(N$ zzmwZO%wZ$r$H&Jj4wBE3f98T#AuPXZ|-)_V1dWR{k8dx7lx0HI~`;QK#QfpM|6rGMt z_yn#8#@y~zIJH>bF%t6@v%5!UmP=fa($|THCfW1~(YiJSbK)w+I@nNi+Fk)i%4r=( zKPzok5rLwcb-(|ZXYjANnG%XGim4c|v>@>ZrZN8BwU1Z^YdIR@%r7?rceGyX-CMYo z0hO+{qtp5|zx3WcV)NK-t|v9wakUZB%~$#-)6cTqfsS&Y(0X=bv_*?8`?ao;&_&dx zG0QlYzwURR8K=j^FCuk@*D#EM7a4&$xbqB+Mrp~G;^nEL73d0!$JD$U6cl^<8aK_c zUW_s3Q(B_<7xF*CwbnGXuPIY?Vb2Z}Y+YkTN%V`Jd}4IMda}G*U}3 zMEaQWA;xI=_CVY6EXFdGqhTE-g{eTR$l@hR^9MSUAm}0?$xO%9oQy$m5Y6D0Wn9e8 z2&w>LMq8{Lm>Bzc{O7Dzwkn2!-Z&KKrz#!Pa>>vZuD5Rbdo_}iPVkjomKgL z)VL!(*us)$^WD?d{3%u#a9>6|N|F-77R=%~Q>XVEO%axzye&cC)M0C(;J$^}o7Ci~ zOIy}cb53`lxv3D7ZGG@RS}3eRSwzf(BUZ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_tools.py b/tests/test_jetmet_tools.py index 9ba7af610..c3a552923 100644 --- a/tests/test_jetmet_tools.py +++ b/tests/test_jetmet_tools.py @@ -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", ] @@ -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)