pyhs3.distributions.histfactory.modifiers.gamma_constraint

pyhs3.distributions.histfactory.modifiers.gamma_constraint(name, gamma, sigma_rel, constraint, context)[source]

Constraint distribution of per-bin parameters whose nominal value is 1.

Shared by shapesys, staterror (Barlow-Beeston full) and the channel-level Barlow-Beeston-lite constraint, so each HS3 v0.2 constraint type is defined once. gamma and sigma_rel have shape (B,): the parameter and its relative uncertainty for each constrained bin. The returned distribution is elementwise, so it evaluates to (B,) per-bin terms:

  • Gauss: Gauss(1 | gamma, sigma_rel)

  • Poisson: Pois(tau | gamma * tau), continuous, with tau = 1 / sigma_rel**2 (as RooFit’s HistFactory builds it)

  • LogNormal: LogNormal(1 | mu = ln gamma, sigma = sigma_rel), whose median is gamma

The distribution’s x, the (B,) constant 1 or tau, is the constraint’s global observable (auxiliary data): a constant named {name}_x of its own, so that a model can replace it.

Parameters:
  • name (str) – Name of the constraint distribution; helper tensors are named after it.

  • gamma (TensorVar) – (B,) per-bin parameters.

  • sigma_rel (ndarray[tuple[Any, ...], dtype[float64]]) – (B,) relative uncertainties.

  • constraint (Literal['Gauss', 'Poisson', 'LogNormal']) – The HS3 v0.2 constraint type.

  • context (Context) – Built tensors by name; extended with the helper tensors.

Return type:

tuple[SampleableDistribution, Context]

Returns:

The constraint distribution and the context it evaluates in.