Skip to content

Commit

Permalink
Merge pull request #102 from uhh-cms/plot_postfit_shapes
Browse files Browse the repository at this point in the history
Plot postfit shapes
  • Loading branch information
mafrahm authored Jan 24, 2025
2 parents f871768 + 73e3a98 commit 36f9e2d
Show file tree
Hide file tree
Showing 12 changed files with 699 additions and 166 deletions.
1 change: 1 addition & 0 deletions hbw/categorization/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def catid_2b(self: Categorizer, events: ak.Array, **kwargs) -> tuple[ak.Array, a
# TODO: not hard-coded -> use config?
ml_processes = [
"signal_ggf", "signal_ggf2", "signal_vbf", "signal_vbf2",
"signal_ggf4", "signal_ggf5", "signal_vbf4", "signal_vbf5",
"hh_ggf_hbb_hvv_kl1_kt1", "hh_vbf_hbb_hvv_kv1_k2v1_kl1",
"hh_ggf_hbb_hvvqqlnu_kl1_kt1", "hh_vbf_hbb_hvvqqlnu_kv1_k2v1_kl1",
"hh_ggf_hbb_hvv2l2nu_kl1_kt1", "hh_vbf_hbb_hvv2l2nu_kv1_k2v1_kl1",
Expand Down
44 changes: 40 additions & 4 deletions hbw/config/defaults_and_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,38 @@ def set_config_defaults_and_groups(config_inst):
# process groups for conveniently looping over certain processs
# (used in wrapper_factory and during plotting)
config_inst.x.process_groups = {
"ml_study": [
"hh_vbf_hbb_hww2l2nu_kv1p74_k2v1p37_kl14p4",
"hh_vbf_hbb_hww2l2nu_kvm0p758_k2v1p44_klm19p3",
"hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kvm2p12_k2v3p87_klm5p96",
"hh_vbf_hbb_hww2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hww2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hww2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hww2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hww2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hww2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hww2l2nu_kl0_kt1",
"hh_ggf_hbb_hww2l2nu_kl1_kt1",
"hh_ggf_hbb_hww2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hww2l2nu_kl5_kt1",
"st",
"tt",
"dy_m4to10", "dy_m10to50", "dy_m50toinf",
"w_lnu",
"vv",
"h_ggf", "h_vbf", "zh", "wh", "zh_gg", "tth",
],
"test_postfit": [
# "hh_vbf_hbb_hww2l2nu",
"hh_ggf_hbb_hww2l2nu",
"st",
"tt",
"dy",
"w_lnu",
"vv",
"h",
],
"all": ["*"],
"default": ["hh_ggf_hbb_hvv_kl1_kt1", "hh_vbf_hbb_hvv_kv1_k2v1_kl1", "tt", "dy", "st", "vv", "w_lnu", "h"], # noqa: E501
"sl": ["hh_ggf_hbb_hvv_kl1_kt1", "hh_vbf_hbb_hvv_kv1_k2v1_kl1", "tt", "qcd", "st", "dy", "vv", "w_lnu", "h"], # noqa: E501
Expand Down Expand Up @@ -282,10 +314,15 @@ def set_config_defaults_and_groups(config_inst):
),
# Dilepton
"SR_dl": (
"sr__1b__ml_signal_ggf", "sr__1b__ml_signal_ggf2", "sr__2b__ml_signal_ggf", "sr__2b__ml_signal_ggf2",
"sr__1b__ml_signal_vbf", "sr__1b__ml_signal_vbf2", "sr__2b__ml_signal_vbf", "sr__2b__ml_signal_vbf2",
"sr__1b__ml_signal_ggf4", "sr__1b__ml_signal_ggf5", "sr__2b__ml_signal_ggf4", "sr__2b__ml_signal_ggf5",
"sr__1b__ml_signal_vbf4", "sr__1b__ml_signal_vbf5", "sr__2b__ml_signal_vbf4", "sr__2b__ml_signal_vbf5",
"sr__1b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1", "sr__2b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1",
"sr__2mu__1b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1", "sr__2mu__2b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1",
"sr__2e__1b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1", "sr__2e__2b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1",
"sr__emu__1b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1", "sr__emu__2b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1",
"sr__1b", "sr__2b",
),
"vbfSR_dl": (
"sr__1b__ml_hh_vbf_hbb_hvv2l2nu_kv1_k2v1_kl1", "sr__2b__ml_hh_vbf_hbb_hvv2l2nu_kv1_k2v1_kl1",
Expand Down Expand Up @@ -372,10 +409,8 @@ def set_config_defaults_and_groups(config_inst):
for proc, _, _ in config_inst.walk_processes() if proc.has_tag("is_signal")
},
"dilep": {
"hh_ggf_hbb_hvv2l2nu_kl0_kt1": {"scale": 10000, "unstack": True},
"hh_ggf_hbb_hvv2l2nu_kl1_kt1": {"scale": 10000, "unstack": True},
"hh_ggf_hbb_hvv2l2nu_kl2p45_kt1": {"scale": 10000, "unstack": True},
"hh_ggf_hbb_hvv2l2nu_kl5_kt1": {"scale": 10000, "unstack": True},
"hh_vbf_hbb_hww2l2nu": {"scale": 90000, "unstack": True},
"hh_ggf_hbb_hww2l2nu": {"scale": 10000, "unstack": True},
},
"dileptest": {
"hh_ggf_hbb_hvv2l2nu_kl1_kt1": {"scale": 10000, "unstack": True},
Expand Down Expand Up @@ -478,4 +513,5 @@ def set_config_defaults_and_groups(config_inst):
"vbfSR_dl_resolved": is_signal_sm,
"vbfSR_dl_boosted": is_signal_sm,
"BR_dl": is_background,

}
2 changes: 1 addition & 1 deletion hbw/inference/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def config_variable(self: InferenceModel, config_cat_inst: od.Config):
dnn_proc = dnn_cat.replace("ml_", "")
return f"mlscore.{dnn_proc}"
else:
return "mli_mbb"
return "mli_lep_pt"

def customize_category(self: InferenceModel, cat_inst: DotDict, config_cat_inst: od.Config):
""" Function to allow customizing the inference category """
Expand Down
233 changes: 211 additions & 22 deletions hbw/inference/dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,94 @@
# "hh_ggf_hbb_hvv2l2nu_kl2p45_kt1",
# "hh_ggf_hbb_hvv2l2nu_kl5_kt1",

dl.derive("dl_ml_study_5", cls_dict={
"ml_model_name": "dl_22post_ml_study_5",
"config_categories": [
"sr__1b__ml_signal_ggf5",
"sr__1b__ml_signal_vbf5",
"sr__1b__ml_tt",
"sr__1b__ml_st",
"sr__1b__ml_dy",
"sr__1b__ml_h",
"sr__2b__ml_signal_ggf5",
"sr__2b__ml_signal_vbf5",
"sr__2b__ml_tt",
"sr__2b__ml_st",
"sr__2b__ml_dy",
"sr__2b__ml_h",
],
"processes": [
# qqHH_CV_m0p012_C2V_0p03_kl_10p2
# "hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kv1p74_k2v1p37_kl14p4",
"hh_vbf_hbb_hww2l2nu_kvm0p758_k2v1p44_klm19p3",
"hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kvm2p12_k2v3p87_klm5p96",
"hh_vbf_hbb_hww2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hww2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hww2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hww2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hww2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hww2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hww2l2nu_kl0_kt1",
"hh_ggf_hbb_hww2l2nu_kl1_kt1",
"hh_ggf_hbb_hww2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hww2l2nu_kl5_kt1",
"st",
"tt",
"dy",
"w_lnu",
"vv",
"h_ggf", "h_vbf", "zh", "wh", "zh_gg", "tth",
],
"systematics": rate_systematics,
})

dl.derive("dl_ml_study_1", cls_dict={
dl.derive("dl_ml_study_4", cls_dict={
"ml_model_name": "dl_22post_ml_study_4",
"config_categories": [
"sr__1b__ml_signal_ggf4",
"sr__1b__ml_signal_vbf4",
"sr__1b__ml_tt",
"sr__1b__ml_st",
"sr__1b__ml_dy",
"sr__1b__ml_h",
"sr__2b__ml_signal_ggf4",
"sr__2b__ml_signal_vbf4",
"sr__2b__ml_tt",
"sr__2b__ml_st",
"sr__2b__ml_dy",
"sr__2b__ml_h",
],
"processes": [
# qqHH_CV_m0p012_C2V_0p03_kl_10p2
# "hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kv1p74_k2v1p37_kl14p4",
"hh_vbf_hbb_hww2l2nu_kvm0p758_k2v1p44_klm19p3",
"hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kvm2p12_k2v3p87_klm5p96",
"hh_vbf_hbb_hww2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hww2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hww2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hww2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hww2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hww2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hww2l2nu_kl0_kt1",
"hh_ggf_hbb_hww2l2nu_kl1_kt1",
"hh_ggf_hbb_hww2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hww2l2nu_kl5_kt1",
"st",
"tt",
"dy",
"w_lnu",
"vv",
"h_ggf", "h_vbf", "zh", "wh", "zh_gg", "tth",
],
"systematics": rate_systematics,
})


dl_ml_study_1 = dl.derive("dl_ml_study_1", cls_dict={
"ml_model_name": "dl_22post_ml_study_1",
"config_categories": [
"sr__1b__ml_signal_ggf",
Expand All @@ -171,16 +257,69 @@
"sr__2b__ml_h",
],
"processes": [
"hh_vbf_hbb_hvv2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hvv2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hvv2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hvv2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hvv2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hvv2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hvv2l2nu_kl0_kt1",
"hh_ggf_hbb_hvv2l2nu_kl1_kt1",
"hh_ggf_hbb_hvv2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hvv2l2nu_kl5_kt1",
# qqHH_CV_m0p012_C2V_0p03_kl_10p2
# "hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kv1p74_k2v1p37_kl14p4",
"hh_vbf_hbb_hww2l2nu_kvm0p758_k2v1p44_klm19p3",
"hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kvm2p12_k2v3p87_klm5p96",
"hh_vbf_hbb_hww2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hww2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hww2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hww2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hww2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hww2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hww2l2nu_kl0_kt1",
"hh_ggf_hbb_hww2l2nu_kl1_kt1",
"hh_ggf_hbb_hww2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hww2l2nu_kl5_kt1",
"st",
"tt",
"dy",
"w_lnu",
"vv",
"h_ggf", "h_vbf", "zh", "wh", "zh_gg", "tth",
],
"systematics": rate_systematics,
})

dl_ml_study_1.derive("dl_ml_study_1_handle", cls_dict={
"ml_model_name": "dl_22post_ml_study_1_handle",
})

dl_ml_study_3 = dl.derive("dl_ml_study_3", cls_dict={
"ml_model_name": "dl_22_procs1_w0",
"config_categories": [
"sr__1b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1",
"sr__1b__ml_hh_vbf_hbb_hvv2l2nu_kv1_k2v1_kl1",
"sr__1b__ml_tt",
"sr__1b__ml_st",
"sr__1b__ml_dy",
"sr__1b__ml_h",
"sr__2b__ml_hh_ggf_hbb_hvv2l2nu_kl1_kt1",
"sr__2b__ml_hh_vbf_hbb_hvv2l2nu_kv1_k2v1_kl1",
"sr__2b__ml_tt",
"sr__2b__ml_st",
"sr__2b__ml_dy",
"sr__2b__ml_h",
],
"processes": [
# "hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kv1p74_k2v1p37_kl14p4",
"hh_vbf_hbb_hww2l2nu_kvm0p758_k2v1p44_klm19p3",
"hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kvm2p12_k2v3p87_klm5p96",
"hh_vbf_hbb_hww2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hww2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hww2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hww2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hww2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hww2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hww2l2nu_kl0_kt1",
"hh_ggf_hbb_hww2l2nu_kl1_kt1",
"hh_ggf_hbb_hww2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hww2l2nu_kl5_kt1",
"st",
"tt",
"dy",
"w_lnu",
Expand All @@ -190,7 +329,11 @@
"systematics": rate_systematics,
})

dl.derive("dl_ml_study_2", cls_dict={
dl_ml_study_3.derive("dl_ml_study_3_handle", cls_dict={
"ml_model_name": "dl_22_procs1_w0_handle",
})

dl_ml_study_2 = dl.derive("dl_ml_study_2", cls_dict={
"ml_model_name": "dl_22post_ml_study_2",
"config_categories": [
"sr__1b__ml_signal_ggf2",
Expand All @@ -207,16 +350,22 @@
"sr__2b__ml_h",
],
"processes": [
"hh_vbf_hbb_hvv2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hvv2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hvv2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hvv2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hvv2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hvv2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hvv2l2nu_kl0_kt1",
"hh_ggf_hbb_hvv2l2nu_kl1_kt1",
"hh_ggf_hbb_hvv2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hvv2l2nu_kl5_kt1",
# "hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kv1p74_k2v1p37_kl14p4",
"hh_vbf_hbb_hww2l2nu_kvm0p758_k2v1p44_klm19p3",
"hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kvm2p12_k2v3p87_klm5p96",
"hh_vbf_hbb_hww2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hww2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hww2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hww2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hww2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hww2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hww2l2nu_kl0_kt1",
"hh_ggf_hbb_hww2l2nu_kl1_kt1",
"hh_ggf_hbb_hww2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hww2l2nu_kl5_kt1",
"st",
"tt",
"dy",
"w_lnu",
Expand All @@ -226,6 +375,14 @@
"systematics": rate_systematics,
})

dl_ml_study_2.derive("dl_ml_study_2_handle", cls_dict={
"ml_model_name": "dl_22post_ml_study_2_handle",
})

dl_ml_study_2.derive("dl_ml_study_2_ignore", cls_dict={
"ml_model_name": "dl_22post_ml_study_2",
})

dl.derive("dl_hww_and_hzz", cls_dict={
"processes": [
"hh_ggf_hbb_hww_kl0_kt1",
Expand Down Expand Up @@ -390,3 +547,35 @@
"systematics": rate_systematics},
)
dl.derive("dl_rates_only", cls_dict={"systematics": rate_systematics})

dl.derive("dl_postfit_test", cls_dict={
"ml_model_name": None,
"config_categories": [
"sr__1b",
"sr__2b",
],
"processes": [
# "hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kv1p74_k2v1p37_kl14p4",
"hh_vbf_hbb_hww2l2nu_kvm0p758_k2v1p44_klm19p3",
"hh_vbf_hbb_hww2l2nu_kvm0p012_k2v0p03_kl10p2",
"hh_vbf_hbb_hww2l2nu_kvm2p12_k2v3p87_klm5p96",
"hh_vbf_hbb_hww2l2nu_kv1_k2v1_kl1",
"hh_vbf_hbb_hww2l2nu_kv1_k2v0_kl1",
"hh_vbf_hbb_hww2l2nu_kvm0p962_k2v0p959_klm1p43",
"hh_vbf_hbb_hww2l2nu_kvm1p21_k2v1p94_klm0p94",
"hh_vbf_hbb_hww2l2nu_kvm1p6_k2v2p72_klm1p36",
"hh_vbf_hbb_hww2l2nu_kvm1p83_k2v3p57_klm3p39",
"hh_ggf_hbb_hww2l2nu_kl0_kt1",
"hh_ggf_hbb_hww2l2nu_kl1_kt1",
"hh_ggf_hbb_hww2l2nu_kl2p45_kt1",
"hh_ggf_hbb_hww2l2nu_kl5_kt1",
"st",
"tt",
"dy",
"w_lnu",
"vv",
"h_ggf", "h_vbf", "zh", "wh", "zh_gg", "tth",
],
"systematics": rate_systematics,
})
Loading

0 comments on commit 36f9e2d

Please sign in to comment.