Skip to content

Commit

Permalink
bdt lp sf plots
Browse files Browse the repository at this point in the history
  • Loading branch information
rkansal47 committed Jun 1, 2024
1 parent 6a433c7 commit 7172853
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/HHbbVV/postprocessing/PostProcess.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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()"
Expand Down

0 comments on commit 7172853

Please sign in to comment.