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