smoofit.model.Process

class smoofit.model.Process(name, sub_procs=None)[source]

Represents a process entering the analysis.

A process is identified by its name.

A process can be a “simple” process, or it can be composed of “sub-processes”, when it makes physical sense to consider several processes together.

For instance, when using an EFT, the sub-processes could correspond to the various contributions of the EFT expansion (SM prediction, interferences, squared/cross terms), or the points of a morphing basis.

Another use case would be differential measurements (unfolding), where each generator-level bin of the measured distribution is treated as a different signal. These various signals can then be naturally represented as a single Process object.

Using sub-processes instead of several simple processes in those cases is not mandatory, but makes it easier (and more efficient) to specify how the process components are affected by the parameters of the model (which can be vectors!).

The actual predicted yields of the process, or the systematic uncertainties that affect it, are specified through ChannelContrib objects.

Methods

__init__(name[, sub_procs])

Constructor

add_contrib(channel_contrib)

Register a channel contribution for this process

batch_pred(values)

Compute the yields of the process using a batch of parameter values.

pred(values)

Compute the yields of the process given the parameter values.

scale_bins_by(var)

Register a Variable as a linear yield modifier across bins

scale_by(var)

Register a Variable as a linear yield modifier (e.g.

scale_by_fn(fn, variables)

Scale the yields of this process by an arbitrary function

__init__(name, sub_procs=None)[source]

Constructor

Parameters
  • name (str) – name of the process - should be unique among all the processes linked to a Model object.

  • sub_procs (Optional[List[str]]) – names of the sub-processes - also defines how many there are (default is “simple” process, i.e. no sub-components)

add_contrib(channel_contrib)[source]

Register a channel contribution for this process

Parameters

channel_contrib (ChannelContrib) – a ChannelContrib object

batch_pred(values)[source]

Compute the yields of the process using a batch of parameter values.

Note

This method is only available after the model to which this process has been assigned has been prepared!

Parameters

values (DeviceArrayBase) – 2D array where the first axis is the batch dimension, i.e. every row specifies parameter values in the order expeced by the compiled model

Return type

Tuple[DeviceArrayBase, DeviceArrayBase]

Returns

a tuple of two 3D jnp.DeviceArray where the entries (i,j,:) in the first (second) array contain the predicted yields (sumw2), across all channels, of the sub-process with index j given the parameter values in row i of values (if the process has no sub-processes, this axis has only one entry)

pred(values)[source]

Compute the yields of the process given the parameter values.

Note

This method is only available after the model to which this process has been assigned has been prepared!

Parameters

values (DeviceArrayBase) – 1D array with the parameter values in the order expected by the compiled model, e.g. as returned by Model.values_from_dict()

Return type

Tuple[DeviceArrayBase, DeviceArrayBase]

Returns

a tuple of two 2D jnp.DeviceArray where the entries (j,:) in the first (second) array contain the predicted yields (sumw2), across all channels, of the sub-process with index j (if the process has no sub-processes, this axis has only one entry)

scale_bins_by(var)[source]

Register a Variable as a linear yield modifier across bins

If the parameter is a scalar, the yields in all bins and sub-processes of this process will be scaled linearly by the parameter.

If the parameter is vector-valued, the dimensionality of the variable should match the number of bins (across all channels) of this process. The yields in each bin will then be scaled linearly by a single component of the variable.

Parameters

var (Variable) – a Variable scaling the yields of this process

scale_by(var)[source]

Register a Variable as a linear yield modifier (e.g. signal strength modifier)

If the parameter is a scalar, the yields in all bins and sub-processes of this process will be scaled linearly by the parameter.

If the parameter is vector-valued, the dimensionality of the variable should match the number of sub-processes of this process. Each sub-process will then be scaled linearly by a single component of the variable.

Parameters

var (Variable) – a Variable scaling the yields of this process

scale_by_fn(fn, variables)[source]

Scale the yields of this process by an arbitrary function

The input variables to the function are passed as positional arguments. Each argument is a 1D jnp.DeviceArray with the same shape as the corresponding Variable, except if the latter is a scalar, in which case the argument would have shape (1,).

The return value of the function should be broadcastable (with standard broadcasting rules) to a 2D shape (number of sub-processes, number of bins across all channels). This means that:

  • a scalar or array with shape (1,) or (1, 1) will be broadcast to all sub-processes and bins

  • an array with shape (n_sub_procs, 1) will scale each sub-process by a different value, but uniformly across all bins

  • an array with shape (1, n_bins) will scale each bin by a different value, but uniformly across all sub-processes

  • an array with shape (n_sub_procs, n_bins) will scale each sub-process and each bin by a different value

Parameters
  • fn (Callable[[DeviceArrayBase], DeviceArrayBase]) – a callable returning the factors by which the yields should be scaled

  • variables (Union[Variable, Tuple[Variable]]) – a Variable or a tuple of Variable objects whose values will be passed to fn