ATLAS Offline Software
TEST5.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 # TEST5.py - derivation framework example demonstrating the use of decorators
3 # Two decorations are done - one from an example tool (AugemntationToolExample)
4 # and one from a CP tool (muon selection tool). Decorations are added as ExtraVariables
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from AthenaConfiguration.Enums import MetadataCategory
9 
10 def TEST5CPToolCfg(flags):
11  """Configure the example muon CP tool"""
12  acc = ComponentAccumulator()
13  mst = CompFactory.CP.MuonSelectionTool(name = 'TEST5MuonSelectionTool',
14  TurnOffMomCorr = True,
15  AllowSettingGeometryOnTheFly = True)
16  acc.addPublicTool(mst, primary=True)
17  acc.addPublicTool(CompFactory.DerivationFramework.AsgSelectionToolWrapper(name = "TEST5MuonToolWrapper",
18  AsgSelectionTool = mst,
19  CutType = "IDHits",
20  StoreGateEntryName = "TEST5GoodMuons",
21  ContainerName = "Muons"),
22  primary = True)
23  return(acc)
24 
25 
27  """Configure the example augmentation tool"""
28  acc = ComponentAccumulator()
29  acc.addPublicTool(CompFactory.DerivationFramework.AugmentationToolExample(name = "TEST5AugmentationTool"),
30  primary = True)
31  return(acc)
32 
33 
34 def TEST5KernelCfg(flags, name='TEST5Kernel', **kwargs):
35  """Configure the derivation framework driving algorithm (kernel)"""
36  acc = ComponentAccumulator()
37  augmentationTool = acc.getPrimaryAndMerge(TEST5AugmentationToolCfg(flags))
38  cpTool = acc.getPrimaryAndMerge(TEST5CPToolCfg(flags))
39  DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
40  acc.addEventAlgo(DerivationKernel(name, AugmentationTools = [augmentationTool,cpTool]))
41  return acc
42 
43 
44 def TEST5Cfg(flags):
45 
46  acc = ComponentAccumulator()
47  acc.merge(TEST5KernelCfg(flags, name="TEST5Kernel",StreamName = "OutputStreamDAOD_TEST5"))
48 
49  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
50  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
51  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
52  TEST5SlimmingHelper = SlimmingHelper("TEST5SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
53  TEST5SlimmingHelper.SmartCollections = ["EventInfo","InDetTrackParticles","PrimaryVertices","Muons"]
54  TEST5SlimmingHelper.ExtraVariables += ["InDetTrackParticles.DFDecoratorExample"]
55  TEST5SlimmingHelper.ExtraVariables += ["Muons.TEST5GoodMuons"]
56  TEST5SlimmingHelper.StaticContent += ["std::vector<float>#DFAugmentationExample"]
57  TEST5ItemList = TEST5SlimmingHelper.GetItemList()
58  acc.merge(OutputStreamCfg(flags, "DAOD_TEST5", ItemList=TEST5ItemList, AcceptAlgs=["TEST5Kernel"]))
59  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_TEST5", AcceptAlgs=["TEST5Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
60  return acc
python.TEST5.TEST5CPToolCfg
def TEST5CPToolCfg(flags)
Definition: TEST5.py:10
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TEST5.TEST5AugmentationToolCfg
def TEST5AugmentationToolCfg(flags)
Definition: TEST5.py:26
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.TEST5.TEST5KernelCfg
def TEST5KernelCfg(flags, name='TEST5Kernel', **kwargs)
Definition: TEST5.py:34
python.TEST5.TEST5Cfg
def TEST5Cfg(flags)
Definition: TEST5.py:44
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:222
SlimmingHelper
Definition: SlimmingHelper.py:1
python.HION12.DerivationKernel
DerivationKernel
Definition: HION12.py:66