normalization#
Column production methods related to sample normalization event weights.
Functions:
|
Helper function to obtain information about stitching datasets: :rtype: |
|
Helper function to compute the branching ratios from sum of weights of inclusive samples. |
|
Hook to optionally update the per-dataset selection stats. |
Classes:
|
|
|
|
- get_stitching_datasets(self, debug=False)[source]#
Helper function to obtain information about stitching datasets: :rtype:
tuple[Dataset,list[Dataset]]the inclusive dataset, which is the dataset that contains all processes
all datasets that are required to stitch this dataset_inst
- get_br_from_inclusive_datasets(self, process_insts, dataset_selection_stats, merged_selection_stats, debug=False)[source]#
Helper function to compute the branching ratios from sum of weights of inclusive samples.
- Return type:
dict[od.Process, float]
- update_dataset_selection_stats(self, dataset_selection_stats)[source]#
Hook to optionally update the per-dataset selection stats.
- Return type:
dict[str, dict[str, float | dict[str, float]]]
- class normalization_weights(*args, **kwargs)[source]#
Bases:
ProducerAttributes:
Methods:
call_func(events, **kwargs)Uses luminosity information of internal py:attr:config_inst, the cross section of a process obtained through
category_idsand the sum of event weights from the py:attr:selection_stats attribute to assign each event a normalization weight.get_br_from_inclusive_datasets(...[, debug])Helper function to compute the branching ratios from sum of weights of inclusive samples.
get_stitching_datasets([debug])Helper function to obtain information about stitching datasets: :rtype:
tuple[Dataset,list[Dataset]]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:
Noneskip_func(**kwargs)Default skip function.
update_cls_dict(cls_name, cls_dict, get_attr)Hook to optionally update the per-dataset selection stats.
- 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_idsand 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
luminosityauxiliary 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:
- get_br_from_inclusive_datasets(process_insts, dataset_selection_stats, merged_selection_stats, debug=False)#
Helper function to compute the branching ratios from sum of weights of inclusive samples.
- Return type:
dict[od.Process, float]
- get_stitching_datasets(debug=False)#
Helper function to obtain information about stitching datasets: :rtype:
tuple[Dataset,list[Dataset]]the inclusive dataset, which is the dataset that contains all processes
all datasets that are required to stitch this dataset_inst
- get_xsecs_from_inclusive_datasets = False#
- init_func(**kwargs)#
Initializes the normalization weights producer by setting up the normalization weight column.
- Return type:
- luminosity = None#
- mc_only: bool = True#
- normalize_weights_per_dataset = True#
- requires_func(task, reqs, **kwargs)#
Adds the requirements needed by the underlying py:attr:task to access selection stats into reqs.
- Return type:
- 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.
py: attr: known_process_ids: A set of all process ids that are known by the lookup table.
- static update_cls_dict(cls_name, cls_dict, get_attr)#
- update_dataset_selection_stats(dataset_selection_stats)#
Hook to optionally update the per-dataset selection stats.
- Return type:
dict[str, dict[str, float | dict[str, float]]]
- update_dataset_selection_stats_br = None#
- update_dataset_selection_stats_sum_weights = None#
- uses = {'mc_weight', 'process_id'}#
- weight_name = 'normalization_weight'#
- class stitched_normalization_weights(*args, **kwargs)#
Bases:
normalization_weightsAttributes:
Methods:
skip_func(**kwargs)Default skip function.
- allow_stitching = True#
- cache_instances = True#
- get_xsecs_from_inclusive_datasets = True#
- weight_name = 'normalization_weight'#
- class stitched_normalization_weights_brs_from_processes(*args, **kwargs)#
Bases:
stitched_normalization_weightsAttributes:
Methods:
skip_func(**kwargs)Default skip function.
- cache_instances = True#
- get_xsecs_from_inclusive_datasets = False#