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