From 88917f97322db63722f527d1a1bb2cb271290542 Mon Sep 17 00:00:00 2001
From: Tadej Novak <tadej.novak@cern.ch>
Date: Wed, 10 Apr 2019 14:44:26 +0200
Subject: [PATCH] Handle cases with multiple xAOD::EventInfos when creating
 output

---
 .../OutputStreamAthenaPool/python/OutputStreamConfig.py        | 2 +-
 .../OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx         | 3 ++-
 .../OutputStreamAthenaPool/src/MakeEventStreamInfo.h           | 3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py b/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py
index 23965b7bff6..604906579b1 100644
--- a/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py
+++ b/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py
@@ -30,7 +30,7 @@ def OutputStreamCfg(configFlags, streamName, ItemList=[] ):
    outputStream = AthenaOutputStream(
       outputAlgName,
       WritingTool = writingTool,
-      ItemList    = [ "xAOD::EventInfo#*", "xAOD::EventAuxInfo#*"  ]+ItemList, 
+      ItemList    = [ "xAOD::EventInfo#EventInfo", "xAOD::EventAuxInfo#EventInfoAux."  ]+ItemList, 
       OutputFile = fileName,
       HelperTools = [ streamInfoTool ],
       )
diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx b/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx
index d2f85fdaa37..33eb966c9f3 100644
--- a/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx
+++ b/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx
@@ -32,6 +32,7 @@ MakeEventStreamInfo::MakeEventStreamInfo(const std::string& type,
 
    // Declare the properties
    declareProperty("Key", m_key = "");
+   declareProperty("EventInfoKey", m_eventInfoKey = "EventInfo");
 }
 //___________________________________________________________________________
 MakeEventStreamInfo::~MakeEventStreamInfo() {
@@ -99,7 +100,7 @@ StatusCode MakeEventStreamInfo::postExecute() {
       lumiN = pEvent->event_ID()->lumi_block();
       evtype = *pEvent->event_type();
    } else {
-      const xAOD::EventInfo* xEvent = m_eventStore->tryConstRetrieve<xAOD::EventInfo>();
+      const xAOD::EventInfo* xEvent = m_eventStore->tryConstRetrieve<xAOD::EventInfo>(m_eventInfoKey);
       if( xEvent ) {
          runN = xEvent->runNumber();
          lumiN = xEvent->lumiBlock();
diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.h b/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.h
index cc75b0c1397..b98e148117c 100644
--- a/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.h
+++ b/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.h
@@ -47,6 +47,9 @@ private:
    /// Key, the StoreGate key for the EventStreamInfo object.
    StringProperty m_key;
 
+   /// Key, the StoreGate key for the xAOD::EventInfo object.
+   StringProperty m_eventInfoKey;
+
    /// Pointer to the data stores
    ServiceHandle<StoreGateSvc> m_metaDataStore;
    ServiceHandle<StoreGateSvc> m_eventStore;
-- 
GitLab