ATLAS Offline Software
Loading...
Searching...
No Matches
ReadxAODConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2# Configure the ReadxAOD 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 ReadxAODCfg(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 # The exact configuration of the tool is set in InDetTrackSelectionTool_Loose_Cfg
18 # One could also configure the tool directly here if bespoke settings were needed
19 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig import (
20 InDetTrackSelectionTool_Loose_Cfg)
21 trackSelectionTool = acc.popToolsAndMerge(InDetTrackSelectionTool_Loose_Cfg(flags))
22
23 # Configure the algorithm.... note that the tool from above is passed
24 # Then add the algorithm to the accumulator
25 acc.addEventAlgo(CompFactory.ReadxAOD(name = "ReadxAOD",
26 PtCut = 1.0*GeV,
27 TrackSelectionTool = trackSelectionTool,
28 TrackParticlesKey = "InDetTrackParticles"))
29 return acc
30
31# Lines to allow the script to be run stand-alone via python
32if __name__ == "__main__":
33
34 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
35 from AthenaConfiguration.AllConfigFlags import initConfigFlags
36 import sys
37 # Configuration flags
38 flags = initConfigFlags()
39
40 # Obtain default test files (user can provide their own as well)
41 from AthenaConfiguration.TestDefaults import defaultTestFiles
42
43 # Set the input file - can also use command line via --files
44 flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
45
46 # Number of events to process
47 flags.Exec.MaxEvents = 1000
48 flags.fillFromArgs()
49 flags.lock()
50
51 # Configure the file reading machinery
52 cfg = MainServicesCfg(flags)
53 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
54 cfg.merge(PoolReadCfg(flags))
55
56 # Run the job
57 cfg.merge(ReadxAODCfg(flags))
58 sys.exit(cfg.run().isFailure())
59