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 from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
36 acc.merge( EventInfoCnvAlgCfg( flags, disableBeamSpot=True ) )
37 
38 acc.addEventAlgo( CompFactory.AthPoolEx.WriteData("WriteData", OutputLevel = DEBUG) )
39 acc.addEventAlgo( CompFactory.AthPoolEx.ReWriteData("ReWriteData", OutputLevel = DEBUG) )
40 
41 # Pool writing
42 # ---------------- Output Stream 1 configuration
43 from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleWriteCfg
44 acc.merge( AthenaPoolExampleWriteCfg(flags, stream1name, writeCatalog = "file:Catalog1.xml",
45  disableEventTag = noTag) )
46 
47 acc.merge( OutputStreamCfg(flags, stream1name, disableEventTag = noTag,
48  ItemList = ['EventInfo#*', 'ExampleHitContainer#My*']
49  ) )
50 
51 acc.addEventAlgo(
52  CompFactory.MakeInputDataHeader(
53  "MakeInputDH", StreamName = outputStreamName(stream1name), OutputLevel = DEBUG ),
54  sequenceName = outSequence )
55 
56 # ---------------- Output Stream 2 configuration
57 acc.merge( AthenaPoolExampleWriteCfg(flags, stream2name, disableEventTag = noTag) )
58 acc.merge( OutputStreamCfg(flags, stream2name, disableEventTag = noTag,
59  ItemList = ['EventInfo#*', 'ExampleTrackContainer#*Trackss']
60  ) )
61 
62 # Run
63 import sys
64 sc = acc.run(flags.Exec.MaxEvents)
65 sys.exit(sc.isFailure())
66 
67 
68 
69 
70 
71 
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=None, MetadataItemList=None, disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, keepProvenanceTagsRegEx=None, AcceptAlgs=None, HelperTools=None)
Definition: OutputStreamConfig.py:13
AthenaPoolExample_WriteCond.outputStreamName
string outputStreamName
Definition: AthenaPoolExample_WriteCond.py:21
AthenaPoolExampleConfig.AthenaPoolExampleWriteCfg
def AthenaPoolExampleWriteCfg(flags, outputStreamName, writeCatalog=None, disableEventTag=True)
Definition: AthenaPoolExampleConfig.py:40
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
Constants
some useful constants -------------------------------------------------—
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11