ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolExample_Copy.py
Go to the documentation of this file.
1#!/env/python
2
3# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4
5
35
36from AthenaConfiguration.AllConfigFlags import initConfigFlags
37from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg, outputStreamName
38
39streamName = "Copy"
40outputFileName = "SimplePoolReplica1.root"
41noTag = True
42
43# Setup flags
44flags = initConfigFlags()
45flags.Input.Files = [ "SimplePoolFile1.root" ]
46flags.addFlag(f"Output.{streamName}FileName", outputFileName)
47flags.Exec.MaxEvents = -1
48flags.Common.MsgSuppression = False
49flags.Exec.DebugMessageComponents = [ outputStreamName(streamName), "EventSelector",
50 "PoolSvc", "AthenaPoolCnvSvc","AthenaPoolAddressProviderSvc", "MetaDataSvc" ]
51
52#Run3 for now
53from AthenaConfiguration.TestDefaults import defaultGeometryTags
54flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
55
56flags.lock()
57
58# Main services
59from AthenaConfiguration.MainServicesConfig import MainServicesCfg
60acc = MainServicesCfg( flags )
61
62# Pool reading and writing
63from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleReadCfg, AthenaPoolExampleWriteCfg
64acc.merge( AthenaPoolExampleReadCfg(flags, readCatalogs = ["file:Catalog1.xml"]) )
65acc.merge( AthenaPoolExampleWriteCfg(flags, streamName,
66 writeCatalog = "file:Catalog1.xml",
67 disableEventTag = noTag) )
68
69# Produce xAOD::EventInfo from EventInfo
70from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
71acc.merge( EventInfoCnvAlgCfg(flags, disableBeamSpot = True) )
72
73streamCA = OutputStreamCfg(flags, streamName, disableEventTag = noTag,
74 ItemList = ["EventInfo#*", "ExampleHitContainer#MyHits"])
75stream = streamCA.getEventAlgo( outputStreamName( streamName ) )
76stream.ExtendProvenanceRecord = False
77acc.merge( streamCA )
78
79# Run
80import sys
81sc = acc.run(flags.Exec.MaxEvents)
82sys.exit(sc.isFailure())
83
84
85
86
87
88