From 7cacde5d412c618d21bc63a40d7ca30825df77ff Mon Sep 17 00:00:00 2001
From: ckato <ckato@cern.ch>
Date: Sun, 18 Nov 2018 17:20:18 +0100
Subject: [PATCH] adding readCdo in MdtDigitToMdtRDO

---
 .../MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt          | 7 ++++---
 .../MuonByteStreamCnvTest/MdtDigitToMdtRDO.h              | 5 +++++
 .../MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx        | 8 ++++++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt
index 246bb445e22..ef63407e2ca 100644
--- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt
+++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt
@@ -28,18 +28,19 @@ atlas_depends_on_subdirs( PUBLIC
                           MuonSpectrometer/MuonCnv/MuonTGC_CnvTools
                           MuonSpectrometer/MuonDigitContainer
                           MuonSpectrometer/MuonIdHelpers
-                          MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData )
+                          MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData 
+			  MuonSpectrometer/MuonCablings/MuonCablingData )
 
 # Component(s) in the package:
 atlas_add_library( MuonByteStreamCnvTestLib
                    src/*.cxx
                    PUBLIC_HEADERS MuonByteStreamCnvTest
                    LINK_LIBRARIES AthenaBaseComps GaudiKernel MuonReadoutGeometry MuonRDO StoreGateLib SGtests RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib MuonMDT_CablingLib TGCcablingInterfaceLib MuonIdHelpersLib
-                   PRIVATE_LINK_LIBRARIES EventInfo MuonDigitContainer MuonPrepRawData )
+                   PRIVATE_LINK_LIBRARIES EventInfo MuonDigitContainer MuonPrepRawData MuonCablingData )
 
 atlas_add_component( MuonByteStreamCnvTest
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonRDO TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib EventInfo MuonMDT_CablingLib TGCcablingInterfaceLib MuonDigitContainer MuonIdHelpersLib MuonPrepRawData MuonByteStreamCnvTestLib )
+                     LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonRDO TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib EventInfo MuonMDT_CablingLib TGCcablingInterfaceLib MuonDigitContainer MuonIdHelpersLib MuonPrepRawData MuonByteStreamCnvTestLib MuonCablingData )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h
index d0374bdd2aa..1d6c3bc8755 100644
--- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h
+++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h
@@ -12,6 +12,9 @@
 #include "MuonRDO/MdtCsmContainer.h"
 #include "MuonMDT_Cabling/MuonMDT_CablingSvc.h"
 
+#include "MuonCablingData/MuonMDT_CablingMap.h"
+#include "StoreGate/ReadCondHandleKey.h"
+
 class MdtIdHelper;
 
 /////////////////////////////////////////////////////////////////////////////
@@ -36,6 +39,8 @@ class MdtDigitToMdtRDO : public AthAlgorithm {
   bool m_BMEpresent;
   SG::WriteHandleKey<MdtCsmContainer> m_csmContainerKey{this,"OutputObjectName","MDTCSM","WriteHandleKey for Output MdtCsmContainer"};
   SG::ReadHandleKey<MdtDigitContainer> m_digitContainerKey{this,"InputObjectName","MDT_DIGITS","ReadHandleKey for Input MdtDigitContainer"};
+  SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"};
+
 };
 
 #endif
diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx
index 5f6ce979da6..2a748b23c20 100644
--- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx
@@ -44,6 +44,7 @@ StatusCode MdtDigitToMdtRDO::initialize()
   ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_digitContainerKey );
   ATH_CHECK( detStore()->retrieve(m_mdtIdHelper,"MDTIDHELPER") );
   ATH_CHECK( m_cabling.retrieve() );
+  ATH_CHECK( m_readKey.initialize() );
 
   if ( fillTagInfo().isFailure() ) {
     ATH_MSG_WARNING( "Could not fill the tagInfo for MDT cabling"  );
@@ -95,6 +96,13 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const {
 
   MdtCsmIdHash hashF;
 
+  SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey};
+  const MuonMDT_CablingMap* readCdo{*readHandle};
+  if(readCdo==0){
+    ATH_MSG_ERROR("Null pointer to the read conditions object");
+    return StatusCode::FAILURE;
+  }
+
   // Iterate on the collections
   collection_iterator it_coll = container->begin();
   for ( ; it_coll != container->end(); ++it_coll) 
-- 
GitLab