From 7172853641d1cc1dc4d33e6265e114731868b64c Mon Sep 17 00:00:00 2001 From: rkansal47 Date: Sat, 1 Jun 2024 15:58:30 -0500 Subject: [PATCH] bdt lp sf plots --- src/HHbbVV/postprocessing/PostProcess.ipynb | 29 ++++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/HHbbVV/postprocessing/PostProcess.ipynb b/src/HHbbVV/postprocessing/PostProcess.ipynb index b8cda9bb..8c299bc5 100644 --- a/src/HHbbVV/postprocessing/PostProcess.ipynb +++ b/src/HHbbVV/postprocessing/PostProcess.ipynb @@ -84,7 +84,7 @@ "year = \"2018\"\n", "bdt_preds_dir = samples_dir / \"24_04_05_k2v0_training_eqsig_vbf_vars_rm_deta/inferences\"\n", "\n", - "date = \"24May31\"\n", + "date = \"24Jun1\"\n", "plot_dir = MAIN_DIR / f\"plots/PostProcessing/{date}LPSFs\"\n", "templates_dir = f\"templates/{date}\"\n", "_ = os.system(f\"mkdir -p {plot_dir}\")\n", @@ -135,7 +135,13 @@ "cutflow = pd.DataFrame(index=list(samples.keys()) + list(nonres_samples.keys()))\n", "\n", "events_dict = postprocessing.load_samples(\n", - " samples_dir, {**nonres_samples, **samples}, year, filters, hem_cleaning=False, variations=False\n", + " # samples_dir, {**nonres_samples, **samples}, year, filters, hem_cleaning=False, variations=False\n", + " samples_dir,\n", + " {**nonres_samples},\n", + " year,\n", + " filters,\n", + " hem_cleaning=False,\n", + " variations=False,\n", ")\n", "# events_dict |= postprocessing.load_samples(samples_dir, {\"Data\": \"JetHT\"}, year, filters, hem_cleaning=False)\n", "\n", @@ -447,7 +453,13 @@ " # var=\"bbFatJetPt\", label=r\"$p^{bb}_T$ (GeV)\", bins=[20, 300, 2300], significance_dir=\"right\"\n", " # ),\n", " # ShapeVar(var=\"bbFatJetParticleNetMass\", label=r\"$m^{bb}_{reg}$ (GeV)\", bins=[20, 50, 250]),\n", - " ShapeVar(var=\"BDTScore\", label=r\"BDT Score\", bins=[20, 0, 1]),\n", + " ShapeVar(var=\"BDTScore\", label=r\"$BDT_{ggF}$\", bins=[20, 0, 1]),\n", + " ShapeVar(var=\"BDTScore\", label=r\"$BDT_{ggF}$\", bins=[20, 0.9, 1]),\n", + " ShapeVar(var=\"BDTScore\", label=r\"$BDT_{ggF}$\", bins=[20, 0.99, 1]),\n", + " ShapeVar(var=\"BDTScoreVBF\", label=r\"$BDT_{VBF}$\", bins=[20, 0, 1]),\n", + " ShapeVar(var=\"BDTScoreVBF\", label=r\"$BDT_{VBF}$\", bins=[20, 0.9, 1]),\n", + " ShapeVar(var=\"BDTScoreVBF\", label=r\"$BDT_{VBF}$\", bins=[20, 0.99, 1]),\n", + " # ShapeVar(var=\"BDTScore\", label=r\"BDT Score\", bins=[20, 0, 1]),\n", "]\n", "\n", "\n", @@ -456,8 +468,9 @@ " bb_mask = bb_masks[sig_key]\n", " weight = events[\"finalWeight\"].values.squeeze()\n", " weight_lp = weight * events[\"VV_lp_sf_nom\"].values.squeeze()\n", - " weight_lp_sys_up = weight * events[\"VV_lp_sf_sys_up\"].values.squeeze()\n", - " weight_lp_sys_down = weight * events[\"VV_lp_sf_sys_down\"].values.squeeze()\n", + " weight_lp *= weight.sum() / weight_lp.sum()\n", + " # weight_lp_sys_up = weight * events[\"VV_lp_sf_sys_up\"].values.squeeze()\n", + " # weight_lp_sys_down = weight * events[\"VV_lp_sf_sys_down\"].values.squeeze()\n", "\n", " for shape_var in control_plot_vars:\n", " h = Hist(\n", @@ -482,7 +495,8 @@ " }\n", " )\n", "\n", - " for norm in [True, False]:\n", + " # for norm in [True, False]:\n", + " for norm in [False]:\n", " fig, ax = plt.subplots(figsize=(10, 10))\n", "\n", " for l in [\"Pre-LP\", \"Post-LP\"]:\n", @@ -504,7 +518,8 @@ "\n", " norm_str = \"_norm\" if norm else \"\"\n", " plt.savefig(\n", - " plot_dir / f\"{year}_{shape_var.var}_{sig_key}_lpsf{norm_str}.pdf\",\n", + " plot_dir\n", + " / f\"{year}_{shape_var.var}_{sig_key}_lpsf{norm_str}_{shape_var.bins[1]}.pdf\",\n", " bbox_inches=\"tight\",\n", " )\n", " plt.show()"