ATLAS Offline Software
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 
17 from AthenaConfiguration.AllConfigFlags import initConfigFlags
18 from AthenaConfiguration.ComponentFactory import CompFactory
19 from AthenaCommon.Constants import DEBUG
20 
21 outputStreamName = "ExampleCond"
22 outputFileName = "ROOTTREE:SimplePoolFile4.root"
23 noTag = True
24 
25 # Setup flags
26 flags = initConfigFlags()
27 flags.Input.Files = ["SimplePoolFile1.root"]
28 flags.addFlag(f"Output.{outputStreamName}FileName", outputFileName)
29 flags.Exec.MaxEvents = -1
30 flags.Common.MsgSuppression = False
31 flags.Exec.DebugMessageComponents = ["PoolSvc", "AthenaPoolCnvSvc","AthenaPoolAddressProviderSvc", "MetaDataSvc"]
32 flags.lock()
33 
34 # Main services
35 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
36 acc = MainServicesCfg( flags )
37 
38 from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleReadCfg, AthenaPoolExampleWriteCfg
39 acc.merge( AthenaPoolExampleReadCfg(flags, readCatalogs = ["file:Catalog1.xml"]) )
40 acc.merge( AthenaPoolExampleWriteCfg(flags, outputStreamName,
41  writeCatalog = "file:Catalog1.xml",
42  disableEventTag = noTag) )
43 
44 # Creata and attach the algorithms
45 acc.addEventAlgo( CompFactory.AthPoolEx.ReadData("ReadData", OutputLevel = DEBUG) )
46 acc.addEventAlgo( CompFactory.AthPoolEx.WriteCond("WriteCond",
47  DetStore = acc.getService("DetectorStore"),
48  ConditionName = "PedestalWriteData",
49  Weight = 0.0, Offset = 0.0,
50  OutputLevel = DEBUG) )
51 
52 from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
53 acc.merge( OutputConditionsAlgCfg(flags, outputStreamName, outputFile = outputFileName,
54  ObjectList = ["ExampleHitContainer#PedestalWriteData"],
55  WriteIOV = False,
56  OutputLevel = DEBUG
57  ) )
58 
59 # Run
60 import sys
61 sc = acc.run(flags.Exec.MaxEvents)
62 sys.exit(sc.isFailure())
63 
64 
65 
66 
67 
68 
AthenaPoolExampleConfig.AthenaPoolExampleWriteCfg
def AthenaPoolExampleWriteCfg(flags, outputStreamName, writeCatalog=None, disableEventTag=True)
Definition: AthenaPoolExampleConfig.py:40
OutputConditionsAlgConfig.OutputConditionsAlgCfg
def OutputConditionsAlgCfg(flags, name="OutputConditionsAlg", outputFile='condobjs.root', **kwargs)
Definition: OutputConditionsAlgConfig.py:5
AthenaPoolExampleConfig.AthenaPoolExampleReadCfg
def AthenaPoolExampleReadCfg(flags, readCatalogs=[])
Definition: AthenaPoolExampleConfig.py:6
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