ATLAS Offline Software
Loading...
Searching...
No Matches
TEST2.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2# TEST2.py - derivation framework example demonstrating skimming via means of string
3
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5from AthenaConfiguration.ComponentFactory import CompFactory
6from AthenaConfiguration.Enums import MetadataCategory
7from AthenaCommon.CFElements import seqAND
8
10 """Configure the example skimming tool"""
11 from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg
12 acc = ComponentAccumulator()
13 tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
14 acc.addPublicTool(CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "TEST2StringSkimmingTool",
15 expression = "count(Muons.pt > (1 * GeV)) >= 1",
16 TrigDecisionTool=tdt),
17 primary = True)
18 return(acc)
19
20def TEST2KernelCfg(flags, name='TEST2Kernel', **kwargs):
21 """Configure the derivation framework driving algorithm (kernel)"""
22 acc = ComponentAccumulator()
23 # The next three lines are necessary in case the string skimming tool accesses containers which haven't
24 # previously been accessed via ReadHandles (as here). One must create a new sequence, list all of the
25 # accessed container types and keys as ExtraDataForDynamicConsumers (just Muons here) and then set the property
26 # ProcessDynamicDataDependencies to True for that sequence. The relevant skimming tools must then be attached
27 # to this sequence. The use of seqAND here isn't relevant since there is only one sequence in use.
28 # This step isn't needed in case the common augmentations are run first (e.g. with PHYS/PHYSLITE etc). In
29 # such cases one can omit the next three lines and the sequenceName argument in addEventAlgo.
30 acc.addSequence( seqAND("TEST2Sequence") )
31 acc.getSequence("TEST2Sequence").ExtraDataForDynamicConsumers = ['xAOD::MuonContainer/Muons']
32 acc.getSequence("TEST2Sequence").ProcessDynamicDataDependencies = True
33 skimmingTool = acc.getPrimaryAndMerge(TEST2SkimmingToolCfg(flags))
34 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
35 acc.addEventAlgo(DerivationKernel(name, SkimmingTools = [skimmingTool]), sequenceName="TEST2Sequence")
36 return acc
37
38
39def TEST2Cfg(flags):
40
41 acc = ComponentAccumulator()
42 acc.merge(TEST2KernelCfg(flags, name="TEST2Kernel"))
43
44 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
45 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
46 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
47 TEST2SlimmingHelper = SlimmingHelper("TEST2SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
48 TEST2SlimmingHelper.SmartCollections = ["EventInfo",
49 "Electrons",
50 "Photons",
51 "Muons",
52 "PrimaryVertices",
53 "InDetTrackParticles",
54 "AntiKt4EMTopoJets",
55 "AntiKt4EMPFlowJets",
56
57 "MET_Baseline_AntiKt4EMTopo",
58 "MET_Baseline_AntiKt4EMPFlow",
59 "TauJets",
60 "DiTauJets",
61 "DiTauJetsLowPt",
62 "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"]
63 TEST2ItemList = TEST2SlimmingHelper.GetItemList()
64
65 acc.merge(OutputStreamCfg(flags, "DAOD_TEST2", ItemList=TEST2ItemList, AcceptAlgs=["TEST2Kernel"]))
66 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_TEST2", AcceptAlgs=["TEST2Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
67
68 return acc
TEST2SkimmingToolCfg(flags)
Definition TEST2.py:9
TEST2Cfg(flags)
Definition TEST2.py:39
TEST2KernelCfg(flags, name='TEST2Kernel', **kwargs)
Definition TEST2.py:20