default#

Default histogram producers that define columnflow’s default behavior.

Classes:

cf_default(*args, **kwargs)

all_weights(*args, **kwargs)

class cf_default(*args, create_hist_func=law.util.no_value, fill_hist_func=law.util.no_value, post_process_hist_func=law.util.no_value, post_process_merged_hist_func=law.util.no_value, **kwargs)[source]#

Bases: HistProducer

Attributes:

Methods:

call_func(events, **kwargs)

Default histogram producer that implements all hooks necessary to ensure columnflow's default behavior: :rtype: Array

create_hist_func(variables, task, **kwargs)

Define the histogram structure for the default histogram producer.

fill_hist_func(h, data, task)

Fill the histogram with the data.

post_process_hist_func(h, task)

Post-process the histogram, converting integer to string axis for consistent lookup across configs where ids might be different.

skip_func(**kwargs)

update_cls_dict(cls_name, cls_dict, get_attr)

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

Default histogram producer that implements all hooks necessary to ensure columnflow’s default behavior: :rtype: Array

  • create_hist: defines the histogram structure

  • __call__: receives an event chunk and updates it, and creates event weights (1’s in this case)

  • fill: receives the data and fills the histogram

  • post_process_hist: post-processes the histogram before it is saved

create_hist_func(variables, task, **kwargs)#

Define the histogram structure for the default histogram producer.

data_only = False#
fill_hist_func(h, data, task)#

Fill the histogram with the data.

mc_only = False#
post_process_hist_func(h, task)#

Post-process the histogram, converting integer to string axis for consistent lookup across configs where ids might be different.

skip_func(**kwargs) bool#
Return type:

bool

static update_cls_dict(cls_name, cls_dict, get_attr)#
class all_weights(*args, **kwargs)[source]#

Bases: cf_default

Attributes:

Methods:

call_func(events, **kwargs)

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

init_func()

skip_func(**kwargs)

update_cls_dict(cls_name, cls_dict, get_attr)

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

HistProducer 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 = False#
skip_func(**kwargs) bool#
Return type:

bool

static update_cls_dict(cls_name, cls_dict, get_attr)#