ATLAS Offline Software
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://atlassoftwaredocs.web.cern.ch/guides/ca_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 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
31 if __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 
SystemOfUnits
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.InDetTrackSelectionToolConfig.InDetTrackSelectionTool_Loose_Cfg
def InDetTrackSelectionTool_Loose_Cfg(flags, name="InDetTrackSelectionTool_Loose", **kwargs)
Configs based on CutLevel Loose #####.
Definition: InDetTrackSelectionToolConfig.py:36
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
ReadxAODConfig.ReadxAODCfg
def ReadxAODCfg(flags)
Definition: ReadxAODConfig.py:11
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69