Skip to content

setupRabbit: expose empty-bin systematic clipping/zeroing#708

Merged
davidwalter2 merged 2 commits into
WMass:mainfrom
lucalavezzo:setuprabbit-empty-bin-systematics
Jul 21, 2026
Merged

setupRabbit: expose empty-bin systematic clipping/zeroing#708
davidwalter2 merged 2 commits into
WMass:mainfrom
lucalavezzo:setuprabbit-empty-bin-systematics

Conversation

@lucalavezzo

Copy link
Copy Markdown
Collaborator

Summary

Adds two opt-in setupRabbit.py CLI flags (both off by default) that forward to the rabbit TensorWriter knobs of the same name (WMass/rabbit#146):

  • --clipSystVariations X — clip each bin's log-normal up/down factor to [1/X, X].
  • --zeroSystLowNeff X (+ --zeroSystLowNeffProcs) — zero every systematic's logk in any (bin, process) whose effective sample size n_eff = sumw^2/sumw2 is below X.

Motivation

In dense log-normal Z datacards, thin backgrounds (Ztautau, PhotonInduced, Other) have bins whose nominal is a mixed-sign NLO weight-cancellation residual, giving n_eff << 1. There logk = log(syst/nom) is floating-point noise and nom*exp(logk) blows up to ~1e15–1e20, which debug_inputdata flags and which makes rabbit_plot_inputdata explode. These flags tame that at build time; --zeroSystLowNeff additionally cleans the card so the debug/plot tools come out clean. The signal (Zmumu) has no low-n_eff bins, so the all-process default is safe.

Dependency

Requires WMass/rabbit#146 (the TensorWriter clip_syst_variations / zero_syst_low_neff kwargs).

Validation

A real 4D Z card rebuilt with --zeroSystLowNeff 1 is byte-identical to an independent post-hoc reference across every dataset (hnorm/hsumw/hsumw2/hdata_obs/hlogk).

🤖 Generated with Claude Code

Add two opt-in CLI flags (both off by default) that forward to the rabbit
TensorWriter knobs of the same name:

- --clipSystVariations X: clip each bin's log_normal up/down factor to [1/X, X].
- --zeroSystLowNeff X (+ --zeroSystLowNeffProcs): zero every systematic's logk
  in any (bin, process) with n_eff = sumw^2/sumw2 < X. Tames the ~1e15-1e20
  blow-ups from mixed-sign NLO weight-cancellation-residual bins in thin
  backgrounds (Ztautau/PhotonInduced/Other) that break debug/plot tools.

The new knobs are forwarded to TensorWriter only when actually set, so this
script remains compatible with rabbit versions predating them. Using the flags
requires a rabbit with these TensorWriter arguments (WMass/rabbit#146).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@lucalavezzo
lucalavezzo force-pushed the setuprabbit-empty-bin-systematics branch from dc74bcb to 283fa06 Compare July 21, 2026 20:21
@davidwalter2

Copy link
Copy Markdown
Collaborator

I think you should also update the rabbit submodule

WMass/rabbit#146 is merged (5a01cb4), adding the TensorWriter
clip_syst_variations / zero_syst_low_neff arguments that the new
setupRabbit flags forward to. Bumps the pin 948a94a -> 5a01cb4 (only WMass#146
in between) so --clipSystVariations / --zeroSystLowNeff are usable.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@davidwalter2
davidwalter2 merged commit 7a8ce51 into WMass:main Jul 21, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants