normalization#

Column production methods related to sample normalization event weights.

Functions:

get_inclusive_dataset(self)

Helper function to obtain the inclusive dataset from a list of datasets that are required to stitch this dataset_inst.

get_stitching_datasets(self)

Helper function to obtain all datasets that are required to stitch this dataset_inst.

get_br_from_inclusive_dataset(self, ...)

Helper function to compute the branching ratios from the inclusive sample.

Classes:

get_inclusive_dataset(self)[source]#

Helper function to obtain the inclusive dataset from a list of datasets that are required to stitch this dataset_inst.

Return type:

Dataset

get_stitching_datasets(self)[source]#

Helper function to obtain all datasets that are required to stitch this dataset_inst.

Return type:

list[Dataset]

get_br_from_inclusive_dataset(self, inclusive_dataset, stats)[source]#

Helper function to compute the branching ratios from the inclusive sample. This is done with ratios of event weights isolated per dataset and thus independent of the overall mc weight normalization.

Return type:

dict[int, float]

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

Bases: Producer

Attributes:

Methods:

call_func(events, **kwargs)

Uses luminosity information of internal py:attr:config_inst, the cross section of a process obtained through category_ids and the sum of event weights from the py:attr:selection_stats attribute to assign each event a normalization weight.

get_br_from_inclusive_dataset(...)

Helper function to compute the branching ratios from the inclusive sample.

get_inclusive_dataset()

Helper function to obtain the inclusive dataset from a list of datasets that are required to stitch this dataset_inst.

get_stitching_datasets()

Helper function to obtain all datasets that are required to stitch this dataset_inst.

init_func(**kwargs)

Initializes the normalization weights producer by setting up the normalization weight column.

requires_func(task, reqs, **kwargs)

Adds the requirements needed by the underlying py:attr:task to access selection stats into reqs.

setup_func(task, reqs, inputs, ...)

Sets up objects required by the computation of normalization weights and stores them as instance attributes: :rtype: None

skip_func(**kwargs)

update_cls_dict(cls_name, cls_dict, get_attr)

allow_stitching = False#
cache_instances = True#
call_func(events, **kwargs)#

Uses luminosity information of internal py:attr:config_inst, the cross section of a process obtained through category_ids and the sum of event weights from the py:attr:selection_stats attribute to assign each event a normalization weight. The normalization weight is stored in a new column named after the py:attr:weight_name attribute.

The computation of all weights requires that the selection statistics (“stats” output of SelectEvents) contains a field "sum_mc_weight_per_process" which itself is a dictionary mapping process ids to the sum of event weights for that process.

luminosity is used to scale the yield of the simulation. When None, the luminosity auxiliary field of the config is used.

When py:attr`allow_stitching` is set to True, the sum of event weights is computed for all datasets with a leaf process contained in the leaf processes of the py:attr:dataset_inst. For stitching, the process_id needs to be reconstructed for each leaf process on a per event basis. Moreover, when stitching is enabled, an additional normalization weight is computed for the inclusive dataset only and stored in a column named <weight_name>_inclusive_only. This weight resembles the normalization weight for the inclusive dataset, as if it were unstitched and should therefore only be applied, when using the inclusive dataset as a standalone dataset.

Return type:

Array

data_only = False#
get_br_from_inclusive_dataset(inclusive_dataset, stats)#

Helper function to compute the branching ratios from the inclusive sample. This is done with ratios of event weights isolated per dataset and thus independent of the overall mc weight normalization.

Return type:

dict[int, float]

get_inclusive_dataset()#

Helper function to obtain the inclusive dataset from a list of datasets that are required to stitch this dataset_inst.

Return type:

Dataset

get_stitching_datasets()#

Helper function to obtain all datasets that are required to stitch this dataset_inst.

Return type:

list[Dataset]

get_xsecs_from_inclusive_dataset = False#
init_func(**kwargs)#

Initializes the normalization weights producer by setting up the normalization weight column.

Return type:

None

luminosity = None#
mc_only = True#
requires_func(task, reqs, **kwargs)#

Adds the requirements needed by the underlying py:attr:task to access selection stats into reqs.

Return type:

None

setup_func(task, reqs, inputs, reader_targets, **kwargs)#

Sets up objects required by the computation of normalization weights and stores them as instance attributes: :rtype: None

  • py: attr: process_weight_table: A sparse array serving as a lookup table for the calculated process weights.

    This weight is defined as the product of the luminosity, the cross section, divided by the sum of event weights per process.

skip_func(**kwargs) bool#
Return type:

bool

static update_cls_dict(cls_name, cls_dict, get_attr)#
uses = {'mc_weight', 'process_id'}#
weight_name = 'normalization_weight'#
class stitched_normalization_weights(*args, **kwargs)#

Bases: normalization_weights

Attributes:

Methods:

skip_func(**kwargs)

allow_stitching = True#
cache_instances = True#
get_xsecs_from_inclusive_dataset = True#
skip_func(**kwargs) bool#
Return type:

bool

weight_name = 'normalization_weight'#
class stitched_normalization_weights_brs_from_processes(*args, **kwargs)#

Bases: stitched_normalization_weights

Attributes:

Methods:

skip_func(**kwargs)

cache_instances = True#
get_xsecs_from_inclusive_dataset = False#
skip_func(**kwargs) bool#
Return type:

bool