Skip to content
Merged
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
11 changes: 7 additions & 4 deletions src/boostedhh/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,16 @@ def _normalize_weights(

# check weights are scaled
if "weight_noxsec" in events and np.all(events["weight"] == events["weight_noxsec"]):
# print(sample)
if "VBF" in sample or "GluGlutoHHto2B2Tau" in sample:
if sample in xsecs:
warnings.warn(
f"Temporarily scaling {sample} by its xsec and lumi - remember to remove after fixing in the processor!",
stacklevel=0,
)
events["weight"] = events["weight"] * xsecs[sample] * LUMI[year]
else:
raise ValueError(f"{sample} has not been scaled by its xsec and lumi!")
raise ValueError(
f"{sample} has not been scaled by its xsec and lumi, and no xsecs['{sample}'] entry exists to patch it here!"
)

events["finalWeight"] = events["weight"] / totals["np_nominal"]

Expand Down Expand Up @@ -541,7 +542,9 @@ def load_sample(
continue

# empty parquet directory (skimmer failed or produced no events)
parquet_files = list(parquet_path.glob("*.parquet")) if parquet_path.is_dir() else [parquet_path]
parquet_files = (
list(parquet_path.glob("*.parquet")) if parquet_path.is_dir() else [parquet_path]
)
if not parquet_files:
warnings.warn(
f"Empty parquet directory for {load_sample}! Skimmer may have failed or produced no events. "
Expand Down
Loading