Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/boostedhh/hh_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from collections import OrderedDict

years = ["2022", "2022EE", "2023", "2023BPix"]
years = ["2022", "2022EE", "2023", "2023BPix", "2024"]

# in pb^-1
LUMI = {
Expand All @@ -23,6 +23,7 @@
"2017": 41480.0,
"2016": 36330.0,
"Run2": 137640.0,
"2024": 109950.0,
}


Expand Down Expand Up @@ -197,6 +198,7 @@
"ggfbbtt-kl0p00": "GluGlutoHHto2B2Tau_kl-0p00_kt-1p00_c2-0p00",
"ggfbbtt-kl2p45": "GluGlutoHHto2B2Tau_kl-2p45_kt-1p00_c2-0p00",
"ggfbbtt-kl5p00": "GluGlutoHHto2B2Tau_kl-5p00_kt-1p00_c2-0p00",

"vbfbbtt": "VBFHHto2B2Tau_CV_1_C2V_1_C3_1",
"vbfbbtt-k2v0": "VBFHHto2B2Tau_CV_1_C2V_0_C3_1",
# BSM VBF samples: use regex [_-] to handle 2022/2022EE (hyphen) vs 2023/2023BPix (underscore) naming
Expand Down
57 changes: 40 additions & 17 deletions src/boostedhh/processors/corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ def get_pog_json(obj: str, year: str) -> str:
print(f"No json for {obj}")

year = get_UL_year(year) if year == "2018" else year
if "2022" in year or "2023" in year:
if "2022" in year or "2023" in year or "2024" in year:
year = {
"2022": "2022_Summer22",
"2022EE": "2022_Summer22EE",
"2023": "2023_Summer23",
"2023BPix": "2023_Summer23BPix",
"2024": "2024_Summer24",
}[year]
return f"{pog_correction_path}/POG/{pog_json[0]}/{year}/{pog_json[1]}"

Expand Down Expand Up @@ -103,23 +104,44 @@ def add_pileup_weight(weights: Weights, year: str, nPU: np.ndarray, dataset: str
weights.add("pileup", sf)

else:
# https://twiki.cern.ch/twiki/bin/view/CMS/LumiRecommendationsRun3
values = {}

cset = correctionlib.CorrectionSet.from_file(get_pog_json("pileup", year))
corr = {
"2018": "Collisions18_UltraLegacy_goldenJSON",
"2022": "Collisions2022_355100_357900_eraBCD_GoldenJson",
"2022EE": "Collisions2022_359022_362760_eraEFG_GoldenJson",
"2023": "Collisions2023_366403_369802_eraBC_GoldenJson",
"2023BPix": "Collisions2023_369803_370790_eraD_GoldenJson",
}[year]
# evaluate and clip up to 10 to avoid large weights
values["nominal"] = np.clip(cset[corr].evaluate(nPU, "nominal"), 0, 10)
values["up"] = np.clip(cset[corr].evaluate(nPU, "up"), 0, 10)
values["down"] = np.clip(cset[corr].evaluate(nPU, "down"), 0, 10)

if year == "2024":
import json

# Read directly from the Golden JSON file
golden_json_path = "/afs/cern.ch/user/j/jinwa/Cert_Collisions2024_378981_386951_Golden.json"

print(f"Loading pileup from Golden JSON: {golden_json_path}")

# For 2024, temporarily use a nominal weight of 1 (if there is no pileup information in the Golden JSON).
values = {}
values["nominal"] = np.ones_like(nPU, dtype=float)
values["up"] = np.ones_like(nPU, dtype=float)
values["down"] = np.ones_like(nPU, dtype=float)

print(f"Using default pileup weights (all 1.0) for 2024")

weights.add("pileup", values["nominal"], values["up"], values["down"])

else:

weights.add("pileup", values["nominal"], values["up"], values["down"])
# https://twiki.cern.ch/twiki/bin/view/CMS/LumiRecommendationsRun3
values = {}

cset = correctionlib.CorrectionSet.from_file(get_pog_json("pileup", year))
corr = {
"2018": "Collisions18_UltraLegacy_goldenJSON",
"2022": "Collisions2022_355100_357900_eraBCD_GoldenJson",
"2022EE": "Collisions2022_359022_362760_eraEFG_GoldenJson",
"2023": "Collisions2023_366403_369802_eraBC_GoldenJson",
"2023BPix": "Collisions2023_369803_370790_eraD_GoldenJson",
}[year]
# evaluate and clip up to 10 to avoid large weights
values["nominal"] = np.clip(cset[corr].evaluate(nPU, "nominal"), 0, 10)
values["up"] = np.clip(cset[corr].evaluate(nPU, "up"), 0, 10)
values["down"] = np.clip(cset[corr].evaluate(nPU, "down"), 0, 10)

weights.add("pileup", values["nominal"], values["up"], values["down"])


def get_vpt(genpart, check_offshell=False):
Expand Down Expand Up @@ -412,6 +434,7 @@ def get_veto(j, nj, csetstr):
"2022EE": "Summer22EE_23Sep2023_RunEFG_V1",
"2023": "Summer23Prompt23_RunC_V1",
"2023BPix": "Summer23BPixPrompt23_RunD_V1",
"2024": "Summer24Prompt24_RunBCDEFGHI_V1",
}[year]

jet_veto = get_veto(j, nj, corr_str) > 0
Expand Down
29 changes: 29 additions & 0 deletions src/boostedhh/processors/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,32 @@ def jetid_v14(jets: ak.Array) -> tuple[ak.Array, ak.Array]:
) | ((np.abs(jets.eta) > 2.7) & jetidtight)

return jetidtight, jetidtightlepveto

def jetid_v15(jets: ak.Array) -> tuple[ak.Array, ak.Array]:
"""
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetID13p6TeV#Recommendations_for_the_13_6_AN1
"""

jetidtight = (
(
(np.abs(jets.eta) <= 2.6)
& (jets.neHEF < 0.99)
& (jets.neEmEF < 0.9)
& ((jets.chMultiplicity + jets.neMultiplicity) > 1)
& (jets.chHEF > 0.01)
& (jets.chMultiplicity > 0)
)
| (
((np.abs(jets.eta) > 2.6) & (np.abs(jets.eta) <= 2.7))
& (jets.neHEF < 0.90)
& (jets.neEmEF < 0.99)
)
| (((np.abs(jets.eta) > 2.7) & (np.abs(jets.eta) <= 3.0)) & (jets.neHEF < 0.99))
| ((np.abs(jets.eta) > 3.0) & (jets.neMultiplicity >= 2) & (jets.neEmEF < 0.4))
)

jetidtightlepveto = (
(np.abs(jets.eta) <= 2.7) & jetidtight & (jets.muEF < 0.8) & (jets.chEmEF < 0.8)
) | ((np.abs(jets.eta) > 2.7) & jetidtight)

return jetidtight, jetidtightlepveto
2 changes: 1 addition & 1 deletion src/boostedhh/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def parse_common_hh_args(parser):
type=str,
nargs="+",
required=True,
choices=["2018", "2022", "2022EE", "2023", "2023BPix"],
choices=["2018", "2022", "2022EE", "2023", "2023BPix", "2024"],
)

parser.add_argument(
Expand Down
Loading