ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolExample_Concat.py
Go to the documentation of this file.
1#!/env/python
2
3# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4
5
7
8import os
9os.system ('rm -f SimplePoolFile[13].root')
10
11from AthenaConfiguration.AllConfigFlags import initConfigFlags
12from AthenaConfiguration.ComponentFactory import CompFactory
13from AthenaCommon.Constants import DEBUG
14from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg, outputStreamName
15
16stream1name = "Stream1"
17file1Name = "SimplePoolFile1.root"
18stream2name = "Stream2"
19file2Name = "SimplePoolFile3.root"
20outSequence = 'AthOutSeq'
21noTag = True
22
23# Setup flags
24flags = initConfigFlags()
25flags.Input.Files = []
26flags.addFlag(f"Output.{stream1name}FileName", file1Name)
27flags.addFlag(f"Output.{stream2name}FileName", file2Name)
28flags.Common.MsgSuppression = False
29flags.Exec.MaxEvents = 20
30flags.Exec.DebugMessageComponents = [outputStreamName(stream1name), outputStreamName(stream2name),
31 "PoolSvc", "AthenaPoolCnvSvc", "WriteData", "ReWriteData"]
32flags.lock()
33
34# Main services
35from AthenaConfiguration.MainServicesConfig import MainServicesCfg
36acc = MainServicesCfg( flags )
37
38from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
39acc.merge( EventInfoCnvAlgCfg( flags, disableBeamSpot=True ) )
40
41acc.addEventAlgo( CompFactory.AthPoolEx.WriteData("WriteData", OutputLevel = DEBUG) )
42acc.addEventAlgo( CompFactory.AthPoolEx.ReWriteData("ReWriteData", OutputLevel = DEBUG) )
43
44# Pool writing
45# ---------------- Output Stream 1 configuration
46from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleWriteCfg
47acc.merge( AthenaPoolExampleWriteCfg(flags, stream1name, writeCatalog = "file:Catalog1.xml",
48 disableEventTag = noTag) )
49
50acc.merge( OutputStreamCfg(flags, stream1name, disableEventTag = noTag,
51 ItemList = ['EventInfo#*', 'ExampleHitContainer#My*']
52 ) )
53
54acc.addEventAlgo(
55 CompFactory.MakeInputDataHeader(
56 "MakeInputDH", StreamName = outputStreamName(stream1name), OutputLevel = DEBUG ),
57 sequenceName = outSequence )
58
59# ---------------- Output Stream 2 configuration
60acc.merge( AthenaPoolExampleWriteCfg(flags, stream2name, disableEventTag = noTag) )
61acc.merge( OutputStreamCfg(flags, stream2name, disableEventTag = noTag,
62 ItemList = ['EventInfo#*', 'ExampleTrackContainer#*Trackss']
63 ) )
64
65# Run
66import sys
67sc = acc.run(flags.Exec.MaxEvents)
68sys.exit(sc.isFailure())
69
70
71
72
73
74