ATLAS Offline Software
Loading...
Searching...
No Matches
WritexAODConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 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
7from AthenaConfiguration.ComponentFactory import CompFactory
8from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9from AthenaCommon.SystemOfUnits import GeV
10
11def 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 InDetConfig.InDetTrackSelectionToolConfig import InDetTrackSelectionToolCfg
18 trackSelectionTool = acc.popToolsAndMerge(InDetTrackSelectionToolCfg(
19 flags,
20 name="TestTrackSelectorTool",
21 minPt=1.0*GeV)
22 )
23
24 # Configure the algorithm.... note that the tool from above is passed
25 # Then add the algorithm to the accumulator
26 acc.addEventAlgo(CompFactory.WritexAOD(name="WritexAOD",
27 TrackSelectionTool=trackSelectionTool,
28 TrackParticlesKey="InDetTrackParticles",
29 NewTrackParticlesKey="SelectedTrackParticles"))
30 return acc
31
32# Lines to allow the script to be run stand-alone via python
33if __name__ == "__main__":
34
35 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
36 from AthenaConfiguration.AllConfigFlags import initConfigFlags
37 import sys
38 # Configuration flags
39 flags = initConfigFlags()
40
41 # Obtain default test files (user can provide their own as well)
42 from AthenaConfiguration.TestDefaults import defaultTestFiles
43
44 # Set the input file - can also use command line via --files
45 flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
46
47 # Number of events to process
48 flags.Exec.MaxEvents = 1000
49 flags.fillFromArgs()
50 flags.lock()
51
52 # Configure the file reading machinery
53 cfg = MainServicesCfg(flags)
54 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
55 cfg.merge(PoolReadCfg(flags))
56
57 # Configure the output writing
58 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
59 cfg.merge(OutputStreamCfg(
60 flags,
61 streamName="TestStream",
62 ItemList=["EventInfo#*",
63 "xAOD::TrackParticleContainer#SelectedTrackParticles"])
64 )
65
66 # Run the job
67 cfg.merge(WritexAODCfg(flags))
68 sys.exit(cfg.run().isFailure())