diff --git a/Trigger/TrigValidation/TrigValTools/bin/chainComp.py b/Trigger/TrigValidation/TrigValTools/bin/chainComp.py index 8db48946665d3b22a264cdeaa06e6f47b745da52..860ebf0036da9f882493275c3b450e20b85d6814 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/chainComp.py +++ b/Trigger/TrigValidation/TrigValTools/bin/chainComp.py @@ -109,15 +109,13 @@ def print_event_diff(inp_data, ref_data, key): def print_step_diff(inp_data, ref_data, key): - if key not in inp_data: - inp_data[key] = dict() - if key not in ref_data: - ref_data[key] = dict() - if inp_data[key] != ref_data[key]: + inp_steps = inp_data.get(key, dict()) + ref_steps = ref_data.get(key, dict()) + if inp_steps != ref_steps: logging.info(' %s:', key) - for step in range(max(len(inp_data[key]), len(ref_data[key]))): - inp_count = inp_data[key][step] if step in inp_data[key] else 0 - ref_count = ref_data[key][step] if step in ref_data[key] else 0 + for step in range(max(len(inp_steps), len(ref_steps))): + inp_count = inp_steps.get(step, 0) + ref_count = ref_steps.get(step, 0) if inp_count != ref_count: logging.info(' %d: %d -> %d', step, ref_count, inp_count)