diff --git a/hbt/config/configs_hbt.py b/hbt/config/configs_hbt.py index 36d49de..9cc8ff3 100644 --- a/hbt/config/configs_hbt.py +++ b/hbt/config/configs_hbt.py @@ -7,6 +7,7 @@ from __future__ import annotations import os +import re import itertools import functools @@ -345,7 +346,6 @@ def if_not_era(*, values: list[str | None] | None = None, **kwargs) -> list[str] # add the dataset dataset = cfg.add_dataset(campaign.get_dataset(dataset_name)) - # add tags to datasets if dataset.name.startswith("data_e_"): dataset.add_tag({"etau", "emu_from_e", "ee"}) @@ -359,8 +359,12 @@ def if_not_era(*, values: list[str | None] | None = None, **kwargs) -> list[str] dataset.add_tag({"has_top", "single_top", "st"}) if dataset.name.startswith("dy_"): dataset.add_tag("dy") + if re.match(r"^dy_m50toinf_\dj_(|pt.+_)amcatnlo$", dataset.name): + dataset.add_tag("dy_stitched") if dataset.name.startswith("w_lnu_"): dataset.add_tag("w_lnu") + if re.match(r"^w_lnu_\dj_(|pt.+_)amcatnlo$", dataset.name): + dataset.add_tag("w_lnu_stitched") # datasets that are known to have no lhe info at all if law.util.multi_match(dataset.name, [ r"^(ww|wz|zz)_.*pythia$", @@ -510,10 +514,29 @@ def if_not_era(*, values: list[str | None] | None = None, **kwargs) -> list[str] dataset.name for dataset in cfg.datasets if dataset.is_mc and not dataset.has_tag("signal") ]), + "backgrounds_unstitched": (backgrounds_unstitched := [ + dataset.name for dataset in cfg.datasets + if ( + dataset.is_mc and + not dataset.has_tag("signal") and + not dataset.has_tag({"dy_stitched", "w_lnu_stitched"}, mode=any) + ) + ]), "sm_ggf": (sm_ggf_group := ["hh_ggf_hbb_htt_kl1_kt1_powheg", *backgrounds]), - "sm": (sm_group := ["hh_ggf_hbb_htt_kl1_kt1_powheg", "hh_vbf_hbb_htt_kv1_k2v1_kl1_madgraph", *backgrounds]), + "sm": (sm_group := [ + "hh_ggf_hbb_htt_kl1_kt1_powheg", + "hh_vbf_hbb_htt_kv1_k2v1_kl1_madgraph", + *backgrounds, + ], + ), + "sm_unstitched": (sm_group_unstitched := [ + "hh_ggf_hbb_htt_kl1_kt1_powheg", + "hh_vbf_hbb_htt_kv1_k2v1_kl1_madgraph", + *backgrounds_unstitched, + ]), "sm_ggf_data": data_group + sm_ggf_group, "sm_data": data_group + sm_group, + "sm_data_unstitched": data_group + sm_group_unstitched, "dy": [dataset.name for dataset in cfg.datasets if dataset.has_tag("dy")], "w_lnu": [dataset.name for dataset in cfg.datasets if dataset.has_tag("w_lnu")], } diff --git a/hbt/config/variables.py b/hbt/config/variables.py index 2d0cbfb..54d87c3 100644 --- a/hbt/config/variables.py +++ b/hbt/config/variables.py @@ -41,14 +41,6 @@ def add_variables(config: od.Config) -> None: x_title="Luminosity block", discrete_x=True, ) - add_variable( - config, - name="n_jet", - expression="n_jet", - binning=(11, -0.5, 10.5), - x_title="Number of jets", - discrete_x=True, - ) add_variable( config, name="n_hhbtag", @@ -640,6 +632,15 @@ def build_hh(events, which=None): x_title=r"Subleading muon $\phi$", ) + add_variable( + config, + name="njets", + expression=lambda events: ak.num(events.Jet["pt"], axis=1), + aux={"inputs": {"Jet.pt"}}, + binning=(11, -0.5, 10.5), + x_title=r"Number of jets", + ) + for proc in ["hh", "tt", "dy"]: # outputs of the resonant pDNN at SM-like mass and spin values add_variable( diff --git a/hbt/weight/default.py b/hbt/weight/default.py index fe2ecd0..bea787a 100644 --- a/hbt/weight/default.py +++ b/hbt/weight/default.py @@ -60,6 +60,12 @@ def default_init(self: WeightProducer) -> None: } +normalization_inclusive = default.derive( + "normalization_inclusive", + cls_dict={"drop_weights": {"normalization_weight"}}, +) + + normalization_only = default.derive( "normalization_only", cls_dict={"keep_weights": {"normalization_weight"}},