Skip to content

Commit

Permalink
updated data templates
Browse files Browse the repository at this point in the history
  • Loading branch information
rkansal47 committed Mar 15, 2024
1 parent 11a7575 commit 2a9fe3f
Show file tree
Hide file tree
Showing 86 changed files with 1,878 additions and 318 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]
# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: "v4.0.0-alpha.8"
# hooks:
# - id: prettier
# types_or: [yaml, markdown, html, css, scss, javascript, json]
# args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.2"
Expand Down
229 changes: 0 additions & 229 deletions src/HHbbVV/postprocessing/BDTPreProcessing.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion src/HHbbVV/postprocessing/BDTPreProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def save_bdt_data(

bdt_events_dict = []
for key in BDT_sample_order:
print(key)
save_vars = BDT_data_vars + jec_jmsr_vars if key != "Data" else BDT_data_vars
events = pd.DataFrame(
{var: utils.get_feat(events_dict[key], var, bb_masks[key]) for var in save_vars}
Expand Down
94 changes: 19 additions & 75 deletions src/HHbbVV/postprocessing/BDT_LPSFs.ipynb

Large diffs are not rendered by default.

33 changes: 30 additions & 3 deletions src/HHbbVV/postprocessing/PostProcessRes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@
"outputs": [],
"source": [
"MAIN_DIR = Path(\"../../../\")\n",
"samples_dir = MAIN_DIR / \"../data/skimmer/24Mar5AllYears\"\n",
"samples_dir = MAIN_DIR / \"../data/skimmer/24Mar6AllYearsBDTVars\"\n",
"# samples_dir = f\"{MAIN_DIR}/../data/skimmer/Feb24\"\n",
"# nonres_signal_samples_dir = f\"{MAIN_DIR}/../data/skimmer/Jun10\"\n",
"# res_signal_samples_dir = f\"{MAIN_DIR}/../data/skimmer/Apr11\"\n",
"# samples_dir = \"/eos/uscms/store/user/rkansal/bbVV/skimmer/Feb24\"\n",
"# nonres_signal_samples_dir = \"/eos/uscms/store/user/cmantill/bbVV/skimmer/Jun10/\"\n",
"# res_signal_samples_dir = \"/eos/uscms/store/user/rkansal/bbVV/skimmer/Apr11/\"\n",
"year = \"2016\"\n",
"year = \"2016APV\"\n",
"\n",
"date = \"24Mar6\"\n",
"plot_dir = MAIN_DIR / f\"plots/PostProcessing/{date}/\"\n",
Expand Down Expand Up @@ -135,7 +135,7 @@
"\n",
"events_dict = postprocessing.load_samples(\n",
" samples_dir,\n",
" {**nonres_samples, **res_samples, **samples},\n",
" {**nonres_samples}, # , **res_samples, **samples},\n",
" year,\n",
" load_filters,\n",
")\n",
Expand All @@ -144,6 +144,33 @@
"cutflow"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"events = events_dict[\"HHbbVV\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"list(events.columns)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"events[\"DijetMass\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
2 changes: 1 addition & 1 deletion src/HHbbVV/postprocessing/bash_scripts/BDTPreProcessing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
####################################################################################################

MAIN_DIR="../../.."
data_dir="$MAIN_DIR/../data/skimmer/24Mar6AllYearsBDTVars"
data_dir="$MAIN_DIR/../data/skimmer/24Mar14UpdateData"

for year in 2016APV 2016 2017 2018
do
Expand Down
7 changes: 4 additions & 3 deletions src/HHbbVV/postprocessing/bash_scripts/NonresTemplates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
####################################################################################################

MAIN_DIR="../../.."
data_dir="$MAIN_DIR/../data/skimmer/24Mar6AllYearsBDTVars"
data_dir="$MAIN_DIR/../data/skimmer/24Mar14UpdateData"
TAG=""


Expand Down Expand Up @@ -40,10 +40,11 @@ if [[ -z $TAG ]]; then
exit 1
fi

for year in 2016APV 2016 2017 2018
# for year in 2016APV 2016 2017 2018
for year in 2017 2018 2016APV 2016
do
python -u postprocessing.py --year $year --data-dir "$data_dir" --templates \
--bdt-preds-dir "$MAIN_DIR/../data/skimmer/24Mar6AllYearsBDTVars/24_03_07_new_samples_max_depth_5/inferences" \
--bdt-preds-dir "$data_dir/24_03_07_new_samples_max_depth_5/inferences" \
--plot-dir "${MAIN_DIR}/plots/PostProcessing/$TAG" \
--template-dir "templates/$TAG" --plot-shifts
# --control-plots --control-plot-vars "BDTScore" \
Expand Down
6 changes: 6 additions & 0 deletions src/HHbbVV/postprocessing/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,10 +1136,16 @@ def derive_variables(
do_jshifts: bool = True,
):
"""Add Dijet variables"""
import time

start = time.time()

for sample, events in events_dict.items():
if not nonres_vars:
continue

print(f"Deriving variables for {sample} {time.time() - start:.2f}s")

bb_mask = bb_masks[sample]
_add_nonres_columns(events, bb_mask, vbf_vars=vbf_vars)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
,Pre-selection,QCD SF,LP SF,bbFatJetPt >= 300,VVFatJetPt >= 300,0.8 ≤ bbFatJetParticleNetMD_Txbb < 0.9735,0 ≤ nGoodElectronsHbb < 0.9,0 ≤ nGoodMuonsHbb < 0.9
HHbbVV,0.9147081031687907,0.9147081031687907,0.9147081031687907,0.9088022319312213,0.9037950499185726,0.30175414428376585,0.30112232829530405,0.2990202748826515
ggHH_kl_2p45_kt_1_HHbbVV,0.6688447704532685,0.6688447704532685,0.6688447704532685,0.6649531572120448,0.6617354385600798,0.2299036391879109,0.2295289421882006,0.2280924478485079
ggHH_kl_5_kt_1_HHbbVV,0.6956895087373941,0.6956895087373941,0.6956895087373941,0.6920514447111688,0.6892047021562906,0.3063302486063932,0.30550315963569236,0.30391351000104144
ggHH_kl_0_kt_1_HHbbVV,1.1944766869755938,1.1944766869755938,1.1944766869755938,1.1863493648635597,1.17930333767202,0.39586526060371247,0.39514188691284224,0.39256694301449424
VBFHHbbVV,0.017115373482989717,0.017115373482989717,0.017115373482989717,0.017030078444247275,0.016924919012766975,0.00579761879633008,0.0057790354556334165,0.0057248101820241174
qqHH_CV_1_C2V_0_kl_1_HHbbVV,9.060969753010587,9.060969753010587,9.060969753010587,9.041934826728792,9.02728294983494,2.4426924669829826,2.43781489891332,2.4243925435159057
qqHH_CV_1p5_C2V_1_kl_1_HHbbVV,15.269096111629358,15.269096111629358,15.269096111629358,15.23647158421826,15.20829496277662,4.13073889572393,4.120987792038875,4.10015685148764
qqHH_CV_1_C2V_1_kl_2_HHbbVV,0.0173959132140592,0.0173959132140592,0.0173959132140592,0.017299990201845,0.017214419089199705,0.00846784274434387,0.008440107570873445,0.008373264656125586
qqHH_CV_1_C2V_2_kl_1_HHbbVV,8.138882127595444,8.138882127595444,8.138882127595444,8.123943352838433,8.11286122859791,2.1892512907726895,2.1837678445588895,2.1717354106435
qqHH_CV_1_C2V_1_kl_0_HHbbVV,0.04617824244896124,0.04617824244896124,0.04617824244896124,0.0459311591300662,0.04565497610400018,0.014190872302543785,0.01416197212352274,0.014112105993637325
QCD,717986.216814939,956785.8146709627,956785.8146709627,948406.4124347997,941617.267942029,754552.8113641972,752984.4192876149,750107.2737808328
TT,63126.80979180276,63126.80979180276,63126.80979180276,62714.21430804499,62290.703474200425,49529.77449791308,44329.76646173106,39159.45860664165
ST,5417.824558008516,5417.824558008516,5417.824558008516,5380.176293677084,5350.773696634727,4335.103148326725,3970.1436871856044,3563.758325231233
W+Jets,9487.889178263631,9487.889178263631,9487.889178263631,9424.292575831972,9375.118673797197,7834.787103754956,7814.4993526839335,7789.446400547657
Z+Jets,12055.822300436781,12055.822300436781,12055.822300436781,11968.016139487008,11904.514452147456,6790.915177024769,6773.707406230397,6734.8455822324595
Diboson,544.751536187187,544.751536187187,544.751536187187,541.5192000426408,539.5255957808083,336.0954273567496,320.18549221259616,303.48286314956806
ggFHbb,120.74204174793252,120.74204174793252,120.74204174793252,120.02707196890958,119.27175261578469,38.999571077551494,38.97813391667,38.788894151509346
VBFHbb,32.24173303425971,32.24173303425971,32.24173303425971,32.089487243194796,31.921442997500897,9.845327900626657,9.826780907273822,9.728638615140152
ZHbb,32.70020301080715,32.70020301080715,32.70020301080715,32.51666448179822,32.40029638484181,9.92855058278212,9.896574590344532,9.807368124790582
WHbb,56.014320595270185,56.014320595270185,56.014320595270185,55.69337399997595,55.51504919284625,19.11120104088777,19.06683717160466,18.91991542799836
ggZHbb,4.8805631912185055,4.8805631912185055,4.8805631912185055,4.852821845932874,4.827078996358681,1.9281741450543308,1.9243343671398156,1.9080303961975615
ttHbb,156.94119216557863,156.94119216557863,156.94119216557863,155.9939482895008,154.97672213467678,97.04622661247781,85.884977667534,74.2696929751333
HWW,80.56791059341468,80.56791059341468,80.56791059341468,80.1332628058381,79.59897023669294,63.60672027477934,52.77270242090221,43.58177362660231
Data,1047903.0,1047903.0,1047903.0,1047903.0,1047903.0,863853.0,854944.0,844713.0
Loading

0 comments on commit 2a9fe3f

Please sign in to comment.