Skip to content

Commit

Permalink
bf
Browse files Browse the repository at this point in the history
  • Loading branch information
rkansal47 committed Oct 26, 2023
1 parent 6c497b6 commit 32c5ad3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ nohup bash -c 'for sample in NMSSM_XToYHTo2W2BTo4Q2B_MX-4000_MY-150 NMSSM_XToYHT

### Create Datacard

Need `root==6.22.6`, and `square_coef` branch of https://github.com/rkansal47/rhalphalib installed (`pip install -e . --user` after checking out the branch). `CMSSW_11_2_0` recommended.
Need `root==6.22.6`, and `square_coef` branch of https://github.com/rkansal47/rhalphalib installed (`pip install -e . --user` after checking out the branch).

```bash
python3 postprocessing/CreateDatacard.py --templates-dir templates/$TAG --model-name $TAG (--resonant)
Expand Down
2 changes: 1 addition & 1 deletion src/HHbbVV/postprocessing/CreateDatacard.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def nonres_alphabet_fit(
# was integer, and numpy complained about subtracting float from it
initial_qcd = failCh.getObservation().astype(float)
for sample in failCh:
if args.resonant and sample.sampletype == rl.Sample.SIGNAL:
if sample.sampletype == rl.Sample.SIGNAL:
continue
logging.debug("subtracting %s from qcd" % sample._name)
initial_qcd -= sample.getExpectation(nominal=True)
Expand Down
36 changes: 35 additions & 1 deletion src/HHbbVV/postprocessing/PostProcess.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"# bdt_data_dir = \"/eos/uscms/store/user/cmantill/bbVV/skimmer/Jun10/bdt_data/\"\n",
"year = \"2018\"\n",
"\n",
"date = \"23Aug21\"\n",
"date = \"23Oct12\"\n",
"plot_dir = f\"../../../plots/PostProcessing/{date}/\"\n",
"templates_dir = f\"templates/{date}\"\n",
"_ = os.system(f\"mkdir -p {plot_dir}\")\n",
Expand Down Expand Up @@ -173,6 +173,40 @@
"postprocessing.load_bdt_preds(events_dict, year, bdt_preds_dir, jec_jmsr_shifts=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Aside: checking if regressed mass is actually saving useful jets"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bbmsd = utils.get_feat(events_dict[\"HHbbVV\"], \"bbFatJetMsd\", bb_masks[\"HHbbVV\"])\n",
"vvmsd = utils.get_feat(events_dict[\"HHbbVV\"], \"VVFatJetMsd\", bb_masks[\"HHbbVV\"])\n",
"bbpnetm = utils.get_feat(events_dict[\"HHbbVV\"], \"bbFatJetParticleNetMass\", bb_masks[\"HHbbVV\"])\n",
"vvpnetm = utils.get_feat(events_dict[\"HHbbVV\"], \"VVFatJetParticleNetMass\", bb_masks[\"HHbbVV\"])\n",
"bbpnet = utils.get_feat(events_dict[\"HHbbVV\"], \"bbFatJetParticleNetMD_Xbb\", bb_masks[\"HHbbVV\"])\n",
"vvpart = utils.get_feat(events_dict[\"HHbbVV\"], \"VVFatJetParTMD_THWW4q\", bb_masks[\"HHbbVV\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bbreg = (bbmsd < 50) * (bbpnetm > 50)\n",
"plt.title(\"Jets with Msd < 50 GeV and PNet Mass > 50 GeV\")\n",
"plt.hist(bbpnet[bbreg], np.linspace(0, 1, 50), histtype=\"step\", label=\"bb\")\n",
"plt.xlabel(\"Txbb\")\n",
"plt.show()"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down
13 changes: 13 additions & 0 deletions src/HHbbVV/postprocessing/TrainBDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ def main(args):

data_dict = load_data(args.data_path, args.year, args.all_years)

for year, data in data_dict.items():
for key in training_keys:
print(
(
f"{year} {key} Yield: "
f'{np.sum(data[data["Dataset"] == key][weight_key])}, '
"Number of Events: ",
f'{len(data[data["Dataset"] == key])}, ',
)
)

return

if not args.inference_only:
training_data_dict = {
year: data[
Expand Down

0 comments on commit 32c5ad3

Please sign in to comment.