From 8343ee953b0c17cc3958ab4339d86d11097ae12f Mon Sep 17 00:00:00 2001
From: TJ Khoo <khoo@cern.ch>
Date: Thu, 22 Nov 2018 19:16:11 +0100
Subject: [PATCH] Set up xAOD output stream formatting   * Recognise "xAOD"
 stream type as needing some additional components     and set these up.   *
 This requires merging some property info in AthenaPoolCnvSvc that     is set
 up by the PoolReadCfg module, so this property is added     to
 UnifyProperties.py.

---
 .../python/UnifyProperties.py                 |  1 +
 .../python/OutputStreamConfig.py              | 20 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/Control/AthenaConfiguration/python/UnifyProperties.py b/Control/AthenaConfiguration/python/UnifyProperties.py
index a3c289bf875..e5bf140c7ce 100644
--- a/Control/AthenaConfiguration/python/UnifyProperties.py
+++ b/Control/AthenaConfiguration/python/UnifyProperties.py
@@ -41,6 +41,7 @@ _propsToUnify={"GeoModelSvc.DetectorTools":unifySet,
                "ProxyProviderSvc.ProviderNames":unifySet,
                "TagInfoMgr.ExtraTagValuePairs":unifySetOfPairs,
                "AthenaOutputStream.ItemList":unifySet,
+               "AthenaPoolCnvSvc.PoolAttributes":unifySet
                }
 
 
diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py b/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py
index 64d8fcaf38d..84ee1b4cee0 100644
--- a/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py
+++ b/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py
@@ -37,6 +37,26 @@ def OutputStreamCfg(configFlags, streamName, ItemList=[] ):
    #outputStream.MetadataStore = svcMgr.MetaDataStore
    #outputStream.MetadataItemList = [ "EventStreamInfo#" + streamName, "IOVMetaDataContainer#*" ]
 
+   # For xAOD output
+   if streamName=="xAOD":
+      from xAODEventFormatCnv.xAODEventFormatCnvConf import xAODMaker__EventFormatSvc
+      # Simplifies naming 
+      result.addService(xAODMaker__EventFormatSvc())
+      outputStream.MetadataItemList.append( "xAOD::EventFormat#EventFormat" )
+
+      from xAODMetaDataCnv.xAODMetaDataCnvConf import xAODMaker__FileMetaDataMarkUpTool
+      streamMarkUpTool = xAODMaker__FileMetaDataMarkUpTool( streamName + "_FileMetaDataMarkUpTool" )
+      streamMarkUpTool.Key = streamName
+      outputStream.HelperTools += [ streamMarkUpTool ]
+      outputStream.WritingTool.SubLevelBranchName = "<key>"
+
+      from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc
+      poolcnvsvc = AthenaPoolCnvSvc()
+      result.addService(poolcnvsvc)
+      poolcnvsvc.PoolAttributes += [ "DatabaseName = '" + fileName + "'; COMPRESSION_LEVEL = '5'" ]
+      poolcnvsvc.PoolAttributes += [ "DatabaseName = '" + fileName + "'; ContainerName = 'TTree=CollectionTree'; TREE_AUTO_FLUSH = '-10000000'" ]
+      poolcnvsvc.PoolAttributes += [ "DatabaseName = '" + fileName + "'; ContainerName = 'TTree=CollectionTree'; CONTAINER_SPLITLEVEL = '1'" ]
+      poolcnvsvc.PoolAttributes += [ "DatabaseName = '" + fileName + "'; ContainerName = 'TTree=Aux.'; CONTAINER_SPLITLEVEL = '1'"]
 
    result.addEventAlgo(outputStream)
    return result
-- 
GitLab