json_filter#

Selectors for applying golden JSON in data.

Selectors#

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

Bases: Selector

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

Select only events from certified luminosity blocks included in the “golden” JSON. This filter can only be applied in recorded data.

By default, the JSON file should specified in the config as an external file under lumi.golden:

cfg.x.external_files = DotDict.wrap({
    "lumi": {
        "golden": "/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/Legacy_2017/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSON.txt",  # noqa
    },
})

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

Parameters:
  • events (Array) – Array containing events in the NanoAOD format

  • data_only (default: True) – boolean flag to indicate that this selector should only run on observed data, defaults to True

Return type:

Array

Returns:

Array containing boolean masks to accept or reject given events

data_only = False#
get_lumi_file(external_files)#

Function to load path or url to golden json files.

By default, the path is extracted from the current config_inst, which should have a external_files in the auxiliary information block. The path or url is extracted with

external_files.lumi.golden
Parameters:

external_files (DotDict) – Config containing the information about the path or url to the golden json file containing good lumi sections.

Return type:

str

Returns:

path or url to golden json file.

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

None

setup_func(reqs, inputs, reader_targets)#

Setup function for json_filter. Load golden JSON and set up run/luminosity block lookup table.

Parameters:
  • reqs (dict) – Contains requirements for this task

  • inputs (dict) – Additional inputs, currently not used

  • reader_targets (InsertableDict) – Additional targets, currently not used

Return type:

None

shifts_only = None#
uses = {'luminosityBlock', 'run'}#