ATLAS Offline Software
Loading...
Searching...
No Matches
CheckCPSGroups Namespace Reference

Functions

 checkCPSGroups (chainDicts)

Variables

str __doc__ = "Validation of coherent prescales set on the list of chains"
 log = logging.getLogger(__name__)

Detailed Description

Validation of Coherent Prescale Groups
- Python check that all Coherent Prescale group assignments are reasonable
- Allows early failure in the case of invalid groups, such as:
  - Only one chain in CPS group
  - Multiple L1 inputs for same CPS group
  - CPS group not matching L1 name

Author: Teng Jian Khoo

Function Documentation

◆ checkCPSGroups()

CheckCPSGroups.checkCPSGroups ( chainDicts)

Definition at line 19 of file CheckCPSGroups.py.

19def checkCPSGroups(chainDicts):
20
21 cps_to_chain = {}
22 for hlt in chainDicts:
23 # Extract all CPS items
24 for group in hlt["groups"]:
25 if 'CPS' in group:
26 # Add if not existing
27 if group not in cps_to_chain:
28 cps_to_chain[group] = []
29 cps_to_chain[group].append(hlt)
30
31 CPS_OK = True
32 for CPS_group, HLT_list in cps_to_chain.items():
33 CPS_item = CPS_group.split('CPS_',1)[1]
34
35 if not CPS_group.startswith('RATE:CPS'):
36 log.error("Malformed CPS group %s", CPS_group)
37 CPS_OK = False
38
39 # Checks for each CPS item
40 if len(HLT_list)<2:
41 log.error("CPS group %s contains too few chains %s", CPS_group, [hlt['chainName'] for hlt in HLT_list])
42 CPS_OK = False
43
44 for grp in hlt['groups']:
45 if 'Primary' in grp:
46 log.error("Primary trigger '%s' in CPS %s", hlt['chainName'], CPS_group)
47 CPS_OK = False
48
49 # Verify L1 item matches CPS group
50 if ',' in hlt['L1item']:
51 if CPS_item != hlt['name'].rsplit('_L1')[1]:
52 log.error("CPS group %s for HLT chain %s does not match mult-seed L1 item %s", CPS_group, hlt['chainName'], hlt['name'].rsplit('_L1')[1])
53 CPS_OK = False
54 # Checks CPS for multi-seed items
55 else:
56 if CPS_item != hlt['L1item'][3:]:
57 log.error("CPS group %s for HLT chain %s does not match L1 item %s", CPS_group, hlt['chainName'], hlt['L1item'])
58 CPS_OK = False
59 # Passing this check also implies that there is exactly 1 L1 for the CPS group
60
61 if not CPS_OK:
62 raise Exception("Invalid CPS group assignments found")

Variable Documentation

◆ __doc__

str CheckCPSGroups.__doc__ = "Validation of coherent prescales set on the list of chains"
private

Definition at line 14 of file CheckCPSGroups.py.

◆ log

CheckCPSGroups.log = logging.getLogger(__name__)

Definition at line 17 of file CheckCPSGroups.py.