diff --git a/Database/CoralUtilities/src/blobaccess.cxx b/Database/CoralUtilities/src/blobaccess.cxx
index 3639a817712fcf694b69bae567e9dcbf11e4c0cf..5ed56c257d25f2d11bfd11f2607f75d33745cfc3 100644
--- a/Database/CoralUtilities/src/blobaccess.cxx
+++ b/Database/CoralUtilities/src/blobaccess.cxx
@@ -108,8 +108,10 @@ bool readBlobAsJson(const coral::Blob &blob, nlohmann::json& out){
 bool readBlobAsTTree(const coral::Blob &blob, TTree*& out){
 	std::string sb = reinterpret_cast<const char*>(blob.startingAddress());
 	std::vector<unsigned char> bdata = CxxUtils::base64_decode(sb);
-	TMemFile f("buffer", reinterpret_cast<char*>(bdata.data()), static_cast<uLongf>(blob.size())); 
-	TTree* t = (TTree*) f.Get("tmptree");
+	TMemFile f("buffer", reinterpret_cast<char*>(bdata.data()), static_cast<uLongf>(bdata.size())); 
+	TTree* t = (TTree*) f.Get("tree");
+	t->LoadBaskets();
+	t->SetDirectory(0);
 	f.Close();
 	out = t;
 	return true;
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt
index 472f44dc999af8af4203907a859a7c440dd6ca99..aa4fa2b8b0f31d2cffc4a5810e2efcd38265cc2d 100644
--- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt
@@ -16,7 +16,7 @@ atlas_add_library( MuonCondAlgLib
                    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 MuonCondSvcLib CoralUtilitiesLib StoreGateLib MuonIdHelpersLib MuonReadoutGeometry MdtCalibSvcLib MdtCalibData MuonCalibITools MdtCalibUtils MuonCalibToolsLib PathResolver nlohmann_json::nlohmann_json 
+                   LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities Identifier GaudiKernel MuonCondData MuonCondInterface MuonCondSvcLib CoralUtilitiesLib StoreGateLib MuonIdHelpersLib MuonReadoutGeometry MdtCalibSvcLib MdtCalibData MuonCalibITools MdtCalibUtils MuonCalibToolsLib PathResolver MuonNSWCommonDecode nlohmann_json::nlohmann_json 
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo )
 
 atlas_add_component( MuonCondAlg
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/NswCalibDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/NswCalibDbAlg.h
new file mode 100644
index 0000000000000000000000000000000000000000..e60fde706d8a776eca996e3e6e5def6413a326ec
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/NswCalibDbAlg.h
@@ -0,0 +1,81 @@
+/*
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDALG_NSWCALIBDBALG_H
+#define MUONCONDALG_NSWCALIBDBALG_H
+
+// STL includes
+#include <string>
+#include <vector>
+
+// Gaudi includes
+#include "GaudiKernel/ICondSvc.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "GaudiKernel/ToolHandle.h"
+
+// Athena includes
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "StoreGate/WriteCondHandleKey.h"
+
+// Muon includes
+#include "MuonCondData/NswCalibDbTimeChargeData.h"
+#include "MuonCondData/NswCalibDbThresholdData.h"
+#include "MuonIdHelpers/IMuonIdHelperSvc.h"
+
+
+// Forward declarations
+class CondAttrListCollection;
+
+
+class NswCalibDbAlg: public AthReentrantAlgorithm{
+
+public:
+
+    using AthReentrantAlgorithm::AthReentrantAlgorithm;
+    virtual ~NswCalibDbAlg() = default;
+    virtual StatusCode initialize() override;
+    virtual StatusCode execute (const EventContext&) const override;
+
+ 
+private:
+
+    typedef SG::WriteCondHandleKey<NswCalibDbTimeChargeData> writeKeyTdoPdo_t;
+    typedef SG::WriteCondHandleKey<NswCalibDbThresholdData > writeKeyVmm_t;
+    typedef SG::ReadCondHandleKey<CondAttrListCollection> readKey_t;
+
+	StatusCode loadDataCalibMm  (const EventContext& ctx) const;
+	StatusCode loadDataCalibStgc(const EventContext& ctx) const;
+
+	StatusCode loadTimeChargeData(const EventContext&, readKey_t, const std::string) const;
+	StatusCode loadThresholdData (const EventContext&, readKey_t                   ) const;
+
+	bool buildChannelId(Identifier*& channelId, unsigned int elinkId, unsigned int vmm, unsigned int channel) const;
+    
+    Gaudi::Property<bool> m_isOnline{this, "isOnline", false, "This algo is being used online"};
+    Gaudi::Property<bool> m_isData  {this, "isData"  , true , "Processing data"};
+
+    ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
+    ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
+ 
+    writeKeyTdoPdo_t m_writeKey_tdopdo{this, "WriteKey_TdoPdo", "NswCalibDbTimeChargeData", "Key of output calibration data (TDOs and PDOs)" };
+    writeKeyVmm_t    m_writeKey_vmm   {this, "WriteKey_VMM"   , "NswCalibDbThresholdData" , "Key of output calibration data (VMM thresholds)"};
+
+    readKey_t m_readKey_data_mm_sidea_tdo  {this, "ReadKey_MM_SIDEA_TDO"  , "/MDT/MM/TIME/SIDEA"   , "Key of input MM condition data for side A data TDO"};
+    readKey_t m_readKey_data_mm_sidec_tdo  {this, "ReadKey_MM_SIDEC_TDO"  , "/MDT/MM/TIME/SIDEC"   , "Key of input MM condition data for side C data TDO"};
+    readKey_t m_readKey_data_mm_sidea_pdo  {this, "ReadKey_MM_SIDEA_PDO"  , "/MDT/MM/CHARGE/SIDEA" , "Key of input MM condition data for side A data PDO"};
+    readKey_t m_readKey_data_mm_sidec_pdo  {this, "ReadKey_MM_SIDEC_PDO"  , "/MDT/MM/CHARGE/SIDEC" , "Key of input MM condition data for side C data PDO"};
+    readKey_t m_readKey_data_mm_sidea_vmm  {this, "ReadKey_MM_SIDEA_VMM"  , "/MDT/MM/VMM/SIDEA"    , "Key of input MM condition data for side A data VMM"};
+    readKey_t m_readKey_data_mm_sidec_vmm  {this, "ReadKey_MM_SIDEC_VMM"  , "/MDT/MM/VMM/SIDEC"    , "Key of input MM condition data for side C data VMM"};
+    readKey_t m_readKey_data_stgc_sidea_tdo{this, "ReadKey_STGC_SIDEA_TDO", "/TGC/NSW/TIME/SIDEA"  , "Key of input sTGC condition data for side A data TDO"};
+    readKey_t m_readKey_data_stgc_sidec_tdo{this, "ReadKey_STGC_SIDEC_TDO", "/TGC/NSW/TIME/SIDEC"  , "Key of input sTGC condition data for side C data TDO"};
+    readKey_t m_readKey_data_stgc_sidea_pdo{this, "ReadKey_STGC_SIDEA_PDO", "/TGC/NSW/CHARGE/SIDEA", "Key of input sTGC condition data for side A data PDO"};
+    readKey_t m_readKey_data_stgc_sidec_pdo{this, "ReadKey_STGC_SIDEC_PDO", "/TGC/NSW/CHARGE/SIDEC", "Key of input sTGC condition data for side C data PDO"};
+    readKey_t m_readKey_data_stgc_sidea_vmm{this, "ReadKey_STGC_SIDEA_VMM", "/TGC/NSW/VMM/SIDEA"   , "Key of input sTGC condition data for side A data VMM"};
+    readKey_t m_readKey_data_stgc_sidec_vmm{this, "ReadKey_STGC_SIDEC_VMM", "/TGC/NSW/VMM/SIDEC"   , "Key of input sTGC condition data for side C data VMM"};
+ 
+};
+
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/NswCalibDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/NswCalibDbAlg.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..480e285590585a4c6d1c296cfca9301cdeec49fe
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/NswCalibDbAlg.cxx
@@ -0,0 +1,345 @@
+/*
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondAlg/NswCalibDbAlg.h"
+
+#include "TTree.h"
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+#include "CoralBase/Blob.h"
+#include "CoralUtilities/blobaccess.h"
+#include "MuonCondData/NswCalibDbTimeChargeData.h"
+#include "MuonCondData/NswCalibDbThresholdData.h"
+#include "MuonNSWCommonDecode/NSWElink.h"
+#include "MuonNSWCommonDecode/NSWResourceId.h"
+#include "MuonNSWCommonDecode/NSWOfflineHelper.h"
+
+
+// Initialize
+StatusCode
+NswCalibDbAlg::initialize(){
+
+	// retrievals
+	ATH_MSG_DEBUG( "initializing " << name() );                
+	ATH_CHECK(m_condSvc    .retrieve());
+	ATH_CHECK(m_idHelperSvc.retrieve());
+
+    // read keys
+    ATH_CHECK(m_readKey_data_mm_sidea_tdo  .initialize(!m_readKey_data_mm_sidea_tdo  .empty() && m_isData));
+    ATH_CHECK(m_readKey_data_mm_sidec_tdo  .initialize(!m_readKey_data_mm_sidec_tdo  .empty() && m_isData));
+    ATH_CHECK(m_readKey_data_mm_sidea_pdo  .initialize(!m_readKey_data_mm_sidea_pdo  .empty() && m_isData));
+    ATH_CHECK(m_readKey_data_mm_sidec_pdo  .initialize(!m_readKey_data_mm_sidec_pdo  .empty() && m_isData));
+    ATH_CHECK(m_readKey_data_mm_sidea_vmm  .initialize(!m_readKey_data_mm_sidea_vmm  .empty() && m_isData));
+    ATH_CHECK(m_readKey_data_mm_sidec_vmm  .initialize(!m_readKey_data_mm_sidec_vmm  .empty() && m_isData));
+    ATH_CHECK(m_readKey_data_stgc_sidea_tdo.initialize(!m_readKey_data_stgc_sidea_tdo.empty() && m_isData));
+    ATH_CHECK(m_readKey_data_stgc_sidec_tdo.initialize(!m_readKey_data_stgc_sidec_tdo.empty() && m_isData));
+    ATH_CHECK(m_readKey_data_stgc_sidea_pdo.initialize(!m_readKey_data_stgc_sidea_pdo.empty() && m_isData));
+    ATH_CHECK(m_readKey_data_stgc_sidec_pdo.initialize(!m_readKey_data_stgc_sidec_pdo.empty() && m_isData));
+    ATH_CHECK(m_readKey_data_stgc_sidea_vmm.initialize(!m_readKey_data_stgc_sidea_vmm.empty() && m_isData));
+    ATH_CHECK(m_readKey_data_stgc_sidec_vmm.initialize(!m_readKey_data_stgc_sidec_vmm.empty() && m_isData));
+
+	// write keys	
+	ATH_CHECK(m_writeKey_tdopdo.initialize());
+	ATH_CHECK(m_writeKey_vmm   .initialize());
+
+	// register write handles
+    if(m_condSvc->regHandle(this, m_writeKey_tdopdo).isFailure()) {
+      ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey_tdopdo.fullKey() << " with CondSvc");
+      return StatusCode::FAILURE;
+    }
+    if(m_condSvc->regHandle(this, m_writeKey_vmm   ).isFailure()) {
+      ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey_vmm   .fullKey() << " with CondSvc");
+      return StatusCode::FAILURE;
+    }
+
+    return StatusCode::SUCCESS;
+}
+
+
+// execute
+StatusCode 
+NswCalibDbAlg::execute(const EventContext& ctx) const {
+
+	ATH_MSG_DEBUG( "execute " << name() );   
+
+	// nothing to do when online	
+	if(m_isOnline) {
+		ATH_MSG_DEBUG( "IsOnline is set to True; nothing to do!" );   
+		return StatusCode::SUCCESS;
+	}
+	
+	// retrieving data (for future: add calls to separate methods here, if any)
+	if(m_isData) {
+		ATH_CHECK(loadDataCalibMm  (ctx));
+		ATH_CHECK(loadDataCalibStgc(ctx));
+	}
+	else {
+		// keep for now: place to drop MC-only methods, if any
+	} 
+	
+
+	// return	
+	return StatusCode::SUCCESS;
+}
+
+
+// loadDataCalibMm
+StatusCode
+NswCalibDbAlg::loadDataCalibMm(const EventContext& ctx) const{
+
+	if(loadTimeChargeData(ctx, m_readKey_data_mm_sidea_tdo, "TDO").isFailure()) return StatusCode::FAILURE;
+	if(loadTimeChargeData(ctx, m_readKey_data_mm_sidec_tdo, "TDO").isFailure()) return StatusCode::FAILURE;
+	if(loadTimeChargeData(ctx, m_readKey_data_mm_sidea_pdo, "PDO").isFailure()) return StatusCode::FAILURE;
+	if(loadTimeChargeData(ctx, m_readKey_data_mm_sidec_pdo, "PDO").isFailure()) return StatusCode::FAILURE;
+	if(loadThresholdData (ctx, m_readKey_data_mm_sidea_vmm       ).isFailure()) return StatusCode::FAILURE;
+	if(loadThresholdData (ctx, m_readKey_data_mm_sidec_vmm       ).isFailure()) return StatusCode::FAILURE;
+	return StatusCode::SUCCESS;
+}
+	
+
+// loadDataPdo
+StatusCode
+NswCalibDbAlg::loadDataCalibStgc(const EventContext& ctx) const {
+	if(loadTimeChargeData(ctx, m_readKey_data_stgc_sidea_tdo, "TDO").isFailure()) return StatusCode::FAILURE;
+	if(loadTimeChargeData(ctx, m_readKey_data_stgc_sidec_tdo, "TDO").isFailure()) return StatusCode::FAILURE;
+	if(loadTimeChargeData(ctx, m_readKey_data_stgc_sidea_pdo, "PDO").isFailure()) return StatusCode::FAILURE;
+	if(loadTimeChargeData(ctx, m_readKey_data_stgc_sidec_pdo, "PDO").isFailure()) return StatusCode::FAILURE;
+	if(loadThresholdData (ctx, m_readKey_data_stgc_sidea_vmm       ).isFailure()) return StatusCode::FAILURE;
+	if(loadThresholdData (ctx, m_readKey_data_stgc_sidec_vmm       ).isFailure()) return StatusCode::FAILURE;
+	return StatusCode::SUCCESS;
+}
+
+
+// loadThresholdData
+StatusCode
+NswCalibDbAlg::loadThresholdData(const EventContext& ctx, readKey_t readKey) const {
+
+	// set up write handle
+	SG::WriteCondHandle<NswCalibDbThresholdData> writeHandle{m_writeKey_vmm, ctx};
+	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<NswCalibDbThresholdData> writeCdo{std::make_unique<NswCalibDbThresholdData>(m_idHelperSvc->mmIdHelper(), m_idHelperSvc->stgcIdHelper())};
+
+	// set up read handle
+	SG::ReadCondHandle<CondAttrListCollection> readHandle{readKey, ctx};
+	const CondAttrListCollection* readCdo{*readHandle}; 
+	if(readCdo==0){
+	  ATH_MSG_ERROR("Null pointer to the read conditions object");
+	  return StatusCode::FAILURE; 
+	} 
+	writeHandle.addDependency(readHandle);
+	ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+	ATH_MSG_DEBUG("Range of input is " << readHandle.getRange() << ", range of output is " << writeHandle.getRange());
+
+	// iterate through data
+	CondAttrListCollection::const_iterator itr;
+	unsigned int nObjs = 0;
+	for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+		// retrieve blob
+		const coral::AttributeList& atr = itr->second;
+		if(atr["data"].specification().type() != typeid(coral::Blob)) {
+			ATH_MSG_FATAL( "Data column is not of type blob!" );
+			return StatusCode::FAILURE;
+		}
+		coral::Blob blob = atr["data"].data<coral::Blob>();
+		TTree* tree = nullptr;
+		if(!CoralUtilities::readBlobAsTTree(blob, tree)) {
+			ATH_MSG_FATAL( "Cannot retrieve data from coral blob!" );
+			return StatusCode::FAILURE;
+		}
+
+		// parse tree
+		unsigned int elinkId;
+		unsigned int vmm; 
+		unsigned int channel;
+		float threshold;
+
+		tree->SetBranchAddress("vmm"           , &vmm           );
+		tree->SetBranchAddress("channel"       , &channel       );
+		tree->SetBranchAddress("elinkId"       , &elinkId       );
+		tree->SetBranchAddress("threshold"     , &threshold     );
+
+		// loop over channels
+		unsigned int nChns = 0; 
+		for(unsigned int iEvt=0; iEvt<tree->GetEntries(); ++iEvt){
+			tree->GetEntry(iEvt);
+			Identifier* channelId = nullptr;
+			if(!buildChannelId(channelId, elinkId, vmm, channel)){
+				ATH_MSG_WARNING("Could not find valid channelId for elink "<<elinkId);
+				continue;
+			}
+			writeCdo->setData(channelId, threshold);
+        	++nChns;
+		}
+		ATH_MSG_VERBOSE("Retrieved data for "<<nChns<<" channels.");
+        ++nObjs;
+    }
+	ATH_MSG_VERBOSE("Retrieved data for "<<nObjs<<" objects.");
+
+	// insert/write data
+	if (writeHandle.record(std::move(writeCdo)).isFailure()) {
+		ATH_MSG_FATAL("Could not record NswCalibDbTimeChargeData " << writeHandle.key() 
+		      << " with EventRange " << writeHandle.getRange()
+		      << " into Conditions Store");
+		return StatusCode::FAILURE;
+	}		  
+	ATH_MSG_DEBUG("Recorded new " << writeHandle.key() << " with range " << writeHandle.getRange() << " into Conditions Store");
+
+    return StatusCode::SUCCESS;
+}
+
+
+
+// loadTimeChargeData
+StatusCode
+NswCalibDbAlg::loadTimeChargeData(const EventContext& ctx, readKey_t readKey, const std::string type) const {
+
+	// set up write handle
+	SG::WriteCondHandle<NswCalibDbTimeChargeData> writeHandle{m_writeKey_tdopdo, ctx};
+	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<NswCalibDbTimeChargeData> writeCdo{std::make_unique<NswCalibDbTimeChargeData>(m_idHelperSvc->mmIdHelper(), m_idHelperSvc->stgcIdHelper())};
+
+	// set up read handle
+	SG::ReadCondHandle<CondAttrListCollection> readHandle{readKey, ctx};
+	const CondAttrListCollection* readCdo{*readHandle}; 
+	if(readCdo==0){
+	  ATH_MSG_ERROR("Null pointer to the read conditions object");
+	  return StatusCode::FAILURE; 
+	} 
+	writeHandle.addDependency(readHandle);
+	ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
+	ATH_MSG_DEBUG("Range of input is " << readHandle.getRange() << ", range of output is " << writeHandle.getRange());
+
+	// iterate through data
+	CondAttrListCollection::const_iterator itr;
+	unsigned int nObjs = 0;
+	for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
+
+		// retrieve blob
+		const coral::AttributeList& atr = itr->second;
+		if(atr["data"].specification().type() != typeid(coral::Blob)) {
+			ATH_MSG_FATAL( "Data column is not of type blob!" );
+			return StatusCode::FAILURE;
+		}
+		coral::Blob blob = atr["data"].data<coral::Blob>();
+		TTree* tree = nullptr;
+		if(!CoralUtilities::readBlobAsTTree(blob, tree)) {
+			ATH_MSG_FATAL( "Cannot retrieve data from coral blob!" );
+			return StatusCode::FAILURE;
+		}
+
+		// parse tree
+		unsigned int elinkId;
+		unsigned int vmm; 
+		unsigned int channel;
+		float slope;
+		float slopeError;
+		float intercept;
+		float interceptError;
+		float chi2;
+		float prob;
+
+		tree->SetBranchAddress("vmm"           , &vmm           );
+		tree->SetBranchAddress("channel"       , &channel       );
+		tree->SetBranchAddress("elinkId"       , &elinkId       );
+		tree->SetBranchAddress("slope"         , &slope         );
+		tree->SetBranchAddress("slopeError"    , &slopeError    );
+		tree->SetBranchAddress("intercept"     , &intercept     );
+		tree->SetBranchAddress("interceptError", &interceptError);
+		tree->SetBranchAddress("chi2"          , &chi2          );
+		tree->SetBranchAddress("prob"          , &prob          );
+
+		// loop over channels
+		unsigned int nChns = 0; 
+		for(unsigned int iEvt=0; iEvt<tree->GetEntries(); ++iEvt){
+			tree->GetEntry(iEvt);
+			Identifier* channelId = nullptr;
+			if(!buildChannelId(channelId, elinkId, vmm, channel)){
+				ATH_MSG_WARNING("Could not find valid channelId for elink "<<elinkId);
+				continue;
+			}
+			writeCdo->setData(type, channelId, slope, slopeError, intercept, interceptError);
+        	++nChns;
+		}
+		ATH_MSG_VERBOSE("Retrieved data for "<<nChns<<" channels.");
+        ++nObjs;
+    }
+	ATH_MSG_VERBOSE("Retrieved data for "<<nObjs<<" objects.");
+
+	// insert/write data
+	if (writeHandle.record(std::move(writeCdo)).isFailure()) {
+		ATH_MSG_FATAL("Could not record NswCalibDbTimeChargeData " << writeHandle.key() 
+		      << " with EventRange " << writeHandle.getRange()
+		      << " into Conditions Store");
+		return StatusCode::FAILURE;
+	}		  
+	ATH_MSG_DEBUG("Recorded new " << writeHandle.key() << " with range " << writeHandle.getRange() << " into Conditions Store");
+
+    return StatusCode::SUCCESS;
+}
+
+
+// buildChannelId
+bool
+NswCalibDbAlg::buildChannelId(Identifier*& channelId, unsigned int elinkId, unsigned int vmm, unsigned int channel) const {
+
+	// build NSWOfflineHelper
+	Muon::nsw::NSWResourceId* resId = new Muon::nsw::NSWResourceId((uint32_t) elinkId);
+	Muon::nsw::helper::NSWOfflineHelper helper(resId, vmm, channel);
+	
+	std::string stationName;
+	if(resId->detId () < eformat::MUON_STGC_ENDCAP_C_SIDE)
+		stationName = resId->is_large_station () ? "MML" : "MMS";
+	else
+		stationName = resId->is_large_station () ? "STL" : "STS";
+	
+	int8_t   stationEta    = resId->station_eta ();
+	uint8_t  stationPhi    = resId->station_phi ();
+	uint8_t  multiLayer    = resId->multi_layer ();
+	uint8_t  gasGap        = resId->gas_gap     ();
+	
+	uint8_t  channelType   = helper.channel_type  ();
+	uint16_t channelNumber = helper.channel_number();
+
+	/* keep for debugging
+	std::cout << "Station name="    << stationName 
+	          << " Station eta="    << static_cast <int>          (stationEta)
+	          << " Station phi="    << static_cast <unsigned int> (stationPhi)
+	          << " Multilayer="     << static_cast <unsigned int> (multiLayer) 
+	          << " Gas gap="        << static_cast <unsigned int> (gasGap)
+	          << " Channel type="   << static_cast <unsigned int> (channelType)
+	          << " Channel Number=" << channelNumber << std::endl;
+	*/
+
+	// MM
+	if(resId->detId () < eformat::MUON_STGC_ENDCAP_C_SIDE){
+		Identifier chnlId = m_idHelperSvc->mmIdHelper().channelID(stationName, static_cast<int>(stationEta), static_cast<int>(stationPhi), static_cast<int>(multiLayer), static_cast<int>(gasGap), static_cast<int>(channelNumber));
+		if(!chnlId.is_valid()){
+			ATH_MSG_WARNING("Could not extract valid channelId for MM elink "<<elinkId);
+			return false;
+		}
+		channelId = &chnlId;
+	}
+	// sTGC
+	else{
+		Identifier chnlId = m_idHelperSvc->stgcIdHelper().channelID(stationName, static_cast<int>(stationEta), static_cast<int>(stationPhi), static_cast<int>(multiLayer), static_cast<int>(gasGap), static_cast<int>(channelType), static_cast<int>(channelNumber));
+		if(!chnlId.is_valid()){
+			ATH_MSG_WARNING("Could not extract valid channelId for STGC elink "<<elinkId);
+			return false;
+		}
+		channelId = &chnlId;
+	}
+
+	return true;
+}
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx
index c698b1ac83bb9a1adffd807d722d1eaf223a6899..93288bf7a146f5998d3e5c3ed68d794b9e5d927f 100644
--- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx
@@ -7,6 +7,7 @@
 #include "MuonCondAlg/RpcCondDbAlg.h"
 #include "MuonCondAlg/TgcCondDbAlg.h"
 #include "MuonCondAlg/TgcDigitASDposCondAlg.h"
+#include "MuonCondAlg/NswCalibDbAlg.h"
 
 DECLARE_COMPONENT(CscCondDbAlg)
 DECLARE_COMPONENT(MdtCondDbAlg)
@@ -17,3 +18,4 @@ DECLARE_COMPONENT(MuonAlignmentCondAlg)
 DECLARE_COMPONENT(MdtCalibDbAlg)
 DECLARE_COMPONENT(MdtCalibFormatAlgTest)
 DECLARE_COMPONENT(TgcDigitASDposCondAlg)
+DECLARE_COMPONENT(NswCalibDbAlg)
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/NswCalibDbThresholdData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/NswCalibDbThresholdData.h
new file mode 100644
index 0000000000000000000000000000000000000000..3e029658f6fdf899344591fd1e6dd2ab558f23b3
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/NswCalibDbThresholdData.h
@@ -0,0 +1,52 @@
+/*
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDDATA_NSWCALIBDBTHRESHOLDDATA_H
+#define MUONCONDDATA_NSWCALIBDBTHRESHOLDDATA_H
+
+// STL includes
+#include <vector>
+
+// Athena includes
+#include "AthenaKernel/CondCont.h" 
+#include "AthenaKernel/BaseInfo.h" 
+
+// Forward declarations
+class Identifier;
+class MmIdHelper;
+class sTgcIdHelper;
+
+
+class NswCalibDbThresholdData {
+
+  friend class NswCalibDbAlg;
+
+public:
+
+    NswCalibDbThresholdData(const MmIdHelper&, const sTgcIdHelper&);
+    virtual ~NswCalibDbThresholdData() = default;
+
+	// setting functions
+	void setData(const Identifier*, const double);
+
+	// retrieval functions
+	std::vector<Identifier> getChannelIds(const std::string="", const std::string="") const;
+	bool                    getThreshold (const Identifier*   , double&             ) const;
+
+ 
+private:
+
+	// containers
+    std::map<unsigned long long, std::vector<double> > m_data{};
+
+	// ID helpers
+	const MmIdHelper&   m_mmIdHelper;
+	const sTgcIdHelper& m_stgcIdHelper;
+
+};
+
+CLASS_DEF( NswCalibDbThresholdData , 108292495 , 1 )
+CLASS_DEF( CondCont<NswCalibDbThresholdData> , 169109811 , 1 )
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/NswCalibDbTimeChargeData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/NswCalibDbTimeChargeData.h
new file mode 100644
index 0000000000000000000000000000000000000000..eef06e712e2bfb70b3949ecd619b7f610cc6a20a
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/NswCalibDbTimeChargeData.h
@@ -0,0 +1,55 @@
+/*
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUONCONDDATA_NSWCALIBDBTIMECHARGEDATA_H
+#define MUONCONDDATA_NSWCALIBDBTIMECHARGEDATA_H
+
+// STL includes
+#include <vector>
+
+// Athena includes
+#include "AthenaKernel/CondCont.h" 
+#include "AthenaKernel/BaseInfo.h" 
+
+// Forward declarations
+class Identifier;
+class MmIdHelper;
+class sTgcIdHelper;
+
+
+class NswCalibDbTimeChargeData {
+
+  friend class NswCalibDbAlg;
+
+public:
+
+    NswCalibDbTimeChargeData(const MmIdHelper&, const sTgcIdHelper&);
+    virtual ~NswCalibDbTimeChargeData() = default;
+
+	// setting functions
+	void setData   (const std::string, const Identifier*, const double, const double, const double, const double);
+
+	// retrieval functions
+	std::vector<Identifier> getChannelIds    (const std::string, const std::string="", const std::string="") const;
+	bool                    getSlope         (const std::string, const Identifier*, double&) const;
+	bool                    getSlopeError    (const std::string, const Identifier*, double&) const;
+	bool                    getIntercept     (const std::string, const Identifier*, double&) const;
+	bool                    getInterceptError(const std::string, const Identifier*, double&) const;
+
+ 
+private:
+
+	// containers
+    std::map<std::string, std::map<unsigned long long, std::vector<double> > > m_data{};
+
+	// ID helpers
+	const MmIdHelper&   m_mmIdHelper;
+	const sTgcIdHelper& m_stgcIdHelper;
+
+};
+
+CLASS_DEF( NswCalibDbTimeChargeData , 120842040 , 1 )
+CLASS_DEF( CondCont<NswCalibDbTimeChargeData> , 217895024 , 1 )
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/NswCalibDbThresholdData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/NswCalibDbThresholdData.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..1ecbdf0af79a44a69775b655db52b1f8b5f16a9a
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/NswCalibDbThresholdData.cxx
@@ -0,0 +1,69 @@
+/*
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondData/NswCalibDbThresholdData.h"
+#include "MuonIdHelpers/MmIdHelper.h"
+#include "MuonIdHelpers/sTgcIdHelper.h"
+#include "Identifier/Identifier.h"
+
+
+// general functions ---------------------------------
+NswCalibDbThresholdData::NswCalibDbThresholdData(const MmIdHelper& mmIdHelper, const sTgcIdHelper& stgcIdHelper):
+    m_mmIdHelper(mmIdHelper),
+    m_stgcIdHelper(stgcIdHelper)
+{
+}
+
+
+// setting functions ---------------------------------
+
+// setData
+void
+NswCalibDbThresholdData::setData(const Identifier* chnlId, const double threshold) {
+	unsigned long long channelId = chnlId->get_compact();
+	if(m_data.find(channelId) != m_data.end()) return;
+	std::vector<double> empty; // storing as vector is not optimal, but keep for now in case we'll add more data in the future
+	m_data[channelId] = empty;
+	m_data[channelId].push_back(threshold);
+}
+
+
+
+// retrieval functions -------------------------------
+
+// getChannelIds
+std::vector<Identifier>
+NswCalibDbThresholdData::getChannelIds(const std::string tech, const std::string side) const {
+	std::vector<Identifier> chnls;
+	std::vector<Identifier> keys;
+	std::map<unsigned long long, std::vector<double> >::const_iterator it;
+	for(it=m_data.begin(); it!=m_data.end(); it++){
+		Identifier id(it->first);
+		keys.push_back(id);
+	}
+	if(tech=="" && side=="") return keys;
+	for(unsigned int i=0; i<keys.size(); ++i){
+		int tec = m_mmIdHelper.technology(keys[i]);
+		int eta = m_mmIdHelper.stationEta(keys[i]);
+		if(strcmp(tech.c_str(), "STGC")==0 && tec!=4) continue;
+		if(strcmp(tech.c_str(), "MM"  )==0 && tec!=5) continue;
+		if(strcmp(side.c_str(), "A"   )==0 && eta<=0) continue;
+		if(strcmp(side.c_str(), "C"   )==0 && eta>=0) continue;
+		chnls.push_back(keys[i]);
+	}
+	return chnls;
+}
+
+// getThreshold
+bool
+NswCalibDbThresholdData::getThreshold(const Identifier* chnlId, double& threshold) const {
+	unsigned long long channelId = chnlId->get_compact();
+	if(m_data.find(channelId)      == m_data.end()) return false;
+	if(m_data.at(channelId).size() != 1           ) return false;
+	threshold = m_data.at(channelId).at(0);
+	return true;
+}
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/NswCalibDbTimeChargeData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/NswCalibDbTimeChargeData.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..6233f39ddb471828d5dbc6bc5e0433ab479f0a03
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/NswCalibDbTimeChargeData.cxx
@@ -0,0 +1,116 @@
+/*
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondData/NswCalibDbTimeChargeData.h"
+#include "MuonIdHelpers/IMuonIdHelperSvc.h"
+#include "Identifier/Identifier.h"
+
+
+// general functions ---------------------------------
+NswCalibDbTimeChargeData::NswCalibDbTimeChargeData(const MmIdHelper& mmIdHelper, const sTgcIdHelper& stgcIdHelper):
+    m_mmIdHelper(mmIdHelper),
+    m_stgcIdHelper(stgcIdHelper)
+{
+}
+
+
+// setting functions ---------------------------------
+
+// setData
+void
+NswCalibDbTimeChargeData::setData(const std::string type, const Identifier* chnlId, const double slope, const double slopeError, const double intercept, const double interceptError) {
+	if(type!="TDO" && type!="PDO") return;
+	if(m_data.find(type) == m_data.end()){
+		std::map<unsigned long long, std::vector<double> > empty;
+		m_data[type] = empty;
+	}
+	unsigned long long channelId = chnlId->get_compact();
+	if(m_data[type].find(channelId) != m_data[type].end()) return;
+	std::vector<double> empty;
+	m_data[type][channelId] = empty;
+	m_data[type][channelId].push_back(slope         );
+	m_data[type][channelId].push_back(slopeError    );
+	m_data[type][channelId].push_back(intercept     );
+	m_data[type][channelId].push_back(interceptError);
+}
+
+
+
+// retrieval functions -------------------------------
+
+// getChannelIds
+std::vector<Identifier>
+NswCalibDbTimeChargeData::getChannelIds(const std::string type, const std::string tech, const std::string side) const {
+	std::vector<Identifier> chnls;
+	if(type!="TDO" && type!="PDO") return chnls;
+	if(m_data.find(type) == m_data.end()) return chnls;
+	std::vector<Identifier> keys;
+	std::map<unsigned long long, std::vector<double> >::const_iterator it;
+	for(it=m_data.at(type).begin(); it!=m_data.at(type).end(); it++){
+		Identifier id(it->first);
+		keys.push_back(id);
+	}
+	if(tech=="" && side=="") return keys;
+	for(unsigned int i=0; i<keys.size(); ++i){
+		int tec = m_mmIdHelper.technology(keys[i]);
+		int eta = m_mmIdHelper.stationEta(keys[i]);
+		if(strcmp(tech.c_str(), "STGC")==0 && tec!=4) continue;
+		if(strcmp(tech.c_str(), "MM"  )==0 && tec!=5) continue;
+		if(strcmp(side.c_str(), "A"   )==0 && eta<=0) continue;
+		if(strcmp(side.c_str(), "C"   )==0 && eta>=0) continue;
+		chnls.push_back(keys[i]);
+	}
+	return chnls;
+}
+
+// getSlope
+bool
+NswCalibDbTimeChargeData::getSlope(const std::string type, const Identifier* chnlId, double& slope) const {
+	if(type!="TDO" && type!="PDO") return false;
+	if(m_data.find(type) == m_data.end()) return false;
+	unsigned long long channelId = chnlId->get_compact();
+	if(m_data.at(type).find(channelId)      == m_data.at(type).end()) return false;
+	if(m_data.at(type).at(channelId).size() != 4                    ) return false;
+	slope = m_data.at(type).at(channelId).at(0);
+	return true;
+}
+
+// getSlopeError
+bool
+NswCalibDbTimeChargeData::getSlopeError(const std::string type, const Identifier* chnlId, double& slopeError) const {
+	if(type!="TDO" && type!="PDO") return false;
+	if(m_data.find(type) == m_data.end()) return false;
+	unsigned long long channelId = chnlId->get_compact();
+	if(m_data.at(type).find(channelId)      == m_data.at(type).end()) return false;
+	if(m_data.at(type).at(channelId).size() != 4                    ) return false;
+	slopeError = m_data.at(type).at(channelId).at(1);
+	return true;
+}
+
+// getIntercept
+bool
+NswCalibDbTimeChargeData::getIntercept(const std::string type, const Identifier* chnlId, double& intercept) const {
+	if(type!="TDO" && type!="PDO") return false;
+	if(m_data.find(type) == m_data.end()) return false;
+	unsigned long long channelId = chnlId->get_compact();
+	if(m_data.at(type).find(channelId)      == m_data.at(type).end()) return false;
+	if(m_data.at(type).at(channelId).size() != 4                    ) return false;
+	intercept = m_data.at(type).at(channelId).at(2);
+	return true;
+}
+
+// getInterceptError
+bool
+NswCalibDbTimeChargeData::getInterceptError(const std::string type, const Identifier* chnlId, double& interceptError) const {
+	if(type!="TDO" && type!="PDO") return false;
+	if(m_data.find(type) == m_data.end()) return false;
+	unsigned long long channelId = chnlId->get_compact();
+	if(m_data.at(type).find(channelId)      == m_data.at(type).end()) return false;
+	if(m_data.at(type).at(channelId).size() != 4                    ) return false;
+	interceptError = m_data.at(type).at(channelId).at(3);
+	return true;
+}
+
+
+
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/CMakeLists.txt
index 31522128c83a162ca485c65654b8a179a737bcd0..ddb8d954095c749e72ffafbdb193bedf1f47f0c2 100644
--- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/CMakeLists.txt
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/CMakeLists.txt
@@ -12,7 +12,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 atlas_add_component( MuonCondTest
                      src/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MuonCondInterface MuonCondSvcLib MuonReadoutGeometry Identifier )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MuonCondInterface MuonCondData MuonCondSvcLib CoralUtilitiesLib MuonReadoutGeometry Identifier )
 
 # Install files from the package:
 atlas_install_headers( MuonCondTest )
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/NswCondTestAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/NswCondTestAlg.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0cf2b006df59eb0a27f28319411332c847a14ea
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/NswCondTestAlg.h
@@ -0,0 +1,46 @@
+/*
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef NswCondTestAlg_H
+#define NswCondTestAlg_H 
+
+//STL
+#include <string>
+#include <chrono>
+
+//Athena
+#include "GaudiKernel/ServiceHandle.h"
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "MuonCondData/NswCalibDbTimeChargeData.h"
+#include "MuonCondData/NswCalibDbThresholdData.h"
+
+
+//Forward declarations
+class ISvcLocator;
+class StatusCode;
+
+
+class NswCondTestAlg : public AthReentrantAlgorithm {
+
+public:
+	NswCondTestAlg(const std::string &name, ISvcLocator *pSvcLocator) ;
+	virtual ~NswCondTestAlg() override;
+	
+	virtual StatusCode initialize() override;
+	virtual StatusCode execute(const EventContext&) const override;
+	virtual StatusCode finalize() override;
+   
+private:
+	StatusCode retrieveTdoPdo(const EventContext&, std::string, std::string, std::string, std::chrono::duration<double>&) const;
+	StatusCode retrieveVmm(const EventContext&, std::string, std::string, std::chrono::duration<double>&) const;
+	std::string timestamp() const; 
+
+ 	SG::ReadCondHandleKey<NswCalibDbTimeChargeData> m_readKey_tdopdo{this, "ReadKey_tdopdo", "NswCalibDbTimeChargeData", "Key of NswCalibDbTimeChargeData object containing calibration data (TDOs and PDOs)"  };
+ 	SG::ReadCondHandleKey<NswCalibDbThresholdData > m_readKey_vmm   {this, "ReadKey_vmm"   , "NswCalibDbThresholdData" , "Key of NswCalibDbThresholdData object containing calibration data (VMM thresholds)"  };
+
+
+}; //end of class
+
+#endif
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/NswCondAlgTest.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/NswCondAlgTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..5f931155364c4bd2281320d2a83363a50c65198d
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/NswCondAlgTest.py
@@ -0,0 +1,153 @@
+# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+
+run = "datatest" ## "mc" or "dataR1" or "dataR2"
+
+from AthenaCommon.GlobalFlags import GlobalFlags, globalflags
+if run == "datatest":
+	globalflags.DetGeo.set_Value_and_Lock('atlas') 
+	globalflags.DataSource.set_Value_and_Lock('data')
+	#globalflags.DatabaseInstance.set_Value_and_Lock("OFLP200")
+	globalflags.DatabaseInstance.set_Value_and_Lock("CONDBR2")
+
+from AthenaCommon.JobProperties import jobproperties
+
+# GeoModel is needed to make a test build of the volumes - in case of bugs it crashes
+include("MuonGeoModel/MuonGeoModel_MinimalSetup.py")
+# after the above include, GeoModelSvc should be setup, now use a recent layout to start from
+GeoModelSvc.AtlasVersion='ATLAS-R3S-2021-01-00-02'
+# since we have chosen a symmetric NSW layout and we execute this jobOptions file outside of a 
+# standard job transform, set the MuonDetectorTool and DetDescrCnvSvc properties by hand
+GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].HasCSC = False
+GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].HasSTgc = True
+GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].HasMM = True
+if hasattr(svcMgr,'DetDescrCnvSvc'):
+    svcMgr.DetDescrCnvSvc.HasCSC=False
+    svcMgr.DetDescrCnvSvc.HasSTgc=True
+    svcMgr.DetDescrCnvSvc.HasMM=True
+
+
+#--------------------------------------------------------------
+# Setup Athena
+#--------------------------------------------------------------
+
+from AthenaCommon.AppMgr import ToolSvc
+from AthenaCommon.AlgSequence import AlgSequence
+import AthenaCommon.AtlasUnixStandardJob
+
+from AthenaCommon.AppMgr import ServiceMgr,athCondSeq
+import AthenaPoolCnvSvc.ReadAthenaPool
+ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/work/c/cheidegg/ec/AthenaDev/test.HITS.pool.root"]
+
+# use auditors
+from GaudiCommonSvc.GaudiCommonSvcConf import AuditorSvc
+
+ServiceMgr += AuditorSvc()
+theAuditorSvc = ServiceMgr.AuditorSvc
+theAuditorSvc.Auditors  += [ "ChronoAuditor"]
+theAuditorSvc.Auditors  += [ "MemStatAuditor" ]
+theApp.AuditAlgorithms=True
+
+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=="datatest":
+	print("fooooooo")
+	svcMgr.IOVDbSvc.DBInstance="CONDBR2"
+	print(svcMgr.IOVDbSvc.DBInstance)
+
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_MDT;dbname=CONDBR2;user=ATLAS_COOLOFL_MDT_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/MDT/MM/TIME/SIDEA"    , "MmTdoSideA-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_MDT;dbname=CONDBR2;user=ATLAS_COOLOFL_MDT_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/MDT/MM/TIME/SIDEC"    , "MmTdoSideC-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_MDT;dbname=CONDBR2;user=ATLAS_COOLOFL_MDT_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/MDT/MM/CHARGE/SIDEA"  , "MmPdoSideA-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_MDT;dbname=CONDBR2;user=ATLAS_COOLOFL_MDT_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/MDT/MM/CHARGE/SIDEC"  , "MmPdoSideC-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_MDT;dbname=CONDBR2;user=ATLAS_COOLOFL_MDT_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/MDT/MM/VMM/SIDEA"     , "MmVmmSideA-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_MDT;dbname=CONDBR2;user=ATLAS_COOLOFL_MDT_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/MDT/MM/VMM/SIDEC"     , "MmVmmSideC-Rnd-TEST",className='CondAttrListCollection')
+
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_TGC;dbname=CONDBR2;user=ATLAS_COOLOFL_TGC_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/TGC/NSW/TIME/SIDEA"  , "sTgcTdoSideA-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_TGC;dbname=CONDBR2;user=ATLAS_COOLOFL_TGC_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/TGC/NSW/TIME/SIDEC"  , "sTgcTdoSideC-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_TGC;dbname=CONDBR2;user=ATLAS_COOLOFL_TGC_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/TGC/NSW/CHARGE/SIDEA", "sTgcPdoSideA-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_TGC;dbname=CONDBR2;user=ATLAS_COOLOFL_TGC_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/TGC/NSW/CHARGE/SIDEC", "sTgcPdoSideC-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_TGC;dbname=CONDBR2;user=ATLAS_COOLOFL_TGC_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/TGC/NSW/VMM/SIDEA"   , "sTgcVmmSideA-Rnd-TEST",className='CondAttrListCollection')
+	#conddb.addFolderWithTag("", "<dbConnection>oracle://INT8R;schema=ATLAS_COOLOFL_TGC;dbname=CONDBR2;user=ATLAS_COOLOFL_TGC_W;password=do5cM5Gmcfl0BbdKo3Myz_jAd04z</dbConnection>/TGC/NSW/VMM/SIDEC"   , "sTgcVmmSideC-Rnd-TEST",className='CondAttrListCollection')
+
+	conddb.addFolderWithTag("MDT_OFL", "/MDT/MM/TIME/SIDEA"   , "MmTdoSideA-Rnd-TEST"  , forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("MDT_OFL", "/MDT/MM/TIME/SIDEC"   , "MmTdoSideC-Rnd-TEST"  , forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("MDT_OFL", "/MDT/MM/CHARGE/SIDEA" , "MmPdoSideA-Rnd-TEST"  , forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("MDT_OFL", "/MDT/MM/CHARGE/SIDEC" , "MmPdoSideC-Rnd-TEST"  , forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("MDT_OFL", "/MDT/MM/VMM/SIDEA"    , "MmVmmSideA-Rnd-TEST"  , forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("MDT_OFL", "/MDT/MM/VMM/SIDEC"    , "MmVmmSideC-Rnd-TEST"  , forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("TGC_OFL", "/TGC/NSW/TIME/SIDEA"  , "sTgcTdoSideA-Rnd-TEST", forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("TGC_OFL", "/TGC/NSW/TIME/SIDEC"  , "sTgcTdoSideC-Rnd-TEST", forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("TGC_OFL", "/TGC/NSW/CHARGE/SIDEA", "sTgcPdoSideA-Rnd-TEST", forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("TGC_OFL", "/TGC/NSW/CHARGE/SIDEC", "sTgcPdoSideC-Rnd-TEST", forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("TGC_OFL", "/TGC/NSW/VMM/SIDEA"   , "sTgcPdoSideA-Rnd-TEST", forceData=True, className='CondAttrListCollection');
+	conddb.addFolderWithTag("TGC_OFL", "/TGC/NSW/VMM/SIDEC"   , "sTgcPdoSideC-Rnd-TEST", forceData=True, className='CondAttrListCollection');
+
+
+
+
+
+##--------------------------------------------------------------
+## NEW Data Base Algorithms
+##--------------------------------------------------------------
+
+from MuonCondAlg.MuonCondAlgConf import NswCalibDbAlg
+alg = NswCalibDbAlg("NswCalibDbAlg")
+alg.OutputLevel = VERBOSE
+alg.isOnline = False
+alg.isData   = True
+
+if "mc" in run:
+	alg.isData = False
+
+condSequence += alg
+
+
+
+##--------------------------------------------------------------
+## NEW Test Algorithm
+##--------------------------------------------------------------
+from MuonCondTest.MuonCondTestConf import NswCondTestAlg
+job += NswCondTestAlg()
+
+
+
+##--------------------------------------------------------------
+## 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/MuonCondTest_entries.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MuonCondTest_entries.cxx
index d997e466a17d7bb11bf5a187f9c0316f20b05713..daaa97d03ffde491f45d75f966ebe9f86e6e17d4 100644
--- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MuonCondTest_entries.cxx
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MuonCondTest_entries.cxx
@@ -8,6 +8,7 @@
 #include "MuonCondTest/CSCConditionsTestAlgMT.h"
 #include "MuonCondTest/RPCStatusTestAlg.h"
 #include "MuonCondTest/MuonConditionsHistoSummary.h"
+#include "MuonCondTest/NswCondTestAlg.h"
 
 DECLARE_COMPONENT( AlignCondAthTest )
 DECLARE_COMPONENT( MuonConditionsTestAlg )
@@ -16,3 +17,4 @@ DECLARE_COMPONENT( MDTConditionsTestAlgMT )
 DECLARE_COMPONENT( CSCConditionsTestAlgMT )
 DECLARE_COMPONENT( RPCStatusTestAlg )
 DECLARE_COMPONENT( MuonConditionsHistoSummary )
+DECLARE_COMPONENT( NswCondTestAlg )
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/NswCondTestAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/NswCondTestAlg.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..3f43d95d1cf6b5a9b52a29999eee5eca4032fb80
--- /dev/null
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/NswCondTestAlg.cxx
@@ -0,0 +1,212 @@
+/*
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonCondTest/NswCondTestAlg.h"
+
+//STL
+#include <stdio.h>
+#include <iostream>
+#include <ctime>
+#include <sstream>
+#include "vector"
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+//Gaudi and Athena
+#include "GaudiKernel/StatusCode.h"
+#include "AthenaKernel/IOVInfiniteRange.h"
+#include "CoralBase/Blob.h"
+#include "CoralUtilities/blobaccess.h"
+#include "Identifier/Identifier.h"
+
+
+// constructor
+NswCondTestAlg::NswCondTestAlg(const std::string& name, ISvcLocator* pSvcLocator ) :
+                         AthReentrantAlgorithm( name, pSvcLocator ){
+}
+
+// destructor
+NswCondTestAlg::~NswCondTestAlg(){
+	ATH_MSG_VERBOSE( "Calling destructor"  );
+}
+
+// initialize
+StatusCode
+NswCondTestAlg::initialize(){ 
+	ATH_MSG_INFO("Calling initialize");
+	ATH_CHECK(m_readKey_tdopdo.initialize());
+	ATH_CHECK(m_readKey_vmm   .initialize());
+	return StatusCode::SUCCESS;
+}
+
+// execute
+StatusCode
+NswCondTestAlg::execute(const EventContext& ctx) const {
+	ATH_MSG_INFO("Calling execute");
+
+	// setup parameters
+	std::chrono::duration<double> retrieving_MM_TDO_A;
+	std::chrono::duration<double> retrieving_MM_TDO_C;
+	std::chrono::duration<double> retrieving_MM_PDO_A;
+	std::chrono::duration<double> retrieving_MM_PDO_C;
+	std::chrono::duration<double> retrieving_MM_VMM_A;
+	std::chrono::duration<double> retrieving_MM_VMM_C;
+	std::chrono::duration<double> retrieving_STGC_TDO_A;
+	std::chrono::duration<double> retrieving_STGC_TDO_C;
+	std::chrono::duration<double> retrieving_STGC_PDO_A;
+	std::chrono::duration<double> retrieving_STGC_PDO_C;
+	std::chrono::duration<double> retrieving_STGC_VMM_A;
+	std::chrono::duration<double> retrieving_STGC_VMM_C;
+
+	// retrieve all folders
+	if(!retrieveTdoPdo(ctx, "TDO", "MM"  , "A", retrieving_MM_TDO_A  ).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveTdoPdo(ctx, "TDO", "MM"  , "C", retrieving_MM_TDO_C  ).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveTdoPdo(ctx, "PDO", "MM"  , "A", retrieving_MM_PDO_A  ).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveTdoPdo(ctx, "PDO", "MM"  , "C", retrieving_MM_PDO_C  ).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveVmm   (ctx,        "MM"  , "A", retrieving_MM_VMM_A  ).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveVmm   (ctx,        "MM"  , "C", retrieving_MM_VMM_C  ).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveTdoPdo(ctx, "TDO", "STGC", "A", retrieving_STGC_TDO_A).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveTdoPdo(ctx, "TDO", "STGC", "C", retrieving_STGC_TDO_C).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveTdoPdo(ctx, "PDO", "STGC", "A", retrieving_STGC_PDO_A).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveTdoPdo(ctx, "PDO", "STGC", "C", retrieving_STGC_PDO_C).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveVmm   (ctx,        "STGC", "A", retrieving_STGC_VMM_A).isSuccess()) return StatusCode::FAILURE;
+	if(!retrieveVmm   (ctx,        "STGC", "C", retrieving_STGC_VMM_C).isSuccess()) return StatusCode::FAILURE;
+
+	// postprocess
+	ATH_MSG_INFO("Retrieving time for (MM  , TDO, Side A) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_TDO_A  ).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (MM  , TDO, Side C) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_TDO_C  ).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (MM  , PDO, Side A) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_PDO_A  ).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (MM  , PDO, Side C) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_PDO_C  ).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (MM  , VMM, Side A) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_VMM_A  ).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (MM  , VMM, Side C) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_VMM_C  ).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (STGC, TDO, Side A) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_TDO_A).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (STGC, TDO, Side C) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_TDO_C).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (STGC, PDO, Side A) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_PDO_A).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (STGC, PDO, Side C) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_PDO_C).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (STGC, VMM, Side A) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_VMM_A).count()*1.0) << "s ");
+	ATH_MSG_INFO("Retrieving time for (STGC, VMM, Side C) = " << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_VMM_C).count()*1.0) << "s ");
+
+	ATH_MSG_INFO("MADE IT TO THE END!!");
+	return StatusCode::SUCCESS;
+}
+
+// finalize
+StatusCode
+NswCondTestAlg::finalize(){
+  ATH_MSG_INFO("Calling finalize");
+  return StatusCode::SUCCESS;
+}
+
+
+// retrieveTdoPdo
+StatusCode
+NswCondTestAlg::retrieveTdoPdo(const EventContext& ctx, std::string data, std::string tech, std::string side, std::chrono::duration<double>& timer) const {
+
+	ATH_MSG_INFO("Starting with "<<data<<" data for "<<tech<<" and "<<side<<" at "<<timestamp());
+	auto start1 = std::chrono::high_resolution_clock::now();
+
+    // Start with an infinte range and narrow it down as needed
+    EventIDRange rangeW = IOVInfiniteRange::infiniteMixed();
+
+	// Retrieve Data Object
+    SG::ReadCondHandle<NswCalibDbTimeChargeData> readHandle{m_readKey_tdopdo, ctx};
+    const NswCalibDbTimeChargeData* readCdo{*readHandle}; 
+//	std::unique_ptr<NswCalibDbTimeChargeData> writeCdo{std::make_unique<NswCalibDbTimeChargeData>(m_idHelperSvc->mmIdHelper())};
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    EventIDRange range;
+    if(!readHandle.range(range)) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    // Intersect validity range of this obj with the validity of already-loaded objs
+    rangeW = EventIDRange::intersect(range, rangeW);
+
+	// retrieve all channels
+	std::vector<Identifier> channelIds = readCdo->getChannelIds(data, tech, side);
+	ATH_MSG_INFO("Found data for "<<channelIds.size()<<" channels!");
+	
+	// retrieve data for the first channel
+	if(channelIds.size()>0){
+		Identifier channel = channelIds[0];
+		ATH_MSG_INFO("Checking channel 0 (Id = "<<channel.get_compact()<<")");
+
+		double slope; readCdo->getSlope     (data, &channel, slope);
+		double error; readCdo->getSlopeError(data, &channel, error);
+		ATH_MSG_INFO("slope     = "<<slope<<" (error="<<error<<")");
+
+		double intercept; readCdo->getIntercept     (data, &channel, intercept);
+		double interror ; readCdo->getInterceptError(data, &channel, interror );
+		ATH_MSG_INFO("intercept = "<<intercept<<" (error="<<interror<<")");
+	} 
+
+	auto end1 = std::chrono::high_resolution_clock::now();
+	timer += end1-start1;
+	ATH_MSG_INFO("Ending at "<<timestamp());
+	return StatusCode::SUCCESS;
+}
+
+// retrieveVmm
+StatusCode
+NswCondTestAlg::retrieveVmm(const EventContext& ctx, std::string tech, std::string side, std::chrono::duration<double>& timer) const {
+
+	ATH_MSG_INFO("Starting with VMM data for "<<tech<<" and "<<side<<" at "<<timestamp());
+	auto start1 = std::chrono::high_resolution_clock::now();
+
+    // Start with an infinte range and narrow it down as needed
+    EventIDRange rangeW = IOVInfiniteRange::infiniteMixed();
+
+	// Retrieve Data Object
+    SG::ReadCondHandle<NswCalibDbThresholdData> readHandle{m_readKey_vmm, ctx};
+    const NswCalibDbThresholdData* readCdo{*readHandle}; 
+    if(readCdo==0){
+      ATH_MSG_ERROR("Null pointer to the read conditions object");
+      return StatusCode::FAILURE; 
+    } 
+  
+    EventIDRange range;
+    if(!readHandle.range(range)) {
+      ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
+      return StatusCode::FAILURE;
+    } 
+  
+    // Intersect validity range of this obj with the validity of already-loaded objs
+    rangeW = EventIDRange::intersect(range, rangeW);
+
+	// retrieve all channels
+	std::vector<Identifier> channelIds = readCdo->getChannelIds(tech, side);
+	ATH_MSG_INFO("Found data for "<<channelIds.size()<<" channels!");
+	
+	// retrieve data for the first channel
+	if(channelIds.size()>0){
+		Identifier channel = channelIds[0];
+		ATH_MSG_INFO("Checking channel 0 (Id = "<<channel.get_compact()<<")");
+
+		double threshold; readCdo->getThreshold(&channel, threshold);
+		ATH_MSG_INFO("threshold = "<<threshold);
+	} 
+
+	auto end1 = std::chrono::high_resolution_clock::now();
+	timer += end1-start1;
+	ATH_MSG_INFO("Ending at "<<timestamp());
+	return StatusCode::SUCCESS;
+}
+
+std::string
+NswCondTestAlg::timestamp() const {
+	const boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
+	const boost::posix_time::time_duration td = now.time_of_day();
+	const long hours        = td.hours();
+	const long minutes      = td.minutes();
+	const long seconds      = td.seconds();
+	const long milliseconds = td.total_milliseconds() - ((hours * 3600 + minutes * 60 + seconds) * 1000);
+    char buf[40];
+    sprintf(buf, "%02ld:%02ld:%02ld.%03ld", hours, minutes, seconds, milliseconds);
+    return buf;
+}
+
+
diff --git a/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py b/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py
index 2ca1f30d06c0b69ef8b9fdb2b8dae384fe43c0db..b957a73db9352497bf4223dafbeb2d9677e4f14e 100644
--- a/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py
+++ b/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py
@@ -154,3 +154,27 @@ def TgcDigitASDposCondAlgCfg(flags):
     result.addCondAlgo(CompFactory.TgcDigitASDposCondAlg())
     result.merge(addFolders(flags, ["/TGC/DIGIT/ASDPOS"] , detDb="TGC_OFL", className="CondAttrListCollection"))
     return result
+
+def NswCalibDbAlgCfg(flags, **kwargs):
+    result = ComponentAccumulator()
+    if flags.Common.isOnline:
+        return result ## avoid adding algo to the component accumulator
+    if flags.Input.isMC:
+        kwargs['isData'  ] = False
+        kwargs['isOnline'] = False
+    else:
+        kwargs['isData'  ] = True
+        kwargs['isOnline'] = True if flags.Common.isOnline else False
+    folders = ["/MDT/MM/TIME/SIDEA" , "/MDT/MM/CHARGE/SIDEA" , "/MDT/MM/VMM/SIDEA" , \
+               "/MDT/MM/TIME/SIDEC" , "/MDT/MM/CHARGE/SIDEC" , "/MDT/MM/VMM/SIDEC" ]
+    scheme  = "MDT_OFL"
+    result.merge( addFolders(flags, folders , detDb=scheme, className='CondAttrListCollection') )
+    folders = ["/TGC/NSW/TIME/SIDEA", "/TGC/NSW/CHARGE/SIDEA", "/TGC/NSW/VMM/SIDEA", \
+               "/TGC/NSW/TIME/SIDEC", "/TGC/NSW/CHARGE/SIDEC", "/TGC/NSW/VMM/SIDEC"]
+    scheme  = "TGC_OFL"
+    result.merge( addFolders(flags, folders , detDb=scheme, className='CondAttrListCollection') )
+    alg     = CompFactory.NswCalibDbAlg(**kwargs)
+    result.addCondAlgo(alg)
+    return result
+
+