ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolExample_WriteCond.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
16
17from AthenaConfiguration.AllConfigFlags import initConfigFlags
18from AthenaConfiguration.ComponentFactory import CompFactory
19from AthenaCommon.Constants import DEBUG
20
21outputStreamName = "ExampleCond"
22outputFileName = "ROOTTREE:SimplePoolFile4.root"
23noTag = True
24
25# Setup flags
26flags = initConfigFlags()
27flags.Input.Files = ["SimplePoolFile1.root"]
28flags.addFlag(f"Output.{outputStreamName}FileName", outputFileName)
29flags.Exec.MaxEvents = -1
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 AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleReadCfg, AthenaPoolExampleWriteCfg
39acc.merge( AthenaPoolExampleReadCfg(flags, readCatalogs = ["file:Catalog1.xml"]) )
40acc.merge( AthenaPoolExampleWriteCfg(flags, outputStreamName,
41 writeCatalog = "file:Catalog1.xml",
42 disableEventTag = noTag) )
43
44# Creata and attach the algorithms
45acc.addEventAlgo( CompFactory.AthPoolEx.ReadData("ReadData", OutputLevel = DEBUG) )
46acc.addEventAlgo( CompFactory.AthPoolEx.WriteCond("WriteCond",
47 DetStore = acc.getService("DetectorStore"),
48 ConditionName = "PedestalWriteData",
49 Weight = 0.0, Offset = 0.0,
50 OutputLevel = DEBUG) )
51
52from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
53acc.merge( OutputConditionsAlgCfg(flags, outputStreamName, outputFile = outputFileName,
54 ObjectList = ["ExampleHitContainer#PedestalWriteData"],
55 WriteIOV = False,
56 OutputLevel = DEBUG
57 ) )
58
59# Run
60import sys
61sc = acc.run(flags.Exec.MaxEvents)
62sys.exit(sc.isFailure())
63
64
65
66
67
68