ATLAS Offline Software
TrigSlimmingHelper.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
3 """Helper functions for adding trigger EDM content to a derivation"""
4 
5 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
6 from TrigEDMConfig.TriggerEDM import getTriggerEDMList
7 
8 
9 def addTrigEDMSetToOutput(flags, helper: SlimmingHelper, edmSet: str, edmVersion: int = None):
10  """Add a full trigger EDM set to the output slimming helper"""
11 
12  # NB: I'm not sure that importing and using the ConfigFlags is a pattern that we want to
13  # encourage, but given that the derivations aren't built with CA's yet this is the best I can
14  # do...
15  if edmVersion is None:
16  edmVersion = flags.Trigger.EDMVersion
17 
18  # Do nothing if there is no trigger payload in the input file
19  if edmVersion == -1:
20  return
21 
22  edmList = getTriggerEDMList(edmSet, edmVersion, flags.Trigger.ExtraEDMList)
23  # This list is a mapping from container type to a list of required container names
24  # This includes the Aux containers and their lists of aux variables.
25  # The SlimmingHelper however requires the list of *interface* (non-Aux) containers with
26  # the dynamic aux variables specified
27  # Collate that information here
28  interface_containers = []
29  for cont_type, cont_list in edmList.items():
30  for container in cont_list:
31  # For the next part we need to know all the container names and the associated aux items
32  # If we can assume the standard relation between interface and aux names (which is
33  # probably safe) then we just need to look at the aux names for this.
34  interface_name, aux, auxitems = container.partition("Aux.")
35  if aux:
36  # If the string doesn't contain 'Aux.' then aux will be the empty string
37  # i.e. we only enter this block if we're really looking at an aux container
38  interface_containers.append(f"{interface_name}.{auxitems}")
39 
40  helper.ExtraVariables += interface_containers
TrigSlimmingHelper.addTrigEDMSetToOutput
def addTrigEDMSetToOutput(flags, SlimmingHelper helper, str edmSet, int edmVersion=None)
Definition: TrigSlimmingHelper.py:9
python.TriggerEDM.getTriggerEDMList
def getTriggerEDMList(key, runVersion, extraEDMList=[])
Definition: TriggerEDM.py:67