ATLAS Offline Software
AthenaPoolExample_WriteMeta.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 
13 
14 from AthenaConfiguration.AllConfigFlags import initConfigFlags
15 from AthenaConfiguration.ComponentFactory import CompFactory
16 from AthenaCommon.Constants import DEBUG
17 
18 outputFileName = "ROOTTREE:SimplePoolFile5.root"
19 outputStreamName = "ExampleMeta"
20 noTag = True
21 
22 # Setup flags
23 flags = initConfigFlags()
24 flags.Input.Files = []
25 flags.addFlag(f"Output.{outputStreamName}FileName", outputFileName)
26 flags.Exec.MaxEvents = 10
27 flags.Common.MsgSuppression = False
28 flags.Exec.DebugMessageComponents = ["PoolSvc", "AthenaPoolCnvSvc","AthenaPoolAddressProviderSvc", "MetaDataSvc"]
29 flags.lock()
30 
31 # Main services
32 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
33 acc = MainServicesCfg( flags )
34 
35 from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleWriteCfg
36 acc.merge( AthenaPoolExampleWriteCfg( flags, outputStreamName,
37  writeCatalog = "file:Catalog2.xml",
38  disableEventTag = noTag ) )
39 
40 # Creata and attach the algorithms
41 acc.addEventAlgo( CompFactory.AthPoolEx.WriteData("WriteData", OutputLevel = DEBUG) )
42 acc.addEventAlgo( CompFactory.AthPoolEx.WriteCond("WriteCond",
43  DetStore = acc.getService("MetaDataStore"),
44  ConditionName = "PedestalWriteData",
45  OutputLevel = DEBUG) )
46 
47 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
48 acc.merge( OutputStreamCfg( flags, outputStreamName, disableEventTag = noTag,
49  ItemList = ["EventInfo#*", "ExampleHitContainer#MyHits"],
50  MetadataItemList = ["ExampleHitContainer#PedestalWriteData"],
51  ) )
52 
53 # Run
54 import sys
55 sc = acc.run(flags.Exec.MaxEvents)
56 sys.exit(sc.isFailure())
57 
58 
59 
60 
61 
62 
AthenaPoolExampleConfig.AthenaPoolExampleWriteCfg
def AthenaPoolExampleWriteCfg(flags, outputStreamName, writeCatalog=None, disableEventTag=True)
Definition: AthenaPoolExampleConfig.py:40
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:260
Constants
some useful constants -------------------------------------------------—
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19