Skip to content

Commit

Permalink
res pt scan
Browse files Browse the repository at this point in the history
  • Loading branch information
rkansal47 committed Sep 12, 2023
1 parent 5f57a7a commit 4520d79
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 100 deletions.
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,9 @@ Run `postprocessing/bash_scripts/ControlPlots.sh` from inside `postprocessing fo

#### Making separate background and signal templates for scan (resonant)

Background and data:

```bash
nohup bash -c 'for year in 2016APV 2016 2017 2018; do python -u postprocessing.py --templates --year $year --template-dir "/eos/uscms/store/user/rkansal/bbVV/templates/$TAG/" --data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Feb24" --resonant --sig-samples "" --res-txbb-wp LP MP HP --res-thww-wp 0.4 0.6 0.8 0.9 0.94 0.96 0.98 --no-do-jshifts --templates-name backgrounds --old-processor; done' &> outs/bgout.txt &
```

Signal:

```bash
nohup bash -c 'for sample in NMSSM_XToYHTo2W2BTo4Q2B_MX-4000_MY-150 NMSSM_XToYHTo2W2BTo4Q2B_MX-3000_MY-250; do for year in 2016APV 2016 2017 2018; do python -u postprocessing.py --templates --year $year --template-dir "/eos/uscms/store/user/rkansal/bbVV/templates/$TAG/" --data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Feb24" --signal-data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Apr11" --resonant --sig-samples $sample --bg-keys "" --res-txbb-wp LP MP HP --res-thww-wp 0.4 0.6 0.8 0.9 0.94 0.96 0.98 --no-do-jshifts --templates-name $sample --no-data; done; done' &> outs/sigout.txt &
nohup bash_scripts/res_tagger_scan.sh $TAG &> scan.txt &
nohup bash_scripts/res_pt_scan.sh $TAG &> scan.txt &
```


Expand Down
33 changes: 17 additions & 16 deletions src/HHbbVV/combine/binder/BiasTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"source": [
"MAIN_DIR = \"../../../../\"\n",
"\n",
"plot_dir = f\"{MAIN_DIR}/plots/BiasTest/23Sep11\"\n",
"plot_dir = f\"{MAIN_DIR}/plots/BiasTest/23Sep12\"\n",
"_ = os.system(f\"mkdir -p {plot_dir}\")"
]
},
Expand All @@ -40,20 +40,31 @@
"outputs": [],
"source": [
"cards_dir = \"23Jul17ResClipTFScale1\"\n",
"bias_dir = \"23Sep8\"\n",
"\n",
"# r_bounds = [-1, 20]\n",
"r_bounds = [-5, 40]\n",
"\n",
"samples = [\n",
" \"NMSSM_XToYHTo2W2BTo4Q2B_MX-1200_MY-190\",\n",
" \"NMSSM_XToYHTo2W2BTo4Q2B_MX-2000_MY-125\",\n",
" \"NMSSM_XToYHTo2W2BTo4Q2B_MX-3000_MY-250\",\n",
"]\n",
"\n",
"biases = [0.0, 0.15, 0.3, 1.0]\n",
"r_dict = {}\n",
"# r_dict = {}\n",
"\n",
"for sample in samples:\n",
" r_dict[sample] = {}\n",
" if sample not in r_dict:\n",
" r_dict[sample] = {}\n",
"\n",
" for bias in biases:\n",
" if bias in r_dict[sample]:\n",
" continue\n",
"\n",
" print(sample, bias)\n",
" file = uproot.concatenate(\n",
" f\"/uscms/home/rkansal/hhcombine/cards/biastests/{cards_dir}/{sample}/higgsCombinebias{bias}.FitDiagnostics.mH125.*2.root\"\n",
" f\"/uscms/home/rkansal/hhcombine/cards/biastests/{cards_dir}/{sample}/bias/{bias_dir}/higgsCombinebias{bias}.FitDiagnostics.mH125.*.root\"\n",
" )\n",
"\n",
" r = np.array(file.limit)[::4]\n",
Expand All @@ -73,16 +84,6 @@
" }"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"r_bounds = [-1, 20]\n",
"# r_bounds = [-5, 40]"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -133,8 +134,8 @@
"source": [
"from scipy import stats\n",
"\n",
"xrange = 2.5\n",
"bins = 21\n",
"xrange = 3\n",
"bins = 16\n",
"x = np.linspace(-xrange, xrange, 101)\n",
"\n",
"for sample in samples:\n",
Expand Down
4 changes: 3 additions & 1 deletion src/HHbbVV/combine/mv_bias_outputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ for sample in NMSSM_XToYHTo2W2BTo4Q2B_MX-1200_MY-190 NMSSM_XToYHTo2W2BTo4Q2B_MX-
do
cd $sample
mkdir -p bias/$TAG
mv higgsCombinebias*.FitDiagnostics.mH125.*$seed_last_digit.root bias/$TAG/
# move only files with size > 0
find higgsCombinebias*.FitDiagnostics.mH125.*$seed_last_digit.root -type f -size +0c -exec mv {} bias/$TAG/ \;
# mv higgsCombinebias*.FitDiagnostics.mH125.*$seed_last_digit.root bias/$TAG/
cd -
done
34 changes: 20 additions & 14 deletions src/HHbbVV/combine/submit/submit_cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,20 @@ def write_template(templ_file: str, out_file: str, templ_args: dict):
for mX, mY in res_mps:
scan_samples.append(f"NMSSM_XToYHTo2W2BTo4Q2B_MX-{mX}_MY-{mY}")

scan_txbb_wps = ["LP", "MP", "HP"]
scan_thww_wps = [0.4, 0.6, 0.8, 0.9, 0.94, 0.96, 0.98]
# scan_txbb_wps = ["LP", "MP", "HP"]
# scan_thww_wps = [0.4, 0.6, 0.8, 0.9, 0.94, 0.96, 0.98]

scan_txbb_wps = ["HP"]
scan_thww_wps = [0.6, 0.8]
scan_leadingpt_wps = [300, 350, 400, 450]
scan_subleadingpt_wps = [300, 350, 400, 450]

nonres_scan_cuts = ["txbb", "bdt"]
res_scan_cuts = ["txbb", "thww"]
res_scan_cuts = ["txbb", "thww", "leadingpt", "subleadingpt"]


def main(args):
global scan_txbb_wps, scan_thww_wps
global scan_txbb_wps, scan_thww_wps, scan_leadingpt_wps, scan_subleadingpt_wps

t2_local_prefix, t2_prefix, proxy, username, submitdir = setup(args)

Expand All @@ -215,20 +220,22 @@ def main(args):
scan_txbb_wps = scan_txbb_wps[-1:]
scan_thww_wps = scan_thww_wps[-2:]

scan_wps = list(
itertools.product(scan_txbb_wps, scan_thww_wps, scan_leadingpt_wps, scan_subleadingpt_wps)
)
# remove WPs where subleading pT > leading pT
scan_wps = [wp for wp in scan_wps if wp[3] <= wp[2]]

scan_cuts = res_scan_cuts if args.resonant else nonres_scan_cuts

for sample in samples:
if args.scan:
for txbb_wp in scan_txbb_wps:
for thww_wp in scan_thww_wps:
os.system(
f"mkdir -p {t2_local_prefix}/{cards_dir}/"
f"txbb_{txbb_wp}_thww_{thww_wp}/{sample}"
)
for wps in scan_wps:
cutstr = "_".join([f"{cut}_{wp}" for cut, wp in zip(scan_cuts, wps)])
os.system(f"mkdir -p {t2_local_prefix}/{cards_dir}/{cutstr}/{sample}")
else:
os.system(f"mkdir -p {t2_local_prefix}/{cards_dir}/{sample}")

scan_wps = list(itertools.product(scan_txbb_wps, scan_thww_wps))
scan_cuts = res_scan_cuts if args.resonant else nonres_scan_cuts

# split along WPs for scan or along # of samples for regular jobs
njobs = len(scan_wps) if args.scan else ceil(len(samples) / args.files_per_job)

Expand All @@ -243,7 +250,6 @@ def main(args):
for j in range(njobs):
if args.scan:
run_samples = samples

cutstr = "_".join([f"{cut}_{wp}" for cut, wp in zip(scan_cuts, scan_wps[j])])
run_templates_dir = templates_dir + cutstr
run_cards_dir = cards_dir + cutstr
Expand Down
16 changes: 16 additions & 0 deletions src/HHbbVV/postprocessing/bash_scripts/res_pt_scan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
TAG=$1

# backgrounds and data
for year in 2016APV 2016 2017 2018
do
python -u postprocessing.py --templates --year $year --template-dir "/eos/uscms/store/user/rkansal/bbVV/templates/$TAG/" --data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Feb24" --resonant --sig-samples "" --res-leading-pt 300 350 400 450 --res-subleading-pt 300 350 400 450 --res-thww-wp 0.6 0.8 --no-do-jshifts --templates-name backgrounds --old-processor
done

# signals
for sample in NMSSM_XToYHTo2W2BTo4Q2B_MX-4000_MY-150 NMSSM_XToYHTo2W2BTo4Q2B_MX-3000_MY-250 NMSSM_XToYHTo2W2BTo4Q2B_MX-2000_MY-125 NMSSM_XToYHTo2W2BTo4Q2B_MX-1200_MY-190 NMSSM_XToYHTo2W2BTo4Q2B_MX-900_MY-80
do
for year in 2016APV 2016 2017 2018
do
python -u postprocessing.py --templates --year $year --template-dir "/eos/uscms/store/user/rkansal/bbVV/templates/$TAG/" --data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Feb24" --signal-data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Apr11" --resonant --sig-samples $sample --bg-keys "" --res-leading-pt 300 350 400 450 --res-subleading-pt 300 350 400 450 --res-thww-wp 0.6 0.8 --no-do-jshifts --templates-name $sample --no-data
done
done
16 changes: 16 additions & 0 deletions src/HHbbVV/postprocessing/bash_scripts/res_tagger_scan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
TAG=$1

# backgrounds and data
for year in 2016APV 2016 2017 2018
do
python -u postprocessing.py --templates --year $year --template-dir "/eos/uscms/store/user/rkansal/bbVV/templates/$TAG/" --data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Feb24" --resonant --sig-samples "" --res-txbb-wp LP MP HP --res-thww-wp 0.4 0.6 0.8 0.9 0.94 0.96 0.98 --no-do-jshifts --templates-name backgrounds --old-processor
done

# signals
for sample in NMSSM_XToYHTo2W2BTo4Q2B_MX-4000_MY-150 NMSSM_XToYHTo2W2BTo4Q2B_MX-3000_MY-250 NMSSM_XToYHTo2W2BTo4Q2B_MX-2000_MY-125 NMSSM_XToYHTo2W2BTo4Q2B_MX-1200_MY-190 NMSSM_XToYHTo2W2BTo4Q2B_MX-900_MY-80
do
for year in 2016APV 2016 2017 2018
do
python -u postprocessing.py --templates --year $year --template-dir "/eos/uscms/store/user/rkansal/bbVV/templates/$TAG/" --data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Feb24" --signal-data-dir "/eos/uscms/store/user/rkansal/bbVV/skimmer/Apr11" --resonant --sig-samples $sample --bg-keys "" --res-txbb-wp LP MP HP --res-thww-wp 0.4 0.6 0.8 0.9 0.94 0.96 0.98 --no-do-jshifts --templates-name $sample --no-data
done
done
Loading

0 comments on commit 4520d79

Please sign in to comment.