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