ATLAS Offline Software
Functions
TrigNavSlimmingMTConfig Namespace Reference

Functions

def isCollectionInInputPOOLFile (flags, checkString)
 
def getTrigNavSlimmingMTOnlineConfig (flags)
 
def TrigNavSlimmingMTDerivationCfg (flags, chainsFilter=[])
 
def AddRun3TrigNavSlimmingCollectionsToSlimmingHelper (slimmingHelper)
 
def TrigNavSlimmingMTCfg (flags)
 

Function Documentation

◆ AddRun3TrigNavSlimmingCollectionsToSlimmingHelper()

def TrigNavSlimmingMTConfig.AddRun3TrigNavSlimmingCollectionsToSlimmingHelper (   slimmingHelper)

Definition at line 98 of file TrigNavSlimmingMTConfig.py.

99  slimmingHelper.AppendToDictionary.update({'HLTNav_Summary_DAODSlimmed':'xAOD::TrigCompositeContainer','HLTNav_Summary_DAODSlimmedAux':'xAOD::TrigCompositeAuxContainer',
100  'HLTNav_RepackedFeatures_Particle':'xAOD::ParticleContainer','HLTNav_RepackedFeatures_ParticleAux':'xAOD::ParticleAuxContainer',
101  'HLTNav_RepackedFeatures_MET':'xAOD::TrigMissingETContainer','HLTNav_RepackedFeatures_METAux':'xAOD::TrigMissingETAuxContainer',
102  'HLTNav_RepackedROIs':'TrigRoiDescriptorCollection'})
103 
104  # Collections where we drop some branches
105  slimmingHelper.ExtraVariables += ['HLTNav_RepackedFeatures_Particle.px.py.pz.e', # Dropping charge and pdgid (neither filled)
106  'HLTNav_RepackedFeatures_MET.ex.ey.ez.sumEt.sumE.flag.roiWord'] # Dropping MET component branches
107 
108  # Collections where we keep all branches
109  slimmingHelper.AllVariables += ['HLTNav_Summary_DAODSlimmed',
110  'HLTNav_RepackedROIs']
111 
112 #
113 # Return an ComponentAccumulator which configures trigger navigation slimming during
114 # RAW->ALL, RAW->ESD or ESD->AOD (and MC equivalents)
115 #
116 # The collections should only be created once, if already present in an input POOL file then we do not re-create.
117 #
118 # The ESD level data contains a minimal slimming on top of the Online slimming.
119 # Some graph nodes and edges which were only of use online are removed.
120 # This level of slimming is designed to support T0 trigger monitoring.
121 #
122 # If the job is configured to produce AODFULL level output, then the ESD level graph is saved also to the AOD.
123 # Hence T0 trigger monitoring is also supported in AODFULL as it is in ESD.
124 #
125 # If the job is configured to produce AODSLIM level output, then the graph is additionally slimmed.
126 # The navigation graph is reduced to only refer to the final-feature and initial-ROI,
127 # all nodes from intermediate steps between these two are dropped.
128 # All branches corresponding to chains which failed the trigger are dropped.
129 # This is insufficient for T0 monitoring, but retains the information needed for trigger-matching for analyses.
130 # Unlike at DAOD level, in AODRun3_SMALL slimmed we do still keep reference to the actual trigger features
131 # (in case we needed to do offline trigger matching with more than the 4-vector, for example) and no chainsFilter
132 # is applied.
133 #

◆ getTrigNavSlimmingMTOnlineConfig()

def TrigNavSlimmingMTConfig.getTrigNavSlimmingMTOnlineConfig (   flags)

Definition at line 21 of file TrigNavSlimmingMTConfig.py.

22  onlineSlim = CompFactory.TrigNavSlimmingMTAlg('TrigNavSlimmingMTAlg_Online')
23  onlineSlim.TrigDecisionTool = "" # We do NOT filter on chains online, no additional tools/services required.
24  onlineSlim.OutputCollection = "HLTNav_Summary_OnlineSlimmed"
25  onlineSlim.PrimaryInputCollection = "HLTNav_Summary"
26  onlineSlim.KeepFailedBranched = True
27  onlineSlim.KeepOnlyFinalFeatures = False
28  onlineSlim.RemoveEmptySteps = False
29  onlineSlim.EdgesToDrop = []
30  onlineSlim.NodesToDrop = []
31  onlineSlim.ChainsFilter = []
32  onlineSlim.RuntimeValidation = flags.Trigger.doRuntimeNaviVal
33  return onlineSlim
34 
35 #
36 # Return an instance of the TrigNavSlimmingMTAlg to be used during AOD->DAOD
37 #
38 # Any additional DAOD->DAOD will not change the slimmed navigation collection.
39 #
40 # The navigation graph is reduced to only refer to the final-feature and initial-ROI,
41 # all nodes from intermediate steps between these two are dropped.
42 # All branches corresponding to chains which failed the trigger are dropped.
43 #
44 # A chainsFilter is optionally supplied. All graph nodes which are not active for at least one chain
45 # supplied on this filter are dropped. (Assuming a non-empty list was supplied).
46 #
47 # Trigger features are reduced to xAOD::Particle representation only, all their 4-vectors
48 # are packed into a single compact container. Separate containers are used to pack features
49 # which do not derive from IParticle, e.g. MET. The RoIs are similarly repacked.
50 #
51 # NOTE: Unlike all other levels, the content of the DAOD is not controlled by TrigEDMRun3.py
52 # NOTE: We therefore also need to run AddRun3TrigNavSlimmingCollectionsToSlimmingHelper to register the outputs to a SlimmingHelper
53 #

◆ isCollectionInInputPOOLFile()

def TrigNavSlimmingMTConfig.isCollectionInInputPOOLFile (   flags,
  checkString 
)

Definition at line 12 of file TrigNavSlimmingMTConfig.py.

12 def isCollectionInInputPOOLFile(flags, checkString):
13  return any(checkString in entry for entry in flags.Input.Collections)
14 
15 #
16 # Return an instance of the TrigNavSlimmingMTAlg to be used in an online environment, either at P1,
17 # during standalone execution of the trigger on data, or during the RDOtoRDOTrigger step for MC.
18 #
19 # Returns a single alg with no dependencies, no need to make this function return a ComponentAccumulator.
20 #

◆ TrigNavSlimmingMTCfg()

def TrigNavSlimmingMTConfig.TrigNavSlimmingMTCfg (   flags)

Definition at line 134 of file TrigNavSlimmingMTConfig.py.

134 def TrigNavSlimmingMTCfg(flags):
135 
136  log = logging.getLogger("TrigNavSlimmingMTCfg.py")
137 
138  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
139  ca = ComponentAccumulator()
140 
141  if flags.Trigger.EDMVersion in [1, 2] and not flags.Trigger.doEDMVersionConversion:
142  log.debug("Not going to run Run 3 navigation slimming on a R2 input file as we are not setup to run the navigation conversion in this job")
143  return ca
144 
145  # We only run this if we are in a job which is decoding the HLT data in reconstruction, and if the slimming has not been switched off
146  if flags.Trigger.decodeHLT is False:
147  log.debug("Nothing to do as Trigger.decodeHLT is False")
148  return ca
149 
150  if flags.Trigger.doNavigationSlimming is False:
151  log.debug("Nothing to do as Trigger.doNavigationSlimming is False")
152  return ca
153 
154  doESD = flags.Output.doWriteESD
155  doAOD = flags.Output.doWriteAOD
156 
157  from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg, getRun3NavigationContainerFromInput
158  from TrigDecisionTool.TrigDecisionToolHelpers import possible_keys
159 
160  # NOTE: Derivations currently have a different configuration hook, see TrigNavSlimmingMTDerivationCfg above.
161 
162  inputCollection = getRun3NavigationContainerFromInput(flags)
163  doESDSlim = not isCollectionInInputPOOLFile(flags, "HLTNav_Summary_ESDSlimmed")
164  doAODSlim = not isCollectionInInputPOOLFile(flags, "HLTNav_Summary_AODSlimmed")
165 
166  if doESD and doESDSlim:
167  tdt = ca.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
168  esdSlim = CompFactory.TrigNavSlimmingMTAlg('TrigNavSlimmingMTAlg_ESD')
169  esdSlim.TrigDecisionTool = tdt
170  esdSlim.OutputCollection = "HLTNav_Summary_ESDSlimmed"
171  esdSlim.PrimaryInputCollection = inputCollection
172  esdSlim.AllOutputContainers = possible_keys
173  esdSlim.KeepFailedBranched = True
174  esdSlim.KeepOnlyFinalFeatures = False
175  esdSlim.RemoveEmptySteps = False
176  esdSlim.RepackROIs = False
177  esdSlim.RepackFeatures = False
178  esdSlim.EdgesToDrop = ["view"]
179  esdSlim.NodesToDrop = ["F"]
180  esdSlim.ChainsFilter = []
181  ca.addEventAlgo(esdSlim)
182  #
183  collections = [f"xAOD::TrigCompositeContainer#{esdSlim.OutputCollection}", f"xAOD::TrigCompositeAuxContainer#{esdSlim.OutputCollection}Aux.-"]
184  from OutputStreamAthenaPool.OutputStreamConfig import addToESD
185  ca.merge(addToESD(flags, collections))
186  #
187  log.info("Producing ESD Slimmed Trigger Navigation Collection. Reading {} and writing {}".format(esdSlim.PrimaryInputCollection, esdSlim.OutputCollection))
188  if esdSlim.OutputCollection not in possible_keys:
189  log.error("Producing a collection {} which is not listed in 'possible_keys'! Add this here too.".format(esdSlim.OutputCollection))
190  else:
191  log.info("Will not create ESD Slimmed Trigger Navigation Collection in this job")
192 
193  if doAOD and doAODSlim:
194  tdt = ca.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
195  aodSlim = CompFactory.TrigNavSlimmingMTAlg('TrigNavSlimmingMTAlg_AOD')
196  aodSlim.TrigDecisionTool = tdt
197  aodSlim.OutputCollection = "HLTNav_Summary_AODSlimmed"
198  aodSlim.PrimaryInputCollection = inputCollection
199  aodSlim.AllOutputContainers = possible_keys
200  aodSlim.RemoveEmptySteps = False
201  aodSlim.RepackROIs = False
202  aodSlim.RepackFeatures = False
203  aodSlim.EdgesToDrop = ["view"]
204  aodSlim.NodesToDrop = ["F"]
205  aodSlim.ChainsFilter = []
206  #
207  if flags.Trigger.AODEDMSet == "AODSLIM":
208  aodSlim.KeepFailedBranched = False
209  aodSlim.KeepOnlyFinalFeatures = True
210  log.info("Producing AODSLIM Trigger Navigation Collection. Reading {} and writing {}".format(aodSlim.PrimaryInputCollection, aodSlim.OutputCollection))
211  else: # For "AODFULL", "ESD", or any other future identifier which is _not_ "AODSLIM"
212  aodSlim.KeepFailedBranched = True
213  aodSlim.KeepOnlyFinalFeatures = False
214  log.info("Producing AODFULL Slimmed Trigger Navigation Collection. Reading {} and writing {}".format(aodSlim.PrimaryInputCollection, aodSlim.OutputCollection))
215  ca.addEventAlgo(aodSlim)
216  #
217  collections = [f"xAOD::TrigCompositeContainer#{aodSlim.OutputCollection}", f"xAOD::TrigCompositeAuxContainer#{aodSlim.OutputCollection}Aux.-"]
218  from OutputStreamAthenaPool.OutputStreamConfig import addToAOD
219  ca.merge(addToAOD(flags, collections))
220  #
221  if aodSlim.OutputCollection not in possible_keys:
222  log.error("Producing a collection {} which is not listed in 'possible_keys'! Add this here too.".format(esdSlim.OutputCollection))
223  else:
224  log.info("Will not create AOD Slimmed Trigger Navigation Collection in this job")
225 
226  return ca

◆ TrigNavSlimmingMTDerivationCfg()

def TrigNavSlimmingMTConfig.TrigNavSlimmingMTDerivationCfg (   flags,
  chainsFilter = [] 
)

Definition at line 54 of file TrigNavSlimmingMTConfig.py.

54 def TrigNavSlimmingMTDerivationCfg(flags, chainsFilter = []):
55 
56  log = logging.getLogger("TrigNavSlimmingMTDerivationCfg.py")
57 
58  if isCollectionInInputPOOLFile(flags, "HLTNav_Summary_DAODSlimmed"):
59  log.info("Will not create a new DAOD Slimmed Trigger Navigation Collection in this job (already present in input file)")
60  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
61  return ComponentAccumulator()
62 
63  from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg, getRun3NavigationContainerFromInput
64  from TrigDecisionTool.TrigDecisionToolHelpers import possible_keys
65  ca = TrigDecisionToolCfg(flags)
66  tdt = ca.getPrimary()
67 
68  inputCollection = getRun3NavigationContainerFromInput(flags)
69 
70  daodSlim = CompFactory.TrigNavSlimmingMTAlg('TrigNavSlimmingMTAlg_DAOD')
71  daodSlim.TrigDecisionTool = tdt
72  daodSlim.OutputCollection = "HLTNav_Summary_DAODSlimmed"
73  daodSlim.PrimaryInputCollection = inputCollection
74  daodSlim.AllOutputContainers = possible_keys
75  daodSlim.KeepFailedBranched = False
76  daodSlim.KeepOnlyFinalFeatures = True
77  daodSlim.RemoveEmptySteps = True
78  daodSlim.RepackROIs = False # CAUTION: There may be an ROI memory management issue which needs solving in order to enable this functionality (ATLASG-1662).
79  daodSlim.RepackROIsOutputCollection = "HLTNav_RepackedROIs"
80  daodSlim.RepackMET = True # To check: Is there any analysis need to have online-MET(s) in DAOD?
81  daodSlim.RepackFeatures = True
82 
83  daodSlim.RepackFeaturesOutputCollection_Particle = "HLTNav_RepackedFeatures_Particle"
84  daodSlim.RepackFeaturesOutputCollection_MET = "HLTNav_RepackedFeatures_MET"
85  daodSlim.EdgesToDrop = ["view"] # "view" element links, only useful online.
86  daodSlim.NodesToDrop = ["F", "CH"] # Filter nodes, only useful online. CH=ComboHypo nodes, not useful given we run here with KeepFailedBranched=False
87  daodSlim.ChainsFilter = chainsFilter
88  ca.addEventAlgo(daodSlim)
89 
90  log.info("Producing DAOD Slimmed Trigger Navigation Collection. Reading {} and writing {}".format(daodSlim.PrimaryInputCollection, daodSlim.OutputCollection))
91 
92  if daodSlim.OutputCollection not in possible_keys:
93  log.error("Producing a collection {} which is not listed in 'possible_keys'! Add this here too.".format(daodSlim.OutputCollection))
94 
95  return ca
96 
97 # Adds the branches to the slimming helper component accumulator
TrigNavSlimmingMTConfig.AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
def AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(slimmingHelper)
Definition: TrigNavSlimmingMTConfig.py:98
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
TrigNavSlimmingMTConfig.TrigNavSlimmingMTDerivationCfg
def TrigNavSlimmingMTDerivationCfg(flags, chainsFilter=[])
Definition: TrigNavSlimmingMTConfig.py:54
python.TrigDecisionToolConfig.getRun3NavigationContainerFromInput
def getRun3NavigationContainerFromInput(flags)
Definition: TrigDecisionToolConfig.py:63
python.OutputStreamConfig.addToESD
def addToESD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:127
python.TriggerInterface.TrigDecisionToolCfg
def TrigDecisionToolCfg(flags)
Definition: TriggerInterface.py:14
TrigNavSlimmingMTConfig.getTrigNavSlimmingMTOnlineConfig
def getTrigNavSlimmingMTOnlineConfig(flags)
Definition: TrigNavSlimmingMTConfig.py:21
TrigNavSlimmingMTConfig.TrigNavSlimmingMTCfg
def TrigNavSlimmingMTCfg(flags)
Definition: TrigNavSlimmingMTConfig.py:134
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142
TrigNavSlimmingMTConfig.isCollectionInInputPOOLFile
def isCollectionInInputPOOLFile(flags, checkString)
Definition: TrigNavSlimmingMTConfig.py:12