ATLAS Offline Software
TrigSlimmingHelper.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 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  returnList = []
13 
14  if edmVersion is None:
15  edmVersion = flags.Trigger.EDMVersion
16 
17  # Do nothing if there is no trigger payload in the input file
18  if edmVersion == -1:
19  return returnList
20 
21  edmList = getTriggerEDMList(flags, key=edmSet, runVersion=edmVersion)
22  # This list is a mapping from container type to a list of required container names
23  # This includes the Aux containers and their lists of aux variables.
24  # We should add both the interface and Aux containers to the list, which functions
25  # like the contents of smart collection modules. We can ignore the auxitems, because
26  # they were already set upstream, and might conflict with other additions.
27  # We additionally pick up non-xAOD items in StaticContent
28  # Collate that information here
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  # Smart container additions expect both interface and aux contents to be listed
35  interface_name, aux, auxitems = container.partition("Aux.")
36  if aux:
37  returnList += [interface_name,interface_name+'Aux.']
38 
39  if "xAOD::" not in cont_type:
40  helper.StaticContent += [f"{cont_type}#{container}"]
41 
42  # The list of interface names is returned to the slimming helper within the lookup of smart-collections
43  return returnList
44 
python.TriggerEDM.getTriggerEDMList
def getTriggerEDMList(flags, key, runVersion=-1)
Definition: TriggerEDM.py:149
TrigSlimmingHelper.addTrigEDMSetToOutput
def addTrigEDMSetToOutput(flags, SlimmingHelper helper, str edmSet, int edmVersion=None)
Definition: TrigSlimmingHelper.py:9