215def hlt_result_cfg(flags, hypo_algs):
216 from TrigEDMConfig.DataScoutingInfo import getFullHLTResultID
217 from TrigEDMConfig.TriggerEDMRun3 import EDMDetailsRun3
218 from TrigEDMConfig.TriggerEDM import getRawTriggerEDMList
219 from TrigOutputHandling.TrigOutputHandlingConfig import TriggerEDMSerialiserToolCfg, StreamTagMakerToolCfg, TriggerBitsMakerToolCfg
220
221
222 serialiser = TriggerEDMSerialiserToolCfg(flags, 'Serialiser')
223
224 serialiser.addCollectionListToMainResult([
225 coll[0]
for coll
in getRawTriggerEDMList(flags, runVersion=3)
if 'BS' in coll[1]
and coll[2]==
'Steer' and not coll[0].
split(
'#')[0]
in EDMDetailsRun3
226 ])
227 for hypo in hypo_algs:
228 serialiser.addCollectionListToMainResult([
229 'xAOD::TrigCompositeContainer#%s' % hypo.HypoOutputDecisions,
230 'xAOD::TrigCompositeAuxContainer#%sAux.' % hypo.HypoOutputDecisions,
231 ])
232
233
234 resultList = [getFullHLTResultID(), 1]
236 chain_names = []
237 for hypo in hypo_algs:
238 for hypo_tool in hypo.HypoTools:
239 chain_names.append(hypo_tool.name)
240 if hasattr(hypo_tool,'CreateRandomData'):
241 for coll_name in hypo_tool.CreateRandomData.keys():
242 collections.add(coll_name)
243 for coll_name in collections:
244 serialiser.addCollectionListToResults([
245 'xAOD::TrigCompositeContainer#{:s}'.format(coll_name),
246 'xAOD::TrigCompositeAuxContainer#{:s}Aux.'.format(coll_name)
247 ], resultList)
248
249
250 streamPhysicsMain = {
251 'name': 'Main',
252 'type': 'physics',
253 'obeyLB': True,
254 'forceFullEventBuilding': True
255 }
256 streamExamplePEB = {
257 'name': 'ExamplePEB',
258 'type': 'calibration',
259 'obeyLB': True,
260 'forceFullEventBuilding': False
261 }
262 streamExampleDataScoutingPEB = {
263 'name': 'ExampleDataScoutingPEB',
264 'type': 'physics',
265 'obeyLB': True,
266 'forceFullEventBuilding': False
267 }
268 chain_to_streams = {}
269 for counter, ch in enumerate(chain_names, start=1):
270 if counter % 3 == 1:
271 chain_to_streams[ch] = [streamPhysicsMain]
272 elif counter % 3 == 2:
273 chain_to_streams[ch] = [streamExamplePEB]
274 elif counter % 3 == 0:
275 chain_to_streams[ch] = [streamExampleDataScoutingPEB]
276
277 menu_json = write_dummy_menu_json(flags, chain_to_streams.keys(), chain_to_streams)
278
279 acc = ComponentAccumulator()
280
281
282 from TrigConfigSvc.TrigConfigSvcCfg import HLTConfigSvcCfg
283 hltConfigSvcCfg = HLTConfigSvcCfg(flags)
284 hltConfigSvcCfg.getService("HLTConfigSvc").HLTJsonFileName = menu_json
285 acc.merge(hltConfigSvcCfg)
286
287
288 stmaker = StreamTagMakerToolCfg()
289 stmaker.ChainDecisions = 'HLTNav_Summary'
290 stmaker.PEBDecisionKeys = [str(hypo.HypoOutputDecisions) for hypo in hypo_algs]
291
292
293 bitsmaker = TriggerBitsMakerToolCfg()
294 bitsmaker.ChainDecisions = 'HLTNav_Summary'
295
296
297 from TrigServices.TrigServicesConfig import TrigServicesCfg
298 trigServicesCfg = TrigServicesCfg(flags)
299 hltEventLoopMgr = trigServicesCfg.getPrimary()
300 hltEventLoopMgr.ResultMaker.StreamTagMaker = stmaker
301 hltEventLoopMgr.ResultMaker.MakerTools = [bitsmaker, serialiser]
302 acc.merge(trigServicesCfg)
303
304 return acc
305
306
std::vector< std::string > split(const std::string &s, const std::string &t=":")