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