Skip to content

Commit 72f9971

Browse files
maxgallianigamova
authored andcommitted
drop systematic lines that do not affect any channel/process when calling combineCards with --include-channel or --exclude-channel
1 parent 8bd0f6d commit 72f9971

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

scripts/combineCards.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,22 @@ def compareParamSystLines(a, b):
392392
if process_errors:
393393
raise RuntimeError("ERROR: mismatch between process signal labels:\n%s" % ("\n".join(process_errors)))
394394

395+
# Remove systematics that don't affect any process/channel in the combination
396+
removed_systs = {
397+
name for name, (pdf, pdfargs, effect, nofloat) in systlines.items()
398+
if not any(effect.get(b, {}).get(p, "-") != "-" for b, p, s in keyline)
399+
}
400+
for name in removed_systs:
401+
del systlines[name]
402+
403+
# Remove pruned systematics from groups - leave all other group members untouched
404+
if removed_systs:
405+
groups = {
406+
gname: nuisanceNames - removed_systs
407+
for gname, nuisanceNames in groups.items()
408+
if nuisanceNames - removed_systs
409+
}
410+
395411
print("Combination of", " ".join(args))
396412
print("imax %d number of bins" % len(bins))
397413
print("jmax %d number of processes minus 1" % (len(signals) + len(backgrounds) - 1))

0 commit comments

Comments
 (0)