From 0be0dd1a98c2e091004f23fc22610f16269379e8 Mon Sep 17 00:00:00 2001 From: Walter Lampl <walter.lampl@cern.ch> Date: Tue, 30 Oct 2018 11:13:59 +0000 Subject: [PATCH] Prototype of output configuration with ComponentAccumulator --- .../CaloRec/python/CaloTopoClusterConfig.py | 28 ++++++++---- .../python/AllConfigFlags.py | 9 +++- .../python/UnifyProperties.py | 1 + .../python/OutputStreamConfig.py | 43 +++++++++++++++++++ 4 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py diff --git a/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py b/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py index ea98ef8a097..20f9aec6e03 100644 --- a/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py +++ b/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py @@ -112,21 +112,33 @@ if __name__=="__main__": ConfigFlags.Input.isMC = False ConfigFlags.Input.Files = ["myESD.pool.root"] + ConfigFlags.Output.ESDFileName="esdOut.pool.root" ConfigFlags.lock() - cfg=ComponentAccumulator() - + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + #cfg=ComponentAccumulator() + cfg=MainServicesSerialCfg() cfg.merge(PoolReadCfg(ConfigFlags)) + theKey="CaloCalTopoClustersNew" + topoAcc,topoAlg=CaloTopoClusterCfg(ConfigFlags) - topoAlg.ClustersOutputName="CaloCalTopoClustersNew" + topoAlg.ClustersOutputName=theKey cfg.merge(topoAcc) - cfg.addEventAlgo(topoAlg) - + cfg.addEventAlgo(topoAlg,sequenceName="AthAlgSeq") + + from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + cfg.merge(OutputStreamCfg(ConfigFlags,"ESD", ItemList=["xAOD::CaloClusterContainer#"+theKey, + "xAOD::CaloClusterAuxContainer#"+theKey+"Aux.", + "CaloClusterCellLinkContainer#"+theKey+"_links"])) + + + cfg.getService("StoreGateSvc").Dump=True - f=open("CaloTopoCluster.pkl","w") - cfg.store(f) - f.close() + cfg.run() + #f=open("CaloTopoCluster.pkl","w") + #cfg.store(f) + #f.close() diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py index 940a9f1b1da..dfc51a02bef 100644 --- a/Control/AthenaConfiguration/python/AllConfigFlags.py +++ b/Control/AthenaConfiguration/python/AllConfigFlags.py @@ -27,8 +27,13 @@ def _createCfgFlags(): acf.addFlag('Output.doESD', False) # produce ESD containers - acf.addFlag('Output.writeESD', False) # configure ESD output writing - + + acf.addFlag('Output.HITFileName','myHIT.pool.root') + acf.addFlag('Output.RDOFileName','myROD.pool.root') + acf.addFlag('Output.ESDFileName','myESD.pool.root') + acf.addFlag('Output.AODFileName','myAOD.pool.root') + + #Geo Model Flags: acf.addFlag('GeoModel.Layout', 'atlas') # replaces global.GeoLayout acf.addFlag("GeoModel.AtlasVersion", lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("Geometry","ATLAS-R2-2016-01-00-01")) # diff --git a/Control/AthenaConfiguration/python/UnifyProperties.py b/Control/AthenaConfiguration/python/UnifyProperties.py index 35e8f5508ea..a3c289bf875 100644 --- a/Control/AthenaConfiguration/python/UnifyProperties.py +++ b/Control/AthenaConfiguration/python/UnifyProperties.py @@ -40,6 +40,7 @@ _propsToUnify={"GeoModelSvc.DetectorTools":unifySet, "PoolSvc.ReadCatalog":unifySet, "ProxyProviderSvc.ProviderNames":unifySet, "TagInfoMgr.ExtraTagValuePairs":unifySetOfPairs, + "AthenaOutputStream.ItemList":unifySet, } diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py b/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py new file mode 100644 index 00000000000..64d8fcaf38d --- /dev/null +++ b/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py @@ -0,0 +1,43 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator, ConfigurationError +from AthenaCommon.Logging import logging + +def OutputStreamCfg(configFlags, streamName, ItemList=[] ): + from OutputStreamAthenaPoolConf import MakeEventStreamInfo + from AthenaServices.AthenaServicesConf import AthenaOutputStream + from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool + + flagName="Output.%sFileName" % streamName + if configFlags.hasFlag(flagName): + fileName=configFlags._get(flagName) + else: + fileName="my%s.pool.root" % streamName + msg = logging.getLogger('OutputStreamCfg') + msg.info("No file name predefined for stream %s. Using %s" % (streamName, fileName)) + + if fileName in configFlags.Input.Files: + raise ConfigurationError("Same name for input and output file %s" % fileName) + + + outputAlgName="OutputStream"+streamName + + result=ComponentAccumulator(sequenceName="AthOutSeq") + # define athena output stream + writingTool = AthenaOutputStreamTool( streamName + "Tool" ) + streamInfoTool = MakeEventStreamInfo( streamName + "_MakeEventStreamInfo" ) + streamInfoTool.Key = streamName + outputStream = AthenaOutputStream( + outputAlgName, + WritingTool = writingTool, + ItemList = [ "xAOD::EventInfo#*" ]+ItemList, + OutputFile = fileName, + HelperTools = [ streamInfoTool ], + ) + #outputStream.MetadataStore = svcMgr.MetaDataStore + #outputStream.MetadataItemList = [ "EventStreamInfo#" + streamName, "IOVMetaDataContainer#*" ] + + + result.addEventAlgo(outputStream) + return result + -- GitLab