From f72c9a9dd135035cdafdb741c5872461afe2ca5f Mon Sep 17 00:00:00 2001 From: Massimiliano Galli Date: Mon, 16 Mar 2026 17:22:32 +0100 Subject: [PATCH 1/2] drop systematic lines that do not affect any channel/process when calling combineCards with --include-channel or --exclude-channel --- scripts/combineCards.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/combineCards.py b/scripts/combineCards.py index b00ce74d708..ed1e8c1b247 100755 --- a/scripts/combineCards.py +++ b/scripts/combineCards.py @@ -392,6 +392,22 @@ def compareParamSystLines(a, b): if process_errors: raise RuntimeError("ERROR: mismatch between process signal labels:\n%s" % ("\n".join(process_errors))) +# Remove systematics that don't affect any process/channel in the combination +removed_systs = { + name for name, (pdf, pdfargs, effect, nofloat) in systlines.items() + if not any(effect.get(b, {}).get(p, "-") != "-" for b, p, s in keyline) +} +for name in removed_systs: + del systlines[name] + +# Remove pruned systematics from groups - leave all other group members untouched +if removed_systs: + groups = { + gname: nuisanceNames - removed_systs + for gname, nuisanceNames in groups.items() + if nuisanceNames - removed_systs + } + print("Combination of", " ".join(args)) print("imax %d number of bins" % len(bins)) print("jmax %d number of processes minus 1" % (len(signals) + len(backgrounds) - 1)) From 08d45f3fffeeddf37a0b95062e0e7057b6e3a498 Mon Sep 17 00:00:00 2001 From: Massimiliano Galli Date: Tue, 17 Mar 2026 15:33:15 +0100 Subject: [PATCH 2/2] lint combineCards.py --- scripts/combineCards.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/combineCards.py b/scripts/combineCards.py index ed1e8c1b247..0906f6574ab 100755 --- a/scripts/combineCards.py +++ b/scripts/combineCards.py @@ -393,20 +393,13 @@ def compareParamSystLines(a, b): raise RuntimeError("ERROR: mismatch between process signal labels:\n%s" % ("\n".join(process_errors))) # Remove systematics that don't affect any process/channel in the combination -removed_systs = { - name for name, (pdf, pdfargs, effect, nofloat) in systlines.items() - if not any(effect.get(b, {}).get(p, "-") != "-" for b, p, s in keyline) -} +removed_systs = {name for name, (pdf, pdfargs, effect, nofloat) in systlines.items() if not any(effect.get(b, {}).get(p, "-") != "-" for b, p, s in keyline)} for name in removed_systs: del systlines[name] # Remove pruned systematics from groups - leave all other group members untouched if removed_systs: - groups = { - gname: nuisanceNames - removed_systs - for gname, nuisanceNames in groups.items() - if nuisanceNames - removed_systs - } + groups = {gname: nuisanceNames - removed_systs for gname, nuisanceNames in groups.items() if nuisanceNames - removed_systs} print("Combination of", " ".join(args)) print("imax %d number of bins" % len(bins))