Skip to content
Snippets Groups Projects
Commit ee003c61 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'SkimmingDAODs' into 'main'

Adding TEST7.py with skimming code for DAODs to D2AODs

See merge request atlas/athena!69413
parents 2df8fb28 49cfc906
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
# All derivation framework formats must be listed here
# Example formats
......@@ -14,6 +14,8 @@ from DerivationFrameworkExamples.TEST4 import TEST4Cfg
from DerivationFrameworkExamples.TEST5 import TEST5Cfg
# Pre-selection example
from DerivationFrameworkExamples.TEST6 import TEST6Cfg
# Skimming DAOD->D2AOD with strings
from DerivationFrameworkExamples.TEST7 import TEST7Cfg
# Truth (EVNT->xAOD) formats
# TRUTH0 - complete copy of HepMC to xAOD truth
......@@ -137,7 +139,7 @@ from DerivationFrameworkNCB.NCB1 import NCB1Cfg
# Avoids compilation warnings from Flake8
__all__ = ['TEST1Cfg','TEST2Cfg','TEST3Cfg','TEST4Cfg','TEST5Cfg','TEST6Cfg',
__all__ = ['TEST1Cfg','TEST2Cfg','TEST3Cfg','TEST4Cfg','TEST5Cfg','TEST6Cfg','TEST7Cfg',
'TRUTH0Cfg','TRUTH1Cfg','TRUTH3Cfg',
'PHYSCfg','PHYSLITECfg',
'PHYSVALCfg',
......
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#!/usr/bin/env python
# TEST7.py - derivation framework example demonstrating skimming via means of string
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaCommon.CFElements import seqAND
def TEST7SkimmingToolCfg(flags):
"""Configure the example skimming tool"""
from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg
acc = ComponentAccumulator()
tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
acc.addPublicTool(CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "TEST7StringSkimmingTool",
expression = "( count(Muons.pt > (6 * GeV)) + count(Electrons.pt > (6 * GeV)) ) >= 3",
TrigDecisionTool=tdt),
primary = True)
return(acc)
def TEST7KernelCfg(flags, name='TEST7Kernel', **kwargs):
"""Configure the derivation framework driving algorithm (kernel)"""
acc = ComponentAccumulator()
# The next three lines are necessary in case the string skimming tool accesses containers which haven't
# previously been accessed via ReadHandles (as here). One must create a new sequence, list all of the
# accessed container types and keys as ExtraDataForDynamicConsumers (just Muons here) and then set the property
# ProcessDynamicDataDependencies to True for that sequence. The relevant skimming tools must then be attached
# to this sequence. The use of seqAND here isn't relevant since there is only one sequence in use.
# This step isn't needed in case the common augmentations are run first (e.g. with PHYS/PHYSLITE etc). In
# such cases one can omit the next three lines and the sequenceName argument in addEventAlgo.
acc.addSequence( seqAND("TEST7Sequence") )
acc.getSequence("TEST7Sequence").ExtraDataForDynamicConsumers = ['xAOD::MuonContainer/Muons','xAOD::ElectronContainer/Electrons']
acc.getSequence("TEST7Sequence").ProcessDynamicDataDependencies = True
skimmingTool = acc.getPrimaryAndMerge(TEST7SkimmingToolCfg(flags))
DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
acc.addEventAlgo(DerivationKernel(name, SkimmingTools = [skimmingTool]), sequenceName="TEST7Sequence")
return acc
def TEST7Cfg(ConfigFlags):
acc = ComponentAccumulator()
acc.merge(TEST7KernelCfg(ConfigFlags, name="TEST7Kernel"))
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
TEST7SlimmingHelper = SlimmingHelper("TEST7SlimmingHelper", NamesAndTypes = ConfigFlags.Input.TypedCollections, ConfigFlags = ConfigFlags)
TEST7SlimmingHelper.SmartCollections = ["EventInfo",
"Electrons",
"Photons",
"Muons",
"PrimaryVertices",
"InDetTrackParticles",
"AntiKt4EMTopoJets",
"AntiKt4EMPFlowJets",
"BTagging_AntiKt4EMPFlow",
"BTagging_AntiKtVR30Rmax4Rmin02Track",
"MET_Baseline_AntiKt4EMTopo",
"MET_Baseline_AntiKt4EMPFlow",
"TauJets",
"DiTauJets",
"DiTauJetsLowPt",
"AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
"AntiKtVR30Rmax4Rmin02PV0TrackJets"]
TEST7ItemList = TEST7SlimmingHelper.GetItemList()
acc.merge(OutputStreamCfg(ConfigFlags, "D2AOD_TEST7", ItemList=TEST7ItemList, AcceptAlgs=["TEST7Kernel"]))
acc.merge(SetupMetaDataForStreamCfg(ConfigFlags, "D2AOD_TEST7", AcceptAlgs=["TEST7Kernel"], propagateMetadataFromInput=True))
return acc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment