Skip to content

Commit

Permalink
Merge branch 'update_lp' of https://github.com/rkansal47/HHbbVV into …
Browse files Browse the repository at this point in the history
…update_lp
  • Loading branch information
rkansal47 committed Jul 24, 2024
2 parents c92da81 + a289b66 commit b5a440a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 97 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ using the [coffea](https://coffeateam.github.io/coffea/) and
- [PlotFits](#plotfits)
- [Combine](#combine)
- [CMSSW + Combine Quickstart](#cmssw--combine-quickstart)
- [Packages](#packages)
- [Run fits and diagnostics locally](#run-fits-and-diagnostics-locally)
- [F-tests locally for non-resonant](#f-tests-locally-for-non-resonant)
- [Run fits on condor](#run-fits-on-condor)
Expand Down Expand Up @@ -272,6 +273,7 @@ Or to submit only the signal:

```bash
python src/condor/submit.py --year 2018 --tag $TAG --sample TTbar --subsamples TTToSemiLeptonic --processor ttsfs --submit
python src/condor/submit.py --year 2018 --tag $TAG --sample SingleTop --subsamples ST_tW_antitop_5f_NoFullyHadronicDecays ST_tW_top_5f_NoFullyHadronicDecays ST_s-channel_4f_leptonDecays ST_t-channel_antitop_4f_InclusiveDecays ST_t-channel_top_4f_InclusiveDecays --processor ttsfs --submit
```

## Condor Scripts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"metadata": {},
"outputs": [],
"source": [
"plot_dir = \"../../../plots/ttsfs/24Feb29_update_lps\"\n",
"plot_dir = \"../../../plots/ttsfs/24Mar1_update_lps\"\n",
"\n",
"import os\n",
"\n",
Expand Down Expand Up @@ -89,48 +89,10 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cutflow"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"utils.get_pickles(f\"{data_dir}/{year}/TTToSemiLeptonic/pickles\", year, \"TTToSemiLeptonic\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"utils.get_pickles(f\"{data_dir}/{year}/SingleMuon_Run2018C/pickles\", year, \"SingleMuon_Run2018D\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"utils.get_pickles(f\"{data_dir}/{year}/SingleMuon_Run2018D/pickles\", year, \"SingleMuon_Run2018D\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"9006700 / 10030532"
"HEM Veto Efficiency"
]
},
{
Expand All @@ -157,49 +119,39 @@
"metadata": {},
"outputs": [],
"source": [
"3127 / 3774"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"679 / 796"
"scale_samples = [\"Top\", \"TTbar\", \"W+Jets\"] # normalizations are off\n",
"\n",
"total_scale = 0\n",
"total_noscale = 0\n",
"for sample, events in events_dict.items():\n",
" if sample in scale_samples:\n",
" total_scale += events[\"weight\"].sum().values[0]\n",
" elif sample != \"Data\":\n",
" total_noscale += events[\"weight\"].sum().values[0]\n",
"\n",
"print(f\"Total MC: {total_scale + total_noscale}\")\n",
"\n",
"sf = (events_dict[\"Data\"][\"weight\"].sum().values[0] - total_noscale) / total_scale\n",
"for sample, events in events_dict.items():\n",
" if sample in scale_samples:\n",
" events[\"weight\"] *= sf\n",
"\n",
"total = 0\n",
"for sample, events in events_dict.items():\n",
" if sample != \"Data\":\n",
" total += events[\"weight\"].sum().values[0]\n",
"\n",
"print(f\"New Total MC: {total}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# total = 0\n",
"# for sample, events in events_dict.items():\n",
"# if sample != \"Data\":\n",
"# total += events[\"weight\"].sum().values[0]\n",
"\n",
"# print(f\"Total MC: {total}\")\n",
"\n",
"# sf = events[\"weight\"].sum().values[0] / total\n",
"# for sample, events in events_dict.items():\n",
"# if sample != \"Data\":\n",
"# events[\"weight\"] *= sf\n",
"\n",
"# total = 0\n",
"# for sample, events in events_dict.items():\n",
"# if sample != \"Data\":\n",
"# total += events[\"weight\"].sum().values[0]\n",
"\n",
"# print(f\"New Total MC: {total}\")"
"utils.add_to_cutflow(events_dict, \"Scale\", \"weight\", cutflow)\n",
"cutflow"
]
},
{
Expand Down Expand Up @@ -345,22 +297,6 @@
"### Pre plots"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_hist"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -644,6 +580,15 @@
"print(\"Abs: \", unc[binn] / pre_vals[binn])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pre_hists"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -654,14 +599,14 @@
"pre_MC_vals = (\n",
" pre_hists[tvar][sum, :].values()\n",
" - data_vals\n",
" # - pre_hists[tvar][\"TTbar\", :].values()\n",
" # - pre_hists[tvar][\"TTSL\", :].values()\n",
" - pre_hists[tvar][\"TTbar\", :].values()\n",
" - pre_hists[tvar][\"Top\", :].values()\n",
")\n",
"post_lnN_MC_vals = (\n",
" post_lnN_hists[tvar][sum, :].values()\n",
" - data_vals\n",
" # - post_lnN_hists[tvar][\"TTbar\", :].values()\n",
" # - post_lnN_hists[tvar][\"TTSL\", :].values()\n",
" - post_lnN_hists[tvar][\"TTbar\", :].values()\n",
" - post_lnN_hists[tvar][\"Top\", :].values()\n",
")"
]
},
Expand All @@ -681,11 +626,22 @@
"metadata": {},
"outputs": [],
"source": [
"lb = 5\n",
"lb = 10\n",
"print(\"Pre chi2:\", chisquare(pre_MC_vals[-lb:], data_vals[-lb:]))\n",
"print(\"Post chi2:\", chisquare(post_lnN_MC_vals[-lb:], data_vals[-lb:]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"lb = 5\n",
"print(pre_MC_vals[-lb:], data_vals[-lb:])\n",
"print(post_lnN_MC_vals[-lb:], data_vals[-lb:])"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit b5a440a

Please sign in to comment.