ATLAS Offline Software
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 
36 from AthenaConfiguration.AllConfigFlags import initConfigFlags
37 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg, outputStreamName
38 
39 streamName = "Copy"
40 outputFileName = "SimplePoolReplica1.root"
41 noTag = True
42 
43 # Setup flags
44 flags = initConfigFlags()
45 flags.Input.Files = [ "SimplePoolFile1.root" ]
46 flags.addFlag(f"Output.{streamName}FileName", outputFileName)
47 flags.Exec.MaxEvents = -1
48 flags.Common.MsgSuppression = False
49 flags.Exec.DebugMessageComponents = [ outputStreamName(streamName), "EventSelector",
50  "PoolSvc", "AthenaPoolCnvSvc","AthenaPoolAddressProviderSvc", "MetaDataSvc" ]
51 flags.lock()
52 
53 # Main services
54 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
55 acc = MainServicesCfg( flags )
56 
57 # Pool reading and writing
58 from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleReadCfg, AthenaPoolExampleWriteCfg
59 acc.merge( AthenaPoolExampleReadCfg(flags, readCatalogs = ["file:Catalog1.xml"]) )
60 acc.merge( AthenaPoolExampleWriteCfg(flags, streamName,
61  writeCatalog = "file:Catalog1.xml",
62  disableEventTag = noTag) )
63 
64 # Produce xAOD::EventInfo from EventInfo
65 from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
66 acc.merge( EventInfoCnvAlgCfg(flags, disableBeamSpot = True) )
67 
68 streamCA = OutputStreamCfg(flags, streamName, disableEventTag = noTag,
69  ItemList = ["EventInfo#*", "ExampleHitContainer#MyHits"])
70 stream = streamCA.getEventAlgo( outputStreamName( streamName ) )
71 stream.ExtendProvenanceRecord = False
72 stream.ExcludeList += ["xAOD::EventInfo#*", "xAOD::EventAuxInfo#*"]
73 acc.merge( streamCA )
74 
75 # Run
76 import sys
77 sc = acc.run(flags.Exec.MaxEvents)
78 sys.exit(sc.isFailure())
79 
80 
81 
82 
83 
84 
AthenaPoolExample_WriteCond.outputStreamName
string outputStreamName
Definition: AthenaPoolExample_WriteCond.py:21
AthenaPoolExampleConfig.AthenaPoolExampleWriteCfg
def AthenaPoolExampleWriteCfg(flags, outputStreamName, writeCatalog=None, disableEventTag=True)
Definition: AthenaPoolExampleConfig.py:38
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
AthenaPoolExampleConfig.AthenaPoolExampleReadCfg
def AthenaPoolExampleReadCfg(flags, readCatalogs=[])
Definition: AthenaPoolExampleConfig.py:6
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:252
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11