ATLAS Offline Software
TestReadWriteEventFormat.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 import sys
3 
4 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
5 from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
8 from xAODEventFormatCnv.EventFormatTestConfig import (
9  EventFormatTestFlags,
10  EventFormatTestOutputCfg,
11 )
12 
13 
14 def main():
15  numberOfStreams = 1
16  flags = EventFormatTestFlags(
17  inputFiles=["Test0.pool.root"],
18  eventsPerFile=1,
19  )
20  streamName = "ReadWriteTest"
21  for i in range(numberOfStreams):
22  flags.addFlag(
23  f"Output.{streamName}{i}FileName",
24  f"{streamName}{i}.pool.root",
25  )
26  flags.addFlag(f"Output.doWrite{streamName}{i}", True)
27 
28  flags.lock()
29 
30  itemList = [
31  "xAODMakerTest::AVec#TestObject",
32  "xAODMakerTest::AAuxContainer#TestObjectAux.",
33  "xAODMakerTest::AVec#TestObject2",
34  "xAODMakerTest::AAuxContainer#TestObject2Aux.",
35  "xAOD::EventInfo#EventInfo",
36  "xAOD::EventAuxInfo#EventInfoAux.",
37  ]
38 
40  flags,
41  streamName="ReadWriteTest",
42  itemList=itemList,
43  numberOfStreams=numberOfStreams,
44  )
45 
46  acc.addEventAlgo(
47  CompFactory.xAODMakerTest.ACreatorAlg("ACreator", OutputKey="TestObject2")
48  )
49  acc.merge(EventInfoCnvAlgCfg(flags=flags, inputKey="", disableBeamSpot=True))
50  acc.merge(PoolReadCfg(flags))
51  acc.merge(
53  flags,
54  tools=[
55  CompFactory.xAODMaker.EventFormatMetaDataTool(
56  "EventFormatMetaDataTool",
57  OutputLevel=1,
58  Keys=[
59  "EventFormatStreamTest0",
60  "EventFormatAOD",
61  "SomeNotExistentKey",
62  ],
63  ),
64  CompFactory.xAODMaker.FileMetaDataTool(
65  "FileMetaDataTool",
66  OutputLevel=3,
67  ),
68  ],
69  )
70  )
71  acc.addEventAlgo(CompFactory.xAODMakerTest.EventFormatPrinterAlg())
72  acc.addEventAlgo(
73  CompFactory.xAODMakerTest.ACreatorAlg("ACreator", OutputKey="TestObject2")
74  )
75  acc.run(flags.Exec.MaxEvents)
76 
77 
78 if __name__ == "__main__":
79  sys.exit(main())
EventFormatTestConfig.EventFormatTestFlags
def EventFormatTestFlags(eventsPerFile=5, inputFiles=None)
Definition: EventFormatTestConfig.py:12
TestReadWriteEventFormat.main
def main()
Definition: TestReadWriteEventFormat.py:14
EventFormatTestConfig.EventFormatTestOutputCfg
def EventFormatTestOutputCfg(flags, streamName="Test", numberOfStreams=5, itemList=None)
Definition: EventFormatTestConfig.py:24
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.MetaDataSvcConfig.MetaDataSvcCfg
def MetaDataSvcCfg(flags, toolNames=[], tools=[])
Definition: MetaDataSvcConfig.py:6
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69