columnflow.weight#
Tools for producing new columns to be used as event or object weights.
Classes:
|
Base class for all weight producers, i.e., functions that produce and return a single column that is meant to be used as a per-event or per-object weight. |
Functions:
|
Decorator for creating a new |
- class WeightProducer(*args, requires_func=law.util.no_value, setup_func=law.util.no_value, sandbox=law.util.no_value, call_force=law.util.no_value, max_chunk_size=law.util.no_value, pick_cached_result=law.util.no_value, inst_dict=None, **kwargs)[source]#
Bases:
TaskArrayFunctionBase class for all weight producers, i.e., functions that produce and return a single column that is meant to be used as a per-event or per-object weight.
Attributes:
Methods:
weight_producer([func, bases, mc_only, ...])Decorator for creating a new
WeightProducersubclass with additional, optional bases and attaching the decorated function to it ascall_func().- exposed = True#
- classmethod weight_producer(func=None, bases=(), mc_only=False, data_only=False, **kwargs)[source]#
Decorator for creating a new
WeightProducersubclass with additional, optional bases and attaching the decorated function to it ascall_func().When mc_only (data_only) is True, the weight producer is skipped and not considered by other calibrators, selectors and producers in case they are evaluated on a
order.Dataset(using thedataset_instattribute) whoseis_mc(is_data) attribute is False.When nominal_only is True or shifts_only is set, the producer is skipped and not considered by other calibrators, selectors and producers in case they are evaluated on a
order.Shift(using theglobal_shift_instattribute) whose name does not match.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 newWeightProducerclass.bases (tuple, default:
()) – Additional bases for the newWeightProducer.mc_only (bool, default:
False) – Boolean flag indicating that thisWeightProducershould only run on Monte Carlo simulation and skipped for real data.data_only (bool, default:
False) – Boolean flag indicating that thisWeightProducershould only run on real data and skipped for Monte Carlo simulation.
- Return type:
DerivableMeta | Callable
- Returns:
New
WeightProducersubclass.
- weight_producer(func=None, bases=(), mc_only=False, data_only=False, **kwargs)#
Decorator for creating a new
WeightProducersubclass with additional, optional bases and attaching the decorated function to it ascall_func().When mc_only (data_only) is True, the weight producer is skipped and not considered by other calibrators, selectors and producers in case they are evaluated on a
order.Dataset(using thedataset_instattribute) whoseis_mc(is_data) attribute is False.When nominal_only is True or shifts_only is set, the producer is skipped and not considered by other calibrators, selectors and producers in case they are evaluated on a
order.Shift(using theglobal_shift_instattribute) whose name does not match.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 newWeightProducerclass.bases (tuple, default:
()) – Additional bases for the newWeightProducer.mc_only (bool, default:
False) – Boolean flag indicating that thisWeightProducershould only run on Monte Carlo simulation and skipped for real data.data_only (bool, default:
False) – Boolean flag indicating that thisWeightProducershould only run on real data and skipped for Monte Carlo simulation.
- Return type:
DerivableMeta | Callable
- Returns:
New
WeightProducersubclass.