ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExBasics
python
WritexAODConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
# Configure the WritexAOD algorithm
3
# For guidelines on writing configuration scripts see the following pages:
4
# https://atlas-software.docs.cern.ch/athena/configuration/
5
6
# Imports of the configuration machinery
7
from
AthenaConfiguration.ComponentFactory
import
CompFactory
8
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
9
from
AthenaCommon.SystemOfUnits
import
GeV
10
11
def
WritexAODCfg
(flags):
12
'''Method to configure the ReadTriggerDecision algorithm'''
13
acc = ComponentAccumulator()
14
15
# Track selection tool configuration
16
# https://twiki.cern.ch/twiki/bin/view/AtlasProtected/InDetTrackSelectionTool
17
from
InDetTrackSelectionTool.InDetTrackSelectionToolConfig
import
(
18
InDetTrackSelectionToolCfg)
19
trackSelectionTool = acc.popToolsAndMerge(InDetTrackSelectionToolCfg(
20
flags,
21
name=
"TestTrackSelectorTool"
,
22
minPt=1.0*GeV)
23
)
24
25
# Configure the algorithm.... note that the tool from above is passed
26
# Then add the algorithm to the accumulator
27
acc.addEventAlgo(CompFactory.WritexAOD(name=
"WritexAOD"
,
28
TrackSelectionTool=trackSelectionTool,
29
TrackParticlesKey=
"InDetTrackParticles"
,
30
NewTrackParticlesKey=
"SelectedTrackParticles"
))
31
return
acc
32
33
# Lines to allow the script to be run stand-alone via python
34
if
__name__ ==
"__main__"
:
35
36
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
37
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
38
import
sys
39
# Configuration flags
40
flags = initConfigFlags()
41
42
# Obtain default test files (user can provide their own as well)
43
from
AthenaConfiguration.TestDefaults
import
defaultTestFiles
44
45
# Set the input file - can also use command line via --files
46
flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
47
48
# Number of events to process
49
flags.Exec.MaxEvents = 1000
50
flags.fillFromArgs()
51
flags.lock()
52
53
# Configure the file reading machinery
54
cfg = MainServicesCfg(flags)
55
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
56
cfg.merge(PoolReadCfg(flags))
57
58
# Configure the output writing
59
from
OutputStreamAthenaPool.OutputStreamConfig
import
OutputStreamCfg
60
cfg.merge(OutputStreamCfg(
61
flags,
62
streamName=
"TestStream"
,
63
ItemList=[
"EventInfo#*"
,
64
"xAOD::TrackParticleContainer#SelectedTrackParticles"
])
65
)
66
67
# Run the job
68
cfg.merge(
WritexAODCfg
(flags))
69
sys.exit(cfg.run().isFailure())
WritexAODConfig.WritexAODCfg
WritexAODCfg(flags)
Definition
WritexAODConfig.py:11
Generated on
for ATLAS Offline Software by
1.17.0