|
15 | 15 | prompt_validation_script_package = "prompt.validations." |
16 | 16 | prompt_validation_script_dir = "calibration/scripts/prompt/validations" |
17 | 17 |
|
18 | | -input_data_filters = {"Magnet": {"On": "On", |
| 18 | +INPUT_DATA_FILTERS = {"Magnet": {"On": "On", |
19 | 19 | "Off": "Off", |
20 | 20 | "Either": "Either"}, |
21 | 21 | "Beam Energy": {"No Beam": "No Beam", |
|
31 | 31 | "cosmic_calib": "cosmic_calib", |
32 | 32 | "gamma_gamma_calib": "gamma_gamma_calib", |
33 | 33 | "hadron_calib": "hadron_calib", |
34 | | - "mumutight_calib": "mumutight_calib", |
| 34 | + "mumutight_or_highm_calib": "mumutight_or_highm_calib", |
35 | 35 | "offip_calib": "offip_calib", |
36 | 36 | "radmumu_calib": "radmumu_calib", |
37 | 37 | "random_calib": "random_calib", |
@@ -81,7 +81,7 @@ class CalibrationSettings(namedtuple('CalSet_Factory', |
81 | 81 | input_data_filters dictionary e.g. from prompt import input_data_filters with details about data tags and run quality |
82 | 82 | tags found at: https://calibration.belle2.org/belle2/data_tags/list/. |
83 | 83 | To exclude specific filters, pre-append with *NOT* e.g. |
84 | | - {"all_events": ["mumutight_calib", "hadron_calib", "Good", "On"], |
| 84 | + {"all_events": ["mumutight_or_highm_calib", "hadron_calib", "Good", "On"], |
85 | 85 | "offres_photon_events": ["gamma_gamma_calib", "Good", "NOT On"]}. |
86 | 86 | Not selecting a specfic filters (e.g. Magnet) is equivalent to not having any requirements, e.g. (Either) |
87 | 87 |
|
@@ -121,6 +121,20 @@ def __new__(cls, name, expert_username, description, |
121 | 121 | raise ValueError("You must specify at least one input data name") |
122 | 122 | input_data_names = frozenset(input_data_names) |
123 | 123 |
|
| 124 | + # The input data names in the filters MUST correspond to the input data names for the calibration. |
| 125 | + if input_data_filters: |
| 126 | + if set(input_data_filters.keys()) != input_data_names: |
| 127 | + raise ValueError("The 'input_data_filters' keys don't match the 'input_data_names'!") |
| 128 | + # Requested input data filters MUST exist in the ones we defined in the global dictionary. |
| 129 | + allowed_filters = {filter_name for category in INPUT_DATA_FILTERS.values() for filter_name in category} |
| 130 | + requested_filters = {filter_name.replace("NOT", "", 1).lstrip() for filters in input_data_filters.values() |
| 131 | + for filter_name in filters} |
| 132 | + if not allowed_filters.issuperset(requested_filters): |
| 133 | + raise ValueError("The 'input_data_filters' contains unknown filter names:" |
| 134 | + f"{requested_filters.difference(allowed_filters)}") |
| 135 | + else: |
| 136 | + input_data_filters = {} |
| 137 | + |
124 | 138 | if expert_config: |
125 | 139 | # Check that it's a dictionary and not some other valid JSON object |
126 | 140 | if not isinstance(expert_config, dict): |
|
0 commit comments