ATLAS Offline Software
Loading...
Searching...
No Matches
TestWriteEventFormat.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2import sys
3from AthenaConfiguration.ComponentFactory import CompFactory
4from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
5from xAODEventFormatCnv.EventFormatTestConfig import (
6 EventFormatTestFlags,
7 EventFormatTestOutputCfg,
8)
9from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
10
11
12def main():
13 numberOfStreams = 5
14 streamName = "Test"
15 flags = EventFormatTestFlags(eventsPerFile=5)
16 for i in range(numberOfStreams):
17 flags.addFlag(
18 f"Output.{streamName}{i}FileName",
19 f"{streamName}{i}.pool.root",
20 )
21 flags.addFlag(f"Output.doWrite{streamName}{i}", True)
22
23 flags.fillFromArgs()
24 flags.lock()
25
26 acc = EventFormatTestOutputCfg(
27 flags,
28 itemList=[
29 "xAODMakerTest::AVec#TestObject",
30 "xAODMakerTest::AAuxContainer#TestObjectAux.",
31 "xAOD::EventInfo#EventInfo",
32 "xAOD::EventAuxInfo#EventInfoAux.",
33 ],
34 )
35 acc.addEventAlgo(
36 CompFactory.xAODMakerTest.ACreatorAlg("ACreator", OutputKey="TestObject"),
37 sequenceName="AthAlgSeq",
38 )
39 acc.merge(EventInfoCnvAlgCfg(flags, disableBeamSpot=True))
40 acc.merge(
41 MetaDataSvcCfg(
42 flags,
43 toolNames=[
44 "xAODMaker::EventFormatMetaDataTool",
45 "xAODMaker::FileMetaDataTool",
46 ],
47 )
48 )
49 acc.run(flags.Exec.MaxEvents)
50
51
52if __name__ == "__main__":
53 sys.exit(main())