Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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://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 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
33 if __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())
WritexAODConfig.WritexAODCfg
def WritexAODCfg(flags)
Definition: WritexAODConfig.py:11
SystemOfUnits
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, keepProvenanceTagsRegEx=None, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:16
python.InDetTrackSelectionToolConfig.InDetTrackSelectionToolCfg
def InDetTrackSelectionToolCfg(flags, name="InDetTrackSelectionTool", **kwargs)
Definition: InDetTrackSelectionToolConfig.py:7
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69