btag#

Producers for btag scale factor weights.

Classes:

BTagSFConfig(correction_set, jec_sources[, ...])

btag_weights(*args, **kwargs)

class BTagSFConfig(correction_set, jec_sources, discriminator='', corrector_kwargs=<factory>)[source]#

Bases: object

Attributes:

Methods:

new(obj)

correction_set: str#
jec_sources: list[str]#
discriminator: str = ''#
corrector_kwargs: dict[str, Any]#
classmethod new(obj)[source]#
Return type:

BTagSFConfig

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

Bases: Producer

Attributes:

Methods:

call_func(events, task[, jet_mask, ...])

B-tag scale factor weight producer.

get_btag_config()

get_btag_file(external_files)

post_init_func(task, **kwargs)

requires_func(task, reqs, **kwargs)

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

skip_func(**kwargs)

update_cls_dict(cls_name, cls_dict, get_attr)

cache_instances = True#
call_func(events, task, jet_mask=Ellipsis, negative_b_score_action='ignore', negative_b_score_log_mode='warning', **kwargs)#

B-tag scale factor weight producer. Requires an external file in the config as under btag_sf_corr:

cfg.x.external_files = DotDict.wrap({
    "btag_sf_corr": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/BTV/2017_UL/btagging.json.gz",  # noqa
})

get_btag_file can be adapted in a subclass in case it is stored differently in the external files.

The name of the correction set, a list of JEC uncertainty sources which should be propagated through the weight calculation, and the column used for b-tagging should be given as an auxiliary entry in the config:

cfg.x.btag_sf = BTagSFConfig(
    correction_set="deepJet_shape",
    jec_sources=["Absolute", "FlavorQCD", ...],
    discriminator="btagDeepFlavB",
    corrector_kwargs={...},
)

get_btag_config can be adapted in a subclass in case it is stored differently in the config.

Optionally, a jet_mask can be supplied to compute the scale factor weight based only on a subset of jets.

The negative_b_score_action defines the procedure of how to handle jets with a negative b-tag. Supported modes are: :rtype: ak.Array

  • “ignore”: the jet_mask is extended to exclude jets with b_score < 0

  • “remove”: the scale factor is set to 0 for jets with b_score < 0, resulting in an overall

    btag weight of 0 for the event

  • “raise”: an exception is raised

The verbosity of the handling of jets with negative b-score can be set via negative_b_score_log_mode, which offers the following options:

  • "none": no message is given

  • "info": a logger.info message is given

  • "debug": a logger.debug message is given

  • "warning": a logger.warning message is given

Resources:

data_only = False#
get_btag_config()#
get_btag_file(external_files)#
mc_only = True#
post_init_func(task, **kwargs)#
Return type:

None

requires_func(task, reqs, **kwargs)#
Return type:

None

setup_func(task, reqs, inputs, reader_targets, **kwargs)#
Return type:

None

skip_func(**kwargs) bool#
Return type:

bool

static update_cls_dict(cls_name, cls_dict, get_attr)#
uses = {'Jet.{pt,eta,phi,mass,hadronFlavour}'}#
weight_name = 'btag_weight'#