reboost.math package

Submodules

reboost.math.functions module

reboost.math.functions.ex_lin_activeness(distances, fccd, alpha, beta)

Exponentially modified linear HPGe activeness model.

This is based on a charge collection efficiency of:

\[\begin{split}f(d) = \begin{cases} \mathrm{exp\_norm} * \left(e^{d/\beta} - 1\right) & \text{if } 0 \leq d < \mathrm{trans\_pt}, \\ 1 + \frac{d - f}{\alpha} & \text{if } \mathrm{trans\_pt} \leq d \leq f, \\ 1 & \text{if } d > f \end{cases}\end{split}\]

Where:

  • d: Distance to surface,

  • f: Full charge collection depth (FCCD).

  • alpha: the slope of the linear part of the function, which controls how quickly the activeness increases in the linear region. A smaller alpha results in a steeper increase, while a larger alpha results in a more gradual increase.

  • beta: the characteristic length scale of the exponential part of the function, which controls how quickly the activeness increases in the exponential region. A smaller beta results in a steeper increase, while a larger beta results in a more gradual increase.

  • trans_pt: the transition point between the exponential and linear parts of the function, which is determined by the parameters fccd, alpha, and beta. It is calculated by matching the functions and the derivatives at the transition point, which ensures a smooth transition between the two regions. The transition point is found by solving the equation:

    \[\alpha + \mathrm{trans\_pt} -f + \beta e^{-\mathrm{trans\_pt}/\beta} - \beta = 0\]
  • exp_norm: the normalization factor for the exponential part of the function, which is determined by the parameters alpha and beta. It is calculated by ensuring that the exponential part of the function matches the linear part at the transition point, which ensures a smooth transition between the two regions.

    \[\mathrm{exp\_norm} = \left(\frac{\beta}{\alpha}\right)\exp\left(-\frac{\mathrm{trans\_pt}}{\beta}\right)\]
Parameters:
  • distances (Array) – the distance from each step to the detector surface. The computation is performed for each element and the shape preserved in the output.

  • fccd_in_mm – the value of the FCCD

  • alpha (float) – the slope parameter for the linear part of the function, which controls how quickly the activeness increases in the linear region. 1 / alpha is the slope of the linear part of the function.

  • beta (float) – the characteristic length scale for the exponential part of the function, which controls how quickly the activeness increases in the exponential region.

  • fccd (float)

Returns:

:class::ak.Array of the activeness per step

Return type:

activeness

reboost.math.functions.piecewise_linear_activeness(distances, fccd_in_mm, dlf)

Piecewise linear HPGe activeness model.

Based on:

\[\begin{split}f(d) = \begin{cases} 0 & \text{if } d < f*l, \\ \frac{x-f*l}{f - f*l} & \text{if } t \leq d < f, \\ 1 & \text{otherwise.} \end{cases}\end{split}\]

Where:

  • d: Distance to surface,

  • l: Dead layer fraction, the fraction of the FCCD which is fully inactive

  • f: Full charge collection depth (FCCD).

Parameters:
  • distances (Array) – the distance from each step to the detector surface. The computation is performed for each element and the shape preserved in the output.

  • fccd_in_mm (float) – the value of the FCCD

  • dlf (float) – the fraction of the FCCD which is fully inactive.

Returns:

a VectorOfVectors or Array of the activeness

Return type:

Array

reboost.math.functions.vectorised_active_energy(distances, edep, fccd, dlf)

Energy after piecewise linear HPGe activeness model vectorised over FCCD or dead layer fraction.

Based on the same linear activeness function as piecewise_linear_activeness(). However, this function vectorises the calculation to provide a range of output energies varying the fccd or dead layer fraction. Either fccd or dlf can be a list. This adds an extra dimension to the output, with the same length as the input fccd or dlf list.

Parameters:
  • distances (Array) – the distance from each step to the detector surface. Can be either a awkward array, or a LGDO VectorOfVectors . The computation is performed for each element and the first dimension is preserved, a new dimension is added vectorising over the FCCD or DLF.

  • edep (Array) – the energy for each step.

  • fccd (float | list) – the value of the FCCD, can be a list.

  • dlf (float | list) – the fraction of the FCCD which is fully inactive, can be a list.

Returns:

Activeness for each set of parameters

Return type:

VectorOfVectors | Array

reboost.math.stats module

reboost.math.stats.apply_energy_resolution(energies, channels, tcm_tables, reso_pars, reso_func)

Apply the energy resolution sampling to an array with many channels.

Parameters:
  • energies (Array) – the energies to smear

  • channels (Array) – the channel index for each energy

  • tcm_tables (dict) – the mapping from indices to channel names.

  • reso_pars (dict) – the pars for each channel.

  • reso_func (Callable) – the function to compute the resolution.

reboost.math.stats.gaussian_sample(mu, sigma, *, seed=None)

Generate samples from a gaussian.

Based on:

\[y_i \sim \mathcal{N}(\mu_i,\sigma_i)\]

where $y_i$ is the output, $x_i$ the input (mu) and $sigma$ is the standard deviation for each point.

Parameters:
  • mu (Array) – the mean positions to sample from, should be a flat (ArrayLike) object.

  • sigma (Array | float) – the standard deviation for each input value, can also be a single float.

  • seed (int | None) – the random seed.

Returns:

sampled values.

Return type:

Array

reboost.math.stats.get_resolution(energies, channels, tcm_tables, reso_pars, reso_func)

Get the resolution for each energy.

Parameters:
  • energies (Array) – the energies to smear

  • channels (Array) – the channel index for each energy

  • tcm_tables (dict) – the mapping from indices to channel names.

  • reso_pars (dict) – the pars for each channel.

  • reso_func (Callable) – the function to compute the resolution.

Return type:

Array