diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibEvtInfo.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibEvtInfo.h
index 4f324b555bbb4a518a5d8ccde038fce01bdaae41..2f4b3812bc2bed633d047e33bf99971d3dca6b68 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibEvtInfo.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibEvtInfo.h
@@ -14,6 +14,7 @@
 #define ISCT_CalibEvtInfo_H
 
 //Gaudi includes
+#include "GaudiKernel/IAlgTool.h"
 #include "GaudiKernel/IInterface.h"
 #include <vector>
 #include <string>
@@ -23,7 +24,7 @@
 *  Interface to class to deal with run/event information for SCTCalib
 **/
 
-class ISCT_CalibEvtInfo: virtual public IInterface{
+class ISCT_CalibEvtInfo: virtual public IAlgTool{
   public:
     /// no-op c/tor
     ISCT_CalibEvtInfo(){}
@@ -60,7 +61,6 @@ class ISCT_CalibEvtInfo: virtual public IInterface{
 
 };
 
-
 inline const InterfaceID & ISCT_CalibEvtInfo::interfaceID(){
   static const InterfaceID IID("ISCT_CalibEvtInfo",1,0);
   return IID;
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoSvc.h
deleted file mode 100644
index 80e891e5e1616eeec44c38c18d6482c73d09acd1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoSvc.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file ISCT_CalibHistoSvc.h
- * Header file to interface class for histograms in the SCT_CalibAlgs package
- * @author Shaun Roe
-**/
-
-#ifndef ISCT_CalibHistoSvc_h
-#define ISCT_CalibHistoSvc_h
-
-//Gaudi includes
-#include "GaudiKernel/IInterface.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include <vector>
-#include <string>
-#include <utility>
-class TH1F;
-class TH2F;
-class TH1I;
-class ITHistSvc;
-class SCT_ID;
-
-class ISCT_CalibHistoSvc: virtual public IInterface{
-  public:
-    ISCT_CalibHistoSvc();
-    /// no-op destructor
-    virtual ~ISCT_CalibHistoSvc(){}
-    /// interfaceID re-implemented from IInterface
-    static const InterfaceID & interfaceID();
-    /// book histograms
-    virtual bool book()=0;
-    /// read histograms
-    virtual bool read(const std::string & fileName)=0;
-    /// fill histograms from simulation
-    virtual bool fill(const bool fromData=false)=0;
-    /// fill histograms from data
-    virtual bool fillFromData()=0;
-    /// get number of events in a specific bin
-    virtual int getNumberOfEventsInBin(const int nbin);
-    /// get total number of entries in the number of events histo
-    int size();
-    /// get bin content for bin in specific histogram
-    double getBinForHistogramIndex(const int bin, const int histogramIndex);
-    /// get the number of entries in a given histogram
-    int size(const int histogramIndex);
-    void binHistograms(const int nLbMerged);
-    /// set number of lumiblocks
-    static void setNumberOfLb(const int nLb);
-    /// get number of lumiblocks
-    static int numberOfLb();
-    /// set number of lumiblocks
-    static void setLbToMerge(const int nLbMerge);
-    /// get number of lumiblocks
-    static int LbToMerge();
-  protected:
-    std::vector<TH1F *> m_phistoVector;
-    std::vector<TH2F *> m_phistoVector2D;
-    TH1I * m_numberOfEventsHisto;
-    ITHistSvc * m_thistSvc;
-    //need to implement retrieval for these
-    //ServiceHandle<StoreGateSvc> m_detStore;
-    //ServiceHandle<StoreGateSvc> m_evtStore;
-    const SCT_ID* m_pSCTHelper;
-    static int m_nLb;
-    static int m_nLbMerge;
-    //
-    bool init();
-    template<class S>
-    std::pair<std::string, bool> retrievedService(S & service){
-       if (service.retrieve().isFailure() ) return std::make_pair(std::string("Unable to retrieve ")+service.name(), false);
-       return std::make_pair("",true);
-     }
-};
-
-
-inline const InterfaceID & ISCT_CalibHistoSvc::interfaceID(){
-  static const InterfaceID IID("ISCT_CalibHistoSvc",1,0);
-  return IID;
-}
-
-
-
-#endif
-
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoTool.h
index 301f5e16b021c2051c4668055e69fb7a6cc3b2a9..517e26c0bfec82b1febb23ef0f8d85ffe89b261e 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoTool.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoTool.h
@@ -12,7 +12,7 @@
 #define ISCT_CalibHistoTool_h
 
 //Gaudi includes
-//#include "GaudiKernel/IInterface.h"
+#include "GaudiKernel/IInterface.h"
 #include "GaudiKernel/IAlgTool.h"
 #include "StoreGate/StoreGateSvc.h"
 #include "GaudiKernel/ToolHandle.h"
@@ -61,7 +61,7 @@ class ISCT_CalibHistoTool: virtual public IAlgTool {
       std::vector<TH1F *> m_phistoVector;
       std::vector<TH2F *> m_phistoVector2D;
       TH1I * m_numberOfEventsHisto;
-      ITHistSvc * m_thisSvc;
+      ITHistSvc * m_thistSvc;
       //need to implement retrieval for these
       //ServiceHandle<StoreGateSvc> m_detStore;
       //ServiceHandle<StoreGateSvc> m_evtStore;
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibModuleListSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibModuleListSvc.h
deleted file mode 100644
index d274eed12a5a6188d8bb3de2a59798ddec1b1a3f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibModuleListSvc.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
-* @file SCT_CalibModuleListSvc.h
-* Header file for the SCT_CalibModuleListSvc class
-* @author Shaun Roe
-**/
-
-#ifndef ISCT_CalibModuleListSvc_h
-#define ISCT_CalibModuleListSvc_h
-
-// STL and boost headers
-#include <string>
-#include <vector>
-#include <set>
-#include <map>
-#include <utility>
-
-#include "GaudiKernel/IInterface.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "Identifier/Identifier.h"
-
-class ISCT_CalibModuleListSvc:virtual public IInterface{
-public:
-  //@name Service methods, reimplemented
-   //@{
-  ISCT_CalibModuleListSvc(){/**nop**/}; 
-  virtual ~ISCT_CalibModuleListSvc(){/**nop**/};
-  virtual StatusCode initialize()=0;
-  virtual StatusCode finalize()=0;
-  static const InterfaceID & interfaceID();
-   //@}
-  virtual StatusCode readModuleList( std::map< Identifier, std::set<Identifier> >& moduleList )=0;
-   
-protected:
-  template<class S>
-  std::pair<std::string, bool> retrievedService(S & service){
-     if (service.retrieve().isFailure() ) return std::make_pair(std::string("Unable to retrieve ")+service.name(), false);
-     return std::make_pair("",true);
-   }
- };
- 
- inline const InterfaceID & ISCT_CalibModuleListSvc::interfaceID(){
-   static const InterfaceID IID("ISCT_CalibModuleListSvc",1,0);
-   return IID;
- }
-#endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibModuleListTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibModuleListTool.h
index d6708c9724e5df77140a3250d8eb0d5ac66ed75f..761348143382502d3fff990ddd39da50f9b36b90 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibModuleListTool.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibModuleListTool.h
@@ -23,7 +23,7 @@
 #include "GaudiKernel/ToolHandle.h"
 #include "Identifier/Identifier.h"
 
-class ISCT_CalibModuleListTool:virtual public IAlgTool {
+class ISCT_CalibModuleListTool : virtual public IAlgTool {
    public:
       //@name Service methods, reimplemented
       //@{
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h
index 61a3a870578199837ef072f5a1633a29d6a8d0ef..ad49c46cc508fd9e2ee4619e65fbd7929e41393b 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h
@@ -19,11 +19,10 @@
 #define SCTCalib_H
 
 // Local
-#include "SCT_CalibAlgs/ISCT_CalibHistoSvc.h"
 #include "SCT_CalibAlgs/ISCT_CalibHistoTool.h"
 #include "SCT_CalibAlgs/ISCT_CalibEvtInfo.h"
-#include "SCT_CalibAlgs/ISCT_CalibModuleListSvc.h"
-#include "SCT_CalibAlgs/SCTCalibWriteSvc.h" //template parameter
+#include "SCT_CalibAlgs/ISCT_CalibModuleListTool.h"
+#include "SCT_CalibAlgs/SCTCalibWriteTool.h" //template parameter
 
 //Athena
 #include "AthenaBaseComps/AthAlgorithm.h"  //baseclass
@@ -102,19 +101,16 @@ class SCTCalib : public AthAlgorithm {
       SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};
       SG::ReadHandleKey<EventInfo>                                m_eventInfoKey;
 
-      ServiceHandle<SCTCalibWriteSvc>                 m_pCalibWriteSvc;
+      ToolHandle<SCTCalibWriteTool>                   m_pCalibWriteTool{this, "SCTCalibWriteTool", "SCTCalibWriteTool", "Tool to write out data from calibration loop"};
       ToolHandle<ISCT_ConfigurationConditionsTool>    m_ConfigurationConditionsTool{this, "SCT_ConfigurationConditionsTool", "SCT_ConfigurationConditionsTool/InDetSCT_ConfigurationConditionsTool", "Tool to retrieve SCT Configuration"};
       ToolHandle<ISCT_ReadCalibDataTool>              m_ReadCalibDataTool{this, "SCT_ReadCalibDataTool", "SCT_ReadCalibDataTool/InDetSCT_ReadCalibDataTool", "Tool to retrieve SCT calibration data"};
       ToolHandle<ISCT_DetectorLevelConditionsTool>    m_MajorityConditionsTool{this, "SCT_MajorityConditionsTool", "SCT_MajorityConditionsTool", "Tool to retrieve the majority conditions of SCT"};
       ToolHandle<ISCT_CablingTool>                    m_CablingTool{this, "SCT_CablingTool", "SCT_CablingTool", "Tool to retrieve SCT Cabling"};
-      ToolHandle<ISCT_CalibHistoTool>                 m_calibHitmapTool;
-
-      //shaun added
-      //ServiceHandle<ISCT_CalibHistoSvc>               m_calibHitmapSvc; //convert to Tool
-      ServiceHandle<ISCT_CalibHistoSvc>               m_calibBsErrSvc;
-      ServiceHandle<ISCT_CalibHistoSvc>               m_calibLbSvc;
-      ServiceHandle<ISCT_CalibModuleListSvc>          m_calibModuleListSvc;
-      ServiceHandle<ISCT_CalibEvtInfo>                m_calibEvtInfoSvc;
+      ToolHandle<ISCT_CalibHistoTool>                 m_calibHitmapTool{this, "SCT_CalibHitMapTool", "SCT_CalibHitMapTool", "Tool for reading and writing HitMap histograms"};
+      ToolHandle<ISCT_CalibHistoTool>                 m_calibLbTool{this, "SCT_CalibLbTool", "SCT_CalibLbTool", "Tool for reading and writing Lb dependent HitMap histograms"};
+      ToolHandle<ISCT_CalibHistoTool>                 m_calibBsErrTool{this, "SCT_CalibBsErrTool", "SCT_CalibBsErrTool", "Tool for reading and writing BS error histograms"};
+      ToolHandle<ISCT_CalibModuleListTool>            m_calibModuleListTool{this, "SCT_CalibModuleListTool", "SCT_CalibModuleListTool", "Tool for handling list of modules"};
+      ToolHandle<ISCT_CalibEvtInfo>                   m_calibEvtInfoTool{this, "SCT_CalibEvtInfo", "SCT_CalibEvtInfo", "Tool for handling event info"};
 
       // Book histograms
 
@@ -219,7 +215,7 @@ class SCTCalib : public AthAlgorithm {
       BooleanProperty m_doBSErrorDB;
       BooleanProperty m_doLorentzAngle;
       BooleanProperty m_writeToCool;
-      //reinstated 21 May, sroe
+
       BooleanProperty m_noisyUpdate;
       BooleanProperty m_noisyUploadTest;
       FloatProperty   m_noisyModuleAverageInDB; // Average number of modules with at least 1 noisy strip in COOL
@@ -387,8 +383,7 @@ class SCTCalib : public AthAlgorithm {
                                const std::map< Identifier, std::set<Identifier> >& moduleListNew,
                                const std::map< Identifier, std::set<Identifier> >& moduleListRef,
                                const std::string& badStripsFile) const;
-      /* StatusCode  */
-      /* noisyStripsToSummaryXmlFake( const std::string& badStripsFile) const; */
+
       std::set<int>
       getNoisyChips( const std::set<Identifier>& stripIdList ) const;
       //
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteSvc.h
deleted file mode 100644
index 75e97fc990b5f0c4d147eac9bbb4fd8e980fe0d8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteSvc.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/** -*- c++ -*- */
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/*
-* @file SCTCalibWriteSvc.h
-*
-* @brief Header file for the SCTCalibWriteSvc class 
-*
-* @author Jose E. Garcia
-**/
-
-#ifndef SCTCalibWriteSvc_H
-#define SCTCalibWriteSvc_H
-
-//STL
-#include <string>
-#include <map>
-#include <set>
-#include <list>
-
-// Gaudi includes
-#include "AthenaBaseComps/AthService.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/ClassID.h"
-#include "StoreGate/StoreGate.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "CoralBase/AttributeListSpecification.h"
-#include "AthenaPoolUtilities/AthenaAttributeList.h"
-
-
-// Athena includes
-#include "Identifier/Identifier.h"
-
-// local includes
-#include "InDetConditionsSummaryService/InDetHierarchy.h"
-
-//forward declarations
-class ISvcLocator;
-class IdentifierHash;
-class SCT_ID;
-class EventInfo;
-class IIOVRegistrationSvc;
-class IAthenaOutputStreamTool;
-class CondAttrListCollection;
-class StoreGateSvc;
-
-/**
-** Algorithm to test writing conditions data and reading them back.
-  **/
-class SCTCalibWriteSvc: public AthService {
-  friend class SvcFactory<SCTCalibWriteSvc>;
- public:
-  // Constructor
-  SCTCalibWriteSvc(const std::string &name, ISvcLocator *pSvcLocator) ;
-  // Destructor
-  ~SCTCalibWriteSvc();
-  
-  // overloading functions
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-  static const InterfaceID& interfaceID() { 
-    static const InterfaceID IID_SCTCalibWriteSvc("SCTCalibWriteSvc", 1, 0); 
-    return IID_SCTCalibWriteSvc;
-  }
-  virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF); 
-  
-  ///Manually get the data in the structure before proceding
-  virtual StatusCode fillData();
-  
-  //I'm going to fill this from job options, so the callback version of fillData is not needed.
-  virtual StatusCode fillData(int& /*i */, std::list<std::string>& /*l*/) { //comment out unused parameters to prevent compiler warning
-    return StatusCode::FAILURE;
-  }
-  
-  std::string 
-  addDefect(const std::string& defectlist,const int defectBeginChannel,const int defectEndChannel) const;
-  
-  std::string 
-  addNumber(const std::string numStr,const unsigned long long number) const;
-
-  std::string 
-  createDefectString(const int defectBeginChannel,const int defectEndChannel) const;
-  
-  StatusCode 
-  createCondObjects( const Identifier& wafer_id,const SCT_ID* m_sctId,const int samplesize,const std::string& defectType,const float threshold,const std::string& defectList ) const;
-  
-  StatusCode createListStrip( const Identifier& wafer_id,
-            const SCT_ID* m_sctId,
-            const int samplesize,
-            const std::string& defectType,
-            const float threshold,
-            const std::string& defectList ) const;
-  
-  StatusCode createListChip( const Identifier& wafer_id,
-           const SCT_ID* m_sctId,
-           const int samplesize,
-           const std::string& defectType,
-           const float threshold,
-           const std::string& defectList ) const;
-
-  StatusCode createListEff( const Identifier& wafer_id,
-          const SCT_ID* m_sctId,
-          const int samplesize,
-          const float eff ) const;
-  
-  StatusCode createListNO( const Identifier& wafer_id,
-         const SCT_ID* m_sctId,
-         const int samplesize,
-         const float noise_occ ) const;
-
-  StatusCode createListRawOccu( const Identifier& wafer_id,
-        const SCT_ID* m_sctId,
-        const int samplesize,
-        const float raw_occu ) const;
-
-  StatusCode createListBSErr(const Identifier& wafer_id,
-	const SCT_ID* m_sctId,
-	const int samplesize,
-        const std::string & errorList,
-        const std::string & probList) const ;
-    
-    //StatusCode createListBSErr( const Identifier& wafer_id,
-    //        const unsigned long long n_events,
-    //        const std::string& BSErrorType,
-    //        const std::string& Ratio ) const;
-    
-  //  StatusCode createListLA(const Identifier& wafer_id,const SCT_ID* m_sctId,const int samplesize, const int module, const float lorentz, const float MCW ) const;
-  StatusCode createListLA(const Identifier& wafer_id,const SCT_ID* m_sctId,const int samplesize, const int module, const float lorentz, const float err_lorentz, const float chisq, const float fitParam_a, const float err_a, const float fitParam_b, const float err_b, const float fitParam_sigma, const float err_sigma, const float MCW, const float err_MCW ) const;
-/*  StatusCode createListLA( const Identifier& wafer_id,
-         const SCT_ID* m_sctId,
-         const int samplesize,
-         const float lorentz,
-         const float MCW ) const;
-*/
-  StatusCode wrapUpNoisyChannel();
-  StatusCode wrapUpDeadStrips();
-  StatusCode wrapUpDeadChips();
-  StatusCode wrapUpEfficiency();
-  StatusCode wrapUpNoiseOccupancy();
-  StatusCode wrapUpRawOccupancy();
-  StatusCode wrapUpBSErrors();
-  StatusCode wrapUpLorentzAngle();
-
-private:
-  StoreGateSvc* m_detStore;
-  SG::ReadHandleKey<EventInfo> m_eventInfoKey;
-
-  StatusCode registerIOV(const CLID& clid);
-  int stringToInt(const std::string& s) const;
-  
-  StatusCode streamOutCondObjects(const std::string & foldername);
-  StatusCode streamOutCondObjectsWithErrMsg(const std::string & foldername);
-
-  StatusCode registerCondObjects(const std::string & foldername,const std::string & tagname);
-  StatusCode recordAndStream(const CondAttrListCollection* pCollection,const std::string & foldername, bool & flag);
-  StatusCode registerCondObjectsWithErrMsg(const std::string& foldername,const std::string& tagname);
-  //
-  coral::AttributeListSpecification* createBasicDbSpec(const bool capsFormat) const;
-  void setBasicValues(coral::AttributeList & attrList, const Identifier& wafer_id, const int samplesize,const SCT_ID* m_sctId, const bool capsFormat) const;
-  // small helper function
-  unsigned int computeIstrip4moncond(const Identifier& elementId) const;
-  
-  const CondAttrListCollection* getAttrListCollectionByFolder(const std::string&) const;
-  
-  // would it make sense to change the strings to properties?
-  // that would be a fairly simple fix
-  static std::string s_separator;
-  static std::string s_defectFolderName;
-  static std::string s_deadStripFolderName;
-  static std::string s_deadChipFolderName;
-  static std::string s_effFolderName;
-  static std::string s_noFolderName;
-  static std::string s_RawOccuFolderName;
-  static std::string s_BSErrFolderName;
-  static std::string s_LAFolderName;
-  // cache for the Collections, access by foldername
-  mutable std::map<const std::string, const CondAttrListCollection*>  m_attrListCollectionMap;
-  CondAttrListCollection*      m_attrListColl;
-  CondAttrListCollection*      m_attrListColl_deadStrip;
-  CondAttrListCollection*      m_attrListColl_deadChip;
-  CondAttrListCollection*      m_attrListColl_eff;
-  CondAttrListCollection*      m_attrListColl_no;
-  CondAttrListCollection*      m_attrListColl_RawOccu;
-  CondAttrListCollection*      m_attrListColl_BSErr;
-  CondAttrListCollection*      m_attrListColl_LA;
-  BooleanProperty              m_writeCondObjs;
-  BooleanProperty              m_regIOV;
-  BooleanProperty              m_readWriteCool;
-  BooleanProperty              m_twoStepWriteReg;
-  BooleanProperty              m_manualiov;
-  /*IntegerProperty              m_regTime;*/
-  IntegerProperty              m_version;
-  /*IntegerProperty              m_nhits_noisychip;*/
-  /*IntegerProperty              m_nhits_noisywafer;*/
-  /*IntegerProperty              m_nhits_noisymodule;*/
-  IntegerProperty      m_beginRun;
-  IntegerProperty      m_endRun;
-  StringProperty               m_streamName;
-  std::string                  m_tagID4NoisyStrips;
-  std::string                  m_tagID4DeadStrips;
-  std::string                  m_tagID4DeadChips;
-  std::string                  m_tagID4Efficiency;
-  std::string                  m_tagID4NoiseOccupancy;
-  std::string                  m_tagID4RawOccupancy;
-  std::string                  m_tagID4BSErrors;
-  std::string                  m_tagID4LorentzAngle;
-
-
-  IIOVRegistrationSvc*         m_regSvc;
-  //IAthenaOutputStreamTool*     m_streamer;
-  ToolHandle<IAthenaOutputStreamTool> m_streamer;
-
-  //StringArrayProperty          m_badElements; unused list of bad detector elements (= module sides)
-  std::set<Identifier>         m_badIds;
-  bool                         m_defectRecorded;
-  bool                         m_deadStripRecorded;
-  bool                         m_deadChipRecorded;
-  bool                         m_effRecorded;
-  bool                         m_noRecorded;
-  bool                         m_RawOccuRecorded;
-  bool                         m_BSErrRecorded;
-  bool                         m_LARecorded;
-  const SCT_ID*                m_pHelper;
-  // FIXME: this caches only the last call of getList.
-  // creating a hash of _all_ calls may be faster, but wastes a lot of memory
-  mutable std::string          m_currentDefectList;
-};
-
-#endif // SCTCalibWriteSvc.h
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..437cfe410103386c62b5e9d6b5cbf94ea56dd14a
--- /dev/null
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h
@@ -0,0 +1,242 @@
+/** -*- c++ -*- */
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/*
+* @file SCTCalibWriteTool.h
+*
+* @brief Header file for the SCTCalibWriteTool class
+*
+* @author Jose E. Garcia
+**/
+
+#ifndef SCTCalibWriteTool_H
+#define SCTCalibWriteTool_H
+
+//STL
+#include <string>
+#include <map>
+#include <set>
+#include <list>
+
+// Gaudi includes
+#include "GaudiKernel/IInterface.h"
+#include "GaudiKernel/IAlgTool.h"
+//#include "GaudiKernel/ServiceHandle.h"
+#include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/StatusCode.h"
+#include "GaudiKernel/ClassID.h"
+
+#include "StoreGate/StoreGate.h"
+#include "StoreGate/ReadHandleKey.h"
+
+#include "CoralBase/AttributeListSpecification.h"
+
+#include "AthenaPoolUtilities/AthenaAttributeList.h"
+#include "AthenaBaseComps/AthAlgTool.h"
+
+// Athena includes
+#include "Identifier/Identifier.h"
+
+// local includes
+#include "InDetConditionsSummaryService/InDetHierarchy.h"
+
+//forward declarations
+class IdentifierHash;
+class SCT_ID;
+class EventInfo;
+class IIOVRegistrationSvc;
+class IAthenaOutputStreamTool;
+class CondAttrListCollection;
+class StoreGateSvc;
+
+/**
+** Algorithm to test writing conditions data and reading them back.
+**/
+class SCTCalibWriteTool : public AthAlgTool {
+
+   public:
+      // Constructor
+      SCTCalibWriteTool(const std::string& type, const std::string& name, const IInterface* parent);
+      // Destructor
+      ~SCTCalibWriteTool() {};
+
+      // overloading functions
+      virtual StatusCode initialize();
+      virtual StatusCode finalize();
+      static const InterfaceID & interfaceID();
+      virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF);
+
+      ///Manually get the data in the structure before proceding
+      virtual StatusCode fillData();
+
+      //I'm going to fill this from job options, so the callback version of fillData is not needed.
+      virtual StatusCode fillData(int& /*i */, std::list<std::string>& /*l*/) { //comment out unused parameters to prevent compiler warning
+         return StatusCode::FAILURE;
+      }
+
+      std::string
+      addDefect(const std::string& defectlist,const int defectBeginChannel,const int defectEndChannel) const;
+
+      std::string
+      addNumber(const std::string numStr,const unsigned long long number) const;
+
+      std::string
+      createDefectString(const int defectBeginChannel,const int defectEndChannel) const;
+
+      StatusCode
+      createCondObjects( const Identifier& wafer_id,const SCT_ID* m_sctId,const int samplesize,const std::string& defectType,const float threshold,const std::string& defectList ) const;
+
+      StatusCode createListStrip( const Identifier& wafer_id,
+                                  const SCT_ID* m_sctId,
+                                  const int samplesize,
+                                  const std::string& defectType,
+                                  const float threshold,
+                                  const std::string& defectList ) const;
+
+      StatusCode createListChip( const Identifier& wafer_id,
+                                 const SCT_ID* m_sctId,
+                                 const int samplesize,
+                                 const std::string& defectType,
+                                 const float threshold,
+                                 const std::string& defectList ) const;
+
+      StatusCode createListEff( const Identifier& wafer_id,
+                                const SCT_ID* m_sctId,
+                                const int samplesize,
+                                const float eff ) const;
+
+      StatusCode createListNO( const Identifier& wafer_id,
+                               const SCT_ID* m_sctId,
+                               const int samplesize,
+                               const float noise_occ ) const;
+
+      StatusCode createListRawOccu( const Identifier& wafer_id,
+                                    const SCT_ID* m_sctId,
+                                    const int samplesize,
+                                    const float raw_occu ) const;
+
+      StatusCode createListBSErr(const Identifier& wafer_id,
+                                 const SCT_ID* m_sctId,
+                                 const int samplesize,
+                                 const std::string & errorList,
+                                 const std::string & probList) const ;
+
+      StatusCode createListLA(const Identifier& wafer_id,
+                              const SCT_ID* m_sctId,
+                              const int samplesize,
+                              const int module,
+                              const float lorentz,
+                              const float err_lorentz,
+                              const float chisq,
+                              const float fitParam_a,
+                              const float err_a,
+                              const float fitParam_b,
+                              const float err_b,
+                              const float fitParam_sigma,
+                              const float err_sigma,
+                              const float MCW,
+                              const float err_MCW ) const;
+
+      StatusCode wrapUpNoisyChannel();
+      StatusCode wrapUpDeadStrips();
+      StatusCode wrapUpDeadChips();
+      StatusCode wrapUpEfficiency();
+      StatusCode wrapUpNoiseOccupancy();
+      StatusCode wrapUpRawOccupancy();
+      StatusCode wrapUpBSErrors();
+      StatusCode wrapUpLorentzAngle();
+
+   private:
+      StoreGateSvc* m_detStore;
+      SG::ReadHandleKey<EventInfo> m_eventInfoKey;
+
+      StatusCode registerIOV(const CLID& clid);
+      int stringToInt(const std::string& s) const;
+
+      StatusCode streamOutCondObjects(const std::string & foldername);
+      StatusCode streamOutCondObjectsWithErrMsg(const std::string & foldername);
+
+      StatusCode registerCondObjects(const std::string & foldername,const std::string & tagname);
+      StatusCode recordAndStream(const CondAttrListCollection* pCollection,const std::string & foldername, bool & flag);
+      StatusCode registerCondObjectsWithErrMsg(const std::string& foldername,const std::string& tagname);
+
+      coral::AttributeListSpecification* createBasicDbSpec(const bool capsFormat) const;
+      void setBasicValues(coral::AttributeList & attrList, const Identifier& wafer_id, const int samplesize,const SCT_ID* m_sctId, const bool capsFormat) const;
+      // small helper function
+      unsigned int computeIstrip4moncond(const Identifier& elementId) const;
+
+      const CondAttrListCollection* getAttrListCollectionByFolder(const std::string&) const;
+
+      // would it make sense to change the strings to properties?
+      // that would be a fairly simple fix
+      static std::string s_separator;
+      static std::string s_defectFolderName;
+      static std::string s_deadStripFolderName;
+      static std::string s_deadChipFolderName;
+      static std::string s_effFolderName;
+      static std::string s_noFolderName;
+      static std::string s_RawOccuFolderName;
+      static std::string s_BSErrFolderName;
+      static std::string s_LAFolderName;
+
+      // cache for the Collections, access by foldername
+      mutable std::map<const std::string, const CondAttrListCollection*>  m_attrListCollectionMap;
+      CondAttrListCollection*      m_attrListColl;
+      CondAttrListCollection*      m_attrListColl_deadStrip;
+      CondAttrListCollection*      m_attrListColl_deadChip;
+      CondAttrListCollection*      m_attrListColl_eff;
+      CondAttrListCollection*      m_attrListColl_no;
+      CondAttrListCollection*      m_attrListColl_RawOccu;
+      CondAttrListCollection*      m_attrListColl_BSErr;
+      CondAttrListCollection*      m_attrListColl_LA;
+      BooleanProperty              m_writeCondObjs;
+      BooleanProperty              m_regIOV;
+      BooleanProperty              m_readWriteCool;
+      BooleanProperty              m_twoStepWriteReg;
+      BooleanProperty              m_manualiov;
+      /*IntegerProperty              m_regTime;*/
+      IntegerProperty              m_version;
+      /*IntegerProperty              m_nhits_noisychip;*/
+      /*IntegerProperty              m_nhits_noisywafer;*/
+      /*IntegerProperty              m_nhits_noisymodule;*/
+      IntegerProperty              m_beginRun;
+      IntegerProperty              m_endRun;
+      StringProperty               m_streamName;
+      std::string                  m_tagID4NoisyStrips;
+      std::string                  m_tagID4DeadStrips;
+      std::string                  m_tagID4DeadChips;
+      std::string                  m_tagID4Efficiency;
+      std::string                  m_tagID4NoiseOccupancy;
+      std::string                  m_tagID4RawOccupancy;
+      std::string                  m_tagID4BSErrors;
+      std::string                  m_tagID4LorentzAngle;
+
+      IIOVRegistrationSvc*         m_regSvc;
+      IAthenaOutputStreamTool*     m_streamer;
+      //ToolHandle<IAthenaOutputStreamTool> m_streamer;
+
+      //StringArrayProperty          m_badElements; unused list of bad detector elements (= module sides)
+      std::set<Identifier>         m_badIds;
+      bool                         m_defectRecorded;
+      bool                         m_deadStripRecorded;
+      bool                         m_deadChipRecorded;
+      bool                         m_effRecorded;
+      bool                         m_noRecorded;
+      bool                         m_RawOccuRecorded;
+      bool                         m_BSErrRecorded;
+      bool                         m_LARecorded;
+      const SCT_ID*                m_pHelper;
+      // FIXME: this caches only the last call of getList.
+      // creating a hash of _all_ calls may be faster, but wastes a lot of memory
+      mutable std::string          m_currentDefectList;
+};
+
+inline const InterfaceID & SCTCalibWriteTool::interfaceID() {
+   static const InterfaceID IID("SCTCalibWriteTool",1,0);
+   return IID;
+}
+
+#endif // SCTCalibWriteTool.h
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCT_LorentzAngleFunc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCT_LorentzAngleFunc.h
index 748ab1caa5941c0f16f9577366f9687350a29495..6f71c74312ec83326c251f049ba22a5db0fefccf 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCT_LorentzAngleFunc.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCT_LorentzAngleFunc.h
@@ -7,21 +7,19 @@
 #include "TMath.h"
 
 Double_t
-LA_func(Double_t *x, Double_t *par){
-  const Int_t    n     = 1000; // number of integration step                                                                                                                                            
-  const Double_t xmin = x[0] - 5.0*par[3];
-  const Double_t xmax = x[0] + 5.0*par[3];
-  const Double_t h    = (xmax - xmin)/(n - 1);
-  const Double_t pi = 3.14159265;
-  Double_t sum = 0;
-  Double_t x_  = xmin;
-  Double_t LA_sum = 0;
-  for (Int_t i=1; i<n; i++) {
-    LA_sum= par[0]*TMath::Abs(TMath::Tan(x_*pi/180)-TMath::Tan(par[1]*pi/180))+par[2];
-    sum  += LA_sum * 0.017455/TMath::Sqrt(2*pi)/(par[3]*pi/180)*TMath::Exp(-(x[0]*pi/180 - x_*pi/180 )*(x[0]*pi/180 - x_*pi/180 )/(2*par[3]*pi/180*par[3]*pi/180))*h;
-    x_ += h;
-  }
-  return   sum;
+LA_func(Double_t *x, Double_t *par) {
+   const Int_t    n     = 1000; // number of integration step
+   const Double_t xmin = x[0] - 5.0*par[3];
+   const Double_t xmax = x[0] + 5.0*par[3];
+   const Double_t h    = (xmax - xmin)/(n - 1);
+   const Double_t pi = 3.14159265;
+   Double_t sum = 0;
+   Double_t x_  = xmin;
+   Double_t LA_sum = 0;
+   for (Int_t i=1; i<n; i++) {
+      LA_sum= par[0]*TMath::Abs(TMath::Tan(x_*pi/180)-TMath::Tan(par[1]*pi/180))+par[2];
+      sum  += LA_sum * 0.017455/TMath::Sqrt(2*pi)/(par[3]*pi/180)*TMath::Exp(-(x[0]*pi/180 - x_*pi/180 )*(x[0]*pi/180 - x_*pi/180 )/(2*par[3]*pi/180*par[3]*pi/180))*h;
+      x_ += h;
+   }
+   return   sum;
 }
-
-
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.cxx
index a6463d789eab951aed7ba5043e136700bbe24425..f60cc25aa3078fb16e3cb716c1dc15b066a95cb3 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.cxx
@@ -8,39 +8,38 @@
  */
 #include "IElementStreamer.h"
 
+namespace SCT_CalibAlgs {
+
+unsigned int IElementStreamer::m_depth=0;
+unsigned int IElementStreamer::m_nodeIndex=0;
 
-namespace SCT_CalibAlgs{
-  unsigned int IElementStreamer::m_depth=0;
-  unsigned int IElementStreamer::m_nodeIndex=0;
 IElementStreamer::IElementStreamer(const std::string & name, const std::map<std::string, std::string> & attributeMap, std::ostream & os):
-m_name(name), m_os(os),m_nodeId(m_nodeIndex){
-  std::map<std::string, std::string>::const_iterator i(attributeMap.begin());
-  std::map<std::string, std::string>::const_iterator end(attributeMap.end());
-  for(;i!=end;++i){
-    m_attributeNames.push_back(i->first); 
-    m_attributeValues.push_back(i->second);
-  }
-  ++m_depth;
-  ++m_nodeIndex;
+   m_name(name), m_os(os),m_nodeId(m_nodeIndex) {
+   std::map<std::string, std::string>::const_iterator i(attributeMap.begin());
+   std::map<std::string, std::string>::const_iterator end(attributeMap.end());
+   for(; i!=end; ++i) {
+      m_attributeNames.push_back(i->first);
+      m_attributeValues.push_back(i->second);
+   }
+   ++m_depth;
+   ++m_nodeIndex;
 }
 
 IElementStreamer::IElementStreamer(const std::string & name, const std::vector<std::string> & attributeNames, const std::vector<std::string> & attributeValues, std::ostream & os):
-m_name(name), m_attributeNames(attributeNames), m_attributeValues(attributeValues),m_os(os),m_nodeId(m_nodeIndex){
-  ++m_depth;
-  ++m_nodeIndex;
+   m_name(name), m_attributeNames(attributeNames), m_attributeValues(attributeValues),m_os(os),m_nodeId(m_nodeIndex) {
+   ++m_depth;
+   ++m_nodeIndex;
 }
 
-IElementStreamer::IElementStreamer(const std::string & name, const std::string & attributeName, const std::string & attributeValue, std::ostream & os):m_name(name),m_os(os), m_nodeId(m_nodeIndex){
-  m_attributeNames.push_back(attributeName);
-  m_attributeValues.push_back(attributeValue);
-  ++m_depth;
-  ++m_nodeIndex;
-}
-IElementStreamer::~IElementStreamer(){
-  --m_depth;
+IElementStreamer::IElementStreamer(const std::string & name, const std::string & attributeName, const std::string & attributeValue, std::ostream & os):m_name(name),m_os(os), m_nodeId(m_nodeIndex) {
+   m_attributeNames.push_back(attributeName);
+   m_attributeValues.push_back(attributeValue);
+   ++m_depth;
+   ++m_nodeIndex;
 }
-}
-
-
 
+IElementStreamer::~IElementStreamer() {
+   --m_depth;
+}
 
+}
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.h
index b00c7eb5c4d43b0099a89bf595e821de80da7524..5856d23a87d306b01e2581056d0a1b6c1e76ef4c 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.h
@@ -12,28 +12,29 @@
 #include <string>
 #include <map>
 #include <vector>
-namespace SCT_CalibAlgs{
-class IElementStreamer{
-protected:
-  std::string m_name;
-  std::vector<std::string> m_attributeNames;
-  std::vector<std::string> m_attributeValues;
-  std::ostream & m_os;
-  static unsigned int m_depth;
-  static unsigned int m_nodeIndex;
-  unsigned int m_nodeId;
-  
-public:
-  IElementStreamer(const std::string & name, const std::map<std::string, std::string> & attributeMap, std::ostream & os=std::cout);
-  IElementStreamer(const std::string & name, const std::string & attributeName, const std::string & attributeValue, std::ostream & os=std::cout);
-  IElementStreamer(const std::string & name, const std::vector<std::string> & attributeNames, const std::vector<std::string> & attributeValues, std::ostream & os=std::cout);
-  ~IElementStreamer();
-  template<class T>
-  void value(const T & v){
-    m_os<<v;
-  }
+namespace SCT_CalibAlgs {
+
+class IElementStreamer {
+
+   protected:
+      std::string m_name;
+      std::vector<std::string> m_attributeNames;
+      std::vector<std::string> m_attributeValues;
+      std::ostream & m_os;
+      static unsigned int m_depth;
+      static unsigned int m_nodeIndex;
+      unsigned int m_nodeId;
+
+   public:
+      IElementStreamer(const std::string & name, const std::map<std::string, std::string> & attributeMap, std::ostream & os=std::cout);
+      IElementStreamer(const std::string & name, const std::string & attributeName, const std::string & attributeValue, std::ostream & os=std::cout);
+      IElementStreamer(const std::string & name, const std::vector<std::string> & attributeNames, const std::vector<std::string> & attributeValues, std::ostream & os=std::cout);
+      ~IElementStreamer();
+      template<class T>
+      void value(const T & v) {
+         m_os<<v;
+      }
 };
+
 }
 #endif
-
-
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx
index 76c8c001798714118fa7e327d8e7323c39ddeb1e..20a73ad7c9bf06fee508e0fdb24b0ecedbd65ca1 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx
@@ -18,7 +18,7 @@
 int ISCT_CalibHistoTool::m_nLb=0;
 int ISCT_CalibHistoTool::m_nLbMerge=0;
 
-ISCT_CalibHistoTool::ISCT_CalibHistoTool():m_numberOfEventsHisto(0),m_thisSvc(0),m_pSCTHelper(0) {
+ISCT_CalibHistoTool::ISCT_CalibHistoTool():m_numberOfEventsHisto(0),m_thistSvc(0),m_pSCTHelper(0) {
    //std::cout<<"Instantiation of ISCT_CalibHistoTool"<<std::endl;
    //nop
 }
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx
index cf64c30d9e3f1d9c243dc992a528a8edc8b483e6..af1368e69fbc2e4644da1e1d5f1b8dd82365566c 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx
@@ -21,9 +21,9 @@
 #include "SCT_CalibAlgs/SCTCalib.h"
 #include "SCT_CalibAlgs/SCT_LorentzAngleFunc.h"
 #include "SCT_CalibUtilities.h"
-#include "SCT_CalibBsErrorSvc.h"
-#include "SCT_CalibLbSvc.h"
-#include "SCT_CalibModuleListSvc.h"
+#include "SCT_CalibBsErrorTool.h"
+#include "SCT_CalibLbTool.h"
+#include "SCT_CalibModuleListTool.h"
 #include "SCT_CalibEventInfo.h"
 #include "SCT_CalibHitmapTool.h"
 
@@ -158,29 +158,29 @@ normalizeList( const std::string& strList ) {
 
 SCTCalib::SCTCalib( const std::string& name, ISvcLocator* pSvcLocator ) :
    AthAlgorithm( name, pSvcLocator ),
-   p_sgSvc                     ("StoreGateSvc",name),
+   p_sgSvc                   ("StoreGateSvc",name),
    m_thistSvc(0),
    m_pSCTHelper(0),
    m_eventInfoKey(std::string("ByteStreamEventInfo")),
-   m_pCalibWriteSvc            ("SCTCalibWriteSvc",name),
-   m_calibHitmapTool           ("SCT_CalibHitmapTool"),
-   m_calibBsErrSvc             ("SCT_CalibBsErrorSvc",name),
-   m_calibLbSvc                ("SCT_CalibLbSvc",name),
-   m_calibModuleListSvc        ("SCT_CalibModuleListSvc",name),
-   m_calibEvtInfoSvc           ("SCT_CalibEventInfo",name),
+   //m_pCalibWriteTool         ("SCTCalibWriteTool"),
+   //m_calibHitmapTool         ("SCT_CalibHitmapTool"),
+   //m_calibBsErrTool          ("SCT_CalibBsErrorTool"),
+   //m_calibLbTool             ("SCT_CalibLbTool"),
+   //m_calibModuleListTool     ("SCT_CalibModuleListTool"),
+   //m_calibEvtInfoTool        ("SCT_CalibEventInfo"),
    m_numOfEventsProcessed(0),
-
    m_numOfLBsProcessed(0),
    m_absolutetriplimit(0),
    m_relativetriplimit(0),
    m_numberOfEventsHist(0),
    m_inputHist(0),
    /* m_readHist(false), */
-   m_MAXHASH(0) {
+   m_MAXHASH(0)
+{
    declareProperty( "RunNumber",                 m_runNumber );
    declareProperty( "RunStartTime",              m_runStartTime );
    declareProperty( "RunEndTime",                m_runEndTime );
-   declareProperty( "LBMax",                     m_LBMax = "1000");
+   declareProperty( "LBMax",                     m_LBMax                      = "1000");
    declareProperty( "UseDCS",                    m_useDCS                     = false );
    declareProperty( "UseConfiguration",          m_useConfiguration           = true );
    declareProperty( "UseCalibration",            m_useCalibration             = true );
@@ -192,7 +192,6 @@ SCTCalib::SCTCalib( const std::string& name, ISvcLocator* pSvcLocator ) :
    declareProperty( "HistBefore2010",            m_histBefore2010             = false );
    declareProperty( "DoHitMaps",                 m_doHitMaps                  = true );
    declareProperty( "LbsPerWindow",              m_nLbsMerged                  = 20 );
-   //  declareProperty( "EventsPerWindow",           m_eventsPerWindow            = 10000 );
    declareProperty( "ReadHitMaps",               m_readHitMaps                = false );
    declareProperty( "DoBSErrors",                m_doBSErrors                 = false );
    declareProperty( "DoNoisyStrip",              m_doNoisyStrip               = true );
@@ -206,15 +205,15 @@ SCTCalib::SCTCalib( const std::string& name, ISvcLocator* pSvcLocator ) :
    declareProperty( "DoBSErrorDB",               m_doBSErrorDB                = false );
    declareProperty( "DoLorentzAngle",            m_doLorentzAngle             = false );
    declareProperty( "WriteToCool",               m_writeToCool                = true );
-   //reinstated 21 May
-   declareProperty( "NoisyUpdate",                m_noisyUpdate               = true );
-   declareProperty( "NoisyUploadTest",            m_noisyUploadTest           = true );
-   declareProperty( "NoisyModuleAverageInDB",     m_noisyModuleAverageInDB    = -1. );
-   declareProperty( "NoisyStripLastRunInDB",      m_noisyStripLastRunInDB     = -999 );
-   declareProperty( "NoisyStripAverageInDB",      m_noisyStripAverageInDB     = -999. );
-   declareProperty( "NoisyModuleList",            m_noisyModuleList           = 200 );
-   declareProperty( "NoisyModuleDiff",            m_noisyModuleDiff           = 0.200 );
-   declareProperty( "NoisyStripDiff",             m_noisyStripDiff            = 128. );
+
+   declareProperty( "NoisyUpdate",               m_noisyUpdate                = true );
+   declareProperty( "NoisyUploadTest",           m_noisyUploadTest            = true );
+   declareProperty( "NoisyModuleAverageInDB",    m_noisyModuleAverageInDB     = -1. );
+   declareProperty( "NoisyStripLastRunInDB",     m_noisyStripLastRunInDB      = -999 );
+   declareProperty( "NoisyStripAverageInDB",     m_noisyStripAverageInDB      = -999. );
+   declareProperty( "NoisyModuleList",           m_noisyModuleList            = 200 );
+   declareProperty( "NoisyModuleDiff",           m_noisyModuleDiff            = 0.200 );
+   declareProperty( "NoisyStripDiff",            m_noisyStripDiff             = 128. );
 
    declareProperty( "NoisyMinStat",              m_noisyMinStat               = 50000 );
    declareProperty( "NoisyStripAll",             m_noisyStripAll              = true );
@@ -317,7 +316,7 @@ StatusCode SCTCalib::initialize() {
    m_waferItrBegin  = m_pSCTHelper->wafer_begin();
    m_waferItrEnd  = m_pSCTHelper->wafer_end();
    //
-   if ( not retrievedService(m_pCalibWriteSvc)) return StatusCode::FAILURE;
+   if ( not retrievedService(m_pCalibWriteTool)) return StatusCode::FAILURE;
    if ( m_doHV) msg( MSG::FATAL ) << "Not yet properly implemented and tested!" << endmsg;
 
    ATH_CHECK(m_ConfigurationConditionsTool.retrieve( EnableTool {m_useConfiguration} ) );
@@ -337,29 +336,29 @@ StatusCode SCTCalib::initialize() {
 
    if ( not retrievedService(m_calibHitmapTool)) return StatusCode::FAILURE;
 
-   if ( not retrievedService(m_calibModuleListSvc)) return StatusCode::FAILURE;
+   if ( not retrievedService(m_calibModuleListTool)) return StatusCode::FAILURE;
 
-   if ( not retrievedService(m_calibEvtInfoSvc)) return StatusCode::FAILURE;
+   if ( not retrievedService(m_calibEvtInfoTool)) return StatusCode::FAILURE;
 
    if ( !m_useBSError ) {
       ATH_MSG_DEBUG( "ByteStreamErrorsSvc was removed in initialization" );
    } else {
-      if ( not retrievedService(m_calibBsErrSvc)) return StatusCode::FAILURE;
+      if ( not retrievedService(m_calibBsErrTool)) return StatusCode::FAILURE;
    }
-   if ( not retrievedService(m_calibLbSvc) ) return StatusCode::FAILURE;
+   if ( not retrievedService(m_calibLbTool) ) return StatusCode::FAILURE;
 
    ATH_CHECK(m_CablingTool.retrieve());
 
    //--- LB range
    try {
       m_LBRange = std::stoi( m_LBMax );
-      ISCT_CalibHistoSvc::setNumberOfLb(m_LBRange);
+      ISCT_CalibHistoTool::setNumberOfLb(m_LBRange);
    } catch (...) {
       ATH_MSG_ERROR( "Couldn't cast m_LBMax=\""<< m_LBMax <<"\" to m_LBRange...");
       m_LBRange = 0;
    }
 
-   ISCT_CalibHistoSvc::setLbToMerge(m_nLbsMerged);
+   ISCT_CalibHistoTool::setLbToMerge(m_nLbsMerged);
 
 
    m_readHIST = m_doNoiseOccupancy || m_doRawOccupancy || m_doEfficiency || m_doBSErrorDB || m_doLorentzAngle;
@@ -372,7 +371,7 @@ StatusCode SCTCalib::initialize() {
    //--- Open BS
    if ( m_readBS ) {
       ATH_MSG_INFO( "------------> Reading from ByteStream <-------------");
-      m_calibEvtInfoSvc->setSource("BS");
+      m_calibEvtInfoTool->setSource("BS");
       ATH_CHECK(m_eventInfoKey.initialize());
    }
 
@@ -380,7 +379,7 @@ StatusCode SCTCalib::initialize() {
    //--- Open HIST
    if ( m_readHIST ) {
       ATH_MSG_INFO( "------------> Reading from HIST <-------------" );
-      m_calibEvtInfoSvc->setSource("HIST");
+      m_calibEvtInfoTool->setSource("HIST");
       //--- List of HIST
       std::string hist("");
       std::vector<std::string> histCollection = m_input_hist.value();
@@ -405,7 +404,7 @@ StatusCode SCTCalib::initialize() {
          const std::string os=std::to_string((int)m_runNumber);
          ATH_MSG_INFO( "Getting HIST directory : " << (int)m_runNumber );
          if ( not m_inputHist->GetDirectory( "/run_"+TString(os) ) ) return msg( MSG::ERROR ) << "RunNumber in HIST is inconsistent with jobO : " << os << endmsg, StatusCode::FAILURE ;
-         ATH_MSG_INFO( "Getting Number of events: " << m_calibEvtInfoSvc->counter() );
+         ATH_MSG_INFO( "Getting Number of events: " << m_calibEvtInfoTool->counter() );
          //--- Read number of events : Get an entry of "tier0ESD" in "/GLOBAL/DQTDataFlow/events_lb"
          std::string osHist= std::string( "/run_") + std::to_string((int)m_runNumber)+"/GLOBAL/DQTDataFlow/events_lb";
          TH1I* hist_events = (TH1I *) m_inputHist->Get( osHist.c_str() );
@@ -419,26 +418,26 @@ StatusCode SCTCalib::initialize() {
 
       ATH_MSG_INFO( "Initialization of TimeStamp/LB, taken from runInfo.txt" );
       //--- Initialization of TimeStamp/LB, taken from runInfo.txt
-      m_calibEvtInfoSvc->setSource("HIST");
-      m_calibEvtInfoSvc->setTimeStamp(m_runStartTime,m_runEndTime);
-      m_calibEvtInfoSvc->setRunNumber(m_runNumber);
+      m_calibEvtInfoTool->setSource("HIST");
+      m_calibEvtInfoTool->setTimeStamp(m_runStartTime,m_runEndTime);
+      m_calibEvtInfoTool->setRunNumber(m_runNumber);
    }
 
    //--- Booking histograms for hitmaps
    if ( m_doHitMaps ) m_calibHitmapTool->book();
    //--- Reading histograms for hitmaps
    if ( ( not m_doHitMaps && not m_doNoisyLB) && m_readHitMaps) {
-      m_calibEvtInfoSvc->setSource("HIST");
+      m_calibEvtInfoTool->setSource("HIST");
       m_calibHitmapTool->read("./SCTHitMaps.root");
       m_numberOfEventsHist = m_calibHitmapTool->size();
-      m_calibEvtInfoSvc->setTimeStamp(m_runStartTime,m_runEndTime);
-      m_calibEvtInfoSvc->setRunNumber(m_runNumber);
-      m_calibLbSvc->read("./SCTLB.root");
+      m_calibEvtInfoTool->setTimeStamp(m_runStartTime,m_runEndTime);
+      m_calibEvtInfoTool->setRunNumber(m_runNumber);
+      m_calibLbTool->read("./SCTLB.root");
    }
    //--- Booking histograms for BSErrors
-   if ( m_doBSErrors ) m_calibBsErrSvc->book();
+   if ( m_doBSErrors ) m_calibBsErrTool->book();
    //--- Hit-vs-LB for LBs in noisy links/chips
-   if ( m_doNoisyLB ) m_calibLbSvc->book();
+   if ( m_doNoisyLB ) m_calibLbTool->book();
 
    //--- Check statistics for NoiseOccupancy
    if ( m_doNoiseOccupancy and notEnoughStatistics(m_noiseOccupancyMinStat, m_numberOfEventsHist)) return StatusCode::FAILURE;
@@ -491,14 +490,14 @@ StatusCode SCTCalib::execute() {
       const int lumiBlock = evt->event_ID()->lumi_block();
       int timeStampBeginOld;
       int timeStampEndOld;
-      m_calibEvtInfoSvc->getTimeStamps(timeStampBeginOld, timeStampEndOld);
-      m_calibEvtInfoSvc->setTimeStamp(std::min(timeStamp, timeStampBeginOld), std::max(timeStamp, timeStampEndOld));
+      m_calibEvtInfoTool->getTimeStamps(timeStampBeginOld, timeStampEndOld);
+      m_calibEvtInfoTool->setTimeStamp(std::min(timeStamp, timeStampBeginOld), std::max(timeStamp, timeStampEndOld));
       int lbBeginOld;
       int lbEndOld;
-      m_calibEvtInfoSvc->getLumiBlock(lbBeginOld, lbEndOld);
-      m_calibEvtInfoSvc->setLumiBlock(std::min(lumiBlock, lbBeginOld), std::max(lumiBlock, lbEndOld));
-      m_calibEvtInfoSvc->setLumiBlock(lumiBlock);
-      m_calibEvtInfoSvc->setTimeStamp(timeStamp);
+      m_calibEvtInfoTool->getLumiBlock(lbBeginOld, lbEndOld);
+      m_calibEvtInfoTool->setLumiBlock(std::min(lumiBlock, lbBeginOld), std::max(lumiBlock, lbEndOld));
+      m_calibEvtInfoTool->setLumiBlock(lumiBlock);
+      m_calibEvtInfoTool->setTimeStamp(timeStamp);
    }
 
    const bool majorityIsGoodOrUnused=( m_useMajority and m_MajorityConditionsTool->isGood() ) or !m_useMajority;
@@ -506,13 +505,13 @@ StatusCode SCTCalib::execute() {
    if ( m_doHitMaps  and majorityIsGoodOrUnused ) m_calibHitmapTool->fill(m_readBS);
 
    //--- Fill histograms for (1) Number of events and (2) Hits as a function of LB
-   if ( m_doNoisyLB and majorityIsGoodOrUnused ) m_calibLbSvc->fill(m_readBS);
+   if ( m_doNoisyLB and majorityIsGoodOrUnused ) m_calibLbTool->fill(m_readBS);
 
    //--- Fill histograms for (1) Number of events and (2) BSErrors
-   if ( m_doBSErrors ) m_calibBsErrSvc->fill(m_readBS);
+   if ( m_doBSErrors ) m_calibBsErrTool->fill(m_readBS);
 
    //--- Increment event counter : to be ready for the next event loop
-   m_calibEvtInfoSvc->incrementCounter();
+   m_calibEvtInfoTool->incrementCounter();
 
    return StatusCode::SUCCESS;
 }
@@ -524,11 +523,11 @@ StatusCode SCTCalib::execute() {
 StatusCode SCTCalib::endRun() {
    ATH_MSG_INFO( "----- in endRun() ----- " );
    //--- Number of events processed
-   m_numberOfEvents = (m_readHIST || (!m_doHitMaps && m_readHitMaps)) ? m_numberOfEventsHist : m_calibEvtInfoSvc->counter();
-   m_calibEvtInfoSvc->getTimeStamps(m_utcBegin,m_utcEnd);
+   m_numberOfEvents = (m_readHIST || (!m_doHitMaps && m_readHitMaps)) ? m_numberOfEventsHist : m_calibEvtInfoTool->counter();
+   m_calibEvtInfoTool->getTimeStamps(m_utcBegin,m_utcEnd);
 
 
-   //  if ( m_doNoisyLB ) m_calibLbSvc->binHistograms(m_nLbsMerged);
+   //  if ( m_doNoisyLB ) m_calibLbTool->binHistograms(m_nLbsMerged);
 
    //--- IOV range defined by RunNumber and LB
    unsigned int beginRun = (int) m_runNumber;
@@ -661,8 +660,8 @@ StatusCode SCTCalib::doHVPrintXML(const std::pair<int, int> & timeInterval, cons
 StatusCode SCTCalib::getNoisyStrip() {
    enum Categories {ALL, NEW, REF, N_CATEGORIES};
    //--- Check statistics
-   //msg( MSG::INFO ) << m_calibEvtInfoSvc->counter() << "   " <<m_calibHitmapTool->size() << endmsg;
-   //int numOfEventsProcessed=m_calibEvtInfoSvc->counter();
+   //msg( MSG::INFO ) << m_calibEvtInfoTool->counter() << "   " <<m_calibHitmapTool->size() << endmsg;
+   //int numOfEventsProcessed=m_calibEvtInfoTool->counter();
    m_numOfEventsProcessed=m_calibHitmapTool->size();
    //sroe: This looks like a bug, so I change the code here
 
@@ -682,7 +681,7 @@ StatusCode SCTCalib::getNoisyStrip() {
    //--- Number of LBs processed
    m_numOfLBsProcessed = 0;
    for ( int iLB = 0; iLB != m_LBRange; ++iLB ) {
-      if ( m_calibLbSvc and m_calibLbSvc->getNumberOfEventsInBin( iLB + 1 ) > 0 ) ++m_numOfLBsProcessed;
+      if ( m_calibLbTool and m_calibLbTool->getNumberOfEventsInBin( iLB + 1 ) > 0 ) ++m_numOfLBsProcessed;
    }
 
    //--- Choice of threshold
@@ -691,7 +690,7 @@ StatusCode SCTCalib::getNoisyStrip() {
    ModuleList_t moduleLists[N_CATEGORIES];
    //Reading data from COOL
    // original code switched on this :if (m_noisyUpdate)
-   if (m_calibModuleListSvc->readModuleList(moduleLists[REF]).isFailure()) return msg( MSG::ERROR ) << "Could not read moduleList" << endmsg, StatusCode::FAILURE;
+   if (m_calibModuleListTool->readModuleList(moduleLists[REF]).isFailure()) return msg( MSG::ERROR ) << "Could not read moduleList" << endmsg, StatusCode::FAILURE;
 
    //two bad strip lists: all, new
    typedef std::set<Identifier> StripList_t;
@@ -936,7 +935,7 @@ StatusCode SCTCalib::getDeadStrip() {
 
       //check BS Error
       bool hasBSError=false;
-      if(m_calibBsErrSvc->size((int)waferHash)>0) hasBSError=true;
+      if(m_calibBsErrTool->size((int)waferHash)>0) hasBSError=true;
       if(disabled || hasBSError) { //goto WRITE_DB; //<-- who ever put this in should be shot; http://xkcd.com/292/
          if(side==1) {
             //write to DB & .xml.
@@ -954,7 +953,7 @@ StatusCode SCTCalib::getDeadStrip() {
 
             if(!(defectStrip.empty())) {
                if(m_writeToCool) {
-                  if (m_pCalibWriteSvc->createListStrip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadStripSignificance,defectStrip).isFailure())
+                  if (m_pCalibWriteTool->createListStrip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadStripSignificance,defectStrip).isFailure())
                      return msg( MSG::ERROR ) << "Could not create list" << endmsg, StatusCode::FAILURE;
                }
 
@@ -966,7 +965,7 @@ StatusCode SCTCalib::getDeadStrip() {
 
             if(!(defectChip.empty())) {
                if(m_writeToCool) {
-                  if ( m_pCalibWriteSvc->createListChip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadChipSignificance,defectChip).isFailure())
+                  if ( m_pCalibWriteTool->createListChip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadChipSignificance,defectChip).isFailure())
                      return msg( MSG::ERROR ) << "Could not create list" << endmsg, StatusCode::FAILURE;
                }
 
@@ -1052,7 +1051,7 @@ StatusCode SCTCalib::getDeadStrip() {
 
             if(!(defectStrip.empty())) {
                if(m_writeToCool) {
-                  if (m_pCalibWriteSvc->createListStrip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadStripSignificance,defectStrip).isFailure())
+                  if (m_pCalibWriteTool->createListStrip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadStripSignificance,defectStrip).isFailure())
                      return msg( MSG::ERROR ) << "Could not create strip list" << endmsg, StatusCode::FAILURE;
                }
 
@@ -1064,7 +1063,7 @@ StatusCode SCTCalib::getDeadStrip() {
             }
             if(!(defectChip.empty())) {
                if(m_writeToCool) {
-                  if (m_pCalibWriteSvc->createListChip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadChipSignificance,defectChip).isFailure())
+                  if (m_pCalibWriteTool->createListChip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadChipSignificance,defectChip).isFailure())
                      return msg( MSG::ERROR ) << "Could not create strip list" << endmsg, StatusCode::FAILURE;
                }
 
@@ -1097,14 +1096,14 @@ StatusCode SCTCalib::getDeadStrip() {
             if(m_doDeadStrip) {
                if(side==0) beginDead=0, endDead=767;
                else beginDead=768, endDead=1535;
-               defectStrip = m_pCalibWriteSvc->addDefect(defectStrip,beginDead,endDead);
+               defectStrip = m_pCalibWriteTool->addDefect(defectStrip,beginDead,endDead);
             }
 
             //For DeadChip
             if(m_doDeadChip) {
                if(side==0) beginDead=0, endDead=5;
                else beginDead=6, endDead=11;
-               defectChip = m_pCalibWriteSvc->addDefect(defectChip,beginDead,endDead);
+               defectChip = m_pCalibWriteTool->addDefect(defectChip,beginDead,endDead);
             }
 
             if(side==1) {
@@ -1123,7 +1122,7 @@ StatusCode SCTCalib::getDeadStrip() {
                }
                if(!(defectStrip.empty())) {
                   if(m_writeToCool) {
-                     if (m_pCalibWriteSvc->createListStrip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadStripSignificance,defectStrip).isFailure())
+                     if (m_pCalibWriteTool->createListStrip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadStripSignificance,defectStrip).isFailure())
                         return msg( MSG::ERROR ) << "Could not create strip list" << endmsg, StatusCode::FAILURE;
                   }
 
@@ -1136,7 +1135,7 @@ StatusCode SCTCalib::getDeadStrip() {
 
                if(!(defectChip.empty())) {
                   if(m_writeToCool) {
-                     if ( m_pCalibWriteSvc->createListChip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadChipSignificance,defectChip).isFailure())
+                     if ( m_pCalibWriteTool->createListChip(moduleId,m_pSCTHelper,10000,"DEAD",m_deadChipSignificance,defectChip).isFailure())
                         return msg( MSG::ERROR ) << "Could not create chip list" << endmsg, StatusCode::FAILURE;
                   }
 
@@ -1182,7 +1181,7 @@ StatusCode SCTCalib::getDeadStrip() {
             }
 
             if(m_doDeadChip) {
-               if((beforeIsDead && !isDead) || (j==5 && isDead)) defectChip = m_pCalibWriteSvc->addDefect(defectChip,beginDead,endDead);
+               if((beforeIsDead && !isDead) || (j==5 && isDead)) defectChip = m_pCalibWriteTool->addDefect(defectChip,beginDead,endDead);
             }
             beforeIsDead = isDead;
          }//end chip loop
@@ -1207,7 +1206,7 @@ StatusCode SCTCalib::getDeadStrip() {
                }
 
                if(m_doDeadStrip) {
-                  if((beforeIsDead && !isDead) || (j==5 && isDead)) defectStrip = m_pCalibWriteSvc->addDefect(defectStrip,beginDead,endDead);
+                  if((beforeIsDead && !isDead) || (j==5 && isDead)) defectStrip = m_pCalibWriteTool->addDefect(defectStrip,beginDead,endDead);
                }
                beforeIsDead = isDead;
             }
@@ -1246,13 +1245,13 @@ StatusCode SCTCalib::getDeadStrip() {
 
    if( m_writeToCool ) {
       if(m_doDeadStrip && hasDeadStrip) {
-         if ( m_pCalibWriteSvc->wrapUpDeadStrips().isFailure() ) {
+         if ( m_pCalibWriteTool->wrapUpDeadStrips().isFailure() ) {
             msg( MSG::ERROR ) << "Could not get DeadStrips Info" << endmsg;
             return StatusCode::FAILURE;
          }
       }
       if(m_doDeadChip && hasDeadChip) {
-         if ( m_pCalibWriteSvc->wrapUpDeadChips().isFailure() ) {
+         if ( m_pCalibWriteTool->wrapUpDeadChips().isFailure() ) {
             msg( MSG::ERROR ) << "Could not get DeadChips Info" << endmsg;
             return StatusCode::FAILURE;
          }
@@ -1374,7 +1373,7 @@ StatusCode SCTCalib::getNoiseOccupancy()
                outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn)<<endl;
                //--- DB output
                if ( m_writeToCool ) {
-                  if ( m_pCalibWriteSvc->createListNO( waferId, m_pSCTHelper, 10000, occupancy ).isFailure() ) {
+                  if ( m_pCalibWriteTool->createListNO( waferId, m_pSCTHelper, 10000, occupancy ).isFailure() ) {
                      msg( MSG::ERROR ) << "Unable to run createListNO" << endmsg;
                      return StatusCode::FAILURE;
                   }
@@ -1400,7 +1399,7 @@ StatusCode SCTCalib::getNoiseOccupancy()
                outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn)<<endl;
                //--- DB output
                if ( m_writeToCool ) {
-                  if ( m_pCalibWriteSvc->createListNO( waferId, m_pSCTHelper, 10000, occupancy ).isFailure() ) {
+                  if ( m_pCalibWriteTool->createListNO( waferId, m_pSCTHelper, 10000, occupancy ).isFailure() ) {
                      msg( MSG::ERROR ) << "Unable to run createListNO" << endmsg;
                      return StatusCode::FAILURE;
                   }
@@ -1425,7 +1424,7 @@ StatusCode SCTCalib::getNoiseOccupancy()
                outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn)<<endl;
                //--- DB output
                if ( m_writeToCool ) {
-                  if ( m_pCalibWriteSvc->createListNO( waferId, m_pSCTHelper, 10000, occupancy ).isFailure() ) {
+                  if ( m_pCalibWriteTool->createListNO( waferId, m_pSCTHelper, 10000, occupancy ).isFailure() ) {
                      msg( MSG::ERROR ) << "Unable to run createListNO" << endmsg;
                      return StatusCode::FAILURE;
                   }
@@ -1472,7 +1471,7 @@ StatusCode SCTCalib::getNoiseOccupancy()
 
    //--- DB output
    if( m_writeToCool ) {
-      if ( m_pCalibWriteSvc->wrapUpNoiseOccupancy().isFailure() ) {
+      if ( m_pCalibWriteTool->wrapUpNoiseOccupancy().isFailure() ) {
          msg( MSG::ERROR ) << "Could not get NoiseOccupancy" << endmsg;
          return StatusCode::FAILURE;
       }
@@ -1551,7 +1550,7 @@ StatusCode SCTCalib::getRawOccupancy()
                   }
                   //--- DB writing
                   if( m_writeToCool ) {
-                     if( m_pCalibWriteSvc->createListRawOccu(waferId, m_pSCTHelper, m_numberOfEvents, raw_occu).isFailure() ) {
+                     if( m_pCalibWriteTool->createListRawOccu(waferId, m_pSCTHelper, m_numberOfEvents, raw_occu).isFailure() ) {
                         msg( MSG::ERROR ) << "Unable to run createListRawOccu" << endmsg;
                         return StatusCode::FAILURE;
                      }
@@ -1578,7 +1577,7 @@ StatusCode SCTCalib::getRawOccupancy()
                }
                //--- DB writing
                if( m_writeToCool ) {
-                  if( m_pCalibWriteSvc->createListRawOccu(waferId, m_pSCTHelper, m_numberOfEvents, raw_occu).isFailure() ) {
+                  if( m_pCalibWriteTool->createListRawOccu(waferId, m_pSCTHelper, m_numberOfEvents, raw_occu).isFailure() ) {
                      msg( MSG::ERROR ) << "Unable to run createListRawOccu" << endmsg;
                      return StatusCode::FAILURE;
                   }
@@ -1619,7 +1618,7 @@ StatusCode SCTCalib::getRawOccupancy()
 
    //--- DB output
    if( m_writeToCool ) {
-      if ( m_pCalibWriteSvc->wrapUpRawOccupancy().isFailure() ) {
+      if ( m_pCalibWriteTool->wrapUpRawOccupancy().isFailure() ) {
          msg( MSG::ERROR ) << "Could not get RawOccupancy" << endmsg;
          return StatusCode::FAILURE;
       }
@@ -1685,7 +1684,7 @@ StatusCode SCTCalib::getEfficiency() {
    outFile << xmlValue("RunNumber",  (int)m_runNumber                  ) << linefeed
            << xmlValue("StartTime",  m_utcBegin                        ) << linefeed
            << xmlValue("EndTime",  m_utcEnd                            ) << linefeed
-           << xmlValue("Duration",  m_calibEvtInfoSvc->duration()      ) << linefeed
+           << xmlValue("Duration",  m_calibEvtInfoTool->duration()      ) << linefeed
            << xmlValue("LB",  m_LBRange                                ) << linefeed
            << xmlValue("Events",  m_numberOfEvents                     ) << linefeed
            << "  <modules>"<< endl;
@@ -1731,7 +1730,7 @@ StatusCode SCTCalib::getEfficiency() {
                   outFile << xmlChannelEfficiencyDataString(waferId, eff, sn)<<endl;
                   //--- DB writing
                   if( m_writeToCool ) {
-                     if( m_pCalibWriteSvc->createListEff(waferId, m_pSCTHelper, eff_entry, eff).isFailure() ) {
+                     if( m_pCalibWriteTool->createListEff(waferId, m_pSCTHelper, eff_entry, eff).isFailure() ) {
                         msg( MSG::ERROR ) << "Unable to run createListEff" << endmsg;
                         return StatusCode::FAILURE;
                      }
@@ -1760,7 +1759,7 @@ StatusCode SCTCalib::getEfficiency() {
                outFile << xmlChannelEfficiencyDataString(waferId, eff, sn)<<endl;
                //--- DB writing
                if( m_writeToCool ) {
-                  if( m_pCalibWriteSvc->createListEff(waferId, m_pSCTHelper, eff_entry, eff).isFailure() ) {
+                  if( m_pCalibWriteTool->createListEff(waferId, m_pSCTHelper, eff_entry, eff).isFailure() ) {
                      msg( MSG::ERROR ) << "Unable to run createListEff" << endmsg;
                      return StatusCode::FAILURE;
                   }
@@ -1810,7 +1809,7 @@ StatusCode SCTCalib::getEfficiency() {
 
    //--- DB output
    if( m_writeToCool ) {
-      if ( m_pCalibWriteSvc->wrapUpEfficiency().isFailure() ) {
+      if ( m_pCalibWriteTool->wrapUpEfficiency().isFailure() ) {
          msg( MSG::ERROR ) << "Could not get Efficiency" << endmsg;
          return StatusCode::FAILURE;
       }
@@ -1947,8 +1946,8 @@ StatusCode SCTCalib::getBSErrors() {
                         n_errors = (unsigned long long)prof_tmp->GetBinContent( iEta+1, iPhi+1 );
                         //		    unsigned long long n_errors = (unsigned long long)prof_tmp->GetBinContent( iEta+1, iPhi+1 );
                         if(n_errors!=0) {
-                           defecttype = m_pCalibWriteSvc->addNumber( defecttype, errItr->first );
-                           n_defect = m_pCalibWriteSvc->addNumber( n_defect, n_errors );
+                           defecttype = m_pCalibWriteTool->addNumber( defecttype, errItr->first );
+                           n_defect = m_pCalibWriteTool->addNumber( n_defect, n_errors );
                            errorProb = (float) n_errors / (float) m_numberOfEvents;
                            nErrs_ECC_module[iDisk][iSide][iEta][iPhi][errItr->first] = n_errors;
                            if( thisBec==ENDCAP_C ) {
@@ -1978,7 +1977,7 @@ StatusCode SCTCalib::getBSErrors() {
                         nErrLink_ECA[iDisk][iEta]++;
                      }
                      if( m_writeToCool ) {
-                        if( m_pCalibWriteSvc->createListBSErr(waferId, m_pSCTHelper, m_numberOfEvents, osErrorList.str(),osProbList.str()).isFailure() ) {
+                        if( m_pCalibWriteTool->createListBSErr(waferId, m_pSCTHelper, m_numberOfEvents, osErrorList.str(),osProbList.str()).isFailure() ) {
                            msg( MSG::ERROR ) << "Unable to run createListBSError" << endmsg;
                            return StatusCode::FAILURE;
                         }
@@ -2026,8 +2025,8 @@ StatusCode SCTCalib::getBSErrors() {
                      n_errors = (unsigned long long)prof_tmp->GetBinContent( iEta+1, iPhi+1 );
                      //		  unsigned long long n_errors = (unsigned long long)prof_tmp->GetBinContent( iEta+1, iPhi+1 );
                      if(n_errors!=0) {
-                        defecttype = m_pCalibWriteSvc->addNumber( defecttype, errItr->first );
-                        n_defect = m_pCalibWriteSvc->addNumber( n_defect, n_errors );
+                        defecttype = m_pCalibWriteTool->addNumber( defecttype, errItr->first );
+                        n_defect = m_pCalibWriteTool->addNumber( n_defect, n_errors );
                         errorProb = (float) n_errors / (float) m_numberOfEvents;
                         nErrs_Barrel_module[iLayer][iSide][iEta][iPhi][errItr->first] = n_errors;
                         nErrLink_Barrel_module[iLayer][iSide][iEta][iPhi]+=n_errors;
@@ -2047,7 +2046,7 @@ StatusCode SCTCalib::getBSErrors() {
                   n_errorLink++;
                   nErrLink_Barrel[iLayer]++;
                   if( m_writeToCool ) {
-                     if( m_pCalibWriteSvc->createListBSErr(waferId, m_pSCTHelper, m_numberOfEvents, osErrorList.str(), osProbList.str()).isFailure() ) {
+                     if( m_pCalibWriteTool->createListBSErr(waferId, m_pSCTHelper, m_numberOfEvents, osErrorList.str(), osProbList.str()).isFailure() ) {
                         msg( MSG::ERROR ) << "Unable to run createListBSError" << endmsg;
                         return StatusCode::FAILURE;
                      }//end of if m_pCalib
@@ -2165,7 +2164,7 @@ StatusCode SCTCalib::getBSErrors() {
 
    //--- DB output
    if( m_writeToCool ) {
-      if ( m_pCalibWriteSvc->wrapUpBSErrors().isFailure() ) {
+      if ( m_pCalibWriteTool->wrapUpBSErrors().isFailure() ) {
          msg( MSG::ERROR ) << "Could not get ByteStream Errors" << endmsg;
          return StatusCode::FAILURE;
       }
@@ -2424,8 +2423,8 @@ StatusCode SCTCalib::getLorentzAngle() {
 
             //--- DB output
             if ( m_writeToCool ) {
-               //	if ( m_pCalibWriteSvc->createListLA( waferId, m_pSCTHelper, 10000, moduleint[iModule], LA_BarrelSide[iLayer][iSide][iModule],MCW_BarrelSide[iLayer][iSide][iModule] ).isFailure() ) {
-               if ( m_pCalibWriteSvc->createListLA( waferId, m_pSCTHelper, 10000, moduleint[iModule], LA_BarrelSide[iLayer][iSide][iModule], Err_LA_BarrelSide[iLayer][iSide][iModule],  Chisq_BarrelSide[iLayer][iSide][iModule], A_BarrelSide[iLayer][iSide][iModule], Err_A_BarrelSide[iLayer][iSide][iModule], B_BarrelSide[iLayer][iSide][iModule], Err_B_BarrelSide[iLayer][iSide][iModule], Sigma_BarrelSide[iLayer][iSide][iModule], Err_Sigma_BarrelSide[iLayer][iSide][iModule], MCW_BarrelSide[iLayer][iSide][iModule], Err_MCW_BarrelSide[iLayer][iSide][iModule] ).isFailure() ) {
+               //	if ( m_pCalibWriteTool->createListLA( waferId, m_pSCTHelper, 10000, moduleint[iModule], LA_BarrelSide[iLayer][iSide][iModule],MCW_BarrelSide[iLayer][iSide][iModule] ).isFailure() ) {
+               if ( m_pCalibWriteTool->createListLA( waferId, m_pSCTHelper, 10000, moduleint[iModule], LA_BarrelSide[iLayer][iSide][iModule], Err_LA_BarrelSide[iLayer][iSide][iModule],  Chisq_BarrelSide[iLayer][iSide][iModule], A_BarrelSide[iLayer][iSide][iModule], Err_A_BarrelSide[iLayer][iSide][iModule], B_BarrelSide[iLayer][iSide][iModule], Err_B_BarrelSide[iLayer][iSide][iModule], Sigma_BarrelSide[iLayer][iSide][iModule], Err_Sigma_BarrelSide[iLayer][iSide][iModule], MCW_BarrelSide[iLayer][iSide][iModule], Err_MCW_BarrelSide[iLayer][iSide][iModule] ).isFailure() ) {
                   msg( MSG::ERROR ) << "Unable to run createListLA" << endmsg;
                   return StatusCode::FAILURE;
                }
@@ -2478,7 +2477,7 @@ StatusCode SCTCalib::getLorentzAngle() {
    file << xmlValue("RunNumber",  (int)m_runNumber) << linefeed
         << xmlValue("StartTime",  m_utcBegin) << linefeed
         << xmlValue("EndTime",  m_utcEnd) << linefeed
-        << xmlValue("Duration",  m_calibEvtInfoSvc->duration() ) << linefeed
+        << xmlValue("Duration",  m_calibEvtInfoTool->duration() ) << linefeed
         << xmlValue("LB",  m_LBRange) << linefeed
         << xmlValue("Events",  m_numberOfEvents) << linefeed
         << xmlValue("Flag",  DBUploadFlag) << linefeed
@@ -2492,7 +2491,7 @@ StatusCode SCTCalib::getLorentzAngle() {
 
    //--- DB output
    if( m_writeToCool ) {
-      if ( m_pCalibWriteSvc->wrapUpLorentzAngle().isFailure() ) {
+      if ( m_pCalibWriteTool->wrapUpLorentzAngle().isFailure() ) {
          msg( MSG::ERROR ) << "Could not get LorentzAngle" << endmsg;
          return StatusCode::FAILURE;
       }
@@ -2596,8 +2595,8 @@ StatusCode SCTCalib::openXML4DeadSummary( std::ofstream& file, const char* type,
    file <<xmlValue("RunNumber",(int) m_runNumber)                       << linefeed
         <<xmlValue("StartTime",      m_utcBegin)                        << linefeed
         <<xmlValue("EndTime",        m_utcEnd)                          << linefeed
-        <<xmlValue("Duration",       m_calibEvtInfoSvc->duration())     << linefeed
-        <<xmlValue("LB",             m_calibEvtInfoSvc->numLumiBlocks())<< linefeed
+        <<xmlValue("Duration",       m_calibEvtInfoTool->duration())     << linefeed
+        <<xmlValue("LB",             m_calibEvtInfoTool->numLumiBlocks())<< linefeed
         <<xmlValue("Events",         m_numberOfEvents )                 << linefeed
         <<xmlValue("Modules",        n_Module)                          << linefeed
         <<xmlValue("Links",          n_Link)                            << linefeed
@@ -2638,7 +2637,7 @@ StatusCode SCTCalib::openXML4MonSummary( std::ofstream& file, const char* type )
    file << xmlValue("RunNumber",  (int)m_runNumber                  ) << linefeed
         << xmlValue("StartTime",  m_utcBegin                        ) << linefeed
         << xmlValue("EndTime",  m_utcEnd                          ) << linefeed
-        << xmlValue("Duration",  m_calibEvtInfoSvc->duration() ) << linefeed
+        << xmlValue("Duration",  m_calibEvtInfoTool->duration() ) << linefeed
         << xmlValue("LB",  m_LBRange                         ) << linefeed
         << xmlValue("Events",  m_numberOfEvents                  ) << linefeed
         << "  <data>"<< endl;
@@ -2834,16 +2833,16 @@ SCTCalib::writeModuleListToCool( const std::map< Identifier, std::set<Identifier
          std::string defectStripsRef =  moduleRefItr != moduleListRef.end() ? getStripList( (*moduleRefItr).second ) : "";
          if ( m_noisyUpdate ) { //--- UPD1/UPD4
             if ( defectStripsAll != defectStripsRef ) {
-               if(m_pCalibWriteSvc->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll ).isFailure()) {
-                  msg( MSG::ERROR ) << "Could not create defect strip entry in the CalibWriteSvc." << endmsg;
+               if(m_pCalibWriteTool->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll ).isFailure()) {
+                  msg( MSG::ERROR ) << "Could not create defect strip entry in the CalibWriteTool." << endmsg;
                }
                nDefects++;
             } else msg( MSG::DEBUG ) << "Module "<< moduleId  <<" is identical to the reference output" << endmsg;
          } else {
             if ( m_noisyStripAll ) { //--- ALL noisy strips
-               if ( !defectStripsAll.empty() ) m_pCalibWriteSvc->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll );
+               if ( !defectStripsAll.empty() ) m_pCalibWriteTool->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll );
             } else { //--- Only NEW noisy strips
-               if ( !defectStripsNew.empty() ) m_pCalibWriteSvc->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsNew );
+               if ( !defectStripsNew.empty() ) m_pCalibWriteTool->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsNew );
             }
          }
       }
@@ -2852,7 +2851,7 @@ SCTCalib::writeModuleListToCool( const std::map< Identifier, std::set<Identifier
    if ( moduleListAll.empty() || nDefects==0 ) {
       msg( MSG::INFO ) << "Number of noisy strips was zero or the same list of noisy strips. No local DB was created." << endmsg;
    } else {
-      if ( m_pCalibWriteSvc->wrapUpNoisyChannel().isFailure() ) {
+      if ( m_pCalibWriteTool->wrapUpNoisyChannel().isFailure() ) {
          msg( MSG::ERROR ) << "Could not get NoisyStrips info" << endmsg;
          return StatusCode::FAILURE;
       }
@@ -2884,7 +2883,7 @@ SCTCalib::getStripList( const std::set<Identifier>& stripIdList ) const {
             } else {
                int stripBegin = firstStrip;
                int stripEnd   = firstStrip + groupSize -1;
-               strList = m_pCalibWriteSvc->addDefect( strList, stripBegin, stripEnd );
+               strList = m_pCalibWriteTool->addDefect( strList, stripBegin, stripEnd );
                firstStrip = stripNum;
                groupSize  = 1;
             }
@@ -2892,7 +2891,7 @@ SCTCalib::getStripList( const std::set<Identifier>& stripIdList ) const {
          if ( stripItr == stripItrLast ) {
             int stripBegin = firstStrip;
             int stripEnd   = stripNum;
-            strList = m_pCalibWriteSvc->addDefect( strList, stripBegin, stripEnd );
+            strList = m_pCalibWriteTool->addDefect( strList, stripBegin, stripEnd );
          }
       }
    }
@@ -2946,6 +2945,7 @@ SCTCalib::noisyStripsToXml( const std::map< Identifier, std::set<Identifier> >&
 
    return StatusCode::SUCCESS;
 }
+
 StatusCode SCTCalib::noisyStripsToSummaryXml( const std::map< Identifier, std::set<Identifier> >& moduleListAll,
       const std::map< Identifier, std::set<Identifier> >& moduleListNew,
       const std::map< Identifier, std::set<Identifier> >& moduleListRef,
@@ -2991,7 +2991,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml( const std::map< Identifier, std::s
       bool isNoisyWafer = getNumNoisyStrips( waferId ).second; // true if this wafer is noisy
       if ( isNoisyWafer ) {
          int link = m_pSCTHelper->side( waferId );
-         defectLinks = m_pCalibWriteSvc->addDefect( defectLinks, link, link );
+         defectLinks = m_pCalibWriteTool->addDefect( defectLinks, link, link );
          ++numLinksAll;
       }
 
@@ -3029,7 +3029,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml( const std::map< Identifier, std::s
                for ( ; chipItr != chipItrE; ++chipItr ) {
                   int chipId = *chipItr;
                   //--- To be written into module list
-                  defectChips = m_pCalibWriteSvc->addDefect( defectChips, chipId, chipId );
+                  defectChips = m_pCalibWriteTool->addDefect( defectChips, chipId, chipId );
                   //--- LBs where this chip was noisy
                   std::pair< string, float > defectLB = getNoisyLB( moduleId, chipId );
                   //--- Chip list written to XML
@@ -3119,7 +3119,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml( const std::map< Identifier, std::s
            << "  <value name=\"RunNumber\">"        << (int) m_runNumber                 << "</value>" << linefeed
            << "  <value name=\"StartTime\">"        << m_utcBegin                        << "</value>" << linefeed
            << "  <value name=\"EndTime\">"          << m_utcEnd                          << "</value>" << linefeed
-           << "  <value name=\"Duration\">"         << m_calibEvtInfoSvc->duration() << "</value>" << linefeed
+           << "  <value name=\"Duration\">"         << m_calibEvtInfoTool->duration() << "</value>" << linefeed
            << "  <value name=\"LB\">"               << m_numOfLBsProcessed               << "</value>" << linefeed
            << "  <value name=\"Events\">"           << m_numberOfEvents            << "</value>" << linefeed
            << "  <value name=\"Modules\">"          << numModulesAll                     << "</value>" << linefeed
@@ -3211,15 +3211,15 @@ SCTCalib::getNoisyLB( const Identifier& moduleId, int& chipId ) const {
    double chipOccupancyThr = noisyStripThr*n_stripPerChip*m_noisyChipFraction;
    std::set<int> LBList;
    LBList.clear();
-   if (!m_calibLbSvc) {
-      msg( MSG::ERROR ) << "NULL pointer m_calibLbSvc line "<<__LINE__ << endmsg;
+   if (!m_calibLbTool) {
+      msg( MSG::ERROR ) << "NULL pointer m_calibLbTool line "<<__LINE__ << endmsg;
       return std::make_pair( defectLB, defectLBFrac );
    }
 
    for ( int iLB = 0; iLB != m_LBRange; ++iLB ) {
-      double numEventsInLB = m_calibLbSvc->getNumberOfEventsInBin( iLB + 1 );
+      double numEventsInLB = m_calibLbTool->getNumberOfEventsInBin( iLB + 1 );
       if ( numEventsInLB == 0 ) continue;
-      double chipOccupancy = m_calibLbSvc->getBinForHistogramIndex( iLB + 1, histIndex )/numEventsInLB;
+      double chipOccupancy = m_calibLbTool->getBinForHistogramIndex( iLB + 1, histIndex )/numEventsInLB;
       if ( chipOccupancy > chipOccupancyThr ) LBList.insert( iLB );
    }
    //--- Transform LBList to string and calculate a fraction of noisy LBs
@@ -3254,7 +3254,7 @@ std::string SCTCalib::getLBList( const std::set<int>& LBList ) const {
             } else {
                int LBBegin = firstLB;
                int LBEnd   = firstLB + LBSize -1;
-               strList = m_pCalibWriteSvc->addDefect( strList, LBBegin, LBEnd );
+               strList = m_pCalibWriteTool->addDefect( strList, LBBegin, LBEnd );
                firstLB = iLB;
                LBSize  = 1;
             }
@@ -3262,7 +3262,7 @@ std::string SCTCalib::getLBList( const std::set<int>& LBList ) const {
          if ( LBItr == LBItrLast ) {
             int LBBegin = firstLB;
             int LBEnd   = iLB;
-            strList = m_pCalibWriteSvc->addDefect( strList, LBBegin, LBEnd );
+            strList = m_pCalibWriteTool->addDefect( strList, LBBegin, LBEnd );
          }
       }
    }
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx
deleted file mode 100644
index b8938c63a34981e345e6281b9c81ff12b04de5b2..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx
+++ /dev/null
@@ -1,752 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file SCTCalibWriteSvc.cxx
- *
- * @brief Implementation file for uploading to DB on CAF
- *
- * @author Jose E. Garcia
- **/
-#include "SCT_CalibAlgs/SCTCalibWriteSvc.h"
-
-// IOVDbTest includes
-#include "RegistrationServices/IIOVRegistrationSvc.h"
-
-// Gaudi includes
-#include "GaudiKernel/StatusCode.h"
-//#include "GaudiKernel/IToolSvc.h"
-
-// Athena includes
-#include "AthenaKernel/IAthenaOutputStreamTool.h"
-#include "CoralBase/Attribute.h"
-
-#include "AthenaPoolUtilities/CondAttrListCollection.h"
-#include "Identifier/IdentifierHash.h"
-#include "InDetIdentifier/SCT_ID.h"
-
-// Event Info 
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
-#include "EventInfo/EventType.h"
-
-//path resolver to find the file
-#include "PathResolver/PathResolver.h"
-
-#include <fstream>
-#include <iterator>
-#include <sstream>
-#include <iostream>
-#include <istream>
-#include <boost/lexical_cast.hpp>
-
-using std::string;
-/////////////////////////////////////////////////////////////////////////////
-string SCTCalibWriteSvc::s_separator = string("-");
-string SCTCalibWriteSvc::s_defectFolderName = string("/SCT/Derived/Monitoring");
-string SCTCalibWriteSvc::s_deadStripFolderName = string("/SCT/Derived/DeadStrips");
-string SCTCalibWriteSvc::s_deadChipFolderName = string("/SCT/Derived/DeadChips");
-string SCTCalibWriteSvc::s_effFolderName = string("/SCT/Derived/Efficiency");
-string SCTCalibWriteSvc::s_noFolderName = string("/SCT/Derived/NoiseOccupancy");
-string SCTCalibWriteSvc::s_RawOccuFolderName = string("/SCT/Derived/RawOccupancy");
-string SCTCalibWriteSvc::s_BSErrFolderName = string("/SCT/Derived/BSErrorsRun2");
-string SCTCalibWriteSvc::s_LAFolderName = string("/SCT/Derived/LorentzAngleRun2_v2");
-
-static bool becCapsFormat(true);
-static bool becUnderscoreFormat(false);
-
-SCTCalibWriteSvc::SCTCalibWriteSvc(const std::string& name, ISvcLocator* pSvcLocator ) :
-  AthService(name, pSvcLocator),
-  m_detStore(0),
-  m_eventInfoKey(std::string("ByteStreamEventInfo")),
-  m_attrListColl(0),
-  m_attrListColl_deadStrip(0),
-  m_attrListColl_deadChip(0),
-  m_attrListColl_eff(0),
-  m_attrListColl_no(0),
-  m_attrListColl_RawOccu(0),
-  m_attrListColl_BSErr(0),
-  m_attrListColl_LA(0),
-  //boolean properties
-  m_writeCondObjs(true),
-  m_regIOV(true),
-  m_readWriteCool(true),
-  m_twoStepWriteReg(false),
-  m_manualiov(true),
-  //
-  /*m_regTime(0), never used */
-  m_version(0),
-  m_beginRun(IOVTime::MINRUN),
-  m_endRun(IOVTime::MAXRUN),
-  m_streamName("CondStreamTest"),
-  
-
-  m_regSvc(0),
-  //m_streamer(0),
-  m_streamer("AthenaOutputStreamTool", this),
-  m_badIds(),
-  
-  m_defectRecorded(false),
-  m_deadStripRecorded(false),
-  m_deadChipRecorded(false),
-  m_effRecorded(false),
-  m_noRecorded(false),
-  m_RawOccuRecorded(false),
-  m_BSErrRecorded(false),
-  m_LARecorded(false),
-  m_pHelper(0),
-  m_currentDefectList("") 
-{
-  declareProperty("WriteCondObjs",        m_writeCondObjs);
-  declareProperty("RegisterIOV",          m_regIOV);
-  declareProperty("ReadWriteCool",        m_readWriteCool);
-  declareProperty("TwoStepWriteReg",      m_twoStepWriteReg);
-  declareProperty("ManualIOV",            m_manualiov);
-  //declareProperty("RegTime",              m_regTime);  never used Register time in sec
-  
-  declareProperty("BeginRun",             m_beginRun);
-  declareProperty("EndRun",               m_endRun);
-  //string properties:
-  declareProperty("StreamName",           m_streamName);
-  declareProperty("TagID4NoisyStrips",    m_tagID4NoisyStrips);
-  declareProperty("TagID4DeadStrips",     m_tagID4DeadStrips);
-  declareProperty("TagID4DeadChips",      m_tagID4DeadChips);
-  declareProperty("TagID4Efficiency",     m_tagID4Efficiency);
-  declareProperty("TagID4NoiseOccupancy", m_tagID4NoiseOccupancy);
-  declareProperty("TagID4RawOccupancy",   m_tagID4RawOccupancy);
-  declareProperty("TagID4BSErrors",       m_tagID4BSErrors);
-  declareProperty("TagID4LorentzAngle",   m_tagID4LorentzAngle);
-
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-SCTCalibWriteSvc::~SCTCalibWriteSvc()
-{ }
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-StatusCode SCTCalibWriteSvc::initialize(){ 
-  StatusCode sc = service("DetectorStore", m_detStore);
-  if ( !sc.isSuccess() || 0 == m_detStore) return msg(MSG:: ERROR) << "Could not find DetStore" << endmsg, StatusCode::FAILURE;
-  if (m_detStore->retrieve(m_pHelper,"SCT_ID").isFailure()) return msg(MSG:: ERROR) << "SCT mgr failed to retrieve" << endmsg, StatusCode::FAILURE;
-  
-  ATH_CHECK(m_eventInfoKey.initialize());
-  
-  // ------------------------------------------------------------
-  // The following is required for writing out something to COOL
-
-  // CondAttrListCollection to store table temporarily
-  m_attrListColl = new CondAttrListCollection(true);
-  m_attrListColl_deadStrip = new CondAttrListCollection(true);
-  m_attrListColl_deadChip = new CondAttrListCollection(true);
-  m_attrListColl_eff = new CondAttrListCollection(true);
-  m_attrListColl_no = new CondAttrListCollection(true);
-  m_attrListColl_RawOccu = new CondAttrListCollection(true);
-  m_attrListColl_BSErr = new CondAttrListCollection(true);
-  m_attrListColl_LA = new CondAttrListCollection(true);
-
-  // Get the IOVRegistrationSvc when needed
-  if (m_regIOV) {
-    if (service("IOVRegistrationSvc", m_regSvc).isFailure()) return msg(MSG:: ERROR)<< "Unable to find IOVRegistrationSvc "<< endmsg, StatusCode::FAILURE;
-  }
-  return StatusCode::SUCCESS;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::finalize(){
-  if (!m_defectRecorded) delete m_attrListColl;
-  if (!m_deadStripRecorded) delete m_attrListColl_deadStrip;
-  if (!m_deadChipRecorded) delete m_attrListColl_deadChip;
-  if (!m_effRecorded) delete m_attrListColl_eff;
-  if (!m_noRecorded) delete m_attrListColl_no;
-  if (!m_RawOccuRecorded) delete m_attrListColl_RawOccu;
-  if (!m_BSErrRecorded) delete m_attrListColl_BSErr;
-  if (!m_LARecorded) delete m_attrListColl_LA;
-  return StatusCode::SUCCESS;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-StatusCode SCTCalibWriteSvc::queryInterface(const InterfaceID& riid, void** ppvIF)
-{
-  if(SCTCalibWriteSvc::interfaceID().versionMatch(riid) ){
-      *ppvIF = (SCTCalibWriteSvc*)this; 
-    } else{ 
-      return AthService::queryInterface(riid, ppvIF); 
-    }
-  return StatusCode::SUCCESS; 
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-unsigned int
-SCTCalibWriteSvc::computeIstrip4moncond(const Identifier& elementId) const {
-    unsigned int iiside = m_pHelper->side(elementId);
-    unsigned int iistrip = m_pHelper->strip(elementId);
-    return 768*iiside + iistrip;
-}
-
-StatusCode 
-SCTCalibWriteSvc::fillData(){
-  // this is a dummy function
-  return StatusCode::SUCCESS;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////////////////////////////
-// Local stuff
-//////////////////////////////////////////////////////////////////////////////////////////
-
-string
-SCTCalibWriteSvc::addDefect(const string& defectlist,const int defectBeginChannel,const int defectEndChannel) const{
-  // check size of defect list,
-  // if it is empty then use createDefectString to make first entry. 
-  if (defectlist.empty()) return createDefectString(defectBeginChannel,defectEndChannel);
-
-  // adding another Defect in DefectList
-  std::ostringstream defect;
-  defect << defectlist << " " << defectBeginChannel;
-  if (defectBeginChannel==defectEndChannel){
-     defect << " ";
-  } else {
-    defect << "-" << defectEndChannel << " ";
-  }
-  return defect.str();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-std::string
-SCTCalibWriteSvc::createDefectString(const int defectBeginChannel,const int defectEndChannel) const{
-  std::ostringstream defect;
-  defect << " " << defectBeginChannel;
-  if (defectBeginChannel!=defectEndChannel) {
-    defect << "-" << defectEndChannel;
-  }
-  defect << " ";
-  return defect.str();
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////
-
-std::string
-SCTCalibWriteSvc::addNumber(const string numStr,const unsigned long long number) const{
-  std::ostringstream num_string;
-  // if it is empty then use createDefectString to make first entry. 
-  if (numStr.empty()){
-    num_string << number;
-  }else{  // adding another number to numStr
-    num_string << numStr << " " << number;
-  }
-  return num_string.str();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::createCondObjects(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,
-  const std::string & defectType,const float threshold,const std::string & defectList) const{
-  if (!m_writeCondObjs) {return StatusCode::SUCCESS;}
-  coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becCapsFormat);
-  attrSpec->extend("DefectType","string");
-  attrSpec->extend("Threshold","float");
-  attrSpec->extend("DefectList","string");
- 
-  if (!attrSpec->size()) {
-    msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-    return StatusCode::FAILURE;
-  } 
-
-  coral::AttributeList attrList0(*attrSpec);
-  setBasicValues(attrList0, wafer_id, samplesize,sctId,becCapsFormat);
-  attrList0["DefectType"].setValue(static_cast<std::string>(defectType));
-  attrList0["Threshold"].setValue(static_cast<float>(threshold));
-  attrList0["DefectList"].setValue(static_cast<std::string>(defectList));
-  std::ostringstream attrStr2;
-  attrList0.toOutputStream( attrStr2 );
-  m_attrListColl->add(wafer_id.get_identifier32().get_compact(), attrList0);
-  return StatusCode::SUCCESS;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-StatusCode SCTCalibWriteSvc::createListStrip(const Identifier& wafer_id,
-                   const SCT_ID* sctId,
-                   const int samplesize,
-                   const std::string & defectType,
-                   const float threshold,
-                   const std::string & defectList) const
-{
-  if (!m_writeCondObjs) {return StatusCode::SUCCESS;}
-  coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becCapsFormat);
-  attrSpec->extend("DefectType","string");
-  attrSpec->extend("Threshold","float");
-  attrSpec->extend("DefectList","string");
- 
-  if (!attrSpec->size()) {
-    msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-    return StatusCode::FAILURE;
-  } 
-
-  coral::AttributeList attrList0(*attrSpec);
-  setBasicValues(attrList0, wafer_id, samplesize,sctId, becCapsFormat);
-  attrList0["DefectType"].setValue(static_cast<std::string>(defectType));
-  attrList0["Threshold"].setValue(static_cast<float>(threshold));
-  attrList0["DefectList"].setValue(static_cast<std::string>(defectList));
-
-  std::ostringstream attrStr2;
-  attrList0.toOutputStream( attrStr2 );
-  m_attrListColl_deadStrip->add(wafer_id.get_identifier32().get_compact(), attrList0);
-  msg(MSG::INFO)<<"createListStrip: return StatusCode::SUCCESS"<<endmsg;
-  return StatusCode::SUCCESS;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-StatusCode SCTCalibWriteSvc::createListChip(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const std::string & defectType,const float threshold,const std::string & defectList) const{
-  if (!m_writeCondObjs) {return StatusCode::SUCCESS;}
-  coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becCapsFormat);
-  attrSpec->extend("DefectType","string");
-  attrSpec->extend("Threshold","float");
-  attrSpec->extend("DefectList","string");
-  if (!attrSpec->size()) {
-    msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-    return StatusCode::FAILURE;
-  } 
-
-  // Add three attr lists
-  coral::AttributeList attrList0(*attrSpec);
-  setBasicValues(attrList0, wafer_id, samplesize,sctId, becCapsFormat);
-  attrList0["DefectType"].setValue(static_cast<std::string>(defectType));
-  attrList0["Threshold"].setValue(static_cast<float>(threshold));
-  attrList0["DefectList"].setValue(static_cast<std::string>(defectList));
-
-  std::ostringstream attrStr2;
-  attrList0.toOutputStream( attrStr2 );
-  m_attrListColl_deadChip->add(wafer_id.get_identifier32().get_compact(), attrList0);
-
-  return StatusCode::SUCCESS;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-StatusCode SCTCalibWriteSvc::createListEff(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const float eff) const {
-  if(!m_writeCondObjs) {return StatusCode::SUCCESS;}
-
-  coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becUnderscoreFormat);
-  attrSpec->extend("Efficiency", "float");
-  if (!attrSpec->size()) {
-    msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-    return(StatusCode::FAILURE);
-  } 
-
-  coral::AttributeList attrList0(*attrSpec);
-  setBasicValues(attrList0, wafer_id, samplesize,sctId,becUnderscoreFormat);
-  attrList0["Efficiency"].setValue(static_cast<float>(eff));
-  
-  std::ostringstream attrStr2;
-  attrList0.toOutputStream(attrStr2);
-  m_attrListColl_eff->add(wafer_id.get_identifier32().get_compact(), attrList0);
-
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-
-StatusCode SCTCalibWriteSvc::createListNO(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const float noise_occ) const {
-  if (!m_writeCondObjs) {return StatusCode::SUCCESS;}
-  coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becUnderscoreFormat);
-  attrSpec->extend("NoiseOccupancy", "float");
-  if (!attrSpec->size()) {
-    msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-    return StatusCode::FAILURE;
-  } 
-  // Add three attr lists
-  coral::AttributeList attrList0(*attrSpec);
-  setBasicValues(attrList0, wafer_id, samplesize,sctId,becUnderscoreFormat);
-  attrList0["NoiseOccupancy"].setValue(static_cast<float>(noise_occ));
-  std::ostringstream attrStr2;
-  attrList0.toOutputStream(attrStr2);
-  m_attrListColl_no->add(wafer_id.get_identifier32().get_compact(), attrList0);
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-
-StatusCode 
-SCTCalibWriteSvc::createListRawOccu(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const float raw_occu) const {
-  if (!m_writeCondObjs) {return StatusCode::SUCCESS;}
-  coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becUnderscoreFormat);
-  attrSpec->extend("RawOccupancy", "float");
-  if (!attrSpec->size()) {
-    msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-    return StatusCode::FAILURE;
-  } 
-  // Add three attr lists
-  coral::AttributeList attrList0(*attrSpec);
-  setBasicValues(attrList0, wafer_id, samplesize, sctId,becUnderscoreFormat);
-  attrList0["RawOccupancy"].setValue(static_cast<float>(raw_occu));
-  std::ostringstream attrStr2;
-  attrList0.toOutputStream(attrStr2);
-  m_attrListColl_RawOccu->add(wafer_id.get_identifier32().get_compact(), attrList0);
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-
-StatusCode 
-SCTCalibWriteSvc::createListBSErr(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const std::string & errorList,const std::string & probList) const {
-  if (!m_writeCondObjs) {return StatusCode::SUCCESS;}
-
-
-  int eta = sctId->eta_module(wafer_id);
-  int phi = sctId->phi_module(wafer_id);
-  int barrel_ec = sctId->barrel_ec(wafer_id);
-  int layer = sctId->layer_disk(wafer_id);
-
-  coral::AttributeListSpecification* attrSpec =
-      new coral::AttributeListSpecification();
-  attrSpec->extend("SampleSize", "int");
-  attrSpec->extend("barrel_endcap", "int");
-  attrSpec->extend("Layer", "int");
-  attrSpec->extend("Eta", "int");
-  attrSpec->extend("Phi", "int");
-  attrSpec->extend("BSErrors", "string");
-  attrSpec->extend("BadFraction", "string");
-
-  if (!attrSpec->size()) {
-      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-      return StatusCode::FAILURE;
-  }
-
-  // Add three attr lists
-  coral::AttributeList attrList0(*attrSpec);
-  attrList0["SampleSize"].setValue(static_cast<int>(samplesize));
-  attrList0["barrel_endcap"].setValue(static_cast<int>(barrel_ec));
-  attrList0["Layer"].setValue(static_cast<int>(layer));
-  attrList0["Phi"].setValue(static_cast<int>(phi));
-  attrList0["Eta"].setValue(static_cast<int>(eta));
-  attrList0["BSErrors"].setValue(static_cast<std::string>(errorList));
-  attrList0["BadFraction"].setValue(static_cast<std::string>(probList));
-
-  
-  std::ostringstream attrStr2;
-  attrList0.toOutputStream(attrStr2);
-  m_attrListColl_BSErr->add(wafer_id.get_identifier32().get_compact(), attrList0);
-  return StatusCode::SUCCESS;
-}
-
-
-StatusCode
-SCTCalibWriteSvc::createListLA(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,int module, const float lorentz, const float err_lorentz, const float chisq, const float fitParam_a, const float err_a, const float fitParam_b, const float err_b, const float fitParam_sigma, const float err_sigma, const float MCW, const float err_MCW ) const {
-  if (!m_writeCondObjs) return StatusCode::SUCCESS;
-  int barrel_ec = sctId->barrel_ec(wafer_id);
-  int layer = sctId->layer_disk(wafer_id);
-  int side = sctId->side(wafer_id);
-  
-  coral::AttributeListSpecification* attrSpec =new coral::AttributeListSpecification();
-  attrSpec->extend("SampleSize", "int");
-  attrSpec->extend("barrel_endcap", "int");
-  attrSpec->extend("Layer", "int");
-  attrSpec->extend("Side", "int");
-  attrSpec->extend("moduleType", "int");
-  attrSpec->extend("lorentzAngle", "float");
-  attrSpec->extend("err_lorentzAngle", "float");
-  attrSpec->extend("chisq", "float");
-  attrSpec->extend("fitParam_a", "float");
-  attrSpec->extend("err_a", "float");
-  attrSpec->extend("fitParam_b", "float");
-  attrSpec->extend("err_b", "float");
-  attrSpec->extend("fitParam_sigma", "float");
-  attrSpec->extend("err_sigma", "float");
-  attrSpec->extend("minClusterWidth", "float");
-  attrSpec->extend("err_minClusterWidth", "float");
-   
-  if (!attrSpec->size()) {
-    msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-    return StatusCode::FAILURE;
-  }
-  
-  // Add three attr lists
-  coral::AttributeList attrList0(*attrSpec);
-  attrList0["SampleSize"].setValue(static_cast<int>(samplesize));
-  attrList0["barrel_endcap"].setValue(static_cast<int>(barrel_ec));
-  attrList0["Layer"].setValue(static_cast<int>(layer));
-  attrList0["Side"].setValue(static_cast<int>(side));
-  attrList0["moduleType"].setValue(static_cast<int>(module));
-  attrList0["lorentzAngle"].setValue(static_cast<float>(lorentz));
-  attrList0["err_lorentzAngle"].setValue(static_cast<float>(err_lorentz));
-  attrList0["chisq"].setValue(static_cast<float>(chisq));
-  attrList0["fitParam_a"].setValue(static_cast<float>(fitParam_a));
-  attrList0["err_a"].setValue(static_cast<float>(err_a));
-  attrList0["fitParam_b"].setValue(static_cast<float>(fitParam_b));
-  attrList0["err_b"].setValue(static_cast<float>(err_b));
-  attrList0["fitParam_sigma"].setValue(static_cast<float>(fitParam_sigma));
-  attrList0["err_sigma"].setValue(static_cast<float>(err_sigma));
-  attrList0["minClusterWidth"].setValue(static_cast<float>(MCW));
-  attrList0["err_minClusterWidth"].setValue(static_cast<float>(err_MCW));
-   
-  std::ostringstream attrStr2;
-  attrList0.toOutputStream(attrStr2);
-  m_attrListColl_LA->add(wafer_id.get_identifier32().get_compact(), attrList0);
-  
-  return StatusCode::SUCCESS;
-}
-
-
-// StatusCode 
-// SCTCalibWriteSvc::createListLA(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,int /*module*/, const float lorentz, const float MCW ) const {
-//   if (!m_writeCondObjs) return StatusCode::SUCCESS;
-//   int barrel_ec = sctId->barrel_ec(wafer_id);
-//   int layer = sctId->layer_disk(wafer_id);
-//   int side = sctId->side(wafer_id);
-
-//   coral::AttributeListSpecification* attrSpec =new coral::AttributeListSpecification();
-//   attrSpec->extend("SampleSize", "int");
-//   attrSpec->extend("barrel_endcap", "int");
-//   attrSpec->extend("Layer", "int");
-//   attrSpec->extend("Side", "int");
-//   attrSpec->extend("LorentzAngle", "float");
-//   attrSpec->extend("MinClusterWidth", "float");
- 
-//   if (!attrSpec->size()) {
-//     msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
-//     return StatusCode::FAILURE;
-//   } 
-
-//   // Add three attr lists
-//   coral::AttributeList attrList0(*attrSpec);
-//   attrList0["SampleSize"].setValue(static_cast<int>(samplesize));
-//   attrList0["barrel_endcap"].setValue(static_cast<int>(barrel_ec));
-//   attrList0["Layer"].setValue(static_cast<int>(layer));
-//   attrList0["Side"].setValue(static_cast<int>(side));
-//   attrList0["LorentzAngle"].setValue(static_cast<float>(lorentz));
-//   attrList0["MinClusterWidth"].setValue(static_cast<float>(MCW));
-  
-//   std::ostringstream attrStr2;
-//   attrList0.toOutputStream(attrStr2);
-//   m_attrListColl_LA->add(wafer_id.get_identifier32().get_compact(), attrList0);
-
-//   return StatusCode::SUCCESS;
-// }
-
-///////////////////////////////////////////////////////////////////////////////////
-
-const CondAttrListCollection*
-SCTCalibWriteSvc::getAttrListCollectionByFolder(const string& foldername) const {
-    // trying to find the pointer in the hashmap
-    // if it exists, return it, otherwise put it in.
-  const CondAttrListCollection* nullPtr(0);
-  const CondAttrListCollection* attrListCollection = nullPtr;
-  if (m_attrListCollectionMap.count(foldername) == 0) {
-      if ( m_detStore->retrieve(attrListCollection, foldername).isFailure()) return  msg(MSG:: ERROR)<< "Could not retrieve " << foldername << endmsg, nullPtr;
-      m_attrListCollectionMap.insert(make_pair(foldername, attrListCollection));
-  } else {
-      attrListCollection = m_attrListCollectionMap[foldername];
-  }
-  return attrListCollection;
-}
-
-// ===========================================================================
-
-int SCTCalibWriteSvc::stringToInt(const std::string& s) const {
-    return atoi(s.c_str());  
-}
-
-// ======================================================================
-StatusCode SCTCalibWriteSvc::wrapUpNoisyChannel(){
-  if (recordAndStream(m_attrListColl,s_defectFolderName,m_defectRecorded).isFailure()) return StatusCode::FAILURE;
-  if (registerCondObjectsWithErrMsg(s_defectFolderName, m_tagID4NoisyStrips).isFailure()) return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::wrapUpDeadStrips(){
-  if ( recordAndStream(m_attrListColl_deadStrip,s_deadStripFolderName,m_deadStripRecorded).isFailure()) return  StatusCode::FAILURE;
-  if (registerCondObjectsWithErrMsg(s_deadStripFolderName, m_tagID4DeadStrips).isFailure()) return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::wrapUpDeadChips(){
-  if (recordAndStream(m_attrListColl_deadChip,s_deadChipFolderName,m_deadChipRecorded).isFailure())  return StatusCode::FAILURE;
-  if (registerCondObjectsWithErrMsg(s_deadChipFolderName, m_tagID4DeadChips).isFailure()) return StatusCode::FAILURE;  
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::wrapUpEfficiency(){
-  if (recordAndStream(m_attrListColl_eff, s_effFolderName,m_effRecorded).isFailure()) return StatusCode::FAILURE;
-  if (registerCondObjectsWithErrMsg(s_effFolderName, m_tagID4Efficiency).isFailure()) return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::wrapUpNoiseOccupancy(){
-  if (recordAndStream(m_attrListColl_no, s_noFolderName,m_noRecorded).isFailure()) return StatusCode::FAILURE;
-  if (registerCondObjectsWithErrMsg(s_noFolderName, m_tagID4NoiseOccupancy).isFailure()) return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::wrapUpRawOccupancy(){
-  if (recordAndStream(m_attrListColl_RawOccu, s_RawOccuFolderName,m_RawOccuRecorded).isFailure()) return StatusCode::FAILURE;
-  if( registerCondObjectsWithErrMsg(s_RawOccuFolderName, m_tagID4RawOccupancy).isFailure()) return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::wrapUpBSErrors(){
-  if (recordAndStream(m_attrListColl_BSErr, s_BSErrFolderName,m_BSErrRecorded).isFailure()) return StatusCode::FAILURE;
-  if (registerCondObjectsWithErrMsg(s_BSErrFolderName, m_tagID4BSErrors).isFailure()) return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-StatusCode SCTCalibWriteSvc::wrapUpLorentzAngle(){
-  if (recordAndStream(m_attrListColl_LA, s_LAFolderName,m_LARecorded).isFailure()) return StatusCode::FAILURE;
-  if( registerCondObjectsWithErrMsg(s_LAFolderName, m_tagID4LorentzAngle).isFailure()) return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-
-StatusCode SCTCalibWriteSvc::streamOutCondObjects(const std::string& foldername) {
-  //if (m_streamer->connectOutput().isFailure()) {
-  if (m_streamer->connectOutput(m_streamName).isFailure()) {
-    msg(MSG:: ERROR) <<"Could not connect stream to output" <<endmsg;
-    return( StatusCode::FAILURE);
-  }
-  IAthenaOutputStreamTool::TypeKeyPairs typeKeys(1);
-  if (m_readWriteCool) {
-    IAthenaOutputStreamTool::TypeKeyPair
-    attrCollPair("CondAttrListCollection",foldername);
-    typeKeys[0] = attrCollPair;
-  }
-    
-  if (m_streamer->streamObjects(typeKeys).isFailure()) {
-    msg(MSG:: ERROR) << "Could not stream out AttributeLists" << endmsg;
-    return StatusCode::FAILURE;
-  }
-    
-  if (m_streamer->commitOutput().isFailure()) {
-    msg(MSG:: ERROR) << "Could not commit output stream" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  return StatusCode::SUCCESS;
-}
-///////////////////////////////////////////////////////////////////////////////////////
-
-StatusCode SCTCalibWriteSvc::streamOutCondObjectsWithErrMsg(const std::string& foldername) {
-  if (streamOutCondObjects(foldername).isFailure()){
-    return msg(MSG:: ERROR) <<"Could create conditions object  "<< foldername<< endmsg, StatusCode::FAILURE;
-  }
-  return StatusCode::SUCCESS;
-}
-
-// ======================================================================
-StatusCode 
-SCTCalibWriteSvc::registerCondObjects(const std::string& foldername,const std::string& tagname) {
-  // Register the IOV DB with the conditions data written out
-  if (m_readWriteCool) {
-    // Can only write out AttrList's if this is NOT write and reg in two steps
-    if (!m_twoStepWriteReg) { 
-      // Using COOL, write out attrlist and collection of attrlists
-      // attrlist collection 
-      StatusCode sc;
-      unsigned int beginRun;
-      unsigned int endRun;
-      if ( !m_manualiov ) {
-
-        SG::ReadHandle<EventInfo> evt(m_eventInfoKey);
-        if (not evt.isValid()) {
-           msg(MSG:: ERROR) << "Unable to get the EventInfo" << endmsg;
-           return StatusCode::FAILURE;
-        }
-	
-        beginRun = evt->event_ID()->run_number();
-        endRun = beginRun;
-
-      } else {
-        beginRun = m_beginRun;
-        if ( m_endRun != -1 )    endRun = m_endRun;
-        else                     endRun = IOVTime::MAXRUN;
-      }
-      
-      unsigned int beginLB = IOVTime::MINEVENT;
-      unsigned int endLB = IOVTime::MAXEVENT;
-      
-      //msg(MSG:: INFO) <<"beginRun = "<<beginRun<<"   endRun = "<<endRun<<"    tag = "<<tagname<<"   m_manualiov = "<<m_manualiov << endmsg;
-
-      if (not tagname.empty()) {
-        sc = m_regSvc->registerIOV("CondAttrListCollection",foldername,tagname,beginRun, endRun,beginLB, endLB);
-      } else {
-        sc = m_regSvc->registerIOV("CondAttrListCollection",foldername,"",beginRun, endRun,beginLB, endLB);
-      }
-      if (sc.isFailure()) {
-        msg(MSG:: ERROR) <<"Could not register in IOV DB for CondAttrListCollection" << endmsg;
-        return StatusCode::FAILURE;
-      }
-    }
-  }
-  return StatusCode::SUCCESS;
-}
-
-StatusCode 
-SCTCalibWriteSvc::registerCondObjectsWithErrMsg(const std::string& foldername,const std::string& tagname) {
-  if (m_regIOV){
-    if (registerCondObjects(foldername,tagname).isFailure()){
-       msg(MSG:: ERROR) << "Could not register "<<foldername << endmsg;
-       return StatusCode::FAILURE;
-    }
-  }
-  return StatusCode::SUCCESS;
-}
-
-StatusCode 
-SCTCalibWriteSvc::recordAndStream(const CondAttrListCollection* pCollection,const std::string & foldername, bool & flag){
-  if (m_writeCondObjs) {
-    if (m_detStore->record(pCollection, foldername).isFailure()) {
-      msg(MSG:: ERROR) << "Could not record "<<foldername << endmsg;
-      return StatusCode::FAILURE;
-    }
-    flag=true;
-    if (streamOutCondObjectsWithErrMsg(s_defectFolderName).isFailure()) return StatusCode::FAILURE;
-  }
-  return StatusCode::SUCCESS;
-}
-
-coral::AttributeListSpecification*
-SCTCalibWriteSvc::createBasicDbSpec(const bool capsFormat) const{
-  coral::AttributeListSpecification* attrSpec =new coral::AttributeListSpecification();
-  const std::string becName=capsFormat?"BarrelEndcap":"barrel_endcap";
-  attrSpec->extend("SampleSize", "int");
-  attrSpec->extend(becName, "int");
-  attrSpec->extend("Layer", "int");
-  attrSpec->extend("Eta", "int");
-  attrSpec->extend("Phi", "int");
-  return attrSpec;
-}
-
-void
-SCTCalibWriteSvc::setBasicValues(coral::AttributeList & attrList, const Identifier& wafer_id, const int samplesize,const SCT_ID* sctId, const bool capsFormat) const{
-  int eta = sctId->eta_module(wafer_id);
-  int phi = sctId->phi_module(wafer_id);
-  int barrel_ec = sctId->barrel_ec(wafer_id);
-  int layer = sctId->layer_disk(wafer_id);
-  //
-  const std::string becName=capsFormat?"BarrelEndcap":"barrel_endcap";
-  attrList["SampleSize"].setValue(static_cast<int>(samplesize));
-  attrList[becName].setValue(static_cast<int>(barrel_ec));
-  attrList["Layer"].setValue(static_cast<int>(layer));
-  attrList["Eta"].setValue(static_cast<int>(eta));
-  attrList["Phi"].setValue(static_cast<int>(phi));
-
-  return;
-}
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..368ad7188a3a16e9dfca261e9b2792f03dd14fbb
--- /dev/null
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx
@@ -0,0 +1,758 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @file SCTCalibWriteTool.cxx
+ *
+ * @brief Implementation file for uploading to DB on CAF
+ *
+ * @author Jose E. Garcia
+ **/
+#include "SCT_CalibAlgs/SCTCalibWriteTool.h"
+
+// IOVDbTest includes
+#include "RegistrationServices/IIOVRegistrationSvc.h"
+
+// Gaudi includes
+#include "GaudiKernel/StatusCode.h"
+#include "GaudiKernel/IToolSvc.h"
+
+// Athena includes
+#include "AthenaKernel/IAthenaOutputStreamTool.h"
+#include "CoralBase/Attribute.h"
+
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+#include "Identifier/IdentifierHash.h"
+#include "InDetIdentifier/SCT_ID.h"
+
+// Event Info
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/EventID.h"
+#include "EventInfo/EventType.h"
+
+//path resolver to find the file
+#include "PathResolver/PathResolver.h"
+
+#include <fstream>
+#include <iterator>
+#include <sstream>
+#include <iostream>
+#include <istream>
+#include <boost/lexical_cast.hpp>
+
+using std::string;
+/////////////////////////////////////////////////////////////////////////////
+string SCTCalibWriteTool::s_separator = string("-");
+string SCTCalibWriteTool::s_defectFolderName = string("/SCT/Derived/Monitoring");
+string SCTCalibWriteTool::s_deadStripFolderName = string("/SCT/Derived/DeadStrips");
+string SCTCalibWriteTool::s_deadChipFolderName = string("/SCT/Derived/DeadChips");
+string SCTCalibWriteTool::s_effFolderName = string("/SCT/Derived/Efficiency");
+string SCTCalibWriteTool::s_noFolderName = string("/SCT/Derived/NoiseOccupancy");
+string SCTCalibWriteTool::s_RawOccuFolderName = string("/SCT/Derived/RawOccupancy");
+string SCTCalibWriteTool::s_BSErrFolderName = string("/SCT/Derived/BSErrorsRun2");
+string SCTCalibWriteTool::s_LAFolderName = string("/SCT/Derived/LorentzAngleRun2_v2");
+
+static bool becCapsFormat(true);
+static bool becUnderscoreFormat(false);
+
+SCTCalibWriteTool::SCTCalibWriteTool(const std::string& type, const std::string& name, const IInterface* parent) :
+   AthAlgTool(type, name, parent),
+   m_detStore(0),
+   m_eventInfoKey(std::string("ByteStreamEventInfo")),
+   m_attrListColl(0),
+   m_attrListColl_deadStrip(0),
+   m_attrListColl_deadChip(0),
+   m_attrListColl_eff(0),
+   m_attrListColl_no(0),
+   m_attrListColl_RawOccu(0),
+   m_attrListColl_BSErr(0),
+   m_attrListColl_LA(0),
+   //boolean properties
+   m_writeCondObjs(true),
+   m_regIOV(true),
+   m_readWriteCool(true),
+   m_twoStepWriteReg(false),
+   m_manualiov(true),
+
+   /*m_regTime(0), never used */
+   m_version(0),
+   m_beginRun(IOVTime::MINRUN),
+   m_endRun(IOVTime::MAXRUN),
+   m_streamName("CondStreamTest"),
+
+   m_regSvc(0),
+   m_streamer(0),
+   //m_streamer("AthenaOutputStreamTool"),
+   m_badIds(),
+
+   m_defectRecorded(false),
+   m_deadStripRecorded(false),
+   m_deadChipRecorded(false),
+   m_effRecorded(false),
+   m_noRecorded(false),
+   m_RawOccuRecorded(false),
+   m_BSErrRecorded(false),
+   m_LARecorded(false),
+   m_pHelper(0),
+   m_currentDefectList("")
+{
+   declareProperty("WriteCondObjs",        m_writeCondObjs);
+   declareProperty("RegisterIOV",          m_regIOV);
+   declareProperty("ReadWriteCool",        m_readWriteCool);
+   declareProperty("TwoStepWriteReg",      m_twoStepWriteReg);
+   declareProperty("ManualIOV",            m_manualiov);
+   //declareProperty("RegTime",              m_regTime);  never used Register time in sec
+
+   declareProperty("BeginRun",             m_beginRun);
+   declareProperty("EndRun",               m_endRun);
+   //string properties:
+   declareProperty("StreamName",           m_streamName);
+   declareProperty("TagID4NoisyStrips",    m_tagID4NoisyStrips);
+   declareProperty("TagID4DeadStrips",     m_tagID4DeadStrips);
+   declareProperty("TagID4DeadChips",      m_tagID4DeadChips);
+   declareProperty("TagID4Efficiency",     m_tagID4Efficiency);
+   declareProperty("TagID4NoiseOccupancy", m_tagID4NoiseOccupancy);
+   declareProperty("TagID4RawOccupancy",   m_tagID4RawOccupancy);
+   declareProperty("TagID4BSErrors",       m_tagID4BSErrors);
+   declareProperty("TagID4LorentzAngle",   m_tagID4LorentzAngle);
+
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::initialize() {
+   StatusCode sc = service("DetectorStore", m_detStore);
+   if ( !sc.isSuccess() || 0 == m_detStore) return msg(MSG:: ERROR) << "Could not find DetStore" << endmsg, StatusCode::FAILURE;
+   if (m_detStore->retrieve(m_pHelper,"SCT_ID").isFailure()) return msg(MSG:: ERROR) << "SCT mgr failed to retrieve" << endmsg, StatusCode::FAILURE;
+
+   ATH_CHECK(m_eventInfoKey.initialize());
+
+   // ------------------------------------------------------------
+   // The following is required for writing out something to COOL
+
+   // CondAttrListCollection to store table temporarily
+   m_attrListColl = new CondAttrListCollection(true);
+   m_attrListColl_deadStrip = new CondAttrListCollection(true);
+   m_attrListColl_deadChip = new CondAttrListCollection(true);
+   m_attrListColl_eff = new CondAttrListCollection(true);
+   m_attrListColl_no = new CondAttrListCollection(true);
+   m_attrListColl_RawOccu = new CondAttrListCollection(true);
+   m_attrListColl_BSErr = new CondAttrListCollection(true);
+   m_attrListColl_LA = new CondAttrListCollection(true);
+
+   // Get the IOVRegistrationSvc when needed
+   if (m_regIOV) {
+      if (service("IOVRegistrationSvc", m_regSvc).isFailure()) return msg(MSG:: ERROR)<< "Unable to find IOVRegistrationSvc "<< endmsg, StatusCode::FAILURE;
+   }
+   return StatusCode::SUCCESS;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::finalize() {
+   if (!m_defectRecorded) delete m_attrListColl;
+   if (!m_deadStripRecorded) delete m_attrListColl_deadStrip;
+   if (!m_deadChipRecorded) delete m_attrListColl_deadChip;
+   if (!m_effRecorded) delete m_attrListColl_eff;
+   if (!m_noRecorded) delete m_attrListColl_no;
+   if (!m_RawOccuRecorded) delete m_attrListColl_RawOccu;
+   if (!m_BSErrRecorded) delete m_attrListColl_BSErr;
+   if (!m_LARecorded) delete m_attrListColl_LA;
+   return StatusCode::SUCCESS;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::queryInterface(const InterfaceID& riid, void** ppvIF)
+{
+   if(SCTCalibWriteTool::interfaceID().versionMatch(riid) ) {
+      *ppvIF = (SCTCalibWriteTool*)this;
+   } else {
+      return AthAlgTool::queryInterface(riid, ppvIF);
+   }
+   return StatusCode::SUCCESS;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+unsigned int
+SCTCalibWriteTool::computeIstrip4moncond(const Identifier& elementId) const {
+   unsigned int iiside = m_pHelper->side(elementId);
+   unsigned int iistrip = m_pHelper->strip(elementId);
+   return 768*iiside + iistrip;
+}
+
+StatusCode
+SCTCalibWriteTool::fillData() {
+   // this is a dummy function
+   return StatusCode::SUCCESS;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////
+// Local stuff
+//////////////////////////////////////////////////////////////////////////////////////////
+
+string
+SCTCalibWriteTool::addDefect(const string& defectlist,const int defectBeginChannel,const int defectEndChannel) const {
+   // check size of defect list,
+   // if it is empty then use createDefectString to make first entry.
+   if (defectlist.empty()) return createDefectString(defectBeginChannel,defectEndChannel);
+
+   // adding another Defect in DefectList
+   std::ostringstream defect;
+   defect << defectlist << " " << defectBeginChannel;
+   if (defectBeginChannel==defectEndChannel) {
+      defect << " ";
+   } else {
+      defect << "-" << defectEndChannel << " ";
+   }
+   return defect.str();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+std::string
+SCTCalibWriteTool::createDefectString(const int defectBeginChannel,const int defectEndChannel) const {
+   std::ostringstream defect;
+   defect << " " << defectBeginChannel;
+   if (defectBeginChannel!=defectEndChannel) {
+      defect << "-" << defectEndChannel;
+   }
+   defect << " ";
+   return defect.str();
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+std::string
+SCTCalibWriteTool::addNumber(const string numStr,const unsigned long long number) const {
+   std::ostringstream num_string;
+   // if it is empty then use createDefectString to make first entry.
+   if (numStr.empty()) {
+      num_string << number;
+   } else { // adding another number to numStr
+      num_string << numStr << " " << number;
+   }
+   return num_string.str();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::createCondObjects(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const std::string & defectType,const float threshold,const std::string & defectList) const {
+   if (!m_writeCondObjs) {
+      return StatusCode::SUCCESS;
+   }
+   coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becCapsFormat);
+   attrSpec->extend("DefectType","string");
+   attrSpec->extend("Threshold","float");
+   attrSpec->extend("DefectList","string");
+
+   if (!attrSpec->size()) {
+      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
+      return StatusCode::FAILURE;
+   }
+
+   coral::AttributeList attrList0(*attrSpec);
+   setBasicValues(attrList0, wafer_id, samplesize,sctId,becCapsFormat);
+   attrList0["DefectType"].setValue(static_cast<std::string>(defectType));
+   attrList0["Threshold"].setValue(static_cast<float>(threshold));
+   attrList0["DefectList"].setValue(static_cast<std::string>(defectList));
+   std::ostringstream attrStr2;
+   attrList0.toOutputStream( attrStr2 );
+   m_attrListColl->add(wafer_id.get_identifier32().get_compact(), attrList0);
+   return StatusCode::SUCCESS;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::createListStrip(const Identifier& wafer_id,
+                                   const SCT_ID* sctId,
+                                   const int samplesize,
+                                   const std::string & defectType,
+                                   const float threshold,
+                                   const std::string & defectList) const
+{
+   if (!m_writeCondObjs) {
+      return StatusCode::SUCCESS;
+   }
+   coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becCapsFormat);
+   attrSpec->extend("DefectType","string");
+   attrSpec->extend("Threshold","float");
+   attrSpec->extend("DefectList","string");
+
+   if (!attrSpec->size()) {
+      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
+      return StatusCode::FAILURE;
+   }
+
+   coral::AttributeList attrList0(*attrSpec);
+   setBasicValues(attrList0, wafer_id, samplesize,sctId, becCapsFormat);
+   attrList0["DefectType"].setValue(static_cast<std::string>(defectType));
+   attrList0["Threshold"].setValue(static_cast<float>(threshold));
+   attrList0["DefectList"].setValue(static_cast<std::string>(defectList));
+
+   std::ostringstream attrStr2;
+   attrList0.toOutputStream( attrStr2 );
+   m_attrListColl_deadStrip->add(wafer_id.get_identifier32().get_compact(), attrList0);
+   msg(MSG::INFO)<<"createListStrip: return StatusCode::SUCCESS"<<endmsg;
+   return StatusCode::SUCCESS;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::createListChip(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const std::string & defectType,const float threshold,const std::string & defectList) const {
+   if (!m_writeCondObjs) {
+      return StatusCode::SUCCESS;
+   }
+   coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becCapsFormat);
+   attrSpec->extend("DefectType","string");
+   attrSpec->extend("Threshold","float");
+   attrSpec->extend("DefectList","string");
+   if (!attrSpec->size()) {
+      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
+      return StatusCode::FAILURE;
+   }
+
+   // Add three attr lists
+   coral::AttributeList attrList0(*attrSpec);
+   setBasicValues(attrList0, wafer_id, samplesize,sctId, becCapsFormat);
+   attrList0["DefectType"].setValue(static_cast<std::string>(defectType));
+   attrList0["Threshold"].setValue(static_cast<float>(threshold));
+   attrList0["DefectList"].setValue(static_cast<std::string>(defectList));
+
+   std::ostringstream attrStr2;
+   attrList0.toOutputStream( attrStr2 );
+   m_attrListColl_deadChip->add(wafer_id.get_identifier32().get_compact(), attrList0);
+
+   return StatusCode::SUCCESS;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::createListEff(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const float eff) const {
+   if(!m_writeCondObjs) {
+      return StatusCode::SUCCESS;
+   }
+
+   coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becUnderscoreFormat);
+   attrSpec->extend("Efficiency", "float");
+   if (!attrSpec->size()) {
+      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
+      return(StatusCode::FAILURE);
+   }
+
+   coral::AttributeList attrList0(*attrSpec);
+   setBasicValues(attrList0, wafer_id, samplesize,sctId,becUnderscoreFormat);
+   attrList0["Efficiency"].setValue(static_cast<float>(eff));
+
+   std::ostringstream attrStr2;
+   attrList0.toOutputStream(attrStr2);
+   m_attrListColl_eff->add(wafer_id.get_identifier32().get_compact(), attrList0);
+
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::createListNO(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const float noise_occ) const {
+   if (!m_writeCondObjs) {
+      return StatusCode::SUCCESS;
+   }
+   coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becUnderscoreFormat);
+   attrSpec->extend("NoiseOccupancy", "float");
+   if (!attrSpec->size()) {
+      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
+      return StatusCode::FAILURE;
+   }
+   // Add three attr lists
+   coral::AttributeList attrList0(*attrSpec);
+   setBasicValues(attrList0, wafer_id, samplesize,sctId,becUnderscoreFormat);
+   attrList0["NoiseOccupancy"].setValue(static_cast<float>(noise_occ));
+   std::ostringstream attrStr2;
+   attrList0.toOutputStream(attrStr2);
+   m_attrListColl_no->add(wafer_id.get_identifier32().get_compact(), attrList0);
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::createListRawOccu(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const float raw_occu) const {
+   if (!m_writeCondObjs) {
+      return StatusCode::SUCCESS;
+   }
+   coral::AttributeListSpecification* attrSpec =createBasicDbSpec(becUnderscoreFormat);
+   attrSpec->extend("RawOccupancy", "float");
+   if (!attrSpec->size()) {
+      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
+      return StatusCode::FAILURE;
+   }
+   // Add three attr lists
+   coral::AttributeList attrList0(*attrSpec);
+   setBasicValues(attrList0, wafer_id, samplesize, sctId,becUnderscoreFormat);
+   attrList0["RawOccupancy"].setValue(static_cast<float>(raw_occu));
+   std::ostringstream attrStr2;
+   attrList0.toOutputStream(attrStr2);
+   m_attrListColl_RawOccu->add(wafer_id.get_identifier32().get_compact(), attrList0);
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::createListBSErr(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,const std::string & errorList,const std::string & probList) const {
+   if (!m_writeCondObjs) {
+      return StatusCode::SUCCESS;
+   }
+
+   int eta = sctId->eta_module(wafer_id);
+   int phi = sctId->phi_module(wafer_id);
+   int barrel_ec = sctId->barrel_ec(wafer_id);
+   int layer = sctId->layer_disk(wafer_id);
+
+   coral::AttributeListSpecification* attrSpec =
+      new coral::AttributeListSpecification();
+   attrSpec->extend("SampleSize", "int");
+   attrSpec->extend("barrel_endcap", "int");
+   attrSpec->extend("Layer", "int");
+   attrSpec->extend("Eta", "int");
+   attrSpec->extend("Phi", "int");
+   attrSpec->extend("BSErrors", "string");
+   attrSpec->extend("BadFraction", "string");
+
+   if (!attrSpec->size()) {
+      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
+      return StatusCode::FAILURE;
+   }
+
+   // Add three attr lists
+   coral::AttributeList attrList0(*attrSpec);
+   attrList0["SampleSize"].setValue(static_cast<int>(samplesize));
+   attrList0["barrel_endcap"].setValue(static_cast<int>(barrel_ec));
+   attrList0["Layer"].setValue(static_cast<int>(layer));
+   attrList0["Phi"].setValue(static_cast<int>(phi));
+   attrList0["Eta"].setValue(static_cast<int>(eta));
+   attrList0["BSErrors"].setValue(static_cast<std::string>(errorList));
+   attrList0["BadFraction"].setValue(static_cast<std::string>(probList));
+
+   std::ostringstream attrStr2;
+   attrList0.toOutputStream(attrStr2);
+   m_attrListColl_BSErr->add(wafer_id.get_identifier32().get_compact(), attrList0);
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::createListLA(const Identifier& wafer_id,const SCT_ID* sctId,const int samplesize,int module, const float lorentz, const float err_lorentz, const float chisq, const float fitParam_a, const float err_a, const float fitParam_b, const float err_b, const float fitParam_sigma, const float err_sigma, const float MCW, const float err_MCW ) const {
+   if (!m_writeCondObjs) return StatusCode::SUCCESS;
+   int barrel_ec = sctId->barrel_ec(wafer_id);
+   int layer = sctId->layer_disk(wafer_id);
+   int side = sctId->side(wafer_id);
+
+   coral::AttributeListSpecification* attrSpec =new coral::AttributeListSpecification();
+   attrSpec->extend("SampleSize", "int");
+   attrSpec->extend("barrel_endcap", "int");
+   attrSpec->extend("Layer", "int");
+   attrSpec->extend("Side", "int");
+   attrSpec->extend("moduleType", "int");
+   attrSpec->extend("lorentzAngle", "float");
+   attrSpec->extend("err_lorentzAngle", "float");
+   attrSpec->extend("chisq", "float");
+   attrSpec->extend("fitParam_a", "float");
+   attrSpec->extend("err_a", "float");
+   attrSpec->extend("fitParam_b", "float");
+   attrSpec->extend("err_b", "float");
+   attrSpec->extend("fitParam_sigma", "float");
+   attrSpec->extend("err_sigma", "float");
+   attrSpec->extend("minClusterWidth", "float");
+   attrSpec->extend("err_minClusterWidth", "float");
+
+   if (!attrSpec->size()) {
+      msg(MSG:: ERROR) << " Attribute list specification is empty" <<endmsg;
+      return StatusCode::FAILURE;
+   }
+
+   // Add three attr lists
+   coral::AttributeList attrList0(*attrSpec);
+   attrList0["SampleSize"].setValue(static_cast<int>(samplesize));
+   attrList0["barrel_endcap"].setValue(static_cast<int>(barrel_ec));
+   attrList0["Layer"].setValue(static_cast<int>(layer));
+   attrList0["Side"].setValue(static_cast<int>(side));
+   attrList0["moduleType"].setValue(static_cast<int>(module));
+   attrList0["lorentzAngle"].setValue(static_cast<float>(lorentz));
+   attrList0["err_lorentzAngle"].setValue(static_cast<float>(err_lorentz));
+   attrList0["chisq"].setValue(static_cast<float>(chisq));
+   attrList0["fitParam_a"].setValue(static_cast<float>(fitParam_a));
+   attrList0["err_a"].setValue(static_cast<float>(err_a));
+   attrList0["fitParam_b"].setValue(static_cast<float>(fitParam_b));
+   attrList0["err_b"].setValue(static_cast<float>(err_b));
+   attrList0["fitParam_sigma"].setValue(static_cast<float>(fitParam_sigma));
+   attrList0["err_sigma"].setValue(static_cast<float>(err_sigma));
+   attrList0["minClusterWidth"].setValue(static_cast<float>(MCW));
+   attrList0["err_minClusterWidth"].setValue(static_cast<float>(err_MCW));
+
+   std::ostringstream attrStr2;
+   attrList0.toOutputStream(attrStr2);
+   m_attrListColl_LA->add(wafer_id.get_identifier32().get_compact(), attrList0);
+
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+const CondAttrListCollection*
+SCTCalibWriteTool::getAttrListCollectionByFolder(const string& foldername) const {
+   // trying to find the pointer in the hashmap
+   // if it exists, return it, otherwise put it in.
+   const CondAttrListCollection* nullPtr(0);
+   const CondAttrListCollection* attrListCollection = nullPtr;
+   if (m_attrListCollectionMap.count(foldername) == 0) {
+      if ( m_detStore->retrieve(attrListCollection, foldername).isFailure()) return  msg(MSG:: ERROR)<< "Could not retrieve " << foldername << endmsg, nullPtr;
+      m_attrListCollectionMap.insert(make_pair(foldername, attrListCollection));
+   } else {
+      attrListCollection = m_attrListCollectionMap[foldername];
+   }
+   return attrListCollection;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+int
+SCTCalibWriteTool::stringToInt(const std::string& s) const {
+   return atoi(s.c_str());
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::wrapUpNoisyChannel() {
+   if (recordAndStream(m_attrListColl,s_defectFolderName,m_defectRecorded).isFailure()) return StatusCode::FAILURE;
+   if (registerCondObjectsWithErrMsg(s_defectFolderName, m_tagID4NoisyStrips).isFailure()) return StatusCode::FAILURE;
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::wrapUpDeadStrips() {
+   if ( recordAndStream(m_attrListColl_deadStrip,s_deadStripFolderName,m_deadStripRecorded).isFailure()) return  StatusCode::FAILURE;
+   if (registerCondObjectsWithErrMsg(s_deadStripFolderName, m_tagID4DeadStrips).isFailure()) return StatusCode::FAILURE;
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+StatusCode
+
+SCTCalibWriteTool::wrapUpDeadChips() {
+   if (recordAndStream(m_attrListColl_deadChip,s_deadChipFolderName,m_deadChipRecorded).isFailure())  return StatusCode::FAILURE;
+   if (registerCondObjectsWithErrMsg(s_deadChipFolderName, m_tagID4DeadChips).isFailure()) return StatusCode::FAILURE;
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode 
+SCTCalibWriteTool::wrapUpEfficiency() {
+   if (recordAndStream(m_attrListColl_eff, s_effFolderName,m_effRecorded).isFailure()) return StatusCode::FAILURE;
+   if (registerCondObjectsWithErrMsg(s_effFolderName, m_tagID4Efficiency).isFailure()) return StatusCode::FAILURE;
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode 
+SCTCalibWriteTool::wrapUpNoiseOccupancy() {
+   if (recordAndStream(m_attrListColl_no, s_noFolderName,m_noRecorded).isFailure()) return StatusCode::FAILURE;
+   if (registerCondObjectsWithErrMsg(s_noFolderName, m_tagID4NoiseOccupancy).isFailure()) return StatusCode::FAILURE;
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode 
+SCTCalibWriteTool::wrapUpRawOccupancy() {
+   if (recordAndStream(m_attrListColl_RawOccu, s_RawOccuFolderName,m_RawOccuRecorded).isFailure()) return StatusCode::FAILURE;
+   if( registerCondObjectsWithErrMsg(s_RawOccuFolderName, m_tagID4RawOccupancy).isFailure()) return StatusCode::FAILURE;
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode 
+SCTCalibWriteTool::wrapUpBSErrors() {
+   if (recordAndStream(m_attrListColl_BSErr, s_BSErrFolderName,m_BSErrRecorded).isFailure()) return StatusCode::FAILURE;
+   if (registerCondObjectsWithErrMsg(s_BSErrFolderName, m_tagID4BSErrors).isFailure()) return StatusCode::FAILURE;
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode 
+SCTCalibWriteTool::wrapUpLorentzAngle() {
+   if (recordAndStream(m_attrListColl_LA, s_LAFolderName,m_LARecorded).isFailure()) return StatusCode::FAILURE;
+   if( registerCondObjectsWithErrMsg(s_LAFolderName, m_tagID4LorentzAngle).isFailure()) return StatusCode::FAILURE;
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode 
+SCTCalibWriteTool::streamOutCondObjects(const std::string& foldername) {
+   //if (m_streamer->connectOutput().isFailure()) {
+   if (m_streamer->connectOutput(m_streamName).isFailure()) {
+      msg(MSG:: ERROR) <<"Could not connect stream to output" <<endmsg;
+      return( StatusCode::FAILURE);
+   }
+   IAthenaOutputStreamTool::TypeKeyPairs typeKeys(1);
+   if (m_readWriteCool) {
+      IAthenaOutputStreamTool::TypeKeyPair
+      attrCollPair("CondAttrListCollection",foldername);
+      typeKeys[0] = attrCollPair;
+   }
+
+   if (m_streamer->streamObjects(typeKeys).isFailure()) {
+      msg(MSG:: ERROR) << "Could not stream out AttributeLists" << endmsg;
+      return StatusCode::FAILURE;
+   }
+
+   if (m_streamer->commitOutput().isFailure()) {
+      msg(MSG:: ERROR) << "Could not commit output stream" << endmsg;
+      return StatusCode::FAILURE;
+   }
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::streamOutCondObjectsWithErrMsg(const std::string& foldername) {
+   if (streamOutCondObjects(foldername).isFailure()) {
+      return msg(MSG:: ERROR) <<"Could create conditions object  "<< foldername<< endmsg, StatusCode::FAILURE;
+   }
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::registerCondObjects(const std::string& foldername,const std::string& tagname) {
+   // Register the IOV DB with the conditions data written out
+   if (m_readWriteCool) {
+      // Can only write out AttrList's if this is NOT write and reg in two steps
+      if (!m_twoStepWriteReg) {
+         // Using COOL, write out attrlist and collection of attrlists
+         // attrlist collection
+         StatusCode sc;
+         unsigned int beginRun;
+         unsigned int endRun;
+         if ( !m_manualiov ) {
+
+            SG::ReadHandle<EventInfo> evt(m_eventInfoKey);
+            if (not evt.isValid()) {
+               msg(MSG:: ERROR) << "Unable to get the EventInfo" << endmsg;
+               return StatusCode::FAILURE;
+            }
+
+            beginRun = evt->event_ID()->run_number();
+            endRun = beginRun;
+
+         } else {
+            beginRun = m_beginRun;
+            if ( m_endRun != -1 )    endRun = m_endRun;
+            else                     endRun = IOVTime::MAXRUN;
+         }
+
+         unsigned int beginLB = IOVTime::MINEVENT;
+         unsigned int endLB = IOVTime::MAXEVENT;
+
+         //msg(MSG:: INFO) <<"beginRun = "<<beginRun<<"   endRun = "<<endRun<<"    tag = "<<tagname<<"   m_manualiov = "<<m_manualiov << endmsg;
+
+         if (not tagname.empty()) {
+            sc = m_regSvc->registerIOV("CondAttrListCollection",foldername,tagname,beginRun, endRun,beginLB, endLB);
+         } else {
+            sc = m_regSvc->registerIOV("CondAttrListCollection",foldername,"",beginRun, endRun,beginLB, endLB);
+         }
+         if (sc.isFailure()) {
+            msg(MSG:: ERROR) <<"Could not register in IOV DB for CondAttrListCollection" << endmsg;
+            return StatusCode::FAILURE;
+         }
+      }
+   }
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::registerCondObjectsWithErrMsg(const std::string& foldername,const std::string& tagname) {
+   if (m_regIOV) {
+      if (registerCondObjects(foldername,tagname).isFailure()) {
+         msg(MSG:: ERROR) << "Could not register "<<foldername << endmsg;
+         return StatusCode::FAILURE;
+      }
+   }
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode
+SCTCalibWriteTool::recordAndStream(const CondAttrListCollection* pCollection,const std::string & foldername, bool & flag) {
+   if (m_writeCondObjs) {
+      if (m_detStore->record(pCollection, foldername).isFailure()) {
+         msg(MSG:: ERROR) << "Could not record "<<foldername << endmsg;
+         return StatusCode::FAILURE;
+      }
+      flag=true;
+      if (streamOutCondObjectsWithErrMsg(s_defectFolderName).isFailure()) return StatusCode::FAILURE;
+   }
+   return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+coral::AttributeListSpecification*
+SCTCalibWriteTool::createBasicDbSpec(const bool capsFormat) const {
+   coral::AttributeListSpecification* attrSpec =new coral::AttributeListSpecification();
+   const std::string becName=capsFormat?"BarrelEndcap":"barrel_endcap";
+   attrSpec->extend("SampleSize", "int");
+   attrSpec->extend(becName, "int");
+   attrSpec->extend("Layer", "int");
+   attrSpec->extend("Eta", "int");
+   attrSpec->extend("Phi", "int");
+   return attrSpec;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void
+SCTCalibWriteTool::setBasicValues(coral::AttributeList & attrList, const Identifier& wafer_id, const int samplesize,const SCT_ID* sctId, const bool capsFormat) const {
+   int eta = sctId->eta_module(wafer_id);
+   int phi = sctId->phi_module(wafer_id);
+   int barrel_ec = sctId->barrel_ec(wafer_id);
+   int layer = sctId->layer_disk(wafer_id);
+   //
+   const std::string becName=capsFormat?"BarrelEndcap":"barrel_endcap";
+   attrList["SampleSize"].setValue(static_cast<int>(samplesize));
+   attrList[becName].setValue(static_cast<int>(barrel_ec));
+   attrList["Layer"].setValue(static_cast<int>(layer));
+   attrList["Eta"].setValue(static_cast<int>(eta));
+   attrList["Phi"].setValue(static_cast<int>(phi));
+
+   return;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorSvc.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorSvc.cxx
deleted file mode 100644
index 67a4f9ab72c1994e43ea93286f0f7bee1f1fdd75..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorSvc.cxx
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file SCT_CalibBsErrorSvc.cxx
- * Implementation file for the SCT_CalibBsErrorSvc class
- * @author Shaun Roe
-**/
-
-#include "SCT_CalibBsErrorSvc.h"
-#include "SCT_CalibUtilities.h"
-#include "SCT_CalibNumbers.h"
-//Inner detector includes
-
-#include <set>
-
-#include "Identifier/Identifier.h"
-#include "Identifier/IdentifierHash.h"
-#include "GaudiKernel/ITHistSvc.h"
-
-#include "TH1I.h"
-
-// RAW data access
-#include "InDetRawData/InDetRawDataCLASS_DEF.h"
-#include "InDetRawData/SCT3_RawData.h"
-
-using namespace std;
-using namespace SCT_CalibAlgs;
-
-const static string pathRoot("/BSErrors/");
-const static string detectorPaths[]={"SCTEC/", "SCTB/","SCTEA/"};
-const static string detectorNames[] = { "negativeEndcap", "barrel", "positiveEndcap" };
-const static int  n_BSErrorType = 15;
-const static int firstBSErrorType = 0;
-const static int lastBSErrorType = 14;
-static int MAXHASH(0);
-
-
-
-SCT_CalibBsErrorSvc::SCT_CalibBsErrorSvc(const std::string &name, ISvcLocator * svc):
-  AthService(name,svc),
-  m_detStore("DetectorStore", name),
-  m_evtStore("StoreGateSvc", name), 
-  m_pSCTHelper(0),
-  m_scterr_bec(0),
-  m_scterr_layer(0),
-  m_scterr_eta(0),
-  m_scterr_phi(0),
-  m_scterr_side(0),
-  m_scterr_rodid(0),
-  m_scterr_channel(0),
-  m_scterr_type(0)
-{
-
-}
-
-StatusCode
-SCT_CalibBsErrorSvc::initialize(){
-  if ( service( "THistSvc", m_thistSvc ).isFailure() ) return msg( MSG::ERROR) << "Unable to retrieve pointer to THistSvc" << endmsg, StatusCode::FAILURE;
-  if ( m_detStore->retrieve( m_pSCTHelper, "SCT_ID").isFailure()) return msg( MSG::ERROR) << "Unable to retrieve SCTHelper" << endmsg, StatusCode::FAILURE;
-  if ( m_bytestreamErrorsTool.retrieve().isFailure()) return msg( MSG::ERROR) << "Unable to retrieve BS Error Tool" << endmsg, StatusCode::FAILURE;
-  //
-  MAXHASH=m_pSCTHelper->wafer_hash_max();
-  m_waferItrBegin  = m_pSCTHelper->wafer_begin();
-  m_waferItrEnd  = m_pSCTHelper->wafer_end();
-  
-  return StatusCode::SUCCESS;
-}
-
-StatusCode
-SCT_CalibBsErrorSvc::finalize(){
-  msg( MSG::INFO)<<"Finalize of SCT_CalibBsErrorSvc"<<endmsg;
- 
-  return StatusCode::SUCCESS;
-}
-
-StatusCode 
-SCT_CalibBsErrorSvc::queryInterface(const InterfaceID & riid, void** ppvInterface ){
-  if ( ISCT_CalibHistoSvc::interfaceID().versionMatch(riid) ) {
-   *ppvInterface = dynamic_cast<ISCT_CalibHistoSvc*>(this);
-  } else {
-   return AthService::queryInterface(riid, ppvInterface);
-  }
-  addRef();
-  return StatusCode::SUCCESS;
-}
-
-bool
-SCT_CalibBsErrorSvc::book(){
-  bool result(true);
-  m_phistoVector.clear();
-  string histoName=pathRoot+"GENERAL/";
-  //histogram for numbers of events
-  m_numberOfEventsHisto=new TH1I("events","Events",1,0.5,1.5);
-  if( m_thistSvc->regHist( histoName.c_str(), m_numberOfEventsHisto ).isFailure() ) {
-      msg( MSG::ERROR ) << "Error in booking BSErrors histogram" << endmsg;
-  }
-  //--- BSErrors for each wafer
-  SCT_ID::const_id_iterator waferItr  = m_waferItrBegin;
-  SCT_ID::const_id_iterator waferItrE = m_waferItrEnd;
-  for( ; waferItr not_eq waferItrE; ++waferItr ) {
-    Identifier waferId = *waferItr;
-    const int bec( m_pSCTHelper->barrel_ec( waferId ) );
-    const string formattedPosition( formatPosition(waferId, m_pSCTHelper));
-    std::string histotitle = string( "SCT " ) + detectorNames[ bec2Index(bec) ] + string( " BSErrors : plane " ) + formattedPosition;
-    const std::string name=pathRoot+detectorPaths[bec2Index(m_pSCTHelper->barrel_ec( waferId ))] + formattedPosition;
-    TH1F* hitmapHisto_tmp = new TH1F( TString( formattedPosition ), TString( histotitle ), n_BSErrorType, firstBSErrorType-0.5, lastBSErrorType+0.5 );
-    if( m_thistSvc->regHist( name.c_str(), hitmapHisto_tmp ).isFailure() ) msg( MSG::ERROR ) << "Error in booking BSErrors histogram" << endmsg;
-    m_phistoVector.push_back( hitmapHisto_tmp );
-  }
-  return result; 
-}
-
-bool 
-SCT_CalibBsErrorSvc::read(const std::string & fileName){
-  msg( MSG::ERROR ) << "Reding BsError histograms from " << fileName.c_str() << " is not supported!" << endmsg;
-  return false;
-}
-
-bool
-SCT_CalibBsErrorSvc::fill(const bool fromData){
-  if (fromData){
-    return fillFromData(); 
-  }
-  bool result(true);
-  //--- Number of event
-  m_numberOfEventsHisto->Fill( 1 );
-  //--- Fill BSErrors
-  const int maxEntry = m_scterr_type->size();
-  for( int i = 0; i != maxEntry; ++i ) {
-    int bec   = (*m_scterr_bec)[i];
-    int layer = (*m_scterr_layer)[i];
-    int phi   = (*m_scterr_phi)[i];
-    int eta   = (*m_scterr_eta)[i];
-    int side  = (*m_scterr_side)[i];
-    int type  = (*m_scterr_type)[i];
-    Identifier waferId = m_pSCTHelper->wafer_id( bec, layer, phi, eta, side );
-    fillBsErrorsForWafer(waferId, type);
-  }
-  return result; 
-}
-
-bool
-SCT_CalibBsErrorSvc::fillFromData(){
- bool result(true);
- //--- Number of event
- m_numberOfEventsHisto->Fill( 1 );
- //--- Loop over BSErrors
-  for ( int type = 0; type < SCT_ByteStreamErrors::NUM_ERROR_TYPES; ++type ) {
-    const std::set<IdentifierHash>* errorSet = m_bytestreamErrorsTool->getErrorSet( type );
-    if ( errorSet != 0 ) {
-      std::set<IdentifierHash>::const_iterator it  = errorSet->begin();
-      std::set<IdentifierHash>::const_iterator itE = errorSet->end();
-      for ( ; it != itE; ++it ) {
-        Identifier waferId = m_pSCTHelper->wafer_id( *it );
-        fillBsErrorsForWafer(waferId, type);
-      }
-    }
-  }
-  return result; 
-}
-
-void 
-SCT_CalibBsErrorSvc::fillBsErrorsForWafer(const Identifier & waferId, const int type){
-  int iWaferHash = (int) m_pSCTHelper->wafer_hash( waferId );
-  const string osWafer=formatPosition(waferId, m_pSCTHelper,".");
-  //--- Protection for wrong waferID
-  if ( iWaferHash < 0 || iWaferHash >= MAXHASH ) {
-    msg( MSG::WARNING ) << "WaferHash " << iWaferHash << " is out of range : [ bec.layer.eta.phi.side, BSErrorType ] = [ " << osWafer << ", " << type << " ]" << endmsg;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg( MSG::DEBUG ) << "BSError : [ bec.layer.eta.phi.side, Type ] = [ " << osWafer<< ", " << type << " ]"<< endmsg;
-    m_phistoVector[ iWaferHash ]->Fill( type );
-  }
-}
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorSvc.h
deleted file mode 100644
index 7b9d8d77855937a1112922ceca637c899b809c64..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorSvc.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
-* @file SCT_CalibBsErrorSvc.h
-* Header file for the SCT_CalibBsErrorSvc class
-* @author Shaun Roe
-**/
-
-#ifndef SCT_CalibBsErrorSvc_h
-#define SCT_CalibBsErrorSvc_h
-
-
-//STL includes
-#include <string>
-
-//Athena includes
-#include "AthenaBaseComps/AthService.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "InDetIdentifier/SCT_ID.h"
-
-#include "SCT_ConditionsTools/ISCT_ByteStreamErrorsTool.h"
-
-
-//local includes
-#include "SCT_CalibAlgs/ISCT_CalibHistoSvc.h"
-
-//fwd declarations
-template <class TYPE> class SvcFactory;
-class StatusCode;
-class ISvcLocator;
-
-
-
-class SCT_CalibBsErrorSvc:virtual public ISCT_CalibHistoSvc, public AthService{
-  friend class SvcFactory<SCT_CalibBsErrorSvc>;
-public:
-  //@name Service methods, reimplemented
-   //@{
-  SCT_CalibBsErrorSvc(const std::string &name, ISvcLocator * svc); 
-  virtual ~SCT_CalibBsErrorSvc(){}
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-   //interfaceID() implementation is in the baseclass
-  virtual StatusCode queryInterface(const InterfaceID & riid, void** ppvInterface );
-   //@}
-   //@name ISCT_CalibHistoSvc methods, reimplemented
-   //@{
-  virtual bool book();
-  virtual bool read(const std::string & fileName);
-  virtual bool fill(const bool fromData=false);
-  virtual bool fillFromData();
-   //@}
-private:
-  ServiceHandle<StoreGateSvc> m_detStore;
-  ServiceHandle<StoreGateSvc> m_evtStore;
-  ToolHandle<ISCT_ByteStreamErrorsTool> m_bytestreamErrorsTool{this, "SCT_ByteStreamErrorsTool", "SCT_ByteStreamErrorsTool", "Tool to retrieve SCT ByteStream Errors"};
-  const SCT_ID* m_pSCTHelper;
-
-
-  // SCT specific numbers
-  
-  SCT_ID::const_id_iterator m_waferItrBegin;
-  SCT_ID::const_id_iterator m_waferItrEnd;
-  typedef std::vector<int> VecInt;
-  VecInt *m_scterr_bec;       
-  VecInt *m_scterr_layer;     
-  VecInt *m_scterr_eta;       
-  VecInt *m_scterr_phi;       
-  VecInt *m_scterr_side;
-  VecInt *m_scterr_rodid;     
-  VecInt *m_scterr_channel;
-  VecInt *m_scterr_type;
-
-
-    //
-  void
-    fillBsErrorsForWafer(const Identifier & waferId, const int type);
-
-};
-#endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h
index a8972c79e17f2b883240789572cec80516b0f1db..7ee81e269a6b7a67ec095e67feabd4773f918058 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h
@@ -37,7 +37,7 @@ class SCT_CalibBsErrorTool : public extends<AthAlgTool, ISCT_CalibHistoTool>
    public:
       //@name Tool methods, reimplemented
       //@{
-      SCT_CalibBsErrorTool(const std::string& type, const std::string& name, const IInterface* parent);
+      SCT_CalibBsErrorTool(const std::string&, const std::string&, const IInterface*);
       virtual ~SCT_CalibBsErrorTool() {};
       virtual StatusCode initialize();
       virtual StatusCode finalize();
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx
index d9fc765c22b1660772d64f7209f174bf1a5544cc..c6c714c423cde4d9d56faa07dbcca684cf5d87ef 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx
@@ -7,14 +7,15 @@
  * Implementation file for the SCT_CalibEventInfo class
  * @author Shaun Roe
 **/
+
 #include <limits>
-//STL, boost
+
 #include "SCT_CalibEventInfo.h"
 #include "SCT_CalibUtilities.h"
-#include "EventInfo/EventInfo.h"
 
+#include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
-//coral/cool
+
 #include "CoralBase/TimeStamp.h"
 
 namespace {
@@ -23,7 +24,8 @@ const int INTMAX(std::numeric_limits<int>::max());
 const long long oneBillion(1000000000LL);
 }
 
-SCT_CalibEventInfo::SCT_CalibEventInfo(const std::string &name, ISvcLocator * svc):AthService(name,svc),
+SCT_CalibEventInfo::SCT_CalibEventInfo(const std::string& type, const std::string& name, const IInterface* parent) :
+   base_class(type, name, parent),
    m_timeStampBegin(INTMAX),
    m_tsBeginString(""),
    m_tsEndString(""),
@@ -59,7 +61,7 @@ SCT_CalibEventInfo::queryInterface(const InterfaceID & riid, void** ppvInterface
    if ( ISCT_CalibEvtInfo::interfaceID().versionMatch(riid) ) {
       *ppvInterface = dynamic_cast<ISCT_CalibEvtInfo*>(this);
    } else {
-      return AthService::queryInterface(riid, ppvInterface);
+      return AthAlgTool::queryInterface(riid, ppvInterface);
    }
    addRef();
    return StatusCode::SUCCESS;
@@ -106,18 +108,22 @@ SCT_CalibEventInfo::setLumiBlock(const int begin, const int end) {
    m_LBEnd=end;
    m_numLB=end-begin+1;
 }
+
 void
 SCT_CalibEventInfo::setLumiBlock(const int lb) {
    m_lumiBlock=lb;
 }
+
 void
 SCT_CalibEventInfo::setSource(const std::string source) {
    m_source=source;
 }
+
 void
 SCT_CalibEventInfo::setRunNumber(const int rn) {
-  m_runNumber=rn;
+   m_runNumber=rn;
 }
+
 void
 SCT_CalibEventInfo::setBunchCrossing(const int bc) {
    m_bunchCrossing=bc;
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h
index 56896443cc937f1b92e93759df51a9f6c64a3ed9..a80750b22dd0b39cfcb6e0e07839eca2645a624e 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h
@@ -10,8 +10,10 @@
 
 #ifndef SCT_CalibEventInfo_h
 #define SCT_CalibEventInfo_h
-#include "AthenaBaseComps/AthService.h"    //baseclass
-#include "GaudiKernel/ServiceHandle.h"     //member
+//#include "AthenaBaseComps/AthService.h"    //baseclass
+//#include "GaudiKernel/ServiceHandle.h"     //member
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "GaudiKernel/ToolHandle.h"     //member
 
 #include "SCT_CalibAlgs/ISCT_CalibEvtInfo.h"
 #include <string>
@@ -20,12 +22,12 @@ class StatusCode;
 class ISvcLocator;
 class InterfaceID;
 
-class SCT_CalibEventInfo: virtual public ISCT_CalibEvtInfo,  public AthService {
-      friend class SvcFactory<SCT_CalibEventInfo>;
+class SCT_CalibEventInfo: public extends<AthAlgTool, ISCT_CalibEvtInfo>
+{
    public:
       //@name Service methods, reimplemented
       //@{
-      SCT_CalibEventInfo(const std::string &name, ISvcLocator * svc);
+      SCT_CalibEventInfo(const std::string&, const std::string&, const IInterface*);
       virtual ~SCT_CalibEventInfo() {}
       virtual StatusCode initialize();
       virtual StatusCode finalize();
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapSvc.h
deleted file mode 100644
index 80066e67eeff41acfe6a5095a2360d29372b3629..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapSvc.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file SCT_CalibHitmapSvc.h
- * Header file for the SCT_CalibHitmapSvc class
- * @author Shaun Roe
-**/
-
-#ifndef SCT_CalibHitmapSvc_h
-#define SCT_CalibHitmapSvc_h
-
-//STL includes
-#include <string>
-
-//Athena includes
-#include "AthenaBaseComps/AthService.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "StoreGate/ReadHandleKey.h"
-
-//Inner detector includes
-#include "InDetIdentifier/SCT_ID.h"
-#include "InDetRawData/SCT_RDO_Container.h"
-
-//local includes
-#include "SCT_CalibAlgs/ISCT_CalibHistoSvc.h"
-
-//fwd declarations
-template <class TYPE> class SvcFactory;
-class StatusCode;
-class ISvcLocator;
-
-class SCT_CalibHitmapSvc:virtual public ISCT_CalibHistoSvc, public AthService{
-  friend class SvcFactory<SCT_CalibHitmapSvc>;
-  
-public:
-  //@name Service methods, reimplemented
-  //@{
-  SCT_CalibHitmapSvc(const std::string &name, ISvcLocator * svc); 
-  virtual ~SCT_CalibHitmapSvc(){};
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-  //interfaceID() implementation is in the baseclass
-  virtual StatusCode queryInterface(const InterfaceID & riid, void** ppvInterface );
-  //@}
-  //@name ISCT_CalibHistoSvc methods, reimplemented
-  //@{
-  virtual bool book();
-  virtual bool read(const std::string & fileName);
-  virtual bool fill(const bool fromData=false);
-  virtual bool fillFromData();
-  //  virtual bool binHistograms(const int eventsPerWindow);
-  //@}
-private:
-  ServiceHandle<StoreGateSvc> m_detStore;
-  ServiceHandle<StoreGateSvc> m_evtStore;
- 
-  const SCT_ID* m_pSCTHelper;
-  SCT_ID::const_id_iterator m_waferItrBegin;
-  SCT_ID::const_id_iterator m_waferItrEnd;
-  typedef std::vector<int> VecInt;
-  VecInt *m_sct_waferHash;
-  VecInt *m_sct_firstStrip;
-  VecInt *m_sct_rdoGroupSize;
-  
-  SG::ReadHandleKey<SCT_RDO_Container> m_rdoContainerKey;
-
-};
-#endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.cxx
index a6675bc8f3dd22f2f651e326a5e34883534b6a3d..5b9d0c950f00d4ee7e2566f2498d6549b73ba1bd 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.cxx
@@ -87,7 +87,7 @@ SCT_CalibHitmapTool::book() {
    string histoName=pathRoot+"GENERAL/";
    //histogram for numbers of events
    m_numberOfEventsHisto=new TH1I("events","Events",1,0.5,1.5);
-   if( m_thisSvc->regHist( histoName.c_str(), m_numberOfEventsHisto ).isFailure() ) {
+   if( m_thistSvc->regHist( histoName.c_str(), m_numberOfEventsHisto ).isFailure() ) {
       msg( MSG::ERROR ) << "Error in booking EventNumber histogram" << endmsg;
    }
    //histograms for each wafer
@@ -105,7 +105,7 @@ SCT_CalibHitmapTool::book() {
       TH1F* hitmapHisto_tmp = new TH1F( TString( formattedPosition ), TString( histotitle ), nbins, firstStrip-0.5, lastStrip+0.5 );
 
       //cout<<name.c_str()<<endl;
-      if( m_thisSvc->regHist( name.c_str(), hitmapHisto_tmp ).isFailure()) {
+      if( m_thistSvc->regHist( name.c_str(), hitmapHisto_tmp ).isFailure()) {
          msg( MSG::ERROR ) << "Error in booking Hitmap histogram" << endmsg;
       } else {
          m_phistoVector.push_back( hitmapHisto_tmp );
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.h
index f41dd4c61d4d8098e4a5271a3427cb563d9014c8..594c6da54a5b92a5ab700c4488cd874fec2a3775 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.h
@@ -3,7 +3,7 @@
 */
 
 /**
- * @file SCT_CalibHitmapSvc.h
+ * @file SCT_CalibHitmapTool.h
  * Header file for the SCT_CalibHitmapTool class
  * @author Shaun Roe
 **/
@@ -28,6 +28,7 @@
 #include "SCT_CalibAlgs/ISCT_CalibHistoTool.h"
 
 //fwd declarations
+
 class StatusCode;
 
 //class SCT_CalibHitmapTool : virtual public ISCT_CalibHistoTool, public AthAlgTool
@@ -37,9 +38,8 @@ class SCT_CalibHitmapTool : public extends<AthAlgTool, ISCT_CalibHistoTool>
    public:
       //@name Tool methods, reimplemented
       //@{
-      SCT_CalibHitmapTool(const std::string& type, const std::string& name, const IInterface* parent);
-      //SCT_CalibHitmapTool(const std::string&);
-      virtual ~SCT_CalibHitmapTool(){};
+      SCT_CalibHitmapTool(const std::string&, const std::string&, const IInterface*);
+      virtual ~SCT_CalibHitmapTool() {};
       virtual StatusCode initialize();
       virtual StatusCode finalize();
       //interfaceID() implementation is in the baseclass
@@ -51,8 +51,9 @@ class SCT_CalibHitmapTool : public extends<AthAlgTool, ISCT_CalibHistoTool>
       virtual bool read(const std::string & fileName);
       virtual bool fill(const bool fromData=false);
       virtual bool fillFromData();
-      //  virtual bool binHistograms(const int eventsPerWindow);
+      //virtual bool binHistograms(const int eventsPerWindow);
       //@}
+
    private:
       ServiceHandle<StoreGateSvc> m_detStore;
       ServiceHandle<StoreGateSvc> m_evtStore;
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvSvc.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvSvc.cxx
deleted file mode 100644
index a9e715b34f387c27d6943fe294fb7e68e34c9215..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvSvc.cxx
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-/**
-* @file SCT_CalibHvSvc.cxx
-* Implementation file for the SCT_CalibHvSvc class
-* @author Shaun Roe
-**/
-
-#include "SCT_CalibHvSvc.h"
-#include "SCT_CalibUtilities.h"
-#include "SCT_CalibNumbers.h"
-
-
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
-
-using namespace std;
-using namespace SCT_CalibAlgs;
-
-//const static int n_chipsPerSide(6);
-//const static int n_stripsPerChip(128);
-const static string detectorNames[] = { "negativeEndcap", "barrel", "positiveEndcap" };
-
-
-const static string detectorPaths[]={"SCTEC/", "SCTB/","SCTEA/"};
-namespace{
-  void
-  initQueue(std::queue<int> & q, const int numvals, const int setval){
-    for (int i(0);i<numvals;++i) q.push(setval);
-  }
-
-}
-
-
-SCT_CalibHvSvc::SCT_CalibHvSvc(const std::string &name, ISvcLocator * svc):
-  AthService(name,svc),
-  m_detStore("DetectorStore", name),
-  m_evtStore("StoreGateSvc", name),
-  m_pSCTHelper(0),
-  m_sct_waferHash(0),  
-  m_sct_numHitsInWafer(0),
-  m_lumiBlock(0),
-  m_maxq(100),
-  m_phvtripPrevTime(0),
-  m_phvtripFirstTime(0),
-  m_absolutetriplimit(0),
-  m_relativetriplimit(0),
-  m_tq{0},
-  m_evt(0),
-  m_outputLowHits(false),m_lowHitCut(100)
-{
-}
-
-
-StatusCode 
-SCT_CalibHvSvc::initialize(){
-  ATH_CHECK(m_DCSConditionsTool.retrieve());
-  
-  return StatusCode::SUCCESS;
-
-}
-
-StatusCode 
-SCT_CalibHvSvc::finalize(){
-  return StatusCode::SUCCESS;
-}
-
-StatusCode 
-SCT_CalibHvSvc::queryInterface(const InterfaceID & riid, void** ppvInterface ){
-  if ( ISCT_CalibHistoSvc::interfaceID().versionMatch(riid) ) {
-    *ppvInterface = dynamic_cast<ISCT_CalibHistoSvc*>(this);
-  } else {
-    return AthService::queryInterface(riid, ppvInterface);
-  }
-  addRef();
-  return StatusCode::SUCCESS;
-}
-
-
-bool
-SCT_CalibHvSvc::book(){
-  bool result(true);
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Book HVTrips" <<endmsg;
-   //now initialize the queues (fill 100 spots with 0):
-  queue<int> qtemp;
-  initQueue(qtemp, m_maxq,0);
-   // need to keep previous bins lbn 4 deep. 
-  initQueue(m_prevLBN, 4, 0);
-  vector< pair <int,int> > dummy;      
-   //first set num events processed to 0
-  //int n_elements=8176;  //info taken from SCTCalib.h: SCT specific number 
-  m_phvtripProcessedEventsInt.insert(m_phvtripProcessedEventsInt.end(), n_elements, 1);
-  m_phvtripRunningTotalInt.insert(m_phvtripRunningTotalInt.end(), n_elements, 0);
-  m_phvtripHasItTripped.insert(m_phvtripHasItTripped.end(),n_elements, 0);
-  m_phvtripQueue.insert(m_phvtripQueue.end(), n_elements, qtemp);
-  m_summarytrips.insert(m_summarytrips.end(),n_elements, dummy);
-  m_summarytripslb.insert(m_summarytripslb.end(), n_elements, dummy);
-  m_phvtripHasItTripped_prev = m_phvtripHasItTripped;
-  return result;
-}
-
-bool 
-SCT_CalibHvSvc::fill(const bool fromData){
-  if (fromData){
-    return fillFromData(); 
-  }
-  bool result(true);
-  int lumi_block(0);//fix me!;
-  //int event_number;
-  const int wafersize = m_sct_waferHash->size();
-  int time_stamp= m_evt->event_ID()->time_stamp();
-  int curr_time =  time_stamp;
-  int dtime = curr_time - m_phvtripPrevTime;
-  int totalHits = 0;
-  if (curr_time<m_phvtripPrevTime){ 
-    msg(MSG::ERROR) << "Events not sorted properly (time is going backwards!) " << endmsg;
-    return false;
-  }
-  // for first event
-  if (m_phvtripFirstTime > curr_time){ m_phvtripFirstTime = curr_time; }
-  bool newbin = false;
-  // check if we have a new time bin, if we do pop off the back (oldest) part 
-  // of the queue and enqueue 0 for every wafer
-  int maxtbins(5);
-  if (dtime > maxtbins) {
-    newbin = true;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " new t bin " << dtime <<" since start "<< (curr_time-(m_phvtripFirstTime-1.01)) << endmsg;
-    m_phvtripHasItTripped_prev = m_phvtripHasItTripped;
-    for (int iwaf = 0; iwaf!=n_elements; ++iwaf){
-      m_phvtripQueue[iwaf].pop();
-      m_phvtripQueue[iwaf].push(0);
-      m_phvtripHasItTripped[iwaf]=0;
-    }
-  }
-    //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "time stamp "<<time_stamp <<" event number "<< Event_number<<endmsg;
-  // Loop over all hits in the event 
-  bool isgoodnow;
-  for( int itrk=0; itrk!=wafersize; ++itrk){
-    int waferhash = (*m_sct_waferHash)[itrk];
-    Identifier waferId = m_pSCTHelper->wafer_id(waferhash);
-    Identifier moduleId = m_pSCTHelper->module_id(waferId);
-    //step one is to make sure this one isn't already know to be messed up:
-    isgoodnow = m_DCSConditionsTool->isGood(moduleId,InDetConditions::SCT_MODULE);
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "checked is good "<< isgoodnow <<endmsg;
-    if (isgoodnow){
-      int numhits = (*m_sct_numHitsInWafer)[itrk];
-      totalHits += numhits;
-    /**
-    calculate the limit for an individual module, limit is m_relativetriplimit (default = 4) times the running average in that module. 
-    limits are given in hits/second. need to convert numhits in bin to average (within bin) hits/sec.
-    **/
-    double limit =  m_relativetriplimit * (double)m_phvtripRunningTotalInt[waferhash] / ((double)curr_time-((double)m_phvtripFirstTime-0.01));
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "waferhash "<<waferhash<<" itrk "<<itrk <<" run tot "<< m_phvtripRunningTotalInt[waferhash] 
-    <<" num hits "<<numhits<<" evnts processed "<<  m_phvtripProcessedEventsInt[waferhash] <<" limit "<<limit
-    <<" abs limit, rel limit "<<m_absolutetriplimit<<","<< m_relativetriplimit<<" max bins "<<maxtbins
-    <<endmsg;
-
-  if ( ((numhits + m_phvtripQueue[waferhash].back() )/ (double)maxtbins ) > m_absolutetriplimit 
-  and ((numhits + m_phvtripQueue[waferhash].back() )/ (double)maxtbins ) > limit) {
-        //read back queue and see if the high hit rate is persistant for 3 previous bins (a bin is 5 seconds by default)
-    for (int iq = 0; iq<m_maxq; ++iq){
-      m_tq[iq]=m_phvtripQueue[waferhash].front();
-      m_phvtripQueue[waferhash].pop();
-    }
-    if (m_tq[m_maxq-2]/(double)maxtbins > limit && m_tq[m_maxq-3]/(double)maxtbins > limit && m_tq[m_maxq-4]/(double)maxtbins > limit){
-        // found a persistent trip/thing
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found a potential trip in SCT wafer "<< waferhash<<endmsg;
-            //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRIP: "<< waferhash<<" "<<time_stamp <<" "<< Event_number <<" "<< (numhits + m_tq[m_maxq-1] ) <<endmsg;
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRIP more info: limit = "<< limit <<" abslimit = "<<  m_absolutetriplimit 
-        <<" hits/secs now = "<< ((numhits + m_tq[m_maxq-1])/ maxtbins ) 
-        <<" running total = "<< m_phvtripRunningTotalInt[waferhash]
-        <<" running average =  "<<  m_phvtripRunningTotalInt[waferhash] / (curr_time-(m_phvtripFirstTime-1.01)) << endmsg;
-      m_phvtripHasItTripped[waferhash] =  (numhits + m_tq[m_maxq-1] );
-    } // end trip found
-
-        //put queue back the way we found it:
-    for (int iq = 0; iq < m_maxq; ++iq) {
-      m_phvtripQueue[waferhash].push(m_tq[iq]);
-    }
-  } // end potential trip id
-      //incriment event counter
-  m_phvtripProcessedEventsInt[waferhash] += 1;
-      //recalcuate running total:
-  m_phvtripRunningTotalInt[waferhash] += numhits;
-  m_phvtripQueue[waferhash].back() += numhits;
-} //end is good check   
-else { 
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Was a bad module already: "<< waferhash <<endmsg; 
-}
-} //end loop over tracks
-
-// text output, summarizing the event
-//if new bin summarzie the previous event. 
-if (newbin) { 
-  SCT_ID::const_id_iterator waferItr  = m_waferItrBegin;
-  SCT_ID::const_id_iterator waferItrE = m_waferItrEnd;
-  for( ; waferItr not_eq waferItrE; ++waferItr ) {
-    Identifier       waferId   = *waferItr;
-    IdentifierHash   waferHash = m_pSCTHelper->wafer_hash( waferId );
-    if (m_phvtripHasItTripped_prev[waferHash]>0) {
-      pair<int,int> wp;
-      wp.first = (m_phvtripPrevTime - 3*maxtbins);
-      wp.second = (m_phvtripPrevTime + maxtbins);
-      m_summarytrips[waferHash].push_back(wp);
-      pair<int,int> lbn;
-      lbn.first = m_prevLBN.front();
-      lbn.second = m_prevLBN.back();
-      m_summarytripslb[waferHash].push_back(lbn);
-    }
-  }
-  m_phvtripPrevTime = curr_time; //reset prev and current time
-  m_prevLBN.pop();
-  m_prevLBN.push(lumi_block);
-}
-
-for (int iwaf(0); iwaf!=n_elements; ++iwaf){
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "mod "<< iwaf <<" events with that waf " <<m_phvtripProcessedEventsInt[iwaf] << " numhits "<<m_phvtripRunningTotalInt[iwaf] <<endmsg;
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "did it trip "<<m_phvtripHasItTripped[iwaf] << endmsg;
-  if (m_phvtripHasItTripped[iwaf]) {
-        //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRIP: "<< iwaf <<" "<<time_stamp <<" "<< Event_number <<" "<<  m_phvtripQueue[iwaf].back() <<endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRIP more info: abslimit = "<<  m_absolutetriplimit 
-      <<" hits/secs now = "<< ( m_phvtripQueue[iwaf].back() / maxtbins ) 
-      <<" running total = "<< m_phvtripRunningTotalInt[iwaf]
-      <<" running average =  "<<  m_phvtripRunningTotalInt[iwaf] / (curr_time-(m_phvtripFirstTime-1.01)) << endmsg;
-  }
-}
-if (m_outputLowHits && (totalHits < m_lowHitCut) ){
-  //msg(MSG::WARNING) <<"Event: " << Event_number << " Total hits: " << totalHits << endmsg;
-}
-return result;
-}
-
-
-bool 
-SCT_CalibHvSvc::fillFromData(){
-  bool result(true);
-
-
-  return result;
-}
-
-
-
-
-
-
-
-
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvSvc.h
deleted file mode 100644
index 0b74cb2c9d4214f08275cc8039ad659ac7b52942..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvSvc.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file SCT_CalibHvSvc.h
- * Header file for the SCT_CalibHvSvc class
- * @author Shaun Roe
-**/
-
-#ifndef SCT_CalibHvSvc_h
-#define SCT_CalibHvSvc_h
-
-//STL includes
-#include <string>
-#include <vector>
-#include <queue>
-#include <utility> //for 'pair'
-
-//Athena includes
-#include "AthenaBaseComps/AthService.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
-
-//Inner detector includes
-#include "InDetIdentifier/SCT_ID.h"
-
-//local includes
-#include "SCT_CalibAlgs/ISCT_CalibHistoSvc.h"
-#include "SCT_ConditionsTools/ISCT_DCSConditionsTool.h" //template parameter
-
-//fwd declarations
-template <class TYPE> class SvcFactory;
-class StatusCode;
-class ISvcLocator;
-class IdentifierHash;
-class EventInfo;
-
-class SCT_CalibHvSvc:virtual public ISCT_CalibHistoSvc, public AthService{
-  friend class SvcFactory<SCT_CalibHvSvc>;
-  
-public:
-  //@name Service methods, reimplemented
-  //@{
-  SCT_CalibHvSvc(const std::string &name, ISvcLocator * svc); 
-  virtual ~SCT_CalibHvSvc(){};
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-  //interfaceID() implementation is in the baseclass
-  virtual StatusCode queryInterface(const InterfaceID & riid, void** ppvInterface );
-  //@}
-  //@name ISCT_CalibHistoSvc methods, reimplemented
-  //@{
-  virtual bool book();
-  virtual bool fill(const bool fromData=false);
-  virtual bool fillFromData();
-  //@}
-private:
-  enum { n_chipPerSide = 6, n_chipPerModule = 12, n_stripPerChip = 128, n_etaInBarrel = 12,
-         n_phiBinsB0 = 32, n_phiBinsB1 = 40, n_phiBinsB2 = 48, n_phiBinsB3 = 56,
-         n_phiBinsECShort = 40, n_phiBinsECMiddle = 40, n_phiBinsECOuter = 52, n_elements=8176,
-         n_BSErrorType = 15, firstBSErrorType = 0, lastBSErrorType = 14 };
-         
-  ServiceHandle<StoreGateSvc> m_detStore;
-  ServiceHandle<StoreGateSvc> m_evtStore;
-  ToolHandle<ISCT_DCSConditionsTool> m_DCSConditionsTool{this, "SCT_DCSConditionsTool", "SCT_DCSConditionsTool", "Tool to retrieve SCT DCS information"};
-  
-  const SCT_ID* m_pSCTHelper;
-  SCT_ID::const_id_iterator m_waferItrBegin;
-  SCT_ID::const_id_iterator m_waferItrEnd;
-  typedef std::vector<int> VecInt;
-  VecInt *m_sct_waferHash;
-  VecInt *m_sct_numHitsInWafer;
-  mutable int m_lumiBlock;
-  
-  //private use in this class
-  int m_maxq;
-  // For HV trips
-  std::vector< std::queue<int> > m_phvtripQueue;
-  std::queue<int> m_prevLBN;
-  VecInt m_phvtripRunningTotalInt;
-  VecInt m_phvtripProcessedEventsInt;
-  VecInt m_phvtripHasItTripped;
-  VecInt m_phvtripHasItTripped_prev;
-  //
-  int m_phvtripPrevTime;
-  int m_phvtripFirstTime;
-  double          m_absolutetriplimit;
-  double          m_relativetriplimit;
-   int m_tq[100];
-
-  std::vector< std::vector< std::pair<int, int> > > m_summarytrips;
-  std::vector< std::vector< std::pair<int, int> > > m_summarytripslb;
-  const EventInfo* m_evt;
-  bool m_outputLowHits;
-  int m_lowHitCut;
- ///retrieve a service and report if it failed
- template<class S>
- bool retrievedService(S & service, const std::string & serviceName){
-   if (service.retrieve().isFailure() ) return msg(MSG::ERROR)<<"Unable to retrieve "<<serviceName<<endmsg, false;
-   return true;
- }
-
-};
-#endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.h
index 43420de499781b34f063432f2e46ccdc14a1ab49..7970874fd2e0dd8b3917e2b0540344a58e810200 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.h
@@ -36,13 +36,13 @@ class ISvcLocator;
 class IdentifierHash;
 class EventInfo;
 
-class SCT_CalibHvTool : : public extends<AthAlgTool, ISCT_CalibHistoTool>
+class SCT_CalibHvTool : public extends<AthAlgTool, ISCT_CalibHistoTool>
 {
 
    public:
       //@name Tool methods, reimplemented
       //@{
-      SCT_CalibHvTool(const std::string& type, const std::string& name, const IInterface* parent);
+      SCT_CalibHvTool(const std::string&, const std::string&, const IInterface*);
       virtual ~SCT_CalibHvTool() {};
       virtual StatusCode initialize();
       virtual StatusCode finalize();
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbSvc.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbSvc.cxx
deleted file mode 100644
index e549ccc45ad46ea154d3d75bf6eb6aa9a186620e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbSvc.cxx
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-/**
- * @file SCT_CalibLbSvc.cxx
- * Implementation file for the SCT_CalibLbSvc class
- * @author Shaun Roe
-**/
-
-#include "SCT_CalibLbSvc.h"
-#include "SCT_CalibUtilities.h"
-#include "SCT_CalibNumbers.h"
-#include "SCT_CalibEventInfo.h"
-
-//InnerDetector
-#include "InDetReadoutGeometry/SiDetectorElement.h"
-#include "InDetReadoutGeometry/SCT_DetectorManager.h"
-
-#include "InDetRawData/SCT3_RawData.h"
-#include "InDetRawData/InDetRawDataCLASS_DEF.h"
-
-#include "StoreGate/ReadHandle.h"
-
-#include "Identifier/Identifier.h"
-#include "Identifier/IdentifierHash.h"
-#include "GaudiKernel/ITHistSvc.h"
-
-#include <boost/lexical_cast.hpp>
-
-#include "TH1I.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TFile.h"
-#include "TMath.h"
-
-using namespace std;
-using namespace SCT_CalibAlgs;
-
-const static string pathRoot("/LB/");
-const static int n_chipsPerSide(6);
-const static int n_stripsPerChip(128);
-const static string detectorNames[] = { "negativeEndcap", "barrel", "positiveEndcap" };
-const static string detectorPaths[]={"SCTEC/", "SCTB/","SCTEA/"};
-
-
-
-SCT_CalibLbSvc::SCT_CalibLbSvc(const std::string &name, ISvcLocator * svc):AthService(name,svc),
-m_detStore("DetectorStore", name),
-m_evtStore("StoreGateSvc", name),
-m_evtInfo("SCT_CalibEventInfo",name),
-m_pSCTHelper(0),
-m_pManager(0),
-m_sct_waferHash(0),
-m_sct_firstStrip(0),
-m_sct_rdoGroupSize(0),
-m_lumiBlock(0),
-m_LbRange(0),
-m_LbsToMerge(0),
-m_rdoContainerKey(std::string("SCT_RDOs")) {
-  //nop
-}
-
-StatusCode 
-SCT_CalibLbSvc::initialize(){
-  msg( MSG::INFO)<<"Initialize of "<<PACKAGE_VERSION<<endmsg;
-  if ( service( "THistSvc", m_thistSvc ).isFailure() ) return msg( MSG::ERROR) << "Unable to retrieve pointer to THistSvc" << endmsg, StatusCode::FAILURE;
-  if ( m_detStore->retrieve( m_pSCTHelper, "SCT_ID").isFailure()) return msg( MSG::ERROR) << "Unable to retrieve SCTHelper" << endmsg, StatusCode::FAILURE;
-  if ( m_detStore->retrieve( m_pManager, "SCT").isFailure() ) return msg( MSG::ERROR) << "Unable to retrieve SCTManager" << endmsg,StatusCode::FAILURE;
-  std::pair<std::string, bool> msgCode=retrievedService(m_evtInfo);
-  if (not msgCode.second) return msg( MSG::ERROR) <<msgCode.first<< endmsg,StatusCode::FAILURE;
-  //
-  m_waferItrBegin  = m_pSCTHelper->wafer_begin();
-  m_waferItrEnd  = m_pSCTHelper->wafer_end();
-  
-  m_LbRange=numberOfLb();
-
-  // Read Handle Key
-  ATH_CHECK( m_rdoContainerKey.initialize() );
-
-  return StatusCode::SUCCESS;
-  
-}
-
-
-StatusCode 
-SCT_CalibLbSvc::finalize(){
-  msg( MSG::INFO)<<"Finalize of "<<PACKAGE_VERSION<<endmsg;
-  return StatusCode::SUCCESS;
-}
-
-StatusCode 
-SCT_CalibLbSvc::queryInterface(const InterfaceID & riid, void** ppvInterface ){
-  if ( ISCT_CalibHistoSvc::interfaceID().versionMatch(riid) ) {
-   *ppvInterface = dynamic_cast<ISCT_CalibHistoSvc*>(this);
-  } else {
-   return AthService::queryInterface(riid, ppvInterface);
-  }
-  addRef();
-  return StatusCode::SUCCESS;
-}
-
-bool
-SCT_CalibLbSvc::book(){
-  msg( MSG::INFO)<<"book() method of "<<PACKAGE_VERSION<<endmsg;
-  bool result(true);
-  //pointers to the histos are deleted by m_thistSvc methods
-  m_phistoVector.clear();
-  m_phistoVector2D.clear();
-  string histoName=pathRoot+"GENERAL/";
-  m_LbRange=numberOfLb();
-  m_numberOfEventsHisto=new TH1I("events","Events",m_LbRange,0.5,m_LbRange+0.5);
-
-  m_LbsToMerge = LbToMerge();
-  int yAxisBins = TMath::Ceil(1.0*m_LbRange/m_LbsToMerge);
-
-
-  if( m_thistSvc->regHist( histoName.c_str(), m_numberOfEventsHisto ).isFailure() ) {
-    msg( MSG::ERROR ) << "Error in booking EventNumber histogram" << endmsg;
-  }
-  //histograms for each wafer
-  SCT_ID::const_id_iterator waferItr  = m_waferItrBegin;
-  ////
-  std::string hitmapPaths[3];
-  for (int i(0);i<3;++i){
-    hitmapPaths[i]=pathRoot+detectorPaths[i]; 
-  }
-  ////
-  for(; waferItr !=m_waferItrEnd;++waferItr){
-    const  Identifier &waferId=*waferItr;
-    const int bec(m_pSCTHelper->barrel_ec(waferId));
-    const string formattedPosition=formatPosition(waferId, m_pSCTHelper)+"_";
-    ////
-    std::string histotitle = string( "SCT " ) + detectorNames[ bec2Index(bec) ] + string( " Hitmap: plane " ) + formattedPosition;
-    std::string formattedPosition2D = formattedPosition+"_2D";
-    std::string name2D=hitmapPaths[bec2Index(m_pSCTHelper->barrel_ec( waferId ))] + formattedPosition + "_2D";
-    //    TH2F* hitmapHistoLB_tmp2D = new TH2F( TString( formattedPosition2D ), TString( histotitle ), nbins, firstStrip-0.5, lastStrip+0.5 ,1,0,0);
-    TH2F* hitmapHistoLB_tmp2D = new TH2F( TString( formattedPosition2D ), TString( histotitle ), nbins, firstStrip-0.5, lastStrip+0.5 ,yAxisBins,0.5,m_LbsToMerge*yAxisBins+0.5);
-    //    hitmapHistoLB_tmp2D->GetYaxis()->SetCanExtend(kTRUE);
-    //    TH2F* hitmapHistoLB_tmp2D = new TH2F( TString( formattedPosition2D ), TString( histotitle ), nbins, firstStrip-0.5, lastStrip+0.5 ,m_LbRange,0.5,m_LbRange+0.5);
-    if(m_thistSvc->regHist( name2D.c_str(), hitmapHistoLB_tmp2D ).isFailure() ) {
-      msg( MSG::ERROR ) << "Error in booking 2D Hitmap histogram" << endmsg;
-    } else {
-      //      m_phistoVector.push_back( hitmapHisto_tmp );
-      m_phistoVector2D.push_back( hitmapHistoLB_tmp2D );
-    }
-    ////
-    for (int iChip(0);iChip!=n_chipsPerSide;++iChip){
-      int chipId= m_pSCTHelper->side(waferId)==0 ? iChip:iChip+n_chipsPerSide;
-      const string formattedChipPosition = formattedPosition + boost::lexical_cast<string>(chipId);
-      const string hname= pathRoot+detectorPaths[bec2Index(bec)]+"/"+formattedChipPosition;
-      const string histTitle = string("SCT")+detectorNames[bec2Index(bec)]+string(" LB: chip ")+formattedChipPosition;
-      TH1F* hist_tmp = new TH1F(TString(formattedChipPosition), TString(histTitle), m_LbRange, 0.5, m_LbRange+0.5);
-      if(m_thistSvc->regHist(hname.c_str(), hist_tmp).isFailure() ) msg(MSG::ERROR)<<"Error in booking LB histogram"<<endl;
-      m_phistoVector.push_back(hist_tmp);
-    }
-  }
-  return result;
-}
-
-bool 
-SCT_CalibLbSvc::read(const std::string & fileName){
-  msg( MSG::INFO)<<"read() method of "<<PACKAGE_VERSION<<endmsg;
-  bool result(true);
-   m_LbRange=numberOfLb();
-  //pointers to the histos are deleted by m_thistSvc methods
-  m_phistoVector.clear();
-  m_phistoVector2D.clear();
-  TFile *fileLB = TFile::Open( fileName.c_str() );
-  msg( MSG::INFO ) << "opening LB file : " << fileName.c_str() << endmsg;
-
-  if(fileLB){
-    m_numberOfEventsHisto= (TH1I*) fileLB->Get("GENERAL/events");
-  } else {
-    msg( MSG::ERROR ) << "can not open LB file : " << fileName.c_str() << endmsg;
-    return result;
-  }
-
-  if( m_numberOfEventsHisto==NULL ) {
-    msg( MSG::ERROR ) << "Error in reading EventNumber histogram" << endmsg;
-  }
-  //std::cout<<"new of m_numberOfEventsHisto, value = "<<m_numberOfEventsHisto<<std::endl;
-  //histograms for each wafer
-  SCT_ID::const_id_iterator waferItr  = m_waferItrBegin;
-  for(; waferItr !=m_waferItrEnd;++waferItr){
-    const  Identifier &waferId=*waferItr;
-    const int bec(m_pSCTHelper->barrel_ec(waferId));
-    const string formattedPosition=formatPosition(waferId, m_pSCTHelper)+"_";
-    ////
-    std::string name2D=detectorPaths[bec2Index(m_pSCTHelper->barrel_ec( waferId ))] + formattedPosition + "_2D";
-    TH2F* hitmapHistoLB_tmp2D = (TH2F*) fileLB->Get(name2D.c_str());
-    //    hitmapHistoLB_tmp2D->GetYaxis()->SetCanExtend(kTRUE);
-
-    if( hitmapHistoLB_tmp2D==NULL ) {
-      msg( MSG::ERROR ) << "Error in reading Hitmap histogram" << endmsg;
-    } else {
-      m_phistoVector2D.push_back( hitmapHistoLB_tmp2D );
-    }
-    ////
-    for (int iChip(0);iChip!=n_chipsPerSide;++iChip){
-      int chipId= m_pSCTHelper->side(waferId)==0 ? iChip : iChip+n_chipsPerSide;
-      const string hname= detectorPaths[bec2Index(bec)]+"/"+formattedPosition + boost::lexical_cast<string>(chipId);
-      TH1F* hist_tmp = (TH1F*) fileLB->Get(hname.c_str());
-      if( hist_tmp==NULL ) {
-        msg( MSG::ERROR ) << "Error in reading LB histogram" << endmsg;
-      } else {
-        m_phistoVector.push_back(hist_tmp);
-      }
-    }
-  }
-  return result;
-}
-
-bool 
-SCT_CalibLbSvc::fill(const bool fromData){
-  if (fromData){
-    return fillFromData(); 
-  }
-  m_numberOfEventsHisto->Fill(m_lumiBlock);
-  bool result(true);
-  int maxEntry = m_sct_waferHash->size();
-   for( int i = 0; i != maxEntry; ++i ) {
-     int theFirstStrip = (*m_sct_firstStrip)[i];
-     //
-     int endStrip      = (*m_sct_rdoGroupSize)[i] + theFirstStrip;
-     int index         = (*m_sct_waferHash)[i];
-     TH2F * pThisHisto2D=m_phistoVector2D[ index ];
-     //     pThisHisto2D->GetYaxis()->SetCanExtend(kTRUE);
-
-     for( int strip(theFirstStrip); strip !=endStrip; ++strip) {
-       pThisHisto2D->Fill( strip, m_lumiBlock);
-     }
-     //
-     int rdoGroupSize  = (*m_sct_rdoGroupSize)[i];
-     IdentifierHash waferHash = (*m_sct_waferHash)[i];
-     fillLbForWafer(waferHash, theFirstStrip, rdoGroupSize);
-   }
-  
-  return result;
-}
-
-bool 
-SCT_CalibLbSvc::fillFromData(){
-  if (not m_evtInfo) return msg( MSG::ERROR ) << "The evtInfo pointer is NULL" << endmsg, false;
-  m_lumiBlock=m_evtInfo->lumiBlock();
-  m_numberOfEventsHisto->Fill(m_lumiBlock);
-  bool result(true);
-   //--- Retrieve the RDO container
-  typedef SCT_RDORawData SCTRawDataType;
-  SG::ReadHandle<SCT_RDO_Container> p_rdoContainer(m_rdoContainerKey);
-  if ( not p_rdoContainer.isValid() ) {
-   msg( MSG::ERROR ) << "Failed to retrieve SCT RDO container" << endmsg;
-  }
- 
-  SCT_RDO_Container::const_iterator itr  = p_rdoContainer->begin();
-  SCT_RDO_Container::const_iterator itrE = p_rdoContainer->end();
-  for( ; itr != itrE; ++itr ) {
-    const InDetRawDataCollection<SCTRawDataType>* SCT_Collection( *itr );
-    if ( !SCT_Collection ) continue;// select only SCT RDOs
-    Identifier     waferId   = SCT_Collection->identify();
-    IdentifierHash waferHash = m_pSCTHelper->wafer_hash( waferId );
-    ////
-    TH2F * pThisHisto2D =m_phistoVector2D[(int)waferHash];
-    ////
-    DataVector<SCTRawDataType>::const_iterator rdoItr  = SCT_Collection->begin();
-    DataVector<SCTRawDataType>::const_iterator rdoItrE = SCT_Collection->end();
-    for( ; rdoItr != rdoItrE; ++rdoItr ) {
-      int theFirstStrip = m_pSCTHelper->strip((*rdoItr)->identify());
-      ////
-      int strip=m_pSCTHelper->strip((*rdoItr)->identify());
-      const int endStrip=(*rdoItr)->getGroupSize() + strip;
-      for (;strip != endStrip;++strip){
-	pThisHisto2D->Fill( strip, m_lumiBlock);
-      }
-      ////
-      int rdoGroupSize  = (*rdoItr)->getGroupSize();
-      fillLbForWafer(waferHash, theFirstStrip, rdoGroupSize);
-    }
-  }
-  
-  return result;
-}
-
-void
-SCT_CalibLbSvc::fillLbForWafer(const IdentifierHash &waferHash, const int theFirstStrip, const int groupSize ){
-  const InDetDD::SiDetectorElement* pElement = m_pManager->getDetectorElement( waferHash );
-
-  if ( pElement) {
-    int stripNumber = ( pElement->swapPhiReadoutDirection() ) ? lastStrip - theFirstStrip : theFirstStrip;
-    int index = ((int)waferHash)*n_chipsPerSide + stripNumber/n_stripsPerChip;
-    //--- Fill LB histograms
-    for( int j = 0; j != groupSize; ++j ) {
-      m_phistoVector[ index ]->Fill( m_lumiBlock );
-    }
-    
-  } else {
-    msg( MSG::FATAL ) << "Element pointer is NULL" << endmsg;
-  }
-  
-}
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbSvc.h
deleted file mode 100644
index ae62bde8cc7443c0b6a2c3bb4a918b22c7166f91..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbSvc.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file SCT_CalibLbSvc.h
- * Header file for the SCT_CalibLbSvc class
- * @author Shaun Roe
-**/
-
-#ifndef SCT_CalibLbSvc_h
-#define SCT_CalibLbSvc_h
-
-//STL includes
-#include <string>
-
-//Athena includes
-#include "AthenaBaseComps/AthService.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "SCT_CalibAlgs/ISCT_CalibEvtInfo.h"
-#include "InDetRawData/SCT_RDO_Container.h"
-
-//Inner detector includes
-#include "InDetIdentifier/SCT_ID.h"
-
-//local includes
-#include "SCT_CalibAlgs/ISCT_CalibHistoSvc.h"
-
-//fwd declarations
-template <class TYPE> class SvcFactory;
-namespace InDetDD{
-  class  SCT_DetectorManager;
-}
-class StatusCode;
-class ISvcLocator;
-class IdentifierHash;
-
-class SCT_CalibLbSvc: virtual public ISCT_CalibHistoSvc, public AthService{
-  friend class SvcFactory<SCT_CalibLbSvc>;
-  
-public:
-  //@name Service methods, reimplemented
-  //@{
-  SCT_CalibLbSvc(const std::string &name, ISvcLocator * svc); 
-  virtual ~SCT_CalibLbSvc(){}
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-  //interfaceID() implementation is in the baseclass
-  virtual StatusCode queryInterface(const InterfaceID & riid, void** ppvInterface );
-  //@}
-  //@name ISCT_CalibHistoSvc methods, reimplemented
-  //@{
-  virtual bool book();
-  virtual bool fill(const bool fromData=false);
-  virtual bool read(const std::string & fileName);
-  virtual bool fillFromData();
-  //@}
-private:
-  ServiceHandle<StoreGateSvc> m_detStore;
-  ServiceHandle<StoreGateSvc> m_evtStore;
-  ServiceHandle<ISCT_CalibEvtInfo> m_evtInfo;
-    
-  const SCT_ID* m_pSCTHelper;
-  const InDetDD::SCT_DetectorManager* m_pManager;
-  SCT_ID::const_id_iterator m_waferItrBegin;
-  SCT_ID::const_id_iterator m_waferItrEnd;
-  typedef std::vector<int> VecInt;
-  VecInt *m_sct_waferHash;
-  VecInt *m_sct_firstStrip;
-  VecInt *m_sct_rdoGroupSize;
-  
-  mutable int m_lumiBlock;
-  
-  //private use in this class
-  int                m_LbRange;
-  int                m_LbsToMerge;
-
-  SG::ReadHandleKey<SCT_RDO_Container> m_rdoContainerKey;
-  
-  void
-  fillLbForWafer(const IdentifierHash &waferHash, const int theFirstStrip, const int groupSize );
- 
-};
-#endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbTool.h
index 9bf64c81aedcbda99f33c819407e01324064b561..956d7a3b3d26bae20c6324a0b4503dcc3dfb3646 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbTool.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbTool.h
@@ -43,7 +43,7 @@ class SCT_CalibLbTool : public extends<AthAlgTool, ISCT_CalibHistoTool>
    public:
       //@name Tool methods, reimplemented
       //@{
-      SCT_CalibLbTool(const std::string& type, const std::string& name, const IInterface* parent);
+      SCT_CalibLbTool(const std::string&, const std::string&, const IInterface*);
       virtual ~SCT_CalibLbTool() {};
       virtual StatusCode initialize();
       virtual StatusCode finalize();
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListSvc.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListSvc.cxx
deleted file mode 100644
index 78db75b9d06e12e2b0cb25556a8883e082ec3c7e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListSvc.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "SCT_CalibModuleListSvc.h"
-
-SCT_CalibModuleListSvc::SCT_CalibModuleListSvc(const std::string& name, ISvcLocator* pSvcLocator ) :
-    AthService(name, pSvcLocator),
-    m_pSCTHelper(0),
-    m_detStore("DetectorStore", name),
-    m_IOVDbSvc( "IOVDbSvc", name ){
-
-}
-    
-SCT_CalibModuleListSvc::~SCT_CalibModuleListSvc(){
-  //nop
-}
-   
-   
-StatusCode SCT_CalibModuleListSvc::initialize(){
-  if (msgLvl(MSG::DEBUG)) msg(MSG:: DEBUG) << "Initializing SCT_CalibModuleListSvc "  << endmsg;
-  
-  StatusCode sc = m_detStore->retrieve( m_pSCTHelper, "SCT_ID" );
-   if ( sc.isFailure() ) {
-     msg( MSG::ERROR ) << "Unable to retrieve SCTHelper" << endmsg;
-     return sc;
-   }
-
-  sc = m_MonitorConditionsTool.retrieve();
-  if ( sc.isFailure() ) {
-    msg( MSG::ERROR ) << "Unable to retrieve MonitorConditionsSvc" << endmsg;
-    return sc;
-  }
-  
-  sc = m_IOVDbSvc.retrieve();
-   if ( sc.isFailure() ) {
-     msg( MSG::ERROR ) << "Unable to retrieve IOVDbSvc" << endmsg;
-     return sc;
-   }
-  
-  return StatusCode::SUCCESS;
-    
-}
-
-StatusCode SCT_CalibModuleListSvc::finalize(){
-  return StatusCode::SUCCESS;
-}
-
-StatusCode 
-SCT_CalibModuleListSvc::queryInterface(const InterfaceID & riid, void** ppvInterface ){
-  if ( ISCT_CalibModuleListSvc::interfaceID().versionMatch(riid) ) {
-   *ppvInterface = dynamic_cast<ISCT_CalibModuleListSvc*>(this);
-  } else {
-   return AthService::queryInterface(riid, ppvInterface);
-  }
-  addRef();
-  return StatusCode::SUCCESS;
-}
-
-StatusCode SCT_CalibModuleListSvc::readModuleList( std::map< Identifier, std::set<Identifier> >& moduleList ) {
-  //--- Read strips using SCT_MonitorConditionsSvc
-  SCT_ID::const_id_iterator waferIdItr  = m_pSCTHelper->wafer_begin();
-  SCT_ID::const_id_iterator waferIdItrE = m_pSCTHelper->wafer_end();
-  for( ; waferIdItr != waferIdItrE; ++waferIdItr ) {
-    if ( m_pSCTHelper->side( *waferIdItr ) != 0 ) continue;
-    Identifier waferId  = *waferIdItr;
-    Identifier moduleId = m_pSCTHelper->module_id( waferId );
-
-    std::set<Identifier> stripIdList;
-    m_MonitorConditionsTool->badStrips( moduleId, stripIdList );
-    if ( !stripIdList.empty() ) moduleList.insert( std::map< Identifier, std::set<Identifier> >::value_type( moduleId, stripIdList ) );
-  }
-
-  //--- Drop the folder to avoid conflict with SCTCalibWriteSvc
-  if ( !( m_IOVDbSvc->dropObject( "/SCT/Derived/Monitoring", true ) ) ) msg( MSG::ERROR ) << "Unable to drop /SCT/Derived/Monitoring" << endmsg;
-
-  return StatusCode::SUCCESS;
-}
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListSvc.h
deleted file mode 100644
index 0ff8e6108c2a1436dc1e9f2c7951360b7a7cbca1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListSvc.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
-* @file SCT_CalibModuleListSvc.h
-* Header file for the SCT_CalibModuleListSvc class
-* @author Shaun Roe
-**/
-
-#ifndef SCT_CalibModuleListSvc_h
-#define SCT_CalibModuleListSvc_h
-
-// STL and boost headers
-#include <string>
-#include <vector>
-#include <set>
-#include <map>
-
-#include "GaudiKernel/IInterface.h"
-#include "AthenaBaseComps/AthService.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "AthenaKernel/IIOVDbSvc.h"
-
-#include "GaudiKernel/ServiceHandle.h"
-#include "SCT_CalibAlgs/ISCT_CalibModuleListSvc.h"       
-#include "SCT_ConditionsTools/ISCT_MonitorConditionsTool.h"
-
-#include "Identifier/Identifier.h"
-#include "InDetIdentifier/SCT_ID.h"
-
-
-//fwd declarations
-template <class TYPE> class SvcFactory;
-
-
-class SCT_CalibModuleListSvc:virtual public ISCT_CalibModuleListSvc, public AthService{
-  friend class SvcFactory<SCT_CalibModuleListSvc>;
-public:
-  //@name Service methods, reimplemented
-   //@{
-  SCT_CalibModuleListSvc(const std::string &name, ISvcLocator * svc); 
-  virtual ~SCT_CalibModuleListSvc();
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-  virtual StatusCode queryInterface(const InterfaceID & riid, void** ppvInterface );
-   //@}
-  virtual StatusCode readModuleList( std::map< Identifier, std::set<Identifier> >& moduleList );
-   
-private:
-  const SCT_ID* m_pSCTHelper;
-  ServiceHandle<StoreGateSvc> m_detStore;
-  ToolHandle<ISCT_MonitorConditionsTool> m_MonitorConditionsTool{this, "SCT_MonitorConditionsTool", "SCT_MonitorConditionsTool/InDetSCT_MonitorConditionsTool", "Tool to retrieve noisy strip information"};
-  ServiceHandle<IIOVDbSvc> m_IOVDbSvc;
-  
-};
-#endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListTool.h
index b6a1d47f124471bfb5b7b7ae0402b84e2d7ab689..ada9c098f82e27d7caf6c5d836e32902e356b05d 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListTool.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibModuleListTool.h
@@ -40,7 +40,7 @@ class SCT_CalibModuleListTool : public extends<AthAlgTool, ISCT_CalibModuleListT
    public:
       //@name Tool methods, reimplemented
       //@{
-      SCT_CalibModuleListTool(const std::string& type, const std::string& name, const IInterface* parent);
+      SCT_CalibModuleListTool(const std::string&, const std::string&, const IInterface*);
       virtual ~SCT_CalibModuleListTool() {};
       virtual StatusCode initialize();
       virtual StatusCode finalize();
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibNumbers.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibNumbers.h
index 2f04d5a4408ac4d743c85fb17e4a850f66cd31ec..5a5dd67d19f76c35323a0f7171095916a96561b0 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibNumbers.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibNumbers.h
@@ -4,17 +4,19 @@
 
 #ifndef SCT_CalibNumbers_h
 #define SCT_CalibNumbers_h
-namespace SCT_CalibAlgs{
+namespace SCT_CalibAlgs {
+
 // SCT specific numbers
- enum { nbins       = 6*128, firstStrip     =  0, lastStrip     = nbins-1,
-        ntimeBins   =     3, firstTimeBin   =  0, lastTimeBin   =  2,
-        n_hitBins   =    50, first_hitBin   =  0, last_hitBin   = 50,
-        n_etaBins   =    13, first_etaBin   = -6, last_etaBin   =  6,
-        n_phiBins   =    56, first_phiBin   =  0, last_phiBin   = 55,
-        n_barrels   =     4, first_barrel   =  0, last_barrel   =  3,
-        n_disks     =     9, first_disk     =  0, last_disk     =  8,
-        n_etaBinsEC =     3, first_etaBinEC =  0, last_etaBinEC =  2,
-        n_phiBinsEC =    52, first_phiBinEC =  0, last_phiBinEC = 51 };
-      }
-      
-#endif
\ No newline at end of file
+enum { nbins       = 6*128, firstStrip     =  0, lastStrip     = nbins-1,
+       ntimeBins   =     3, firstTimeBin   =  0, lastTimeBin   =  2,
+       n_hitBins   =    50, first_hitBin   =  0, last_hitBin   = 50,
+       n_etaBins   =    13, first_etaBin   = -6, last_etaBin   =  6,
+       n_phiBins   =    56, first_phiBin   =  0, last_phiBin   = 55,
+       n_barrels   =     4, first_barrel   =  0, last_barrel   =  3,
+       n_disks     =     9, first_disk     =  0, last_disk     =  8,
+       n_etaBinsEC =     3, first_etaBinEC =  0, last_etaBinEC =  2,
+       n_phiBinsEC =    52, first_phiBinEC =  0, last_phiBinEC = 51
+     };
+}
+
+#endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.cxx
index b1a17438a96d098e1c333b80ef64d44e0a6b9d47..291051f1bab04caddc8d20a737815ca4cb1e27c6 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.cxx
@@ -8,70 +8,65 @@
  *
  * @author Shaun Roe shaun.roe@cern.ch
  **/
- 
- 
- #include "SCT_CalibUtilities.h"
- 
- //STL, boost
- #include <boost/lexical_cast.hpp>
- 
- //gaudi
- #include "EventInfo/EventInfo.h"
- #include "EventInfo/EventID.h"
- #include "InDetIdentifier/SCT_ID.h"
- #include "Identifier/Identifier.h"
- 
- 
- namespace SCT_CalibAlgs{
-   std::string 
-   eventInfoAsString(const EventInfo * theEvent){
-     using boost::lexical_cast;
-     using std::string;
-     const EventID* e=theEvent->event_ID();
-     string result = string("[ Run, Event, Time, Lumi, Bunch ] = [ " )+
-       lexical_cast<string>(e->run_number()) + ", " +
-       lexical_cast<string>(e->event_number()) + ", "+
-       lexical_cast<string>(e->time_stamp()) + ", "+
-       lexical_cast<string>(e->lumi_block()) + ", "+
-       lexical_cast<string>(e->lumi_block()) + " ] ";
-     return result;
-   }//function end
-   
-   std::string 
-   formatPosition(const Identifier & waferId, const SCT_ID* helper, const std::string & delimiter, const bool includeSide){
-     using boost::lexical_cast;
-     using std::string;
-     string result=lexical_cast<string>(helper->barrel_ec(waferId))+delimiter;
-     result+=lexical_cast<string>(helper->layer_disk(waferId))+delimiter;
-     result+=lexical_cast<string>(helper->phi_module(waferId))+delimiter;
-     result+=lexical_cast<string>(helper->eta_module(waferId));
-     if (includeSide) result+=(  delimiter+lexical_cast<string>(helper->side(waferId))  );
-     return result;
-   }//function end
-   
-   std::string 
-   chipList2LinkList(const std::string & chipList){
-     if ( chipList == "0-5  6-11" ) {
-       return "0 1";
-     } else if ( chipList == "0-5" ) {
-       return "0";
-     } else if ( chipList == "6-11" ) {
-       return "1";
-     } else {
-       return "";
-     }
-   }
-   
-    unsigned int 
-    bec2Index( const int bec ) {
-     return (bec/2) + 1;
-   }
-   
-   
-   std::string 
-   xmlCloseChannel(){
-     return "</channel>"; 
+
+#include "SCT_CalibUtilities.h"
+
+//STL, boost
+#include <boost/lexical_cast.hpp>
+
+//gaudi
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/EventID.h"
+#include "InDetIdentifier/SCT_ID.h"
+#include "Identifier/Identifier.h"
+
+namespace SCT_CalibAlgs {
+std::string
+eventInfoAsString(const EventInfo * theEvent) {
+   using boost::lexical_cast;
+   using std::string;
+   const EventID* e=theEvent->event_ID();
+   string result = string("[ Run, Event, Time, Lumi, Bunch ] = [ " )+
+                   lexical_cast<string>(e->run_number()) + ", " +
+                   lexical_cast<string>(e->event_number()) + ", "+
+                   lexical_cast<string>(e->time_stamp()) + ", "+
+                   lexical_cast<string>(e->lumi_block()) + ", "+
+                   lexical_cast<string>(e->lumi_block()) + " ] ";
+   return result;
+}//function end
+
+std::string
+formatPosition(const Identifier & waferId, const SCT_ID* helper, const std::string & delimiter, const bool includeSide) {
+   using boost::lexical_cast;
+   using std::string;
+   string result=lexical_cast<string>(helper->barrel_ec(waferId))+delimiter;
+   result+=lexical_cast<string>(helper->layer_disk(waferId))+delimiter;
+   result+=lexical_cast<string>(helper->phi_module(waferId))+delimiter;
+   result+=lexical_cast<string>(helper->eta_module(waferId));
+   if (includeSide) result+=(  delimiter+lexical_cast<string>(helper->side(waferId))  );
+   return result;
+}//function end
+
+std::string
+chipList2LinkList(const std::string & chipList) {
+   if ( chipList == "0-5  6-11" ) {
+      return "0 1";
+   } else if ( chipList == "0-5" ) {
+      return "0";
+   } else if ( chipList == "6-11" ) {
+      return "1";
+   } else {
+      return "";
    }
- } //end of namespace
- 
- 
+}
+
+unsigned int
+bec2Index( const int bec ) {
+   return (bec/2) + 1;
+}
+
+std::string
+xmlCloseChannel() {
+   return "</channel>";
+}
+} //end of namespace
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.h
index 98ce37f00d346b5332dd2ab573d887d284c94ee3..6078988736a53787fcf569d827ffb4c562999abf 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.h
@@ -2,12 +2,12 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
- /**
-  * @file SCT_CalibUtilities.h
-  * header file for the SCTCalibUtilities
-  *
-  * @author Shaun Roe shaun.roe@cern.ch
-  **/
+/**
+ * @file SCT_CalibUtilities.h
+ * header file for the SCTCalibUtilities
+ *
+ * @author Shaun Roe shaun.roe@cern.ch
+ **/
 
 #ifndef SCT_CalibAlgs_SCT_CalibUtilities_h
 #define SCT_CalibAlgs_SCT_CalibUtilities_h
@@ -18,25 +18,31 @@
 class Identifier;
 class SCT_ID;
 class EventInfo;
-namespace SCT_CalibAlgs{
-  std::string eventInfoAsString(const EventInfo * theEvent);
-  std::string formatPosition(const Identifier & waferId, const SCT_ID* helper, const std::string & delimiter="_", const bool includeSide=true);
-  std::string chipList2LinkList(const std::string & chipList);
-  unsigned int bec2Index( const int bec );
-  template <class T>
-  std::string xmlValue(const std::string & name, const T value){
-    std::ostringstream os;
-    os<<"  <value name=\""<<name<<"\">"<<value<<"</value>";
-    return os.str();
-  }
-  template <class T>
-  std::string xmlOpenChannel(const long id, const T since, const T until){
-    std::string opener=std::string("  <channel id=\"")+boost::lexical_cast<std::string>(id)+"\"";
-    std::string sinceAttr=std::string(" since=\"")+boost::lexical_cast<std::string>(since)+"\"";
-    std::string untilAttr=std::string(" until=\"")+boost::lexical_cast<std::string>(until)+"\"";
-    return opener+sinceAttr+untilAttr+">";
-  }
-  std::string xmlCloseChannel();
+
+namespace SCT_CalibAlgs {
+
+std::string eventInfoAsString(const EventInfo * theEvent);
+std::string formatPosition(const Identifier & waferId, const SCT_ID* helper, const std::string & delimiter="_", const bool includeSide=true);
+std::string chipList2LinkList(const std::string & chipList);
+unsigned int bec2Index( const int bec );
+
+template <class T>
+std::string xmlValue(const std::string & name, const T value) {
+   std::ostringstream os;
+   os<<"  <value name=\""<<name<<"\">"<<value<<"</value>";
+   return os.str();
+}
+
+template <class T>
+std::string xmlOpenChannel(const long id, const T since, const T until) {
+   std::string opener=std::string("  <channel id=\"")+boost::lexical_cast<std::string>(id)+"\"";
+   std::string sinceAttr=std::string(" since=\"")+boost::lexical_cast<std::string>(since)+"\"";
+   std::string untilAttr=std::string(" until=\"")+boost::lexical_cast<std::string>(until)+"\"";
+   return opener+sinceAttr+untilAttr+">";
+}
+
+std::string xmlCloseChannel();
+
 } //end of namespace
 
 #endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlHeader.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlHeader.cxx
index 2d37847036f9526de5cfa9fd7d965be67ce293d2..893a8184927f252a25f927bdcf9b8d5c8f48c927 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlHeader.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlHeader.cxx
@@ -2,24 +2,24 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
- /**
-  * @file XmlHeader.cxx
-  * implementation file for the XmlHeader class
-  *
-  * @author Shaun Roe shaun.roe@cern.ch
-  **/
-  
+/**
+ * @file XmlHeader.cxx
+ * implementation file for the XmlHeader class
+ *
+ * @author Shaun Roe shaun.roe@cern.ch
+ **/
+
 #include "XmlHeader.h"
 #include <ostream>
-  
-namespace SCT_CalibAlgs{
-  XmlHeader::XmlHeader(std::ostream & output): m_os(output){
-    m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n";
-  }
-  
-  void
-  XmlHeader::addStylesheet(const std::string  & stylesheetPath){
-    m_os << std::string("<?xml-stylesheet type=\"text/xsl\" href=\"") + stylesheetPath + std::string("\"?>\n"); 
-  }
 
-}
\ No newline at end of file
+namespace SCT_CalibAlgs {
+XmlHeader::XmlHeader(std::ostream & output): m_os(output) {
+   m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n";
+}
+
+void
+XmlHeader::addStylesheet(const std::string  & stylesheetPath) {
+   m_os << std::string("<?xml-stylesheet type=\"text/xsl\" href=\"") + stylesheetPath + std::string("\"?>\n");
+}
+
+}
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlHeader.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlHeader.h
index 1fd65cf869e0342bba135d99de7b551f9ebb90fd..8c11634bccc6b2adee691ba6b449e3cf039efacc 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlHeader.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlHeader.h
@@ -14,16 +14,15 @@
 #include <iosfwd>
 #include <string>
 
-namespace SCT_CalibAlgs{
-  class XmlHeader{
-  public:
-    XmlHeader(std::ostream & output);
-    void addStylesheet(const std::string & stylesheetPath);
+namespace SCT_CalibAlgs {
+class XmlHeader {
+   public:
+      XmlHeader(std::ostream & output);
+      void addStylesheet(const std::string & stylesheetPath);
 
-  private:
-    std::ostream & m_os;
-  };
+   private:
+      std::ostream & m_os;
+};
 }
 
-
 #endif
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlStreamer.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlStreamer.cxx
index 250b6c422ec1e6fe609e8e8d2aa7b71f73ca7ae8..89750e21c04984e3ef916f8de765cbbeb71ec381 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlStreamer.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlStreamer.cxx
@@ -12,49 +12,51 @@
 typedef std::map<std::string, std::string> Attributes_t;
 typedef std::vector<std::string> NameValue_t;
 static Attributes_t empty;
-namespace SCT_CalibAlgs{
-XmlStreamer::XmlStreamer(const std::string & name, const Attributes_t & attributes, std::ostream & os):IElementStreamer(name,attributes, os){
-  //if (m_nodeId==0) m_os<<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-  m_os<<"\n<"<<m_name;
-  if (not attributes.empty()){
-    Attributes_t::const_iterator i(attributes.begin());
-    const Attributes_t::const_iterator end(attributes.end());
-    for(;i!=end;++i){
-      m_os<<" "<<i->first<<"=\""<<i->second<<"\"";
-    }
-  }
-  m_os<<">";
-  m_os.flush();
+
+namespace SCT_CalibAlgs {
+
+XmlStreamer::XmlStreamer(const std::string & name, const Attributes_t & attributes, std::ostream & os):IElementStreamer(name,attributes, os) {
+   //if (m_nodeId==0) m_os<<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+   m_os<<"\n<"<<m_name;
+   if (not attributes.empty()) {
+      Attributes_t::const_iterator i(attributes.begin());
+      const Attributes_t::const_iterator end(attributes.end());
+      for(; i!=end; ++i) {
+         m_os<<" "<<i->first<<"=\""<<i->second<<"\"";
+      }
+   }
+   m_os<<">";
+   m_os.flush();
 }
 
-XmlStreamer::XmlStreamer(const std::string & name, const NameValue_t & attributeNames, const NameValue_t & attributeValues, std::ostream & os):IElementStreamer(name,attributeNames,attributeValues, os){
-  //if (m_nodeId==0) m_os<<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-  m_os<<"\n<"<<m_name;
-  for(unsigned int i(0);i!=attributeNames.size();++i){
-    m_os<<" "<<attributeNames[i]<<"=\""<<attributeValues[i]<<"\"";
-  }
-  m_os<<">";
-  m_os.flush();
+XmlStreamer::XmlStreamer(const std::string & name, const NameValue_t & attributeNames, const NameValue_t & attributeValues, std::ostream & os):IElementStreamer(name,attributeNames,attributeValues, os) {
+   //if (m_nodeId==0) m_os<<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+   m_os<<"\n<"<<m_name;
+   for(unsigned int i(0); i!=attributeNames.size(); ++i) {
+      m_os<<" "<<attributeNames[i]<<"=\""<<attributeValues[i]<<"\"";
+   }
+   m_os<<">";
+   m_os.flush();
 }
 
 XmlStreamer::XmlStreamer(const std::string & name, std::ostream & os)
-:IElementStreamer(name,empty, os){
-  m_os<<"\n<"<<m_name<<">";
-  m_os.flush();
+   :IElementStreamer(name,empty, os) {
+   m_os<<"\n<"<<m_name<<">";
+   m_os.flush();
 }
 
-XmlStreamer::XmlStreamer(const std::string & name, const std::string & attributeName, const std::string & attributeValue, std::ostream & os):IElementStreamer(name,attributeName,attributeValue, os){
-  m_os<<"\n<"<<m_name;
-   for(unsigned int i(0);i!=m_attributeNames.size();++i){
-     m_os<<" "<<m_attributeNames[i]<<"=\""<<m_attributeValues[i]<<"\"";
+XmlStreamer::XmlStreamer(const std::string & name, const std::string & attributeName, const std::string & attributeValue, std::ostream & os):IElementStreamer(name,attributeName,attributeValue, os) {
+   m_os<<"\n<"<<m_name;
+   for(unsigned int i(0); i!=m_attributeNames.size(); ++i) {
+      m_os<<" "<<m_attributeNames[i]<<"=\""<<m_attributeValues[i]<<"\"";
    }
    m_os<<">";
    m_os.flush();
 }
 
-
-XmlStreamer::~XmlStreamer(){
-  m_os<<"</"<<m_name<<">";
-  if (m_depth==1) m_os<<"\n";
+XmlStreamer::~XmlStreamer() {
+   m_os<<"</"<<m_name<<">";
+   if (m_depth==1) m_os<<"\n";
 }
+
 }
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlStreamer.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlStreamer.h
index efda412b4906813cb4c41e759d9c563d3e98e2fe..c3fb9b62e7a0c8657757f46b49a72da1deec0654 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlStreamer.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/XmlStreamer.h
@@ -11,15 +11,17 @@
 
 #include "IElementStreamer.h"
 
-namespace SCT_CalibAlgs{
-class XmlStreamer:public IElementStreamer{
-public:
-  XmlStreamer(const std::string & name, const std::map<std::string, std::string> & attributes, std::ostream & os=std::cout);
-  XmlStreamer(const std::string & name, const std::string & attributeName, const std::string & attributeValue, std::ostream & os=std::cout);
-  
-  XmlStreamer(const std::string & name, const std::vector<std::string> & attributeNames, const std::vector<std::string> & attributeValues, std::ostream & os=std::cout);
-  XmlStreamer(const std::string & name, std::ostream & os=std::cout);
-  virtual ~XmlStreamer();
+namespace SCT_CalibAlgs {
+
+class XmlStreamer:public IElementStreamer {
+
+   public:
+      XmlStreamer(const std::string & name, const std::map<std::string, std::string> & attributes, std::ostream & os=std::cout);
+      XmlStreamer(const std::string & name, const std::string & attributeName, const std::string & attributeValue, std::ostream & os=std::cout);
+
+      XmlStreamer(const std::string & name, const std::vector<std::string> & attributeNames, const std::vector<std::string> & attributeValues, std::ostream & os=std::cout);
+      XmlStreamer(const std::string & name, std::ostream & os=std::cout);
+      virtual ~XmlStreamer();
 };
 
 }
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/components/SCT_CalibAlgs_entries.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/components/SCT_CalibAlgs_entries.cxx
index 1c3f1c2008549e866e4fa2e6541daf5e35cf3cad..c631368c8a94b3b6555bed9739d49c6a02ac4fee 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/components/SCT_CalibAlgs_entries.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/components/SCT_CalibAlgs_entries.cxx
@@ -1,20 +1,7 @@
 #include "SCT_CalibAlgs/SCTCalib.h"
-#include "SCT_CalibAlgs/SCTCalibWriteSvc.h"
-#include "../SCT_CalibHitmapSvc.h"
-#include "../SCT_CalibLbSvc.h"
-#include "../SCT_CalibBsErrorSvc.h"
-#include "../SCT_CalibModuleListSvc.h"
+//#include "SCT_CalibAlgs/SCTCalibWriteTool.h"
 #include "../SCT_CalibEventInfo.h"
 
-
-
 DECLARE_COMPONENT( SCTCalib )
-DECLARE_COMPONENT( SCT_CalibBsErrorSvc )
-DECLARE_COMPONENT( SCTCalibWriteSvc )
-DECLARE_COMPONENT( SCT_CalibHitmapSvc )
-DECLARE_COMPONENT( SCT_CalibLbSvc )
-DECLARE_COMPONENT( SCT_CalibModuleListSvc )
+//DECLARE_COMPONENT( SCTCalibWriteTool )
 DECLARE_COMPONENT( SCT_CalibEventInfo )
-
-  
-