From 6dc169e3911ae48bc9756711c4de078dffc589cf Mon Sep 17 00:00:00 2001 From: anmalara Date: Fri, 17 Mar 2023 18:17:48 +0100 Subject: [PATCH] remove ULEGACYV8 variable --- bucoffea/config/vbfhinv.yaml | 1 - bucoffea/helpers/weights.py | 33 ++++++++++------------------ bucoffea/vbfhinv/vbfhinvProcessor.py | 16 ++++++-------- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/bucoffea/config/vbfhinv.yaml b/bucoffea/config/vbfhinv.yaml index 1bdbd538c..850355a43 100644 --- a/bucoffea/config/vbfhinv.yaml +++ b/bucoffea/config/vbfhinv.yaml @@ -222,7 +222,6 @@ default: run: sync: False - ulegacyv8: True one_fifth_unblind: False tight_mjj_cut: False qcd_estimation: True diff --git a/bucoffea/helpers/weights.py b/bucoffea/helpers/weights.py index d68c3751e..3c112f34b 100644 --- a/bucoffea/helpers/weights.py +++ b/bucoffea/helpers/weights.py @@ -67,31 +67,22 @@ def varied_weight(sfname, *args): ### Electrons (For UL: Both 2017 and 2018 have their SFs split by electron pt) - if extract_year(df['dataset']) == 2017 or cfg.RUN.ULEGACYV8: - high_et = electrons.pt>20 + high_et = electrons.pt>20 - # Low pt SFs - low_pt_args = (electrons.etasc[~high_et], electrons.pt[~high_et]) - ele_reco_sf_low = varied_weight('ele_reco_pt_lt_20', *low_pt_args) - ele_id_sf_low = varied_weight("ele_id_loose", *low_pt_args) + # Low pt SFs + low_pt_args = (electrons.etasc[~high_et], electrons.pt[~high_et]) + ele_reco_sf_low = varied_weight('ele_reco_pt_lt_20', *low_pt_args) + ele_id_sf_low = varied_weight("ele_id_loose", *low_pt_args) - # High pt SFs - high_pt_args = (electrons.etasc[high_et], electrons.pt[high_et]) + # High pt SFs + high_pt_args = (electrons.etasc[high_et], electrons.pt[high_et]) - ele_reco_sf_high = varied_weight("ele_reco", *high_pt_args) - ele_id_sf_high = varied_weight("ele_id_loose", *high_pt_args) - - # Combine - veto_weight_ele = (1 - ele_reco_sf_low*ele_id_sf_low).prod() * (1-ele_reco_sf_high*ele_id_sf_high).prod() - else: - # No split for 2018 - args = (electrons.etasc, electrons.pt) - ele_reco_sf = varied_weight("ele_reco", *args) - ele_id_sf = varied_weight("ele_id_loose", *args) - - # Combine - veto_weight_ele = (1 - ele_id_sf*ele_reco_sf).prod() + ele_reco_sf_high = varied_weight("ele_reco", *high_pt_args) + ele_id_sf_high = varied_weight("ele_id_loose", *high_pt_args) + # Combine + veto_weight_ele = (1 - ele_reco_sf_low*ele_id_sf_low).prod() * (1-ele_reco_sf_high*ele_id_sf_high).prod() + # Gen-checking for electrons if cfg.ELECTRON.GENCHECK: veto_weight_ele = gen_check_for_leptons(electrons, veto_weight_ele) diff --git a/bucoffea/vbfhinv/vbfhinvProcessor.py b/bucoffea/vbfhinv/vbfhinvProcessor.py index ee48054a3..af5cdf432 100644 --- a/bucoffea/vbfhinv/vbfhinvProcessor.py +++ b/bucoffea/vbfhinv/vbfhinvProcessor.py @@ -635,10 +635,9 @@ def ewk_correction(a, b): output['tree_float16'][region]["leadak4_chf"] += processor.column_accumulator(np.float16(diak4.i0.chf[mask])) output['tree_float16'][region]["leadak4_cef"] += processor.column_accumulator(np.float16(diak4.i0.cef[mask])) - if cfg.RUN.ULEGACYV8: - output['tree_float16'][region]["leadak4_setaeta"] += processor.column_accumulator(np.float16(diak4.i0.setaeta[mask])) - output['tree_float16'][region]["leadak4_sphiphi"] += processor.column_accumulator(np.float16(diak4.i0.sphiphi[mask])) - output['tree_float16'][region]["leadak4_cssize"] += processor.column_accumulator(np.float16(diak4.i0.hfcentralstripsize[mask])) + output['tree_float16'][region]["leadak4_setaeta"] += processor.column_accumulator(np.float16(diak4.i0.setaeta[mask])) + output['tree_float16'][region]["leadak4_sphiphi"] += processor.column_accumulator(np.float16(diak4.i0.sphiphi[mask])) + output['tree_float16'][region]["leadak4_cssize"] += processor.column_accumulator(np.float16(diak4.i0.hfcentralstripsize[mask])) output['tree_float16'][region]["trailak4_pt"] += processor.column_accumulator(np.float16(diak4.i1.pt[mask])) output['tree_float16'][region]["trailak4_eta"] += processor.column_accumulator(np.float16(diak4.i1.eta[mask])) @@ -648,10 +647,9 @@ def ewk_correction(a, b): output['tree_float16'][region]["trailak4_chf"] += processor.column_accumulator(np.float16(diak4.i1.chf[mask])) output['tree_float16'][region]["trailak4_cef"] += processor.column_accumulator(np.float16(diak4.i1.cef[mask])) - if cfg.RUN.ULEGACYV8: - output['tree_float16'][region]["trailak4_setaeta"] += processor.column_accumulator(np.float16(diak4.i1.setaeta[mask])) - output['tree_float16'][region]["trailak4_sphiphi"] += processor.column_accumulator(np.float16(diak4.i1.sphiphi[mask])) - output['tree_float16'][region]["trailak4_cssize"] += processor.column_accumulator(np.float16(diak4.i1.hfcentralstripsize[mask])) + output['tree_float16'][region]["trailak4_setaeta"] += processor.column_accumulator(np.float16(diak4.i1.setaeta[mask])) + output['tree_float16'][region]["trailak4_sphiphi"] += processor.column_accumulator(np.float16(diak4.i1.sphiphi[mask])) + output['tree_float16'][region]["trailak4_cssize"] += processor.column_accumulator(np.float16(diak4.i1.hfcentralstripsize[mask])) output['tree_float16'][region]["mjj"] += processor.column_accumulator(np.float16(df["mjj"][mask])) output['tree_float16'][region]["detajj"] += processor.column_accumulator(np.float16(df["detajj"][mask])) @@ -815,7 +813,7 @@ def ezfill(name, **kwargs): ezfill('ak4_central_eta', jeteta=get_more_central_jeteta(diak4)[mask].flatten(), weight=w_diak4) ezfill('ak4_forward_eta', jeteta=get_more_forward_jeteta(diak4)[mask].flatten(), weight=w_diak4) - if cfg.RUN.ULEGACYV8 and cfg.RUN.SAVE_HF_VARIABLES: + if cfg.RUN.SAVE_HF_VARIABLES: def is_hf_jet(_ak4, ptmin=80, etamin=2.9, etamax=5.0): return (_ak4.pt > ptmin) & (_ak4.abseta > etamin) & (_ak4.abseta < etamax)