pyhs3.distributions.CrystalBallDist

class pyhs3.distributions.CrystalBallDist(*, name, alpha_L, alpha_R, m, m0, n_R, n_L, sigma_L, sigma_R)[source]

Crystal Ball distribution implementation.

Implements the generalized asymmetrical double-sided Crystal Ball line shape as defined in ROOT’s RooCrystalBall.

The probability density function is defined as:

\[\begin{split}f(m; m_0, \sigma_L, \sigma_R, \alpha_L, \alpha_R, n_L, n_R) = \begin{cases} A_L \cdot \left(B_L - \frac{m - m_0}{\sigma_L}\right)^{-n_L}, & \text{for } \frac{m - m_0}{\sigma_L} < -\alpha_L \\ \exp\left(-\frac{1}{2} \cdot \left[\frac{m - m_0}{\sigma_L}\right]^2\right), & \text{for } \frac{m - m_0}{\sigma_L} \leq 0 \\ \exp\left(-\frac{1}{2} \cdot \left[\frac{m - m_0}{\sigma_R}\right]^2\right), & \text{for } \frac{m - m_0}{\sigma_R} \leq \alpha_R \\ A_R \cdot \left(B_R + \frac{m - m_0}{\sigma_R}\right)^{-n_R}, & \text{otherwise} \end{cases}\end{split}\]

where:

\[\begin{split}\begin{align} A_i &= \left(\frac{n_i}{\alpha_i}\right)^{n_i} \cdot \exp\left(-\frac{\alpha_i^2}{2}\right) \\ B_i &= \frac{n_i}{\alpha_i} - \alpha_i \end{align}\end{split}\]
Parameters:
  • m (str) – Observable variable

  • m0 (str) – Peak position (mean)

  • sigma_L (str) – Left-side width parameter (must be > 0)

  • sigma_R (str) – Right-side width parameter (must be > 0)

  • alpha_L (str) – Left-side transition point (must be > 0)

  • alpha_R (str) – Right-side transition point (must be > 0)

  • n_L (str) – Left-side power law exponent (must be > 0)

  • n_R (str) – Right-side power law exponent (must be > 0)

Note

All parameters except m and m0 must be positive. The distribution reduces to a single-sided Crystal Ball when one of the alpha parameters is set to zero.

Parameters:

name (str)

__init__(*, name, alpha_L, alpha_R, m, m0, n_R, n_L, sigma_L, sigma_R)[source]

Initialize a CrystalBallDist.

Parameters:
  • name (str) – Name of the distribution

  • alpha_L (str) – Left-side transition point parameter name

  • alpha_R (str) – Right-side transition point parameter name

  • m (str) – Observable variable name

  • m0 (str) – Peak position parameter name

  • n_L (str) – Left-side power law exponent parameter name

  • n_R (str) – Right-side power law exponent parameter name

  • sigma_L (str) – Left-side width parameter name

  • sigma_R (str) – Right-side width parameter name

Methods

__init__(*, name, alpha_L, alpha_R, m, m0, ...)

Initialize a CrystalBallDist.

expression(distributionsandparameters)

Evaluate the Crystal Ball distribution.

from_dict(config)

Create a CrystalBallDist from a dictionary configuration.