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