ATLAS Offline Software
Loading...
Searching...
No Matches
PHYSLITE.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2#====================================================================
3# DAOD_PHYSLITE.py
4# This defines DAOD_PHYSLITE, an unskimmed DAOD format for Run 3.
5# It contains the variables and objects needed for the large majority
6# of physics analyses in ATLAS.
7# It requires the flag PHYSLITE in Derivation_tf.py
8#====================================================================
9
10from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11from AthenaConfiguration.ComponentFactory import CompFactory
12from AthenaConfiguration.Enums import MetadataCategory
13from GoodRunsLists.GoodRunsListsDictionary import getGoodRunsLists
14
15
16
17def CPAlgorithmsCfg(flags):
18 """do the CP algorithm configuration for PHYSLITE"""
19
20 from AthenaCommon.Logging import logging
21 logPLCPAlgCfg = logging.getLogger('PLCPAlgCfg')
22 logPLCPAlgCfg.info('****************** STARTING PHYSLITE CPAlgorithmsCfg *****************')
23
24 forceEGammaFullSimConfig = False
25 if not flags.Sim.ISF.Simulator.isFullSim():
26 logPLCPAlgCfg.warning("Forcing full simulation configuration for EGamma algorithms. This is not recommended for fast simulation but no recommendations available yet.")
27 forceEGammaFullSimConfig = True
28
29 FixedElDict = {}
30 FixedPhDict = {}
31 from egammaAlgs.egammaAODFixesConfig import runAODFix
32 doneFix, fixes = runAODFix(flags)
33 logPLCPAlgCfg.info(f'Existing egamma AOD fixes for timing cut issue : {fixes}')
34 if 'egammatopoIsoFix' in fixes:
35 FixedElDict.update({"ElectronIsolationCorrectionAlg.isolationCorrectionTool.FixTimingIssueInCore": False})
36 FixedPhDict.update({"PhotonIsolationCorrectionAlg.isolationCorrectionTool.FixTimingIssueInCore": False})
37 if 'egClusterL2_3Fix' in fixes:
38 FixedElDict.update({"ElectronCalibrationAndSmearingAlg.calibrationAndSmearingTool.FixForMissingCells": False})
39 FixedPhDict.update({"PhotonCalibrationAndSmearingAlg.calibrationAndSmearingTool.FixForMissingCells": False})
40
41 from AnalysisAlgorithmsConfig.ConfigFactory import ConfigFactory
42 from AnalysisAlgorithmsConfig.ConfigSequence import ConfigSequence
43 configSeq = ConfigSequence ()
44
45 # create factory object to build block configurations
46 factory = ConfigFactory()
47
48 # Set up the systematics loader/handler algorithm:
49 subConfig = factory.makeConfig ('CommonServices')
50 subConfig.setOptionValue ('.runSystematics', False)
51 subConfig.setOptionValue ('.fixDAODTruthRecord', False)
52 configSeq += subConfig
53
54 # Disable expert-mode warnings
55 import warnings
56 from AnalysisAlgorithmsConfig.ConfigAccumulator import ExpertModeWarning
57 warnings.simplefilter('ignore', ExpertModeWarning)
58
59 # Create a pile-up analysis config
60 if flags.Input.isMC:
61 # setup config and lumicalc files for pile-up tool
62 configSeq += factory.makeConfig ('PileupReweighting')
63
64 # Set up the GRL decoration analysis config
65 configSeq += factory.makeConfig ('EventCleaning')
66 configSeq.setOptionValue ('.noFilter', True)
67 configSeq.setOptionValue ('.GRLDict', getGoodRunsLists())
68
69 # set up the muon analysis algorithm config (must come before electrons and photons to allow FSR collection):
70
71 logPLCPAlgCfg.info('Do Muons')
72
73 subConfig = factory.makeConfig ('Muons')
74 subConfig.setOptionValue ('.containerName', 'AnalysisMuons')
75 subConfig.setOptionValue ('.addGlobalFELinksDep', True)
76 configSeq += subConfig
77 subConfig = factory.makeConfig ('Muons.WorkingPoint')
78 subConfig.setOptionValue ('.containerName', 'AnalysisMuons')
79 subConfig.setOptionValue ('.selectionName', 'loose')
80 subConfig.setOptionValue ('.trackSelection', False)
81 subConfig.setOptionValue ('.quality', 'Loose')
82 subConfig.setOptionValue ('.isolation', 'NonIso')
83 configSeq += subConfig
84 subConfig = factory.makeConfig ('Thinning')
85 subConfig.setOptionValue ('.containerName', 'AnalysisMuons')
86 subConfig.setOptionValue ('.selectionName', 'loose')
87 subConfig.setOptionValue ('.deepCopy', True)
88 subConfig.setOptionValue ('.sortPt', True)
89 subConfig.setOptionValue ('.noUniformSelection', True)
90 subConfig.setOptionValue ('.containerType', 'xAOD::MuonContainer')
91 configSeq += subConfig
92
93 # set up the electron analysis config (For SiHits electrons, use: LooseLHElectronSiHits.NonIso):
94
95 logPLCPAlgCfg.info('Do Electrons')
96
97 subConfig = factory.makeConfig ('Electrons')
98 subConfig.setOptionValue ('.containerName', 'AnalysisElectrons')
99 subConfig.setOptionValue ('.forceFullSimConfigForIso', forceEGammaFullSimConfig)
100 subConfig.setOptionValue ('.isolationCorrection', True)
101 subConfig.setOptionValue ('.minPt', 0.)
102 subConfig.setOptionValue ('.decorateSamplingPattern', True)
103 subConfig.setOptionValue ('.decorateEmva', True)
104 subConfig.setOptionValue ('.addGlobalFELinksDep', True)
105 if len(FixedElDict) > 0:
106 subConfig.setOptionValue ('.propertyOverrides', FixedElDict)
107 configSeq += subConfig
108 subConfig = factory.makeConfig ('Electrons.WorkingPoint')
109 subConfig.setOptionValue ('.containerName', 'AnalysisElectrons')
110 subConfig.setOptionValue ('.selectionName', 'looseLH')
111 subConfig.setOptionValue ('.trackSelection', False)
112 subConfig.setOptionValue ('.identificationWP', 'LooseLH')
113 subConfig.setOptionValue ('.addSelectionToPreselection', False)
114 subConfig.setOptionValue ('.isolationWP', 'NonIso')
115 subConfig.setOptionValue ('.doFSRSelection', True)
116 subConfig.setOptionValue ('.noEffSF', True)
117 configSeq += subConfig
118 subConfig = factory.makeConfig ('Electrons.WorkingPoint')
119 subConfig.setOptionValue ('.containerName', 'AnalysisElectrons')
120 subConfig.setOptionValue ('.selectionName', 'looseDNN')
121 subConfig.setOptionValue ('.trackSelection', False)
122 subConfig.setOptionValue ('.identificationWP', 'LooseDNN')
123 subConfig.setOptionValue ('.addSelectionToPreselection', False)
124 subConfig.setOptionValue ('.isolationWP', 'NonIso')
125 subConfig.setOptionValue ('.doFSRSelection', True)
126 subConfig.setOptionValue ('.noEffSF', True)
127 configSeq += subConfig
128 subConfig = factory.makeConfig ('Thinning')
129 subConfig.setOptionValue ('.containerName', 'AnalysisElectrons')
130 subConfig.setOptionValue ('.selectionName', 'looseLH||looseDNN')
131 subConfig.setOptionValue ('.deepCopy', True)
132 subConfig.setOptionValue ('.sortPt', True)
133 subConfig.setOptionValue ('.noUniformSelection', True)
134 subConfig.setOptionValue ('.containerType', 'xAOD::ElectronContainer')
135 configSeq += subConfig
136
137 # So SiHit electrons - should come after the standard selection in order to avoid keeping the same electrons twice
138 subConfig = factory.makeConfig ('Electrons')
139 subConfig.setOptionValue ('.containerName', 'AnalysisSiHitElectrons')
140 subConfig.setOptionValue ('.forceFullSimConfigForIso', forceEGammaFullSimConfig)
141 subConfig.setOptionValue ('.isolationCorrection', True)
142 subConfig.setOptionValue ('.minPt', 0.)
143 subConfig.setOptionValue ('.postfix', 'SiHit')
144 subConfig.setOptionValue ('.decorateEmva', True)
145 subConfig.setOptionValue ('.addGlobalFELinksDep', True)
146 if len(FixedElDict) > 0:
147 subConfig.setOptionValue ('.propertyOverrides', FixedElDict)
148 configSeq += subConfig
149 subConfig = factory.makeConfig ('Electrons.WorkingPoint')
150 subConfig.setOptionValue ('.containerName', 'AnalysisSiHitElectrons')
151 subConfig.setOptionValue ('.selectionName', 'SiHits')
152 subConfig.setOptionValue ('.trackSelection', False)
153 subConfig.setOptionValue ('.identificationWP', 'SiHitElectron')
154 subConfig.setOptionValue ('.isolationWP', 'NonIso')
155 subConfig.setOptionValue ('.doFSRSelection', True) # needed to veto FSR electrons
156 subConfig.setOptionValue ('.noEffSF', True)
157 subConfig.setOptionValue ('.postfix', 'SiHit')
158 configSeq += subConfig
159 subConfig = factory.makeConfig ('Thinning')
160 subConfig.setOptionValue ('.containerName', 'AnalysisSiHitElectrons')
161 subConfig.setOptionValue ('.selectionName', 'SiHits')
162 subConfig.setOptionValue ('.deepCopy', True)
163 subConfig.setOptionValue ('.sortPt', True)
164 subConfig.setOptionValue ('.noUniformSelection', True)
165 subConfig.setOptionValue ('.containerType', 'xAOD::ElectronContainer')
166 configSeq += subConfig
167
168 # set up the photon analysis config:
169
170 logPLCPAlgCfg.info('Do Photons')
171
172 subConfig = factory.makeConfig ('Photons')
173 subConfig.setOptionValue ('.containerName', 'AnalysisPhotons')
174 subConfig.setOptionValue ('.forceFullSimConfigForIso', forceEGammaFullSimConfig)
175 subConfig.setOptionValue ('.recomputeIsEM', False)
176 subConfig.setOptionValue ('.minPt', 0.)
177 subConfig.setOptionValue ('.decorateEmva', True)
178 subConfig.setOptionValue ('.addGlobalFELinksDep', True)
179 if len(FixedPhDict) > 0:
180 subConfig.setOptionValue ('.propertyOverrides', FixedPhDict)
181 configSeq += subConfig
182 subConfig = factory.makeConfig ('Photons.WorkingPoint')
183 subConfig.setOptionValue ('.containerName', 'AnalysisPhotons')
184 subConfig.setOptionValue ('.selectionName', 'loose')
185 subConfig.setOptionValue ('.qualityWP', 'Loose')
186 subConfig.setOptionValue ('.isolationWP', 'NonIso')
187 subConfig.setOptionValue ('.doFSRSelection', True)
188 subConfig.setOptionValue ('.recomputeIsEM', False)
189 subConfig.setOptionValue ('.noEffSFForID', True)
190 subConfig.setOptionValue ('.noEffSFForIso', True)
191 configSeq += subConfig
192 subConfig = factory.makeConfig ('Thinning')
193 subConfig.setOptionValue ('.containerName', 'AnalysisPhotons')
194 subConfig.setOptionValue ('.selectionName', 'loose')
195 subConfig.setOptionValue ('.deepCopy', True)
196 subConfig.setOptionValue ('.sortPt', True)
197 subConfig.setOptionValue ('.noUniformSelection', True)
198 subConfig.setOptionValue ('.containerType', 'xAOD::PhotonContainer')
199 configSeq += subConfig
200
201
202
203 # set up the tau analysis algorithm config:
204 # Commented for now due to use of public tools
205 subConfig = factory.makeConfig ('TauJets')
206 subConfig.setOptionValue ('.containerName', 'AnalysisTauJets')
207 subConfig.setOptionValue ('.addGlobalFELinksDep', True)
208 configSeq += subConfig
209 subConfig = factory.makeConfig ('TauJets.WorkingPoint')
210 subConfig.setOptionValue ('.containerName', 'AnalysisTauJets')
211 subConfig.setOptionValue ('.selectionName', 'baseline')
212 subConfig.setOptionValue ('.quality', 'Baseline')
213 configSeq += subConfig
214 subConfig = factory.makeConfig ('Thinning')
215 subConfig.setOptionValue ('.containerName', 'AnalysisTauJets')
216 subConfig.setOptionValue ('.selectionName', 'baseline')
217 subConfig.setOptionValue ('.deepCopy', True)
218 subConfig.setOptionValue ('.sortPt', True)
219 subConfig.setOptionValue ('.noUniformSelection', True)
220 subConfig.setOptionValue ('.containerType', 'xAOD::TauJetContainer')
221 configSeq += subConfig
222
223 # set up the jet analysis algorithm config:
224 jetContainer = 'AntiKt4EMPFlowJets'
225 subConfig = factory.makeConfig ('Jets')
226 subConfig.setOptionValue ('.containerName', 'AnalysisJets')
227 subConfig.setOptionValue ('.jetCollection', jetContainer)
228 subConfig.setOptionValue ('.runFJvtSelection', False)
229 subConfig.setOptionValue ('.runJvtSelection', False)
230 subConfig.setOptionValue ('.runUncertainties', False)
231 subConfig.setOptionValue ('.outputTruthLabelIDs', True)
232 configSeq += subConfig
233 subConfig = factory.makeConfig ('Thinning')
234 subConfig.setOptionValue ('.containerName', 'AnalysisJets')
235 subConfig.setOptionValue ('.deepCopy', True)
236 subConfig.setOptionValue ('.sortPt', True)
237 subConfig.setOptionValue ('.noUniformSelection', True)
238 subConfig.setOptionValue ('.containerType', 'xAOD::JetContainer')
239 configSeq += subConfig
240
241 largeRjetContainer='AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets'
242 subConfig = factory.makeConfig ('Jets')
243 subConfig.setOptionValue ('.containerName', 'AnalysisLargeRJets')
244 subConfig.setOptionValue ('.jetCollection', largeRjetContainer)
245 subConfig.setOptionValue ('.runGhostMuonAssociation', False)
246 # Disable kinematic selections on large-R jets
247 subConfig.setOptionValue ('.minPt', 0.)
248 subConfig.setOptionValue ('.maxPt', 0.)
249 subConfig.setOptionValue ('.maxRapidity', 0.)
250 subConfig.setOptionValue ('.minMass', 0.)
251 subConfig.setOptionValue ('.maxMass', 0.)
252 subConfig.setOptionValue ('.runUncertainties', False)
253 subConfig.setOptionValue ('.outputTruthLabelIDs', True)
254 configSeq += subConfig
255 subConfig = factory.makeConfig ('Thinning')
256 subConfig.setOptionValue ('.containerName', 'AnalysisLargeRJets')
257 subConfig.setOptionValue ('.deepCopy', True)
258 subConfig.setOptionValue ('.sortPt', True)
259 subConfig.setOptionValue ('.noUniformSelection', True)
260 subConfig.setOptionValue ('.containerType', 'xAOD::JetContainer')
261 configSeq += subConfig
262
263 from AnalysisAlgorithmsConfig.ConfigAccumulator import ConfigAccumulator
264 configAccumulator = ConfigAccumulator (dataType=None, algSeq=None,
265 autoconfigFromFlags=flags, noSysSuffix=True, noSystematics=True)
266 configSeq.fullConfigure (configAccumulator)
267 return configAccumulator.CA
268
269
270
271# Main algorithm config
272def PHYSLITEKernelCfg(flags, name='PHYSLITEKernel', **kwargs):
273 """Configure the derivation framework driving algorithm (kernel) for PHYSLITE"""
274 acc = ComponentAccumulator()
275
276 # This block does the common physics augmentation which isn't needed (or possible) for PHYS->PHYSLITE
277 # Ensure block only runs for AOD input
278 if 'StreamAOD' in flags.Input.ProcessingTags:
279 # Common augmentations
280 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
281 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
282
283 # Thinning tools
284 # These are set up in PhysCommonThinningConfig. Only thing needed here the list of tools to schedule
285 # This differs depending on whether the input is AOD or PHYS
286 # These are needed whatever the input since they are not applied in PHYS
287 thinningToolsArgs = {
288 'ElectronCaloClusterThinningToolName' : "PHYSLITEElectronCaloClusterThinningTool",
289 'PhotonCaloClusterThinningToolName' : "PHYSLITEPhotonCaloClusterThinningTool",
290 'ElectronGSFTPThinningToolName' : "PHYSLITEElectronGSFTPThinningTool",
291 'PhotonGSFTPThinningToolName' : "PHYSLITEPhotonGSFTPThinningTool"
292 }
293 # whereas these are only needed if the input is AOD since they are applied already in PHYS
294 if 'StreamAOD' in flags.Input.ProcessingTags:
295 thinningToolsArgs.update({
296 'TrackParticleThinningToolName' : "PHYSLITETrackParticleThinningTool",
297 'MuonTPThinningToolName' : "PHYSLITEMuonTPThinningTool",
298 'TauJetThinningToolName' : "PHYSLITETauJetThinningTool",
299 'TauJets_MuonRMThinningToolName' : "PHYSLITETauJets_MuonRMThinningTool",
300 'DiTauTPThinningToolName' : "PHYSLITEDiTauTPThinningTool",
301 'DiTauLowPtThinningToolName' : "PHYSLITEDiTauLowPtThinningTool",
302 'DiTauLowPtTPThinningToolName' : "PHYSLITEDiTauLowPtTPThinningTool",
303 })
304 # Configure the thinning tools
305 from DerivationFrameworkPhys.PhysCommonThinningConfig import PhysCommonThinningCfg
306 acc.merge(PhysCommonThinningCfg(flags, StreamName = kwargs['StreamName'], **thinningToolsArgs))
307 # Get them from the CA so they can be added to the kernel
308 thinningTools = []
309 for key in thinningToolsArgs:
310 thinningTools.append(acc.getPublicTool(thinningToolsArgs[key]))
311
312
313 # Higgs augmentations - 4l vertex, Higgs STXS truth variables, CloseBy isolation correction (for all analyses)
314 # For PhysLite, must run CloseBy BEFORE running analysis sequences to be able to 'pass through' to the shallow copy the added isolation values
315 # Here we only run the augmentation algs
316 # These do not need to be run if PhysLite is run from Phys (i.e. not from 'StreamAOD')
317 if 'StreamAOD' in flags.Input.ProcessingTags:
318 # running from AOD
319
320 from DerivationFrameworkHiggs.HiggsPhysContent import HiggsAugmentationAlgsCfg
321 acc.merge(HiggsAugmentationAlgsCfg(flags))
322
323
324 from IsolationSelection.IsolationSelectionConfig import IsoCloseByAlgsCfg
325 acc.merge(IsoCloseByAlgsCfg(flags, isPhysLite = True))
326
327 #==============================================================================
328 # Analysis-level variables
329 #==============================================================================
330
331 # Needed in principle to support MET association when running PHYS->PHYSLITE,
332 # but since this doesn't work for PHYS->PHYSLITE anyway, commenting for now
333 #if 'StreamDAOD_PHYS' in flags.Input.ProcessingTags
334 # from AtlasGeoModel.GeoModelConfig import GeoModelCfg
335 # acc.merge(GeoModelCfg(flags))
336
337 # add CP algorithms to job
338 acc.merge(CPAlgorithmsCfg(flags))
339
340 # Build MET from our analysis objects
341 if 'StreamAOD' in flags.Input.ProcessingTags:
342 from METReconstruction.METAssocCfg import AssocConfig, METAssocConfig
343 from METReconstruction.METAssociatorCfg import getAssocCA
344 associators = [AssocConfig('PFlowJet', 'AnalysisJets'),
345 AssocConfig('Muon', 'AnalysisMuons'),
346 AssocConfig('Ele', 'AnalysisElectrons'),
347 AssocConfig('Gamma', 'AnalysisPhotons'),
348 AssocConfig('Tau', 'AnalysisTauJets'),
349 AssocConfig('Soft', '')]
350 PHYSLITE_cfg = METAssocConfig('AnalysisMET',
351 flags,
352 associators,
353 doPFlow=True,
354 usePFOLinks=True)
355 components_PHYSLITE_cfg = getAssocCA(PHYSLITE_cfg,METName='AnalysisMET')
356 acc.merge(components_PHYSLITE_cfg)
357 elif 'StreamDAOD_PHYS' in flags.Input.ProcessingTags:
358 from DerivationFrameworkJetEtMiss.METCommonConfig import METRemappingCfg
359
360 METRemap_cfg = METRemappingCfg(flags)
361 acc.merge(METRemap_cfg)
362
363 # The derivation kernel itself
364 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
365 acc.addEventAlgo(DerivationKernel(name, ThinningTools = thinningTools))
366
367 return acc
368
369
370def PHYSLITECfg(flags):
371
372 acc = ComponentAccumulator()
373
374 # Get the lists of triggers needed for trigger matching.
375 # This is needed at this scope (for the slimming) and further down in the config chain
376 # for actually configuring the matching, so we create it here and pass it down
377 # TODO: this should ideally be called higher up to avoid it being run multiple times in a train
378 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
379 PHYSLITETriggerListsHelper = TriggerListsHelper(flags)
380
381 # Set the stream name - varies depending on whether the input is AOD or DAOD_PHYS
382 streamName = 'StreamDAOD_PHYSLITE' if 'StreamAOD' in flags.Input.ProcessingTags else 'StreamD2AOD_PHYSLITE'
383
384 # Common augmentations
385 acc.merge(PHYSLITEKernelCfg(flags, name="PHYSLITEKernel", StreamName = streamName, TriggerListsHelper = PHYSLITETriggerListsHelper))
386
387 # ============================
388 # Define contents of the format
389 # =============================
390 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
391 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
392 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
393
394 PHYSLITESlimmingHelper = SlimmingHelper("PHYSLITESlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
395 PHYSLITESlimmingHelper.ExtraVariables = []
396 # Trigger content
397 PHYSLITESlimmingHelper.IncludeTriggerNavigation = False
398 PHYSLITESlimmingHelper.IncludeJetTriggerContent = False
399 PHYSLITESlimmingHelper.IncludeMuonTriggerContent = False
400 PHYSLITESlimmingHelper.IncludeEGammaTriggerContent = False
401 PHYSLITESlimmingHelper.IncludeTauTriggerContent = False
402 PHYSLITESlimmingHelper.IncludeEtMissTriggerContent = False
403 PHYSLITESlimmingHelper.IncludeBJetTriggerContent = False
404 PHYSLITESlimmingHelper.IncludeBPhysTriggerContent = False
405 PHYSLITESlimmingHelper.IncludeMinBiasTriggerContent = False
406
407 # Trigger matching
408 # Run 2
409 if flags.Trigger.EDMVersion == 2:
410 # Need to re-run matching so that new Analysis<X> containers are matched to triggers
411 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun2Cfg
412 acc.merge(TriggerMatchingCommonRun2Cfg(flags,
413 name = "PHYSLITETrigMatchNoTau",
414 OutputContainerPrefix = "AnalysisTrigMatch_",
415 ChainNames = PHYSLITETriggerListsHelper.Run2TriggerNamesNoTau,
416 InputElectrons = "AnalysisElectrons",
417 InputPhotons = "AnalysisPhotons",
418 InputMuons = "AnalysisMuons",
419 InputTaus = "AnalysisTauJets"))
420 acc.merge(TriggerMatchingCommonRun2Cfg(flags,
421 name = "PHYSLITETrigMatchTau",
422 OutputContainerPrefix = "AnalysisTrigMatch_",
423 ChainNames = PHYSLITETriggerListsHelper.Run2TriggerNamesTau,
424 DRThreshold = 0.2,
425 InputElectrons = "AnalysisElectrons",
426 InputPhotons = "AnalysisPhotons",
427 InputMuons = "AnalysisMuons",
428 InputTaus = "AnalysisTauJets"))
429 # Now add the resulting decorations to the output
430 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
431 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = PHYSLITESlimmingHelper,
432 OutputContainerPrefix = "AnalysisTrigMatch_",
433 TriggerList = PHYSLITETriggerListsHelper.Run2TriggerNamesTau)
434 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = PHYSLITESlimmingHelper,
435 OutputContainerPrefix = "AnalysisTrigMatch_",
436 TriggerList = PHYSLITETriggerListsHelper.Run2TriggerNamesNoTau)
437
438 # Run 3, or Run 2 with navigation conversion
439 if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
440 # No need to run matching: just keep navigation so matching can be done by analysts
441 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
442 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(PHYSLITESlimmingHelper)
443
444 # Event content
445 PHYSLITESlimmingHelper.AppendToDictionary.update({
446 'TruthEvents':'xAOD::TruthEventContainer','TruthEventsAux':'xAOD::TruthEventAuxContainer',
447 'MET_Truth':'xAOD::MissingETContainer','MET_TruthAux':'xAOD::MissingETAuxContainer',
448 'TruthElectrons':'xAOD::TruthParticleContainer','TruthElectronsAux':'xAOD::TruthParticleAuxContainer',
449 'TruthMuons':'xAOD::TruthParticleContainer','TruthMuonsAux':'xAOD::TruthParticleAuxContainer',
450 'TruthPhotons':'xAOD::TruthParticleContainer','TruthPhotonsAux':'xAOD::TruthParticleAuxContainer',
451 'TruthTaus':'xAOD::TruthParticleContainer','TruthTausAux':'xAOD::TruthParticleAuxContainer',
452 'TruthNeutrinos':'xAOD::TruthParticleContainer','TruthNeutrinosAux':'xAOD::TruthParticleAuxContainer',
453 'TruthBSM':'xAOD::TruthParticleContainer','TruthBSMAux':'xAOD::TruthParticleAuxContainer',
454 'TruthBoson':'xAOD::TruthParticleContainer','TruthBosonAux':'xAOD::TruthParticleAuxContainer',
455 'TruthTop':'xAOD::TruthParticleContainer','TruthTopAux':'xAOD::TruthParticleAuxContainer',
456 'TruthForwardProtons':'xAOD::TruthParticleContainer','TruthForwardProtonsAux':'xAOD::TruthParticleAuxContainer',
457 'BornLeptons':'xAOD::TruthParticleContainer','BornLeptonsAux':'xAOD::TruthParticleAuxContainer',
458 'TruthBosonsWithDecayParticles':'xAOD::TruthParticleContainer','TruthBosonsWithDecayParticlesAux':'xAOD::TruthParticleAuxContainer',
459 'TruthBosonsWithDecayVertices':'xAOD::TruthVertexContainer','TruthBosonsWithDecayVerticesAux':'xAOD::TruthVertexAuxContainer',
460 'TruthBSMWithDecayParticles':'xAOD::TruthParticleContainer','TruthBSMWithDecayParticlesAux':'xAOD::TruthParticleAuxContainer',
461 'TruthBSMWithDecayVertices':'xAOD::TruthVertexContainer','TruthBSMWithDecayVerticesAux':'xAOD::TruthVertexAuxContainer',
462 'TruthPrimaryVertices':'xAOD::TruthVertexContainer','TruthPrimaryVerticesAux':'xAOD::TruthVertexAuxContainer',
463 'AnalysisElectrons':'xAOD::ElectronContainer', 'AnalysisElectronsAux':'xAOD::ElectronAuxContainer',
464 'AnalysisSiHitElectrons':'xAOD::ElectronContainer', 'AnalysisSiHitElectronsAux':'xAOD::ElectronAuxContainer',
465 'AnalysisMuons':'xAOD::MuonContainer', 'AnalysisMuonsAux':'xAOD::MuonAuxContainer',
466 'AnalysisJets':'xAOD::JetContainer','AnalysisJetsAux':'xAOD::AuxContainerBase',
467 'AnalysisPhotons':'xAOD::PhotonContainer', 'AnalysisPhotonsAux':'xAOD::PhotonAuxContainer',
468 'AnalysisTauJets':'xAOD::TauJetContainer', 'AnalysisTauJetsAux':'xAOD::TauJetAuxContainer',
469 'MET_Core_AnalysisMET':'xAOD::MissingETContainer', 'MET_Core_AnalysisMETAux':'xAOD::MissingETAuxContainer',
470 'METAssoc_AnalysisMET':'xAOD::MissingETAssociationMap', 'METAssoc_AnalysisMETAux':'xAOD::MissingETAuxAssociationMap',
471 'AnalysisLargeRJets':'xAOD::JetContainer','AnalysisLargeRJetsAux':'xAOD::AuxContainerBase'
472 })
473
474 PHYSLITESlimmingHelper.SmartCollections = [
475 'EventInfo',
476 'InDetTrackParticles',
477 'PrimaryVertices',
478 ]
479
480 from DerivationFrameworkMuons.MuonsCommonConfig import MuonVariablesCfg
481
482 # add in extra values for Higgs
483 from DerivationFrameworkHiggs.HiggsPhysContent import setupHiggsSlimmingVariables
484 setupHiggsSlimmingVariables(flags, PHYSLITESlimmingHelper)
485
486 if flags.Input.isMC:
487 from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool
488 addTruth3ContentToSlimmerTool(PHYSLITESlimmingHelper, reduced=True)
489 # This block is only needed if input is AOD, as it is already done for PHYS->PHYSLITE
490 if 'StreamAOD' in flags.Input.ProcessingTags:
491 from DerivationFrameworkMCTruth.HFClassificationCommonConfig import HFClassificationCommonCfg
492 acc.merge(HFClassificationCommonCfg(flags))
493
494 # Save the extra variables which aren't included by other means
495 btag_variables = [f'{flags.BTagging.AK4TaggerName}_p{x}' for x in ['b', 'c', 'u', 'tau']]
496 PHYSLITESlimmingHelper.ExtraVariables += [
497 'AnalysisElectrons.trackParticleLinks.f1.pt.eta.phi.charge.author.DFCommonElectronsLHVeryLoose.DFCommonElectronsLHLoose.DFCommonElectronsLHLooseBL.DFCommonElectronsLHMedium.DFCommonElectronsLHTight.DFCommonElectronsLHVeryLooseIsEMValue.DFCommonElectronsLHLooseIsEMValue.DFCommonElectronsLHLooseBLIsEMValue.DFCommonElectronsLHMediumIsEMValue.DFCommonElectronsLHTightIsEMValue.DFCommonElectronsDNNLoose.DFCommonElectronsDNNMedium.DFCommonElectronsDNNTight.DFCommonElectronsDNNVeryLooseNoCF97.DFCommonElectronsDNNMediumNoCF.DFCommonElectronsDNNTightNoCF.DFCommonElectronsECIDS.DFCommonElectronsECIDSResult.topoetcone20.topoetcone20ptCorrection.neflowisol20.ptcone20_Nonprompt_All_MaxWeightTTVALooseCone_pt500.ptcone20_Nonprompt_All_MaxWeightTTVALooseCone_pt1000.ptvarcone30_Nonprompt_All_MaxWeightTTVALooseCone_pt500.ptvarcone30_Nonprompt_All_MaxWeightTTVALooseCone_pt1000.topoetcone20_CloseByCorr.ptcone20_Nonprompt_All_MaxWeightTTVALooseCone_pt1000_CloseByCorr.ptvarcone30_Nonprompt_All_MaxWeightTTVALooseCone_pt1000_CloseByCorr.caloClusterLinks.ambiguityLink.TruthLink.truthOrigin.truthType.truthPdgId.firstEgMotherTruthType.firstEgMotherTruthOrigin.firstEgMotherTruthParticleLink.firstEgMotherPdgId.ambiguityType.OQ.Eadded_Lr2.Eadded_Lr3.E_mva_only.DFCommonAddAmbiguity',
498 'AnalysisSiHitElectrons.pt.eta.phi.charge.author.topoetcone20_CloseByCorr.DFCommonElectronsLHVeryLoose.ptvarcone30_Nonprompt_All_MaxWeightTTVALooseCone_pt1000_CloseByCorr.OQ.truthOrigin.truthType.firstEgMotherTruthType.firstEgMotherTruthOrigin.z0stheta.d0Normalized.nInnerExpPix.clEta.clPhi.E_mva_only',
499 'AnalysisPhotons.f1.pt.eta.phi.author.OQ.DFCommonPhotonsIsEMLoose.DFCommonPhotonsIsEMMedium.DFCommonPhotonsIsEMTight.DFCommonPhotonsIsEMTightIsEMValue.DFCommonPhotonsCleaning.DFCommonPhotonsCleaningNoTime.ptcone20.topoetcone20.topoetcone40.topoetcone20ptCorrection.topoetcone40ptCorrection.topoetcone20_CloseByCorr.topoetcone40_CloseByCorr.ptcone20_CloseByCorr.caloClusterLinks.vertexLinks.ambiguityLink.TruthLink.truthOrigin.truthType.Eadded_Lr2.Eadded_Lr3.E_mva_only.DFCommonPhotonsIsEMTightNF.DFCommonPhotonsIsEMTightNFIsEMValue.DFCommonPhotonsNFBDTTight.DFCommonPhotonsNFBDTTightIsEMValue.DFCommonPhotonsNFBDTScore',
500 'GSFTrackParticles.chiSquared.phi.d0.theta.qOverP.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag.z0.vz.charge.vertexLink.numberOfPixelHits.numberOfSCTHits.expectInnermostPixelLayerHit.expectNextToInnermostPixelLayerHit.numberOfInnermostPixelLayerHits.numberOfNextToInnermostPixelLayerHits.originalTrackParticle',
501 'GSFConversionVertices.trackParticleLinks.x.y.z.px.py.pz.pt1.pt2.neutralParticleLinks.minRfirstHit',
502 'egammaClusters.calE.calEta.calPhi.calM.e_sampl.eta_sampl.ETACALOFRAME.PHICALOFRAME.ETA2CALOFRAME.PHI2CALOFRAME.constituentClusterLinks.samplingPattern',
503 "AnalysisMuons.{var_string}".format(var_string = ".".join(MuonVariablesCfg(flags))),
504 'CombinedMuonTrackParticles.qOverP.d0.z0.vz.phi.theta.truthOrigin.truthType.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag.numberOfPixelDeadSensors.numberOfPixelHits.numberOfPixelHoles.numberOfSCTDeadSensors.numberOfSCTHits.numberOfSCTHoles.numberOfTRTHits.numberOfTRTOutliers.chiSquared.numberDoF',
505 'ExtrapolatedMuonTrackParticles.d0.z0.vz.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag.truthOrigin.truthType.qOverP.theta.phi',
506 'MuonSpectrometerTrackParticles.phi.d0.z0.vz.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag.vertexLink.theta.qOverP',
507 'InDetForwardTrackParticles.vz.truthType.truthOrigin.numberDoF.numberOfTRTHits.numberOfSCTHoles.theta.numberOfTRTOutliers.numberOfPrecisionLayers.numberOfSCTDeadSensors.numberOfPixelHoles.numberOfSCTHits.numberOfPrecisionHoleLayers.numberOfPixelDeadSensors.phi.numberOfPixelHits.z0.d0.qOverP.chiSquared.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag',
508 'AnalysisTauJets.pt.eta.phi.m.ptFinalCalib.etaFinalCalib.ptTauEnergyScale.etaTauEnergyScale.charge.nChargedTracks.isTauFlags.PanTau_DecayMode.NNDecayMode.RNNJetScoreSigTrans.GNTauScoreSigTrans_v0prune.GNTauVL_v0prune.GNTauL_v0prune.GNTauM_v0prune.GNTauT_v0prune.RNNEleScoreSigTrans_v1.EleRNNLoose_v1.EleRNNMedium_v1.EleRNNTight_v1.trackWidth.passTATTauMuonOLR.tauTrackLinks.vertexLink.truthParticleLink.truthJetLink.IsTruthMatched.truthOrigin.truthType.TESCompatibility',
509 'AnalysisJets.pt.eta.phi.m.numConstit.JetConstitScaleMomentum_pt.JetConstitScaleMomentum_eta.JetConstitScaleMomentum_phi.JetConstitScaleMomentum_m.NumTrkPt500.SumPtTrkPt500.DetectorEta.DetectorY.JVFCorr.NNJvtPass.NumTrkPt1000.TrackWidthPt1000.GhostMuonSegmentCount.PartonTruthLabelID.HadronConeExclExtendedTruthLabelID.HadronConeExclTruthLabelID.TrueFlavor.DFCommonJets_jetClean_LooseBad.DFCommonJets_jetClean_TightBad.Timing.btagging.btaggingLink.GhostTrack.DFCommonJets_fJvt.PSFrac.JetAccessorMap.EMFrac.Width.ActiveArea4vec_pt.ActiveArea4vec_eta.ActiveArea4vec_m.ActiveArea4vec_phi.EnergyPerSampling.SumPtChargedPFOPt500.isJvtHS.QGTransformer_ConstScore.{btag_var_string}'.format(btag_var_string = ".".join(btag_variables)),
510 'TruthPrimaryVertices.t.x.y.z',
511 'MET_Core_AnalysisMET.name.mpx.mpy.sumet.source',
512 'METAssoc_AnalysisMET.',
513 'InDetTrackParticles.numberOfTRTHits.numberOfTRTOutliers',
514 'EventInfo.RandomRunNumber.PileupWeight_NOSYS.GenFiltHT.GenFiltMET.GenFiltHTinclNu.GenFiltPTZ.GenFiltFatJ.HF_Classification.HF_SimpleClassification.{GRL_Deco_names}'.format(GRL_Deco_names='.'.join(str(key) for key in (getGoodRunsLists()).keys())),
515 'Kt4EMPFlowEventShape.Density',
516 'Kt4EMPFlowNeutEventShape.Density',
517 'TauTracks.flagSet.trackLinks',
518 'AnalysisLargeRJets.pt.eta.phi.m.numConstit.JetConstitScaleMomentum_pt.JetConstitScaleMomentum_eta.JetConstitScaleMomentum_phi.JetConstitScaleMomentum_m.DetectorEta.DetectorY.ECF1.ECF2.ECF3.Tau1_wta.Tau2_wta.Tau3_wta.Split12.Split23.Qw.D2.C2.R10TruthLabel_R22v1.R10TruthLabel_R21Precision_2022v1.GhostBHadronsFinalCount.GhostCHadronsFinalCount.GN2Xv01_phbb.GN2Xv01_phcc.GN2Xv01_ptop.GN2Xv01_pqcd',
519 ]
520
521 # Output stream
522 PHYSLITEItemList = PHYSLITESlimmingHelper.GetItemList()
523
524 formatString = 'D2AOD_PHYSLITE' if 'StreamDAOD_PHYS' in flags.Input.ProcessingTags else 'DAOD_PHYSLITE'
525 acc.merge(OutputStreamCfg(flags, formatString, ItemList=PHYSLITEItemList, AcceptAlgs=["PHYSLITEKernel"]))
526 acc.merge(SetupMetaDataForStreamCfg(flags, formatString, AcceptAlgs=["PHYSLITEKernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
527
528 return acc
529
PHYSLITECfg(flags)
Definition PHYSLITE.py:370
PHYSLITEKernelCfg(flags, name='PHYSLITEKernel', **kwargs)
Definition PHYSLITE.py:272
CPAlgorithmsCfg(flags)
Definition PHYSLITE.py:17