all_weights#

Exemplary event weight producer.

Classes:

all_weights(*args[, requires_func, ...])

class all_weights(*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: WeightProducer

Methods:

call_func(events, **kwargs)

WeightProducer that combines all event weights from the event_weights aux entry from either the config or the dataset.

init_func()

rtype:

None

skip_func()

update_cls_dict(cls_name, cls_dict, get_attr)

Attributes:

call_func(events, **kwargs)#

WeightProducer that combines all event weights from the event_weights aux entry from either the config or the dataset. The weights are multiplied together to form the full event weight.

The expected structure of the event_weights aux entry is a dictionary with the weight column name as key and a list of shift sources as values. The shift sources are used to declare the shifts that the produced event weight depends on. Example:

from columnflow.config_util import get_shifts_from_sources
# add weights and their corresponding shifts for all datasets
cfg.x.event_weights = {
    "normalization_weight": [],
    "muon_weight": get_shifts_from_sources(config, "mu_sf"),
    "btag_weight": get_shifts_from_sources(config, "btag_hf", "btag_lf"),
}
for dataset_inst in cfg.datasets:
    # add dataset-specific weights and their corresponding shifts
    dataset.x.event_weights = {}
    if not dataset_inst.has_tag("skip_pdf"):
        dataset_inst.x.event_weights["pdf_weight"] = get_shifts_from_sources(config, "pdf")
Return type:

Array

data_only = False#
init_func()#
Return type:

None

mc_only = True#
skip_func()#
static update_cls_dict(cls_name, cls_dict, get_attr)#