Skip to content

Commit

Permalink
kt reclustering
Browse files Browse the repository at this point in the history
  • Loading branch information
rkansal47 committed Dec 15, 2024
1 parent 762c679 commit 2af62e4
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 1,235 deletions.
1,211 changes: 8 additions & 1,203 deletions src/HHbbVV/postprocessing/TopAnalysis.ipynb

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/HHbbVV/processors/corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ def _get_lund_arrays(
fatjet_idx: int | ak.Array,
num_prongs: int,
min_pt: float = 1.0,
ca_recluster: bool = False,
):
"""
Gets the ``num_prongs`` subjet pTs and Delta and kT per primary LP splitting of fatjets at
Expand All @@ -854,6 +855,8 @@ def _get_lund_arrays(
jec_fatjets (FatJetArray): post-JEC fatjets, used to update subjet pTs.
fatjet_idx (int | ak.Array): fatjet index
num_prongs (int): number of prongs / subjets per jet to reweight
min_pt (float): minimum pT for pf candidates considered for LP declustering
ca_recluster (bool): whether to recluster subjets with CA after kT
Returns:
lds, kt_subjets_vec, kt_subjets_pt: lund declusterings, subjet 4-vectors, JEC-corrected subjet pTs
Expand All @@ -870,6 +873,8 @@ def _get_lund_arrays(
cadef = fastjet.JetDefinition(fastjet.cambridge_algorithm, dR)
ktdef = fastjet.JetDefinition(fastjet.kt_algorithm, dR)

recluster_def = cadef if ca_recluster else ktdef

# get pfcands of the top-matched jets
ak8_pfcands = events.FatJetPFCands
ak8_pfcands = ak8_pfcands[ak8_pfcands.jetIdx == fatjet_idx]
Expand Down Expand Up @@ -911,8 +916,8 @@ def _get_lund_arrays(

# then re-cluster with CA
# won't need to flatten once https://github.com/scikit-hep/fastjet/pull/145 is released
ca_clustering = fastjet.ClusterSequence(kt_subjet_consts, cadef)
lds = ca_clustering.exclusive_jets_lund_declusterings(1)
reclustering = fastjet.ClusterSequence(kt_subjet_consts, recluster_def)
lds = reclustering.exclusive_jets_lund_declusterings(1)

return lds, kt_subjets_vec, kt_subjets_pt

Expand Down
82 changes: 52 additions & 30 deletions src/HHbbVV/scale_factors/top_reweighting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -41,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -132,7 +132,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -150,7 +150,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -196,7 +196,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -228,7 +228,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -252,7 +252,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -498,7 +498,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -523,7 +523,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -538,7 +538,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -561,7 +561,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -604,7 +604,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -649,7 +649,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -658,7 +658,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -677,7 +677,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -692,7 +692,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -725,7 +725,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -741,7 +741,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -763,7 +763,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -790,7 +790,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -805,7 +805,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -836,11 +836,38 @@
"# then re-cluster with CA\n",
"# won't need to flatten once https://github.com/scikit-hep/fastjet/pull/145 is released\n",
"# ca_clustering = fastjet.ClusterSequence(ak.flatten(kt_subjet_consts, axis=1), cadef)\n",
"ca_clustering = fastjet.ClusterSequence(filled_consts, cadef)\n",
"ca_clustering = fastjet.ClusterSequence(filled_consts, ktdef)\n",
"lds = ca_clustering.exclusive_jets_lund_declusterings(1)\n",
"lds_flat = ak.flatten(lds, axis=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"lds"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"merged_top_events"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"kt_subjet_consts"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -1432,7 +1459,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "python310",
"display_name": "python39",
"language": "python",
"name": "python3"
},
Expand All @@ -1448,12 +1475,7 @@
"pygments_lexer": "ipython3",
"version": "3.9.15"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "15adc7883e707560d0d9727709639b8fe3f3cff1f197d2d643742923ff23a29c"
}
}
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
Expand Down
26 changes: 26 additions & 0 deletions src/condor/submit_configs/ttsfs_24_12_15_lp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"TTbarScaleFactors":
{
"TTbar":
{
"files_per_job": 10,
"max_files": 80,
"chunksize": 80000,
"subsamples": ["TTToSemiLeptonic"],
},
"SingleTop":
{
"files_per_job": 10,
"max_files": 80,
"chunksize": 80000,
"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",
],
},
},
}

0 comments on commit 2af62e4

Please sign in to comment.