Skip to content

Commit

Permalink
Merge pull request #61 from uhh-cms/stitching_debuggin_objects
Browse files Browse the repository at this point in the history
Add unstitched tags and Datasets for debugging purpose
  • Loading branch information
riga authored Jan 24, 2025
2 parents d1a3a6c + e17f6a4 commit 3b567d5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
27 changes: 25 additions & 2 deletions hbt/config/configs_hbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from __future__ import annotations

import os
import re
import itertools
import functools

Expand Down Expand Up @@ -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"})
Expand All @@ -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$",
Expand Down Expand Up @@ -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")],
}
Expand Down
17 changes: 9 additions & 8 deletions hbt/config/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 6 additions & 0 deletions hbt/weight/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}},
Expand Down

0 comments on commit 3b567d5

Please sign in to comment.