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

Classes

class  MTCalibPebHypoOptions

Functions

 set_flags (flags, options=default_options)
 l1_seq_cfg (flags, options=default_options)
 make_hypo_alg (name)
 make_hypo_tool (name, options=default_options)
 make_all_hypo_algs (num_chains, concurrent=False)
 hlt_result_cfg (flags, hypo_algs)
 make_summary_algs (hypo_algs)
 hlt_seq_cfg (flags, num_chains, concurrent=False, hypo_algs=None)
 write_dummy_menu_json (flags, chains, chain_to_streams)

Variables

 log = logging.getLogger('MTCalibPebConfig.py')
str _menu_name = 'MTCalibPeb'
str _menu_file_name = 'HLTMenu_{:s}.json'.format(_menu_name)
list rob_list
dict rob_access_dict
 default_options = MTCalibPebHypoOptions()
 flags = initConfigFlags()
 acc = l1_seq_cfg(flags)
 withDetails

Function Documentation

◆ hlt_result_cfg()

hlt_result_cfg ( flags,
hypo_algs )

Definition at line 208 of file MTCalibPebConfig.py.

208def hlt_result_cfg(flags, hypo_algs):
209 from TrigEDMConfig.DataScoutingInfo import getFullHLTResultID
210 from TrigEDMConfig.TriggerEDMRun3 import EDMDetailsRun3
211 from TrigEDMConfig.TriggerEDM import getRawTriggerEDMList
212 from TrigOutputHandling.TrigOutputHandlingConfig import TriggerEDMSerialiserToolCfg, StreamTagMakerToolCfg, TriggerBitsMakerToolCfg
213
214 # Tool serialising EDM objects to fill the HLT result
215 serialiser = TriggerEDMSerialiserToolCfg(flags, 'Serialiser')
216 # Add some framework EDM to the output, but skip the ones in EDMDetailsRun3 to avoid the fuss
217 serialiser.addCollectionListToMainResult([
218 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
219 ])
220 for hypo in hypo_algs:
221 serialiser.addCollectionListToMainResult([
222 'xAOD::TrigCompositeContainer#%s' % hypo.HypoOutputDecisions,
223 'xAOD::TrigCompositeAuxContainer#%sAux.' % hypo.HypoOutputDecisions,
224 ])
225
226 # Data scouting example
227 resultList = [getFullHLTResultID(), 1]
228 collections = set()
229 chain_names = []
230 for hypo in hypo_algs:
231 for hypo_tool in hypo.HypoTools:
232 chain_names.append(hypo_tool.name)
233 if hasattr(hypo_tool,'CreateRandomData'):
234 for coll_name in hypo_tool.CreateRandomData.keys():
235 collections.add(coll_name)
236 for coll_name in collections:
237 serialiser.addCollectionListToResults([
238 'xAOD::TrigCompositeContainer#{:s}'.format(coll_name),
239 'xAOD::TrigCompositeAuxContainer#{:s}Aux.'.format(coll_name)
240 ], resultList)
241
242 # StreamTag definitions
243 streamPhysicsMain = {
244 'name': 'Main',
245 'type': 'physics',
246 'obeyLB': True,
247 'forceFullEventBuilding': True
248 }
249 streamExamplePEB = {
250 'name': 'ExamplePEB',
251 'type': 'calibration',
252 'obeyLB': True,
253 'forceFullEventBuilding': False
254 }
255 streamExampleDataScoutingPEB = {
256 'name': 'ExampleDataScoutingPEB',
257 'type': 'physics',
258 'obeyLB': True,
259 'forceFullEventBuilding': False
260 }
261 chain_to_streams = {}
262 for counter, ch in enumerate(chain_names, start=1):
263 if counter % 3 == 1:
264 chain_to_streams[ch] = [streamPhysicsMain]
265 elif counter % 3 == 2:
266 chain_to_streams[ch] = [streamExamplePEB]
267 elif counter % 3 == 0:
268 chain_to_streams[ch] = [streamExampleDataScoutingPEB]
269
270 menu_json = write_dummy_menu_json(flags, chain_to_streams.keys(), chain_to_streams)
271
272 acc = ComponentAccumulator()
273
274 # Give the menu json name to HLTConfigSvc
275 from TrigConfigSvc.TrigConfigSvcCfg import HLTConfigSvcCfg
276 hltConfigSvcCfg = HLTConfigSvcCfg(flags)
277 hltConfigSvcCfg.getService("HLTConfigSvc").HLTJsonFileName = menu_json
278 acc.merge(hltConfigSvcCfg)
279
280 # Tool adding stream tags to HLT result
281 stmaker = StreamTagMakerToolCfg()
282 stmaker.ChainDecisions = 'HLTNav_Summary'
283 stmaker.PEBDecisionKeys = [str(hypo.HypoOutputDecisions) for hypo in hypo_algs]
284
285 # Tool adding HLT bits to HLT result
286 bitsmaker = TriggerBitsMakerToolCfg()
287 bitsmaker.ChainDecisions = 'HLTNav_Summary'
288
289 # Configure the HLT result maker to use the above tools
290 from TrigServices.TrigServicesConfig import TrigServicesCfg
291 trigServicesCfg = TrigServicesCfg(flags)
292 hltEventLoopMgr = trigServicesCfg.getPrimary()
293 hltEventLoopMgr.ResultMaker.StreamTagMaker = stmaker
294 hltEventLoopMgr.ResultMaker.MakerTools = [bitsmaker, serialiser]
295 acc.merge(trigServicesCfg)
296
297 return acc
298
299
STL class.
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179

◆ hlt_seq_cfg()

hlt_seq_cfg ( flags,
num_chains,
concurrent = False,
hypo_algs = None )

Definition at line 315 of file MTCalibPebConfig.py.

315def hlt_seq_cfg(flags, num_chains, concurrent=False, hypo_algs=None):
316 acc = ComponentAccumulator()
317
318 # Load these objects from StoreGate
319 loadFromSG = [('xAOD::EventInfo', 'StoreGateSvc+EventInfo'),
320 ('TrigConf::L1Menu','DetectorStore+L1TriggerMenu'),
321 ('TrigConf::HLTMenu','DetectorStore+HLTTriggerMenu')]
322
323 from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
324 acc.merge(SGInputLoaderCfg(flags, loadFromSG))
325
326 # Sequences need to ensure that summary algs run after all hypos
327 acc.addSequence(seqOR('hltTop'))
328 acc.addSequence(parOR('hltHypoSeq'), parentName='hltTop')
329 acc.addSequence(parOR('hltEndSeq'), parentName='hltTop')
330
331 if not hypo_algs:
332 hypo_algs = make_all_hypo_algs(num_chains, concurrent)
333 summary_algs = make_summary_algs(hypo_algs)
334 hlt_result_ca = hlt_result_cfg(flags, hypo_algs)
335
336 acc.addEventAlgo(hypo_algs, sequenceName='hltHypoSeq')
337 acc.addEventAlgo(summary_algs, sequenceName='hltEndSeq')
338 acc.merge(hlt_result_ca)
339
340 return acc
341
342

◆ l1_seq_cfg()

l1_seq_cfg ( flags,
options = default_options )

Definition at line 130 of file MTCalibPebConfig.py.

130def l1_seq_cfg(flags, options=default_options):
131 from HLTSeeding.HLTSeedingConfig import HLTSeedingCfg
132 acc = HLTSeedingCfg(flags)
133
134 l1_decoder_alg = acc.getEventAlgo('HLTSeeding')
135 l1_decoder_alg.prescaler = CompFactory.PrescalingEmulationTool()
136
137 # Generate L1 menu
138 from TrigConfigSvc.TrigConfigSvcCfg import generateL1Menu
139 generateL1Menu(flags)
140
141 # Need to set HLT menu file name here to avoid conflict when merging with HLT sequence CA
142 acc.getService("HLTConfigSvc").HLTJsonFileName = _menu_file_name
143
144 return acc
145
146

◆ make_all_hypo_algs()

make_all_hypo_algs ( num_chains,
concurrent = False )

Definition at line 171 of file MTCalibPebConfig.py.

171def make_all_hypo_algs(num_chains, concurrent=False):
172 hypo_tools = []
173 for chain_index in range(1, 1+num_chains):
174 # Default hypo tool for chains 1, 4, 7, 10, ...
175 hypoTool = make_hypo_tool('HLT_MTCalibPeb{:d}'.format(chain_index))
176 hypoTool.PEBROBList = rob_list
177 hypoTool.PEBSubDetList = []
178 # Hypo for chains 2, 5, 8, 11, ...
179 if chain_index % 3 == 2:
180 hypoTool.PEBROBList = [0x420024, 0x420025, 0x420026, 0x420027] # example LAr EMB ROBs
181 hypoTool.PEBSubDetList = [0x53, 0x54] # TILECAL_EXT A and C
182 # Hypo for chains 3, 6, 9, 12, ...
183 elif chain_index % 3 == 0:
184 hypoTool.CreateRandomData = {
185 'ExampleCollection_{:d}_1'.format(chain_index): 5,
186 'ExampleCollection_{:d}_2'.format(chain_index): 3,
187 }
188 hypoTool.PEBROBList = [0x420034, 0x420035, 0x420036, 0x420037] # example LAr EMB ROBs
189 hypoTool.PEBROBList.extend([0x7c0001]) # extra HLT result for data scouting
190 hypo_tools.append(hypoTool)
191
192 # Add the hypo tools to algorithm(s)
193 hypo_algs = []
194 if concurrent:
195 for tool in hypo_tools:
196 hypo = make_hypo_alg('HypoAlg{:d}'.format(len(hypo_algs)+1))
197 hypo.HypoTools += [tool]
198 hypo_algs.append(hypo)
199 else:
200 hypo = make_hypo_alg('HypoAlg1')
201 for tool in hypo_tools:
202 hypo.HypoTools += [tool]
203 hypo_algs.append(hypo)
204
205 return hypo_algs
206
207

◆ make_hypo_alg()

make_hypo_alg ( name)

Definition at line 147 of file MTCalibPebConfig.py.

147def make_hypo_alg(name):
148 hypo = CompFactory.MTCalibPebHypoAlg(name)
149 hypo.HypoInputDecisions = 'HLTSeedingSummary'
150 hypo.HypoOutputDecisions = 'MTCalibPebDecisions_'+name
151 return hypo
152
153

◆ make_hypo_tool()

make_hypo_tool ( name,
options = default_options )

Definition at line 154 of file MTCalibPebConfig.py.

154def make_hypo_tool(name, options=default_options):
155 hypo_tool = CompFactory.MTCalibPebHypoTool(name)
156 hypo_tool.UseRandomSeed = options.UseRandomSeed
157 hypo_tool.RandomAcceptRate = options.RandomAcceptRate
158 hypo_tool.BurnTimePerCycleMillisec = options.BurnTimePerCycleMillisec
159 hypo_tool.NumBurnCycles = options.NumBurnCycles
160 hypo_tool.BurnTimeRandomly = options.BurnTimeRandomly
161 hypo_tool.Crunch = options.Crunch
162 hypo_tool.CheckDataConsistency = options.CheckDataConsistency
163 hypo_tool.ROBAccessDict = options.ROBAccessDict
164 hypo_tool.TimeBetweenROBReqMillisec = options.TimeBetweenROBReqMillisec
165 hypo_tool.PEBROBList = options.PEBROBList
166 hypo_tool.PEBSubDetList = options.PEBSubDetList
167 hypo_tool.CreateRandomData = options.CreateRandomData
168 return hypo_tool
169
170

◆ make_summary_algs()

make_summary_algs ( hypo_algs)

Definition at line 300 of file MTCalibPebConfig.py.

300def make_summary_algs(hypo_algs):
301 summary = CompFactory.TriggerSummaryAlg('TriggerSummaryAlg')
302 summary.InputDecision = 'HLTSeedingSummary'
303 summary.FinalDecisions = [str(hypo.HypoOutputDecisions) for hypo in hypo_algs]
304
305 summMaker = CompFactory.DecisionSummaryMakerAlg()
306 summMaker.FinalDecisionKeys = [str(hypo.HypoOutputDecisions) for hypo in hypo_algs]
307 summMaker.FinalStepDecisions = {}
308 for hypo in hypo_algs:
309 for tool in hypo.HypoTools:
310 summMaker.FinalStepDecisions[tool.getName()] = [str(hypo.HypoOutputDecisions)]
311 log.info('summMaker = %s', summMaker)
312 return [summary, summMaker]
313
314

◆ set_flags()

set_flags ( flags,
options = default_options )

Definition at line 110 of file MTCalibPebConfig.py.

110def set_flags(flags, options=default_options):
111 flags.Common.isOnline = True
112 flags.Input.Files = []
113 flags.Input.Format = Format.BS
114 flags.Input.isMC = False
115 flags.Trigger.doHLT = True
116 flags.Trigger.EDMVersion = 3
117 flags.Trigger.Online.isPartition = True
118 flags.Trigger.triggerMenuSetup = 'Dev_pp_run3_v1'
119 flags.Trigger.forceEnableAllChains = True
120 # Disable signature-specific detector configuration parts
121 flags.Trigger.doID = False
122 flags.Trigger.doCalo = False
123 flags.Trigger.doMuon = False
124 # Disable L1 data decoding (except for CTP)
125 flags.Trigger.L1.doMuon = False
126 flags.Trigger.L1.doCalo = False
127 flags.Trigger.L1.doTopo = False
128
129

◆ write_dummy_menu_json()

write_dummy_menu_json ( flags,
chains,
chain_to_streams )

Definition at line 343 of file MTCalibPebConfig.py.

343def write_dummy_menu_json(flags, chains, chain_to_streams):
344 import json
345 from TrigConfHLTUtils.HLTUtils import string2hash
346 from TrigConfigSvc.TrigConfigSvcCfg import getHLTPrescalesSetFileName
347 menu_dict = dict([
348 ("filetype", "hltmenu"),
349 ("name", _menu_name),
350 ("chains", dict()),
351 ("streams", dict()),
352 ("sequencers", dict())
353 ])
354 hlt_ps_dict = dict([
355 ("filetype", "hltprescale"),
356 ("name", _menu_name),
357 ("prescales", dict())
358 ])
359 counter = 0
360 for chain in chains:
361 # Prepare information for stream list and fill separate dictionary
362 chain_streams = []
363 for stream in chain_to_streams[chain]:
364 stream_name = stream['name']
365 chain_streams.append(stream_name)
366 # If not already listed, add stream details to stream dictionary
367 if stream_name not in menu_dict["streams"]:
368 menu_dict["streams"][stream_name] = dict([
369 ("name", stream_name),
370 ("type", stream['type']),
371 ("obeyLB", stream['obeyLB']),
372 ("forceFullEventBuilding", stream['forceFullEventBuilding'])
373 ])
374
375 menu_dict["chains"][chain] = dict([
376 ("counter", counter),
377 ("nameHash", string2hash(chain)),
378 ("legMultiplicities", [1]),
379 ("l1item", ''),
380 ("l1thresholds", ['FSNOSEED']),
381 ("groups", []),
382 ("streams", chain_streams),
383 ("sequencers", [] )
384 ])
385 hlt_ps_dict["prescales"][chain] = dict([
386 ("counter", counter),
387 ("hash", string2hash(chain)),
388 ("prescale", 1),
389 ("enabled", True),
390 ])
391
392 counter += 1
393
394 log.info('Writing trigger menu to %s', _menu_file_name)
395 with open(_menu_file_name, 'w') as json_file:
396 json.dump(menu_dict, json_file, indent=4, sort_keys=False)
397
398 hlt_ps_file_name = getHLTPrescalesSetFileName(flags)
399 log.info('Writing HLT prescales to %s', hlt_ps_file_name)
400 with open(hlt_ps_file_name, 'w') as json_file:
401 json.dump(hlt_ps_dict, json_file, indent=4, sort_keys=False)
402
403 return _menu_file_name
404
405
406# unit test

Variable Documentation

◆ _menu_file_name

str MTCalibPebConfig._menu_file_name = 'HLTMenu_{:s}.json'.format(_menu_name)
protected

Definition at line 13 of file MTCalibPebConfig.py.

◆ _menu_name

str MTCalibPebConfig._menu_name = 'MTCalibPeb'
protected

Definition at line 12 of file MTCalibPebConfig.py.

◆ acc

MTCalibPebConfig.acc = l1_seq_cfg(flags)

Definition at line 413 of file MTCalibPebConfig.py.

◆ default_options

MTCalibPebConfig.default_options = MTCalibPebHypoOptions()

Definition at line 107 of file MTCalibPebConfig.py.

◆ flags

MTCalibPebConfig.flags = initConfigFlags()

Definition at line 409 of file MTCalibPebConfig.py.

◆ log

MTCalibPebConfig.log = logging.getLogger('MTCalibPebConfig.py')

Definition at line 10 of file MTCalibPebConfig.py.

◆ rob_access_dict

dict MTCalibPebConfig.rob_access_dict
Initial value:
= {
'01 :GET:RND20:': rob_list, # Retrieve 20 random ROBs from rob_list
'02 :GET:RND10:': rob_list, # Retrieve 10 random ROBs from rob_list
'03 :GET:RND5:': rob_list, # Retrieve 5 random ROBs from rob_list
'04 :GET:RND10:': rob_list, # Retrieve 10 random ROBs from rob_list
'05 :GET:RND20:': rob_list, # Retrieve 20 random ROBs from rob_list
'06 :GET:RND50:': rob_list, # Retrieve 50 random ROBs from rob_list
'07 :GET:RND10:': rob_list, # Retrieve 10 random ROBs from rob_list
'08 :GET:RND5:': rob_list, # Retrieve 5 random ROBs from rob_list
'09 :GET:RND20:': rob_list, # Retrieve 20 random ROBs from rob_list
'10 :GET:RND20:': rob_list, # Retrieve 20 random ROBs from rob_list
'11 :GET:RND10:': rob_list, # Retrieve 10 random ROBs from rob_list
'12 :GET:RND10:': rob_list # Retrieve 10 random ROBs from rob_list
}

Definition at line 76 of file MTCalibPebConfig.py.

◆ rob_list

list MTCalibPebConfig.rob_list

Definition at line 17 of file MTCalibPebConfig.py.

◆ withDetails

MTCalibPebConfig.withDetails

Definition at line 415 of file MTCalibPebConfig.py.