columnflow.reduction#

Event and collection reduction objects.

Classes:

Reducer(*args, **kwargs)

Base class for all reducers.

Functions:

reducer([func, bases, mc_only, data_only])

Decorator for creating a new Reducer subclass with additional, optional bases and attaching the decorated function to it as call_func.

class Reducer(*args, **kwargs)[source]#

Bases: TaskArrayFunction

Base class for all reducers.

Attributes:

Methods:

reducer([func, bases, mc_only, data_only])

Decorator for creating a new Reducer subclass with additional, optional bases and attaching the decorated function to it as call_func.

exposed = True#
classmethod reducer(func=None, bases=(), mc_only=False, data_only=False, **kwargs)[source]#

Decorator for creating a new Reducer subclass with additional, optional bases and attaching the decorated function to it as call_func.

When mc_only (data_only) is True, the reducer is skipped and not considered by other task array functions in case they are evalauted on a order.Dataset (using the dataset_inst attribute) whose is_mc (is_data) attribute is False.

All additional kwargs are added as class members of the new subclasses.

Parameters:
  • func (Callable | None, default: None) – Function to be wrapped and integrated into new Reducer class.

  • bases (tuple, default: ()) – Additional bases for the new reducer.

  • mc_only (bool, default: False) – Boolean flag indicating that this reducer should only run on Monte Carlo simulation and skipped for real data.

  • data_only (bool, default: False) – Boolean flag indicating that this reducer should only run on real data and skipped for Monte Carlo simulation.

Return type:

DerivableMeta | Callable

Returns:

New reducer subclass.

cache_instances = True#
reducer(func=None, bases=(), mc_only=False, data_only=False, **kwargs)#

Decorator for creating a new Reducer subclass with additional, optional bases and attaching the decorated function to it as call_func.

When mc_only (data_only) is True, the reducer is skipped and not considered by other task array functions in case they are evalauted on a order.Dataset (using the dataset_inst attribute) whose is_mc (is_data) attribute is False.

All additional kwargs are added as class members of the new subclasses.

Parameters:
  • func (Callable | None, default: None) – Function to be wrapped and integrated into new Reducer class.

  • bases (tuple, default: ()) – Additional bases for the new reducer.

  • mc_only (bool, default: False) – Boolean flag indicating that this reducer should only run on Monte Carlo simulation and skipped for real data.

  • data_only (bool, default: False) – Boolean flag indicating that this reducer should only run on real data and skipped for Monte Carlo simulation.

Return type:

DerivableMeta | Callable

Returns:

New reducer subclass.