ATLAS Offline Software
Loading...
Searching...
No Matches
TrigNavSlimmingMTConfig Namespace Reference

Functions

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

Function Documentation

◆ AddRun3TrigNavSlimmingCollectionsToSlimmingHelper()

TrigNavSlimmingMTConfig.AddRun3TrigNavSlimmingCollectionsToSlimmingHelper ( slimmingHelper)

Definition at line 99 of file TrigNavSlimmingMTConfig.py.

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

◆ getTrigNavSlimmingMTOnlineConfig()

TrigNavSlimmingMTConfig.getTrigNavSlimmingMTOnlineConfig ( flags)

Definition at line 21 of file TrigNavSlimmingMTConfig.py.

21def getTrigNavSlimmingMTOnlineConfig(flags):
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()

TrigNavSlimmingMTConfig.isCollectionInInputPOOLFile ( flags,
checkString )

Definition at line 12 of file TrigNavSlimmingMTConfig.py.

12def 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()

TrigNavSlimmingMTConfig.TrigNavSlimmingMTCfg ( flags)

Definition at line 135 of file TrigNavSlimmingMTConfig.py.

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

◆ TrigNavSlimmingMTDerivationCfg()

TrigNavSlimmingMTConfig.TrigNavSlimmingMTDerivationCfg ( flags,
chainsFilter = [] )

Definition at line 54 of file TrigNavSlimmingMTConfig.py.

54def 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 # Note: We rely on BJetTriggerByYearContent.py to keep HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_bJets in the DAOD
83 daodSlim.RepackFeaturesExclusionList = ["HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_bJets"]
84 daodSlim.RepackFeaturesOutputCollection_Particle = "HLTNav_RepackedFeatures_Particle"
85 daodSlim.RepackFeaturesOutputCollection_MET = "HLTNav_RepackedFeatures_MET"
86 daodSlim.EdgesToDrop = ["view", "btag"] # "view" element links, only useful online; "btag" edges, and in general xAOD::BTagging has been deprecated, see https://gitlab.cern.ch/atlas/athena/-/merge_requests/83984
87 daodSlim.NodesToDrop = ["F", "CH"] # Filter nodes, only useful online. CH=ComboHypo nodes, not useful given we run here with KeepFailedBranched=False
88 daodSlim.ChainsFilter = chainsFilter
89 ca.addEventAlgo(daodSlim)
90
91 log.info("Producing DAOD Slimmed Trigger Navigation Collection. Reading {} and writing {}".format(daodSlim.PrimaryInputCollection, daodSlim.OutputCollection))
92
93 if daodSlim.OutputCollection not in possible_keys:
94 log.error("Producing a collection {} which is not listed in 'possible_keys'! Add this here too.".format(daodSlim.OutputCollection))
95
96 return ca
97
98# Adds the branches to the slimming helper component accumulator