cabinetry
cabinetry copied to clipboard
Generalizing overriding of settings in config
When creating the instructions for building a given template histogram, cabinetry
combines information from regions, samples and systematics (and the specific up/down template). From highest to lowest level, the order is regions -> samples -> systematics. Settings are taken from the lowest level where they are available. This means that a weight
specified for a systematic template will override the weight
for the relevant sample for a given template.
At the moment, the implementation takes settings from the highest level and checks for overrides at lower levels via a function in template_builder
: https://github.com/alexander-held/cabinetry/blob/d62a1612e00c357954160b14ad9dccd833a0c862/src/cabinetry/template_builder.py#L17-L20
This check is done for a limited number of settings, where it is most relevant. At the moment, not all settings can be overridden.
Possible improvements The current approach should likely be generalized to allow overriding any settings. Instead of checking the highest level and then checking for overrides at lower levels, should also consider checking at the lowest level and going higher up until all relevant settings are filled. This could allow the use of settings that are specified only at lower levels (e.g. in systematics) without a corresponding higher level setting.
When adopting this more general approach, the config schema has to be relaxed. At the moment it restricts which settings can be used at lower levels (samples / systematics) to the settings that are actually supported.
Related issues #43 discusses configuration file design.