diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx
index bc94a1d1c364464eeb86329e6474f67e4fd07efc..c608cd46542158bc4ebef9b3a1a986c9e7f3fa11 100644
--- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.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
 */
 
 /// Author: Ketevi A. Assamagan, Woochun Park
@@ -7,7 +7,6 @@
 
 /// algorithm to decode RDO into PrepRawData
 
-#include "MuonIdHelpers/CscIdHelper.h"
 #include "MuonReadoutGeometry/CscReadoutElement.h"
 #include "MuonRDO/CscRawData.h"
 #include "MuonRDO/CscRawDataCollection.h"
@@ -35,7 +34,6 @@ const InterfaceID& CscRdoToCscPrepDataToolCore::interfaceID()
 CscRdoToCscPrepDataToolCore::CscRdoToCscPrepDataToolCore
 (const std::string& type, const std::string& name, const IInterface* parent)
   : AthAlgTool(type, name, parent),
-    m_muonMgr(nullptr),
     m_cscCalibTool( "CscCalibTool/CscCalibTool", this),
     m_cscRdoDecoderTool ("Muon::CscRDO_Decoder/CscRDO_Decoder", this),
     m_cabling( "CSCcablingSvc" ,name),
@@ -53,18 +51,14 @@ CscRdoToCscPrepDataToolCore::CscRdoToCscPrepDataToolCore
 }  
 
 StatusCode CscRdoToCscPrepDataToolCore::initialize(){
-  ATH_MSG_DEBUG(" in initialize()");
-  ATH_CHECK(detStore()->retrieve( m_muonMgr ));
-  ATH_MSG_INFO("The Geometry version is " << m_muonMgr->get_DBMuonVersion());
-
   ATH_CHECK(m_cscCalibTool.retrieve());
   ATH_CHECK(m_cscRdoDecoderTool.retrieve());
   ATH_CHECK(m_idHelperSvc.retrieve());
   ATH_CHECK(m_cabling.retrieve());
-
   // check if initializing of DataHandle objects success
-  ATH_CHECK( m_rdoContainerKey.initialize() );
-  ATH_CHECK( m_outputCollectionKey.initialize() );
+  ATH_CHECK(m_rdoContainerKey.initialize());
+  ATH_CHECK(m_outputCollectionKey.initialize());
+  ATH_CHECK(m_muDetMgrKey.initialize());
   return StatusCode::SUCCESS;
 }
 
@@ -77,6 +71,9 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(std::vector<IdentifierHash>&, std
 //************** Process for the givenId EF Filter case...
 StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoContainer, IdentifierHash givenHashId, std::vector<IdentifierHash>& decodedIdhs) {  
   IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context();
+
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
   
   // if CSC decoding is switched off stop here
   if( !m_decodeData ) {
@@ -180,7 +177,7 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon
       const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, j);
       ATH_MSG_DEBUG ( "        LOOP over width  " << j <<  " " << channelId );
 
-      const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId);
+      const CscReadoutElement* descriptor = muDetMgr->getCscReadoutElement(channelId);
       //calculate local positions on the strip planes
       if ( !descriptor ) {
         ATH_MSG_WARNING ( "Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId)
@@ -266,6 +263,8 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon
   typedef CscRawDataContainer::const_iterator collection_iterator;
   
   IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context();
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
  
   // if CSC decoding is switched off stop here
   if( !m_decodeData ) {
@@ -349,7 +348,7 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon
           const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, j);
           ATH_MSG_DEBUG ( "DecodeAll**LOOP over width  " << j <<  " " << channelId );
 
-          const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId);
+          const CscReadoutElement* descriptor = muDetMgr->getCscReadoutElement(channelId);
           //calculate local positions on the strip planes
           if ( !descriptor ) {
             ATH_MSG_WARNING ( "Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId)
diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h
index b2938aecb068204cd966f71a6a8f4b16a3204b3c..ded73c64b1dfd485927c732c5e103041c4688dbe 100644
--- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h
+++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h
@@ -15,13 +15,14 @@
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 #include "CscCalibTools/ICscCalibTool.h"
 #include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h"
-#include <string>
+#include "StoreGate/ReadCondHandleKey.h"
+#include "MuonReadoutGeometry/MuonDetectorManager.h"
 
-namespace MuonGM {
-  class MuonDetectorManager;
-}
+#include <string>
+#include <vector>
 
 class CscRawDataContainer;
+
 ////////////////////////////////////////////////////////////////////////////////////////
 /// Author: Ketevi A. Assamagan
 /// BNL, April 03, 2005
@@ -62,9 +63,8 @@ namespace Muon {
     virtual StatusCode decode(const CscRawDataContainer* rdo, 
 		      std::vector<IdentifierHash>& decodedIdhs);
     virtual StatusCode decode( const std::vector<uint32_t>& ) {return StatusCode::FAILURE;}
-    
-    /// Muon Detector Descriptor
-    const MuonGM::MuonDetectorManager* m_muonMgr;
+
+    SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; 
     
     ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
     
diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx
index 376c4923a4420da4cc646db4765a88967043a420..a8996a11eb3dd9b6ac2be8ddc030c03f0f5c61ca 100644
--- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx
@@ -64,7 +64,7 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(std::vector<IdentifierHash>& givenI
   const bool externalCachePRD = !m_prdContainerCacheKey.key().empty();
   if (!externalCachePRD) {
     // without the cache we just record the container
-    StatusCode status = outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(m_muonMgr->cscIdHelper()->module_hash_max()));
+    StatusCode status = outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(m_idHelperSvc->cscIdHelper().module_hash_max()));
     if (status.isFailure() || !outputHandle.isValid() )   {
       ATH_MSG_FATAL("Could not record container of CSC PrepData Container at " << m_outputCollectionKey.key());
       return StatusCode::FAILURE;
@@ -135,6 +135,8 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta
   
     
   IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context();
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
   
   // if CSC decoding is switched off stop here
   if( !m_decodeData ) {
@@ -225,7 +227,7 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta
       const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, j);
       ATH_MSG_DEBUG ( "        LOOP over width  " << j <<  " " << channelId );
 
-      const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId);
+      const CscReadoutElement * descriptor = muDetMgr->getCscReadoutElement(channelId);
       //calculate local positions on the strip planes
       if ( !descriptor ) {
         ATH_MSG_WARNING ( "Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId)
@@ -316,6 +318,8 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta
   typedef CscRawDataContainer::const_iterator collection_iterator;
   
   IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context();
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
  
   // if CSC decoding is switched off stop here
   if( !m_decodeData ) {
@@ -391,7 +395,7 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoConta
           const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, j);
           ATH_MSG_DEBUG ( "DecodeAll**LOOP over width  " << j <<  " " << channelId );
 
-          const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId);
+          const CscReadoutElement * descriptor = muDetMgr->getCscReadoutElement(channelId);
           //calculate local positions on the strip planes
           if ( !descriptor ) {
             ATH_MSG_WARNING ( "Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId)
diff --git a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.cxx
index 07ef4788a7e1c37d0a40c450e87ea08c26c34b44..9c714838d2aa30dd06319b5acae8cd4ca2b620d6 100644
--- a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.cxx
@@ -23,7 +23,6 @@ Muon::MmRdoToPrepDataToolCore::MmRdoToPrepDataToolCore(const std::string& t,
 					       const IInterface*  p )
   :
   AthAlgTool(t,n,p),
-  m_muonMgr(nullptr),
   m_fullEventDone(false),
   m_mmPrepDataContainer(nullptr),
   m_clusterBuilderTool("Muon::SimpleMMClusterBuilderTool/SimpleMMClusterBuilderTool",this),
@@ -45,16 +44,12 @@ Muon::MmRdoToPrepDataToolCore::MmRdoToPrepDataToolCore(const std::string& t,
 
 StatusCode Muon::MmRdoToPrepDataToolCore::initialize()
 {  
-  ATH_MSG_DEBUG(" in initialize()");
- 
-  ATH_CHECK(detStore()->retrieve(m_muonMgr));
-  
+  ATH_MSG_DEBUG(" in initialize()");  
   ATH_CHECK(m_idHelperSvc.retrieve());
-
   // check if the initialization of the data container is success
   ATH_CHECK(m_mmPrepDataContainerKey.initialize());
   ATH_CHECK(m_rdoContainerKey.initialize());
-
+  ATH_CHECK(m_muDetMgrKey.initialize());
   ATH_MSG_INFO("initialize() successful in " << name());
   return StatusCode::SUCCESS;
 }
@@ -111,6 +106,10 @@ StatusCode Muon::MmRdoToPrepDataToolCore::processCollection(const MM_RawDataColl
 
     const MM_RawData* rdo = *it;
     const Identifier rdoId = rdo->identify();
+    if (!m_idHelperSvc->isMM(rdoId)) {
+      ATH_MSG_WARNING("given Identifier "<<rdoId.get_compact()<<" ("<<m_idHelperSvc->mmIdHelper().print_to_string(rdoId)<<") is no MicroMega Identifier, continuing");
+      continue;
+    }
     ATH_MSG_DEBUG(" dump rdo " << m_idHelperSvc->toString(rdoId ));
     
     int channel = rdo->channel();
@@ -121,8 +120,13 @@ StatusCode Muon::MmRdoToPrepDataToolCore::processCollection(const MM_RawDataColl
     ATH_MSG_DEBUG(" channel RDO " << channel << " channel from rdoID " << m_idHelperSvc->mmIdHelper().channel(rdoId));
     rdoList.push_back(prdId);
 
+    // TODO: this needs to be replaced by SG::ReadCondHandle<MuonGM::MuonDetectorManager>
+    // will do it in a follow-up MR, since for now, we need to get the Run2 detectors running, so skip MicroMegas for now
+    const MuonGM::MuonDetectorManager* muDetMgrNominal=nullptr;
+    ATH_CHECK(detStore()->retrieve(muDetMgrNominal));
+
     // get the local and global positions
-    const MuonGM::MMReadoutElement* detEl = m_muonMgr->getMMReadoutElement(layid);
+    const MuonGM::MMReadoutElement* detEl = muDetMgrNominal->getMMReadoutElement(layid);
     Amg::Vector2D localPos;
 
     bool getLocalPos = detEl->stripPosition(prdId,localPos);
diff --git a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.h
index 467fee554b7bec244e6249045781d9b4eb63b445..83dc3a3305e2307392d59985d771c65693e9d0b3 100644
--- a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.h
+++ b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.h
@@ -5,29 +5,24 @@
 #ifndef MUONMmRdoToPrepDataToolCore_H
 #define MUONMmRdoToPrepDataToolCore_H
 
+#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 
-#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
-
 #include "MuonPrepRawData/MMPrepDataContainer.h"
 #include "MuonRDO/MM_RawDataContainer.h"
-
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 #include "MMClusterization/IMMClusterBuilderTool.h"
 #include "NSWCalibTools/INSWCalibTool.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "MuonReadoutGeometry/MuonDetectorManager.h"
 
 #include <string>
 #include <vector>
 
 class MM_RawDataCollection;
 
-namespace MuonGM
-{    
-    class MuonDetectorManager;
-}
-
 namespace Muon 
 {
 
@@ -66,8 +61,7 @@ namespace Muon
 
     void processRDOContainer( std::vector<IdentifierHash>& idWithDataVect );
 
-    /// Muon Detector Descriptor
-    const MuonGM::MuonDetectorManager * m_muonMgr;
+    SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; 
     
     ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
     
diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.cxx
index cc933d324d6925ef55f335f50d76bcd2cb5d17e7..c8a5e59cfc4e595deac59d4a539a755473128cfe 100755
--- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.cxx
@@ -4,7 +4,6 @@
 
 #include "RpcRdoToPrepDataToolCore.h"
 
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
 #include "MuonReadoutGeometry/RpcReadoutElement.h"
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
 #include "MuonTrigCoinData/RpcCoinDataContainer.h"
@@ -31,7 +30,6 @@ Muon::RpcRdoToPrepDataToolCore::RpcRdoToPrepDataToolCore( const std::string& typ
     m_reduceCablingOverlap(true),         //!< toggle on/off the overlap removal
     m_timeShift(0.),                      //!< any global time shift ?!
     m_decodeData(true),                   //!< toggle on/off the decoding of RPC RDO into RpcPrepData
-    m_muonMgr(nullptr),
     m_rpcRdoDecoderTool("Muon::RpcRDO_Decoder", this),
     m_fullEventDone(false)
 {
@@ -90,10 +88,6 @@ StatusCode Muon::RpcRdoToPrepDataToolCore::initialize() {
   ATH_MSG_INFO("etaphi_coincidenceTime             "<<m_etaphi_coincidenceTime);
   ATH_MSG_INFO("overlap_timeTolerance              "<<m_overlap_timeTolerance );
   ATH_MSG_INFO("Correct prd time from cool db      "<<m_RPCInfoFromDb         );
-    
-  /// get the detector descriptor manager
-  ATH_CHECK(detStore()->retrieve(m_muonMgr));
-  ATH_MSG_VERBOSE("MuonDetectorManager retrieved");
   ATH_CHECK(m_rpcRdoDecoderTool.retrieve());  
   ATH_CHECK(m_idHelperSvc.retrieve());
   ATH_CHECK(m_rpcReadKey.initialize());
@@ -102,6 +96,7 @@ StatusCode Muon::RpcRdoToPrepDataToolCore::initialize() {
   ATH_CHECK(m_rpcPrepDataContainerKey.initialize());
   ATH_CHECK(m_rpcCoinDataContainerKey.initialize());
   ATH_CHECK(m_eventInfo.initialize());
+  ATH_CHECK(m_muDetMgrKey.initialize());
   return StatusCode::SUCCESS;
 }
 
@@ -1100,8 +1095,9 @@ StatusCode Muon::RpcRdoToPrepDataToolCore::processPad(const RpcPad *rdoColl,
             }
           }
         }
-	      // det element
-	      const RpcReadoutElement *descriptor = m_muonMgr->getRpcReadoutElement(channelId);
+        SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+        const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
+        const RpcReadoutElement* descriptor = muDetMgr->getRpcReadoutElement(channelId);
 	      
 	      // here check validity
 	      // if invalid, reset flags
diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.h
index 04d83a72e3249f56d7842fbe4266b8e3e4c91ae5..d456a18de7ff11b1825c4a1122e7a497b23e9318 100755
--- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.h
+++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.h
@@ -6,7 +6,6 @@
 #define MUONRDOTOPREPDATA_RPCRDOTOPREPDATATOOLCORE_H
 
 #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
-
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
@@ -21,17 +20,13 @@
 #include "RPC_CondCabling/RpcCablingCondData.h"
 #include "StoreGate/ReadCondHandleKey.h"
 #include "xAODEventInfo/EventInfo.h"
+#include "MuonReadoutGeometry/MuonDetectorManager.h"
 
 #include <string>
 #include <set>
 
 #define maxOfflineHash 600 // actually 593
 
-namespace MuonGM
-{
-  class MuonDetectorManager;
-}
-
 namespace Muon {
 
 /////////////////////////////////////////////////////////////////////////////
@@ -84,8 +79,7 @@ protected:
   bool m_RPCInfoFromDb;                 //!< correct time prd from cool db
   // end of configurable options 
 
-  /// Muon Detector Descriptor
-  const MuonGM::MuonDetectorManager* m_muonMgr;
+  SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; 
   
   ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
  
diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx
index f763c485979c00b6db3a1931947341c8175c62f6..25924a048ded723f70e793f9a108882ddb3d4752 100644
--- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx
@@ -13,7 +13,6 @@ using namespace Muon;
 
 Muon::sTgcRdoToPrepDataToolCore::sTgcRdoToPrepDataToolCore(const std::string& t, const std::string& n, const IInterface* p) :
   AthAlgTool(t,n,p),
-  m_muonMgr(nullptr),
   m_fullEventDone(false),
   m_stgcPrepDataContainer(0),
   m_clusterBuilderTool("Muon::SimpleSTgcClusterBuilderTool/SimpleSTgcClusterBuilderTool",this)
@@ -32,13 +31,11 @@ Muon::sTgcRdoToPrepDataToolCore::sTgcRdoToPrepDataToolCore(const std::string& t,
 StatusCode Muon::sTgcRdoToPrepDataToolCore::initialize()
 {  
   ATH_MSG_DEBUG(" in initialize()");
-  /// get the detector descriptor manager
-  ATH_CHECK(detStore()->retrieve(m_muonMgr));
   ATH_CHECK( m_idHelperSvc.retrieve() );
-
   // check if the initialization of the data container is success
   ATH_CHECK(m_stgcPrepDataContainerKey.initialize());
   ATH_CHECK(m_rdoContainerKey.initialize());
+  ATH_CHECK(m_muDetMgrKey.initialize());
   ATH_MSG_INFO("initialize() successful in " << name());
   return StatusCode::SUCCESS;
 }
@@ -92,11 +89,20 @@ StatusCode Muon::sTgcRdoToPrepDataToolCore::processCollection(const STGC_RawData
 
     const STGC_RawData* rdo = *it;
     const Identifier rdoId = rdo->identify();
+    if (!m_idHelperSvc->issTgc(rdoId)) {
+      ATH_MSG_WARNING("given Identifier "<<rdoId.get_compact()<<" ("<<m_idHelperSvc->stgcIdHelper().print_to_string(rdoId)<<") is no sTGC Identifier, continuing");
+      continue;
+    }
     std::vector<Identifier> rdoList;
     rdoList.push_back(rdoId);
+
+    // TODO: this needs to be replaced by SG::ReadCondHandle<MuonGM::MuonDetectorManager>
+    // will do it in a follow-up MR, since for now, we need to get the Run2 detectors running, so skip sTGCs for now
+    const MuonGM::MuonDetectorManager* muDetMgrNominal=nullptr;
+    ATH_CHECK(detStore()->retrieve(muDetMgrNominal));
     
     // get the local and global positions
-    const MuonGM::sTgcReadoutElement* detEl = m_muonMgr->getsTgcReadoutElement(rdoId);
+    const MuonGM::sTgcReadoutElement* detEl = muDetMgrNominal->getsTgcReadoutElement(rdoId);
     Amg::Vector2D localPos;
 
     bool getLocalPos = detEl->stripPosition(rdoId,localPos);
diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.h
index 92544584ef1016a7023fb0b65a21daeeec1f7540..526920bff29d323fa751371965367ec95533ea52 100644
--- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.h
+++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.h
@@ -5,23 +5,20 @@
 #ifndef MUONTGC_CNVTOOLS_STGCRDOTOPREPDATATOOLCORE
 #define MUONTGC_CNVTOOLS_STGCRDOTOPREPDATATOOLCORE
 
+#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
-#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
 
 #include "MuonRDO/STGC_RawDataContainer.h"
 #include "MuonPrepRawData/sTgcPrepDataContainer.h"
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 #include "STgcClusterization/ISTgcClusterBuilderTool.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "MuonReadoutGeometry/MuonDetectorManager.h"
 
 #include <string>
-
-namespace MuonGM 
-{
-  class MuonDetectorManager;
-  class TgcReadoutElement; 
-}
+#include <vector>
 
 namespace Muon 
 {
@@ -73,8 +70,7 @@ namespace Muon
 
       void processRDOContainer(std::vector<IdentifierHash>& idWithDataVect);
 
-      /** muon detector manager */
-      const MuonGM::MuonDetectorManager* m_muonMgr;
+      SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; 
 
       ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
 
diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.cxx
index 42dc58c60f724ab56181a5dc443885e89a168a9f..50a049f1e7c6210b1dad32ef1eba7ed8eb125f88 100644
--- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.cxx
@@ -4,7 +4,6 @@
 
 #include "TgcRdoToPrepDataToolCore.h"
 
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
 #include "MuonReadoutGeometry/TgcReadoutElement.h"
 #include "TGCcablingInterface/ITGCcablingServerSvc.h"
 #include "TGCcablingInterface/TGCIdBase.h"
@@ -22,7 +21,6 @@
 
 Muon::TgcRdoToPrepDataToolCore::TgcRdoToPrepDataToolCore(const std::string& t, const std::string& n, const IInterface* p)
   : AthAlgTool(t, n, p), 
-    m_muonMgr(0),
     m_tgcCabling(0),
     m_nHitRDOs(0), 
     m_nHitPRDs(0), 
@@ -74,7 +72,6 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::queryInterface(const InterfaceID& rii
 StatusCode Muon::TgcRdoToPrepDataToolCore::initialize()
 {
   ATH_CHECK(AthAlgTool::initialize());
-  ATH_CHECK(detStore()->retrieve(m_muonMgr));
   ATH_CHECK(m_idHelperSvc.retrieve());
 
   for(int ibc=0; ibc<NBC+1; ibc++) {      
@@ -95,6 +92,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::initialize()
   
   ATH_CHECK(m_outputCoinKeys.initialize());
   ATH_CHECK(m_outputprepdataKeys.initialize());
+  ATH_CHECK(m_muDetMgrKey.initialize());
  
   // check if initializing of DataHandle objects success
   ATH_CHECK( m_rdoContainerKey.initialize() );
@@ -397,6 +395,9 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat
     if(!status.isSuccess()) return status;
   }
 
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
+
   TgcPrepDataCollection* collection = 0;
   TgcPrepDataCollection* collectionAllBcs = 0;
   IdentifierHash tgcHashId;
@@ -521,7 +522,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat
       continue;
     }
     
-    const MuonGM::TgcReadoutElement* descriptor = m_muonMgr->getTgcReadoutElement(channelId);
+    const MuonGM::TgcReadoutElement* descriptor = muDetMgr->getTgcReadoutElement(channelId);
     if(!isOfflineIdOKForTgcReadoutElement(descriptor, channelId)) {
       ATH_MSG_WARNING("decodeHits: MuonGM::TgcReadoutElement is invalid.");
       continue;
@@ -637,6 +638,9 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it
     ATH_MSG_DEBUG("decodeTracklet: can't get the OfflineIdOut");
     return StatusCode::SUCCESS;
   }
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
+
   //*** Get OfflineId of pivot plane (TGC3) end ***//
   
   //*** Get OfflineId of non-pivot plane (TGC2) start ***//
@@ -703,7 +707,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it
   ATH_MSG_DEBUG("TGC RDO->Coindata for LowPT: " << m_idHelperSvc->tgcIdHelper().show_to_string(channelIdOut)); 
 
   //*** Get geometry of pivot plane (TGC3) start ***//
-  const MuonGM::TgcReadoutElement* descriptor_o = m_muonMgr->getTgcReadoutElement(channelIdOut);
+  const MuonGM::TgcReadoutElement* descriptor_o = muDetMgr->getTgcReadoutElement(channelIdOut);
   if(!isOfflineIdOKForTgcReadoutElement(descriptor_o, channelIdOut)) {
     return StatusCode::SUCCESS;
   }
@@ -731,7 +735,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it
   //*** Get geometry of pivot plane (TGC3) end ***//
   
   //*** Get geometry of non-pivot plane (TGC2) start ***//
-  const MuonGM::TgcReadoutElement* descriptor_i = m_muonMgr->getTgcReadoutElement(channelIdIn);
+  const MuonGM::TgcReadoutElement* descriptor_i = muDetMgr->getTgcReadoutElement(channelIdIn);
   if(!isOfflineIdOKForTgcReadoutElement(descriptor_i, channelIdIn)) {
     return StatusCode::SUCCESS;
   }
@@ -935,8 +939,10 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI(const TgcRdo::cons
     }
   }
 
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
   // Get MuonGM::TgcReadoutElement from channelIdIn
-  const MuonGM::TgcReadoutElement* descriptor = m_muonMgr->getTgcReadoutElement(channelIdIn);
+  const MuonGM::TgcReadoutElement* descriptor = muDetMgr->getTgcReadoutElement(channelIdIn);
   if(!isOfflineIdOKForTgcReadoutElement(descriptor, channelIdIn)) {
     ATH_MSG_WARNING("Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI descriptor doesn't contain " 
 		    << m_idHelperSvc->tgcIdHelper().show_to_string(channelIdIn));
@@ -1016,6 +1022,8 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat
     ATH_MSG_DEBUG("Invalid hitId_rdo_hipt, hitId == 0!! skip to convert this RDO to PRD");
     return StatusCode::SUCCESS;
   }
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
 
   TgcCoinDataCollection* coincollection = 0;
   IdentifierHash tgcHashId;
@@ -1125,8 +1133,8 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat
   
   //*** TGC3 start ***// 
   // Get geometry of pivot plane 
-  const MuonGM::TgcReadoutElement* descriptor_o[2] = {m_muonMgr->getTgcReadoutElement(channelIdOut[0]), 
-                                                      m_muonMgr->getTgcReadoutElement(channelIdOut[1])};
+  const MuonGM::TgcReadoutElement* descriptor_o[2] = {muDetMgr->getTgcReadoutElement(channelIdOut[0]), 
+                                                      muDetMgr->getTgcReadoutElement(channelIdOut[1])};
   for(int i=0; i<2; i++) {
     if(!isOfflineIdOKForTgcReadoutElement(descriptor_o[i], channelIdOut[i])) {
       return StatusCode::SUCCESS;
@@ -1157,8 +1165,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat
     return StatusCode::SUCCESS;
   }
 
-  //const MuonGM::TgcReadoutElement* descriptor_oo = m_muonMgr->getTgcReadoutElement(channelIdOut_tmp);
-  descriptor_oo = m_muonMgr->getTgcReadoutElement(channelIdOut_tmp);
+  descriptor_oo = muDetMgr->getTgcReadoutElement(channelIdOut_tmp);
   if(!isOfflineIdOKForTgcReadoutElement(descriptor_oo, channelIdOut_tmp)) {
     return StatusCode::SUCCESS;
   }
@@ -1167,10 +1174,10 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat
   
   //*** TGC1 start ***// 
   // Get geometry of non-pivot plane 
-  const MuonGM::TgcReadoutElement* descriptor_i[4] = {m_muonMgr->getTgcReadoutElement(channelIdIn[0]), 
-                                                      m_muonMgr->getTgcReadoutElement(channelIdIn[1]), 
-                                                      m_muonMgr->getTgcReadoutElement(channelIdIn[2]), 
-                                                      m_muonMgr->getTgcReadoutElement(channelIdIn[3])};
+  const MuonGM::TgcReadoutElement* descriptor_i[4] = {muDetMgr->getTgcReadoutElement(channelIdIn[0]), 
+                                                      muDetMgr->getTgcReadoutElement(channelIdIn[1]), 
+                                                      muDetMgr->getTgcReadoutElement(channelIdIn[2]), 
+                                                      muDetMgr->getTgcReadoutElement(channelIdIn[3])};
   for(int i=0; i<4; i++) {
     if(!isOfflineIdOKForTgcReadoutElement(descriptor_i[i], channelIdIn[i])) {
       return StatusCode::SUCCESS;
@@ -1200,8 +1207,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat
     return StatusCode::SUCCESS;
   }
 
-  //const MuonGM::TgcReadoutElement* descriptor_ii = m_muonMgr->getTgcReadoutElement(channelIdIn_tmp);
-  descriptor_ii = m_muonMgr->getTgcReadoutElement(channelIdIn_tmp);
+  descriptor_ii = muDetMgr->getTgcReadoutElement(channelIdIn_tmp);
   if(!isOfflineIdOKForTgcReadoutElement(descriptor_ii, channelIdIn_tmp)) {
     return StatusCode::SUCCESS;
   }
@@ -1487,8 +1493,9 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeSL(const TgcRdo::const_iterator
     return StatusCode::SUCCESS;
   }
   //*** Phi (strip) end ***//
-  
-  const MuonGM::TgcReadoutElement* descriptor_w2 = m_muonMgr->getTgcReadoutElement(channelId_wire[2]);
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
+  const MuonGM::TgcReadoutElement* descriptor_w2 = muDetMgr->getTgcReadoutElement(channelId_wire[2]);
   if(!isOfflineIdOKForTgcReadoutElement(descriptor_w2, channelId_wire[2])) {
     return StatusCode::SUCCESS;
   }
@@ -2246,9 +2253,11 @@ double Muon::TgcRdoToPrepDataToolCore::getWidthStrip(const MuonGM::TgcReadoutEle
 bool Muon::TgcRdoToPrepDataToolCore::getSLWireGeometry(const Identifier* channelId_wire, 
 						   double& width_wire, double& r_wire, double& z_wire)
 {
-  const MuonGM::TgcReadoutElement* descriptor_w[3] = {m_muonMgr->getTgcReadoutElement(channelId_wire[0]), 
-						      m_muonMgr->getTgcReadoutElement(channelId_wire[1]), 
-						      m_muonMgr->getTgcReadoutElement(channelId_wire[2])};
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
+  const MuonGM::TgcReadoutElement* descriptor_w[3] = {muDetMgr->getTgcReadoutElement(channelId_wire[0]), 
+						      muDetMgr->getTgcReadoutElement(channelId_wire[1]), 
+						      muDetMgr->getTgcReadoutElement(channelId_wire[2])};
   for(int i=0; i<3; i++) {
     if(!isOfflineIdOKForTgcReadoutElement(descriptor_w[i], channelId_wire[i])) {
       return false;
@@ -2319,9 +2328,11 @@ bool Muon::TgcRdoToPrepDataToolCore::getSLStripGeometry(const Identifier* channe
 						    const bool isBackward, const bool isAside, 
 						    double& width_strip, double& theta_strip)
 {
-  const MuonGM::TgcReadoutElement* descriptor_s[3] = {m_muonMgr->getTgcReadoutElement(channelId_strip[0]), 
-						      m_muonMgr->getTgcReadoutElement(channelId_strip[1]), 
-						      m_muonMgr->getTgcReadoutElement(channelId_strip[2])};
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
+  const MuonGM::TgcReadoutElement* descriptor_s[3] = {muDetMgr->getTgcReadoutElement(channelId_strip[0]), 
+						      muDetMgr->getTgcReadoutElement(channelId_strip[1]), 
+						      muDetMgr->getTgcReadoutElement(channelId_strip[2])};
   for(int i=0; i<3; i++) {
     if(!isOfflineIdOKForTgcReadoutElement(descriptor_s[i], channelId_strip[i])) {
       return false;
@@ -2530,7 +2541,9 @@ bool Muon::TgcRdoToPrepDataToolCore::getPosAndIdWireIn(const MuonGM::TgcReadoutE
   }
   
   channelIdIn_tmp = channelIdIn[flag_boundary_i];
-  const MuonGM::TgcReadoutElement* descriptor_iw = m_muonMgr->getTgcReadoutElement(channelIdIn_tmp);
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
+  const MuonGM::TgcReadoutElement* descriptor_iw = muDetMgr->getTgcReadoutElement(channelIdIn_tmp);
   if(!isOfflineIdOKForTgcReadoutElement(descriptor_iw, channelIdIn_tmp)) {
     return false;
   }
@@ -2631,7 +2644,9 @@ bool Muon::TgcRdoToPrepDataToolCore::getPosAndIdStripIn(const MuonGM::TgcReadout
   }
   
   channelIdIn_tmp = channelIdIn[flag_isL3];
-  const MuonGM::TgcReadoutElement* descriptor_is = m_muonMgr->getTgcReadoutElement(channelIdIn_tmp);
+  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
+  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
+  const MuonGM::TgcReadoutElement* descriptor_is = muDetMgr->getTgcReadoutElement(channelIdIn_tmp);
   if(!isOfflineIdOKForTgcReadoutElement(descriptor_is, channelIdIn_tmp)) {
     return true;
   }
diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.h
index cebc7c625133bd023b41a4106dcafff759933c7d..36206e799f74391ce413b9c938d7c4a0797fa1fb 100644
--- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.h
+++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.h
@@ -15,12 +15,14 @@
 #include "MuonRDO/TgcRdoContainer.h"
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 #include "TGCcablingInterface/ITGCcablingSvc.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "MuonReadoutGeometry/MuonDetectorManager.h"
 
 #include <string>
+#include <vector>
 
 namespace MuonGM 
 {
-  class MuonDetectorManager;
   class TgcReadoutElement; 
 }
 
@@ -302,8 +304,7 @@ namespace Muon
       /** Get SL local position */
       const Amg::Vector2D* getSLLocalPosition(const MuonGM::TgcReadoutElement* readout, const Identifier, const double eta, const double phi) const; 
 
-      /** muon detector manager */
-      const MuonGM::MuonDetectorManager* m_muonMgr;
+      SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; 
 
       ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
       
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MuonAlignmentCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MuonAlignmentCondAlg.h
index bfe6c5deac12dda94a256cc1342a6a9a1214c443..99194ed975cb9dc3362564233f0d701e5eb28ee6 100644
--- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MuonAlignmentCondAlg.h
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MuonAlignmentCondAlg.h
@@ -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
 */
 
 #ifndef MUONCONDALG_MUONALIGNMENTCONDALG_H
@@ -31,11 +31,9 @@ class MuonAlignmentCondAlg: public AthAlgorithm {
   virtual ~MuonAlignmentCondAlg() = default;
   virtual StatusCode initialize() override;
   virtual StatusCode execute() override;
-  virtual StatusCode finalize() override;
-
-  //std::vector<std::string> parlineFolder() { return m_parlineFolder; }
 
   Gaudi::Property<std::vector<std::string>> m_parlineFolder {this, "ParlineFolders", std::vector<std::string>(), "Database folders", "OrderedSet<std::string>"};
+  Gaudi::Property<bool> m_doRecRoiSvcUpdate {this, "DoRecRoiSvcUpdate", false, "if set to true, the old (not thread safe) RPC/TGCRecRoiSvc are updating the nominal MuonDetectorManager from the detectorStore"};
     
  private:
 
@@ -91,7 +89,6 @@ class MuonAlignmentCondAlg: public AthAlgorithm {
   std::string m_aLinesFile;
   std::string m_asBuiltFile;
 
-  StatusCode InitializeGeometryAndIdHelpers();
   StatusCode loadParameters();
   StatusCode loadAlignABLines();
   StatusCode loadAlignABLines(std::string folderName,
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx
index bb53caa079895e6c8581474f9050dd5f1806f668..a5cf3a2990f227e5c9f1d19350e9fb9f98366976 100644
--- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx
@@ -2,30 +2,25 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "GaudiKernel/MsgStream.h"
+#include "MuonCondAlg/MuonAlignmentCondAlg.h"
 
-#include "StoreGate/StoreGateSvc.h"
+#include "MuonCondSvc/MdtStringUtils.h"
+#include "GaudiKernel/ConcurrencyFlags.h"
 #include "SGTools/TransientAddress.h"
 #include "CoralBase/Attribute.h"
 #include "CoralBase/AttributeListSpecification.h"
 #include "AthenaPoolUtilities/AthenaAttributeList.h"
 #include "AthenaPoolUtilities/CondAttrListCollection.h"
-
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
 #include "MuonReadoutGeometry/GlobalUtilities.h"
-
 #include "PathResolver/PathResolver.h"
+
 #include <fstream>
 #include <string>
 #include <map>
 
-#include "MuonCondAlg/MuonAlignmentCondAlg.h"
-
-#include "MuonCondSvc/MdtStringUtils.h"
-
-MuonAlignmentCondAlg::MuonAlignmentCondAlg(const std::string& name, 
-				       ISvcLocator* pSvcLocator) 
-  : AthAlgorithm(name, pSvcLocator),
+MuonAlignmentCondAlg::MuonAlignmentCondAlg(const std::string& name, ISvcLocator* pSvcLocator) :
+    AthAlgorithm(name, pSvcLocator),
     m_condSvc{"CondSvc", name}
 {
   m_geometryVersion = "";
@@ -87,65 +82,18 @@ StatusCode MuonAlignmentCondAlg::initialize(){
     return StatusCode::FAILURE;
   }
   
-  //=================
-  // Initialize geometry and Id Helpers. Initialization of the pointer to the MuonDetectorManager from the detector store.
-  // !!!!!!!!!!! It was called in the loadParameters before. !!!!!!!!!!
-  //=================
-
-  if (InitializeGeometryAndIdHelpers().isFailure()) {
-    ATH_MSG_FATAL("Error in InitializeGeometryAndIdHelpers");
-    return StatusCode::FAILURE;
-  }
- 
-
- return StatusCode::SUCCESS;
-}
-
-StatusCode MuonAlignmentCondAlg::execute(){
-  
-  StatusCode sc = StatusCode::SUCCESS;
-
-  ATH_MSG_DEBUG( "execute " << name() ); 
-
-  sc = loadParameters();
-
-  return sc;
-}
-
-
-StatusCode MuonAlignmentCondAlg::finalize(){
-  
-  ATH_MSG_DEBUG( "finalize " << name() );
-  return StatusCode::SUCCESS;
-}
-
-StatusCode MuonAlignmentCondAlg::InitializeGeometryAndIdHelpers(){
-
-  //=================
-  // Initialize pointer to the MuonDetectorManager from the detector store
-  //=================
-  
-  if (StatusCode::SUCCESS != detStore()->retrieve(m_muonDetMgrDS)) {
-    ATH_MSG_FATAL("Couldn't load MuonDetectorManager");
-    return StatusCode::FAILURE;
-  }
-
-  //=================
-  // Initialize geometry
-  //=================
-
+  ATH_CHECK(detStore()->retrieve(m_muonDetMgrDS));
   m_geometryVersion = m_muonDetMgrDS->geometryVersion();
   ATH_MSG_INFO("geometry version from the MuonDetectorManager = " << m_geometryVersion);
-  
-  //=================
-  // Initialize Helpers
-  //=================
-  
   ATH_CHECK(m_idHelperSvc.retrieve());
-
   return StatusCode::SUCCESS;
 }
 
+StatusCode MuonAlignmentCondAlg::execute(){
+  ATH_MSG_DEBUG( "execute " << name() ); 
+  ATH_CHECK(loadParameters());
+  return StatusCode::SUCCESS;
+}
 
 StatusCode MuonAlignmentCondAlg::loadParameters() {
 
@@ -229,17 +177,14 @@ StatusCode MuonAlignmentCondAlg::loadAlignABLines() {
     }
   }
 
-  // >>>>>>>>>>>> START: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store >>>>>>>>>>>>
-  // =======================
-  // FIRST Update the MuonDetectorManager and THEN record the ALine.
-  // =======================
-
-  // FIXME: const_cast
-  if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateAlignment(*writeALineCdo).isFailure()) ATH_MSG_ERROR("Unable to updateAlignment" );
-  else ATH_MSG_DEBUG("updateAlignment DONE" );
-  // if (m_muonDetMgrDS->updateAlignment(writeALineCdo.get()).isFailure()) ATH_MSG_ERROR("Unable to updateAlignment" );
-  // else ATH_MSG_DEBUG("updateAlignment DONE" );
-  // <<<<<<<<<<<<< END: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store <<<<<<<<<<<<<
+  // currently, the RPC/TGCRecRoiSvc are services and thus do not participate the scheduling of Read/Write(Cond)Handle(Key)
+  // thus, RPC/TGCRecRoiSvc are not able to use the MuonDetectorCondAlg. To have aligned Roi, here the nominal MuonDetectorManager 
+  // (in the detector store) is updated which is *not* thread-safe. These lines have to be removed as soon as the trigger
+  // group has decided on how to migrate the RPC/TGCRecRoiSvc to MT. Now, only running for serial trigger jobs.
+  if (m_doRecRoiSvcUpdate && Gaudi::Concurrency::ConcurrencyFlags::numThreads()==1) {
+    if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateAlignment(*writeALineCdo).isFailure()) ATH_MSG_ERROR("Unable to updateAlignment" );
+    else ATH_MSG_DEBUG("updateAlignment DONE" );
+  }
 
   if (writeALineHandle.record(rangeALineW, std::move(writeALineCdo)).isFailure()) {
     ATH_MSG_FATAL("Could not record ALineMapContainer " << writeALineHandle.key() 
diff --git a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py
index 0692668867031a6d0fb5ff7ed07c87203463d1e0..f880265dae93f0ca62f17094b2433609fe313db8 100644
--- a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py
+++ b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py
@@ -44,6 +44,7 @@ def MuonGeoModelCfg(flags):
             acc.merge(addFolders( flags, ['/MUONALIGN/TGC/SIDEC'], 'MUONALIGN_OFL', className='CondAttrListCollection'))
 
         MuonAlign = MuonAlignmentCondAlg()
+        if flags.Muon.MuonTrigger: MuonAlign.DoRecRoiSvcUpdate = True # this should be removed as soon as RPC/TGCRecRoiSvc are migrated to use the MuonDetectorCondAlg
         MuonAlign.ParlineFolders = ["/MUONALIGN/MDT/BARREL",
                                     "/MUONALIGN/MDT/ENDCAP/SIDEA",
                                     "/MUONALIGN/MDT/ENDCAP/SIDEC",
diff --git a/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest.ref b/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest.ref
index 19870c902df591399e53249e88245277decfadbc..dcb83378af3ee53e17f8a6e06dd0eec8d0cb80b4 100644
--- a/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest.ref
+++ b/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest.ref
@@ -31,7 +31,6 @@ MdtRdoToMdtPrep...   INFO Processing configuration for layouts with BMG chambers
 MdtRdoToMdtPrep...   INFO Processing configuration for layouts with BME chambers.
 MdtRdoToMdtPrep...   INFO Processing configuration for layouts with BMG chambers.
 MdtRdoToMdtPrep...   INFO Retrieved DecodingTool = PrivateToolHandle('Muon::MdtRdoToPrepDataToolMT/MdtRdoToMdtPrepDataTool')
-CscRdoToCscPrep...   INFO The Geometry version is MuonSpectrometer-R.08.01
 CscRdoToCscPrep...   INFO Retrieved CscRdoToCscPrepDataTool = PrivateToolHandle('Muon::CscRdoToCscPrepDataToolMT/CscRdoToCscPrepDataTool')
 MdtRawDataProvi...   INFO Fraction of fills that use the cache = 0
 TgcRawDataProvi...   INFO Fraction of fills that use the cache = 0
diff --git a/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest_Cache.ref b/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest_Cache.ref
index 19870c902df591399e53249e88245277decfadbc..dcb83378af3ee53e17f8a6e06dd0eec8d0cb80b4 100644
--- a/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest_Cache.ref
+++ b/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest_Cache.ref
@@ -31,7 +31,6 @@ MdtRdoToMdtPrep...   INFO Processing configuration for layouts with BMG chambers
 MdtRdoToMdtPrep...   INFO Processing configuration for layouts with BME chambers.
 MdtRdoToMdtPrep...   INFO Processing configuration for layouts with BMG chambers.
 MdtRdoToMdtPrep...   INFO Retrieved DecodingTool = PrivateToolHandle('Muon::MdtRdoToPrepDataToolMT/MdtRdoToMdtPrepDataTool')
-CscRdoToCscPrep...   INFO The Geometry version is MuonSpectrometer-R.08.01
 CscRdoToCscPrep...   INFO Retrieved CscRdoToCscPrepDataTool = PrivateToolHandle('Muon::CscRdoToCscPrepDataToolMT/CscRdoToCscPrepDataTool')
 MdtRawDataProvi...   INFO Fraction of fills that use the cache = 0
 TgcRawDataProvi...   INFO Fraction of fills that use the cache = 0
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonAlignConfig.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonAlignConfig.py
index 7b5bb0f418ee376f1b5e9d2f1059a911810bf11f..8660ab43458ebb82f41fc9c00ed29282fdcf0ff2 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonAlignConfig.py
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonAlignConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 # read alignment constants from DB to update MuonGeoModel
@@ -42,12 +42,14 @@ condSequence = AthSequencer("AthCondSeq")
 
 from MuonCondAlg.MuonCondAlgConf import MuonAlignmentCondAlg
 MuonAlignAlg = MuonAlignmentCondAlg()
-condSequence+=MuonAlignAlg
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+if TriggerFlags.MuonSlice.doTrigMuonConfig: MuonAlignAlg.DoRecRoiSvcUpdate = True # this should be removed as soon as RPC/TGCRecRoiSvc are migrated to use the MuonDetectorCondAlg
 MuonAlignAlg.ParlineFolders = ["/MUONALIGN/MDT/BARREL",
                                "/MUONALIGN/MDT/ENDCAP/SIDEA",
                                "/MUONALIGN/MDT/ENDCAP/SIDEC",
                                "/MUONALIGN/TGC/SIDEA",
                                "/MUONALIGN/TGC/SIDEC"]
+condSequence+=MuonAlignAlg
 
 # Disable caching. This will have some memory impact (TBC) but is necessary for the moment to make this thread safe.
 MuonDetectorTool.FillCacheInitTime = 1