From 1a38b5d7b3d5f8adfae2a5c42338cce48c9f8a64 Mon Sep 17 00:00:00 2001
From: Peter Van Gemmeren <peter.van.gemmeren@cern.ch>
Date: Wed, 1 Apr 2020 13:25:11 +0000
Subject: [PATCH] Athena meta data hide input store and remove TAG navigation
 for ByteStream

---
 .../src/MakeEventStreamInfo.cxx               |   6 +-
 .../IByteStreamSingleEventInputSvc.h          |  57 -----
 .../python/ReadByteStreamTag.py               |  41 ----
 .../share/BSNavigationProvider_jobOptions.py  |  35 ---
 .../src/ByteStreamNavigationProviderSvc.cxx   | 207 -----------------
 .../src/ByteStreamNavigationProviderSvc.h     |  78 -------
 .../src/ByteStreamSingleEventInputSvc.cxx     | 215 ------------------
 .../src/ByteStreamSingleEventInputSvc.h       |  58 -----
 .../components/ByteStreamCnvSvc_entries.cxx   |   4 -
 .../src/RPC_RawDataProviderTool.cxx           |   5 -
 .../EventTagUtils/RegistrationStreamTrig.h    |   3 +-
 .../src/RegistrationStreamTrig.cxx            |   9 +-
 .../RecExCommission/share/Collisions_ATN.py   |   3 -
 .../share/RecExCommon_topOptions.py           |  50 +---
 14 files changed, 11 insertions(+), 760 deletions(-)
 delete mode 100644 Event/ByteStreamCnvSvc/ByteStreamCnvSvc/IByteStreamSingleEventInputSvc.h
 delete mode 100644 Event/ByteStreamCnvSvc/python/ReadByteStreamTag.py
 delete mode 100644 Event/ByteStreamCnvSvc/share/BSNavigationProvider_jobOptions.py
 delete mode 100644 Event/ByteStreamCnvSvc/src/ByteStreamNavigationProviderSvc.cxx
 delete mode 100644 Event/ByteStreamCnvSvc/src/ByteStreamNavigationProviderSvc.h
 delete mode 100644 Event/ByteStreamCnvSvc/src/ByteStreamSingleEventInputSvc.cxx
 delete mode 100644 Event/ByteStreamCnvSvc/src/ByteStreamSingleEventInputSvc.h

diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx b/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx
index 06db1927fef..f6220d92acb 100644
--- a/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx
+++ b/Database/AthenaPOOL/OutputStreamAthenaPool/src/MakeEventStreamInfo.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /** @file MakeEventStreamInfo.cxx
@@ -41,7 +41,7 @@ MakeEventStreamInfo::~MakeEventStreamInfo() {
 //___________________________________________________________________________
 StatusCode MakeEventStreamInfo::initialize() {
    ATH_MSG_INFO("Initializing " << name() << " - package version " << PACKAGE_VERSION);
-   // Locate the MetaDataStore and InputMetaDataStore
+   // Locate the MetaDataStore
    if (!m_metaDataStore.retrieve().isSuccess()) {
       ATH_MSG_FATAL("Could not find MetaDataStore");
       return(StatusCode::FAILURE);
@@ -142,7 +142,7 @@ StatusCode MakeEventStreamInfo::preFinalize() {
 //___________________________________________________________________________
 StatusCode MakeEventStreamInfo::finalize() {
    ATH_MSG_DEBUG("in finalize()");
-   // release the MetaDataStore and InputMetaDataStore
+   // release the MetaDataStore
    if (!m_metaDataStore.release().isSuccess()) {
       ATH_MSG_WARNING("Could not release MetaDataStore");
    }
diff --git a/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/IByteStreamSingleEventInputSvc.h b/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/IByteStreamSingleEventInputSvc.h
deleted file mode 100644
index 70b573792be..00000000000
--- a/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/IByteStreamSingleEventInputSvc.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef BYTESTREAMCNVSVC_IBYTESTREAMSINGLEEVENTINPUTSVC_H
-#define BYTESTREAMCNVSVC_IBYTESTREAMSINGLEEVENTINPUTSVC_H
-
-/**
-   @class     IByteStreamSingleEventInputSvc
-   @brief     Interface read a single event from ByteStream file given
-              a file name and event position in that file
-
-   @author:      Sergey Panitkin
-*/
-
-// FrameWork includes
-//#include "GaudiKernel/IService.h"
-#include "GaudiKernel/IInterface.h"
-
-#include <string>
-
-// Raw event definition here
-#include "ByteStreamData/RawEvent.h"
-
-
-/// Declaration of the interface ID ( interface id, major version, minor version)
-static const InterfaceID IID_IByteStreamSingleEventInputSvc("IByteStreamSingleEventInputSvc",1,0);
-
-//Gaudi style interface to Athena
-
-class IByteStreamSingleEventInputSvc : virtual public IInterface
-{
-
- public:
-
-
-  virtual ~IByteStreamSingleEventInputSvc(){};
-  
-  /// Retrieve interface ID
-  static const InterfaceID& interfaceID();
-
- 
-  /// get event for a given filename and event position
-  virtual const RawEvent* getEvent(const std::string& filename, const long long pos)= 0 ;
-
- protected:
-  // /standard constructor
-    IByteStreamSingleEventInputSvc(){};
-  
-};
-
-inline const InterfaceID& IByteStreamSingleEventInputSvc::interfaceID()
-{
-  return IID_IByteStreamSingleEventInputSvc;
-}
-
-#endif
diff --git a/Event/ByteStreamCnvSvc/python/ReadByteStreamTag.py b/Event/ByteStreamCnvSvc/python/ReadByteStreamTag.py
deleted file mode 100644
index 026359231d6..00000000000
--- a/Event/ByteStreamCnvSvc/python/ReadByteStreamTag.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-###############################################################
-#
-# module for reading EventStorage BS input file.
-#==============================================================
-
-from AthenaCommon.AppMgr import theApp
-
-# get a handle on the ServiceManager
-svcMgr = theApp.serviceMgr()
-
-# Need Pool to read TAG in Pool format
-import AthenaPoolCnvSvc.ReadAthenaPool # noqa: F401
-
-# Services
-#from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ROBDataProviderSvc
-#svcMgr += ROBDataProviderSvc()
-
-# for EventType
-from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamCnvSvc
-svcMgr += ByteStreamCnvSvc()
-svcMgr.EventPersistencySvc.CnvServices += [ "ByteStreamCnvSvc" ]
-
-# ByteStreamAddressProviderSvc
-from ByteStreamCnvSvcBase. ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc
-svcMgr += ByteStreamAddressProviderSvc()
-ByteStreamAddressProviderSvc = svcMgr.ByteStreamAddressProviderSvc
-
-# specific for tag
-from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamNavigationProviderSvc
-svcMgr += ByteStreamNavigationProviderSvc( "ByteStreamNavigationProviderSvc" )
-svcMgr.ProxyProviderSvc.ProviderNames += [ "ByteStreamNavigationProviderSvc" ]
-
-# Basic metadata
-svcMgr.MetaDataSvc.MetaDataTools += [ "ByteStreamMetadataTool" ]
-
-# User metadata in FMD
-from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamAttListMetadataSvc
-svcMgr += ByteStreamAttListMetadataSvc("ByteStreamAttListMetadataSvc")
-
diff --git a/Event/ByteStreamCnvSvc/share/BSNavigationProvider_jobOptions.py b/Event/ByteStreamCnvSvc/share/BSNavigationProvider_jobOptions.py
deleted file mode 100644
index 1fe4c65e086..00000000000
--- a/Event/ByteStreamCnvSvc/share/BSNavigationProvider_jobOptions.py
+++ /dev/null
@@ -1,35 +0,0 @@
-###############################################################
-#
-# Job options file for navigating to BS input file.
-#==============================================================
-
-"""
- -+- 19 330 A           svcMgr.ProxyProviderSvc.ProviderNames += [ "ByteStreamNavigationProviderSvc" ]
- -+- 19 331
- -+- 19 332 A           EventPersistencySvc = svcMgr.EventPersistencySvc
- -+- 19 333 A           EventPersistencySvc.CnvServices += [ "ByteStreamCnvSvc" ]
- -+- 19 334 A           svcMgr += Service("ByteStreamCnvSvc")
-"""
-# get a handle on the ServiceManager
-svcMgr = theApp.serviceMgr()
-
-# Services
-
-# for EventType
-from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamCnvSvc
-svcMgr += ByteStreamCnvSvc()
-
-# Properties 
-EventPersistencySvc = svcMgr.EventPersistencySvc
-EventPersistencySvc.CnvServices += [ "ByteStreamCnvSvc" ]
-
-# ByteStreamNavigationProviderSvc
-from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamNavigationProviderSvc
-svcMgr += ByteStreamNavigationProviderSvc()
-ByteStreamNavigationProviderSvc = svcMgr.ByteStreamNavigationProviderSvc
-
-# proxy provider
-from SGComps.SGCompsConf import ProxyProviderSvc
-svcMgr += ProxyProviderSvc()
-ProxyProviderSvc = svcMgr.ProxyProviderSvc
-ProxyProviderSvc.ProviderNames += [ "ByteStreamNavigationProviderSvc" ]
diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamNavigationProviderSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamNavigationProviderSvc.cxx
deleted file mode 100644
index 2f886636596..00000000000
--- a/Event/ByteStreamCnvSvc/src/ByteStreamNavigationProviderSvc.cxx
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// Include files
-#include "ByteStreamNavigationProviderSvc.h"
-
-#include "ByteStreamCnvSvcBase/ByteStreamAddress.h"
-#include "ByteStreamCnvSvcBase/ByteStreamAddressProviderSvc.h"
-#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
-
-#include "ByteStreamCnvSvc/IByteStreamSingleEventInputSvc.h"
-
-#include "EventInfo/EventInfo.h"
-
-#include "StoreGate/StoreGate.h"
-#include "StoreGate/ActiveStoreSvc.h"
-#include "SGTools/TransientAddress.h"
-
-#include "PersistentDataModel/DataHeader.h"
-
-//------------------------------------------------------------------------------------
-/// Standard constructor
-ByteStreamNavigationProviderSvc::ByteStreamNavigationProviderSvc(const std::string& name, ISvcLocator* svc) :
-	::AthService(name, svc),
-        m_rawEvent(0),
-	m_activeStoreSvc("ActiveStoreSvc", name),
-	m_addressProvider(0),
-	m_singleEventInputSvc("ByteStreamSingleEventInputSvc", name),
-	m_robDataProviderSvc("ROBDataProviderSvc", name) {
-   declareProperty("TypeNames", m_typeNames);
-}
-
-//------------------------------------------------------------------------------------
-/// Standard Destructor
-ByteStreamNavigationProviderSvc::~ByteStreamNavigationProviderSvc() {}
-//------------------------------------------------------------------------------------
-/// Initialize the service.
-StatusCode ByteStreamNavigationProviderSvc::initialize() {
-   ATH_MSG_INFO("Initializing " << name() << " - package version " << PACKAGE_VERSION);
-   if (!::AthService::initialize().isSuccess()) {
-      ATH_MSG_FATAL("Cannot initialize AthService base class.");
-      return(StatusCode::FAILURE);
-   }
-
-   if (!m_singleEventInputSvc.retrieve().isSuccess()) {
-      ATH_MSG_FATAL("Cannot get ByteStreamSingleEventInputSvc");
-      return(StatusCode::FAILURE);
-   }
-   if (!m_robDataProviderSvc.retrieve().isSuccess()) {
-      ATH_MSG_FATAL("Cannot get ROBDataProviderSvc");
-      return(StatusCode::FAILURE);
-   }
-   IService *pIS(0);
-   StatusCode status = service("ByteStreamAddressProviderSvc", "ByteStreamAddressProviderSvc", pIS);
-   if (status != StatusCode::SUCCESS || 0 == (m_addressProvider = dynamic_cast<IAddressProvider*>(pIS))) {
-      ATH_MSG_FATAL("Cannot get ByteStreamAddressProviderSvc");
-      return(StatusCode::FAILURE);
-   }
-   return(StatusCode::SUCCESS);
-}
-//------------------------------------------------------------------------------------
-/// Finalize the service.
-StatusCode ByteStreamNavigationProviderSvc::finalize() {
-   if (!m_robDataProviderSvc.release().isSuccess()) {
-      ATH_MSG_WARNING("Cannot release ROBDataProviderSvc");
-   }
-   return(::AthService::finalize());
-}
-//------------------------------------------------------------------------------------
-StoreGateSvc* ByteStreamNavigationProviderSvc::eventStore() {
-   if (m_activeStoreSvc == 0) {
-      if (!m_activeStoreSvc.retrieve().isSuccess()) {
-         ATH_MSG_ERROR("Cannot get ActiveStoreSvc");
-         throw GaudiException("Cannot get ActiveStoreSvc", name(), StatusCode::FAILURE);
-      }
-   }
-   return m_activeStoreSvc->operator->();
-}
-//------------------------------------------------------------------------------------
-StatusCode ByteStreamNavigationProviderSvc::loadAddresses(StoreID::type storeId, tadList& tlist) {
-   if (storeId != StoreID::EVENT_STORE) {
-      return(StatusCode::SUCCESS);
-   }
-   // Read bytestream event
-   StatusCode sc_re = readEvent();
-   if (!sc_re.isSuccess()) {
-      if (sc_re.isRecoverable()) {
-         // Recoverable error if header(s) was not found. Keep going
-         ATH_MSG_DEBUG("loadAddress: Cannot get ByteStream header");
-         return(StatusCode::SUCCESS);
-      } else {
-         ATH_MSG_ERROR("loadAddress: Cannot get ByteStream event");
-         return(StatusCode::FAILURE);
-      }
-   }
-   // Set event address for ROBDataProviderService
-   m_robDataProviderSvc->setNextEvent(m_rawEvent);
-   // Create new transient address from iop
-   IOpaqueAddress* iop = new ByteStreamAddress(ClassID_traits<EventInfo>::ID(), "", "");
-   SG::TransientAddress* tad = new SG::TransientAddress(ClassID_traits<EventInfo>::ID(), "ByteStreamEventInfo", iop, true);
-   tlist.push_back(tad);
-   StatusCode sc_pLA = m_addressProvider->preLoadAddresses(storeId, tlist);
-   return(sc_pLA);
-}
-//------------------------------------------------------------------------------------
-StatusCode ByteStreamNavigationProviderSvc::updateAddress(StoreID::type storeId,
-                                                          SG::TransientAddress* tad,
-                                                          const EventContext& ctx) {
-   ATH_MSG_DEBUG("In updateAddress for: " << tad->clID() << " / " << tad->name());
-   if (storeId != StoreID::EVENT_STORE) {
-      return(StatusCode::FAILURE);
-   }
-   // Check if tad is DataHeader
-   if (tad->clID() == ClassID_traits<DataHeader>::ID()) {
-      ATH_MSG_DEBUG("pdateAddress: tad is DataHeader");
-      return(StatusCode::FAILURE);
-   }
-   // If there is no Bytestream event, read one in
-   if (m_rawEvent == 0) {
-      StatusCode sc_re = readEvent();
-      // Exit with failure on hard read event error
-      if (!sc_re.isSuccess()) {
-         ATH_MSG_DEBUG("updateAddress: Cannot get ByteStream event");
-         return(StatusCode::FAILURE);
-      }
-      // Set event address for ROBDataProviderService
-      m_robDataProviderSvc->setNextEvent(m_rawEvent);
-   }
-   // Do Update address like in ByteStreamAddressProviderSvc
-   StatusCode sc_dUA = m_addressProvider->updateAddress(storeId, tad, ctx);
-   return(sc_dUA);
-}
-//------------------------------------------------------------------------------------
-//
-// Read one Bytestream event
-// File name and event offset are encoded in a Header token
-// with TECH signature 1000
-//
-StatusCode ByteStreamNavigationProviderSvc::readEvent() {
-   SG::ConstIterator<DataHeader> dataHeader, dataHeaderLast;
-   // Get all headers
-   StatusCode status = eventStore()->retrieve(dataHeader, dataHeaderLast);
-   if (!status.isSuccess()) {
-      m_rawEvent = 0;
-      ATH_MSG_DEBUG("readEvent: Cannot find any DataHeader in StoreGate");
-      return(StatusCode::RECOVERABLE);
-   }
-   std::string file;
-   const Token* token = 0;
-   // Find a header which has a token with Bytestrean attributes (TECH=1000)
-   for (; dataHeader != dataHeaderLast; dataHeader++) {
-      if (dataHeader->begin()->getToken() != 0
-	      && dataHeader->begin()->getToken()->technology() == 0x00001000) {
-          // Key hold file name
-         file  = dataHeader->getProcessTag();
-         token = dataHeader->begin()->getToken();
-      } else if (token == 0 && dataHeader->isInput()) {
-         for (std::vector<DataHeaderElement>::const_iterator i = dataHeader->beginProvenance(),
-		         iEnd = dataHeader->endProvenance(); i != iEnd; i++) {
-            if (i->getToken() != 0 && i->getToken()->technology() == 0x00001000) {
-               token = i->getToken();
-            }
-         }
-      }
-   }
-   // If there is no such header then return
-   if (file.empty()) {
-      if (token == 0) {
-         //set pointer to BS event to null
-         m_rawEvent = 0;
-         ATH_MSG_DEBUG("readEvent: Cannot find BS DataHeader in StoreGate");
-         return(StatusCode::RECOVERABLE);
-      } else {
-         const DataHeader* dh = nullptr;
-         StatusCode status = eventStore()->retrieve(dh, token->toString());
-         if (!status.isSuccess()) {
-            m_rawEvent = 0;
-            ATH_MSG_DEBUG("readEvent: Cannot retrieve BS DataHeader from StoreGate");
-            return(StatusCode::RECOVERABLE);
-         }
-         file  = dh->getProcessTag();
-         token = dh->begin()->getToken();
-      }
-   }
-   if (token == 0) {
-      ATH_MSG_ERROR("readEvent: Cannot get RawEvent Token");
-      return(StatusCode::FAILURE);
-   }
-   // Get event offset from the token
-   long long int offset = token->oid().second; 
-   if (!token->contID().empty()) {
-      unsigned long long int cntID;
-      sscanf(token->contID().c_str(), "%08llX", &cntID);
-      offset += (long long int)(cntID<<32);
-   }
-   ATH_MSG_DEBUG("readEvent: File name    : " << file);
-   ATH_MSG_DEBUG("readEvent: Ev. Offset   : " << offset);
-   // read one event and return pointer to it
-   m_rawEvent = m_singleEventInputSvc->getEvent(file, offset);
-   // Check if something is wrong
-   if (m_rawEvent == 0) {
-      ATH_MSG_ERROR("readEvent: Cannot retrieve RawEvent");
-      return(StatusCode::FAILURE);
-   }
-   return(StatusCode::SUCCESS);
-}
diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamNavigationProviderSvc.h b/Event/ByteStreamCnvSvc/src/ByteStreamNavigationProviderSvc.h
deleted file mode 100644
index de863b6e745..00000000000
--- a/Event/ByteStreamCnvSvc/src/ByteStreamNavigationProviderSvc.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef BYTESTREAMNAVIGATIONPROVIDERSVC_H
-#define BYTESTREAMNAVIGATIONPROVIDERSVC_H
-
-/** @file ByteStreamNavigationProviderSvc.h
- *  @brief This file contains the class definition for the ByteStreamNavigationProviderSvc class.
- *  @author Peter van Gemmeren <gemmeren@anl.gov>
- **/
-
-#include "AthenaKernel/IAddressProvider.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "AthenaBaseComps/AthService.h"
-
-#include "ByteStreamData/RawEvent.h"
-
-#include <map>
-
-// Forward declarations
-class ActiveStoreSvc;
-class StoreGateSvc;
-class IByteStreamSingleEventInputSvc;
-class IROBDataProviderSvc;
-
-template <class TYPE> class SvcFactory;
-
-/** @class ByteStreamNavigationProviderSvc
- *  @brief This class implements IAddressProvider for ByteStream Back navigation.
- **/
-class ByteStreamNavigationProviderSvc : public ::AthService, public virtual IAddressProvider {
-
-   /// Allow the factory class access to the constructor
-   friend class SvcFactory<ByteStreamNavigationProviderSvc>;
-
-public:
-   ByteStreamNavigationProviderSvc(const std::string& name, ISvcLocator* svcloc);
-   virtual ~ByteStreamNavigationProviderSvc();
-
-   /// Service initialize
-   virtual StatusCode initialize();
-   /// Service finalize
-   virtual StatusCode finalize();
-
-   /// IAddressProvider interface.
-   /// Load the address
-   virtual StatusCode loadAddresses(StoreID::type id, tadList& tlist);
-
-   /// Update an existing transient Address
-   virtual StatusCode updateAddress(StoreID::type id,
-                                    SG::TransientAddress* tad,
-                                    const EventContext& ctx);
-
-private:
-   /// Return pointer to active event SG
-   StoreGateSvc* eventStore();
-
-   const RawEvent* m_rawEvent;
-
-   /// type and name of the objects to create the address for.
-   Gaudi::Property<std::vector<std::string>> m_typeNames;
-
-   typedef ServiceHandle<ActiveStoreSvc> ActiveStoreSvc_t;
-   ActiveStoreSvc_t m_activeStoreSvc;
-
-   typedef ServiceHandle<IAddressProvider> IAddressProvider_t;
-   //IAddressProvider_t m_addressProvider;
-   IAddressProvider* m_addressProvider;
-
-   ServiceHandle<IByteStreamSingleEventInputSvc> m_singleEventInputSvc;
-   ServiceHandle<IROBDataProviderSvc> m_robDataProviderSvc;
-
-   /// Read one BytestreamEvent
-   StatusCode readEvent();
-};
-
-#endif
diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamSingleEventInputSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamSingleEventInputSvc.cxx
deleted file mode 100644
index f91cb17eef1..00000000000
--- a/Event/ByteStreamCnvSvc/src/ByteStreamSingleEventInputSvc.cxx
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/** @file ByteStreamSingleEventInputSvc.cxx
- *  @brief This file contains the implementation for the ByteStreamSingleEventInputSvc class.
- *  @author Peter van Gemmeren <gemmeren@anl.gov>
- **/
-
-#include "ByteStreamSingleEventInputSvc.h"
-#include "DumpFrags.h"
-#include "ByteStreamData/ByteStreamMetadata.h"
-#include "EventStorage/pickDataReader.h"
-#include "EventStorage/EventStorageRecords.h"
-
-#include "GaudiKernel/GenericAddress.h"
-#include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/ISvcLocator.h"
-#include "GaudiKernel/IIncidentSvc.h"
-#include "GaudiKernel/FileIncident.h"
-
-#include <unistd.h>
-
-#include "eformat/HeaderMarker.h"
-#include "eformat/Version.h"
-#include "eformat/old/util.h"
-
-#include "StoreGate/StoreGateSvc.h"
-
-//----------------------------------------------------------------------------------------
-ByteStreamSingleEventInputSvc::ByteStreamSingleEventInputSvc(const std::string& name, ISvcLocator* svcloc) :
-	::AthService(name, svcloc),
-	m_re(0),
-	m_reader(0),
-	m_mdSvc("StoreGateSvc/InputMetaDataStore", name),
-	m_incidentSvc("IncidentSvc", name),
-	m_currentFilename() {
-   declareProperty("DumpFlag", m_dump = false);
-}
-//----------------------------------------------------------------------------------------
-ByteStreamSingleEventInputSvc::~ByteStreamSingleEventInputSvc() {
-   delete m_re; m_re = 0;
-   delete m_reader; m_reader = 0;
-}
-//----------------------------------------------------------------------------------------
-StatusCode ByteStreamSingleEventInputSvc::initialize() {
-   if (!::AthService::initialize().isSuccess()) {
-      ATH_MSG_FATAL("Cannot initialize AthService base class.");
-      return(StatusCode::FAILURE);
-   }
-   if (!m_incidentSvc.retrieve().isSuccess()) {
-      ATH_MSG_FATAL("Cannot get IncidentSvc.");
-      return(StatusCode::FAILURE);
-   }
-   if (!m_mdSvc.retrieve().isSuccess()) {
-      ATH_MSG_FATAL("Cannot get InputMetaDataStore.");
-      return(StatusCode::FAILURE);
-   }
-   return(StatusCode::SUCCESS);
-}
-//________________________________________________________________________________
-StatusCode ByteStreamSingleEventInputSvc::stop() {
-   return(StatusCode::SUCCESS);
-}
-//----------------------------------------------------------------------------------------
-StatusCode ByteStreamSingleEventInputSvc::finalize() {
-   if (!m_mdSvc.release().isSuccess()) {
-      ATH_MSG_WARNING("Cannot release InputMetaDataStore.");
-   }
-   if (!m_incidentSvc.release().isSuccess()) {
-      ATH_MSG_WARNING("Cannot release IncidentSvc.");
-   }
-   return(::AthService::finalize());
-}
-//----------------------------------------------------------------------------------------
-const RawEvent* ByteStreamSingleEventInputSvc::getEvent(const std::string& filename, const long long pos) {
-   // Some sanity check here. Is the filename empty?
-   if (filename.empty()) {
-      ATH_MSG_ERROR("ByteStreamSingleEventInputSvc: Empty filename recieved for ByteStream " << filename);
-      return(0);
-   }
-   // Check if the file with given name is already opened
-   if (filename != m_currentFilename) {
-      if (!m_currentFilename.empty()) {
-         FileIncident endInputFileIncident(name(), "EndInputFile", "FID:" + m_reader->GUID(), m_reader->GUID());
-         m_incidentSvc->fireIncident(endInputFileIncident);
-      }
-      if (!m_mdSvc->clearStore().isSuccess()) {
-         ATH_MSG_WARNING("Unable to clear Input MetaData Proxies");
-      }
-      // Delete old reader if exists
-      delete m_reader; m_reader = 0;
-      // Pick up new reader
-      m_reader = pickDataReader(filename);
-      // Check if reader pick up was successful. Sanity check mostly.
-      if (m_reader == 0){
-         ATH_MSG_ERROR("Cannot pick up valid reader for the file : " << filename);
-         return(0);
-      }
-      if (m_currentFilename.empty()) {
-         FileIncident firstInputFileIncident(name(), "FirstInputFile", "BSF:" + m_reader->GUID(), m_reader->GUID());
-         m_incidentSvc->fireIncident(firstInputFileIncident);
-      }
-      // Double check of a sort here. Interrogate reader for a file name.
-      // Remove later for efficiency and use  just filename?
-      ATH_MSG_DEBUG("Picked valid file: " << m_reader->fileName());
-      // All was good and a new reader is picked up
-      // Call new file as "currently open file"
-      m_currentFilename = filename;
-
-      // Get ByteStream Metadata into Input MetaData Store
-      std::bitset<64> word1;
-      std::bitset<64> word2;
-      for (unsigned int i=0; i<64; ++i) {
-         word1[i] = m_reader->detectorMask()[i];
-         word2[i] = m_reader->detectorMask()[i+64];
-      }
-      ByteStreamMetadata* metadata = new ByteStreamMetadata(m_reader->runNumber(), m_reader->eventsInFile(),
-	      m_reader->maxEvents(), m_reader->recEnable(), m_reader->triggerType(), word1.to_ulong(), word2.to_ulong(),
-	      m_reader->beamType(), m_reader->beamEnergy(), m_reader->GUID(), m_reader->stream(),
-	      m_reader->projectTag(), m_reader->lumiblockNumber(), m_reader->freeMetaDataStrings());
-      if (!m_mdSvc->record(metadata, "ByteStreamMetadata").isSuccess()) {
-         delete metadata; metadata = 0;
-         ATH_MSG_WARNING("Unable to record Input MetaData for ByteStream");
-      }
-      FileIncident beginInputFileIncident(name(), "BeginInputFile", "BSF:" + m_reader->GUID(), m_reader->GUID());
-      m_incidentSvc->fireIncident(beginInputFileIncident);
-   } // current filename check
-   char *buf;
-   unsigned int eventSize;
-
-   // Temporarily, until tdaq-common switches to "long long int" for event position
-   long int tmppos;
-   tmppos = (long)pos;
-   // Another sanity check for truncation error of conversion of "long long" to "long".
-   // Probably never needed after tdaq update, mildly useful before that.
-   long long int check_pos;
-   check_pos = (long long)tmppos;
-   if (check_pos != pos) {
-      // Truncation error here
-      ATH_MSG_ERROR("Truncation error for event position in file " << pos << ": " << check_pos);
-      return(0);
-   }
-   DRError ecode = m_reader->getData(eventSize, &buf, tmppos);
-   if (DROK != ecode) {
-      ATH_MSG_ERROR("Error reading event in position: " << pos);
-      return(0);
-   }
-   // Delete the old event
-   if (m_re) {
-      OFFLINE_FRAGMENTS_NAMESPACE::PointerType st = 0;
-      m_re->start(st);
-      delete [] st;
-      delete m_re; m_re = 0;
-   }
-   OFFLINE_FRAGMENTS_NAMESPACE::DataType* fragment = reinterpret_cast<OFFLINE_FRAGMENTS_NAMESPACE::DataType*>(buf);
-   // Check fragment type
-   const uint32_t headWord = fragment[0];
-   ATH_MSG_DEBUG("First word of the fragment " << MSG::hex << headWord << MSG::dec);
-   // Format version
-   const uint32_t formatVersion = eformat::helper::Version(fragment[3]).major_version();
-   ATH_MSG_DEBUG("Format version " << MSG::hex << formatVersion << MSG::dec);
-   // Error message
-   if ((formatVersion != eformat::MAJOR_DEFAULT_VERSION)
-	   && (formatVersion != eformat::MAJOR_V24_VERSION)
-	   && (formatVersion != eformat::MAJOR_V30_VERSION)
-	   && (formatVersion != eformat::MAJOR_V31_VERSION)) {
-      ATH_MSG_ERROR("Unsupported Format Version: " << MSG::hex << formatVersion << MSG::dec);
-   }
-   if (eformat::FULL_EVENT == headWord || 0xcc1234cc == headWord) {// ROS = 0xcc1234cc
-      // Convert old ROS fragment
-      if (formatVersion != eformat::MAJOR_DEFAULT_VERSION) {
-         // 100 for increase of data-size due to header conversion
-         uint32_t newRosSize = eventSize + 100;
-         OFFLINE_FRAGMENTS_NAMESPACE::DataType* newFragment = new OFFLINE_FRAGMENTS_NAMESPACE::DataType[newRosSize];
-         eformat::old::convert(fragment, newFragment, newRosSize);
-         // Delete old fragment
-         delete [] fragment;
-         // Set new pointer
-         fragment = newFragment;
-      }
-      // This is a FullEventFragment make a new FEFrag in memory from it
-      m_re = new RawEvent(fragment);
-      ATH_MSG_DEBUG("Made an FullEventFragment from ES");
-      // Check validity
-      try {
-         m_re->check_tree();
-      } catch (...) {
-         // Bad event
-         ATH_MSG_ERROR("Failed to create FullEventFragment");
-         delete m_re; m_re = 0;
-         delete [] fragment;
-         return(0);
-      }
-   } else {
-      // Unknown fragment
-      ATH_MSG_ERROR("Unknown Header word in input fragment" << MSG::hex << headWord);
-      return(0);
-   }
-   if (m_dump) {
-      DumpFrags::dump(m_re);
-   }
-   return(m_re);
-}
-//----------------------------------------------------------------------------------------
-StatusCode ByteStreamSingleEventInputSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) {
-   if (IByteStreamSingleEventInputSvc::interfaceID().versionMatch(riid)) {
-      *ppvInterface = dynamic_cast<IByteStreamSingleEventInputSvc*>(this);
-   } else {
-      // Interface is not directly available: try out a base class
-      return(::AthService::queryInterface(riid, ppvInterface));
-   }
-   addRef();
-   return(StatusCode::SUCCESS);
-}
diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamSingleEventInputSvc.h b/Event/ByteStreamCnvSvc/src/ByteStreamSingleEventInputSvc.h
deleted file mode 100644
index bf6e749dd9f..00000000000
--- a/Event/ByteStreamCnvSvc/src/ByteStreamSingleEventInputSvc.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef BYTESTREAMSINGLEEVENTINPUTSVC_H
-#define BYTESTREAMSINGLEEVENTINPUTSVC_H
-
-/** @file ByteStreamSingleEventInputSvc.h
- *  @brief This file contains the class definition for the ByteStreamSingleEventInputSvc class.
- *  @author Peter van Gemmeren <gemmeren@anl.gov>
- **/
-
-#include "EventStorage/DataReader.h"
-
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/Property.h"  // no forward decl: typedef
-#include "AthenaBaseComps/AthService.h"
-
-#include "ByteStreamCnvSvc/IByteStreamSingleEventInputSvc.h"
-
-#include "ByteStreamData/RawEvent.h"
-
-class StoreGateSvc;
-class IIncidentSvc;
-
-/** @class ByteStreamSingleEventInputSvc
- *  @brief This class implements the interface to the ByteStreamInputSvc for reading a single event
- *  from ByteStream file given a file name and event position in that file.
- **/
-class ByteStreamSingleEventInputSvc : public ::AthService, virtual public IByteStreamSingleEventInputSvc {
-public:
-   /// Standard Service Constructor
-   ByteStreamSingleEventInputSvc(const std::string& name, ISvcLocator* pSvcLocator);
-   /// Destructor
-   virtual ~ByteStreamSingleEventInputSvc();
-
-   /// Required of all Gaudi Services
-   StatusCode initialize();
-   StatusCode stop();
-   StatusCode finalize();
-   /// Required of all Gaudi services:  see Gaudi documentation for details
-   StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
-
-   /// get event for a given filename and event position
-   const RawEvent* getEvent(const std::string& filename, const long long pos);
-
-private: // data
-   RawEvent*          m_re;            //!< current event
-   DataReader*        m_reader;        //!< DataReader from EventStorage
-   ServiceHandle<StoreGateSvc> m_mdSvc; //!< StoreGateSvc
-   ServiceHandle<IIncidentSvc> m_incidentSvc; //!< IncidentSvc
-   std::string        m_currentFilename; //!< name of the currently opened file
-
-private: // properties
-   Gaudi::Property<bool>    m_dump;	      //!< Dump fragments
-};
-
-#endif
diff --git a/Event/ByteStreamCnvSvc/src/components/ByteStreamCnvSvc_entries.cxx b/Event/ByteStreamCnvSvc/src/components/ByteStreamCnvSvc_entries.cxx
index a1dbb13243f..eba4f795afb 100644
--- a/Event/ByteStreamCnvSvc/src/components/ByteStreamCnvSvc_entries.cxx
+++ b/Event/ByteStreamCnvSvc/src/components/ByteStreamCnvSvc_entries.cxx
@@ -6,8 +6,6 @@
 #include "../ByteStreamRDP_OutputSvc.h"
 #include "../ByteStreamEventStorageInputSvc.h"
 #include "../ByteStreamEventStorageOutputSvc.h"
-#include "../ByteStreamSingleEventInputSvc.h"
-#include "../ByteStreamNavigationProviderSvc.h"
 #include "../ByteStreamOutputStreamCopyTool.h"
 #include "../ByteStreamMetadataTool.h"
 #include "../ByteStreamAttListMetadataSvc.h"
@@ -20,8 +18,6 @@ DECLARE_COMPONENT( ByteStreamMergeOutputSvc )
 DECLARE_COMPONENT( ByteStreamRDP_OutputSvc )
 DECLARE_COMPONENT( ByteStreamEventStorageInputSvc )
 DECLARE_COMPONENT( ByteStreamEventStorageOutputSvc )
-DECLARE_COMPONENT( ByteStreamSingleEventInputSvc )
-DECLARE_COMPONENT( ByteStreamNavigationProviderSvc )
 DECLARE_COMPONENT( ByteStreamAttListMetadataSvc )
 
 DECLARE_COMPONENT( ByteStreamOutputStreamCopyTool )
diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx
index 0c9bb804c9a..c66cbd719eb 100644
--- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx
@@ -73,10 +73,6 @@ StatusCode Muon::RPC_RawDataProviderTool::initialize()
       return StatusCode::FAILURE;  
     }
     
-    const std::vector<const Property*>* byteStreamNavProps
-        = (jobOptionsSvc)?  jobOptionsSvc->getProperties("ByteStreamNavigationProviderSvc") : 0;
-
-    
     const std::vector<const Property*>* dataFlowProps 
         = (jobOptionsSvc)?  jobOptionsSvc->getProperties("DataFlowConfig") : 0;
 
@@ -85,7 +81,6 @@ StatusCode Muon::RPC_RawDataProviderTool::initialize()
                      TrigConfSvc->getProperties("EventSelector"); 
     
     if     ( dataFlowProps != 0 ) has_bytestream = true;
-        if( byteStreamNavProps != 0 ) has_bytestream = true;
     else if( eventSelProps != 0 )
     {
         for (std::vector<const Property*>::const_iterator 
diff --git a/PhysicsAnalysis/EventTag/EventTagUtils/EventTagUtils/RegistrationStreamTrig.h b/PhysicsAnalysis/EventTag/EventTagUtils/EventTagUtils/RegistrationStreamTrig.h
index 7f1bf53b313..78808cc220c 100755
--- a/PhysicsAnalysis/EventTag/EventTagUtils/EventTagUtils/RegistrationStreamTrig.h
+++ b/PhysicsAnalysis/EventTag/EventTagUtils/EventTagUtils/RegistrationStreamTrig.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef REGISTRATIONSVC_REGSTREAMDEFMETA_H
@@ -54,7 +54,6 @@ public:
 protected:
 
   ServiceHandle<StoreGateSvc> m_pOutputStore;
-  ServiceHandle<StoreGateSvc> m_pInputStore;
   StringProperty  m_LBColl_name;
   StringProperty  m_incompleteLBColl_name;
 
diff --git a/PhysicsAnalysis/EventTag/EventTagUtils/src/RegistrationStreamTrig.cxx b/PhysicsAnalysis/EventTag/EventTagUtils/src/RegistrationStreamTrig.cxx
index c78c67087ff..442bbaa8d06 100755
--- a/PhysicsAnalysis/EventTag/EventTagUtils/src/RegistrationStreamTrig.cxx
+++ b/PhysicsAnalysis/EventTag/EventTagUtils/src/RegistrationStreamTrig.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "EventTagUtils/RegistrationStreamTrig.h"
@@ -42,7 +42,6 @@ RegistrationStreamTrig::RegistrationStreamTrig(const std::string& name,
     :
     AthAlgorithm(name,pSvcLocator),
     m_pOutputStore("StoreGateSvc/MetaDataStore", name),
-    m_pInputStore("StoreGateSvc/InputMetaDataStore", name),
     m_trigConfSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name ),
     m_run(0),
     m_lb(0)
@@ -63,12 +62,6 @@ RegistrationStreamTrig::initialize()
      return(sc);
    }
 
-   sc = m_pInputStore.retrieve();
-   if (0 == m_pInputStore || sc.isFailure()) {
-      ATH_MSG_ERROR("Could not find InputMetaDataStore");
-      return(sc);
-   }
-
    if ( m_gettriggerconf ) {
      sc= m_trigConfSvc.retrieve();
      if (0 == m_trigConfSvc || sc.isFailure()) {
diff --git a/Reconstruction/RecExample/RecExCommission/share/Collisions_ATN.py b/Reconstruction/RecExample/RecExCommission/share/Collisions_ATN.py
index a51d8c385ea..8423966e91b 100644
--- a/Reconstruction/RecExample/RecExCommission/share/Collisions_ATN.py
+++ b/Reconstruction/RecExample/RecExCommission/share/Collisions_ATN.py
@@ -310,6 +310,3 @@ include("RecExCommon/RecExCommon_topOptions.py")
 if Debug:
     from IOVDbSvc.CondDB import conddb
     conddb.dumpFolderTags('iovfolderlist.txt',True)
-
-
-# svcMgr.ByteStreamNavigationProviderSvc.OutputLevel = DEBUG
diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py
index 9ab81808af4..b6147aa38b7 100644
--- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py
+++ b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py
@@ -477,51 +477,13 @@ if globalflags.InputFormat.is_bytestream():
         # --> AK
     else:
         logRecExCommon_topOptions.info("Read ByteStream file(s)")
-        if rec.readTAG():
-            # FIXME need cleaner merger between ReadAthenaPool.py and ReadByteStream.py
-
-            # for EventType
-            from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamCnvSvc
-            svcMgr += ByteStreamCnvSvc()
-            #EventPersistencySvc = svcMgr.EventPersistencySvc
-            svcMgr.EventPersistencySvc.CnvServices += [ "ByteStreamCnvSvc" ]
-
-            # ByteStreamAddressProviderSvc
-            from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc
-            svcMgr += ByteStreamAddressProviderSvc()
-            ByteStreamAddressProviderSvc = svcMgr.ByteStreamAddressProviderSvc
-
-            # proxy provider
-            from SGComps.SGCompsConf import ProxyProviderSvc
-            svcMgr += ProxyProviderSvc()
-
-            #specific for tag
-            from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamNavigationProviderSvc
-            svcMgr += ByteStreamNavigationProviderSvc( "ByteStreamNavigationProviderSvc" )
-
-            import AthenaPoolCnvSvc.ReadAthenaPool
-
-            svcMgr.ProxyProviderSvc.ProviderNames += [ "ByteStreamNavigationProviderSvc" ]
-
-            EventSelector = svcMgr.EventSelector
-            # List of input collections:
-            EventSelector.InputCollections = athenaCommonFlags.FilesInput()
-            # Type of input collections:
-            EventSelector.CollectionType = "ExplicitROOT"
-            # Query applied to event tag collection metadata:
-            EventSelector.Query = athenaCommonFlags.PoolInputQuery()
-            EventSelector.RefName = "StreamRAW"
-
+        from ByteStreamCnvSvc import ReadByteStream
 
-        else: #Regular offline case:
-            from ByteStreamCnvSvc import ReadByteStream
-
-
-            # Specify input file
-            if len(athenaCommonFlags.FilesInput())>0:
-                svcMgr.ByteStreamInputSvc.FullFileName=athenaCommonFlags.FilesInput()
-            elif len(athenaCommonFlags.BSRDOInput())>0:
-                svcMgr.ByteStreamInputSvc.FullFileName=athenaCommonFlags.BSRDOInput()
+        # Specify input file
+        if len(athenaCommonFlags.FilesInput())>0:
+            svcMgr.ByteStreamInputSvc.FullFileName=athenaCommonFlags.FilesInput()
+        elif len(athenaCommonFlags.BSRDOInput())>0:
+            svcMgr.ByteStreamInputSvc.FullFileName=athenaCommonFlags.BSRDOInput()
 
     if globalflags.DataSource()=='geant4':
         logRecExCommon_topOptions.info("DataSource is 'geant4'")
-- 
GitLab