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