From 09fe2c2083ea34b1903b000ce23bf1c71fdfe3ab Mon Sep 17 00:00:00 2001
From: Constantin Heidegger <constantin.heidegger@cern.ch>
Date: Sat, 13 Jul 2019 13:07:42 +0200
Subject: [PATCH] migrated condition summary services for MDT, RPC, CSC, TGC to
 new MuonCondAlg module and associated files in MuonCondData module; adding
 test files and test algorithm in MuonCondTest module

---
 .../MuonCondAlg/CMakeLists.txt                |  45 +
 .../MuonCondAlg/MuonCondAlg/CscCondDbAlg.h    |  79 ++
 .../MuonCondAlg/MuonCondAlg/MdtCondDbAlg.h    |  88 ++
 .../MuonCondAlg/MuonCondAlg/RpcCondDbAlg.h    |  74 ++
 .../MuonCondAlg/MuonCondAlg/TgcCondDbAlg.h    |  66 ++
 .../MuonCondGeneral/MuonCondAlg/doc/Doxyfile  | 215 +++++
 .../MuonCondAlg/doc/packagedoc.h              |  17 +
 .../MuonCondAlg/doc/used_packages.html        |  10 +
 .../MuonCondAlg/python/AllCondDbAlgConfig.py  |  15 +
 .../MuonCondAlg/python/CscCondDbAlgConfig.py  |   9 +
 .../MuonCondAlg/python/MdtCondDbAlgConfig.py  |   9 +
 .../python/MuonTopCondAlgConfigRUN2.py        |  88 ++
 .../MuonCondAlg/python/RpcCondDbAlgConfig.py  |   9 +
 .../MuonCondAlg/python/TgcCondDbAlgConfig.py  |   9 +
 .../MuonCondAlg/src/CscCondDbAlg.cxx          | 482 ++++++++++
 .../MuonCondAlg/src/MdtCondDbAlg.cxx          | 843 ++++++++++++++++++
 .../MuonCondAlg/src/RpcCondDbAlg.cxx          | 487 ++++++++++
 .../MuonCondAlg/src/TgcCondDbAlg.cxx          | 130 +++
 .../src/components/MuonCondAlg_entries.cxx    |  10 +
 .../MuonCondData/CMakeLists.txt               |  12 +-
 .../MuonCondData/MuonCondData/CscCondDbData.h |  83 ++
 .../MuonCondData/MuonCondData/MdtCondDbData.h | 117 +++
 .../MuonCondData/MuonCondData/RpcCondDbData.h | 127 +++
 .../MuonCondData/MuonCondData/TgcCondDbData.h |  56 ++
 .../MuonCondData/src/CscCondDbData.cxx        | 147 +++
 .../MuonCondData/src/MdtCondDbData.cxx        | 322 +++++++
 .../MuonCondData/src/RpcCondDbData.cxx        | 308 +++++++
 .../MuonCondData/src/TgcCondDbData.cxx        |  61 ++
 .../MuonCondTest/MDTConditionsTestAlgMT.h     |  43 +
 .../share/AllCondSummary_topOptionsMT.py      | 206 +++++
 .../share/MDTCondSummary_topOptionsMT.py      | 157 ++++
 .../src/MDTConditionsTestAlgMT.cxx            | 110 +++
 32 files changed, 4432 insertions(+), 2 deletions(-)
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCondDbAlg.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/RpcCondDbAlg.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcCondDbAlg.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/Doxyfile
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/packagedoc.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/used_packages.html
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MdtCondDbAlgConfig.py
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/RpcCondDbAlgConfig.py
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/TgcCondDbAlgConfig.py
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcCondDbAlg.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/MdtCondDbData.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/RpcCondDbData.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcCondDbData.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/MdtCondDbData.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/RpcCondDbData.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcCondDbData.cxx
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/MDTConditionsTestAlgMT.h
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py
 create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MDTConditionsTestAlgMT.cxx

diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt
new file mode 100644
index 00000000000..bdf50ea2974
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt
@@ -0,0 +1,45 @@
+################################################################################
+# Package: MuonCondAlg
+################################################################################
+
+# Declare the package name:
+atlas_subdir( MuonCondAlg )
+
+# Declare the package's dependencies:
+atlas_depends_on_subdirs( PUBLIC
+                          Control/AthenaBaseComps
+                          Control/AthenaKernel
+                          Control/StoreGate
+                          Database/AthenaPOOL/AthenaPoolUtilities
+                          DetectorDescription/Identifier
+                          GaudiKernel
+                          MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData
+                          MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface
+                          MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc
+                          MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool
+                          PRIVATE
+                          Event/EventInfo
+                          MuonSpectrometer/MuonIdHelpers )
+
+# External dependencies:
+find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
+find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+
+# Component(s) in the package:
+atlas_add_library( MuonCondAlgLib
+                   src/*.cxx
+                   PUBLIC_HEADERS MuonCondAlg
+                   INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
+                   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities Identifier GaudiKernel MuonCondData MuonCondInterface MuonCondSvc MuonCondTool StoreGateLib SGtests MuonIdHelpersLib
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo )
+
+atlas_add_component( MuonCondAlg
+                     src/components/*.cxx
+                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities Identifier GaudiKernel MuonCondData MuonCondInterface MuonCondSvc MuonCondTool EventInfo MuonIdHelpersLib MuonCondAlgLib )
+
+# Install files from the package:
+atlas_install_python_modules( python/*.py )
+atlas_install_joboptions( share/*.py )
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h
new file mode 100644
index 00000000000..107b9b93bdc
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h
@@ -0,0 +1,79 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDALG_CSCCONDDBALG_H
+#define MUONCONDALG_CSCCONDDBALG_H
+
+//STL includes
+#include <string>
+#include <sstream>
+#include <vector>
+#include <zlib.h>
+
+//Gaudi includes
+#include "GaudiKernel/ICondSvc.h"
+#include "GaudiKernel/ToolHandle.h"
+
+//Athena includes
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+#include "Identifier/Identifier.h"
+#include "Identifier/IdentifierHash.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "StoreGate/WriteCondHandleKey.h"
+#include "MuonIdHelpers/MuonIdHelperTool.h"
+#include "MuonCondData/CscCondDbData.h"
+#include "MuonCondSvc/MdtStringUtils.h"
+
+//forward declarations
+class Identifier;
+class IdentifierHash;
+class MuonIdHelper;
+class StatusCode;
+
+namespace Muon {
+  class MuonIdHelperTool;
+}
+
+
+
+class CscCondDbAlg: public AthAlgorithm{
+
+public:
+
+    CscCondDbAlg( const std::string & name, ISvcLocator* svc);
+    virtual ~CscCondDbAlg() = default;
+    virtual StatusCode initialize() override;
+    virtual StatusCode execute   () override;
+    virtual StatusCode finalize  () override;
+
+ 
+private:
+
+    virtual StatusCode loadDataHv   (EventIDRange &, std::unique_ptr<CscCondDbData>&);
+    virtual StatusCode loadDataStat (EventIDRange &, std::unique_ptr<CscCondDbData>&);
+    virtual StatusCode cacheVersion1(std::string   , std::unique_ptr<CscCondDbData>&);
+    virtual StatusCode cacheVersion2(std::string   , std::unique_ptr<CscCondDbData>&);
+	virtual StatusCode onlineToOfflineIds(const unsigned int &, Identifier &, Identifier &) const;
+
+    bool m_isOnline;
+    bool m_isData;  
+    bool m_isRun1;   
+
+    bool m_phiSwapVersion1Strings;
+    bool m_onlineOfflinePhiFlip;
+
+    ServiceHandle<ICondSvc> m_condSvc;
+    ToolHandle<Muon::MuonIdHelperTool> m_idHelper;
+    std::string m_defaultDatabaseReadVersion;
+ 
+    SG::WriteCondHandleKey<CscCondDbData> m_writeKey{this, "WriteKey", "CscCondDbData", "Key of output CSC condition data"};    
+
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_hv  {this, "ReadKey_HV", "/CSC/DCS/LAYERSTATE", "Key of input CSC condition data HV"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_stat{this, "ReadKey_ST", "/CSC/STAT"          , "Key of input CSC condition data stat"};
+
+};
+
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCondDbAlg.h
new file mode 100644
index 00000000000..7a517acea94
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCondDbAlg.h
@@ -0,0 +1,88 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDALG_MDTCONDDBALG_H
+#define MUONCONDALG_MDTCONDDBALG_H
+
+//STL includes
+#include <string>
+#include <vector>
+#include <zlib.h>
+
+//Gaudi includes
+#include "GaudiKernel/ICondSvc.h"
+#include "GaudiKernel/ToolHandle.h"
+
+//Athena includes
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+#include "Identifier/Identifier.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "StoreGate/WriteCondHandleKey.h"
+#include "MuonIdHelpers/MuonIdHelperTool.h"
+#include "MuonCondInterface/IMDT_MapConversion.h"
+#include "MuonCondData/MdtCondDbData.h"
+#include "MuonCondSvc/MdtStringUtils.h"
+
+//forward declarations
+class Identifier;
+class MuonIdHelper;
+class StatusCode;
+class IMDT_MapConversion;
+
+namespace Muon {
+  class MuonIdHelperTool;
+}
+
+
+class MdtCondDbAlg: public AthAlgorithm{
+
+public:
+
+    MdtCondDbAlg( const std::string & name, ISvcLocator* svc);
+    virtual ~MdtCondDbAlg() = default;
+    virtual StatusCode initialize() override;
+    virtual StatusCode execute   () override;
+    virtual StatusCode finalize  () override;
+
+ 
+private:
+
+    virtual StatusCode loadDataPsHv           (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+    virtual StatusCode loadDataPsLv           (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+    virtual StatusCode loadDataHv             (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+    virtual StatusCode loadDataLv             (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+    virtual StatusCode loadDataDroppedChambers(EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+    virtual StatusCode loadMcDroppedChambers  (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+    virtual StatusCode loadMcDeadElements     (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+    virtual StatusCode loadMcDeadTubes        (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+    virtual StatusCode loadMcNoisyChannels    (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
+
+    bool m_isOnline;
+    bool m_isData;  
+    bool m_isRun1;   
+    bool m_checkOnSetPoint;
+
+    ServiceHandle<ICondSvc> m_condSvc;
+    ToolHandle<IMDT_MapConversion> m_condMapTool;
+    ToolHandle<Muon::MuonIdHelperTool> m_idHelper;
+ 
+    SG::WriteCondHandleKey<MdtCondDbData> m_writeKey{this, "WriteKey", "MdtCondDbData", "Key of output MDT condition data"};    
+
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_pshv           {this, "ReadKey_DataR1_HV", "/MDT/DCS/PSHVMLSTATE"      , "Key of input MDT condition data for Run 1 data HV"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_psv0           {this, "ReadKey_DataR1_V0", "/MDT/DCS/PSV0SETPOINTS"    , "Key of input MDT condition data for Run 1 data V0"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_psv1           {this, "ReadKey_DataR1_V1", "/MDT/DCS/PSV1SETPOINTS"    , "Key of input MDT condition data for Run 1 data V1"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_pslv           {this, "ReadKey_DataR1_LV", "/MDT/DCS/PSLVCHSTATE"      , "Key of input MDT condition data for Run 1 data LV"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_droppedChambers{this, "ReadKey_DataR1_DC", "/MDT/DCS/DROPPEDCH"        , "Key of input MDT condition data for Run 1 data dropped chambers"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_hv             {this, "ReadKey_DataR2_HV", "/MDT/DCS/HV"               , "Key of input MDT condition data for Run 2 data HV"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_lv             {this, "ReadKey_DataR2_LV", "/MDT/DCS/LV"               , "Key of input MDT condition data for Run 2 data LV"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_droppedChambers{this, "ReadKey_MC_DC"    , "/MDT/DCS/DROPPEDCH"        , "Key of input MDT condition data for MC dropped chambers"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_deadElements   {this, "ReadKey_MC_DE"    , "/MDT/DQMF/DEAD_ELEMENT"    , "Key of input MDT condition data for MC dead elements"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_deadTubes      {this, "ReadKey_MC_DT"    , "/MDT/TUBE_STATUS/DEAD_TUBE", "Key of input MDT condition data for MC dead tubes"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_noisyChannels  {this, "ReadKey_MC_NC"    , "/MDT/DCS/PSLVCHSTATE"      , "Key of input MDT condition data for MC noisy channels"};
+ 
+};
+
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/RpcCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/RpcCondDbAlg.h
new file mode 100644
index 00000000000..5b6c92febf6
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/RpcCondDbAlg.h
@@ -0,0 +1,74 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDALG_RPCCONDDBALG_H
+#define MUONCONDALG_RPCCONDDBALG_H
+
+//STL includes
+#include <string>
+#include <sstream>
+#include <vector>
+#include <zlib.h>
+
+//Gaudi includes
+#include "GaudiKernel/ICondSvc.h"
+#include "GaudiKernel/ToolHandle.h"
+
+//Athena includes
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+#include "Identifier/Identifier.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "StoreGate/WriteCondHandleKey.h"
+#include "MuonIdHelpers/MuonIdHelperTool.h"
+#include "MuonCondData/RpcCondDbData.h"
+#include "MuonCondSvc/MdtStringUtils.h"
+
+//forward declarations
+class Identifier;
+class MuonIdHelper;
+class StatusCode;
+
+namespace Muon {
+  class MuonIdHelperTool;
+}
+
+
+
+class RpcCondDbAlg: public AthAlgorithm{
+
+public:
+
+    RpcCondDbAlg( const std::string & name, ISvcLocator* svc);
+    virtual ~RpcCondDbAlg() = default;
+    virtual StatusCode initialize() override;
+    virtual StatusCode execute   () override;
+    virtual StatusCode finalize  () override;
+
+ 
+private:
+
+    virtual StatusCode loadDataDeadPanels (EventIDRange &, std::unique_ptr<RpcCondDbData>&);
+    virtual StatusCode loadDataOffPanels  (EventIDRange &, std::unique_ptr<RpcCondDbData>&);
+    virtual StatusCode loadMcElementStatus(EventIDRange &, std::unique_ptr<RpcCondDbData>&);
+
+    bool m_isOnline;
+    bool m_isData;  
+    bool m_isRun1;   
+
+    ServiceHandle<ICondSvc> m_condSvc;
+    ToolHandle<Muon::MuonIdHelperTool> m_idHelper;
+ 
+    SG::WriteCondHandleKey<RpcCondDbData> m_writeKey{this, "WriteKey", "RpcCondDbData", "Key of output RPC condition data"};    
+
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_deadPanels  {this, "ReadKey_DA_DP", "/RPC/DCS/DeadRopanels"   , "Key of input RPC condition data for data dead panels"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_offPanels   {this, "ReadKey_DA_OP", "/RPC/DCS/OffRopanels"    , "Key of input RPC condition data for data off panels"};
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_deadElements{this, "ReadKey_MC_DE", "/RPC/DQMF/ELEMENT_STATUS", "Key of input RPC condition data for MC dead elements"};
+
+	float m_panelEfficiency;
+
+};
+
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcCondDbAlg.h
new file mode 100644
index 00000000000..e4023e09426
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcCondDbAlg.h
@@ -0,0 +1,66 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDALG_TGCCONDDBALG_H
+#define MUONCONDALG_TGCCONDDBALG_H
+
+//STL includes
+#include <string>
+#include <vector>
+#include <zlib.h>
+
+//Gaudi includes
+#include "GaudiKernel/ICondSvc.h"
+#include "GaudiKernel/ToolHandle.h"
+
+//Athena includes
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+#include "Identifier/Identifier.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "StoreGate/WriteCondHandleKey.h"
+#include "MuonIdHelpers/MuonIdHelperTool.h"
+#include "MuonCondData/TgcCondDbData.h"
+#include "MuonCondSvc/MdtStringUtils.h"
+
+//forward declarations
+class Identifier;
+class MuonIdHelper;
+class StatusCode;
+
+namespace Muon {
+  class MuonIdHelperTool;
+}
+
+
+
+class TgcCondDbAlg: public AthAlgorithm{
+
+public:
+
+    TgcCondDbAlg( const std::string & name, ISvcLocator* svc);
+    virtual ~TgcCondDbAlg() = default;
+    virtual StatusCode initialize() override;
+    virtual StatusCode execute   () override;
+    virtual StatusCode finalize  () override;
+
+ 
+private:
+
+    virtual StatusCode loadDetectorStatus(EventIDRange &, std::unique_ptr<TgcCondDbData>&);
+
+    bool m_isOnline;
+    bool m_isData;  
+    bool m_isRun1;   
+
+    ServiceHandle<ICondSvc> m_condSvc;
+    ToolHandle<Muon::MuonIdHelperTool> m_idHelper;
+ 
+    SG::WriteCondHandleKey<TgcCondDbData> m_writeKey{this, "WriteKey", "TgcCondDbData", "Key of output TGC condition data"};    
+    SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_detectorStatus{this, "ReadKey", "/TGC/1/DetectorStatus", "Key of input TGC condition data"};
+
+};
+
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/Doxyfile b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/Doxyfile
new file mode 100644
index 00000000000..67072a6e599
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/Doxyfile
@@ -0,0 +1,215 @@
+# Doxyfile 1.3.9.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = MuonCondAlg
+PROJECT_NUMBER         = MuonCondAlg-00-03-04
+OUTPUT_DIRECTORY = /afs/cern.ch/atlas/maxidisk/d98/13.0.10/InstallArea/doc/MuonCondAlg
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = YES
+FULL_PATH_NAMES        = YES
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = NO
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT =  ../src ../MuonCondAlg ../doc ../share
+FILE_PATTERNS          = *.cxx *.h *.py *.xml *.mk
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = ../doc ../cmt ../share
+EXAMPLE_PATTERNS       = *.cxx *.html requirements *.py
+EXAMPLE_RECURSIVE      = YES
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = YES
+INLINE_SOURCES         = YES
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION    = NO
+VERBATIM_HEADERS       = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = NO
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = YES
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES =  /afs/cern.ch/atlas/maxidisk/d98/13.0.10/InstallArea/doc/MuonCondInterface.tag
+GENERATE_TAGFILE = /afs/cern.ch/atlas/maxidisk/d98/13.0.10/InstallArea/doc/MuonCondAlg.tag
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = YES
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+UML_LOOK               = YES
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DOT_IMAGE_FORMAT       = gif
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/packagedoc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/packagedoc.h
new file mode 100644
index 00000000000..4eb28db8464
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/packagedoc.h
@@ -0,0 +1,17 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+
+@page MuonCondAlg_page MuonCondAlg package
+@author Constantin.Heidegger@cern.ch
+
+ 
+@section MuonCondAlg_MuonCondAlgIntro Introduction
+This package contains the algorithms
+responsible to retrieve the 
+conditions information from the 
+COOL Database and provide it to the clients
+
+*/
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/used_packages.html b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/used_packages.html
new file mode 100644
index 00000000000..f516fc7d769
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/used_packages.html
@@ -0,0 +1,10 @@
+<center><table border="1"><tr><td><center><i>Used packages</i></center></td></tr>
+<tr><td><a href="http://cern.ch/atlas-computing/links/buildDirectory/AtlasCore/13.0.10/InstallArea/doc/GaudiInterface/html/index.html">External/GaudiInterface</a></td></tr>
+<tr><td><a href="http://cern.ch/atlas-computing/links/buildDirectory/AtlasCore/13.0.10/InstallArea/doc/AtlasPolicy/html/index.html">AtlasPolicy</a></td></tr>
+<tr><td><a href="/afs/cern.ch/atlas/maxidisk/d98/13.0.10/InstallArea/doc/MuonCondInterface/html/index.html">MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface</a></td></tr>
+<tr><td><a href="http://cern.ch/atlas-computing/links/buildDirectory/AtlasConditions/13.0.10/InstallArea/doc/MuonIdHelpers/html/index.html">MuonSpectrometer/MuonIdHelpers</a></td></tr>
+<tr><td><a href="http://cern.ch/atlas-computing/links/buildDirectory/AtlasConditions/13.0.10/InstallArea/doc/MuonAlignmentData/html/index.html">MuonSpectrometer/MuonAlignment/MuonAlignmentData</a></td></tr>
+<tr><td><a href="http://cern.ch/atlas-computing/links/buildDirectory/AtlasCore/13.0.10/InstallArea/doc/StoreGate/html/index.html">Control/StoreGate</a></td></tr>
+<tr><td><a href="http://cern.ch/atlas-computing/links/buildDirectory/AtlasConditions/13.0.10/InstallArea/doc/MuonGeoModel/html/index.html">MuonSpectrometer/MuonGeoModel</a></td></tr>
+<tr><td><a href="/afs/cern.ch/atlas/maxidisk/d98/13.0.10/InstallArea/doc/MuonCondCool/html/index.html">MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool</a></td></tr>
+</table></center>
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py
new file mode 100644
index 00000000000..e60a1e711c4
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py
@@ -0,0 +1,15 @@
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.AlgSequence import AthSequencer
+from MuonCondAlg.MuonTopCondAlgConfigRUN2 import MdtCondDbAlg,RpcCondDbAlg,CscCondDbAlg,TgcCondDbAlg
+
+condSequence = AthSequencer("AthCondSeq")
+if not hasattr(condSequence,"MdtCondDbAlg"):
+    condSequence += MdtCondDbAlg("MdtCondDbAlg")
+if not hasattr(condSequence,"RpcCondDbAlg"):
+    condSequence += RpcCondDbAlg("RpcCondDbAlg")
+#if not hasattr(condSequence,"CscCondDbAlg"):
+#    condSequence += CscCondDbAlg("CscCondDbAlg")
+#if not hasattr(condSequence,"TgcCondDbAlg"):
+#    condSequence += TgcCondDbAlg("TgcCondDbAlg")
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py
new file mode 100644
index 00000000000..c513599605d
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py
@@ -0,0 +1,9 @@
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.AlgSequence import AthSequencer
+from MuonCondAlg.MuonTopCondAlgConfigRUN2 import CscCondDbAlg
+
+condSequence = AthSequencer("AthCondSeq")
+if not hasattr(condSequence,"CscCondDbAlg"): 
+    condSequence += CscCondDbAlg("CscCondDbAlg")
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MdtCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MdtCondDbAlgConfig.py
new file mode 100644
index 00000000000..1250da0a14a
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MdtCondDbAlgConfig.py
@@ -0,0 +1,9 @@
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.AlgSequence import AthSequencer
+from MuonCondAlg.MuonTopCondAlgConfigRUN2 import MdtCondDbAlg
+
+condSequence = AthSequencer("AthCondSeq")
+if not hasattr(condSequence,"MdtCondDbAlg"):
+    condSequence += MdtCondDbAlg("MdtCondDbAlg")
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py
new file mode 100644
index 00000000000..7cc2d3120c0
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py
@@ -0,0 +1,88 @@
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+
+## Configuration Access to OFFLINE DB (COMP200)
+
+import copy
+
+from IOVDbSvc.CondDB import conddb
+
+from AthenaCommon import CfgMgr
+from AthenaCommon.AppMgr import ToolSvc, ServiceMgr
+from AthenaCommon.GlobalFlags import globalflags
+from AthenaCommon.Logging import logging
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+
+
+def addFolder(parent, db, folder):
+    log = logging.getLogger(parent.getName())        
+    log.info("Adding folder %s:%s to IOVDbSvc", db, folder)
+    conddb.addFolder(db, folder, className='CondAttrListCollection');
+
+
+class MdtCondDbAlg(CfgMgr.MdtCondDbAlg):
+    def __init__(self,name="MdtCondDbAlg",**kwargs):
+        if athenaCommonFlags.isOnline:
+            kwargs['isOnline'] = True  # COOL folders not available online
+        else:    
+            kwargs['isOnline'] = False # COOL folders not available online
+            if globalflags.DataSource != 'data':
+                kwargs['isData'] = False
+            if globalflags.DataSource == 'data':
+                kwargs['isData'] = True
+                kwargs['isRun1'] = False
+        super(MdtCondDbAlg,self).__init__(name,**kwargs)
+        if globalflags.DataSource == 'data':
+            addFolder(self, "DCS_OFL", "/MDT/DCS/HV")
+            addFolder(self, "DCS_OFL", "/MDT/DCS/LV")
+        else: # if MC or simulation
+            addFolder(self, "DCS_OFL", "/MDT/DCS/DROPPEDCH"  )
+            addFolder(self, "DCS_OFL", "/MDT/DCS/PSLVCHSTATE")
+
+
+class RpcCondDbAlg(CfgMgr.RpcCondDbAlg):
+    def __init__(self,name="RpcCondDbAlg",**kwargs):
+        if athenaCommonFlags.isOnline:
+            kwargs['isOnline'] = True  # COOL folders not available online
+        else:    
+            kwargs['isOnline'] = False # COOL folders not available online
+            if globalflags.DataSource != 'data':
+                kwargs['isData'] = False
+            if globalflags.DataSource == 'data':
+                kwargs['isData'] = True
+                kwargs['isRun1'] = False
+        super(RpcCondDbAlg,self).__init__(name,**kwargs)
+        if globalflags.DataSource == 'data':
+            addFolder(self, "DCS_OFL", "/RPC/DCS/DeadRopanels"   )
+            addFolder(self, "DCS_OFL", "/RPC/DCS/OffRopanels"    )
+            addFolder(self, "RPC_OFL", "/RPC/DQMF/ELEMENT_STATUS")
+        else: # if MC or simulation
+            addFolder(self, "RPC_OFL", "/RPC/DQMF/ELEMENT_STATUS")
+
+class CscCondDbAlg(CfgMgr.CscCondDbAlg):
+    def __init__(self,name="CscCondDbAlg",**kwargs):
+        if athenaCommonFlags.isOnline:
+            kwargs['isOnline'] = True  # COOL folders not available online
+        else:    
+            kwargs['isOnline'] = False # COOL folders not available online
+            if globalflags.DataSource != 'data':
+                kwargs['isData'] = False
+            if globalflags.DataSource == 'data':
+                kwargs['isData'] = True
+                kwargs['isRun1'] = False
+        super(CscCondDbAlg,self).__init__(name,**kwargs)
+        addFolder(self, "CSC_OFL", "/CSC/STAT")
+
+class TgcCondDbAlg(CfgMgr.TgcCondDbAlg):
+    def __init__(self,name="TgcCondDbAlg",**kwargs):
+        if athenaCommonFlags.isOnline:
+            kwargs['isOnline'] = True  # COOL folders not available online
+        else:    
+            kwargs['isOnline'] = False # COOL folders not available online
+            if globalflags.DataSource != 'data':
+                kwargs['isData'] = False
+            if globalflags.DataSource == 'data':
+                kwargs['isData'] = True
+                kwargs['isRun1'] = False
+        super(TgcCondDbAlg,self).__init__(name,**kwargs)
+        addFolder(self, "", "") # which folder?
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/RpcCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/RpcCondDbAlgConfig.py
new file mode 100644
index 00000000000..ceb78ca0786
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/RpcCondDbAlgConfig.py
@@ -0,0 +1,9 @@
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.AlgSequence import AthSequencer
+from MuonCondAlg.MuonTopCondAlgConfigRUN2 import RpcCondDbAlg
+
+condSequence = AthSequencer("AthCondSeq")
+if not hasattr(condSequence,"RpcCondDbAlg"):
+    condSequence += RpcCondDbAlg("RpcCondDbAlg")
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/TgcCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/TgcCondDbAlgConfig.py
new file mode 100644
index 00000000000..700628acff0
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/TgcCondDbAlgConfig.py
@@ -0,0 +1,9 @@
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.AlgSequence import AthSequencer
+from MuonCondAlg.MuonTopCondAlgConfigRUN2 import TgcCondDbAlg
+
+condSequence = AthSequencer("AthCondSeq")
+if not hasattr(condSequence,"TgcCondDbAlg"):
+    condSequence += TgcCondDbAlg("TgcCondDbAlg")
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx
new file mode 100644
index 00000000000..4f64bb8e1c1
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx
@@ -0,0 +1,482 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondAlg/CscCondDbAlg.h"
+#include <zlib.h>
+
+// constructor
+CscCondDbAlg::CscCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) : 
+    AthAlgorithm(name, pSvcLocator),
+    m_condSvc("CondSvc", name),
+    m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"),
+    m_defaultDatabaseReadVersion("02-00")
+  {
+ 
+    declareProperty("IdHelper"                  , m_idHelper                           );
+    declareProperty("defaultDatabaseReadVersion", m_defaultDatabaseReadVersion, "02-00");
+    declareProperty("phiSwapVersion1Strings"    , m_phiSwapVersion1Strings = true      );
+    declareProperty("onlineOfflinePhiFlip"      , m_onlineOfflinePhiFlip = true        );
+
+    declareProperty("isOnline"                  , m_isOnline                           );
+    declareProperty("isData"                    , m_isData                             );
+    declareProperty("isRun1"                    , m_isRun1                             );
+}
+
+
+// Initialize
+StatusCode
+CscCondDbAlg::initialize(){
+
+    ATH_MSG_DEBUG( "initializing " << name() );                
+    ATH_CHECK(m_condSvc .retrieve());
+    ATH_CHECK(m_idHelper.retrieve());
+    ATH_CHECK(m_writeKey.initialize());
+    ATH_CHECK(m_readKey_folder_da_hv  .initialize());
+    ATH_CHECK(m_readKey_folder_da_stat.initialize());
+
+    if(m_condSvc->regHandle(this, m_writeKey).isFailure()) {
+      ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
+      return StatusCode::FAILURE;
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+// finalize
+StatusCode
+CscCondDbAlg::finalize(){
+  return StatusCode::SUCCESS;
+}
+
+
+// execute
+StatusCode 
+CscCondDbAlg::execute(){
+
+    ATH_MSG_DEBUG( "execute " << name() );   
+
+	if(m_isOnline) {
+		ATH_MSG_DEBUG( "IsOnline is set to True; nothing to do!" );   
+		return StatusCode::SUCCESS;
+	}
+ 
+    // launching Write Cond Handle
+    SG::WriteCondHandle<CscCondDbData> writeHandle{m_writeKey};
+    if (writeHandle.isValid()) {
+        ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
+        	  << " In theory this should not be called, but may happen"
+        	  << " if multiple concurrent events are being processed out of order.");
+        return StatusCode::SUCCESS; 
+    }
+    std::unique_ptr<CscCondDbData> writeCdo{std::make_unique<CscCondDbData>()};
+    EventIDRange rangeW;
+    StatusCode sc  = StatusCode::SUCCESS;
+    StatusCode sc0 = StatusCode::SUCCESS;
+
+    // retrieving data
+    if(m_isData) {
+        //sc0 = loadDataHv  (rangeW, writeCdo); if(sc0.isFailure()) {sc = sc0;}
+        sc0 = loadDataStat(rangeW, writeCdo); if(sc0.isFailure()) {sc = sc0;}
+    }
+    else {
+        sc0 = loadDataStat(rangeW, writeCdo); if(sc0.isFailure()) {sc = sc0;}
+    }
+
+    if(sc.isFailure() || sc0.isFailure()){
+        ATH_MSG_WARNING("Could not read data from the DB");
+        return StatusCode::FAILURE;
+    }
+
+    if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
+      ATH_MSG_FATAL("Could not record CscCondDbData " << writeHandle.key() 
+  		  << " with EventRange " << rangeW
+  		  << " into Conditions Store");
+      return StatusCode::FAILURE;
+    }		  
+    ATH_MSG_INFO("Recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
+
+    return StatusCode::SUCCESS;
+}
+
+
+// loadDataHv
+StatusCode
+CscCondDbAlg::loadDataHv(EventIDRange & rangeW, std::unique_ptr<CscCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_hv};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+	std::map<Identifier, int> layerMap;
+    int hv_state, lv_state, hv_setpoint0, hv_setpoint1;
+
+    unsigned int chan_index = 0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+        unsigned int chanNum      = readCdo->chanNum (chan_index);
+        std::string csc_chan_name = readCdo->chanName(chanNum);
+
+        //itr=readCdo->chanAttrListPair(chanNum);
+        const coral::AttributeList& atr = itr->second;
+    
+        if(atr.size()){
+    
+            hv_state     = *(static_cast<const int*>((atr["HVState"    ]).addressOfData()));
+            lv_state     = *(static_cast<const int*>((atr["LVState"    ]).addressOfData()));
+            hv_setpoint0 = *(static_cast<const int*>((atr["HVSetpoint0"]).addressOfData()));
+            hv_setpoint1 = *(static_cast<const int*>((atr["HVSetpoint1"]).addressOfData()));
+    
+            std::string delimiter = "_";
+            std::vector<std::string> tokens;
+            MuonCalib::MdtStringUtils::tokenize(csc_chan_name,tokens,delimiter);
+
+            if((hv_state!=1 or lv_state!=1 or hv_setpoint0 <1000 or hv_setpoint1 <1000) && tokens.size()!=0){
+      
+                std::string layer = tokens[1];
+                std::string number_layer = tokens[1].substr(1,2);   
+                int wirelayer = atoi(const_cast<char*>(number_layer.c_str()));
+
+                int eta=0; 
+                std::string eta_side = tokens[0].substr(0,1);
+                if (eta_side == "A") eta = +1;
+                if (eta_side == "C") eta = -1;
+
+                std::string chamber_name;
+                std::string size_side = tokens[0].substr(1,1);
+                if (size_side == "L") chamber_name = "CSL";
+                if (size_side == "S") chamber_name = "CSS";
+
+                int phi=0;
+                std::string sector_side = tokens[0].substr(2,4);
+                if (sector_side == "01" || sector_side == "02") phi=1;
+                if (sector_side == "03" || sector_side == "04") phi=2;
+                if (sector_side == "05" || sector_side == "06") phi=3;
+                if (sector_side == "07" || sector_side == "08") phi=4;
+                if (sector_side == "09" || sector_side == "10") phi=5;
+                if (sector_side == "11" || sector_side == "12") phi=6;
+                if (sector_side == "13" || sector_side == "14") phi=7;
+                if (sector_side == "15" || sector_side == "16") phi=8;
+      
+                Identifier ChamberId   = m_idHelper->cscIdHelper().elementID(chamber_name, eta, phi);
+                Identifier WireLayerId = m_idHelper->cscIdHelper().channelID(ChamberId, 1, wirelayer,1,1);
+                std::string WireLayerstring = chamber_name+"_"+eta_side+"_"+sector_side+"_"+layer;  
+
+                writeCdo->setDeadLayer(WireLayerstring, WireLayerId);
+                if(layerMap.count(ChamberId)==0) layerMap[ChamberId] = 0;
+                ++layerMap[ChamberId];
+                if(layerMap[ChamberId]==3) writeCdo->setDeadStation(chamber_name, ChamberId);
+            }
+        }
+        chan_index++;
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+
+// loadDataStat
+StatusCode
+CscCondDbAlg::loadDataStat(EventIDRange & rangeW, std::unique_ptr<CscCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_stat};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+       return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+       ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+ 
+    CondAttrListCollection::const_iterator itr;
+
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+        const coral::AttributeList& atr = itr->second;
+        std::string data = atr["Data"].data<std::string>();
+        ATH_MSG_DEBUG("Data is: "<<data);
+ 	
+        std::istringstream ss(data);	
+
+	    if(!ss.good()) {
+            ATH_MSG_WARNING("Failed forming stringstream during caching");
+            continue;
+        }
+
+        std::string version;
+		ss >> version;
+
+        if(version == "1" || atoi(version.c_str()) == 1){
+            if(!cacheVersion1(data, writeCdo).isSuccess()) {
+                ATH_MSG_ERROR("Failed caching from COOL string version 1");
+                return StatusCode::FAILURE;
+            }
+        }
+        else if(version == "02-00") {
+            if(!cacheVersion2(data, writeCdo).isSuccess()) {
+                ATH_MSG_ERROR("Failed caching from COOL string version 02-00");
+                return StatusCode::FAILURE;
+            }
+        }
+        else {
+            // Old version was treated as an actual number rather than string. It was always
+            // set to 1 or sometimes 1.00000, so we convert to integer here and check
+            ATH_MSG_WARNING("Don't recognize CSC COOL string version " << version << ". Will treat as default version " << m_defaultDatabaseReadVersion);
+            if(m_defaultDatabaseReadVersion == "1"){
+                if(!cacheVersion1(data, writeCdo).isSuccess()) {
+                    ATH_MSG_ERROR("Failed caching from COOL string version 1");
+                    return StatusCode::FAILURE;
+                }
+            }
+            else if(m_defaultDatabaseReadVersion == "02-00"){
+                if(!cacheVersion2(data, writeCdo).isSuccess()) {
+                    ATH_MSG_ERROR("Failed caching from COOL string version 02-00");
+                    return StatusCode::FAILURE;
+                }
+            }
+        }
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+// cacheVersion1
+StatusCode 
+CscCondDbAlg::cacheVersion1(std::string data, std::unique_ptr<CscCondDbData>& writeCdo){
+
+	// careful, this is untested yet!
+
+    std::string valueStr;
+	std::istringstream ss(data);
+
+	bool started = false;
+    while(ss.good()) {
+        ss >> valueStr;
+  
+		if(valueStr == "END") break;
+ 
+        if(valueStr == "<BEGIN_DATA>"){
+            started = true;
+			continue;
+		}
+		if(!started) continue;
+
+		ATH_MSG_DEBUG("current element " << valueStr);
+
+        int index = atoi(valueStr.c_str());
+
+		// swapping version 1 strings
+        if(m_phiSwapVersion1Strings){
+            Identifier chanId;
+			IdContext context = m_idHelper->cscIdHelper().channel_context();
+            m_idHelper->cscIdHelper().get_id((IdentifierHash)index, chanId, &context);
+            int stationEta  = m_idHelper->cscIdHelper().stationEta (chanId); // +1 Wheel A   -1 Wheel C
+            int measuresPhi = m_idHelper->cscIdHelper().measuresPhi(chanId); // 0 eta 1 phi
+
+            if(stationEta > 0 && measuresPhi ==1){
+                int stationName  = m_idHelper->cscIdHelper().stationName (chanId); // CSL or CSS
+                int stationPhi   = m_idHelper->cscIdHelper().stationPhi  (chanId); // PhiSector from 1-8
+                int chamberLayer = m_idHelper->cscIdHelper().chamberLayer(chanId); // Either 1 or 2 (but always 2)
+                int wireLayer    = m_idHelper->cscIdHelper().wireLayer   (chanId); // layer in chamber 1-4
+                int strip        = 49 - m_idHelper->cscIdHelper().strip  (chanId);
+
+                Identifier newId = m_idHelper->cscIdHelper().channelID(stationName,stationEta,stationPhi,chamberLayer, wireLayer,measuresPhi,strip);
+                IdentifierHash hash ;
+                m_idHelper->cscIdHelper().get_channel_hash(newId, hash);
+
+				ATH_MSG_VERBOSE("Swapped phi strip "<< m_idHelper->cscIdHelper().show_to_string(chanId) << 
+                                " (" << index << ") to " << m_idHelper->cscIdHelper().show_to_string(newId) << 
+                                " (" << hash << ")");
+                index = hash;
+            }
+            else {
+                ATH_MSG_VERBOSE("Not swapping " << m_idHelper->cscIdHelper().show_to_string(chanId));
+            }
+        }
+
+        writeCdo->setDeadChannelHash((IdentifierHash) index);
+
+    }
+    return StatusCode::SUCCESS;
+}
+
+
+
+// cacheVersion2
+StatusCode 
+CscCondDbAlg::cacheVersion2(std::string data, std::unique_ptr<CscCondDbData>& writeCdo) {
+
+	std::istringstream ss(data);
+    std::string valueStr;
+    unsigned int chanAddress = 0;
+
+	bool started = false;
+    while(ss.good()) {
+        ss >> valueStr;
+
+		if(valueStr == "<END_DATA>") break;
+   
+        if(valueStr == "<BEGIN_DATA>"){
+            started = true;
+			continue;
+		}
+		if(!started) continue;
+		ATH_MSG_DEBUG("current element " << valueStr);
+        std::istringstream iss(valueStr);
+
+
+		// use new iss to translate the hex
+        if(chanAddress==0){
+            iss >> std::hex >> chanAddress;
+            continue;
+        }
+
+		// next element is the status bit
+        unsigned int token;
+        iss >> token;
+
+		ATH_MSG_DEBUG("channel address: " << chanAddress << " and token " << token);
+
+        //remaining categories need offline identifiers
+        Identifier chamberId;
+        Identifier channelId;
+        if(!onlineToOfflineIds(chanAddress, chamberId, channelId).isSuccess())
+            ATH_MSG_ERROR("Cannon get offline Ids from online Id" << std::hex << chanAddress << std::dec);
+		
+        IdentifierHash chanHash;
+        m_idHelper->cscIdHelper().get_channel_hash(channelId, chanHash);
+        writeCdo->setChannelStatus(chanHash, token);
+        chanAddress = 0;
+
+    }
+
+
+    return StatusCode::SUCCESS;
+}
+
+
+
+// onlineToOfflineIds
+StatusCode 
+CscCondDbAlg::onlineToOfflineIds(const unsigned int & onlineId, Identifier &elementId, Identifier &channelId) const {
+    int stationName =       ((onlineId >> 16)&0x1) + 50;
+    int phi =               ((onlineId >> 13)&0x7)+1;
+    int eta =               ((((onlineId >> 12)&0x1) == 1) ? 1:-1);
+    int chamLay =           ((onlineId>>11)&0x1) +1;
+    int wireLay =           ((onlineId>>9)&0x3) +1;
+    int measuresPhi =       ((onlineId >> 8)&0x1);
+    int strip;
+  
+    //Online and offline phi ids are flipped on A wheel
+    if(m_onlineOfflinePhiFlip && measuresPhi && eta == 1){
+      strip = 48 - ((onlineId)&0xff) ; //equivalent: 49 -( onlineId&0xff +1)
+    }
+    else {
+      strip = ((onlineId)&0xff) +1;
+    }
+  
+    elementId = m_idHelper->cscIdHelper().elementID(stationName,eta,phi);
+    channelId = m_idHelper->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip);
+  
+    return StatusCode::SUCCESS;
+}
+
+
+
+
+//// loadDataDeadChambers
+//StatusCode
+//CscCondDbAlg::loadDataDeadChambers(EventIDRange & rangeW, std::unique_ptr<CscCondDbData>& writeCdo){
+//  
+//    ATH_CHECK(m_readKey_folder_da_chambers.initialize());
+//    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_chambers};
+//    const CondAttrListCollection* readCdo{*readHandle}; 
+//    if(readCdo==0){
+//      ATH_MSG_ERROR("Null pointer to the read conditions object");
+//      return StatusCode::FAILURE; 
+//    } 
+//  
+//    if ( !readHandle.range(rangeW) ) {
+//      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+//      return StatusCode::FAILURE;
+//    } 
+//  
+//    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+//    ATH_MSG_INFO("Range of input is " << rangeW);
+//
+//    std::vector<std::string> goodChambers;
+//    std::vector<std::string> deadChambers;
+//
+//    CondAttrListCollection::const_iterator itr;
+//    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+//
+//        const coral::AttributeList& atr = itr->second;
+//        std::string chamber_enabled = *(static_cast<const std::string*>((atr["enabledChambers"]).addressOfData()));
+//    
+//        std::string delimiter = " ";
+//        std::vector<std::string> tokens;
+//        MuonCalib::MdtStringUtils::tokenize(chamber_enabled,tokens,delimiter);
+//    
+//        for (unsigned int i=0; i<tokens.size(); i++) goodChambers.push_back(tokens[i]);
+//    }
+//  
+//    std::string chamber_all[] = {"A01","A02","A03","A04","A05","A06","A07","A08","A09","A10","A11","A12","A13","A14","A15","A16",
+//                                 "C01","C02","C03","C04","C05","C06","C07","C08","C09","C10","C11","C12","C13","C14","C15","C16"};
+//    std::vector<std::string> chamber_v(chamber_all,chamber_all+32);
+//    sort(chamber_v.begin(), chamber_v.end());
+//    
+//    for(unsigned int i=0; i<chamber_v.size(); ++i){
+//        if(!binary_search(goodChambers.begin(), goodChambers.end(), chamber_v[i]))
+//            deadChambers.push_back(chamber_v[i]);
+//    } 
+//
+//    for(unsigned int i=0; i<deadChambers.size(); ++i){
+//        int eta = 0; 
+//        std::string eta_side = deadChambers[i].substr(0,1);
+//        if(eta_side == "A") eta = +1;
+//        if(eta_side == "C") eta = -1;
+//
+//        int phi = 0;
+//        std::string sector_side = deadChambers[i].substr(2,4);
+//        if(sector_side == "01" || sector_side == "02") phi=1;
+//        if(sector_side == "03" || sector_side == "04") phi=2;
+//        if(sector_side == "05" || sector_side == "06") phi=3;
+//        if(sector_side == "07" || sector_side == "08") phi=4;
+//        if(sector_side == "09" || sector_side == "10") phi=5;
+//        if(sector_side == "11" || sector_side == "12") phi=6;
+//        if(sector_side == "13" || sector_side == "14") phi=7;
+//        if(sector_side == "15" || sector_side == "16") phi=8;
+//
+//        std::string chamber_name = "";
+//        if(sector_side == "01" || sector_side == "03" ||sector_side == "05" ||sector_side == "07" || sector_side == "09" || sector_side == "11" || sector_side == "13" || sector_side == "15" ) chamber_name = "CSL";
+//        if(sector_side == "02" || sector_side == "04" || sector_side == "06"|| sector_side == "08" || sector_side == "10"|| sector_side == "12"|| sector_side == "14"|| sector_side == "16") chamber_name = "CSS";
+//
+//        Identifier ChamberId = m_idHelper->cscIdHelper().elementID(chamber_name, eta, phi);
+//		writeCdo->setDeadStation(deadChambers[i], ChamberId);
+//    }
+//
+//    return StatusCode::SUCCESS;
+//}
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx
new file mode 100644
index 00000000000..616ec8100b6
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx
@@ -0,0 +1,843 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondAlg/MdtCondDbAlg.h"
+#include "MuonCondTool/MDT_MapConversion.h"
+#include <zlib.h>
+
+// constructor
+MdtCondDbAlg::MdtCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) : 
+    AthAlgorithm(name, pSvcLocator),
+    m_condSvc("CondSvc", name),
+    m_condMapTool("MDT_MapConversion"),
+    m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool")
+  {
+ 
+    declareProperty("MDT_MapConversion", m_condMapTool);
+    declareProperty("IdHelper"         , m_idHelper   );
+
+    declareProperty("isOnline"         , m_isOnline               );
+    declareProperty("isData"           , m_isData                 );
+    declareProperty("isRun1"           , m_isRun1                 );
+    declareProperty("useRun1SetPoints" , m_checkOnSetPoint = false);
+}
+
+
+// Initialize
+StatusCode
+MdtCondDbAlg::initialize(){
+
+    ATH_MSG_DEBUG( "initializing " << name() );                
+    ATH_CHECK(m_condSvc .retrieve());
+    ATH_CHECK(m_idHelper.retrieve());
+    ATH_CHECK(m_writeKey.initialize());
+    ATH_CHECK(m_readKey_folder_da_pshv.initialize());
+    ATH_CHECK(m_readKey_folder_da_psv0.initialize());
+    ATH_CHECK(m_readKey_folder_da_psv1.initialize());
+    ATH_CHECK(m_readKey_folder_da_pslv.initialize());
+    ATH_CHECK(m_readKey_folder_da_hv  .initialize());
+    ATH_CHECK(m_readKey_folder_da_lv  .initialize());
+    ATH_CHECK(m_readKey_folder_da_droppedChambers.initialize());
+    ATH_CHECK(m_readKey_folder_mc_droppedChambers.initialize());
+    ATH_CHECK(m_readKey_folder_mc_deadElements   .initialize());
+    ATH_CHECK(m_readKey_folder_mc_deadTubes      .initialize());
+    ATH_CHECK(m_readKey_folder_mc_noisyChannels  .initialize());
+
+    if(m_condSvc->regHandle(this, m_writeKey).isFailure()) {
+      ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
+      return StatusCode::FAILURE;
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+// finalize
+StatusCode
+MdtCondDbAlg::finalize(){
+  return StatusCode::SUCCESS;
+}
+
+
+// execute
+StatusCode 
+MdtCondDbAlg::execute(){
+
+    ATH_MSG_DEBUG( "execute " << name() );   
+
+	if(m_isOnline) {
+    	ATH_MSG_DEBUG( "IsOnline is set to True; nothing to do!" );   
+		return StatusCode::SUCCESS;
+	}
+ 
+    // launching Write Cond Handle
+    SG::WriteCondHandle<MdtCondDbData> writeHandle{m_writeKey};
+    if (writeHandle.isValid()) {
+        ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
+        	  << " In theory this should not be called, but may happen"
+        	  << " if multiple concurrent events are being processed out of order.");
+        return StatusCode::SUCCESS; 
+    }
+
+    std::unique_ptr<MdtCondDbData> writeCdo{std::make_unique<MdtCondDbData>()};
+    EventIDRange rangeW;
+    StatusCode sc = StatusCode::SUCCESS;
+
+    // retrieving data
+    if(m_isData && m_isRun1) {
+		if(loadDataPsHv           (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+		if(loadDataPsLv           (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+		if(loadDataDroppedChambers(rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+    }
+    else if(m_isData && !m_isRun1) {
+		if(loadDataHv             (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+		if(loadDataLv             (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+    }
+    else {
+		if(loadMcDroppedChambers  (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+		if(loadMcNoisyChannels    (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+		//if(loadMcDeadElements     (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+		//if(loadMcDeadTubes        (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
+    } 
+    if(sc.isFailure()){ // checking both to avoid "Unchecked StatusCode" error
+        ATH_MSG_WARNING("Could not read data from the DB");
+        return StatusCode::FAILURE;
+    }
+
+    if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
+      ATH_MSG_FATAL("Could not record MdtCondDbData " << writeHandle.key() 
+  		  << " with EventRange " << rangeW
+  		  << " into Conditions Store");
+      return StatusCode::FAILURE;
+    }		  
+    ATH_MSG_INFO("Recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
+
+    return StatusCode::SUCCESS;
+}
+
+
+// loadDataPsHv
+StatusCode
+MdtCondDbAlg::loadDataPsHv(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_pshv};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+
+    std::vector<Identifier> cachedDeadMultiLayersId_standby;
+    CondAttrListCollection::const_iterator itr;
+    unsigned int chan_index=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+        unsigned int chanNum   = readCdo->chanNum (chan_index);
+        std::string hv_payload = readCdo->chanName(chanNum   );
+        std::string hv_name;
+        itr = readCdo->chanAttrListPair(chanNum);
+        const coral::AttributeList& atr = itr->second;
+
+        if(atr.size()==1) {
+            hv_name = *(static_cast<const std::string*>((atr["fsm_currentState"]).addressOfData()));
+            std::string delimiter = " ";
+            std::vector<std::string> tokens;
+            MuonCalib::MdtStringUtils::tokenize(hv_name, tokens, delimiter);
+     
+            std::string thename; 
+            std::string delimiter2 = "_";
+            std::vector<std::string> tokens2;
+            MuonCalib::MdtStringUtils::tokenize(hv_payload, tokens2, delimiter2);
+
+            if(tokens[0]!="ON" && tokens[0]!="STANDBY" && tokens[0]!="UNKNOWN"){
+                int multilayer = atoi(const_cast<char*>(tokens2[3].c_str()));
+                std::string chamber_name = tokens2[2];
+                Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+                Identifier MultiLayerId  = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1);
+                thename = chamber_name+"_multilayer"+tokens2[3];
+                writeCdo->setDeadMultilayer(thename, MultiLayerId);
+                writeCdo->setDeadChamber   (ChamberId);
+                cachedDeadMultiLayersId_standby.push_back(MultiLayerId);
+            }
+            if(tokens[0]=="STANDBY"){
+                int multilayer = atoi(const_cast<char*>(tokens2[3].c_str()));
+                std::string chamber_name = tokens2[2];
+                Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+                Identifier MultiLayerId  = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1);
+                thename = chamber_name+"_multilayer"+tokens2[3];
+                writeCdo->setDeadMultilayer(thename, MultiLayerId);
+                writeCdo->setDeadChamber   (ChamberId);
+                cachedDeadMultiLayersId_standby.push_back(MultiLayerId);
+                //m_Chamber_Naming_standby[int(chanNum)] = MultiLayerId;
+            }
+        }
+        chan_index++;
+    }
+
+
+    // moving on to SetPoints
+    if(!m_checkOnSetPoint) return StatusCode::SUCCESS;
+
+    std::map<Identifier, float> chamberML_V1;
+    std::map<Identifier, float> chamberML_V0; 
+    std::map<Identifier, std::string> mlname;
+ 
+    // V0 handle
+    SG::ReadCondHandle<CondAttrListCollection> readHandle_v0{m_readKey_folder_da_psv0};
+    const CondAttrListCollection* readCdo_v0{*readHandle_v0}; 
+    if(readCdo_v0==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle_v0.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle_v0.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle_v0.fullKey() << " readCdo->size()= " << readCdo_v0->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    // V1
+    SG::ReadCondHandle<CondAttrListCollection> readHandle_v1{m_readKey_folder_da_psv1};
+    const CondAttrListCollection* readCdo_v1{*readHandle_v1}; 
+    if(readCdo_v1==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle_v1.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle_v1.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle_v1.fullKey() << " readCdo->size()= " << readCdo_v1->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    // V0 iteration
+    CondAttrListCollection::const_iterator itr_v0;
+    unsigned int chan_index_v0=0; 
+    for(itr_v0 = readCdo_v0->begin(); itr_v0 != readCdo_v0->end(); ++itr_v0) {
+      
+        unsigned int chanNum            = readCdo_v0->chanNum  (chan_index_v0);
+        std::string setPointsV0_payload = readCdo_v0->chanName(chanNum);
+        
+        float setPointsV0_name;
+           
+        itr_v0 = readCdo_v0->chanAttrListPair(chanNum);
+        const coral::AttributeList& atr_v0 = itr_v0->second;
+            
+        if(atr_v0.size()==1){
+            setPointsV0_name = *(static_cast<const float*>((atr_v0["readBackSettings_v0"]).addressOfData()));
+            std::string delimiter2 = "_";
+            std::vector<std::string> tokens2;
+            MuonCalib::MdtStringUtils::tokenize(setPointsV0_payload, tokens2, delimiter2);
+            //chamberML_V0_chanum[int(chanNum)] = float(setPointsV0_name);
+        
+            int multilayer = atoi(const_cast<char*>(tokens2[3].c_str()));
+            std::string chamber_name     = tokens2[2];
+            std::string thename          = chamber_name+"_"+tokens2[3];
+            Identifier ChamberId         = m_condMapTool->ConvertToOffline(chamber_name);
+            Identifier MultiLayerId      = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1);
+            chamberML_V0[MultiLayerId]   = setPointsV0_name;
+            mlname[MultiLayerId]         = thename;
+      
+        }
+        chan_index_v0++;
+    }
+
+    // V1 iteration
+    CondAttrListCollection::const_iterator itr_v1;
+    unsigned int chan_index_v1=0; 
+    for(itr_v1 = readCdo_v1->begin(); itr_v1 != readCdo_v1->end(); ++itr_v1) {
+      
+        unsigned int chanNum            = readCdo_v1->chanNum(chan_index_v1);
+        std::string setPointsV1_payload = readCdo_v1->chanName(chanNum);
+        float setPointsV1_name;
+        itr_v1 = readCdo_v1-> chanAttrListPair(chanNum);
+        const coral::AttributeList& atr_v1 = itr_v1->second;
+    
+        if(atr_v1.size()==1){
+            setPointsV1_name = *(static_cast<const float*>((atr_v1["readBackSettings_v1"]).addressOfData()));
+               
+            std::string delimiter2 = "_";
+            std::vector<std::string> tokens2;
+            MuonCalib::MdtStringUtils::tokenize(setPointsV1_payload, tokens2, delimiter2);
+            //chamberML_V1_chanum[int(chanNum)] = float(setPointsV1_name);
+           
+            int multilayer = atoi(const_cast<char*>(tokens2[3].c_str()));
+            std::string chamber_name     = tokens2[2];
+            std::string thename          = chamber_name+"_"+tokens2[3];
+            Identifier ChamberId         = m_condMapTool->ConvertToOffline(chamber_name);
+            Identifier MultiLayerId      = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1);
+            chamberML_V1[MultiLayerId]   = setPointsV1_name;
+            mlname[MultiLayerId]         = thename;
+          
+        }
+        chan_index_v1++;
+    }
+    
+    // check for chamber standby the correct value of Setpoint V0 vs SetpointV1
+    // for chamber StandBy --> V0==V1 to be on
+    for (unsigned int vect=0; vect<cachedDeadMultiLayersId_standby.size(); vect++){
+        Identifier MultilayerId_ch = cachedDeadMultiLayersId_standby[vect];
+        
+        if (chamberML_V1.find(MultilayerId_ch)->second == chamberML_V0.find(MultilayerId_ch)->second){
+            ATH_MSG_DEBUG( "Chamber has  correct Voltage V1 = "<< chamberML_V1.find(MultilayerId_ch)->second<<" V0=   " << chamberML_V0.find(MultilayerId_ch)->second );
+        }
+        else{
+            ATH_MSG_DEBUG( "Chamber has  wrong correct Voltage V1 = "<< chamberML_V1.find(MultilayerId_ch)->second<<" V0=   " << chamberML_V0.find(MultilayerId_ch)->second);
+            ATH_MSG_DEBUG( "Has to be masked!!!");
+            writeCdo->setDeadMultilayer(mlname[MultilayerId_ch], MultilayerId_ch);
+        }
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+
+// loadDataPsLv
+StatusCode 
+MdtCondDbAlg::loadDataPsLv(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_pslv};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    unsigned int chan_index=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+        unsigned int chanNum = readCdo->chanNum(chan_index);
+        std::string hv_name;
+        std::string hv_payload = readCdo->chanName(chanNum);
+        
+        itr = readCdo-> chanAttrListPair(chanNum);
+        const coral::AttributeList& atr=itr->second;
+    
+        if(atr.size()){
+            hv_name = *(static_cast<const std::string*>((atr["fsmCurrentState"]).addressOfData()));
+            std::string delimiter = " ";
+            std::vector<std::string> tokens;
+            MuonCalib::MdtStringUtils::tokenize(hv_name, tokens, delimiter);
+            std::string delimiter2 = "_";
+            std::vector<std::string> tokens2;
+            MuonCalib::MdtStringUtils::tokenize(hv_payload,tokens2,delimiter2);
+      
+            if(tokens[0]!="ON"){
+                std::string chamber_name= tokens2[2];
+	            Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name);
+                writeCdo->setDeadStation(chamber_name, ChamberId);
+            }
+        }
+        chan_index++;
+    }
+  
+    return StatusCode::SUCCESS;
+}
+
+
+
+// loadDataHv
+StatusCode
+MdtCondDbAlg::loadDataHv(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_hv};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    unsigned int chan_index=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+        unsigned int chanNum   = readCdo->chanNum(chan_index);
+        std::string hv_name_ml1, hv_name_ml2;
+        std::string hv_payload = readCdo->chanName(chanNum);
+        float hv_v0_ml1, hv_v0_ml2, hv_v1_ml1, hv_v1_ml2;
+        itr = readCdo->chanAttrListPair(chanNum);
+        const coral::AttributeList& atr = itr->second;
+
+        if(atr.size()) {
+            hv_name_ml1 = *(static_cast<const std::string*>((atr["fsmCurrentState_ML1"]).addressOfData()));
+            hv_name_ml2 = *(static_cast<const std::string*>((atr["fsmCurrentState_ML2"]).addressOfData()));
+            hv_v0_ml1   = *(static_cast<const float*>((atr["v0set_ML1"]).addressOfData()));
+            hv_v1_ml1   = *(static_cast<const float*>((atr["v1set_ML1"]).addressOfData()));
+            hv_v0_ml2   = *(static_cast<const float*>((atr["v0set_ML2"]).addressOfData()));
+            hv_v1_ml2   = *(static_cast<const float*>((atr["v1set_ML2"]).addressOfData()));
+
+            std::string thename;            
+            std::string delimiter2 = "_";
+            std::vector<std::string> tokens2;
+            MuonCalib::MdtStringUtils::tokenize(hv_payload, tokens2, delimiter2);
+
+            if(hv_name_ml1 !="ON" && hv_name_ml1 !="STANDBY" && hv_name_ml1 !="UNKNOWN"){
+	            int multilayer = 1;
+	            std::string chamber_name = tokens2[0];
+	            Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+	            Identifier MultiLayerId  = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer, 1, 1);
+                thename = chamber_name+"_multilayer1";
+                writeCdo->setDeadMultilayer(thename, MultiLayerId);
+                writeCdo->setDeadChamber   (ChamberId);
+            }
+      
+            if(hv_name_ml1=="STANDBY" && hv_v0_ml1 != hv_v1_ml1){
+	            int multilayer = 1;
+	            std::string chamber_name = tokens2[0];
+	            Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+	            Identifier MultiLayerId  = m_idHelper->mdtIdHelper().channelID(ChamberId, multilayer, 1, 1);
+                thename = chamber_name+"_multilayer1";
+                writeCdo->setDeadMultilayer(thename, MultiLayerId);
+                writeCdo->setDeadChamber   (ChamberId);
+            }
+
+            if(hv_name_ml2 !="ON" && hv_name_ml2 !="STANDBY" && hv_name_ml2 !="UNKNOWN"){
+	            int multilayer = 2;
+	            std::string chamber_name = tokens2[0];
+	            Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+	            Identifier MultiLayerId  = m_idHelper->mdtIdHelper().channelID(ChamberId, multilayer, 1, 1);
+                thename = chamber_name+"_multilayer2";
+                writeCdo->setDeadMultilayer(thename, MultiLayerId);
+                writeCdo->setDeadChamber   (ChamberId);
+            }
+      
+            if(hv_name_ml2=="STANDBY" && hv_v0_ml2 != hv_v1_ml2){
+	            int multilayer = 2;
+	            std::string chamber_name = tokens2[0];
+	            Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+	            Identifier MultiLayerId  = m_idHelper->mdtIdHelper().channelID(ChamberId, multilayer, 1, 1);
+                thename = chamber_name+"_multilayer2";
+                writeCdo->setDeadMultilayer(thename, MultiLayerId);
+                writeCdo->setDeadChamber   (ChamberId);
+            }
+
+            if(hv_name_ml2 !="ON" && hv_name_ml2 !="STANDBY" && hv_name_ml2 !="UNKNOWN" && hv_name_ml1 !="ON" && hv_name_ml1 !="STANDBY" && hv_name_ml1 !="UNKNOWN" ){
+                std::string chamber_name = tokens2[0];
+                Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+                writeCdo->setDeadStation(chamber_name, ChamberId);
+            }
+            if(hv_name_ml2=="STANDBY" && hv_v0_ml2 != hv_v1_ml2 && hv_name_ml1=="STANDBY" && hv_v0_ml1 != hv_v1_ml1){
+                std::string chamber_name = tokens2[0];
+                Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+                writeCdo->setDeadStation(chamber_name, ChamberId);
+            }
+        }  
+        chan_index++;
+    }
+    return StatusCode::SUCCESS;
+}
+
+
+// loadDataLv
+StatusCode 
+MdtCondDbAlg::loadDataLv(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){
+
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_lv};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    unsigned int chan_index=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+    
+        unsigned int chanNum = readCdo->chanNum(chan_index);
+        std::string hv_name;
+        std::string hv_payload = readCdo->chanName(chanNum);
+        
+        itr = readCdo->chanAttrListPair(chanNum);
+        const coral::AttributeList& atr = itr->second;
+    
+        if(atr.size()){
+            hv_name = *(static_cast<const std::string*>((atr["fsmCurrentState_LV"]).addressOfData()));
+            std::string delimiter = " ";
+            std::vector<std::string> tokens;
+            MuonCalib::MdtStringUtils::tokenize(hv_name, tokens, delimiter);
+            std::string delimiter2 = "_";
+            std::vector<std::string> tokens2;
+            MuonCalib::MdtStringUtils::tokenize(hv_payload,tokens2,delimiter2);
+      
+            if(tokens[0]!="ON"){
+                std::string chamber_name= tokens2[0];
+	            Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name);
+                writeCdo->setDeadStation(chamber_name, ChamberId);
+            }
+        }
+        chan_index++;
+    }
+  
+    return StatusCode::SUCCESS;
+  
+}
+
+
+
+//loadDataDroppedChambers
+StatusCode 
+MdtCondDbAlg::loadDataDroppedChambers(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){
+
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_droppedChambers};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    //unsigned int chan_index=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+        const coral::AttributeList& atr = itr->second;
+        std::string chamber_dropped;
+        chamber_dropped = *(static_cast<const std::string*>((atr["Chambers_disabled"]).addressOfData()));
+    
+        std::string delimiter = " ";
+        std::vector<std::string> tokens;
+        MuonCalib::MdtStringUtils::tokenize(chamber_dropped,tokens,delimiter);
+        for (unsigned int i=0; i<tokens.size(); i++) {
+            if(tokens[i]!="0"){
+	            std::string chamber_name = tokens[i];
+	            Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name);
+                writeCdo->setDeadStation(chamber_name, ChamberId);
+            }
+        }
+    }
+    return StatusCode::SUCCESS;
+}
+
+
+
+// loadMcDroppedChambers
+StatusCode
+MdtCondDbAlg::loadMcDroppedChambers(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo) {
+
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_droppedChambers};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+        const coral::AttributeList& atr = itr->second;
+        std::string chamber_name;
+        chamber_name = *(static_cast<const std::string*>((atr["Chambers_disabled"]).addressOfData()));
+    
+        Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name);
+        writeCdo->setDeadChamber(ChamberId);
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+// loadMcDeadElements
+StatusCode
+MdtCondDbAlg::loadMcDeadElements(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo) {
+
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_deadElements};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+    
+        const coral::AttributeList& atr = itr->second;
+        std::string chamber_name, list_mlayer, list_layer, list_tube;
+
+        chamber_name = *(static_cast<const std::string*>((atr["Chambers_Name"  ]).addressOfData()));
+        list_mlayer  = *(static_cast<const std::string*>((atr["Dead_multilayer"]).addressOfData()));
+        list_layer   = *(static_cast<const std::string*>((atr["Dead_layer"     ]).addressOfData()));
+        list_tube    = *(static_cast<const std::string*>((atr["Dead_tube"      ]).addressOfData()));
+ 
+        std::string thename; 
+        std::string delimiter = " ";
+        std::vector<std::string> tokens;
+        std::vector<std::string> tokens_mlayer;
+        std::vector<std::string> tokens_layer;
+        Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name);
+        MuonCalib::MdtStringUtils::tokenize(list_tube  , tokens       , delimiter);
+        MuonCalib::MdtStringUtils::tokenize(list_mlayer, tokens_mlayer, delimiter);
+        MuonCalib::MdtStringUtils::tokenize(list_layer , tokens_layer , delimiter);
+    
+        for(unsigned int i=0; i<tokens.size(); i++){
+            if(tokens[i]!="0"){
+                int ml    = atoi(const_cast<char*>((tokens[i].substr(0,1)).c_str()));
+                int layer = atoi(const_cast<char*>((tokens[i].substr(1,2)).c_str()));
+                int tube  = atoi(const_cast<char*>((tokens[i].substr(2  )).c_str()));
+                Identifier ChannelId = m_idHelper->mdtIdHelper().channelID(ChamberId, ml, layer, tube);
+                thename = chamber_name+"_"+tokens[i];
+                writeCdo->setDeadTube   (thename, ChannelId);
+                writeCdo->setDeadChamber(ChamberId);
+            }
+        }
+
+        for(unsigned int i=0; i<tokens_mlayer.size(); i++){
+            if(tokens_mlayer[i]!="0"){
+                int ml = atoi(const_cast<char*>((tokens_mlayer[i].substr(0)).c_str()));
+                Identifier ChannelId = m_idHelper->mdtIdHelper().channelID(ChamberId,ml,1,1);
+                thename = chamber_name+"_"+tokens[i];
+                writeCdo->setDeadMultilayer(thename, ChannelId);
+                writeCdo->setDeadChamber   (ChamberId);
+            }
+        }
+      
+        for(unsigned int i=0; i<tokens_layer.size(); i++) {
+            if(tokens_layer[i]!="0"){
+                int ml    = atoi(const_cast<char*>((tokens_layer[i].substr(0,1)).c_str()));
+                int layer = atoi(const_cast<char*>((tokens_layer[i].substr(1  )).c_str()));
+                Identifier ChannelId = m_idHelper->mdtIdHelper().channelID(ChamberId, ml, layer, 1);
+                thename = chamber_name+"_"+tokens[i];
+                writeCdo->setDeadLayer  (thename, ChannelId);
+                writeCdo->setDeadChamber(ChamberId);
+            }
+        }
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+
+//loadMcDeadTubes
+StatusCode 
+MdtCondDbAlg::loadMcDeadTubes(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo) {
+
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_deadTubes};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+        const coral::AttributeList& atr=itr->second;
+        
+        std::string chamber_name;
+        std::string dead_tube;
+        std::string tube_list;
+        dead_tube    = *(static_cast<const std::string*>((atr["DeadTube_List"]).addressOfData()));
+        chamber_name = *(static_cast<const std::string*>((atr["Chamber_Name" ]).addressOfData()));
+
+        std::string thename;
+        std::vector<std::string> tokens;
+        std::string delimiter = " ";
+        MuonCalib::MdtStringUtils::tokenize(dead_tube, tokens, delimiter);
+        Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name);
+
+        for (unsigned int i=0; i<tokens.size(); i++) {
+            int ml    = atoi(const_cast<char*>((tokens[i].substr(0,1)).c_str()));
+            int layer = atoi(const_cast<char*>((tokens[i].substr(1,2)).c_str()));
+            int tube  = atoi(const_cast<char*>((tokens[i].substr(2  )).c_str()));
+            thename   = chamber_name+"_"+tokens[i];
+            tube_list = tokens[i]+".";
+            Identifier ChannelId = m_idHelper->mdtIdHelper().channelID(ChamberId, ml, layer, tube); 
+		    writeCdo->setDeadTube(thename, ChannelId);
+        }
+		writeCdo->setDeadChamber(ChamberId);
+    }
+  
+    return StatusCode::SUCCESS;
+}
+
+
+
+// loadMcNoisyChannels
+StatusCode 
+MdtCondDbAlg::loadMcNoisyChannels(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo) {
+
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_noisyChannels};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    unsigned int chan_index=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+        unsigned int chanNum   = readCdo->chanNum (chan_index);
+        std::string hv_payload = readCdo->chanName(chanNum   );
+        std::string hv_name;
+        itr = readCdo->chanAttrListPair(chanNum);
+        const coral::AttributeList& atr = itr->second;
+
+        if(atr.size()==1) {
+            hv_name = *(static_cast<const std::string*>((atr["fsm_currentState"]).addressOfData()));
+            std::string delimiter = " ";
+            std::vector<std::string> tokens;
+            MuonCalib::MdtStringUtils::tokenize(hv_name, tokens, delimiter);
+     
+            std::string thename; 
+            std::string delimiter2 = "_";
+            std::vector<std::string> tokens2;
+            MuonCalib::MdtStringUtils::tokenize(hv_payload, tokens2, delimiter2);
+
+            if(tokens[0]!="ON" && tokens[0]!="STANDBY" && tokens[0]!="UNKNOWN"){
+                int multilayer = atoi(const_cast<char*>(tokens2[3].c_str()));
+                std::string chamber_name = tokens2[2];
+                Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+                Identifier MultiLayerId  = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1);
+                thename = chamber_name+"_multilayer"+tokens2[3];
+                writeCdo->setDeadMultilayer(thename, MultiLayerId);
+                writeCdo->setDeadChamber   (ChamberId);
+            }
+            if(tokens[0]=="STANDBY"){
+                int multilayer = atoi(const_cast<char*>(tokens2[3].c_str()));
+                std::string chamber_name = tokens2[2];
+                Identifier ChamberId     = m_condMapTool->ConvertToOffline(chamber_name);
+                Identifier MultiLayerId  = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1);
+                thename = chamber_name+"_multilayer"+tokens2[3];
+                writeCdo->setDeadMultilayer(thename, MultiLayerId);
+                writeCdo->setDeadChamber   (ChamberId);
+            }
+        }
+        chan_index++;
+    }
+	return StatusCode::SUCCESS;
+}
+
+
+//inline bool 
+//MdtCondDbAlg::uncompressInMyBuffer(const coral::Blob &blob) {
+//    if (!m_decompression_buffer) {
+//        m_buffer_length= 50000;
+//        m_decompression_buffer = new Bytef[m_buffer_length];
+//    }
+//    uLongf actual_length; 
+//    while(1) {
+//        actual_length=m_buffer_length;
+//        int res(uncompress(m_decompression_buffer, &actual_length, reinterpret_cast<const Bytef *>(blob.startingAddress()), static_cast<uLongf>(blob.size())));
+//        if (res == Z_OK) break;
+//        //double buffer if it was not big enough
+//        if( res == Z_BUF_ERROR) {
+//          m_buffer_length*=2;
+//          ATH_MSG_VERBOSE(  "Increasing buffer to " << m_buffer_length);
+//          delete [] m_decompression_buffer;
+//          m_decompression_buffer = new Bytef[m_buffer_length];
+//          continue;
+//        }
+//        //something else is wrong
+//        return false;
+//    }
+//    //append 0 to terminate string, increase buffer if it is not big enough
+//    if (actual_length >= m_buffer_length) {
+//        Bytef * old_buffer=m_decompression_buffer;
+//        size_t old_length=m_buffer_length;
+//        m_buffer_length*=2;
+//        m_decompression_buffer = new Bytef[m_buffer_length];
+//        memcpy(m_decompression_buffer, old_buffer, old_length);
+//        delete [] old_buffer;
+//    }
+//    m_decompression_buffer[actual_length]=0;
+//    return true;
+//} 
+//
+//
+//inline StatusCode 
+//MdtCondDbAlg::extractString(std::string &input, std::string &output, std::string separator) {
+//    unsigned long int pos = 0;
+//    std::string::size_type start = input.find_first_not_of(separator.c_str(),pos);
+//    if(start == std::string::npos) {
+//        ATH_MSG_ERROR("MdtCondDbAlg::extractString: Cannot extract string in a proper way!");
+//        return StatusCode::FAILURE;
+//    }
+//    std::string::size_type stop = input.find_first_of(separator.c_str(),start+1);
+//    if (stop == std::string::npos) stop = input.size();
+//    output = input.substr(start,stop-start);
+//    input.erase(pos,stop-pos);
+//
+//    return StatusCode::SUCCESS;
+//}  
+
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx
new file mode 100644
index 00000000000..70c409af62c
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx
@@ -0,0 +1,487 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondAlg/RpcCondDbAlg.h"
+#include <zlib.h>
+
+// constructor
+RpcCondDbAlg::RpcCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) : 
+    AthAlgorithm(name, pSvcLocator),
+    m_condSvc("CondSvc", name),
+    m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool")
+  {
+ 
+    declareProperty("IdHelper"         , m_idHelper   );
+    declareProperty("isOnline"                 , m_isOnline                                           );
+    declareProperty("isData"                   , m_isData                                             );
+    declareProperty("isRun1"                   , m_isRun1                                             );
+	declareProperty("PanelEfficiency"          , m_panelEfficiency        = 0.50                      ); 
+}
+
+
+// Initialize
+StatusCode
+RpcCondDbAlg::initialize(){
+
+    ATH_MSG_DEBUG( "initializing " << name() );                
+    ATH_CHECK(m_condSvc .retrieve());
+    ATH_CHECK(m_idHelper.retrieve());
+    ATH_CHECK(m_writeKey.initialize());
+    ATH_CHECK(m_readKey_folder_da_deadPanels  .initialize());
+    ATH_CHECK(m_readKey_folder_da_offPanels   .initialize());
+    ATH_CHECK(m_readKey_folder_mc_deadElements.initialize());
+
+    if(m_condSvc->regHandle(this, m_writeKey).isFailure()) {
+      ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
+      return StatusCode::FAILURE;
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+// finalize
+StatusCode
+RpcCondDbAlg::finalize(){
+  return StatusCode::SUCCESS;
+}
+
+
+// execute
+StatusCode 
+RpcCondDbAlg::execute(){
+
+    ATH_MSG_DEBUG( "execute " << name() );   
+ 
+	if(m_isOnline) {
+		ATH_MSG_DEBUG( "IsOnline is set to True; nothing to do!" );   
+		return StatusCode::SUCCESS;
+	}
+
+    // launching Write Cond Handle
+    SG::WriteCondHandle<RpcCondDbData> writeHandle{m_writeKey};
+    if (writeHandle.isValid()) {
+        ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
+        	  << " In theory this should not be called, but may happen"
+        	  << " if multiple concurrent events are being processed out of order.");
+        return StatusCode::SUCCESS; 
+    }
+    std::unique_ptr<RpcCondDbData> writeCdo{std::make_unique<RpcCondDbData>()};
+    EventIDRange rangeW;
+    StatusCode sc  = StatusCode::SUCCESS;
+    StatusCode sc0 = StatusCode::SUCCESS;
+
+    // retrieving data
+    if(m_isData) {
+        sc0 = loadDataDeadPanels (rangeW, writeCdo); if(sc0.isFailure()) {sc = sc0;}
+        sc0 = loadDataOffPanels  (rangeW, writeCdo); if(sc0.isFailure()) {sc = sc0;}
+        sc0 = loadMcElementStatus(rangeW, writeCdo); if(sc0.isFailure()) {sc = sc0;}
+    }
+    else {
+        sc0 = loadMcElementStatus(rangeW, writeCdo); if(sc0.isFailure()) {sc = sc0;}
+    } 
+    if(sc.isFailure()){
+        ATH_MSG_WARNING("Could not read data from the DB");
+        return StatusCode::FAILURE;
+    }
+
+    if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
+      ATH_MSG_FATAL("Could not record RpcCondDbData " << writeHandle.key() 
+  		  << " with EventRange " << rangeW
+  		  << " into Conditions Store");
+      return StatusCode::FAILURE;
+    }		  
+    ATH_MSG_INFO("Recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
+
+    return StatusCode::SUCCESS;
+}
+
+
+// loadDataDeadPanels
+StatusCode
+RpcCondDbAlg::loadDataDeadPanels(EventIDRange & rangeW, std::unique_ptr<RpcCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_deadPanels};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    unsigned int chan_index=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+		unsigned int chanNum    = readCdo->chanNum (chan_index);
+		std::string sector_name = readCdo->chanName(chanNum);
+		
+		const coral::AttributeList& atr=itr->second;
+		
+		std::string panel_dead;
+		std::string panel_reason;
+		if(atr.size()){
+			panel_dead   = *(static_cast<const std::string*>((atr["RpcDeadROPanelIds"    ]).addressOfData()));  
+			panel_reason = *(static_cast<const std::string*>((atr["RpcDeadROPanelReasons"]).addressOfData()));  
+			
+			ATH_MSG_DEBUG("panel_dead "   << panel_dead  );
+			ATH_MSG_DEBUG("panel_reason " << panel_reason);
+			
+			char * ch_tmp;
+			std::string delimiter = ",";
+			std::vector<std::string> info_panel;
+			MuonCalib::MdtStringUtils::tokenize(panel_dead,info_panel,delimiter);
+			
+			Identifier PanelId;
+			
+			for(unsigned int i=0; i<info_panel.size();i++){
+				ch_tmp  = const_cast<char*>(info_panel[i].c_str());
+				PanelId = atoi(ch_tmp);
+				ATH_MSG_DEBUG("info_panel " << ch_tmp << " " << atoi(ch_tmp));
+				
+				if(PanelId.get_compact()){
+					ATH_MSG_DEBUG("DEADPANEL " << m_idHelper->rpcIdHelper().show_to_string(PanelId));
+					Identifier atlasId = m_idHelper->rpcIdHelper().panelID(PanelId);
+					std::stringstream ss;
+					ss << "panel_" << sector_name << "_" << m_idHelper->rpcIdHelper().show_to_string(PanelId);
+					if(atlasId!=0) writeCdo->setDeadPanel(ss.str(), atlasId);
+					ATH_MSG_DEBUG("push-back");
+				}
+			}  
+		}
+        chan_index++;
+    }
+    return StatusCode::SUCCESS;
+}
+
+
+// loadDataOffPanels
+StatusCode
+RpcCondDbAlg::loadDataOffPanels(EventIDRange & rangeW, std::unique_ptr<RpcCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_offPanels};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    unsigned int chan_index=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+		unsigned int chanNum    = readCdo->chanNum (chan_index);
+		std::string sector_name = readCdo->chanName(chanNum);
+		
+		const coral::AttributeList& atr=itr->second;
+		
+		std::string panel_off;
+		std::string panel_reason;
+		if(atr.size()){
+			panel_off    = *(static_cast<const std::string*>((atr["RpcOffROPanelIds"    ]).addressOfData()));
+			panel_reason = *(static_cast<const std::string*>((atr["RpcOffROPanelReasons"]).addressOfData()));
+
+			ATH_MSG_DEBUG("panel_off "    << panel_off   );
+			ATH_MSG_DEBUG("panel_reason " << panel_reason);
+			
+			char * ch_tmp;
+			std::string delimiter = ",";
+			std::vector<std::string> info_panel;
+			MuonCalib::MdtStringUtils::tokenize(panel_off,info_panel,delimiter);
+			
+			Identifier PanelId;
+			
+			for(unsigned int i=0; i<info_panel.size();i++){
+				ch_tmp  = const_cast<char*>(info_panel[i].c_str());
+				PanelId = atoi(ch_tmp);
+				ATH_MSG_DEBUG("info_panel " << ch_tmp << " " << PanelId);
+				
+				if(PanelId.get_compact()){
+					ATH_MSG_DEBUG("OFFPANEL " << m_idHelper->rpcIdHelper().show_to_string(PanelId));
+					Identifier atlasId = m_idHelper->rpcIdHelper().panelID(PanelId);
+					std::stringstream ss;
+					ss << "panel_" << sector_name << "_" << m_idHelper->rpcIdHelper().show_to_string(PanelId);
+					if(atlasId!=0) writeCdo->setOffPanel(ss.str(), atlasId);
+					ATH_MSG_DEBUG("push-back");
+				}  
+			}   
+		}
+        chan_index++;
+	}
+    return StatusCode::SUCCESS;
+}
+
+
+// loadMcElementStatus
+StatusCode
+RpcCondDbAlg::loadMcElementStatus(EventIDRange & rangeW, std::unique_ptr<RpcCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_deadElements};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+
+    unsigned int chan_index=0;
+	unsigned int iFracDeadStrip=0; 
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+		const coral::AttributeList& atr = itr->second;
+		CondAttrListCollection::ChanNum channum = itr->first;
+		Identifier chamberId;
+		chamberId  = channum;
+
+		std::string eff_panel, striplist, eff; 
+		 
+		eff_panel = *(static_cast<const std::string*>((atr["PanelRes"   ]).addressOfData()));
+		striplist = *(static_cast<const std::string*>((atr["StripStatus"]).addressOfData()));
+
+		ATH_MSG_DEBUG("-----------------------------entry #" << chan_index);
+		ATH_MSG_DEBUG("channel ID = Panel ID " << channum << " as identif. = " << m_idHelper->rpcIdHelper().show_to_string(chamberId)); 
+		ATH_MSG_DEBUG("eff_panel load is " << eff_panel);
+		ATH_MSG_DEBUG("striplist load is " << striplist << " " << striplist.size());
+     
+
+		// Efficiencies and Cluster Sizes
+		std::string delimiter = " ";
+		std::vector<std::string> info_panel;
+		std::vector<float> info_panel_test;
+		MuonCalib::MdtStringUtils::tokenize(eff_panel,info_panel,delimiter);
+		          
+		char * SDBversion = const_cast<char*>(info_panel[0].c_str());    
+		int DBversion     = atoi( SDBversion ) ;
+ 
+		char * SNStrip  = const_cast<char*>(info_panel[2].c_str());    
+		int npanelstrip = atoi( SNStrip ) ;
+		
+		char * SProjectedTracks = const_cast<char*>(info_panel[1].c_str());
+		double ProjectedTracks  = atof(SProjectedTracks);
+		writeCdo->setProjectedTrack(chamberId, ProjectedTracks);
+
+		char * SEfficiency = const_cast<char*>(info_panel[3].c_str());
+		double Efficiency  = atof(SEfficiency);
+		writeCdo->setEfficiency(chamberId, Efficiency);
+
+		if(Efficiency <= m_panelEfficiency )
+			writeCdo->setLowEffPanel(chamberId);
+
+		char * SGapEfficiency = const_cast<char*>(info_panel[5].c_str());
+		double GapEfficiency  = atof(SGapEfficiency);
+		writeCdo->setGapEfficiency(chamberId, GapEfficiency);
+
+		char * SMeanClusterSize = const_cast<char*>(info_panel[17].c_str());
+		double MeanClusterSize  = atof(SMeanClusterSize);
+		writeCdo->setMeanClusterSize(chamberId, MeanClusterSize);
+
+		if( DBversion>2 ){
+			char * SFracClusterSize1_a = const_cast<char*>(info_panel[19].c_str());
+			char * SFracClusterSize1_b = const_cast<char*>(info_panel[20].c_str());
+			double FracClusterSize1    = atof(SFracClusterSize1_a)+atof(SFracClusterSize1_b)*10000;
+			writeCdo->setFracClusterSize1(chamberId, FracClusterSize1);
+
+			char * SFracClusterSize2_a = const_cast<char*>(info_panel[21].c_str());
+			char * SFracClusterSize2_b = const_cast<char*>(info_panel[22].c_str());
+			double FracClusterSize2    = atof(SFracClusterSize2_a)+atof(SFracClusterSize2_b)*10000;
+			writeCdo->setFracClusterSize2(chamberId, FracClusterSize2);
+
+			char * SFracClusterSize3_a = const_cast<char*>(info_panel[23].c_str());
+			char * SFracClusterSize3_b = const_cast<char*>(info_panel[24].c_str());
+			double FracClusterSize3    = atof(SFracClusterSize3_a)+atof(SFracClusterSize3_b)*10000;
+			writeCdo->setFracClusterSize3(chamberId, FracClusterSize3);
+		}
+		else {
+			if(info_panel.size()>20){
+				char * SFracClusterSize1 = const_cast<char*>(info_panel[19].c_str());
+				double FracClusterSize1  = atof(SFracClusterSize1);
+				writeCdo->setFracClusterSize1(chamberId, FracClusterSize1);
+
+				char * SFracClusterSize2 = const_cast<char*>(info_panel[20].c_str());
+				double FracClusterSize2  = atof(SFracClusterSize2);
+				writeCdo->setFracClusterSize2(chamberId, FracClusterSize2);
+			}
+			else {
+				writeCdo->setFracClusterSize1(chamberId, 0.6);
+				writeCdo->setFracClusterSize2(chamberId, 0.2);
+				ATH_MSG_DEBUG("Panel with incomplete info in the DB, size = " << info_panel.size() << " instead of required >20");
+				ATH_MSG_DEBUG("PanelId = " << channum << " = " << m_idHelper->rpcIdHelper().show_to_string(chamberId));
+				ATH_MSG_DEBUG("Cluster Size 1 and 2 fractions are set to 0.6 and 0.2 for this chamber.");
+			}
+		}
+     
+		// strip status 
+		// n chars = #strips (status between 0--9)
+		int countdeadstrip          = 0;     
+		int countdeadstripinfidarea = 0;     
+		int countpanelstrip         = 0;
+		 
+		// update for the timing and error on timing 
+		// new info strip |status time error_on_time|
+		std::string delimiter_strip = "|";
+		std::vector<std::string> info_strip;
+		std::string strip_status_list = "";
+		std::vector<float> info_strip_test;
+		
+		MuonCalib::MdtStringUtils::tokenize(striplist,info_strip,delimiter_strip);
+		char * ch_strip2;
+
+		if (info_strip.size()>1){
+			for(unsigned int i=0; i<info_strip.size(); ++i){
+				ch_strip2 = const_cast<char*>(info_strip[i].c_str());
+	 
+				std::string delimiter_strip2 = "  ";
+				std::vector<std::string> info_strip2;
+				std::vector<float> info_strip_test2;
+
+				MuonCalib::MdtStringUtils::tokenize(ch_strip2,info_strip2,delimiter_strip2);
+	 
+				char * STime = const_cast<char*>(info_strip2[1].c_str());
+				double Time  = atof(STime);
+				char * SSigmaTime  = const_cast<char*>(info_strip2[2].c_str());
+				double SigmaTime   = atof(SSigmaTime);
+				char* strip_status = const_cast<char*>(info_strip2[0].c_str());
+
+				strip_status_list = strip_status_list + strip_status ;
+	
+				std::vector<double> Time_vect;
+				Time_vect.push_back(Time);
+				Time_vect.push_back(SigmaTime);
+				 
+				Identifier strip_id ;
+				CondAttrListCollection::ChanNum stripnum;
+				stripnum = channum + i*4;
+				strip_id = channum + i*4;
+	
+				ATH_MSG_DEBUG("strip "<<strip_id<<" has time " << Time << " and " << SigmaTime);
+ 
+				writeCdo->setStripTime(strip_id, Time_vect);
+
+				ATH_MSG_VERBOSE("strip #"<<i+1<< " strip_id " <<  stripnum 
+				                <<" expanded "<<m_idHelper->rpcIdHelper().show_to_string(strip_id));
+
+				++countpanelstrip;
+				
+				if(strip_status[0]=='0'){
+					writeCdo->setDeadStrip(strip_id);
+					++countdeadstrip;
+
+					if (i>1 && i<info_strip.size()-2){
+						// strip in the fiducial area for the efficiency measurement
+						++countdeadstripinfidarea;
+					}
+				}
+			}
+		}
+		else {
+			ATH_MSG_DEBUG("no timing info");
+
+			for(unsigned int i=0; i<striplist.size();i++){
+	 
+				std::string part_strip = striplist.substr(i,1);
+				strip_status_list = strip_status_list + part_strip ;
+				char * ch_panel = const_cast<char*>(part_strip.c_str());
+	 
+				Identifier strip_id ;
+				CondAttrListCollection::ChanNum stripnum;
+				stripnum = channum + i*4;
+				strip_id = channum + i*4;
+	
+				ATH_MSG_VERBOSE("strip #"<<i+1<<" info_strip " << part_strip
+				                << " strip_id " <<  stripnum <<" expanded "
+				                <<m_idHelper->rpcIdHelper().show_to_string(strip_id)<< " panel = " << ch_panel);
+	 
+				++countpanelstrip;
+
+				if(part_strip=="0"){
+					++countdeadstrip;
+					writeCdo->setDeadStrip(strip_id);
+					if (i>1 && i<striplist.size()-2){
+						// strip in the fiducial area for the efficiency measurement
+						++countdeadstripinfidarea;
+					}
+				}
+			}
+		}
+
+		if(countpanelstrip != npanelstrip) 
+			ATH_MSG_WARNING("WARNING (no side effects for this, just a reminder for a proper fix of the DB content) no matching strip number!!! " << countpanelstrip << " != " <<npanelstrip << " Identifier: " << channum);
+     
+		float FracDeadStripMap = 0 ;
+		if(countpanelstrip-4>0) FracDeadStripMap = float(countdeadstripinfidarea)/float(countpanelstrip-4);
+
+		// store in the suitabel maps 
+		writeCdo->setDeadStripList(chamberId, strip_status_list);
+		writeCdo->setFracDeadStrip(chamberId, FracDeadStripMap );
+		++iFracDeadStrip;
+ 
+		std::stringstream ss;
+		ss << "Size of RPC_PanelFracDeadStripMap " << iFracDeadStrip << "; in panel ";
+		ss << channum << " FracDeadStri(in fid.area) " << FracDeadStripMap << " (incl. borders) ";
+		if(countpanelstrip==0) ss << "DIVISION BY ZERO IMPOSSIBLE";
+		else                   ss << float(countdeadstrip)/float(countpanelstrip);
+		ss << " nDeadStrips,InFidArea/nStrips " << countdeadstrip << ",";
+		ss << countdeadstripinfidarea << "/" << countpanelstrip;
+		ATH_MSG_DEBUG(ss.str());
+
+		ATH_MSG_DEBUG("Efficiency is " << Efficiency << " and fraction is " << FracDeadStripMap << " and thus " << Efficiency-(0.99-FracDeadStripMap));
+ 
+		if(Efficiency-(0.99-FracDeadStripMap)>0.) {
+			if(Efficiency<0.995 || FracDeadStripMap>0.01){
+				if(Efficiency>0.005 || FracDeadStripMap<0.99){
+					std::stringstream msg;
+					msg << "WARNING: Inconsistent panel eff.="<<Efficiency
+					    <<" and 0.99-dead_frac="<<0.99-FracDeadStripMap
+					    <<" nDeadStrips,InFidArea/nStrips "<<countdeadstrip<<","
+					    <<countdeadstripinfidarea<<"/"<<countpanelstrip
+					    <<" for panelId="<<m_idHelper->rpcIdHelper().show_to_string(chamberId);
+					if      (Efficiency-(0.99-FracDeadStripMap)>0.2)
+						msg << " difference >0.2";
+					else if (Efficiency-(0.99-FracDeadStripMap)>0.1)
+						msg << " difference >0.1";
+					else if (Efficiency-(0.99-FracDeadStripMap)>0.05)
+						msg << " difference >0.05";
+					else if (Efficiency-(0.99-FracDeadStripMap)>0.025)
+						msg << " difference >0.025";
+					else if (Efficiency-(0.99-FracDeadStripMap)>0.01)
+						msg << " difference >0.01";
+					else 
+						msg << " difference >0 but <=0.01";
+					ATH_MSG_DEBUG(msg.str());
+				}
+			}
+		}
+	}
+    return StatusCode::SUCCESS;
+}
+
+
+
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcCondDbAlg.cxx
new file mode 100644
index 00000000000..a3f2336cd10
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcCondDbAlg.cxx
@@ -0,0 +1,130 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondAlg/TgcCondDbAlg.h"
+#include <zlib.h>
+
+// constructor
+TgcCondDbAlg::TgcCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) : 
+    AthAlgorithm(name, pSvcLocator),
+    m_condSvc("CondSvc", name),
+    m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool")
+  {
+ 
+    declareProperty("IdHelper"         , m_idHelper   );
+
+    declareProperty("isOnline"                 , m_isOnline                                                );
+    declareProperty("isData"                   , m_isData                                                  );
+    declareProperty("isRun1"                   , m_isRun1                                                  );
+}
+
+
+// Initialize
+StatusCode
+TgcCondDbAlg::initialize(){
+
+    ATH_MSG_DEBUG( "initializing " << name() );                
+    ATH_CHECK(m_condSvc .retrieve());
+    ATH_CHECK(m_idHelper.retrieve());
+    ATH_CHECK(m_writeKey.initialize());
+    ATH_CHECK(m_readKey_folder_detectorStatus.initialize());
+
+    if(m_condSvc->regHandle(this, m_writeKey).isFailure()) {
+      ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
+      return StatusCode::FAILURE;
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+// finalize
+StatusCode
+TgcCondDbAlg::finalize(){
+  return StatusCode::SUCCESS;
+}
+
+
+// execute
+StatusCode 
+TgcCondDbAlg::execute(){
+
+    ATH_MSG_DEBUG( "execute " << name() );   
+
+	if(m_isOnline) {
+		ATH_MSG_DEBUG( "IsOnline is set to True; nothing to do!" );   
+		return StatusCode::SUCCESS;
+	}
+ 
+    // launching Write Cond Handle
+    SG::WriteCondHandle<TgcCondDbData> writeHandle{m_writeKey};
+    if (writeHandle.isValid()) {
+        ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
+        	  << " In theory this should not be called, but may happen"
+        	  << " if multiple concurrent events are being processed out of order.");
+        return StatusCode::SUCCESS; 
+    }
+    std::unique_ptr<TgcCondDbData> writeCdo{std::make_unique<TgcCondDbData>()};
+    EventIDRange rangeW;
+    StatusCode sc  = StatusCode::SUCCESS;
+    StatusCode sc0 = StatusCode::SUCCESS;
+
+    // retrieving data
+    sc0 = loadDetectorStatus(rangeW, writeCdo); if(sc0.isFailure()) {sc = sc0;}
+    if(sc.isFailure()){
+        ATH_MSG_WARNING("Could not read data from the DB");
+        return StatusCode::FAILURE;
+    }
+
+    if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
+      ATH_MSG_FATAL("Could not record TgcCondDbData " << writeHandle.key() 
+  		  << " with EventRange " << rangeW
+  		  << " into Conditions Store");
+      return StatusCode::FAILURE;
+    }		  
+    ATH_MSG_INFO("Recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
+
+    return StatusCode::SUCCESS;
+}
+
+
+// loadDetectorStatus
+StatusCode
+TgcCondDbAlg::loadDetectorStatus(EventIDRange & rangeW, std::unique_ptr<TgcCondDbData>& writeCdo){
+  
+    SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_detectorStatus};
+    const CondAttrListCollection* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    if ( !readHandle.range(rangeW) ) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+    ATH_MSG_INFO("Range of input is " << rangeW);
+
+    CondAttrListCollection::const_iterator itr;
+    for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+		const coral::AttributeList& atr=itr->second;
+		int detector_status;
+		
+		detector_status=*(static_cast<const int*>((atr["detector_status"]).addressOfData()));
+		ATH_MSG_DEBUG("TGC detector status is " << detector_status);
+		
+		if (detector_status!=0){
+		    int channum=itr->first;
+		    Identifier chamberId = m_idHelper->tgcIdHelper().elementID(Identifier(channum));
+			writeCdo->setDeadStation(chamberId);
+		}
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx
new file mode 100644
index 00000000000..4ec92220091
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx
@@ -0,0 +1,10 @@
+#include "MuonCondAlg/CscCondDbAlg.h"
+#include "MuonCondAlg/MdtCondDbAlg.h"
+#include "MuonCondAlg/RpcCondDbAlg.h"
+#include "MuonCondAlg/TgcCondDbAlg.h"
+
+
+DECLARE_COMPONENT( CscCondDbAlg )
+DECLARE_COMPONENT( MdtCondDbAlg )
+DECLARE_COMPONENT( RpcCondDbAlg )
+DECLARE_COMPONENT( TgcCondDbAlg )
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/CMakeLists.txt
index 04135df6716..4b65031f274 100644
--- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/CMakeLists.txt
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/CMakeLists.txt
@@ -7,15 +7,23 @@ atlas_subdir( MuonCondData )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
+                          Control/AthenaBaseComps
                           Control/AthenaKernel
                           Control/AthContainers
                           Control/StoreGate
                           Database/AthenaPOOL/AthenaPoolUtilities
-                          DetectorDescription/Identifier )
+                          DetectorDescription/Identifier
+                          GaudiKernel
+                          PRIVATE
+                          Event/EventInfo
+                          MuonSpectrometer/MuonIdHelpers )
+
 
 # Component(s) in the package:
 atlas_add_library( MuonCondData
                    src/*.cxx
                    PUBLIC_HEADERS MuonCondData
-                   LINK_LIBRARIES AthContainers AthenaPoolUtilities Identifier StoreGateLib SGtests )
+                   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES AthenaBaseComps AthenaKernel AthContainers AthenaPoolUtilities Identifier GaudiKernel StoreGateLib SGtests MuonIdHelpersLib 
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo )
 
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h
new file mode 100644
index 00000000000..660dc2278e2
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h
@@ -0,0 +1,83 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDDATA_CSCCONDDBDATA_H
+#define MUONCONDDATA_CSCCONDDBDATA_H
+
+//STL includes
+#include <string>
+#include <vector>
+
+//Athena includes
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+#include "AthenaKernel/CondCont.h" 
+#include "Identifier/Identifier.h"
+#include "Identifier/IdentifierHash.h"
+//#include "GeoPrimitives/GeoPrimitives.h"
+#include "AthenaKernel/BaseInfo.h" 
+
+
+//forward declarations
+class Identifier;
+class IdentifierHash;
+
+
+
+class CscCondDbData {
+
+  friend class CscCondDbAlg;
+
+public:
+
+    CscCondDbData();
+    virtual ~CscCondDbData() = default;
+
+    virtual void setChannelStatus(IdentifierHash, int);
+    virtual void setDeadChannelHash(IdentifierHash);
+
+    virtual void setDeadLayer     (std::string, Identifier);
+    virtual void setDeadStation   (std::string, Identifier);
+   
+    virtual const std::vector<std::string>& getDeadLayers     () const;
+    virtual const std::vector<std::string>& getDeadStations   () const;
+    
+    virtual const std::vector<Identifier>& getDeadLayersId     () const;
+    virtual const std::vector<Identifier>& getDeadStationsId   () const;
+
+    virtual const std::vector<unsigned int>& getDeadChannelsHash() const;
+    
+    virtual const int& getChannelStatus(IdentifierHash) const;
+
+    virtual bool isGood           (const Identifier &    ) const;
+    virtual bool isGoodLayer      (const Identifier &    ) const;
+    virtual bool isGoodStation    (const Identifier &    ) const;
+
+    virtual bool isGoodChannelHash(const IdentifierHash &) const;
+
+
+ 
+private:
+
+    std::vector<std::string> m_cachedDeadLayers;
+    std::vector<std::string> m_cachedDeadStations;
+
+    std::vector<Identifier> m_cachedDeadLayersId;
+    std::vector<Identifier> m_cachedDeadStationsId;
+
+    std::vector<unsigned int> m_cachedDeadChannelsHash;
+    std::map<unsigned int, int> m_cachedChannelsStatus;
+
+    std::vector<std::string> m_emptyNames;
+    std::vector<Identifier> m_emptyIds; 
+    std::vector<unsigned int> m_emptyHashs;
+
+    int m_nillint = 0;
+
+};
+
+CLASS_DEF( CscCondDbData, 10742890, 1)
+#include "AthenaKernel/CondCont.h"
+CLASS_DEF( CondCont<CscCondDbData>, 43297256, 0)
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/MdtCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/MdtCondDbData.h
new file mode 100644
index 00000000000..16a68f21e00
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/MdtCondDbData.h
@@ -0,0 +1,117 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDDATA_MDTCONDDBDATA_H
+#define MUONCONDDATA_MDTCONDDBDATA_H
+
+//STL includes
+#include <string>
+#include <vector>
+
+//Athena includes
+#include "MuonIdHelpers/MdtIdHelper.h"
+#include "Identifier/Identifier.h"
+//#include "GeoPrimitives/GeoPrimitives.h"
+#include "AthenaKernel/CondCont.h" 
+#include "AthenaKernel/BaseInfo.h" 
+
+
+//forward declarations
+class Identifier;
+class MdtIdHelper;
+
+
+class MdtCondDbData {
+
+  friend class MdtCondDbAlg;
+
+public:
+
+    MdtCondDbData();
+    virtual ~MdtCondDbData() = default;
+
+    virtual void setDeadTube      (std::string, Identifier);
+    virtual void setDeadLayer     (std::string, Identifier);
+    virtual void setDeadMultilayer(std::string, Identifier);
+    virtual void setDeadStation   (std::string, Identifier);
+    virtual void setDeadChamber   (Identifier);
+
+    virtual void setNoisyTube      (Identifier);
+    virtual void setNoisyLayer     (Identifier);
+    virtual void setNoisyMultilayer(Identifier);
+    virtual void setNoisyStation   (Identifier);
+    virtual void setNoisyChamber   (Identifier);
+   
+    virtual const std::vector<std::string>& getDeadTubes      () const;
+    virtual const std::vector<std::string>& getDeadLayers     () const;
+    virtual const std::vector<std::string>& getDeadMultilayers() const;
+    virtual const std::vector<std::string>& getDeadStations   () const;
+    virtual const std::vector<std::string>& getDeadChambers   () const;
+    
+    virtual const std::vector<Identifier>& getDeadTubesId      () const;
+    virtual const std::vector<Identifier>& getDeadLayersId     () const;
+    virtual const std::vector<Identifier>& getDeadMultilayersId() const;
+    virtual const std::vector<Identifier>& getDeadStationsId   () const;
+    virtual const std::vector<Identifier>& getDeadChambersId   () const;
+
+    virtual const std::vector<std::string>& getNoisyTubes      () const;
+    virtual const std::vector<std::string>& getNoisyLayers     () const;
+    virtual const std::vector<std::string>& getNoisyMultilayers() const;
+    virtual const std::vector<std::string>& getNoisyStations   () const;
+    virtual const std::vector<std::string>& getNoisyChambers   () const;
+    
+    virtual const std::vector<Identifier>& getNoisyTubesId      () const;
+    virtual const std::vector<Identifier>& getNoisyLayersId     () const;
+    virtual const std::vector<Identifier>& getNoisyMultilayersId() const;
+    virtual const std::vector<Identifier>& getNoisyStationsId   () const;
+    virtual const std::vector<Identifier>& getNoisyChambersId   () const;
+  
+    virtual bool isGood          (const Identifier & Id) const;
+    virtual bool isGoodChannel   (const Identifier & Id) const;
+    virtual bool isGoodTube      (const Identifier & Id) const;
+    virtual bool isGoodLayer     (const Identifier & Id) const;
+    virtual bool isGoodMultilayer(const Identifier & Id) const;
+    virtual bool isGoodStation   (const Identifier & Id) const;
+    virtual bool isGoodChamber   (const Identifier & Id) const;
+
+
+ 
+private:
+
+    std::vector<std::string> m_cachedDeadTubes;
+    std::vector<std::string> m_cachedDeadLayers;
+    std::vector<std::string> m_cachedDeadMultilayers;
+    std::vector<std::string> m_cachedDeadStations;
+    std::vector<std::string> m_cachedDeadChambers;
+
+    std::vector<Identifier> m_cachedDeadTubesId;
+    std::vector<Identifier> m_cachedDeadLayersId;
+    std::vector<Identifier> m_cachedDeadMultilayersId;
+    std::vector<Identifier> m_cachedDeadStationsId;
+    std::vector<Identifier> m_cachedDeadChambersId;
+ 
+    std::vector<std::string> m_cachedNoisyTubes;
+    std::vector<std::string> m_cachedNoisyLayers;
+    std::vector<std::string> m_cachedNoisyMultilayers;
+    std::vector<std::string> m_cachedNoisyStations;
+    std::vector<std::string> m_cachedNoisyChambers;
+
+    std::vector<Identifier> m_cachedNoisyTubesId;
+    std::vector<Identifier> m_cachedNoisyLayersId;
+    std::vector<Identifier> m_cachedNoisyMultilayersId;
+    std::vector<Identifier> m_cachedNoisyStationsId;
+    std::vector<Identifier> m_cachedNoisyChambersId;
+
+    std::vector<std::string> m_emptyNames;
+    std::vector<Identifier> m_emptyIds; 
+
+    const MdtIdHelper * m_idHelper;
+
+};
+
+CLASS_DEF( MdtCondDbData, 58088442, 1)
+#include "AthenaKernel/CondCont.h"
+CLASS_DEF( CondCont<MdtCondDbData>, 62077248, 0)
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/RpcCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/RpcCondDbData.h
new file mode 100644
index 00000000000..4fddd2ee9e6
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/RpcCondDbData.h
@@ -0,0 +1,127 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDDATA_RPCCONDDBDATA_H
+#define MUONCONDDATA_RPCCONDDBDATA_H
+
+//STL includes
+#include <string>
+#include <vector>
+
+//Athena includes
+#include "Identifier/Identifier.h"
+//#include "GeoPrimitives/GeoPrimitives.h"
+#include "AthenaKernel/CondCont.h" 
+#include "AthenaKernel/BaseInfo.h" 
+
+
+//forward declarations
+class Identifier;
+
+
+class RpcCondDbData {
+
+  friend class RpcCondDbAlg;
+
+public:
+
+    RpcCondDbData();
+    virtual ~RpcCondDbData() = default;
+
+    virtual void setDeadPanel       (std::string, Identifier        );
+    virtual void setDeadStrip       (Identifier                     );
+    virtual void setDeadStripInt    (Identifier, int                );
+    virtual void setDeadStripList   (Identifier, std::string        );
+    virtual void setEfficiency      (Identifier, double             );
+    virtual void setFracClusterSize1(Identifier, double             );
+    virtual void setFracClusterSize2(Identifier, double             );
+    virtual void setFracClusterSize3(Identifier, double             );
+    virtual void setFracDeadStrip   (Identifier, double             );
+    virtual void setGapEfficiency   (Identifier, double             );
+    virtual void setLowEffPanel     (Identifier                     );
+    virtual void setMeanClusterSize (Identifier, double             );
+    virtual void setOffPanel        (std::string, Identifier        );
+    virtual void setProjectedTrack  (Identifier, int                );
+    virtual void setStripTime       (Identifier, std::vector<double>);
+
+    virtual const std::vector<std::string>& getDeadPanels() const;
+    virtual const std::vector<std::string>& getOffPanels () const;
+    
+    virtual const std::vector<Identifier>& getDeadPanelsId() const;
+    virtual const std::vector<Identifier>& getDeadStrips  () const;
+    virtual const std::vector<Identifier>& getLowEffPanels() const;
+    virtual const std::vector<Identifier>& getOffPanelsId () const;
+
+    virtual const std::string&         getDeadStripList   (const Identifier& );
+    virtual const int&                 getDeadStripInt    (const Identifier& );
+    virtual const double&              getEfficiency      (const Identifier& );
+    virtual const double&              getFracClusterSize1(const Identifier& );
+    virtual const double&              getFracClusterSize2(const Identifier& );
+    virtual const double&              getFracClusterSize3(const Identifier& );
+    virtual const double&              getFracDeadStrip   (const Identifier& );
+    virtual const double&              getGapEfficiency   (const Identifier& );
+    virtual const double&              getMeanClusterSize (const Identifier& );
+    virtual const int&                 getProjectedTrack  (const Identifier& );
+    virtual const std::vector<double>& getStripTime       (const Identifier& );
+ 
+ 
+    virtual bool isEffPanel      (const Identifier & Id) const;
+    virtual bool isGood          (const Identifier & Id) const;
+    virtual bool isGoodPanel     (const Identifier & Id) const;
+    virtual bool isGoodStrip     (const Identifier & Id) const;
+    virtual bool isOffPanel      (const Identifier & Id) const;
+
+
+ 
+private:
+
+    std::vector<std::string> m_cachedDeadPanels;
+    std::vector<std::string> m_cachedOffPanels;
+
+    std::vector<Identifier> m_cachedDeadPanelsId;
+    std::vector<Identifier> m_cachedDeadStrips;
+    std::vector<Identifier> m_cachedLowEffPanels;
+    std::vector<Identifier> m_cachedOffPanelsId;
+
+    std::map<Identifier, std::string         > m_cachedDeadStripList;
+    std::map<Identifier, int                 > m_cachedDeadStripListInt;
+    std::map<Identifier, double              > m_cachedEfficiency;
+    std::map<Identifier, double              > m_cachedFracClusterSize1;
+    std::map<Identifier, double              > m_cachedFracClusterSize2;
+    std::map<Identifier, double              > m_cachedFracClusterSize3;
+    std::map<Identifier, double              > m_cachedFracDeadStrip;
+    std::map<Identifier, double              > m_cachedGapEfficiency;
+    std::map<Identifier, double              > m_cachedMeanClusterSize;
+    std::map<Identifier, int                 > m_cachedProjectedTracks;
+    std::map<Identifier, std::vector<double> > m_cachedStripTime;
+
+    std::vector<std::string> m_emptyNames;
+    std::vector<Identifier> m_emptyIds; 
+    std::vector<double> m_emptyDoubles; 
+    double m_nill = -1;
+    int    m_nillint = -1;
+    std::string m_nillstr = "";
+
+public:
+
+    virtual const std::map<Identifier,              double>& getEfficiencyMap      () const { return m_cachedEfficiency      ;}
+    virtual const std::map<Identifier,              double>& getEfficiencyGapMap   () const { return m_cachedGapEfficiency   ;}
+    virtual const std::map<Identifier,              double>& getMeanClusterSizeMap () const { return m_cachedMeanClusterSize ;}
+    virtual const std::map<Identifier,              double>& getFracClusterSize1Map() const { return m_cachedFracClusterSize1;}
+    virtual const std::map<Identifier,              double>& getFracClusterSize2Map() const { return m_cachedFracClusterSize2;}
+    virtual const std::map<Identifier,              double>& getFracClusterSize3Map() const { return m_cachedFracClusterSize3;}
+    virtual const std::map<Identifier,         std::string>& getDeadStripMap       () const { return m_cachedDeadStripList   ;}
+    virtual const std::map<Identifier,              double>& getFracDeadStripMap   () const { return m_cachedFracDeadStrip   ;}
+    virtual const std::map<Identifier,                 int>& getProjectedTracksMap () const { return m_cachedProjectedTracks ;}
+    virtual const std::map<Identifier,                 int>& getDeadStripIntMap    () const { return m_cachedDeadStripListInt;}
+    virtual const std::map<Identifier,std::vector<double> >& getStripTimeMap       () const { return m_cachedStripTime       ;}
+
+
+};
+
+CLASS_DEF( RpcCondDbData, 25128902, 1)
+#include "AthenaKernel/CondCont.h"
+CLASS_DEF( CondCont<RpcCondDbData>, 178635428, 0)
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcCondDbData.h
new file mode 100644
index 00000000000..ab5c89ef3d6
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcCondDbData.h
@@ -0,0 +1,56 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDDATA_TGCCONDDBDATA_H
+#define MUONCONDDATA_TGCCONDDBDATA_H
+
+//STL includes
+#include <string>
+#include <vector>
+
+//Athena includes
+#include "Identifier/Identifier.h"
+//#include "GeoPrimitives/GeoPrimitives.h"
+#include "AthenaKernel/CondCont.h" 
+#include "AthenaKernel/BaseInfo.h" 
+
+
+//forward declarations
+class Identifier;
+
+
+class TgcCondDbData {
+
+  friend class TgcCondDbAlg;
+
+public:
+
+    TgcCondDbData();
+    virtual ~TgcCondDbData() = default;
+
+    virtual void setDeadStation(Identifier);
+
+    virtual const std::vector<Identifier>& getDeadStationsId() const;
+
+    virtual bool isGood          (const Identifier & Id) const;
+    virtual bool isGoodStation   (const Identifier & Id) const;
+
+
+ 
+private:
+
+    std::vector<Identifier> m_cachedDeadStationsId;
+
+    std::vector<std::string> m_emptyNames;
+    std::vector<Identifier> m_emptyIds; 
+
+    static bool Compare(const Identifier &a, const Identifier &b) {return (a>b);}
+
+};
+
+CLASS_DEF( TgcCondDbData, 130737053, 1)
+#include "AthenaKernel/CondCont.h"
+CLASS_DEF( CondCont<TgcCondDbData>, 178252645, 0)
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx
new file mode 100644
index 00000000000..6e4ff7bdd70
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx
@@ -0,0 +1,147 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondData/CscCondDbData.h"
+
+//STL includes
+#include <vector>
+#include <string>
+
+
+using namespace std;
+
+
+// constructor
+CscCondDbData::CscCondDbData() {
+}
+
+
+// --- writing identifiers -------
+
+// setChannelStatus
+void
+CscCondDbData::setChannelStatus(IdentifierHash hash, int status){
+    m_cachedChannelsStatus[(unsigned int) hash] = status;
+    if((status & 0x1) || ((status >> 1) & 0x1)) setDeadChannelHash(hash);
+}
+
+// setDeadChannelHash
+void
+CscCondDbData::setDeadChannelHash(IdentifierHash hash){
+    if(std::find(m_cachedDeadChannelsHash.begin(), m_cachedDeadChannelsHash.end(), (unsigned int) hash) != m_cachedDeadChannelsHash.end()) return;
+    m_cachedDeadChannelsHash.push_back((unsigned int) hash);
+}
+
+// setDeadLayer
+void
+CscCondDbData::setDeadLayer(std::string name, Identifier Id){
+    if(std::find(m_cachedDeadLayersId.begin(), m_cachedDeadLayersId.end(), Id)!=m_cachedDeadLayersId.end()) return;
+    m_cachedDeadLayers  .push_back(name);
+    m_cachedDeadLayersId.push_back(Id  );
+}
+
+// setDeadStation
+void
+CscCondDbData::setDeadStation(std::string name, Identifier Id){
+    if(std::find(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id)!=m_cachedDeadStationsId.end()) return;
+    m_cachedDeadStations  .push_back(name);
+    m_cachedDeadStationsId.push_back(Id  );
+}
+
+
+
+
+
+// --- reading identifiers -------
+
+// getDeadLayers
+const 
+std::vector<std::string>& CscCondDbData::getDeadLayers() const{
+    if(m_cachedDeadLayers.size()!=0) return m_cachedDeadLayers;
+    return m_emptyNames;
+}
+
+// getDeadStations
+const 
+std::vector<std::string>& CscCondDbData::getDeadStations() const{
+    if(m_cachedDeadStations.size()!=0) return m_cachedDeadStations;
+    return m_emptyNames;
+}
+
+
+
+// getDeadLayersId
+const 
+std::vector<Identifier>& CscCondDbData::getDeadLayersId() const{
+    if(m_cachedDeadLayersId.size()!=0) return m_cachedDeadLayersId;
+    return m_emptyIds;
+}
+
+// getDeadStationsId
+const 
+std::vector<Identifier>& CscCondDbData::getDeadStationsId() const{
+    if(m_cachedDeadStationsId.size()!=0) return m_cachedDeadStationsId;
+    return m_emptyIds;
+}
+
+
+
+// getDeadChannelsHashs
+const 
+std::vector<unsigned int>& CscCondDbData::getDeadChannelsHash() const{
+    if(m_cachedDeadChannelsHash.size()!=0) return m_cachedDeadChannelsHash;
+    return m_emptyHashs;
+}
+
+
+
+// --- stored info for all -------
+
+// getChannelStatus
+const
+int& CscCondDbData::getChannelStatus(IdentifierHash hash) const{
+	if(m_cachedChannelsStatus.find((unsigned int) hash)==m_cachedChannelsStatus.end()) return m_nillint;
+	return m_cachedChannelsStatus.find((unsigned int) hash)->second;
+}
+
+
+
+
+// --- probing identifiers -------
+
+// isGood
+bool 
+CscCondDbData::isGood(const Identifier & Id) const{
+    // probing id in all lists
+    if(not isGoodLayer     (Id)) return false;
+    if(not isGoodStation   (Id)) return false;
+    return true;
+}
+
+// isGoodChannelHash
+bool 
+CscCondDbData::isGoodChannelHash(const IdentifierHash & hash) const{
+    if(m_cachedDeadChannelsHash.size()==0) return true;
+    bool found = std::find(m_cachedDeadChannelsHash.begin(), m_cachedDeadChannelsHash.end(), (unsigned int) hash) != m_cachedDeadChannelsHash.end();
+    return !found;
+}
+
+// isGoodLayer
+bool
+CscCondDbData::isGoodLayer(const Identifier & Id) const{
+    if(m_cachedDeadLayersId.size()==0) return true;
+    bool found = std::find(m_cachedDeadLayersId.begin(), m_cachedDeadLayersId.end(), Id)!=m_cachedDeadLayersId.end();
+    return !found;
+} 
+
+// isGoodStation
+bool
+CscCondDbData::isGoodStation(const Identifier & Id) const{
+    if(m_cachedDeadStationsId.size()==0) return true;
+    bool found = std::find(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id)!=m_cachedDeadStationsId.end();
+    return !found;
+} 
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/MdtCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/MdtCondDbData.cxx
new file mode 100644
index 00000000000..873debccc0f
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/MdtCondDbData.cxx
@@ -0,0 +1,322 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondData/MdtCondDbData.h"
+
+//STL includes
+#include <vector>
+#include <string>
+
+#include "Identifier/Identifier.h"
+
+using namespace std;
+
+
+// constructor
+MdtCondDbData::MdtCondDbData(){
+}
+
+
+// --- writing identifiers -------
+
+// setDeadTube
+void
+MdtCondDbData::setDeadTube(std::string name, Identifier Id){
+    if(std::find(m_cachedDeadTubesId.begin(), m_cachedDeadTubesId.end(), Id)!=m_cachedDeadTubesId.end()) return;
+    m_cachedDeadTubes  .push_back(name);
+    m_cachedDeadTubesId.push_back(Id  );
+}
+
+// setDeadLayer
+void
+MdtCondDbData::setDeadLayer(std::string name, Identifier Id){
+    if(std::find(m_cachedDeadLayersId.begin(), m_cachedDeadLayersId.end(), Id)!=m_cachedDeadLayersId.end()) return;
+    m_cachedDeadLayers  .push_back(name);
+    m_cachedDeadLayersId.push_back(Id  );
+}
+
+// setDeadMultilayer
+void
+MdtCondDbData::setDeadMultilayer(std::string name, Identifier Id){
+    if(std::find(m_cachedDeadMultilayersId.begin(), m_cachedDeadMultilayersId.end(), Id)!=m_cachedDeadMultilayersId.end()) return;
+    m_cachedDeadMultilayers  .push_back(name);
+    m_cachedDeadMultilayersId.push_back(Id  );
+}
+
+// setDeadStation (= a chamber dead by itself)
+void
+MdtCondDbData::setDeadStation(std::string name, Identifier Id){
+    if(std::find(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id)!=m_cachedDeadStationsId.end()) return;
+    m_cachedDeadStations  .push_back(name);
+    m_cachedDeadStationsId.push_back(Id  );
+}
+
+// setDeadChamber (= a chamber with dead channels)
+void
+MdtCondDbData::setDeadChamber(Identifier Id){
+    if(std::find(m_cachedDeadChambersId.begin(), m_cachedDeadChambersId.end(), Id)!=m_cachedDeadChambersId.end()) return;
+    m_cachedDeadChambersId.push_back(Id  );
+}
+
+// setNoisyTube
+void
+MdtCondDbData::setNoisyTube(Identifier Id){
+    if(std::find(m_cachedNoisyTubesId.begin(), m_cachedNoisyTubesId.end(), Id)!=m_cachedNoisyTubesId.end()) return;
+    m_cachedNoisyTubesId.push_back(Id  );
+}
+
+// setNoisyLayer
+void
+MdtCondDbData::setNoisyLayer(Identifier Id){
+    if(std::find(m_cachedNoisyLayersId.begin(), m_cachedNoisyLayersId.end(), Id)!=m_cachedNoisyLayersId.end()) return;
+    m_cachedNoisyLayersId.push_back(Id  );
+}
+
+// setNoisyMultilayer
+void
+MdtCondDbData::setNoisyMultilayer(Identifier Id){
+    if(std::find(m_cachedNoisyMultilayersId.begin(), m_cachedNoisyMultilayersId.end(), Id)!=m_cachedNoisyMultilayersId.end()) return;
+    m_cachedNoisyMultilayersId.push_back(Id  );
+}
+
+// setNoisyStation
+void
+MdtCondDbData::setNoisyStation(Identifier Id){
+    if(std::find(m_cachedNoisyStationsId.begin(), m_cachedNoisyStationsId.end(), Id)!=m_cachedNoisyStationsId.end()) return;
+    m_cachedNoisyStationsId.push_back(Id  );
+}
+
+// setNoisyChamber
+void
+MdtCondDbData::setNoisyChamber(Identifier Id){
+    if(std::find(m_cachedNoisyChambersId.begin(), m_cachedNoisyChambersId.end(), Id)!=m_cachedNoisyChambersId.end()) return;
+    m_cachedNoisyChambersId.push_back(Id  );
+}
+
+
+
+
+
+// --- reading identifiers -------
+
+// getDeadTubes
+const 
+std::vector<std::string>& MdtCondDbData::getDeadTubes() const{
+    if(m_cachedDeadTubes.size()!=0) return m_cachedDeadTubes;
+    return m_emptyNames;
+}
+
+// getDeadLayers
+const 
+std::vector<std::string>& MdtCondDbData::getDeadLayers() const{
+    if(m_cachedDeadLayers.size()!=0) return m_cachedDeadLayers;
+    return m_emptyNames;
+}
+
+// getDeadMultilayers
+const 
+std::vector<std::string>& MdtCondDbData::getDeadMultilayers() const{
+    if(m_cachedDeadMultilayers.size()!=0) return m_cachedDeadMultilayers;
+    return m_emptyNames;
+}
+
+// getDeadStations
+const 
+std::vector<std::string>& MdtCondDbData::getDeadStations() const{
+    if(m_cachedDeadStations.size()!=0) return m_cachedDeadStations;
+    return m_emptyNames;
+}
+
+// getDeadChambers
+const 
+std::vector<std::string>& MdtCondDbData::getDeadChambers() const{
+    if(m_cachedDeadChambers.size()!=0) return m_cachedDeadChambers;
+    return m_emptyNames;
+}
+
+
+
+// getDeadTubesId
+const 
+std::vector<Identifier>& MdtCondDbData::getDeadTubesId() const{
+    if(m_cachedDeadTubesId.size()!=0) return m_cachedDeadTubesId;
+    return m_emptyIds;
+}
+
+// getDeadLayersId
+const 
+std::vector<Identifier>& MdtCondDbData::getDeadLayersId() const{
+    if(m_cachedDeadLayersId.size()!=0) return m_cachedDeadLayersId;
+    return m_emptyIds;
+}
+
+// getDeadMultilayersId
+const 
+std::vector<Identifier>& MdtCondDbData::getDeadMultilayersId() const{
+    if(m_cachedDeadMultilayersId.size()!=0) return m_cachedDeadMultilayersId;
+    return m_emptyIds;
+}
+
+// getDeadStationsId
+const 
+std::vector<Identifier>& MdtCondDbData::getDeadStationsId() const{
+    if(m_cachedDeadStationsId.size()!=0) return m_cachedDeadStationsId;
+    return m_emptyIds;
+}
+
+// getDeadChambersId
+const 
+std::vector<Identifier>& MdtCondDbData::getDeadChambersId() const{
+    if(m_cachedDeadChambersId.size()!=0) return m_cachedDeadChambersId;
+    return m_emptyIds;
+}
+
+
+
+// getNoisyTubes
+const 
+std::vector<std::string>& MdtCondDbData::getNoisyTubes() const{
+    if(m_cachedNoisyTubes.size()!=0) return m_cachedNoisyTubes;
+    return m_emptyNames;
+}
+
+// getNoisyLayers
+const 
+std::vector<std::string>& MdtCondDbData::getNoisyLayers() const{
+    if(m_cachedNoisyLayers.size()!=0) return m_cachedNoisyLayers;
+    return m_emptyNames;
+}
+
+// getNoisyMultilayers
+const 
+std::vector<std::string>& MdtCondDbData::getNoisyMultilayers() const{
+    if(m_cachedNoisyMultilayers.size()!=0) return m_cachedNoisyMultilayers;
+    return m_emptyNames;
+}
+
+// getNoisyStations
+const 
+std::vector<std::string>& MdtCondDbData::getNoisyStations() const{
+    if(m_cachedNoisyStations.size()!=0) return m_cachedNoisyStations;
+    return m_emptyNames;
+}
+
+// getNoisyChambers
+const 
+std::vector<std::string>& MdtCondDbData::getNoisyChambers() const{
+    if(m_cachedNoisyChambers.size()!=0) return m_cachedNoisyChambers;
+    return m_emptyNames;
+}
+
+
+
+// getNoisyTubesId
+const 
+std::vector<Identifier>& MdtCondDbData::getNoisyTubesId() const{
+    if(m_cachedNoisyTubesId.size()!=0) return m_cachedNoisyTubesId;
+    return m_emptyIds;
+}
+
+// getNoisyLayersId
+const 
+std::vector<Identifier>& MdtCondDbData::getNoisyLayersId() const{
+    if(m_cachedNoisyLayersId.size()!=0) return m_cachedNoisyLayersId;
+    return m_emptyIds;
+}
+
+// getNoisyMultilayersId
+const 
+std::vector<Identifier>& MdtCondDbData::getNoisyMultilayersId() const{
+    if(m_cachedNoisyMultilayersId.size()!=0) return m_cachedNoisyMultilayersId;
+    return m_emptyIds;
+}
+
+// getNoisyStationsId
+const 
+std::vector<Identifier>& MdtCondDbData::getNoisyStationsId() const{
+    if(m_cachedNoisyStationsId.size()!=0) return m_cachedNoisyStationsId;
+    return m_emptyIds;
+}
+
+// getNoisyChambersId
+const 
+std::vector<Identifier>& MdtCondDbData::getNoisyChambersId() const{
+    if(m_cachedNoisyChambersId.size()!=0) return m_cachedNoisyChambersId;
+    return m_emptyIds;
+}
+
+
+
+// --- probing identifiers -------
+
+// isGood
+bool 
+MdtCondDbData::isGood(const Identifier & Id) const{
+    // probing id in all lists
+    if(not isGoodTube      (Id)) return false;
+    if(not isGoodLayer     (Id)) return false;
+    if(not isGoodMultilayer(Id)) return false;
+    if(not isGoodChamber   (Id)) return false;
+    if(not isGoodStation   (Id)) return false;
+    return true;
+}
+
+// isGoodChannel
+bool 
+MdtCondDbData::isGoodChannel(const Identifier & Id) const{
+    // probing channel and all associated entities
+    //Identifier layerId      = m_idHelper->layerID     (Id); 
+    Identifier multilayerId = m_idHelper->multilayerID(Id); 
+    Identifier chamberId    = m_idHelper->elementID   (Id); 
+    //Identifier stationId    = m_idHelper->stationID   (Id); 
+    if(not isGoodTube      (Id          )) return false;
+    //if(not isGoodLayer     (layerId     )) return false;
+    if(not isGoodMultilayer(multilayerId)) return false;
+    if(not isGoodChamber   (chamberId   )) return false;
+    //if(not isGoodStation   (stationId   )) return false;
+    return true;
+}
+
+// isGoodTube
+bool
+MdtCondDbData::isGoodTube(const Identifier & Id) const{
+    if(m_cachedDeadTubesId.size()==0) return true;
+    bool found = std::find(m_cachedDeadTubesId.begin(), m_cachedDeadTubesId.end(), Id)!=m_cachedDeadTubesId.end();
+    return !found;
+} 
+
+// isGoodLayer
+bool
+MdtCondDbData::isGoodLayer(const Identifier & Id) const{
+    if(m_cachedDeadLayersId.size()==0) return true;
+    bool found = std::find(m_cachedDeadLayersId.begin(), m_cachedDeadLayersId.end(), Id)!=m_cachedDeadLayersId.end();
+    return !found;
+} 
+
+// isGoodMultilayer
+bool
+MdtCondDbData::isGoodMultilayer(const Identifier & Id) const{
+    if(m_cachedDeadMultilayersId.size()==0) return true;
+    bool found = std::find(m_cachedDeadMultilayersId.begin(), m_cachedDeadMultilayersId.end(), Id)!=m_cachedDeadMultilayersId.end();
+    return !found;
+} 
+
+// isGoodStation
+bool
+MdtCondDbData::isGoodStation(const Identifier & Id) const{
+    if(m_cachedDeadStationsId.size()==0) return true;
+    bool found = std::find(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id)!=m_cachedDeadStationsId.end();
+    return !found;
+} 
+
+// isGoodChamber
+bool
+MdtCondDbData::isGoodChamber(const Identifier & Id) const{
+    if(m_cachedDeadChambersId.size()==0) return true;
+    bool found = std::find(m_cachedDeadChambersId.begin(), m_cachedDeadChambersId.end(), Id)!=m_cachedDeadChambersId.end();
+    return !found;
+} 
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/RpcCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/RpcCondDbData.cxx
new file mode 100644
index 00000000000..24c666fac83
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/RpcCondDbData.cxx
@@ -0,0 +1,308 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondData/RpcCondDbData.h"
+
+//STL includes
+#include <vector>
+#include <string>
+
+#include "Identifier/Identifier.h"
+
+using namespace std;
+
+
+// constructor
+RpcCondDbData::RpcCondDbData(){
+}
+
+
+// --- writing identifiers -------
+
+// setDeadPanel
+void
+RpcCondDbData::setDeadPanel(std::string name, Identifier Id){
+    if(std::find(m_cachedDeadPanelsId.begin(), m_cachedDeadPanelsId.end(), Id)!=m_cachedDeadPanelsId.end()) return;
+    m_cachedDeadPanels  .push_back(name);
+    m_cachedDeadPanelsId.push_back(Id  );
+}
+
+// setDeadStrip
+void
+RpcCondDbData::setDeadStrip(Identifier stripId){
+    if(std::find(m_cachedDeadStrips.begin(), m_cachedDeadStrips.end(), stripId)!=m_cachedDeadStrips.end()) return;
+    m_cachedDeadStrips.push_back(stripId);
+}
+
+// setDeadStripInt
+void
+RpcCondDbData::setDeadStripInt(Identifier chamberId, int striplist){
+    if(m_cachedDeadStripListInt.count(chamberId)) return;
+    m_cachedDeadStripListInt[chamberId] = striplist;
+}
+
+// setDeadStripList
+void
+RpcCondDbData::setDeadStripList(Identifier chamberId, std::string striplist){
+    if(m_cachedDeadStripList.count(chamberId)) return;
+    m_cachedDeadStripList[chamberId] = striplist;
+}
+
+// setEfficiency
+void
+RpcCondDbData::setEfficiency(Identifier chamberId, double efficiency){
+    if(m_cachedEfficiency.count(chamberId)) return;
+    m_cachedEfficiency[chamberId] = efficiency;
+}
+
+// setFracClusterSize1
+void
+RpcCondDbData::setFracClusterSize1(Identifier chamberId, double fcs){
+    if(m_cachedFracClusterSize1.count(chamberId)) return;
+    m_cachedFracClusterSize1[chamberId] = fcs;
+}
+
+// setFracClusterSize2
+void
+RpcCondDbData::setFracClusterSize2(Identifier chamberId, double fcs){
+    if(m_cachedFracClusterSize2.count(chamberId)) return;
+    m_cachedFracClusterSize2[chamberId] = fcs;
+}
+
+// setFracClusterSize3
+void
+RpcCondDbData::setFracClusterSize3(Identifier chamberId, double fcs){
+    if(m_cachedFracClusterSize3.count(chamberId)) return;
+    m_cachedFracClusterSize3[chamberId] = fcs;
+}
+
+// setFracDeadStrip
+void
+RpcCondDbData::setFracDeadStrip(Identifier chamberId, double fds){
+    if(m_cachedFracDeadStrip.count(chamberId)) return;
+    m_cachedFracDeadStrip[chamberId] = fds;
+}
+
+// setGapEfficiency
+void
+RpcCondDbData::setGapEfficiency(Identifier chamberId, double efficiency){
+    if(m_cachedGapEfficiency.count(chamberId)) return;
+    m_cachedGapEfficiency[chamberId] = efficiency;
+}
+
+// setLowEffPanel
+void
+RpcCondDbData::setLowEffPanel(Identifier chamberId){
+    if(std::find(m_cachedLowEffPanels.begin(), m_cachedLowEffPanels.end(), chamberId)!=m_cachedLowEffPanels.end()) return;
+    m_cachedLowEffPanels.push_back(chamberId);
+}
+
+// setMeanClusterSize
+void
+RpcCondDbData::setMeanClusterSize(Identifier chamberId, double mcs){
+    if(m_cachedMeanClusterSize.count(chamberId)) return;
+    m_cachedMeanClusterSize[chamberId] = mcs;
+}
+
+// setOffPanel
+void
+RpcCondDbData::setOffPanel(std::string name, Identifier Id){
+    if(std::find(m_cachedOffPanelsId.begin(), m_cachedOffPanelsId.end(), Id)!=m_cachedOffPanelsId.end()) return;
+    m_cachedOffPanels  .push_back(name);
+    m_cachedOffPanelsId.push_back(Id  );
+}
+
+// setProjectedTrack
+void
+RpcCondDbData::setProjectedTrack(Identifier chamberId, int projectedTracks){
+    if(m_cachedProjectedTracks.count(chamberId)) return;
+    m_cachedProjectedTracks[chamberId] = projectedTracks;
+}
+
+// setStripTime
+void
+RpcCondDbData::setStripTime(Identifier stripId, std::vector<double> time){
+    if(m_cachedStripTime.count(stripId)) return;
+    m_cachedStripTime[stripId] = time;
+}
+
+
+
+
+
+
+// --- reading identifiers -------
+
+
+// getDeadPanels
+const std::vector<std::string>& 
+RpcCondDbData::getDeadPanels() const{
+    if(m_cachedDeadPanels.size()!=0) return m_cachedDeadPanels;
+    return m_emptyNames;
+}
+
+// getDeadPanelsId
+const std::vector<Identifier>& 
+RpcCondDbData::getDeadPanelsId() const{
+    if(m_cachedDeadPanelsId.size()!=0) return m_cachedDeadPanelsId;
+    return m_emptyIds;
+}
+
+// getDeadStrips
+const std::vector<Identifier>& 
+RpcCondDbData::getDeadStrips() const{
+    if(m_cachedDeadStrips.size()!=0) return m_cachedDeadStrips;
+    return m_emptyIds;
+}
+
+// getLowEffPanels
+const std::vector<Identifier>& 
+RpcCondDbData::getLowEffPanels() const{
+    if(m_cachedLowEffPanels.size()!=0) return m_cachedLowEffPanels;
+    return m_emptyIds;
+}
+
+// getOffPanels
+const std::vector<std::string>& 
+RpcCondDbData::getOffPanels() const{
+    if(m_cachedOffPanels.size()!=0) return m_cachedOffPanels;
+    return m_emptyNames;
+}
+
+// getOffPanelsId
+const std::vector<Identifier>& 
+RpcCondDbData::getOffPanelsId() const{
+    if(m_cachedOffPanelsId.size()!=0) return m_cachedOffPanelsId;
+    return m_emptyIds;
+}
+
+
+
+
+
+// getDeadStripInt
+const int&
+RpcCondDbData::getDeadStripInt(const Identifier & Id) {
+	if(m_cachedDeadStripListInt.find(Id)==m_cachedDeadStripListInt.end()) return m_nillint;
+	return m_cachedDeadStripListInt[Id];
+} 
+
+// getDeadStripList
+const std::string&
+RpcCondDbData::getDeadStripList(const Identifier & Id) {
+	if(m_cachedDeadStripList.find(Id)==m_cachedDeadStripList.end()) return m_nillstr;
+	return m_cachedDeadStripList[Id];
+} 
+
+// getEfficiency
+const double&
+RpcCondDbData::getEfficiency(const Identifier & Id) {
+	if(m_cachedEfficiency.find(Id)==m_cachedEfficiency.end()) return m_nill;
+	return m_cachedEfficiency[Id];
+} 
+
+// getFracClusterSize1
+const double&
+RpcCondDbData::getFracClusterSize1(const Identifier & Id) {
+	if(m_cachedFracClusterSize1.find(Id)==m_cachedFracClusterSize1.end()) return m_nill;
+	return m_cachedFracClusterSize1[Id];
+} 
+
+// getFracClusterSize2
+const double&
+RpcCondDbData::getFracClusterSize2(const Identifier & Id) {
+	if(m_cachedFracClusterSize2.find(Id)==m_cachedFracClusterSize2.end()) return m_nill;
+	return m_cachedFracClusterSize2[Id];
+} 
+
+// getFracClusterSize3
+const double&
+RpcCondDbData::getFracClusterSize3(const Identifier & Id) {
+	if(m_cachedFracClusterSize3.find(Id)==m_cachedFracClusterSize3.end()) return m_nill;
+	return m_cachedFracClusterSize3[Id];
+} 
+
+// getFracDeadStrip
+const double&
+RpcCondDbData::getFracDeadStrip(const Identifier & Id) {
+	if(m_cachedFracDeadStrip.find(Id)==m_cachedFracDeadStrip.end()) return m_nill;
+	return m_cachedFracDeadStrip[Id];
+} 
+
+// getGapEfficiency
+const double&
+RpcCondDbData::getGapEfficiency(const Identifier & Id) {
+	if(m_cachedGapEfficiency.find(Id)==m_cachedGapEfficiency.end()) return m_nill;
+	return m_cachedGapEfficiency[Id];
+} 
+
+// getMeanClusterSize
+const double&
+RpcCondDbData::getMeanClusterSize(const Identifier & Id) {
+	if(m_cachedMeanClusterSize.find(Id)==m_cachedMeanClusterSize.end()) return m_nill;
+	return m_cachedMeanClusterSize[Id];
+} 
+
+// getProjectedTrack
+const int&
+RpcCondDbData::getProjectedTrack(const Identifier & Id) {
+	if(m_cachedProjectedTracks.find(Id)==m_cachedProjectedTracks.end()) return m_nillint;
+	return m_cachedProjectedTracks[Id];
+} 
+
+// getStripTime
+const std::vector<double>& 
+RpcCondDbData::getStripTime(const Identifier & Id) {
+	if(m_cachedStripTime.find(Id)==m_cachedStripTime.end()) return m_emptyDoubles;
+	return m_cachedStripTime[Id];
+} 
+
+
+
+
+// --- probing identifiers -------
+
+// isGood
+bool 
+RpcCondDbData::isGood(const Identifier & Id) const{
+    // probing id in all lists
+    if(not isGoodPanel(Id)) return false;
+    if(    isOffPanel (Id)) return false;
+    if(not isGoodStrip(Id)) return false;
+    return true;
+}
+
+// isGoodPanel
+bool 
+RpcCondDbData::isGoodPanel(const Identifier & Id) const{
+    if(m_cachedDeadPanelsId.size()==0) return true;
+    bool found = std::find(m_cachedDeadPanelsId.begin(), m_cachedDeadPanelsId.end(), Id)!=m_cachedDeadPanelsId.end();
+    return !found;
+} 
+
+// isGoodStrip
+bool 
+RpcCondDbData::isGoodStrip(const Identifier & Id) const{
+    if(m_cachedDeadStrips.size()==0) return true;
+    bool found = std::find(m_cachedDeadStrips.begin(), m_cachedDeadStrips.end(), Id)!=m_cachedDeadStrips.end();
+    return !found;
+} 
+
+// isOffPanel
+bool 
+RpcCondDbData::isOffPanel(const Identifier & Id) const{
+    if(m_cachedOffPanelsId.size()==0) return true;
+    bool found = std::find(m_cachedOffPanelsId.begin(), m_cachedOffPanelsId.end(), Id)!=m_cachedOffPanelsId.end();
+    return found;
+} 
+
+// isEffPanel
+bool
+RpcCondDbData::isEffPanel(const Identifier & Id) const{
+    if(m_cachedLowEffPanels.size()==0) return true;
+    bool found = std::find(m_cachedLowEffPanels.begin(), m_cachedLowEffPanels.end(), Id)!=m_cachedLowEffPanels.end();
+    return !found;
+} 
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcCondDbData.cxx
new file mode 100644
index 00000000000..d6da1573d14
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcCondDbData.cxx
@@ -0,0 +1,61 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondData/TgcCondDbData.h"
+
+//STL includes
+#include <vector>
+#include <string>
+
+#include "Identifier/Identifier.h"
+
+using namespace std;
+
+
+// constructor
+TgcCondDbData::TgcCondDbData(){
+}
+
+
+// --- writing identifiers -------
+
+// setDeadStation
+void
+TgcCondDbData::setDeadStation(Identifier Id){
+    if(std::binary_search(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id, Compare)) return;
+    m_cachedDeadStationsId.push_back(Id  );
+}
+
+
+// --- reading identifiers -------
+
+// getDeadStationsId
+const 
+std::vector<Identifier>& TgcCondDbData::getDeadStationsId() const{
+    if(m_cachedDeadStationsId.size()!=0) return m_cachedDeadStationsId;
+    return m_emptyIds;
+}
+
+
+// --- probing identifiers -------
+
+// isGood
+bool 
+TgcCondDbData::isGood(const Identifier & Id) const{
+    // probing id in all lists
+    if(not isGoodStation   (Id)) return false;
+    return true;
+}
+
+// isGoodStation
+bool
+TgcCondDbData::isGoodStation(const Identifier & Id) const{
+    if(m_cachedDeadStationsId.size()==0) return true;
+    bool found = std::binary_search(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id, Compare);
+    return !found;
+} 
+
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/MDTConditionsTestAlgMT.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/MDTConditionsTestAlgMT.h
new file mode 100644
index 00000000000..fd49a7d0822
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/MDTConditionsTestAlgMT.h
@@ -0,0 +1,43 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MDTConditionsTestAlgMT_H
+#define MDTConditionsTestAlgMT_H 
+
+//STL
+#include <string>
+
+//Gaudi
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "GaudiKernel/ServiceHandle.h"
+
+//Athena
+#include "MuonCondInterface/IMDTConditionsSvc.h"
+#include "MuonCondData/MdtCondDbData.h"
+
+
+//Forward declarations
+class ISvcLocator;
+class StatusCode;
+class MdtCondDbData;
+
+
+
+///Example class to show calling the SCT_ConditionsSummarySvc
+class MDTConditionsTestAlgMT : public AthAlgorithm {
+
+ public:
+  MDTConditionsTestAlgMT(const std::string &name,ISvcLocator *pSvcLocator) ;
+ ~MDTConditionsTestAlgMT();
+
+  StatusCode initialize();
+  StatusCode execute();
+  StatusCode finalize();
+   
+ private:
+  SG::ReadCondHandleKey<MdtCondDbData> m_readKey{this, "ReadKey", "MdtCondDbData", "Key of MdtCondDbData"};
+
+}; //end of class
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py
new file mode 100644
index 00000000000..b54c30a39f6
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py
@@ -0,0 +1,206 @@
+
+
+run  = "mc" ## "mc" or "dataR1" or "dataR2"
+what = "mdt" ## "mdt" or "csc" or "rpc" or "tgc"
+
+from AthenaCommon.GlobalFlags import GlobalFlags, globalflags
+if run == "dataR1":
+	globalflags.DetGeo.set_Value_and_Lock('atlas') 
+	globalflags.DataSource.set_Value_and_Lock('data')
+	globalflags.DatabaseInstance.set_Value_and_Lock("COMP200")
+if run == "dataR2":
+	globalflags.DetGeo.set_Value_and_Lock('atlas') 
+	globalflags.DataSource.set_Value_and_Lock('data')
+	globalflags.DatabaseInstance.set_Value_and_Lock("CONDBR2")
+
+
+
+
+#--------------------------------------------------------------
+# Setup Athena
+#--------------------------------------------------------------
+
+from AthenaCommon.AppMgr import ToolSvc
+from AthenaCommon.AlgSequence import AlgSequence
+
+import AthenaCommon.AtlasUnixStandardJob
+
+# use auditors
+from AthenaCommon.AppMgr import ServiceMgr,athCondSeq
+
+from GaudiSvc.GaudiSvcConf import AuditorSvc
+
+ServiceMgr += AuditorSvc()
+theAuditorSvc = ServiceMgr.AuditorSvc
+theAuditorSvc.Auditors  += [ "ChronoAuditor"]
+theAuditorSvc.Auditors  += [ "MemStatAuditor" ]
+theApp.AuditAlgorithms=True
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.detdescr.SCT_setOff()
+DetFlags.ID_setOff()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+DetFlags.Truth_setOff()
+DetFlags.LVL1_setOff()
+DetFlags.SCT_setOff()
+DetFlags.TRT_setOff()
+
+import AtlasGeoModel.SetGeometryVersion
+import AtlasGeoModel.GeoModelInit
+
+from AthenaCommon.JobProperties import jobproperties
+from AthenaCommon.AlgSequence import AlgSequence
+
+job = AlgSequence()
+
+
+
+##--------------------------------------------------------------
+## Data Base Services
+##--------------------------------------------------------------
+
+from AthenaCommon.AlgSequence import AthSequencer
+
+condSequence = AthSequencer("AthCondSeq")
+
+# Conditions Service for reading conditions data in serial and MT Athena
+from IOVSvc.IOVSvcConf import CondSvc
+svcMgr += CondSvc()
+
+# Conditions data access infrastructure for serial and MT Athena
+from IOVSvc.IOVSvcConf import CondInputLoader
+condSequence += CondInputLoader( "CondInputLoader")
+
+import StoreGate.StoreGateConf as StoreGateConf
+svcMgr += StoreGateConf.StoreGateSvc("ConditionStore")
+
+from IOVDbSvc.CondDB import conddb
+
+
+## MDT 
+if what=="mdt":
+	if run=="mc":
+		conddb.setGlobalTag("OFLCOND-MC16-SDR-20")
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/DROPPEDCH"        , className='CondAttrListCollection');
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/PSLVCHSTATE"      , className='CondAttrListCollection');
+		#conddb.addFolder("MDT_OFL", "/MDT/DQMF/DEAD_ELEMENT"    , className='CondAttrListCollection');
+		#conddb.addFolder("MDT_OFL", "/MDT/TUBE_STATUS/DEAD_TUBE", className='CondAttrListCollection');
+	elif run=="dataR1":
+		conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09")
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/DROPPEDCH"        , forceData=True, className='CondAttrListCollection');
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/PSLVCHSTATE"      , forceData=True, className='CondAttrListCollection');
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/PSHVMLSTATE"      , forceData=True, className='CondAttrListCollection');
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/PSV0SETPOINTS"    , forceData=True, className='CondAttrListCollection');
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/PSV1SETPOINTS"    , forceData=True, className='CondAttrListCollection');
+	elif run=="dataR2":
+		conddb.setGlobalTag("CONDBR2-BLKPA-2018-15")
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/LV"               , forceData=True, className='CondAttrListCollection');
+		conddb.addFolder("DCS_OFL", "/MDT/DCS/HV"               , forceData=True, className='CondAttrListCollection');
+
+
+## CSC
+if what=="csc":
+	if run=="dataR1":
+		conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09")
+		conddb.addFolder("CSC_OFL", "/CSC/STAT"          , className='CondAttrListCollection');
+		#conddb.addFolder("DCS_OFL", "/CSC/DCS/LAYERSTATE", className='CondAttrListCollection');
+
+
+## RPC
+if what=="rpc":
+	if run=="mc":
+		conddb.setGlobalTag("OFLCOND-MC16-SDR-20")
+		conddb.addFolder("DCS_OFL", "/RPC/DCS/DeadRopanels"   , className='CondAttrListCollection'); 
+		conddb.addFolder("DCS_OFL", "/RPC/DCS/OffRopanels"    , className='CondAttrListCollection'); 
+	if run=="dataR1":
+		conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09")
+		conddb.addFolder("RPC_OFL", "/RPC/DQMF/ELEMENT_STATUS", className='CondAttrListCollection'); 
+		conddb.addFolder("DCS_OFL", "/RPC/DCS/DeadRopanels"   , className='CondAttrListCollection'); 
+		conddb.addFolder("DCS_OFL", "/RPC/DCS/OffRopanels"    , className='CondAttrListCollection'); 
+
+
+## TGC
+if what=="tgc":
+	if run=="dataR1":
+		#conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09")
+		#conddb.addFolder("DCS_OFL", "/TGC/1/DetectorStatus"   , className='CondAttrListCollection'); 
+		## this folder is actually scheme ONLINE! DO NOT USE!
+		pass
+
+
+
+
+
+##--------------------------------------------------------------
+## NEW Data Base Algorithms
+##--------------------------------------------------------------
+
+from AthenaCommon.CfgGetter import getPublicTool
+
+from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperTool
+MuonIdHelperTool = Muon__MuonIdHelperTool("Muon::MuonIdHelperTool")
+ToolSvc += MuonIdHelperTool
+#MuonIdHelperTool.OutputLevel = DEBUG
+
+## MDT
+if what=="mdt":
+	from MuonCondAlg.MuonCondAlgConf import MdtCondDbAlg
+	alg = MdtCondDbAlg("MdtCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool"))
+	if run=="dataR1": alg.useRun1SetPoints = False
+
+## CSC
+if what=="csc":
+	from MuonCondAlg.MuonCondAlgConf import CscCondDbAlg
+	alg = CscCondDbAlg("CscCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool"))
+
+## RPC
+if what=="rpc":
+	from MuonCondAlg.MuonCondAlgConf import RpcCondDbAlg
+	alg = RpcCondDbAlg("RpcCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool"))
+
+## TGC
+if what=="tgc":
+	from MuonCondAlg.MuonCondAlgConf import TgcCondDbAlg
+	alg = TgcCondDbAlg("CscCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool"))
+
+## append to sequence
+if run=="mc":
+	alg.isData = False
+elif run=="dataR1":
+	alg.isData = True
+	alg.isRun1 = True
+elif run=="dataR2":
+	alg.isData = True
+	alg.isRun1 = False
+#alg.OutputLevel = DEBUG
+condSequence += alg
+
+
+
+##--------------------------------------------------------------
+## NEW Test Algorithm
+##--------------------------------------------------------------
+if what=="mdt":
+	from MuonCondTest.MuonCondTestConf import MDTConditionsTestAlgMT
+	job += MDTConditionsTestAlgMT()
+
+
+
+##--------------------------------------------------------------
+## General Stuff
+##--------------------------------------------------------------
+import AthenaCommon.AtlasUnixGeneratorJob
+
+ServiceMgr.EventSelector.RunNumber  = 138460 #1204110576 seconds epoch
+import time, calendar
+#time in seconds , now
+ServiceMgr.EventSelector.InitialTimeStamp  = calendar.timegm(time.gmtime())
+#ServiceMgr.EventSelector.InitialTimeStamp  =  594682#found valid in db browser?
+theApp.EvtMax                              =  2 
+
+ServiceMgr.MessageSvc.Format      = "% F%40W%S%7W%R%T %0W%M"
+ServiceMgr.MessageSvc.OutputLevel = VERBOSE
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py
new file mode 100644
index 00000000000..ae07c3bc349
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py
@@ -0,0 +1,157 @@
+
+
+run = "mc" ## "mc" or "dataR1" or "dataR2"
+
+from AthenaCommon.GlobalFlags import GlobalFlags, globalflags
+if run == "dataR1":
+	globalflags.DetGeo.set_Value_and_Lock('atlas') 
+	globalflags.DataSource.set_Value_and_Lock('data')
+	globalflags.DatabaseInstance.set_Value_and_Lock("COMP200")
+if run == "dataR2":
+	globalflags.DetGeo.set_Value_and_Lock('atlas') 
+	globalflags.DataSource.set_Value_and_Lock('data')
+	globalflags.DatabaseInstance.set_Value_and_Lock("CONDBR2")
+
+
+
+
+#--------------------------------------------------------------
+# Setup Athena
+#--------------------------------------------------------------
+
+from AthenaCommon.AppMgr import ToolSvc
+from AthenaCommon.AlgSequence import AlgSequence
+
+import AthenaCommon.AtlasUnixStandardJob
+
+# use auditors
+from AthenaCommon.AppMgr import ServiceMgr,athCondSeq
+
+from GaudiSvc.GaudiSvcConf import AuditorSvc
+
+ServiceMgr += AuditorSvc()
+theAuditorSvc = ServiceMgr.AuditorSvc
+theAuditorSvc.Auditors  += [ "ChronoAuditor"]
+theAuditorSvc.Auditors  += [ "MemStatAuditor" ]
+theApp.AuditAlgorithms=True
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.detdescr.SCT_setOff()
+DetFlags.ID_setOff()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+DetFlags.Truth_setOff()
+DetFlags.LVL1_setOff()
+DetFlags.SCT_setOff()
+DetFlags.TRT_setOff()
+
+import AtlasGeoModel.SetGeometryVersion
+import AtlasGeoModel.GeoModelInit
+
+from AthenaCommon.JobProperties import jobproperties
+from AthenaCommon.AlgSequence import AlgSequence
+
+job = AlgSequence()
+
+
+
+
+##--------------------------------------------------------------
+## Data Base Services
+##--------------------------------------------------------------
+
+from AthenaCommon.AlgSequence import AthSequencer
+
+condSequence = AthSequencer("AthCondSeq")
+
+# Conditions Service for reading conditions data in serial and MT Athena
+from IOVSvc.IOVSvcConf import CondSvc
+svcMgr += CondSvc()
+
+# Conditions data access infrastructure for serial and MT Athena
+from IOVSvc.IOVSvcConf import CondInputLoader
+condSequence += CondInputLoader( "CondInputLoader")
+
+import StoreGate.StoreGateConf as StoreGateConf
+svcMgr += StoreGateConf.StoreGateSvc("ConditionStore")
+
+from IOVDbSvc.CondDB import conddb
+
+if run=="mc":
+	conddb.setGlobalTag("OFLCOND-MC16-SDR-20")
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/DROPPEDCH"        , className='CondAttrListCollection');
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/PSLVCHSTATE"      , className='CondAttrListCollection');
+	#conddb.addFolder("MDT_OFL", "/MDT/DQMF/DEAD_ELEMENT"    , className='CondAttrListCollection');
+	#conddb.addFolder("MDT_OFL", "/MDT/TUBE_STATUS/DEAD_TUBE", className='CondAttrListCollection');
+elif run=="dataR1":
+	conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09")
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/DROPPEDCH"        , forceData=True, className='CondAttrListCollection');
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/PSLVCHSTATE"      , forceData=True, className='CondAttrListCollection');
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/PSHVMLSTATE"      , forceData=True, className='CondAttrListCollection');
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/PSV0SETPOINTS"    , forceData=True, className='CondAttrListCollection');
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/PSV1SETPOINTS"    , forceData=True, className='CondAttrListCollection');
+elif run=="dataR2":
+	conddb.setGlobalTag("CONDBR2-BLKPA-2018-15")
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/LV"               , forceData=True, className='CondAttrListCollection');
+	conddb.addFolder("DCS_OFL", "/MDT/DCS/HV"               , forceData=True, className='CondAttrListCollection');
+
+
+
+
+
+
+##--------------------------------------------------------------
+## NEW Data Base Algorithms
+##--------------------------------------------------------------
+
+from AthenaCommon.CfgGetter import getPublicTool
+
+from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperTool
+MuonIdHelperTool = Muon__MuonIdHelperTool("Muon::MuonIdHelperTool")
+ToolSvc += MuonIdHelperTool
+#MuonIdHelperTool.OutputLevel = DEBUG
+
+
+from MuonCondAlg.MuonCondAlgConf import MdtCondDbAlg
+alg = MdtCondDbAlg("MdtCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool"))
+
+if "mc" in run:
+	alg.isData = False
+elif run=="dataR1":
+	alg.isData           = True
+	alg.isRun1           = True
+	alg.useRun1SetPoints = False
+elif run=="dataR2":
+	alg.isData = True
+	alg.isRun1 = False
+
+#alg.OutputLevel = DEBUG
+condSequence += alg
+
+
+
+##--------------------------------------------------------------
+## NEW Test Algorithm
+##--------------------------------------------------------------
+from MuonCondTest.MuonCondTestConf import MDTConditionsTestAlgMT
+job += MDTConditionsTestAlgMT()
+
+
+
+##--------------------------------------------------------------
+## General Stuff
+##--------------------------------------------------------------
+import AthenaCommon.AtlasUnixGeneratorJob
+
+ServiceMgr.EventSelector.RunNumber  = 138460 #1204110576 seconds epoch
+import time, calendar
+#time in seconds , now
+ServiceMgr.EventSelector.InitialTimeStamp  = calendar.timegm(time.gmtime())
+#ServiceMgr.EventSelector.InitialTimeStamp  =  594682#found valid in db browser?
+theApp.EvtMax                              =  2 
+
+ServiceMgr.MessageSvc.Format      = "% F%40W%S%7W%R%T %0W%M"
+ServiceMgr.MessageSvc.OutputLevel = VERBOSE
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MDTConditionsTestAlgMT.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MDTConditionsTestAlgMT.cxx
new file mode 100644
index 00000000000..0cf0a75fd4e
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MDTConditionsTestAlgMT.cxx
@@ -0,0 +1,110 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondTest/MDTConditionsTestAlgMT.h"
+#include "MuonCondSvc/MuonHierarchy.h"
+
+
+//Gaudi includes
+#include "GaudiKernel/StatusCode.h"
+
+//Athena includes
+#include "Identifier/Identifier.h"
+
+
+MDTConditionsTestAlgMT::MDTConditionsTestAlgMT(
+                         const std::string& name,
+                         ISvcLocator* pSvcLocator ) :
+                         AthAlgorithm( name, pSvcLocator ){
+			
+}
+
+MDTConditionsTestAlgMT::~MDTConditionsTestAlgMT()
+{
+  ATH_MSG_VERBOSE( "Calling destructor"  );
+}
+
+//Initialize
+StatusCode
+MDTConditionsTestAlgMT::initialize(){
+ 
+  StatusCode sc(StatusCode::SUCCESS);
+  msg(MSG::INFO)<< "Calling initialize" << endmsg;
+  ATH_CHECK(m_readKey.initialize());
+ 
+  return sc;
+}
+
+//Execute
+StatusCode
+MDTConditionsTestAlgMT::execute(){
+  StatusCode sc(StatusCode::SUCCESS);
+
+  msg(MSG::INFO)<< "Calling execute" << endmsg;
+  msg(MSG::INFO)<< "Now setting up read handle: "; 
+  SG::ReadCondHandle<MdtCondDbData> readHandle{m_readKey};
+  const MdtCondDbData* readCdo{*readHandle};
+  if(readCdo==0){
+    msg(MSG::INFO)<< "DID NOT WORK!"<< endmsg;
+    ATH_MSG_ERROR("Null pointer to the read conditions object");
+    return StatusCode::FAILURE;
+  }
+  else {
+    msg(MSG::INFO)<< "worked!"<< endmsg;
+  }
+
+
+  msg(MSG::INFO)<<"Reading Dead Tubes: ";
+  int size = readCdo->getDeadTubesId().size();
+  msg(MSG::INFO)<<"found "<<size<<" from Id"<<endmsg;
+  for(int k=0;k<size;++k){
+    msg(MSG::INFO)<<"\t"<<k<<": "<<readCdo->getDeadTubes()[k]<<endmsg;
+  } 
+
+  msg(MSG::INFO)<<"Reading Dead Layers: ";
+  size = readCdo->getDeadLayersId().size();
+  msg(MSG::INFO)<<"found "<<size<<" from Id"<<endmsg;
+  for(int k=0;k<size;++k){
+    msg(MSG::INFO)<<"\t"<<k<<": "<<readCdo->getDeadLayers()[k]<<endmsg;
+  } 
+
+  msg(MSG::INFO)<<"Reading Dead Multilayers: ";
+  size = readCdo->getDeadMultilayersId().size();
+  msg(MSG::INFO)<<"found "<<size<<" from Id"<<endmsg;
+  for(int k=0;k<size;++k){
+    msg(MSG::INFO)<<"\t"<<k<<": "<<readCdo->getDeadMultilayers()[k]<<endmsg;
+  } 
+
+  msg(MSG::INFO)<<"Reading Dead Stations: ";
+  size = readCdo->getDeadStationsId().size();
+  msg(MSG::INFO)<<"found "<<size<<" from Id"<<endmsg;
+  for(int k=0;k<size;++k){
+    msg(MSG::INFO)<<"\t"<<k<<": "<<readCdo->getDeadStations()[k]<<endmsg;
+  } 
+
+  msg(MSG::INFO)<<"Reading Chambers with Dead Channels: ";
+  size = readCdo->getDeadChambersId().size();
+  msg(MSG::INFO)<<"found "<<size<<" from Id"<<endmsg;
+  for(int k=0;k<size;++k){
+    msg(MSG::INFO)<<"\t"<<k<<": "<<readCdo->getDeadChambersId()[k]<<endmsg;
+  } 
+
+
+  msg(MSG::INFO)<<"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"<<endmsg;
+
+  msg(MSG::INFO)<<"Now probing Ids"<<endmsg;
+  msg(MSG::INFO)<<"ID=1699348480; isGood? "<<readCdo->isGood(Identifier(1699348480))<<endmsg;
+
+  msg(MSG::INFO)<<"MADE IT TO THE END"<<endmsg;
+  return sc;
+}
+
+
+//Finalize
+StatusCode
+MDTConditionsTestAlgMT::finalize(){
+  StatusCode sc(StatusCode::SUCCESS);
+  msg(MSG::INFO)<< "Calling finalize" << endmsg;
+  return sc;
+}
-- 
GitLab