ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolExample_WriteMeta.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
13
14import os
15os.system ('rm -f Catalog2.xml')
16
17from AthenaConfiguration.AllConfigFlags import initConfigFlags
18from AthenaConfiguration.ComponentFactory import CompFactory
19from AthenaCommon.Constants import DEBUG
20
21outputFileName = "ROOTTREE:SimplePoolFile5.root"
22outputStreamName = "ExampleMeta"
23noTag = True
24
25# Setup flags
26flags = initConfigFlags()
27flags.Input.Files = []
28flags.addFlag(f"Output.{outputStreamName}FileName", outputFileName)
29flags.Exec.MaxEvents = 10
30flags.Common.MsgSuppression = False
31flags.Exec.DebugMessageComponents = ["PoolSvc", "AthenaPoolCnvSvc","AthenaPoolAddressProviderSvc", "MetaDataSvc"]
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
41from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleWriteCfg
42acc.merge( AthenaPoolExampleWriteCfg( flags, outputStreamName,
43 writeCatalog = "file:Catalog2.xml",
44 disableEventTag = noTag ) )
45
46# Creata and attach the algorithms
47acc.addEventAlgo( CompFactory.AthPoolEx.WriteData("WriteData", OutputLevel = DEBUG) )
48acc.addEventAlgo( CompFactory.AthPoolEx.WriteCond("WriteCond",
49 DetStore = acc.getService("MetaDataStore"),
50 ConditionName = "PedestalWriteData",
51 OutputLevel = DEBUG) )
52
53from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
54acc.merge( OutputStreamCfg( flags, outputStreamName, disableEventTag = noTag,
55 ItemList = ["EventInfo#*", "ExampleHitContainer#MyHits"],
56 MetadataItemList = ["ExampleHitContainer#PedestalWriteData"],
57 ) )
58
59# Run
60import sys
61sc = acc.run(flags.Exec.MaxEvents)
62sys.exit(sc.isFailure())
63
64
65
66
67
68