From a1cf6b8dd2d84f8922650a54b2ee9e5b77b96f23 Mon Sep 17 00:00:00 2001 From: Mori Ludovico Date: Fri, 21 Aug 2026 16:45:44 -0700 Subject: [PATCH] small fix to allow load time xsec reweight in more samples --- src/boostedhh/utils.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/boostedhh/utils.py b/src/boostedhh/utils.py index fbabd40..b21f474 100644 --- a/src/boostedhh/utils.py +++ b/src/boostedhh/utils.py @@ -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"] @@ -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. "