ATLAS Offline Software
Classes | Functions
python.HLT.Menu.MenuPrescaleConfig Namespace Reference

Classes

class  PrescaleClass
 

Functions

def MenuPrescaleConfig (hltMenuConfig, flags)
 
def filterChains (chains, type_prescales, type_groups, invert=False)
 
def applyHLTPrescale (triggerPythonConfig, HLTPrescale, ignoreUnknownChains=False)
 

Function Documentation

◆ applyHLTPrescale()

def python.HLT.Menu.MenuPrescaleConfig.applyHLTPrescale (   triggerPythonConfig,
  HLTPrescale,
  ignoreUnknownChains = False 
)

Definition at line 82 of file MenuPrescaleConfig.py.

82 def applyHLTPrescale(triggerPythonConfig, HLTPrescale, ignoreUnknownChains=False):
83  for item, prescale in HLTPrescale.items():
84  if item not in triggerPythonConfig.dicts().keys():
85  if ignoreUnknownChains:
86  log.warning('Attempt to set prescales for nonexisting chain: %s', item)
87  continue
88  else:
89  log.error('Attempt to set prescales for nonexisting chain: %s', item)
90  continue
91  hltchain = triggerPythonConfig.dicts()[item]
92  hltchain['prescale'] = prescale
93  log.info('Applied HLTPS to the item %s: PS %s', item, hltchain['prescale'])
94 

◆ filterChains()

def python.HLT.Menu.MenuPrescaleConfig.filterChains (   chains,
  type_prescales,
  type_groups,
  invert = False 
)
Disable(enable if invert==True) chains with groups matching type_groups

Definition at line 70 of file MenuPrescaleConfig.py.

70 def filterChains(chains, type_prescales, type_groups, invert=False):
71  """Disable(enable if invert==True) chains with groups matching type_groups"""
72 
73  def match(s1, s2): return not s1.isdisjoint(s2)
74 
75  # Loop over all chains in all signatures and find chains to enable/disable
76  chain_disable_list = [ch.name for ch in itertools.chain.from_iterable(chains.values())
77  if match(set(type_groups), ch.groups) ^ invert ]
78 
79  type_prescales.update(itertools.zip_longest(chain_disable_list, [], fillvalue=-1))
80 
81 

◆ MenuPrescaleConfig()

def python.HLT.Menu.MenuPrescaleConfig.MenuPrescaleConfig (   hltMenuConfig,
  flags 
)

Definition at line 9 of file MenuPrescaleConfig.py.

9 def MenuPrescaleConfig(hltMenuConfig, flags):
10  L1Prescales = {}
11  HLTPrescales = {}
12  chains = {}
13  Prescales = PrescaleClass()
14 
15  menu_name = flags.Trigger.triggerMenuSetup
16 
17  log.info('Menu name: %s', menu_name)
18 
19  # Generate the list of chains from the basic menu (terminates in a version number)
20  base_menu_name = re.match(r'\w*_v\d*',menu_name).group(0)
21  try:
22  menu_module = importlib.import_module(f'TriggerMenuMT.HLT.Menu.{base_menu_name}')
23  except Exception as e:
24  log.fatal(f'Failed to import menu module "{base_menu_name}" inferred from menu "{menu_name}"!')
25  raise e
26  chains = menu_module.setupMenu()
27 
28  # Determine prescale sets from the remainder of the menu name
29  # These filters become progressively less inclusive:
30  # - Primary: primary (always unprescaled) triggers only
31  # - BulkMCProd: triggers for generic CP and physics analysis work (veto label PS:NoBulkMCProd)
32  # - TriggerValidation: adds more specialised triggers for trigger performance
33  # and/or CP studies, possibly run heavily prescaled in data (veto label PS:NoTrigVal)
34  # - HLTReprocessing: excludes a handful of triggers not to be
35  # used in reprocessing jobs, mostly due to CPU cost (veto label PS:NoHLTRepro)
36  #
37  # Besides the filter, explicit prescale values may also be set for specific triggers
38  # -- see the end of the file for these mappings, which should not overlap with the
39  # disabled triggers (else they will be overwritten)
40  if 'Primary_prescale' in menu_name:
41  filterChains(chains, Prescales.HLTPrescales_primary_prescale,
42  ['Primary:L1Muon','Primary:Legacy','Primary:PhaseI','Primary:CostAndRate',
43  'Support:TagAndProbe','Support:LegacyTagAndProbe','Support:PhaseITagAndProbe'],
44  invert = True) # enable these groups
45  L1Prescales = Prescales.L1Prescales_primary_prescale
46  HLTPrescales = Prescales.HLTPrescales_primary_prescale
47  elif 'BulkMCProd_prescale' in menu_name:
48  assert(menu_name.startswith('Dev') or menu_name.startswith('MC'))
49  filterChains(chains, Prescales.HLTPrescales_bulkmcprod_prescale, ["PS:NoHLTRepro","PS:NoTrigVal","PS:NoBulkMCProd"])
50  L1Prescales = Prescales.L1Prescales_bulkmcprod_prescale
51  HLTPrescales = Prescales.HLTPrescales_bulkmcprod_prescale
52  elif 'TriggerValidation_prescale' in menu_name:
53  filterChains(chains, Prescales.HLTPrescales_trigvalid_prescale, ["PS:NoHLTRepro","PS:NoTrigVal"])
54  L1Prescales = Prescales.L1Prescales_trigvalid_prescale
55  HLTPrescales = Prescales.HLTPrescales_trigvalid_prescale
56  elif 'HLTReprocessing_prescale' in menu_name:
57  filterChains(chains, Prescales.HLTPrescales_HLTRepro_prescale, ["PS:NoHLTRepro"])
58  L1Prescales = Prescales.L1Prescales_HLTRepro_prescale
59  HLTPrescales = Prescales.HLTPrescales_HLTRepro_prescale
60  elif 'prescale' in menu_name:
61  log.error(f'Unknown menu prescale set for menu {menu_name}!')
62  raise RuntimeError('Unknown menu prescale set')
63  else:
64  L1Prescales = Prescales.L1Prescales
65  HLTPrescales = Prescales.HLTPrescales
66 
67  return (L1Prescales, HLTPrescales, chains)
68 
69 
python.HLT.Menu.MenuPrescaleConfig.filterChains
def filterChains(chains, type_prescales, type_groups, invert=False)
Definition: MenuPrescaleConfig.py:70
python.HLT.Menu.MenuPrescaleConfig.applyHLTPrescale
def applyHLTPrescale(triggerPythonConfig, HLTPrescale, ignoreUnknownChains=False)
Definition: MenuPrescaleConfig.py:82
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
python.HLT.Menu.MenuPrescaleConfig.MenuPrescaleConfig
def MenuPrescaleConfig(hltMenuConfig, flags)
Definition: MenuPrescaleConfig.py:9
CaloLCW_tf.group
group
Definition: CaloLCW_tf.py:28
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356