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" ]
51flags.lock()
52
53# Main services
54from AthenaConfiguration.MainServicesConfig import MainServicesCfg
55acc = MainServicesCfg( flags )
56
57# Pool reading and writing
58from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleReadCfg, AthenaPoolExampleWriteCfg
59acc.merge( AthenaPoolExampleReadCfg(flags, readCatalogs = ["file:Catalog1.xml"]) )
60acc.merge( AthenaPoolExampleWriteCfg(flags, streamName,
61 writeCatalog = "file:Catalog1.xml",
62 disableEventTag = noTag) )
63
64# Produce xAOD::EventInfo from EventInfo
65from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
66acc.merge( EventInfoCnvAlgCfg(flags, disableBeamSpot = True) )
67
68streamCA = OutputStreamCfg(flags, streamName, disableEventTag = noTag,
69 ItemList = ["EventInfo#*", "ExampleHitContainer#MyHits"])
70stream = streamCA.getEventAlgo( outputStreamName( streamName ) )
71stream.ExtendProvenanceRecord = False
72acc.merge( streamCA )
73
74# Run
75import sys
76sc = acc.run(flags.Exec.MaxEvents)
77sys.exit(sc.isFailure())
78
79
80
81
82
83