74 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
78 args = flags.fillFromArgs(parser=parser)
79 menu_name = MENU_ALIASES.get(args.menu, args.menu)
82 if args.check_l1
or args.check_CPS
or args.dump_dicts:
83 args.parse_names =
True
85 flags.Trigger.triggerConfig=
'FILE'
87 flags.Trigger.triggerMenuSetup=menu_name
91 from TrigConfigSvc.TrigConfigSvcCfg
import generateL1Menu
95 menumodule = importlib.import_module(f
'TriggerMenuMT.HLT.Menu.{menu_name}')
96 menu = menumodule.setupMenu()
101 return args.stream
in chain.stream
107 groupstr = args.group
108 def filt(x, old=filt):
111 for group
in x.groups:
112 if group.startswith(groupstr):
119 elif args.parse_names:
126 for chain, chain_dict
in chain_to_dict.items():
127 if not chain_dict[
'L1item']:
130 this_l1items = chain_dict[
'L1item'].
split(
',')
131 for this_l1
in this_l1items:
132 if this_l1
not in l1items:
133 sys.stderr.write(f
'L1 item not in menu for HLT item {chain}\n')
142 def match_group(expr,chain):
143 for group
in chain.groups:
152 chain_dict = chain_to_dict[chain.name]
154 not chain_dict[
'L1item']
155 or not match_group(
'Support',chain)
156 or match_group(
'TagAndProbe',chain)
162 if len(chain_dict[
'L1item'].
split(
',')) == 1:
163 if chain_dict[
'L1item']
not in L1_to_chains:
164 L1_to_chains[chain_dict[
'L1item']] =
set()
165 L1_to_chains[chain_dict[
'L1item']].
add(chain.name)
167 if match_group(
'RATE:CPS',chain):
169 for group
in chain.groups:
170 if group.startswith(
'RATE:CPS_'):
171 cps_item =
'L1_'+group[9:]
172 if cps_item ==
'L1_ZB':
173 cps_item =
'L1_ZeroBias'
174 if cps_item
not in cps_to_chains:
175 cps_to_chains[cps_item] =
set()
176 cps_to_chains[cps_item].
add(chain.name)
178 for cps_item, cps_chains
in cps_to_chains.items():
179 L1_chains = L1_to_chains[cps_item]
180 if len(L1_chains) < len(cps_chains):
181 raise RuntimeError(
'More CPS chains than L1-seeded, something wrong in parsing')
182 if len(cps_chains) < len(L1_chains):
183 print(f
'CPS group seeded by {cps_item} does not include all support chains')
184 print(f
' Contains {len(cps_chains)} / {len(L1_chains)}')
186 for missing
in L1_chains.difference(cps_chains):