ATLAS Offline Software
Classes | Functions | Variables
MTCalibPebConfig Namespace Reference

Classes

class  MTCalibPebHypoOptions
 

Functions

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

Variables

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

Function Documentation

◆ hlt_result_cfg()

def MTCalibPebConfig.hlt_result_cfg (   flags,
  hypo_algs 
)

Definition at line 215 of file MTCalibPebConfig.py.

215 def 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  # Tool serialising EDM objects to fill the HLT result
222  serialiser = TriggerEDMSerialiserToolCfg(flags, 'Serialiser')
223  # Add some framework EDM to the output, but skip the ones in EDMDetailsRun3 to avoid the fuss
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_v1#%s' % hypo.HypoOutputDecisions,
230  'xAOD::TrigCompositeAuxContainer_v2#%sAux.' % hypo.HypoOutputDecisions,
231  ])
232 
233  # Data scouting example
234  resultList = [getFullHLTResultID(), 1]
235  collections = set()
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_v1#{:s}'.format(coll_name),
246  'xAOD::TrigCompositeAuxContainer_v2#{:s}Aux.'.format(coll_name)
247  ], resultList)
248 
249  # StreamTag definitions
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  # Give the menu json name to HLTConfigSvc
282  from TrigConfigSvc.TrigConfigSvcCfg import HLTConfigSvcCfg
283  hltConfigSvcCfg = HLTConfigSvcCfg(flags)
284  hltConfigSvcCfg.getService("HLTConfigSvc").HLTJsonFileName = menu_json
285  acc.merge(hltConfigSvcCfg)
286 
287  # Tool adding stream tags to HLT result
288  stmaker = StreamTagMakerToolCfg()
289  stmaker.ChainDecisions = 'HLTNav_Summary'
290  stmaker.PEBDecisionKeys = [str(hypo.HypoOutputDecisions) for hypo in hypo_algs]
291 
292  # Tool adding HLT bits to HLT result
293  bitsmaker = TriggerBitsMakerToolCfg()
294  bitsmaker.ChainDecisions = 'HLTNav_Summary'
295 
296  # Configure the HLT result maker to use the above tools
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 

◆ hlt_seq_cfg()

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

Definition at line 322 of file MTCalibPebConfig.py.

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

◆ l1_seq_cfg()

def MTCalibPebConfig.l1_seq_cfg (   flags,
  options = default_options 
)

Definition at line 137 of file MTCalibPebConfig.py.

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

◆ make_all_hypo_algs()

def MTCalibPebConfig.make_all_hypo_algs (   num_chains,
  concurrent = False 
)

Definition at line 178 of file MTCalibPebConfig.py.

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

◆ make_hypo_alg()

def MTCalibPebConfig.make_hypo_alg (   name)

Definition at line 154 of file MTCalibPebConfig.py.

154 def make_hypo_alg(name):
155  hypo = CompFactory.MTCalibPebHypoAlg(name)
156  hypo.HypoInputDecisions = 'HLTSeedingSummary'
157  hypo.HypoOutputDecisions = 'MTCalibPebDecisions_'+name
158  return hypo
159 
160 

◆ make_hypo_tool()

def MTCalibPebConfig.make_hypo_tool (   name,
  options = default_options 
)

Definition at line 161 of file MTCalibPebConfig.py.

161 def make_hypo_tool(name, options=default_options):
162  hypo_tool = CompFactory.MTCalibPebHypoTool(name)
163  hypo_tool.UseRandomSeed = options.UseRandomSeed
164  hypo_tool.RandomAcceptRate = options.RandomAcceptRate
165  hypo_tool.BurnTimePerCycleMillisec = options.BurnTimePerCycleMillisec
166  hypo_tool.NumBurnCycles = options.NumBurnCycles
167  hypo_tool.BurnTimeRandomly = options.BurnTimeRandomly
168  hypo_tool.Crunch = options.Crunch
169  hypo_tool.CheckDataConsistency = options.CheckDataConsistency
170  hypo_tool.ROBAccessDict = options.ROBAccessDict
171  hypo_tool.TimeBetweenROBReqMillisec = options.TimeBetweenROBReqMillisec
172  hypo_tool.PEBROBList = options.PEBROBList
173  hypo_tool.PEBSubDetList = options.PEBSubDetList
174  hypo_tool.CreateRandomData = options.CreateRandomData
175  return hypo_tool
176 
177 

◆ make_summary_algs()

def MTCalibPebConfig.make_summary_algs (   hypo_algs)

Definition at line 307 of file MTCalibPebConfig.py.

307 def make_summary_algs(hypo_algs):
308  summary = CompFactory.TriggerSummaryAlg('TriggerSummaryAlg')
309  summary.InputDecision = 'HLTSeedingSummary'
310  summary.FinalDecisions = [str(hypo.HypoOutputDecisions) for hypo in hypo_algs]
311 
312  summMaker = CompFactory.DecisionSummaryMakerAlg()
313  summMaker.FinalDecisionKeys = [str(hypo.HypoOutputDecisions) for hypo in hypo_algs]
314  summMaker.FinalStepDecisions = {}
315  for hypo in hypo_algs:
316  for tool in hypo.HypoTools:
317  summMaker.FinalStepDecisions[tool.getName()] = [str(hypo.HypoOutputDecisions)]
318  log.info('summMaker = %s', summMaker)
319  return [summary, summMaker]
320 
321 

◆ set_flags()

def MTCalibPebConfig.set_flags (   flags,
  options = default_options 
)

Definition at line 113 of file MTCalibPebConfig.py.

113 def set_flags(flags, options=default_options):
114  flags.Common.isOnline = True
115  flags.Input.Files = []
116  flags.Input.Format = Format.BS
117  flags.Input.isMC = False
118  flags.Trigger.doHLT = True
119  flags.Trigger.EDMVersion = 3
120  flags.Trigger.Online.isPartition = True
121  flags.Trigger.triggerMenuSetup = 'Dev_pp_run3_v1'
122  flags.Trigger.enableL1MuonPhase1 = options.EnableL1MuonPhase1
123  flags.Trigger.enableL1CaloPhase1 = options.EnableL1CaloPhase1
124  flags.Trigger.enableL1CaloLegacy = options.EnableL1CaloLegacy
125  flags.Trigger.forceEnableAllChains = True
126  flags.Trigger.ROBPrefetchingOptions = [] # workaround for ATR-26307
127  # Disable signature-specific detector configuration parts
128  flags.Trigger.doID = False
129  flags.Trigger.doCalo = False
130  flags.Trigger.doMuon = False
131  # Disable L1 data decoding (except for CTP)
132  flags.Trigger.L1.doMuon = False
133  flags.Trigger.L1.doCalo = False
134  flags.Trigger.L1.doTopo = False
135 
136 

◆ write_dummy_menu_json()

def MTCalibPebConfig.write_dummy_menu_json (   flags,
  chains,
  chain_to_streams 
)

Definition at line 350 of file MTCalibPebConfig.py.

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

Variable Documentation

◆ _menu_file_name

string MTCalibPebConfig._menu_file_name = 'HLTMenu_{:s}.json'.format(_menu_name)
private

Definition at line 13 of file MTCalibPebConfig.py.

◆ _menu_name

string MTCalibPebConfig._menu_name = 'MTCalibPeb'
private

Definition at line 12 of file MTCalibPebConfig.py.

◆ acc

def MTCalibPebConfig.acc = l1_seq_cfg(flags)

Definition at line 420 of file MTCalibPebConfig.py.

◆ default_options

MTCalibPebConfig.default_options = MTCalibPebHypoOptions()

Definition at line 110 of file MTCalibPebConfig.py.

◆ flags

MTCalibPebConfig.flags = initConfigFlags()

Definition at line 416 of file MTCalibPebConfig.py.

◆ log

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

Definition at line 10 of file MTCalibPebConfig.py.

◆ rob_access_dict

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

MTCalibPebConfig.make_all_hypo_algs
def make_all_hypo_algs(num_chains, concurrent=False)
Definition: MTCalibPebConfig.py:178
python.TriggerEDM.getRawTriggerEDMList
def getRawTriggerEDMList(flags, runVersion=-1)
Definition: TriggerEDM.py:125
MTCalibPebConfig.make_hypo_tool
def make_hypo_tool(name, options=default_options)
Definition: MTCalibPebConfig.py:161
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
MTCalibPebConfig.make_summary_algs
def make_summary_algs(hypo_algs)
Definition: MTCalibPebConfig.py:307
MTCalibPebConfig.l1_seq_cfg
def l1_seq_cfg(flags, options=default_options)
Definition: MTCalibPebConfig.py:137
python.TrigConfigSvcCfg.generateL1Menu
def generateL1Menu(flags)
Definition: TrigConfigSvcCfg.py:184
MTCalibPebConfig.hlt_result_cfg
def hlt_result_cfg(flags, hypo_algs)
Definition: MTCalibPebConfig.py:215
python.DataScoutingInfo.getFullHLTResultID
def getFullHLTResultID()
Definition: DataScoutingInfo.py:73
MTCalibPebConfig.write_dummy_menu_json
def write_dummy_menu_json(flags, chains, chain_to_streams)
Definition: MTCalibPebConfig.py:350
MTCalibPebConfig.make_hypo_alg
def make_hypo_alg(name)
Definition: MTCalibPebConfig.py:154
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.JetAnalysisCommon.parOR
parOR
Definition: JetAnalysisCommon.py:271
MTCalibPebConfig.set_flags
def set_flags(flags, options=default_options)
Definition: MTCalibPebConfig.py:113
python.CFElements.seqOR
def seqOR(name, subs=[])
Definition: CFElements.py:33
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
MTCalibPebConfig.hlt_seq_cfg
def hlt_seq_cfg(flags, num_chains, concurrent=False, hypo_algs=None)
Definition: MTCalibPebConfig.py:322
TrigOutputHandlingConfig.TriggerEDMSerialiserToolCfg
def TriggerEDMSerialiserToolCfg(flags, name="Serialiser")
Definition: TrigOutputHandlingConfig.py:51
python.TrigServicesConfig.TrigServicesCfg
def TrigServicesCfg(flags)
Definition: TrigServicesConfig.py:175
TrigOutputHandlingConfig.StreamTagMakerToolCfg
def StreamTagMakerToolCfg(name="StreamTagMakerTool")
Definition: TrigOutputHandlingConfig.py:109
Trk::open
@ open
Definition: BinningType.h:40
TrigOutputHandlingConfig.TriggerBitsMakerToolCfg
def TriggerBitsMakerToolCfg(name="TriggerBitsMakerTool")
Definition: TrigOutputHandlingConfig.py:117
HLTUtils.string2hash
def string2hash(string)
Definition: HLTUtils.py:5
python.TrigConfigSvcCfg.HLTConfigSvcCfg
def HLTConfigSvcCfg(flags)
Definition: TrigConfigSvcCfg.py:231
str
Definition: BTagTrackIpAccessor.cxx:11
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
python.TrigConfigSvcCfg.getHLTPrescalesSetFileName
def getHLTPrescalesSetFileName(flags)
Definition: TrigConfigSvcCfg.py:152
HLTSeedingConfig.HLTSeedingCfg
def HLTSeedingCfg(flags, seqName=None)
Definition: HLTSeedingConfig.py:309