btag#

Producers for btag scale factor weights.

Classes:

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

Functions:

get_b_score_column(btag_config)

Helper function to resolve the btag score column from the btag configuration.

class btag_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, pick_cached_result=law.util.no_value, inst_dict=None, **kwargs)[source]#

Bases: Producer

Methods:

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

B-tag scale factor weight producer.

get_btag_config()

get_btag_file(external_files)

init_func()

rtype:

None

requires_func(reqs)

rtype:

None

setup_func(reqs, inputs, reader_targets)

rtype:

None

skip_func()

Attributes:

data_only

mc_only

nominal_only

shifts_only

uses

call_func(events, 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 = ("deepJet_shape", ["Absolute", "FlavorQCD", ...], "btagDeepFlavB")

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 btag_weight is set to 0 for jets with b_score < 0

  • “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)#
init_func()#
Return type:

None

mc_only = True#
nominal_only = False#
requires_func(reqs)#
Return type:

None

setup_func(reqs, inputs, reader_targets)#
Return type:

None

shifts_only = None#
skip_func()#
uses = {'Jet.eta', 'Jet.hadronFlavour', 'Jet.pt'}#
get_b_score_column(btag_config)[source]#

Helper function to resolve the btag score column from the btag configuration.

Parameters:

btag_config (tuple[str, list, str] | tuple[str, list]) – Entry in auxiliary config_inst.x.btag_sf, see example

btag_weights(). If tuple has less than 3 entries, the column name is derived from the name of the correction set. :rtype: str :returns: Name of column that is required for the calculation of this set of corrections.