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()

MTCalibPebConfig.hlt_result_cfg ( flags,
hypo_algs )

Definition at line 209 of file MTCalibPebConfig.py.

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

◆ hlt_seq_cfg()

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

Definition at line 316 of file MTCalibPebConfig.py.

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

◆ l1_seq_cfg()

MTCalibPebConfig.l1_seq_cfg ( flags,
options = default_options )

Definition at line 131 of file MTCalibPebConfig.py.

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

◆ make_all_hypo_algs()

MTCalibPebConfig.make_all_hypo_algs ( num_chains,
concurrent = False )

Definition at line 172 of file MTCalibPebConfig.py.

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

◆ make_hypo_alg()

MTCalibPebConfig.make_hypo_alg ( name)

Definition at line 148 of file MTCalibPebConfig.py.

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

◆ make_hypo_tool()

MTCalibPebConfig.make_hypo_tool ( name,
options = default_options )

Definition at line 155 of file MTCalibPebConfig.py.

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

◆ make_summary_algs()

MTCalibPebConfig.make_summary_algs ( hypo_algs)

Definition at line 301 of file MTCalibPebConfig.py.

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

◆ set_flags()

MTCalibPebConfig.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 flags.Trigger.ROBPrefetchingOptions = [] # workaround for ATR-26307
121 # Disable signature-specific detector configuration parts
122 flags.Trigger.doID = False
123 flags.Trigger.doCalo = False
124 flags.Trigger.doMuon = False
125 # Disable L1 data decoding (except for CTP)
126 flags.Trigger.L1.doMuon = False
127 flags.Trigger.L1.doCalo = False
128 flags.Trigger.L1.doTopo = False
129
130

◆ write_dummy_menu_json()

MTCalibPebConfig.write_dummy_menu_json ( flags,
chains,
chain_to_streams )

Definition at line 344 of file MTCalibPebConfig.py.

344def write_dummy_menu_json(flags, chains, chain_to_streams):
345 import json
346 from TrigConfHLTUtils.HLTUtils import string2hash
347 from TrigConfigSvc.TrigConfigSvcCfg import getHLTPrescalesSetFileName
348 menu_dict = dict([
349 ("filetype", "hltmenu"),
350 ("name", _menu_name),
351 ("chains", dict()),
352 ("streams", dict()),
353 ("sequencers", dict())
354 ])
355 hlt_ps_dict = dict([
356 ("filetype", "hltprescale"),
357 ("name", _menu_name),
358 ("prescales", dict())
359 ])
360 counter = 0
361 for chain in chains:
362 # Prepare information for stream list and fill separate dictionary
363 chain_streams = []
364 for stream in chain_to_streams[chain]:
365 stream_name = stream['name']
366 chain_streams.append(stream_name)
367 # If not already listed, add stream details to stream dictionary
368 if stream_name not in menu_dict["streams"]:
369 menu_dict["streams"][stream_name] = dict([
370 ("name", stream_name),
371 ("type", stream['type']),
372 ("obeyLB", stream['obeyLB']),
373 ("forceFullEventBuilding", stream['forceFullEventBuilding'])
374 ])
375
376 menu_dict["chains"][chain] = dict([
377 ("counter", counter),
378 ("nameHash", string2hash(chain)),
379 ("legMultiplicities", [1]),
380 ("l1item", ''),
381 ("l1thresholds", ['FSNOSEED']),
382 ("groups", []),
383 ("streams", chain_streams),
384 ("sequencers", [] )
385 ])
386 hlt_ps_dict["prescales"][chain] = dict([
387 ("counter", counter),
388 ("hash", string2hash(chain)),
389 ("prescale", 1),
390 ("enabled", True),
391 ])
392
393 counter += 1
394
395 log.info('Writing trigger menu to %s', _menu_file_name)
396 with open(_menu_file_name, 'w') as json_file:
397 json.dump(menu_dict, json_file, indent=4, sort_keys=False)
398
399 hlt_ps_file_name = getHLTPrescalesSetFileName(flags)
400 log.info('Writing HLT prescales to %s', hlt_ps_file_name)
401 with open(hlt_ps_file_name, 'w') as json_file:
402 json.dump(hlt_ps_dict, json_file, indent=4, sort_keys=False)
403
404 return _menu_file_name
405
406
407# 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 414 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 410 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:
1= {
2 '01 :ADDGET:RND20:': rob_list, # Prefetch+Retrieve 20 random ROBs from rob_list
3 '02 :GET:RND10: ': rob_list, # Retrieve 10 random ROBs from rob_list
4 '03 :GET:RND5: ': rob_list, # Retrieve 5 random ROBs from rob_list
5 '04 :ADD:RND10: ': rob_list, # Prefetch 10 random ROBs from rob_list
6 '05 :ADD:RND20: ': rob_list, # Prefetch 20 random ROBs from rob_list
7 '06 :ADDGET:RND50:': rob_list, # Prefetch+Retrieve 50 random ROBs from rob_list
8 '07 :ADDGET:RND10:': rob_list, # Prefetch+Retrieve 10 random ROBs from rob_list
9 '08 :ADDGET:RND5: ': rob_list, # Prefetch+Retrieve 5 random ROBs from rob_list
10 '09 :GET:RND20: ': rob_list, # Retrieve 20 random ROBs from rob_list
11 '10 :ADDGET:RND20:': rob_list, # Prefetch+Retrieve 20 random ROBs from rob_list
12 '11 :GET:RND10: ': rob_list, # Retrieve 10 random ROBs from rob_list
13 '12 :ADDGET:RND10:': rob_list # Prefetch+Retrieve 10 random ROBs from rob_list
14}

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 416 of file MTCalibPebConfig.py.