From efd1cb54faf10d4889dcf88e55baf4bbcc6a63e8 Mon Sep 17 00:00:00 2001
From: cranshaw <Jack.Cranshaw@cern.ch>
Date: Tue, 9 Jan 2018 09:41:25 -0600
Subject: [PATCH] Merge in changes in master from over the holidays.

Former-commit-id: 9b39c6d94a0e18ecf2c03d471ab95211791e4ecf
---
 .../ControlTest/test/SGDataLink_test.cxx      |    2 +-
 .../AthenaDBTestRec/CMakeLists.txt            |   11 +-
 .../src/app/TestCoolRecWriter.cxx             |   30 +-
 .../AthenaPoolMultiTest/CMakeLists.txt        |    6 +-
 .../CaloDetDescr/CaloDetDescrElement.h        |    4 +-
 .../CaloDetDescr/CaloDetDescriptor.h          |    4 +-
 .../CaloIdentifier/CaloIdentifier/TileTBID.h  |    8 +-
 Calorimeter/CaloIdentifier/src/TileTBID.cxx   |    8 +-
 .../CaloTriggerTool/CaloTriggerTowerService.h |   24 +-
 .../src/CaloTriggerTowerService.cxx           |   20 +-
 Control/AthAllocators/share/DataPool_test.ref |   12 +-
 .../AthAnalysisBaseComps/AthAnalysisHelper.h  |   10 +-
 .../src/AthAnalysisHelper.cxx                 |    2 +-
 .../AthContainers/ATLAS_CHECK_THREAD_SAFETY   |    1 +
 .../AthContainers/AthContainersDict.h         |    3 +-
 .../AthContainers/AuxStoreInternal.h          |    8 +-
 .../AthContainers/AuxVectorBase.h             |   38 +-
 .../AthContainers/AuxVectorBase.icc           |   28 +-
 .../AthContainers/AuxVectorData.h             |    4 -
 .../AthContainers/AuxVectorData.icc           |   12 -
 .../AthContainers/AthContainers/ClassName.h   |    4 +-
 .../AthContainers/ConstDataVector.h           |   30 +-
 .../AthContainers/ConstDataVector.icc         |   20 -
 .../AthContainers/AthContainers/DataVector.h  |   62 +-
 .../AthContainers/DataVector.icc              |   69 -
 .../AthContainers/UserDataStore.h             |  213 --
 .../AthContainers/AthContainers/ViewVector.h  |    2 +-
 .../AthContainers/dataVectorAsELV.h           |    4 +-
 .../AthContainers/AthContainers/selection.xml |    2 -
 .../AthContainers/tools/DVLCast.h             |   11 -
 .../AthContainers/tools/DVLDataBucket.h       |    2 +-
 .../AthContainers/tools/DVLEltBaseInfo.icc    |    2 -
 .../AthContainers/tools/DVLInfo.h             |   16 +-
 .../AthContainers/tools/DVLInfo.icc           |   28 +-
 .../AthContainers/tools/DVL_algorithms.h      |    2 -
 .../AthContainers/tools/DVL_algorithms.icc    |    6 +-
 .../AthContainers/tools/ElementProxy.h        |    4 -
 .../AthContainers/tools/ElementProxy.icc      |   10 -
 .../AthContainers/tools/IsMostDerivedFlag.h   |    2 -
 .../AthContainers/tools/UDSLabelHashTable.h   |   63 -
 .../AthContainers/tools/copyThinned.h         |   28 +-
 .../AthContainers/tools/copyThinned.icc       |   36 +-
 .../AthContainers/tools/foreach.h             |   31 -
 .../AthContainers/tools/threading.h           |   28 +-
 .../AthContainers/tools/threading.icc         |    4 +-
 Control/AthContainers/CMakeLists.txt          |    1 -
 Control/AthContainers/Root/AuxElement.cxx     |    7 +-
 .../AthContainers/Root/AuxTypeRegistry.cxx    |    5 +-
 Control/AthContainers/Root/AuxVectorBase.cxx  |   17 +-
 Control/AthContainers/Root/AuxVectorData.cxx  |    4 -
 Control/AthContainers/Root/DVLInfo.cxx        |    2 +-
 .../AthContainers/Root/UDSLabelHashTable.cxx  |   72 -
 Control/AthContainers/Root/UserDataStore.cxx  |  118 -
 Control/AthContainers/share/foreach_test.ref  |    2 -
 .../AthContainers/src/copyAuxStoreThinned.cxx |    3 +-
 .../test/AuxElementComplete_test.cxx          |    2 -
 .../test/AuxTypeRegistry_test.cxx             |    2 +-
 .../AthContainers/test/AuxVectorBase_test.cxx |    2 -
 .../AthContainers/test/AuxVectorData_test.cxx |    7 +-
 Control/AthContainers/test/DVLInfo_test.cxx   |    4 +-
 .../AthContainers/test/DataVector_test.cxx    |    4 +-
 .../AthContainers/test/DataVector_test.icc    |    7 +-
 .../test/IsMostDerivedFlag_test.cxx           |    2 -
 .../test/ViewVectorBase_test.cxx              |    2 +-
 .../AthContainers/test/ViewVector_test.cxx    |    4 +-
 .../test/copyAuxStoreThinned_test.cxx         |    5 +-
 .../AthContainers/test/copyThinned_test.cxx   |   20 +-
 Control/AthContainers/test/foreach_test.cxx   |   36 -
 .../AthViews/AthViews/GraphExecutionTask.h    |   35 -
 Control/AthViews/AthViews/ViewHelper.h        |  385 +-
 Control/AthViews/CMakeLists.txt               |   20 +-
 Control/AthViews/share/SimpleViewExample.py   |   62 +
 Control/AthViews/share/ViewNest.py            |   79 +
 .../{GraphViews.py => ViewScheduling.py}      |   56 +-
 Control/AthViews/src/AthViewAlgorithm.cxx     |  142 -
 Control/AthViews/src/GraphExecutionTask.cxx   |   71 -
 .../RoiCollectionToViews.cxx                  |   40 +-
 .../{src_dflow => src}/RoiCollectionToViews.h |   19 +-
 Control/AthViews/src/ViewDataVerifier.cxx     |  125 +
 .../ViewDataVerifier.h}                       |   75 +-
 .../{src_dflow => src}/ViewTestAlg.cxx        |    0
 .../AthViews/{src_dflow => src}/ViewTestAlg.h |    0
 .../src/components/AthViews_entries.cxx       |    8 +
 Control/AthViews/src_dflow/DFlowAlg1.cxx      |    2 +-
 Control/AthViews/src_dflow/ViewMergeAlg.cxx   |   22 +-
 Control/AthViews/src_dflow/ViewMergeAlg.h     |    6 +-
 .../AthViews/src_dflow/ViewSubgraphAlg.cxx    |   47 +-
 Control/AthViews/src_dflow/ViewSubgraphAlg.h  |   13 +-
 .../components/AthViewsDFlow_entries.cxx      |    4 -
 .../AthViews/test/test_simple_view_example.sh |    5 +
 Control/AthViews/test/test_view_nest_fail.sh  |   10 +
 Control/AthViews/test/test_view_scheduling.sh |    5 +
 .../AthenaBaseComps/share/AthAlgTool_test.ref |   12 +-
 .../share/AthAlgorithm_test.ref               |   14 +-
 .../AthenaKernel/AthenaKernel/IUserDataSvc.h  |  333 --
 .../share/SlotSpecificObj_test.ref            |    9 +-
 .../AthenaKernel/share/errorcheck_test.ref    |   58 +-
 Control/AthenaKernel/test/CondCont_test.cxx   |    4 +-
 .../test/SlotSpecificObj_test.cxx             |    2 +-
 Control/AthenaKernel/test/errorcheck_test.cxx |   74 +-
 Control/AthenaMP/src/AthMpEvtLoopMgr.cxx      |   64 +-
 Control/AthenaMP/src/AthMpEvtLoopMgr.h        |    6 +-
 .../src/memory-monitor/rapidjson/document.h   |   14 +
 Control/AthenaServices/CMakeLists.txt         |    2 +-
 Control/AthenaServices/share/RCUSvc_test.ref  |    9 +-
 Control/AthenaServices/src/MetaDataSvc.cxx    |   12 +-
 .../src/MixingEventSelector.cxx               |    2 +-
 Control/AthenaServices/test/RCUSvc_test.cxx   |    4 +-
 .../CxxUtils/CxxUtils/ConcurrentBitset.icc    |    4 +-
 Control/CxxUtils/Root/ClassName.cxx           |    7 +-
 .../CxxUtils/test/ConcurrentBitset_test.cxx   |    4 +-
 Control/CxxUtils/test/copy_bounded_test.cxx   |   15 +-
 Control/DataModelAthenaPool/CMakeLists.txt    |    6 -
 .../DataModelAthenaPoolDict.h                 |    4 -
 .../UDSLabelHashTableCnv_p1.h                 |   22 -
 .../UDSLabelHashTable_p1.h                    |   27 -
 .../DataModelAthenaPool/UserDataStoreCnv_p1.h |   46 -
 .../DataModelAthenaPool/UserDataStore_p1.h    |   34 -
 .../DataModelAthenaPool/selection.xml         |    6 -
 .../src/UDSLabelHashTableCnv_p1.cxx           |   26 -
 .../src/UserDataStoreCnv.cxx                  |   42 -
 .../src/UserDataStoreCnv.h                    |   34 -
 .../src/UserDataStoreCnv_p1.cxx               |  267 --
 .../DataModelRunTests/share/CondReader.ref    |  121 +-
 .../DataModelRunTests/share/CondReaderMT.ref  |   95 +-
 .../share/xAODTestDecorHandle1MT.ref          |   66 +-
 .../share/xAODTestDecorHandle2MT.ref          |   46 +-
 .../share/xAODTestSymlinks1.ref               |   25 +-
 .../share/xAODTestSymlinks1MT.ref             |   77 +-
 .../share/xAODTestSymlinks2MT.ref             |   54 +-
 Control/IOVSvc/share/IOVSvcTool_test.ref      |   24 +-
 Control/PileUpComps/src/BkgStreamsCache.cxx   |    2 +-
 .../src/BkgStreamsConcentricCache.cxx         |    4 +-
 .../PileUpComps/src/BkgStreamsStepCache.cxx   |    2 +-
 .../PileUpComps/src/SplitBkgStreamsCache.cxx  |    4 +-
 Control/RngComps/CMakeLists.txt               |    2 +-
 Control/RngComps/share/AtRanlux_test.ref      |   10 +-
 Control/RngComps/share/AtRndmGen_test.ref     |   10 +-
 Control/RngComps/share/RNGWrapper_test.ref    |    1 +
 Control/RngComps/src/interpretSeeds.cxx       |    4 +-
 Control/RngComps/test/RNGWrapper_test.cxx     |    2 +
 Control/SGComps/share/SGFolder_test.ref       |   15 +-
 Control/StoreGate/share/SGHive_test.ref       |   58 +-
 Control/StoreGate/src/SGHiveMgrSvc.cxx        |    2 +-
 Control/StoreGate/src/SGHiveMgrSvc.h          |    4 +-
 Control/StoreGate/src/StoreGate.cxx           |    2 +-
 .../ut_xaodrootaccess_tauxstore_test.ref      |    4 +-
 .../test/ut_xaodrootaccess_tauxstore_test.cxx |   16 +-
 .../CollectionBase/src/CollectionFactory.cpp  |    4 +-
 .../PersistencySvc/IPersistencySvc.h          |    6 +-
 .../PersistencySvc/IPersistencySvcFactory.h   |   25 -
 .../PersistencySvc/src/IPersistencySvc.cpp    |   12 +
 .../src/IPersistencySvcFactory.cpp            |   21 -
 .../APR/PersistencySvc/src/PersistencySvc.cpp |    1 -
 .../RootStorageSvc/src/RootTreeContainer.cpp  |    2 +-
 Database/APR/StorageSvc/StorageSvc/DbIter.h   |    2 +-
 Database/APR/Tests/CMakeLists.txt             |    1 +
 .../FileCatalog_Functionality/FCtest.cpp      |    3 +-
 .../TestDriver.cpp                            |   22 +-
 .../TestDriver.cpp                            |   20 +-
 .../TestDriver.cpp                            |   57 +-
 .../PersistencySvc_Functionality/TestDriver.h |    1 -
 .../PersistencySvc_Functionality/main.cpp     |    5 -
 .../PersistencySvc_NoClassID/TestDriver.cpp   |   19 +-
 .../PersistencySvc_Parameters/TestDriver.cpp  |   21 +-
 .../AthenaPoolCnvSvc/CMakeLists.txt           |    3 +-
 .../AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx |   10 +-
 .../AthenaPoolServices/CMakeLists.txt         |    6 +-
 .../AthenaPOOL/DBDataModel/CMakeLists.txt     |   10 +-
 .../EventSelectorAthenaPool/CMakeLists.txt    |    5 +-
 Database/AthenaPOOL/PoolSvc/CMakeLists.txt    |    9 +-
 .../AthenaPOOL/PoolSvc/PoolSvc/IPoolSvc.h     |    1 -
 Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx   |  164 +-
 Database/AthenaPOOL/PoolSvc/src/PoolSvc.h     |    4 -
 .../RootConversions/test/tcls_common.h        |    6 +-
 .../AthenaRoot/AthenaRootComps/CMakeLists.txt |    5 +-
 .../test_athena_variable_shape_merged.ref     |    0
 Database/CoolConvUtilities/CMakeLists.txt     |    7 +-
 .../CoolConvUtilities/src/AtlCoolCopy.cxx     |    2 +-
 Database/CoralDB/src/CoralDB.cxx              |    2 +-
 Database/IOVDbSvc/CMakeLists.txt              |    9 +-
 Database/IOVDbSvc/python/CondDB.py            |    2 +
 Database/RegistrationServices/CMakeLists.txt  |    6 +-
 .../src/RegistrationStream.cxx                |   20 +-
 .../src/RegistrationStream.h                  |    3 +-
 .../src/RegistrationStreamLCGTool.cxx         |   12 +-
 .../src/RegistrationStreamTagTool.cxx         |   16 +-
 .../DetDescrCondTools/CMakeLists.txt          |    8 +-
 .../GeoAdaptors/GeoCaloCalibHit.icc           |    3 +-
 .../GeoModelKernel/GeoAccessVolAndSTAction.h  |    8 +-
 .../RegionSelector/src/RegSelectorHashMap.cxx |   16 +-
 Event/ByteStreamCnvSvc/CMakeLists.txt         |   10 +-
 .../src/EventSelectorByteStream.cxx           |   14 +-
 .../ByteStreamCnvSvc/test/AtlFindBSEvent.cxx  |    3 +
 .../ByteStreamCnvSvcBase/ROBDataProviderSvc.h |    4 +-
 Event/DFStreamEventSelector/CMakeLists.txt    |    2 +-
 Event/EventCommonAlgs/src/I4MomDumper.cxx     |    2 +-
 Event/EventCommonAlgs/src/INav4MomDumper.cxx  |    2 +-
 .../OverlayCommonAlgs/src/BSFilter.cxx        |   46 +-
 .../OverlayCommonAlgs/src/BSFilter.h          |    6 +-
 .../src/CopyMcEventCollection.cxx             |   10 +-
 .../OverlayCommonAlgs/src/G4HitMerger.cxx     |    2 +-
 .../src/xAODShallowAuxContainerCnv.cxx        |    5 +-
 .../src/xAODTrigBphysContainerCnv.cxx         |    6 +-
 .../Root/ByteStreamAuxContainer_v1.cxx        |    5 +-
 Event/xAOD/xAODTruth/xAODTruth/selection.xml  |    1 +
 Event/xAOD/xAODTruthCnv/CMakeLists.txt        |   56 +-
 .../xAODTruthCnv/Root/TruthMetaDataTool.cxx   |  109 +
 .../src/components/xAODTruthCnv_entries.cxx   |    2 +
 .../xAODTruthCnv/TruthMetaDataTool.h          |   84 +
 .../xAODTruthCnv/xAODTruthCnv/selection.xml   |    5 +
 .../xAODTruthCnv/xAODTruthCnvDict.h           |   11 +
 .../AFP/AFP_GeoModel/src/AFP_GeoModelTool.cxx |    2 +-
 .../AFP/AFP_Monitoring/CMakeLists.txt         |    5 +-
 .../src/AFPTechnicalMonitorTool.cxx           |    4 +-
 .../AFP_LocReco/AFP_SIDBasicKalman.h          |   49 +-
 .../AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h  |   18 +-
 .../AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h   |   18 +-
 .../AFP_LocReco/AFP_LocReco/AFP_TDZVertex.h   |    7 +-
 .../AFP_LocReco/AFP_LocReco/AFP_UserObjects.h |    4 +-
 .../AFP_LocReco/src/AFP_SIDBasicKalman.cxx    |   84 +-
 .../AFP_LocReco/src/AFP_SIDLocReco.cxx        |   20 +-
 .../AFP_LocReco/src/AFP_TDLocReco.cxx         |   18 +-
 .../AFP_LocReco/src/AFP_TDZVertex.cxx         |    8 +-
 .../ALFA_BeamTransport/src/ALFA_BeamTrack.cxx |   42 +-
 .../src/ALFA_DetectorFactory.cxx              |    4 +-
 .../ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h     |   12 +-
 .../ALFA_GloRec/ALFA_GloRec/AlfaLocalHits.h   |   32 +-
 .../ALFA_GloRec/src/ALFA_GloRec.cxx           |    5 +-
 .../ALFA_GloRec/src/AlfaLocalHits.cxx         |    9 +-
 .../FPTracker/FPTracker/CollimatorData.h      |    3 +-
 .../FPTracker/FPTracker/ConfigData.h          |    3 +-
 .../FPTracker/src/readConfigData.cxx          |   16 +-
 .../src/ForwardRegionGeoModelTool.cxx         |    2 +-
 .../ForwardTracker/ConfigData.h               |    3 +-
 .../ZDC/ZDC_GeoM/src/ZDC_DetTool.cxx          |    2 +-
 .../ZdcConditions/ZdcCablingService.h         |    2 +-
 .../ZdcConditions/src/ZdcCablingService.cxx   |    1 -
 Generators/EvgenProdTools/src/FixHepMC.cxx    |    3 +-
 .../EventBoost/EventBoost/EventBoost.h        |    2 +-
 .../EventBoost/src/EventBoost.cxx             |   18 +-
 Generators/HepMCWeightSvc/CMakeLists.txt      |    1 +
 Generators/MCTester_i/src/MCTesterAlg.cxx     |    4 +-
 .../TruthIO/TruthIO/ReadHepEvtFromAscii.h     |    1 -
 Generators/TruthIO/src/DumpMC.cxx             |    4 +-
 Generators/TruthIO/src/PrintMC.cxx            |    2 +-
 .../TruthIO/src/ReadHepEvtFromAscii.cxx       |    3 +-
 .../InDetAlignGenAlgs/InDetAlignWrt.h         |   64 +-
 .../InDetAlignGenAlgs/SPLayer.h               |    2 -
 .../InDetAlignGenAlgs/SiDistWriteAlg.h        |    8 +-
 .../InDetAlignGenAlgs/src/AddTRTMomConstr.cxx |   39 +-
 .../InDetAlignGenAlgs/src/AlignWrt.cxx        |  232 +-
 .../InDetAlignGenAlgs/src/InDetAlignCog.cxx   |    8 +-
 .../InDetAlignGenAlgs/src/SPLayer.cxx         |    4 +-
 .../InDetAlignGenAlgs/src/SiDistWriteAlg.cxx  |   46 +-
 .../InDetAlignGenTools/InDetAlignDBTool.h     |   14 +-
 .../InDetAlignGenTools/InDetAlignFillTrack.h  |  192 +-
 .../src/InDetAlignDBTool.cxx                  |  105 +-
 .../src/InDetAlignFillTrack.cxx               |  388 +--
 .../Application/createDeadModuleList.C        |    7 +-
 .../Application/updateDeadMaps.C              |    7 +-
 .../Application/updateNoiseMaps.C             |    7 +-
 .../PixelCalibAlgs/src/NoiseMapBuilder.cxx    |    7 +-
 .../PixelChargeInterpolationHistograms.cxx    |    2 +-
 .../src/PixelResidualHistograms.cxx           |    2 +-
 .../SCT_CalibAlgs/SCTCalibWriteSvc.h          |    4 +-
 .../SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx    |    4 +-
 .../TRT_CalibTools/src/FillAlignTrkInfo.cxx   |    4 +
 .../src/TRTCalibTrackSelectionTool.cxx        |    4 +-
 .../src/PixelClusterErrorData.cxx             |    6 +-
 .../src/PixelClusterOnTrackErrorData.cxx      |   16 +-
 .../src/PixelDCSSvc.cxx                       |    2 +
 .../src/PixelDCSTestSvc.cxx                   |    2 +
 .../src/SpecialPixelMapSvc.cxx                |   17 +-
 .../PixelCoralClientUtils/src/CoralClient.cc  |   10 +-
 .../SCT_ConditionsServices/src/SCT_Chip.cxx   |    2 +-
 .../src/SCT_ReadCalibChipDataSvc.cxx          |    4 +-
 .../src/SCT_ReadCalibChipUtilities.h          |    2 +-
 .../src/SCT_ReadCalibDataCondAlg.cxx          |    2 +-
 .../src/SCT_TdaqEnabledCondAlg.cxx            |    2 +-
 .../src/TRT_CalDbSvc.cxx                      |    4 -
 .../TRT_ConditionsServices/src/TRT_CalDbSvc.h |    8 +-
 .../src/TRT_HWMappingSvc.cxx                  |    3 +-
 .../InDetCosmicsFilters/src/TrackFilter.cxx   |    5 +-
 .../InDetReadoutGeometry/SiDetectorElement.h  |    4 +-
 .../InDetReadoutGeometry/TRT_BaseElement.h    |    4 +-
 .../src/InDetServMatTool.cxx                  |    2 +-
 .../PixelCabling/src/PixelCablingSvc.cxx      |   37 +-
 .../SCT_Cabling/src/SCT_CablingUtilities.cxx  |    2 +-
 .../src/SCT_FillCablingFromText.cxx           |    2 +-
 .../src/BCM_DigitizationTool.cxx              |    2 +-
 .../src/PixelDigitizationTool.cxx             |    6 +-
 .../src/PixelDigitizationTool.h               |    2 +-
 .../src/SCT_DigitizationTool.cxx              |    2 +-
 .../SiDigitization/SiChargedDiodeCollection.h |    4 +-
 .../TRT_Digitization/src/TRTDigCondBase.cxx   |   10 +-
 .../TRT_Digitization/src/TRTDigCondBase.h     |    8 +-
 .../src/TRTDigCondFakeMap.cxx                 |   10 +-
 .../TRT_Digitization/src/TRTDigCondFakeMap.h  |    3 +-
 .../TRT_Digitization/src/TRTDigSettings.cxx   |   46 +-
 .../TRT_Digitization/src/TRTDigitization.cxx  |    6 -
 .../src/TRTDigitizationTool.cxx               |   85 +-
 .../src/TRTDigitizationTool.h                 |   13 +-
 .../src/TRTElectronicsNoise.cxx               |   42 +-
 .../src/TRTElectronicsProcessing.cxx          |   37 +-
 .../TRT_Digitization/src/TRTNoise.cxx         |   26 +-
 .../TRT_Digitization/src/TRTNoise.h           |   11 +-
 .../src/TRTProcessingOfStraw.cxx              |  102 +-
 .../src/TRTProcessingOfStraw.h                |    4 +-
 .../src/TRTTimeCorrection.cxx                 |   25 +-
 .../TRT_Digitization/src/TRTTimeCorrection.h  |    4 +-
 .../src/TRT_BarrelDriftTimeData.cxx           |    1 -
 .../src/TRT_SimDriftTimeTool.cxx              |    4 -
 .../src/TRT_SimDriftTimeTool.h                |    2 -
 .../src/InDetSimDataCollectionCnv_p3.cxx      |    1 -
 .../InDetJiveXML/BeamSpotRetriever.h          |    4 +-
 .../InDetJiveXML/PixelClusterRetriever.h      |    8 +-
 .../InDetJiveXML/PixelRDORetriever.h          |    8 +-
 .../InDetJiveXML/SCTRDORetriever.h            |    6 +-
 .../InDetJiveXML/SiClusterRetriever.h         |    8 +-
 .../InDetJiveXML/SiSpacePointRetriever.h      |    6 +-
 .../InDetJiveXML/InDetJiveXML/TRTRetriever.h  |    6 +-
 .../InDetJiveXML/src/BeamSpotRetriever.cxx    |    2 +-
 .../src/PixelClusterRetriever.cxx             |   14 +-
 .../InDetJiveXML/src/PixelRDORetriever.cxx    |   10 +-
 .../InDetJiveXML/src/SCTRDORetriever.cxx      |   12 +-
 .../InDetJiveXML/src/SiClusterRetriever.cxx   |   16 +-
 .../src/SiSpacePointRetriever.cxx             |   10 +-
 .../InDetJiveXML/src/TRTRetriever.cxx         |   14 +-
 .../src/PixelPrepDataToxAOD.cxx               |    2 +-
 .../src/SCT_PrepDataToxAOD.cxx                |    2 +-
 .../src/TRT_PrepDataToxAOD.cxx                |   20 +-
 .../src/PixelRodDecoder.cxx                   |    1 +
 .../src/PixelRodEncoder.cxx                   |    2 -
 .../src/PixelRodEncoder.h                     |    6 +-
 .../share/InDetRecConditionsAccess.py         |    6 +-
 .../src/IDAlignMonEfficiencies.cxx            |   19 +-
 .../src/IDAlignMonEfficiencies.h              |    1 -
 .../src/IDAlignMonGenericTracks.cxx           |    4 +-
 .../src/IDAlignMonGenericTracks.h             |    2 +-
 .../src/IDAlignMonNtuple.cxx                  |   35 +-
 .../src/IDAlignMonPVBiases.cxx                |    3 +-
 .../src/IDAlignMonPVBiases.h                  |    1 -
 .../src/IDAlignMonResiduals.cxx               |   64 +-
 .../src/IDAlignMonSivsTRT.cxx                 |    4 +-
 .../src/IDAlignMonTrackSegments.h             |    6 -
 .../src/IDAlignMonTruthComparison.cxx         |    3 +-
 .../src/IDAlignMonTruthComparison.h           |    1 -
 .../src/InDetAlignMonBeamSpot.cxx             |    4 +-
 .../src/TrackSelectionAlg.cxx                 |    9 +-
 .../src/TrackSelectionAlg.h                   |    2 +-
 .../src/TrackSelectionTool.cxx                |   25 +-
 .../src/TrackSelectionTool.h                  |    4 +-
 .../IDPerfMonWenu.h                           |    2 +-
 .../InDetPerformanceMonitoring/IDPerfMonZee.h |    2 +-
 .../TRT_Electron_Monitoring_Tool.h            |   18 +-
 .../src/IDPerfMonKshort.cxx                   |    2 +-
 .../src/IDPerfMonWenu.cxx                     |   30 +-
 .../src/IDPerfMonZee.cxx                      |   30 +-
 .../src/MuonSelector.cxx                      |    2 +-
 .../src/TRT_Electron_Monitoring_Tool.cxx      |  170 +-
 .../SCT_Monitoring/SCTErrMonTool.h            |    6 +-
 .../SCT_Monitoring/SCTHitEffMonTool.h         |    2 +-
 .../SCT_Monitoring/SCTHitsNoiseMonTool.h      |   20 +-
 .../SCT_Monitoring/SCTRatioNoiseMonTool.h     |  150 +-
 .../SCT_Monitoring/SCTTracksMonTool.h         |    8 +-
 .../SCT_Monitoring/src/SCTErrMonTool.cxx      |  208 +-
 .../SCT_Monitoring/src/SCTHitEffMonTool.cxx   |  196 +-
 .../src/SCTHitsNoiseMonTool.cxx               |  146 +-
 .../src/SCTRatioNoiseMonTool.cxx              |  414 +--
 .../SCT_Monitoring/src/SCTTracksMonTool.cxx   |   54 +-
 .../src/BCM_ZeroSuppression.cxx               |    2 +-
 .../InDetRawData/InDetRawData/InDetRawData.h  |    2 +-
 .../InDetRawData/InDetRawDataCollection.h     |    8 +-
 .../InDetDenseEnvAmbiTrackSelectionTool.cxx   |    4 +-
 .../InDetPRD_AssociationToolGangedPixels.h    |    2 +-
 .../InDetPRD_AssociationToolGangedPixels.cxx  |    6 +-
 .../src/InDetTestBLayerTool.cxx               |    5 +-
 .../src/InDetTestPixelLayerTool.cxx           |    9 +-
 .../PixelToTPIDTool/PixelToTPIDTool.h         |    1 -
 .../PixelToTPIDTool/src/PixelToTPIDTool.cxx   |    3 +-
 .../TRT_ElectronPidToolRun2.h                 |    4 +-
 .../src/TRT_ElectronPidToolRun2.cxx           |    4 +-
 .../src/TRT_SeededSpacePointFinder_ATL.cxx    |    8 +-
 .../src/TRTTrackHoleSearchTool.cxx            |    5 +-
 .../TrigTrackResidualMonitor.h                |    1 -
 .../src/TrigTrackResidualMonitor.cxx          |    6 +-
 .../src/TrigTrackSlimmer.cxx                  |    3 +-
 .../IPRD_MultiTruthBuilder.h                  |    2 +-
 .../InDetTruthTools/PRD_MultiTruthBuilder.h   |    2 +-
 .../src/PRD_MultiTruthBuilder.cxx             |    2 +-
 .../PixelRTT/src/ResPullValidation.cxx        |   16 +-
 .../PixelRTT/src/TrackValidation.cxx          |   12 +-
 .../LArStripsCrossTalkCorrector.h             |    2 +-
 .../src/LArCalibShortCorrector.cxx            |    5 +-
 .../src/LArStripsCrossTalkCorrector.cxx       |    7 +-
 .../LArCellRec/src/LArCellMaskingTool.cxx     |    4 +-
 .../src/LArDetectorToolH62002.cxx             |    2 +-
 .../LArGeoH62004Algs/CMakeLists.txt           |    4 +-
 .../src/LArDetectorFactoryH62004.cxx          |    2 +-
 .../src/LArDetectorToolH62004.cxx             |    2 +-
 .../LArReadoutGeometry/FCAL_ChannelMap.h      |    8 +-
 .../src/FCAL_ChannelMap.cxx                   |    6 +-
 .../LArIdentifier/LArElectrodeID.h            |    2 +-
 .../LArIdentifier/LArIdentifier/LArHVLineID.h |    2 +-
 .../LArIdentifier/LArOnlineID_Base.h          |   10 +-
 .../LArIdentifier/src/LArOnlineID_Base.cxx    |   10 +-
 .../LArRawUtils/LArRawUtils/LArRoI_Map.h      |    2 +-
 LArCalorimeter/LArRawUtils/src/LArRoI_Map.cxx |    2 +-
 .../LArCalibTest/src/LArCablingChecker.cxx    |    2 +-
 LumiBlock/LumiCalc/CMakeLists.txt             |    8 +-
 .../Amdcsimrec/AmdcDb/src/AmdcDb.cxx          |    6 +-
 .../AmdcOracle/src/AmdcDumpOracle.cxx         |    2 +-
 .../python/GlobalChi2Align_IteratorClasses.py |  547 ---
 .../share/GenAlignIterator.py                 |   86 -
 .../share/GenAlignIteratorBatch.py            |   89 -
 .../MuonAlignExample/share/L1_MSID_Flags.py   |   94 -
 .../MuonAlignExample/share/L23MdtFlags.py     |   98 -
 .../MuonAlignExample/share/L3CSCFlags.py      |   67 -
 .../MuonAlignExample/share/L3MdtFlags.py      |  100 -
 .../share/L3MdtFlags_muidSA.py                |  105 -
 .../MuonAlignExample/share/MuonAlignment.py   |    7 -
 .../MuonAlignExample/share/MuonStandalone.py  |    3 +-
 .../MuonAlignExample/share/bfield_off.py      |   10 -
 .../MuonAlignExample/share/doBarrelOnly.py    |    4 -
 .../MuonAlignExample/share/doEndcapOnly.py    |    4 -
 .../share/runargs.ESDtoESD.py                 |  213 --
 .../share/runargs.RDOtoESD.py                 |  153 -
 .../share/submitMonitoringToGridDESD-inOneGo2 |   14 -
 .../MuonAlignExample_TestConfiguration.xml    |   43 -
 .../MuonAlignGenTools/CMakeLists.txt          |   86 -
 .../CommonGeometryManagerTool.h               |  129 -
 .../MuonAlignGenTools/CscAlignDBTool.h        |   52 -
 .../CscGeometryManagerTool.h                  |   67 -
 .../MuonAlignGenTools/MdtAlignDBTool.h        |   35 -
 .../MdtGeometryManagerTool.h                  |   72 -
 .../MuonAlignGenTools/MuonAlignDBTool.h       |  161 -
 .../MuonAlignGenTools/MuonAlignHelperTool.h   |   64 -
 .../MuonAlignGenTools/MuonAlignModuleTool.h   |   97 -
 .../MuonAlignGenTools/MuonAlignRefitTool.h    |  130 -
 .../MuonAlignGenTools/MuonFillNtupleTool.h    |  443 ---
 .../MuonGeometryManagerTool.h                 |   92 -
 .../MuonTrackCollectionProvider.h             |   91 -
 .../MuonAlignGenTools/MuonTrackPreProcessor.h |  283 --
 .../TgcGeometryManagerTool.h                  |   68 -
 .../MuonAlignGenTools/UnbiasedMuonResiduals.h |  366 --
 .../MuonAlignGenTools/doc/packagedoc.h        |   22 -
 .../python/ConfigureFullReco.py               |  187 -
 .../python/ConfigureMuonAlignment.py          |  274 --
 .../python/ConfigureMuonStandaloneReco.py     |   58 -
 .../python/ConfigureSolveMuonAlignment.py     |  249 --
 .../python/CscAlignDBToolGetter.py            |   57 -
 .../MuonAlignGenTools/python/IOFiles.py       |  101 -
 .../python/MdtAlignDBToolGetter.py            |   63 -
 .../python/MdtGeometryManagerToolGetter.py    |   38 -
 .../python/MuonAlignDBToolGetter.py           |   57 -
 .../python/MuonAlignModuleToolGetter.py       |   42 -
 .../python/MuonAlignRefitToolGetter.py        |   75 -
 .../python/MuonAlignmentFlags.py              |  788 -----
 .../python/MuonAlignmentIOFiles.py            |  145 -
 .../python/MuonFillNtupleToolGetter.py        |   54 -
 .../python/MuonGeometryManagerToolGetter.py   |   82 -
 .../MuonTrackCollectionProviderGetter.py      |   47 -
 .../python/MuonTrackPreProcessorGetter.py     |   82 -
 .../share/MuonDataRec_myTopOptions.py         |  274 --
 .../share/unbiasedMuonResiduals_jobOptions.py |   62 -
 .../src/CommonGeometryManagerTool.cxx         |  204 --
 .../MuonAlignGenTools/src/CscAlignDBTool.cxx  |   25 -
 .../src/CscGeometryManagerTool.cxx            |  417 ---
 .../MuonAlignGenTools/src/MdtAlignDBTool.cxx  |   25 -
 .../src/MdtGeometryManagerTool.cxx            |  673 ----
 .../MuonAlignGenTools/src/MuonAlignDBTool.cxx | 1328 -------
 .../src/MuonAlignHelperTool.cxx               |  439 ---
 .../src/MuonAlignModuleTool.cxx               |  539 ---
 .../src/MuonAlignRefitTool.cxx                |  585 ----
 .../src/MuonFillNtupleTool.cxx                | 1812 ----------
 .../src/MuonGeometryManagerTool.cxx           |  317 --
 .../src/MuonTrackCollectionProvider.cxx       |  244 --
 .../src/MuonTrackPreProcessor.cxx             | 2282 ------------
 .../src/TgcGeometryManagerTool.cxx            |  609 ----
 .../src/UnbiasedMuonResiduals.cxx             | 3101 -----------------
 .../components/MuonAlignGenTools_entries.cxx  |   31 -
 .../MuonCalibEvent/MdtCalibHit.h              |    2 +-
 .../MuonCalibEvent/src/MdtCalibHit.cxx        |    4 +-
 .../src/MuonSegmentToCalibSegment.cxx         |    2 +-
 .../src/MuonRdoToMuonDigitTool.cxx            |    8 +-
 .../src/CSC_RawDataProviderTool.cxx           |    9 +-
 .../src/CSC_RawDataProviderTool.h             |    3 +-
 .../src/MuonRdoContainerManager.cxx           |    2 +-
 .../MuonMDT_CnvTools/src/MdtHptdcReadOut.cxx  |   20 +-
 .../MuonMDT_CnvTools/src/MdtHptdcReadOut.h    |   32 +-
 .../MuonPrdSelector/IMuonIdCutTool.h          |    4 +-
 .../MuonPrdSelector/MuonIdCutTool.h           |    6 +-
 .../MuonPrdSelector/src/MuonIdCutTool.cxx     |    6 +-
 .../src/MuonPrdSelectorAlg.cxx                |    8 +-
 .../src/TGC_RawDataProviderTool.cxx           |   58 +-
 .../src/TGC_RawDataProviderTool.h             |    5 +-
 .../src/TgcPrepDataReplicationTool.cxx        |    2 +-
 .../MuonAGDD/MuonAGDD/MuonAGDDToolHelper.h    |    4 +-
 .../MuonAGDD/src/MuonAGDDToolHelper.cxx       |   12 +-
 .../MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h  |   34 +-
 .../MuonAGDDBase/AGDDMuonStation.h            |   34 +-
 .../MuonAGDDBase/src/AGDDMMSpacer.cxx         |    6 +-
 .../MuonAGDDBase/src/AGDDMicromegas.cxx       |    4 +-
 .../MuonAGDDBase/src/AGDDMuonStation.cxx      |    4 +-
 .../sTGCDetectorDescription.h                 |    2 +-
 .../src/CscDigitizationTool.cxx               |    2 +-
 .../src/MdtDigitizationTool.cxx               |    2 +-
 .../sTGC_Digitization/sTgcSimDigitData.h      |   44 +
 .../src/sTgcDigitizationTool.cxx              |  208 +-
 .../src/sTgcSimDigitData.cxx                  |   25 +
 .../MuonGMdbObjects/src/DblQ00Dbam.cxx        |    4 +-
 .../MuonGMdbObjects/src/DblQ00Wcsc.cxx        |    2 +-
 .../MuonGMdbObjects/src/DblQ00Wtgc.cxx        |    2 +-
 .../MuonGeoModel/src/MuonDetectorTool.cxx     |    2 +-
 .../MuonGeoModelTest/src/MuonGMCheck.cxx      |  140 +-
 .../MuonGeoModelTest/src/MuonGMTestOnPrd.cxx  |    4 +-
 .../MuonHoughPatternFinderTool.h              |    5 -
 .../src/MuonHoughPatternFinderTool.cxx        |   49 -
 .../src/MuonLayerHoughTool.cxx                |   10 +-
 .../MuonPrepRawData/MuonPrepDataCollection.h  |    4 +-
 .../MuonTrigCoinData/MuonCoinDataCollection.h |    6 +-
 .../MuonTrigCoinData/TgcCoinData.h            |    8 +-
 .../CMakeLists.txt                            |    3 +-
 .../src/MooSegmentCombinationFinder.cxx       |   75 +-
 .../src/MooSegmentCombinationFinder.h         |   11 +-
 .../src/MooSegmentFinderAlg.cxx               |    9 -
 .../src/MooSegmentFinderAlg.h                 |    2 -
 .../MuonCurvedSegmentCombiner.h               |   13 +-
 .../src/MuonCurvedSegmentCombiner.cxx         |   52 +-
 .../IMuonCurvedSegmentCombiner.h              |    4 +-
 .../IMuonSegmentCombinationCleanerTool.h      |    4 +-
 .../MuonPatternSegmentMaker/CMakeLists.txt    |    3 +-
 .../MuonPatternSegmentMaker.h                 |    4 +-
 .../src/MuonPatternSegmentMaker.cxx           |    7 +-
 .../CMakeLists.txt                            |    3 +-
 .../IMuonPatternSegmentMaker.h                |    3 +-
 .../src/MuonSegmentCombinationCleanerTool.cxx |   27 +-
 .../src/MuonSegmentCombinationCleanerTool.h   |    7 +-
 .../src/MuonTrackSteering.cxx                 |   13 -
 .../src/MuonTrackSteering.h                   |    1 -
 .../MuonTruthAlgs/MuonTrackTruthTool.h        |   19 +-
 .../MuonTruthAlgs/src/MuonTrackTruthTool.cxx  |  106 +-
 .../src/MuonEventInfoMonTool.cxx              |    2 +-
 .../MdtRawDataMonitoring/MdtRawDataValAlg.h   |    2 +-
 .../src/MdtRawDataValAlg.cxx                  |    7 +-
 .../TgcLv1RawDataValAlg.h                     |    2 +-
 .../TgcRawDataMonitoring/TgcRawDataValAlg.h   |   25 +-
 .../src/TgcLv1RawDataValAlg_Functions.cxx     |    2 +-
 .../src/TgcLv1RawDataValAlg_ReadContainer.cxx |    2 +-
 .../src/TgcRawDataValAlg_Efficiency.cxx       |   14 +-
 .../src/TgcRawDataValAlg_Profile.cxx          |    4 +-
 .../test/test_MuonRecRTT_JPsi_no_pileup.sh    |    7 -
 .../test/test_MuonRecRTT_JPsi_with_pileup.sh  |    7 -
 .../test/test_MuonRecRTT_ZPrime_no_pileup.sh  |    7 -
 .../test_MuonRecRTT_ZPrime_with_pileup.sh     |    7 -
 .../test/test_MuonRecRTT_Z_no_pileup.sh       |    7 -
 .../test/test_MuonRecRTT_Z_with_pileup.sh     |    7 -
 .../test/test_MuonRecRTT_ttbar_no_pileup.sh   |    7 -
 .../test/test_MuonRecRTT_ttbar_with_pileup.sh |    7 -
 .../test/test_muonrecrtt_jpsi_no_pileup.sh    |   10 +
 .../test/test_muonrecrtt_jpsi_with_pileup.sh  |   10 +
 .../test/test_muonrecrtt_ttbar_no_pileup.sh   |   10 +
 .../test/test_muonrecrtt_ttbar_with_pileup.sh |   10 +
 .../test/test_muonrecrtt_z_no_pileup.sh       |   10 +
 .../test/test_muonrecrtt_z_with_pileup.sh     |   10 +
 .../test/test_muonrecrtt_zprime_no_pileup.sh  |   10 +
 .../test_muonrecrtt_zprime_with_pileup.sh     |   10 +
 .../MuonTrackPerformanceAlg.h                 |    8 +-
 .../MuonTrackStatisticsAlg.h                  |   15 +-
 .../MuonTrackStatisticsTool.h                 |   21 +-
 .../share/MuonTrackStatistics_jobOptions.py   |    6 +-
 .../src/MuonPerformanceAlg.cxx                |   31 +-
 .../src/MuonPerformanceAlg.h                  |   14 +-
 .../src/MuonTrackPerformanceAlg.cxx           |   19 +-
 .../src/MuonTrackStatisticsAlg.cxx            |   65 +-
 .../src/MuonTrackStatisticsTool.cxx           |  145 +-
 .../FsrUtils/src/ToolTester.cxx               |   28 +-
 .../AnalysisCommon/FsrUtils/src/ToolTester.h  |    2 +-
 .../PMGTools/PMGTools/IPMGCrossSectionTool.h  |   21 +-
 .../PMGTools/PMGTools/PMGCrossSectionTool.h   |   16 +-
 .../PMGTools/Root/PMGCrossSectionTool.cxx     |  120 +-
 .../PileupReweighting/src/testPRWTool.C       |    4 +-
 .../share/ut_ParticleScaleFactorTool_test.ref |   12 -
 .../ThinningUtils/CMakeLists.txt              |    3 +-
 .../ThinningUtils/src/ThinGeantTruthAlg.cxx   |   58 +-
 .../ThinningUtils/src/ThinGeantTruthAlg.h     |    5 +-
 .../src/EGSelectionToolWrapper.cxx            |    4 +-
 .../EventTag/EventTagAlgs/CMakeLists.txt      |    6 +-
 .../HSG2/HSG2DPDUtils/python/HSG2D3PD.py      |    2 +-
 .../HSG2DPDUtils/python/METRefGetter_plup.py  |    6 +-
 .../MissingEtDQA/src/PhysValMET.cxx           |    6 +-
 .../Root/DiMuonTPSelectionTool.cxx            |    8 +-
 .../Root/HighPtSingleMuonSelectionTool.cxx    |    4 +-
 .../Root/MuonRecoTPEfficiencyTool.cxx         |    8 +-
 .../Root/MuonSelectionTool.cxx                |    6 +-
 .../share/PhysValMET_jobOptions.py            |    2 +
 .../share/PhysValPFlow_jobOptions.py          |   10 +-
 .../procedures/RingerProcedureWrapper.icc     |    2 +
 .../TauTrackEvent/TauTrackEvent/TruthTau.h    |    2 +-
 Projects/AthSimulation/externals.txt          |    2 +-
 Projects/Athena/externals.txt                 |    2 +-
 Projects/Athena/package_filters.txt           |    6 +-
 .../util/example_METAssoc.cxx                 |  203 --
 .../MissingETGoodness/src/JetVarTool.cxx      |    2 +-
 .../src/JetVariablesTool.cxx                  |    2 +-
 .../CaloTrkMuIdTools/CaloMuonLikelihoodTool.h |    1 -
 .../CaloTrkMuIdTools/TrackDepositInCaloTool.h |   11 +-
 .../src/CaloMuonLikelihoodTool.cxx            |   13 +-
 .../src/TrackDepositInCaloTool.cxx            |   49 +-
 .../MuGirl/src/MuGirlRecoTool.cxx             |    3 +-
 .../src/MuonCombinedInDetCandidateAlg.cxx     |    5 +-
 .../src/MuonCombinedInDetCandidateAlg.h       |    2 +
 .../src/MuonCombinedInDetExtensionAlg.cxx     |   26 +-
 .../src/MuonCombinedInDetExtensionAlg.h       |    1 +
 .../src/MuonCaloTagTool.cxx                   |   73 +-
 .../src/MuonCaloTagTool.h                     |    9 +-
 .../src/MuonCandidateTool.cxx                 |    8 +-
 .../src/MuonCandidateTool.h                   |    4 +
 .../src/MuonCombinedTool.cxx                  |    3 +-
 .../src/MuonCreatorTool.cxx                   |    8 +-
 .../src/MuonCreatorTool.h                     |    3 +
 .../src/MuonSegmentTagTool.cxx                |    5 +-
 .../src/TrackSegmentAssociationTool.cxx       |   18 +-
 .../src/TrackSegmentAssociationTool.h         |    6 +-
 .../python/MuonCombinedAlgs.py                |    4 +
 .../PFlow/PFlowUtils/CMakeLists.txt           |    3 +-
 .../PFlow/PFlowUtils/src/CombinePFO.cxx       |   41 +
 .../PFlow/PFlowUtils/src/CombinePFO.h         |   37 +
 .../src/components/PFlowUtils_entries.cxx     |    3 +-
 .../PFlowValidation/PFODQA/CMakeLists.txt     |    2 +-
 .../PFlowValidation/PFODQA/src/PhysValPFO.cxx |   57 +-
 .../PFlowValidation/PFODQA/src/PhysValPFO.h   |   13 +-
 .../PanTauEvent/CorrectedEflowMomentum.h      |    2 +-
 .../VrtSecInclusive/VrtSecInclusive.h         |    2 +-
 .../VrtSecInclusive/src/AANT_Tools.cxx        |    6 +-
 .../src/TrackSelectionAlgs.cxx                |    6 +-
 .../VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx |   12 +-
 .../VrtSecInclusive/src/VertexingAlgs.cxx     |   76 +-
 .../eflowRec/share/PFlowHiveExOpts.py         |    1 -
 .../G4Atlas/G4AtlasApps/python/SimFlags.py    |   82 +-
 .../python/G4AtlasUserActionConfig.py         |    9 +-
 .../python/G4UserActionsConfig.py             |   12 +-
 .../CMakeLists.txt                            |    1 +
 .../ISF_HitAnalysis.h                         |    8 +-
 .../epara/TFCS1DRegression.cxx                |  484 ---
 .../epara/TFCS1DRegression.h                  |   37 -
 .../epara/TFCSFunction.cxx                    |  103 -
 .../epara/TFCSFunction.h                      |   29 -
 .../epara/firstPCA.cxx                        |  597 ----
 .../epara/firstPCA.h                          |   53 -
 .../epara/secondPCA.cxx                       |  455 ---
 .../epara/secondPCA.h                         |   53 -
 .../python/fcsTrfArgs.py                      |   22 +
 .../scripts/FCS_Ntup_tf.py                    |   50 +
 .../share/ISF_ntuple.py                       |  114 +-
 .../share/ISF_ntuple_core.py                  |   98 +
 .../share/skeleton.ESDtoNTUP_FCS.py           |   79 +
 .../src/FastCaloSimCaloExtrapolation.h        |    2 +-
 .../src/ISF_HitAnalysis.cxx                   |   44 +
 .../tools/IntArray_linkdef.h                  |   13 -
 .../tools/TFCS1DFunctionHistogram_linkdef.h   |    7 -
 .../TFCS1DFunctionRegressionTF_linkdef.h      |    7 -
 .../tools/TFCS1DFunctionRegression_linkdef.h  |    7 -
 .../tools/TFCS1DFunction_linkdef.h            |    7 -
 .../tools/TFCSEnergyParametrization_linkdef.h |    7 -
 .../tools/TFCSExtrapolationState_linkdef.h    |    7 -
 .../TFCSPCAEnergyParametrization_linkdef.h    |    7 -
 .../tools/TFCSParametrizationBase_linkdef.h   |    7 -
 .../tools/TFCSParametrization_linkdef.h       |    7 -
 .../tools/TFCSSimulationState_linkdef.h       |    7 -
 .../tools/TFCSTruthState_linkdef.h            |    7 -
 .../tools/epara_validation_plots.C            |  323 --
 .../tools/init_epara.C                        |   39 -
 .../tools/init_epara_validation.C             |   42 -
 .../tools/run_epara.C                         |   76 -
 .../tools/run_epara_validation.C              |  431 ---
 .../PlanarDetElement.h                        |    4 +-
 .../ISF_PRD_AssociationTool.h                 |    2 +-
 .../src/ISF_PRD_AssociationTool.cxx           |    6 +-
 .../share/skeleton.EVGENtoHIT_ISF.py          |    2 +-
 .../share/skeleton.EVGENtoHIT_MC12.py         |    2 +-
 .../test/SimCoreTests_TestConfiguration.xml   |    2 +-
 .../test/test_AtlasG4_CavernBg_TR2HITS.sh     |    2 +-
 .../AtlasCLHEP_RandomGenerators/dSFMTEngine.h |    6 +-
 .../src/dSFMTEngine.cxx                       |    6 +-
 .../src/TBCaloCoolPosTool.cxx                 |    8 +-
 TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx   |    4 +-
 .../TileConditions/TileCablingService.h       |   26 +-
 .../TileConditions/src/TileCablingService.cxx |   15 +-
 .../TileCosmicAlgs/TileCosmicsTrigger.h       |   16 +-
 .../TileCosmicAlgs/TileMuonFitter.h           |   36 +-
 .../TileCosmicAlgs/src/TileCosmicsTrigger.cxx |   56 +-
 .../TileCosmicAlgs/src/TileMuonFitter.cxx     |  125 +-
 .../TileDetDescr/src/TileDetDescrManager.cxx  |    4 +-
 .../TileIdentifier/TileIdentifier/TileHWID.h  |   18 +-
 .../TileIdentifier/src/TileHWID.cxx           |   16 +-
 .../TileL2Algs/TileL2Algs/TileL2Builder.h     |   22 +-
 .../TileL2Algs/TileL2Algs/TileMuRODToNtuple.h |   19 +-
 .../TileL2Algs/TileRawChannelToL2.h           |   15 +-
 .../python/TileL2FromRawChGetter.py           |    3 -
 .../TileL2Algs/src/TileL2Builder.cxx          |   58 +-
 .../TileL2Algs/src/TileMuRODToNtuple.cxx      |   35 +-
 .../TileL2Algs/src/TileRawChannelToL2.cxx     |  103 +-
 .../TileMuId/TileMuId/TileLookForMuAlg.h      |   22 +-
 .../TileMuId/TileMuId/TileMuToNtuple.h        |   13 +-
 .../TileMuId/src/TileLookForMuAlg.cxx         |   84 +-
 .../TileMuId/src/TileMuToNtuple.cxx           |   43 +-
 .../TileRecAlgs/MBTSTimeDiffEventInfoAlg.h    |   12 +-
 .../TileRecAlgs/TileBeamElemToCell.h          |   23 +-
 .../TileRecAlgs/TileCellSelector.h            |   39 +-
 .../TileRecAlgs/TileRecAlgs/TileCellToTTL1.h  |   25 +-
 .../TileRecAlgs/TileRecAlgs/TileCellVerify.h  |   19 +-
 .../TileRecAlgs/TileDigitsFilter.h            |   23 +
 .../TileRecAlgs/TileDigitsThresholdFilter.h   |   15 +-
 .../TileRecAlgs/TileDigitsToTTL1.h            |   21 +-
 .../TileRecAlgs/TileMuonReceiverReadCnt.h     |   26 +-
 .../TileRecAlgs/TileRawChannelToHit.h         |   26 +-
 .../TileRecAlgs/TileRawChannelToTTL1.h        |   23 +-
 .../share/TileDigitsThresholdFilter_test.ref  |   16 +-
 .../src/MBTSTimeDiffEventInfoAlg.cxx          |   68 +-
 .../TileRecAlgs/src/TileBeamElemToCell.cxx    |   73 +-
 .../TileRecAlgs/src/TileCellSelector.cxx      |  325 +-
 .../TileRecAlgs/src/TileCellToTTL1.cxx        |   50 +-
 .../TileRecAlgs/src/TileCellVerify.cxx        |   94 +-
 .../TileRecAlgs/src/TileDigitsFilter.cxx      |  101 +-
 .../src/TileDigitsThresholdFilter.cxx         |   44 +-
 .../TileRecAlgs/src/TileDigitsToTTL1.cxx      |   83 +-
 .../src/TileMuonReceiverReadCnt.cxx           |  136 +-
 .../TileRecAlgs/src/TileRawChannelToHit.cxx   |   82 +-
 .../TileRecAlgs/src/TileRawChannelToTTL1.cxx  |   79 +-
 .../TileRecUtils/ITileRawChannelTool.h        |    2 +-
 .../TileRecUtils/TileBeamInfoProvider.h       |   51 +-
 .../TileRecUtils/TileCellBuilder.h            |   58 +-
 .../TileRecUtils/TileCellBuilderFromHit.h     |   57 +-
 .../TileRecUtils/TileRawChannelBuilder.h      |   31 +-
 .../TileRecUtils/TileRawChannelMaker.h        |   12 +-
 .../TileRecUtils/TileRawChannelNoiseFilter.h  |    2 +-
 .../TileRecUtils/TileRawChannelOF1Corrector.h |   19 +-
 .../TileRecUtils/TileRawChannelVerify.h       |   13 +-
 .../TileRecUtils/TileRawCorrelatedNoise.h     |   19 +-
 .../TileRecUtils/src/TileBeamInfoProvider.cxx |  205 +-
 .../TileRecUtils/src/TileCellBuilder.cxx      |  191 +-
 .../src/TileCellBuilderFromHit.cxx            |  113 +-
 .../src/TileRawChannelBuilder.cxx             |   68 +-
 .../src/TileRawChannelBuilderFitFilter.cxx    |    2 +-
 .../TileRawChannelBuilderFitFilterCool.cxx    |    2 +-
 .../src/TileRawChannelBuilderFlatFilter.cxx   |    2 +-
 .../src/TileRawChannelBuilderMF.cxx           |    2 +-
 .../src/TileRawChannelBuilderManyAmps.cxx     |    2 +-
 .../src/TileRawChannelBuilderOpt2Filter.cxx   |    2 +-
 .../src/TileRawChannelBuilderOptFilter.cxx    |    2 +-
 .../src/TileRawChannelBuilderQIEFilter.cxx    |    2 +-
 .../TileRecUtils/src/TileRawChannelMaker.cxx  |   82 +-
 .../src/TileRawChannelNoiseFilter.cxx         |    6 +-
 .../src/TileRawChannelOF1Corrector.cxx        |   20 +-
 .../TileRecUtils/src/TileRawChannelVerify.cxx |   76 +-
 .../src/TileRawCorrelatedNoise.cxx            |   51 +-
 .../TileSimAlgs/TileSimAlgs/TileDigitsMaker.h |   25 +-
 .../TileSimAlgs/TileSimAlgs/TileHitToCell.h   |   23 +-
 .../TileSimAlgs/TileHitToRawChannel.h         |   33 +-
 .../TileSimAlgs/TileSimAlgs/TileHitToTTL1.h   |   30 +-
 .../TileSimAlgs/TileHitVecToCntTool.h         |   18 +-
 .../TileSimAlgs/TileMuonReceiverDecision.h    |   23 +-
 .../TilePulseForTileMuonReceiver.h            |   27 +
 .../TileSimAlgs/TileTBHitToBeamElem.h         |   18 +-
 .../TileSimAlgs/src/TileDigitsMaker.cxx       |   89 +-
 .../TileSimAlgs/src/TileHitToCell.cxx         |   51 +-
 .../TileSimAlgs/src/TileHitToRawChannel.cxx   |   74 +-
 .../TileSimAlgs/src/TileHitToTTL1.cxx         |  129 +-
 .../TileSimAlgs/src/TileHitVecToCntTool.cxx   |   44 +-
 .../src/TileMuonReceiverDecision.cxx          |   78 +-
 .../src/TilePulseForTileMuonReceiver.cxx      |  111 +-
 .../TileSimAlgs/src/TileTBHitToBeamElem.cxx   |   52 +-
 Tools/LWHists/src/LWBinLabels.cxx             |    2 +-
 Tools/PathResolver/Root/PathResolver.cxx      |    6 +-
 .../src/TrackCollectionMerger.cxx             |   16 +-
 .../TrkTruthAlgs/src/TrackTruthSelector.cxx   |    4 +-
 .../TrkAlgebraUtils/src/IPCMat.cxx            |    2 +-
 .../TrkAlignEvent/src/AlignTrack.cxx          |   13 +-
 .../TrkAlignGenAlgs/python/AlignAlgGetter.py  |   72 -
 .../python/AlignTrackDresserGetter.py         |   64 -
 .../python/ShiftingDerivCalcToolGetter.py     |   62 -
 .../TrkDetDescrAlgs/MaterialValidation.h      |    1 -
 .../TrkDetDescrAlgs/src/MaterialMapping.cxx   |    2 +-
 .../src/MaterialValidation.cxx                |    1 -
 .../TrkDetDescrUtils/BinUtility.h             |   16 +-
 .../TrkDetDescrUtils/BinnedArray.h            |    3 +-
 .../TrkDetDescrUtils/BinnedArray1D.h          |    6 +-
 .../TrkDetDescrUtils/BinnedArray1D1D.h        |    6 +-
 .../TrkDetDescrUtils/BinnedArray1D1D1D.h      |    2 +-
 .../TrkDetDescrUtils/BinnedArray2D.h          |    6 +-
 .../TrkDetDescrUtils/BinnedArrayArray.h       |    4 +-
 .../TrkDetDescrUtils/CompactBinnedArray.h     |    2 +-
 .../TrkDetDescrUtils/CompactBinnedArray1D.h   |    6 +-
 .../TrkDetDescrUtils/CompactBinnedArray2D.h   |    6 +-
 .../TrkGeometry/MagneticFieldProperties.h     |    4 +-
 .../TrkPrepRawData/PrepRawDataCollection.h    |    8 +-
 .../TrkRIO_OnTrack/RIO_OnTrack.h              |    2 +-
 .../TrkSpacePoint/SpacePointCollection.h      |    9 +-
 .../TrkVertexOnTrack/VertexOnTrack.h          |    2 +-
 .../TrkVertexOnTrack/src/VertexOnTrack.cxx    |    2 +-
 .../TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx |    4 +-
 .../TrkJiveXML/TrkJiveXML/SegmentRetriever.h  |    4 +-
 .../TrkJiveXML/TrkJiveXML/TrackRetriever.h    |    4 +-
 .../TrkJiveXML/TrkJiveXML/VertexRetriever.h   |    6 +-
 .../TrkJiveXML/src/SegmentRetriever.cxx       |   20 +-
 .../TrkJiveXML/src/TrackRetriever.cxx         |   64 +-
 .../TrkJiveXML/src/VertexRetriever.cxx        |   41 +-
 .../src/DeterministicAnnealingFilter.cxx      |    2 +-
 ...enseEnvironmentsAmbiguityProcessorTool.cxx |    4 +-
 .../TrkAssociationTools/PRD_AssociationTool.h |    2 +-
 .../src/PRD_AssociationTool.cxx               |    6 +-
 .../TrkToolInterfaces/IPRD_AssociationTool.h  |    4 +-
 .../TrkToolInterfaces/ITRT_ElectronPidTool.h  |    4 +-
 .../src/TruthTrackCreation.cxx                |    2 +-
 .../TrkValInterfaces/ITrkObserverTool.h       |    4 +-
 .../TrkValTools/TrkValTools/TrkObserverTool.h |    4 +-
 .../TrkValTools/src/TrkObserverTool.cxx       |    4 +-
 .../TrigCaloRec/src/FullCaloCellContMaker.cxx |    9 +-
 .../src/TrigFastTrackFinder.cxx               |   13 +
 .../src/AcceptL1TopoMonitor.cxx               |    4 +-
 .../TrigGenericAlgs/src/AcceptL1TopoMonitor.h |    2 -
 .../TrigL2MuonSA/CscDataPreparator.h          |    3 +
 .../TrigL2MuonSA/MdtDataPreparator.h          |    7 +
 .../TrigL2MuonSA/MuFastSteering.h             |   18 +-
 .../TrigL2MuonSA/RpcDataPreparator.h          |    3 +
 .../TrigL2MuonSA/TgcDataPreparator.h          |    5 +
 .../TrigL2MuonSA/src/CscDataPreparator.cxx    |   15 +-
 .../TrigL2MuonSA/src/MdtDataPreparator.cxx    |   30 +-
 .../TrigL2MuonSA/src/MuFastSteering.cxx       |   10 +-
 .../TrigL2MuonSA/src/RpcDataPreparator.cxx    |   22 +-
 .../TrigL2MuonSA/src/TgcDataPreparator.cxx    |   17 +-
 .../python/TrigMuSuperEFConfig.py             |    2 +-
 .../TrigMuonEF/python/TrigMuonEFConfig.py     |   10 -
 .../python/TrigMuonEFCosmicConfig.py          |    4 +-
 .../src/TrigMuonEFStandaloneTrackTool.cxx     |    6 +-
 .../TrigmuComb/TrigmuComb/muCombMT.h          |  216 ++
 .../TrigmuComb/python/TrigmuCombMTConfig.py   |   92 +
 .../TrigmuComb/src/muCombMT.cxx               |  862 +++++
 .../Root/FeatureContainer.cxx                 |    4 +-
 .../TrigDecisionTool/FeatureContainer.h       |    6 +-
 .../Root/TrigEgammaAnalysisBaseTool.cxx       |   12 +-
 .../Root/TrigEgammaNavAnalysisTool.cxx        |    2 +-
 .../Root/TrigEgammaNavTPAnalysisTool.cxx      |    2 +-
 .../TrigEgammaAnalysisBaseTool.h              |    6 +-
 .../TrigJiveXML/LVL1ResultRetriever.h         |    4 +-
 .../TrigJiveXML/src/EmTauROIRetriever.cxx     |   18 +-
 .../TrigJiveXML/src/JetROIRetriever.cxx       |   18 +-
 .../TrigJiveXML/src/LVL1ResultRetriever.cxx   |   18 +-
 .../TrigJiveXML/src/MuonROIRetriever.cxx      |    6 +-
 .../src/TrigSiSpacePointRetriever.cxx         |    8 +-
 .../TrigJiveXML/src/TriggerInfoRetriever.cxx  |   22 +-
 .../Root/TrigMuonMatching.cxx                 |    2 +-
 .../TrigConfHLTData/HLTTriggerElement.h       |    4 +-
 .../TrigConfL1Data/Root/HelperFunctions.cxx   |   15 +-
 .../TrigConfL1Data/Root/TriggerItem.cxx       |    2 +-
 .../TrigConfL1Data/HelperFunctions.h          |    6 +-
 .../src/TrigConfCoolWriter.cxx                |    2 +-
 .../TrigConfStorage/src/XMLBoostHelper.cxx    |   18 +-
 .../TrigConfStorage/src/test/2COOLApp.cxx     |    2 +-
 .../src/test/ConsistencyChecker.cxx           |    2 +-
 .../TrigConfStorage/src/test/ReadWrite.cxx    |    2 +-
 .../TrigCaloDataAccessSvc/CMakeLists.txt      |   73 +
 .../ITrigCaloDataAccessSvc.h                  |  207 ++
 .../share/testDataAccessService.py            |   30 +
 .../src/TestCaloDataAccess.cxx                |  242 ++
 .../src/TestCaloDataAccess.h                  |   35 +
 .../src/TrigCaloDataAccessSvc.cxx             |  357 ++
 .../src/TrigCaloDataAccessSvc.h               |  154 +
 .../TrigCaloDataAccessSvc_entries.cxx         |    5 +
 .../test/test_dataaccess.sh                   |    5 +
 .../src/TrigROBDataProviderSvc.cxx            |    6 +
 .../src/TrigROBDataProviderSvc.h              |   28 +-
 .../src/TrigROBDataProviderSvc_RTT.h          |   10 +-
 .../TrigSerializeCnvSvc/CMakeLists.txt        |    8 +-
 .../TrigEvent/TrigInDetEvent/CMakeLists.txt   |   15 +-
 .../TrigInDetEvent/TrigHisto1D.h              |    2 +-
 .../TrigInDetEvent/TrigHisto1DContainer.h     |    6 +-
 .../TrigInDetEvent/TrigHisto2D.h              |    2 +-
 .../TrigInDetEvent/TrigHisto2DContainer.h     |    6 +-
 .../TrigInDetEvent/TrigInDetTrack.h           |    2 +-
 .../TrigInDetEvent/TrigInDetTrackCollection.h |    6 +-
 .../TrigInDetEvent/TrigInDetTrackFitPar.h     |    4 +-
 .../TrigSiSpacePointCollection.h              |    2 +-
 .../TrigInDetEvent/TrigSpacePointCounts.h     |    2 +-
 .../TrigSpacePointCountsCollection.h          |    6 +-
 .../TrigInDetEvent/TrigTauTracksInfo.h        |    2 +-
 .../TrigTauTracksInfoCollection.h             |    6 +-
 .../TrigInDetEvent/TrigTrackCounts.h          |    2 +-
 .../TrigTrackCountsCollection.h               |    6 +-
 .../TrigInDetEvent/TrigTrtHitCounts.h         |    2 +-
 .../TrigTrtHitCountsCollection.h              |    6 +-
 .../TrigInDetEvent/TrigVertexCollection.h     |    6 +-
 .../TrigInDetEvent/TrigVertexCounts.h         |    2 +-
 .../TrigVertexCountsCollection.h              |    6 +-
 .../TrigNavigation/TrigNavigation/Holder.icc  |    2 +-
 .../src/FTKRegionalWrapper.cxx                |   12 +
 .../TrigFTKByteStream/TrigFTKByteStreamTool.h |    3 +-
 .../src/FTKByteStreamDecoderEncoder.cxx       |  225 +-
 .../src/FTKByteStreamDecoderEncoder.h         |   55 +-
 .../TrigFTK/TrigFTKByteStream/src/FTKDump.cxx |   60 +-
 .../TrigFTK/TrigFTKByteStream/src/FTKDump.h   |    5 +-
 .../src/TrigFTKByteStreamTool.cxx             |   26 +-
 .../TrigTrigFTKByteStream_entries.cxx         |    3 +-
 .../TrigFTKPool/TrigFTKPool/FTKAthTrack.h     |    2 +-
 .../TrigFTK/TrigFTKPool/src/FTKAthTrack.cxx   |    5 +-
 .../TrigFTKSim/TrigFTKSim/FTKObjectInput.h    |   17 +-
 .../TrigFTKSim/TrigFTKSim/FTKObjectOutput.h   |    5 +-
 .../TrigFTKSim/TrigFTKSim/FTK_AMBank.h        |    4 +-
 .../TrigFTKSim/FTK_RegionalRawInput.h         |    2 +-
 .../TrigFTKSim/tsp/TSPROOTBankGenerator.h     |    6 +-
 .../share/skeleton.FTKStandaloneMerge.py      |   61 +-
 .../share/skeleton.FTKStandaloneSim.py        |  233 +-
 .../TrigFTKSim/src/FTKTrackFitterAlgo.cxx     |   18 +-
 Trigger/TrigFTK/TrigFTKSim/src/FTK_AMBank.cxx |    7 +-
 .../TrigFTK/TrigFTKSim/src/tsp/FTKTSPBank.cxx |    1 +
 .../src/tsp/TSPROOTBankGenerator.cxx          |    6 +-
 .../TrigFTK/TrigFTKSim/standalone/dataflow.cc |    1 +
 .../TrigFTK/TrigFTKSim/standalone/dataflow.h  |    7 +-
 .../TrigFTKSim/standalone/efficiency.cc       |    1 +
 .../TrigFTKSim/standalone/efficiency.h        |    3 +-
 .../src/MultiLayerPerceptron.cxx              |   14 +-
 .../src/TrigL2CaloRingerFex.cxx               |    4 +-
 .../src/TrigL2CaloRingerHypo.cxx              |    2 +-
 .../TrigMuonHypo/TrigMuonHypo/MufastOTRHypo.h |    2 +-
 .../TrigMuonHypo/TrigMufastHypoAlg.h          |   21 +-
 .../TrigMuonHypo/TrigMufastHypoTool.h         |    6 +-
 .../TrigMuonHypo/TrigmuCombHypoAlg.h          |   52 +
 .../TrigMuonHypo/TrigmuCombHypoTool.h         |   82 +
 .../TrigMuonHypo/python/TrigMuonHypoConfig.py |   63 +-
 .../TrigMuonHypo/src/MufastOTRHypo.cxx        |    2 +-
 .../TrigMuonHypo/src/TrigMufastHypoAlg.cxx    |   12 +-
 .../TrigMuonHypo/src/TrigMufastHypoTool.cxx   |   91 +-
 .../TrigMuonHypo/src/TrigmuCombHypoAlg.cxx    |  163 +
 .../TrigMuonHypo/src/TrigmuCombHypoTool.cxx   |  243 ++
 .../TrigTauHypo/src/EFPhotonTauFex.cxx        |    2 +-
 .../TrigTauHypo/src/EFTauDiKaonHypo.cxx       |    2 +-
 .../TrigTauHypo/src/HLTVertexPreSelHypo.cxx   |    4 +-
 .../src/SimpleLArDigitsChecks.cxx             |    4 +-
 .../src/SimpleLArDigitsChecks.h               |    2 +-
 .../src/SimpleSuperCellChecks.cxx             |   10 +-
 .../src/SimpleSuperCellChecks.h               |    2 +-
 .../src/TrigT1CaloBaseFex.cxx                 |   61 +-
 .../TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.h |   43 +-
 .../TrigL1CaloUpgrade/src/TrigT1CaloEFex.cxx  |    2 +-
 .../src/TrigT1CaloTauFex.cxx                  |   39 +-
 .../TrigL1CaloUpgrade/src/TrigT1CaloTauFex.h  |   21 +-
 .../TrigCostMonitor/src/TrigCostRun.cxx       |   18 +-
 .../src/HLTMinBiasMonTool.cxx                 |   40 +-
 Trigger/TrigSteer/L1Decoder/src/FakeRoI.cxx   |    2 +-
 Trigger/TrigSteer/L1Decoder/src/FakeRoI.h     |    8 +-
 .../TrigSteer/L1Decoder/src/FakeRoIView.cxx   |    2 +-
 Trigger/TrigSteer/L1Decoder/src/FakeRoIView.h |    8 +-
 .../L1Decoder/src/IRoIsUnpackingTool.h        |    2 +-
 .../TrigSteer/L1Decoder/src/L1CaloDecoder.cxx |    2 +-
 .../TrigSteer/L1Decoder/src/L1CaloDecoder.h   |    8 +-
 Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx |   11 +-
 Trigger/TrigSteer/L1Decoder/src/L1Decoder.h   |    2 +-
 .../TrigSteer/TrigSteering/src/TrigSteer.cxx  |    2 +-
 .../src/EventViewCreatorAlgorithm.cxx         |    9 +-
 .../ViewAlgs/src/EventViewCreatorAlgorithm.h  |   10 +-
 .../TrigSteer/ViewAlgsTest/share/EVTest.py    |   28 +-
 .../ViewAlgsTest/share/creatingEVTest.ref     |   15 +-
 .../TrigSteer/ViewAlgsTest/share/menuRun.py   |   15 +-
 .../ViewAlgsTest/share/mergingEVTest.ref      |   15 +-
 .../ViewAlgsTest/src/TestFEXAlgView.cxx       |    9 +-
 .../ViewAlgsTest/src/TestFEXAlgView.h         |    5 +-
 .../ViewAlgsTest/src/TestViewDriver.cxx       |   41 +-
 .../ViewAlgsTest/src/TestViewDriver.h         |   18 +-
 .../Root/GenericArrayCreator.cxx              |    4 +-
 .../L1TopoInterfaces/Root/ConfigurableAlg.cxx |    2 +-
 .../L1TopoMonitoring/src/L1TopoTestAlg.cxx    |    2 +-
 .../L1TopoSimulationUtils/CMakeLists.txt      |    4 +-
 .../share/L1TopoSimulationUtils_test.ref      |   41 +
 .../test/L1TopoSimulationUtils_test.cxx       |   11 +-
 .../src/DeriveSimulationInputs.cxx            |    6 +-
 .../IL1CaloLArTowerEnergy.h                   |    6 +-
 .../L1CaloLArTowerEnergy.h                    |    6 +-
 .../src/L1CaloLArTowerEnergy.cxx              |   12 +-
 .../src/L1CaloPprPhos4ShapeMaker.cxx          |    2 +-
 .../src/PpmCoolMappingTool.cxx                |    4 +-
 .../TrigT1CaloSim/TrigT1CaloSim/CPCMX.h       |    3 -
 .../TrigT1CaloSim/TrigT1CaloSim/CPMSim.h      |    3 -
 .../TrigT1CaloSim/CPMTowerMaker.h             |    3 -
 .../TrigT1CaloSim/TrigT1CaloSim/EnergyCMX.h   |    2 -
 .../TrigT1CaloSim/JEMEnergySim.h              |    2 -
 .../TrigT1CaloSim/TrigT1CaloSim/JEMJetSim.h   |    2 -
 .../TrigT1CaloSim/TrigT1CaloSim/JetCMX.h      |    3 -
 .../TrigT1CaloSim/JetElementMaker.h           |    2 -
 .../TrigT1CaloSim/ReprocessTriggerTowers.h    |    2 -
 .../TrigT1CaloSim/Run2CPMTowerMaker.h         |    3 -
 .../TrigT1CaloSim/Run2JetElementMaker.h       |    3 -
 .../TrigT1CaloSim/TrigT1CaloSim/Tester.h      |    2 -
 Trigger/TrigT1/TrigT1CaloSim/src/CPCMX.cxx    |    5 -
 Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.cxx   |    5 -
 .../TrigT1CaloSim/src/CPMTowerMaker.cxx       |    5 -
 .../TrigT1/TrigT1CaloSim/src/EnergyCMX.cxx    |    6 -
 .../TrigT1/TrigT1CaloSim/src/JEMEnergySim.cxx |    6 -
 .../TrigT1/TrigT1CaloSim/src/JEMJetSim.cxx    |    5 -
 Trigger/TrigT1/TrigT1CaloSim/src/JetCMX.cxx   |    5 -
 .../TrigT1CaloSim/src/JetElementMaker.cxx     |    5 -
 .../src/ReprocessTriggerTowers.cxx            |    6 -
 .../TrigT1CaloSim/src/Run2CPMTowerMaker.cxx   |    4 -
 .../TrigT1CaloSim/src/Run2JetElementMaker.cxx |    4 -
 Trigger/TrigT1/TrigT1CaloSim/src/Tester.cxx   |    7 -
 .../TrigT1CaloSim/src/TriggerTowerMaker.cxx   |    1 -
 .../TrigT1CaloToolInterfaces/IL1EtTools.h     |   18 +-
 .../IL1JetElementTools.h                      |    6 +-
 .../TrigT1CaloTools/L1EtTools.h               |   20 +-
 .../TrigT1CaloTools/L1JetElementTools.h       |    6 +-
 .../TrigT1/TrigT1CaloTools/src/L1EtTools.cxx  |   28 +-
 .../TrigT1CaloTools/src/L1JetElementTools.cxx |    6 +-
 .../src/L1TriggerTowerTool.cxx                |    4 +-
 .../src/Mioct/SectorLogicReader.cxx           |    2 +-
 .../ITrigTRT_DriftCircleProvider.h            |    8 +-
 .../src/TrigInDetTrackFitter.cxx              |    3 +-
 .../TrigInDetVxInJetTool.h                    |    8 +-
 .../TrigInDetVxInJetTool/src/CutTrk.cxx       |    2 +-
 .../TrigInDetVxInJetTool/src/TrigVrtSec.cxx   |    1 -
 .../TrigInDetVxInJetTool/src/Utilities.cxx    |    3 +-
 .../TrigTRT_DriftCircleProviderTool.h         |    8 +-
 .../TrigTruthEventAthenaPool/CMakeLists.txt   |    2 +-
 .../TrigUpgradeTest/CMakeLists.txt            |   66 +-
 .../TrigUpgradeTest/share/IDCalo.py           |  147 +-
 .../TrigUpgradeTest/share/egamma.withViews.py |  213 +-
 .../TrigUpgradeTest/share/mu.withViews.py     |  526 ++-
 .../TrigUpgradeTest/share/testHLT_MT.py       |   51 +-
 .../test/test_egamma_run_data.sh              |    2 +-
 .../TrigUpgradeTest/test/test_graph_view.sh   |    5 -
 .../TrigUpgradeTest/test/test_id_run_mc.sh    |    2 +-
 .../TrigUpgradeTest/test/test_mu_run_data.sh  |    5 +-
 .../test/test_view_schedule.sh                |    5 +
 graphics/JiveXML/src/ONCRPCServerSvc.cxx      |    2 +-
 graphics/VP1/VP1AlgsBatch/CMakeLists.txt      |    6 +-
 graphics/VP1/VP1AlgsEventProd/CMakeLists.txt  |    6 +-
 .../VP1/VP1Base/src/VP1ColorSelectButton.cxx  |    8 +-
 .../VP13DCocktailPlugin/CMakeLists.txt        |   42 +-
 .../VP13DCocktailPlugin_VP1AutoFactory.h      |   29 +
 .../VP1TrackCaloPlugin_VP1AutoFactory.h       |   29 +
 .../src/VP13DCocktailChannel.cxx              |    2 +-
 .../VP13DCocktailPlugin_VP1AutoFactory.cxx    |   38 +
 .../src/VP1TrackCaloChannel.cxx               |   10 +-
 .../src/VP1TrackCaloPlugin_VP1AutoFactory.cxx |   38 +
 .../VP1AODPlugin_VP1AutoFactory.h             |    3 +-
 .../src/VP1AODPlugin_VP1AutoFactory.cxx       |    3 +-
 .../src/IParticleCollHandle_Jet.cxx           |    3 +
 .../VP1AODSystems/src/IParticleHandle_Jet.cxx |   28 +-
 .../src/JetCollectionSettingsButton.cxx       |    3 +-
 .../src/jet_settings_display_form.ui          |    4 +-
 .../VP1Systems/VP1BPhysSystems/CMakeLists.txt |    2 +-
 .../VP1Systems/VP1CaloSystems/CMakeLists.txt  |    7 +-
 .../VP1CaloSystems/VP1CaloCellController.h    |   22 +-
 .../src/VP1CaloCellController.cxx             |  362 +-
 .../VP1CaloSystems/src/VP1CaloCellSystem.cxx  |    2 +-
 .../VP1PRDSystems/PRDCollHandleBase.h         |    2 +-
 .../VP1PRDSystems/PRDCollHandle_CSC.h         |    2 +-
 .../VP1PRDSystems/PRDCollHandle_CSC_Strip.h   |    2 +-
 .../VP1PRDSystems/PRDCollHandle_MDT.h         |    4 +-
 .../VP1PRDSystems/PRDCollHandle_MM.h          |    4 +-
 .../VP1PRDSystems/PRDCollHandle_Pixel.h       |    4 +-
 .../VP1PRDSystems/PRDCollHandle_RPC.h         |    2 +-
 .../VP1PRDSystems/PRDCollHandle_SCT.h         |    2 +-
 .../VP1PRDSystems/PRDCollHandle_SpacePoints.h |    2 +-
 .../VP1PRDSystems/PRDCollHandle_TGC.h         |    2 +-
 .../VP1PRDSystems/PRDCollHandle_TRT.h         |    2 +-
 .../VP1PRDSystems/PRDCollHandle_sTGC.h        |    2 +-
 .../VP1PRDSystems/src/PRDCollHandle_CSC.cxx   |    6 +-
 .../src/PRDCollHandle_CSC_Strip.cxx           |    6 +-
 .../VP1PRDSystems/src/PRDCollHandle_MDT.cxx   |    6 +-
 .../VP1PRDSystems/src/PRDCollHandle_MM.cxx    |    6 +-
 .../VP1PRDSystems/src/PRDCollHandle_Pixel.cxx |    6 +-
 .../VP1PRDSystems/src/PRDCollHandle_RPC.cxx   |    6 +-
 .../VP1PRDSystems/src/PRDCollHandle_SCT.cxx   |    6 +-
 .../VP1PRDSystems/src/PRDCollHandle_TGC.cxx   |    6 +-
 .../VP1PRDSystems/src/PRDCollHandle_TRT.cxx   |    6 +-
 .../VP1PRDSystems/src/PRDCollHandle_sTGC.cxx  |    6 +-
 .../VP1TestSystems/Example3DSystem3.h         |    2 +-
 .../VP1TestSystems/Example3DSystem4.h         |    2 +-
 .../VP1TestSystems/Example3DSystem5.h         |    2 +-
 .../VP1TestSystems/src/Example3DSystem2.cxx   |    2 +-
 .../VP1TestSystems/src/Example3DSystem3.cxx   |    2 +-
 .../VP1TestSystems/src/Example3DSystem4.cxx   |    2 +-
 .../VP1TestSystems/src/Example3DSystem5.cxx   |    2 +-
 .../src/TrackCollHandle_TruthTracks.cxx       |    2 +-
 .../src/TrackHandle_TrkTrack.cxx              |    7 +-
 .../VP1UtilitySystems/CMakeLists.txt          |    4 +-
 .../VP1UtilitySystems/VP1PartSpectSystem.h    |    1 +
 .../src/VP1ExtraInputSystem.cxx               |    5 +-
 .../src/VP1PartSpectSystem.cxx                |   25 +-
 1090 files changed, 12983 insertions(+), 33248 deletions(-)
 create mode 100644 Control/AthContainers/AthContainers/ATLAS_CHECK_THREAD_SAFETY
 delete mode 100644 Control/AthContainers/AthContainers/UserDataStore.h
 delete mode 100644 Control/AthContainers/AthContainers/tools/UDSLabelHashTable.h
 delete mode 100644 Control/AthContainers/AthContainers/tools/foreach.h
 delete mode 100644 Control/AthContainers/Root/UDSLabelHashTable.cxx
 delete mode 100644 Control/AthContainers/Root/UserDataStore.cxx
 delete mode 100644 Control/AthContainers/share/foreach_test.ref
 delete mode 100644 Control/AthContainers/test/foreach_test.cxx
 delete mode 100644 Control/AthViews/AthViews/GraphExecutionTask.h
 create mode 100644 Control/AthViews/share/SimpleViewExample.py
 create mode 100644 Control/AthViews/share/ViewNest.py
 rename Control/AthViews/share/{GraphViews.py => ViewScheduling.py} (58%)
 delete mode 100755 Control/AthViews/src/AthViewAlgorithm.cxx
 delete mode 100644 Control/AthViews/src/GraphExecutionTask.cxx
 rename Control/AthViews/{src_dflow => src}/RoiCollectionToViews.cxx (70%)
 rename Control/AthViews/{src_dflow => src}/RoiCollectionToViews.h (67%)
 create mode 100644 Control/AthViews/src/ViewDataVerifier.cxx
 rename Control/AthViews/{AthViews/AthViewAlgorithm.h => src/ViewDataVerifier.h} (50%)
 mode change 100755 => 100644
 rename Control/AthViews/{src_dflow => src}/ViewTestAlg.cxx (100%)
 rename Control/AthViews/{src_dflow => src}/ViewTestAlg.h (100%)
 create mode 100644 Control/AthViews/src/components/AthViews_entries.cxx
 create mode 100755 Control/AthViews/test/test_simple_view_example.sh
 create mode 100755 Control/AthViews/test/test_view_nest_fail.sh
 create mode 100755 Control/AthViews/test/test_view_scheduling.sh
 delete mode 100644 Control/AthenaKernel/AthenaKernel/IUserDataSvc.h
 delete mode 100644 Control/DataModelAthenaPool/DataModelAthenaPool/UDSLabelHashTableCnv_p1.h
 delete mode 100644 Control/DataModelAthenaPool/DataModelAthenaPool/UDSLabelHashTable_p1.h
 delete mode 100644 Control/DataModelAthenaPool/DataModelAthenaPool/UserDataStoreCnv_p1.h
 delete mode 100644 Control/DataModelAthenaPool/DataModelAthenaPool/UserDataStore_p1.h
 delete mode 100644 Control/DataModelAthenaPool/src/UDSLabelHashTableCnv_p1.cxx
 delete mode 100644 Control/DataModelAthenaPool/src/UserDataStoreCnv.cxx
 delete mode 100644 Control/DataModelAthenaPool/src/UserDataStoreCnv.h
 delete mode 100644 Control/DataModelAthenaPool/src/UserDataStoreCnv_p1.cxx
 create mode 100644 Control/RngComps/share/RNGWrapper_test.ref
 delete mode 100644 Database/APR/PersistencySvc/PersistencySvc/IPersistencySvcFactory.h
 create mode 100644 Database/APR/PersistencySvc/src/IPersistencySvc.cpp
 delete mode 100644 Database/APR/PersistencySvc/src/IPersistencySvcFactory.cpp
 mode change 100644 => 100755 Database/AthenaRoot/AthenaRootComps/share/test_athena_variable_shape_merged.ref
 create mode 100644 Event/xAOD/xAODTruthCnv/Root/TruthMetaDataTool.cxx
 create mode 100644 Event/xAOD/xAODTruthCnv/xAODTruthCnv/TruthMetaDataTool.h
 create mode 100644 Event/xAOD/xAODTruthCnv/xAODTruthCnv/selection.xml
 create mode 100644 Event/xAOD/xAODTruthCnv/xAODTruthCnv/xAODTruthCnvDict.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/python/GlobalChi2Align_IteratorClasses.py
 delete mode 100755 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/GenAlignIterator.py
 delete mode 100755 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/GenAlignIteratorBatch.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L1_MSID_Flags.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L23MdtFlags.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3CSCFlags.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3MdtFlags.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3MdtFlags_muidSA.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/bfield_off.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/doBarrelOnly.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/doEndcapOnly.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/runargs.ESDtoESD.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/runargs.RDOtoESD.py
 delete mode 100755 MuonSpectrometer/MuonAlignment/MuonAlignExample/share/submitMonitoringToGridDESD-inOneGo2
 delete mode 100755 MuonSpectrometer/MuonAlignment/MuonAlignExample/test/MuonAlignExample_TestConfiguration.xml
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/CMakeLists.txt
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CommonGeometryManagerTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CscAlignDBTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CscGeometryManagerTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MdtAlignDBTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MdtGeometryManagerTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignDBTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignHelperTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignModuleTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignRefitTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonFillNtupleTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonGeometryManagerTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonTrackCollectionProvider.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonTrackPreProcessor.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/TgcGeometryManagerTool.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/UnbiasedMuonResiduals.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/doc/packagedoc.h
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureFullReco.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureMuonAlignment.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureMuonStandaloneReco.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureSolveMuonAlignment.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/CscAlignDBToolGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/IOFiles.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MdtAlignDBToolGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MdtGeometryManagerToolGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignDBToolGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignModuleToolGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignRefitToolGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignmentFlags.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignmentIOFiles.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonFillNtupleToolGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonGeometryManagerToolGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonTrackCollectionProviderGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonTrackPreProcessorGetter.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/share/MuonDataRec_myTopOptions.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/share/unbiasedMuonResiduals_jobOptions.py
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CommonGeometryManagerTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CscAlignDBTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CscGeometryManagerTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MdtAlignDBTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MdtGeometryManagerTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignDBTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignHelperTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignModuleTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignRefitTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonFillNtupleTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonGeometryManagerTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonTrackCollectionProvider.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonTrackPreProcessor.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/TgcGeometryManagerTool.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/UnbiasedMuonResiduals.cxx
 delete mode 100644 MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/components/MuonAlignGenTools_entries.cxx
 create mode 100644 MuonSpectrometer/MuonDigitization/sTGC_Digitization/sTGC_Digitization/sTgcSimDigitData.h
 create mode 100644 MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcSimDigitData.cxx
 delete mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_JPsi_no_pileup.sh
 delete mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_JPsi_with_pileup.sh
 delete mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ZPrime_no_pileup.sh
 delete mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ZPrime_with_pileup.sh
 delete mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_Z_no_pileup.sh
 delete mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_Z_with_pileup.sh
 delete mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ttbar_no_pileup.sh
 delete mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ttbar_with_pileup.sh
 create mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_jpsi_no_pileup.sh
 create mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_jpsi_with_pileup.sh
 create mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_ttbar_no_pileup.sh
 create mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_ttbar_with_pileup.sh
 create mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_z_no_pileup.sh
 create mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_z_with_pileup.sh
 create mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_zprime_no_pileup.sh
 create mode 100755 MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_zprime_with_pileup.sh
 delete mode 100644 Reconstruction/MET/METReconstruction/util/example_METAssoc.cxx
 create mode 100644 Reconstruction/PFlow/PFlowUtils/src/CombinePFO.cxx
 create mode 100644 Reconstruction/PFlow/PFlowUtils/src/CombinePFO.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCS1DRegression.cxx
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCS1DRegression.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCSFunction.cxx
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCSFunction.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/firstPCA.cxx
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/firstPCA.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/secondPCA.cxx
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/secondPCA.h
 create mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
 create mode 100755 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py
 create mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py
 create mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/IntArray_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionHistogram_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionRegressionTF_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionRegression_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunction_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSEnergyParametrization_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSExtrapolationState_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSPCAEnergyParametrization_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSParametrizationBase_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSParametrization_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSSimulationState_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSTruthState_linkdef.h
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/epara_validation_plots.C
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/init_epara.C
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/init_epara_validation.C
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run_epara.C
 delete mode 100644 Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run_epara_validation.C
 delete mode 100644 Tracking/TrkAlignment/TrkAlignGenAlgs/python/AlignAlgGetter.py
 delete mode 100644 Tracking/TrkAlignment/TrkAlignGenTools/python/AlignTrackDresserGetter.py
 delete mode 100644 Tracking/TrkAlignment/TrkAlignGenTools/python/ShiftingDerivCalcToolGetter.py
 create mode 100755 Trigger/TrigAlgorithms/TrigmuComb/TrigmuComb/muCombMT.h
 create mode 100755 Trigger/TrigAlgorithms/TrigmuComb/python/TrigmuCombMTConfig.py
 create mode 100755 Trigger/TrigAlgorithms/TrigmuComb/src/muCombMT.cxx
 create mode 100644 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/CMakeLists.txt
 create mode 100755 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/TrigCaloDataAccessSvc/ITrigCaloDataAccessSvc.h
 create mode 100644 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/share/testDataAccessService.py
 create mode 100644 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TestCaloDataAccess.cxx
 create mode 100644 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TestCaloDataAccess.h
 create mode 100644 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TrigCaloDataAccessSvc.cxx
 create mode 100644 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TrigCaloDataAccessSvc.h
 create mode 100644 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/components/TrigCaloDataAccessSvc_entries.cxx
 create mode 100755 Trigger/TrigDataAccess/TrigCaloDataAccessSvc/test/test_dataaccess.sh
 create mode 100644 Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigmuCombHypoAlg.h
 create mode 100644 Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigmuCombHypoTool.h
 create mode 100644 Trigger/TrigHypothesis/TrigMuonHypo/src/TrigmuCombHypoAlg.cxx
 create mode 100644 Trigger/TrigHypothesis/TrigMuonHypo/src/TrigmuCombHypoTool.cxx
 create mode 100644 Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/share/L1TopoSimulationUtils_test.ref
 delete mode 100755 Trigger/TrigValidation/TrigUpgradeTest/test/test_graph_view.sh
 create mode 100755 Trigger/TrigValidation/TrigUpgradeTest/test/test_view_schedule.sh
 create mode 100644 graphics/VP1/VP1Plugins/VP13DCocktailPlugin/VP13DCocktailPlugin/VP13DCocktailPlugin_VP1AutoFactory.h
 create mode 100644 graphics/VP1/VP1Plugins/VP13DCocktailPlugin/VP13DCocktailPlugin/VP1TrackCaloPlugin_VP1AutoFactory.h
 create mode 100644 graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP13DCocktailPlugin_VP1AutoFactory.cxx
 create mode 100644 graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP1TrackCaloPlugin_VP1AutoFactory.cxx

diff --git a/AtlasTest/ControlTest/test/SGDataLink_test.cxx b/AtlasTest/ControlTest/test/SGDataLink_test.cxx
index b1658cd220b..eae140a22cc 100644
--- a/AtlasTest/ControlTest/test/SGDataLink_test.cxx
+++ b/AtlasTest/ControlTest/test/SGDataLink_test.cxx
@@ -290,7 +290,7 @@ namespace Athena_test
       dummyToRemoveWarning(r3Foo);
       cout << "ERROR should never get here" <<endl;
       assert(0);
-    } catch (runtime_error e) {
+    } catch (const runtime_error& e) {
       cout << "foo Foo not yet registered. Caught exception -"
  	   << e.what()<< "- as expected" << endl;
     }	
diff --git a/AtlasTest/DatabaseTest/AthenaDBTestRec/CMakeLists.txt b/AtlasTest/DatabaseTest/AthenaDBTestRec/CMakeLists.txt
index 041387bdf04..d2e2a13aef1 100644
--- a/AtlasTest/DatabaseTest/AthenaDBTestRec/CMakeLists.txt
+++ b/AtlasTest/DatabaseTest/AthenaDBTestRec/CMakeLists.txt
@@ -17,7 +17,6 @@ atlas_depends_on_subdirs( PUBLIC
                           PRIVATE
                           Database/APR/CollectionBase
                           Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
                           Database/APR/PersistencySvc
                           Database/APR/StorageSvc
                           Database/AthenaPOOL/AthenaPoolCnvSvc
@@ -39,30 +38,30 @@ atlas_add_library( AthenaDBTestRecLib
                    PUBLIC_HEADERS AthenaDBTestRec
                    PRIVATE_INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
                    LINK_LIBRARIES AthenaBaseComps AthenaKernel SGTools AthenaPoolUtilities GaudiKernel StoreGateLib SGtests AthenaPoolCnvSvcLib
-                   PRIVATE_LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc CoraCool PersistentDataModel EventInfo )
+                   PRIVATE_LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} CollectionBase CollectionUtilities PersistencySvc StorageSvc CoraCool PersistentDataModel EventInfo )
 
 atlas_add_component( AthenaDBTestRec
                      src/components/*.cxx
                      INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests AthenaPoolUtilities GaudiKernel CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolCnvSvcLib CoraCool PersistentDataModel EventInfo AthenaDBTestRecLib )
+                     LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests AthenaPoolUtilities GaudiKernel CollectionBase CollectionUtilities PersistencySvc StorageSvc AthenaPoolCnvSvcLib CoraCool PersistentDataModel EventInfo AthenaDBTestRecLib )
 
 atlas_add_poolcnv_library( AthenaDBTestRecPoolCnv
                            src/*.cxx
                            FILES AthenaDBTestRec/TestCoolRecPoolData.h AthenaDBTestRec/TestCoolRecPoolDataColl.h
                            MULT_CHAN_TYPES TestCoolRecPoolDataColl
                            INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                           LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests AthenaPoolUtilities GaudiKernel CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolCnvSvcLib CoraCool PersistentDataModel EventInfo AthenaDBTestRecLib )
+                           LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests AthenaPoolUtilities GaudiKernel CollectionBase CollectionUtilities PersistencySvc StorageSvc AthenaPoolCnvSvcLib CoraCool PersistentDataModel EventInfo AthenaDBTestRecLib )
 
 atlas_add_dictionary( AthenaDBTestRecDataDict
                       AthenaDBTestRec/AthenaDBTestRecDataDict.h
                       AthenaDBTestRec/selection.xml
                       INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests AthenaPoolUtilities GaudiKernel CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolCnvSvcLib CoraCool PersistentDataModel EventInfo AthenaDBTestRecLib )
+                      LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests AthenaPoolUtilities GaudiKernel CollectionBase CollectionUtilities PersistencySvc StorageSvc AthenaPoolCnvSvcLib CoraCool PersistentDataModel EventInfo AthenaDBTestRecLib )
 
 atlas_add_executable( TestCoolRecWriter
                       src/app/*.cxx
                       INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests AthenaPoolUtilities GaudiKernel CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolCnvSvcLib CoraCool PersistentDataModel EventInfo AthenaDBTestRecLib )
+                      LINK_LIBRARIES ${COOL_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests AthenaPoolUtilities GaudiKernel CollectionBase CollectionUtilities PersistencySvc StorageSvc AthenaPoolCnvSvcLib CoraCool PersistentDataModel EventInfo AthenaDBTestRecLib )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/AtlasTest/DatabaseTest/AthenaDBTestRec/src/app/TestCoolRecWriter.cxx b/AtlasTest/DatabaseTest/AthenaDBTestRec/src/app/TestCoolRecWriter.cxx
index f98e8aa31d6..9a5e2c5dc3c 100644
--- a/AtlasTest/DatabaseTest/AthenaDBTestRec/src/app/TestCoolRecWriter.cxx
+++ b/AtlasTest/DatabaseTest/AthenaDBTestRec/src/app/TestCoolRecWriter.cxx
@@ -17,7 +17,6 @@
 #include "PersistentDataModel/Placement.h"
 #include "PersistentDataModel/Token.h"
 #include "PersistencySvc/ISession.h"
-#include "PersistencySvc/IPersistencySvcFactory.h"
 #include "PersistencySvc/IPersistencySvc.h"
 #include "PersistencySvc/DatabaseConnectionPolicy.h"
 #include "PersistencySvc/ITransaction.h"
@@ -574,29 +573,12 @@ bool TestCoolRecWriter::setupPool() {
 	      << std::endl;
   }
   m_poolcat->start();
-
-  /*  MN: commenting it out, need to test if the dict get loaded automaticalle
-  // now load dictionary library
-  std::string library="libAthenaDBTestRecDataDict.so";
-  std::cout << "Load library " << library << std::endl;
-  Reflex::SharedLibrary libloader(library);
-  if (!libloader.Load()) {
-    std::cout << "Cannot load dictionary libaray " << library << std::endl;
-  }
-  */
-  
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  m_persistencySvc = psfactory? (psfactory->create("PersistencySvc", *m_poolcat)) : 0; 
-  if( m_persistencySvc ) {
-    pool::DatabaseConnectionPolicy policy;
-    policy.setWriteModeForNonExisting(pool::DatabaseConnectionPolicy::CREATE);
-    policy.setWriteModeForExisting(pool::DatabaseConnectionPolicy::UPDATE);
-    m_persistencySvc->session().setDefaultConnectionPolicy(policy);
-    m_persistencySvc->session().transaction().start(pool::ITransaction::UPDATE);
-  } else {
-    std::cout << "Error setting up pool::PersistencySvc" << std::endl;
-    return false;
-  }
+  m_persistencySvc = pool::IPersistencySvc::create(*m_poolcat).release();
+  pool::DatabaseConnectionPolicy policy;
+  policy.setWriteModeForNonExisting(pool::DatabaseConnectionPolicy::CREATE);
+  policy.setWriteModeForExisting(pool::DatabaseConnectionPolicy::UPDATE);
+  m_persistencySvc->session().setDefaultConnectionPolicy(policy);
+  m_persistencySvc->session().transaction().start(pool::ITransaction::UPDATE);
   return true;
 }
 
diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/CMakeLists.txt b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/CMakeLists.txt
index 59853cd6e8e..0ed62276852 100644
--- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/CMakeLists.txt
+++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/CMakeLists.txt
@@ -18,8 +18,6 @@ atlas_depends_on_subdirs( PUBLIC
                           Database/APR/CollectionBase
                           Database/APR/CollectionUtilities
                           Database/APR/POOLCore
-                          Database/APR/PersistencySvc
-                          Database/APR/StorageSvc
                           Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleData
                           Database/AthenaPOOL/AthenaPoolUtilities
                           Database/PersistentDataModel
@@ -40,12 +38,12 @@ atlas_add_library( AthenaPoolMultiTestLib
                    PUBLIC_HEADERS AthenaPoolMultiTest
                    PRIVATE_INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
                    LINK_LIBRARIES StoreGateLib SGtests GoodRunsListsLib ByteStreamData_test
-                   PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaPoolTestData AthenaBaseComps SGTools CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolExampleData AthenaPoolUtilities PersistentDataModel DBDataModel ByteStreamData EventInfo xAODEventInfo GaudiKernel )
+                   PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaPoolTestData AthenaBaseComps SGTools CollectionBase CollectionUtilities POOLCore AthenaPoolExampleData AthenaPoolUtilities PersistentDataModel DBDataModel ByteStreamData EventInfo xAODEventInfo GaudiKernel )
 
 atlas_add_component( AthenaPoolMultiTest
                      src/components/*.cxx
                      INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaPoolTestData AthenaBaseComps SGTools StoreGateLib SGtests GoodRunsListsLib CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolExampleData AthenaPoolUtilities DBDataModel ByteStreamData ByteStreamData_test EventInfo xAODEventInfo GaudiKernel AthenaPoolMultiTestLib )
+                     LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaPoolTestData AthenaBaseComps SGTools StoreGateLib SGtests GoodRunsListsLib CollectionBase CollectionUtilities POOLCore AthenaPoolExampleData AthenaPoolUtilities DBDataModel ByteStreamData ByteStreamData_test EventInfo xAODEventInfo GaudiKernel AthenaPoolMultiTestLib )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h
index 4c2dc7dfd1d..926fc13bd94 100755
--- a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h
+++ b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h
@@ -171,7 +171,7 @@ class CaloDetDescrElement : public Identifiable
 
   /** @brief cell identifier
    */
-  Identifier identify () const;
+  Identifier identify () const override final;
 
   /** @brief cell online identifier 1
    */
@@ -189,7 +189,7 @@ class CaloDetDescrElement : public Identifiable
   /** @brief cell subcalo hash 
       same as subcalo_hash(), but kept for backward compatibility 
   */
-  IdentifierHash identifyHash() const;
+  IdentifierHash identifyHash() const override final;
 
   /** @brief cell descriptor
    */
diff --git a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescriptor.h b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescriptor.h
index a9432b9cb34..190c6f5b1de 100755
--- a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescriptor.h
+++ b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescriptor.h
@@ -136,10 +136,10 @@ class CaloDetDescriptor : public Identifiable
 
   /** @brief get region identifier
    */
-  Identifier identify() const;               
+  Identifier identify() const override final;
   /** @brief get hash identifier for the region
    */
-  IdentifierHash identifyHash() const;       
+  IdentifierHash identifyHash() const  override final;
   /** @brief get calo hash
    */
   IdentifierHash calo_hash() const;
diff --git a/Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h b/Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h
index 07ac2b8280f..8317f038f3f 100755
--- a/Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h
+++ b/Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h
@@ -101,16 +101,16 @@ public:
   /**
    * @brief identifer for Tile testbeam detectors of a give type
    */
-  Identifier          type_id                 ( int type)                     const throw(TileID_Exception);
+  Identifier          type_id                 ( int type)                     const;
   /**
    * @brief identifer for one module of a Tile testbeam detector
    */
-  Identifier          module_id               ( int type, int module )        const throw(TileID_Exception);
+  Identifier          module_id               ( int type, int module )        const;
   /**
    * @brief identifer for one channel of a Tile testbeam detector
    */
   Identifier          channel_id              ( int type, int module, 
-                                                int channel )                 const throw(TileID_Exception);
+                                                int channel )                 const;
 
   /**
    * @brief extract module ID from channel ID
@@ -120,7 +120,7 @@ public:
    * @brief create channel ID from module ID
    */
   Identifier          channel_id              ( const Identifier& id,
-                                                int channel )                 const throw(TileID_Exception); 
+                                                int channel )                 const; 
 
   /**
    * @brief Test ID if it is TileTBID
diff --git a/Calorimeter/CaloIdentifier/src/TileTBID.cxx b/Calorimeter/CaloIdentifier/src/TileTBID.cxx
index 3442a3d335a..83aa0de7383 100755
--- a/Calorimeter/CaloIdentifier/src/TileTBID.cxx
+++ b/Calorimeter/CaloIdentifier/src/TileTBID.cxx
@@ -106,7 +106,7 @@ TileTBID::tiletb_id     ()      const
 // Build type & module id
 //
 Identifier
-TileTBID::type_id       ( int type )      const throw(TileID_Exception)
+TileTBID::type_id       ( int type )      const
 {
 #ifndef NDEBUG
     if(m_do_checks) {
@@ -140,7 +140,7 @@ TileTBID::type_id       ( int type )      const throw(TileID_Exception)
 }
 
 Identifier
-TileTBID::module_id       ( int type, int module )       const throw(TileID_Exception)
+TileTBID::module_id       ( int type, int module )       const
 {
 #ifndef NDEBUG
     if(m_do_checks) {
@@ -178,7 +178,7 @@ TileTBID::module_id       ( int type, int module )       const throw(TileID_Exce
 // Build channel id
 //
 Identifier
-TileTBID::channel_id ( int type, int module, int channel ) const throw(TileID_Exception)
+TileTBID::channel_id ( int type, int module, int channel ) const
 {
 #ifndef NDEBUG
     if(m_do_checks) {
@@ -224,7 +224,7 @@ TileTBID::module_id     ( const Identifier & any_id )   const
 
 Identifier
 TileTBID::channel_id    ( const Identifier & module_id, 
-                          int channel )                     const throw(TileID_Exception)
+                          int channel )                     const
 {
     Identifier compactId(module_id);
     m_channel_impl.pack(channel,compactId);
diff --git a/Calorimeter/CaloTriggerTool/CaloTriggerTool/CaloTriggerTowerService.h b/Calorimeter/CaloTriggerTool/CaloTriggerTool/CaloTriggerTowerService.h
index f7c67106106..b86404396b8 100755
--- a/Calorimeter/CaloTriggerTool/CaloTriggerTool/CaloTriggerTowerService.h
+++ b/Calorimeter/CaloTriggerTool/CaloTriggerTool/CaloTriggerTowerService.h
@@ -71,30 +71,30 @@ class CaloTriggerTowerService : public AthAlgTool
    * create a TT HWIdentifier from a TT Identifier
    *
    */
-  HWIdentifier createTTChannelID(const Identifier & id, bool bQuiet=false) throw(CaloID_Exception) ;
+  HWIdentifier createTTChannelID(const Identifier & id, bool bQuiet=false);
 
 
   /**
    * create a TT Identifier from a TT HWIdentifier
    *
    */
-  Identifier cnvToIdentifier(const HWIdentifier & id, bool bQuiet=false) throw(CaloID_Exception);
+  Identifier cnvToIdentifier(const HWIdentifier & id, bool bQuiet=false);
 
 
   /**
    * create a CoolChannelId (used by TDAQ framework) from a HWIdentifier
    *
    */
-  //unsigned int createL1CoolChannelId( const HWIdentifier & id ) throw(CaloID_Exception);
-  L1CaloCoolChannelId createL1CoolChannelId( const HWIdentifier& id ) throw(CaloID_Exception);
+  //unsigned int createL1CoolChannelId( const HWIdentifier & id );
+  L1CaloCoolChannelId createL1CoolChannelId( const HWIdentifier& id );
 
 
   /**
    * create an HWIdentifier from an TDAQ CoolChannelId
    *
    */
-  //HWIdentifier cnvCoolChannelIdToHWID( const unsigned int coolChannelId ) throw(CaloID_Exception);
-  HWIdentifier cnvCoolChannelIdToHWID( const L1CaloCoolChannelId& coolChannelId ) throw(CaloID_Exception);
+  //HWIdentifier cnvCoolChannelIdToHWID( const unsigned int coolChannelId );
+  HWIdentifier cnvCoolChannelIdToHWID( const L1CaloCoolChannelId& coolChannelId );
 
 
 
@@ -103,7 +103,7 @@ class CaloTriggerTowerService : public AthAlgTool
    * returns a TDAQ CoolChannelId corresponding to a L1CaloRxCoolChannelId
    *
    */
-  L1CaloCoolChannelId cnvRxIdToCoolChannelId(const L1CaloRxCoolChannelId& rxCoolChannelId) throw(CaloID_Exception);
+  L1CaloCoolChannelId cnvRxIdToCoolChannelId(const L1CaloRxCoolChannelId& rxCoolChannelId);
 
 
   /**
@@ -111,18 +111,18 @@ class CaloTriggerTowerService : public AthAlgTool
    *
    */
 
-   std::vector<L1CaloRxCoolChannelId> cnvCoolChannelIdToRxId(const L1CaloCoolChannelId& ppmCoolChannelId) throw(CaloID_Exception);
+   std::vector<L1CaloRxCoolChannelId> cnvCoolChannelIdToRxId(const L1CaloCoolChannelId& ppmCoolChannelId);
 
 
   /** return 0 for z<0 channels and 1 for z>0 channels */
-  unsigned int pos_neg(const HWIdentifier & id) throw(CaloID_Exception);
+  unsigned int pos_neg(const HWIdentifier & id);
 
   /** return the corresponding sampling of channelId:
       @return 0: for EM calorimeter
       @return 1: for HAD calorimeter
       @return 999: error
   */
-  unsigned int em_had(const HWIdentifier & id) throw(CaloID_Exception);
+  unsigned int em_had(const HWIdentifier & id);
 
   /** To know if a channel belongs to the barrel, end cap or fcal parts
       @return 0: barrel
@@ -130,7 +130,7 @@ class CaloTriggerTowerService : public AthAlgTool
       @return 2: fcal
       @return 999: error
   */
-  unsigned int barrel_endcap_fcal(const HWIdentifier & id) throw(CaloID_Exception);
+  unsigned int barrel_endcap_fcal(const HWIdentifier & id);
 
   /** To get the type of the module connected to the channel:
       @return 1: PPM
@@ -138,7 +138,7 @@ class CaloTriggerTowerService : public AthAlgTool
       @return 3: JEM
       @return 999: error
   */
-  unsigned int module_type(const HWIdentifier & id) throw(CaloID_Exception);
+  unsigned int module_type(const HWIdentifier & id);
 
 
   //
diff --git a/Calorimeter/CaloTriggerTool/src/CaloTriggerTowerService.cxx b/Calorimeter/CaloTriggerTool/src/CaloTriggerTowerService.cxx
index 618f353ba26..bb60da6ccfd 100755
--- a/Calorimeter/CaloTriggerTool/src/CaloTriggerTowerService.cxx
+++ b/Calorimeter/CaloTriggerTool/src/CaloTriggerTowerService.cxx
@@ -172,7 +172,7 @@ bool CaloTriggerTowerService::is_initialized () const
 
 
 //===========================================================
-HWIdentifier  CaloTriggerTowerService::createTTChannelID(const Identifier & id, bool bQuiet) throw(CaloID_Exception)
+HWIdentifier  CaloTriggerTowerService::createTTChannelID(const Identifier & id, bool bQuiet)
 {
 
 	HWIdentifier invalidId (0);
@@ -204,7 +204,7 @@ HWIdentifier  CaloTriggerTowerService::createTTChannelID(const Identifier & id,
 
 
 //===========================================================================
-Identifier  CaloTriggerTowerService::cnvToIdentifier(const HWIdentifier & id, bool bQuiet) throw(CaloID_Exception)
+Identifier  CaloTriggerTowerService::cnvToIdentifier(const HWIdentifier & id, bool bQuiet)
 {
 	Identifier invalidId (0);
 
@@ -233,7 +233,7 @@ Identifier  CaloTriggerTowerService::cnvToIdentifier(const HWIdentifier & id, bo
 	}
 }
 
-L1CaloCoolChannelId CaloTriggerTowerService::cnvRxIdToCoolChannelId(const L1CaloRxCoolChannelId& rxCoolChannelId) throw(CaloID_Exception) {
+L1CaloCoolChannelId CaloTriggerTowerService::cnvRxIdToCoolChannelId(const L1CaloRxCoolChannelId& rxCoolChannelId) {
 
    L1CaloCoolChannelId invalidId;
 
@@ -256,7 +256,7 @@ L1CaloCoolChannelId CaloTriggerTowerService::cnvRxIdToCoolChannelId(const L1Calo
    }
 }
 
-std::vector<L1CaloRxCoolChannelId> CaloTriggerTowerService::cnvCoolChannelIdToRxId(const L1CaloCoolChannelId& ppmCoolChannelId) throw(CaloID_Exception) {
+std::vector<L1CaloRxCoolChannelId> CaloTriggerTowerService::cnvCoolChannelIdToRxId(const L1CaloCoolChannelId& ppmCoolChannelId) {
 
    if(!m_caloTTPpmRxIdMap ) {
      msg() << MSG::ERROR << " No CaloTTPpmRxIdMap !" << endmsg;
@@ -278,7 +278,7 @@ std::vector<L1CaloRxCoolChannelId> CaloTriggerTowerService::cnvCoolChannelIdToRx
 }
 
 //==========================================================================
-unsigned int CaloTriggerTowerService::barrel_endcap_fcal(const HWIdentifier & id) throw(CaloID_Exception) {
+unsigned int CaloTriggerTowerService::barrel_endcap_fcal(const HWIdentifier & id) {
 
     if(!m_caloTTOnAttrIdMap) {
      msg() << MSG::ERROR << " No TTOnAttrIdMap !" << endmsg;
@@ -292,7 +292,7 @@ unsigned int CaloTriggerTowerService::barrel_endcap_fcal(const HWIdentifier & id
 }
 
 //==========================================================================
-unsigned int CaloTriggerTowerService::em_had(const HWIdentifier & id) throw(CaloID_Exception) {
+unsigned int CaloTriggerTowerService::em_had(const HWIdentifier & id) {
 
     if(!m_caloTTOnAttrIdMap) {
      msg() << MSG::ERROR << " No TTOnAttrIdMap !" << endmsg;
@@ -306,7 +306,7 @@ unsigned int CaloTriggerTowerService::em_had(const HWIdentifier & id) throw(Calo
 }
 
 //==========================================================================
-unsigned int CaloTriggerTowerService::pos_neg(const HWIdentifier & id) throw(CaloID_Exception) {
+unsigned int CaloTriggerTowerService::pos_neg(const HWIdentifier & id) {
 
     if(!m_caloTTOnAttrIdMap) {
      msg() << MSG::ERROR << " No TTOnAttrIdMap !" << endmsg;
@@ -319,7 +319,7 @@ unsigned int CaloTriggerTowerService::pos_neg(const HWIdentifier & id) throw(Cal
     }
 }
 
-unsigned int CaloTriggerTowerService::module_type(const HWIdentifier & id) throw(CaloID_Exception) {
+unsigned int CaloTriggerTowerService::module_type(const HWIdentifier & id) {
 
 
     if(!m_caloTTOnAttrIdMap) {
@@ -335,7 +335,7 @@ unsigned int CaloTriggerTowerService::module_type(const HWIdentifier & id) throw
 
 
 //===========================================================
-L1CaloCoolChannelId CaloTriggerTowerService::createL1CoolChannelId( const HWIdentifier & id ) throw(CaloID_Exception) {
+L1CaloCoolChannelId CaloTriggerTowerService::createL1CoolChannelId( const HWIdentifier & id ) {
 
     if(m_caloTTOnAttrIdMap) {
 
@@ -360,7 +360,7 @@ L1CaloCoolChannelId CaloTriggerTowerService::createL1CoolChannelId( const HWIden
 
 
 //===========================================================
-HWIdentifier CaloTriggerTowerService::cnvCoolChannelIdToHWID( const L1CaloCoolChannelId& coolChannelId ) throw(CaloID_Exception) {
+HWIdentifier CaloTriggerTowerService::cnvCoolChannelIdToHWID( const L1CaloCoolChannelId& coolChannelId ) {
 
     unsigned int       crate = coolChannelId.crate();
     unsigned int      module = coolChannelId.module(false); // get the physical module position
diff --git a/Control/AthAllocators/share/DataPool_test.ref b/Control/AthAllocators/share/DataPool_test.ref
index 2d04da3a150..ee00e9b9f97 100644
--- a/Control/AthAllocators/share/DataPool_test.ref
+++ b/Control/AthAllocators/share/DataPool_test.ref
@@ -1,22 +1,28 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/DataPool_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/AthAllocators/share/../share/DataPool_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/AthAllocators/share/../share/DataPool_test.txt
 JobOptionsSvc        INFO # (6,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO # (8,1): ApplicationMgr.ExtSvc += ["IncidentSvc", "ChronoStatSvc", "AuditorSvc"]
 JobOptionsSvc        INFO Job options successfully read in from ../share/DataPool_test.txt
+MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
-                                          running on lxplus020.cern.ch on Mon Dec 11 13:11:58 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 15:55:24 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
+ServiceManager      DEBUG Initializing service IncidentSvc
 IncidentSvc         DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service ChronoStatSvc
 ChronoStatSvc       DEBUG Service base class initialized successfully
 ChronoStatSvc        INFO  Number of skipped events for MemStat-1
+ServiceManager      DEBUG Initializing service AuditorSvc
 AuditorSvc          DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
 EventDataSvc        DEBUG Service base class initialized successfully
diff --git a/Control/AthAnalysisBaseComps/AthAnalysisBaseComps/AthAnalysisHelper.h b/Control/AthAnalysisBaseComps/AthAnalysisBaseComps/AthAnalysisHelper.h
index 0e728e74e8f..ead06242a63 100644
--- a/Control/AthAnalysisBaseComps/AthAnalysisBaseComps/AthAnalysisHelper.h
+++ b/Control/AthAnalysisBaseComps/AthAnalysisBaseComps/AthAnalysisHelper.h
@@ -210,7 +210,7 @@ public:
   ///evt = ROOT.POOL.TEvent()
   ///...
   ///ROOT.AAH.retrieveMetadata("/Folder","key",evt.inputMetaStore())
-  static std::string retrieveMetadata(const std::string& folder, const std::string& key, ServiceHandle<StoreGateSvc>& inputMetaStore) throw(std::exception) {
+  static std::string retrieveMetadata(const std::string& folder, const std::string& key, ServiceHandle<StoreGateSvc>& inputMetaStore) {
     std::string out("");
     StatusCode result = retrieveMetadata(folder,key,out,inputMetaStore);
     if(result.isFailure()) { std::cout << "ERROR: Could not retrieve IOVMetadata with folder " << folder << " and key " << key << std::endl; }
@@ -220,7 +220,7 @@ public:
 
    ///retrieve metadata from the input metadata storegate. Use checkMetaSG.py to see the 'folder' and 'key' values available
    ///always takes the first CondAttrListCollection (aka IOV) and the first channel number present in that IOV
-   template<typename T> static StatusCode retrieveMetadata(const std::string& folder, const std::string& key, T& out) throw(std::exception) {
+   template<typename T> static StatusCode retrieveMetadata(const std::string& folder, const std::string& key, T& out) {
       ServiceHandle<StoreGateSvc> inputMetaStore("StoreGateSvc/InputMetaDataStore", "AthAnalysisHelper");
       if(inputMetaStore.retrieve().isFailure()) return StatusCode::FAILURE; //must remember to release
       StatusCode result = retrieveMetadata(folder,key,out,inputMetaStore);
@@ -231,7 +231,7 @@ public:
    
    
    ///implemenation where you pass it a particular store instead
-  template<typename T> static StatusCode retrieveMetadata(const std::string& folder, const std::string& key, T& out, ServiceHandle<StoreGateSvc>& inputMetaStore) throw(std::exception) {
+  template<typename T> static StatusCode retrieveMetadata(const std::string& folder, const std::string& key, T& out, ServiceHandle<StoreGateSvc>& inputMetaStore) {
       const IOVMetaDataContainer* cont = 0;
       if( inputMetaStore->retrieve(cont,folder).isFailure()) return StatusCode::FAILURE;
    
@@ -261,7 +261,7 @@ public:
 
   ///retrieve metadata, for a specified IOVTime and a specific channel, unless the channel is -1, in which case we take the first available channel
   ///channels have to be unsigned int, so can use -1 to signal 'take whatever first channel is (it isn't always 0)'
-  template<typename T> static StatusCode retrieveMetadata(const std::string& folder, const std::string& key, T& out, ServiceHandle<StoreGateSvc>& inputMetaStore, const IOVTime& time, int channel=-1) throw(std::exception) {
+  template<typename T> static StatusCode retrieveMetadata(const std::string& folder, const std::string& key, T& out, ServiceHandle<StoreGateSvc>& inputMetaStore, const IOVTime& time, int channel=-1) {
       const IOVMetaDataContainer* cont = 0;
       if( inputMetaStore->retrieve(cont,folder).isFailure()) return StatusCode::FAILURE;
    
@@ -296,7 +296,7 @@ public:
       return StatusCode::SUCCESS;
    }
 
-  template<typename T> static StatusCode retrieveMetadata(const std::string& folder, const std::string& key, T& out, IOVTime time, int channel=-1) throw(std::exception) {
+  template<typename T> static StatusCode retrieveMetadata(const std::string& folder, const std::string& key, T& out, IOVTime time, int channel=-1) {
       ServiceHandle<StoreGateSvc> inputMetaStore("StoreGateSvc/InputMetaDataStore", "AthAnalysisHelper");
       if(inputMetaStore.retrieve().isFailure()) return StatusCode::FAILURE; //must remember to release
       StatusCode result = retrieveMetadata(folder,key,out,inputMetaStore,time,channel);
diff --git a/Control/AthAnalysisBaseComps/src/AthAnalysisHelper.cxx b/Control/AthAnalysisBaseComps/src/AthAnalysisHelper.cxx
index f87269b3c6e..ce44f51c343 100644
--- a/Control/AthAnalysisBaseComps/src/AthAnalysisHelper.cxx
+++ b/Control/AthAnalysisBaseComps/src/AthAnalysisHelper.cxx
@@ -51,7 +51,7 @@ void AthAnalysisHelper::dumpJobOptionProperties(const std::string& client) {
 void AthAnalysisHelper::printAuxElement(const SG::AuxElement& ae) {
    const SG::auxid_set_t& auxids = ae.getAuxIDs();
    SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance();
-   for( auto& aux : auxids) {
+   for( SG::auxid_t aux : auxids) {
       std::string name = reg.getName( aux );
       std::cout << "    " << name << " = ";
       const std::type_info& typeinfo = *reg.getType(aux);
diff --git a/Control/AthContainers/AthContainers/ATLAS_CHECK_THREAD_SAFETY b/Control/AthContainers/AthContainers/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 00000000000..0076643cfbe
--- /dev/null
+++ b/Control/AthContainers/AthContainers/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+AthContainers
diff --git a/Control/AthContainers/AthContainers/AthContainersDict.h b/Control/AthContainers/AthContainers/AthContainersDict.h
index 91b4f5a52d5..8c5a3bd7ab5 100644
--- a/Control/AthContainers/AthContainers/AthContainersDict.h
+++ b/Control/AthContainers/AthContainers/AthContainersDict.h
@@ -5,7 +5,6 @@
 */
 
 
-#include "AthContainers/UserDataStore.h"
 #include "AthContainers/AuxTypeRegistry.h"
 #include "AthContainers/AuxVectorData.h"
 #include "AthContainers/AuxVectorBase.h"
@@ -33,7 +32,7 @@ struct AthContainersInstan
 
 
 namespace {
-  struct GCCXML_DUMMY_INSTANTIATION_ATHCONTAINERS {
+  struct DUMMY_INSTANTIATION_ATHCONTAINERS {
     DataLink<SG::IConstAuxStore> dummy1;
 
     SG::PackedContainer<char>           pchar;
diff --git a/Control/AthContainers/AthContainers/AuxStoreInternal.h b/Control/AthContainers/AthContainers/AuxStoreInternal.h
index 2a023e5fa0c..a75b8816d16 100644
--- a/Control/AthContainers/AthContainers/AuxStoreInternal.h
+++ b/Control/AthContainers/AthContainers/AuxStoreInternal.h
@@ -396,12 +396,8 @@ private:
   /// Record which variables are decorations.
   std::vector<bool> m_isDecoration;
 
-  // Hide this from root --- otherwise we get errors about the dictionary
-  // for this guy's allocator.
-#ifndef __REFLEX__
   /// Set of @c auxid's for which we've created a vector.
   SG::auxid_set_t m_auxids;
-#endif
 
   /// Count changes to @c m_auxids.
   size_t m_tick;
@@ -432,8 +428,8 @@ private:
 
 #ifndef XAOD_STANDALONE
 
-#include "SGTools/BaseInfo.h"
-#include "SGTools/CLASS_DEF.h"
+#include "AthenaKernel/BaseInfo.h"
+#include "AthenaKernel/CLASS_DEF.h"
 SG_BASE( SG::AuxStoreInternal, SG::IAuxStore );
 CLASS_DEF( SG::AuxStoreInternal , 16428258 , 1 )
 
diff --git a/Control/AthContainers/AthContainers/AuxVectorBase.h b/Control/AthContainers/AthContainers/AuxVectorBase.h
index 060e02e678b..be59e406771 100644
--- a/Control/AthContainers/AthContainers/AuxVectorBase.h
+++ b/Control/AthContainers/AthContainers/AuxVectorBase.h
@@ -110,7 +110,6 @@ public:
   AuxVectorBase();
 
 
-#if __cplusplus > 201100
   /**
    * @brief Move constructor.
    * @param rhs The container from which to move.
@@ -123,7 +122,6 @@ public:
    * @param rhs The container from which to move.
    */
   AuxVectorBase& operator= (AuxVectorBase&& rhs);
-#endif
 
 
   /**
@@ -433,7 +431,7 @@ private:
    * An exception is raised if the container has an associated store
    * (but that should never actually happen).
    */
-  void initAuxVectorBase1 (const SG_STD_OR_BOOST::false_type&,
+  void initAuxVectorBase1 (const std::false_type&,
                            SG::OwnershipPolicy /*ownPolicy*/,
                            SG::IndexTrackingPolicy /*indexTrackingPolicy*/);
 
@@ -447,7 +445,7 @@ private:
    * An exception is raised if index tracking is disabled and the container
    * has an associated store.
    */
-  void initAuxVectorBase1 (const SG_STD_OR_BOOST::true_type&,
+  void initAuxVectorBase1 (const std::true_type&,
                            SG::OwnershipPolicy ownPolicy,
                            SG::IndexTrackingPolicy indexTrackingPolicy);
 
@@ -462,7 +460,7 @@ private:
    * @c m_trackIndices.
    */
   template <class ForwardIterator>
-  void setIndices1 (const SG_STD_OR_BOOST::false_type&,
+  void setIndices1 (const std::false_type&,
                     ForwardIterator beg,
                     ForwardIterator end,
                     size_t first);
@@ -479,7 +477,7 @@ private:
    * and indices will be set sequentially, starting with @c first.
    */
   template <class ForwardIterator>
-  void setIndices1 (const SG_STD_OR_BOOST::true_type&,
+  void setIndices1 (const std::true_type&,
                     ForwardIterator beg,
                     ForwardIterator end,
                     size_t first);
@@ -493,7 +491,7 @@ private:
    * @c m_trackIndices.
    */
   template <class ForwardIterator> 
-  void clearIndex1 (const SG_STD_OR_BOOST::false_type&, ForwardIterator elt);
+  void clearIndex1 (const std::false_type&, ForwardIterator elt);
 
 
   /**
@@ -503,7 +501,7 @@ private:
    * This is the auxdata case.
    */
   template <class ForwardIterator>
-  void clearIndex1 (const SG_STD_OR_BOOST::true_type&, ForwardIterator elt);
+  void clearIndex1 (const std::true_type&, ForwardIterator elt);
 
 
   /**
@@ -514,7 +512,7 @@ private:
    * No-auxdata case; a no-op except for checking @c m_trackIndices.
    */
   template <class ForwardIterator>
-  void clearIndices1 (const SG_STD_OR_BOOST::false_type&,
+  void clearIndices1 (const std::false_type&,
                       ForwardIterator,
                       ForwardIterator);
 
@@ -527,7 +525,7 @@ private:
    * Auxdata case.
    */
   template <class ForwardIterator>
-  void clearIndices1 (const SG_STD_OR_BOOST::true_type&,
+  void clearIndices1 (const std::true_type&,
                       ForwardIterator beg,
                       ForwardIterator end);
 
@@ -539,7 +537,7 @@ private:
    *
    * The no-auxdata case; a no-op except for checking @c m_trackIndices.
    */
-  void resize1 (const SG_STD_OR_BOOST::false_type&, size_t size);
+  void resize1 (const std::false_type&, size_t size);
 
 
   /**
@@ -548,7 +546,7 @@ private:
    *
    * The auxdata case.
    */
-  void resize1 (const SG_STD_OR_BOOST::true_type&, size_t size);
+  void resize1 (const std::true_type&, size_t size);
 
 
   /**
@@ -557,7 +555,7 @@ private:
    *
    * The no-auxdata case; a no-op except for checking @c m_trackIndices.
    */
-  void reserve1 (const SG_STD_OR_BOOST::false_type&, size_t size);
+  void reserve1 (const std::false_type&, size_t size);
 
 
   /**
@@ -566,7 +564,7 @@ private:
    *
    * The auxdata case.
    */
-  void reserve1 (const SG_STD_OR_BOOST::true_type&, size_t size);
+  void reserve1 (const std::true_type&, size_t size);
 
 
   /**
@@ -578,7 +576,7 @@ private:
    * No-auxdata version; a no-op except for checking @c m_trackIndices.
    */
   template <class DVL>
-  void shift1 (const SG_STD_OR_BOOST::false_type&,
+  void shift1 (const std::false_type&,
                DVL& cont, size_t pos, ptrdiff_t offs);
 
 
@@ -610,7 +608,7 @@ private:
    * (running destructors as appropriate).
    */
   template <class DVL>
-  void shift1 (const SG_STD_OR_BOOST::true_type&,
+  void shift1 (const std::true_type&,
                DVL& cont, size_t pos, ptrdiff_t offs);
 
 
@@ -623,7 +621,7 @@ private:
    * No-auxdata version; a no-op except for checking @c m_trackIndices.
    */
   template <class ForwardIterator>
-  void moveAux1 (const SG_STD_OR_BOOST::false_type&,
+  void moveAux1 (const std::false_type&,
                  size_t index,
                  ForwardIterator beg,
                  ForwardIterator end);
@@ -643,7 +641,7 @@ private:
    * The auxdata case.
    */
   template <class ForwardIterator>
-  void moveAux1 (const SG_STD_OR_BOOST::true_type&,
+  void moveAux1 (const std::true_type&,
                  size_t index,
                  ForwardIterator beg,
                  ForwardIterator end);
@@ -658,7 +656,7 @@ private:
    * No-auxdata version; a no-op except for checking @c m_trackIndices.
    */
   template <class ForwardIterator>
-  void resortAux1 (const SG_STD_OR_BOOST::false_type&,
+  void resortAux1 (const std::false_type&,
                    size_t index,
                    ForwardIterator beg,
                    ForwardIterator end);
@@ -678,7 +676,7 @@ private:
    * The auxdata case.
    */
   template <class ForwardIterator>
-  void resortAux1 (const SG_STD_OR_BOOST::true_type&,
+  void resortAux1 (const std::true_type&,
                    size_t index,
                    ForwardIterator a,
                    ForwardIterator b);
diff --git a/Control/AthContainers/AthContainers/AuxVectorBase.icc b/Control/AthContainers/AthContainers/AuxVectorBase.icc
index f56d5745e08..b9ee2863916 100644
--- a/Control/AthContainers/AthContainers/AuxVectorBase.icc
+++ b/Control/AthContainers/AthContainers/AuxVectorBase.icc
@@ -122,7 +122,7 @@ void AuxVectorBase::setIndices (ForwardIterator beg,
  */
 template <class ForwardIterator>
 inline
-void AuxVectorBase::setIndices1 (const SG_STD_OR_BOOST::false_type&,
+void AuxVectorBase::setIndices1 (const std::false_type&,
                                  ForwardIterator,
                                  ForwardIterator,
                                  size_t)
@@ -142,7 +142,7 @@ void AuxVectorBase::setIndices1 (const SG_STD_OR_BOOST::false_type&,
  * and indices will be set sequentially, starting with @c first.
  */
 template <class ForwardIterator>
-void AuxVectorBase::setIndices1 (const SG_STD_OR_BOOST::true_type&,
+void AuxVectorBase::setIndices1 (const std::true_type&,
                                  ForwardIterator beg,
                                  ForwardIterator end,
                                  size_t first)
@@ -185,7 +185,7 @@ void AuxVectorBase::clearIndex (ForwardIterator elt)
  */
 template <class ForwardIterator>
 inline
-void AuxVectorBase::clearIndex1 (const SG_STD_OR_BOOST::false_type&,
+void AuxVectorBase::clearIndex1 (const std::false_type&,
                                  ForwardIterator /*elt*/)
 {
   ATHCONTAINERS_ASSERT (!m_trackIndices);
@@ -199,7 +199,7 @@ void AuxVectorBase::clearIndex1 (const SG_STD_OR_BOOST::false_type&,
  * This is the auxdata case.
  */
 template <class ForwardIterator>
-void AuxVectorBase::clearIndex1 (const SG_STD_OR_BOOST::true_type&,
+void AuxVectorBase::clearIndex1 (const std::true_type&,
                                  ForwardIterator elt)
 {
   if (!m_trackIndices)
@@ -239,7 +239,7 @@ void AuxVectorBase::clearIndices (ForwardIterator beg,
  */
 template <class ForwardIterator>
 inline
-void AuxVectorBase::clearIndices1 (const SG_STD_OR_BOOST::false_type&,
+void AuxVectorBase::clearIndices1 (const std::false_type&,
                                    ForwardIterator,
                                    ForwardIterator)
 {
@@ -255,7 +255,7 @@ void AuxVectorBase::clearIndices1 (const SG_STD_OR_BOOST::false_type&,
  * Auxdata case.
  */
 template <class ForwardIterator>
-void AuxVectorBase::clearIndices1 (const SG_STD_OR_BOOST::true_type&,
+void AuxVectorBase::clearIndices1 (const std::true_type&,
                                    ForwardIterator beg,
                                    ForwardIterator end)
 {
@@ -292,7 +292,7 @@ void AuxVectorBase::resize (size_t size)
  */
 inline
 void
-AuxVectorBase::resize1 (const SG_STD_OR_BOOST::false_type&, size_t /*size*/)
+AuxVectorBase::resize1 (const std::false_type&, size_t /*size*/)
 {
   ATHCONTAINERS_ASSERT (!m_trackIndices);
 }
@@ -321,7 +321,7 @@ void AuxVectorBase::reserve (size_t size)
  * The no-auxdata case; a no-op except for checking @c m_trackIndices.
  */
 inline
-void AuxVectorBase::reserve1 (const SG_STD_OR_BOOST::false_type&, size_t)
+void AuxVectorBase::reserve1 (const std::false_type&, size_t)
 {
   ATHCONTAINERS_ASSERT (!m_trackIndices);
 }
@@ -375,7 +375,7 @@ void AuxVectorBase::shift (DVL& cont,
  */
 template <class DVL>
 inline
-void AuxVectorBase::shift1 (const SG_STD_OR_BOOST::false_type&,
+void AuxVectorBase::shift1 (const std::false_type&,
                             DVL& /*cont*/,
                             size_t /*pos*/, ptrdiff_t /*offs*/)
 {
@@ -411,7 +411,7 @@ void AuxVectorBase::shift1 (const SG_STD_OR_BOOST::false_type&,
  * (running destructors as appropriate).
  */
 template <class DVL>
-void AuxVectorBase::shift1 (const SG_STD_OR_BOOST::true_type&,
+void AuxVectorBase::shift1 (const std::true_type&,
                             DVL& cont,
                             size_t pos, ptrdiff_t offs)
 {
@@ -490,7 +490,7 @@ AuxVectorBase::moveAux (size_t index, ForwardIterator beg, ForwardIterator end)
  */
 template <class ForwardIterator>
 inline
-void AuxVectorBase::moveAux1 (const SG_STD_OR_BOOST::false_type&,
+void AuxVectorBase::moveAux1 (const std::false_type&,
                               size_t /*index*/,
                               ForwardIterator /*beg*/,
                               ForwardIterator /*end*/)
@@ -513,7 +513,7 @@ void AuxVectorBase::moveAux1 (const SG_STD_OR_BOOST::false_type&,
  * The auxdata case.
  */
 template <class ForwardIterator>
-void AuxVectorBase::moveAux1 (const SG_STD_OR_BOOST::true_type&,
+void AuxVectorBase::moveAux1 (const std::true_type&,
                               size_t index,
                               ForwardIterator beg,
                               ForwardIterator end)
@@ -596,7 +596,7 @@ void AuxVectorBase::resortAux (size_t index,
  */
 template <class ForwardIterator>
 inline
-void AuxVectorBase::resortAux1 (const SG_STD_OR_BOOST::false_type&,
+void AuxVectorBase::resortAux1 (const std::false_type&,
                                 size_t /*index*/,
                                 ForwardIterator /*beg*/,
                                 ForwardIterator /*end*/)
@@ -619,7 +619,7 @@ void AuxVectorBase::resortAux1 (const SG_STD_OR_BOOST::false_type&,
  * The auxdata case.
  */
 template <class ForwardIterator>
-void AuxVectorBase::resortAux1 (const SG_STD_OR_BOOST::true_type&,
+void AuxVectorBase::resortAux1 (const std::true_type&,
                                 size_t index,
                                 ForwardIterator beg,
                                 ForwardIterator end)
diff --git a/Control/AthContainers/AthContainers/AuxVectorData.h b/Control/AthContainers/AthContainers/AuxVectorData.h
index e60acb7f6a6..13bcfdeb679 100644
--- a/Control/AthContainers/AthContainers/AuxVectorData.h
+++ b/Control/AthContainers/AthContainers/AuxVectorData.h
@@ -174,7 +174,6 @@ public:
   AuxVectorData();
 
 
-#if __cplusplus > 201100
   /**
    * @brief Move constructor.
    * @param rhs The container from which to move.
@@ -187,7 +186,6 @@ public:
    * @param rhs The container from which to move.
    */
   AuxVectorData& operator= (AuxVectorData&& rhs);
-#endif
 
 
   /// Destructor.
@@ -655,7 +653,6 @@ private:
     Cache();
 
 
-#if __cplusplus > 201100
     /**
      * @brief Cache manager move constructor.
      * @param rhs The cache from which to copy.
@@ -668,7 +665,6 @@ private:
      * @param rhs The cache from which to copy.
      */
     Cache& operator= (Cache&& rhs);
-#endif
 
 
     /**
diff --git a/Control/AthContainers/AthContainers/AuxVectorData.icc b/Control/AthContainers/AthContainers/AuxVectorData.icc
index 73c34d0515c..7f2969e8bc6 100644
--- a/Control/AthContainers/AthContainers/AuxVectorData.icc
+++ b/Control/AthContainers/AthContainers/AuxVectorData.icc
@@ -256,9 +256,6 @@ AuxVectorData::getDecoration (SG::auxid_t auxid, size_t ndx) const
 
 
 
-#ifndef __GCCXML__
-
-
 /**
  * @brief Return a pointer to the start of an aux data vector.
  * @param auxid The desired aux data item.
@@ -328,9 +325,6 @@ void* AuxVectorData::getDecorationArray (SG::auxid_t auxid) const
 }
 
 
-#endif // not __GCCXML__
-
-
 /**
  * @brief Swap this instance with another.
  * @param other The other instance with which to swap.
@@ -384,9 +378,6 @@ void* AuxVectorData::Cache::cachePtr (SG::auxid_t auxid)
 }
 
 
-#ifndef __GCCXML__
-
-
 /**
  * @brief Return a pointer to the start of an aux data vector.
  * @param auxid The desired aux data item.
@@ -518,9 +509,6 @@ void* AuxVectorData::Cache::getDecorationArray (SG::auxid_t auxid,
 }
 
 
-#endif // not __GCCXML__
-
-
 /**
  * @brief Set an option for an auxiliary data variable.
  * @param id The variable for which we want to set the option.
diff --git a/Control/AthContainers/AthContainers/ClassName.h b/Control/AthContainers/AthContainers/ClassName.h
index c7c83366061..4db11b00aaf 100644
--- a/Control/AthContainers/AthContainers/ClassName.h
+++ b/Control/AthContainers/AthContainers/ClassName.h
@@ -10,8 +10,8 @@
 
 #ifndef XAOD_STANDALONE
 
-// Get the code from SGTools:
-#include "SGTools/ClassName.h"
+// Get the code from AthenaKernel:
+#include "AthenaKernel/ClassName.h"
 
 #else
 
diff --git a/Control/AthContainers/AthContainers/ConstDataVector.h b/Control/AthContainers/AthContainers/ConstDataVector.h
index 7c44daee0ca..96b9712d849 100644
--- a/Control/AthContainers/AthContainers/ConstDataVector.h
+++ b/Control/AthContainers/AthContainers/ConstDataVector.h
@@ -67,9 +67,7 @@
 
 #include "AthContainers/DataVector.h"
 #include "AthLinks/ElementLink.h"
-#if __cplusplus > 201100
 #include <initializer_list>
-#endif
 
 
 /**
@@ -140,9 +138,7 @@ public:
   using DV::cend;
   using DV::crbegin;
   using DV::crend;
-#if __cplusplus > 201100
   using DV::shrink_to_fit;
-#endif
 
 
   /// Expose the const versions of these methods too.
@@ -226,14 +222,11 @@ public:
   // except for setting @c m_isMostDerived.  We arrange for these flags
   // to all get set to false; they'll get set correctly when
   // @c testInsert is called.
-#if __cplusplus > 201100
   // Need this to get the default copy ctor defined when a move
   // ctor is also present.
   ConstDataVector (const ConstDataVector&) = default;
-#endif
 
 
-#if __cplusplus > 201100
   /**
    * @brief Move constructor.
    * @param rhs The container from which to move.
@@ -254,7 +247,6 @@ public:
    */
   ConstDataVector(std::initializer_list<value_type> l,
                   SG::OwnershipPolicy ownPolicy = SG::VIEW_ELEMENTS);
-#endif
 
 
   /**
@@ -282,7 +274,6 @@ public:
   ConstDataVector& operator= (const ConstDataVector& rhs) ;
 
 
-#if __cplusplus > 201100
   /**
    * @brief Move assignment.
    * @param rhs The container from which to move.
@@ -303,7 +294,6 @@ public:
    * ownership of the new elements.
    */
   ConstDataVector& operator= (std::initializer_list<value_type> l);
-#endif
 
 
   /**
@@ -319,7 +309,6 @@ public:
   void assign(InputIterator first, InputIterator last);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Assign from an initializer list.
    * @param l An initializer list.
@@ -329,7 +318,6 @@ public:
    * ownership of the new elements.
    */
   void assign(std::initializer_list<value_type> l);
-#endif
 
 
   /**
@@ -532,8 +520,6 @@ public:
   void insert(iterator position, InputIterator first, InputIterator last);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Add an element to the end of the collection.
    * @param pElem The element to add to the collection.
@@ -558,7 +544,6 @@ public:
    * @c DataVector in the hierarchy.
    */
   iterator insert(iterator position, std::unique_ptr<const base_value_type> pElem);
-#endif
 
 
   /**
@@ -573,7 +558,6 @@ public:
    * @c DataVector in the hierarchy.
    */
   void insert(iterator position, std::initializer_list<value_type> l);
-#endif
 
 
   //@}
@@ -691,8 +675,6 @@ public:
   void swapElement(iterator pos, value_type newElem, reference oldElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Swap one element out of the container.
    * @param index Index of the element in the container to swap.
@@ -739,8 +721,6 @@ public:
   void swapElement(iterator pos,
                    std::unique_ptr<const base_value_type> newElem,
                    std::unique_ptr<const base_value_type>& oldElem);
-#endif
-#endif
 
 
 public:
@@ -874,8 +854,6 @@ private:
   void assignElement (typename BaseContainer::iterator pos, value_type newElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Handle element assignment.
    * @param pos Position in the container to assign.
@@ -886,8 +864,6 @@ private:
    */
   void assignElement (typename BaseContainer::iterator pos,
                       std::unique_ptr<const base_value_type> newElem);
-#endif
-#endif
 
 
   /**
@@ -934,7 +910,7 @@ private:
 
 #ifndef XAOD_STANDALONE
 
-#include "SGTools/ClassID_traits.h"
+#include "AthenaKernel/ClassID_traits.h"
 
 /**
  * @brief Specialize @c ClassID_traits for @c ConstDataVector so that
@@ -973,13 +949,11 @@ public:
   DVLConstDataVectorBucket (ConstDataVector<DV>* data);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Constructor from a payload object.
    * @param data Object to hold in the bucket.
    */
   DVLConstDataVectorBucket (std::unique_ptr<ConstDataVector<DV> > data);
-#endif
 };
 
 
@@ -988,7 +962,7 @@ public:
  *        the first template argument.
  *
  * Specialize this for @c ConstDataVector.
- * See SGTools/StorableConversions.h for an explanation.
+ * See AthenaKernel/StorableConversions.h for an explanation.
  */
 template <class DV, class U>
 struct DataBucketTrait<ConstDataVector<DV>, U>
diff --git a/Control/AthContainers/AthContainers/ConstDataVector.icc b/Control/AthContainers/AthContainers/ConstDataVector.icc
index d87c007bfe1..9763da76517 100644
--- a/Control/AthContainers/AthContainers/ConstDataVector.icc
+++ b/Control/AthContainers/AthContainers/ConstDataVector.icc
@@ -123,7 +123,6 @@ ConstDataVector<DV>::ConstDataVector
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Move constructor.
  * @param rhs The container from which to move.
@@ -156,7 +155,6 @@ ConstDataVector<DV>::ConstDataVector
     : ConstDataVector (l.begin(), l.end(), ownPolicy)
 {
 }
-#endif
 
 
 /**
@@ -199,7 +197,6 @@ ConstDataVector<DV>::operator= (const ConstDataVector& rhs)
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Move assignment.
  * @param rhs The container from which to move.
@@ -236,7 +233,6 @@ ConstDataVector<DV>::operator= (std::initializer_list<value_type> l)
   this->assign (l.begin(), l.end());
   return *this;
 }
-#endif
 
 
 /**
@@ -260,7 +256,6 @@ void ConstDataVector<DV>::assign(InputIterator first, InputIterator last)
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Assign from an initializer list.
  * @param l An initializer list.
@@ -275,7 +270,6 @@ void ConstDataVector<DV>::assign(std::initializer_list<value_type> l)
 {
   this->assign (l.begin(), l.end());
 }
-#endif
 
 
 /**
@@ -564,8 +558,6 @@ void ConstDataVector<DV>::insert (iterator position,
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Add an element to the end of the collection.
  * @param pElem The element to add to the collection.
@@ -607,7 +599,6 @@ ConstDataVector<DV>::insert(iterator position,
   return to_my_iterator
     (DV::insert (to_base_iterator (position), std::move (ptr)));
 }
-#endif
 
 
 /**
@@ -628,7 +619,6 @@ void ConstDataVector<DV>::insert (iterator position,
 {
   this->insert (position, l.begin(), l.end());
 }
-#endif
 
 
 //=== Erasure operations.
@@ -784,8 +774,6 @@ ConstDataVector<DV>::swapElement (iterator pos,
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Swap one element out of the container.
  * @param index Index of the element in the container to swap.
@@ -854,8 +842,6 @@ ConstDataVector<DV>::swapElement (iterator pos,
   DV::swapElement (to_base_iterator(pos), std::move(new_u), old_u);
   oldElem = std::move (old_u);
 }
-#endif
-#endif
 
 
 /**
@@ -1050,8 +1036,6 @@ ConstDataVector<DV>::assignElement (typename BaseContainer::iterator pos,
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Handle element assignment.
  * @param pos Position in the container to assign.
@@ -1071,8 +1055,6 @@ ConstDataVector<DV>::assignElement (typename BaseContainer::iterator pos,
   std::unique_ptr<typename DV::base_value_type> new_u (pelem);
   DV::assignElement (pos, std::move(new_u));
 }
-#endif
-#endif
 
 
 /**
@@ -1156,7 +1138,6 @@ DVLConstDataVectorBucket<DV>::DVLConstDataVectorBucket
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Constructor from a payload object.
  * @param data Object to hold in the bucket.
@@ -1167,7 +1148,6 @@ DVLConstDataVectorBucket<DV>::DVLConstDataVectorBucket
   : DVLDataBucket<DV> (std::unique_ptr<DV> (const_cast<DV*> (data.release()->asDataVector())))
 {
 }
-#endif // C++11
 
 
 } // namespace SG
diff --git a/Control/AthContainers/AthContainers/DataVector.h b/Control/AthContainers/AthContainers/DataVector.h
index 998d465dda8..b729c57197d 100644
--- a/Control/AthContainers/AthContainers/DataVector.h
+++ b/Control/AthContainers/AthContainers/DataVector.h
@@ -572,7 +572,7 @@
 #  define SG_VIRTUAL(X) X
 # endif // not SG_VIRTUAL
 #else
-# include "SGTools/BaseInfo.h"
+# include "AthenaKernel/BaseInfo.h"
 #endif
 
 
@@ -860,14 +860,11 @@ public:
   // except for setting @c m_isMostDerived.  We arrange for these flags
   // to all get set to false; they'll get set correctly when
   // @c testInsert is called.
-#if __cplusplus > 201100
   // Need this to get the default copy ctor defined when a move
   // ctor is also present.
   DataVector (const DataVector&) = default;
-#endif
 
 
-#if __cplusplus > 201100
   /**
    * @brief Move constructor.
    * @param rhs The container from which to move.
@@ -875,7 +872,6 @@ public:
    * Any auxiliary data will be moved along with the container contents.
    */
   DataVector (DataVector&& rhs);
-#endif
 
 
   /**
@@ -898,7 +894,6 @@ public:
              SG::IAuxStore* store = 0);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Constructor from an initializer list.
    * @param l An initializer list.
@@ -913,7 +908,6 @@ public:
 	     SG::OwnershipPolicy ownPolicy = SG::VIEW_ELEMENTS,
              SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES,
              SG::IAuxStore* store = 0);
-#endif
 
 
   /**
@@ -931,7 +925,6 @@ public:
   DataVector& operator= (const DataVector& rhs);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Move assignment.
    * @param rhs The container from which to move.
@@ -952,7 +945,6 @@ public:
    * ownership of the new elements.
    */
   DataVector& operator= (std::initializer_list<value_type> l);
-#endif
 
 
   /**
@@ -968,9 +960,8 @@ public:
   void assign(InputIterator first, InputIterator last);
 
 
-#if __cplusplus > 201100
   /**
-   * @brief Assign from an initializer list.
+
    * @param l An initializer list.
    *
    * Any existing owned elements will be released.
@@ -978,7 +969,6 @@ public:
    * ownership of the new elements.
    */
   void assign(std::initializer_list<value_type> l);
-#endif
 
 
   // Destructor is inherited.
@@ -1319,8 +1309,6 @@ public:
   void push_back(value_type pElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Add an element to the end of the collection.
    * @param pElem The element to add to the collection.
@@ -1331,8 +1319,6 @@ public:
    * @c DataVector in the hierarchy.
    */
   void push_back(std::unique_ptr<base_value_type> pElem);
-#endif
-#endif
 
 
   /**
@@ -1366,8 +1352,6 @@ public:
   iterator insert(iterator position, value_type pElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Add a new element to the collection.
    * @param position Iterator before which the element will be added.
@@ -1380,8 +1364,6 @@ public:
    * @c DataVector in the hierarchy.
    */
   iterator insert(iterator position, std::unique_ptr<base_value_type> pElem);
-#endif
-#endif
 
 
   /**
@@ -1418,7 +1400,6 @@ public:
   void insert(iterator position, InputIterator first, InputIterator last);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Add a group of new elements to the collection.
    * @param position Iterator before which the element will be added.
@@ -1431,7 +1412,6 @@ public:
    * @c DataVector in the hierarchy.
    */
   void insert(iterator position, std::initializer_list<value_type> l);
-#endif
 
 
   /**
@@ -1604,8 +1584,6 @@ public:
   void swapElement(iterator pos, value_type newElem, reference oldElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Swap one element out of the container.
    * @param index Index of the element in the container to swap.
@@ -1652,8 +1630,6 @@ public:
   void swapElement(iterator pos,
                    std::unique_ptr<base_value_type> newElem,
                    std::unique_ptr<base_value_type>& oldElem);
-#endif
-#endif
 
 
 public:
@@ -1850,8 +1826,6 @@ private:
   void assignElement (typename BaseContainer::iterator pos, value_type newElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Handle element assignment.
    * @param pos Position in the container to assign.
@@ -1862,8 +1836,6 @@ private:
    */
   void assignElement (typename BaseContainer::iterator pos,
                       std::unique_ptr<base_value_type> newElem);
-#endif
-#endif
 
 
   /**
@@ -2092,7 +2064,6 @@ public:
   DataVector(const DataVector& rhs);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Move constructor.
    * @param rhs The container from which to move.
@@ -2100,7 +2071,6 @@ public:
    * Any auxiliary data will be moved along with the container contents.
    */
   DataVector(DataVector&& rhs);
-#endif
 
 
   /**
@@ -2122,7 +2092,6 @@ public:
              SG::IAuxStore* store = 0);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Constructor from iterators.
    * @param l An initializer list.
@@ -2137,7 +2106,6 @@ public:
 	     SG::OwnershipPolicy ownPolicy = SG::VIEW_ELEMENTS,
              SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES,
              SG::IAuxStore* store = 0);
-#endif
 
 
   /**
@@ -2155,7 +2123,6 @@ public:
   DataVector& operator= (const DataVector& rhs);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Move assignment.
    * @param rhs The container from which to move.
@@ -2176,7 +2143,6 @@ public:
    * ownership of the new elements.
    */
   DataVector& operator= (std::initializer_list<value_type> l);
-#endif
 
 
   /**
@@ -2192,7 +2158,6 @@ public:
   void assign(InputIterator first, InputIterator last);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Assign from an initializer list.
    * @param l An initializer list.
@@ -2202,7 +2167,6 @@ public:
    * ownership of the new elements.
    */
   void assign(std::initializer_list<value_type> l);
-#endif
 
 
   /**
@@ -2288,14 +2252,12 @@ public:
   void reserve (size_type n);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Change the vector capacity to match the current size.
    *
    * Note: this does not affect auxiliary data.
    */
   void shrink_to_fit();
-#endif
 
 
   //@}
@@ -2563,8 +2525,6 @@ public:
   void push_back(value_type pElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Add an element to the end of the collection.
    * @param pElem The element to add to the collection.
@@ -2575,8 +2535,6 @@ public:
    * @c DataVector in the hierarchy.
    */
   void push_back(std::unique_ptr<base_value_type> pElem);
-#endif
-#endif
 
 
   /**
@@ -2610,8 +2568,6 @@ public:
   iterator insert(iterator position, value_type pElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Add a new element to the collection.
    * @param position Iterator before which the element will be added.
@@ -2624,8 +2580,6 @@ public:
    * @c DataVector in the hierarchy.
    */
   iterator insert(iterator position, std::unique_ptr<base_value_type> pElem);
-#endif
-#endif
 
 
   /**
@@ -2662,7 +2616,6 @@ public:
   void insert(iterator position, InputIterator first, InputIterator last);
 
 
-#if __cplusplus > 201100
   /**
    * @brief Add a group of new elements to the collection.
    * @param position Iterator before which the element will be added.
@@ -2675,7 +2628,6 @@ public:
    * @c DataVector in the hierarchy.
    */
   void insert(iterator position, std::initializer_list<value_type> l);
-#endif
 
 
   /**
@@ -2846,8 +2798,6 @@ public:
   void swapElement(iterator pos, value_type newElem, reference oldElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Swap one element out of the container.
    * @param index Index of the element in the container to swap.
@@ -2893,8 +2843,6 @@ public:
   void swapElement(iterator pos,
                    std::unique_ptr<base_value_type> newElem,
                    std::unique_ptr<base_value_type>& oldElem);
-#endif
-#endif
 
 
 public:
@@ -3059,8 +3007,6 @@ private:
   void assignElement (typename BaseContainer::iterator pos, value_type newElem);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Handle element assignment.
    * @param pos Position in the container to assign.
@@ -3071,8 +3017,6 @@ private:
    */
   void assignElement (typename BaseContainer::iterator pos,
                       std::unique_ptr<base_value_type> newElem);
-#endif
-#endif
 
 
   /**
@@ -3363,7 +3307,7 @@ namespace SG {
  * @brief Metafunction to find the proper @c DataBucket class for @c T.
  *
  * Specialize this for @c DataVector.
- * See SGTools/StorableConversions.h for an explanation.
+ * See AthenaKernel/StorableConversions.h for an explanation.
  */
 template <class T, class U>
 struct DataBucketTrait<DataVector<T>, U>
diff --git a/Control/AthContainers/AthContainers/DataVector.icc b/Control/AthContainers/AthContainers/DataVector.icc
index 969cfa1e1c8..a96ac4ed24d 100644
--- a/Control/AthContainers/AthContainers/DataVector.icc
+++ b/Control/AthContainers/AthContainers/DataVector.icc
@@ -80,13 +80,10 @@ struct VirtBases<B1, DataModel_detail::NoBase, DataModel_detail::NoBase>
   typedef typename DataVector<B1>::difference_type difference_type;
   typedef typename DataVector<B1>::allocator_type allocator_type;
 
-#ifndef __GCCXML__
   // We're using virtual derivation.
   static const bool has_virtual = true;
-#endif
 
 
-#if __cplusplus > 201100
   // We need to delete the move ctor; otherwise, we get warnings about
   // a virtual base having a non-trivial move ctor.  Then we also need
   // to explicitly default the ordinary ctors so that they remain visible.
@@ -95,7 +92,6 @@ struct VirtBases<B1, DataModel_detail::NoBase, DataModel_detail::NoBase>
   // default doesn't work here with gcc 4.7; it does with 4.9.
   VirtBases& operator= (VirtBases&) { return *this; }
   VirtBases& operator= (VirtBases&&) = delete;
-#endif
 
 
 protected:
@@ -161,13 +157,10 @@ struct VirtBases<B1, B2, DataModel_detail::NoBase>
   typedef typename DataVector<B1>::difference_type difference_type;
   typedef typename DataVector<B1>::allocator_type allocator_type;
 
-#ifndef __GCCXML__
   // We're using virtual derivation.
   static const bool has_virtual = true;
-#endif
 
 
-#if __cplusplus > 201100
   // We need to delete the move ctor; otherwise, we get warnings about
   // a virtual base having a non-trivial move ctor.  Then we also need
   // to explicitly default the ordinary ctors so that they remain visible.
@@ -176,7 +169,6 @@ struct VirtBases<B1, B2, DataModel_detail::NoBase>
   // default doesn't work here with gcc 4.7; it does with 4.9.
   VirtBases& operator= (VirtBases&) { return *this; }
   VirtBases& operator= (VirtBases&&) = delete;
-#endif
 
 
 protected:
@@ -251,13 +243,10 @@ struct VirtBases
   typedef typename DataVector<B1>::difference_type difference_type;
   typedef typename DataVector<B1>::allocator_type allocator_type;
 
-#ifndef __GCCXML__
   // We're using virtual derivation.
   static const bool has_virtual = true;
-#endif
 
 
-#if __cplusplus > 201100
   // We need to delete the move ctor; otherwise, we get warnings about
   // a virtual base having a non-trivial move ctor.  Then we also need
   // to explicitly default the ordinary ctors so that they remain visible.
@@ -266,7 +255,6 @@ struct VirtBases
   // default doesn't work here with gcc 4.7; it does with 4.9.
   VirtBases& operator= (VirtBases&) { return *this; }
   VirtBases& operator= (VirtBases&&) = delete;
-#endif
 
 
 protected:
@@ -434,7 +422,6 @@ DataVector<T, BASE>::DataVector
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Move constructor.
  * @param rhs The container from which to move.
@@ -452,7 +439,6 @@ DataVector<T, BASE>::DataVector (DataVector&& rhs)
   this->setIndices (this->begin(), this->end());
   this->m_isMostDerived = true;
 }
-#endif
 
 
 /**
@@ -507,7 +493,6 @@ DataVector<T, BASE>::DataVector
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Constructor from an initializer list.
  * @param l An initializer list.
@@ -539,7 +524,6 @@ DataVector<T, BASE>::DataVector
     : DataVector (l.begin(), l.end(), ownPolicy, trackIndices, store)
 {
 }
-#endif
 
 
 /**
@@ -572,7 +556,6 @@ DataVector<T, BASE>& DataVector<T, BASE>::operator= (const DataVector& rhs)
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Move assignment.
  * @param rhs The container from which to move.
@@ -616,7 +599,6 @@ DataVector<T, BASE>::operator= (std::initializer_list<value_type> l)
   this->assign (l.begin(), l.end());
   return *this;
 }
-#endif
 
 
 /**
@@ -640,7 +622,6 @@ void DataVector<T, BASE>::assign(InputIterator first, InputIterator last)
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Assign from an initializer list.
  * @param l An initializer list.
@@ -654,7 +635,6 @@ void DataVector<T, BASE>::assign(std::initializer_list<value_type> l)
 {
   this->assign (l.begin(), l.end());
 }
-#endif
 
 
 //=== Size and capacity.
@@ -1102,8 +1082,6 @@ void DataVector<T, BASE>::push_back(value_type pElem)
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Add an element to the end of the collection.
  * @param pElem The element to add to the collection.
@@ -1129,8 +1107,6 @@ void DataVector<T, BASE>::push_back(std::unique_ptr<base_value_type> pElem)
   if (ptr)
     this->moveAux (this->size()-1, ptr, false, true);
 }
-#endif
-#endif
 
 
 /**
@@ -1179,8 +1155,6 @@ DataVector<T, BASE>::insert(iterator position, value_type pElem)
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Add a new element to the collection.
  * @param position Iterator before which the element will be added.
@@ -1209,8 +1183,6 @@ DataVector<T, BASE>::insert(iterator position,
   this->moveAux (ret-this->begin(), ptr);
   return ret;
 }
-#endif
-#endif
 
 
 /**
@@ -1275,7 +1247,6 @@ void DataVector<T, BASE>::insert(iterator position,
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Add a group of new elements to the collection.
  * @param position Iterator before which the element will be added.
@@ -1293,7 +1264,6 @@ void DataVector<T, BASE>::insert(iterator position,
 {
   insert (position, l.begin(), l.end());
 }
-#endif
 
 
 /**
@@ -1585,8 +1555,6 @@ void DataVector<T, BASE>::swapElement(iterator pos,
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Swap one element out of the container.
  * @param index Index of the element in the container to swap.
@@ -1661,8 +1629,6 @@ void DataVector<T, BASE>::swapElement(iterator pos,
   *pos.base() = ptr;
   this->moveAux (pos.base() - this->m_pCont.begin(), ptr);
 }
-#endif
-#endif
 
 
 /**
@@ -1869,8 +1835,6 @@ void DataVector<T, BASE>::assignElement (typename BaseContainer::iterator pos,
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Handle element assignment.
  * @param pos Position in the container to assign.
@@ -1894,8 +1858,6 @@ DataVector<T, BASE>::assignElement (typename BaseContainer::iterator pos,
   *pos = ptr;
   this->moveAux (pos - this->m_pCont.begin(), ptr);
 }
-#endif
-#endif
 
 
 /**
@@ -2026,8 +1988,6 @@ const DataModel_detail::DVLInfo<DataVector<T> > DataVector<T, BASE>::s_info;
 //
 
 
-#ifndef __CINT__ // I don't think CINT will be able to read this.
-
 // An abbreviation for the DataVector specialization to try to make
 // things a little more readable.
 #define DATAVECTOR DataVector<T, DataModel_detail::NoBase>
@@ -2102,7 +2062,6 @@ DATAVECTOR::DataVector(const DataVector& rhs)
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Move constructor.
  * @param rhs The container from which to move.
@@ -2123,7 +2082,6 @@ DATAVECTOR::DataVector(DataVector&& rhs)
   // Go ahead and set this flag now.
   m_isMostDerived = true;
 }
-#endif
 
 
 /**
@@ -2158,7 +2116,6 @@ DATAVECTOR::DataVector
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Constructor from an initializer list.
  * @param l An initializer list.
@@ -2181,7 +2138,6 @@ DATAVECTOR::DataVector
     : DataVector (l.begin(), l.end(), ownPolicy, trackIndices, store)
 {
 }
-#endif
 
 
 /**
@@ -2214,7 +2170,6 @@ DATAVECTOR& DATAVECTOR::operator= (const DataVector& rhs)
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Move assignment.
  * @param rhs The container from which to move.
@@ -2256,7 +2211,6 @@ DATAVECTOR& DATAVECTOR::operator= (std::initializer_list<value_type> l)
   this->assign (l.begin(), l.end());
   return *this;
 }
-#endif
 
 
 /**
@@ -2281,7 +2235,6 @@ void DATAVECTOR::assign (InputIterator first,
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Assign from an initializer list.
  * @param l An initializer list.
@@ -2295,7 +2248,6 @@ void DATAVECTOR::assign (std::initializer_list<value_type> l)
 {
   this->assign (l.begin(), l.end());
 }
-#endif
 
 
 /**
@@ -2434,7 +2386,6 @@ void DATAVECTOR::reserve (size_type n)
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Change the vector capacity to match the current size.
  *
@@ -2446,7 +2397,6 @@ void DATAVECTOR::shrink_to_fit()
 {
   m_pCont.shrink_to_fit();
 }
-#endif
 
 
 //=== Element access.
@@ -2825,8 +2775,6 @@ void DATAVECTOR::push_back(value_type pElem)
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Add an element to the end of the collection.
  * @param pElem The element to add to the collection.
@@ -2852,8 +2800,6 @@ void DATAVECTOR::push_back(std::unique_ptr<base_value_type> pElem)
   if (ptr)
     this->moveAux (this->size()-1, ptr, false, true);
 }
-#endif
-#endif
 
 
 /**
@@ -2903,8 +2849,6 @@ DATAVECTOR::insert(iterator position, value_type pElem)
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Add a new element to the collection.
  * @param position Iterator before which the element will be added.
@@ -2933,8 +2877,6 @@ DATAVECTOR::insert(iterator position, std::unique_ptr<base_value_type> pElem)
   this->moveAux (ret-this->begin(), ptr);
   return ret;
 }
-#endif
-#endif
 
 
 /**
@@ -2990,7 +2932,6 @@ DATAVECTOR::insert (iterator position, InputIterator first, InputIterator last)
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Add a group of new elements to the collection.
  * @param position Iterator before which the element will be added.
@@ -3009,7 +2950,6 @@ DATAVECTOR::insert (iterator position, std::initializer_list<value_type> l)
 {
   this->insert (position, l.begin(), l.end());
 }
-#endif
 
 
 /**
@@ -3298,8 +3238,6 @@ DATAVECTOR::swapElement (iterator pos,
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Swap one element out of the container.
  * @param index Index of the element in the container to swap.
@@ -3374,8 +3312,6 @@ DATAVECTOR::swapElement (iterator pos,
   *pos.base() = ptr;
   this->moveAux (pos.base() - this->m_pCont.begin(), ptr);
 }
-#endif
-#endif
 
 
 /**
@@ -3568,8 +3504,6 @@ void DATAVECTOR::assignElement (typename BaseContainer::iterator pos,
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Handle element assignment.
  * @param pos Position in the container to assign.
@@ -3593,8 +3527,6 @@ DATAVECTOR::assignElement (typename BaseContainer::iterator pos,
   *pos = ptr;
   this->moveAux (pos - this->m_pCont.begin(), ptr);
 }
-#endif
-#endif
 
 
 /**
@@ -3800,7 +3732,6 @@ const DataModel_detail::DVLInfo<DataVector<T> > DATAVECTOR::s_info;
 
 
 #undef DATAVECTOR
-#endif // not __CINT__
 
 
 //****************************************************************************
diff --git a/Control/AthContainers/AthContainers/UserDataStore.h b/Control/AthContainers/AthContainers/UserDataStore.h
deleted file mode 100644
index b40b92c25bd..00000000000
--- a/Control/AthContainers/AthContainers/UserDataStore.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//Dear emacs, this is -*-c++-*-
-#ifndef ATHCONTAINERS_USERDATASTORE_H
-#define ATHCONTAINERS_USERDATASTORE_H
-
-#ifdef XAOD_STANDALONE
-
-/**
- *  @short Placeholder class when using AthContainers in ROOT
- *
- *         The xAOD format doesn't consider the UserDataStore at the
- *         moment, but it could change later on. For now, because the
- *         dictionary generation expects a class called UserDataStore
- *         to be available, we use a dummy class.
- *
- * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
- *
- * $Revision: 764634 $
- * $Date: 2016-07-27 16:09:53 +0200 (Wed, 27 Jul 2016) $
- */
-class UserDataStore {
-
-public:
-   /// Default constructor
-   UserDataStore() {}
-
-}; // class UserDataStore;
-
-#else
-
-#include "GaudiKernel/StatusCode.h"
-#include "AthenaKernel/IAthenaBarCode.h"
-#include "GaudiKernel/MsgStream.h"
-#include <string>
-#include <map>
-
-//#include <ext/hash_map>
-//#include <boost/unordered_map.hpp>
-
-
-#include "AthContainers/tools/UDSLabelHashTable.h"
-#include "SGTools/CLASS_DEF.h"
-
-#include "boost/any.hpp"
-
-/** @class UserDataStoreObj
- * @brief User Data store for type T
- */
-
-class UserDataStore {
- 
-  friend class UserDataStoreCnv_p1;
-
-public:
-
-  /// Default constructor
-  UserDataStore();  
-
-  /**
-   * @brief Record method with template payload
-   * @param abc A data-object implementing the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param value Decoration payload 
-   */
-  template<typename T>
-  StatusCode record(const IAthenaBarCode& obj, const std::string& label, const T& value); 
-
-
-  /**
-   * @brief Retrieve method with template payload
-   * @param abc A data-object implementing the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param[out] value Decoration payload 
-   */
-  template<typename T>
-  StatusCode retrieve(const IAthenaBarCode& obj, const std::string& label, T& value) const; 
-
-
-  /** 
-   * @brief Contains method for element decorations
-   * @param abc A data-object implementing the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @return True if the decoration exists
-   */ 
-  bool contains(const IAthenaBarCode& obj, const std::string& label) const;
-
-
-  /**
-   * @brief Table-of-contents method
-   * @param barcode A data-object implementing the IAthenaBarCode interface
-   * @return A vector of labels existing for this object
-   */
-  std::vector<const std::string*> getLabels(const AthenaBarCode_t& barcode) const;
-
-
-  
-  /**
-   * @brief Record method with boost::any as payload 
-   * @param abc A data-object implementing the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param value Decoration payload 
-   */
-  StatusCode recordAny(const IAthenaBarCode& obj, const std::string& label, const boost::any& value);
-
-
-  /**
-   * @brief Retrieve method with boost::any as payload
-   * @param abc A data-object implementing the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param[out] value Decoration payload 
-   */
-  StatusCode retrieveAny(const IAthenaBarCode& obj, const std::string& label, const boost::any*& value) const;
-
-
-  /**
-   * @brief Method to set the AthenaBarCode of this event (called by UserDataSvc)
-   * @param eventABC The AthenaBarCode
-   */
-  void setEventABC(const AthenaBarCode_t& eventABC);
-
-
-
-  /**
-   * @brief Method to get the AthenaBarCode of this event (called by UserDataSvc)
-   * @return The AthenaBarCode
-   */
-  AthenaBarCode_t getEventABC() const { return m_eventABC; }
-
-
-  enum NotFoundTypes {
-    ALLGOOD=0,
-    BARCODE,
-    LABEL
-  };
-
-private: 
-
-  // For experimental use of hash-maps instead of std::map
-  // class abcHashFcn {
-  //   public:
-  //     size_t operator()(const AthenaBarCode_t abc) const { return ((abc & 0xFFFFFFFF)>>6); } //Extract the 26 counter-bits
-  //   };
-  
-  typedef boost::any payload_t; 
-
-  typedef UDSLabelHashTable::hash_t index_t;
-
-  typedef std::map<AthenaBarCode_t,std::map<index_t, payload_t > > mapmap_t;
-  //typedef __gnu_cxx::hash_map<AthenaBarCode_t,std::map<index_t, payload_t >, abcHashFcn > mapmap_t;
-  //typedef boost::unordered_map<AthenaBarCode_t,std::map<index_t, payload_t >, abcHashFcn > mapmap_t;
-
-  typedef std::map<index_t, payload_t >::iterator iterator;
-  typedef std::map<index_t, payload_t >::const_iterator const_iterator;
-
-  mapmap_t m_data;
-
-  //find a label (const version)
-  const_iterator find(const AthenaBarCode_t& barcode, const std::string& label) const;
-
-  //Update the cached map-iterator m_lastIt;
-  //void updateIt(const AthenaBarCode_t& barcode);
-
-  const_iterator m_notFoundIt;
-  const std::map<index_t, payload_t > m_defaultEntry;
-
-  UDSLabelHashTable m_labelTable;
-
-  ///Cache of last barcode/object (const)
-  mutable  mapmap_t::const_iterator m_lastIt;
-
-  ///Cache of last barcode/object (non-const)
-  mutable  mapmap_t::iterator m_lastIt_nc;
-
-  ///AthenaBarCode for this event
-  AthenaBarCode_t m_eventABC;
-
-  ///Cached Message Stream
-  mutable MsgStream m_msg;
-
-  mutable NotFoundTypes m_whyNotFound;
-
-};
-  
-CLASS_DEF( UserDataStore , 51567825 , 1 )
-  
-template<typename T>
-StatusCode UserDataStore::retrieve(const IAthenaBarCode& obj, const std::string& label, T& value) const {
-  const boost::any* aValue=0;
-  StatusCode sc=this->retrieveAny(obj,label, aValue);
-  if (sc.isFailure()) return sc;
-  if (typeid(T) != aValue->type()) { 
-    m_msg << MSG::ERROR << "Typeid mismatch while retrieving user data with label " << label << endmsg;
-    return StatusCode::FAILURE;
-  }
-  const T* decoPtr=boost::any_cast<T>(aValue);
-  value=*decoPtr; //Deep copy! 
-  return StatusCode::SUCCESS;
-}
-
-
-template<typename T>
-StatusCode UserDataStore::record(const IAthenaBarCode& obj, const std::string& label, const T& value) {
-  boost::any aValue(value);
-  return this->recordAny(obj,label, aValue);
-}
-
-#endif // not XAOD_STANDALONE
-
-
-#endif // not ATHCONTAINERS_USERDATASTORE_H
diff --git a/Control/AthContainers/AthContainers/ViewVector.h b/Control/AthContainers/AthContainers/ViewVector.h
index 0a163b87714..ef2a8d213e4 100644
--- a/Control/AthContainers/AthContainers/ViewVector.h
+++ b/Control/AthContainers/AthContainers/ViewVector.h
@@ -258,7 +258,7 @@ private:
 
 
 #ifndef XAOD_STANDALONE
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 namespace SG {
 
 
diff --git a/Control/AthContainers/AthContainers/dataVectorAsELV.h b/Control/AthContainers/AthContainers/dataVectorAsELV.h
index cdd8b993e3a..2c49194c5c6 100644
--- a/Control/AthContainers/AthContainers/dataVectorAsELV.h
+++ b/Control/AthContainers/AthContainers/dataVectorAsELV.h
@@ -35,7 +35,7 @@ namespace SG {
  * Handle the case of a view vector with elements deriving from AuxElement.
  */
 template <class DV>
-void dataVectorViewAsELV (const SG_STD_OR_BOOST::true_type&,
+void dataVectorViewAsELV (const std::true_type&,
                           const DV& v,
                           std::vector<ElementLink<DV> >& ret,
                           IProxyDict* store)
@@ -63,7 +63,7 @@ void dataVectorViewAsELV (const SG_STD_OR_BOOST::true_type&,
  * (just throw an exception).
  */
 template <class DV>
-void dataVectorViewAsELV (const SG_STD_OR_BOOST::false_type&,
+void dataVectorViewAsELV (const std::false_type&,
                           const DV&,
                           std::vector<ElementLink<DV> >&,
                           IProxyDict*)
diff --git a/Control/AthContainers/AthContainers/selection.xml b/Control/AthContainers/AthContainers/selection.xml
index 02c4d233380..2ad09b28199 100644
--- a/Control/AthContainers/AthContainers/selection.xml
+++ b/Control/AthContainers/AthContainers/selection.xml
@@ -1,6 +1,4 @@
 <lcgdict>
-  <class name="UserDataStore"/>
-
   <class name="SG::AuxTypeRegistry"/>
   <class name="SG::AuxVectorBase"/>
   <class name="SG::AuxVectorData">
diff --git a/Control/AthContainers/AthContainers/tools/DVLCast.h b/Control/AthContainers/AthContainers/tools/DVLCast.h
index e396ab87214..d996eefeb44 100644
--- a/Control/AthContainers/AthContainers/tools/DVLCast.h
+++ b/Control/AthContainers/AthContainers/tools/DVLCast.h
@@ -27,16 +27,6 @@
 namespace DataModel_detail {
 
 
-#ifdef __GCCXML__
-// Dummy version for reflex.
-template <class DVL>
-struct DVLCast
-{
-  typedef typename DVL::base_value_type T;
-  template <class U> static T* cast (U* b);
-  template <class U> static const T* cast (const U* b);
-};
-#else
 /**
  * @brief casting operations for @c DataVector/@c DataList.
  *
@@ -157,7 +147,6 @@ struct DVLCast<DVL, true>
       return dynamic_cast<const T*> (b);
   }
 };
-#endif // not __GCCXML__
 
 
 } // namespace DataModel_detail
diff --git a/Control/AthContainers/AthContainers/tools/DVLDataBucket.h b/Control/AthContainers/AthContainers/tools/DVLDataBucket.h
index 6ca86a13087..fb1f97767d9 100644
--- a/Control/AthContainers/AthContainers/tools/DVLDataBucket.h
+++ b/Control/AthContainers/AthContainers/tools/DVLDataBucket.h
@@ -18,7 +18,7 @@
 #define ATHCONTAINERS_TOOLS_DVLDATABUCKET_H
 
 #include "AthContainers/ViewVector.h"
-#include "SGTools/DataBucket.h"
+#include "AthenaKernel/DataBucket.h"
 #include "AthContainers/tools/DVLInfo.h"
 #include <memory>
 
diff --git a/Control/AthContainers/AthContainers/tools/DVLEltBaseInfo.icc b/Control/AthContainers/AthContainers/tools/DVLEltBaseInfo.icc
index 240f80d796b..e90d288136a 100644
--- a/Control/AthContainers/AthContainers/tools/DVLEltBaseInfo.icc
+++ b/Control/AthContainers/AthContainers/tools/DVLEltBaseInfo.icc
@@ -93,7 +93,6 @@ struct RegisterDVLEltBaseInit
   RegisterDVLEltBaseInit();
   static void doinit (SG::BaseInfoBase* bib);
 };
-#ifndef __REFLEX__
 template <class T>
 RegisterDVLEltBaseInit<T>::RegisterDVLEltBaseInit()
 {
@@ -102,7 +101,6 @@ RegisterDVLEltBaseInit<T>::RegisterDVLEltBaseInit()
   // Set up the init function.
   SG::BaseInfoBase::addInit(&typeid(T), doinit);
 }
-#endif
 template <class T>
 void RegisterDVLEltBaseInit<T>::doinit (SG::BaseInfoBase* bib)
 {
diff --git a/Control/AthContainers/AthContainers/tools/DVLInfo.h b/Control/AthContainers/AthContainers/tools/DVLInfo.h
index 59997138bde..ed501bc937d 100644
--- a/Control/AthContainers/AthContainers/tools/DVLInfo.h
+++ b/Control/AthContainers/AthContainers/tools/DVLInfo.h
@@ -22,17 +22,7 @@
 #include "AthContainers/AuxVectorBase.h"
 #include <typeinfo>
 #include <cstddef>
-
-
-#if __cplusplus > 201100
-# include <type_traits>
-namespace SG_STD_OR_BOOST = std;
-#else
-# include "boost/type_traits/remove_const.hpp"
-# include "boost/type_traits/is_pointer.hpp"
-# include "boost/type_traits/is_base_of.hpp"
-namespace SG_STD_OR_BOOST = boost;
-#endif
+#include <type_traits>
 
 
 
@@ -215,9 +205,7 @@ public:
   typedef T Container;
 
   /// The container's element type (with pointer and any const removed).
-  typedef typename
-    SG_STD_OR_BOOST::remove_const<typename Container::base_value_type>::type
-    Elt;
+  typedef typename std::remove_const<typename Container::base_value_type>::type Elt;
 
 
   /**
diff --git a/Control/AthContainers/AthContainers/tools/DVLInfo.icc b/Control/AthContainers/AthContainers/tools/DVLInfo.icc
index 8767ec5f9da..a098d5d482d 100644
--- a/Control/AthContainers/AthContainers/tools/DVLInfo.icc
+++ b/Control/AthContainers/AthContainers/tools/DVLInfo.icc
@@ -24,7 +24,7 @@
 
 
 #ifndef XAOD_STANDALONE
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 #endif
 
 
@@ -40,7 +40,7 @@ namespace DataModel_detail {
  */
 template <class CONTAINER, class ELT>
 inline
-void dvlPush (CONTAINER& cont, ELT* elt, const SG_STD_OR_BOOST::true_type&)
+void dvlPush (CONTAINER& cont, ELT* elt, const std::true_type&)
 {
   cont.push_back (elt);
 }
@@ -56,7 +56,7 @@ void dvlPush (CONTAINER& cont, ELT* elt, const SG_STD_OR_BOOST::true_type&)
  */
 template <class CONTAINER, class ELT>
 inline
-void dvlPush (CONTAINER& cont, ELT* elt, const SG_STD_OR_BOOST::false_type&)
+void dvlPush (CONTAINER& cont, ELT* elt, const std::false_type&)
 {
   cont.push_back (*elt);
 }
@@ -70,7 +70,7 @@ void dvlPush (CONTAINER& cont, ELT* elt, const SG_STD_OR_BOOST::false_type&)
  */
 template <class ITERATOR>
 inline
-const void* dvlGetPointer (ITERATOR& it, const SG_STD_OR_BOOST::true_type&)
+const void* dvlGetPointer (ITERATOR& it, const std::true_type&)
 {
   return *it;
 }
@@ -85,7 +85,7 @@ const void* dvlGetPointer (ITERATOR& it, const SG_STD_OR_BOOST::true_type&)
  */
 template <class ITERATOR>
 inline
-const void* dvlGetPointer (ITERATOR& it, const SG_STD_OR_BOOST::false_type&)
+const void* dvlGetPointer (ITERATOR& it, const std::false_type&)
 {
   return &*it;
 }
@@ -95,12 +95,12 @@ const void* dvlGetPointer (ITERATOR& it, const SG_STD_OR_BOOST::false_type&)
  * @brief Helper for converting a container to @x AuxVectorBase.
  */
 template <class T>
-SG::AuxVectorBase* dvlGetBase (T* p, const SG_STD_OR_BOOST::true_type&)
+SG::AuxVectorBase* dvlGetBase (T* p, const std::true_type&)
 {
   return p;
 }
 template <class T>
-SG::AuxVectorBase* dvlGetBase (T*, const SG_STD_OR_BOOST::false_type&)
+SG::AuxVectorBase* dvlGetBase (T*, const std::false_type&)
 {
   return 0;
 }
@@ -165,7 +165,7 @@ void DVLInfo<T>::push (void* cont_p, void* elt_p) const
   Container* cont = reinterpret_cast<Container*> (cont_p);
   Elt* elt = reinterpret_cast<Elt*> (elt_p);
   dvlPush (*cont, elt,
-           typename SG_STD_OR_BOOST::is_pointer<typename Container::value_type>::type());
+           typename std::is_pointer<typename Container::value_type>::type());
 }
 
 
@@ -254,7 +254,7 @@ SG::AuxVectorBase* DVLInfo<T>::base (void* cont_p) const
   Container* cont = reinterpret_cast<Container*> (cont_p);
   return DataModel_detail::dvlGetBase
     (cont,
-     typename SG_STD_OR_BOOST::is_base_of<SG::AuxVectorBase,T>::type());
+     typename std::is_base_of<SG::AuxVectorBase,T>::type());
 }
 
 
@@ -288,7 +288,7 @@ const void* DVLIterator<T>::next()
     if (m_it == m_end)
       return 0;
     ret = dvlGetPointer (m_it, 
-                         typename SG_STD_OR_BOOST::is_pointer<typename T::value_type>::type());
+                         typename std::is_pointer<typename T::value_type>::type());
     ++m_it;
   }
   return ret;
@@ -324,7 +324,7 @@ size_t dvl_size_const (const std::list<T>& /*c*/)
 }
 
 
-#if defined(XAOD_STANDALONE) || defined(__GCCXML__)
+#if defined(XAOD_STANDALONE)
 template <class T>
 void* dvl_convert (const T& ,
                    const DVLInfoBase& )
@@ -349,7 +349,7 @@ void* dvl_convert (const T& src,
 {
   // @a src's element type, with pointer and const removed.
   typedef
-    typename SG_STD_OR_BOOST::remove_const<typename T::base_value_type>::type
+    typename std::remove_const<typename T::base_value_type>::type
     Elt;
 
   // Fetch the cast function.
@@ -426,7 +426,7 @@ void* dvl_convert (const T& src,
 }
 
 
-#if defined(XAOD_STANDALONE) || defined(__GCCXML__)
+#if defined(XAOD_STANDALONE)
 template <class T>
 void dvl_update (const T&,
                  void* ,
@@ -452,7 +452,7 @@ void dvl_update (const T& src,
 {
   // @a src's element type, with pointer and const removed.
   typedef
-    typename SG_STD_OR_BOOST::remove_const<typename T::base_value_type>::type
+    typename std::remove_const<typename T::base_value_type>::type
     Elt;
 
   // Clear the target container.
diff --git a/Control/AthContainers/AthContainers/tools/DVL_algorithms.h b/Control/AthContainers/AthContainers/tools/DVL_algorithms.h
index 1dcc2e90bc5..49a6ea056fb 100644
--- a/Control/AthContainers/AthContainers/tools/DVL_algorithms.h
+++ b/Control/AthContainers/AthContainers/tools/DVL_algorithms.h
@@ -916,7 +916,6 @@ random_shuffle
 }
                           
 
-#if __cplusplus > 201100
 /**
  * @brief Specialization of @c shuffle for @c DataVector/List.
  * @param beg The start iterator for the shuffle operation.
@@ -964,7 +963,6 @@ shuffle
                 g);
   DataModel_detail::resortAux (beg, end);
 }
-#endif
 
 
 } // namespace std
diff --git a/Control/AthContainers/AthContainers/tools/DVL_algorithms.icc b/Control/AthContainers/AthContainers/tools/DVL_algorithms.icc
index f01cf16a5da..645f4afa9a4 100644
--- a/Control/AthContainers/AthContainers/tools/DVL_algorithms.icc
+++ b/Control/AthContainers/AthContainers/tools/DVL_algorithms.icc
@@ -271,7 +271,7 @@ void resortAux (ForwardIterator beg,
  * Aux data case.
  */
 template <class DVL>
-void resortAux1 (const SG_STD_OR_BOOST::true_type&,
+void resortAux1 (const std::true_type&,
                  typename DataModel_detail::iterator<DVL> beg,
                  typename DataModel_detail::iterator<DVL> end)
 {
@@ -291,7 +291,7 @@ void resortAux1 (const SG_STD_OR_BOOST::true_type&,
  * Aux data case with reverse iterators.
  */
 template <class DVL>
-void resortAux1 (const SG_STD_OR_BOOST::true_type&,
+void resortAux1 (const std::true_type&,
                  typename std::reverse_iterator<typename DataModel_detail::iterator<DVL> > beg,
                  typename std::reverse_iterator<typename DataModel_detail::iterator<DVL> > end)
 {
@@ -312,7 +312,7 @@ void resortAux1 (const SG_STD_OR_BOOST::true_type&,
  */
 template <class ForwardIterator>
 inline
-void resortAux1 (const SG_STD_OR_BOOST::false_type&,
+void resortAux1 (const std::false_type&,
                  ForwardIterator,
                  ForwardIterator)
 {
diff --git a/Control/AthContainers/AthContainers/tools/ElementProxy.h b/Control/AthContainers/AthContainers/tools/ElementProxy.h
index 6a6a518a0db..4d233a6e0d0 100644
--- a/Control/AthContainers/AthContainers/tools/ElementProxy.h
+++ b/Control/AthContainers/AthContainers/tools/ElementProxy.h
@@ -92,8 +92,6 @@ public:
   ElementProxy& operator= (typename DVL::value_type rhs);
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
   /**
    * @brief Assignment operator, from a pointer.
    * @param rhs The pointer from which we're assigning.
@@ -104,8 +102,6 @@ public:
    * to use this interface.
    */
   ElementProxy& operator= (std::unique_ptr<typename DVL::base_value_type> rhs);
-#endif
-#endif
 
 
   /**
diff --git a/Control/AthContainers/AthContainers/tools/ElementProxy.icc b/Control/AthContainers/AthContainers/tools/ElementProxy.icc
index 8b5fa81d2a4..c394f225130 100644
--- a/Control/AthContainers/AthContainers/tools/ElementProxy.icc
+++ b/Control/AthContainers/AthContainers/tools/ElementProxy.icc
@@ -18,9 +18,6 @@
 namespace DataModel_detail {
 
 
-#ifndef __GCCXML__
-
-
 /**
  * @brief Constructor.
  * @param i The underlying container iterator pointing at
@@ -79,8 +76,6 @@ ElementProxy<DVL>& ElementProxy<DVL>::operator= (typename DVL::value_type rhs)
 }
 
 
-#if __cplusplus > 201100
-#ifndef __REFLEX__
 /**
  * @brief Assignment operator, from a pointer.
  * @param rhs The pointer from which we're assigning.
@@ -98,8 +93,6 @@ ElementProxy<DVL>::operator= (std::unique_ptr<typename DVL::base_value_type> rhs
     m_container->assignElement(m_proxied, std::move(rhs));
   return *this;
 }
-#endif
-#endif
 
 
 /**
@@ -150,7 +143,4 @@ const DVL* ElementProxy<DVL>::container() const
 }
 
 
-#endif // not __GCCXML__
-
-
 } // namespace DataModel_detail
diff --git a/Control/AthContainers/AthContainers/tools/IsMostDerivedFlag.h b/Control/AthContainers/AthContainers/tools/IsMostDerivedFlag.h
index afba730ab2c..21faed7a95e 100644
--- a/Control/AthContainers/AthContainers/tools/IsMostDerivedFlag.h
+++ b/Control/AthContainers/AthContainers/tools/IsMostDerivedFlag.h
@@ -36,9 +36,7 @@ public:
   IsMostDerivedFlag() : m_flag(false) {}
   IsMostDerivedFlag(bool flag) : m_flag(flag) {}
   IsMostDerivedFlag(const IsMostDerivedFlag&) : m_flag(false) {}
-#if __cplusplus > 201100
   IsMostDerivedFlag(IsMostDerivedFlag&&) : m_flag(false) {}
-#endif
   operator bool() const { return m_flag; }
   IsMostDerivedFlag& operator= (const IsMostDerivedFlag&) { return *this; }
   IsMostDerivedFlag& operator= (bool flag) { m_flag = flag; return *this;}
diff --git a/Control/AthContainers/AthContainers/tools/UDSLabelHashTable.h b/Control/AthContainers/AthContainers/tools/UDSLabelHashTable.h
deleted file mode 100644
index 28ba811496f..00000000000
--- a/Control/AthContainers/AthContainers/tools/UDSLabelHashTable.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//Dear emacs, this is -*-c++-*-
-
-
-#ifndef ATHCONTAINERS_UDSLABELHASHTABLE_H
-#define ATHCONTAINERS_UDSLABELHASHTABLE_H
-
-// Don't use this header outside of Athena:
-#ifdef XAOD_STANDALONE
-#error "UDSLabelHashTable.h is not to be used outside of Athena!"
-#endif // XAOD_STANDALONE
-
-
-#include "SGTools/crc64.h"
-#include <map>
-#include <string>
-#include "GaudiKernel/MsgStream.h"
-
-#include <stdint.h>
-
-
-/** @class UDSLabelHashTable
- * @brief Helper class for UserDataStore
- * Provides the hash function and keeps a map<hash,label>
- */
-
-class UDSLabelHashTable {
-
- public:
-  typedef uint32_t hash_t;
-
-  enum {INVALID=0};
-
-  hash_t hash(const std::string& label) const;
-  const std::string& getLabel(const hash_t number) const;
-  hash_t addLabel(const std::string& label);
-  void addLabel(const std::string& label, hash_t hash);
-
-  std::vector<const std::string*> getAllLabels() const;
-
-  size_t size() const {return m_hashLabels.size();}
-
-  typedef std::map<hash_t, std::string>::const_iterator const_iterator;
-  const_iterator begin() const { return m_hashLabels.begin(); }
-  const_iterator end()   const { return m_hashLabels.end();   }
-
- private:
-  std::map<hash_t, std::string> m_hashLabels;
-  std::string m_empty;
-  
-  
-};
-  
-inline
-UDSLabelHashTable::hash_t UDSLabelHashTable::hash(const std::string& label) const {
-  const uint64_t hash64=SG::crc64(label);
-  return (hash_t)(hash64 & 0xFFFFFFFF);
-}
-
-#endif // not ATHCONTAINERS_UDSLABELHASHTABLE_H
diff --git a/Control/AthContainers/AthContainers/tools/copyThinned.h b/Control/AthContainers/AthContainers/tools/copyThinned.h
index 5d25ec7f1d0..f59d9e9bb40 100644
--- a/Control/AthContainers/AthContainers/tools/copyThinned.h
+++ b/Control/AthContainers/AthContainers/tools/copyThinned.h
@@ -15,6 +15,10 @@
  * @c IAuxStore objects.  Support for other types may be added by
  * providing additional overloads for @c copyThinned1.
  *
+ * There are two variants: @c copyThinned and @ copyThinnedConst.  The former returns
+ * a non-const pointer, and the latter returns a const pointer.
+ * Only the const variety may be used with a @c DataVector instance.
+ *
  * In the signature of @c copyThinned1, the container is passed twice:
  * once as a reference and once as a pointer.  This allows one to use
  * overload resolution on the pointer argument to select the proper
@@ -50,7 +54,8 @@ namespace SG {
  * thinning defined in @c svc.  Ownership of the new object is passed
  * back to the caller.
  *
- * The code here handles @c DataVector and @c IAuxStore objects.
+ * The code here handles @c IAuxStore objects.
+ * (For a @c DataVector object, use @c copyThinnedConst.)
  * Support for additional object types may be added by adding
  * overloads for @c copyThinned1.
  */
@@ -60,6 +65,25 @@ copyThinned (const CONTAINER& orig,
              IThinningSvc* svc);
 
 
+/**
+ * @brief Helper to copy an object while applying thinning, const version.
+ * @param orig The object to copy.
+ * @param svc The thinning service.
+ *
+ * Returns a new copy of @c orig with elements removed according to the
+ * thinning defined in @c svc.  Ownership of the new object is passed
+ * back to the caller.
+ *
+ * The code here handles @c DataVector and @c IAuxStore objects.
+ * Support for additional object types may be added by adding
+ * overloads for @c copyThinned1.
+ */
+template <class CONTAINER>
+const CONTAINER*
+copyThinnedConst (const CONTAINER& orig,
+                  IThinningSvc* svc);
+
+
 /**
  * @brief Helper to copy an object while applying thinning.
  * @param orig The object to copy.
@@ -87,7 +111,7 @@ copyThinned1 (const CONTAINER& orig,
  * copy of @c orig, from which any thinned elements are removed.
  */
 template <class CONTAINER>
-CONTAINER*
+const CONTAINER*
 copyThinned1 (const CONTAINER& orig,
               const DataVector<typename CONTAINER::base_value_type>* dummy,
               IThinningSvc* svc);
diff --git a/Control/AthContainers/AthContainers/tools/copyThinned.icc b/Control/AthContainers/AthContainers/tools/copyThinned.icc
index 37402c9c18b..1a71a000ef7 100644
--- a/Control/AthContainers/AthContainers/tools/copyThinned.icc
+++ b/Control/AthContainers/AthContainers/tools/copyThinned.icc
@@ -44,7 +44,7 @@ copyThinned1 (const CONTAINER& orig,
  * copy of @c orig, from which any thinned elements are removed.
  */
 template <class CONTAINER>
-CONTAINER*
+const CONTAINER*
 copyThinned1 (const CONTAINER& orig,
               const DataVector<typename CONTAINER::base_value_type>* /*dummy*/,
               IThinningSvc* svc)
@@ -64,13 +64,7 @@ copyThinned1 (const CONTAINER& orig,
       }
     }
     
-    // FIXME: This is a const-correctness violation, but it's too
-    // hard to actually fix the interfaces at this time.
-    // It's problematic to have @c createPersistent return
-    // a const pointer, because the converter code will then try
-    // to register the results of extending converters, requiring
-    // a non-const pointer.
-    return const_cast<CONTAINER*> (newcont->asDataVector());
+    return newcont->asDataVector();
   }
 
   return new CONTAINER (orig);
@@ -115,6 +109,11 @@ copyThinned1 (const CONTAINER& orig,
  * Returns a new copy of @c orig with elements removed according to the
  * thinning defined in @c svc.  Ownership of the new object is passed
  * back to the caller.
+ *
+ * The code here handles @c IAuxStore objects.
+ * (For a @c DataVector object, use @c copyThinnedConst.)
+ * Support for additional object types may be added by adding
+ * overloads for @c copyThinned1.
  */
 template <class CONTAINER>
 CONTAINER* copyThinned (const CONTAINER& orig,
@@ -124,4 +123,25 @@ CONTAINER* copyThinned (const CONTAINER& orig,
 }
 
 
+/**
+ * @brief Helper to copy an object while applying thinning, const version.
+ * @param orig The object to copy.
+ * @param svc The thinning service.
+ *
+ * Returns a new copy of @c orig with elements removed according to the
+ * thinning defined in @c svc.  Ownership of the new object is passed
+ * back to the caller.
+ *
+ * The code here handles @c DataVector and @c IAuxStore objects.
+ * Support for additional object types may be added by adding
+ * overloads for @c copyThinned1.
+ */
+template <class CONTAINER>
+const CONTAINER* copyThinnedConst (const CONTAINER& orig,
+                                   IThinningSvc* svc)
+{
+  return copyThinned1 (orig, &orig, svc);
+}
+
+
 } // namespace SG
diff --git a/Control/AthContainers/AthContainers/tools/foreach.h b/Control/AthContainers/AthContainers/tools/foreach.h
deleted file mode 100644
index 5aa9bb6eac2..00000000000
--- a/Control/AthContainers/AthContainers/tools/foreach.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// This file's extension implies that it's C, but it's really -*- C++ -*-.
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id$
-/**
- * @file AthContainers/tools/foreach.h
- * @author scott snyder <snyder@bnl.gov>
- * @date Sep, 2013
- * @brief foreach helper for standalone build.
- *
- * Define @c ATHCONTAINERS_FOREACH to use either @c BOOST_FOREACH
- * for C++ directly, depending on whether or not we're using c++11.
- */
-
-
-#ifndef ATHCONTAINERS_FOREACH_H
-#define ATHCONTAINERS_FOREACH_H
-
-
-#if __cplusplus < 201100
-# include "boost/foreach.hpp"
-# define ATHCONTAINERS_FOREACH(A, B) BOOST_FOREACH(A, B)
-#else
-# define ATHCONTAINERS_FOREACH(A, B) for (A : B)
-#endif
-
-
-#endif // not ATHCONTAINERS_FOREACH_H
diff --git a/Control/AthContainers/AthContainers/tools/threading.h b/Control/AthContainers/AthContainers/tools/threading.h
index 34e224d351b..274e7095162 100644
--- a/Control/AthContainers/AthContainers/tools/threading.h
+++ b/Control/AthContainers/AthContainers/tools/threading.h
@@ -21,13 +21,6 @@
 #define ATHCONTAINERS_THREADING_H
 
 
-#if defined(__GCCXML__)
-# ifndef ATHCONTAINERS_NO_THREADS
-#  define ATHCONTAINERS_NO_THREADS
-# endif
-#endif
-
-
 #ifdef ATHCONTAINERS_NO_THREADS
 
 
@@ -116,17 +109,9 @@ inline void fence_seq_cst() {}
 
 #include "boost/thread/shared_mutex.hpp"
 #include "boost/thread/tss.hpp"
-#if __cplusplus > 201100
-# include <atomic>
-# include <mutex>
-# include <thread>
-namespace SG_STD_OR_BOOST = std;
-#else
-# include "boost/atomic.hpp"
-# include "boost/thread/mutex.hpp"
-# include "boost/thread/thread.hpp"
-namespace SG_STD_OR_BOOST = boost;
-#endif
+#include <atomic>
+#include <mutex>
+#include <thread>
 
 
 namespace AthContainers_detail {
@@ -136,10 +121,9 @@ namespace AthContainers_detail {
 using boost::upgrade_mutex;
 using boost::thread_specific_ptr;
 
-// Other mutex/lock types come from either boost or std.
-using SG_STD_OR_BOOST::mutex;
-using SG_STD_OR_BOOST::lock_guard;
-using SG_STD_OR_BOOST::thread;
+using std::mutex;
+using std::lock_guard;
+using std::thread;
 
 
 /**
diff --git a/Control/AthContainers/AthContainers/tools/threading.icc b/Control/AthContainers/AthContainers/tools/threading.icc
index e51cd3eeec5..91bdff03f1e 100644
--- a/Control/AthContainers/AthContainers/tools/threading.icc
+++ b/Control/AthContainers/AthContainers/tools/threading.icc
@@ -23,7 +23,7 @@ namespace AthContainers_detail {
 inline
 void fence_acq_rel()
 {
-  SG_STD_OR_BOOST::atomic_thread_fence (SG_STD_OR_BOOST::memory_order_acq_rel);
+  std::atomic_thread_fence (std::memory_order_acq_rel);
 }
 
 
@@ -33,7 +33,7 @@ void fence_acq_rel()
 inline
 void fence_seq_cst()
 {
-  SG_STD_OR_BOOST::atomic_thread_fence (SG_STD_OR_BOOST::memory_order_seq_cst);
+  std::atomic_thread_fence (std::memory_order_seq_cst);
 }
 
 
diff --git a/Control/AthContainers/CMakeLists.txt b/Control/AthContainers/CMakeLists.txt
index 504dc07e5c1..f7a2a615d3c 100644
--- a/Control/AthContainers/CMakeLists.txt
+++ b/Control/AthContainers/CMakeLists.txt
@@ -72,7 +72,6 @@ _add_test( IsMostDerivedFlag_test )
 _add_test( ElementProxy_test )
 _add_test( DVLIterator_test )
 _add_test( DVL_iter_swap_test )
-_add_test( foreach_test )
 _add_test( AuxTypeVector_test )
 _add_test( AuxTypeVectorFactory_test )
 _add_test( AuxTypeRegistry_test EXTRA_PATTERNS "will use std::" )
diff --git a/Control/AthContainers/Root/AuxElement.cxx b/Control/AthContainers/Root/AuxElement.cxx
index 56145ab2374..6726c508b8c 100644
--- a/Control/AthContainers/Root/AuxElement.cxx
+++ b/Control/AthContainers/Root/AuxElement.cxx
@@ -14,7 +14,6 @@
 #include "AthContainers/AuxElement.h"
 #include "AthContainers/AuxStoreStandalone.h"
 #include "AthContainers/exceptions.h"
-#include "AthContainers/tools/foreach.h"
 
 
 
@@ -437,7 +436,7 @@ void AuxElement::clearAux()
 
   SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
   SG::AuxTypeRegistry::lock_t lock (r);
-  ATHCONTAINERS_FOREACH (SG::auxid_t auxid, m_container->getWritableAuxIDs()) {
+  for (SG::auxid_t auxid : m_container->getWritableAuxIDs()) {
     void* dst = m_container->getDataArray (auxid);
     r.clear (lock, auxid, dst, m_index);
   }
@@ -475,7 +474,7 @@ void AuxElement::copyAux (const AuxElement& other)
 
   SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
 
-  ATHCONTAINERS_FOREACH (SG::auxid_t auxid, other_ids) {
+  for (SG::auxid_t auxid : other_ids) {
     const void* src = ocont->getDataArrayAllowMissing (auxid);
     if (src) {
       void* dst = m_container->getDataArray (auxid);
@@ -487,7 +486,7 @@ void AuxElement::copyAux (const AuxElement& other)
     }
   }
 
-  ATHCONTAINERS_FOREACH (SG::auxid_t auxid, m_container->getWritableAuxIDs()) {
+  for (SG::auxid_t auxid : m_container->getWritableAuxIDs()) {
     if (other_ids.find (auxid) == other_ids.end()) {
       void* dst = m_container->getDataArray (auxid);
       r.clear (auxid, dst, m_index);
diff --git a/Control/AthContainers/Root/AuxTypeRegistry.cxx b/Control/AthContainers/Root/AuxTypeRegistry.cxx
index 0984f6be4d7..b8fa0856255 100644
--- a/Control/AthContainers/Root/AuxTypeRegistry.cxx
+++ b/Control/AthContainers/Root/AuxTypeRegistry.cxx
@@ -14,7 +14,6 @@
 #include "AthContainers/AuxTypeRegistry.h"
 #include "AthContainers/exceptions.h"
 #include "AthContainers/normalizedTypeinfoName.h"
-#include "AthContainers/tools/foreach.h"
 #include "AthLinks/ElementLinkBase.h"
 #include "CxxUtils/checker_macros.h"
 #include <cassert>
@@ -652,9 +651,9 @@ AuxTypeRegistry::AuxTypeRegistry()
  */
 AuxTypeRegistry::~AuxTypeRegistry()
 {
-  ATHCONTAINERS_FOREACH (ti_map_t::value_type& p, m_factories)
+  for (ti_map_t::value_type& p : m_factories)
     delete p.second;
-  ATHCONTAINERS_FOREACH (const IAuxTypeVectorFactory* p, m_oldFactories)
+  for (const IAuxTypeVectorFactory* p : m_oldFactories)
     delete p;
 }
 
diff --git a/Control/AthContainers/Root/AuxVectorBase.cxx b/Control/AthContainers/Root/AuxVectorBase.cxx
index 9aaad19f378..d4e7d40f6ea 100644
--- a/Control/AthContainers/Root/AuxVectorBase.cxx
+++ b/Control/AthContainers/Root/AuxVectorBase.cxx
@@ -12,7 +12,6 @@
 
 
 #include "AthContainers/AuxVectorBase.h"
-#include "AthContainers/tools/foreach.h"
 
 
 namespace SG {
@@ -33,7 +32,6 @@ AuxVectorBase::AuxVectorBase()
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Move constructor.
  * @param rhs The container from which to move.
@@ -57,7 +55,6 @@ AuxVectorBase& AuxVectorBase::operator= (AuxVectorBase&& rhs)
   }
   return *this;
 }
-#endif
 
 
 /**
@@ -132,7 +129,7 @@ void AuxVectorBase::setStore (const DataLink<SG::IConstAuxStore>& store)
  * (but that should never actually happen).
  */
 void
-AuxVectorBase::initAuxVectorBase1 (const SG_STD_OR_BOOST::false_type&,
+AuxVectorBase::initAuxVectorBase1 (const std::false_type&,
                                    SG::OwnershipPolicy /*ownPolicy*/,
                                    SG::IndexTrackingPolicy /*indexTrackingPolicy*/)
 {
@@ -152,7 +149,7 @@ AuxVectorBase::initAuxVectorBase1 (const SG_STD_OR_BOOST::false_type&,
  * has an associated store.
  */
 void
-AuxVectorBase::initAuxVectorBase1 (const SG_STD_OR_BOOST::true_type&,
+AuxVectorBase::initAuxVectorBase1 (const std::true_type&,
                                    SG::OwnershipPolicy ownPolicy,
                                    SG::IndexTrackingPolicy indexTrackingPolicy)
 {
@@ -176,7 +173,7 @@ AuxVectorBase::initAuxVectorBase1 (const SG_STD_OR_BOOST::true_type&,
  *
  * The auxdata case.
  */
-void AuxVectorBase::resize1 (const SG_STD_OR_BOOST::true_type&, size_t size)
+void AuxVectorBase::resize1 (const std::true_type&, size_t size)
 {
   if (this->hasNonConstStore()) {
     if (!this->getStore()->resize (size)) {
@@ -195,7 +192,7 @@ void AuxVectorBase::resize1 (const SG_STD_OR_BOOST::true_type&, size_t size)
  *
  * The auxdata case.
  */
-void AuxVectorBase::reserve1 (const SG_STD_OR_BOOST::true_type&, size_t size)
+void AuxVectorBase::reserve1 (const std::true_type&, size_t size)
 {
   if (this->hasNonConstStore()) {
     this->getStore()->reserve (size);
@@ -298,12 +295,12 @@ void AuxVectorBase::swapElementsAux (size_t aindex,
   SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
   SG::AuxTypeRegistry::lock_t lock (r);
 
-  ATHCONTAINERS_FOREACH (SG::auxid_t auxid, a_ids) {
+  for (SG::auxid_t auxid : a_ids) {
     void* aptr = acont->getDataArray (auxid);
     void* bptr = bcont->getDataArray (auxid);
     r.swap (lock, auxid, aptr, aindex, bptr, bindex);
   }
-  ATHCONTAINERS_FOREACH (SG::auxid_t auxid, b_ids) {
+  for (SG::auxid_t auxid : b_ids) {
     if (a_ids.find (auxid) == a_ids.end()) {
       void* aptr = acont->getDataArray (auxid);
       void* bptr = bcont->getDataArray (auxid);
@@ -335,7 +332,7 @@ AuxVectorBase::ResortAuxHelper::ResortAuxHelper (size_t sz,
   size_t naux = auxid_set.size();
   m_auxdata.reserve (naux);
   m_auxids.reserve (naux);
-  ATHCONTAINERS_FOREACH (SG::auxid_t auxid, auxid_set) {
+  for (SG::auxid_t auxid : auxid_set) {
     m_auxdata.push_back (vec.getDataArrayForResort (auxid));
     m_auxids.push_back (auxid);
   }
diff --git a/Control/AthContainers/Root/AuxVectorData.cxx b/Control/AthContainers/Root/AuxVectorData.cxx
index df19512fad3..47c4f897fa6 100644
--- a/Control/AthContainers/Root/AuxVectorData.cxx
+++ b/Control/AthContainers/Root/AuxVectorData.cxx
@@ -42,7 +42,6 @@ AuxVectorData::AuxVectorData()
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Move constructor.
  * @param rhs The container from which to move.
@@ -81,7 +80,6 @@ AuxVectorData& AuxVectorData::operator= (AuxVectorData&& rhs)
   }
   return *this;
 }
-#endif
 
 
 /**
@@ -420,7 +418,6 @@ AuxVectorData::Cache::Cache()
 }
 
 
-#if __cplusplus > 201100
 /**
  * @brief Cache manager move constructor.
  * @param rhs The cache from which to copy.
@@ -456,7 +453,6 @@ AuxVectorData::Cache& AuxVectorData::Cache::operator= (Cache&& rhs)
   }
   return *this;
 }
-#endif
 
 
 /**
diff --git a/Control/AthContainers/Root/DVLInfo.cxx b/Control/AthContainers/Root/DVLInfo.cxx
index 3bc0f7c19ac..5fe39922bf2 100644
--- a/Control/AthContainers/Root/DVLInfo.cxx
+++ b/Control/AthContainers/Root/DVLInfo.cxx
@@ -18,7 +18,7 @@
 #include "AthContainers/tools/DVLInfo.h"
 #include "AthContainers/tools/threading.h"
 #ifndef XAOD_STANDALONE
-#include "SGTools/CLIDRegistry.h"
+#include "AthenaKernel/CLIDRegistry.h"
 #endif
 #include <typeinfo>
 #include <string>
diff --git a/Control/AthContainers/Root/UDSLabelHashTable.cxx b/Control/AthContainers/Root/UDSLabelHashTable.cxx
deleted file mode 100644
index cad5a1a914a..00000000000
--- a/Control/AthContainers/Root/UDSLabelHashTable.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef XAOD_STANDALONE
-
-#include "AthContainers/tools/UDSLabelHashTable.h"
-#include "AthenaKernel/getMessageSvc.h"
-
-void UDSLabelHashTable::addLabel(const std::string& label, hash_t hash)
-{
-  hash_t h = addLabel (label);
-  if (h != hash) {
-    MsgStream logstr(Athena::getMessageSvc(), "UDSLabelHashTable");
-    logstr << MSG::ERROR << "Hash mismatch for " << label
-           << ": " << hash << "/" << h << endmsg;
-  }
-}
-
-
-UDSLabelHashTable::hash_t UDSLabelHashTable::addLabel(const std::string& label) {
-  if (label.size()==0) {
-    MsgStream logstr(Athena::getMessageSvc(), "UDSLabelHashTable");
-    logstr << MSG::ERROR << "Zero-length string given as Label!" << endmsg;
-    return INVALID;
-  }
-  hash_t h=this->hash(label);
-  if (h==INVALID) {
-    MsgStream logstr(Athena::getMessageSvc(), "UDSLabelHashTable");
-    logstr << MSG::ERROR << "Label " << label << " yields an invalid hash. Please choose different name!" << endmsg;
-    return INVALID;
-  }
-
-  std::map<hash_t, std::string>::const_iterator it=m_hashLabels.find(h);
-  if (it==m_hashLabels.end()) {
-    //new label, new hash
-    m_hashLabels[h]=label;
-  }
-  else {
-    //Hash exists already
-    if (it->second!=label) { //Same hash but different label -> hash-collision! 
-      MsgStream logstr(Athena::getMessageSvc(), "UDSLabelHashTable");
-      logstr << MSG::ERROR << "Hash collision between label " << label << " and label " << it->second << endmsg;
-      return INVALID;
-    }
-  }
-  return h;
-}
-   
-
-const std::string& UDSLabelHashTable::getLabel(const hash_t number) const {
-  std::map<hash_t, std::string>::const_iterator it=m_hashLabels.find(number);
-  if (it==m_hashLabels.end()) 
-    return m_empty;
-  else 
-    return it->second;
-}
-
-
-std::vector<const std::string*> UDSLabelHashTable::getAllLabels() const {
-
-  std::vector<const std::string*> allLabels;
-  allLabels.reserve(m_hashLabels.size());
-  std::map<hash_t, std::string>::const_iterator it=m_hashLabels.begin();
-  std::map<hash_t, std::string>::const_iterator it_e=m_hashLabels.end();
-  for(;it!=it_e;++it) 
-    allLabels.push_back(&(it->second));
-
-  return allLabels;
-}
-
-#endif // not XAOD_STANDALONE
diff --git a/Control/AthContainers/Root/UserDataStore.cxx b/Control/AthContainers/Root/UserDataStore.cxx
deleted file mode 100644
index bc0d9ecd6f9..00000000000
--- a/Control/AthContainers/Root/UserDataStore.cxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "AthContainers/UserDataStore.h"
-
-#ifndef XAOD_STANDALONE
-
-#include "AthenaKernel/getMessageSvc.h"
-
-UserDataStore::UserDataStore() : 
-  m_data(), 
-  m_lastIt(m_data.end()), 
-  m_lastIt_nc(m_data.end()),
-  m_eventABC(IAthenaBarCode::UNDEFINEDBARCODE),
-  m_msg(Athena::getMessageSvc(),"UserDataStore"),
-  m_whyNotFound(ALLGOOD)
-
- {}
-
-
-
-UserDataStore::const_iterator
-UserDataStore::find(const AthenaBarCode_t& barcode, const std::string& label) const {
-  m_whyNotFound=ALLGOOD;
-  if (m_lastIt==m_data.end() || m_lastIt->first!=barcode) 
-    m_lastIt=m_data.find(barcode);
-  
-  if (m_lastIt==m_data.end()) { //No user data for this bar-code
-    m_whyNotFound=BARCODE;
-    return m_notFoundIt;
-  }
-
-  const index_t idx=m_labelTable.hash(label);
-  const_iterator label_it=m_lastIt->second.find(idx);
-  if (label_it==m_lastIt->second.end()) {
-    //std::cout << "Did not find label " << label << "(hash=" << idx << ")" << std::endl;
-    m_whyNotFound=LABEL;
-    return m_notFoundIt;
-  }
-  else 
-    return label_it;
-}
-
-void UserDataStore::setEventABC(const AthenaBarCode_t& eventABC) {
-  if (m_eventABC==IAthenaBarCode::UNDEFINEDBARCODE)  m_eventABC=eventABC;
-}
-    
-
-
-StatusCode UserDataStore::recordAny(const IAthenaBarCode& obj, const std::string& label, const boost::any& value) {
-  const AthenaBarCode_t& barcode=obj.getAthenaBarCode();
-  
-  if (barcode==IAthenaBarCode::UNDEFINEDBARCODE) {
-    m_msg << MSG::ERROR << "Attempt to record UserData for an object with undefined AthenaBarCode. Label=" << label << endmsg;
-    return StatusCode::FAILURE;
-  }
-
-  const index_t idx=m_labelTable.addLabel(label);
-  if (idx==UDSLabelHashTable::INVALID) {
-    m_msg << MSG::ERROR << "Failed to convert label '" << label << "' into a hash value" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  else {
-    if (m_lastIt_nc==m_data.end() || m_lastIt_nc->first!=barcode) {
-      m_lastIt_nc=m_data.find(barcode);
-    }
-    if (m_lastIt_nc==m_data.end()) {
-      m_lastIt_nc=m_data.insert(std::make_pair(barcode,m_defaultEntry)).first;
-    }
-    (m_lastIt_nc->second)[idx]=value;
-    return StatusCode::SUCCESS;
-  }
-}
-
-
-StatusCode UserDataStore::retrieveAny(const IAthenaBarCode& obj, const std::string& label, const boost::any*& value) const {
-  const AthenaBarCode_t& barcode=obj.getAthenaBarCode();
-  
-  const_iterator it=this->find(barcode,label);
-  if (it==m_notFoundIt) {
-    if (m_whyNotFound==BARCODE) 
-      m_msg << MSG::ERROR << "No user data found for bar code " << barcode << endmsg;
-    if (m_whyNotFound==LABEL) 
-      m_msg << MSG::ERROR << "No user data with label '" << label << "' found for this barcode" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  else {
-    value=&(it->second);
-    return StatusCode::SUCCESS;
-  }
-}
-
-
-bool UserDataStore::contains(const IAthenaBarCode& obj, const std::string& label) const {
- const AthenaBarCode_t& barcode=obj.getAthenaBarCode();
- const_iterator it=this->find(barcode,label);
- return (it!=m_notFoundIt);
-}
-
-
-std::vector<const std::string*> UserDataStore::getLabels(const AthenaBarCode_t& barcode) const {
-  
-  std::vector<const std::string*> out;
-  mapmap_t::const_iterator abc_it=m_data.find(barcode);
-  if (abc_it!=m_data.end()) {
-    const std::map<index_t, boost::any>& labelMap=abc_it->second;
-    const_iterator it=labelMap.begin();
-    const_iterator it_e=labelMap.end();
-    for (;it!=it_e;++it) {
-      const std::string& sLabel=m_labelTable.getLabel(it->first);
-      out.push_back(&sLabel);
-    }
-  }// end if abc_it!=m_data.end()
-  return out;
-}
-
-#endif // not XAOD_STANDALONE
diff --git a/Control/AthContainers/share/foreach_test.ref b/Control/AthContainers/share/foreach_test.ref
deleted file mode 100644
index 3b6d9b5ee93..00000000000
--- a/Control/AthContainers/share/foreach_test.ref
+++ /dev/null
@@ -1,2 +0,0 @@
-test1
-10 11 12 13 14 15 16 17 18 19 
diff --git a/Control/AthContainers/src/copyAuxStoreThinned.cxx b/Control/AthContainers/src/copyAuxStoreThinned.cxx
index 1112306e938..c3238e67b2e 100644
--- a/Control/AthContainers/src/copyAuxStoreThinned.cxx
+++ b/Control/AthContainers/src/copyAuxStoreThinned.cxx
@@ -13,7 +13,6 @@
 
 #include "AthContainers/tools/copyAuxStoreThinned.h"
 #include "AthContainers/tools/getThinnedFlags.h"
-#include "AthContainers/tools/foreach.h"
 #include "AthContainers/AuxTypeRegistry.h"
 #include "AthContainersInterfaces/IConstAuxStore.h"
 #include "AthContainersInterfaces/IAuxStore.h"
@@ -64,7 +63,7 @@ void copyAuxStoreThinned NO_SANITIZE_UNDEFINED
   copy.resize (nremaining);
   
   // Loop over all the variables of the original container:
-  ATHCONTAINERS_FOREACH (SG::auxid_t auxid, auxids) {
+  for (SG::auxid_t auxid : auxids) {
     // Skip null auxids (happens if we don't have the dictionary)
     if(auxid == SG::null_auxid) continue;
 
diff --git a/Control/AthContainers/test/AuxElementComplete_test.cxx b/Control/AthContainers/test/AuxElementComplete_test.cxx
index 0913177c777..885586aad1e 100644
--- a/Control/AthContainers/test/AuxElementComplete_test.cxx
+++ b/Control/AthContainers/test/AuxElementComplete_test.cxx
@@ -94,7 +94,6 @@ void test1()
   assert (elt3.ityp1() == 31);
   assert (elt3.container() != elt.container());
 
-#if __cplusplus > 201100
   elt.ityp1() = 41;
   assert (elt3.ityp1() == 31);
   elt3 = std::move(elt);
@@ -107,7 +106,6 @@ void test1()
   assert (ityp2(elt4) == 2);
   assert (elt4.ftyp1() == 1.5);
   assert (elt4.container() != elt.container());
-#endif
 
   elt3.ityp1() = 41;
   elt.releasePrivateStore();
diff --git a/Control/AthContainers/test/AuxTypeRegistry_test.cxx b/Control/AthContainers/test/AuxTypeRegistry_test.cxx
index c2e034b7d64..126aadfbd38 100644
--- a/Control/AthContainers/test/AuxTypeRegistry_test.cxx
+++ b/Control/AthContainers/test/AuxTypeRegistry_test.cxx
@@ -23,7 +23,7 @@
 #ifndef XAOD_STANDALONE
 #include "SGTools/TestStore.h"
 #include "SGTools/StringPool.h"
-#include "SGTools/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 CLASS_DEF (std::vector<int*>, 28374627, 0)
 using namespace SGTest;
 
diff --git a/Control/AthContainers/test/AuxVectorBase_test.cxx b/Control/AthContainers/test/AuxVectorBase_test.cxx
index a2023368265..2136ef34ba0 100644
--- a/Control/AthContainers/test/AuxVectorBase_test.cxx
+++ b/Control/AthContainers/test/AuxVectorBase_test.cxx
@@ -954,7 +954,6 @@ void test_move()
 {
   std::cout << "test_move\n";
 
-#if __cplusplus > 201100
   SG::AuxVectorBase_test b1;
   b1.initAuxVectorBase<B> (SG::OWN_ELEMENTS, SG::DEFAULT_TRACK_INDICES);
   SG::AuxStoreInternal store;
@@ -981,7 +980,6 @@ void test_move()
   assert (b3.getStore() == &store);
   assert (b3.getData<int> (ityp, 0) == 1);
   assert (b3.getData<int> (ityp, 1) == 2);
-#endif
 }
 
 
diff --git a/Control/AthContainers/test/AuxVectorData_test.cxx b/Control/AthContainers/test/AuxVectorData_test.cxx
index c96b7f2147f..940e344500b 100644
--- a/Control/AthContainers/test/AuxVectorData_test.cxx
+++ b/Control/AthContainers/test/AuxVectorData_test.cxx
@@ -18,7 +18,6 @@
 #include "AthContainers/AuxTypeRegistry.h"
 #include "AthContainers/AuxStoreInternal.h"
 #include "AthContainers/exceptions.h"
-#include "AthContainers/tools/foreach.h"
 #include "SGTools/TestStore.h"
 #include "TestTools/expect_exception.h"
 #include "CxxUtils/checker_macros.h"
@@ -233,7 +232,6 @@ void test_move()
 {
   std::cout << "test_move\n";
 
-#if __cplusplus > 201100
   AuxVectorData_test b1;
   SG::AuxStoreInternal store;
   b1.setStore (&store);
@@ -260,7 +258,6 @@ void test_move()
   assert (b3.getStore() == &store);
   assert (b3.getData<int> (ityp, 0) == 1);
   assert (b3.getData<int> (ityp, 1) == 2);
-#endif
 }
 
 
@@ -322,7 +319,7 @@ ThreadingTest::ThreadingTest()
 
 void ThreadingTest::worker (AuxVectorData& b, size_t istart)
 {
-  ATHCONTAINERS_FOREACH (SG::auxid_t id, m_ids) {
+  for (SG::auxid_t id : m_ids) {
     assert (b.getData<int> (id, istart) == static_cast<int>(id*1234 + istart));
     ++istart;
     if (istart >= m_nelt) istart = 0;
@@ -332,7 +329,7 @@ void ThreadingTest::worker (AuxVectorData& b, size_t istart)
 
 void ThreadingTest::worker_c (const AuxVectorData& b, size_t istart)
 {
-  ATHCONTAINERS_FOREACH (SG::auxid_t id, m_ids) {
+  for (SG::auxid_t id : m_ids) {
     assert (b.getData<int> (id, istart) == static_cast<int>(id*1234 + istart));
     ++istart;
     if (istart >= m_nelt) istart = 0;
diff --git a/Control/AthContainers/test/DVLInfo_test.cxx b/Control/AthContainers/test/DVLInfo_test.cxx
index 620cc34106d..5cf72494dd7 100644
--- a/Control/AthContainers/test/DVLInfo_test.cxx
+++ b/Control/AthContainers/test/DVLInfo_test.cxx
@@ -17,7 +17,7 @@
 #include "AthContainers/tools/DVLInfo.h"
 #include "SGTools/BaseInfo.h"
 #include "SGTools/CLASS_DEF.h"
-#include "boost/type_traits/remove_pointer.hpp"
+#include <type_traits>
 #include <vector>
 #include <list>
 #include <cassert>
@@ -136,7 +136,7 @@ class mycont
   : public T
 {
 public:
-  typedef typename boost::remove_pointer<typename T::value_type>::type
+  typedef typename std::remove_pointer<typename T::value_type>::type
     base_value_type;
   mycont (SG::OwnershipPolicy pol) : m_pol (pol) {}
   T& stdcont() { return *this; }
diff --git a/Control/AthContainers/test/DataVector_test.cxx b/Control/AthContainers/test/DataVector_test.cxx
index 39f61850d40..1e1d7daf6bd 100644
--- a/Control/AthContainers/test/DataVector_test.cxx
+++ b/Control/AthContainers/test/DataVector_test.cxx
@@ -19,8 +19,8 @@
 #include <boost/iterator_adaptors.hpp>
 #include <boost/iterator/indirect_iterator.hpp>
 #include <boost/assign/list_of.hpp>
-#include "SGTools/CLASS_DEF.h"
-#include "SGTools/ClassName.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthenaKernel/ClassName.h"
 
 
 #include "DataVector_test.icc"
diff --git a/Control/AthContainers/test/DataVector_test.icc b/Control/AthContainers/test/DataVector_test.icc
index 0f3f16df721..e21548e5a33 100644
--- a/Control/AthContainers/test/DataVector_test.icc
+++ b/Control/AthContainers/test/DataVector_test.icc
@@ -17,7 +17,6 @@
 
 
 #include "AthContainers/exceptions.h"
-#include "AthContainers/tools/foreach.h"
 #include "TestTools/expect_exception.h"
 #include "SGTools/TestStore.h"
 #include "CxxUtils/checker_macros.h"
@@ -413,7 +412,7 @@ template <class T>
 void checkaux1 (const DataVector<T>& v, const SG::AuxElement*)
 {
   if (!v.hasNonConstStore()) return;
-  ATHCONTAINERS_FOREACH (const typename DataVector<T>::base_value_type* p, v) {
+  for (const typename DataVector<T>::base_value_type* p : v) {
     if (p)
       p->checkaux();
   }
@@ -462,7 +461,7 @@ void setaux1 (DV& v, SG::IAuxStore& store, const SG::AuxElement*)
 {
   if (!v.hasNonConstStore())
     v.setStore (&store);
-  ATHCONTAINERS_FOREACH (typename DV::value_type p, v) {
+  for (typename DV::value_type p : v) {
     if (p)
       p->setaux();
   }
@@ -575,7 +574,7 @@ struct test2_maybeconst1
 
 
 template <class T>
-struct test2_maybeconst1<T, SG_STD_OR_BOOST::true_type>
+struct test2_maybeconst1<T, std::true_type>
 {
   typedef T type;
 };
diff --git a/Control/AthContainers/test/IsMostDerivedFlag_test.cxx b/Control/AthContainers/test/IsMostDerivedFlag_test.cxx
index 27d2161cf19..5e131b306c1 100644
--- a/Control/AthContainers/test/IsMostDerivedFlag_test.cxx
+++ b/Control/AthContainers/test/IsMostDerivedFlag_test.cxx
@@ -30,10 +30,8 @@ void test1()
   assert (f2 == true);
   SG::IsMostDerivedFlag f3 (f2);
   assert (f3 == false);
-#if __cplusplus > 201100
   SG::IsMostDerivedFlag f4 (std::move (f2));
   assert (f4 == false);
-#endif
 }
 
 
diff --git a/Control/AthContainers/test/ViewVectorBase_test.cxx b/Control/AthContainers/test/ViewVectorBase_test.cxx
index 0ef75cc446a..b1a121b7c16 100644
--- a/Control/AthContainers/test/ViewVectorBase_test.cxx
+++ b/Control/AthContainers/test/ViewVectorBase_test.cxx
@@ -18,7 +18,7 @@
 #include "AthContainers/DataVector.h"
 #include "AthContainers/AuxElement.h"
 #include "SGTools/TestStore.h"
-#include "SGTools/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "CxxUtils/checker_macros.h"
 #include <iostream>
 #include <cassert>
diff --git a/Control/AthContainers/test/ViewVector_test.cxx b/Control/AthContainers/test/ViewVector_test.cxx
index 402644c83ec..245b1164c57 100644
--- a/Control/AthContainers/test/ViewVector_test.cxx
+++ b/Control/AthContainers/test/ViewVector_test.cxx
@@ -19,9 +19,9 @@
 #include "AthContainers/ViewVector.h"
 #include "AthContainers/ConstDataVector.h"
 #include "AthContainers/DataVector.h"
-#include "SGTools/BaseInfo.h"
 #include "SGTools/TestStore.h"
-#include "SGTools/CLASS_DEF.h"
+#include "AthenaKernel/BaseInfo.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "TestTools/expect_exception.h"
 #include "CxxUtils/checker_macros.h"
 #include <iostream>
diff --git a/Control/AthContainers/test/copyAuxStoreThinned_test.cxx b/Control/AthContainers/test/copyAuxStoreThinned_test.cxx
index a85c10d62e2..142bc69ab2a 100644
--- a/Control/AthContainers/test/copyAuxStoreThinned_test.cxx
+++ b/Control/AthContainers/test/copyAuxStoreThinned_test.cxx
@@ -19,7 +19,6 @@
 #include "AthContainers/AuxStoreInternal.h"
 #include "AthContainers/AuxTypeRegistry.h"
 #include "AthContainers/PackedContainer.h"
-#include "AthContainers/tools/foreach.h"
 #include <vector>
 #include <iostream>
 #include <cassert>
@@ -37,7 +36,7 @@ public:
   {
     m_suppressed.insert (auxid);
     m_selected = getAuxIDs();
-    ATHCONTAINERS_FOREACH(SG::auxid_t auxid, m_suppressed)
+    for (SG::auxid_t auxid : m_suppressed)
       m_selected.erase (auxid);
   }
 
@@ -79,7 +78,7 @@ void compare (const SG::AuxStoreInternal& a,
 
   const SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance();
 
-  ATHCONTAINERS_FOREACH(SG::auxid_t id, a.getAuxIDs()) {
+  for (SG::auxid_t id : a.getAuxIDs()) {
     if (id == suppressed) {
       assert (b.getAuxIDs().count(id) == 0);
       continue;
diff --git a/Control/AthContainers/test/copyThinned_test.cxx b/Control/AthContainers/test/copyThinned_test.cxx
index 2760f5c37e3..10adb1f1846 100644
--- a/Control/AthContainers/test/copyThinned_test.cxx
+++ b/Control/AthContainers/test/copyThinned_test.cxx
@@ -16,7 +16,6 @@
 #ifndef XAOD_STANDALONE
 
 #include "AthContainers/tools/copyThinned.h"
-#include "AthContainers/tools/foreach.h"
 #include "AthContainers/DataVector.h"
 #include "AthContainers/AuxStoreInternal.h"
 #include "AthContainers/AuxTypeRegistry.h"
@@ -41,7 +40,7 @@ void compare (const SG::AuxStoreInternal& a,
 
   const SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance();
 
-  ATHCONTAINERS_FOREACH(SG::auxid_t id, a.getAuxIDs()) {
+  for (SG::auxid_t id : a.getAuxIDs()) {
     const char* aptr = reinterpret_cast<const char*>(a.getData(id));
     const char* bptr = reinterpret_cast<const char*>(b.getData(id));
     assert (aptr != 0 && bptr != 0);
@@ -96,6 +95,15 @@ void tryit (CONTAINER& cont, IThinningSvc* svc, bool thinned = false)
 }
 
 
+template <class CONTAINER>
+void tryitConst (CONTAINER& cont, IThinningSvc* svc, bool thinned = false)
+{
+  const CONTAINER* newcont = SG::copyThinnedConst (cont, svc);
+  compare (cont, *newcont, thinned);
+  delete newcont;
+}
+
+
 void test1()
 {
   std::cout << "test1\n";
@@ -106,11 +114,11 @@ void test1()
   std::vector<int> v;
 
   tryit (store, 0);
-  tryit (dv, 0);
+  tryitConst (dv, 0);
   tryit (v, 0);
 
   tryit (store, &svc);
-  tryit (dv, &svc);
+  tryitConst (dv, &svc);
   tryit (v, &svc);
 
   SG::auxid_t ityp = SG::AuxTypeRegistry::instance().getAuxID<int> ("anInt");
@@ -135,7 +143,7 @@ void test1()
   svc.remap (&v2, 1, 2);
 
   tryit (store, &svc);
-  tryit (dv, &svc);
+  tryitConst (dv, &svc);
   tryit (v, &svc);
 
   for (int i=0, i1=0; i < 10; ++i) {
@@ -153,7 +161,7 @@ void test1()
   }
 
   tryit (store, &svc, true);
-  tryit (dv, &svc, true);
+  tryitConst (dv, &svc, true);
   tryit (v, &svc, true);
 }
 
diff --git a/Control/AthContainers/test/foreach_test.cxx b/Control/AthContainers/test/foreach_test.cxx
deleted file mode 100644
index 63f7b3e40c8..00000000000
--- a/Control/AthContainers/test/foreach_test.cxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id$
-/**
- * @file AthContainers/test/foreach_test.cxx
- * @author scott snyder <snyder@bnl.gov>
- * @date Apr, 2014
- * @brief Regression test for foreach.h
- */
-
-
-#undef NDEBUG
-#include "AthContainers/tools/foreach.h"
-#include <vector>
-#include <iostream>
-
-
-void test1()
-{
-  std::cout << "test1\n";
-  std::vector<int> v;
-  for (int i=0; i < 10; i++)
-    v.push_back (i+10);
-  ATHCONTAINERS_FOREACH (int x, v)
-    std::cout << x << " ";
-  std::cout << "\n";
-}
-
-
-int main()
-{
-  test1();
-  return 0;
-}
diff --git a/Control/AthViews/AthViews/GraphExecutionTask.h b/Control/AthViews/AthViews/GraphExecutionTask.h
deleted file mode 100644
index 1c153f7e87e..00000000000
--- a/Control/AthViews/AthViews/GraphExecutionTask.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef GAUDIHIVE_GRAPHEXECUTIONTASK_H
-#define GAUDIHIVE_GRAPHEXECUTIONTASK_H
-
-// Framework include files
-#include "GaudiKernel/SmartIF.h"
-#include "GaudiKernel/IService.h"
-#include "GaudiKernel/IAlgResourcePool.h"
-#include "GaudiKernel/EventContext.h"
-
-// External libs
-#include "tbb/task.h"
-#include <vector>
-#include <string>
-
-class GraphExecutionTask: public tbb::task
-{
-  public:
-    GraphExecutionTask( std::vector< std::string > const& algoNames, EventContext * inputContext, SmartIF< IService > & algPool ):
-	    m_eventContext( inputContext ),
-	    m_algoNames( algoNames ),
-	    m_algResourcePool( algPool ){};
-
-  virtual tbb::task* execute();
-
-  private:  
-    EventContext * m_eventContext;
-    std::vector< std::string > m_algoNames;
-    SmartIF< IAlgResourcePool > m_algResourcePool;
-};
-
-#endif
diff --git a/Control/AthViews/AthViews/ViewHelper.h b/Control/AthViews/AthViews/ViewHelper.h
index a9517262520..99b01f01ce4 100644
--- a/Control/AthViews/AthViews/ViewHelper.h
+++ b/Control/AthViews/AthViews/ViewHelper.h
@@ -8,13 +8,13 @@
 #include "CxxUtils/make_unique.h"
 #include "GaudiKernel/SmartIF.h"
 #include "GaudiKernel/IService.h"
+#include "GaudiKernel/IScheduler.h"
 #include "GaudiKernel/EventContext.h"
 #include "GaudiKernel/StatusCode.h"
 #include "AthenaKernel/ExtendedEventContext.h"
 #include "StoreGate/WriteHandle.h"
 #include "StoreGate/ReadHandle.h"
 #include "AthViews/View.h"
-#include "AthViews/GraphExecutionTask.h"
 #include "AthContainers/DataVector.h"
 
 #include "tbb/task.h"
@@ -31,238 +31,235 @@ namespace ViewHelper
       EventContext m_context;
     };
   }
-	//Function to create a vector of views, each populated with one data object
-	template< typename T >
-	inline StatusCode MakeAndPopulate( std::string const& ViewNameRoot, std::vector< SG::View* > & ViewVector,
-			SG::WriteHandle< T > & PopulateHandle, std::vector< T > const& InputData, bool allowFallThrough=false )
-	{
-		//Loop over all input data
-		unsigned int const viewNumber = InputData.size();
-		for ( unsigned int viewIndex = 0; viewIndex < viewNumber; ++viewIndex )
-		{
-			//Create view
-			std::string viewName = ViewNameRoot + std::to_string( viewIndex );
-			SG::View * outputView = new SG::View( viewName, allowFallThrough );
-			ViewVector.push_back( outputView );
-
-			//Attach the handle to the view
-			StatusCode sc = PopulateHandle.setProxyDict( outputView );
-			if ( !sc.isSuccess() )
-			{
-				ViewVector.clear();
-				return sc;
-			}
-
-			//Populate the view
-			sc = PopulateHandle.record( CxxUtils::make_unique< T >( InputData[ viewIndex ] ) );
-			if ( !sc.isSuccess() )
-			{
-				ViewVector.clear();
-				return sc;
-			}
-		}
-
-		return StatusCode::SUCCESS;
-	}
-
-        //Function to add data to existing views
-        template< typename T >
-        inline StatusCode Populate( std::vector< SG::View* > & ViewVector,
-                        SG::WriteHandle< T > & PopulateHandle, std::vector< T > const& InputData )
+
+  //Function to create a vector of views, each populated with one data object
+  template< typename T >
+  inline StatusCode MakeAndPopulate( std::string const& ViewNameRoot, std::vector< SG::View* > & ViewVector,
+                                     SG::WriteHandleKey< T > const& PopulateKey, EventContext const& SourceContext, std::vector< T > const& InputData, bool const allowFallThrough=true )
+  {
+    //Make a WriteHandle to use
+    SG::WriteHandle<T> populateHandle( PopulateKey, SourceContext );
+
+    //Loop over all input data
+    unsigned int const viewNumber = InputData.size();
+    for ( unsigned int viewIndex = 0; viewIndex < viewNumber; ++viewIndex )
+    {
+      //Create view
+      std::string viewName = ViewNameRoot + std::to_string( viewIndex );
+      SG::View * outputView = new SG::View( viewName, allowFallThrough );
+      ViewVector.push_back( outputView );
+
+      //Attach a handle to the view
+      StatusCode sc = populateHandle.setProxyDict( outputView );
+      if ( !sc.isSuccess() )
+      {
+        ViewVector.clear();
+        return sc;
+      }
+
+      //Populate the view
+      sc = populateHandle.record( CxxUtils::make_unique< T >( InputData[ viewIndex ] ) );
+      if ( !sc.isSuccess() )
+      {
+        ViewVector.clear();
+        return sc;
+      }
+    }
+
+    return StatusCode::SUCCESS;
+  }
+
+  //Function to add data to existing views
+  template< typename T >
+  inline StatusCode Populate( std::vector< SG::View* > const& ViewVector,
+                              SG::WriteHandleKey< T > const& PopulateKey, EventContext const& SourceContext, std::vector< T > const& InputData )
+  {
+    //Make a WriteHandle to use
+    SG::WriteHandle<T> populateHandle( PopulateKey, SourceContext );
+
+    //Vector length check
+    unsigned int const viewNumber = InputData.size();
+    if ( viewNumber != ViewVector.size() ) return StatusCode::FAILURE;
+
+    //Loop over all input data
+    for ( unsigned int viewIndex = 0; viewIndex < viewNumber; ++viewIndex )
+    {
+      //Attach the handle to the view
+      StatusCode sc = populateHandle.setProxyDict( ViewVector.at( viewIndex ) );
+      if ( !sc.isSuccess() )
+      {
+        return sc;
+      }
+
+      //Populate the view
+      sc = populateHandle.record( CxxUtils::make_unique< T >( InputData.at( viewIndex ) ) );
+      if ( !sc.isSuccess() )
+      {
+        return sc;
+      }
+    }
+
+    return StatusCode::SUCCESS;
+  }
+
+  //Function to attach a set of views to a graph node
+  inline StatusCode ScheduleViews( std::vector< SG::View* > const& ViewVector, std::string const& NodeName,
+      EventContext const& SourceContext, IScheduler * Scheduler )
+  {
+    //Prevent view nesting - test if source context has view attached
+    Atlas::ExtendedEventContext const* extendedContext = SourceContext.template getExtension<Atlas::ExtendedEventContext>();
+    if ( dynamic_cast< SG::View* >( extendedContext->proxy() ) )
+    {
+      return StatusCode::FAILURE;
+    }
+
+    //Retrieve the scheduler
+    if ( !Scheduler )
+    {
+      return StatusCode::FAILURE;
+    }
+
+    if ( ViewVector.size() )
+    {
+      for ( SG::View* view : ViewVector )
+      {
+        //Make a context with the view attached
+        EventContext * viewContext = new EventContext( SourceContext );
+        viewContext->setExtension( Atlas::ExtendedEventContext( view, extendedContext->conditionsRun() ) );
+
+        //Attach the view to the named node
+        StatusCode sc = Scheduler->scheduleEventView( &SourceContext, NodeName, viewContext );
+        if ( !sc.isSuccess() )
         {
-		//Vector length check
-                unsigned int const viewNumber = InputData.size();
-		if ( viewNumber != ViewVector.size() ) return StatusCode::FAILURE;
-
-                //Loop over all input data
-                for ( unsigned int viewIndex = 0; viewIndex < viewNumber; ++viewIndex )
-                {
-                        //Attach the handle to the view
-                        StatusCode sc = PopulateHandle.setProxyDict( ViewVector.at( viewIndex ) );
-                        if ( !sc.isSuccess() )
-                        {
-                                return sc;
-                        }
-
-                        //Populate the view
-                        sc = PopulateHandle.record( CxxUtils::make_unique< T >( InputData.at( viewIndex ) ) );
-                        if ( !sc.isSuccess() )
-                        {
-                                return sc;
-                        }
-                }
-
-                return StatusCode::SUCCESS;
+          return StatusCode::FAILURE;
         }
+      }
+    }
+    else
+    {
+      //Disable the node if no views
+      return Scheduler->scheduleEventView( &SourceContext, NodeName, 0 );
+    }
+
+    return StatusCode::SUCCESS;
+  }
+
+  //Function merging view data into a single collection
+  template< typename T >
+  inline StatusCode MergeViewCollection( std::vector< SG::View* > const& ViewVector, SG::ReadHandleKey< T > const& QueryKey, EventContext const& SourceContext, T & OutputData )
+  {
+    //Make a ReadHandle to use
+    SG::ReadHandle<T> queryHandle( QueryKey, SourceContext );
+
+    //Loop over all views
+    for ( SG::View* inputView : ViewVector )
+    {
+      //Attach the handle to the view
+      StatusCode sc = queryHandle.setProxyDict( inputView );
+      if ( !sc.isSuccess() )
+      {
+        OutputData.clear();
+        return sc;
+      }
+
+      //Merge the data
+      T inputData = *queryHandle;
+      OutputData.insert( OutputData.end(), inputData.begin(), inputData.end() );
+    }
+
+    return StatusCode::SUCCESS;
+  }
+
+  //Function merging view data into a single collection - overload for datavectors because aux stores are annoying
+  template< typename T >
+  inline StatusCode MergeViewCollection( std::vector< SG::View* > const& ViewVector, SG::ReadHandleKey< DataVector< T > > const& QueryKey, EventContext const& SourceContext, DataVector< T > & OutputData )
+  {
+    //Make a ReadHandle to use
+    SG::ReadHandle<T> queryHandle( QueryKey, SourceContext );
+
+    //Loop over all views
+    for ( SG::View* inputView : ViewVector )
+    {
+      //Attach the handle to the view
+      StatusCode sc = queryHandle.setProxyDict( inputView );
+      if ( !sc.isSuccess() )
+      {
+        OutputData.clear();
+        return sc;
+      }
+
+      //Merge the data
+      for ( const auto inputObject : *queryHandle.cptr() )
+      {
+        //Relies on non-existant assignment operator in TrigComposite
+        T * outputObject = new T();
+        OutputData.push_back( outputObject );
+        *outputObject = *inputObject;
+      }
+
+      //Tomasz version
+      //const size_t sizeSoFar = OutputData.size();
+      //OutputData.resize( sizeSoFar + QueryHandle->size() );
+      //std::swap_ranges( QueryHandle.ptr()->begin(), QueryHandle.ptr()->end(), OutputData.begin() + sizeSoFar );
+    }
+
+    return StatusCode::SUCCESS;
+  }
 
-	
-
-	
-	//Function to run a set of views with the named algorithms
-	inline StatusCode RunViews( std::vector< SG::View* > const& ViewVector, std::vector< std::string > const& AlgorithmNames,
-			EventContext const& InputContext, SmartIF< IService > & AlgPool )
-	{
-	  impl::SaveAndRestoreContext restoreContext;
-		//Check there is work to do
-		if ( !ViewVector.size() || !AlgorithmNames.size() )
-		{
-			return StatusCode::FAILURE;
-		}
-
-		//Create a tbb task for each view
-		tbb::task_list allTasks;
-		for ( SG::View* inputView : ViewVector )
-		{
-			//Make a context with the view attached
-			EventContext * viewContext = new EventContext( InputContext );
-                        unsigned int conditionsRun = InputContext.template getExtension<Atlas::ExtendedEventContext>()->conditionsRun();
-                        viewContext->setExtension( Atlas::ExtendedEventContext( inputView,
-                                                                                conditionsRun ) );
-
-			//Make the task
-			tbb::task * viewTask = new( tbb::task::allocate_root() )GraphExecutionTask( AlgorithmNames, viewContext, AlgPool );
-			allTasks.push_back( *viewTask );
-		}
-		
-		//Run the tasks
-		tbb::task::spawn_root_and_wait( allTasks );
-
-		return StatusCode::SUCCESS;
-	}
-
-
-	// a varaint of RunViews accepting ready to use contexts
-	// useful ehne contexts neeed to be made anyways for the purpose of filling the handles
-	// to avoid confusion it start from small run
-	inline StatusCode runInViews( std::vector<EventContext>& contexts, const std::vector< std::string >& algorithms, SmartIF< IService > & algPool) {
-	  if ( contexts.empty() )
-	    return StatusCode::SUCCESS;
-	  
-	  impl::SaveAndRestoreContext restoreContext;
-	  tbb::task_list allTasks;
-	  for ( EventContext& ctx: contexts ) {
-
-	    tbb::task * viewTask  = new ( tbb::task::allocate_root() )GraphExecutionTask( algorithms, &ctx, algPool );
-	    allTasks.push_back( *viewTask );
-
-	  }
-	  tbb::task::spawn_root_and_wait( allTasks );
-
-	  return StatusCode::SUCCESS;
-	}
-	
-	//Function merging view data into a single collection
-	template< typename T >
-	inline StatusCode MergeViewCollection( std::vector< SG::View* > const& ViewVector, SG::ReadHandle< T > & QueryHandle, T & OutputData )
-	{
-		//Loop over all views
-		for ( SG::View* inputView : ViewVector )
-		{
-			//Attach the handle to the view
-			StatusCode sc = QueryHandle.setProxyDict( inputView );
-			if ( !sc.isSuccess() )
-			{
-				OutputData.clear();
-				return sc;
-			}
-
-			//Merge the data
-			T inputData = *QueryHandle;
-			OutputData.insert( OutputData.end(), inputData.begin(), inputData.end() );
-		}
-
-		return StatusCode::SUCCESS;
-	}
-
-	//Function merging view data into a single collection - overload for datavectors because aux stores are annoying
-	template< typename T >
-	inline StatusCode MergeViewCollection( std::vector< SG::View* > const& ViewVector, SG::ReadHandle< DataVector< T > > & QueryHandle, DataVector< T > & OutputData )
-	{
-		//Loop over all views
-		for ( SG::View* inputView : ViewVector )
-		{
-			//Attach the handle to the view
-			StatusCode sc = QueryHandle.setProxyDict( inputView );
-			if ( !sc.isSuccess() )
-			{
-				OutputData.clear();
-				return sc;
-			}
-
-			//Merge the data
-			for ( const auto inputObject : *QueryHandle.cptr() )
-			{
-				//Relies on non-existant assignment operator in TrigComposite
-				T * outputObject = new T();
-				OutputData.push_back( outputObject );
-				*outputObject = *inputObject;
-			}
-
-			//Tomasz version
-			//const size_t sizeSoFar = OutputData.size();
-			//OutputData.resize( sizeSoFar + QueryHandle->size() );
-			//std::swap_ranges( QueryHandle.ptr()->begin(), QueryHandle.ptr()->end(), OutputData.begin() + sizeSoFar );
-		}
-
-		return StatusCode::SUCCESS;
-	}
   /**
    * @arg unique_index - gets appended to the view name if >= 0
    */
-  inline SG::View* makeView( const std::string& common_name, int unique_index=-1, bool allowFallThrough = true) {
-	  return  (( unique_index == -1 ) ?
-		   new SG::View( common_name, allowFallThrough ) :
-		   new SG::View( common_name+ " "+std::to_string(unique_index), allowFallThrough ) );
-	  
+  inline SG::View* makeView( const std::string& common_name, int const unique_index=-1, bool const allowFallThrough = true) {
+    return  (( unique_index == -1 ) ?
+    new SG::View( common_name, allowFallThrough ) :
+    new SG::View( common_name+ " "+std::to_string(unique_index), allowFallThrough ) );
+
   }
-  
+
   /**
    * @brief - records object in a view
-   */  
+   */
   template< typename T >
   StatusCode addToView( SG::View* view, const std::string& key, T* ptr ) {
-    
+
     SG::WriteHandle< T > handle( key );
-    
+
     if( handle.setProxyDict( view ).isFailure() ) {
       return StatusCode::FAILURE;
     }
-    
+
     if ( handle.record( std::unique_ptr<T>( ptr ) ).isFailure() ) {
       return StatusCode::FAILURE;
     }
-    
+
     return StatusCode::SUCCESS;
   }
 
   template< typename T >
   StatusCode addViewCollectionToView(SG::View* view, const std::string& key, const T* src ) {
-    auto * viewColl = new ConstDataVector<T>();    
+    auto * viewColl = new ConstDataVector<T>();
     viewColl->clear( SG::VIEW_ELEMENTS ); //make it a view
     viewColl->insert( viewColl->end(), src->begin(), src->end() ); // copy content
 
-    return  addToView( view, key, viewColl );    
+    return addToView( view, key, viewColl );
   }
 
-  
+
   /**
    * @return nullptr if object of type T is missing in the view
    */
   template< typename T >
   const T* getFromView( SG::View* view, const std::string& key) {
-    
+
     SG::ReadHandle<T> handle(key);
-    
-    if ( handle.setProxyDict(view).isFailure() )  {
+
+    if ( handle.setProxyDict(view).isFailure() ) {
       return nullptr;
     }
-    
+
     return handle.cptr();
   }
 
-  
-
-  
 } // EOF namspace ViewHelper
 
 #endif
diff --git a/Control/AthViews/CMakeLists.txt b/Control/AthViews/CMakeLists.txt
index 6eb290d470a..32195c6b230 100644
--- a/Control/AthViews/CMakeLists.txt
+++ b/Control/AthViews/CMakeLists.txt
@@ -23,16 +23,21 @@ atlas_depends_on_subdirs( PUBLIC
 # Component(s) in the package:
 atlas_add_library( AthViews
                    src/*.cxx
-                   src/components/*.cxx
                    PUBLIC_HEADERS AthViews
                    INCLUDE_DIRS ${TBB_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${TBB_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib GaudiKernel CxxUtils )
+                   LINK_LIBRARIES ${TBB_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib GaudiKernel CxxUtils TrigSteeringEvent )
+
+atlas_add_component( AthViewsAlgs
+                   src/*.cxx
+                   src/components/*.cxx
+                   INCLUDE_DIRS ${TBB_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${TBB_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib GaudiKernel CxxUtils AthViews TrigSteeringEvent )
 
 atlas_add_component( AthViewsDFlow
                      src_dflow/*.cxx
                      src_dflow/components/*.cxx
                      INCLUDE_DIRS ${TBB_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${TBB_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib GaudiKernel CxxUtils AthViews TrigSteeringEvent )
+                     LINK_LIBRARIES ${TBB_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib GaudiKernel CxxUtils AthViews )
 
 
 atlas_add_test( ViewLinking_test 
@@ -41,6 +46,15 @@ atlas_add_test( ViewLinking_test
 		LINK_LIBRARIES ${TBB_LIBRARIES}
 		AthViews TestTools )
 
+atlas_add_test( SimpleViews SCRIPT test/test_simple_view_example.sh
+                PROPERTIES PASS_REGULAR_EXPRESSION "INFO view_test running with store view9" )
+
+atlas_add_test( ViewScheduling SCRIPT test/test_view_scheduling.sh
+                PROPERTIES PASS_REGULAR_EXPRESSION "INFO 109" )
+
+atlas_add_test( ViewNestFail SCRIPT test/test_view_nest_fail.sh
+                PROPERTIES PASS_REGULAR_EXPRESSION "Execution of algorithm nest_alg failed" )
+
 # Install files from the package:
 atlas_install_headers( AthViews )
 atlas_install_joboptions( share/*.py )
diff --git a/Control/AthViews/share/SimpleViewExample.py b/Control/AthViews/share/SimpleViewExample.py
new file mode 100644
index 00000000000..99368074f17
--- /dev/null
+++ b/Control/AthViews/share/SimpleViewExample.py
@@ -0,0 +1,62 @@
+#
+#  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+#
+
+###############################################################
+#
+# Job options file
+#
+# Based on AthExStoreGateExamples
+#
+#==============================================================
+
+#--------------------------------------------------------------
+# ATLAS default Application Configuration options
+#--------------------------------------------------------------
+
+# Configure the scheduler
+from AthenaCommon.AlgScheduler import AlgScheduler
+AlgScheduler.ShowControlFlow( True )
+AlgScheduler.ShowDataDependencies( True )
+
+# Control flow
+from AthenaCommon.AlgSequence import AthSequencer
+allViewAlgorithms = AthSequencer( "allViewAlgorithms" )
+allViewAlgorithms.ModeOR = False
+allViewAlgorithms.Sequential = False
+allViewAlgorithms.StopOverride = False
+makeViewSequence = AthSequencer( "makeViewSequence" )
+makeViewSequence.ModeOR = False
+makeViewSequence.Sequential = True
+makeViewSequence.StopOverride = False
+
+# Event-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence
+job = AlgSequence()
+
+# Make views
+makeViewSequence += CfgMgr.AthViews__ViewSubgraphAlg("make_alg")
+makeViewSequence.make_alg.ViewBaseName = "view"
+makeViewSequence.make_alg.ViewNumber = 10
+makeViewSequence.make_alg.ViewNodeName = "allViewAlgorithms"
+makeViewSequence.make_alg.Scheduler = AlgScheduler.getScheduler()
+
+# View algorithm
+ViewTest = CfgMgr.AthViews__ViewTestAlg("view_test")
+allViewAlgorithms += ViewTest
+
+# Add the view algorithms to the job
+makeViewSequence += allViewAlgorithms
+
+job += makeViewSequence
+
+#--------------------------------------------------------------
+# Event related parameters
+#--------------------------------------------------------------
+theApp.EvtMax = 10
+
+#==============================================================
+#
+# End of job options file
+#
+###############################################################
diff --git a/Control/AthViews/share/ViewNest.py b/Control/AthViews/share/ViewNest.py
new file mode 100644
index 00000000000..de997372eb0
--- /dev/null
+++ b/Control/AthViews/share/ViewNest.py
@@ -0,0 +1,79 @@
+#
+#  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+#
+
+###############################################################
+#
+# Job options file
+#
+# Based on AthExStoreGateExamples
+#
+#==============================================================
+
+#--------------------------------------------------------------
+# ATLAS default Application Configuration options
+#--------------------------------------------------------------
+
+# Configure the scheduler
+from AthenaCommon.AlgScheduler import AlgScheduler
+AlgScheduler.ShowControlFlow( True )
+AlgScheduler.ShowDataDependencies( True )
+
+# Control flow
+from AthenaCommon.AlgSequence import AthSequencer
+l2ViewAlgorithms = AthSequencer( "l2ViewAlgorithms" )
+l2ViewAlgorithms.ModeOR = False
+l2ViewAlgorithms.Sequential = False
+l2ViewAlgorithms.StopOverride = False
+l1ViewAlgorithms = AthSequencer( "l1ViewAlgorithms" )
+l1ViewAlgorithms.ModeOR = False
+l1ViewAlgorithms.Sequential = True
+l1ViewAlgorithms.StopOverride = False
+makeViewSequence = AthSequencer( "makeViewSequence" )
+makeViewSequence.ModeOR = False
+makeViewSequence.Sequential = True
+makeViewSequence.StopOverride = False
+
+# Event-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence
+job = AlgSequence()
+
+# Make views
+makeViewSequence += CfgMgr.AthViews__ViewSubgraphAlg("make_alg")
+makeViewSequence.make_alg.ViewBaseName = "view"
+makeViewSequence.make_alg.ViewNumber = 10
+makeViewSequence.make_alg.ViewNodeName = l1ViewAlgorithms.name()
+makeViewSequence.make_alg.Scheduler = AlgScheduler.getScheduler()
+
+# View algorithms
+ViewTest = CfgMgr.AthViews__ViewTestAlg("view_test")
+l1ViewAlgorithms += ViewTest
+#
+l1ViewAlgorithms += CfgMgr.AthViews__ViewSubgraphAlg("nest_alg")
+l1ViewAlgorithms.nest_alg.ViewBaseName = "viewView"
+l1ViewAlgorithms.nest_alg.ViewNumber = 10
+l1ViewAlgorithms.nest_alg.ViewNodeName = l2ViewAlgorithms.name()
+l1ViewAlgorithms.nest_alg.Scheduler = AlgScheduler.getScheduler()
+#
+ViewViewTest = CfgMgr.AthViews__ViewTestAlg("viewView_test")
+l2ViewAlgorithms += ViewViewTest
+
+# Add the view algorithms to the job
+l1ViewAlgorithms += l2ViewAlgorithms
+makeViewSequence += l1ViewAlgorithms
+
+# Merge views
+makeViewSequence += CfgMgr.AthViews__ViewMergeAlg("merge_alg")
+
+job += makeViewSequence
+
+#--------------------------------------------------------------
+# Event related parameters
+#--------------------------------------------------------------
+theApp.EvtMax = 10
+
+#==============================================================
+#
+# End of job options file
+#
+###############################################################
diff --git a/Control/AthViews/share/GraphViews.py b/Control/AthViews/share/ViewScheduling.py
similarity index 58%
rename from Control/AthViews/share/GraphViews.py
rename to Control/AthViews/share/ViewScheduling.py
index 9fa9401983a..fc639b39934 100644
--- a/Control/AthViews/share/GraphViews.py
+++ b/Control/AthViews/share/ViewScheduling.py
@@ -19,55 +19,52 @@ from AthenaCommon.AlgScheduler import AlgScheduler
 AlgScheduler.ShowControlFlow( True )
 AlgScheduler.ShowDataDependencies( True )
 
-# Make a separate alg pool for the view algs
-from GaudiHive.GaudiHiveConf import AlgResourcePool
-viewAlgPoolName = "ViewAlgPool"
-svcMgr += AlgResourcePool( viewAlgPoolName )
-
-# Set of view algs
+# Control flow
 from AthenaCommon.AlgSequence import AthSequencer
 allViewAlgorithms = AthSequencer( "allViewAlgorithms" )
 allViewAlgorithms.ModeOR = False
-allViewAlgorithms.Sequential = True
+allViewAlgorithms.Sequential = False
 allViewAlgorithms.StopOverride = False
-
-# Filter to stop view algs from running on whole event
-allViewAlgorithms += CfgMgr.AthPrescaler( "alwaysFail" )
-allViewAlgorithms.alwaysFail.PercentPass = 0.0
-
-# Method to set up a view algorithm
-def DeclareViewAlgorithm( viewAlg ):
-	global svcMgr, allViewAlgorithms
-	svcMgr.ViewAlgPool.TopAlg += [ viewAlg.name() ]
-	allViewAlgorithms += viewAlg
+makeViewSequence = AthSequencer( "makeViewSequence" )
+makeViewSequence.ModeOR = False
+makeViewSequence.Sequential = True
+makeViewSequence.StopOverride = False
 
 # Event-level algorithm sequence
 from AthenaCommon.AlgSequence import AlgSequence
 job = AlgSequence()
 
-
 # Make views
-job += CfgMgr.AthViews__ViewSubgraphAlg("make_alg")
-job.make_alg.ViewBaseName = "view"
-job.make_alg.ViewNumber = 5
-job.make_alg.AlgPoolName = viewAlgPoolName
-job.make_alg.AlgorithmNameSequence = [ "dflow_alg1", "dflow_alg2", "dflow_alg3" ] #Eventually scheduler will do this
+makeViewSequence += CfgMgr.AthViews__ViewSubgraphAlg("make_alg")
+makeViewSequence.make_alg.ViewBaseName = "view"
+makeViewSequence.make_alg.ViewNumber = 10
+makeViewSequence.make_alg.ViewNodeName = "allViewAlgorithms"
+makeViewSequence.make_alg.Scheduler = AlgScheduler.getScheduler()
 
 # View algorithms
+ViewTest = CfgMgr.AthViews__ViewTestAlg("view_test")
+allViewAlgorithms += ViewTest
+#
+ViewVerify = CfgMgr.AthViews__ViewDataVerifier("view_verify")
+ViewVerify.DataObjects = [ ('int','view_start') ]
+allViewAlgorithms += ViewVerify
+#
 dflow_alg1 = CfgMgr.AthViews__DFlowAlg1("dflow_alg1")
-DeclareViewAlgorithm( dflow_alg1 )
+allViewAlgorithms += dflow_alg1
 #
 dflow_alg2 = CfgMgr.AthViews__DFlowAlg2("dflow_alg2")
-DeclareViewAlgorithm( dflow_alg2 )
+allViewAlgorithms += dflow_alg2
 #
 dflow_alg3 = CfgMgr.AthViews__DFlowAlg3("dflow_alg3")
-DeclareViewAlgorithm( dflow_alg3 )
+allViewAlgorithms += dflow_alg3
+
+# Add the view algorithms to the job
+makeViewSequence += allViewAlgorithms
 
 # Merge views
-job += CfgMgr.AthViews__ViewMergeAlg("merge_alg")
+makeViewSequence += CfgMgr.AthViews__ViewMergeAlg("merge_alg")
 
-# Add the view algorithms to the job
-job += allViewAlgorithms
+job += makeViewSequence
 
 #--------------------------------------------------------------
 # Event related parameters
@@ -79,4 +76,3 @@ theApp.EvtMax = 10
 # End of job options file
 #
 ###############################################################
-
diff --git a/Control/AthViews/src/AthViewAlgorithm.cxx b/Control/AthViews/src/AthViewAlgorithm.cxx
deleted file mode 100755
index 705e7349e1c..00000000000
--- a/Control/AthViews/src/AthViewAlgorithm.cxx
+++ /dev/null
@@ -1,142 +0,0 @@
-///////////////////////// -*- C++ -*- /////////////////////////////
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// AthViewAlgorithm.h 
-// Header file for class AthViewAlgorithm
-// Author: B Wynne, based on S Binet's AthAlgorithm
-/////////////////////////////////////////////////////////////////// 
-
-// AthenaBaseComps includes
-#include "AthViews/AthViewAlgorithm.h"
-#include "AthenaKernel/ExtendedEventContext.h"
-
-#include "GaudiKernel/IJobOptionsSvc.h"
-
-// STL includes
-
-/////////////////////////////////////////////////////////////////// 
-// Public methods: 
-/////////////////////////////////////////////////////////////////// 
-
-// Constructors
-////////////////
-AthViewAlgorithm::AthViewAlgorithm( const std::string& name, 
-			    ISvcLocator* pSvcLocator,
-			    const std::string& version ) :
-  AthAlgorithm( name, pSvcLocator, version )
-{
-  //
-  // Property declaration
-  // 
-  //declareProperty( "Property", m_nProperty );
-  
-  //Flags for requiring views (or not)
-  m_require_view = false;
-  m_require_not_view = false;
-  declareProperty( "RequireView", m_require_view, "True if this algorithm may only run in a view" );
-  declareProperty( "RequireNotView", m_require_not_view, "True if this algorithm may only run on whole events" );
-}
-
-// Destructor
-///////////////
-AthViewAlgorithm::~AthViewAlgorithm()
-{ 
-  ATH_MSG_DEBUG ("Calling destructor");
-}
-
-StatusCode AthViewAlgorithm::sysInitialize()
-{
-  //We need the properties now!
-  StatusCode sc = setProperties();
-  if( sc.isFailure() ) return StatusCode::FAILURE;
-
-  //Check for stupid
-  if ( m_require_view && m_require_not_view )
-  {
-    ATH_MSG_FATAL( "AthViewAlgorithm config fail: requiring view and not view" );
-    return StatusCode::FAILURE;
-  }
-
-  return AthAlgorithm::sysInitialize();
-}
-#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT 
-StatusCode AthViewAlgorithm::sysExecute(const EventContext& ctx) {
-#else
-StatusCode AthViewAlgorithm::sysExecute() {
-  const EventContext& ctx = *getContext();
-#endif
-  ATH_MSG_WARNING( "AthViewAlgorithm is now OBSOLETE, please migrate your code" );
-
-  //Skip the algorithm if views are required or avoided
-  SG::View * myView = eventView(ctx);
-  if ( !myView && m_require_view )
-  {
-    ATH_MSG_INFO( "Skipping execution of " << name() << ": not in event view" );
-    return StatusCode::SUCCESS;
-  }
-  if ( myView && m_require_not_view )
-  {
-    ATH_MSG_INFO( "Skipping execution of " << name() << ": in event view" );
-    return StatusCode::SUCCESS;
-  }
-
-  //Set all DataHandles to use the EventView pointer
-  for ( auto handle : inputHandles() )
-  {
-    SG::VarHandleBase * athenaHandle = static_cast< SG::VarHandleKey* >( handle )->owningHandle();
-    CHECK( athenaHandle->setProxyDict( myView ) );
-  }
-  for ( auto handle : outputHandles() )
-  {
-    SG::VarHandleBase * athenaHandle = static_cast< SG::VarHandleKey* >( handle )->owningHandle();
-    CHECK( athenaHandle->setProxyDict( myView ) );
-  }
-
-#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT 
-  return AthAlgorithm::sysExecute(ctx);
-#else
-  return AthAlgorithm::sysExecute();
-#endif
-}
-
-//Retrieve the EventView pointer from the context if it exists
-SG::View * AthViewAlgorithm::eventView(const EventContext& ctx)
-{
-  //Try to get the view from context
-  if ( ! ctx.valid() ) return 0; //but why no context?
-  SG::View * myView = dynamic_cast< SG::View * >
-    ( ctx.getExtension<Atlas::ExtendedEventContext>()->proxy() );
-  if ( myView )
-  {
-    ATH_MSG_DEBUG( "Algorithm " << name() << " is in view " << myView );
-  }
-  else
-  {
-    ATH_MSG_DEBUG( "Algorithm " << name() << " is not in a view" );
-  }
-  return myView;
-}
-
-/////////////////////////////////////////////////////////////////// 
-// Const methods: 
-///////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-// Non-const methods: 
-/////////////////////////////////////////////////////////////////// 
-
-/////////////////////////////////////////////////////////////////// 
-// Protected methods: 
-/////////////////////////////////////////////////////////////////// 
-
-/////////////////////////////////////////////////////////////////// 
-// Const methods: 
-///////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-// Non-const methods: 
-/////////////////////////////////////////////////////////////////// 
-
diff --git a/Control/AthViews/src/GraphExecutionTask.cxx b/Control/AthViews/src/GraphExecutionTask.cxx
deleted file mode 100644
index ec8abfb226e..00000000000
--- a/Control/AthViews/src/GraphExecutionTask.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "AthViews/GraphExecutionTask.h"
-
-// Framework
-#include "GaudiKernel/Algorithm.h"
-#include "GaudiKernel/IAlgResourcePool.h"
-#include "GaudiKernel/IAlgorithm.h"
-#include "GaudiKernel/ThreadLocalContext.h"
-
-
-//The method for scheduling a subgraph
-tbb::task* GraphExecutionTask::execute()
-{
-	//Quit now if there's nothing to do
-	if ( !m_algoNames.size() )
-	{
-		return nullptr;
-	}
-
-	//Quit if you can't find the alg pool
-	if ( !m_algResourcePool )
-	{
-		return nullptr;
-	}
-
-	//Try to get control of the first named algorithm in the list
-	std::string name = m_algoNames[0];
-	IAlgorithm * ialgoPtr = nullptr;
-	StatusCode testPool = m_algResourcePool->acquireAlgorithm( name, ialgoPtr, false ); //true = blocking, doesn't work in single-thread mode
-	if ( !testPool.isSuccess() )
-	{
-		//If you can't get control of the algorithm, re-queue this task
-		//this->set_depth(0);
-		this->recycle_as_safe_continuation();
-		return nullptr;
-	}
-
-	//Run the algorithm in this context
-	Algorithm * algoPtr = dynamic_cast< Algorithm* >( ialgoPtr );
-	if ( !algoPtr )
-	{
-		return nullptr;
-	}
-#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT
-        Gaudi::Hive::setCurrentContext( *m_eventContext );
-        algoPtr->whiteboard()->selectStore( m_eventContext->slot() ).ignore();
-	algoPtr->sysExecute( *m_eventContext );
-#else
-	algoPtr->setContext( m_eventContext );
-	algoPtr->sysExecute();
-#endif
-
-	//Release the algorithm
-	testPool = m_algResourcePool->releaseAlgorithm( name, ialgoPtr );
-
-	//Remove the completed algorithm name from the list
-	m_algoNames.erase( m_algoNames.begin() );
-
-	//If the list still has entries, add this task on to the queue again
-	if ( m_algoNames.size() )
-	{
-		//this->add_to_depth(1);
-		this->recycle_as_safe_continuation();
-	}
-
-	//Done!
-	return nullptr;
-}
diff --git a/Control/AthViews/src_dflow/RoiCollectionToViews.cxx b/Control/AthViews/src/RoiCollectionToViews.cxx
similarity index 70%
rename from Control/AthViews/src_dflow/RoiCollectionToViews.cxx
rename to Control/AthViews/src/RoiCollectionToViews.cxx
index 748b4ac55a1..eb56a40ac5c 100644
--- a/Control/AthViews/src_dflow/RoiCollectionToViews.cxx
+++ b/Control/AthViews/src/RoiCollectionToViews.cxx
@@ -22,29 +22,8 @@ namespace AthViews {
 ////////////////
 RoiCollectionToViews::RoiCollectionToViews( const std::string& name,
                       ISvcLocator* pSvcLocator ) : 
-  ::AthAlgorithm( name, pSvcLocator ),
-  m_trigRoIs( "input_rois" ),
-  m_w_views( "all_views" ),
-  m_viewRoIs( "output_rois" ),
-  m_algorithmNameSequence( std::vector< std::string >() ),
-  m_algPoolName( "" ),
-  m_viewBaseName( "" )
+  ::AthAlgorithm( name, pSvcLocator )
 {
-  //
-  // Property declaration
-  // 
-
-  declareProperty( "InputRoICollection", m_trigRoIs, "Collection of RoIs to split into views" );
-  
-  declareProperty( "OutputRoICollection", m_viewRoIs, "RoI collection to use inside views" );
-  
-  declareProperty( "AllViews", m_w_views, "All views" );
-
-  declareProperty( "ViewBaseName", m_viewBaseName, "Name to use for all views - number will be appended" );
-
-  declareProperty( "AlgorithmNameSequence", m_algorithmNameSequence, "Names of algorithms to run in the views" );
-
-  declareProperty( "AlgPoolName", m_algPoolName, "Name for the algorithm pool service to use with the views" );
 }
 
 // Destructor
@@ -62,6 +41,7 @@ StatusCode RoiCollectionToViews::initialize()
   CHECK( m_trigRoIs.initialize() );
   CHECK( m_viewRoIs.initialize() );
   CHECK( m_w_views.initialize() );
+  CHECK( m_scheduler.retrieve() );
 
   return StatusCode::SUCCESS;
 }
@@ -88,7 +68,9 @@ StatusCode RoiCollectionToViews::execute()
   ATH_CHECK( inputRoIs.isValid() );
  
   //Skip if there's nothing to do
-  if ( inputRoIs->empty() ) return StatusCode::SUCCESS;
+  //if ( inputRoIs->empty() ) return StatusCode::SUCCESS;
+  //NB: don't do this any more. Calling the helper with an empty collection is now correct
+  //as this will deactivate the node in the scheduler
 
   std::vector< ConstDataVector<TrigRoiDescriptorCollection> > outputRoICollectionVector;
   for ( auto roi: *inputRoIs )
@@ -102,18 +84,18 @@ StatusCode RoiCollectionToViews::execute()
 
   //Create the views and populate them
   std::vector< SG::View* > viewVector;
-  SG::WriteHandle< ConstDataVector<TrigRoiDescriptorCollection> > outputRoIs( m_viewRoIs, ctx );
   CHECK( ViewHelper::MakeAndPopulate( m_viewBaseName, //Base name for all views to use
           viewVector,                                 //Vector to store views
-          outputRoIs,                                 //A writehandle to use to access the views (the handle itself, not the contents)
+          m_viewRoIs,                                 //A writehandlekey to use to access the views
+          ctx,                                        //The context of this algorithm
           outputRoICollectionVector,                  //Data to initialise each view - one view will be made per entry
           m_viewFallThrough ) );                      //Allow fall through from view to storegate
 
   //Run the algorithms in views
-  CHECK( ViewHelper::RunViews( viewVector,              //View vector
-          m_algorithmNameSequence,                        //Algorithms to run in each view
-          ctx,                                            //Context to attach the views to
-          serviceLocator()->service( m_algPoolName ) ) ); //Service to retrieve algorithms by name
+  CHECK( ViewHelper::ScheduleViews( viewVector, //View vector
+          m_viewNodeName,                       //CF node to attach views to
+          ctx,                                  //Context to attach the views to
+          m_scheduler.get() ) );                //Scheduler
 
   //Store the collection of views
   SG::WriteHandle< std::vector< SG::View* > > outputViewHandle( m_w_views, ctx );
diff --git a/Control/AthViews/src_dflow/RoiCollectionToViews.h b/Control/AthViews/src/RoiCollectionToViews.h
similarity index 67%
rename from Control/AthViews/src_dflow/RoiCollectionToViews.h
rename to Control/AthViews/src/RoiCollectionToViews.h
index 7fa41a37da9..eaa452fcca7 100644
--- a/Control/AthViews/src_dflow/RoiCollectionToViews.h
+++ b/Control/AthViews/src/RoiCollectionToViews.h
@@ -16,6 +16,7 @@
 #include "StoreGate/ReadHandleKey.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 #include "AthContainers/ConstDataVector.h"
+#include "GaudiKernel/IScheduler.h"
 
 namespace AthViews {
 
@@ -60,17 +61,19 @@ class RoiCollectionToViews
   /// Containers
   
   // vars
-  SG::ReadHandleKey< TrigRoiDescriptorCollection > m_trigRoIs;
-  SG::WriteHandleKey< std::vector< SG::View* > > m_w_views;
-  SG::WriteHandleKey< ConstDataVector<TrigRoiDescriptorCollection> > m_viewRoIs;
-  std::vector< std::string > m_algorithmNameSequence;
-  std::string m_algPoolName;
-  std::string m_viewBaseName;
-  Gaudi::Property< bool > m_viewFallThrough { this, "ViewFallThrough", false, "Set whether views may access StoreGate directly to retrieve data" };
+  ServiceHandle< IScheduler > m_scheduler{ this, "Scheduler", "AvalancheSchedulerSvc", "The Athena scheduler" };
+  SG::ReadHandleKey< TrigRoiDescriptorCollection > m_trigRoIs { this, "InputRoICollection", "input_rois", "Collection of RoIs to split into views" };
+  SG::WriteHandleKey< std::vector< SG::View* > > m_w_views { this, "AllViews", "all_views", "Output view collection" };
+  SG::WriteHandleKey< ConstDataVector<TrigRoiDescriptorCollection> > m_viewRoIs { this, "OutputRoICollection", "output_rois", "RoI collection to use inside views" };
+  Gaudi::Property< std::string > m_viewBaseName { this, "ViewBaseName", "", "Name to use for all views - number will be appended" };
+  Gaudi::Property< std::string > m_viewNodeName { this, "ViewNodeName", "", "Name of the CF node to attach views to" };
+  Gaudi::Property< bool > m_viewFallThrough { this, "ViewFallThrough", true, "Set whether views may access StoreGate directly to retrieve data" };
+
 }; 
 
+/////////////////////////////////////////////////////////////////// 
 // I/O operators
-//////////////////////
+/////////////////////////////////////////////////////////////////// 
 
 /////////////////////////////////////////////////////////////////// 
 // Inline methods: 
diff --git a/Control/AthViews/src/ViewDataVerifier.cxx b/Control/AthViews/src/ViewDataVerifier.cxx
new file mode 100644
index 00000000000..1e7e2237b39
--- /dev/null
+++ b/Control/AthViews/src/ViewDataVerifier.cxx
@@ -0,0 +1,125 @@
+///////////////////////// -*- C++ -*- /////////////////////////////
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// ViewDataVerifier.cxx 
+// Implementation file for class ViewDataVerifier
+// Author: B. Wynne <bwynne@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+
+#include "ViewDataVerifier.h"
+
+// STL includes
+
+// FrameWork includes
+#include "AthenaKernel/ExtendedEventContext.h"
+
+namespace AthViews {
+
+/////////////////////////////////////////////////////////////////// 
+// Public methods: 
+/////////////////////////////////////////////////////////////////// 
+
+// Constructors
+////////////////
+ViewDataVerifier::ViewDataVerifier( const std::string& name, 
+                      ISvcLocator* pSvcLocator ) : 
+  ::AthAlgorithm( name, pSvcLocator )
+{
+}
+
+// Destructor
+///////////////
+ViewDataVerifier::~ViewDataVerifier()
+{}
+
+// Athena Algorithm's Hooks
+////////////////////////////
+StatusCode ViewDataVerifier::initialize()
+{
+  ATH_MSG_INFO ("Initializing " << name() << "...");
+
+  StatusCode sc = StatusCode::SUCCESS;
+
+  // Debug message indicating what containers will be loaded
+  // Code copied from SGInputLoader
+  if ( m_load.value().size() > 0 ) {
+    std::ostringstream str;
+    str << "Will explicitly preload the following DataObjects:";
+    for ( auto &obj : m_load.value() ) {
+      str << "\n    + " << obj;
+      if ( obj.key() == "" ) {
+        sc = StatusCode::FAILURE;
+        str << "   ERROR: empty key is not allowed!";
+      }
+    }
+    ATH_MSG_INFO( str.str() );
+  }
+
+  // Inform the scheduler that these containers will be available
+  if ( !setProperty( "ExtraOutputs", m_load.toString() ).isSuccess() ) {
+    ATH_MSG_WARNING( "Failed setting property ExtraOutputs" );
+  }
+
+  return sc;
+}
+
+StatusCode ViewDataVerifier::finalize()
+{
+  ATH_MSG_INFO ("Finalizing " << name() << "...");
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode ViewDataVerifier::execute()
+{  
+  ATH_MSG_DEBUG ("Executing " << name() << "...");
+
+  // Retrieve the current view from the EventContext
+  auto viewProxy = getContext().getExtension<Atlas::ExtendedEventContext>()->proxy();
+
+  ATH_MSG_INFO( name() << " running with store " << viewProxy->name() );
+
+  // Test each container
+  for ( auto &obj : m_load.value() ) {
+
+    // Create a VarHandleKey (copied from SGInputLoader)
+    SG::VarHandleKey vhk( obj.clid(), obj.key(), Gaudi::DataHandle::Writer );
+
+    // Create a test proxy 
+    SG::DataProxy* dp = viewProxy->proxy( obj.clid(), vhk.key() );
+
+    // Test if the proxy is valid
+    if ( dp ) { 
+      ATH_MSG_INFO( "Found " << obj.key() << " in " << viewProxy->name() );
+    } else {
+      ATH_MSG_ERROR( "Did not find " << obj.key() << " in " << viewProxy->name() );
+    }
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+/////////////////////////////////////////////////////////////////// 
+// Const methods: 
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Non-const methods: 
+/////////////////////////////////////////////////////////////////// 
+
+/////////////////////////////////////////////////////////////////// 
+// Protected methods: 
+/////////////////////////////////////////////////////////////////// 
+
+/////////////////////////////////////////////////////////////////// 
+// Const methods: 
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Non-const methods: 
+/////////////////////////////////////////////////////////////////// 
+
+} //> end namespace AthViews
diff --git a/Control/AthViews/AthViews/AthViewAlgorithm.h b/Control/AthViews/src/ViewDataVerifier.h
old mode 100755
new mode 100644
similarity index 50%
rename from Control/AthViews/AthViews/AthViewAlgorithm.h
rename to Control/AthViews/src/ViewDataVerifier.h
index 30cf76ebb17..5d98a722420
--- a/Control/AthViews/AthViews/AthViewAlgorithm.h
+++ b/Control/AthViews/src/ViewDataVerifier.h
@@ -4,74 +4,75 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// AthViewAlgorithm.h 
-// Header file for class AthViewAlgorithm
-// Author: B Wynne, based on S Binet's AthAlgorithm
+// ViewDataVerifier.h 
+// Header file for class ViewDataVerifier
+// Author: B. Wynne <bwynne@cern.ch>
 /////////////////////////////////////////////////////////////////// 
-#ifndef ATHVIEWS_ATHVIEWALGORITHM_H
-#define ATHVIEWS_ATHVIEWALGORITHM_H 1
+#ifndef ATHVIEWS_VIEWDATAVERIFIER_H
+#define ATHVIEWS_VIEWDATAVERIFIER_H 1
 
+// STL includes
+#include <string>
 
 // FrameWork includes
 #include "AthenaBaseComps/AthAlgorithm.h"
-#include "AthViews/View.h"
+#include "GaudiKernel/DataObjID.h"
+
+namespace AthViews {
+
+class ViewDataVerifier
+  : public ::AthAlgorithm
+{ 
 
-class AthViewAlgorithm : public AthAlgorithm
-{
   /////////////////////////////////////////////////////////////////// 
   // Public methods: 
   /////////////////////////////////////////////////////////////////// 
  public: 
+
   // Copy constructor: 
 
   /// Constructor with parameters: 
-  AthViewAlgorithm(const std::string& name, 
-               ISvcLocator* pSvcLocator,
-               const std::string& version=PACKAGE_VERSION);
+  ViewDataVerifier( const std::string& name, ISvcLocator* pSvcLocator );
 
   /// Destructor: 
-  virtual ~AthViewAlgorithm();
+  virtual ~ViewDataVerifier(); 
 
-#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT 
-  virtual StatusCode sysExecute(const EventContext&) override;
-#else
-  virtual StatusCode sysExecute() override;
-#endif
-  virtual StatusCode sysInitialize() override;
+  // Assignment operator: 
+  //ViewDataVerifier &operator=(const ViewDataVerifier &alg); 
 
+  // Athena algorithm's Hooks
+  virtual StatusCode  initialize();
+  virtual StatusCode  execute();
+  virtual StatusCode  finalize();
 
   /////////////////////////////////////////////////////////////////// 
-  // Non-const methods: 
-  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
 
   /////////////////////////////////////////////////////////////////// 
-  // Protected methods: 
+  // Non-const methods: 
   /////////////////////////////////////////////////////////////////// 
- protected: 
-  SG::View * eventView(const EventContext& ctx);
-
-  /// callback for output level property 
-  void msg_update_handler(Property& outputLevel);
-
-  //flags for whether the algorithm can only be run in a view (or not)
-  bool m_require_view;
-  bool m_require_not_view;
 
   /////////////////////////////////////////////////////////////////// 
   // Private data: 
   /////////////////////////////////////////////////////////////////// 
- private:
+ private: 
 
   /// Default constructor: 
-  AthViewAlgorithm(); //> not implemented
-  AthViewAlgorithm (const AthViewAlgorithm& ); //> not implemented
-  AthViewAlgorithm& operator= (const AthViewAlgorithm&); //> not implemented
+  ViewDataVerifier();
+
+  /// Containers to verify
+  Gaudi::Property< DataObjIDColl > m_load{ this, "DataObjects", DataObjIDColl(), "Objects to confirm are found in this view" };
+  
+  // vars
 }; 
 
+// I/O operators
+//////////////////////
+
 /////////////////////////////////////////////////////////////////// 
 // Inline methods: 
 /////////////////////////////////////////////////////////////////// 
 
-
-
-#endif //> !ATHVIEWS_ATHVIEWALGORITHM_H
+} //> end namespace AthViews
+#endif //> !ATHVIEWS_VIEWDATAVERIFIER_H
diff --git a/Control/AthViews/src_dflow/ViewTestAlg.cxx b/Control/AthViews/src/ViewTestAlg.cxx
similarity index 100%
rename from Control/AthViews/src_dflow/ViewTestAlg.cxx
rename to Control/AthViews/src/ViewTestAlg.cxx
diff --git a/Control/AthViews/src_dflow/ViewTestAlg.h b/Control/AthViews/src/ViewTestAlg.h
similarity index 100%
rename from Control/AthViews/src_dflow/ViewTestAlg.h
rename to Control/AthViews/src/ViewTestAlg.h
diff --git a/Control/AthViews/src/components/AthViews_entries.cxx b/Control/AthViews/src/components/AthViews_entries.cxx
new file mode 100644
index 00000000000..72b806f5bb4
--- /dev/null
+++ b/Control/AthViews/src/components/AthViews_entries.cxx
@@ -0,0 +1,8 @@
+#include "../ViewDataVerifier.h"
+#include "../ViewTestAlg.h"
+#include "../RoiCollectionToViews.h"
+
+DECLARE_COMPONENT( AthViews::ViewDataVerifier )
+DECLARE_COMPONENT( AthViews::ViewTestAlg )
+DECLARE_COMPONENT( AthViews::RoiCollectionToViews )
+
diff --git a/Control/AthViews/src_dflow/DFlowAlg1.cxx b/Control/AthViews/src_dflow/DFlowAlg1.cxx
index 3131a12ad05..c94436c8753 100644
--- a/Control/AthViews/src_dflow/DFlowAlg1.cxx
+++ b/Control/AthViews/src_dflow/DFlowAlg1.cxx
@@ -42,7 +42,7 @@ DFlowAlg1::DFlowAlg1( const std::string& name,
 
   declareProperty( "IntFlow", m_w_int, "Data flow of int" );
 
-  declareProperty( "ViewStart", m_r_int, "Seed data of view" );
+  declareProperty( "ViewStart", m_r_int, "Seed data of view" ); //implicit DH or whatever
 }
 
 // Destructor
diff --git a/Control/AthViews/src_dflow/ViewMergeAlg.cxx b/Control/AthViews/src_dflow/ViewMergeAlg.cxx
index 0eb9d275087..ca18ca3ad10 100644
--- a/Control/AthViews/src_dflow/ViewMergeAlg.cxx
+++ b/Control/AthViews/src_dflow/ViewMergeAlg.cxx
@@ -25,20 +25,8 @@ namespace AthViews {
 ViewMergeAlg::ViewMergeAlg( const std::string& name, 
                       ISvcLocator* pSvcLocator ) : 
   ::AthAlgorithm( name, pSvcLocator ),
-  m_w_ints( "mergedOutput" ),
-  m_r_ints( "dflow_ints" ),
-  m_r_views( "all_views" )
+  m_r_ints( "dflow_ints" )
 {
-  //
-  // Property declaration
-  // 
-  //declareProperty( "Property", m_nProperty );
-
-  //declareProperty( "IntsFromViews", m_r_ints, "Data flow of ints" );
-
-  declareProperty( "MergedInts", m_w_ints, "Data flow of ints" );
-
-  declareProperty( "AllViews", m_r_views, "All views" );
 }
 
 // Destructor
@@ -78,11 +66,11 @@ StatusCode ViewMergeAlg::execute()
 
   //Merge results
   std::vector< int > outputVector;
-  SG::ReadHandle< std::vector< int > > inputHandle( m_r_ints, ctx );
   SG::ReadHandle< std::vector< SG::View* > > inputViews( m_r_views, ctx );
-  CHECK( ViewHelper::MergeViewCollection( *inputViews,	//Vector of views (inside ReadHandle)
-				inputHandle,		//ReadHandle to access the views (the handle itself)
-				outputVector ) );	//Container to merge results into
+  CHECK( ViewHelper::MergeViewCollection( *inputViews,  //Vector of views (inside ReadHandle)
+				m_r_ints,               //ReadHandleKey to access the views
+                                ctx,                    //The context of this algorithm
+				outputVector ) );       //Container to merge results into
 
   //Output the merged data
   SG::WriteHandle< std::vector< int > > outputHandle( m_w_ints, ctx );
diff --git a/Control/AthViews/src_dflow/ViewMergeAlg.h b/Control/AthViews/src_dflow/ViewMergeAlg.h
index 03981d45cc8..bdc8e2e499f 100644
--- a/Control/AthViews/src_dflow/ViewMergeAlg.h
+++ b/Control/AthViews/src_dflow/ViewMergeAlg.h
@@ -58,9 +58,9 @@ class ViewMergeAlg
   /// Containers
   
   // vars
-  SG::WriteHandleKey< std::vector<int> > m_w_ints;
-  SG::ReadHandleKey< std::vector<int> > m_r_ints;
-  SG::ReadHandleKey< std::vector< SG::View* > > m_r_views;
+  SG::WriteHandleKey< std::vector<int> > m_w_ints{ this, "MergedInts", "mergedOutput", "Data flow of ints" };
+  SG::ReadHandleKey< std::vector<int> > m_r_ints; //This is not guaranteed to be created, so can't be declared
+  SG::ReadHandleKey< std::vector< SG::View* > > m_r_views{ this, "AllViews", "all_views", "All views" };
 }; 
 
 // I/O operators
diff --git a/Control/AthViews/src_dflow/ViewSubgraphAlg.cxx b/Control/AthViews/src_dflow/ViewSubgraphAlg.cxx
index 3a1fdc8cb6e..9411b646c38 100644
--- a/Control/AthViews/src_dflow/ViewSubgraphAlg.cxx
+++ b/Control/AthViews/src_dflow/ViewSubgraphAlg.cxx
@@ -22,29 +22,8 @@ namespace AthViews {
 ////////////////
 ViewSubgraphAlg::ViewSubgraphAlg( const std::string& name, 
                       ISvcLocator* pSvcLocator ) : 
-  ::AthAlgorithm( name, pSvcLocator ),
-  m_w_views( "all_views" ),
-  m_w_int( "view_start" ),
-  m_algorithmNameSequence( std::vector< std::string >() ),
-  m_algPoolName( "" ),
-  m_viewBaseName( "" ),
-  m_viewNumber( 0 )
+  ::AthAlgorithm( name, pSvcLocator )
 {
-  //
-  // Property declaration
-  // 
-
-  declareProperty( "ViewStart", m_w_int, "A number to start off the view" );
-  
-  declareProperty( "AllViews", m_w_views, "All views" );
-
-  declareProperty( "ViewBaseName", m_viewBaseName, "Name to use for all views - number will be appended" );
-
-  declareProperty( "ViewNumber", m_viewNumber, "Total number of views to make" );
-
-  declareProperty( "AlgorithmNameSequence", m_algorithmNameSequence, "Names of algorithms to run in the views" );
-
-  declareProperty( "AlgPoolName", m_algPoolName, "Name for the algorithm pool service to use with the views" );
 }
 
 // Destructor
@@ -59,8 +38,10 @@ StatusCode ViewSubgraphAlg::initialize()
 {
   ATH_MSG_INFO ("Initializing " << name() << "...");
 
+  renounce( m_w_int ); // To test ViewDataVerifier
   CHECK( m_w_int.initialize() );
   CHECK( m_w_views.initialize() );
+  CHECK( m_scheduler.retrieve() );
 
   return StatusCode::SUCCESS;
 }
@@ -91,17 +72,17 @@ StatusCode ViewSubgraphAlg::execute()
   }
 
   //Create the views and populate them
-  SG::WriteHandle< int > viewStartHandle( m_w_int, ctx );
-  CHECK( ViewHelper::MakeAndPopulate( m_viewBaseName,	//Base name for all views to use
-					viewVector,	//Vector to store views
-					viewStartHandle,//A writehandle to use to access the views (the handle itself, not the contents)
-					viewData ) );	//Data to initialise each view - one view will be made per entry
-
-  //Run the algorithms in views
-  CHECK( ViewHelper::RunViews( viewVector,					//View vector
-				m_algorithmNameSequence,			//Algorithms to run in each view
-				ctx,						//Context to attach the views to
-				serviceLocator()->service( m_algPoolName ) ) );	//Service to retrieve algorithms by name
+  CHECK( ViewHelper::MakeAndPopulate( m_viewBaseName,   //Base name for all views to use
+					viewVector,     //Vector to store views
+					m_w_int,        //A writehandlekey to use to access the views
+                                        ctx,            //The context of this algorithm
+					viewData ) );   //Data to initialise each view - one view will be made per entry
+
+  //Schedule the algorithms in views
+  CHECK( ViewHelper::ScheduleViews( viewVector, //View vector
+        m_viewNodeName,                         //Name of node to attach views to
+        ctx,                                    //Context to attach the views to
+        m_scheduler.get() ) );                  //ServiceHandle for the scheduler
 
   //Store the collection of views
   SG::WriteHandle< std::vector< SG::View* > > outputViewHandle( m_w_views, ctx );
diff --git a/Control/AthViews/src_dflow/ViewSubgraphAlg.h b/Control/AthViews/src_dflow/ViewSubgraphAlg.h
index d860b098c68..127aa52ab67 100644
--- a/Control/AthViews/src_dflow/ViewSubgraphAlg.h
+++ b/Control/AthViews/src_dflow/ViewSubgraphAlg.h
@@ -13,6 +13,7 @@
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "AthViews/View.h"
 #include "StoreGate/WriteHandleKey.h"
+#include "GaudiKernel/IScheduler.h"
 
 namespace AthViews {
 
@@ -57,12 +58,12 @@ class ViewSubgraphAlg
   /// Containers
   
   // vars
-  SG::WriteHandleKey< std::vector< SG::View* > > m_w_views;
-  SG::WriteHandleKey<int> m_w_int;
-  std::vector< std::string > m_algorithmNameSequence;
-  std::string m_algPoolName;
-  std::string m_viewBaseName;
-  int m_viewNumber;
+  ServiceHandle< IScheduler > m_scheduler { this, "Scheduler", "AvalancheSchedulerSvc", "The Athena scheduler" };
+  SG::WriteHandleKey< std::vector< SG::View* > > m_w_views { this, "AllViews", "all_views", "All views" };
+  SG::WriteHandleKey< int > m_w_int { this, "ViewStart", "view_start", "A number to start off the view" };
+  Gaudi::Property< std::string > m_viewBaseName { this, "ViewBaseName", "", "Name to use for all views - number will be appended" };
+  Gaudi::Property< std::string > m_viewNodeName { this, "ViewNodeName", "", "Name of CF node to attach views to" };
+  Gaudi::Property< int > m_viewNumber { this, "ViewNumber", 0, "Total number of views to make" };
 }; 
 
 // I/O operators
diff --git a/Control/AthViews/src_dflow/components/AthViewsDFlow_entries.cxx b/Control/AthViews/src_dflow/components/AthViewsDFlow_entries.cxx
index 22e21ea6412..09b2e00d851 100644
--- a/Control/AthViews/src_dflow/components/AthViewsDFlow_entries.cxx
+++ b/Control/AthViews/src_dflow/components/AthViewsDFlow_entries.cxx
@@ -1,17 +1,13 @@
 #include "../DFlowAlg1.h"
 #include "../DFlowAlg2.h"
 #include "../DFlowAlg3.h"
-#include "../ViewTestAlg.h"
 #include "../ViewMergeAlg.h"
 #include "../ViewSubgraphAlg.h"
-#include "../RoiCollectionToViews.h"
 
 
 DECLARE_COMPONENT( AthViews::DFlowAlg1 )
 DECLARE_COMPONENT( AthViews::DFlowAlg2 )
 DECLARE_COMPONENT( AthViews::DFlowAlg3 )
-DECLARE_COMPONENT( AthViews::ViewTestAlg )
 DECLARE_COMPONENT( AthViews::ViewMergeAlg )
 DECLARE_COMPONENT( AthViews::ViewSubgraphAlg )
-DECLARE_COMPONENT( AthViews::RoiCollectionToViews )
 
diff --git a/Control/AthViews/test/test_simple_view_example.sh b/Control/AthViews/test/test_simple_view_example.sh
new file mode 100755
index 00000000000..610b74b9476
--- /dev/null
+++ b/Control/AthViews/test/test_simple_view_example.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+# art-type: build
+# art-ci: master
+
+athena.py --threads=1 AthViews/SimpleViewExample.py
diff --git a/Control/AthViews/test/test_view_nest_fail.sh b/Control/AthViews/test/test_view_nest_fail.sh
new file mode 100755
index 00000000000..84caa738f68
--- /dev/null
+++ b/Control/AthViews/test/test_view_nest_fail.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# art-type: build
+# art-ci: master
+
+# We expect this command to fail, so invert the exit code
+if athena.py --threads=1 AthViews/ViewNest.py; then
+  exit 1
+else
+  exit 0
+fi
diff --git a/Control/AthViews/test/test_view_scheduling.sh b/Control/AthViews/test/test_view_scheduling.sh
new file mode 100755
index 00000000000..99db2e07108
--- /dev/null
+++ b/Control/AthViews/test/test_view_scheduling.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+# art-type: build
+# art-ci: master
+
+athena.py --threads=1 AthViews/ViewScheduling.py
diff --git a/Control/AthenaBaseComps/share/AthAlgTool_test.ref b/Control/AthenaBaseComps/share/AthAlgTool_test.ref
index b138459127e..05343ba4188 100644
--- a/Control/AthenaBaseComps/share/AthAlgTool_test.ref
+++ b/Control/AthenaBaseComps/share/AthAlgTool_test.ref
@@ -1,7 +1,7 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/propertyHandling_test.txt
-JobOptionsSvc        INFO # =======> /home/leggett/bld2/work/gprop2/src/Control/AthenaBaseComps/share/../share/propertyHandling_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/AthenaBaseComps/share/../share/propertyHandling_test.txt
 JobOptionsSvc        INFO # (1,1): alg.rkey = "FooSvc+aaa"
 JobOptionsSvc        INFO # (2,1): alg.wkey = "BarSvc+bbb"
 JobOptionsSvc        INFO # (3,1): alg.ukey = "ccc"
@@ -46,8 +46,8 @@ JobOptionsSvc        INFO # (50,1): arrtool2.wkeyarr = ["aaa"]
 JobOptionsSvc        INFO Job options successfully read in from ../share/propertyHandling_test.txt
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v28r2)
-                                          running on zeus on Tue Jul  4 11:55:28 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 15:50:04 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
@@ -56,10 +56,10 @@ HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
 test1
-ClassIDSvc           INFO  getRegistryEntries: read 751 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 754 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO  getRegistryEntries: read 401 CLIDRegistry entries for module ALL
 obj 293847295 StoreGateSvc+tee
 obj 293847295 StoreGateSvc+thh.rrr
 test2
-arrtool2            ERROR Explicit circular data dependency found for id ('AthenaBaseCompsTest::MyObj','StoreGateSvc+aaa')
-arrtool2            FATAL /home/leggett/bld2/work/gprop2/src/Control/AthenaBaseComps/src/AthAlgTool.cxx:84 (StatusCode AthAlgTool::sysInitialize()): code 0: AlgTool::sysInitialize()
+arrtool2            ERROR Explicit circular data dependency found for id  ( 'AthenaBaseCompsTest::MyObj' , 'StoreGateSvc+aaa' ) 
+arrtool2            FATAL /home/leggett/work/v30r1.002/src/Control/AthenaBaseComps/src/AthAlgTool.cxx:73 (StatusCode AthAlgTool::sysInitialize()): code 0: AlgTool::sysInitialize()
diff --git a/Control/AthenaBaseComps/share/AthAlgorithm_test.ref b/Control/AthenaBaseComps/share/AthAlgorithm_test.ref
index 027f382375a..acf9504e8d3 100644
--- a/Control/AthenaBaseComps/share/AthAlgorithm_test.ref
+++ b/Control/AthenaBaseComps/share/AthAlgorithm_test.ref
@@ -1,7 +1,7 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/propertyHandling_test.txt
-JobOptionsSvc        INFO # =======> /home/sss/atlas/dvtest/build/../tests/../share/propertyHandling_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/AthenaBaseComps/share/../share/propertyHandling_test.txt
 JobOptionsSvc        INFO # (1,1): alg.rkey = "FooSvc+aaa"
 JobOptionsSvc        INFO # (2,1): alg.wkey = "BarSvc+bbb"
 JobOptionsSvc        INFO # (3,1): alg.ukey = "ccc"
@@ -46,8 +46,8 @@ JobOptionsSvc        INFO # (50,1): arrtool2.wkeyarr = ["aaa"]
 JobOptionsSvc        INFO Job options successfully read in from ../share/propertyHandling_test.txt
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
-                                          running on karma on Wed Aug  9 13:39:17 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 15:48:57 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
@@ -56,8 +56,8 @@ HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
 test1
-ClassIDSvc           INFO  getRegistryEntries: read 782 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 435 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 754 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 401 CLIDRegistry entries for module ALL
 test2
-arralg2             ERROR Explicit circular data dependency detected for id ('AthenaBaseCompsTest::MyObj','StoreGateSvc+aaa')
-arralg2             FATAL ../src/AthAlgorithm.cxx:153 (StatusCode AthAlgorithm::sysInitialize()): code 0: Algorithm::sysInitialize()
+arralg2             ERROR Explicit circular data dependency detected for id  ( 'AthenaBaseCompsTest::MyObj' , 'StoreGateSvc+aaa' ) 
+arralg2             FATAL /home/leggett/work/v30r1.002/src/Control/AthenaBaseComps/src/AthAlgorithm.cxx:142 (StatusCode AthAlgorithm::sysInitialize()): code 0: Algorithm::sysInitialize()
diff --git a/Control/AthenaKernel/AthenaKernel/IUserDataSvc.h b/Control/AthenaKernel/AthenaKernel/IUserDataSvc.h
deleted file mode 100644
index fa7419189da..00000000000
--- a/Control/AthenaKernel/AthenaKernel/IUserDataSvc.h
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//Dear emacs, this is -*-c++-*-
-
-#ifndef IUSERDATASVC_H
-#define IUSERDATASVC_H
-
-#include "GaudiKernel/IService.h"
-#include "GaudiKernel/StatusCode.h"
-#include "AthenaKernel/IAthenaBarCode.h"
-
-#include <string>
-#include <typeinfo>
-#include "boost/any.hpp"
-
-
-/** @class IUserDataSvc
- * @brief  interface to UserDataSvc
- * @author Yushu Yao <yyao@lbl.gov> - ATLAS Collaboration
- * @author Walter Lampl <walter.lampl@cern.ch>
- *$Id: IUserDataSvc.h,v 1.8 2008/05/27 22:09:42 yyao Exp $
- */
-
-class IUserDataSvc : virtual public IService {
-
-public:
-
-  //Standard destructor
-  ~IUserDataSvc() {}
-
-  //Standard interfaceID query
-  static const InterfaceID&   interfaceID();
-
-
-  // * * * * * * * * * * * * * * * * * * * * * * * *
-  //NEW StoreGate-inspired interface:
-  //1. Event Level Decorations
-  // * * * * * * * * * * * * * * * * * * * * * * * *
-
-  /** 
-   * @brief Record method for event decorations (recommended)
-   * @param label String label of the decoration
-   * @param deco Decoration payload (template) 
-   */
-  template<typename DECO>
-  StatusCode record(const std::string& label, const DECO& deco);
-
-
-  /** 
-   * @brief Retrieve method for event decorations (recommended)
-   * @param label String label of the decoration
-   * @param[out] deco (output) Decoration payload  
-   */
-  template<typename DECO>
-  StatusCode retrieve(const std::string & label, DECO &deco);
-
-
-  /** 
-   * @brief Contains method for event decorations (recommended)
-   * @param label String label of the decoration
-   * @return True if the decoration exists
-   */
-  virtual bool contains(const std::string& label) =0;
-
-  // * * * * * * * * * * * * * * * * * * * * * * * *
-  //2. Element Level Decorations
-  // * * * * * * * * * * * * * * * * * * * * * * * *
-
-  /** 
-   * @brief Record method for element decorations (recommended)
-   * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param deco Decoration payload (template) 
-   */
-  template<typename DECO>
-  StatusCode record(const IAthenaBarCode &abc, const std::string& label, const DECO& deco);
-
-
-  /** 
-   * @brief Retrieve method for element decorations (recommended)
-    * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param[out] deco (output) Decoration payload  
-   */
-  template<typename DECO>
-  StatusCode retrieve(const IAthenaBarCode &abc, const std::string & label, DECO &deco);
-
-  /** 
-   * @brief Contains method for element decorations (recommended)
-   * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @return True if the decoration exists
-   */
-  virtual bool contains(const IAthenaBarCode& abc,const std::string& label) =0;
-
-
-
-
-  // * * * * * * * * * * * * * * * * * * * * * * * *
-  // Pure Virtual Methods
-  // * * * * * * * * * * * * * * * * * * * * * * * *
-
-  //For Element decoration
-  virtual StatusCode recordAny(const IAthenaBarCode& abc,const std::string& label, const boost::any& value)=0;
-  virtual StatusCode retrieveAny(const IAthenaBarCode& abc,const std::string& label, const boost::any*& value) =0;
-
-  //For Event decoration:
-  virtual StatusCode recordAny(const std::string& label, const boost::any& value)=0;
-  virtual StatusCode retrieveAny(const std::string& label, const boost::any*& value) =0;
-
-
-  // * * * * * * * * * * * * * * * * * * * * * * * *
-  //Legacy interface
-  // * * * * * * * * * * * * * * * * * * * * * * * *
-
-  
-  /** 
-   * @brief Legacy Retrieve method for element decorations (deprecated)
-   * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param[out] deco (output) Decoration payload  
-   */
-  template<typename DECO>
-  StatusCode getElementDecoration(const IAthenaBarCode &abc, const std::string & label, DECO &deco) {
-    return retrieve(abc,label,deco);
-  }
-
-  /**
-   * @brief Legacy Retrieve method for element decorations (deprecated)
-   * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param[out] deco (output) Decoration payload
-   */
-
-  template<typename DECO>
-  StatusCode getInMemElementDecoration(const IAthenaBarCode &abc, const std::string & label, DECO &deco) {
-    return retrieve(abc,label,deco);
-  }
-
-  /** 
-   * @brief Legacy Record method for element decorations (deprecated)
-   * @param label String label of the decoration
-   * @param deco (output) Decoration payload  
-   */
-  template<typename DECO>
-  StatusCode decorateElement(const IAthenaBarCode &abc, const std::string& label, DECO& deco) {
-    return record(abc,label,deco);
-  }
-  
-  /** 
-   * @brief Legacy Record method for event decorations (deprecated)
-   * @param label String label of the decoration
-   * @param[out] deco (output) Decoration payload  
-   */
-  template<typename DECO>
-  StatusCode decorateEvent(const std::string& label, const DECO& deco) {
-    return record(label,deco);
-  }
-
-  /** 
-   * @brief Legacy Retrieve method for event decorations (deprecated)
-    * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param[out] deco (output) Decoration payload  
-   */
-  template<typename DECO>
-  StatusCode getEventDecoration(const std::string & label, DECO &deco) {
-    return retrieve(label,deco);
-  }
-
-  /** 
-   * @brief Legacy Retrieve method for event decorations (deprecated)
-    * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @param[out] deco (output) Decoration payload  
-   */
-  template<typename DECO>
-  StatusCode getInMemEventDecoration(const std::string & label, DECO &deco) {
-    return retrieve(label,deco);
-  }
-
-  /** 
-   * @brief Legacy Contains method for Event decorations (deprecated)
-   * @param label String label of the decoration
-   * @return True if the decoration exists
-   */
-  bool containsEventDecoration(const std::string &label) {
-    return contains(label);
-  }
-  /** 
-   * @brief Legacy Contains method for Event decorations (deprecated)
-   * @param label String label of the decoration
-   * @return True if the decoration exists
-   */
-
-  bool containsInMemEventDecoration(const std::string &label) {
-    return contains(label);
-  }
-
-  /** 
-   * @brief Legacy Contains method for Event decorations (deprecated)
-   * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @return True if the decoration exists
-   */
-  bool containsElementDecoration(const IAthenaBarCode &abc, const std::string &label="") {
-    return contains(abc,label);
-  }
-
-  /** 
-   * @brief Legacy Contains method for Event decorations (deprecated)
-   * @param abc A data-object implmenting the IAthenaBarCode interface
-   * @param label String label of the decoration
-   * @return True if the decoration exists
-   */
-  bool containsInMemElementDecoration(const IAthenaBarCode &abc, const std::string &label="") {
-    return contains(abc,label);
-  }
-
-
-
-  virtual int vdecorateElement(const IAthenaBarCode &abc, const std::string& label,
-			       const std::type_info &decoinfo, void* & deco) =0;
-
-  virtual int vgetElementDecoration(const IAthenaBarCode &abc, const std::string& label,
-				     const std::type_info &decoinfo, void *&deco) = 0;
-
-
-
-  int vgetInMemElementDecoration(const IAthenaBarCode &abc, const std::string& label,
-				 const std::type_info &decoinfo, void *&deco,
-				 bool /*quiet*/) {
-    return vgetElementDecoration(abc,label,decoinfo,deco);
-  }
-
-
-};
-
-
-
-
-template<typename DECO>
-inline StatusCode IUserDataSvc::record(const std::string& label, const DECO& deco) {  
-  const boost::any value(deco);
-  return this->recordAny(label, value);
-
-}
-
-template<typename DECO>
-inline StatusCode IUserDataSvc::retrieve(const std::string & label, DECO &deco) {
-  const boost::any* value;
-  StatusCode sc=this->retrieveAny(label, value);
-  if (sc.isFailure()) return sc;
-  if (typeid(DECO) != value->type())  return StatusCode::FAILURE;
- 
-  deco=boost::any_cast<DECO>(*value);
-  return StatusCode::SUCCESS;
-}
-
-
-template<typename DECO>
-inline StatusCode IUserDataSvc::record(const IAthenaBarCode &abc, const std::string& label, const DECO& deco) {
-  boost::any value(deco);
-  return this->recordAny(abc,label, value);
-}
-
-
-template<typename DECO>
-inline StatusCode IUserDataSvc::retrieve(const IAthenaBarCode &abc, const std::string & label, DECO &deco) {
-  const boost::any* value=0;
-  StatusCode sc=this->retrieveAny(abc,label, value);
-  if (sc.isFailure()) return sc;
-  if (typeid(DECO) != value->type())  return StatusCode::FAILURE;
-  const DECO* decoPtr=boost::any_cast<DECO>(value);
-  deco=*decoPtr; //Deep copy! 
-  return StatusCode::SUCCESS;
-
-}
-
-
-inline const InterfaceID&
-IUserDataSvc::interfaceID() {
-  static const InterfaceID IID("IUserDataSvc", 1, 0);
-  return IID;
-}
-
-#endif // IUSERDATASVC_H
-
-
-//Old methods, not implemented in the new version:
-
-//virtual bool containsElementDecoration(const IAthenaBarCode &abc, const std::string &label="") = 0;
-  //virtual bool containsInMemElementDecoration(const IAthenaBarCode &abc, const std::string &label="") = 0;
-
-  //Functions to iterate over existing element level decorations in this event
-  //Slow, not suggested to use for production purpose
-  //virtual  std::vector<AthenaBarCode_t> getElListOfABC()  =0;
-  //virtual  std::vector<std::string> getElListOfLabel(const AthenaBarCode_t &abc) =0;
-  //virtual  std::vector<AthenaBarCode_t> getInMemElListOfABC()  =0;
-  //virtual  std::vector<std::string> getInMemElListOfLabel(const AthenaBarCode_t &abc) =0;
-
-
-/*
-  virtual int
-  vdecorate(const std::string& label, const std::type_info &decoinfo,
-      void* & deco, void* & defaultobj, void* & tobedeleted,
-      const UserDataAssociation::DecoLevel& level, const CLID& clid,
-      const std::string & key) = 0;
-
-  virtual int
-  vdecorateElement(const IAthenaBarCode &abc, const std::string& label,
-      const std::type_info &decoinfo, void* & deco, void* & defaultobj,
-      void* & tobedeleted)=0;
-
-  virtual int
-  vgetDecoration(const std::string& label, const std::type_info &decoinfo,
-      void *&deco, const UserDataAssociation::DecoLevel& level,
-      const CLID& clid, const std::string & key) = 0;
-
-  virtual int
-  vgetInMemDecoration(const std::string& label, const std::type_info &decoinfo,
-      void *&deco, const UserDataAssociation::DecoLevel& level,
-      const CLID& clid, const std::string & key) = 0;
-
-  virtual int
-  vgetElementDecoration(const IAthenaBarCode &abc, const std::string& label,
-                        const std::type_info &decoinfo, void *&deco) = 0;
-
-
-
-  */
diff --git a/Control/AthenaKernel/share/SlotSpecificObj_test.ref b/Control/AthenaKernel/share/SlotSpecificObj_test.ref
index 9918982fc78..4a9329b2faf 100644
--- a/Control/AthenaKernel/share/SlotSpecificObj_test.ref
+++ b/Control/AthenaKernel/share/SlotSpecificObj_test.ref
@@ -1,17 +1,20 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/SlotSpecificObj_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/AthenaKernel/share/../share/SlotSpecificObj_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/AthenaKernel/share/../share/SlotSpecificObj_test.txt
 JobOptionsSvc        INFO # (1,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO Job options successfully read in from ../share/SlotSpecificObj_test.txt
+MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
-                                          running on lxplus020.cern.ch on Mon Dec 11 13:14:37 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 15:57:35 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
+ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
diff --git a/Control/AthenaKernel/share/errorcheck_test.ref b/Control/AthenaKernel/share/errorcheck_test.ref
index 8ee22118d35..c4af616e72f 100644
--- a/Control/AthenaKernel/share/errorcheck_test.ref
+++ b/Control/AthenaKernel/share/errorcheck_test.ref
@@ -1,7 +1,7 @@
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on pc-tbed-pub-13.cern.ch on Tue Dec  5 15:09:02 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
+                                          running on karma on Fri Dec 15 20:15:45 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
@@ -9,31 +9,31 @@ EventLoopMgr      WARNING No events will be processed from external input.
 HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
-alg                 ERROR ../errorcheck_test.cxx (StatusCode test1()): code 0: foomsg
-alg                  INFO ../errorcheck_test.cxx (StatusCode test1()): some message
-alg                  INFO ../errorcheck_test.cxx (StatusCode test1()): a... b
-alg                  INFO ../errorcheck_test.cxx (StatusCode test1()): foo
-alg                 FATAL ../errorcheck_test.cxx (StatusCode test1a()): code 0: StatusCode (StatusCode::FAILURE)
-alg                 ERROR ../errorcheck_test.cxx (StatusCode test1b()): code 2: StatusCode (StatusCode::FAILURE)
-alg                 ERROR ../errorcheck_test.cxx (StatusCode test1c()): code 2: StatusCode (StatusCode::RECOVERABLE)
-alg                 FATAL ../errorcheck_test.cxx (StatusCode test1d()): code 0: StatusCode (StatusCode::FAILURE)
-alg                 FATAL ../errorcheck_test.cxx (StatusCode test1e()): code 0: StatusCode (StatusCode::RECOVERABLE)
-alg                 FATAL ../errorcheck_test.cxx (StatusCode test1f()): code 123: StatusCode (StatusCode::RECOVERABLE)
-alg                 FATAL ../errorcheck_test.cxx (int test1g()): code 0: StatusCode (StatusCode::FAILURE)
-algname             ERROR ../errorcheck_test.cxx (StatusCode Algtest::test1()): code 0: foomsg
-algname              INFO ../errorcheck_test.cxx (StatusCode Algtest::test1()): some info
-algname             FATAL ../errorcheck_test.cxx (StatusCode Algtest::test1()): code 0: StatusCode (StatusCode::FAILURE)
-toolname            ERROR ../errorcheck_test.cxx (StatusCode Algtooltest::test1()): code 0: foomsg
-toolname             INFO ../errorcheck_test.cxx (StatusCode Algtooltest::test1()): some info
-toolname            FATAL ../errorcheck_test.cxx (StatusCode Algtooltest::test1()): code 123: StatusCode (StatusCode::RECOVERABLE)
-servname            ERROR ../errorcheck_test.cxx (StatusCode Servtest::test1()): code 0: foomsg
-servname             INFO ../errorcheck_test.cxx (StatusCode Servtest::test1()): some info
-servname            ERROR ../errorcheck_test.cxx (StatusCode Servtest::test1()): code 2: StatusCode (StatusCode::FAILURE)
-                    ERROR ../errorcheck_test.cxx (StatusCode Test::test1()): code 0: foomsg
-                     INFO ../errorcheck_test.cxx (StatusCode Test::test1()): some info
-                    FATAL ../errorcheck_test.cxx (StatusCode Test::test1()): code 0: StatusCode (StatusCode::RECOVERABLE)
-                    FATAL ../errorcheck_test.cxx (int Test::test2()): code 0: StatusCode (StatusCode::FAILURE)
+alg                 ERROR ../test/errorcheck_test.cxx:210 (StatusCode test1()): code 0: foomsg
+alg                  INFO ../test/errorcheck_test.cxx:212 (StatusCode test1()): some message
+alg                  INFO ../test/errorcheck_test.cxx:215 (StatusCode test1()): a... b
+alg                  INFO ../test/errorcheck_test.cxx:219 (StatusCode test1()): foo
+alg                 FATAL ../test/errorcheck_test.cxx:127 (StatusCode test1a()): code 0: sc2
+alg                 ERROR ../test/errorcheck_test.cxx:139 (StatusCode test1b()): code 2: sc2
+alg                 ERROR ../test/errorcheck_test.cxx:151 (StatusCode test1c()): code 2: sc2
+alg                 FATAL ../test/errorcheck_test.cxx:163 (StatusCode test1d()): code 0: sc2
+alg                 FATAL ../test/errorcheck_test.cxx:175 (StatusCode test1e()): code 0: sc2
+alg                 FATAL ../test/errorcheck_test.cxx:187 (StatusCode test1f()): code 123: sc2
+alg                 FATAL ../test/errorcheck_test.cxx:198 (int test1g()): code 0: sc2
+algname             ERROR ../test/errorcheck_test.cxx:38 (StatusCode Algtest::test1()): code 0: foomsg
+algname              INFO ../test/errorcheck_test.cxx:39 (StatusCode Algtest::test1()): some info
+algname             FATAL ../test/errorcheck_test.cxx:45 (StatusCode Algtest::test1()): code 0: sc2
+toolname            ERROR ../test/errorcheck_test.cxx:62 (StatusCode Algtooltest::test1()): code 0: foomsg
+toolname             INFO ../test/errorcheck_test.cxx:63 (StatusCode Algtooltest::test1()): some info
+toolname            FATAL ../test/errorcheck_test.cxx:65 (StatusCode Algtooltest::test1()): code 123: StatusCode (StatusCode::RECOVERABLE)
+servname            ERROR ../test/errorcheck_test.cxx:82 (StatusCode Servtest::test1()): code 0: foomsg
+servname             INFO ../test/errorcheck_test.cxx:83 (StatusCode Servtest::test1()): some info
+servname            ERROR ../test/errorcheck_test.cxx:85 (StatusCode Servtest::test1()): code 2: StatusCode (StatusCode::FAILURE)
+                    ERROR ../test/errorcheck_test.cxx:100 (StatusCode Test::test1()): code 0: foomsg
+                     INFO ../test/errorcheck_test.cxx:101 (StatusCode Test::test1()): some info
+                    FATAL ../test/errorcheck_test.cxx:103 (StatusCode Test::test1()): code 0: StatusCode (StatusCode::RECOVERABLE)
+                    FATAL ../test/errorcheck_test.cxx:114 (int Test::test2()): code 0: sc2
 alg                 ERROR FILE:LINE (StatusCode test1()): code 0: foox
-alg                 ERROR ../errorcheck_test.cxx (StatusCode test1()): code 0: fooy
-test2                INFO ../errorcheck_test.cxx (void test2(std::vector<int>, const int*, int (*)(), int*)): test2
-test3                INFO ../errorcheck_test.cxx (void test3(const std::string&, int)): test3
+alg                 ERROR ../test/errorcheck_test.cxx:237 (StatusCode test1()): code 0: fooy
+test2                INFO ../test/errorcheck_test.cxx:253 (void test2(std::vector<int>, const int*, int (*)(), int*)): test2
+test3                INFO ../test/errorcheck_test.cxx:262 (void test3(const std::string&, int)): test3
diff --git a/Control/AthenaKernel/test/CondCont_test.cxx b/Control/AthenaKernel/test/CondCont_test.cxx
index 93aabbee844..9d3c7b52d1e 100644
--- a/Control/AthenaKernel/test/CondCont_test.cxx
+++ b/Control/AthenaKernel/test/CondCont_test.cxx
@@ -84,7 +84,7 @@ void fillit (CondCont<T>& cc, std::vector<T*> & ptrs)
   assert (cc.proxy() == nullptr);
   std::ostringstream ss1;
   cc.list (ss1);
-  assert (ss1.str() == "id: ('key')  proxy: 0\n\
+  assert (ss1.str() == "id: 'key'  proxy: 0\n\
 clock: [0]\n\
 RE: [0]\n");
 
@@ -101,7 +101,7 @@ RE: [0]\n");
   std::ostringstream ss2;
   cc.list (ss2);
   std::ostringstream exp2;
-  exp2 << "id: ('key')  proxy: 0\n"
+  exp2 << "id: 'key'  proxy: 0\n"
        << "clock: [1]\n"
        << "{[4294967295,t:123] - [4294967295,t:456]} " << ptrs[2] << "\n"
        << "RE: [2]\n"
diff --git a/Control/AthenaKernel/test/SlotSpecificObj_test.cxx b/Control/AthenaKernel/test/SlotSpecificObj_test.cxx
index 32b401190f2..1724c9f2667 100644
--- a/Control/AthenaKernel/test/SlotSpecificObj_test.cxx
+++ b/Control/AthenaKernel/test/SlotSpecificObj_test.cxx
@@ -42,7 +42,7 @@ public:
   virtual StatusCode freeStore( size_t /*partitionIndex*/ ) override { std::abort(); }
   virtual size_t getPartitionNumber(int /*eventnumber*/) const override { std::abort(); }
   virtual size_t getNumberOfStores() const override { return nslots; }
-  virtual unsigned int freeSlots() override { std::abort(); }
+  virtual size_t freeSlots() override { std::abort(); }
 
 };
 
diff --git a/Control/AthenaKernel/test/errorcheck_test.cxx b/Control/AthenaKernel/test/errorcheck_test.cxx
index def9ac2ed97..aabe4fdf75c 100644
--- a/Control/AthenaKernel/test/errorcheck_test.cxx
+++ b/Control/AthenaKernel/test/errorcheck_test.cxx
@@ -37,8 +37,12 @@ StatusCode Algtest::test1()
 {
   REPORT_ERROR (StatusCode (StatusCode::FAILURE)) << "foomsg";
   REPORT_MESSAGE (MSG::INFO) << "some info";
-  CHECK( StatusCode (StatusCode::SUCCESS) );
-  CHECK( StatusCode (StatusCode::FAILURE) );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK( sc1 );
+  StatusCode sc2 (StatusCode::FAILURE);
+  CHECK( sc2 );
   return StatusCode (StatusCode::SUCCESS);
 }
 
@@ -102,8 +106,12 @@ StatusCode Test::test1()
 
 int Test::test2()
 {
-  CHECK( StatusCode (StatusCode::SUCCESS), 0 );
-  CHECK( StatusCode (StatusCode::FAILURE), -1 );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK( sc1, 0 );
+  StatusCode sc2 (StatusCode::FAILURE);
+  CHECK( sc2, -1 );
   return 0;
 }
 
@@ -111,60 +119,90 @@ int Test::test2()
 
 StatusCode test1a()
 {
-  CHECK_WITH_CONTEXT( StatusCode (StatusCode::SUCCESS), "alg" );
-  CHECK_WITH_CONTEXT( StatusCode (StatusCode::FAILURE), "alg" );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK_WITH_CONTEXT( sc1, "alg" );
+  StatusCode sc2 (StatusCode::FAILURE);
+  CHECK_WITH_CONTEXT( sc2, "alg" );
   return StatusCode (StatusCode::SUCCESS);
 }
 
 
 StatusCode test1b()
 {
-  CHECK_RECOVERABLE_WITH_CONTEXT( StatusCode (StatusCode::SUCCESS), "alg" );
-  CHECK_RECOVERABLE_WITH_CONTEXT( StatusCode (StatusCode::FAILURE), "alg" );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK_RECOVERABLE_WITH_CONTEXT( sc1, "alg" );
+  StatusCode sc2 (StatusCode::FAILURE);
+  CHECK_RECOVERABLE_WITH_CONTEXT( sc2, "alg" );
   return StatusCode (StatusCode::SUCCESS);
 }
 
 
 StatusCode test1c()
 {
-  CHECK_RECOVERABLE_WITH_CONTEXT( StatusCode (StatusCode::SUCCESS), "alg" );
-  CHECK_RECOVERABLE_WITH_CONTEXT( StatusCode (StatusCode::RECOVERABLE),"alg" );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK_RECOVERABLE_WITH_CONTEXT( sc1, "alg" );
+  StatusCode sc2 (StatusCode::RECOVERABLE);
+  CHECK_RECOVERABLE_WITH_CONTEXT( sc2,"alg" );
   return StatusCode (StatusCode::SUCCESS);
 }
 
 
 StatusCode test1d()
 {
-  CHECK_FATAL_WITH_CONTEXT( StatusCode (StatusCode::SUCCESS), "alg" );
-  CHECK_FATAL_WITH_CONTEXT( StatusCode (StatusCode::FAILURE), "alg" );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK_FATAL_WITH_CONTEXT( sc1, "alg" );
+  StatusCode sc2 (StatusCode::FAILURE);
+  CHECK_FATAL_WITH_CONTEXT( sc2, "alg" );
   return StatusCode (StatusCode::SUCCESS);
 }
 
 
 StatusCode test1e()
 {
-  CHECK_FATAL_WITH_CONTEXT( StatusCode (StatusCode::SUCCESS), "alg" );
-  CHECK_FATAL_WITH_CONTEXT( StatusCode (StatusCode::RECOVERABLE), "alg" );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK_FATAL_WITH_CONTEXT( sc1, "alg" );
+  StatusCode sc2 (StatusCode::RECOVERABLE);
+  CHECK_FATAL_WITH_CONTEXT( sc2, "alg" );
   return StatusCode (StatusCode::SUCCESS);
 }
 
 
 StatusCode test1f()
 {
-  CHECK_CODE_WITH_CONTEXT( StatusCode (StatusCode::SUCCESS), "alg", StatusCode(123) );
-  CHECK_CODE_WITH_CONTEXT( StatusCode (StatusCode::RECOVERABLE), "alg", StatusCode(123) );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK_CODE_WITH_CONTEXT( sc1, "alg", StatusCode(123) );
+  StatusCode sc2 (StatusCode::RECOVERABLE);
+  CHECK_CODE_WITH_CONTEXT( sc2, "alg", StatusCode(123) );
   return StatusCode (StatusCode::SUCCESS);
 }
 
 int test1g()
 {
-  CHECK_WITH_CONTEXT( StatusCode (StatusCode::SUCCESS), "alg", 0 );
-  CHECK_WITH_CONTEXT( StatusCode (StatusCode::FAILURE), "alg", -1 );
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
+  StatusCode sc1 (StatusCode::SUCCESS);
+  CHECK_WITH_CONTEXT( sc1, "alg", 0 );
+  StatusCode sc2 (StatusCode::FAILURE);
+  CHECK_WITH_CONTEXT( sc2, "alg", -1 );
   return 0;
 }
 
 StatusCode test1()
 {
+  // Can't write it like CHECK( StatusCode (StatusCode::SUCCESS) );
+  // or we get parse errors from clang.
   Algtest algtest;  algtest.addRef();
   Algtooltest algtooltest (&algtest);  algtooltest.addRef();
   Servtest servtest;  servtest.addRef();
diff --git a/Control/AthenaMP/src/AthMpEvtLoopMgr.cxx b/Control/AthenaMP/src/AthMpEvtLoopMgr.cxx
index 07ee415e46e..bf441c46736 100644
--- a/Control/AthenaMP/src/AthMpEvtLoopMgr.cxx
+++ b/Control/AthenaMP/src/AthMpEvtLoopMgr.cxx
@@ -43,6 +43,7 @@ AthMpEvtLoopMgr::AthMpEvtLoopMgr(const std::string& name
 				 , ISvcLocator* svcLocator)
   : AthService(name,svcLocator)
   , m_evtProcessor("AthenaEventLoopMgr", name)
+  , m_evtSelector(nullptr)
   , m_nWorkers(0)
   , m_workerTopDir("athenaMP_workers")
   , m_outputReportName("AthenaMPOutputs")
@@ -78,11 +79,29 @@ StatusCode AthMpEvtLoopMgr::initialize()
 
   Gaudi::Concurrency::ConcurrencyFlags::setNumProcs(m_nWorkers);
 
-  if(m_strategy=="EventService" && m_nEventsBeforeFork!=0) {
-    ATH_MSG_ERROR("The EventService strategy cannot run with non-zero value for EventsBeforeFork");
+  SmartIF<IProperty> prpMgr(serviceLocator());
+  if(!prpMgr.isValid()) {
+    ATH_MSG_ERROR("Failed to get hold of the Property Manager");
     return StatusCode::FAILURE;
   }
 
+  std::string evtSelName = prpMgr->getProperty("EvtSel").toString();
+  ATH_CHECK(serviceLocator()->service(evtSelName,m_evtSelector));
+
+  if(m_strategy=="EventService") {
+    // ES with non-zero events before forking makes no sense
+    if(m_nEventsBeforeFork!=0) {
+      ATH_MSG_ERROR("The EventService strategy cannot run with non-zero value for EventsBeforeFork");
+      return StatusCode::FAILURE;
+    }
+
+    // We need to ignore SkipEvents in ES
+    if(updateSkipEvents(0).isFailure()) {
+      ATH_MSG_ERROR("Failed to set skipEvents=0 in Event Service");
+      return StatusCode::FAILURE;
+    }
+  }
+
   if(m_isPileup) {
     m_evtProcessor = ServiceHandle<IEventProcessor>("PileUpEventLoopMgr",name());
     ATH_MSG_INFO("ELM: The job running in pileup mode");
@@ -323,19 +342,6 @@ StatusCode AthMpEvtLoopMgr::executeRun(int maxevt)
     ATH_MSG_INFO("END collecting sub-process logs");
   }
 
-  // Restart the event selector in order to avoid segfault at stop()
-  SmartIF<IProperty> prpMgr(serviceLocator());
-  if(prpMgr.isValid()) {
-    std::string evtSelName = prpMgr->getProperty("EvtSel").toString();
-    IService* evtSelector(0);
-    ATH_CHECK(serviceLocator()->service(evtSelName,evtSelector));
-    ATH_CHECK(evtSelector->start());
-  }
-  else {
-    ATH_MSG_ERROR("Failed to get hold of the Property Manager");
-    return StatusCode::FAILURE;
-  }
-
   if(sc.isSuccess())
     return generateOutputReport();
   else 
@@ -647,18 +653,7 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt)
   }
 
   // Change the InputCollections property of the event selector
-  SmartIF<IProperty> prpMgr(serviceLocator());
-  IService* evtSelector(0);
-  if(prpMgr.isValid()) {
-    std::string evtSelName = prpMgr->getProperty("EvtSel").toString();
-    ATH_CHECK(serviceLocator()->service(evtSelName,evtSelector));
-  }
-  else {
-    ATH_MSG_ERROR("Failed to get hold of the Property Manager");
-    return StatusCode::FAILURE;
-  }
-
-  IProperty* propertyServer = dynamic_cast<IProperty*>(evtSelector);
+  IProperty* propertyServer = dynamic_cast<IProperty*>(m_evtSelector);
   if(!propertyServer) {
     ATH_MSG_ERROR("Unable to dyn-cast the event selector to IProperty");
     return StatusCode::FAILURE;
@@ -672,7 +667,7 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt)
   ATH_MSG_INFO("Updated the InputCollections property of the event selector");
 
   // Register new input files with the I/O component manager
-  IIoComponent* iocomp = dynamic_cast<IIoComponent*>(evtSelector);
+  IIoComponent* iocomp = dynamic_cast<IIoComponent*>(m_evtSelector);
   if(iocomp==nullptr) {
     ATH_MSG_FATAL("Unable to dyn-cast Event Selector to IIoComponent");
     return StatusCode::FAILURE;
@@ -711,9 +706,18 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt)
 
   // _______________________ Update Skip Events ___________________________
   int skipEvents = std::atoi(tokens["skipEvents"].c_str());
+  return updateSkipEvents(skipEvents);
+}
+
+StatusCode AthMpEvtLoopMgr::updateSkipEvents(int skipEvents)
+{
+  IProperty* propertyServer = dynamic_cast<IProperty*>(m_evtSelector);
+  if(!propertyServer) {
+    ATH_MSG_ERROR("Unable to dyn-cast the event selector to IProperty");
+    return StatusCode::FAILURE;
+  }
 
-  propertyName = "SkipEvents";
-  IntegerProperty skipEventsProperty(propertyName, skipEvents);
+  IntegerProperty skipEventsProperty("SkipEvents", skipEvents);
   if(propertyServer->setProperty(skipEventsProperty).isFailure()) {
     ATH_MSG_ERROR("Unable to update " << skipEventsProperty.name() << " property on the Event Selector");
     return StatusCode::FAILURE;
diff --git a/Control/AthenaMP/src/AthMpEvtLoopMgr.h b/Control/AthenaMP/src/AthMpEvtLoopMgr.h
index 82e2c0e1cbd..35df378aa02 100644
--- a/Control/AthenaMP/src/AthMpEvtLoopMgr.h
+++ b/Control/AthenaMP/src/AthMpEvtLoopMgr.h
@@ -3,7 +3,7 @@
 */
 
 #ifndef ATHENAMP_ATHMPEVTLOOPMGR_H
-#define ATHENAMP_ATHMPEVTLOOPMGR_H 1
+#define ATHENAMP_ATHMPEVTLOOPMGR_H
 
 #include "GaudiKernel/IEventProcessor.h"
 #include "AthenaBaseComps/AthService.h"
@@ -35,6 +35,7 @@ class AthMpEvtLoopMgr
 
  private:
   ServiceHandle<IEventProcessor> m_evtProcessor;
+  IService*                      m_evtSelector;
   int                            m_nWorkers;
   std::string                    m_workerTopDir;
   std::string                    m_outputReportName;
@@ -61,7 +62,8 @@ class AthMpEvtLoopMgr
   StatusCode wait();
   StatusCode generateOutputReport(); 
   boost::shared_ptr<AthenaInterprocess::FdsRegistry> extractFds();
-  StatusCode afterRestart(int&);
+  StatusCode afterRestart(int& maxevt);
+  StatusCode updateSkipEvents(int skipEvents);
 }; 
 
 #endif
diff --git a/Control/AthenaMP/src/memory-monitor/rapidjson/document.h b/Control/AthenaMP/src/memory-monitor/rapidjson/document.h
index a090a4ad1f4..2dce56c1c99 100644
--- a/Control/AthenaMP/src/memory-monitor/rapidjson/document.h
+++ b/Control/AthenaMP/src/memory-monitor/rapidjson/document.h
@@ -1588,18 +1588,32 @@ private:
 
     // Initialize this value as array with initial data, without calling destructor.
     void SetArrayRaw(GenericValue* values, SizeType count, Allocator& allocator) {
+#if __GNUC__ >= 8
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
         flags_ = kArrayFlag;
         data_.a.elements = (GenericValue*)allocator.Malloc(count * sizeof(GenericValue));
         std::memcpy(data_.a.elements, values, count * sizeof(GenericValue));
         data_.a.size = data_.a.capacity = count;
+#if __GNUC__ >= 8
+# pragma GCC diagnostic pop
+#endif
     }
 
     //! Initialize this value as object with initial data, without calling destructor.
     void SetObjectRaw(Member* members, SizeType count, Allocator& allocator) {
+#if __GNUC__ >= 8
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
         flags_ = kObjectFlag;
         data_.o.members = (Member*)allocator.Malloc(count * sizeof(Member));
         std::memcpy(data_.o.members, members, count * sizeof(Member));
         data_.o.size = data_.o.capacity = count;
+#if __GNUC__ >= 8
+# pragma GCC diagnostic pop
+#endif
     }
 
     //! Initialize this value as constant string, without calling destructor.
diff --git a/Control/AthenaServices/CMakeLists.txt b/Control/AthenaServices/CMakeLists.txt
index 8be1d15b715..56cc303770a 100644
--- a/Control/AthenaServices/CMakeLists.txt
+++ b/Control/AthenaServices/CMakeLists.txt
@@ -53,7 +53,7 @@ atlas_add_test( AthenaOutputStream_test
    src/OutputStreamSequencerSvc.cxx src/MetaDataSvc.cxx
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
    LINK_LIBRARIES TestTools AsgTools AthenaKernel SGTools StoreGateLib GaudiKernel AthenaBaseComps PersistentDataModel
-   EXTRA_PATTERNS "^AthenaRootStrea... +(INFO|DEBUG)|^AthenaSealSvc +DEBUG|^SGAudSvc +(INFO|DEBUG)|of type DataHistory|DEBUG Recorded object|object modifiable when retrieved|^ToolSvc +DEBUG Service base class initialized|^IncidentSvc *DEBUG Adding .* listener|^Py:Athena *INFO using release|DecisionSvc +DEBUG|: duplicate entry|^IoComponentMgr +(INFO|DEBUG)|DBReplicaSvc|^HistogramPersis.*DEBUG|^JobOptionsSvc +INFO|^//GP:=|^ItemListSvc +(INFO|DEBUG)|Info File PoolFileCatalog.xml does not exist|DataModelCompatSvc::initialize|^ProxyProviderSvc +DEBUG|^DataModelCompatSvc +DEBUG|^AthenaOutputStreamVERBOSE|^AthenaOutputStream +DEBUG|Service base class initialized successfully|^TimelineSvc +DEBUG|DEBUG Property update for OutputLevel"
+   EXTRA_PATTERNS "^AthenaRootStrea... +(INFO|DEBUG)|^AthenaSealSvc +DEBUG|^SGAudSvc +(INFO|DEBUG)|of type DataHistory|DEBUG Recorded object|object modifiable when retrieved|^ToolSvc +DEBUG Service base class initialized|^ServiceManager +DEBUG Initializing service|^IncidentSvc *DEBUG Adding .* listener|^Py:Athena *INFO using release|DecisionSvc +DEBUG|: duplicate entry|^IoComponentMgr +(INFO|DEBUG)|DBReplicaSvc|^HistogramPersis.*DEBUG|^JobOptionsSvc +INFO|^//GP:=|^ItemListSvc +(INFO|DEBUG)|Info File PoolFileCatalog.xml does not exist|DataModelCompatSvc::initialize|^ProxyProviderSvc +DEBUG|^DataModelCompatSvc +DEBUG|^AthenaOutputStreamVERBOSE|^AthenaOutputStream +DEBUG|Service base class initialized successfully|^TimelineSvc +DEBUG|DEBUG Property update for OutputLevel"
    ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
 
 atlas_add_test( FPEControlSvc_test
diff --git a/Control/AthenaServices/share/RCUSvc_test.ref b/Control/AthenaServices/share/RCUSvc_test.ref
index e33ea74377f..716d0fed487 100644
--- a/Control/AthenaServices/share/RCUSvc_test.ref
+++ b/Control/AthenaServices/share/RCUSvc_test.ref
@@ -1,18 +1,21 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/RCUSvc_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/AthenaServices/share/../share/RCUSvc_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/AthenaServices/share/../share/RCUSvc_test.txt
 JobOptionsSvc        INFO # (4,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO # (6,1): Athena::RCUSvc.HiveWhiteBoardSvc = "TestWhiteBoard"
 JobOptionsSvc        INFO Job options successfully read in from ../share/RCUSvc_test.txt
+MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
-                                          running on lxplus020.cern.ch on Mon Dec 11 13:21:55 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 15:58:17 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
+ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
diff --git a/Control/AthenaServices/src/MetaDataSvc.cxx b/Control/AthenaServices/src/MetaDataSvc.cxx
index c48f633de88..d2ec1a528fb 100644
--- a/Control/AthenaServices/src/MetaDataSvc.cxx
+++ b/Control/AthenaServices/src/MetaDataSvc.cxx
@@ -72,6 +72,7 @@ MetaDataSvc::MetaDataSvc(const std::string& name, ISvcLocator* pSvcLocator) : ::
    m_toolForClid.insert(std::pair<CLID, std::string>(1234982351, "BookkeeperTool"));
    m_toolForClid.insert(std::pair<CLID, std::string>(1107011239, "xAODMaker::TriggerMenuMetaDataTool"));
    m_toolForClid.insert(std::pair<CLID, std::string>(1115934851, "LumiBlockMetaDataTool"));
+   m_toolForClid.insert(std::pair<CLID, std::string>(1188015687, "xAODMaker::TruthMetaDataTool"));
 }
 //__________________________________________________________________________
 MetaDataSvc::~MetaDataSvc() {
@@ -408,9 +409,6 @@ StatusCode MetaDataSvc::addProxyToInputMetaDataStore(const std::string& tokenStr
    std::istringstream iss(numName);
    iss >> num;
    CLID clid = m_persToClid[className];
-   const std::string par[2] = { "SHM" , className };
-   const unsigned long ipar[2] = { num , 0 };
-   IOpaqueAddress* opqAddr = nullptr;
    if (clid == 167728019) { // EventStreamInfo, will change tool to combine input metadata, clearing things before...
       bool foundTool = false;
       for (auto iter = m_metaDataTools.begin(), iterEnd = m_metaDataTools.end(); iter != iterEnd; iter++) {
@@ -423,6 +421,7 @@ StatusCode MetaDataSvc::addProxyToInputMetaDataStore(const std::string& tokenStr
             m_incSvc->removeListener(cfSvc.get(), IncidentType::EndInputFile);
             m_incSvc->removeListener(cfSvc.get(), IncidentType::EndRun);
             m_incSvc->removeListener(cfSvc.get(), "StoreCleared");
+            m_incSvc->removeListener(cfSvc.get(), "MetaDataStop");
             cfSvc.release().ignore();
          }
          if (!m_outputDataStore->clearStore().isSuccess()) {
@@ -445,7 +444,9 @@ StatusCode MetaDataSvc::addProxyToInputMetaDataStore(const std::string& tokenStr
          }
       }
    }
-
+   const std::string par[3] = { "SHM" , keyName , className };
+   const unsigned long ipar[2] = { num , 0 };
+   IOpaqueAddress* opqAddr = nullptr;
    if (!m_addrCrtr->createAddress(m_storageType, clid, par, ipar, opqAddr).isSuccess()) {
       ATH_MSG_FATAL("addProxyToInputMetaDataStore: Cannot create address for " << tokenStr);
       return(StatusCode::FAILURE);
@@ -459,6 +460,9 @@ StatusCode MetaDataSvc::addProxyToInputMetaDataStore(const std::string& tokenStr
       ATH_MSG_FATAL("addProxyToInputMetaDataStore: Cannot access data for " << tokenStr);
       return(StatusCode::FAILURE);
    }
+   if (keyName.find("Aux.") != std::string::npos && m_inputDataStore->symLink (clid, keyName, 187169987).isFailure()) {
+      ATH_MSG_WARNING("addProxyToInputMetaDataStore: Cannot symlink to AuxStore for " << tokenStr);
+   }
    std::map<std::string, std::string>::const_iterator iter = m_streamForKey.find(keyName);
    if (iter == m_streamForKey.end()) {
       m_streamForKey.insert(std::pair<std::string, std::string>(keyName, fileName));
diff --git a/Control/AthenaServices/src/MixingEventSelector.cxx b/Control/AthenaServices/src/MixingEventSelector.cxx
index d57c36519be..bb8871af28b 100644
--- a/Control/AthenaServices/src/MixingEventSelector.cxx
+++ b/Control/AthenaServices/src/MixingEventSelector.cxx
@@ -184,7 +184,7 @@ MixingEventSelector::decodeTrigger(string triggDescr) {
 	   << selTN.type() << '/' << selTN.name() 
 	   << "] can not be found or created");
       } //selector available
-    } catch (boost::bad_lexical_cast e) {
+    } catch (const boost::bad_lexical_cast& e) {
       ATH_MSG_ERROR
 	("decodeTrigger: Can't cast ["<< *iToken 
 	 << "] to double(frequency). SKIPPING");
diff --git a/Control/AthenaServices/test/RCUSvc_test.cxx b/Control/AthenaServices/test/RCUSvc_test.cxx
index b6e21bdfad0..0c07a94b9f9 100644
--- a/Control/AthenaServices/test/RCUSvc_test.cxx
+++ b/Control/AthenaServices/test/RCUSvc_test.cxx
@@ -47,13 +47,13 @@ public:
   virtual StatusCode clearStore(size_t /*partitionIndex*/) override { std::abort(); }
   virtual StatusCode setNumberOfStores(size_t /*slots*/) override { std::abort(); }
   virtual DataObjIDColl getNewDataObjects() override { std::abort(); }
-  virtual void addNewDataObjects( DataObjIDColl& /*products*/ ){ std::abort(); }
+  virtual void addNewDataObjects( DataObjIDColl& /*products*/ ) override { std::abort(); }
   virtual bool exists( const DataObjID& ) override { std::abort(); }
   virtual size_t allocateStore( int /*evtnumber*/ ) override { std::abort(); }
   virtual StatusCode freeStore( size_t /*partitionIndex*/ ) override { std::abort(); }
   virtual size_t getPartitionNumber(int /*eventnumber*/) const override { std::abort(); }
   virtual size_t getNumberOfStores() const override { return nslots; }
-  virtual unsigned int freeSlots() override { std::abort(); }
+  virtual size_t freeSlots() override { std::abort(); }
 
 };
 
diff --git a/Control/CxxUtils/CxxUtils/ConcurrentBitset.icc b/Control/CxxUtils/CxxUtils/ConcurrentBitset.icc
index 083474666ba..1030d3ec9a0 100644
--- a/Control/CxxUtils/CxxUtils/ConcurrentBitset.icc
+++ b/Control/CxxUtils/CxxUtils/ConcurrentBitset.icc
@@ -415,11 +415,11 @@ ConcurrentBitset& ConcurrentBitset::insert (bit_t bit, bit_t new_nbits /*= 0*/)
  @endcode
 */
 template <class ITERATOR,
-          typename = typename std::enable_if<
+          typename /*= typename std::enable_if<
             std::is_base_of<
               typename std::forward_iterator_tag,
               typename std::iterator_traits<ITERATOR>::iterator_category
-              >::value> >
+              >::value>*/ >
 inline
 ConcurrentBitset&
 ConcurrentBitset::insert (ITERATOR beg, ITERATOR end, bit_t new_nbits /*= 0*/)
diff --git a/Control/CxxUtils/Root/ClassName.cxx b/Control/CxxUtils/Root/ClassName.cxx
index e13a7e89f78..a63f740274f 100644
--- a/Control/CxxUtils/Root/ClassName.cxx
+++ b/Control/CxxUtils/Root/ClassName.cxx
@@ -12,7 +12,6 @@
 
 
 #include "CxxUtils/ClassName.h"
-#include "boost/foreach.hpp"
 #include <cassert>
 
 
@@ -261,7 +260,7 @@ std::string ClassName::fullName() const
     name = "const " + name;
   if (m_targs.size() > 0) {
     name += '<';
-    BOOST_FOREACH (const ClassName& cn, m_targs) {
+    for (const ClassName& cn : m_targs) {
       if (name[name.size()-1] != '<')
         name += ',';
       name += cn.fullName();
@@ -355,9 +354,9 @@ void ClassName::subst (const match_t& matches)
     }
   }
 
-  BOOST_FOREACH (ClassName& c, m_namespace)
+  for (ClassName& c : m_namespace)
     c.subst (matches);
-  BOOST_FOREACH (ClassName& c, m_targs)
+  for (ClassName& c : m_targs)
     c.subst (matches);
 }
 
diff --git a/Control/CxxUtils/test/ConcurrentBitset_test.cxx b/Control/CxxUtils/test/ConcurrentBitset_test.cxx
index 2bc6a61a8e5..eb8f9535b78 100644
--- a/Control/CxxUtils/test/ConcurrentBitset_test.cxx
+++ b/Control/CxxUtils/test/ConcurrentBitset_test.cxx
@@ -13,6 +13,7 @@
 
 #undef NDEBUG
 #include "CxxUtils/ConcurrentBitset.h"
+#include "CxxUtils/checker_macros.h"
 #include "TestTools/random.h"
 #include "tbb/concurrent_unordered_set.h"
 #include "boost/timer/timer.hpp"
@@ -762,7 +763,8 @@ public:
 
   bool test (size_t id) const
   {
-    return ck_hs_get (const_cast<ck_hs_t*>(&m_hs), id, reinterpret_cast<const void*> (id)) != nullptr;
+    ck_hs_t* hs ATLAS_THREAD_SAFE = const_cast<ck_hs_t*>(&m_hs);
+    return ck_hs_get (hs, id, reinterpret_cast<const void*> (id)) != nullptr;
   }
 
 
diff --git a/Control/CxxUtils/test/copy_bounded_test.cxx b/Control/CxxUtils/test/copy_bounded_test.cxx
index 22dcdfef664..751e69c8555 100644
--- a/Control/CxxUtils/test/copy_bounded_test.cxx
+++ b/Control/CxxUtils/test/copy_bounded_test.cxx
@@ -17,7 +17,6 @@
 #ifndef XAOD_STANDALONE
 
 #include "CxxUtils/copy_bounded.h"
-#include "boost/foreach.hpp"
 #include "boost/range/iterator_range.hpp"
 #include "boost/range/algorithm/fill.hpp"
 #include <vector>
@@ -65,43 +64,43 @@ void test1b (InputRange& input, OutputRange& output)
   boost::iterator_range<OutputIterator> rangeo (bego, mido);
 
   int i = 0;
-  BOOST_FOREACH (value_type& it, input)
+  for (value_type& it : input)
     it = i++;
 
   boost::range::fill (output, 0);
   CxxUtils::copy_bounded (begi, endi, bego, mido);
   i = 0;
-  BOOST_FOREACH (value_type& it, output)
+  for (value_type& it : output)
     assert (it == (i < 5 ? i++ : 0));
 
   boost::range::fill (output, 0);
   CxxUtils::copy_bounded (input, rangeo);
   i = 0;
-  BOOST_FOREACH (value_type& it, output)
+  for (value_type& it : output)
     assert (it == (i < 5 ? i++ : 0));
 
   boost::range::fill (output, 0);
   CxxUtils::copy_bounded (begi, midi, bego, endo);
   i = 0;
-  BOOST_FOREACH (value_type& it, output)
+  for (value_type& it : output)
     assert (it == (i < 5 ? i++ : 0));
 
   boost::range::fill (output, 0);
   CxxUtils::copy_bounded (rangei, output);
   i = 0;
-  BOOST_FOREACH (value_type& it, output)
+  for (value_type& it : output)
     assert (it == (i < 5 ? i++ : 0));
 
   boost::range::fill (output, 0);
   CxxUtils::copy_bounded (begi, endi, bego, endo);
   i = 0;
-  BOOST_FOREACH (value_type& it, output)
+  for (value_type& it : output)
     assert (it == i++);
 
   boost::range::fill (output, 0);
   CxxUtils::copy_bounded (input, output);
   i = 0;
-  BOOST_FOREACH (value_type& it, output)
+  for (value_type& it : output)
     assert (it == i++);
 }
 
diff --git a/Control/DataModelAthenaPool/CMakeLists.txt b/Control/DataModelAthenaPool/CMakeLists.txt
index 2dc72e4dbf0..1243489ff92 100644
--- a/Control/DataModelAthenaPool/CMakeLists.txt
+++ b/Control/DataModelAthenaPool/CMakeLists.txt
@@ -40,12 +40,6 @@ atlas_add_component( DataModelAthenaPool
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers AthLinks AthenaBaseComps AthenaKernel Navigation RootUtils RootUtilsPyROOT GaudiKernel TestTools SGTools AthenaPoolCnvSvcLib AthenaPoolUtilities RootConversions DataModelAthenaPoolLib )
 
-atlas_add_poolcnv_library( DataModelAthenaPoolPoolCnv
-                           src/*.cxx
-                           FILES AthContainers/UserDataStore.h
-                           INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                           LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers AthLinks AthenaBaseComps AthenaKernel Navigation RootUtils RootUtilsPyROOT GaudiKernel TestTools SGTools AthenaPoolCnvSvcLib AthenaPoolUtilities RootConversions DataModelAthenaPoolLib )
-
 atlas_add_dictionary( DataModelAthenaPoolDictDict
                       DataModelAthenaPool/DataModelAthenaPoolDict.h
                       DataModelAthenaPool/selection.xml
diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/DataModelAthenaPoolDict.h b/Control/DataModelAthenaPool/DataModelAthenaPool/DataModelAthenaPoolDict.h
index b10f2baaaac..88be54b8c6b 100755
--- a/Control/DataModelAthenaPool/DataModelAthenaPool/DataModelAthenaPoolDict.h
+++ b/Control/DataModelAthenaPool/DataModelAthenaPool/DataModelAthenaPoolDict.h
@@ -22,7 +22,6 @@
 #include "DataModelAthenaPool/CLHEPConverters.h"
 #include "DataModelAthenaPool/PackedContainerConverter.h"
 #include "DataModelAthenaPool/AthenaBarCode_p1.h"
-#include "DataModelAthenaPool/UserDataStore_p1.h"
 
 
 namespace {
@@ -63,9 +62,6 @@ namespace {
      std::vector<ElementLinkStr_p2> m_elLinkStr_p2;
 
      AthenaBarCode_p1 m_abcp1;
-
-     UserDataStore_p1 m_UDSp1;
-     UDSLabelHashTable_p1 m_UDSLabels_p1;
    };
 
    
diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/UDSLabelHashTableCnv_p1.h b/Control/DataModelAthenaPool/DataModelAthenaPool/UDSLabelHashTableCnv_p1.h
deleted file mode 100644
index f13cd9cc5f9..00000000000
--- a/Control/DataModelAthenaPool/DataModelAthenaPool/UDSLabelHashTableCnv_p1.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//Dear emacs, this is -*-c++-*-
-#ifndef UDSLABELHASHTABLECNV_P1
-#define UDSLABELHASHTABLECNV_P1
-
-class UDSLabelHashTable;
-class UDSLabelHashTable_p1;
-
-/** @class UDSLabelHashTableCnv_p1
- *  @brief T/P converter class for UDSLabelHashTable used by UserDataStore
- */
-
-class UDSLabelHashTableCnv_p1 {
- public:
-  void transToPers(const UDSLabelHashTable& trans, UDSLabelHashTable_p1& pers);
-  void persToTrans(const UDSLabelHashTable_p1& pers, UDSLabelHashTable& trans);
-};
-
-#endif
diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/UDSLabelHashTable_p1.h b/Control/DataModelAthenaPool/DataModelAthenaPool/UDSLabelHashTable_p1.h
deleted file mode 100644
index 1d85a60cf2c..00000000000
--- a/Control/DataModelAthenaPool/DataModelAthenaPool/UDSLabelHashTable_p1.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//dear emacs, this is -*-c++-*-
-#ifndef USDLABELHASHTABLE_P1_H
-#define USDLABELHASHTABLE_P1_H
-
-#include <vector>
-#include <string>
-
-
-/** @class UDSLabelHashTable_p1
- *  @brief Persistent representation of the UDSLabelHashTable class used by UserDataStore
- **/
- 
-class UDSLabelHashTable_p1 {
- public:
-  typedef uint32_t hash_t;
-  //Hash-to-label association
-  std::vector<std::string> m_label;
-  std::vector<hash_t> m_labelHash;
-
-};
-
-
-#endif
diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/UserDataStoreCnv_p1.h b/Control/DataModelAthenaPool/DataModelAthenaPool/UserDataStoreCnv_p1.h
deleted file mode 100644
index ef2f0c92128..00000000000
--- a/Control/DataModelAthenaPool/DataModelAthenaPool/UserDataStoreCnv_p1.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//Dear emacs, this is -*-c++-*-
-
-#ifndef USERDATASTORECNV_P1
-#define USERDATASTORECNV_P1
-
-#include "AthContainers/UserDataStore.h"
-#include "DataModelAthenaPool/UserDataStore_p1.h"
-#include "DataModelAthenaPool/UDSLabelHashTableCnv_p1.h"
-
-
-/** @class UserDataStoreObjCnv_p1
- *  @brief T/P converter for UserDataStoreObj
- **/
-
-class UserDataStoreCnv_p1 {
-public:
-  void persToTrans(const UserDataStore_p1& persObj, UserDataStore& transObj,MsgStream& mLog);
-
-  void transToPers(const UserDataStore& transObj, UserDataStore_p1& persObj,MsgStream& mLog);
-
-private:
-  UDSLabelHashTableCnv_p1 m_labelCnv;
-
-  typedef UserDataStore::mapmap_t mapmap_t;
-
-  enum TYPES {
-    UINT=0,
-    INT,
-    FLOAT,
-    DOUBLE,
-    VUINT,
-    VINT,
-    VFLOAT,
-    VDOUBLE,
-    BOOL
-  };
-
-};
-
-
-#endif
-
diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/UserDataStore_p1.h b/Control/DataModelAthenaPool/DataModelAthenaPool/UserDataStore_p1.h
deleted file mode 100644
index 226b600dca5..00000000000
--- a/Control/DataModelAthenaPool/DataModelAthenaPool/UserDataStore_p1.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//Dear emacs, this is -*-c++-*-
-
-#ifndef USERDATASTOREOBJ_P1
-#define USERDATASTOREOBJ_P1
-
-
-
-#include "DataModelAthenaPool/UDSLabelHashTable_p1.h"
-
-/** @class UserDataStoreObj_p1
- *  @brief T/P converter class for UserDataStoreObj
- */
-
-class UserDataStore_p1: public UDSLabelHashTable_p1 {
- public:
-
-  uint64_t m_eventABC;
-  
-  //Values in mapmap
-  std::vector<uint64_t> m_barcode;
-  std::vector<uint32_t> m_hash;
-  std::vector<uint16_t> m_valuesPerABC;
-  std::vector<uint16_t> m_vecSize;
-  std::vector<uint32_t> m_values;
-  std::vector<uint8_t>  m_type;
-
-};
-
-
-#endif
diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/selection.xml b/Control/DataModelAthenaPool/DataModelAthenaPool/selection.xml
index 509e916dba7..9662509e87d 100755
--- a/Control/DataModelAthenaPool/DataModelAthenaPool/selection.xml
+++ b/Control/DataModelAthenaPool/DataModelAthenaPool/selection.xml
@@ -66,10 +66,4 @@
   <function name="DataModelAthenaPool::installPackedContainerConverters"/>
 
   <class name="AthenaBarCode_p1" />
-
-  <class name="UserDataStore_p1" id="1D3E6FC1-54CD-4239-9714-9C467160F3FA"/>
-
-  <class name="UDSLabelHashTable_p1" />
-
-
 </lcgdict>
diff --git a/Control/DataModelAthenaPool/src/UDSLabelHashTableCnv_p1.cxx b/Control/DataModelAthenaPool/src/UDSLabelHashTableCnv_p1.cxx
deleted file mode 100644
index 3afad050f6d..00000000000
--- a/Control/DataModelAthenaPool/src/UDSLabelHashTableCnv_p1.cxx
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "AthContainers/tools/UDSLabelHashTable.h"
-#include "DataModelAthenaPool/UDSLabelHashTable_p1.h"
-#include "DataModelAthenaPool/UDSLabelHashTableCnv_p1.h"
-
-void UDSLabelHashTableCnv_p1::transToPers(const UDSLabelHashTable& trans, UDSLabelHashTable_p1& pers) {
-  const size_t s=trans.size();
-  pers.m_label.resize(s);
-  pers.m_labelHash.resize(s);
-  for (const auto& p : trans) {
-    pers.m_labelHash.push_back(p.first);
-    pers.m_label.push_back(p.second);
-  }
-  return;
-}
-
-
-void UDSLabelHashTableCnv_p1::persToTrans(const UDSLabelHashTable_p1& pers, UDSLabelHashTable& trans){
-  const size_t s=pers.m_labelHash.size();
-  for (size_t i=0;i<s;++i) {
-    trans.addLabel (pers.m_label[i], pers.m_labelHash[i]);
-  }
-}
diff --git a/Control/DataModelAthenaPool/src/UserDataStoreCnv.cxx b/Control/DataModelAthenaPool/src/UserDataStoreCnv.cxx
deleted file mode 100644
index 0310afd6ae9..00000000000
--- a/Control/DataModelAthenaPool/src/UserDataStoreCnv.cxx
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "UserDataStoreCnv.h"
-
-
-UserDataStoreCnv::UserDataStoreCnv(ISvcLocator* svcloc) : 
-  T_AthenaPoolCustomCnv<UserDataStore, UserDataStore_p1 >( svcloc),
-  m_converterP1(),
-  m_guidP1("1D3E6FC1-54CD-4239-9714-9C467160F3FA"),
-  m_log(msgSvc(), "UserDataStoreCnv")
-{}
-
-
-UserDataStore_p1* UserDataStoreCnv::createPersistent(UserDataStore* transObj) {
-
-  UserDataStore_p1* pers=new UserDataStore_p1();
-  m_converterP1.transToPers(*transObj,*pers,m_log);
-  return pers;
-}
-
-
-
-UserDataStore* UserDataStoreCnv::createTransient () {
-
-  UserDataStore* trans=0;
-
-  if (compareClassGuid(m_guidP1)) {
-    if (m_log.level() <= MSG::DEBUG) m_log << MSG::DEBUG << "Reading version UserDataStore_p1" << endmsg;
-    trans=new UserDataStore();
-    UserDataStore_p1* pers=poolReadObject<UserDataStore_p1>();
-    m_converterP1.persToTrans(*pers,*trans,m_log);
-    if (m_log.level() <= MSG::DEBUG) m_log << MSG::DEBUG << "Done converting UserDataStore_p1 to UserDataStore" << endmsg;
-    delete pers;
-  }
-  else {
-    m_log << MSG::ERROR << "Unsupported persistent version of UserDataSvc GUID=" << m_classID.toString() << endmsg;
-    //throw std::runtime_error("Unsupported persistent version of UserDataSvc");
-  }
-  return trans;
-}
diff --git a/Control/DataModelAthenaPool/src/UserDataStoreCnv.h b/Control/DataModelAthenaPool/src/UserDataStoreCnv.h
deleted file mode 100644
index 66c40dd8473..00000000000
--- a/Control/DataModelAthenaPool/src/UserDataStoreCnv.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//Dear emacs, this is -*-c++-*-
-#ifndef USERDATASTORECNV_H
-#define USERDATASTORECNV_H
-
-
-#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
-#include "DataModelAthenaPool/UserDataStoreCnv_p1.h"
-#include "AthContainers/UserDataStore.h"
-#include "GaudiKernel/MsgStream.h"
-
-/** @class UserDataStoreCnv 
- *  @brief Top-Level T/P converter for UserDataStore object
- **/
-	
-class UserDataStoreCnv  : public T_AthenaPoolCustomCnv<UserDataStore, UserDataStore_p1 > {
-  friend class CnvFactory<UserDataStoreCnv>;
-
- protected:
-  UserDataStoreCnv(ISvcLocator* svcloc);
-  UserDataStore_p1*  createPersistent(UserDataStore* transCont);
-  UserDataStore*     createTransient ();
-
- private:
-    UserDataStoreCnv_p1 m_converterP1;
-    pool::Guid m_guidP1;
-    MsgStream m_log;
-
-};	
-
-#endif
diff --git a/Control/DataModelAthenaPool/src/UserDataStoreCnv_p1.cxx b/Control/DataModelAthenaPool/src/UserDataStoreCnv_p1.cxx
deleted file mode 100644
index 080b35e0a38..00000000000
--- a/Control/DataModelAthenaPool/src/UserDataStoreCnv_p1.cxx
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "DataModelAthenaPool/UserDataStoreCnv_p1.h"
-#include <cxxabi.h>
-
-void
-UserDataStoreCnv_p1::transToPers(const UserDataStore& transObj, UserDataStore_p1& persObj,MsgStream& mLog) {
-
-  persObj.m_eventABC=transObj.m_eventABC;
-
-  m_labelCnv.transToPers(transObj.m_labelTable,persObj);
-
-  persObj.m_barcode.reserve(transObj.m_data.size());
-  persObj.m_valuesPerABC.reserve(transObj.m_data.size());
-
-  const size_t maxUserData=transObj.m_data.size()*transObj.m_labelTable.size(); //maximum size, could be too large
-  persObj.m_hash.reserve(maxUserData);
-  persObj.m_type.reserve(maxUserData);
-  persObj.m_vecSize.reserve(maxUserData);
-  persObj.m_values.reserve(5*maxUserData);
-
-  union {
-    uint32_t uint;
-    int32_t  sint;
-    float    flt;
-  } toUint;
-
-
-  mapmap_t::const_iterator itObj=transObj.m_data.begin();
-  mapmap_t::const_iterator itObj_e=transObj.m_data.end();
-  for (;itObj!=itObj_e;++itObj) {
-    const AthenaBarCode_t& abc=itObj->first;
-    typedef std::map<uint32_t, boost::any> varmap_t;
-    const varmap_t& variableMap=itObj->second;
-    varmap_t::const_iterator itVar=variableMap.begin();
-    varmap_t::const_iterator itVar_e=variableMap.end();
-    persObj.m_barcode.push_back(abc);
-    persObj.m_valuesPerABC.push_back(variableMap.size());
-    for (;itVar!=itVar_e;++itVar) {
-      persObj.m_hash.push_back(itVar->first);
-      const boost::any& payload=itVar->second;
-      const std::type_info& ty=payload.type(); 
-
-      //Case: uint32_t
-      if (ty==typeid(uint32_t)) {
-	const uint32_t v=boost::any_cast<uint32_t>(payload);
-	persObj.m_vecSize.push_back(1);
-	persObj.m_type.push_back(UINT);
-	persObj.m_values.push_back(v);
-      }
-      //Case: vector of uint32_t
-      else if (ty==typeid(std::vector<uint32_t>)) {
-	const std::vector<uint32_t>& v=boost::any_cast<std::vector<uint32_t> > (payload);
-	persObj.m_vecSize.push_back(v.size());
-	persObj.m_type.push_back(VUINT);
-	const size_t ptr=persObj.m_values.size();
-	persObj.m_values.resize(persObj.m_values.size()+v.size());
-	memcpy(&(persObj.m_values[ptr]),&(v[0]),v.size()*sizeof(uint32_t));
-	//persObj.m_values.insert(persObj.m_values.end(),v.begin(),v.end());
-	//std::vector<uint32_t>::const_iterator it=v.begin();
-	//std::vector<uint32_t>::const_iterator it_e=v.end();
-	//for (;it!=it_e;++it) {
-	//  persObj.m_values.push_back(*it);
-	//}
-      }
-      //Case: signed int
-      else if (ty==typeid(int32_t)) {
-	toUint.sint=boost::any_cast<int32_t>(payload);
-	persObj.m_vecSize.push_back(1);
-	persObj.m_type.push_back(INT);
-	persObj.m_values.push_back(toUint.uint); 
-      }
-      //Case: bool
-      else if (ty==typeid(bool)) {
-	const bool b=boost::any_cast<bool>(payload);
-	persObj.m_vecSize.push_back(1);
-	persObj.m_type.push_back(BOOL);
-	persObj.m_values.push_back((uint32_t)b);
-      }
-      //Case: vector of signed int
-      else if (ty==typeid(std::vector<int32_t>)) {
-	const std::vector<int32_t>& v=boost::any_cast<std::vector<int32_t> >(payload);
-	persObj.m_vecSize.push_back(v.size());
-	persObj.m_type.push_back(VINT);
-	const size_t ptr=persObj.m_values.size();
-	persObj.m_values.resize(persObj.m_values.size()+v.size());
-	memcpy(&(persObj.m_values[ptr]),&(v[0]),v.size()*sizeof(int32_t));
-// 	std::vector<int32_t>::const_iterator it=v.begin();
-// 	std::vector<int32_t>::const_iterator it_e=v.end();
-// 	for (;it!=it_e;++it) {
-// 	  toUint.sint=*it;
-// 	  persObj.m_values.push_back(toUint.uint);
-// 	}
-      }
-      //Case float 
-      else if (ty==typeid(float)) {
-	persObj.m_vecSize.push_back(1);
-	persObj.m_type.push_back(FLOAT);
-	toUint.flt=boost::any_cast<float>(payload);
-	persObj.m_values.push_back(toUint.uint);
-      }
-      //Case double 
-      else if (ty==typeid(double)) {
-	persObj.m_vecSize.push_back(1);
-	persObj.m_type.push_back(DOUBLE);
-	toUint.flt=boost::any_cast<double>(payload);
-	persObj.m_values.push_back(toUint.uint);
-      }
-      //Case vector of float
-      else if (ty==typeid(std::vector<float>)) {
-	const std::vector<float>& v=boost::any_cast<std::vector<float> >(payload);
-	persObj.m_vecSize.push_back(v.size());
-	persObj.m_type.push_back(VFLOAT);
-	const size_t ptr=persObj.m_values.size();
-	persObj.m_values.resize(persObj.m_values.size()+v.size());
-	memcpy(&(persObj.m_values[ptr]),&(v[0]),v.size()*sizeof(float));
-	//void* destPtr=&(*persObj.m_values.back())
-	//std::vector<float>::const_iterator it=v.begin();
-	//std::vector<float>::const_iterator it_e=v.end();
-	
-// 	for (;it!=it_e;++it) {
-// 	  toUint.flt=*it; 
-// 	  persObj.m_values.push_back(toUint.uint);
-// 	}
-      }
-      //Case vector of double
-      else if (ty==typeid(std::vector<double>)) {
-	const std::vector<double>& v=boost::any_cast<std::vector<double> >(payload);
-	persObj.m_vecSize.push_back(v.size());
-	persObj.m_type.push_back(VDOUBLE);
-	std::vector<double>::const_iterator it=v.begin();
-	std::vector<double>::const_iterator it_e=v.end();
-	for (;it!=it_e;++it) {
-	  toUint.flt=*it; //cast double to float
-	  persObj.m_values.push_back(toUint.uint);
-	}
-      }
-      else {
-	//Can't deal with this type 
-	int stat;
-	char * tyNameS = abi::__cxa_demangle(ty.name(), 0, 0, &stat);
-	std::string tyName;
-	if (stat || tyNameS==NULL) 
-	  tyName="<Can't demangle type id>";
-	else
-	  tyName=tyNameS;
-
-	free(tyNameS);
-	mLog << MSG::ERROR << "while writing out UserData label " << transObj.m_labelTable.getLabel(itVar->first) 
-	     <<": The type " << tyName << " is not supported." << endmsg;
-      }
-    }// end loop over variables
-  }// end loop over objects (barcodes)
-}
-
-
-void
-UserDataStoreCnv_p1::persToTrans(const UserDataStore_p1& persObj, UserDataStore& transObj, MsgStream& mLog) {
-
-  transObj.m_eventABC=persObj.m_eventABC;
-
-  m_labelCnv.persToTrans(persObj,transObj.m_labelTable);
-  size_t idxABC=0;
-  size_t idxVec=0;
-  size_t idxValue=0;
-  std::map<uint32_t, boost::any > emptyMap;
-
-  const size_t nABC=persObj.m_barcode.size();
-  if (nABC!=persObj.m_valuesPerABC.size()) {
-    //ERROR
-    return;
-  }
-
-  union {
-    uint32_t uint;
-    int32_t  sint;
-    float    flt;
-  } toUint;
-
-
-  for (;idxABC<nABC;++idxABC) {
-    const AthenaBarCode_t abc=persObj.m_barcode[idxABC];
-    const size_t nval=persObj.m_valuesPerABC[idxABC];
-    mapmap_t::iterator abcIt=transObj.m_data.insert(transObj.m_data.end(),mapmap_t::value_type(abc,emptyMap));
-    std::map<uint32_t, boost::any>& valmap=abcIt->second; 
-    for (size_t i=0;i<nval;++i,++idxVec) {
-      const size_t s=persObj.m_vecSize[idxVec];
-      const uint32_t valhash=persObj.m_hash[idxVec];
-      const uint8_t ty=persObj.m_type[idxVec];
-      if (ty==UINT) {
-	  const uint32_t v=persObj.m_values[idxValue];
-	  ++idxValue;
-	  valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any(v)));
-      }
-      else if (ty==VUINT) {
-	std::vector<uint32_t> vec(s);
-	memcpy(&(vec[0]),&(persObj.m_values[idxValue]),s*sizeof(uint32_t));
-	idxValue+=s;
-	//vec.reserve(s);
-	//for (unsigned j=0;j<s;++j,++idxValue)
-	//  vec.push_back(persObj.m_values[idxValue]);
-	valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any(vec)));
-      }
-      else if (ty==INT) {
-	toUint.uint=persObj.m_values[idxValue];
-	++idxValue;
-	valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any(toUint.sint)));
-      }
-      else if (ty==BOOL) {
-	const bool b=persObj.m_values[idxValue];
-	++idxValue;
-	valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any(b)));
-      }
-      else if (ty==VINT) {
-	std::vector<int32_t> vec(s);
-	memcpy(&(vec[0]),&(persObj.m_values[idxValue]),s*sizeof(uint32_t));
-	idxValue+=s;
-	//vec.reserve(s);
-	//std::cout << "Reading vector<int32_t> of size " << s << std::endl;
-	//for (unsigned j=0;j<s;++j,++idxValue) {
-	//  toUint.uint=persObj.m_values[idxValue];
-	//  vec.push_back(toUint.sint);
-	//}
-	valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any(vec)));
-      }
-      else if (ty==FLOAT) {
-	toUint.uint=persObj.m_values[idxValue];
-	++idxValue;
-	valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any(toUint.flt)));
-      }
-      else if (ty==VFLOAT) {
-	std::vector<float> vec(s);
-	memcpy(&(vec[0]),&(persObj.m_values[idxValue]),s*sizeof(uint32_t));
-	idxValue+=s;
-
-	//vec.reserve(s);
-	//for (unsigned j=0;j<s;++j,++idxValue) {
-	//  toUint.uint=persObj.m_values[idxValue];
-	//  vec.push_back(toUint.flt);
-	//	}
-	valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any(vec)));
-      }
-      else if (ty==DOUBLE) {
-	toUint.uint=persObj.m_values[idxValue];
-	++idxValue;
-	valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any((double)toUint.flt)));
-      }
-      else if (ty==VDOUBLE) {
-	std::vector<double> vec;
-	vec.reserve(s);
-	for (unsigned j=0;j<s;++j,++idxValue) {
-	  toUint.uint=persObj.m_values[idxValue];
-	  vec.push_back(toUint.flt);
-	}
-	valmap.insert(valmap.end(),std::pair<uint32_t,boost::any>(valhash,boost::any(vec)));
-      }
-      else {
-       	mLog << MSG::ERROR << "while reading in  UserData label " << transObj.m_labelTable.getLabel(valhash) 
-	     <<": Encountered unsupported type (" <<  ty << ")" << endmsg;
-      }// end-else
-
-    }//end loop over attributes (=hashes)
-  }//end loop over barcodes
-}
-
diff --git a/Control/DataModelTest/DataModelRunTests/share/CondReader.ref b/Control/DataModelTest/DataModelRunTests/share/CondReader.ref
index 2a3619e760b..a9a4d88c3e3 100644
--- a/Control/DataModelTest/DataModelRunTests/share/CondReader.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/CondReader.ref
@@ -1,24 +1,23 @@
-Thu Nov  2 15:55:29 EDT 2017
-WARNING: TCMALLOCDIR not defined, will use libc malloc
+Tue Jan  2 17:37:06 PST 2018
+Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [?-21.0.0] [i686-slc5-gcc43-dbg] [?/?] -- built on [?]
+Py:Athena            INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [dev/3227fd4b6f] -- built on [2018-01-02T1642]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "DataModelRunTests/CondReader_jo.py"
 Py:Athena            INFO including file "AthenaPoolCnvSvc/AthenaPool_jobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 467 configurables from 2 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5430 configurables from 7 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
-EventInfoMgtInit: Got release version  sss-rel_0
+[?1034hEventInfoMgtInit: Got release version  Athena-22.0.0
 Py:IOVDbSvc.CondDB    INFO Setting up conditions DB access to instance OFLP200
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-# setting LC_ALL to "C"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
-                                          running on karma on Thu Nov  2 15:55:58 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 17:37:22 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
@@ -26,49 +25,51 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 9012 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 3106 CLIDRegistry entries for module ALL
 ChronoStatSvc        INFO  Number of skipped events for MemStat-1
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 372 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 719 CLIDRegistry entries for module ALL
 CondInputLoader      INFO Initializing CondInputLoader...
 MetaDataSvc          INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00
 AthenaPoolCnvSvc     INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc         INFO Read replica configuration from /home/sss/atlas/dvtest/build/share/dbreplica.config
+DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(proxyurl=http://msquid01-ib.nersc.gov:3128)(proxyurl=http://msquid02-ib.nersc.gov:3128) will be considered for COOL data
+DBReplicaSvc         INFO Read replica configuration from /bld2/build/v30r1.002/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
 DBReplicaSvc         INFO No specific match for domain found - use default fallback
-DBReplicaSvc         INFO Total of 1 servers found for host karma [atlas_dd ]
+DBReplicaSvc         INFO Total of 2 servers found for host zeus [ATLF atlas_dd ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc              INFO Setting up APR FileCatalog and Streams
-PoolSvc              INFO Resolved path (via DATAPATH) is /home/sss/atlas/DBRelease/current/poolcond/PoolCat_oflcond.xml
-PoolSvc              INFO Resolved path (via DATAPATH) is /home/sss/atlas/DBRelease/current/poolcond/PoolCat_oflcond.xml
-PoolSvc           WARNING Unable to locate catalog for apcfile:poolcond/PoolFileCatalog.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
+PoolSvc           WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
+PoolSvc           WARNING Unable to locate catalog for apcfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
+PoolSvc              INFO Resolved path (via ATLAS_POOLCOND_PATH) is /cvmfs/atlas-condb.cern.ch/repo/conditions/poolcond/PoolFileCatalog.xml
 PoolSvc              INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml
 DbSession            INFO     Open     DbSession    
 Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
 IOVDbSvc             INFO Opened read transaction for POOL PersistencySvc
 IOVDbSvc             INFO Only 5 POOL conditions files will be open at once
+IOVDbSvc             INFO Cache alignment will be done in 3 slices
 IOVDbSvc             INFO Read from meta data only for folder /TagInfo
 IOVDbSvc             INFO Initialised with 2 connections and 3 folders
 IOVDbSvc             INFO Service IOVDbSvc initialised successfully
 IOVDbSvc             INFO preLoadAddresses: Removing folder /TagInfo. It should only be in the file meta data and was not found.
 IOVDbSvc             INFO Opening COOL connection for sqlite://;schema=condtest.db;dbname=OFLP200
-ClassIDSvc           INFO  getRegistryEntries: read 837 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1233 CLIDRegistry entries for module ALL
 IOVSvc               INFO No IOVSvcTool associated with store "StoreGateSvc"
 IOVSvcTool           INFO IOVRanges will be checked at every Event
 IOVDbSvc             INFO Disconnecting from sqlite://;schema=condtest.db;dbname=OFLP200
 IOVDbSvc             INFO Added taginfo remove for /DMTest/S2
 IOVDbSvc             INFO Added taginfo remove for /DMTest/TestAttrList
 CondInputLoader      INFO Adding base classes:
-  + ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList')  ->
-  + ('DMTest::S2','ConditionStore+/DMTest/S2')  -> DMTest::S1 (243020043)
+  +  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )   ->
+  +  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )   -> DMTest::S1 (243020043)
 CondInputLoader      INFO Will create WriteCondHandle dependencies for the following DataObjects:
-    + ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList')
-    + ('DMTest::S1','ConditionStore+/DMTest/S2')
-    + ('DMTest::S2','ConditionStore+/DMTest/S2')
+    +  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' ) 
+    +  ( 'DMTest::S1' , 'ConditionStore+/DMTest/S2' ) 
+    +  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' ) 
 HistogramPersis...WARNING Histograms saving not required.
 EventSelector        INFO  Enter McEventSelector Initialization 
 AthenaEventLoopMgr   INFO Setup EventSelector service EventSelector
@@ -81,42 +82,42 @@ EventPersistenc...   INFO Added successfully Conversion service:McCnvSvc
 AthenaEventLoopMgr   INFO   ===>>>  start of run 0    <<<===
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 EventPersistenc...   INFO Added successfully Conversion service:TagInfoMgr
-ClassIDSvc           INFO  getRegistryEntries: read 109 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 114 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #0, run #0 0 events processed so far  <<<===
 IOVDbSvc             INFO Opening COOL connection for sqlite://;schema=condtest.db;dbname=OFLP200
 IOVDbSvc             INFO Disconnecting from sqlite://;schema=condtest.db;dbname=OFLP200
 DbSession            INFO     Open     DbSession    
 Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
-Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO                           condtest.pool.root
 RootDatabase.open    INFO condtest.pool.root File version:60806
-ClassIDSvc           INFO  getRegistryEntries: read 711 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 35 CLIDRegistry entries for module ALL
 DMTest::CondRea...   INFO Event 0 LBN 0
 DMTest::CondRea...   INFO   xint xint (int) : 10
 DMTest::CondRea...   INFO   scond 1000
 DMTest::CondRea...   INFO   s2 0
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #0 1 events processed so far  <<<===
 condtest.pool.root   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #0 1 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,1,t:0,l:0,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,1,t:0,l:0,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,1,t:0,l:0,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,1,t:0,l:0,b:4294967295]
 DMTest::CondRea...   INFO Event 1 LBN 0
 DMTest::CondRea...   INFO   xint xint (int) : 10
 DMTest::CondRea...   INFO   scond 1000
 DMTest::CondRea...   INFO   s2 0
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #0 2 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #2, run #0 2 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,2,t:0,l:1,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,2,t:0,l:1,b:4294967295]
 DMTest::CondRea...   INFO Event 2 LBN 1
 DMTest::CondRea...   INFO   xint xint (int) : 20
 DMTest::CondRea...   INFO   scond 2000
 DMTest::CondRea...   INFO   s2 0
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #0 3 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #3, run #0 3 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,3,t:0,l:1,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,3,t:0,l:1,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,3,t:0,l:1,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,3,t:0,l:1,b:4294967295]
 DMTest::CondRea...   INFO Event 3 LBN 1
 DMTest::CondRea...   INFO   xint xint (int) : 20
 DMTest::CondRea...   INFO   scond 2000
@@ -125,7 +126,7 @@ AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #0 4 events pr
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #4, run #0 4 events processed so far  <<<===
 DbSession            INFO     Open     DbSession    
 Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
-Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO                           condtest.pool.root
 RootDatabase.open    INFO condtest.pool.root File version:60806
 DMTest::CondRea...   INFO Event 4 LBN 2
@@ -134,26 +135,26 @@ DMTest::CondRea...   INFO   scond 3000
 DMTest::CondRea...   INFO   s2 100
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #0 5 events processed so far  <<<===
 condtest.pool.root   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #5, run #0 5 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,5,t:0,l:2,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,5,t:0,l:2,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,5,t:0,l:2,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,5,t:0,l:2,b:4294967295]
 DMTest::CondRea...   INFO Event 5 LBN 2
 DMTest::CondRea...   INFO   xint xint (int) : 30
 DMTest::CondRea...   INFO   scond 3000
 DMTest::CondRea...   INFO   s2 100
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #5, run #0 6 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #6, run #0 6 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,6,t:0,l:3,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,6,t:0,l:3,b:4294967295]
 DMTest::CondRea...   INFO Event 6 LBN 3
 DMTest::CondRea...   INFO   xint xint (int) : 40
 DMTest::CondRea...   INFO   scond 4000
 DMTest::CondRea...   INFO   s2 100
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #6, run #0 7 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #7, run #0 7 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,7,t:0,l:3,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,7,t:0,l:3,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,7,t:0,l:3,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,7,t:0,l:3,b:4294967295]
 DMTest::CondRea...   INFO Event 7 LBN 3
 DMTest::CondRea...   INFO   xint xint (int) : 40
 DMTest::CondRea...   INFO   scond 4000
@@ -162,7 +163,7 @@ AthenaEventLoopMgr   INFO   ===>>>  done processing event #7, run #0 8 events pr
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #8, run #0 8 events processed so far  <<<===
 DbSession            INFO     Open     DbSession    
 Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
-Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO                           condtest.pool.root
 RootDatabase.open    INFO condtest.pool.root File version:60806
 DMTest::CondRea...   INFO Event 8 LBN 4
@@ -171,26 +172,26 @@ DMTest::CondRea...   INFO   scond 5000
 DMTest::CondRea...   INFO   s2 200
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #8, run #0 9 events processed so far  <<<===
 condtest.pool.root   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #9, run #0 9 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,9,t:0,l:4,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,9,t:0,l:4,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,9,t:0,l:4,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,9,t:0,l:4,b:4294967295]
 DMTest::CondRea...   INFO Event 9 LBN 4
 DMTest::CondRea...   INFO   xint xint (int) : 50
 DMTest::CondRea...   INFO   scond 5000
 DMTest::CondRea...   INFO   s2 200
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #9, run #0 10 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #10, run #0 10 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,10,t:0,l:5,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,10,t:0,l:5,b:4294967295]
 DMTest::CondRea...   INFO Event 10 LBN 5
 DMTest::CondRea...   INFO   xint xint (int) : 60
 DMTest::CondRea...   INFO   scond 6000
 DMTest::CondRea...   INFO   s2 200
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #0 11 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #11, run #0 11 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,11,t:0,l:5,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,11,t:0,l:5,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,11,t:0,l:5,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,11,t:0,l:5,b:4294967295]
 DMTest::CondRea...   INFO Event 11 LBN 5
 DMTest::CondRea...   INFO   xint xint (int) : 60
 DMTest::CondRea...   INFO   scond 6000
@@ -199,7 +200,7 @@ AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #0 12 events
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #12, run #0 12 events processed so far  <<<===
 DbSession            INFO     Open     DbSession    
 Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
-Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO                           condtest.pool.root
 RootDatabase.open    INFO condtest.pool.root File version:60806
 DMTest::CondRea...   INFO Event 12 LBN 6
@@ -208,26 +209,26 @@ DMTest::CondRea...   INFO   scond 7000
 DMTest::CondRea...   INFO   s2 300
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #0 13 events processed so far  <<<===
 condtest.pool.root   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #13, run #0 13 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,13,t:0,l:6,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,13,t:0,l:6,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,13,t:0,l:6,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,13,t:0,l:6,b:4294967295]
 DMTest::CondRea...   INFO Event 13 LBN 6
 DMTest::CondRea...   INFO   xint xint (int) : 70
 DMTest::CondRea...   INFO   scond 7000
 DMTest::CondRea...   INFO   s2 300
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #0 14 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #14, run #0 14 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,14,t:0,l:7,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,14,t:0,l:7,b:4294967295]
 DMTest::CondRea...   INFO Event 14 LBN 7
 DMTest::CondRea...   INFO   xint xint (int) : 80
 DMTest::CondRea...   INFO   scond 8000
 DMTest::CondRea...   INFO   s2 300
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #0 15 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #15, run #0 15 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,15,t:0,l:7,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,15,t:0,l:7,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,15,t:0,l:7,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,15,t:0,l:7,b:4294967295]
 DMTest::CondRea...   INFO Event 15 LBN 7
 DMTest::CondRea...   INFO   xint xint (int) : 80
 DMTest::CondRea...   INFO   scond 8000
@@ -236,7 +237,7 @@ AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #0 16 events
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #16, run #0 16 events processed so far  <<<===
 DbSession            INFO     Open     DbSession    
 Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
-Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO                           condtest.pool.root
 RootDatabase.open    INFO condtest.pool.root File version:60806
 DMTest::CondRea...   INFO Event 16 LBN 8
@@ -245,26 +246,26 @@ DMTest::CondRea...   INFO   scond 9000
 DMTest::CondRea...   INFO   s2 400
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #0 17 events processed so far  <<<===
 condtest.pool.root   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #17, run #0 17 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,17,t:0,l:8,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,17,t:0,l:8,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,17,t:0,l:8,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,17,t:0,l:8,b:4294967295]
 DMTest::CondRea...   INFO Event 17 LBN 8
 DMTest::CondRea...   INFO   xint xint (int) : 90
 DMTest::CondRea...   INFO   scond 9000
 DMTest::CondRea...   INFO   s2 400
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #0 18 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #18, run #0 18 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,18,t:0,l:9,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,18,t:0,l:9,b:4294967295]
 DMTest::CondRea...   INFO Event 18 LBN 9
 DMTest::CondRea...   INFO   xint xint (int) : 100
 DMTest::CondRea...   INFO   scond 10000
 DMTest::CondRea...   INFO   s2 400
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #0 19 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #19, run #0 19 events processed so far  <<<===
-CondInputLoader      INFO   CondObj ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList') is still valid at [0,19,t:0,l:9,b:4294967295]
-CondInputLoader      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,19,t:0,l:9,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )  is still valid at [0,19,t:0,l:9,b:4294967295]
+CondInputLoader      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,19,t:0,l:9,b:4294967295]
 DMTest::CondRea...   INFO Event 19 LBN 9
 DMTest::CondRea...   INFO   xint xint (int) : 100
 DMTest::CondRea...   INFO   scond 10000
@@ -278,9 +279,9 @@ IncidentProcAlg2     INFO Finalize
 EventSelector        INFO finalize
 IOVDbSvc             INFO Folder /DMTest/S2 (PoolRef) db-read 1/5 objs/chan/bytes 10/1/1860 ((     0.01 ))s
 IOVDbSvc             INFO Folder /DMTest/TestAttrList (AttrList) db-read 1/10 objs/chan/bytes 20/1/80 ((     0.00 ))s
-IOVDbSvc             INFO Total payload read from COOL: 1940 bytes in ((      0.01 ))s
+IOVDbSvc             INFO Total payload read from COOL: 1940 bytes in ((      0.02 ))s
 IOVDbSvc             INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: ((     0.00 ))s
-IOVDbSvc             INFO Connection sqlite://;schema=condtest.db;dbname=OFLP200 : nConnect: 2 nFolders: 2 ReadTime: ((     0.01 ))s
+IOVDbSvc             INFO Connection sqlite://;schema=condtest.db;dbname=OFLP200 : nConnect: 2 nFolders: 2 ReadTime: ((     0.02 ))s
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
 ChronoStatSvc.f...   INFO  Service finalized successfully 
diff --git a/Control/DataModelTest/DataModelRunTests/share/CondReaderMT.ref b/Control/DataModelTest/DataModelRunTests/share/CondReaderMT.ref
index 14b791ce474..8c75261ccc1 100644
--- a/Control/DataModelTest/DataModelRunTests/share/CondReaderMT.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/CondReaderMT.ref
@@ -1,7 +1,7 @@
-Thu Nov  2 15:55:29 EDT 2017
-WARNING: TCMALLOCDIR not defined, will use libc malloc
+Tue Jan  2 17:34:58 PST 2018
+Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [?-21.0.0] [i686-slc5-gcc43-dbg] [?/?] -- built on [?]
+Py:Athena            INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [dev/3227fd4b6f] -- built on [2018-01-02T1642]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
@@ -11,25 +11,24 @@ Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "DataModelRunTests/CondReaderMT_jo.py"
 Py:Athena            INFO including file "DataModelRunTests/CondReader_jo.py"
 Py:Athena            INFO including file "AthenaPoolCnvSvc/AthenaPool_jobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 467 configurables from 2 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5430 configurables from 7 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
-EventInfoMgtInit: Got release version  sss-rel_0
+[?1034hEventInfoMgtInit: Got release version  Athena-22.0.0
 Py:IOVDbSvc.CondDB    INFO Setting up conditions DB access to instance OFLP200
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-# setting LC_ALL to "C"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 MessageSvc           INFO Activating in a separate thread
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
-                                          running on karma on Thu Nov  2 15:55:58 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 17:35:14 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                                     INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                                   INFO in initialize...
 AthDictLoaderSvc                                   INFO acquired Dso-registry
-ClassIDSvc                                         INFO  getRegistryEntries: read 9454 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 3572 CLIDRegistry entries for module ALL
 ChronoStatSvc                                      INFO  Number of skipped events for MemStat-1
 CoreDumpSvc                                        INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                                        INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
@@ -39,24 +38,26 @@ AthenaPoolCnvSvc                                   INFO Initializing AthenaPoolC
 PoolSvc                                            INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc                                            INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc                                            INFO Frontier compression level set to 5
-DBReplicaSvc                                       INFO Read replica configuration from /home/sss/atlas/dvtest/build/share/dbreplica.config
+DBReplicaSvc                                       INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(proxyurl=http://msquid01-ib.nersc.gov:3128)(proxyurl=http://msquid02-ib.nersc.gov:3128) will be considered for COOL data
+DBReplicaSvc                                       INFO Read replica configuration from /bld2/build/v30r1.002/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
 DBReplicaSvc                                       INFO No specific match for domain found - use default fallback
-DBReplicaSvc                                       INFO Total of 1 servers found for host karma [atlas_dd ]
+DBReplicaSvc                                       INFO Total of 2 servers found for host zeus [ATLF atlas_dd ]
 PoolSvc                                            INFO Successfully setup replica sorting algorithm
 PoolSvc                                            INFO Setting up APR FileCatalog and Streams
-PoolSvc                                            INFO Resolved path (via DATAPATH) is /home/sss/atlas/DBRelease/current/poolcond/PoolCat_oflcond.xml
-PoolSvc                                            INFO Resolved path (via DATAPATH) is /home/sss/atlas/DBRelease/current/poolcond/PoolCat_oflcond.xml
-PoolSvc                                         WARNING Unable to locate catalog for apcfile:poolcond/PoolFileCatalog.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
+PoolSvc                                         WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
+PoolSvc                                         WARNING Unable to locate catalog for apcfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
+PoolSvc                                            INFO Resolved path (via ATLAS_POOLCOND_PATH) is /cvmfs/atlas-condb.cern.ch/repo/conditions/poolcond/PoolFileCatalog.xml
 PoolSvc                                            INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml
 DbSession                                          INFO     Open     DbSession    
 Domain[ROOT_All]                                   INFO >   Access   DbDomain     READ      [ROOT_All] 
 IOVDbSvc                                           INFO Opened read transaction for POOL PersistencySvc
 IOVDbSvc                                           INFO Only 5 POOL conditions files will be open at once
+IOVDbSvc                                           INFO Cache alignment will be done in 3 slices
 IOVDbSvc                                           INFO Read from meta data only for folder /TagInfo
 IOVDbSvc                                           INFO Initialised with 2 connections and 3 folders
 IOVDbSvc                                           INFO Service IOVDbSvc initialised successfully
-ClassIDSvc                                         INFO  getRegistryEntries: read 1155 CLIDRegistry entries for module ALL
-ClassIDSvc                                         INFO  getRegistryEntries: read 54 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 1612 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 324 CLIDRegistry entries for module ALL
 CondInputLoader                                    INFO Initializing CondInputLoader...
 IOVDbSvc                                           INFO preLoadAddresses: Removing folder /TagInfo. It should only be in the file meta data and was not found.
 IOVDbSvc                                           INFO Opening COOL connection for sqlite://;schema=condtest.db;dbname=OFLP200
@@ -66,12 +67,12 @@ IOVDbSvc                                           INFO Disconnecting from sqlit
 IOVDbSvc                                           INFO Added taginfo remove for /DMTest/S2
 IOVDbSvc                                           INFO Added taginfo remove for /DMTest/TestAttrList
 CondInputLoader                                    INFO Adding base classes:
-  + ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList')  ->
-  + ('DMTest::S2','ConditionStore+/DMTest/S2')  -> DMTest::S1 (243020043)
+  +  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' )   ->
+  +  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )   -> DMTest::S1 (243020043)
 CondInputLoader                                    INFO Will create WriteCondHandle dependencies for the following DataObjects:
-    + ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList')
-    + ('DMTest::S1','ConditionStore+/DMTest/S2')
-    + ('DMTest::S2','ConditionStore+/DMTest/S2')
+    +  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' ) 
+    +  ( 'DMTest::S1' , 'ConditionStore+/DMTest/S2' ) 
+    +  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' ) 
 ThreadPoolSvc                                      INFO no thread init tools attached
 AvalancheSchedulerSvc                              INFO Activating scheduler in a separate thread
 AvalancheSchedulerSvc                              INFO Waiting for AvalancheSchedulerSvc to activate
@@ -85,24 +86,24 @@ AvalancheSchedulerSvc                              INFO Data Dependencies for Al
   SGInputLoader
       none
   DMTest::CondReaderAlg
-    o INPUT  ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList')
-    o INPUT  ('DMTest::S1','ConditionStore+/DMTest/S2')
-    o INPUT  ('DMTest::S1','ConditionStore+scond')
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
+    o INPUT   ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' ) 
+    o INPUT   ( 'DMTest::S1' , 'ConditionStore+/DMTest/S2' ) 
+    o INPUT   ( 'DMTest::S1' , 'ConditionStore+scond' ) 
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
   CondInputLoader
-    o OUTPUT ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList')
-    o OUTPUT ('DMTest::S1','ConditionStore+/DMTest/S2')
-    o OUTPUT ('DMTest::S2','ConditionStore+/DMTest/S2')
+    o OUTPUT  ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' ) 
+    o OUTPUT  ( 'DMTest::S1' , 'ConditionStore+/DMTest/S2' ) 
+    o OUTPUT  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' ) 
   DMTest::CondAlg1
-    o INPUT  ('AthenaAttributeList','ConditionStore+/DMTest/TestAttrList')
-    o OUTPUT ('DMTest::S1','ConditionStore+scond')
-    o OUTPUT ('DMTest::S2','ConditionStore+scond')
+    o INPUT   ( 'AthenaAttributeList' , 'ConditionStore+/DMTest/TestAttrList' ) 
+    o OUTPUT  ( 'DMTest::S1' , 'ConditionStore+scond' ) 
+    o OUTPUT  ( 'DMTest::S2' , 'ConditionStore+scond' ) 
   EndIncFiringAlg
       none
   IncidentProcAlg2
       none
 AvalancheSchedulerSvc                              INFO Will attribute the following unmet INPUT dependencies to "SGInputLoader/SGInputLoader" Algorithm
-   o ('EventInfo','StoreGateSvc+McEventInfo')    required by Algorithm: 
+   o  ( 'EventInfo' , 'StoreGateSvc+McEventInfo' )     required by Algorithm: 
        * DMTest::CondReaderAlg
 PrecedenceSvc                                      INFO Assembling CF and DF task precedence rules
 PrecedenceRulesGraph                               INFO CondSvc found. DF precedence rules will be augmented with 'Conditions'
@@ -119,20 +120,20 @@ CondInputLoader                                    INFO created CondCont<AthenaA
 CondInputLoader                                    INFO created CondCont<DMTest::S2> with key 'ConditionStore+/DMTest/S2'
 ApplicationMgr                                     INFO Application Manager Started successfully
 AthenaHiveEventLoopMgr                             INFO Starting loop on events
-EventPersistencySvc                                INFO Added successfully Conversion service:McCnvSvc
+EventPersistencySvc                     0   0      INFO Added successfully Conversion service:McCnvSvc
 AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start of run 0    <<<===
 EventPersistencySvc                     0   0      INFO Added successfully Conversion service:AthenaPoolCnvSvc
 EventPersistencySvc                     0   0      INFO Added successfully Conversion service:TagInfoMgr
-ClassIDSvc                              0   0      INFO  getRegistryEntries: read 109 CLIDRegistry entries for module ALL
+ClassIDSvc                              0   0      INFO  getRegistryEntries: read 114 CLIDRegistry entries for module ALL
 AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start processing event #0, run #0 on slot 0,  0 events processed so far  <<<===
 IOVDbSvc                                0   0      INFO Opening COOL connection for sqlite://;schema=condtest.db;dbname=OFLP200
 IOVDbSvc                                0   0      INFO Disconnecting from sqlite://;schema=condtest.db;dbname=OFLP200
 DbSession                               0   0      INFO     Open     DbSession    
 Domain[ROOT_All]                        0   0      INFO >   Access   DbDomain     READ      [ROOT_All] 
-Domain[ROOT_All]                        0   0      INFO ->  Access   DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]                        0   0      INFO ->  Access   DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]                        0   0      INFO                           condtest.pool.root
 RootDatabase.open                       0   0      INFO condtest.pool.root File version:60806
-ClassIDSvc                              0   0      INFO  getRegistryEntries: read 711 CLIDRegistry entries for module ALL
+ClassIDSvc                              0   0      INFO  getRegistryEntries: read 35 CLIDRegistry entries for module ALL
 DMTest::CondReaderAlg                   0   0      INFO Event 0 LBN 0
 DMTest::CondReaderAlg                   0   0      INFO   xint xint (int) : 10
 DMTest::CondReaderAlg                   0   0      INFO   scond 1000
@@ -145,7 +146,7 @@ DMTest::CondReaderAlg                   1   0      INFO   scond 1000
 DMTest::CondReaderAlg                   1   0      INFO   s2 0
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #1, run #0 on slot 0,  2 events processed so far  <<<===
 AthenaHiveEventLoopMgr                  2   0      INFO   ===>>>  start processing event #2, run #0 on slot 0,  2 events processed so far  <<<===
-CondInputLoader                         2   0      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,2,t:0,l:1,b:4294967295]
+CondInputLoader                         2   0      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,2,t:0,l:1,b:4294967295]
 DMTest::CondReaderAlg                   2   0      INFO Event 2 LBN 1
 DMTest::CondReaderAlg                   2   0      INFO   xint xint (int) : 20
 DMTest::CondReaderAlg                   2   0      INFO   scond 2000
@@ -170,7 +171,7 @@ DMTest::CondReaderAlg                   5   0      INFO   scond 3000
 DMTest::CondReaderAlg                   5   0      INFO   s2 100
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #5, run #0 on slot 0,  6 events processed so far  <<<===
 AthenaHiveEventLoopMgr                  6   0      INFO   ===>>>  start processing event #6, run #0 on slot 0,  6 events processed so far  <<<===
-CondInputLoader                         6   0      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,6,t:0,l:3,b:4294967295]
+CondInputLoader                         6   0      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,6,t:0,l:3,b:4294967295]
 DMTest::CondReaderAlg                   6   0      INFO Event 6 LBN 3
 DMTest::CondReaderAlg                   6   0      INFO   xint xint (int) : 40
 DMTest::CondReaderAlg                   6   0      INFO   scond 4000
@@ -195,7 +196,7 @@ DMTest::CondReaderAlg                   9   0      INFO   scond 5000
 DMTest::CondReaderAlg                   9   0      INFO   s2 200
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #9, run #0 on slot 0,  10 events processed so far  <<<===
 AthenaHiveEventLoopMgr                  10  0      INFO   ===>>>  start processing event #10, run #0 on slot 0,  10 events processed so far  <<<===
-CondInputLoader                         10  0      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,10,t:0,l:5,b:4294967295]
+CondInputLoader                         10  0      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,10,t:0,l:5,b:4294967295]
 DMTest::CondReaderAlg                   10  0      INFO Event 10 LBN 5
 DMTest::CondReaderAlg                   10  0      INFO   xint xint (int) : 60
 DMTest::CondReaderAlg                   10  0      INFO   scond 6000
@@ -220,7 +221,7 @@ DMTest::CondReaderAlg                   13  0      INFO   scond 7000
 DMTest::CondReaderAlg                   13  0      INFO   s2 300
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #13, run #0 on slot 0,  14 events processed so far  <<<===
 AthenaHiveEventLoopMgr                  14  0      INFO   ===>>>  start processing event #14, run #0 on slot 0,  14 events processed so far  <<<===
-CondInputLoader                         14  0      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,14,t:0,l:7,b:4294967295]
+CondInputLoader                         14  0      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,14,t:0,l:7,b:4294967295]
 DMTest::CondReaderAlg                   14  0      INFO Event 14 LBN 7
 DMTest::CondReaderAlg                   14  0      INFO   xint xint (int) : 80
 DMTest::CondReaderAlg                   14  0      INFO   scond 8000
@@ -245,7 +246,7 @@ DMTest::CondReaderAlg                   17  0      INFO   scond 9000
 DMTest::CondReaderAlg                   17  0      INFO   s2 400
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #17, run #0 on slot 0,  18 events processed so far  <<<===
 AthenaHiveEventLoopMgr                  18  0      INFO   ===>>>  start processing event #18, run #0 on slot 0,  18 events processed so far  <<<===
-CondInputLoader                         18  0      INFO   CondObj ('DMTest::S2','ConditionStore+/DMTest/S2') is still valid at [0,18,t:0,l:9,b:4294967295]
+CondInputLoader                         18  0      INFO   CondObj  ( 'DMTest::S2' , 'ConditionStore+/DMTest/S2' )  is still valid at [0,18,t:0,l:9,b:4294967295]
 DMTest::CondReaderAlg                   18  0      INFO Event 18 LBN 9
 DMTest::CondReaderAlg                   18  0      INFO   xint xint (int) : 100
 DMTest::CondReaderAlg                   18  0      INFO   scond 10000
@@ -257,10 +258,10 @@ DMTest::CondReaderAlg                   19  0      INFO   xint xint (int) : 100
 DMTest::CondReaderAlg                   19  0      INFO   scond 10000
 DMTest::CondReaderAlg                   19  0      INFO   s2 400
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #19, run #0 on slot 0,  20 events processed so far  <<<===
-AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.468361
+AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.565278
 Domain[ROOT_All]                                   INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 condtest.pool.root                                 INFO Database being retired...
-Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 31ADA153-ED54-8944-9F72-24E989E80F9B
+Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 03774D99-F736-A540-9FC7-19D4D27FAEC8
 Domain[ROOT_All]                                   INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 ApplicationMgr                                     INFO Application Manager Stopped successfully
 IncidentProcAlg1                                   INFO Finalize
@@ -271,11 +272,11 @@ EventSelector                                      INFO finalize
 AvalancheSchedulerSvc                              INFO Joining Scheduler thread
 AvalancheSchedulerSvc                   19  0      INFO Terminating thread-pool resources
 EventDataSvc                                       INFO Finalizing EventDataSvc - package version StoreGate-00-00-00
-IOVDbSvc                                           INFO Folder /DMTest/S2 (PoolRef) db-read 1/5 objs/chan/bytes 10/1/1860 ((     0.00 ))s
-IOVDbSvc                                           INFO Folder /DMTest/TestAttrList (AttrList) db-read 1/10 objs/chan/bytes 20/1/80 ((     0.00 ))s
-IOVDbSvc                                           INFO Total payload read from COOL: 1940 bytes in ((      0.01 ))s
+IOVDbSvc                                           INFO Folder /DMTest/S2 (PoolRef) db-read 1/5 objs/chan/bytes 10/1/1860 ((     0.03 ))s
+IOVDbSvc                                           INFO Folder /DMTest/TestAttrList (AttrList) db-read 1/10 objs/chan/bytes 20/1/80 ((     0.01 ))s
+IOVDbSvc                                           INFO Total payload read from COOL: 1940 bytes in ((      0.03 ))s
 IOVDbSvc                                           INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: ((     0.00 ))s
-IOVDbSvc                                           INFO Connection sqlite://;schema=condtest.db;dbname=OFLP200 : nConnect: 2 nFolders: 2 ReadTime: ((     0.01 ))s
+IOVDbSvc                                           INFO Connection sqlite://;schema=condtest.db;dbname=OFLP200 : nConnect: 2 nFolders: 2 ReadTime: ((     0.03 ))s
 AthDictLoaderSvc                                   INFO in finalize...
 ToolSvc                                            INFO Removing all tools created by ToolSvc
 ChronoStatSvc.finalize()                           INFO  Service finalized successfully 
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1MT.ref b/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1MT.ref
index a53e16fd098..6e6e214db14 100644
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1MT.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1MT.ref
@@ -1,7 +1,7 @@
-Mon Oct 16 19:48:38 CEST 2017
+Tue Jan  2 16:49:14 PST 2018
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [atlas-work3/16a61e8faf] -- built on [2017-10-16T1807]
+Py:Athena            INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [dev/3227fd4b6f] -- built on [2018-01-02T1642]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
@@ -10,27 +10,27 @@ Py:AlgScheduler      INFO setting up AvalancheSchedulerSvc/AvalancheSchedulerSvc
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestDecorHandle1MT_jo.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestDecorHandle1_jo.py"
-Py:ConfigurableDb    INFO Read module info for 5421 configurables from 64 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5430 configurables from 7 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
 [?1034hApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 MessageSvc           INFO Activating in a separate thread
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus032.cern.ch on Mon Oct 16 19:48:55 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 16:49:22 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                                     INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                                   INFO in initialize...
 AthDictLoaderSvc                                   INFO acquired Dso-registry
-ClassIDSvc                                         INFO  getRegistryEntries: read 2850 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 2845 CLIDRegistry entries for module ALL
 ChronoStatSvc                                      INFO  Number of skipped events for MemStat-1
 CoreDumpSvc                                        INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                                        INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaHiveEventLoopMgr                             INFO Initializing AthenaHiveEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc                                         INFO  getRegistryEntries: read 6961 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 6935 CLIDRegistry entries for module ALL
 ClassIDSvc                                         INFO  getRegistryEntries: read 61 CLIDRegistry entries for module ALL
 ThreadPoolSvc                                      INFO no thread init tools attached
 AvalancheSchedulerSvc                              INFO Activating scheduler in a separate thread
@@ -45,38 +45,38 @@ AvalancheSchedulerSvc                              INFO Data Dependencies for Al
   SGInputLoader
       none
   xAODTestWriteCVec
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
-    o OUTPUT ('DMTest::CVec','StoreGateSvc+cvec')
-    o OUTPUT ('DMTest::CVec','StoreGateSvc+cvec.dtest')
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
+    o OUTPUT  ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) 
+    o OUTPUT  ( 'DMTest::CVec' , 'StoreGateSvc+cvec.dtest' ) 
   xAODTestWriteCInfo
-    o INPUT  ('DMTest::CVec','StoreGateSvc+cvec')
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
-    o OUTPUT ('DMTest::C','StoreGateSvc+cinfo')
-    o OUTPUT ('SG::AuxElement','StoreGateSvc+cinfo')
+    o INPUT   ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) 
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
+    o OUTPUT  ( 'DMTest::C' , 'StoreGateSvc+cinfo' ) 
+    o OUTPUT  ( 'SG::AuxElement' , 'StoreGateSvc+cinfo' ) 
   xAODTestWrite
-    o INPUT  ('DMTest::CVec','StoreGateSvc+cvec')
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
-    o OUTPUT ('DMTest::CVec','StoreGateSvc+ctrig')
-    o OUTPUT ('DMTest::CVecWithData','StoreGateSvc+cvecWD')
-    o OUTPUT ('DMTest::GVec','StoreGateSvc+gvec')
+    o INPUT   ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) 
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
+    o OUTPUT  ( 'DMTest::CVec' , 'StoreGateSvc+ctrig' ) 
+    o OUTPUT  ( 'DMTest::CVecWithData' , 'StoreGateSvc+cvecWD' ) 
+    o OUTPUT  ( 'DMTest::GVec' , 'StoreGateSvc+gvec' ) 
   xAODTestDecor
-    o INPUT  ('DMTest::C','StoreGateSvc+cinfo')
-    o INPUT  ('DMTest::CVec','StoreGateSvc+ctrig')
-    o INPUT  ('DMTest::CVec','StoreGateSvc+cvec')
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
-    o OUTPUT ('DMTest::C','StoreGateSvc+cinfo.dInt1')
-    o OUTPUT ('DMTest::CVec','StoreGateSvc+ctrig.dInt1')
-    o OUTPUT ('DMTest::CVec','StoreGateSvc+cvec.dInt1')
-    o OUTPUT ('SG::AuxElement','StoreGateSvc+cinfo.dInt1')
+    o INPUT   ( 'DMTest::C' , 'StoreGateSvc+cinfo' ) 
+    o INPUT   ( 'DMTest::CVec' , 'StoreGateSvc+ctrig' ) 
+    o INPUT   ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) 
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
+    o OUTPUT  ( 'DMTest::C' , 'StoreGateSvc+cinfo.dInt1' ) 
+    o OUTPUT  ( 'DMTest::CVec' , 'StoreGateSvc+ctrig.dInt1' ) 
+    o OUTPUT  ( 'DMTest::CVec' , 'StoreGateSvc+cvec.dInt1' ) 
+    o OUTPUT  ( 'SG::AuxElement' , 'StoreGateSvc+cinfo.dInt1' ) 
   xAODTestReadDecor
-    o INPUT  ('DMTest::C','StoreGateSvc+cinfo.dInt1')
-    o INPUT  ('DMTest::CVec','StoreGateSvc+cvec.dInt1')
+    o INPUT   ( 'DMTest::C' , 'StoreGateSvc+cinfo.dInt1' ) 
+    o INPUT   ( 'DMTest::CVec' , 'StoreGateSvc+cvec.dInt1' ) 
   EndIncFiringAlg
       none
   IncidentProcAlg2
       none
 AvalancheSchedulerSvc                              INFO Will attribute the following unmet INPUT dependencies to "SGInputLoader/SGInputLoader" Algorithm
-   o ('EventInfo','StoreGateSvc+McEventInfo')    required by Algorithm: 
+   o  ( 'EventInfo' , 'StoreGateSvc+McEventInfo' )     required by Algorithm: 
        * xAODTestWrite
        * xAODTestWriteCInfo
        * xAODTestDecor
@@ -92,9 +92,9 @@ AthenaHiveEventLoopMgr                             INFO Setup EventSelector serv
 ApplicationMgr                                     INFO Application Manager Initialized successfully
 ApplicationMgr                                     INFO Application Manager Started successfully
 AthenaHiveEventLoopMgr                             INFO Starting loop on events
-ClassIDSvc                                         INFO  getRegistryEntries: read 108 CLIDRegistry entries for module ALL
-EventPersistencySvc                                INFO Added successfully Conversion service:McCnvSvc
+EventPersistencySvc                     0   0      INFO Added successfully Conversion service:McCnvSvc
 AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start of run 0    <<<===
+ClassIDSvc                              0   0      INFO  getRegistryEntries: read 108 CLIDRegistry entries for module ALL
 AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start processing event #0, run #0 on slot 0,  0 events processed so far  <<<===
 xAODTestReadDecor                       0   0      INFO cvec.dInt1: 401 402 403 404 405 406 407 408 409 410
 xAODTestReadDecor                       0   0      INFO cinfo.dInt1: 3000
@@ -175,7 +175,7 @@ AthenaHiveEventLoopMgr                  19  0      INFO   ===>>>  start processi
 xAODTestReadDecor                       19  0      INFO cvec.dInt1: 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010
 xAODTestReadDecor                       19  0      INFO cinfo.dInt1: 60000
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #19, run #0 on slot 0,  20 events processed so far  <<<===
-AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.303719
+AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.333871
 ApplicationMgr                                     INFO Application Manager Stopped successfully
 IncidentProcAlg1                                   INFO Finalize
 SGInputLoader                                      INFO Finalizing SGInputLoader...
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle2MT.ref b/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle2MT.ref
index 457ce122e92..80a10d229a7 100644
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle2MT.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle2MT.ref
@@ -1,7 +1,7 @@
-Fri Oct 27 23:34:23 CEST 2017
+Tue Jan  2 17:45:50 PST 2018
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-opt] [atlas-work3/9f528da37a] -- built on [2017-10-27T2310]
+Py:Athena            INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [dev/3227fd4b6f] -- built on [2018-01-02T1642]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
@@ -10,22 +10,22 @@ Py:AlgScheduler      INFO setting up AvalancheSchedulerSvc/AvalancheSchedulerSvc
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestDecorHandle2MT_jo.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestDecorHandle2_jo.py"
-Py:ConfigurableDb    INFO Read module info for 5436 configurables from 58 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5430 configurables from 7 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 [?1034hPy:Athena            INFO including file "AthenaCommon/runbatch.py"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 MessageSvc           INFO Activating in a separate thread
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus012.cern.ch on Fri Oct 27 23:34:39 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 17:46:07 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                                     INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                                   INFO in initialize...
 AthDictLoaderSvc                                   INFO acquired Dso-registry
-ClassIDSvc                                         INFO  getRegistryEntries: read 10254 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 10201 CLIDRegistry entries for module ALL
 ChronoStatSvc                                      INFO  Number of skipped events for MemStat-1
 CoreDumpSvc                                        INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                                        INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
@@ -35,23 +35,22 @@ AthenaPoolCnvSvc                                   INFO Initializing AthenaPoolC
 PoolSvc                                            INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc                                            INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc                                            INFO Frontier compression level set to 5
-DBReplicaSvc                                       INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128) will be considered for COOL data
-DBReplicaSvc                                       INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-10-26T2259/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
-DBReplicaSvc                                       INFO Total of 10 servers found for host lxplus012.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc                                       INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(proxyurl=http://msquid01-ib.nersc.gov:3128)(proxyurl=http://msquid02-ib.nersc.gov:3128) will be considered for COOL data
+DBReplicaSvc                                       INFO Read replica configuration from /bld2/build/v30r1.002/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
+DBReplicaSvc                                       INFO No specific match for domain found - use default fallback
+DBReplicaSvc                                       INFO Total of 2 servers found for host zeus [ATLF atlas_dd ]
 PoolSvc                                            INFO Successfully setup replica sorting algorithm
 PoolSvc                                            INFO Setting up APR FileCatalog and Streams
 PoolSvc                                            INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml
 DbSession                                          INFO     Open     DbSession    
 Domain[ROOT_All]                                   INFO >   Access   DbDomain     READ      [ROOT_All] 
+EventSelector                                      INFO Initializing EventSelector - package version EventSelectorAthenaPool-00-00-00
 EventSelector                                      INFO reinitialization...
 EventSelector                                      INFO EventSelection with query 
-Domain[ROOT_All]                                   INFO ->  Access   DbDatabase   READ      [ROOT_All] 93E7DA84-0A72-4B49-A584-F3907D86A720
+Domain[ROOT_All]                                   INFO ->  Access   DbDatabase   READ      [ROOT_All] 3B042E92-46EE-DB43-8F81-88D283E3D843
 Domain[ROOT_All]                                   INFO                           xaoddata.root
 RootDatabase.open                                  INFO xaoddata.root File version:60806
 EventPersistencySvc                                INFO Added successfully Conversion service:AthenaPoolCnvSvc
-EventSelector                                      INFO Initializing EventSelector - package version EventSelectorAthenaPool-00-00-00
-EventSelector                                      INFO reinitialization...
-EventSelector                                      INFO EventSelection with query 
 AthenaPoolAddressProviderSvc                       INFO Initializing AthenaPoolAddressProviderSvc - package version EventSelectorAthenaPool-00-00-00
 ClassIDSvc                                         INFO  getRegistryEntries: read 1493 CLIDRegistry entries for module ALL
 ThreadPoolSvc                                      INFO no thread init tools attached
@@ -67,16 +66,16 @@ AvalancheSchedulerSvc                              INFO Data Dependencies for Al
   SGInputLoader
       none
   xAODTestReadDecor
-    o INPUT  ('DMTest::C','StoreGateSvc+cinfo.dInt1')
-    o INPUT  ('DMTest::CVec','StoreGateSvc+cvec.dInt1')
+    o INPUT   ( 'DMTest::C' , 'StoreGateSvc+cinfo.dInt1' ) 
+    o INPUT   ( 'DMTest::CVec' , 'StoreGateSvc+cvec.dInt1' ) 
   EndIncFiringAlg
       none
   IncidentProcAlg2
       none
 AvalancheSchedulerSvc                              INFO Will attribute the following unmet INPUT dependencies to "SGInputLoader/SGInputLoader" Algorithm
-   o ('DMTest::C','StoreGateSvc+cinfo.dInt1')    required by Algorithm: 
+   o  ( 'DMTest::C' , 'StoreGateSvc+cinfo.dInt1' )     required by Algorithm: 
        * xAODTestReadDecor
-   o ('DMTest::CVec','StoreGateSvc+cvec.dInt1')    required by Algorithm: 
+   o  ( 'DMTest::CVec' , 'StoreGateSvc+cvec.dInt1' )     required by Algorithm: 
        * xAODTestReadDecor
 PrecedenceSvc                                      INFO Assembling CF and DF task precedence rules
 PrecedenceSvc                                      INFO PrecedenceSvc initialized successfully
@@ -87,18 +86,19 @@ HistogramPersistencySvc                         WARNING Histograms saving not re
 AthenaHiveEventLoopMgr                             INFO Setup EventSelector service EventSelector
 ApplicationMgr                                     INFO Application Manager Initialized successfully
 xaoddata.root                                      INFO Database being retired...
-Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 93E7DA84-0A72-4B49-A584-F3907D86A720
+Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 3B042E92-46EE-DB43-8F81-88D283E3D843
+Domain[ROOT_All]                                   INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 DbSession                                          INFO     Open     DbSession    
 Domain[ROOT_All]                                   INFO >   Access   DbDomain     READ      [ROOT_All] 
-Domain[ROOT_All]                                   INFO ->  Access   DbDatabase   READ      [ROOT_All] 93E7DA84-0A72-4B49-A584-F3907D86A720
+Domain[ROOT_All]                                   INFO ->  Access   DbDatabase   READ      [ROOT_All] 3B042E92-46EE-DB43-8F81-88D283E3D843
 Domain[ROOT_All]                                   INFO                           xaoddata.root
 RootDatabase.open                                  INFO xaoddata.root File version:60806
 ApplicationMgr                                     INFO Application Manager Started successfully
 AthenaHiveEventLoopMgr                             INFO Starting loop on events
-AthenaPoolConverter                                INFO massageEventInfo: unable to get OverrideRunNumberFromInput property from EventSelector 
+AthenaPoolConverter                     0   0      INFO massageEventInfo: unable to get OverrideRunNumberFromInput property from EventSelector 
 AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start of run 0    <<<===
-AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start processing event #0, run #0 on slot 0,  0 events processed so far  <<<===
 ClassIDSvc                              0   0      INFO  getRegistryEntries: read 11 CLIDRegistry entries for module ALL
+AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start processing event #0, run #0 on slot 0,  0 events processed so far  <<<===
 xAODTestReadDecor                       0   0      INFO cvec.dInt1: 401 402 403 404 405 406 407 408 409 410
 xAODTestReadDecor                       0   0      INFO cinfo.dInt1: 3000
 ClassIDSvc                              0   0      INFO  getRegistryEntries: read 50 CLIDRegistry entries for module ALL
@@ -179,9 +179,9 @@ AthenaHiveEventLoopMgr                  19  0      INFO   ===>>>  start processi
 xAODTestReadDecor                       19  0      INFO cvec.dInt1: 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010
 xAODTestReadDecor                       19  0      INFO cinfo.dInt1: 60000
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #19, run #0 on slot 0,  20 events processed so far  <<<===
-AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.394916
+AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.581046
 xaoddata.root                                      INFO Database being retired...
-Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 93E7DA84-0A72-4B49-A584-F3907D86A720
+Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 3B042E92-46EE-DB43-8F81-88D283E3D843
 ApplicationMgr                                     INFO Application Manager Stopped successfully
 IncidentProcAlg1                                   INFO Finalize
 SGInputLoader                                      INFO Finalizing SGInputLoader...
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1.ref b/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1.ref
index 0d10480e832..3a06fe2cd3c 100644
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1.ref
@@ -1,20 +1,20 @@
-Fri Oct 27 20:47:51 CEST 2017
+Tue Jan  2 16:43:07 PST 2018
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-opt] [atlas-work3/9f528da37a] -- built on [2017-10-27T2018]
+Py:Athena            INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [dev/3227fd4b6f] -- built on [2018-01-02T1642]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestSymlinks1_jo.py"
-Py:ConfigurableDb    INFO Read module info for 5436 configurables from 58 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5430 configurables from 7 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
 [?1034hApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus012.cern.ch on Fri Oct 27 20:48:04 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 16:43:19 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
@@ -22,28 +22,29 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2398 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 2318 CLIDRegistry entries for module ALL
 ChronoStatSvc        INFO  Number of skipped events for MemStat-1
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 6591 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 6620 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO  getRegistryEntries: read 61 CLIDRegistry entries for module ALL
 MetaDataSvc          INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00
 AthenaPoolCnvSvc     INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128) will be considered for COOL data
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-10-26T2259/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 10 servers found for host lxplus012.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(proxyurl=http://msquid01-ib.nersc.gov:3128)(proxyurl=http://msquid02-ib.nersc.gov:3128) will be considered for COOL data
+DBReplicaSvc         INFO Read replica configuration from /bld2/build/v30r1.002/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
+DBReplicaSvc         INFO No specific match for domain found - use default fallback
+DBReplicaSvc         INFO Total of 2 servers found for host zeus [ATLF atlas_dd ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc              INFO Setting up APR FileCatalog and Streams
 PoolSvc              INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml
 DbSession            INFO     Open     DbSession    
 Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
-ClassIDSvc           INFO  getRegistryEntries: read 904 CLIDRegistry entries for module ALL
-xAODTestAlg       WARNING Implicit circular data dependency detected for id ('SG::AuxElement','StoreGateSvc+cinfo2')
+ClassIDSvc           INFO  getRegistryEntries: read 902 CLIDRegistry entries for module ALL
+xAODTestAlg       WARNING Implicit circular data dependency detected for id  ( 'SG::AuxElement' , 'StoreGateSvc+cinfo2' ) 
 HistogramPersis...WARNING Histograms saving not required.
 EventSelector        INFO  Enter McEventSelector Initialization 
 AthenaEventLoopMgr   INFO Setup EventSelector service EventSelector
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1MT.ref b/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1MT.ref
index 86a06339534..46c1e6e0beb 100644
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1MT.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1MT.ref
@@ -1,7 +1,7 @@
-Fri Oct 27 20:47:51 CEST 2017
+Tue Jan  2 16:45:21 PST 2018
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-opt] [atlas-work3/9f528da37a] -- built on [2017-10-27T2018]
+Py:Athena            INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [dev/3227fd4b6f] -- built on [2018-01-02T1642]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
@@ -10,22 +10,22 @@ Py:AlgScheduler      INFO setting up AvalancheSchedulerSvc/AvalancheSchedulerSvc
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestSymlinks1MT_jo.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestSymlinks1_jo.py"
-Py:ConfigurableDb    INFO Read module info for 5436 configurables from 58 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5430 configurables from 7 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
 [?1034hApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 MessageSvc           INFO Activating in a separate thread
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus012.cern.ch on Fri Oct 27 20:48:04 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 16:45:33 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                                     INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                                   INFO in initialize...
 AthDictLoaderSvc                                   INFO acquired Dso-registry
-ClassIDSvc                                         INFO  getRegistryEntries: read 2850 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 2845 CLIDRegistry entries for module ALL
 ChronoStatSvc                                      INFO  Number of skipped events for MemStat-1
 CoreDumpSvc                                        INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                                        INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
@@ -35,17 +35,18 @@ AthenaPoolCnvSvc                                   INFO Initializing AthenaPoolC
 PoolSvc                                            INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc                                            INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc                                            INFO Frontier compression level set to 5
-DBReplicaSvc                                       INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128) will be considered for COOL data
-DBReplicaSvc                                       INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-10-26T2259/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
-DBReplicaSvc                                       INFO Total of 10 servers found for host lxplus012.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc                                       INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(proxyurl=http://msquid01-ib.nersc.gov:3128)(proxyurl=http://msquid02-ib.nersc.gov:3128) will be considered for COOL data
+DBReplicaSvc                                       INFO Read replica configuration from /bld2/build/v30r1.002/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
+DBReplicaSvc                                       INFO No specific match for domain found - use default fallback
+DBReplicaSvc                                       INFO Total of 2 servers found for host zeus [ATLF atlas_dd ]
 PoolSvc                                            INFO Successfully setup replica sorting algorithm
 PoolSvc                                            INFO Setting up APR FileCatalog and Streams
 PoolSvc                                            INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml
 DbSession                                          INFO     Open     DbSession    
 Domain[ROOT_All]                                   INFO >   Access   DbDomain     READ      [ROOT_All] 
-ClassIDSvc                                         INFO  getRegistryEntries: read 7495 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 7463 CLIDRegistry entries for module ALL
 ClassIDSvc                                         INFO  getRegistryEntries: read 61 CLIDRegistry entries for module ALL
-xAODTestAlg                                     WARNING Implicit circular data dependency detected for id ('SG::AuxElement','StoreGateSvc+cinfo2')
+xAODTestAlg                                     WARNING Implicit circular data dependency detected for id  ( 'SG::AuxElement' , 'StoreGateSvc+cinfo2' ) 
 ThreadPoolSvc                                      INFO no thread init tools attached
 AvalancheSchedulerSvc                              INFO Activating scheduler in a separate thread
 AvalancheSchedulerSvc                              INFO Waiting for AvalancheSchedulerSvc to activate
@@ -59,39 +60,39 @@ AvalancheSchedulerSvc                              INFO Data Dependencies for Al
   SGInputLoader
       none
   xAODTestWriteCVec
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
-    o OUTPUT ('DMTest::CVec','StoreGateSvc+cvec')
-    o OUTPUT ('DMTest::CVec','StoreGateSvc+cvec.dtest')
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
+    o OUTPUT  ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) 
+    o OUTPUT  ( 'DMTest::CVec' , 'StoreGateSvc+cvec.dtest' ) 
   xAODTestWriteCInfo
-    o INPUT  ('DMTest::CVec','StoreGateSvc+cvec')
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
-    o OUTPUT ('DMTest::C','StoreGateSvc+cinfo')
-    o OUTPUT ('SG::AuxElement','StoreGateSvc+cinfo')
+    o INPUT   ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) 
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
+    o OUTPUT  ( 'DMTest::C' , 'StoreGateSvc+cinfo' ) 
+    o OUTPUT  ( 'SG::AuxElement' , 'StoreGateSvc+cinfo' ) 
   xAODTestWriteSymlinks
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
-    o OUTPUT ('DMTest::S1','StoreGateSvc+S2')
-    o OUTPUT ('DMTest::S1','StoreGateSvc+S2alias')
-    o OUTPUT ('DMTest::S2','StoreGateSvc+S2')
-    o OUTPUT ('DMTest::S2','StoreGateSvc+S2alias')
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
+    o OUTPUT  ( 'DMTest::S1' , 'StoreGateSvc+S2' ) 
+    o OUTPUT  ( 'DMTest::S1' , 'StoreGateSvc+S2alias' ) 
+    o OUTPUT  ( 'DMTest::S2' , 'StoreGateSvc+S2' ) 
+    o OUTPUT  ( 'DMTest::S2' , 'StoreGateSvc+S2alias' ) 
   xAODTestReadSymlink
-    o INPUT  ('DMTest::S1','StoreGateSvc+S2')
-    o INPUT  ('DMTest::S2','StoreGateSvc+S2')
-    o INPUT  ('DMTest::S2','StoreGateSvc+S2alias')
-    o INPUT  ('SG::AuxElement','StoreGateSvc+cinfo')
+    o INPUT   ( 'DMTest::S1' , 'StoreGateSvc+S2' ) 
+    o INPUT   ( 'DMTest::S2' , 'StoreGateSvc+S2' ) 
+    o INPUT   ( 'DMTest::S2' , 'StoreGateSvc+S2alias' ) 
+    o INPUT   ( 'SG::AuxElement' , 'StoreGateSvc+cinfo' ) 
   xAODTestAlg
-    o INPUT  ('DMTest::CVec','StoreGateSvc+cvec')
-    o INPUT  ('DMTest::S1','StoreGateSvc+S2')
-    o INPUT  ('DMTest::S2','StoreGateSvc+S2')
-    o INPUT  ('DMTest::S2','StoreGateSvc+S2alias')
-    o INPUT  ('EventInfo','StoreGateSvc+McEventInfo')
-    o OUTPUT ('DMTest::C','StoreGateSvc+cinfo2')
-    o OUTPUT ('SG::AuxElement','StoreGateSvc+cinfo2')
+    o INPUT   ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) 
+    o INPUT   ( 'DMTest::S1' , 'StoreGateSvc+S2' ) 
+    o INPUT   ( 'DMTest::S2' , 'StoreGateSvc+S2' ) 
+    o INPUT   ( 'DMTest::S2' , 'StoreGateSvc+S2alias' ) 
+    o INPUT   ( 'EventInfo' , 'StoreGateSvc+McEventInfo' ) 
+    o OUTPUT  ( 'DMTest::C' , 'StoreGateSvc+cinfo2' ) 
+    o OUTPUT  ( 'SG::AuxElement' , 'StoreGateSvc+cinfo2' ) 
   EndIncFiringAlg
       none
   IncidentProcAlg2
       none
 AvalancheSchedulerSvc                              INFO Will attribute the following unmet INPUT dependencies to "SGInputLoader/SGInputLoader" Algorithm
-   o ('EventInfo','StoreGateSvc+McEventInfo')    required by Algorithm: 
+   o  ( 'EventInfo' , 'StoreGateSvc+McEventInfo' )     required by Algorithm: 
        * xAODTestAlg
        * xAODTestWriteSymlinks
        * xAODTestWriteCInfo
@@ -107,9 +108,9 @@ AthenaHiveEventLoopMgr                             INFO Setup EventSelector serv
 ApplicationMgr                                     INFO Application Manager Initialized successfully
 ApplicationMgr                                     INFO Application Manager Started successfully
 AthenaHiveEventLoopMgr                             INFO Starting loop on events
-ClassIDSvc                                         INFO  getRegistryEntries: read 108 CLIDRegistry entries for module ALL
-EventPersistencySvc                                INFO Added successfully Conversion service:McCnvSvc
+EventPersistencySvc                     0   0      INFO Added successfully Conversion service:McCnvSvc
 AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start of run 0    <<<===
+ClassIDSvc                              0   0      INFO  getRegistryEntries: read 108 CLIDRegistry entries for module ALL
 AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start processing event #0, run #0 on slot 0,  0 events processed so far  <<<===
 xAODTestReadSymlink                     0   0      INFO C (as AuxElement): 1000; S 0
 xAODTestAlg.xAODTestReadSymlinkTool     0   0      INFO From tool: C (as AuxElement): 1000; S 0
@@ -190,7 +191,7 @@ AthenaHiveEventLoopMgr                  19  0      INFO   ===>>>  start processi
 xAODTestReadSymlink                     19  0      INFO C (as AuxElement): 20000; S 1900
 xAODTestAlg.xAODTestReadSymlinkTool     19  0      INFO From tool: C (as AuxElement): 20000; S 1900
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #19, run #0 on slot 0,  20 events processed so far  <<<===
-AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.0584865
+AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.21888
 Domain[ROOT_All]                                   INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 ApplicationMgr                                     INFO Application Manager Stopped successfully
 IncidentProcAlg1                                   INFO Finalize
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks2MT.ref b/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks2MT.ref
index 35f5495678f..9dee00bacaf 100644
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks2MT.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks2MT.ref
@@ -1,7 +1,7 @@
-Fri Oct 27 23:27:42 CEST 2017
+Tue Jan  2 17:47:48 PST 2018
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-opt] [atlas-work3/9f528da37a] -- built on [2017-10-27T2310]
+Py:Athena            INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [dev/3227fd4b6f] -- built on [2018-01-02T1642]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
@@ -10,22 +10,22 @@ Py:AlgScheduler      INFO setting up AvalancheSchedulerSvc/AvalancheSchedulerSvc
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestSymlinks2MT_jo.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestSymlinks2_jo.py"
-Py:ConfigurableDb    INFO Read module info for 5436 configurables from 58 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5430 configurables from 7 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 [?1034hPy:Athena            INFO including file "AthenaCommon/runbatch.py"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 MessageSvc           INFO Activating in a separate thread
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus012.cern.ch on Fri Oct 27 23:27:57 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 17:48:04 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                                     INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                                   INFO in initialize...
 AthDictLoaderSvc                                   INFO acquired Dso-registry
-ClassIDSvc                                         INFO  getRegistryEntries: read 10254 CLIDRegistry entries for module ALL
+ClassIDSvc                                         INFO  getRegistryEntries: read 10201 CLIDRegistry entries for module ALL
 ChronoStatSvc                                      INFO  Number of skipped events for MemStat-1
 CoreDumpSvc                                        INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                                        INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
@@ -35,23 +35,22 @@ AthenaPoolCnvSvc                                   INFO Initializing AthenaPoolC
 PoolSvc                                            INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc                                            INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc                                            INFO Frontier compression level set to 5
-DBReplicaSvc                                       INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128) will be considered for COOL data
-DBReplicaSvc                                       INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-10-26T2259/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
-DBReplicaSvc                                       INFO Total of 10 servers found for host lxplus012.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc                                       INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(proxyurl=http://msquid01-ib.nersc.gov:3128)(proxyurl=http://msquid02-ib.nersc.gov:3128) will be considered for COOL data
+DBReplicaSvc                                       INFO Read replica configuration from /bld2/build/v30r1.002/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
+DBReplicaSvc                                       INFO No specific match for domain found - use default fallback
+DBReplicaSvc                                       INFO Total of 2 servers found for host zeus [ATLF atlas_dd ]
 PoolSvc                                            INFO Successfully setup replica sorting algorithm
 PoolSvc                                            INFO Setting up APR FileCatalog and Streams
 PoolSvc                                            INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml
 DbSession                                          INFO     Open     DbSession    
 Domain[ROOT_All]                                   INFO >   Access   DbDomain     READ      [ROOT_All] 
+EventSelector                                      INFO Initializing EventSelector - package version EventSelectorAthenaPool-00-00-00
 EventSelector                                      INFO reinitialization...
 EventSelector                                      INFO EventSelection with query 
-Domain[ROOT_All]                                   INFO ->  Access   DbDatabase   READ      [ROOT_All] 93E7DA84-0A72-4B49-A584-F3907D86A720
+Domain[ROOT_All]                                   INFO ->  Access   DbDatabase   READ      [ROOT_All] 3B042E92-46EE-DB43-8F81-88D283E3D843
 Domain[ROOT_All]                                   INFO                           xaoddata.root
 RootDatabase.open                                  INFO xaoddata.root File version:60806
 EventPersistencySvc                                INFO Added successfully Conversion service:AthenaPoolCnvSvc
-EventSelector                                      INFO Initializing EventSelector - package version EventSelectorAthenaPool-00-00-00
-EventSelector                                      INFO reinitialization...
-EventSelector                                      INFO EventSelection with query 
 AthenaPoolAddressProviderSvc                       INFO Initializing AthenaPoolAddressProviderSvc - package version EventSelectorAthenaPool-00-00-00
 ClassIDSvc                                         INFO  getRegistryEntries: read 1493 CLIDRegistry entries for module ALL
 ThreadPoolSvc                                      INFO no thread init tools attached
@@ -67,22 +66,22 @@ AvalancheSchedulerSvc                              INFO Data Dependencies for Al
   SGInputLoader
       none
   xAODTestReadSymlink
-    o INPUT  ('DMTest::S1','StoreGateSvc+S2')
-    o INPUT  ('DMTest::S2','StoreGateSvc+S2')
-    o INPUT  ('DMTest::S2','StoreGateSvc+S2alias')
-    o INPUT  ('SG::AuxElement','StoreGateSvc+cinfo')
+    o INPUT   ( 'DMTest::S1' , 'StoreGateSvc+S2' ) 
+    o INPUT   ( 'DMTest::S2' , 'StoreGateSvc+S2' ) 
+    o INPUT   ( 'DMTest::S2' , 'StoreGateSvc+S2alias' ) 
+    o INPUT   ( 'SG::AuxElement' , 'StoreGateSvc+cinfo' ) 
   EndIncFiringAlg
       none
   IncidentProcAlg2
       none
 AvalancheSchedulerSvc                              INFO Will attribute the following unmet INPUT dependencies to "SGInputLoader/SGInputLoader" Algorithm
-   o ('DMTest::S1','StoreGateSvc+S2')    required by Algorithm: 
+   o  ( 'DMTest::S1' , 'StoreGateSvc+S2' )     required by Algorithm: 
        * xAODTestReadSymlink
-   o ('DMTest::S2','StoreGateSvc+S2')    required by Algorithm: 
+   o  ( 'DMTest::S2' , 'StoreGateSvc+S2' )     required by Algorithm: 
        * xAODTestReadSymlink
-   o ('DMTest::S2','StoreGateSvc+S2alias')    required by Algorithm: 
+   o  ( 'DMTest::S2' , 'StoreGateSvc+S2alias' )     required by Algorithm: 
        * xAODTestReadSymlink
-   o ('SG::AuxElement','StoreGateSvc+cinfo')    required by Algorithm: 
+   o  ( 'SG::AuxElement' , 'StoreGateSvc+cinfo' )     required by Algorithm: 
        * xAODTestReadSymlink
 PrecedenceSvc                                      INFO Assembling CF and DF task precedence rules
 PrecedenceSvc                                      INFO PrecedenceSvc initialized successfully
@@ -93,18 +92,19 @@ HistogramPersistencySvc                         WARNING Histograms saving not re
 AthenaHiveEventLoopMgr                             INFO Setup EventSelector service EventSelector
 ApplicationMgr                                     INFO Application Manager Initialized successfully
 xaoddata.root                                      INFO Database being retired...
-Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 93E7DA84-0A72-4B49-A584-F3907D86A720
+Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 3B042E92-46EE-DB43-8F81-88D283E3D843
+Domain[ROOT_All]                                   INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 DbSession                                          INFO     Open     DbSession    
 Domain[ROOT_All]                                   INFO >   Access   DbDomain     READ      [ROOT_All] 
-Domain[ROOT_All]                                   INFO ->  Access   DbDatabase   READ      [ROOT_All] 93E7DA84-0A72-4B49-A584-F3907D86A720
+Domain[ROOT_All]                                   INFO ->  Access   DbDatabase   READ      [ROOT_All] 3B042E92-46EE-DB43-8F81-88D283E3D843
 Domain[ROOT_All]                                   INFO                           xaoddata.root
 RootDatabase.open                                  INFO xaoddata.root File version:60806
 ApplicationMgr                                     INFO Application Manager Started successfully
 AthenaHiveEventLoopMgr                             INFO Starting loop on events
-AthenaPoolConverter                                INFO massageEventInfo: unable to get OverrideRunNumberFromInput property from EventSelector 
+AthenaPoolConverter                     0   0      INFO massageEventInfo: unable to get OverrideRunNumberFromInput property from EventSelector 
 AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start of run 0    <<<===
-AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start processing event #0, run #0 on slot 0,  0 events processed so far  <<<===
 ClassIDSvc                              0   0      INFO  getRegistryEntries: read 11 CLIDRegistry entries for module ALL
+AthenaHiveEventLoopMgr                  0   0      INFO   ===>>>  start processing event #0, run #0 on slot 0,  0 events processed so far  <<<===
 xAODTestReadSymlink                     0   0      INFO C (as AuxElement): 1000; S 0
 ClassIDSvc                              0   0      INFO  getRegistryEntries: read 50 CLIDRegistry entries for module ALL
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #0, run #0 on slot 0,  1 events processed so far  <<<===
@@ -165,9 +165,9 @@ AthenaHiveEventLoopMgr                             INFO   ===>>>  done processin
 AthenaHiveEventLoopMgr                  19  0      INFO   ===>>>  start processing event #19, run #0 on slot 0,  19 events processed so far  <<<===
 xAODTestReadSymlink                     19  0      INFO C (as AuxElement): 20000; S 1900
 AthenaHiveEventLoopMgr                             INFO   ===>>>  done processing event #19, run #0 on slot 0,  20 events processed so far  <<<===
-AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.299475
+AthenaHiveEventLoopMgr                             INFO ---> Loop Finished (seconds): 0.366807
 xaoddata.root                                      INFO Database being retired...
-Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 93E7DA84-0A72-4B49-A584-F3907D86A720
+Domain[ROOT_All]                                   INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 3B042E92-46EE-DB43-8F81-88D283E3D843
 ApplicationMgr                                     INFO Application Manager Stopped successfully
 IncidentProcAlg1                                   INFO Finalize
 SGInputLoader                                      INFO Finalizing SGInputLoader...
diff --git a/Control/IOVSvc/share/IOVSvcTool_test.ref b/Control/IOVSvc/share/IOVSvcTool_test.ref
index 9aa70380ce5..6a9e8db2b6a 100644
--- a/Control/IOVSvc/share/IOVSvcTool_test.ref
+++ b/Control/IOVSvc/share/IOVSvcTool_test.ref
@@ -2,32 +2,37 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/IOVSvcTool_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/IOVSvc/share/../share/IOVSvcTool_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/IOVSvc/share/../share/IOVSvcTool_test.txt
 JobOptionsSvc        INFO # (2,1): ApplicationMgr.DLLs += ["StoreGate", "IOVSvc"]
 JobOptionsSvc        INFO # (3,1): ApplicationMgr.CreateSvc += ["StoreGateSvc/DetectorStore"]
 JobOptionsSvc        INFO # (5,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO Job options successfully read in from ../share/IOVSvcTool_test.txt
+MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
-                                          running on lxplus020.cern.ch on Mon Dec 11 13:23:13 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 16:08:10 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : StoreGate, IOVSvc
 ApplicationMgr       INFO Application Manager Configured successfully
+ServiceManager      DEBUG Initializing service IncidentSvc
 IncidentSvc         DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service DetectorStore
 DetectorStore       DEBUG Service base class initialized successfully
 DetectorStore       DEBUG trying to create store SGImplSvc/DetectorStore_Impl
 DetectorStore_Impl  DEBUG Service base class initialized successfully
 EventPersistenc...  DEBUG Service base class initialized successfully
 ClassIDSvc          DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [ModuleLoaded] listener 'ClassIDSvc' with priority 100
-ClassIDSvc           INFO  getRegistryEntries: read 1114 CLIDRegistry entries for module ALL
-ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-opt/x86_64-slc6-gcc62-opt/share/clid.db
-ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-12-10T2303/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/clid.db
+ClassIDSvc           INFO  getRegistryEntries: read 1113 CLIDRegistry entries for module ALL
+ClassIDSvc          DEBUG processCLIDDB: read 1484 entries from CLIDDB file: /home/leggett/work/v30r1.002/bld/x86_64-slc6-gcc62-dbg/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 1484 entries from CLIDDB file: /bld2/build/v30r1.002/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/clid.db
 IncidentSvc         DEBUG Adding [EndEvent] listener 'DetectorStore' with priority 100
 IncidentSvc         DEBUG Adding [BeginEvent] listener 'DetectorStore' with priority 100
+ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
 EventDataSvc        DEBUG Service base class initialized successfully
@@ -40,6 +45,8 @@ HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
 ToolSvc             DEBUG Service base class initialized successfully
+IOVSvc              DEBUG Initializing IOVSvc version IOVSvc-00-00-00
+IOVSvc              DEBUG AthService initialized
 StoreGateSvc        DEBUG Service base class initialized successfully
 StoreGateSvc        DEBUG trying to create store SGImplSvc/StoreGateSvc_Impl
 StoreGateSvc_Impl   DEBUG Service base class initialized successfully
@@ -50,11 +57,14 @@ ConditionStore      DEBUG trying to create store SGImplSvc/ConditionStore_Impl
 ConditionStore_...  DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [EndEvent] listener 'ConditionStore' with priority 100
 IncidentSvc         DEBUG Adding [BeginEvent] listener 'ConditionStore' with priority 100
+IOVSvcTool          DEBUG Initializing IOVSvcTool version IOVSvc-00-00-00
 IncidentSvc         DEBUG Adding [BeginEvent] listener 'ToolSvc.IOVSvcTool' with priority 100
 IncidentSvc         DEBUG Adding [BeginRun] listener 'ToolSvc.IOVSvcTool' with priority 100
 IOVSvcTool           INFO IOVRanges will be checked at every Event
 IncidentSvc         DEBUG Adding [CheckIOV] listener 'ToolSvc.IOVSvcTool' with priority 100
 IncidentSvc         DEBUG Adding [ReloadProxies] listener 'ToolSvc.IOVSvcTool' with priority 100
+IOVSvcTool          DEBUG Tool initialized
 ClassIDSvc           INFO  getRegistryEntries: read 372 CLIDRegistry entries for module ALL
-IOVSvcTool          DEBUG replace proxy [Dooo:6666/old] @0x2801b60 with [Dooo:6666/new] @0x2819910
+IOVSvcTool          DEBUG registering proxy [Dooo:6666/old] at 0xc56300
+IOVSvcTool          DEBUG replace proxy [Dooo:6666/old] @0xc56300 with [Dooo:6666/new] @0xc6e260
 *** IOVSvcTool_test OK ***
diff --git a/Control/PileUpComps/src/BkgStreamsCache.cxx b/Control/PileUpComps/src/BkgStreamsCache.cxx
index 460afb5c634..446db333cba 100644
--- a/Control/PileUpComps/src/BkgStreamsCache.cxx
+++ b/Control/PileUpComps/src/BkgStreamsCache.cxx
@@ -139,7 +139,7 @@ BkgStreamsCache::setup(int firstXing,
         {
           m_streams.emplace_back(streamName,serviceLocator(),selecName);
         }
-      catch (std::runtime_error e)
+      catch (const std::runtime_error& e)
         {
           ATH_MSG_ERROR ( "Exception thrown while creating PileUpStream "
                           << streamName << " : " << e.what() );
diff --git a/Control/PileUpComps/src/BkgStreamsConcentricCache.cxx b/Control/PileUpComps/src/BkgStreamsConcentricCache.cxx
index 447e3e18cfa..65b48e0667c 100644
--- a/Control/PileUpComps/src/BkgStreamsConcentricCache.cxx
+++ b/Control/PileUpComps/src/BkgStreamsConcentricCache.cxx
@@ -154,7 +154,7 @@ BkgStreamsConcentricCache::setup(int firstXing,
     const std::string& streamName(bufName.str());    
     try {
       m_streams.push_back(PileUpStream(streamName,serviceLocator(),selecName)); 
-    } catch (std::runtime_error e) {
+    } catch (const std::runtime_error& e) {
       ATH_MSG_ERROR ( "Exception thrown while creating PileUpStream " 
 		      << streamName << " : " << e.what() );     
       return StatusCode::FAILURE;
@@ -471,7 +471,7 @@ BkgStreamsConcentricCache::Ring::Ring(const string& prop) :
     try {
       m_lowXing = boost::lexical_cast<long>(*token++);
       m_hiXing = boost::lexical_cast<long>(*token);
-    } catch (boost::bad_lexical_cast e) {
+    } catch (const boost::bad_lexical_cast& e) {
       OK = false;
     }
   }
diff --git a/Control/PileUpComps/src/BkgStreamsStepCache.cxx b/Control/PileUpComps/src/BkgStreamsStepCache.cxx
index f3ab8ccb199..4c3a238b3ab 100644
--- a/Control/PileUpComps/src/BkgStreamsStepCache.cxx
+++ b/Control/PileUpComps/src/BkgStreamsStepCache.cxx
@@ -136,7 +136,7 @@ BkgStreamsStepCache::setup(int firstXing,
     const std::string& streamName(bufName.str());
     try {
       m_streams.push_back(PileUpStream(streamName,serviceLocator(),selecName));
-    } catch (std::runtime_error e) {
+    } catch (const std::runtime_error& e) {
       ATH_MSG_ERROR ( "Exception thrown while creating PileUpStream "
                       << streamName << " : " << e.what() );
       return StatusCode::FAILURE;
diff --git a/Control/PileUpComps/src/SplitBkgStreamsCache.cxx b/Control/PileUpComps/src/SplitBkgStreamsCache.cxx
index fe2cb7a3340..a47a08fc557 100644
--- a/Control/PileUpComps/src/SplitBkgStreamsCache.cxx
+++ b/Control/PileUpComps/src/SplitBkgStreamsCache.cxx
@@ -167,7 +167,7 @@ SplitBkgStreamsCache::setup(int firstXing,
 	{
 	  m_streams1.push_back(PileUpStream(streamName,serviceLocator(),selecName1)); 
 	} 
-      catch (std::runtime_error e) 
+      catch (const std::runtime_error& e) 
 	{
 	  ATH_MSG_ERROR ( "Exception thrown while creating PileUpStream " 
 			  << streamName << " : " << e.what() );     
@@ -193,7 +193,7 @@ SplitBkgStreamsCache::setup(int firstXing,
 	{
 	  m_streams2.push_back(PileUpStream(streamName,serviceLocator(),selecName2)); 
 	} 
-      catch (std::runtime_error e) 
+      catch (const std::runtime_error& e) 
 	{
 	  ATH_MSG_ERROR ( "Exception thrown while creating PileUpStream " 
 			  << streamName << " : " << e.what() );     
diff --git a/Control/RngComps/CMakeLists.txt b/Control/RngComps/CMakeLists.txt
index 2f577ce4761..e2a4aa984de 100644
--- a/Control/RngComps/CMakeLists.txt
+++ b/Control/RngComps/CMakeLists.txt
@@ -52,7 +52,7 @@ atlas_add_test( AtDSFMT_test
    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
    LINK_LIBRARIES ${CLHEP_LIBRARIES} TestTools AthenaKernel StoreGateLib
    GaudiKernel
-   EXTRA_PATTERNS "^IncidentSvc *DEBUG Adding .* listener|^JobOptionsSvc +INFO|DEBUG Property update for OutputLevel"
+   EXTRA_PATTERNS "^IncidentSvc *DEBUG Adding .* listener|^JobOptionsSvc +INFO|DEBUG Property update for OutputLevel|^ServiceManager *DEBUG Initializing service"
    ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share"  )
 set_property( TEST RngComps_AtDSFMT_test_ctest APPEND PROPERTY
               ENVIRONMENT "ATLAS_REFERENCE_TAG=${RNGCOMPS_REFERENCE_TAG}" )
diff --git a/Control/RngComps/share/AtRanlux_test.ref b/Control/RngComps/share/AtRanlux_test.ref
index a2166d11bc1..5a9ba67517b 100644
--- a/Control/RngComps/share/AtRanlux_test.ref
+++ b/Control/RngComps/share/AtRanlux_test.ref
@@ -1,7 +1,7 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/AtRanlux_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/RngComps/share/../share/AtRanlux_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/RngComps/share/../share/AtRanlux_test.txt
 JobOptionsSvc        INFO # (5,1): ApplicationMgr.DLLs += ["AthenaServices"]
 JobOptionsSvc        INFO # (6,1): ApplicationMgr.ExtSvc += ["AtRanluxGenSvc", "AtRanluxGenSvc/AtRanluxGenSvc2", "AtRanluxGenSvc/AtRanluxGenSvc3"]
 JobOptionsSvc        INFO # (7,1): ApplicationMgr.ExtSvcCreates = 0
@@ -17,16 +17,20 @@ JobOptionsSvc        INFO # (23,1): AtRanluxGenSvc3.ReadFromFile = 1
 JobOptionsSvc        INFO # (24,1): AtRanluxGenSvc3.FileToRead = "test_AtRanluxGenSvc.out"
 JobOptionsSvc        INFO # (25,1): AtRanluxGenSvc3.SaveToFile = 0
 JobOptionsSvc        INFO Job options successfully read in from ../share/AtRanlux_test.txt
+MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
-                                          running on lxplus020.cern.ch on Mon Dec 11 13:31:06 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 18:29:20 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
+ServiceManager      DEBUG Initializing service IncidentSvc
 IncidentSvc         DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
 EventDataSvc        DEBUG Service base class initialized successfully
diff --git a/Control/RngComps/share/AtRndmGen_test.ref b/Control/RngComps/share/AtRndmGen_test.ref
index 72d443e00c5..a8e1457403f 100644
--- a/Control/RngComps/share/AtRndmGen_test.ref
+++ b/Control/RngComps/share/AtRndmGen_test.ref
@@ -1,7 +1,7 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/AtRndmGen_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/RngComps/share/../share/AtRndmGen_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/RngComps/share/../share/AtRndmGen_test.txt
 JobOptionsSvc        INFO # (5,1): ApplicationMgr.DLLs += ["AthenaServices"]
 JobOptionsSvc        INFO # (7,1): ApplicationMgr.ExtSvc += ["AtRndmGenSvc", "AtRndmGenSvc/AtRndmGenSvc2", "AtRndmGenSvc/AtRndmGenSvc3"]
 JobOptionsSvc        INFO # (8,1): ApplicationMgr.ExtSvcCreates = 0
@@ -18,16 +18,20 @@ JobOptionsSvc        INFO # (25,1): AtRndmGenSvc3.ReadFromFile = 1
 JobOptionsSvc        INFO # (26,1): AtRndmGenSvc3.FileToRead = "test_AtRndmGenSvc.out"
 JobOptionsSvc        INFO # (27,1): AtRndmGenSvc3.SaveToFile = 0
 JobOptionsSvc        INFO Job options successfully read in from ../share/AtRndmGen_test.txt
+MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
-                                          running on lxplus020.cern.ch on Mon Dec 11 13:31:47 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 18:23:40 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
+ServiceManager      DEBUG Initializing service IncidentSvc
 IncidentSvc         DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
 EventDataSvc        DEBUG Service base class initialized successfully
diff --git a/Control/RngComps/share/RNGWrapper_test.ref b/Control/RngComps/share/RNGWrapper_test.ref
new file mode 100644
index 00000000000..681daa30260
--- /dev/null
+++ b/Control/RngComps/share/RNGWrapper_test.ref
@@ -0,0 +1 @@
+RNGWapper_test
diff --git a/Control/RngComps/src/interpretSeeds.cxx b/Control/RngComps/src/interpretSeeds.cxx
index 38eadccb5ba..20e2e0d4f06 100644
--- a/Control/RngComps/src/interpretSeeds.cxx
+++ b/Control/RngComps/src/interpretSeeds.cxx
@@ -52,7 +52,7 @@ bool interpretSeeds(const std::string& buffer,
 #if defined(__GNUC__) && !defined(__clang__)
 #pragma GCC diagnostic pop
 #endif
-    } catch (boost::bad_lexical_cast e) {
+    } catch (const boost::bad_lexical_cast& e) {
       status = false;
     }
   }
@@ -84,7 +84,7 @@ bool interpretSeeds(const std::string& buffer,
 #pragma GCC diagnostic pop
 #endif
       }
-    } catch (boost::bad_lexical_cast e) {
+    } catch (const boost::bad_lexical_cast& e) {
       status = false;
     }
   }
diff --git a/Control/RngComps/test/RNGWrapper_test.cxx b/Control/RngComps/test/RNGWrapper_test.cxx
index 3e2922c6710..03051976d98 100644
--- a/Control/RngComps/test/RNGWrapper_test.cxx
+++ b/Control/RngComps/test/RNGWrapper_test.cxx
@@ -91,6 +91,8 @@ private:
 
 
 int main() {
+
+    std::cout << "RNGWapper_test\n";
     
     std::function< CLHEP::HepRandomEngine*(void) > dSFMTFactory = [](void)->CLHEP::HepRandomEngine* { 
       return new CLHEP::dSFMTEngine(); 
diff --git a/Control/SGComps/share/SGFolder_test.ref b/Control/SGComps/share/SGFolder_test.ref
index a9b9c41f946..6451663fe62 100644
--- a/Control/SGComps/share/SGFolder_test.ref
+++ b/Control/SGComps/share/SGFolder_test.ref
@@ -2,19 +2,22 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/SGFolder_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/SGComps/share/../share/SGFolder_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/SGComps/share/../share/SGFolder_test.txt
 JobOptionsSvc        INFO # (5,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO # (6,1): ToolSvc.MyFolder.ItemList = ["Foo#Bla", "Bar#*", "8101", "8107#", "Baricco#*"]
 JobOptionsSvc        INFO # (7,1): ToolSvc.MyFolder.CheckItems = 1
 JobOptionsSvc        INFO Job options successfully read in from ../share/SGFolder_test.txt
+MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
-                                          running on lxplus020.cern.ch on Mon Dec 11 13:32:57 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 16:09:24 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
+ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
+ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
@@ -31,9 +34,9 @@ ApplicationMgr Ready
 ToolSvc             DEBUG Service base class initialized successfully
 ClassIDSvc          DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [ModuleLoaded] listener 'ClassIDSvc' with priority 100
-ClassIDSvc           INFO  getRegistryEntries: read 1207 CLIDRegistry entries for module ALL
-ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-opt/x86_64-slc6-gcc62-opt/share/clid.db
-ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-12-10T2303/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/clid.db
+ClassIDSvc           INFO  getRegistryEntries: read 1206 CLIDRegistry entries for module ALL
+ClassIDSvc          DEBUG processCLIDDB: read 1484 entries from CLIDDB file: /home/leggett/work/v30r1.002/bld/x86_64-slc6-gcc62-dbg/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 1484 entries from CLIDDB file: /bld2/build/v30r1.002/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/clid.db
 ToolSvc.MyFolder  WARNING add: can not find type [Baricco] in clid db
 ToolSvc.MyFolder  WARNING add: can not find type [basfbojjvd] in clid db
 ToolSvc.MyFolder  WARNING add: can not find type [cucu] in clid db
diff --git a/Control/StoreGate/share/SGHive_test.ref b/Control/StoreGate/share/SGHive_test.ref
index 5b908077c15..83f5c859c06 100644
--- a/Control/StoreGate/share/SGHive_test.ref
+++ b/Control/StoreGate/share/SGHive_test.ref
@@ -2,15 +2,15 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/SGHive_test.txt
-JobOptionsSvc        INFO # =======> /home/leggett/work/v30r0/src/Control/StoreGate/share/../share/SGHive_test.txt
+JobOptionsSvc        INFO # =======> /home/leggett/work/v30r1.002/src/Control/StoreGate/share/../share/SGHive_test.txt
 JobOptionsSvc        INFO # (1,1): StoreGateSvc.OutputLevel = 1
 JobOptionsSvc        INFO # (2,1): HiveMgrSvc.OutputLevel = 1
 JobOptionsSvc        INFO # (3,1): HiveMgrSvc.NSlots = 4
 JobOptionsSvc        INFO Job options successfully read in from ../share/SGHive_test.txt
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on zeus.lbl.gov on Fri Nov 17 11:22:53 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r1)
+                                          running on zeus on Tue Jan  2 16:20:50 2018
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
@@ -25,20 +25,30 @@ StoreGateSvc        DEBUG Property update for OutputLevel : new value = 1
 StoreGateSvc        DEBUG Service base class initialized successfully
 StoreGateSvc      VERBOSE Initializing StoreGateSvc - package version StoreGate-00-00-00
 StoreGateSvc        DEBUG trying to create store SGImplSvc/StoreGateSvc_Impl
+StoreGateSvc_Impl   DEBUG Property update for OutputLevel : new value = 1
 StoreGateSvc_Impl VERBOSE Initializing StoreGateSvc_Impl - package version StoreGate-00-00-00
+StoreGateSvc_Impl   DEBUG Service base class initialized successfully
 StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service EventPersistencySvc
 ClassIDSvc           INFO  getRegistryEntries: read 172 CLIDRegistry entries for module ALL
 StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
+0_StoreGateSvc_...  DEBUG Property update for OutputLevel : new value = 1
 0_StoreGateSvc_...VERBOSE Initializing 0_StoreGateSvc_Impl - package version StoreGate-00-00-00
+0_StoreGateSvc_...  DEBUG Service base class initialized successfully
 0_StoreGateSvc_...VERBOSE ServiceLocatorHelper::service: found service EventPersistencySvc
 0_StoreGateSvc_...VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
+1_StoreGateSvc_...  DEBUG Property update for OutputLevel : new value = 1
 1_StoreGateSvc_...VERBOSE Initializing 1_StoreGateSvc_Impl - package version StoreGate-00-00-00
+1_StoreGateSvc_...  DEBUG Service base class initialized successfully
 1_StoreGateSvc_...VERBOSE ServiceLocatorHelper::service: found service EventPersistencySvc
 1_StoreGateSvc_...VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
+2_StoreGateSvc_...  DEBUG Property update for OutputLevel : new value = 1
 2_StoreGateSvc_...VERBOSE Initializing 2_StoreGateSvc_Impl - package version StoreGate-00-00-00
+2_StoreGateSvc_...  DEBUG Service base class initialized successfully
 2_StoreGateSvc_...VERBOSE ServiceLocatorHelper::service: found service EventPersistencySvc
 2_StoreGateSvc_...VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
+3_StoreGateSvc_...  DEBUG Property update for OutputLevel : new value = 1
 3_StoreGateSvc_...VERBOSE Initializing 3_StoreGateSvc_Impl - package version StoreGate-00-00-00
+3_StoreGateSvc_...  DEBUG Service base class initialized successfully
 3_StoreGateSvc_...VERBOSE ServiceLocatorHelper::service: found service EventPersistencySvc
 3_StoreGateSvc_...VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
 Now we expect to see an error message:
@@ -67,37 +77,37 @@ HiveMgrSvc          DEBUG Freed slot 1
 HiveMgrSvc          DEBUG Slot 1 allocated to event number 333333
 
 *** SGHive_test noSlot BEGINS ***
-ClassIDSvc           INFO  getRegistryEntries: read 930 CLIDRegistry entries for module ALL
-StoreGateSvc_Impl VERBOSE committing dataObj "('SG::Foo','blassed')"
-StoreGateSvc_Impl   DEBUG Recorded object @0x1d4f900 with key pFoo1 of type SG::Foo(CLID 81010)
- in DataObject @0x1e0ce30
+ClassIDSvc           INFO  getRegistryEntries: read 931 CLIDRegistry entries for module ALL
+StoreGateSvc_Impl VERBOSE committing dataObj " ( 'SG::Foo' , 'blassed' ) "
+StoreGateSvc_Impl   DEBUG Recorded object @0x29b6750 with key pFoo1 of type SG::Foo(CLID 81010)
+ in DataObject @0x2994690
  object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x1db42d0 with key pFoo2 of type SG::Foo(CLID 81010)
- in DataObject @0x1d96090
+StoreGateSvc_Impl   DEBUG Recorded object @0x2a29770 with key pFoo2 of type SG::Foo(CLID 81010)
+ in DataObject @0x2a99200
  object modifiable when retrieved
-StoreGateSvc_Impl VERBOSE committing dataObj "('SG::Foo','pFoo2')"
-StoreGateSvc_Impl VERBOSE committing dataObj "('SG::Foo','pFoo1')"
-StoreGateSvc_Impl   DEBUG Recorded object @0x1e3ebe0 with key pFoo3 of type SG::Foo(CLID 81010)
- in DataObject @0x1d61480
+StoreGateSvc_Impl VERBOSE committing dataObj " ( 'SG::Foo' , 'pFoo2' ) "
+StoreGateSvc_Impl VERBOSE committing dataObj " ( 'SG::Foo' , 'pFoo1' ) "
+StoreGateSvc_Impl   DEBUG Recorded object @0x2a999e0 with key pFoo3 of type SG::Foo(CLID 81010)
+ in DataObject @0x2a29140
  object modifiable when retrieved
-StoreGateSvc_Impl VERBOSE committing dataObj "('SG::Foo','pFoo3')"
+StoreGateSvc_Impl VERBOSE committing dataObj " ( 'SG::Foo' , 'pFoo3' ) "
 
 *** SGHive_test noSlot ENDS ***
 
 *** SGHive_test withSlot BEGINS ***
-0_StoreGateSvc_...VERBOSE committing dataObj "('SG::Foo','blassed')"
-0_StoreGateSvc_...  DEBUG Recorded object @0x1e41b20 with key pFoo1 of type SG::Foo(CLID 81010)
- in DataObject @0x1e7d530
+0_StoreGateSvc_...VERBOSE committing dataObj " ( 'SG::Foo' , 'blassed' ) "
+0_StoreGateSvc_...  DEBUG Recorded object @0x2a29790 with key pFoo1 of type SG::Foo(CLID 81010)
+ in DataObject @0x297b420
  object modifiable when retrieved
-0_StoreGateSvc_...  DEBUG Recorded object @0x1e43120 with key pFoo2 of type SG::Foo(CLID 81010)
- in DataObject @0x1e0d680
+0_StoreGateSvc_...  DEBUG Recorded object @0x2a5ea70 with key pFoo2 of type SG::Foo(CLID 81010)
+ in DataObject @0x298d210
  object modifiable when retrieved
-0_StoreGateSvc_...VERBOSE committing dataObj "('SG::Foo','pFoo2')"
-0_StoreGateSvc_...VERBOSE committing dataObj "('SG::Foo','pFoo1')"
-0_StoreGateSvc_...  DEBUG Recorded object @0x1e0d6d0 with key pFoo3 of type SG::Foo(CLID 81010)
- in DataObject @0x1e0d120
+0_StoreGateSvc_...VERBOSE committing dataObj " ( 'SG::Foo' , 'pFoo2' ) "
+0_StoreGateSvc_...VERBOSE committing dataObj " ( 'SG::Foo' , 'pFoo1' ) "
+0_StoreGateSvc_...  DEBUG Recorded object @0x2a5e7f0 with key pFoo3 of type SG::Foo(CLID 81010)
+ in DataObject @0x2a5ef20
  object modifiable when retrieved
-0_StoreGateSvc_...VERBOSE committing dataObj "('SG::Foo','pFoo3')"
+0_StoreGateSvc_...VERBOSE committing dataObj " ( 'SG::Foo' , 'pFoo3' ) "
 
 *** SGHive_test withSlot ENDS ***
 StoreGateSvc      VERBOSE Finalizing StoreGateSvc - package version StoreGate-00-00-00
diff --git a/Control/StoreGate/src/SGHiveMgrSvc.cxx b/Control/StoreGate/src/SGHiveMgrSvc.cxx
index 2fe5815d1f9..13d3fe10bd7 100644
--- a/Control/StoreGate/src/SGHiveMgrSvc.cxx
+++ b/Control/StoreGate/src/SGHiveMgrSvc.cxx
@@ -133,7 +133,7 @@ size_t HiveMgrSvc::getPartitionNumber(int evtNumber) const {
   return std::string::npos;
 }
 
-unsigned int HiveMgrSvc::freeSlots() {
+size_t HiveMgrSvc::freeSlots() {
   return m_freeSlots;
 }
 
diff --git a/Control/StoreGate/src/SGHiveMgrSvc.h b/Control/StoreGate/src/SGHiveMgrSvc.h
index 046f597e063..beea28d5b0d 100644
--- a/Control/StoreGate/src/SGHiveMgrSvc.h
+++ b/Control/StoreGate/src/SGHiveMgrSvc.h
@@ -107,7 +107,7 @@ public:
   virtual size_t getPartitionNumber(int eventnumber) const override;
   
   /// Get free slots number
-  virtual unsigned int freeSlots() override;
+  virtual size_t freeSlots() override;
     
   //@{ @name Gaudi Service boilerplate
   virtual StatusCode initialize() override;
@@ -127,7 +127,7 @@ private:
   ServiceHandle<StoreGateSvc> m_hiveStore;
   size_t m_nSlots; //property settable also by setNumberOfStores
   std::vector<SG::HiveEventSlot> m_slots;
-    std::atomic<unsigned int> m_freeSlots {0};
+    std::atomic<size_t> m_freeSlots {0};
   //maybe  ServiceHandle<ActiveStoreSvc> m_active;
 
 };
diff --git a/Control/StoreGate/src/StoreGate.cxx b/Control/StoreGate/src/StoreGate.cxx
index 875e1ecfbdf..4d0a1ff90c6 100644
--- a/Control/StoreGate/src/StoreGate.cxx
+++ b/Control/StoreGate/src/StoreGate.cxx
@@ -51,7 +51,7 @@ getStore() {
 }
 
 StoreGateSvc* 
-getStore(std::string name) throw (std::runtime_error) {
+getStore(std::string name) {
   StoreGateSvc* pSGService(0);
   static const bool CREATEIF(true);
   if ((Gaudi::svcLocator()->service(name, pSGService, CREATEIF)).isSuccess()) {
diff --git a/Control/xAODRootAccess/share/ut_xaodrootaccess_tauxstore_test.ref b/Control/xAODRootAccess/share/ut_xaodrootaccess_tauxstore_test.ref
index d3f8cfa1d96..d764c97bba7 100644
--- a/Control/xAODRootAccess/share/ut_xaodrootaccess_tauxstore_test.ref
+++ b/Control/xAODRootAccess/share/ut_xaodrootaccess_tauxstore_test.ref
@@ -14,8 +14,8 @@ ut_xaodrootaccess_taux... INFO    Environment initialised for data access
 *............................................................................*
 ut_xaodrootaccess_taux... INFO    Created transient input TTree for the test
 ut_xaodrootaccess_taux... INFO    Auxiliary variables found on the input:
-ut_xaodrootaccess_taux... INFO      - id: 1, name: var2, type: float
-ut_xaodrootaccess_taux... INFO      - id: 0, name: var1, type: float
+ut_xaodrootaccess_taux... INFO      - name: var1, type: float
+ut_xaodrootaccess_taux... INFO      - name: var2, type: float
 ******************************************************************************
 *Tree    :OutputTree: Output Tree                                            *
 *Entries :        1 : Total =            1953 bytes  File  Size =          0 *
diff --git a/Control/xAODRootAccess/test/ut_xaodrootaccess_tauxstore_test.cxx b/Control/xAODRootAccess/test/ut_xaodrootaccess_tauxstore_test.cxx
index b89fd497a94..107ca8a8f3f 100644
--- a/Control/xAODRootAccess/test/ut_xaodrootaccess_tauxstore_test.cxx
+++ b/Control/xAODRootAccess/test/ut_xaodrootaccess_tauxstore_test.cxx
@@ -19,6 +19,8 @@
 #include "xAODRootAccess/TAuxStore.h"
 #include "xAODRootAccess/tools/ReturnCheck.h"
 
+#include "CxxUtils/StrFormat.h"
+
 /// Helper macro for evaluating logical tests
 #define SIMPLE_ASSERT( EXP )                                            \
    do {                                                                 \
@@ -73,11 +75,15 @@ int main() {
 
    // Check that it found the two variables that it needed to:
    ::Info( APP_NAME, "Auxiliary variables found on the input:" );
-   for( auto auxid : store.getAuxIDs() ) {
-      ::Info( APP_NAME, "  - id: %i, name: %s, type: %s",
-              static_cast< int >( auxid ),
-              reg.getName( auxid ).c_str(),
-              reg.getTypeName( auxid ).c_str() );
+   std::vector<std::string> vars;
+   for( SG::auxid_t auxid : store.getAuxIDs() ) {
+     vars.push_back (CxxUtils::strformat ("  - name: %s, type: %s",
+                                          reg.getName( auxid ).c_str(),
+                                          reg.getTypeName( auxid ).c_str() ));
+   }
+   std::sort (vars.begin(), vars.end());
+   for (const std::string& s : vars) {
+      ::Info( APP_NAME, "%s", s.c_str());
    }
    SIMPLE_ASSERT( store.getAuxIDs().size() == 2 );
 
diff --git a/Database/APR/CollectionBase/src/CollectionFactory.cpp b/Database/APR/CollectionBase/src/CollectionFactory.cpp
index d3c0f74ef0e..a674507845b 100755
--- a/Database/APR/CollectionBase/src/CollectionFactory.cpp
+++ b/Database/APR/CollectionBase/src/CollectionFactory.cpp
@@ -197,7 +197,7 @@ pool::CollectionFactory::createAndRegister( const pool::ICollectionDescription&
      try {
         fcRegister.registerLFN( physicalName, logicalName );
      } 
-     catch( pool::FCduplicateLFNException )
+     catch( const pool::FCduplicateLFNException& )
      {}
   }
   if( metadata ) {
@@ -341,7 +341,7 @@ pool::CollectionFactory::registerExisting( pool::ICollection* collection,
       try    {
 	 fcRegister.registerLFN( physicalName, logicalName );
       } 
-      catch( pool::FCduplicateLFNException ){};
+      catch( const pool::FCduplicateLFNException& ){};
    }
    if( metadata )  {
       fcRegister.registerMetaData( guid, *metadata );
diff --git a/Database/APR/PersistencySvc/PersistencySvc/IPersistencySvc.h b/Database/APR/PersistencySvc/PersistencySvc/IPersistencySvc.h
index 68fc3f20b63..aff2a2e3dce 100644
--- a/Database/APR/PersistencySvc/PersistencySvc/IPersistencySvc.h
+++ b/Database/APR/PersistencySvc/PersistencySvc/IPersistencySvc.h
@@ -8,7 +8,7 @@
 #define PERSISTENCYSVC_IPERSISTENCYSVC
 
 #include <string>
-#include <utility>
+#include <memory>
 
 class Placement;
 class Token;
@@ -32,8 +32,8 @@ namespace pool {
   class IPersistencySvc { 
   public:
 
-    /// Constructor
-    explicit IPersistencySvc( IFileCatalog& ) {}
+    /// Factory for PersistencySvc
+    static std::unique_ptr<IPersistencySvc> create( IFileCatalog& catalog );
 
     /// Empty destructor
     virtual ~IPersistencySvc() {}
diff --git a/Database/APR/PersistencySvc/PersistencySvc/IPersistencySvcFactory.h b/Database/APR/PersistencySvc/PersistencySvc/IPersistencySvcFactory.h
deleted file mode 100644
index 2e2da6c65af..00000000000
--- a/Database/APR/PersistencySvc/PersistencySvc/IPersistencySvcFactory.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef PERSISTENCYSVC_IPERSISTENCYSVCFACTORY_H
-#define PERSISTENCYSVC_IPERSISTENCYSVCFACTORY_H
-
-#include "PersistencySvc/IPersistencySvc.h"
-
-namespace pool {
-
-  // This class signature has been kept only for backward compatibility.
-  class IPersistencySvcFactory
-  {
-  public:
-    static IPersistencySvcFactory* get();
-
-    IPersistencySvc* create(const std::string& className, IFileCatalog& catalog );
-  private:
-    IPersistencySvcFactory();
-  };
-
-}
-
-#endif
diff --git a/Database/APR/PersistencySvc/src/IPersistencySvc.cpp b/Database/APR/PersistencySvc/src/IPersistencySvc.cpp
new file mode 100644
index 00000000000..071e7ef9b98
--- /dev/null
+++ b/Database/APR/PersistencySvc/src/IPersistencySvc.cpp
@@ -0,0 +1,12 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "PersistencySvc/IPersistencySvc.h"
+#include "PersistencySvc.h"
+
+std::unique_ptr< pool::IPersistencySvc >
+pool::IPersistencySvc::create( IFileCatalog& catalog )
+{
+   return std::unique_ptr<IPersistencySvc>( new PersistencySvc::PersistencySvc(catalog) );
+}
diff --git a/Database/APR/PersistencySvc/src/IPersistencySvcFactory.cpp b/Database/APR/PersistencySvc/src/IPersistencySvcFactory.cpp
deleted file mode 100644
index cc39aef7df6..00000000000
--- a/Database/APR/PersistencySvc/src/IPersistencySvcFactory.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "PersistencySvc/IPersistencySvcFactory.h"
-#include "PersistencySvc.h"
-
-pool::IPersistencySvcFactory::IPersistencySvcFactory(){}
-
-pool::IPersistencySvc* pool::IPersistencySvcFactory::create(const std::string& className, IFileCatalog& catalog ){
-  IPersistencySvc* ret = 0;
-  if(className=="PersistencySvc") ret = new pool::PersistencySvc::PersistencySvc(catalog);
-  return ret;
-}
-
-pool::IPersistencySvcFactory*
-pool::IPersistencySvcFactory::get()
-{
-  static pool::IPersistencySvcFactory s_instance;
-  return &s_instance;
-}
diff --git a/Database/APR/PersistencySvc/src/PersistencySvc.cpp b/Database/APR/PersistencySvc/src/PersistencySvc.cpp
index 42aa561c72f..dcbdc022f3e 100644
--- a/Database/APR/PersistencySvc/src/PersistencySvc.cpp
+++ b/Database/APR/PersistencySvc/src/PersistencySvc.cpp
@@ -17,7 +17,6 @@
 #include "PersistentDataModel/Placement.h"
 
 pool::PersistencySvc::PersistencySvc::PersistencySvc( pool::IFileCatalog& fileCatalog ):
-  pool::IPersistencySvc( fileCatalog ),
   m_session( new pool::PersistencySvc::UserSession( fileCatalog ) )
 {}
 
diff --git a/Database/APR/RootStorageSvc/src/RootTreeContainer.cpp b/Database/APR/RootStorageSvc/src/RootTreeContainer.cpp
index 73b54f6ba9a..2436d841e57 100755
--- a/Database/APR/RootStorageSvc/src/RootTreeContainer.cpp
+++ b/Database/APR/RootStorageSvc/src/RootTreeContainer.cpp
@@ -210,7 +210,7 @@ DbStatus RootTreeContainer::writeObject(TransactionStack::value_type& ent) {
                    // FIXME: may be able to get rid of this copy
                    // if we switch to a thread-safe container.
                    const SG::auxid_set_t ids = store->getSelectedAuxIDs();
-                   for(auto &id : ids ) {
+                   for(SG::auxid_t id : ids ) {
                       BranchDesc&       newBrDsc( m_auxBranchMap[id] );
                       if( !newBrDsc.branch ) {
                          auto &reg = SG::AuxTypeRegistry::instance();
diff --git a/Database/APR/StorageSvc/StorageSvc/DbIter.h b/Database/APR/StorageSvc/StorageSvc/DbIter.h
index bf9afbf563a..7c40fa78c4a 100644
--- a/Database/APR/StorageSvc/StorageSvc/DbIter.h
+++ b/Database/APR/StorageSvc/StorageSvc/DbIter.h
@@ -87,7 +87,7 @@ namespace pool  {
     /// Dereference operator
     T* object()  const                  {    return m_obj.ptr();              }
     /// Access to cursor token
-    const Token* token() const          {    return m_token;                  }
+    const Token* token() const          {    return &m_token;                 }
     /// Scan the container
     DbStatus scan(const DbContainer& cntH, const DbTypeInfo* typ);
     /// Retrieve next element
diff --git a/Database/APR/Tests/CMakeLists.txt b/Database/APR/Tests/CMakeLists.txt
index 8ee16a660fb..7d634f3c97d 100644
--- a/Database/APR/Tests/CMakeLists.txt
+++ b/Database/APR/Tests/CMakeLists.txt
@@ -59,6 +59,7 @@ function( _add_test name )
 endfunction( _add_test )
 
 # Declare the test(s) of the package:
+_add_test( FileCatalog_Functionality )
 _add_test( StorageSvc_BasicFunctionality )
 _add_test( StorageSvc_AuxStore
   DICTHEADER StorageSvc_AuxStore/AuxStoreTest.h
diff --git a/Database/APR/Tests/FileCatalog_Functionality/FCtest.cpp b/Database/APR/Tests/FileCatalog_Functionality/FCtest.cpp
index 44ad4fd4c26..916904001d3 100644
--- a/Database/APR/Tests/FileCatalog_Functionality/FCtest.cpp
+++ b/Database/APR/Tests/FileCatalog_Functionality/FCtest.cpp
@@ -210,4 +210,5 @@ public:
 
 CPPUNIT_TEST_SUITE_REGISTRATION(FCtest);
 //#include<CppUnit_testdriver.cpp>
-//#include<TestPolicy/CppUnit_testdriver.cxx>
+#include<TestPolicy/CppUnit_testdriver.cxx>
+
diff --git a/Database/APR/Tests/PersistencySvc_FileCatalogOperations/TestDriver.cpp b/Database/APR/Tests/PersistencySvc_FileCatalogOperations/TestDriver.cpp
index f224d75bc8c..026c6b2b5e6 100644
--- a/Database/APR/Tests/PersistencySvc_FileCatalogOperations/TestDriver.cpp
+++ b/Database/APR/Tests/PersistencySvc_FileCatalogOperations/TestDriver.cpp
@@ -25,9 +25,8 @@
 #include "PersistencySvc/IDatabase.h"
 #include "PersistencySvc/IContainer.h"
 #include "PersistencySvc/ITokenIterator.h"
-
 #include "PersistencySvc/IPersistencySvc.h"
-#include "PersistencySvc/IPersistencySvcFactory.h"
+
 
 int numTokenInstances();
 
@@ -62,15 +61,7 @@ pool::TestDriver::write()
   pool::IFileCatalog& catalog = *m_fileCatalog;
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
-
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
   catalog.start();
 
   // Set up the policy.
@@ -143,14 +134,7 @@ pool::TestDriver::read()
   pool::IFileCatalog& catalog = *m_fileCatalog;
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
   catalog.start();
 
   // Starting a read transaction
diff --git a/Database/APR/Tests/PersistencySvc_FileOpenWithoutCatalog/TestDriver.cpp b/Database/APR/Tests/PersistencySvc_FileOpenWithoutCatalog/TestDriver.cpp
index df008832391..f51a88696d7 100644
--- a/Database/APR/Tests/PersistencySvc_FileOpenWithoutCatalog/TestDriver.cpp
+++ b/Database/APR/Tests/PersistencySvc_FileOpenWithoutCatalog/TestDriver.cpp
@@ -24,9 +24,7 @@
 #include "PersistencySvc/IDatabase.h"
 #include "PersistencySvc/IContainer.h"
 #include "PersistencySvc/ITokenIterator.h"
-
 #include "PersistencySvc/IPersistencySvc.h"
-#include "PersistencySvc/IPersistencySvcFactory.h"
 
 int numTokenInstances();
 
@@ -59,14 +57,7 @@ pool::TestDriver::write()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Set up the policy.
   pool::DatabaseConnectionPolicy policy;
@@ -130,14 +121,7 @@ pool::TestDriver::read()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Starting a read transaction
   if ( ! persistencySvc->session().transaction().start( pool::ITransaction::READ ) ) {
diff --git a/Database/APR/Tests/PersistencySvc_Functionality/TestDriver.cpp b/Database/APR/Tests/PersistencySvc_Functionality/TestDriver.cpp
index 1091e71a3d7..1203ee4a569 100644
--- a/Database/APR/Tests/PersistencySvc_Functionality/TestDriver.cpp
+++ b/Database/APR/Tests/PersistencySvc_Functionality/TestDriver.cpp
@@ -27,7 +27,6 @@
 #include "PersistencySvc/ITokenIterator.h"
 
 #include "PersistencySvc/IPersistencySvc.h"
-#include "PersistencySvc/IPersistencySvcFactory.h"
 
 
 static const RootType emptyType;
@@ -76,14 +75,7 @@ pool::TestDriver::write()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Set up the policy.
   pool::DatabaseConnectionPolicy policy;
@@ -244,14 +236,7 @@ pool::TestDriver::read()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Starting a read transaction
   if ( ! persistencySvc->session().transaction().start( pool::ITransaction::READ ) ) {
@@ -350,17 +335,6 @@ pool::TestDriver::read()
 }
 
 
-void
-pool::TestDriver::testPlugins()
-{
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-}
-
-
-
 void
 pool::TestDriver::readCollections()
 {
@@ -368,14 +342,7 @@ pool::TestDriver::readCollections()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Starting a read transaction
   if ( ! persistencySvc->session().transaction().start( pool::ITransaction::READ ) ) {
@@ -441,14 +408,7 @@ pool::TestDriver::readBackUpdatedObjects()
   catalog.start();
   
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Starting a read transaction
   if ( ! persistencySvc->session().transaction().start( pool::ITransaction::READ ) ) {
@@ -519,14 +479,7 @@ pool::TestDriver::readFileSizes()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Starting a read transaction
   if ( ! persistencySvc->session().transaction().start( pool::ITransaction::READ ) ) {
diff --git a/Database/APR/Tests/PersistencySvc_Functionality/TestDriver.h b/Database/APR/Tests/PersistencySvc_Functionality/TestDriver.h
index 31ebf10c592..50498a7df56 100644
--- a/Database/APR/Tests/PersistencySvc_Functionality/TestDriver.h
+++ b/Database/APR/Tests/PersistencySvc_Functionality/TestDriver.h
@@ -25,7 +25,6 @@ namespace pool {
     TestDriver();
     ~TestDriver();
     void loadLibraries( const std::vector<std::string>& libraries );
-    void testPlugins();
     void write();
     void read();
     void readCollections();
diff --git a/Database/APR/Tests/PersistencySvc_Functionality/main.cpp b/Database/APR/Tests/PersistencySvc_Functionality/main.cpp
index 9aa5207959d..3a0c36a9d79 100644
--- a/Database/APR/Tests/PersistencySvc_Functionality/main.cpp
+++ b/Database/APR/Tests/PersistencySvc_Functionality/main.cpp
@@ -18,11 +18,6 @@ int main( int, char** ) {
     libraries.push_back( "test_TestDictionaryDict" );
     driver.loadLibraries( libraries );
     
-
-    std::cout << "[OVAL] Testing the plugins..." << std::endl;
-    driver.testPlugins();
-    std::cout << "[OVAL] ...done" << std::endl;
-
     std::cout << "[OVAL] Writing objects in the database." << std::endl;
     driver.write();
     std::cout << "[OVAL] ...done" << std::endl;
diff --git a/Database/APR/Tests/PersistencySvc_NoClassID/TestDriver.cpp b/Database/APR/Tests/PersistencySvc_NoClassID/TestDriver.cpp
index d0ce34c3984..d1f8d9060e2 100644
--- a/Database/APR/Tests/PersistencySvc_NoClassID/TestDriver.cpp
+++ b/Database/APR/Tests/PersistencySvc_NoClassID/TestDriver.cpp
@@ -26,7 +26,6 @@
 #include "PersistencySvc/ITokenIterator.h"
 
 #include "PersistencySvc/IPersistencySvc.h"
-#include "PersistencySvc/IPersistencySvcFactory.h"
 
 #include "MyTestClass.h"
 
@@ -62,14 +61,7 @@ pool::TestDriver::write()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Set up the policy.
   pool::DatabaseConnectionPolicy policy;
@@ -128,14 +120,7 @@ pool::TestDriver::read()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Starting a read transaction
   if ( ! persistencySvc->session().transaction().start( pool::ITransaction::READ ) ) {
diff --git a/Database/APR/Tests/PersistencySvc_Parameters/TestDriver.cpp b/Database/APR/Tests/PersistencySvc_Parameters/TestDriver.cpp
index 66414d46d28..2fa5d9d41b4 100644
--- a/Database/APR/Tests/PersistencySvc_Parameters/TestDriver.cpp
+++ b/Database/APR/Tests/PersistencySvc_Parameters/TestDriver.cpp
@@ -19,9 +19,8 @@
 #include "PersistencySvc/DatabaseConnectionPolicy.h"
 #include "PersistencySvc/IDatabase.h"
 #include "PersistencySvc/IDatabaseParameters.h"
-
 #include "PersistencySvc/IPersistencySvc.h"
-#include "PersistencySvc/IPersistencySvcFactory.h"
+
 
 int numTokenInstances();
 
@@ -55,14 +54,7 @@ pool::TestDriver::write()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Set up the policy.
   pool::DatabaseConnectionPolicy policy;
@@ -114,14 +106,7 @@ pool::TestDriver::read()
   catalog.start();
 
   std::cout << "Creating the persistency service" << std::endl;
-  pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-  if ( ! psfactory ) {
-    throw std::runtime_error( "Could not retrieve an IPersistencySvc factory" );
-  }
-  std::unique_ptr< pool::IPersistencySvc > persistencySvc( psfactory->create( "PersistencySvc", catalog ) );
-  if ( ! persistencySvc.get() ) {
-    throw std::runtime_error( "Could not create a PersistencySvc" );
-  }
+  std::unique_ptr< pool::IPersistencySvc > persistencySvc( pool::IPersistencySvc::create(catalog) );
 
   // Starting a read transaction
   if ( ! persistencySvc->session().transaction().start( pool::ITransaction::READ ) ) {
diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/CMakeLists.txt b/Database/AthenaPOOL/AthenaPoolCnvSvc/CMakeLists.txt
index 8ca751f789e..62e7f4b0a5c 100644
--- a/Database/AthenaPOOL/AthenaPoolCnvSvc/CMakeLists.txt
+++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/CMakeLists.txt
@@ -40,8 +40,7 @@ atlas_add_library( AthenaPoolCnvSvcLib
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
    LINK_LIBRARIES ${Boost_LIBRARIES} AthContainers AthContainersRoot AthLinks AthenaBaseComps
-   AthenaKernel CxxUtils DataModelRoot RootUtils SGTools CollectionBase
-   CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolUtilities
+   AthenaKernel CxxUtils DataModelRoot RootUtils SGTools StorageSvc AthenaPoolUtilities
    PersistentDataModel TPTools GaudiKernel StoreGateLib
    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} )
 
diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx
index 10f5921774a..f3ed4559c1f 100644
--- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx
+++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx
@@ -825,8 +825,8 @@ StatusCode AthenaPoolCnvSvc::createAddress(long svcType,
    if (par[0] == "SHM") {
       token = new Token();
       token->setOid(Token::OID_t(ip[0], ip[1]));
-      token->setAuxString("[PNAME=" + par[1] + "]");
-      RootType classDesc = RootType::ByName(par[1]);
+      token->setAuxString("[PNAME=" + par[2] + "]");
+      RootType classDesc = RootType::ByName(par[2]);
       token->setClassID(pool::DbReflex::guid(classDesc));
    } else if (!m_inputStreamingTool.empty() && m_inputStreamingTool->isClient()) {
       Token addressToken;
@@ -860,7 +860,11 @@ StatusCode AthenaPoolCnvSvc::createAddress(long svcType,
    if (token == nullptr) {
       return(StatusCode::RECOVERABLE);
    }
-   refpAddress = new TokenAddress(POOL_StorageType, clid, "", "", 0, token);
+   unsigned long ip0 = ip[0];
+   if (par[1].substr(0, 12) == "MetaDataHdr(") {
+     ip0 = 0;
+   }
+   refpAddress = new TokenAddress(POOL_StorageType, clid, "", par[1], ip0, token);
    return(StatusCode::SUCCESS);
 }
 //______________________________________________________________________________
diff --git a/Database/AthenaPOOL/AthenaPoolServices/CMakeLists.txt b/Database/AthenaPOOL/AthenaPoolServices/CMakeLists.txt
index ab38f5084a7..fef15323da2 100644
--- a/Database/AthenaPOOL/AthenaPoolServices/CMakeLists.txt
+++ b/Database/AthenaPOOL/AthenaPoolServices/CMakeLists.txt
@@ -11,10 +11,6 @@ atlas_depends_on_subdirs( PUBLIC
                           PRIVATE
                           Control/AthenaBaseComps
                           Control/DataModelRoot
-                          Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
-                          Database/APR/PersistencySvc
                           Database/APR/StorageSvc )
 
 # External dependencies:
@@ -27,7 +23,7 @@ atlas_add_component( AthenaRootStreamerSvc
                      src/AthenaRootStreamerSvc.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} GaudiKernel AthenaBaseComps DataModelRoot CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} GaudiKernel AthenaBaseComps DataModelRoot StorageSvc )
 
 # Install files from the package:
 atlas_install_headers( AthenaPoolServices )
diff --git a/Database/AthenaPOOL/DBDataModel/CMakeLists.txt b/Database/AthenaPOOL/DBDataModel/CMakeLists.txt
index a658d2d3041..f66f3c824b6 100644
--- a/Database/AthenaPOOL/DBDataModel/CMakeLists.txt
+++ b/Database/AthenaPOOL/DBDataModel/CMakeLists.txt
@@ -11,11 +11,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Control/DataModel
                           Control/SGTools
                           PRIVATE
-                          Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
-                          Database/APR/PersistencySvc
-                          Database/APR/StorageSvc )
+                          Database/APR/CollectionBase )
 
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
@@ -26,11 +22,11 @@ atlas_add_library( DBDataModel
                    PUBLIC_HEADERS DBDataModel
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
                    LINK_LIBRARIES DataModel SGTools
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc )
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} CollectionBase )
 
 atlas_add_dictionary( DBDataModelDict
                       DBDataModel/DBDataModelDict.h
                       DBDataModel/selection.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} DataModel SGTools CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc DBDataModel )
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} DataModel SGTools CollectionBase DBDataModel )
 
diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/CMakeLists.txt b/Database/AthenaPOOL/EventSelectorAthenaPool/CMakeLists.txt
index 6f2649203c3..13ab2ab05fc 100644
--- a/Database/AthenaPOOL/EventSelectorAthenaPool/CMakeLists.txt
+++ b/Database/AthenaPOOL/EventSelectorAthenaPool/CMakeLists.txt
@@ -11,10 +11,7 @@ atlas_depends_on_subdirs( PRIVATE
                           Control/AthenaKernel
                           Control/StoreGate
                           Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
                           Database/APR/PersistencySvc
-                          Database/APR/StorageSvc
                           Database/AthenaPOOL/AthenaPoolCnvSvc
                           Database/AthenaPOOL/AthenaPoolUtilities
                           Database/AthenaPOOL/DBDataModel
@@ -34,7 +31,7 @@ atlas_add_component( EventSelectorAthenaPool
                      src/registerKeys.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolCnvSvcLib AthenaPoolUtilities DBDataModel PersistentDataModel GaudiKernel )
+                     LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests CollectionBase PersistencySvc AthenaPoolCnvSvcLib AthenaPoolUtilities DBDataModel PersistentDataModel GaudiKernel )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/Database/AthenaPOOL/PoolSvc/CMakeLists.txt b/Database/AthenaPOOL/PoolSvc/CMakeLists.txt
index 9858c9f4183..835b4736120 100644
--- a/Database/AthenaPOOL/PoolSvc/CMakeLists.txt
+++ b/Database/AthenaPOOL/PoolSvc/CMakeLists.txt
@@ -11,14 +11,12 @@ atlas_depends_on_subdirs(
    PUBLIC
    Control/DataModelRoot
    Database/APR/CollectionBase
-   Database/APR/CollectionUtilities
-   Database/APR/POOLCore
    Database/APR/PersistencySvc
-   Database/APR/StorageSvc
    GaudiKernel
    PRIVATE
    Control/AthenaBaseComps
    Control/AthenaKernel
+   Database/APR/StorageSvc
    Database/ConnectionManagement/DBReplicaSvc
    Database/PersistentDataModel
    Tools/PathResolver )
@@ -30,9 +28,8 @@ find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
 atlas_add_component( PoolSvc
    PoolSvc/*.h src/*.cxx src/components/*.cxx
    INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
-   LINK_LIBRARIES ${CORAL_LIBRARIES} DataModelRoot CollectionBase
-   CollectionUtilities POOLCore PersistencySvc StorageSvc GaudiKernel
-   AthenaBaseComps AthenaKernel PersistentDataModel PathResolver )
+   LINK_LIBRARIES ${CORAL_LIBRARIES} DataModelRoot CollectionBase PersistencySvc GaudiKernel
+   AthenaBaseComps AthenaKernel StorageSvc PersistentDataModel PathResolver )
 
 # Install files from the package:
 atlas_install_headers( PoolSvc )
diff --git a/Database/AthenaPOOL/PoolSvc/PoolSvc/IPoolSvc.h b/Database/AthenaPOOL/PoolSvc/PoolSvc/IPoolSvc.h
index 4ad829d3e48..3629f8e167c 100644
--- a/Database/AthenaPOOL/PoolSvc/PoolSvc/IPoolSvc.h
+++ b/Database/AthenaPOOL/PoolSvc/PoolSvc/IPoolSvc.h
@@ -16,7 +16,6 @@
 #include "DataModelRoot/RootType.h"
 
 #include <string>
-#include <vector>
 
 // Forward declarations
 namespace pool {
diff --git a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx
index 745119e9f58..919b324049c 100644
--- a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx
+++ b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.cxx
@@ -24,7 +24,6 @@
 #include "FileCatalog/IFileCatalog.h"
 #include "FileCatalog/IFCAction.h"
 
-#include "PersistencySvc/IPersistencySvcFactory.h"
 #include "PersistencySvc/IPersistencySvc.h"
 #include "PersistencySvc/ISession.h"
 #include "PersistencySvc/IDatabase.h"
@@ -67,22 +66,20 @@ StatusCode PoolSvc::initialize() {
       return(StatusCode::FAILURE);
    }
    // Register input file's names with the I/O manager
-   const std::vector<std::string>& readcat = m_readCatalog.value();
    bool allGood = true;
-   std::string fileName;
-   for (std::size_t icat = 0, imax = readcat.size(); icat < imax; icat++) {
-      if (readcat[icat].substr(0, 16) == "xmlcatalog_file:") {
-         fileName = readcat[icat].substr(16);
+   for (auto& catalog : m_readCatalog.value()) {
+      if (catalog.substr(0, 16) == "xmlcatalog_file:") {
+         const std::string& fileName = catalog.substr(16);
          if (!iomgr->io_register(this, IIoComponentMgr::IoMode::READ, fileName, fileName).isSuccess()) {
-            ATH_MSG_FATAL("could not register [" << readcat[icat] << "] for input !");
+            ATH_MSG_FATAL("could not register [" << catalog << "] for input !");
             allGood = false;
          } else {
-            ATH_MSG_INFO("io_register[" << this->name() << "](" << readcat[icat] << ") [ok]");
+            ATH_MSG_INFO("io_register[" << this->name() << "](" << catalog << ") [ok]");
          }
       }
    }
    if (m_writeCatalog.value().substr(0, 16) == "xmlcatalog_file:") {
-      fileName = m_writeCatalog.value().substr(16);
+      const std::string& fileName = m_writeCatalog.value().substr(16);
       if (!iomgr->io_register(this, IIoComponentMgr::IoMode::WRITE, fileName, fileName).isSuccess()) {
          ATH_MSG_FATAL("could not register [" << m_writeCatalog.value() << "] for input !");
          allGood = false;
@@ -133,16 +130,10 @@ StatusCode PoolSvc::initialize() {
    }
    MSG::Level athLvl = msg().level();
    ATH_MSG_DEBUG("OutputLevel is " << athLvl);
-   pool::DbPrintLvl::setLevel( athLvl );
-
-   return setupPersistencySvc();
-}
-//__________________________________________________________________________
-StatusCode PoolSvc::reinit() {
-   ATH_MSG_INFO("Re-initializing " << name());
-   // Setup a catalog connection based on the value of $POOL_CATALOG
-   return(StatusCode::SUCCESS);
+   pool::DbPrintLvl::setLevel(athLvl);
+   return(setupPersistencySvc());
 }
+
 //__________________________________________________________________________
 StatusCode PoolSvc::io_reinit() {
    ATH_MSG_INFO("I/O reinitialization...");
@@ -180,10 +171,7 @@ StatusCode PoolSvc::io_reinit() {
          m_writeCatalog.setValue("xmlcatalog_file:" + fileName);
       }
    }
-   if (!setupPersistencySvc().isSuccess()) {
-      return(StatusCode::FAILURE);
-   }
-   return reinit();
+   return(setupPersistencySvc());
 }
 //__________________________________________________________________________
 StatusCode PoolSvc::setupPersistencySvc() {
@@ -199,27 +187,17 @@ StatusCode PoolSvc::setupPersistencySvc() {
       ATH_MSG_FATAL("Failed to setup POOL File Catalog.");
       return(StatusCode::FAILURE);
    }
-   // Setup a persistency service
-   for (std::vector<pool::IPersistencySvc*>::const_iterator iter = m_persistencySvcVec.begin(),
-		   last = m_persistencySvcVec.end(); iter != last; iter++) {
-      delete *iter;
+   // Cleanup persistency service
+   for (const auto& persistencySvc : m_persistencySvcVec) {
+      delete persistencySvc;
    }
    m_persistencySvcVec.clear();
-   for (std::vector<CallMutex*>::const_iterator iter = m_pers_mut.begin(),
-		   last = m_pers_mut.end(); iter != last; iter++) {
-      delete *iter;
+   for (const auto& persistencyMutex : m_pers_mut) {
+      delete persistencyMutex;
    }
    m_pers_mut.clear();
-   pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-   if (psfactory == nullptr) {
-      ATH_MSG_FATAL("Failed to create PersistencySvcFactory.");
-      return(StatusCode::FAILURE);
-   }
-   m_persistencySvcVec.push_back(psfactory->create("PersistencySvc", *m_catalog)); // Read Service
-   if (m_persistencySvcVec[IPoolSvc::kInputStream] == nullptr) {
-      ATH_MSG_FATAL("Failed to create Input PersistencySvc.");
-      return(StatusCode::FAILURE);
-   }
+   // Setup a persistency services
+   m_persistencySvcVec.push_back(pool::IPersistencySvc::create(*m_catalog).release()); // Read Service
    m_pers_mut.push_back(new CallMutex);
    if (!m_persistencySvcVec[IPoolSvc::kInputStream]->session().technologySpecificAttributes(pool::ROOT_StorageType.type()).setAttribute<bool>("MultiThreaded", true)) {
       ATH_MSG_FATAL("Failed to enable multithreaded ROOT via PersistencySvc.");
@@ -230,11 +208,7 @@ StatusCode PoolSvc::setupPersistencySvc() {
       ATH_MSG_FATAL("Failed to connect Input PersistencySvc.");
       return(StatusCode::FAILURE);
    }
-   m_persistencySvcVec.push_back(psfactory->create("PersistencySvc", *m_catalog)); // Write Service
-   if (m_persistencySvcVec[IPoolSvc::kOutputStream] == nullptr) {
-      ATH_MSG_FATAL("Failed to create Output PersistencySvc.");
-      return(StatusCode::FAILURE);
-   }
+   m_persistencySvcVec.push_back(pool::IPersistencySvc::create(*m_catalog).release()); // Write Service
    m_pers_mut.push_back(new CallMutex);
    pool::DatabaseConnectionPolicy policy;
    policy.setWriteModeForNonExisting(pool::DatabaseConnectionPolicy::CREATE);
@@ -247,10 +221,8 @@ StatusCode PoolSvc::setupPersistencySvc() {
 }
 //__________________________________________________________________________
 StatusCode PoolSvc::stop() {
-   unsigned int contextId = 0;
    bool retError = false;
-   for (std::vector<pool::IPersistencySvc*>::const_iterator iter = m_persistencySvcVec.begin(),
-		   last = m_persistencySvcVec.end(); iter != last; iter++, contextId++) {
+   for (unsigned int contextId = 0, imax = m_persistencySvcVec.size(); contextId < imax; contextId++) {
       if (!disconnect(contextId).isSuccess()) {
          ATH_MSG_FATAL("Cannot disconnect Stream: " << contextId);
          retError = true;
@@ -260,32 +232,36 @@ StatusCode PoolSvc::stop() {
 }
 //__________________________________________________________________________
 StatusCode PoolSvc::finalize() {
-   unsigned int contextId = 0;
-   for (std::vector<pool::IPersistencySvc*>::const_iterator iter = m_persistencySvcVec.begin(),
-		   last = m_persistencySvcVec.end(); iter != last; iter++, contextId++) {
-      delete *iter;
+   // Cleanup persistency service
+   for (const auto& persistencySvc : m_persistencySvcVec) {
+      delete persistencySvc;
    }
    m_persistencySvcVec.clear();
-   for (std::vector<CallMutex*>::const_iterator iter = m_pers_mut.begin(),
-		   last = m_pers_mut.end(); iter != last; iter++) {
-      delete *iter;
+   for (const auto& persistencyMutex : m_pers_mut) {
+      delete persistencyMutex;
    }
    m_pers_mut.clear();
    if (m_catalog != nullptr) {
       m_catalog->commit();
       delete m_catalog; m_catalog = nullptr;
    }
-   bool retError = false;
-   if (!::AthService::finalize().isSuccess()) {
-      ATH_MSG_FATAL("Cannot finalize AthService base class.");
-      retError = true;
-   }
-   return(retError ? StatusCode::FAILURE : StatusCode::SUCCESS);
+   return(::AthService::finalize());
 }
 //__________________________________________________________________________
 StatusCode PoolSvc::io_finalize() {
    ATH_MSG_INFO("I/O finalization...");
-   return(disconnect(IPoolSvc::kInputStream));
+   unsigned int streamId = 0;
+   for (std::vector<pool::IPersistencySvc*>::const_iterator iter = m_persistencySvcVec.begin(),
+		   last = m_persistencySvcVec.end(); iter != last; iter++, streamId++) {
+      ATH_MSG_DEBUG("Deleting PersSvc stream " << streamId);
+      delete *iter;
+   }
+   m_persistencySvcVec.clear();
+   if (m_catalog != nullptr) {
+      m_catalog->commit();
+      delete m_catalog; m_catalog = nullptr;
+   }
+   return(StatusCode::SUCCESS);
 }
 //_______________________________________________________________________
 StatusCode PoolSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) {
@@ -347,17 +323,8 @@ unsigned int PoolSvc::getInputContext(const std::string& label, unsigned int max
          return(contextIter->second);
       }
    }
-   pool::IPersistencySvcFactory* psfactory = pool::IPersistencySvcFactory::get();
-   if (psfactory == nullptr) {
-      ATH_MSG_ERROR("Failed to create PersistencySvcFactory.");
-      return(IPoolSvc::kInputStream);
-   }
    const unsigned int id = m_persistencySvcVec.size();
-   m_persistencySvcVec.push_back(psfactory->create("PersistencySvc", *m_catalog));
-   if (m_persistencySvcVec[id] == nullptr) {
-      ATH_MSG_ERROR("Failed to create Input PersistencySvc.");
-      return(IPoolSvc::kInputStream);
-   }
+   m_persistencySvcVec.push_back( pool::IPersistencySvc::create(*m_catalog).release() );
    m_pers_mut.push_back(new CallMutex);
    if (!connect(pool::ITransaction::READ).isSuccess()) {
       ATH_MSG_ERROR("Failed to connect Input PersistencySvc.");
@@ -535,13 +502,9 @@ pool::ICollection* PoolSvc::createCollection(const std::string& collectionType,
 //__________________________________________________________________________
 void PoolSvc::registerExistingCollection(pool::ICollection* coll, bool overwrite, bool sharedCat) {
    std::lock_guard<CallMutex> lock(m_pool_mut);
-   pool::CollectionFactory* collFac = pool::CollectionFactory::get();
    m_catalog->commit();
-   if (sharedCat) {
-      collFac->registerExisting(coll, overwrite, m_catalog);
-   } else {
-      collFac->registerExisting(coll, overwrite, nullptr);
-   }
+   pool::CollectionFactory* collFac = pool::CollectionFactory::get();
+   collFac->registerExisting(coll, overwrite, sharedCat ? m_catalog : nullptr);
    m_catalog->start();
 }
 //__________________________________________________________________________
@@ -603,13 +566,11 @@ StatusCode PoolSvc::commit(unsigned int contextId) const {
    std::lock_guard<CallMutex> lock(*m_pers_mut[contextId]);
    pool::IPersistencySvc* persSvc = m_persistencySvcVec[contextId];
    if (persSvc != nullptr && persSvc->session().transaction().isActive()) {
-      unsigned int type = persSvc->session().transaction().type();
       if (!persSvc->session().transaction().commit()) {
          ATH_MSG_ERROR("POOL commit failed " << persSvc);
-         persSvc->session().disconnectAll();
          return(StatusCode::FAILURE);
       }
-      if (type == pool::ITransaction::READ) {
+      if (persSvc->session().transaction().type() == pool::ITransaction::READ) {
          persSvc->session().disconnectAll();
       }
    }
@@ -622,7 +583,7 @@ StatusCode PoolSvc::commitAndHold(unsigned int contextId) const {
    }
    std::lock_guard<CallMutex> lock(*m_pers_mut[contextId]);
    pool::IPersistencySvc* persSvc = m_persistencySvcVec[contextId];
-   if (persSvc->session().transaction().isActive()) {
+   if (persSvc != nullptr && persSvc->session().transaction().isActive()) {
       if (!persSvc->session().transaction().commitAndHold()) {
          ATH_MSG_ERROR("POOL commitAndHold failed " << persSvc);
          return(StatusCode::FAILURE);
@@ -651,7 +612,7 @@ StatusCode PoolSvc::disconnectDb(const std::string& connection, unsigned int con
    if (contextId >= m_persistencySvcVec.size()) {
       return(StatusCode::SUCCESS);
    }
-   std::lock_guard<CallMutex> lock(*m_pers_mut[contextId]);
+   std::lock_guard<CallMutex> lockC(*m_pers_mut[contextId]);
    std::unique_ptr<pool::IDatabase> dbH = getDbHandle(contextId, connection);
    if (dbH == nullptr) {
       ATH_MSG_ERROR("Failed to get Session/DatabaseHandle.");
@@ -659,14 +620,15 @@ StatusCode PoolSvc::disconnectDb(const std::string& connection, unsigned int con
    }
    std::map<unsigned int, unsigned int>::const_iterator maxFileIter = m_contextMaxFile.find(contextId);
    if (maxFileIter != m_contextMaxFile.end() && maxFileIter->second > 0) {
-      const Guid guid(dbH->fid());
-      m_guidLists[contextId].remove(guid);
+      std::lock_guard<CallMutex> lock(m_pool_mut);
+      m_guidLists[contextId].remove(Guid(dbH->fid()));
    }
    dbH->disconnect();
    return(StatusCode::SUCCESS);
 }
 //_______________________________________________________________________
 long long int PoolSvc::getFileSize(const std::string& dbName, long tech, unsigned int contextId) const {
+   std::lock_guard<CallMutex> lock(*m_pers_mut[contextId]);
    std::unique_ptr<pool::IDatabase> dbH = getDbHandle(contextId, dbName);
    if (dbH == nullptr) {
       ATH_MSG_DEBUG("getFileSize: Failed to get Session/DatabaseHandle to get POOL FileSize property.");
@@ -690,6 +652,7 @@ StatusCode PoolSvc::getAttribute(const std::string& optName,
    if (contextId >= m_persistencySvcVec.size()) {
       contextId = IPoolSvc::kInputStream;
    }
+   std::lock_guard<CallMutex> lock(*m_pers_mut[contextId]);
    pool::ISession& sesH = m_persistencySvcVec[contextId]->session();
    std::ostringstream oss;
    if (data == "DbLonglong") {
@@ -710,6 +673,7 @@ StatusCode PoolSvc::getAttribute(const std::string& optName,
 		const std::string& dbName,
 		const std::string& contName,
 		unsigned int contextId) const {
+   std::lock_guard<CallMutex> lock(*m_pers_mut[contextId]);
    std::unique_ptr<pool::IDatabase> dbH = getDbHandle(contextId, dbName);
    if (dbH == nullptr) {
       ATH_MSG_DEBUG("getAttribute: Failed to get Session/DatabaseHandle to get POOL property.");
@@ -761,6 +725,7 @@ StatusCode PoolSvc::setAttribute(const std::string& optName,
    if (contextId >= m_persistencySvcVec.size()) {
       contextId = IPoolSvc::kOutputStream;
    }
+   std::lock_guard<CallMutex> lock(*m_pers_mut[contextId]);
    pool::ISession& sesH = m_persistencySvcVec[contextId]->session();
    if (data[data.size() - 1] == 'L') {
       if (!sesH.technologySpecificAttributes(tech).setAttribute<long long int>(optName, atoll(data.c_str()))) {
@@ -785,7 +750,7 @@ StatusCode PoolSvc::setAttribute(const std::string& optName,
    if (contextId >= m_persistencySvcVec.size()) {
       contextId = IPoolSvc::kOutputStream;
    }
-   std::lock_guard<CallMutex> lock(m_pool_mut);
+   std::lock_guard<CallMutex> lock(*m_pers_mut[contextId]);
    std::unique_ptr<pool::IDatabase> dbH = getDbHandle(contextId, dbName);
    if (dbH == nullptr) {
       ATH_MSG_DEBUG("Failed to get Session/DatabaseHandle to set POOL property.");
@@ -838,12 +803,7 @@ StatusCode PoolSvc::setAttribute(const std::string& optName,
          retError = contH->technologySpecificAttributes().setAttribute<int>(optName, atoi(data.c_str()), objName);
       }
       if (!retError) {
-         ATH_MSG_DEBUG("Failed to set POOL container property, "
-	         << optName
-	         << " for "
-	         << contName << " : " << objName
-	         << " to "
-	         << data);
+         ATH_MSG_DEBUG("Failed to set POOL container property, " << optName << " for " << contName << " : " << objName << " to " << data);
          return(StatusCode::FAILURE);
       }
    }
@@ -906,40 +866,36 @@ StatusCode PoolSvc::setFrontierCache(const std::string& conn) const {
          // set the schema to be refreshed
          webCache.refreshSchemaInfo(*iter);
       }
-      ATH_MSG_DEBUG("Cache flag for connection "
-	      << *iter
-	      << " set to "
-	      << webCache.webCacheInfo(*iter).isSchemaInfoCached());
+      ATH_MSG_DEBUG("Cache flag for connection " << *iter << " set to " << webCache.webCacheInfo(*iter).isSchemaInfoCached());
    }
    return(StatusCode::SUCCESS);
 }
 //__________________________________________________________________________
 pool::IFileCatalog* PoolSvc::createCatalog() {
    pool::IFileCatalog* ctlg = new pool::IFileCatalog;
-   for (std::vector<std::string>::const_iterator iter = m_readCatalog.value().begin(),
-	   last = m_readCatalog.value().end(); iter != last; ++iter) {
-      ATH_MSG_DEBUG("POOL ReadCatalog is " << *iter);
-      if (iter->substr(0, 8) == "apcfile:" || iter->substr(0, 7) == "prfile:") {
-         std::string::size_type cpos = iter->find(":");
+   for (auto& catalog : m_readCatalog.value()) {
+      ATH_MSG_DEBUG("POOL ReadCatalog is " << catalog);
+      if (catalog.substr(0, 8) == "apcfile:" || catalog.substr(0, 7) == "prfile:") {
+         std::string::size_type cpos = catalog.find(":");
          // check for file accessed via ATLAS_POOLCOND_PATH
-         std::string file = poolCondPath(iter->substr(cpos + 1));
+         std::string file = poolCondPath(catalog.substr(cpos + 1));
          if (!file.empty()) {
             ATH_MSG_INFO("Resolved path (via ATLAS_POOLCOND_PATH) is " << file);
             ctlg->addReadCatalog("file:" + file);
          } else {
             // As backup, check for file accessed via PathResolver
-            std::string file = PathResolver::find_file(iter->substr(cpos + 1), "DATAPATH");
+            file = PathResolver::find_file(catalog.substr(cpos + 1), "DATAPATH");
             if (!file.empty()) {
                ATH_MSG_INFO("Resolved path (via DATAPATH) is " << file);
                ctlg->addReadCatalog("file:" + file);
             } else {
                ATH_MSG_WARNING("Unable to locate catalog for "
-	               << *iter
+	               << catalog
 	               << " check your ATLAS_POOLCOND_PATH and DATAPATH variables");
             }
          }
       } else {
-         ctlg->addReadCatalog(*iter);
+         ctlg->addReadCatalog(catalog);
       }
    }
    try {
diff --git a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h
index 9181173b4dc..da58694eb3c 100644
--- a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h
+++ b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h
@@ -12,13 +12,11 @@
 
 #include "PoolSvc/IPoolSvc.h"
 #include "GaudiKernel/IIoComponent.h"
-#include "GaudiKernel/ServiceHandle.h"
 #include "AthenaBaseComps/AthService.h"
 
 #include <string>
 #include <vector>
 #include <map>
-#include <memory>
 #include <mutex>
 
 // Forward declarations
@@ -26,7 +24,6 @@ namespace pool {
    class IContainer;
    class IDatabase;
    class IPersistencySvc;
-   class ISession;
 }
 class Guid;
 
@@ -42,7 +39,6 @@ class PoolSvc : public ::AthService, virtual public IPoolSvc, virtual public IIo
 public: // Non-static members
    /// Required of all Gaudi services:
    StatusCode initialize();
-   StatusCode reinit();
    StatusCode io_reinit();
    /// Required of all Gaudi services:
    StatusCode stop();
diff --git a/Database/AthenaPOOL/RootConversions/test/tcls_common.h b/Database/AthenaPOOL/RootConversions/test/tcls_common.h
index 04390974287..75de02c3177 100755
--- a/Database/AthenaPOOL/RootConversions/test/tcls_common.h
+++ b/Database/AthenaPOOL/RootConversions/test/tcls_common.h
@@ -24,6 +24,9 @@
 #include "TClonesArray.h"
 
 
+bool operator< (const T1& a, const T1& b);
+
+
 class C
 {
 public:
@@ -146,6 +149,7 @@ public:
   E e;
   T9 t9;
 };
+bool operator< (const V& a, const V& b);
 
 
 class W
@@ -384,5 +388,3 @@ std::ostream& operator<< (std::ostream& s, const QQ& c);
 std::ostream& operator<< (std::ostream& s, const RR& c);
 std::ostream& operator<< (std::ostream& s, const SS& c);
 
-bool operator< (const T1& a, const T1& b);
-bool operator< (const V& a, const V& b);
diff --git a/Database/AthenaRoot/AthenaRootComps/CMakeLists.txt b/Database/AthenaRoot/AthenaRootComps/CMakeLists.txt
index dfd15e7656b..6c91cb0a320 100644
--- a/Database/AthenaRoot/AthenaRootComps/CMakeLists.txt
+++ b/Database/AthenaRoot/AthenaRootComps/CMakeLists.txt
@@ -17,9 +17,8 @@ atlas_depends_on_subdirs( PUBLIC
                           Control/StoreGate
                           Database/APR/CollectionBase
                           Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
+                          Database/APR/FileCatalog
                           Database/APR/PersistencySvc
-                          Database/APR/StorageSvc
                           Database/AthenaRoot/AthenaRootKernel
                           Database/PersistentDataModel
                           Database/AthenaPOOL/PoolSvc
@@ -39,7 +38,7 @@ atlas_add_component( AthenaRootComps
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} SGTools AthenaBaseComps AthenaKernel DataModelRoot RootUtils RootUtilsPyROOT StoreGateLib SGtests CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaRootKernel PersistentDataModel EventInfo GaudiKernel xAODRootAccess xAODEventInfo)
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} SGTools AthenaBaseComps AthenaKernel DataModelRoot RootUtils RootUtilsPyROOT StoreGateLib SGtests CollectionBase CollectionUtilities FileCatalog PersistencySvc AthenaRootKernel PersistentDataModel EventInfo GaudiKernel xAODRootAccess xAODEventInfo)
 
 # Install files from the package:
 atlas_install_headers( AthenaRootComps )
diff --git a/Database/AthenaRoot/AthenaRootComps/share/test_athena_variable_shape_merged.ref b/Database/AthenaRoot/AthenaRootComps/share/test_athena_variable_shape_merged.ref
old mode 100644
new mode 100755
diff --git a/Database/CoolConvUtilities/CMakeLists.txt b/Database/CoolConvUtilities/CMakeLists.txt
index f10e2e2c974..677a6bbbdae 100644
--- a/Database/CoolConvUtilities/CMakeLists.txt
+++ b/Database/CoolConvUtilities/CMakeLists.txt
@@ -7,11 +7,8 @@ atlas_subdir( CoolConvUtilities )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PRIVATE
-                          Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
+                          Database/APR/FileCatalog
                           Database/APR/PersistencySvc
-                          Database/APR/StorageSvc
                           Database/CoraCool )
 
 # External dependencies:
@@ -25,7 +22,7 @@ atlas_add_executable( AtlCoolCopy
                       src/ReplicaSorter.cxx
                       src/CoolTagInfo.cxx
                       INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc CoraCool )
+                      LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} FileCatalog PersistencySvc CoraCool )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/Database/CoolConvUtilities/src/AtlCoolCopy.cxx b/Database/CoolConvUtilities/src/AtlCoolCopy.cxx
index 70b224a03f6..7085f120c03 100755
--- a/Database/CoolConvUtilities/src/AtlCoolCopy.cxx
+++ b/Database/CoolConvUtilities/src/AtlCoolCopy.cxx
@@ -1624,7 +1624,7 @@ int AtlCoolCopy::rootIOVs(const std::string& folder,
 	// truncate the string first to avoid coverity complaining about
 	// potential buffer overruns
 	std::string sourcetag2=sourcetag.substr(0,255);
-	strncpy(nt_tagid,sourcetag2.c_str(),256);
+	strncpy(nt_tagid,sourcetag2.c_str(),sizeof(nt_tagid)-1);
       }
       // loop over the payload elements and fill the ones for which buffers
       // are defined
diff --git a/Database/CoralDB/src/CoralDB.cxx b/Database/CoralDB/src/CoralDB.cxx
index ee82c31abf6..9b26064c787 100644
--- a/Database/CoralDB/src/CoralDB.cxx
+++ b/Database/CoralDB/src/CoralDB.cxx
@@ -1001,7 +1001,7 @@ bool CoralDB::deleteDataTag(const string& tag, const string& tmpIdTag) {
     deleteRows(TABLENAME_PREFIX+"CLOBS", "IDTAG", idTag, "REV", rev);
     deleteRows(TABLENAME_PREFIX+"CLOBS_REVS", "IDTAG", idTag, "TAG", tag);
   }
-  catch(RowNotFound) {
+  catch(const RowNotFound&) {
     // OK, this dataTag did not have any fields => no REV found by findEntry().
     // Only need to delete from CLOBS_TAGS below.
   }
diff --git a/Database/IOVDbSvc/CMakeLists.txt b/Database/IOVDbSvc/CMakeLists.txt
index a048e8b4e99..4f0099f8451 100644
--- a/Database/IOVDbSvc/CMakeLists.txt
+++ b/Database/IOVDbSvc/CMakeLists.txt
@@ -16,11 +16,7 @@ atlas_depends_on_subdirs(
    Control/CxxUtils
    Control/SGTools
    Control/StoreGate
-   Database/APR/CollectionBase
-   Database/APR/CollectionUtilities
-   Database/APR/POOLCore
-   Database/APR/PersistencySvc
-   Database/APR/StorageSvc
+   Database/APR/FileCatalog
    Database/AthenaPOOL/AthenaPoolUtilities
    Database/AthenaPOOL/PoolSvc
    Database/CoraCool
@@ -48,8 +44,7 @@ atlas_add_component( IOVDbSvc
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS}
    LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${COOL_LIBRARIES}
    GaudiKernel AthenaBaseComps AthenaKernel CxxUtils SGTools StoreGateLib
-   CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc
-   AthenaPoolUtilities CoraCool IOVDbDataModel EventInfo IOVDbSvcLib )
+   FileCatalog AthenaPoolUtilities CoraCool IOVDbDataModel EventInfo IOVDbSvcLib )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/Database/IOVDbSvc/python/CondDB.py b/Database/IOVDbSvc/python/CondDB.py
index 73c53a5c647..d389d8bdaac 100644
--- a/Database/IOVDbSvc/python/CondDB.py
+++ b/Database/IOVDbSvc/python/CondDB.py
@@ -225,8 +225,10 @@ class CondDB:
         "Add access to given folder, using folder1 online, folder2 offline"
         if self.isOnline and not self.isMC:
             self.addFolder(ident,folder1,force=force,forceMC=forceMC,forceData=forceData,className=className)
+            return folder1
         else:
             self.addFolder(ident+'_OFL',folder2,force=force,forceMC=forceMC,forceData=forceData,className=className)
+            return folder2
 
     def addFolderSplitMC(self,ident,folder1,folder2,force=False,forceMC=False,forceData=False,className=None):
         "Add access to given folder, using folder1 (online) for real data, folde2 (offline) for MC"
diff --git a/Database/RegistrationServices/CMakeLists.txt b/Database/RegistrationServices/CMakeLists.txt
index 4f72efc4ad6..0cd9f98ecf1 100644
--- a/Database/RegistrationServices/CMakeLists.txt
+++ b/Database/RegistrationServices/CMakeLists.txt
@@ -14,10 +14,8 @@ atlas_depends_on_subdirs( PUBLIC
                           Control/SGTools
                           Control/StoreGate
                           Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
                           Database/APR/POOLCore
-                          Database/APR/PersistencySvc
-                          Database/APR/StorageSvc
+                          Database/APR/FileCatalog
                           Database/AthenaPOOL/AthenaPoolKernel
                           Database/AthenaPOOL/AthenaPoolUtilities
                           Database/AthenaPOOL/DBDataModel
@@ -41,7 +39,7 @@ atlas_add_component( RegistrationServices
                      src/OutputConditionsAlg.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolUtilities DBDataModel PersistentDataModel )
+                     LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests CollectionBase POOLCore FileCatalog AthenaPoolUtilities DBDataModel PersistentDataModel )
 
 # Install files from the package:
 atlas_install_headers( RegistrationServices )
diff --git a/Database/RegistrationServices/src/RegistrationStream.cxx b/Database/RegistrationServices/src/RegistrationStream.cxx
index abc37e36e10..034addbde34 100755
--- a/Database/RegistrationServices/src/RegistrationStream.cxx
+++ b/Database/RegistrationServices/src/RegistrationStream.cxx
@@ -518,6 +518,24 @@ std::vector<std::string> RegistrationStream::getCollMetadataKeys()
 StatusCode RegistrationStream::io_reinit() 
 {
    ATH_MSG_DEBUG("I/O reinitialization...");
-   // Dummy
+   ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", this->name());
+   if (!incSvc.retrieve().isSuccess()) {
+      ATH_MSG_FATAL("Cannot get the IncidentSvc");
+      return StatusCode::FAILURE;
+   }
+   incSvc->addListener(this, "MetaDataStop", 30);
+   return StatusCode::SUCCESS;
+}
+
+StatusCode RegistrationStream::io_finalize() {
+   ATH_MSG_INFO("I/O finalization...");
+   const Incident metaDataStopIncident(name(), "MetaDataStop");
+   this->handle(metaDataStopIncident);
+   ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", this->name());
+   if (!incSvc.retrieve().isSuccess()) {
+      ATH_MSG_FATAL("Cannot get the IncidentSvc");
+      return StatusCode::FAILURE;
+   }
+   incSvc->removeListener(this, "MetaDataStop");
    return StatusCode::SUCCESS;
 }
diff --git a/Database/RegistrationServices/src/RegistrationStream.h b/Database/RegistrationServices/src/RegistrationStream.h
index 8934f2d0f7a..58e0ff51c2f 100755
--- a/Database/RegistrationServices/src/RegistrationStream.h
+++ b/Database/RegistrationServices/src/RegistrationStream.h
@@ -72,8 +72,9 @@ public:
     /// Working entry point
     virtual StatusCode execute();
 
-/// Callback method to reinitialize the internal state of the component for I/O purposes (e.g. upon @c fork(2))
+    /// Callback method to reinitialize the internal state of the component for I/O purposes (e.g. upon @c fork(2))
     virtual StatusCode io_reinit();
+    virtual StatusCode io_finalize();
 
     /// Standard RegistrationStream Constructor
     RegistrationStream(const std::string& name, ISvcLocator* pSvcLocator); 
diff --git a/Database/RegistrationServices/src/RegistrationStreamLCGTool.cxx b/Database/RegistrationServices/src/RegistrationStreamLCGTool.cxx
index 95650f38a14..cf2defc1408 100755
--- a/Database/RegistrationServices/src/RegistrationStreamLCGTool.cxx
+++ b/Database/RegistrationServices/src/RegistrationStreamLCGTool.cxx
@@ -407,7 +407,7 @@ RegistrationStreamLCGTool::fillAtt(std::vector< std::pair<std::string, std::stri
           used.insert(prefName);
           ATH_MSG_DEBUG("Setting primary ref to " << prefName);
        }
-       catch( pool::Exception e ) {
+       catch( const pool::Exception& e ) {
           ATH_MSG_WARNING("Unable to set primary ref name, taking default");
           ATH_MSG_WARNING("due to exception " << e.what() );
        }
@@ -440,7 +440,7 @@ RegistrationStreamLCGTool::fillAtt(std::vector< std::pair<std::string, std::stri
                     used.insert(name);
                     ATH_MSG_DEBUG("Provenance key " << name << " added to spec");
                 }
-                catch (pool::Exception e) {
+                catch (const pool::Exception& e) {
                     ATH_MSG_DEBUG("Provenance stage " << name << " already in token spec");
                 }
             }
@@ -496,7 +496,7 @@ RegistrationStreamLCGTool::fillAtt(std::vector< std::pair<std::string, std::stri
                try {
 	           m_collection->schemaEditor().insertColumn( name, typeName );
                }
-               catch (pool::Exception e) {
+               catch (const pool::Exception& e) {
                    msg(MSG::ERROR) << "Unable to add column " << name 
                                    << " to " << m_collection->description().name() << endmsg;
                }
@@ -506,7 +506,7 @@ RegistrationStreamLCGTool::fillAtt(std::vector< std::pair<std::string, std::stri
                try {
                   m_collection->schemaEditor().setUniqueConstraint("PrimKey",m_primKeyAtts);
                }
-               catch (pool::Exception e) {
+               catch (const pool::Exception& e) {
                   ATH_MSG_WARNING("Unable to set primary key due to " << e.what());
                }
             }
@@ -541,7 +541,7 @@ RegistrationStreamLCGTool::fillAtt(std::vector< std::pair<std::string, std::stri
  	   try {
               std::string brefName(ir->first+"_ref");
 	      if (brefName!=prefName) row.tokenList()[ brefName ].fromString( ir->second );
-	   } catch( pool::Exception e ) {
+	   } catch( const pool::Exception& e ) {
               msg(MSG::ERROR) << " Failed to set Token "
                   << ir->second << " for provenance stage "
 	          << ir->first 
@@ -551,7 +551,7 @@ RegistrationStreamLCGTool::fillAtt(std::vector< std::pair<std::string, std::stri
 
         m_collection->dataEditor().insertRow(row);
 
-    } catch (pool::Exception e) {
+    } catch (const pool::Exception& e) {
         ATH_MSG_ERROR( 
 	    "Caught exception from collection add of Pool attributes. Message: " 
   	    << e.what()
diff --git a/Database/RegistrationServices/src/RegistrationStreamTagTool.cxx b/Database/RegistrationServices/src/RegistrationStreamTagTool.cxx
index c8bf0c0da7e..ec1f268dbe0 100755
--- a/Database/RegistrationServices/src/RegistrationStreamTagTool.cxx
+++ b/Database/RegistrationServices/src/RegistrationStreamTagTool.cxx
@@ -126,7 +126,7 @@ RegistrationStreamTagTool::fillAtt(std::vector< std::pair<std::string, std::stri
           used.insert(prefName);
           ATH_MSG_DEBUG("Setting primary ref to " << prefName);
        }
-       catch( pool::Exception e ) {
+       catch( const pool::Exception& e ) {
           ATH_MSG_WARNING("Unable to set primary ref name, taking default");
           ATH_MSG_WARNING("due to exception " << e.what() );
        }
@@ -159,7 +159,7 @@ RegistrationStreamTagTool::fillAtt(std::vector< std::pair<std::string, std::stri
                     used.insert(name);
                     ATH_MSG_DEBUG("Provenance key " << name << " added to spec");
                 }
-                catch (pool::Exception e) {
+                catch (const pool::Exception& e) {
                     ATH_MSG_DEBUG("Provenance stage " << name << " already in token spec");
                 }
             }
@@ -231,7 +231,7 @@ RegistrationStreamTagTool::fillAtt(std::vector< std::pair<std::string, std::stri
                      try {
                         m_collection->schemaEditor().addCollectionFragment(group);
                      }
-                     catch (pool::Exception e) {
+                     catch (const pool::Exception& e) {
                         ATH_MSG_ERROR("Unable to add fragment " << group << " due to " << e.what() );
                         fragmentGood = false;
                      }
@@ -241,7 +241,7 @@ RegistrationStreamTagTool::fillAtt(std::vector< std::pair<std::string, std::stri
                      try {
 	                m_collection->schemaEditor().insertColumn( name, typeName, info, group );
                      }
-                     catch (pool::Exception e) {
+                     catch (const pool::Exception& e) {
                         msg(MSG::ERROR) << "Unable to add column " << name 
                                           << " to " << m_collection->description().name() 
                                           << " due to " << e.what() << endmsg;
@@ -253,7 +253,7 @@ RegistrationStreamTagTool::fillAtt(std::vector< std::pair<std::string, std::stri
                   try {
 	             m_collection->schemaEditor().insertColumn( name, typeName, info );
                   }
-                  catch (pool::Exception e) {
+                  catch (const pool::Exception& e) {
                      msg(MSG::ERROR) << "Unable to add column " << name 
                                        << " to " << m_collection->description().name() 
                                        << " due to " << e.what() << endmsg;
@@ -266,7 +266,7 @@ RegistrationStreamTagTool::fillAtt(std::vector< std::pair<std::string, std::stri
                try {
                   m_collection->schemaEditor().setUniqueConstraint("PrimKey",m_primKeyAtts);
                }
-               catch (pool::Exception e) {
+               catch (const pool::Exception& e) {
                   ATH_MSG_WARNING("Unable to set primary key due to " << e.what());
                }
             }
@@ -302,7 +302,7 @@ RegistrationStreamTagTool::fillAtt(std::vector< std::pair<std::string, std::stri
  	   try {
               std::string brefName(ir->first+"_ref");
 	      if (brefName!=prefName) row.tokenList()[ brefName ].fromString( ir->second );
-	   } catch( pool::Exception e ) {
+	   } catch( const pool::Exception& e ) {
               msg(MSG::ERROR) << " Failed to set Token "
                   << ir->second << " for provenance stage "
 	          << ir->first 
@@ -312,7 +312,7 @@ RegistrationStreamTagTool::fillAtt(std::vector< std::pair<std::string, std::stri
 
         m_collection->dataEditor().insertRow(row);
 
-    } catch (pool::Exception e) {
+    } catch (const pool::Exception& e) {
         msg(MSG::ERROR) 
 	    << "Caught exception from collection add of Pool attributes. Message: " 
   	    << e.what() << endmsg;
diff --git a/DetectorDescription/DetDescrCond/DetDescrCondTools/CMakeLists.txt b/DetectorDescription/DetDescrCond/DetDescrCondTools/CMakeLists.txt
index 1f905f0bdec..416e1e6489c 100644
--- a/DetectorDescription/DetDescrCond/DetDescrCondTools/CMakeLists.txt
+++ b/DetectorDescription/DetDescrCond/DetDescrCondTools/CMakeLists.txt
@@ -11,11 +11,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Control/StoreGate
                           GaudiKernel
                           PRIVATE
-                          Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
-                          Database/APR/PersistencySvc
-                          Database/APR/StorageSvc
+                          Database/APR/FileCatalog
                           Database/AthenaPOOL/AthenaPoolUtilities
                           Database/AthenaPOOL/PoolSvc
                           DetectorDescription/DetDescrCond/DetDescrConditions
@@ -32,7 +28,7 @@ atlas_add_component( DetDescrCondTools
                      src/CoolHistSvc.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc AthenaPoolUtilities DetDescrConditions Identifier )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel FileCatalog AthenaPoolUtilities DetDescrConditions Identifier )
 
 # Install files from the package:
 atlas_install_headers( DetDescrCondTools )
diff --git a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoCaloCalibHit.icc b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoCaloCalibHit.icc
index e6f3676d84f..a5bc0f8f70d 100755
--- a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoCaloCalibHit.icc
+++ b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoCaloCalibHit.icc
@@ -675,7 +675,8 @@ inline void GeoCaloCalibHit::init(const std::string & collectionName) {
        m_distance = 3980*CLHEP::mm;
         return;
     default:
-      break;
+      m_failed = true;
+      return;
     }   //  over samplings
   case 2: // type == 2, 5200
      if (m_region !=0 || m_sampling !=0) {
diff --git a/DetectorDescription/GeoModel/GeoModelKernel/GeoModelKernel/GeoAccessVolAndSTAction.h b/DetectorDescription/GeoModel/GeoModelKernel/GeoModelKernel/GeoAccessVolAndSTAction.h
index fb264dd39d3..f3dd738150e 100755
--- a/DetectorDescription/GeoModel/GeoModelKernel/GeoModelKernel/GeoAccessVolAndSTAction.h
+++ b/DetectorDescription/GeoModel/GeoModelKernel/GeoModelKernel/GeoAccessVolAndSTAction.h
@@ -36,13 +36,13 @@ class GeoAccessVolAndSTAction final : public GeoNodeAction
   const HepGeom::Transform3D & getDefTransform() const;
   const std::string & getName() const;
 
-  virtual void handleNameTag(const GeoNameTag *nameTag);
-  virtual void handleSerialDenominator(const GeoSerialDenominator* sD);
+  virtual void handleNameTag(const GeoNameTag *nameTag) override;
+  virtual void handleSerialDenominator(const GeoSerialDenominator* sD) override;
 
-  virtual void handleSerialTransformer(const GeoSerialTransformer* sT);
+  virtual void handleSerialTransformer(const GeoSerialTransformer* sT) override;
   const GeoSerialTransformer* getSerialTransformer() const;
 
-  virtual void handleIdentifierTag(const GeoIdentifierTag* idTag);
+  virtual void handleIdentifierTag(const GeoIdentifierTag* idTag) override;
 
   Query<unsigned int> getId() const;
 
diff --git a/DetectorDescription/RegionSelector/src/RegSelectorHashMap.cxx b/DetectorDescription/RegionSelector/src/RegSelectorHashMap.cxx
index 0a8eed20276..364cca4f221 100755
--- a/DetectorDescription/RegionSelector/src/RegSelectorHashMap.cxx
+++ b/DetectorDescription/RegionSelector/src/RegSelectorHashMap.cxx
@@ -153,15 +153,15 @@ void RegSelectorHashMap::mountDataStruct(void){
 void RegSelectorHashMap::regionSelectorRobIdUint(double etaminIn, double etamaxIn,
 					       double phiminIn, double phimaxIn,
 					       std::vector<uint32_t>& outList){
-  regionSelectorINROB((const int)-1, (const double)etaminIn, (const double)etamaxIn, 
-	(const double)phiminIn, (const double)phimaxIn,&outList);
+  regionSelectorINROB((int)-1, (double)etaminIn, (double)etamaxIn, 
+	(double)phiminIn, (double)phimaxIn,&outList);
 }
 
 void RegSelectorHashMap::regionSelectorRobIdUint(int sampling, double etaminIn, double etamaxIn,
 					       double phiminIn, double phimaxIn,
 					       std::vector<uint32_t>& outList){
-  regionSelectorINROB((const int)sampling, (const double)etaminIn,
-	(const double)etamaxIn, (const double)phiminIn, (const double)phimaxIn,
+  regionSelectorINROB((int)sampling, (double)etaminIn,
+	(double)etamaxIn, (double)phiminIn, (double)phimaxIn,
 	&outList);
 }
 
@@ -499,16 +499,16 @@ void RegSelectorHashMap::phiConditionRobId(std::vector<std::vector<uint32_t> >&
 void RegSelectorHashMap::regionSelector(double etaminIn, double etamaxIn,
 					double phiminIn, double phimaxIn,std::vector<IdentifierHash>& outList){
   verifyInputs(etaminIn, etamaxIn, phiminIn, phimaxIn);
-  regionSelectorIN((const int)-1, (const double)etaminIn, (const double)etamaxIn,
-		   (const double)phiminIn, (const double)phimaxIn,&outList);
+  regionSelectorIN((int)-1, (double)etaminIn, (double)etamaxIn,
+		   (double)phiminIn, (double)phimaxIn,&outList);
   
 }
 
 void RegSelectorHashMap::regionSelector(int sampling, double etaminIn, double etamaxIn,
 					double phiminIn, double phimaxIn, std::vector<IdentifierHash>& outList){
   verifyInputs(etaminIn, etamaxIn, phiminIn, phimaxIn);
-  regionSelectorIN((const int)sampling, (const double)etaminIn, (const double)etamaxIn,
-		   (const double)phiminIn, (const double)phimaxIn,&outList);
+  regionSelectorIN((int)sampling, (double)etaminIn, (double)etamaxIn,
+		   (double)phiminIn, (double)phimaxIn,&outList);
   
 }
 
diff --git a/Event/ByteStreamCnvSvc/CMakeLists.txt b/Event/ByteStreamCnvSvc/CMakeLists.txt
index 8533f36099d..43a75798e22 100644
--- a/Event/ByteStreamCnvSvc/CMakeLists.txt
+++ b/Event/ByteStreamCnvSvc/CMakeLists.txt
@@ -18,10 +18,8 @@ atlas_depends_on_subdirs(
    Control/SGTools
    Control/StoreGate
    Database/APR/CollectionBase
-   Database/APR/CollectionUtilities
    Database/APR/POOLCore
-   Database/APR/PersistencySvc
-   Database/APR/StorageSvc
+   Database/APR/FileCatalog
    Database/AthenaPOOL/AthenaPoolKernel
    Database/AthenaPOOL/AthenaPoolUtilities
    Database/PersistentDataModel
@@ -42,8 +40,8 @@ atlas_add_library( ByteStreamCnvSvcLib
    LINK_LIBRARIES AthenaBaseComps ByteStreamData GaudiKernel
    ByteStreamCnvSvcBaseLib StoreGateLib rt
    PRIVATE_LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${Boost_LIBRARIES}
-   AthenaKernel SGTools CollectionBase CollectionUtilities POOLCore
-   PersistencySvc StorageSvc AthenaPoolUtilities PersistentDataModel EventInfo
+   AthenaKernel SGTools CollectionBase POOLCore FileCatalog
+   AthenaPoolUtilities PersistentDataModel EventInfo
    ByteStreamCnvSvcLegacy )
 
 atlas_add_component( ByteStreamCnvSvc
@@ -59,7 +57,7 @@ atlas_add_executable( AtlCopyBSEvent test/AtlCopyBSEvent.cxx
    INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
    ${Boost_INCLUDE_DIRS}
    LINK_LIBRARIES ${CORAL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${Boost_LIBRARIES}
-   CollectionBase POOLCore PersistentDataModel )
+   CollectionBase POOLCore FileCatalog PersistentDataModel )
 
 atlas_add_executable( AtlListBSEvents test/AtlListBSEvents.cxx
    INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
diff --git a/Event/ByteStreamCnvSvc/src/EventSelectorByteStream.cxx b/Event/ByteStreamCnvSvc/src/EventSelectorByteStream.cxx
index 8b2cdb9882d..b6a7be7b14d 100644
--- a/Event/ByteStreamCnvSvc/src/EventSelectorByteStream.cxx
+++ b/Event/ByteStreamCnvSvc/src/EventSelectorByteStream.cxx
@@ -461,15 +461,15 @@ StatusCode EventSelectorByteStream::next(IEvtSelector::Context& it) const {
       try { 
          pre = m_eventSource->nextEvent(); 
       } 
-      catch (ByteStreamExceptions::readError) { 
+      catch (const ByteStreamExceptions::readError&) { 
          ATH_MSG_FATAL("Caught ByteStreamExceptions::readError"); 
          return StatusCode::FAILURE; 
       } 
-      catch (ByteStreamExceptions::badFragment) { 
+      catch (const ByteStreamExceptions::badFragment&) { 
          ATH_MSG_ERROR("badFragment encountered");
          badEvent = true;
       }
-      catch (ByteStreamExceptions::badFragmentData) { 
+      catch (const ByteStreamExceptions::badFragmentData&) { 
          ATH_MSG_ERROR("badFragment data encountered");
          badEvent = true;
       }
@@ -537,7 +537,7 @@ StatusCode EventSelectorByteStream::next(IEvtSelector::Context& it) const {
          try {
             m_eventSource->validateEvent();
          }
-         catch (ByteStreamExceptions::badFragmentData) { 
+         catch (const ByteStreamExceptions::badFragmentData&) { 
             ATH_MSG_ERROR("badFragment data encountered");
 
             ++n_bad_events;
@@ -594,15 +594,15 @@ StatusCode EventSelectorByteStream::previous(IEvtSelector::Context& /*ctxt*/) co
        try { 
           pre = m_eventSource->previousEvent(); 
        } 
-       catch (ByteStreamExceptions::readError) { 
+       catch (const ByteStreamExceptions::readError&) { 
           ATH_MSG_FATAL("Caught ByteStreamExceptions::readError"); 
           return StatusCode::FAILURE; 
        } 
-       catch (ByteStreamExceptions::badFragment) { 
+       catch (const ByteStreamExceptions::badFragment&) { 
           ATH_MSG_ERROR("badFragment encountered");
           badEvent = true;
        }
-       catch (ByteStreamExceptions::badFragmentData) { 
+       catch (const ByteStreamExceptions::badFragmentData&) { 
           ATH_MSG_ERROR("badFragment data encountered");
           badEvent = true;
        }
diff --git a/Event/ByteStreamCnvSvc/test/AtlFindBSEvent.cxx b/Event/ByteStreamCnvSvc/test/AtlFindBSEvent.cxx
index 1b8c5f32531..d338d591894 100644
--- a/Event/ByteStreamCnvSvc/test/AtlFindBSEvent.cxx
+++ b/Event/ByteStreamCnvSvc/test/AtlFindBSEvent.cxx
@@ -37,6 +37,9 @@ int main (int argc, char *argv[])
 {
   using namespace eformat;
 
+  setenv("TZ", "Europe/Zurich", 1);
+  tzset();
+  
   //Interpret arguments
   //Format
   // findEvent -e [--event] <eventNumber> [-r, --run <runnumber>] [-l, --listevents] [-c, --checkevents] files ... 
diff --git a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ROBDataProviderSvc.h b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ROBDataProviderSvc.h
index dc1ef63edd6..bedb316f828 100755
--- a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ROBDataProviderSvc.h
+++ b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ROBDataProviderSvc.h
@@ -45,7 +45,7 @@ public:
    virtual ~ROBDataProviderSvc();
 
    /// initialize the service
-   virtual StatusCode initialize();
+   virtual StatusCode initialize() override;
 
    /// Gaudi queryInterface method.
    //   virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
@@ -85,7 +85,7 @@ public:
 				  const std::function< void(const ROBF* )>& fn ) const override;
 
    virtual bool isEventComplete(const EventContext& /*context*/) const override { return true; }
-   virtual int collectCompleteEventData(const EventContext& /*context*/, const std::string /*callerName*/ ) {  return 0; }
+   virtual int collectCompleteEventData(const EventContext& /*context*/, const std::string /*callerName*/ ) override {  return 0; }
 
 
 
diff --git a/Event/DFStreamEventSelector/CMakeLists.txt b/Event/DFStreamEventSelector/CMakeLists.txt
index 4c4f9c243e4..1a4a6ea64d8 100644
--- a/Event/DFStreamEventSelector/CMakeLists.txt
+++ b/Event/DFStreamEventSelector/CMakeLists.txt
@@ -32,7 +32,7 @@ atlas_add_library( DFStreamEventSelectorLib
    LINK_LIBRARIES AthenaBaseComps GaudiKernel
    StoreGateLib rt ${TDAQ-COMMON_hltinterface_LIBRARY}
    PRIVATE_LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} 
-   AthenaKernel StorageSvc EventInfo xAODEventInfo)
+   AthenaKernel EventInfo xAODEventInfo)
 
 atlas_add_component( DFStreamEventSelector
    src/components/*.cxx
diff --git a/Event/EventCommonAlgs/src/I4MomDumper.cxx b/Event/EventCommonAlgs/src/I4MomDumper.cxx
index 9c09222e109..9cff05b2071 100644
--- a/Event/EventCommonAlgs/src/I4MomDumper.cxx
+++ b/Event/EventCommonAlgs/src/I4MomDumper.cxx
@@ -195,7 +195,7 @@ I4MomDumper::dump( const std::string& collName )
   }
 
   // sorting the collection by Pt
-  typedef std::set<I4Momentum*, P4Sorters::Descending::Pt> Coll_t;
+  typedef std::set<const I4Momentum*, P4Sorters::Descending::Pt> Coll_t;
   Coll_t i4moms( coll->begin(), coll->end() );
 
   if ( m_display == Display::EEtaPhiM ) {
diff --git a/Event/EventCommonAlgs/src/INav4MomDumper.cxx b/Event/EventCommonAlgs/src/INav4MomDumper.cxx
index d4c1d7d904b..32e38d82323 100755
--- a/Event/EventCommonAlgs/src/INav4MomDumper.cxx
+++ b/Event/EventCommonAlgs/src/INav4MomDumper.cxx
@@ -178,7 +178,7 @@ INav4MomDumper::dump( const std::string& collName )
   }
 
   // sorting the collection by Pt
-  typedef std::set<INavigable4Momentum*, P4Sorters::Descending::Pt> Coll_t;
+  typedef std::set<const INavigable4Momentum*, P4Sorters::Descending::Pt> Coll_t;
   Coll_t inav4moms( coll->begin(), coll->end() );
 
   FourMomUtils::dump( out, inav4moms );
diff --git a/Event/EventOverlay/OverlayCommonAlgs/src/BSFilter.cxx b/Event/EventOverlay/OverlayCommonAlgs/src/BSFilter.cxx
index b41c6e7ea1e..8fed41f43b3 100644
--- a/Event/EventOverlay/OverlayCommonAlgs/src/BSFilter.cxx
+++ b/Event/EventOverlay/OverlayCommonAlgs/src/BSFilter.cxx
@@ -20,8 +20,8 @@
 using namespace HLT;
 
 BSFilter::BSFilter( const std::string& name,ISvcLocator* pSvcLocator ) :
-  AthAlgorithm (name, pSvcLocator),All(0),pass(0),EventCounter(0),
-  m_trigbit(63),m_filterfile(""),efile(nullptr),m_EventIdFile(""),
+  AthAlgorithm (name, pSvcLocator),m_All(0),m_pass(0),m_EventCounter(0),
+  m_trigbit(63),m_filterfile(""),m_efile(nullptr),m_EventIdFile(""),
   m_trigConf( "TrigConf::TrigConfigSvc/TrigConfigSvc", name )
 {
   declareProperty("TriggerBit", m_trigbit);
@@ -33,7 +33,7 @@ BSFilter::~BSFilter(){}
 
 StatusCode BSFilter::initialize()
 {
-  All=0; pass=0;
+  m_All=0; m_pass=0;
   ATH_MSG_INFO( "Initializing BSFilter" );
   CHECK( m_trigConf.retrieve() );
 
@@ -47,13 +47,13 @@ StatusCode BSFilter::initialize()
         int r = fscanf(vfile, "%i %lu %i %i %lf\n", &vrun, &vevent, &vtrig, &vnvtx, &vdt);
         if (r>0){
           msg(MSG::DEBUG) << "Read "<<r<<" filter values: "<<vrun<<"/"<<vevent<<" "<<vtrig<<","<<vnvtx<<","<<vdt<<endmsg;
-          if (filtermap[vrun][vevent].magic==777){
-            msg(MSG::WARNING)<<"Already filter info for run/event "<<vrun<<"/"<<vevent<<", magic="<<filtermap[vrun][vevent].magic<<endmsg;
+          if (m_filtermap[vrun][vevent].magic==777){
+            msg(MSG::WARNING)<<"Already filter info for run/event "<<vrun<<"/"<<vevent<<", magic="<<m_filtermap[vrun][vevent].magic<<endmsg;
           }
-          filtermap[vrun][vevent].trig=vtrig;
-          filtermap[vrun][vevent].nvtx=vnvtx;
-          filtermap[vrun][vevent].dt=vdt;
-          filtermap[vrun][vevent].magic=777;
+          m_filtermap[vrun][vevent].trig=vtrig;
+          m_filtermap[vrun][vevent].nvtx=vnvtx;
+          m_filtermap[vrun][vevent].dt=vdt;
+          m_filtermap[vrun][vevent].magic=777;
           ++ne;
         }
         else{
@@ -70,10 +70,10 @@ StatusCode BSFilter::initialize()
   }
 
   //////////////////////////
-  efile=NULL;
+  m_efile=NULL;
   if (m_EventIdFile!=""){
-    efile = fopen(m_EventIdFile.c_str(),"w");
-    if (efile){
+    m_efile = fopen(m_EventIdFile.c_str(),"w");
+    if (m_efile){
       msg(MSG::INFO)<<"Opended EventIdFile: "<<m_EventIdFile<<endmsg;
     }
     else{
@@ -86,13 +86,13 @@ StatusCode BSFilter::initialize()
 
 StatusCode BSFilter::finalize()
 {
-  ATH_MSG_INFO("BS Filter PASSED "<<pass<<" FROM "<< All);
+  ATH_MSG_INFO("BS Filter PASSED "<<m_pass<<" FROM "<< m_All);
   return StatusCode::SUCCESS;
 }
 
 StatusCode BSFilter::execute()
 {
-  All++;
+  m_All++;
   ATH_MSG_INFO("BS Filter");
 
 
@@ -199,11 +199,11 @@ StatusCode BSFilter::execute()
     
 
     if(item_fired_after_veto && m_filterfile=="") {//don't bother to write out RAW if we're only running to make the trigs.txt file
-      // assert(item_fired_before_veto); //or else how could it pass after veto??
+      // assert(item_fired_before_veto); //or else how could it m_pass after veto??
       ATH_MSG_INFO("Filter Passed");
       setFilterPassed(true);
-      pass++;
-      if (efile) fprintf(efile,"svcMgr.EvtIdModifierSvc.add_modifier(run_nbr=%d, evt_nbr=%ld, time_stamp=%d, lbk_nbr=%d, nevts=1)\n",run,event,bc_time_sec,lbn); //"%ld" for evt_nbr since it's 64 bit, but need fix for https://its.cern.ch/jira/browse/ATEAM-286 first!
+      m_pass++;
+      if (m_efile) fprintf(m_efile,"svcMgr.EvtIdModifierSvc.add_modifier(run_nbr=%d, evt_nbr=%ld, time_stamp=%d, lbk_nbr=%d, nevts=1)\n",run,event,bc_time_sec,lbn); //"%ld" for evt_nbr since it's 64 bit, but need fix for https://its.cern.ch/jira/browse/ATEAM-286 first!
     }
     else    {
       ATH_MSG_INFO("Filter Failed");
@@ -221,16 +221,16 @@ StatusCode BSFilter::execute()
     //Here is where you'd check for TAG info of some kind...
     if (m_filterfile!=""){
       passed=false;
-      if (filtermap[run][event].magic!=777){
+      if (m_filtermap[run][event].magic!=777){
         ATH_MSG_WARNING("Dont have info in filtermap for "<<run<<" "<<event);
       }
       else{
-        if (filtermap[run][event].nvtx==1 && filtermap[run][event].trig==1 && fabs(filtermap[run][event].dt) <3.0){
+        if (m_filtermap[run][event].nvtx==1 && m_filtermap[run][event].trig==1 && fabs(m_filtermap[run][event].dt) <3.0){
           passed=true;
-          ATH_MSG_INFO("Passing filter event "<<run<<" "<<event<<", trig run dt magic: "<<filtermap[run][event].trig<<" "<<filtermap[run][event].nvtx<<" "<<filtermap[run][event].dt<<" "<<filtermap[run][event].magic);
+          ATH_MSG_INFO("Passing filter event "<<run<<" "<<event<<", trig run dt magic: "<<m_filtermap[run][event].trig<<" "<<m_filtermap[run][event].nvtx<<" "<<m_filtermap[run][event].dt<<" "<<m_filtermap[run][event].magic);
         }
         else{
-          ATH_MSG_INFO("Not passing filter event "<<run<<" "<<event<<", trig run dt magic: "<<filtermap[run][event].trig<<" "<<filtermap[run][event].nvtx<<" "<<filtermap[run][event].dt<<" "<<filtermap[run][event].magic);
+          ATH_MSG_INFO("Not passing filter event "<<run<<" "<<event<<", trig run dt magic: "<<m_filtermap[run][event].trig<<" "<<m_filtermap[run][event].nvtx<<" "<<m_filtermap[run][event].dt<<" "<<m_filtermap[run][event].magic);
         }
       }
     }
@@ -241,8 +241,8 @@ StatusCode BSFilter::execute()
     if(passed)    {
       ATH_MSG_INFO("Filter Passed");
       setFilterPassed(true);
-      pass++;
-      if (efile) fprintf(efile,"svcMgr.EvtIdModifierSvc.add_modifier(run_nbr=%d, evt_nbr=%ld, time_stamp=%d, lbk_nbr=%d, nevts=1)\n",run,event,bc_time_sec,lbn); //"%ld" for evt_n    br since it's 64 bit, but need fix for https://its.cern.ch/jira/browse/ATEAM-286 first!
+      m_pass++;
+      if (m_efile) fprintf(m_efile,"svcMgr.EvtIdModifierSvc.add_modifier(run_nbr=%d, evt_nbr=%ld, time_stamp=%d, lbk_nbr=%d, nevts=1)\n",run,event,bc_time_sec,lbn); //"%ld" for evt_n    br since it's 64 bit, but need fix for https://its.cern.ch/jira/browse/ATEAM-286 first!
     }
     else    {
       ATH_MSG_INFO("Filter Failed");
diff --git a/Event/EventOverlay/OverlayCommonAlgs/src/BSFilter.h b/Event/EventOverlay/OverlayCommonAlgs/src/BSFilter.h
index 2e595a8c5e4..87b3945cbdb 100644
--- a/Event/EventOverlay/OverlayCommonAlgs/src/BSFilter.h
+++ b/Event/EventOverlay/OverlayCommonAlgs/src/BSFilter.h
@@ -21,7 +21,7 @@ class BSFilter : public AthAlgorithm
   virtual StatusCode  finalize();
 
  protected:
-  int All, pass, EventCounter;
+  int m_All, m_pass, m_EventCounter;
   int m_trigbit;
   std::string m_filterfile;
   class filterinfo{ 
@@ -30,9 +30,9 @@ class BSFilter : public AthAlgorithm
     int magic;
     filterinfo(): trig(0),nvtx(0), dt(0.0),magic(99999) {}
   };
-  std::map< int, std::map < uint64_t, filterinfo > > filtermap;
+  std::map< int, std::map < uint64_t, filterinfo > > m_filtermap;
 
-  FILE *efile;
+  FILE *m_efile;
   std::string m_EventIdFile;
 
   ServiceHandle< TrigConf::ITrigConfigSvc > m_trigConf;
diff --git a/Event/EventOverlay/OverlayCommonAlgs/src/CopyMcEventCollection.cxx b/Event/EventOverlay/OverlayCommonAlgs/src/CopyMcEventCollection.cxx
index c99d4bcf394..f0bec0079a9 100644
--- a/Event/EventOverlay/OverlayCommonAlgs/src/CopyMcEventCollection.cxx
+++ b/Event/EventOverlay/OverlayCommonAlgs/src/CopyMcEventCollection.cxx
@@ -159,9 +159,9 @@ StatusCode CopyMcEventCollection::overlayExecute() {
 
   //Stolen from Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx
   //Check if anything needs to be done for xAOD::EventInfo...
-  std::string m_xaodKey = "EventInfo";
-  if( ! m_storeGateOutput->contains< xAOD::EventInfo >( m_xaodKey ) ) { 
-    ATH_MSG_INFO( "Making xAOD::EventInfo with key: " << m_xaodKey );
+  std::string xaodKey = "EventInfo";
+  if( ! m_storeGateOutput->contains< xAOD::EventInfo >( xaodKey ) ) { 
+    ATH_MSG_INFO( "Making xAOD::EventInfo with key: " << xaodKey );
 
     // Create the xAOD object(s):
     xAOD::EventAuxInfo* aux = new xAOD::EventAuxInfo();
@@ -172,8 +172,8 @@ StatusCode CopyMcEventCollection::overlayExecute() {
     CHECK( m_cnvTool->convert( outEvtInfo, xaod ) );
 
     //Record the xAOD object(s):
-    CHECK( m_storeGateOutput->record( aux, m_xaodKey + "Aux." ) );
-    CHECK( m_storeGateOutput->record( xaod, m_xaodKey ) );
+    CHECK( m_storeGateOutput->record( aux, xaodKey + "Aux." ) );
+    CHECK( m_storeGateOutput->record( xaod, xaodKey ) );
   }//xAOD::EventInfo
 
   if (m_checkeventnumbers){
diff --git a/Event/EventOverlay/OverlayCommonAlgs/src/G4HitMerger.cxx b/Event/EventOverlay/OverlayCommonAlgs/src/G4HitMerger.cxx
index 106a3ca9952..10012ead8fb 100644
--- a/Event/EventOverlay/OverlayCommonAlgs/src/G4HitMerger.cxx
+++ b/Event/EventOverlay/OverlayCommonAlgs/src/G4HitMerger.cxx
@@ -32,7 +32,7 @@ operator<<(std::ostream& o, const McEventCollection& in)
     count++;
     o << " GenEvent " << count << ": signal_process_vertex " << (*evt)->signal_process_vertex() << " # tracks: " << (*evt)->particles_size() << " # vertices: " << (*evt)->vertices_size() << '\n';
     int iTrk(0);
-    for ( HepMC::GenEvent::particle_iterator p = (*evt)->particles_begin(); p != (*evt)->particles_end(); ++p ) {
+    for ( HepMC::GenEvent::particle_const_iterator p = (*evt)->particles_begin(); p != (*evt)->particles_end(); ++p ) {
       iTrk++;
       const HepMC::FourVector fv((*p)->momentum().px(),
                                  (*p)->momentum().py(),
diff --git a/Event/xAOD/xAODCoreAthenaPool/src/xAODShallowAuxContainerCnv.cxx b/Event/xAOD/xAODCoreAthenaPool/src/xAODShallowAuxContainerCnv.cxx
index bf286b0b323..54bfb73caeb 100644
--- a/Event/xAOD/xAODCoreAthenaPool/src/xAODShallowAuxContainerCnv.cxx
+++ b/Event/xAOD/xAODCoreAthenaPool/src/xAODShallowAuxContainerCnv.cxx
@@ -7,7 +7,6 @@
 #include "AthenaKernel/IThinningSvc.h"
 
 #include "AthContainers/tools/getThinnedFlags.h"
-#include "AthContainers/tools/foreach.h"
 #include "AthContainers/AuxTypeRegistry.h"
 
 xAODShallowAuxContainerCnv::xAODShallowAuxContainerCnv( ISvcLocator* svcLoc ) :
@@ -40,7 +39,7 @@ xAOD::ShallowAuxContainer* xAODShallowAuxContainerCnv::createPersistent( xAOD::S
          newcont->getStore()->resize(nremaining); //had to access underlying store directly, can't call 'resize' on container
 
          // Loop over all the variables of the original container:
-         ATHCONTAINERS_FOREACH (SG::auxid_t auxid, auxids) {
+         for (SG::auxid_t auxid : auxids) {
             // Skip null auxids (happens if we don't have the dictionary)
             if(auxid == SG::null_auxid) continue;
             // Skip non-selected dynamic variables.
@@ -74,4 +73,4 @@ xAOD::ShallowAuxContainer* xAODShallowAuxContainerCnv::createPersistent( xAOD::S
 
 xAOD::ShallowAuxContainer* xAODShallowAuxContainerCnv::createTransient( ) {
    return poolReadObject<xAOD::ShallowAuxContainer>(); 
-}
\ No newline at end of file
+}
diff --git a/Event/xAOD/xAODTrigBphysAthenaPool/src/xAODTrigBphysContainerCnv.cxx b/Event/xAOD/xAODTrigBphysAthenaPool/src/xAODTrigBphysContainerCnv.cxx
index 189a6d70191..53252ed9274 100644
--- a/Event/xAOD/xAODTrigBphysAthenaPool/src/xAODTrigBphysContainerCnv.cxx
+++ b/Event/xAOD/xAODTrigBphysAthenaPool/src/xAODTrigBphysContainerCnv.cxx
@@ -39,7 +39,11 @@ xAODTrigBphysContainerCnv::
 createPersistent( xAOD::TrigBphysContainer* trans ) {
 
    // Create a copy of the container:
-   return SG::copyThinned (*trans, IThinningSvc::instance());
+   const xAOD::TrigBphysContainer* c =
+     SG::copyThinnedConst (*trans, IThinningSvc::instance());
+   // FIXME: const_cast.
+   //  createPersistent() should probably be changed to return a const pointer.
+   return const_cast<xAOD::TrigBphysContainer*> (c);
 }
 
 /**
diff --git a/Event/xAOD/xAODTrigger/Root/ByteStreamAuxContainer_v1.cxx b/Event/xAOD/xAODTrigger/Root/ByteStreamAuxContainer_v1.cxx
index d2b6ec16d98..f98f8facd49 100644
--- a/Event/xAOD/xAODTrigger/Root/ByteStreamAuxContainer_v1.cxx
+++ b/Event/xAOD/xAODTrigger/Root/ByteStreamAuxContainer_v1.cxx
@@ -11,7 +11,6 @@
 #include "xAODCore/tools/AuxPersVector.h"
 #include "AthContainers/AuxTypeRegistry.h"
 #include "AthContainers/exceptions.h"
-#include "AthContainers/tools/foreach.h"
 
 // Local include(s):
 #include "xAODTrigger/versions/ByteStreamAuxContainer_v1.h"
@@ -419,14 +418,14 @@ namespace xAOD {
 
       guard_t guard (m_mutex);
 
-      ATHCONTAINERS_FOREACH (SG::IAuxTypeVector* p, m_dynamicVecs)
+      for (SG::IAuxTypeVector* p : m_dynamicVecs)
          delete p;
       m_dynamicVecs.clear();
 
       SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
 #define ADD_IDS(VAR, TYP) \
       do { typedef std::map< std::string, std::vector< TYP > > CONT; \
-           ATHCONTAINERS_FOREACH (CONT::value_type& p, VAR) \
+          for (CONT::value_type& p : VAR)                                 \
              m_auxids.insert (r.getAuxID< TYP > (p.first)); } while(0)
       ADD_IDS(m_int, int);
       ADD_IDS(m_float, float);
diff --git a/Event/xAOD/xAODTruth/xAODTruth/selection.xml b/Event/xAOD/xAODTruth/xAODTruth/selection.xml
index 20d274ba2e4..abd3914cc9d 100644
--- a/Event/xAOD/xAODTruth/xAODTruth/selection.xml
+++ b/Event/xAOD/xAODTruth/xAODTruth/selection.xml
@@ -32,6 +32,7 @@
   <class name="xAOD::TruthEvent_v1" />
   <class name="xAOD::TruthPileupEvent_v1" />
   <class name="xAOD::TruthEvent_v1::PdfInfo" />
+  <class name="xAOD::TruthMetaData_v1" />
 
   <!-- The persistent classes: -->
   <class name="xAOD::TruthParticleContainer_v1"
diff --git a/Event/xAOD/xAODTruthCnv/CMakeLists.txt b/Event/xAOD/xAODTruthCnv/CMakeLists.txt
index 07e7e5c6037..89b82f15bba 100644
--- a/Event/xAOD/xAODTruthCnv/CMakeLists.txt
+++ b/Event/xAOD/xAODTruthCnv/CMakeLists.txt
@@ -5,29 +5,47 @@
 # Declare the package name:
 atlas_subdir( xAODTruthCnv )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/AthLinks
-                          Control/StoreGate
-                          Event/EventInfo
-                          Event/xAOD/xAODEventInfo
-                          Event/xAOD/xAODTruth
-                          GaudiKernel
-                          Generators/GeneratorObjects )
+# Extra package dependencies, based on the build environment:
+set( extra_dep )
+if( NOT XAOD_STANDALONE )
+   set( extra_dep Database/AthenaPOOL/AthenaPoolKernel
+      PRIVATE
+      Control/AthLinks
+      Control/AthenaBaseComps
+      Control/StoreGate
+      Event/EventInfo
+      Event/xAOD/xAODEventInfo
+      Event/xAOD/xAODTruth
+      GaudiKernel
+      Generators/GeneratorObjects )
+endif()
 
-# External dependencies:
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+# Declare the package's dependencies:
+atlas_depends_on_subdirs(
+   PUBLIC
+   Control/AthToolSupport/AsgTools
+   Event/xAOD/xAODTruth
+   ${extra_dep} )
 
 # Component(s) in the package:
-atlas_add_component( xAODTruthCnv
-                     src/*.cxx
-                     src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel AthLinks StoreGateLib SGtests EventInfo xAODEventInfo xAODTruth GaudiKernel GeneratorObjects )
+atlas_add_library( xAODTruthCnvLib
+   xAODTruthCnv/*.h Root/*.cxx
+   PUBLIC_HEADERS xAODTruthCnv
+   LINK_LIBRARIES AsgTools xAODTruth )
+
+if( NOT XAOD_STANDALONE )
+   atlas_add_component( xAODTruthCnv
+      src/*.h src/*.cxx src/components/*.cxx
+      LINK_LIBRARIES AthLinks AthenaBaseComps StoreGateLib EventInfo
+      xAODEventInfo xAODTruth GaudiKernel GeneratorObjects
+      xAODTruthCnvLib )
+endif()
+
+atlas_add_dictionary( xAODTruthCnvDict
+   xAODTruthCnv/xAODTruthCnvDict.h
+   xAODTruthCnv/selection.xml
+   LINK_LIBRARIES xAODTruthCnvLib )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
 atlas_install_python_modules( python/*.py )
-
diff --git a/Event/xAOD/xAODTruthCnv/Root/TruthMetaDataTool.cxx b/Event/xAOD/xAODTruthCnv/Root/TruthMetaDataTool.cxx
new file mode 100644
index 00000000000..ba3b829a746
--- /dev/null
+++ b/Event/xAOD/xAODTruthCnv/Root/TruthMetaDataTool.cxx
@@ -0,0 +1,109 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// Local include(s):
+#include "xAODTruthCnv/TruthMetaDataTool.h"
+
+namespace xAODMaker {
+
+   // Helper typedef:
+   typedef xAOD::TruthMetaDataContainer Cont_t;
+
+   TruthMetaDataTool::TruthMetaDataTool( const std::string& name )
+      : asg::AsgMetadataTool( name ),
+        m_truthMeta(), m_truthMetaAux() {
+
+      declareProperty( "InputKey", m_inputKey = "TruthMetaData" );
+      declareProperty( "OutputKey", m_outputKey = "TruthMetaData" );
+
+#ifdef ASGTOOL_ATHENA
+      declareInterface< ::IMetaDataTool >( this );
+#endif // ASGTOOL_ATHENA
+   }
+
+   StatusCode TruthMetaDataTool::initialize() {
+
+      // Greet the user:
+      ATH_MSG_DEBUG( "Initialising TruthMetaDataTool" );
+      ATH_MSG_DEBUG( "  InputKey  = " << m_inputKey );
+      ATH_MSG_DEBUG( "  OutputKey = " << m_outputKey );
+
+      // Reset the internal variable(s):
+      m_truthMeta.reset(); m_truthMetaAux.reset();
+
+      // Retrun gracefully:
+      return StatusCode::SUCCESS;
+   }
+
+   StatusCode TruthMetaDataTool::beginInputFile() {
+
+      // If the input file doesn't have any trigger configuration metadata,
+      // then finish right away:
+      if( ! inputMetaStore()->contains< Cont_t >( m_inputKey ) ) {
+         return StatusCode::SUCCESS;
+      }
+
+      // Retrieve the input container:
+      const Cont_t* input = 0;
+      ATH_CHECK( inputMetaStore()->retrieve( input, m_inputKey ) );
+
+      // Create an output container if it doesn't exist yet:
+      if( ( ! m_truthMeta.get() ) && ( ! m_truthMetaAux.get() ) ) {
+         ATH_MSG_DEBUG( "Creating output container" );
+         m_truthMeta.reset( new xAOD::TruthMetaDataContainer() );
+         m_truthMetaAux.reset( new xAOD::TruthMetaDataAuxContainer() );
+         m_truthMeta->setStore( m_truthMetaAux.get() );
+      }
+
+      // Loop over the configurations of the input file:
+      for( const xAOD::TruthMetaData* meta : *input ) {
+
+         // Check if this configuration is already in the output container:
+         bool exists = false;
+         for( const xAOD::TruthMetaData* existing : *m_truthMeta ) {
+            if( existing->mcChannelNumber() == meta->mcChannelNumber() ){
+               exists = true;
+               break;
+            }
+         }
+         if( exists ) {
+            continue;
+         }
+
+         // If it's a new configuration, put it into the output container:
+         ATH_MSG_VERBOSE( "Copying configuration with ChannelID: "
+                          << meta->mcChannelNumber() );
+         xAOD::TruthMetaData* out = new xAOD::TruthMetaData();
+         m_truthMeta->push_back( out );
+         *out = *meta;
+      }
+
+      // Return gracefully:
+      return StatusCode::SUCCESS;
+   }
+
+   StatusCode TruthMetaDataTool::metaDataStop() {
+
+      // The output may already have trigger configuration metadata in it.
+      // For instance from TrigConf::xAODMenuWriter. In this case let that
+      // object take precedence.
+      if( outputMetaStore()->contains< Cont_t >( m_outputKey ) ) {
+         ATH_MSG_DEBUG( "xAOD::TruthMetaDataContainer already in the output" );
+         return StatusCode::SUCCESS;
+      }
+
+      // Record the truth metadata, if any was found in the processed input files.
+      if( m_truthMeta.get() && m_truthMetaAux.get() ) {
+         ATH_MSG_DEBUG( "Recording truth metadata" );
+         ATH_CHECK( outputMetaStore()->record( m_truthMeta.release(),
+                                               m_outputKey ) );
+         ATH_CHECK( outputMetaStore()->record( m_truthMetaAux.release(),
+                                               m_outputKey + "Aux." ) );
+      }
+
+      // Retrun gracefully:
+      return StatusCode::SUCCESS;
+   }
+
+} // namespace xAODMaker
diff --git a/Event/xAOD/xAODTruthCnv/src/components/xAODTruthCnv_entries.cxx b/Event/xAOD/xAODTruthCnv/src/components/xAODTruthCnv_entries.cxx
index caba567aabd..6eaa0bedfd8 100644
--- a/Event/xAOD/xAODTruthCnv/src/components/xAODTruthCnv_entries.cxx
+++ b/Event/xAOD/xAODTruthCnv/src/components/xAODTruthCnv_entries.cxx
@@ -1,10 +1,12 @@
 #include "../xAODTruthCnvAlg.h"
 #include "../RedoTruthLinksAlg.h"
+#include "xAODTruthCnv/TruthMetaDataTool.h"
 #include "../xAODTruthReader.h"
 #include "../HepMCTruthReader.h"
 
 DECLARE_COMPONENT( xAODMaker::xAODTruthCnvAlg )
 DECLARE_COMPONENT( xAODMaker::RedoTruthLinksAlg )
+DECLARE_COMPONENT( xAODMaker::TruthMetaDataTool )
 DECLARE_COMPONENT( xAODReader::xAODTruthReader )
 DECLARE_COMPONENT( HepMCTruthReader )
 
diff --git a/Event/xAOD/xAODTruthCnv/xAODTruthCnv/TruthMetaDataTool.h b/Event/xAOD/xAODTruthCnv/xAODTruthCnv/TruthMetaDataTool.h
new file mode 100644
index 00000000000..d240b8f5519
--- /dev/null
+++ b/Event/xAOD/xAODTruthCnv/xAODTruthCnv/TruthMetaDataTool.h
@@ -0,0 +1,84 @@
+// Dear emacs, this is -*- c++ -*-
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef XAODTRUTHCNV_TRUTHMETADATATOOL_H
+#define XAODTRUTHCNV_TRUTHMETADATATOOL_H
+
+// System include(s):
+#include <string>
+#include <memory>
+
+// Gaudi/Athena include(s):
+#include "AsgTools/AsgMetadataTool.h"
+#ifdef ASGTOOL_ATHENA
+#   include "AthenaPoolKernel/IMetaDataTool.h"
+#endif // ASGTOOL_ATHENA
+
+// EDM include(s):
+#include "xAODTruth/TruthMetaDataContainer.h"
+#include "xAODTruth/TruthMetaDataAuxContainer.h"
+
+namespace xAODMaker {
+
+   /// Tool taking care of copying the truth metadata from file to file
+   ///
+   /// This tool does the heavy lifting when creating/merging DxAOD files to
+   /// make sure that the truth metadata ends up in the output.
+   ///
+   class TruthMetaDataTool : public asg::AsgMetadataTool
+#ifdef ASGTOOL_ATHENA
+                           , public virtual ::IMetaDataTool
+#endif // ASGTOOL_ATHENA
+   {
+
+      /// Declare the correct constructor for Athena
+      ASG_TOOL_CLASS0( TruthMetaDataTool )
+
+   public:
+      /// Regular AlgTool constructor
+      TruthMetaDataTool( const std::string& name = "TruthMetaDataTool" );
+
+      /// Function initialising the tool
+      virtual StatusCode initialize();
+
+   protected:
+      /// @name Functions called by the AsgMetadataTool base class
+      /// @{
+
+      /// Function collecting the configuration metadata from the input
+      /// file
+      virtual StatusCode beginInputFile();
+
+      /// Function writing out the collected metadata
+      virtual StatusCode metaDataStop();
+
+      /// @}
+
+   private:
+      /// @name Tool properties
+      /// @{
+
+      /// The key of the truth metadata in the input file
+      std::string m_inputKey;
+      /// The key of the truth metadata for the output file
+      std::string m_outputKey;
+
+      /// @}
+
+      /// @name Objects accummulating the merged metadata
+      /// @{
+
+      /// The merged trigger menu container
+      std::unique_ptr< xAOD::TruthMetaDataContainer > m_truthMeta;
+      /// The merged trigger menu auxiliary container
+      std::unique_ptr< xAOD::TruthMetaDataAuxContainer > m_truthMetaAux;
+
+      /// @}
+
+   }; // class TruthMetaDataTool
+
+} // namespace xAODMaker
+
+#endif // XAODTRUTHCNV_TRUTHMETADATATOOL_H
diff --git a/Event/xAOD/xAODTruthCnv/xAODTruthCnv/selection.xml b/Event/xAOD/xAODTruthCnv/xAODTruthCnv/selection.xml
new file mode 100644
index 00000000000..a56d7b32960
--- /dev/null
+++ b/Event/xAOD/xAODTruthCnv/xAODTruthCnv/selection.xml
@@ -0,0 +1,5 @@
+<lcgdict>
+
+  <class name="xAODMaker::TruthMetaDataTool" />
+
+</lcgdict>
diff --git a/Event/xAOD/xAODTruthCnv/xAODTruthCnv/xAODTruthCnvDict.h b/Event/xAOD/xAODTruthCnv/xAODTruthCnv/xAODTruthCnvDict.h
new file mode 100644
index 00000000000..b0021f1e8e5
--- /dev/null
+++ b/Event/xAOD/xAODTruthCnv/xAODTruthCnv/xAODTruthCnvDict.h
@@ -0,0 +1,11 @@
+// Dear emacs, this is -*- c++ -*-
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+#ifndef XAODTRUTHCNV_XAODTRUTHCNVDICT_H
+#define XAODTRUTHCNV_XAODTRUTHCNVDICT_H
+
+// Local include(s):
+#include "xAODTruthCnv/TruthMetaDataTool.h"
+
+#endif // XAODTRUTHCNV_XAODTRUTHCNVDICT_H
diff --git a/ForwardDetectors/AFP/AFP_GeoModel/src/AFP_GeoModelTool.cxx b/ForwardDetectors/AFP/AFP_GeoModel/src/AFP_GeoModelTool.cxx
index 324d37c9995..f98edcc31d9 100755
--- a/ForwardDetectors/AFP/AFP_GeoModel/src/AFP_GeoModelTool.cxx
+++ b/ForwardDetectors/AFP/AFP_GeoModel/src/AFP_GeoModelTool.cxx
@@ -213,7 +213,7 @@ StatusCode AFP_GeoModelTool::create()
 
             m_pAFPDetectorFactory->create(world);
             //theFactory.create(world);
-        } catch (std::bad_alloc) {
+        } catch (const std::bad_alloc&) {
             log << MSG::FATAL << "Could not create new DetectorNode!" << endmsg;
             return StatusCode::FAILURE;
         }
diff --git a/ForwardDetectors/AFP/AFP_Monitoring/CMakeLists.txt b/ForwardDetectors/AFP/AFP_Monitoring/CMakeLists.txt
index 958bafb6557..b6b526e1a2d 100644
--- a/ForwardDetectors/AFP/AFP_Monitoring/CMakeLists.txt
+++ b/ForwardDetectors/AFP/AFP_Monitoring/CMakeLists.txt
@@ -12,7 +12,6 @@ atlas_depends_on_subdirs( PUBLIC
    Event/xAOD/xAODForward
    ForwardDetectors/AFP/AFP_RawEv
    PRIVATE
-   External/AtlasROOT
    Tools/LWHists
    Event/xAOD/xAODEventInfo
    )
@@ -22,7 +21,7 @@ atlas_add_component( AFP_Monitoring
    src/*.cxx
    src/components/*.cxx
    PUBLIC_HEADERS AFP_Monitoring
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib LWHists xAODForward xAODEventInfo AFP_RawEv)
+   LINK_LIBRARIES AthenaMonitoringLib LWHists xAODForward xAODEventInfo AFP_RawEv)
 
 atlas_install_headers( AFP_Monitoring )
-atlas_install_joboptions( share/*.py )
\ No newline at end of file
+atlas_install_joboptions( share/*.py )
diff --git a/ForwardDetectors/AFP/AFP_Monitoring/src/AFPTechnicalMonitorTool.cxx b/ForwardDetectors/AFP/AFP_Monitoring/src/AFPTechnicalMonitorTool.cxx
index 15eacdb0e75..9f0ef5bf9be 100644
--- a/ForwardDetectors/AFP/AFP_Monitoring/src/AFPTechnicalMonitorTool.cxx
+++ b/ForwardDetectors/AFP/AFP_Monitoring/src/AFPTechnicalMonitorTool.cxx
@@ -97,8 +97,8 @@ StatusCode AFPTechnicalMonitorTool::fillHistograms()
     const AFP_RawDataContainer* afpContainer = 0;
     CHECK(evtStore()->retrieve(afpContainer));
 
-    for (AFP_RawDataCollection* hitCollection : *afpContainer) {
-      for (AFP_RawData* hit : *hitCollection) {
+    for (const AFP_RawDataCollection* hitCollection : *afpContainer) {
+      for (const AFP_RawData* hit : *hitCollection) {
     	if (hit->Get_link() <= 3) {
     	  m_cNearStation.fillHistograms(*hit);
     	}
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDBasicKalman.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDBasicKalman.h
index b780e69ef43..aaedfc244a8 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDBasicKalman.h
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDBasicKalman.h
@@ -32,7 +32,6 @@
 #define MAXCHI2TRK 3.0
 #define MAXSHAREDHITS 2
 
-using namespace std;
 
 class AFP_SIDBasicKalman
 {
@@ -44,14 +43,14 @@ class AFP_SIDBasicKalman
 		float m_AmpThresh;
 		int m_iDataType;
 
-		list<SIDRESULT> m_listResults;
-		list<SIDHIT>    m_ListSIDHits;
-		map<Int_t, SIDHITPOS> m_MapSIDHitPos;
+                std::list<SIDRESULT> m_listResults;
+                std::list<SIDHIT>    m_ListSIDHits;
+                std::map<Int_t, SIDHITPOS> m_MapSIDHitPos;
 
 	public:
-		StatusCode Initialize(float fAmpThresh, int iDataType, const list<SIDHIT> &ListSIDHits, Float_t fsSID[SIDSTATIONID][SIDCNT], Float_t fxSID[SIDSTATIONID][SIDCNT], Float_t fySID[SIDSTATIONID][SIDCNT], Float_t fzSID[SIDSTATIONID][SIDCNT]);
+		StatusCode Initialize(float fAmpThresh, int iDataType, const std::list<SIDHIT> &ListSIDHits, Float_t fsSID[SIDSTATIONID][SIDCNT], Float_t fxSID[SIDSTATIONID][SIDCNT], Float_t fySID[SIDSTATIONID][SIDCNT], Float_t fzSID[SIDSTATIONID][SIDCNT]);
 		StatusCode Execute();
-		StatusCode Finalize(list<SIDRESULT>* pListResults);
+		StatusCode Finalize(std::list<SIDRESULT>* pListResults);
 		
 		void GetData();
 
@@ -70,37 +69,37 @@ class AFP_SIDBasicKalman
 		TH2F* m_histS4_PixMap;
 		
 	private:
-		vector<SIDHITSEED> m_pTrkSeeds;
+                std::vector<SIDHITSEED> m_pTrkSeeds;
 		CLHEP::HepMatrix m_Hk, m_Qk, m_Vk, m_C0;
 		
 		CLHEP::HepMatrix m_m0, m_x0;
 		Float_t m_z0;
 		
-		vector< CLHEP::HepMatrix > m_Fk;
-		vector< CLHEP::HepMatrix > m_Ck;
-		vector< CLHEP::HepMatrix > m_CkP;
-		vector< CLHEP::HepMatrix > m_Rk;
-
-		vector< CLHEP::HepVector > m_xk;
-		vector< CLHEP::HepVector > m_xkP;
-		vector< CLHEP::HepVector > m_rk;
-		vector< CLHEP::HepVector > m_rkP;
-		vector< CLHEP::HepVector > m_mk;
-		vector< Float_t > m_chik;
-		vector< Float_t > m_zk;
-		vector< Int_t >   m_HID;
+		std::vector< CLHEP::HepMatrix > m_Fk;
+		std::vector< CLHEP::HepMatrix > m_Ck;
+		std::vector< CLHEP::HepMatrix > m_CkP;
+		std::vector< CLHEP::HepMatrix > m_Rk;
+
+		std::vector< CLHEP::HepVector > m_xk;
+		std::vector< CLHEP::HepVector > m_xkP;
+		std::vector< CLHEP::HepVector > m_rk;
+		std::vector< CLHEP::HepVector > m_rkP;
+		std::vector< CLHEP::HepVector > m_mk;
+		std::vector< Float_t > m_chik;
+		std::vector< Float_t > m_zk;
+		std::vector< Int_t >   m_HID;
 		
-		vector< CLHEP::HepVector > m_xkS;
-		vector< CLHEP::HepMatrix > m_CkS;
-		vector< Float_t > m_chikS;
+		std::vector< CLHEP::HepVector > m_xkS;
+		std::vector< CLHEP::HepMatrix > m_CkS;
+		std::vector< Float_t > m_chikS;
 		
-		void FillSIDHITPOS(const SIDHIT &SIDHit, map<Int_t, SIDHITPOS> &MapSIDHitPos);
+		void FillSIDHITPOS(const SIDHIT &SIDHit, std::map<Int_t, SIDHITPOS> &MapSIDHitPos);
 		void GetTrkSeeds();
 		bool FillTrkPropagators(const SIDHITSEED &SIDHitSeed, Int_t plateF);
 		bool FillTrkPropagators(Int_t stID, Int_t plateF);
 		void Smooth();
 		void FilterTrkCollection();
-		Int_t GetSharedHits(const vector<Int_t> &HID1, const vector<Int_t>  &HID2);
+		Int_t GetSharedHits(const std::vector<Int_t> &HID1, const std::vector<Int_t>  &HID2);
 		void ClearMatrix();
 		
 };
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h
index af4386b6ad4..726b223884d 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h
@@ -62,8 +62,6 @@
 #include "xAODForward/AFPTrackContainer.h"
 
 
-using namespace std;
-
 #define SIDSTATIONID 4
 
 class StoreGateSvc;
@@ -72,7 +70,7 @@ class ActiveStoreSvc;
 class AFP_SIDLocReco : public AthAlgorithm
 {
 	public:
-		AFP_SIDLocReco(const string& name, ISvcLocator* pSvcLocator);
+                AFP_SIDLocReco(const std::string& name, ISvcLocator* pSvcLocator);
 		~AFP_SIDLocReco();
 
 	private:
@@ -101,12 +99,12 @@ class AFP_SIDLocReco : public AthAlgorithm
 		Float_t m_fzSID[SIDSTATIONID][SIDCNT];
 
 
-		string m_strKeyGeometryForReco;
-		vector<string> m_vecListAlgoSID;
-		string m_strAlgoSID;
+                std::string m_strKeyGeometryForReco;
+                std::vector<std::string> m_vecListAlgoSID;
+                std::string m_strAlgoSID;
 	
-		string m_strKeySIDLocRecoEvCollection;
-		string m_strSIDCollectionName;
+                std::string m_strKeySIDLocRecoEvCollection;
+                std::string m_strSIDCollectionName;
 
 	public:
 		StatusCode initialize();
@@ -119,10 +117,10 @@ class AFP_SIDLocReco : public AthAlgorithm
 		void SaveGeometry();
 		void ClearGeometry();
 
-		StatusCode AFPCollectionReading(list<SIDHIT> &ListSIDHits);	
+		StatusCode AFPCollectionReading(std::list<SIDHIT> &ListSIDHits);	
 
 		StatusCode RecordSIDCollection();
-  StatusCode ExecuteRecoMethod(const string strAlgo, const list<SIDHIT> &ListSIDHits, xAOD::AFPTrackContainer* resultContainer);
+                StatusCode ExecuteRecoMethod(const std::string strAlgo, const std::list<SIDHIT> &ListSIDHits, xAOD::AFPTrackContainer* resultContainer);
 };
 
 #endif	//AFP_TDLOCRECO_h
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h
index 38374159408..17af9482b3f 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDLocReco.h
@@ -56,8 +56,6 @@
 
 
 
-using namespace std;
-
 #define NSIDE  3
 #define NTRACK 10
 #define NTRIG  4
@@ -69,7 +67,7 @@ class ActiveStoreSvc;
 class AFP_TDLocReco : public AthAlgorithm
 {
 	public:
-		AFP_TDLocReco(const string& name, ISvcLocator* pSvcLocator);
+                AFP_TDLocReco(const std::string& name, ISvcLocator* pSvcLocator);
 		~AFP_TDLocReco();
 
 	private:
@@ -90,12 +88,12 @@ class AFP_TDLocReco : public AthAlgorithm
 		Int_t m_iEvent;				//event number from zero value
 		Float_t m_AmpThresh;			// TD signal amplitude threshold
 
-		string m_strKeyGeometryForReco;
-		vector<string> m_vecListAlgoTD;
-		string m_strAlgoTD;
+                std::string m_strKeyGeometryForReco;
+                std::vector<std::string> m_vecListAlgoTD;
+                std::string m_strAlgoTD;
 	
-		string m_strKeyTDLocRecoEvCollection;
-		string m_strTDCollectionName;
+                std::string m_strKeyTDLocRecoEvCollection;
+                std::string m_strTDCollectionName;
 
 	public:
 		StatusCode initialize();
@@ -108,10 +106,10 @@ class AFP_TDLocReco : public AthAlgorithm
 		void SaveGeometry();
 		void ClearGeometry();
 
-		StatusCode AFPCollectionReading(list<TDHIT> &ListTDHits);	
+		StatusCode AFPCollectionReading(std::list<TDHIT> &ListTDHits);	
 
 		StatusCode RecordTDCollection();
-		StatusCode ExecuteRecoMethod(const string strAlgo, const list<TDHIT> &ListMDHits);
+		StatusCode ExecuteRecoMethod(const std::string strAlgo, const std::list<TDHIT> &ListMDHits);
 };
 
 #endif	//AFP_TDLOCRECO_h
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDZVertex.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDZVertex.h
index 3d562fbc6fb..0fef25b1190 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDZVertex.h
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_TDZVertex.h
@@ -19,7 +19,6 @@
 #include "AFP_LocReco/AFP_UserObjects.h"
 //#include "AFP_Geometry/AFP_constants.h"
 
-using namespace std;
 
 class AFP_TDZVertex
 {
@@ -32,12 +31,12 @@ class AFP_TDZVertex
 		int m_iDataType;
 
 	private:
-		list<TDRESULT> m_listResults;
+                std::list<TDRESULT> m_listResults;
 
 	public:
 		StatusCode Initialize(float fAmpThresh, int iDataType);
-		StatusCode Execute(const list<TDHIT> &ListTDHits);
-		StatusCode Finalize(list<TDRESULT>* pListResults);
+		StatusCode Execute(const std::list<TDHIT> &ListTDHits);
+		StatusCode Finalize(std::list<TDRESULT>* pListResults);
 
 		void GetData();
 
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_UserObjects.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_UserObjects.h
index 6d565e07e82..213811ef372 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_UserObjects.h
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_UserObjects.h
@@ -8,8 +8,6 @@
 #include <iostream>
 #include <vector>
 
-using namespace std;
-
 typedef struct _TDHIT
 {
 	int iEvent;
@@ -84,7 +82,7 @@ typedef struct _SIDRESULT
 	float y_slope;
 	float z_slope;
 	
-	vector<int> ListHitID;
+        std::vector<int> ListHitID;
 	
 	float nHits;
 	float nHoles;
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_SIDBasicKalman.cxx b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_SIDBasicKalman.cxx
index c8ff7f9bb7b..b8c52f70e0f 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_SIDBasicKalman.cxx
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_SIDBasicKalman.cxx
@@ -46,7 +46,7 @@ AFP_SIDBasicKalman::~AFP_SIDBasicKalman()
 	m_listResults.clear();
 }
 
-StatusCode AFP_SIDBasicKalman::Initialize(float fAmpThresh, int iDataType, const list<SIDHIT> &ListSIDHits, Float_t fsSID[SIDSTATIONID][SIDCNT], Float_t fxSID[SIDSTATIONID][SIDCNT], Float_t fySID[SIDSTATIONID][SIDCNT], Float_t fzSID[SIDSTATIONID][SIDCNT])
+StatusCode AFP_SIDBasicKalman::Initialize(float fAmpThresh, int iDataType, const std::list<SIDHIT> &ListSIDHits, Float_t fsSID[SIDSTATIONID][SIDCNT], Float_t fxSID[SIDSTATIONID][SIDCNT], Float_t fySID[SIDSTATIONID][SIDCNT], Float_t fzSID[SIDSTATIONID][SIDCNT])
 {
 
       	m_AmpThresh = (float)fAmpThresh;
@@ -57,18 +57,18 @@ StatusCode AFP_SIDBasicKalman::Initialize(float fAmpThresh, int iDataType, const
 	Float_t delta_pixel_x = 0.050*CLHEP::mm; // size of pixel along x, in mm
 	Float_t delta_pixel_y = 0.250*CLHEP::mm; // size of pixel along y, in mm
 
-        Float_t interPlaneX[4][4] ={0,0,0,0,
-                                    0,0,0,0,
-                                    0,-0.187358,-0.127971,0,
-                                    0,-0.101478,-0.0661546,-0.0675869};
-        Float_t interPlaneY[4][4] ={0,0,0,0,
-                                    0,0,0,0,
-                                    0,-0.134756, -0.204807,0,
-                                    0, -0.155841, -0.334444,-0.341143};
-        Float_t Alpha[4][4] ={0,0,0,0,
-                                    0,0,0,0, 
-                                    0.2443461,0.253198,0.227862,0, 
-                                    0.2443461,0.250661,0.252849,0.247896};
+        Float_t interPlaneX[4][4] ={{0,0,0,0},
+                                    {0,0,0,0},
+                                    {0,-0.187358,-0.127971,0},
+                                    {0,-0.101478,-0.0661546,-0.0675869}};
+        Float_t interPlaneY[4][4] ={{0,0,0,0},
+                                    {0,0,0,0},
+                                    {0,-0.134756, -0.204807,0},
+                                    {0, -0.155841, -0.334444,-0.341143}};
+        Float_t Alpha[4][4] ={{0,0,0,0},
+                              {0,0,0,0}, 
+                              {0.2443461,0.253198,0.227862,0}, 
+                              {0.2443461,0.250661,0.252849,0.247896}};
 
 	
 	// x-y-z map of all pixels
@@ -99,7 +99,7 @@ StatusCode AFP_SIDBasicKalman::Initialize(float fAmpThresh, int iDataType, const
 	}
 
 	// x-y-z map of hit pixels
-	list<SIDHIT>::const_iterator iter;
+        std::list<SIDHIT>::const_iterator iter;
 	for (iter=ListSIDHits.begin(); iter!=ListSIDHits.end(); iter++)
 	{
          	if ((*iter).fADC > m_AmpThresh)
@@ -160,7 +160,7 @@ StatusCode AFP_SIDBasicKalman::Execute()
 	MsgStream LogStream(Athena::getMessageSvc(), "AFP_SIDBasicKalman::Execute()");
 	
 //	/*
-	map<Int_t, SIDHITPOS>::const_iterator iter0;
+        std::map<Int_t, SIDHITPOS>::const_iterator iter0;
 	for (iter0=m_MapSIDHitPos.begin(); iter0!=m_MapSIDHitPos.end(); iter0++)
 	{
                 /*
@@ -183,7 +183,7 @@ StatusCode AFP_SIDBasicKalman::Execute()
 	GetTrkSeeds();
 	////////////////////////
 
-	vector<SIDHITSEED>::const_iterator iter1;
+        std::vector<SIDHITSEED>::const_iterator iter1;
 	for (iter1= m_pTrkSeeds.begin(); iter1!= m_pTrkSeeds.end(); iter1++)
 	{
                  		
@@ -240,14 +240,14 @@ StatusCode AFP_SIDBasicKalman::Execute()
 
 		LogStream << MSG::DEBUG << "Found new track candidate with parameters:" << endmsg;
 		LogStream << MSG::DEBUG << "Hit ID's : ";
-		vector<Int_t>::const_iterator iter2;
+                std::vector<Int_t>::const_iterator iter2;
 		for (iter2= m_HID.begin(); iter2!= m_HID.end(); iter2++) LogStream << MSG::DEBUG << (*iter2) << "\t";
 		LogStream << endmsg;
 		
 		LogStream << MSG::DEBUG << "Filtered parameters : X, DX, Y, DY, chi2" << endmsg;
-		vector< CLHEP::HepVector >::const_iterator iter3;
-		vector< Float_t >::const_iterator iter4 = m_chik.begin();
-			LogStream << MSG::DEBUG << (*iter1).fSeedX << "\t" << (*iter1).fSeedDX << "\t" << (*iter1).fSeedY << "\t" << (*iter1).fSeedDY << "\t" << 0 << endmsg;
+                std::vector< CLHEP::HepVector >::const_iterator iter3;
+                std::vector< Float_t >::const_iterator iter4 = m_chik.begin();
+                LogStream << MSG::DEBUG << (*iter1).fSeedX << "\t" << (*iter1).fSeedDX << "\t" << (*iter1).fSeedY << "\t" << (*iter1).fSeedDY << "\t" << 0 << endmsg;
 		for (iter3=m_xk.begin(); iter3!= m_xk.end(); iter3++)
 		{
 			LogStream << MSG::DEBUG << (*iter3)[0] << "\t" << (*iter3)[1] << "\t" << (*iter3)[2] << "\t" << (*iter3)[3] << "\t" << (*iter4) << endmsg;
@@ -262,8 +262,8 @@ StatusCode AFP_SIDBasicKalman::Execute()
 		Float_t Chi2Sum = 0;
 		
 		LogStream << MSG::DEBUG << "Smoothed parameters : X, DX, Y, DY, chi2" << endmsg;
-		vector< CLHEP::HepVector >::const_reverse_iterator iter5;
-		vector< Float_t >::const_reverse_iterator iter6 = m_chikS.rbegin();
+                std::vector< CLHEP::HepVector >::const_reverse_iterator iter5;
+                std::vector< Float_t >::const_reverse_iterator iter6 = m_chikS.rbegin();
 		for (iter5=m_xkS.rbegin(); iter5!= m_xkS.rend(); ++iter5)
 		{				
 			LogStream << MSG::DEBUG << (*iter5)[0] << "\t" << (*iter5)[1] << "\t" << (*iter5)[2] << "\t" << (*iter5)[3] << "\t" << (*iter6) << endmsg;
@@ -299,7 +299,7 @@ StatusCode AFP_SIDBasicKalman::Execute()
 	
 	if (m_listResults.size()!=0)
 	{
-		list<SIDRESULT>::const_iterator iter7;
+                std::list<SIDRESULT>::const_iterator iter7;
 		LogStream << MSG::INFO << "Filtered tracks parameters : X, DX, Y, DY, Z, quality: " << endmsg;
 		for (iter7=m_listResults.begin(); iter7!=m_listResults.end(); iter7++)
 		{
@@ -313,7 +313,7 @@ StatusCode AFP_SIDBasicKalman::Execute()
 	return StatusCode::SUCCESS;
 }
 
-StatusCode AFP_SIDBasicKalman::Finalize(list<SIDRESULT>* pListResults)
+StatusCode AFP_SIDBasicKalman::Finalize(std::list<SIDRESULT>* pListResults)
 {
 	*pListResults = m_listResults;
 
@@ -322,7 +322,7 @@ StatusCode AFP_SIDBasicKalman::Finalize(list<SIDRESULT>* pListResults)
 	return StatusCode::SUCCESS;
 }
 
-void AFP_SIDBasicKalman::FillSIDHITPOS(const SIDHIT &SIDHit, map<Int_t, SIDHITPOS> &MapSIDHitPos)
+void AFP_SIDBasicKalman::FillSIDHITPOS(const SIDHIT &SIDHit, std::map<Int_t, SIDHITPOS> &MapSIDHitPos)
 {
 	SIDHITPOS SIDHitPos;
 
@@ -347,12 +347,12 @@ void AFP_SIDBasicKalman::FillSIDHITPOS(const SIDHIT &SIDHit, map<Int_t, SIDHITPO
 	Int_t HitID = nStID*1000000+nPlID*100000+nPixCol*100+nPixRow;
 	// Remove close hit pixel in X wrt signal amplitude
         // Actually do simple clustering
-	map<Int_t, SIDHITPOS>::iterator iter0 = MapSIDHitPos.find(HitID-100);
-	map<Int_t, SIDHITPOS>::iterator iter1 = MapSIDHitPos.find(HitID+100);
+        std::map<Int_t, SIDHITPOS>::iterator iter0 = MapSIDHitPos.find(HitID-100);
+        std::map<Int_t, SIDHITPOS>::iterator iter1 = MapSIDHitPos.find(HitID+100);
 	
 	if( iter0==MapSIDHitPos.end() && iter1==MapSIDHitPos.end())
 	{
-		MapSIDHitPos.insert(pair<Int_t, SIDHITPOS>(HitID, SIDHitPos));
+          MapSIDHitPos.insert(std::pair<Int_t, SIDHITPOS>(HitID, SIDHitPos));
 	}
 	
 	else if( iter0!=MapSIDHitPos.end() )
@@ -371,7 +371,7 @@ void AFP_SIDBasicKalman::FillSIDHITPOS(const SIDHIT &SIDHit, map<Int_t, SIDHITPO
                 SIDHitPos.fPixZ	/=SIDHitPos.fAmp;                
 
 		MapSIDHitPos.erase(iter0);
-		MapSIDHitPos.insert(pair<Int_t, SIDHITPOS>(HitID, SIDHitPos));
+		MapSIDHitPos.insert(std::pair<Int_t, SIDHITPOS>(HitID, SIDHitPos));
 //		}
 	}
 	
@@ -390,7 +390,7 @@ void AFP_SIDBasicKalman::FillSIDHITPOS(const SIDHIT &SIDHit, map<Int_t, SIDHITPO
        	       	SIDHitPos.fPixZ /=SIDHitPos.fAmp;
 
 		MapSIDHitPos.erase(iter1);
-		MapSIDHitPos.insert(pair<Int_t, SIDHITPOS>(HitID, SIDHitPos));
+		MapSIDHitPos.insert(std::pair<Int_t, SIDHITPOS>(HitID, SIDHitPos));
 //		}
 	}
 
@@ -398,10 +398,10 @@ void AFP_SIDBasicKalman::FillSIDHITPOS(const SIDHIT &SIDHit, map<Int_t, SIDHITPO
 
 void AFP_SIDBasicKalman::GetTrkSeeds()
 {	
-	map<Int_t, SIDHITPOS> MapSIDHitPosSeed0;
-	map<Int_t, SIDHITPOS> MapSIDHitPosSeed1;
+        std::map<Int_t, SIDHITPOS> MapSIDHitPosSeed0;
+        std::map<Int_t, SIDHITPOS> MapSIDHitPosSeed1;
 
-	list<SIDHIT>::const_iterator iter;
+        std::list<SIDHIT>::const_iterator iter;
 	for (iter=m_ListSIDHits.begin(); iter!=m_ListSIDHits.end(); iter++)
 	{
 		if ((*iter).fADC > m_AmpThresh && (*iter).nDetectorID == 0)
@@ -416,8 +416,8 @@ void AFP_SIDBasicKalman::GetTrkSeeds()
 	}
 
 
-	map<Int_t, SIDHITPOS>::const_iterator iter0;
-	map<Int_t, SIDHITPOS>::const_iterator iter1;
+        std::map<Int_t, SIDHITPOS>::const_iterator iter0;
+        std::map<Int_t, SIDHITPOS>::const_iterator iter1;
 	for (iter0=MapSIDHitPosSeed0.begin(); iter0!=MapSIDHitPosSeed0.end(); iter0++)
 	{
 		for (iter1=MapSIDHitPosSeed1.begin(); iter1!=MapSIDHitPosSeed1.end(); iter1++)
@@ -477,7 +477,7 @@ bool AFP_SIDBasicKalman::FillTrkPropagators(const SIDHITSEED &SIDHitSeed, Int_t
 	CLHEP::HepVector mi(2);
 	Float_t XYdist=100.*CLHEP::mm;
 	Int_t HitID=-1;
-	map<Int_t, SIDHITPOS>::const_iterator iter;
+        std::map<Int_t, SIDHITPOS>::const_iterator iter;
 	for (iter=m_MapSIDHitPos.begin(); iter!=m_MapSIDHitPos.end(); iter++)
 	{
 		if( (*iter).second.nStationID != SIDHitSeed.nStationID ) continue;
@@ -550,7 +550,7 @@ bool AFP_SIDBasicKalman::FillTrkPropagators(Int_t stID, Int_t plateF)
 	CLHEP::HepVector mi(2);
 	Float_t XYdist=100.*CLHEP::mm;
 	Int_t HitID=-1;
-	map<Int_t, SIDHITPOS>::const_iterator iter;
+	std::map<Int_t, SIDHITPOS>::const_iterator iter;
 	for (iter=m_MapSIDHitPos.begin(); iter!=m_MapSIDHitPos.end(); iter++)
 	{
 		if( (*iter).second.nStationID != stID ) continue;
@@ -709,8 +709,8 @@ void AFP_SIDBasicKalman::Smooth()
 void AFP_SIDBasicKalman::FilterTrkCollection()
 {
 	//filtering tracking collection using shared hits + quality requirement
-	list<SIDRESULT>::iterator iter1;
-	list<SIDRESULT>::iterator iter2;
+        std::list<SIDRESULT>::iterator iter1;
+        std::list<SIDRESULT>::iterator iter2;
 	for (iter1=m_listResults.begin(); iter1!=m_listResults.end(); iter1++)
 	{
 		for (iter2=m_listResults.begin(); iter2!=m_listResults.end(); )
@@ -736,12 +736,12 @@ void AFP_SIDBasicKalman::FilterTrkCollection()
 	
 }
 
-Int_t AFP_SIDBasicKalman::GetSharedHits(const vector<Int_t> &HID1, const vector<Int_t>  &HID2)
+Int_t AFP_SIDBasicKalman::GetSharedHits(const std::vector<Int_t> &HID1, const std::vector<Int_t>  &HID2)
 {
 	Int_t SharedHits = 0;
 	
-	vector<Int_t>::const_iterator iter1;
-	vector<Int_t>::const_iterator iter2;
+        std::vector<Int_t>::const_iterator iter1;
+        std::vector<Int_t>::const_iterator iter2;
 	
 	for (iter1=HID1.begin(); iter1!=HID1.end(); iter1++)
 	{
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_SIDLocReco.cxx b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_SIDLocReco.cxx
index 5f283d2456d..14663c7e6fb 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_SIDLocReco.cxx
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_SIDLocReco.cxx
@@ -16,7 +16,7 @@
 #include "xAODForward/AFPTrackAuxContainer.h"
 
 
-AFP_SIDLocReco::AFP_SIDLocReco(const string& name, ISvcLocator* pSvcLocator) :
+AFP_SIDLocReco::AFP_SIDLocReco(const std::string& name, ISvcLocator* pSvcLocator) :
   AthAlgorithm(name, pSvcLocator)
 {
   ATH_MSG_DEBUG("begin AFP_SIDLocReco::AFP_SIDLocReco");
@@ -119,7 +119,7 @@ StatusCode AFP_SIDLocReco::execute()
 
   StatusCode sc;
 
-  list<SIDHIT> ListSIDHits;
+  std::list<SIDHIT> ListSIDHits;
   ListSIDHits.clear();
 
   m_eventNum = 0;
@@ -170,7 +170,7 @@ StatusCode AFP_SIDLocReco::execute()
     //		return StatusCode::SUCCESS;
   }
   else {
-    string strAlgoSID;
+    std::string strAlgoSID;
     for(unsigned int i=0; i<m_vecListAlgoSID.size(); i++)
       {
 	strAlgoSID = m_vecListAlgoSID[i];
@@ -216,7 +216,7 @@ void AFP_SIDLocReco::ClearGeometry()
 }
 
 
-StatusCode AFP_SIDLocReco::AFPCollectionReading(list<SIDHIT> &ListSIDHits)
+StatusCode AFP_SIDLocReco::AFPCollectionReading(std::list<SIDHIT> &ListSIDHits)
 {
   StatusCode sc;
 
@@ -237,7 +237,7 @@ StatusCode AFP_SIDLocReco::AFPCollectionReading(list<SIDHIT> &ListSIDHits)
   xAOD::AFPSiHitContainer::const_iterator mcSIDGenEnd = siHitContainer->end();
 
   for(;hitIter!=mcSIDGenEnd;++hitIter) {
-    xAOD::AFPSiHit* hit = *hitIter;
+    const xAOD::AFPSiHit* hit = *hitIter;
     SIDHit.iEvent 			= m_eventNum;
     SIDHit.fADC  			= hit->depositedCharge();
     SIDHit.fTDC 			= 0;
@@ -345,7 +345,7 @@ void AFP_SIDLocReco::SaveGeometry()
   ATH_MSG_DEBUG("end AFP_SIDLocReco::SaveGeometry()");
 }
 
-StatusCode AFP_SIDLocReco::ExecuteRecoMethod(const string strAlgo, const list<SIDHIT> &ListSIDHits, xAOD::AFPTrackContainer* resultContainer)
+StatusCode AFP_SIDLocReco::ExecuteRecoMethod(const std::string strAlgo, const std::list<SIDHIT> &ListSIDHits, xAOD::AFPTrackContainer* resultContainer)
 {
   ATH_MSG_DEBUG("begin AFP_SIDLocReco::ExecuteRecoMethod()");
 
@@ -356,12 +356,12 @@ StatusCode AFP_SIDLocReco::ExecuteRecoMethod(const string strAlgo, const list<SI
 
   StatusCode sc = StatusCode::SUCCESS;
   SIDRESULT SIDResults;
-  list<SIDRESULT> listSIDResults;
+  std::list<SIDRESULT> listSIDResults;
   listSIDResults.clear();
 
-  map<string, int> mapRecoMethods;
+  std::map<std::string, int> mapRecoMethods;
   mapRecoMethods.clear();
-  mapRecoMethods.insert(pair<string, int>("SIDBasicKalman", 1));
+  mapRecoMethods.insert(std::pair<std::string, int>("SIDBasicKalman", 1));
 
   switch(mapRecoMethods[strAlgo])
     {
@@ -380,7 +380,7 @@ StatusCode AFP_SIDLocReco::ExecuteRecoMethod(const string strAlgo, const list<SI
 	sc = pSIDBasicKalman->Execute();
 	sc = pSIDBasicKalman->Finalize(&listSIDResults);
 
-	list<SIDRESULT>::const_iterator iter;
+        std::list<SIDRESULT>::const_iterator iter;
 	for(iter=listSIDResults.begin(); iter!=listSIDResults.end(); iter++) {
 	  if (iter->nStationID != -1) {
 	    xAOD::AFPTrack* track = new xAOD::AFPTrack;
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_TDLocReco.cxx b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_TDLocReco.cxx
index ff66c082c54..777d343dbb1 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_TDLocReco.cxx
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_TDLocReco.cxx
@@ -8,7 +8,7 @@
 #include "AthenaKernel/errorcheck.h"
 #include "AthenaBaseComps/AthMsgStreamMacros.h" 
 
-AFP_TDLocReco::AFP_TDLocReco(const string& name, ISvcLocator* pSvcLocator) :
+AFP_TDLocReco::AFP_TDLocReco(const std::string& name, ISvcLocator* pSvcLocator) :
 AthAlgorithm(name, pSvcLocator)
 {
 	ATH_MSG_DEBUG("begin AFP_TDLocReco::AFP_TDLocReco");
@@ -111,7 +111,7 @@ StatusCode AFP_TDLocReco::execute()
 
 	StatusCode sc;
 
-	list<TDHIT> ListTDHits;
+        std::list<TDHIT> ListTDHits;
 	ListTDHits.clear();
 
 	m_eventNum = 0;
@@ -157,7 +157,7 @@ StatusCode AFP_TDLocReco::execute()
 	}
 	else
 	{
-		string strAlgoTD;
+                std::string strAlgoTD;
 		for(unsigned int i=0; i<m_vecListAlgoTD.size(); i++)
 		{
 			strAlgoTD = m_vecListAlgoTD[i];
@@ -203,7 +203,7 @@ void AFP_TDLocReco::ClearGeometry()
 }
 
 
-StatusCode AFP_TDLocReco::AFPCollectionReading(list<TDHIT> &ListTDHits)
+StatusCode AFP_TDLocReco::AFPCollectionReading(std::list<TDHIT> &ListTDHits)
 {
 	StatusCode sc;
 
@@ -280,19 +280,19 @@ void AFP_TDLocReco::SaveGeometry()
 	ATH_MSG_DEBUG("end AFP_TDLocReco::SaveGeometry()");
 }
 
-StatusCode AFP_TDLocReco::ExecuteRecoMethod(const string strAlgo, const list<TDHIT> &ListTDHits)
+StatusCode AFP_TDLocReco::ExecuteRecoMethod(const std::string strAlgo, const std::list<TDHIT> &ListTDHits)
 {
 	ATH_MSG_DEBUG("begin AFP_TDLocReco::ExecuteRecoMethod()");
 
 	StatusCode sc = StatusCode::SUCCESS;
 	TDRESULT TDResults;
-	list<TDRESULT> listTDResults;
+        std::list<TDRESULT> listTDResults;
 	listTDResults.clear();
 
 
-	map<string, int> mapRecoMethods;
+        std::map<std::string, int> mapRecoMethods;
 	mapRecoMethods.clear();
-	mapRecoMethods.insert(pair<string, int>("TDZVertex", 1));
+	mapRecoMethods.insert(std::pair<std::string, int>("TDZVertex", 1));
 
 
 	switch(mapRecoMethods[strAlgo])
@@ -305,7 +305,7 @@ StatusCode AFP_TDLocReco::ExecuteRecoMethod(const string strAlgo, const list<TDH
 			sc = pTDZVertex->Execute(ListTDHits);
 			sc = pTDZVertex->Finalize(&listTDResults);
 
-			list<TDRESULT>::const_iterator iter;
+                        std::list<TDRESULT>::const_iterator iter;
 			for(iter=listTDResults.begin(); iter!=listTDResults.end(); iter++)
 			{
 				TDResults.nStationID  = (*iter).nStationID;
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_TDZVertex.cxx b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_TDZVertex.cxx
index b1ce8781292..a43de9e2bdb 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_TDZVertex.cxx
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/src/AFP_TDZVertex.cxx
@@ -26,7 +26,7 @@ StatusCode AFP_TDZVertex::Initialize(float fAmpThresh, int iDataType)
 	return StatusCode::SUCCESS;
 }
 
-StatusCode AFP_TDZVertex::Execute(const list<TDHIT> &ListTDHits)
+StatusCode AFP_TDZVertex::Execute(const std::list<TDHIT> &ListTDHits)
 {
 
 	
@@ -35,7 +35,7 @@ StatusCode AFP_TDZVertex::Execute(const list<TDHIT> &ListTDHits)
 	const int NTRAINS = 4;
 	//const int NBARS = 32;
 	
-	vector<float> vecTDHit[NST][NDET][NTRAINS];
+        std::vector<float> vecTDHit[NST][NDET][NTRAINS];
 	
 	for (int i=0; i<NST; i++)
 	{
@@ -49,7 +49,7 @@ StatusCode AFP_TDZVertex::Execute(const list<TDHIT> &ListTDHits)
 	}
 
 	
-	list<TDHIT>::const_iterator iter;
+        std::list<TDHIT>::const_iterator iter;
 	for (iter=ListTDHits.begin(); iter!=ListTDHits.end(); iter++)
 	{
 		if ((*iter).fADC > m_AmpThresh)
@@ -107,7 +107,7 @@ StatusCode AFP_TDZVertex::Execute(const list<TDHIT> &ListTDHits)
 	return StatusCode::SUCCESS;
 }
 
-StatusCode AFP_TDZVertex::Finalize(list<TDRESULT>* pListResults)
+StatusCode AFP_TDZVertex::Finalize(std::list<TDRESULT>* pListResults)
 {
 	*pListResults = m_listResults;
 
diff --git a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx
index 2b25edb069d..e0e5d5a35f9 100644
--- a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx
+++ b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx
@@ -85,28 +85,28 @@ int ALFA_BeamTrack::initialize(const FPConfig &ConfigValues){
 	*/
 	
 	//Set Configuration parameters of FPTracker library
-	FPTracker::ConfigData m_ConfigData;
+	FPTracker::ConfigData ConfigData;
 	
 	
-	m_ConfigData.IP=ConfigValues.IP;
-	m_ConfigData.useaper=ConfigValues.useaper;
-	m_ConfigData.apermb=ConfigValues.apermb;
-	m_ConfigData.xcol1=ConfigValues.xcol1;
-	m_ConfigData.xcol2=ConfigValues.xcol2;
-	m_ConfigData.absZMagMax=ConfigValues.absZMagMax;
-	m_ConfigData.endMarker=ConfigValues.RPDistance;
-	m_ConfigData.setpbeam(ConfigValues.pbeam0);
+	ConfigData.IP=ConfigValues.IP;
+	ConfigData.useaper=ConfigValues.useaper;
+	ConfigData.apermb=ConfigValues.apermb;
+	ConfigData.xcol1=ConfigValues.xcol1;
+	ConfigData.xcol2=ConfigValues.xcol2;
+	ConfigData.absZMagMax=ConfigValues.absZMagMax;
+	ConfigData.endMarker=ConfigValues.RPDistance;
+	ConfigData.setpbeam(ConfigValues.pbeam0);
 	
 	/*
-	std::cout<<m_ConfigData.IP<<std::endl;
-	std::cout<<m_ConfigData.useaper<<std::endl;
-	std::cout<<m_ConfigData.apermb<<std::endl;
-	std::cout<<m_ConfigData.xcol1<<std::endl;
-	std::cout<<m_ConfigData.xcol2<<std::endl;
-	std::cout<<m_ConfigData.absZMagMax<<std::endl;
-	std::cout<<m_ConfigData.endMarker<<std::endl;
-	std::cout<<m_ConfigData.pbeam0<<std::endl;
-	std::cout<<m_ConfigData.brho<<std::endl;*/
+	std::cout<<ConfigData.IP<<std::endl;
+	std::cout<<ConfigData.useaper<<std::endl;
+	std::cout<<ConfigData.apermb<<std::endl;
+	std::cout<<ConfigData.xcol1<<std::endl;
+	std::cout<<ConfigData.xcol2<<std::endl;
+	std::cout<<ConfigData.absZMagMax<<std::endl;
+	std::cout<<ConfigData.endMarker<<std::endl;
+	std::cout<<ConfigData.pbeam0<<std::endl;
+	std::cout<<ConfigData.brho<<std::endl;*/
 	
 	
 	
@@ -116,14 +116,14 @@ int ALFA_BeamTrack::initialize(const FPConfig &ConfigValues){
 	
 	
     
-	m_ip     = m_ConfigData.IP;
+	m_ip     = ConfigData.IP;
      	m_Magver = 3;
      
      	m_Side = FPTracker::beam1;
      	m_Magfile =  m_AlfaTwiss ? 
     	FPTracker::getAlfaMagnetConfigFiles(m_ConfDir, m_Side):
 			FPTracker::getMagnetConfigFiles(m_ConfDir, m_ip, m_Magver, m_Side);
-       	m_Beamline_1 = FPTracker::setupBeamline(m_ConfigData, m_Side, m_Magver, m_Magfile);
+       	m_Beamline_1 = FPTracker::setupBeamline(ConfigData, m_Side, m_Magver, m_Magfile);
     	std::cout<<" beamline_1 start  "<<'\n';
 	std::cout<<m_Beamline_1;
 	std::cout<<" beamline_1 end  "<<"\n\n";
@@ -132,7 +132,7 @@ int ALFA_BeamTrack::initialize(const FPConfig &ConfigValues){
 	m_Magfile =  m_AlfaTwiss ? 
     	FPTracker::getAlfaMagnetConfigFiles(m_ConfDir, m_Side):
 			FPTracker::getMagnetConfigFiles(m_ConfDir, m_ip, m_Magver, m_Side);
-	m_Beamline_2 = setupBeamline(m_ConfigData, m_Side, m_Magver, m_Magfile);
+	m_Beamline_2 = setupBeamline(ConfigData, m_Side, m_Magver, m_Magfile);
   
 	std::cout<<" beamline_2 start  "<<'\n';
 	std::cout<<m_Beamline_2;
diff --git a/ForwardDetectors/ALFA/ALFA_GeoModel/src/ALFA_DetectorFactory.cxx b/ForwardDetectors/ALFA/ALFA_GeoModel/src/ALFA_DetectorFactory.cxx
index 2ebe3918acf..06cc33f8ea3 100755
--- a/ForwardDetectors/ALFA/ALFA_GeoModel/src/ALFA_DetectorFactory.cxx
+++ b/ForwardDetectors/ALFA/ALFA_GeoModel/src/ALFA_DetectorFactory.cxx
@@ -1257,7 +1257,7 @@ void ALFA_DetectorFactory::ConstructODFibers00(const eRPotName eRPName, const in
 	MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeoModel::ALFA_DetectorFactory");
 	
 	int i;
-	char szLabel[32];
+	char szLabel[180];
 	HepGeom::Transform3D TransODFiber;
 	
 	GeoBox* OD_Fiberbox1 = new GeoBox(4.*CLHEP::mm,.24*CLHEP::mm,.24*CLHEP::mm);
@@ -1363,7 +1363,7 @@ void ALFA_DetectorFactory::ConstructODFibers00(const eRPotName eRPName, const in
 void ALFA_DetectorFactory::ConstructODFibers01(const eRPotName eRPName, const int iODPlate, eFiberType eFType, GeoFullPhysVol* pMotherVolume, const HepGeom::Transform3D& MotherTransform, const HepGeom::Transform3D& TransODCladding)
 {
 	int i;
-	char szLabel[32];
+	char szLabel[180];
 	HepGeom::Transform3D TransODFiber;
 	
 	GeoBox* OD_Fiberbox1 = new GeoBox(4.*CLHEP::mm,.24*CLHEP::mm,.24*CLHEP::mm);
diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h
index 06f76a4274e..a05aa65651c 100644
--- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h
+++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h
@@ -68,8 +68,6 @@
 
 #include "ALFA_GloRec/AlfaLocalHits.h"
 
-using namespace std;
-
 class StoreGateSvc;
 class ActiveStoreSvc;
 
@@ -104,12 +102,12 @@ private:
     //  steerable members
     //////////////////////////////////////////////
     int m_iDataType;            
-    string m_strTrackPathPatterns;
+    std::string m_strTrackPathPatterns;
     TObjArray m_TObjArrTrackPathPatterns;
-    string m_strGloRecAnalysisFile;
-    string m_strGloRecCollectionName;   
-    string m_strLocRecCorrCollectionName;
-    string m_TruthCollectionName;   
+    std::string m_strGloRecAnalysisFile;
+    std::string m_strGloRecCollectionName;   
+    std::string m_strLocRecCorrCollectionName;
+    std::string m_TruthCollectionName;   
         
 
     //////////////////////////////////////////////
diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/AlfaLocalHits.h b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/AlfaLocalHits.h
index 2fd74fbe31b..96346b57c89 100644
--- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/AlfaLocalHits.h
+++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/AlfaLocalHits.h
@@ -22,8 +22,6 @@
 #include "TObjArray.h"
 #include "TObjString.h"
 
-using namespace std;
-
 
 
 ////////////////////////////////////////////
@@ -37,23 +35,23 @@ class AlfaLocalHit{
     	TString m_potname;
     	int m_ishit;
     	Float_t m_x, m_y, m_z;
-        ALFA_LocRecCorrEvent * m_LocRecCorr;
+        const ALFA_LocRecCorrEvent * m_LocRecCorr;
   	public:
     	AlfaLocalHit();
-    	AlfaLocalHit(ALFA_LocRecCorrEvent * LocRecCorrHit);
-    	AlfaLocalHit(AlfaLocalHit * h);
-        void    SetHit(ALFA_LocRecCorrEvent * LocRecCorrHit); 
+    	AlfaLocalHit(const ALFA_LocRecCorrEvent * LocRecCorrHit);
+    	AlfaLocalHit(const AlfaLocalHit * h);
+        void    SetHit(const ALFA_LocRecCorrEvent * LocRecCorrHit); 
     	void    AssignZ();
-    	int     GetPotNum(){return m_pot;};
-    	float   GetX(){return m_x;};
-    	float   GetY(){return m_y;};
-    	float   GetZ(){return m_z;};
-    	int     IsHi(){return m_ishit;};
+    	int     GetPotNum() const {return m_pot;};
+    	float   GetX() const {return m_x;};
+    	float   GetY() const {return m_y;};
+    	float   GetZ() const {return m_z;};
+    	int     IsHi() const {return m_ishit;};
     	int     GetMDindex(const char * name);
-    	TString GetPotName(){return m_potname;};
-	    TString GetMDname (int i);
-	    ALFA_LocRecCorrEvent * GetLocRecCorr(){return m_LocRecCorr;};
-	    void    Print();
+    	TString GetPotName() const {return m_potname;};
+        TString GetMDname (int i);
+        const ALFA_LocRecCorrEvent * GetLocRecCorr() const {return m_LocRecCorr;};
+        void    Print();
 };
 
 ///////////////////////////////////////////////////
@@ -68,9 +66,9 @@ class AlfaLocalHit{
 ///////////////////////////////////////////////////
 class AlfaLocalHits : public AlfaLocalHit {
 	private:
-		vector<AlfaLocalHit> m_hits;
+                std::vector<AlfaLocalHit> m_hits;
 		int  m_nhits;
-		vector<AlfaLocalHits> m_paths;
+                std::vector<AlfaLocalHits> m_paths;
 		int  m_npaths;
 		TString m_pathpattern;
 	public:
diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/src/ALFA_GloRec.cxx b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/src/ALFA_GloRec.cxx
index 67280064abd..b7f1c0a7b10 100644
--- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/src/ALFA_GloRec.cxx
+++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/src/ALFA_GloRec.cxx
@@ -170,7 +170,7 @@ StatusCode ALFA_GloRec::initialize() {
 	msg(MSG::DEBUG) << "======================================" << endmsg;
 	msg(MSG::DEBUG) << "ALFA_GloRec::initialize  - data type  " << endmsg;
 	msg(MSG::DEBUG) << "======================================" << endmsg;
-	msg(MSG::DEBUG) << "DataType = " << m_iDataType << endl;
+	msg(MSG::DEBUG) << "DataType = " << m_iDataType << endmsg;
 
 	TString l_strtmp(m_strTrackPathPatterns);
   	m_TObjArrTrackPathPatterns.Clear();
@@ -259,10 +259,9 @@ StatusCode ALFA_GloRec::execute() {
 	ALFA_LocRecCorrEvCollection::const_iterator mcColBeg = pLocRecCorrCol->begin();
 	ALFA_LocRecCorrEvCollection::const_iterator mcColEnd = pLocRecCorrCol->end();
 	AlfaLocalHits hits;
-	ALFA_LocRecCorrEvent * pLocRecCorr_tmp = 0;
 	for(; mcColBeg!=mcColEnd; ++mcColBeg) {
 	        HepGeom::Point3D<double> PointInAtlasCS;
-		pLocRecCorr_tmp = static_cast<ALFA_LocRecCorrEvent*> (*mcColBeg);
+		const ALFA_LocRecCorrEvent* pLocRecCorr_tmp = static_cast<const ALFA_LocRecCorrEvent*> (*mcColBeg);
 		AlfaLocalHit l_hit(pLocRecCorr_tmp);
 		hits.AddHit(l_hit);
 		//PointInAtlasCS = m_pGeometryReader->GetDetPointInAtlas((eRPotName)(iRPot+1), Point3D<double>(fRecPosX, fRecPosY, 10.0));
diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/src/AlfaLocalHits.cxx b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/src/AlfaLocalHits.cxx
index 2d103a05dfd..844f7a3edce 100644
--- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/src/AlfaLocalHits.cxx
+++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/src/AlfaLocalHits.cxx
@@ -13,6 +13,9 @@
 #include "ALFA_LocRecEv/ALFA_LocRecEvent.h"
 #include "ALFA_LocRecCorrEv/ALFA_LocRecCorrEvent.h"
 
+using std::cout;
+using std::endl;
+
 ////////////////////////////////////////////
 //
 //  implementation of AlfaLocalHit
@@ -30,12 +33,12 @@ AlfaLocalHit::AlfaLocalHit(){
 }
 
 
-AlfaLocalHit::AlfaLocalHit(ALFA_LocRecCorrEvent * LocRecCorrHit){
+AlfaLocalHit::AlfaLocalHit(const ALFA_LocRecCorrEvent * LocRecCorrHit){
   // explicit constructor 
   SetHit(LocRecCorrHit);
 }
 
-AlfaLocalHit::AlfaLocalHit(AlfaLocalHit * h){
+AlfaLocalHit::AlfaLocalHit(const AlfaLocalHit * h){
   m_pot = h->GetPotNum();
   m_potname = GetMDname(m_pot);
   m_ishit = 1;
@@ -46,7 +49,7 @@ AlfaLocalHit::AlfaLocalHit(AlfaLocalHit * h){
 }
 
 
-void AlfaLocalHit::SetHit(ALFA_LocRecCorrEvent * LocRecCorrHit){
+void AlfaLocalHit::SetHit(const ALFA_LocRecCorrEvent * LocRecCorrHit){
   m_pot = LocRecCorrHit->getPotNum();
   //cout << "AlfaLocalHit::SetHit... m_pot = " << m_pot << endl;
   m_potname = GetMDname(m_pot);
diff --git a/ForwardDetectors/FPTracker/FPTracker/CollimatorData.h b/ForwardDetectors/FPTracker/FPTracker/CollimatorData.h
index 8006b28fd9f..6c27b3718f3 100644
--- a/ForwardDetectors/FPTracker/FPTracker/CollimatorData.h
+++ b/ForwardDetectors/FPTracker/FPTracker/CollimatorData.h
@@ -10,7 +10,8 @@
 
 namespace FPTracker{
   class ConfigData;
-  struct CollimatorData{
+  class CollimatorData{
+  public:
     static const int ncoll = 2;
     std::vector< std::vector<double> > coll_z;
     std::vector< std::vector<double> > coll_xap;
diff --git a/ForwardDetectors/FPTracker/FPTracker/ConfigData.h b/ForwardDetectors/FPTracker/FPTracker/ConfigData.h
index 8c5d83f6bf3..353a7855141 100644
--- a/ForwardDetectors/FPTracker/FPTracker/ConfigData.h
+++ b/ForwardDetectors/FPTracker/FPTracker/ConfigData.h
@@ -6,7 +6,8 @@
 #define  FPTRACKER_CONDIFGDATA_H
 #include <ostream>
 namespace FPTracker{
-  struct ConfigData{
+  class ConfigData{
+  public:
     
     int    IP;
 //    float  xinner0;
diff --git a/ForwardDetectors/FPTracker/src/readConfigData.cxx b/ForwardDetectors/FPTracker/src/readConfigData.cxx
index 41b1df59bd2..a101417a3bd 100644
--- a/ForwardDetectors/FPTracker/src/readConfigData.cxx
+++ b/ForwardDetectors/FPTracker/src/readConfigData.cxx
@@ -17,7 +17,7 @@ namespace FPTracker{
 
   class ValueSetter{
   public:
-    ValueSetter():errors_(false){}
+    ValueSetter():m_errors(false){}
     
     template<class T>
     bool setValue(T& val, const std::string& s)
@@ -29,35 +29,35 @@ namespace FPTracker{
 	}
       catch (boost::bad_lexical_cast& )
 	{
-	  errors_ = true;
+	  m_errors = true;
 	  ok      = false;
 
 	  std::ostringstream ost;
 	  ost<<"error converting "<< s <<'\n';
 	  SimpleLogger::getLogger()->info(ost);
 
-	  notConverted_.push_back(s);
+	  m_notConverted.push_back(s);
 	}
       
       return ok;
     }
     
-    bool errors() const {return errors_;}
+    bool errors() const {return m_errors;}
     
     std::vector<std::string>::const_iterator begin() const
     {
-      return notConverted_.begin();
+      return m_notConverted.begin();
     }
 
     
     std::vector<std::string>::const_iterator end() const
     {
-      return notConverted_.end();
+      return m_notConverted.end();
     }
 
   private:
-    bool errors_;
-    std::vector< std::string > notConverted_;
+    bool m_errors;
+    std::vector< std::string > m_notConverted;
   };
       
 
diff --git a/ForwardDetectors/ForwardSimulation/ForwardRegionGeoModel/src/ForwardRegionGeoModelTool.cxx b/ForwardDetectors/ForwardSimulation/ForwardRegionGeoModel/src/ForwardRegionGeoModelTool.cxx
index acfe8ab53ff..daba635469d 100755
--- a/ForwardDetectors/ForwardSimulation/ForwardRegionGeoModel/src/ForwardRegionGeoModelTool.cxx
+++ b/ForwardDetectors/ForwardSimulation/ForwardRegionGeoModel/src/ForwardRegionGeoModelTool.cxx
@@ -84,7 +84,7 @@ ForwardRegionGeoModelTool::create()
       //
       GeoPhysVol *world=&*theExpt->getPhysVol();
       theFactory.create(world);
-    } catch (std::bad_alloc) {
+    } catch (const std::bad_alloc&) {
       log << MSG::FATAL << "Could not create new DetectorNode!" << endmsg;
       return StatusCode::FAILURE; 
     }
diff --git a/ForwardDetectors/ForwardTracker/ForwardTracker/ConfigData.h b/ForwardDetectors/ForwardTracker/ForwardTracker/ConfigData.h
index 004696f99d5..ebd0537fc3a 100644
--- a/ForwardDetectors/ForwardTracker/ForwardTracker/ConfigData.h
+++ b/ForwardDetectors/ForwardTracker/ForwardTracker/ConfigData.h
@@ -9,7 +9,8 @@
 
 namespace ForwardTracker {
 
-  struct ConfigData {
+  class ConfigData {
+  public:
     
     std::string twissFile1;
     std::string twissFile2;
diff --git a/ForwardDetectors/ZDC/ZDC_GeoM/src/ZDC_DetTool.cxx b/ForwardDetectors/ZDC/ZDC_GeoM/src/ZDC_DetTool.cxx
index 948b960ef1f..30cecd5ab0e 100644
--- a/ForwardDetectors/ZDC/ZDC_GeoM/src/ZDC_DetTool.cxx
+++ b/ForwardDetectors/ZDC/ZDC_GeoM/src/ZDC_DetTool.cxx
@@ -53,7 +53,7 @@ StatusCode ZDC_DetTool::create()
       GeoPhysVol* world = &*theExpt->getPhysVol();
       theZDCFactory.create(world);  
     } 
-    catch (std::bad_alloc) {
+    catch (const std::bad_alloc&) {
       
       if (msgLevel(MSG::FATAL)) msg(MSG::FATAL) << "Could not create new ZDC DetectorNode!" << endmsg;
       return StatusCode::FAILURE; 
diff --git a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h b/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h
index 3d574faf8fc..d3a778b6d24 100755
--- a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h
+++ b/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h
@@ -42,7 +42,7 @@ public:
     */
 
     //Identifier          h2s_channel_id          ( const HWIdentifier & id ) const throw (ZdcID_Exception);
-    Identifier          h2s_channel_id          ( int crate, int channel ) const throw (ZdcID_Exception);
+    Identifier          h2s_channel_id          ( int crate, int channel ) const;
 
     //HWIdentifier        s2h_ppm_hwid              ( const Identifier & id ) const;
     //HWIdentifier        s2h_channel_hwid          ( const Identifier & id ) const;// throw (ZdcID_Exception);
diff --git a/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingService.cxx b/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingService.cxx
index 0da8a2b3f8f..92e17339b62 100755
--- a/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingService.cxx
+++ b/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingService.cxx
@@ -345,7 +345,6 @@ Identifier ZdcCablingService::h2s_channel_id ( const HWIdentifier & hwid ) const
 */
 
 Identifier ZdcCablingService::h2s_channel_id ( int crate, int channel ) const
-  throw (ZdcID_Exception)
 {
 
   int side     = hwid2side     (crate,channel);
diff --git a/Generators/EvgenProdTools/src/FixHepMC.cxx b/Generators/EvgenProdTools/src/FixHepMC.cxx
index c63016ed940..0652494768f 100644
--- a/Generators/EvgenProdTools/src/FixHepMC.cxx
+++ b/Generators/EvgenProdTools/src/FixHepMC.cxx
@@ -25,7 +25,8 @@ FixHepMC::FixHepMC(const string& name, ISvcLocator* pSvcLocator)
 
 StatusCode FixHepMC::execute() {
   for (McEventCollection::const_iterator ievt = events()->begin(); ievt != events()->end(); ++ievt) {
-    HepMC::GenEvent* evt = *ievt;
+    // FIXME: const_cast
+    HepMC::GenEvent* evt = const_cast<HepMC::GenEvent*>(*ievt);
 
     // Add a unit entry to the event weight vector if it's currently empty
     if (evt->weights().empty()) {
diff --git a/Generators/GenAnalysisTools/EventBoost/EventBoost/EventBoost.h b/Generators/GenAnalysisTools/EventBoost/EventBoost/EventBoost.h
index d6ee1fbe583..49fc8cf4da0 100755
--- a/Generators/GenAnalysisTools/EventBoost/EventBoost/EventBoost.h
+++ b/Generators/GenAnalysisTools/EventBoost/EventBoost/EventBoost.h
@@ -45,7 +45,7 @@ public:
   StatusCode Analyse_EndEvent();
   StatusCode GenAnalysis_initialize();
   StatusCode GenAnalysis_finalize();
-  StatusCode AnalyseGenEvent(HepMC::GenEvent*);
+  StatusCode AnalyseGenEvent(const HepMC::GenEvent*);
   StatusCode EventCopy(const HepMC::GenEvent* evt) const;
 
   bool doModification(HepMC::GenParticle * part, double& pxsum);
diff --git a/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx b/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx
index b74571bd4e8..a1972c9482e 100755
--- a/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx
+++ b/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx
@@ -82,7 +82,7 @@ StatusCode EventBoost::execute() {
 
   for(it=mcCollptr->begin(); it!=mcCollptr->end(); it++) {
 
-    HepMC::GenEvent* genEvt = (*it);
+    const HepMC::GenEvent* genEvt = (*it);
     EventCopy(genEvt);
 
   }
@@ -97,7 +97,7 @@ StatusCode EventBoost::execute() {
 
   for(it=mcCollptrCOPY->begin(); it!=mcCollptrCOPY->end(); it++) {
 
-    HepMC::GenEvent* newEvt = (*it);
+    const HepMC::GenEvent* newEvt = (*it);
 
     //Call user analysis for this genevent:
     if (AnalyseGenEvent(newEvt).isFailure())
@@ -168,12 +168,12 @@ StatusCode EventBoost::GenAnalysis_finalize(){
 
 //______________________________________________________________________________
 
-StatusCode EventBoost::AnalyseGenEvent(HepMC::GenEvent* genEvt) {
+StatusCode EventBoost::AnalyseGenEvent(const HepMC::GenEvent* genEvt) {
 
   msg(MSG::VERBOSE) << "EventBoost begin AnalyseGenEvent()" << endmsg;
 
-  HepMC::GenEvent::particle_iterator p = genEvt->particles_begin();
-  HepMC::GenEvent::particle_iterator pEnd = genEvt->particles_end();
+  HepMC::GenEvent::particle_const_iterator p = genEvt->particles_begin();
+  HepMC::GenEvent::particle_const_iterator pEnd = genEvt->particles_end();
 
   std::vector<HepMC::GenParticle*> particles_needing_modification;
 
@@ -198,8 +198,8 @@ StatusCode EventBoost::AnalyseGenEvent(HepMC::GenEvent* genEvt) {
   
   if ((m_gaussian_vertex_smearing)||(m_flat_vertex_smearing)) {
 
-    HepMC::GenEvent::vertex_iterator v = genEvt->vertices_begin();
-    HepMC::GenEvent::vertex_iterator vEnd = genEvt->vertices_end();
+    HepMC::GenEvent::vertex_const_iterator v = genEvt->vertices_begin();
+    HepMC::GenEvent::vertex_const_iterator vEnd = genEvt->vertices_end();
 
     std::vector<HepMC::GenVertex*> vertices_needing_modification;
     
@@ -265,7 +265,7 @@ StatusCode EventBoost::AnalyseGenEvent(HepMC::GenEvent* genEvt) {
 //__________________________________________________________________________
 
 
-bool EventBoost::doModification(HepMC::GenParticle * part, double& m_pxsum ) {
+bool EventBoost::doModification(HepMC::GenParticle * part, double& pxsum ) {
 
   /*    
   From px' = gamma_x*px+beta_x*gamma_x*E
@@ -287,7 +287,7 @@ bool EventBoost::doModification(HepMC::GenParticle * part, double& m_pxsum ) {
   mom.boost(boostvector);
   part->set_momentum(mom);
   if (part->status()==1) {
-    m_pxsum+=mom.x()-temp;
+    pxsum+=mom.x()-temp;
   }
 
   return true;
diff --git a/Generators/HepMCWeightSvc/CMakeLists.txt b/Generators/HepMCWeightSvc/CMakeLists.txt
index cfc35202a5a..0522a140176 100644
--- a/Generators/HepMCWeightSvc/CMakeLists.txt
+++ b/Generators/HepMCWeightSvc/CMakeLists.txt
@@ -23,6 +23,7 @@ find_package( CORAL COMPONENTS CoralBase )
 # Component(s) in the package:
 atlas_add_component( HepMCWeightSvc
    src/*.cxx src/components/*.cxx
+   NO_PUBLIC_HEADERS
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
    LINK_LIBRARIES ${CORAL_LIBRARIES} GaudiKernel AthenaBaseComps
    AthenaPoolUtilities IOVDbDataModel EventInfo )
diff --git a/Generators/MCTester_i/src/MCTesterAlg.cxx b/Generators/MCTester_i/src/MCTesterAlg.cxx
index 9c0dc89029a..909abe75801 100644
--- a/Generators/MCTester_i/src/MCTesterAlg.cxx
+++ b/Generators/MCTester_i/src/MCTesterAlg.cxx
@@ -148,7 +148,9 @@ StatusCode MCTesterAlg::execute()
     McEventCollection::const_iterator itr;
 
     for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
-      HepMC::GenEvent* evt=(*itr);
+      // const_cast needed because HepMCEvent ctor below takes
+      // a non-const reference (and we probably don't want to copy it).
+      HepMC::GenEvent* evt=const_cast<HepMC::GenEvent*>(*itr);
 
       //make HepMCEvent
       HepMCEvent * temp_event = new HepMCEvent(*evt,m_include_decays_to_self);
diff --git a/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h b/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h
index 69dc3c944df..94d73de726d 100644
--- a/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h
+++ b/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h
@@ -17,7 +17,6 @@ public:
 private:
 
   StoreGateSvc* m_sgSvc;
-  HepMC::IO_GenEvent* m_ascii_in;
   
   // Setable Properties:-
   std::string m_key; 
diff --git a/Generators/TruthIO/src/DumpMC.cxx b/Generators/TruthIO/src/DumpMC.cxx
index 46fc84b3fd6..0e05898da0d 100644
--- a/Generators/TruthIO/src/DumpMC.cxx
+++ b/Generators/TruthIO/src/DumpMC.cxx
@@ -88,7 +88,7 @@ StatusCode DumpMC::execute() {
   for (McEventCollection::const_iterator itr = events_const()->begin(); itr != events_const()->end(); ++itr) {
     //int g_id = (*itr)->signal_process_id();
     //GeneratorName_print(g_id);
-    HepMC::PdfInfo *pdfinfo = (*itr)->pdf_info();
+    const HepMC::PdfInfo *pdfinfo = (*itr)->pdf_info();
     if (pdfinfo) {
       cout << "PdfInfo: "
                 << pdfinfo->id1() << ", "
@@ -103,7 +103,7 @@ StatusCode DumpMC::execute() {
                 <<      endl;
     }
 
-   HepMC::HeavyIon *ion = (*itr)->heavy_ion();
+   const HepMC::HeavyIon *ion = (*itr)->heavy_ion();
     if (ion) {
       std::cout << std::endl;
       std::cout << "Heavy Ion: "
diff --git a/Generators/TruthIO/src/PrintMC.cxx b/Generators/TruthIO/src/PrintMC.cxx
index 32f5a1a8fd7..e23c8aa4faa 100644
--- a/Generators/TruthIO/src/PrintMC.cxx
+++ b/Generators/TruthIO/src/PrintMC.cxx
@@ -61,7 +61,7 @@ StatusCode PrintMC::execute() {
   for (McEventCollection::const_iterator itr = events_const()->begin(); itr != events_const()->end(); ++itr) {
 
     // Get event number from HepMC
-    HepMC::GenEvent* evt = *itr;
+    const HepMC::GenEvent* evt = *itr;
     int evtnum = evt->event_number();
     // Override with evtnum from Athena if enabled and functional
     if (!m_trustHepMC) {
diff --git a/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx b/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx
index 54944999f1b..4fa18d7b520 100644
--- a/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx
+++ b/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx
@@ -23,7 +23,7 @@ extern "C" {
 
 ReadHepEvtFromAscii::ReadHepEvtFromAscii(const std::string& name, ISvcLocator* pSvcLocator) 
   :  AthAlgorithm(name, pSvcLocator),
-     m_sgSvc(0), m_ascii_in(0)
+     m_sgSvc(0)
 {
   // Set users' request
   declareProperty("McEventKey",  m_key        = "GEN_EVENT");
@@ -46,7 +46,6 @@ StatusCode ReadHepEvtFromAscii::initialize(){
   HepMC::HEPEVT_Wrapper::set_max_number_entries(10000);
   
   // Initialize input file
-//  m_ascii_in = new HepMC::IO_Ascii(m_input_file.c_str(), std::ios::in);
   int ifile=5;
   closefile_(ifile);
   openfile_(ifile,m_input_file.c_str(),m_input_file.size());
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/InDetAlignWrt.h b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/InDetAlignWrt.h
index a7982b83917..745d68434e0 100755
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/InDetAlignWrt.h
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/InDetAlignWrt.h
@@ -31,40 +31,40 @@ private:
   bool m_setup;
 
   // algorithm parameters
-  bool par_create;
-  bool par_wrt;
-  bool par_wrtiov;
-  bool par_print;
-  bool par_migrate;
-  std::string par_rfile;
-  std::string par_wfile;
-  std::string par_dispfile;
-  bool par_ntuple;
-  int par_wrtrun;
-  int par_wrtevent;
-  unsigned int par_run1;  // IOV to be filled
-  unsigned int par_run2;
-  unsigned int par_evt1;
-  unsigned int par_evt2;
-  std::string par_iovtag;
-  std::string par_dbtoolinst;
+  bool m_par_create;
+  bool m_par_wrt;
+  bool m_par_wrtiov;
+  bool m_par_print;
+  bool m_par_migrate;
+  std::string m_par_rfile;
+  std::string m_par_wfile;
+  std::string m_par_dispfile;
+  bool m_par_ntuple;
+  int m_par_wrtrun;
+  int m_par_wrtevent;
+  unsigned int m_par_run1;  // IOV to be filled
+  unsigned int m_par_run2;
+  unsigned int m_par_evt1;
+  unsigned int m_par_evt2;
+  std::string m_par_iovtag;
+  std::string m_par_dbtoolinst;
 
   // parameters to add displacements
-  int par_dispmode;
-  int par_dettype;
-  int par_bec;
-  int par_layer;
-  int par_ring;
-  int par_sector;
-  float par_rphidisp;
-  float par_rdisp;
-  float par_zdisp;
-  int par_systdisp;
-  int par_irskip;
-  int par_dispcsc;
-  bool par_wrtbeam;
-  bool par_writetop;
-  std::string par_topname;
+  int m_par_dispmode;
+  int m_par_dettype;
+  int m_par_bec;
+  int m_par_layer;
+  int m_par_ring;
+  int m_par_sector;
+  float m_par_rphidisp;
+  float m_par_rdisp;
+  float m_par_zdisp;
+  int m_par_systdisp;
+  int m_par_irskip;
+  int m_par_dispcsc;
+  bool m_par_wrtbeam;
+  bool m_par_writetop;
+  std::string m_par_topname;
 
   // private methods
   void DispDB();
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/SPLayer.h b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/SPLayer.h
index 712bc7bc2ff..680fee4c019 100755
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/SPLayer.h
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/SPLayer.h
@@ -29,8 +29,6 @@ class SPLayer {
   std::string name() const;
 
  private:
-  int m_hbase;
-  int m_hbase2;
   int m_dettype;
   int m_bec;
   int m_layer;
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/SiDistWriteAlg.h b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/SiDistWriteAlg.h
index f2834f02549..1117995a21c 100755
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/SiDistWriteAlg.h
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/InDetAlignGenAlgs/SiDistWriteAlg.h
@@ -28,10 +28,10 @@ private:
   const SCT_ID* m_sctid;
   bool m_first; // first event flag
   // parameters
-  bool par_print; // flag to print out information 
-  int par_size; // size of distortion array
-  std::string par_readfile; // text file to read for information
-  std::string par_distkey; // SG key for distortion information
+  bool m_par_print; // flag to print out information 
+  int m_par_size; // size of distortion array
+  std::string m_par_readfile; // text file to read for information
+  std::string m_par_distkey; // SG key for distortion information
 
   // private methods
   bool readFile();
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/AddTRTMomConstr.cxx b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/AddTRTMomConstr.cxx
index ee42103c8bc..2d7ea7191d2 100644
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/AddTRTMomConstr.cxx
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/AddTRTMomConstr.cxx
@@ -26,6 +26,7 @@
 #include "InDetIdentifier/TRT_ID.h"
 #include "AtlasDetDescr/AtlasDetectorID.h"
 #include "IdDictDetDescr/IdDictManager.h"
+#include "AthContainers/ConstDataVector.h"
 
 
 
@@ -172,12 +173,12 @@ StatusCode AddTRTMomConstr::execute() {
       msg (MSG::FATAL) << "could not find input track list with name " << m_trackListInput << endmsg ;
       return StatusCode::FAILURE ;
     }
-    TrackCollection* outputtracks = new TrackCollection( SG::VIEW_ELEMENTS ) ;
+    auto outputtracks = std::make_unique<ConstDataVector<TrackCollection> >( SG::VIEW_ELEMENTS ) ;
 
     TrackCollection::const_iterator it  = inputtracks->begin() ;
     TrackCollection::const_iterator itE = inputtracks->end() ;
     for( ; it != itE ; ++it ) {
-      Trk::Track *track = (*it) ;
+      const Trk::Track *track = (*it) ;
       if( m_applyTrkSel && !accept( *track ) ) {
         ATH_MSG_DEBUG( "kinematic requirements not passed, skip track") ;
         continue ;
@@ -193,11 +194,12 @@ StatusCode AddTRTMomConstr::execute() {
       }
     }
 
-    if( sgSvc()->record( outputtracks, m_trackListOutput ).isFailure() ) {
-      msg(MSG::ERROR) << "Failed to record trackcollection with name " << m_trackListOutput << endmsg ;
-    }
     m_nTracksProcessed += inputtracks->size() ;
     m_nTracksAccepted += outputtracks->size() ;
+
+    if( sgSvc()->record( std::move(outputtracks), m_trackListOutput ).isFailure() ) {
+      msg(MSG::ERROR) << "Failed to record trackcollection with name " << m_trackListOutput << endmsg ;
+    }
   }
   return StatusCode::SUCCESS;
 } // execute(.)
@@ -276,20 +278,18 @@ const Trk::TrackStateOnSurface* AddTRTMomConstr::findouterscthit( const Trk::Tra
   ATH_MSG_VERBOSE ("Inside findouterscthit: " << track->trackStateOnSurfaces()->size());
   double rmax=0. ;
   const Trk::TrackStateOnSurface* rc=0 ;
-  for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsos=
-         track->trackStateOnSurfaces()->begin();
-       tsos!=track->trackStateOnSurfaces()->end();++tsos){ 
-    if( !(*tsos)->type(Trk::TrackStateOnSurface::Outlier) &&
-        (*tsos)->measurementOnTrack() &&
-        (*tsos)->trackParameters() ) {
+  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
+    if( !tsos->type(Trk::TrackStateOnSurface::Outlier) &&
+        tsos->measurementOnTrack() &&
+        tsos->trackParameters() ) {
       ATH_MSG_VERBOSE ( "Found good measuredtrackparameters" );
-      const InDet::SCT_ClusterOnTrack* sctclus = dynamic_cast<const InDet::SCT_ClusterOnTrack*>((*tsos)->measurementOnTrack()); 
+      const InDet::SCT_ClusterOnTrack* sctclus = dynamic_cast<const InDet::SCT_ClusterOnTrack*>(tsos->measurementOnTrack()); 
       if(sctclus) {
         ATH_MSG_VERBOSE ( "Found SCT_ClusterOnTrack");
         const Amg::Vector3D& pos = sctclus->globalPosition() ;
         double r = sqrt(pos.x()*pos.x() + pos.y()*pos.y()) ;
         if(rc==0 || r>rmax) {
-          rc = *tsos ;
+          rc = tsos ;
           rmax = r ;
         }
       }
@@ -303,19 +303,18 @@ const Trk::TrackStateOnSurface* AddTRTMomConstr::findinnertrthit( const Trk::Tra
   ATH_MSG_VERBOSE ( "Inside findinnerscthit: " << track->trackStateOnSurfaces()->size() );
   double rmin=9999999. ;
   const Trk::TrackStateOnSurface* rc=0 ;
-  for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsos = track->trackStateOnSurfaces()->begin();
-       tsos!=track->trackStateOnSurfaces()->end();++tsos){ 
-    if( !(*tsos)->type(Trk::TrackStateOnSurface::Outlier) && 
-         (*tsos)->measurementOnTrack() &&
-         (*tsos)->trackParameters() ) {
+  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
+    if( !tsos->type(Trk::TrackStateOnSurface::Outlier) && 
+         tsos->measurementOnTrack() &&
+         tsos->trackParameters() ) {
       ATH_MSG_VERBOSE ( "Found good measuredtrackparameters" );
-      const InDet::TRT_DriftCircleOnTrack* trthit = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>((*tsos)->measurementOnTrack()); 
+      const InDet::TRT_DriftCircleOnTrack* trthit = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(tsos->measurementOnTrack()); 
       if(trthit) {
         ATH_MSG_VERBOSE ( "Found TRT_DriftCircleOnTrack" );
         const Amg::Vector3D& pos = trthit->globalPosition() ;
         double r = sqrt(pos.x()*pos.x() + pos.y()*pos.y()) ;
         if(rc==0 || r<rmin) {
-          rc = *tsos ;
+          rc = tsos ;
           rmin = r ;
         }
       }
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/AlignWrt.cxx b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/AlignWrt.cxx
index 8e467839760..ee94cc38acb 100755
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/AlignWrt.cxx
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/AlignWrt.cxx
@@ -28,75 +28,75 @@ InDetAlignWrt::InDetAlignWrt(const std::string& name, ISvcLocator* pSvcLocator)
    p_migratetool("InDetAlignDBTool/InDetAlignMigrate"),
    p_eventinfo (0),
    m_setup     (false),
-   par_create(true),
-   par_wrt(false),
-   par_wrtiov(true),
-   par_print(false),
-   par_migrate(false),
-   par_rfile(""),
-   par_wfile(""),
-   par_dispfile(""),
-   par_ntuple(false),
-   par_wrtrun(-1),
-   par_wrtevent(0),
-   par_run1(IOVTime::MINRUN),
-   par_run2(IOVTime::MAXRUN),
-   par_evt1(IOVTime::MINEVENT),
-   par_evt2(IOVTime::MAXEVENT),
-   par_iovtag(""),
-   par_dbtoolinst("InDetAlignDBTool"),
-   par_dispmode(0),
-   par_dettype(-1),
-   par_bec(-1),
-   par_layer(-1),
-   par_ring(-1),
-   par_sector(-1),
-   par_rphidisp(0.1),
-   par_rdisp(0.2),
-   par_zdisp(0.3),
-   par_systdisp(1),
-   par_irskip(0),
-   par_dispcsc(0),
-   par_wrtbeam(false),
-   par_writetop(false),
-   par_topname("")
+   m_par_create(true),
+   m_par_wrt(false),
+   m_par_wrtiov(true),
+   m_par_print(false),
+   m_par_migrate(false),
+   m_par_rfile(""),
+   m_par_wfile(""),
+   m_par_dispfile(""),
+   m_par_ntuple(false),
+   m_par_wrtrun(-1),
+   m_par_wrtevent(0),
+   m_par_run1(IOVTime::MINRUN),
+   m_par_run2(IOVTime::MAXRUN),
+   m_par_evt1(IOVTime::MINEVENT),
+   m_par_evt2(IOVTime::MAXEVENT),
+   m_par_iovtag(""),
+   m_par_dbtoolinst("InDetAlignDBTool"),
+   m_par_dispmode(0),
+   m_par_dettype(-1),
+   m_par_bec(-1),
+   m_par_layer(-1),
+   m_par_ring(-1),
+   m_par_sector(-1),
+   m_par_rphidisp(0.1),
+   m_par_rdisp(0.2),
+   m_par_zdisp(0.3),
+   m_par_systdisp(1),
+   m_par_irskip(0),
+   m_par_dispcsc(0),
+   m_par_wrtbeam(false),
+   m_par_writetop(false),
+   m_par_topname("")
 {
   
   // declare algorithm parameters
   declareProperty("BeamConditionService",m_beamcondsvc);   
-  declareProperty("Create",par_create);
-  declareProperty("Write",par_wrt);
-  declareProperty("WriteIOV",par_wrtiov);
-  declareProperty("PrintDB",par_print);
-  declareProperty("Migrate",par_migrate);
-  declareProperty("RFile",par_rfile);
-  declareProperty("WFile",par_wfile);
-  declareProperty("RWNtuple",par_ntuple);
-  declareProperty("WriteRun",par_wrtrun);
-  declareProperty("WriteEvent",par_wrtevent);
-  declareProperty("ValidRun1",par_run1);
-  declareProperty("ValidRun2",par_run2);
-  declareProperty("ValidEvent1",par_evt1);
-  declareProperty("ValidEvent2",par_evt2);
-  declareProperty("IOVTag",par_iovtag);
-  declareProperty("DBToolInst",par_dbtoolinst);
-  declareProperty("DispMode",par_dispmode);
-  declareProperty("DispDet",par_dettype);
-  declareProperty("DispBec",par_bec);
-  declareProperty("DispLayer",par_layer);
-  declareProperty("DispRing",par_ring);
-  declareProperty("DispSector",par_sector);
-  declareProperty("DispRphi",par_rphidisp);
-  declareProperty("DispR",par_rdisp);
-  declareProperty("DispZ",par_zdisp);
-  declareProperty("DispSyst",par_systdisp);
-  declareProperty("DispFile",par_dispfile);
-  declareProperty("RndmSkip",par_irskip);
-  declareProperty("DispCSC",par_dispcsc);
+  declareProperty("Create",m_par_create);
+  declareProperty("Write",m_par_wrt);
+  declareProperty("WriteIOV",m_par_wrtiov);
+  declareProperty("PrintDB",m_par_print);
+  declareProperty("Migrate",m_par_migrate);
+  declareProperty("RFile",m_par_rfile);
+  declareProperty("WFile",m_par_wfile);
+  declareProperty("RWNtuple",m_par_ntuple);
+  declareProperty("WriteRun",m_par_wrtrun);
+  declareProperty("WriteEvent",m_par_wrtevent);
+  declareProperty("ValidRun1",m_par_run1);
+  declareProperty("ValidRun2",m_par_run2);
+  declareProperty("ValidEvent1",m_par_evt1);
+  declareProperty("ValidEvent2",m_par_evt2);
+  declareProperty("IOVTag",m_par_iovtag);
+  declareProperty("DBToolInst",m_par_dbtoolinst);
+  declareProperty("DispMode",m_par_dispmode);
+  declareProperty("DispDet",m_par_dettype);
+  declareProperty("DispBec",m_par_bec);
+  declareProperty("DispLayer",m_par_layer);
+  declareProperty("DispRing",m_par_ring);
+  declareProperty("DispSector",m_par_sector);
+  declareProperty("DispRphi",m_par_rphidisp);
+  declareProperty("DispR",m_par_rdisp);
+  declareProperty("DispZ",m_par_zdisp);
+  declareProperty("DispSyst",m_par_systdisp);
+  declareProperty("DispFile",m_par_dispfile);
+  declareProperty("RndmSkip",m_par_irskip);
+  declareProperty("DispCSC",m_par_dispcsc);
 
-  declareProperty("WriteBeamPos",par_wrtbeam);
-  declareProperty("WriteTopTrans",par_writetop);
-  declareProperty("TopTransFile",par_topname);
+  declareProperty("WriteBeamPos",m_par_wrtbeam);
+  declareProperty("WriteTopTrans",m_par_writetop);
+  declareProperty("TopTransFile",m_par_topname);
 
   declareProperty("InDetAlignDBTool",p_iddbtool);
   declareProperty("InDetAlignMigrateTool",p_migratetool);
@@ -119,11 +119,11 @@ StatusCode InDetAlignWrt::initialize() {
   ATH_CHECK( p_iddbtool.retrieve() );
 
   // get second InDetAlignDBTool for migration if needed
-  if (par_migrate) {
+  if (m_par_migrate) {
     ATH_CHECK (p_migratetool.retrieve() );
   }
   // get BeamCondSvc if needed
-  if (par_wrtbeam) {
+  if (m_par_wrtbeam) {
     
     if ( m_beamcondsvc.retrieve().isFailure()){
            msg( MSG::ERROR) <<"Cannot get BeamCondSvc - beamspots will not be put in ntuple" << endmsg;
@@ -131,25 +131,25 @@ StatusCode InDetAlignWrt::initialize() {
   }
   
   if (msgLvl(MSG::DEBUG)) {
-    if (par_create) msg() << "ID Alignment database structures will be created" << endmsg;
-    if (par_rfile!="") {
-      if (par_ntuple) msg() << "Alignment constants will be initialised from ntuple: " << par_rfile << endmsg;  
-      else msg() << "Alignment constants will be initialised from text file" << par_rfile << endmsg;
+    if (m_par_create) msg() << "ID Alignment database structures will be created" << endmsg;
+    if (m_par_rfile!="") {
+      if (m_par_ntuple) msg() << "Alignment constants will be initialised from ntuple: " << m_par_rfile << endmsg;  
+      else msg() << "Alignment constants will be initialised from text file" << m_par_rfile << endmsg;
     }
-    if (par_dispfile!="") 
-      msg() << "Alignment constants will be set according to recipe in file " << par_dispfile << endmsg;
-    if (par_wrt) 
+    if (m_par_dispfile!="") 
+      msg() << "Alignment constants will be set according to recipe in file " << m_par_dispfile << endmsg;
+    if (m_par_wrt) 
       msg() << "ID Alignment database structures will be written on run " 
-      << par_wrtrun << " event " << par_wrtevent << endmsg;
-    if (par_wfile!="") 
-      msg() << "Structures will be written on file " << par_wfile << endmsg;
-  if (par_wrtbeam) 
-    msg() << "Beampos information will be written on run " << par_wrtrun 
-    << " event " << par_wrtevent << endmsg;
-  if (par_writetop) 
-    msg() << "Toplevel transforms will be read from file " << par_topname 
-    << "and written on run " << par_wrtrun << " event " << par_wrtevent << endmsg;
-  if (!par_wrtiov) 
+      << m_par_wrtrun << " event " << m_par_wrtevent << endmsg;
+    if (m_par_wfile!="") 
+      msg() << "Structures will be written on file " << m_par_wfile << endmsg;
+  if (m_par_wrtbeam) 
+    msg() << "Beampos information will be written on run " << m_par_wrtrun 
+    << " event " << m_par_wrtevent << endmsg;
+  if (m_par_writetop) 
+    msg() << "Toplevel transforms will be read from file " << m_par_topname 
+    << "and written on run " << m_par_wrtrun << " event " << m_par_wrtevent << endmsg;
+  if (!m_par_wrtiov) 
     msg() << "IOV writing will be suppressed - only output stream" << endmsg;
   }
 
@@ -160,21 +160,21 @@ StatusCode InDetAlignWrt::execute() {
 
   if (!m_setup) {
     m_setup=true;
-    if (par_create) {
+    if (m_par_create) {
       ATH_MSG_DEBUG( 
         "Creating null alignment database from geometry information in GeoModel");
       p_iddbtool->createDB();
     }
-    if (par_rfile!="") {
-      if (par_ntuple) {
-	p_iddbtool->readNtuple(par_rfile);
+    if (m_par_rfile!="") {
+      if (m_par_ntuple) {
+	p_iddbtool->readNtuple(m_par_rfile);
       } else {
-	p_iddbtool->readTextFile(par_rfile);
+	p_iddbtool->readTextFile(m_par_rfile);
       }
     }
-    if (par_dispmode>0 || par_dispcsc>0) DispDB();
-    if (par_dispfile!="") dispFile();
-    if (par_print) p_iddbtool->printDB(2);
+    if (m_par_dispmode>0 || m_par_dispcsc>0) DispDB();
+    if (m_par_dispfile!="") dispFile();
+    if (m_par_print) p_iddbtool->printDB(2);
   }
   // make a fall back solution in case event info not available to prevent crash
   int run = -1;
@@ -188,39 +188,39 @@ StatusCode InDetAlignWrt::execute() {
   ATH_MSG_DEBUG(  "In AlignWrt::execute for run/event " << run << 
       "," << event );
   // trigger database write by setting filter passed to false
-  if ((par_wrt || par_wrtbeam || par_writetop) && 
-      par_wrtrun==run && par_wrtevent==event) doOutput();
+  if ((m_par_wrt || m_par_wrtbeam || m_par_writetop) && 
+      m_par_wrtrun==run && m_par_wrtevent==event) doOutput();
 
   return StatusCode::SUCCESS;
 }
 
 
 StatusCode InDetAlignWrt::finalize() {
-  if (par_wrtrun==-1) doOutput();
-  if (par_migrate) doMigration();
+  if (m_par_wrtrun==-1) doOutput();
+  if (m_par_migrate) doMigration();
   return StatusCode::SUCCESS;
 }
 
 void InDetAlignWrt::DispDB() {
   // displace silicon modules according to recipe in DispMode
   // or use DispCSC if appropriate parameter is set
-  //if (par_dispcsc!=0) {
-  //  ATH_MSG_DEBUG("DispCSC called for mode " << par_dispcsc );
-  //  p_iddbtool->dispCSC(par_dettype, par_bec, par_layer, par_ring,
-  //    par_sector, par_dispcsc);
+  //if (m_par_dispcsc!=0) {
+  //  ATH_MSG_DEBUG("DispCSC called for mode " << m_par_dispcsc );
+  //  p_iddbtool->dispCSC(m_par_dettype, m_par_bec, m_par_layer, m_par_ring,
+  //    m_par_sector, m_par_dispcsc);
   //} else {
-  ATH_MSG_DEBUG( "DispDB called for mode " << par_dispmode );
-  p_iddbtool->dispGroup(par_dettype,par_bec,par_layer,par_ring,par_sector,
-			par_rphidisp,par_rdisp,par_zdisp,par_systdisp,par_dispmode,par_irskip);
+  ATH_MSG_DEBUG( "DispDB called for mode " << m_par_dispmode );
+  p_iddbtool->dispGroup(m_par_dettype,m_par_bec,m_par_layer,m_par_ring,m_par_sector,
+			m_par_rphidisp,m_par_rdisp,m_par_zdisp,m_par_systdisp,m_par_dispmode,m_par_irskip);
   //}
 }
 
 void InDetAlignWrt::dispFile() {
   ATH_MSG_DEBUG( 
     "::dispFile() : Initialise AlignableTransforms from parameters file "
-    << par_dispfile );
+    << m_par_dispfile );
   std::ifstream infile;
-  infile.open(par_dispfile.c_str());
+  infile.open(m_par_dispfile.c_str());
   // loop over lines in file
   int nline=0;
   std::string cline;
@@ -234,7 +234,7 @@ void InDetAlignWrt::dispFile() {
        isyst << " to [det,bec,layer] [" << dettype << "," << bec << "," << 
        layer << "] {rphi,r,z} {" << rpd << "," << rd << "," << zd << "}" );
     p_iddbtool->dispGroup(dettype,bec,layer,ring,sector,
-        rpd,rd,zd,isyst,level,par_irskip);
+        rpd,rd,zd,isyst,level,m_par_irskip);
   } // end of input loop
   ATH_MSG_DEBUG( "Read " << nline << 
      " displacement recipe lines" );
@@ -242,23 +242,23 @@ void InDetAlignWrt::dispFile() {
 
 void InDetAlignWrt::doOutput() {
   // write all objects and fill IOV database 
-  if (par_wrt) {
+  if (m_par_wrt) {
     // first sort, just in case
     p_iddbtool->sortTrans();
-    if (par_wfile=="") {
+    if (m_par_wfile=="") {
       ATH_MSG_DEBUG( "doOutput for AlignableTransforms" );
       if (StatusCode::SUCCESS!=p_iddbtool->outputObjs()) 
         msg(MSG::ERROR) << "Write of AlignableTransforms fails" << endmsg;
-      if (par_wrtiov)
-  p_iddbtool->fillDB(par_iovtag,par_run1,par_evt1,par_run2,par_evt2);
+      if (m_par_wrtiov)
+  p_iddbtool->fillDB(m_par_iovtag,m_par_run1,m_par_evt1,m_par_run2,m_par_evt2);
     } else {
-      p_iddbtool->writeFile(par_ntuple,par_wfile);
+      p_iddbtool->writeFile(m_par_ntuple,m_par_wfile);
     }
   }
-  if (par_wrtbeam) {
+  if (m_par_wrtbeam) {
     m_beamcondsvc->fillRec();
   }
-  if (par_writetop) {
+  if (m_par_writetop) {
     genTopTrans();
   }
 }
@@ -266,10 +266,10 @@ void InDetAlignWrt::doOutput() {
 void InDetAlignWrt::genTopTrans() {
   // generate top level transforms into TDS
   ATH_MSG_DEBUG( "Initialise TOPTRANS from parameters file: " <<
-     par_topname);
+     m_par_topname);
   DetCondKeyTrans* dkp=new DetCondKeyTrans();
   std::ifstream infile;
-  infile.open(par_topname.c_str());
+  infile.open(m_par_topname.c_str());
   // loop over all lines in file
   int nline=0;
   std::string cline,key;
@@ -302,6 +302,6 @@ void InDetAlignWrt::doMigration() {
   // write data to POOL file and optionally IOV
   if (StatusCode::SUCCESS!=p_migratetool->outputObjs())
     msg(MSG::ERROR) << "Write of AlignableTransform fails" << endmsg;
-  if (par_wrtiov)
-    p_migratetool->fillDB(par_iovtag,par_run1,par_evt1,par_run2,par_evt2);
+  if (m_par_wrtiov)
+    p_migratetool->fillDB(m_par_iovtag,m_par_run1,m_par_evt1,m_par_run2,m_par_evt2);
 }
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/InDetAlignCog.cxx b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/InDetAlignCog.cxx
index 18c9665aae1..fa58d81703e 100644
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/InDetAlignCog.cxx
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/InDetAlignCog.cxx
@@ -242,8 +242,8 @@ StatusCode InDetAlignCog::execute() {
     Params_t params;
 
     // initialize transforms to identity
-    for( int i=0; i<6; m_cog[i++]){ m_cog[i++]=0.0;} 
-    for( int i=0; i<6; m_resglob[i++]){ m_resglob[i++]=0.0;}
+    for( int i=0; i<6; i++){ m_cog[i]=0.0;} 
+    for( int i=0; i<6; i++){ m_resglob[i]=0.0;}
     m_CoG.setIdentity();
     m_ResGlob.setIdentity();
     
@@ -258,7 +258,7 @@ StatusCode InDetAlignCog::execute() {
 
 
       // normalization of m_cog
-      for( int i=0; i<6; m_cog[i++]){m_cog[i++]/=(double) m_counter;} 
+      for( int i=0; i<6; i++){m_cog[i]/=(double) m_counter;} 
 
 
       // convert to HepGeom::Transform3D:
@@ -314,7 +314,7 @@ StatusCode InDetAlignCog::execute() {
     if( !m_useChi2 ) {
       if (m_counter==0) throw std::logic_error("No Si-elements.");
       // normalization of m_resglob
-      for( int i=0; i<6; m_resglob[i++]){m_resglob[i++]/=(double) m_counter;}
+      for( int i=0; i<6; i++){m_resglob[i]/=(double) m_counter;}
 
       // convert to HepGeom::Transform3D:
       m_ResGlob = makeAffine3d(m_resglob);
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/SPLayer.cxx b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/SPLayer.cxx
index 6c2549cee6e..dfade9c9f2f 100755
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/SPLayer.cxx
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/SPLayer.cxx
@@ -9,10 +9,10 @@
 #include <iostream>
 #include "InDetAlignGenAlgs/SPLayer.h"
 
-SPLayer::SPLayer(const int h1, const int h2, const int det, const int bec,
+SPLayer::SPLayer(const int /*h1*/, const int /*h2*/, const int det, const int bec,
      const int layer, const int side, const std::string& name,
      const std::vector<TH1*>& histlist) :
-  m_hbase(h1), m_hbase2(h2), m_dettype(det), m_bec(bec), m_layer(layer),
+  m_dettype(det), m_bec(bec), m_layer(layer),
   m_side(side),m_nmod(0), m_nhit(0), m_name(name), m_histlist(histlist)
  { 
    std::cout << "In splayer constructer" << std::endl;
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/SiDistWriteAlg.cxx b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/SiDistWriteAlg.cxx
index 2fc072305d8..4536c292be8 100755
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/SiDistWriteAlg.cxx
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/SiDistWriteAlg.cxx
@@ -19,17 +19,17 @@ SiDistWriteAlg::SiDistWriteAlg(const std::string& name, ISvcLocator* pSvcLocator
         
      m_pixid(0),m_sctid(0),
      m_first(true),
-     par_print(false),
-     par_size(3),
-     par_readfile(""),
-     par_distkey("/Indet/PixelDist")
+     m_par_print(false),
+     m_par_size(3),
+     m_par_readfile(""),
+     m_par_distkey("/Indet/PixelDist")
 {
 
  
-  declareProperty("Print",par_print);
-  declareProperty("ReadFile",par_readfile);
-  declareProperty("ArraySize",par_size);
-  declareProperty("KeyName",par_distkey);
+  declareProperty("Print",m_par_print);
+  declareProperty("ReadFile",m_par_readfile);
+  declareProperty("ArraySize",m_par_size);
+  declareProperty("KeyName",m_par_distkey);
 }
 
 SiDistWriteAlg::~SiDistWriteAlg()
@@ -59,11 +59,11 @@ StatusCode SiDistWriteAlg::initialize()
     << endmsg;
   }
    ATH_MSG_DEBUG( "Distortion information in TDS at key " <<
-    par_distkey );
-  if (!par_readfile.empty())
+    m_par_distkey );
+  if (!m_par_readfile.empty())
      ATH_MSG_DEBUG ( "Read distortion parameters from file" 
-    << par_readfile );
-  if (par_print) ATH_MSG_DEBUG ( 
+    << m_par_readfile );
+  if (m_par_print) ATH_MSG_DEBUG ( 
     "Distortion information will be printed on first event" );
   return StatusCode::SUCCESS;
 }
@@ -74,8 +74,8 @@ StatusCode SiDistWriteAlg::finalize() {
 
 StatusCode SiDistWriteAlg::execute() {
   if (m_first) {
-    if (!par_readfile.empty()) readFile();
-    if (par_print) print();
+    if (!m_par_readfile.empty()) readFile();
+    if (m_par_print) print();
   m_first=false;
   }
   return StatusCode::SUCCESS;
@@ -83,14 +83,14 @@ StatusCode SiDistWriteAlg::execute() {
 
 bool SiDistWriteAlg::readFile() {
   // create structure in TDS
-  ATH_MSG_DEBUG ( "Create new DetCondCFloat of size " << par_size
+  ATH_MSG_DEBUG ( "Create new DetCondCFloat of size " << m_par_size
   << " in TDS" );
-  std::unique_ptr<DetCondCFloat> pdist(new DetCondCFloat(par_size,par_distkey));
+  std::unique_ptr<DetCondCFloat> pdist(new DetCondCFloat(m_par_size,m_par_distkey));
   // read data from text file
-  ATH_MSG_DEBUG ( "Opening text file " << par_readfile << 
+  ATH_MSG_DEBUG ( "Opening text file " << m_par_readfile << 
     " to get distortion data" );
   std::ifstream infile;
-  infile.open(par_readfile.c_str());
+  infile.open(m_par_readfile.c_str());
   if (!infile) {
     msg (MSG::ERROR) << "Problem opening input file" << endmsg;
     return false;
@@ -128,11 +128,11 @@ bool SiDistWriteAlg::readFile() {
   ATH_MSG_DEBUG ( "Read distortions for " << nline << " modules" << 
       " of which " << nadd << " successfully added" );
   // record in StoreGate
-  if (StatusCode::SUCCESS==detStore()->record(pdist.get(),par_distkey)) {
+  if (StatusCode::SUCCESS==detStore()->record(pdist.get(),m_par_distkey)) {
     pdist.release();
-    ATH_MSG_DEBUG ( "Recorded DetCondCFloat " << par_distkey << " in TDS" );
+    ATH_MSG_DEBUG ( "Recorded DetCondCFloat " << m_par_distkey << " in TDS" );
   } else {
-    msg(MSG::ERROR) << "Failed to record DetCondCFloat " << par_distkey << " in TDS"
+    msg(MSG::ERROR) << "Failed to record DetCondCFloat " << m_par_distkey << " in TDS"
     << endmsg;
     return false;
   }
@@ -165,10 +165,10 @@ bool SiDistWriteAlg::makeIdent(const std::string& ident,
 }
 
 void SiDistWriteAlg::print() {
-  ATH_MSG_DEBUG ( "Print distortion parameters at " << par_distkey );
+  ATH_MSG_DEBUG ( "Print distortion parameters at " << m_par_distkey );
   // retrieve distortions from Storegate and print in detail
   const DetCondCFloat* pdist=0;
-  if (StatusCode::SUCCESS==detStore()->retrieve(pdist,par_distkey)) {
+  if (StatusCode::SUCCESS==detStore()->retrieve(pdist,m_par_distkey)) {
     pdist->print2();
   } else {
     msg (MSG::ERROR) << "Unable to retrieve distortion parameters " <<
diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignDBTool.h b/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignDBTool.h
index 2b7bcf86b77..e3d6bc03ce3 100755
--- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignDBTool.h
+++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignDBTool.h
@@ -184,17 +184,17 @@ class InDetAlignDBTool: virtual public IInDetAlignDBTool, public AthAlgTool {
 
   CondAttrListCollection* m_attrListCollection;
 
-  bool par_newdb; // create database using new (collection) format
-  bool par_scttwoside; // create structures with separated SCT module sides
-  int par_fake; // set to 1 to fake full ATLAS geom, 2 to fake CTB geom
-  std::string par_condstream; // name of conditions stream
+  bool m_par_newdb; // create database using new (collection) format
+  bool m_par_scttwoside; // create structures with separated SCT module sides
+  int m_par_fake; // set to 1 to fake full ATLAS geom, 2 to fake CTB geom
+  std::string m_par_condstream; // name of conditions stream
   /** name of the root folder for constants, which can be set via 
       the <key> syntax. Default: /Indet/Align. */
-  std::string par_dbroot;
+  std::string m_par_dbroot;
   /** the base part of the key for loading AlignableTransform objects
       from the Transient Data Store. Default: /Indet/Align */
-  std::string par_dbkey;
-  bool par_oldTextFile;  // Input text file using old format
+  std::string m_par_dbkey;
+  bool m_par_oldTextFile;  // Input text file using old format
 
   AlignableTransform* getTransPtr(const std::string key) const;
   const AlignableTransform* cgetTransPtr(const std::string key) const;
diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignFillTrack.h b/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignFillTrack.h
index 036a9f2b379..72fa2a8cc99 100644
--- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignFillTrack.h
+++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignFillTrack.h
@@ -107,137 +107,137 @@ class InDetAlignFillTrack: virtual public IInDetAlignFillTrack, public AthAlgToo
   ToolHandle < Trk::IExtrapolator >      m_extrapolator;  //!<  Pointer to IExtrapolator
   ToolHandle < Trk::ITrackSummaryTool >  m_trackSumTool;  //!<  Pointer to Trk::ITrackSummaryTool
 
-  NTuple::Item<long> nt_ntracks;            //!< number of tracks
-  NTuple::Item<long> nt_nUptracks;          //!< number of Up tracks
-  NTuple::Item<long> nt_nLowtracks;         //!< number of Low tracks
-  NTuple::Item<long> nt_nmctracks;          //!< number of mc tracks
-  NTuple::Item<long> nt_matchingTrk;        //!< matching tracks
+  NTuple::Item<long> m_nt_ntracks;            //!< number of tracks
+  NTuple::Item<long> m_nt_nUptracks;          //!< number of Up tracks
+  NTuple::Item<long> m_nt_nLowtracks;         //!< number of Low tracks
+  NTuple::Item<long> m_nt_nmctracks;          //!< number of mc tracks
+  NTuple::Item<long> m_nt_matchingTrk;        //!< matching tracks
   // ----------------------------------------------------------------------
   // Trk::Track parameters
-  NTuple::Array<float> nt_Trk_d0;      //!< d0 parameter
-  NTuple::Array<float> nt_Trk_z0;      //!< z0 parameter
-  NTuple::Array<float> nt_Trk_phi0;    //!< phi0 parameter
-  NTuple::Array<float> nt_Trk_theta0;  //!< theta0 parameter
-  NTuple::Array<float> nt_Trk_qoverp;  //!< q/p parameter
-  NTuple::Array<float> nt_Trk_pt;      //!< pt parameter
+  NTuple::Array<float> m_nt_Trk_d0;      //!< d0 parameter
+  NTuple::Array<float> m_nt_Trk_z0;      //!< z0 parameter
+  NTuple::Array<float> m_nt_Trk_phi0;    //!< phi0 parameter
+  NTuple::Array<float> m_nt_Trk_theta0;  //!< theta0 parameter
+  NTuple::Array<float> m_nt_Trk_qoverp;  //!< q/p parameter
+  NTuple::Array<float> m_nt_Trk_pt;      //!< pt parameter
   // ----------------------------------------------------------------------
 
   // ----------------------------------------------------------------------
-  NTuple::Array<long> nt_Trk_nHits;      //!< number of hits
-  NTuple::Array<long> nt_Trk_nhitspix;   //!< number of Pixel hits 
-  NTuple::Array<long> nt_Trk_nhitssct;   //!< number of SCT hits
-  NTuple::Array<long> nt_Trk_nhitstrt;   //!<  number of TRT hits
-
-  NTuple::Array<long> nt_Trk_nsharedPixels; //!< number of Pixel shared hits 
-  NTuple::Array<long> nt_Trk_nsharedSCT;    //!< number of SCT shared hits 
-  NTuple::Array<long> nt_Trk_nshared;       //!< number of shared hits 
-
-  NTuple::Array<long> nt_Trk_nholesPixels;  //!< number of Pixel holes 
-  NTuple::Array<long> nt_Trk_nholesSCT;     //!< number of SCT holes 
-  NTuple::Array<long> nt_Trk_nholes;        //!< number of holes 
-
-  NTuple::Array<float> nt_Trk_chi2;      //!< number of chi2 
-  NTuple::Array<long> nt_Trk_ndof;       //!< number of ndof 
-  NTuple::Array<float> nt_Trk_chi2Prob;  //!< number of chi2 probability 
+  NTuple::Array<long> m_nt_Trk_nHits;      //!< number of hits
+  NTuple::Array<long> m_nt_Trk_nhitspix;   //!< number of Pixel hits 
+  NTuple::Array<long> m_nt_Trk_nhitssct;   //!< number of SCT hits
+  NTuple::Array<long> m_nt_Trk_nhitstrt;   //!<  number of TRT hits
+
+  NTuple::Array<long> m_nt_Trk_nsharedPixels; //!< number of Pixel shared hits 
+  NTuple::Array<long> m_nt_Trk_nsharedSCT;    //!< number of SCT shared hits 
+  NTuple::Array<long> m_nt_Trk_nshared;       //!< number of shared hits 
+
+  NTuple::Array<long> m_nt_Trk_nholesPixels;  //!< number of Pixel holes 
+  NTuple::Array<long> m_nt_Trk_nholesSCT;     //!< number of SCT holes 
+  NTuple::Array<long> m_nt_Trk_nholes;        //!< number of holes 
+
+  NTuple::Array<float> m_nt_Trk_chi2;      //!< number of chi2 
+  NTuple::Array<long> m_nt_Trk_ndof;       //!< number of ndof 
+  NTuple::Array<float> m_nt_Trk_chi2Prob;  //!< number of chi2 probability 
  // ----------------------------------------------------------------------
 
   // ----------------------------------------------------------------------
   // Trk::Track parameters
-  NTuple::Array<float> nt_Trk_d0_Up;      //!< d0 parameter (Up track)
-  NTuple::Array<float> nt_Trk_z0_Up;      //!< z0 parameter (Up track)
-  NTuple::Array<float> nt_Trk_phi0_Up;    //!< phi0 parameter (Up track)
-  NTuple::Array<float> nt_Trk_theta0_Up;  //!< theta0 parameter (Up track)
-  NTuple::Array<float> nt_Trk_qoverp_Up;  //!< q/p parameter (Up track)
-  NTuple::Array<float> nt_Trk_pt_Up;      //!< pt parameter (Up track)
+  NTuple::Array<float> m_nt_Trk_d0_Up;      //!< d0 parameter (Up track)
+  NTuple::Array<float> m_nt_Trk_z0_Up;      //!< z0 parameter (Up track)
+  NTuple::Array<float> m_nt_Trk_phi0_Up;    //!< phi0 parameter (Up track)
+  NTuple::Array<float> m_nt_Trk_theta0_Up;  //!< theta0 parameter (Up track)
+  NTuple::Array<float> m_nt_Trk_qoverp_Up;  //!< q/p parameter (Up track)
+  NTuple::Array<float> m_nt_Trk_pt_Up;      //!< pt parameter (Up track)
   // ----------------------------------------------------------------------
 
   // ----------------------------------------------------------------------
-  NTuple::Array<long> nt_Trk_nHits_Up;      //!< number of hits (Up track)
-  NTuple::Array<long> nt_Trk_nhitspix_Up;   //!< number of Pixel hits (Up track)
-  NTuple::Array<long> nt_Trk_nhitssct_Up;   //!< number of SCT hits (Up track)
-  NTuple::Array<long> nt_Trk_nhitstrt_Up;   //!<  number of TRT hits (Up track)
-
-  NTuple::Array<long> nt_Trk_nsharedPixels_Up; //!< number of Pixel shared hits (Up track)
-  NTuple::Array<long> nt_Trk_nsharedSCT_Up;    //!< number of SCT shared hits (Up track)
-  NTuple::Array<long> nt_Trk_nshared_Up;       //!< number of shared hits (Up track)
-
-  NTuple::Array<long> nt_Trk_nholesPixels_Up;  //!< number of Pixel holes (Up track)
-  NTuple::Array<long> nt_Trk_nholesSCT_Up;     //!< number of SCT holes (Up track)
-  NTuple::Array<long> nt_Trk_nholes_Up;        //!< number of holes (Up track)
-
-  NTuple::Array<float> nt_Trk_chi2_Up;      //!< number of chi2 (Up track) 
-  NTuple::Array<long> nt_Trk_ndof_Up;       //!< number of ndof (Up track) 
-  NTuple::Array<float> nt_Trk_chi2Prob_Up;  //!< number of chi2 probability (Up track) 
+  NTuple::Array<long> m_nt_Trk_nHits_Up;      //!< number of hits (Up track)
+  NTuple::Array<long> m_nt_Trk_nhitspix_Up;   //!< number of Pixel hits (Up track)
+  NTuple::Array<long> m_nt_Trk_nhitssct_Up;   //!< number of SCT hits (Up track)
+  NTuple::Array<long> m_nt_Trk_nhitstrt_Up;   //!<  number of TRT hits (Up track)
+
+  NTuple::Array<long> m_nt_Trk_nsharedPixels_Up; //!< number of Pixel shared hits (Up track)
+  NTuple::Array<long> m_nt_Trk_nsharedSCT_Up;    //!< number of SCT shared hits (Up track)
+  NTuple::Array<long> m_nt_Trk_nshared_Up;       //!< number of shared hits (Up track)
+
+  NTuple::Array<long> m_nt_Trk_nholesPixels_Up;  //!< number of Pixel holes (Up track)
+  NTuple::Array<long> m_nt_Trk_nholesSCT_Up;     //!< number of SCT holes (Up track)
+  NTuple::Array<long> m_nt_Trk_nholes_Up;        //!< number of holes (Up track)
+
+  NTuple::Array<float> m_nt_Trk_chi2_Up;      //!< number of chi2 (Up track) 
+  NTuple::Array<long> m_nt_Trk_ndof_Up;       //!< number of ndof (Up track) 
+  NTuple::Array<float> m_nt_Trk_chi2Prob_Up;  //!< number of chi2 probability (Up track) 
  // ----------------------------------------------------------------------
 
   // ----------------------------------------------------------------------
   // Trk::Track parameters
-  NTuple::Array<float> nt_Trk_d0_Low;      //!< d0 parameter (Low track)
-  NTuple::Array<float> nt_Trk_z0_Low;      //!< z0 parameter (Low track)
-  NTuple::Array<float> nt_Trk_phi0_Low;    //!< phi0 parameter (Low track)
-  NTuple::Array<float> nt_Trk_theta0_Low;  //!< theta0 parameter (Low track)
-  NTuple::Array<float> nt_Trk_qoverp_Low;  //!< q/p parameter (Low track)
-  NTuple::Array<float> nt_Trk_pt_Low;      //!< pt parameter (Low track)
+  NTuple::Array<float> m_nt_Trk_d0_Low;      //!< d0 parameter (Low track)
+  NTuple::Array<float> m_nt_Trk_z0_Low;      //!< z0 parameter (Low track)
+  NTuple::Array<float> m_nt_Trk_phi0_Low;    //!< phi0 parameter (Low track)
+  NTuple::Array<float> m_nt_Trk_theta0_Low;  //!< theta0 parameter (Low track)
+  NTuple::Array<float> m_nt_Trk_qoverp_Low;  //!< q/p parameter (Low track)
+  NTuple::Array<float> m_nt_Trk_pt_Low;      //!< pt parameter (Low track)
   // ----------------------------------------------------------------------
 
   // ----------------------------------------------------------------------
-  NTuple::Array<long> nt_Trk_nHits_Low;      //!< number of hits (Low track)
-  NTuple::Array<long> nt_Trk_nhitspix_Low;   //!< number of Pixel hits (Low track)
-  NTuple::Array<long> nt_Trk_nhitssct_Low;   //!< number of SCT hits (Low track)
-  NTuple::Array<long> nt_Trk_nhitstrt_Low;   //!<  number of TRT hits (Low track)
-
-  NTuple::Array<long> nt_Trk_nsharedPixels_Low; //!< number of Pixel shared hits (Low track)
-  NTuple::Array<long> nt_Trk_nsharedSCT_Low;    //!< number of SCT shared hits (Low track)
-  NTuple::Array<long> nt_Trk_nshared_Low;       //!< number of shared hits (Low track)
-
-  NTuple::Array<long> nt_Trk_nholesPixels_Low;  //!< number of Pixel holes (Low track)
-  NTuple::Array<long> nt_Trk_nholesSCT_Low;     //!< number of SCT holes (Low track)
-  NTuple::Array<long> nt_Trk_nholes_Low;        //!< number of holes (Low track)
+  NTuple::Array<long> m_nt_Trk_nHits_Low;      //!< number of hits (Low track)
+  NTuple::Array<long> m_nt_Trk_nhitspix_Low;   //!< number of Pixel hits (Low track)
+  NTuple::Array<long> m_nt_Trk_nhitssct_Low;   //!< number of SCT hits (Low track)
+  NTuple::Array<long> m_nt_Trk_nhitstrt_Low;   //!<  number of TRT hits (Low track)
+
+  NTuple::Array<long> m_nt_Trk_nsharedPixels_Low; //!< number of Pixel shared hits (Low track)
+  NTuple::Array<long> m_nt_Trk_nsharedSCT_Low;    //!< number of SCT shared hits (Low track)
+  NTuple::Array<long> m_nt_Trk_nshared_Low;       //!< number of shared hits (Low track)
+
+  NTuple::Array<long> m_nt_Trk_nholesPixels_Low;  //!< number of Pixel holes (Low track)
+  NTuple::Array<long> m_nt_Trk_nholesSCT_Low;     //!< number of SCT holes (Low track)
+  NTuple::Array<long> m_nt_Trk_nholes_Low;        //!< number of holes (Low track)
   
-  NTuple::Array<float> nt_Trk_chi2_Low;      //!< number of chi2 (Low track) 
-  NTuple::Array<long> nt_Trk_ndof_Low;       //!< number of ndof (Low track) 
-  NTuple::Array<float> nt_Trk_chi2Prob_Low;  //!< number of chi2 probability (Low track) 
+  NTuple::Array<float> m_nt_Trk_chi2_Low;      //!< number of chi2 (Low track) 
+  NTuple::Array<long> m_nt_Trk_ndof_Low;       //!< number of ndof (Low track) 
+  NTuple::Array<float> m_nt_Trk_chi2Prob_Low;  //!< number of chi2 probability (Low track) 
   // ----------------------------------------------------------------------
   
   // ----------------------------------------------------------------------
-  NTuple::Array<float> nt_mc_trkistruth;    //!< Has the Track an associated truth track?
+  NTuple::Array<float> m_nt_mc_trkistruth;    //!< Has the Track an associated truth track?
   
   // generated particle parameters
-  NTuple::Array<float> nt_mc_Trk_genParticlePt;  //!< generated pt
-  NTuple::Array<float> nt_mc_Trk_genParticleEta; //!< generated eta 
-  NTuple::Array<float> nt_mc_Trk_genParticlePhi; //!< generated phi
+  NTuple::Array<float> m_nt_mc_Trk_genParticlePt;  //!< generated pt
+  NTuple::Array<float> m_nt_mc_Trk_genParticleEta; //!< generated eta 
+  NTuple::Array<float> m_nt_mc_Trk_genParticlePhi; //!< generated phi
   
   // MonteCarlo Track parameters
-  NTuple::Array<float> nt_mc_Trk_d0;        //!< MonteCarlo d0 parameter
-  NTuple::Array<float> nt_mc_Trk_z0;        //!< MonteCarlo z0 parameter
-  NTuple::Array<float> nt_mc_Trk_phi0;      //!< MonteCarlo phi0 parameter
-  NTuple::Array<float> nt_mc_Trk_theta0;    //!< MonteCarlo theta0 parameter
-  NTuple::Array<float> nt_mc_Trk_eta;       //!< MonteCarlo eta parameter
-  NTuple::Array<float> nt_mc_Trk_qoverp;    //!< MonteCarlo q/p parameter
-  NTuple::Array<float> nt_mc_Trk_qoverpt;   //!< MonteCarlo q/pt parameter
+  NTuple::Array<float> m_nt_mc_Trk_d0;        //!< MonteCarlo d0 parameter
+  NTuple::Array<float> m_nt_mc_Trk_z0;        //!< MonteCarlo z0 parameter
+  NTuple::Array<float> m_nt_mc_Trk_phi0;      //!< MonteCarlo phi0 parameter
+  NTuple::Array<float> m_nt_mc_Trk_theta0;    //!< MonteCarlo theta0 parameter
+  NTuple::Array<float> m_nt_mc_Trk_eta;       //!< MonteCarlo eta parameter
+  NTuple::Array<float> m_nt_mc_Trk_qoverp;    //!< MonteCarlo q/p parameter
+  NTuple::Array<float> m_nt_mc_Trk_qoverpt;   //!< MonteCarlo q/pt parameter
     
-  NTuple::Array<float> nt_mc_Trk_pt;        //!< MonteCarlo pt parameter
-  NTuple::Array<float> nt_mc_Trk_charge;    //!< MonteCarlo charge parameter
-  NTuple::Array<float> nt_mc_Trk_prob;      //!< MonteCarlo prob parameter
-  NTuple::Array<float> nt_mc_Trk_pdg;       //!< MonteCarlo pdg parameter
+  NTuple::Array<float> m_nt_mc_Trk_pt;        //!< MonteCarlo pt parameter
+  NTuple::Array<float> m_nt_mc_Trk_charge;    //!< MonteCarlo charge parameter
+  NTuple::Array<float> m_nt_mc_Trk_prob;      //!< MonteCarlo prob parameter
+  NTuple::Array<float> m_nt_mc_Trk_pdg;       //!< MonteCarlo pdg parameter
   
-  NTuple::Array<float> nt_mc_Trk_vtxX;      //!< MonteCarlo Vertex.X parameter
-  NTuple::Array<float> nt_mc_Trk_vtxY;      //!< MonteCarlo Vertex.Y parameter
-  NTuple::Array<float> nt_mc_Trk_vtxZ;      //!< MonteCarlo Vertex.Z parameter
+  NTuple::Array<float> m_nt_mc_Trk_vtxX;      //!< MonteCarlo Vertex.X parameter
+  NTuple::Array<float> m_nt_mc_Trk_vtxY;      //!< MonteCarlo Vertex.Y parameter
+  NTuple::Array<float> m_nt_mc_Trk_vtxZ;      //!< MonteCarlo Vertex.Z parameter
   // ----------------------------------------------------------------------
 
 
   // ----------------------------------------------------------------------
   // Matching Trk::Track_Up and Trk::Track_Low
-  NTuple::Array<float> nt_Trk_delta_d0;      //!< d0 parameter
-  NTuple::Array<float> nt_Trk_delta_z0;      //!< z0 parameter
-  NTuple::Array<float> nt_Trk_delta_phi0;    //!< phi0 parameter
+  NTuple::Array<float> m_nt_Trk_delta_d0;      //!< d0 parameter
+  NTuple::Array<float> m_nt_Trk_delta_z0;      //!< z0 parameter
+  NTuple::Array<float> m_nt_Trk_delta_phi0;    //!< phi0 parameter
   //**
-  NTuple::Array<float> nt_Trk_delta_theta0;  //!< theta parameter
-  NTuple::Array<float> nt_Trk_delta_eta;     //!< eta parameter
-  NTuple::Array<float> nt_Trk_delta_qoverpt; //!< q/pt parameter
-  NTuple::Array<float> nt_Trk_delta_pt;      //!< pt parameter
-  NTuple::Array<float> nt_Trk_delta_charge;  //!< charge parameter
+  NTuple::Array<float> m_nt_Trk_delta_theta0;  //!< theta parameter
+  NTuple::Array<float> m_nt_Trk_delta_eta;     //!< eta parameter
+  NTuple::Array<float> m_nt_Trk_delta_qoverpt; //!< q/pt parameter
+  NTuple::Array<float> m_nt_Trk_delta_pt;      //!< pt parameter
+  NTuple::Array<float> m_nt_Trk_delta_charge;  //!< charge parameter
   // ----------------------------------------------------------------------
 
 };
diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx
index 0b393a9d40e..82952c054e5 100755
--- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx
+++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx
@@ -71,25 +71,25 @@ InDetAlignDBTool::InDetAlignDBTool(const std::string& type,
     m_pixman(nullptr),
     m_sctman(nullptr),
     m_attrListCollection(nullptr),
-    par_newdb(true),
-    par_scttwoside(false),
-    par_fake(0),
-    par_condstream("CondStream1"),
-    par_dbroot( IND_ALIGN ),
-    par_dbkey( IND_ALIGN ),
-    par_oldTextFile(false),
+    m_par_newdb(true),
+    m_par_scttwoside(false),
+    m_par_fake(0),
+    m_par_condstream("CondStream1"),
+    m_par_dbroot( IND_ALIGN ),
+    m_par_dbkey( IND_ALIGN ),
+    m_par_oldTextFile(false),
     m_dynamicDB(false),
     m_forceUserDBConfig(false)
 {
   declareInterface<IInDetAlignDBTool>(this);
   declareProperty("IToolSvc",    p_toolsvc);
-  declareProperty("NewDB",       par_newdb);     //Take out at some point; New is misleading!! Very old developments!
-  declareProperty("SCTTwoSide",  par_scttwoside);
-  declareProperty("FakeDB",      par_fake);
-  declareProperty("CondStream",  par_condstream);
-  declareProperty("DBRoot",      par_dbroot,"name of the root folder for constants");
-  declareProperty("DBKey",       par_dbkey,"base part of the key for loading AlignableTransforms");
-  declareProperty("OldTextFile", par_oldTextFile);
+  declareProperty("NewDB",       m_par_newdb);     //Take out at some point; New is misleading!! Very old developments!
+  declareProperty("SCTTwoSide",  m_par_scttwoside);
+  declareProperty("FakeDB",      m_par_fake);
+  declareProperty("CondStream",  m_par_condstream);
+  declareProperty("DBRoot",      m_par_dbroot,"name of the root folder for constants");
+  declareProperty("DBKey",       m_par_dbkey,"base part of the key for loading AlignableTransforms");
+  declareProperty("OldTextFile", m_par_oldTextFile);
   declareProperty("forceUserDBConfig",m_forceUserDBConfig, "Set to true to override any DB auto-configuration");
 }
 
@@ -136,22 +136,22 @@ StatusCode InDetAlignDBTool::initialize()
     ATH_MSG_FATAL("Pixel and SCT Managers have different alignfolder type registered --> Check ");
   
   if (m_pixman->m_alignfoldertype == InDetDD::static_run1 && !m_forceUserDBConfig){
-    par_dbroot = "/Indet/Align";
+    m_par_dbroot = "/Indet/Align";
     m_dynamicDB = false;
   }
   if (m_pixman->m_alignfoldertype == InDetDD::timedependent_run2 && !m_forceUserDBConfig){
-    par_dbroot = "/Indet/AlignL3";
+    m_par_dbroot = "/Indet/AlignL3";
     m_dynamicDB = true;
   }  
-  par_dbkey = par_dbroot;
+  m_par_dbkey = m_par_dbroot;
 
   if ((StatusCode::SUCCESS!=detStore()->retrieve(m_pixid)) ||
       (StatusCode::SUCCESS!=detStore()->retrieve(m_sctid))) {
     // attempt failed - optionally fake up the geometry
-    if (par_fake==1) {
+    if (m_par_fake==1) {
       ATH_MSG_DEBUG("Initialising fake full ATLAS geometry");
       fakeGeom(3,3,4,9);
-    } else if (par_fake==2) {
+    } else if (m_par_fake==2) {
       ATH_MSG_DEBUG("Initialising fake CTB geometry");
       fakeGeom(3,0,4,0);
     } else {
@@ -207,7 +207,7 @@ StatusCode InDetAlignDBTool::initialize()
 
 
   if (msgLvl(MSG::DEBUG)) {
-    ATH_MSG_DEBUG( "Database root folder " << par_dbroot );
+    ATH_MSG_DEBUG( "Database root folder " << m_par_dbroot );
     ATH_MSG_DEBUG( "Geometry initialisation sees " << ndet[0] << 
       " pixel and " <<  ndet[1] << " SCT modules giving " << m_alignobjs.size() 
     << " alignment keys" );
@@ -216,7 +216,7 @@ StatusCode InDetAlignDBTool::initialize()
     for (unsigned int i=0;i<m_alignobjs.size();++i)
       ATH_MSG_DEBUG( " " << m_alignobjs[i] << " [" << m_alignchans[i] << "]" );
     
-    if (par_newdb)
+    if (m_par_newdb)
       ATH_MSG_DEBUG("Assuming new COOL alignment DB model based on AlignableTransformContainer");
     else
       ATH_MSG_DEBUG("Assuming old (Lisbon) alignment DB model based on separate AlignableTransforms");
@@ -261,7 +261,7 @@ void InDetAlignDBTool::createDB() const
   
   ATH_MSG_DEBUG("createDB method called");
   // check not running in fake mode (need real geometry here)
-  if (par_fake) {
+  if (m_par_fake) {
     ATH_MSG_FATAL("Cannot create new database when geometry is faked");
   }
   AlignableTransform* pat;
@@ -270,9 +270,9 @@ void InDetAlignDBTool::createDB() const
   // AlignableTransform objects with default values
 
   // first create the empty AlignableTransform objects in TDS
-  if (par_newdb) {
+  if (m_par_newdb) {
     // check object does not already exist
-    if (detStore()->contains<AlignableTransformContainer>(par_dbroot)) {
+    if (detStore()->contains<AlignableTransformContainer>(m_par_dbroot)) {
       ATH_MSG_WARNING("createDB: AlignableTransformContainer already exists");
       return;
     }
@@ -285,13 +285,13 @@ void InDetAlignDBTool::createDB() const
   }
 
   if (msgLvl(MSG::DEBUG)) {
-    if (par_scttwoside) ATH_MSG_DEBUG( "Produce separate transforms for each side of SCT modules" );
+    if (m_par_scttwoside) ATH_MSG_DEBUG( "Produce separate transforms for each side of SCT modules" );
     else ATH_MSG_DEBUG( "Treat both sides of SCT module as single entity" );
   }
 
   for (unsigned int i=0;i<m_alignobjs.size();++i) {
     pat=new AlignableTransform(m_alignobjs[i]);
-    if (par_newdb) {
+    if (m_par_newdb) {
       // add to collection and set corresponding channel number
       patc->push_back(pat);
       patc->add(m_alignchans[i]);
@@ -306,9 +306,9 @@ void InDetAlignDBTool::createDB() const
         ATH_MSG_ERROR( "Could not record AlignableTransform "<< m_alignobjs[i] );
     }
   }
-  if (par_newdb) {
+  if (m_par_newdb) {
     // record collection in SG
-    if (StatusCode::SUCCESS!=detStore()->record(patc,par_dbroot))
+    if (StatusCode::SUCCESS!=detStore()->record(patc,m_par_dbroot))
         ATH_MSG_ERROR("Could not record AlignableTransformContainer");
     ATH_MSG_DEBUG( "Collection has size " <<  patc->size() );
   }
@@ -331,7 +331,7 @@ void InDetAlignDBTool::createDB() const
         std::string key=dirkey(ident,3);
         // do not produce AlignableTrasnforms for SCT side 1 if option set
         if (!(m_sctid->is_sct(ident) && m_sctid->side(ident)==1) || 
-            par_scttwoside) {
+            m_par_scttwoside) {
             if ((pat=getTransPtr(key))) {
             pat->add(ident,Amg::EigenTransformToCLHEP( Amg::Transform3D::Identity() ) );
             } else {
@@ -402,7 +402,7 @@ void InDetAlignDBTool::createDB() const
       //return; 
     }
     
-    if (par_newdb) {
+    if (m_par_newdb) {
       atrlistcol = m_attrListCollection;
       if (StatusCode::SUCCESS!=detStore()->record(atrlistcol,ibl_folderName))
 	ATH_MSG_ERROR( "Could not record IBLDist "<< ibl_folderName );
@@ -455,7 +455,7 @@ std::string InDetAlignDBTool::dirkey(const int det,const int bec,const
   // given SCT/pixel det/bec/layer, and level (1,2 or 3) return
   // directory key name for associated alignment data
   std::ostringstream result;
-  result << par_dbkey << "/" ;
+  result << m_par_dbkey << "/" ;
   if (level==1) {
     result << "ID";
   } else {
@@ -482,7 +482,7 @@ std::string InDetAlignDBTool::dirkey(const int det,const int bec,const
     result << "/" ;          // new folders have L1, L2, L3 structure
   }
   else{
-    result << par_dbkey << "/" ;
+    result << m_par_dbkey << "/" ;
   }
   if (level==1) {
     result << "ID";
@@ -559,7 +559,7 @@ void InDetAlignDBTool::dispGroup(const int dettype, const int bec,
         int mdet,mbec,mlayer,mring,msector,mside;
         idToDetSet(ident,mdet,mbec,mlayer,mring,msector,mside);
         // find matching modules - note side=1 modules never touched
-        if ((dettype==-1 || mdet==dettype) && (bec==-1 || fabs(2*mbec)==bec) &&
+        if ((dettype==-1 || mdet==dettype) && (bec==-1 || std::abs(2*mbec)==bec) &&
             (layer==-1 || mlayer==layer) && (ring==-1 || mring==ring) && 
             (sector== -1 || msector==sector) && mside==0) {
           // displace this module - first choose displacement type
@@ -867,7 +867,7 @@ void InDetAlignDBTool::writeGlobalFolderFile( const std::string file)
 
 
 void InDetAlignDBTool::readTextFile(const std::string file) const {
-  //  if (par_oldTextFile) return readOldTextFile(file);
+  //  if (m_par_oldTextFile) return readOldTextFile(file);
 
   ATH_MSG_DEBUG("readTextFile - set alignment constants from text file: " << file );
   std::ifstream infile;
@@ -1255,8 +1255,9 @@ Amg::Transform3D InDetAlignDBTool::getTransL123( const Identifier& ident ) const
   Amg::Transform3D trfL2 = getTrans( ident, 2 ) ;
   Amg::Transform3D trfL3 = getTrans( ident, 3 ) ;
   ATH_MSG_FATAL("Code needs to corrected otherwise you will get nonsensical results-- IndetAlignDBTool:2060");
-  const Amg::Transform3D trfNominal   ; //= element->defModuleTransform() ;
-  result = trfNominal.inverse() * trfL1 * trfL2 * trfNominal * trfL3 ;
+  //const Amg::Transform3D trfNominal   ; //= element->defModuleTransform() ;
+  //result = trfNominal.inverse() * trfL1 * trfL2 * trfNominal * trfL3 ;
+  result = trfL1 * trfL2 * trfL3 ;
   return result ;
 }
 
@@ -1278,11 +1279,11 @@ Amg::Transform3D InDetAlignDBTool::getTrans(const Identifier& ident,
 
 StatusCode InDetAlignDBTool::outputObjs() const {
   
-  ATH_MSG_DEBUG( "Output AlignableTranform objects to stream" << par_condstream );
+  ATH_MSG_DEBUG( "Output AlignableTranform objects to stream" << m_par_condstream );
   // get the AthenaOutputStream tool
   IAthenaOutputStreamTool* optool;
 
-  if (StatusCode::SUCCESS!=p_toolsvc->retrieveTool("AthenaPoolOutputStreamTool",par_condstream,optool)) {
+  if (StatusCode::SUCCESS!=p_toolsvc->retrieveTool("AthenaPoolOutputStreamTool",m_par_condstream,optool)) {
     ATH_MSG_ERROR("Cannot get AthenaPoolOutputStream tool" );
     return StatusCode::FAILURE;
   }
@@ -1294,15 +1295,15 @@ StatusCode InDetAlignDBTool::outputObjs() const {
   // construct list of objects to be written out, either 
   // AlignableTransformContainer or several of AlignableTransforms
   int npairs=m_alignobjs.size();
-  if (par_newdb) npairs=1;
+  if (m_par_newdb) npairs=1;
   IAthenaOutputStreamTool::TypeKeyPairs typekeys(npairs);
-  if (par_newdb) {
+  if (m_par_newdb) {
     typekeys[0]=
       IAthenaOutputStreamTool::TypeKeyPair("AlignableTransformContainer",
-             par_dbroot);
-    if (!(detStore()->contains<AlignableTransformContainer>(par_dbroot)))
+             m_par_dbroot);
+    if (!(detStore()->contains<AlignableTransformContainer>(m_par_dbroot)))
       ATH_MSG_ERROR(
-        "Expected " << par_dbroot << " object not found" );
+        "Expected " << m_par_dbroot << " object not found" );
   } else {
     for (unsigned int i=0;i<m_alignobjs.size();++i) {
       typekeys[i]=IAthenaOutputStreamTool::TypeKeyPair("AlignableTransform",
@@ -1336,7 +1337,7 @@ StatusCode InDetAlignDBTool::outputObjs() const {
   if (StatusCode::SUCCESS!=optool->commitOutput()) {
     ATH_MSG_ERROR("Could not commit output" );
   }
-  ATH_MSG_DEBUG( "Written " << typekeys.size() << " objects to stream " << par_condstream);
+  ATH_MSG_DEBUG( "Written " << typekeys.size() << " objects to stream " << m_par_condstream);
   return StatusCode::SUCCESS;
 }
 
@@ -1357,13 +1358,13 @@ void InDetAlignDBTool::fillDB(const std::string tag,
   }
   // loop over all AlignableTransform objects created earlier and save them
   int nobj=0; 
-  if (par_newdb) {
+  if (m_par_newdb) {
     if (StatusCode::SUCCESS==regsvc->registerIOV(
-             "AlignableTransformContainer",par_dbroot,tag,run1,run2,event1,event2)) {
-      ATH_MSG_DEBUG( "Stored AlignableTransform object " << par_dbroot );
+             "AlignableTransformContainer",m_par_dbroot,tag,run1,run2,event1,event2)) {
+      ATH_MSG_DEBUG( "Stored AlignableTransform object " << m_par_dbroot );
       ++nobj;
     } else {
-      ATH_MSG_ERROR("Failed (registerIOV) to store object " << par_dbroot );
+      ATH_MSG_ERROR("Failed (registerIOV) to store object " << m_par_dbroot );
     }
   } else {
     // old way - register all objects separately
@@ -1427,8 +1428,8 @@ AlignableTransform* InDetAlignDBTool::getTransPtr(const std::string key)
   // given key and return it, return 0 if not collection or key value not found
   AlignableTransformContainer* patc;
   AlignableTransform* pat=0;
-  if (par_newdb) {
-    if (StatusCode::SUCCESS==detStore()->retrieve(patc,par_dbroot )) {
+  if (m_par_newdb) {
+    if (StatusCode::SUCCESS==detStore()->retrieve(patc,m_par_dbroot )) {
       for (DataVector<AlignableTransform>::iterator dva=patc->begin();
      dva!=patc->end();++dva) {
         if ((*dva)->tag()==key) {
@@ -1450,8 +1451,8 @@ const AlignableTransform* InDetAlignDBTool::cgetTransPtr(const std::string key)
   // const version
   const AlignableTransformContainer* patc;
   const AlignableTransform* pat=0;
-  if (par_newdb) {
-    if (StatusCode::SUCCESS==detStore()->retrieve(patc,par_dbroot )) {
+  if (m_par_newdb) {
+    if (StatusCode::SUCCESS==detStore()->retrieve(patc,m_par_dbroot )) {
       for (DataVector<AlignableTransform>::const_iterator dva=patc->begin();
      dva!=patc->end();++dva) {
         if ((*dva)->tag()==key) {
diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
index b5448250343..d022e3c9a32 100755
--- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
+++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
@@ -261,16 +261,16 @@ StatusCode InDetAlignFillTrack::FillTrack() {
     else ATH_MSG_DEBUG( "Collection with name "<< m_inputLowCol <<" found in StoreGate" );
   }
 
-  nt_ntracks = tracks->size();
+  m_nt_ntracks = tracks->size();
   if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved Track Collection size: " << tracks->size() << endmsg;
 
   if (m_inputUpCol!="") {
-    nt_nUptracks = Uptracks->size();
+    m_nt_nUptracks = Uptracks->size();
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved Up Track Collection size: " << Uptracks->size() << endmsg;
   }
 
   if (m_inputLowCol!="") {
-    nt_nLowtracks = Lowtracks->size();
+    m_nt_nLowtracks = Lowtracks->size();
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved Low Track Collection size: " << Lowtracks->size() << endmsg;
   }
 
@@ -311,7 +311,7 @@ StatusCode InDetAlignFillTrack::FillTrack() {
 	msg(MSG::DEBUG) << "Retrieved "<< truthCol->size() <<" truth tracks from StoreGate" << endmsg;
       }
       
-      nt_nmctracks = truthCol->size();
+      m_nt_nmctracks = truthCol->size();
       
       TrackCollection::const_iterator trackItr  = tracks->begin();
       TrackCollection::const_iterator trackItrE = tracks->end();
@@ -376,14 +376,14 @@ StatusCode InDetAlignFillTrack::FillTrack() {
 						    << ", phi "<< genParticle->momentum().phi() << " CLHEP::rad"
 						    << endmsg;
 	    
-	    nt_mc_trkistruth[nTracks] = 1;
-	    nt_mc_Trk_pdg[nTracks] = genParticle->pdg_id();
-	    nt_mc_Trk_prob[nTracks] = trkTruthProb;
+	    m_nt_mc_trkistruth[nTracks] = 1;
+	    m_nt_mc_Trk_pdg[nTracks] = genParticle->pdg_id();
+	    m_nt_mc_Trk_prob[nTracks] = trkTruthProb;
 	    float pX = genParticle->momentum().px();  float pY = genParticle->momentum().py();
 	    float genParticlePt = sqrt((pX*pX)+(pY*pY));
-	    nt_mc_Trk_genParticlePt[nTracks] = genParticlePt;
-	    nt_mc_Trk_genParticleEta[nTracks] = genParticle->momentum().eta();
-	    nt_mc_Trk_genParticlePhi[nTracks] = genParticle->momentum().phi();
+	    m_nt_mc_Trk_genParticlePt[nTracks] = genParticlePt;
+	    m_nt_mc_Trk_genParticleEta[nTracks] = genParticle->momentum().eta();
+	    m_nt_mc_Trk_genParticlePhi[nTracks] = genParticle->momentum().phi();
 	    
 	    if(genParticle->pdg_id()==0) 
 	      ATH_MSG_WARNING("Particle with PDG 0!");
@@ -413,7 +413,7 @@ StatusCode InDetAlignFillTrack::FillTrack() {
 		if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "reading from track record, size = " 
 							<< recordCollection->size() << endmsg;
 		
-		int m_nmctracks = 0;
+		int nmctracks = 0;
 		
 		for (TrackRecordCollection::const_iterator record = recordCollection->begin();  
 		     record != recordCollection->end();++record) {
@@ -517,23 +517,23 @@ StatusCode InDetAlignFillTrack::FillTrack() {
 		    
 		  }
 		  
-		  dumpPerigee(generatedTrackPerigee, m_nmctracks); 
-		  nt_mc_Trk_vtxX[m_nmctracks] = productionVertex.x();
-		  nt_mc_Trk_vtxY[m_nmctracks] = productionVertex.y();
-		  nt_mc_Trk_vtxZ[m_nmctracks] = productionVertex.z();
+		  dumpPerigee(generatedTrackPerigee, nmctracks); 
+		  m_nt_mc_Trk_vtxX[nmctracks] = productionVertex.x();
+		  m_nt_mc_Trk_vtxY[nmctracks] = productionVertex.y();
+		  m_nt_mc_Trk_vtxZ[nmctracks] = productionVertex.z();
 		  
 		  delete productionVertexTrackParams;
 		  delete generatedTrackPerigee;
 		  
-		  m_nmctracks++;
+		  nmctracks++;
 		}
 	      }
 	      
 	      if (generatedTrackPerigee) {
 		dumpPerigee(generatedTrackPerigee, nTracks);     
-		nt_mc_Trk_vtxX[nTracks] = genParticle->production_vertex()->position().x();
-		nt_mc_Trk_vtxY[nTracks] = genParticle->production_vertex()->position().y();
-		nt_mc_Trk_vtxZ[nTracks] = genParticle->production_vertex()->position().z();
+		m_nt_mc_Trk_vtxX[nTracks] = genParticle->production_vertex()->position().x();
+		m_nt_mc_Trk_vtxY[nTracks] = genParticle->production_vertex()->position().y();
+		m_nt_mc_Trk_vtxZ[nTracks] = genParticle->production_vertex()->position().z();
 		
 		delete generatedTrackPerigee;
 		
@@ -541,7 +541,7 @@ StatusCode InDetAlignFillTrack::FillTrack() {
 	      
 	    }
 	  }
-	  nt_mc_trkistruth[nTracks] = 0;
+	  m_nt_mc_trkistruth[nTracks] = 0;
 	}
 	//} // if (truthCol)  commented out for coverity 14309
   
@@ -628,65 +628,65 @@ void InDetAlignFillTrack::bookNtuple() {
     
     if (nt0) {
       StatusCode sc;
-      // nt0->addItem("event", nt_event); // event number
-      sc =  nt0->addItem("nTracks", nt_ntracks, 0, maxTracks); // number of tracks
-      if (m_doTruth) sc =nt0->addItem("mc_nTracks", nt_nmctracks, 0, maxTracks); // number of mc tracks
+      // nt0->addItem("event", m_nt_event); // event number
+      sc =  nt0->addItem("nTracks", m_nt_ntracks, 0, maxTracks); // number of tracks
+      if (m_doTruth) sc =nt0->addItem("mc_nTracks", m_nt_nmctracks, 0, maxTracks); // number of mc tracks
       
       // ----------------------------------------------------------------------
       // Trk::Track parameters
-      sc = nt0->addItem("Trk_d0",     nt_ntracks, nt_Trk_d0);
-      sc = nt0->addItem("Trk_z0",     nt_ntracks, nt_Trk_z0);
-      sc = nt0->addItem("Trk_phi0",   nt_ntracks, nt_Trk_phi0);
-      sc = nt0->addItem("Trk_theta0", nt_ntracks, nt_Trk_theta0);
-      sc = nt0->addItem("Trk_qoverp", nt_ntracks, nt_Trk_qoverp);
-      sc = nt0->addItem("Trk_pt",     nt_ntracks, nt_Trk_pt);
+      sc = nt0->addItem("Trk_d0",     m_nt_ntracks, m_nt_Trk_d0);
+      sc = nt0->addItem("Trk_z0",     m_nt_ntracks, m_nt_Trk_z0);
+      sc = nt0->addItem("Trk_phi0",   m_nt_ntracks, m_nt_Trk_phi0);
+      sc = nt0->addItem("Trk_theta0", m_nt_ntracks, m_nt_Trk_theta0);
+      sc = nt0->addItem("Trk_qoverp", m_nt_ntracks, m_nt_Trk_qoverp);
+      sc = nt0->addItem("Trk_pt",     m_nt_ntracks, m_nt_Trk_pt);
       // ----------------------------------------------------------------------
 
       // ----------------------------------------------------------------------
       // Trk::Track hits...
-      sc = nt0->addItem("Trk_nHits",       nt_ntracks, nt_Trk_nHits);
-      sc = nt0->addItem("Trk_nhitsPixels", nt_ntracks, nt_Trk_nhitspix);
-      sc = nt0->addItem("Trk_nhitsSCT",    nt_ntracks, nt_Trk_nhitssct);
-      sc = nt0->addItem("Trk_nhitsTRT",    nt_ntracks, nt_Trk_nhitstrt);
-
-      sc = nt0->addItem("Trk_nsharedPixels", nt_ntracks, nt_Trk_nsharedPixels);
-      sc = nt0->addItem("Trk_nsharedSCT",    nt_ntracks, nt_Trk_nsharedSCT);
-      sc = nt0->addItem("Trk_nshared",       nt_ntracks, nt_Trk_nshared);
-
-      sc = nt0->addItem("Trk_nholesPixels", nt_ntracks, nt_Trk_nholesPixels);
-      sc = nt0->addItem("Trk_nholesSCT",    nt_ntracks, nt_Trk_nholesSCT);
-      sc = nt0->addItem("Trk_nholes",       nt_ntracks, nt_Trk_nholes);
-
-      sc = nt0->addItem("Trk_chi2",     nt_ntracks, nt_Trk_chi2);
-      sc = nt0->addItem("Trk_ndof",     nt_ntracks, nt_Trk_ndof);
-      sc = nt0->addItem("Trk_chi2Prob", nt_ntracks, nt_Trk_chi2Prob);
+      sc = nt0->addItem("Trk_nHits",       m_nt_ntracks, m_nt_Trk_nHits);
+      sc = nt0->addItem("Trk_nhitsPixels", m_nt_ntracks, m_nt_Trk_nhitspix);
+      sc = nt0->addItem("Trk_nhitsSCT",    m_nt_ntracks, m_nt_Trk_nhitssct);
+      sc = nt0->addItem("Trk_nhitsTRT",    m_nt_ntracks, m_nt_Trk_nhitstrt);
+
+      sc = nt0->addItem("Trk_nsharedPixels", m_nt_ntracks, m_nt_Trk_nsharedPixels);
+      sc = nt0->addItem("Trk_nsharedSCT",    m_nt_ntracks, m_nt_Trk_nsharedSCT);
+      sc = nt0->addItem("Trk_nshared",       m_nt_ntracks, m_nt_Trk_nshared);
+
+      sc = nt0->addItem("Trk_nholesPixels", m_nt_ntracks, m_nt_Trk_nholesPixels);
+      sc = nt0->addItem("Trk_nholesSCT",    m_nt_ntracks, m_nt_Trk_nholesSCT);
+      sc = nt0->addItem("Trk_nholes",       m_nt_ntracks, m_nt_Trk_nholes);
+
+      sc = nt0->addItem("Trk_chi2",     m_nt_ntracks, m_nt_Trk_chi2);
+      sc = nt0->addItem("Trk_ndof",     m_nt_ntracks, m_nt_Trk_ndof);
+      sc = nt0->addItem("Trk_chi2Prob", m_nt_ntracks, m_nt_Trk_chi2Prob);
       // ----------------------------------------------------------------------
 
       if (m_doTruth) {
 	// ----------------------------------------------------------------------
-	sc = nt0->addItem("mc_TrkIsTruth",  nt_ntracks, nt_mc_trkistruth);
+	sc = nt0->addItem("mc_TrkIsTruth",  m_nt_ntracks, m_nt_mc_trkistruth);
 	
 	// generated particle parameters
-	sc = nt0->addItem("mc_Trk_genParticlePt",  nt_ntracks, nt_mc_Trk_genParticlePt);
-	sc = nt0->addItem("mc_Trk_genParticleEta", nt_ntracks, nt_mc_Trk_genParticleEta);
-	sc = nt0->addItem("mc_Trk_genParticlePhi", nt_ntracks, nt_mc_Trk_genParticlePhi);
+	sc = nt0->addItem("mc_Trk_genParticlePt",  m_nt_ntracks, m_nt_mc_Trk_genParticlePt);
+	sc = nt0->addItem("mc_Trk_genParticleEta", m_nt_ntracks, m_nt_mc_Trk_genParticleEta);
+	sc = nt0->addItem("mc_Trk_genParticlePhi", m_nt_ntracks, m_nt_mc_Trk_genParticlePhi);
 	
 	// MonteCarlo Track parameters
-	sc = nt0->addItem("mc_Trk_d0",      nt_ntracks, nt_mc_Trk_d0);
-	sc = nt0->addItem("mc_Trk_z0",      nt_ntracks, nt_mc_Trk_z0);
-	sc = nt0->addItem("mc_Trk_phi0",    nt_ntracks, nt_mc_Trk_phi0);
-	sc = nt0->addItem("mc_Trk_theta",   nt_ntracks, nt_mc_Trk_theta0);
-	sc = nt0->addItem("mc_Trk_eta",     nt_ntracks, nt_mc_Trk_eta);
-	sc = nt0->addItem("mc_Trk_qoverp",  nt_ntracks, nt_mc_Trk_qoverp);
-	sc = nt0->addItem("mc_Trk_qoverpt", nt_ntracks, nt_mc_Trk_qoverpt);
-	sc = nt0->addItem("mc_Trk_pt",      nt_ntracks, nt_mc_Trk_pt);
-	sc = nt0->addItem("mc_Trk_charge",  nt_ntracks, nt_mc_Trk_charge);
-	sc = nt0->addItem("mc_Trk_prob",    nt_ntracks, nt_mc_Trk_prob);
-	sc = nt0->addItem("mc_Trk_pdg",     nt_ntracks, nt_mc_Trk_pdg);
-
-	sc = nt0->addItem("mc_Trk_vtxX",    nt_ntracks, nt_mc_Trk_vtxX);
-	sc = nt0->addItem("mc_Trk_vtxY",    nt_ntracks, nt_mc_Trk_vtxY);
-	sc = nt0->addItem("mc_Trk_vtxZ",    nt_ntracks, nt_mc_Trk_vtxZ);
+	sc = nt0->addItem("mc_Trk_d0",      m_nt_ntracks, m_nt_mc_Trk_d0);
+	sc = nt0->addItem("mc_Trk_z0",      m_nt_ntracks, m_nt_mc_Trk_z0);
+	sc = nt0->addItem("mc_Trk_phi0",    m_nt_ntracks, m_nt_mc_Trk_phi0);
+	sc = nt0->addItem("mc_Trk_theta",   m_nt_ntracks, m_nt_mc_Trk_theta0);
+	sc = nt0->addItem("mc_Trk_eta",     m_nt_ntracks, m_nt_mc_Trk_eta);
+	sc = nt0->addItem("mc_Trk_qoverp",  m_nt_ntracks, m_nt_mc_Trk_qoverp);
+	sc = nt0->addItem("mc_Trk_qoverpt", m_nt_ntracks, m_nt_mc_Trk_qoverpt);
+	sc = nt0->addItem("mc_Trk_pt",      m_nt_ntracks, m_nt_mc_Trk_pt);
+	sc = nt0->addItem("mc_Trk_charge",  m_nt_ntracks, m_nt_mc_Trk_charge);
+	sc = nt0->addItem("mc_Trk_prob",    m_nt_ntracks, m_nt_mc_Trk_prob);
+	sc = nt0->addItem("mc_Trk_pdg",     m_nt_ntracks, m_nt_mc_Trk_pdg);
+
+	sc = nt0->addItem("mc_Trk_vtxX",    m_nt_ntracks, m_nt_mc_Trk_vtxX);
+	sc = nt0->addItem("mc_Trk_vtxY",    m_nt_ntracks, m_nt_mc_Trk_vtxY);
+	sc = nt0->addItem("mc_Trk_vtxZ",    m_nt_ntracks, m_nt_mc_Trk_vtxZ);
 	// ----------------------------------------------------------------------
       }
 
@@ -720,37 +720,37 @@ void InDetAlignFillTrack::bookUpNtuple() {
     
     if (nt1) {
       StatusCode sc;
-      // nt1->addItem("event", nt_event); // event number
-      sc = nt1->addItem("nTracks_Up", nt_nUptracks, 0, maxTracks); // number of tracks
+      // nt1->addItem("event", m_nt_event); // event number
+      sc = nt1->addItem("nTracks_Up", m_nt_nUptracks, 0, maxTracks); // number of tracks
 
       // ----------------------------------------------------------------------
       // Trk::Track parameters
-      sc = nt1->addItem("Trk_d0_Up",     nt_nUptracks, nt_Trk_d0_Up);
-      sc = nt1->addItem("Trk_z0_Up",     nt_nUptracks, nt_Trk_z0_Up);
-      sc = nt1->addItem("Trk_phi0_Up",   nt_nUptracks, nt_Trk_phi0_Up);
-      sc = nt1->addItem("Trk_theta0_Up", nt_nUptracks, nt_Trk_theta0_Up);
-      sc = nt1->addItem("Trk_qoverp_Up", nt_nUptracks, nt_Trk_qoverp_Up);
-      sc = nt1->addItem("Trk_pt_Up",     nt_nUptracks, nt_Trk_pt_Up);
+      sc = nt1->addItem("Trk_d0_Up",     m_nt_nUptracks, m_nt_Trk_d0_Up);
+      sc = nt1->addItem("Trk_z0_Up",     m_nt_nUptracks, m_nt_Trk_z0_Up);
+      sc = nt1->addItem("Trk_phi0_Up",   m_nt_nUptracks, m_nt_Trk_phi0_Up);
+      sc = nt1->addItem("Trk_theta0_Up", m_nt_nUptracks, m_nt_Trk_theta0_Up);
+      sc = nt1->addItem("Trk_qoverp_Up", m_nt_nUptracks, m_nt_Trk_qoverp_Up);
+      sc = nt1->addItem("Trk_pt_Up",     m_nt_nUptracks, m_nt_Trk_pt_Up);
       // ----------------------------------------------------------------------
 
       // ----------------------------------------------------------------------
       // Trk::Track hits...
-      sc = nt1->addItem("Trk_nHits_Up",       nt_nUptracks, nt_Trk_nHits_Up);
-      sc = nt1->addItem("Trk_nhitsPixels_Up", nt_nUptracks, nt_Trk_nhitspix_Up);
-      sc = nt1->addItem("Trk_nhitsSCT_Up",    nt_nUptracks, nt_Trk_nhitssct_Up);
-      sc = nt1->addItem("Trk_nhitsTRT_Up",    nt_nUptracks, nt_Trk_nhitstrt_Up);
+      sc = nt1->addItem("Trk_nHits_Up",       m_nt_nUptracks, m_nt_Trk_nHits_Up);
+      sc = nt1->addItem("Trk_nhitsPixels_Up", m_nt_nUptracks, m_nt_Trk_nhitspix_Up);
+      sc = nt1->addItem("Trk_nhitsSCT_Up",    m_nt_nUptracks, m_nt_Trk_nhitssct_Up);
+      sc = nt1->addItem("Trk_nhitsTRT_Up",    m_nt_nUptracks, m_nt_Trk_nhitstrt_Up);
       
-      sc = nt1->addItem("Trk_nsharedPixels_Up", nt_nUptracks, nt_Trk_nsharedPixels_Up);
-      sc = nt1->addItem("Trk_nsharedSCT_Up",    nt_nUptracks, nt_Trk_nsharedSCT_Up);
-      sc = nt1->addItem("Trk_nshared_Up",       nt_nUptracks, nt_Trk_nshared_Up);
+      sc = nt1->addItem("Trk_nsharedPixels_Up", m_nt_nUptracks, m_nt_Trk_nsharedPixels_Up);
+      sc = nt1->addItem("Trk_nsharedSCT_Up",    m_nt_nUptracks, m_nt_Trk_nsharedSCT_Up);
+      sc = nt1->addItem("Trk_nshared_Up",       m_nt_nUptracks, m_nt_Trk_nshared_Up);
       
-      sc = nt1->addItem("Trk_nholesPixels_Up", nt_nUptracks, nt_Trk_nholesPixels_Up);
-      sc = nt1->addItem("Trk_nholesSCT_Up",    nt_nUptracks, nt_Trk_nholesSCT_Up);
-      sc = nt1->addItem("Trk_nholes_Up",       nt_nUptracks, nt_Trk_nholes_Up);
+      sc = nt1->addItem("Trk_nholesPixels_Up", m_nt_nUptracks, m_nt_Trk_nholesPixels_Up);
+      sc = nt1->addItem("Trk_nholesSCT_Up",    m_nt_nUptracks, m_nt_Trk_nholesSCT_Up);
+      sc = nt1->addItem("Trk_nholes_Up",       m_nt_nUptracks, m_nt_Trk_nholes_Up);
       
-      sc = nt1->addItem("Trk_chi2_Up",     nt_nUptracks, nt_Trk_chi2_Up);
-      sc = nt1->addItem("Trk_ndof_Up",     nt_nUptracks, nt_Trk_ndof_Up);
-      sc = nt1->addItem("Trk_chi2Prob_Up", nt_nUptracks, nt_Trk_chi2Prob_Up);
+      sc = nt1->addItem("Trk_chi2_Up",     m_nt_nUptracks, m_nt_Trk_chi2_Up);
+      sc = nt1->addItem("Trk_ndof_Up",     m_nt_nUptracks, m_nt_Trk_ndof_Up);
+      sc = nt1->addItem("Trk_chi2Prob_Up", m_nt_nUptracks, m_nt_Trk_chi2Prob_Up);
       // ----------------------------------------------------------------------
      
       if (sc.isFailure()) msg(MSG::FATAL) << "Failed ntupleSvc()" << endmsg;
@@ -780,37 +780,37 @@ void InDetAlignFillTrack::bookLowNtuple() {
     
     if (nt2) {
       StatusCode sc;
-      // sc = nt2->addItem("event", nt_event); // event number
-      sc = nt2->addItem("nTracks_Low", nt_nLowtracks, 0, maxTracks); // number of tracks
+      // sc = nt2->addItem("event", m_nt_event); // event number
+      sc = nt2->addItem("nTracks_Low", m_nt_nLowtracks, 0, maxTracks); // number of tracks
 
       // ----------------------------------------------------------------------
       // Trk::Track parameters
-      sc = nt2->addItem("Trk_d0_Low",     nt_nLowtracks, nt_Trk_d0_Low);
-      sc = nt2->addItem("Trk_z0_Low",     nt_nLowtracks, nt_Trk_z0_Low);
-      sc = nt2->addItem("Trk_phi0_Low",   nt_nLowtracks, nt_Trk_phi0_Low);
-      sc = nt2->addItem("Trk_theta0_Low", nt_nLowtracks, nt_Trk_theta0_Low);
-      sc = nt2->addItem("Trk_qoverp_Low", nt_nLowtracks, nt_Trk_qoverp_Low);
-      sc = nt2->addItem("Trk_pt_Low",     nt_nLowtracks, nt_Trk_pt_Low);
+      sc = nt2->addItem("Trk_d0_Low",     m_nt_nLowtracks, m_nt_Trk_d0_Low);
+      sc = nt2->addItem("Trk_z0_Low",     m_nt_nLowtracks, m_nt_Trk_z0_Low);
+      sc = nt2->addItem("Trk_phi0_Low",   m_nt_nLowtracks, m_nt_Trk_phi0_Low);
+      sc = nt2->addItem("Trk_theta0_Low", m_nt_nLowtracks, m_nt_Trk_theta0_Low);
+      sc = nt2->addItem("Trk_qoverp_Low", m_nt_nLowtracks, m_nt_Trk_qoverp_Low);
+      sc = nt2->addItem("Trk_pt_Low",     m_nt_nLowtracks, m_nt_Trk_pt_Low);
       // ----------------------------------------------------------------------
 
       // ----------------------------------------------------------------------
       // Trk::Track hits...
-      sc = nt2->addItem("Trk_nHits_Low",       nt_nLowtracks, nt_Trk_nHits_Low);
-      sc = nt2->addItem("Trk_nhitsPixels_Low", nt_nLowtracks, nt_Trk_nhitspix_Low);
-      sc = nt2->addItem("Trk_nhitsSCT_Low",    nt_nLowtracks, nt_Trk_nhitssct_Low);
-      sc = nt2->addItem("Trk_nhitsTRT_Low",    nt_nLowtracks, nt_Trk_nhitstrt_Low);
-
-      sc = nt2->addItem("Trk_nsharedPixels_Low", nt_nLowtracks, nt_Trk_nsharedPixels_Low);
-      sc = nt2->addItem("Trk_nsharedSCT_Low",    nt_nLowtracks, nt_Trk_nsharedSCT_Low);
-      sc = nt2->addItem("Trk_nshared_Low",       nt_nLowtracks, nt_Trk_nshared_Low);
-
-      sc = nt2->addItem("Trk_nholesPixels_Low", nt_nLowtracks, nt_Trk_nholesPixels_Low);
-      sc = nt2->addItem("Trk_nholesSCT_Low",    nt_nLowtracks, nt_Trk_nholesSCT_Low);
-      sc = nt2->addItem("Trk_nholes_Low",       nt_nLowtracks, nt_Trk_nholes_Low);
-
-      sc = nt2->addItem("Trk_chi2_Low",     nt_nLowtracks, nt_Trk_chi2_Low);
-      sc = nt2->addItem("Trk_ndof_Low",     nt_nLowtracks, nt_Trk_ndof_Low);
-      sc = nt2->addItem("Trk_chi2Prob_Low", nt_nLowtracks, nt_Trk_chi2Prob_Low);
+      sc = nt2->addItem("Trk_nHits_Low",       m_nt_nLowtracks, m_nt_Trk_nHits_Low);
+      sc = nt2->addItem("Trk_nhitsPixels_Low", m_nt_nLowtracks, m_nt_Trk_nhitspix_Low);
+      sc = nt2->addItem("Trk_nhitsSCT_Low",    m_nt_nLowtracks, m_nt_Trk_nhitssct_Low);
+      sc = nt2->addItem("Trk_nhitsTRT_Low",    m_nt_nLowtracks, m_nt_Trk_nhitstrt_Low);
+
+      sc = nt2->addItem("Trk_nsharedPixels_Low", m_nt_nLowtracks, m_nt_Trk_nsharedPixels_Low);
+      sc = nt2->addItem("Trk_nsharedSCT_Low",    m_nt_nLowtracks, m_nt_Trk_nsharedSCT_Low);
+      sc = nt2->addItem("Trk_nshared_Low",       m_nt_nLowtracks, m_nt_Trk_nshared_Low);
+
+      sc = nt2->addItem("Trk_nholesPixels_Low", m_nt_nLowtracks, m_nt_Trk_nholesPixels_Low);
+      sc = nt2->addItem("Trk_nholesSCT_Low",    m_nt_nLowtracks, m_nt_Trk_nholesSCT_Low);
+      sc = nt2->addItem("Trk_nholes_Low",       m_nt_nLowtracks, m_nt_Trk_nholes_Low);
+
+      sc = nt2->addItem("Trk_chi2_Low",     m_nt_nLowtracks, m_nt_Trk_chi2_Low);
+      sc = nt2->addItem("Trk_ndof_Low",     m_nt_nLowtracks, m_nt_Trk_ndof_Low);
+      sc = nt2->addItem("Trk_chi2Prob_Low", m_nt_nLowtracks, m_nt_Trk_chi2Prob_Low);
       // ----------------------------------------------------------------------
       if (sc.isFailure()) msg(MSG::FATAL) << "Failed ntupleSvc()" << endmsg;
       else  msg(MSG::DEBUG) << "Ntuple " << nt2id << " has been booked successfully! " << endmsg;
@@ -839,20 +839,20 @@ void InDetAlignFillTrack::bookMatchingNtuple() {
     
     if (nt3) {
       StatusCode sc;
-      // sc = nt3->addItem("event", nt_event); // event number
+      // sc = nt3->addItem("event", m_nt_event); // event number
      
-      sc = nt3->addItem("nTracks_Match",nt_matchingTrk, 0, maxTracks); // number of tracks
+      sc = nt3->addItem("nTracks_Match",m_nt_matchingTrk, 0, maxTracks); // number of tracks
 
       // ----------------------------------------------------------------------
       // Matching for the usual Trk::Track parameters
-      sc = nt3->addItem("Trk_delta_d0",       nt_matchingTrk, nt_Trk_delta_d0);
-      sc = nt3->addItem("Trk_delta_phi0",      nt_matchingTrk, nt_Trk_delta_phi0);
-      sc = nt3->addItem("Trk_delta_theta0",    nt_matchingTrk, nt_Trk_delta_theta0);
-      sc = nt3->addItem("Trk_delta_eta",       nt_matchingTrk, nt_Trk_delta_eta);
-      sc = nt3->addItem("Trk_delta_z0",        nt_matchingTrk, nt_Trk_delta_z0);
-      sc = nt3->addItem("Trk_delta_qoverpt",   nt_matchingTrk, nt_Trk_delta_qoverpt);
-      sc = nt3->addItem("Trk_delta_pt",        nt_matchingTrk, nt_Trk_delta_pt);
-      sc = nt3->addItem("Trk_delta_charge",    nt_matchingTrk, nt_Trk_delta_charge);
+      sc = nt3->addItem("Trk_delta_d0",       m_nt_matchingTrk, m_nt_Trk_delta_d0);
+      sc = nt3->addItem("Trk_delta_phi0",      m_nt_matchingTrk, m_nt_Trk_delta_phi0);
+      sc = nt3->addItem("Trk_delta_theta0",    m_nt_matchingTrk, m_nt_Trk_delta_theta0);
+      sc = nt3->addItem("Trk_delta_eta",       m_nt_matchingTrk, m_nt_Trk_delta_eta);
+      sc = nt3->addItem("Trk_delta_z0",        m_nt_matchingTrk, m_nt_Trk_delta_z0);
+      sc = nt3->addItem("Trk_delta_qoverpt",   m_nt_matchingTrk, m_nt_Trk_delta_qoverpt);
+      sc = nt3->addItem("Trk_delta_pt",        m_nt_matchingTrk, m_nt_Trk_delta_pt);
+      sc = nt3->addItem("Trk_delta_charge",    m_nt_matchingTrk, m_nt_Trk_delta_charge);
       // ----------------------------------------------------------------------
       
       if (sc.isFailure()) msg(MSG::FATAL) << "Failed ntupleSvc()" << endmsg;
@@ -1034,79 +1034,79 @@ void InDetAlignFillTrack::dumpTrack(int itrk, const Trk::Track* trk,
     }  
     // Fill ntuple
     if (TrkColName=="Up") {
-      nt_Trk_d0_Up[itrk] = d0;
-      nt_Trk_z0_Up[itrk] = z0;
-      nt_Trk_phi0_Up[itrk] = phi0;
-      nt_Trk_theta0_Up[itrk] = theta;
-      nt_Trk_qoverp_Up[itrk] = qOverP;
-      nt_Trk_pt_Up[itrk] = transverseMomentum;
+      m_nt_Trk_d0_Up[itrk] = d0;
+      m_nt_Trk_z0_Up[itrk] = z0;
+      m_nt_Trk_phi0_Up[itrk] = phi0;
+      m_nt_Trk_theta0_Up[itrk] = theta;
+      m_nt_Trk_qoverp_Up[itrk] = qOverP;
+      m_nt_Trk_pt_Up[itrk] = transverseMomentum;
       
-      nt_Trk_nHits_Up[itrk] = nHits;
-      nt_Trk_nhitspix_Up[itrk] = nhitspix;
-      nt_Trk_nhitssct_Up[itrk] = nhitssct;
-      nt_Trk_nhitstrt_Up[itrk] = nhitstrt;
+      m_nt_Trk_nHits_Up[itrk] = nHits;
+      m_nt_Trk_nhitspix_Up[itrk] = nhitspix;
+      m_nt_Trk_nhitssct_Up[itrk] = nhitssct;
+      m_nt_Trk_nhitstrt_Up[itrk] = nhitstrt;
       
-      nt_Trk_nsharedPixels_Up[itrk] = nshpix;
-      nt_Trk_nsharedSCT_Up[itrk] = nshsct;
-      nt_Trk_nshared_Up[itrk] = nshared;
+      m_nt_Trk_nsharedPixels_Up[itrk] = nshpix;
+      m_nt_Trk_nsharedSCT_Up[itrk] = nshsct;
+      m_nt_Trk_nshared_Up[itrk] = nshared;
       
-      nt_Trk_nholesPixels_Up[itrk] = nhpix;
-      nt_Trk_nholesSCT_Up[itrk] = nhsct;
-      nt_Trk_nholes_Up[itrk] = nholes;
+      m_nt_Trk_nholesPixels_Up[itrk] = nhpix;
+      m_nt_Trk_nholesSCT_Up[itrk] = nhsct;
+      m_nt_Trk_nholes_Up[itrk] = nholes;
       
-      nt_Trk_chi2_Up[itrk] = fitQual->chiSquared();
-      nt_Trk_ndof_Up[itrk] = fitQual->numberDoF();
-      nt_Trk_chi2Prob_Up[itrk] = chi2Prob;
+      m_nt_Trk_chi2_Up[itrk] = fitQual->chiSquared();
+      m_nt_Trk_ndof_Up[itrk] = fitQual->numberDoF();
+      m_nt_Trk_chi2Prob_Up[itrk] = chi2Prob;
     }
     else if (TrkColName=="Low") {
-      nt_Trk_d0_Low[itrk] = d0;
-      nt_Trk_z0_Low[itrk] = z0;
-      nt_Trk_phi0_Low[itrk] = phi0;
-      nt_Trk_theta0_Low[itrk] = theta;
-      nt_Trk_qoverp_Low[itrk] = qOverP;
-      nt_Trk_pt_Low[itrk] = transverseMomentum;
+      m_nt_Trk_d0_Low[itrk] = d0;
+      m_nt_Trk_z0_Low[itrk] = z0;
+      m_nt_Trk_phi0_Low[itrk] = phi0;
+      m_nt_Trk_theta0_Low[itrk] = theta;
+      m_nt_Trk_qoverp_Low[itrk] = qOverP;
+      m_nt_Trk_pt_Low[itrk] = transverseMomentum;
       
-      nt_Trk_nHits_Low[itrk] = nHits;
-      nt_Trk_nhitspix_Low[itrk] = nhitspix;
-      nt_Trk_nhitssct_Low[itrk] = nhitssct;
-      nt_Trk_nhitstrt_Low[itrk] = nhitstrt;
+      m_nt_Trk_nHits_Low[itrk] = nHits;
+      m_nt_Trk_nhitspix_Low[itrk] = nhitspix;
+      m_nt_Trk_nhitssct_Low[itrk] = nhitssct;
+      m_nt_Trk_nhitstrt_Low[itrk] = nhitstrt;
       
-      nt_Trk_nsharedPixels_Low[itrk] = nshpix;
-      nt_Trk_nsharedSCT_Low[itrk] = nshsct;
-      nt_Trk_nshared_Low[itrk] = nshared;
+      m_nt_Trk_nsharedPixels_Low[itrk] = nshpix;
+      m_nt_Trk_nsharedSCT_Low[itrk] = nshsct;
+      m_nt_Trk_nshared_Low[itrk] = nshared;
       
-      nt_Trk_nholesPixels_Low[itrk] = nhpix;
-      nt_Trk_nholesSCT_Low[itrk] = nhsct;
-      nt_Trk_nholes_Low[itrk] = nholes;
+      m_nt_Trk_nholesPixels_Low[itrk] = nhpix;
+      m_nt_Trk_nholesSCT_Low[itrk] = nhsct;
+      m_nt_Trk_nholes_Low[itrk] = nholes;
       
-      nt_Trk_chi2_Low[itrk] = fitQual->chiSquared();
-      nt_Trk_ndof_Low[itrk] = fitQual->numberDoF();
-      nt_Trk_chi2Prob_Low[itrk] = chi2Prob;
+      m_nt_Trk_chi2_Low[itrk] = fitQual->chiSquared();
+      m_nt_Trk_ndof_Low[itrk] = fitQual->numberDoF();
+      m_nt_Trk_chi2Prob_Low[itrk] = chi2Prob;
     }
     else {
-      nt_Trk_d0[itrk] = d0;
-      nt_Trk_z0[itrk] = z0;
-      nt_Trk_phi0[itrk] = phi0;
-      nt_Trk_theta0[itrk] = theta;
-      nt_Trk_qoverp[itrk] = qOverP;
-      nt_Trk_pt[itrk] = transverseMomentum;
+      m_nt_Trk_d0[itrk] = d0;
+      m_nt_Trk_z0[itrk] = z0;
+      m_nt_Trk_phi0[itrk] = phi0;
+      m_nt_Trk_theta0[itrk] = theta;
+      m_nt_Trk_qoverp[itrk] = qOverP;
+      m_nt_Trk_pt[itrk] = transverseMomentum;
       
-      nt_Trk_nHits[itrk] = nHits;
-      nt_Trk_nhitspix[itrk] = nhitspix;
-      nt_Trk_nhitssct[itrk] = nhitssct;
-      nt_Trk_nhitstrt[itrk] = nhitstrt;
+      m_nt_Trk_nHits[itrk] = nHits;
+      m_nt_Trk_nhitspix[itrk] = nhitspix;
+      m_nt_Trk_nhitssct[itrk] = nhitssct;
+      m_nt_Trk_nhitstrt[itrk] = nhitstrt;
       
-      nt_Trk_nsharedPixels[itrk] = nshpix;
-      nt_Trk_nsharedSCT[itrk] = nshsct;
-      nt_Trk_nshared[itrk] = nshared;
+      m_nt_Trk_nsharedPixels[itrk] = nshpix;
+      m_nt_Trk_nsharedSCT[itrk] = nshsct;
+      m_nt_Trk_nshared[itrk] = nshared;
       
-      nt_Trk_nholesPixels[itrk] = nhpix;
-      nt_Trk_nholesSCT[itrk] = nhsct;
-      nt_Trk_nholes[itrk] = nholes;
+      m_nt_Trk_nholesPixels[itrk] = nhpix;
+      m_nt_Trk_nholesSCT[itrk] = nhsct;
+      m_nt_Trk_nholes[itrk] = nholes;
       
-      nt_Trk_chi2[itrk] = fitQual->chiSquared();
-      nt_Trk_ndof[itrk] = fitQual->numberDoF();
-      nt_Trk_chi2Prob[itrk] = chi2Prob;
+      m_nt_Trk_chi2[itrk] = fitQual->chiSquared();
+      m_nt_Trk_ndof[itrk] = fitQual->numberDoF();
+      m_nt_Trk_chi2Prob[itrk] = chi2Prob;
     }
   }
   
@@ -1143,15 +1143,15 @@ void InDetAlignFillTrack::dumpPerigee(const Trk::TrackParameters* generatedTrack
 	  << " pT = " << pt/CLHEP::GeV << " CLHEP::GeV/c" << endmsg;
   }
 
-  nt_mc_Trk_d0[index] = d0;
-  nt_mc_Trk_z0[index] = z0;
-  nt_mc_Trk_phi0[index] = phi0;
-  nt_mc_Trk_theta0[index] = theta;
-  nt_mc_Trk_eta[index] = eta;
-  nt_mc_Trk_qoverp[index] = qoverp;
-  nt_mc_Trk_qoverpt[index] = qoverpt;
-  nt_mc_Trk_pt[index] = pt;
-  nt_mc_Trk_charge[index] = charge;
+  m_nt_mc_Trk_d0[index] = d0;
+  m_nt_mc_Trk_z0[index] = z0;
+  m_nt_mc_Trk_phi0[index] = phi0;
+  m_nt_mc_Trk_theta0[index] = theta;
+  m_nt_mc_Trk_eta[index] = eta;
+  m_nt_mc_Trk_qoverp[index] = qoverp;
+  m_nt_mc_Trk_qoverpt[index] = qoverpt;
+  m_nt_mc_Trk_pt[index] = pt;
+  m_nt_mc_Trk_charge[index] = charge;
  
   return;  
 }
@@ -1274,16 +1274,16 @@ StatusCode InDetAlignFillTrack::dumpMatching(const TrackCollection* tracksUpper,
     if(matchFound) {
       
       if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Match found!" <<endmsg;
-      nt_matchingTrk = 1;
-      nt_Trk_delta_d0[nTracksUpper] = d0Up - Matched_Low_d0;
-      nt_Trk_delta_phi0[nTracksUpper] = phi0Up - Matched_Low_phi0;
+      m_nt_matchingTrk = 1;
+      m_nt_Trk_delta_d0[nTracksUpper] = d0Up - Matched_Low_d0;
+      m_nt_Trk_delta_phi0[nTracksUpper] = phi0Up - Matched_Low_phi0;
       //**
-      nt_Trk_delta_theta0[nTracksUpper] = thetaUp - Matched_Low_theta;
-      nt_Trk_delta_eta[nTracksUpper] = eta0Up - Matched_Low_eta0;
-      nt_Trk_delta_z0[nTracksUpper] = z0Up - Matched_Low_z0;
-      nt_Trk_delta_qoverpt[nTracksUpper] = qOverPtUp - Matched_Low_qOverPt;
-      nt_Trk_delta_pt[nTracksUpper] = ptUp - Matched_Low_pt;
-      nt_Trk_delta_charge[nTracksUpper] = chargeUp - Matched_Low_charge;
+      m_nt_Trk_delta_theta0[nTracksUpper] = thetaUp - Matched_Low_theta;
+      m_nt_Trk_delta_eta[nTracksUpper] = eta0Up - Matched_Low_eta0;
+      m_nt_Trk_delta_z0[nTracksUpper] = z0Up - Matched_Low_z0;
+      m_nt_Trk_delta_qoverpt[nTracksUpper] = qOverPtUp - Matched_Low_qOverPt;
+      m_nt_Trk_delta_pt[nTracksUpper] = ptUp - Matched_Low_pt;
+      m_nt_Trk_delta_charge[nTracksUpper] = chargeUp - Matched_Low_charge;
       
     } // end match found
     
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/createDeadModuleList.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/createDeadModuleList.C
index fcfce03b31b..9178654f16e 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/createDeadModuleList.C
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/createDeadModuleList.C
@@ -232,7 +232,12 @@ int main(int argc, char* argv[]){
 
   //std::string testarea = std::getenv("TestArea");
   //ifstream ifs;
-  std::string cmtpath = std::getenv("DATAPATH");
+  char* tmppath = std::getenv("DATAPATH");
+  if(tmppath == nullptr){
+      std::cout << "FATAL: Unable to retrieve environmental DATAPATH" << std::endl;
+      exit(EXIT_FAILURE);
+  }
+  std::string cmtpath(tmppath);
   std::vector<std::string> paths = splitter(cmtpath, ':');
   std::ifstream ifs;
   std::ifstream ifs2;
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateDeadMaps.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateDeadMaps.C
index 1ea7ceb7696..7602d177fa4 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateDeadMaps.C
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateDeadMaps.C
@@ -436,7 +436,12 @@ int main(int argc, char* argv[]){
 
   //std::string testarea = std::getenv("TestArea");
   //ifstream ifs;
-  std::string cmtpath = std::getenv("DATAPATH");
+  char* tmppath = std::getenv("DATAPATH");
+  if(tmppath == nullptr){
+      std::cout << "FATAL: Unable to retrieve environmental DATAPATH" << std::endl;
+      exit(EXIT_FAILURE);
+  }
+  std::string cmtpath(tmppath);
   std::vector<std::string> paths = splitter(cmtpath, ':');
   std::ifstream ifs;
   for (const auto& x : paths){
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateNoiseMaps.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateNoiseMaps.C
index 253d7a8de7b..f3aca980e09 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateNoiseMaps.C
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateNoiseMaps.C
@@ -563,7 +563,12 @@ int main(int argc, char* argv[]){
   }
 
   //std::string testarea = std::getenv("TestArea");
-  std::string cmtpath = std::getenv("DATAPATH");
+  char* tmppath = std::getenv("DATAPATH");
+  if(tmppath == nullptr){
+      std::cout << "FATAL: Unable to retrieve environmental DATAPATH" << std::endl;
+      exit(EXIT_FAILURE);    
+  }
+  std::string cmtpath(tmppath);
   std::vector<std::string> paths = splitter(cmtpath, ':');
   std::ifstream ifs;
   for (const auto& x : paths){
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/NoiseMapBuilder.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/NoiseMapBuilder.cxx
index b4656cff6e1..93614ba4ab4 100755
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/NoiseMapBuilder.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/NoiseMapBuilder.cxx
@@ -166,7 +166,12 @@ StatusCode NoiseMapBuilder::initialize(){
 
   //std::string testarea = std::getenv("TestArea");
   //ifstream ifs(testarea + "/InstallArea/share/PixelMapping_Run2.dat");
-  std::string cmtpath = std::getenv("DATAPATH");
+  char* tmppath = std::getenv("DATAPATH");
+  if(tmppath == nullptr){
+      ATH_MSG_FATAL( "Unable to retrieve environmental DATAPATH" );
+      return StatusCode::FAILURE;
+  }
+  std::string cmtpath(tmppath);
   std::vector<std::string> paths = splitter(cmtpath, ':');
   std::ifstream ifs;
   for (const auto& x : paths){
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx
index 2359354d3ed..08ed0be71db 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx
@@ -239,7 +239,7 @@ PixelChargeInterpolationParameters *PixelChargeInterpolationHistograms::Analyze(
 	TCanvas *c1 = new TCanvas();
 	c1->UseCurrentStyle();
 
-	//char *currpath = getcwd(NULL,0);
+	//char *currpath = getcwd(nullptr,0);
         //mkdir(m_etaProfile->GetName(),S_IRWXU | S_IRWXG | S_IRWXO);
 	//chdir(m_etaProfile->GetName());
 
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelResidualHistograms.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelResidualHistograms.cxx
index f8b52fc6ebc..3c94ef13690 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelResidualHistograms.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelResidualHistograms.cxx
@@ -399,7 +399,7 @@ int PixelResidualHistograms::Analyze(PixelResidualHistograms *reference,
 	
 	int nhistos =  m_HistogramsVector->GetNhistos();
 
-	char *currpath = getcwd(NULL,0);
+	char *currpath = getcwd(nullptr,0);
         mkdir(m_GlobalName.c_str(),S_IRWXU | S_IRWXG | S_IRWXO);
 	chdir(m_GlobalName.c_str());
 
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteSvc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteSvc.h
index fc11f2b5f3f..75e97fc990b 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteSvc.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteSvc.h
@@ -153,8 +153,8 @@ private:
   StatusCode registerIOV(const CLID& clid);
   int stringToInt(const std::string& s) const;
   
-  StatusCode streamOutCondObjects(const std::string & foldername) const;
-  StatusCode streamOutCondObjectsWithErrMsg(const std::string & foldername) 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);
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx
index 6e630f2df89..35b3a7587f4 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx
@@ -626,7 +626,7 @@ StatusCode SCTCalibWriteSvc::wrapUpLorentzAngle(){
 
 ///////////////////////////////////////////////////////////////////////////////////////
 
-StatusCode SCTCalibWriteSvc::streamOutCondObjects(const std::string& foldername) const{
+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;
@@ -652,7 +652,7 @@ StatusCode SCTCalibWriteSvc::streamOutCondObjects(const std::string& foldername)
 }
 ///////////////////////////////////////////////////////////////////////////////////////
 
-StatusCode SCTCalibWriteSvc::streamOutCondObjectsWithErrMsg(const std::string& foldername) const{
+StatusCode SCTCalibWriteSvc::streamOutCondObjectsWithErrMsg(const std::string& foldername) {
   if (streamOutCondObjects(foldername).isFailure()){
     return msg(MSG:: ERROR) <<"Could create conditions object  "<< foldername<< endmsg, StatusCode::FAILURE;
   }
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/FillAlignTrkInfo.cxx b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/FillAlignTrkInfo.cxx
index c87bb536273..c1bb63bc644 100755
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/FillAlignTrkInfo.cxx
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/FillAlignTrkInfo.cxx
@@ -69,11 +69,15 @@ bool FillAlignTrkInfo::fill(const Trk::Track* aTrack, TRT::TrackInfo* output,
   (*output)[TRT::Track::chiSquare]=aTrack->fitQuality()->chiSquared();
   (*output)[TRT::Track::degreesOfFreedom]=aTrack->fitQuality()->numberDoF();
 
+  // implicit memory allocation in createSummary, need to clean up later 
   const Trk::TrackSummary* summary = m_TrackSummaryTool->createSummary(*aTrack);
   (*output)[TRT::Track::numberOfPixelHits]=summary->get(Trk::numberOfPixelHits) ;
   (*output)[TRT::Track::numberOfSCTHits]=summary->get(Trk::numberOfSCTHits) ;
   (*output)[TRT::Track::numberOfTRTHits]=summary->get(Trk::numberOfTRTHits) ;
 
+  // fix to coverity 118333
+  delete summary;
+
   // All ok
   if (msgLvl(MSG::DEBUG)) msg() << "Track info filled .... " << endmsg;
   return true;
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibTrackSelectionTool.cxx b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibTrackSelectionTool.cxx
index 9f0523e23ba..65239bd4310 100755
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibTrackSelectionTool.cxx
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibTrackSelectionTool.cxx
@@ -71,8 +71,8 @@ bool TRTCalibTrackSelectionTool::isAccepted(const Trk::Track* pTrack) const
   
   float eta=-log(tan(theta/2));
   if (m_EtaMin< m_EtaMax && (eta < m_EtaMin || eta > m_EtaMax) ) return false;
-  
-  const Trk::TrackSummary* summary = m_TrackSummaryTool->createSummary(*pTrack);
+
+  std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*pTrack));
   if(summary->get(Trk::numberOfTRTHits)<m_MinTRTHits) return false;
   if(summary->get(Trk::numberOfPixelHits)<m_MinPixelHits) return false;
   if(summary->get(Trk::numberOfSCTHits)<m_MinSCTHits) return false;
diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterErrorData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterErrorData.cxx
index e19f84fe329..84c3cdb6c04 100644
--- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterErrorData.cxx
+++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterErrorData.cxx
@@ -236,8 +236,10 @@ void PixelClusterErrorData::Load(std::string file){
   m_ibletaerror.clear();
 
   float value;
-  nb = std::min(nb, nmax);
-  ne = std::min(ne, nmax);
+  if(nb<0) nb=0;
+  else if(nb>nmax) nb=nmax;
+  if(ne<0) ne=0;
+  else if(ne>nmax) ne=nmax;
   for(int ib=0; ib<nb && !infile.eof(); ib++){
     infile >> value;
     m_barrelphierror.push_back(value);
diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterOnTrackErrorData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterOnTrackErrorData.cxx
index c347a5afde5..58cf27ec476 100644
--- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterOnTrackErrorData.cxx
+++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterOnTrackErrorData.cxx
@@ -453,7 +453,7 @@ void PixelClusterOnTrackErrorData::Load(std::string file){
 
   float value;
   if(ncsx<0)ncsx = 0;
-  ncsx = std::min(ncsx, nmax);
+  if(ncsx>nmax) ncsx=nmax;
   m_csx.clear();
   m_csx.reserve(ncsx);
   for(int i=0; i<ncsx && !infile.eof(); i++){
@@ -461,7 +461,7 @@ void PixelClusterOnTrackErrorData::Load(std::string file){
     m_csx.push_back(value);
   }
   if(ncsy<0)ncsy=0;
-  ncsy = std::min(ncsy, nmax);
+  if(ncsy>nmax) ncsy=nmax;
   m_csy.clear();
   m_csy.reserve(ncsy);
   for(int i=0; i<ncsy && !infile.eof(); i++){
@@ -470,14 +470,14 @@ void PixelClusterOnTrackErrorData::Load(std::string file){
   }
   if(m_etabinsibl>0 && m_phibinsibl >0 ){ // IBL
     m_ibletaref.clear();
-    m_etabinsibl = std::min(m_etabinsibl, nmax);
+    if(m_etabinsibl>nmax) m_etabinsibl=nmax;
     m_ibletaref.reserve(m_etabinsibl+1);
     for(int i=0; i<m_etabinsibl+1; i++){
       infile >> value;
       m_ibletaref.push_back(value);
     }
     m_iblphibins.clear();
-    m_phibinsibl = std::min(m_phibinsibl, nmax);
+    if(m_phibinsibl>nmax) m_phibinsibl=nmax;
     m_iblphibins.reserve(m_phibinsibl+1);
     for(int i=0; i<m_phibinsibl+1; i++){
       infile >> value;
@@ -485,7 +485,7 @@ void PixelClusterOnTrackErrorData::Load(std::string file){
     }	 
   }
   if(neta<0)neta=0;
-  neta = std::min(neta, nmax);
+  if(neta>nmax) neta=nmax;
   m_etaref.clear();
   m_etaref.reserve(neta);
   for(int i=0; i<neta && !infile.eof(); i++){
@@ -493,7 +493,7 @@ void PixelClusterOnTrackErrorData::Load(std::string file){
     m_etaref.push_back(value);
   }
   if(nalpha<0)nalpha = 0;
-  nalpha = std::min(nalpha, nmax);
+  if(nalpha>nmax) nalpha=nmax;
   m_phibins.clear();
   m_phibins.reserve(nalpha);
   for(int i=0; i<nalpha && !infile.eof(); i++){
@@ -501,7 +501,7 @@ void PixelClusterOnTrackErrorData::Load(std::string file){
     m_phibins.push_back(value);
   }
   if(nxbinsibl>0){ // IBL
-    nxbinsibl = std::min(nxbinsibl, nmax);
+    if(nxbinsibl>nmax) nxbinsibl=nmax;
     m_iblphierror.clear();
     m_iblphierror.reserve(nxbinsibl);
     for(int ib1=0; ib1<nxbinsibl; ib1++){
@@ -520,7 +520,7 @@ void PixelClusterOnTrackErrorData::Load(std::string file){
      m_barrelphierror.push_back(value);
   }
   if(nybinsibl>0){ // IBL
-    nybinsibl = std::min(nybinsibl, nmax);
+    if(nybinsibl>nmax) nybinsibl=nmax;
     m_ibletaerror.clear();
     m_ibletaerror.reserve(nybinsibl);
     for(int ib1=0; ib1<nybinsibl; ib1++){
diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelDCSSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelDCSSvc.cxx
index c2cf3a0b585..db8160086e9 100644
--- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelDCSSvc.cxx
+++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelDCSSvc.cxx
@@ -28,6 +28,8 @@ PixelDCSSvc::PixelDCSSvc(const std::string& name, ISvcLocator* sl):
   AthService(name, sl),
   m_detStore("DetectorStore", name),
   m_pixelDCSData(0),
+  m_pixid(nullptr),
+  m_pixman(nullptr),
   m_par_temperatureKey(""),
   m_par_HVKey(""),
   m_par_FSMStatusKey(""),
diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelDCSTestSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelDCSTestSvc.cxx
index 0a696e5651e..613d6b955bf 100644
--- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelDCSTestSvc.cxx
+++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelDCSTestSvc.cxx
@@ -16,6 +16,8 @@
 
 PixelDCSTestSvc::PixelDCSTestSvc(const std::string& name, ISvcLocator* pSvcLocator) :
   AthAlgorithm(name, pSvcLocator),
+  m_pixid(nullptr),
+  m_pixman(nullptr),
   m_pixelDCSSvc("PixelDCSSvc", name),
   m_pixelSvc("PixelConditionsSummarySvc", name)
 {
diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/SpecialPixelMapSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/SpecialPixelMapSvc.cxx
index 8ee28564bb2..ce822d3f14b 100755
--- a/InnerDetector/InDetConditions/PixelConditionsServices/src/SpecialPixelMapSvc.cxx
+++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/SpecialPixelMapSvc.cxx
@@ -993,7 +993,7 @@ StatusCode SpecialPixelMapSvc::createFromTextfiles( bool fillMissing ) const{
   std::map<unsigned int, unsigned int> moduleIDMap;
   std::vector<std::string> prodIDs;
   
-  CoralDB::CoralDB* db = new CoralDB::CoralDB(m_connectionString, coral::ReadOnly, coral::Info, true);
+   auto db = std::make_unique<CoralDB::CoralDB>(CoralDB::CoralDB(m_connectionString, coral::ReadOnly, coral::Info, true)); 
    if(!isIBL){
 
      db->setObjectDictionaryTag("PIXEL");
@@ -1086,7 +1086,18 @@ StatusCode SpecialPixelMapSvc::createFromTextfiles( bool fillMissing ) const{
       else{ // IBL
 	//
 	offset = filename.find("[");
-	std::istringstream ss(filename.substr(offset,20));
+        if(offset==std::string::npos){
+            ATH_MSG_ERROR( "Cound not find the token '['" );
+            return StatusCode::FAILURE;
+        }
+        std::string tmpstr;
+        try {
+          tmpstr = filename.substr(offset,20);
+        }
+        catch(std::exception &ex) {
+          ATH_MSG_ERROR( "Cound not get string, exception caught: " << ex.what() );
+        }
+	std::istringstream ss(tmpstr);
 	char c;
 	int system,subsystem,component, eta;
 	unsigned int layer,phi;
@@ -1151,8 +1162,6 @@ StatusCode SpecialPixelMapSvc::createFromTextfiles( bool fillMissing ) const{
     return StatusCode::FAILURE;
   }
   
-  delete db;
-
   return StatusCode::SUCCESS;
 }
 
diff --git a/InnerDetector/InDetConditions/PixelCoralClientUtils/src/CoralClient.cc b/InnerDetector/InDetConditions/PixelCoralClientUtils/src/CoralClient.cc
index df8bae3d1ab..cb19d1873aa 100644
--- a/InnerDetector/InDetConditions/PixelCoralClientUtils/src/CoralClient.cc
+++ b/InnerDetector/InDetConditions/PixelCoralClientUtils/src/CoralClient.cc
@@ -144,7 +144,13 @@ void PixCoralClient::connect() {
 */
 PixCoralClient::~PixCoralClient() {
   disconnect();
-  m_connectionService->purgeConnectionPool();
+  try {
+    m_connectionService->purgeConnectionPool();
+  }
+  catch (coral::Exception & ex) {
+    std::cout << "INFO [PixCoralClient::~PixCoralClien] Exception caught in purging connection pool. " <<std::endl;
+    std::cout << ex.what() <<std::endl;
+  }
 }
 
 
@@ -747,7 +753,7 @@ void PixCoralClient::createTable(){
       std::cout << "\nCOOLCORAL Client:  Creating table: " << PIXEL_TABLE_DATA <<" for ";
       try {
 	std::cout <<tableTypeName<T>() << std::endl;
-      } catch (coral::AttributeListException) {
+      } catch (const coral::AttributeListException&) {
 	std::cout <<typeid(T).name() << std::endl;
       }
     }
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_Chip.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_Chip.cxx
index b8f9735c0c6..f91d15ca219 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_Chip.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_Chip.cxx
@@ -57,7 +57,7 @@ bool SCT_Chip::initializeMaskFromString(const std::string &maskString){
                  >> std::hex >> subWords[nSubwords-2] 
                  >> std::hex >> subWords[nSubwords-3] 
                  >> std::hex >> subWords[nSubwords-4];
-  } catch(std::ios_base::failure) {
+  } catch(const std::ios_base::failure&) {
     std::cerr << "The SCT_ChipMask code has failed to convert the received string to a mask; the received string is: ";
     std::cerr << maskString << std::endl;
     successfulInitialization = false;
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibChipDataSvc.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibChipDataSvc.cxx
index 167eb9b6175..e588ea4aa2d 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibChipDataSvc.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibChipDataSvc.cxx
@@ -209,7 +209,7 @@ SCT_ReadCalibChipDataSvc::getNPtGainData(const Identifier& moduleId, const int s
     //see: http://stackoverflow.com/questions/235386/using-nan-in-c
     waferData.assign(it, end);
     return waferData;
-  } catch (std::out_of_range e) {
+  } catch (const std::out_of_range& e) {
     return waferData; 
   }
 } //SCT_ReadCalibChipDataSvc::getNPtGainData()
@@ -252,7 +252,7 @@ SCT_ReadCalibChipDataSvc::getNoiseOccupancyData(const Identifier& moduleId, cons
     if (*it != *it) return waferData;
     waferData.assign(it, end); 
     return waferData;
-  } catch (std::out_of_range e) {
+  } catch (const std::out_of_range& e) {
     return waferData; 
   }
 } // SCT_ReadCalibChipDataSvc::getNoiseOccupancyData()
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibChipUtilities.h b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibChipUtilities.h
index 26d99dc9837..d33bcbb7bc0 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibChipUtilities.h
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibChipUtilities.h
@@ -31,7 +31,7 @@ namespace SCT_ReadCalibChipUtilities {
     for (Tokenizer::iterator i{tok.begin()}; i!=end; ++i) {
       try {
         userContainer[j]=boost::lexical_cast<V_t>(*i);
-      } catch (boost::bad_lexical_cast) {
+      } catch (const boost::bad_lexical_cast&) {
         userContainer[j]=errVal;
         noNan=false;
       }
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataCondAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataCondAlg.cxx
index 4f686987bd0..c43989c0e46 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataCondAlg.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataCondAlg.cxx
@@ -34,7 +34,7 @@ namespace {
     for (Tokenizer::iterator i{tok.begin()}; i!=tok.end(); ++i) {
       try {
 	userContainer.push_back(boost::lexical_cast<V_t>(*i));
-      } catch (boost::bad_lexical_cast) {
+      } catch (const boost::bad_lexical_cast&) {
 	userContainer.push_back(errVal);
 	noNan=false;
       }
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_TdaqEnabledCondAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_TdaqEnabledCondAlg.cxx
index 7d821bbfae3..89f461200db 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_TdaqEnabledCondAlg.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_TdaqEnabledCondAlg.cxx
@@ -194,7 +194,7 @@ unsigned int SCT_TdaqEnabledCondAlg::parseChannelName(const std::string &chanNam
   iss.exceptions(std::ios_base::badbit|std::ios_base::failbit);
   try{
     iss>>std::hex>>result;
-  } catch (std::ios_base::failure){ //bad conversion to int
+  } catch (const std::ios_base::failure&){ //bad conversion to int
     std::cerr<<"Bad conversion of last 6 digits of "<<chanNameString<<" to a hex number"<<std::endl;
     throw(std::ios_base::failure("stringToInt failure in SCT_TdaqEnabledSvc"));
   } 
diff --git a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_CalDbSvc.cxx b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_CalDbSvc.cxx
index ea4066c16d5..08906238283 100644
--- a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_CalDbSvc.cxx
+++ b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_CalDbSvc.cxx
@@ -36,10 +36,6 @@ TRT_CalDbSvc::TRT_CalDbSvc( const std::string& name, ISvcLocator* pSvcLocator )
     m_streamer("AthenaPoolOutputStreamTool/CondStream1"),
     m_detstore("DetectorStore",name),
     m_condSvc("CondSvc",name),
-    m_rtReadKey("/TRT/Calib/RT"),
-    m_errReadKey("/TRT/Calib/errors2d"),
-    m_slopeReadKey("/TRT/Calib/slopes"),
-    m_t0ReadKey("/TRT/Calib/T0"),
     m_useCachedPtr(false)
 {
   declareProperty("StreamTool",m_streamer);
diff --git a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_CalDbSvc.h b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_CalDbSvc.h
index 17c1cbeb1b4..83c9103949e 100644
--- a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_CalDbSvc.h
+++ b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_CalDbSvc.h
@@ -143,10 +143,10 @@ class TRT_CalDbSvc: public AthService , virtual public ITRT_CalDbSvc
 
   ServiceHandle<ICondSvc> m_condSvc;
   //  ReadHandle  keys
-  SG::ReadCondHandleKey<RtRelationContainer> m_rtReadKey{this,"RtReadKeyName","in","r-t relation in-key"};
-  SG::ReadCondHandleKey<RtRelationContainer> m_errReadKey{this,"ErrorReadKeyName","in","error on r in-key"};
-  SG::ReadCondHandleKey<RtRelationContainer> m_slopeReadKey{this,"SlopeReadKeyName","in","slope of error in-key"};
-  SG::ReadCondHandleKey<StrawT0Container> m_t0ReadKey{this,"T0ReadKeyName","in","t0 in-key"};
+  SG::ReadCondHandleKey<RtRelationContainer> m_rtReadKey{this,"RtReadKeyName","/TRT/Calib/RT","r-t relation in-key"};
+  SG::ReadCondHandleKey<RtRelationContainer> m_errReadKey{this,"ErrorReadKeyName","/TRT/Calib/errors2d","error on r in-key"};
+  SG::ReadCondHandleKey<RtRelationContainer> m_slopeReadKey{this,"SlopeReadKeyName","/TRT/Calib/slopes","slope of error in-key"};
+  SG::ReadCondHandleKey<StrawT0Container> m_t0ReadKey{this,"T0ReadKeyName","/TRT/Calib/T0","t0 in-key"};
 
   bool m_useCachedPtr;  
   Gaudi::Hive::ContextSpecificPtr<RtRelationContainer> m_rtContainer;
diff --git a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_HWMappingSvc.cxx b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_HWMappingSvc.cxx
index c083e2590cd..6d97ce22ff0 100644
--- a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_HWMappingSvc.cxx
+++ b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_HWMappingSvc.cxx
@@ -415,6 +415,7 @@ StatusCode TRT_HWMappingSvc::build_BarrelHVLinePadMap() {
     TRTcoralClient->get_BarrelHVLinePadMap( rawMap );
     if ( rawMap.size() == 0 ) {
       msg(MSG::WARNING) << "Retrieved and empty Barrel HV-line/pad map from database." << endmsg;
+      delete TRTcoralClient;
       return StatusCode::FAILURE;
     }
 
@@ -460,7 +461,7 @@ StatusCode TRT_HWMappingSvc::build_BarrelHVLinePadMap() {
         m_Barrel_HV_CoolChanNames->at(hashedPad) = chanName;
       }
     }
-
+    delete TRTcoralClient;
 
   } else {
     std::map< std::string, std::vector<int> > fuseBoxPadMapEven;
diff --git a/InnerDetector/InDetCosmics/InDetCosmicsFilters/src/TrackFilter.cxx b/InnerDetector/InDetCosmics/InDetCosmicsFilters/src/TrackFilter.cxx
index 2f2c3b4ac8f..59edd44444c 100755
--- a/InnerDetector/InDetCosmics/InDetCosmicsFilters/src/TrackFilter.cxx
+++ b/InnerDetector/InDetCosmics/InDetCosmicsFilters/src/TrackFilter.cxx
@@ -113,10 +113,9 @@ StatusCode InDet::TrackFilter::execute()
         int ntrthits=0;
 	int npixhits=0;
 
-        for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsos=track->trackStateOnSurfaces()->begin();
-             tsos!=track->trackStateOnSurfaces()->end(); ++tsos) {
+        for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
           
-          const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>((*tsos)->measurementOnTrack());
+          const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
           
           if (hitOnTrack != 0) {
             const Identifier& surfaceID = hitOnTrack->identify();
diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiDetectorElement.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiDetectorElement.h
index d41920972d5..8bf282a7dbc 100755
--- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiDetectorElement.h
+++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiDetectorElement.h
@@ -128,10 +128,10 @@ namespace InDetDD {
       //@{
     
       /// identifier of this detector element:
-      virtual Identifier identify() const;
+      Identifier identify() const;
     
       /// identifier hash
-      virtual IdentifierHash identifyHash() const;
+      IdentifierHash identifyHash() const;
     
       /// Returns the id helper
       const AtlasDetectorID* getIdHelper() const;
diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/TRT_BaseElement.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/TRT_BaseElement.h
index 4f6c5a47792..c240c7ccbad 100755
--- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/TRT_BaseElement.h
+++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/TRT_BaseElement.h
@@ -63,10 +63,10 @@ namespace InDetDD {
     virtual TRT_BaseElement::Type type() const = 0; 
 
     /** identifier of this detector element: */
-    virtual Identifier identify() const;
+    Identifier identify() const;
 
     /** identifier hash */
-    virtual IdentifierHash identifyHash() const;
+    IdentifierHash identifyHash() const;
 
     // --- GeoModel transformation forwards ----------------------------------------------------- //
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatTool.cxx b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatTool.cxx
index 6e8bf422ba9..49af82ec4d0 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatTool.cxx
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatTool.cxx
@@ -214,7 +214,7 @@ StatusCode InDetServMatTool::create()
 	}
       }
 
-    } catch (std::bad_alloc) {
+    } catch (const std::bad_alloc&) {
 	msg(MSG::FATAL) << "Could not create new InDetServMatNode!" << endmsg;
       return StatusCode::FAILURE; 
     }
diff --git a/InnerDetector/InDetDetDescr/PixelCabling/src/PixelCablingSvc.cxx b/InnerDetector/InDetDetDescr/PixelCabling/src/PixelCablingSvc.cxx
index 43ad20ca862..603861484ee 100644
--- a/InnerDetector/InDetDetDescr/PixelCabling/src/PixelCablingSvc.cxx
+++ b/InnerDetector/InDetDetDescr/PixelCabling/src/PixelCablingSvc.cxx
@@ -8,6 +8,7 @@
 #include <iostream>
 #include <fstream>
 #include <sstream>
+#include <exception>
 
 #include "GaudiKernel/ServiceHandle.h"
 #include "StoreGate/StoreGateSvc.h"
@@ -530,7 +531,7 @@ Identifier PixelCablingSvc::getPixelId(Identifier offlineId, uint32_t FE, uint32
         column_row_offset = -1;
         eta_module = m_idHelper->eta_module(offlineId) + m_eta_module_offset;
         if (eta_module >= m_layer_FEsPerHalfModule[0].size()) {
-            msg(MSG::WARNING) << "getPixelId: Eta_module out of range (eta_module = " << eta_module
+            msg(MSG::ERROR) << "getPixelId: Eta_module out of range (eta_module = " << eta_module
                               << ", expected number of modules per stave = " << m_layer_FEsPerHalfModule[0].size() << ")" << endmsg;
             return Identifier();
         }
@@ -607,8 +608,8 @@ Identifier PixelCablingSvc::getPixelId(Identifier offlineId, uint32_t FE, uint32
 #ifdef PIXEL_DEBUG
     unsigned int eta_index_max =  m_idHelper->eta_index_max(offlineId);
     unsigned int phi_index_max =  m_idHelper->phi_index_max(offlineId);
-    if (eta_index > eta_index_max) msg(MSG::WARNING) << "Error! eta_index: " << eta_index << " > eta_index_max: " << eta_index_max << endmsg;
-    if (phi_index > phi_index_max) msg(MSG::WARNING) << "Error! phi_index: " << phi_index << " > phi_index_max: " << phi_index_max << endmsg;
+    if (eta_index > eta_index_max) msg(MSG::ERROR) << "Error! eta_index: " << eta_index << " > eta_index_max: " << eta_index_max << endmsg;
+    if (phi_index > phi_index_max) msg(MSG::ERROR) << "Error! phi_index: " << phi_index << " > phi_index_max: " << phi_index_max << endmsg;
     //consistency check - to be removed to speed up
     uint32_t check_FE = getFE(&pixelId,offlineId);
     uint32_t check_row = getRow(&pixelId,offlineId) + column_row_offset;
@@ -668,7 +669,7 @@ uint32_t PixelCablingSvc::getFE(Identifier *pixelId, Identifier offlineId)
     case IBL:
         eta_module = m_idHelper->eta_module(offlineId) + m_eta_module_offset; //offset by 10 to start counting from 0
         if (eta_module >= m_layer_FEsPerHalfModule[0].size()) {
-            msg(MSG::WARNING) << "getFE: Eta_module out of range (eta_module = " << eta_module
+            msg(MSG::ERROR) << "getFE: Eta_module out of range (eta_module = " << eta_module
                               << ", expected number of modules per stave = " << m_layer_FEsPerHalfModule[0].size() << ")" << endmsg;
             return 0xffffffff;
         }
@@ -741,7 +742,7 @@ uint32_t PixelCablingSvc::getColumn(Identifier *pixelId, Identifier offlineId)
         column_offset = 1;
         eta_module = m_idHelper->eta_module(offlineId) + m_eta_module_offset; //offset by 10 to start counting from 0
         if (eta_module >= m_layer_FEsPerHalfModule[0].size()) {
-            msg(MSG::WARNING) << "getColumn: Eta_module out of range (eta_module = " << eta_module
+            msg(MSG::ERROR) << "getColumn: Eta_module out of range (eta_module = " << eta_module
                               << ", expected number of modules per stave = " << m_layer_FEsPerHalfModule[0].size() << ")" << endmsg;
             return 0xffffffff;
         }
@@ -779,7 +780,7 @@ uint32_t PixelCablingSvc::getColumn(Identifier *pixelId, Identifier offlineId)
     // Check output sanity
     // ---------------------
     if (column >= (int)columnsPerFE) {
-        msg(MSG::WARNING) << "Computed column number exceeds maximum value: col = " << column + column_offset
+        msg(MSG::ERROR) << "Computed column number exceeds maximum value: col = " << column + column_offset
                           << " (max = " << columnsPerFE << ")" <<  endmsg;
         return 0xffffffff;
     }
@@ -827,7 +828,7 @@ uint32_t PixelCablingSvc::getRow(Identifier *pixelId, Identifier offlineId)
         row_offset = 1;
         eta_module = m_idHelper->eta_module(offlineId) + m_eta_module_offset; //offset by 10 to start counting from 0
         if (eta_module >= m_layer_FEsPerHalfModule[0].size()) {
-            msg(MSG::WARNING) << "getRow: Eta_module out of range (eta_module = " << eta_module
+            msg(MSG::ERROR) << "getRow: Eta_module out of range (eta_module = " << eta_module
                               << ", expected number of modules per stave = " << m_layer_FEsPerHalfModule[0].size() << ")" << endmsg;
             return 0xffffffff;
         }
@@ -869,7 +870,7 @@ uint32_t PixelCablingSvc::getRow(Identifier *pixelId, Identifier offlineId)
     // Check output sanity
     // ---------------------
     if (row >= (int)rowsPerFE) {
-        msg(MSG::WARNING) << "Computed row number exceeds maximum value: row = " << row + row_offset
+        msg(MSG::ERROR) << "Computed row number exceeds maximum value: row = " << row + row_offset
                           << "(max = " << rowsPerFE << ")" << endmsg;
         return 0xffffffff;
     }
@@ -895,10 +896,16 @@ uint32_t PixelCablingSvc::getFEwrtSlink(Identifier *pixelId) {
     uint32_t linkNum = (onlineId >> 24) & 0xFFFF;
     unsigned int localFE = getFE(pixelId, offlineId);   // FE number within module, [0,1]. Increases with increasing eta_index
 
-    nnn = (linkNum >> (localFE * 8)) & 0xF;
+    if(localFE>1) {
+      msg(MSG::FATAL) << "Unexpected FE: "<<localFE<<"  PixelCablingSvc::getFEwrtSlink() "<< endmsg;
+      throw std::runtime_error( "Unexpected FE" );
+    }
+    else {
+      nnn = (linkNum >> (localFE * 8)) & 0xF;
+    }
 
     // Check for errors
-    if (nnn > 7) msg(MSG::WARNING) << "Error in the identification of the FE-I4 w.r.t. Slink" << endmsg;
+    if (nnn > 7) msg(MSG::ERROR) << "Error in the identification of the FE-I4 w.r.t. Slink" << endmsg;
 
     return nnn;
 }
@@ -1122,7 +1129,7 @@ unsigned int PixelCablingSvc::getLocalFEI4(const uint32_t fe, const uint64_t onl
 
     if (fe == linknum40) return 0;
     else if (fe == linknum80) return 1;
-    else msg(MSG::WARNING) << "Error in retrieving local FE-I4 number: linknumber " << fe
+    else msg(MSG::ERROR) << "Error in retrieving local FE-I4 number: linknumber " << fe
                            << " not found in onlineID " << std::hex << onlineId << endmsg;
     return 0xF;
 }
@@ -1188,6 +1195,12 @@ int PixelCablingSvc::getHitDiscCnfg(const uint32_t robId, const int link) {
 int PixelCablingSvc::getHitDiscCnfg(Identifier* pixelId) {
 
     uint32_t robId = getRobId(m_idHelper->wafer_id(*pixelId));
-    int link = getFEwrtSlink(pixelId);
+    int link = -999;
+    try {
+        link = getFEwrtSlink(pixelId);
+    }
+    catch(std::exception& ex) {
+        msg(MSG::FATAL) << "Exception caught in PixelCablingSvc::getFEwrtSlink(): "<<ex.what() << endmsg;
+    }
     return getHitDiscCnfg(robId, link);
 }
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingUtilities.cxx b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingUtilities.cxx
index 125ed538992..d885b1931a2 100644
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingUtilities.cxx
+++ b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingUtilities.cxx
@@ -29,7 +29,7 @@ namespace SCT_Cabling{
         } else {
           istrm>>std::dec>>result;
         }
-      } catch (std::ios_base::failure){ //bad conversion to int
+      } catch (const std::ios_base::failure&){ //bad conversion to int
         result=-1;
         //need to throw here
         std::cerr<<"stringToInt failed to convert a string to an integer in InDetCabling/SCT_CablingUtilities"<<std::endl;
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.cxx b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.cxx
index f17b106e753..72042784db6 100644
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.cxx
+++ b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.cxx
@@ -165,7 +165,7 @@ SCT_FillCablingFromText::readDataFromFile(SCT_CablingSvc * cabling){
         dataLine>>rod>>Link>>barrelOrEndcap>>layer>>eta>>phi>>side>>std::hex>>robidFromfile>>std::dec>>sn ;
         offlineId = idHelper->wafer_id(barrelOrEndcap,layer,phi,eta,side) ;
         offlineIdHash = idHelper->wafer_hash(offlineId);       
-      }catch(std::ios_base::failure){
+      }catch(const std::ios_base::failure&){
         msg(MSG::FATAL)<<"An error occurred while reading the cabling file "<<m_source
         <<", it may be badly formatted in the following line: \n"<<inString<<endmsg;
         //shall we continue or fail? continue... to see whether there are more errors
diff --git a/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx b/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx
index e303eeab42c..7e4509a720b 100644
--- a/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx
@@ -74,7 +74,7 @@ StatusCode BCM_DigitizationTool::createOutputContainers()
   // Create output RDO container and record it to StoreGate
   try {
     m_rdoContainer = new BCM_RDO_Container();
-  } catch (std::bad_alloc) {
+  } catch (const std::bad_alloc&) {
     ATH_MSG_FATAL ( "Could not create a new BCM RawDataContainer!" );
     return StatusCode::FAILURE;
   }
diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx
index 1c298c0e40f..a6010757b18 100644
--- a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx
@@ -232,7 +232,7 @@ StatusCode PixelDigitizationTool::digitizeEvent() {
     CHECK(m_rdoContainer->addCollection(RDOColl,RDOColl->identifyHash()));
 
     ATH_MSG_DEBUG("Pixel RDOs '" << RDOColl->identifyHash() << "' added to container");
-    addSDO(chargedDiodes);
+    addSDO(chargedDiodes.get());
     chargedDiodes->clear();
   }
   delete m_timedHits;
@@ -266,7 +266,7 @@ StatusCode PixelDigitizationTool::digitizeEvent() {
           CHECK(m_rdoContainer->addCollection(RDOColl,RDOColl->identifyHash()));
 
           ATH_MSG_DEBUG("Pixel RDOs '" << RDOColl->identifyHash() << "' added to container");
-          addSDO(chargedDiodes);
+          addSDO(chargedDiodes.get());
           chargedDiodes->clear();
         }
       }
@@ -282,7 +282,7 @@ StatusCode PixelDigitizationTool::digitizeEvent() {
 //=======================================
 // Convert a SiTotalCharge to a InDetSimData, and store it. (this needs working...)
 //-----------------------------------------------------------------------------------------------
-void PixelDigitizationTool::addSDO(std::unique_ptr<SiChargedDiodeCollection>& collection) {
+void PixelDigitizationTool::addSDO(SiChargedDiodeCollection* collection) {
 
   typedef SiTotalCharge::list_t list_t;
 
diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.h
index ba15e1d5d9b..7f9acea0df4 100644
--- a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.h
+++ b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.h
@@ -44,7 +44,7 @@ class PixelDigitizationTool : public PileUpToolBase {
     virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final;
 
   protected:
-    void addSDO(std::unique_ptr<SiChargedDiodeCollection>& collection);
+    void addSDO(SiChargedDiodeCollection *collection);
 
   private:
 
diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx
index 2d65578f251..86b15bf444c 100644
--- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx
@@ -660,7 +660,7 @@ SCT_RDO_Collection* SCT_DigitizationTool::createRDO(SiChargedDiodeCollection* co
   IdentifierHash idHash_de{collection->identifyHash()};
   try {
     p_rdocoll = new SCT_RDO_Collection(idHash_de);
-  } catch (std::bad_alloc) {
+  } catch (const std::bad_alloc&) {
     ATH_MSG_FATAL("Could not create a new SCT_RDORawDataCollection !");
   }
   p_rdocoll->setIdentifier(id_de);
diff --git a/InnerDetector/InDetDigitization/SiDigitization/SiDigitization/SiChargedDiodeCollection.h b/InnerDetector/InDetDigitization/SiDigitization/SiDigitization/SiChargedDiodeCollection.h
index 16391dc7037..1da634de1c2 100755
--- a/InnerDetector/InDetDigitization/SiDigitization/SiDigitization/SiChargedDiodeCollection.h
+++ b/InnerDetector/InDetDigitization/SiDigitization/SiDigitization/SiChargedDiodeCollection.h
@@ -88,8 +88,8 @@ class SiChargedDiodeCollection : Identifiable {
   const InDetDD::SiDetectorElement * element() const;
 
   // wafer identifier for this collection
-  virtual Identifier identify() const;
-  virtual IdentifierHash identifyHash() const;
+  virtual Identifier identify() const override final;
+  virtual IdentifierHash identifyHash() const override final;
 
   // id helper for this collection
   const AtlasDetectorID* id_helper();
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.cxx
index 69c02bfe689..8d999c867eb 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.cxx
@@ -6,7 +6,7 @@
 #include "TRTDigSettings.h"
 
 #include <cmath>
-#include <cstdlib> //Always include this when including cmath!
+#include <cstdlib>
 
 #include "InDetReadoutGeometry/TRT_DetElementCollection.h"
 #include "InDetReadoutGeometry/TRT_DetectorManager.h"
@@ -27,7 +27,7 @@ TRTDigCondBase::TRTDigCondBase( const TRTDigSettings* digset,
 				const InDetDD::TRT_DetectorManager* detmgr,
 				const TRT_ID* trt_id,
 				int UseGasMix,
-				ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc // added by Sasha for Argon
+				ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc
 			      )
   : m_settings(digset), m_detmgr(detmgr), m_id_helper(trt_id),
     m_averageNoiseLevel(-1.0),
@@ -51,7 +51,7 @@ float TRTDigCondBase::strawAverageNoiseLevel() const {
   } else {
     std::map<int,StrawState>::const_iterator it(m_hitid_to_StrawState.begin());
     m_averageNoiseLevel = 0.;
-    double tmp(0.);//we want double precision for this
+    double tmp(0.);
     for ( ; it!=m_it_hitid_to_StrawState_End; ++it ) {
       tmp += it->second.noiselevel;
     };
@@ -80,7 +80,7 @@ void TRTDigCondBase::initialize() {
 
   for (;it!=itE;++it) { // loop over straws
 
-    const double strawLength((*it)->strawLength()); //Not used until much later..
+    const double strawLength((*it)->strawLength());
     const Identifier id((*it)->identify());
 
     const int ringwheel(m_id_helper->layer_or_wheel(id));
@@ -104,7 +104,6 @@ void TRTDigCondBase::initialize() {
 
       // get ID of the straw, and the gas mix
       const int hitid(hitid_helper->buildHitId( endcap, isneg, ringwheel, phisector, layer, iStraw));
-      //Identifier strawId = m_id_helper->straw_id(m_id_helper->barrel_ec(id), phisector, ringwheel, layer, iStraw);
       Identifier strawId = m_id_helper->straw_id(side, phisector, ringwheel, layer, iStraw);
       int strawGasType = StrawGasType(strawId);
 
@@ -121,7 +120,6 @@ void TRTDigCondBase::initialize() {
       ++strawcount;
 
       // Count the gas fraction in a number of regions:
-      // std::cout << "AJB  side=" << side << " ringwheel=" << ringwheel << " phisector=" << phisector << " layer=" << layer << " iStraw=" << iStraw << " strawGasType=" << strawGasType << std::endl;
       if ( side==+1 && ringwheel>=0 && ringwheel<=2  ) nBAA[ringwheel][strawGasType]++; // [ringwheel=0,1,2][strawGasType=0,1,2]
       if ( side==-1 && ringwheel>=0 && ringwheel<=2  ) nBAC[ringwheel][strawGasType]++; // [ringwheel=0,1,2][strawGasType=0,1,2]
       if ( side==+2 && ringwheel>=0 && ringwheel<=13 ) nECA[ringwheel][strawGasType]++; // [ringwheel=0, 13][strawGasType=0,1,2]
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.h
index 4694fc0b55c..29f0d1cede3 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.h
@@ -33,7 +33,7 @@ public:
 		  const InDetDD::TRT_DetectorManager*,
 		  const TRT_ID*,
 		  int UseGasMix,
-		  ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc // added by Sasha for Argon
+		  ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc
 		);
 
   /** Destructor */
@@ -79,12 +79,8 @@ public:
 
 
   //Crosstalk noise
-  bool crossTalkNoise( CLHEP::HepRandomEngine* ); 
+  bool crossTalkNoise( CLHEP::HepRandomEngine* );
   bool crossTalkNoiseOtherEnd( CLHEP::HepRandomEngine* );
-  //FIXME - These two variables are defined but not used anywhere??
-  //double m_crosstalkNoiseLevel;               /**< Average cross talk noise level */
-  //double m_crosstalkNoiseLevelOtherEnd;       /**< Average cross talk noise level - other end*/
-
 
   //--- For looping over all straws (only to be used at initialization):
 
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondFakeMap.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondFakeMap.cxx
index 5d3bfb048ef..c2b87336b0b 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondFakeMap.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondFakeMap.cxx
@@ -17,7 +17,7 @@
 #include "InDetIdentifier/TRT_ID.h"
 
 #include <cmath>
-#include <cstdlib> //Always include this when including cmath!
+#include <cstdlib>
 
 //________________________________________________________________________________
 TRTDigCondFakeMap::TRTDigCondFakeMap( const TRTDigSettings* digset,
@@ -25,7 +25,7 @@ TRTDigCondFakeMap::TRTDigCondFakeMap( const TRTDigSettings* digset,
 				      ServiceHandle <IAtRndmGenSvc> atRndmGenSvc,
 				      const TRT_ID* trt_id,
 				      int UseGasMix,
-				      ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc // added by Sasha for Argon
+				      ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc
 				    )
   : TRTDigCondBase(digset, detmgr, trt_id, UseGasMix, sumSvc)
 {
@@ -42,9 +42,9 @@ void TRTDigCondFakeMap::setStrawStateInfo(Identifier& TRT_Identifier,
 
   noiselevel = m_average_noiselevel; // Not used here, but returned to caller
 
-  const double relfluct(0.05); // Hard coded! FIXME
-  double                      relnoiseamp = CLHEP::RandGaussZiggurat::shoot(m_pHRengine, 1.0, relfluct );
-  while (relnoiseamp < 0.1) { relnoiseamp = CLHEP::RandGaussZiggurat::shoot(m_pHRengine, 1.0, relfluct ); }
+  // 5% relative fluctuation is hard-coded here
+  double                       relnoiseamp = CLHEP::RandGaussZiggurat::shoot(m_pHRengine, 1.00, 0.05 );
+  while (relnoiseamp < 0.10) { relnoiseamp = CLHEP::RandGaussZiggurat::shoot(m_pHRengine, 1.00, 0.05 ); }
 
   // Anatoli says we need to scale the noise amplitude of Kr,Ar according to LT_(Kr,Ar)/LT_Xe
   int strawGasType = StrawGasType(TRT_Identifier);
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondFakeMap.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondFakeMap.h
index 87a550b15fd..0d19bb7764a 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondFakeMap.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondFakeMap.h
@@ -22,12 +22,11 @@ public:
 		     ServiceHandle <IAtRndmGenSvc> atRndmGenSvc,
 		     const TRT_ID* trt_id,
 		     int UseGasMix,
-		     ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc // added by Sasha for Argon
+		     ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc
  		   );
 
 protected:
 
-  /// Sasha: first argument was changed: "const unsigned int& hitid" -> "Identifier& TRT_Identifier"
   void setStrawStateInfo(Identifier& TRT_Identifier,
 			  const double& strawlength,
 			  double& noiselevel,
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
index 99b335ed187..3833fcd7d40 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
@@ -63,17 +63,17 @@ void TRTDigSettings::defineVariables() {
   //The ranges of allowed values are pretty wide. If parameters are outside we will assume something is wrong.
 
   //doubles:
-  defineNewVariable("ionisationPotential",&m_ionisationPotential,"Ionisation potential","eV",CLHEP::eV,1.0,50.0);
-  defineNewVariable("ionisationPotentialArgon",&m_ionisationPotentialArgon,"Ionisation potential Argon","eV",CLHEP::eV,1.0,50.0);
+  defineNewVariable("ionisationPotential",       &m_ionisationPotential,       "Ionisation potential",        "eV",CLHEP::eV,1.0,50.0);
+  defineNewVariable("ionisationPotentialArgon",  &m_ionisationPotentialArgon,  "Ionisation potential Argon",  "eV",CLHEP::eV,1.0,50.0);
   defineNewVariable("ionisationPotentialKrypton",&m_ionisationPotentialKrypton,"Ionisation potential Krypton","eV",CLHEP::eV,1.0,50.0);
-  defineNewVariable("smearingFactor",&m_smearingFactor,"Cluster energy smearing factor","",1,0.1,1.0);
-  defineNewVariable("smearingFactorArgon",&m_smearingFactorArgon,"Cluster energy smearing factor Argon","",1,0.1,1.0);
-  defineNewVariable("smearingFactorKrypton",&m_smearingFactorKrypton,"Cluster energy smearing factor Krypton","",1,0.1,1.0);
-  defineNewVariable("timeInterval",&m_timeInterval,"Time interval covered by each digit","ns",CLHEP::ns,1,200);
-  defineNewVariable("minDiscriminatorWidth",&m_minDiscriminatorWidth,"Minimum discriminator time over threshold","ns",CLHEP::ns,0.5,20.0);
-  defineNewVariable("discriminatorSettlingTime",&m_discriminatorSettlingTime,"Discriminator settling time","ns",CLHEP::ns,0.5,20.0);
-  defineNewVariable("discriminatorDeadTime",&m_discriminatorDeadTime,"Discriminator dead time","ns",CLHEP::ns,0.5,20.0);
-  defineNewVariable("TrtRangeCutProperty",&m_trtRangeCutProperty,"Electrons range cut in TRT xenon simulation","mm",CLHEP::mm,0.05,30.00);
+  defineNewVariable("smearingFactor",            &m_smearingFactor,            "Cluster energy smearing factor","",        1,0.1,1.0);
+  defineNewVariable("smearingFactorArgon",       &m_smearingFactorArgon,       "Cluster energy smearing factor Argon","",  1,0.1,1.0);
+  defineNewVariable("smearingFactorKrypton",     &m_smearingFactorKrypton,     "Cluster energy smearing factor Krypton","",1,0.1,1.0);
+  defineNewVariable("timeInterval",              &m_timeInterval,              "Time interval covered by each digit","ns",CLHEP::ns,1,200);
+  defineNewVariable("minDiscriminatorWidth",     &m_minDiscriminatorWidth,     "Minimum discriminator time over threshold","ns",CLHEP::ns,0.5,20.0);
+  defineNewVariable("discriminatorSettlingTime", &m_discriminatorSettlingTime, "Discriminator settling time",              "ns",CLHEP::ns,0.5,20.0);
+  defineNewVariable("discriminatorDeadTime",     &m_discriminatorDeadTime,     "Discriminator dead time",                  "ns",CLHEP::ns,0.5,20.0);
+  defineNewVariable("TrtRangeCutProperty",       &m_trtRangeCutProperty,       "Electrons range cut in TRT xenon simulation","mm",CLHEP::mm,0.05,30.00);
 
   // LT Bar
   defineNewVariable("lowThresholdBar",       &m_lowThresholdBar,       "Low Threshold Barrel",         "eV",CLHEP::eV,50.0,500.0);
@@ -103,7 +103,6 @@ void TRTDigSettings::defineVariables() {
   defineNewVariable("strawLengthBarrel",&m_strawLengthBarrel,"Long barrel straw length","mm",CLHEP::mm,1400.0,1450.0); // 1425.5
   defineNewVariable("innerRadiusEndcap",&m_innerRadiusEndcap,"Inner radius of the endcap straws","mm",CLHEP::mm,600.0,640.0); // 621.18
   defineNewVariable("outerRadiusEndcap",&m_outerRadiusEndcap,"Outer radius of the endcap straws","mm",CLHEP::mm,1060.0,1070.0); // 1067
-
   defineNewVariable("innerRadiusOfStraw",&m_innerRadiusOfStraw,"Inner radius of straw","mm",CLHEP::mm,1.0,3.0); // 2.0 mm
   defineNewVariable("outerRadiusOfWire",&m_outerRadiusOfWire,"Outer radius of wire","micrometer",CLHEP::micrometer,5.0,40.0); // 0.0155 mm
   defineNewVariable("lengthOfDeadRegion",&m_lengthOfDeadRegion,"Length of dead region at straw ends","mm",CLHEP::mm,1.0,3.0);
@@ -159,10 +158,12 @@ void TRTDigSettings::defineVariables() {
   defineNewBoolVariable("isOverlay",&m_isOverlay,"Flag set for overlay jobs");
 
   //ints:
-  defineNewIntVariable("htT0shiftBarShort", &m_htT0shiftBarShort, "HT T0 shift in 0.78125 ns steps, short barrel straws",-32,32);
-  defineNewIntVariable("htT0shiftBarLong",  &m_htT0shiftBarLong,  "HT T0 shift in 0.78125 ns steps, long barrel straws", -32,32);
-  defineNewIntVariable("htT0shiftECAwheels",&m_htT0shiftECAwheels,"HT T0 shift in 0.78125 ns steps, A type wheels",      -32,32);
-  defineNewIntVariable("htT0shiftECBwheels",&m_htT0shiftECBwheels,"HT T0 shift in 0.78125 ns steps, B type wheels",      -32,32);
+
+  // Time shifts
+  defineNewIntVariable("htT0shiftBarShort",   &m_htT0shiftBarShort,   "HT T0 shift in 0.78125 ns steps, short barrel straws",-32,32);
+  defineNewIntVariable("htT0shiftBarLong",    &m_htT0shiftBarLong,    "HT T0 shift in 0.78125 ns steps, long barrel straws", -32,32);
+  defineNewIntVariable("htT0shiftECAwheels",  &m_htT0shiftECAwheels,  "HT T0 shift in 0.78125 ns steps, A type wheels",      -32,32);
+  defineNewIntVariable("htT0shiftECBwheels",  &m_htT0shiftECBwheels,  "HT T0 shift in 0.78125 ns steps, B type wheels",      -32,32);
 
   defineNewIntVariable("ltT0shiftBarShortXe", &m_ltT0shiftBarShortXe, "LT T0 shift in 0.78125 ns steps, short barrel straws, Xe",-32,32);
   defineNewIntVariable("ltT0shiftBarShortKr", &m_ltT0shiftBarShortKr, "LT T0 shift in 0.78125 ns steps, short barrel straws, Kr",-32,32);
@@ -186,13 +187,11 @@ void TRTDigSettings::defineVariables() {
 void TRTDigSettings::print(const std::string& front) const {
 
   std::cout << front << "======= Printing TRT Digitization Settings ======="<<std::endl;
-  //std::cout << front <<std::endl;
 
   std::map <std::string,doubleparameter>::const_iterator itd = m_doubleparMap.begin();
   std::map <std::string,doubleparameter>::const_iterator itdE = m_doubleparMap.end();
 
   for (;itd!=itdE;++itd) {
-    //std::cout << front << std::endl;
     std::cout << front << itd->second.description<<": "<<(*(itd->second.directvaraddress))/itd->second.unit<<" "<<itd->second.unitname <<std::endl;
   };
 
@@ -200,7 +199,6 @@ void TRTDigSettings::print(const std::string& front) const {
   std::map <std::string,intboolparameter>::const_iterator itibE = m_intboolparMap.end();
 
   for (;itib!=itibE;++itib) {
-    //std::cout << front << std::endl;
     if (itib->second.directvaraddress_int) {
       //int
       std::cout << front << itib->second.description<<": "<<*(itib->second.directvaraddress_int)<<std::endl;
@@ -214,7 +212,6 @@ void TRTDigSettings::print(const std::string& front) const {
     }
   }
 
-  //std::cout << front <<std::endl;
   std::cout << front << "==============================================="<<std::endl;
 
   return;
@@ -519,10 +516,10 @@ void TRTDigSettings::fillDefaults(const InDetDD::TRT_DetectorManager* detmgr) {
   m_outerRadiusOfWire  = 0.0155*CLHEP::mm;
   m_lengthOfDeadRegion =    3.0*CLHEP::mm;
   m_attenuationLength  =   400.*CLHEP::cm;
-  m_maxVertexDisplacement = 0.0;           // units!?
-  m_timeOffsetCalcVertexX = 0.0*CLHEP::cm; // units!?
-  m_timeOffsetCalcVertexY = 0.0*CLHEP::cm; // units!?
-  m_timeOffsetCalcVertexZ = 0.0*CLHEP::cm; // units!?
+  m_maxVertexDisplacement = 0.0;
+  m_timeOffsetCalcVertexX = 0.0*CLHEP::cm;
+  m_timeOffsetCalcVertexY = 0.0*CLHEP::cm;
+  m_timeOffsetCalcVertexZ = 0.0*CLHEP::cm;
 
   // (Xenon)
   // HT fine-tune on 2011 data tagged as 00-11-07
@@ -591,12 +588,11 @@ void TRTDigSettings::fillDefaults(const InDetDD::TRT_DetectorManager* detmgr) {
   m_relativeHighThresholdFluctuation = 0.05;
 
   // Clusters
-  // Note: smearingFactor is a possible candidate for tuning drift time accuracy
   m_smearingFactor        = 0.4;
   m_smearingFactorArgon   = 0.4;
   m_smearingFactorKrypton = 0.4;
   m_ionisationPotential        = 26.0*CLHEP::eV;
-  m_ionisationPotentialArgon   = 28.3*CLHEP::eV; // according to thesis of Peter Cwetanski (TABLE 4-I)
+  m_ionisationPotentialArgon   = 28.3*CLHEP::eV;
   m_ionisationPotentialKrypton = 28.3*CLHEP::eV;
 
 }
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitization.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitization.cxx
index 2d16b40bd64..c262428b64b 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitization.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitization.cxx
@@ -25,18 +25,14 @@ StatusCode TRTDigitization::initialize() {
     return StatusCode::FAILURE;
   }
   ATH_MSG_DEBUG ( "Retrieved TRT Digitization Tool." );
-
   return StatusCode::SUCCESS;
 }
 
 //----------------------------------------------------------------------
 // Execute method:
 //----------------------------------------------------------------------
-
 StatusCode TRTDigitization::execute() {
-
   ATH_MSG_DEBUG ( "execute()" );
-
   return m_digTool->processAllSubEvents();
 }
 
@@ -44,8 +40,6 @@ StatusCode TRTDigitization::execute() {
 // Finalize method:                                                     //
 //----------------------------------------------------------------------//
 StatusCode TRTDigitization::finalize() {
-  
   ATH_MSG_DEBUG ( "finalize()" );
-
   return StatusCode::SUCCESS;
 }
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx
index ef897e85af4..16901a30ab9 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx
@@ -13,7 +13,7 @@
 
 #include "TRTDigitizationTool.h"
 #include "HitManagement/TimedHitCollection.h"
-#include "InDetSimEvent/TRTUncompressedHitCollection.h"//hide?
+#include "InDetSimEvent/TRTUncompressedHitCollection.h"
 #include "TRTProcessingOfStraw.h"
 #include "TRTElectronicsProcessing.h"
 
@@ -69,10 +69,8 @@ static constexpr unsigned int crazyParticleBarcode(std::numeric_limits<int32_t>:
 
 #include "CLHEP/Random/RandGaussZiggurat.h"
 
-
 #include "StoreGate/WriteHandleKey.h"
-//AJB Temporary for debugging and development
-//#include "driftCircle.h"
+//#include "driftCircle.h" // local copy for debugging and development
 
 //_____________________________________________________________________________
 TRTDigitizationTool::TRTDigitizationTool(const std::string& type,
@@ -105,10 +103,9 @@ TRTDigitizationTool::TRTDigitizationTool(const std::string& type,
     m_condDBdigverfoldersexists(false),
     m_HardScatterSplittingMode(0),
     m_HardScatterSplittingSkipper(false),
-    m_UseGasMix(0),                  // postInclude UseGasMix for the whole detector: 0="default:use statusHT", 1="use Xe", 2="use Kr", 3="use Ar"
+    m_UseGasMix(0),
     m_cosmicEventPhase(0.0),
-    m_particleFlag(0),
-    m_sumSvc("TRT_StrawStatusSummarySvc","TRT_StrawStatusSummarySvc") // added by Sasha for Argon
+    m_sumSvc("TRT_StrawStatusSummarySvc","TRT_StrawStatusSummarySvc")
 
 {
 
@@ -125,7 +122,7 @@ TRTDigitizationTool::TRTDigitizationTool(const std::string& type,
   m_settings->addPropertiesForOverrideableParameters(static_cast<AlgTool*>(this));
   declareProperty("RndmSvc",                       m_atRndmGenSvc, "Random Number Service used in TRT digitization" );
   declareProperty("TRT_StrawNeighbourSvc",         m_TRTStrawNeighbourSvc);
-  declareProperty("InDetTRTStrawStatusSummarySvc", m_sumSvc);  // need for Argon
+  declareProperty("InDetTRTStrawStatusSummarySvc", m_sumSvc);
   declareProperty("UseGasMix",                     m_UseGasMix);
   declareProperty("HardScatterSplittingMode",      m_HardScatterSplittingMode);
   declareProperty("ParticleBarcodeVeto",           m_vetoThisBarcode=crazyParticleBarcode, "Barcode of particle to ignore");
@@ -202,7 +199,6 @@ StatusCode TRTDigitizationTool::initialize()
   }
 
   // Initialize data handle keys
-
   ATH_CHECK(m_outputRDOCollName.initialize());
   ATH_CHECK(m_outputSDOCollName.initialize());
 
@@ -277,14 +273,11 @@ StatusCode TRTDigitizationTool::initialize()
 //_____________________________________________________________________________
 StatusCode TRTDigitizationTool::prepareEvent(unsigned int)
 {
-
   m_vDigits.clear();
   m_trtHitCollList.clear();
   m_thpctrt = new TimedHitCollection<TRTUncompressedHit>();
   m_HardScatterSplittingSkipper = false;
-
   return StatusCode::SUCCESS;
-
 }
 
 //_____________________________________________________________________________
@@ -420,7 +413,7 @@ StatusCode TRTDigitizationTool::processStraws(std::set<int>& sim_hitids, std::se
   // Create a map for the SDO
   SG::WriteHandle<InDetSimDataCollection> simDataMap(m_outputSDOCollName);
 
-  ATH_CHECK(simDataMap.record(std::make_unique<InDetSimDataCollection>() )); 
+  ATH_CHECK(simDataMap.record(std::make_unique<InDetSimDataCollection>() ));
 
   // Register the map into StoreGate
   if (not simDataMap.isValid()) {
@@ -433,7 +426,6 @@ StatusCode TRTDigitizationTool::processStraws(std::set<int>& sim_hitids, std::se
   m_cosmicEventPhase = 0.0;
   if (m_settings->doCosmicTimingPit()) {
     m_cosmicEventPhase = getCosmicEventPhase();
-    //std::cout << "AJB " << m_cosmicEventPhase << std::endl;
   };
 
   // Create  a vector of deposits
@@ -484,13 +476,9 @@ StatusCode TRTDigitizationTool::processStraws(std::set<int>& sim_hitids, std::se
       }
       ATH_MSG_VERBOSE ( "Deposit: trackID " << deposit.first << " energyDeposit " << deposit.second );
       depositVector.push_back(deposit);
-      // evtIndex != 0 ? hit_iter->eventId() : 0 ;   commented for now. Once mc09 campaign is over, consider to implement + implement cuts on hitTime in addition/in stead bunchcrossing cuts.
     }
 
     const TimedHitPtr<TRTUncompressedHit>& theHit(*i);
-    //double globalHitTime(hitTime(theHit));
-    //double globalTime(static_cast<double>(theHit->GetGlobalTime()));
-    //double bunchCrossingTime(globalHitTime - globalTime);
     const double bunchCrossingTime(hitTime(theHit) - static_cast<double>(theHit->GetGlobalTime()));
 
     // Add the simdata object to the map.
@@ -513,10 +501,6 @@ StatusCode TRTDigitizationTool::processStraws(std::set<int>& sim_hitids, std::se
     //  }
     //}
 
-    // This will be set in TRTProcessingOfStraw::ProcessStraw
-    // according to what types of particles hit the straw.
-    m_particleFlag=0;
-
     // if StatusHT == 6 thats emulate argon, ==7 that's emulate krypton
     bool emulateArFlag = m_sumSvc->getStatusHT(idStraw) == 6;
     bool emulateKrFlag = m_sumSvc->getStatusHT(idStraw) == 7;
@@ -526,51 +510,19 @@ StatusCode TRTDigitizationTool::processStraws(std::set<int>& sim_hitids, std::se
                                        m_cosmicEventPhase, //m_ComTime,
                                        StrawGasType(idStraw),
 				       emulateArFlag,
-				       emulateKrFlag,
-                                       m_particleFlag);
-
-    // Sorry, a lot of test code here before the output digit is saved.
+				       emulateKrFlag);
 
-    // query m_particleFlag bits 0 to 15 (left-to-right)
-    //std::cout << "AJB "; for (unsigned i=0;i<16;i++) std::cout << particleFlagQueryBit(i,m_particleFlag); std::cout << std::endl;
-
-    //AJB, Print out the digits etc (for debugging)
+    // Print out the digits etc (for debugging)
     //int          mstrw = digit_straw.GetStrawID();
     //unsigned int mword = digit_straw.GetDigit();
     //std::cout << "AJB " << mstrw << ":" << mword << std::endl;
-    //print_mword_properties(mword); // AJB
+    //print_mword_properties(mword);
     //std::cout << "AJB "; bits24(mword);
     //std::cout << "AJB "; bits27(mword);
 
-/*
-    if (particleFlagQueryBit(10,m_particleFlag)) { // Do this only for pions > 10 GeV
-      if ( digit_straw.GetDigit() ) {
-        // bool HT=highLevel(mword);
-        // if (HT) {
-          unsigned int region = getRegion(hitID); // 1=barrelShort, 2=barrelLong, 3=ECA, 4=ECB
-          // bool HT1=highLevel1(mword); bool HT2=highLevel2(mword); bool HT3=highLevel3(mword);
-          std::cout << "AJB " << region
-                    <<    " " << timeOverThreshold(mword)
-                    <<    " " << rawDriftTime(mword)
-                    <<    " " << highLevel2(mword)
-                    << std::endl;
-          //int ichip = 0; m_TRTStrawNeighbourSvc->getChip(idStraw, ichip);
-          //int detid = m_trt_id->barrel_ec(idLayer); // +1=BA, -1=BC, +2=EA, -2=EC
-          //if (detid==+1) std::cout << "AJBBA " << HT1 << " " << HT2 << " " << HT3 << std::endl;
-          //if (detid==-1) std::cout << "AJBBC " << HT1 << " " << HT2 << " " << HT3 << std::endl;
-          //if (detid==-2) std::cout << "AJBEC " << HT1 << " " << HT2 << " " << HT3 << std::endl;
-          //if (detid==+2) std::cout << "AJBEA " << HT1 << " " << HT2 << " " << HT3 << std::endl;
-       // }
-      }
-    }
-*/
-
     // finally push back the output digit.
     if ( digit_straw.GetDigit() ) {
       m_vDigits.push_back(digit_straw);
-      //int          mstrw = digit_straw.GetStrawID();
-      //unsigned int mword = digit_straw.GetDigit();
-      //std::cout << "AJB "; bits32(mword);
     }
 
   } // end of straw loop
@@ -595,7 +547,7 @@ StatusCode TRTDigitizationTool::processAllSubEvents() {
   m_trtrdo_container = SG::makeHandle(m_outputRDOCollName);
   ATH_CHECK(m_trtrdo_container.record(std::make_unique<TRT_RDO_Container>(m_trt_id->straw_layer_hash_max())));
   ATH_MSG_DEBUG ( " TRT_RDO_Container created " );
-  
+
   if (not m_trtrdo_container.isValid()) {
     ATH_MSG_FATAL ( "Container " << m_outputRDOCollName.key() << " could not be registered in StoreGate !" );
     return StatusCode::FAILURE;
@@ -603,7 +555,6 @@ StatusCode TRTDigitizationTool::processAllSubEvents() {
     ATH_MSG_DEBUG ( "Container " << m_outputRDOCollName.key() << " registered in StoreGate" );
   }
 
-
   m_vDigits.clear();
 
   //Set of all hitid's with simhits (used for noise simulation).
@@ -708,11 +659,10 @@ StatusCode TRTDigitizationTool::mergeEvent() {
   if (not m_trtrdo_container.isValid()) {
     ATH_MSG_FATAL ( "Container " << m_outputRDOCollName.key() << " could not be registered in StoreGate !" );
     return StatusCode::FAILURE;
-  }else {
+  } else {
     ATH_MSG_DEBUG ( "Container " << m_outputRDOCollName.key() << " registered in StoreGate" );
   }
 
-
   //Set of all hitid's with simhits (used for noise simulation).
   std::set<int> sim_hitids;
   std::set<Identifier> simhitsIdentifiers;
@@ -997,20 +947,11 @@ StatusCode TRTDigitizationTool::ConditionsDependingInitialization() {
 
 }
 
-//_____________________________________________________________________________
-//The meaning of these 16 bits is given in TRTProcessingOfStraw::particleFlagSetBit()
-bool TRTDigitizationTool::particleFlagQueryBit(int bitposition, unsigned short particleFlag) const {
-  if ( bitposition >= 0 && bitposition < 16) {
-    return (1 << bitposition) & particleFlag;
-  } else {
-    ATH_MSG_WARNING ( "Trying to read bit position " << bitposition << " in unsigned short m_particleFlag !");
-    return 0; // returning a false neagtive is preferred over a false positive.
-  }
-}
-
 //_____________________________________________________________________________
 unsigned int TRTDigitizationTool::getRegion(int hitID) {
+
 // 1=barrelShort, 2=barrelLong, 3=ECA, 4=ECB
+
   const int mask(0x0000001F);
   const int word_shift(5);
   int layerID, ringID, wheelID;
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.h
index be0ece6dd76..249ffdddb1d 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.h
@@ -12,10 +12,8 @@
 #include <vector>
 #include <list>
 #include <utility> /* pair */
-
 #include "xAODEventInfo/EventInfo.h"  /*SubEvent*/
 #include "PileUpTools/PileUpToolBase.h"
-
 #include "TRTDigit.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
@@ -24,9 +22,7 @@
 //#include "CommissionEvent/ComTime.h"
 #include "TRT_ConditionsServices/ITRT_StrawNeighbourSvc.h"
 #include "HepPDT/ParticleDataTable.hh"
-
 #include "TRT_ConditionsServices/ITRT_StrawStatusSummarySvc.h"
-
 #include "CLHEP/Random/RandomEngine.h"
 #include "StoreGate/WriteHandleKey.h"
 #include "StoreGate/WriteHandle.h"
@@ -64,6 +60,7 @@ public:
 
   ///called at the end of the subevts loop. Not (necessarily) able to access SubEvents
   StatusCode mergeEvent();
+
   ///called for each active bunch-crossing to process current SubEvents bunchXing is in ns
   StatusCode processBunchXing( int bunchXing,
 			       SubEventIterator bSubEvents,
@@ -108,7 +105,6 @@ private:
   // The straw's gas mix: 1=Xe, 2=Kr, 3=Ar
   int StrawGasType(Identifier& TRT_Identifier) const;
 
-  bool particleFlagQueryBit(int bitposition, unsigned short particleFlag) const;
   unsigned int getRegion(int hitID);
   double getCosmicEventPhase();
 
@@ -116,7 +112,7 @@ private:
   std::vector<TRTDigit> m_vDigits; /**< Vector of all digits */
   std::string m_dataObjectName; /**< Name of the hits collections */
   SG::WriteHandleKey<TRT_RDO_Container> m_outputRDOCollName{this,"OutputObjectName","TRT_RDOs","WHK Output Object name"}; /**< name of the output RDOs. */
-  SG::WriteHandleKey<InDetSimDataCollection> m_outputSDOCollName{this,"OutputSDOName","TRT_SDO_Map","WHK Output SDO container name"}; /**< name of the output SDOs. */ 
+  SG::WriteHandleKey<InDetSimDataCollection> m_outputSDOCollName{this,"OutputSDOName","TRT_SDO_Map","WHK Output SDO container name"}; /**< name of the output SDOs. */
   SG::WriteHandle<TRT_RDO_Container> m_trtrdo_container; //RDO container handle
 
   bool m_printOverrideableSettings;
@@ -159,9 +155,8 @@ private:
 
   int m_UseGasMix;
   double m_cosmicEventPhase;     // local replacement for the comTime service
-  unsigned short m_particleFlag; // 16-bit flag indicating the presence of up to 16 types of particle hitting the straw.
-  ServiceHandle<ITRT_StrawStatusSummarySvc> m_sumSvc; // added by Sasha for Argon
-  IntegerProperty                                    m_vetoThisBarcode;
+  ServiceHandle<ITRT_StrawStatusSummarySvc> m_sumSvc;
+  IntegerProperty m_vetoThisBarcode;
 
 };
 
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsNoise.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsNoise.cxx
index ef586222c9a..f46502834fe 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsNoise.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsNoise.cxx
@@ -14,7 +14,7 @@
 #include "TRTDigSettings.h"
 
 #include <cmath>
-#include <cstdlib> //Always include this when including cmath!
+#include <cstdlib>
 
 //_____________________________________________________________________________
 TRTElectronicsNoise::TRTElectronicsNoise(const TRTDigSettings* digset,
@@ -27,22 +27,18 @@ TRTElectronicsNoise::TRTElectronicsNoise(const TRTDigSettings* digset,
 
   //Need to initialize the signal shaping first as it is used in tabulateNoiseSignalShape()!
   this->InitializeNoiseShaping();
-
   m_pHRengine = atRndmGenSvc->GetEngine("TRT_ElectronicsNoise");
-
   m_fractionOfSlowNoise = m_settings->slowPeriodicNoisePulseFraction();
-
   this->tabulateNoiseSignalShape();
-
   this->reinitElectronicsNoise(200);
-
   const double slowPeriod(m_settings->slowPeriodicNoisePulseDistance());
-  //Must be rounded to nearest multiple of binwidth... (fixme - from options)
 
+  //Must be rounded to nearest multiple of binwidth... (fixme - from options)
   const double binwidth(m_settings->timeInterval()/m_settings->numberOfBins());
   m_nbins_periodic = static_cast<int>(slowPeriod/binwidth + 0.5);
 
   if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TRTElectronicsNoise::Constructor done"   << endmsg;
+
 }
 
 //_____________________________________________________________________________
@@ -62,8 +58,7 @@ void TRTElectronicsNoise::getSamplesOfMaxLTOverNoiseAmp(std::vector<float>& maxL
   reinitElectronicsNoise(500);
   unsigned int index         = m_noiseSignalShape.size();
   unsigned int nbinsinperiod = m_settings->numberOfBins();
-  unsigned int maxindex      =
-    m_cachedFastNoiseAfterSignalShaping.size() - nbinsinperiod;
+  unsigned int maxindex      = m_cachedFastNoiseAfterSignalShaping.size() - nbinsinperiod;
 
   for (unsigned int i = 0; i < nsamplings; ++i) {
     maxLTOverNoiseAmp[i] = getMax(index, index, nbinsinperiod );
@@ -80,6 +75,7 @@ double TRTElectronicsNoise::getMax(unsigned int firstbinslowsignal,
 				   unsigned int firstbinfastsignal,
 				   const unsigned int& binsinwindow )
 {
+
   // This method assumes that firstbinslowsignal + binsinwindow doesn't
   // exceed the cached array sizes (and same for fastsignal).
 
@@ -90,8 +86,7 @@ double TRTElectronicsNoise::getMax(unsigned int firstbinslowsignal,
     double totalsig =
       m_cachedFastNoiseAfterSignalShaping[firstbinfastsignal++] +
       m_cachedSlowNoiseAfterSignalShaping[firstbinslowsignal++];
-    if ( max<totalsig )
-      max = totalsig;
+    if ( max<totalsig ) max = totalsig;
   };
 
   return max;
@@ -123,11 +118,9 @@ void TRTElectronicsNoise::reinitElectronicsNoise(const unsigned int& numberOfDig
   unsigned int binindex;
 
   //### Fast signal:
-
   double fractionOfFastNoise = 1.0-m_fractionOfSlowNoise;
 
   //### First we produce the noise as it is BEFORE signal shaping:
-
   for (unsigned int i(0); i < nbins; ++i) {
     m_tmpArray[i] = 0.;
     m_cachedFastNoiseAfterSignalShaping[i] = 0.;
@@ -136,8 +129,7 @@ void TRTElectronicsNoise::reinitElectronicsNoise(const unsigned int& numberOfDig
   timeOfNextPulse = 0.5 * fastPeriod;
   while ( true ) {
     binindex = static_cast<unsigned int>(timeOfNextPulse*invbinwidth);
-    if (binindex >= nbins)
-      break;
+    if (binindex >= nbins) break;
     m_tmpArray[binindex] += CLHEP::RandGaussZiggurat::shoot(m_pHRengine, 0., 1.);
     timeOfNextPulse += fastPeriod;
   };
@@ -145,8 +137,7 @@ void TRTElectronicsNoise::reinitElectronicsNoise(const unsigned int& numberOfDig
   //### Then (Anatolis) signal shaping:
   for (unsigned int i(0); i < nbins; ++i) {
     unsigned int limit(i+m_noiseSignalShape.size());
-    if ( limit > nbins )
-      limit = nbins;
+    if ( limit > nbins ) limit = nbins;
     for (unsigned int j(i); j < limit; ++j) {
       m_cachedFastNoiseAfterSignalShaping[j] +=
 	m_tmpArray[i] * m_noiseSignalShape[j-i] * fractionOfFastNoise;
@@ -154,19 +145,16 @@ void TRTElectronicsNoise::reinitElectronicsNoise(const unsigned int& numberOfDig
   };
 
   //### Slow periodic signal
-
   for (unsigned int i(0); i < nbins; ++i) {
     m_tmpArray[i] = 0.;
     m_cachedSlowNoiseAfterSignalShaping[i] = 0.;
   }
 
   //### First we produce the noise as it is BEFORE signal shaping:
-
   timeOfNextPulse = 0.5 * slowPeriod;
   while (true) {
     binindex = static_cast<unsigned int>(timeOfNextPulse*invbinwidth);
-    if (binindex >= nbins)
-      break;
+    if (binindex >= nbins) break;
     m_tmpArray[binindex] += CLHEP::RandGaussZiggurat::shoot(m_pHRengine, 0., 1.);
     timeOfNextPulse += slowPeriod;
   };
@@ -174,8 +162,7 @@ void TRTElectronicsNoise::reinitElectronicsNoise(const unsigned int& numberOfDig
   //### Then (Anatolis) signal shaping:
   for (unsigned int i(0); i < nbins; ++i) {
     unsigned int limit(i+m_noiseSignalShape.size());
-    if (limit > nbins)
-      limit = nbins;
+    if (limit > nbins) limit = nbins;
     for (unsigned int j(i); j < limit; ++j) {
       m_cachedSlowNoiseAfterSignalShaping[j] +=
 	m_tmpArray[i] * m_noiseSignalShape[j-i] *
@@ -202,8 +189,7 @@ void TRTElectronicsNoise::tabulateNoiseSignalShape() {
   //Cut of trailing zeroes:
   unsigned int noiseshapebins(m_noiseSignalShape.size()-1);
   for ( ;noiseshapebins>0;--noiseshapebins) {
-    if (m_noiseSignalShape.at(noiseshapebins-1)>0.001*shapemax)
-      break;
+    if (m_noiseSignalShape.at(noiseshapebins-1)>0.001*shapemax) break;
   }
   m_noiseSignalShape.resize(noiseshapebins);
 
@@ -299,11 +285,9 @@ double TRTElectronicsNoise::NoiseShape(const double& time) const {
   //convert to nanoseconds:
   const double time_ns(time/CLHEP::nanosecond);
 
-  if ( time_ns<0 || time_ns > 32 )
-    return 0;
-
-  double tmp = 0;
+  if ( time_ns<0 || time_ns > 32 ) return 0;
 
+  double tmp(0);
   for (unsigned int i(6); i>=4; --i) {
     if (time_ns<15.5)
       tmp = (tmp + m_noisepars1[i])*time_ns;
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
index 2b36fd013a2..13ffce94979 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
@@ -62,10 +62,6 @@ void TRTElectronicsProcessing::Initialize() {
   m_totalNumberOfBins = m_numberOfPreZeroBins + m_numberOfPostZeroBins; //assigning to int
   m_timeInterval += m_binWidth * static_cast<double>(m_numberOfPreZeroBins); //assigning to double
 
-  //TK: why dont we use these? [fixme?]
-  //AJB: Yes, what a mess!
-  //  int numberOfBinsInEncodingBin = m_settings->numberOfBinsInEncodingBin();
-  //  m_encodingBinWidth = m_binWidth * (double) numberOfBinsInEncodingBin;
   m_minDiscriminatorWidthInBinWidths =     static_cast<int>(m_settings->minDiscriminatorWidth()     / m_binWidth + 0.5);
   m_discriminatorSettlingTimeInBinWidths = static_cast<int>(m_settings->discriminatorSettlingTime() / m_binWidth + 0.5);
   m_discriminatorDeadTimeInBinWidths =     static_cast<int>(m_settings->discriminatorDeadTime()     / m_binWidth + 0.5);
@@ -81,7 +77,6 @@ void TRTElectronicsProcessing::Initialize() {
   m_lowThresholdEC[2]  = m_settings->lowThresholdEC(2);
 
   TabulateSignalShape();
-
   //for (int j=0; j<3; j++) { for (int i=0; i<m_numberOfPostZeroBins; i++) std::cout << "AJBLT " << j << " " << m_lowThresholdSignalShape[j][i] << std::endl; }
   //for (int j=0; j<3; j++) { for (int i=0; i<m_numberOfPostZeroBins; i++) std::cout << "AJBHT " << j << " " << m_highThresholdSignalShape[j][i] << std::endl; }
 
@@ -104,11 +99,9 @@ void TRTElectronicsProcessing::Initialize() {
 //___________________________________________________________________________
 void TRTElectronicsProcessing::TabulateSignalShape() {
 
-  // Fixme: This assumes 0.78125 ns bin spacing and m_numberOfPostZeroBins=160 bins!
-  // So we need to hard-code the processing to reflect that this is not a parameter!
-
   if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "TRTElectronicsProcessing::TabulateSignalShape() begin" << endmsg;
 
+  // We have 160 bins each 0.78125 ns
   // These arrays are cut and paste from the output of TRT_Digitization/share/signalShapes.cpp
 
   const double pXeLT[160] = {
@@ -259,7 +252,7 @@ void TRTElectronicsProcessing::ProcessDeposits( const std::vector<TRTElectronics
     highthreshold = highthreshold*CLHEP::RandGaussZiggurat::shoot(m_pHRengine, 1.0, high_threshold_fluctuation );
   }
 
-  //Null out arrays: (AJB m_totalNumberOfBins=160(125ns))
+  //Null out arrays: m_totalNumberOfBins=160(125ns)
   for (int i(0); i < m_totalNumberOfBins; ++i) {
     m_energyDistribution[i] = 0.;
     m_lowThresholdSignal[i] = 0.;
@@ -267,7 +260,7 @@ void TRTElectronicsProcessing::ProcessDeposits( const std::vector<TRTElectronics
     m_lowThresholdDiscriminator[i] = 0;
     m_highThresholdDiscriminator[i] = 0;
   }
-  // Fill cluster energies into relevant time bins
+  // Fill cluster energies into relevant time bins: m_energyDistribution[m_totalNumberOfBins] * 1.0e6 eV
   // With pileup, m_timeInterval=125ns and signal event starting at 50 ns.
   const unsigned int numberOfDeposits(deposits.size());
   for (unsigned int i(0); i < numberOfDeposits; ++i) {
@@ -277,42 +270,26 @@ void TRTElectronicsProcessing::ProcessDeposits( const std::vector<TRTElectronics
       m_energyDistribution[index] += deposits[i].energy();
     }
   }
-  //std::cout << "AJB before shaping ";
-  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout << m_energyDistribution[i]*1.0e6 << " "; // (eV)
-  //std::cout << std::endl;
 
   // Signal shaping; 4 different shaping functions for: LT, HT, Argon, Xenon
+  // Fills m_lowThresholdSignal[m_totalNumberOfBins] and m_highThresholdSignal[m_totalNumberOfBins]
   SignalShaping(strawGasType);
-  //std::cout << "AJB after shaping ";
-  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout <<  m_lowThresholdSignal[i]*1.0e6 << " "; // (eV); or m_highThresholdSignal[i]
-  //std::cout << std::endl;
 
   // Add noise; LT only
   // (though both LT and HT also get fluctuations elsewhere which gives similar effect to noise).
   if ( m_pElectronicsNoise && noiseamplitude>0 ) {
     m_pElectronicsNoise->addElectronicsNoise(m_lowThresholdSignal,noiseamplitude); // LT signal only
-    //std::cout << "AJB after adding noise ";
-    //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout <<  m_lowThresholdSignal[i]*1.0e6 << " "; // (eV); or m_highThresholdSignal[i]
-    //std::cout << std::endl;
   }
 
   // Discriminator response (in what fine time bins are the thresholds exceeded)
+  // Fills m_lowThresholdDiscriminator[m_totalNumberOfBins] and m_highThresholdDiscriminator[m_totalNumberOfBins]
   DiscriminatorResponse(lowthreshold,highthreshold);
-  //std::cout << "AJB after discriminator " << strawGasType << getRegion(hitID) << std::endl;
-  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout << m_lowThresholdDiscriminator[i]; // or m_highThresholdDiscriminator[i]
-  //std::cout << std::endl;
 
   // Apply an independent LT T0 shift to m_lowThresholdDiscriminator[]
   LTt0Shift(hitID,strawGasType);
-  //std::cout << "AJB after discriminator LT T0 shift " << strawGasType << getRegion(hitID) << std::endl;
-  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout << m_lowThresholdDiscriminator[i];
-  //std::cout << std::endl;
 
   // Apply an independent HT T0 shift to m_highThresholdDiscriminator[]
   HTt0Shift(hitID);
-  //std::cout << "AJB after discriminator HT T0 shift " << strawGasType << getRegion(hitID) << std::endl;
-  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout <<  m_highThresholdDiscriminator[i];
-  //std::cout << std::endl;
 
   // Finally turn the fine discriminator response arrays into an output digit;
   // for RDO reduction, zero: msb, and first 4 unused bits, first and third HT bits, last 4 LT bits
@@ -574,7 +551,7 @@ double TRTElectronicsProcessing::getHighThreshold ( int hitID, int strawGasType
 //___________________________________________________________________________
 void TRTElectronicsProcessing::HTt0Shift(int hitID) {
 
-  // Apply a (small)timing shift to m_highThresholdDiscriminator[]
+  // Apply a timing shift to m_highThresholdDiscriminator[]
   // t0Shift tuning is provided by the parameters:
   // htT0shiftBarShort, htT0shiftBarLong, htT0shiftECAwheels and m_htT0shiftECBwheels
 
@@ -620,7 +597,7 @@ void TRTElectronicsProcessing::HTt0Shift(int hitID) {
 //_____________________________________________________________________________
 void TRTElectronicsProcessing::LTt0Shift( int hitID, int strawGasType ) {
 
-  // Apply a (small)timing shift to m_lowThresholdDiscriminator[]
+  // Apply a timing shift to m_lowThresholdDiscriminator[]
   // t0Shift tuning is provided by the parameters:
   // ltT0shiftBarShort, ltT0shiftBarLong, ltT0shiftECAwheels and m_ltT0shiftECBwheels
 
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.cxx
index d592c187481..2903ca5e000 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.cxx
@@ -54,14 +54,9 @@ TRTNoise::TRTNoise( const TRTDigSettings* digset,
     m_sumSvc(sumSvc)
 {
   if (msgLevel(MSG::VERBOSE)) { msg(MSG::VERBOSE) << "TRTNoise::Constructor begin" << endmsg; }
-
   m_noise_randengine = atRndmGenSvc->GetEngine("TRT_Noise");
-
   InitThresholdsAndNoiseAmplitudes_and_ProduceNoiseDigitPool();
-
-  if ( m_settings->noiseInSimhits() )
-    m_pElectronicsNoise->reinitElectronicsNoise( 1000 );
-
+  if ( m_settings->noiseInSimhits() ) m_pElectronicsNoise->reinitElectronicsNoise( 1000 );
   if (msgLevel(MSG::VERBOSE)) { msg(MSG::VERBOSE) << "Constructor done" << endmsg; }
 }
 
@@ -93,6 +88,7 @@ void TRTNoise::InitThresholdsAndNoiseAmplitudes_and_ProduceNoiseDigitPool() {
   // So now we first figure out the value of k, and afterwards we go //
   // through the straws and set LT_i and NA_i.                       //
   /////////////////////////////////////////////////////////////////////
+
   if (msgLevel(MSG::VERBOSE)) { msg(MSG::VERBOSE)
     << "TRTNoise::InitThresholdsAndNoiseAmplitudes_and_ProduceNoiseDigitPool Begin" << endmsg;
   }
@@ -101,7 +97,6 @@ void TRTNoise::InitThresholdsAndNoiseAmplitudes_and_ProduceNoiseDigitPool() {
   // Step 1 - create lookup table for mapping: noiselevel -> LT/NA //
   ///////////////////////////////////////////////////////////////////
   // According to Anatoli, the noise shaping function is not very different for Argon and Xenon(and Krypton).
-
   std::vector<float> maxLTOverNoiseAmp;
   m_pElectronicsNoise->getSamplesOfMaxLTOverNoiseAmp(maxLTOverNoiseAmp,10000);
 
@@ -192,9 +187,11 @@ void TRTNoise::InitThresholdsAndNoiseAmplitudes_and_ProduceNoiseDigitPool() {
   float actualLT, actualNA;
 
   m_pDigConditions->resetGetNextStraw();
+
   double sumLT_Ar(0.), sumLTsq_Ar(0.), sumNA_Ar(0.), sumNAsq_Ar(0.);
   double sumLT_Xe(0.), sumLTsq_Xe(0.), sumNA_Xe(0.), sumNAsq_Xe(0.);
   double sumLT_Kr(0.), sumLTsq_Kr(0.), sumNA_Kr(0.), sumNAsq_Kr(0.);
+
   while ( m_pDigConditions->getNextStraw( hitid, noiselevel, noiseamp) ) {
 
     int strawGasType = StrawGasType(getStrawIdentifier(hitid));
@@ -221,6 +218,7 @@ void TRTNoise::InitThresholdsAndNoiseAmplitudes_and_ProduceNoiseDigitPool() {
     }
 
     m_pDigConditions->setRefinedStrawParameters( hitid, actualLT, actualNA );
+
     if ( m_settings->noiseInUnhitStraws() ) {
       actual_LTs.push_back(actualLT);
       actual_noiseamps.push_back(actualNA);
@@ -260,7 +258,6 @@ void TRTNoise::InitThresholdsAndNoiseAmplitudes_and_ProduceNoiseDigitPool() {
   ///////////////////////////////////////////////////////////////////
   // Step 4 - Produce pool of pure noise digits                    //
   ///////////////////////////////////////////////////////////////////
-
   if ( m_settings->noiseInUnhitStraws() ) {
     ProduceNoiseDigitPool( actual_LTs, actual_noiseamps, strawTypes );
   }
@@ -287,6 +284,7 @@ void TRTNoise::ProduceNoiseDigitPool( const std::vector<float>& lowthresholds,
   TRTDigit digit;
   unsigned int nokdigits(0);
   unsigned int ntries(0);
+
   while ( nokdigits < m_digitPoolLength ) {
 
     // Once and a while, create new vectors of shaped electronics noise.
@@ -350,7 +348,9 @@ void TRTNoise::appendPureNoiseToProperDigits( std::vector<TRTDigit>& digitVect,
       digitVect.push_back(TRTDigit(hitid,ndigit));
     }
   };
+
   digitVect.pop_back(); //Required since last hitID is occasionally corrupted.
+
   return;
 }
 
@@ -452,7 +452,6 @@ void TRTNoise::sortDigits(std::vector<TRTDigit>& digitVect)
   return;
 }
 
-
 //_____________________________________________________________________________
 float TRTNoise::useLookupTable(const float& x, // noise_level
 			       const std::vector<float>& y_given_x,
@@ -492,6 +491,7 @@ void TRTNoise::makeInvertedLookupTable( const std::vector<float>& y_given_x,
 					std::vector<float>& x_given_y,
 					float & min_y,
 					float & max_y ) {
+
   //Only works well when y_given_x.size() is large.
   //
   //Also assumes that y_given_x is homogeneous.
@@ -514,6 +514,7 @@ void TRTNoise::makeInvertedLookupTable( const std::vector<float>& y_given_x,
   if ( x_given_y.size() != n ) {
     x_given_y.resize(n);
   }
+
   //Fill new array:
   const float step_y((max_y-min_y)/(n-1));
   const float step_x((max_x-min_x)/(n-1));
@@ -552,13 +553,10 @@ void TRTNoise::evolve_LT2AmpVsNL_to_include_LTfluct( std::vector<float>& nl_give
   std::vector<float> new_nl_given_lt2na(number_new_bins);
 
   new_min_lt2na = min_lt2na;
-  new_max_lt2na =
-    relativeLTFluct < 0.4 ? max_lt2na/(1.0-2.0*relativeLTFluct) : 5*max_lt2na;
-
+  new_max_lt2na = relativeLTFluct < 0.4 ? max_lt2na/(1.0-2.0*relativeLTFluct) : 5*max_lt2na;
 
   for (unsigned int i = 0; i<number_new_bins;++i) {
-    const float new_lt2naval(new_min_lt2na +
-			     (new_max_lt2na-new_min_lt2na)*static_cast<float>(i)/(number_new_bins-1));
+    const float new_lt2naval(new_min_lt2na + (new_max_lt2na-new_min_lt2na)*static_cast<float>(i)/(number_new_bins-1));
     float sigma = new_lt2naval*relativeLTFluct;
     if ( sigma <= 0 ) {
       if (sigma<0) { sigma *= -1.0; }
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.h
index 34b4a617863..20d854e9640 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.h
@@ -48,7 +48,7 @@ public:
 	    TRTElectronicsNoise * electronicsnoise,
 	    const TRT_ID* trt_id,
 	    int UseGasMix,
-	    ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc // added by Sasha for Argon
+	    ServiceHandle<ITRT_StrawStatusSummarySvc> sumSvc
 	  );
 
   /**
@@ -66,14 +66,14 @@ public:
 				      const std::set<int>& sim_hitids) ;
 
 
-  void appendCrossTalkNoiseToProperDigits(std::vector<TRTDigit>& digitVect, 
+  void appendCrossTalkNoiseToProperDigits(std::vector<TRTDigit>& digitVect,
 					  const std::set<Identifier>& simhitsIdentifiers,
-					  ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc); 
-  
+					  ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc);
+
   void sortDigits(std::vector<TRTDigit>& digitVect);
 
   ~TRTNoise();
- 
+
   MsgStream& msg (MSG::Level lvl) const { return m_msg << lvl; }
   bool msgLevel (MSG::Level lvl)    { return m_msg.get().level() <= lvl; }
 
@@ -205,6 +205,7 @@ public:
   unsigned int getRegion(int hitID,const TRT_ID* trt_id);
   int m_UseGasMix;
   ServiceHandle<ITRT_StrawStatusSummarySvc> m_sumSvc; // need for Argon
+
 };
 
 #endif
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.cxx
index 5c02906199d..a132d30a2e7 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.cxx
@@ -83,12 +83,7 @@ TRTProcessingOfStraw::TRTProcessingOfStraw(const TRTDigSettings* digset,
 
 {
   ATH_MSG_VERBOSE ( "TRTProcessingOfStraw::Constructor begin" );
-
   Initialize(atRndmGenSvc);
-
-  //m_clusterlist.reserve(400); //distribution peaks much lower, but this is about the max size seen at <mu>=40.
-  //m_depositList.reserve(400);  //distribution peaks much lower, but this is about the max size seen at <mu>=40.
-
   ATH_MSG_VERBOSE ( "Constructor done" );
 }
 
@@ -119,14 +114,13 @@ void TRTProcessingOfStraw::Initialize(ServiceHandle <IAtRndmGenSvc> atRndmGenSvc
   m_ionisationPotential    = m_settings->ionisationPotential(0);  // strawGasType=0 here just to initialize
   m_smearingFactor         = m_settings->smearingFactor(0);       // to keep coverity happy. Reset correctly later.
   m_trEfficiencyBarrel     = m_settings->trEfficiencyBarrel(0);   //
-  m_trEfficiencyEndCapA     = m_settings->trEfficiencyEndCapA(0);   //
-  m_trEfficiencyEndCapB     = m_settings->trEfficiencyEndCapB(0);
+  m_trEfficiencyEndCapA    = m_settings->trEfficiencyEndCapA(0);  //
+  m_trEfficiencyEndCapB    = m_settings->trEfficiencyEndCapB(0);  //
 
   m_maxelectrons = 100; // 100 gives good Gaussian approximation
 
   if (m_pPAItoolXe==NULL) {
     ATH_MSG_FATAL ( "TRT_PAITool for Xenon not defined! no point in continuing!" );
-    // throw?
   }
   if (m_pPAItoolKr==NULL) {
     ATH_MSG_ERROR ( "TRT_PAITool for Krypton is not defined!!! Xenon TRT_PAITool will be used for Krypton straws!" );
@@ -158,20 +152,16 @@ void TRTProcessingOfStraw::Initialize(ServiceHandle <IAtRndmGenSvc> atRndmGenSvc
   //Create our own engine with own seeds:
   m_pHRengine = atRndmGenSvc->GetEngine("TRT_ProcessStraw");
 
-  // Tabulate exp(-dist/m_attenuationLength) as a function of
-  // dist = time*m_signalPropagationSpeed [0.0 mm ,1419.9 mm]
-  // otherwise we are doing an exp() for every cluster!
-  // > 99.9% of output digits are the same, saves 13% CPU time.
+  // Tabulate exp(-dist/m_attenuationLength) as a function of dist = time*m_signalPropagationSpeed [0.0 mm ,1419.9 mm]
+  // otherwise we are doing an exp() for every cluster! > 99.9% of output digits are the same, saves 13% CPU time.
   m_expattenuation.reserve(142);
   for (unsigned int k=0; k<142; k++) {
     double dist = 10.0*(k+0.5); // [5mm, 1415mm] max 5 mm error (sigma = 3 mm)
     m_expattenuation.push_back(exp(-dist/m_attenuationLength));
   }
 
-  //For the field effect on drifttimes in this class we will assume
-  //that the local x,y coordinates of endcap straws are such that the
-  //local y-direction is parallel to the global z-direction. As a
-  //sanity check against future code developments we will test this
+  //For the field effect on drifttimes in this class we will assume that the local x,y coordinates of endcap straws are such that the
+  //local y-direction is parallel to the global z-direction. As a sanity check against future code developments we will test this
   //assumption on one straw from each endcap layer.
 
   if (m_solenoidFieldStrength!=0.0)
@@ -290,8 +280,7 @@ void TRTProcessingOfStraw::ProcessStraw ( hitCollConstIter i,
                                           double cosmicEventPhase, // const ComTime* m_ComTime,
                                           int strawGasType,
 					  bool emulationArflag,
-					  bool emulationKrflag,
-                                          unsigned short & particleFlag )
+					  bool emulationKrflag)
 {
 
   //////////////////////////////////////////////////////////
@@ -369,18 +358,11 @@ void TRTProcessingOfStraw::ProcessStraw ( hitCollConstIter i,
 	{
 
           const double energyDeposit = (*theHit)->GetEnergyDeposit(); // keV (see comment below)
-
-          // particleFlag
-          if (energyDeposit<30.0) {
-            particleFlagSetBit(1, particleFlag); // mostly TR
-          } else {
-            particleFlagSetBit(2, particleFlag); // mostly brem.
-          }
-
           // Apply radiator efficiency "fudge factor" to ignore some TR photons (assuming they are over produced in the sim. step.
           // The fraction removed is based on tuning pHT for electrons to data, after tuning pHT for muons (which do not produce TR).
           // The efficiency is different for Xe, Kr and Ar. Avoid fudging non-TR photons (TR is < 30 keV).
           // Also: for |eta|<0.5 apply parabolic scale; see "Parabolic Fudge" https://indico.cern.ch/event/304066/
+
           if ( energyDeposit<30.0 ) {
 
 	    double ArEmulationScaling_BA = 0.15;
@@ -436,38 +418,12 @@ void TRTProcessingOfStraw::ProcessStraw ( hitCollConstIter i,
                  (static_cast<int>(abs(particleEncoding)/100000) == 100) &&
                  (static_cast<int>((abs(particleEncoding))-10000000)/100>10)) )
         {
-          particleFlagSetBit(15, particleFlag); // HIP
 	  m_clusterlist.push_back(
              cluster((*theHit)->GetEnergyDeposit()*CLHEP::keV, timeOfHit, (*theHit)->GetPostStepX(), (*theHit)->GetPostStepY(), (*theHit)->GetPostStepZ() )
              );
         }
       else { // It's not a photon, monopole or Qball with charge > 10, so we proceed with regular ionization using the PAI model
 
-          // particleFlag for charged particles
-          if (abs(particleEncoding)==11) {
-            if (particleEncoding== 11) particleFlagSetBit(3, particleFlag); // any electron
-            if (particleEncoding==-11) particleFlagSetBit(4, particleFlag); // any positron
-            if (particleEncoding== 11 && (*theHit)->GetKineticEnergy() > 10000.*CLHEP::MeV ) particleFlagSetBit(5, particleFlag); // hard electron
-            if (particleEncoding==-11 && (*theHit)->GetKineticEnergy() > 10000.*CLHEP::MeV ) particleFlagSetBit(6, particleFlag); // hard positron
-           }
-          else if (abs(particleEncoding)==13) {
-              particleFlagSetBit(7, particleFlag); // muon
-              if ((*theHit)->GetKineticEnergy() > 10000.*CLHEP::MeV) particleFlagSetBit(8, particleFlag); // hard muon
-            }
-          else if (abs(particleEncoding)==211)  {
-              particleFlagSetBit( 9, particleFlag); // pion
-              if ((*theHit)->GetKineticEnergy() > 10000.*CLHEP::MeV) particleFlagSetBit(10, particleFlag); // hard pion
-            }
-          else if (abs(particleEncoding)==321)  {
-              particleFlagSetBit(11, particleFlag); // kaon
-            }
-          else if (abs(particleEncoding)==2212) {
-              particleFlagSetBit(12, particleFlag); // proton
-            }
-          else {
-              particleFlagSetBit(13, particleFlag); // other charged particle
-            }
-
 	  // Lookup mass and charge from the PDG info in CLHEP HepPDT:
 	  const HepPDT::ParticleData *particle(m_pParticleTable->particle(HepPDT::ParticleID(abs(particleEncoding))));
       	  double particleCharge(0.);
@@ -742,7 +698,7 @@ void TRTProcessingOfStraw::ClustersToDeposits (const int& hitID,
 	}
       else // Barrel
 	{
-          if (m_useMagneticFieldMap) { // Using magnetic field map (here bug #91830 is fixed)
+          if (m_useMagneticFieldMap) { // Using magnetic field map (here bug #91830 is corrected)
               effectiveField2 = map_z2 + (map_x2+map_y2)*cluster_y2/cluster_r2;
           }
           else { // Without the mag field map (very small change in digi output)
@@ -776,10 +732,6 @@ void TRTProcessingOfStraw::ClustersToDeposits (const int& hitID,
       double expdirect(1.0), expreflect(1.0); // Initially set to "no attenuation".
       if (m_useAttenuation)
         {
-           // Tabulate this to save 13% CPU
-           //expdirect  = exp( -timedirect *m_signalPropagationSpeed / m_attenuationLength);
-           //expreflect = exp( -timereflect*m_signalPropagationSpeed / m_attenuationLength);
-
            // Distances the signal propagate along the wire.
            double distdirect  = timedirect *m_signalPropagationSpeed;
            double distreflect = timereflect*m_signalPropagationSpeed;
@@ -788,6 +740,8 @@ void TRTProcessingOfStraw::ClustersToDeposits (const int& hitID,
 
            // Tabulating exp(-dist/m_attenuationLength) with only 142 elements: index [0,141].
            // > 99.9% of output digits are the same, saves 13% CPU time.
+           //expdirect  = exp( -timedirect *m_signalPropagationSpeed / m_attenuationLength);
+           //expreflect = exp( -timereflect*m_signalPropagationSpeed / m_attenuationLength);
            unsigned int kdirect  = static_cast<unsigned int>(distdirect/10);
            unsigned int kreflect = static_cast<unsigned int>(distreflect/10);
            expdirect  = m_expattenuation[kdirect];
@@ -867,40 +821,6 @@ Amg::Vector3D TRTProcessingOfStraw::getGlobalPosition (  int hitID, const TimedH
 }
 
 //________________________________________________________________________________
-/*
- particleFlag in an unsigned short that can be set to record
- the presence of up to 16 different G4hit particle types/energies.
- This can be queried in the TRTDigitizationTool class for
- studies at the Digitization level. e.g. HIP and PID studies.
-
- Bits 0 to 15 represent the straw was hit at least once by a:
-
- bit  pdg  Particle type
- 0         spare
- 1     22  photon < 0.030MeV (mostly TR)
- 2     22  photon > 0.030MeV (mostly brem)
- 3     11  electron
- 4    -11  positron
- 5     11  electron > 10 GeV
- 6    -11  positron > 10 GeV
- 7     13  muon
- 8     13  muon > 10 GeV
- 9    211  pion
- 10   211  pion > 10 GeV
- 11   321  kaon
- 12  2212  proton
- 13        other charged particle
- 14        spare
- 15        HIP
-*/
-void TRTProcessingOfStraw::particleFlagSetBit(int bitposition, unsigned short &particleFlag) const {
-  if ( bitposition >=0 && bitposition < 16) {
-    particleFlag |= (1 << bitposition);
-  } else {
-    ATH_MSG_WARNING ( "Trying to set bit position " << bitposition << " in unsigned short m_particleFlag !");
-  }
-}
-
 unsigned int TRTProcessingOfStraw::getRegion(int hitID) {
 // 1=barrelShort, 2=barrelLong, 3=ECA, 4=ECB
   const int mask(0x0000001F);
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h
index 427b7637493..92a4d43f7c7 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h
@@ -95,8 +95,7 @@ public:
 		     double m_cosmicEventPhase, //const ComTime* m_ComTime,
                      int strawGasType,
 		     bool emulationArflag,
-		     bool emulationKrflag,
-                     unsigned short & m_particleFlag );
+		     bool emulationKrflag );
 
   MsgStream& msg (MSG::Level lvl) const { return m_msg << lvl; }
   bool msgLvl (MSG::Level lvl) { return m_msg.get().level() <= lvl; }
@@ -234,7 +233,6 @@ private:
 
   Amg::Vector3D getGlobalPosition( int hitID, const TimedHitPtr<TRTUncompressedHit> *theHit );
 
-  void particleFlagSetBit(int bitposition, unsigned short &particleFlag) const;
   unsigned int getRegion(int hitID);
 
   //Magnetic field stuff
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.cxx
index baf8e10606f..0df48f4c208 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.cxx
@@ -241,11 +241,11 @@ double TRTTimeCorrection::calculateTimeShiftFromStrawEnds( const Amg::Vector3D&
 
   //The two (hopefully relevant) extreme points of the vertex region:
   Amg::Vector3D vertexExtension1( m_settings->timeOffsetCalcVertexX(),
-			       m_settings->timeOffsetCalcVertexY(),
-			       m_settings->timeOffsetCalcVertexZ() + m_maxVertexDisplacement);
+                                  m_settings->timeOffsetCalcVertexY(),
+                                  m_settings->timeOffsetCalcVertexZ() + m_maxVertexDisplacement);
   Amg::Vector3D vertexExtension2( m_settings->timeOffsetCalcVertexX(),
-			       m_settings->timeOffsetCalcVertexY(),
-			       m_settings->timeOffsetCalcVertexZ() - m_maxVertexDisplacement);
+                                  m_settings->timeOffsetCalcVertexY(),
+                                  m_settings->timeOffsetCalcVertexZ() - m_maxVertexDisplacement);
 
   //Minimum distance between vertex region and the straw ends:
   // const double mindisttoend1(std::min(strawend1_globalcoord.distance(vertexExtension1),
@@ -295,10 +295,7 @@ void TRTTimeCorrection::PropagationTime(const int& strawID, const double& meanZ,
   if (strawID & m_subdetectorMask) {
 
     //===// EndCap //===//
-
     const unsigned int iWheel((strawID >> m_shift15Bits) & m_right5Bits);
-
-
     direct_distance  = m_directDistsForEndCapWheels[iWheel];
     reflect_distance = m_reflectedDistsForEndCapWheels[iWheel];
 
@@ -316,10 +313,8 @@ void TRTTimeCorrection::PropagationTime(const int& strawID, const double& meanZ,
   } else {
 
     //===// Barrel //===//
-
     const unsigned int iRing((strawID >> m_shift15Bits) & m_right5Bits);
     const unsigned int iLayer((strawID >> m_shift5Bits) & m_right5Bits);
-
     direct_distance  = m_directDistsForBarrelLayers[iRing][iLayer];
     reflect_distance = m_reflectedDistsForBarrelLayers[iRing][iLayer];
 
@@ -382,9 +377,6 @@ void TRTTimeCorrection::calculateSignalDists_EndCap(const unsigned int& iWheel,
   return;
 }
 
-
-
-
 //_____________________________________________________________________________
 Identifier TRTTimeCorrection::getIdentifier ( int hitID,
 					      bool & statusok)
@@ -455,13 +447,9 @@ Identifier TRTTimeCorrection::getIdentifier ( int hitID,
 	<< planeID << ", " << strawID << ")"
 	<< endmsg;
       if (msgLevel(MSG::ERROR)) msg(MSG::ERROR)
-	<< "If this happens very rarely, don't be alarmed "
-	<< "(it is a Geant4 'feature')"
-	<< endmsg;
+	<< "If this happens very rarely, don't be alarmed (it is a Geant4 'feature')" << endmsg;
       if (msgLevel(MSG::ERROR)) msg(MSG::ERROR)
-	<< "If it happens a lot, you probably have misconfigured geometry "
-	<< "in the sim. job."
-	<< endmsg;
+	<< "If it happens a lot, you probably have misconfigured geometry in the sim. job." << endmsg;
       statusok = false;
     }
 
@@ -469,4 +457,3 @@ Identifier TRTTimeCorrection::getIdentifier ( int hitID,
 
   return IdStraw;
 }
-
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
index ca6247e6f44..ffd5bad279f 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
@@ -17,12 +17,10 @@ namespace InDetDD {
 
 class TRTDigSettings;
 class TRT_ID;
-
 class ITRT_CalDbSvc;
 
 #include "GeoPrimitives/GeoPrimitives.h"
 
-
 /**
  * Time correction
  */
@@ -129,7 +127,7 @@ private:
   /** Cached distances */
   std::vector< std::vector<double> > m_reflectedDistsForBarrelLayers;
 
-  //TODO/FIXME: substitute these with use of hitidhelper:
+  //Substitute these with use of hitidhelper?:
   const unsigned int m_subdetectorMask;
   const unsigned int m_right5Bits;
   const unsigned int m_shift5Bits;
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_BarrelDriftTimeData.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_BarrelDriftTimeData.cxx
index d6d8d7d8c07..0197f858853 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_BarrelDriftTimeData.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_BarrelDriftTimeData.cxx
@@ -417,4 +417,3 @@ double TRT_BarrelDriftTimeData::DriftTimeAtMaxField(const double& dist) const {
 //______________________________________________________________________________
 // Diffusion code has been remove (June 2015), only represents a spread of a few ns.
 // That is much smaller than the signal shaping width.
-
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_SimDriftTimeTool.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_SimDriftTimeTool.cxx
index d76ce28685c..e5be3b89809 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_SimDriftTimeTool.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_SimDriftTimeTool.cxx
@@ -13,15 +13,11 @@
 ////////////////////////////////////
 
 #include "TRT_SimDriftTimeTool.h"
-
 #include "TRT_BarrelDriftTimeData.h"
 #include "TRT_ScaledDriftTimeData.h"
-
 #include "GaudiKernel/MsgStream.h"
 #include "CLHEP/Units/SystemOfUnits.h"
-
 #include "GaudiKernel/ServiceHandle.h"
-
 #include "InDetReadoutGeometry/TRT_DetectorManager.h"
 
 TRT_SimDriftTimeTool::TRT_SimDriftTimeTool( const std::string& type,
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_SimDriftTimeTool.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_SimDriftTimeTool.h
index efe81ed358f..d33c9b4194c 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_SimDriftTimeTool.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRT_SimDriftTimeTool.h
@@ -14,9 +14,7 @@
 
 #ifndef TRT_SIMDRIFTTIMETOOL_H
 #define TRT_SIMDRIFTTIMETOOL_H
-
 #include "TRT_Digitization/ITRT_SimDriftTimeTool.h"
-
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "AthenaBaseComps/AthAlgTool.h"
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p3.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p3.cxx
index 54cd7bbecfb..18268fe191b 100644
--- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p3.cxx
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p3.cxx
@@ -19,7 +19,6 @@ void InDetSimDataCollectionCnv_p3::transToPers(const InDetSimDataCollection*, In
 void  InDetSimDataCollectionCnv_p3::persToTrans(const InDetSimDataCollection_p3* persCont, InDetSimDataCollection* transCont, MsgStream &log)
 {
 
-    typedef InDetSimDataCollection_p3 PERS;
     typedef std::vector<std::pair<Identifier::value_type, InDetSimData_p2 > >::const_iterator COLLITER;
     InDetSimDataCnv_p2  simDataCnv;
 
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/BeamSpotRetriever.h b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/BeamSpotRetriever.h
index c8def7d30b7..98176dfea69 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/BeamSpotRetriever.h
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/BeamSpotRetriever.h
@@ -33,12 +33,12 @@ namespace JiveXML {
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
   private:
      
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       /// A service handle for the beamspot service
       ServiceHandle<IBeamCondSvc> m_beamSpotSvc; 
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/PixelClusterRetriever.h b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/PixelClusterRetriever.h
index 394595b6b59..30256391462 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/PixelClusterRetriever.h
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/PixelClusterRetriever.h
@@ -45,18 +45,18 @@ namespace JiveXML
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; }
+      virtual std::string dataTypeName() const { return m_typeName; }
 
       /// initialize only geo model tool
-      virtual StatusCode initialize() { return geo.retrieve(); }
+      virtual StatusCode initialize() { return m_geo.retrieve(); }
 
     private:
 
       /// The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       /// A tool handle to the geo model tool
-      const ToolHandle<IInDetGeoModelTool> geo;
+      const ToolHandle<IInDetGeoModelTool> m_geo;
 
       /// The StoreGate key for the SiClusterCollection to retrieve
       std::string m_PixelClusterCollName;
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/PixelRDORetriever.h b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/PixelRDORetriever.h
index 2fa40a4c107..6755321b3f8 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/PixelRDORetriever.h
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/PixelRDORetriever.h
@@ -37,18 +37,18 @@ namespace JiveXML {
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
       /// Only retrieve geo tool in initialize
-      virtual StatusCode initialize() { return geo.retrieve(); };
+      virtual StatusCode initialize() { return m_geo.retrieve(); };
     
     private:
       
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       /// A tool handle to the geo model tool
-      const ToolHandle<IInDetGeoModelTool> geo;
+      const ToolHandle<IInDetGeoModelTool> m_geo;
 
       /// The StoreGate key for the PixelRDO container
       std::string m_PixelRDOContainerName;
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SCTRDORetriever.h b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SCTRDORetriever.h
index 73d20e704d4..56025f9bfea 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SCTRDORetriever.h
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SCTRDORetriever.h
@@ -41,7 +41,7 @@ namespace JiveXML {
     virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool);    
 
     /// Return the name of the data type
-    virtual std::string dataTypeName() const { return typeName; };
+    virtual std::string dataTypeName() const { return m_typeName; };
     
     /// Only retrieve geo tool in initialize
     virtual StatusCode initialize();
@@ -49,10 +49,10 @@ namespace JiveXML {
   private:
     
     ///The data type that is generated by this retriever
-    const std::string typeName;
+    const std::string m_typeName;
     
     /// A tool handle to the geo model tool
-    const ToolHandle<IInDetGeoModelTool> geo;
+    const ToolHandle<IInDetGeoModelTool> m_geo;
 
     /// The StoreGate key for the SCTRDO container
     SG::ReadHandleKey<SCT_RDO_Container> m_SCTRDOContainerName;
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SiClusterRetriever.h b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SiClusterRetriever.h
index b613c0c5bde..12b96bd7019 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SiClusterRetriever.h
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SiClusterRetriever.h
@@ -45,18 +45,18 @@ namespace JiveXML
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; }
+      virtual std::string dataTypeName() const { return m_typeName; }
 
       /// initialize only geo model tool
-      virtual StatusCode initialize() { return geo.retrieve(); }
+      virtual StatusCode initialize() { return m_geo.retrieve(); }
 
     private:
       
       /// The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       /// A tool handle to the geo model tool
-      const ToolHandle<IInDetGeoModelTool> geo;
+      const ToolHandle<IInDetGeoModelTool> m_geo;
    
       /// The StoreGate key for the SiClusterCollection to retrieve
       std::string m_SiClusterCollName;
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SiSpacePointRetriever.h b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SiSpacePointRetriever.h
index fe5d586af58..49010736801 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SiSpacePointRetriever.h
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/SiSpacePointRetriever.h
@@ -44,7 +44,7 @@ namespace JiveXML{
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
       /// Only retrieve geo tool in initialize
       virtual StatusCode initialize();
@@ -52,10 +52,10 @@ namespace JiveXML{
     private:
       
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       /// A tool handle to the geo model tool
-      const ToolHandle<IInDetGeoModelTool> geo;
+      const ToolHandle<IInDetGeoModelTool> m_geo;
      
       /** StoreGate key for Pixel space points*/
       SG::ReadHandleKey<SpacePointContainer> m_PixelSPContainerName;
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/TRTRetriever.h b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/TRTRetriever.h
index 6d69554e766..c4e82d10588 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/TRTRetriever.h
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/InDetJiveXML/TRTRetriever.h
@@ -52,7 +52,7 @@ namespace JiveXML{
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
       /// initialize only geo model tool
       virtual StatusCode initialize();
@@ -60,10 +60,10 @@ namespace JiveXML{
     private:
       
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
       
       /// A tool handle to the geo model tool
-      const ToolHandle<IInDetGeoModelTool> geo;
+      const ToolHandle<IInDetGeoModelTool> m_geo;
 
       /// The StoreGate key for the TRT Cluster collection to retrieve
       SG::ReadHandleKey<InDet::TRT_DriftCircleContainer> m_TRTDriftCircleCollKey{ this, "TRTClusters", "TRT_DriftCircles", "Container name for TRT Drift Circles" }; 
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/src/BeamSpotRetriever.cxx b/InnerDetector/InDetEventCnv/InDetJiveXML/src/BeamSpotRetriever.cxx
index 030bef860ab..50dd4142a70 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/src/BeamSpotRetriever.cxx
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/src/BeamSpotRetriever.cxx
@@ -17,7 +17,7 @@ namespace JiveXML {
    * @param parent AlgTools parent owning this tool
    **/
   BeamSpotRetriever::BeamSpotRetriever(const std::string& type,const std::string& name,const IInterface* parent):
-    AthAlgTool(type,name,parent), typeName("BeamSpot"), m_beamSpotSvc("BeamCondSvc",name){
+    AthAlgTool(type,name,parent), m_typeName("BeamSpot"), m_beamSpotSvc("BeamCondSvc",name){
     
     //Declare the interface
     declareInterface<IDataRetriever>(this);
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/src/PixelClusterRetriever.cxx b/InnerDetector/InDetEventCnv/InDetJiveXML/src/PixelClusterRetriever.cxx
index bade266cc79..34854d072ec 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/src/PixelClusterRetriever.cxx
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/src/PixelClusterRetriever.cxx
@@ -29,8 +29,8 @@ namespace JiveXML {
    **/
   PixelClusterRetriever::PixelClusterRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("PixCluster"),
-    geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
+    m_typeName("PixCluster"),
+    m_geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -97,7 +97,7 @@ namespace JiveXML {
       const InDet::SiClusterCollection* SiClusterColl = (*SiClusterCollItr);
 
       //Only run on Pixel clusters
-      if ( ! geo->PixelIDHelper()->is_pixel(SiClusterColl->identify())) continue ;
+      if ( ! m_geo->PixelIDHelper()->is_pixel(SiClusterColl->identify())) continue ;
 
       //Now loop over all clusters in that collection 
       InDet::SiClusterCollection::const_iterator SiClusterItr = SiClusterColl->begin();
@@ -108,8 +108,8 @@ namespace JiveXML {
         const InDet::PixelCluster *cluster = dynamic_cast<const InDet::PixelCluster*>(sicluster);
         
         //and the detector element for that cluster via the id
-        Identifier id = geo->PixelIDHelper()->wafer_id(cluster->identify());
-        InDetDD::SiDetectorElement* element = geo->PixelGeoManager()->getDetectorElement(id);
+        Identifier id = m_geo->PixelIDHelper()->wafer_id(cluster->identify());
+        InDetDD::SiDetectorElement* element = m_geo->PixelGeoManager()->getDetectorElement(id);
         if (!element){
           if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Could not obtain Detector Element with ID " << id << endmsg;
           continue ;
@@ -126,8 +126,8 @@ namespace JiveXML {
         //Get the cluster id
         Identifier clusterId = cluster->identify();
         ident.push_back(DataType(clusterId.get_compact()));
-        phiModule.push_back(DataType(geo->PixelIDHelper()->phi_module(clusterId)));
-        etaModule.push_back(DataType(geo->PixelIDHelper()->eta_module(clusterId)));
+        phiModule.push_back(DataType(m_geo->PixelIDHelper()->phi_module(clusterId)));
+        etaModule.push_back(DataType(m_geo->PixelIDHelper()->eta_module(clusterId)));
         
         //Only process truth if its there
         if ( simClusterMap == NULL ) continue;
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/src/PixelRDORetriever.cxx b/InnerDetector/InDetEventCnv/InDetJiveXML/src/PixelRDORetriever.cxx
index 6ac3a15f84b..ca2b25da40f 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/src/PixelRDORetriever.cxx
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/src/PixelRDORetriever.cxx
@@ -24,8 +24,8 @@ namespace JiveXML {
    **/
   PixelRDORetriever::PixelRDORetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("PixelRDO"),
-    geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
+    m_typeName("PixelRDO"),
+    m_geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
     
     //Declare the interface
     declareInterface<IDataRetriever>(this);
@@ -72,7 +72,7 @@ namespace JiveXML {
         const Identifier id = rdoData->identify();
 
         //Get the detector element
-        const InDetDD::SiDetectorElement *element = geo->PixelGeoManager()->getDetectorElement(id);
+        const InDetDD::SiDetectorElement *element = m_geo->PixelGeoManager()->getDetectorElement(id);
 
         //Make sure we got the detector element
         if (element == NULL){
@@ -89,8 +89,8 @@ namespace JiveXML {
         xVec.push_back(DataType(globalPos.x()*CLHEP::mm/CLHEP::cm));
         yVec.push_back(DataType(globalPos.y()*CLHEP::mm/CLHEP::cm));
         zVec.push_back(DataType(globalPos.z()*CLHEP::mm/CLHEP::cm));
-        phiModuleVec.push_back(DataType(geo->PixelIDHelper()->phi_module(id)));
-        etaModuleVec.push_back(DataType(geo->PixelIDHelper()->eta_module(id)));
+        phiModuleVec.push_back(DataType(m_geo->PixelIDHelper()->phi_module(id)));
+        etaModuleVec.push_back(DataType(m_geo->PixelIDHelper()->eta_module(id)));
       }
     }
 
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/src/SCTRDORetriever.cxx b/InnerDetector/InDetEventCnv/InDetJiveXML/src/SCTRDORetriever.cxx
index bd0c17484b7..24f0a899004 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/src/SCTRDORetriever.cxx
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/src/SCTRDORetriever.cxx
@@ -24,8 +24,8 @@ namespace JiveXML {
    **/
   SCTRDORetriever::SCTRDORetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("SCTRDO"),
-    geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
+    m_typeName("SCTRDO"),
+    m_geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
 
     //Declare the interface
     declareInterface<IDataRetriever>(this);
@@ -97,7 +97,7 @@ namespace JiveXML {
         Identifier id = rdoData->identify();
 
         //Get the hit detector element
-        const InDetDD::SiDetectorElement *element = geo->SCTGeoManager()->getDetectorElement(id);
+        const InDetDD::SiDetectorElement *element = m_geo->SCTGeoManager()->getDetectorElement(id);
         //Make sure we got the detector element
         if (element == NULL){
           msg(MSG::WARNING) << "Unable to obtain detector element for SCT_RDO hit with id " << id << endmsg;
@@ -114,8 +114,8 @@ namespace JiveXML {
         x1.push_back(DataType( endsOfStrip.second.x()*CLHEP::mm/CLHEP::cm));
         y1.push_back(DataType( endsOfStrip.second.y()*CLHEP::mm/CLHEP::cm));
         z1.push_back(DataType( endsOfStrip.second.z()*CLHEP::mm/CLHEP::cm));
-        phiModule.push_back(DataType( geo->SCTIDHelper()->phi_module(id) ));
-        etaModule.push_back(DataType( geo->SCTIDHelper()->eta_module(id) ));
+        phiModule.push_back(DataType( m_geo->SCTIDHelper()->phi_module(id) ));
+        etaModule.push_back(DataType( m_geo->SCTIDHelper()->eta_module(id) ));
 
         //Check if we have rdoData3
         const SCT3_RawData *rdoData3 = dynamic_cast<const SCT3_RawData *>(rdoData);
@@ -170,7 +170,7 @@ namespace JiveXML {
     // Read Handle Key
     ATH_CHECK( m_SCTRDOContainerName.initialize() );
 
-    return geo.retrieve();
+    return m_geo.retrieve();
   }
 
 } //namespace
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/src/SiClusterRetriever.cxx b/InnerDetector/InDetEventCnv/InDetJiveXML/src/SiClusterRetriever.cxx
index 72e5f4770af..c86a5498e6a 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/src/SiClusterRetriever.cxx
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/src/SiClusterRetriever.cxx
@@ -28,8 +28,8 @@ namespace JiveXML {
    **/
   SiClusterRetriever::SiClusterRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("STC"),
-    geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
+    m_typeName("STC"),
+    m_geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -98,7 +98,7 @@ namespace JiveXML {
       const InDet::SiClusterCollection* SiClusterColl = (*SiClusterCollItr);
 
       //Only run on silicon (SCT) clusters
-      if ( ! geo->SCTIDHelper()->is_sct(SiClusterColl->identify())) continue ;
+      if ( ! m_geo->SCTIDHelper()->is_sct(SiClusterColl->identify())) continue ;
 
       //Now loop over all clusters in that collection 
       InDet::SiClusterCollection::const_iterator SiClusterItr = SiClusterColl->begin();
@@ -108,8 +108,8 @@ namespace JiveXML {
         const InDet::SiCluster* cluster = (*SiClusterItr);
         
         //and the detector element for that cluster via the id
-        Identifier id = geo->SCTIDHelper()->wafer_id(cluster->identify());
-        InDetDD::SiDetectorElement* element = geo->SCTGeoManager()->getDetectorElement(id);
+        Identifier id = m_geo->SCTIDHelper()->wafer_id(cluster->identify());
+        InDetDD::SiDetectorElement* element = m_geo->SCTGeoManager()->getDetectorElement(id);
         if (!element){
           if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Could not obtain Detector Element with ID " << id << endmsg;
           continue ;
@@ -134,9 +134,9 @@ namespace JiveXML {
         //Get the cluster id
         Identifier clusterId = cluster->identify();
         ident.push_back(DataType(clusterId.get_compact()));
-        phiModule.push_back(DataType(geo->SCTIDHelper()->phi_module(clusterId)));
-        etaModule.push_back(DataType(geo->SCTIDHelper()->eta_module(clusterId)));
-        side.push_back(DataType(geo->SCTIDHelper()->side(clusterId)));
+        phiModule.push_back(DataType(m_geo->SCTIDHelper()->phi_module(clusterId)));
+        etaModule.push_back(DataType(m_geo->SCTIDHelper()->eta_module(clusterId)));
+        side.push_back(DataType(m_geo->SCTIDHelper()->side(clusterId)));
         
         //Only process truth if its there
         if ( simClusterMap == NULL ) continue;
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/src/SiSpacePointRetriever.cxx b/InnerDetector/InDetEventCnv/InDetJiveXML/src/SiSpacePointRetriever.cxx
index dd6cca09bc8..ed71b3b61bd 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/src/SiSpacePointRetriever.cxx
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/src/SiSpacePointRetriever.cxx
@@ -28,8 +28,8 @@ namespace JiveXML
    **/
   SiSpacePointRetriever::SiSpacePointRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("S3D"),
-    geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
+    m_typeName("S3D"),
+    m_geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
 
     //Declare the interface
     declareInterface<IDataRetriever>(this);
@@ -209,8 +209,8 @@ namespace JiveXML
           Identifier idSecond = (clusterList.second != NULL) ? clusterList.second->identify() : Identifier();
 
           //Get phi and eta of the module in detector coordinates of the first cluster
-          phiModule.push_back(DataType(geo->SCTIDHelper()->phi_module(idFirst)));
-          etaModule.push_back(DataType(geo->SCTIDHelper()->eta_module(idFirst)));
+          phiModule.push_back(DataType(m_geo->SCTIDHelper()->phi_module(idFirst)));
+          etaModule.push_back(DataType(m_geo->SCTIDHelper()->eta_module(idFirst)));
 
           // Store the cluster(s) identifier (pair)
           clusters.push_back(DataType(idFirst.get_compact()));   
@@ -261,7 +261,7 @@ namespace JiveXML
     ATH_CHECK(m_PixelPRDTruthName.initialize());
     ATH_CHECK(m_SCTPRDTruthName.initialize());
 
-    return geo.retrieve();
+    return m_geo.retrieve();
   }
   
 } //namespace
diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/src/TRTRetriever.cxx b/InnerDetector/InDetEventCnv/InDetJiveXML/src/TRTRetriever.cxx
index 233ecc3ca7b..ff9a469d2ec 100755
--- a/InnerDetector/InDetEventCnv/InDetJiveXML/src/TRTRetriever.cxx
+++ b/InnerDetector/InDetEventCnv/InDetJiveXML/src/TRTRetriever.cxx
@@ -24,15 +24,15 @@ namespace JiveXML {
    **/
   TRTRetriever::TRTRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("TRT"),
-    geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
+    m_typeName("TRT"),
+    m_geo("JiveXML::InDetGeoModelTool/InDetGeoModelTool",this){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
   }
 
   StatusCode TRTRetriever::initialize() {
-    ATH_CHECK( geo.retrieve() );
+    ATH_CHECK( m_geo.retrieve() );
     ATH_CHECK( m_TRTDriftCircleCollKey.initialize() );
     m_useTRTTruthMap = !m_TRTTruthMapKey.key().empty();
     ATH_CHECK( m_TRTTruthMapKey.initialize(m_useTRTTruthMap) );
@@ -92,7 +92,7 @@ namespace JiveXML {
       for ( ; DriftCircleCollItr != DriftCircleColl->end(); ++DriftCircleCollItr){
 
         //Get the drift cirlce itself and its unique identifier
-        InDet::TRT_DriftCircle* driftcircle = (*DriftCircleCollItr);
+        const InDet::TRT_DriftCircle* driftcircle = (*DriftCircleCollItr);
 
         //In verbose mode, print out drift circle information
         if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Retrieving information from " << (*driftcircle) << endmsg;
@@ -112,10 +112,10 @@ namespace JiveXML {
          * NOTE: to get rhoz and phi, obtain DetectorElement
          * and then change to hashid - faster
          */
-        const InDetDD::TRT_BaseElement* element = geo->TRTGeoManager()->getElement(geo->TRTIDHelper()->layer_id(id));
+        const InDetDD::TRT_BaseElement* element = m_geo->TRTGeoManager()->getElement(m_geo->TRTIDHelper()->layer_id(id));
 
         //get global coord of straw
-	Amg::Vector3D global  = element->strawTransform(geo->TRTIDHelper()->straw(id))*Amg::Vector3D(0.,0.,0.);
+	Amg::Vector3D global  = element->strawTransform(m_geo->TRTIDHelper()->straw(id))*Amg::Vector3D(0.,0.,0.);
         
         //store the phi value
         phi.push_back(DataType( (global.phi()<0) ? global.phi() + 2*M_PI : global.phi()));
@@ -133,7 +133,7 @@ namespace JiveXML {
         driftR.push_back(DataType((driftcircle->localPosition())[Trk::driftRadius]*CLHEP::mm/CLHEP::cm));
 
         //Get subdetector number
-        switch ( geo->TRTIDHelper()->barrel_ec(id) ) {
+        switch ( m_geo->TRTIDHelper()->barrel_ec(id) ) {
           case -2 : sub.push_back(DataType( 0 )); break;
           case -1 : sub.push_back(DataType( 1 )); break;
           case  1 : sub.push_back(DataType( 2 )); break;
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
index f0aabb3cb27..35325443a47 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
@@ -147,7 +147,7 @@ StatusCode PixelPrepDataToxAOD::execute()
     if( clusterCollection->empty() ) continue;
     
     // loop over collection and convert to xAOD
-    for( auto& prd : *clusterCollection ){    
+    for( const InDet::PixelCluster* prd : *clusterCollection ){    
       ++counter;
 
       Identifier clusterId = prd->identify();
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx
index 71a457e9667..ee9c49504b8 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx
@@ -150,7 +150,7 @@ StatusCode SCT_PrepDataToxAOD::execute()
 
          
     // loop over collection and convert to xAOD
-    for( auto& prd : *clusterCollection ){
+    for( const InDet::SCT_Cluster* prd : *clusterCollection ){
       ++counter;
       
       Identifier clusterId = prd->identify();
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/TRT_PrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/TRT_PrepDataToxAOD.cxx
index a3aed6663a3..e5e533fe34e 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/TRT_PrepDataToxAOD.cxx
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/TRT_PrepDataToxAOD.cxx
@@ -100,8 +100,8 @@ StatusCode TRT_PrepDataToxAOD::execute()
 {
   //This is needed for the algorithm. If not there, it fails
 
-  SG::ReadHandle<InDet::TRT_DriftCircleContainer> m_trtPrds(m_driftcirclecontainer);
-  if (not m_trtPrds.isValid()) {
+  SG::ReadHandle<InDet::TRT_DriftCircleContainer> h_trtPrds(m_driftcirclecontainer);
+  if (not h_trtPrds.isValid()) {
     ATH_MSG_ERROR("Cannot retrieve TRT PrepDataContainer " << m_driftcirclecontainer.key());
     return StatusCode::FAILURE;
   }
@@ -111,12 +111,12 @@ StatusCode TRT_PrepDataToxAOD::execute()
 
   const PRD_MultiTruthCollection* prdmtColl = 0; // to be used in the loop later
   if (m_useTruthInfo && (!m_multiTruth.key().empty())  ) {
-    SG::ReadHandle<PRD_MultiTruthCollection> m_prdmtColl(m_multiTruth);
-    if (not m_prdmtColl.isValid()){
+    SG::ReadHandle<PRD_MultiTruthCollection> h_prdmtColl(m_multiTruth);
+    if (not h_prdmtColl.isValid()){
       if (m_firstEventWarnings) {
 	ATH_MSG_WARNING("PRD MultiTruth collection not available (" << m_multiTruth.key() << "). Skipping this info although requested.");}
     } else {
-      prdmtColl = m_prdmtColl.cptr();
+      prdmtColl = h_prdmtColl.cptr();
     }
   }
 
@@ -125,12 +125,12 @@ StatusCode TRT_PrepDataToxAOD::execute()
 
   const InDetSimDataCollection* sdoCollection = 0; // to be used in the loop later
   if (m_writeSDOs && m_useTruthInfo && (!m_SDOcontainer.key().empty()) ) {
-    SG::ReadHandle<InDetSimDataCollection> m_sdoCollection(m_SDOcontainer);
-    if (not m_sdoCollection.isValid()) {
+    SG::ReadHandle<InDetSimDataCollection> h_sdoCollection(m_SDOcontainer);
+    if (not h_sdoCollection.isValid()) {
       if (m_firstEventWarnings){
 	ATH_MSG_WARNING("SDO Collection not available (" << m_SDOcontainer.key() << "). Skipping this info although requested.");}
     } else{
-      sdoCollection = m_sdoCollection.cptr();
+      sdoCollection = h_sdoCollection.cptr();
     }
   }
 
@@ -142,8 +142,8 @@ StatusCode TRT_PrepDataToxAOD::execute()
   SG::WriteHandle<std::vector<unsigned int>> offsets(m_xAodOffset);
   ATH_CHECK(offsets.record(std::make_unique<std::vector<unsigned int>>(m_TRTHelper->straw_layer_hash_max() , 0)  ));
   
-  InDet::TRT_DriftCircleContainer::const_iterator it = m_trtPrds->begin();
-  InDet::TRT_DriftCircleContainer::const_iterator it_end = m_trtPrds->end();
+  InDet::TRT_DriftCircleContainer::const_iterator it = h_trtPrds->begin();
+  InDet::TRT_DriftCircleContainer::const_iterator it_end = h_trtPrds->end();
   unsigned int counter(0);
   for( ; it!=it_end; ++it ) {
 
diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx
index b4093f54006..17200a177d6 100644
--- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx
+++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx
@@ -53,6 +53,7 @@ PixelRodDecoder::PixelRodDecoder
       m_maxNumBCIDWarnings(50),
       m_pixelCabling("PixelCablingSvc",name),
       m_pixel_id(nullptr),
+      m_det(eformat::SubDetector()),
       m_cablingData(nullptr),
       m_condsummary("PixelConditionsSummarySvc",name),
       m_errors("PixelByteStreamErrorsSvc",name)
diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodEncoder.cxx b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodEncoder.cxx
index 3b6f787fffc..35937a67019 100644
--- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodEncoder.cxx
+++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodEncoder.cxx
@@ -214,7 +214,6 @@ void PixelRodEncoder::fillROD(std::vector<uint32_t>& v32rod, MsgStream& log, int
 #ifdef PIXEL_DEBUG
 	    log << MSG::DEBUG << "(before) empty Pixel Module header/trailer pair written for BCID " << fake_BCID << endmsg;
 #endif
-	    last_BCID = fake_BCID;  
 	    fake_BCID++;
 	  } // end while cycle "while ((fake_BCID < BCID) && !timing_error)"
 
@@ -336,7 +335,6 @@ void PixelRodEncoder::fillROD(std::vector<uint32_t>& v32rod, MsgStream& log, int
 #ifdef PIXEL_DEBUG
 	    log << MSG::DEBUG << "(before) empty IBL Module header/trailer pair written for BCID " << fake_BCID << endmsg;
 #endif
-	    last_BCID = fake_BCID;  
 	    fake_BCID++;
 	  } // end while cycle "while ((fake_BCID < BCID) && !timing_error)"
 
diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodEncoder.h b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodEncoder.h
index 76e840c983d..4646141cf21 100644
--- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodEncoder.h
+++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodEncoder.h
@@ -61,7 +61,7 @@ public:
   }
   
   // setCablingSvc
-  void set_pixelCabling(ServiceHandle<IPixelCablingSvc> pixelCabling) { 
+  void set_pixelCabling(const ServiceHandle<IPixelCablingSvc>& pixelCabling) {
     m_pixelCabling = pixelCabling;
   }
 
@@ -112,7 +112,7 @@ class OrderRdos {
 
  public :
   
- OrderRdos(Identifier offlineId, ServiceHandle<IPixelCablingSvc> pixelCabling): 
+ OrderRdos(Identifier offlineId, const ServiceHandle<IPixelCablingSvc>& pixelCabling):
   m_pixelCabling("dummy","dummy") ,  m_offlineId(offlineId) 
   { m_pixelCabling = pixelCabling; }
   
@@ -141,7 +141,7 @@ class OrderInitialRdos {
   
   // OrderInitialRdos(Identifier offlineId, ServiceHandle<IPixelCablingSvc> pixelCabling, const PixelID * pixelID): 
   //  m_pixelCabling("dummy","dummy") ,  m_offlineId(offlineId) , m_PixelID(pixelID)
- OrderInitialRdos(ServiceHandle<IPixelCablingSvc> pixelCabling, const PixelID * pixelID): 
+ OrderInitialRdos(const ServiceHandle<IPixelCablingSvc>& pixelCabling, const PixelID * pixelID):
   m_pixelCabling("dummy","dummy") , m_PixelID(pixelID)
   { m_pixelCabling = pixelCabling; }
   
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py
index 4da6b4fd59d..c1e59b98030 100644
--- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py
@@ -407,9 +407,9 @@ if DetFlags.haveRIO.TRT_on():
     if not conddb.folderRequested('/TRT/Calib/T0'):
         conddb.addFolderSplitOnline("TRT","/TRT/Onl/Calib/T0","/TRT/Calib/T0",className='TRTCond::StrawT0MultChanContainer')
     if not conddb.folderRequested('/TRT/Calib/errors2d'):
-        conddb.addFolderSplitOnline ("TRT","/TRT/Onl/Calib/errors2d","/TRT/Calib/errors2d",className='TRTCond::RtRelationMultChanContainer')
+        TRTErrorsFolder = conddb.addFolderSplitOnline ("TRT","/TRT/Onl/Calib/errors2d","/TRT/Calib/errors2d",className='TRTCond::RtRelationMultChanContainer')
     if not conddb.folderRequested('/TRT/Calib/slopes'):
-        conddb.addFolderSplitOnline ("TRT","/TRT/Onl/Calib/slopes","/TRT/Calib/slopes",className='TRTCond::RtRelationMultChanContainer')
+        TRTSlopesFolder = conddb.addFolderSplitOnline ("TRT","/TRT/Onl/Calib/slopes","/TRT/Calib/slopes",className='TRTCond::RtRelationMultChanContainer')
         
     if not conddb.folderRequested('/TRT/Calib/ToTCalib'):
         conddb.addFolderSplitOnline("TRT","/TRT/Onl/Calib/ToTCalib","/TRT/Calib/ToTCalib")
@@ -420,6 +420,8 @@ if DetFlags.haveRIO.TRT_on():
     # Calibration DB Service
     from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc
     InDetTRTCalDbSvc = TRT_CalDbSvc()
+    InDetTRTCalDbSvc.ErrorReadKeyName = TRTErrorsFolder
+    InDetTRTCalDbSvc.SlopeReadKeyName = TRTSlopesFolder
     ServiceMgr += InDetTRTCalDbSvc
     if(InDetFlags.doPrintConfigurables()):
         print InDetTRTCalDbSvc
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx
index 9abe47a7511..f8ef813a53c 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx
@@ -201,7 +201,6 @@ IDAlignMonEfficiencies::IDAlignMonEfficiencies( const std::string & type, const
    m_trtID(0),
    m_PIX_Mgr(0),
    m_SCT_Mgr(0),
-   m_Pi(3.14156),
    m_NPixLayers(0),
    m_events(0),
    m_histosBooked(0),
@@ -830,7 +829,7 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
   }
   
   // get TrackCollection
-  DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
+  const DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
   DataVector<Trk::Track>::const_iterator trksItr  = trks->begin();
   DataVector<Trk::Track>::const_iterator trksItrE = trks->end();
   for (; trksItr != trksItrE; ++trksItr) {
@@ -2234,14 +2233,14 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 
 
   int nHits = 0;
-  for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsos2=trk->trackStateOnSurfaces()->begin();tsos2!=trk->trackStateOnSurfaces()->end(); ++tsos2) {
+  for (const Trk::TrackStateOnSurface* tsos2 : *trk->trackStateOnSurfaces()) {
 
     int detType2 = -99; 
     int barrelEC2 = -99;
     int layerDisk2 = -99;
     int modEta2 = -99; 
     int modPhi2 = -99;
-    const Trk::MeasurementBase* hit2 =(*tsos2)->measurementOnTrack();
+    const Trk::MeasurementBase* hit2 =tsos2->measurementOnTrack();
     if (hit2== NULL) continue;//the first hit on the track never has associated hit information - just stores track parameters
     nHits++;
         
@@ -2275,7 +2274,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
     if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "testing hit " << nHits << " for overlap, detType2 = " << detType2 
 	       << ", modEta2 = " << modEta2 << ", modPhi2 = " << modPhi2 << endmsg;
 
-    if(!(*tsos2)->type(Trk::TrackStateOnSurface::Measurement)) {
+    if(!tsos2->type(Trk::TrackStateOnSurface::Measurement)) {
       if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because hit is an outlier" << endmsg;
       continue;
     }
@@ -2310,10 +2309,10 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
       }
     }
 
-    //const Trk::TrackParameters* trackParameter = (*tsos2)->trackParameters();
+    //const Trk::TrackParameters* trackParameter = tsos2->trackParameters();
     //const Trk::MeasuredTrackParameters* measuredTrackParameter = dynamic_cast<const Trk::MeasuredTrackParameters*>(trackParameter);
 
-    const Trk::TrackParameters* TrackParameters = (*tsos2)->trackParameters();
+    const Trk::TrackParameters* TrackParameters = tsos2->trackParameters();
     if (!TrackParameters)
       continue;
     const AmgSymMatrix(5)* covariance = TrackParameters->covariance();
@@ -2330,7 +2329,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
       if((detType2==0 || detType2==1) && m_doHitQuality) {
 	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to overlap hit..." << endmsg;
 	
-	hit2 = m_hitQualityTool->getGoodHit(*tsos2);
+	hit2 = m_hitQualityTool->getGoodHit(tsos2);
 	if(hit2==NULL) {
 	  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because failed hit quality cuts." << endmsg;
 	  continue;
@@ -2381,7 +2380,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module phi, eta  = " << modEta <<", "<<modPhi<< endmsg;
 	//if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "overlap module radius = " << radius2 << endmsg;
 	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "second module phi, eta  = " << modEta2 <<", "<<modPhi2<< endmsg;
-	xOverlap = (*tsos2);
+	xOverlap = (tsos2);
       } //added by LT
       
     }
@@ -2390,7 +2389,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
       if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "***** identified local Y overlap" << endmsg;
       //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module radius = " << radius << endmsg;
       //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "overlap module radius = " << radius2 << endmsg;
-      yOverlap = (*tsos2);
+      yOverlap = (tsos2);
     }
     if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "modEta2 = " << modEta2 << endmsg;
     if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "modPhi2 = " << modPhi2 << endmsg;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h
index 922cfe7e1c2..7c075e7e36c 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h
@@ -429,7 +429,6 @@ class IDAlignMonEfficiencies : public ManagedMonitorToolBase
 	
   //const InDetDD::TRT_DetectorManager    *m_TRT_Mgr;
 
-  const float m_Pi;
   std::string m_stream;
   std::string m_tracksName;
   ToolHandle<Trk::ITrackSummaryTool> m_trackSumTool;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
index 03c5d3dc71f..33d2fedd3fe 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
@@ -1654,7 +1654,7 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
 
   
   //get tracks
-  DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
+  const DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
   //const DataVector<xAOD::TrackParticle>* trkPs = m_trackSelection->selectTracksParticle(m_tracksName);
 
 
@@ -2411,7 +2411,7 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
       qOverP   = perigeeParams[Trk::qOverP]*1000.;
       trketa   = measPer->eta(); 
       if (qOverP < 0) charge = -1;
-      else charge =+ 1; 
+      else charge = 1; 
     }   
     if(trkpt > ptlast && trkpt < ptfirst && chargefirst*charge < 0 && trkpt > 20){
       z_E[1]   = fabs(trkpt / sin(trktheta));
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h
index 03f448042ab..32d04bf2fa5 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h
@@ -418,7 +418,7 @@ protected:
   std::string m_triggerChainName;
   float m_barrelEta;
   const xAOD::VertexContainer* m_vertices;
-  xAOD::Vertex* m_pvtx;
+  const xAOD::Vertex* m_pvtx;
   bool m_doHitQuality;
   bool m_extendedPlots;
   float m_d0Range;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx
index 67f5719fe9a..e98b414e7f2 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx
@@ -325,8 +325,7 @@ StatusCode IDAlignMonNtuple::fillHistograms()
     int nHits = 0;
 
     //looping over the hits
-    for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator iter_tsos=(track->trackStateOnSurfaces()->begin());
-	 iter_tsos!=track->trackStateOnSurfaces()->end() &&  nHits < s_n_maxHits; ++iter_tsos) {//looping over hits
+    for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
 
       float residualX = s_n_ERRORVALUE; float residualY = s_n_ERRORVALUE;
       float biasedResidualX = s_n_ERRORVALUE; float biasedResidualY = s_n_ERRORVALUE;
@@ -340,45 +339,45 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 
       if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TSOS (hit) = " << nHits << endmsg;       
 
-      if ((*iter_tsos) == NULL) continue;
+      if (tsos == nullptr) continue;
 
       //determining type of TSOS object - can represent many different track elements
-      if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Measurement)) {
+      if (tsos->type(Trk::TrackStateOnSurface::Measurement)) {
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Measurement" << endmsg;
 	hitType = 0;
       }
-      else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::InertMaterial)) {
+      else if (tsos->type(Trk::TrackStateOnSurface::InertMaterial)) {
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::InertMaterial" << endmsg;
 	hitType = 1;
       }
-      else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::BremPoint)) {
+      else if (tsos->type(Trk::TrackStateOnSurface::BremPoint)) {
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::BremPoint" << endmsg;
 	hitType = 2;
       }
-      else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Scatterer)) {
+      else if (tsos->type(Trk::TrackStateOnSurface::Scatterer)) {
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Scatterer" << endmsg;
 	hitType = 3;
       }
-      else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Perigee)) {
+      else if (tsos->type(Trk::TrackStateOnSurface::Perigee)) {
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Perigee" << endmsg;
 	hitType = 4;
       }
-      else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Outlier)) {
+      else if (tsos->type(Trk::TrackStateOnSurface::Outlier)) {
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Outlier" << endmsg;
 	hitType = 5;
       }
-      else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Hole)) {
+      else if (tsos->type(Trk::TrackStateOnSurface::Hole)) {
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Hole" << endmsg;
 	hitType = 6;
       }
-      else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Unknown)) {
+      else if (tsos->type(Trk::TrackStateOnSurface::Unknown)) {
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Unknown" << endmsg;
 	hitType = 7;
       }
       else if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unrecognised Trk::TrackStateOnSurface Type" << endmsg;
 
 
-      const Trk::MeasurementBase* mesh =(*iter_tsos)->measurementOnTrack();
+      const Trk::MeasurementBase* mesh =tsos->measurementOnTrack();
       if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined  hit MeasurementBase " << endmsg;
          
       //Trk::RIO_OnTrack object contains information on the hit used to fit the track at this surface
@@ -464,7 +463,7 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is pixel or SCT, finding residuals... " << endmsg;
 
-	const Trk::TrackParameters* trackParameter = (*iter_tsos)->trackParameters();
+	const Trk::TrackParameters* trackParameter = tsos->trackParameters();
 
 	//alternative method used by Oleg in his HitQualitySelection tool to get cluster width
 	const std::vector<Identifier> idVec = (hit->prepRawData())->rdoList() ;
@@ -501,7 +500,7 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	  
 	  //finding unbiased single residuals
 	  StatusCode sc;
-	  sc = getSiResiduals(track,*iter_tsos,true,unbiasedResXY);
+	  sc = getSiResiduals(track,tsos,true,unbiasedResXY);
 	  if (sc.isFailure()) {
 	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining unbiased residuals! Hit is skipped." << endmsg;
 	    //return StatusCode::SUCCESS;
@@ -515,7 +514,7 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 
 	  
 	  //finding biased single residuals (for interest)
-	  sc = getSiResiduals(track,*iter_tsos,false,biasedResXY);
+	  sc = getSiResiduals(track,tsos,false,biasedResXY);
 	  if (sc.isFailure()) {
 	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining biased residuals! Hit is skipped." << endmsg;
 	    //return StatusCode::SUCCESS;
@@ -838,14 +837,14 @@ const Trk::TrackParameters* IDAlignMonNtuple::getUnbiasedTrackParameters(const T
     const Trk::TrackStateOnSurface* OtherModuleSideHit(0);
     const Identifier& OtherModuleSideID = m_SCT_Mgr->getDetectorElement(surfaceID)->otherSide()->identify();
       
-    for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator TempTsos=trkPnt->trackStateOnSurfaces()->begin();TempTsos!=trkPnt->trackStateOnSurfaces()->end(); ++TempTsos) {
+    for (const Trk::TrackStateOnSurface* TempTsos : *trkPnt->trackStateOnSurfaces()) {
         
-      const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>((*TempTsos)->measurementOnTrack());
+      const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(TempTsos->measurementOnTrack());
       if (hitOnTrack != 0) {
 	const Identifier& trkID = hitOnTrack->identify();
 	if (m_sctID->wafer_id(trkID) == OtherModuleSideID) {
 	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "True unbiased residual. Removing OtherModuleSide Hit " << m_idHelper->show_to_string(OtherModuleSideID,0,'/') << endmsg;
-	  OtherModuleSideHit = *TempTsos;
+	  OtherModuleSideHit = TempTsos;
 	}
       }
     }
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx
index 33519e93975..1d451048059 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx
@@ -59,8 +59,7 @@ IDAlignMonPVBiases::IDAlignMonPVBiases( const std::string & type, const std::str
   m_histosBooked(0),
   m_tracksName("ExtendedTracks"),
   m_triggerChainName("NoTriggerSelection"),
-  m_trackToVertexIPEstimator("Trk::TrackToVertexIPEstimator"), 
-  m_vertices(0)
+  m_trackToVertexIPEstimator("Trk::TrackToVertexIPEstimator")
   //m_TreeFolder("/PVbiases/PVbiases"),
   //m_Tree(0),
   //m_TreeName("PVbiases")
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
index ec8fbb02dc6..154d439d00e 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
@@ -149,7 +149,6 @@ private:
   std::string m_triggerChainName;
   std::string m_VxPrimContainerName;
   ToolHandle< Trk::ITrackToVertexIPEstimator >  m_trackToVertexIPEstimator;
-  const xAOD::VertexContainer* m_vertices;
   //std::string m_TreeFolder;
   //TTree* m_Tree;
   //std::string m_TreeName;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
index 25169390e99..9c6d5e26992 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
@@ -1212,7 +1212,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
   // NB the weight is a "per track" weight, so histograms such as BS info are never weighted
 
 	
-  DataVector<Trk::Track>* tracks = m_trackSelection->selectTracks(m_tracksName);
+  const DataVector<Trk::Track>* tracks = m_trackSelection->selectTracks(m_tracksName);
   if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "IDAlignMonResiduals::fillHistograms() -- event: " << m_events
 					 << " with Track collection " << m_tracksName << " has size =" << tracks->size()
 					 << endmsg;
@@ -1268,21 +1268,20 @@ StatusCode IDAlignMonResiduals::fillHistograms()
     }
 
     //looping over the hits
-    for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator iter_tsos=(track->trackStateOnSurfaces()->begin());
-	 iter_tsos!=track->trackStateOnSurfaces()->end(); ++iter_tsos) {//looping over hits
+    for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
 					
       ++nTSOS;
 			
       if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "***************** TSOS (hit) = " << nTSOS << endmsg;       
 			
-      if ((*iter_tsos) == NULL) continue;
+      if (tsos == NULL) continue;
 			
       //skipping outliers
-      if(!(*iter_tsos)->type(Trk::TrackStateOnSurface::Measurement)) {
+      if(!tsos->type(Trk::TrackStateOnSurface::Measurement)) {
       	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because it is an outlier (or the first TSOS on the track)" << endmsg;
       continue;
       }		
-      const Trk::MeasurementBase* mesh =(*iter_tsos)->measurementOnTrack();
+      const Trk::MeasurementBase* mesh =tsos->measurementOnTrack();
       if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined hit MeasurementBase " << endmsg;
 			
       //Trk::RIO_OnTrack object contains information on the hit used to fit the track at this surface
@@ -1293,7 +1292,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	continue;
       }
 			
-      const Trk::TrackParameters* trackParameter = (*iter_tsos)->trackParameters();
+      const Trk::TrackParameters* trackParameter = tsos->trackParameters();
       if(trackParameter==NULL) {
 	//if no TrackParameters for TSOS we cannot define residuals
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because does not have TrackParameters" << endmsg;
@@ -1375,9 +1374,9 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	//have identified a TRT hit
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is from the TRT, finding residuals... " << endmsg;
 	bool isTubeHit = (mesh->localCovariance()(Trk::locX,Trk::locX) > 1.0) ? 1 : 0;			
-	const Trk::TrackParameters* trackParameter = (*iter_tsos)->trackParameters();
+	const Trk::TrackParameters* trackParameter = tsos->trackParameters();
 	float hitR = hit->localParameters()[Trk::driftRadius];
-	float trketa = (*iter_tsos)->trackParameters()->eta();
+	float trketa = tsos->trackParameters()->eta();
 	float pullR = -9.9;
 	
 	const Identifier& id = m_trtID->layer_id(hitId);
@@ -1394,7 +1393,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found Trk::TrackParameters" << endmsg;
 	
 	//getting unbiased track parameters by removing the hit from the track and refitting
-	const Trk::TrackParameters* trackParameterUnbiased = getUnbiasedTrackParameters(track,*iter_tsos);
+	const Trk::TrackParameters* trackParameterUnbiased = getUnbiasedTrackParameters(track,tsos);
 	
 	if(!trackParameterUnbiased){//updator can fail
 	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot define unbiased parameters for hit, skipping it." << endmsg;
@@ -1407,7 +1406,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	//Theoretically there should be no difference in the pull, but in practice, there can be differences
 	bool isPullUnbiased = true;
 				
-	const Trk::MeasurementBase* mesh =(*iter_tsos)->measurementOnTrack(); //This has been defined in line 869. Should be safe to keep it without redefinition
+	const Trk::MeasurementBase* mesh =tsos->measurementOnTrack(); //This has been defined in line 869. Should be safe to keep it without redefinition
 	//Not clear to me here. isPullUnbiased is set to true. Why inside the Function I am checking if it is true or not? Useless I would say.
 	const Trk::ResidualPull* residualPull = m_residualPullCalculator->residualPull(mesh, 
 										       trackParameterUnbiased, 
@@ -1427,7 +1426,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	float residualR = hitR - perdictR;
 	//float eventPhase = timeCor;  I think this is useless. I would prefer not to assign this and pass directly timeCor
 
-	const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>((*iter_tsos)->measurementOnTrack());
+	const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(tsos->measurementOnTrack());
 
 	
 	  
@@ -1506,7 +1505,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	if(m_doHitQuality) {
 	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to Silicon hit..." << endmsg;
 	  
-	  hit = m_hitQualityTool->getGoodHit(*iter_tsos);
+	  hit = m_hitQualityTool->getGoodHit(tsos);
 	  if(hit==NULL) {
 	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit failed quality cuts and is rejected." << endmsg;
 	    continue;
@@ -1568,7 +1567,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  }
 	}
 				
-	//const Trk::TrackParameters* trackParameter = (*iter_tsos)->trackParameters();  // Already defined before in line 880. Should be safe here to take the one up since there are the continues.
+	//const Trk::TrackParameters* trackParameter = tsos->trackParameters();  // Already defined before in line 880. Should be safe here to take the one up since there are the continues.
 				
 	//finding residuals
 	if(trackParameter){//should always have TrackParameters since we now skip tracks with no MeasuredTrackParameters
@@ -1580,7 +1579,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 					
 	  //finding unbiased single residuals
 	  StatusCode sc;
-	  sc = getSiResiduals(track,*iter_tsos,true,unbiasedResXY);
+	  sc = getSiResiduals(track,tsos,true,unbiasedResXY);
 	  if (sc.isFailure()) {
 	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining unbiased residuals! Hit is skipped." << endmsg;
 	    m_sirescalcfailure -> Fill(detType, hweight);
@@ -1593,7 +1592,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  pullY     = (float)unbiasedResXY[3];
 					
 	  //finding biased single residuals (for interest)
-	  sc = getSiResiduals(track,*iter_tsos,false,biasedResXY);
+	  sc = getSiResiduals(track,tsos,false,biasedResXY);
 	  if (sc.isFailure()) {
 	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining biased residuals! Hit is skipped." << endmsg;
 	    continue;
@@ -2727,8 +2726,8 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 					   << ", barrelEC= "<<barrelEC<< endmsg;
       
       int nHits = 0;
-      for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsos2=trk->trackStateOnSurfaces()->begin();tsos2!=trk->trackStateOnSurfaces()->end(); ++tsos2) {
-	const Trk::MeasurementBase* mesh =(*tsos2)->measurementOnTrack();
+      for (const Trk::TrackStateOnSurface* tsos2 : *trk->trackStateOnSurfaces()) {
+	const Trk::MeasurementBase* mesh =tsos2->measurementOnTrack();
 	const Trk::RIO_OnTrack* hit2 = dynamic_cast <const Trk::RIO_OnTrack*>(mesh);
 	if (hit2== NULL) continue;//the first hit on the track never has associated RIO_OnTrack - just stores track parameters
 	++nHits;
@@ -2738,7 +2737,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	int modEta2 = -99; 
 	int modPhi2 = -99;
 			
-	//const Identifier& hitId2 = (dynamic_cast <const Trk::RIO_OnTrack*>((*tsos2)->measurementOnTrack()))->identify();
+	//const Identifier& hitId2 = (dynamic_cast <const Trk::RIO_OnTrack*>(tsos2->measurementOnTrack()))->identify();
 	const Identifier& hitId2 = hit2->identify();
 	
 	if (m_idHelper->is_sct(hitId2)) 
@@ -2780,7 +2779,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	  }
 			
 			
-	if(!(*tsos2)->type(Trk::TrackStateOnSurface::Measurement)) {
+	if(!tsos2->type(Trk::TrackStateOnSurface::Measurement)) {
 	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because hit is an outlier" << endmsg;
 	  continue;
 	}
@@ -2815,7 +2814,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	}
 			
 			
-	const Trk::TrackParameters* measuredTrackParameter = (*tsos2)->trackParameters();
+	const Trk::TrackParameters* measuredTrackParameter = tsos2->trackParameters();
 	const AmgSymMatrix(5)* MeasTrackParCovariance = measuredTrackParameter ? measuredTrackParameter->covariance() : NULL;
 	if(MeasTrackParCovariance==NULL) {
 				
@@ -2828,7 +2827,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	  if((detType2==0 || detType2==1) && m_doHitQuality) {
 	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to overlap hit..." << endmsg;
 					
-	    hit2 = m_hitQualityTool->getGoodHit(*tsos2);
+	    hit2 = m_hitQualityTool->getGoodHit(tsos2);
 	    if(hit2==NULL) {
 	      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because failed hit quality cuts." << endmsg;
 	      continue;
@@ -2883,7 +2882,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) <<  "original module phi, eta,layerDisk,barrelEC  = " << modEta <<", "<<modPhi<<",  "<< layerDisk <<" , "<< barrelEC  << endmsg;
 	    //if(msgLvl(MSG::DEBUG)) msg() <<  "overlap module radius = " << radius2 << endmsg;
 	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) <<  "second module phi, eta,layerDisk,barrelEC  = " << modEta2 <<", "<<modPhi2<<layerDisk<<barrelEC<< endmsg;
-	    xOverlap = (*tsos2);
+	    xOverlap = tsos2;
 	  } //added by LT
 				
 	}
@@ -2893,7 +2892,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "modPhi2 = " << modPhi2 << endmsg;
 	  //if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module radius = " << radius << endmsg;
 	  //if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "overlap module radius = " << radius2 << endmsg;
-	  yOverlap = (*tsos2);	  
+	  yOverlap = tsos2;	  
 	}
       }		
     }
@@ -2934,15 +2933,15 @@ const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(cons
     const Trk::TrackStateOnSurface* OtherModuleSideHit(0);
     const Identifier& OtherModuleSideID = m_SCT_Mgr->getDetectorElement(surfaceID)->otherSide()->identify();
 		
-    for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator TempTsos=trkPnt->trackStateOnSurfaces()->begin();TempTsos!=trkPnt->trackStateOnSurfaces()->end(); ++TempTsos) {
+    for (const Trk::TrackStateOnSurface* TempTsos : *trkPnt->trackStateOnSurfaces()) {
 			
-      const Trk::RIO_OnTrack* TempHitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>((*TempTsos)->measurementOnTrack());
+      const Trk::RIO_OnTrack* TempHitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(TempTsos->measurementOnTrack());
       if (TempHitOnTrack != 0) {
 	//const Identifier& trkID = TempHitOnTrack->identify();
 	//if (m_sctID->wafer_id(trkID) == OtherModuleSideID) {
 	if (m_sctID->wafer_id(TempHitOnTrack->identify()) == OtherModuleSideID) {
 	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "True unbiased residual. Removing OtherModuleSide Hit " << m_idHelper->show_to_string(OtherModuleSideID,0,'/') << endmsg;
-	  OtherModuleSideHit = *TempTsos;
+	  OtherModuleSideHit = TempTsos;
 	}
       }
     }
@@ -3177,22 +3176,21 @@ bool IDAlignMonResiduals::trackRequiresRefit(const Trk::Track* track)
 	
   if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Testing track to see if requires refit..." << endmsg;
 	
-  for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator iter_tsos=(track->trackStateOnSurfaces()->begin());
-       iter_tsos!=track->trackStateOnSurfaces()->end(); ++iter_tsos) {//looping over hits
+  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
 		
-    if((*iter_tsos) == NULL) continue;
+    if(tsos == nullptr) continue;
 		
     //skipping outliers
-    if(!(*iter_tsos)->type(Trk::TrackStateOnSurface::Measurement)) continue;
+    if(!tsos->type(Trk::TrackStateOnSurface::Measurement)) continue;
 		
-    const Trk::MeasurementBase* mesh =(*iter_tsos)->measurementOnTrack();
+    const Trk::MeasurementBase* mesh =tsos->measurementOnTrack();
     if (mesh==NULL) continue;
     const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(mesh);
     if (hit==NULL) continue;
 		
     ++nHits;
 		
-    const Trk::TrackParameters* trackParameter = (*iter_tsos)->trackParameters();
+    const Trk::TrackParameters* trackParameter = tsos->trackParameters();
     if(trackParameter==NULL) ++nHitsNoParams; //if no TrackParameters for TSOS we cannot define residuals
 		
   }
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx
index d9bcb771e92..27694cf332e 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx
@@ -302,7 +302,7 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
 
 
   //tracks that are fitted to Si hits only, before extension to TRT
-  DataVector<Trk::Track>* tracksSi = m_trackSelection->selectTracks("ResolvedTracks");
+  const DataVector<Trk::Track>* tracksSi = m_trackSelection->selectTracks("ResolvedTracks");
   if(!tracksSi) {
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Histograms not filled because TrackSelectionTool returned NULL track collection"<< endmsg;
     return StatusCode::SUCCESS;
@@ -313,7 +313,7 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
   } 
   
   //tracks that are fitted with Si and TRT hits
-  DataVector<Trk::Track>* tracksTRT = m_trackSelection->selectTracks("ExtendedTracks");
+  const DataVector<Trk::Track>* tracksTRT = m_trackSelection->selectTracks("ExtendedTracks");
   if(!tracksTRT) {
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Histograms not filled because TrackSelectionTool returned NULL track collection"<< endmsg;
     return StatusCode::SUCCESS;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h
index 2d80db4b29b..b18e1b90cc7 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h
@@ -82,12 +82,6 @@ class IDAlignMonTrackSegments : public ManagedMonitorToolBase
   int m_histosBooked;
   
   //tools
-  const AtlasDetectorID*                m_idHelper;
-  const InDetDD::PixelDetectorManager*  m_Pix_Mgr;  
-  const InDetDD::SCT_DetectorManager*   m_SCT_Mgr;
-  const PixelID*                        m_pixelID;
-  const SCT_ID*                         m_sctID; 
-  
   ToolHandle<Trk::ITrackSummaryTool> m_trackSumTool;
   ToolHandle<InDet::IInDetTrackSplitterTool> m_trackSplitter;
   ToolHandle<InDetAlignMon::TrackSelectionTool> m_trackSelectionUpper;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx
index c3e0bc11394..df33fee34d9 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx
@@ -62,7 +62,6 @@
 IDAlignMonTruthComparison::IDAlignMonTruthComparison( const std::string & type, const std::string & name, const IInterface* parent )
 	     :ManagedMonitorToolBase( type, name, parent ),
 	      m_Pi(3.14156),
-	      m_idHelper(0),
 	      m_tracksName("ExtendedTracks"),
 	      m_tracksTruthName("ExtendedTracksTruthCollection")
 {
@@ -358,7 +357,7 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
 {
 
   //get TrackCollection using TrackSelectionTool
-  DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
+  const DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
   
   //although we select tracks using the TrackSelectionTool, we still need to get a complete TrackCollection
   //from StoreGate for use in the track-truth map, otherwise the track-truth matching is screwed up
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h
index c10c3749d8d..cfbc44c2fc4 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h
@@ -149,7 +149,6 @@ protected:
 
 	float m_Pi;
 
-	const AtlasDetectorID*                m_idHelper;
 	std::string m_stream;
 	std::string m_tracksName;
 	std::string m_tracksTruthName;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx
index 61c55304917..9095f2e70ac 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx
@@ -88,10 +88,10 @@ StatusCode InDetAlignMonBeamSpot::initialize() {
   if(!sc.isSuccess()) return sc;
 
   if ( m_extrapolator.retrieve().isFailure() ) {
-    ATH_MSG_WARNING ("Failed to retrieve tool "+m_extrapolator);
+    ATH_MSG_WARNING ("Failed to retrieve tool "+m_extrapolator.typeAndName());
   } else {
     m_hasExtrapolator = true;
-    ATH_MSG_INFO ("Retrieved tool "+m_extrapolator);
+    ATH_MSG_INFO ("Retrieved tool "+m_extrapolator.typeAndName());
   }
 
   if ( m_beamCondSvc.retrieve().isFailure() ) {
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx
index fb9c4f13338..83444582e88 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx
@@ -19,6 +19,7 @@
 
 
 #include "VxVertex/VxContainer.h"
+#include "AthContainers/ConstDataVector.h"
 
 //---------------------------------------------------------------------------------------
 
@@ -130,26 +131,26 @@ StatusCode TrackSelectionAlg::execute()
   
   
   //this is the track view that will be filled
-  TrackCollection* selectedTracks = new TrackCollection( SG::VIEW_ELEMENTS );
+  auto selectedTracks = std::make_unique<ConstDataVector<TrackCollection> >( SG::VIEW_ELEMENTS );
 
   //looping over input track collection and implementing track selection cuts
   TrackCollection::const_iterator trksItr  = tracks->begin();
   TrackCollection::const_iterator trksItrE = tracks->end();
   for (; trksItr != trksItrE; ++trksItr) {
     
-    Trk::Track* track = *trksItr;
+    const Trk::Track* track = *trksItr;
     bool trackPassed = makeTrackCuts(track, zVtx);
     if(trackPassed) selectedTracks->push_back(track);    
   }
 
-  evtStore()->record(selectedTracks,m_outputTrackCol);
+  evtStore()->record(std::move(selectedTracks),m_outputTrackCol);
 
   return StatusCode::SUCCESS;
 }
 
 //---------------------------------------------------------------------------------------
 
-bool TrackSelectionAlg::makeTrackCuts(Trk::Track* track, float zVtx)
+bool TrackSelectionAlg::makeTrackCuts(const Trk::Track* track, float zVtx)
 {
   bool trackPassed = true;
 
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h
index 9c989e7b3d0..32a341820ad 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h
@@ -34,7 +34,7 @@ class TrackSelectionAlg : public AthAlgorithm
 
  private:
     
-  bool makeTrackCuts(Trk::Track*, float);
+  bool makeTrackCuts(const Trk::Track*, float);
 
   ToolHandle< Trk::ITrackSummaryTool > m_trackSumTool; //!<  Pointer to Trk::ITrackSummaryTool
 
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx
index c8f068bbd70..6bf2a2de22c 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx
@@ -18,6 +18,7 @@
 #include "CommissionEvent/ComTime.h"
 #include "VxVertex/VxContainer.h"
 #include "VxVertex/RecVertex.h"
+#include "AthContainers/ConstDataVector.h"
 
 
 InDetAlignMon::TrackSelectionTool::TrackSelectionTool( const std::string & type, const std::string & name, const IInterface* parent )
@@ -230,7 +231,7 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
   return return_tracks;
 }
 
-DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const std::string &trackColName)
+const DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const std::string &trackColName)
 {
 
   //if this method is used the decision on which trackcollection
@@ -238,7 +239,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
   //returns a view to a new track collection object which contains the selected tracks
 
   const TrackCollection* tracks; //pointer to original track collection in StoreGate
-  DataVector<Trk::Track>* selected_tracks = new DataVector<Trk::Track>(SG::VIEW_ELEMENTS); //new track collection view
+  auto selected_tracks = std::make_unique<ConstDataVector<DataVector<Trk::Track> > >(SG::VIEW_ELEMENTS); //new track collection view
   
   const Trk::RecVertex* pVtx = NULL;
   if(m_usePrimVtx){
@@ -248,7 +249,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
     StatusCode sc = evtStore()->retrieve (vxContainer,m_VtxContainerName);
     if (sc.isFailure()) {
       if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No PrimVtxCollection with name  "<<m_VtxContainerName<<" found in StoreGate" << endmsg;
-      return selected_tracks; //return empty track collection (but not NULL)
+      return selected_tracks.release()->asDataVector(); //return empty track collection (but not NULL)
     } else {
       if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "PrimVtxCollection with name  "<<m_VtxContainerName<< " with nvertices =  " << vxContainer->size() <<" found  in StoreGate" << endmsg;
     }
@@ -259,7 +260,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
       // Select good primary vertex
       if ((*vxIter)->vertexType() != Trk::PriVtx) continue;
       if ((*vxIter)->recVertex().fitQuality().numberDoF() <= 0) continue;
-      std::vector<Trk::VxTrackAtVertex*>* vxTrackAtVertex = (*vxIter)->vxTrackAtVertex();
+      const std::vector<Trk::VxTrackAtVertex*>* vxTrackAtVertex = (*vxIter)->vxTrackAtVertex();
       if (vxTrackAtVertex==0 || vxTrackAtVertex->size() < m_minTracksPerVtx) continue;
       if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found a primary vertex built with " << vxTrackAtVertex->size() << " tracks" << endmsg;
       pVtx = &((*vxIter)->recVertex());//set pointer to identified primary vertex
@@ -272,7 +273,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
   StatusCode sc = evtStore()->retrieve(tracks,trackColName);
   if (sc.isFailure()) {
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<trackColName<<" found in StoreGate" << endmsg;
-    return selected_tracks; //return empty track collection (but not NULL)
+    return selected_tracks.release()->asDataVector(); //return empty track collection (but not NULL)
   } else {
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<trackColName<<" found in StoreGate" << endmsg;
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endmsg;
@@ -282,7 +283,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
   TrackCollection::const_iterator trksItrE = tracks->end();
   for (; trksItr != trksItrE; ++trksItr) {
     
-    Trk::Track* track = *trksItr;
+    const Trk::Track* track = *trksItr;
 
     if(m_passAllTracks) {
       if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track automatically passes TrackSelectionTool since passAllTracks=True" << endmsg;
@@ -350,7 +351,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
     }
   }
 
-  return selected_tracks;
+  return selected_tracks.release()->asDataVector();
 }
 
 
@@ -510,7 +511,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
 
 //---------------------------------------------------------------------------------------
 
-DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks()
+const DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks()
 {
 
   //if this method the decision on which trackcollection
@@ -518,12 +519,12 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks()
   //returns a view to a new track collection object which contains the selected tracks
 
   const TrackCollection* tracks;
-  DataVector<Trk::Track>* selected_tracks = new DataVector<Trk::Track>(SG::VIEW_ELEMENTS);
+  auto selected_tracks = std::make_unique<ConstDataVector<DataVector<Trk::Track> > >(SG::VIEW_ELEMENTS);
 
   StatusCode sc = evtStore()->retrieve(tracks,m_trackColName);
   if (sc.isFailure()) {
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<m_trackColName<<" found in StoreGate" << endmsg;
-    return selected_tracks; //return empty track collection (but not NULL)
+    return selected_tracks.release()->asDataVector(); //return empty track collection (but not NULL)
   } else {
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_trackColName<<" found in StoreGate" << endmsg;
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endmsg;
@@ -533,7 +534,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks()
   TrackCollection::const_iterator trksItrE = tracks->end();
   for (; trksItr != trksItrE; ++trksItr) {
     
-    Trk::Track* track = *trksItr;
+    const Trk::Track* track = *trksItr;
 
     if(m_passAllTracks) {
       selected_tracks->push_back(track);//allow all tracks into new collection, regardless of decision 
@@ -544,6 +545,6 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks()
     }
   }
 
-  return selected_tracks;
+  return selected_tracks.release()->asDataVector();
 }
 
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
index d3913a245b3..8c85dc0dd1c 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
@@ -50,12 +50,12 @@ namespace InDetAlignMon{
     //if this method is used the decision on which trackcollection
     //is made by the calling method
     DataVector<Trk::Track>* selectTracksNew(const std::string&);
-    DataVector<Trk::Track>* selectTracks(const std::string &);
+    const DataVector<Trk::Track>* selectTracks(const std::string &);
     DataVector<xAOD::TrackParticle>* selectTracksParticle(const std::string &);
 
     //if this method the decision on which trackcollection
     //is made from the configuration of the TrackSlectionTool (in jobOptions)
-    DataVector<Trk::Track>* selectTracks();
+    const DataVector<Trk::Track>* selectTracks();
 
     std::string getTrackColName(){
       return m_trackColName;
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonWenu.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonWenu.h
index 23864a858a7..15aa170b7db 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonWenu.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonWenu.h
@@ -83,7 +83,7 @@ public:
   int m_histosBooked;
 
   enum m_eta_region { incl, barrel, eca, ecc, Nregions };
-  std::vector<std::string> region_strings;
+  std::vector<std::string> m_region_strings;
 
   // event histos
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h
index ca15da21180..e5a76b392e5 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h
@@ -79,7 +79,7 @@ public:
  protected:
 
   enum m_eta_region { incl, barrel, eca, ecc, Nregions };
-  std::vector<std::string> region_strings;
+  std::vector<std::string> m_region_strings;
 
   int m_histosBooked;
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/TRT_Electron_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/TRT_Electron_Monitoring_Tool.h
index 8caeec09a11..7a9e719ab17 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/TRT_Electron_Monitoring_Tool.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/TRT_Electron_Monitoring_Tool.h
@@ -105,7 +105,7 @@ public:
 
 	const TRT_ID*	m_pTRTHelper;
 
-  	const InDetDD::TRT_DetectorManager *mgr;
+  	const InDetDD::TRT_DetectorManager *m_mgr;
 
 	void bookGeoHistograms( lw_geo_hists_t &hists, const std::string& name);
 	void bookPCandHistograms( MonGroup &monGroup, lw_partcand_hists_t &hists, const std::string& name);
@@ -148,7 +148,7 @@ private:
 	std::string m_conversionName;
 
 	std::string m_isEMFlag;
-	myIsEMType isEMType;
+	myIsEMType m_isEMType;
 
 	bool m_doTracksMon;
 	bool m_doElectronMon;
@@ -169,14 +169,14 @@ private:
 	float m_ZRMax;
 	float m_PionTRTHitCut;
 
-	lw_geo_hists_t tBarrelA;
-	lw_geo_hists_t tBarrelC;
-	lw_geo_hists_t tEndCapA;
-	lw_geo_hists_t tEndCapC;
+	lw_geo_hists_t m_tBarrelA;
+	lw_geo_hists_t m_tBarrelC;
+	lw_geo_hists_t m_tEndCapA;
+	lw_geo_hists_t m_tEndCapC;
 
-	lw_partcand_hists_t tEl;
-	lw_partcand_hists_t tMu;
-	lw_partcand_hists_t tPi;
+	lw_partcand_hists_t m_tEl;
+	lw_partcand_hists_t m_tMu;
+	lw_partcand_hists_t m_tPi;
 
 };
 #endif
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
index 66f4125ec8b..4df06c1c19e 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
@@ -427,7 +427,7 @@ StatusCode IDPerfMonKshort::fillHistograms()
     ATH_MSG_DEBUG("No collection with name "<<m_VxPrimContainerName<<" found in StoreGate");
     return StatusCode::SUCCESS;
   }
-  xAOD::Vertex *primaryVertex= std::begin(*PrimVxContainer)[0];
+  const xAOD::Vertex *primaryVertex= std::begin(*PrimVxContainer)[0];
 
 const xAOD::VertexContainer* SecVxContainer(0);
  if(evtStore()->contains<xAOD::VertexContainer>(m_VxContainerName)){
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonWenu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonWenu.cxx
index a6a65df64dd..94c190fe9b5 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonWenu.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonWenu.cxx
@@ -73,10 +73,10 @@ IDPerfMonWenu::IDPerfMonWenu( const std::string & type, const std::string & name
   declareProperty("electronIDLevel",m_electronIDLevel = "Tight");
   //declareProperty("isolationCone",m_isolationCone = xAOD::Iso::ptcone20); // temporary -- should be replaced by isolation tool
 
-  region_strings.push_back("incl");
-  region_strings.push_back("barrel");
-  region_strings.push_back("eca");
-  region_strings.push_back("ecc");
+  m_region_strings.push_back("incl");
+  m_region_strings.push_back("barrel");
+  m_region_strings.push_back("eca");
+  m_region_strings.push_back("ecc");
 
 }
 
@@ -236,25 +236,25 @@ StatusCode IDPerfMonWenu::bookHistograms()
       std::string title;
       std::string name;
 
-      name = "Wenu_Eop_" + region_strings[region];
-      title = "E/p for Wenu EM-clusters in " + region_strings[region];
+      name = "Wenu_Eop_" + m_region_strings[region];
+      title = "E/p for Wenu EM-clusters in " + m_region_strings[region];
       m_Wenu_Eop.push_back(new TH1F(name.c_str(),title.c_str(), 60, 0., 10.));
       if (region==incl) RegisterHisto(al_Wenu_mon,m_Wenu_Eop[region]);
       else RegisterHisto(al_Wenu_mon,m_Wenu_Eop[region]);
 
-      name = "Wenu_Eopdiff_" + region_strings[region];
-      title = "E/p difference (pos-neg) for Wenu EM-clusters in " + region_strings[region];
+      name = "Wenu_Eopdiff_" + m_region_strings[region];
+      title = "E/p difference (pos-neg) for Wenu EM-clusters in " + m_region_strings[region];
       m_Wenu_Eopdiff.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
       if (region==incl) RegisterHisto(al_Wenu_mon,m_Wenu_Eopdiff[region],true);
       else RegisterHisto(al_Wenu_mon,m_Wenu_Eopdiff[region],true);
 
-      name = "Wenu_Eop_plus_" + region_strings[region];
-      title = "E/p for pos. charged Wenu EM-clusters in " + region_strings[region];
+      name = "Wenu_Eop_plus_" + m_region_strings[region];
+      title = "E/p for pos. charged Wenu EM-clusters in " + m_region_strings[region];
       m_Wenu_Eop_plus.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
       RegisterHisto(al_Wenu_mon,m_Wenu_Eop_plus[region],true);
 
-      name = "Wenu_Eop_minus_" + region_strings[region];
-      title = "E/p for neg. charged Wenu EM-clusters in " + region_strings[region];
+      name = "Wenu_Eop_minus_" + m_region_strings[region];
+      title = "E/p for neg. charged Wenu EM-clusters in " + m_region_strings[region];
       m_Wenu_Eop_minus.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
       RegisterHisto(al_Wenu_mon,m_Wenu_Eop_minus[region],true);
 
@@ -623,11 +623,7 @@ const xAOD::CaloCluster* IDPerfMonWenu::getLeadingEMcluster(const xAOD::CaloClus
 
 }
 
-const xAOD::CaloCluster* IDPerfMonWenu::getLeadingEMcluster(const xAOD::PhotonContainer* photons, const xAOD::ElectronContainer* electrons, const xAOD::CaloCluster* omitCluster) const {
-
-  // iterators over the photon container
-  xAOD::PhotonContainer::const_iterator photonItr = photons->begin();
-  xAOD::PhotonContainer::const_iterator photonItrEnd = photons->end();
+const xAOD::CaloCluster* IDPerfMonWenu::getLeadingEMcluster(const xAOD::PhotonContainer* /*photons*/, const xAOD::ElectronContainer* electrons, const xAOD::CaloCluster* omitCluster) const {
 
   // iterators over the electron container
   xAOD::ElectronContainer::const_iterator electronItr = electrons->begin();
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZee.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZee.cxx
index 8e6d2679e40..4907bc8c09b 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZee.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZee.cxx
@@ -78,10 +78,10 @@ IDPerfMonZee::IDPerfMonZee( const std::string & type, const std::string & name,
   declareProperty("triggerChainName",m_triggerChainName);
   declareProperty("electronIDLevel",m_electronIDLevel = "Tight");
 
-  region_strings.push_back("incl");
-  region_strings.push_back("barrel");
-  region_strings.push_back("eca");
-  region_strings.push_back("ecc");
+  m_region_strings.push_back("incl");
+  m_region_strings.push_back("barrel");
+  m_region_strings.push_back("eca");
+  m_region_strings.push_back("ecc");
 
 }
 
@@ -253,25 +253,25 @@ StatusCode IDPerfMonZee::bookHistograms()
       std::string title;
       std::string name;
 
-      name = "Zee_Eop_" + region_strings[region];
-      title = "E/p for Zee EM-clusters in " + region_strings[region];
+      name = "Zee_Eop_" + m_region_strings[region];
+      title = "E/p for Zee EM-clusters in " + m_region_strings[region];
       m_Zee_Eop.push_back(new TH1F(name.c_str(),title.c_str(), 60, 0., 10.));
       if (region==incl) RegisterHisto(al_Zee_mon,m_Zee_Eop[region]);
       else RegisterHisto(al_Zee_mon,m_Zee_Eop[region]);
 
-      name = "Zee_Eopdiff_" + region_strings[region];
-      title = "E/p difference (pos-neg) for Zee EM-clusters in " + region_strings[region];
+      name = "Zee_Eopdiff_" + m_region_strings[region];
+      title = "E/p difference (pos-neg) for Zee EM-clusters in " + m_region_strings[region];
       m_Zee_Eopdiff.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
       if (region==incl) RegisterHisto(al_Zee_mon,m_Zee_Eopdiff[region],true);
       else RegisterHisto(al_Zee_mon,m_Zee_Eopdiff[region],true);
 
-      name = "Zee_Eop_plus_" + region_strings[region];
-      title = "E/p for pos. charged Zee EM-clusters in " + region_strings[region];
+      name = "Zee_Eop_plus_" + m_region_strings[region];
+      title = "E/p for pos. charged Zee EM-clusters in " + m_region_strings[region];
       m_Zee_Eop_plus.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
       RegisterHisto(al_Zee_mon,m_Zee_Eop_plus[region],true);
 
-      name = "Zee_Eop_minus_" + region_strings[region];
-      title = "E/p for neg. charged Zee EM-clusters in " + region_strings[region];
+      name = "Zee_Eop_minus_" + m_region_strings[region];
+      title = "E/p for neg. charged Zee EM-clusters in " + m_region_strings[region];
       m_Zee_Eop_minus.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
       RegisterHisto(al_Zee_mon,m_Zee_Eop_minus[region],true);
 
@@ -714,11 +714,7 @@ const xAOD::CaloCluster* IDPerfMonZee::getLeadingEMcluster(const xAOD::CaloClust
 
 }
 
-const xAOD::CaloCluster* IDPerfMonZee::getLeadingEMcluster(const xAOD::PhotonContainer* photons, const xAOD::ElectronContainer* electrons, const xAOD::CaloCluster* omitCluster) const {
-
-  // iterators over the photon container
-  xAOD::PhotonContainer::const_iterator photonItr = photons->begin();
-  xAOD::PhotonContainer::const_iterator photonItrEnd = photons->end();
+const xAOD::CaloCluster* IDPerfMonZee::getLeadingEMcluster(const xAOD::PhotonContainer* /*photons*/, const xAOD::ElectronContainer* electrons, const xAOD::CaloCluster* omitCluster) const {
 
   // iterators over the electron container
   xAOD::ElectronContainer::const_iterator electronItr = electrons->begin();
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelector.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelector.cxx
index c27ee1c18aa..0880a46eb5d 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelector.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelector.cxx
@@ -182,7 +182,7 @@ bool MuonSelector::passQualCuts()
   if( xAOD::Muon::Combined ) return false;
   if (IDTrk) {
     uint8_t dummy(-1);
-    bool eBLhits = IDTrk->summaryValue( dummy, xAOD::expectInnermostPixelLayerHit )? dummy :-1;
+    bool eBLhits = IDTrk->summaryValue( dummy, xAOD::expectInnermostPixelLayerHit )? dummy :false;
     int  nBLhits = IDTrk->summaryValue( dummy, xAOD::numberOfInnermostPixelLayerHits )? dummy :-1;
 
     int nhitsPIX = IDTrk->summaryValue( dummy, xAOD::numberOfPixelHits )? dummy :-1;
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/TRT_Electron_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/TRT_Electron_Monitoring_Tool.cxx
index 8071f1a7abb..ba4942f1b15 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/TRT_Electron_Monitoring_Tool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/TRT_Electron_Monitoring_Tool.cxx
@@ -34,7 +34,7 @@ TRT_Electron_Monitoring_Tool( const std::string & type,
                         const IInterface* parent )
   : ManagedMonitorToolBase( type, name, parent ),
   m_pTRTHelper			(0),
-  mgr				(0)
+  m_mgr				(0)
 {
   declareProperty( "trackName", m_tracksName="InDetTrackParticles" );
   declareProperty( "electronName", m_electronsName="Electrons");
@@ -80,7 +80,7 @@ TRT_Electron_Monitoring_Tool::initialize()
   }
 
   // Retrieve detector manager
-  if (detStore()->retrieve(mgr, "TRT").isFailure())
+  if (detStore()->retrieve(m_mgr, "TRT").isFailure())
   {
      ATH_MSG_FATAL("Unable to retrieve pointer to TRT DetectorManager" );
      return StatusCode::FAILURE;
@@ -88,9 +88,9 @@ TRT_Electron_Monitoring_Tool::initialize()
     ATH_MSG_DEBUG( "Retrieved TRT manager" );
   }
 
-  if(m_isEMFlag=="Loose") isEMType = ISEMLOOSE;
-  else if(m_isEMFlag=="Medium") isEMType = ISEMMEDIUM;
-  else if(m_isEMFlag=="Tight") isEMType = ISEMTIGHT;
+  if(m_isEMFlag=="Loose") m_isEMType = ISEMLOOSE;
+  else if(m_isEMFlag=="Medium") m_isEMType = ISEMMEDIUM;
+  else if(m_isEMFlag=="Tight") m_isEMType = ISEMTIGHT;
   else {
     ATH_MSG_WARNING( "Unrecognized isEM jobOption " << m_isEMFlag );
     ATH_MSG_WARNING( "Choose from Loose,Medium or Tight" );
@@ -154,14 +154,14 @@ bookHistograms()
   {
     MonGroup hl_monGroup_pcand	( this, "TRT//HTMonitoring/ParticleCandidates",  run);
     if(m_doTracksMon){
-      bookGeoHistograms		(tBarrelA	,"BarrelA"    );
-      bookGeoHistograms		(tBarrelC	,"BarrelC"    );
-      bookGeoHistograms		(tEndCapA	,"EndCapA"    );
-      bookGeoHistograms		(tEndCapC	,"EndCapC"    );
-      bookPCandHistograms	(hl_monGroup_pcand,tPi		,"Pion");
+      bookGeoHistograms		(m_tBarrelA	,"BarrelA"    );
+      bookGeoHistograms		(m_tBarrelC	,"BarrelC"    );
+      bookGeoHistograms		(m_tEndCapA	,"EndCapA"    );
+      bookGeoHistograms		(m_tEndCapC	,"EndCapC"    );
+      bookPCandHistograms	(hl_monGroup_pcand,m_tPi		,"Pion");
     }
-    if(m_doMuonMon)	bookPCandHistograms(hl_monGroup_pcand,tMu,"Muon");
-    if(m_doElectronMon)	bookPCandHistograms(hl_monGroup_pcand,tEl,"Electron");
+    if(m_doMuonMon)	bookPCandHistograms(hl_monGroup_pcand,m_tMu,"Muon");
+    if(m_doElectronMon)	bookPCandHistograms(hl_monGroup_pcand,m_tEl,"Electron");
   }
   catch(const char* hName)
   {
@@ -261,13 +261,13 @@ fillHistograms()
 
    ATH_MSG_DEBUG("Filling TRT Electron Monitor Histograms");
 
-  tBarrelA.N = 0;
-  tBarrelC.N = 0;
-  tEndCapA.N = 0;
-  tEndCapC.N = 0;
-  tEl.N = 0;
-  tMu.N = 0;
-  tPi.N = 0;
+  m_tBarrelA.N = 0;
+  m_tBarrelC.N = 0;
+  m_tEndCapA.N = 0;
+  m_tEndCapC.N = 0;
+  m_tEl.N = 0;
+  m_tMu.N = 0;
+  m_tPi.N = 0;
 
   std::vector<Trk::Track*> v_usedTrks;
   loopOverConversions(v_usedTrks);
@@ -275,13 +275,13 @@ fillHistograms()
   loopOverMuons(v_usedTrks);
   loopOverTracks(v_usedTrks);
 
-  if(m_doElectronMon)	tEl.hNCand->Fill(tEl.N);
-  if(m_doMuonMon)	tMu.hNCand->Fill(tMu.N);
-  if(m_doTracksMon)	tPi.hNCand->Fill(tPi.N);
-  tBarrelA.hNTracks->Fill(tBarrelA.N);
-  tBarrelC.hNTracks->Fill(tBarrelC.N);
-  tEndCapA.hNTracks->Fill(tBarrelA.N);
-  tEndCapC.hNTracks->Fill(tBarrelC.N);
+  if(m_doElectronMon)	m_tEl.hNCand->Fill(m_tEl.N);
+  if(m_doMuonMon)	m_tMu.hNCand->Fill(m_tMu.N);
+  if(m_doTracksMon)	m_tPi.hNCand->Fill(m_tPi.N);
+  m_tBarrelA.hNTracks->Fill(m_tBarrelA.N);
+  m_tBarrelC.hNTracks->Fill(m_tBarrelC.N);
+  m_tEndCapA.hNTracks->Fill(m_tBarrelA.N);
+  m_tEndCapC.hNTracks->Fill(m_tBarrelC.N);
 
   return StatusCode::SUCCESS;
 }//fillHistograms
@@ -320,7 +320,7 @@ loopOverConversions(std::vector<Trk::Track*> &v_usedTrks)
 	  if(!trkProbe) continue;
 
 	  if(!conversionQualityCuts(trkTag,trkProbe)) continue;
-	  tEl.N++;
+	  m_tEl.N++;
 	  if(!fillAllHistograms( (xAOD::TrackParticle*)trkProbe, electron_mass, PCAND_EL ))
 	    {
 	      ATH_MSG_DEBUG( "fillStructHistograms failed!" );
@@ -363,7 +363,7 @@ loopOverRecElectrons(std::vector<Trk::Track*> &v_usedTrks)
       }
       if(matched) continue;
       v_usedTrks.push_back( (Trk::Track*)trk );
-      tEl.N++;
+      m_tEl.N++;
       if(!fillAllHistograms( (xAOD::TrackParticle*)trkP, electron_mass, PCAND_EL ))
       {
 	ATH_MSG_DEBUG( "fillStructHistograms failed!" );
@@ -396,7 +396,7 @@ loopOverMuons(std::vector<Trk::Track*> &v_usedTrks)
       if(!trkP) continue;
       const Trk::Track *trk = trkP->track();
       v_usedTrks.push_back( (Trk::Track*)trk );
-      tMu.N++;
+      m_tMu.N++;
       if(!fillAllHistograms( (xAOD::TrackParticle*)trkP, muon_mass, PCAND_MU ))
       {
 	ATH_MSG_DEBUG( "fillStructHistograms failed!" );
@@ -426,7 +426,7 @@ loopOverTracks(std::vector<Trk::Track*> &v_usedTrks)
       //      if(!(*tp)) continue;
       fillAllHistograms((xAOD::TrackParticle*)tp);
       if(!pionQualityCuts((xAOD::TrackParticle*)tp,v_usedTrks)) continue;
-      tPi.N++;
+      m_tPi.N++;
       if(!fillAllHistograms((xAOD::TrackParticle*)tp, pion_mass, PCAND_PI ))
       {
 	ATH_MSG_DEBUG( "fillStructHistograms failed!" );
@@ -515,12 +515,12 @@ electronQualityCuts(const xAOD::Electron *electron)
    bool val_loose=0;
   bool val_medium=0;
   bool val_tight=0;
-  if(isEMType==ISEMLOOSE && !(electron->passSelection(val_loose, "Loose")==0))  return false;
-  if(isEMType==ISEMMEDIUM && !(electron->passSelection(val_medium, "Medium")==0))  return false;
-  if(isEMType==ISEMTIGHT && !(electron->passSelection(val_tight, "Tight")==0))  return false;
-  // if(isEMType==ISEMLOOSE  && !(electron->isem(egammaPID::ElectronLoose    )==0)) return false;
-  // if(isEMType==ISEMMEDIUM && !(electron->isem(egammaPID::ElectronMedium   )==0)) return false;
-  // if(isEMType==ISEMTIGHT  && !(electron->isem(egammaPID::ALLNOTRT_ELECTRON | egammaPID::TRACKMATCHTIGHT_ELECTRON | egammaPID::CONVMATCH_ELECTRON)==0)) return false;
+  if(m_isEMType==ISEMLOOSE && !(electron->passSelection(val_loose, "Loose")==0))  return false;
+  if(m_isEMType==ISEMMEDIUM && !(electron->passSelection(val_medium, "Medium")==0))  return false;
+  if(m_isEMType==ISEMTIGHT && !(electron->passSelection(val_tight, "Tight")==0))  return false;
+  // if(m_isEMType==ISEMLOOSE  && !(electron->isem(egammaPID::ElectronLoose    )==0)) return false;
+  // if(m_isEMType==ISEMMEDIUM && !(electron->isem(egammaPID::ElectronMedium   )==0)) return false;
+  // if(m_isEMType==ISEMTIGHT  && !(electron->isem(egammaPID::ALLNOTRT_ELECTRON | egammaPID::TRACKMATCHTIGHT_ELECTRON | egammaPID::CONVMATCH_ELECTRON)==0)) return false;
   return true;
 }//electronQualityCuts
 
@@ -610,7 +610,7 @@ fillAllHistograms(xAOD::TrackParticle *trkP, float mass, int PCand){
   int nHLHits[4]={0,0,0,0};
   int nTRTHTHits = 0;
   int nTRTHits   = 0;
-  int m_barrel_ec(0);
+  int barrel_ec(0);
   const DataVector<const Trk::TrackStateOnSurface>* trackStates = trkP->track()->trackStateOnSurfaces();
 
   DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin = trackStates->begin();
@@ -627,8 +627,8 @@ fillAllHistograms(xAOD::TrackParticle *trkP, float mass, int PCand){
       else
       {
 	Identifier DCoTId = trtCircle->identify();
-	m_barrel_ec = myBarrelEC(m_pTRTHelper->barrel_ec(DCoTId));
-	if(m_barrel_ec<0) continue;
+	barrel_ec = myBarrelEC(m_pTRTHelper->barrel_ec(DCoTId));
+	if(barrel_ec<0) continue;
 
 	const InDet::TRT_DriftCircle *RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle*>(trtCircle->prepRawData());
 	const Trk::MeasurementBase* mesb=(*TSOSItBegin)->measurementOnTrack();
@@ -636,10 +636,10 @@ fillAllHistograms(xAOD::TrackParticle *trkP, float mass, int PCand){
 	float TRThitX = trtCircle->globalPosition().x();
 	float TRThitY = trtCircle->globalPosition().y();
 	float TRThitZ = fabs(trtCircle->globalPosition().z());
-	float zr = m_barrel_ec<2 ? TRThitZ : sqrt(pow(TRThitX,2)+pow(TRThitY,2));
-	int m_phi_or_plane   =  m_barrel_ec<2 ? m_pTRTHelper->phi_module(DCoTId) :m_pTRTHelper->straw_layer(DCoTId);
-	int m_layer_or_wheel = m_pTRTHelper->layer_or_wheel(DCoTId);
-	bool inCorOuter = isGasInCorOuter(m_barrel_ec,m_phi_or_plane,m_layer_or_wheel);
+	float zr = barrel_ec<2 ? TRThitZ : sqrt(pow(TRThitX,2)+pow(TRThitY,2));
+	int phi_or_plane   =  barrel_ec<2 ? m_pTRTHelper->phi_module(DCoTId) :m_pTRTHelper->straw_layer(DCoTId);
+	int layer_or_wheel = m_pTRTHelper->layer_or_wheel(DCoTId);
+	bool inCorOuter = isGasInCorOuter(barrel_ec,phi_or_plane,layer_or_wheel);
 	if(RawDriftCircle && !isTubeHit)
 	{
 	  bool highL = RawDriftCircle->highLevel();
@@ -649,47 +649,47 @@ fillAllHistograms(xAOD::TrackParticle *trkP, float mass, int PCand){
 	  TProfile_LW	*pHTFracStrawZCO = 0;
     	  TProfile_LW	*pHTFracGamma = 0;
     	  lw_geo_hists_t * myGeoHists = 0;
-	  if(mass==0){ switch (m_barrel_ec){
+	  if(mass==0){ switch (barrel_ec){
 	    case DET_BARRELA:
-	      pHTFracTrackPhi = tBarrelA.pHTFracTrackPhi;
-	      pHTFracStrawZR  = tBarrelA.pHTFracStrawZR;
-	      pHTFracStrawZAI  = tBarrelA.pHTFracStrawZAI;
-	      pHTFracStrawZCO  = tBarrelA.pHTFracStrawZCO;
+	      pHTFracTrackPhi = m_tBarrelA.pHTFracTrackPhi;
+	      pHTFracStrawZR  = m_tBarrelA.pHTFracStrawZR;
+	      pHTFracStrawZAI  = m_tBarrelA.pHTFracStrawZAI;
+	      pHTFracStrawZCO  = m_tBarrelA.pHTFracStrawZCO;
 	      break;
 	    case DET_BARRELC:
-	      pHTFracTrackPhi = tBarrelC.pHTFracTrackPhi;
-	      pHTFracStrawZR  = tBarrelC.pHTFracStrawZR;
-	      pHTFracStrawZAI = tBarrelC.pHTFracStrawZAI;
-	      pHTFracStrawZCO = tBarrelC.pHTFracStrawZCO;
+	      pHTFracTrackPhi = m_tBarrelC.pHTFracTrackPhi;
+	      pHTFracStrawZR  = m_tBarrelC.pHTFracStrawZR;
+	      pHTFracStrawZAI = m_tBarrelC.pHTFracStrawZAI;
+	      pHTFracStrawZCO = m_tBarrelC.pHTFracStrawZCO;
 	      break;
 	    case DET_ENDCAPA:
-	      pHTFracTrackPhi = tEndCapA.pHTFracTrackPhi;
-	      pHTFracStrawZR  = tEndCapA.pHTFracStrawZR;
-	      pHTFracStrawZAI = tEndCapA.pHTFracStrawZAI;
-	      pHTFracStrawZCO = tEndCapA.pHTFracStrawZCO;
+	      pHTFracTrackPhi = m_tEndCapA.pHTFracTrackPhi;
+	      pHTFracStrawZR  = m_tEndCapA.pHTFracStrawZR;
+	      pHTFracStrawZAI = m_tEndCapA.pHTFracStrawZAI;
+	      pHTFracStrawZCO = m_tEndCapA.pHTFracStrawZCO;
 	      break;
 	    case DET_ENDCAPC:
-	      pHTFracTrackPhi = tEndCapC.pHTFracTrackPhi;
-	      pHTFracStrawZR  = tEndCapC.pHTFracStrawZR;
-	      pHTFracStrawZAI = tEndCapC.pHTFracStrawZAI;
-	      pHTFracStrawZCO = tEndCapC.pHTFracStrawZCO;
+	      pHTFracTrackPhi = m_tEndCapC.pHTFracTrackPhi;
+	      pHTFracStrawZR  = m_tEndCapC.pHTFracStrawZR;
+	      pHTFracStrawZAI = m_tEndCapC.pHTFracStrawZAI;
+	      pHTFracStrawZCO = m_tEndCapC.pHTFracStrawZCO;
 	      break;
 	    default : continue;
 	  }
 	  }
 	  else{
-	    switch (m_barrel_ec){
+	    switch (barrel_ec){
               case DET_BARRELA:
-                myGeoHists = &tBarrelA;
+                myGeoHists = &m_tBarrelA;
 	        break;
               case DET_BARRELC:
-                myGeoHists = &tBarrelC;
+                myGeoHists = &m_tBarrelC;
             	  break;
               case DET_ENDCAPA:
-                myGeoHists = &tEndCapA;
+                myGeoHists = &m_tEndCapA;
 	        break;
               case DET_ENDCAPC:
-                myGeoHists = &tEndCapC;
+                myGeoHists = &m_tEndCapC;
 	        break;
               default : break;
             }
@@ -726,7 +726,7 @@ fillAllHistograms(xAOD::TrackParticle *trkP, float mass, int PCand){
 	      myGeoHists->pHTFracGammaAll->Fill(gamma,1);
 	      //charge>0 ? myGeoHists->pHTFracGammaPosAll->Fill(gamma,1) : myGeoHists->pHTFracGammaNegAll->Fill(gamma,1);
             }
-	    nHLHits[m_barrel_ec]++;
+	    nHLHits[barrel_ec]++;
 	    nTRTHTHits++;
 
 	  }//if(RawDriftCircle->highLevel())
@@ -741,7 +741,7 @@ fillAllHistograms(xAOD::TrackParticle *trkP, float mass, int PCand){
 	    myGeoHists->pHTFracGammaAll->Fill(gamma,0);
 	    //charge>0 ? myGeoHists->pHTFracGammaPosAll->Fill(gamma,0) : myGeoHists->pHTFracGammaNegAll->Fill(gamma,0);
 	  }
-	  nLLHits[m_barrel_ec]++;
+	  nLLHits[barrel_ec]++;
 	  nTRTHits++;
 	}//if(RawDriftCircle && !isTubeHit)
       }//else  ---- came from if(!(trtCircle) || !(aTrackParam))
@@ -752,16 +752,16 @@ fillAllHistograms(xAOD::TrackParticle *trkP, float mass, int PCand){
     lw_geo_hists_t * myGeoHists = 0;
     switch (i){
       case DET_BARRELA:
-        myGeoHists = &tBarrelA;
+        myGeoHists = &m_tBarrelA;
         break;
       case DET_BARRELC:
-        myGeoHists = &tBarrelC;
+        myGeoHists = &m_tBarrelC;
 	break;
       case DET_ENDCAPA:
-        myGeoHists = &tEndCapA;
+        myGeoHists = &m_tEndCapA;
 	break;
       case DET_ENDCAPC:
-        myGeoHists = &tEndCapC;
+        myGeoHists = &m_tEndCapC;
 	break;
       default : continue;
     }
@@ -782,22 +782,22 @@ fillAllHistograms(xAOD::TrackParticle *trkP, float mass, int PCand){
 
     switch (PCand){
       case PCAND_EL:
-        hPIDProb	= tEl.hPIDProb;
-        hHTFrac		= tEl.hHTFrac;
-        pPIDProbEta	= tEl.pPIDProbEta;
-        pHTFracEta	= tEl.pHTFracEta;
+        hPIDProb	= m_tEl.hPIDProb;
+        hHTFrac		= m_tEl.hHTFrac;
+        pPIDProbEta	= m_tEl.pPIDProbEta;
+        pHTFracEta	= m_tEl.pHTFracEta;
         break;
       case PCAND_MU:
-        hPIDProb	= tMu.hPIDProb;
-        hHTFrac		= tMu.hHTFrac;
-        pPIDProbEta	= tMu.pPIDProbEta;
-        pHTFracEta	= tMu.pHTFracEta;
+        hPIDProb	= m_tMu.hPIDProb;
+        hHTFrac		= m_tMu.hHTFrac;
+        pPIDProbEta	= m_tMu.pPIDProbEta;
+        pHTFracEta	= m_tMu.pHTFracEta;
         break;
       case PCAND_PI:
-        hPIDProb	= tPi.hPIDProb;
-        hHTFrac		= tPi.hHTFrac;
-        pPIDProbEta	= tPi.pPIDProbEta;
-        pHTFracEta	= tPi.pHTFracEta;
+        hPIDProb	= m_tPi.hPIDProb;
+        hHTFrac		= m_tPi.hHTFrac;
+        pPIDProbEta	= m_tPi.pPIDProbEta;
+        pHTFracEta	= m_tPi.pHTFracEta;
         break;
       default : break;
     }
@@ -924,8 +924,8 @@ TH2F_LW* TRT_Electron_Monitoring_Tool::trtBookHistoLW(MonGroup &mongroup,
 
 int
 TRT_Electron_Monitoring_Tool::
-myBarrelEC(int m_barrel_ec){
-  switch(m_barrel_ec){
+myBarrelEC(int barrel_ec){
+  switch(barrel_ec){
     case  1 : return DET_BARRELA;
     case -1 : return DET_BARRELC;
     case  2 : return DET_ENDCAPA;
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTErrMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTErrMonTool.h
index 3323a12211c..b6432748a18 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTErrMonTool.h
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTErrMonTool.h
@@ -139,9 +139,9 @@ class SCTErrMonTool : public ManagedMonitorToolBase
 
   TH1I *m_nErrors;
   TH1I *m_nLinksWithErrors;
-  int *nErrors_buf;
-  int *nLinksWithErrors_buf;
-  int nErrors_pos;
+  int *m_nErrors_buf;
+  int *m_nLinksWithErrors_buf;
+  int m_nErrors_pos;
 
   TH1I *m_MaskedAllLinks; // maskedLinks||maskedRODs
 
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitEffMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitEffMonTool.h
index 8831a3f4b5f..e9811cc24bf 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitEffMonTool.h
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitEffMonTool.h
@@ -94,7 +94,7 @@ private:
 
   StatusCode initialize();
 
-  const InDetDD::SCT_DetectorManager * mgr;
+  const InDetDD::SCT_DetectorManager * m_mgr;
 
   /** Method to cut on track or hit variables and automatize DEBUG statements */
   StatusCode failCut (Bool_t value, std::string name);
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitsNoiseMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitsNoiseMonTool.h
index 47163b28e88..3c2dc9bbb68 100644
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitsNoiseMonTool.h
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitsNoiseMonTool.h
@@ -115,17 +115,17 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{
   VecProf2_t m_pnoiseoccupancymapHistoVectorECmTrigger;
   
   TH1F* m_nSP;
-  int *nSP_buf;
-  int nSP_pos;
+  int *m_nSP_buf;
+  int m_nSP_pos;
   TH1F* m_nHits;
-  int *nHits_buf;
-  int nHits_pos;
+  int *m_nHits_buf;
+  int m_nHits_pos;
   TH1F* m_nmaxHits;
-  int *nmaxHits_buf;
-  Identifier *nmaxModule_buf;
+  int *m_nmaxHits_buf;
+  Identifier *m_nmaxModule_buf;
   TH1F* m_nminHits;
-  int *nminHits_buf;
-  Identifier *nminModule_buf;
+  int *m_nminHits_buf;
+  Identifier *m_nminModule_buf;
 
   //Histograms with hits per luminosity block
   H1_t m_numBarrelHitsPerLumiBlock;
@@ -138,7 +138,7 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{
   H1_t m_numSPPerLumiBlockECm;
 
 
-  H2_t rioMap;
+  H2_t m_rioMap;
   //@}
   //Histograms with NO distribution
   TH1F* m_BARNO;
@@ -222,7 +222,7 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{
   VecH1_t m_ncluHistoVectorECm;
 
   //Pointer to histogram of time bin coincidences
-  H2I_t coincidenceHist; 
+  H2I_t m_coincidenceHist; 
 
   /// stream stem for the ROOT histograms
   std::string m_stream;
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTRatioNoiseMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTRatioNoiseMonTool.h
index 0979ba1a041..29d056de921 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTRatioNoiseMonTool.h
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTRatioNoiseMonTool.h
@@ -50,8 +50,6 @@ class StatusCode;
 class SCT_ID;
 class IInDetConditionsSvc;
 
-using namespace SCT_Monitoring;
-
 #define DEBUG(x) ATH_MSG_DEBUG(x)
 #define INFO(x) ATH_MSG_INFO(x)
 #define WARNING(x) ATH_MSG_WARNING(x)
@@ -94,25 +92,25 @@ private:
   typedef std::vector<H2_t> VecH2_t;
   typedef std::vector<H1I_t> VecH1I_t;
   //@}
-  int eventID;
+  int m_eventID;
   int m_numberOfEvents;
   
   
-  int nNoSides_ev;
-  int nOneSide_ev;
-  int nTwoSide_ev;
-  int nNoSidesBarrel_ev[N_BARRELS];
-  int nOneSideBarrel_ev[N_BARRELS];
-  int nTwoSideBarrel_ev[N_BARRELS];
-  int nNonGoodModulesBarrel_ev[N_DISKS];
-  int nNoSidesEndcapA_ev[N_DISKS];
-  int nOneSideEndcapA_ev[N_DISKS];
-  int nTwoSideEndcapA_ev[N_DISKS];
-  int nNonGoodModulesEndcapA_ev[N_DISKS];
-  int nNoSidesEndcapC_ev[N_DISKS];
-  int nOneSideEndcapC_ev[N_DISKS];
-  int nTwoSideEndcapC_ev[N_DISKS];
-  int nNonGoodModulesEndcapC_ev[N_DISKS];
+  int m_nNoSides_ev;
+  int m_nOneSide_ev;
+  int m_nTwoSide_ev;
+  int m_nNoSidesBarrel_ev[SCT_Monitoring::N_BARRELS];
+  int m_nOneSideBarrel_ev[SCT_Monitoring::N_BARRELS];
+  int m_nTwoSideBarrel_ev[SCT_Monitoring::N_BARRELS];
+  int m_nNonGoodModulesBarrel_ev[SCT_Monitoring::N_DISKS];
+  int m_nNoSidesEndcapA_ev[SCT_Monitoring::N_DISKS];
+  int m_nOneSideEndcapA_ev[SCT_Monitoring::N_DISKS];
+  int m_nTwoSideEndcapA_ev[SCT_Monitoring::N_DISKS];
+  int m_nNonGoodModulesEndcapA_ev[SCT_Monitoring::N_DISKS];
+  int m_nNoSidesEndcapC_ev[SCT_Monitoring::N_DISKS];
+  int m_nOneSideEndcapC_ev[SCT_Monitoring::N_DISKS];
+  int m_nTwoSideEndcapC_ev[SCT_Monitoring::N_DISKS];
+  int m_nNonGoodModulesEndcapC_ev[SCT_Monitoring::N_DISKS];
   
   VecProf2_t m_pnoiseoccupancymapHistoVectorECC;
   VecProf2_t m_pnoiseoccupancymapHistoVectorECCSide0;
@@ -124,59 +122,59 @@ private:
   VecProf2_t m_pnoiseoccupancymapHistoVectorECASide0;
   VecProf2_t m_pnoiseoccupancymapHistoVectorECASide1;
   
-  float d1;
-  float n1;
-  float n1Barrel[N_BARRELS];
-  float n1EndcapA[N_DISKS];
-  float n1EndcapC[N_DISKS];
-  float d1Barrel[N_BARRELS];
-  float d1EndcapA[N_DISKS];
-  float d1EndcapC[N_DISKS];
+  float m_d1;
+  float m_n1;
+  float m_n1Barrel[SCT_Monitoring::N_BARRELS];
+  float m_n1EndcapA[SCT_Monitoring::N_DISKS];
+  float m_n1EndcapC[SCT_Monitoring::N_DISKS];
+  float m_d1Barrel[SCT_Monitoring::N_BARRELS];
+  float m_d1EndcapA[SCT_Monitoring::N_DISKS];
+  float m_d1EndcapC[SCT_Monitoring::N_DISKS];
   
-  bool noSidesHit;
-  bool oneSideHit;
-  bool twoSidesHit;
-  bool correct_TimeBin;
+  bool m_noSidesHit;
+  bool m_oneSideHit;
+  bool m_twoSidesHit;
+  bool m_correct_TimeBin;
 
-  int nNoSides[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nOneSide[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nOneSide0[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nOneSide1[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nTwoSide[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
+  int m_nNoSides[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nOneSide[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nOneSide0[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nOneSide1[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nTwoSide[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
   
-  int nLink0[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nLink1[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  bool goodModules[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
+  int m_nLink0[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nLink1[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  bool m_goodModules[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
 
-  int nLayer[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nEta[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nPhi[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nNonGoodModule[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
+  int m_nLayer[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nEta[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nPhi[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nNonGoodModule[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
 
   int m_checkrecent;
   int m_current_lb;
   int m_last_reset_lb;
   
-  int set_timebin;
-  int tbin;
-  int modNum;
-  float ratio;
-  float ratioside0;
-  float ratioside1;
+  int m_set_timebin;
+  int m_tbin;
+  int m_modNum;
+  float m_ratio;
+  float m_ratioside0;
+  float m_ratioside1;
   
   //static const long NBINS_LBs = 2000;
   
-  int nNoSides_lb[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int nOneSide_lb[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
-  int noisyM[SCT_Monitoring::NBINS_LBs+1];
+  int m_nNoSides_lb[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_nOneSide_lb[SCT_Monitoring::N_MOD_BARREL + 2 * SCT_Monitoring::N_MOD_ENDCAPS];
+  int m_noisyM[SCT_Monitoring::NBINS_LBs+1];
   //@name Histograms related members
   //@{
 
   //General Histograms
   H1_t m_NOEV;
-  H1_t m_NOEVBAR[N_BARRELS];
-  H1_t m_NOEVECC[N_DISKS];
-  H1_t m_NOEVECA[N_DISKS];
+  H1_t m_NOEVBAR[SCT_Monitoring::N_BARRELS];
+  H1_t m_NOEVECC[SCT_Monitoring::N_DISKS];
+  H1_t m_NOEVECA[SCT_Monitoring::N_DISKS];
   H2_t m_NOEV_RDO;
   H2_t m_NOEV_Eventnum;
   H1_t m_side;
@@ -185,23 +183,23 @@ private:
   H1_t m_N11;
   H1_t m_N21;
 
-  H1_t m_NZ1BAR[N_BARRELS];
-  H1_t m_N11BAR[N_BARRELS];
-  H1_t m_N21BAR[N_BARRELS];
-  Prof_t m_NZ1BAR_vsLB[N_BARRELS];
-  Prof_t m_N11BAR_vsLB[N_BARRELS];
+  H1_t m_NZ1BAR[SCT_Monitoring::N_BARRELS];
+  H1_t m_N11BAR[SCT_Monitoring::N_BARRELS];
+  H1_t m_N21BAR[SCT_Monitoring::N_BARRELS];
+  Prof_t m_NZ1BAR_vsLB[SCT_Monitoring::N_BARRELS];
+  Prof_t m_N11BAR_vsLB[SCT_Monitoring::N_BARRELS];
 
-  H1_t m_NZ1ECC[N_DISKS];
-  H1_t m_N11ECC[N_DISKS];
-  H1_t m_N21ECC[N_DISKS];
-  Prof_t m_NZ1ECC_vsLB[N_DISKS];
-  Prof_t m_N11ECC_vsLB[N_DISKS];
+  H1_t m_NZ1ECC[SCT_Monitoring::N_DISKS];
+  H1_t m_N11ECC[SCT_Monitoring::N_DISKS];
+  H1_t m_N21ECC[SCT_Monitoring::N_DISKS];
+  Prof_t m_NZ1ECC_vsLB[SCT_Monitoring::N_DISKS];
+  Prof_t m_N11ECC_vsLB[SCT_Monitoring::N_DISKS];
   
-  H1_t m_NZ1ECA[N_DISKS];
-  H1_t m_N11ECA[N_DISKS];
-  H1_t m_N21ECA[N_DISKS];
-  Prof_t m_NZ1ECA_vsLB[N_DISKS];
-  Prof_t m_N11ECA_vsLB[N_DISKS];
+  H1_t m_NZ1ECA[SCT_Monitoring::N_DISKS];
+  H1_t m_N11ECA[SCT_Monitoring::N_DISKS];
+  H1_t m_N21ECA[SCT_Monitoring::N_DISKS];
+  Prof_t m_NZ1ECA_vsLB[SCT_Monitoring::N_DISKS];
+  Prof_t m_N11ECA_vsLB[SCT_Monitoring::N_DISKS];
 
   H1_t m_NO;
   H1_t m_NOSide;
@@ -217,14 +215,14 @@ private:
   H1_t m_NOEC_ShortMiddle;
   H1_t m_NOEC_Inner;
   H1_t m_NOEC_Middle; 
-  H1_t m_NOBAR_layer[N_BARRELS];
-  Prof_t m_NOBAR_layer_vsLB[N_BARRELS];
-  H1_t m_NOECC_disk[N_DISKS];
-  Prof_t m_NOECC_disk_vsLB[N_DISKS];
-  H1_t m_NOECA_disk[N_DISKS];
-  Prof_t m_NOECA_disk_vsLB[N_DISKS];
+  H1_t m_NOBAR_layer[SCT_Monitoring::N_BARRELS];
+  Prof_t m_NOBAR_layer_vsLB[SCT_Monitoring::N_BARRELS];
+  H1_t m_NOECC_disk[SCT_Monitoring::N_DISKS];
+  Prof_t m_NOECC_disk_vsLB[SCT_Monitoring::N_DISKS];
+  H1_t m_NOECA_disk[SCT_Monitoring::N_DISKS];
+  Prof_t m_NOECA_disk_vsLB[SCT_Monitoring::N_DISKS];
   
-  H1_t m_numberHitsinBarrel[N_BARRELS];
+  H1_t m_numberHitsinBarrel[SCT_Monitoring::N_BARRELS];
 
   H1_t m_NZ1_vs_modnum;
   H1_t m_N11_vs_modnum;
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTTracksMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTTracksMonTool.h
index a08cb83e0b7..95b21662cff 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTTracksMonTool.h
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTTracksMonTool.h
@@ -72,10 +72,10 @@ private:
   typedef std::vector<H2_t> VecH2_t;
   //@}
   TH1I *m_nTracks;
-  int *nTracks_buf;
-  int nTracks_pos;
-  TH1I *trackTrigger;
-  TProfile *trackTriggerRate;
+  int *m_nTracks_buf;
+  int m_nTracks_pos;
+  TH1I *m_trackTrigger;
+  TProfile *m_trackTriggerRate;
   TH1F *m_totalBarrelResidual;
   TH1F *m_totalEndCapAResidual;
   TH1F *m_totalEndCapCResidual;
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx
index 446aaa2b77c..64a9e27d202 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx
@@ -156,9 +156,9 @@ SCTErrMonTool::SCTErrMonTool(const std::string &type, const std::string &name, c
   m_rateErrorsPerLumi{},
   m_nErrors{},
   m_nLinksWithErrors{},
-  nErrors_buf{},
-  nLinksWithErrors_buf{},
-  nErrors_pos{},
+  m_nErrors_buf{},
+  m_nLinksWithErrors_buf{},
+  m_nErrors_pos{},
   m_MaskedAllLinks{},
   m_numberOfEventsLumi{},
   m_numberOfEvents{},
@@ -291,8 +291,8 @@ SCTErrMonTool::SCTErrMonTool(const std::string &type, const std::string &name, c
      }
    }
 
-   free(nErrors_buf);
-   free(nLinksWithErrors_buf);
+   free(m_nErrors_buf);
+   free(m_nLinksWithErrors_buf);
  }
 
  // ====================================================================================================
@@ -477,7 +477,7 @@ SCTErrMonTool::SCTErrMonTool(const std::string &type, const std::string &name, c
 
    // BSError histograms
    int nlayer = 0;
-   const std::string m_errorsNames[] = {
+   const std::string errorsNames[] = {
      "ABCD", "Raw", "TimeOut", "", "", "", "", "", "", "",
      "", "BSParse", "MissingLink", "", "", "", "", "",
      "", "", "", "", "", "", "summary", "badError", "", ""
@@ -488,7 +488,7 @@ SCTErrMonTool::SCTErrMonTool(const std::string &type, const std::string &name, c
      else if(reg==1||reg==2) nlayer = N_DISKSx2;
      for (int layer(0); layer != nlayer; ++layer) {
        for (int errType(0); errType != N_ERRTYPES; ++errType) {
-	 if(m_errorsNames[errType]=="")continue;
+	 if(errorsNames[errType]=="")continue;
 	 if (m_doPerLumiErrors) {
 	   if (m_doErr2DPerLumiHists) {
 	     const int xbins(m_allErrsPerLumi[errType][reg][layer]->GetNbinsX() + 1);
@@ -724,7 +724,7 @@ SCTErrMonTool::fillHistograms() {
     Identifier SCT_Identifier = SCT_Collection->identify();
     for (DataVector<SCTRawDataType>::const_iterator p_rdo = SCT_Collection->begin(); p_rdo != p_rdo_end; ++p_rdo) {
       count_SCT_RDO++;
-      SCT3_RawData *rdo3 = dynamic_cast<SCT3_RawData *>(*p_rdo);
+      const SCT3_RawData *rdo3 = dynamic_cast<const SCT3_RawData *>(*p_rdo);
       SCT_Identifier = (*p_rdo)->identify();
       int barrel_ec = m_pSCTHelper->barrel_ec(SCT_Identifier);
       if (barrel_ec == BARREL) {
@@ -1237,31 +1237,31 @@ SCTErrMonTool::fillByteStreamErrors() {
 
   //  if(m_environment==AthenaMonManager::online){
   // Time Dependent SP plots only online
-  nErrors_buf[nErrors_pos] = total_errors;
-  nLinksWithErrors_buf[nErrors_pos] = tot_mod_bytestream_errs[SUMMARY][iGEN];
-  nErrors_pos++;
-  if (nErrors_pos == m_evtsbins) {
-    nErrors_pos = 0;
+  m_nErrors_buf[m_nErrors_pos] = total_errors;
+  m_nLinksWithErrors_buf[m_nErrors_pos] = tot_mod_bytestream_errs[SUMMARY][iGEN];
+  m_nErrors_pos++;
+  if (m_nErrors_pos == m_evtsbins) {
+    m_nErrors_pos = 0;
   }
   if (m_numberOfEvents % m_checkrate == 0) {
     m_nErrors->Reset();
-    Int_t latest_nErrors_pos = nErrors_pos;
+    Int_t latest_nErrors_pos = m_nErrors_pos;
     m_nLinksWithErrors->Reset();
     for (Int_t i = 1; i < m_evtsbins; i++) {
       if (latest_nErrors_pos == m_evtsbins) {
         latest_nErrors_pos = 0;
       }
       if (m_numberOfEvents < m_evtsbins) {
-        if (i < nErrors_pos) {
-          m_nErrors->SetBinContent(i, nErrors_buf[i]);
-          m_nLinksWithErrors->SetBinContent(i, nLinksWithErrors_buf[i]);
+        if (i < m_nErrors_pos) {
+          m_nErrors->SetBinContent(i, m_nErrors_buf[i]);
+          m_nLinksWithErrors->SetBinContent(i, m_nLinksWithErrors_buf[i]);
         }else {
           m_nErrors->SetBinContent(i, 0);
           m_nLinksWithErrors->SetBinContent(i, 0);
         }
       } else {
-        m_nErrors->SetBinContent(i, nErrors_buf[latest_nErrors_pos]);
-        m_nLinksWithErrors->SetBinContent(i, nLinksWithErrors_buf[latest_nErrors_pos]);
+        m_nErrors->SetBinContent(i, m_nErrors_buf[latest_nErrors_pos]);
+        m_nLinksWithErrors->SetBinContent(i, m_nLinksWithErrors_buf[latest_nErrors_pos]);
         m_nErrors->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents);
         m_nLinksWithErrors->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents);
       }
@@ -1352,12 +1352,12 @@ SCTErrMonTool::bookErrHistosHelper(MonGroup &mg, TString name, TString title, TP
 // StatusCode SCTErrMonTool::bookErrHistos(bool newRunFlag(), bool newLumiBlockFlag()){
 StatusCode
 SCTErrMonTool::bookErrHistos() {
-  const std::string m_errorsNames[] = {
+  const std::string errorsNames[] = {
     "ABCD", "Raw", "TimeOut", "LVL1ID", "BCID", "Preamble", "Formatter", "MaskedLinkLink", "RODClock", "TruncROD",
     "ROBFrag", "BSParse", "MissingLink", "MaskedROD", "MaskedLink", "ABCDChip0", "ABCDChip1", "ABCDChip2",
     "ABCDChip3", "ABCDChip4", "ABCDChip5", "ABCDError1", "ABCDError2", "ABCDError4", "summary", "badError", "LinkLevel", "RODLevel"
   };
-  std::string m_errorsNamesMG[] = {
+  std::string errorsNamesMG[] = {
     "SCT/SCTB/errors", "SCT/SCTB/errors", "SCT/SCTB/errors", "SCT/SCTB/errors/LVL1ID", "SCT/SCTB/errors/BCID",
     "SCT/SCTB/errors/Preamble", "SCT/SCTB/errors/Formatter", "SCT/SCTB/errors/MaskedLinkLink",
     "SCT/SCTB/errors/RODClock", "SCT/SCTB/errors/TruncROD", "SCT/SCTB/errors/ROBFrag", "SCT/SCTB/errors",
@@ -1370,7 +1370,7 @@ SCTErrMonTool::bookErrHistos() {
   if (m_doPerLumiErrors) {
     MonGroup lumiErr(this, "SCT/SCTB/errors", lumiBlock, ATTRIB_UNMANAGED);
     if (ManagedMonitorToolBase::newLumiBlockFlag()) {
-      std::string m_layerNames[] = {
+      std::string layerNames[] = {
         "0_0", "0_1", "1_0", "1_1", "2_0", "2_1", "3_0", "3_1"
       };
       m_numErrorsPerLumi[iBARREL] = TH2F_LW::create("NumErrsPerLumi",
@@ -1388,29 +1388,29 @@ SCTErrMonTool::bookErrHistos() {
         msg(MSG::WARNING) << "Couldn't book RateErrorsPerLumi" << endmsg;
       }
       for (unsigned int bin(0); bin < n_lumiErrBins; bin++) {
-        m_numErrorsPerLumi[iBARREL]->GetXaxis()->SetBinLabel(bin + 1, m_errorsNames[bin].c_str());
-        m_rateErrorsPerLumi[iBARREL]->GetXaxis()->SetBinLabel(bin + 1, m_errorsNames[bin].c_str());
+        m_numErrorsPerLumi[iBARREL]->GetXaxis()->SetBinLabel(bin + 1, errorsNames[bin].c_str());
+        m_rateErrorsPerLumi[iBARREL]->GetXaxis()->SetBinLabel(bin + 1, errorsNames[bin].c_str());
       }
       for (unsigned int bin(0); bin < N_BARRELSx2; bin++) {
-        m_numErrorsPerLumi[iBARREL]->GetYaxis()->SetBinLabel(bin + 1, m_layerNames[bin].c_str());
-        m_rateErrorsPerLumi[iBARREL]->GetYaxis()->SetBinLabel(bin + 1, m_layerNames[bin].c_str());
+        m_numErrorsPerLumi[iBARREL]->GetYaxis()->SetBinLabel(bin + 1, layerNames[bin].c_str());
+        m_rateErrorsPerLumi[iBARREL]->GetYaxis()->SetBinLabel(bin + 1, layerNames[bin].c_str());
       }
       // int limit = 2*n_barrels;
       bool somethingFailed(false);
       if (m_doErr2DPerLumiHists) {
         for (int layer(0); layer != N_BARRELSx2; ++layer) {
 	  for (int errType(0); errType != N_ERRTYPES; ++errType) {
-            MonGroup lumiErr2(this, m_errorsNamesMG[errType], lumiBlock, ATTRIB_UNMANAGED);
-            std::string name1 = m_errorsNames[errType] + "ErrsPerLumi";
-            std::string title = m_errorsNames[errType] + " errors per lumiblock layer ";
-            std::string name2 = std::string("T") + m_errorsNames[errType] + "ErrsPerLumi_";
+            MonGroup lumiErr2(this, errorsNamesMG[errType], lumiBlock, ATTRIB_UNMANAGED);
+            std::string name1 = errorsNames[errType] + "ErrsPerLumi";
+            std::string title = errorsNames[errType] + " errors per lumiblock layer ";
+            std::string name2 = std::string("T") + errorsNames[errType] + "ErrsPerLumi_";
             somethingFailed |=
               bookErrHistosHelper(lumiErr2, name1, title, name2, m_allErrsPerLumi[errType][iBARREL][layer],
                                   m_pallErrsPerLumi[errType][iBARREL][layer], layer).isFailure();
-	    if(m_errorsNames[errType]=="ABCD"||m_errorsNames[errType]=="Raw"||
-	       m_errorsNames[errType]=="TimeOut"||m_errorsNames[errType]=="BSParse"||
-	       m_errorsNames[errType]=="MissingLink"||m_errorsNames[errType]=="summary"||m_errorsNames[errType]=="badError"){
-	      MonGroup lumiErr3(this, m_errorsNamesMG[errType]+"/"+m_errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
+	    if(errorsNames[errType]=="ABCD"||errorsNames[errType]=="Raw"||
+	       errorsNames[errType]=="TimeOut"||errorsNames[errType]=="BSParse"||
+	       errorsNames[errType]=="MissingLink"||errorsNames[errType]=="summary"||errorsNames[errType]=="badError"){
+	      MonGroup lumiErr3(this, errorsNamesMG[errType]+"/"+errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
 	      somethingFailed |= bookErrHistosHelper(lumiErr3, name1, title, name2, m_allErrsPerLumi_tmp[errType][iBARREL][layer],
 						   m_pallErrsPerLumi_tmp[errType][iBARREL][layer], layer).isFailure();
 	    }
@@ -1446,9 +1446,9 @@ SCTErrMonTool::bookErrHistos() {
     m_nLinksWithErrors->GetYaxis()->SetTitle("Num of Links with Errors");
     size_t nErrors_buf_size;
     nErrors_buf_size = m_evtsbins * sizeof(int);
-    nErrors_buf = (int *) malloc(nErrors_buf_size);
-    nLinksWithErrors_buf = (int *) malloc(nErrors_buf_size);
-    nErrors_pos = 0;
+    m_nErrors_buf = (int *) malloc(nErrors_buf_size);
+    m_nLinksWithErrors_buf = (int *) malloc(nErrors_buf_size);
+    m_nErrors_pos = 0;
     if (Errors.regHist(m_nErrors).isFailure()) {
       msg(MSG::WARNING) << "Couldn't book nErrors vs event number hist" << endmsg;
     }
@@ -1469,18 +1469,18 @@ SCTErrMonTool::bookErrHistos() {
     bool somethingFailed(false);
     for (int layer(0); layer != N_BARRELSx2; ++layer) {
       for (int errType(0); errType != N_ERRTYPES; ++errType) {
-        MonGroup err2(this, m_errorsNamesMG[errType], run, ATTRIB_UNMANAGED);
-        std::string name1 = m_errorsNames[errType] + "Errs_";
-        std::string title = m_errorsNames[errType] + " errors layer ";
-        std::string name2 = std::string("T") + m_errorsNames[errType] + "Errs_";
+        MonGroup err2(this, errorsNamesMG[errType], run, ATTRIB_UNMANAGED);
+        std::string name1 = errorsNames[errType] + "Errs_";
+        std::string title = errorsNames[errType] + " errors layer ";
+        std::string name2 = std::string("T") + errorsNames[errType] + "Errs_";
         somethingFailed |= bookErrHistosHelper(err2, name1, title, name2, m_allErrs[errType][iBARREL][layer],
                                                m_pallErrs[errType][iBARREL][layer], layer).isFailure();
         m_allErrs[errType][iBARREL][layer]->GetXaxis()->SetTitle("Index in the direction of #eta");
         m_allErrs[errType][iBARREL][layer]->GetYaxis()->SetTitle("Index in the direction of #phi");
-	if(m_errorsNames[errType]=="ABCD"||m_errorsNames[errType]=="Raw"||
-	   m_errorsNames[errType]=="TimeOut"||m_errorsNames[errType]=="BSParse"||
-	   m_errorsNames[errType]=="MissingLink"||m_errorsNames[errType]=="summary"||m_errorsNames[errType]=="badError"){
-	  MonGroup lumiErr3(this, m_errorsNamesMG[errType]+"/"+m_errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
+	if(errorsNames[errType]=="ABCD"||errorsNames[errType]=="Raw"||
+	   errorsNames[errType]=="TimeOut"||errorsNames[errType]=="BSParse"||
+	   errorsNames[errType]=="MissingLink"||errorsNames[errType]=="summary"||errorsNames[errType]=="badError"){
+	  MonGroup lumiErr3(this, errorsNamesMG[errType]+"/"+errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
 	  somethingFailed |= bookErrHistosHelper(lumiErr3, name1, title, name2, m_allErrs_tmp[errType][iBARREL][layer],
 					       m_pallErrs_tmp[errType][iBARREL][layer], layer).isFailure();
 	}
@@ -1504,12 +1504,12 @@ SCTErrMonTool::bookErrHistos() {
 // ====================================================================================================
 StatusCode
 SCTErrMonTool::bookPositiveEndCapErrHistos() {
-  const std::string m_errorsNames[] = {
+  const std::string errorsNames[] = {
     "ABCD", "Raw", "TimeOut", "LVL1ID", "BCID", "Preamble", "Formatter", "MaskedLinkLink", "RODClock", "TruncROD",
     "ROBFrag", "BSParse", "MissingLink", "MaskedROD", "MaskedLink", "ABCDChip0", "ABCDChip1", "ABCDChip2",
     "ABCDChip3", "ABCDChip4", "ABCDChip5", "ABCDError1", "ABCDError2", "ABCDError4", "summary", "badError", "LinkLevel", "RODLevel"
   };
-  std::string m_errorsNamesMG[] = {
+  std::string errorsNamesMG[] = {
     "SCT/SCTEA/errors", "SCT/SCTEA/errors", "SCT/SCTEA/errors", "SCT/SCTEA/errors/LVL1ID", "SCT/SCTEA/errors/BCID",
     "SCT/SCTEA/errors/Preamble", "SCT/SCTEA/errors/Formatter", "SCT/SCTEA/errors/MaskedLinkLink",
     "SCT/SCTEA/errors/RODClock", "SCT/SCTEA/errors/TruncROD", "SCT/SCTEA/errors/ROBFrag", "SCT/SCTEA/errors",
@@ -1522,7 +1522,7 @@ SCTErrMonTool::bookPositiveEndCapErrHistos() {
   if (m_doPerLumiErrors) {
     MonGroup lumiErr(this, "SCT/SCTEA/errors", lumiBlock, ATTRIB_UNMANAGED);
     if (ManagedMonitorToolBase::newLumiBlockFlag()) {
-      std::string m_layerNames[N_DISKSx2] = {
+      std::string layerNames[N_DISKSx2] = {
         "0_0", "0_1", "1_0", "1_1", "2_0", "2_1", "3_0", "3_1", "4_0", "4_1", "5_0", "5_1", "6_0", "6_1", "7_0", "7_1",
         "8_0", "8_1"
       };
@@ -1540,27 +1540,27 @@ SCTErrMonTool::bookPositiveEndCapErrHistos() {
         msg(MSG::WARNING) << "Couldn't book RateErrorsPerLumi" << endmsg;
       }
       for (unsigned int bin(0); bin < n_lumiErrBins; bin++) {
-        m_numErrorsPerLumi[iECp]->GetXaxis()->SetBinLabel(bin + 1, m_errorsNames[bin].c_str());
-        m_rateErrorsPerLumi[iECp]->GetXaxis()->SetBinLabel(bin + 1, m_errorsNames[bin].c_str());
+        m_numErrorsPerLumi[iECp]->GetXaxis()->SetBinLabel(bin + 1, errorsNames[bin].c_str());
+        m_rateErrorsPerLumi[iECp]->GetXaxis()->SetBinLabel(bin + 1, errorsNames[bin].c_str());
       }
       for (unsigned int bin(0); bin != N_ENDCAPSx2; ++bin) {
-        m_numErrorsPerLumi[iECp]->GetYaxis()->SetBinLabel(bin + 1, m_layerNames[bin].c_str());
-        m_rateErrorsPerLumi[iECp]->GetYaxis()->SetBinLabel(bin + 1, m_layerNames[bin].c_str());
+        m_numErrorsPerLumi[iECp]->GetYaxis()->SetBinLabel(bin + 1, layerNames[bin].c_str());
+        m_rateErrorsPerLumi[iECp]->GetYaxis()->SetBinLabel(bin + 1, layerNames[bin].c_str());
       }
       bool failedBooking(false);
       if (m_doErr2DPerLumiHists) {
         for (int layer(0); layer != N_DISKSx2; ++layer) {
           for (int errType(0); errType != N_ERRTYPES; ++errType) {
-            MonGroup lumiErr2(this, m_errorsNamesMG[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
-            std::string name1 = m_errorsNames[errType] + "ErrsECpPerLumi_";
-            std::string title = m_errorsNames[errType] + " errors per lumiblock Disk ";
-            std::string name2 = std::string("T") + m_errorsNames[errType] + "ErrsECpPerLumi_";
+            MonGroup lumiErr2(this, errorsNamesMG[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
+            std::string name1 = errorsNames[errType] + "ErrsECpPerLumi_";
+            std::string title = errorsNames[errType] + " errors per lumiblock Disk ";
+            std::string name2 = std::string("T") + errorsNames[errType] + "ErrsECpPerLumi_";
             failedBooking |= bookErrHistosHelper(lumiErr2, name1, title, name2, m_allErrsPerLumi[errType][iECp][layer],
                                                  m_pallErrsPerLumi[errType][iECp][layer], layer).isFailure();
-	    if(m_errorsNames[errType]=="ABCD"||m_errorsNames[errType]=="Raw"||
-	       m_errorsNames[errType]=="TimeOut"||m_errorsNames[errType]=="BSParse"||
-	       m_errorsNames[errType]=="MissingLink"||m_errorsNames[errType]=="summary"||m_errorsNames[errType]=="badError"){
-	      MonGroup lumiErr3(this, m_errorsNamesMG[errType]+"/"+m_errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
+	    if(errorsNames[errType]=="ABCD"||errorsNames[errType]=="Raw"||
+	       errorsNames[errType]=="TimeOut"||errorsNames[errType]=="BSParse"||
+	       errorsNames[errType]=="MissingLink"||errorsNames[errType]=="summary"||errorsNames[errType]=="badError"){
+	      MonGroup lumiErr3(this, errorsNamesMG[errType]+"/"+errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
 	      failedBooking |= bookErrHistosHelper(lumiErr3, name1, title, name2, m_allErrsPerLumi_tmp[errType][iECp][layer],
 						   m_pallErrsPerLumi_tmp[errType][iECp][layer], layer).isFailure();
 	    }
@@ -1593,17 +1593,17 @@ SCTErrMonTool::bookPositiveEndCapErrHistos() {
     bool failedBooking(false);
     for (int layer(0); layer != N_DISKSx2; ++layer) {
       for (int errType(0); errType != N_ERRTYPES; ++errType) {
-        MonGroup err2(this, m_errorsNamesMG[errType], run, ATTRIB_UNMANAGED);
-        std::string name1 = m_errorsNames[errType] + "ErrsECp_";
-        std::string title = m_errorsNames[errType] + " errors Disk ";
-        std::string name2 = std::string("T") + m_errorsNames[errType] + "ErrsECp_";
+        MonGroup err2(this, errorsNamesMG[errType], run, ATTRIB_UNMANAGED);
+        std::string name1 = errorsNames[errType] + "ErrsECp_";
+        std::string title = errorsNames[errType] + " errors Disk ";
+        std::string name2 = std::string("T") + errorsNames[errType] + "ErrsECp_";
         failedBooking |=
           bookErrHistosHelper(err2, name1, title, name2, m_allErrs[errType][iECp][layer],
                               m_pallErrs[errType][iECp][layer], layer, false).isFailure();
-	if(m_errorsNames[errType]=="ABCD"||m_errorsNames[errType]=="Raw"||
-	   m_errorsNames[errType]=="TimeOut"||m_errorsNames[errType]=="BSParse"||
-	   m_errorsNames[errType]=="MissingLink"||m_errorsNames[errType]=="summary"||m_errorsNames[errType]=="badError"){
-	  MonGroup lumiErr3(this, m_errorsNamesMG[errType]+"/"+m_errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
+	if(errorsNames[errType]=="ABCD"||errorsNames[errType]=="Raw"||
+	   errorsNames[errType]=="TimeOut"||errorsNames[errType]=="BSParse"||
+	   errorsNames[errType]=="MissingLink"||errorsNames[errType]=="summary"||errorsNames[errType]=="badError"){
+	  MonGroup lumiErr3(this, errorsNamesMG[errType]+"/"+errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
 	  failedBooking |= bookErrHistosHelper(lumiErr3, name1, title, name2, m_allErrs_tmp[errType][iECp][layer],
 					       m_pallErrs_tmp[errType][iECp][layer], layer).isFailure();
 	}
@@ -1633,12 +1633,12 @@ SCTErrMonTool::bookPositiveEndCapErrHistos() {
 // StatusCode SCTErrMonTool::bookNegativeEndCapErrHistos(bool isNewRun, bool isNewLumiBlock){
 StatusCode
 SCTErrMonTool::bookNegativeEndCapErrHistos() {
-  const std::string m_errorsNames[] = {
+  const std::string errorsNames[] = {
     "ABCD", "Raw", "TimeOut", "LVL1ID", "BCID", "Preamble", "Formatter", "MaskedLinkLink", "RODClock", "TruncROD",
     "ROBFrag", "BSParse", "MissingLink", "MaskedROD", "MaskedLink", "ABCDChip0", "ABCDChip1", "ABCDChip2",
     "ABCDChip3", "ABCDChip4", "ABCDChip5", "ABCDError1", "ABCDError2", "ABCDError4", "summary", "badError", "LinkLevel", "RODLevel"
   };
-  std::string m_errorsNamesMG[] = {
+  std::string errorsNamesMG[] = {
     "SCT/SCTEC/errors", "SCT/SCTEC/errors", "SCT/SCTEC/errors", "SCT/SCTEC/errors/LVL1ID", "SCT/SCTEC/errors/BCID",
     "SCT/SCTEC/errors/Preamble", "SCT/SCTEC/errors/Formatter", "SCT/SCTEC/errors/MaskedLinkLink",
     "SCT/SCTEC/errors/RODClock", "SCT/SCTEC/errors/TruncROD", "SCT/SCTEC/errors/ROBFrag", "SCT/SCTEC/errors",
@@ -1651,7 +1651,7 @@ SCTErrMonTool::bookNegativeEndCapErrHistos() {
   if (m_doPerLumiErrors) {
     MonGroup lumiErr(this, "SCT/SCTEC/errors", lumiBlock, ATTRIB_UNMANAGED);
     if (ManagedMonitorToolBase::newLumiBlockFlag()) {
-      std::string m_layerNames[N_DISKSx2] = {
+      std::string layerNames[N_DISKSx2] = {
         "0_0", "0_1", "1_0", "1_1", "2_0", "2_1", "3_0", "3_1", "4_0", "4_1", "5_0", "5_1", "6_0", "6_1", "7_0", "7_1",
         "8_0", "8_1"
       };
@@ -1669,27 +1669,27 @@ SCTErrMonTool::bookNegativeEndCapErrHistos() {
         msg(MSG::WARNING) << "Couldn't book RateErrorsPerLumi" << endmsg;
       }
       for (unsigned int bin(0); bin < n_lumiErrBins; bin++) {
-        m_numErrorsPerLumi[iECm]->GetXaxis()->SetBinLabel(bin + 1, m_errorsNames[bin].c_str());
-        m_rateErrorsPerLumi[iECm]->GetXaxis()->SetBinLabel(bin + 1, m_errorsNames[bin].c_str());
+        m_numErrorsPerLumi[iECm]->GetXaxis()->SetBinLabel(bin + 1, errorsNames[bin].c_str());
+        m_rateErrorsPerLumi[iECm]->GetXaxis()->SetBinLabel(bin + 1, errorsNames[bin].c_str());
       }
       for (unsigned int bin(0); bin < N_ENDCAPSx2; bin++) {
-        m_numErrorsPerLumi[iECm]->GetYaxis()->SetBinLabel(bin + 1, m_layerNames[bin].c_str());
-        m_rateErrorsPerLumi[iECm]->GetYaxis()->SetBinLabel(bin + 1, m_layerNames[bin].c_str());
+        m_numErrorsPerLumi[iECm]->GetYaxis()->SetBinLabel(bin + 1, layerNames[bin].c_str());
+        m_rateErrorsPerLumi[iECm]->GetYaxis()->SetBinLabel(bin + 1, layerNames[bin].c_str());
       }
       bool failedBooking(false);
       if (m_doErr2DPerLumiHists) {
         for (int layer(0); layer != N_DISKSx2; ++layer) {
           for (int errType(0); errType != N_ERRTYPES; ++errType) {
-            MonGroup lumiErr2(this, m_errorsNamesMG[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
-            std::string name1 = m_errorsNames[errType] + "ErrsECmPerLumi_";
-            std::string title = m_errorsNames[errType] + " errors per lumiblock layer ";
-            std::string name2 = std::string("T") + m_errorsNames[errType] + "ErrsECmPerLumi_";
+            MonGroup lumiErr2(this, errorsNamesMG[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
+            std::string name1 = errorsNames[errType] + "ErrsECmPerLumi_";
+            std::string title = errorsNames[errType] + " errors per lumiblock layer ";
+            std::string name2 = std::string("T") + errorsNames[errType] + "ErrsECmPerLumi_";
             failedBooking |= bookErrHistosHelper(lumiErr2, name1, title, name2, m_allErrsPerLumi[errType][iECm][layer],
                                                  m_pallErrsPerLumi[errType][iECm][layer], layer).isFailure();
-	    if(m_errorsNames[errType]=="ABCD"||m_errorsNames[errType]=="Raw"||
-	       m_errorsNames[errType]=="TimeOut"||m_errorsNames[errType]=="BSParse"||
-	       m_errorsNames[errType]=="MissingLink"||m_errorsNames[errType]=="summary"||m_errorsNames[errType]=="badError"){
-	      MonGroup lumiErr3(this, m_errorsNamesMG[errType]+"/"+m_errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
+	    if(errorsNames[errType]=="ABCD"||errorsNames[errType]=="Raw"||
+	       errorsNames[errType]=="TimeOut"||errorsNames[errType]=="BSParse"||
+	       errorsNames[errType]=="MissingLink"||errorsNames[errType]=="summary"||errorsNames[errType]=="badError"){
+	      MonGroup lumiErr3(this, errorsNamesMG[errType]+"/"+errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
 	      failedBooking |= bookErrHistosHelper(lumiErr3, name1, title, name2, m_allErrsPerLumi_tmp[errType][iECm][layer],
 						   m_pallErrsPerLumi_tmp[errType][iECm][layer], layer).isFailure();
 	    }
@@ -1722,19 +1722,19 @@ SCTErrMonTool::bookNegativeEndCapErrHistos() {
     bool failedBooking(false);
     for (int layer(0); layer != N_DISKSx2; ++layer) {
       for (int errType(0); errType != N_ERRTYPES; ++errType) {
-        MonGroup err2(this, m_errorsNamesMG[errType], run, ATTRIB_UNMANAGED);
-        std::string name1 = m_errorsNames[errType] + "ErrsECm_";
-        std::string title = m_errorsNames[errType] + " errors Disk ";
-        std::string name2 = std::string("T") + m_errorsNames[errType] + "ErrsECm_";
+        MonGroup err2(this, errorsNamesMG[errType], run, ATTRIB_UNMANAGED);
+        std::string name1 = errorsNames[errType] + "ErrsECm_";
+        std::string title = errorsNames[errType] + " errors Disk ";
+        std::string name2 = std::string("T") + errorsNames[errType] + "ErrsECm_";
         failedBooking |=
           bookErrHistosHelper(err2, name1, title, name2, m_allErrs[errType][iECm][layer],
                               m_pallErrs[errType][iECm][layer], layer, false).isFailure();
         m_allErrs[errType][iECm][layer]->GetXaxis()->SetTitle("Index in the direction of #eta");
         m_allErrs[errType][iECm][layer]->GetYaxis()->SetTitle("Index in the direction of #phi");
-	if(m_errorsNames[errType]=="ABCD"||m_errorsNames[errType]=="Raw"||
-	   m_errorsNames[errType]=="TimeOut"||m_errorsNames[errType]=="BSParse"||
-	   m_errorsNames[errType]=="MissingLink"||m_errorsNames[errType]=="summary"||m_errorsNames[errType]=="badError"){
-	  MonGroup lumiErr3(this, m_errorsNamesMG[errType]+"/"+m_errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
+	if(errorsNames[errType]=="ABCD"||errorsNames[errType]=="Raw"||
+	   errorsNames[errType]=="TimeOut"||errorsNames[errType]=="BSParse"||
+	   errorsNames[errType]=="MissingLink"||errorsNames[errType]=="summary"||errorsNames[errType]=="badError"){
+	  MonGroup lumiErr3(this, errorsNamesMG[errType]+"/"+errorsNames[errType], lumiBlock, ATTRIB_UNMANAGED);// 07.01.2015
 	  failedBooking |= bookErrHistosHelper(lumiErr3, name1, title, name2, m_allErrs_tmp[errType][iECm][layer],
 					       m_pallErrs_tmp[errType][iECm][layer], layer).isFailure();
 	}
@@ -1775,20 +1775,20 @@ SCTErrMonTool::bookConfMaps() {
       msg(MSG::INFO) << "Global Path :" << m_path << endmsg;
     }
 
-    std::string m_SummaryBinNames[] = {
+    std::string SummaryBinNames[] = {
       "Mod Out", "Flagged Links", "Masked Links", "Errors", "Inefficient", "Noisy"
     };
-    std::string m_ConfigurationBinNames[] = {
+    std::string ConfigurationBinNames[] = {
       "Modules", "Link 0", "Link 1", "Chips", "Strips (10^{2})"
     };
-    std::string m_ConfigurationOnlineBinNames[] = {
+    std::string ConfigurationOnlineBinNames[] = {
       "Mod Out", "Flagged Links", "Masked Links", "Errors"
     };
-    std::string m_ConfigurationEffBinNames[] = {
+    std::string ConfigurationEffBinNames[] = {
       "Ineff B", "Ineff EA", "Ineff EC", "ALL"
     };
 
-    std::string m_ConfigurationNoiseBinNames[] = {
+    std::string ConfigurationNoiseBinNames[] = {
       "Noisy B", "Noisy EA", "Noisy EC", "ALL"
     };
     string hNumEndcap[N_DISKS] = {
@@ -1854,15 +1854,15 @@ SCTErrMonTool::bookConfMaps() {
       for (int reg = 0; reg != NREGIONS_INC_GENERAL; ++reg) {
         m_Conf[reg] = TProfile_LW::create(conftitle[reg], conflabel[reg], Confbins, -0.5, Confbins - 0.5);
         for (int bin = 0; bin < Confbins; bin++) {
-          m_Conf[reg]->GetXaxis()->SetBinLabel(bin + 1, m_SummaryBinNames[bin].c_str());
+          m_Conf[reg]->GetXaxis()->SetBinLabel(bin + 1, SummaryBinNames[bin].c_str());
         }
         m_ConfRN[reg] = TProfile_LW::create(conftitleRN[reg], conflabel[reg], Confbins, -0.5, Confbins - 0.5);
         for (int bin = 0; bin < Confbins; bin++) {
-          m_ConfRN[reg]->GetXaxis()->SetBinLabel(bin + 1, m_SummaryBinNames[bin].c_str());
+          m_ConfRN[reg]->GetXaxis()->SetBinLabel(bin + 1, SummaryBinNames[bin].c_str());
         }
         m_ConfNew[reg] = TProfile_LW::create(conftitleNew[reg], conflabel[reg], Confbins-1, -0.5, Confbins-1 - 0.5);
         for (int bin = 1; bin < Confbins; bin++) {
-          m_ConfNew[reg]->GetXaxis()->SetBinLabel(bin, m_SummaryBinNames[bin].c_str());
+          m_ConfNew[reg]->GetXaxis()->SetBinLabel(bin, SummaryBinNames[bin].c_str());
         }
         m_ConfOutModules[reg] = TProfile_LW::create(conftitleOutM[reg], conflabel[reg], 1, -0.5, 0.5);
 	m_ConfOutModules[reg]->GetXaxis()->SetBinLabel(1, "Mod Out");
@@ -1872,7 +1872,7 @@ SCTErrMonTool::bookConfMaps() {
           m_ConfOnline[reg] = TProfile_LW::create(confonlinetitle[reg], conflabel[reg] + " Online", conf_online_bins,
                                                   -0.5, conf_online_bins - 0.5);
           for (int bin = 0; bin < conf_online_bins; bin++) {
-            m_ConfOnline[reg]->GetXaxis()->SetBinLabel(bin + 1, m_ConfigurationOnlineBinNames[bin].c_str());
+            m_ConfOnline[reg]->GetXaxis()->SetBinLabel(bin + 1, ConfigurationOnlineBinNames[bin].c_str());
           }
         }
         for (int errType = 0; errType != SUMMARY; ++errType) {
@@ -1965,22 +1965,22 @@ SCTErrMonTool::bookConfMaps() {
         m_ConfEffOnline = new TProfile(confefftitle, "Number of Inefficient Modules Online", conf_eff_bins, -0.5,
                                        conf_eff_bins - 0.5);
         for (int bin = 0; bin < conf_eff_bins; bin++) {
-          m_ConfEffOnline->GetXaxis()->SetBinLabel(bin + 1, m_ConfigurationEffBinNames[bin].c_str());
+          m_ConfEffOnline->GetXaxis()->SetBinLabel(bin + 1, ConfigurationEffBinNames[bin].c_str());
         }
         m_ConfNoiseOnline = TProfile_LW::create(confnoisetitle, "Number of Noisy Modules Online", conf_noise_bins, -0.5,
                                                 conf_noise_bins - 0.5);
         for (int bin = 0; bin < conf_noise_bins; bin++) {
-          m_ConfNoiseOnline->GetXaxis()->SetBinLabel(bin + 1, m_ConfigurationNoiseBinNames[bin].c_str());
+          m_ConfNoiseOnline->GetXaxis()->SetBinLabel(bin + 1, ConfigurationNoiseBinNames[bin].c_str());
         }
         m_ConfNoiseOnlineRecent = TProfile_LW::create(confnoisetitle_recent, "Number of Noisy Modules Online Recent",
                                                       conf_noise_bins, -0.5, conf_noise_bins - 0.5);
 
         for (int bin = 0; bin < conf_noise_bins; bin++) {
-          m_ConfNoiseOnlineRecent->GetXaxis()->SetBinLabel(bin + 1, m_ConfigurationNoiseBinNames[bin].c_str());
+          m_ConfNoiseOnlineRecent->GetXaxis()->SetBinLabel(bin + 1, ConfigurationNoiseBinNames[bin].c_str());
         }
       }
       for (int bin = 0; bin < ConfbinsDetailed; bin++) {
-        m_DetailedConfiguration->GetXaxis()->SetBinLabel(bin + 1, m_ConfigurationBinNames[bin].c_str());
+        m_DetailedConfiguration->GetXaxis()->SetBinLabel(bin + 1, ConfigurationBinNames[bin].c_str());
       }
 
       for (int reg = 0; reg != NREGIONS_INC_GENERAL; ++reg) {
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx
index 541a802b985..d639a69607e 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx
@@ -89,7 +89,7 @@ namespace {// anonymous namespace for functions at file scope
   };// 23.01.2015
 
   template< typename T > Identifier
-  surfaceOnTrackIdentifier(T &tsos, const bool useTrackParameters = true) {
+  surfaceOnTrackIdentifier(const T &tsos, const bool useTrackParameters = true) {
     Identifier result(0); // default constructor produces invalid value
     const Trk::MeasurementBase *mesb = tsos->measurementOnTrack();
 
@@ -130,7 +130,7 @@ using std::string;
 // Constructor with parameters:
 SCTHitEffMonTool::SCTHitEffMonTool(const string &type, const string &name, const IInterface *parent) :
   ManagedMonitorToolBase(type, name, parent),
-  mgr(nullptr),
+  m_mgr(nullptr),
   m_pSCTHelper(0),
   m_pManager(0),
   m_TrackName(std::string("ResolvedSCTTracks")),// original track collection
@@ -348,7 +348,7 @@ StatusCode
 SCTHitEffMonTool::initialize() {
   INFO("Initializing SCTHitEffMonTool");
 
-  CHECK(detStore()->retrieve(mgr, "SCT"));
+  CHECK(detStore()->retrieve(m_mgr, "SCT"));
   CHECK(detStore()->retrieve(m_sctId, "SCT_ID"));
   CHECK(detStore()->retrieve(m_pixelId, "PixelID"));
   CHECK(detStore()->retrieve(m_trtId, "TRT_ID"));
@@ -1139,16 +1139,16 @@ SCTHitEffMonTool::fillHistograms() {
   }
 
   // ---- First try if m_tracksName is a TrackCollection
-  SG::ReadHandle<TrackCollection>m_tracks(m_TrackName);
+  SG::ReadHandle<TrackCollection>tracks(m_TrackName);
   if (evtStore()->contains<TrackCollection> (m_TrackName.key())) {
-    if (not m_tracks.isValid()) {
-      WARNING("Tracks not found: " << m_tracks << " / " << m_TrackName.key());
+    if (not tracks.isValid()) {
+      WARNING("Tracks not found: " << tracks << " / " << m_TrackName.key());
       if (m_chronotime) {
         m_chrono->chronoStop("SCTHitEff");
       }
       return StatusCode::SUCCESS;
     }else {
-      VERBOSE("Successfully retrieved " << m_TrackName.key() << " : " << m_tracks->size() << " items");
+      VERBOSE("Successfully retrieved " << m_TrackName.key() << " : " << tracks->size() << " items");
     }
   } else {
     WARNING("Collection " << m_TrackName.key() << " not found");
@@ -1169,7 +1169,7 @@ SCTHitEffMonTool::fillHistograms() {
 
   // cut on number of tracks (skip this cut for online)
   if (m_environment != AthenaMonManager::online) {
-    if (failCut(m_tracks->size() <= m_maxTracks, "# of tracks cut")) {
+    if (failCut(tracks->size() <= m_maxTracks, "# of tracks cut")) {
       if (m_chronotime) {
         m_chrono->chronoStop("SCTHitEff");
       }
@@ -1180,8 +1180,8 @@ SCTHitEffMonTool::fillHistograms() {
   Int_t nTrk(0), nTrkPars(0), nTrkGood(0);
 
   // Loop over track collection to count tracks
-  const TrackCollection::const_iterator endOfTracks(m_tracks->end());
-  for (TrackCollection::const_iterator itr(m_tracks->begin()); itr != endOfTracks; ++itr) {
+  const TrackCollection::const_iterator endOfTracks(tracks->end());
+  for (TrackCollection::const_iterator itr(tracks->begin()); itr != endOfTracks; ++itr) {
     nTrk++;
     const Trk::Track *pthisTrack(*itr);
     if (not pthisTrack) {
@@ -1219,8 +1219,8 @@ SCTHitEffMonTool::fillHistograms() {
   }
 
   // Loop over original track collection
-  //  const TrackCollection::const_iterator endOfTracks(m_tracks->end());
-  for (TrackCollection::const_iterator itr(m_tracks->begin()); itr != endOfTracks; ++itr) {
+  //  const TrackCollection::const_iterator endOfTracks(tracks->end());
+  for (TrackCollection::const_iterator itr(tracks->begin()); itr != endOfTracks; ++itr) {
     VERBOSE("Starting new track");
     const Trk::Track *pthisTrack(*itr);
     if (not pthisTrack) {
@@ -1278,11 +1278,11 @@ SCTHitEffMonTool::fillHistograms() {
       trackWithHoles->trackStateOnSurfaces()->begin();
     DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItrE = trackWithHoles->trackStateOnSurfaces()->end();
 
-    Int_t m_NHits[3] = {
+    Int_t NHits[3] = {
       0, 0, 0
     };
-    Int_t m_pixelNHits(0);
-    Int_t m_trtNHits(0);
+    Int_t pixelNHits(0);
+    Int_t trtNHits(0);
     std::map < Identifier, Double_t > mapOfTrackHitResiduals;
     Double_t zmin = std::numeric_limits<float>::max();
     Double_t zmax = -std::numeric_limits<float>::max();
@@ -1301,13 +1301,13 @@ SCTHitEffMonTool::fillHistograms() {
       if ((*TSOSItr)->type(Trk::TrackStateOnSurface::Measurement) or(*TSOSItr)->type(Trk::TrackStateOnSurface::Outlier))
       {
         if (m_pixelId->is_pixel(surfaceID)) {
-          m_pixelNHits++;
+          pixelNHits++;
         }
         if (m_trtId->is_trt(surfaceID)) {
-          m_trtNHits++;
+          trtNHits++;
         }
         if (m_sctId->is_sct(surfaceID)) {
-          m_NHits[bec2Index(m_sctId->barrel_ec(surfaceID))]++;
+          NHits[bec2Index(m_sctId->barrel_ec(surfaceID))]++;
           mapOfTrackHitResiduals[surfaceID] = getResidual(surfaceID, (*TSOSItr)->trackParameters(), &*p_sctclcontainer);
         }
       }
@@ -1337,7 +1337,7 @@ SCTHitEffMonTool::fillHistograms() {
       }
     }
 
-    Int_t sctNHits(m_NHits[ENDCAP_C_INDEX] + m_NHits[BARREL_INDEX] + m_NHits[ENDCAP_A_INDEX]);
+    Int_t sctNHits(NHits[ENDCAP_C_INDEX] + NHits[BARREL_INDEX] + NHits[ENDCAP_A_INDEX]);
     std::vector<Bool_t> layersCrossedByTrack[N_REGIONS];
     std::vector<Int_t> nHolesOnLayer[N_REGIONS];
     std::vector<Int_t> nHolesDistOnLayer[N_REGIONS];
@@ -1369,7 +1369,7 @@ SCTHitEffMonTool::fillHistograms() {
         continue;
       }
       Int_t histnumber(detIndex);
-      Int_t m_eff(0), m_unas(0);
+      Int_t eff(0), unas(0);
       IdentifierHash sideHash(m_sctId->wafer_hash(surfaceID));
       Identifier module_id(m_sctId->module_id(surfaceID));
       Float_t layerPlusHalfSide(float(layer) + float(side) * 0.5);
@@ -1382,17 +1382,17 @@ SCTHitEffMonTool::fillHistograms() {
 
       if ((*TSOSItr)->type(Trk::TrackStateOnSurface::Measurement) or(*TSOSItr)->type(Trk::TrackStateOnSurface::Outlier))
       {
-        m_eff = 1;
+        eff = 1;
       } else if ((*TSOSItr)->type(Trk::TrackStateOnSurface::Hole) and fabs(trackHitResidual) < distCut) {
-        m_eff = 1;
-        m_unas = 1;
+        eff = 1;
+        unas = 1;
       }
 
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(0.); // Some sort of track on silicon
-        m_Eff_SelectionHisto[isub]->Fill(0., m_eff); // Some sort of track on silicon
+        m_Eff_SelectionHisto[isub]->Fill(0., eff); // Some sort of track on silicon
         m_SelectionHisto[isub]->Fill(1.); // Past the bad module selection
-        m_Eff_SelectionHisto[isub]->Fill(1., m_eff); // Past the bad module selection
+        m_Eff_SelectionHisto[isub]->Fill(1., eff); // Past the bad module selection
       }
 
       bool otherFaceFound(false);
@@ -1418,29 +1418,29 @@ SCTHitEffMonTool::fillHistograms() {
       }
 
       if (m_detailed) {
-        m_Eff_nSCTHisto[isub]->Fill(sctNHits, m_eff);
-        m_Eff_nTRTHisto[isub]->Fill(m_trtNHits, m_eff);
+        m_Eff_nSCTHisto[isub]->Fill(sctNHits, eff);
+        m_Eff_nTRTHisto[isub]->Fill(trtNHits, eff);
       }
       if (m_useSCTorTRT) {
-        if (failCut(m_trtNHits >= m_minTRTHits or
+        if (failCut(trtNHits >= m_minTRTHits or
                     sctNHits >= m_minSCTHits, "track cut: min TRT or SCT hits")) {
           continue;
         }
       } else {
-        if (failCut(m_trtNHits >= m_minTRTHits, "track cut: min TRT hits")) {
+        if (failCut(trtNHits >= m_minTRTHits, "track cut: min TRT hits")) {
           continue;
         }
         if (failCut(sctNHits >= m_minSCTHits, "track cut: min SCT hits")) {
           continue;
         }
-        if (failCut(m_pixelNHits >= m_minPixelHits, "track cut: min Pixel hits")) {
+        if (failCut(pixelNHits >= m_minPixelHits, "track cut: min Pixel hits")) {
           continue;
         }
       }
 
       if (m_detailed) {
         m_nOtherHisto[isub]->Fill(nOther);
-        m_Eff_nOtherHisto[isub]->Fill(nOther, m_eff);
+        m_Eff_nOtherHisto[isub]->Fill(nOther, eff);
       }
 
       if (failCut(nOther >= m_minOtherHits, "track cut: minOtherHits")) {
@@ -1449,10 +1449,10 @@ SCTHitEffMonTool::fillHistograms() {
 
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(2.); // Past SCT/TRT Hits selection
-        m_Eff_SelectionHisto[isub]->Fill(2., m_eff); // Past SCT/TRT Hits selection
+        m_Eff_SelectionHisto[isub]->Fill(2., eff); // Past SCT/TRT Hits selection
         if (m_useTRTPhase or m_isCosmic) {
           m_timecorHisto[isub]->Fill(timecor);
-          m_Eff_timecorHisto[isub]->Fill(timecor, m_eff);
+          m_Eff_timecorHisto[isub]->Fill(timecor, eff);
         }
       }
       DEBUG("Use TRT phase " << m_useTRTPhase << " is cosmic? " << m_isCosmic << " timecor " << timecor);
@@ -1512,7 +1512,7 @@ SCTHitEffMonTool::fillHistograms() {
       }
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(3.); // Past TRT time/Hits selection
-        m_Eff_SelectionHisto[isub]->Fill(3., m_eff); // Past TRT time/Hits selection
+        m_Eff_SelectionHisto[isub]->Fill(3., eff); // Past TRT time/Hits selection
       }
 
       Bool_t enclosingHits(true);
@@ -1544,7 +1544,7 @@ SCTHitEffMonTool::fillHistograms() {
 
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(4.); //
-        m_Eff_SelectionHisto[isub]->Fill(4., m_eff); // Past nHits cut
+        m_Eff_SelectionHisto[isub]->Fill(4., eff); // Past nHits cut
       }
 
       // Now fill with the local z
@@ -1553,11 +1553,11 @@ SCTHitEffMonTool::fillHistograms() {
       Double_t chi2_div_ndf = ndf > 0 ? chi2 / ndf : -1;
 
       if (m_detailed) {
-        m_Eff_phiHisto[isub]->Fill(phiUp, m_eff);
+        m_Eff_phiHisto[isub]->Fill(phiUp, eff);
         if (ndf > 0 and chi2_div_ndf <= m_maxChi2 and otherFaceFound) {
-          m_Eff_phiHistoFinal[isub]->Fill(phiUp, m_eff);
+          m_Eff_phiHistoFinal[isub]->Fill(phiUp, eff);
         }
-        m_Unas_phiHisto[isub]->Fill(phiUp, m_unas);
+        m_Unas_phiHisto[isub]->Fill(phiUp, unas);
         m_phiLocalHisto[isub]->Fill(phiUp);
         if (fabs(d0) < 50) {
           m_phiLocalCutHisto[isub]->Fill(phiUp);
@@ -1572,12 +1572,12 @@ SCTHitEffMonTool::fillHistograms() {
       }
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(5.); // Past phiUp cut
-        m_Eff_SelectionHisto[isub]->Fill(5., m_eff); // Past phiUp cut
+        m_Eff_SelectionHisto[isub]->Fill(5., eff); // Past phiUp cut
         if (ndf > 0) {
           m_chi2Histo[isub]->Fill(chi2_div_ndf);
-          m_Eff_chi2Histo[isub]->Fill(chi2_div_ndf, m_eff);
+          m_Eff_chi2Histo[isub]->Fill(chi2_div_ndf, eff);
           if (otherFaceFound) {
-            m_Eff_chi2HistoFinal[isub]->Fill(chi2_div_ndf, m_eff);
+            m_Eff_chi2HistoFinal[isub]->Fill(chi2_div_ndf, eff);
           }
           if (m_superDetailed) {
             m_chi2ResidualHisto[isub]->Fill(trackHitResidual, chi2_div_ndf);
@@ -1591,12 +1591,12 @@ SCTHitEffMonTool::fillHistograms() {
 
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(6.); //
-        m_Eff_SelectionHisto[isub]->Fill(6., m_eff); // Past chi2
+        m_Eff_SelectionHisto[isub]->Fill(6., eff); // Past chi2
         const float face(otherFaceFound);
-        m_Eff_otherFaceHisto[isub]->Fill(face, m_eff);
-        m_Unas_otherFaceHisto[isub]->Fill(face, m_unas);
-        m_Eff_otherFaceHisto[isub]->Fill(-1, m_eff);
-        m_Unas_otherFaceHisto[isub]->Fill(-1, m_unas);
+        m_Eff_otherFaceHisto[isub]->Fill(face, eff);
+        m_Unas_otherFaceHisto[isub]->Fill(face, unas);
+        m_Eff_otherFaceHisto[isub]->Fill(-1, eff);
+        m_Unas_otherFaceHisto[isub]->Fill(-1, unas);
       }
 
       if (m_requireOtherFace and failCut(otherFaceFound, "hit cut: other face found")) {
@@ -1605,7 +1605,7 @@ SCTHitEffMonTool::fillHistograms() {
 
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(7.); // Past other face selection
-        m_Eff_SelectionHisto[isub]->Fill(7., m_eff); // Past other face selection
+        m_Eff_SelectionHisto[isub]->Fill(7., eff); // Past other face selection
       }
       if (not trkParamOnSurface) continue;
       Double_t xl(trkParamOnSurface->localPosition()[0]);
@@ -1621,7 +1621,7 @@ SCTHitEffMonTool::fillHistograms() {
         if (ieta == 1) {
           m_xlResidualE1Histo[isub][layer]->Fill(xl, trackHitResidual);
         }
-        if (m_unas) {
+        if (unas) {
           m_xlResidualUnasHisto[isub][layer]->Fill(xl, trackHitResidual);
         }
       }
@@ -1655,11 +1655,11 @@ SCTHitEffMonTool::fillHistograms() {
       }
 
       if (m_detailed) {
-        if (m_eff == 1) {
+        if (eff == 1) {
           if (m_superDetailed) {
             m_localHitHisto[isub]->Fill(xl, yl);
           }
-          if (m_unas) {
+          if (unas) {
             m_localUnasHisto[isub]->Fill(xl, yl);
           }
           m_localHitXHisto[isub]->Fill(xl);
@@ -1667,23 +1667,23 @@ SCTHitEffMonTool::fillHistograms() {
         } else {
           m_localMissHisto[isub]->Fill(xl, yl);
         }
-        m_Eff_xlocHisto[isub]->Fill(xl, m_eff);
-        m_Eff_ylocHistos[isub]->Fill(yl, m_eff);
-        m_Unas_xlocHisto[isub]->Fill(xl, m_unas);
-        m_Unas_ylocHisto[isub]->Fill(yl, m_unas);
+        m_Eff_xlocHisto[isub]->Fill(xl, eff);
+        m_Eff_ylocHistos[isub]->Fill(yl, eff);
+        m_Unas_xlocHisto[isub]->Fill(xl, unas);
+        m_Unas_ylocHisto[isub]->Fill(yl, unas);
       }
 
       if (m_requireGuardRing and failCut(insideGuardRing, "hit cut: inside guard ring")) {
         continue;
       }
 
-      if (m_eff == 1 and m_superDetailed) {
+      if (eff == 1 and m_superDetailed) {
         m_localHitGHisto[isub]->Fill(xl, yl);
       }
 
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(8.); // Past guard ring
-        m_Eff_SelectionHisto[isub]->Fill(8., m_eff); // Past guard ring
+        m_Eff_SelectionHisto[isub]->Fill(8., eff); // Past guard ring
       }
 
       // Check bad chips
@@ -1710,42 +1710,42 @@ SCTHitEffMonTool::fillHistograms() {
         continue;
       }
       VERBOSE("Candidate passed all cuts");
-      m_Eff_summaryHisto_old[isub]->Fill(layerPlusHalfSide, m_eff); // in order to calculate m_EffsummaryIncBadMod
-      m_Eff_summaryHisto[isub]->Fill(dedicated_layerPlusHalfSide, m_eff); // adjustment for dedicated_title()
-      m_Eff_hashCodeHisto->Fill(Double_t(sideHash), m_eff);// 15.12.2014
-      m_Eff_LumiBlockHisto[isub]->Fill(pEvent->lumiBlock(), m_eff);// 20.01.2015
-      m_Eff_LumiBlockHisto_Total->Fill(pEvent->lumiBlock(), m_eff);// 02.09.2016
+      m_Eff_summaryHisto_old[isub]->Fill(layerPlusHalfSide, eff); // in order to calculate m_EffsummaryIncBadMod
+      m_Eff_summaryHisto[isub]->Fill(dedicated_layerPlusHalfSide, eff); // adjustment for dedicated_title()
+      m_Eff_hashCodeHisto->Fill(Double_t(sideHash), eff);// 15.12.2014
+      m_Eff_LumiBlockHisto[isub]->Fill(pEvent->lumiBlock(), eff);// 20.01.2015
+      m_Eff_LumiBlockHisto_Total->Fill(pEvent->lumiBlock(), eff);// 02.09.2016
       if (BCIDpos == 0 && InTrain) {
-        m_Eff_summaryHistoFirstBCID[isub]->Fill(dedicated_layerPlusHalfSide, m_eff); // adjustment for dedicated_title()
+        m_Eff_summaryHistoFirstBCID[isub]->Fill(dedicated_layerPlusHalfSide, eff); // adjustment for dedicated_title()
       }
       if (m_detailed) {
         m_SelectionHisto[isub]->Fill(9.); // Past bad chip
-        m_Eff_SelectionHisto[isub]->Fill(9., m_eff); // Past bad chip
+        m_Eff_SelectionHisto[isub]->Fill(9., eff); // Past bad chip
         m_EventHisto[isub]->Fill(pEvent->eventNumber());
-        m_Eff_EventHisto[isub]->Fill(pEvent->eventNumber(), m_eff);
+        m_Eff_EventHisto[isub]->Fill(pEvent->eventNumber(), eff);
         m_hashCodeHisto->Fill(Double_t(sideHash));
-        m_Unas_summaryHisto[isub]->Fill(layerPlusHalfSide, m_unas);
-        m_Eff_etaHisto[isub]->Fill(eta, m_eff);
-        m_Eff_ptiHisto[isub]->Fill(perigeeCharge / pT, m_eff);
-        m_Unas_ptiHisto[isub]->Fill(perigeeCharge / pT, m_unas);
-        m_Eff_d0Histo[isub]->Fill(d0, m_eff);
-        m_Eff_z0Histo[isub]->Fill(z0, m_eff);
-        m_Eff_ptHisto[isub]->Fill(log10(pT), m_eff);
+        m_Unas_summaryHisto[isub]->Fill(layerPlusHalfSide, unas);
+        m_Eff_etaHisto[isub]->Fill(eta, eff);
+        m_Eff_ptiHisto[isub]->Fill(perigeeCharge / pT, eff);
+        m_Unas_ptiHisto[isub]->Fill(perigeeCharge / pT, unas);
+        m_Eff_d0Histo[isub]->Fill(d0, eff);
+        m_Eff_z0Histo[isub]->Fill(z0, eff);
+        m_Eff_ptHisto[isub]->Fill(log10(pT), eff);
         m_ResidualHisto[isub]->Fill(trackHitResidual);
-        if (m_unas == 1) {
+        if (unas == 1) {
           m_ResidualUnasHisto[isub]->Fill(trackHitResidual);
         }
-        if (m_eff == 0) {
+        if (eff == 0) {
           m_ResidualMissHisto[isub]->Fill(trackHitResidual);
         }
-        m_Eff_nTrk[isub]->Fill(nTrk, m_eff);
-        m_Eff_nGoodTrk[isub]->Fill(nTrkGood, m_eff);
+        m_Eff_nTrk[isub]->Fill(nTrk, eff);
+        m_Eff_nGoodTrk[isub]->Fill(nTrkGood, eff);
       }
       if (m_superDetailed) {
-        // m_Eff_LumiBlockHisto[isub]->Fill(pEvent->lumiBlock(), m_eff);//20.01.2015
+        // m_Eff_LumiBlockHisto[isub]->Fill(pEvent->lumiBlock(), eff);//20.01.2015
         chipPos = (side == 1) ? 11 - chipPos : chipPos;
-        m_inEffChip[isub]->Fill(sideHash, chipPos, int(m_eff == 0));
-        m_inEffStrip[isub]->Fill(sideHash, xl / 79.95e-3 + 768. / 2., int(m_eff == 0));
+        m_inEffChip[isub]->Fill(sideHash, chipPos, int(eff == 0));
+        m_inEffStrip[isub]->Fill(sideHash, xl / 79.95e-3 + 768. / 2., int(eff == 0));
         // Find the opposite side of this module,
         if (side == 0) {
           Double_t trackHitResidual2(999);
@@ -1754,33 +1754,33 @@ SCTHitEffMonTool::fillHistograms() {
             trackHitResidual2 = otherItr->second;
           }
           m_TwoSidesResiduals[isub]->Fill(trackHitResidual, trackHitResidual2);
-          if (m_eff == 0 or m_unas == 1) {
+          if (eff == 0 or unas == 1) {
             m_TwoSidesResidualsIneff[isub]->Fill(trackHitResidual, trackHitResidual2);
           }
         }
         const int layerSideIndex = int(layerPlusHalfSide * 2);
         layersCrossedByTrack[isub][layerSideIndex] = true;
-        nHolesDistOnLayer[isub][layerSideIndex] += int(m_eff == 0);
+        nHolesDistOnLayer[isub][layerSideIndex] += int(eff == 0);
         nHolesOnLayer[isub][layerSideIndex] += int((*TSOSItr)->type(Trk::TrackStateOnSurface::Hole));
         if (fabs(trackHitResidual) < 65) {
           m_layerResidualHistos[isub][layerSideIndex]->Fill(m_sctId->eta_module(surfaceID),
                                                             m_sctId->phi_module(surfaceID), trackHitResidual);
         }
       }
-      m_Eff_Total->Fill(Double_t(isub), m_eff);
+      m_Eff_Total->Fill(Double_t(isub), eff);
       if (BCIDpos == 0 && InTrain) {
-        m_Eff_TotalBCID->Fill(Double_t(isub), m_eff);
+        m_Eff_TotalBCID->Fill(Double_t(isub), eff);
       }
       useDetector[isub] = true;
       const int ieta(m_sctId->eta_module(surfaceID));
       const int iphi(m_sctId->phi_module(surfaceID));
-      m_effMap[histnumber][side]->Fill(ieta, iphi, m_eff);
-      m_effLumiBlock[histnumber][side]->Fill(pEvent->lumiBlock(), m_eff);// 23.01.2015
+      m_effMap[histnumber][side]->Fill(ieta, iphi, eff);
+      m_effLumiBlock[histnumber][side]->Fill(pEvent->lumiBlock(), eff);// 23.01.2015
 
       if (testOffline) {
         m_ineffMap[histnumber][side]->Fill(ieta, iphi, 1); // dummyfill for testing
       }else {
-        m_ineffMap[histnumber][side]->Fill(ieta, iphi, (m_eff == 0));
+        m_ineffMap[histnumber][side]->Fill(ieta, iphi, (eff == 0));
       }
       if (testOffline) {
         INFO("Filling " << histnumber << ", " << side << " eta " << ieta << " phi " << iphi);
@@ -1791,12 +1791,12 @@ SCTHitEffMonTool::fillHistograms() {
       m_d0TkHisto->Fill(d0);
       m_z0TkHisto->Fill(z0);
       m_PtTkHisto->Fill(log10(pT));
-      m_mNHitHisto->Fill(m_NHits[ENDCAP_C_INDEX]);
-      m_pNHitHisto->Fill(m_NHits[ENDCAP_A_INDEX]);
-      m_barrelNHitHisto->Fill(m_NHits[BARREL_INDEX]);
+      m_mNHitHisto->Fill(NHits[ENDCAP_C_INDEX]);
+      m_pNHitHisto->Fill(NHits[ENDCAP_A_INDEX]);
+      m_barrelNHitHisto->Fill(NHits[BARREL_INDEX]);
       m_SCTNHitHisto->Fill(sctNHits);
-      m_pixelNHitHisto->Fill(m_pixelNHits);
-      m_trtNHitHisto->Fill(m_trtNHits);
+      m_pixelNHitHisto->Fill(pixelNHits);
+      m_trtNHitHisto->Fill(trtNHits);
       for (Int_t thisRegion(0); thisRegion != N_REGIONS; ++thisRegion) {
         if (useDetector[thisRegion]) {
           m_etaTkUsedHisto[thisRegion]->Fill(eta);
@@ -1822,7 +1822,7 @@ SCTHitEffMonTool::fillHistograms() {
     delete trackWithHoles;
     trackWithHoles = 0;
   }
-  VERBOSE("finished loop over tracks = " << (*m_tracks).size());
+  VERBOSE("finished loop over tracks = " << (*tracks).size());
   if (m_detailed) {
     m_nTrkHisto->Fill(nTrk);
     m_nTrkParsHisto->Fill(nTrkPars);
@@ -1844,8 +1844,8 @@ StatusCode
 SCTHitEffMonTool::procHistograms() {                                                                             // hidetoshi
                                                                                                                  // 14.01.22
   if (m_superDetailed) {
-    const std::set<Identifier> *m_badModules = m_configConditions->badModules();
-    INFO("Found " << m_badModules->size() << " bad modules");
+    const std::set<Identifier> *badModules = m_configConditions->badModules();
+    INFO("Found " << badModules->size() << " bad modules");
     std::array < std::array < double, N_ENDCAPS >, N_REGIONS > MaxEta;
     std::array < std::array < double, N_ENDCAPS >, N_REGIONS > MaxPhi;
     for (int isub(0); isub < N_REGIONS; ++isub) {
@@ -1864,7 +1864,7 @@ SCTHitEffMonTool::procHistograms() {
       }
       Int_t isub(bec2Index(m_sctId->barrel_ec(*wafItr)));
       Int_t layer(m_sctId->layer_disk(*wafItr));
-      InDetDD::SiDetectorElement *element = mgr->getDetectorElement(*wafItr);
+      InDetDD::SiDetectorElement *element = m_mgr->getDetectorElement(*wafItr);
       const Amg::Vector3D position = element->center();
       element->getEtaPhiRegion(0., etaMin, etaMax, phiMin, phiMax, rz);
       etabins[isub][layer].push_back(etaMin);
@@ -1876,8 +1876,8 @@ SCTHitEffMonTool::procHistograms() {
         dPhi = 2 * M_PI - dPhi;
       }
       float dEta(fabs(etaMax - etaMin));
-      std::set< Identifier >::const_iterator bMItr(m_badModules->find(*wafItr));
-      Float_t eff(Float_t(bMItr == m_badModules->end()));
+      std::set< Identifier >::const_iterator bMItr(badModules->find(*wafItr));
+      Float_t eff(Float_t(bMItr == badModules->end()));
       Float_t accSide[2] = {
         eff, eff
       };
@@ -1974,7 +1974,7 @@ SCTHitEffMonTool::procHistograms() {
         WARNING("Barrel-or-endcap index is invalid");
         return StatusCode::FAILURE;
       }
-      InDetDD::SiDetectorElement *element = mgr->getDetectorElement(surfaceID);
+      InDetDD::SiDetectorElement *element = m_mgr->getDetectorElement(surfaceID);
       //      const HepGeom::Point3D<float> position = element->center();
       //      m_accPhysMap[histnumber]->Fill(position.pseudoRapidity(), position.phi(), (1. - bMod->second) * N_CHIPS *
       // 2);
@@ -2036,7 +2036,7 @@ StatusCode
 SCTHitEffMonTool::findAnglesToWaferSurface(const Amg::Vector3D &mom, Identifier id, Double_t &theta, Double_t &phi) {
   phi = 90.;
   theta = 90.;
-  InDetDD::SiDetectorElement *element = mgr->getDetectorElement(id);
+  InDetDD::SiDetectorElement *element = m_mgr->getDetectorElement(id);
   if (not element) {
     VERBOSE("findAnglesToWaferSurface: failed to find detector element for id = " << m_sctId->print_to_string(id));
     return StatusCode::FAILURE;
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx
index e2f818a34a7..c01c8a3ae9b 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx
@@ -143,24 +143,24 @@ SCTHitsNoiseMonTool::SCTHitsNoiseMonTool(const std::string &type,
                                          const IInterface *parent) :
   SCTMotherTrigMonTool(type, name, parent),
   m_nSP(nullptr),
-  nSP_buf(nullptr),
-  nSP_pos(0),
+  m_nSP_buf(nullptr),
+  m_nSP_pos(0),
   m_nHits(nullptr),
-  nHits_buf(nullptr),
-  nHits_pos(0),
+  m_nHits_buf(nullptr),
+  m_nHits_pos(0),
   m_nmaxHits(nullptr),
-  nmaxHits_buf(nullptr),
-  nmaxModule_buf(nullptr),
+  m_nmaxHits_buf(nullptr),
+  m_nmaxModule_buf(nullptr),
   m_nminHits(nullptr),
-  nminHits_buf(nullptr),
-  nminModule_buf(nullptr),
+  m_nminHits_buf(nullptr),
+  m_nminModule_buf(nullptr),
   m_numBarrelHitsPerLumiBlock(nullptr),
   m_numHitsPerLumiBlockECp(nullptr),
   m_numHitsPerLumiBlockECm(nullptr),
   m_numBarrelSPPerLumiBlock(nullptr),
   m_numSPPerLumiBlockECp(nullptr),
   m_numSPPerLumiBlockECm(nullptr),
-  rioMap(nullptr),
+  m_rioMap(nullptr),
   //
   m_BARNO(nullptr),
   m_BARNOTrigger(nullptr),
@@ -206,7 +206,7 @@ SCTHitsNoiseMonTool::SCTHitsNoiseMonTool(const std::string &type,
   m_hitsvstrigger(nullptr),
   m_hitsvsL1ID(nullptr),
   m_ncluHisto(nullptr),
-  coincidenceHist(nullptr),
+  m_coincidenceHist(nullptr),
   m_numberOfEvents(0),
   m_numberOfEventsTrigger(0),
   m_numberOfEventsRecent(0),
@@ -338,12 +338,12 @@ SCTHitsNoiseMonTool::SCTHitsNoiseMonTool(const std::string &type,
 // ====================================================================================================
 // ====================================================================================================
 SCTHitsNoiseMonTool::~SCTHitsNoiseMonTool() {
-  free(nSP_buf);
-  free(nmaxHits_buf);
-  free(nminHits_buf);
-  free(nmaxModule_buf);
-  free(nminModule_buf);
-  free(nHits_buf);
+  free(m_nSP_buf);
+  free(m_nmaxHits_buf);
+  free(m_nminHits_buf);
+  free(m_nmaxModule_buf);
+  free(m_nminModule_buf);
+  free(m_nHits_buf);
 }
 
 // ====================================================================================================
@@ -919,7 +919,7 @@ SCTHitsNoiseMonTool::generalHistsandNoise() {
     DataVector<SCTRawDataType>::const_iterator p_rdo = SCT_Collection->begin();
     DataVector<SCTRawDataType>::const_iterator end_rdo = SCT_Collection->end();
     for (; p_rdo != end_rdo; ++p_rdo) {
-      SCT3_RawData *rdo3 = dynamic_cast<SCT3_RawData *>(*p_rdo);
+      const SCT3_RawData *rdo3 = dynamic_cast<const SCT3_RawData *>(*p_rdo);
       int tbin;// = (*p_rdo)->getTimeBin();
       if (rdo3 != 0) {
         tbin = (rdo3)->getTimeBin();
@@ -1176,36 +1176,36 @@ SCTHitsNoiseMonTool::generalHistsandNoise() {
   if (m_environment == AthenaMonManager::online) {
     // Time Dependent plots only online
     bool badmodule = false;
-    nHits_buf[nHits_pos] = meanhits;
-    nmaxHits_buf[nHits_pos] = maxhits;
-    nmaxModule_buf[nHits_pos] = maxhits_Id;
-    nminHits_buf[nHits_pos] = minhits;
-    nminModule_buf[nHits_pos] = minhits_Id;
-    nHits_pos++;
-    if (nHits_pos == m_evtsbins) {
-      nHits_pos = 0;
+    m_nHits_buf[m_nHits_pos] = meanhits;
+    m_nmaxHits_buf[m_nHits_pos] = maxhits;
+    m_nmaxModule_buf[m_nHits_pos] = maxhits_Id;
+    m_nminHits_buf[m_nHits_pos] = minhits;
+    m_nminModule_buf[m_nHits_pos] = minhits_Id;
+    m_nHits_pos++;
+    if (m_nHits_pos == m_evtsbins) {
+      m_nHits_pos = 0;
     }
 
     if (m_numberOfEvents % m_checkrate == 0) {
       m_nHits->Reset();
       m_nmaxHits->Reset();
-      Int_t latest_nHits_pos = nHits_pos;
+      Int_t latest_nHits_pos = m_nHits_pos;
       m_nminHits->Reset();
       // Check if the same module is the noisiest one for at least 10 events
       // Need to add a similar check for modules with the minimum number of hits
-      if (nHits_pos > 10) {
+      if (m_nHits_pos > 10) {
         for (int s = 10; s > 0; --s) {
-          int npos = nHits_pos - s;
-          if (nmaxModule_buf[npos] == nmaxModule_buf[npos - 1]) {
+          int npos = m_nHits_pos - s;
+          if (m_nmaxModule_buf[npos] == m_nmaxModule_buf[npos - 1]) {
             badmodule = true;
           } else {
             badmodule = false;
           }
         }
-      } else if (nHits_pos < 10 && m_numberOfEvents > m_evtsbins) {
+      } else if (m_nHits_pos < 10 && m_numberOfEvents > m_evtsbins) {
         for (int s = 10; s > 0; --s) {
-          int npos = nHits_pos - s;
-          int nppos = nHits_pos - s - 1;
+          int npos = m_nHits_pos - s;
+          int nppos = m_nHits_pos - s - 1;
           if (npos < 0) {
             npos = m_evtsbins + npos;
           }
@@ -1213,7 +1213,7 @@ SCTHitsNoiseMonTool::generalHistsandNoise() {
           if (nppos < 0) {
             nppos = m_evtsbins + nppos;
           }
-          if (nmaxModule_buf[npos] == nmaxModule_buf[nppos]) {
+          if (m_nmaxModule_buf[npos] == m_nmaxModule_buf[nppos]) {
             badmodule = true;
           } else {
             badmodule = false;
@@ -1227,10 +1227,10 @@ SCTHitsNoiseMonTool::generalHistsandNoise() {
         }
 
         if (m_numberOfEvents < m_evtsbins) {
-          if (i < nHits_pos) {
-            m_nHits->SetBinContent(i, nHits_buf[i]);
-            m_nmaxHits->SetBinContent(i, nmaxHits_buf[i]);
-            m_nminHits->SetBinContent(i, nminHits_buf[i]);
+          if (i < m_nHits_pos) {
+            m_nHits->SetBinContent(i, m_nHits_buf[i]);
+            m_nmaxHits->SetBinContent(i, m_nmaxHits_buf[i]);
+            m_nminHits->SetBinContent(i, m_nminHits_buf[i]);
           }else {
             m_nHits->SetBinContent(i, 0);
             m_nmaxHits->SetBinContent(i, 0);
@@ -1238,13 +1238,13 @@ SCTHitsNoiseMonTool::generalHistsandNoise() {
           }
         } else {
           // Fill average histo
-          m_nHits->SetBinContent(i, nHits_buf[latest_nHits_pos]);
+          m_nHits->SetBinContent(i, m_nHits_buf[latest_nHits_pos]);
           m_nHits->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents);
           // Fill max histo
-          m_nmaxHits->SetBinContent(i, nmaxHits_buf[latest_nHits_pos]);
+          m_nmaxHits->SetBinContent(i, m_nmaxHits_buf[latest_nHits_pos]);
           m_nmaxHits->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents);
           // Fill min histo
-          m_nminHits->SetBinContent(i, nminHits_buf[latest_nHits_pos]);
+          m_nminHits->SetBinContent(i, m_nminHits_buf[latest_nHits_pos]);
           m_nminHits->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents);
           // Change color of the Line if found a noisy module
           // Need to add similar system for minimum histogram
@@ -3009,12 +3009,12 @@ SCTHitsNoiseMonTool::bookNoiseDistributions() {
 StatusCode
 SCTHitsNoiseMonTool::bookSPvsEventNumber() {
   if (newRunFlag()) {
-    free(nSP_buf);
-    free(nHits_buf);
-    free(nmaxHits_buf);
-    free(nminHits_buf);
-    free(nmaxModule_buf);
-    free(nminModule_buf);
+    free(m_nSP_buf);
+    free(m_nHits_buf);
+    free(m_nmaxHits_buf);
+    free(m_nminHits_buf);
+    free(m_nmaxModule_buf);
+    free(m_nminModule_buf);
     MonGroup BarrelSPHist(this, "SCT/GENERAL/hits", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED);
     // Book a histogram
     m_nSP = th1Factory("sct_sp_vs_en", "Number of Spacepoints vs Event Number", BarrelSPHist, 1, m_evtsbins + 1,
@@ -3023,8 +3023,8 @@ SCTHitsNoiseMonTool::bookSPvsEventNumber() {
     m_nSP->GetYaxis()->SetTitle("Num of Spacepoints");
     size_t nSP_buf_size;
     nSP_buf_size = m_evtsbins * sizeof(int);
-    nSP_buf = (int *) malloc(nSP_buf_size);
-    nSP_pos = 0;
+    m_nSP_buf = (int *) malloc(nSP_buf_size);
+    m_nSP_pos = 0;
 
     m_nHits = th1Factory("sct_av_hits_vs_en", "Number of Average Hits vs Event Number", BarrelSPHist, 1, m_evtsbins + 1,
                          m_evtsbins);
@@ -3032,8 +3032,8 @@ SCTHitsNoiseMonTool::bookSPvsEventNumber() {
     m_nHits->GetYaxis()->SetTitle("Num of Average Hits");
     size_t nHits_buf_size;
     nHits_buf_size = m_evtsbins * sizeof(int);
-    nHits_buf = (int *) malloc(nHits_buf_size);
-    nHits_pos = 0;
+    m_nHits_buf = (int *) malloc(nHits_buf_size);
+    m_nHits_pos = 0;
 
     m_nmaxHits = th1Factory("sct_max_hits_vs_en", "Max Number of Hits vs Event Number", BarrelSPHist, 1, m_evtsbins + 1,
                             m_evtsbins);
@@ -3041,10 +3041,10 @@ SCTHitsNoiseMonTool::bookSPvsEventNumber() {
     m_nmaxHits->GetYaxis()->SetTitle("Num of Max Hits");
     size_t nmaxHits_buf_size;
     nmaxHits_buf_size = m_evtsbins * sizeof(int);
-    nmaxHits_buf = (int *) malloc(nmaxHits_buf_size);
+    m_nmaxHits_buf = (int *) malloc(nmaxHits_buf_size);
     size_t nmaxModule_buf_size;
     nmaxModule_buf_size = m_evtsbins * sizeof(Identifier);
-    nmaxModule_buf = (Identifier *) malloc(nmaxModule_buf_size);
+    m_nmaxModule_buf = (Identifier *) malloc(nmaxModule_buf_size);
 
     m_nminHits = th1Factory("sct_min_hits_vs_en", "Min Number of Hits vs Event Number", BarrelSPHist, 1, m_evtsbins + 1,
                             m_evtsbins);
@@ -3052,10 +3052,10 @@ SCTHitsNoiseMonTool::bookSPvsEventNumber() {
     m_nminHits->GetYaxis()->SetTitle("Num of Min Hits");
     size_t nminHits_buf_size;
     nminHits_buf_size = m_evtsbins * sizeof(int);
-    nminHits_buf = (int *) malloc(nminHits_buf_size);
+    m_nminHits_buf = (int *) malloc(nminHits_buf_size);
     size_t nminModule_buf_size;
     nminModule_buf_size = m_evtsbins * sizeof(Identifier);
-    nminModule_buf = (Identifier *) malloc(nminModule_buf_size);
+    m_nminModule_buf = (Identifier *) malloc(nminModule_buf_size);
   }
   return StatusCode::SUCCESS;
 }
@@ -3075,7 +3075,7 @@ SCTHitsNoiseMonTool::makeSPvsEventNumber() {
     }
     return StatusCode::FAILURE;
   }
-  int m_sct_nspacepoints(0);
+  int sct_nspacepoints(0);
   // loop over SCT space points collections
   SpacePointContainer::const_iterator it = SCT_spcontainer->begin();
   SpacePointContainer::const_iterator endit = SCT_spcontainer->end();
@@ -3096,31 +3096,31 @@ SCTHitsNoiseMonTool::makeSPvsEventNumber() {
     if (thisBec == 2) {
       m_numSPPerLumiBlockECp->Fill(thisLayerDisk, colNext->size());
     }
-    m_sct_nspacepoints += (int) colNext->size();
+    sct_nspacepoints += (int) colNext->size();
   }
 
   if (m_environment == AthenaMonManager::online) {
     // Time Dependent SP plots only online
-    nSP_buf[nSP_pos] = m_sct_nspacepoints;
-    nSP_pos++;
-    if (nSP_pos == m_evtsbins) {
-      nSP_pos = 0;
+    m_nSP_buf[m_nSP_pos] = sct_nspacepoints;
+    m_nSP_pos++;
+    if (m_nSP_pos == m_evtsbins) {
+      m_nSP_pos = 0;
     }
     if (m_numberOfEvents % m_checkrate == 0) {
       m_nSP->Reset();
-      Int_t latest_nSP_pos = nSP_pos;
+      Int_t latest_nSP_pos = m_nSP_pos;
       for (Int_t i = 1; i < m_evtsbins; i++) {
         if (latest_nSP_pos == m_evtsbins) {
           latest_nSP_pos = 0;
         }
         if (m_numberOfEvents < m_evtsbins) {
-          if (i < nSP_pos) {
-            m_nSP->SetBinContent(i, nSP_buf[i]);
+          if (i < m_nSP_pos) {
+            m_nSP->SetBinContent(i, m_nSP_buf[i]);
           } else {
             m_nSP->SetBinContent(i, 0);
           }
         } else {
-          m_nSP->SetBinContent(i, nSP_buf[latest_nSP_pos]);
+          m_nSP->SetBinContent(i, m_nSP_buf[latest_nSP_pos]);
           m_nSP->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents);
         }
         latest_nSP_pos++;
@@ -3286,7 +3286,7 @@ SCTHitsNoiseMonTool::bookGeneralTrackTimeHistos(const unsigned int systemIndex)
     MonGroup tbinGroup(this, "SCT/GENERAL/tbin", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED);
     std::string stem = m_stream + pathDelimiter + path[systemIndex];
     const unsigned int nBins = 8;
-    std::string m_tbinsNames[] = {
+    std::string tbinsNames[] = {
       "000", "001", "010", "011", "100", "101", "110", "111"
     };
     std::string histoName = "TrackTimeBin" + abbreviations[systemIndex];
@@ -3309,13 +3309,13 @@ SCTHitsNoiseMonTool::bookGeneralTrackTimeHistos(const unsigned int systemIndex)
       m_tbinfracVsLBECm = profFactory("TBinFrac01XVsLBEC", "fraction of 01X vs LumiBlock in EndcapC", timeGroup, 2000,
                                       0, 2000);
       for (unsigned int bin(0); bin < nBins; bin++) {
-        m_tbinHistoECm->GetXaxis()->SetBinLabel(bin + 1, m_tbinsNames[bin].c_str());
+        m_tbinHistoECm->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str());
       }
       m_tbinHistoECm->GetXaxis()->SetTitle("TimeBin");
       if (m_environment == AthenaMonManager::online) {
         m_tbinHistoRecentECm = h1Factory(histoNameRecent, histoTitleRecent, timeGroup, -0.5, 7.5, nBins);
         for (unsigned int bin(0); bin < nBins; bin++) {
-          m_tbinHistoRecentECm->GetXaxis()->SetBinLabel(bin + 1, m_tbinsNames[bin].c_str());
+          m_tbinHistoRecentECm->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str());
         }
         m_tbinHistoRecentECm->GetXaxis()->SetTitle("TimeBin");
       }
@@ -3335,13 +3335,13 @@ SCTHitsNoiseMonTool::bookGeneralTrackTimeHistos(const unsigned int systemIndex)
       m_tbinfracVsLB =
         profFactory("TBinFrac01XVsLB", "fraction of 01X vs LumiBlock in Barrel", timeGroup, 2000, 0, 2000);
       for (unsigned int bin(0); bin < nBins; bin++) {
-        m_tbinHisto->GetXaxis()->SetBinLabel(bin + 1, m_tbinsNames[bin].c_str());
+        m_tbinHisto->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str());
       }
       m_tbinHisto->GetXaxis()->SetTitle("TimeBin");
       if (m_environment == AthenaMonManager::online) {
         m_tbinHistoRecent = h1Factory(histoNameRecent, histoTitleRecent, timeGroup, -0.5, 7.5, nBins);
         for (unsigned int bin(0); bin < nBins; bin++) {
-          m_tbinHistoRecent->GetXaxis()->SetBinLabel(bin + 1, m_tbinsNames[bin].c_str());
+          m_tbinHistoRecent->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str());
         }
         m_tbinHistoRecent->GetXaxis()->SetTitle("TimeBin");
       }
@@ -3362,13 +3362,13 @@ SCTHitsNoiseMonTool::bookGeneralTrackTimeHistos(const unsigned int systemIndex)
       m_tbinfracVsLBECp = profFactory("TBinFrac01XVsLBEA", "fraction of 01X vs LumiBlock in EndcapA", timeGroup, 2000,
                                       0, 2000);
       for (unsigned int bin(0); bin < nBins; bin++) {
-        m_tbinHistoECp->GetXaxis()->SetBinLabel(bin + 1, m_tbinsNames[bin].c_str());
+        m_tbinHistoECp->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str());
       }
       m_tbinHistoECp->GetXaxis()->SetTitle("TimeBin");
       if (m_environment == AthenaMonManager::online) {
         m_tbinHistoRecentECp = h1Factory(histoNameRecent, histoTitleRecent, timeGroup, -0.5, 7.5, nBins);
         for (unsigned int bin(0); bin < nBins; bin++) {
-          m_tbinHistoRecentECp->GetXaxis()->SetBinLabel(bin + 1, m_tbinsNames[bin].c_str());
+          m_tbinHistoRecentECp->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str());
         }
         m_tbinHistoRecentECp->GetXaxis()->SetTitle("TimeBin");
       }
@@ -3390,14 +3390,14 @@ SCTHitsNoiseMonTool::bookGeneralTrackTimeHistos(const unsigned int systemIndex)
       }
       h1Factory(streamhitmap, histoTitle, timeGroup, *(tbinHistoVectorArray[systemIndex]), -0.5, 7.5, nBins);
       for (unsigned int bin(0); bin < nBins; bin++) {
-        tbinHistoVector[i]->GetXaxis()->SetBinLabel(bin + 1, m_tbinsNames[bin].c_str());
+        tbinHistoVector[i]->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str());
       }
       tbinHistoVector[i]->GetXaxis()->SetTitle("TimeBin");
       if (m_environment == AthenaMonManager::online) {
         h1Factory(streamhitmaprecent, histoTitleRecent, timeGroup, *(tbinHistoVectorArrayRecent[systemIndex]), -0.5,
                    7.5, nBins);
         for (unsigned int bin(0); bin < nBins; bin++) {
-          tbinHistoVectorRecent[i]->GetXaxis()->SetBinLabel(bin + 1, m_tbinsNames[bin].c_str());
+          tbinHistoVectorRecent[i]->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str());
         }
         tbinHistoVectorRecent[i]->GetXaxis()->SetTitle("TimeBin");
       }
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTRatioNoiseMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTRatioNoiseMonTool.cxx
index 5bfd1168407..d735df25542 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTRatioNoiseMonTool.cxx
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTRatioNoiseMonTool.cxx
@@ -100,23 +100,23 @@ SCTRatioNoiseMonTool::SCTRatioNoiseMonTool(const string &type,
                                            const string &name,
                                            const IInterface *parent) :
   SCTMotherTrigMonTool(type, name, parent),
-  eventID(0),
+  m_eventID(0),
   m_numberOfEvents(0),
-  nNoSides_ev{},
-  nOneSide_ev{},
-  nTwoSide_ev{},
-  nNoSidesBarrel_ev{},
-  nOneSideBarrel_ev{},
-  nTwoSideBarrel_ev{},
-  nNonGoodModulesBarrel_ev{},
-  nNoSidesEndcapA_ev{},
-  nOneSideEndcapA_ev{},
-  nTwoSideEndcapA_ev{},
-  nNonGoodModulesEndcapA_ev{},
-  nNoSidesEndcapC_ev{},
-  nOneSideEndcapC_ev{},
-  nTwoSideEndcapC_ev{},
-  nNonGoodModulesEndcapC_ev{},
+  m_nNoSides_ev{},
+  m_nOneSide_ev{},
+  m_nTwoSide_ev{},
+  m_nNoSidesBarrel_ev{},
+  m_nOneSideBarrel_ev{},
+  m_nTwoSideBarrel_ev{},
+  m_nNonGoodModulesBarrel_ev{},
+  m_nNoSidesEndcapA_ev{},
+  m_nOneSideEndcapA_ev{},
+  m_nTwoSideEndcapA_ev{},
+  m_nNonGoodModulesEndcapA_ev{},
+  m_nNoSidesEndcapC_ev{},
+  m_nOneSideEndcapC_ev{},
+  m_nTwoSideEndcapC_ev{},
+  m_nNonGoodModulesEndcapC_ev{},
   //
   m_pnoiseoccupancymapHistoVectorECC{},
   m_pnoiseoccupancymapHistoVectorECCSide0{},
@@ -128,47 +128,47 @@ SCTRatioNoiseMonTool::SCTRatioNoiseMonTool(const string &type,
   m_pnoiseoccupancymapHistoVectorECASide0{},
   m_pnoiseoccupancymapHistoVectorECASide1{},
   //
-  d1(0),
-  n1(0),
-  n1Barrel{},
-  n1EndcapA{},
-  n1EndcapC{},
-  d1Barrel{},
-  d1EndcapA{},
-  d1EndcapC{},
+  m_d1(0),
+  m_n1(0),
+  m_n1Barrel{},
+  m_n1EndcapA{},
+  m_n1EndcapC{},
+  m_d1Barrel{},
+  m_d1EndcapA{},
+  m_d1EndcapC{},
   //
-  noSidesHit(false),
-  oneSideHit(false),
-  twoSidesHit(false),
-  correct_TimeBin(false),
+  m_noSidesHit(false),
+  m_oneSideHit(false),
+  m_twoSidesHit(false),
+  m_correct_TimeBin(false),
   //
-  nNoSides{},
-  nOneSide{},
-  nOneSide0{},
-  nOneSide1{},
-  nTwoSide{},
+  m_nNoSides{},
+  m_nOneSide{},
+  m_nOneSide0{},
+  m_nOneSide1{},
+  m_nTwoSide{},
   //
-  nLink0{},
-  nLink1{},
+  m_nLink0{},
+  m_nLink1{},
   /** goodModules init in ctor body **/
   //
-  nLayer{},
-  nEta{},
-  nPhi{},
-  nNonGoodModule{},
+  m_nLayer{},
+  m_nEta{},
+  m_nPhi{},
+  m_nNonGoodModule{},
   //
   m_checkrecent(1),
   m_current_lb(0),
   m_last_reset_lb(0),
-  set_timebin(-1),
-  tbin(-1),
-  modNum(0),
-  ratio(-1.0),
-  ratioside0(-1.0),
-  ratioside1(-1.0),
-  nNoSides_lb{},
-  nOneSide_lb{},
-  noisyM{},
+  m_set_timebin(-1),
+  m_tbin(-1),
+  m_modNum(0),
+  m_ratio(-1.0),
+  m_ratioside0(-1.0),
+  m_ratioside1(-1.0),
+  m_nNoSides_lb{},
+  m_nOneSide_lb{},
+  m_noisyM{},
   // General histograms
   m_NOEV(nullptr),
   m_NOEVBAR{},
@@ -250,7 +250,7 @@ SCTRatioNoiseMonTool::SCTRatioNoiseMonTool(const string &type,
   declareProperty("NOTrigger", m_NOTrigger = "L1_RD0_EMPTY");
   declareProperty("IgnoreRDOCutOnline", m_ignore_RDO_cut_online);
 
-  for (auto &i:goodModules) {
+  for (auto &i:m_goodModules) {
     i = true;
   }
 }
@@ -341,35 +341,35 @@ SCTRatioNoiseMonTool::fillHistograms() {
   SCT_RDO_Container::const_iterator lastCol = p_rdocontainer->end();
 
   // Declare Time Bin
-  set_timebin = 4;
-  tbin = -1;
+  m_set_timebin = 4;
+  m_tbin = -1;
 
   // Declaring Counting variables
-  nNoSides_ev = 0;
-  nOneSide_ev = 0;
-  nTwoSide_ev = 0;
+  m_nNoSides_ev = 0;
+  m_nOneSide_ev = 0;
+  m_nTwoSide_ev = 0;
   for (int i = 0; i < n_layers[BARREL_INDEX]; i++) {
-    nNoSidesBarrel_ev[i] = 0;
-    nOneSideBarrel_ev[i] = 0;
-    nTwoSideBarrel_ev[i] = 0;
-    nNonGoodModulesBarrel_ev[i] = 0;
+    m_nNoSidesBarrel_ev[i] = 0;
+    m_nOneSideBarrel_ev[i] = 0;
+    m_nTwoSideBarrel_ev[i] = 0;
+    m_nNonGoodModulesBarrel_ev[i] = 0;
   }
   for (int i = 0; i < n_layers[ENDCAP_C_INDEX]; i++) {
-    nNoSidesEndcapC_ev[i] = 0;
-    nOneSideEndcapC_ev[i] = 0;
-    nTwoSideEndcapC_ev[i] = 0;
-    nNonGoodModulesEndcapC_ev[i] = 0;
-    nNoSidesEndcapA_ev[i] = 0;
-    nOneSideEndcapA_ev[i] = 0;
-    nTwoSideEndcapA_ev[i] = 0;
-    nNonGoodModulesEndcapA_ev[i] = 0;
+    m_nNoSidesEndcapC_ev[i] = 0;
+    m_nOneSideEndcapC_ev[i] = 0;
+    m_nTwoSideEndcapC_ev[i] = 0;
+    m_nNonGoodModulesEndcapC_ev[i] = 0;
+    m_nNoSidesEndcapA_ev[i] = 0;
+    m_nOneSideEndcapA_ev[i] = 0;
+    m_nTwoSideEndcapA_ev[i] = 0;
+    m_nNonGoodModulesEndcapA_ev[i] = 0;
   }
 
   // Zero the module counters
   for (int i = 0; i < n_mod[GENERAL_INDEX]; i++) {
-    nLink0[i] = 0;
-    nLink1[i] = 0;
-    goodModules[i] = true;
+    m_nLink0[i] = 0;
+    m_nLink1[i] = 0;
+    m_goodModules[i] = true;
   }
 
   SG::ReadHandle<xAOD::EventInfo> pEvent(m_eventInfoKey);
@@ -381,15 +381,15 @@ SCTRatioNoiseMonTool::fillHistograms() {
   int tmplb = pEvent->lumiBlock();
   if (tmplb > m_current_lb) {
     for (int i = 0; i < n_mod[GENERAL_INDEX]; i++) {
-      nNoSides_lb[i] = 0;
-      nOneSide_lb[i] = 0;
+      m_nNoSides_lb[i] = 0;
+      m_nOneSide_lb[i] = 0;
     }
   }
   m_current_lb = tmplb;
   int count_SCT_RDO = 0;
   if (isSelectedTrigger == true) {
     for (; col_it != lastCol; ++col_it) {
-      correct_TimeBin = false;
+      m_correct_TimeBin = false;
       const InDetRawDataCollection<SCTRawDataType> *SCT_Collection(*col_it);
       if (!SCT_Collection) {
         continue; // select only SCT RDOs
@@ -404,23 +404,23 @@ SCTRatioNoiseMonTool::fillHistograms() {
       int thisSide = m_pSCTHelper->side(SCT_Identifier);
       bool goodModule = (m_checkBadModules and m_pSummarySvc) ? m_pSummarySvc->isGood(rd->identifyHash()) : true;
 
-      modNum = (rd->identifyHash()) / 2;
-      goodModules[modNum] = goodModule;
-      nLayer[modNum] = thisLayerDisk;
-      nEta[modNum] = thisEta;
-      nPhi[modNum] = thisPhi;
+      m_modNum = (rd->identifyHash()) / 2;
+      m_goodModules[m_modNum] = goodModule;
+      m_nLayer[m_modNum] = thisLayerDisk;
+      m_nEta[m_modNum] = thisEta;
+      m_nPhi[m_modNum] = thisPhi;
       if (!goodModule) {
-        nNonGoodModule[modNum] = 1;
+        m_nNonGoodModule[m_modNum] = 1;
       }
 
       DataVector<SCTRawDataType>::const_iterator p_rdo_end = SCT_Collection->end();
       for (DataVector<SCTRawDataType>::const_iterator p_rdo = SCT_Collection->begin(); p_rdo != p_rdo_end; ++p_rdo) {
         count_SCT_RDO++;
-        SCT3_RawData *rdo3 = dynamic_cast<SCT3_RawData *>(*p_rdo);
+        const SCT3_RawData *rdo3 = dynamic_cast<const SCT3_RawData *>(*p_rdo);
         if (rdo3 != 0) {
-          tbin = (rdo3)->getTimeBin();
+          m_tbin = (rdo3)->getTimeBin();
         }
-        if (timeBinInPattern(tbin, XIX) && goodModule) {
+        if (timeBinInPattern(m_tbin, XIX) && goodModule) {
           // fill hit info in barrel
           if (thisBec == 0) {
             int layer = thisLayerDisk;
@@ -428,10 +428,10 @@ SCTRatioNoiseMonTool::fillHistograms() {
           }
 
           if (thisSide == 1) {
-            nLink1[modNum] += 1;
+            m_nLink1[m_modNum] += 1;
             m_side->Fill(1);
           } else {
-            nLink0[modNum] += 1;
+            m_nLink0[m_modNum] += 1;
             m_side->Fill(3);
           }
         }
@@ -441,89 +441,89 @@ SCTRatioNoiseMonTool::fillHistograms() {
     // ignores the RDO cut online since the empty events are pre-filtered there
     if (count_SCT_RDO < 1E6 || (m_ignore_RDO_cut_online && m_environment == AthenaMonManager::online)) {
       m_num_RDO->Fill(count_SCT_RDO);
-      if(m_current_lb<=SCT_Monitoring::NBINS_LBs) noisyM[m_current_lb] = 0;
+      if(m_current_lb<=SCT_Monitoring::NBINS_LBs) m_noisyM[m_current_lb] = 0;
       for (int j = 0; j < n_mod[GENERAL_INDEX]; j++) {
-        noSidesHit = false;
-        oneSideHit = false;
-        twoSidesHit = false;
-        if (nLink0[j] != 0 && nLink1[j] != 0) {
-          twoSidesHit = true;
-        } else if (nLink0[j] != 0 || nLink1[j] != 0) {
-          oneSideHit = true;
-        } else if (nLink0[j] == 0 && nLink1[j] == 0 && goodModules[j]) {
-          noSidesHit = true;
+        m_noSidesHit = false;
+        m_oneSideHit = false;
+        m_twoSidesHit = false;
+        if (m_nLink0[j] != 0 && m_nLink1[j] != 0) {
+          m_twoSidesHit = true;
+        } else if (m_nLink0[j] != 0 || m_nLink1[j] != 0) {
+          m_oneSideHit = true;
+        } else if (m_nLink0[j] == 0 && m_nLink1[j] == 0 && m_goodModules[j]) {
+          m_noSidesHit = true;
         }
 
         if (isBarrel(j)) {
-          if (noSidesHit) {
-            nNoSidesBarrel_ev[nLayer[j]] += 1;
+          if (m_noSidesHit) {
+            m_nNoSidesBarrel_ev[m_nLayer[j]] += 1;
           }
-          if (oneSideHit) {
-            nOneSideBarrel_ev[nLayer[j]] += 1;
+          if (m_oneSideHit) {
+            m_nOneSideBarrel_ev[m_nLayer[j]] += 1;
           }
-          if (twoSidesHit) {
-            nTwoSideBarrel_ev[nLayer[j]] += 1;
+          if (m_twoSidesHit) {
+            m_nTwoSideBarrel_ev[m_nLayer[j]] += 1;
           }
-          if (nNonGoodModule[j]) {
-            nNonGoodModulesBarrel_ev[nLayer[j]] += 1;
+          if (m_nNonGoodModule[j]) {
+            m_nNonGoodModulesBarrel_ev[m_nLayer[j]] += 1;
           }
         }
         if (isEndcapA(j)) {
-          if (noSidesHit) {
-            nNoSidesEndcapA_ev[nLayer[j]] += 1;
+          if (m_noSidesHit) {
+            m_nNoSidesEndcapA_ev[m_nLayer[j]] += 1;
           }
-          if (oneSideHit) {
-            nOneSideEndcapA_ev[nLayer[j]] += 1;
+          if (m_oneSideHit) {
+            m_nOneSideEndcapA_ev[m_nLayer[j]] += 1;
           }
-          if (twoSidesHit) {
-            nTwoSideEndcapA_ev[nLayer[j]] += 1;
+          if (m_twoSidesHit) {
+            m_nTwoSideEndcapA_ev[m_nLayer[j]] += 1;
           }
-          if (nNonGoodModule[j]) {
-            nNonGoodModulesEndcapA_ev[nLayer[j]] += 1;
+          if (m_nNonGoodModule[j]) {
+            m_nNonGoodModulesEndcapA_ev[m_nLayer[j]] += 1;
           }
         }
         if (isEndcapC(j)) {
-          if (noSidesHit) {
-            nNoSidesEndcapC_ev[nLayer[j]] += 1;
+          if (m_noSidesHit) {
+            m_nNoSidesEndcapC_ev[m_nLayer[j]] += 1;
           }
-          if (oneSideHit) {
-            nOneSideEndcapC_ev[nLayer[j]] += 1;
+          if (m_oneSideHit) {
+            m_nOneSideEndcapC_ev[m_nLayer[j]] += 1;
           }
-          if (twoSidesHit) {
-            nTwoSideEndcapC_ev[nLayer[j]] += 1;
+          if (m_twoSidesHit) {
+            m_nTwoSideEndcapC_ev[m_nLayer[j]] += 1;
           }
-          if (nNonGoodModule[j]) {
-            nNonGoodModulesEndcapC_ev[nLayer[j]] += 1;
+          if (m_nNonGoodModule[j]) {
+            m_nNonGoodModulesEndcapC_ev[m_nLayer[j]] += 1;
           }
         }
         // --------------------------------------
-        if (noSidesHit && !nNonGoodModule[j]) {
+        if (m_noSidesHit && !m_nNonGoodModule[j]) {
           m_NZ1_vs_modnum->Fill(j);
-          nNoSides_ev += 1;
-          nNoSides_lb[j] += 1;
-          nNoSides[j] += 1;
+          m_nNoSides_ev += 1;
+          m_nNoSides_lb[j] += 1;
+          m_nNoSides[j] += 1;
         }
         // --------------------------------------
-        if (oneSideHit) {
+        if (m_oneSideHit) {
           m_N11_vs_modnum->Fill(j);
-          nOneSide_ev += 1;
-          nOneSide_lb[j] += 1;
-          nOneSide[j] += 1;
-          if (nLink0[j] != 0) {
-            nOneSide0[j] += 1;
+          m_nOneSide_ev += 1;
+          m_nOneSide_lb[j] += 1;
+          m_nOneSide[j] += 1;
+          if (m_nLink0[j] != 0) {
+            m_nOneSide0[j] += 1;
           }
-          if (nLink1[j] != 0) {
-            nOneSide1[j] += 1;
+          if (m_nLink1[j] != 0) {
+            m_nOneSide1[j] += 1;
           }
         }
         // --------------------------------------
-        if (twoSidesHit) {
-          nTwoSide_ev += 1;
-          nTwoSide[j] += 1;
+        if (m_twoSidesHit) {
+          m_nTwoSide_ev += 1;
+          m_nTwoSide[j] += 1;
         }
         // --------------------------------------
-        if (calculateNoiseOccupancyUsingRatioMethod(nOneSide_lb[j], nNoSides_lb[j]) * 1E5 > 100.) {
-          if(m_current_lb<=SCT_Monitoring::NBINS_LBs) noisyM[m_current_lb] += 1;
+        if (calculateNoiseOccupancyUsingRatioMethod(m_nOneSide_lb[j], m_nNoSides_lb[j]) * 1E5 > 100.) {
+          if(m_current_lb<=SCT_Monitoring::NBINS_LBs) m_noisyM[m_current_lb] += 1;
         }
       }
 
@@ -534,46 +534,46 @@ SCTRatioNoiseMonTool::fillHistograms() {
         92, 132, 132, 132, 132, 132, 92, 92, 52
       };
 
-      float NO_ev = calculateNoiseOccupancyUsingRatioMethod(nOneSide_ev, nNoSides_ev);
+      float NO_ev = calculateNoiseOccupancyUsingRatioMethod(m_nOneSide_ev, m_nNoSides_ev);
 
       m_NOEV->Fill(1E5 * NO_ev);
       m_NOEV_RDO->Fill(1E5 * NO_ev, count_SCT_RDO);
-      m_NZ1->Fill(nNoSides_ev);
-      m_N11->Fill(nOneSide_ev);
-      m_N21->Fill(nTwoSide_ev);
+      m_NZ1->Fill(m_nNoSides_ev);
+      m_N11->Fill(m_nOneSide_ev);
+      m_N21->Fill(m_nTwoSide_ev);
 
       for (int l = 0; l < n_layers[BARREL_INDEX]; l++) {
-        int nosidehit = NumModBarrelLayer[l] - nNonGoodModulesBarrel_ev[l] - nOneSideBarrel_ev[l] -
-                        nTwoSideBarrel_ev[l];
-        float NO_barrel_ev = calculateNoiseOccupancyUsingRatioMethod(nOneSideBarrel_ev[l], nosidehit);
+        int nosidehit = NumModBarrelLayer[l] - m_nNonGoodModulesBarrel_ev[l] - m_nOneSideBarrel_ev[l] -
+                        m_nTwoSideBarrel_ev[l];
+        float NO_barrel_ev = calculateNoiseOccupancyUsingRatioMethod(m_nOneSideBarrel_ev[l], nosidehit);
         m_NOEVBAR[l]->Fill(1E5 * NO_barrel_ev);
         m_NZ1BAR[l]->Fill(nosidehit);
-        m_N11BAR[l]->Fill(nOneSideBarrel_ev[l]);
-        m_N21BAR[l]->Fill(nTwoSideBarrel_ev[l]);
-        m_NZ1BAR_vsLB[l]->Fill(m_current_lb, nNoSidesBarrel_ev[l]);
-        m_N11BAR_vsLB[l]->Fill(m_current_lb, nOneSideBarrel_ev[l]);
+        m_N11BAR[l]->Fill(m_nOneSideBarrel_ev[l]);
+        m_N21BAR[l]->Fill(m_nTwoSideBarrel_ev[l]);
+        m_NZ1BAR_vsLB[l]->Fill(m_current_lb, m_nNoSidesBarrel_ev[l]);
+        m_N11BAR_vsLB[l]->Fill(m_current_lb, m_nOneSideBarrel_ev[l]);
       }
       for (int m = 0; m < n_layers[ENDCAP_C_INDEX]; m++) {
-        int nosidehit = NumModEndcapDisk[m] - nNonGoodModulesEndcapC_ev[m] - nOneSideEndcapC_ev[m] -
-                        nTwoSideEndcapC_ev[m];
-        float NO_endcapc_ev = calculateNoiseOccupancyUsingRatioMethod(nOneSideEndcapC_ev[m], nosidehit);
+        int nosidehit = NumModEndcapDisk[m] - m_nNonGoodModulesEndcapC_ev[m] - m_nOneSideEndcapC_ev[m] -
+                        m_nTwoSideEndcapC_ev[m];
+        float NO_endcapc_ev = calculateNoiseOccupancyUsingRatioMethod(m_nOneSideEndcapC_ev[m], nosidehit);
         m_NOEVECC[m]->Fill(1E5 * NO_endcapc_ev);
         m_NZ1ECC[m]->Fill(nosidehit);
-        m_N11ECC[m]->Fill(nOneSideEndcapC_ev[m]);
-        m_N21ECC[m]->Fill(nTwoSideEndcapC_ev[m]);
-        m_NZ1ECC_vsLB[m]->Fill(m_current_lb, nNoSidesEndcapC_ev[m]);
-        m_N11ECC_vsLB[m]->Fill(m_current_lb, nOneSideEndcapC_ev[m]);
+        m_N11ECC[m]->Fill(m_nOneSideEndcapC_ev[m]);
+        m_N21ECC[m]->Fill(m_nTwoSideEndcapC_ev[m]);
+        m_NZ1ECC_vsLB[m]->Fill(m_current_lb, m_nNoSidesEndcapC_ev[m]);
+        m_N11ECC_vsLB[m]->Fill(m_current_lb, m_nOneSideEndcapC_ev[m]);
       }
       for (int q = 0; q < n_layers[ENDCAP_A_INDEX]; q++) {
-        int nosidehit = NumModEndcapDisk[q] - nNonGoodModulesEndcapA_ev[q] - nOneSideEndcapA_ev[q] -
-                        nTwoSideEndcapA_ev[q];
-        float NO_endcapa_ev = calculateNoiseOccupancyUsingRatioMethod(nOneSideEndcapA_ev[q], nosidehit);
+        int nosidehit = NumModEndcapDisk[q] - m_nNonGoodModulesEndcapA_ev[q] - m_nOneSideEndcapA_ev[q] -
+                        m_nTwoSideEndcapA_ev[q];
+        float NO_endcapa_ev = calculateNoiseOccupancyUsingRatioMethod(m_nOneSideEndcapA_ev[q], nosidehit);
         m_NOEVECA[q]->Fill(1E5 * NO_endcapa_ev);
         m_NZ1ECA[q]->Fill(nosidehit);
-        m_N11ECA[q]->Fill(nOneSideEndcapA_ev[q]);
-        m_N21ECA[q]->Fill(nTwoSideEndcapA_ev[q]);
-        m_NZ1ECA_vsLB[q]->Fill(m_current_lb, nNoSidesEndcapA_ev[q]);
-        m_N11ECA_vsLB[q]->Fill(m_current_lb, nOneSideEndcapA_ev[q]);
+        m_N11ECA[q]->Fill(m_nOneSideEndcapA_ev[q]);
+        m_N21ECA[q]->Fill(m_nTwoSideEndcapA_ev[q]);
+        m_NZ1ECA_vsLB[q]->Fill(m_current_lb, m_nNoSidesEndcapA_ev[q]);
+        m_N11ECA_vsLB[q]->Fill(m_current_lb, m_nOneSideEndcapA_ev[q]);
       }
     }
     ++m_numberOfEvents;
@@ -592,11 +592,11 @@ SCTRatioNoiseMonTool::fillHistograms() {
       }
       /*Now reset the counters used for the reset histograms*/
       for (int i = 0; i < n_mod[GENERAL_INDEX]; i++) {
-        nNoSides[i] = 0;
-        nOneSide[i] = 0;
-        nOneSide0[i] = 0;
-        nOneSide1[i] = 0;
-        nTwoSide[i] = 0;
+        m_nNoSides[i] = 0;
+        m_nOneSide[i] = 0;
+        m_nOneSide0[i] = 0;
+        m_nOneSide1[i] = 0;
+        m_nTwoSide[i] = 0;
       }
     }
   }
@@ -660,7 +660,7 @@ SCTRatioNoiseMonTool::procHistograms() {
     }
   }
 
-  // calculate and fill ratio noise per lumiblock
+  // calculate and fill m_ratio noise per lumiblock
   int nNoSides_lb_allmod[SCT_Monitoring::NBINS_LBs + 1];
   int nOneSide_lb_allmod[SCT_Monitoring::NBINS_LBs + 1];
   for (int bin = 1; bin < SCT_Monitoring::NBINS_LBs + 1; bin++) {
@@ -715,79 +715,79 @@ SCTRatioNoiseMonTool::procHistograms() {
         m_NO_vsLB->Fill(bin, NOLB);
       }
     }
-    if (noisyM[bin] != 0) {
-      m_NoisyModules_vsLB->Fill(bin, noisyM[bin]);
+    if (m_noisyM[bin] != 0) {
+      m_NoisyModules_vsLB->Fill(bin, m_noisyM[bin]);
     }
   }
   // Construct the plots of interest
   for (int j = 0; j < n_mod[GENERAL_INDEX]; j++) {
-    int layer = nLayer[j];
-
-    if (nNoSides[j] != 0) {
-      ratio = 0;
-      ratioside0 = 0;
-      ratioside1 = 0;
-      ratio = 1E5 * calculateNoiseOccupancyUsingRatioMethod(nOneSide[j], nNoSides[j]);
-      ratioside0 = 1E5 * calculateOneSideNoiseOccupancyUsingRatioMethod(nOneSide0[j], nNoSides[j]);
-      ratioside1 = 1E5 * calculateOneSideNoiseOccupancyUsingRatioMethod(nOneSide1[j], nNoSides[j]);
-      if (ratio != 0) {
-        m_NO->Fill(ratio);
-        m_NOSide->Fill(ratioside0);
-        m_NOSide->Fill(ratioside1);
+    int layer = m_nLayer[j];
+
+    if (m_nNoSides[j] != 0) {
+      m_ratio = 0;
+      m_ratioside0 = 0;
+      m_ratioside1 = 0;
+      m_ratio = 1E5 * calculateNoiseOccupancyUsingRatioMethod(m_nOneSide[j], m_nNoSides[j]);
+      m_ratioside0 = 1E5 * calculateOneSideNoiseOccupancyUsingRatioMethod(m_nOneSide0[j], m_nNoSides[j]);
+      m_ratioside1 = 1E5 * calculateOneSideNoiseOccupancyUsingRatioMethod(m_nOneSide1[j], m_nNoSides[j]);
+      if (m_ratio != 0) {
+        m_NO->Fill(m_ratio);
+        m_NOSide->Fill(m_ratioside0);
+        m_NOSide->Fill(m_ratioside1);
         // --------------------------------------
         if (isBarrel(j)) {
-          m_NOBAR->Fill(ratio);
-          m_NOBARSide->Fill(ratioside0);
-          m_NOBARSide->Fill(ratioside1);
-          m_pnoiseoccupancymapHistoVectorBAR[layer]->Fill(nEta[j], nPhi[j], ratio);
-          m_pnoiseoccupancymapHistoVectorBARSide0[layer]->Fill(nEta[j], nPhi[j], ratioside0);
-          m_pnoiseoccupancymapHistoVectorBARSide1[layer]->Fill(nEta[j], nPhi[j], ratioside1);
+          m_NOBAR->Fill(m_ratio);
+          m_NOBARSide->Fill(m_ratioside0);
+          m_NOBARSide->Fill(m_ratioside1);
+          m_pnoiseoccupancymapHistoVectorBAR[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratio);
+          m_pnoiseoccupancymapHistoVectorBARSide0[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratioside0);
+          m_pnoiseoccupancymapHistoVectorBARSide1[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratioside1);
           if (layer < 4) {
-            m_NOBAR_layer[layer]->Fill(ratio);
+            m_NOBAR_layer[layer]->Fill(m_ratio);
           }
         }
         // --------------------------------------
         if (isEndcap(j)) {
           // ---------------
           if (isEndcapA(j)) {
-            m_NOECA_disk[layer]->Fill(ratio);
-            m_NOECASide->Fill(ratioside0);
-            m_NOECASide->Fill(ratioside0);
-            m_pnoiseoccupancymapHistoVectorECA[layer]->Fill(nEta[j], nPhi[j], ratio);
-            m_pnoiseoccupancymapHistoVectorECASide0[layer]->Fill(nEta[j], nPhi[j], ratioside0);
-            m_pnoiseoccupancymapHistoVectorECASide1[layer]->Fill(nEta[j], nPhi[j], ratioside1);
+            m_NOECA_disk[layer]->Fill(m_ratio);
+            m_NOECASide->Fill(m_ratioside0);
+            m_NOECASide->Fill(m_ratioside0);
+            m_pnoiseoccupancymapHistoVectorECA[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratio);
+            m_pnoiseoccupancymapHistoVectorECASide0[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratioside0);
+            m_pnoiseoccupancymapHistoVectorECASide1[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratioside1);
           }
           // ---------------
           if (isEndcapC(j)) {
-            m_NOECC_disk[layer]->Fill(ratio);
-            m_NOECCSide->Fill(ratioside0);
-            m_NOECCSide->Fill(ratioside0);
-            m_pnoiseoccupancymapHistoVectorECC[layer]->Fill(nEta[j], nPhi[j], ratio);
-            m_pnoiseoccupancymapHistoVectorECCSide0[layer]->Fill(nEta[j], nPhi[j], ratioside0);
-            m_pnoiseoccupancymapHistoVectorECCSide1[layer]->Fill(nEta[j], nPhi[j], ratioside1);
+            m_NOECC_disk[layer]->Fill(m_ratio);
+            m_NOECCSide->Fill(m_ratioside0);
+            m_NOECCSide->Fill(m_ratioside0);
+            m_pnoiseoccupancymapHistoVectorECC[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratio);
+            m_pnoiseoccupancymapHistoVectorECCSide0[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratioside0);
+            m_pnoiseoccupancymapHistoVectorECCSide1[layer]->Fill(m_nEta[j], m_nPhi[j], m_ratioside1);
           }
-          m_NOEC->Fill(ratio);
-          m_NOECSide->Fill(ratioside0);
-          m_NOECSide->Fill(ratioside1);
-          switch (nEta[j]) {
+          m_NOEC->Fill(m_ratio);
+          m_NOECSide->Fill(m_ratioside0);
+          m_NOECSide->Fill(m_ratioside1);
+          switch (m_nEta[j]) {
           case 0:
-            m_NOEC_Outer->Fill(ratio);
+            m_NOEC_Outer->Fill(m_ratio);
             break;
 
           case 1:
             switch (layer) {
             case 7:
-              m_NOEC_ShortMiddle->Fill(ratio);
+              m_NOEC_ShortMiddle->Fill(m_ratio);
               break;
 
             default:
-              m_NOEC_Middle->Fill(ratio);
+              m_NOEC_Middle->Fill(m_ratio);
               break;
             }
             break;
 
           case 2:
-            m_NOEC_Inner->Fill(ratio);
+            m_NOEC_Inner->Fill(m_ratio);
             break;
 
           default:
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx
index 57c6a437a64..b84cc66da0e 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx
@@ -72,8 +72,8 @@ SCTTracksMonTool::SCTTracksMonTool(const string &type,
                                    const IInterface *parent)
   : SCTMotherTrigMonTool(type, name, parent),
   m_nTracks(nullptr),
-  trackTrigger(nullptr),
-  trackTriggerRate(nullptr),
+  m_trackTrigger(nullptr),
+  m_trackTriggerRate(nullptr),
   m_totalBarrelResidual(nullptr),
   m_totalEndCapAResidual(nullptr),
   m_totalEndCapCResidual(nullptr),
@@ -138,8 +138,8 @@ SCTTracksMonTool::SCTTracksMonTool(const string &type,
   declareProperty("useIDGlobal", m_useIDGlobal = false);
   declareProperty("doUnbiasedCalc", m_doUnbiasedCalc = true);
   declareProperty("EvtsBins", m_evtsbins = 5000);
-  nTracks_buf = nullptr;
-  nTracks_pos = 0;
+  m_nTracks_buf = nullptr;
+  m_nTracks_pos = 0;
 }
 
 // ====================================================================================================
@@ -298,14 +298,14 @@ SCTTracksMonTool::fillHistograms() {
   if (trkend == trkbegin) {
     if (m_doTrigger) {
       for (int trig(0); trig != N_TRIGGER_TYPES; ++trig) {
-        trackTriggerRate->Fill(trig, 0);
+        m_trackTriggerRate->Fill(trig, 0);
       }
     }
     for (int i(0); i != N_REGIONS; ++i) {
       m_trackRate->Fill(i, 0);
     }
   }
-  int m_goodTrks_N = 0;
+  int goodTrks_N = 0;
   ATH_MSG_DEBUG("Begin loop over " << tracks->size() << " tracks");
   for (TrackCollection::const_iterator trkitr(tracks->begin()); trkitr != trkend; ++trkitr) {
     int local_scthits = 0;
@@ -325,7 +325,7 @@ SCTTracksMonTool::fillHistograms() {
       ATH_MSG_DEBUG("track fails minimum SCT hit requirement");
       break;
     }
-    m_goodTrks_N++;
+    goodTrks_N++;
     if (track->fitQuality()->numberDoF() > 0.) { // Fill Track Chi2/ndf histogram
       m_trk_chi2->Fill(track->fitQuality()->chiSquared() / track->fitQuality()->numberDoF());
     }
@@ -346,10 +346,10 @@ SCTTracksMonTool::fillHistograms() {
     if (m_doTrigger) {
       for (int trig(0); trig != N_TRIGGER_TYPES; ++trig) {
         if (SCTMotherTrigMonTool::hasTriggerFired(trig)) {
-          trackTrigger->Fill(trig);
-          trackTriggerRate->Fill(trig, 1);
+          m_trackTrigger->Fill(trig);
+          m_trackTriggerRate->Fill(trig, 1);
         } else {
-          trackTriggerRate->Fill(trig, 0);
+          m_trackTriggerRate->Fill(trig, 0);
         }
       }
     }
@@ -550,7 +550,7 @@ SCTTracksMonTool::fillHistograms() {
                                                                  // barrel, Eca, Ecb)
     }
   } // end of loop on tracks
-  m_trk_N->Fill(m_goodTrks_N);
+  m_trk_N->Fill(goodTrks_N);
   m_trk_nclu_totHisto->Fill(local_tot_trkhits, 1.);
   if (m_environment == AthenaMonManager::online) {
     if (m_numberOfEvents == 1 || (m_numberOfEvents > 1 && m_numberOfEvents % m_checkrate == 0)) {// 30.11.2014
@@ -560,26 +560,26 @@ SCTTracksMonTool::fillHistograms() {
       }
     }
     // Time Dependent SP plots only online
-    nTracks_buf[nTracks_pos] = (int) (m_trk_chi2->GetEntries());
-    nTracks_pos++;
-    if (nTracks_pos == m_evtsbins) {
-      nTracks_pos = 0;
+    m_nTracks_buf[m_nTracks_pos] = (int) (m_trk_chi2->GetEntries());
+    m_nTracks_pos++;
+    if (m_nTracks_pos == m_evtsbins) {
+      m_nTracks_pos = 0;
     }
     if (m_numberOfEvents % m_checkrate == 0) {
       m_nTracks->Reset();
-      Int_t latest_nTracks_pos(nTracks_pos);
+      Int_t latest_nTracks_pos(m_nTracks_pos);
       for (Int_t i(1); i != m_evtsbins; ++i) {
         if (latest_nTracks_pos == m_evtsbins) {
           latest_nTracks_pos = 0;
         }
         if (m_numberOfEvents < m_evtsbins) {
-          if (i < nTracks_pos) {
-            m_nTracks->SetBinContent(i, nTracks_buf[i]);
+          if (i < m_nTracks_pos) {
+            m_nTracks->SetBinContent(i, m_nTracks_buf[i]);
           } else {
             m_nTracks->SetBinContent(i, 0);
           }
         } else {
-          m_nTracks->SetBinContent(i, nTracks_buf[latest_nTracks_pos]);
+          m_nTracks->SetBinContent(i, m_nTracks_buf[latest_nTracks_pos]);
           m_nTracks->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents);
         }
         latest_nTracks_pos++;
@@ -781,19 +781,19 @@ SCTTracksMonTool::bookGeneralHistos() {                                        /
     CHECK(Tracks.regHist(m_totalEndCapCPull));
 
     if (m_doTrigger == true) {
-      trackTrigger = new TH1I("trackTriggers", "Tracks for different trigger types", N_TRIGGER_TYPES, -0.5, 7.5);            //
+      m_trackTrigger = new TH1I("trackTriggers", "Tracks for different trigger types", N_TRIGGER_TYPES, -0.5, 7.5);            //
                                                                                                                              // first
                                                                                                                              // bin,
                                                                                                                              // last
                                                                                                                              // bin
-      trackTriggerRate = new TProfile("trackTriggersRate", "Track per event for different trigger types",
+      m_trackTriggerRate = new TProfile("trackTriggersRate", "Track per event for different trigger types",
                                       N_TRIGGER_TYPES, -0.5, 7.5);            // first bin, last bin
       for (int trig(0); trig != N_TRIGGER_TYPES; ++trig) {
-        trackTrigger->GetXaxis()->SetBinLabel(trig + 1, SCTMotherTrigMonTool::m_triggerNames[trig].c_str());
-        trackTriggerRate->GetXaxis()->SetBinLabel(trig + 1, SCTMotherTrigMonTool::m_triggerNames[trig].c_str());
+        m_trackTrigger->GetXaxis()->SetBinLabel(trig + 1, SCTMotherTrigMonTool::m_triggerNames[trig].c_str());
+        m_trackTriggerRate->GetXaxis()->SetBinLabel(trig + 1, SCTMotherTrigMonTool::m_triggerNames[trig].c_str());
       }
-      CHECK(Tracks.regHist(trackTrigger));
-      CHECK(Tracks.regHist(trackTriggerRate));
+      CHECK(Tracks.regHist(m_trackTrigger));
+      CHECK(Tracks.regHist(m_trackTriggerRate));
     }
     // Book histogram of track rate for different regions of the detector
     m_trackRate = new TProfile("SCTTrackRate", "Track per event for SCT regions", 3, 0.0, 3.0);
@@ -849,8 +849,8 @@ SCTTracksMonTool::bookGeneralHistos() {                                        /
       m_nTracks->GetYaxis()->SetTitle("Num of Tracks");
       size_t nTracks_buf_size;
       nTracks_buf_size = m_evtsbins * sizeof(int);
-      nTracks_buf = (int *) malloc(nTracks_buf_size);
-      nTracks_pos = 0;
+      m_nTracks_buf = (int *) malloc(nTracks_buf_size);
+      m_nTracks_pos = 0;
       CHECK(Tracks.regHist(m_nTracks));
     }
   }                               // hidetoshi 14.01.22
diff --git a/InnerDetector/InDetRawAlgs/BCM_ZeroSuppression/src/BCM_ZeroSuppression.cxx b/InnerDetector/InDetRawAlgs/BCM_ZeroSuppression/src/BCM_ZeroSuppression.cxx
index 77043d36afb..1109890aa89 100644
--- a/InnerDetector/InDetRawAlgs/BCM_ZeroSuppression/src/BCM_ZeroSuppression.cxx
+++ b/InnerDetector/InDetRawAlgs/BCM_ZeroSuppression/src/BCM_ZeroSuppression.cxx
@@ -64,7 +64,7 @@ StatusCode BCM_ZeroSuppression::execute() {
   // Create output RDO container and record it to StoreGate
   try {
     m_bcmCompactDO = new BCM_RDO_Container();
-  } catch (std::bad_alloc) {
+  } catch (const std::bad_alloc&) {
     msg(MSG::FATAL) << "Could not create a new BCM RawDataContainer!" << endmsg;
     return StatusCode::FAILURE;
   }
diff --git a/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawData.h b/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawData.h
index 20d33e14c40..d9cf6e0ab4f 100755
--- a/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawData.h
+++ b/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawData.h
@@ -40,7 +40,7 @@ public:
   // Virtual methods:
   ///////////////////////////////////////////////////////////////////
 
-  virtual Identifier identify() const;
+  virtual Identifier identify() const override final;
 
 
   virtual unsigned int getWord() const;
diff --git a/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataCollection.h b/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataCollection.h
index 441d108d1c5..71faf8dec7a 100755
--- a/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataCollection.h
+++ b/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataCollection.h
@@ -28,7 +28,7 @@
 #include "InDetRawData/InDetRawData.h"
 
 template< class RawDataT >
-class InDetRawDataCollection : public DataVector< RawDataT > {
+class InDetRawDataCollection : public Identifiable, public DataVector< RawDataT > {
 
   ///////////////////////////////////////////////////////////////////
   // Public methods:
@@ -47,11 +47,11 @@ public:
   // Const methods:
   ///////////////////////////////////////////////////////////////////
 
-  virtual Identifier identify() const;
+  virtual Identifier identify() const override final;
 
-  virtual IdentifierHash identifyHash() const;
+  virtual IdentifierHash identifyHash() const override final;
 
-  virtual void setIdentifier(Identifier id);
+  void setIdentifier(Identifier id);
 
   ///////////////////////////////////////////////////////////////////
   // Private methods:
diff --git a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/src/InDetDenseEnvAmbiTrackSelectionTool.cxx b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/src/InDetDenseEnvAmbiTrackSelectionTool.cxx
index 88f64406b54..0f4105137ba 100755
--- a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/src/InDetDenseEnvAmbiTrackSelectionTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/src/InDetDenseEnvAmbiTrackSelectionTool.cxx
@@ -709,8 +709,8 @@ void InDet::InDetDenseEnvAmbiTrackSelectionTool::fillTrackDetails(const Trk::Tra
     
     
     // get iterators for range
-    Trk::IPRD_AssociationTool::PRD_MapIt mapIt    = range.first;
-    Trk::IPRD_AssociationTool::PRD_MapIt mapItEnd = range.second;
+    Trk::IPRD_AssociationTool::ConstPRD_MapIt mapIt    = range.first;
+    Trk::IPRD_AssociationTool::ConstPRD_MapIt mapItEnd = range.second;
     // simple for loop instead of fancier remove_if above
     for ( ;mapIt!=mapItEnd; ++mapIt) {
       tsosDetails.overlappingTracks.insert( std::pair<const Trk::Track*, int >(mapIt->second, index) );
diff --git a/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_AssociationToolGangedPixels.h b/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_AssociationToolGangedPixels.h
index 565874d717f..68ee8ce52bd 100755
--- a/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_AssociationToolGangedPixels.h
+++ b/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_AssociationToolGangedPixels.h
@@ -70,7 +70,7 @@ namespace InDet {
     IMPORTANT: Please use the typedefs IPRD_AssociationTool::PrepRawDataRange and 
     IPRD_AssociationTool::ConstPRD_MapIt (defined in the interface) to access the 
     tracks, as the way the data is stored internally may change.*/
-    virtual Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange onTracks(const Trk::PrepRawData& prd) ;
+    virtual Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange onTracks(const Trk::PrepRawData& prd) const;
 
       /** resets the tool - should be called before using tool (and maybe afterwards to free up 
     memory)*/
diff --git a/InnerDetector/InDetRecTools/InDetAssociationTools/src/InDetPRD_AssociationToolGangedPixels.cxx b/InnerDetector/InDetRecTools/InDetAssociationTools/src/InDetPRD_AssociationToolGangedPixels.cxx
index f20b55dee31..fdc0667bf9f 100755
--- a/InnerDetector/InDetRecTools/InDetAssociationTools/src/InDetPRD_AssociationToolGangedPixels.cxx
+++ b/InnerDetector/InDetRecTools/InDetAssociationTools/src/InDetPRD_AssociationToolGangedPixels.cxx
@@ -123,8 +123,8 @@ StatusCode InDet::InDetPRD_AssociationToolGangedPixels::removePRDs( const Trk::T
     Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange 
         range = m_prepRawDataTrackMap.equal_range(prd);
     // get iterators for range
-    PRD_MapIt mapIt    = range.first;
-    PRD_MapIt mapItEnd = range.second;
+    ConstPRD_MapIt mapIt    = range.first;
+    ConstPRD_MapIt mapItEnd = range.second;
     // simple for loop instead of fancier remove_if above
     for ( ;mapIt!=mapItEnd; ++mapIt) {
       if ( mapIt->second==&track ) {
@@ -283,7 +283,7 @@ std::vector< const Trk::PrepRawData* > InDet::InDetPRD_AssociationToolGangedPixe
 }
 
 Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange 
-InDet::InDetPRD_AssociationToolGangedPixels::onTracks(const Trk::PrepRawData& prd) 
+InDet::InDetPRD_AssociationToolGangedPixels::onTracks(const Trk::PrepRawData& prd) const
 {
   //	std::pair<IPRD_AssociationTool::PRD_MapIt, IPRD_AssociationTool::PRD_MapIt>       range = 
   return m_prepRawDataTrackMap.equal_range(&prd);
diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx
index d00a6d5723d..54d39dfb2a4 100644
--- a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx
@@ -50,7 +50,10 @@ namespace InDet {
     AthAlgTool(name, n,p),
     m_extrapolator(""),
     m_pixelCondSummarySvc("",n),
-    m_residualPullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator")
+    m_residualPullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"),
+    m_idHelper(nullptr),
+    m_pixelId(nullptr),
+    m_configured(false)
   {
     declareInterface<IInDetTestBLayerTool>(this);
     declareProperty("Extrapolator"   , m_extrapolator);
diff --git a/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx b/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx
index 0d5104a3513..87778a27448 100644
--- a/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx
@@ -38,7 +38,13 @@ namespace InDet {
     AthAlgTool(name, n,p),
     m_extrapolator("Trk::Extrapolator/InDetExtrapolator"),
     m_pixelCondSummarySvc("PixelConditionsSummarySvc",n),
-    m_residualPullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator")
+    m_residualPullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"),
+    m_idHelper(nullptr),
+    m_pixelId(nullptr),
+    m_configured(false),
+    m_cachedFracGood(-9999),
+    m_cachedTrkParam(nullptr),
+    m_cached_track_residual(nullptr)
   {
     declareInterface<IInDetTestPixelLayerTool>(this);
     declareProperty("Extrapolator"   , m_extrapolator);
@@ -50,7 +56,6 @@ namespace InDet {
     declareProperty("PhiRegionSize", m_phiRegionSize = 3.);
     declareProperty("EtaRegionSize", m_etaRegionSize = 3.);
     declareProperty("GoodFracCut", m_goodFracCut = 0.5);
-
   }  
 
   InDetTestPixelLayerTool::~InDetTestPixelLayerTool() {}
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h
index dea2c541e85..dfc3bb9795e 100644
--- a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h
+++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h
@@ -64,7 +64,6 @@ namespace InDet
       StatusCode update( IOVSVC_CALLBACK_ARGS );  
       dEdxID *m_mydedx;
       std::string m_filename;
-      Trk::ParticleMasses        m_particlemasses;      // Particle masses.
       const PixelID* m_pixelid;
       double m_conversionfactor;
       bool m_readfromcool;
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx
index 9d5b97f44c5..f027dbd98c2 100644
--- a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx
+++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx
@@ -46,7 +46,8 @@ InDet::PixelToTPIDTool::PixelToTPIDTool(const std::string& t,
   AthAlgTool(t,n,p),
   m_IBLParameterSvc("IBLParameterSvc",n),
   m_overflowIBLToT(0),
-  m_offlineCalibSvc("PixelOfflineCalibSvc", n)
+  m_offlineCalibSvc("PixelOfflineCalibSvc", n),
+  m_pixelid(nullptr)
 {
   declareInterface<IPixelToTPIDTool>(this);
   declareProperty("CalibrationFile", m_filename = "mcpar_signed_234.txt");
diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h
index c52148c149f..50696480bb4 100644
--- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h
+++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h
@@ -94,8 +94,8 @@ namespace InDet
     /** Electron probabilities to be returned */
     std::vector<float> electronProbability_old(const Trk::Track& track);
 
-    virtual double probHT( const double pTrk, const Trk::ParticleHypothesis hypothesis, const int HitPart, const int Layer, const int Strawlayer) override;
-    virtual double probHTRun2( float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy ) override;
+    virtual double probHT( const double pTrk, const Trk::ParticleHypothesis hypothesis, const int HitPart, const int Layer, const int Strawlayer) const override;
+    virtual double probHTRun2( float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy ) const override;
 
   // get the ToT from the bitpattern and correct for local variations
   // Jared - Remove ToT calc
diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx
index 69b37f1ce55..3fbdb6abfd9 100644
--- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx
+++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx
@@ -498,7 +498,7 @@ bool InDet::TRT_ElectronPidToolRun2::CheckGeometry(int BEC, int Layer, int Straw
 |*%%%  a geometry check is performed every time here  %%%%%%%%%%%%%%%%%%%%%%%*|
 \*****************************************************************************/
 
-double InDet::TRT_ElectronPidToolRun2::probHT( const double /*pTrk*/, const Trk::ParticleHypothesis /*hypothesis*/, const int HitPart, const int Layer, const int StrawLayer){
+double InDet::TRT_ElectronPidToolRun2::probHT( const double /*pTrk*/, const Trk::ParticleHypothesis /*hypothesis*/, const int HitPart, const int Layer, const int StrawLayer) const {
   if (not CheckGeometry(HitPart,Layer,StrawLayer) ){
     ATH_MSG_ERROR("TRT geometry fail. Returning default value.");
     return 0.5;
@@ -509,6 +509,6 @@ double InDet::TRT_ElectronPidToolRun2::probHT( const double /*pTrk*/, const Trk:
 }
 
 
-double InDet::TRT_ElectronPidToolRun2::probHTRun2( float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy ){
+double InDet::TRT_ElectronPidToolRun2::probHTRun2( float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy ) const {
    return m_HTcalc.getProbHT( pTrk, hypothesis, TrtPart, GasType, StrawLayer, ZR, rTrkWire, Occupancy );
 }
diff --git a/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/src/TRT_SeededSpacePointFinder_ATL.cxx b/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/src/TRT_SeededSpacePointFinder_ATL.cxx
index be64ba0a39a..2a20ea4cfef 100755
--- a/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/src/TRT_SeededSpacePointFinder_ATL.cxx
+++ b/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/src/TRT_SeededSpacePointFinder_ATL.cxx
@@ -841,10 +841,10 @@ InDet::TRT_SeededSpacePointFinder_ATL::production2Spb(const Trk::TrackParameters
 
   std::vector<bypass_struct> tmp_prod_bypass;
   tmp_prod_bypass.reserve(spcount);
-  Trk::SpacePoint const**vrp = new Trk::SpacePoint const*[spcount];
-  double *rk = new double[spcount];
-  long *geo_info = new long[spcount];
-  double *zSP = new double[spcount];
+  Trk::SpacePoint const**vrp = new Trk::SpacePoint const*[spcount]{};
+  double *rk = new double[spcount]{};
+  long *geo_info = new long[spcount]{};
+  double *zSP = new double[spcount]{};
 
   if (vrp != 0 && rk != 0 && geo_info != 0 && zSP != 0) {
 
diff --git a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTTrackHoleSearchTool.cxx b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTTrackHoleSearchTool.cxx
index 53a2162c0ec..6b458693c03 100644
--- a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTTrackHoleSearchTool.cxx
+++ b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTTrackHoleSearchTool.cxx
@@ -465,10 +465,7 @@ const Trk::Track* TRTTrackHoleSearchTool::addHolesToTrack(const Trk::Track& trac
 	}
 
 	// add new holes
-	for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator it = holes->begin();
-	     it != holes->end(); ++it) {
-		tsos->push_back(*it);
-	}
+        tsos->insert (tsos->end(), holes->begin(), holes->end());
 
 	// sort
 	const Trk::TrackParameters* perigee = track.perigeeParameters();
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/InDetTrigTrackResidualMonitor/TrigTrackResidualMonitor.h b/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/InDetTrigTrackResidualMonitor/TrigTrackResidualMonitor.h
index 70e2be97c23..60fe28acbbe 100644
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/InDetTrigTrackResidualMonitor/TrigTrackResidualMonitor.h
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/InDetTrigTrackResidualMonitor/TrigTrackResidualMonitor.h
@@ -109,7 +109,6 @@ namespace InDet
     
     const PixelID*           m_idHelperPixel;
     const SCT_ID*            m_idHelperSCT;
-    const InDetDD::SCT_DetectorManager*   m_SCT_Mgr;
     
  
     
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/src/TrigTrackResidualMonitor.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/src/TrigTrackResidualMonitor.cxx
index 187a52ad765..964b73a87de 100644
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/src/TrigTrackResidualMonitor.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/src/TrigTrackResidualMonitor.cxx
@@ -504,13 +504,13 @@ namespace InDet
 		    const Identifier& OtherModuleSideID = m_SCT_Manager->getDetectorElement(id)->otherSide()->identify();
 		    //const Trk::RIO_OnTrack* hit(0);
 		    
-		    for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator TempTsos=(*itResTrk)->trackStateOnSurfaces()->begin();TempTsos!=(*itResTrk)->trackStateOnSurfaces()->end(); ++TempTsos) {
-		      const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>((*TempTsos)->measurementOnTrack());
+		    for (const Trk::TrackStateOnSurface* TempTsos : *(*itResTrk)->trackStateOnSurfaces()) {
+		      const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(TempTsos->measurementOnTrack());
 		      //hit = hitOnTrack;
 		      if (hitOnTrack != 0) {
 			const Identifier& trkID = hitOnTrack->identify();
 			if (m_idHelperSCT->wafer_id(trkID) == OtherModuleSideID) {
-			  OtherModuleSideHit = *TempTsos;
+			  OtherModuleSideHit = TempTsos;
 			}
 		      }
 		    }
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackSlimmer/src/TrigTrackSlimmer.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackSlimmer/src/TrigTrackSlimmer.cxx
index 4d3a2e91165..aecd40429ea 100644
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackSlimmer/src/TrigTrackSlimmer.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackSlimmer/src/TrigTrackSlimmer.cxx
@@ -108,7 +108,8 @@ namespace InDet
 	   it != m_allTracksFromStoreGate->end()   ; ++it) {
 
 	if (!m_sumTool.empty()) {
-	  m_sumTool->updateTrack(**it);
+          // FIXME: const_cast
+	  m_sumTool->updateTrack(*const_cast<Trk::Track*>(*it));
 	}
 	Trk::Track* slimmed = m_trackSlimmingTool->slim(**it);
 	slimmedTracks->push_back(slimmed);
diff --git a/InnerDetector/InDetTruth/InDetTruthInterfaces/InDetTruthInterfaces/IPRD_MultiTruthBuilder.h b/InnerDetector/InDetTruth/InDetTruthInterfaces/InDetTruthInterfaces/IPRD_MultiTruthBuilder.h
index 18707811dae..b67eaf006c3 100755
--- a/InnerDetector/InDetTruth/InDetTruthInterfaces/InDetTruthInterfaces/IPRD_MultiTruthBuilder.h
+++ b/InnerDetector/InDetTruth/InDetTruthInterfaces/InDetTruthInterfaces/IPRD_MultiTruthBuilder.h
@@ -30,7 +30,7 @@ namespace InDet {
 				 const Trk::PrepRawData* prd,
 				 const InDetSimDataCollection* simDataMap,
 				 bool pixels
-				 ) = 0;
+				 ) const = 0;
     
   };
 
diff --git a/InnerDetector/InDetTruth/InDetTruthTools/InDetTruthTools/PRD_MultiTruthBuilder.h b/InnerDetector/InDetTruth/InDetTruthTools/InDetTruthTools/PRD_MultiTruthBuilder.h
index e1d4a9f8889..2bc7d9538d2 100755
--- a/InnerDetector/InDetTruth/InDetTruthTools/InDetTruthTools/PRD_MultiTruthBuilder.h
+++ b/InnerDetector/InDetTruth/InDetTruthTools/InDetTruthTools/PRD_MultiTruthBuilder.h
@@ -24,7 +24,7 @@ namespace InDet {
 				 const Trk::PrepRawData* prd,
 				 const InDetSimDataCollection* simDataMap,
 				 bool pixels
-				 );
+				 ) const;
 
     virtual StatusCode initialize();
     
diff --git a/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_MultiTruthBuilder.cxx b/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_MultiTruthBuilder.cxx
index 826b443a5a2..1bd4a6c95e1 100755
--- a/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_MultiTruthBuilder.cxx
+++ b/InnerDetector/InDetTruth/InDetTruthTools/src/PRD_MultiTruthBuilder.cxx
@@ -44,7 +44,7 @@ void PRD_MultiTruthBuilder::addPrepRawDatum(PRD_MultiTruthCollection *prdTruth,
 					    const Trk::PrepRawData* prd,
 					    const InDetSimDataCollection* simDataMap,
 					    bool pixels
-					    )
+					    ) const
 {
   if(!prdTruth || !prd || !simDataMap) {
     return;
diff --git a/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx b/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx
index c280d1363cd..fcf4a751480 100644
--- a/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx
+++ b/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx
@@ -62,7 +62,6 @@ ResPullValidation::ResPullValidation(std::string etaORphi, std::string pullORres
 	// double *angleBins;
 	double lim;
 	if(m_anglename == "eta"){
-		m_anglename = "eta";
 		// nangleBins = 10;
 		// angleBins = IntegerBins(nangleBins,-2.5,0.5);
 		if (m_respullname == "res" && m_datatype != "cosmic") lim = 0.5;
@@ -171,7 +170,7 @@ bool ResPullValidation::Fill(Int_t Layer, Double_t GeVTrkPt, Double_t Angle,
 	
 	float HighPtRes=0;
 	if(m_datatype == "cosmic") HighPtRes = 1;
-	if(m_anglename == "phi") HighPtRes=0.05;
+	else if(m_anglename == "phi") HighPtRes=0.05;
 	else HighPtRes=0.5;
 	if( fabs(Residual) < sqrt((0.5/GeVTrkPt)*(0.5/GeVTrkPt)
 				+ HighPtRes*HighPtRes) ){
@@ -278,8 +277,17 @@ int ResPullValidation::Analyze(TDirectory *ref_file){
 		delete c1;
 	}
 
-	chdir(currpath);
-	delete currpath;
+	if(currpath==NULL) {
+          std::stringstream message;
+          message << "Invalid current directory! ";
+          throw std::runtime_error(message.str());
+        }
+        else if( chdir(currpath)!=0) {
+          std::stringstream message;
+          message << "Failed to enter current directory!";
+          throw std::runtime_error(message.str());;
+        }
+        delete currpath;
 	delete reference;
 
 	old->cd();
diff --git a/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx b/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx
index 846594a66e7..6eb4c31b1d7 100644
--- a/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx
+++ b/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx
@@ -196,7 +196,17 @@ int CosmicTrackValidation::Analyze(TDirectory *ref_file){
 	}
 	delete[] c1;
         delete reference;
-	chdir(currpath);
+
+        if(currpath==NULL) {
+          std::stringstream message;
+          message << "Invalid current directory! ";
+          throw std::runtime_error(message.str());
+        }
+        else if( chdir(currpath)!=0) {
+          std::stringstream message;
+          message << "Failed to enter current directory!";
+          throw std::runtime_error(message.str());;
+        }
 	delete currpath;
 
 	old->cd();
diff --git a/LArCalorimeter/LArCalibUtils/LArCalibUtils/LArStripsCrossTalkCorrector.h b/LArCalorimeter/LArCalibUtils/LArCalibUtils/LArStripsCrossTalkCorrector.h
index 6b7a63dedf3..ecf084916a8 100755
--- a/LArCalorimeter/LArCalibUtils/LArCalibUtils/LArStripsCrossTalkCorrector.h
+++ b/LArCalorimeter/LArCalibUtils/LArCalibUtils/LArStripsCrossTalkCorrector.h
@@ -94,7 +94,7 @@ class LArStripsCrossTalkCorrector : public AthAlgorithm
 
   const size_t m_noIdx;
 
-  std::vector < std::vector < LArAccumulatedCalibDigit* > > m_stripsLookUp;
+  std::vector < std::vector < const LArAccumulatedCalibDigit* > > m_stripsLookUp;
 
   std::vector < std::bitset< 128 > > m_knownMissingFebs;
 
diff --git a/LArCalorimeter/LArCalibUtils/src/LArCalibShortCorrector.cxx b/LArCalorimeter/LArCalibUtils/src/LArCalibShortCorrector.cxx
index 2200840a20b..1f3e64c818c 100644
--- a/LArCalorimeter/LArCalibUtils/src/LArCalibShortCorrector.cxx
+++ b/LArCalorimeter/LArCalibUtils/src/LArCalibShortCorrector.cxx
@@ -139,7 +139,7 @@ StatusCode LArCalibShortCorrector::execute(){
     }
     
 
-    std::vector<std::pair<LArAccumulatedCalibDigit*, LArAccumulatedCalibDigit*> > shortedDigits;
+    std::vector<std::pair<const LArAccumulatedCalibDigit*, const LArAccumulatedCalibDigit*> > shortedDigits;
     shortedDigits.resize(nShorts);
 
     LArAccumulatedCalibDigitContainer::const_iterator it=larAccumulatedCalibDigitContainer->begin();
@@ -207,7 +207,8 @@ StatusCode LArCalibShortCorrector::execute(){
 	newSampleSum[is]=sampleSumsPulsed[is]+(sampleSumsNeighbor[is]-ped);
 	//std::cout << newSampleSum[is] << std::endl;
       }
-      shortedDigits[ii].first->setSampleSum(newSampleSum);
+      // FIXME: const_cast can change objects in SG.
+      const_cast<LArAccumulatedCalibDigit*>(shortedDigits[ii].first)->setSampleSum(newSampleSum);
     }//end loop over pairs of shorted digits
   }//end loop over container keys
   return StatusCode::SUCCESS;
diff --git a/LArCalorimeter/LArCalibUtils/src/LArStripsCrossTalkCorrector.cxx b/LArCalorimeter/LArCalibUtils/src/LArStripsCrossTalkCorrector.cxx
index 34a682987a0..1efa54e7b7e 100755
--- a/LArCalorimeter/LArCalibUtils/src/LArStripsCrossTalkCorrector.cxx
+++ b/LArCalorimeter/LArCalibUtils/src/LArStripsCrossTalkCorrector.cxx
@@ -206,7 +206,7 @@ StatusCode LArStripsCrossTalkCorrector::executeWithAccumulatedDigits()
     int nStrips=0;
     
     for (;it!=it_end;it++) {  //Loop over all cells to fill Strips lookup table
-      LArAccumulatedCalibDigit* dig=*it;
+      const LArAccumulatedCalibDigit* dig=*it;
       chid=dig->hardwareID();     
       if (!(m_onlineHelper->isEMBchannel(chid) || m_onlineHelper->isEMECchannel(chid))) continue; //Deal only with EM calos case
       if (!m_larCablingSvc->isOnlineConnected(chid)) continue; //ignore disconnected channels
@@ -301,7 +301,7 @@ StatusCode LArStripsCrossTalkCorrector::executeWithAccumulatedDigits()
 	for (unsigned iphi=0; iphi<m_MAXphi; iphi++) {  // Loop over phi range
 	 
 	  const unsigned iphi2=iphi+m_MAXphi*iside;    //Phi index inside lookup table 
-	  LArAccumulatedCalibDigit* currDig=m_stripsLookUp[iphi2][ieta];
+	  const LArAccumulatedCalibDigit* currDig=m_stripsLookUp[iphi2][ieta];
 
 	  if (currDig==0 || currDig==&febErrorDummy) continue; //Digit not found or FEB in error: ignore
 
@@ -478,7 +478,8 @@ StatusCode LArStripsCrossTalkCorrector::executeWithAccumulatedDigits()
 	    else {
 	      ATH_MSG_VERBOSE("Correction for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec << " DAC="<<currDig->DAC() << " succeeded " 
 			      << currDig->sampleSum()[2] << "->" << SampleSumInt[2]);
-	      currDig->setSampleSum(SampleSumInt);
+              // FIXME: const_cast, modifying object in SG.
+	      const_cast<LArAccumulatedCalibDigit*>(currDig)->setSampleSum(SampleSumInt);
 	    }
 
 	  }// end if-pulsed 
diff --git a/LArCalorimeter/LArCellRec/src/LArCellMaskingTool.cxx b/LArCalorimeter/LArCellRec/src/LArCellMaskingTool.cxx
index ca4b2c9dc48..677259852c4 100644
--- a/LArCalorimeter/LArCellRec/src/LArCellMaskingTool.cxx
+++ b/LArCalorimeter/LArCellRec/src/LArCellMaskingTool.cxx
@@ -140,10 +140,10 @@ StatusCode LArCellMaskingTool::fillIncludedCellsMap() {
 	    else
 	      nDisconnected++;
 	  }
-	  catch (LArOnlID_Exception) {
+	  catch (const LArOnlID_Exception&) {
 	    nOnlExceptions++;
 	  }
-	  catch(LArID_Exception) {
+	  catch(const LArID_Exception&) {
 	    nOfflExceptions++;
 	  }
 	  if (!haveChannel) channel++;
diff --git a/LArCalorimeter/LArGeoModel/LArGeoH62002Algs/src/LArDetectorToolH62002.cxx b/LArCalorimeter/LArGeoModel/LArGeoH62002Algs/src/LArDetectorToolH62002.cxx
index 26b92e9a900..a33a9af26d0 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoH62002Algs/src/LArDetectorToolH62002.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoH62002Algs/src/LArDetectorToolH62002.cxx
@@ -103,7 +103,7 @@ LArDetectorToolH62002::create()
       //
       GeoPhysVol *world=&*theExpt->getPhysVol();
       theLArFactory.create(world);
-    } catch (std::bad_alloc) {
+    } catch (const std::bad_alloc&) {
       log << MSG::FATAL << "Could not create new H62002Node!" << endmsg;
       return StatusCode::FAILURE; 
     }
diff --git a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/CMakeLists.txt b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/CMakeLists.txt
index 821a785accb..deb64ed3222 100644
--- a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/CMakeLists.txt
+++ b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/CMakeLists.txt
@@ -14,7 +14,7 @@ atlas_depends_on_subdirs( PUBLIC
                           LArCalorimeter/LArGeoModel/LArReadoutGeometry
                           PRIVATE
                           Calorimeter/CaloDetDescr
-                          Control/DataModel
+                          Control/AthContainers
                           Database/AthenaPOOL/RDBAccessSvc
                           GaudiKernel
                           LArCalorimeter/LArG4/LArG4RunControl
@@ -33,7 +33,7 @@ atlas_add_component( LArGeoH62004Algs
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib SGtests GeoModelKernel GeoModelUtilities LArReadoutGeometry CaloDetDescrLib DataModel GaudiKernel LArG4RunControl LArGeoCode LArGeoEndcap LArGeoH6Cryostats LArGeoTBECLib )
+                     LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib SGtests GeoModelKernel GeoModelUtilities LArReadoutGeometry CaloDetDescrLib AthContainers GaudiKernel LArG4RunControl LArGeoCode LArGeoEndcap LArGeoH6Cryostats LArGeoTBECLib )
 
 # Install files from the package:
 atlas_install_headers( LArGeoH62004Algs )
diff --git a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorFactoryH62004.cxx b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorFactoryH62004.cxx
index 5ef7bb5f377..37a57fd1c45 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorFactoryH62004.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorFactoryH62004.cxx
@@ -31,7 +31,7 @@
 #include "CLHEP/GenericFunctions/Cos.hh"
 #include "StoreGate/StoreGateSvc.h"
 #include "StoreGate/DataHandle.h"
-#include "DataModel/DataVector.h"
+#include "AthContainers/DataVector.h"
 
 // need if we want tu use EMEC from LArGeoTBEC:
 #include "LArGeoTBEC/EMECModuleConstruction.h"
diff --git a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorToolH62004.cxx b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorToolH62004.cxx
index 2f406eb019e..a0f02659e22 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorToolH62004.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorToolH62004.cxx
@@ -142,7 +142,7 @@ LArDetectorToolH62004::create()
       //
       GeoPhysVol *world=&*theExpt->getPhysVol();
       theLArFactory.create(world);
-    } catch (std::bad_alloc) {
+    } catch (const std::bad_alloc&) {
       log << MSG::FATAL << "Could not create new H62004Node!" << endmsg;
       return StatusCode::FAILURE; 
     }
diff --git a/LArCalorimeter/LArGeoModel/LArReadoutGeometry/LArReadoutGeometry/FCAL_ChannelMap.h b/LArCalorimeter/LArGeoModel/LArReadoutGeometry/LArReadoutGeometry/FCAL_ChannelMap.h
index 1a850ce5b5d..ba65c06f865 100755
--- a/LArCalorimeter/LArGeoModel/LArReadoutGeometry/LArReadoutGeometry/FCAL_ChannelMap.h
+++ b/LArCalorimeter/LArGeoModel/LArReadoutGeometry/LArReadoutGeometry/FCAL_ChannelMap.h
@@ -87,18 +87,18 @@ public:
 		   float x, 
 		   float y, 
 		   int& eta, 
-		   int& phi) const throw (std::range_error);
+		   int& phi) const;
 
     /** For reconstruction, decoding of tile identifiers */
     float x(int isam, 
 	    int eta, 
-	    int phi) const throw(std::range_error) ;
+	    int phi) const;
     float y(int isam, 
 	    int eta, 
-	    int phi) const throw(std::range_error) ;
+	    int phi) const;
 
     void tileSize(int sam, int eta, int phi, 
-		  float& dx, float& dy) const throw(std::range_error) ;
+		  float& dx, float& dy) const;
 
     void tileSize(int isam, int ntubes, float& dx, float& dy) const;
 
diff --git a/LArCalorimeter/LArGeoModel/LArReadoutGeometry/src/FCAL_ChannelMap.cxx b/LArCalorimeter/LArGeoModel/LArReadoutGeometry/src/FCAL_ChannelMap.cxx
index bc607c9cff2..109d17096df 100755
--- a/LArCalorimeter/LArGeoModel/LArReadoutGeometry/src/FCAL_ChannelMap.cxx
+++ b/LArCalorimeter/LArGeoModel/LArReadoutGeometry/src/FCAL_ChannelMap.cxx
@@ -205,7 +205,7 @@ FCAL_ChannelMap::create_tileMap(int isam)
 // ***********************************************************************
 bool 
 FCAL_ChannelMap::getTileID(int isam, float x_orig, float y_orig, 
-	int& eta, int& phi) const throw (std::range_error) 
+	int& eta, int& phi) const
 {
 
 //  /* ### MIRROR for compatibility between G3 and ASCII files ### */
@@ -304,7 +304,6 @@ FCAL_ChannelMap::getTileID(int isam, float x_orig, float y_orig,
    ---------------------------------------------------------------------- */
 float 
 FCAL_ChannelMap::x(int isam, int eta, int phi) const
-                                    throw(std::range_error)
 {
   if(m_invert_xy){ 
    // temp turn off the flag 
@@ -347,7 +346,6 @@ FCAL_ChannelMap::x(int isam, int eta, int phi) const
    ---------------------------------------------------------------------- */
 float 
 FCAL_ChannelMap::y(int isam, int eta, int phi) const
-                                    throw(std::range_error)
 {
   if(m_invert_xy){
 
@@ -423,7 +421,7 @@ void FCAL_ChannelMap::tileSize(int sam, int ntubes, float &dx, float &dy) const
 }
 
 void FCAL_ChannelMap::tileSize(int sam, int eta, int phi,
-	float& dx, float& dy ) const  throw(std::range_error)
+	float& dx, float& dy ) const
 {
   
   tileName_t tilename = (eta << 16) + phi  ; 
diff --git a/LArCalorimeter/LArIdentifier/LArIdentifier/LArElectrodeID.h b/LArCalorimeter/LArIdentifier/LArIdentifier/LArElectrodeID.h
index 017f9d0be7c..ae6e5b040d3 100755
--- a/LArCalorimeter/LArIdentifier/LArIdentifier/LArElectrodeID.h
+++ b/LArCalorimeter/LArIdentifier/LArIdentifier/LArElectrodeID.h
@@ -247,7 +247,7 @@ class LArElectrodeID : public AtlasDetectorID {
   IdentifierHash electrode_hash_binary_search(HWIdentifier elecId) const;
   
   /* Check methods */
-  void  electrodeId_checks(int det, int side, int mod, int phi, int eta, int hvgap, int elec )const throw(LArOnlID_Exception);
+  void  electrodeId_checks(int det, int side, int mod, int phi, int eta, int hvgap, int elec )const;
   
   /* create expanded HWIdentifier from HWIdentifier (return == 0 for OK) */
   int  get_expanded_id (const HWIdentifier& id, ExpandedIdentifier& exp_id, 
diff --git a/LArCalorimeter/LArIdentifier/LArIdentifier/LArHVLineID.h b/LArCalorimeter/LArIdentifier/LArIdentifier/LArHVLineID.h
index 9962b11c378..ef6f1a3057a 100755
--- a/LArCalorimeter/LArIdentifier/LArIdentifier/LArHVLineID.h
+++ b/LArCalorimeter/LArIdentifier/LArIdentifier/LArHVLineID.h
@@ -159,7 +159,7 @@ class LArHVLineID : public AtlasDetectorID {
   IdentifierHash hvline_hash_binary_search(HWIdentifier hvId) const;
 
   /* Check methods */
-  void  hvlineId_checks(int part, int canline, int cannode, int line )const throw(LArOnlID_Exception);
+  void  hvlineId_checks(int part, int canline, int cannode, int line )const;
 
   /* create expanded HWIdentifier from HWIdentifier (return == 0 for OK) */
   int  get_expanded_id (const HWIdentifier& id, ExpandedIdentifier& exp_id, 
diff --git a/LArCalorimeter/LArIdentifier/LArIdentifier/LArOnlineID_Base.h b/LArCalorimeter/LArIdentifier/LArIdentifier/LArOnlineID_Base.h
index b8da64432b5..fd73570f3ac 100755
--- a/LArCalorimeter/LArIdentifier/LArIdentifier/LArOnlineID_Base.h
+++ b/LArCalorimeter/LArIdentifier/LArIdentifier/LArOnlineID_Base.h
@@ -355,18 +355,18 @@ protected:
 			  int pos_neg,
 			  int feedthrough,
 			  int slot,
-			  int channel ) const throw(LArOnlID_Exception);
+			  int channel ) const;
 
   void  channel_Id_checks(const HWIdentifier feedthroughId,
 			  int slot,
-			  int channel ) const throw(LArOnlID_Exception);
+			  int channel ) const;
 
   void  channel_Id_checks(const HWIdentifier febId,
-			  int channel ) const throw(LArOnlID_Exception);
+			  int channel ) const;
 
-  void  feb_Id_checks(int barrel_ec, int pos_neg, int feedthrough, int slot ) const throw(LArOnlID_Exception); 
+  void  feb_Id_checks(int barrel_ec, int pos_neg, int feedthrough, int slot ) const;
 
-  void  feedthrough_Id_checks(int barrel_ec, int pos_neg, int feedthrough ) const throw(LArOnlID_Exception); 
+  void  feedthrough_Id_checks(int barrel_ec, int pos_neg, int feedthrough ) const; 
 
   /** create expanded HWIdentifier from HWIdentifier (return == 0 for OK) */
   int  get_expanded_id  (const HWIdentifier& id, 
diff --git a/LArCalorimeter/LArIdentifier/src/LArOnlineID_Base.cxx b/LArCalorimeter/LArIdentifier/src/LArOnlineID_Base.cxx
index 885916b7611..31d7816ec62 100755
--- a/LArCalorimeter/LArIdentifier/src/LArOnlineID_Base.cxx
+++ b/LArCalorimeter/LArIdentifier/src/LArOnlineID_Base.cxx
@@ -675,7 +675,7 @@ int  LArOnlineID_Base::initialize_from_dictionary (const IdDictMgr& dict_mgr)
 
 /* ================================================================*/
 void LArOnlineID_Base::channel_Id_checks( int barrel_ec, int pos_neg, int feedthrough,
-                                     int slot,       int channel ) const throw(LArOnlID_Exception)
+                                     int slot,       int channel ) const
 /* ================================================================*/
 {  
     // Check that id is within allowed range
@@ -703,7 +703,7 @@ void LArOnlineID_Base::channel_Id_checks( int barrel_ec, int pos_neg, int feedth
 
 /* ================================================================*/
 void LArOnlineID_Base::channel_Id_checks   ( const HWIdentifier febId,
-                                        int channel ) const throw(LArOnlID_Exception) 
+                                        int channel ) const
 /* ================================================================*/
 {
   // Check that id is within allowed range
@@ -729,7 +729,7 @@ void LArOnlineID_Base::channel_Id_checks   ( const HWIdentifier febId,
 
 /* ================================================================*/
 void LArOnlineID_Base::channel_Id_checks   ( const HWIdentifier feedthroughId,
-                                         int slot,  int channel ) const throw(LArOnlID_Exception) 
+                                         int slot,  int channel ) const
 /* ================================================================*/
 {
   // Check that id is within allowed range
@@ -754,7 +754,7 @@ void LArOnlineID_Base::channel_Id_checks   ( const HWIdentifier feedthroughId,
 }
 
 /* ================================================================*/
-void LArOnlineID_Base::feb_Id_checks( int barrel_ec, int pos_neg, int feedthrough, int slot ) const throw(LArOnlID_Exception)
+void LArOnlineID_Base::feb_Id_checks( int barrel_ec, int pos_neg, int feedthrough, int slot ) const
 /* ================================================================*/
 {
   // Check that id is within allowed range
@@ -781,7 +781,7 @@ void LArOnlineID_Base::feb_Id_checks( int barrel_ec, int pos_neg, int feedthroug
 }
 
 /* ================================================================*/
-void LArOnlineID_Base::feedthrough_Id_checks( int barrel_ec, int pos_neg, int feedthrough ) const throw(LArOnlID_Exception)
+void LArOnlineID_Base::feedthrough_Id_checks( int barrel_ec, int pos_neg, int feedthrough ) const
 /* ==============================================================================*/
 {
   // Check that id is within allowed range
diff --git a/LArCalorimeter/LArRawUtils/LArRawUtils/LArRoI_Map.h b/LArCalorimeter/LArRawUtils/LArRawUtils/LArRoI_Map.h
index 8744b9c0022..f31ee9dfe2c 100755
--- a/LArCalorimeter/LArRawUtils/LArRawUtils/LArRoI_Map.h
+++ b/LArCalorimeter/LArRawUtils/LArRawUtils/LArRoI_Map.h
@@ -90,7 +90,7 @@ class LArRoI_Map : public AthAlgTool,
 
   /** Add channel to cache
    */
-  void addEntry( const Identifier& id  ) throw (LArID_Exception) ; 
+  void addEntry( const Identifier& id  ); 
 
   void print(); 
 
diff --git a/LArCalorimeter/LArRawUtils/src/LArRoI_Map.cxx b/LArCalorimeter/LArRawUtils/src/LArRoI_Map.cxx
index 509f7ab0de4..48cc6677f4a 100755
--- a/LArCalorimeter/LArRawUtils/src/LArRoI_Map.cxx
+++ b/LArCalorimeter/LArRawUtils/src/LArRoI_Map.cxx
@@ -189,7 +189,7 @@ LArRoI_Map::~LArRoI_Map( )
 }
 
 
-void LArRoI_Map::addEntry(const Identifier& id )  throw (LArID_Exception) 
+void LArRoI_Map::addEntry(const Identifier& id )
 {
 
 // std::cout <<" addEntry id="<<m_TT_ID->show_to_string(id)<<std::endl; 
diff --git a/LArCalorimeter/LArTest/LArCalibTest/src/LArCablingChecker.cxx b/LArCalorimeter/LArTest/LArCalibTest/src/LArCablingChecker.cxx
index ef60a172ae7..4a72d1794e4 100755
--- a/LArCalorimeter/LArTest/LArCalibTest/src/LArCablingChecker.cxx
+++ b/LArCalorimeter/LArTest/LArCalibTest/src/LArCablingChecker.cxx
@@ -149,7 +149,7 @@ StatusCode LArCablingChecker::execute() {
     try {
       offline_id = m_larCablingSvc->cnvToIdentifier(online_id);
     }
-    catch (LArID_Exception) {
+    catch (const LArID_Exception&) {
       noOffline_id = true;
     }
 
diff --git a/LumiBlock/LumiCalc/CMakeLists.txt b/LumiBlock/LumiCalc/CMakeLists.txt
index 5d64a418ad6..a3eecfc463a 100644
--- a/LumiBlock/LumiCalc/CMakeLists.txt
+++ b/LumiBlock/LumiCalc/CMakeLists.txt
@@ -14,10 +14,6 @@ atlas_depends_on_subdirs( PUBLIC
                           PRIVATE
                           Control/DataModelRoot
                           Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
-                          Database/APR/PersistencySvc
-                          Database/APR/StorageSvc
                           Database/AthenaPOOL/DBDataModel
                           Database/CoolConvUtilities
                           Database/CoraCool )
@@ -37,7 +33,7 @@ atlas_add_library( LumiBlockCoolQuery
                    PUBLIC_HEADERS LumiCalc
                    INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
                    LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaKernel xAODLuminosity LumiBlockData GoodRunsListsLib
-                   PRIVATE_LINK_LIBRARIES DataModelRoot CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc DBDataModel )
+                   PRIVATE_LINK_LIBRARIES DataModelRoot CollectionBase DBDataModel )
 
 atlas_add_executable( iLumiCalc
                       src/iLumiCalc.cxx
@@ -47,7 +43,7 @@ atlas_add_executable( iLumiCalc
                       src/LumiCalculator.cxx
                       src/ReplicaSorter.cxx
                       INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaKernel GoodRunsListsLib xAODLuminosity LumiBlockData DataModelRoot CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc DBDataModel LumiBlockCoolQuery )
+                      LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaKernel GoodRunsListsLib xAODLuminosity LumiBlockData DataModelRoot CollectionBase DBDataModel LumiBlockCoolQuery )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb.cxx b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb.cxx
index b12b259c438..d29d686ef51 100755
--- a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb.cxx
+++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb.cxx
@@ -184,6 +184,7 @@ StatusCode AmdcDb::initialize() {
         ATH_MSG_FATAL( "DoUpdatedSvc failed" ) ; 
         return StatusCode::FAILURE;
       }
+      m_IsInitialized = true;
   }
   
   ATH_MSG_INFO( "Initialisation ended     " ) ;
@@ -245,11 +246,6 @@ StatusCode AmdcDb::DoUpdatedSvc()
     return StatusCode::SUCCESS;
   }
 
-  if ( !m_AmdcsimrecAthenaSvcUpdatedSvcDONE ){
-    ATH_MSG_INFO( "DoUpdatedSvc() called BUT m_AmdcsimrecAthenaSvcUpdatedSvcDONE is false    " ) ;
-    return StatusCode::SUCCESS;
-  }
-
 //Set Db Keys
   IRDBAccessSvc* pIRDBAccessSvc;
   StatusCode sc = service("RDBAccessSvc",pIRDBAccessSvc);
diff --git a/MuonSpectrometer/Amdcsimrec/AmdcOracle/src/AmdcDumpOracle.cxx b/MuonSpectrometer/Amdcsimrec/AmdcOracle/src/AmdcDumpOracle.cxx
index b663abaa134..677686acb80 100755
--- a/MuonSpectrometer/Amdcsimrec/AmdcOracle/src/AmdcDumpOracle.cxx
+++ b/MuonSpectrometer/Amdcsimrec/AmdcOracle/src/AmdcDumpOracle.cxx
@@ -86,7 +86,7 @@ StatusCode AmdcDumpOracle::initialize(){
 //  Do something now if possible
     if ( m_IRDBAccessSvcWithUpdateUpdatedSvcDONE ){
       ATH_MSG_INFO( "m_IRDBAccessSvcWithUpdateUpdatedSvcDONE found true in initialize " ) ;
-      StatusCode sc = DoIt() ;
+      sc = DoIt() ;
       if ( sc.isFailure() ) {
         ATH_MSG_FATAL( "DoIt failed" ) ; 
         return StatusCode::FAILURE;
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/python/GlobalChi2Align_IteratorClasses.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/python/GlobalChi2Align_IteratorClasses.py
deleted file mode 100644
index ed99db2a846..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/python/GlobalChi2Align_IteratorClasses.py
+++ /dev/null
@@ -1,547 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-import os
-import sys
-import commands
-import shutil 
-import time
-import datetime # available in python 2.3
-import re
-import glob
-
-from Jobs         import JobThread,LocalJobList,SgeJobList,LxbatchJobList,PathenaJobList,PbsJobList
-from DefaultFiles import Files,DefaultFiles
-from ScriptWriter import ScriptWriter
-
-#------------------------------------------------------------------------
-class GlobalChi2AlignIterator:
-    """Class which runs the alignment iterations."""
-    
-    def __init__(self,logfile):
-        self.nCPUs               = 1
-        self.queue               = ""
-        self.firstIteration      = 0
-        self.iterations          = 1
-        self.outputPath          = ""
-        self.runMode             = ""    # pathena, lxbatch, local, sge, pbs
-        self.runLocation         = "lxplus"
-        self.doJobChecks         = True
-        self.doAccumulate        = True  # if false, input expected from matrix/vector.bin
-        self.solveLocally        = False 
-        self.runargsJobOption    = "runargs.ESDtoESD.py"
-        self.zipLogFiles         = False
-        self.setupScript         = ""   
-        self.alignmentLevel      = 'L3'
-        self.rootName            = ''
-        self.doEndcapOnly        = False
-        self.doBarrelOnly        = False
-        self.inputAsztFile       = ''
-        self.inputL1Ascii        = ''
-        self.inputL23Ascii       = ''
-        self.files               = NotImplemented
-        self.runOptions          = ''    # only used for global alignment flags
-        self.errorScaleDb        = ''
-        self.readEventList       = False 
-        self.writeEventList      = True
-        self.nFilesPerJob        = 0
-        self.nEventsPerJob       = -1
-        self.dataType            = 'MC'
-        self.skipEvents          = 0
-        self.resumePathenaJob    = False
-        self.site                = ''
-        self.doBinariesOnly      = True # only gets matrix.bin and vector.bin from pathena job output
-        self.preIncludes         = []
-        self.tag                 = ""
-        self.libDS               = ""
-        self.official            = False
-
-    def configRunMode(self):
-        
-        #---------------------------------------
-        # Auto config for batch running
-        #---------------------------------------
-        if self.queue == "" :
-            if self.runMode == "lxbatch" :
-                self.queue = "8nh"
-            elif self.runMode == "sge" :
-                self.queue = "all.q"
-            elif self.runMode == "pbs" :
-                self.queue = "batch"   
-
-        #--------------------------------------
-        # Auto config rootName 
-        #--------------------------------------
-        if self.rootName == "" :
-            if self.alignmentLevel == 'L1' :
-                self.rootName = "L1"
-            if self.alignmentLevel == 'L2.3' :
-                self.rootName = "L23"
-            else :
-                self.rootName = "L3"
-                self.rootName+="_"+self.dataType
-            #self.rootName+="_"+self.runMode
-            self.rootName += "_";
-            if self.doEndcapOnly:
-                self.rootName += "EC";
-            elif self.doBarrelOnly:
-                self.rootName += "Barrel";
-            else :
-                self.rootName +="notshifted"
-
-            print "\nUsing auto-configured rootName ",self.rootName
-
-        #-------------------------------------
-        # Auto config output path
-        #-------------------------------------
-        if self.outputPath =="" :
-            if self.runLocation == "lxplus" :
-                user = os.getenv("USER")
-                self.outputPath = "/afs/cern.ch/user/"+user[0]+"/"+user+"/scratch0/"+self.rootName+"_results"
-            else :
-                self.outputPath = "/tmp/$USER/"+self.rootName+"_results"
-            msg = "\nOutput path: "+self.outputPath
-            print msg
-
-        
-        #------------------------------    
-        # Auto config default files/datasets
-        #-------------------------------
-        filestype="files"
-        if self.runMode == "pathena" or self.runMode == "prun":
-            filestype="dataset"
-
-        if self.files == NotImplemented :
-            if self.dataType == "MC":
-                self.files = DefaultFiles.default('zmumu_MC',filestype)
-            elif self.dataType == "cosmics" :
-                self.files = DefaultFiles.default('121080',filestype)
-            elif self.dataType == "data" :
-                self.files = DefaultFiles.default('periodD',filestype)        
-            elif self.dataType == 'bfield_off_MC':
-                if self.MCmomentum==4:
-                    self.files = DefaultFiles.default('bfield_off_MC_4GeV',filestype)                    
-                elif self.MCmomentum==6:
-                    self.files = DefaultFiles.default('bfield_off_MC_6GeV',filestype)
-                elif self.MCmomentum==8:
-                    self.files = DefaultFiles.default('bfield_off_MC_8GeV',filestype)
-                elif self.MCmomentum==12:
-                    self.files = DefaultFiles.default('bfield_off_MC_12GeV',filestype)
-                elif self.MCmomentum==20:
-                    self.files = DefaultFiles.default('bfield_off_MC_20GeV',filestype)
-                else:
-                    print "bad momentum for bfield_off MC!"
-                    sys.exit(32)
-            elif self.dataType == 'bfield_off_data':
-                self.files = DefaultFiles.default('bfield_off_data',filestype)
-                self.preIncludes.append("bfield_off.py")
-            elif self.dataType == 'L1_zmumu_MC':
-                self.files = DefaultFiles.default('L1_zmumu_MC',filestype)
-            else :
-                msg = "ERROR: Unkown dataType! Known values are MC,cosmics,data. Given: "+repr(self.dataType)
-                print msg
-                sys.exit(3)
-        else :
-            print "Using user defined files in directory:"
-            print self.files.inputFilePath
-
-        self.inputDatasetDef=self.files.datasetdef
-        print "\ninput files: \n",self.files.files
-        
-        #--------------------------------------------------
-        # Auto config job parameters
-        #--------------------------------------------------
-        if self.runMode == "local" :
-            if self.nCPUs == 0 :
-                self.nCPUs = 1
-            if self.nFilesPerJob == 0 :
-                self.nFilesPerJob = 1
-            if self.nEventsPerJob == 0:
-                self.nEventsPerJob = 200
-        else :
-            if self.nFilesPerJob == 0 :
-                self.nFilesPerJob = 1
-            if self.nEventsPerJob == 0:
-                self.nEventsPerJob = 500
-
-        #-------------------------------------
-        # Auto config output path
-        #-------------------------------------
-        
-        #shutil.copy(self.alignJobOptions,self.outputPath)
-        #shutil.copy(self.solveJobOptions,self.outputPath)
-        #if self.errorScaleDb!='':
-        #    shutil.copy(self.errorScaleDb,self.outputPath)
-
-        return
-
-    def run(self):
-        
-        # create output directory and copy files there
-        self.setupOutputDir()
-        
-        print "----------------------------------------------"
-        print "\t%s      " % datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
-        print "----------------------------------------------"
-        print "output path:   ", self.outputPath
-        print "athena release:", os.environ.get("AtlasVersion")
-        print "run mode:      ", self.runMode
-        
-        #check the runmode
-        self.checkRunMode()
-        
-        #start the total time counter  
-        StartTime=time.time()
-
-        #loop over iterations
-        for iter in range(self.firstIteration, self.firstIteration+self.iterations):
-            
-            # print header
-            print
-            print "----------------------------------------------"
-            print "--- Iteration "+repr(iter)
-            print "----------------------------------------------"
-            
-            # get start time
-            IterStartTime=time.time()
-
-             #get the job handler for accumulate and solve jobs
-            print "getting jobLists"
-            accumJobList,solveJobList = self.getJobLists()
-
-            #loop over Jobs/CPUs
-            if self.doAccumulate:
-                print "Processing..."
-                self.processAccumulateJobs(iter,accumJobList)
-                print "done processing"
-
-                if self.doJobChecks:
-                    print "Checking jobs..."
-                    self.checkAccumulateJobs(iter,accumJobList)
-
-            #AsztOutputDir = scriptWriter.IterPath
-            #print "AsztOutputDir: ",AsztOutputDir
-
-            # if pathena job, get the output files
-            if self.runMode == 'pathena' or self.runMode == 'prun' :
-
-                print "running post job"
-                scriptWriter=ScriptWriter(self,iter)
-                postjobscript = scriptWriter.pathenaPostJobScript()
-
-                localJobList=LocalJobList(1)
-                postLogFile = scriptWriter.LogDir + scriptWriter.JobName + \
-                    '.postlog'
-                localJobList.process(postjobscript,postLogFile)                
-                print "done with post job"
-
-            if self.doSolve:
-                print "Solving Iteration ",repr(iter)," with solveJobList: ",solveJobList
-                self.processSolveJob(iter,solveJobList)
-            else:
-                print "Skip Solving Iteration "+repr(iter)
-                            
-            print "----------------------------------------------" 
-            print "  Iteration %d finished: %5.3f seconds" % (iter,(time.time()-IterStartTime))
-            print "----------------------------------------------"
-
-            ##end of for(iterations)
-        print
-        print "----------------------------------------------" 
-        print "Processed %d Iterations in %5.3f seconds" % (self.iterations,time.time()-StartTime)
-        print "----------------------------------------------" 
-    
-    
-    def setupOutputDir(self):
-
-        #create output directory
-        self.outputPath = self.getPath(self.outputPath)
-        if os.path.isdir(self.outputPath):
-            print "\nOutputPath: ", self.outputPath, "already exists!"
-            if self.doAccumulate and False:
-                print "exiting..."
-                sys.exit()
-            else:
-                print "continuing..."
-        else:
-            os.makedirs(self.outputPath)
-            #os.makedirs(self.outputPath+"/MuonAlignExample")
-
-        #copy authentication.xml since job cannot read it via afs
-        if self.runMode=='sge' :            
-            shutil.copy(os.environ['CORAL_AUTH_PATH']+'/authentication.xml',
-                        self.outputPath)
-
-        #copy PoolFileCatalog
-        #shutil.copy("PoolFileCatalog.xml",self.outputPath)
-
-        #copy joboptions
-        cwd=os.getcwd()
-        files=glob.glob(cwd+'/*py')
-        print "\ncopying files to ",self.outputPath
-        for file in files:
-            print " ...",file
-            #shutil.copy(file,self.outputPath+"/MuonAlignExample")
-            shutil.copy(file,self.outputPath)
-        print "\n"
-        if self.inputAsztFile!="":
-            shutil.copy(self.inputAsztFile,self.outputPath)
-        
-        #shutil.copy(self.alignJobOptions,self.outputPath)
-        #shutil.copy(self.solveJobOptions,self.outputPath)
-        if self.errorScaleDb!='':
-            print "copying ",self.errorScaleDb," to ",self.outputPath
-            shutil.copy(self.errorScaleDb,self.outputPath)
-        return
-
-    def getPath(self,path):
-        if len(path)>0 and not path.endswith("/"):
-            path += "/"
-        elif len(path)==0:
-            path = "./"
-        return path
-    
-    def checkRunMode(self):
-        print "in checkRunMode"
-        if self.runMode == 'sge':
-            print " -> Algorithm will run in SGE batch"
-        elif self.runMode == 'pbs':
-            print " -> Algorithm will run in Torque/PBS batch"
-        elif self.runMode == 'lxbatch':
-            print " -> Algorithm will run in lxbatch"
-        elif self.runMode == 'local':
-            print " -> Algorithm will run on local machine"
-        elif self.runMode == 'pathena':
-            print " -> Algorithm will run in pathena"
-        elif self.runMode == 'prun':
-            print " -> Algorithm will run with prun"
-        else:
-            print " -> runMode ",self.runMode," not implemented yet, exiting..."
-            sys.exit()
-            
-        #if runMode=="local" check if number of jobs exceeds number of cpus available 
-        #if self.runMode == 'local':
-        #    nLocalCPUs = os.sysconf("SC_NPROCESSORS_ONLN")
-        #    if isinstance(nLocalCPUs, int)\
-        #           and nLocalCPUs>0 and self.nCPUs > nLocalCPUs: 
-        #        print "More jobs assigned than CPUs available on local machine",\
-        #              "(%d), exiting..." % nLocalCPUs
-        #        sys.exit()
-
-        #disable solving when running only a single job since no matrices have to be combined
-        if self.nCPUs==1 and self.runMode!='pathena' and self.runMode!='prun' \
-                and self.doSolve:
-            self.doSolve=False
-            print "Disabling solving. For a single job no matrices have to be combined."
-
-        #zip logfiles when running on batch
-        if self.runMode != 'local' and self.runMode != 'pathena' and self.runMode != 'prun':
-            self.zipLogFiles = True
-        return
-
-
-    def getJobLists(self) :
-        
-        if self.runMode == 'local':
-            jobList = LocalJobList(self.nCPUs) 
-        elif self.runMode == 'sge':
-            jobList = SgeJobList(self.queue)
-        elif self.runMode == 'pbs':
-            jobList = PbsJobList(self.queue) 
-        elif self.runMode == 'lxbatch':
-            jobList = LxbatchJobList(self.queue)
-        elif self.runMode == 'pathena' or self.runMode == 'prun':
-            doPrun = (self.runMode=='prun')
-            jobList = PathenaJobList(doPrun)
-
-        if self.runMode != 'local' and self.solveLocally:
-            solveJobList = LocalJobList(self.nCPUs)
-        else:
-            solveJobList = jobList
-
-        return jobList,solveJobList
-
-    def getString(self,iteration,index) :
-        retstring = ""
-        if iteration>-1:
-            retstring += "_iter"+str(iteration)
-        #if self.runMode != 'pathena' :
-        #    if str(index) == "*":
-        #        retstring += "_index*"
-        #    elif index>-1:
-        #        retstring += "_index"+str(index)
-        if str(index) == "*":
-            retstring += "_index*"
-        elif index>-1:
-            retstring += "_index"+str(index)
-        return retstring
-
-    def getPath(self,path):
-        if len(path)>0 and not path.endswith("/"):
-            path += "/"
-        elif len(path)==0:
-            path = "./"
-        return path
-
-
-    def processAccumulateJobs(self,iter,accumJobList) :
-
-        print "in processAccumulateJobs"
-
-        scriptWriter=ScriptWriter(self,iter)
-
-        njobs = self.nCPUs
-        if self.runMode == 'pathena' or self.runMode == 'prun' :
-            njobs = 1
-        print "njobs: ",njobs,"\n"
-
-        for j in range(0, njobs):
-            print "  job: ",j,"\n"
-
-            if njobs == 1:
-                iCPU = -1
-            else:
-                iCPU = j
-
-            #if not self.doAccumulate:
-            #if j == 0:
-            #    print "Skip Accumulation Iter"+repr(iter)
-            #continue
-        
-            #write the joboption file which handles the inputfiles of the job
-            if self.files==NotImplemented:
-                print "files not set!"
-                sys.exit(89)
-            inputDataMap = self.files.writeFile(self,iCPU,scriptWriter.ScriptDir)
-            if not inputDataMap:
-                print "  No input files in list for this job, continue with next job."
-                continue
-            if inputDataMap.find("/") != -1:
-                inputDataMap = inputDataMap.rsplit("/",1)[1]
-
-            print "inputDataMap:", inputDataMap
-
-            #-------------------------    
-            #-- write run script
-            #-------------------------   
-            jobrunscript=scriptWriter.runScript(self,iter,j,iCPU,accumJobList,inputDataMap)
-
-            #-------------------------    
-            #-- process jobs
-            #-------------------------
-            #if self.doAccumulate:
-            batchLogFile = scriptWriter.LogDir + scriptWriter.JobName + '.batchlog'
-            if ((self.runMode=='pathena' or self.runMode=='prun') and self.resumePathenaJob):
-                print "not running accumJob because resumePathenaJob==True"
-            else:
-                print "starting accumJob"
-                accumJobList.process(jobrunscript,batchLogFile)
-
-            #-------------------------    
-            #-- wait for jobs to finish and solve
-            #-------------------------    
-        print "\nWaiting for jobs to finish"
-        #if not self.doAccumulate:
-        scriptWriter.setCPU(iter,-1)
-        batchLogFile = scriptWriter.LogDir + scriptWriter.JobName + '.batchlog'
-        accumJobList.wait(batchLogFile)
-        print "jobs done"
-
-        return
-
-    def checkAccumulateJobs(self,iter,accumJobList) :
-        #-------------------------    
-        #-- check all jobs finished successfully             
-        #-------------------------    
-        
-        scriptWriter=ScriptWriter(self,iter)
-        
-        #loop over Jobs/CPUs
-        njobs = self.nCPUs
-        reprocessing = True
-        while reprocessing :
-            reprocessing = False
-            for j in range(0, njobs):
-                if njobs == 1:
-                    iCPU = -1
-                    AsztOutputDir = scriptWriter.IterPath
-                else:
-                    iCPU = j
-                    AsztOutputDir = scriptWriter.LogDir
-
-                if not self.doAccumulate:
-                  continue
-
-                scriptWriter.setCPU(iter,iCPU)
-                logFile=scriptWriter.LogDir + scriptWriter.JobName + '.log'
-                if accumJobList.check(logFile):
-                    continue
-                        
-                print "job ",iCPU," failed, resubmitting"
-        
-                #write the joboption file and run script
-                inputDataMap = self.files.writeFile(self,iCPU,scriptWriter.ScriptDir)
-                if not inputDataMap:
-                    print "  No input files in list for this job, continue with next job."
-                    continue
-                if inputDataMap.find("/") != -1:
-                    inputDataMap = inputDataMap.rsplit("/",1)[1]
-                    jobrunscript=scriptWriter.runScript(self,iter,j,iCPU,accumJobList,inputDataMap)
-                  
-                #-------------------------    
-                #-- reprocess jobs
-                #-------------------------
-                batchLogFile = scriptWriter.LogDir + scriptWriter.JobName + '.batchlog'
-                if ((self.runMode=='pathena' or self.runMode=='prun') \
-                        and self.resumePathenaJob):
-                    print "not running accumJob because resumePathenaJob==True"
-                else:
-                    print "starting accumJob"
-                    accumJobList.process(jobrunscript,batchLogFile)
-                    reprocessing = True
-
-            if reprocessing:
-                print "Waiting for resubmitted jobs to finish"
-                accumJobList.wait(batchLogFile)
-
-        return
-
-
-    def processSolveJob(self,iter,solveJobList) :
-
-        scriptWriter=ScriptWriter(self,iter)
-
-        scriptWriter.setSolve()
-
-        # the input files aren't needed for solving, but it's easier to configure as for 
-        # a normal job so the conditions database is configured properly
-        inputDataMap = self.files.writeFile(self,-1,scriptWriter.ScriptDir)
-        if not inputDataMap:
-            if self.runMode=='local':
-                print self.fileList.inputPaths
-            print "  No input fileSs in list for this job!"
-        if inputDataMap.find("/") != -1:
-            inputDataMap = inputDataMap.rsplit("/",1)[1]
-
-        jobrunscript=scriptWriter.solveScript(self,iter,solveJobList,inputDataMap)
-        batchLogFile = scriptWriter.LogDir + scriptWriter.JobName + '.batchlog'
-
-        print "starting solving job"
-        solveJobList.process(jobrunscript,batchLogFile)
-
-        print "Waiting for solving job to finish"
-        solveJobList.wait(batchLogFile)       
-
-
-class Flags():
-    """Class to contain flags passed to athena job."""
-
-    def __init__ (self):
-        self.errorScaleDb  = ""
-        self.alignmentJob  = ""
-        self.doEndcapOnly  = False
-        self.doBarrelOnly  = False
-        self.readEventList = False
-        self.nEventsPerJob = -1
-        self.skipEvents    = 0
-        self.iteration     = 0
-        self.tag           = ""
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/GenAlignIterator.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/GenAlignIterator.py
deleted file mode 100755
index 90c87dbac4a..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/GenAlignIterator.py
+++ /dev/null
@@ -1,86 +0,0 @@
-import os
-import sys
-import shutil
-import commands
-
-from MuonAlignExample.GlobalChi2Align_IteratorClasses import GlobalChi2AlignIterator
-from MuonAlignExample.GlobalChi2Align_MonitorClasses  import GlobalChi2Plotter
-from MuonAlignExample.GlobalChi2Align_MonitorClasses  import TrendPlotter
-
-
-#---------------------------
-# Non-Default Data Examples
-#---------------------------
-from MuonAlignExample.DefaultFiles import DefaultFiles
-#myfiles = DefaultFiles.manualFile(['/data.old/data10_7TeV.00152221.physics_MuonswBeam.merge.DESD_SGLMU.f238_m428','/data.old/data10_7TeV.00153565.physics_MuonswBeam.merge.DESD_SGLMU.f251_m467'],"terrier09","ESD","ATLAS-GEO-10-00-00","COMCOND-ES1PST-002-00","data10_7TeV.0015221.physics_MuonswBeam.merge.DESD_SGLMU.f238_m428")
-#myfiles = DefaultFiles.default('15GeV_data','files')
-myfiles = DefaultFiles.default('SGLMU_repro09_v01_data','files')
-#myfiles = DefaultFiles.manualFile(["/tmp/roberth/group.perf-muons.00165591.physics_Muons.reco.TMU15GEV.20101116.s1_ESD"],'','ESD','','',840,'group.det-muon*physics_Muons.reco.20101119_EEalign_V6_ESD') 
-
-#-------------------------
-# Set iterator job flags
-#-------------------------
-iterator = GlobalChi2AlignIterator(logfile='joblog.txt')
-iterator.readEventList    = False
-iterator.files            = myfiles
-iterator.runargsJobOption = "runargs.ESDtoESD.py"
-iterator.doAccumulate     = True 
-iterator.doSolve          = True
-iterator.runMode          = 'local' #local, sge, lxbatch, pathena
-iterator.runLocation      = 'lxplus' # bnl,lxplus
-iterator.dataType         = 'data'# MC,cosmic,data
-iterator.MCmomentum       = 20
-iterator.resumePathenaJob = False 
-iterator.rootName         = 'L1_1file_noscat'
-iterator.inputAsztFile    = '' # use for L3 only
-iterator.asztRootName     = ''
-iterator.doMonitoring     = False
-iterator.outputDatasetDef = '' 
-#iterator.site             = 'ANALY_BNL_ATLAS_1'
-iterator.site             = ''
-iterator.solveLocally     = True
-iterator.alignmentLevel   = 'L1'
-iterator.alignmentJob     = 'L1_MSID' # L3Mdt, L1_MSID, L3CSC
-iterator.doEndcapOnly     = False
-iterator.doBarrelOnly     = False
-iterator.nEventsPerJob    = -1 
-iterator.nFilesPerJob     = 5
-#iterator.nFilesPerJob     = 10
-#iterator.skipEvents       = 132
-iterator.nCPUs            = 1 
-iterator.errorScaleDb     = ''
-iterator.tag              = '' #"NLooseMuon>0 && fabs(LooseMuonPt1)/1000>6 && fabs(LooseMuonEta1)>1 && LooseMuonMDTHits1>12 && (LooseMuonTGCHits1>0 || LooseMuonRPCHits1>0)"
-
-iterator.firstIteration   = 2
-iterator.iterations       = 1
-
-iterator.configRunMode()
-
-iterator.run()
-
-#-------------------------
-# Monitoring here
-#-------------------------
-if iterator.doMonitoring:
-    scriptPath = currentPath+"/scripts"
-    outputPath = iterator.outputPath+"/pics"
-
-    globchi2plot = GlobalChi2Plotter(scriptPath)
-    globchi2plot.inputPath     = iterator.outputPath
-    globchi2plot.outputPath    = outputPath
-    globchi2plot.rootName      = iterator.rootName 
-    globchi2plot.absoluteLines = True
-    for i in range(iterator.firstIteration,
-                   iterator.firstIteration+iterator.iterations):
-        globchi2plot.iteration = i
-        globchi2plot.run()
-
-    if iterator.iterations>1 or iterator.firstIteration != 0:
-        trendplot = TrendPlotter(scriptPath)
-        trendplot.inputPath    = iterator.outputPath
-        trendplot.outputPath   = outputPath
-        trendplot.rootName     = iterator.rootName 
-        trendplot.drawErrors   = True
-        trendplot.combineTower = False
-        trendplot.run()
- 
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/GenAlignIteratorBatch.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/GenAlignIteratorBatch.py
deleted file mode 100755
index 4ea8da009a7..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/GenAlignIteratorBatch.py
+++ /dev/null
@@ -1,89 +0,0 @@
-import os
-import sys
-import shutil
-import commands
-
-from MuonAlignExample.GlobalChi2Align_IteratorClasses import GlobalChi2AlignIterator
-from MuonAlignExample.GlobalChi2Align_MonitorClasses  import GlobalChi2Plotter
-from MuonAlignExample.GlobalChi2Align_MonitorClasses  import TrendPlotter
-
-
-#---------------------------
-# Non-Default Data Examples
-#---------------------------
-from MuonAlignExample.DefaultFiles import DefaultFiles
-#myfiles = DefaultFiles.manualFile(['/data.old/data10_7TeV.00152221.physics_MuonswBeam.merge.DESD_SGLMU.f238_m428','/data.old/data10_7TeV.00153565.physics_MuonswBeam.merge.DESD_SGLMU.f251_m467'],"terrier09","ESD","ATLAS-GEO-10-00-00","COMCOND-ES1PST-002-00","data10_7TeV.0015221.physics_MuonswBeam.merge.DESD_SGLMU.f238_m428")
-#myfiles = DefaultFiles.default('15GeV_data','dataset')
-myfiles = DefaultFiles.manualFile(["/tmp/roberth/group.perf-muons.00165591.physics_Muons.reco.TMU15GEV.20101116.s1_ESD"],'','ESD','','',840,'group.det-muon.data11_7TeV*physics_Muons.*.reco.20110609_ESD') 
-
-#-------------------------
-# Set iterator job flags
-#-------------------------
-iterator = GlobalChi2AlignIterator(logfile='joblog.txt')
-iterator.readEventList    = False 
-iterator.files            = myfiles
-iterator.runargsJobOption = "runargs.ESDtoESD.py"
-iterator.doAccumulate     = True
-iterator.doSolve          = True
-iterator.runMode          = 'pathena' #local, sge, lxbatch, pathena, prun
-iterator.runLocation      = 'lxplus' # bnl,lxplus
-iterator.dataType         = 'data'# MC,cosmic,data
-iterator.MCmomentum       = 20
-iterator.resumePathenaJob = False 
-iterator.rootName         = 'L3_ZMUMUskim_data_batch_EE-BIS8'
-iterator.inputAsztFile    = ''
-iterator.asztRootName     = ''
-iterator.doMonitoring     = False
-#iterator.libDS            = "user.roberth.0610193906.769101.lib._001050"
-iterator.libDS            = ""
-iterator.official         = True
-iterator.outputDatasetDef = "group.det-muon.ZMUMU.20110609_EE-BIS8_iter0_V25"
-#iterator.outputDatasetDef = "group.det-muon.TMU15GEV.20101116_EE_iter3_V14"
-#iterator.site             = 'ANALY_BNL_ATLAS_1'
-iterator.site             = ''
-iterator.solveLocally     = True
-iterator.alignmentLevel   = 'L3'
-iterator.alignmentJob     = 'L3Mdt_muidSA' # L3Mdt, L1_MSID, L3CSC
-iterator.doEndcapOnly     = False 
-iterator.doBarrelOnly     = False
-iterator.nEventsPerJob    = -1 
-iterator.nFilesPerJob     = 5
-#iterator.nFilesPerJob     = 10
-iterator.skipEvents       = 0 
-iterator.errorScaleDb     = ''
-iterator.tag              = '' #"NLooseMuon>0 && fabs(LooseMuonPt1)/1000>6 && fabs(LooseMuonEta1)>1 && LooseMuonMDTHits1>12 && (LooseMuonTGCHits1>0 || LooseMuonRPCHits1>0)"
-#iterator.noBuild          = True
-#iterator.inTarBall        = ""
-#iterator.outTarBall       = "EE-BIS8_V14
-iterator.firstIteration   = 0 
-iterator.iterations       = 1
-
-iterator.configRunMode()
-iterator.run()
-
-#-------------------------
-# Monitoring here
-#-------------------------
-if iterator.doMonitoring:
-    scriptPath = currentPath+"/scripts"
-    outputPath = iterator.outputPath+"/pics"
-
-    globchi2plot = GlobalChi2Plotter(scriptPath)
-    globchi2plot.inputPath     = iterator.outputPath
-    globchi2plot.outputPath    = outputPath
-    globchi2plot.rootName      = iterator.rootName 
-    globchi2plot.absoluteLines = True
-    for i in range(iterator.firstIteration,
-                   iterator.firstIteration+iterator.iterations):
-        globchi2plot.iteration = i
-        globchi2plot.run()
-
-    if iterator.iterations>1 or iterator.firstIteration != 0:
-        trendplot = TrendPlotter(scriptPath)
-        trendplot.inputPath    = iterator.outputPath
-        trendplot.outputPath   = outputPath
-        trendplot.rootName     = iterator.rootName 
-        trendplot.drawErrors   = True
-        trendplot.combineTower = False
-        trendplot.run()
- 
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L1_MSID_Flags.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L1_MSID_Flags.py
deleted file mode 100644
index 4bf44d9fa21..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L1_MSID_Flags.py
+++ /dev/null
@@ -1,94 +0,0 @@
-
-# set up flags for L1 MDT endcap alignment
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-try:
-    doVP1
-    #rec.doVP1=doVP1
-except:
-    rec.doVP1=False
-
-if 'iteration' in dir():
-    align.iteration = int(iteration)
-else:
-    align.iteration = 0
-
-if 'readEventList' in dir():
-    align.readEventList=readEventList
-
-if 'inputMatrixFiles' in dir():
-    align.inputMatrixFiles=inputMatrixFiles
-
-if 'inputVectorFiles' in dir():
-    align.inputVectorFiles=inputVectorFiles
-
-if 'inputHitmapFiles' in dir():
-    align.inputHitmapFiles=inputHitmapFiles
-
-if 'jobIndex' in dir():
-    align.jobIndex = int(jobIndex)
-else:
-    align.jobIndex = -1
-
-if 'solveOnly' in dir():
-    align.solveOnly = solveOnly    
-
-align.OutputLevel             = INFO 
-align.derivativeType          = 'Analytical' # be careful... I think this is overwritten later
-
-#align.fitterType              = "iPat"
-#align.particleNumber          = 0 # non-interacting so iPat doesn't add material
-#mualign.resetScatteringAngles = True
-
-align.fitterType              = "CombMuonTrackFitter"
-align.particleNumber          = 2 # muon so MCTB will work ok with scattering already on track
-mualign.resetScatteringAngles = False
-
-mualign.trackCollectionProvider = "MuonTrackCollectionProvider"
-mualign.MuonContainerName       = "MuidMuonCollection"
-mualign.useStandaloneTracks     = False
-
-mualign.asztFilePath          = './'
-
-mualign.modulesToAlign  = ['ECA']
-mualign.jobType               = 'ECmisal'
-mualign.endcapsToAlign        = 'A' # A-side only 
-mualign.doMultiLevelAlignment = True
-mualign.requireOneHitPerTubeLayerEC = True 
-#mualign.declusterTGCHits      = False
-
-readESD=rec.readESD
-mualign.setDefaultRecoFlags(readESD)
-mualign.setDefaultL1Flags()
-if align.derivativeType=='Analytical':
-  mualign.setDefaultAnalyticalDerivativeFlags()
-else:
-  mualign.setDefaultShiftingDerivativeFlags()
-mualign.setDefaultMatrixSolvingFlags()
-
-mualign.useFullReco = True
-#mualign.mdtAlignParams=[0,1,2,3,4]
-#mualign.xyRotZPosition = 5700.
-mualign.xyRotZPosition = 0.
-
-mualign.applySelectionCuts = False 
-
-#mualign.doLocalErrorScaling = doLocalErrorScaling
-if 'readEventList' in dir():
-    align.readEventList=readEventList
-
-if 'rootName' in dir():
-    align.fileRootName = rootName
-    align.fileRootName.lock()
-
-if 'isBatch' in dir():
-    align.outputPath = ""
-    align.outputPath.lock()
-    mualign.asztFilePath = ""
-    mualign.asztFilePath.lock()
-    mualign.initialAsztFilePath = ""
-
-#if iteration>0:
-#  align.readEventList = True
-#  align.writeEventList = False
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L23MdtFlags.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L23MdtFlags.py
deleted file mode 100644
index ef4e20ff272..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L23MdtFlags.py
+++ /dev/null
@@ -1,98 +0,0 @@
-
-# setup flags for L3 MDT endcap alignment
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-# set up alignment flags
-if 'iteration' in dir():
-    align.iteration = int(iteration)
-else:
-    align.iteration = 0
-
-#if 'readEventList' in dir():
-#    align.readEventList=readEventList
-
-if 'inputMatrixFiles' in dir():
-    align.inputMatrixFiles=inputMatrixFiles
-
-if 'inputVectorFiles' in dir():
-    align.inputVectorFiles=inputVectorFiles
-
-if 'inputHitmapFiles' in dir():
-    align.inputHitmapFiles=inputHitmapFiles
-
-if 'solveOnly' in dir():
-    align.solveOnly = solveOnly    
-  
-#align.OutputLevel             = VERBOSE
-align.OutputLevel             = DEBUG
-#align.OutputLevel             = INFO
-align.derivativeType          = 'Numerical' # be careful... I think this is overwritten later
-
-align.particleNumber          = 2 # muon
-
-align.fitterType              = "MCTB"
-
-mualign.trackCollectionProvider = "TrackCollectionProvider"
-mualign.MuonContainerName       = "MooreTracks"
-
-mualign.jobType               = 'Barrel'
-
-mualign.setDefaultRecoFlags()
-mualign.setDefaultL23Flags()
-mualign.setDefaultMatrixSolvingFlags()
-
-if align.derivativeType=='Analytical':
-    mualign.setDefaultAnalyticalDerivativeFlags()
-else:
-    mualign.setDefaultShiftingDerivativeFlags()  
-
-if 'doBarrelOnly' in dir() and doBarrelOnly:
-    mualign.modulesToAlign = ["SectorA4_I","SectorA4_M","SectorA4_O"]
-    #mualign.modulesToAlign = ["SectorA5"]
-    #mualign.chamberSelectionString = "[B?S, 2, 2]"
-else:
-    print "L23 not implemented for Endcap."
-    sys.exit();
-
-mualign.doMultiLevelAlignment = True
-mualign.doModuleSelection = True
-mualign.useFullReco = False
-#mualign.useAlternateASZT  = True
-#mualign.alignParams = [1,2]
-
-#SelectionCuts:
-mualign.applySelectionCuts = True
-mualign.requireRPCPhiHit = True
-mualign.removeRPCEtaHits = True
-mualign.cutOnNumHolesOnTrack=-1
-mualign.cutOnNumOutlierOnTrack=-1
-mualign.requireSmallLargeOverlap = True
-
-if 'rootName' in dir():
-    align.fileRootName = rootName
-    align.fileRootName.lock()
-
-if 'isBatch' in dir():
-    align.outputPath = ""
-    align.outputPath.lock()
-    mualign.asztFilePath = ""
-    mualign.asztFilePath.lock()
-    mualign.initialAsztFilePath = ""
-
-if align.iteration>0:
-    align.readEventList = True
-    align.writeEventList = False
-
-def doSetup():
-    print "in setup method"
-    dresser = topSequence.AlignAlg.AlignTrackDresser
-    creator = topSequence.AlignAlg.AlignTrackCreator
-    dresser.OutputLevel = INFO
-    creator.OutputLevel = INFO
-    preprocessor = topSequence.AlignAlg.AlignTrackPreProcessor
-    #preprocessor.RemoveRPCEtaHits = True
-    #preprocessor.RequireRPCPhiHit = True
-    #preprocessor.RequireSmallLargeOverlap=True
-    print preprocessor
-    
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3CSCFlags.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3CSCFlags.py
deleted file mode 100644
index 5f79360d36d..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3CSCFlags.py
+++ /dev/null
@@ -1,67 +0,0 @@
-
-# setup flags for L3 MDT endcap alignment
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-# set up alignment flags
-if 'iteration' in dir():
-    align.iteration = int(iteration)
-else:
-    align.iteration = 0
-
-if 'readEventList' in dir():
-    align.readEventList=readEventList
-
-if 'inputMatrixFiles' in dir():
-    align.inputMatrixFiles=inputMatrixFiles
-
-if 'inputVectorFiles' in dir():
-    align.inputVectorFiles=inputVectorFiles
-
-if 'inputHitmapFiles' in dir():
-    align.inputHitmapFiles=inputHitmapFiles
-
-if 'solveOnly' in dir():
-    align.solveOnly = solveOnly    
-
-align.OutputLevel             = DEBUG
-
-align.derivativeType          = 'Analytical' # be careful... I think this is overwritten later
-
-align.particleNumber          = 2 # muon
-
-align.fitterType              = "MCTB"
-
-mualign.trackCollectionProvider = "MuonTrackCollectionProvider"
-mualign.MuonContainerName       = "MuidMuonCollection"
-mualign.useStandaloneTracks     = False
-
-mualign.jobType               = 'EC'
-mualign.endcapsToAlign        = 'A' # A-side only
-mualign.doModuleSelection     = True
-mualign.doMultiLevelAlignment = False
-
-#mualign.setDefaultRecoFlags()
-mualign.setDefaultAnalyticalDerivativeFlags()
-mualign.setDefaultCscL3Flags()
-mualign.setDefaultMatrixSolvingFlags()
-
-#mualign.chamberSelectionString = "[EIL]"
-#mualign.chamberSelectionString = "[EI?,5]"
-#mualign.chamberSelectionString = "[BI?]"
-mualign.useFullReco = False
-
-if 'rootName' in dir():
-    align.fileRootName = rootName
-    align.fileRootName.lock()
-
-if 'isBatch' in dir():
-    align.outputPath = ""
-    align.outputPath.lock()
-    mualign.asztFilePath = ""
-    mualign.asztFilePath.lock()
-    mualign.initialAsztFilePath = ""
-
-if align.iteration>0:
-    align.readEventList = True
-    align.writeEventList = False
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3MdtFlags.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3MdtFlags.py
deleted file mode 100644
index 77bd7021ee9..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3MdtFlags.py
+++ /dev/null
@@ -1,100 +0,0 @@
-
-# setup flags for L3 MDT endcap alignment
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-# set up alignment flags
-if 'iteration' in dir():
-    align.iteration = int(iteration)
-else:
-    align.iteration = 0
-
-if 'readEventList' in dir():
-    align.readEventList=readEventList
-
-if 'inputMatrixFiles' in dir():
-    align.inputMatrixFiles=inputMatrixFiles
-
-if 'inputVectorFiles' in dir():
-    align.inputVectorFiles=inputVectorFiles
-
-if 'inputHitmapFiles' in dir():
-    align.inputHitmapFiles=inputHitmapFiles
-
-if 'solveOnly' in dir():
-    align.solveOnly = solveOnly    
-  
-align.OutputLevel             = INFO 
-align.derivativeType          = 'Analytical' # be careful... I think this is overwritten later
-#align.doVP1=True
-
-align.particleNumber          = 2 # muon
-
-align.fitterType              = "MCTB"
-
-align.writeNtuple = True 
-align.dataType = 'data' 
-
-mualign.trackCollectionProvider = "TrackCollectionProvider"
-mualign.MuonContainerName       = "MooreTracks"
-mualign.inputIDTrackCol         = ""
-
-mualign.jobType               = ''
-mualign.endcapsToAlign        = 'BOTH'
-mualign.alignCSC              = True
-
-mualign.useAlternateASZT = False
-if align.iteration==0:
-  mualign.doMultiLevelAlignment = False
-else:
-  mualign.doMultiLevelAlignment = True
-
-#from RecExConfig.RecFlags import rec
-#readESD=rec.readESD
-#print "readESD=",readESD
-#mualign.setDefaultRecoFlags(readESD)
-mualign.setDefaultRecoFlags()
-#mualign.setDefaultShiftingDerivativeFlags()
-mualign.setDefaultL3Flags()
-if align.derivativeType=='Analytical':
-  mualign.setDefaultAnalyticalDerivativeFlags()
-mualign.setDefaultMatrixSolvingFlags()
-
-if 'doBarrelOnly' in dir() and doBarrelOnly:
-  mualign.chamberSelectionString = "[BIL]"
-else:
-  #mualign.chamberSelectionString = "[EML,2,3]"
-  #mualign.chamberSelectionString = "[E?L,2,1-99]"
-  #mualign.chamberSelectionString = "[E??]"
-  mualign.redoErrorScaling = False
-  #mualign.removeBEEHits = False
-  #mualign.removeEEHits = False
-  mualign.removeCSCHits = False
-  mualign.removeBarrelHits = False
-  mualign.removeEndcapHits = False
-  mualign.pTCorrectTrack = False
-  #mualign.chamberSelectionString = "[EIS,8,-2]"
-  mualign.chamberSelectionString = "[BEE] | [EEL]"
-
-#mualign.moduleSelectionString = "[EI?,5]"
-#mualign.moduleSelectionString = "[BI?]"
-
-mualign.doModuleSelection = True
-
-mualign.useFullReco = False
-
-if 'rootName' in dir():
-    align.fileRootName = rootName
-    align.fileRootName.lock()
-
-if 'isBatch' in dir():
-    align.outputPath = ""
-    align.outputPath.lock()
-    mualign.asztFilePath = ""
-    mualign.asztFilePath.lock()
-    mualign.initialAsztFilePath = ""
-
-if align.iteration>0:
-    align.readEventList = True
-    align.eventList = "goodEvts_iter0.txt" 
-#    align.writeEventList = False
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3MdtFlags_muidSA.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3MdtFlags_muidSA.py
deleted file mode 100644
index 5dd7db1ff61..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/L3MdtFlags_muidSA.py
+++ /dev/null
@@ -1,105 +0,0 @@
-
-# setup flags for L3 MDT endcap alignment
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-# set up alignment flags
-if 'iteration' in dir():
-    align.iteration = int(iteration)
-else:
-    align.iteration = 0
-
-if 'readEventList' in dir():
-    align.readEventList=readEventList
-
-if 'inputMatrixFiles' in dir():
-    align.inputMatrixFiles=inputMatrixFiles
-
-if 'inputVectorFiles' in dir():
-    align.inputVectorFiles=inputVectorFiles
-
-if 'inputHitmapFiles' in dir():
-    align.inputHitmapFiles=inputHitmapFiles
-
-if 'solveOnly' in dir():
-    align.solveOnly = solveOnly    
-  
-align.OutputLevel             = DEBUG 
-align.derivativeType          = 'Analytical' # be careful... I think this is overwritten later
-#align.doVP1=True
-
-align.particleNumber          = 2 # muon
-
-align.fitterType              = "MCTB"
-
-align.writeNtuple = True 
-align.dataType = 'data' 
-
-mualign.trackCollectionProvider = "MuonTrackCollectionProvider"
-mualign.MuonContainerName       = "MuidESDMuonCollection"
-mualign.inputIDTrackCol         = ""
-mualign.useStandaloneTracks     = True
-mualign.inputTrackCollectionType = 0
-
-mualign.jobType               = ''
-mualign.endcapsToAlign        = 'BOTH'
-mualign.alignCSC              = True
-
-mualign.useAlternateASZT = False
-if align.iteration==0:
-  mualign.doMultiLevelAlignment = False
-else:
-  mualign.doMultiLevelAlignment = True
-
-#from RecExConfig.RecFlags import rec
-#readESD=rec.readESD
-#print "readESD=",readESD
-#mualign.setDefaultRecoFlags(readESD)
-mualign.setDefaultRecoFlags()
-#mualign.setDefaultShiftingDerivativeFlags()
-mualign.setDefaultL3Flags()
-if align.derivativeType=='Analytical':
-  mualign.setDefaultAnalyticalDerivativeFlags()
-mualign.setDefaultMatrixSolvingFlags()
-
-if 'doBarrelOnly' in dir() and doBarrelOnly:
-  mualign.chamberSelectionString = "[BIL]"
-else:
-  #mualign.chamberSelectionString = "[EML,2,3]"
-  #mualign.chamberSelectionString = "[E?L,2,1-99]"
-  #mualign.chamberSelectionString = "[E??]"
-  mualign.redoErrorScaling = False
-  mualign.removeBIS8Hits = False
-  mualign.removeBEEHits = False
-  mualign.removeEEHits = False
-  mualign.removeCSCHits = False
-  mualign.removeBarrelHits = True 
-  mualign.removeEndcapHits = False
-  mualign.removeTGCEtaHits = True
-  mualign.pTCorrectTrack = False
-  #mualign.chamberSelectionString = "[EIS,8,-2]"
-  mualign.chamberSelectionString = "[BEE] | [EEL] | [BIS,,-8 8]"
-  #mualign.chamberSelectionString = "[BIS,,-8 8]"
-
-#mualign.moduleSelectionString = "[EI?,5]"
-#mualign.moduleSelectionString = "[BI?]"
-
-mualign.doModuleSelection = True
-
-mualign.useFullReco = False
-
-if 'rootName' in dir():
-    align.fileRootName = rootName
-    align.fileRootName.lock()
-
-if 'isBatch' in dir():
-    align.outputPath = ""
-    align.outputPath.lock()
-    mualign.asztFilePath = ""
-    mualign.asztFilePath.lock()
-    mualign.initialAsztFilePath = ""
-
-if align.iteration>0:
-    #align.readEventList = True
-    align.eventList = "goodEvts_iter0.txt" 
-    align.writeEventList = False
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/MuonAlignment.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/MuonAlignment.py
index fb3debd9321..f0bc736841f 100644
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/MuonAlignment.py
+++ b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/MuonAlignment.py
@@ -1,15 +1,9 @@
 import os
 
 from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
 from AthenaCommon.Constants import *
 from AthenaCommon.AppMgr import ToolSvc
 
-# configure muon alignment
-from MuonAlignGenTools.ConfigureMuonAlignment import ConfigureMuonAlignment
-config = ConfigureMuonAlignment()
-config.configureAlignment(mualign.useAlternateASZT(),align.isMC())
-
 if align.readEventList() :
 
     from TrkAlignGenAlgs.SelectEventNumberGetter import SelectEventNumberGetter
@@ -19,7 +13,6 @@ if align.readEventList() :
     selectEvtNumber.EventList = align.eventList()
     #selectEvtNumber.EventList = "goodEvts.txt"
 
-#if mualign.doLocalErrorScaling:
 if 'errorScaleDb' in dir() and errorScaleDb!='':
     
     errScaleDbName=errorScaleDb
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/MuonStandalone.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/MuonStandalone.py
index a611cb02558..98df3d7d920 100644
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/MuonStandalone.py
+++ b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/MuonStandalone.py
@@ -21,5 +21,4 @@ import MuonRecExample.MuonRecStandaloneFlags
 # configure flags so that only Muon Standalone reco is run
 import MuonRecExample.MuonRecStandaloneOnlySetup
 
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-muonRecFlags.useAlignmentCorrections = mualign.useOpticalAlignment()
+muonRecFlags.useAlignmentCorrections = True
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/bfield_off.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/bfield_off.py
deleted file mode 100644
index 0acdc0d4ebc..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/bfield_off.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-mualign.trackCollectionProvider  = 'MuonTrackCollectionProvider'
-mualign.MuonContainerName        = "MuidMuonCollection"
-align.inputTrkCol                = "MooreTracks"
-mualign.inputIDTrackCol          = "Tracks"
-mualign.useStandaloneTracks      = True
-mualign.inputTrackCollectionType = 1 # MS standalone with ID track match
-mualign.momentumCut              = 4 
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/doBarrelOnly.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/doBarrelOnly.py
deleted file mode 100644
index d07e86ce9f8..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/doBarrelOnly.py
+++ /dev/null
@@ -1,4 +0,0 @@
-
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-mualign.doBarrel=True
-mualign.doEndcap=False
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/doEndcapOnly.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/doEndcapOnly.py
deleted file mode 100644
index d1d77928907..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/doEndcapOnly.py
+++ /dev/null
@@ -1,4 +0,0 @@
-
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-mualign.doBarrel=False
-mualign.doEndcap=True
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/runargs.ESDtoESD.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/runargs.ESDtoESD.py
deleted file mode 100644
index f223a1bf556..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/runargs.ESDtoESD.py
+++ /dev/null
@@ -1,213 +0,0 @@
-from MuonRecExample.MuonRecFlags import muonRecFlags
-from AthenaCommon.Constants import *
-
-# Choices for alignmentJob:
-#   'L3Mdt'
-#   'L1_MSID'
-#   'L3CSC'
-
-
-# the following defaults are set if global variables not already set
-try:
-  alignmentJob
-except:
-  alignmentJob  = "L3Mdt"
-
-try:
-  doEndcapOnly
-except:
-  doEndcapOnly  = True
-
-try:
-  doBarrelOnly
-except:
-  doBarrelOnly  = False
-
-try:
-  readEventList
-except:
-  readEventList = False
-
-try:
-  inputFile
-except:
-  inputFile=['/tmp/roberth/data11_7TeV.00191933.physics_Muons.merge.DESD_SGLMU.f415_m1026/data11_7TeV.00191933.physics_Muons.merge.DESD_SGLMU.f415_m1026._lb0205._0001.1']
-
-try:
-  maxEvents
-except:
-  maxEvents=-1
-
-try:
-  skipEvents
-except:
-  skipEvents=0
-
-try:
-  preIncludes 
-except:
-  preIncludes=[]
-
-try:
-  tag
-except:
-  tag=""
-
-try:
-  commissioning
-except:
-  commissioning=False
-
-###############################################
-#from AthenaCommon.GlobalFlags import GlobalFlags
-#GlobalFlags.DataSource.set_data()
-#GlobalFlags.DetGeo.set_atlas()
-
-  
-from RecExConfig.RecFlags     import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-if tag!="":
-  athenaCommonFlags.PoolInputQuery.set_Value_and_Lock(tag)
-  rec.readTAG.set_Value_and_Lock(True)
-  athenaCommonFlags.FilesInput = inputFile
-
-if inputFile[0].find('TMU15GEV.20101116')>-1:
-
-  MagFieldAthenaSvc = Service( "MagFieldAthenaSvc" );
-  svcMgr += MagFieldAthenaSvc
-  MagFieldAthenaSvc.NameOfTheSource = "BYPYTH"
-  MagFieldAthenaSvc.noTiltNoShift = 0
-  #MagFieldAthenaSvc.NameOfTheBfieldFile = "/afs/cern.ch/atlas/project/magfield/Map/AtlasFull/bmagatlas_09_fullAsym20400.data.bz2" 
-  MagFieldAthenaSvc.NameOfTheBfieldFile = "bmagatlas_09_fullAsym20400.data.bz2"
-
-  MagFieldAthenaSvc.SolenoidField = "map7730bes2.grid"
-  MagFieldAthenaSvc.dxsol     = 0.0
-  MagFieldAthenaSvc.dysol     = 1.6
-  MagFieldAthenaSvc.dzsol     = 0.0
-  MagFieldAthenaSvc.dthetasol = 0.0
-  MagFieldAthenaSvc.dphisol   = 0.0
-  MagFieldAthenaSvc.dpsisol   = 0.0
-
-
-rec.doESD.unlock()
-rec.doESD.set_Value_and_Lock(False)
-
-rec.Commissioning.set_Value_and_Lock(commissioning)
-
-rec.doCBNT.set_Value_and_Lock(False)
-rec.doDPD.set_Value_and_Lock(False)
-rec.doWriteTAG.set_Value_and_Lock(False)
-rec.doWriteESD.set_Value_and_Lock(True)
-rec.doMonitoring.set_Value_and_Lock(False)
-rec.doNameAuditor.set_Value_and_Lock(False)
-
-recAlgs.doMuGirl.set_Value_and_Lock(False)
-
-rec.doDumpProperties=True
-rec.doTrigger       =False
-rec.doAOD           =True
-
-rec.doPerfMon.set_Value_and_Lock(False)
-rec.doDetailedPerfMon.set_Value_and_Lock(False)
-rec.doSemiDetailedPerfMon.set_Value_and_Lock(False)
-
-#rec.doWriteAOD      =False
-#rec.doCalo          =False
-
-#rec.OutputLevel.set_Value_and_Lock(VERBOSE)
-
-#rec.doAODCaloCells.set_Value_and_Lock(False)
-#rec.doAODall.set_Value_and_Lock(False)
-#rec.doEgamma=False
-#from JetRec.JetRecFlags import jetFlags
-#jetFlags.Enabled=False
-
-#from AthenaCommon.DetFlags import DetFlags
-#DetFlags.Muon_setOn() 
-#if alignmentJob=="L1_MSID":
-#  DetFlags.ID_setOn()
-#if alignmentJob!="L3CSC":
-#  DetFlags.CSC_setOff()
-#  muonRecFlags.doCSCs.set_Value_and_Lock(False)
-#else:
-#  DetFlags.CSC_setOn()
-#  muonRecFlags.doCSCs.set_Value_and_Lock(True)
-
-#print "!!!!!!!!!!!!!!!!!!!!!!! (check for ID on/off) DetFlags: "
-#DetFlags.Print()
-
-from PyJobTransformsCore.runargs import RunArguments
-
-runArgs = RunArguments()
-
-runArgs.preExec = []
-
-# Maximum number of events to process
-runArgs.skipEvents = skipEvents
-runArgs.maxEvents  = maxEvents 
-
-# Input file that contains ESD's
-if tag=="":
-  runArgs.inputESDFile = inputFile
-
-runArgs.outputLevel = DEBUG
-
-# Output file that contains AOD's
-# runArgs.outputAODFile = '/tmp/roberth/AOD.pool.root'
-
-# List of strings separated by commas
-runArgs.autoConfiguration = ['everything']
-
-runArgs.preInclude=[]
-
-# jobOption to set alignment flags
-if alignmentJob=="L1_MSID":
-  runArgs.preInclude.append('MuonAlignExample/L1_MSID_Flags.py')
-
-elif alignmentJob=="L23Mdt":
-  runArgs.preInclude.append('MuonAlignExample/L23MdtFlags.py')
-  runArgs.preInclude.append('MuonAlignExample/MuonStandalone.py')
-
-elif alignmentJob=="L3Mdt":
-  runArgs.preInclude.append('MuonAlignExample/L3MdtFlags.py')
-#  runArgs.preInclude.append('MuonStandalone.py')
-
-elif alignmentJob=="L3Mdt_muidSA":
-  runArgs.preInclude.append('MuonAlignExample/L3MdtFlags_muidSA.py')
-
-elif alignmentJob=="L3CSC":
-  runArgs.preInclude.append('MuonAlignExample/L3CSCFlags.py')
-
-elif alignmentJob=="L3MdtToroidOff":
-  runArgs.preInclude.append('MuonAlignExample/L3MdtToroidOffFlags.py')
-
-else:
-  print "wrong alignmentJob!!!!!!!"
-  sys.exit(3)
-
-if doEndcapOnly:
-  runArgs.preInclude.append('MuonAlignExample/doEndcapOnly.py')
-
-if doBarrelOnly:
-  runArgs.preInclude.append('MuonAlignExample/doBarrelOnly.py')
-
-# option to read event list
-if readEventList:
-  runArgs.preInclude.append('MuonAlignExample/SelectEventNumber.py')
-
-if preIncludes!=[]:
-  for preInclude in preIncludes:
-    runArgs.preInclude.append(preInclude)
-
-runArgs.postInclude=['MuonAlignExample/MuonAlignment.py']
-
-excSvc=Service("ExceptionSvc")
-excSvc.Catch='NONE'
-excSvc.Errors='ALL'
-print excSvc
-
-include("RecJobTransforms/skeleton.ESDtoESD.py")
-#include("PATJobTransforms/skeleton.MergePool.py") 
-
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/runargs.RDOtoESD.py b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/runargs.RDOtoESD.py
deleted file mode 100644
index 1694f67edf1..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/runargs.RDOtoESD.py
+++ /dev/null
@@ -1,153 +0,0 @@
-from MuonRecExample.MuonRecFlags import muonRecFlags
-from AthenaCommon.Constants import *
-
-# Choices for alignmentJob:
-# 
-#   'L3Mdt'
-#   'L1_MSID'
-#   'L3CSC'
-
-# the following defaults are set if global variables not already set
-try:
-  alignmentJob
-except:
-  alignmentJob  = "L3Mdt"
-
-try:
-  doEndcapOnly
-except:
-  doEndcapOnly  = True
-
-try:
-  doBarrelOnly
-except:
-  doBarrelOnly  = False
-
-try:
-  readEventList
-except:
-  readEventList = False
-
-try:
-  inputFile
-except:
-  inputFile=['/tmp/roberth/CSC.20100624.singlepart_mu5GeV.50K.RDO.pool.root']
-
-try:
-  maxEvents
-except:
-  maxEvents=-1
-
-try:
-  skipEvents
-except:
-  skipEvents=0
-
-try:
-  preIncludes 
-except:
-  preIncludes=[]
-
-try:
-  tag
-except:
-  tag=""
-
-try:
-  commissioning
-except:
-  commissioning=False
-
-###############################################
-#from AthenaCommon.GlobalFlags import GlobalFlags
-#GlobalFlags.DataSource.set_data()
-#GlobalFlags.DetGeo.set_atlas()
-
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-
-rec.Commissioning.set_Value_and_Lock(commissioning)
-
-rec.doCBNT.set_Value_and_Lock(False)
-rec.doDPD.set_Value_and_Lock(False)
-rec.doWriteTAG.set_Value_and_Lock(False)
-rec.doWriteESD.set_Value_and_Lock(False)
-rec.doMonitoring.set_Value_and_Lock(False)
-rec.doNameAuditor.set_Value_and_Lock(False)
-
-recAlgs.doMuGirl.set_Value_and_Lock(False)
-
-rec.doDumpProperties=True
-rec.doTrigger       =False
-
-rec.doAOD           =True
-
-from PyJobTransformsCore.runargs import RunArguments
-
-runArgs = RunArguments()
-
-runArgs.preExec = []
-
-# Maximum number of events to process
-runArgs.skipEvents = skipEvents
-runArgs.maxEvents  = maxEvents 
-
-# Input file that contains ESD's
-if tag=="":
-  runArgs.inputRDOFile = inputFile
-
-runArgs.outputLevel = DEBUG
-
-# Output file that contains AOD's
-# runArgs.outputAODFile = '/tmp/roberth/AOD.pool.root'
-
-# List of strings separated by commas
-runArgs.autoConfiguration = ['everything']
-
-runArgs.preInclude=[]
-
-# jobOption to set alignment flags
-if alignmentJob=="L1_MSID":
-  runArgs.preInclude.append('MuonAlignExample/L1_MSID_Flags.py')
-
-elif alignmentJob=="L23Mdt":
-  runArgs.preInclude.append('MuonAlignExample/L23MdtFlags.py')
-  runArgs.preInclude.append('MuonAlignExample/MuonStandalone.py')
-
-elif alignmentJob=="L3Mdt":
-  runArgs.preInclude.append('MuonAlignExample/L3MdtFlags.py')
-#  runArgs.preInclude.append('MuonStandalone.py')
-
-elif alignmentJob=="L3CSC":
-  runArgs.preInclude.append('MuonAlignExample/L3CSCFlags.py')
-
-elif alignmentJob=="L3MdtToroidOff":
-  runArgs.preInclude.append('MuonAlignExample/L3MdtToroidOffFlags.py')
-
-else:
-  print "wrong alignmentJob!!!!!!!"
-  sys.exit(3)
-
-if doEndcapOnly:
-  runArgs.preInclude.append('MuonAlignExample/doEndcapOnly.py')
-
-if doBarrelOnly:
-  runArgs.preInclude.append('MuonAlignExample/doBarrelOnly.py')
-
-# option to read event list
-if readEventList:
-  runArgs.preInclude.append('MuonAlignExample/SelectEventNumber.py')
-
-if preIncludes!=[]:
-  for preInclude in preIncludes:
-    runArgs.preInclude.append(preInclude)
-
-runArgs.postInclude=['MuonAlignExample/MuonAlignment.py']
-
-excSvc=Service("ExceptionSvc")
-excSvc.Catch='NONE'
-excSvc.Errors='ALL'
-print excSvc
-
-include("RecJobTransforms/skeleton.RAWtoESD.py")
-print excSvc
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/submitMonitoringToGridDESD-inOneGo2 b/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/submitMonitoringToGridDESD-inOneGo2
deleted file mode 100755
index 33f76c37a09..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/share/submitMonitoringToGridDESD-inOneGo2
+++ /dev/null
@@ -1,14 +0,0 @@
-pathena runargs.ESDtoESD_newCSCALines.py RecJobTransforms/skeleton.ESDtoESD.py \
---extFile newCSCALines.txt \
---extOutFile UnbiasedMuonResiduals.root \
---inDS=data10_7TeV.*.physics_MuonswBeam.merge.DESD_SGLMU.r1299*p165*_00 \
---outDS=user.roberth.data10_7TeV.allRuns.physics_MuonswBeam.merge.DESD_SGLMU.r1299_p165.UnbiasedRes.V29_newCSCALines \
---libDS=user.roberth.0727100604.262367.lib._000144 \
---inputType=ESD --dbRelease=LATEST --nFilesPerJob=1 --site=ANALY_BNL_ATLAS_1
-
-#pathena runargs.ESDtoESD_oldCSCALines.py RecJobTransforms/skeleton.ESDtoESD.py \
-#--extFile oldCSCALines.txt \
-#--extOutFile UnbiasedMuonResiduals.root \
-#--inDS=data10_7TeV.*.physics_MuonswBeam.merge.DESD_SGLMU.r1299*p165*_00 \
-#--outDS=user.roberth.data10_7TeV.allRuns.physics_MuonswBeam.merge.DESD_SGLMU.r1299_p165.UnbiasedRes.V29_oldCSCALines \
-#--inputType=ESD --dbRelease=LATEST --nFilesPerJob=1 --site=ANALY_BNL_ATLAS_1
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignExample/test/MuonAlignExample_TestConfiguration.xml b/MuonSpectrometer/MuonAlignment/MuonAlignExample/test/MuonAlignExample_TestConfiguration.xml
deleted file mode 100755
index 82d93e9a465..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignExample/test/MuonAlignExample_TestConfiguration.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>  
-<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd">
-
-<unifiedTestConfiguration>
-<atn/>
-<kv/>
-<rtt xmlns="http://www.hep.ucl.ac.uk/atlas/AtlasTesting/rtt" >
-  <rttContactPerson>Robert Harrington (roberth@NOSPAMbu.edu)</rttContactPerson>
-  <mailto>roberth@NOSPAMbu.edu</mailto>
-  <refRelease></refRelease>
-  
-  <jobList>
-    <classification>
-      <displayClass>OfflineValidation</displayClass>
-      <displayProcess>Reco</displayProcess>
-      <displayComponent>Det-Muon</displayComponent>
-    </classification>
-    
-    <athena userJobId="MuonAlign_L3EC">
-      <doc>Muon Alignment test</doc>
-      <displayName>MdtGlobalChi2AlignAlgs_Reco_Test</displayName>
-      <options>MuonAlignExample/runargs.ESDtoESD.py</options>
-      <package>MuonSpectrometer/MuonAlignment/MuonAlignExample</package>
-      <group>MuonAlignExample</group>
-      <queue>medium</queue>
-      <dataset>/castor/cern.ch/atlas/atlascerngroupdisk/det-muon/Bytestream2010/MuonBytestreamRun155697_selectedCbMu10Events_rec15.6.10.ESD.pool.root</dataset>
-    </athena>
-    
-  </jobList>
-
-  <jobGroups>
-    <jobGroup name="AthenaMuonAlignExample" parent="Athena">
-      <keepFilePattern> *.txt </keepFilePattern>
-      <keepFilePattern> *.root </keepFilePattern>
-      <keepFilePattern> *.ps </keepFilePattern>
-      <keepFilePattern> *.gif </keepFilePattern>
-      <keepFilePattern> *.log </keepFilePattern>
-      <keepFilePattern> *.C </keepFilePattern>
-      <keepFilePattern> *.py </keepFilePattern>
-    </jobGroup>
-  </jobGroups>
-</rtt>
-</unifiedTestConfiguration>
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/CMakeLists.txt b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/CMakeLists.txt
deleted file mode 100644
index a274e68abe5..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/CMakeLists.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-################################################################################
-# Package: MuonAlignGenTools
-################################################################################
-
-# Declare the package name:
-atlas_subdir( MuonAlignGenTools )
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/DataModel
-                          DetectorDescription/Identifier
-                          GaudiKernel
-                          MuonSpectrometer/MuonGMdbObjects
-                          MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces
-                          Tracking/TrkAlignment/TrkAlignEvent
-                          Tracking/TrkAlignment/TrkAlignGenTools
-                          Tracking/TrkAlignment/TrkAlignInterfaces
-                          Tracking/TrkDetDescr/TrkDetDescrInterfaces
-                          Tracking/TrkEvent/TrkSegment
-                          Tracking/TrkEvent/TrkTrack
-                          PRIVATE
-                          Control/StoreGate
-                          Database/AthenaPOOL/RDBAccessSvc
-                          DetectorDescription/AtlasDetDescr
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          DetectorDescription/GeoPrimitives
-                          Event/EventPrimitives
-                          Event/xAOD/xAODEventInfo
-                          Generators/GeneratorObjects
-                          MuonSpectrometer/MuonAlignment/MuonAlignEvent
-                          MuonSpectrometer/MuonCalib/MuonCalibITools
-                          MuonSpectrometer/MuonCalib/MuonCalibIdentifier
-                          MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase
-                          MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface
-                          MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry
-                          MuonSpectrometer/MuonIdHelpers
-                          MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonCompetingRIOsOnTrack
-                          MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData
-                          MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack
-                          MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment
-                          MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools
-                          MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities
-                          MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerUtils
-                          Reconstruction/MuonIdentification/MuidInterfaces
-                          Reconstruction/MuonIdentification/MuonCombinedToolInterfaces
-                          Reconstruction/MuonIdentification/muonEvent
-                          Reconstruction/Particle
-                          Simulation/G4Sim/TrackRecord
-                          Tracking/TrkDetDescr/TrkGeometry
-                          Tracking/TrkDetDescr/TrkSurfaces
-                          Tracking/TrkDetDescr/TrkVolumes
-                          Tracking/TrkEvent/TrkCompetingRIOsOnTrack
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkEvent/TrkEventUtils
-                          Tracking/TrkEvent/TrkMaterialOnTrack
-                          Tracking/TrkEvent/TrkMeasurementBase
-                          Tracking/TrkEvent/TrkParameters
-                          Tracking/TrkEvent/TrkPrepRawData
-                          Tracking/TrkEvent/TrkRIO_OnTrack
-                          Tracking/TrkEvent/TrkTrackSummary
-                          Tracking/TrkExtrapolation/TrkExInterfaces
-                          Tracking/TrkFitter/TrkFitterInterfaces
-                          Tracking/TrkTools/TrkToolInterfaces
-                          Trigger/TrigEvent/TrigDecisionInterface )
-
-# External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
-find_package( CLHEP )
-find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
-find_package( Eigen )
-find_package( HepMC )
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
-
-# Component(s) in the package:
-atlas_add_component( MuonAlignGenTools
-                     src/*.cxx
-                     src/components/*.cxx
-                     INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps DataModel Identifier GaudiKernel MuonGMdbObjects MuonRecToolInterfaces TrkAlignEvent TrkAlignGenToolsLib TrkDetDescrInterfaces TrkSegment TrkTrack StoreGateLib SGtests AtlasDetDescr GeoPrimitives EventPrimitives xAODEventInfo GeneratorObjects MuonAlignEvent MuonCalibITools MuonCalibIdentifier MuonCalibStandAloneBaseLib MuonCondInterface MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils MuidInterfaces MuonCombinedToolInterfaces muonEvent Particle TrkGeometry TrkSurfaces TrkVolumes TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces )
-
-# Install files from the package:
-atlas_install_headers( MuonAlignGenTools )
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
-
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CommonGeometryManagerTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CommonGeometryManagerTool.h
deleted file mode 100644
index 7579cd4453f..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CommonGeometryManagerTool.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_COMMONGEOMETRYMANAGERTOOL_H
-#define MUONALIGNGENTOOLS_COMMONGEOMETRYMANAGERTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "DataModel/DataVector.h"
-#include "TrkAlignInterfaces/IGeometryManagerTool.h"
-#include "TrkAlignEvent/AlignParList.h"
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-
-#include "CLHEP/Geometry/Point3D.h"
-
-/**
-   @file CommonGeometryManagerTool.h
-   @class CommonGeometryManagerTool
-
-   @brief Tool with generic methods for muon geometry manager tools.
-
-   @author 
-     Robert Harrington <roberth@cern.ch>
-
-   @date 3/8/2011
-*/
-
-
-class RegionSelectionSvc;
-
-namespace MuonGM {
-  class MuonDetectorManager;
-  class MuonReadoutElement;
-}
-
-namespace MuonCalib {
-  class IIdToFixedIdTool;
-  class MuonFixedId;
-}
-
-namespace Trk {
-  class IAlignModuleTool;  
-}
-
-namespace Muon {
-
-  class CommonGeometryManagerTool : public AthAlgTool {
-    
-  public:
-    
-    enum L1Modules { EndcapA, EndcapC, Barrel, nL1Modules };
-    
-    CommonGeometryManagerTool(const std::string& type, const std::string& name,
-			    const IInterface* parent);
-    virtual ~CommonGeometryManagerTool();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-   
-    void createAlignModuleList();
-
-  protected:
-
-
-    bool chamberSelected(const MuonGM::MuonReadoutElement* mre);
-    bool chamberSelected(const MuonCalib::MuonFixedId& fid);
-    bool moduleSelected(std::string name);
-    
-    void setSigmas(DataVector<Trk::AlignPar>* modPars);
-
-    bool alignTraX() { return m_alignTraX; }
-    bool alignTraY() { return m_alignTraY; }
-    bool alignTraZ() { return m_alignTraZ; }
-    bool alignRotX() { return m_alignRotX; }
-    bool alignRotY() { return m_alignRotY; }
-    bool alignRotZ() { return m_alignRotZ; }
-
-    double sigmaTraX() { return m_sigmaTraX; }
-    double sigmaTraY() { return m_sigmaTraY; }
-    double sigmaTraZ() { return m_sigmaTraZ; }
-    double sigmaRotX() { return m_sigmaRotX; }
-    double sigmaRotY() { return m_sigmaRotY; }
-    double sigmaRotZ() { return m_sigmaRotZ; }
-
-    double softcutTraX() { return m_softcutTraX; }
-    double softcutTraY() { return m_softcutTraY; }
-    double softcutTraZ() { return m_softcutTraZ; }
-    double softcutRotX() { return m_softcutRotX; }
-    double softcutRotY() { return m_softcutRotY; }
-    double softcutRotZ() { return m_softcutRotZ; }
-
-    const MuonGM::MuonDetectorManager* p_muonMgr;
-    ToolHandle<MuonCalib::IIdToFixedIdTool> m_idTool;
-
-  private:
-
-    const RegionSelectionSvc* m_regionSvc;
-
-    bool m_alignTraX;
-    bool m_alignTraY;
-    bool m_alignTraZ;
-    bool m_alignRotX;
-    bool m_alignRotY;
-    bool m_alignRotZ;
-
-    double m_sigmaTraX;
-    double m_sigmaTraY;
-    double m_sigmaTraZ;
-    double m_sigmaRotX;
-    double m_sigmaRotY;
-    double m_sigmaRotZ;    
-
-    double m_softcutTraX;
-    double m_softcutTraY;
-    double m_softcutTraZ;
-    double m_softcutRotX;
-    double m_softcutRotY;
-    double m_softcutRotZ;
-
-    bool        m_doModuleSelection;
-    std::vector<std::string> m_moduleSelection;
-
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_COMMONGEOMETRYMANAGERTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CscAlignDBTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CscAlignDBTool.h
deleted file mode 100644
index 2fd83cc0f3b..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CscAlignDBTool.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_CSCALIGNDBTOOL_H
-#define MUONALIGNGENTOOLS_CSCALIGNDBTOOL_H
-
-#include "MuonAlignGenTools/MuonAlignDBTool.h"
-
-/**
-   @file CscAlignDBTool.h
-   @class CscAlignDBTool
-
-   @brief Tool for reading and writing alignment constants.  Can read constants from oracle DB or an ASCII file.  Writes constants to an output ASCII file.
-   @ Specific modifications for Csc from RH's MuonAlignDBTool
-   @author Prolay Mal <prolay@physics.arizona.edu>
-   @date 10/16/2009
-*/
-
-class IRDBAccessSvc;
-class TFile;
-
-namespace MuonCalib {
-  class IIdToFixedIdTool;
-}
-
-namespace MuonGM {
-  class MuonDetectorManager;
-  class CscReadoutElement;
-}
-
-namespace Trk {
-  class IAlignModuleTool;
-  class TrkDetElementBase;
-}
-
-class IMultiLevelAlignmentDbTool;
-
-namespace Muon {
-
-  class CscAlignDBTool : virtual public MuonAlignDBTool {
-    
-  public:
-    CscAlignDBTool(const std::string& type, const std::string& name,
-		   const IInterface* parent);
-    virtual ~CscAlignDBTool();
-    
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_CSCALIGNDBTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CscGeometryManagerTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CscGeometryManagerTool.h
deleted file mode 100644
index 6bb53d14484..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/CscGeometryManagerTool.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_CSCGEOMETRYMANAGERTOOL_H
-#define MUONALIGNGENTOOLS_CSCGEOMETRYMANAGERTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "TrkAlignInterfaces/IGeometryManagerTool.h"
-#include "MuonAlignGenTools/CommonGeometryManagerTool.h"
-
-/**
-   @file CscGeometryManagerTool.h
-   @class CscGeometryManagerTool
-
-   @brief Tool for creating AlignModules for MDT alignment.
-
-   @author 
-     Robert Harrington <roberth@cern.ch>
-
-   @date 02/21/2011
-*/
-namespace Trk {
-  class IAlignModuleTool;
-}
-
-namespace Muon {
-
-  class CscGeometryManagerTool : public CommonGeometryManagerTool, virtual public Trk::IGeometryManagerTool {
-
-  public:
-
-    CscGeometryManagerTool(const std::string& type, const std::string& name,
-			   const IInterface* parent);
-    virtual ~CscGeometryManagerTool();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-    
-    int ReadGeometry(int);
-    
-    void buildGeometry();
-
-    void PrintModPositions() {}
-    void StoreModPositions(std::string) {}
-
-  private:
-
-    ToolHandle<Trk::IAlignModuleTool> m_alignModuleTool; //!< Pointer to AlignModuleTool
-
-    Trk::AlignModuleList  m_alignModuleList;    
-
-    std::vector<Trk::AlignModuleList*> m_idHashToAlignModuleMaps; // uses det element id hash
-
-    DataVector<DataVector<Trk::AlignPar> >* m_alignParList;
-    DataVector<DataVector<Trk::AlignPar> >* m_fullAlignParList;
-
-    std::vector<int> m_cscAlignParameters;
-
-    void buildL1();
-    void buildL0();
-    void buildL3();
-  };
-  
-}
-  
-#endif // MUONALIGNGENTOOLS_CSCGEOMETRYMANAGERTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MdtAlignDBTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MdtAlignDBTool.h
deleted file mode 100644
index e456d7789f0..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MdtAlignDBTool.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MDTALIGNDBTOOL_H
-#define MUONALIGNGENTOOLS_MDTALIGNDBTOOL_H
-
-#include "MuonAlignGenTools/MuonAlignDBTool.h"
-
-/**
-   @file MdtAlignDBTool.h
-   @class MdtAlignDBTool
-
-   @brief Tool for reading and writing alignment constants.  Can read constants from oracle DB or an ASCII file.  Writes constants to an output ASCII file.
-
-   Modified to inherit from MuonAlignDBTool on 7/7/10.
-
-   @author Robert Harrington <roberth@bu.edu>, Steffen Kaiser <Steffen.Kaiser@cern.ch>
-   @date 10/14/2008
-*/
-
-namespace Muon {
-
-  class MdtAlignDBTool : public MuonAlignDBTool {
-    
-  public:
-    MdtAlignDBTool(const std::string& type, const std::string& name,
-			    const IInterface* parent);
-    virtual ~MdtAlignDBTool();
-        
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_MDTALIGNDBTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MdtGeometryManagerTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MdtGeometryManagerTool.h
deleted file mode 100644
index a6996cc1836..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MdtGeometryManagerTool.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MDTGEOMETRYMANAGERTOOL_H
-#define MUONALIGNGENTOOLS_MDTGEOMETRYMANAGERTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "TrkAlignInterfaces/IGeometryManagerTool.h"
-#include "MuonAlignGenTools/MuonGeometryManagerTool.h"
-#include "DataModel/DataVector.h"
-
-/**
-   @file MdtGeometryManagerTool.h
-   @class MdtGeometryManagerTool
-
-   @brief Tool for creating AlignModules for MDT alignment.
-
-   @author 
-     Robert Harrington <roberth@cern.ch>
-
-   @date 02/21/2011
-*/
-namespace Trk {
-  class IAlignModuleTool;
-}
-
-namespace Muon {
-
-  class MdtGeometryManagerTool : public CommonGeometryManagerTool, virtual public Trk::IGeometryManagerTool {
-
-  public:
-
-    MdtGeometryManagerTool(const std::string& type, const std::string& name,
-			   const IInterface* parent);
-    virtual ~MdtGeometryManagerTool();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-    
-    int ReadGeometry(int);
-    
-    void buildGeometry();
-
-    void PrintModPositions() {}
-    void StoreModPositions(std::string) {}
-
-  private:
-    void addModuleParameters(Trk::AlignModule * module, 
-			     DataVector<DataVector<Trk::AlignPar> >* allFullModPars, 
-			     DataVector<DataVector<Trk::AlignPar> >* allActiveModPars);
-    
-    ToolHandle<Trk::IAlignModuleTool> m_alignModuleTool; //!< Pointer to AlignModuleTool
-
-    Trk::AlignModuleList  m_alignModuleList;    
-
-    std::vector<Trk::AlignModuleList*> m_idHashToAlignModuleMaps; // uses det element id hash
-
-    DataVector<DataVector<Trk::AlignPar> >* m_alignParList;
-    DataVector<DataVector<Trk::AlignPar> >* m_fullAlignParList;
-
-    std::vector<int> m_mdtAlignParameters;
-
-    void buildL1();
-    void buildL0();
-    void buildL23();
-    void buildL3();
-  };
-  
-}
-  
-#endif // MUONALIGNGENTOOLS_MDTGEOMETRYMANAGERTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignDBTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignDBTool.h
deleted file mode 100644
index 8933856cb1e..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignDBTool.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MUONALIGNDBTOOL_H
-#define MUONALIGNGENTOOLS_MUONALIGNDBTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "DataModel/DataVector.h"
-
-#include "MuonCondInterface/IMultiLevelAlignmentDbTool.h"
-#include "MuonGMdbObjects/DblQ00Aszt.h"
-
-#include "TrkAlignInterfaces/ITrkAlignDBTool.h"
-#include "TrkAlignEvent/AlignParList.h"
-#include "TrkAlignEvent/AlignModule.h"
-
-/**
-   @file MuonAlignDBTool.h
-   @class MuonAlignDBTool
-
-   @brief Base class for tools for reading and writing alignment constants.  
-   Can read constants from oracle DB or an ASCII file.  Writes constants to 
-   an output ASCII file.
-
-   Modified from MdtAlignDBTool
-
-   @author Robert Harrington <roberth@bu.edu>, Steffen Kaiser <Steffen.Kaiser@cern.ch>
-   @date 7/7/2010
-*/
-
-class IRDBAccessSvc;
-class TFile;
-
-namespace MuonCalib {
-  class IIdToFixedIdTool;
-}
-
-namespace MuonGM {
-  class MuonDetectorManager;
-  class MuonReadoutElement;
-}
-
-namespace Trk {
-  class IAlignModuleTool;
-  class TrkDetElementBase;
-}
-
-class IMultiLevelAlignmentDbTool;
-
-namespace Muon {
-
-  class MuonAlignDBTool : virtual public Trk::ITrkAlignDBTool, public AthAlgTool {
-    
-  public:
-    MuonAlignDBTool(const std::string& type, const std::string& name,
-			    const IInterface* parent);
-    virtual ~MuonAlignDBTool();
-    
-    StatusCode initialize();
-    
-    StatusCode finalize();
-
-    /** Writes alignment parameter (to ASCII file for now) */
-    void writeAlignPar();
-
-    /** sets ntuple */
-    void setNtuple(TFile* ntuple) { m_ntuple=ntuple; }
-
-    /** called before final solving to get initial A-lines */
-    StatusCode preSolve();
-
-  protected:
-    /** used to decompose a HepGeom::Transform3D into translations and rotations **/
-    void decomposeTransform(const Amg::Transform3D& transform, double* values) const; 
-    const MuonGM::MuonReadoutElement* getMuonRE(const Trk::TrkDetElementBase* detElement) const;
-
-
-  private:
-
-    void                initL1FromDatabase() const;
-    MuonGM::DblQ00Aszt* initAlinesEqZero() const;
-    MuonGM::DblQ00Aszt* initSigmasFromAsciiFile() const;
-
-    void writeALinesToAsciiFile(const ALineMapContainer* alines, const std::string& file) const;
-
-    void writeASZTToAscii(MuonGM::DblQ00Aszt::ASZT* aszt, 
-			  int nObj, const std::string& filename) const;
-
-    //bool selectModuleASZT(const AlignModuleList* alignModList,
-    //		  const MuonGM::DblQ00Aszt::ASZT& aszt, 
-    //		  const AlignModule* alignMod);
-
-    //void fillSigmasToFirstAlignParMap();
-    
-    /** returns TrkDetElementBase if it is in an AlignModule only, returns 0 otherwise */
-    const Trk::TrkDetElementBase* getDetElement(Identifier id) const;
-
-    void createL1LookupTable();
-    void createL23LookupTable();
-    void createL3LookupTable();    
-    void setDetElemLookup() const;
-
-    ALineMapContainer* asciiToALines(const std::string& inputfile);
-
-    StatusCode getInitialALines();
-
-    void globalToL1AlignFrame(const Trk::AlignModule* mod, 
-			      double* globalPars, double* alignPars) const;
-
-    void level1AlignToGlobalFrame(const Trk::AlignModule* mod, 
-				  double* alignPars, double* globalPars) const;
-
-    ToolHandle<IMultiLevelAlignmentDbTool>  m_multilevelDbTool; //!< Pointer to MultiLevelAlignmentDbTool
-    ToolHandle<MuonCalib::IIdToFixedIdTool> m_idTool;           //!< Pointer to IdToFixedIdTool
-    ToolHandle<Trk::IAlignModuleTool>       m_alignModuleTool;  //!< Pointer to AlignModuleTool
-
-    const MuonGM::MuonDetectorManager* p_muonMgr;
-    
-    std::string m_asztInputFile;
-    std::string m_asztOutputFile;
-    std::string m_sigmaInputFile;
-    std::string m_sigmaOutputFile;
-
-    TFile* m_ntuple;
-
-    // for RDBAccess
-    IRDBAccessSvc* m_rdbAccessSvc;
-    std::string m_detectorKey;
-    std::string m_detectorNode;
-
-    const MuonGM::MuonDetectorManager* m_muonDetMgr;
-    //ALineMapContainer* m_alineData;
-
-    const ALineMapContainer* m_alines;
-    
-    //Trk::AlignParList* m_detElementAlignPar;
-
-    //bool m_storeL3Params;
-
-    // lookup tables to help go from ASZT to AlignPar and AlignModule
-    mutable std::vector<Identifier>*                    m_detElemLookup_identifier;
-    mutable std::vector<const Trk::AlignModule*>*       m_detElemLookup_alignMod;
-    mutable std::vector<const Trk::TrkDetElementBase*>* m_detElemLookup_detElem;
-    mutable std::vector<int>*                           m_detElemLookup_alineIndex;
-    mutable std::vector<std::string>*                   m_detElemLookup_stName;
-    mutable std::vector<int>*                           m_detElemLookup_stPhi;
-    mutable std::vector<int>*                           m_detElemLookup_stEta;
-
-    std::vector<DataVector<Trk::AlignPar>* >             m_ALineContainerToAlignPar;
-    std::vector<const Trk::AlignModule*>                 m_ALineContainerToMod;
-
-    bool m_useMultiLevelDbTool;
-
-
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_MUONALIGNDBTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignHelperTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignHelperTool.h
deleted file mode 100644
index 8e13d8a05f7..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignHelperTool.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MUONALIGNHELPERTOOL_H
-#define MUONALIGNGENTOOLS_MUONALIGNHELPERTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-
-#include "Identifier/Identifier.h"
-
-#include <math.h>
-
-/**
-   @file MuonAlignHelperTool.h
-   @class MuonAlignHelperTool
-
-   @brief Tool containing miscellaneous methods useful for muon alignment 
-
-   @author Robert Harrington <roberth@bu.edu>
-   @date 8/27/2010
-*/
-
-class IMessageSvc;
-
-namespace Muon {
-  class MuonIdHelperTool;
-
-  namespace MuonAlign {
-    float RadsToDegrees(float Radians);
-    double FixRad(double Radians);
-  }
-
-  enum StationLayer { Inner, Middle, Outer, Other };  
-
-  static const InterfaceID ID_MuonAlignHelperTool ( "Muon::MuonAlignHelperTool",1,0);
-
-  class MuonAlignHelperTool : public AthAlgTool {
-    
-  public:
-    MuonAlignHelperTool(const std::string& type,
-			const std::string& name,
-			const IInterface* parent);
-    ~MuonAlignHelperTool();
-
-    StatusCode initialize();
-    StatusCode finalize();
-
-    bool isEndcap(Identifier id) const;
-    bool isBIS8(Identifier id) const;
-    StationLayer getMdtStatLayer(Identifier id) const;
-
-    static const InterfaceID& interfaceID() { return ID_MuonAlignHelperTool; }
-
-  private:
-    ToolHandle<MuonIdHelperTool> m_muonIdHelper;
-
-    
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_MUONALIGNHELPERTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignModuleTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignModuleTool.h
deleted file mode 100644
index 1d4a1f356f4..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignModuleTool.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MUONALIGNMODULETOOL_H
-#define MUONALIGNGENTOOLS_MUONALIGNMODULETOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-
-#include "TrkAlignInterfaces/IGeometryManagerTool.h"
-#include "TrkAlignEvent/AlignParList.h"
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignGenTools/AlignModuleTool.h"
-
-/**
-   @file MuonAlignModuleTool.h
-   @class MuonAlignModuleTool
-
-   @brief MDT-specific implementation of AlignModuleTool, primarily needed 
-   to shift and restore MdtAlignModules.
-
-   @author Robert Harrington <roberth@bu.edu>, Steffen Kaiser <Steffen.Kaiser@cern.ch>
-   @date 3/18/2009
-*/
-
-namespace MuonGM {
-  class MuonStation;
-  class MuonDetectorManager;
-}
-
-namespace Trk {
-  class AlignTSOS;
-  class Track;
-}
-
-namespace Muon {
-
-  class MuonAlignModuleTool : public Trk::AlignModuleTool {
-    
-  public:
-    
-    MuonAlignModuleTool(const std::string& type, const std::string& name,
-		       const IInterface* parent);
-    ~MuonAlignModuleTool();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-    
-    /** methods used for numerical derivative to shift module before refitting track and restore to normal position, to be inherited by detector-specific align modules */
-    void shiftModule(const Trk::AlignModule* module, 
-		     const Trk::Track* track, 
-		     Trk::AlignModule::TransformParameters dimension, 
-		     double value) const;
-    /*
-    void shiftMdt(const Trk::AlignModule* module, 
-		  Trk::AlignModule::TransformParameters dimension, 
-		  double value) const;
-    void shiftTgc(const Trk::AlignModule* module, 
-		  Trk::AlignModule::TransformParameters dimension, 
-		  double value) const;
-    void shiftRpc(const Trk::AlignModule* module, 
-		  Trk::AlignModule::TransformParameters dimension, 
-		  double value) const;
-    */
-
-    void shiftDetElements(Trk::AlignModule::DetectorType detType,
-			  const std::vector<Identifier>& readoutElementIDs,
-			  const Trk::AlignModule* module, 
-			  const Trk::Track* track,
-			  Trk::AlignModule::TransformParameters dimension, 
-			  double value) const;
-    
-    void restoreModule(const Trk::AlignModule* module) const;
-
-    void setMeasurementProperties(Trk::AlignTSOS* atsos) const;
-
-    int subDetElementIDHash(Identifier id) const;
-
-  private:
-    const MuonGM::MuonDetectorManager* p_muonMgr;
-
-    void shiftSurface(const Trk::AlignModule* module, 
-		      const Trk::TrkDetElementBase* detelement,
-		      Identifier id) const;
-    
-    /** stores original transforms for chambers when chambers are shifted so they can be used to restore chambers when restoreModule called */
-    mutable std::vector<std::vector<Amg::Transform3D*>*> m_origTransforms; 
-
-    /** stores original transforms for TGC chamber when chamber is shifted so it can be used to restore chamber when restoreModule called */
-    mutable std::vector<MuonGM::MuonStation*> m_shiftedMuonStations;
-
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_MUONALIGNMODULETOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignRefitTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignRefitTool.h
deleted file mode 100644
index a934bc4f066..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonAlignRefitTool.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MUONALIGNREFITTOOL_H
-#define MUONALIGNGENTOOLS_MUONALIGNREFITTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "Identifier/Identifier.h"
-#include "TrkTrack/Track.h"
-
-#include "MuonRecToolInterfaces/IMuonRefitTool.h"
-//#include "MuonAlignGenTools/myMuonRefitTool.h"
-
-#include "TrkDetDescrInterfaces/ITrackingVolumesSvc.h"
-
-#include <math.h>
-
-/**
-   @file MuonAlignRefitTool.h
-   @class MuonAlignRefitTool
-
-   @brief Tool containing methods to refit tracks for muon alignment 
-
-   @author Robert Harrington <roberth@bu.edu>
-   @date 11/25/2010
-*/
-
-class AtlasDetectorID;
-
-namespace Trk {
-  class Track;
-  class IPropagator;
-  //class IMagneticFieldTool;
-  class MagneticFieldProperties;
-  class MeasurementTypeID;
-  class Volume;
-}
-
-class IMessageSvc;
-
-namespace Muon {
-
-  class IMdtDriftCircleOnTrackCreator;
-  class IMuonClusterOnTrackCreator;
-  class IMuonCompetingClustersOnTrackCreator;
-  class MuonEDMHelperTool;
-  class MuonEDMPrinterTool;
-  class MuonIdHelperTool;
-  class IMuonSegmentTrackBuilder;
-  //class IMuonRefitTool;
-  class MuonAlignHelperTool;
-
-  static const InterfaceID ID_MuonAlignRefitTool ( "Muon::MuonAlignRefitTool",1,0);
-
-  class MuonAlignRefitTool : public AthAlgTool {
-    
-  public:
-    MuonAlignRefitTool(const std::string& type,
-			const std::string& name,
-			const IInterface* parent);
-    virtual ~MuonAlignRefitTool();
-
-    virtual StatusCode initialize();
-    virtual StatusCode finalize();
-
-    /** sets qOverP for first TSOS on track */
-    Trk::Track* pTCorrectTrack(const Trk::Track& track, double qOverP, bool removePerigee=false) const;
-
-    const Trk::Track* prepareHitsOnTrack(const Trk::Track& track);
-
-    const Trk::Track* refitForAlignment(const Trk::Track& track);
-
-    const Trk::MaterialEffectsBase* materialEffects(const Trk::TrackStateOnSurface& tsos) const;
-    
-    static const InterfaceID& interfaceID() { return ID_MuonAlignRefitTool; }
-    
-  private:
-    
-    //ToolHandle<Trk::IPropagator>         m_propagator;
-    //ToolHandle<Trk::IMagneticFieldTool>  m_magFieldTool;    
-    ToolHandle<IMuonSegmentTrackBuilder> m_trackBuilder; //<! track builder
-    ToolHandle<MuonEDMPrinterTool>       m_printer;      //<! helper to nicely print out tracks
-    ToolHandle<MuonEDMHelperTool>        m_helper;       //<! muon EDM helper
-    ToolHandle<MuonIdHelperTool>         m_muonIdHelper;     //<! muon id helper
-    ToolHandle<IMuonRefitTool>           m_refitTool;    //<! muon refit tool
-    //ToolHandle<myMuonRefitTool>            m_refitTool;    //<! muon refit tool
-
-    ToolHandle<MuonAlignHelperTool>      m_muonAlignHelperTool;
-
-    //Trk::MagneticFieldProperties*        m_magFieldProperties; //!< magnetic field properties
-    const AtlasDetectorID*  m_idHelper;
-    Trk::MeasurementTypeID* m_measTypeIdHelper;
-
-    ServiceHandle<Trk::ITrackingVolumesSvc> m_trackingVolumesSvc;
-
-    const Trk::Volume*      m_calVolume;
-    const Trk::Volume*      m_indetVolume;
-    
-    bool m_removeBIS8Hits;
-    bool m_removeBEEHits;
-    bool m_removeEEHits;
-    bool m_removeTGCHits;
-    bool m_removeTGCEtaHits;
-    bool m_removeRPCEtaHits;
-    bool m_removeCSCHits;
-    bool m_removeSpoiledCSCHits;
-    bool m_removeCSCPhiHits;
-    bool m_removeSmallBarrelHits;
-    bool m_removeBarrelHits;
-    bool m_removeEndcapHits;
-    bool m_removeTRTHits;
-    bool m_removeScattering;
-
-    bool m_declusterTGCHits;
-    
-    bool m_recreateStartingParameters;
-    bool m_extrapolateToMuonEntry;
-
-    bool m_redoErrorScaling;
-
-    IMuonRefitTool::Settings m_defaultRefitSettings;
-
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_MUONALIGNHELPERTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonFillNtupleTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonFillNtupleTool.h
deleted file mode 100644
index d8d01ced8b1..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonFillNtupleTool.h
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MUONFILLNTUPLETOOL_H
-#define MUONALIGNGENTOOLS_MUONFILLNTUPLETOOL_H
-
-#include "GaudiKernel/ToolHandle.h"
-#include "AthenaBaseComps/AthAlgTool.h"
-
-#include "TrkAlignInterfaces/IFillNtupleTool.h"
-#include "TrkSegment/TrackSegment.h"
-#include "TrkSegment/SegmentCollection.h"
-#include "TMatrixD.h"
-#include "TVector3.h"
-
-/**
-   @file MuonFillNtupleTool.h
-   @class MuonFillNtupleTool
-
-   @brief Tool for writing information to ntuple for debugging.
-
-   @author Robert Harrington <roberth@bu.edu>, Steffen Kaiser <Steffen.Kaiser@cern.ch>
-   @date 10/14/2008
-*/
-
-class TFile;
-class TTree;
-
-namespace MuonGM {
-  class MuonDetectorManager;
-}
-
-namespace Muon {
-  class MuonEDMHelperTool;
-  class MuonTrackHistTool;
-  class MuonIdHelperTool;
-}
-
-class MdtIdHelper;
-class CscIdHelper;
-class RpcIdHelper;
-class TgcIdHelper;
-
-namespace Trk {
-  class AlignTrack;
-  class IAlignModuleTool;
-  class IResidualPullCalculator;
-}
-
-class Identifier;
-
-namespace MuonCalib {
-  class IIdToFixedIdTool;
-}
-
-namespace Muon {
-  class MuonFillNtupleTool : virtual public Trk::IFillNtupleTool, public AthAlgTool {
-    
-  public:
-    MuonFillNtupleTool(const std::string& type, const std::string& name,
-			    const IInterface* parent);
-    virtual ~MuonFillNtupleTool();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-
-    /** dumps track information to ntuple */
-    void dumpTrack(int itrk, const Trk::AlignTrack* alignTrack);
-
-    void storeHitmap();
-    void fillHitmap();
-    void fillSummary();
-    void showStatistics();
-
-    void setNtuple(TFile* ntuple) { m_ntuple=ntuple; }
-    StatusCode fillNtuple();
-
-  private:
-
-    void createChamberTrees();
-
-    // ToolHandle<Muon::MuonTrackHistTool>   m_trackHistTool; //!< Pointer to MuonTrackHistTool
-    ToolHandle<Trk::IResidualPullCalculator> m_pullCalculator; //!< Pointer to pull calculator
-    //ToolHandle<Muon::MuonEDMHelperTool>   m_helperTool; //!< Pointer to EDM helper tool
-    ToolHandle<MuonCalib::IIdToFixedIdTool> m_idTool;   //!< Pointer to IdToFixedIdTool
-    ToolHandle<Trk::IAlignModuleTool> m_alignModuleTool; //!< Pointer to AlignModuleTool
-
-
-    ToolHandle<MuonIdHelperTool>   m_muonIdHelperTool;
- 
-    const MuonGM::MuonDetectorManager* p_muonMgr; //!< Pointer to muon detector manager
-
-    // access to Id Helpers
-    const MdtIdHelper* p_MdtIdHelper; //!< Pointer to MDT Id helper
-    const CscIdHelper* p_CscIdHelper; //!< Pointer to CSC Id helper
-    const RpcIdHelper* p_RpcIdHelper; //!< Pointer to RPC Id helper
-    const TgcIdHelper* p_TgcIdHelper; //!< Pointer to TGC Id helper
-
-    std::string m_segmentcollName;
-
-    TFile* m_ntuple;
-    TTree* m_tree;
-
-    // Reconstructed variables
-    //int      m_runNumber;
-    //int      m_evtNumber;
-    
-    //int      m_nMuonOutliers;
-    //int      m_nTgcOutliers;
-
-    /** number of associated precision hits [MDT+CSC] (etah in ntuple)  */
-    //int m_etah;
-    /** number of trigger chamber hits measuring phi (phih in ntuple)  */
-    //int m_phih;
-    /** number of associated MDT hits [including tube hits] (mdth in ntuple)  */
-    //int m_mdth;
-    /** number of associated CSC eta hits [precision coordinate] (cscetah in ntuple)  */
-    //int m_cscetah;
-    /** number of associated CSC phi hits [second coordinate] (cscphih in ntuple)  */
-    //int m_cscphih;
-    /** number of associated RPC eta hits [precision coordinate] (rpcetah in ntuple)  */
-    //int m_rpcetah;
-    /** number of associated RPC phi hits [second coordinate] (rpcphih in ntuple)  */
-    //int m_rpcphih;
-    /** number of associated TGC eta hits [precision coordinate] (tgcetah in ntuple)  */
-    //int m_tgcetah;
-    /** number of associated TGC phi hits [second coordinate] (tgcphih in ntuple)  */
-    //int m_tgcphih;
-    /** number of associated stations (stati in ntuple)  */
-    //int m_stati;
-    /** track fit status:  1=road, 2=merged_road, 3=road_wire, 4=road_time, 5=final_wire, 6=final_time, 7=final_track (star in ntuple)  */
-    //int m_statr;
-
-    /** x coord of track perigee (xvtxr in ntuple)  */
-    //double m_xvtxr;
-    /** y coord of track perigee (yvtxr in ntuple)  */
-    //double m_yvtxr;
-    /** z coord of track perigee (zvtxr in ntuple)  */
-    //double m_zvtxr;
-    /** a0 perigee parameter of reconstructed track (a0r in ntuple)  */
-    //double m_a0r;
-    /** z0 perigee parameter of reconstructed track (z0r in ntuple)  */
-    //double m_z0r;
-    /** phi perigee parameter of reconstructed track (phir in ntuple)  */
-    //double m_phir;
-    /** cot(theta) perigee parameter of reconstructed track (cotthr in ntuple)  */
-    //double m_cotthr;
-    /** charge/pt perigee parameter of reconstructed track (ptir in ntuple)  */
-    //double m_ptir;
-    /** eta of perigee of reconstructed track (etar in ntuple)  */
-    //double m_etar;
-    /** Chi2 per degree of freedom of the track fit (chi2 in ntuple)  */
-    //double m_chi2;
-    /** Chi2 probability of the track fit (chi2pr in ntuple)  */
-    //double m_chi2pr;
-    /** x coord of vertex w.r.t which track perigee parameters are given (origx in ntuple)  */
-    //double m_vertexx;
-    /** y coord of vertex w.r.t which track perigee parameters are given (origy in ntuple)  */
-    //double m_vertexy;
-    /** z coord of vertex w.r.t which track perigee parameters are given (origz in ntuple)  */
-    //double m_vertexz;
-
-    /** covariance matrix element [a0,a0] (covr11 in ntuple)  */
-    //double m_covr11;
-    /** covariance matrix element [a0,z0] (covr12 in ntuple)  */
-    //double m_covr12;
-    /** covariance matrix element [z0,z0] (covr22 in ntuple)  */
-    //double m_covr22;
-    /** covariance matrix element [a0,phi] (covr13 in ntuple)  */
-    //double m_covr13;
-    /** covariance matrix element [z0,phi] (covr23 in ntuple)  */
-    //double m_covr23;
-    /** covariance matrix element [phi,phi] (covr33 in ntuple)  */
-    //double m_covr33;
-    /** covariance matrix element [a0,cot(theta)] (covr14 in ntuple)  */
-    //double m_covr14;
-    /** covariance matrix element [z0,cot(theta)] (covr24 in ntuple)  */
-    //double m_covr24;
-    /** covariance matrix element [phi,cot(theta)] (covr34 in ntuple)  */
-    //double m_covr34;
-    /** covariance matrix element [cot(theta),cot(theta)] (covr44 in ntuple)  */
-    //double m_covr44;
-    /** covariance matrix element [a0,q/pt] (covr15 in ntuple)  */
-    //double m_covr15;
-    /** covariance matrix element [z0,q/pt] (covr25 in ntuple)  */
-    //double m_covr25;
-    /** covariance matrix element [phi,q/pt] (covr35 in ntuple)  */
-    //double m_covr35;
-    /** covariance matrix element [cot(theta),q/pt] (covr45 in ntuple)  */
-    //double m_covr45;
-    /** covariance matrix element [q/pt,q/pt] (covr55 in ntuple)  */
-    //double m_covr55;
-  
-   /** HIT INFORMATION */
-
-    /** number of hits on track [including scattering centers] (nhits in ntuple) */
-    //int m_nhits;
-
-    /** hit station name index [see MuonIdHelper] (statname in ntuple) */
-    int*  m_hit_statname;
-    /** hit station eta index [see MuonIdHelper] (stateta in ntuple) */
-    int*  m_hit_stateta;
-    /** hit station phi index [see MuonIdHelper] (statphi in ntuple) */
-    int*  m_hit_statphi;
-    /** hit station region index: 0=Inner, 1=BEE or EE, 2=Middle, 3=Outer (statreg in ntuple) */
-    int*  m_hit_statreg;
-    /** hit technology [see MuonIdHelper] (tech in ntuple) */
-    int*  m_hit_tech;
-    /** hit detector technology: 1=RPCeta, 2=RPCphi, 3=TGCeta, 4=TGCphi, 5=CSCeta, 6=CSCphi, 7=MDT, 10=scatt.ctr (hit_dtyp in ntuple) */
-    int*  m_hit_dtyp;
-    
-    /**  MuonFixedId in integer form (fixedid in ntuple) */
-    int*  m_hit_fixedid;
-    /**  hit station name index from MuonFixedId (fixedstatname in ntuple) */
-    int*  m_hit_fixedstatname;
-      
-    /** doubletR number for RPC hit [see RpcIdHelper] (hit_dblr in ntuple) */
-    double*  m_hit_dblr;
-    /** doubletZ number for RPC hit [see RpcIdHelper] (hit_dblz in ntuple) */
-    double*  m_hit_dblz;
-    /** doubletPhi number for RPC hit [see RpcIdHelper] (hit_dblp in ntuple) */
-    double*  m_hit_dblp;
-
-    /** gasGap number for RPC or TGC hit [see RpcIdHelper or TgcIdHelper] (hit_ggap in ntuple) */
-    int*  m_hit_ggap;
-    /** strip number for RPC or CSC hit [see RpcIdHelper or CscIdHelper] (hit_strp in ntuple) */
-    int*  m_hit_strp;
-    /** channel number for TGC hit [see TgcIdHelper] (hit_chnl in ntuple) */
-    int*  m_hit_chnl;
-    /** chamberLayer number for CSC hit [see CscIdHelper] (hit_clyr in ntuple) */
-    int*  m_hit_clyr;
-    /** wireLayer number for CSC hit [see CscIdHelper] (hit_wlyr in ntuple) */
-    int*  m_hit_wlyr;
-    /** multiLayer number for MDT hit [see MdtIdHelper] (hit_mlyr in ntuple) */
-    int*  m_hit_mlyr;
-    /** tubeLayer number for MDT hit [see MdtIdHelper] (hit_tlyr in ntuple) */
-    int*  m_hit_tlyr;
-    /** tube number for MDT hit [see MdtIdHelper] (hit_tube in ntuple) */
-    int*  m_hit_tube;
-    
-    /** radius of hit (hit_rho in ntuple) */
-    double*  m_hit_rho;
-    /** phi angle of hit (hit_phi in ntuple) */
-    double*  m_hit_phi;
-    /** z coord of hit (hit_z in ntuple) */
-    double*  m_hit_z;
-    /** cot(theta) of hit (hit_cotth in ntuple) */
-    double*  m_hit_cotth;
-    /** eta angle of hit (hit_eta in ntuple) */
-    double*  m_hit_eta;
-    /** local x coord of hit (hit_xloc in ntuple) */
-    double*  m_hit_xloc;
-    /** local y coord of hit (hit_yloc in ntuple) */
-    double*  m_hit_yloc;
-    /** local z coord of hit (hit_zloc in ntuple) */
-    double*  m_hit_zloc;
-    /** drift distance to wire for hit [MDT only] (hit_drd in ntuple) */
-    double*  m_hit_drd;
-    /** hit error (hit_sig in ntuple) */
-    double*  m_hit_sig;
-    /** hit normalized residual (hit_res in ntuple) */
-    double*  m_hit_res;
-
-    /** global x-position of first tube in 1st tubelayer */
-    double* m_hit_t0_x;
-
-    /** global y-position of first tube in 1st tubelayer */
-    double* m_hit_t0_y;
-
-    /** global z-position of first tube in 1st tubelayer */
-    double* m_hit_t0_z;
-
-    /** global x-position of 12th tube in 1st tubelayer */
-    double* m_hit_t1_x;
-
-    /** global y-position of 12th tube in 1st tubelayer */
-    double* m_hit_t1_y;
-
-    /** global z-position of 12th tube in 1st tubelayer */
-    double* m_hit_t1_z;
-
-    /** global x-position of first tube in 3rd tubelayer */
-    double* m_hit_t2_x;
-
-    /** global y-position of first tube in 3rd tubelayer */
-    double* m_hit_t2_y;
-
-    /** global z-position of first tube in 3rd tubelayer */
-    double* m_hit_t2_z;
-
-    /** TSOS track parameter locX or locY */
-    double* m_hit_tpar;
-        
-    /** number of radiation lengths [scatt.ctr only] (hit_x0 in ntuple) */
-    int*  m_hit_x0;
-
-    /** TSOS type */
-    //double*  m_hit_type; 
-    
-    /** derivatives */
-    /*
-    double*  m_hit_deriv_transx;
-    double*  m_hit_deriv_transy;
-    double*  m_hit_deriv_transz;
-    double*  m_hit_deriv_rotx;
-    double*  m_hit_deriv_roty;
-    double*  m_hit_deriv_rotz;
-    */
-
-    const int m_max_nchambers;
-    //int       m_nchambers;
-    //int       m_nshifts;
-    long long int* m_chamberid;
-    long long int* m_chamberstatname;
-    double*   m_transx;
-    double*   m_transy;
-    double*   m_transz;
-    double*   m_rotx;
-    double*   m_roty;
-    double*   m_rotz;
-
-    TMatrixD* m_chi2_transx;
-    TMatrixD* m_chi2_transy;
-    TMatrixD* m_chi2_transz;
-    TMatrixD* m_chi2_rotx;
-    TMatrixD* m_chi2_roty;
-    TMatrixD* m_chi2_rotz;
-    TMatrixD* m_chi2_transx_X;
-    TMatrixD* m_chi2_transy_X;
-    TMatrixD* m_chi2_transz_X;
-    TMatrixD* m_chi2_rotx_X;
-    TMatrixD* m_chi2_roty_X;
-    TMatrixD* m_chi2_rotz_X;
-    //mdt
-    TMatrixD* m_chi2_transx_mdt;
-    TMatrixD* m_chi2_transy_mdt;
-    TMatrixD* m_chi2_transz_mdt;
-    TMatrixD* m_chi2_rotx_mdt;
-    TMatrixD* m_chi2_roty_mdt;
-    TMatrixD* m_chi2_rotz_mdt;
-    //tgc
-    TMatrixD* m_chi2_transx_tgc;
-    TMatrixD* m_chi2_transy_tgc;
-    TMatrixD* m_chi2_transz_tgc;
-    TMatrixD* m_chi2_rotx_tgc;
-    TMatrixD* m_chi2_roty_tgc;
-    TMatrixD* m_chi2_rotz_tgc;
-    //rpc
-    TMatrixD* m_chi2_transx_rpc;
-    TMatrixD* m_chi2_transy_rpc;
-    TMatrixD* m_chi2_transz_rpc;
-    TMatrixD* m_chi2_rotx_rpc;
-    TMatrixD* m_chi2_roty_rpc;
-    TMatrixD* m_chi2_rotz_rpc;
-    //csc
-    TMatrixD* m_chi2_transx_csc;
-    TMatrixD* m_chi2_transy_csc;
-    TMatrixD* m_chi2_transz_csc;
-    TMatrixD* m_chi2_rotx_csc;
-    TMatrixD* m_chi2_roty_csc;
-    TMatrixD* m_chi2_rotz_csc;
-    //scat
-    TMatrixD* m_chi2_transx_scat;
-    TMatrixD* m_chi2_transy_scat;
-    TMatrixD* m_chi2_transz_scat;
-    TMatrixD* m_chi2_rotx_scat;
-    TMatrixD* m_chi2_roty_scat;
-    TMatrixD* m_chi2_rotz_scat;
-    //id
-    TMatrixD* m_chi2_transx_id;
-    TMatrixD* m_chi2_transy_id;
-    TMatrixD* m_chi2_transz_id;
-    TMatrixD* m_chi2_rotx_id;
-    TMatrixD* m_chi2_roty_id;
-    TMatrixD* m_chi2_rotz_id;
-
-    /** TRUTH INFORMATION (only filled in case of single muon MC) */ 
-    
-    /** generated pt of the truth muon */
-    //double m_truth_pt_gen;
-    /** pt of the truth muon at the muon spectrometer entrance */
-    //double m_truth_pt_msentrance;
-
-    int m_totaltrks;
-    int m_totalhits;
-    int m_max_hits; // max number of hits on track stored in ntuple
-
-    const int m_csc_nMaxHits;
-    StoreGateSvc* m_storeGate;
-
-    double* m_chi2VAlignParamQuality; 
-    /*
-    double m_trackChi2;       //!> track chi2
-    double m_trackChi2Dof;    //!> track chi2 per degree of freedom
-    double m_idTrackChi2;     //!> inner detector track chi2
-    double m_idTrackChi2Dof;  //!> inner detector track chi2 per degree of freedom
-    double m_msTrackChi2;     //!> muon spectrometer track chi2
-    double m_msTrackChi2Dof;  //!> muon spectrometer track chi2 per degree of freedom
-    double m_trackEta;        //!> track eta
-    double m_energyLoss;      //!> energy loss
-    int    m_nSctHits;        //!> number silicon hits
-    int    m_nPixHits;        //!> number pixel hits
-    int    m_nTrtHits;        //!> number TRT hits
-    double m_msidPtDiff;      //!> relative difference of pT between MS and ID track 
-    double m_idPtAtIP;        //!> momentum of ID track at IP
-    double m_idZ0AtIP;        //!> z0 of ID track at IP
-    double m_idD0AtIP;        //!> d0 of ID track at IP
-    double m_msPtAtIP;        //!> momentum of MS track at IP
-    double m_msZ0AtIP;        //!> z0 of MS track at IP
-    double m_msD0AtIP;        //!> d0 of MS track at IP
-    int    m_nMdtHits;        //!> number MDT hits
-    int    m_nRpcPhiHits;     //!> number RPC phi hits
-    int    m_nTgcPhiHits;     //!> number TGC phi hits
-    */
-    //These are CSC specific variables
-    /*
-    int  m_csc_nphihits;
-    int  m_csc_netahits; 
-    double m_csc_phi_avg_residual;
-    double m_csc_phi_avg_error; 
-    double m_csc_eta_avg_residual;
-    double m_csc_eta_avg_error; 
-    double *m_csc_phi_hit_residual;
-    double *m_csc_eta_hit_residual; 
-    double *m_csc_phi_hit_error; 
-    double *m_csc_eta_hit_error;
-    int *m_csc_eta_hit_layer;
-    int *m_csc_phi_hit_layer;
-    int *m_csc_eta_hit_sector;
-    int *m_csc_phi_hit_sector;
-
-    double m_muon_track_sagitta;
-    */
-
-    //std::string m_muonContainer;   //!> name of muon container
-    
-    //bool m_bigNtuple;         //!> make ntuple with all branches
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_MUONFILLNTUPLETOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonGeometryManagerTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonGeometryManagerTool.h
deleted file mode 100644
index 585aedc9d78..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonGeometryManagerTool.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MUONGEOMETRYMANAGERTOOL_H
-#define MUONALIGNGENTOOLS_MUONGEOMETRYMANAGERTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "DataModel/DataVector.h"
-#include "TrkAlignInterfaces/IGeometryManagerTool.h"
-#include "MuonAlignGenTools/CommonGeometryManagerTool.h"
-#include "TrkAlignEvent/AlignParList.h"
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-
-#include "CLHEP/Geometry/Point3D.h"
-
-/**
-   @file MuonGeometryManagerTool.h
-   @class MuonGeometryManagerTool
-
-   @brief Tool for creating AlignModules for MDT alignment.
-
-   @author 
-     Robert Harrington <roberth@bu.edu>, Steffen Kaiser <Steffen.Kaiser@cern.ch>, Yair Mahalalel <Yair.Mahalalel@cern.ch>
-
-   @date 10/14/2008
-*/
-
-namespace Trk {
-  class IAlignModuleTool;  
-}
-
-namespace Muon {
-
-  class MuonGeometryManagerTool : public CommonGeometryManagerTool, virtual public Trk::IGeometryManagerTool {
-    
-  public:
-    
-    MuonGeometryManagerTool(const std::string& type, const std::string& name,
-			    const IInterface* parent);
-    virtual ~MuonGeometryManagerTool();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-    
-    /** Returns number of alignment parameters */
-    int ReadGeometry(int);
-
-    void buildGeometry();
-
-    void createAlignModuleList();
-
-    void PrintModPositions() {}
-    void StoreModPositions(std::string) {}
-
-  protected:
-    
-    void addModuleParameters(Trk::AlignModule * module, 
-			     DataVector<DataVector<Trk::AlignPar> >* allFullModPars, 
-			     DataVector<DataVector<Trk::AlignPar> >* allActiveModPars);
-
-  private:
-
-    bool isOneDetOnly(const Trk::AlignModule* mod, 
-		      Trk::AlignModule::DetectorType& detType) const;
-
-
-    ToolHandle<Trk::IAlignModuleTool> m_alignModuleTool; //!< Pointer to AlignModuleTool
-
-    ToolHandle<Trk::IGeometryManagerTool> m_mdtGeoManager; //!< Pointer to MdtGeometryManagerTool
-    ToolHandle<Trk::IGeometryManagerTool> m_cscGeoManager; //!< Pointer to MdtGeometryManagerTool
-    ToolHandle<Trk::IGeometryManagerTool> m_tgcGeoManager; //!< Pointer to MdtGeometryManagerTool
-
-
-    Trk::AlignModuleList  m_alignModuleList;    
-
-    std::vector<Trk::AlignModuleList*> m_idHashToAlignModuleMaps; // uses det element id hash
-
-    DataVector<DataVector<Trk::AlignPar> >* m_alignParList;
-    DataVector<DataVector<Trk::AlignPar> >* m_fullAlignParList;
-
-    bool m_alignMdt;
-    bool m_alignTgc;
-    bool m_alignCsc;
-
-  }; // end class
-  
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_MUONGEOMETRYMANAGERTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonTrackCollectionProvider.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonTrackCollectionProvider.h
deleted file mode 100644
index e6b610af698..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonTrackCollectionProvider.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MUONTRACKCOLLECTIONPROVIDER_H
-#define MUONALIGNGENTOOLS_MUONTRACKCOLLECTIONPROVIDER_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-
-#include "TrkAlignInterfaces/ITrackCollectionProvider.h"
-
-/**
-   @file MuonTrackCollectionProvider.h
-   @class MuonTrackCollectionProvider
-   
-   @brief Tool used to get Muon collection from StoreGate and return collection of tracks
-
-   @author Robert Harrington <roberth@bu.edu>
-   @date 7/29/2010
-*/
-
-namespace MuonCombined {
-  class IMuonTrackTagTool;
-}
-
-namespace Muon {
-
-  class MuonAlignRefitTool;
-
-  class MuonTrackCollectionProvider : virtual public Trk::ITrackCollectionProvider, public AthAlgTool {
-
-  public:
-
-    enum TrackType {
-      
-      /** Analysis::Muon */
-      Muon = 0,
-      
-      /** MS standalone and ID tracks */
-      MSStandaloneWithIDTrackMatch = 1,
-
-      /** Combined muon track */
-      CombinedMuonTrack = 2,
-
-      /** number of track types */
-      NumberOfTrackTypes = 3
-    };
-
-    MuonTrackCollectionProvider(const std::string & type, const std::string & name, const IInterface * parent);
-    virtual ~MuonTrackCollectionProvider();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-    
-    StatusCode trackCollection(const TrackCollection*& tracks);
-    StatusCode trackCollectionFromMuonContainer(const TrackCollection*& tracks);
-    StatusCode trackCollectionFromTrackContainers(const TrackCollection*& tracks);
-    StatusCode trackCollectionFromCombinedTrack(const TrackCollection*& tracks);
-        
-  private:
-
-    ToolHandle<MuonCombined::IMuonTrackTagTool>   m_tagTool;
-
-    ToolHandle<MuonAlignRefitTool> m_muonAlignRefitTool;
-
-    //TrackCollection*     m_trackCollection;
-    
-    std::string m_inputMuonCol;    //!< Name of input Analysis::Muon collection
-    
-    std::string m_inputTrackCol;   //!< Name of input muon Trk::Track collection
-
-    std::string m_inputIDTrackCol; //!< Name of input ID Trk::Track collection
- 
-    //int m_nRetrievalErrors;    //!< number of retrieval errors at the beginning of the job
-    //int m_maxRetrievalErrors;  //!< maximum allowed number of retrieval errors at the beginning of the job (-1 for infinite)
-    
-    bool m_useStandaloneTracks; //!< flag to return standalone track (returns combined if false)
-
-    int    m_inputTrackType; //!< type of input container(s)
-    
-    double m_momentumCut;       //!< momentum cut
-    double m_trackMatchDeltaR;  //!< track match deltaR cut
-
-    bool m_removePerigeeBeforeRefit; //!> remove perigee from track before refit
-
-  }; // end class
-
-} // end namespace
-
-#endif // MUONALIGNGENTOOLS_MUONTRACKCOLLECTIONPROVIDER_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonTrackPreProcessor.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonTrackPreProcessor.h
deleted file mode 100644
index 930ff2e66be..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/MuonTrackPreProcessor.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_MUONTRACKPREPROCESSOR_H
-#define MUONALIGNGENTOOLS_MUONTRACKPREPROCESSOR_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "DataModel/DataVector.h"
-#include "TrkAlignInterfaces/IAlignTrackPreProcessor.h"
-#include "TrkEventPrimitives/ParticleHypothesis.h"
-
- 
-/**
-   @file MuonTrackPreProcessor.h
-   @class MuonTrackPreProcessor
-
-   @brief Tool for processing collections of tracks.  Removes unwanted hits from tracks.
-
-   @author Robert Harrington <roberth@bu.edu>
-   
-   @date 10/25/2009
-*/
-
-class AtlasDetectorID;
-class ITrackingVolumesSvc;
-class TTree;
-
-namespace Trk {
-  class Track;
-  class AlignTrack;
-  class ITrackFitter;
-  //class ITrackSelectorTool;
-  class IResidualPullCalculator;
-  class MeasurementTypeID;
-  class Volume; 
-}
-
-class TFile;
-class TTree;
-
-namespace MuonGM {
-  class MuonDetectorManager;
-}
-
-namespace Muon {
-  
-  class MuonIdHelperTool;
-  class IMuonSegmentTrackBuilder;
-  class MuonAlignRefitTool;
-  class MuonEDMPrinterTool;
-  class MuonAlignHelperTool;
-
-  class MuonTrackPreProcessor : virtual public Trk::IAlignTrackPreProcessor, public AthAlgTool {
-
-  public:
-    MuonTrackPreProcessor(const std::string& type, const std::string& name,
-			  const IInterface* parent);
-    virtual ~MuonTrackPreProcessor();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-    
-    DataVector<Trk::Track>* processTrackCollection(const DataVector<Trk::Track>* trks);
-    
-    void setNtuple(TFile* file) { m_ntuple=file; }
-    StatusCode fillNtuple();
-
-  private:
-
-    void dumpChamberNames(const Trk::Track& track) const;
-    void printCompetingROTs(const Trk::Track& track) const;
-    void calculateTrackChi2(const Trk::Track* track);
-
-    // private methods
-    Trk::AlignTrack* refitTrack(const Trk::Track& origTrack) const;
-    const Trk::Track* removeHits(const Trk::Track& origTrack) const;
-    const Trk::Track* declusterTGCHits(const Trk::Track& origTrack) const;
-    
-    bool passesStandardTrackSelection(const Trk::Track& origTrack);
-    bool passesInitTrackSelection(const Trk::Track& origTrack);
-    bool passesFinalTrackSelection(const Trk::Track& origTrack);
-    
-    int getMdtStatLayer(Identifier id) const;
-
-    void identifyScatterers(const Trk::Track& origTrack) const;
-    
-    void createTree();
-
-    bool isEndcap(Identifier id) const; // checks whether isEndcap or BEE
-
-    bool isBIS8(Identifier id) const; // checks whether BIS8 chamber
-
-    double trackSagitta(const Trk::Track& track) const;
-
-    const MuonGM::MuonDetectorManager* p_muonMgr;
-
-    StoreGateSvc* m_storeGate;
-
-    TFile* m_ntuple;  //!> output ntuple
-
-    // private variables
-    //ToolHandleArray<Trk::ITrackSelectorTool>  m_trackSelectorTools; 
-    ToolHandle<Trk::ITrackFitter>  m_trackFitterTool;
-    ToolHandle<Trk::ITrackFitter>  m_SLTrackFitterTool;  
-    ToolHandle<MuonIdHelperTool>   m_muonIdHelperTool; 
-
-    ToolHandle<Muon::IMuonSegmentTrackBuilder> m_segmentTrackBuilder;
-
-    ToolHandle<Trk::IResidualPullCalculator>   m_pullCalculator;
-    
-    ToolHandle<Muon::MuonAlignRefitTool> m_muonAlignRefitTool;
-
-    ToolHandle<Muon::MuonAlignHelperTool> m_muonAlignHelperTool;
-
-    ToolHandle<Muon::MuonEDMPrinterTool>  m_printer;
-
-    //ServiceHandle<ITrackingVolumesSvc> m_trackingVolumesSvc;
-    //const Trk::Volume*                 m_msVolume;
-    //const Trk::Volume*                 m_calVolume;
-    //const Trk::Volume*                 m_indetVolume;
-
-    const AtlasDetectorID*   m_idHelper;
-    Trk::MeasurementTypeID* m_measTypeIdHelper;
-
-    bool m_refitTracks;                      //!> refit tracks with new fitter
-    //bool m_runOutlierRemoval;                //!> run outlier removal in track refit
-    int  m_particleNumber;
-    Trk::ParticleHypothesis m_particleHypothesis; //!> particle hypothesis in track refit
-
-    bool m_resetScatteringAngles;   //!> reset scattering angles before refit
-    bool m_removeScattererTSOS;     //!> remove TSOS of type Scatterer
-
-    //bool m_redoErrorScaling;        //!> uses recalibrateHitsOnTrack method of MuonSegmentTrackBuilder, which redoes ROT creation with error scaling (if ROT creator configured with error scaling)
-
-    //bool m_removePerigeeBeforeRefit; //!> remove perigee from track before refit
-    bool m_pTCorrectTrack;           //!> correct pT for first TSOS on track
-
-    //bool m_declusterTGCHits;        //!> break up TGC Competing RIOsOnTrack into RIO_OnTrack
-    //bool m_cutOnBarrel;             //!> remove tracks that have barrel hits
-
-    bool m_applyStandardSelectionCuts;  //!> apply standard selection cuts
-    bool m_applySelectionCuts;          //!> apply selection cuts
-    bool m_requireOneHitPerTubeLayerEC; //!> require one tube hit per multilayer (for MDT hits in endcap only)
-    bool m_requireOuterLayerEndcapMdt;  //!> remove tracks that don't have a hit in the outer layer MDT endcap
-    bool m_requireInnerLayerEndcapMdt;  //!> remove tracks that don't have a hit in the inner layer MDT endcap
-    bool m_requireSmallLargeOverlap;    //!> select only small/large overlap tracks
-    bool m_requireSectorOverlap;        //!> select only tracks hitting m_sector1 as well as m_sector2
-    int  m_sector1;                     //!> selected sector for overlap requirement
-    int  m_sector2;                     //!> selected sector for overlap requirement
-
-    bool m_requireBarrelECOverlap;      //!> remove tracks that don't overlap barrel and EC
-    bool m_requireRPCPhiHit;            //!> use only tracks which have a RPC phi hit
-
-    unsigned int m_minMdtChambers;      //!> min number of MDT chambers required on track
-    unsigned int m_minSmallMdtChambers; //!> min number of small MDT chambers required on track
-    unsigned int m_minLargeMdtChambers; //!> min number of large MDT chambers required on track
-
-    bool   m_selectCombinedMuons;  //!> select only muons with combined tracks
-    double m_MSID_ptDiffCut;       //!> cut on relative difference of MS and ID pT
-    double m_maxDriftSignSumInner; //!> cut on sum of drift radius signs for inner layer multilayers
-    double m_maxDriftSignSum;      //!> cut on sum of drift radius signs for each multilayer
-    double m_chiSqCut;             //!> cut on normalized chi2
-    int    m_nAllowedOutliers;     //!> number of outliers allowed on track
-    int    m_nAllowedHoles;        //!> number of holes allowed on track
-    std::string m_muonContainer;   //!> name of muon container
-
-
-    // tree variables
-    TTree*  m_tree;                           //!> output tree
-    int     m_runNumber;
-    int     m_evtNumber;
-    int     m_nresiduals;
-    double* m_residuals;
-    double* m_respulls;
-    int     m_nInnerLayersHit;
-    int     m_nMiddleLayersHit;      
-    int     m_nOuterLayersHit;       
-    int     m_nOtherLayersHit;       
-    int     m_nTubeLayersHitInner;
-    int     m_nTubeLayersHitMiddle;
-    int     m_nTubeLayersHitOuter;
-    int     m_nTubeLayersHitOther;
-    int     m_nChambersHit;
-    int     m_nLargeChambersHit;
-    int     m_nSmallChambersHit; 
-    double  m_driftSignsInnerLayer;
-    double  m_driftSignsMiddleLayer;
-    double  m_driftSignsOuterLayer;
-    double  m_driftSignsOtherLayer;
-    int     m_nInnerLayerOutliers;   
-    int     m_nMiddleLayerOutliers;  
-    int     m_nOuterLayerOutliers;   
-    int     m_nOtherLayerOutliers;   
-    int     m_nInnerLayerHoles;      
-    int     m_nMiddleLayerHoles;     
-    int     m_nOuterLayerHoles;      
-    int     m_nOtherLayerHoles;      
-    int     m_trackNDoF;             
-    double  m_trackChi2;             
-    double  m_trackPt;               
-    double  m_trackEta;
-    double  m_qOverP;
-    //double  m_trackSagitta;
-    // residuals
-
-    int     m_nIDres;
-    double* m_IDres;
-    double* m_IDerr;
-
-    int     m_nIDscatRes;
-    double* m_IDscatPhiRes;
-    double* m_IDscatPhiErr;
-    double* m_IDscatThetaRes;
-    double* m_IDscatThetaErr;
-
-    int     m_nMSres;
-    double* m_MSres;
-    double* m_MSerr;
-    int*    m_MSstatLayer;
-    int*    m_MSisEndcap;
-
-    int     m_nMStrigRes;
-    double* m_MStrigRes;
-    double* m_MStrigErr;
-    int   * m_MStrigStatLayer;
-    int   * m_MStrigIsEndcap;
-
-    int     m_nMSscatRes;
-    double* m_MSscatPhiRes;
-    double* m_MSscatPhiErr;
-    double* m_MSscatThetaRes;
-    double* m_MSscatThetaErr;
-
-    int     m_nCalRes;
-    double* m_CalRes;
-    double* m_CalErr;
-
-    int     m_nChambers;
-    int*    m_chamberId;
-    int*    m_resIndex;
-    
-    double  m_beePosX;
-    double  m_beePosY;
-
-    // cut flow variables
-    mutable int m_nProcessed;
-    mutable int m_nPassHitRemoval;
-    mutable int m_nPassTGCHitRemoval;
-    mutable int m_nPassBarrelVeto;
-    mutable int m_nPassInnerLayer;
-    mutable int m_nPassOuterLayer;
-    mutable int m_nPassSmallLargeOverlap;
-    mutable int m_nPassSectorOverlap;
-    mutable int m_nPassMinChambers;
-    mutable int m_nPassMinSmallChambers;
-    mutable int m_nPassMinLargeChambers;
-    mutable int m_nPassRPCPhiHit;
-    mutable int m_nPassStandardTrackSel;
-    mutable int m_nPassInitTrackSel;
-    mutable int m_nPassTubeLayerEC;
-    mutable int m_nPassTubeLayerBarrel;
-    mutable int m_nPassDriftSignSumEC;
-    mutable int m_nPassDriftSignSumBarrel;
-    mutable int m_nPassTrackRefit;
-    mutable int m_nPassTrackChi2Cut;
-    mutable int m_nPassOutlierCut;
-    mutable int m_nPassHoleCut;
-    mutable int m_nPassFinalTrackSel;
-
-    mutable int m_nProcessTrackSelection;
-    mutable int m_nPassBarrelECOverlap;
-    mutable int m_nPassNMdtHits;
-    mutable int m_nPassNLayers;
-    mutable int m_nPassTrackChi2;
-    mutable int m_nPassMomentum;
-    mutable int m_nPassD0;
-    mutable int m_nPassZ0;
-  };
-}
-#endif // MUONALIGNGENTOOLS_MUONTRACKPREPROCESSOR_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/TgcGeometryManagerTool.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/TgcGeometryManagerTool.h
deleted file mode 100644
index 8c15ee4e815..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/TgcGeometryManagerTool.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONALIGNGENTOOLS_TGCGEOMETRYMANAGERTOOL_H
-#define MUONALIGNGENTOOLS_TGCGEOMETRYMANAGERTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "TrkAlignInterfaces/IGeometryManagerTool.h"
-#include "MuonAlignGenTools/CommonGeometryManagerTool.h"
-
-/**
-   @file TgcGeometryManagerTool.h
-   @class TgcGeometryManagerTool
-
-   @brief Tool for creating AlignModules for MDT alignment.
-
-   @author 
-     Robert Harrington <roberth@cern.ch>
-
-   @date 02/21/2011
-*/
-namespace Trk {
-  class IAlignModuleTool;
-}
-
-namespace Muon {
-
-  class TgcGeometryManagerTool : public CommonGeometryManagerTool, virtual public Trk::IGeometryManagerTool {
-
-  public:
-
-    TgcGeometryManagerTool(const std::string& type, const std::string& name,
-			   const IInterface* parent);
-    virtual ~TgcGeometryManagerTool();
-    
-    StatusCode initialize();
-    StatusCode finalize();
-    
-    int ReadGeometry(int);
-    
-    void buildGeometry();
-
-    void PrintModPositions() {}
-    void StoreModPositions(std::string) {}
-
-  private:
-
-    ToolHandle<Trk::IAlignModuleTool> m_alignModuleTool; //!< Pointer to AlignModuleTool
-
-    Trk::AlignModuleList  m_alignModuleList;    
-
-    std::vector<Trk::AlignModuleList*> m_idHashToAlignModuleMaps; // uses det element id hash
-
-    DataVector<DataVector<Trk::AlignPar> >* m_alignParList;
-    DataVector<DataVector<Trk::AlignPar> >* m_fullAlignParList;
-
-    std::vector<int> m_mdtAlignParameters;
-
-    void buildL1();
-    void buildL0();
-    void buildL23();
-    void buildL3();
-  };
-  
-}
-  
-#endif // MUONALIGNGENTOOLS_TGCGEOMETRYMANAGERTOOL_H
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/UnbiasedMuonResiduals.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/UnbiasedMuonResiduals.h
deleted file mode 100644
index 78e01de856f..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/MuonAlignGenTools/UnbiasedMuonResiduals.h
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef UNBIASEDMUONRESIDUALS_H
-#define UNBIASEDMUONRESIDUALS_H
-
-#include "GaudiKernel/ToolHandle.h"
-#include "AthenaBaseComps/AthAlgorithm.h"
-
-#include "TrkAlignEvent/AlignModule.h"
-
-#include "TrkSegment/SegmentCollection.h"
-#include "TrkTrack/TrackCollection.h"
-//#include "TrkEventPrimitives/GlobalDirection.h"
-//#include "TrkEventPrimitives/GlobalPosition.h"
-//#include "TrkParameters/MeasuredAtaPlane.h"
-
-#include "TrkAlignEvent/AlignModule.h"
-
-#include <vector>
-#include <list>
-#include <string>
-#include <map>
-
-class StoreGateSvc;
-class Identifier;
-
-class TFile;
-class TTree;
-
-namespace Trig{
-  class ITrigDecisionTool;
-}
-
-namespace Trk{
-  class Track;
-  class Segment;
-  class IExtrapolator;
-  class PlaneSurface;
-  class ITrackFitter;
-  class IResidualPullCalculator;
-}
-
-namespace Analysis {
-  class Muon;
-  class MuonContainer;
-}
-
-namespace MuonGM {
-  class MuonDetectorManager;
-}
-
-namespace Rec {
-  class ICombinedMuonTrackBuilder;
-}
-
-namespace MuonCombined {
-  class IMuonTrackTagTool;
-}
-
-namespace Muon {
-
-  class MuonSegment;
-  class MuonSegmentCombination;
-  class MuonEDMHelperTool;
-  class MuonIdHelperTool;
-  class IMuonSegmentTrackBuilder;
-  class MuonAlignHelperTool;
-  class MuonAlignRefitTool;
-  class IMuonSegmentTrackBuilder;
-  //class MuonRefitTool;
-  class IMdtDriftCircleOnTrackCreator;
-  class IMuonClusterOnTrackCreator;
-  class MuonEDMPrinterTool;
-
-  class UnbiasedMuonResiduals: public AthAlgorithm {
-    
-  public:
-    enum TrackFittingType {
-
-      /** uses iPat, combines separately-fit ID and MS standalone tracks into a combined track */
-      CombinedMuonTrackBuilder   = 0,
-
-      /** uses track fitter to fit standalone muon, using ID momentum for multiple scattering*/
-      MSStandaloneWithIDMomentum = 1,
-
-      /** uses track fitter to refit combined muon track */
-      NormalTrackFitter          = 2,
-      
-      /** uses iPat, does combined fit, and then selects standalone track */
-      MSStandaloneFromCombinedMuon = 3,
-
-      /** uses muon standalone, phi/eta matched to ID track */
-      MSStandaloneWithIDTrackMatch = 4,
-
-      /** maximum number of enums */
-      NumberOfTrackFittingTypes  = 5
-    };
-
-    UnbiasedMuonResiduals( const std::string& name,
-			   ISvcLocator* pSvcLocator);
-    ~UnbiasedMuonResiduals();
-    
-    virtual StatusCode initialize();
-    virtual StatusCode execute();
-    virtual StatusCode finalize();
-    
-    typedef std::pair<Muon::MuonSegment*, const Analysis::Muon*> SegMatch;
-    typedef std::pair<Muon::MuonSegment*, const Trk::Track*> SegMatchTrack;
-
-  private:
-
-    /** name of the segment collection to retrieve from StoreGate */
-    std::vector<int>                             m_segmCollectionFlag;
-    std::vector<std::string>                     m_segmCollectionName; 
-    std::vector<std::string>                     m_trackCollectionName;
-    std::vector<std::string>                     m_inDetTrackCollectionName;
-    
-    /** pointer to detector manager*/
-    const MuonGM::MuonDetectorManager*           m_detMgr;  
-    
-    /** a handle on Store Gate for access to the Event Store */
-    StoreGateSvc*                                m_storeGate;
-    
-    /** class member version of retrieving MsgStream */
-    ToolHandle<MuonCombined::IMuonTrackTagTool>  m_tagTool;
-    ToolHandle<Muon::MuonEDMHelperTool>          p_muonEDMHelperTool;
-    ToolHandle<Muon::MuonIdHelperTool>           p_idHelperTool;
-    ToolHandle<Muon::IMuonSegmentTrackBuilder>   p_trackBuilder;
-    //ToolHandle<Muon::MuonRefitTool>              p_trackRefitTool;
-    ToolHandle<Trk::IExtrapolator>               p_IExtrapolator;
-    ToolHandle<Rec::ICombinedMuonTrackBuilder>   m_combinedTrackBuilder; //!< combined track builder
-    ToolHandle<Trk::ITrackFitter>                m_trackFitter;          //!< fitter
-    ToolHandle<Trig::ITrigDecisionTool>          m_trigDec;              //!< trigger decision tool
-    ToolHandle<Trk::IResidualPullCalculator>     m_pullCalculator;       //!< residual pull calculator
-    ToolHandle<Muon::IMdtDriftCircleOnTrackCreator> m_mdtRotCreator;     //!< mdt ROT creator
-    ToolHandle<Muon::IMuonClusterOnTrackCreator>    m_cscRotCreator;     //!< csc ROT creator
-
-    ToolHandle<Muon::MuonAlignHelperTool>        m_muonAlignHelperTool;
-    ToolHandle<Muon::MuonAlignRefitTool>         m_muonAlignRefitTool;
-    ToolHandle<Muon::MuonEDMPrinterTool>         m_printer;
-
-    void checkCovVar(const Trk::Track& track) const;
- 
-    bool passesChamberSelection(Trk::AlignModule::DetectorType detType,
-				Identifier id, int flag=0);
-    
-    /** methods called by fillHistograms */
-    StatusCode getSegments( Trk::AlignModule::DetectorType detType,
-			    std::vector<SegMatch>& muonInn, int iflag);
-
-    StatusCode getSegments( Trk::AlignModule::DetectorType detType,
-			    std::vector<SegMatchTrack>& muonInn, int iflag);
-
-    //StatusCode getAllSegments( const std::string& segmCollectionName, 
-    //		       const std::string& trackCollectionName, 
-    //		       std::vector<SegMatch>& muonInn);
-    
-    const Trk::PlaneSurface* getDetectorSurface(Trk::AlignModule::DetectorType detType,
-						const Muon::MuonSegment* mSeg); 
-
-    const Trk::Track* getTrackFromTrack(const Trk::Track* track);
-    const Trk::Track* getTrackFromMuon(const Analysis::Muon* muon);
-
-    const Trk::Track* getTrack(const Trk::Track* idTrack,
-			       const Trk::Track* muTrack,
-			       const Trk::Track* combTrack);
-    
-    Trk::Track* getUnbiasedTrack(Identifier id1,
-				 const Trk::Track* initTrack,
-				 const Trk::PlaneSurface* detSurface,
-				 Trk::AlignModule::DetectorType detType,
-				 int flag=0);
-
-    const Trk::TrackParameters* getIDTrackExtrapolated(const Trk::Track* track,
-						       const Trk::PlaneSurface* detSurface);
-    
-    const Trk::TrackParameters* getSegmentExtrapolated(const Muon::MuonSegment* mSeg,
-						       const Trk::PlaneSurface* detSurface);
-        
-    const Trk::TrackParameters* getTrackExtrapolated(Identifier id,
-						     const Trk::Track* unbiasedTrack,
-						     const Trk::PlaneSurface* detSurface);
-    
-    const Analysis::Muon* findMuon(const Analysis::MuonContainer* muonTES, 
-				   Muon::MuonSegment* mSeg) const;
-
-    const Trk::Track* findBestTrack(Trk::AlignModule::DetectorType detType,
-				    const TrackCollection* muonTracks,
-				    const TrackCollection* idTracks,
-				    Muon::MuonSegment* mSeg);
-    
-    const Trk::Track* prepareTrack(const Trk::Track& track, double qOverP);
-
-    void compareSurfaces(const std::string& trackType,
-			 const Trk::Surface& segSurface, 
-			 const Trk::Surface& detSurf);
-    
-    //const Trk::MeasuredAtaPlane* trackParameters(const Trk::TrackStateOnSurface* tsit, 
-    //						 const Trk::PlaneSurface& surface);  
-    
-    const Trk::TrackStateOnSurface* cloneTSOS(const Trk::TrackStateOnSurface* tsos,
-					      bool makeOutlier=false);
-    
-    Trk::Track* cleanTrack(Identifier id, const Trk::Track& initTrack,
-			   bool removePerigee);
-
-    bool checkMuon(const Analysis::Muon& muon);
-    bool checkTrack(const Trk::Track& track);
-    
-    void getBiasedResiduals(const Trk::Track& track);
-
-    int  getMdtStatLayer(Identifier id) const;
-
-    void setIdentificationVariables(Trk::AlignModule::DetectorType detType, 
-				    const MuonSegment& mSeg);
-
-    void calcResForExtrapolatedIDToDetSurface(const Analysis::Muon& muon,
-					      const Trk::TrackParameters& segPar,
-					      const Trk::PlaneSurface* detSurface,
-					      Trk::AlignModule::DetectorType detType);
-    
-    void calcResForSegmentAtDetSurface(const Trk::TrackParameters& trackPar,
-				       const Trk::TrackParameters& segPar,
-				       const Trk::ErrorMatrix& trkErrMat,
-				       const Trk::ErrorMatrix& segErrMat);
-
-    void removeExtraSegments(Trk::AlignModule::DetectorType detType,
-			     std::list<Muon::MuonSegment*>& muonSegments) const;
-
-    void printPerigee(const Trk::Track& track);
-
-    Trk::Track* correctErrors(const Trk::Track& track);
-
-    std::set<Identifier> chamberIds(Trk::AlignModule::DetectorType detType, 
-				    const MuonSegment& seg) const;
-
-    Identifier chamberId(Trk::AlignModule::DetectorType detType, const MuonSegment& seg) const;
-    Identifier triggerChamberId(const MuonSegment& seg) const;
-
-    void getTrackIds(const Trk::Track& track, std::list<Identifier>& trackIds) const;
-
-    std::vector<std::string> m_triggerList;
-
-    bool m_doMdt;
-    bool m_doCsc;
-    bool m_doRpc;
-    bool m_doTgc;
-
-    bool m_makeTGCOutliers;
-    bool m_redoErrorScaling;
-
-    /** tree variables */
-    TFile* m_file;
-    TTree* m_tree;
-    
-    int m_run;
-    int m_evt;
-    int m_nPixHits;
-    int m_nSCTHits;
-    int m_nTRTHits;
-    int m_nCSCHits;
-    int m_nMDTHits;
-    int m_nRPCHits;
-    int m_nTGCHits;
-
-    int m_nInnerMDTHits;
-    int m_nMiddleMDTHits;
-    int m_nOuterMDTHits;
-    int m_nTriggerPhiHits;
-
-    const int m_MAXNMDTHITS;
-    const int m_MAXNTGCHITS;
-    const int m_MAXNCSCHITS;
-    const int m_MAXNRPCHITS;
-
-    double* m_cscHitLocX;
-    double* m_cscHitLocY;
-    double* m_cscHitErrors;
-   
-    double* m_mdtRes;
-    double* m_tgcRes;
-    double* m_cscRes;
-    double* m_rpcRes;
-
-    double* m_mdtPull;
-    double* m_tgcPull;
-    double* m_cscPull;
-    double* m_rpcPull;   
-
-    int m_author;
-    
-    int m_hIndex;
-    int m_phiSector;
-    int m_isEndcap;
-    int m_identifier;
-    int m_isCSide;
-    
-    int m_detType;
-    
-    int m_layer;
-    int m_stName;
-    int m_stPhi;
-    int m_stEta;
-    
-    double m_momentum;
-    double m_charge;
-    double m_d0;
-    double m_z0;
-    double m_phi0;
-    double m_theta0;
-    double m_eta0;
-    double m_trackChi2;
-    double m_calEnergyLoss;
-    double m_calEnergyLossErr;
-    double m_materialOnTrack;
-    
-    double m_deltaPhi;
-    double m_deltaTheta;
-
-    double m_dR;
-    double m_dZlocal;
-    double m_dXlocal;
-    double m_dYlocal;
-    double m_dXlocalAngle;
-    double m_dYlocalAngle;
-
-    double m_pullXlocal;
-    double m_pullYlocal;
-    double m_pullXlocalAngle;
-    double m_pullYlocalAngle;
-
-    double m_dXglobal;
-    double m_dYglobal;
-    double m_dZglobal;
-    double m_dXglobalAngle;
-    double m_dYglobalAngle;
-    double m_dZglobalAngle;
-    
-    double m_detTheta;
-    double m_detThetaErr;
-
-    /** Quality/multiplicity cuts */
-    float m_MinMuonMom;
-    int   m_minSCTHits, m_minPIXHits, m_minTRTHits, m_minMDTHits, m_minCSCHits;
-    float m_MaxIDd0, m_MaxIDz0, m_MaxIDChiDof;
-    
-    double m_trackMatchDeltaR;
-    double m_matchChi2Cut;
-
-    int m_trackFittingType;
-
-    bool m_extrapolateIDTrack;
-    bool m_useTrackContainer;
-
-    std::string m_muonTgcPrdKey; //TGC Container;
-    std::string m_muonTgcPrdKey_prev; //TGC Container;
-    std::string m_muonTgcPrdKey_next; //TGC Container;
-    
-    std::vector<std::string> m_listOfTriggers;
-  };
-
-} // end namespace
-
-#endif
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/doc/packagedoc.h b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/doc/packagedoc.h
deleted file mode 100644
index 37b2ef88948..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/doc/packagedoc.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
-@page MuonAlignGenTools_page MuonAlignGenTools package
-@author Robert Harrington <roberth@bu.edu>, Steffen Kaiser <Steffen.Kaiser@cern.ch>
-
-@section MuonAlignGenTools_introduction Introduction
-
-This package provides tools for performing muon spectrometer alignment with tracks.  The 
-available tools are:
-
-@section MuonAlignGenTools_MuonAlignGenToolsOverview Class Overview
- The MuonAlignGenTools package contains the following packages:
-
- - MuonGeometryManagerTool:  get the list of all MDT chambers from MuonDetectorManager
-  
- - MuonFillNtupleTool:  gets information about hits and tracks and stores in 
-   ntuple.  Used for validation and testing. 
-
-*/
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureFullReco.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureFullReco.py
deleted file mode 100644
index 93717f8a383..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureFullReco.py
+++ /dev/null
@@ -1,187 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   ConfigureFullReco.py
-## @brief:  Used to setup full reconstruction for 
-#           track-based alignment.  
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Include            import include
-from MuonRecExample.MuonRecFlags     import muonRecFlags
-from RecJobTransforms.RecConfig      import recConfig
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-
-## ConfigureFullReco sets up full reconstruction for track-based alignment.
-#  
-class ConfigureFullReco () :
-
-    def configureReco(self) :
-
-        from AthenaCommon.DetFlags import DetFlags
-        DetFlags.Muon_setOn() 
-        DetFlags.ID_setOn()
-
-        #==============================================================
-        # Job Configuration parameters:
-        #==============================================================
-        # Signal to include file that this is not the postOptions,
-        # in case the jobConfig is also the postOptions
-        isPostOptions = False
-                
-        #--- Configuration part: ---------------------------------------
-        doRestrictedESD = recConfig.restrictedESD
-        doMinimalRec = recConfig.doMinimalRec
-        doBackTracking = recConfig.doBackTracking
-
-        indetRecos = ( 'xKalman', 'iPatRec', 'newTracking' )
-        doAODall=False  # TODO: = recConfig.<something>
-        # set all known flags to False
-        for reco in indetRecos:
-            exec 'do%s = False' % reco
-
-        #
-        # set requested flags to True
-        #
-        recosOn = []
-        recosAll = list(indetRecos)
-        if 'all' in recConfig.doIndetReco:
-            # add all known indet recos
-            for reco in indetRecos: recosOn.append(reco)
-
-        # add all requested recos (avoid doubles)
-        for reco in recConfig.doIndetReco:
-            if reco != 'all':
-                if reco not in recosOn : recosOn.append(reco)
-                if reco not in recosAll: recosAll.append(reco)
-        for reco in recosOn:
-            exec 'do%s = True' % reco
-
-        # Determine doAODall flag
-        doAODall = True
-        for reco in indetRecos:
-            if reco not in recosOn:
-                doAODall = False
-                break
-
-        # Switch off some parts of combined reco
-        if 'doObjMissingET' in recConfig.combinedRecoOff:
-            doObjMissingET=False
-
-        include( "RecExCond/RecExCommon_flags.py" )
-
-        # Switch off sub-detectors
-        for detOff in recConfig.detectorsOff:
-            cmd='DetFlags.%s_setOff()' % detOff
-            try:
-                exec cmd
-                recoLog.info(cmd)
-            except AttributeError:
-                recoLog.error("Can not switch off detector %s", detOff)
-                raise
-
-        if 'InDetFlags' in dir():
-           InDetFlags.usePrimVertexZcoordinate(recConfig.usePrimVertexZcoordinate)
-           InDetFlags.doSlimming=recConfig.enableTrackSlimming
-
-           
-        #--------------------------------------------------------------
-        # Do the job!
-        #--------------------------------------------------------------
-        include( "RecExCommon/RecExCommon_topOptions.py" )
-
-        #
-        # Include user options
-        #
-        if recConfig.postOptionsESD:
-            # Signal to include file that this is the postOptions,
-            # in case the jobConfig is also the postOptions
-            isPostOptions = True
-            include( recConfig.postOptionsESD )
-        #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-        #if align.doVP1():
-        #    from VP1Algs.VP1AlgsConf import VP1Alg
-        #    topSequence += VP1Alg()
-	
-    def configureCosmicReco(self) :
-
-        from AthenaCommon.DetFlags import DetFlags
-        DetFlags.Muon_setOn() 
-        DetFlags.ID_setOn()
-
-        #==============================================================
-        # Job Configuration parameters:
-        #==============================================================
-        # Signal to include file that this is not the postOptions,
-        # in case the jobConfig is also the postOptions
-        isPostOptions = False
-                
-        #--- Configuration part: ---------------------------------------
-        doRestrictedESD = recConfig.restrictedESD
-        doMinimalRec = recConfig.doMinimalRec
-        doBackTracking = recConfig.doBackTracking
-
-        indetRecos = ( 'xKalman', 'iPatRec', 'newTracking' )
-        doAODall=False  # TODO: = recConfig.<something>
-        # set all known flags to False
-        for reco in indetRecos:
-            exec 'do%s = False' % reco
-
-        #
-        # set requested flags to True
-        #
-        recosOn = []
-        recosAll = list(indetRecos)
-        if 'all' in recConfig.doIndetReco:
-            # add all known indet recos
-            for reco in indetRecos: recosOn.append(reco)
-
-        # add all requested recos (avoid doubles)
-        for reco in recConfig.doIndetReco:
-            if reco != 'all':
-                if reco not in recosOn : recosOn.append(reco)
-                if reco not in recosAll: recosAll.append(reco)
-        for reco in recosOn:
-            exec 'do%s = True' % reco
-
-        # Determine doAODall flag
-        doAODall = True
-        for reco in indetRecos:
-            if reco not in recosOn:
-                doAODall = False
-                break
-
-        # Switch off some parts of combined reco
-        if 'doObjMissingET' in recConfig.combinedRecoOff:
-            doObjMissingET=False
-
-        include( "RecExCond/RecExCommon_flags.py" )
-
-        # Switch off sub-detectors
-
-        include( "RecJobTransforms/csc_reco_detflags.py" )
-
-        if 'InDetFlags' in dir():
-           InDetFlags.usePrimVertexZcoordinate(recConfig.usePrimVertexZcoordinate)
-           InDetFlags.doSlimming=recConfig.enableTrackSlimming
-
- 
-        #--------------------------------------------------------------
-        # Do the job!
-        #--------------------------------------------------------------
-        include( "RecExCommon/RecExCommon_topOptions.py" )
-
-        #
-        # Include user options
-        #
-        if recConfig.postOptionsESD:
-            # Signal to include file that this is the postOptions,
-            # in case the jobConfig is also the postOptions
-            isPostOptions = True
-            include( recConfig.postOptionsESD )
-        #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-        #if align.doVP1():
-        #    from VP1Algs.VP1AlgsConf import VP1Alg
-        #    topSequence += VP1Alg()
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureMuonAlignment.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureMuonAlignment.py
deleted file mode 100644
index 2463c76ea17..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureMuonAlignment.py
+++ /dev/null
@@ -1,274 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-
-## @file:   ConfigureMuonAlignment.py
-## @brief:  Creates algorithms with tools necessary 
-#           for performing muon alignment.  All setups
-#           are done using flags set beforehand, so it
-#           is necessary to set the flags first.
-## @author: Robert Harrington <roberth@cern.ch>
-## @date:   10/19/2009
-
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-from GaudiKernel.Constants import VERBOSE,INFO,DEBUG
-
-## ConfigureMuonAlignment calls other classes to create AlignAlg and 
-#  reconfigure with tools specific to muon alignment.
-class ConfigureMuonAlignment() :
-
-    ## constructor
-    def __init__ ( self ) :
-        
-        # set defaults for muon alignment
-        align.alignmentType = 'GlobalChi2'
-        align.useSLFitter = True
-        align.runOutlierRemoval = False
-
-        if not align.fileRootName.is_locked() :
-            self.setFileRootName()
-        if not align.outputPath.is_locked() :
-            align.outputPath = align.fileRootName()
-        if not mualign.asztFilePath.is_locked() :
-            mualign.asztFilePath = align.fileRootName()
-
-        #self.muonIO = MuonAlignmentIOFiles()
-        #self.muonIO.setInitialAsztFilePath(mualign.initialAsztFilePath())
-        #self.muonIO.setAsztFilePath(mualign.asztFilePath())
-
-        if align.alignmentLevel() == 1 :
-            self.setL1()
-        elif align.alignmentLevel() == 23 :
-            self.setL23()
-        elif align.alignmentLevel() == 3 :
-            self.setL3()
-        else:
-            print "only L1, L2 and L3 implemented"
-            exit
-
-    ## sets root filename from aligflags
-    def setFileRootName(self) :
-        fileroot=str(align.alignmentLevel())+"_"+align.dataType()
-        if mualign.jobType()!="":
-            fileroot = fileroot + "_" + mualign.jobType()
-        align.fileRootName = fileroot
-        print "in ConfigMuonAlignment, fileroot=",fileroot
-
-    ## sets AlignmentFlags and MuonAlignmentFlags for L1 alignment
-    def setL1 ( self ) :
-        #align.derivativeType = 'Numerical'
-        align.alignmentLevel = 1        
-        align.requireOverlap = False
-        #self.setFullReco(True)
-        
-        level1modules = []
-        if mualign.doEndcap() :
-            
-            if mualign.endcapsToAlign=='A' or mualign.endcapsToAlign=='BOTH' :
-                level1modules.append('ECA')                
-            if mualign.endcapsToAlign=='C' or mualign.endcapsToAlign=='BOTH' :
-                level1modules.append('ECC')
-
-        if mualign.doBarrel() :
-            level1modules.append('Bar')
-            #mlog.warning("this isn't really implemented yet!!!")
-
-    ## sets AlignmentFlags and MuonAlignmentFlags for L2.3 alignment
-    def setL23 ( self ) :
-        align.alignmentLevel = 23
-
-    ## sets AlignmentFlags and MuonAlignmentFlags for L3 alignment
-    def setL3 ( self ) :
-        #if mualign.alignMDT():
-        #    align.derivativeType = 'Numerical'
-        #elif mualign.alignCSC():
-        #    align.derivativeType = 'Analytical'
-        #else:
-        #    align.derivativeType = 'unknown'
-        align.alignmentLevel = 3
-        #self.setFullReco(False)
-
-
-    ## sets AlignmentFlags and MuonAlignmentFlags for full reconstruction
-    #def setFullReco ( self, doFullReco = True ) :
-    #    mualign.useFullReco = doFullReco
-    #    if doFullReco : 
-    #        # align.fitterType should be set by Flags.py
-    #        if align.fitterType == 'CombMuonTrackFitter' :
-    #            align.useSLFitter = False
-    #    else:
-    #        align.fitterType = 'MCTB'
-    
-    ## created configured algorithm
-    def configureAlignment ( self, useAlternateAscii=False, isMC=True) :
-        
-        print "in configureAlignment"
-
-        self.setAlignmentDbTool(useAlternateAscii,isMC)
-        
-        # get AlignAlg without muon-specific tools
-        from TrkAlignGenAlgs.AlignAlgGetter import AlignAlgGetter
-        alignAlg = AlignAlgGetter().AlignAlgHandle()
-        
-        # add muon-specific tools using current MuonAlignment flags
-        
-        # MuonTrackCollectionProvider
-        if mualign.trackCollectionProvider()=='MuonTrackCollectionProvider':
-            from MuonAlignGenTools.MuonTrackCollectionProviderGetter import MuonTrackCollectionProviderGetter
-            alignAlg.TrackCollectionProvider = MuonTrackCollectionProviderGetter().MuonTrackCollectionProviderHandle()
-
-            # create instance of MuonMatchQuality
-            #from MuonTrackThroughCalo.ConfMuonTrackThroughCalo import ConfMuonTrackThroughCalo
-            #MuonTTC = ConfMuonTrackThroughCalo("MuonTrackThroughCalo")
-
-            from AthenaCommon.AppMgr import ToolSvc
-            #ToolSvc += MuonTTC
-
-            from MuonRecExample import MuonRecTools            
-            muonCombiTrackMaker = MuonRecTools.getPublicTool('MooTrackSteering')
-            #muonCombiTrackMaker.OutputLevel = DEBUG
-            muonCombiTrackMaker.OutputLevel = align.OutputLevel()
-
-            atlasExtrapolator=MuonRecTools.getPublicTool('AtlasExtrapolator')
-            from MuonCombinedTestTools.MuonCombinedTestToolsConf import MuonCombined__MuonTrackTagTestTool
-            combinedMuonTag = MuonCombined__MuonTrackTagTestTool(name = "CombinedMuonTag",
-                                                                 ExtrapolatorTool = atlasExtrapolator,
-                                                                 #TTCTool          = MuonTTC,
-                                                                 Chi2Cut          = 2500.)
-            ToolSvc += combinedMuonTag
-
-            alignAlg.TrackCollectionProvider.TagTool = combinedMuonTag
-
-        # create tool instance
-        elif mualign.trackCollectionProvider()=='TrackCollectionProvider':
-            from TrkAlignGenTools.TrackCollectionProviderGetter import TrackCollectionProviderGetter
-            alignAlg.TrackCollectionProvider = TrackCollectionProviderGetter().TrackCollectionProviderGetterHandle()
-        else:
-            print "Using default TrackCollectionProvider!"
-
-	# MuonTrackPreProcessor
-        from MuonAlignGenTools.MuonTrackPreProcessorGetter import MuonTrackPreProcessorGetter
-        alignAlg.AlignTrackPreProcessor = MuonTrackPreProcessorGetter().MuonTrackPreProcessorHandle()
-        
-	# MuonGeometryManagerTool
-        from MuonAlignGenTools.MuonGeometryManagerToolGetter import MuonGeometryManagerToolGetter
-        alignAlg.GeometryManagerTool = MuonGeometryManagerToolGetter().MuonGeometryManagerToolHandle()
-        
-	# MuonFillNtupleTool
-        from MuonAlignGenTools.MuonFillNtupleToolGetter import MuonFillNtupleToolGetter
-        alignAlg.FillNtupleTool = MuonFillNtupleToolGetter().MuonFillNtupleToolHandle()
-        
-	# MdtAlignDBTool
-        if mualign.alignMDT():
-            from MuonAlignGenTools.MdtAlignDBToolGetter import MdtAlignDBToolGetter
-            alignAlg.AlignDBTool = MdtAlignDBToolGetter().MdtAlignDBToolHandle()
-        elif mualign.alignCSC():
-            from MuonAlignGenTools.CscAlignDBToolGetter import CscAlignDBToolGetter
-            alignAlg.AlignDBTool = CscAlignDBToolGetter().CscAlignDBToolHandle()
-        else:
-            print '************ At the moment set to MdtAlignDBTool  *************'
-            print '*********** but please make sure what you are doing ***********'
-            from MuonAlignGenTools.MdtAlignDBToolGetter import MdtAlignDBToolGetter 
-            alignAlg.AlignDBTool = MdtAlignDBToolGetter().MdtAlignDBToolHandle()
-
-	# create MuonAlignModuleTool and configure tools
-        from MuonAlignGenTools.MuonAlignModuleToolGetter import MuonAlignModuleToolGetter
-        alignModTool = MuonAlignModuleToolGetter().MuonAlignModuleToolHandle()
-        alignAlg.AlignTool.AlignModuleTool = alignModTool
-        alignAlg.AlignTool.MatrixTool.AlignModuleTool = alignModTool
-        alignAlg.AlignTrackCreator.AlignModuleTool = alignModTool
-        alignAlg.AlignTrackDresser.DerivCalcTool.AlignModuleTool = alignModTool
-        
-        # set matrix tool output to DEBUG
-        alignAlg.AlignTool.MatrixTool.OutputLevel = 2
-        
-        # configure GlobalChi2AlignTool's output tree
-        globalChi2AlignTool = alignAlg.AlignTool
-        
-	# add RegionSelectionSvc
-        self.addRegionSelectionSvc()
-
-    ## configure database tools and MuonDetectorTool for alignment
-    def setAlignmentDbTool(self,useAlternateAscii,isMC) :
-
-        from AtlasGeoModel.MuonGM import GeoModelSvc
-        MuonDetectorTool = GeoModelSvc.DetectorTools[ "MuonDetectorTool" ]
-        MuonDetectorTool.OutputLevel = align.OutputLevel()
-        #MuonDetectorTool.OutputLevel = INFO
-
-        print "in setAlignmentDbTool, useAlternateAscii=",useAlternateAscii
-        if isMC:
-
-            #altASZTFile = ""
-            if mualign.doMultiLevelAlignment():
-                MuonDetectorTool.UseAsciiConditionData = 1            
-                MuonDetectorTool.UseConditionDb = 0
-            from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-            if useAlternateAscii:
-              #altASZTFile = self.muonIO.asztInputFile()
-                MuonDetectorTool.AlternateASZTFile = "asztInput.txt"
-                MuonDetectorTool.UseAsciiConditionData = 1            
-
-        # get MuonAlignmentDbTool if already configured, create one if not
-        from __main__ import ToolSvc
-        try:
-            muonAlignmentDbTool = ToolSvc.MGM_AlignmentDbTool
-        except:
-            from MuonCondTool.MuonCondToolConf import MuonAlignmentDbTool
-            muonAlignmentDbTool = MuonAlignmentDbTool("MGM_AlignmentDbTool")
-            ToolSvc += muonAlignmentDbTool
-            MuonDetectorTool.TheMuonAlignmentTool = muonAlignmentDbTool
-            
-        muonAlignmentDbTool.OutputLevel = align.OutputLevel()
-        #muonAlignmentDbTool.OutputLevel = DEBUG
-        muonAlignmentDbTool.DumpALines = False
-        if isMC and useAlternateAscii and align.alignmentLevel == 3:
-            muonAlignmentDbTool.ALinesFile = "asztInput.txt"
-        if not isMC:
-            muonAlignmentDbTool.ParlineFolders = ["/MUONALIGN/MDT/BARREL",
-                                                  "/MUONALIGN/MDT/ENDCAP/SIDEA",
-                                                  "/MUONALIGN/MDT/ENDCAP/SIDEC",
-                                                  "/MUONALIGN/TGC/SIDEA",
-                                                  "/MUONALIGN/TGC/SIDEC"]
-        print "doMultiLevelAlignment: ",mualign.doMultiLevelAlignment()
-
-        if mualign.doMultiLevelAlignment() :
-            from MuonCondTool.MuonCondToolConf import MultiLevelAlignmentDbTool
-            MultiLevelAlignmentDbTool = MultiLevelAlignmentDbTool("MultiLevelAlignmentDbTool")
-            MultiLevelAlignmentDbTool.ABLineDbTool = muonAlignmentDbTool
-            if align.alignmentLevel == 1:
-                MultiLevelAlignmentDbTool.L1AsciiFile = "level1input.txt"
-            elif align.alignmentLevel == 23:
-                MultiLevelAlignmentDbTool.L23AsciiFile = "level23input.txt"
-            elif align.alignmentLevel == 3:
-                MultiLevelAlignmentDbTool.L3AsciiFile = "asztInput.txt"
-            else:
-                print "*** Alignment level: ", align.alignmentLevel,\
-                      "not yet implemented in MultiLevelAlignmentDbTool ***"
-            MultiLevelAlignmentDbTool.OutputLevel = align.OutputLevel()
-            #MultiLevelAlignmentDbTool.OutputLevel = INFO
-
-            #MultiLevelAlignmentDbTool.MuonIdHelperTool = ToolSvc.MuonIdHelperTool
-            ToolSvc += MultiLevelAlignmentDbTool
-            
-            MuonDetectorTool.TheMuonAlignmentTool = MultiLevelAlignmentDbTool
-
-        #from IOVDbSvc.CondDB import conddb
-        #conddb.addOverride("/MUONALIGN/MDT/ENDCAP/SIDEA","MuonAlignMDTEndCapAAlign-2010-01-02")
-        #conddb.addOverride("/MUONALIGN/MDT/ENDCAP/SIDEC","MuonAlignMDTEndCapCAlign-2010-01-02")
-
-        print ToolSvc
-
-    ## add RegionSelectionSvc
-    def addRegionSelectionSvc(self) :
-        from MuonCalibStandAloneBase.MuonCalibStandAloneBaseConf import RegionSelectionSvc
-        RegionSelectionSvc = RegionSelectionSvc(PrintList = True)
-        RegionSelectionSvc.Region = mualign.chamberSelectionString()
-        
-        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-        svcMgr += RegionSelectionSvc
-        print RegionSelectionSvc
-        
-        
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureMuonStandaloneReco.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureMuonStandaloneReco.py
deleted file mode 100644
index a8af3b17104..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureMuonStandaloneReco.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   ConfigureMuonStandaloneReco.py
-## @brief:  Used to setup muon standalone reconstruction for 
-#           track-based alignment.  
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Include import include
-
-from MuonRecExample.MuonRecFlags import muonRecFlags, mooreFlags, muonboyFlags
-from RecJobTransforms.RecConfig import recConfig
-from RecExConfig.RecAlgsFlags import recAlgs as recAlgsFlags
-from RecExConfig.RecFlags import rec 
-
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-## ConfigureMuonStandaloneReco sets up muon reco for track-based alignment
-class ConfigureMuonStandaloneReco () :
-
-    def configureReco(self) :
-        from AthenaCommon.DetFlags import DetFlags
-        DetFlags.Muon_setOn()
-        DetFlags.Calo_setOff()
-        
-        recAlgsFlags.doMuonIDStandAlone = False
-        recAlgsFlags.doMuonIDCombined   = False
-
-        # add some more flags available for standalone running
-        import MuonRecExample.MuonRecStandaloneFlags
-        
-         # configure flags so that only Muon Standalone reco is run
-        import MuonRecExample.MuonRecStandaloneOnlySetup
-
-        muonRecFlags.useAlignmentCorrections = mualign.useOpticalAlignment()
-
-        # cosmics setup
-        #if align.dataType()=='cosmic' or align.dataType()=='simCosmic':
-
-        ##### no more flags after this line #####
-        print "align.dataType()=",align.dataType()
-        if align.dataType()=='data' or align.dataType()=='cosmic' :
-            muonRecTopOptions="MuonAlignGenTools/MuonDataRec_myTopOptions.py"
-        else :
-            muonRecTopOptions="MuonRecExample/MuonRec_topOptions.py"
-        try:
-            include(muonRecTopOptions)
-            
-        ###### put any user finetuning before this line #####
-        except:
-            # always write config so far for debugging
-            from AthenaCommon.ConfigurationShelve import saveToAscii
-            saveToAscii("config.txt")
-            # but still exit with error
-            raise
-        
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureSolveMuonAlignment.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureSolveMuonAlignment.py
deleted file mode 100644
index 4135dabd4d3..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/ConfigureSolveMuonAlignment.py
+++ /dev/null
@@ -1,249 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-
-## @file:   ConfigureSolveMuonAlignment.py
-## @brief:  Creates SolveAlign algorithm with tools necessary 
-#           for performing muon alignment.  All setups
-#           are done using flags set beforehand, so it
-#           is necessary to set the flags first.
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/23/2009
-###  Modified on Mar-28-2010 -- Prolay Mal (prolay@physics.arizona.edu)
-###             For L3 CSC alignment
-
-
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-
-## ConfigureSolveMuonAlignment calls other classes to create SolveAlign and 
-#  reconfigure with tools specific to muon alignment.
-class ConfigureSolveMuonAlignment() :
-
-    ## initialize
-    def __init__ ( self ) :
-        
-        # set defaults for muon alignment
-        align.alignmentType = 'GlobalChi2'
-        align.useSLFitter = True
-        align.runOutlierRemoval = False
-        
-        self.setFileRootName()
-        self.muonIO = MuonAlignmentIOFiles()
-
-        if align.alignmentLevel() == 1 :
-            self.setL1()
-        elif align.alignmentLevel() == 3 :
-            self.setL3()
-        else:
-            print "only L1 and L3 implemented"
-            exit
-
-    ## sets root filename from aligflags
-    def setFileRootName(self) :
-        fileroot=str(align.alignmentLevel())+"_"+align.dataType()
-        if mualign.jobType()!="":
-            fileroot = fileroot + "_" + mualign.jobType()
-        align.fileRootName = fileroot
-        print "in ConfigMuonAlignment, fileroot=",fileroot
-
-    ## sets AlignmentFlags and MuonAlignmentFlags for L1 alignment
-    def setL1 ( self ) :
-        align.derivativeType = 'Numerical'
-        align.alignmentLevel = 1        
-        align.requireOverlap = False
-        self.setFullReco(True)
-
-        mualign.alignMDT              = True
-        level1modules = []
-        if mualign.doEndcap() :
-
-            if mualign.endcapsToAlign=='A' or mualign.endcapsToAlign=='BOTH' :
-                level1modules.append(0)                
-            if mualign.endcapsToAlign=='C' or mualign.endcapsToAlign=='BOTH' :
-                level1modules.append(1)
-
-        if mualign.doBarrel() :
-            level1modules.append(2)
-            mlog.warning("this isn't really implemented yet!!!")
-
-    ## sets AlignmentFlags and MuonAlignmentFlags for L3 alignment
-    def setL3 ( self ) :
-        if mualign.alignMDT():
-            align.derivativeType = 'Numerical'
-        elif mualign.alignCSC():
-            align.derivativeType = 'Analytical'
-        else:
-            align.derivativeType = 'unknown'
-        align.alignmentLevel = 3
-        self.setFullReco(False)
-
-    ## sets AlignmentFlags and MuonAlignmentFlags for full reconstruction
-    def setFullReco ( self, doFullReco = True ) :
-        mualign.useFullReco = doFullReco
-        from AthenaCommon.DetFlags import DetFlags
-        DetFlags.Muon_setOn()
-        if doFullReco :             
-            DetFlags.ID_setOn()
-            # align.fitterType should be set by L1MdtEndcapOnlyFlags.py
-            if align.fitterType == 'CombMuonTrackFitter' :
-                align.useSLFitter = False
-        else:
-            align.fitterType = 'MCTB'
-
-    ## sets AlignmentFlags and MuonAlignmentFlags for multilevel alignment
-    def doMultiLevelAlignment(self) :
-        doMultiLevelAlignment = False
-        if align.alignmentLevel()!=3 : 
-            if align.iteration()>0 or mualign.jobType()=='misal' :
-                doMultiLevelAlignment = True
-        mualign.doMultiLevelAlignment = doMultiLevelAlignment
-        return doMultiLevelAlignment
-    
-    ## created configured algorithm
-    def configureSolveAlignment ( self, useAlternateAscii=False ) :
-        
-        self.setAlignmentDbTool(useAlternateAscii)
-        
-        # get AlignAlg without muon-specific tools
-        from TrkAlignGenAlgs.AlignSolveGetter import AlignSolveGetter
-        solveAlign = AlignSolveGetter().AlignSolveHandle()
-        
-        # add muon-specific tools using current MuonAlignment flags
-        
-	# MuonGeometryManagerTool
-        from MuonAlignGenTools.MuonGeometryManagerToolGetter import MuonGeometryManagerToolGetter
-        solveAlign.GeometryManagerTool = MuonGeometryManagerToolGetter().MuonGeometryManagerToolHandle()
-        
-        # Csc/MdtAlignDBTool
-        if mualign.alignMDT():            
-            from MuonAlignGenTools.MdtAlignDBToolGetter import MdtAlignDBToolGetter
-            solveAlign.AlignDBTool = MdtAlignDBToolGetter().MdtAlignDBToolHandle()
-        elif mualign.alignCSC():
-            from MuonAlignGenTools.CscAlignDBToolGetter import CscAlignDBToolGetter
-            solveAlign.AlignDBTool = CscAlignDBToolGetter().CscAlignDBToolHandle()
-        else:
-            print '************ At the moment set to MdtAlignDBTool  *************'
-            print '*********** but please make sure what you are doing ***********'
-            from MuonAlignGenTools.MdtAlignDBToolGetter import MdtAlignDBToolGetter 
-            solveAlign.AlignDBTool = MdtAlignDBToolGetter().MdtAlignDBToolHandle()
-
-	# create MuonAlignModuleTool and configure tools
-        from MuonAlignGenTools.MuonAlignModuleToolGetter import MuonAlignModuleToolGetter
-        alignModTool = MuonAlignModuleToolGetter().MuonAlignModuleToolHandle()
-        solveAlign.AlignTool.AlignModuleTool = alignModTool
-        solveAlign.AlignTool.MatrixTool.AlignModuleTool = alignModTool
-        
-        # set matrix tool output to DEBUG
-        solveAlign.AlignTool.MatrixTool.OutputLevel = 2
-
-        # configure GlobalChi2AlignTool's output tree
-        globalChi2AlignTool = solveAlign.AlignTool
-        globalChi2AlignTool.DoShiftDerivTree = mualign.doShiftDerivTree()
-
-	# add RegionSelectionSvc
-        self.addRegionSelectionSvc()
-
-   ## created configured algorithm
-    def newConfigureSolveAlignment ( self ) :
-        
-        self.setAlignmentDbTool()
-        
-        # setup MCTB fitter (not used but needed for AlignTrackPreProcessor)
-
-        # get AlignAlg without muon-specific tools
-        from TrkAlignGenAlgs.AlignAlgGetter import AlignAlgGetter
-        solveAlign = AlignAlgGetter().AlignAlgHandle()
-        
-        # add muon-specific tools using current MuonAlignment flags
-        
-	# MuonGeometryManagerTool
-        from MuonAlignGenTools.MuonGeometryManagerToolGetter import MuonGeometryManagerToolGetter
-        solveAlign.GeometryManagerTool = MuonGeometryManagerToolGetter().MuonGeometryManagerToolHandle()
-        
-        
-	# Csc/MdtAlignDBTool
-        if mualign.alignMDT():
-            from MuonAlignGenTools.MdtAlignDBToolGetter import MdtAlignDBToolGetter
-            solveAlign.AlignDBTool = MdtAlignDBToolGetter().MdtAlignDBToolHandle()
-        elif mualign.alignCSC():
-            from MuonAlignGenTools.CscAlignDBToolGetter import CscAlignDBToolGetter
-            solveAlign.AlignDBTool = CscAlignDBToolGetter().CscAlignDBToolHandle()
-        else:
-            print '************ At the moment set to MdtAlignDBTool  *************'
-            print '*********** but please make sure what you are doing ***********'
-            from MuonAlignGenTools.MdtAlignDBToolGetter import MdtAlignDBToolGetter 
-            solveAlign.AlignDBTool = MdtAlignDBToolGetter().MdtAlignDBToolHandle()
-            
-	# create MuonAlignModuleTool and configure tools
-        from MuonAlignGenTools.MuonAlignModuleToolGetter import MuonAlignModuleToolGetter
-        alignModTool = MuonAlignModuleToolGetter().MuonAlignModuleToolHandle()
-        solveAlign.AlignTool.AlignModuleTool = alignModTool
-        solveAlign.AlignTool.MatrixTool.AlignModuleTool = alignModTool
-        
-        # set matrix tool output to DEBUG
-        solveAlign.AlignTool.MatrixTool.OutputLevel = 2
-
-        # configure GlobalChi2AlignTool's output tree
-        globalChi2AlignTool = solveAlign.AlignTool
-        globalChi2AlignTool.DoShiftDerivTree = mualign.doShiftDerivTree()
-
-	# add RegionSelectionSvc
-        self.addRegionSelectionSvc()
-
-        solveAlign.SolveOnly = True
-
-    ## configure database tools and MuonDetectorTool for alignment
-    def setAlignmentDbTool(self,useAlternateAscii) :
-
-        from AtlasGeoModel.MuonGM import GeoModelSvc
-        MuonDetectorTool = GeoModelSvc.DetectorTools[ "MuonDetectorTool" ]
-        MuonDetectorTool.OutputLevel = align.OutputLevel()
-        altASZTFile = ""
-        if mualign.doMultiLevelAlignment():
-            MuonDetectorTool.UseAsciiConditionData = 1            
-            MuonDetectorTool.UseConditionDb = 1
-        else :
-            print "doMultiLevelAlignment=False"
-        from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-        if useAlternateAscii:
-            altASZTFile = self.muonIO.asztInputFile()
-            MuonDetectorTool.AlternateASZTFile = altASZTFile
-        print MuonDetectorTool
-
-        from MuonCondTool.MuonCondToolConf import MuonAlignmentDbTool
-        MuonAlignmentDbTool = MuonAlignmentDbTool("MGM_AlignmentDbTool")
-        MuonAlignmentDbTool.ParlineFolders = ["/MUONALIGN/MDT/BARREL",
-                                              "/MUONALIGN/MDT/ENDCAP/SIDEA",
-                                              "/MUONALIGN/MDT/ENDCAP/SIDEC",
-                                              "/MUONALIGN/TGC/SIDEA",
-                                              "/MUONALIGN/TGC/SIDEC"]
-        MuonAlignmentDbTool.OutputLevel = align.OutputLevel()
-        
-        from __main__ import ToolSvc
-        ToolSvc += MuonAlignmentDbTool
-        
-        if mualign.doMultiLevelAlignment() :
-            from MuonCondTool.MuonCondToolConf import MultiLevelAlignmentDbTool
-            MultiLevelAlignmentDbTool = MultiLevelAlignmentDbTool("MultiLevelAlignmentDbTool")
-            MultiLevelAlignmentDbTool.ABLineDbTool = ToolSvc.MGM_AlignmentDbTool
-            MultiLevelAlignmentDbTool.L1AsciiFile = self.muonIO.inputLevel1File()
-            MultiLevelAlignmentDbTool.OutputLevel = align.OutputLevel()
-            ToolSvc += MultiLevelAlignmentDbTool
-            
-            MuonDetectorTool.TheMuonAlignmentTool = MultiLevelAlignmentDbTool
-        else:
-            MuonDetectorTool.TheMuonAlignmentTool = MuonAlignmentDbTool
-
-    ## add RegionSelectionSvc
-    def addRegionSelectionSvc(self) :
-        from MuonCalibStandAloneBase.MuonCalibStandAloneBaseConf import RegionSelectionSvc
-        RegionSelectionSvc = RegionSelectionSvc(PrintList = True)
-        RegionSelectionSvc.Region = mualign.moduleSelectionString()
-        
-        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-        svcMgr += RegionSelectionSvc
-        print RegionSelectionSvc
-        
-        
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/CscAlignDBToolGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/CscAlignDBToolGetter.py
deleted file mode 100644
index 92d33139927..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/CscAlignDBToolGetter.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-## @file:   CscAlignDBToolGetter.py
-## @brief:  Creates and configures CscAlignDBTool.
-## @author: Prolay Mal (prolay@physics.arizona.edu)
-## @date:   03/28/2010
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-from AthenaCommon.Constants import *
-
-## CscAlignDBToolGetter creates and configures CscAlignDBTool, but does
-#  not add to ToolSvc.  User must add to a tool as a private tool, or add to 
-#  ToolSvc.
-class CscAlignDBToolGetter ( Configured ) :
-
-    _name = 'CscAlignDBToolGetter'
-
-    ## create and configure MdtAlignDBTool using pre-set flags
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        muonIO = MuonAlignmentIOFiles()
-
-        # create tool instance
-
-        from __main__ import ToolSvc
-
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__CscAlignDBTool
-        muonAlignDBTool = Muon__CscAlignDBTool(OutputLevel = align.OutputLevel(),
-                                               ABLineDbTool = ToolSvc.MGM_AlignmentDbTool,
-                                               ASZTOutputFile = muonIO.asztOutputFile(),
-                                               AlternateASZTFile = str(''),
-                                               SigmaOutputFile = '',
-                                               SigmaInputFile = '',
-                                               UseMultiLevelDbTool = mualign.doMultiLevelAlignment()) 
-        if mualign.useAlternateASZT() : 
-            muonAlignDBTool.AlternateASZTFile = muonIO.asztInputFile()
-        self._CscAlignDBToolHandle = muonAlignDBTool
-
-        if mualign.doMultiLevelAlignment :
-            MultiLevelAlignmentDbTool = ToolSvc.MultiLevelAlignmentDbTool
-        else:
-            from MuonCondTool.MuonCondToolConf import MultiLevelAlignmentDbTool
-            MultiLevelAlignmentDbTool = MultiLevelAlignmentDbTool("MultiLevelAlignmentDbTool")
-            MultiLevelAlignmentDbTool.ABLineDbTool = ToolSvc.MGM_AlignmentDbTool
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    ## return handle to CscAlignDBTool
-    def CscAlignDBToolHandle ( self ) :
-        return self._CscAlignDBToolHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/IOFiles.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/IOFiles.py
deleted file mode 100644
index fd3a163e30b..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/IOFiles.py
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   ALinesFiles.py
-## @brief:  Returns names for input and output 
-#           A-lines files.  Can be used outside 
-#           ATHENA framework.  
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-## ALinesFiles is used to return names of input and output 
-#  A-lines files outside the Athena framework.
-class IOFiles() :
-    def __init__(self) :
-        IOFiles.initialAsztFilePath = "asztfiles"
-        IOFiles.asztFilePath = "."
-        IOFiles.rootFilePath = "."
-
-    def setInitialAsztFilePath(self, initPath) :
-        IOFiles.initialAsztFilePath = initPath
-        return
-
-    def setAsztFilePath(self, initPath) :
-        IOFiles.asztFilePath = initPath
-        return
-    def setRootFilePath(self, initPath) :
-        IOFiles.rootFilePath = initPath
-        return
-
-    def level1AsciiFile(self,name,iteration=0,index=-1) :
-        if(iteration<1):
-            return self.getPath(self.initialAsztFilePath)+\
-                   self.level1AsciiFileName(name,iteration,index)
-        else:
-            return self.getPath(self.asztFilePath)+\
-                   self.level1AsciiFileName(name,iteration,index)
-
-    def inputLevel1File(self,name,iteration=0,index=-1) :
-        if(iteration<1):
-            return self.getPath(self.initialAsztFilePath)+\
-                   self.inputLevel1FileName(name,iteration,index)
-        else:
-            return self.getPath(self.asztFilePath)+\
-                   self.inputLevel1FileName(name,iteration,index)
-
-    def asztInputFile(self,name,iteration=0,index=-1) :
-        if(iteration<1):
-            return self.getPath(self.initialAsztFilePath)+\
-                   self.asztInputFileName(name,iteration,index)
-        else:
-            return self.getPath(self.asztFilePath)+\
-                   self.asztInputFileName(name,iteration,index)
-    
-    def asztOutputFile(self,name,iteration=0,index=-1) :
-        return self.getPath(self.asztFilePath)+\
-               self.asztOutputFileName(name,iteration,index)
- 
-    def asztInputFileName(self,name,iteration=0,index=-1) :
-        if(iteration<1):
-            return name+".txt"
-        else:
-            return self.asztFileName(name,iteration-1,index)
-
-    def asztOutputFileName(self,name,iteration=0,index=-1) :
-        return self.asztFileName(name,iteration,index)
-
-    def asztFileName(self,name,iteration,index) :
-        return name+self.getString(iteration,index)+".txt"
-
-    def level1AsciiFileName(self,name,iteration,index) :
-        return "level1_"+name+self.getString(iteration,index)+".txt"
-
-    def inputLevel1FileName(self,name,iteration,index) :
-        return "level1_"+name+self.getString(iteration-1,index)+".txt"
-
-    def ntupleFileName(self,name,iteration=0,index=-1) :
-        return "MuonAlign_"+name+self.getString(iteration,index)+".root"
-
-    def ntupleFilePath(self) :
-        return self.getPath(self.rootFilePath)
-
-    def ntupleFile(self,name,iteration=0,index=-1):
-        return self.ntupleFilePath() + self.ntupleFileName(name,iteration,index)
-        
-    def getString(self,iteration,index) :
-        retstring = ""
-        if iteration>-1:
-            retstring += "_iter"+str(iteration)
-        if str(index) == "*":
-            retstring += "_index*"
-        elif index>-1:
-            retstring += "_index"+str(index)
-        return retstring
-
-    def getPath(self,path):
-        if len(path)>0 and not path.endswith("/"):
-            path += "/"
-        elif len(path)==0:
-            path = "./"
-        return path
-       
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MdtAlignDBToolGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MdtAlignDBToolGetter.py
deleted file mode 100644
index 9589a42fa4e..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MdtAlignDBToolGetter.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   MdtAlignDBToolGetter.py
-## @brief:  Creates and configures MdtAlignDBTool.
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-from AthenaCommon.Constants import *
-
-## MdtAlignDBToolGetter creates and configures MdtAlignDBTool, but does
-#  not add to ToolSvc.  User must add to a tool as a private tool, or add to 
-#  ToolSvc.
-class MdtAlignDBToolGetter ( Configured ) :
-
-    _name = 'MdtAlignDBToolGetter'
-
-    ## create and configure MdtAlignDBTool using pre-set flags
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        muonIO = MuonAlignmentIOFiles()
-
-        # create tool instance
-        
-        from __main__ import ToolSvc
-        
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MdtAlignDBTool
-        muonAlignDBTool = Muon__MdtAlignDBTool(OutputLevel = DEBUG, #align.OutputLevel(),
-                                               ABLineDbTool = ToolSvc.MGM_AlignmentDbTool,
-                                               #MultiLevelAlignmentDbTool = ToolSvc.MGM_AlignmentDbTool,
-                                                #ASZTOutputFile = muonIO.asztOutputFile(),
-                                                ASZTOutputFile = "asztOutput.txt",
-                                                AlternateASZTFile = str(''),
-                                                SigmaOutputFile = '',
-                                                SigmaInputFile = '',
-                                                UseMultiLevelDbTool = mualign.doMultiLevelAlignment()) 
-                                                #UseMultiLevelDbTool = True)
-                                                #StoreL3Params = False)
-        
-        if mualign.useAlternateASZT() : 
-            #muonAlignDBTool.AlternateASZTFile = muonIO.asztInputFile()
-            muonAlignDBTool.AlternateASZTFile = "asztInput.txt"
-        self._MdtAlignDBToolHandle = muonAlignDBTool
-        if mualign.doMultiLevelAlignment :
-            MultiLevelAlignmentDbTool = ToolSvc.MultiLevelAlignmentDbTool
-        else:
-            from MuonCondTool.MuonCondToolConf import MultiLevelAlignmentDbTool
-            MultiLevelAlignmentDbTool = MultiLevelAlignmentDbTool("MultiLevelAlignmentDbTool")
-            MultiLevelAlignmentDbTool.ABLineDbTool = ToolSvc.MGM_AlignmentDbTool
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    ## return handle to MdtAlignDBTool
-    def MdtAlignDBToolHandle ( self ) :
-        return self._MdtAlignDBToolHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MdtGeometryManagerToolGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MdtGeometryManagerToolGetter.py
deleted file mode 100644
index d329c83407c..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MdtGeometryManagerToolGetter.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   MdtGeometryManagerToolGetter.py
-## @brief:  Creates and configures MdtGeometryManagerTool.
-## @author: Robert Harrington <roberth@cern.ch>
-## @date:   02/22/2011
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-## Created and configures MdtGeometryManagerTool as a public tool, added 
-#  to ToolSvc
-class MdtGeometryManagerToolGetter ( Configured ) :
-
-    _name = 'MdtGeometryManagerToolGetter'
-
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        # create tool instance
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MdtGeometryManagerTool
-        mdtGeometryManagerTool = Muon__MdtGeometryManagerTool(OutputLevel = align.OutputLevel(),
-                                                               MdtAlignParameters = mualign.mdtAlignParams())
-        self._MdtGeometryManagerToolHandle = mdtGeometryManagerTool
-
-        mlog.info(" now adding to ToolSvc" )
-        from __main__ import ToolSvc
-        ToolSvc += self.MdtGeometryManagerToolHandle()
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    def MdtGeometryManagerToolHandle ( self ) :
-        return self._MdtGeometryManagerToolHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignDBToolGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignDBToolGetter.py
deleted file mode 100644
index 5ae9d716692..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignDBToolGetter.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   MuonAlignDBToolGetter.py
-## @brief:  Creates and configures MuonAlignDBTool.
-## @author: Robert Harrington <roberth@cern.ch>
-## @date:   3/7/2011
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-from AthenaCommon.Constants import *
-
-## MuonAlignDBToolGetter creates and configures MuonAlignDBTool, but does
-#  not add to ToolSvc.  User must add to a tool as a private tool, or add to 
-#  ToolSvc.
-class MuonAlignDBToolGetter ( Configured ) :
-
-    _name = 'MuonAlignDBToolGetter'
-
-    ## create and configure MuonAlignDBTool using pre-set flags
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        muonIO = MuonAlignmentIOFiles()
-
-        # create tool instance
-        
-        from __main__ import ToolSvc
-        
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonAlignDBTool
-        muonAlignDBTool = Muon__MuonAlignDBTool(OutputLevel = DEBUG, #align.OutputLevel(),
-                                                ASZTOutputFile = "asztOutput.txt",
-                                                AlternateASZTFile = str(''),
-                                                SigmaOutputFile = '',
-                                                SigmaInputFile = '',
-                                                UseMultiLevelDbTool = mualign.doMultiLevelAlignment()) 
-        
-        if mualign.useAlternateASZT() : 
-            muonAlignDBTool.AlternateASZTFile = "asztInput.txt"
-        self._MuonAlignDBToolHandle = muonAlignDBTool
-        if mualign.doMultiLevelAlignment :
-            MultiLevelAlignmentDbTool = ToolSvc.MultiLevelAlignmentDbTool
-        else:
-            from MuonCondTool.MuonCondToolConf import MultiLevelAlignmentDbTool
-            MultiLevelAlignmentDbTool = MultiLevelAlignmentDbTool("MultiLevelAlignmentDbTool")
-            MultiLevelAlignmentDbTool.ABLineDbTool = ToolSvc.MGM_AlignmentDbTool
-            
-        mlog.info(" leaving configure" )
-
-        return True
-
-    ## return handle to MuonAlignDBTool
-    def MuonAlignDBToolHandle ( self ) :
-        return self._MuonAlignDBToolHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignModuleToolGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignModuleToolGetter.py
deleted file mode 100644
index 839946e8687..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignModuleToolGetter.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   MuonAlignModuleToolGetter.py
-## @brief:  Creates and configures MuonAlignModuleTool.
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-## MuonAlignModuleToolGetter creates and configures MuonAlignModuleTool, but 
-#  does not add to ToolSvc.  User must add to a tool as a private tool, or add to 
-#  ToolSvc.
-class MuonAlignModuleToolGetter ( Configured ) :
-
-    _name = 'MuonAlignModuleToolGetter'
-
-    ## creates and configures MuonAlignModuleTool using pre-set flags.
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        # create tool instance
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonAlignModuleTool
-        muonAlignModuleTool = Muon__MuonAlignModuleTool(OutputLevel = align.OutputLevel(),
-                                                        AlignModuleListType = mualign.alignModuleListType())
-                
-        self._MuonAlignModuleToolHandle = muonAlignModuleTool
-
-        mlog.info(" now adding to ToolSvc" )
-        from __main__ import ToolSvc
-        ToolSvc += self.MuonAlignModuleToolHandle()
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    ## returns handle to MuonAlignModuleTool
-    def MuonAlignModuleToolHandle ( self ) :
-        return self._MuonAlignModuleToolHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignRefitToolGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignRefitToolGetter.py
deleted file mode 100644
index 777509c96f5..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignRefitToolGetter.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   MuonAlignRefitToolGetter.py
-## @brief:  Creates and configures MuonAlignRefitTool.
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   11/26/2010
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-## MuonAlignRefitToolGetter creates and configures MuonAlignRefitTool, but 
-## does not add to ToolSvc.  User must add to a tool as a private tool, or add to 
-#  ToolSvc.
-class MuonAlignRefitToolGetter ( Configured ) :
-
-    _name = 'MuonAlignRefitToolGetter'
-
-    ## creates and configures MuonAlignRefitTool using pre-set flags.
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        from TrkAlignGenTools.AlignmentTrackFitter import AlignmentTrackFitter
-        #from MuonTrackFinderTools.MuonTrackFinderToolsConf import Muon__MuonRefitTool
-        from MuonTrackFinderTools.MuonTrackFinderToolsConf import Muon__MuonRefitTool
-        muonRefitTool = Muon__MuonRefitTool("MuonRefitToolForAlignment",
-                                            OutputLevel = align.OutputLevel(),
-                                            Fitter = AlignmentTrackFitter().fitter())
-
-        from __main__ import ToolSvc
-        ToolSvc += muonRefitTool
-
-        # create tool instance
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonAlignRefitTool
-        muonAlignRefitTool = Muon__MuonAlignRefitTool(OutputLevel = align.OutputLevel())
-
-        combmu = mualign.selectCombinedMuons()
-
-        muonAlignRefitTool.MuonRefitTool         = muonRefitTool
-
-        muonAlignRefitTool.RemoveBIS8Hits        = False
-        muonAlignRefitTool.RemoveTGCHits         = False
-        muonAlignRefitTool.RemoveTGCEtaHits      = True
-        muonAlignRefitTool.RemoveRPCEtaHits      = True
-        muonAlignRefitTool.RemoveCSCPhiHits      = True
-        muonAlignRefitTool.DeclusterTGCHits      = False
-        muonAlignRefitTool.RemoveSmallBarrelHits = False
-
-        muonAlignRefitTool.RemoveCSCHits         = mualign.removeCSCHits()
-        muonAlignRefitTool.RemoveBEEHits         = not mualign.alignEE()
-        muonAlignRefitTool.RemoveEEHits          = not mualign.alignEE()
-
-        muonAlignRefitTool.RemoveBarrelHits      = not mualign.alignBarrel()
-        muonAlignRefitTool.RemoveEndcapHits      = not mualign.alignEndcap()
-        muonAlignRefitTool.RemoveTRTHits         = mualign.removeTRTHits()
-        muonAlignRefitTool.RemoveScattering      = not align.includeScatterers()
-
-        muonAlignRefitTool.RecreateStartingParameters = not mualign.selectCombinedMuons()
-        muonAlignRefitTool.ExtrapolateToMuonEntry     = not mualign.selectCombinedMuons()
-
-        self._MuonAlignRefitToolHandle = muonAlignRefitTool
-
-        mlog.info(" now adding to ToolSvc" )
-        from __main__ import ToolSvc
-        ToolSvc += self.MuonAlignRefitToolHandle()
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    ## returns handle to MuonAlignRefitTool
-    def MuonAlignRefitToolHandle ( self ) :
-        return self._MuonAlignRefitToolHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignmentFlags.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignmentFlags.py
deleted file mode 100644
index 89a62541d0e..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignmentFlags.py
+++ /dev/null
@@ -1,788 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-## @file:   MuonAlignmentFlags.py
-## @brief:  Flags specific to muon alignment, inherit from 
-## 	    JobProperty
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-##  Modified by Prolay Mal March-28-2010
-##           Incoporated the Csc specific stuffs
-############################################################
-
-
-__author__ = 'Robert Harrington'
-__version__ = ""
-__doc__ = "Muon Alignment specific flags"
-
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
-from AthenaCommon.Logging import logging
-from AthenaCommon.Constants import *
-
-from MuonRecExample.MuonRecFlags import muonRecFlags
-from RecExConfig.RecFlags import rec as recFlags
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-from PerfMonComps.PerfMonFlags import jobproperties as perfMonJobProperties
-perfMonFlags = perfMonJobProperties.PerfMonFlags
-
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-
-mlog = logging.getLogger( 'MuonAlignmentFlags.py' )
-
-_flags = []
-
-# define default flags
-class alignMDT(JobProperty) :
-    """ flag to set alignment of MDT chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(alignMDT)
-
-class alignTGC(JobProperty) :
-    """ flag to set alignment of TGC chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(alignTGC)
-
-class alignRPC(JobProperty) :
-    """ flag to set alignment of RPC chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(alignRPC)
-
-class alignCSC(JobProperty) :
-    """ flag to set alignment of CSC chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(alignCSC)
-
-class mdtAlignTraX(JobProperty) :
-    """ sets alignment of x-translation for MDT """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignTraX)
-
-class mdtAlignTraY(JobProperty) :
-    """ sets alignment of y-translation for MDT """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignTraY)
-
-class mdtAlignTraZ(JobProperty) :
-    """ sets alignment of z-translation for MDT """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignTraZ)
-    
-class mdtAlignRotX(JobProperty) :
-    """ sets alignment of x-rotation for MDT """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignRotX)
-
-class mdtAlignRotY(JobProperty) :
-    """ sets alignment of y-rotation for MDT """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignRotY)
-
-class mdtAlignRotZ(JobProperty) :
-    """ sets alignment of z-rotation for MDT """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignRotZ)
-    
-class xyRotZPosition(JobProperty) :
-    """ position along z-axis of xy-rotations for L1 alignment """
-    statusOn = True
-    allowedType = ['float']
-    StoredValue = 0.
-_flags.append(xyRotZPosition)
-
-class modulesToAlign(JobProperty) :
-    """ Modules to align (for alignmentLevel<L3)"""
-    statusOn = True
-    allowedType = ['list']
-    StoredValue = [] 
-_flags.append(modulesToAlign)
-
-class alignEE(JobProperty) :
-    """ Align EEL/BEE chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(alignEE)
-
-class alignEndcap(JobProperty) :
-    """ Align endcap chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(alignEndcap)
-
-class alignBarrel(JobProperty) :
-    """ Align barrel chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(alignBarrel)
-    
-class applyStandardSelectionCuts(JobProperty) :
-    """ flag to apply standard selection cuts """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(applyStandardSelectionCuts)
-
-class applySelectionCuts(JobProperty) :
-    """ flag to apply selection cuts """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(applySelectionCuts)
-
-class cutOnTrackChisquare(JobProperty) :
-    """ flag to apply chisquare cuts on track selection """
-    statusOn = True
-    allowedType = ['double']
-    StoredValue = 5.0
-_flags.append(cutOnTrackChisquare)
-
-class cutOnNumHolesOnTrack(JobProperty) :
-    """ flag to remove holes on the tracks  """
-    statusOn = True
-    allowedType = ['int']
-    StoredValue = 0
-_flags.append(cutOnNumHolesOnTrack)
-
-class cutOnNumOutlierOnTrack(JobProperty) :
-    """ flag to apply allowed number of outliers on the tracks  """
-    statusOn = True
-    allowedType = ['int']
-    StoredValue = 1
-_flags.append(cutOnNumOutlierOnTrack)
-
-class cutOnMaxDriftSignSum(JobProperty) :
-    """ flag to apply allowed number of outliers on the tracks  """
-    statusOn = True
-    allowedType = ['double']
-    StoredValue = 2.0
-_flags.append(cutOnMaxDriftSignSum)
-
-class cutOnBarrelTracks(JobProperty) :
-    """ flag to remove tracks that pass through the barrel """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(cutOnBarrelTracks)
-
-class requireOuterLayerECTracks(JobProperty) :
-    """ flag to remove tracks that don't pass through the outer layer endcap MDT """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(requireOuterLayerECTracks)
-
-class requireInnerLayerECTracks(JobProperty) :
-    """ flag to remove tracks that don't pass through the inner layer endcap MDT """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(requireInnerLayerECTracks)
-
-class requireOneHitPerTubeLayerEC(JobProperty) :
-    """ flag to remove tracks that don't have at least 1 hit per tube layer"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(requireOneHitPerTubeLayerEC)
-
-class requireBarrelECOverlap(JobProperty) :
-    """ flag to remove tracks that don't have at least 1 hit in both barrel and endcap"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(requireBarrelECOverlap)
-
-class requireSmallLargeOverlap(JobProperty) :
-    """ flag to remove tracks that don't have at least 1 hit in a small and a large MDT chamber"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(requireSmallLargeOverlap)
-
-
-class requireRPCPhiHit(JobProperty) :
-    """ flag to remove tracks that don't have at least 1 RPC phi hit"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(requireRPCPhiHit)
-
-class removeBarrelHits(JobProperty) :
-    """ flag to remove barrel muon hits from tracks """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(removeBarrelHits)
-
-class removeEndcapHits(JobProperty) :
-    """ flag to remove endcap muon hits from tracks """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(removeEndcapHits)
-
-class redoErrorScaling(JobProperty) :
-    """ flag to redo error scaling for ROTs on track"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(redoErrorScaling)
-
-class pTCorrectTrack(JobProperty) :
-    """ flag to reset the qOverPt for the first non-perigee TSOS on a track """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(pTCorrectTrack)
-
-class removeTRTHits(JobProperty) :
-    """ flag to remove TRT hits from tracks """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(removeTRTHits)
-
-class removeCSCHits(JobProperty) :
-    """ flag to remove CSC hits from tracks """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(removeCSCHits)
-
-class useFullReco(JobProperty) :
-    """ flag to use full reconstruction (uses standalone muon if False) """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(useFullReco)
-
-class jobType(JobProperty) :
-    """ string to label type of alignment job """
-    statusOn = True
-    allowedType = ['string']
-    StoredValue = ""
-_flags.append(jobType)
-
-class doBarrel(JobProperty) :
-    """ flag to align barrel chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(doBarrel)
-
-class doEndcap(JobProperty) :
-    """ flag to align endcap chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(doEndcap)
-
-class doModuleSelection(JobProperty) :
-    """ flag to select level 1 modules in MuonGeometryManagerTool """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(doModuleSelection)
-
-class chamberSelectionString(JobProperty) :
-    """ string used by RegionSelectionSvc to select chambers """
-    statusOn = True
-    allowedType = ['string']
-    StoredValue = ""
-_flags.append(chamberSelectionString)
-
-class doMultiLevelAlignment(JobProperty) :
-    """ flag to perform mutlilevel alignment usign MultiLevelAlignmentDbTool """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(doMultiLevelAlignment)
-
-class doShiftDerivTree(JobProperty) :
-    """ flag to turn on output tree in ShiftingDerivCalcTool """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(doShiftDerivTree)
-
-class doChi2VChamberShiftsMeasType(JobProperty) :
-    """ flag to do chi2 vs. chamber shift and discontinuity cut in shifting derivatives for each type of measurement separately """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(doChi2VChamberShiftsMeasType)
-
-class useAlternateASZT(JobProperty) :
-    """ flag to turn on use of alternate ASZT file in MuonAlignDBTool (also used by MuonAlignment_jobOptions.py) """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(useAlternateASZT)
-
-class initialAsztFilePath(JobProperty) :
-    """ path from which the initial aszt file is read """
-    statusOn = True
-    allowedType = ['string']
-    StoredValue = '../asztfiles/'
-_flags.append(initialAsztFilePath)
-
-class asztFilePath(JobProperty) :
-    """ path the aszt files are read from / written to"""
-    statusOn = True
-    allowedType = ['string']
-    StoredValue = ''
-_flags.append(asztFilePath)
-
-class endcapsToAlign(JobProperty) :
-    """ flag to align only one endcap """
-    statusOn = True
-    allowedType = ['string']
-    StoredValue = 'BOTH'
-    allowedValues = [ 'BOTH', 'A', 'C' ] 
-_flags.append(endcapsToAlign)
-
-class numberOfShifts(JobProperty) :
-    """ number of shifts for shifting derivatives """
-    statusOn = True
-    allowedType = ['int']
-    StoredValue = 5
-_flags.append(numberOfShifts)
-
-class shiftSizeRotations(JobProperty) :
-    """ size of shifts for rotations in shifting derivatives """
-    statusOn = True
-    allowedType = ['float']
-    StoredValue = 0.1
-_flags.append(shiftSizeRotations)
-
-class shiftSizeTranslations(JobProperty) :
-    """ size of shifts for translations in shifting derivatives """
-    statusOn = True
-    allowedType = ['float']
-    StoredValue = 0.1
-_flags.append(shiftSizeTranslations)
-
-class useOpticalAlignment(JobProperty) :
-    """ use A-lines from optical alignment system """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(useOpticalAlignment)
-
-class MuonContainerName(JobProperty) :
-    """ container name used by MuonTrackPreProcessor and MuonFillNtuple """
-    statusOn = True
-    allowedType = ['string']
-    StoredValue = ""
-_flags.append(MuonContainerName)
-
-class inputIDTrackCol(JobProperty) :
-    """ container name used by MuonTrackCollectionProvider to get input ID tracks"""
-    statusOn = True
-    allowedType = ['string']
-    StoredValue = "Tracks"
-_flags.append(inputIDTrackCol)
-
-class momentumCut(JobProperty) :
-    """ momentum cut """
-    statusOn = True
-    allowedType = ['float']
-    StoredValue = 4.0
-_flags.append(momentumCut)
-
-class inputTrackCollectionType(JobProperty) :
-    """ input track collection type """
-    statusOn = True
-    allowedType = ['int']
-    StoredValue = 0
-    allowedValues = [0,1,2] # see MuonTrackCollectionProvider for TrackType enum
-_flags.append(inputTrackCollectionType)
-
-class selectCombinedMuons(JobProperty) :
-    """ select combined muons in MuonTrackPreProcessor """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(selectCombinedMuons)
-
-class msidPtDiffCut(JobProperty):
-    """ apply cut to relative difference in momentum between MS and ID"""
-    statusOn = True
-    allowedType = ['float']
-    StoredValue = 0.15
-_flags.append(msidPtDiffCut)
-
-class doBigNtuple(JobProperty):
-    """ fill ntuple with all possible branches for debugging and validation """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(doBigNtuple)
-
-class doLocalErrorScaling(JobProperty):
-    """ do error scaling for muon chambers """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(doLocalErrorScaling)
-
-class useStandaloneTracks(JobProperty):
-    """ use standalone tracks """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(useStandaloneTracks)
-
-class trackCollectionProvider(JobProperty):
-    """ type of trackCollectionProvider to use in AlignAlg"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = 'TrackCollectionProvider'
-    allowedValues = [ 'TrackCollectionProvider', 'MuonTrackCollectionProvider' ]
-_flags.append(trackCollectionProvider)
-
-class resetScatteringAngles(JobProperty):
-    """ reset ScatteringAngles to zero before track refit"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(resetScatteringAngles)
-
-class removePerigeeBeforeRefit(JobProperty):
-    """ remove perigee before refit """
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = False
-_flags.append(removePerigeeBeforeRefit)
-
-class mdtAlignTraX(JobProperty):
-    """ align parameter x-translation"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignTraX)
-
-class mdtAlignTraY(JobProperty):
-    """ align parameter y-translation"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignTraY)
-
-class mdtAlignTraZ(JobProperty):
-    """ align parameter z-translation"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignTraZ)
-
-class mdtAlignRotX(JobProperty):
-    """ align parameter x-rotation"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignRotX)
-
-class mdtAlignRotY(JobProperty):
-    """ align parameter y-rotation"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignRotY)
-
-class mdtAlignRotZ(JobProperty):
-    """ align parameter z-rotation"""
-    statusOn = True
-    allowedType = ['bool']
-    StoredValue = True
-_flags.append(mdtAlignRotZ)
-
-# add to jobproperties
-class MuonAlignmentFlags(JobPropertyContainer):
-    """ The alignment flag/job property container """
-    
-    # some derived flags
-    def alignModuleListType(self) :
-        if align.alignmentLevel()==0 :
-            return 0
-        elif align.alignmentLevel()==1 :
-            return 1
-        elif align.alignmentLevel()==23 :
-            return 2
-        elif align.alignmentLevel()==3 :
-            return 3
-        else :
-            print "bad option"
-            return -1
-
-    ## returns instance of MuonAlgnmentIIOFiles
-    def muonAlignmentIOFiles(self) :
-        from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-        return MuonAlignmentIOFiles()    
-
-    # methods for setting sets of flags
-
-    ## sets default flags for muon reconstruction (see ConfigureMuonAlignment for more flag setting)
-    def setDefaultRecoFlags(self,readESD=False) :
-        print "setDefaultRecoFlags"
-        muonRecFlags.doMuonboy.set_Value_and_Lock(False)
-        muonRecFlags.doCalib.set_Value_and_Lock(False)
-        muonRecFlags.doCalibNtuple.set_Value_and_Lock(False)
-
-        #recFlags.readESD    = readESD
-        #print "readESD set to ",recFlags.readESD
-
-        recFlags.oldFlagTopSteering.set_Off()
-
-        #recFlags.doESD      = True
-        recFlags.doWriteESD = False
-        recFlags.doWriteAOD = False
-        recFlags.doWriteTAG = False
-        recFlags.doCBNT     = False
-        recFlags.doTrigger  = False
-        recFlags.doTruth.set_Value_and_Lock(False)
-        recFlags.doAOD.set_Value_and_Lock(False)
-        recFlags.doDetailedPerfMon.set_Value_and_Lock(False)
-        recFlags.doPerfMon.set_Value_and_Lock(False)
-
-        DQMonFlags.doMuonPhysicsMon.set_Value_and_Lock(False)
-        DQMonFlags.doMuonRawMon.set_Value_and_Lock(False)
-        DQMonFlags.doMuonSegmentMon.set_Value_and_Lock(False)
-        DQMonFlags.doMuonTrackMon.set_Value_and_Lock(False)
-
-        perfMonFlags.doDsoMonitoring.set_Value_and_Lock(False)
-        perfMonFlags.doDetailedMonitoring.set_Value_and_Lock(False)
-        perfMonFlags.doFullMon.set_Value_and_Lock(False)
-        perfMonFlags.doMonitoring.set_Value_and_Lock(False)
-        perfMonFlags.doPersistencyMonitoring.set_Value_and_Lock(False)
-        
-        from AthenaCommon.Include import include
-        include.block("PerfMonComps/DomainsRegistry.py")
-
-    ## sets default flags for shifting(numerical) derivatives 
-    #  (see ConfigureMuonAlignment for more flag setting)
-    def setDefaultShiftingDerivativeFlags(self) :
-        self.doShiftDerivTree = True
-        self.doChi2VChamberShiftsMeasType = True
-        self.numberOfShifts = 11
-
-    ## sets default flags for analytical derivatives 
-    #  (see ConfigureMuonAlignment for more flag setting)
-    def setDefaultAnalyticalDerivativeFlags(self) :
-        self.doShiftDerivTree = False
-        self.doChi2VChamberShiftsMeasType = False
-        align.includeScatteringResiduals = False
-        #align.includeScatterers = True
-        align.removeATSOSNotInAlignModule=True
-        #self.declusterTGCHits = True
-    
-    ## sets default flags for L0 alignment (see ConfigureMuonAlignment
-    #  for more flag setting)
-    def setDefaultL0Flags(self) :
-
-        from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
-        muonCombinedRecFlags.doMuidMuonCollection=True
-
-        align.alignmentLevel              = 0
-        align.includeScatterers           = True 
-        align.removeATSOSNotInAlignModule = False
-        align.includeScatteringResiduals  = True
-        align.trackAlignParamCut          = 100.
-        align.setMinIterations            = True 
-
-        self.chamberSelectionString       = ''
-        self.doModuleSelection            = True
-        self.shiftSizeRotations           = 1.5
-        self.shiftSizeTranslations        = 1.5
-        self.selectCombinedMuons          = True
-        self.msidPtDiffCut                = 999. # 0.15
-        self.alignTGC                     = False
-        self.alignCSC                     = True
-        self.alignRPC                     = False
-        self.alignMDT                     = True
-        self.requireOuterLayerECTracks    = False 
-        self.requireInnerLayerECTracks    = False
-        self.requireOneHitPerTubeLayerEC  = False
-        self.removeTGCHits                = False
-        self.removeCSCHits                = False
-        self.removeTRTHits                = False
-        self.removeBarrelHits             = False
-        self.cutOnBarrelTracks            = False
-        align.refitTracks                 = True
-
-        self.doBigNtuple = True
-
-    ## sets default flags for L1 alignment (see ConfigureMuonAlignment
-    #  for more flag setting)
-    def setDefaultL1Flags(self) :
-
-        from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
-        muonCombinedRecFlags.doMuidMuonCollection=True
-
-        align.alignmentLevel              = 1
-        #if align.fitterType == 'iPat' :
-        #align.inputTrkCol               = 'ConvertedMuIdCBTracks'
-        #else :
-        #  align.inputTrkCol               = 'Combined_Tracks'
-
-        align.includeScatterers           = False #rdh 
-        align.removeATSOSNotInAlignModule = False
-        align.includeScatteringResiduals  = True 
-        align.trackAlignParamCut          = 100.
-        #align.trackAlignParamCut          = 1.e-5
-        #align.trackAlignParamCut          = 1.e-4
-        align.setMinIterations            = True 
-
-        self.chamberSelectionString       = ''
-        self.doModuleSelection            = True
-        #self.shiftSizeRotations           = 1.0
-        #self.shiftSizeTranslations        = 1.0
-        self.shiftSizeRotations           = 1.5
-        self.shiftSizeTranslations        = 1.5
-        self.selectCombinedMuons          = True
-        self.msidPtDiffCut                = 999. # 0.15
-        #self.MuonContainerName            = "MuidMuonCollection"
-        self.alignTGC                     = True
-        self.alignCSC                     = True
-        self.alignRPC                     = True
-        self.alignMDT                     = True
-        self.requireOuterLayerECTracks    = False
-        self.requireInnerLayerECTracks    = False
-        self.requireOneHitPerTubeLayerEC  = False
-        self.removeCSCHits                = False
-        self.removeTRTHits                = False
-        self.removeBarrelHits             = False
-        self.cutOnBarrelTracks            = False
-        align.refitTracks                 = True
-        
-        self.doBigNtuple = True
-
-        #if not self.alignTGC:
-        #    muonRecFlags.doTGCs.set_Value_and_Lock(False)
-        #if not self.alignCSC: 
-        #    muonRecFlags.doCSCs.set_Value_and_Lock(False)
-        #if not self.alignMDT: 
-        #    muonRecFlags.doMDTs.set_Value_and_Lock(False)
-
-    ## sets default flags for L2.3 alignment (see ConfigureMuonAlignment
-    #  for more flag setting)
-    def setDefaultL23Flags(self) :
-        align.alignmentLevel              = 23
-        align.inputTrkCol                 = 'MooreTracks'
-        align.includeScatteringResiduals  = True
-        align.includeScatterers           = True
-        align.removeATSOSNotInAlignModule = False
-        align.refitTracks                 = True
-        align.minNumHitsPerModule         = 0
-        align.minNumTrksPerModule         = 1
-        self.chamberSelectionString       = ''
-        self.doModuleSelection            = True
-        self.shiftSizeRotations           = 1.0
-        self.shiftSizeTranslations        = 1.0
-        self.mdtAlignTraX                 = False
-        self.useAlternateASZT             = False
-        self.selectCombinedMuons          = False
-        self.MuonContainerName            = ""
-        self.alignMDT                     = True
-        self.applySelectionCuts           = False
-        self.applyStandardSelectionCuts   = True
-
-    ## sets default flags for L3 alignment (see ConfigureMuonAlignment
-    #  for more flag setting)
-    def setDefaultL3Flags(self) :
-        align.alignmentLevel              = 3
-        align.includeScatteringResiduals  = True
-        align.includeScatterers           = True
-        align.removeATSOSNotInAlignModule = False
-        align.refitTracks                 = True
-        align.minNumHitsPerModule         = 0
-        align.minNumTrksPerModule         = 400
-        #align.minNumTrksPerModule         = 1
-        self.chamberSelectionString       = ''
-        self.doModuleSelection            = True
-        self.shiftSizeRotations           = 1.0
-        self.shiftSizeTranslations        = 1.0
-        self.mdtAlignTraX                 = False
-        #self.alignParams                  = [1,2,3]
-        self.useAlternateASZT             = False
-        self.selectCombinedMuons          = False
-        #self.MuonContainerName            = ""
-        self.alignMDT                     = True
-        self.applySelectionCuts           = False
-        self.applyStandardSelectionCuts   = True
-        
-    ## sets default flags for L3 alignment (see ConfigureMuonAlignment 
-    #  for more flag setting) 
-    def setDefaultCscL3Flags(self) : 
-        align.alignmentLevel              = 3 
-        align.inputTrkCol                 = 'MooreTracks' 
-        align.includeScatteringResiduals  = True 
-        align.includeScatterers           = True 
-        align.removeATSOSNotInAlignModule = False
-        align.refitTracks                 = True 
-        align.minNumHitsPerModule         = 0
-        align.minNumHitsPerModule         = 1
-        self.requireInnerLayerECTracks    = False 
-        self.requireOneHitPerTubeLayerEC  = False 
-        self.requireOuterLayerECTracks    = False
-        self.removeBarrelHits             = False
-        self.removeCSCHits                = False
-        self.removeTRTHits                = False
-        self.cutOnTrackChisquare          = 10.
-        self.cutOnNumHolesOnTrack         = 100
-        self.cutOnNumOutlierOnTrack       = 100
-        self.cutOnMaxDriftSignSum         = 100         
-        self.chamberSelectionString       = '' 
-        self.doModuleSelection            = False 
-        self.shiftSizeRotations           = 1.0 
-        self.shiftSizeTranslations        = 1.0 
-        self.mdtAlignTraZ                 = False
-        self.mdtAlignRotX                 = False
-        self.mdtAlignRotY                 = False
-        self.useAlternateASZT             = True 
-        self.selectCombinedMuons          = False 
-        self.MuonContainerName            = "" 
-        self.alignCSC                     = True 
-        self.alignMDT                     = False 
-        self.alignRPC                     = False 
-        self.alignTGC                     = False 
-        self.applySelectionCuts           = False
-        self.applyStandardSelectionCuts   = True
-
-    ## sets default flags for matrix solving (see ConfigureMuonAlignment
-    #  for more flag setting)
-    def setDefaultMatrixSolvingFlags(self) :
-        align.weakModeToRemove = 1
-        align.matrixToolSolveOption = 6 # SOLVE_ROOT
-        align.useSparseMatrix  = True
-        align.writeEigenMatrices = False
-        align.writeModuleNames = True
-
-jobproperties.add_Container(MuonAlignmentFlags)
-
-for flag in _flags:
-    jobproperties.MuonAlignmentFlags.add_JobProperty(flag)
-del _flags
-
-MuonAlignmentFlags = jobproperties.MuonAlignmentFlags
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignmentIOFiles.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignmentIOFiles.py
deleted file mode 100644
index a7ae2946de0..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonAlignmentIOFiles.py
+++ /dev/null
@@ -1,145 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-
-## @file:   MuonAlignmentIOFiles.py
-## @brief:  Returns names of input and output files used specifically 
-#           for muon alignment 
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Logging import logging
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-from MuonAlignGenTools.IOFiles import IOFiles
-
-## MuonAlignmentIOFiles is used to return names of input and output files
-#  used for muon alignment.  For A-lines, this class calls a separate ALinesFiles
-#  class which can be configured outside ATHENA.
-class MuonAlignmentIOFiles () :
-
-    _asztInputFile      = ""
-    _asztOutputFile     = ""
-    _asztInputFileName  = ""
-    _asztOutputFileName = ""
-    _level1AsciiFile    = ""
-    _inputLevel1File    = ""
-    _ntupleFileName     = ""
-    _ntupleFilePath     = ""
-    _ntupleFile         = ""
-    _IOFiles            = IOFiles()
-    _rootFilePathIsSet  = False
-    _asztFilePathIsSet  = False
-    _initialAsztFilePathIsSet = False
-    
-    def __init__(self):
-        mlog = logging.getLogger( 'MuonAlignmentIOFiles::__init__' )
-        if not MuonAlignmentIOFiles._rootFilePathIsSet:
-            self.setRootFilePath(align.outputPath())
-        if not MuonAlignmentIOFiles._asztFilePathIsSet:
-            self.setAsztFilePath(mualign.asztFilePath())
-        if not MuonAlignmentIOFiles._initialAsztFilePathIsSet:
-            self.setInitialAsztFilePath(mualign.initialAsztFilePath())   
-
-    def setRootFilePath(self,path) :
-        MuonAlignmentIOFiles._IOFiles.rootFilePath = path
-        MuonAlignmentIOFiles._rootFilePathIsSet = True
-
-    def setAsztFilePath(self,path) :
-        MuonAlignmentIOFiles._IOFiles.asztFilePath = path
-        MuonAlignmentIOFiles._asztFilePathIsSet = True  
-    
-    def setInitialAsztFilePath(self,path) :
-        MuonAlignmentIOFiles._IOFiles.initialAsztFilePath = path   
-        MuonAlignmentIOFiles._initialAsztFilePathIsSet = True
-
-    def asztInputFile(self) :
-        if not MuonAlignmentIOFiles._asztInputFile :
-            if align.iteration()>0 or \
-                    align.dataType()=='MC' or align.dataType()=='simCosmic' :
-                MuonAlignmentIOFiles._asztInputFile = MuonAlignmentIOFiles._IOFiles.asztInputFile(
-                    align.fileRootName(),
-                    align.iteration(),
-                    align.jobIndex())
-            else :
-                print "setting asztInputFile to ''"
-                MuonAlignmentIOFiles._asztInputFile=""
-            print "asztInputFile: ",MuonAlignmentIOFiles._asztInputFile
-        return MuonAlignmentIOFiles._asztInputFile
-
-    def asztOutputFile(self) :
-        if not MuonAlignmentIOFiles._asztOutputFile :
-            MuonAlignmentIOFiles._asztOutputFile = MuonAlignmentIOFiles._IOFiles.asztOutputFile(
-                align.fileRootName(),
-                align.iteration(),
-                align.jobIndex())
-        return MuonAlignmentIOFiles._asztOutputFile
-
-    def asztInputFileName(self) :
-        if not MuonAlignmentIOFiles._asztInputFileName :
-            MuonAlignmentIOFiles._asztInputFileName =  MuonAlignmentIOFiles._IOFiles.asztInputFileName(
-                align.fileRootName(),
-                align.iteration(),
-                align.jobIndex())
-        return MuonAlignmentIOFiles._asztInputFileName
-
-    def asztOutputFileName(self) :
-        if not MuonAlignmentIOFiles._asztOutputFileName :
-            MuonAlignmentIOFiles._asztOutputFileName = MuonAlignmentIOFiles._IOFiles.asztOutputFileName(
-                align.fileRootName(),
-                align.iteration(),
-                align.jobIndex())
-        return MuonAlignmentIOFiles._asztOutputFileName
-
-    def level1AsciiFile(self) :
-        if not MuonAlignmentIOFiles._level1AsciiFile :
-            if align.iteration()>0 or \
-                    align.dataType()=='MC' or align.dataType()=='simCosmic' :
-                MuonAlignmentIOFiles._level1AsciiFile = MuonAlignmentIOFiles._IOFiles.level1AsciiFile(
-                    align.fileRootName(),
-                    align.iteration(),
-                    align.jobIndex())
-            else :
-                MuonAlignmentIOFiles._level1AsciiFile=""
-            print "level1AsciiFile: ",MuonAlignmentIOFiles._level1AsciiFile
-        return MuonAlignmentIOFiles._level1AsciiFile
-
-    def inputLevel1File(self) :
-        if not MuonAlignmentIOFiles._inputLevel1File :
-            if align.iteration()>0 :
-                MuonAlignmentIOFiles._inputLevel1File = MuonAlignmentIOFiles._IOFiles.inputLevel1File(
-                    align.fileRootName(),
-                    align.iteration(),
-                    align.jobIndex())
-            elif align.dataType()=='MC' or align.dataType()=='simCosmic' :
-                MuonAlignmentIOFiles._inputLevel1File = MuonAlignmentIOFiles._IOFiles.inputLevel1File(
-                    align.fileRootName(),
-                    align.iteration())                
-            else :
-                MuonAlignmentIOFiles._inputLevel1File=""
-            print "level1AsciiFile: ",MuonAlignmentIOFiles._inputLevel1File
-        return MuonAlignmentIOFiles._inputLevel1File
-
-    def ntupleFileName(self) :
-        if not MuonAlignmentIOFiles._ntupleFileName :
-            MuonAlignmentIOFiles._ntupleFileName = MuonAlignmentIOFiles._IOFiles.ntupleFileName(
-                align.fileRootName(),
-                align.iteration(),
-                align.jobIndex())
-        return MuonAlignmentIOFiles._ntupleFileName
-
-    def ntupleFilePath(self) :
-        if not MuonAlignmentIOFiles._ntupleFilePath :
-            MuonAlignmentIOFiles._ntupleFilePath = MuonAlignmentIOFiles._IOFiles.ntupleFilePath()
-        return MuonAlignmentIOFiles._ntupleFilePath
-
-    def ntupleFile(self) :
-        if not MuonAlignmentIOFiles._ntupleFile :
-            MuonAlignmentIOFiles._ntupleFile = MuonAlignmentIOFiles._IOFiles.ntupleFile(
-                align.fileRootName(),
-                align.iteration(),
-                align.jobIndex())
-        return MuonAlignmentIOFiles._ntupleFile
-        
-
-   
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonFillNtupleToolGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonFillNtupleToolGetter.py
deleted file mode 100644
index 81d93ce77e6..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonFillNtupleToolGetter.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   MuonFillNtupleToolGetter.py
-## @brief:  Creates and configures MuonFillNtupleTool.
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-## MuonFillNtupleToolGetter creates and configures MuonFillNtupleTool, but 
-#  does not add to ToolSvc.  User must add to a tool as a private tool, or add to 
-#  ToolSvc.
-class MuonFillNtupleToolGetter ( Configured ) :
-
-    _name = 'MuonFillNtupleToolGetter'
-
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        # create tool instance
-        from TrkAlignGenTools.AlignResidualCalculatorGetter import AlignResidualCalculatorGetter
-        resCalc = AlignResidualCalculatorGetter().ResidualPullCalculatorHandle()
-        
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonFillNtupleTool
-        from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
-        muonIO = MuonAlignmentIOFiles()
-        muonFillNtupleTool = Muon__MuonFillNtupleTool(OutputLevel = align.OutputLevel(),
-                                                      ResidualPullCalculator = resCalc,
-                                                      MuonContainer = mualign.MuonContainerName())
-
-        from MuonAlignGenTools.MuonAlignModuleToolGetter import MuonAlignModuleToolGetter
-        muonAlignModuleTool = MuonAlignModuleToolGetter().MuonAlignModuleToolHandle()
-        muonFillNtupleTool.AlignModuleTool = muonAlignModuleTool
-        muonFillNtupleTool.BigNtuple = mualign.doBigNtuple()
-
-        
-        from MuTagTools.MuTagToolsConf import MuTagEDMHelper
-        ConfiguredMuTagEDMHelper = MuTagEDMHelper("ConfiguredMuTagEDMHelper")
-        from __main__ import ToolSvc
-        ToolSvc += ConfiguredMuTagEDMHelper        
-        muonFillNtupleTool.muTagEDMHelperTool = ConfiguredMuTagEDMHelper
-
-        self._MuonFillNtupleToolHandle = muonFillNtupleTool
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    def MuonFillNtupleToolHandle ( self ) :
-        return self._MuonFillNtupleToolHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonGeometryManagerToolGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonGeometryManagerToolGetter.py
deleted file mode 100644
index a4c7a416af3..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonGeometryManagerToolGetter.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   MuonGeometryManagerToolGetter.py
-## @brief:  Creates and configures MuonGeometryManagerTool.
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-## Created and configures MuonGeometryManagerTool as a public tool, added 
-#  to ToolSvc
-class MuonGeometryManagerToolGetter ( Configured ) :
-
-    _name = 'MuonGeometryManagerToolGetter'
-
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        # create tool instance
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonGeometryManagerTool, Muon__MdtGeometryManagerTool, Muon__CscGeometryManagerTool, Muon__TgcGeometryManagerTool
-
-        # MDT
-        mdtGeometryManagerTool =  Muon__MdtGeometryManagerTool(OutputLevel = align.OutputLevel(),
-                                                               AlignLevel = align.alignmentLevel(),
-                                                               AlignTraX=mualign.mdtAlignTraX(),
-                                                               AlignTraY=mualign.mdtAlignTraY(),
-                                                               AlignTraZ=mualign.mdtAlignTraZ(),
-                                                               AlignRotX=mualign.mdtAlignRotX(),
-                                                               AlignRotY=mualign.mdtAlignRotY(),
-                                                               AlignRotZ=mualign.mdtAlignRotZ())
-        self._MdtGeometryManagerToolHandle = mdtGeometryManagerTool
-
-        # CSC
-        cscGeometryManagerTool =  Muon__CscGeometryManagerTool(OutputLevel = align.OutputLevel(),
-                                                               AlignLevel = align.alignmentLevel())
-        self._CscGeometryManagerToolHandle = cscGeometryManagerTool
-
-        # TGC
-        tgcGeometryManagerTool =  Muon__TgcGeometryManagerTool(OutputLevel = align.OutputLevel(),
-                                                               AlignLevel = align.alignmentLevel())
-        self._TgcGeometryManagerToolHandle = tgcGeometryManagerTool
-        
-        mlog.info(" now adding geometryManagerTools to ToolSvc" )
-        from __main__ import ToolSvc
-        ToolSvc += self.MdtGeometryManagerToolHandle()
-        ToolSvc += self.CscGeometryManagerToolHandle()
-        ToolSvc += self.TgcGeometryManagerToolHandle()
-
-        muonGeometryManagerTool = Muon__MuonGeometryManagerTool(OutputLevel = align.OutputLevel(),
-                                                                AlignLevel = align.alignmentLevel(),
-                                                                MdtGeometryManager = mdtGeometryManagerTool,
-                                                                CscGeometryManager = cscGeometryManagerTool,
-                                                                TgcGeometryManager = tgcGeometryManagerTool,
-                                                                doModuleSelection = mualign.doModuleSelection(),
-                                                                AlignMdt = mualign.alignMDT(),
-                                                                AlignTgc = False, #mualign.alignTGC(),
-                                                                AlignCsc = False, #mualign.alignCSC(),
-                                                                ModuleSelection = mualign.modulesToAlign())
-        self._MuonGeometryManagerToolHandle = muonGeometryManagerTool
-        
-        mlog.info(" now adding MuonGeometryManagerTool to ToolSvc" )
-        ToolSvc += self.MuonGeometryManagerToolHandle()
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    def MuonGeometryManagerToolHandle ( self ) :
-        return self._MuonGeometryManagerToolHandle
-
-    def MdtGeometryManagerToolHandle ( self ) :
-        return self._MdtGeometryManagerToolHandle
-
-    def CscGeometryManagerToolHandle ( self ) :
-        return self._CscGeometryManagerToolHandle
-
-    def TgcGeometryManagerToolHandle ( self ) :
-        return self._TgcGeometryManagerToolHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonTrackCollectionProviderGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonTrackCollectionProviderGetter.py
deleted file mode 100644
index 3f9eb424813..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonTrackCollectionProviderGetter.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-## @file:   MuonTrackCollectionProviderGetter.py
-## @brief:  to instantiate the MuonTrackCollectionProvider
-## 	    with the default configuration
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   7/29/2010
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-class MuonTrackCollectionProviderGetter ( Configured ) :
-    
-    _name = 'MuonTrackCollectionProviderGetter'
-
-    def configure(self):
-        mlog = logging.getLogger( self._name+'::configure :' )
-
-        from MuonAlignGenTools.MuonAlignRefitToolGetter import MuonAlignRefitToolGetter
-        muonAlignRefitTool = MuonAlignRefitToolGetter().MuonAlignRefitToolHandle()
-
-        # create tool instance
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonTrackCollectionProvider
-        muonTrackCollectionProvider=Muon__MuonTrackCollectionProvider("MuonTrackCollectionProvider",
-                                                                      OutputLevel = align.OutputLevel(),
-                                                                      InputMuonCol=mualign.MuonContainerName(),
-                                                                      InputTrackCol=align.inputTrkCol(),
-                                                                      InputIDTrackCol=mualign.inputIDTrackCol(),
-                                                                      UseStandaloneTracks = mualign.useStandaloneTracks(),
-                                                                      TrackType = mualign.inputTrackCollectionType(),
-                                                                      MomentumCut=mualign.momentumCut(),
-                                                                      MuonAlignRefitTool=muonAlignRefitTool)
-        
-        self._muonTrackCollectionProviderHandle = muonTrackCollectionProvider
-
-        mlog.info(" now adding to ToolSvc" )
-        from __main__ import ToolSvc
-        ToolSvc += self.MuonTrackCollectionProviderHandle()
-
-        mlog.info(" leaving configure")
-
-        return True
-
-    def MuonTrackCollectionProviderHandle(self):
-        return self._muonTrackCollectionProviderHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonTrackPreProcessorGetter.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonTrackPreProcessorGetter.py
deleted file mode 100644
index 87708e5b37b..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/python/MuonTrackPreProcessorGetter.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   MuonTrackPreProcessorGetter.py
-## @brief:  Creates and configures MuonTrackPreProcessorGetter.
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-## MuonTrackPreProcessorGetter creates and configures MuonTrackPreProcessor, but 
-#  does not add to ToolSvc.  User must add to a tool as a private tool, or add to 
-#  ToolSvc.
-class MuonTrackPreProcessorGetter ( Configured ) :
-
-    _name = 'MuonTrackPreProcessorGetter'
-
-    def configure ( self ) :
-        mlog = logging.getLogger( self._name+'::configure :' )
-        
-        # create tool instance
-        from TrkAlignGenTools.AlignmentTrackFitter import AlignmentTrackFitter
-        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonAlignHelperTool,Muon__MuonTrackPreProcessor
-        
-        from MuonAlignGenTools.MuonAlignRefitToolGetter import MuonAlignRefitToolGetter
-        muonAlignRefitTool = MuonAlignRefitToolGetter().MuonAlignRefitToolHandle()
-
-        muonAlignHelperTool = Muon__MuonAlignHelperTool(OutputLevel = align.OutputLevel())
-
-        from __main__ import ToolSvc
-        ToolSvc += muonAlignHelperTool
-
-        muonTrackPreProcessor = Muon__MuonTrackPreProcessor(OutputLevel = align.OutputLevel(),
-                                                            TrackFitterTool = AlignmentTrackFitter().fitter(),
-                                                            MuonAlignRefitTool  = muonAlignRefitTool)
-
-        if align.useSLFitter() :
-            muonTrackPreProcessor.SLTrackFitterTool = AlignmentTrackFitter().slfitter()
-
-        muonTrackPreProcessor.RefitTracks          = align.refitTracks()
-        muonTrackPreProcessor.ParticleNumber       = align.particleNumber()
-        muonTrackPreProcessor.RunOutlierRemoval    = align.runOutlierRemoval()
-        muonTrackPreProcessor.RedoErrorScaling     = mualign.redoErrorScaling()
-        muonTrackPreProcessor.pTCorrectTrack       = mualign.pTCorrectTrack()
-        muonTrackPreProcessor.RemovePerigeeBeforeRefit = mualign.removePerigeeBeforeRefit()
-
-        muonTrackPreProcessor.ResetScatteringAngles= mualign.resetScatteringAngles()
-
-        muonTrackPreProcessor.ApplyStandardSelectionCuts  = mualign.applyStandardSelectionCuts()
-        muonTrackPreProcessor.ApplySelectionCuts          = mualign.applySelectionCuts()
-        muonTrackPreProcessor.RequireOneHitPerTubeLayerEC = mualign.requireOneHitPerTubeLayerEC()
-        muonTrackPreProcessor.RequireInnerLayerEndcapMdt  = mualign.requireInnerLayerECTracks()
-        muonTrackPreProcessor.RequireOuterLayerEndcapMdt  = mualign.requireOuterLayerECTracks()
-        muonTrackPreProcessor.RequireBarrelECOverlap      = mualign.requireBarrelECOverlap()
-        muonTrackPreProcessor.CutOnBarrel                 = mualign.cutOnBarrelTracks()
-        muonTrackPreProcessor.RequireRPCPhiHit            = mualign.requireRPCPhiHit()
-        muonTrackPreProcessor.RequireSmallLargeOverlap    = mualign.requireSmallLargeOverlap()
-
-        muonTrackPreProcessor.MuonContainer        = mualign.MuonContainerName()
-        muonTrackPreProcessor.SelectCombinedMuons  = mualign.selectCombinedMuons()
-
-        muonTrackPreProcessor.MSID_ptDiffCut       = mualign.msidPtDiffCut()
-        muonTrackPreProcessor.chiSqCut             = mualign.cutOnTrackChisquare()
-        muonTrackPreProcessor.nAllowedHoles        = mualign.cutOnNumHolesOnTrack()
-        muonTrackPreProcessor.nAllowedOutliers     = mualign.cutOnNumOutlierOnTrack()
-        muonTrackPreProcessor.MaxDriftSignSum      = mualign.cutOnMaxDriftSignSum()
-
-        self._MuonTrackPreProcessorHandle = muonTrackPreProcessor
-
-        mlog.info(" adding MuonTrackPreProcessor to ToolSvc" )
-        ToolSvc += muonAlignHelperTool
-
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    def MuonTrackPreProcessorHandle ( self ) :
-        return self._MuonTrackPreProcessorHandle
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/share/MuonDataRec_myTopOptions.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/share/MuonDataRec_myTopOptions.py
deleted file mode 100644
index 5576c3cdeab..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/share/MuonDataRec_myTopOptions.py
+++ /dev/null
@@ -1,274 +0,0 @@
-# #######################################################################
-# TopOptions to process cosmics /single beam data 
-# M. Woudstra, R. Nikolaidou 
-#
-# By default we run on 10 events of the 121080 (taken on June 2009) run,
-# autoconfiguration of bfield and conditions tag, full reconstruction
-# Muonboy and Moore and we produce as
-# output : CBNT, ESD, Monitoring, ascii file with the configuration of the job  
-# #######################################################################
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from AthenaCommon.BeamFlags import jobproperties
-from AthenaCommon.GlobalFlags import globalflags
-from AthenaCommon.BFieldFlags import jobproperties
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.DetFlags import DetFlags
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecConfFlags import recConfFlags
-
-# setup environment 
-from MuonRecExample.MuonRecFlags import muonRecFlags,muonboyFlags,mooreFlags
-from MuonRecExample import MuonRecStandaloneOnlySetup
-
-# in Standalone mode, don't allow any configuration errors
-athenaCommonFlags.AllowIgnoreConfigError = False
-
-#
-# command line parameters (-c)
-#
-if 'EvtMax' not in dir():
-    EvtMax = 10 # maximum number of events to process
-
-if 'SkipEvents' not in dir():
-    SkipEvents = 0
-
-
-# Set properly beam type, DataSource, InputFormat, Detector Description, Conditions Tag
-globalflags.DataSource.set_Value_and_Lock('data')
-#jobproperties.Beam.beamType.set_Value_and_Lock("cosmics")
-#globalflags.InputFormat.set_Value_and_Lock('bytestream')
-
-###############################################################################
-# Data 2008 splash events
-# https://twiki.cern.ch/twiki/bin/view/Atlas/IndividualInterestingSingleBeamEvents
-## athenaCommonFlags.BSRDOInput.set_Value_and_Lock(['/afs/cern.ch/user/g/gencomm/w0/jboyd/GetInterestingEvents/BSfiles/87764/evt.194586._0001.data'])
-## # set the following to override the auto-config
-## globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEO-08-00-02')
-## jobproperties.BField.solenoidOn.set_Value_and_Lock(True)
-## jobproperties.BField.barrelToroidOn.set_Value_and_Lock(True)
-## jobproperties.BField.endcapToroidOn.set_Value_and_Lock(True)
-## globalflags.ConditionsTag.set_Value_and_Lock('COMCOND-ES1C-000-00')
-
-##############################################################################
-# Data 2009 without CSCs
-#muonRecFlags.doCSCs = False
-#athenaCommonFlags.BSRDOInput.set_Value_and_Lock(['/castor/cern.ch/grid/atlas/DAQ/2009/00121080/physics_RPCwBeam/data09_cos.00121080.physics_RPCwBeam.daq.RAW._lb0000._SFO-5._0605.data'])
-#athenaCommonFlags.BSRDOInput.set_Value_and_Lock(['/castor/cern.ch/grid/atlas/DAQ/2009/00121064/physics_RPCwBeam/data09_cos.00121064.physics_RPCwBeam.daq.RAW._lb0000._SFO-5._0002.data'])
-# set the following to override the auto-config
-#globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEO-08-00-01')
-#jobproperties.BField.solenoidOn.set_Value_and_Lock(True)
-#jobproperties.BField.barrelToroidOn.set_Value_and_Lock(True)
-#jobproperties.BField.endcapToroidOn.set_Value_and_Lock(True)
-#globalflags.ConditionsTag.set_Value_and_Lock('COMCOND-REPC-002-03')
-# Use auto-config with caution! It is tuned to Summer 2009 reprocessing.
-#rec.triggerStream = "RPCwBeam"
-rec.AutoConfiguration = ['TriggerStream','FieldAndGeo', 'ConditionsTag']
-#rec.AutoConfiguration = ['TriggerStream','FieldAndGeo', 'ConditionsTag'] 
-
-##############################################################################
-## # Data 2008 with CSCs
-## muonRecFlags.doCSCs=True
-## athenaCommonFlags.BSRDOInput.set_Value_and_Lock([
-##         '/castor/cern.ch/grid/atlas/DAQ/2008/91897/physics_TGCwBeam/daq.ATLAS.0091897.physics.TGCwBeam.LB0001.SFO-1._0001.data'])
-## globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEONF-04-00-00')
-## jobproperties.BField.solenoidOn.set_Value_and_Lock(False)
-## jobproperties.BField.barrelToroidOn.set_Value_and_Lock(False)
-## jobproperties.BField.endcapToroidOn.set_Value_and_Lock(False)
-## globalflags.ConditionsTag.set_Value_and_Lock('COMCOND-REPC-001-02')
-
-
-##############################################################################
-## # Data 2008 without CSCs
-## muonRecFlags.doCSCs=False
-## athenaCommonFlags.BSRDOInput.set_Value_and_Lock([
-##     '/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/RAW/data08_cos.00091060.physics_RPCwBeam.daq.RAW.o4/daq.ATLAS.0091060.physics.RPCwBeam.LB0032.SFO-1._0013.data'])
-##     #        '/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/RAW/data08_cos.00091060.physics_RPCwBeam.daq.RAW.o4/daq.ATLAS.0091060.physics.RPCwBeam.LB0001.SFO-1._0001.data'])
-##     #        '/castor/cern.ch/grid/atlas/DAQ/2008/87863/physics_BPTX/daq.NoTag.0087863.physics.BPTX.LB0000.SFO-1._0001.data'])
-## # WARNING: the files on that atlsdatadisk may disappear after some time
-## # WARNING: the STAGE_SVCCLASS below is only needed for files on atlasdatadisk
-## if athenaCommonFlags.BSRDOInput()[0].startswith("/castor/cern.ch/grid/atlas/atlasdatadisk/"):
-##    import os
-##    os.environ["STAGE_SVCCLASS"]='atldata'
-## globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEONF-04-00-00')
-## jobproperties.BField.solenoidOn.set_Value_and_Lock(False)
-## jobproperties.BField.barrelToroidOn.set_Value_and_Lock(False)
-## jobproperties.BField.endcapToroidOn.set_Value_and_Lock(False)
-## globalflags.ConditionsTag.set_Value_and_Lock('COMCOND-REPC-001-03')
-##############################################################################
-
-
-## Descoping exercise (disable various parts in muon reconstruction chain ##
-##
-
-
-#---->  DESCOPING EXERCISE (disable various parts of reconstruction chain)
-#
-
-# Stop at formation of PRDs only
-#muonRecFlags.Enabled = False
-
-# Disable MDTs
-#muonRecFlags.doMDTs=False
-
-# Disable RPCs
-#muonRecFlags.doRPCs=False
-
-# Disable TGCs
-#muonRecFlags.doTGCs=False
-
-# Disable CSCs
-#muonRecFlags.doCSCs=False
-
-# Stop Muonboy at segment level 
-#muonboyFlags.doSegmentsOnly = True
-
-# Stop Moore at segment level
-#mooreFlags.doSegmentsOnly = True
-
-# Don't run on Muonboy at all
-#muonRecFlags.doMuonboy = False
-
-# Don't run on Moore at all
-#muonRecFlags.doMoore = False
-
-#----> END OF CONFIGURATION FOR DESCOPING EXERCISE 
-#
-
-
-
-# Run from an ESD file and produce an ntuple
-#rec.readESD = True
-#rec.doCBNT = True
-#rec.doESD = False
-
-
-# Switch off the alignment corrections (on by default for data)
-#muonRecFlags.useAlignmentCorrections = False
-
-# Switch on/off the T0 fit (on by default for data)
-#muonRecFlags.doSegmentT0Fit = False
-
-# Calibration ntuple
-#muonRecFlags.doCalibNtuple = False # write calibration ntuple?
-#muonRecFlags.calibNtupleSegments = False # write segments to ntuple?
-#muonRecFlags.calibNtupleTracks = False # write tracks to ntuple?
-#muonRecFlags.calibNtupleTrigger = False # write trigger info to ntuple?
-#muonRecFlags.calibMoore = False   # write Moore tracks/segments to ntuple?
-#muonRecFlags.calibMuonboy = False # write Muonboy tracks/segments to ntuple?
-
-
-
-# General Reco flags jobproperties 
-from RecExConfig.RecFlags import rec
-
-# no truth when running on data
-rec.doTruth = False
-
-# Switch Perfmon studies 
-rec.doPerfMon = True
-rec.doDetailedPerfMon = True
-rec.doNameAuditor = True
-
-# For Trigger MBTS and L1 Calo we need the Tile Calorimeter
-# the algorithm: MuonCalibExtraTreeTriggerAlg stores trigger info
-DetFlags.makeRIO.Calo_setOn()
-DetFlags.detdescr.LVL1_setOn()
-DetFlags.readRDOBS.LVL1_setOn()
-# Temporarily switch off Tile because of crash (bug #51240)
-# ==> Will have less (trigger) info in Calibration Ntuple !!!
-rec.doTile = False
-# Write ESDs 
-rec.doWriteESD = True
-
-
-# Enable Persint Display  
-rec.doPersint.set_Value_and_Lock(False)
-
-# Max number of events to run, number of events to skip
-athenaCommonFlags.EvtMax.set_Value_and_Lock(EvtMax)
-athenaCommonFlags.SkipEvents.set_Value_and_Lock(SkipEvents)
-
-
-#--------------------------------------------------------------------------------
-# end of user flags
-#--------------------------------------------------------------------------------
-
-rec.doDetStatus.set_Value_and_Lock(False) # because of bug in DetectorStatus/DetStatusSvc_CondDB.py"
-rec.Commissioning = True
-# lock all flags. Very important!
-#rec.lock_JobProperties()
-muonRecFlags.lock_JobProperties()
-
-
-# The main jobOption file
-try:
-    if 'EventList' in dir():
-        include("MuonRecExample/SelectEvents_jobOptions.py")
-
-    include("RecExCommission/RecExCommission.py")                
-    include ("RecExCommon/RecExCommon_topOptions.py")
-    if rec.doPersint():
-        from MboyView.MboyViewConf import MboyView
-        theMboyView = MboyView()
-        if muonRecFlags.doMuonboy():
-            theMboyView.TrkTrackCollectionLocationList+=["ConvertedMBoyTracks"]
-        if muonRecFlags.doMoore():
-            theMboyView.TrkTrackCollectionLocationList+=["MooreTracks"]
-            theMboyView.TrkSegmentCollectionLocationList+=["MooreSegments"]
-
-    try:
-        del topSequence.Stream2Filter
-    except AttributeError:
-        pass
-
-    # remove TileMuonFitter topSequence (CPU)
-    try:
-       del topSequence.TileMuonFitter
-    except AttributeError:
-       pass
-    # move triggeralg to end (calo has run after it)
-    try:
-        # keep link to alg
-        MuonCalibExtraTreeTriggerAlg = topSequence.MuonCalibExtraTreeTriggerAlg
-        # then remove it from topSequence
-        del topSequence.MuonCalibExtraTreeTriggerAlg
-    except AttributeError:
-       pass
-    else:
-       # and add at end (after Tile)
-       topSequence += MuonCalibExtraTreeTriggerAlg
-
-
-    ###### put any user finetuning before this line #####
-
-##### DO NOT ADD ANYTHING AFTER THIS LINE #####
-except:
-    # always write config so far for debugging
-    from AthenaCommon.ConfigurationShelve import saveToAscii
-    saveToAscii("config.txt")
-    # add DetFlags
-    from MuonRecExample.MuonRecUtils import dumpDetFlags
-    dumpDetFlags("config.txt")
-    # but still exit with error
-    raise
-else:
-    # and write config to include user changes after topOptions
-    from AthenaCommon.ConfigurationShelve import saveToAscii
-    saveToAscii("config.txt")
-    # add DetFlags
-    from MuonRecExample.MuonRecUtils import dumpDetFlags
-    dumpDetFlags("config.txt")
-
-if rec.doPersint():
-    from MboyView.MboyViewConf import MboyView
-    theMboyView = MboyView()
-    if muonRecFlags.doMuonboy():
-        theMboyView.TrkTrackCollectionLocationList+=["ConvertedMBoyTracks"]
-    if muonRecFlags.doMoore():
-        theMboyView.TrkTrackCollectionLocationList+=["MooreTracks"]
-        theMboyView.TrkSegmentCollectionLocationList+=["MooreSegments"]
-
-
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/share/unbiasedMuonResiduals_jobOptions.py b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/share/unbiasedMuonResiduals_jobOptions.py
deleted file mode 100644
index ec0d32000a4..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/share/unbiasedMuonResiduals_jobOptions.py
+++ /dev/null
@@ -1,62 +0,0 @@
-ToolSvc.MuonClusterOnTrackCreator.FixedErrorTgcEta = 80.
-
-#mgmAlignTool = ToolSvc.MGM_AlignmentDbTool
-#mgmAlignTool.OutputLevel = INFO 
-#mgmAlignTool.ALinesFile = 'newCSCALines.txt'
-#print ToolSvc.MGM_AlignmentDbTool
-
-include("MuidExample/MuonIdentification_jobOptions.py")
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-MCTBSLFitter = MuonRecTools.getPublicToolClone("myMCTBSLFitter","MCTBSLFitter")
-MCTBSLFitter.FillDerivativeMatrix = False
-MCTBSLFitter.SortHits = False
-MCTBSLFitter.OutputLevel = INFO
-MCTBSLFitter.GetMaterialFromTrack = True
-MCTBSLFitter.Momentum=0. 
-ToolSvc += MCTBSLFitter
-
-# create instance of MuonTrackTagTestTool
-from MuonTrackThroughCalo.ConfMuonTrackThroughCalo import ConfMuonTrackThroughCalo
-MuonTTC = ConfMuonTrackThroughCalo("MuonTrackThroughCalo")
-
-from AthenaCommon.AppMgr import ToolSvc
-ToolSvc += MuonTTC
-
-from MuonRecExample import MuonRecTools            
-atlasExtrapolator=MuonRecTools.getPublicTool('AtlasExtrapolator')
-from MuonCombinedTestTools.MuonCombinedTestToolsConf import MuonCombined__MuonTrackTagTestTool
-combinedMuonTag = MuonCombined__MuonTrackTagTestTool(name = "CombinedMuonTag",
-                                                     ExtrapolatorTool = atlasExtrapolator,
-                                                     TTCTool          = MuonTTC,
-                                                     Chi2Cut          = 2500.)
-ToolSvc += combinedMuonTag
-
-from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__UnbiasedMuonResiduals
-topSequence += Muon__UnbiasedMuonResiduals("UnbiasedMuonResiduals",
-                                     WhichSegmCollections = [1,1],
-                                     SegmentCollectionName = ["MooreSegments","ConvertedMBoySegments"],
-                                     #MuonTrackCollections = ["MuidMuonCollection","StacoMuonCollection"],
-                                     MuonTrackCollections  = ["MooreTracks","ConvertedMBoyTracks"],
-                                     InDetTrackCollections = ["Tracks","Tracks"],
-                                     TagTool = combinedMuonTag,
-                                     Fitter = ToolSvc.myMCTBSLFitter,
-                                     CombinedTrackBuilder = CombinedMuonTrackBuilder,
-                                     TrackFittingType = 4, # MS standalone with ID track match
-                                     UseTrackContainer=True,
-                                     #maxIDTrackd0 = 5,
-                                     #maxIDTrackz0 = 200,
-                                     minMuonMom   = 4.0,
-                                     #minPIXHits   = 1,
-                                     #minSCTHits   = 4,
-                                     #minTRTHits   = 0,
-                                     #minMDTHits   = 10,
-                                     #minCSCHits   = 0,
-                                     TriggerList  = [],
-                                     doMdt=True,
-				     doCsc=True,
-				     MakeTgcOutliers=True, 
-                                     OutputLevel  = INFO) 
-
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CommonGeometryManagerTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CommonGeometryManagerTool.cxx
deleted file mode 100644
index ff2a17519a9..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CommonGeometryManagerTool.cxx
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "DataModel/DataVector.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-#include "MuonAlignGenTools/CommonGeometryManagerTool.h"
-#include "TrkAlignInterfaces/IAlignModuleTool.h"
-
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/TgcReadoutElement.h"
-#include "MuonReadoutGeometry/RpcReadoutElement.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonReadoutGeometry/MuonStation.h"
-
-#include "MuonCalibIdentifier/MuonFixedId.h"
-#include "MuonCalibITools/IIdToFixedIdTool.h"
-
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "TrkAlignEvent/AlignPar.h"
-#include "MuonAlignEvent/CombinedMuonAlignModule.h"
-#include "MuonAlignEvent/RpcAlignModule.h"
-#include "MuonAlignEvent/MdtAlignModule.h"
-#include "MuonAlignEvent/TgcAlignModule.h"
-#include "MuonAlignEvent/CscAlignModule.h"
-
-#include "MuonIdHelpers/MdtIdHelper.h"
-#include "MuonCalibStandAloneBase/RegionSelectionSvc.h"
-
-#include "GeoPrimitives/GeoPrimitivesHelpers.h"
-
-#include "TFile.h"
-#include "TTree.h"
-#include <iostream>
-
-using namespace MuonGM;
-
-namespace Muon {
-  
-//________________________________________________________________________
-CommonGeometryManagerTool::CommonGeometryManagerTool(const std::string& type,
-						 const std::string& name,
-						 const IInterface* parent)
-  : AthAlgTool(type,name,parent)
-  , p_muonMgr(0)
-  , m_idTool("MuonCalib::IdToFixedIdTool")
-  , m_regionSvc(0)
- {
-
-  declareProperty("doModuleSelection", m_doModuleSelection = false );
-  declareProperty("ModuleSelection",   m_moduleSelection );
-
-  declareProperty("AlignTraX",   m_alignTraX = true);
-  declareProperty("AlignTraY",   m_alignTraY = true);
-  declareProperty("AlignTraZ",   m_alignTraZ = true);
-  declareProperty("AlignRotX",   m_alignRotX = true);
-  declareProperty("AlignRotY",   m_alignRotY = true);
-  declareProperty("AlignRotZ",   m_alignRotZ = true);
-
-  declareProperty("SigmaTraX",   m_sigmaTraX = 1.);
-  declareProperty("SigmaTraY",   m_sigmaTraY = 1.);
-  declareProperty("SigmaTraZ",   m_sigmaTraZ = 1.);
-  declareProperty("SigmaRotX",   m_sigmaRotX = 0.001);
-  declareProperty("SigmaRotY",   m_sigmaRotY = 0.001);
-  declareProperty("SigmaRotZ",   m_sigmaRotZ = 0.001);
-
-  declareProperty("SoftCutTraX",   m_softcutTraX = 0.);
-  declareProperty("SoftCutTraY",   m_softcutTraY = 0.);
-  declareProperty("SoftCutTraZ",   m_softcutTraZ = 0.);
-  declareProperty("SoftCutRotX",   m_softcutRotX = 0.);
-  declareProperty("SoftCutRotY",   m_softcutRotY = 0.);
-  declareProperty("SoftCutRotZ",   m_softcutRotZ = 0.);
-
-}
-
-//________________________________________________________________________
-CommonGeometryManagerTool::~CommonGeometryManagerTool() 
-{
-  ATH_MSG_DEBUG("in CommonGeometryManagerTool d'tor");
-  
-}
-
-//_______________________________________________________________________
-StatusCode CommonGeometryManagerTool::initialize() 
-{
-  msg(MSG::DEBUG) << "initialize() of CommonGeometryManagerTool" << endmsg;  
-  
-  StatusCode sc=detStore()->retrieve(p_muonMgr);
-  if (sc.isFailure()) {
-    msg(MSG::FATAL)<<"Cannot retrieve MuonDetectorManager"<<endmsg;
-    return sc;
-  }
-  else msg(MSG::DEBUG)<<"retrieved MuonDetectorManager"<<endmsg;
-         
-  if (m_idTool.retrieve().isSuccess())
-    msg(MSG::INFO) << "Retrieved " << m_idTool << endmsg; 
-  else{
-    msg(MSG::FATAL)<<"Could not get " << m_idTool <<endmsg; 
-    return StatusCode::FAILURE;
-  }
-
-  sc=service("RegionSelectionSvc", m_regionSvc);
-  if(!sc.isSuccess())
-    {
-    msg(MSG::FATAL) << "Could not get RegionSelectionSvc!" << endmsg;
-    return sc;
-  }
-  
-  if (m_doModuleSelection){
-    msg(MSG::INFO) << "Region selection string: " 
-                   << m_regionSvc->GetRegionSelection() << endmsg;
-  }
-
-  // Print moduleSelection
-  if(m_doModuleSelection && m_moduleSelection.size()>0){
-    msg(MSG::INFO) << "The following modules will be selected (nModules="
-		   << m_moduleSelection.size()  << "): " << endmsg;
-    for(int i=0;i<(int)m_moduleSelection.size();i++){
-      msg(MSG::INFO) << "  module: " << m_moduleSelection[i] << endmsg;
-    }
-  }
-
-  return StatusCode::SUCCESS;
-}
-  
-//________________________________________________________________________
-StatusCode CommonGeometryManagerTool::finalize() 
-{  
-  msg(MSG::DEBUG) << "finalize() of CommonGeometryManagerTool" << endmsg;
- 
-  return StatusCode::SUCCESS;
-}
-
-//________________________________________________________________________
-void CommonGeometryManagerTool::setSigmas(DataVector<Trk::AlignPar>* modPars)
-{
-  for(unsigned int ipar=0;ipar<modPars->size();++ipar) {
-    switch(modPars->at(ipar)->paramType()) {
-    case Trk::AlignModule::TransX:
-      modPars->at(ipar)->setSigma(m_sigmaTraX);
-      modPars->at(ipar)->setSoftCut(m_softcutTraX);
-      break;
-    case Trk::AlignModule::TransY:
-      modPars->at(ipar)->setSigma(m_sigmaTraY);
-      modPars->at(ipar)->setSoftCut(m_softcutTraY);
-      break;
-    case Trk::AlignModule::TransZ:
-      modPars->at(ipar)->setSigma(m_sigmaTraZ);
-      modPars->at(ipar)->setSoftCut(m_softcutTraZ);
-      break;
-    case Trk::AlignModule::RotX:
-      modPars->at(ipar)->setSigma(m_sigmaRotX);
-      modPars->at(ipar)->setSoftCut(m_softcutRotX);
-      break;
-    case Trk::AlignModule::RotY:
-      modPars->at(ipar)->setSigma(m_sigmaRotY);
-      modPars->at(ipar)->setSoftCut(m_softcutRotY);
-      break;
-    case Trk::AlignModule::RotZ:
-      modPars->at(ipar)->setSigma(m_sigmaRotZ);
-      modPars->at(ipar)->setSoftCut(m_softcutRotZ);
-      break;
-    default:
-      break;
-    }
-  }
-}
-
-//________________________________________________________________________
-bool CommonGeometryManagerTool::chamberSelected(const MuonGM::MuonReadoutElement* mre)
-{
-  return chamberSelected(m_idTool->idToFixedId(mre->identifyATLAS()));
-}
-//________________________________________________________________________
-bool CommonGeometryManagerTool::chamberSelected(const MuonCalib::MuonFixedId& fid)
-{
-  if (!m_doModuleSelection) return true;
-  
-  return m_regionSvc->isInRegion(fid);
-}
-
-//________________________________________________________________________
-bool CommonGeometryManagerTool::moduleSelected(std::string name)
-{
-  bool goodmodule=!m_doModuleSelection;
-  
-  if (m_doModuleSelection) {
-    for (int imod=0;imod<(int)m_moduleSelection.size();imod++) {
-      if (name==m_moduleSelection[imod]) {		    
-	goodmodule=true;
-	break;
-      }
-    }
-  }
-
-  return goodmodule;
-}
-
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CscAlignDBTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CscAlignDBTool.cxx
deleted file mode 100644
index c0aec5738bf..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CscAlignDBTool.cxx
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-#include "MuonAlignGenTools/CscAlignDBTool.h"
-
-namespace Muon {
-  
-  //________________________________________________________________________
-  CscAlignDBTool::CscAlignDBTool(const std::string& type,
-				 const std::string& name,
-				 const IInterface* parent)
-    : MuonAlignDBTool(type,name,parent)
-  {
-  }
-  
-  //________________________________________________________________________
-  CscAlignDBTool::~CscAlignDBTool() 
-  {
-    
-  }
- 
-} // end namespace  
-  
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CscGeometryManagerTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CscGeometryManagerTool.cxx
deleted file mode 100644
index 4898d32ddda..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/CscGeometryManagerTool.cxx
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "MuonAlignGenTools/CscGeometryManagerTool.h"
-
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "DataModel/DataVector.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-#include "TrkAlignInterfaces/IAlignModuleTool.h"
-
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/TgcReadoutElement.h"
-#include "MuonReadoutGeometry/RpcReadoutElement.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonReadoutGeometry/MuonStation.h"
-
-#include "MuonCalibIdentifier/MuonFixedId.h"
-#include "MuonCalibITools/IIdToFixedIdTool.h"
-
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "TrkAlignEvent/AlignPar.h"
-#include "MuonAlignEvent/CombinedMuonAlignModule.h"
-#include "MuonAlignEvent/MdtAlignModule.h"
-
-#include "MuonIdHelpers/MdtIdHelper.h"
-#include "MuonCalibStandAloneBase/RegionSelectionSvc.h"
-
-#include "GeoPrimitives/GeoPrimitivesHelpers.h"
-
-#include "TFile.h"
-#include "TTree.h"
-#include <iostream>
-
-using namespace MuonGM;
-
-namespace Muon {
-  
-//________________________________________________________________________
-CscGeometryManagerTool::CscGeometryManagerTool(const std::string& type,
-						 const std::string& name,
-						 const IInterface* parent)
-  : CommonGeometryManagerTool(type,name,parent)
-  , m_alignModuleTool("Muon::MuonAlignModuleTool")
-  , m_idHashToAlignModuleMaps(Trk::AlignModule::NDetectorTypes,(Trk::AlignModuleList*)0)
-  , m_alignParList    (0)
-  , m_fullAlignParList(0)
- {
-
-  declareInterface<IGeometryManagerTool>(this);
-
-  declareProperty("AlignModuleTool",     m_alignModuleTool);
-  declareProperty("CscAlignParameters",  m_cscAlignParameters );
-  declareProperty("AlignLevel",          m_alignLevel=3);
-
-}
-
-//________________________________________________________________________
-CscGeometryManagerTool::~CscGeometryManagerTool() 
-{
-  ATH_MSG_DEBUG("in CscGeometryManagerTool d'tor");
-  
-  ATH_MSG_DEBUG("alignModuleList.size: "<<m_alignModuleList.size());
-  for (int i=0;i<(int)m_alignModuleList.size();i++) 
-    delete m_alignModuleList[i];
-  
-  ATH_MSG_DEBUG("deleting fullAlignParList");
-  delete m_fullAlignParList;
-  
-  ATH_MSG_DEBUG("deleting alignParList");
-  delete m_alignParList;
-
-  ATH_MSG_DEBUG("done with CscGeometryManagerTool d'tor");
-
-}
-
-//_______________________________________________________________________
-StatusCode CscGeometryManagerTool::initialize() 
-{
-  msg(MSG::DEBUG) << "initialize() of CscGeometryManagerTool" << endmsg;  
-
-  if (!CommonGeometryManagerTool::initialize().isSuccess()) {
-    ATH_MSG_FATAL("CommonGeometryManagerTool not initialized");
-    return StatusCode::FAILURE;
-  }
-  
-  return StatusCode::SUCCESS;
-}
-  
-//________________________________________________________________________
-StatusCode CscGeometryManagerTool::finalize() 
-{  
-  msg(MSG::DEBUG) << "finalize() of CscGeometryManagerTool" << endmsg;
-  
-  if (!CommonGeometryManagerTool::finalize().isSuccess()) {
-    ATH_MSG_FATAL("CommonGeometryManagerTool finalize not successful");
-    return StatusCode::FAILURE;
-  }
-  
-  return StatusCode::SUCCESS;
-}
-
-//________________________________________________________________________
-int CscGeometryManagerTool::ReadGeometry(int)
-{
-  ATH_MSG_DEBUG("in ReadGeometry()");
-  
-  // set pointers
-  m_idHashToAlignModuleMapsPtr = &m_idHashToAlignModuleMaps;
-  m_alignModuleListPtr = &m_alignModuleList;
-  
-  // build alignment geometry
-  buildGeometry();
-  
-  // now set the alignment parameters
-  // first prepare the parameter lists
-  m_alignParList     = new DataVector< DataVector<Trk::AlignPar> >(SG::OWN_ELEMENTS);
-  m_fullAlignParList = new DataVector< DataVector<Trk::AlignPar> >(SG::OWN_ELEMENTS);
-
-  // loop over modules
-  ATH_MSG_DEBUG("Adding module parameters to modules");
-  std::vector<Trk::AlignModule *>::const_iterator imod = m_alignModuleListPtr->begin();
-  std::vector<Trk::AlignModule *>::const_iterator imod_end = m_alignModuleListPtr->end();
-  for( ; imod!=imod_end ; ++imod) {
-    ATH_MSG_DEBUG("Module "<<(*imod)->name());
-    addModuleParameters(*imod,m_fullAlignParList,m_alignParList);
-  }
-  
-  // set alignModuleList and hash table in the alignModuleTool
-  m_alignModuleTool->setAlignModules(&m_alignModuleList, &m_idHashToAlignModuleMaps);
-  ATH_MSG_DEBUG(" geometry set in m_alignModuleTool");
-  
-  // set alignPar lists in the alignModuleTool
-  ATH_MSG_DEBUG(" alignParList = "<<m_alignParList);
-  ATH_MSG_DEBUG(" fullAlignParList = "<<m_fullAlignParList);
-  m_alignModuleTool->setAlignParLists(m_fullAlignParList, m_alignParList);
-  ATH_MSG_DEBUG(" AlignParLists set in m_alignModuleTool");
-    
-  int nDoF= m_alignModuleTool->nAlignParameters();
-  ATH_MSG_DEBUG("AlignModuleList has " << nDoF << " alignment parameters");
-  
-  ATH_MSG_DEBUG("leaving ReadGeometry");
-  return nDoF;
-}
-
-//________________________________________________________________________
-void CscGeometryManagerTool::buildGeometry()
-{
-  ATH_MSG_INFO("Preparing CSC geometry");
-  if      (m_alignLevel==0)  buildL0();
-  else if (m_alignLevel==3)  buildL3();
-  else if (m_alignLevel==1)  buildL1();
-  else if (m_alignLevel==23) return;
-  else
-    ATH_MSG_FATAL("Can't do alignLevel "<<m_alignLevel<<" yet!");
-  return;
-}
-
-//________________________________________________________________________
-void CscGeometryManagerTool::buildL3()
-{
-  ATH_MSG_ERROR("migrate CscGeometryManagerTool::buildL3() to Eigen!");
-  return;
-
-  /*
-  ATH_MSG_INFO("preparing CSC geometry for L3");
-
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	
-	CombinedMuonAlignModule* alignmod(0);
-	
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  const MuonGM::MdtReadoutElement* mdt=
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  
-	  if (!mdt) continue;
-	  
-          const Amg::Transform3D mdtTransform = mdt->AmdbLRSToGlobalTransform();
-          Amg::Transform3D gf2af=mdtTransform.inverse();
-	  
-	  if (alignmod==0) {
-	    
-	    if (!chamberSelected(mdt)) continue;
-	    
-	    alignmod=new CombinedMuonAlignModule(this,gf2af);
-	    
-	    // set alignModule identifier and idHash
-	    Identifier id=mdt->identifyATLAS();
-	    alignmod->setIdHash(getNextIDHash());
-	    alignmod->setIdentifier(id);
-	    
-	    // set alignModule name
-	    MuonCalib::MuonFixedId fid=m_idTool->idToFixedId(id);
-	    std::string name=fid.stationNumberToFixedStationString(fid.stationName());
-	    
-	    std::stringstream chamberName;
-	    chamberName<<name<<std::abs(fid.eta());
-	    if (fid.eta()<0) chamberName<<"C"; else chamberName<<"A";
-	    int detphi=2*fid.phi(); 
-	    if (name.substr(2,1)=="L")      detphi--;
-	    else if (name.substr(2,1)!="S") detphi=fid.phi();	      
-	    chamberName<<detphi;	      
-	    alignmod->setName(chamberName.str());
-	    
-	    ATH_MSG_DEBUG("created new MdtAlignModule, id "<<id
-			  <<", fixedId "<<fid.getIdInt()
-			  <<", "<<chamberName.str().c_str());
-	    	  
-	    m_alignModuleListPtr->push_back(alignmod);
-	  } // created new alignModule
-	  
-	  // add this mdt to alignModule and set map from idHash to AlignModule
-	  const Amg::Transform3D transform = Amg::Transform3D::Identity();
-	  alignmod->addDetElement(Trk::AlignModule::MDT,mdt,transform);
-	  
-	  int idHash=mdt->identifyHash(); // this returns idHash for MDT detector, not readout element. But it's ok because there's 1 detector element per align module.
-	   
-	  ATH_MSG_DEBUG("setting alignmod for idHash "<<idHash);
-	  (*mdtIdHashMap)[idHash]=alignmod;
-	  ATH_MSG_DEBUG("setting idHash");
-	  alignmod->setIdHash(idHash);
-
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-
-  return;
-  */
-}
-
-//________________________________________________________________________
-void CscGeometryManagerTool::buildL0()
-{
-  
-  ATH_MSG_INFO("preparing MDT geometry for L0");
-
-  // Create align module.  Alignment will be done in global frame.
-  //Amg::Transform3D transformBar=Amg::Transform3D::Identity();
-  
-  CombinedMuonAlignModule* mod= new CombinedMuonAlignModule(this,Amg::Transform3D::Identity());
-
-  mod->setIdHash(getNextIDHash());
-  mod->setName("MDT");
-  mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("BIL",1,1,1,1,1));
-  
-  // loop over MDT chambers and add to modules
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-  
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  const MuonGM::MdtReadoutElement* mdt = 
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  if (0==mdt) continue;
-	  
-	  // get AlignModule, determine whether endcap or barrel
-	  unsigned int det=Barrel;
-	  bool isBarrel=p_muonMgr->mdtIdHelper()->isBarrel(mdt->identify());
-	  
-	  // change to endcap if BEE
-	  if (isBarrel) {
-	    std::string stNameString=p_muonMgr->mdtIdHelper()->stationNameString(p_muonMgr->mdtIdHelper()->stationName(mdt->identify()));
-	    if (stNameString.substr(0,3)=="BEE") isBarrel=false;
-	  }
-	  
-	  if (!isBarrel) {
-	    int stEta=ieta-MuonGM::MuonDetectorManager::NMdtStEtaOffset;
-	    det = (stEta>0) ? EndcapA : EndcapC;
-	  }
-	  
-	  Trk::AlignModule* mod(0);
-	  for (int imod=0;imod<(int)m_alignModuleList.size();imod++) {
-	    if (m_alignModuleList[imod]->identify32()==det) {
-	      mod=m_alignModuleList[imod];
-	      break;
-	    }
-	  }
-	  
-	  if (!mod) continue;
-	  
-	  // add detector element to AlignModule
-	  IdentifierHash idHash=mdt->identifyHash();	  
-	  
-	  Amg::Transform3D level1AlignToAmdbLRS = 
-	    mod->globalFrameToAlignFrame().inverse() *
-	    mdt->AmdbLRSToGlobalTransform().inverse(); 
-	  
-	  
-	  mod->addDetElement(Trk::AlignModule::MDT,
-			     mdt, level1AlignToAmdbLRS);
-	  
-	  (*mdtIdHashMap)[idHash]=mod;
-	  
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-  
-  return;
-}
-//________________________________________________________________________
-void CscGeometryManagerTool::buildL1()
-{
-  
-  ATH_MSG_INFO("preparing MDT geometry for L1");
-
-  // Create align modules.  Alignment will be done in global frame for barrel and 
-  // each end cap.
-  std::string modulenames[nL1Modules]={"ECA","ECC","Bar"};
-  
-  for (int imod=0;imod<nL1Modules;imod++) {      
-    
-    if (!moduleSelected(modulenames[imod])) continue;
-    
-    CombinedMuonAlignModule* mod = 
-      new CombinedMuonAlignModule(this,Amg::Transform3D::Identity());
-
-    m_alignModuleListPtr->push_back(mod);
-    
-    mod->setIdHash(getNextIDHash());
-    mod->setName(modulenames[imod]);
-
-    switch (imod) {
-    case 0:
-      mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("EIL", 1,1,1,1,1));
-      break;
-    case 1:
-      mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("EIL",-1,1,1,1,1));
-      break;
-    case 2:
-      mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("BIL", 1,1,1,1,1));
-      break;
-    }
-  }
-
-  // loop over MDT chambers and add to modules
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-  
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  const MuonGM::MdtReadoutElement* mdt = 
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  if (0==mdt) continue;
-	  
-	  // get AlignModule, determine whether endcap or barrel
-	  unsigned int det=Barrel;
-	  bool isBarrel=p_muonMgr->mdtIdHelper()->isBarrel(mdt->identify());
-	  
-	  // change to endcap if BEE
-	  if (isBarrel) {
-	    std::string stNameString=p_muonMgr->mdtIdHelper()->stationNameString(p_muonMgr->mdtIdHelper()->stationName(mdt->identify()));
-	    if (stNameString.substr(0,3)=="BEE") isBarrel=false;
-	  }
-	  
-	  if (!isBarrel) {
-	    int stEta=ieta-MuonGM::MuonDetectorManager::NMdtStEtaOffset;
-	    det = (stEta>0) ? EndcapA : EndcapC;
-	  }
-	  
-	  Trk::AlignModule* mod(0);
-	  for (int imod=0;imod<(int)m_alignModuleList.size();imod++) {
-	    if (m_alignModuleList[imod]->identify32()==det) {
-	      mod=m_alignModuleList[imod];
-	      break;
-	    }
-	  }
-	  
-	  if (!mod) continue;
-	  
-	  // add detector element to AlignModule
-	  IdentifierHash idHash=mdt->identifyHash();	  
-	  
-	  Amg::Transform3D level1AlignToAmdbLRS = 
-	    mod->globalFrameToAlignFrame().inverse() *
-	    mdt->AmdbLRSToGlobalTransform().inverse();
-	  	  
-	  mod->addDetElement(Trk::AlignModule::MDT,
-			     mdt, level1AlignToAmdbLRS);
-	  
-	  (*mdtIdHashMap)[idHash]=mod;
-	  
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-  
-  return;
-}
-
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MdtAlignDBTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MdtAlignDBTool.cxx
deleted file mode 100644
index a72edf8171e..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MdtAlignDBTool.cxx
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-#include "MuonAlignGenTools/MdtAlignDBTool.h"
-
-namespace Muon {
-  
-  //________________________________________________________________________
-  MdtAlignDBTool::MdtAlignDBTool(const std::string& type,
-				 const std::string& name,
-				 const IInterface* parent)
-    : MuonAlignDBTool(type,name,parent)
-  {
-
-  }
-  
-  //________________________________________________________________________
-  MdtAlignDBTool::~MdtAlignDBTool() 
-  {
-    
-  }
-  
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MdtGeometryManagerTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MdtGeometryManagerTool.cxx
deleted file mode 100644
index c7c404ea8ec..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MdtGeometryManagerTool.cxx
+++ /dev/null
@@ -1,673 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "MuonAlignGenTools/MdtGeometryManagerTool.h"
-
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "DataModel/DataVector.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-#include "TrkAlignInterfaces/IAlignModuleTool.h"
-
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/TgcReadoutElement.h"
-#include "MuonReadoutGeometry/RpcReadoutElement.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonReadoutGeometry/MuonStation.h"
-
-#include "MuonCalibIdentifier/MuonFixedId.h"
-#include "MuonCalibITools/IIdToFixedIdTool.h"
-
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "TrkAlignEvent/AlignPar.h"
-#include "MuonAlignEvent/CombinedMuonAlignModule.h"
-#include "MuonAlignEvent/MdtAlignModule.h"
-
-#include "MuonIdHelpers/MdtIdHelper.h"
-#include "MuonCalibStandAloneBase/RegionSelectionSvc.h"
-
-#include "GeoPrimitives/GeoPrimitivesHelpers.h"
-
-#include "TFile.h"
-#include "TTree.h"
-#include <iostream>
-
-using namespace MuonGM;
-
-namespace Muon {
-  
-//________________________________________________________________________
-MdtGeometryManagerTool::MdtGeometryManagerTool(const std::string& type,
-						 const std::string& name,
-						 const IInterface* parent)
-  : CommonGeometryManagerTool(type,name,parent)
-  , m_alignModuleTool("Muon::MuonAlignModuleTool")
-  , m_idHashToAlignModuleMaps(Trk::AlignModule::NDetectorTypes,(Trk::AlignModuleList*)0)
-  , m_alignParList    (0)
-  , m_fullAlignParList(0)
- {
-
-  declareInterface<IGeometryManagerTool>(this);
-
-  declareProperty("AlignModuleTool", m_alignModuleTool);
-  declareProperty("AlignLevel",      m_alignLevel=3);
-}
-
-//________________________________________________________________________
-MdtGeometryManagerTool::~MdtGeometryManagerTool() 
-{
-  ATH_MSG_DEBUG("in MdtGeometryManagerTool d'tor");
-  
-  ATH_MSG_DEBUG("alignModuleList.size: "<<m_alignModuleList.size());
-  for (int i=0;i<(int)m_alignModuleList.size();i++) 
-    delete m_alignModuleList[i];
-  
-  ATH_MSG_DEBUG("deleting fullAlignParList");
-  delete m_fullAlignParList;
-  
-  ATH_MSG_DEBUG("deleting alignParList");
-  delete m_alignParList;
-
-  ATH_MSG_DEBUG("done with MdtGeometryManagerTool d'tor");
-
-}
-
-//_______________________________________________________________________
-StatusCode MdtGeometryManagerTool::initialize() 
-{
-  msg(MSG::DEBUG) << "initialize() of MdtGeometryManagerTool" << endmsg;  
-  
-  if (!CommonGeometryManagerTool::initialize().isSuccess()) {
-    ATH_MSG_FATAL("CommonGeometryManagerTool not initialized");
-    return StatusCode::FAILURE;
-  }
-
-  return StatusCode::SUCCESS;
-}
-  
-//________________________________________________________________________
-StatusCode MdtGeometryManagerTool::finalize() 
-{  
-  msg(MSG::DEBUG) << "finalize() of MdtGeometryManagerTool" << endmsg;
-
-  if (!CommonGeometryManagerTool::finalize().isSuccess()) {
-    ATH_MSG_FATAL("CommonGeometryManagerTool finalize not successful");
-    return StatusCode::FAILURE;
-  }
-    
-  return StatusCode::SUCCESS;
-}
-
-//________________________________________________________________________
-int MdtGeometryManagerTool::ReadGeometry(int)
-{
-  ATH_MSG_DEBUG("in ReadGeometry()");
-  
-  // set pointers
-  m_idHashToAlignModuleMapsPtr = &m_idHashToAlignModuleMaps;
-  m_alignModuleListPtr = &m_alignModuleList;
-  
-  // build alignment geometry
-  buildGeometry();
-  
-  // now set the alignment parameters
-  // first prepare the parameter lists
-  m_alignParList     = new DataVector< DataVector<Trk::AlignPar> >(SG::OWN_ELEMENTS);
-  m_fullAlignParList = new DataVector< DataVector<Trk::AlignPar> >(SG::OWN_ELEMENTS);
-
-  // loop over modules
-  ATH_MSG_DEBUG("Adding module parameters to modules");
-  std::vector<Trk::AlignModule *>::const_iterator imod = m_alignModuleListPtr->begin();
-  std::vector<Trk::AlignModule *>::const_iterator imod_end = m_alignModuleListPtr->end();
-  for( ; imod!=imod_end ; ++imod) {
-    ATH_MSG_DEBUG("Module "<<(*imod)->name());
-    addModuleParameters(*imod,m_fullAlignParList,m_alignParList);
-  }
-  
-  // set alignModuleList and hash table in the alignModuleTool
-  m_alignModuleTool->setAlignModules(&m_alignModuleList, &m_idHashToAlignModuleMaps);
-  ATH_MSG_DEBUG(" geometry set in m_alignModuleTool");
-  
-  // set alignPar lists in the alignModuleTool
-  ATH_MSG_DEBUG(" alignParList = "<<m_alignParList);
-  ATH_MSG_DEBUG(" fullAlignParList = "<<m_fullAlignParList);
-  m_alignModuleTool->setAlignParLists(m_fullAlignParList, m_alignParList);
-  ATH_MSG_DEBUG(" AlignParLists set in m_alignModuleTool");
-    
-  int nDoF= m_alignModuleTool->nAlignParameters();
-  ATH_MSG_DEBUG("AlignModuleList has " << nDoF << " alignment parameters");
-  
-  ATH_MSG_DEBUG("leaving ReadGeometry");
-  return nDoF;
-}
-
-//________________________________________________________________________
-void MdtGeometryManagerTool::buildGeometry()
-{
-  ATH_MSG_INFO("Preparing MDT geometry");
-  if      (m_alignLevel==0)  buildL0();
-  else if (m_alignLevel==3)  buildL3();
-  else if (m_alignLevel==1)  buildL1();
-  else if (m_alignLevel==23) buildL23();
-  else
-    ATH_MSG_FATAL("Can't do alignLevel "<<m_alignLevel<<" yet!");
-}
-
-//________________________________________________________________________
-void MdtGeometryManagerTool::buildL3()
-{
-
-  ATH_MSG_ERROR("migrate  MdtGeometryManagerTool::buildL3() to Eigen");
-  return;
-
-  /*
-  ATH_MSG_INFO("preparing MDT geometry for L3");
-
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	
-	CombinedMuonAlignModule* alignmod(0);
-	
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  const MuonGM::MdtReadoutElement* mdt=
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  
-	  if (!mdt) continue;
-	  
-          const Amg::Transform3D mdtTransform = mdt->AmdbLRSToGlobalTransform();
-          Amg::Transform3D gf2af=mdtTransform.inverse();
-	  
-	  if (alignmod==0) {
-	    
-	    if (!chamberSelected(mdt)) continue;
-	    
-	    alignmod=new CombinedMuonAlignModule(this,gf2af);
-	    
-	    // set alignModule identifier and idHash
-	    Identifier id=mdt->identifyATLAS();
-	    alignmod->setIdHash(getNextIDHash());
-	    alignmod->setIdentifier(id);
-	    
-	    // set alignModule name
-	    MuonCalib::MuonFixedId fid=m_idTool->idToFixedId(id);
-	    std::string name=fid.stationNumberToFixedStationString(fid.stationName());
-	    
-	    std::stringstream chamberName;
-	    chamberName<<name<<std::abs(fid.eta());
-	    if (fid.eta()<0) chamberName<<"C"; else chamberName<<"A";
-	    int detphi=2*fid.phi(); 
-	    if (name.substr(2,1)=="L")      detphi--;
-	    else if (name.substr(2,1)!="S") detphi=fid.phi();	      
-	    chamberName<<detphi;	      
-	    alignmod->setName(chamberName.str());
-	    
-	    ATH_MSG_DEBUG("created new MdtAlignModule, id "<<id
-			  <<", fixedId "<<fid.getIdInt()
-			  <<", "<<chamberName.str().c_str());
-	    	  
-	    m_alignModuleListPtr->push_back(alignmod);
-	  } // created new alignModule
-	  
-	  // add this mdt to alignModule and set map from idHash to AlignModule
-	  const Amg::Transform3D transform = Amg::Transform3D::Identity();
-	  alignmod->addDetElement(Trk::AlignModule::MDT,mdt,transform);
-	  
-	  int idHash=mdt->identifyHash(); // this returns idHash for MDT detector, not readout element. But it's ok because there's 1 detector element per align module.
-	   
-	  ATH_MSG_DEBUG("setting alignmod for idHash "<<idHash);
-	  (*mdtIdHashMap)[idHash]=alignmod;
-	  ATH_MSG_DEBUG("setting idHash");
-	  alignmod->setIdHash(idHash);
-
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-
-  return;
-  */
-}
-
-//________________________________________________________________________
-void MdtGeometryManagerTool::buildL0()
-{
-  
-  ATH_MSG_INFO("preparing MDT geometry for L0");
-
-  // Create align module.  Alignment will be done in global frame.
-  //Amg::Transform3D transformBar=Amg::Transform3D::Identity();
-  
-  CombinedMuonAlignModule* mod= new CombinedMuonAlignModule(this,Amg::Transform3D::Identity());
-
-  m_alignModuleListPtr->push_back(mod);
-
-  int idHash=getNextIDHash();
-  ATH_MSG_DEBUG("setting idHash "<<idHash);
-  mod->setIdHash(idHash);
-  mod->setName("MDT");
-  //mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("BIL",1,1,1,1,1));
-  mod->setIdentifier((Identifier)0);
-  
-  // loop over MDT chambers and add to modules
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-  
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  const MuonGM::MdtReadoutElement* mdt = 
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  if (0==mdt) continue;
-
-	  int imod=0;
-	  Trk::AlignModule* mod=(*m_alignModuleListPtr)[imod];
-	  if (!mod) {
-	    ATH_MSG_DEBUG("no mod selected!");
-	    continue;
-	  }
-	  
-	  // add detector element to AlignModule
-	  IdentifierHash idHash=mdt->identifyHash();	  
-	  
-	  Amg::Transform3D level1AlignToAmdbLRS = 
-	    mod->globalFrameToAlignFrame().inverse() *
-	    mdt->AmdbLRSToGlobalTransform().inverse(); 
-	  
-	  
-	  mod->addDetElement(Trk::AlignModule::MDT,
-			     mdt, level1AlignToAmdbLRS);
-	  
-	  ATH_MSG_DEBUG("setting mdtIdHashMap["<<idHash<<"] to "<<mod->name());
-	  (*mdtIdHashMap)[idHash]=mod;
-	  
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-  
-  return;
-}
-//________________________________________________________________________
-void MdtGeometryManagerTool::buildL1()
-{
-  
-  ATH_MSG_INFO("preparing MDT geometry for L1");
-
-  // Create align modules.  Alignment will be done in global frame for barrel and 
-  // each end cap.
-  std::string modulenames[nL1Modules]={"ECA","ECC","Bar"};
-  
-  for (int imod=0;imod<nL1Modules;imod++) {      
-    
-    ATH_MSG_DEBUG("imod: "<<imod);
-
-    if (!moduleSelected(modulenames[imod])) continue;
-
-    ATH_MSG_DEBUG("module selected");
-
-    CombinedMuonAlignModule* mod = 
-      new CombinedMuonAlignModule(this,Amg::Transform3D::Identity());
-
-    m_alignModuleListPtr->push_back(mod);
-    //mod->setIdHash(getNextIDHash());
-    int idHash=getNextIDHash();
-    ATH_MSG_DEBUG("idHash: "<<idHash);
-    mod->setIdHash(idHash);
-    mod->setName(modulenames[imod]);
-
-    Identifier id;
-    switch (imod) {
-    case 0:
-      ATH_MSG_DEBUG("setting ID for ECA");
-      //mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("EIL",1,1,1,1,1));
-      mod->setIdentifier((Identifier)EndcapA);
-      break;
-    case 1:
-      ATH_MSG_DEBUG("setting ID for ECC");
-      //mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("EIL",-1,1,1,1,1));
-      mod->setIdentifier((Identifier)EndcapC);
-      break;
-    case 2:
-      ATH_MSG_DEBUG("setting ID for Barrel");
-      //mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("BIL",1,1,1,1,1));
-      mod->setIdentifier((Identifier)Barrel);
-      break;
-    }
-  }
-
-  ATH_MSG_DEBUG("adding MDT chambers to L1 modules");
-
-  // loop over MDT chambers and add to modules
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-  
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  //ATH_MSG_DEBUG(iname<<" "<<ieta<<" "<<iphi<<" "<<imult);
-
-	  const MuonGM::MdtReadoutElement* mdt = 
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  if (0==mdt) continue;
-
-	  ATH_MSG_DEBUG("have mdt");
-
-	  // get AlignModule, determine whether endcap or barrel
-	  unsigned int det=Barrel;
-	  bool isBarrel=p_muonMgr->mdtIdHelper()->isBarrel(mdt->identify());
-	  
-	  // change to endcap if BEE
-	  if (isBarrel) {
-	    std::string stNameString=p_muonMgr->mdtIdHelper()->stationNameString(p_muonMgr->mdtIdHelper()->stationName(mdt->identify()));
-	    if (stNameString.substr(0,3)=="BEE") isBarrel=false;
-	  }
-	  
-	  if (!isBarrel) {
-	    int stEta=ieta-MuonGM::MuonDetectorManager::NMdtStEtaOffset;
-	    det = (stEta>0) ? EndcapA : EndcapC;
-	  }
-	  
-	  ATH_MSG_DEBUG("looping over alignModList (size: "<<m_alignModuleList.size()<<")");
-
-	  Trk::AlignModule* mod(0);
-	  for (int imod=0;imod<(int)m_alignModuleListPtr->size();imod++) {
-	    ATH_MSG_DEBUG("alignModuleList["<<imod<<"]="<<(*m_alignModuleListPtr)[imod]->identify32());
-	    if ((*m_alignModuleListPtr)[imod]->identify32()==det) {
-	      mod=(*m_alignModuleListPtr)[imod];
-	      break;
-	    }
-	  }
-	  
-	  if (!mod) continue;
-	  
-	  // add detector element to AlignModule
-	  IdentifierHash idHash=mdt->identifyHash();	  
-	  
-	  Amg::Transform3D level1AlignToAmdbLRS = 
-	    mod->globalFrameToAlignFrame().inverse() *
-	    mdt->AmdbLRSToGlobalTransform().inverse(); 
-	  	  
-	  mod->addDetElement(Trk::AlignModule::MDT,
-			     mdt, level1AlignToAmdbLRS);
-	  
-	  ATH_MSG_DEBUG("setting idHashMap for idHash: "<<idHash);
-
-	  (*mdtIdHashMap)[idHash]=mod;
-	  
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-  
-  return;
-}
-
-//________________________________________________________________________
-void MdtGeometryManagerTool::buildL23()
-{
-
-  ATH_MSG_INFO("migrate MdtGeometryManagerTool::buildL23() to Eigen");
-  return;
-
-
-  /*
-  ATH_MSG_INFO("preparing MDT geometry for L2.3");
-  
-  //get module names
-  unsigned int nSectors = 16;
-  std::vector<std::string> moduleNames(64);
-  
-  unsigned int imod=0;
-  for (unsigned int isec=0; isec<nSectors; isec++) {
-    
-    bool isSmall = ((isec+1)%2 == 0) ? true : false; 
-    for (int detSide=0; detSide<2; detSide++){
-      
-      std::stringstream moduleStream;
-      moduleStream<<"Sector";
-      
-      if (detSide==0) moduleStream<<"A";
-      else            moduleStream<<"C";
-      
-      moduleStream<<(isec+1);
-      std::string moduleString=moduleStream.str();
-      
-      if(!isSmall){
-        moduleNames[imod++]=moduleString;
-      }
-      else{
-        moduleNames[imod++]=moduleString+"_I";
-        moduleNames[imod++]=moduleString+"_M";
-        moduleNames[imod++]=moduleString+"_O";
-      }
-    }
-  }
-  
-  // create AlignModules
-  for (imod=0; imod<moduleNames.size(); ++imod) {
-    
-    ATH_MSG_DEBUG("building Module: " << moduleNames[imod]);
-    if (!moduleSelected(moduleNames[imod])){ 
-      ATH_MSG_DEBUG("Module not in selection.");
-      continue;
-    }
-    
-    CombinedMuonAlignModule* mod;
-    mod = new CombinedMuonAlignModule(this,Amg::Transform3D::Identity());
-    m_alignModuleListPtr->push_back(mod);
-    
-    mod->setName(moduleNames[imod]);
-    mod->setIdentifier((Identifier)imod);
-    mod->setIdHash(getNextIDHash());
-  }
-  
-  // loop over MDT chamber and add to AlignModules
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-  
-  int etamax = abs(p_muonMgr->mdtIdHelper()->stationEtaMin(true))
-    + p_muonMgr->mdtIdHelper()->stationEtaMax(true);
-
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ietaindex=0; ietaindex<etamax; ietaindex++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {	
-	for (int imult=1; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  
-	  //loop first eta=0..8, then eta=-1..-8
-          int ieta = ietaindex;
-          if (ietaindex > p_muonMgr->mdtIdHelper()->stationEtaMax(true)) {
-            ieta = -1*(ietaindex - p_muonMgr->mdtIdHelper()->stationEtaMax(true));
-          }
-	  
-          ATH_MSG_DEBUG("loop -> name: " << iname << ", eta: " << ieta 
-                        << ", phi: " << iphi << ", mult: " << imult);
-	  
-          bool isValid(true);
-          Identifier chid = p_muonMgr->mdtIdHelper()->channelID(iname,ieta,iphi,imult,1,1,true,&isValid);
-          if (!isValid){ 
-            ATH_MSG_DEBUG("not valid ID!");
-            continue;
-          }
-	  
-          int stName = p_muonMgr->mdtIdHelper()->stationName(chid);
-          int stEta  = p_muonMgr->mdtIdHelper()->stationEta(chid);
-          int stPhi  = p_muonMgr->mdtIdHelper()->stationPhi(chid);
-          int ml     = p_muonMgr->mdtIdHelper()->multilayer(chid);
-       
-          ATH_MSG_DEBUG("loop2 -> name: " << stName << ", eta: " << stEta 
-                        << ", phi: " << stPhi << ", mult: " << ml << ", valid: " << isValid);
-
-          const MuonGM::MdtReadoutElement* mdt = 
-            p_muonMgr->getMdtReadoutElement(chid);
- 
-	  if (!mdt) continue;
-	  
-	  bool isBarrel=p_muonMgr->mdtIdHelper()->isBarrel(mdt->identify());
-	  if (!isBarrel){
-            ATH_MSG_DEBUG("is not Barrel");
-            continue;
-          }
-	  
-          MuonCalib::MuonFixedId fid=m_idTool->idToFixedId(mdt->identify());
-          std::string name=fid.stationNumberToFixedStationString(fid.stationName());	    
-          ATH_MSG_DEBUG("name: " << name);
-	  
-          if(name=="BEE"){
-            ATH_MSG_DEBUG("Is BEE chamber, will be rejected.");
-            continue;
-	  }
-	  
-          std::stringstream chamberName;
-          chamberName<<name<<std::abs(fid.eta());
-          if (fid.eta()<0) chamberName<<"C"; else chamberName<<"A";
-          int detphi=2*fid.phi(); 
-          if (name.substr(2,1)=="L")      detphi--;
-          else if (name.substr(2,1)!="S") detphi=fid.phi();	      
-          chamberName<<detphi;	      
-          ATH_MSG_DEBUG("chamberName: " << chamberName.str());
-	  
-          std::stringstream modName;
-          modName<<"Sector";
-          if (fid.eta()<0) modName<<"C"; 
-          else             modName<<"A";
-          modName<<detphi;
-          
-          ATH_MSG_DEBUG("iphi: " << iphi);
-          if(detphi%2==0){
-            ATH_MSG_DEBUG("is odd");
-            if (name.substr(1,1)=="I")      modName<<"_I";
-            else if (name.substr(1,1)=="M") modName<<"_M";
-            else if (name.substr(1,1)=="O") modName<<"_O";
-            else ATH_MSG_WARNING("Could not identify chamber layer for chamber: " << name);
-          }
-          
-          ATH_MSG_DEBUG("modName: " << modName.str());
-	  
-	  Trk::AlignModule* mod(0);
-	  for (unsigned int imod=0;imod<m_alignModuleListPtr->size();imod++) {
-	    ATH_MSG_DEBUG("alignModuleList["<<imod<<"]="<<(*m_alignModuleListPtr)[imod]->identify32());
-            if ((*m_alignModuleListPtr)[imod]->name()==modName.str()) {
-	      mod=(*m_alignModuleListPtr)[imod];
-	      break;
-	    }
-	  }
-	  
-	  if (!mod) { ATH_MSG_DEBUG("no module"); continue; }
-
-	  //set alignframe to the local frame of first readout element
-          if (mod->globalFrameToAlignFrame()==Identity) {
-            const Amg::Transform3D mdtTransform = mdt->AmdbLRSToGlobalTransform();
-            Amg::Transform3D gf2af=mdtTransform.inverse();
-            mod->setGlobalFrameToAlignFrameTransform(gf2af);
-	    
-	    
-            ATH_MSG_DEBUG("setting globalFrameToAlignFrame: "<<endmsg
-                          <<     gf2af[0][0]<<" "<< gf2af[0][1]<<" "<< gf2af[0][2]
-                          <<" "<<gf2af[1][0]<<" "<< gf2af[1][1]<<" "<< gf2af[1][2]
-                          <<" "<<gf2af[2][0]<<" "<< gf2af[2][1]<<" "<< gf2af[2][2]<<" ");
-	    
-	    
-            Identifier id = mdt->identifyATLAS();
-            mod->setIdentifier(id);
-            ATH_MSG_DEBUG("name: " << name << ", eta: " << ieta << ", phi: " << iphi);
-            ATH_MSG_DEBUG("alignmod identifier: " << id.getString());
-          } 
-	  else 
-            ATH_MSG_DEBUG("transform already set");          
-          	 	  
-	  // add detector element to AlignModule
-	  IdentifierHash idHash=mdt->identifyHash();	  
-
-	  Amg::Transform3D level23AlignToAmdbLRS = 
-	    mod->globalFrameToAlignFrame().inverse() *
-	    mdt->AmdbLRSToGlobalTransform().inverse(); 
-	  
-           mod->addDetElement(Trk::AlignModule::MDT,
-                              mdt, level23AlignToAmdbLRS);
-	  (*mdtIdHashMap)[idHash]=mod;
-
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-
-  return;
-  */
-
-}
-
-//________________________________________________________________________
-void MdtGeometryManagerTool::addModuleParameters(Trk::AlignModule * module, 
-						 DataVector<DataVector<Trk::AlignPar> >* allFullModPars, 
-						 DataVector<DataVector<Trk::AlignPar> >* allActiveModPars)
-{
-  ATH_MSG_DEBUG("in addModuleParameters");
-  
-    // prepare all parameters
-  ATH_MSG_DEBUG("preparing all parameters");
-  DataVector<Trk::AlignPar> * fullModPars = new DataVector<Trk::AlignPar>(SG::OWN_ELEMENTS);
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::TransX));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::TransY));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::TransZ));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::RotX));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::RotY));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::RotZ));
-  
-  // set sigmas
-  ATH_MSG_DEBUG("setting sigmas");
-  setSigmas(fullModPars);
-  
-  ATH_MSG_DEBUG("setting active parameters");
-  // select active parameters based on jobOption properties
-  DataVector<Trk::AlignPar> * activeModPars = new DataVector<Trk::AlignPar>(SG::VIEW_ELEMENTS);
-  for(unsigned int ipar=0;ipar<fullModPars->size();++ipar) {
-    
-    if(  (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransX && alignTraX()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransY && alignTraY()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransZ && alignTraZ()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotX   && alignRotX()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotY   && alignRotY()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotZ   && alignRotZ()) ) {
-      ATH_MSG_DEBUG("parameter type "
-		    <<fullModPars->at(ipar)->paramType()<<" \'"
-		    <<fullModPars->at(ipar)->dumpType()<<"\' is now active");
-      activeModPars->push_back(fullModPars->at(ipar));
-    }
-    else
-      ATH_MSG_DEBUG("parameter type "
-		    <<fullModPars->at(ipar)->paramType()<<" \'"
-		    <<fullModPars->at(ipar)->dumpType()<<"\' is NOT active");
-  }
-  
-  // now add parameters to the list
-  allFullModPars->push_back(fullModPars);
-  allActiveModPars->push_back(activeModPars);
-}
-
-
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignDBTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignDBTool.cxx
deleted file mode 100644
index 70d4ec1a255..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignDBTool.cxx
+++ /dev/null
@@ -1,1328 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-
-#include "GaudiKernel/SystemOfUnits.h"
-
-#include "GeoModelInterfaces/IGeoModelSvc.h"
-#include "RDBAccessSvc/IRDBAccessSvc.h"
-#include "RDBAccessSvc/IRDBRecordset.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonIdHelpers/MdtIdHelper.h"
-
-#include "MuonCalibITools/IIdToFixedIdTool.h"
-#include "MuonCalibIdentifier/MuonFixedId.h"
-#include "MuonCondInterface/IMultiLevelAlignmentDbTool.h"
-
-#include "TrkAlignInterfaces/IAlignModuleTool.h"
-#include "TrkAlignEvent/AlignParList.h"
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "MuonAlignEvent/MdtAlignModule.h"
-#include "MuonAlignGenTools/MuonAlignDBTool.h"
-
-#include "TFile.h"
-#include "TTree.h"
-
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include <map>
-#include "Identifier/Identifier.h"
-
-using namespace MuonGM;
-
-namespace Muon {
-  
-  //________________________________________________________________________
-  MuonAlignDBTool::MuonAlignDBTool(const std::string& type,
-				   const std::string& name,
-				   const IInterface* parent)
-    : AthAlgTool(type,name,parent)
-    , m_multilevelDbTool("MultiLevelAlignmentDbTool")
-    , m_idTool("MuonCalib::IdToFixedIdTool")
-    , m_alignModuleTool("Muon::MuonAlignModuleTool")
-    , p_muonMgr(0)
-    , m_ntuple(0)
-    , m_rdbAccessSvc(0)
-    , m_muonDetMgr(0)
-    , m_alines(0)
-    , m_detElemLookup_identifier(0)
-    , m_detElemLookup_alignMod(0)
-    , m_detElemLookup_detElem(0)
-    , m_detElemLookup_alineIndex(0)
-    , m_detElemLookup_stName(0)
-    , m_detElemLookup_stPhi(0)
-    , m_detElemLookup_stEta(0)
-    , m_useMultiLevelDbTool(true)
-  {
-    
-    declareInterface<ITrkAlignDBTool>(this);
-    
-    declareProperty("AlternateASZTFile", m_asztInputFile="aszt.txt");
-    declareProperty("ASZTOutputFile",    m_asztOutputFile="aszt_out.txt");
-    declareProperty("SigmaInputFile",    m_sigmaInputFile="");
-    declareProperty("SigmaOutputFile",   m_sigmaOutputFile="sigmas_out.txt");
-    declareProperty("AlignModuleTool",   m_alignModuleTool);
-    //declareProperty("StoreL3Params",     m_storeL3Params=true);
-    declareProperty("UseMultiLevelDbTool", m_useMultiLevelDbTool=true);
-    declareProperty("MultiLevelAlignmentDbTool",  m_multilevelDbTool);
-    
-  }
-  
-  //________________________________________________________________________
-  MuonAlignDBTool::~MuonAlignDBTool() 
-  {
-
-    delete m_detElemLookup_identifier;
-    delete m_detElemLookup_alignMod;
-    delete m_detElemLookup_detElem;
-    delete m_detElemLookup_alineIndex;
-   
-  }
-  
-  //________________________________________________________________________
-  StatusCode MuonAlignDBTool::initialize() 
-  {
-    ATH_MSG_INFO("initialize() of MuonAlignDBTool");  
-    
-    StatusCode sc;
-    
-    sc=detStore()->retrieve(p_muonMgr);
-    if (sc.isFailure()) {
-      ATH_MSG_FATAL("Cannot retrieve MuonDetectorManager");
-      return sc;
-    }
-    else ATH_MSG_DEBUG("retrieved MuonDetectorManager");
-    
-    if (m_useMultiLevelDbTool) {
-      if (m_multilevelDbTool.retrieve().isSuccess())
-	ATH_MSG_INFO("Retrieved " << m_multilevelDbTool);
-      else {      
-	ATH_MSG_WARNING("Could not get " << m_multilevelDbTool);
-      }
-    }
-
-    if (m_idTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_idTool);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_idTool); 
-      return StatusCode::FAILURE;
-    }
-    
-    if (m_alignModuleTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_alignModuleTool);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_alignModuleTool); 
-      return StatusCode::FAILURE;
-    }
-    
-    IGeoModelSvc *geoModel;
-    sc = service ("GeoModelSvc",geoModel);
-    if (sc.isSuccess())
-      ATH_MSG_INFO("Retrieved GeoModelSvc");
-    else {
-      ATH_MSG_FATAL("Couldn't get GeoModelSvc");
-      return StatusCode::FAILURE;
-    }
-
-    std::string AtlasVersion = geoModel->atlasVersion();
-    std::string MuonVersion  = geoModel->muonVersionOverride();
-    m_detectorKey  = MuonVersion.empty() ? AtlasVersion : MuonVersion;
-    m_detectorNode = MuonVersion.empty() ? "ATLAS" : "MuonSpectrometer";    
-    sc = service("RDBAccessSvc",m_rdbAccessSvc);
-    if (sc.isSuccess())
-      ATH_MSG_INFO("Retrieved RDBAccessSvc");
-    else {
-      ATH_MSG_FATAL("Couldn't get RDBAccessSvc");
-      return StatusCode::FAILURE;
-    }
-    
-    // get muon detector manager
-    StoreGateSvc* detStore = 0;
-    if (StatusCode::SUCCESS != service("DetectorStore", detStore)) {
-      ATH_MSG_FATAL("DetectorStore not found");
-      return StatusCode::FAILURE;
-    }
-    if (StatusCode::SUCCESS != detStore->retrieve(m_muonDetMgr)) {
-      ATH_MSG_FATAL("Couldn't retrieve muon detector manager");
-      return StatusCode::FAILURE;
-    }
-    
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonAlignDBTool::finalize() 
-  {  
-    ATH_MSG_DEBUG("finalize() of MuonAlignDBTool");
-    
-    // delete ALines if created here
-    if (m_alines != p_muonMgr->ALineContainer() && 
-	m_alines != m_multilevelDbTool->level1Container()) {
-      ATH_MSG_DEBUG("deleting ALines");
-      delete m_alines;
-    }
-
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonAlignDBTool::preSolve()
-  {
-    StatusCode sc=getInitialALines();
-    if (sc != StatusCode::SUCCESS) {
-      ATH_MSG_ERROR("failed to get initial A-lines!");
-      return StatusCode::FAILURE;
-    }    
-    return StatusCode::SUCCESS;
-  }
-  
-  //________________________________________________________________________
-  StatusCode MuonAlignDBTool::getInitialALines()
-  {
-       
-    using namespace MuonGM;
-        
-    ATH_MSG_DEBUG("alignModuleListType="<<m_alignModuleTool->alignModuleListType());
-
-    if (m_alignModuleTool->alignModuleListType()==Trk::L3) {
-      
-      ATH_MSG_DEBUG("firstEventInitialize for L3");
-
-      if (m_asztInputFile!="") { 
-	ATH_MSG_DEBUG("asztInputFile: "<<m_asztInputFile);
-	std::map<std::string, std::string> asciiFileDBMap;
-	asciiFileDBMap.insert(std::make_pair("ASZT",m_asztInputFile));
-	
-	ATH_MSG_INFO("getting alines from ascii file");
-	m_alines = asciiToALines(m_asztInputFile);
-	ATH_MSG_DEBUG("ALines from ascii");      
-      }
-      else {
-	m_alines = p_muonMgr->ALineContainer();
-	ATH_MSG_DEBUG("ALines from muon manager, size "<<m_alines->size());      
-      }
-
-      createL3LookupTable();
-    }
-    else if (m_alignModuleTool->alignModuleListType()==Trk::L1) {
-      ATH_MSG_DEBUG("firstEventInitialize for L1");
-      m_alines = m_multilevelDbTool->level1Container();
-      createL1LookupTable();
-    }
-    else if (m_alignModuleTool->alignModuleListType()==Trk::L2) {
-      ATH_MSG_DEBUG("firstEventInitialize for L2.3");
-      //ATH_MSG_ERROR("L2.3 is not yet implemented in the MultilevelDbTool");
-      //return StatusCode::FAILURE;
-      m_alines = m_multilevelDbTool->level23Container();
-      createL23LookupTable();
-    }
-    else {
-      ATH_MSG_ERROR("bad option -- should be L1, L2.3 or L3");
-      return StatusCode::FAILURE;
-    }
-    ATH_MSG_DEBUG("returning from firstEventInitialize()");
-    
-    return StatusCode::SUCCESS;
-  }
-  
-  //__________________________________________________________________________
-  void MuonAlignDBTool::decomposeTransform(const Amg::Transform3D& /*transform*/, double* /*values*/) const
-  { 
-    ATH_MSG_ERROR("migrate decomposeTransform to Eigen");
-    return;
-
-    /*
-    // copied from AlignModule 
-    HepGeom::Scale3D scale; 
-    HepGeom::Rotate3D   rotation; 
-    HepGeom::Translate3D translation; 
-    transform.getDecomposition(scale,rotation,translation); 
-    
-    values[0]=translation.dx(); 
-    values[1]=translation.dy(); 
-    values[2]=translation.dz(); 
-    
-    
-    // a12 = cosbeta singamma     
-    // a13 = -sinbeta 
-    // a23 =  sinalpha cosbeta 
-    
-    double sinbeta = -rotation[0][2]; 
-    double cosbeta = std::sqrt(1.-sinbeta*sinbeta); 
-    
-    double sinalpha = rotation[1][2]/cosbeta;     
-    double singamma = rotation[0][1]/cosbeta; 
-    
-    values[3]=-std::asin(sinalpha); 
-    values[4]=-std::asin(sinbeta); 
-    values[5]=-std::asin(singamma); 
-    
-    return;
-    */
-  } 
-
-
-  //________________________________________________________________________
-  void MuonAlignDBTool::writeAlignPar()
-  {
-    ATH_MSG_ERROR("migrate MuonAlignDBTool::writeAlignPar() to Eigen");
-    return;
-
-    /*
-
-    //using namespace CLHEP;
-
-    long long int chamberId;
-    int    nDoF,nTracks;
-    double trackChi2;
-    double init_tras, init_traz, init_trat;
-    double init_rots, init_rotz, init_rott;
-    double delta_tras, delta_traz, delta_trat;
-    double delta_rots, delta_rotz, delta_rott;
-    double err_tras, err_traz, err_trat;
-    double err_rots, err_rotz, err_rott;
-    double firstderiv_tras;
-    double firstderiv_traz;
-    double firstderiv_trat;
-    double firstderiv_rots;
-    double firstderiv_rotz;
-    double firstderiv_rott;
-    double secndderiv_tras;
-    double secndderiv_traz;
-    double secndderiv_trat;
-    double secndderiv_rots;
-    double secndderiv_rotz;
-    double secndderiv_rott;
-
-    ATH_MSG_DEBUG("creating alignPar tree");
-    TTree* tree(0);
-    if (m_ntuple) {
-
-      m_ntuple->cd();
-
-      std::string treename="alignPar";
-
-      tree=new TTree(treename.c_str(),treename.c_str());
-
-      tree->Branch("chamberId",       &chamberId,       "chamberId/L");
-
-      tree->Branch("nDoF",            &nDoF,            "nDoF/I");
-      tree->Branch("nTracks",         &nTracks,         "nTracks/I");
-      tree->Branch("trackChi2",       &trackChi2,       "trackChi2/D");
-      tree->Branch("delta_tras",      &delta_tras,      "delta_tras/D"); //in mm 
-      tree->Branch("delta_traz",      &delta_traz,      "delta_traz/D"); 
-      tree->Branch("delta_trat",      &delta_trat,      "delta_trat/D"); 
-      tree->Branch("delta_rots",      &delta_rots,      "delta_rots/D"); //in rad
-      tree->Branch("delta_rotz",      &delta_rotz,      "delta_rotz/D"); 
-      tree->Branch("delta_rott",      &delta_rott,      "delta_rott/D"); 
-      tree->Branch("err_tras",        &err_tras,        "err_tras/D"); //in mm 
-      tree->Branch("err_traz",        &err_traz,        "err_traz/D"); 
-      tree->Branch("err_trat",        &err_trat,        "err_trat/D"); 
-      tree->Branch("err_rots",        &err_rots,        "err_rots/D"); //in rad
-      tree->Branch("err_rotz",        &err_rotz,        "err_rotz/D"); 
-      tree->Branch("err_rott",        &err_rott,        "err_rott/D"); 
-      tree->Branch("init_tras",       &init_tras,       "init_tras/D");  //in mm 
-      tree->Branch("init_traz",       &init_traz,       "init_traz/D");  
-      tree->Branch("init_trat",       &init_trat,       "init_trat/D");  
-      tree->Branch("init_rots",       &init_rots,       "init_rots/D");  //in rad
-      tree->Branch("init_rotz",       &init_rotz,       "init_rotz/D"); 
-      tree->Branch("init_rott",       &init_rott,       "init_rott/D"); 
-      tree->Branch("firstderiv_tras", &firstderiv_tras, "firstderiv_tras/D");
-      tree->Branch("firstderiv_traz", &firstderiv_traz, "firstderiv_traz/D");
-      tree->Branch("firstderiv_trat", &firstderiv_trat, "firstderiv_trat/D");
-      tree->Branch("firstderiv_rots", &firstderiv_rots, "firstderiv_rots/D");
-      tree->Branch("firstderiv_rotz", &firstderiv_rotz, "firstderiv_rotz/D");
-      tree->Branch("firstderiv_rott", &firstderiv_rott, "firstderiv_rott/D");
-      tree->Branch("secndderiv_tras", &secndderiv_tras, "secndderiv_tras/D");
-      tree->Branch("secndderiv_traz", &secndderiv_traz, "secndderiv_traz/D");
-      tree->Branch("secndderiv_trat", &secndderiv_trat, "secndderiv_trat/D");
-      tree->Branch("secndderiv_rots", &secndderiv_rots, "secndderiv_rots/D");
-      tree->Branch("secndderiv_rotz", &secndderiv_rotz, "secndderiv_rotz/D");
-      tree->Branch("secndderiv_rott", &secndderiv_rott, "secndderiv_rott/D");
-    }
-        
-    const Trk::AlignModuleList* modList=
-      m_alignModuleTool->getAlignModuleCollection();
-    
-    ALineMapContainer* newALines=new ALineMapContainer();
-
-    int ialine(0);
-    ATH_MSG_DEBUG("have "<<m_alines->size()<<" ALines");
-
-    for (ciALineMap cialine = m_alines->begin(); 
-	 cialine != m_alines->end(); ++cialine,ialine++) {
-
-      
-      if (m_alignModuleTool->alignModuleListType()==Trk::L1 &&
-	  ialine>(int)modList->size()-1) {
-	ATH_MSG_WARNING("more a-lines in input file than modules created in MuonGeometryManagerTool!");
-	continue;
-      }
-      
-
-      Identifier ALineId = (*cialine).first;
-      ALinePar* ALine    = (*cialine).second;
-
-      std::string name; int jff,jzz,obj;
-      ALine->getAmdbId(name,jff,jzz,obj);
-
-      ATH_MSG_DEBUG("ialine: "<<ialine<<", "<<name<<" "<<jff<<" "<<jzz);
-
-      DataVector<Trk::AlignPar>* alignParVec=m_ALineContainerToAlignPar[ialine];
-
-      if (!alignParVec) {
-	float tras,traz,trat,rots,rotz,rott;
-	ALine->getParameters(tras,traz,trat,rots,rotz,rott);
-	
-	ALinePar* newALine=new ALinePar();
-	newALine->setAmdbId(name,jff,jzz,obj);
-
-	if (m_alignModuleTool->alignModuleListType()==Trk::L1) {
-
-	  double* initParsGF=new double[6];
-	  initParsGF[0]=tras; initParsGF[3]=rots;
-	  initParsGF[1]=traz; initParsGF[4]=rotz;
-	  initParsGF[2]=trat; initParsGF[5]=rott;
-
-	  double* initPars=new double[6];
-	  globalToL1AlignFrame(m_ALineContainerToMod[ialine],initParsGF,initPars);
-
-	  tras = initPars[0];
-	  traz = initPars[1];
-	  trat = initPars[2];
-	  rots = initPars[0];
-	  rotz = initPars[1];
-	  rott = initPars[2];
-
-	  delete [] initPars;
-	  delete [] initParsGF;
-	}
-
-	newALine->setParameters(tras,traz,trat,
-				rots,rotz,rott);
-	ATH_MSG_DEBUG("created newALines with following params: ["<<
-		      tras<<","<<traz<<","<<trat<<","<<
-		      rots<<","<<rotz<<","<<rott<<"]");
-	newALines->insert(std::make_pair(ALineId,newALine));
-	continue;	
-      }
-      
-      ATH_MSG_DEBUG("have alignParVec");
-      
-      chamberId=0;
-      nTracks=0;
-      nDoF=0;
-      trackChi2=0.;
-
-      //bool useAlignModuleTransform=false;
-      bool useAlignModule=true;
-      const MuonGM::MuonReadoutElement* muonRE(0);
-      if (m_alignModuleTool->alignModuleListType()==Trk::L3) {
-	
-	Trk::AlignModule::DetectorType detType=Trk::AlignModule::NDetectorTypes;
-	if (p_muonMgr->mdtIdHelper()->is_mdt(ALineId)) {
-	  detType=Trk::AlignModule::MDT;
-	  muonRE=p_muonMgr->getMdtReadoutElement(ALineId);
-	}
-	else if (p_muonMgr->mdtIdHelper()->is_mdt(ALineId)) {
-	  detType=Trk::AlignModule::CSC;
-	  muonRE=p_muonMgr->getCscReadoutElement(ALineId);	  
-	}
-	if (!muonRE) continue;
-	
-	// get AlignPar from AlignModuleTool (from current alignment job)
-	m_alignModuleTool->fillDetAlignmentParameters(muonRE,alignParVec,detType);
-	
-	// get chamberId
-	chamberId = 0;
-	if (muonRE) chamberId = m_idTool->idToFixedId(muonRE->identifyATLAS()).getIdInt();
-	if (useAlignModule) {
-	  ATH_MSG_DEBUG("using chamberId for alignmodule");
-	  const Trk::AlignModule* module=
-	    m_alignModuleTool->findAlignModule(muonRE,detType);
-	  ATH_MSG_DEBUG("module: "<<module);
-	  if (!module) continue;	
-	  chamberId = (long long int)module->identify().get_compact();
-	  nTracks  = module->nTracks();
-	  nDoF     = module->nDoF();
-	  trackChi2= module->trackChi2();
-	}
-      }
-      else {
-	//useAlignModuleTransform=false;
-	//useAlignModule=true;
-	ATH_MSG_DEBUG("m_ALineContainerToModId["<<ialine<<"]:");
-	        
-        const Trk::AlignModule* module=0;
-        if(ialine<(int)m_ALineContainerToMod.size()){
-         module=m_ALineContainerToMod[ialine];
-        }
-        if(module){
-          ATH_MSG_DEBUG("module name: "<<module->name());
-          chamberId = m_idTool->idToFixedId(module->identify()).getIdInt();
-          //chamberId = module->identify().get_compact();
-          nTracks   = module->nTracks();
-          nDoF      = module->nDoF();
-          trackChi2 = module->trackChi2();
-	}
-
-        ATH_MSG_DEBUG("chamberId: "<<chamberId);
-      }
-
-      // get alignment parameters
-      init_tras=delta_tras=err_tras=firstderiv_tras=secndderiv_tras=0.;
-      init_traz=delta_traz=err_traz=firstderiv_traz=secndderiv_traz=0.;
-      init_trat=delta_trat=err_trat=firstderiv_trat=secndderiv_trat=0.;
-      init_rots=delta_rots=err_rots=firstderiv_rots=secndderiv_rots=0.;
-      init_rotz=delta_rotz=err_rotz=firstderiv_rotz=secndderiv_rotz=0.;
-      init_rott=delta_rott=err_rott=firstderiv_rott=secndderiv_rott=0.;
-      
-      if (alignParVec->size()>0) {
-	if ((*alignParVec)[0]) {
-	  init_tras      = (*alignParVec)[0]->initPar();
-	  delta_tras     = (*alignParVec)[0]->par();
-	  err_tras       = (*alignParVec)[0]->err();
-	  firstderiv_tras= (*alignParVec)[0]->firstDeriv();
-	  secndderiv_tras= (*alignParVec)[0]->secndDeriv();
-	}
-	if ((*alignParVec)[1]) {	
-	  init_traz      = (*alignParVec)[1]->initPar();
-	  delta_traz     = (*alignParVec)[1]->par();
-	  err_traz       = (*alignParVec)[1]->err();
-	  firstderiv_traz= (*alignParVec)[1]->firstDeriv();
-	  secndderiv_traz= (*alignParVec)[1]->secndDeriv();
-	}
-	if ((*alignParVec)[2]) {
-	  init_trat      = (*alignParVec)[2]->initPar();
-	  delta_trat     = (*alignParVec)[2]->par();
-	  err_trat       = (*alignParVec)[2]->err();
-	  firstderiv_trat= (*alignParVec)[2]->firstDeriv();
-	  secndderiv_trat= (*alignParVec)[2]->secndDeriv();
-	}
-	if ((*alignParVec)[3]) {
-	  init_rots      = (*alignParVec)[3]->initPar();
-	  delta_rots     = (*alignParVec)[3]->par();
-	  err_rots       = (*alignParVec)[3]->err();
-	  firstderiv_rots= (*alignParVec)[3]->firstDeriv();
-	  secndderiv_rots= (*alignParVec)[3]->secndDeriv();
-	}
-	if ((*alignParVec)[4]) {
-	  init_rotz      = (*alignParVec)[4]->initPar();
-	  delta_rotz     = (*alignParVec)[4]->par();
-	  err_rotz       = (*alignParVec)[4]->err();
-	  firstderiv_rotz= (*alignParVec)[4]->firstDeriv();
-	  secndderiv_rotz= (*alignParVec)[4]->secndDeriv();
-	}
-	if ((*alignParVec)[5]) {
-	  init_rott      = (*alignParVec)[5]->initPar();
-	  delta_rott     = (*alignParVec)[5]->par();
-	  err_rott       = (*alignParVec)[5]->err();
-	  firstderiv_rott= (*alignParVec)[5]->firstDeriv();
-	  secndderiv_rott= (*alignParVec)[5]->secndDeriv();
-	}
-      }
-
-      bool haveAlignPar=false;
-      if (std::fabs(delta_tras-0.)>.001 ||
-	  std::fabs(delta_traz-0.)>.001 ||
-	  std::fabs(delta_trat-0.)>.001 ||
-	  std::fabs(delta_rots-0.)>.001 ||
-	  std::fabs(delta_rotz-0.)>.001 ||
-	  std::fabs(delta_rott-0.)>.001 ) {
-	haveAlignPar=true;
-	ATH_MSG_DEBUG("init_tras="<<init_tras);
-	ATH_MSG_DEBUG("init_traz="<<init_traz);
-	ATH_MSG_DEBUG("init_trat="<<init_trat);
-	ATH_MSG_DEBUG("init_rots="<<init_rots);
-	ATH_MSG_DEBUG("init_rotz="<<init_rotz);
-	ATH_MSG_DEBUG("init_rott="<<init_rott);
-	ATH_MSG_DEBUG("delta_tras="<<delta_tras);
-	ATH_MSG_DEBUG("delta_traz="<<delta_traz);
-	ATH_MSG_DEBUG("delta_trat="<<delta_trat);
-	ATH_MSG_DEBUG("delta_rots="<<delta_rots);
-	ATH_MSG_DEBUG("delta_rotz="<<delta_rotz);
-	ATH_MSG_DEBUG("delta_rott="<<delta_rott);
-	ATH_MSG_DEBUG("firstderiv_tras="<<firstderiv_tras);
-	ATH_MSG_DEBUG("firstderiv_traz="<<firstderiv_traz);
-	ATH_MSG_DEBUG("firstderiv_trat="<<firstderiv_trat);
-	ATH_MSG_DEBUG("firstderiv_rots="<<firstderiv_rots);
-	ATH_MSG_DEBUG("firstderiv_rotz="<<firstderiv_rotz);
-	ATH_MSG_DEBUG("firstderiv_rott="<<firstderiv_rott);
-      }
-
-      // add to newALines
-      //std::string name; int jff,jzz,obj;
-      //ALine->getAmdbId(name,jff,jzz,obj);
-      //float tras,traz,trat,rots,rotz,rott;
-      //ALine->getParameters(tras,traz,trat,rots,rotz,rott);
-
-      ALinePar* newALine=new ALinePar();
-      newALine->setAmdbId(name,jff,jzz,obj);
-      
-      HepGeom::Transform3D initParXform(HepGeom::TranslateX3D(init_tras)*
-				  HepGeom::TranslateY3D(init_traz)*
-				  HepGeom::TranslateZ3D(init_trat)*
-				  HepGeom::RotateX3D(init_rots)*
-				  HepGeom::RotateY3D(init_rotz)*
-				  HepGeom::RotateZ3D(init_rott));
-      
-      HepGeom::Transform3D deltaParXform(HepGeom::TranslateX3D(delta_tras)*
-				   HepGeom::TranslateY3D(delta_traz)*
-				   HepGeom::TranslateZ3D(delta_trat)*
-				   HepGeom::RotateX3D(delta_rots)*
-				   HepGeom::RotateY3D(delta_rotz)*
-				   HepGeom::RotateZ3D(delta_rott));
-      
-      HepGeom::Transform3D finalXform=deltaParXform*initParXform;
-      double* finalPars=new double[6];
-      decomposeTransform(finalXform,finalPars);
-      newALine->setParameters(finalPars[0],finalPars[1],finalPars[2],
-			      finalPars[3],finalPars[4],finalPars[5]);
-      delete [] finalPars;
-
-      if (haveAlignPar) {
-	ATH_MSG_DEBUG(name<<" "<<jff<<" "<<jzz<<" "<<obj);
-	ATH_MSG_DEBUG(std::setw(10)<<std::setprecision(5)<<
-		      finalPars[0]<<" "<<finalPars[1]<<" "<<finalPars[2]);
-	ATH_MSG_DEBUG(finalPars[3]<<" "<<finalPars[4]<<" "<<finalPars[5]);
-      }
-      newALines->insert(std::make_pair(ALineId,newALine));
-      
-      // fill tree for this chamber
-      if (m_ntuple) tree->Fill();
-    }
-    
-    if (m_ntuple) {
-      tree->Write();
-      delete tree;
-    }
-
-    writeALinesToAsciiFile(newALines, m_asztOutputFile);
-    ATH_MSG_DEBUG("wrote ASZT values to "<<m_asztOutputFile);
-    
-    delete newALines;
-    return;
-    */
-  }
-
-  //________________________________________________________________________  
-  MuonGM::DblQ00Aszt* MuonAlignDBTool::initSigmasFromAsciiFile() const
-  {
-    //using namespace CLHEP;
-    
-    if (m_sigmaInputFile=="") return 0;    
-    
-    std::map<std::string, std::string> asciiFileDBMap;
-    asciiFileDBMap.insert(std::make_pair("ASZT",m_sigmaInputFile));
-    
-    ATH_MSG_INFO("getting sigmas from ascii file");     
-    DblQ00Aszt* sigmas = new DblQ00Aszt(asciiFileDBMap.find("ASZT")->second);
-    if (sigmas->size()==0){ 
-      ATH_MSG_FATAL("Couldn't read sigmas from ascii file!");
-        delete sigmas;
-        return 0;
-    }
-    else ATH_MSG_INFO("N. of lines read = "<<sigmas->size());  
-      
-    return sigmas;
-  }
-  
-  //________________________________________________________________________
-  DblQ00Aszt* MuonAlignDBTool::initAlinesEqZero() const
-  {
-    ATH_MSG_DEBUG("in initAlinesEqZero");
-
-    std::string filename="initAlines.txt";
-    std::ofstream asztFile;
-    asztFile.open(filename.c_str());
-    const std::vector<Trk::AlignModule*>* alignModColl=
-      m_alignModuleTool->getAlignModuleCollection();
-    for (int j=0;j<(int)alignModColl->size();j++) {
-      asztFile
-	<<"A "
-	<< (*alignModColl)[j]->name()        <<"       " 
-	<< (*alignModColl)[j]->identifyHash() <<" " 
-	<< (*alignModColl)[j]->identify()  <<" " 
-	<< 0   <<" " // job
-	<< 0.  <<" " // tras
-	<< 0.  <<" " // traz?
-	<< 0.  <<" " // trat
-	<< 0.  <<" " // rots
-	<< 0.  <<" " // rotz
-	<< 0.  <<" " // rott
-	<< "\n";
-    }
-    asztFile.close(); 
-    ATH_MSG_DEBUG("did initAlinesEqZero");
-    return new DblQ00Aszt(filename);
-  }
-
-  //________________________________________________________________________
-  const Trk::TrkDetElementBase* MuonAlignDBTool::getDetElement(Identifier id) const
-  {
-    ATH_MSG_DEBUG("in getDetElement(Identifier)");
-
-    if (!m_detElemLookup_identifier) setDetElemLookup();
-    
-    for (int i=0;i<(int)m_detElemLookup_identifier->size();i++) {
-      if (id == (*m_detElemLookup_identifier)[i]) {
-	
-	ATH_MSG_DEBUG("getting MDT");
-	const MuonGM::MdtReadoutElement* mdt=
-	  dynamic_cast<const MuonGM::MdtReadoutElement*>((*m_detElemLookup_detElem)[i]);
-	if (mdt) return mdt;
-	
-	ATH_MSG_DEBUG("no MDT, getting CSC");
-	const MuonGM::CscReadoutElement* csc=
-	  dynamic_cast<const MuonGM::CscReadoutElement*>((*m_detElemLookup_detElem)[i]);
-	if (csc) return csc;
-	
-	ATH_MSG_WARNING("no MDT or CSC!");
-	
-      }
-    }
-    
-    return 0;
-  }
-  
-  //________________________________________________________________________
-  void MuonAlignDBTool::setDetElemLookup() const
-  {
-    ATH_MSG_DEBUG("in setDetElemLookup");
-    
-    const Trk::AlignModuleList* alignModList=
-      m_alignModuleTool->getAlignModuleCollection();
-    
-    ATH_MSG_DEBUG("m_detElemLookup_identifier="<<m_detElemLookup_identifier);
-    if (!m_detElemLookup_identifier) {
-      
-      ATH_MSG_DEBUG("doing detector element lookup arrays");      
-      m_detElemLookup_identifier = new std::vector<Identifier>;
-      m_detElemLookup_alignMod   = new std::vector<const Trk::AlignModule*>;
-      m_detElemLookup_detElem    = new std::vector<const Trk::TrkDetElementBase*>;
-      m_detElemLookup_stEta      = new std::vector<int>;
-      m_detElemLookup_stPhi      = new std::vector<int>;
-      m_detElemLookup_stName     = new std::vector<std::string>;
-      
-      for (int imod=0;imod<(int)alignModList->size();imod++) {
-	ATH_MSG_DEBUG("imod="<<imod<<"/"<<alignModList->size());
-	const Trk::AlignModule* alignMod=(*alignModList)[imod];
-	ATH_MSG_DEBUG("alignmod: "<<alignMod->identify());
-
-	const std::vector<const Trk::TrkDetElementBase*>* detElementColl=
-	  alignMod->detElementCollection(Trk::AlignModule::MDT);
-	if (!detElementColl) 
-	  detElementColl=alignMod->detElementCollection(Trk::AlignModule::CSC);
-
-	if (!detElementColl) { 
-	   ATH_MSG_WARNING("not MDT or CSC!");
-	} else {
-           unsigned int lastDetIdHash=99999999;
-           for (int i=0;i<(int)detElementColl->size();i++) {
-             ATH_MSG_DEBUG("idet="<<i<<"/"<<detElementColl->size());
-             const MuonGM::MuonReadoutElement* muonRE=getMuonRE((*detElementColl)[i]);
-             if (!muonRE) continue;       
-             
-             ATH_MSG_DEBUG("idHash="<<muonRE->identifyHash()<<", last "<<lastDetIdHash);
-             
-             if (lastDetIdHash!=muonRE->identifyHash()) {
-               lastDetIdHash=muonRE->identifyHash();
-               m_detElemLookup_identifier->push_back(muonRE->identify());
-               m_detElemLookup_alignMod->push_back(alignMod);
-               m_detElemLookup_detElem ->push_back(muonRE);	    
-               m_detElemLookup_stEta   ->push_back(muonRE->getStationEta());
-               m_detElemLookup_stPhi   ->push_back(muonRE->getStationPhi());
-               m_detElemLookup_stName  ->push_back(std::string(muonRE->getStationName(),0,3));
-             }
-           }
-        }
-
-      }
-      
-      ATH_MSG_DEBUG("done");
-      
-      if (!m_detElemLookup_alineIndex && m_alines && m_alines->size()>0) {
-	ATH_MSG_DEBUG("doing alineIndex lookup");
-	m_detElemLookup_alineIndex = new std::vector<int>;
-	
-	for (int imod=0;imod<(int)alignModList->size();imod++) {
-	  const Trk::AlignModule* alignMod=(*alignModList)[imod];
-	  const std::vector<const Trk::TrkDetElementBase*>* detElementColl =  
-	    alignMod->detElementCollection(Trk::AlignModule::MDT);
-	  if (!detElementColl) detElementColl =
-	    alignMod->detElementCollection(Trk::AlignModule::CSC);
-	  if (!detElementColl) {
-	    ATH_MSG_WARNING("no detElementColl for MDT or CSC");
-	  } else {
-	    unsigned int lastDetIdHash=0;
-	    for (int i=0;i<(int)detElementColl->size();i++) {
-	      const MuonGM::MuonReadoutElement* muonRE=getMuonRE((*detElementColl)[i]);
-	    
-	      if (!muonRE) continue;
-	      ATH_MSG_DEBUG("idHash="<<muonRE->identifyHash()<<", last "<<lastDetIdHash);
-	    
-	      if (lastDetIdHash!=muonRE->identifyHash()) {
-		lastDetIdHash=muonRE->identifyHash();
-	      
-		// now loop through ALines and get corresponding entry
-		int ialine(0);
-		ATH_MSG_DEBUG("have "<< m_alines->size()<<" ALines");
-		for (ciALineMap cialine = m_alines->begin();
-		     cialine != m_alines->end(); ++cialine,ialine++) {
-		  Identifier ALineId = (*cialine).first;
-		  if (ALineId == muonRE->identify()) {
-		    m_detElemLookup_alineIndex->push_back(ialine);
-		    ATH_MSG_DEBUG("have ALine");
-		    break;
-		  }
-		}
-	      }
-	    }
-	  }
-	}
-      }
-      
-      ATH_MSG_DEBUG("done with setDetElemLookup");
-      return;    
-    }
-  }
-  
-  //________________________________________________________________________
-  void MuonAlignDBTool::createL3LookupTable()
-  {
-    ATH_MSG_DEBUG("in createL3LookupTable");
-
-    if (m_alines)
-      ATH_MSG_DEBUG("have "<<m_alines->size()<<" A-lines");
-    else {
-      ATH_MSG_WARNING("no A-lines!");
-      return;
-    }
-
-    int ialine(0);
-    for (ciALineMap cialine = m_alines->begin(); 
-	 cialine != m_alines->end(); ++cialine,ialine++) {
-      ATH_MSG_DEBUG("ialine "<<ialine);
-      
-      Identifier ALineId = (*cialine).first;
-      std::stringstream chname;
-      ATH_MSG_DEBUG("ALineId: "<<ALineId);
-      if (p_muonMgr->mdtIdHelper()->is_muon(ALineId)) {
-	std::string stnamestr=p_muonMgr->mdtIdHelper()->stationNameString(p_muonMgr->mdtIdHelper()->stationName(ALineId));
-	chname<<stnamestr;
-	if (p_muonMgr->mdtIdHelper()->is_mdt(ALineId)) {
-	  int stEta=p_muonMgr->mdtIdHelper()->stationEta(ALineId);
-	  chname<<std::abs(stEta);
-	  if (stEta<0) chname<<"C"; else chname<<"A";
-	  int stPhi=p_muonMgr->mdtIdHelper()->stationPhi(ALineId);
-	  int detphi=2*stPhi;
-	  if (stnamestr.substr(2,1)=="L") detphi--;
-	  else if (stnamestr.substr(2,1)!="S"&&stnamestr.substr(0,3)!="BEE") detphi=stPhi;
-	  chname<<std::setfill('0')<<std::setw(2)<<detphi;
-	  ATH_MSG_DEBUG("ALineId: "<<ALineId<<" is MDT "<<chname.str());
-	}
-	else if (p_muonMgr->cscIdHelper()->is_csc(ALineId)) {
-	  ATH_MSG_DEBUG("ALineId: "<<ALineId<<" is CSC");
-	}
-	else if (p_muonMgr->tgcIdHelper()->is_tgc(ALineId)) {
-	  ATH_MSG_DEBUG("ALineId: "<<ALineId<<" is TGC");
-	}
-	else if (p_muonMgr->rpcIdHelper()->is_rpc(ALineId)) {
-	  ATH_MSG_DEBUG("ALineId: "<<ALineId<<" is RPC");
-	}
-      }
-      else
-	ATH_MSG_WARNING("ALineId "<<ALineId<<" not muon chamber!");
-
-      // get MuonReadoutElement for this ALine
-      const Trk::TrkDetElementBase* detElement=getDetElement(ALineId);
-      if (!detElement) {
-	ATH_MSG_DEBUG("no detElement, pushing back 0");
-	m_ALineContainerToAlignPar.push_back(0);
-	continue;
-      }
-            
-      ALinePar* ALine = (*cialine).second;
-      float s,z,t,rots,rotz,rott;
-      ALine->getParameters(s,z,t,rots,rotz,rott);
-      
-      const int NPAR=6;
-      float* initPars=new float[NPAR];
-      initPars[0]=s;
-      initPars[1]=z;
-      initPars[2]=t;
-      initPars[3]=rots;
-      initPars[4]=rotz;
-      initPars[5]=rott;
-      
-      float* initErrs=new float[NPAR];
-      for (int i=0;i<NPAR;i++) {
-	initErrs[i]=0.; 
-	ATH_MSG_DEBUG("initPars["<<i<<"]="<<initPars[i]);
-      }
-      
-      // get AlignModule for this detElement
-      Trk::AlignModule::DetectorType detType=Trk::AlignModule::NDetectorTypes;
-      if (dynamic_cast<const MdtReadoutElement*>(detElement))
-	detType=Trk::AlignModule::MDT;
-      else if (dynamic_cast<const CscReadoutElement*>(detElement))
-	detType=Trk::AlignModule::CSC;
-      else {
-	ATH_MSG_WARNING("not MDT or CSC");
-      }
-     
-      const Trk::AlignModule* alignModule=
-	m_alignModuleTool->findAlignModule(detElement,detType);
-      if (!alignModule) {
-         ATH_MSG_WARNING("no AlignModule! (detType "<<detType<<", ID: "<<detElement->identify());
-      } else {
-         // get AlignPars for this AlignModule
-         DataVector<Trk::AlignPar>* apVec=m_alignModuleTool->getFullAlignPars(alignModule);	
-         if (apVec) {
-           for (int i=0;i<(int)apVec->size();i++) {
-             int param=(*apVec)[i]->paramType();
-             (*apVec)[i]->setInitPar(initPars[param],initErrs[param]);
-             ATH_MSG_DEBUG("setting initPar "<<initPars[param]<<" to "<<*(*apVec)[i]);
-           }
-           ATH_MSG_DEBUG("pushing back apVec");
-           m_ALineContainerToAlignPar.push_back(apVec);
-         }
-         else {
-           ATH_MSG_DEBUG("pushing back 0");
-           m_ALineContainerToAlignPar.push_back(0);
-         }
-      }
-      
-      delete [] initPars;      
-      delete [] initErrs;      
-    }
-  }
-
-  //________________________________________________________________________
-  void MuonAlignDBTool::createL1LookupTable()
-  {
-    ATH_MSG_DEBUG("in createL1LookupTable");
-
-    // if no alines from MultiLevelAlignmentDbTool, create empty alines
-    if (!m_alines || m_alines->size()<1) {
-
-      ATH_MSG_DEBUG("creating A-lines for L1 with zeros");
-
-      ALineMapContainer* alines=new ALineMapContainer();
-      const std::vector<Trk::AlignModule*>* alignModColl=
-	m_alignModuleTool->getAlignModuleCollection();
-      ATH_MSG_DEBUG("alignModColl size(): "<<alignModColl->size());
-      for (int j=0;j<(int)alignModColl->size();j++) {
-	ATH_MSG_DEBUG("j="<<j);
-	ATH_MSG_DEBUG("name: "<<(*alignModColl)[j]->name());
-	ATH_MSG_DEBUG("idHash: "<<(*alignModColl)[j]->identifyHash());
-	ATH_MSG_DEBUG("identify: "<<(*alignModColl)[j]->identify());
-	ALinePar* newALine = new ALinePar();
-	newALine->setAmdbId((*alignModColl)[j]->name(),
-			    (*alignModColl)[j]->identifyHash(),
-			    (*alignModColl)[j]->identify().get_identifier32().get_compact(),0);
-	newALine->setParameters(0.,0.,0.,0.,0.,0.);
-	newALine->isNew(true);
-	Identifier id((*alignModColl)[j]->identify());	
-	alines->insert(std::make_pair(id,(ALinePar*)newALine));
-      }
-      m_alines=alines;
-    }
-
-    const Trk::AlignModuleList* modList=
-      m_alignModuleTool->getAlignModuleCollection();
-
-    int ialine(0);
-    for (ciALineMap cialine = m_alines->begin(); 
-	 cialine != m_alines->end(); ++cialine,ialine++) {
-      ATH_MSG_DEBUG("ialine "<<ialine);
-
-      if (ialine>(int)modList->size()-1) {
-	ATH_MSG_WARNING("more a-lines in input file than modules created in MuonGeometryManagerTool!");
-	continue;
-      }
-
-      // get AlignModule from AlignModuleList
-      const Trk::AlignModule* mod = (*modList)[ialine];
-      ATH_MSG_DEBUG("mod id: "<<mod->identify());
-
-      // get initial alignment parameters
-      //Identifier ALineId = (*cialine).first;
-      ALinePar* ALine = (*cialine).second;
-
-      float tras,traz,trat,rots,rotz,rott;
-      ALine->getParameters(tras,traz,trat,rots,rotz,rott);
-			   
-      
-      ATH_MSG_INFO(std::setw(9)<<std::setprecision(5)<<"global frame tra s/z/t="<<
-		   tras<<" "<<traz<<" "<<trat);
-      ATH_MSG_INFO(std::setprecision(5)<<"global frame rot s/z/t="<<
-		   rots<<" "<<rotz<<" "<<rott);
-
-      const int NPAR=6;
-      double* initParsGF=new double[NPAR];
-      initParsGF[0]=tras; initParsGF[3]=rots;
-      initParsGF[1]=traz; initParsGF[4]=rotz;
-      initParsGF[2]=trat; initParsGF[5]=rott;
-
-      double* initPars=new double[NPAR];
-      globalToL1AlignFrame(mod,initParsGF,initPars);
-      delete [] initParsGF;
-
-      ATH_MSG_INFO(std::setw(10)<<std::setprecision(5)<<"align frame tra s/z/t="<<
-		   initPars[0]<<" "<<
-		   initPars[1]<<" "<<
-		   initPars[2]);
-      ATH_MSG_INFO(std::setw(10)<<std::setprecision(5)<<"align frame rot s/z/t="<<
-		   initPars[3]<<" "<<
-		   initPars[4]<<" "<<
-		   initPars[5]);
-
-      float* initErrs=new float[NPAR];
-      for (int i=0;i<NPAR;i++) {
-	initErrs[i]=0.;
-	ATH_MSG_DEBUG("initPar["<<i<<"]="<<initPars[i]);
-      }      
-
-      // retrieve align pars from AlignModuleTool
-      DataVector<Trk::AlignPar>* alignPars=
-	m_alignModuleTool->getFullAlignPars((*modList)[ialine]);
-      if (alignPars) {
-	for (int i=0;i<(int)alignPars->size();i++) {
-	  int param=(*alignPars)[i]->paramType();
-	  (*alignPars)[i]->setInitPar(initPars[param],initErrs[param]);
-	  ATH_MSG_DEBUG("set initPar["<<param<<"]="<<initPars[param]);
-	}
-	m_ALineContainerToAlignPar.push_back(alignPars);
-      }
-      else  {
-	ATH_MSG_DEBUG("no alignPars, pushing back 0");
-	m_ALineContainerToAlignPar.push_back(0);	
-      }
-      
-      //m_ALineContainerToModId.push_back((long long int)(*modList)[ialine]->identify().get_compact());
-      m_ALineContainerToMod.push_back((*modList)[ialine]);
-      
-      delete [] initPars;      
-      delete [] initErrs;
-    }
-    return;
-  }
-
- //________________________________________________________________________
-  void MuonAlignDBTool::createL23LookupTable()
-  {
-    ATH_MSG_DEBUG("in createL23LookupTable");
-
-    if (m_alines)
-      ATH_MSG_DEBUG("have "<<m_alines->size()<<" A-lines");
-
-    // if no alines from MultiLevelAlignmentDbTool, create empty alines
-    if (!m_alines || m_alines->size()<1) {
-
-      ATH_MSG_DEBUG("creating A-lines for L23 with zeros");
-
-      ALineMapContainer* alines=new ALineMapContainer();
-      const std::vector<Trk::AlignModule*>* alignModColl=
-	m_alignModuleTool->getAlignModuleCollection();
-      ATH_MSG_DEBUG("alignModColl size(): "<<alignModColl->size());
-      for (int j=0;j<(int)alignModColl->size();j++) {
-	ATH_MSG_DEBUG("j="<<j);
-	ATH_MSG_DEBUG("name: "<<(*alignModColl)[j]->name());
-	ATH_MSG_DEBUG("idHash: "<<(*alignModColl)[j]->identifyHash());
-	ATH_MSG_DEBUG("identify: "<<(*alignModColl)[j]->identify());
-	ALinePar* newALine = new ALinePar();
-	newALine->setAmdbId((*alignModColl)[j]->name(),
-			    (*alignModColl)[j]->identifyHash(),
-			    (*alignModColl)[j]->identify().get_identifier32().get_compact(),0);
-	newALine->setParameters(0.,0.,0.,0.,0.,0.);
-	newALine->isNew(true);
-	Identifier id((*alignModColl)[j]->identify());	
-	alines->insert(std::make_pair(id,(ALinePar*)newALine));
-      }
-      m_alines=alines;
-    }
-
-
-    int ialine(0);
-    for (ciALineMap cialine = m_alines->begin(); 
-	 cialine != m_alines->end(); ++cialine,ialine++) {
-      ATH_MSG_DEBUG("ialine "<<ialine);
-      
-      Identifier ALineId = (*cialine).first;
-
-      // get TrkDetElementBase for this ALine
-      const Trk::TrkDetElementBase* detElement=getDetElement(ALineId);
-      if (!detElement) {
-	ATH_MSG_DEBUG("no detElement, pushing back 0");
-	m_ALineContainerToAlignPar.push_back(0);
-        m_ALineContainerToMod.push_back(0);
-	continue;
-      }
-      
-      ALinePar* ALine = (*cialine).second;      
-      float s,z,t,rots,rotz,rott;
-      ALine->getParameters(s,z,t,rots,rotz,rott);
-      
-      const int NPAR=6;
-      float* initPars=new float[NPAR];
-      initPars[0]=s;
-      initPars[1]=z;
-      initPars[2]=t;
-      initPars[3]=rots;
-      initPars[4]=rotz;
-      initPars[5]=rott;
-      
-      float* initErrs=new float[NPAR];
-      for (int i=0;i<NPAR;i++) {
-	initErrs[i]=0.; 
-	ATH_MSG_DEBUG("initPars["<<i<<"]="<<initPars[i]);
-      }
-      
-      // get AlignModule for this MDT
-      const Trk::AlignModule* alignModule=
-	m_alignModuleTool->findAlignModule(detElement,Trk::AlignModule::MDT);
-      if (!alignModule){ 
-
-        ATH_MSG_WARNING("no AlignModule for MDT");
-        m_ALineContainerToMod.push_back(alignModule);
-
-      } else {
-
-         m_ALineContainerToMod.push_back(alignModule);
-    
-         DataVector<Trk::AlignPar>* apVec2=m_alignModuleTool->getAlignPars(alignModule);	
-         ATH_MSG_DEBUG("name: " <<  alignModule->name());
-         ATH_MSG_DEBUG("active pars: " << apVec2->size());
-
-         // get AlignPars for this AlignModule
-         DataVector<Trk::AlignPar>* apVec=m_alignModuleTool->getFullAlignPars(alignModule);	
-         if (apVec) {
-           for (int i=0;i<(int)apVec->size();i++) {
-             int param=(*apVec)[i]->paramType();
-             (*apVec)[i]->setInitPar(initPars[param],initErrs[param]);
-             ATH_MSG_DEBUG("setting initPar "<<initPars[param]<<" to "<<*(*apVec)[i]);
-           }
-           ATH_MSG_DEBUG("pushing back apVec");
-           m_ALineContainerToAlignPar.push_back(apVec);
-         }
-         else {
-           ATH_MSG_DEBUG("pushing back 0");
-           m_ALineContainerToAlignPar.push_back(0);
-         }
-      }
-      
-      delete [] initPars;      
-      delete [] initErrs;
-
-    }
-
-    return;
-  }
-
-
-
-  //________________________________________________________________________
-  void MuonAlignDBTool::writeALinesToAsciiFile(const ALineMapContainer* alines, 
-					      const std::string& outputfile) const
-  {
-
-    std::ofstream alineFile;
-    alineFile.open(outputfile.c_str());
-
-    const Trk::AlignModuleList* modList=
-      m_alignModuleTool->getAlignModuleCollection();
-    
-    int ialine(0);
-    for (ciALineMap cialine = alines->begin(); 
-	 cialine != alines->end(); ++cialine,ialine++) {
-      //Identifier ALineId = (*cialine).first;
-      ALinePar* ALine = (*cialine).second;
-      std::string name; int jff(0),jzz(0),obj(0);
-      float tras(0.),traz(0.),trat(0.),rots(0.),rotz(0.),rott(0.);
-      ALine->getAmdbId(name,jff,jzz,obj);
-      ALine->getParameters(tras,traz,trat,rots,rotz,rott);
-      
-      ATH_MSG_DEBUG(name<<" "<<jff<<" "<<jzz<<" "<<obj);
-      ATH_MSG_INFO(std::setw(10)<<std::setprecision(5)<<
-		   "align frame tra s/z/t="<<tras<<" "<<traz<<" "<<trat);
-      ATH_MSG_INFO(std::setw(10)<<std::setprecision(5)<<
-		   "align frame rot s/z/t="<<rots<<" "<<rotz<<" "<<rott);
-
-      // convert from align frame to global frame
-
-      if (m_alignModuleTool->alignModuleListType()==Trk::L1) {
-
-	const Trk::AlignModule* mod = (*modList)[ialine];
-	double* initPars=new double[6];
-	initPars[0]=tras; initPars[3]=rots;
-	initPars[1]=traz; initPars[4]=rotz;
-	initPars[2]=trat; initPars[5]=rott;
-		
-	double* finalParsGF=new double[6];
-	level1AlignToGlobalFrame(mod,initPars,finalParsGF);
-
-	tras=finalParsGF[0]; rots=finalParsGF[3];
-	traz=finalParsGF[1]; rotz=finalParsGF[4];
-	trat=finalParsGF[2]; rott=finalParsGF[5];
-
-	delete [] finalParsGF;
-	delete [] initPars;
-
-	ATH_MSG_INFO(std::setw(9)<<std::setprecision(5)<<
-		     "global frame tra s/z/t="<<tras<<" "<<traz<<" "<<trat);
-	ATH_MSG_INFO(std::setprecision(5)<<
-		     "global frame rot s/z/t="<<rots<<" "<<rotz<<" "<<rott);
-	
-      }
-
-      alineFile
-	<< "A "
-	<< name <<" "
-	<< jff  <<" "
-	<< jzz  <<" "
-	<< obj  <<" "
-	<< tras <<" "
-	<< traz <<" "
-	<< trat <<" "
-	<< rots <<" "
-	<< rotz <<" "
-	<< rott <<"\n";      
-    }
-    alineFile.close();
-    return;
-  }
-
-  //________________________________________________________________________
-  ALineMapContainer* MuonAlignDBTool::asciiToALines(const std::string& inputfile) 
-  {
-    // this method is used for L3 only!
-
-    ATH_MSG_DEBUG("in asciiToALines, inputfile "<<inputfile);
-
-    ALineMapContainer* alines=new ALineMapContainer();
-    std::ifstream alineFile(inputfile.c_str());
-    if (!alineFile.is_open())
-      ATH_MSG_ERROR("bad ascii file: "<<inputfile);
-
-    char ALineMarker;
-    std::string name; int jff(0),jzz(0),obj(0);
-    float tras(0.),traz(0.),trat(0.),rots(0.),rotz(0.),rott(0.);
-
-    while (alineFile
-	   >> ALineMarker
-	   >> name
-	   >> jff
-	   >> jzz
-	   >> obj
-	   >> tras
-	   >> traz
-	   >> trat
-	   >> rots
-	   >> rotz
-	   >> rott
-	   ) {
-
-      ATH_MSG_DEBUG(name<<" "<<jff<<" "<<jzz<<" "<<obj<<" "
-		    <<tras<<" "<<traz<<" "<<trat<<" "
-		    <<rots<<" "<<rotz<<" "<<rott);
-      
-      bool isValid;
-      Identifier id=p_muonMgr->mdtIdHelper()->elementID(name,jzz,jff,
-							true,&isValid);
-      if (!isValid) continue; 
-      
-      const MuonGM::MuonReadoutElement* muonRE(0);
-      if (p_muonMgr->mdtIdHelper()->is_mdt(id))
-	muonRE=p_muonMgr->getMdtReadoutElement(id);
-      else if (p_muonMgr->cscIdHelper()->is_csc(id))
-	muonRE=p_muonMgr->getCscReadoutElement(id);	
-      if (!muonRE) continue;
-      
-      ATH_MSG_DEBUG("stPhi/stEta="<<muonRE->getStationPhi()<<"/"<<muonRE->getStationEta());
-      
-      ATH_MSG_DEBUG("found mdt");
-      ALinePar* newALine = new ALinePar();
-      newALine->setAmdbId(name,jff,jzz,obj);
-      newALine->setParameters(tras,traz,trat,rots,rotz,rott);
-      alines->insert(std::make_pair(muonRE->identify(),newALine));
-    }
-    
-    alineFile.close();
-    
-    return alines;    
-  }
-  
-  //________________________________________________________________________
-  void MuonAlignDBTool::globalToL1AlignFrame(const Trk::AlignModule* /*mod*/,
-					     double* /*globalPars*/, double* /*alignPars*/) const
-  {
-
-    ATH_MSG_ERROR("migrate  MuonAlignDBTool::globalToL1AlignFrame to Eigen");
-    return;
-    /*
-    HepGeom::Transform3D parsGlobalFrame(HepGeom::TranslateX3D(globalPars[0])*
-					 HepGeom::TranslateY3D(globalPars[1])*
-					 HepGeom::TranslateZ3D(globalPars[2])*
-					 HepGeom::RotateX3D   (globalPars[3])*
-					 HepGeom::RotateY3D   (globalPars[4])*
-					 HepGeom::RotateZ3D   (globalPars[5]));
-    
-    HepGeom::Transform3D initParsAlignFrame = mod->globalFrameToAlignFrame()*parsGlobalFrame*
-      mod->globalFrameToAlignFrame().inverse(); 
-    decomposeTransform(initParsAlignFrame,alignPars);
-    */
-    return;
-  }
-
-  //________________________________________________________________________
-  void MuonAlignDBTool::level1AlignToGlobalFrame(const Trk::AlignModule* /*mod*/,
-						 double* /*alignPars*/, double* /*alignParsGF*/) const
-  {
-
-    ATH_MSG_ERROR("migrate  MuonAlignDBTool::level1AligntoGlobalFrame to Eigen");
-    return;
-
-    /*
-    ATH_MSG_DEBUG("in level1AlignToGlobalFrame:");
-    ATH_MSG_DEBUG("alignPars tra: "<<alignPars[0]<<" "<<alignPars[1]<<" "<<alignPars[2]);
-    ATH_MSG_DEBUG("alignPars rot: "<<alignPars[3]<<" "<<alignPars[4]<<" "<<alignPars[5]);
-
-    HepGeom::Transform3D parsAlignFrame(HepGeom::TranslateX3D(alignPars[0])*
-				  HepGeom::TranslateY3D(alignPars[1])*
-				  HepGeom::TranslateZ3D(alignPars[2])*
-				  HepGeom::RotateX3D   (alignPars[3])*
-				  HepGeom::RotateY3D   (alignPars[4])*
-				  HepGeom::RotateZ3D   (alignPars[5]));
-    
-    HepGeom::Transform3D parsGlobalFrame = mod->globalFrameToAlignFrame().inverse()*parsAlignFrame*
-      mod->globalFrameToAlignFrame(); 
-    decomposeTransform(parsGlobalFrame,alignParsGF);
-
-    ATH_MSG_DEBUG("alignParsGF tra: "<<alignParsGF[0]<<" "<<alignParsGF[1]<<" "<<alignParsGF[2]);
-    ATH_MSG_DEBUG("alignParsGF rot: "<<alignParsGF[3]<<" "<<alignParsGF[4]<<" "<<alignParsGF[5]);
-    */
-
-    return;
-  }
-
-  //________________________________________________________________________
-  const MuonGM::MuonReadoutElement* MuonAlignDBTool::getMuonRE(const Trk::TrkDetElementBase* detElement) const 
-  {
-    const MuonGM::MuonReadoutElement* muonRE=
-      dynamic_cast<const MuonGM::MdtReadoutElement*>(detElement);	
-    if (!muonRE)
-      muonRE=dynamic_cast<const MuonGM::CscReadoutElement*>(detElement);
-    if (!muonRE)
-      ATH_MSG_WARNING("muonRE not MDT or CSC!");
-    return muonRE;
-  }
-  
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignHelperTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignHelperTool.cxx
deleted file mode 100644
index 0455e628c7d..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignHelperTool.cxx
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-#include "MuonAlignGenTools/MuonAlignHelperTool.h"
-
-#include "MuonIdHelpers/MuonIdHelperTool.h"
-
-namespace Muon {
-  
-  //________________________________________________________________________
-  MuonAlignHelperTool::MuonAlignHelperTool(const std::string& type,
-					   const std::string& name,
-					   const IInterface* parent)
-    : AthAlgTool(type,name,parent)  
-    , m_muonIdHelper("Muon::MuonIdHelperTool/MuonIdHelperTool")    
-  {
-
-    declareInterface<MuonAlignHelperTool>(this);
-
-    declareProperty("MuonIdHelperTool", m_muonIdHelper);
-  }
-  
-  //________________________________________________________________________
-  MuonAlignHelperTool::~MuonAlignHelperTool() 
-  {
-    
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonAlignHelperTool::initialize()
-  {   
-    // set up MuonIdHelperTool
-    if (m_muonIdHelper.retrieve().isSuccess()) 
-      ATH_MSG_INFO("Retrieved  "<<m_muonIdHelper);
-    else {
-      ATH_MSG_FATAL("Could not get MuonIdHelperTool!");
-      return StatusCode::FAILURE;
-    }   
-    
-    return StatusCode::SUCCESS;
-  }
-  
-  //________________________________________________________________________
-  StatusCode MuonAlignHelperTool::finalize()
-  {
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  bool MuonAlignHelperTool::isEndcap(Identifier id) const
-  {
-    if (m_muonIdHelper->isEndcap(id)) return true;        
-    if (m_muonIdHelper->mdtIdHelper().stationNameString(m_muonIdHelper->mdtIdHelper().stationName(id)).substr(0,3)=="BEE") return true;
-    return false;
-  }
-
-  //________________________________________________________________________
-  bool MuonAlignHelperTool::isBIS8(Identifier id) const
-  {
-    if (m_muonIdHelper->mdtIdHelper().stationNameString(m_muonIdHelper->mdtIdHelper().stationName(id)).substr(0,3)=="BIS" && std::abs(m_muonIdHelper->mdtIdHelper().stationEta(id))==8) return true;
-    return false;
-  }
- 
-  /* 
-  //________________________________________________________________________
-  Trk::Track* MuonAlignHelperTool::redoHitsOnTrack(const Trk::Track& track,
-						   bool rescaleErrorsOnly) const {
-    
-    // loop over track and calculate residuals
-    const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces();
-    if( !states ){
-      ATH_MSG_DEBUG("track without states, discarding track");
-      return 0;
-    }
-    
-    // vector to store states, the boolean indicated whether the state was create in this routine (true) or belongs to the track (false)
-    // If any new state is created, all states will be cloned and a new track will beformed from them.
-    std::vector< std::pair<bool,const Trk::TrackStateOnSurface* > > newStates;
-    newStates.reserve(states->size()+5);
-    
-    Identifier currentMdtChId;
-    
-    // loop over TSOSs
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit = states->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end = states->end();
-    for( ; tsit!=tsit_end ; ++tsit ){
-      
-      if( !*tsit ) continue; //sanity check
-      
-      // check whether state is a measurement
-      const Trk::TrackParameters* pars = (*tsit)->trackParameters();
-      if (!pars) {
-	newStates.push_back( std::make_pair(false,*tsit) );
-	continue;
-      }
-
-      // check whether state is a measurement
-      const Trk::MeasurementBase* meas = (*tsit)->measurementOnTrack();
-      if (!meas) {
-	newStates.push_back( std::make_pair(false,*tsit) );
-	continue;
-      }
-
-      Identifier id = m_helperTool->getIdentifier(*meas);
-      
-      // Not a ROT, else it would have had an identifier. Keep the TSOS.
-      if (!id.is_valid() || !m_idHelperTool->isMuon(id)) {
-	newStates.push_back( std::make_pair(false,*tsit) );	
-	continue;
-      }
-      
-      ATH_MSG_VERBOSE(" new measurement " << m_idHelperTool->toString(id));
-      
-      if( m_idHelperTool->isMdt(id) ) {
-	
-	const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(meas);
-	if( !mdt ){
-	  ATH_MSG_WARNING(" Measurement with MDT identifier that is not a MdtDriftCircleOnTrack ");
-	  continue;
-	}
-	bool hasT0=mdt->timingMode()==3;
-	const Trk::RIO_OnTrack* newMdt;
-	if (rescaleErrorsOnly) 
-	  newMdt=(hasT0)?
-	    m_mdtRotCreatorAdjT0->updateError( *mdt, pars ):
-	    m_mdtRotCreator     ->updateError( *mdt, pars );
-	else
-	  newMdt=(hasT0)?
-	    m_mdtRotCreatorAdjT0->correct( *(mdt->prepRawData()), *pars ):
-	    m_mdtRotCreator     ->correct( *(mdt->prepRawData()), *pars );
-	    
-	
-	if( !newMdt ) {
-	  ATH_MSG_WARNING(" Failed to recalibrate MDT ");
-	  continue;
-	}
-	const Trk::FitQualityOnSurface* fqos=(**tsit).fitQualityOnSurface() ? 
-	  new Trk::FitQualityOnSurface(*(**tsit).fitQualityOnSurface()) : 0;
-	const Trk::MaterialEffectsBase* meb=( (*tsit)->materialEffectsOnTrack()) ?
-	  (*tsit)->materialEffectsOnTrack()->clone() : 0;
-	Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface( newMdt, pars->clone(), fqos, meb, 
-								       (*tsit)->types() );
-	newStates.push_back( std::make_pair(true,tsos) );	
-	
-	
-	
-      }else if( m_idHelperTool->isCsc(id) ) {
-	
-	const CscClusterOnTrack* csc = dynamic_cast<const CscClusterOnTrack*>(meas);
-	if( !csc ){
-	  ATH_MSG_WARNING(" Measurement with MDT identifier that is not a MdtDriftCircleOnTrack ");
-	  continue;
-	}
-	const Trk::RIO_OnTrack* newCsc = m_cscRotCreator->correct( *csc->prepRawData(), *pars );
-	if( !newCsc ) {
-	  ATH_MSG_WARNING(" Failed to recalibrate CSC ");
-	  continue;
-	}
-	const Trk::FitQualityOnSurface* fqos=(**tsit).fitQualityOnSurface() ? 
-	  new Trk::FitQualityOnSurface(*(**tsit).fitQualityOnSurface()) : 0;
-	const Trk::MaterialEffectsBase* meb=( (*tsit)->materialEffectsOnTrack()) ?
-	  (*tsit)->materialEffectsOnTrack()->clone() : 0;	
-	Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface( newCsc, pars->clone(), fqos, meb, 
-								       (*tsit)->types() );
-	newStates.push_back( std::make_pair(true,tsos) );	
-	
-	
-	
-      }
-      else if (  m_idHelperTool->isTrigger(id) ) {
-	
-	tsit = insertClustersWithCompetingRotCreation( tsit, tsit_end, newStates );	
-	
-      }
-      else {
-	ATH_MSG_WARNING(" unknown Identifier ");
-      }      
-    }
-    
-    ATH_MSG_DEBUG(" original track had " << states->size() 
-		  << " TSOS, adding " << newStates.size() - states->size() 
-		  << " new TSOS ");
-    
-    // states were added, create a new track
-    DataVector<const Trk::TrackStateOnSurface>* trackStateOnSurfaces = new DataVector<const Trk::TrackStateOnSurface>();
-    trackStateOnSurfaces->reserve( newStates.size() );
-    std::vector< std::pair<bool,const Trk::TrackStateOnSurface* > >::iterator nit = newStates.begin();
-    std::vector< std::pair<bool,const Trk::TrackStateOnSurface* > >::iterator nit_end = newStates.end();
-    for( ;nit!=nit_end;++nit ){
-      // add states. If nit->first is true we have a new state. If it is false the state is from the old track and has to be cloned
-      trackStateOnSurfaces->push_back( nit->first ? nit->second : nit->second->clone() );
-    }
-    Trk::Track* newTrack =  new Trk::Track( track.info(), trackStateOnSurfaces, track.fitQuality() ? track.fitQuality()->clone():0 );
-    
-    return newTrack;
-  }
-  
-  //________________________________________________________________________
-  DataVector<const Trk::TrackStateOnSurface>::const_iterator 
-  MuonAlignHelperTool::
-  insertClustersWithCompetingRotCreation( DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit,
-					  DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end,
-					  std::vector< std::pair<bool,const Trk::TrackStateOnSurface* > >& states) const {
-    
-    // iterator should point to a valid element
-    if ( tsit == tsit_end ) {
-      ATH_MSG_WARNING(" iterator pointing to end of vector, this should no happen ");
-      return --tsit;
-    }
-    
-    // check whether state is a measurement
-    const Trk::MeasurementBase* meas = (*tsit)->measurementOnTrack();
-    const Trk::TrackParameters* pars = (*tsit)->trackParameters();
-    if ( !meas  || !pars ) {
-      ATH_MSG_WARNING(" iterator pointing to a TSOS without a measurement or TrackParameters ");
-      if ( tsit+1 == tsit_end ) --tsit;
-      return tsit;
-    }
-    
-    ATH_MSG_VERBOSE(" inserting with competing ROT creation ");
-
-    // loop over states until we reached the last tgc hit in this detector element
-    // keep trackof the identifiers and the states
-    std::list<const Trk::PrepRawData*> etaPrds;
-    std::list<const Trk::PrepRawData*> phiPrds;
-    const Trk::TrkDetElementBase* currentDetEl = 0;
-    std::vector< std::pair<bool,const Trk::TrackStateOnSurface* > > newStates;
-    // keep track of outliers as we might have to drop them..
-    std::vector< std::pair<bool,const Trk::TrackStateOnSurface* > > outlierStates;
-    bool hasPhi = false;
-    bool hasEta = false;
-
-    for ( ;tsit!=tsit_end;++tsit ){
-      
-      if ( !*tsit ) continue;
-      
-      // check whether state is a measurement, keep if not
-      const Trk::MeasurementBase* meas = (*tsit)->measurementOnTrack();
-      if ( !meas ) {
-	newStates.push_back( std::make_pair(false,*tsit) );
-	continue;
-      }
-
-      // get identifier, keep state if it has no identifier.
-      Identifier id = m_helperTool->getIdentifier(*meas);
-      if ( !id.is_valid() ) {
-	newStates.push_back( std::make_pair(false,*tsit) );
-	continue;
-      }
-
-
-      // sanity check, this SHOULD be a RPC, TGC or CSC measurement
-      if ( !( m_idHelperTool->isTrigger(id) ) ){
-	break;
-      }
-
-      bool measuresPhi = m_idHelperTool->measuresPhi(id);
-      if ( !hasPhi && measuresPhi )  hasPhi = true;
-      if ( !hasEta && !measuresPhi ) hasEta = true;
-
-      // check whether state is a measurement
-      if ( (*tsit)->type(Trk::TrackStateOnSurface::Outlier) ) {	
-	outlierStates.push_back( std::make_pair(measuresPhi,*tsit) );
-	continue;
-      }
-
-      
-      // check whether we are still in the same chamber, stop loop if not
-
-      ATH_MSG_VERBOSE(" handling " << m_idHelperTool->toString(id));
-      
-      std::list<const Trk::PrepRawData*>& prdList = measuresPhi ? phiPrds : etaPrds;
-      const MuonClusterOnTrack* clus = dynamic_cast<const MuonClusterOnTrack*>(meas);
-      if ( clus ) {
-	const Trk::TrkDetElementBase* detEl = clus->detectorElement();
-	if ( !currentDetEl ) currentDetEl = detEl;
-	if ( detEl != currentDetEl ){
-	  ATH_MSG_VERBOSE(" new detector element stopping ");
-	  break;
-	}
-	prdList.push_back(clus->prepRawData());
-      }
-      else {
-	// split competing ROTs into constituents
-	const CompetingMuonClustersOnTrack* comp = dynamic_cast<const CompetingMuonClustersOnTrack*>(meas);
-	if ( comp ) {
-	  
-	  const Trk::TrkDetElementBase* detEl = 0; 
-	  if ( comp->containedROTs().empty() ) {
-	    ATH_MSG_WARNING(" CompetingROT without constituents ");
-	    break;
-	  }
-	  detEl = comp->containedROTs().front()->detectorElement();
-	  if ( !currentDetEl ) currentDetEl = detEl;
-	  if ( detEl != currentDetEl ) {
-	    ATH_MSG_VERBOSE(" new detector element stopping ");
-	    break;
-	  }	  
-	  std::vector<const MuonClusterOnTrack*>::const_iterator clit = comp->containedROTs().begin();
-	  std::vector<const MuonClusterOnTrack*>::const_iterator clit_end = comp->containedROTs().end();
-	  for ( ;clit!=clit_end;++clit ) {
-	    prdList.push_back((*clit)->prepRawData());
-	  }
-	  
-	}
-	else {
-	  ATH_MSG_WARNING(" Unknown trigger hit type! ");
-	  continue;
-	}
-      }
-    }
-    
-    // now that we have the lists of prds we can create the competing rots
-    if ( !etaPrds.empty() ) {
-      const CompetingMuonClustersOnTrack* etaCompRot = m_compRotCreator->createBroadCluster(etaPrds,0.);
-      if ( !etaCompRot ) {
-	ATH_MSG_WARNING(" Failed to create CompetingMuonClustersOnTrack for eta hits! ");
-      }
-      else {
-	
-	const Trk::TrackParameters* etaPars = 0;
-	// check whether original parameters are on surface, if so clone original parameters
-	if ( pars->associatedSurface() && etaCompRot->associatedSurface() == *pars->associatedSurface() ) {
-	  etaPars = pars->clone();
-	}
-	else {
-	  etaPars = m_propagator->propagate(*pars,etaCompRot->associatedSurface(),Trk::anyDirection,
-					    false,*m_magFieldProperties);
-	}
-	if ( !etaPars ) {
-	  ATH_MSG_WARNING(" Failed to calculate TrackParameters for eta hits! ");
-	  delete etaCompRot;
-	}
-	else {
-	  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; 
-    typePattern.set(Trk::TrackStateOnSurface::Measurement);
-    typePattern.set(Trk::TrackStateOnSurface::Parameter);
-	  Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface( etaCompRot, etaPars, 0, 0, typePattern );
-	  newStates.push_back( std::make_pair(true,tsos) );
-	}
-      }
-    }
-    
-    if ( !phiPrds.empty() ) {
-      const CompetingMuonClustersOnTrack* phiCompRot = m_compRotCreator->createBroadCluster(phiPrds,0.);
-      if ( !phiCompRot ) {
-	ATH_MSG_WARNING(" Failed to create CompetingMuonClustersOnTrack for phi hits! ");
-      }
-      else {
-	
-	const Trk::TrackParameters* phiPars = 0;
-	// check whether original parameters are on surface, if so clone original parameters
-	if ( pars->associatedSurface() && phiCompRot->associatedSurface() == *pars->associatedSurface() ) {
-	  phiPars = pars->clone();
-	}
-	else {
-	  phiPars = m_propagator->propagate(*pars,phiCompRot->associatedSurface(),Trk::anyDirection,
-					    false,*m_magFieldProperties);
-	}
-	if ( !phiPars ) {
-	  ATH_MSG_WARNING(" Failed to calculate TrackParameters for phi hits! ");
-	  delete phiCompRot;
-	}
-	else {
-	  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; 
-    typePattern.set(Trk::TrackStateOnSurface::Measurement);
-	  typePattern.set(Trk::TrackStateOnSurface::Parameter);
-	  Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface( phiCompRot, phiPars, 0, 0, typePattern );
-	  newStates.push_back( std::make_pair(true,tsos) );
-	}
-      }
-    }
-    
-    // add outliers if there was no measurement on track in the same projection
-    std::vector< std::pair<bool,const Trk::TrackStateOnSurface* > >::iterator outIt = outlierStates.begin();
-    std::vector< std::pair<bool,const Trk::TrackStateOnSurface* > >::iterator outIt_end = outlierStates.end();
-    for( ;outIt!=outIt_end;++outIt ){
-      if ( hasPhi && outIt->first )  newStates.push_back( std::make_pair(false,outIt->second) );
-      else if ( hasEta && !outIt->first ) newStates.push_back( std::make_pair(false,outIt->second));
-      else ATH_MSG_DEBUG(" Dropping outlier ");
-    }    
-    
-    // sort all states in this chamber
-    std::stable_sort(newStates.begin(),newStates.end(),SortTSOSByDistanceToPars(pars) );
-    
-    // insert the states into 
-    states.insert( states.end(),newStates.begin(),newStates.end() );
-    
-    // iterator should point to the last TGC in this chamber
-    return --tsit;
-  }
-  */
-
-  //________________________________________________________________________
-  float MuonAlign::RadsToDegrees(float Radians)
-  {
-    if (Radians < 0) Radians = (-1 * Radians) + M_PI;
-    float Degrees = Radians * (180.)/M_PI;
-    return Degrees;
-  }
-  
-  //________________________________________________________________________
-  double MuonAlign::FixRad(double inputRad)
-  {
-    double Rad=inputRad;
-    if (Rad>M_PI)       Rad -= 2.*M_PI; 
-    else if (Rad<-M_PI) Rad += 2.*M_PI;
-    
-    if (fabs(Rad)>M_PI/2.) {
-      if ( Rad > 0. ) Rad -=M_PI ;
-      else            Rad +=M_PI ;	
-    }
-    return Rad;
-  }
-
-  //________________________________________________________________________
-  StationLayer MuonAlignHelperTool::getMdtStatLayer(Identifier id) const 
-  {
-    
-    const std::string stName=
-      m_muonIdHelper->mdtIdHelper().stationNameString(m_muonIdHelper->mdtIdHelper().stationName(id));
-    
-    // station layer
-    switch ( stName[1] ) {
-    case 'I' :
-      return Inner;
-    case 'M' :
-      return Middle;
-    case 'O' :
-      return Outer;
-    default:
-      return Other;
-    }    
-    return Other;
-  }
-
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignModuleTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignModuleTool.cxx
deleted file mode 100644
index a245b832503..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignModuleTool.cxx
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "DataModel/DataVector.h"
-
-#include "TrkPrepRawData/PrepRawData.h"
-#include "TrkRIO_OnTrack/RIO_OnTrack.h"
-#include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h"
-#include "TrkAlignEvent/AlignTSOS.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "TrkSurfaces/PlaneSurface.h"
-#include "TrkTrack/TrackStateOnSurface.h"
-#include "TrkTrack/Track.h"
-
-#include "MuonAlignEvent/CombinedMuonAlignModule.h"
-#include "MuonAlignGenTools/MuonAlignModuleTool.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/TgcReadoutElement.h"
-#include "MuonReadoutGeometry/RpcReadoutElement.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonReadoutGeometry/MuonDetectorElement.h"
-#include "MuonReadoutGeometry/MuonStation.h"
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-
-#include "MuonIdHelpers/MdtIdHelper.h"
-#include "MuonIdHelpers/TgcIdHelper.h"
-#include "MuonIdHelpers/RpcIdHelper.h"
-#include "MuonIdHelpers/CscIdHelper.h"
-
-namespace Muon {
-
-  //________________________________________________________________________
-  MuonAlignModuleTool::MuonAlignModuleTool(const std::string& type,
-					 const std::string& name,
-					 const IInterface* parent)
-    : Trk::AlignModuleTool(type,name,parent)
-    , p_muonMgr(0)
-
-  {
-    //declareInterface<Trk::IAlignModuleTool>(this);
-
-  }
-  
-  //________________________________________________________________________
-  MuonAlignModuleTool::~MuonAlignModuleTool() 
-  {
-    for (int i=0;i<(int)m_origTransforms.size();i++) 
-      delete m_origTransforms[i];
-  }
-
-  //_______________________________________________________________________
-  StatusCode MuonAlignModuleTool::initialize() 
-  {
-    msg(MSG::DEBUG) << "initialize() of MuonAlignModuleTool" << endmsg;  
-  
-    StatusCode sc = AlignModuleTool::initialize();
-    if (sc.isFailure()) {
-      ATH_MSG_ERROR("Unable to initialize AlignModuleTool");
-      return sc;
-    }
-
-    sc=detStore()->retrieve(p_muonMgr);
-    if (sc.isFailure()) {
-      msg(MSG::FATAL)<<"Cannot retrieve MuonDetectorManager"<<endmsg;
-      return sc;
-    }
-    else msg(MSG::DEBUG)<<"retrieved MuonDetectorManager"<<endmsg;
-    
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonAlignModuleTool::finalize() 
-  {  
-    StatusCode sc = AlignModuleTool::finalize();
-    if (sc.isFailure()) {
-      ATH_MSG_ERROR("Unable to finalize AlignModuleTool");
-      return sc;
-    }
-
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  void MuonAlignModuleTool::shiftModule(const Trk::AlignModule* module, 
-					const Trk::Track* track, 
-					Trk::AlignModule::TransformParameters dimension, 
-					double value) const 
-  {
-    ATH_MSG_DEBUG("in shiftModule, dimension="<<dimension
-		    <<", value="<<value);
-        
-    if (m_origTransforms.size()>0) {
-      ATH_MSG_WARNING("shifting module without restoring!");
-      restoreModule(module);   
-    }
-    m_origTransforms.assign(Trk::AlignModule::NDetectorTypes,(std::vector<Amg::Transform3D*>*)0);
-
-    // loop over track and get the detelements from the track that are in this AlignModule
-    std::vector<Identifier> mdtReadoutElementIDs;
-    std::vector<Identifier> cscReadoutElementIDs;
-    std::vector<Identifier> tgcReadoutElementIDs;
-    std::vector<Identifier> rpcReadoutElementIDs;
-    
-    // loop over track and shift tubes/surfaces in this AlignModule
-    for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator itTsos=
-	   track->trackStateOnSurfaces()->begin();
-	 itTsos!=track->trackStateOnSurfaces()->end(); ++itTsos) {
-      
-      // this will continue if TSOS is a scatterer and NOT a measurement
-      if ((**itTsos).type(Trk::TrackStateOnSurface::Scatterer) ||
-	  (**itTsos).type(Trk::TrackStateOnSurface::Perigee)) continue;
-
-      const Trk::MeasurementBase*      mesb  = (**itTsos).measurementOnTrack();
-      const Trk::RIO_OnTrack*          rio   = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack* crio  = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-
-      if (!rio && crio) rio=&crio->rioOnTrack(0);
-      if (!rio) continue;
-
-      std::vector<const Trk::TrkDetElementBase*> detelements;
-      if (crio) {
-	ATH_MSG_VERBOSE("have CRIO");
-	for (unsigned int irio = 0; irio < crio->numberOfContainedROTs(); irio++) {
-	  ATH_MSG_VERBOSE("irio "<<irio);
-	  const Trk::RIO_OnTrack* trio = &crio->rioOnTrack(irio);
-	  detelements.push_back(trio->associatedSurface().associatedDetectorElement());
-	}
-	ATH_MSG_VERBOSE("crio->assocSurface().associatedDetElemId()="<<
-			crio->associatedSurface().associatedDetectorElementIdentifier());
-      }
-      else {
-	//detelements.push_back(mesb->associatedSurface().associatedDetectorElement());      
-	detelements.push_back(rio->associatedSurface().associatedDetectorElement());      
-	ATH_MSG_VERBOSE("no crio, rio->associatedSurface().associatedDetectorElementIdentifier()="<<
-			rio->associatedSurface().associatedDetectorElementIdentifier());
-      }      
-    
-      // MDT
-      if (!m_idHelper->is_muon(rio->identify())) continue; // this is necessary until AtlasDetDescr bug fixed
-
-      if (m_idHelper->is_mdt(rio->identify())) {
-	
-	ATH_MSG_VERBOSE("storing MDT hit");
-	
-	// MdtReadoutElements are stored in AlignModule, so get MdtReadoutElement from atsos
-	const MuonGM::MdtReadoutElement* mdt=
-	  dynamic_cast<const MuonGM::MdtReadoutElement*>(detelements[0]);
-	
-	if (!mdt) {
-	  ATH_MSG_ERROR("no MdtReadoutElement for Measurement!");
-	  continue;
-	}
-	ATH_MSG_VERBOSE("finding MdtAlignModule");
-
-	if (findAlignModule(mdt,Trk::AlignModule::MDT)) {
-	  std::vector<Identifier>::iterator it=find(mdtReadoutElementIDs.begin(),
-						    mdtReadoutElementIDs.end(),
-						    mdt->identify());
-	  if (it==mdtReadoutElementIDs.end()) {
-	    mdtReadoutElementIDs.push_back(mdt->identify());      
-	    ATH_MSG_DEBUG("pushed back "<<mdt->identify());
-	  }
-	}
-      }
-      // CSC
-      else if (m_idHelper->is_csc(rio->identify())) {
-	
-	ATH_MSG_VERBOSE("storing CSC hit");
-	
-	// CscReadoutElements are stored in AlignModule, so get CscReadoutElement from atsos
-	const MuonGM::CscReadoutElement* csc=
-	  dynamic_cast<const MuonGM::CscReadoutElement*>(detelements[0]);
-	
-	if (!csc) {
-	  ATH_MSG_ERROR("no CscReadoutElement for Measurement!");
-	  continue;
-	}
-	ATH_MSG_VERBOSE("finding CscAlignModule");
-
-	if (findAlignModule(csc,Trk::AlignModule::CSC)) {
-	  std::vector<Identifier>::iterator it=find(cscReadoutElementIDs.begin(),
-						    cscReadoutElementIDs.end(),
-						    csc->identify());
-	  if (it==cscReadoutElementIDs.end()) {
-	    cscReadoutElementIDs.push_back(csc->identify());
-	    ATH_MSG_DEBUG("pushed back "<<csc->identify());
-	  }
-	}
-      }
-      // TGC 
-      else if (m_idHelper->is_tgc(rio->identify())) {
-	
-	ATH_MSG_VERBOSE("storing TGC hit");
-
-	for (int idet=0;idet<(int)detelements.size();idet++) {
-	  const MuonGM::TgcReadoutElement* tgc=
-	    dynamic_cast<const MuonGM::TgcReadoutElement*>(detelements[idet]);
-	  if (!tgc) { 
-	    ATH_MSG_ERROR("no TgcReadoutElement for Measurement!");
-	    continue;
-	  }
-	  if (findAlignModule(tgc,Trk::AlignModule::TGC)) {	    
-	    std::vector<Identifier>::iterator it=find(tgcReadoutElementIDs.begin(),
-						      tgcReadoutElementIDs.end(),
-						      tgc->identify());
-	    if (it==tgcReadoutElementIDs.end()) {
-	      tgcReadoutElementIDs.push_back(tgc->identify());      
-	      ATH_MSG_DEBUG("pushed back "<<tgc->identify());
-	    }
-	  }
-        }
-      }      
-      // RPC
-      else if (m_idHelper->is_rpc(rio->identify())) {
-	
-	if (!m_idHelper->is_muon(rio->identify()))
-	  ATH_MSG_ERROR("is rpc but not muon!!!!");
-
-	ATH_MSG_VERBOSE("storing RPC hit");
-	
-	for (int idet=0;idet<(int)detelements.size();idet++) {
-	  ATH_MSG_DEBUG("idet="<<idet);
-	  const MuonGM::RpcReadoutElement* rpc=
-	    dynamic_cast<const MuonGM::RpcReadoutElement*>(detelements[idet]);
-	  if (!rpc) {
-	    ATH_MSG_ERROR("no RpcReadoutElement for Measurement!");
-	    continue;
-	  }
-	  if (findAlignModule(rpc,Trk::AlignModule::RPC)) {	    
-	    std::vector<Identifier>::iterator it=find(rpcReadoutElementIDs.begin(),
-						      rpcReadoutElementIDs.end(),
-						      rpc->identify());
-	    if (it==rpcReadoutElementIDs.end()) {
-	      rpcReadoutElementIDs.push_back(rpc->identify());      
-	      ATH_MSG_DEBUG("pushed back "<<rpc->identify());
-	    }
-	  }
-	}
-      }
-    }
-    ATH_MSG_DEBUG("this track has "
-		  <<mdtReadoutElementIDs.size()<<" mdt elements, "
-		  <<cscReadoutElementIDs.size()<<" csc elements, "
-		  <<tgcReadoutElementIDs.size()<<" tgc elements, "
-		  <<rpcReadoutElementIDs.size()<<" rpc elements");
-    
-    if (mdtReadoutElementIDs.size()>0) 
-      shiftDetElements(Trk::AlignModule::MDT,mdtReadoutElementIDs,
-		       module,track,dimension,value);
-    if (cscReadoutElementIDs.size()>0) 
-      shiftDetElements(Trk::AlignModule::CSC,cscReadoutElementIDs,
-		       module,track,dimension,value);
-    if (tgcReadoutElementIDs.size()>0) 
-      shiftDetElements(Trk::AlignModule::TGC,tgcReadoutElementIDs,
-		       module,track,dimension,value);
-    if (rpcReadoutElementIDs.size()>0) 
-      shiftDetElements(Trk::AlignModule::RPC,rpcReadoutElementIDs,
-		       module,track,dimension,value);
-    m_shiftedMuonStations.clear();
-    return;
-  }
-
-  //________________________________________________________________________
-  void MuonAlignModuleTool::shiftDetElements(Trk::AlignModule::DetectorType /*detType*/,
-					     const std::vector<Identifier>& /*readoutElementIDs*/,
-					     const Trk::AlignModule* /*module*/,
-					     const Trk::Track* /*track*/,
-					     Trk::AlignModule::TransformParameters /*dimension*/, 
-					     double /*value*/) const
-  {
-
-    ATH_MSG_ERROR("need to migrate shiftDetElements method to Eigen");
-    return;
-
-    /*
-    ATH_MSG_DEBUG("in shiftDetElements, detType "<<detType);
-
-    const Trk::AlignModule::DetElementCollection* detelements=
-      module->detElementCollection(detType);
-    
-    if (0==detelements) return;
-
-    m_origTransforms[detType]=new std::vector<HepGeom::Transform3D*>;
-    m_origTransforms[detType]->assign(detelements->size(),0);
-    for (int ielem=0;ielem<(int)detelements->size();ielem++) {
-
-      // see if this detelement is on the track
-      bool goodDetElement=false;
-      for (int i=0;i<(int)readoutElementIDs.size();i++) {
-	
-	if ((*detelements)[ielem] &&
-	    (*detelements)[ielem]->identify()==readoutElementIDs[i]) {
-	  goodDetElement=true;
-	  ATH_MSG_VERBOSE("found goodDetElement, leaving loop over detelements");
-	  break;
-	}
-      }
-      if (!goodDetElement) continue;
-      
-      const Trk::TrkDetElementBase* detelement=(*detelements)[ielem];
-      
-      // A-lines applied at MuonStation level
-      MuonGM::MuonStation* ms=
-	const_cast<MuonGM::MuonStation*>(dynamic_cast<const MuonGM::MuonReadoutElement*>(detelement)->parentMuonStation());
-            
-      if (find(m_shiftedMuonStations.begin(),
-	       m_shiftedMuonStations.end(),ms)==m_shiftedMuonStations.end()) {
-
-	m_shiftedMuonStations.push_back(ms);
-	
-        // get original transform
-        HepGeom::Transform3D* orig_transform=new HepGeom::Transform3D(*(ms->getGeoTransform()->getDelta()));
-	ATH_MSG_DEBUG("setting orig transform for ielem "<<ielem<<", id "<<(*detelements)[ielem]->identify());
-        (*(m_origTransforms[detType]))[ielem]=orig_transform;
-
-        // add shift to original transform
-        double shifts[6];
-        for (int i=0;i<6;i++) shifts[i]=0.;
-        if (dimension==Trk::AlignModule::TransX || 
-	    dimension==Trk::AlignModule::TransY || 
-	    dimension==Trk::AlignModule::TransZ) 
-	  shifts[dimension]=value; // shift value in mm
-        else 
-	  shifts[dimension]=value; // shift value in rad
-        ATH_MSG_DEBUG("shifts["<<dimension<<"]="<<shifts[dimension]);
-	
-	// shift in alignment frame
-	HepGeom::Transform3D delta_alignmentframe= 
-	  HepGeom::TranslateX3D(shifts[0]) *
-	  HepGeom::TranslateY3D(shifts[1]) *
-	  HepGeom::TranslateZ3D(shifts[2]) *
-	  HepGeom::RotateX3D(shifts[3]) *
-	  HepGeom::RotateY3D(shifts[4]) *
-	  HepGeom::RotateZ3D(shifts[5]);
-
-	// transform to det element frame
-	const Amg::Transform3D* alignmodule_to_detelement=
-	  module->alignModuleToDetElementTransform(detType,detelement);
-
-	HepGeom::Transform3D native_to_amdb = *(ms->getNativeToAmdbLRS());
-
-	HepGeom::Transform3D delta_native = 
-	  native_to_amdb.inverse() * (*alignmodule_to_detelement) * delta_alignmentframe * 
-	  alignmodule_to_detelement->inverse() * native_to_amdb;
-	
-	HepGeom::Transform3D xform=delta_native * (*orig_transform); 
-
-	ms->getGeoTransform()->setDelta( (*orig_transform) * delta_native );
-      }
-            
-      // loop over track and shift tubes/surfaces in this detector element
-      for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator itTsos=
-	     track->trackStateOnSurfaces()->begin();
-	   itTsos!=track->trackStateOnSurfaces()->end(); ++itTsos) {
-	
-	if ((**itTsos).type(Trk::TrackStateOnSurface::Scatterer) ||
-	    (**itTsos).type(Trk::TrackStateOnSurface::Perigee)) continue;
-	
-	const Trk::MeasurementBase*      mesb  = (**itTsos).measurementOnTrack();
-	const Trk::RIO_OnTrack*          rio   = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio  = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);      
-	if (!rio && crio) rio=crio->rioOnTrack(0);
-	if (!rio) continue;
-	
-	const Trk::TrkDetElementBase* hitDetelement = crio ?
-	  crio->rioOnTrack(0)->associatedSurface().associatedDetectorElement() :
-	  mesb->associatedSurface().associatedDetectorElement();
-	Identifier hitId=hitDetelement->identify();
-	
-	if (//!(*atsos)->module() ||
-	    hitId != detelement->identify() ) continue;
-	
-	// RIO_OnTrack
-	if (rio && !crio) {
-	  
-	  // is this an MDT or CSC hit?
-	  if (!m_idHelper->is_mdt(hitId) && 
-	      !m_idHelper->is_csc(hitId) &&
-	      !m_idHelper->is_tgc(hitId)) ATH_MSG_ERROR("something wrong, not MDT or CSC hit");
-	  
-	  ATH_MSG_DEBUG("calling shiftSurface for rio "<<rio->identify()<<", detelement "
-			<<detelement->identify());
-	  
-	  shiftSurface(module,detelement,rio->identify());
-	}
-	
-	// CompetingRIOsOnTrack
-	else {
-	  
-	  // is it a TGC hit?
-	  if (!m_idHelper->is_tgc(hitId) &&
-	      !m_idHelper->is_rpc(hitId)) ATH_MSG_ERROR("something wrong, not TGC or RPC hit");
-	  
-	  ATH_MSG_DEBUG("TGC hit pos before: "<<
-			*(crio->associatedSurface().localToGlobal(crio->localParameters())));
-	  ATH_MSG_DEBUG("crio->assocSurface()="<<&(crio->associatedSurface()));
-	  if (dynamic_cast<const Trk::PlaneSurface*>(&crio->associatedSurface()))
-	    ATH_MSG_DEBUG("crio->planeSurface: "<<dynamic_cast<const Trk::PlaneSurface*>(&crio->associatedSurface()));
-	  
-	  
-	  ATH_MSG_DEBUG("crio->assocSurface().associatedDetectorElementIdentifier="<<crio->associatedSurface().associatedDetectorElementIdentifier());
-	  
-	  shiftSurface(module,detelement,rio->identify());
-	  
-	  ATH_MSG_DEBUG("TGC hit pos after: "<<
-			*(crio->associatedSurface().localToGlobal(crio->localParameters())));
-	  ATH_MSG_DEBUG("crio->assocSurface()="<<&(crio->associatedSurface()));
-	  ATH_MSG_DEBUG("crio->assocSurface().associatedDetectorElementIdentifier="<<crio->associatedSurface().associatedDetectorElementIdentifier());
-	  
-	}
-      }	
-      
-    }
-    ATH_MSG_DEBUG("returning from shiftDetElements");
-    return;
-    */
-
-  }
-   
-  //________________________________________________________________________
-  void MuonAlignModuleTool::restoreModule(const Trk::AlignModule* /*module*/) const 
-  {
-    ATH_MSG_ERROR("migrate restoreModule to Eigen");
-    return;
-
-    /*
-    ATH_MSG_DEBUG("in restoreModule");
-
-    const Muon::CombinedMuonAlignModule* combModule=
-      dynamic_cast<const Muon::CombinedMuonAlignModule*>(module);
-    if (!combModule) {
-      ATH_MSG_ERROR("not CombinedMuonAlignModule!");
-      return;
-    }
-
-    MuonGM::MuonStation* current_ms(0);
-
-    for (int idetType=0;idetType<(int)m_origTransforms.size();idetType++) {
-      if (!m_origTransforms[idetType]) continue;
-      
-      const Trk::AlignModule::DetElementCollection* detelements=
-	module->detElementCollection(Trk::AlignModule::DetectorType(idetType));
-
-      if (0==detelements) continue;
-      
-      for (int ielem=0;ielem<(int)detelements->size();ielem++) {
-	
-	const MuonGM::MuonReadoutElement* const constmre=
-	  dynamic_cast<const MuonGM::MuonReadoutElement*>((*detelements)[ielem]);
-	
-	
-	MuonGM::MuonStation* ms=const_cast<MuonGM::MuonStation*>(constmre->parentMuonStation());
-	
-	HepGeom::Transform3D* origTransform=(*(m_origTransforms[idetType]))[ielem];
-	if (origTransform){ 
-	  HepGeom::Transform3D xform=*origTransform;
-	  ms->getGeoTransform()->setDelta(*origTransform);
-	}
-	
-	if(ms!=current_ms){      
-          current_ms=ms;
-          if(0==origTransform) continue;
-	}
-	
-
-	Trk::TrkDetElementBase* detelement = const_cast<Trk::TrkDetElementBase*>((*detelements)[ielem]);
-	combModule->restoreSurfaces(detelement);
-
-      }
-      delete m_origTransforms[idetType];      
-    }
-    
-    m_origTransforms.clear();
-    
-    return;
-    */
-
-  }
-
-  //________________________________________________________________________
-  void MuonAlignModuleTool::shiftSurface(const Trk::AlignModule* module,
-					 const Trk::TrkDetElementBase* detelement, 
-					 const Identifier id) const
-  {
-    const Muon::CombinedMuonAlignModule* combModule=
-      dynamic_cast<const Muon::CombinedMuonAlignModule*>(module);
-    if (!combModule) {
-      ATH_MSG_ERROR("not CombinedMuonAlignModule!");
-      return;
-    }
-    combModule->shiftSurface(const_cast<Trk::TrkDetElementBase*>(detelement),id);       
-
-    return;
-  }
-
-  //________________________________________________________________________
-  void MuonAlignModuleTool::setMeasurementProperties(Trk::AlignTSOS* alignTSOS) const
-  {
-    bool measPhi=false;
-    
-    // eta measurements need measurement direction set to Trk::y
-    if (alignTSOS->measType()==Trk::TrackState::CSC) {
-      Identifier id = alignTSOS->rio()->prepRawData()->identify();
-      measPhi = p_muonMgr->cscIdHelper()->measuresPhi(id);
-    }
-    else if (alignTSOS->measType()==Trk::TrackState::TGC) {
-      Identifier id = alignTSOS->rio()->prepRawData()->identify();
-      measPhi = p_muonMgr->tgcIdHelper()->isStrip(id);
-    }
-    else if (alignTSOS->measType()==Trk::TrackState::RPC) {
-      Identifier id = alignTSOS->rio()->prepRawData()->identify();
-      measPhi = p_muonMgr->rpcIdHelper()->measuresPhi(id);
-    }
-    else if (alignTSOS->measType()==Trk::TrackState::MDT) 
-      measPhi = true;
-
-    if (!measPhi) alignTSOS->setMeasDir(Trk::y);
-    return;
-  }
-
-  //________________________________________________________________________
-  int MuonAlignModuleTool::subDetElementIDHash(Identifier id) const
-  {
-    if (id.is_valid()) {
-      if (m_idHelper->is_mdt(id))
-	return p_muonMgr->getMdtReadoutElement(id)->identifyHash();
-      else if (m_idHelper->is_csc(id))
-	return p_muonMgr->getCscReadoutElement(id)->identifyHash();
-      else if (m_idHelper->is_tgc(id))
-	return p_muonMgr->getTgcReadoutElement(id)->identifyHash();
-    }
-    return 0;  
-  }
-  
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignRefitTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignRefitTool.cxx
deleted file mode 100644
index ecf95c86e3a..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonAlignRefitTool.cxx
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-#include "MuonAlignGenTools/MuonAlignRefitTool.h"
-#include "MuonAlignGenTools/MuonAlignHelperTool.h"
-
-#include "GaudiKernel/IMessageSvc.h"
-
-#include "TrkGeometry/MagneticFieldProperties.h"
-//#include "TrkMagFieldInterfaces/IMagneticFieldTool.h"
-
-#include "AtlasDetDescr/AtlasDetectorID.h"
-
-#include "DataModel/DataVector.h"
-#include "TrkTrack/TrackStateOnSurface.h"
-#include "TrkTrack/Track.h"
-#include "TrkMeasurementBase/MeasurementBase.h"
-#include "TrkEventUtils/MeasurementTypeID.h"
-#include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h"
-
-#include "MuonRIO_OnTrack/CscClusterOnTrack.h"
-#include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h"
-#include "MuonRIO_OnTrack/MuonClusterOnTrack.h"
-#include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h"
-#include "MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h"
-
-#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h"
-#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h"
-#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h"
-#include "TrkExInterfaces/IPropagator.h"
-#include "MuonRecHelperTools/MuonEDMHelperTool.h"
-#include "MuonRecHelperTools/MuonEDMPrinterTool.h"
-#include "MuonIdHelpers/MuonIdHelperTool.h"
-//#include "MuonCombiTrackMaker/SortMeasurementsByPosition.h"
-//#include "MuonRecToolInterfaces/IMuonRefitTool.h"
-#include "MuonPrepRawData/CscPrepData.h"
-
-#include "TrkVolumes/Volume.h"
-#include "EventPrimitives/EventPrimitives.h"
-
-namespace Muon {
-  
-  //________________________________________________________________________
-  MuonAlignRefitTool::MuonAlignRefitTool(const std::string& type,
-					 const std::string& name,
-					 const IInterface* parent)
-    : AthAlgTool(type,name,parent)      
-      //, m_propagator("Trk::StraightLinePropagator/MuonStraightLinePropagator")
-      //, m_magFieldTool("Trk::MagneticFieldTool/AtlasMagneticFieldTool")
-    , m_trackBuilder("Muon::MuonSegmentTrackBuilder/MuonSegmentTrackBuilder")
-    , m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool")
-    , m_helper("Muon::MuonEDMHelperTool/MuonEDMHelperTool")
-    , m_muonIdHelper("Muon::MuonIdHelperTool/MuonIdHelperTool")
-    , m_refitTool("Muon::MuonRefitTool/MuonRefitTool")
-    , m_muonAlignHelperTool("Muon::MuonAlignHelperTool/MuonAlignHelperTool")
-    , m_trackingVolumesSvc("TrackingVolumesSvc/TrackingVolumesSvc",name)
-  {
-
-    declareInterface<MuonAlignRefitTool>(this);
-
-    //declareProperty("Propagator",              m_propagator, "propagator");
-
-    declareProperty("MuonRefitTool",           m_refitTool);
-
-    declareProperty("TrackBuilder",            m_trackBuilder);
-    declareProperty("TrackingVolumesSvc",      m_trackingVolumesSvc);
-
-    declareProperty("RemoveBIS8Hits",          m_removeBIS8Hits   = false);
-    declareProperty("RemoveBEEHits",           m_removeBEEHits    = false);
-    declareProperty("RemoveEEHits",            m_removeEEHits     = false);
-    declareProperty("RemoveTGCHits",           m_removeTGCHits    = false);
-    declareProperty("RemoveTGCEtaHits",        m_removeTGCEtaHits = true);
-    declareProperty("RemoveRPCEtaHits",        m_removeRPCEtaHits = true);
-    declareProperty("RemoveCSCHits",           m_removeCSCHits    = false);
-    declareProperty("RemoveSpoiledCSCHits",    m_removeSpoiledCSCHits = true);
-    declareProperty("RemoveCSCPhiHits",        m_removeCSCPhiHits = false);
-    declareProperty("RemoveSmallBarrelHits",   m_removeSmallBarrelHits = false);
-    declareProperty("RemoveBarrelHits",        m_removeBarrelHits = false);
-    declareProperty("RemoveEndcapHits",        m_removeEndcapHits = false);
-    declareProperty("RemoveTRTHits",           m_removeTRTHits    = false);
-    declareProperty("RemoveScattering",        m_removeScattering = false);
-
-    declareProperty("DeclusterTGCHits",        m_declusterTGCHits = true);
-
-    declareProperty("RecreateStartingParameters", m_recreateStartingParameters=true);
-    declareProperty("ExtrapolateToMuonEntry",  m_extrapolateToMuonEntry = true);
-
-    declareProperty("RedoErrorScaling",        m_redoErrorScaling = false);
-  }
-  
-  //________________________________________________________________________
-  MuonAlignRefitTool::~MuonAlignRefitTool() 
-  {
-    
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonAlignRefitTool::initialize()
-  {
-
-    StatusCode sc=StatusCode::SUCCESS;
-
-
-    if ( !m_printer.retrieve().isSuccess() ) {
-      ATH_MSG_ERROR ("Unable to retrieve" << m_printer);
-      return StatusCode::FAILURE;
-    }
-
-    if ( !m_helper.retrieve().isSuccess() ) {
-      ATH_MSG_ERROR ("Unable to retrieve" << m_helper);
-      return StatusCode::FAILURE;
-    }
-
-    if ( !m_muonIdHelper.retrieve().isSuccess() ) {
-      ATH_MSG_ERROR ("Unable to retrieve" << m_muonIdHelper);
-      return StatusCode::FAILURE;
-    }
-
-    // Set up ATLAS ID helper 
-    if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) {
-      ATH_MSG_ERROR ("Could not get AtlasDetectorID helper" );
-      return StatusCode::FAILURE;
-    } 
-    m_measTypeIdHelper=new Trk::MeasurementTypeID(m_idHelper);
-    
-    /*
-    sc = m_propagator.retrieve();
-    if ( sc.isSuccess() ) {
-      ATH_MSG_DEBUG("Retrieved " << m_propagator);
-    }else{
-      ATH_MSG_FATAL("Could not get " << m_propagator); 
-      return StatusCode::FAILURE;
-    }
-    */
-
-    sc = m_trackBuilder.retrieve();
-    if (sc.isSuccess()){
-      ATH_MSG_DEBUG("Retrieved " << m_trackBuilder);
-    }else{
-      ATH_MSG_FATAL(" Could not get " << m_trackBuilder);
-      return sc;
-    }
-    
-    /*
-    if (m_magFieldTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved "<<m_magFieldTool);
-    else {
-      ATH_MSG_WARNING("Failed to retrieve "<<m_magFieldTool);
-      return StatusCode::FAILURE;
-    }
-    m_magFieldProperties = new Trk::MagneticFieldProperties(&(*m_magFieldTool),Trk::RealisticField);
-    */
-
-    if (m_muonAlignHelperTool.retrieve().isSuccess()){
-      ATH_MSG_DEBUG("Retrieved " << m_muonAlignHelperTool);
-    }else{
-      ATH_MSG_FATAL(" Could not get " << m_muonAlignHelperTool);
-      return StatusCode::FAILURE;
-    }
-    //return StatusCode::SUCCESS;
-
-    // need to know which TrackingVolume we are in: indet/calo/spectrometer
-    if (m_trackingVolumesSvc.retrieve().isFailure())
-      {
-        ATH_MSG_FATAL( "Failed to retrieve Svc " << m_trackingVolumesSvc );
-        return StatusCode::FAILURE;
-      } 
-    else
-    {
-      ATH_MSG_INFO( "Retrieved Svc " << m_trackingVolumesSvc );
-      m_calVolume   = new Trk::Volume(m_trackingVolumesSvc->volume(Trk::ITrackingVolumesSvc::MuonSpectrometerEntryLayer));
-      m_indetVolume = new Trk::Volume(m_trackingVolumesSvc->volume(Trk::ITrackingVolumesSvc::CalorimeterEntryLayer));
-    }
-    return StatusCode::SUCCESS;
-  }
-  
-  //________________________________________________________________________
-  StatusCode MuonAlignRefitTool::finalize()
-  {
-    //delete m_magFieldProperties;
-
-    return StatusCode::SUCCESS;
-  }
-  
-  
-  //________________________________________________________________________
-  Trk::Track* MuonAlignRefitTool::pTCorrectTrack(const Trk::Track& track, 
-						  double qOverP, bool removePerigee)  const
-  {
-    ATH_MSG_DEBUG("in pTCorrectTrack with qOverP: "<<qOverP);
-
-    DataVector<const Trk::TrackStateOnSurface>* trackStateOnSurfaces =
-      new DataVector<const Trk::TrackStateOnSurface>;
-    bool firstTSOS=true;
-
-    const DataVector<const Trk::TrackStateOnSurface>* oldTSOS=track.trackStateOnSurfaces();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=oldTSOS->begin(); 
-    for (; iTsos!=oldTSOS->end(); ++iTsos) {
-
-      // always remove perigee
-      if (removePerigee && (*iTsos)->type(Trk::TrackStateOnSurface::Perigee)) continue;
-
-      if (firstTSOS) {
-	
-	ATH_MSG_DEBUG("origTSOS: "<<**iTsos);
-	
-	// get track parameters modified with ID momentum
-	const Trk::TrackParameters* parm = (*iTsos)->trackParameters();
-	AmgVector(5) pars=parm->parameters();
-	
-	ATH_MSG_DEBUG("pOverQ: "<<1./qOverP/1000.);
-	pars[Trk::qOverP]=qOverP;
-	
-	//const Trk::TrackParameters* newparm=parm->cloneToNew(pars);
-	
-	const Trk::TrackParameters* newparm = 
-	  parm->associatedSurface().createTrackParameters(pars[Trk::loc1],pars[Trk::loc2],pars[Trk::phi],
-							  pars[Trk::theta],pars[Trk::qOverP],
-							  new AmgSymMatrix(5)(*parm->covariance()));
-	
-
-	const Trk::MeasurementBase*     meas=(**iTsos).measurementOnTrack() ?
-	  (**iTsos).measurementOnTrack()->clone():0;
-	const Trk::FitQualityOnSurface* fqos=(**iTsos).fitQualityOnSurface() ? 
-	  new Trk::FitQualityOnSurface(*(**iTsos).fitQualityOnSurface()) : 0;
-	const Trk::MaterialEffectsBase* meb = (**iTsos).materialEffectsOnTrack() ? (**iTsos).materialEffectsOnTrack()->clone() : 0;
-
-	std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
-	for (int i=0;i<(int)Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes;i++) {
-	  if ((**iTsos).type(Trk::TrackStateOnSurface::TrackStateOnSurfaceType(i)))
-	    typePattern.set(i);
-	}	
-	const Trk::TrackStateOnSurface* newTsos=new Trk::TrackStateOnSurface(meas,newparm,fqos,meb,typePattern);
-	
-	ATH_MSG_DEBUG("newTSOS: "<<*newTsos);	
-	trackStateOnSurfaces->push_back(newTsos);
-	firstTSOS=false;
-      }
-      else 
-	trackStateOnSurfaces->push_back((*iTsos)->clone());
-      
-    }
-    Trk::Track* newTrack = new Trk::Track(Trk::TrackInfo(track.info()),
-					  trackStateOnSurfaces,
-					  track.fitQuality()->clone());
-    return newTrack;
-  } 
- 
-
-  //________________________________________________________________________
-  const Trk::Track* MuonAlignRefitTool::refitForAlignment(const Trk::Track& track)
-  {
-    //IMuonRefitTool::Settings settings;
-    IMuonRefitTool::Settings settings;
-    settings.refit                      = true;
-    settings.removeOutliers             = false;
-    settings.discardNotCleanedTracks    = false;
-    settings.recalibrate                = false;
-    settings.updateErrors               = false;
-    settings.updateTriggerErrors        = false;
-    settings.prepareForFit              = true;
-    settings.recreateStartingParameters = m_recreateStartingParameters;
-    settings.removeOtherSectors         = false;
-    settings.deweightOtherSectors       = false;
-    settings.extrapolateToMuonEntry     = m_extrapolateToMuonEntry;
-    settings.removeTriggerEtaHits       = true;
-
-    ATH_MSG_DEBUG("calling refit");
-    const Trk::Track* refitTrack=m_refitTool->refit(track,&settings);
-    if (!refitTrack || refitTrack==&track) {
-      ATH_MSG_DEBUG("initial refit failed");
-      return 0;
-    }
-
-    // always redo competing ROTs to make sure they have the correct alignment position
-    bool doMdts=m_redoErrorScaling; // for error scaling
-    bool doCompetingClusters=true;  // this should always be done to get the correct alignment
-    if (m_redoErrorScaling) 
-      ATH_MSG_WARNING("error scaling not done properly for CSC hits yet!");
-
-    ATH_MSG_DEBUG("calling recalibrateHitsOnTrack");
-    Trk::Track* recalTrack=m_trackBuilder->recalibrateHitsOnTrack(*refitTrack,doMdts,
-								  doCompetingClusters);
-    if (!recalTrack) {
-      ATH_MSG_DEBUG("track recalibration failed");
-      delete refitTrack;
-      return 0;
-    }
-    
-    ATH_MSG_DEBUG("calling refit again");
-    const Trk::Track* finalRefitTrack=m_refitTool->refit(*recalTrack,&settings);
-    if (!finalRefitTrack || finalRefitTrack==recalTrack) {
-      ATH_MSG_DEBUG("final refit failed");
-      delete recalTrack;
-      return 0;
-    }
-    
-    ATH_MSG_DEBUG("returning finalRefitTrack");
-    return finalRefitTrack;
-  }
- 
-  //________________________________________________________________________
-  const Trk::Track* MuonAlignRefitTool::prepareHitsOnTrack(const Trk::Track& track)
-  {
-    ATH_MSG_DEBUG("in prepareHitsOnTrack");
-
-    const DataVector<const Trk::TrackStateOnSurface>* oldTSOS=track.trackStateOnSurfaces();
-    
-    DataVector<const Trk::TrackStateOnSurface>* trackStateOnSurfaces =
-      new DataVector<const Trk::TrackStateOnSurface>;
-    
-    std::set<Identifier> tgcLayerIds;
-    int nMdtMeas(0);
-
-    bool firstScat=true;
-    bool firstMeas=true;
-
-    // search first valid TSOS first
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=oldTSOS->begin(); 
-    for (iTsos=oldTSOS->begin(); iTsos!=oldTSOS->end(); ++iTsos) {
-      
-      // get measurement, continue if hit to be removed
-      const Trk::MeasurementBase*      mesb     = (*iTsos)->measurementOnTrack();
-      Trk::TrackState::MeasurementType measType = m_measTypeIdHelper->defineType(mesb);
-
-      ATH_MSG_VERBOSE("(before) measType="<<measType<<", type: "<<(*iTsos)->dumpType());
-
-	  
-      // removal of specific types of measurements
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement) &&
-	  ((measType==Trk::TrackState::TGC && m_removeTGCHits) ||
-	   (measType==Trk::TrackState::TRT && m_removeTRTHits) ||
-	   (measType==Trk::TrackState::CSC && m_removeCSCHits) )) continue;
-            
-      // decluster TGC hits
-      if (measType==Trk::TrackState::TGC && m_declusterTGCHits) {
-	
-	// loop over RIO in CRIO, create TSOS from each one
-	const Trk::MeasurementBase*             mesb       = (*iTsos)->measurementOnTrack();	
-	const Trk::CompetingRIOsOnTrack*        crio       = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-
-	// special case of TGC hit not in CompetingROT
-	if (!crio) { 
-	  ATH_MSG_DEBUG("TGC with no crio!"); 
-	  const Trk::RIO_OnTrack* rio=dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	  if (!rio) { ATH_MSG_ERROR("no crio or rio for TGC hit!"); continue; }
-	  const Trk::MeasurementBase*     meas=dynamic_cast<const Trk::MeasurementBase*>(rio)->clone();
-	  const Trk::TrackParameters*     tpar=(**iTsos).trackParameters()->clone();
-	  const Trk::FitQualityOnSurface* fqos=(**iTsos).fitQualityOnSurface() ? 
-	    new Trk::FitQualityOnSurface(*(**iTsos).fitQualityOnSurface()) : 0;	  
-
-
-	  // keep first scatterer, and remaining scatterers only if not removing scattering	  
-	  const Trk::MaterialEffectsBase* meb = 0;
-	  if ((**iTsos).materialEffectsOnTrack()) {
-	    meb = firstScat&&firstMeas ? (**iTsos).materialEffectsOnTrack()->clone() : materialEffects(**iTsos);
-	    firstScat=false;
-	  }
-	  ATH_MSG_DEBUG("meb: "<<meb);
-	  	  	  
-	  const Trk::TrackStateOnSurface* newTsos=
-	    new Trk::TrackStateOnSurface(meas,tpar,fqos,meb);
-	  
-	  trackStateOnSurfaces->push_back(newTsos);
-	  continue;
-	}
-	
-	// normal CompetingROT
-	for (unsigned int irio=0;irio<crio->numberOfContainedROTs();irio++) {
-	  const Trk::RIO_OnTrack* rio=&crio->rioOnTrack(irio);
-	  if (!rio) continue;
-	  Identifier layId = m_muonIdHelper->layerId(rio->identify());
-	  ATH_MSG_DEBUG("have ID "<<layId<<" for rioId "<<rio->identify());
-	  std::pair<std::set<Identifier>::iterator, bool> pr=tgcLayerIds.insert(layId);
-	  if (pr.second == false) continue;
-	  ATH_MSG_DEBUG("adding TGC RIO with rioId "<<rio->identify());
-	  
-	  // attach any material effects to first RIO
-	  const Trk::MeasurementBase*     meas=dynamic_cast<const Trk::MeasurementBase*>(rio)->clone();
-	  const Trk::TrackParameters*     tpar=(**iTsos).trackParameters()->clone();
-	  const Trk::FitQualityOnSurface* fqos=(**iTsos).fitQualityOnSurface() ? 
-	    new Trk::FitQualityOnSurface(*(**iTsos).fitQualityOnSurface()) : 0;
-	  const Trk::MaterialEffectsBase* meb =0;
-
-	  // keep first scatterer, and remaining scatterers only if not removing scattering
-	  if (irio==0) {
-	    if ((**iTsos).materialEffectsOnTrack()) {
-	      meb = firstScat&&firstMeas ? (**iTsos).materialEffectsOnTrack()->clone() : materialEffects(**iTsos);
-	      firstScat=false;
-	    }
-	  }
-	  ATH_MSG_DEBUG("meb: "<<meb);
-	
-	  const Trk::TrackStateOnSurface* newTsos=
-	    new Trk::TrackStateOnSurface(meas,tpar,fqos,meb);
-	  trackStateOnSurfaces->push_back(newTsos);
-	}	
-      }
-      
-      // remove bad CSC hits
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement) &&	  
-	  measType==Trk::TrackState::CSC && 
-	  (m_removeSpoiledCSCHits || m_removeCSCPhiHits)) {
-	
-	ATH_MSG_DEBUG("checking CSC hit");
-	
-	const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	if (rio) {
-	  const CscPrepData* csc_prp_data = dynamic_cast<const CscPrepData*>(rio);	
-	  if (csc_prp_data) {
-	    bool is_measphi_strip = m_muonIdHelper->cscIdHelper().measuresPhi(csc_prp_data->identify());
-	    if (is_measphi_strip&&m_removeCSCPhiHits) continue;                           
-	    if (!is_measphi_strip && 
-		csc_prp_data->status() != CscStatusUnspoiled &&
-		m_removeSpoiledCSCHits) {
-	      ATH_MSG_DEBUG("spoiled CSC hit");
-	      continue;
-	    }
-	  }
-	}
-      }
-      
-      // remove TGC and/or RPC eta hits
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement) &&
-	  ((measType==Trk::TrackState::TGC && m_removeTGCEtaHits) ||
-	   (measType==Trk::TrackState::RPC && m_removeRPCEtaHits))) {
-	
-	const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=&crio->rioOnTrack(0);
-	if (rio) {
-	  if (!m_muonIdHelper->measuresPhi(rio->identify())) continue;
-	}
-      }
-            
-      // removal of barrel or endcap-specific hits
-      if ( ( m_removeBarrelHits || m_removeEndcapHits || 
-	     m_removeSmallBarrelHits || 
-	     m_removeBIS8Hits || m_removeBEEHits || m_removeEEHits ) && 
-	   (*iTsos)->type(Trk::TrackStateOnSurface::Measurement) ) {
-	
-	const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();	
-	const Trk::RIO_OnTrack*           rio = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=&crio->rioOnTrack(0);
-	if (rio) {
-	  if (m_muonIdHelper->isMuon(rio->detectorElement()->identify())) { 
-	    if (!m_muonAlignHelperTool->isEndcap(rio->detectorElement()->identify())) { 
-
-	      // barrel hit, not BIS8
-	      if (!m_muonAlignHelperTool->isBIS8(rio->detectorElement()->identify())) { 
-		
-		if (m_removeBarrelHits) {
-		  ATH_MSG_VERBOSE("removing barrel muon hit");
-		  continue;
-		}
-		if (m_removeSmallBarrelHits) { 
-		  Identifier id=rio->detectorElement()->identify();
-		  const std::string stName=
-		    m_muonIdHelper->mdtIdHelper().stationNameString(m_muonIdHelper->mdtIdHelper().stationName(id));
-		  if (stName[2]!='L') {
-		    ATH_MSG_VERBOSE("removing small barrel hit");
-		    continue;
-		  }
-		}
-	      }
-
-	      // BIS8
-	      else {
-		ATH_MSG_DEBUG("have BIS8 hit");
-		if (m_removeBIS8Hits) {
-		  ATH_MSG_DEBUG("removing BIS8 muon hit");
-		  continue;
-		}
-	      }
-	    }
-	    else {
-	      if (m_removeEndcapHits) {
-		ATH_MSG_VERBOSE("removing endcap muon hit");
-		continue;
-	      }
-	    }
-	    
-	    ATH_MSG_VERBOSE("keeping hit in "
-			    << m_muonIdHelper->toStringGasGap(rio->identify()));
-	  }
-	  if (m_removeBEEHits||m_removeEEHits) {
-	    const std::string stName=
-	      m_muonIdHelper->mdtIdHelper().stationNameString(m_muonIdHelper->mdtIdHelper().stationName(rio->identify()));
-	    if (m_removeBEEHits && stName.substr(0,3)=="BEE") continue;
-	    if (m_removeEEHits  && stName.substr(0,2)=="EE") continue;
-	  }  
-	}
-      }
-      
-      // if MDT hit, increment nMdtMeas
-      if ((**iTsos).type(Trk::TrackStateOnSurface::Measurement) &&
-	  (measType==Trk::TrackState::MDT) &&
-	  !(**iTsos).type(Trk::TrackStateOnSurface::Outlier) &&
-	  !(**iTsos).type(Trk::TrackStateOnSurface::Hole)) nMdtMeas++;
-      
-      // have a good TSOS, create a new TSOS from old one
-      ATH_MSG_VERBOSE("cloning TSOS");
-
-      if ((**iTsos).type(Trk::TrackStateOnSurface::Measurement)) firstMeas=false;
-      
-      const Trk::TrackStateOnSurface* newTsos=0;
-      
-      if (!m_removeScattering) { 
-	newTsos = (**iTsos).clone();
-      }      
-      else {
-	const Trk::MeasurementBase*     mesb = (**iTsos).measurementOnTrack() ? (**iTsos).measurementOnTrack()->clone() : 0;
-	const Trk::TrackParameters*     tpar = (**iTsos).measurementOnTrack() ? (**iTsos).trackParameters()->clone() : 0;
-	const Trk::FitQualityOnSurface* fqos = (**iTsos).fitQualityOnSurface() ? 
-	  new Trk::FitQualityOnSurface(*(**iTsos).fitQualityOnSurface()) : 0;
-	
-	const Trk::MaterialEffectsBase* meb = 0;
-	  // keep first scatterer, and remaining scatterers only if not removing scattering
-	if ((**iTsos).materialEffectsOnTrack()) {
-	  meb = firstScat&&firstMeas ? (**iTsos).materialEffectsOnTrack()->clone() : materialEffects(**iTsos);
-	  if (!firstMeas) firstScat=false;
-	}
-	ATH_MSG_DEBUG("meb: "<<meb);
-
-	newTsos = new Trk::TrackStateOnSurface(mesb,tpar,fqos,meb);
-      }
-
-      if (newTsos) trackStateOnSurfaces->push_back(newTsos);      
-    }
-
-    // see if enough MDT hits remaining after removal
-    if (nMdtMeas<7) {
-      for (int i=0;i<(int)trackStateOnSurfaces->size();i++)
-	delete (*trackStateOnSurfaces)[i];
-      ATH_MSG_DEBUG("only "<<nMdtMeas<<" MDT hits, not making track");
-      return 0;
-    }
-    
-    // create new track with good TSOS
-    const Trk::Track* newTrack = new Trk::Track(Trk::TrackInfo(track.info()),
-                                                trackStateOnSurfaces,
-                                                track.fitQuality()->clone());
-    
-    ATH_MSG_DEBUG("created newTrack:");
-    ATH_MSG_DEBUG(m_printer->print(*newTrack)<<endmsg<<
-		  m_printer->printStations(*newTrack)<<endmsg);//<<
-
-    return newTrack;
-  }
-
-  //________________________________________________________________________
-  const Trk::MaterialEffectsBase* MuonAlignRefitTool::materialEffects(const Trk::TrackStateOnSurface& tsos) const
-  {
-    ATH_MSG_DEBUG("materialEffects");
-    bool cloneMEB=false;
-
-    const Trk::MaterialEffectsBase* meb  = tsos.materialEffectsOnTrack();
-
-    if (meb) {	    
-      
-      /*
-      if (m_removeScattering) {
-	// keep scattering only if in ID or calorimeter
-	Trk::GlobalPosition position =
-	  tsos.materialEffectsOnTrack()->associatedSurface().globalReferencePoint();
-	if (m_indetVolume->inside(position) || m_calVolume->inside(position)) 
-	  cloneMEB=true;
-	
-      }
-      else cloneMEB=true;
-      */
-      if (!m_removeScattering) cloneMEB=true;
-
-      // clone calorimeter energy loss
-      const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(meb);
-      if (meot && !meot->scatteringAngles()) cloneMEB=true;
-    }
-
-    return cloneMEB ? meb->clone() : 0;
-  }
-
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonFillNtupleTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonFillNtupleTool.cxx
deleted file mode 100644
index 821e73a82f0..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonFillNtupleTool.cxx
+++ /dev/null
@@ -1,1812 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-
-//#include "TrkTrackSummaryTool/TrackSummaryTool.h"
-//#include "TrkParameters/MeasuredPerigee.h"
-#include "TrkTrack/Track.h"
-#include "TrkMeasurementBase/MeasurementBase.h"
-#include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h"
-#include "TrkRIO_OnTrack/RIO_OnTrack.h"
-#include "TrkEventPrimitives/ResidualPull.h"
-
-#include "MuonIdHelpers/MuonIdHelperTool.h"
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "MuonIdHelpers/MdtIdHelper.h"
-#include "MuonIdHelpers/RpcIdHelper.h"
-#include "MuonIdHelpers/TgcIdHelper.h"
-#include "MuonIdHelpers/CscIdHelper.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/RpcReadoutElement.h"
-#include "MuonReadoutGeometry/TgcReadoutElement.h"
-#include "MuonCalibITools/IIdToFixedIdTool.h"
-#include "MuonCalibIdentifier/MuonFixedId.h"
-#include "TrkToolInterfaces/IResidualPullCalculator.h"
-#include "MuonRecHelperTools/MuonEDMHelperTool.h"
-//#include "MuonHistTools/MuonTrackHistTool.h"
-
-//for truth info
-#include "HepMC/GenEvent.h"
-#include "CLHEP/Vector/LorentzVector.h"
-#include "GeneratorObjects/McEventCollection.h"
-#include "TrackRecord/TrackRecordCollection.h"
-
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "TrkAlignEvent/AlignTSOS.h"
-#include "TrkAlignEvent/AlignTrack.h"
-#include "TrkAlignEvent/AlignPar.h"
-#include "TrkAlignInterfaces/IAlignModuleTool.h"
-#include "TrkSurfaces/StraightLineSurface.h"
-
-//#include "TrkAlignGenAlgs/AlignAlg.h"
-#include "MuonAlignGenTools/MuonFillNtupleTool.h"
-
-#include "muonEvent/MuonContainer.h"
-#include "Particle/TrackParticle.h"
-#include "MuonSegment/MuonSegment.h"
-
-#include "TFile.h"
-#include "TTree.h"
-#include "TMath.h"
-
-#include <iostream>
-
-using namespace std;
-
-namespace Muon {
-
-  //________________________________________________________________________
-  MuonFillNtupleTool::MuonFillNtupleTool(const std::string& type,
-					 const std::string& name,
-					 const IInterface* parent)
-    : AthAlgTool(type,name,parent)
-      // , m_trackSumTool("Trk::TrackSummaryTool", this)
-      //    , m_trackHistTool("Muon::MuonTrackHistTool/MuonTrackHistTool")
-    , m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator")
-    , m_idTool("MuonCalib::IdToFixedIdTool")
-    , m_alignModuleTool("Muon::MuonAlignModuleTool")
-    , m_muonIdHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool")
-    , p_muonMgr(0)
-    , p_MdtIdHelper(0)
-    , p_CscIdHelper(0)
-    , p_RpcIdHelper(0)
-    , p_TgcIdHelper(0)
-    , m_ntuple(0)
-    , m_tree(0)
-    , m_max_nchambers(10)
-    , m_totaltrks(0)
-    , m_totalhits(0)
-    , m_max_hits(100)
-    , m_csc_nMaxHits(40)
-    , m_storeGate(0)
-    , m_chi2VAlignParamQuality(new double[6])  
-  {
-
-    declareInterface<Trk::IFillNtupleTool>(this);
-  
-    declareProperty("AlignModuleTool",        m_alignModuleTool);
-    declareProperty("ResidualPullCalculator", m_pullCalculator);
-    declareProperty("MuonIdHelperTool",            m_muonIdHelperTool);
-    //declareProperty("MuonContainer",          m_muonContainer="");
-    declareProperty("SegmentCollectionName",    m_segmentcollName="MooreSegments");
-    //declareProperty("BigNtuple",              m_bigNtuple=false);
-    /*
-    m_csc_eta_hit_residual= new double[m_csc_nMaxHits];
-    m_csc_phi_hit_residual= new double[m_csc_nMaxHits];  
-    m_csc_eta_hit_error= new double[m_csc_nMaxHits]; 
-    m_csc_phi_hit_error= new double[m_csc_nMaxHits];  
-    m_csc_eta_hit_layer=new int[m_csc_nMaxHits];
-    m_csc_phi_hit_layer=new int[m_csc_nMaxHits];
-    m_csc_eta_hit_sector=new int[m_csc_nMaxHits]; 
-    m_csc_phi_hit_sector=new int[m_csc_nMaxHits];
-    */
-
-    //  declareProperty("TrackSummaryTool",m_trackSumTool,
-    //	  "tool to extract track info");
-  
-    m_hit_statname=new int[m_max_hits];
-    m_hit_stateta =new int[m_max_hits];
-    m_hit_statphi =new int[m_max_hits];
-    m_hit_statreg =new int[m_max_hits];
-    m_hit_tech    =new int[m_max_hits];
-    m_hit_dtyp    =new int[m_max_hits];
-
-    m_hit_fixedid =new int[m_max_hits];
-    m_hit_fixedstatname=new int[m_max_hits];
-
-    m_hit_dblr    =new double[m_max_hits];
-    m_hit_dblz    =new double[m_max_hits];
-    m_hit_dblp    =new double[m_max_hits];
-
-    m_hit_ggap    =new int[m_max_hits];
-    m_hit_strp    =new int[m_max_hits];
-    m_hit_chnl    =new int[m_max_hits];
-    m_hit_clyr    =new int[m_max_hits];
-    m_hit_wlyr    =new int[m_max_hits];
-    m_hit_mlyr    =new int[m_max_hits];
-    m_hit_tlyr    =new int[m_max_hits];
-    m_hit_tube    =new int[m_max_hits];
-    m_hit_rho     =new double[m_max_hits];
-    m_hit_phi     =new double[m_max_hits];
-    m_hit_z       =new double[m_max_hits];
-    m_hit_cotth   =new double[m_max_hits];
-    m_hit_eta     =new double[m_max_hits];
-    m_hit_xloc    =new double[m_max_hits];
-    m_hit_yloc    =new double[m_max_hits];
-    m_hit_zloc    =new double[m_max_hits];
-    m_hit_drd     =new double[m_max_hits];
-    m_hit_sig     =new double[m_max_hits];
-    m_hit_res     =new double[m_max_hits];
-    m_hit_tpar    =new double[m_max_hits];
-    m_hit_x0      =new int[m_max_hits];
-    m_hit_t0_x    =new double[m_max_hits];
-    m_hit_t0_y    =new double[m_max_hits];
-    m_hit_t0_z    =new double[m_max_hits];
-    m_hit_t1_x    =new double[m_max_hits];
-    m_hit_t1_y    =new double[m_max_hits];
-    m_hit_t1_z    =new double[m_max_hits];
-    m_hit_t2_x    =new double[m_max_hits];
-    m_hit_t2_y    =new double[m_max_hits];
-    m_hit_t2_z    =new double[m_max_hits];
-
-    //m_hit_type      =new double[m_max_hits];
-    /*
-      m_hit_deriv_transx =new double[m_max_hits];
-      m_hit_deriv_transy =new double[m_max_hits];
-      m_hit_deriv_transz =new double[m_max_hits];
-      m_hit_deriv_rotx   =new double[m_max_hits];
-      m_hit_deriv_roty   =new double[m_max_hits];
-      m_hit_deriv_rotz   =new double[m_max_hits];
-    */
-
-    m_chi2_transx = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transy = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transz = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotx   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_roty   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotz   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transx_X = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transy_X = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transz_X = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotx_X   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_roty_X   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotz_X   = new TMatrixD(1,m_max_nchambers);
-    //mdt
-    m_chi2_transx_mdt = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transy_mdt = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transz_mdt = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotx_mdt   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_roty_mdt   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotz_mdt   = new TMatrixD(1,m_max_nchambers);
-    //tgc
-    m_chi2_transx_tgc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transy_tgc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transz_tgc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotx_tgc   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_roty_tgc   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotz_tgc   = new TMatrixD(1,m_max_nchambers);
-    //rpc
-    m_chi2_transx_rpc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transy_rpc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transz_rpc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotx_rpc   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_roty_rpc   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotz_rpc   = new TMatrixD(1,m_max_nchambers);
-    //csc
-    m_chi2_transx_csc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transy_csc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transz_csc = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotx_csc   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_roty_csc   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotz_csc   = new TMatrixD(1,m_max_nchambers);
-    //id
-    m_chi2_transx_id = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transy_id = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transz_id = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotx_id   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_roty_id   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotz_id   = new TMatrixD(1,m_max_nchambers);
-    //scat
-    m_chi2_transx_scat = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transy_scat = new TMatrixD(1,m_max_nchambers);
-    m_chi2_transz_scat = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotx_scat   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_roty_scat   = new TMatrixD(1,m_max_nchambers);
-    m_chi2_rotz_scat   = new TMatrixD(1,m_max_nchambers);
-
-
-    m_chamberid       = new long long int[m_max_nchambers];
-    m_chamberstatname = new long long int[m_max_nchambers];
-    m_transx          = new double[m_max_nchambers];
-    m_transy          = new double[m_max_nchambers];
-    m_transz          = new double[m_max_nchambers];
-    m_rotx            = new double[m_max_nchambers];
-    m_roty            = new double[m_max_nchambers];
-    m_rotz            = new double[m_max_nchambers];
-  }
-
-  //________________________________________________________________________
-  MuonFillNtupleTool::~MuonFillNtupleTool()
-  { 
-    ATH_MSG_DEBUG("in destructor of MuonFillNtupleTool");
-    /*
-    delete [] m_csc_eta_hit_residual;
-    delete [] m_csc_phi_hit_residual;
-    delete [] m_csc_eta_hit_error;
-    delete [] m_csc_phi_hit_error;
-    delete []  m_csc_eta_hit_layer;
-    delete []  m_csc_phi_hit_layer;
-    delete []  m_csc_eta_hit_sector;
-    delete []  m_csc_phi_hit_sector;
-    */
-    delete [] m_chi2VAlignParamQuality;
-
-    delete [] m_hit_statname;
-    delete [] m_hit_stateta;
-    delete [] m_hit_statphi;
-    delete [] m_hit_statreg;
-    delete [] m_hit_tech;
-    delete [] m_hit_dtyp;
-
-    delete [] m_hit_fixedstatname;
-    delete [] m_hit_fixedid;
-
-    delete [] m_hit_dblr;
-    delete [] m_hit_dblz;
-    delete [] m_hit_dblp;
-
-    delete [] m_hit_ggap;
-    delete [] m_hit_strp;
-    delete [] m_hit_chnl;
-    delete [] m_hit_clyr;
-    delete [] m_hit_wlyr;
-    delete [] m_hit_mlyr;
-    delete [] m_hit_tlyr;
-    delete [] m_hit_tube;
-    delete [] m_hit_rho;
-    delete [] m_hit_phi;
-    delete [] m_hit_z;
-    delete [] m_hit_cotth;
-    delete [] m_hit_eta;
-    delete [] m_hit_xloc;
-    delete [] m_hit_yloc;
-    delete [] m_hit_zloc;
-    delete [] m_hit_drd;
-    delete [] m_hit_sig;
-    delete [] m_hit_res;
-    delete [] m_hit_tpar;
-    delete [] m_hit_x0;
-    delete [] m_hit_t0_x;
-    delete [] m_hit_t0_y;
-    delete [] m_hit_t0_z;
-    delete [] m_hit_t1_x;
-    delete [] m_hit_t1_y;
-    delete [] m_hit_t1_z;
-    delete [] m_hit_t2_x;
-    delete [] m_hit_t2_y;
-    delete [] m_hit_t2_z;
-
-    //delete [] m_hit_type;
-
-    /*
-      delete [] m_hit_deriv_transx;
-      delete [] m_hit_deriv_transy;
-      delete [] m_hit_deriv_transz;
-      delete [] m_hit_deriv_rotx;
-      delete [] m_hit_deriv_roty;
-      delete [] m_hit_deriv_rotz;
-    */
-
-    delete m_chi2_transx;
-    delete m_chi2_transy;
-    delete m_chi2_transz;
-    delete m_chi2_rotx;
-    delete m_chi2_roty;
-    delete m_chi2_rotz;
-    delete m_chi2_transx_X;
-    delete m_chi2_transy_X;
-    delete m_chi2_transz_X;
-    delete m_chi2_rotx_X;
-    delete m_chi2_roty_X;
-    delete m_chi2_rotz_X;
-    //mdt
-    delete m_chi2_transx_mdt;
-    delete m_chi2_transy_mdt;
-    delete m_chi2_transz_mdt;
-    delete m_chi2_rotx_mdt;
-    delete m_chi2_roty_mdt;
-    delete m_chi2_rotz_mdt;
-    //tgc
-    delete m_chi2_transx_tgc;
-    delete m_chi2_transy_tgc;
-    delete m_chi2_transz_tgc;
-    delete m_chi2_rotx_tgc;
-    delete m_chi2_roty_tgc;
-    delete m_chi2_rotz_tgc;
-    //rpc
-    delete m_chi2_transx_rpc;
-    delete m_chi2_transy_rpc;
-    delete m_chi2_transz_rpc;
-    delete m_chi2_rotx_rpc;
-    delete m_chi2_roty_rpc;
-    delete m_chi2_rotz_rpc;
-    //csc
-    delete m_chi2_transx_csc;
-    delete m_chi2_transy_csc;
-    delete m_chi2_transz_csc;
-    delete m_chi2_rotx_csc;
-    delete m_chi2_roty_csc;
-    delete m_chi2_rotz_csc;
-    //id
-    delete m_chi2_transx_id;
-    delete m_chi2_transy_id;
-    delete m_chi2_transz_id;
-    delete m_chi2_rotx_id;
-    delete m_chi2_roty_id;
-    delete m_chi2_rotz_id;
-    //scat
-    delete m_chi2_transx_scat;
-    delete m_chi2_transy_scat;
-    delete m_chi2_transz_scat;
-    delete m_chi2_rotx_scat;
-    delete m_chi2_roty_scat;
-    delete m_chi2_rotz_scat;
-
-    delete [] m_chamberid;
-    delete [] m_chamberstatname;
-    delete [] m_transx;
-    delete [] m_transy;
-    delete [] m_transz;
-    delete [] m_rotx;
-    delete [] m_roty;
-    delete [] m_rotz;
-
-  }
-  //________________________________________________________________________
-  StatusCode MuonFillNtupleTool::initialize() 
-  {
-
-    ATH_MSG_DEBUG("initialize() of MuonFillNtupleTool");
-
-    // set up MuonIdHelperTool
-    if (m_muonIdHelperTool.retrieve().isSuccess()) 
-      ATH_MSG_INFO("Retrieved  "<<m_muonIdHelperTool);
-    else {
-      ATH_MSG_FATAL("Could not get MuonIdHelperTool!");
-      return StatusCode::FAILURE;
-    }    
-
-
-    // get TrackSummaryTool
-    /*if ( m_trackSumTool.retrieve().isFailure() ) {
-      ATH_MSG_FATAL("Failed to retrieve tool " << m_trackSumTool);
-      return StatusCode::FAILURE;
-      } 
-      else
-      ATH_MSG_INFO("Retrieved tool " << m_trackSumTool);
-    */
-
-    // check StoreGate service available
-    if (StatusCode::SUCCESS != service("StoreGateSvc", m_storeGate)) {
-      ATH_MSG_FATAL("StoreGate service not found");
-      return StatusCode::FAILURE;
-    }
-  
-    // if ( m_trackHistTool.retrieve().isFailure() ) {
-    //   ATH_MSG_FATAL("Could not get " << m_trackHistTool);
-    //   return StatusCode::FAILURE;
-    // }
-    // else
-    //   ATH_MSG_INFO("Retrieved " << m_trackHistTool);
-
-    if (m_pullCalculator.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_pullCalculator);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_pullCalculator);
-      return StatusCode::FAILURE;
-    }
-    /*
-    if (m_helperTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_helperTool);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_helperTool); 
-      return StatusCode::FAILURE;
-    }
-    */
-    if (m_idTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_idTool);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_idTool ); 
-      return StatusCode::FAILURE;
-    }
-
-    StoreGateSvc* detStore=0;
-    if ( (serviceLocator()->service("DetectorStore", detStore)).isSuccess() ) {
-      if ( detStore->retrieve( p_muonMgr ).isSuccess() ) {
-	p_MdtIdHelper = p_muonMgr->mdtIdHelper();
-	p_CscIdHelper = p_muonMgr->cscIdHelper();
-	p_RpcIdHelper = p_muonMgr->rpcIdHelper();
-	p_TgcIdHelper = p_muonMgr->tgcIdHelper();
-      } 
-      else 
-	ATH_MSG_ERROR( "Cannot retrieve MuonDetDescrMgr " );    
-    } 
-    else 
-      ATH_MSG_ERROR( "MuonDetDescrMgr not found in DetectorStore " );
-     
-    if (m_alignModuleTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_alignModuleTool ); 
-    else{
-      ATH_MSG_FATAL("Could not get " << m_alignModuleTool ); 
-      return StatusCode::FAILURE;
-    }
-  
-    //initialize variables to be written in ntuple
-    for(int i = 0; i<m_max_hits ; i++) {
-      m_hit_statname[i] = -999;
-      m_hit_stateta[i]  = -999;
-      m_hit_statphi[i]  = -999;
-      m_hit_statreg[i]  = -999;
-      m_hit_tech[i]     = -999;
-      m_hit_dtyp[i]     = -999;
-    
-      m_hit_fixedid[i]  = -999;
-      m_hit_fixedstatname[i] = -999;
-    
-      m_hit_dblr[i]     = -999.;
-      m_hit_dblz[i]     = -999.;
-      m_hit_dblp[i]     = -999.;
-     
-      m_hit_ggap[i]     = -999;
-      m_hit_strp[i]     = -999;
-      m_hit_chnl[i]     = -999;
-      m_hit_clyr[i]     = -999;
-      m_hit_wlyr[i]     = -999;
-      m_hit_mlyr[i]     = -999;
-      m_hit_tlyr[i]     = -999;
-      m_hit_tube[i]     = -999;
-      m_hit_rho[i]      = -999.;
-      m_hit_phi[i]      = -999.;
-      m_hit_z[i]        = -999.;
-      m_hit_cotth[i]    = -999.;
-      m_hit_eta[i]      = -999.;
-      m_hit_xloc[i]     = -999.;
-      m_hit_yloc[i]     = -999.;
-      m_hit_zloc[i]     = -999.;
-      m_hit_drd[i]      = -999.;
-      m_hit_sig[i]      = -999.;
-      m_hit_res[i]      = -999.;
-      m_hit_tpar[i]     = -999.;
-      m_hit_x0[i]       = -999;
-      m_hit_t0_x[i] = -999;
-      m_hit_t0_y[i] = -999;
-      m_hit_t0_z[i] = -999;
-      m_hit_t1_x[i] = -999;
-      m_hit_t1_y[i] = -999;
-      m_hit_t1_z[i] = -999;
-      m_hit_t2_x[i] = -999;
-      m_hit_t2_y[i] = -999;
-      m_hit_t2_z[i] = -999;
-
-      //m_hit_type[i] = -999;
-
-      /*
-	m_hit_deriv_transx[i] = -999.;
-	m_hit_deriv_transy[i] = -999.;
-	m_hit_deriv_transz[i] = -999.;
-	m_hit_deriv_rotx[i]   = -999.;
-	m_hit_deriv_roty[i]   = -999.;
-	m_hit_deriv_rotz[i]   = -999.;
-      */
-
-    }
-
-    return StatusCode::SUCCESS;
-
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonFillNtupleTool::fillNtuple()
-  {
-    ATH_MSG_DEBUG("in fillNtuple");
-    if (m_ntuple && m_tree) {
-      m_ntuple->cd();
-      ATH_MSG_DEBUG("writing tree");
-      m_tree->Write();
-      ATH_MSG_DEBUG("done");
-    }
-    return StatusCode::SUCCESS;
-  }
-  
-  //________________________________________________________________________
-  StatusCode MuonFillNtupleTool::finalize() 
-  {
-
-    ATH_MSG_DEBUG("finalize() of MuonFillNtupleTool");
- 
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  void MuonFillNtupleTool::dumpTrack(int /*itrk*/, const Trk::AlignTrack* /*alignTrack*/) 
-  {
-    ATH_MSG_ERROR("migrate MuonFillNtupleTool::dumpTrack to Eigen");
-    return;
-
-    /*
-    ATH_MSG_DEBUG("In processTrack()");
-
-    if (!m_tree && m_ntuple) {
-      m_ntuple->cd();
-      m_tree = new TTree("MuonAlign", "Muon Alignment Ntuple");
-      
-      m_tree->Branch("run",            &m_runNumber, "run/I");
-      m_tree->Branch("evt",            &m_evtNumber, "evt/I");
-      m_tree->Branch("nMuonOutliers",  &m_nMuonOutliers, "nMuonOutliers/I");
-      m_tree->Branch("nTgcOutliers",   &m_nTgcOutliers,  "nTgcOutliers/I");
-
-      m_tree->Branch("CscNumPhiHits",    &m_csc_nphihits,         "CscNumPhiHits/I");
-      m_tree->Branch("CscPhiResidual",    m_csc_phi_hit_residual, "CscPhiResidual[CscNumPhiHits]/D");
-      m_tree->Branch("CscPhiError",       m_csc_phi_hit_error,    "CscPhiError[CscNumPhiHits]/D");
-      m_tree->Branch("CscPhiLayer",       m_csc_phi_hit_layer,    "CscPhiLayer[CscNumPhiHits]/I");
-      m_tree->Branch("CscPhiSector",      m_csc_phi_hit_sector,   "CscPhiSector[CscNumPhiHits]/I");
-      m_tree->Branch("CscNumEtaHits",    &m_csc_netahits,         "CscNumEtaHits/I");
-      m_tree->Branch("CscEtaResidual",    m_csc_eta_hit_residual, "CscEtaResidual[CscNumEtaHits]/D");
-      m_tree->Branch("CscEtaError",       m_csc_eta_hit_error,    "CscEtaError[CscNumEtaHits]/D");
-      m_tree->Branch("CscEtaLayer",       m_csc_eta_hit_layer,    "CscEtaLayer[CscNumEtaHits]/I");
-      m_tree->Branch("CscEtaSector",      m_csc_eta_hit_sector,   "CscEtaSector[CscNumEtaHits]/I");
-      m_tree->Branch("CscAvgPhiResidual",&m_csc_phi_avg_residual, "CscAvgPhiResidual/D");
-      m_tree->Branch("CscAvgPhiError",   &m_csc_phi_avg_error,    "CscAvgPhiError/D");
-      m_tree->Branch("CscAvgEtaResidual",&m_csc_eta_avg_residual, "CscAvgEtaResidual/D");
-      m_tree->Branch("CscAvgEtaError",   &m_csc_eta_avg_error,    "CscAvgEtaError/D");
-      m_tree->Branch("MuonSagitta",      &m_muon_track_sagitta,   "MuonSagitta/D");
-
-
-      if (m_bigNtuple) {
-	m_tree->Branch("etah",       &m_etah, "etah/I");
-	m_tree->Branch("phih",       &m_phih, "phih/I");
-	m_tree->Branch("mdth",       &m_mdth, "mdth/I");
-	m_tree->Branch("cscetah",    &m_cscetah, "cscetah/I");
-	m_tree->Branch("cscphih",    &m_cscphih, "cscphih/I");
-	m_tree->Branch("rpcetah",    &m_rpcetah, "rpcetah/I");
-	m_tree->Branch("rpcphih",    &m_rpcphih, "rpcphih/I");
-	m_tree->Branch("tgcetah",    &m_tgcetah, "tgcetah/I");
-	m_tree->Branch("tgcphih",    &m_tgcphih, "tgcphih/I");
-	m_tree->Branch("stati",      &m_stati, "stati/I");
-	m_tree->Branch("statr",      &m_statr, "statr/I");
-    
-	m_tree->Branch("xvtxr",      &m_xvtxr, "xvtxr/D");
-	m_tree->Branch("yvtxr",      &m_yvtxr, "yvtxr/D");
-	m_tree->Branch("zvtxr",      &m_zvtxr, "zvtxr/D");
-	m_tree->Branch("a0r",        &m_a0r, "a0r/D");
-	m_tree->Branch("z0r",        &m_z0r, "z0r/D");
-	m_tree->Branch("phir",       &m_phir, "phir/D");
-	m_tree->Branch("cotthr",     &m_cotthr, "cotthr/D");
-	m_tree->Branch("ptir",       &m_ptir, "ptir/D");
-	m_tree->Branch("etar",       &m_etar, "etar/D");
-	m_tree->Branch("chi2",       &m_chi2, "chi2/D");
-	m_tree->Branch("chi2pr",     &m_chi2pr, "chi2pr/D");
-	m_tree->Branch("vertexx",    &m_vertexx, "vertexx/D");
-	m_tree->Branch("vertexy",    &m_vertexy, "vertexy/D");
-	m_tree->Branch("vertexz",    &m_vertexz, "vertexz/D");
-    
-	m_tree->Branch("covr11",     &m_covr11, "covr11/D");
-	m_tree->Branch("covr12",     &m_covr12, "covr12/D");
-	m_tree->Branch("covr22",     &m_covr22, "covr22/D");
-	m_tree->Branch("covr13",     &m_covr13, "covr13/D");
-	m_tree->Branch("covr23",     &m_covr23, "covr23/D");
-	m_tree->Branch("covr33",     &m_covr33, "covr33/D");
-	m_tree->Branch("covr14",     &m_covr14, "covr14/D");
-	m_tree->Branch("covr24",     &m_covr24, "covr24/D");
-	m_tree->Branch("covr34",     &m_covr34, "covr34/D");
-	m_tree->Branch("covr44",     &m_covr44, "covr44/D");
-	m_tree->Branch("covr15",     &m_covr15, "covr15/D");
-	m_tree->Branch("covr25",     &m_covr25, "covr25/D");
-	m_tree->Branch("covr35",     &m_covr35, "covr35/D");
-	m_tree->Branch("covr45",     &m_covr45, "covr45/D");
-	m_tree->Branch("covr55",     &m_covr55, "covr55/D");
-			       
-	m_tree->Branch("nhits",      &m_nhits,       "nhits/I");
-	m_tree->Branch("statname",    m_hit_statname,"statname[nhits]/I");
-	m_tree->Branch("stateta",     m_hit_stateta, "stateta[nhits]/I");
-	m_tree->Branch("statphi",     m_hit_statphi, "statphi[nhits]/I");
-    
-	m_tree->Branch("statreg",     m_hit_statreg, "statreg[nhits]/I");
-	m_tree->Branch("tech",        m_hit_tech,    "tech[nhits]/I");
-	m_tree->Branch("dtyp",        m_hit_dtyp,    "dtyp[nhits]/I");
-    
-	m_tree->Branch("fixedstatname", m_hit_fixedstatname,"fixedstatname[nhits]/I");
-	m_tree->Branch("fixedid",     m_hit_fixedid, "fixedid[nhits]/I");
-    
-	m_tree->Branch("dblr",        m_hit_dblr,    "dblr[nhits]/D");
-	m_tree->Branch("dblz",        m_hit_dblz,    "dblz[nhits]/D");
-	m_tree->Branch("dblp",        m_hit_dblp,    "dblp[nhits]/D");
-    
-	m_tree->Branch("ggap",        m_hit_ggap,    "ggap[nhits]/I");
-	m_tree->Branch("strp",        m_hit_strp,    "strp[nhits]/I");
-	m_tree->Branch("chnl",        m_hit_chnl,    "chnl[nhits]/I");
-	m_tree->Branch("clyr",        m_hit_clyr,    "clyr[nhits]/I");
-	m_tree->Branch("wlyr",        m_hit_wlyr,    "wlyr[nhits]/I");
-	m_tree->Branch("mlyr",        m_hit_mlyr,    "mlyr[nhits]/I");
-	m_tree->Branch("tlyr",        m_hit_tlyr,    "tlyr[nhits]/I");
-	m_tree->Branch("tube",        m_hit_tube,    "tube[nhits]/I");
-    
-	m_tree->Branch("rho",         m_hit_rho,     "rho[nhits]/D");
-	m_tree->Branch("phi",         m_hit_phi,     "phi[nhits]/D");
-	m_tree->Branch("z",           m_hit_z,       "z[nhits]/D");
-	m_tree->Branch("cotth",       m_hit_cotth,   "cotth[nhits]/D");
-	m_tree->Branch("eta",         m_hit_eta,     "eta[nhits]/D");
-	m_tree->Branch("xloc",        m_hit_xloc,    "xloc[nhits]/D");
-	m_tree->Branch("yloc",        m_hit_yloc,    "yloc[nhits]/D");
-	m_tree->Branch("zloc",        m_hit_zloc,    "zloc[nhits]/D");
-	m_tree->Branch("drd",         m_hit_drd,     "drd[nhits]/D");
-	m_tree->Branch("sig",         m_hit_sig,     "sig[nhits]/D");
-	m_tree->Branch("res",         m_hit_res,     "res[nhits]/D");
-	m_tree->Branch("tpar",        m_hit_tpar,    "tpar[nhits]/D");
-	m_tree->Branch("x0",          m_hit_x0,      "x0[nhits]/I");  
-	m_tree->Branch("t0_xglob",    m_hit_t0_x,    "t0_xglob[nhits]/D");
-	m_tree->Branch("t0_yglob",    m_hit_t0_y,    "t0_yglob[nhits]/D");
-	m_tree->Branch("t0_zglob",    m_hit_t0_z,    "t0_zglob[nhits]/D");
-	m_tree->Branch("t1_xglob",    m_hit_t1_x,    "t1_xglob[nhits]/D");
-	m_tree->Branch("t1_yglob",    m_hit_t1_y,    "t1_yglob[nhits]/D");
-	m_tree->Branch("t1_zglob",    m_hit_t1_z,    "t1_zglob[nhits]/D");
-	m_tree->Branch("t2_xglob",    m_hit_t2_x,    "t2_xglob[nhits]/D");
-	m_tree->Branch("t2_yglob",    m_hit_t2_y,    "t2_yglob[nhits]/D");
-	m_tree->Branch("t2_zglob",    m_hit_t2_z,    "t2_zglob[nhits]/D");
-    
-	//m_tree->Branch("type",        m_hit_type,    "type[nhits]/I");
-      }
-
-      
-	// m_tree->Branch("deriv_transx", m_hit_deriv_transx, "deriv_transx[nhits]/D");
-	// m_tree->Branch("deriv_transy", m_hit_deriv_transy, "deriv_transy[nhits]/D");
-	// m_tree->Branch("deriv_transz", m_hit_deriv_transz, "deriv_transz[nhits]/D");
-	// m_tree->Branch("deriv_rotx",   m_hit_deriv_rotx,   "deriv_rotx[nhits]/D");
-	// m_tree->Branch("deriv_roty",   m_hit_deriv_roty,   "deriv_roty[nhits]/D");
-	// m_tree->Branch("deriv_rotz",   m_hit_deriv_rotz,   "deriv_rotz[nhits]/D");
-      
-
-      //stringstream brname; brname<<"["<<m_nshifts+1<<"][nchambers]/D";
-      m_tree->Branch("nchambers",     &m_nchambers,      "nchambers/I");
-      m_tree->Branch("chamberid",      m_chamberid,      "chamberid[nchambers]/L");
-      m_tree->Branch("chamberstatname",m_chamberstatname,"chamberstatname[nchambers]/L");
-      m_tree->Branch("transx",         m_transx,  "transx[nchambers]/D");
-      m_tree->Branch("transy",         m_transy,  "transy[nchambers]/D");
-      m_tree->Branch("transz",         m_transz,  "transz[nchambers]/D");
-      m_tree->Branch("rotx",           m_rotx,    "rotx[nchambers]/D");
-      m_tree->Branch("roty",           m_roty,    "roty[nchambers]/D");
-      m_tree->Branch("rotz",           m_rotz,    "rotz[nchambers]/D");
-
-      m_tree->Branch("chi2_transx",  &m_chi2_transx);
-      m_tree->Branch("chi2_transy",  &m_chi2_transy);
-      m_tree->Branch("chi2_transz",  &m_chi2_transz);
-      m_tree->Branch("chi2_rotx",    &m_chi2_rotx);  
-      m_tree->Branch("chi2_roty",    &m_chi2_roty);  
-      m_tree->Branch("chi2_rotz",    &m_chi2_rotz);
-      m_tree->Branch("chi2_transx_X",  &m_chi2_transx_X);
-      m_tree->Branch("chi2_transy_X",  &m_chi2_transy_X);
-      m_tree->Branch("chi2_transz_X",  &m_chi2_transz_X);
-      m_tree->Branch("chi2_rotx_X",    &m_chi2_rotx_X);  
-      m_tree->Branch("chi2_roty_X",    &m_chi2_roty_X);  
-      m_tree->Branch("chi2_rotz_X",    &m_chi2_rotz_X);  
-      m_tree->Branch("chi2VAlignParamQuality", m_chi2VAlignParamQuality, "chi2VAlignParamQuality[6]/D");
-  
-      if (m_bigNtuple) {
-	//mdt
-	m_tree->Branch("chi2_transx_mdt",  &m_chi2_transx_mdt);
-	m_tree->Branch("chi2_transy_mdt",  &m_chi2_transy_mdt);
-	m_tree->Branch("chi2_transz_mdt",  &m_chi2_transz_mdt);
-	m_tree->Branch("chi2_rotx_mdt",    &m_chi2_rotx_mdt);  
-	m_tree->Branch("chi2_roty_mdt",    &m_chi2_roty_mdt);  
-	m_tree->Branch("chi2_rotz_mdt",    &m_chi2_rotz_mdt);
-	//tgc
-	m_tree->Branch("chi2_transx_tgc",  &m_chi2_transx_tgc);
-	m_tree->Branch("chi2_transy_tgc",  &m_chi2_transy_tgc);
-	m_tree->Branch("chi2_transz_tgc",  &m_chi2_transz_tgc);
-	m_tree->Branch("chi2_rotx_tgc",    &m_chi2_rotx_tgc);  
-	m_tree->Branch("chi2_roty_tgc",    &m_chi2_roty_tgc);  
-	m_tree->Branch("chi2_rotz_tgc",    &m_chi2_rotz_tgc);
-	//rpc
-	m_tree->Branch("chi2_transx_rpc",  &m_chi2_transx_rpc);
-	m_tree->Branch("chi2_transy_rpc",  &m_chi2_transy_rpc);
-	m_tree->Branch("chi2_transz_rpc",  &m_chi2_transz_rpc);
-	m_tree->Branch("chi2_rotx_rpc",    &m_chi2_rotx_rpc);  
-	m_tree->Branch("chi2_roty_rpc",    &m_chi2_roty_rpc);  
-	m_tree->Branch("chi2_rotz_rpc",    &m_chi2_rotz_rpc);
-	//csc
-	m_tree->Branch("chi2_transx_csc",  &m_chi2_transx_csc);
-	m_tree->Branch("chi2_transy_csc",  &m_chi2_transy_csc);
-	m_tree->Branch("chi2_transz_csc",  &m_chi2_transz_csc);
-	m_tree->Branch("chi2_rotx_csc",    &m_chi2_rotx_csc);  
-	m_tree->Branch("chi2_roty_csc",    &m_chi2_roty_csc);  
-	m_tree->Branch("chi2_rotz_csc",    &m_chi2_rotz_csc);
-	//id
-	m_tree->Branch("chi2_transx_id",  &m_chi2_transx_id);
-	m_tree->Branch("chi2_transy_id",  &m_chi2_transy_id);
-	m_tree->Branch("chi2_transz_id",  &m_chi2_transz_id);
-	m_tree->Branch("chi2_rotx_id",    &m_chi2_rotx_id);  
-	m_tree->Branch("chi2_roty_id",    &m_chi2_roty_id);  
-	m_tree->Branch("chi2_rotz_id",    &m_chi2_rotz_id);
-	//scat
-	m_tree->Branch("chi2_transx_scat",  &m_chi2_transx_scat);
-	m_tree->Branch("chi2_transy_scat",  &m_chi2_transy_scat);
-	m_tree->Branch("chi2_transz_scat",  &m_chi2_transz_scat);
-	m_tree->Branch("chi2_rotx_scat",    &m_chi2_rotx_scat);  
-	m_tree->Branch("chi2_roty_scat",    &m_chi2_roty_scat);  
-	m_tree->Branch("chi2_rotz_scat",    &m_chi2_rotz_scat);
-  
-	m_tree->Branch("trackChi2",      &m_trackChi2,      "trackChi2/D");
-	m_tree->Branch("trackChi2Dof",   &m_trackChi2Dof,   "trackChi2Dof/D");
-	m_tree->Branch("idTrackChi2",    &m_idTrackChi2,    "idTrackChi2/D");
-	m_tree->Branch("idTrackChi2Dof", &m_idTrackChi2Dof, "idTrackChi2Dof/D");
-	m_tree->Branch("msTrackChi2",    &m_msTrackChi2,    "msTrackChi2/D");
-	m_tree->Branch("msTrackChi2Dof", &m_msTrackChi2Dof, "msTrackChi2Dof/D");
-	m_tree->Branch("trackEta",       &m_trackEta,       "trackEta/D");
-	m_tree->Branch("energyLoss",     &m_energyLoss,     "energyLoss/D");
-	m_tree->Branch("nSctHits",       &m_nSctHits,       "nSctHits/I");
-	m_tree->Branch("nPixHits",       &m_nPixHits,       "nPixHits/I");
-	m_tree->Branch("nTrtHits",       &m_nTrtHits,       "nTrtHits/I");
-	m_tree->Branch("msidPtDiff",     &m_msidPtDiff,     "msidPtDiff/D");
-	m_tree->Branch("idPtAtIP",       &m_idPtAtIP,        "idPtAtIP/D");
-	m_tree->Branch("idZ0AtIP",       &m_idZ0AtIP,        "idZ0AtIP/D");
-	m_tree->Branch("idD0AtIP",       &m_idD0AtIP,        "idD0AtIP/D");
-	m_tree->Branch("msPtAtIP",       &m_msPtAtIP,        "msPtAtIP/D");
-	m_tree->Branch("msZ0AtIP",       &m_msZ0AtIP,        "msZ0AtIP/D");
-	m_tree->Branch("msD0AtIP",       &m_msD0AtIP,        "msD0AtIP/D");
-	m_tree->Branch("nMdtHits",       &m_nMdtHits,        "nMdtHits/I");
-	m_tree->Branch("nRpcPhiHits",    &m_nRpcPhiHits,     "nRpcPhiHits/I");
-	m_tree->Branch("nTgcPhiHits",    &m_nTgcPhiHits,     "nTgcPhiHits/I");
-    
-	m_tree->Branch("truth_pt_gen",        &m_truth_pt_gen,        "truth_pt_gen/D");
-	m_tree->Branch("truth_pt_msentrance", &m_truth_pt_msentrance, "truth_pt_msentrance/D");
-      }
-    }
-
-    //These are CSC specific stuffs and muon track sagitta calculations
-    for(int il=0;il<m_csc_nMaxHits;il++){
-      m_csc_phi_hit_residual[il]=-100000.;
-      m_csc_phi_hit_error[il]=1000.;
-      m_csc_eta_hit_residual[il]=-100000.;
-      m_csc_eta_hit_error[il]=1000.;
-      m_csc_eta_hit_layer[il]=-1000; 
-      m_csc_phi_hit_layer[il]=-1000; 
-      m_csc_eta_hit_sector[il]=-1000; 
-      m_csc_phi_hit_sector[il]=-1000; 
-
-    }
-    m_csc_nphihits=0;
-    m_csc_netahits=0;
-    m_csc_phi_avg_residual=0.;
-    m_csc_phi_avg_error=0.;
-    m_csc_eta_avg_residual=0.;
-    m_csc_eta_avg_error=0.;
-    const Trk::SegmentCollection *m_collecsegments;
-    if( (m_storeGate->retrieve(m_collecsegments, m_segmentcollName)).isFailure()){ 
-      ATH_MSG_FATAL(" could not open segments collection : MooreSegments");
-      return;
-    } else 
-      ATH_MSG_DEBUG("Retrieved Segment Collection: "<<m_segmentcollName); 
-
-    m_muon_track_sagitta=-9999.;
-    int issegmentontrack=-1;
-    int seg_match_rot_csc=1000;
-    int seg_match_rot_m_mdt=1000;
-    int seg_match_rot_o_mdt=1000;
-    const Trk::Segment* seg_matched_m_mdt(0);
-    const Trk::Segment* seg_matched_o_mdt(0);
-    const Trk::Segment* seg_matched_csc(0);
-    for (Trk::SegmentCollection::const_iterator it_seg=m_collecsegments->begin();it_seg!=m_collecsegments->end(); it_seg++) {
-      const Trk::Segment* iSegment = *it_seg;
-      issegmentontrack=m_mutagedmhelpertool->IsThisSegmentInThisTrack(iSegment, alignTrack);
-      if(issegmentontrack<=1){
-	ATH_MSG_DEBUG("Segment Author: "<<iSegment->author());
-	//if (msgLvl(MSG::DEBUG)) iSegment->dump(msg());
-	ATH_MSG_DEBUG("Number of ROT notshared: "<<issegmentontrack);
-	std::string seg_station_name=m_mutagedmhelpertool->SegmentAssociatedStationName(iSegment);
-	int seg_station_level=m_mutagedmhelpertool->StationLevel(seg_station_name);
-	ATH_MSG_DEBUG("Associated Station Name: "<<seg_station_name);
-	ATH_MSG_DEBUG("Associated Station Level: "<<seg_station_level);
-	if(seg_station_name=="CSL"||seg_station_name=="CSS"){
-	  if(issegmentontrack<seg_match_rot_csc){
-	    seg_match_rot_csc=issegmentontrack;
-	    seg_matched_csc=iSegment;
-	  }
-	}else if(seg_station_name=="EMS"||seg_station_name=="EML"){
-	  if(issegmentontrack<seg_match_rot_m_mdt){
-	    seg_match_rot_m_mdt=issegmentontrack;
-	    seg_matched_m_mdt=iSegment;
-	  }
-	}else if(seg_station_name=="EOS"||seg_station_name=="EOL"){
-	  if(issegmentontrack<seg_match_rot_o_mdt){
-	    seg_match_rot_o_mdt=issegmentontrack;
-	    seg_matched_o_mdt=iSegment;
-	  }
-	}else
-	  continue;  
-      }
-    }
-    
-    const Muon::MuonSegment* m_seg_matched_m_mdt=(seg_matched_m_mdt)?
-      dynamic_cast<const Muon::MuonSegment*>(seg_matched_m_mdt):0;
-    
-    if (m_seg_matched_m_mdt && seg_matched_o_mdt && seg_matched_csc) {
-      const Amg::Vector3D csc_gp=seg_matched_csc->globalPosition();
-      const Amg::Vector3D mdt_m_gp=seg_matched_m_mdt->globalPosition();
-      const Amg::Vector3D mdt_o_gp=seg_matched_o_mdt->globalPosition();
-      HepGeom::Vector3D<double> mdt_m_tubedirection;
-      const std::vector<const  Trk::RIO_OnTrack*> pmdt_m_RIOSet = m_seg_matched_m_mdt->containedROTs();
-      for (vector<const  Trk::RIO_OnTrack*>::const_iterator it_m_mdt=pmdt_m_RIOSet.begin();it_m_mdt!=pmdt_m_RIOSet.end(); it_m_mdt++) {
-	const Trk::RIO_OnTrack* rot_m_mdt = (*it_m_mdt);
-	const Identifier& id_m_mdt = rot_m_mdt->identify();
-	if (p_MdtIdHelper->is_mdt(id_m_mdt)) {
-	  if (!p_MdtIdHelper->valid(id_m_mdt)) {
-	    ATH_MSG_WARNING("Skipping tube with invalid identifier");
-	    mdt_m_tubedirection= HepGeom::Vector3D<double>(1.,0.,0.);
-	  }
-	  const Trk::PrepRawData* pPrepRawData_m_mdt =  rot_m_mdt->prepRawData();
-	  const Trk::Surface* pSurface_m_mdt =
-	    &(pPrepRawData_m_mdt->detectorElement()->surface(pPrepRawData_m_mdt->identify()));
-	  const Trk::StraightLineSurface* pStraightLineSurface_m_mdt =
-	    dynamic_cast<const Trk::StraightLineSurface*> (pSurface_m_mdt);
-	  if (!pStraightLineSurface_m_mdt) {
-	    ATH_MSG_WARNING("Skipping tube with invalid surface");
-	    mdt_m_tubedirection=HepGeom::Vector3D<double>(1.,0.,0.);
-	  }
-	  else {
-	    mdt_m_tubedirection=(pStraightLineSurface_m_mdt->transform()).getRotation().colZ();
-	    break;
-	  }
-	}
-      }
-      
-      TVector3 mdt_tubedirection(mdt_m_tubedirection[0], mdt_m_tubedirection[1],mdt_m_tubedirection[2]);
-      //csc_gp=m_mutagedmhelpertool->GetPoint(seg_matched_csc);
-      //mdt_m_gp=m_mutagedmhelpertool->GetPoint(seg_matched_m_mdt);
-      //mdt_o_gp=m_mutagedmhelpertool->GetPoint(seg_matched_o_mdt);
-      ATH_MSG_DEBUG("Found all three layer hits");
-      TVector3 bi(csc_gp[0], csc_gp[1], csc_gp[2]);
-      TVector3 bm(mdt_m_gp[0], mdt_m_gp[1], mdt_m_gp[2]);
-      TVector3 bo(mdt_o_gp[0], mdt_o_gp[1], mdt_o_gp[2]);
-      TVector3 IM = bm-bi;
-      TVector3 IO = bo-bi;
-      m_muon_track_sagitta = IM.Dot(mdt_tubedirection.Cross(IO).Unit());
-      ATH_MSG_DEBUG("m_sagitta: "<<m_muon_track_sagitta);
-    }
-	
-  
-    // get run and event numbers
-    ATH_MSG_DEBUG("Retrieving event info.");
-    const EventInfo* eventInfo;
-    StatusCode sc = m_storeGate->retrieve(eventInfo);
-    if (sc.isFailure()) {
-      ATH_MSG_ERROR( "Could not retrieve event info.");
-    }
-    m_runNumber = eventInfo->event_ID()->run_number();
-    m_evtNumber = eventInfo->event_ID()->event_number();
-
-    // create chamber hitmap trees if they don't already exist
-  
-    // get info for reconstructed track
-    Muon::MuonTrackHistTool::TrackData trackData;
-    m_trackHistTool->extract(trackData, *alignTrack);
-  
-    ATH_MSG_DEBUG("extracted trackData from track");
-  
-    Muon::MuonHitHistTool::HitCountData& hcData = trackData.hitData.countData;
-    m_phih  = hcData.rpcs.nphi + hcData.tgcs.nphi + hcData.cscs.nphi;
-    m_etah  = hcData.mdts.nmdt + hcData.cscs.neta;
-    m_stati = hcData.mdts.nmdtCh + hcData.cscs.netaCh;
-  
-    m_statr=0; // track fit status... 0?
-  
-    // global position of track perigee (probably worthless)
-    m_xvtxr=trackData.gpos.x();
-    m_yvtxr=trackData.gpos.y();
-    m_zvtxr=trackData.gpos.z();
-  
-    ATH_MSG_DEBUG("global position of perigee" << m_xvtxr <<", "<<m_yvtxr
-		  <<", "<<m_zvtxr);
-  
-    const Trk::Perigee* perigee = alignTrack->perigeeParameters();
-    m_a0r    = perigee ? perigee->parameters()[Trk::d0] : -999.;
-    m_z0r    = perigee ? perigee->parameters()[Trk::z0] : -999.;
-    m_phir   = perigee ? perigee->momentum().phi()      : -999.;
-    m_cotthr = perigee ? perigee->cotTheta()            : -999.;
-    m_ptir   = perigee ? perigee->pT()                  : -999.;
-    m_etar   = perigee ? perigee->eta()                 : -999.;
-  
-    m_chi2   = trackData.chi2;
-    m_chi2pr = TMath::Prob(trackData.chi2, (int)trackData.ndof);
-  
-    ATH_MSG_DEBUG("perigee: "<<perigee);
-
-    const Trk::MeasuredPerigee* measPars = dynamic_cast<const Trk::MeasuredPerigee*>(perigee);
-
-    if( measPars ) {
-      
-      ATH_MSG_DEBUG("have measPars");
-    
-      const Trk::CovarianceMatrix& covMat = 
-	measPars->localErrorMatrix().covariance();
-    
-      m_covr11=covMat[0][0];
-      m_covr12=covMat[0][1];
-      m_covr22=covMat[1][1];
-      m_covr13=covMat[0][2];
-      m_covr23=covMat[1][2];
-      m_covr33=covMat[2][2];
-      m_covr14=covMat[0][3];
-      m_covr24=covMat[1][3];
-      m_covr34=covMat[2][3];
-      m_covr44=covMat[3][3];
-      m_covr15=covMat[0][4];
-      m_covr25=covMat[1][4];
-      m_covr35=covMat[2][4];
-      m_covr45=covMat[3][4];
-      m_covr55=covMat[4][4];
-    }
-    else
-      m_covr11=m_covr12=m_covr22=m_covr13=m_covr23=m_covr33=m_covr14=
-	m_covr24=m_covr34=m_covr44=m_covr15=m_covr25=m_covr35=m_covr45= 
-	m_covr55=-999;;
-  
-    m_vertexx=m_vertexy=m_vertexz=0.;
-  
-    // number of hits in different technologies
-    m_mdth=hcData.mdts.nmdt;
-    m_cscetah=hcData.cscs.neta;
-    m_cscphih=hcData.cscs.nphi;
-    m_rpcetah=hcData.rpcs.neta;
-    m_rpcphih=hcData.rpcs.nphi;
-    m_tgcetah=hcData.tgcs.neta;
-    m_tgcphih=hcData.tgcs.nphi;
-  
-    // store information for all hits on this track, including 
-    // scattering centers  
-    //const DataVector<const Trk::TrackStateOnSurface>* states = 
-    //alignTrack->trackStateOnSurfaces();
-  
-    //ATH_MSG_DEBUG("got states");
-    //if( !states ) return;
-    
-    //int nhitsTotal = states->size();
-    const Trk::AlignTSOSCollection* alignTSOSCollection = 
-      alignTrack->alignTSOSCollection();
-    int nhitsTotal = alignTSOSCollection->size();
-    if (nhitsTotal > m_max_hits) nhitsTotal = m_max_hits;
-
-    // loop over track and get information not on AlignTrack
-    m_nMuonOutliers=m_nTgcOutliers=0;
-    const DataVector<const Trk::TrackStateOnSurface>* tsosCollection=alignTrack->trackStateOnSurfaces();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos = tsosCollection->begin();
-    for (; iTsos != tsosCollection->end(); ++iTsos) {
-      if (!(*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) continue;
-      const Trk::MeasurementBase*             mesb       = (*iTsos)->measurementOnTrack();	
-      const Trk::RIO_OnTrack*                 rio        = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack*        crio       = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-      if (!rio && crio) rio=crio->rioOnTrack(0);
-      if (!rio) continue;
-      if (!m_muonIdHelperTool->isMuon(rio->detectorElement()->identify())) continue;
-    
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Outlier)) {
-	m_nMuonOutliers++;    
-	if (m_muonIdHelperTool->isTgc(rio->detectorElement()->identify())) m_nTgcOutliers++;
-      }
-    }
-
-    ATH_MSG_DEBUG("have "<<nhitsTotal<<" hits total");
-  
-    int nhits=0;
-    // loop over TSOSs
-    //DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit    =states->begin();
-    //DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end=states->end();
-    //for( ; tsit!=tsit_end ; ++tsit) {
- 
-    // loop over AlignTSOSs
-    std::vector<const Trk::AlignModule*> doneModules;
-  
-    m_nchambers=0;
-    m_chi2_transx->Zero();
-    m_chi2_transy->Zero();
-    m_chi2_transz->Zero();
-    m_chi2_rotx->Zero();
-    m_chi2_roty->Zero();
-    m_chi2_rotz->Zero();
-    m_chi2_transx_X->Zero();
-    m_chi2_transy_X->Zero();
-    m_chi2_transz_X->Zero();
-    m_chi2_rotx_X->Zero();
-    m_chi2_roty_X->Zero();
-    m_chi2_rotz_X->Zero();
-    //mdt
-    m_chi2_transx_mdt->Zero();
-    m_chi2_transy_mdt->Zero();
-    m_chi2_transz_mdt->Zero();
-    m_chi2_rotx_mdt->Zero();
-    m_chi2_roty_mdt->Zero();
-    m_chi2_rotz_mdt->Zero();
-    //tgc
-    m_chi2_transx_tgc->Zero();
-    m_chi2_transy_tgc->Zero();
-    m_chi2_transz_tgc->Zero();
-    m_chi2_rotx_tgc->Zero();
-    m_chi2_roty_tgc->Zero();
-    m_chi2_rotz_tgc->Zero();
-    //rpc
-    m_chi2_transx_rpc->Zero();
-    m_chi2_transy_rpc->Zero();
-    m_chi2_transz_rpc->Zero();
-    m_chi2_rotx_rpc->Zero();
-    m_chi2_roty_rpc->Zero();
-    m_chi2_rotz_rpc->Zero();
-    //csc
-    m_chi2_transx_csc->Zero();
-    m_chi2_transy_csc->Zero();
-    m_chi2_transz_csc->Zero();
-    m_chi2_rotx_csc->Zero();
-    m_chi2_roty_csc->Zero();
-    m_chi2_rotz_csc->Zero();
-    //id
-    m_chi2_transx_id->Zero();
-    m_chi2_transy_id->Zero();
-    m_chi2_transz_id->Zero();
-    m_chi2_rotx_id->Zero();
-    m_chi2_roty_id->Zero();
-    m_chi2_rotz_id->Zero();
-    //scat
-    m_chi2_transx_scat->Zero();
-    m_chi2_transy_scat->Zero();
-    m_chi2_transz_scat->Zero();
-    m_chi2_rotx_scat->Zero();
-    m_chi2_roty_scat->Zero();
-    m_chi2_rotz_scat->Zero();
-
-    DataVector<Trk::AlignTSOS>::const_iterator atsit = alignTSOSCollection->begin();
-    DataVector<Trk::AlignTSOS>::const_iterator atsit_end = alignTSOSCollection->end();
-    for ( ;atsit!=atsit_end;++atsit) {
-  
-      ATH_MSG_DEBUG("in loop over AlignTSOS, nhits="<<nhits);
-      if (nhits == m_max_hits) break;
-    
-
-      // don't keep scatterer info for now
-      
-	// if( (*tsit)->type(TrackStateOnSurface::scatterer) ) {
-	// const Trk::TrackParameters* pars = (*tsit)->trackParameters();
-	// HepGeom::Point3D<double> pos = pars ? pars->position() : HepGeom::Point3D<double>();
-	// m_hit_dtyp[nhits]=10;
-	// m_hit_rho[nhits]=pos.perp();
-	// m_hit_z[nhits]=pos.z();      
-	// ATH_MSG_DEBUG("m_hit_z"<<nhits<<"]: "<<m_hit_z[mnhits]);
-	// }     
-	// else {
-      
-
-      if ( !(*atsit)->type(Trk::TrackStateOnSurface::Measurement) ){
-        continue;
-      }
-
-      //m_hit_type[nhits]=(*atsit)->type();
-
-      const Trk::MeasurementBase* measurement = 
-	dynamic_cast<const Trk::MeasurementBase*>((*atsit)->measurementOnTrack());
-    
-    
-      ATH_MSG_DEBUG("have measurement");
-      
-      HepGeom::Point3D<double> pos = measurement->globalPosition();
-      double locPos(0.);
-      if( measurement->localParameters().contains(Trk::locX) ) 
-	locPos = measurement->localParameters()[Trk::locX];      
-      if( measurement->localParameters().contains(Trk::locY) ) 
-	locPos = measurement->localParameters()[Trk::locY];
-
-      double error = measurement->localErrorMatrix().error(Trk::locX); 
-      ATH_MSG_DEBUG("error: "<<error);
-      
-      Identifier id = m_helperTool->getIdentifier(*measurement);
-      ATH_MSG_DEBUG("id: "<<id.get_compact());
-      
-      double residual = -999.;
-      if ( id.is_valid() && (p_MdtIdHelper->is_muon(id)|| p_CscIdHelper->is_muon(id))&& 
-	   (p_MdtIdHelper->is_mdt(id)|| p_CscIdHelper->is_csc(id))) {
-
-	const Trk::ResidualPull* resPull = 0;
-	double pull = -999.;
-	const Trk::TrackParameters* trackPars = (*atsit)->trackParameters();
-	if ( trackPars ) {
-	  resPull = m_pullCalculator->residualPull( measurement, trackPars,
-						    Trk::ResidualPull::HitOnly,
-						    (*atsit)->measType());
-	  if ( resPull ) {
-	    residual = resPull->residual().front();
-	    pull = resPull->pull().front();
-	    ATH_MSG_DEBUG("residual: "<<residual);
-	  }
-	}
-	delete resPull; resPull=0;
-   
-	m_hit_tpar[nhits]=trackPars->parameters()[Trk::locX];
-
-	ATH_MSG_DEBUG("have valid muon");
-
-	MuonCalib::MuonFixedId fixedId = m_idTool->idToFixedId(id);
-
-	m_hit_fixedid[nhits]        = fixedId.getIdInt();
-	m_hit_fixedstatname[nhits]  = fixedId.stationName();
-	ATH_MSG_DEBUG("hit in chamber with fixedid "<<m_hit_fixedid[nhits]
-		      <<" and name "<<m_hit_fixedstatname[nhits]);
-
-	// only do CSC/MDT for now
-	if ( p_CscIdHelper->is_csc(id) ) {
-	  m_hit_statname[nhits]=p_CscIdHelper->stationName(id);
-	  m_hit_stateta[nhits]=p_CscIdHelper->stationEta(id);
-	  m_hit_statphi[nhits]=p_CscIdHelper->stationPhi(id);
-	  m_hit_statreg[nhits]=p_CscIdHelper->stationRegion(id);
-	  m_hit_tech[nhits]=p_CscIdHelper->technology(id);
-	  m_hit_dtyp[nhits]=p_CscIdHelper->measuresPhi(id) ? 6 : 5;
-	  m_hit_clyr[nhits]=p_CscIdHelper->chamberLayer(id);
-	  m_hit_wlyr[nhits]=p_CscIdHelper->wireLayer(id);
-	  m_hit_strp[nhits]=p_CscIdHelper->strip(id);
-	  ATH_MSG_DEBUG("m_hit_statname[nhits]: "<<m_hit_statname[nhits]
-			<<"\tm_hit_statreg[nhits]: "<<m_hit_statreg[nhits]);
-	       // Identifier Module = p_CscIdHelper->parentID(id);
-		  // const MuonGM::CscReadoutElement* descriptor = p_muonMgr->getCscReadoutElement(Module);
-		  // HepGeom::Point3D<double> LocalPos = descriptor->globalToLocalCoords(pos,Module);
-		  // m_hit_xloc[nhits]=LocalPos.x();
-		  // m_hit_yloc[nhits]=LocalPos.y();
-		  // m_hit_zloc[nhits]=LocalPos.z();
-	  
-	  ATH_MSG_DEBUG("Done with module finding");
-	  int csc_sector_num=-9999;
-	  if(p_CscIdHelper->stationName(id)==50)
-            csc_sector_num=p_CscIdHelper->stationEta(id)*(2*p_CscIdHelper->stationPhi(id)-1 + 1); 
-	  else
-            csc_sector_num=p_CscIdHelper->stationEta(id)*(2*p_CscIdHelper->stationPhi(id)-2 + 1);
-	  if((*atsit)->measDir()==Trk::x){
-	    if (m_csc_nphihits<m_csc_nMaxHits) {
-	      m_csc_phi_hit_residual[m_csc_nphihits] = ((*atsit)->residuals())[0].residual();
-	      m_csc_phi_hit_error[m_csc_nphihits] = ((*atsit)->residuals())[0].error();
-	      m_csc_phi_hit_layer[m_csc_nphihits] = p_CscIdHelper->wireLayer(id);
-	      m_csc_phi_hit_sector[m_csc_nphihits] = csc_sector_num;
-	      ATH_MSG_DEBUG("In loop for CSC phi hit"); 
-	      m_csc_nphihits++;
-	    }
-	  }else{
-	    if (m_csc_netahits<m_csc_nMaxHits) {
-	      m_csc_eta_hit_residual[m_csc_netahits] = ((*atsit)->residuals())[0].residual(); 
-	      m_csc_eta_hit_error[m_csc_netahits] = ((*atsit)->residuals())[0].error(); 
-	      m_csc_eta_hit_layer[m_csc_netahits] = p_CscIdHelper->wireLayer(id);
-	      m_csc_eta_hit_sector[m_csc_netahits] =csc_sector_num;
-	      ATH_MSG_DEBUG("In loop for CSC eta hit"); 
-	      m_csc_netahits++; 
-	    }
-	  } 
-	  ATH_MSG_DEBUG("Done with Variable filling");
-	}else {
-
-	  m_hit_statname[nhits]=p_MdtIdHelper->stationName(id);
-	  m_hit_stateta [nhits]=p_MdtIdHelper->stationEta(id);
-	  m_hit_statphi [nhits]=p_MdtIdHelper->stationPhi(id);
-	  m_hit_statreg [nhits]=p_MdtIdHelper->stationRegion(id);
-	  m_hit_tech[nhits]    =p_MdtIdHelper->technology(id);
-	  m_hit_dtyp[nhits]=7; // MDT
-	  m_hit_mlyr[nhits]=p_MdtIdHelper->multilayer(id);
-	  m_hit_tlyr[nhits]=p_MdtIdHelper->tubeLayer(id);
-	  m_hit_tube[nhits]=p_MdtIdHelper->tube(id);
-
-	  Identifier Module = p_MdtIdHelper->parentID(id);
-	  const MuonGM::MdtReadoutElement* descriptor = 
-	    p_muonMgr->getMdtReadoutElement(Module);
-	  HepGeom::Point3D<double> LocalPos = descriptor->globalToLocalCoords(pos,Module);
-	  m_hit_xloc[nhits]=LocalPos.x();
-	  m_hit_yloc[nhits]=LocalPos.y();
-	  m_hit_zloc[nhits]=LocalPos.z();
-	  m_hit_t0_x[nhits]=descriptor->tubePos(1,1,1).x();
-	  m_hit_t0_y[nhits]=descriptor->tubePos(1,1,1).y();
-	  m_hit_t0_z[nhits]=descriptor->tubePos(1,1,1).z();
-	  m_hit_t1_x[nhits]=descriptor->tubePos(1,1,12).x();
-	  m_hit_t1_y[nhits]=descriptor->tubePos(1,1,12).y();
-	  m_hit_t1_z[nhits]=descriptor->tubePos(1,1,12).z();
-	  m_hit_t2_x[nhits]=descriptor->tubePos(1,3,1).x();
-	  m_hit_t2_y[nhits]=descriptor->tubePos(1,3,1).y();
-	  m_hit_t2_z[nhits]=descriptor->tubePos(1,3,1).z();
-      
-	  ATH_MSG_DEBUG("hit_tube0_x/y/z="
-			<<m_hit_t0_x[nhits]<<"/"<<m_hit_t0_y[nhits]<<"/"
-			<<m_hit_t0_z[nhits]);
-
-
-	  m_hit_rho[nhits]=pos.perp();
-	  m_hit_phi[nhits]=pos.phi();
-	  m_hit_z[nhits]=pos.z();
-	  m_hit_sig[nhits]=error;
-	  ATH_MSG_DEBUG("pushing back "<<residual<<" to m_hit_res");
-	  m_hit_res[nhits]=residual;
-	  double etaval=0;
-	  if (p_MdtIdHelper->is_mdt(id)) {
-	    m_hit_cotth[nhits]=1./tan(pos.theta());
-	    etaval=-log(tan(atan(1./fabs(m_hit_cotth[nhits]))/2.));
-	    if (m_hit_cotth[nhits] < 0.) { etaval *= -1.;}
-	    m_hit_eta[nhits]=etaval;
-	    m_hit_drd[nhits]=locPos;
-	  } 
-	  else {
-	    m_hit_cotth[nhits]=pos.z()/pos.perp();
-	    etaval=-log(tan(atan(1./fabs(m_hit_cotth[nhits]))/2.));
-	    if (m_hit_cotth[nhits] < 0.) { etaval *= -1.;}
-	    m_hit_eta[nhits]=etaval;
-	  }
-	} //is mdt
-
-	
-	  // if ( p_RpcIdHelper->is_rpc(id) ) {
-	  // m_hit_statname[nhits]=p_RpcIdHelper->stationName(id);
-	  // m_hit_stateta[nhits]=p_RpcIdHelper->stationEta(id);
-	  // m_hit_statphi[nhits]=p_RpcIdHelper->stationPhi(id);
-	  // m_hit_statreg[nhits]=p_RpcIdHelper->stationRegion(id);
-	  // m_hit_tech[nhits]=p_RpcIdHelper->technology(id);
-	  // m_hit_dtyp[nhits]=p_RpcIdHelper->measuresPhi(id) ? 2 : 1; 
-	  // m_hit_dblr[nhits]=p_RpcIdHelper->doubletR(id);
-	  // m_hit_dblz[nhits]=p_RpcIdHelper->doubletZ(id);
-	  // m_hit_dblp[nhits]=p_RpcIdHelper->doubletPhi(id);
-	  // m_hit_ggap[nhits]=p_RpcIdHelper->gasGap(id);
-	  // m_hit_strp[nhits]=p_RpcIdHelper->strip(id);
-	  // Identifier Module = p_RpcIdHelper->parentID(id);
-	  // const MuonGM::RpcReadoutElement* descriptor = p_muonMgr->getRpcReadoutElement(Module);
-	  // HepGeom::Point3D<double> LocalPos = descriptor->globalToLocalCoords(pos,Module);
-	  // m_hit_xloc[nhits]=LocalPos.x();
-	  // m_hit_yloc[nhits]=LocalPos.y();
-	  // m_hit_zloc[nhits]=LocalPos.z();
-	  // } 
-	  // else if ( p_TgcIdHelper->is_tgc(id) ) {
-	  // m_hit_statname[nhits]=p_TgcIdHelper->stationName(id);
-	  // m_hit_stateta[nhits]=p_TgcIdHelper->stationEta(id);
-	  // m_hit_statphi[nhits]=p_TgcIdHelper->stationPhi(id);
-	  // m_hit_statreg[nhits]=p_TgcIdHelper->stationRegion(id);
-	  // m_hit_tech[nhits]=p_TgcIdHelper->technology(id);
-	  // m_hit_dtyp[nhits]=p_TgcIdHelper->isStrip(id) ? 4 : 3;
-	  // m_hit_ggap[nhits]=p_TgcIdHelper->gasGap(id);
-	  // m_hit_chnl[nhits]=p_TgcIdHelper->channel(id);
-	  // Identifier Module = p_TgcIdHelper->parentID(id);
-	  // const MuonGM::TgcReadoutElement* descriptor = p_muonMgr->getTgcReadoutElement(Module);
-	  // HepGeom::Point3D<double> LocalPos = descriptor->globalToLocalCoords(pos,Module);
-	  // m_hit_xloc[nhits]=LocalPos.x();
-	  // m_hit_yloc[nhits]=LocalPos.y();
-	  // m_hit_zloc[nhits]=LocalPos.z();
-	  // } 
-	  // else if ( p_CscIdHelper->is_csc(id) ) {
-	  // m_hit_statname[nhits]=p_CscIdHelper->stationName(id);
-	  // m_hit_stateta[nhits]=p_CscIdHelper->stationEta(id);
-	  // m_hit_statphi[nhits]=p_CscIdHelper->stationPhi(id);
-	  // m_hit_statreg[nhits]=p_CscIdHelper->stationRegion(id);
-	  // m_hit_tech[nhits]=p_CscIdHelper->technology(id);
-	  // m_hit_dtyp[nhits]=p_CscIdHelper->measuresPhi(id) ? 6 : 5;
-	  // m_hit_clyr[nhits]=p_CscIdHelper->chamberLayer(id);
-	  // m_hit_wlyr[nhits]=p_CscIdHelper->wireLayer(id);
-	  // m_hit_strp[nhits]=p_CscIdHelper->strip(id);
-	  // Identifier Module = p_CscIdHelper->parentID(id);
-	  // const MuonGM::CscReadoutElement* descriptor = p_muonMgr->getCscReadoutElement(Module);
-	  // HepGeom::Point3D<double> LocalPos = descriptor->globalToLocalCoords(pos,Module);
-	  // m_hit_xloc[nhits]=LocalPos.x();
-	  // m_hit_yloc[nhits]=LocalPos.y();
-	  // m_hit_zloc[nhits]=LocalPos.z();
-	  // } 
-	  // else if ( p_MdtIdHelper->is_mdt(id) ) { 
-	
-
-      }//csc/mdt
-      ATH_MSG_DEBUG("done with tech-specific");
-
-      ++nhits;
-
-      // get chi2 vs. align parameter information (if it exists)
-      if (!(*atsit)->module()) continue;
-    
-      std::vector<const Trk::AlignModule*>::iterator it=find(doneModules.begin(),
-							     doneModules.end(),
-							     (*atsit)->module());
-      if (it!=doneModules.end()) continue;
-    
-      ATH_MSG_DEBUG("working on nchamber "<<m_nchambers);
-      if (m_nchambers<m_max_nchambers) {
-	const Trk::AlignModule* module=(*atsit)->module();
-	doneModules.push_back(module);
-	ATH_MSG_DEBUG("module "<<module<<" (id "<<module->identify()<<")");
-	Identifier identifier=module->identify();
-	if (identifier.get_compact()>3) {
-	  MuonCalib::MuonFixedId fixedId = 
-	    m_idTool->idToFixedId(module->identify());
-	  m_chamberid[m_nchambers]      =fixedId.getIdInt();
-	  ATH_MSG_DEBUG("chamberid["<<m_nchambers<<"]="
-			<<m_chamberid[m_nchambers]);
-	  m_chamberstatname[m_nchambers]=fixedId.stationName();
-	}
-	else {
-	  m_chamberid[m_nchambers]=identifier.get_compact();
-	  ATH_MSG_DEBUG("chamberid["<<m_nchambers<<"]="
-			<<m_chamberid[m_nchambers]);
-	  m_chamberstatname[m_nchambers]=(int)identifier.get_compact();
-	}
-      
-	double sigmas[6] = {1.,1.,1.,1.,1.,1.};
-	DataVector<Trk::AlignPar>* alignPars=
-	  m_alignModuleTool->getAlignPars(module);
-
-	if (!alignPars) {
-	  ATH_MSG_WARNING("no alignPars set for module!");
-	  continue;
-	}
-
-	ATH_MSG_DEBUG("have alignpars");
-	for (int iap=0;iap<(int)alignPars->size();iap++) {
-	  int iparam=(*alignPars)[iap]->paramType();
-	  sigmas[iparam]=(*alignPars)[iap]->sigma();
-	}
-      
-	m_transx[m_nchambers]=sigmas[0];
-	m_transy[m_nchambers]=sigmas[1];
-	m_transz[m_nchambers]=sigmas[2];
-	m_rotx  [m_nchambers]=sigmas[3];
-	m_roty  [m_nchambers]=sigmas[4];
-	m_rotz  [m_nchambers]=sigmas[5];
-      
-	ATH_MSG_DEBUG("m_rotx["<<m_nchambers<<"]="<<m_rotx[m_nchambers]);
-	ATH_MSG_DEBUG("m_roty["<<m_nchambers<<"]="<<m_roty[m_nchambers]);
-	ATH_MSG_DEBUG("m_rotz["<<m_nchambers<<"]="<<m_rotz[m_nchambers]);
-      
-	double** chi2AlignParam     = (*atsit)->module()->chi2VAlignParamArray();
-	double** chi2AlignParamX    = (*atsit)->module()->chi2VAlignParamXArray();
-	double** chi2AlignParamMdt  = (*atsit)->module()->chi2VAlignParamArrayMeasType(Trk::TrackState::MDT);
-	double** chi2AlignParamTgc  = (*atsit)->module()->chi2VAlignParamArrayMeasType(Trk::TrackState::TGC);
-	double** chi2AlignParamRpc  = (*atsit)->module()->chi2VAlignParamArrayMeasType(Trk::TrackState::RPC);
-	double** chi2AlignParamCsc  = (*atsit)->module()->chi2VAlignParamArrayMeasType(Trk::TrackState::CSC);
-	double** chi2AlignParamUnid = (*atsit)->module()->chi2VAlignParamArrayMeasType(Trk::TrackState::unidentified);
-	double** chi2AlignParamPixel= (*atsit)->module()->chi2VAlignParamArrayMeasType(Trk::TrackState::Pixel);
-	double** chi2AlignParamSCT  = (*atsit)->module()->chi2VAlignParamArrayMeasType(Trk::TrackState::SCT);
-	double** chi2AlignParamTRT  = (*atsit)->module()->chi2VAlignParamArrayMeasType(Trk::TrackState::TRT);
-
-	if (chi2AlignParam==0) continue;
-      
-	if (m_nshifts<0) {
-	  m_nshifts = module->nChamberShifts();
-	  m_chi2_transx  ->ResizeTo(m_nshifts+1,m_chi2_transx  ->GetNcols());
-	  for (int i=0;i<m_nshifts+1;i++)
-	    for (int j=0;j<m_chi2_transx->GetNcols();j++)
-	      ATH_MSG_DEBUG("m_chi2_transx["<<i<<"]["<<j<<"]="<<(*m_chi2_transx)[i][j]);
-	  m_chi2_transy  ->ResizeTo(m_nshifts+1,m_chi2_transy  ->GetNcols());
-	  m_chi2_transz  ->ResizeTo(m_nshifts+1,m_chi2_transz  ->GetNcols());
-	  m_chi2_rotx    ->ResizeTo(m_nshifts+1,m_chi2_rotx    ->GetNcols());
-	  m_chi2_roty    ->ResizeTo(m_nshifts+1,m_chi2_roty    ->GetNcols());
-	  m_chi2_rotz    ->ResizeTo(m_nshifts+1,m_chi2_rotz    ->GetNcols());
-	  m_chi2_transx_X->ResizeTo(m_nshifts+1,m_chi2_transx_X->GetNcols());
-	  m_chi2_transy_X->ResizeTo(m_nshifts+1,m_chi2_transy_X->GetNcols());
-	  m_chi2_transz_X->ResizeTo(m_nshifts+1,m_chi2_transz_X->GetNcols());
-	  m_chi2_rotx_X  ->ResizeTo(m_nshifts+1,m_chi2_rotx_X  ->GetNcols());
-	  m_chi2_roty_X  ->ResizeTo(m_nshifts+1,m_chi2_roty_X  ->GetNcols());
-	  m_chi2_rotz_X  ->ResizeTo(m_nshifts+1,m_chi2_rotz_X  ->GetNcols());
-
-	  // mdt
-	  if (chi2AlignParamMdt) {
-	    m_chi2_transx_mdt->ResizeTo(m_nshifts+1,m_chi2_transx_mdt->GetNcols());
-	    m_chi2_transy_mdt->ResizeTo(m_nshifts+1,m_chi2_transy_mdt->GetNcols());
-	    m_chi2_transz_mdt->ResizeTo(m_nshifts+1,m_chi2_transz_mdt->GetNcols());
-	    m_chi2_rotx_mdt  ->ResizeTo(m_nshifts+1,m_chi2_rotx_mdt  ->GetNcols());
-	    m_chi2_roty_mdt  ->ResizeTo(m_nshifts+1,m_chi2_roty_mdt  ->GetNcols());
-	    m_chi2_rotz_mdt  ->ResizeTo(m_nshifts+1,m_chi2_rotz_mdt  ->GetNcols());
-	  }
-
-	  // tgc
-	  if (chi2AlignParamTgc) {
-	    ATH_MSG_DEBUG("resizing to "<<m_nshifts+1<<", "<<m_chi2_transx_tgc->GetNcols());
-	    m_chi2_transx_tgc->ResizeTo(m_nshifts+1,m_chi2_transx_tgc->GetNcols());
-	    for (int i=0;i<m_nshifts+1;i++)
-	      for (int j=0;j<m_chi2_transx_tgc->GetNcols();j++)
-		ATH_MSG_DEBUG("m_chi2_transx_tgc["<<i<<"]["<<j<<"]="<<(*m_chi2_transx_tgc)[i][j]);
-	    m_chi2_transy_tgc->ResizeTo(m_nshifts+1,m_chi2_transy_tgc->GetNcols());
-	    m_chi2_transz_tgc->ResizeTo(m_nshifts+1,m_chi2_transz_tgc->GetNcols());
-	    m_chi2_rotx_tgc  ->ResizeTo(m_nshifts+1,m_chi2_rotx_tgc  ->GetNcols());
-	    m_chi2_roty_tgc  ->ResizeTo(m_nshifts+1,m_chi2_roty_tgc  ->GetNcols());
-	    m_chi2_rotz_tgc  ->ResizeTo(m_nshifts+1,m_chi2_rotz_tgc  ->GetNcols());
-	  }
-
-	  // rpc
-	  if (chi2AlignParamRpc) {
-	    m_chi2_transx_rpc->ResizeTo(m_nshifts+1,m_chi2_transx_rpc->GetNcols());
-	    m_chi2_transy_rpc->ResizeTo(m_nshifts+1,m_chi2_transy_rpc->GetNcols());
-	    m_chi2_transz_rpc->ResizeTo(m_nshifts+1,m_chi2_transz_rpc->GetNcols());
-	    m_chi2_rotx_rpc  ->ResizeTo(m_nshifts+1,m_chi2_rotx_rpc  ->GetNcols());
-	    m_chi2_roty_rpc  ->ResizeTo(m_nshifts+1,m_chi2_roty_rpc  ->GetNcols());
-	    m_chi2_rotz_rpc  ->ResizeTo(m_nshifts+1,m_chi2_rotz_rpc  ->GetNcols());
-	  }
-
-	  // csc
-	  if (chi2AlignParamCsc) {
-	    m_chi2_transx_csc->ResizeTo(m_nshifts+1,m_chi2_transx_csc->GetNcols());
-	    m_chi2_transy_csc->ResizeTo(m_nshifts+1,m_chi2_transy_csc->GetNcols());
-	    m_chi2_transz_csc->ResizeTo(m_nshifts+1,m_chi2_transz_csc->GetNcols());
-	    m_chi2_rotx_csc  ->ResizeTo(m_nshifts+1,m_chi2_rotx_csc  ->GetNcols());
-	    m_chi2_roty_csc  ->ResizeTo(m_nshifts+1,m_chi2_roty_csc  ->GetNcols());
-	    m_chi2_rotz_csc  ->ResizeTo(m_nshifts+1,m_chi2_rotz_csc  ->GetNcols());
-	  }
-	
-	  // scat
-	  if (chi2AlignParamUnid) {
-	    m_chi2_transx_scat->ResizeTo(m_nshifts+1,m_chi2_transx_scat->GetNcols());
-	    m_chi2_transy_scat->ResizeTo(m_nshifts+1,m_chi2_transy_scat->GetNcols());
-	    m_chi2_transz_scat->ResizeTo(m_nshifts+1,m_chi2_transz_scat->GetNcols());
-	    m_chi2_rotx_scat  ->ResizeTo(m_nshifts+1,m_chi2_rotx_scat  ->GetNcols());
-	    m_chi2_roty_scat  ->ResizeTo(m_nshifts+1,m_chi2_roty_scat  ->GetNcols());
-	    m_chi2_rotz_scat  ->ResizeTo(m_nshifts+1,m_chi2_rotz_scat  ->GetNcols());
-	  }
-	
-	  // id
-	  if (chi2AlignParamPixel || chi2AlignParamSCT || chi2AlignParamTRT) {
-	    m_chi2_transx_id->ResizeTo(m_nshifts+1,m_chi2_transx_id->GetNcols());
-	    m_chi2_transy_id->ResizeTo(m_nshifts+1,m_chi2_transy_id->GetNcols());
-	    m_chi2_transz_id->ResizeTo(m_nshifts+1,m_chi2_transz_id->GetNcols());
-	    m_chi2_rotx_id  ->ResizeTo(m_nshifts+1,m_chi2_rotx_id  ->GetNcols());
-	    m_chi2_roty_id  ->ResizeTo(m_nshifts+1,m_chi2_roty_id  ->GetNcols());
-	    m_chi2_rotz_id  ->ResizeTo(m_nshifts+1,m_chi2_rotz_id  ->GetNcols());
-	  }
-	}
-	ATH_MSG_DEBUG("nshifts "<<m_nshifts<<", nchambers "<<m_nchambers);
-      
-	std::vector<TMatrixD*> chi2matrices;
-	std::vector<TMatrixD*> chi2matricesX;
-	std::vector<TMatrixD*> chi2matricesMdt;
-	std::vector<TMatrixD*> chi2matricesTgc;
-	std::vector<TMatrixD*> chi2matricesRpc;
-	std::vector<TMatrixD*> chi2matricesCsc;
-	std::vector<TMatrixD*> chi2matricesScat;
-	std::vector<TMatrixD*> chi2matricesId;
-      
-	for (int ipar=0;ipar<(int)alignPars->size();ipar++) {
-	  if      ((*alignPars)[ipar]->paramType()==Trk::AlignModule::TransX) {
-	    chi2matrices.push_back(m_chi2_transx);
-	    chi2matricesX.push_back(m_chi2_transx_X);	  
-	    chi2matricesMdt.push_back(m_chi2_transx_mdt);
-	    ATH_MSG_DEBUG("pushing back m_chi2_transx_tgc "<<m_chi2_transx_tgc);
-	    chi2matricesTgc.push_back(m_chi2_transx_tgc);
-	    chi2matricesRpc.push_back(m_chi2_transx_rpc);
-	    chi2matricesCsc.push_back(m_chi2_transx_csc);
-	    chi2matricesScat.push_back(m_chi2_transx_scat);
-	    chi2matricesId.  push_back(m_chi2_transx_id);
-	  }
-	  else if ((*alignPars)[ipar]->paramType()==Trk::AlignModule::TransY) {
-	    chi2matrices.push_back(m_chi2_transy);
-	    chi2matricesX.push_back(m_chi2_transy_X);  
-	    chi2matricesMdt.push_back(m_chi2_transy_mdt);
-	    chi2matricesTgc.push_back(m_chi2_transy_tgc);
-	    chi2matricesRpc.push_back(m_chi2_transy_rpc);
-	    chi2matricesCsc.push_back(m_chi2_transy_csc);
-	    chi2matricesScat.push_back(m_chi2_transy_scat);
-	    chi2matricesId.  push_back(m_chi2_transy_id);
-	  }
-	  else if ((*alignPars)[ipar]->paramType()==Trk::AlignModule::TransZ) {
-	    chi2matrices.push_back(m_chi2_transz);
-	    chi2matricesX.push_back(m_chi2_transz_X);
-	    chi2matricesMdt.push_back(m_chi2_transz_mdt);
-	    chi2matricesTgc.push_back(m_chi2_transz_tgc);
-	    chi2matricesRpc.push_back(m_chi2_transz_rpc);
-	    chi2matricesCsc.push_back(m_chi2_transz_csc);
-	    chi2matricesScat.push_back(m_chi2_transz_scat);
-	    chi2matricesId.  push_back(m_chi2_transz_id);
-	  }
-	  else if ((*alignPars)[ipar]->paramType()==Trk::AlignModule::RotX) {
-	    chi2matrices.push_back(m_chi2_rotx);
-	    chi2matricesX.push_back(m_chi2_rotx_X);
-	    chi2matricesMdt.push_back(m_chi2_rotx_mdt);
-	    chi2matricesTgc.push_back(m_chi2_rotx_tgc);
-	    chi2matricesRpc.push_back(m_chi2_rotx_rpc);
-	    chi2matricesCsc.push_back(m_chi2_rotx_csc);
-	    chi2matricesScat.push_back(m_chi2_rotx_scat);
-	    chi2matricesId.  push_back(m_chi2_rotx_id);
-	  }
-	  else if ((*alignPars)[ipar]->paramType()==Trk::AlignModule::RotY) {
-	    chi2matrices.push_back(m_chi2_roty);
-	    chi2matricesX.push_back(m_chi2_roty_X);
-	    chi2matricesMdt.push_back(m_chi2_roty_mdt);
-	    chi2matricesTgc.push_back(m_chi2_roty_tgc);
-	    chi2matricesRpc.push_back(m_chi2_roty_rpc);
-	    chi2matricesCsc.push_back(m_chi2_roty_csc);
-	    chi2matricesScat.push_back(m_chi2_roty_scat);
-	    chi2matricesId.  push_back(m_chi2_roty_id);
-	  }
-	  else if ((*alignPars)[ipar]->paramType()==Trk::AlignModule::RotZ) {
-	    chi2matrices.push_back(m_chi2_rotz);
-	    chi2matricesX.push_back(m_chi2_rotz_X);
-	    chi2matricesMdt.push_back(m_chi2_rotz_mdt);
-	    chi2matricesTgc.push_back(m_chi2_rotz_tgc);
-	    chi2matricesRpc.push_back(m_chi2_rotz_rpc);
-	    chi2matricesCsc.push_back(m_chi2_rotz_csc);
-	    chi2matricesScat.push_back(m_chi2_rotz_scat);
-	    chi2matricesId.  push_back(m_chi2_rotz_id);
-	  }
-	}
-      
-	for (int ishift=0;ishift<m_nshifts;ishift++) {
-	  ATH_MSG_DEBUG("ishift "<<ishift);
-		
-	  int jpar(0);
-	  for (int iparam=0;iparam<(int)alignPars->size();iparam++) {
-	    ATH_MSG_DEBUG("iparam="<<iparam<<"/"<<alignPars->size());
-	    (*(chi2matrices[jpar]))[ishift][m_nchambers]   =chi2AlignParam[iparam][ishift];
-	    (*(chi2matricesX[jpar]))[ishift][m_nchambers]  =chi2AlignParamX[iparam][ishift];
-
-	    ATH_MSG_DEBUG("chi2matrices["<<jpar<<"]["<<ishift<<"]=chi2AlignParam["
-			  <<iparam<<"]["<<ishift<<"]="<<chi2AlignParam[iparam][ishift]);
-
-	    ATH_MSG_DEBUG("getting Mdt for jpar="<<jpar<<", ishift="
-			  <<ishift<<", nchambers="<<m_nchambers<<", iparam="<<iparam);
-	    if (chi2AlignParamMdt) 
-	      (*(chi2matricesMdt[jpar]))[ishift][m_nchambers]=chi2AlignParamMdt[iparam][ishift];	    
-
-	    ATH_MSG_DEBUG("getting Tgc for jpar="<<jpar<<", ishift="
-			  <<ishift<<", nchambers="<<m_nchambers<<", iparam="<<iparam);
-	    if (chi2AlignParamTgc) 
-	      (*(chi2matricesTgc[jpar]))[ishift][m_nchambers]=chi2AlignParamTgc[iparam][ishift];
-
-	    ATH_MSG_DEBUG("getting Rpc for jpar="<<jpar<<", ishift="
-			  <<ishift<<", nchambers="<<m_nchambers<<", iparam="<<iparam);
-	    if (chi2AlignParamRpc) 
-	      (*(chi2matricesRpc[jpar]))[ishift][m_nchambers]=chi2AlignParamRpc[iparam][ishift];
-
-	    ATH_MSG_DEBUG("getting Csc for jpar="<<jpar<<", ishift="
-			  <<ishift<<", nchambers="<<m_nchambers<<", iparam="<<iparam);
-	    if (chi2AlignParamCsc) 
-	      (*(chi2matricesCsc[jpar]))[ishift][m_nchambers]=chi2AlignParamCsc[iparam][ishift];
-	  
-	    if (chi2AlignParamUnid)
-	      (*(chi2matricesScat[jpar]))[ishift][m_nchambers]=chi2AlignParamUnid[iparam][ishift];
-
-	    if (chi2AlignParamPixel || chi2AlignParamSCT || chi2AlignParamTRT) {
-	      double val(0.);
-	      if (chi2AlignParamPixel) val += chi2AlignParamPixel[iparam][ishift];
-	      if (chi2AlignParamSCT)   val += chi2AlignParamSCT  [iparam][ishift];
-	      if (chi2AlignParamTRT)   val += chi2AlignParamTRT  [iparam][ishift];
-	      (*(chi2matricesId[jpar]))[ishift][m_nchambers]=val;
-	    }
-	  
-	    ATH_MSG_DEBUG("done");
-	    jpar++;
-	  }
-	}
-      
-	m_nchambers++;
-      }
-    } //atsos
-    m_nhits=nhits;
-    ATH_MSG_DEBUG("done with loop over TSOS");
-  
-  
-    //fill truth info (variables are only filled for single muon MC)
-    m_truth_pt_gen = -1;
-    m_truth_pt_msentrance = -1;
-
-    //generated truth variables  
-    sc = StatusCode::SUCCESS;
-    const McEventCollection* mcEventCollection(0);
-    std::string mcEventCollectionName = "TruthEvent";
-    if(m_storeGate->transientContains<McEventCollection>(mcEventCollectionName)) {
-      sc = m_storeGate->retrieve(mcEventCollection,mcEventCollectionName);
-    }
-    if(sc.isFailure() || !mcEventCollection) {
-      ATH_MSG_DEBUG("No McEventCollection: " << mcEventCollectionName 
-		    << " found in store gate.");
-    }
-    else{
-      ATH_MSG_DEBUG("have McEventCollection.");
-    
-      const HepMC::GenEvent*  genEvent  = *(mcEventCollection->begin());
-      const HepMC::GenVertex* genVertex = *(genEvent->vertices_begin());
-      HepMC::GenEvent::particle_const_iterator part = genEvent->particles_begin();
-      HepMC::GenEvent::particle_const_iterator part_end = genEvent->particles_end();
-    
-      const HepMC::GenParticle* muon(0);
-      for(;part!=part_end;++part){
-	if( abs((*part)->pdg_id()) == 13
-	    && (*part)->production_vertex() == genVertex){
-	  if(!muon){   
-	    muon = *part;
-	  }
-	  else{
-	    ATH_MSG_DEBUG("More than one generated muon found."  << endmsg 
-			  << "Generated truth info will not be filled.");
-	    muon = 0;
-	    break;
-	  } 
-	}
-      }
-    
-      if(muon) m_truth_pt_gen = muon->momentum().perp();
-    }
-  
-    //truth variables at muon spectrometer entrance  
-    sc = StatusCode::SUCCESS;
-    const TrackRecordCollection* trackRecordCollection(0);
-    std::string trackRecordCollectionName = "MuonEntryLayer";
-    if(m_storeGate->transientContains<TrackRecordCollection>(trackRecordCollectionName)) {
-      sc = m_storeGate->retrieve(trackRecordCollection,trackRecordCollectionName);
-    }
-    if(sc.isFailure() || !trackRecordCollection){
-      ATH_MSG_DEBUG("No TrackRecordCollection: " << trackRecordCollectionName
-		    << " found in store gate.");
-    }
-    else{
-      ATH_MSG_DEBUG("have TrackRecordCollection.");
-      if(trackRecordCollection->size()==1){
-	TrackRecordConstIterator trackRecord = trackRecordCollection->begin();
-	CLHEP::HepLorentzVector vec((*trackRecord)->GetMomentum(),
-			     (*trackRecord)->GetEnergy());
-	m_truth_pt_msentrance = vec.perp();
-      }else{
-	ATH_MSG_DEBUG("More than one entry in trackRecordCollection found."<< endmsg 
-		      << "Truth info at MS entrance will not be filled.");
-      }
-    }
-
-  
-    // chi2 vs. alignment parameter information from alignTrack
-    for (int i=0;i<6;i++) 
-      m_chi2VAlignParamQuality[i]=alignTrack->trackAlignParamQuality(i);
-  
-
-    // set default values
-    m_trackChi2=m_trackChi2Dof=m_idTrackChi2=m_idTrackChi2Dof=
-      m_msTrackChi2=m_msTrackChi2Dof=m_trackEta=m_energyLoss=m_msidPtDiff=-999.;
-    m_nSctHits=m_nPixHits=m_nTrtHits=m_nMdtHits=m_nRpcPhiHits=m_nTgcPhiHits=-999;
-    m_idPtAtIP=m_idZ0AtIP=m_idD0AtIP=-999.;
-
-    //m_idD0AtIP=alignTrack->perigeeParameters()->parameters()[Trk::d0];
-    //m_idZ0AtIP=alignTrack->perigeeParameters()->parameters()[Trk::z0];
-    //alignTrack->perigeeParameters()->pT(); 
-    m_trackChi2=(alignTrack->fitQuality())->chiSquared();
-    m_trackChi2Dof=(alignTrack->fitQuality())->chiSquared()/((alignTrack->fitQuality())->numberDoF());  
-    //m_trackEta= alignTrack->perigeeParameters()->eta();
-  
-    // muon container info
-    const Analysis::MuonContainer* muons = 0;   
-    if (m_muonContainer!="") {    
-      if(evtStore()->contains<Analysis::MuonContainer>(m_muonContainer)) {
-	StatusCode sc = evtStore()->retrieve(muons,m_muonContainer);
-	if (sc.isFailure()) {	  
-	  ATH_MSG_DEBUG("No Collection with name MuidMuonCollection found in StoreGate");
-	}
-      } 
-      else {
-	ATH_MSG_WARNING("no muon container "<<m_muonContainer);
-      }
-    }
-  
-    if (muons) {
-      if (muons->size()>1) ATH_MSG_WARNING("Need to implement selection to get correct muon!");
-    
-      for (Analysis::MuonContainer::const_iterator muonItr=muons->begin(); 
-	   muonItr != muons->end(); ++muonItr) {
-      
-	if (!(*muonItr)->hasCombinedMuonTrackParticle()) {
-	  ATH_MSG_DEBUG("no combinedMuonTrackParticle!");
-	  continue;
-	}
-      
-	double idPt = (*muonItr)->hasInDetTrackParticle() ? 
-	  (*muonItr)->inDetTrackParticle()->pt() : 0.;
-	ATH_MSG_DEBUG("idPt: "<<idPt);
-      
-	double msExtrapPt = (*muonItr)->muonExtrapolatedTrackParticle() ? 
-	  (*muonItr)->muonExtrapolatedTrackParticle()->pt() : 0.;
-	ATH_MSG_DEBUG("msExtrapPt: "<<msExtrapPt);
-      
-	m_msidPtDiff = std::fabs(msExtrapPt/idPt-1.);
-      
-	// combined track
-	const Trk::FitQuality* fitQual = 
-	  (*muonItr)->combinedMuonTrackParticle()->fitQuality();	  
-	if (fitQual) {
-	  m_trackChi2    = fitQual->chiSquared();
-	  m_trackChi2Dof = fitQual->chiSquared()/(double)fitQual->numberDoF();
-	}
-
-	// MS track
-	if ((*muonItr)->muonExtrapolatedTrackParticle()) {
-	  const Trk::FitQuality* msFitQual = 
-	    (*muonItr)->muonExtrapolatedTrackParticle()->fitQuality();	  
-	  if (msFitQual) {
-	    m_msTrackChi2    = msFitQual->chiSquared();
-	    m_msTrackChi2Dof = msFitQual->chiSquared()/(double)msFitQual->numberDoF();
-	  }
-	}
-
-	// ID track
-	const Trk::FitQuality* idFitQual = 
-	  (*muonItr)->inDetTrackParticle()->fitQuality();	  
-	if (idFitQual) {
-	  m_idTrackChi2    = idFitQual->chiSquared();
-	  m_idTrackChi2Dof = idFitQual->chiSquared()/(double)idFitQual->numberDoF();
-	}
-
-	// other variables
-	m_trackEta   = (*muonItr)->eta();
-	m_energyLoss = (*muonItr)->energyLoss().first;
-	m_nSctHits   = (*muonItr)->numberOfSCTHits();
-	m_nPixHits   = (*muonItr)->numberOfPixelHits();
-	m_nTrtHits   = (*muonItr)->numberOfTRTHits();
-      
-	// ID track
-	const Trk::Track* idtrack = (*muonItr)->inDetTrkTrack();
-	if (idtrack) {
-	  m_idPtAtIP=1./std::fabs(idtrack->perigeeParameters()->parameters()[Trk::qOverP]);
-	  m_idZ0AtIP=idtrack->perigeeParameters()->parameters()[Trk::z0];
-	  m_idD0AtIP=idtrack->perigeeParameters()->parameters()[Trk::d0];
-	}
-      
-	// MS track at IP
-	const Trk::Track* msatIP = (*muonItr)->muonExtrapolatedTrkTrack();
-	if (msatIP) {
-	  m_msPtAtIP=std::fabs(msatIP->perigeeParameters()->parameters()[Trk::qOverP])*1000.;
-	  m_msZ0AtIP=msatIP->perigeeParameters()->parameters()[Trk::z0];
-	  m_msD0AtIP=msatIP->perigeeParameters()->parameters()[Trk::d0];
-	}
-      
-	m_nMdtHits    = (*muonItr)->numberOfMDTHits();
-	m_nRpcPhiHits = (*muonItr)->numberOfRPCPhiHits();
-	m_nTgcPhiHits = (*muonItr)->numberOfTGCPhiHits();
-      }  
-    }
-
-    if(m_csc_nphihits>0){
-      for(int il=0;il<m_csc_nphihits;il++){
-        m_csc_phi_avg_residual += m_csc_phi_hit_residual[il];
-        m_csc_phi_avg_error += (m_csc_phi_hit_error[il]*m_csc_phi_hit_error[il]);
-      }
-      m_csc_phi_avg_residual = (m_csc_phi_avg_residual/m_csc_nphihits);
-      m_csc_phi_avg_error = (sqrt(m_csc_phi_avg_error)/m_csc_nphihits);
-    }
-    if(m_csc_netahits>0){ 
-      for(int il=0;il<m_csc_netahits;il++){ 
-        m_csc_eta_avg_residual += m_csc_eta_hit_residual[il]; 
-        m_csc_eta_avg_error += (m_csc_eta_hit_error[il]*m_csc_eta_hit_error[il]); 
-      } 
-      m_csc_eta_avg_residual = (m_csc_eta_avg_residual/m_csc_netahits); 
-      m_csc_eta_avg_error = (sqrt(m_csc_eta_avg_error)/m_csc_netahits); 
-    } 
-
-    for(int il=0;il<m_csc_nMaxHits;il++)
-      ATH_MSG_VERBOSE("m_csc_phi_hit_residual[il]: "<<m_csc_phi_hit_residual[il]<<"   m_csc_eta_hit_residual[il]: "<< m_csc_eta_hit_residual[il]);  
-
-    if (m_tree) m_tree->Fill();
-
-    ++itrk;
-    return;
-    */
-  }
-  
-
-
-  //________________________________________________________________________
-  void MuonFillNtupleTool::storeHitmap() 
-  {
-  }
-
-  //________________________________________________________________________
-  void MuonFillNtupleTool::fillHitmap() 
-  {
-  }
-
-  //________________________________________________________________________
-  void MuonFillNtupleTool::fillSummary() 
-  {
-  }
-
-  //________________________________________________________________________
-  void MuonFillNtupleTool::showStatistics() 
-  {
-  }
-  
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonGeometryManagerTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonGeometryManagerTool.cxx
deleted file mode 100644
index a418cc6bfbe..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonGeometryManagerTool.cxx
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "DataModel/DataVector.h"
-#include "CLHEP/Units/SystemOfUnits.h"
-
-#include "MuonAlignGenTools/MuonGeometryManagerTool.h"
-#include "TrkAlignInterfaces/IAlignModuleTool.h"
-
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/TgcReadoutElement.h"
-#include "MuonReadoutGeometry/RpcReadoutElement.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonReadoutGeometry/MuonStation.h"
-
-#include "MuonCalibIdentifier/MuonFixedId.h"
-#include "MuonCalibITools/IIdToFixedIdTool.h"
-
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "TrkAlignEvent/AlignPar.h"
-#include "MuonAlignEvent/CombinedMuonAlignModule.h"
-#include "MuonAlignEvent/RpcAlignModule.h"
-#include "MuonAlignEvent/MdtAlignModule.h"
-#include "MuonAlignEvent/TgcAlignModule.h"
-#include "MuonAlignEvent/CscAlignModule.h"
-
-#include "MuonIdHelpers/MdtIdHelper.h"
-#include "MuonCalibStandAloneBase/RegionSelectionSvc.h"
-
-#include "CLHEP/Geometry/Transform3D.h"
-
-#include "TFile.h"
-#include "TTree.h"
-#include <iostream>
-
-using namespace MuonGM;
-
-namespace Muon {
-  
-//________________________________________________________________________
-MuonGeometryManagerTool::MuonGeometryManagerTool(const std::string& type,
-						 const std::string& name,
-						 const IInterface* parent)
-  : CommonGeometryManagerTool(type,name,parent)
-  , m_alignModuleTool("Muon::MuonAlignModuleTool")
-  , m_mdtGeoManager("")
-  , m_cscGeoManager("")
-  , m_tgcGeoManager("")
-  , m_idHashToAlignModuleMaps(Trk::AlignModule::NDetectorTypes,(Trk::AlignModuleList*)0)
-  , m_alignParList    (0)
-  , m_fullAlignParList(0)
- {
-   
-   declareInterface<IGeometryManagerTool>(this);
-
-  declareProperty("AlignModuleTool",       m_alignModuleTool);
-
-  declareProperty("MdtGeometryManager",    m_mdtGeoManager);
-  declareProperty("CscGeometryManager",    m_cscGeoManager);
-  declareProperty("TgcGeometryManager",    m_tgcGeoManager);
-
-  declareProperty("AlignLevel", m_alignLevel=3);
-
-  declareProperty("AlignMdt", m_alignMdt = true );
-  declareProperty("AlignTgc", m_alignTgc = true );
-  declareProperty("AlignCsc", m_alignCsc = true );
-
-}
-
-//________________________________________________________________________
-MuonGeometryManagerTool::~MuonGeometryManagerTool() 
-{
-  ATH_MSG_DEBUG("in MuonGeometryManagerTool d'tor");
-  
-  ATH_MSG_DEBUG("alignModuleList.size: "<<m_alignModuleList.size());
-  for (int i=0;i<(int)m_alignModuleList.size();i++) 
-    delete m_alignModuleList[i];
-  
-  ATH_MSG_DEBUG("deleting fullAlignParList");
-  delete m_fullAlignParList;
-  
-  ATH_MSG_DEBUG("deleting alignParList");
-  delete m_alignParList;
-
-  ATH_MSG_DEBUG("done with MuonGeometryManagerTool d'tor");
-
-}
-
-//_______________________________________________________________________
-StatusCode MuonGeometryManagerTool::initialize() 
-{
-  
-  ATH_MSG_DEBUG("initialize() of MuonGeometryManagerTool");
-
-  if (!CommonGeometryManagerTool::initialize().isSuccess()) {
-    ATH_MSG_FATAL("CommonGeometryManagerTool not initialized");
-    return StatusCode::FAILURE;
-  }
-
-  // MdtGeometryManagerTool
-  if (m_mdtGeoManager.retrieve().isSuccess()) 
-    ATH_MSG_INFO("Retrieved "<<m_mdtGeoManager);
-  else {
-    ATH_MSG_FATAL("Could not get "<<m_mdtGeoManager);
-    return StatusCode::FAILURE;
-  }
-
-  // CscGeometryManagerTool
-  if (m_cscGeoManager.retrieve().isSuccess()) 
-    ATH_MSG_INFO("Retrieved "<<m_cscGeoManager);
-  else {
-    ATH_MSG_FATAL("Could not get "<<m_cscGeoManager);
-    return StatusCode::FAILURE;
-  }
-
-  // TgcGeometryManagerTool
-  if (m_tgcGeoManager.retrieve().isSuccess()) 
-    ATH_MSG_INFO("Retrieved "<<m_tgcGeoManager);
-  else {
-    ATH_MSG_FATAL("Could not get "<<m_tgcGeoManager);
-    return StatusCode::FAILURE;
-  }
-
-  return StatusCode::SUCCESS;
-}
-  
-//________________________________________________________________________
-StatusCode MuonGeometryManagerTool::finalize() 
-{  
-  ATH_MSG_DEBUG("finalize() of MuonGeometryManagerTool");
-
-  if (!CommonGeometryManagerTool::finalize().isSuccess()) {
-    ATH_MSG_FATAL("CommonGeometryManagerTool finalize not successful");
-    return StatusCode::FAILURE;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//________________________________________________________________________
-int MuonGeometryManagerTool::ReadGeometry(int)
-{
-  ATH_MSG_DEBUG("in ReadGeometry()");
-  
-  // set pointers
-  m_idHashToAlignModuleMapsPtr = &m_idHashToAlignModuleMaps;
-  m_alignModuleListPtr = &m_alignModuleList;
-  
-  // build alignment geometry
-  buildGeometry();
-  
-  // now set the alignment parameters
-  // first prepare the parameter lists
-  m_alignParList     = new DataVector< DataVector<Trk::AlignPar> >(SG::OWN_ELEMENTS);
-  m_fullAlignParList = new DataVector< DataVector<Trk::AlignPar> >(SG::OWN_ELEMENTS);
-
-  // loop over modules
-  ATH_MSG_DEBUG("Adding module parameters to modules");
-  std::vector<Trk::AlignModule *>::const_iterator imod = m_alignModuleListPtr->begin();
-  std::vector<Trk::AlignModule *>::const_iterator imod_end = m_alignModuleListPtr->end();
-  for( ; imod!=imod_end ; ++imod) {
-    ATH_MSG_DEBUG("Module "<<(*imod)->name());
-    addModuleParameters(*imod,m_fullAlignParList,m_alignParList);
-  }
-  
-  // set alignModuleList and hash table in the alignModuleTool
-  m_alignModuleTool->setAlignModules(&m_alignModuleList, &m_idHashToAlignModuleMaps);
-  ATH_MSG_DEBUG(" geometry set in m_alignModuleTool");
-  
-  // set alignPar lists in the alignModuleTool
-  ATH_MSG_DEBUG(" alignParList = "<<m_alignParList);
-  ATH_MSG_DEBUG(" fullAlignParList = "<<m_fullAlignParList);
-  m_alignModuleTool->setAlignParLists(m_fullAlignParList, m_alignParList);
-  ATH_MSG_DEBUG(" AlignParLists set in m_alignModuleTool");
-    
-  int nDoF= m_alignModuleTool->nAlignParameters();
-  ATH_MSG_DEBUG("AlignModuleList has " << nDoF << " alignment parameters");
-  
-  ATH_MSG_DEBUG("leaving ReadGeometry");
-  return nDoF;
-}
-
-//________________________________________________________________________
-void MuonGeometryManagerTool::buildGeometry()
-{
-  int idHash = 0;
-
-  if (m_alignMdt) {
-    ATH_MSG_DEBUG("setting first idHash to "<<idHash<<" for MDT");
-    m_mdtGeoManager->setFirstIDHash(idHash);
-    m_mdtGeoManager->setModuleList(m_alignModuleListPtr);
-    m_mdtGeoManager->setHashMaps(m_idHashToAlignModuleMapsPtr);   
-    m_mdtGeoManager->buildGeometry();
-    
-    idHash=m_mdtGeoManager->getNextIDHash();    
-  }
-  if (m_alignCsc) {
-    ATH_MSG_DEBUG("setting first idHash to "<<idHash<<" for CSC");
-    m_cscGeoManager->setFirstIDHash(idHash);
-    m_cscGeoManager->setModuleList(m_alignModuleListPtr);
-    m_cscGeoManager->setHashMaps(m_idHashToAlignModuleMapsPtr);   
-    m_cscGeoManager->buildGeometry();
-    
-    idHash=m_cscGeoManager->getNextIDHash();
-  }
-  if (m_alignTgc) {
-    ATH_MSG_DEBUG("setting first idHash to "<<idHash<<" for TGC");
-    m_tgcGeoManager->setFirstIDHash(idHash);
-    m_tgcGeoManager->setModuleList(m_alignModuleListPtr);
-    m_tgcGeoManager->setHashMaps(m_idHashToAlignModuleMapsPtr);   
-    m_tgcGeoManager->buildGeometry();
-    
-    idHash=m_tgcGeoManager->getNextIDHash();
-  }
-  
-  return;
-}
-  
-//________________________________________________________________________
-void MuonGeometryManagerTool::addModuleParameters(Trk::AlignModule * module, 
-						  DataVector<DataVector<Trk::AlignPar> >* allFullModPars, 
-						  DataVector<DataVector<Trk::AlignPar> >* allActiveModPars)
-{
-  ATH_MSG_DEBUG("in addModuleParameters");
-
-  Trk::AlignModule::DetectorType detType=Trk::AlignModule::unidentified;
-  if (isOneDetOnly(module,detType)) {
-    ATH_MSG_DEBUG("isOneDetOnly, detType="<<detType);
-    if      (detType==Trk::AlignModule::MDT)
-      m_mdtGeoManager->addModuleParameters(module,allFullModPars,allActiveModPars);
-    else if (detType==Trk::AlignModule::CSC)
-      m_cscGeoManager->addModuleParameters(module,allFullModPars,allActiveModPars);
-    else if (detType==Trk::AlignModule::TGC)
-      m_tgcGeoManager->addModuleParameters(module,allFullModPars,allActiveModPars);
-    else {
-      ATH_MSG_WARNING("problem in addModuleParameters!");
-    }
-    ATH_MSG_DEBUG("returning from addModuleParameters");
-    return;
-  }
-
-  // prepare all parameters
-  ATH_MSG_DEBUG("preparing all parameters");
-  DataVector<Trk::AlignPar> * fullModPars = new DataVector<Trk::AlignPar>(SG::OWN_ELEMENTS);
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::TransX));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::TransY));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::TransZ));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::RotX));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::RotY));
-  fullModPars->push_back(new Trk::AlignPar(module,Trk::AlignModule::RotZ));
-  
-  // set sigmas
-  ATH_MSG_DEBUG("setting sigmas");
-  setSigmas(fullModPars);
-  
-  ATH_MSG_DEBUG("setting active parameters");
-  // select active parameters based on jobOption properties
-  DataVector<Trk::AlignPar> * activeModPars = new DataVector<Trk::AlignPar>(SG::VIEW_ELEMENTS);
-  for(unsigned int ipar=0;ipar<fullModPars->size();++ipar) {
-    
-    if(  (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransX && alignTraX()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransY && alignTraY()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransZ && alignTraZ()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotX   && alignRotX()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotY   && alignRotY()) ||
-	 (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotZ   && alignRotZ()) ) {
-      ATH_MSG_DEBUG("parameter type "
-		    <<fullModPars->at(ipar)->paramType()<<" \'"
-		    <<fullModPars->at(ipar)->dumpType()<<"\' is now active");
-      activeModPars->push_back(fullModPars->at(ipar));
-    }
-    else
-      ATH_MSG_DEBUG("parameter type "
-		    <<fullModPars->at(ipar)->paramType()<<" \'"
-		    <<fullModPars->at(ipar)->dumpType()<<"\' is NOT active");
-  }
-  
-  // now add parameters to the list
-  allFullModPars->push_back(fullModPars);
-  allActiveModPars->push_back(activeModPars);
-}
-
-//________________________________________________________________________
-bool MuonGeometryManagerTool::isOneDetOnly(const Trk::AlignModule* mod,
-					   Trk::AlignModule::DetectorType& detType) const
-{
-  ATH_MSG_DEBUG("in isOneDetOnly");
-  
-  Trk::AlignModule::DetectorType firstDetType=Trk::AlignModule::unidentified;
-  
-  for (int i=1;i<Trk::AlignModule::NDetectorTypes; i++) {
-    const Trk::AlignModule::DetElementCollection* coll = 
-      mod->detElementCollection((Trk::AlignModule::DetectorType)i);
-    if (coll && coll->size()>0) { 
-      if (firstDetType==Trk::AlignModule::unidentified)
-	firstDetType=(Trk::AlignModule::DetectorType)i;
-      else {
-	ATH_MSG_DEBUG("more than one detector type!");
-	return false;
-      }
-    }
-  }
-
-  detType=firstDetType;
-  if (detType==Trk::AlignModule::MDT ||
-      detType==Trk::AlignModule::CSC ||
-      detType==Trk::AlignModule::TGC) return true;
-  
-  return false;
-}
-
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonTrackCollectionProvider.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonTrackCollectionProvider.cxx
deleted file mode 100644
index 8162c72b574..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonTrackCollectionProvider.cxx
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TrkTrack/TrackCollection.h"
-
-#include "MuonAlignGenTools/MuonTrackCollectionProvider.h"
-#include "MuonAlignGenTools/MuonAlignRefitTool.h"
-
-#include "muonEvent/Muon.h"
-#include "muonEvent/MuonContainer.h"
-
-#include "MuonCombinedToolInterfaces/IMuonTrackTagTool.h"
-
-namespace Muon {
-  
-  //________________________________________________________________________
-  MuonTrackCollectionProvider::MuonTrackCollectionProvider(const std::string& type, 
-						   const std::string& name,
-						   const IInterface* parent)
-    
-    : AthAlgTool(type,name,parent)
-    , m_tagTool("")
-    , m_muonAlignRefitTool("Muon::MuonAlignRefitTool")
-    , m_inputTrackType(MSStandaloneWithIDTrackMatch)
-  {
-
-    declareInterface<ITrackCollectionProvider>(this);
-
-    declareProperty("TagTool",             m_tagTool);
-
-    declareProperty("MuonAlignRefitTool",  m_muonAlignRefitTool);
-
-    declareProperty("InputMuonCol",        m_inputMuonCol="MuidMuonCollection");
-    declareProperty("InputTrackCol",       m_inputTrackCol="MooreTracks");
-    declareProperty("InputIDTrackCol",     m_inputIDTrackCol="Tracks");
-    
-    declareProperty("UseStandaloneTracks", m_useStandaloneTracks=true);
-    declareProperty("TrackType",           m_inputTrackType=MSStandaloneWithIDTrackMatch);
-
-    declareProperty("MomentumCut",         m_momentumCut=4.);
-    declareProperty("TrackMatchDeltaR",    m_trackMatchDeltaR=0.25);
-
-    declareProperty("RemovePerigeeBeforeRefit", m_removePerigeeBeforeRefit = false);
-
-  }
-
-  //________________________________________________________________________
-  MuonTrackCollectionProvider::~MuonTrackCollectionProvider()
-  {
-
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonTrackCollectionProvider::initialize()
-  {
-    if (m_tagTool.name()!=""){
-      if (m_tagTool.retrieve().isFailure()) {
-	ATH_MSG_FATAL("Failed to retrieve tool " << m_tagTool);
-	return StatusCode::FAILURE;
-      }
-      else {
-	ATH_MSG_INFO("Retrieved tool " << m_tagTool);
-      }       
-    }
-
-    if (m_muonAlignRefitTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved "<<m_muonAlignRefitTool);
-    else {
-      ATH_MSG_WARNING("Failed to retrieve MuonAlignRefitTool");
-      return StatusCode::FAILURE;
-    }
-
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonTrackCollectionProvider::finalize()
-  {
-    return StatusCode::SUCCESS;
-  }
-
-  
-  //________________________________________________________________________
-  StatusCode MuonTrackCollectionProvider::trackCollection(const TrackCollection*& originalTracks)
-  {
-    originalTracks=0;
-    if (m_inputTrackType==Muon)
-      return trackCollectionFromMuonContainer(originalTracks);
-    else if (m_inputTrackType==MSStandaloneWithIDTrackMatch)
-      return trackCollectionFromTrackContainers(originalTracks);
-    else if (m_inputTrackType==CombinedMuonTrack)
-      return trackCollectionFromCombinedTrack(originalTracks);
-    else 
-      return StatusCode::SUCCESS;
-  }
-  
-  //________________________________________________________________________
-  StatusCode MuonTrackCollectionProvider::trackCollectionFromMuonContainer(const TrackCollection*& originalTracks)
-  {
-    originalTracks=0;
-    
-    /** get the container of the original muons - */
-    const Analysis::MuonContainer* muonTES=0;
-    StatusCode sc = evtStore()->retrieve( muonTES, m_inputMuonCol);
-    if ( sc.isFailure() || muonTES == 0 ) return sc;
-    if ( muonTES->size() < 1 ) return sc;
-    
-    TrackCollection* trackCollection=new TrackCollection;
-
-    Analysis::MuonContainer::const_iterator muonIt  = muonTES->begin();
-    Analysis::MuonContainer::const_iterator muonItE = muonTES->end();
-    
-    // Loop over muon collection
-    for ( ; muonIt!=muonItE; ++muonIt ) {
-      
-      if (muonIt == muonItE || !*muonIt) continue;
-      
-      // put fit chi2 cut=2.5/dof
-
-      // Only keep combined muons with ID and MS 
-      if (m_useStandaloneTracks) {
-	if ( !(*muonIt)->isStandAloneMuon()) continue;
-	trackCollection->push_back(const_cast<Trk::Track*>((**muonIt).muonSpectrometerTrkTrack()));
-      }
-      else {
-	if ( !(*muonIt)->isCombinedMuon()) continue;
-	trackCollection->push_back(const_cast<Trk::Track*>((**muonIt).combinedMuonTrkTrack()));
-      }
-    }      
-    
-    originalTracks=trackCollection;
-
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonTrackCollectionProvider::trackCollectionFromTrackContainers(const TrackCollection*& tracks)
-  {
-
-    // check if TagTool exists
-    if (m_tagTool.empty()) {
-      ATH_MSG_ERROR("need TagTool to match MS track to ID track!");
-      return StatusCode::FAILURE;
-    }
-	        
-    tracks=0;
-    
-    /** get the container of the original muon tracks */
-    const TrackCollection* muonTracks=0;
-    if( !evtStore()->contains<TrackCollection>(m_inputTrackCol) ||
-	evtStore()->retrieve(muonTracks,m_inputTrackCol).isFailure() ) {      
-      
-      ATH_MSG_DEBUG("input muon track collection \'"<<m_inputTrackCol<<"\' not found for this event");
-      return StatusCode::SUCCESS;
-    }
-    ATH_MSG_DEBUG("have muon tracks, "<<muonTracks->size());
-
-    /** get the container of the original ID tracks */
-    const TrackCollection* inDetTracks=0;
-    if( !evtStore()->contains<TrackCollection>(m_inputIDTrackCol) ||
-	evtStore()->retrieve(inDetTracks,m_inputIDTrackCol).isFailure() ) {
-      
-      ATH_MSG_DEBUG("input ID track collection \'"<<m_inputIDTrackCol<<"\' not found for this event");
-      return StatusCode::SUCCESS;
-    }
-    ATH_MSG_DEBUG("have ID tracks, "<<inDetTracks->size());
-
-    TrackCollection* trackCollection=new TrackCollection;
-
-    int iMuTrack(0);
-    TrackCollection::const_iterator muTrackIt  = muonTracks->begin();
-    TrackCollection::const_iterator muTrackItE = muonTracks->end();
-    for ( ; muTrackIt!=muTrackItE; ++muTrackIt,iMuTrack++ ) {
-      
-      ATH_MSG_DEBUG("mu track "<<iMuTrack<<"/"<<muonTracks->size());
-      
-      if (muTrackIt == muTrackItE || !*muTrackIt) continue;
-      
-      const Trk::Track* muTrack=*muTrackIt;
-      
-      // loop over ID tracks and see if there is a good match
-      TrackCollection::const_iterator inDetTrackIt  = inDetTracks->begin();
-      TrackCollection::const_iterator inDetTrackItE = inDetTracks->end();  
-      const Trk::Track* bestTrack = 0;
-      double bestMatchChi2=99999.;
-      int iIdTrack=0;
-      for ( ; inDetTrackIt!=inDetTrackItE; ++inDetTrackIt,iIdTrack++ ) {
-	
-	const Trk::Track* inDetTrack = *inDetTrackIt;
-	
-	// check momentum
-	if (!inDetTrack->perigeeParameters()) continue;
-	
-	double matchChi2 = m_tagTool->chi2(*inDetTrack,*muTrack);
-	if (matchChi2<bestMatchChi2) {
-	  bestMatchChi2=matchChi2;
-	  bestTrack=inDetTrack;
-        } 
-      }
-      
-      // get ID track momentum
-      if (!bestTrack) {
-	ATH_MSG_DEBUG("no ID track found to match MS track");
-	continue;
-      }
-      else {
-	ATH_MSG_DEBUG("found ID track");
-      }
-
-      double pT      =bestTrack->perigeeParameters()->pT();
-      double inDetEta=bestTrack->perigeeParameters()->eta();
-      double momentum=std::fabs(pT)*std::sqrt(1.+sinh(inDetEta)*sinh(inDetEta))/1000.;
-      
-      if (momentum<m_momentumCut) {
-	ATH_MSG_DEBUG("no good ID track, continuing");
-	continue;
-      }
-      
-      double charge = (*(bestTrack->trackParameters()->begin()))->charge();
-      double qOverP = charge/(momentum*1000.);
-      ATH_MSG_DEBUG("calling pTCorrectTrack with p="<<.001/qOverP);
-      Trk::Track* newTrack=
-	m_muonAlignRefitTool->pTCorrectTrack(*muTrack,qOverP,m_removePerigeeBeforeRefit);
-      trackCollection->push_back(newTrack);
-    }
-  
-    if (StatusCode::SUCCESS!=evtStore()->record(trackCollection,"pTCorrectedTracks")) {
-      ATH_MSG_WARNING("problem with recording tracks to StoreGate!");
-    }
-
-    tracks=trackCollection;
-    
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonTrackCollectionProvider::trackCollectionFromCombinedTrack(const TrackCollection*& tracks)
-  {
-    tracks=0;
-    return StatusCode::FAILURE;
-  }
-  
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonTrackPreProcessor.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonTrackPreProcessor.cxx
deleted file mode 100644
index cd398519532..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/MuonTrackPreProcessor.cxx
+++ /dev/null
@@ -1,2282 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "StoreGate/StoreGateSvc.h"
-#include "GaudiKernel/MsgStream.h"
-
-#include "AtlasDetDescr/AtlasDetectorID.h"
-#include "xAODEventInfo/EventInfo.h"
-
-#include "TrkFitterInterfaces/ITrackFitter.h"
-#include "TrkFitterInterfaces/IGlobalTrackFitter.h"
-
-//#include "TrkToolInterfaces/ITrackSelectorTool.h"
-#include "TrkToolInterfaces/IResidualPullCalculator.h"
-
-#include "TrkTrack/Track.h"
-#include "TrkTrack/TrackCollection.h"
-#include "TrkTrack/TrackStateOnSurface.h"
-#include "TrkMeasurementBase/MeasurementBase.h"
-#include "TrkRIO_OnTrack/RIO_OnTrack.h"
-#include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h"
-//#include "TrkParameters/MeasuredPerigee.h"
-#include "TrkAlignEvent/AlignTrack.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "TrkEventUtils/MeasurementTypeID.h"
-//#include "TrkDetDescrInterfaces/ITrackingVolumesSvc.h"
-#include "TrkVolumes/Volume.h"
-#include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h"
-#include "TrkMaterialOnTrack/ScatteringAngles.h"
-#include "TrkPrepRawData/PrepRawData.h"
-#include "TrkSurfaces/Surface.h"
-#include "TrkSurfaces/StraightLineSurface.h"
-
-#include "Identifier/Identifier.h"
-#include "MuonIdHelpers/MuonIdHelperTool.h"
-#include "MuonAlignGenTools/MuonTrackPreProcessor.h"
-#include "MuonAlignGenTools/MuonAlignRefitTool.h"
-#include "MuonAlignGenTools/MuonAlignHelperTool.h"
-#include "MuonRecHelperTools/MuonEDMPrinterTool.h"
-
-#include "MuonIdHelpers/MuonIdHelper.h"
-#include "MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h"
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "MuonPrepRawData/CscPrepData.h"
-#include "MuonPrepRawData/TgcPrepData.h"
-
-#include "muonEvent/MuonContainer.h"
-#include "Particle/TrackParticle.h"
-
-#include "MuonCalibStandAloneBase/RegionSelectionSvc.h"
-
-//#include "TrkEventPrimitives/GlobalPosition.h"
-//#include "TrkEventPrimitives/ParamDefs.h"
-#include "GeoPrimitives/GeoPrimitives.h"
-
-#include "TFile.h"
-#include "TTree.h"
-
-namespace Muon {
-  
-  //________________________________________________________________________
-  MuonTrackPreProcessor::MuonTrackPreProcessor(const std::string& type,
-					       const std::string& name,
-					       const IInterface* parent)
-    : AthAlgTool(type,name,parent)
-    , p_muonMgr(0)
-    , m_storeGate(0)
-    , m_ntuple(0)
-    , m_trackFitterTool("Trk::GlobalChi2Fitter/MCTBFitter")
-    , m_SLTrackFitterTool("Trk::GlobalChi2Fitter/MCTBSLFitter")
-    , m_muonIdHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool")
-    , m_segmentTrackBuilder("Muon::MuonSegmentTrackBuilder/MuonSegmentTrackBuilder")
-    , m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator")
-    , m_muonAlignRefitTool("Muon::MuonAlignRefitTool/MuonAlignRefitTool")
-    , m_muonAlignHelperTool("Muon::MuonAlignHelperTool/MuonAlignHelperTool")
-    , m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool")
-      //, m_trackingVolumesSvc("TrackingVolumesSvc/TrackingVolumesSvc",name) //rdh problems with Eigen migration!
-    , m_idHelper(0)   
-    , m_measTypeIdHelper(0)
-    , m_particleNumber(2)
-    , m_particleHypothesis(Trk::muon)
-    , m_tree(0)
-    , m_runNumber(0)
-    , m_evtNumber(0)
-    , m_nresiduals(0)
-    , m_residuals(new double[100])
-    , m_respulls(new double[100])
-    , m_nInnerLayersHit(0)
-    , m_nMiddleLayersHit(0)
-    , m_nOuterLayersHit(0)
-    , m_nOtherLayersHit(0)
-    , m_nTubeLayersHitInner(0)
-    , m_nTubeLayersHitMiddle(0)
-    , m_nTubeLayersHitOuter(0)
-    , m_nTubeLayersHitOther(0)
-    , m_nChambersHit(0)
-    , m_nLargeChambersHit(0)
-    , m_nSmallChambersHit(0)
-    , m_driftSignsInnerLayer(0)
-    , m_driftSignsMiddleLayer(0)
-    , m_driftSignsOuterLayer(0)
-    , m_driftSignsOtherLayer(0)
-    , m_nInnerLayerOutliers(0)
-    , m_nMiddleLayerOutliers(0)
-    , m_nOuterLayerOutliers(0)
-    , m_nOtherLayerOutliers(0)
-    , m_nInnerLayerHoles(0)
-    , m_nMiddleLayerHoles(0)
-    , m_nOuterLayerHoles(0)
-    , m_nOtherLayerHoles(0)
-    , m_trackNDoF(0)
-    , m_trackChi2(0)
-    , m_trackPt(0)
-    , m_trackEta(0)
-    , m_qOverP(0)
-    , m_IDres(new double[100]), m_IDerr(new double[100])
-    , m_IDscatPhiRes(new double[100]), m_IDscatPhiErr(new double[100])
-    , m_IDscatThetaRes(new double[100]), m_IDscatThetaErr(new double[100])
-    , m_MSres(new double[150]), m_MSerr(new double[150])
-    , m_MSstatLayer(new int[150]), m_MSisEndcap(new int[150])
-    , m_MStrigRes(new double[50]), m_MStrigErr(new double[50])
-    , m_MStrigStatLayer(new int[50]), m_MStrigIsEndcap(new int[50])
-    , m_MSscatPhiRes(new double[100]), m_MSscatPhiErr(new double[100])
-    , m_MSscatThetaRes(new double[100]), m_MSscatThetaErr(new double[100])
-    , m_CalRes(new double[10]), m_CalErr(new double[10])
-    , m_nChambers(0)
-    , m_chamberId(new int[50])
-    , m_resIndex(new int[50])
-    , m_beePosX(0)
-    , m_beePosY(0)
-    , m_nProcessed(0)
-    , m_nPassHitRemoval(0)
-    , m_nPassTGCHitRemoval(0)
-    , m_nPassBarrelVeto(0)
-    , m_nPassInnerLayer(0)
-    , m_nPassOuterLayer(0)
-    , m_nPassSmallLargeOverlap(0)
-    , m_nPassSectorOverlap(0)
-    , m_nPassMinChambers(0)
-    , m_nPassMinSmallChambers(0)
-    , m_nPassMinLargeChambers(0)
-    , m_nPassRPCPhiHit(0)
-    , m_nPassStandardTrackSel(0)
-    , m_nPassInitTrackSel(0)
-    , m_nPassTubeLayerEC(0)
-    , m_nPassTubeLayerBarrel(0)
-    , m_nPassDriftSignSumEC(0)
-    , m_nPassDriftSignSumBarrel(0)
-    , m_nPassTrackRefit(0)
-    , m_nPassTrackChi2Cut(0)
-    , m_nPassOutlierCut(0)
-    , m_nPassHoleCut(0)
-    , m_nPassFinalTrackSel(0)
-    , m_nProcessTrackSelection(0)
-    , m_nPassBarrelECOverlap(0)
-    , m_nPassNMdtHits(0)
-    , m_nPassNLayers(0)
-    , m_nPassTrackChi2(0)
-    , m_nPassMomentum(0)
-    , m_nPassD0(0)
-    , m_nPassZ0(0)
-  {
-    declareInterface<Trk::IAlignTrackPreProcessor>(this);
-    
-    declareProperty("TrackFitterTool",             m_trackFitterTool);
-    declareProperty("SLTrackFitterTool",           m_SLTrackFitterTool);
-    declareProperty("MuonIdHelperTool",            m_muonIdHelperTool);
-    //declareProperty("TrackSelectorTools",          m_trackSelectorTools);
-    declareProperty("MuonAlignRefitTool",          m_muonAlignRefitTool);
-    declareProperty("MuonAlignHelperTool",         m_muonAlignHelperTool);
-
-    declareProperty("MuonContainer",               m_muonContainer="");
-
-    //declareProperty("TrackingVolumesSvc",          m_trackingVolumesSvc);
-
-    declareProperty("RefitTracks",                 m_refitTracks = false );    
-    declareProperty("ParticleNumber",              m_particleNumber);
-    //declareProperty("RunOutlierRemoval",           m_runOutlierRemoval);
-
-    declareProperty("ResetScatteringAngles",       m_resetScatteringAngles = false);
-    declareProperty("RemoveScattererTSOS",         m_removeScattererTSOS = false);
-
-    //declareProperty("DeclusterTGCHits",            m_declusterTGCHits = true);
-    //declareProperty("RedoErrorScaling",            m_redoErrorScaling = false);
-    //declareProperty("RemovePerigeeBeforeRefit",    m_removePerigeeBeforeRefit = false);
-    declareProperty("pTCorrectTrack",              m_pTCorrectTrack = false);
-
-
-    declareProperty("ApplyStandardSelectionCuts",  m_applyStandardSelectionCuts = true);
-    declareProperty("ApplySelectionCuts",          m_applySelectionCuts = true);
-    declareProperty("RequireInnerLayerEndcapMdt",  m_requireInnerLayerEndcapMdt = false);
-    declareProperty("RequireOuterLayerEndcapMdt",  m_requireOuterLayerEndcapMdt = false);
-    //declareProperty("CutOnBarrel",                 m_cutOnBarrel = false);
-    declareProperty("RequireOneHitPerTubeLayerEC", m_requireOneHitPerTubeLayerEC = false);
-    declareProperty("RequireSmallLargeOverlap",    m_requireSmallLargeOverlap = false);
-    declareProperty("RequireSectorOverlap",        m_requireSectorOverlap = false);
-    declareProperty("OverlapSector1",              m_sector1 = 0);
-    declareProperty("OverlapSector2",              m_sector2 = 0);
-    declareProperty("RequireBarrelECOverlap",      m_requireBarrelECOverlap = false);
-    declareProperty("RequireRPCPhiHit",            m_requireRPCPhiHit = false);
-
-    declareProperty("MinMdtChambers",              m_minMdtChambers = 0);
-    declareProperty("MinSmallMdtChambers",         m_minSmallMdtChambers = 0);
-    declareProperty("MinLargeMdtChambers",         m_minLargeMdtChambers = 0);
-
-    declareProperty("nAllowedHoles",               m_nAllowedHoles=0);
-    declareProperty("nAllowedOutliers",            m_nAllowedOutliers=1);
-    declareProperty("MaxDriftSignSumInner",        m_maxDriftSignSumInner=2);
-    declareProperty("MaxDriftSignSum",             m_maxDriftSignSum=2);
-    declareProperty("chiSqCut",                    m_chiSqCut=5.);
-    declareProperty("MSID_ptDiffCut",              m_MSID_ptDiffCut=0.15);
-    declareProperty("SelectCombinedMuons",         m_selectCombinedMuons=false);
-
-    m_nIDres=m_nIDscatRes=m_nMSres=m_nMStrigRes=m_nMSscatRes=m_nCalRes=0;
-    
-  }
-
-  //________________________________________________________________________
-  MuonTrackPreProcessor::~MuonTrackPreProcessor()
-  {
-
-  }
-  
-  //________________________________________________________________________
-  StatusCode MuonTrackPreProcessor::initialize()
-  {
-
-    // check StoreGate service available
-    if (StatusCode::SUCCESS != service("StoreGateSvc", m_storeGate)) {
-      ATH_MSG_FATAL("StoreGate service not found");
-      return StatusCode::FAILURE;
-    }
-
-    // get muon detector manager
-    if (detStore()->retrieve(p_muonMgr).isFailure()) {
-      ATH_MSG_FATAL("Cannot retrieve MuonDetectorManager");
-      return StatusCode::FAILURE;
-    }
-    else ATH_MSG_DEBUG("retrieved MuonDetectorManager");
-    
-
-    // Set up ATLAS ID helper 
-    if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) {
-      ATH_MSG_ERROR ("Could not get AtlasDetectorID helper" );
-      return StatusCode::FAILURE;
-    }    
-    m_measTypeIdHelper=new Trk::MeasurementTypeID(m_idHelper);
-
-    // set up MuonIdHelperTool
-    if (m_muonIdHelperTool.retrieve().isSuccess()) 
-      ATH_MSG_INFO("Retrieved  "<<m_muonIdHelperTool);
-    else {
-      ATH_MSG_FATAL("Could not get MuonIdHelperTool!");
-      return StatusCode::FAILURE;
-    }    
-
-    Trk::ParticleSwitcher particleSwitch;
-    m_particleHypothesis = particleSwitch.particle[m_particleNumber];
-    ATH_MSG_INFO("ParticleNumber: "     << m_particleNumber);
-    ATH_MSG_INFO("ParticleHypothesis: " << m_particleHypothesis);
-    
-    // get track fitter tools
-    if (!m_refitTracks && (m_trackFitterTool || m_SLTrackFitterTool)) {
-      ATH_MSG_WARNING("Track fitter tool specified but RefitTracks false.  Check configuration.");
-    }
-    
-    //check overlap configuration
-    if(m_requireSectorOverlap && m_sector1==0 && m_sector2==0){
-      ATH_MSG_FATAL("Sector overlap required but no sectors specified.");
-      return StatusCode::FAILURE;
-    }
-
-
-    //get track selector tools
-    //if(m_trackSelectorTools.retrieve().isSuccess()){
-    //  for (unsigned int k=0; k<m_trackSelectorTools.size(); k++){
-    //    ATH_MSG_INFO("Retrieved  "<<m_trackSelectorTools[k]);
-    //  }
-    //}
-    //else{
-    //  ATH_MSG_FATAL("Could not get TrackSelectorTools!");
-    //  return StatusCode::FAILURE;
-    //}
-    
-    if (m_refitTracks) {
-      if (m_trackFitterTool.retrieve().isSuccess()) {
-	ATH_MSG_INFO("Retrieved " << m_trackFitterTool);
-      }
-      else{
-	ATH_MSG_FATAL("Could not get " << m_trackFitterTool);
-	return StatusCode::FAILURE;
-      }
-      
-      if (m_SLTrackFitterTool.retrieve().isSuccess()) {
-	ATH_MSG_INFO("Retrieved " << m_SLTrackFitterTool);
-      }
-      else{
-	ATH_MSG_FATAL("Could not get " << m_SLTrackFitterTool); 
-	return StatusCode::FAILURE;
-      }          
-    }
-
-    /* problems with Eigen migration!!!
-    // need to know which TrackingVolume we are in: indet/calo/spectrometer
-    if (m_trackingVolumesSvc.retrieve().isFailure())
-      {
-        ATH_MSG_FATAL( "Failed to retrieve Svc " << m_trackingVolumesSvc );
-        return StatusCode::FAILURE;
-      } 
-    else
-    {
-      ATH_MSG_INFO( "Retrieved Svc " << m_trackingVolumesSvc );
-      m_msVolume    = 0;//rdh migrate to Eigen!!! new Trk::Volume(m_trackingVolumesSvc->volume(ITrackingVolumesSvc::MuonSpectrometerExitLayer));
-      m_calVolume   = 0;//rdh migrate to Eigen!!! new Trk::Volume(m_trackingVolumesSvc->volume(ITrackingVolumesSvc::MuonSpectrometerEntryLayer));
-      m_indetVolume = 0;//rdh migrate to Eigen!!! new Trk::Volume(m_trackingVolumesSvc->volume(ITrackingVolumesSvc::CalorimeterEntryLayer));
-    }
-    */
-
-    if (m_pullCalculator.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_pullCalculator);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_pullCalculator);
-      return StatusCode::FAILURE;
-    }
-
-    if (m_segmentTrackBuilder.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_segmentTrackBuilder);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_segmentTrackBuilder); 
-      return StatusCode::FAILURE;
-    }
-    
-    /** muonAlignRefitTool */
-    if (m_muonAlignRefitTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved "<<m_muonAlignRefitTool);
-    else {
-      ATH_MSG_FATAL("Could not get "<<m_muonAlignRefitTool);
-      return StatusCode::FAILURE;
-    }    
-
-    /** muonAlignHelperTool */
-    if (m_muonAlignHelperTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved "<<m_muonAlignHelperTool);
-    else {
-      ATH_MSG_FATAL("Could not get "<<m_muonAlignHelperTool);
-      return StatusCode::FAILURE;
-    }    
-
-    /** MuonEDMPrinterTool */
-    if (m_printer.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved "<<m_printer);
-    else {
-      ATH_MSG_WARNING("Could not get "<<m_printer);
-      return StatusCode::FAILURE;
-    }
-
-    return StatusCode::SUCCESS;
-  }
-  
-  //________________________________________________________________________
-  StatusCode MuonTrackPreProcessor::finalize()
-  {
-
-    // cut flow
-    std::vector<std::string> names;
-    std::vector<int>    npass;
-    names.push_back("ProcessedTracks");
-    names.push_back("HitRemoval");
-    names.push_back("TGCHitRemoval");
-    names.push_back("ProcessedTrackSelection");
-    names.push_back("BarrelECOverlap");
-    names.push_back("NMdtHits");
-    names.push_back("NLayers");
-    names.push_back("TrackChi2");
-    names.push_back("Momentum");
-    names.push_back("D0");
-    names.push_back("Z0");
-    names.push_back("StandardCuts");
-    names.push_back("BarrelVeto");
-    names.push_back("InnerLayer");
-    names.push_back("OuterLayer");
-    names.push_back("SmallLargeOverlap");
-    names.push_back("SectorOverlap");
-    names.push_back("MinChambers");
-    names.push_back("MinSmallChambers");
-    names.push_back("MinLargeChambers");
-    names.push_back("RpcPhiHit");
-    names.push_back("TubeLayersEC");
-    names.push_back("TubeLayersBarrel");
-    names.push_back("DriftSignSumEC");
-    names.push_back("DriftSignSumBarrel");
-    names.push_back("TrackRefit");
-    names.push_back("TrackChi2");
-    names.push_back("Outliers");
-    names.push_back("Holes");
-    
-    std::cout<<"\nCUT FLOW:" << "\n________\n"<<std::endl;
-    npass.push_back(m_nProcessed);    
-    npass.push_back(m_nPassHitRemoval);    
-    npass.push_back(m_nPassTGCHitRemoval);    
-    npass.push_back(m_nProcessTrackSelection);
-    npass.push_back(m_nPassBarrelECOverlap);
-    npass.push_back(m_nPassNMdtHits);
-    npass.push_back(m_nPassNLayers);
-    npass.push_back(m_nPassTrackChi2);
-    npass.push_back(m_nPassMomentum);
-    npass.push_back(m_nPassD0);
-    npass.push_back(m_nPassZ0);
-    npass.push_back(m_nPassStandardTrackSel);
-    npass.push_back(m_nPassBarrelVeto);
-    npass.push_back(m_nPassInnerLayer);
-    npass.push_back(m_nPassOuterLayer);
-    npass.push_back(m_nPassSmallLargeOverlap);
-    npass.push_back(m_nPassSectorOverlap);
-    npass.push_back(m_nPassMinChambers);
-    npass.push_back(m_nPassMinSmallChambers);
-    npass.push_back(m_nPassMinLargeChambers);
-    npass.push_back(m_nPassRPCPhiHit);
-    npass.push_back(m_nPassTubeLayerEC);
-    npass.push_back(m_nPassTubeLayerBarrel);
-    npass.push_back(m_nPassDriftSignSumEC);
-    npass.push_back(m_nPassDriftSignSumBarrel);
-    npass.push_back(m_nPassTrackRefit);
-    npass.push_back(m_nPassTrackChi2Cut);
-    npass.push_back(m_nPassOutlierCut);
-    npass.push_back(m_nPassHoleCut);
-        
-    for (int j=0;j<(int)names.size();j++) {
-      std::cout << std::resetiosflags(std::ios::adjustfield)
-		<< std::setiosflags(std::ios::left)
-		<< std::setw(20)
-		<< names[j]
-		<< std::resetiosflags(std::ios::adjustfield)
-		<< std::setiosflags(std::ios::right)
-		<< std::setw(6)
-		<< npass[j]
-		<< "  ";
-      
-      if (j>0 && npass[j-1]>0 && npass[0]>0) {
-	std::cout << std::setw(6)
-		  << std::setprecision(3)
-		  << npass[j]/(double)npass[j-1]
-		  << "  "
-		  << std::setw(6)
-		  << std::setprecision(3)
-		  << npass[j]/(double)npass[0]
-		  << std::endl;
-      }
-      else std::cout << std::endl;
-    }
-    
-    std::cout << std::endl;
-    
-    delete m_measTypeIdHelper;
-
-    //delete m_msVolume;
-    //delete m_calVolume;
-    //delete m_indetVolume;
-    
-    return StatusCode::SUCCESS;
-  }
-
-  //________________________________________________________________________
-  StatusCode MuonTrackPreProcessor::fillNtuple()
-  {
-
-    int success=1;
-    if (m_tree && m_ntuple) {
-      ATH_MSG_DEBUG("in finalize, writing tree");
-      m_ntuple->cd();
-      success=m_tree->Write();
-    }
-    return success>0 ? StatusCode::SUCCESS : StatusCode::FAILURE;
-  }
-
-  //________________________________________________________________________
-  DataVector<Trk::Track>* 
-  MuonTrackPreProcessor::processTrackCollection(const DataVector<Trk::Track>* tracks) 
-  {
-    if (!m_tree && m_ntuple) createTree();
-
-    //get combined muons, find muon 
-    const Analysis::MuonContainer* muons = 0; 
-    if(m_selectCombinedMuons) {
-      if (evtStore()->contains<Analysis::MuonContainer>(m_muonContainer)) {
-	StatusCode sc = evtStore()->retrieve(muons,m_muonContainer);
-	if (sc.isFailure()) {	  
-	  ATH_MSG_WARNING("No Collection with name "<<m_muonContainer<<" found in StoreGate");
-	  return 0;
-	}
-      } 
-      else {
-	ATH_MSG_DEBUG("StoreGate does not contain Collection with name "<<m_muonContainer);
-	return 0;
-      }
-    }
-
-    // the output collection of AlignTracks
-    // we define it as collection of Tracks but fill AlignTracks inside
-    DataVector<Trk::Track>* alignTracks = new DataVector<Trk::Track>;
-
-    // loop over tracks and create AlignTracks
-    TrackCollection::const_iterator it     = tracks->begin();
-    TrackCollection::const_iterator it_end = tracks->end();
-    int itrack(0);
-    for ( ;	it != it_end ; ++it,itrack++) {
-
-      ATH_MSG_DEBUG("\ntrack "<<itrack<<"/"<<tracks->size());
-
-      const Trk::Track* origTrack=*it;    
-      const Trk::Track* track=0;
-
-      ATH_MSG_DEBUG("original track nDoF: "<<origTrack->fitQuality()->numberDoF());
-
-      // get track fitter
-      bool isSLTrack = Trk::AlignTrack::isSLTrack(origTrack);
-      ToolHandle<Trk::ITrackFitter> fitter = isSLTrack ? m_SLTrackFitterTool : m_trackFitterTool;
-      
-      // get qOverP from 1st TSOS on track
-      double qOverP=0.;
-      if (m_pTCorrectTrack) {
-	const DataVector<const Trk::TrackStateOnSurface>* tsos=
-	  origTrack->trackStateOnSurfaces();
-
-	if ( !(tsos->empty()) ) {
-          const Trk::TrackStateOnSurface* iTsos=tsos->front();
-	  ATH_MSG_DEBUG("tsos: "<<*iTsos);
-	  qOverP=iTsos->trackParameters()->parameters()[Trk::qOverP];
-	  ATH_MSG_DEBUG("qOverP: "<<qOverP<<", 1/qOverP: "<<1./qOverP);
-	}
-
-      }
-
-      if (msgLvl(MSG::VERBOSE)) {
-	ATH_MSG_VERBOSE("refitting original track for debugging");
-	const Trk::Track* tmpTrack=origTrack;
-        if (m_pTCorrectTrack) {
-	  ATH_MSG_DEBUG("calling pTCorrectTrack with qOverP: "<<qOverP);
-	  tmpTrack=m_muonAlignRefitTool->pTCorrectTrack(*origTrack,qOverP,true);
-	}
-	fitter->fit(*tmpTrack,false,Trk::muon);
-	if (m_pTCorrectTrack) delete tmpTrack;
-      }
-      
-      m_nProcessed++;
-      
-      ATH_MSG_DEBUG("before removing hits: ");
-      ATH_MSG_DEBUG(m_printer->print(*origTrack)<<"\n"<<
-		    m_printer->printStations(*origTrack)<<"\n"<<
-		    m_printer->printMeasurements(*origTrack));
-		    
-      /*      
-      if (m_removePerigeeBeforeRefit ||
-	  m_removeTGCHits       || m_removeTRTHits || m_removeCSCHits || 
-          m_removeScattererTSOS || m_removeBarrelMuon || m_removeBEEHits || m_removeEEHits ||
-	  m_removeSmallBarrelHits || m_removeSpoiledCSCHits || m_removeCSCPhiHits ||
-          m_removeTGCEtaHits || m_removeRPCEtaHits) {
-	ATH_MSG_DEBUG("calling removeHits");
-	track=removeHits(*origTrack); //rdh perigee,scatterer
-      */
-
-      // remove hits for badly aligned chambers
-      ATH_MSG_DEBUG("calling prepareHitsOnTrack");
-      track=m_muonAlignRefitTool->prepareHitsOnTrack(*origTrack);
-      if (!track) {
-	ATH_MSG_DEBUG("failed removeHits");
-	continue; 
-      }
-      m_nPassHitRemoval++;
-      
-      // refit track
-      const Trk::Track* oldTrack=track;
-      ATH_MSG_DEBUG("before calling refitForAlignment: ");
-      ATH_MSG_DEBUG(m_printer->print(*oldTrack)<<"\n"<<
-		    m_printer->printStations(*oldTrack)<<"\n"<<
-		    m_printer->printMeasurements(*oldTrack));
-
-      ATH_MSG_DEBUG("calling refitForAlignment");
-      track=m_muonAlignRefitTool->refitForAlignment(*oldTrack);
-      delete oldTrack;
-      if (!track) {
-	ATH_MSG_INFO("failed track refit");
-	continue;
-      }
-
-      // correct pT of track (this may not be necessary with new MuonRefitTool)
-      if (m_pTCorrectTrack) {
-	oldTrack=track;
-	ATH_MSG_DEBUG("getting pTCorrectTrack with qOverP: "<<qOverP);
-	track=m_muonAlignRefitTool->pTCorrectTrack(*oldTrack,qOverP,true);
-	delete oldTrack;
-	if (!track) {
-	  ATH_MSG_DEBUG("failed pTCorrectTrack");
-	  continue;
-	}
-      }
-
-      // check if track passes standard selection
-      if (!passesStandardTrackSelection(*track)) {
-	if (track!=origTrack) delete track;
-	continue;
-      }
-      m_nPassStandardTrackSel++;
-
-      // check if track passes initial track selection
-      if (!passesInitTrackSelection(*track)) {
-	if (track!=origTrack) {
-	  ATH_MSG_DEBUG("deleting track");
-	  delete track;
-	}
-	continue;
-      }
-      m_nPassInitTrackSel++;
-            
-      // refit track with local fitter to get derivatives   
-      Trk::AlignTrack* alignTrack(0);
-      if (track) {
-	if (!track->perigeeParameters()) ATH_MSG_DEBUG("track has no perigee");
-	ATH_MSG_DEBUG("creating alignTrack");
-	alignTrack=refitTrack(*track);		
-      }
-      
-      if (track!=origTrack) delete track;
-      
-      // go to next track if track refit refails
-      if (!alignTrack) {
-	ATH_MSG_DEBUG("track refit failed");
-	continue;
-      }
-      m_nPassTrackRefit++;
-
-      // dump chamber names
-      //if (msgLvl(MSG::DEBUG)) dumpChamberNames(*alignTrack);
-
-      if (!origTrack->perigeeParameters()) ATH_MSG_DEBUG("no perigee parameters for orig track!");
-      alignTrack->setOriginalTrack(origTrack);
-     
-      // check if track passes final track selection
-      if (!passesFinalTrackSelection(*alignTrack)) {
-	delete alignTrack; 
-	continue;
-      }      
-
-      m_nPassFinalTrackSel++;
-      
-      // pT cut
-      if (!m_pTCorrectTrack) {
-	double pT=alignTrack->perigeeParameters()->pT();
-	ATH_MSG_DEBUG("pT="<<pT);      
-	if (pT>500000.) {
-	  ATH_MSG_DEBUG("pT="<<pT<<", too high! (cut at 500 GeV)");
-	  //continue;
-	}
-      }
-
-      if (m_selectCombinedMuons) {
-
-        // see if passes pTDiff cut
-        bool passesPtDiffCut=false;
-   
-        if (muons->size()>1) ATH_MSG_WARNING("Need to implement selection to get correct muon!");
-
-        for (Analysis::MuonContainer::const_iterator muonItr=muons->begin(); 
-             muonItr != muons->end(); ++muonItr) {
-
-          if (m_selectCombinedMuons && 
-              !(*muonItr)->hasCombinedMuonTrackParticle()) {
-            ATH_MSG_DEBUG("no combinedMuonTrackParticle!");
-            continue;
-          }
-	
-          double idPt = (*muonItr)->hasInDetTrackParticle() ? 
-            (*muonItr)->inDetTrackParticle()->pt() : 0.;
-          ATH_MSG_DEBUG("idPt: "<<idPt);
-
-	  // put cuts: 1 pixel, 5 SCT
-
-          double msExtrapPt = (*muonItr)->muonExtrapolatedTrackParticle() ? 
-            (*muonItr)->muonExtrapolatedTrackParticle()->pt() : 0.;
-          ATH_MSG_DEBUG("msExtrapPt: "<<msExtrapPt);
-	
-          double ptDiff = std::fabs(msExtrapPt/idPt-1.);
-          ATH_MSG_DEBUG("pT diff="<<ptDiff);
-		
-          if (ptDiff<m_MSID_ptDiffCut) passesPtDiffCut = true;	
-        }
-      
-        if (!passesPtDiffCut) {
-	  ATH_MSG_DEBUG("fails ptDiff cut");
-          delete alignTrack;
-          continue;
-        }
-      }
-      
-      ATH_MSG_DEBUG("after refit and passing final selection: ");
-      ATH_MSG_DEBUG(m_printer->print(*alignTrack)<<"\n"<<
-		    m_printer->printStations(*alignTrack)<<"\n"<<
-		    m_printer->printMeasurements(*alignTrack));
-
-
-      // get run and event numbers
-      ATH_MSG_DEBUG("Retrieving event info.");
-      const xAOD::EventInfo* eventInfo;
-      StatusCode sc = m_storeGate->retrieve(eventInfo);
-      if (sc.isFailure()) {
-	ATH_MSG_ERROR("Could not retrieve event info.");
-      }
-      m_runNumber = eventInfo->runNumber();
-      m_evtNumber = eventInfo->eventNumber();
-      
-
-      // calculate chi2
-      calculateTrackChi2(alignTrack);
-
-      // fill tree
-      if (m_ntuple) {
-	m_ntuple->cd();
-	m_tree->Fill();
-      }
-
-      // add to alignTracks
-      alignTracks->push_back(alignTrack);
-      
-      // dump some track information
-      /*
-      if (msgLvl(MSG::DEBUG)) {// && !msgLvl(MSG::VERBOSE)) {
-	ATH_MSG_DEBUG("before refit and hit removal: ");
-	Trk::AlignTrack::dumpLessTrackInfo(*origTrack,msg(MSG::DEBUG));
-	ATH_MSG_DEBUG("after refit: ");
-	Trk::AlignTrack::dumpLessTrackInfo(*alignTrack,msg(MSG::DEBUG));
-	ATH_MSG_DEBUG(" ");
-      */      
-    }
-    return alignTracks;
-  }  
-
-  //________________________________________________________________________
-  bool MuonTrackPreProcessor::passesStandardTrackSelection(const Trk::Track& track) 
-  {
-    ATH_MSG_DEBUG("in passesStandardTrackSelection");
-
-    int nBIS8Hits=0;
-    int nECLayerHits[4]={0,0,0,0};
-    int nBarrelLayerHits[4]={0,0,0,0};
-    
-    // search first valid TSOS first    
-    const DataVector<const Trk::TrackStateOnSurface>* oldTSOS=track.trackStateOnSurfaces();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=oldTSOS->begin(); 
-    for (iTsos=oldTSOS->begin(); iTsos!=oldTSOS->end(); ++iTsos) {
-
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) {
-	
-	// get measurement, continue if hit to be removed
-	const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();      
-	const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=&crio->rioOnTrack(0);
-	if (!rio) continue;
-	
-	Identifier detId=rio->detectorElement()->identify();
-	//Identifier rioId=rio->identify();
-	if (!m_muonIdHelperTool->isMuon(detId))  continue;
-	
-	// variables needed for MDT checks
-	bool       isMdt=m_muonIdHelperTool->isMdt(detId);
-	bool       isCsc=m_muonIdHelperTool->isCsc(detId);
-	int        stationLayer(3);
-	
-	if (isMdt)	    
-	  stationLayer = (int)m_muonAlignHelperTool->getMdtStatLayer(detId);
-	else if (isCsc)
-	  stationLayer = 0;
-
-	// barrel selection
-	if (!isEndcap(detId) && !isBIS8(detId)) {
-	  
-	  if (isMdt) 
-	    nBarrelLayerHits[stationLayer]++;
-	    
-	}
-	// selection cuts specific to endcap
-	else {
-	  
-	  if (isMdt) { 
-	    nECLayerHits[stationLayer]++;
-	    if (isBIS8(detId)) nBIS8Hits++;
-	  }
-	  else if (isCsc)
-	    nECLayerHits[stationLayer]++;
-
-	} // EC checks
-	
-      } // measurement checks     
-    } // end loop over TSOS
-
-    double chiSq=track.fitQuality()->chiSquared()/
-      (double)track.fitQuality()->numberDoF();
-
-    
-    //int trackNDoF = track.fitQuality()->numberDoF();    
-    double d0(0.),z0(0.),pT(-99999.),eta(-999.),momentum(-99999.);
-    
-    ATH_MSG_DEBUG("getting d0/z0...");
-
-    if (!m_pTCorrectTrack) {
-      if (!track.perigeeParameters()) ATH_MSG_ERROR("no perigee parameters!");
-      d0=track.perigeeParameters()->parameters()[Trk::d0];
-      z0=track.perigeeParameters()->parameters()[Trk::z0];
-      pT=track.perigeeParameters()->pT();
-      eta=track.perigeeParameters()->eta();
-      momentum=std::fabs(pT)*std::sqrt(1.+sinh(eta)*sinh(eta));
-    }
-
-    //
-    // check selections all at once
-    //
-    ATH_MSG_DEBUG("checking layer hits");
-
-    int nECHits    =nECLayerHits[0]+nECLayerHits[1]+nECLayerHits[2]+nECLayerHits[3];
-    int nBarrelHits=nBarrelLayerHits[0]+nBarrelLayerHits[1]+nBarrelLayerHits[2];
-
-    ATH_MSG_DEBUG("EC: "<<nECHits<<", Barrel: "<<nBarrelHits);
-    ATH_MSG_DEBUG("EC[3]: "<<nECLayerHits[3]<<", Barrel[3]: "<<nBarrelLayerHits[3]);
-    m_nProcessTrackSelection++;
-
-    if (m_requireBarrelECOverlap && (nECHits==0 || nBarrelHits==0)) {
-      ATH_MSG_DEBUG("failed barrel-EC overlap");
-      return false;
-    }
-    m_nPassBarrelECOverlap++;
-
-    if (!m_applyStandardSelectionCuts) {
-      ATH_MSG_DEBUG("returning without applying standard selection cuts");
-      return true;
-    }
-    
-    // cut on number MDT hits
-    if (nECHits+nBarrelHits < 17) {
-      ATH_MSG_DEBUG("fail # MDT hits with "<<nECHits<<" EC and "<<nBarrelHits<<" Barrel");
-      return 0;
-    }
-    m_nPassNMdtHits++;
-    
-    ATH_MSG_DEBUG("cut on number layers");
-
-    // cut on number of layers
-    if (nECLayerHits[3]<4 && nBIS8Hits==0 && 
-	(nECLayerHits[0]+nBarrelLayerHits[0]<6 || 
-	 (nECLayerHits[1]+nBarrelLayerHits[1]<4) || 
-	 nECLayerHits[2]+nBarrelLayerHits[2]<4)) {
-      ATH_MSG_DEBUG("failed # layers with "<<nECLayerHits[0]+nBarrelLayerHits[0]<<" inner, "<<
-		    nECLayerHits[1]+nBarrelLayerHits[1]<<" middle, "<<
-		    nECLayerHits[2]+nBarrelLayerHits[2]<<" outer, "<<
-		    nECLayerHits[3]<<" other");
-      return 0; 
-    }
-    m_nPassNLayers++;
-    
-    // track chi2 cut
-    if (chiSq > 3.) {
-      ATH_MSG_DEBUG("failed track chi2 cut with chiSq/nDoF="<<chiSq);
-      return 0;
-    }
-    m_nPassTrackChi2++;
-
-    // if perigee removed from track, bypass remaining cuts, which don't make sense 
-    // since we don't know them
-    if (m_pTCorrectTrack) return true;
-
-    // momentum cut
-    if (momentum<5000.) {
-      ATH_MSG_DEBUG("failed momentum cut with "<<momentum/1000.<<" GeV");
-      return 0.;
-    }
-    m_nPassMomentum++;
-
-    // d0 cut
-    if (std::fabs(d0)>1000.) {
-      ATH_MSG_DEBUG("failed d0 cut with "<<std::fabs(d0));
-      return 0;
-    }
-    m_nPassD0++;
-
-    // z0 cut
-    if (std::fabs(z0)>2000.) {
-      ATH_MSG_DEBUG("failed z0 cut with "<<std::fabs(z0));
-      return 0;
-    }
-    m_nPassZ0++;
-
-    return true;
-
-  }
-  //________________________________________________________________________
-  bool MuonTrackPreProcessor::passesInitTrackSelection(const Trk::Track& /*track*/) 
-  {
-    ATH_MSG_ERROR("migrate passesInitTrackSelection to Eigen");
-    return false;
-
-    /*
-    ATH_MSG_DEBUG("in passesInitTrackSelection");
-
-    bool hasBarrelHit     =false;
-    bool hasEndcapHit     =false;
-    bool hitsSmallChamber =false;
-    bool hitsLargeChamber =false;
-    bool hitsFirstSector  =false;
-    bool hitsSecondSector =false;
-    bool hasRPCPhiHit     =false;
-
-    int nECLayerHits[4]={0,0,0,0};
-    int nBarrelLayerHits[4]={0,0,0,0};
-
-    std::map<Identifier, std::vector<Identifier> > endcapTubeLayerIdMap; 
-    std::map<Identifier, std::vector<Identifier> > barrelTubeLayerIdMap; 
-    std::map<Identifier, std::vector<int> >        endcapDriftSignSumMap; 
-    std::map<Identifier, std::vector<int> >        barrelDriftSignSumMap; 
-    std::map<Identifier, std::vector<int> >        endcapDriftSignNHitsMap; 
-    std::map<Identifier, std::vector<int> >        barrelDriftSignNHitsMap; 
-
-    std::vector<Identifier> chamberIDs;
-    std::vector<Identifier> smallChamberIDs;
-    std::vector<Identifier> largeChamberIDs;
-    
-    // search first valid TSOS first    
-    m_nChambers=-1;
-    Amg::Vector3D avgBeePos(0.,0.,0.);
-    int nBeeHits(0);
-    Trk::Surface* beeSurf(0);
-    m_beePosX=m_beePosY=-9999.;
-    
-    const DataVector<const Trk::TrackStateOnSurface>* oldTSOS=track.trackStateOnSurfaces();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=oldTSOS->begin(); 
-    for (iTsos=oldTSOS->begin(); iTsos!=oldTSOS->end(); ++iTsos) {
-      
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) {
-	
-	// get measurement, continue if hit to be removed
-	const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();      
-	const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=&crio->rioOnTrack(0);
-	if (!rio) continue;
-	
-	Identifier detId=rio->detectorElement()->identify();
-	Identifier rioId=rio->identify();
-	if (!m_muonIdHelperTool->isMuon(detId))  continue;
-	
-	// variables needed for MDT checks
-	bool       isMdt=m_muonIdHelperTool->isMdt(detId);
-	Identifier chamberId(0);
-	Identifier tubeLayerId(0);
-	int        driftSign(0);
-	int        multilayer(0);
-	int        stationLayer(3);
-
-	if (isMdt) {	    
-	  
-	  chamberId    = m_muonIdHelperTool->chamberId(detId);
-	  tubeLayerId  = m_muonIdHelperTool->gasGapId(rioId);
-	  driftSign    = rio->localParameters()[Trk::driftRadius] > 0. ? 1 : -1;
-	  multilayer   = m_muonIdHelperTool->mdtIdHelper().multilayer(rioId)-1;
-	  stationLayer = getMdtStatLayer(detId);
-	  ATH_MSG_VERBOSE("chamberId: "<<chamberId<<", tubeLayerId: "<<tubeLayerId<<", multilayer: "<<multilayer);
-	  
-	  // check small or large chamber
-	  bool isSmall=m_muonIdHelperTool->isSmallChamber(detId);
-	  if (isSmall) hitsSmallChamber = true;
-	  else         hitsLargeChamber = true;	    
-	  
-	  // check sector hit
-	  int sector=m_muonIdHelperTool->sector(detId)-1;
-	  if (sector==m_sector1) hitsFirstSector =true;
-	  if (sector==m_sector2) hitsSecondSector=true;
-	  
-	  // count number of chambers (incl. small and large)	
-	  if (std::find(chamberIDs.begin(),chamberIDs.end(),chamberId)
-	      ==chamberIDs.end()) {
-	    chamberIDs.push_back(chamberId);
-	  }
-	  if (m_muonIdHelperTool->isSmallChamber(detId)) {
-	    if (std::find(smallChamberIDs.begin(),smallChamberIDs.end(),chamberId)
-		==smallChamberIDs.end()) {
-	      smallChamberIDs.push_back(chamberId);
-	    }
-	  }
-	  else {
-	    if (std::find(largeChamberIDs.begin(),largeChamberIDs.end(),chamberId)
-		==largeChamberIDs.end()) {
-	      largeChamberIDs.push_back(chamberId);
-	    }
-	  }
-
-	  // BEE hits
-	  if (m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(detId)).substr(0,3)=="BEE") {
-	    const Amg::Vector3D globPos=rio->globalPosition();
-	    avgBeePos += globPos;
-	    nBeeHits++;	    
-	    if (!beeSurf) beeSurf=rio->associatedSurface().associatedDetectorElement()->surface().clone();
-	  }
-	} // MDT checks 
-	
-	// barrel selection
-	if (!isEndcap(detId) && !isBIS8(detId)) {
-
-	  hasBarrelHit=true;
-
-	  nBarrelLayerHits[stationLayer]++;
-
-	  if (isMdt) {
-	    // count barrel tube layers
-	    std::map<Identifier, std::vector<Identifier> >::iterator tubeLayerVec = 
-	      barrelTubeLayerIdMap.find(chamberId);
-	    if (tubeLayerVec==barrelTubeLayerIdMap.end()) {
-	      std::vector<Identifier> ids; ids.push_back(tubeLayerId);
-	      barrelTubeLayerIdMap.insert(std::pair<Identifier, std::vector<Identifier> >(chamberId,ids));
-	    }
-	    else {
-	      if (std::find(tubeLayerVec->second.begin(),tubeLayerVec->second.end(),tubeLayerId)==
-		  tubeLayerVec->second.end()) {
-		tubeLayerVec->second.push_back(tubeLayerId);
-	      }
-	    }
-	    
-	    
-	    // check drift sign sum per multilayer
-	    std::map<Identifier, std::vector<int> >::iterator driftSignSumIt = 
-	      barrelDriftSignSumMap.find(chamberId);
-	    std::map<Identifier, std::vector<int> >::iterator driftSignNHitsIt = 
-	      barrelDriftSignNHitsMap.find(chamberId);
-	    if (driftSignSumIt==barrelDriftSignSumMap.end()) {
-	      
-	      // create vector with 2 zeros (one for each multilayer)
-	      std::vector<int> driftSigns; driftSigns.push_back(0); driftSigns.push_back(0);
-	      std::vector<int> nHits;      nHits.push_back(0);      nHits.push_back(0);
-	      barrelDriftSignSumMap.insert(std::pair<Identifier, std::vector<int> >(chamberId,driftSigns)); 
-	      barrelDriftSignNHitsMap.insert(std::pair<Identifier, std::vector<int> >(chamberId,nHits)); 
-	      driftSignSumIt   = barrelDriftSignSumMap.find(chamberId);
-	      driftSignNHitsIt = barrelDriftSignNHitsMap.find(chamberId);
-	    }	      
-
-	    // add drift sign to appropriate multilayer entry
-	    driftSignSumIt->second[multilayer] += driftSign;
-	    driftSignNHitsIt->second[multilayer]++;
-
-	  } // MDT checks
-          
-          if (m_requireRPCPhiHit && !hasRPCPhiHit) {
-            if (m_muonIdHelperTool->isRpc(detId)) {
-              if (m_muonIdHelperTool->measuresPhi(rioId)) {
-                hasRPCPhiHit = true;
-              }
-            }
-          }
-
-	} // Barrel checks
-	
-	// selection cuts specific to endcap
-	else {
-
-	  hasEndcapHit=true;
-
-	  if (isMdt) {
-	    nECLayerHits[stationLayer]++;
-	    
-	    std::map<Identifier, std::vector<Identifier> >::iterator tubeLayerVec = 
-	      endcapTubeLayerIdMap.find(chamberId);
-	    if (tubeLayerVec==endcapTubeLayerIdMap.end()) {
-	      std::vector<Identifier> ids; ids.push_back(tubeLayerId);
-	      endcapTubeLayerIdMap.insert(std::pair<Identifier, std::vector<Identifier> >(chamberId,ids));
-	    }
-	    else {
-	      if (std::find(tubeLayerVec->second.begin(),tubeLayerVec->second.end(),tubeLayerId)==
-		  tubeLayerVec->second.end()) {
-		tubeLayerVec->second.push_back(tubeLayerId);
-	      }
-	    }
-	    
-	    // check drift sign sum per multilayer
-	    std::map<Identifier, std::vector<int> >::iterator driftSignSumIt = 
-	      endcapDriftSignSumMap.find(chamberId);
-	    std::map<Identifier, std::vector<int> >::iterator driftSignNHitsIt = 
-	      endcapDriftSignNHitsMap.find(chamberId);
-	    if (driftSignSumIt==endcapDriftSignSumMap.end()) {
-	      
-	      // create vector with 2 zeros (one for each multilayer)
-	      std::vector<int> driftSigns; driftSigns.push_back(0); driftSigns.push_back(0);
-	      std::vector<int> nHits;      nHits.push_back(0);      nHits.push_back(0);
-	      endcapDriftSignSumMap.insert(std::pair<Identifier, std::vector<int> >(chamberId,driftSigns)); 
-	      endcapDriftSignNHitsMap.insert(std::pair<Identifier, std::vector<int> >(chamberId,nHits));
-	      driftSignSumIt   = endcapDriftSignSumMap.find(chamberId);
-	      driftSignNHitsIt = endcapDriftSignNHitsMap.find(chamberId);
-	    }	      
-
-	    // add drift sign to appropriate multilayer entry
-	    driftSignSumIt->second[multilayer] += driftSign;   
-	    driftSignNHitsIt->second[multilayer]++;   
-
-	  } // MDT checks  	  
-	} // EC checks
-      } // measurement checks     
-    } // end loop over TSOS
-
-    // average BEE position
-    if (nBeeHits>0) {
-      avgBeePos/=(double)nBeeHits;
-      const Amg::Vector2D* locPos=beeSurf->positionOnSurface(avgBeePos,false,1000.);
-      m_beePosX=locPos->get(Trk::locX);
-      m_beePosY=locPos->get(Trk::locY);
-      delete beeSurf;
-      delete locPos;
-    }
-
-    // check tube layers hit
-    int nTubeLayersHitEC[4]={0,0,0,0}; // inner,middle,outer,other
-    std::map<Identifier, std::vector<Identifier> >::const_iterator it   =endcapTubeLayerIdMap.begin();
-    std::map<Identifier, std::vector<Identifier> >::const_iterator itend=endcapTubeLayerIdMap.end();    
-    for (; it!=itend; ++it) {	
-      int statLayer=getMdtStatLayer(it->first);
-      nTubeLayersHitEC[statLayer] += it->second.size();
-    }
-    
-    int nTubeLayersHitBarrel[4]={0,0,0,0}; 
-    it   =endcapTubeLayerIdMap.begin();
-    itend=endcapTubeLayerIdMap.end();   
-    for (; it!=itend; ++it) {	
-      int statLayer=getMdtStatLayer(it->first);
-      nTubeLayersHitBarrel[statLayer] += it->second.size();
-    }
-    
-    // check drift sign sums
-    double maxDriftSignSumEC[4]={0.,0.,0.,0.};    
-    std::map<Identifier, std::vector<int> >::const_iterator driftSignSumIt = 
-      endcapDriftSignSumMap.begin();
-    std::map<Identifier, std::vector<int> >::const_iterator driftSignSumItEnd = 
-      endcapDriftSignSumMap.end();      
-    std::map<Identifier, std::vector<int> >::const_iterator driftSignNHitsIt = 
-      endcapDriftSignNHitsMap.begin();
-    for (; driftSignSumIt!=driftSignSumItEnd;++driftSignSumIt,++driftSignNHitsIt) {	
-      int statLayer=getMdtStatLayer(driftSignSumIt->first);
-      int nhits0=driftSignNHitsIt->second[0];
-      int nhits1=driftSignNHitsIt->second[1];
-      double driftSignSum0 = (nhits0>0) ? (double)driftSignSumIt->second[0]/(double)nhits0 : 0.;
-      double driftSignSum1 = (nhits1>0) ? (double)driftSignSumIt->second[1]/(double)nhits1 : 0.;
-      if (driftSignSum0>maxDriftSignSumEC[statLayer])
-	maxDriftSignSumEC[statLayer]=std::fabs(driftSignSum0);
-      if (driftSignSum1>maxDriftSignSumEC[statLayer])
-	maxDriftSignSumEC[statLayer]=std::fabs(driftSignSum1);
-    }
-    
-    double maxDriftSignSumBarrel[4]={0.,0.,0.,0.};    
-    driftSignSumIt    = barrelDriftSignSumMap.begin();
-    driftSignSumItEnd = barrelDriftSignSumMap.end();      
-    driftSignNHitsIt  = barrelDriftSignNHitsMap.begin();
-    for (; driftSignSumIt!=driftSignSumItEnd;++driftSignSumIt,++driftSignNHitsIt) {	
-      int statLayer=getMdtStatLayer(driftSignSumIt->first);
-      int nhits0=driftSignNHitsIt->second[0];
-      int nhits1=driftSignNHitsIt->second[1];
-      double driftSignSum0 = (nhits0>0) ? (double)driftSignSumIt->second[0]/(double)nhits0 : 0.;
-      double driftSignSum1 = (nhits1>0) ? (double)driftSignSumIt->second[1]/(double)nhits1 : 0.;
-      if (driftSignSum0>maxDriftSignSumBarrel[statLayer])
-	maxDriftSignSumBarrel[statLayer]=std::fabs(driftSignSum0);
-      if (driftSignSum1>maxDriftSignSumBarrel[statLayer])
-	maxDriftSignSumBarrel[statLayer]=std::fabs(driftSignSum1);
-    }
-    
-    // set variables for tree
-    m_nInnerLayersHit      = nECLayerHits[0]+nBarrelLayerHits[0];
-    m_nMiddleLayersHit     = nECLayerHits[1]+nBarrelLayerHits[1];
-    m_nOuterLayersHit      = nECLayerHits[2]+nBarrelLayerHits[2];
-    m_nOtherLayersHit      = nECLayerHits[3]+nBarrelLayerHits[3];
-    m_nTubeLayersHitInner  = nTubeLayersHitEC[0]+nTubeLayersHitBarrel[0];
-    m_nTubeLayersHitMiddle = nTubeLayersHitEC[1]+nTubeLayersHitBarrel[0];
-    m_nTubeLayersHitOuter  = nTubeLayersHitEC[2]+nTubeLayersHitBarrel[0];
-    m_nTubeLayersHitOther  = nTubeLayersHitEC[3]+nTubeLayersHitBarrel[0];
-    m_driftSignsInnerLayer = maxDriftSignSumEC[0];
-    m_driftSignsMiddleLayer= maxDriftSignSumEC[1];
-    m_driftSignsOuterLayer = maxDriftSignSumEC[2];
-    m_driftSignsOtherLayer = maxDriftSignSumEC[3];
-    
-    //
-    // check selections all at once
-    //    
-    if (!m_applySelectionCuts) return true;
-
-    if (m_cutOnBarrel                && hasBarrelHit                                  ) return 0; m_nPassBarrelVeto++;
-    if (m_requireInnerLayerEndcapMdt && nECLayerHits[0]==0                            ) return 0; m_nPassInnerLayer++;
-    if (m_requireOuterLayerEndcapMdt && nECLayerHits[2]==0                            ) return 0; m_nPassOuterLayer++;
-    if (m_requireSmallLargeOverlap   && (!hitsSmallChamber || !hitsLargeChamber)      ) return 0; m_nPassSmallLargeOverlap++;
-    if (m_requireSectorOverlap       && (!hitsFirstSector || !hitsSecondSector)       ) return 0; m_nPassSectorOverlap++;
-    if (m_minMdtChambers>0           && chamberIDs.size() < m_minMdtChambers          ) return 0; m_nPassMinChambers++;
-    if (m_minSmallMdtChambers>0      && smallChamberIDs.size() < m_minSmallMdtChambers) return 0; m_nPassMinSmallChambers++;
-    if (m_minLargeMdtChambers>0      && largeChamberIDs.size() < m_minLargeMdtChambers) return 0; m_nPassMinLargeChambers++;
-    if (m_requireRPCPhiHit           && !hasRPCPhiHit)  return false; m_nPassRPCPhiHit++;
-    
-    // check tube layers hit
-    if (m_requireOneHitPerTubeLayerEC && nTubeLayersHitEC[3] == 0 && 
-	(nTubeLayersHitEC[0] != 8 || 
-	 nTubeLayersHitEC[1] != 6 || 
-	 nTubeLayersHitEC[2] != 6) ) return false; 
-    m_nPassTubeLayerEC++;
-    
-    // check drift sign sums for each multilayer
-    if ((m_maxDriftSignSum>0 || m_maxDriftSignSumInner>0) && 
-	(maxDriftSignSumEC[0]>m_maxDriftSignSumInner ||
-	 maxDriftSignSumEC[1]>m_maxDriftSignSum ||
-	 maxDriftSignSumEC[2]>m_maxDriftSignSum)) return 0; 
-    m_nPassDriftSignSumEC++;
-
-    return true;
-    */
-  }
-
-  /*
-  //________________________________________________________________________
-  const Trk::Track* MuonTrackPreProcessor::removeHits(const Trk::Track& track) const
-  {
-    if (m_removePerigeeBeforeRefit) ATH_MSG_DEBUG("MTPP: removePerigeeBeforeRefit");
-    if (m_removeTGCHits)         ATH_MSG_DEBUG("MTPP: removeTGCHits");
-    if (m_removeTRTHits)         ATH_MSG_DEBUG("MTPP: removeTRTHits");
-    if (m_removeCSCHits)         ATH_MSG_DEBUG("MTPP: removeCSCHits");
-    if (m_removeScattererTSOS)   ATH_MSG_DEBUG("MTPP: removeScattererTSOS");
-    if (m_removeBarrelMuon)      ATH_MSG_DEBUG("MTPP: removeBarrelMuon");
-    if (m_removeSmallBarrelHits) ATH_MSG_DEBUG("MTPP: removeSmallBarrelHits");
-    if (m_removeSpoiledCSCHits)  ATH_MSG_DEBUG("MTPP: removeSpoiledCSCHits");
-    if (m_removeCSCPhiHits)      ATH_MSG_DEBUG("MTPP: removeCSCPhiHits");
-    if (m_removeTGCEtaHits)      ATH_MSG_DEBUG("MTPP: removeTGCEtaHits");
-    if (m_removeRPCEtaHits)      ATH_MSG_DEBUG("MTPP: removeRPCEtaHits");
-    if (m_removeBEEHits)         ATH_MSG_DEBUG("MTPP: removeBEEHits");
-    if (m_removeEEHits)          ATH_MSG_DEBUG("MTPP: removeEEHits");
-
-    const DataVector<const Trk::TrackStateOnSurface>* oldTSOS=track.trackStateOnSurfaces();
-            
-    DataVector<const Trk::TrackStateOnSurface>* trackStateOnSurfaces =
-      new DataVector<const Trk::TrackStateOnSurface>;
-
-    //int nGoodHits(0);
-
-    // search first valid TSOS first
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=oldTSOS->begin(); 
-    for (iTsos=oldTSOS->begin(); iTsos!=oldTSOS->end(); ++iTsos) {
-
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Perigee) && 
-	  m_removePerigeeBeforeRefit) {
-	continue;
-      }
-
-      // get measurement, continue if hit to be removed
-      const Trk::MeasurementBase*      mesb     = (*iTsos)->measurementOnTrack();
-      Trk::TrackState::MeasurementType measType = m_measTypeIdHelper->defineType(mesb);
-
-      ATH_MSG_VERBOSE("(before) measType="<<measType<<", type: "<<(*iTsos)->dumpType());
-      
-      // removal of specific types of measurements
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement) &&
-	  ((measType==Trk::TrackState::TGC && m_removeTGCHits) ||
-	   (measType==Trk::TrackState::TRT && m_removeTRTHits) ||
-	   (measType==Trk::TrackState::CSC && m_removeCSCHits) )) continue;
-
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement) &&	  
-	  measType==Trk::TrackState::CSC && 
-	  (m_removeSpoiledCSCHits || m_removeCSCPhiHits)) {
-
-	ATH_MSG_DEBUG("checking CSC hit");
-
-	const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	if (rio) {
-	  const CscPrepData* csc_prp_data = dynamic_cast<const CscPrepData*>(rio);	
-	  if (csc_prp_data) {
-	    bool is_measphi_strip = p_muonMgr->cscIdHelper()->measuresPhi(csc_prp_data->identify());
-	    if (is_measphi_strip&&m_removeCSCPhiHits) continue;                           
-	    if (!is_measphi_strip && 
-		csc_prp_data->status() != CscStatusUnspoiled &&
-		m_removeSpoiledCSCHits) {
-	      ATH_MSG_DEBUG("spoiled CSC hit");
-	      continue;
-	    }
-	  }
-	}
-      }
-      
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement) &&
-	  measType==Trk::TrackState::TGC && m_removeTGCEtaHits) {
-
-	const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=crio->rioOnTrack(0);
-	if (rio) {
-	  const TgcPrepData* tgc_prp_data = dynamic_cast<const TgcPrepData*>(rio);	
-	  if (tgc_prp_data) {
-	    if (!p_muonMgr->tgcIdHelper()->isStrip(tgc_prp_data->identify())) continue;
-	  }
-	}
-      }
-      
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement) &&
-	  measType==Trk::TrackState::RPC && m_removeRPCEtaHits) {
-	
-       	const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-        const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=crio->rioOnTrack(0);
-        if (rio) {
-          if(!m_muonIdHelperTool->measuresPhi(rio->identify())){
-            continue;
-          }
-        }
-      }
-
-      ATH_MSG_VERBOSE("good hit");
-      // removal of scatterers inside MS
-      if (m_removeScattererTSOS &&
-	  !(*iTsos)->type(Trk::TrackStateOnSurface::Measurement) && 
-	  (**iTsos).materialEffectsOnTrack()) {
-	Trk::GlobalPosition position =
-	  (**iTsos).materialEffectsOnTrack()->associatedSurface().globalReferencePoint();
-	if (!m_indetVolume->inside(position) && !m_calVolume->inside(position)) continue;
-      }    
-      
-      // removal of barrel hits
-      if ( (m_removeBarrelMuon || m_removeSmallBarrelHits || m_removeBEEHits || m_removeEEHits ) && 
-	  (*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) {
-	
-	const Trk::MeasurementBase*             mesb       = (*iTsos)->measurementOnTrack();	
-	const Trk::RIO_OnTrack*                 rio        = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack*        crio       = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=crio->rioOnTrack(0);
-	if (rio) {
-	  if (m_muonIdHelperTool->isMuon(rio->detectorElement()->identify())) {
-	    if (!isEndcap(rio->detectorElement()->identify())) {
-	      if (m_removeBarrelMuon) {
-		ATH_MSG_VERBOSE("removing barrel muon hit");
-		continue;
-	      }
-	      if (m_removeSmallBarrelHits) { 
-		Identifier id=rio->detectorElement()->identify();
-		const std::string stName=
-		  m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(id));
-		if (stName[2]!='L') {
-		  ATH_MSG_VERBOSE("removing small barrel hit");
-		  continue;
-		}
-	      }
-	    }
-	    
-	    ATH_MSG_VERBOSE("keeping hit in "
-			  << m_muonIdHelperTool->toStringGasGap(rio->identify()));
-	  }
-	  if (m_removeBEEHits||m_removeEEHits) {
-	    const std::string stName=
-	      m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(rio->identify()));
-	    if (m_removeBEEHits && stName.substr(0,3)=="BEE") continue;
-	    if (m_removeEEHits  && stName.substr(0,2)=="EE") continue;
-	  }	  
-	}
-      }
-
-
-      // have a good TSOS, create a new TSOS from old one, removing scattering if necessary
-      const Trk::TrackStateOnSurface* newTsos;
-      if (m_removeScattererTSOS && 
-	  ((**iTsos).type(Trk::TrackStateOnSurface::Scatterer) ||
-	   (**iTsos).type(Trk::TrackStateOnSurface::InertMaterial))) {
-
-	ATH_MSG_DEBUG("removing scattering from shared TSOS");
-
-	// check if pure scatterer and remove if it is
-	if ((**iTsos).measurementOnTrack()==0) continue;
-	
-	ATH_MSG_DEBUG("creating new TSOS");
-
-	// have to build a new TSOS without the scattering part
-	const Trk::TrackParameters*     tpar=(**iTsos).trackParameters() ?
-	  (**iTsos).trackParameters()->clone():0;
-	const Trk::MeasurementBase*     meas=(**iTsos).measurementOnTrack() ?
-	  (**iTsos).measurementOnTrack()->clone():0;
-	const Trk::FitQualityOnSurface* fqos=(**iTsos).fitQualityOnSurface() ? 
-	  new Trk::FitQualityOnSurface(*(**iTsos).fitQualityOnSurface()) : 0;
-
-	newTsos=new Trk::TrackStateOnSurface(meas,tpar,fqos);
-      }
-      else {
-	ATH_MSG_VERBOSE("cloning TSOS");
-	newTsos=(**iTsos).clone();
-      }
-      
-      //if (newTsos->type(Trk::TrackStateOnSurface::Measurement) &&
-      //  !newTsos->type(Trk::TrackStateOnSurface::Outlier)) nGoodHits++;
-
-      ATH_MSG_VERBOSE("(after) measType="<<measType<<", type: "<<newTsos->dumpType());
-
-      trackStateOnSurfaces->push_back(newTsos);
-      
-    }
-
-    const Trk::Track* newTrack = new Trk::Track(Trk::TrackInfo(track.info()),
-                                                trackStateOnSurfaces,
-                                                track.fitQuality()->clone());
-
-    //ATH_MSG_DEBUG("# good measurements: "<<nGoodHits);
-    //if (nGoodHits<3) {
-    //delete newTrack;
-    //return 0;
-    //}
-
-    ATH_MSG_DEBUG("created newTrack:");
-    ATH_MSG_DEBUG(m_printer->print(*newTrack)<<"\n"<<
-		  m_printer->printStations(*newTrack)<<"\n");//<<
-
-    return newTrack;    
-  }
-  */
-
-  /*
-  //________________________________________________________________________
-  const Trk::Track* MuonTrackPreProcessor::declusterTGCHits(const Trk::Track& track) const
-  {
-    ATH_MSG_DEBUG("MTPP: declusterTGCHits");
-
-    // layer Identifiers for TGC hits
-    std::set<Identifier> layIds;
-    
-    const DataVector<const Trk::TrackStateOnSurface>* oldTSOS=track.trackStateOnSurfaces();
-    
-    DataVector<const Trk::TrackStateOnSurface>* trackStateOnSurfaces =
-      new DataVector<const Trk::TrackStateOnSurface>;
-    
-    // search first valid TSOS first
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=oldTSOS->begin(); 
-    for (iTsos=oldTSOS->begin(); iTsos!=oldTSOS->end(); ++iTsos) {
-
-      // get measurement
-      const Trk::MeasurementBase*      mesb     = (*iTsos)->measurementOnTrack();
-      Trk::TrackState::MeasurementType measType = m_measTypeIdHelper->defineType(mesb);
-
-      ATH_MSG_VERBOSE("(before) measType="<<measType<<", type: "<<(*iTsos)->dumpType());
-      
-      
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement) &&
-	  measType==Trk::TrackState::TGC) {
-
-	// loop over RIO in CRIO, create TSOS from each one
-	const Trk::MeasurementBase*             mesb       = (*iTsos)->measurementOnTrack();	
-	const Trk::CompetingRIOsOnTrack*        crio       = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!crio) { 
-	  ATH_MSG_DEBUG("TGC with no crio!"); 
-	  const Trk::RIO_OnTrack* rio=dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	  if (!rio) { ATH_MSG_ERROR("no crio or rio for TGC hit!"); continue; }
-	  const Trk::MeasurementBase*     meas=dynamic_cast<const Trk::MeasurementBase*>(rio);
-	  const Trk::TrackParameters*     tpar=(**iTsos).trackParameters()->clone();
-	  const Trk::FitQualityOnSurface* fqos=(**iTsos).fitQualityOnSurface() ? 
-	    new Trk::FitQualityOnSurface(*(**iTsos).fitQualityOnSurface()) : 0;
-	  const Trk::MaterialEffectsBase* meb=( (*iTsos)->materialEffectsOnTrack()) ?
-	    (*iTsos)->materialEffectsOnTrack()->clone() : 0;
-
-	  const Trk::TrackStateOnSurface* newTsos=
-	    new Trk::TrackStateOnSurface(meas,tpar,fqos,meb);
-
-	  trackStateOnSurfaces->push_back(newTsos);
-	  continue; 
-	}
-
-	for (unsigned int irio=0;irio<crio->numberOfContainedROTs();irio++) {
-	  const Trk::RIO_OnTrack* rio=crio->rioOnTrack(irio);
-	  if (!rio) continue;
-	  Identifier layId = m_muonIdHelperTool->layerId(rio->identify());
-	  ATH_MSG_DEBUG("have ID "<<layId<<" for rioId "<<rio->identify());
-	  std::pair<std::set<Identifier>::iterator, bool> pr=layIds.insert(layId);
-	  if (pr.second == false) continue;
-	  ATH_MSG_DEBUG("adding TGC RIO with rioId "<<rio->identify());
-
-	  // attach any material effects to first RIO
-	  const Trk::MeasurementBase*     meas=dynamic_cast<const Trk::MeasurementBase*>(rio);
-	  const Trk::TrackParameters*     tpar=(**iTsos).trackParameters()->clone();
-	  const Trk::FitQualityOnSurface* fqos=(**iTsos).fitQualityOnSurface() ? 
-	    new Trk::FitQualityOnSurface(*(**iTsos).fitQualityOnSurface()) : 0;
-	  const Trk::MaterialEffectsBase* meb=(irio==0 && ((*iTsos)->materialEffectsOnTrack())) ?
-	    (*iTsos)->materialEffectsOnTrack()->clone() : 0;
-	  const Trk::TrackStateOnSurface* newTsos=
-	    new Trk::TrackStateOnSurface(meas,tpar,fqos,meb);
-	  trackStateOnSurfaces->push_back(newTsos);
-	}
-      }
-      else {
-	const Trk::TrackStateOnSurface* newTsos=(**iTsos).clone();
-	trackStateOnSurfaces->push_back(newTsos);
-      }
-    }
-
-    const Trk::Track* newTrack = new Trk::Track(Trk::TrackInfo(track.info()),
-                                                trackStateOnSurfaces,
-                                                track.fitQuality()->clone());
-    return newTrack;    
-  }
-  */
-
-  //________________________________________________________________________
-  Trk::AlignTrack* MuonTrackPreProcessor::refitTrack(const Trk::Track& /*origTrack*/) const
-  {
-    ATH_MSG_ERROR("update refitTrack for Eigen");
-    return 0;
-
-    /*
-    bool isSLTrack = Trk::AlignTrack::isSLTrack(&origTrack);
-    ToolHandle<Trk::ITrackFitter> fitter = isSLTrack ? m_SLTrackFitterTool : m_trackFitterTool;
-    
-    ATH_MSG_DEBUG("refitting track");
-    const Trk::Track* newTrack = 
-      fitter->fit(origTrack,m_runOutlierRemoval,m_particleHypothesis);
-    ATH_MSG_DEBUG("track refit done");
-
-    if (!newTrack) {
-      return 0;
-    }
-
-    //ATH_MSG_DEBUG("creating new AlignTrack");
-    Trk::AlignTrack* alignTrack=new Trk::AlignTrack(*newTrack);
-
-    // if IGlobalTrackFitter, the covariance and derivative matrices are available, 
-    // so set them on the AlignTrack
-    const Trk::IGlobalTrackFitter* globFitter = 
-      dynamic_cast<const Trk::IGlobalTrackFitter*>(& (*fitter) );
-    
-    if (globFitter) {
-      const CLHEP::HepSymMatrix* mat=globFitter->FullCovarianceMatrix();
-      ATH_MSG_DEBUG("mat has "<<mat->num_row()<<" x "<<mat->num_col()<<" entries");
-      alignTrack->setFullCovarianceMatrix(mat);
-      alignTrack->setDerivativeMatrix(globFitter->DerivMatrix());
-    }
-    
-    // cleanup
-    delete newTrack;
-    return alignTrack;
-    */
-  }
-
-  //________________________________________________________________________
-  void MuonTrackPreProcessor::identifyScatterers(const Trk::Track& track) const
-  {
-
-    const DataVector<const Trk::TrackStateOnSurface>* TSOS=track.trackStateOnSurfaces();
-            
-    // search first valid TSOS first
-    int itsos(0);
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=TSOS->begin(); 
-    for (; iTsos!=TSOS->end(); ++iTsos,itsos++) {
-      
-      ATH_MSG_VERBOSE("\nTSOS: "<<itsos<<"\n"<<**iTsos);
-      
-      if (!(*iTsos)->type(Trk::TrackStateOnSurface::Scatterer) &&
-	  !(*iTsos)->type(Trk::TrackStateOnSurface::InertMaterial)) continue;
-      
-      if (!(*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) {	
-	ATH_MSG_DEBUG("not a measurement, but is a scatterer or inert material!");
-      }
-      else {
-	ATH_MSG_DEBUG("scatterer with measurement");
-
-	const Trk::MeasurementBase*             mesb       = (*iTsos)->measurementOnTrack();	
-	const Trk::RIO_OnTrack*                 rio        = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack*        crio       = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=&crio->rioOnTrack(0);
-	Identifier rid;
-	if (rio) {
-	  ATH_MSG_DEBUG("rio detelement identifier: "<<rio->detectorElement()->identify());
-	  rid=rio->detectorElement()->identify();
-	  if (!m_idHelper->is_muon(rid)) { ATH_MSG_DEBUG("not muon"); continue; }
-	  if (m_idHelper->is_mdt(rid)) ATH_MSG_DEBUG("have MDT hit, ID "<<rid);
-	  if (m_idHelper->is_tgc(rid)) ATH_MSG_DEBUG("have TGC hit, ID "<<rid);
-	  if (m_idHelper->is_csc(rid)) ATH_MSG_DEBUG("have CSC hit, ID "<<rid);
-	  if (m_idHelper->is_rpc(rid)) ATH_MSG_DEBUG("have RPC hit, ID "<<rid); 
-	}
-      }
-
-      const Trk::MaterialEffectsBase* meb = (**iTsos).materialEffectsOnTrack();
-      if (!meb) { ATH_MSG_DEBUG("no meb"); continue; }
-      ATH_MSG_DEBUG("Surface: \n" << meb->associatedSurface());
-      ATH_MSG_DEBUG("Surface ID:\n" << meb->associatedSurface().associatedDetectorElementIdentifier());
-      
-      const Trk::TrkDetElementBase* detelement=meb->associatedSurface().associatedDetectorElement();
-      if (!detelement) { ATH_MSG_DEBUG("no detelement"); continue; }
-      
-      Identifier id=meb->associatedSurface().associatedDetectorElementIdentifier();
-      if (!m_idHelper->is_muon(id)) { ATH_MSG_DEBUG("not muon"); continue; }
-      if (m_idHelper->is_mdt(id)) ATH_MSG_DEBUG("have MDT scat, ID "<<id);
-      if (m_idHelper->is_tgc(id)) ATH_MSG_DEBUG("have TGC scat, ID "<<id);
-      if (m_idHelper->is_csc(id)) ATH_MSG_DEBUG("have CSC scat, ID "<<id);
-      if (m_idHelper->is_rpc(id)) ATH_MSG_DEBUG("have RPC scat, ID "<<id);
-    } 
-    return;
-  }	
-
-  //________________________________________________________________________
-  bool MuonTrackPreProcessor::passesFinalTrackSelection(const Trk::Track& track) 
-  {
-
-    double chiSq=track.fitQuality()->chiSquared()/
-      (double)track.fitQuality()->numberDoF();
-    int trackNDoF = track.fitQuality()->numberDoF();
-
-    int nOutliers(0);
-    int nOutliersPerLayer[3]={0,0,0};
-    int nHoles(0);
-    int nHolesPerLayer[3]={0,0,0};
-    
-    // search first valid TSOS first
-    const DataVector<const Trk::TrackStateOnSurface>* oldTSOS=track.trackStateOnSurfaces();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=oldTSOS->begin(); 
-    for (iTsos=oldTSOS->begin(); iTsos!=oldTSOS->end(); ++iTsos) {
-
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Outlier) &&
-	  (*iTsos)->measurementOnTrack())                 nOutliers++;
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Hole)) nHoles++;
-
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) {
-	
-	// get measurement, continue if hit to be removed
-	const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();      
-	const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=&crio->rioOnTrack(0);
-	if (!rio) continue;
-	
-	Identifier detId=rio->detectorElement()->identify();
-	if (!m_muonIdHelperTool->isMuon(detId))  continue;
-	
-	int statLayer=getMdtStatLayer(detId);
-	if (statLayer>2) continue;
-	
-	if ((*iTsos)->type(Trk::TrackStateOnSurface::Hole))    nHolesPerLayer[statLayer]++;
-	if ((*iTsos)->type(Trk::TrackStateOnSurface::Outlier)) nOutliersPerLayer[statLayer]++;
-
-      } // measurement checks     
-    } // end loop over TSOS
-
-    // fill tree variables
-    m_trackNDoF            = trackNDoF;
-    m_trackChi2            = chiSq;
-    //m_trackSagitta         = 0.; //trackSagitta(track);
-    m_nInnerLayerOutliers  = nOutliersPerLayer[0];
-    m_nMiddleLayerOutliers = nOutliersPerLayer[1];
-    m_nOuterLayerOutliers  = nOutliersPerLayer[2];
-    m_nInnerLayerHoles     = nHolesPerLayer[0];
-    m_nMiddleLayerHoles    = nHolesPerLayer[1];
-    m_nOuterLayerHoles     = nHolesPerLayer[2];
-    m_trackPt  = track.perigeeParameters() ? track.perigeeParameters()->pT() : 0.;
-    m_trackEta = track.perigeeParameters() ? track.perigeeParameters()->eta() : -999.;
-    double momentum = track.perigeeParameters() ? 
-      std::fabs(m_trackPt)*std::sqrt(1.+sinh(m_trackEta)*sinh(m_trackEta)) : -999.;
-    m_qOverP   = (momentum>0.) ? track.perigeeParameters()->charge() / momentum : 0.;  
-
-    // get residuals from original tree (for output tree only... these aren't used for alignment)
-    m_nresiduals=0;
-    m_nChambers=-1;
-    iTsos=oldTSOS->begin(); 
-    for (; iTsos!=oldTSOS->end(); ++iTsos) {
-      
-      if (m_nresiduals>=100) break;
-      
-      const Trk::MeasurementBase*      mesb     = (*iTsos)->measurementOnTrack();
-      if (!mesb) continue;
-      Trk::TrackState::MeasurementType measType = m_measTypeIdHelper->defineType(mesb);
-      if (measType!=Trk::TrackState::MDT) continue;
-      
-      const Trk::RIO_OnTrack* rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      if (!rio) continue;
-      Identifier detId=rio->detectorElement()->identify();
-      int chid = m_muonIdHelperTool->chamberId(detId).get_identifier32().get_compact();
-      if (m_nChambers==-1 || m_chamberId[m_nChambers]!=chid) {
-	m_nChambers++;
-	if (m_nChambers>=50) continue;
-	m_chamberId[m_nChambers]=chid;
-	m_resIndex[m_nChambers]=m_nresiduals;
-      }
-      
-      const Trk::ResidualPull* resPull=
-	m_pullCalculator->residualPull((**iTsos).measurementOnTrack(),
-				       (**iTsos).trackParameters(),
-				       Trk::ResidualPull::HitOnly,measType);
-      double res=(resPull->residual())[Trk::driftRadius];
-      m_residuals[m_nresiduals]=res;
-      m_respulls [m_nresiduals++]=(resPull->pull())[Trk::driftRadius];
-
-    }
-        
-    //
-    // check selections all at once
-    //  
-    if (!m_applySelectionCuts) return true;
-
-    if (m_chiSqCut>0.         && chiSq>m_chiSqCut            ) return 0;
-    m_nPassTrackChi2Cut++;    
-    if (m_nAllowedOutliers>=0 && nOutliers>m_nAllowedOutliers) return 0;
-    m_nPassOutlierCut++;
-    if (m_nAllowedHoles>=0    && nOutliers>m_nAllowedHoles   ) return 0;
-    m_nPassHoleCut++;
-
-    return true;
-  }
-
-  //________________________________________________________________________
-  void MuonTrackPreProcessor::createTree() 
-  {
-    ATH_MSG_INFO("creating tree in MuonTrackPreProcessor");
-    m_ntuple->cd();
-    m_tree=new TTree("MuonTrackPreProcessor","MuonTrackPreProcessor");
-    m_tree->Branch("run",                    &m_runNumber,              "run/I");
-    m_tree->Branch("evt",                    &m_evtNumber,              "evt/I");
-    m_tree->Branch("nresiduals",             &m_nresiduals,             "nresiduals/I");
-    m_tree->Branch("residuals",               m_residuals,              "residuals[nresiduals]/D");
-    m_tree->Branch("respulls",                m_respulls,               "respulls[nresiduals]/D");
-    m_tree->Branch("nInnerLayersHit",        &m_nInnerLayersHit,        "nInnerLayersHit/I");
-    m_tree->Branch("nMiddleLayersHit",       &m_nMiddleLayersHit,       "nMiddleLayersHit/I");
-    m_tree->Branch("nOuterLayersHit",        &m_nOuterLayersHit,        "nOuterLayersHit/I");
-    m_tree->Branch("nOtherLayersHit",        &m_nOtherLayersHit,        "nOtherLayersHit/I");
-    m_tree->Branch("nChambersHit",           &m_nChambersHit,           "nChambersHit/I");
-    m_tree->Branch("nLargeChambersHit",      &m_nLargeChambersHit,      "nLargeChambersHit/I");
-    m_tree->Branch("nSmallChambersHit",      &m_nSmallChambersHit,      "nSmallChambersHit/I");
-    m_tree->Branch("nTubeLayersHitInner",    &m_nTubeLayersHitInner,    "nTubeLayersHitInner/I");
-    m_tree->Branch("nTubeLayersHitMiddle",   &m_nTubeLayersHitMiddle,   "nTubeLayersHitMiddle/I");
-    m_tree->Branch("nTubeLayersHitOuter",    &m_nTubeLayersHitOuter,    "nTubeLayersHitOuter/I");
-    m_tree->Branch("nTubeLayersHitOther",    &m_nTubeLayersHitOther,    "nTubeLayersHitOther/I");
-    m_tree->Branch("DriftSignsInnerLayer",   &m_driftSignsInnerLayer,   "driftSignsInnerLayer/D");
-    m_tree->Branch("DriftSignsMiddleLayer",  &m_driftSignsMiddleLayer,  "driftSignsMiddleLayer/D");
-    m_tree->Branch("DriftSignsOuterLayer",   &m_driftSignsOuterLayer,   "driftSignsOuterLayer/D");
-    m_tree->Branch("DriftSignsOtherLayer",   &m_driftSignsOtherLayer,   "driftSignsOtherLayer/D");
-    m_tree->Branch("trackNDoF",              &m_trackNDoF,              "trackNDoF/I");
-    m_tree->Branch("trackChi2",              &m_trackChi2,              "trackChi2/D");
-    m_tree->Branch("trackPt",                &m_trackPt,                "trackPt/D");
-    m_tree->Branch("trackEta",               &m_trackEta,               "trackEta/D");
-    m_tree->Branch("qOverP",                 &m_qOverP,                 "qOverP/D");
-    m_tree->Branch("BEEPosX",                &m_beePosX,                "BEEPosX/D");
-    m_tree->Branch("BEEPosY",                &m_beePosY,                "BEEPosY/D");
-    //m_tree->Branch("trackSagitta",           &m_trackSagitta,           "trackSagitta/D");
-    m_tree->Branch("nChambers",              &m_nChambers,              "nChambers/I");
-    m_tree->Branch("chamberId",               m_chamberId,              "chamberId[nChambers]/I");
-    m_tree->Branch("resIndex",                m_resIndex,               "resIndex[nChambers]/I");
-    m_tree->Branch("nInnerLayerOutliers",    &m_nInnerLayerOutliers,    "nInnerLayerOutliers/I");
-    m_tree->Branch("nMiddleLayerOutliers",   &m_nMiddleLayerOutliers,   "nMiddleLayerOutliers/I");
-    m_tree->Branch("nOuterLayerOutliers",    &m_nOuterLayerOutliers,    "nOuterLayerOutliers/I");
-    m_tree->Branch("nInnerLayerHoles",       &m_nInnerLayerHoles,       "nInnerLayerHoles/I");
-    m_tree->Branch("nMiddleLayerHoles",      &m_nMiddleLayerHoles,      "nMiddleLayerHoles/I");
-    m_tree->Branch("nOuterLayerHoles",       &m_nOuterLayerHoles,       "nOuterLayerHoles/I");
-        
-    m_tree->Branch("nIDres",                 &m_nIDres,                "nIDres/I");
-    m_tree->Branch("IDres",                   m_IDres,                 "IDres[nIDres]/D");
-    m_tree->Branch("IDerr",                   m_IDerr,                 "IDerr[nIDres]/D");
-    
-    m_tree->Branch("nIDscatRes",             &m_nIDscatRes,            "nIDscatRes/I");
-    m_tree->Branch("IDscatPhiRes",            m_IDscatPhiRes,          "IDscatPhiRes[nIDscatRes]/D");
-    m_tree->Branch("IDscatPhiErr",            m_IDscatPhiErr,          "IDscatPhiErr[nIDscatRes]/D");
-    m_tree->Branch("IDscatThetaRes",          m_IDscatThetaRes,        "IDscatThetaRes[nIDscatRes]/D");
-    m_tree->Branch("IDscatThetaErr",          m_IDscatThetaErr,        "IDscatThetaErr[nIDscatRes]/D");
-    
-    m_tree->Branch("nMSres",                 &m_nMSres,                "nMSres/I");
-    m_tree->Branch("MSres",                   m_MSres,                 "MSres[nMSres]/D");
-    m_tree->Branch("MSerr",                   m_MSerr,                 "MSerr[nMSres]/D");
-    m_tree->Branch("MSstatLayer",             m_MSstatLayer,           "MSstatLayer[nMSres]/I");
-    m_tree->Branch("MSisEndcap",              m_MSisEndcap,            "MSisendcap[nMSres]/I");
-
-    m_tree->Branch("nMStrigRes",             &m_nMStrigRes,            "nMStrigRes/I");
-    m_tree->Branch("MStrigRes",               m_MStrigRes,             "MStrigRes[nMStrigRes]/D");
-    m_tree->Branch("MStrigErr",               m_MStrigErr,             "MStrigErr[nMStrigRes]/D");
-    m_tree->Branch("MStrigStatLayer",         m_MStrigStatLayer,       "MStrigStatLayer[nMStrigRes]/I");
-    m_tree->Branch("MStrigIsEndcap",          m_MStrigIsEndcap,        "MStrigIsendcap[nMStrigRes]/I");
-
-    m_tree->Branch("nMSscatRes",             &m_nMSscatRes,            "nMSscatRes/I");
-    m_tree->Branch("MSscatPhiRes",            m_MSscatPhiRes,          "MSscatPhiRes[nMSscatRes]/D");
-    m_tree->Branch("MSscatPhiErr",            m_MSscatPhiErr,          "MSscatPhiErr[nMSscatRes]/D");
-    m_tree->Branch("MSscatThetaRes",          m_MSscatThetaRes,        "MSscatThetaRes[nMSscatRes]/D");
-    m_tree->Branch("MSscatThetaErr",          m_MSscatThetaErr,        "MSscatThetaErr[nMSscatRes]/D");
-
-    m_tree->Branch("nCalRes",                &m_nCalRes,               "nCalRes/I");
-    m_tree->Branch("CalRes",                  m_CalRes,                "CalRes[nCalRes]/D");
-    m_tree->Branch("CalErr",                  m_CalErr,                "CalErr[nCalRes]/D");
-    
-    return;
-  }
-
-  //________________________________________________________________________
-  int MuonTrackPreProcessor::getMdtStatLayer(Identifier id) const 
-  {
-    
-    const std::string stName=
-      m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(id));
-    
-    // station layer
-    switch ( stName[1] ) {
-    case 'I' :
-      return 0;
-    case 'M' :
-      return 1;
-    case 'O' :
-      return 2;
-    default:
-      return 3;
-    }    
-    return 3;
-  }
-
-  //________________________________________________________________________
-  void MuonTrackPreProcessor::dumpChamberNames(const Trk::Track& track) const
-  {
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=track.trackStateOnSurfaces()->begin(); 
-    for (; iTsos!=track.trackStateOnSurfaces()->end(); ++iTsos) {
-
-      const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();      
-      const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-      if (!rio && crio) rio=&crio->rioOnTrack(0);
-      if (!rio) continue;
-      
-      Identifier detId=rio->detectorElement()->identify();
-      if (!m_muonIdHelperTool->isMuon(detId)) continue;
-      
-      const MuonIdHelper& muonIdHelper=dynamic_cast<const MuonIdHelper&>(m_muonIdHelperTool->mdtIdHelper());
-      ATH_MSG_DEBUG("have muon hit in "
-		    <<muonIdHelper.stationNameString(muonIdHelper.stationName(detId))
-		    <<" "<<muonIdHelper.stationPhi(detId)
-		    <<" "<<muonIdHelper.stationEta(detId));
-    }
-          
-    
-    return;
-  }
-  
-  //________________________________________________________________________
-  void MuonTrackPreProcessor::printCompetingROTs(const Trk::Track& track) const
-  {
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=track.trackStateOnSurfaces()->begin(); 
-    for (; iTsos!=track.trackStateOnSurfaces()->end(); ++iTsos) {
-      const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();      
-      const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-      if (!crio) continue;
-
-      if (!rio) rio=&crio->rioOnTrack(0);
-      if (!rio) continue;      
-      Identifier detId=rio->detectorElement()->identify();
-      //Identifier rioId=rio->identify();
-      if (!m_muonIdHelperTool->isMuon(detId))  continue;
-      
-      //get detector type
-      Trk::AlignModule::DetectorType detType=Trk::AlignModule::unidentified;
-      if      (m_muonIdHelperTool->isTgc(detId)) detType=Trk::AlignModule::TGC;
-      else if (m_muonIdHelperTool->isRpc(detId)) detType=Trk::AlignModule::RPC;
-      else ATH_MSG_DEBUG("not TGC or RPC... what is it?");
-
-      ATH_MSG_DEBUG(detTypeStr(detType)<<" global position: "<<mesb->globalPosition());      
-    }
-  }
-
-  //_______________________________________________________________________
-  bool MuonTrackPreProcessor::isEndcap(Identifier id) const
-  {
-    if (m_muonIdHelperTool->isEndcap(id)) return true;        
-    if (m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(id)).substr(0,3)=="BEE") return true;
-    return false;
-  }
-
-  //_______________________________________________________________________
-  bool MuonTrackPreProcessor::isBIS8(Identifier id) const
-  {
-    if (m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(id)).substr(0,3)=="BIS" && std::abs(m_muonIdHelperTool->mdtIdHelper().stationEta(id))==8) return true;
-    return false;
-  }
-
-  /*
-  //________________________________________________________________________
-  double MuonTrackPreProcessor::trackSagitta(const Trk::Track& track) const
-  {
-
-    const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces();
-    if ( !states ) return -999.;
-    
-    // loop over TSOSs, find MDT hits, and mark them as outliers:
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit = states->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end = states->end();
-
-    // loop over hits, find out how many middle chambers
-    int nmiddlechambers(0);
-    int middleStatPhi(0);
-    Identifier middleChamberId(0);
-    for ( ; tsit!=tsit_end ; ++tsit ) {
-      
-      if (!(*tsit)->type(Trk::TrackStateOnSurface::Measurement)) continue;
-      
-      const Trk::MeasurementBase* mesb = (*tsit)->measurementOnTrack();      
-      const Trk::RIO_OnTrack*     rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      if (!rio) continue;
-      
-      Identifier detId=rio->detectorElement()->identify();
-      if (!m_muonIdHelperTool->isMuon(detId) || 
-	  !m_muonIdHelperTool->isMdt(detId))  continue;
-      
-      ATH_MSG_DEBUG("detId: "<<detId<<", middle chamberId="<<middleChamberId);
-      ATH_MSG_DEBUG("ch: "<<m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(detId)));
-      
-      if (detId!=middleChamberId && 
-	  m_muonAlignHelperTool->getMdtStatLayer(detId)==Middle) {
-	if (m_muonIdHelperTool->mdtIdHelper().stationPhi(detId)!=middleStatPhi) {
-	  nmiddlechambers++;
-	  ATH_MSG_DEBUG("incremented nmiddlechambers: "<<nmiddlechambers);
-	}
-	if (nmiddlechambers>1) break;
-	middleStatPhi=m_muonIdHelperTool->mdtIdHelper().stationPhi(detId);
-	middleChamberId=detId;
-      }    
-    }
-    ATH_MSG_DEBUG("nmiddlechambers: "<<nmiddlechambers);
-    if (nmiddlechambers!=1) {
-      return -999.;
-    }
-    
-    ATH_MSG_DEBUG("middleStatPhi: "<<middleStatPhi);
-
-    // get directions
-    Trk::GlobalPosition innerGP,middleGP,outerGP;
-    int                 nInner(0),nMiddle(0),nOuter(0);
-    HepGeom::Vector3D<double>*        wireDir(0);
-
-    for ( tsit=states->begin(); tsit!=tsit_end ; ++tsit ) {
-
-      if (!(*tsit)->type(Trk::TrackStateOnSurface::Measurement)) continue;
-      
-      const Trk::MeasurementBase* mesb = (*tsit)->measurementOnTrack();      
-      const Trk::RIO_OnTrack*     rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      if (!rio) continue;
-      
-      Identifier detId=rio->detectorElement()->identify();
-      if (!m_muonIdHelperTool->isMuon(detId) || !m_muonIdHelperTool->isMdt(detId)) continue;
-      
-      StationLayer statlayer=m_muonAlignHelperTool->getMdtStatLayer(detId);
-      ATH_MSG_DEBUG("statlayer: "<<statlayer);
-
-      if (statlayer==Inner) {
-	ATH_MSG_DEBUG("inner phi: "<<m_muonIdHelperTool->mdtIdHelper().stationPhi(detId));
-	if (m_muonIdHelperTool->mdtIdHelper().stationPhi(detId)!=middleStatPhi) continue;
-	innerGP+=(**tsit).trackParameters()->position();
-	nInner++;
-      }
-      else if (statlayer==Middle) {
-	middleGP+=(**tsit).trackParameters()->position();
-	nMiddle++;
-	if (!wireDir) {
-	  const Trk::StraightLineSurface* wireSurf=dynamic_cast<const Trk::StraightLineSurface*>(&rio->associatedSurface());
-	  if (!wireSurf) continue;
-	  wireDir = new Trk::GlobalDirection(wireSurf->transform().getRotation().colZ());
-	}
-      }
-      else if (statlayer==Outer) {
-	ATH_MSG_DEBUG("outer phi: "<<m_muonIdHelperTool->mdtIdHelper().stationPhi(detId));
-	if (m_muonIdHelperTool->mdtIdHelper().stationPhi(detId)!=middleStatPhi) continue;
-	outerGP+=(**tsit).trackParameters()->position();
-	nOuter++;
-      }
-    }
-    if (nInner==0||nMiddle==0||nOuter==0) {
-      delete wireDir;
-      return -999.;
-    }
-    ATH_MSG_DEBUG("good track");
-    
-    outerGP  /= (double)nOuter;
-    middleGP /= (double)nMiddle;
-    innerGP  /= (double)nInner;
-
-    if (!wireDir) {
-      ATH_MSG_WARNING("no wire direction!  what's wrong?");
-      return -999.;
-    }
-
-    HepGeom::Vector3D<double> vecEOEI(outerGP-innerGP);
-    HepGeom::Vector3D<double> vecEMEI(middleGP-innerGP);
-    HepGeom::Vector3D<double> u=vecEOEI.cross(*wireDir).unit();
-    
-    ATH_MSG_DEBUG("vecEOEI: "<<vecEOEI);
-    ATH_MSG_DEBUG("vecEMEI: "<<vecEMEI);
-    ATH_MSG_DEBUG("u: "<<u);
-    double sagitta=vecEMEI.dot(u);
-    ATH_MSG_DEBUG("sagitta: "<<sagitta);
-
-    delete wireDir;
-
-    return sagitta;
-  }
-  */
-
-  //________________________________________________________________________
-  void MuonTrackPreProcessor::calculateTrackChi2(const Trk::Track* /*track*/)
-  {
-    ATH_MSG_ERROR("migrate calculateTrackChi2 for Eigen");
-    return;
-
-    /*
-    ATH_MSG_DEBUG("calculateTrackChi2");
-
-    double previousQOverP(0.),qOverP(0.);
-    m_nIDres=m_nIDscatRes=m_nMSres=m_nMStrigRes=m_nMSscatRes=m_nCalRes=0;
-
-    bool afterCal=false;
-
-    double trackChi2(0.);
-
-    int itsos(0);
-    for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator itTsos=
-	   track->trackStateOnSurfaces()->begin();
-	 itTsos!=track->trackStateOnSurfaces()->end(); ++itTsos,itsos++) {
-      
-      // scattering residual(s) and/or energy loss first
-      ATH_MSG_DEBUG("\ntsos: "<<itsos);
-      
-      const Trk::TrackStateOnSurface*    tsos       = *itTsos;
-      const Trk::TrackParameters *       tparp      = tsos->trackParameters();
-
-      const Trk::MaterialEffectsBase*    meb        = tsos->materialEffectsOnTrack();
-      const Trk::MaterialEffectsOnTrack* meot       = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(meb);
-      const Trk::ScatteringAngles*       scatterer  = (meot) ? meot->scatteringAngles() : 0;
-      const Trk::EnergyLoss*             energyLoss = (meot) ? meot->energyLoss() : 0;
-      const Trk::MeasurementBase*        mesb       = dynamic_cast<const Trk::MeasurementBase*>(tsos->measurementOnTrack());      
-      const Trk::RIO_OnTrack*            rio        = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack*   crio       = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-      if (!rio && crio)                  rio        = &crio->rioOnTrack(0);
-
-      Trk::TrackState::MeasurementType measType = m_measTypeIdHelper->defineType(mesb);
-      
-      if (msgLvl(MSG::DEBUG)) {
-	if      (measType==Trk::TrackState::unidentified) ATH_MSG_DEBUG("measType: unidentified");
-	else if (measType==Trk::TrackState::Pixel) ATH_MSG_DEBUG("measType: Pixel");
-	else if (measType==Trk::TrackState::SCT)   ATH_MSG_DEBUG("measType: SCT");
-	else if (measType==Trk::TrackState::TRT)   ATH_MSG_DEBUG("measType: TRT");
-	else if (measType==Trk::TrackState::MDT)   ATH_MSG_DEBUG("measType: MDT");
-	else if (measType==Trk::TrackState::CSC)   ATH_MSG_DEBUG("measType: CSC");
-	else if (measType==Trk::TrackState::RPC)   ATH_MSG_DEBUG("measType: RPC");
-	else if (measType==Trk::TrackState::TGC)   ATH_MSG_DEBUG("measType: TGC");
-	else if (measType==Trk::TrackState::Pseudo)  ATH_MSG_DEBUG("measType: Pseudo");
-	else if (measType==Trk::TrackState::Vertex)  ATH_MSG_DEBUG("measType: Vertex");
-	else if (measType==Trk::TrackState::Segment) ATH_MSG_DEBUG("measType: Segment");
-	else if (measType==Trk::TrackState::SpacePoint)   ATH_MSG_DEBUG("measType: SpacePoint");
-	else if (measType==Trk::TrackState::LArCal)  ATH_MSG_DEBUG("measType: LArCal");
-	else if (measType==Trk::TrackState::TileCal) ATH_MSG_DEBUG("measType: TileCal");
-	else ATH_MSG_DEBUG("other");
-      }
-      
-      // determine which volume 
-      bool isID =m_indetVolume->inside(tparp->position());
-      bool isCal=!isID && m_calVolume->inside(tparp->position());
-      bool isMS =!isID && !isCal;
-
-      if (msgLvl(MSG::DEBUG)) {
-	ATH_MSG_DEBUG("position: "<<tparp->position());
-	if      (isMS)  ATH_MSG_DEBUG("isMS");
-	else if (isCal) ATH_MSG_DEBUG("isCal");
-	else if (isID)  ATH_MSG_DEBUG("isID");
-	else            ATH_MSG_DEBUG("not MS, Cal, or ID!!!");
-      }
-
-      // scattering 
-      int nscatparam=0;
-      if (meb && meot) {
-	ATH_MSG_DEBUG("has meb and meot");
-	nscatparam = (scatterer) ? 2 : 1;      
-      }
-      else ATH_MSG_DEBUG("doesn't have meb and meot");
-
-      ATH_MSG_DEBUG("MTPP tsos: "<<tsos<<", meb: "<<meb<<", meot: "<<meot);
-      ATH_MSG_DEBUG("nscatparam: "<<nscatparam);
-
-      // for energy loss 
-      if (meb&&meot) {
-	qOverP=tparp->parameters()[Trk::qOverP];
-	ATH_MSG_DEBUG("qOverP: "<<qOverP<<", dyncast: "<<dynamic_cast<const CaloEnergy*>(energyLoss)<<", nscatparam: "<<nscatparam);
-	if (!dynamic_cast<const CaloEnergy*>(energyLoss) &&
-	    nscatparam!=1) {
-	  previousQOverP     = qOverP;
-	  ATH_MSG_DEBUG("previousQOverP: "<<previousQOverP);
-	}
-	else ATH_MSG_DEBUG("have calo energy loss");
-      }
-
-
-      int&    nScatRes     =isID||(isCal&&!afterCal) ? m_nIDscatRes      : m_nMSscatRes;
-      double* scatPhiRes   =isID||(isCal&&!afterCal) ? m_IDscatPhiRes    : m_MSscatPhiRes;
-      double* scatPhiErr   =isID||(isCal&&!afterCal) ? m_IDscatPhiErr    : m_MSscatPhiErr;
-      double* scatThetaRes =isID||(isCal&&!afterCal) ? m_IDscatThetaRes  : m_MSscatThetaRes;
-      double* scatThetaErr =isID||(isCal&&!afterCal) ? m_IDscatThetaErr  : m_MSscatThetaErr;
-      int nMAX=100;
-
-      for (int iparam=0;iparam<nscatparam;iparam++) {
-	
-	double errSq=0.;
-	double residual(-999.);
-	
-	if (nscatparam==2) {
-
-	  ATH_MSG_DEBUG("  scatparam: "<<iparam);
-
-	  if (tparp) {
-	    if (iparam==0) {
-	      residual=-scatterer->deltaPhi()*tparp->sinTheta();
-	      errSq   = scatterer->sigmaDeltaTheta();
-	      errSq  *=errSq;
-
-	      ATH_MSG_DEBUG("    sigmaDeltaTheta="<<scatterer->sigmaDeltaTheta());
-	      ATH_MSG_DEBUG("    sigmaDeltaPhi  ="<<scatterer->sigmaDeltaPhi());
-	      ATH_MSG_DEBUG("    residual:"<<residual<<", errSq: "<<errSq<<", err="<<std::sqrt(errSq));
-	      if (nScatRes<nMAX) {		
-		scatPhiRes[nScatRes]=residual;
-		scatPhiErr[nScatRes]=std::sqrt(errSq);
-		ATH_MSG_DEBUG("    scatPhiRes["<<nScatRes<<"]="<<scatPhiRes[nScatRes]
-			      <<", scatPhiErr["<<nScatRes<<"]="<<scatPhiErr[nScatRes]);
-		trackChi2+=residual*residual/errSq;
-	      }
-	      else 
-		ATH_MSG_WARNING("too many residuals("<<nScatRes<<"), raise array size!");
-	      
-	    }
-	    else{
-	      residual=-scatterer->deltaTheta();
-	      errSq   = scatterer->sigmaDeltaTheta();
-	      errSq  *= errSq;
-
-	      ATH_MSG_DEBUG("    residual:"<<residual<<", errSq: "<<errSq<<", err="<<std::sqrt(errSq));
-	      if (nScatRes<nMAX) {		
-		scatThetaRes[nScatRes]=residual;
-		scatThetaErr[nScatRes]=std::sqrt(errSq);
-		ATH_MSG_DEBUG("    scatThetaRes["<<nScatRes<<"]="<<scatThetaRes[nScatRes]
-			      <<", scatThetaErr["<<nScatRes<<"]="<<scatThetaErr[nScatRes]);
-		trackChi2+=residual*residual/errSq;
-	      }
-	      else 
-		ATH_MSG_WARNING("too many residuals, raise array size!");
-	    }
-	    if (iparam==1) nScatRes++;
-	  }
-	  else{ 
-	    ATH_MSG_WARNING("scatterer has no TrackParameters!");	
-	  }	  
-	}
-	else if (!rio && !crio) {
-
-	  ATH_MSG_DEBUG("  energy deposit");
-	  
-	  // energy deposit						
-	  double mass      = 105.7;
-	  double E0        = std::sqrt(1./previousQOverP/previousQOverP+mass*mass);
-	  double E1        = std::sqrt(1./qOverP/qOverP + mass*mass);
-	  double energyLoss= std::fabs(meot->energyLoss()->deltaE());
-	  
-	  double residual = .001*(E0-E1-energyLoss);
-	  double err      = .001*meot->energyLoss()->sigmaDeltaE();
-	  
-	  ATH_MSG_DEBUG("    E0/E1/energyLoss: "<<E0<<"/"<<E1<<"/"<<energyLoss);
-	  ATH_MSG_DEBUG("    calorimeter residual: "<<residual/err);
-
-	  if (m_nCalRes<10) {		
-	    m_CalRes[m_nCalRes]=residual;
-	    m_CalErr[m_nCalRes]=err;
-	    ATH_MSG_DEBUG("    calRes["<<m_nCalRes<<"]="<<m_CalRes[m_nCalRes]
-			  <<", calErr["<<m_nCalRes<<"]="<<m_CalErr[m_nCalRes]);
-	    m_nCalRes++;
-	    trackChi2+=residual*residual/err/err;
-	  }
-	  else 
-	    ATH_MSG_WARNING("   too many residuals, raise array size!");
-	}
-      }
-      
-      
-      // residuals from measurement
-      if (rio) {
-	ATH_MSG_DEBUG("  measurement");
-
-
-	int&    nMeasRes=isID||(isCal&&!afterCal) ? m_nIDres : m_nMSres;
-	double* measRes =isID||(isCal&&!afterCal) ? m_IDres  : m_MSres;
-	double* measErr =isID||(isCal&&!afterCal) ? m_IDerr  : m_MSerr;
-
-	int nMeasMAX=100;
-
-	int isEC=-1;
-	int stationLayer=-1;
-
-	if (isMS) {
-	  Identifier detId=rio->detectorElement()->identify();
-	  stationLayer=getMdtStatLayer(detId);
-	  isEC=isEndcap(detId);
-	  ATH_MSG_DEBUG("stationLayer: "<<stationLayer);
-	  ATH_MSG_DEBUG("isEndcap: "<<isEC);	  
-	}
-	
-	int nparams = (measType==Trk::TrackState::Pixel) ? 2 : 1;
-	for (int iparam=0;iparam<nparams;iparam++) {
-	  
-	  ATH_MSG_DEBUG("    iparam: "<<iparam);
-	  double errSq=0.;
-	  double residual(-999.);
-	  
-	  if ( measType!=Trk::TrackState::unidentified &&
-	       (rio!=0 || crio!=0) ) {
-	    
-	    const Trk::ResidualPull * resPull = 0;
-	    
-	    if ( tparp ) {
-	      	      
-	      ATH_MSG_DEBUG("      Calling Trk::ResidualPullCalculator for residual type "
-			    <<Trk::ResidualPull::HitOnly<<")");
-	      ATH_MSG_DEBUG("      mesb->localErrorMatrix().covValue(Trk::loc1): "<<mesb->localErrorMatrix().covValue(Trk::loc1));
-	      resPull = m_pullCalculator->residualPull(mesb, tparp,
-						       Trk::ResidualPull::HitOnly,
-						       measType);
-	      if ( resPull ) {
-		residual = (resPull->residual())[iparam];
-		double pull=(resPull->pull())[iparam];
-		if (pull!=0.) {
-		  errSq  = residual/pull;
-		}
-		errSq*=errSq;
-		
-		// MDT residual 
-		bool isTrigger=(m_idHelper->is_tgc(rio->identify()) ||
-				m_idHelper->is_rpc(rio->identify()));
-
-		if (!isTrigger || isID) {
-		  if (nMeasRes<nMeasMAX) {
-		    measRes[nMeasRes]=residual;
-		    measErr[nMeasRes]=std::sqrt(errSq);
-		    ATH_MSG_DEBUG("      measRes["<<nMeasRes<<"]="<<measRes[nMeasRes]
-				  <<", measErr["<<nMeasRes<<"]="<<measErr[nMeasRes]);
-		    if (isMS) {
-		      m_MSstatLayer[nMeasRes]=stationLayer;
-		      m_MSisEndcap [nMeasRes]=isEC;
-		    }
-		    nMeasRes++;
-
-		    trackChi2+=residual*residual/errSq;
-		  }
-		  else 
-		    ATH_MSG_WARNING("     too many residuals, raise array size!");
-		}
-
-		// trigger chamber residual
-		else {
-		  if (m_nMStrigRes<50) {
-		    m_MStrigRes[m_nMStrigRes]=residual;
-		    m_MStrigErr[m_nMStrigRes]=std::sqrt(errSq);
-		    ATH_MSG_DEBUG("      MStrigRes["<<m_nMStrigRes<<"]="<<m_MStrigRes[m_nMStrigRes]
-				  <<", MStrigErr["<<m_nMStrigRes<<"]="<<m_MStrigErr[m_nMStrigRes]);
-		    m_MStrigStatLayer[m_nMStrigRes]=stationLayer;
-		    m_MStrigIsEndcap [m_nMStrigRes]=isEC;
-		    
-		    trackChi2+=residual*residual/errSq;
-
-		    m_nMStrigRes++;
-		  }
-		  else 
-		    ATH_MSG_WARNING("     too many trigger residuals, raise array size!");		  
-		}
-		
-		ATH_MSG_DEBUG("      residual="<<residual<<", pull="<<pull);
-		ATH_MSG_DEBUG("      pos: ("<<mesb->globalPosition().x()<<", "
-			      <<mesb->globalPosition().y()<<", "
-			      <<mesb->globalPosition().z()<<")");
-		ATH_MSG_DEBUG("      residual:"<<residual<<", errSq: "<<errSq<<", err="<<std::sqrt(errSq));
-	      }
-	    }
-	    delete resPull;
-	  }
-	}
-      }
-
-      if (isID) afterCal=true;
-    }
-
-    ATH_MSG_DEBUG("nMSscatRes: "<<m_nMSscatRes<<", nIDscatRes: "<<m_nIDscatRes);
-
-    ATH_MSG_DEBUG("MTPP track chi2: "<<trackChi2<<", good track chi2: "<<m_trackChi2*(double)m_trackNDoF);
-    return;
-    */
-  }
-
-} // end Muon namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/TgcGeometryManagerTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/TgcGeometryManagerTool.cxx
deleted file mode 100644
index 68fe05d70f7..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/TgcGeometryManagerTool.cxx
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "MuonAlignGenTools/TgcGeometryManagerTool.h"
-
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "DataModel/DataVector.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-#include "TrkAlignInterfaces/IAlignModuleTool.h"
-
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/TgcReadoutElement.h"
-#include "MuonReadoutGeometry/RpcReadoutElement.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonReadoutGeometry/MuonStation.h"
-
-#include "MuonCalibIdentifier/MuonFixedId.h"
-#include "MuonCalibITools/IIdToFixedIdTool.h"
-
-#include "TrkAlignEvent/AlignModuleList.h"
-#include "TrkAlignEvent/AlignModule.h"
-#include "TrkAlignEvent/AlignPar.h"
-#include "MuonAlignEvent/CombinedMuonAlignModule.h"
-#include "MuonAlignEvent/MdtAlignModule.h"
-
-#include "MuonIdHelpers/MdtIdHelper.h"
-#include "MuonCalibStandAloneBase/RegionSelectionSvc.h"
-
-#include "GeoPrimitives/GeoPrimitivesHelpers.h"
-
-#include "TFile.h"
-#include "TTree.h"
-#include <iostream>
-
-using namespace MuonGM;
-
-namespace Muon {
-  
-//________________________________________________________________________
-TgcGeometryManagerTool::TgcGeometryManagerTool(const std::string& type,
-						 const std::string& name,
-						 const IInterface* parent)
-  : CommonGeometryManagerTool(type,name,parent)
-  , m_alignModuleTool("Muon::MuonAlignModuleTool")
-  , m_idHashToAlignModuleMaps(Trk::AlignModule::NDetectorTypes,(Trk::AlignModuleList*)0)
-  , m_alignParList    (0)
-  , m_fullAlignParList(0)
- {
-
-  declareInterface<IGeometryManagerTool>(this);
-
-  declareProperty("AlignModuleTool",     m_alignModuleTool);
-  declareProperty("MdtAlignParameters",  m_mdtAlignParameters );
-  declareProperty("AlignLevel",          m_alignLevel=3);
-
-}
-
-//________________________________________________________________________
-TgcGeometryManagerTool::~TgcGeometryManagerTool() 
-{
-  ATH_MSG_DEBUG("in TgcGeometryManagerTool d'tor");
-  
-  ATH_MSG_DEBUG("alignModuleList.size: "<<m_alignModuleList.size());
-  for (int i=0;i<(int)m_alignModuleList.size();i++) 
-    delete m_alignModuleList[i];
-  
-  ATH_MSG_DEBUG("deleting fullAlignParList");
-  delete m_fullAlignParList;
-  
-  ATH_MSG_DEBUG("deleting alignParList");
-  delete m_alignParList;
-
-  ATH_MSG_DEBUG("done with TgcGeometryManagerTool d'tor");
-
-}
-
-//_______________________________________________________________________
-StatusCode TgcGeometryManagerTool::initialize() 
-{
-  msg(MSG::DEBUG) << "initialize() of TgcGeometryManagerTool" << endmsg;  
-
-  if (!CommonGeometryManagerTool::initialize().isSuccess()) {
-    ATH_MSG_FATAL("CommonGeometryManagerTool not initialized");
-    return StatusCode::FAILURE;
-  }
-  
-  return StatusCode::SUCCESS;
-}
-  
-//________________________________________________________________________
-StatusCode TgcGeometryManagerTool::finalize() 
-{  
-  msg(MSG::DEBUG) << "finalize() of TgcGeometryManagerTool" << endmsg;
-  
-  if (!CommonGeometryManagerTool::finalize().isSuccess()) {
-    ATH_MSG_FATAL("CommonGeometryManagerTool finalize not successful");
-    return StatusCode::FAILURE;
-  }
-  
-  return StatusCode::SUCCESS;
-}
-
-//________________________________________________________________________
-int TgcGeometryManagerTool::ReadGeometry(int)
-{
-  ATH_MSG_DEBUG("in ReadGeometry()");
-  
-  // set pointers
-  m_idHashToAlignModuleMapsPtr = &m_idHashToAlignModuleMaps;
-  m_alignModuleListPtr = &m_alignModuleList;
-  
-  // build alignment geometry
-  buildGeometry();
-  
-  // now set the alignment parameters
-  // first prepare the parameter lists
-  m_alignParList     = new DataVector< DataVector<Trk::AlignPar> >(SG::OWN_ELEMENTS);
-  m_fullAlignParList = new DataVector< DataVector<Trk::AlignPar> >(SG::OWN_ELEMENTS);
-
-  // loop over modules
-  ATH_MSG_DEBUG("Adding module parameters to modules");
-  std::vector<Trk::AlignModule *>::const_iterator imod = m_alignModuleListPtr->begin();
-  std::vector<Trk::AlignModule *>::const_iterator imod_end = m_alignModuleListPtr->end();
-  for( ; imod!=imod_end ; ++imod) {
-    ATH_MSG_DEBUG("Module "<<(*imod)->name());
-    addModuleParameters(*imod,m_fullAlignParList,m_alignParList);
-  }
-  
-  // set alignModuleList and hash table in the alignModuleTool
-  m_alignModuleTool->setAlignModules(&m_alignModuleList, &m_idHashToAlignModuleMaps);
-  ATH_MSG_DEBUG(" geometry set in m_alignModuleTool");
-  
-  // set alignPar lists in the alignModuleTool
-  ATH_MSG_DEBUG(" alignParList = "<<m_alignParList);
-  ATH_MSG_DEBUG(" fullAlignParList = "<<m_fullAlignParList);
-  m_alignModuleTool->setAlignParLists(m_fullAlignParList, m_alignParList);
-  ATH_MSG_DEBUG(" AlignParLists set in m_alignModuleTool");
-    
-  int nDoF= m_alignModuleTool->nAlignParameters();
-  ATH_MSG_DEBUG("AlignModuleList has " << nDoF << " alignment parameters");
-  
-  ATH_MSG_DEBUG("leaving ReadGeometry");
-  return nDoF;
-}
-
-//________________________________________________________________________
-void TgcGeometryManagerTool::buildGeometry()
-{
-  ATH_MSG_INFO("Preparing MDT geometry");
-  if      (m_alignLevel==0)  buildL0();
-  else if (m_alignLevel==3)  buildL3();
-  else if (m_alignLevel==1)  buildL1();
-  else if (m_alignLevel==23) buildL23();
-  else
-    ATH_MSG_FATAL("Can't do alignLevel "<<m_alignLevel<<" yet!");
-}
-
-//________________________________________________________________________
-void TgcGeometryManagerTool::buildL3()
-{
-
-  
-  ATH_MSG_INFO("preparing MDT geometry for L3");
-
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	
-	CombinedMuonAlignModule* alignmod(0);
-	
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  const MuonGM::MdtReadoutElement* mdt=
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  
-	  if (!mdt) continue;
-	  
-          const Amg::Transform3D mdtTransform = mdt->AmdbLRSToGlobalTransform();
-          Amg::Transform3D gf2af=mdtTransform.inverse();
-	  
-	  if (alignmod==0) {
-	    
-	    if (!chamberSelected(mdt)) continue;
-	    
-	    alignmod=new CombinedMuonAlignModule(this,gf2af);
-	    
-	    // set alignModule identifier and idHash
-	    Identifier id=mdt->identifyATLAS();
-	    alignmod->setIdHash(getNextIDHash());
-	    alignmod->setIdentifier(id);
-	    
-	    // set alignModule name
-	    MuonCalib::MuonFixedId fid=m_idTool->idToFixedId(id);
-	    std::string name=fid.stationNumberToFixedStationString(fid.stationName());
-	    
-	    std::stringstream chamberName;
-	    chamberName<<name<<std::abs(fid.eta());
-	    if (fid.eta()<0) chamberName<<"C"; else chamberName<<"A";
-	    int detphi=2*fid.phi(); 
-	    if (name.substr(2,1)=="L")      detphi--;
-	    else if (name.substr(2,1)!="S") detphi=fid.phi();	      
-	    chamberName<<detphi;	      
-	    alignmod->setName(chamberName.str());
-	    
-	    ATH_MSG_DEBUG("created new MdtAlignModule, id "<<id
-			  <<", fixedId "<<fid.getIdInt()
-			  <<", "<<chamberName.str().c_str());
-	    	  
-	    m_alignModuleListPtr->push_back(alignmod);
-	  } // created new alignModule
-	  
-	  // add this mdt to alignModule and set map from idHash to AlignModule
-	  const Amg::Transform3D transform = Amg::Transform3D::Identity();
-	  alignmod->addDetElement(Trk::AlignModule::MDT,mdt,transform);
-	  
-	  int idHash=mdt->identifyHash(); // this returns idHash for MDT detector, not readout element. But it's ok because there's 1 detector element per align module.
-	   
-	  ATH_MSG_DEBUG("setting alignmod for idHash "<<idHash);
-	  (*mdtIdHashMap)[idHash]=alignmod;
-	  ATH_MSG_DEBUG("setting idHash");
-	  alignmod->setIdHash(idHash);
-
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-
-  return;
-  
-}
-
-//________________________________________________________________________
-void TgcGeometryManagerTool::buildL0()
-{
-  
-  ATH_MSG_INFO("preparing MDT geometry for L0");
-
-  // Create align module.  Alignment will be done in global frame.
-  //Amg::Transform3D transformBar=Amg::Transform3D::Identity();
-  
-  CombinedMuonAlignModule* mod= new CombinedMuonAlignModule(this,Amg::Transform3D::Identity());
-
-  mod->setIdHash(getNextIDHash());
-  mod->setName("MDT");
-  mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("BIL",1,1,1,1,1));
-  
-  // loop over MDT chambers and add to modules
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-  
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  const MuonGM::MdtReadoutElement* mdt = 
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  if (0==mdt) continue;
-	  
-	  // get AlignModule, determine whether endcap or barrel
-	  unsigned int det=Barrel;
-	  bool isBarrel=p_muonMgr->mdtIdHelper()->isBarrel(mdt->identify());
-	  
-	  // change to endcap if BEE
-	  if (isBarrel) {
-	    std::string stNameString=p_muonMgr->mdtIdHelper()->stationNameString(p_muonMgr->mdtIdHelper()->stationName(mdt->identify()));
-	    if (stNameString.substr(0,3)=="BEE") isBarrel=false;
-	  }
-	  
-	  if (!isBarrel) {
-	    int stEta=ieta-MuonGM::MuonDetectorManager::NMdtStEtaOffset;
-	    det = (stEta>0) ? EndcapA : EndcapC;
-	  }
-	  
-	  Trk::AlignModule* mod(0);
-	  for (int imod=0;imod<(int)m_alignModuleList.size();imod++) {
-	    if (m_alignModuleList[imod]->identify32()==det) {
-	      mod=m_alignModuleList[imod];
-	      break;
-	    }
-	  }
-	  
-	  if (!mod) continue;
-	  
-	  // add detector element to AlignModule
-	  IdentifierHash idHash=mdt->identifyHash();	  
-	  
-	  Amg::Transform3D level1AlignToAmdbLRS = 
-	    mod->globalFrameToAlignFrame().inverse() *
-	    mdt->AmdbLRSToGlobalTransform().inverse();
-	  
-	  
-	  mod->addDetElement(Trk::AlignModule::MDT,
-			     mdt, level1AlignToAmdbLRS);
-	  
-	  (*mdtIdHashMap)[idHash]=mod;
-	  
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-  
-  return;
-}
-//________________________________________________________________________
-void TgcGeometryManagerTool::buildL1()
-{
-  
-  ATH_MSG_INFO("preparing MDT geometry for L1");
-
-  // Create align modules.  Alignment will be done in global frame for barrel and 
-  // each end cap.
-  std::string modulenames[nL1Modules]={"ECA","ECC","Bar"};
-  
-  for (int imod=0;imod<nL1Modules;imod++) {      
-    
-    if (!moduleSelected(modulenames[imod])) continue;
-    
-    CombinedMuonAlignModule* mod = 
-      new CombinedMuonAlignModule(this,Amg::Transform3D::Identity());
-
-    m_alignModuleListPtr->push_back(mod);
-    
-    mod->setIdHash(getNextIDHash());
-    mod->setName(modulenames[imod]);
-
-    switch (imod) {
-    case 0:
-      mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("EIL", 1,1,1,1,1));
-      break;
-    case 1:
-      mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("EIL",-1,1,1,1,1));
-      break;
-    case 2:
-      mod->setIdentifier(p_muonMgr->mdtIdHelper()->channelID("BIL", 1,1,1,1,1));
-      break;
-    }
-  }
-
-  // loop over MDT chambers and add to modules
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-  
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ieta=0; ieta<MuonGM::MuonDetectorManager::NMdtStatEta; ieta++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {
-	for (int imult=0; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  const MuonGM::MdtReadoutElement* mdt = 
-	    p_muonMgr->getMdtReadoutElement(iname,ieta,iphi,imult);
-	  if (0==mdt) continue;
-	  
-	  // get AlignModule, determine whether endcap or barrel
-	  unsigned int det=Barrel;
-	  bool isBarrel=p_muonMgr->mdtIdHelper()->isBarrel(mdt->identify());
-	  
-	  // change to endcap if BEE
-	  if (isBarrel) {
-	    std::string stNameString=p_muonMgr->mdtIdHelper()->stationNameString(p_muonMgr->mdtIdHelper()->stationName(mdt->identify()));
-	    if (stNameString.substr(0,3)=="BEE") isBarrel=false;
-	  }
-	  
-	  if (!isBarrel) {
-	    int stEta=ieta-MuonGM::MuonDetectorManager::NMdtStEtaOffset;
-	    det = (stEta>0) ? EndcapA : EndcapC;
-	  }
-	  
-	  Trk::AlignModule* mod(0);
-	  for (int imod=0;imod<(int)m_alignModuleList.size();imod++) {
-	    if (m_alignModuleList[imod]->identify32()==det) {
-	      mod=m_alignModuleList[imod];
-	      break;
-	    }
-	  }
-	  
-	  if (!mod) continue;
-	  
-	  // add detector element to AlignModule
-	  IdentifierHash idHash=mdt->identifyHash();	  
-	  
-	  Amg::Transform3D level1AlignToAmdbLRS = 
-	    mod->globalFrameToAlignFrame().inverse() *
-	    mdt->AmdbLRSToGlobalTransform().inverse(); 
-	  	  
-	  mod->addDetElement(Trk::AlignModule::MDT,
-			     mdt, level1AlignToAmdbLRS);
-	  
-	  (*mdtIdHashMap)[idHash]=mod;
-	  
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-  
-  return;
-}
-
-//________________________________________________________________________
-void TgcGeometryManagerTool::buildL23()
-{
-
-  ATH_MSG_ERROR("migrate TgcGeometryManagerTool::buildL23() go Eigen");
-  return;
-
-  /*
-  ATH_MSG_INFO("preparing MDT geometry for L2.3");
-  
-  //get module names
-  unsigned int nSectors = 16;
-  std::vector<std::string> moduleNames(64);
-  
-  unsigned int imod=0;
-  for (unsigned int isec=0; isec<nSectors; isec++) {
-    
-    bool isSmall = ((isec+1)%2 == 0) ? true : false; 
-    for (int detSide=0; detSide<2; detSide++){
-      
-      std::stringstream moduleStream;
-      moduleStream<<"Sector";
-      
-      if (detSide==0) moduleStream<<"A";
-      else            moduleStream<<"C";
-      
-      moduleStream<<(isec+1);
-      std::string moduleString=moduleStream.str();
-      
-      if(!isSmall){
-        moduleNames[imod++]=moduleString;
-      }
-      else{
-        moduleNames[imod++]=moduleString+"_I";
-        moduleNames[imod++]=moduleString+"_M";
-        moduleNames[imod++]=moduleString+"_O";
-      }
-    }
-  }
-  
-  // create AlignModules
-  for (imod=0; imod<moduleNames.size(); ++imod) {
-    
-    ATH_MSG_DEBUG("building Module: " << moduleNames[imod]);
-    if (!moduleSelected(moduleNames[imod])){ 
-      ATH_MSG_DEBUG("Module not in selection.");
-      continue;
-    }
-    
-    CombinedMuonAlignModule* mod;
-    mod = new CombinedMuonAlignModule(this,Amg::Transform3D::Identity());
-    m_alignModuleListPtr->push_back(mod);
-    
-    mod->setName(moduleNames[imod]);
-    mod->setIdentifier((Identifier)imod);
-    mod->setIdHash(getNextIDHash());
-  }
-  
-  // loop over MDT chamber and add to AlignModules
-  const int NMDTREL=MuonGM::MuonDetectorManager::MdtDetElMaxHash;  
-  if (!m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT))
-    m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT) = 
-      new Trk::AlignModuleList((size_t)NMDTREL,0);
-  Trk::AlignModuleList* mdtIdHashMap = m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::MDT);
-  
-  int etamax = abs(p_muonMgr->mdtIdHelper()->stationEtaMin(true))
-    + p_muonMgr->mdtIdHelper()->stationEtaMax(true);
-
-  for (int iname=0; iname<MuonGM::MuonDetectorManager::NMdtStatType; iname++) {
-    for (int ietaindex=0; ietaindex<etamax; ietaindex++) {
-      for (int iphi=0; iphi<MuonGM::MuonDetectorManager::NMdtStatPhi; iphi++) {	
-	for (int imult=1; imult<MuonGM::MuonDetectorManager::NMdtMultilayer; imult++) {
-	  
-	  
-	  //loop first eta=0..8, then eta=-1..-8
-          int ieta = ietaindex;
-          if (ietaindex > p_muonMgr->mdtIdHelper()->stationEtaMax(true)) {
-            ieta = -1*(ietaindex - p_muonMgr->mdtIdHelper()->stationEtaMax(true));
-          }
-	  
-          ATH_MSG_DEBUG("loop -> name: " << iname << ", eta: " << ieta 
-                        << ", phi: " << iphi << ", mult: " << imult);
-	  
-          bool isValid(true);
-          Identifier chid = p_muonMgr->mdtIdHelper()->channelID(iname,ieta,iphi,imult,1,1,true,&isValid);
-          if (!isValid){ 
-            ATH_MSG_DEBUG("not valid ID!");
-            continue;
-          }
-	  
-          int stName = p_muonMgr->mdtIdHelper()->stationName(chid);
-          int stEta  = p_muonMgr->mdtIdHelper()->stationEta(chid);
-          int stPhi  = p_muonMgr->mdtIdHelper()->stationPhi(chid);
-          int ml     = p_muonMgr->mdtIdHelper()->multilayer(chid);
-       
-          ATH_MSG_DEBUG("loop2 -> name: " << stName << ", eta: " << stEta 
-                        << ", phi: " << stPhi << ", mult: " << ml << ", valid: " << isValid);
-
-          const MuonGM::MdtReadoutElement* mdt = 
-            p_muonMgr->getMdtReadoutElement(chid);
- 
-	  if (!mdt) continue;
-	  
-	  bool isBarrel=p_muonMgr->mdtIdHelper()->isBarrel(mdt->identify());
-	  if (!isBarrel){
-            ATH_MSG_DEBUG("is not Barrel");
-            continue;
-          }
-	  
-          MuonCalib::MuonFixedId fid=m_idTool->idToFixedId(mdt->identify());
-          std::string name=fid.stationNumberToFixedStationString(fid.stationName());	    
-          ATH_MSG_DEBUG("name: " << name);
-	  
-          if(name=="BEE"){
-            ATH_MSG_DEBUG("Is BEE chamber, will be rejected.");
-            continue;
-	  }
-	  
-          std::stringstream chamberName;
-          chamberName<<name<<std::abs(fid.eta());
-          if (fid.eta()<0) chamberName<<"C"; else chamberName<<"A";
-          int detphi=2*fid.phi(); 
-          if (name.substr(2,1)=="L")      detphi--;
-          else if (name.substr(2,1)!="S") detphi=fid.phi();	      
-          chamberName<<detphi;	      
-          ATH_MSG_DEBUG("chamberName: " << chamberName.str());
-	  
-          std::stringstream modName;
-          modName<<"Sector";
-          if (fid.eta()<0) modName<<"C"; 
-          else             modName<<"A";
-          modName<<detphi;
-          
-          ATH_MSG_DEBUG("iphi: " << iphi);
-          if(detphi%2==0){
-            ATH_MSG_DEBUG("is odd");
-            if (name.substr(1,1)=="I")      modName<<"_I";
-            else if (name.substr(1,1)=="M") modName<<"_M";
-            else if (name.substr(1,1)=="O") modName<<"_O";
-            else ATH_MSG_WARNING("Could not identify chamber layer for chamber: " << name);
-          }
-          
-          ATH_MSG_DEBUG("modName: " << modName.str());
-	  
-	  Trk::AlignModule* mod(0);
-	  for (unsigned int imod=0;imod<m_alignModuleList.size();imod++) {
-	    //ATH_MSG_DEBUG("  modlist["<<imod<<"]: "<<m_alignModuleList[imod]->name());
-            if (m_alignModuleList[imod]->name()==modName.str()) {
-	      mod=m_alignModuleList[imod];
-	      break;
-	    }
-	  }
-	  
-	  if (!mod) { ATH_MSG_DEBUG("no module"); continue; }
-
-	  //set alignframe to the local frame of first readout element
-          if (mod->globalFrameToAlignFrame().matrix().isIdentity()) {
-            const Amg::Transform3D mdtTransform = mdt->AmdbLRSToGlobalTransform();
-            Amg::Transform3D gf2af=mdtTransform.inverse();
-            mod->setGlobalFrameToAlignFrameTransform(gf2af);
-            
-            ATH_MSG_DEBUG("setting globalFrameToAlignFrame: "<<endmsg
-                          <<     gf2af[0][0]<<" "<< gf2af[0][1]<<" "<< gf2af[0][2]
-                          <<" "<<gf2af[1][0]<<" "<< gf2af[1][1]<<" "<< gf2af[1][2]
-                          <<" "<<gf2af[2][0]<<" "<< gf2af[2][1]<<" "<< gf2af[2][2]<<" ");
-	    
-	    
-            Identifier id = mdt->identifyATLAS();
-            mod->setIdentifier(id);
-            ATH_MSG_DEBUG("name: " << name << ", eta: " << ieta << ", phi: " << iphi);
-            ATH_MSG_DEBUG("alignmod identifier: " << id.getString());
-          } 
-	  else 
-            ATH_MSG_DEBUG("transform already set");          
-          	 	  
-	  // add detector element to AlignModule
-	  IdentifierHash idHash=mdt->identifyHash();	  
-
-	  Amg::Transform3D level23AlignToAmdbLRS = 
-	    mod->globalFrameToAlignFrame().inverse() *
-	    mdt->AmdbLRSToGlobalTransform().inverse(); 
-	  
-           mod->addDetElement(Trk::AlignModule::MDT,
-                              mdt, level23AlignToAmdbLRS);
-	  (*mdtIdHashMap)[idHash]=mod;
-
-	} // imult
-      } // iphi
-    } // ieta
-  } // iname
-
-  return;
-  */
-}
-
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/UnbiasedMuonResiduals.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/UnbiasedMuonResiduals.cxx
deleted file mode 100644
index 338f327efef..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/UnbiasedMuonResiduals.cxx
+++ /dev/null
@@ -1,3101 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/* **********************************************************************
-   UnbiasedMuonResiduals.cxx
-
-   Author:      Dominique Fortin - TRIUMF
-   Robert Harrington - BU
-   created:     May 2010
-   Description: Implementation code for the validation of the alignment of the MDT
-	        
-*********************************************************************/
-
-#include "MuonAlignGenTools/UnbiasedMuonResiduals.h"
-#include "MuonAlignGenTools/MuonAlignHelperTool.h"
-#include "MuonAlignGenTools/MuonAlignRefitTool.h"
-
-#include "StoreGate/StoreGateSvc.h"
-
-#include "TrigDecisionInterface/ITrigDecisionTool.h"
-
-#include "muonEvent/MuonContainer.h"
-
-#include "TrkFitterInterfaces/ITrackFitter.h"
-#include "MuidInterfaces/ICombinedMuonTrackBuilder.h"
-
-#include "TrkTrack/TrackCollection.h"
-#include "TrkRIO_OnTrack/RIO_OnTrack.h"
-#include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h"
-#include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h"
-#include "MuonRIO_OnTrack/TgcClusterOnTrack.h"
-
-#include "MuonIdHelpers/MuonIdHelper.h"
-#include "MuonIdHelpers/MdtIdHelper.h"
-#include "MuonIdHelpers/CscIdHelper.h"
-
-#include "MuonLinearSegmentMakerUtilities/Fit2D.h"
-
-#include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
-#include "MuonReadoutGeometry/CscReadoutElement.h"
-#include "MuonReadoutGeometry/CscDetectorElement.h"
-
-
-// Muon Helpers
-#include "MuonRecHelperTools/MuonEDMPrinterTool.h"
-#include "MuonRecHelperTools/MuonEDMHelperTool.h"
-#include "MuonRecHelperTools/MuonEDMPrinterTool.h"
-#include "MuonIdHelpers/MuonIdHelperTool.h"
-#include "MuonIdHelpers/MuonStationIndex.h"
-
-// Muon Segment + Quality
-#include "MuonSegment/MuonSegment.h"
-#include "MuonSegment/MuonSegmentQuality.h"
-
-// Building track from segments
-#include "MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h"
-
-// Track info
-#include "TrkSegment/Segment.h"
-#include "TrkSegment/SegmentCollection.h"
-#include "TrkExInterfaces/IExtrapolator.h"
-//#include "TrkMagFieldInterfaces/IMagneticFieldTool.h"
-#include "TrkGeometry/TrackingGeometry.h"
-#include "TrkGeometry/MagneticFieldProperties.h"
-//#include "TrkParameters/MeasuredPerigee.h"
-
-#include "TrkParameters/TrackParameters.h"
-//#include "TrkParameters/MeasuredTrackParameters.h"
-
-#include "TrkTrackSummary/TrackSummary.h"
-#include "TrkEventPrimitives/LocalDirection.h"
-#include "TrkEventPrimitives/JacobianPhiThetaLocalAngles.h"
-#include "TrkEventPrimitives/PropDirection.h"
-#include "TrkEventPrimitives/ResidualPull.h"
-#include "TrkParameters/TrackParameters.h"
-//#include "TrkParameters/MeasuredAtaPlane.h"
-#include "TrkToolInterfaces/IResidualPullCalculator.h"
-
-#include "MuonSegmentMakerUtils/MuonSegmentKey.h"
-#include "MuonSegmentMakerUtils/CompareMuonSegmentKeys.h"
-
-#include "MuonCombinedToolInterfaces/IMuonTrackTagTool.h"
-
-#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h"
-#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h"
-
-#include "TFile.h"
-#include "TTree.h"
-
-#include <set>
-#include <vector>
-#include <cmath>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <algorithm>
-#include <math.h>
-#include <functional>
-
-#include <map>
-
-#ifndef REDO_CSC_ROTS
-#define REDO_CSC_ROTS 0
-#endif
-
-using namespace Rec;
-using namespace Trk;
-
-namespace Muon {
-
-  /*
-  //________________________________________________________________________
-  static std::string point2String(const HepGeom::Point3D<double>& pt)
-  {
-    std::ostringstream oss;
-    oss << "eta=" << pt.eta() << ",phi=" << pt.phi() << ",perp=" << pt.perp() << ",z=" << pt.z();
-    return oss.str();
-  }
-  
-  //________________________________________________________________________
-  static std::string dir2String(const HepGeom::Vector3D<double>& dir)
-  {
-    std::ostringstream oss;
-    oss << "eta=" << dir.eta() << ",phi=" << dir.phi()<< ",z=" << dir.z();
-    return oss.str();
-  }
-  */
-
-  //________________________________________________________________________
-  UnbiasedMuonResiduals::UnbiasedMuonResiduals( const std::string & name, 
-						ISvcLocator* pSvcLocator)
-    : AthAlgorithm(name,pSvcLocator)
-    , m_detMgr(0)
-    , m_storeGate(0)
-    , m_tagTool("")
-    , p_muonEDMHelperTool("Muon::MuonEDMHelperTool/MuonEDMHelperTool")
-    , p_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool")
-    , p_trackBuilder("Muon::MuonSegmentTrackBuilder/MuonSegmentTrackBuilder")
-      //, p_trackRefitTool("Muon::MuonRefitTool/MuonRefitTool")
-    , p_IExtrapolator("Trk::Extrapolator/AtlasExtrapolator")
-    , m_combinedTrackBuilder("Rec::CombinedMuonTrackBuilder/CombinedMuonTrackBuilder")
-    , m_trackFitter("Trk::GlobalChi2Fitter/MCTBFitter")
-    , m_trigDec("Trig::TrigDecisionTool/TrigDecisionTool")
-    , m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator")
-    , m_mdtRotCreator("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator")
-    , m_cscRotCreator("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator")
-    , m_muonAlignHelperTool("Muon::MuonAlignHelperTool")
-    , m_muonAlignRefitTool("Muon::MuonAlignRefitTool")
-    , m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool")
-    , m_file(0) 
-    , m_tree(0)
-    , m_MAXNMDTHITS(80)
-    , m_MAXNTGCHITS(80)
-    , m_MAXNCSCHITS(20)
-    , m_MAXNRPCHITS(80)
-    , m_cscHitLocX(new double[m_MAXNCSCHITS])
-    , m_cscHitLocY(new double[m_MAXNCSCHITS])
-    , m_cscHitErrors(new double[m_MAXNCSCHITS])
-    , m_mdtRes(new double[m_MAXNMDTHITS])
-    , m_tgcRes(new double[m_MAXNTGCHITS])
-    , m_cscRes(new double[m_MAXNCSCHITS])
-    , m_rpcRes(new double[m_MAXNRPCHITS])
-    , m_mdtPull(new double[m_MAXNMDTHITS])
-    , m_tgcPull(new double[m_MAXNTGCHITS])
-    , m_cscPull(new double[m_MAXNCSCHITS])
-    , m_rpcPull(new double[m_MAXNRPCHITS])
-    , m_dR(0.)
-    , m_dZlocal(0.)
-  {
-
-    /** switches to control the analysis through job options */
-    declareProperty("TagTool",                 m_tagTool);
-    declareProperty("ResidualPullCalculator",  m_pullCalculator);
-    declareProperty("Extrapolator",            p_IExtrapolator);
-
-    declareProperty("WhichSegmCollections",    m_segmCollectionFlag);
-    declareProperty("SegmentCollectionName",   m_segmCollectionName);
-    declareProperty("MuonTrackCollections",    m_trackCollectionName);  
-    declareProperty("InDetTrackCollections",   m_inDetTrackCollectionName);
-
-    // development for TGC residuals not ready yet
-    //declareProperty("MuonTgcPrdKey",           m_muonTgcPrdKey="TGC_Measurements");
-    //declareProperty("MuonTgcPrdKeyPrev",       m_muonTgcPrdKey_prev="TGC_MeasurementsPriorBC");
-    //declareProperty("MuonTgcPrdKeyNext",       m_muonTgcPrdKey_next="TGC_MeasurementsNextBC");
-
-
-    declareProperty("Fitter",                  m_trackFitter);
-    declareProperty("CombinedTrackBuilder",    m_combinedTrackBuilder);
-    declareProperty("TrackFittingType",        m_trackFittingType=2);
-
-    declareProperty("UseTrackContainer",       m_useTrackContainer=true);
-
-    declareProperty("ExtrapolateIDTrack",      m_extrapolateIDTrack=false);
-
-    /** Requirements on combined muon track */
-    declareProperty("maxIDTrackd0",        m_MaxIDd0           =  50.0);
-    declareProperty("maxIDTrackz0",        m_MaxIDz0           = 200.0);
-    declareProperty("maxIDTrackChidof",    m_MaxIDChiDof       = 5.0 ); 
-    declareProperty("minMuonMom",          m_MinMuonMom        = 5.0 ); // minimum ms and id track momentum 
-    declareProperty("trackMatchDeltaR",    m_trackMatchDeltaR  = 0.5);
-    declareProperty("matchChi2Cut",        m_matchChi2Cut      = 25.);
-
-    declareProperty("minPIXHits",          m_minPIXHits        = 2);
-    declareProperty("minSCTHits",          m_minSCTHits        = 4);
-    declareProperty("minTRTHits",          m_minTRTHits        = 0);
-    declareProperty("minCSCHits",          m_minCSCHits        = 0);
-    declareProperty("minMDTHits",          m_minMDTHits        = 3);
-
-    declareProperty("TriggerList",         m_triggerList);
-
-    declareProperty("doMdt",               m_doMdt=true);
-    declareProperty("doCsc",               m_doCsc=true);
-    declareProperty("doTgc",               m_doTgc=true);
-    declareProperty("doRpc",               m_doRpc=true);
-
-    declareProperty("MakeTgcOutliers",     m_makeTGCOutliers=true);
-    declareProperty("RedoErrorScaling",    m_redoErrorScaling=true);
-
-    m_nPixHits=m_nSCTHits=m_nTRTHits=m_nCSCHits=m_nMDTHits=m_nRPCHits=m_nTGCHits=0;
-    m_nInnerMDTHits=m_nMiddleMDTHits=m_nOuterMDTHits=m_nTriggerPhiHits=0;
-
-    m_author=m_hIndex=m_phiSector=m_isEndcap=m_identifier=m_isCSide=
-      m_detType=-999;
-    
-    m_momentum=m_charge=m_d0=m_z0=m_phi0=m_theta0=m_eta0=-999.;
-    m_trackChi2=m_calEnergyLoss=m_calEnergyLossErr=-999.;
-    m_materialOnTrack=0.;
-    
-    m_deltaPhi=m_deltaTheta=m_dR=m_dXlocal=m_dZlocal=m_dYlocal=
-      m_dXlocalAngle=m_dYlocalAngle=-999.;
-    
-    m_layer=m_stName=m_stPhi=m_stEta=-999;
-    m_pullXlocal=m_pullYlocal=m_pullXlocalAngle=m_pullYlocalAngle=-999.;
-
-    m_run=m_evt=0;
-
-    m_dXglobal=m_dYglobal=m_dZglobal=m_dXglobalAngle=m_dYglobalAngle=m_dZglobalAngle=-999.;
-    m_detTheta=m_detThetaErr=-999.;
-  }
-
-  //________________________________________________________________________
-  UnbiasedMuonResiduals::~UnbiasedMuonResiduals() 
-  {
-
-    delete [] m_cscHitLocX;
-    delete [] m_cscHitLocY;
-    delete [] m_cscHitErrors;
-
-    delete [] m_mdtRes;
-    delete [] m_tgcRes;
-    delete [] m_cscRes;
-    delete [] m_rpcRes;   
-
-    delete [] m_mdtPull;
-    delete [] m_tgcPull;
-    delete [] m_cscPull;
-    delete [] m_rpcPull;
-
-  }
-
-  //________________________________________________________________________
-  StatusCode UnbiasedMuonResiduals::initialize() 
-  {
-    
-    /** retrieve MuonTrackTagTool */
-    if (m_tagTool.name()!=""){
-      if (m_tagTool.retrieve().isFailure()) {
-	ATH_MSG_FATAL("Failed to retrieve tool " << m_tagTool);
-	return StatusCode::FAILURE;
-      }
-      else {
-	ATH_MSG_INFO("Retrieved tool " << m_tagTool);
-      }       
-    }
-
-    // check if TagTool exists
-    if (m_trackFittingType == MSStandaloneWithIDTrackMatch) {      
-      if (m_tagTool.empty()) {
-	ATH_MSG_ERROR("need TagTool to match MS track to ID track!");
-	return StatusCode::FAILURE;
-      }	
-    }
-    
-    /** retrieve MuonDetectorManager */
-    StatusCode sc = detStore()->retrieve(m_detMgr,"Muon");
-    if(sc.isFailure()) {
-      ATH_MSG_ERROR("Could not find the MuonDetectorManager! ");
-      return StatusCode::FAILURE;
-    }
-  
-    /** Helper tool */
-    sc = p_muonEDMHelperTool.retrieve();
-    if (sc.isFailure()){
-      ATH_MSG_FATAL("Fatal to retrieve - Could not get " << p_muonEDMHelperTool); 
-      return sc;
-    } else {
-      ATH_MSG_DEBUG("Retrieved tool" << p_muonEDMHelperTool);
-    } 
-
-    /** Id helpers tools */
-    sc = p_idHelperTool.retrieve();
-    if (sc.isFailure()){
-      ATH_MSG_ERROR("Failed to retrieve tool   " << p_idHelperTool);
-      return sc;
-    } else {
-      ATH_MSG_DEBUG("Retrieved tool   " << p_idHelperTool);
-    }    
-
-    /** Track builder from a pair of segments */
-    sc = p_trackBuilder.retrieve();
-
-    if (sc.isFailure()) {
-      ATH_MSG_FATAL("Could not get " << p_trackBuilder);
-      return sc;
-    } else {
-      ATH_MSG_INFO("Retrieved " << p_trackBuilder);
-    }
-
-    /** Track refit tool */
-    /*
-      sc = p_trackRefitTool.retrieve();
-      if (sc.isFailure()) {
-      ATH_MSG_FATAL("Could not get " << p_trackRefitTool);
-      return sc;
-      } else {
-      ATH_MSG_INFO("Retrieved " << p_trackRefitTool);
-      }
-    */
-
-    sc = m_trackFitter.retrieve();
-    if (sc.isFailure()) {
-      ATH_MSG_FATAL("Could not find refit tool "<<m_trackFitter<<". Exiting.");
-      return StatusCode::FAILURE;
-    } else {
-      ATH_MSG_INFO("Refit tool "<<m_trackFitter);
-    }
-  
-    sc = m_combinedTrackBuilder.retrieve();
-    if (sc.isFailure()) {
-      ATH_MSG_FATAL("Could not find refit tool "<<m_combinedTrackBuilder<<". Exiting.");
-      return StatusCode::FAILURE;
-    } else {
-      ATH_MSG_INFO("Refit tool "<<m_combinedTrackBuilder);
-    }
-    
-    /** Track extrapolator */
-    sc = p_IExtrapolator.retrieve();
-    if (sc.isFailure()){
-      ATH_MSG_ERROR("Could not get " << p_IExtrapolator);
-      return sc;
-    } else {
-      ATH_MSG_INFO("Retrieved " << p_IExtrapolator);
-    }
-   
-    /** Trigger decision tool */
-    sc = m_trigDec.retrieve();
-    if (sc.isFailure()){
-      ATH_MSG_ERROR("Could not get " << m_trigDec);
-      return sc;
-    } else {
-      ATH_MSG_INFO("Retrieved " << m_trigDec);
-    }
-
-    /** muonAlignHelperTool */
-    if (m_muonAlignHelperTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved "<<m_muonAlignHelperTool);
-    else {
-      ATH_MSG_FATAL("Could not get "<<m_muonAlignHelperTool);
-      return StatusCode::FAILURE;
-    }
-
-    /** muonAlignRefitTool */
-    if (m_muonAlignRefitTool.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved "<<m_muonAlignRefitTool);
-    else {
-      ATH_MSG_FATAL("Could not get "<<m_muonAlignRefitTool);
-      return StatusCode::FAILURE;
-    }
-
-    /** residual pull calculator */
-    if (m_pullCalculator.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_pullCalculator);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_pullCalculator);
-      return StatusCode::FAILURE;
-    }
-
-    /** MdtDriftCircleOnTrackCreator*/
-    if (m_mdtRotCreator.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_mdtRotCreator);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_mdtRotCreator);
-      return StatusCode::FAILURE;
-    }
-    
-    /** CscClusterOnTrackCreator*/
-    if (m_cscRotCreator.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved " << m_cscRotCreator);
-    else{
-      ATH_MSG_FATAL("Could not get " << m_cscRotCreator);
-      return StatusCode::FAILURE;
-    }
-
-    /** MuonEDMPrinterTool */
-    if (m_printer.retrieve().isSuccess())
-      ATH_MSG_INFO("Retrieved "<<m_printer);
-    else {
-      ATH_MSG_WARNING("Could not get "<<m_printer);
-      return StatusCode::FAILURE;
-    }
-
-    m_file=new TFile("UnbiasedMuonResiduals.root","RECREATE");
-    m_tree=new TTree("unbiasedMuonResiduals","UnbiasedMuonResiduals");
-
-    m_tree->Branch("run",          &m_run,          "run/I");
-    m_tree->Branch("evt",          &m_evt,          "evt/I");
-
-    m_tree->Branch("nPixHits",     &m_nPixHits,     "nPixHits/I");
-    m_tree->Branch("nSCTHits",     &m_nSCTHits,     "nSCTHits/I");
-    m_tree->Branch("nTRTHits",     &m_nTRTHits,     "nTRTHits/I");
-    m_tree->Branch("nCSCHits",     &m_nCSCHits,     "nCSCHits/I");
-    m_tree->Branch("nMDTHits",     &m_nMDTHits,     "nMDTHits/I");
-    m_tree->Branch("nTGCHits",     &m_nTGCHits,     "nTGCHits/I");
-    m_tree->Branch("nRPCHits",     &m_nRPCHits,     "nRPCHits/I");
-
-    m_tree->Branch("nInnerMDTHits",  &m_nInnerMDTHits,  "nInnerMDTHits/I");
-    m_tree->Branch("nMiddleMDTHits", &m_nMiddleMDTHits, "nMiddleMDTHits/I");
-    m_tree->Branch("nOuterMDTHits",  &m_nOuterMDTHits,  "nOuterMDTHits/I");
-    m_tree->Branch("nTriggerPhiHits",&m_nTriggerPhiHits,"nTriggerPhiHits/I");
-
-    m_tree->Branch("cscHitLocX",    m_cscHitLocX,   "cscHitLocX[nCSCHits]/D");
-    m_tree->Branch("cscHitLocY",    m_cscHitLocY,   "cscHitLocY[nCSCHits]/D");
-    m_tree->Branch("cscHitErrors",  m_cscHitErrors, "cscHitErrors[nCSCHits]/D");
-    
-    m_tree->Branch("mdtRes",        m_mdtRes,       "mdtRes[nMDTHits]/D");
-    m_tree->Branch("tgcRes",        m_tgcRes,       "tgcRes[nTGCHits]/D");
-    m_tree->Branch("cscRes",        m_cscRes,       "cscRes[nCSCHits]/D");
-    m_tree->Branch("rpcRes",        m_rpcRes,       "rpcRes[nRPCHits]/D");
-
-    m_tree->Branch("mdtPull",       m_mdtPull,      "mdtPull[nMDTHits]/D");
-    m_tree->Branch("tgcPull",       m_tgcPull,      "tgcPull[nTGCHits]/D");
-    m_tree->Branch("cscPull",       m_cscPull,      "cscPull[nCSCHits]/D");
-    m_tree->Branch("rpcPull",       m_rpcPull,      "rpcPull[nRPCHits]/D");
-
-    m_tree->Branch("author",       &m_author,       "author/I");
-
-    m_tree->Branch("hIndex",       &m_hIndex,       "hIndex/I");
-    m_tree->Branch("phiSector",    &m_phiSector,    "phiSector/I");
-    m_tree->Branch("isEndcap",     &m_isEndcap,     "isEndcap/I");
-    m_tree->Branch("identifier",   &m_identifier,   "identifier/I");
-    m_tree->Branch("isCSide",      &m_isCSide,      "isCSide/I");
-    m_tree->Branch("detType",      &m_detType,      "detType/I");
-
-    m_tree->Branch("layer",        &m_layer,        "layer/I");
-    m_tree->Branch("stName",       &m_stName,       "stName/I");
-    m_tree->Branch("stPhi",        &m_stPhi,        "stPhi/I");
-    m_tree->Branch("stEta",        &m_stEta,        "stEta/I");
-  
-    m_tree->Branch("momentum",     &m_momentum,     "momentum/D");
-    m_tree->Branch("charge",       &m_charge,       "charge/D");
-    m_tree->Branch("d0",           &m_d0,           "d0/D");
-    m_tree->Branch("z0",           &m_z0,           "z0/D");
-    m_tree->Branch("phi0",         &m_phi0,         "phi0/D");
-    m_tree->Branch("theta0",       &m_theta0,       "theta0/D");
-    m_tree->Branch("eta0",         &m_eta0,         "eta0/D");
-
-    m_tree->Branch("trackChi2",    &m_trackChi2,    "trackChi2/D");
-
-    m_tree->Branch("calEnergyLoss",    &m_calEnergyLoss,    "calEnergyLoss/D");
-    m_tree->Branch("calEnergyLossErr", &m_calEnergyLossErr, "calEnergyLossErr/D");
-    m_tree->Branch("materialOnTrack",  &m_materialOnTrack,  "materialOnTrack/D");
-
-    m_tree->Branch("deltaPhi",     &m_deltaPhi,     "deltaPhi/D");
-    m_tree->Branch("deltaTheta",   &m_deltaTheta,   "deltaTheta/D");
-
-    m_tree->Branch("dR",           &m_dR,           "dR/D");
-    m_tree->Branch("dZlocal",      &m_dZlocal,      "dZlocal/D");
-    m_tree->Branch("dXlocal",      &m_dXlocal,      "dXlocal/D");
-    m_tree->Branch("dYlocal",      &m_dYlocal,      "dYlocal/D");
-    m_tree->Branch("dXlocalAngle", &m_dXlocalAngle, "dXlocalAngle/D");
-    m_tree->Branch("dYlocalAngle", &m_dYlocalAngle, "dYlocalAngle/D");
-    m_tree->Branch("pullXlocal",   &m_pullXlocal,   "pullXlocal/D");
-    m_tree->Branch("pullYlocal",   &m_pullYlocal,   "pullYlocal/D");
-    m_tree->Branch("pullXlocalAngle", &m_pullXlocalAngle, "pullXlocalAngle/D");
-    m_tree->Branch("pullYlocalAngle", &m_pullYlocalAngle, "pullYlocalAngle/D");
-    m_tree->Branch("dXglobal",     &m_dXglobal,     "dXglobal/D");
-    m_tree->Branch("dYglobal",     &m_dYglobal,     "dYglobal/D");
-    m_tree->Branch("dZglobal",     &m_dZglobal,     "dZglobal/D");
-  
-    m_tree->Branch("detTheta",     &m_detTheta,     "detTheta/D");
-    m_tree->Branch("detThetaErr",  &m_detThetaErr,  "detThetaErr/D");
-
-    return sc;
-  }
-
-  //________________________________________________________________________
-  StatusCode UnbiasedMuonResiduals::execute() 
-  {
-    ATH_MSG_ERROR("UnbiasedMuonResiduals::execute()");
-    return StatusCode::FAILURE;
-
-
-    /*
-    StatusCode sc=StatusCode::SUCCESS;
- 
-    m_hIndex = -1;
-
-    // get run and event numbers
-    ATH_MSG_DEBUG("Retrieving event info.");
-    const EventInfo* eventInfo;
-    if (evtStore()->retrieve(eventInfo).isFailure()) {
-      ATH_MSG_ERROR("Could not retrieve event info.");
-    }
-    m_run=eventInfo->event_ID()->run_number();
-    m_evt=eventInfo->event_ID()->event_number();
-    
-    TrackCollection* trackColl=new TrackCollection;
-  
-    for ( unsigned j=0; j<m_segmCollectionName.size(); ++j ) {
-    
-      // check if using this collection from steering file
-      if ( m_segmCollectionFlag[j] == 0 ) continue; 
-        
-      ++m_hIndex;
- 
-      ATH_MSG_DEBUG("hIndex: "<<m_hIndex);
- 
-      // get the segments matched to muons
-      for (int isubdet=0;isubdet<4;isubdet++) {
-
-	ATH_MSG_DEBUG("isubdet: "<<isubdet);
-
-	// detector type
-	Trk::AlignModule::DetectorType detType=Trk::AlignModule::unidentified;
-	switch (isubdet) {
-	case (0): detType=Trk::AlignModule::MDT; break;
-	case (1): detType=Trk::AlignModule::CSC; break;
-	case (2): detType=Trk::AlignModule::RPC; break;
-	case (3): detType=Trk::AlignModule::TGC; break;
-	}
-	
-	if (detType==Trk::AlignModule::MDT && !m_doMdt) continue;
-	if (detType==Trk::AlignModule::CSC && !m_doCsc) continue;
-	if (detType==Trk::AlignModule::RPC && !m_doRpc) continue;
-	if (detType==Trk::AlignModule::TGC && !m_doTgc) continue; // TGC not ready yet
-
-	m_detType=isubdet;
-      
-	ATH_MSG_DEBUG("");
-	if (isubdet==0)      ATH_MSG_DEBUG("getting MDT segments");
-	else if (isubdet==1) ATH_MSG_DEBUG("getting CSC segments");
-	else if (isubdet==2) ATH_MSG_DEBUG("getting RPC segments");
-	else                 ATH_MSG_DEBUG("getting TGC segments");
-
-	// get segments from either the track container or the Analysis::Muon
-
-	int iflag=1; // 0 for inner MDT layer or CSC, 1 for any MDT layer or CSC
-
-	std::vector<SegMatch>      muonInn;
-	std::vector<SegMatchTrack> muonInnTrack;      
-	if (!m_useTrackContainer) {
-	  sc = getSegments(detType,muonInn,iflag);
-	  if ( muonInn.size() < 1 || sc.isFailure() ) continue;  
-	}
-	else {
-	  sc = getSegments(detType,muonInnTrack,iflag);
-	  ATH_MSG_DEBUG("muonInnTrack size: "<<muonInnTrack.size());
-	  if ( muonInnTrack.size() < 1 || sc.isFailure()) continue;  
-	}
-
-	// First loop over segment collection to find match with combined track
-	int nSegments = (muonInn.size()>0) ? muonInn.size() : muonInnTrack.size();
-	ATH_MSG_DEBUG(nSegments<<" segment(s) selected");
-
-	// loop over segments
-	for (int i = 0; i < nSegments; ++i ) {
-	
-	  // get segment
-	  const Muon::MuonSegment* mSeg = 
-	    muonInn.size()>0 ? muonInn[i].first : muonInnTrack[i].first;
-	
-	  // check if mSeg has a RIO_OnTrack
-	  const Trk::RIO_OnTrack* mSegRio=mSeg->rioOnTrack(0);
-	  if (!mSegRio) continue;
-
-	  // get detector surface to which tracks and segments will be extrapolated
-	  const Trk::PlaneSurface* detSurface=getDetectorSurface(detType,mSeg);
-	  if (!detSurface) continue;
-	  
-	  // extrapolate segment to detector surface
-	  const Trk::TrackParameters* segPar=getSegmentExtrapolated(mSeg,detSurface);
-	  if ( !segPar ) continue;
-
-	  // get Analysis::Muon or Trk::Track
-	  const Analysis::Muon* muon  = muonInn.size()>0      ? muonInn[i].second :      0;
-	  const Trk::Track*     track = muonInnTrack.size()>0 ? muonInnTrack[i].second : 0;
-
-	  if (muon && track) {
-	    ATH_MSG_ERROR("have muon and track!");	  
-	    delete trackColl;
-	    return StatusCode::FAILURE;
-	  }
-	  if (!muon && !track) {
-	    ATH_MSG_ERROR("have neither muon nor track!");
-	    delete trackColl;
-	    return StatusCode::FAILURE;
-	  }
-
-	  if (muon && !checkMuon(*muon)) continue;
-
-	  m_trackChi2=
-	    track->fitQuality()->chiSquared()/track->fitQuality()->doubleNumberDoF();
-	  ATH_MSG_DEBUG("track chi2/ndof: "<<m_trackChi2);
-	  
-	  Identifier id = chamberId( detType, *mSeg );
-	  if ( !id.is_valid() ) {
-	    delete trackColl;
-	    return StatusCode::FAILURE; 
-	  }
-	  ATH_MSG_DEBUG("mSeg id: "<<id);
-
-	  // get track from muon or initial track
-	  const Trk::Track* initTrack = muon ?
-	    getTrackFromMuon(muon) : getTrackFromTrack(track);
-	  if (!initTrack) {
-	    ATH_MSG_DEBUG("failed to get initial track");
-	    continue;
-	  }
-
-	  if (!initTrack->perigeeParameters()) 
-	    ATH_MSG_DEBUG("before cleanedTrack, track has no perigee");
-
-	  bool removePerigee=m_trackFittingType==MSStandaloneWithIDMomentum;
-	  Trk::Track* cleanedTrack=cleanTrack(id,*initTrack, removePerigee);
-	  if (!cleanedTrack) {
-	    ATH_MSG_DEBUG("failed to clean track");
-	    continue;
-	  }
-	  delete initTrack;
-	  
-	  // check track
-	  if (!checkTrack(*cleanedTrack)) {
-	    ATH_MSG_DEBUG("failed checkTrack");
-	    continue;
-	  }
-
-	  // get biased residuals from initial track
-	  getBiasedResiduals(*cleanedTrack);
-
-	  // unbias initial track by changing hits in detector to outliers       
-	  Trk::Track* unbiasedTrack = 
-	    getUnbiasedTrack(id,cleanedTrack,detSurface,detType,iflag);
-	  delete cleanedTrack;
-
-	  if (!unbiasedTrack) {
-	    ATH_MSG_DEBUG("failed to get unbiased track");
-	    continue;
-	  }
-
-	  // extrapolate unbiased track to detector surface
-	  const TrackParameters* trackPar = getTrackExtrapolated(id,unbiasedTrack,
-								 detSurface);
-	  if (!trackPar) {
-	    ATH_MSG_DEBUG("muon track extrapolation failed");
-	    delete unbiasedTrack;
-	    continue;
-	  }
-	  
-	  // calculate residuals
-	  const Trk::MeasuredAtaPlane* trkMeasuredAtaPlane=dynamic_cast<const Trk::MeasuredAtaPlane*>(trackPar);
-	  if (!trkMeasuredAtaPlane) {
-	    ATH_MSG_WARNING("no trkMeasuredAtaPlane!");
-	    delete unbiasedTrack;
-	    continue;
-	  }
-	  const ErrorMatrix& trkErrMat=trkMeasuredAtaPlane->localErrorMatrix();
-
-	  const Trk::MeasuredAtaPlane* segMeasuredAtaPlane=dynamic_cast<const Trk::MeasuredAtaPlane*>(segPar);
-	  if (!segMeasuredAtaPlane) {
-	    ATH_MSG_WARNING("no segMeasuredAtaPlane!");
-	    delete unbiasedTrack;
-	    continue;
-	  }
-	  
-	  const ErrorMatrix& segErrMat=segMeasuredAtaPlane->localErrorMatrix();
-	  calcResForSegmentAtDetSurface(*trackPar,*segPar,trkErrMat,segErrMat);
-
-	  // set some variables used in output tree
-	  setIdentificationVariables(detType,*mSeg);
-	  
-	  // calculate residuals for extrapolated ID track to muon detector surface
-	  if (m_extrapolateIDTrack) calcResForExtrapolatedIDToDetSurface(*muon,*segPar,
-									 detSurface,detType);
-	  
-	  m_file->cd();
-	  m_tree->Fill();
-	  
-	  ATH_MSG_DEBUG("hIndex/detType/momentum/d0/phi0/ID: "<<m_hIndex<<"/"<<m_detType<<"/"<<m_momentum<<"/"<<m_d0<<"/"<<m_phi0<<"/"<<m_identifier);
-	  
-	  delete segPar;
-	  delete trackPar;
-	  delete detSurface;
-	  
-	  //if (sc!=StatusCode::SUCCESS) return StatusCode::FAILURE;
-
-	  // record unbiased track in StoreGate
-	  trackColl->push_back(unbiasedTrack);	  
-	} // segments
-
-	muonInn.clear();
-	if (muonInnTrack.size()>0) 
-	  for (int i=0;i<(int)muonInnTrack.size();i++) delete muonInnTrack[i].second;
-	muonInnTrack.clear();
-	
-      } // detType                  
-    } // end loop on collection
-
-    if (StatusCode::SUCCESS!=evtStore()->record(trackColl,"unbiasedTracks")) {
-      ATH_MSG_WARNING("problem with recording tracks to StoreGate!");
-    }
-
-    if (sc.isFailure()) return StatusCode::SUCCESS;
-
-    return sc; 
-    */
-  }
-
-  //________________________________________________________________________
-  StatusCode UnbiasedMuonResiduals::finalize() 
-  {
-
-    m_file->cd();
-    m_tree->Write();
-    m_file->Close();
-
-    StatusCode sc = StatusCode::SUCCESS;
-
-    return sc;
-  }
-
-  //________________________________________________________________________
-  StatusCode
-  UnbiasedMuonResiduals::getSegments( Trk::AlignModule::DetectorType detType,
-				      std::vector<SegMatch>& muonInn, int iflag)
-  {
-    ATH_MSG_DEBUG("in getSegments, detType: "<<detTypeStr(detType));
-
-    std::string segmCollectionName=m_segmCollectionName[m_hIndex];
-    std::string trackCollectionName=m_trackCollectionName[m_hIndex];
-
-    /** get a pointer to the segments */
-    const Trk::SegmentCollection* segmentCollection = 0;
-    StatusCode sc = evtStore()->retrieve(segmentCollection, segmCollectionName); 
-    if ( sc.isFailure() ) return sc;
-
-    Trk::SegmentCollection::const_iterator s;
-    int nSegments = segmentCollection->end() - segmentCollection->begin();
-    if ( nSegments < 1 ) return sc;
-    ATH_MSG_DEBUG("found "<<nSegments<<" segments, getting muon container");
-
-    // get the container of the original muons 
-    const Analysis::MuonContainer* muonTES=0;
-    sc = evtStore()->retrieve( muonTES, trackCollectionName);
-    if ( sc.isFailure() || muonTES == 0 || muonTES->size() < 1 ) return sc;
-    ATH_MSG_DEBUG("found "<<muonTES->size()<<" muons, looping through segments");
-  
-    // Sort segment by station
-    for ( s = segmentCollection->begin(); s != segmentCollection->end(); ++s) {
-      Muon::MuonSegment* mSeg               = dynamic_cast<Muon::MuonSegment*> (*s);
-
-      if ( !mSeg ) {
-         ATH_MSG_WARNING("muon segments cannot be retrieved");
-	 continue;
-      }
-
-      Identifier id1                        = chamberId( detType, *mSeg );
-    
-      if ( !id1.is_valid() ) continue;  
-      if (!p_idHelperTool->isMuon(id1)) continue;
-
-      if (p_idHelperTool->isMdt(id1)) ATH_MSG_DEBUG("isMdt: "<<p_idHelperTool->isMdt(id1));
-      if (p_idHelperTool->isCsc(id1)) ATH_MSG_DEBUG("isCsc: "<<p_idHelperTool->isCsc(id1));
-      if (p_idHelperTool->isCsc(id1)) ATH_MSG_DEBUG("isRpc: "<<p_idHelperTool->isRpc(id1));
-      if (p_idHelperTool->isCsc(id1)) ATH_MSG_DEBUG("isTgc: "<<p_idHelperTool->isTgc(id1));
-      
-      if ( (detType==Trk::AlignModule::MDT && p_idHelperTool->isMdt(id1)) ||
-           (detType==Trk::AlignModule::CSC && p_idHelperTool->isCsc(id1)) ||
-           (detType==Trk::AlignModule::RPC && p_idHelperTool->isRpc(id1)) ||
-           (detType==Trk::AlignModule::TGC && p_idHelperTool->isTgc(id1)) ) {
-      
-        if (chamberIds(detType,*mSeg).size()>1) {
-          continue;
-        }
-      
-        if (!passesChamberSelection(detType,id1,iflag)) continue;
-
-        
-        if (muonTES) {
-          const Analysis::Muon* goodMuon=findMuon(muonTES,mSeg);
-          if (goodMuon) {
-            muonInn.push_back( std::make_pair(mSeg,goodMuon) );
-            continue;
-          }
-        } 
-      }
-    }
-
-    return sc;
-  }
-
-  //________________________________________________________________________
-  StatusCode
-  UnbiasedMuonResiduals::getSegments( Trk::AlignModule::DetectorType /*detType*/,
-				      std::vector<SegMatchTrack>& /*muonInn*/, int /*iflag*/)
-  {
-
-    ATH_MSG_ERROR("migrate getSegments to Eigen");
-    return StatusCode::FAILURE;
-    
-    /*
-    // get vector<MuonSegment*,Track*> for all pairings of segments and tracks where 
-    // segment has at least one chamber with the right detector type
-
-    ATH_MSG_DEBUG("in getSegments for detType: "<<detTypeStr(detType));
-    
-    if (detType!=Trk::AlignModule::TGC) {
-      
-      std::string segmCollectionName      =m_segmCollectionName [m_hIndex];
-      std::string trackCollectionName     =m_trackCollectionName[m_hIndex];
-      std::string inDetTrackCollectionName="";
-      if (m_inDetTrackCollectionName.size()>0)
-	inDetTrackCollectionName=m_inDetTrackCollectionName[m_hIndex];
-      
-      // get a pointer to the segments 
-      const Trk::SegmentCollection* segmentCollection = 0;
-      StatusCode sc = evtStore()->retrieve(segmentCollection, segmCollectionName); 
-      ATH_MSG_DEBUG("found "<<segmentCollection->size()<<" segments");
-      if ( sc.isFailure() || segmentCollection->size()<1 ) return StatusCode::FAILURE;
-      
-      Trk::SegmentCollection::const_iterator s;
-      int nSegments = segmentCollection->end() - segmentCollection->begin();
-      if ( nSegments < 1 ) {
-	ATH_MSG_DEBUG("found no segments!");
-	return StatusCode::FAILURE;
-      }
-      
-      // use tracks from track container
-      const TrackCollection* tracks=0;
-      const TrackCollection* inDetTracks=0;
-      sc = evtStore()->retrieve(tracks,trackCollectionName);
-      if (sc.isFailure() || tracks==0 || tracks->size()<1) {
-	ATH_MSG_DEBUG("found no tracks");
-	return StatusCode::FAILURE;    
-      }
-
-      if (inDetTrackCollectionName!="") {
-	sc = evtStore()->retrieve(inDetTracks,inDetTrackCollectionName);
-	if (sc.isFailure() || inDetTracks==0 || inDetTracks->size()<1) {
-	  ATH_MSG_DEBUG("found no indet tracks");
-	  return StatusCode::FAILURE;
-	}
-	//ATH_MSG_DEBUG("found "<<inDetTracks->size()<<" inner detector tracks");            
-      }
-      ATH_MSG_DEBUG("found "<<tracks->size()<<" tracks, looping through segments");            
-      
-      // Sort segment by station
-      std::list<Muon::MuonSegment*> goodSegments;
-      for ( s = segmentCollection->begin(); s != segmentCollection->end(); ++s) {
-	
-	Muon::MuonSegment* mSeg = dynamic_cast<Muon::MuonSegment*> (*s);
-	
-	// get id(s)
-	std::set<Identifier> ids=chamberIds(detType,*mSeg);      
-	int nChambers=ids.size();
-	if (nChambers>1 && 
-	    (detType==Trk::AlignModule::MDT || detType==Trk::AlignModule::CSC) ) {
-	  ATH_MSG_DEBUG("segment has too many chambers ("<<nChambers<<")");
-	  continue;
-	}
-	
-	// check chi2/ndof of segment
-	double chi2perdof=
-	  mSeg->fitQuality()->chiSquared()/mSeg->fitQuality()->doubleNumberDoF();
-	ATH_MSG_DEBUG("seg chi2/ndof: "<<chi2perdof);
-	if (chi2perdof>10.0) continue;
-	
-	// check if segment has the right detector among all IDs in this segment
-	bool goodSeg=false;
-	std::set<Identifier>::iterator idIt   =ids.begin();
-	std::set<Identifier>::iterator idItEnd=ids.end();
-	for ( ; idIt!=idItEnd; ++idIt) {
-	  
-	  Identifier id=*idIt;
-	  if ( (detType==Trk::AlignModule::MDT && p_idHelperTool->isMdt(id)) ||
-	       (detType==Trk::AlignModule::CSC && p_idHelperTool->isCsc(id)) ||
-	       (detType==Trk::AlignModule::RPC && p_idHelperTool->isRpc(id)) ||
-	       (detType==Trk::AlignModule::TGC && p_idHelperTool->isTgc(id)) ) {
-	    
-	    ATH_MSG_DEBUG("calling passesChamberSel with detType "<<detTypeStr(detType));
-	    if (!passesChamberSelection(detType,id,iflag)) {
-	      ATH_MSG_DEBUG("fails chamber selection");
-	      continue;
-	    }
-	    else {
-	      goodSeg=true;
-	      break;
-	    }
-	  }
-	}
-	
-	
-	if (goodSeg) {
-	  ATH_MSG_DEBUG("found good segment");
-	  goodSegments.push_back(mSeg);
-	}
-	else continue;
-	
-	if (detType==Trk::AlignModule::MDT) ATH_MSG_DEBUG("good MDT segment");
-	if (detType==Trk::AlignModule::CSC) ATH_MSG_DEBUG("good CSC segment");
-	if (detType==Trk::AlignModule::RPC) ATH_MSG_DEBUG("good RPC segment");
-	if (detType==Trk::AlignModule::TGC) ATH_MSG_DEBUG("good TGC segment");
-	
-      }
-      
-      if (goodSegments.size()<1) {
-	ATH_MSG_DEBUG("found no good segments");
-	return StatusCode::FAILURE;
-      }
-      
-      ATH_MSG_DEBUG("have "<<goodSegments.size()<<" good segments");
-      
-      // remove extra MuonSegments if more than one in a chamber
-      removeExtraSegments(detType,goodSegments);
-      
-      std::list<Muon::MuonSegment*>::iterator segIt=goodSegments.begin();
-      std::list<Muon::MuonSegment*>::iterator segItEnd=goodSegments.end();
-      for ( ; segIt != segItEnd; ++segIt ) {
-	Muon::MuonSegment* mSeg = *segIt;
-	
-	ATH_MSG_DEBUG("looking for track for following segment: "<<*mSeg);
-	
-	if (tracks) {
-	  
-	  // find best track for this segment
-	  const Trk::Track* bestTrack=findBestTrack(detType,tracks,inDetTracks,mSeg);
-	  if (!bestTrack) continue;
-	  
-	  double qOverP=m_charge/(m_momentum*1000.);
-	  ATH_MSG_DEBUG("before calling prepareTrack: ");
-	  ATH_MSG_DEBUG(m_printer->print(*bestTrack)<<endmsg<<
-			m_printer->printStations(*bestTrack)<<endmsg<<
-			m_printer->printMeasurements(*bestTrack));
-
-	  const Trk::Track* goodTrack=prepareTrack(*bestTrack,qOverP);
-
-	  if (goodTrack) {
-	    muonInn.push_back( std::make_pair(mSeg,goodTrack) );
-	    continue;
-	  }
-	}
-	else ATH_MSG_DEBUG("no tracks!");
-      }      
-    }
-    else {
-
-      //
-      // TGC segments
-      //
-     
-      // // get TGC PRDs from StoreGate
-      // const Muon::TgcPrepDataContainer* tgc_container[3] = {0, 0, 0};
-      // std::list<Identifier> vecIds;
-      // for(int ibc=0; ibc<3; ibc++){
-      // int bcTag=ibc+1;
-      // std::ostringstream location;
-      // location << m_muonTgcPrdKey  << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "")
-      // << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : "");
-      // StatusCode sc;
-      // sc = this->evtStore()->retrieve(tgc_container[ibc], location.str());
-      // if (sc.isFailure()) {
-      // return sc;
-      // }
-	
-      // }
-      
-      // // loop over PRDs, get collection of PRDs for each chamber
-      
-      // int bunch=-1;
-      // for(int ibc=0; ibc<3; ibc++){
-      // for (Muon::TgcPrepDataContainer::const_iterator containerit = tgc_container[ibc]->begin() ;
-      // containerit != tgc_container[ibc]->end() ; ++containerit) {                  
-      // for (Muon::TgcPrepDataCollection::const_iterator tgcPrd = (*containerit)->begin() ;
-      // tgcPrd != (*containerit)->end() ; ++tgcPrd) {
-      // if((*tgcPrd)->identify() == id ) { bunch = ibc+1; continue; }
-      // }
-      // if(bunch!=-1) continue;
-      // }
-      // if(bunch!=-1) continue;
-      // }      
-
-      // ignore segments in segment container, we will create segments using TGC hits on the track
-
-      // use tracks from track container
-      std::string trackCollectionName     =m_trackCollectionName[m_hIndex];
-      std::string inDetTrackCollectionName="";
-      if (m_inDetTrackCollectionName.size()>0)
-	inDetTrackCollectionName=m_inDetTrackCollectionName[m_hIndex];
-
-      const TrackCollection* tracks=0;
-      const TrackCollection* inDetTracks=0;
-      StatusCode sc = evtStore()->retrieve(tracks,trackCollectionName);
-      if (sc.isFailure() || tracks==0 || tracks->size()<1) 
-	return StatusCode::FAILURE;    
-      
-      if (inDetTrackCollectionName!="") {
-	sc = evtStore()->retrieve(inDetTracks,inDetTrackCollectionName);
-	if (sc.isFailure() || inDetTracks==0 || inDetTracks->size()<1) 
-	  return StatusCode::FAILURE;
-      }
-      ATH_MSG_DEBUG("found "<<tracks->size()<<" tracks, getting first track");  
-
-      const Trk::Track* bestTrack=findBestTrack(detType,tracks,inDetTracks,0);
-      if (!bestTrack) return StatusCode::FAILURE;
-
-      HepGeom::Vector3D<double> dir(bestTrack->perigeeParameters()->momentum());
-
-      double qOverP=m_charge/(m_momentum*1000);
-      const Trk::Track* goodTrack=prepareTrack(*bestTrack,qOverP);
-
-      // have good track, now make TGC segment out of middle layer
-      const DataVector<const Trk::TrackStateOnSurface>* tsosvec=goodTrack->trackStateOnSurfaces();
-      
-      // loop over TSOS and collect TGC hits
-      Muon::Fit2D::PointArray rhoPoints,phiPoints;
-      std::set<std::string> rhoStations, phiStations;
-      const MuonGM::TgcReadoutElement* tgc=0;
-
-      int itsos(0),iHit(0);
-      DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=tsosvec->begin(); 
-      for (; iTsos!=tsosvec->end(); ++iTsos,itsos++) {
-	
-	ATH_MSG_DEBUG("itsos: "<<itsos);
-
-	const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();	
-	const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=crio->rioOnTrack(0);
-	if (!rio) continue;
-
-	ATH_MSG_DEBUG("have rio");
-
-	// check if TGC
-	//const TgcPrepData* tgc_prp_data = dynamic_cast<const TgcPrepData*>(rio);	
-	//if (!tgc_prp_data) continue;
-	//ATH_MSG_DEBUG("have tgc_prp_data");
-	if (!p_idHelperTool->isMuon(rio->identify()) || 
-	    !p_idHelperTool->isTgc(rio->identify())) continue;
-	ATH_MSG_DEBUG("have TGC RIO");
-	
-	// get station name, skip if inner layer
-	std::string stName=
-	  dynamic_cast<const MuonGM::TgcReadoutElement*>(rio->detectorElement())->getStationName();
-	ATH_MSG_DEBUG("hit in TGC chamber: "<<stName);
-	
-	if (stName.substr(1,1)!="T") ATH_MSG_ERROR("not TGC chamber"); // sanity check
-	if (stName.substr(2,1)=="1") continue;
-	
-	if (!tgc) tgc=dynamic_cast<const MuonGM::TgcReadoutElement*>(rio->detectorElement());
-	
-	// get weight from error matrix if it exists
-	const Trk::ErrorMatrix& errMat = mesb->localErrorMatrix();
-	if (!errMat.weightPointer()) {
-	  ATH_MSG_DEBUG("RIO has a singular matrix, skipping");
-	  continue;
-	}
-	double w = errMat.weightValue(Trk::locX);
-	
-	// create rho or phi hit	  
-	if (p_idHelperTool->tgcIdHelper().isStrip(rio->identify())) {
-	  double rho = mesb->globalPosition().perp();
-	  w *= rho * rho;
-	  Muon::Fit2D::Point* pPt = new Muon::Fit2D::Point(iHit,mesb->globalPosition().z(),
-							   mesb->globalPosition().phi(),w,
-							   (void*)mesb);
-	  phiPoints.push_back(pPt);
-	  phiStations.insert(stName);
-	}
-	else {
-	  Muon::Fit2D::Point* pPt = new Muon::Fit2D::Point(iHit,mesb->globalPosition().z(),
-							   mesb->globalPosition().perp(),w,
-							   (void*)mesb);
-	  rhoPoints.push_back(pPt);
-	  rhoStations.insert(stName);
-	}
-	iHit++;
-      }   
-      
-      if (rhoPoints.empty() && phiPoints.empty()) {
-	ATH_MSG_DEBUG("no rho or phi hits");
-	return StatusCode::FAILURE;
-      }
-      
-      // loop over phi and rho hit collections, create segment
-      double dChi2 = 0.0;
-      int nDegf = 0;
-      double zCov[2][2], phiCov[2][2];
-      memset(zCov,   0, sizeof(zCov));
-      memset(phiCov, 0, sizeof(phiCov));
-      
-      Muon::Fit2D fit;
-      HepGeom::Point3D<double> pos;
-      Muon::Fit2D::SimpleStats rhoSimpleStats, phiSimpleStats;
-      Muon::Fit2D::LinStats rhoLinStats, phiLinStats;
-
-      double outlierChi2Cut=10.;
-      double baseZ = tgc->center().z();
-
-      if (rhoStations.size() == 1 || rhoPoints.size() < 4) {
-	fit.fitPoint(rhoPoints, outlierChi2Cut, msgLvl(MSG::DEBUG), rhoSimpleStats);
-	fit.fitPoint(phiPoints, outlierChi2Cut, msgLvl(MSG::DEBUG), phiSimpleStats);
-
-	ATH_MSG_DEBUG("Rho: " << rhoSimpleStats.toString());
-	ATH_MSG_DEBUG("Phi: " << phiSimpleStats.toString());
-	
-	pos.set(rhoSimpleStats.fMean, 0.0, baseZ);
-	pos.setPhi(phiSimpleStats.fMean);
-	dChi2 = rhoSimpleStats.fChi2 + phiSimpleStats.fChi2;
-	nDegf = rhoSimpleStats.n + phiSimpleStats.n - 2;
-	zCov[0][0]=(rhoSimpleStats.fStd)*(rhoSimpleStats.fStd);
-      }
-      else {
-	double rho, rhoErr, phi, phiErr, z = baseZ;
-	fit.fitLine(rhoPoints, outlierChi2Cut, msgLvl(MSG::DEBUG), rhoLinStats);
-	ATH_MSG_DEBUG("Rho: " << rhoLinStats.toString());
-	rhoLinStats.eval(z, rho, rhoErr);
-	pos.set(rho, 0.0, z);
-	dChi2 = rhoLinStats.fChi2;
-	nDegf = rhoLinStats.n - 2;
-	
-	if (phiStations.size() == 1 || phiPoints.size() < 4) {
-	  fit.fitPoint(phiPoints, outlierChi2Cut, msgLvl(MSG::DEBUG), phiSimpleStats);
-	  ATH_MSG_DEBUG("Phi: " << phiSimpleStats.toString());
-	  pos.setPhi(phiSimpleStats.fMean);
-	  phiLinStats.fSlope = 0.0;
-	  dChi2 += phiSimpleStats.fChi2;
-	  nDegf += phiSimpleStats.n - 1;
-	  phiCov[0][0]=(phiSimpleStats.fStd)*(phiSimpleStats.fStd);
-	}
-	else {
-	  fit.fitLine(phiPoints, outlierChi2Cut, msgLvl(MSG::DEBUG), phiLinStats);
-	  ATH_MSG_DEBUG("Phi: " << phiLinStats.toString());
-	  phiLinStats.eval(z, phi, phiErr);
-	  pos.setPhi(phi);
-	  dChi2 += phiLinStats.fChi2;
-	  nDegf += phiLinStats.n - 2;
-	  memcpy(phiCov, phiLinStats.fCov, sizeof(phiCov));
-	}
-	
-	double z1 = pos.z() + copysign(1.0, pos.z());
-	rhoLinStats.eval(z1, rho, rhoErr);
-	HepGeom::Point3D<double> p1(rho, 0.0, z1);
-	phiLinStats.eval(z1, phi, phiErr);
-	p1.setPhi(phi);
-	dir = p1 - pos;
-      }
-      ATH_MSG_DEBUG("Segment position " << point2String(pos));
-      ATH_MSG_DEBUG("Segment direction " << dir2String(dir));
-      
-      
-      const Trk::Surface& surface = tgc->surface();      
-      ATH_MSG_DEBUG("Surface at " << point2String(surface.center()));
-      
-      const Trk::PlaneSurface* pSurface = dynamic_cast<const Trk::PlaneSurface*>(&surface);
-      if (pSurface == NULL) {
-	ATH_MSG_WARNING("Cannot get a PlaneSurface from TgcClusterOnTrack");
-	for (int i=0;i<(int)rhoPoints.size();i++) delete rhoPoints[i];
-	for (int i=0;i<(int)phiPoints.size();i++) delete phiPoints[i];
-	return StatusCode::FAILURE;
-      }
-      const Trk::LocalPosition* pSegPos = pSurface->globalToLocal(pos);
-      if (pSegPos == NULL) {
-	ATH_MSG_WARNING("Cannot get LocalPosition from surface for " << point2String(pos));
-	for (int i=0;i<(int)rhoPoints.size();i++) delete rhoPoints[i];
-	for (int i=0;i<(int)phiPoints.size();i++) delete phiPoints[i];
-	return StatusCode::FAILURE;
-      }
-      ATH_MSG_DEBUG("Segment local position is"
-		    << " x=" << (*pSegPos)[Trk::locX]
-		    << ",y=" << (*pSegPos)[Trk::locY]);
-	
-      const Trk::LocalDirection* pSegDir = pSurface->globalToLocalDirection(dir.unit());
-      if (pSegDir == NULL) {
-	ATH_MSG_WARNING("Cannot get LocalDirection from surface for " << dir2String(dir));
-	for (int i=0;i<(int)rhoPoints.size();i++) delete rhoPoints[i];
-	for (int i=0;i<(int)phiPoints.size();i++) delete phiPoints[i];
-	return StatusCode::FAILURE;
-      }
-	
-      ATH_MSG_DEBUG("Segment local direction is"
-		    << " angleXZ=" << pSegDir->angleXZ()
-		    << ",angleYZ=" << pSegDir->angleYZ());
-	
-      Trk::CovarianceMatrix* pcov = new Trk::CovarianceMatrix(4);
-      (*pcov)[0][0] = zCov[0][0];
-      (*pcov)[0][1] = zCov[0][1];
-      (*pcov)[1][1] = zCov[1][1];
-      (*pcov)[2][2] = phiCov[0][0];
-      (*pcov)[2][3] = phiCov[0][1];
-      (*pcov)[3][3] = phiCov[1][1];
-      (*pcov)[0][2] = 0.0;
-      (*pcov)[0][3] = 0.0;
-      (*pcov)[1][2] = 0.0;
-      (*pcov)[1][3] = 0.0;
-	
-      Trk::ErrorMatrix* perr = new Trk::ErrorMatrix(pcov);
-      Trk::FitQuality* pFitQuality = new Trk::FitQuality(dChi2, nDegf);
-      DataVector<const Trk::MeasurementBase>* pRios = new DataVector<const Trk::MeasurementBase>;
-      for (Muon::Fit2D::PointArray::const_iterator itPt = rhoPoints.begin(); 
-	   itPt != rhoPoints.end(); itPt++) {
-	Muon::Fit2D::Point* pPt = *itPt;
-	if (!pPt->bExclude) {
-	  pRios->push_back(static_cast<const Trk::MeasurementBase*>(((const Muon::MuonClusterOnTrack*)(pPt->pData))->clone()));
-	}
-      }
-      for (Muon::Fit2D::PointArray::const_iterator itPt = phiPoints.begin(); 
-	   itPt != phiPoints.end(); itPt++) {
-	Muon::Fit2D::Point* pPt = *itPt;
-	if (!pPt->bExclude) {
-	  pRios->push_back(static_cast<const Trk::MeasurementBase*>(((const Muon::MuonClusterOnTrack*)(pPt->pData))->clone()));
-	}
-      }
-      Muon::MuonSegment* pMuonSeg = new Muon::MuonSegment(*pSegPos,
-							  pSegDir,
-							  perr,
-							  const_cast<Trk::PlaneSurface*>(pSurface->clone()),
-							  pRios,
-							  pFitQuality);
-      ATH_MSG_DEBUG("Created a new Muon::MuonSegment with surface: "<<*pSurface);
-      delete pSegPos;	    
-      
-      for (int i=0;i<(int)rhoPoints.size();i++) delete rhoPoints[i];
-      for (int i=0;i<(int)phiPoints.size();i++) delete phiPoints[i];
-
-      muonInn.push_back(std::make_pair(pMuonSeg,goodTrack));
-    }
-    
-    return StatusCode::SUCCESS;
-    */
-
-  }
-  
-  /*
-  //________________________________________________________________________
-  StatusCode
-  UnbiasedMuonResiduals::getAllSegments( const std::string& segmCollectionName,
-  const std::string& trackCollectionName,
-  std::vector<SegMatch>& muonInn) 
-  {
-  
-  // get a pointer to the segments 
-  const Trk::SegmentCollection* segmentCollection = 0;
-  StatusCode sc = evtStore()->retrieve(segmentCollection, segmCollectionName); 
-  if ( sc.isFailure() ) return sc;
-
-  Trk::SegmentCollection::const_iterator s;
-  int nSegments = segmentCollection->end() - segmentCollection->begin();
-  ATH_MSG_DEBUG("found "<<nSegments<<" segments");
-  if ( nSegments < 1 ) return sc;
-
-  // get the container of the original muons -
-  const Analysis::MuonContainer* muonTES=0;
-  sc = evtStore()->retrieve( muonTES, trackCollectionName);
-  if ( sc.isFailure() || muonTES == 0 ) return sc;
-  if ( muonTES->size() < 1 ) return sc;
-
-  // Sort segment by station
-  std::list<Muon::MuonSegment*> goodSegments;
-  for ( s = segmentCollection->begin(); s != segmentCollection->end(); ++s ) {
-  Muon::MuonSegment* mSeg               = dynamic_cast<Muon::MuonSegment*> (*s);
-  Identifier id1                        = chamberId(detType,*mSeg );
-  if ( !id1.is_valid() ) continue;  
-
-  if (mSeg->fitQuality()->chiSquared()/mSeg->fitQuality()->doubleNumberDoF()>10.0) continue;
-
-  if ( p_idHelperTool->isMuon( id1) && p_idHelperTool->isMdt( id1 ) ) {
-  if (chamberIds(detType,*mSeg).size()>1) {
-  ATH_MSG_DEBUG("more than 1 chamber") ;
-  continue;
-  }
-	
-  goodSegments.push_back(mSeg);
-  }
-  }
-
-  // remove extra MuonSegment if more than one per chamber
-  removeExtraSegments(goodSegments);
-    
-  std::list<Muon::MuonSegment*>::iterator segIt=goodSegments.begin();
-  std::list<Muon::MuonSegment*>::iterator segItEnd=goodSegments.end();
-
-  for (; segIt != segItEnd; ++segIt) {
-      
-  Muon::MuonSegment* mSeg=*segIt;
-      
-  Analysis::MuonContainer::const_iterator muonIt  = muonTES->begin();
-  Analysis::MuonContainer::const_iterator muonItE = muonTES->end();
-      
-  // Loop over muon collection
-  for ( ; muonIt!=muonItE; ++muonIt ) {
-	
-  if (muonIt == muonItE || !*muonIt) continue;
-	
-  // Only keep combined muons with ID and MS tracks, and best match !
-  if ( !(*muonIt)->isCombinedMuon() ) continue;
-	
-  muonInn.push_back( std::make_pair(mSeg,*muonIt) );
-  }
-  }    
-  
-  return sc;
-  }
-  */
-
-  //________________________________________________________________________
-  const Trk::PlaneSurface* 
-  UnbiasedMuonResiduals::getDetectorSurface(Trk::AlignModule::DetectorType /*detType*/,
-					    const Muon::MuonSegment* /*mSeg*/)
-  {
-    ATH_MSG_ERROR("migrate getDetectorSurface to Eigen");
-    return 0;
-
-    /*
-    ATH_MSG_DEBUG("in getDetectorSurface, detType: "<<detTypeStr(detType));
-  
-    // get detector surface
-    const Trk::RIO_OnTrack* rio(0);
-    const Trk::CompetingRIOsOnTrack* crio(0);
-    std::vector<const Trk::MeasurementBase*> mbs = mSeg->containedMeasurements();
-    const Trk::TrkDetElementBase* det(0);
-    for( unsigned int imbs = 0; imbs< mbs.size(); ++imbs) {
-      
-      ATH_MSG_DEBUG ("meas["<<imbs<<"]: "<<*(mbs[imbs]));
-      rio = dynamic_cast<const Trk::RIO_OnTrack*>(mbs[imbs]);
-      
-      if (rio) ATH_MSG_DEBUG("have rio");
-      
-      if (!rio) {
-	crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*> (mbs[imbs]);
-	if (crio) ATH_MSG_DEBUG("have crio");
-
-	if (crio) rio  = &crio->rioOnTrack(0);
-      }
-      if (rio && detType==Trk::AlignModule::MDT) {
-	det=rio->associatedSurface().associatedDetectorElement();
-	if (dynamic_cast<const MuonGM::MdtReadoutElement*>(det)) {
-	  ATH_MSG_DEBUG("have MDT");
-	  ATH_MSG_DEBUG("MDT det surface: "<<det->surface());
-	  break;    
-	}
-	else { det=0; rio=0; }
-      }
-      else if (rio && detType==Trk::AlignModule::CSC) {
-	det=rio->associatedSurface().associatedDetectorElement();
-	if (dynamic_cast<const MuonGM::CscReadoutElement*>(det)) {
-	  ATH_MSG_VERBOSE("have CSC");
-	  break;    
-	}
-	else { det=0; rio=0; }
-      }
-      else if (crio && rio && detType==Trk::AlignModule::RPC) {
-	det= rio->associatedSurface().associatedDetectorElement();
-	if (dynamic_cast<const MuonGM::RpcReadoutElement*>(det)) {
-	  ATH_MSG_VERBOSE("have RPC");
-	  break;
-	}
-	else { det=0; rio=0; }
-      }
-
-      else if (crio && rio && detType==Trk::AlignModule::TGC) {
-	det=rio->associatedSurface().associatedDetectorElement();
-	if (dynamic_cast<const MuonGM::TgcReadoutElement*>(det)) {
-	  ATH_MSG_VERBOSE("have TGC");
-	  break;
-	}
-	else { det=0; rio=0; }
-      }
-    }
-    if (!rio || !det) {
-      ATH_MSG_DEBUG("no RIO or detector surface in MuonSegment!");
-      return 0;
-    }
-
-    // get detector surface and correct if segment surface has a different orientation
-    const Trk::PlaneSurface& uncorrectedDetSurface=
-      //dynamic_cast<const Trk::PlaneSurface&>( rio->associatedSurface().associatedDetectorElement()->surface() );
-      dynamic_cast<const Trk::PlaneSurface&>( det->surface() );
-    ATH_MSG_DEBUG("uncorrectedDetSurface: "<<uncorrectedDetSurface);
-
-    const MuonGM::MuonReadoutElement* detEl=
-      //dynamic_cast<const MuonGM::MuonReadoutElement*>(rio->associatedSurface().associatedDetectorElement());
-      dynamic_cast<const MuonGM::MuonReadoutElement*>(det);
-   
-    
-    // // get detector element for 1st multilayer
-    // if (detType==Trk::AlignModule::MDT) {
-    // int nMultilayers=detEl->nMDTinStation();
-    // if (nMultilayers==2) {
-    // const MdtIdHelper& mdtIdHelper=p_idHelperTool->mdtIdHelper(); 
-    // Identifier id=rio->detectorElement()->identify();
-    // int stName=mdtIdHelper.stationName(id);
-    // int stEta =mdtIdHelper.stationEta(id);
-    // int stPhi =mdtIdHelper.stationPhi(id);
-    // detEl = m_detMgr->getMdtReadoutElement(mdtIdHelper.channelID(stName,stEta,stPhi,1,1,1));
-    // }
-    // }  
-    
-
-    // surface transform in AMDB frame
-    const HepGeom::Transform3D amdbToGlobal = detEl->AmdbLRSToGlobalTransform();
-    HepGeom::Vector3D<double> lx = amdbToGlobal*HepGeom::Vector3D<double>(1.,0.,0.);
-    HepGeom::Vector3D<double> ly = amdbToGlobal*HepGeom::Vector3D<double>(0.,1.,0.);
-    HepGeom::Vector3D<double> lz = amdbToGlobal*HepGeom::Vector3D<double>(0.,0.,1.);
-    CLHEP::HepRotation surfaceRot(lx,ly,lz);
-    HepGeom::Transform3D* surfaceTransform = new HepGeom::Transform3D(surfaceRot,uncorrectedDetSurface.center());
-
-    if (msgLvl(MSG::DEBUG)) {
-      double distance=uncorrectedDetSurface.center().distance(mSeg->associatedSurface().center());
-      ATH_MSG_DEBUG("surface sep: "<<distance);
-    }
-      
-    // create new surface
-    double surfDim = 500.;
-    Trk::PlaneSurface* detSurface=new Trk::PlaneSurface(surfaceTransform,surfDim,surfDim);
-  
-    return detSurface; 
-    */
-  }
-
-  //________________________________________________________________________
-  const Trk::Track*
-  UnbiasedMuonResiduals::getTrackFromMuon(const Analysis::Muon* muon)
-  {
-    const Trk::Track* idTrack   =  muon->inDetTrkTrack();
-    const Trk::Track* muTrack   =  muon->muonExtrapolatedTrkTrack();
-    const Trk::Track* combTrack =  muon->combinedMuonTrkTrack();
-    return getTrack(idTrack,muTrack,combTrack);
-  }
-
-  //________________________________________________________________________
-  const Trk::Track*
-  UnbiasedMuonResiduals::getTrackFromTrack(const Trk::Track* track)
-  {
-    const Trk::Track* idTrack   =  0;
-    const Trk::Track* muTrack   =  track;
-    const Trk::Track* combTrack =  track;
-    return getTrack(idTrack,muTrack,combTrack);
-  }
-
-  //________________________________________________________________________
-  const Trk::Track*
-  UnbiasedMuonResiduals::getTrack(const Trk::Track* idTrack,
-				  const Trk::Track* muTrack,
-				  const Trk::Track* combTrack)
-  {
-    if (!muTrack) {
-      ATH_MSG_ERROR("no muon track!");
-      return 0;
-    }
-    
-    const Trk::Track* initTrack(0);
-    if (idTrack && muTrack && combTrack &&
-	(m_trackFittingType==CombinedMuonTrackBuilder ||
-	 m_trackFittingType==MSStandaloneFromCombinedMuon)) { 
-      
-      initTrack = m_combinedTrackBuilder->combinedFit(*idTrack,*muTrack,*muTrack);
-      if (!initTrack) ATH_MSG_DEBUG("no initTrack");
-      
-      if (initTrack && m_trackFittingType==MSStandaloneFromCombinedMuon) { 
-	const Trk::Track* standaloneTrack = m_combinedTrackBuilder->standaloneRefit(*initTrack);      
-	delete initTrack;
-	initTrack = standaloneTrack;
-      }
-    }
-    else if (idTrack && m_trackFittingType==MSStandaloneWithIDMomentum) {
-
-      ATH_MSG_ERROR("this doesn't work yet!");
-      return 0;
-
-      //double pT =idTrack->perigeeParameters()->pT();
-      //double eta=idTrack->perigeeParameters()->eta();
-      //double momentum=std::fabs(pT)*std::sqrt(1.+sinh(eta)*sinh(eta));
-      
-      //checkCovVar(*muTrack);
-      
-      //initTrack = m_trackFitter->fit(*muTrack,false,Trk::muon);
-    }
-    else if (combTrack && m_trackFittingType==NormalTrackFitter)
-      initTrack = new Trk::Track(*combTrack);
-    else if (m_trackFittingType==MSStandaloneWithIDTrackMatch) {
-      initTrack=new Trk::Track(*muTrack);
-
-      if (msgLvl(MSG::VERBOSE)) {
-	ATH_MSG_VERBOSE("refitting track");
-	Trk::Track* debugTrack=m_trackFitter->fit(*muTrack,false,Trk::muon);    
-	delete debugTrack;
-      }
-    }
-    else {
-      ATH_MSG_ERROR("bad value for TrackFittingType or incorrect tracks provided!");
-      return 0;
-    }
-    return initTrack;
-  }
-  
-  //________________________________________________________________________
-  Trk::Track*
-  UnbiasedMuonResiduals::getUnbiasedTrack(Identifier id1,
-					  const Trk::Track* initTrack,
-					  const Trk::PlaneSurface* /*detSurface*/,
-					  Trk::AlignModule::DetectorType detType,
-					  int flag)
-  {
-    ATH_MSG_DEBUG("in getUnbiasedTrack");
-
-    if (!initTrack->perigeeParameters()) 
-      ATH_MSG_DEBUG("no perigeeParameters for initTrack");
-    
-    m_materialOnTrack=0.;
-    const DataVector<const Trk::TrackStateOnSurface>* states = initTrack->trackStateOnSurfaces();
-    if ( !states ) return 0;
-    
-    // loop over TSOSs, find MDT hits, and mark them as outliers:
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit = states->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end = states->end();
-    
-    //std::cout << "MDT: will loop on the TSOS" << std::endl;
-    
-    bool isBEE1=(p_idHelperTool->isMdt(id1) && p_idHelperTool->mdtIdHelper().stationNameString(p_idHelperTool->mdtIdHelper().stationName(id1)).substr(0,3)=="BEE");
-    bool removeBarrel=(p_idHelperTool->isEndcap(id1)||isBEE1);
-
-    // This is the list of new TSOS I'll use without the MDTs
-    DataVector<const Trk::TrackStateOnSurface>* myNewTrackStateOnSurfaces = 
-      new DataVector<const Trk::TrackStateOnSurface>();
-    myNewTrackStateOnSurfaces->reserve( states->size() );
-    
-
-    int nGoodChambers=0;
-    Identifier lastId=Identifier();
-    int itsit(0);
-    for ( ; tsit!=tsit_end ; ++tsit,itsit++ ) {
-
-      if ((**tsit).type(Trk::TrackStateOnSurface::Perigee))
-	ATH_MSG_DEBUG("in getUnbiasedTrack, have perigee: "<<**tsit);
-
-      const Trk:: MaterialEffectsBase* materialEffects = 
-	(*tsit)->materialEffectsOnTrack();
-      if (materialEffects) m_materialOnTrack += materialEffects->thicknessInX0();
-      
-      const Trk::MeasurementBase* meas = (*tsit)->measurementOnTrack();
-      if ( !meas ) {
-	myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit) );
-	continue;
-      }
-      
-      const Trk::MeasurementBase*      mesb = (*tsit)->measurementOnTrack();      
-      const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-      if (!rio && crio) rio=&crio->rioOnTrack(0);
-      if (!rio) {
-	myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit) );
-	continue;
-      }
-      
-      Identifier id = p_idHelperTool->chamberId(rio->detectorElement()->identify());
-
-      // check if TGC hit
-      if (m_makeTGCOutliers && p_idHelperTool->isTgc(id) &&
-	  !p_idHelperTool->tgcIdHelper().isStrip(rio->prepRawData()->identify())) {
-	ATH_MSG_DEBUG("setting TGC eta to outlier");
-	myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit,true));
-	continue;
-      }
-      
-      // if barrel and doing endcap cap or vice versa, remove from track
-      bool isBEE=(p_idHelperTool->isMdt(id) && p_idHelperTool->mdtIdHelper().stationNameString(p_idHelperTool->mdtIdHelper().stationName(id)).substr(0,3)=="BEE");
-      bool isEndcap=p_idHelperTool->isEndcap(id)||isBEE;
-      ATH_MSG_DEBUG("isEndcap: "<<isEndcap);
-      if ( p_idHelperTool->isMuon(id) && isEndcap!=removeBarrel ) {
-	ATH_MSG_DEBUG("have endcap and doing barrel (or vice versa)");
-	continue;
-      }
-
-      // ID hits, so keep
-      if (!p_idHelperTool->isMuon(id)) {
-	myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit) );
-	continue;
-      }	
-
-      // increment number MDT chambers if new MDT chamber
-      if (id!=lastId && p_idHelperTool->isMdt(id)) {
-	lastId=id;
-	nGoodChambers++;
-      }
-      
-      // clone TSOS if hits in other chamber
-      if (id!=id1) {
-	myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit) );
-	continue;
-      }	
-
-      // see if in selected chamber
-      if (!passesChamberSelection(detType,id,flag)) {
-	bool makeOutlier=true;
-	myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit,makeOutlier) );
-	continue;
-      }
-      
-      // I have found a good hit, so mark it as outlier so not used in the new track fit      
-      bool makeOutlier=true;
-      ATH_MSG_DEBUG("outlier for hit at position: "<<mesb->globalPosition());
-      myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit,makeOutlier) );     
-    }
-
-    // check if at least 2 MDT chambers on track
-    if (nGoodChambers<2) {
-      ATH_MSG_DEBUG("good chambers: "<<nGoodChambers);
-      return 0;
-    }
-
-    // Create a new track with hits on track and outliers:
-    Trk::Track* newTrack =  new Trk::Track( initTrack->info(), myNewTrackStateOnSurfaces, 
-					    initTrack->fitQuality() ? 
-					    initTrack->fitQuality()->clone():0 );
-    
-    // check that track exists and has enough hits left after turning hits to outliers
-    if ( !newTrack) {
-      ATH_MSG_DEBUG("no track");
-      //delete myNewTrackStateOnSurfaces;
-      return 0;
-    }
-    ATH_MSG_DEBUG("tsos size: "<<newTrack->trackStateOnSurfaces()->size());
-
-    if (newTrack->trackStateOnSurfaces()->size() < 10 ) {
-      ATH_MSG_DEBUG("not enough TSOS");
-      delete newTrack;
-      return 0;
-    }
-    
-    // Refit track with MDT marked as outliers
-    ATH_MSG_DEBUG("refitting track with hits marked as outliers");
-    //ATH_MSG_DEBUG("perigee params: "<<newTrack->perigeeParameters());
-    if (newTrack->perigeeParameters()) ATH_MSG_DEBUG(*newTrack->perigeeParameters());
-    else {
-      ATH_MSG_DEBUG("no perigeeParams, printing first trackParam");
-      ATH_MSG_DEBUG(**(newTrack->trackParameters()->begin()));
-    }    
-    Trk::Track* refitNewTrack = 
-      (m_trackFittingType==CombinedMuonTrackBuilder ||
-       m_trackFittingType==MSStandaloneFromCombinedMuon) ? 
-      m_combinedTrackBuilder->fit(*newTrack,false,Trk::muon) : 
-      m_trackFitter->fit(*newTrack,false,Trk::muon);
-    
-    if ( !refitNewTrack ) {
-      //delete myNewTrackStateOnSurfaces;
-      delete newTrack;
-      return 0;
-    }
-    if (!refitNewTrack->trackStateOnSurfaces() ) {
-      delete newTrack;
-      delete refitNewTrack;
-      return 0;
-    }
-    
-    return refitNewTrack;
-  }
-
-  //________________________________________________________________________
-  Trk::Track*
-  UnbiasedMuonResiduals::cleanTrack(Identifier id1,
-				    const Trk::Track& track, 
-				    bool removePerigee)
-  {
-    ATH_MSG_DEBUG("in cleanTrack");
-    
-    const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces();
-    if ( !states ) return 0;
-    
-    // loop over TSOSs, find MDT hits, and mark them as outliers:
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit = states->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end = states->end();
-        
-
-    bool isBEE1=(p_idHelperTool->isMdt(id1) && p_idHelperTool->mdtIdHelper().stationNameString(p_idHelperTool->mdtIdHelper().stationName(id1)).substr(0,3)=="BEE");
-    bool removeBarrel=p_idHelperTool->isEndcap(id1)||isBEE1;
-
-    // This is the list of new TSOS I'll use without the MDTs
-    DataVector<const Trk::TrackStateOnSurface>* myNewTrackStateOnSurfaces = 
-      new DataVector<const Trk::TrackStateOnSurface>();
-    myNewTrackStateOnSurfaces->reserve( states->size() );
-    
-
-    int itsit(0);
-    for ( ; tsit!=tsit_end ; ++tsit,itsit++ ) {
-
-      if ((**tsit).type(Trk::TrackStateOnSurface::Perigee)) {
-	ATH_MSG_DEBUG("in cleanTrack, have perigee: "<<**tsit);
-	if (!removePerigee) 
-	  myNewTrackStateOnSurfaces->push_back(cloneTSOS(*tsit) );
-	continue;
-      }
-
-      const Trk:: MaterialEffectsBase* materialEffects = 
-	(*tsit)->materialEffectsOnTrack();
-      if (materialEffects) m_materialOnTrack += materialEffects->thicknessInX0();
-      
-      const Trk::MeasurementBase* meas = (*tsit)->measurementOnTrack();
-      if ( !meas ) {
-	myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit) );
-	continue;
-      }
-      
-      const Trk::MeasurementBase*      mesb = (*tsit)->measurementOnTrack();      
-      const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-      if (!rio && crio) rio=&crio->rioOnTrack(0);
-      if (!rio) {
-	myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit) );
-	continue;
-      }
-      
-      Identifier id = p_idHelperTool->chamberId(rio->detectorElement()->identify());
-
-      // if barrel and doing endcap cap or vice versa, remove from track
-      bool isBEE=(p_idHelperTool->isMdt(id) && p_idHelperTool->mdtIdHelper().stationNameString(p_idHelperTool->mdtIdHelper().stationName(id)).substr(0,3)=="BEE");
-      bool isEndcap=p_idHelperTool->isEndcap(id)||isBEE;
-      ATH_MSG_DEBUG("isEndcap: "<<isEndcap);
-      if ( p_idHelperTool->isMuon(id) && isEndcap!=removeBarrel ) {
-	ATH_MSG_DEBUG("have endcap and doing barrel (or vice versa)");
-	continue;
-      }
-
-      myNewTrackStateOnSurfaces->push_back( cloneTSOS(*tsit) );
-      continue;
-    }
-    
-    // Create a new track with hits on track and outliers:
-    Trk::Track* newTrack =  new Trk::Track( track.info(), myNewTrackStateOnSurfaces, 
-					    track.fitQuality() ? 
-					    track.fitQuality()->clone():0 );
-    
-    if (!newTrack) delete myNewTrackStateOnSurfaces;
-    
-    return newTrack;
-  }
-
-  //________________________________________________________________________
-  const Trk::TrackParameters* 
-  UnbiasedMuonResiduals::getTrackExtrapolated(Identifier id1,
-					      const Trk::Track* unbiasedTrack,
-					      const Trk::PlaneSurface* detSurface)
-  {  
-
-
-    // Now loop over the TSOS from above track and get track parameters in the MDT
-    const DataVector<const Trk::TrackStateOnSurface>* states = 
-      unbiasedTrack->trackStateOnSurfaces();
-  
-    // loop over TSOSs, find first TSOS in selected chamber, return track parameters
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit     = states->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end = states->end();
-
-    for ( ; tsit!=tsit_end ; ++tsit ) {
-    
-      const Trk::MeasurementBase*      mesb = (*tsit)->measurementOnTrack();      
-      const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-      if (!rio && crio) rio=&crio->rioOnTrack(0);
-      if (!rio) continue;
-    
-      if (!(*tsit)->type(Trk::TrackStateOnSurface::Outlier)) continue;
-
-      Identifier id = p_idHelperTool->chamberId(rio->detectorElement()->identify());
-      if (id!=id1) continue;
-
-      // Track parameters on detector surface
-      const Trk::TrackParameters* trackPar = (*tsit)->trackParameters();
-      if ( !trackPar ) continue;
-    
-      // extrapolate to detector surface
-      const Trk::TrackParameters* trackParAtDetSurface = 
-	p_IExtrapolator->extrapolate( *trackPar, *detSurface, 
-				      Trk::anyDirection, false, Trk::nonInteracting);
-      if ( !trackParAtDetSurface ) continue;    
-
-      ATH_MSG_DEBUG("original trackPar:    "<<*trackPar);
-      ATH_MSG_DEBUG("trackParAtDetSurface: "<<*trackParAtDetSurface);
-
-      return trackParAtDetSurface;
-    }
-
-    return 0;
-  }
-
-  //________________________________________________________________________
-  bool UnbiasedMuonResiduals::checkMuon(const Analysis::Muon& muon)
-  {
-    const Rec::TrackParticle * cbTrackParticle = muon.combinedMuonTrackParticle();
-    if ( !cbTrackParticle ) return 0;
-    
-    const Trk::Perigee * cbperigee = cbTrackParticle->measuredPerigee();
-    if ( !cbperigee ) return 0;
-    
-    // Only keep combined muons with ID and MS tracks, and best match !
-    if ( !muon.isCombinedMuon() ) return 0;
-  
-    // Cut on momentum
-    if ( muon.p() < m_MinMuonMom ) return 0;
-
-    // Cut on track hit multiplicity
-    if ( muon.numberOfPixelHits()  < m_minPIXHits ) return 0;
-    if ( muon.numberOfSCTHits()    < m_minSCTHits ) return 0;
-    if ( muon.numberOfTRTHits()    < m_minTRTHits ) return 0;
-    if ( muon.numberOfMDTHits()    < m_minMDTHits ) return 0;
-    if ( muon.numberOfCSCEtaHits() < m_minCSCHits ) return 0;
-    
-    m_nPixHits=muon.numberOfPixelHits();
-    m_nSCTHits=muon.numberOfSCTHits();
-    m_nTRTHits=muon.numberOfTRTHits();
-    m_nCSCHits=muon.numberOfCSCEtaHits();
-    m_nMDTHits=muon.numberOfMDTHits();
-  
-    m_author=(int)muon.author();
-    std::pair<double,double> eloss=muon.energyLoss();
-    m_calEnergyLoss=eloss.first;
-    m_calEnergyLossErr=eloss.second;
-
-    // fill some tree variables (filled separately if Analysis::Muon not used)
-    m_charge=cbperigee->charge();
-    m_momentum = muon.p() /1000.;
-    m_d0       = cbperigee->parameters()[Trk::d0];
-    m_z0       = cbperigee->parameters()[Trk::z0];
-    m_phi0     = MuonAlign::RadsToDegrees(cbperigee->parameters()[Trk::phi0]);
-    m_theta0   = MuonAlign::RadsToDegrees(cbperigee->parameters()[Trk::theta]);
-    m_eta0     = cbperigee->eta();          
-
-    ATH_MSG_DEBUG("momentum: "<<m_momentum<<", charge: "<<m_charge);
-    ATH_MSG_DEBUG("d0: "<<m_d0<<", z0: "<<m_z0<<", phi0: "<<m_phi0);
-    ATH_MSG_DEBUG("theta: "<<m_theta0<<", eta: "<<m_eta0);
-
-    return true;
-  }
-
-  //________________________________________________________________________
-  bool UnbiasedMuonResiduals::checkTrack(const Trk::Track& track)
-  {  
-    ATH_MSG_DEBUG("in checkTrack");
-
-    int nLayerHits[4]={0,0,0,0};
-
-    int nBEEHits=0;
-    int nEEHits =0;
-
-    m_nTriggerPhiHits=0;
-
-    bool cscSector5Aor9A=false;
-
-    const DataVector<const Trk::TrackStateOnSurface>* tsosCollection=track.trackStateOnSurfaces();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=tsosCollection->begin(); 
-    for (; iTsos!=tsosCollection->end(); ++iTsos) {
-
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Perigee))
-	ATH_MSG_DEBUG("track has perigee");
-
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) {
-      
-	// get measurement, continue if hit to be removed
-	const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();      
-	const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=&crio->rioOnTrack(0);
-	if (!rio) continue;
-      
-	Identifier detId=rio->detectorElement()->identify();
-	//Identifier rioId=rio->identify();
-
-	if (!p_idHelperTool->isMuon(detId))  continue;      
-
-	// get measurement type
-	TrackState::MeasurementType measType;       
-	if      (p_idHelperTool->isMdt(detId)) measType=TrackState::MDT;
-	else if (p_idHelperTool->isCsc(detId)) measType=TrackState::CSC;
-	else if (p_idHelperTool->isRpc(detId)) measType=TrackState::RPC;
-	else if (p_idHelperTool->isTgc(detId)) measType=TrackState::TGC;
-	else {
-	  ATH_MSG_WARNING("bad muon ID");
-	  continue;
-	}
-
-	if (measType==TrackState::MDT) {	
-	  int stationLayer = getMdtStatLayer(detId);
-	  if (stationLayer>3) { ATH_MSG_WARNING("stationLayer>3!"); continue; }
-	  nLayerHits[stationLayer]++;
-	  if (stationLayer==3) {
-	    const std::string stName=
-	      p_idHelperTool->mdtIdHelper().stationNameString(p_idHelperTool->mdtIdHelper().stationName(detId));
-	    if (stName.substr(0,3)=="BEE") nBEEHits++;
-	    if (stName.substr(0,2)=="EE")  nEEHits++;
-	  }	  
-	} 
-	else if (measType==TrackState::CSC) {
-	  nLayerHits[0]++;	  
-	  int stEta  = p_idHelperTool->cscIdHelper().stationEta(detId);
-	  int stPhi  = p_idHelperTool->cscIdHelper().stationPhi(detId);	  
-	  if ((stPhi==3||stPhi==5) && stEta>0) {
-	    bool isLarge = ! (p_idHelperTool->isSmallChamber( detId ));
-	    if (isLarge)  cscSector5Aor9A=true;
-	  }
-	}
-	else if (measType==TrackState::TGC) { 
-	  if ( (p_idHelperTool->isTgc(detId) && 
-		p_idHelperTool->tgcIdHelper().isStrip(rio->prepRawData()->identify())) ||
-	       (p_idHelperTool->isRpc(detId) && 
-		p_idHelperTool->rpcIdHelper().measuresPhi(rio->prepRawData()->identify())) )
-	    m_nTriggerPhiHits++;
-	  
-	}	
-      }
-    }
-    
-    m_nInnerMDTHits =nLayerHits[0];
-    m_nMiddleMDTHits=nLayerHits[1];
-    m_nOuterMDTHits =nLayerHits[2];
-  
-    int minInnerMDTHits=(cscSector5Aor9A)?6:7;
-    
-    if ( ( m_nInnerMDTHits<minInnerMDTHits && nBEEHits==0 && nEEHits==0) ||
-	 ( m_nMiddleMDTHits<5 ) || 
-	 ( m_nOuterMDTHits<5 && nEEHits==0 ) ) {
-      if ( m_nInnerMDTHits<minInnerMDTHits && nBEEHits==0 && nEEHits==0)
-	ATH_MSG_DEBUG("failed inner cut");
-      if ( m_nMiddleMDTHits<5 ) ATH_MSG_DEBUG("failed middle cut");
-      if ( m_nOuterMDTHits<5 && nEEHits==0 ) {
-	ATH_MSG_DEBUG("failed outer cut, outerMDTHits: "<<m_nOuterMDTHits<<", nEE: "<<nEEHits);
-      }
-      return false;
-    }
-    if (m_nTriggerPhiHits<1) {
-      ATH_MSG_DEBUG("failed trigger phi cut");
-      return false;
-    }
-
-    if (nEEHits>0) ATH_MSG_DEBUG("have EE hits");
-
-    return true;
-  }
-
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::getBiasedResiduals(const Trk::Track& /*track*/)
-  {  
-    ATH_MSG_ERROR("update getBiasedResiduals for Eigen");  
-    return;
-
-    /*
-    m_nCSCHits=m_nMDTHits=m_nRPCHits=m_nTGCHits=0;
-    
-    for (int i=0;i<m_MAXNMDTHITS;i++) { m_mdtRes[i]=-999.; m_mdtPull[i]=-999.; }
-    for (int i=0;i<m_MAXNTGCHITS;i++) { m_tgcRes[i]=-999.; m_tgcPull[i]=-999.; }
-    for (int i=0;i<m_MAXNCSCHITS;i++) { m_cscRes[i]=-999.; m_cscPull[i]=-999.; }
-    for (int i=0;i<m_MAXNRPCHITS;i++) { m_rpcRes[i]=-999.; m_rpcPull[i]=-999.; }
-    
-    const DataVector<const Trk::TrackStateOnSurface>* tsosCollection=track.trackStateOnSurfaces();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=tsosCollection->begin(); 
-    for (; iTsos!=tsosCollection->end(); ++iTsos) {
-    
-      if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) {
-      
-	// get measurement, continue if hit to be removed
-	const Trk::MeasurementBase*      mesb = (*iTsos)->measurementOnTrack();      
-	const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-	const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-	if (!rio && crio) rio=&crio->rioOnTrack(0);
-	if (!rio) continue;
-      
-	Identifier detId=rio->detectorElement()->identify();
-	Identifier rioId=rio->identify();
-
-	if (!p_idHelperTool->isMuon(detId))  continue;      
-
-	// get measurement type
-	TrackState::MeasurementType measType;       
-	if (p_idHelperTool->isMdt(detId))      measType=TrackState::MDT;
-	else if (p_idHelperTool->isCsc(detId)) measType=TrackState::CSC;
-	else if (p_idHelperTool->isRpc(detId)) measType=TrackState::RPC;
-	else if (p_idHelperTool->isTgc(detId)) measType=TrackState::TGC;
-	else {
-	  ATH_MSG_WARNING("bad muon ID");
-	  continue;
-	}
-
-	// get residualPull
-	const Trk::ResidualPull* resPull = 0;
-	const Trk::TrackParameters* trackPars = (*iTsos)->trackParameters();
-	
-	if ( trackPars ) {
-	  resPull = m_pullCalculator->residualPull( mesb, trackPars,
-						    Trk::ResidualPull::HitOnly,
-						    measType);
-	}
-	
-	if (measType==TrackState::MDT) {	
-
-	  if (m_nMDTHits<=m_MAXNMDTHITS) {
-	    if (resPull) {
-	      m_mdtRes [m_nMDTHits]=resPull->residual().front();
-	      m_mdtPull[m_nMDTHits]=resPull->pull().front();
-	    }
-	    m_nMDTHits++;
-	  }
-	} 
-	else if (measType==TrackState::CSC) {
-	  if (m_nCSCHits<=m_MAXNCSCHITS) {
-	    m_cscHitLocX  [m_nCSCHits]=rio->localParameters()[Trk::locX];
-	    m_cscHitLocY  [m_nCSCHits]=rio->localParameters()[Trk::locY];
-	    m_cscHitErrors[m_nCSCHits]=rio->localErrorMatrix().error(Trk::loc1);
-	    if (resPull) {
-	      m_cscRes [m_nCSCHits]=resPull->residual().front();
-	      m_cscPull[m_nCSCHits]=resPull->pull().front();
-	    }
-	    m_nCSCHits++;
-	  }
-	}
-	else if (measType==TrackState::TGC) { 
-	  if (m_nTGCHits<=m_MAXNTGCHITS) {
-	    if (resPull) {
-	      m_tgcRes [m_nTGCHits]=resPull->residual().front();
-	      m_tgcPull[m_nTGCHits]=resPull->pull().front();
-	    }
-	    m_nTGCHits++;
-	  }     
-	}	
-	else if (measType==TrackState::RPC) { 
-
-	  if (m_nRPCHits<=m_MAXNRPCHITS) {
-	    if (resPull) {
-	      m_rpcRes [m_nRPCHits]=resPull->residual().front();
-	      m_rpcPull[m_nRPCHits]=resPull->pull().front();
-	    }
-	    m_nRPCHits++;	    
-	  }
-	}
-      }
-    }
-    
-    return;
-    */
-  } 
-
-  //________________________________________________________________________  
-  const Trk::TrackParameters* 
-  UnbiasedMuonResiduals::getIDTrackExtrapolated(const Trk::Track* idtrack,
-						const Trk::PlaneSurface* detSurface)
-  {
-    if ( !idtrack ) return 0;
-    if ( fabs(idtrack->perigeeParameters()->parameters()[Trk::z0]) > m_MaxIDz0 ) return 0;
-    if ( fabs(idtrack->perigeeParameters()->parameters()[Trk::d0]) > m_MaxIDd0 ) return 0;
-  
-    // PROPAGATE TRACK TO MDT SEGMENT USING THE SURFACE ON WHICH THE SEGMENT IS DEFINED
-    const Trk::TrackParameters* extraPar = 
-      p_IExtrapolator->extrapolate( *idtrack, *detSurface, Trk::alongMomentum, false, Trk::muon);
-    if (!extraPar) return 0;
- 
-    return extraPar;
-  }
-
-  //________________________________________________________________________  
-  const Trk::TrackParameters* 
-  UnbiasedMuonResiduals::getSegmentExtrapolated(const Muon::MuonSegment* /*mSeg*/,
-						const Trk::PlaneSurface* /*detSurface*/)
-  {
-    ATH_MSG_ERROR("migrate getSegmentExtrapolated to Eigen");
-    return 0;
-
-    /*
-    double qOverP=m_charge/100000.;
-
-    ATH_MSG_DEBUG("in getSegmentExtrapolated, mSeg: "<<*mSeg);
-
-    // construct track parameters
-    double locx = mSeg->localParameters().contains(Trk::locX) ? 
-      mSeg->localParameters()[Trk::locX] : 0.;
-    double locy = mSeg->localParameters().contains(Trk::locY) ? 
-      mSeg->localParameters()[Trk::locY] : 0.;
-    double globPhi   = mSeg->globalDirection().phi();
-    double globTheta = mSeg->globalDirection().theta();
-  
-    Trk::JacobianPhiThetaLocalAngles globalToLocalMeasAnglesJacobian(globPhi,globTheta,
-								     detSurface->transform().getRotation().inverse());
- 
-    CLHEP::HepSymMatrix globalToLocalMeasJacobian(5,0);
-    globalToLocalMeasJacobian[Trk::locX][Trk::locX]   = 1.0;
-    globalToLocalMeasJacobian[Trk::locY][Trk::locY]   = 1.0;
-    globalToLocalMeasJacobian[Trk::phi][Trk::phi]     = globalToLocalMeasAnglesJacobian[0][0];
-    globalToLocalMeasJacobian[Trk::theta][Trk::theta] = globalToLocalMeasAnglesJacobian[1][1];
-    globalToLocalMeasJacobian[Trk::theta][Trk::phi]   = globalToLocalMeasAnglesJacobian[0][1]; // also fills [Trk::phi][Trk::theta]
-    globalToLocalMeasJacobian[Trk::qOverP][Trk::qOverP] = 1.0;     
-    
-    
-    Trk::JacobianPhiThetaLocalAngles localToGlobalMeasAnglesJacobian(mSeg->localParameters()[Trk::phi],
-								     mSeg->localParameters()[Trk::theta],
-								     detSurface->transform().getRotation());
-    
-    ATH_MSG_DEBUG("loc angles: "<<localToGlobalMeasAnglesJacobian);
-
-    CLHEP::HepSymMatrix localToGlobalMeasJacobian(5,0);
-    localToGlobalMeasJacobian[Trk::locX] [Trk::locX]  = 1.0;
-    localToGlobalMeasJacobian[Trk::locY] [Trk::locY]  = 1.0;
-    localToGlobalMeasJacobian[Trk::phi]  [Trk::phi]   = localToGlobalMeasAnglesJacobian[0][0];
-    localToGlobalMeasJacobian[Trk::theta][Trk::theta] = localToGlobalMeasAnglesJacobian[1][1];
-    localToGlobalMeasJacobian[Trk::theta][Trk::phi]   = localToGlobalMeasAnglesJacobian[0][1]; // also fills [Trk::phi][Trk::theta]
-    localToGlobalMeasJacobian[Trk::qOverP][Trk::qOverP] = 1.0;     
-    ATH_MSG_DEBUG("jac: "<<localToGlobalMeasJacobian);
-    
-    Trk::CovarianceMatrix locCovMat=mSeg->localErrorMatrix().covariance();
-    
-    CLHEP::HepSymMatrix locCovMatFull(5,0);
-    for (int i=0;i<4;i++)
-      for (int j=i;j<4;j++)
-	locCovMatFull.fast(j+1,i+1)=locCovMat.fast(j+1,i+1);
-    locCovMatFull.fast(5,5)=1.e-12;
-    ATH_MSG_DEBUG("locCovMatFull: "<<locCovMatFull);
-    
-
-    Trk::CovarianceMatrix* globCovMat = new Trk::CovarianceMatrix( locCovMatFull.similarity(localToGlobalMeasJacobian) );
-
-    const Trk::MeasuredAtaPlane* segPar=
-      new Trk::MeasuredAtaPlane(locx,locy,globPhi,globTheta,qOverP,mSeg->associatedSurface(),globCovMat);
-
-    ATH_MSG_DEBUG("segPar: "<<*segPar);
-    ATH_MSG_DEBUG("seg surface: "<<mSeg->associatedSurface());
-    ATH_MSG_DEBUG("detSurface: "<<*detSurface);
-
-    // extrapolate segment to detector surface
-    const Trk::TrackParameters* segParAtDetSurface = 
-      p_IExtrapolator->extrapolate( *segPar, *detSurface, Trk::anyDirection, false,Trk::nonInteracting);
-    if (!segParAtDetSurface) ATH_MSG_ERROR("no segParAtDetSurface!");
-    else ATH_MSG_DEBUG("segParAtDetSurface: "<<*segParAtDetSurface);
-
-    return segParAtDetSurface;
-    */
-  }
-
-
-
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::compareSurfaces(const std::string& /*trackType*/,
-					      const Trk::Surface& /*segSurface*/, 
-					      const Trk::Surface& /*detSurf*/)
-  {
-    ATH_MSG_ERROR("migrate to Eigen");
-    return;
-
-    /*
-    ATH_MSG_VERBOSE(trackType<<" track, isFree: "
-		    <<segSurface.isFree()<<", segSurface: "<<endmsg<<segSurface);
-  
-    //ATH_MSG_DEBUG(trackType<< " track, normal cross normal: "<<segSurface.normal().cross(detSurf.normal()).mag());
-    //ATH_MSG_DEBUG(trackType<<" track, angle: "
-    //	<<segSurface.normal().angle(detSurf.normal())*360./6.2832<<" degrees");
-  
-    const HepGeom::Vector3D<double> unitxvec(1.,0.,0.);
-    const HepGeom::Vector3D<double> segSurfX=segSurface.transform()*unitxvec;
-    const HepGeom::Vector3D<double> detSurfX=detSurf.transform()*unitxvec;
-  
-    //ATH_MSG_DEBUG("x dot x: "<<segSurfX.dot(detSurfX));
-  
-    return;
-    */
-
-  } 
-
-  /*
-  //________________________________________________________________________
-  const Trk::MeasuredAtaPlane* 
-  UnbiasedMuonResiduals::trackParameters(const Trk::TrackStateOnSurface* tsit, 
-					 const Trk::PlaneSurface& surface)
-  {
-  
-    const Trk::TrackParameters* trackPar = tsit->trackParameters();
-  
-    if ( !trackPar ) {
-      return 0;
-    }
-  
-    ATH_MSG_DEBUG("after refit, tsos trackPar: "<<*trackPar);
-  
-    if (!trackPar->covariance())) {
-      return 0;
-    }
-  
-    const Trk::TrackParameters* newTrackPar = 
-      p_IExtrapolator->extrapolate( *trackPar, surface, 
-				    Trk::anyDirection, false, 
-				    Trk::nonInteracting); // Track parameters at same surface as MDT segment
-  
-    if ( !newTrackPar ) return 0;
-  
-    const Trk::MeasuredAtaPlane* trkMeasuredAtaPlane = 
-      dynamic_cast<const Trk::MeasuredAtaPlane*> (newTrackPar);
-    if ( !trkMeasuredAtaPlane ) {
-      ATH_MSG_ERROR("no MeasuredAtaPlane!");
-    }
-  
-    return trkMeasuredAtaPlane;
-  } 
-  */
-
-  //________________________________________________________________________
-  const Analysis::Muon* UnbiasedMuonResiduals::findMuon(const Analysis::MuonContainer* muonTES, 
-							Muon::MuonSegment* mSeg) const
-  {
-  
-    Muon::MuonSegmentKey segKeys(*mSeg);
-  
-    Analysis::MuonContainer::const_iterator muonIt  = muonTES->begin();
-    Analysis::MuonContainer::const_iterator muonItE = muonTES->end();
-  
-    const Analysis::Muon* bestMuon(0);
-    int bestNMatches(-1);
-
-    // Loop over muon collection
-    for ( ; muonIt!=muonItE; ++muonIt ) {
-    
-      if (muonIt == muonItE || !*muonIt) continue;
-
-      // Only keep combined muons with ID and MS tracks, and best match !
-      if ( !(*muonIt)->isCombinedMuon() ) {
-	ATH_MSG_DEBUG("no combined muon!");
-	continue;
-      }
-      const Trk::Track* track = (*muonIt)->combinedMuonTrkTrack();
-
-      // Collect hits from track
-      std::vector<const Trk::MeasurementBase*> measurements;	
-
-      DataVector<const Trk::TrackStateOnSurface>::const_iterator it  = track->trackStateOnSurfaces()->begin();
-      DataVector<const Trk::TrackStateOnSurface>::const_iterator it_end = track->trackStateOnSurfaces()->end();
-      for ( ; it!=it_end; ++it) {
-	if ( (*it) != 0 ){
-	  const Trk::MeasurementBase* rotTest = (*it)->measurementOnTrack();  
-	  if (rotTest) measurements.push_back(rotTest);
-	}
-      }
-
-      Muon::MuonSegmentKey trkKeys(measurements);
-    
-      std::vector< std::pair<unsigned int,int> > intersection;
-      std::set_intersection(segKeys.keys().begin(),segKeys.keys().end(),
-			    trkKeys.keys().begin(),trkKeys.keys().end(),
-			    std::back_inserter(intersection));
-      int intersectionSize = intersection.size();
-      int segmentSize = segKeys.keys().size();
-    
-      // if subset, we're done
-      if( segmentSize == intersectionSize ) return *muonIt;
-    
-      if (intersectionSize>bestNMatches) {
-	bestNMatches=intersectionSize;
-	bestMuon=*muonIt;
-      }
-    }
-  
-    return bestMuon;
-  }
-
-  //________________________________________________________________________
-  const Trk::Track* UnbiasedMuonResiduals::prepareTrack(const Trk::Track& track, double qOverP)
-  {
-    ATH_MSG_DEBUG("in findTrack");
-        
-    const Trk::Track* newTrack=&track;
-
-    bool refitPT=(m_trackFittingType==MSStandaloneWithIDMomentum);
-    ATH_MSG_DEBUG("refitPT: "<<refitPT<<", m_trackFittingType: "<<m_trackFittingType);
-
-    if (refitPT) {
-      
-      ATH_MSG_DEBUG("calling pTCorrectTrack with qOverP="<<qOverP);
-      newTrack=m_muonAlignRefitTool->pTCorrectTrack(track,qOverP,true);
-      if (!newTrack) {
-	ATH_MSG_DEBUG("failed to pT-correct track!");
-	return 0;
-      }
-    }
-    
-    ATH_MSG_DEBUG("recalibrating hits with muonSegmentTrackBuilder");
-    
-    //ATH_MSG_DEBUG("before redoing CROTs: ");
-    ATH_MSG_DEBUG("before recalibrating hits: ");
-    ATH_MSG_DEBUG(m_printer->print(*newTrack)<<endmsg<<
-		  m_printer->printStations(*newTrack)<<endmsg<<
-		  m_printer->printMeasurements(*newTrack));
-  
-    const Trk::Track* oldTrack=newTrack;
-    newTrack=p_trackBuilder->recalibrateHitsOnTrack(*oldTrack,false,true);
-    //newTrack=m_muonAlignRefitTool->redoHitsOnTrack(*bestTrack);
-    if (refitPT) delete oldTrack;
-    
-    if (!newTrack) {
-      ATH_MSG_DEBUG("failed to redo CROTs on track!");
-      return 0;
-    }
-    
-    //ATH_MSG_DEBUG("after redoing CROTs: ");
-    ATH_MSG_DEBUG("after recalibrating hits: ");
-    ATH_MSG_DEBUG(m_printer->print(*newTrack)<<endmsg<<
-		  m_printer->printStations(*newTrack)<<endmsg<<
-		  m_printer->printMeasurements(*newTrack));
-    
-    if (refitPT) {
-      ATH_MSG_DEBUG("calling pTCorrectTrack (again) with qOverP="<<qOverP);
-      oldTrack=newTrack;
-      newTrack=m_muonAlignRefitTool->pTCorrectTrack(*oldTrack,qOverP,
-						       true);
-      delete oldTrack;
-    }
-
-    /*
-      if (m_redoErrorScaling) {
-      ATH_MSG_DEBUG("redoing error scaling");
-      oldTrack=newTrack;
-      newTrack=m_muonAlignRefitTool->rescaleHitErrorsOnTrack(*oldTrack);
-      delete oldTrack;
-      
-      oldTrack=newTrack;
-      newTrack=m_muonAlignRefitTool->pTCorrectTrack(*oldTrack,qOverP);
-      delete oldTrack;
-      }    
-    */
-
-    /*
-      ATH_MSG_DEBUG("printing perigee for pTCorrectTrack (before fit)");    
-      printPerigee(*newTrack);
-      ATH_MSG_DEBUG("refitting pTCorrectTrack");
-      ATH_MSG_DEBUG("perigee params: "<<newTrack->perigeeParameters());
-      if (newTrack->perigeeParameters()) ATH_MSG_DEBUG(*newTrack->perigeeParameters());
-      else {
-      ATH_MSG_DEBUG("no perigeeParams, printing first trackParam");
-      ATH_MSG_DEBUG(**(newTrack->trackParameters()->begin()));
-      }
-    */
-    /*
-      const Trk::Track* refittedNewTrack=m_trackFitter->fit(*newTrack,false,Trk::muon);
-      delete newTrack;
-      ATH_MSG_DEBUG("printing perigee for pTCorretedTrack (after fit)");
-    */  
-
-    return newTrack;
-  }
-  
-  //________________________________________________________________________
-  const Trk::TrackStateOnSurface* 
-  UnbiasedMuonResiduals::cloneTSOS(const Trk::TrackStateOnSurface* tsos,
-				   bool makeOutlier)
-  {
-    
-    if (tsos->type(Trk::TrackStateOnSurface::Perigee)) return tsos->clone();
-
-    const Trk::MeasurementBase*     newMeas = tsos->measurementOnTrack() ? tsos->measurementOnTrack()->clone() : 0;
-    const Trk::TrackParameters*     newPars = tsos->trackParameters() ? tsos->trackParameters()->clone() : 0;
-    const Trk::FitQualityOnSurface* newFitQoS = tsos->fitQualityOnSurface() ? tsos->fitQualityOnSurface()->clone() : 0;
-    const Trk::MaterialEffectsBase* meb = tsos->materialEffectsOnTrack() ? tsos->materialEffectsOnTrack()->clone() : 0;
-  
-    
-    if (meb) {
-      const Trk::MaterialEffectsOnTrack* meot=dynamic_cast<const Trk::MaterialEffectsOnTrack*>(meb);
-      if (meot) {
-	double tinX0=meot->thicknessInX0();
-	const Trk::EnergyLoss* eLoss=meot->energyLoss() ? meot->energyLoss()->clone() : 0;
-	const Trk::Surface& surf=meot->associatedSurface();
-	std::bitset<MaterialEffectsBase::NumberOfMaterialEffectsTypes> typeMaterial;
-	if (eLoss) typeMaterial.set(MaterialEffectsBase::EnergyLossEffects);
-	const Trk::MaterialEffectsOnTrack* newmeot=
-	  new Trk::MaterialEffectsOnTrack(tinX0,0,eLoss,surf,typeMaterial);
-	delete meb;
-	meb=newmeot;
-      }
-    }    
-      
-    std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
-    for (int i=0;i<(int)Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes;i++) {
-      if (tsos->type(Trk::TrackStateOnSurface::TrackStateOnSurfaceType(i)))
-	typePattern.set(i);
-    }
-    if (makeOutlier) typePattern.set(Trk::TrackStateOnSurface::Outlier);
-    const Trk::TrackStateOnSurface* newTsos= new Trk::TrackStateOnSurface( newMeas, newPars, newFitQoS, meb, typePattern);
-    return newTsos;
-  
-  }  
-
-  //________________________________________________________________________
-  bool UnbiasedMuonResiduals::passesChamberSelection(Trk::AlignModule::DetectorType detType,
-						     Identifier id, int flag)
-  {
-    ATH_MSG_DEBUG("in passesChamberSelection, detTYpe="<<detTypeStr(detType));
-
-    if (detType==Trk::AlignModule::CSC) {
-      ATH_MSG_DEBUG("in passesChamberSelection for CSC");
-      if ( p_idHelperTool->isCsc(id) ) {
-	ATH_MSG_DEBUG("is CSC");
-	return true; // Not a CSC
-      }
-    }
-    else if (detType==Trk::AlignModule::MDT) {
-      ATH_MSG_DEBUG("in passesChamberSelection for MDT");
-      if ( p_idHelperTool->isMdt(id) ) {
-	ATH_MSG_DEBUG("is MDT");      
-	std::string stName=p_idHelperTool->chamberNameString(id);
-	if (flag==0) {
-	  if (stName[1]=='I' || (stName.length()>4 && stName[4]=='4') ) {
-	    ATH_MSG_DEBUG("returning true (inner)");
-	    return true;
-	  }
-	}
-	else return true;
-      }
-    }
-    else if (detType==Trk::AlignModule::TGC) {
-      ATH_MSG_DEBUG("in passesChamberSelection for TGC");
-      if ( p_idHelperTool->isTgc(id) ) {
-	ATH_MSG_DEBUG("is TGC");      
-	return true;
-      }
-    }
-    else if (detType==Trk::AlignModule::RPC) {
-      ATH_MSG_DEBUG("in passesChamberSelection for RPC");
-      if ( p_idHelperTool->isRpc(id) ) {
-	ATH_MSG_DEBUG("is RPC");      
-	return true;
-      }      
-    }
-    
-    ATH_MSG_DEBUG("returning false");
-    return false;
-  }
-
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::checkCovVar(const Trk::Track& /*track*/) const
-  {
-    ATH_MSG_ERROR("migrate to Eigen");
-    return;
-
-    /*
-    if (!msgLvl(MSG::DEBUG)) return;
-
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos=track.trackStateOnSurfaces()->begin(); 
-    for (; iTsos!=track.trackStateOnSurfaces()->end(); ++iTsos) {
-      
-      if ((*iTsos)->measurementOnTrack()) 
-	ATH_MSG_DEBUG("in UnbiasedMuonResiduals, cov: "<<(*iTsos)->measurementOnTrack()->localErrorMatrix().covValue(Trk::loc1));
-      
-    }
-    return;
-    */
-  }
-
-  //________________________________________________________________________
-  int UnbiasedMuonResiduals::getMdtStatLayer(Identifier id) const 
-  {
-    
-    const std::string stName=
-      p_idHelperTool->mdtIdHelper().stationNameString(p_idHelperTool->mdtIdHelper().stationName(id));
-    
-    // station layer
-    switch ( stName[1] ) {
-    case 'I' :
-      return 0;
-    case 'M' :
-      return 1;
-    case 'O' :
-      return 2;
-    default:
-      //ATH_MSG_INFO("stName: "<<stName<<", id: "<<id);
-      return 3;
-    }    
-    return 3;
-  }
-
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::setIdentificationVariables(Trk::AlignModule::DetectorType /*detType*/, const MuonSegment& /*mSeg*/) 
-  {
-
-    ATH_MSG_ERROR("migrate to Eigen");
-    return; 
-
-    /*
-    Identifier segId = chamberId( detType,mSeg );
-    bool isSmall     = p_idHelperTool->isSmallChamber( segId );
-
-    bool isBEE_Seg=(p_idHelperTool->isMdt(segId) && p_idHelperTool->mdtIdHelper().stationNameString(p_idHelperTool->mdtIdHelper().stationName(segId)).substr(0,3)=="BEE");
-    
-    m_isEndcap       = p_idHelperTool->isEndcap( segId ) || isBEE_Seg;
-    m_identifier     = (int)segId.get_identifier32().get_compact();
-    
-    if (detType==Trk::AlignModule::MDT) {
-      m_stName = p_idHelperTool->mdtIdHelper().stationName(segId);
-      m_stEta  = p_idHelperTool->mdtIdHelper().stationEta(segId);
-      m_stPhi  = p_idHelperTool->mdtIdHelper().stationPhi(segId);
-    }
-    else if (detType==Trk::AlignModule::CSC) {
-      m_stName = p_idHelperTool->cscIdHelper().stationName(segId);
-      m_stEta  = p_idHelperTool->cscIdHelper().stationEta(segId);
-      m_stPhi  = p_idHelperTool->cscIdHelper().stationPhi(segId);	  
-    }    
-    else if (detType==Trk::AlignModule::RPC) {
-      m_stName = p_idHelperTool->rpcIdHelper().stationName(segId);
-      m_stEta  = p_idHelperTool->rpcIdHelper().stationEta(segId);
-      m_stPhi  = p_idHelperTool->rpcIdHelper().stationPhi(segId);	  
-    }    
-    else if (detType==Trk::AlignModule::TGC) {
-      m_stName = p_idHelperTool->tgcIdHelper().stationName(segId);
-      m_stEta  = p_idHelperTool->tgcIdHelper().stationEta(segId);
-      m_stPhi  = p_idHelperTool->tgcIdHelper().stationPhi(segId);	  
-    }
-    
-    // Here, modify phiSector so it matches the 1-16 map instead of 1-8:
-    m_phiSector = p_idHelperTool->stationPhi( segId );
-    if (detType!=Trk::AlignModule::TGC) {
-      if ( isSmall ) 
-	m_phiSector = 2 * m_phiSector;     // Small chambers start at 2    
-      else 
-	m_phiSector = 2 * m_phiSector - 1; // Large chambers start at 1    
-    }
-
-    const Trk::GlobalPosition& globalPos = mSeg.globalPosition();
-    m_isCSide  = globalPos.z()>0 ? 0 : 1;
-
-    ATH_MSG_DEBUG("isEC: "<<m_isEndcap<<", id: "<<m_identifier);
-    ATH_MSG_DEBUG("isCSide: "<<m_isCSide);
-
-    m_layer = (detType==Trk::AlignModule::MDT) ? getMdtStatLayer(segId) : 0;
-    if (detType==Trk::AlignModule::TGC) m_layer=p_idHelperTool->tgcIdHelper().gasGap(segId);
-
-    return;
-    */
-  }
-
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::calcResForExtrapolatedIDToDetSurface(const Analysis::Muon& /*muon*/,
-								   const Trk::TrackParameters& /*segPar*/,
-								   const Trk::PlaneSurface* /*detSurface*/,
-								   Trk::AlignModule::DetectorType /*detType*/)
-								  
-  {
-    ATH_MSG_ERROR("migrate to Eigen");
-    return;
-    
-    /*
-    m_dZlocal=m_dR=-999.;
-
-    const Trk::Track* idTrack = muon.inDetTrkTrack();
-
-    const Trk::TrackParameters* idTrackPar=0;
-    if (idTrack)
-      idTrackPar = getIDTrackExtrapolated(idTrack,detSurface);    
-    if ( !idTrackPar ) {
-      ATH_MSG_DEBUG("ID track extrapolation failed");
-      return;
-    }      
-    
-    // ID track extrapolated       
-    const Trk::PlaneSurface* segSurface=
-      dynamic_cast<const Trk::PlaneSurface*>(segPar.associatedSurface());    
-
-    const Trk::LocalPosition&  trklocalPos  = idTrackPar->localPosition();
-    const Trk::GlobalPosition* trkglobalPos = segSurface->localToGlobal( trklocalPos );
-
-    const Trk::GlobalPosition& globalPos = segPar.position();
-    const Trk::LocalPosition*  localPos = segSurface->globalToLocal(globalPos);
-    
-    // This is the precision direction in local coordinates (better for endcap)
-    m_dZlocal = trklocalPos.y() - localPos->y();  
-    
-    // Radial distance between track and segment at surface:
-    float Rtrk = sqrt( trkglobalPos->x()*trkglobalPos->x() + trkglobalPos->y()*trkglobalPos->y() );
-    float Rseg = sqrt( globalPos.x()*globalPos.x() + globalPos.y()*globalPos.y() );
-    
-    m_dR   = Rtrk - Rseg;
-    if (detType==Trk::AlignModule::CSC) {
-      //float sinTilt = 0.9796;  // to account for 11.59 degree tilt of chambers
-      //m_dR /= sinTilt; 
-      m_dR *= cos(11.59/CLHEP::degree);
-    }
-    ATH_MSG_DEBUG("dR: "<<m_dR<<", dZ: "<<m_dZlocal);
-
-    delete idTrackPar;    
-    return;
-    */
-
-  }
-  
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::calcResForSegmentAtDetSurface(const Trk::TrackParameters& /*trackPar*/,
-							    const Trk::TrackParameters& /*segPar*/,
-							    const Trk::ErrorMatrix& /*trkErrMat*/,
-							    const Trk::ErrorMatrix& /*segErrMat*/)
-  {
-
-    ATH_MSG_ERROR("migrate to Eigen");
-    return;
-
-    /*
-    ATH_MSG_DEBUG("trackparam extrapolated: "<<trackPar);
-    //ATH_MSG_DEBUG("trackparam extrapolated to surface: "<<trackPar.associatedSurface());
-    ATH_MSG_DEBUG("segment extrapolated:    "<<segPar);
-    
-    // delta phi and theta
-    m_deltaPhi  =std::fabs(trackPar.parameters()[Trk::phi]-segPar.parameters()[Trk::phi]);
-    m_deltaTheta=std::fabs(trackPar.parameters()[Trk::theta]-segPar.parameters()[Trk::theta]);
-    
-    // unbiased residuals -- locX and locY
-    double locX_Segment = segPar.parameters()[Trk::locX];
-    double locY_Segment = segPar.parameters()[Trk::locY];
-    double localTrkX    = trackPar.parameters()[Trk::locX];
-    double localTrkY    = trackPar.parameters()[Trk::locY];  
-
-    m_detTheta    = MuonAlign::RadsToDegrees(trackPar.parameters()[Trk::theta]);
-    m_detThetaErr = MuonAlign::RadsToDegrees(trkErrMat.error(Trk::theta));
-
-    // Y 'seems' to be precision coordinate
-    m_dXlocal           = localTrkX - locX_Segment;
-    m_dYlocal           = localTrkY - locY_Segment;
-    ATH_MSG_INFO("detType: "<<m_detType<<", dXlocal: "<<m_dXlocal<<", dYlocal: "<<m_dYlocal);
-
-    Trk::CovarianceMatrix trackCovMat=trkErrMat.covariance();
-    double ErrX_trk2 = trackCovMat[Trk::locX][Trk::locX];
-    double ErrY_trk2 = trackCovMat[Trk::locY][Trk::locY];
-    
-    // don't include segment error because it's small 
-    //Trk::CovarianceMatrix segCovMat=segErrMat.covariance();
-    //ATH_MSG_DEBUG("segCovMat: "<<segCovMat);
-    //double ErrX_seg2 = segCovMat[Trk::locX][Trk::locX];
-    //double ErrY_seg2 = segCovMat[Trk::locY][Trk::locY];    
-
-    double ErrX=std::sqrt(ErrX_trk2);// + ErrX_seg2);
-    double ErrY=std::sqrt(ErrY_trk2);// + ErrY_seg2);
-
-    m_pullXlocal = m_dXlocal / ErrX;
-    m_pullYlocal = m_dYlocal / ErrY;
-
-    const Trk::PlaneSurface* segSurface=
-      dynamic_cast<const Trk::PlaneSurface*>(segPar.associatedSurface());    
-
-    //HepGeom::Vector3D<double> SegmentGlobalDirection(segPar.momentum());
-    ATH_MSG_DEBUG("seg momentum: "<<segPar.momentum());
-    const Trk::LocalDirection* SegmentLocalDirection = 
-      segSurface->globalToLocalDirection(segPar.momentum());
-    double locAX_Segment = SegmentLocalDirection->angleXZ();
-    double locAY_Segment = SegmentLocalDirection->angleYZ();  
-    
-    // global positions
-    const Trk::PlaneSurface*   segPlane=dynamic_cast<const Trk::PlaneSurface*>(segSurface);
-    Trk::LocalPosition         segLoc(locX_Segment,locY_Segment);
-    const Trk::GlobalPosition* segGlob=segPlane->localToGlobal(segLoc);
-    
-    Trk::LocalPosition trkLoc(localTrkX,localTrkY);
-    const Trk::GlobalPosition* trkGlob=segPlane->localToGlobal(trkLoc);
-    
-    m_dXglobal=trkGlob->x()-segGlob->x();
-    m_dYglobal=trkGlob->y()-segGlob->y();
-    m_dZglobal=trkGlob->z()-segGlob->z();
-    ATH_MSG_DEBUG("dXglobal: "<<m_dXglobal<<", dYglobal: "<<m_dYglobal
-		  <<", dZglobal: "<<m_dZglobal);
-    
-    delete segGlob;
-    delete trkGlob;
-    
-    // Track direction ( angles )
-    HepGeom::Vector3D<double> TrkGlobalDirection( trackPar.momentum() );
-    const Trk::LocalDirection* pTrackLocalDirection = 
-      dynamic_cast<const Trk::PlaneSurface*>(segSurface)->globalToLocalDirection( TrkGlobalDirection );
-    double locAX_trk  = pTrackLocalDirection->angleXZ() ;
-    double locAY_trk  = pTrackLocalDirection->angleYZ() ;    
-    double pullXAngle = MuonAlign::FixRad(locAX_trk - locAX_Segment);	
-    double pullYAngle = MuonAlign::FixRad(locAY_trk - locAY_Segment);
-    m_dXlocalAngle    = pullXAngle*1000.;  // to mrad !!!
-    m_dYlocalAngle    = pullYAngle*1000.;      
-    ATH_MSG_DEBUG("dXlocalAngle: "<<m_dXlocalAngle<<", dYlocalAngle: "<<m_dYlocalAngle);
-
-    m_pullXlocalAngle=pullXAngle;
-    m_pullYlocalAngle=pullYAngle;
-
-    delete pTrackLocalDirection;
-    
-    return;
-    */
-  }
-
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::removeExtraSegments(Trk::AlignModule::DetectorType /* detType*/,
-						  std::list<Muon::MuonSegment*>& /*muonSegments*/) const
-  {
-
-    ATH_MSG_ERROR("migrate to Eigen");
-    return;
-
-    /*
-    ATH_MSG_DEBUG("removeExtraSegments, initial segments size: "<<muonSegments.size());
-
-    std::list<Muon::MuonSegment*>::const_iterator segIt   =muonSegments.begin();
-    std::list<Muon::MuonSegment*>::const_iterator segItEnd=muonSegments.end();
-
-    // get list of chamber IDs
-    std::list<Identifier> chIds;
-    for ( ; segIt != segItEnd; ++segIt) {
-      std::set<Identifier> segIds=chamberIds(detType,**segIt);
-      for (std::set<Identifier>::iterator idIt=segIds.begin();
-	   idIt!=segIds.end();++idIt) {
-	std::list<Identifier>::iterator result=find(chIds.begin(),chIds.end(),*idIt);
-	if (result==chIds.end()) {
-	  chIds.push_back(*idIt);
-	  ATH_MSG_VERBOSE("adding "<<*idIt<<" to chamberIds");
-	}
-      }
-    }
-    
-    // iterator over chamber IDs and find best segment
-    std::list<Muon::MuonSegment*> bestSegments;
-    std::list<Identifier>::iterator idIt=chIds.begin();
-    std::list<Identifier>::iterator idItEnd=chIds.end();
-    for (; idIt != idItEnd; ++idIt) {
-      Identifier id=*idIt;
-      ATH_MSG_VERBOSE("getting best seg for id "<<id);
-      
-      double bestChi2=99999.;
-      Muon::MuonSegment* bestSeg=0;
-      for (segIt=muonSegments.begin();segIt!=segItEnd;++segIt) {
-	double chi2perdof=(**segIt).fitQuality()->chiSquared()/(**segIt).fitQuality()->doubleNumberDoF();
-	if (id==chamberId(detType,**segIt) &&
-	    chi2perdof<bestChi2) {
-	  ATH_MSG_VERBOSE("new best chi2 for ID: "<<chamberId(detType,**segIt)
-			  <<", seg chi2/dof: "<<chi2perdof);
-	  bestChi2=chi2perdof;
-	  bestSeg =*segIt;
-	}
-      }
-      if (bestSeg) {
-	bestSegments.push_back(bestSeg);
-	ATH_MSG_DEBUG("best ID: "<<chamberId(detType,*bestSeg)
-		      <<", seg chi2/dof: "<<bestChi2);
-      }
-      else ATH_MSG_VERBOSE("no segment found");
-    }
-    muonSegments=bestSegments;
-    ATH_MSG_DEBUG("final segments size: "<<muonSegments.size());
-    
-    return;
-    */
-  }
-
-  //________________________________________________________________________
-  Trk::Track* UnbiasedMuonResiduals::correctErrors(const Trk::Track& track)
-  {
-    const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces();
-    if ( !states ) return 0;
-    
-    // loop over TSOSs, find MDT hits, and mark them as outliers:
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit = states->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end = states->end();
-    
-        
-    DataVector<const Trk::TrackStateOnSurface>* newTrackStatesOnSurface =
-      new DataVector<const Trk::TrackStateOnSurface>;
-
-    for ( ; tsit!=tsit_end ; ++tsit ) {
-
-      const Trk::MeasurementBase*      mesb = (**tsit).measurementOnTrack();
-      const Trk::TrackParameters*      tpar = (**tsit).trackParameters();
-      const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-
-      Identifier id(0);
-      if      (rio)  id=rio->identify();
-      else if (crio) id=crio->rioOnTrack(0).identify();
-
-      // check if muon hit with track parameters
-      if (mesb && tpar && (rio || crio) && p_idHelperTool->isMuon(id) ) {
-	
-	// MDT or CSC RIO_OnTrack
-	if (rio) {
-	  
-	  // get updated RIO
-	  const Trk::RIO_OnTrack* updatedRIO=0;
-	  if (p_idHelperTool->isMdt(id)) 
-	    updatedRIO=m_mdtRotCreator->correct(*rio->prepRawData(),*tpar);
-	  else if (p_idHelperTool->isCsc(id))
-	    updatedRIO=m_cscRotCreator->correct(*rio->prepRawData(),*tpar);
-	  
-	  if (updatedRIO) {
-	    std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type;
-	    type.set(Trk::TrackStateOnSurface::Measurement);
-	    if ((**tsit).type(Trk::TrackStateOnSurface::Outlier))
-	      type.set(Trk::TrackStateOnSurface::Outlier);
-	    const Trk::FitQualityOnSurface* fqos=(**tsit).fitQualityOnSurface() ? 
-	      new Trk::FitQualityOnSurface(*(**tsit).fitQualityOnSurface()) : 0;
-	    const Trk::MaterialEffectsBase* meb=(**tsit).materialEffectsOnTrack() ?
-	      (**tsit).materialEffectsOnTrack()->clone() : 0;
-	    
-	    const Trk::TrackStateOnSurface* newTsos=
-	      new Trk::TrackStateOnSurface(updatedRIO,tpar->clone(),fqos,meb,type);
-	    newTrackStatesOnSurface->push_back(newTsos);
-	  }
-	} // rio
-	
-	// RPC or TGC CompetingRIOsOnTrack
-	else if (crio) {
-	  
-	  const Trk::FitQualityOnSurface* fqos=(**tsit).fitQualityOnSurface() ? 
-	    new Trk::FitQualityOnSurface(*(**tsit).fitQualityOnSurface()) : 0;
-	  const Trk::MaterialEffectsBase* meb=(**tsit).materialEffectsOnTrack() ?
-	    (**tsit).materialEffectsOnTrack()->clone() : 0;
-	  const Trk::MeasurementBase* newMeas = mesb->clone();
-	  const Trk::TrackStateOnSurface* newTsos = new Trk::TrackStateOnSurface(newMeas, tpar->clone(),fqos,meb,(**tsit).types());
-	  newTrackStatesOnSurface->push_back(newTsos);
-	} // crio
-      } // good muon hit
-      else {
-	const Trk::TrackStateOnSurface* newTsos=(**tsit).clone();
-	newTrackStatesOnSurface->push_back(newTsos);
-      }
-    }
-        
-    return  new Trk::Track(Trk::TrackInfo(track.info()),
-			   newTrackStatesOnSurface,
-			   track.fitQuality()->clone());
-  }
-
-  //________________________________________________________________________
-  std::set<Identifier> UnbiasedMuonResiduals::chamberIds(Trk::AlignModule::DetectorType detType,
-							 const MuonSegment& seg) const
-  {
-    ATH_MSG_DEBUG("getting chamberIds for detType: "<<detType);
-    std::set<Identifier> chIds;
-    if (detType==Trk::AlignModule::MDT || detType==Trk::AlignModule::CSC) 
-      chIds=p_muonEDMHelperTool->chamberIds(seg);
-    else {
-      Identifier chid;
-      std::vector<const Trk::MeasurementBase*>::const_iterator mit = seg.containedMeasurements().begin();
-      std::vector<const Trk::MeasurementBase*>::const_iterator mit_end = seg.containedMeasurements().end();
-      for( ;mit!=mit_end;++mit ) {
-	
-	// get Identifier
-	Identifier id;
-	const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*>(*mit);
-	if (rio)  id=rio->identify();
-	else {
-	  const Trk::CompetingRIOsOnTrack* crio=dynamic_cast<const Trk::CompetingRIOsOnTrack*>(*mit);
-	  if (crio) id=crio->rioOnTrack(0).identify();
-	  else continue;
-	}
-	
-	// check if valid ID
-	if( !id.is_valid() ) continue;
-
-	// check if muon
-	if (!p_idHelperTool->isMuon(id)) continue;
-
-	// create chamber ID
-	chid = p_idHelperTool->chamberId(id);
-	
-	// check if valid trigger ID
-	if( p_idHelperTool->isTrigger(id) && chid.is_valid() ) {
-	  chIds.insert(chid);
-	}
-      }
-    }
-    ATH_MSG_DEBUG("found "<<chIds.size()<<" chamberIds");
-    return chIds;
-  }  
-  
-  //________________________________________________________________________
-  Identifier UnbiasedMuonResiduals::chamberId(Trk::AlignModule::DetectorType detType,
-					      const MuonSegment& seg) const
-  {
-    ATH_MSG_DEBUG("getting chamberId for detType: "<<detType);
-    Identifier id;
-    if (detType==Trk::AlignModule::MDT || detType==Trk::AlignModule::CSC) 
-      id=p_muonEDMHelperTool->chamberId(seg);
-    else 
-      id=triggerChamberId(seg);
-    ATH_MSG_DEBUG("id: "<<id);
-    if (!id.is_valid() || !p_idHelperTool->isMuon(id)) return Identifier();
-    return id;
-  }
-
-  //________________________________________________________________________
-  Identifier UnbiasedMuonResiduals::triggerChamberId(const MuonSegment& seg) const
-  {
-    Identifier chid;
-    std::vector<const Trk::MeasurementBase*>::const_iterator mit = seg.containedMeasurements().begin();
-    std::vector<const Trk::MeasurementBase*>::const_iterator mit_end = seg.containedMeasurements().end();
-    for ( ;mit!=mit_end;++mit ){
-      
-      // get Identifier
-      Identifier id;
-      const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*>(*mit);
-      if (rio)  id=rio->identify();
-      else {
-	const Trk::CompetingRIOsOnTrack* crio=dynamic_cast<const Trk::CompetingRIOsOnTrack*>(*mit);
-	if (crio) id=crio->rioOnTrack(0).identify();
-	else continue;
-      }
-
-      if ( !id.is_valid() ) continue;
-      
-      // create chamber ID
-      chid = p_idHelperTool->chamberId(id);
-      
-      // stop at first trigger hit
-      if ( p_idHelperTool->isTrigger(id) ) break;
-
-      // check if valid
-      if (!id.is_valid()) break;
-    }
-    return chid;
-  }
-	
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::printPerigee(const Trk::Track& track)
-  {
-    const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces();
-    if ( !states ) return;
-    
-    // loop over TSOSs, find MDT hits, and mark them as outliers:
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit = states->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end = states->end();
-    
-    for ( ; tsit!=tsit_end ; ++tsit ) {
-      
-      if ((**tsit).type(Trk::TrackStateOnSurface::Perigee))
-	ATH_MSG_DEBUG("in printPerigee, have perigee: "<<**tsit);   
-    }
-    return;
-  }
-
-  //________________________________________________________________________
-  const Trk::Track* UnbiasedMuonResiduals::findBestTrack(Trk::AlignModule::DetectorType detType,
-							 const TrackCollection* tracks, 
-							 const TrackCollection* inDetTracks,
-							 Muon::MuonSegment* mSeg=0)
-  {
-    
-    // this method returns the track which has the same hits as the segment if mSeg!=0.  
-    // otherwise, it returns the first track in the collection
-
-    ATH_MSG_DEBUG("in findBestTrack");
-
-    TrackCollection::const_iterator trackIt  = tracks->begin();
-    TrackCollection::const_iterator trackItE = tracks->end();
-    
-    const Trk::Track* bestTrack(0);
-    int bestNMatches(-1);
-    
-    // Loop over muon collection
-    int itrack(0);
-    std::vector<const Trk::Track*> tracksToDelete;
-    for ( ; trackIt!=trackItE; ++trackIt,itrack++ ) {
-      
-      if (trackIt == trackItE || !*trackIt) continue;
-      
-      const Trk::Track* track=*trackIt;
-
-      ATH_MSG_DEBUG("in findBestTrack: track "<<itrack<<"/"<<tracks->size());      
-      ATH_MSG_DEBUG(m_printer->print(*track)<<endmsg<<
-		    m_printer->printStations(*track)<<endmsg<<
-		    m_printer->printMeasurements(*track));
-      
-      //double muonEta=track->perigeeParameters()->eta();
-      //double muonPhi=track->perigeeParameters()->parameters()[Trk::phi];
-      
-      // ATH_MSG_DEBUG("inDetTracks: "<<inDetTracks);
-      ATH_MSG_DEBUG("m_trackFittingType: "<<m_trackFittingType);
-      
-      if (inDetTracks && m_trackFittingType == MSStandaloneWithIDTrackMatch) {
-	
-	// loop over ID tracks and see if there is a good match
-        TrackCollection::const_iterator inDetTrackIt  = inDetTracks->begin();
-        TrackCollection::const_iterator inDetTrackItE = inDetTracks->end();  
-        const Trk::Track* bestIDTrack = 0;	
-	double bestMatchChi2 = m_matchChi2Cut;
-        int iIdTrack=0;
-        for ( ; inDetTrackIt!=inDetTrackItE; ++inDetTrackIt,iIdTrack++ ) {
-
-	  const Trk::Track* inDetTrack = *inDetTrackIt;
-	  
-	  // check momentum
-	  if (!inDetTrack->perigeeParameters()) continue;
-	  
-	  double matchChi2 = m_tagTool->chi2(*inDetTrack,*track);
-	  if (matchChi2<bestMatchChi2) {
-	    bestMatchChi2=matchChi2;
-	    bestIDTrack=inDetTrack;
-	  } 	  
-	}
-	
-	if (bestIDTrack) {
-	  m_charge        = (*(bestIDTrack->trackParameters()->begin()))->charge();
-	  double pT       = bestIDTrack->perigeeParameters()->pT();
-	  double inDetEta = bestIDTrack->perigeeParameters()->eta();
-	  m_momentum      = std::fabs(pT)*std::sqrt(1.+sinh(inDetEta)*sinh(inDetEta))/1000.;
-	  if (m_momentum<m_MinMuonMom) continue;	  
-
-	  ATH_MSG_DEBUG("charge: "<<m_charge<<", momentum: "<<m_momentum);
-	  
-	  m_d0       = bestIDTrack->perigeeParameters()->parameters()[Trk::d0];
-	  m_z0       = bestIDTrack->perigeeParameters()->parameters()[Trk::z0];
-	  m_phi0     = MuonAlign::RadsToDegrees(bestIDTrack->perigeeParameters()->parameters()[Trk::phi0]);
-	  m_theta0   = MuonAlign::RadsToDegrees(bestIDTrack->perigeeParameters()->parameters()[Trk::theta]);
-	  m_eta0     = bestIDTrack->perigeeParameters()->eta();
-	}
-	else {
-	  ATH_MSG_DEBUG("no good ID track, continuing");
-	  continue;
-	}
-      }
-
-      if (mSeg) {
-
-	// get a list of ID for muon hits on track
-	std::list<Identifier> trackIds;
-	getTrackIds(*track,trackIds);
-
-	Identifier mSegId=chamberId(detType,*mSeg);
-	if (find(trackIds.begin(),trackIds.end(),mSegId)==trackIds.end()) continue;
-	
-	Muon::MuonSegmentKey segKeys(*mSeg);
-
-	// Collect hits from track
-	ATH_MSG_DEBUG("getting hits from track");
-	std::vector<const Trk::MeasurementBase*> measurements;	
-	
-	DataVector<const Trk::TrackStateOnSurface>::const_iterator it  = track->trackStateOnSurfaces()->begin();
-	DataVector<const Trk::TrackStateOnSurface>::const_iterator it_end = track->trackStateOnSurfaces()->end();
-	for ( ; it!=it_end; ++it) {
-	  if ( (*it) != 0 ){
-	    const Trk::MeasurementBase* rotTest = (*it)->measurementOnTrack();  
-	    if (rotTest) measurements.push_back(rotTest);
-	  }
-	}
-	ATH_MSG_DEBUG("have "<<measurements.size()<<" measurements");
-	
-	Muon::MuonSegmentKey trkKeys(measurements);
-	
-	std::vector< std::pair<unsigned int,int> > intersection;
-	std::set_intersection(segKeys.keys().begin(),segKeys.keys().end(),
-			      trkKeys.keys().begin(),trkKeys.keys().end(),
-			      std::back_inserter(intersection));
-	int intersectionSize = intersection.size();
-	int segmentSize = segKeys.keys().size();
-	
-	// if subset, we're done
-	if (segmentSize == intersectionSize) {
-	  ATH_MSG_DEBUG("perfect match, returning track");
-	  bestTrack=track;
-	  break;
-	}
-	
-	else if (intersectionSize>bestNMatches) {
-	  bestNMatches=intersectionSize;
-	  ATH_MSG_DEBUG("bestNMatches: "<<bestNMatches);
-	  bestTrack=track;
-	}
-      }
-      else 
-	bestTrack=track;
-    }
-    return bestTrack;        
-  }
-
-  //________________________________________________________________________
-  void UnbiasedMuonResiduals::getTrackIds(const Trk::Track& track, 
-					  std::list<Identifier>& trackIds) const
-  {
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator it  = track.trackStateOnSurfaces()->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator it_end = track.trackStateOnSurfaces()->end();
-    for ( ; it!=it_end; ++it) {
-      const Trk::MeasurementBase*      mesb = (*it)->measurementOnTrack();	
-      const Trk::RIO_OnTrack*          rio  = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(mesb);
-      if (!rio && crio) rio=&crio->rioOnTrack(0);
-      if (!rio) continue;
-      
-      Identifier id=rio->identify();
-      if (find(trackIds.begin(),trackIds.end(),id)==trackIds.end()) 
-	trackIds.push_back(id);      
-    }
-    return;
-  }
-  
-} // end namespace
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/components/MuonAlignGenTools_entries.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/components/MuonAlignGenTools_entries.cxx
deleted file mode 100644
index abaf25cb548..00000000000
--- a/MuonSpectrometer/MuonAlignment/MuonAlignGenTools/src/components/MuonAlignGenTools_entries.cxx
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "MuonAlignGenTools/CommonGeometryManagerTool.h"
-#include "MuonAlignGenTools/MuonGeometryManagerTool.h"
-#include "MuonAlignGenTools/MdtGeometryManagerTool.h"
-#include "MuonAlignGenTools/CscGeometryManagerTool.h"
-#include "MuonAlignGenTools/TgcGeometryManagerTool.h"
-#include "MuonAlignGenTools/MuonFillNtupleTool.h"
-#include "MuonAlignGenTools/MdtAlignDBTool.h"
-#include "MuonAlignGenTools/CscAlignDBTool.h"
-#include "MuonAlignGenTools/MuonAlignModuleTool.h"
-#include "MuonAlignGenTools/MuonTrackPreProcessor.h"
-#include "MuonAlignGenTools/MuonTrackCollectionProvider.h"
-#include "MuonAlignGenTools/MuonAlignHelperTool.h"
-#include "MuonAlignGenTools/MuonAlignRefitTool.h"
-
-DECLARE_COMPONENT( Muon::MuonAlignModuleTool )
-DECLARE_COMPONENT( Muon::CommonGeometryManagerTool )
-DECLARE_COMPONENT( Muon::MuonGeometryManagerTool )
-DECLARE_COMPONENT( Muon::MdtGeometryManagerTool )
-DECLARE_COMPONENT( Muon::CscGeometryManagerTool )
-DECLARE_COMPONENT( Muon::TgcGeometryManagerTool )
-DECLARE_COMPONENT( Muon::MuonFillNtupleTool )
-DECLARE_COMPONENT( Muon::MuonAlignDBTool )
-DECLARE_COMPONENT( Muon::MdtAlignDBTool )
-DECLARE_COMPONENT( Muon::CscAlignDBTool )
-DECLARE_COMPONENT( Muon::MuonAlignHelperTool )
-DECLARE_COMPONENT( Muon::MuonAlignRefitTool )
-DECLARE_COMPONENT( Muon::MuonTrackPreProcessor )
-DECLARE_COMPONENT( Muon::MuonTrackCollectionProvider )
-//DECLARE_COMPONENT( Muon::UnbiasedResidualTool )
-//DECLARE_COMPONENT( Muon::UnbiasedMuonResiduals )
-
diff --git a/MuonSpectrometer/MuonCalib/MuonCalibEvent/MuonCalibEvent/MdtCalibHit.h b/MuonSpectrometer/MuonCalib/MuonCalibEvent/MuonCalibEvent/MdtCalibHit.h
index 73c12215578..543cd9f04b1 100644
--- a/MuonSpectrometer/MuonCalib/MuonCalibEvent/MuonCalibEvent/MdtCalibHit.h
+++ b/MuonSpectrometer/MuonCalib/MuonCalibEvent/MuonCalibEvent/MdtCalibHit.h
@@ -134,7 +134,7 @@ public:
   float sigmaXtwin() const;                          //!< retrieve twin position error
   float sigma2Xtwin() const;                         //!< retrieve twin position variance
     
-  MuonCalib::MdtCalibHitBase* hitBase(MuonCalib::IIdToFixedIdTool*) const;  //!< return a pointer to the MdtCalibHit object to be used in the calibration framework 
+  MuonCalib::MdtCalibHitBase* hitBase(const MuonCalib::IIdToFixedIdTool&) const;  //!< return a pointer to the MdtCalibHit object to be used in the calibration framework 
   
   std::ostream& dump(std::ostream &stream) const;    //!< ostream operator
   MsgStream& dump(MsgStream &sl) const;              //!< MsgStream operator
diff --git a/MuonSpectrometer/MuonCalib/MuonCalibEvent/src/MdtCalibHit.cxx b/MuonSpectrometer/MuonCalib/MuonCalibEvent/src/MdtCalibHit.cxx
index 545a5020741..97a979ecc92 100644
--- a/MuonSpectrometer/MuonCalib/MuonCalibEvent/src/MdtCalibHit.cxx
+++ b/MuonSpectrometer/MuonCalib/MuonCalibEvent/src/MdtCalibHit.cxx
@@ -26,10 +26,10 @@ const float MdtCalibHit::kNoValue = FLT_MAX;
 // MdtCalibHit::hitBase copies data from a MdtCalibHit instance to a MdtCalibHitBase
 // MdtCalibHit and MdtCalibHitBase are nearly identical except that 
 // MdtCalibHit uses an Athena identifier and MdtCalibHitBase uses Muonfixedid
-MuonCalib::MdtCalibHitBase* MdtCalibHit::hitBase(MuonCalib::IIdToFixedIdTool *pIdToFixed) const {
+MuonCalib::MdtCalibHitBase* MdtCalibHit::hitBase(const MuonCalib::IIdToFixedIdTool& rIdToFixed) const {
   MuonCalib::MdtCalibHitBase *hb = new MuonCalib::MdtCalibHitBase(); 
 
-  hb->setIdentifier(pIdToFixed->idToFixedId(m_id));
+  hb->setIdentifier(rIdToFixed.idToFixedId(m_id));
   hb->setTdc(m_tdc);
   hb->setAdc(m_adc);
   hb->setGlobalPos(m_globalPosition);
diff --git a/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx b/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx
index f92634e1dbb..085871bd0d8 100644
--- a/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx
+++ b/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx
@@ -825,7 +825,7 @@ namespace MuonCalib {
           if (sqrt(error2) < 1.999 ) ATH_MSG_DEBUG( " ALARM TOO SMALL drift error "  );
           if (chi2c > qualityFactor)   ATH_MSG_DEBUG( " ALARM TOO LARGE chi2 single hit "  );
         }  
-	MdtCalibHitBase* basehit = calibHit.hitBase(&*m_idToFixedIdTool);
+	MdtCalibHitBase* basehit = calibHit.hitBase(*m_idToFixedIdTool);
 	basehit->setSegmentT0Applied(apply_t0);
 	mdtSeg->addHitOnTrack(basehit);
 
diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx
index ce65fa6d3c3..e85f0980ba3 100644
--- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx
@@ -139,7 +139,7 @@ StatusCode MuonRdoToMuonDigitTool::initialize() {
 
   try{
     m_mdtContainer = new MdtDigitContainer(m_mdtHelper->module_hash_max());
-  } catch(std::bad_alloc){
+  } catch(const std::bad_alloc&){
     ATH_MSG_FATAL( "Could not create a new MdtDigitContainer!" );
     return StatusCode::FAILURE;
   }
@@ -147,7 +147,7 @@ StatusCode MuonRdoToMuonDigitTool::initialize() {
 
   try{
     m_cscContainer = new CscDigitContainer(m_cscHelper->module_hash_max());
-  } catch(std::bad_alloc){
+  } catch(const std::bad_alloc&){
     ATH_MSG_FATAL( "Could not create a new CscDigitContainer!" );
     return StatusCode::FAILURE;
   }
@@ -155,7 +155,7 @@ StatusCode MuonRdoToMuonDigitTool::initialize() {
 
   try{
     m_rpcContainer = new RpcDigitContainer(m_rpcHelper->module_hash_max());
-  } catch(std::bad_alloc){
+  } catch(const std::bad_alloc&){
     ATH_MSG_FATAL( "Could not create a new RpcDigitContainer!" );
     return StatusCode::FAILURE;
   }
@@ -163,7 +163,7 @@ StatusCode MuonRdoToMuonDigitTool::initialize() {
 
   try{
     m_tgcContainer = new TgcDigitContainer(m_tgcHelper->module_hash_max());
-  } catch(std::bad_alloc){
+  } catch(const std::bad_alloc&){
     ATH_MSG_FATAL( "Could not create a new TgcDigitContainer!" );
     return StatusCode::FAILURE;
   }
diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.cxx
index f9c75fdbe55..eeb7ab3af32 100644
--- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.cxx
@@ -40,8 +40,6 @@ Muon::CSC_RawDataProviderTool::CSC_RawDataProviderTool(const std::string& t,
 {
   declareInterface<IMuonRawDataProviderTool>(this);
   declareProperty("Decoder",     m_decoder);
-  declareProperty("RdoLocation", m_containerKey);
- 
 }
 
 //================ Destructor =================================================
@@ -231,12 +229,13 @@ StatusCode Muon::CSC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs
     return StatusCode::SUCCESS;
   }
 
-  if (m_containerKey.isPresent())
+  SG::WriteHandle<CscRawDataContainer> handle(m_containerKey);
+  if (handle.isPresent())
     return StatusCode::SUCCESS;
-  ATH_CHECK( m_containerKey.record(std::unique_ptr<CscRawDataContainer>( 
+  ATH_CHECK( handle.record(std::unique_ptr<CscRawDataContainer>( 
            new CscRawDataContainer(m_muonMgr->cscIdHelper()->module_hash_max())) ));
   
-  CscRawDataContainer* container = m_containerKey.ptr();
+  CscRawDataContainer* container = handle.ptr();
 
 
   m_activeStore->setStore( &*evtStore() );   
diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.h
index 61787eabf91..1b40f021050 100644
--- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.h
+++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.h
@@ -58,7 +58,8 @@ private:
 
   const MuonGM::MuonDetectorManager*  m_muonMgr;
 
-  SG::WriteHandle<CscRawDataContainer> m_containerKey;
+  SG::WriteHandleKey<CscRawDataContainer> m_containerKey{
+     this, "RdoLocation", "CSCRDO", "Name of the CSCRDO produced by RawDataProvider"};
   std::set<uint32_t>                  m_robIdSet;
   CSC_Hid2RESrcID                     m_hid2re;
 
diff --git a/MuonSpectrometer/MuonCnv/MuonContainerManager/src/MuonRdoContainerManager.cxx b/MuonSpectrometer/MuonCnv/MuonContainerManager/src/MuonRdoContainerManager.cxx
index 9e50e3cc049..dedaaa6f48e 100644
--- a/MuonSpectrometer/MuonCnv/MuonContainerManager/src/MuonRdoContainerManager.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonContainerManager/src/MuonRdoContainerManager.cxx
@@ -120,7 +120,7 @@ Muon::MuonRdoContainerManager::handle(const Incident& incident)
 	    
 	    try{
 	        sec = new RpcSectorLogicContainer();
-            } catch(std::bad_alloc) {
+            } catch(const std::bad_alloc&) {
 	        sec = 0;
 	    }
 	    
diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtHptdcReadOut.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtHptdcReadOut.cxx
index 2ad6889740c..9fbe7effafd 100755
--- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtHptdcReadOut.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtHptdcReadOut.cxx
@@ -26,7 +26,7 @@ void MdtHptdcReadOut::decodeWord(uint32_t dataWord)
   setZero();
   m_dataWord = dataWord;
   m_word = dataWord;
-  m_wordHeader = (dataWord>>headerPos)&headerBits;
+  m_wordHeader = (dataWord>>HEADERPOS)&HEADERBITS;
 
   if (is_TSM())         // TDC single measurement
     {
@@ -84,14 +84,14 @@ void MdtHptdcReadOut::setZero()
 uint32_t MdtHptdcReadOut::makeBOT(uint16_t tdcId, uint16_t ecnt, uint16_t bcid)
 {
   uint16_t inputData[4];
-  uint16_t inputPos[4] = {headerPos, 24, 12, 0};
+  uint16_t inputPos[4] = {HEADERPOS, 24, 12, 0};
   uint16_t nData = 4;
 
   if (tdcId < 16) {
-    inputData[0]=BOTvalue1;
+    inputData[0]=BOTVALUE1;
   }
   else {
-    inputData[0]=BOTvalue2;
+    inputData[0]=BOTVALUE2;
     tdcId -= 16;
   }
 
@@ -105,8 +105,8 @@ uint32_t MdtHptdcReadOut::makeBOT(uint16_t tdcId, uint16_t ecnt, uint16_t bcid)
 // End of TDC
 uint32_t MdtHptdcReadOut::makeEOT(uint16_t tdcId, uint16_t ecnt, uint16_t wcnt)
 {
-  uint16_t inputData[4] = {EOTvalue,  tdcId, ecnt, wcnt};
-  uint16_t inputPos[4]  = {headerPos, 24, 12, 0};
+  uint16_t inputData[4] = {EOTVALUE,  tdcId, ecnt, wcnt};
+  uint16_t inputPos[4]  = {HEADERPOS, 24, 12, 0};
   uint16_t nData = 4;
 
   return setBits(nData,inputData,inputPos);
@@ -117,13 +117,13 @@ uint32_t MdtHptdcReadOut::makeTSM(uint16_t tdcId, uint16_t channel, bool leading
 				  uint16_t coarse, uint16_t /*fine*/)
 {
 
-  uint16_t TSMvalue = leading ? TSMvalue_lead : TSMvalue_tail;
+  uint16_t TSMvalue = leading ? TSMVALUE_LEAD : TSMVALUE_TAIL;
 
   uint16_t inputData[4] = {TSMvalue ,
 			   static_cast<uint16_t> (tdcId   & 0xf),
 			   static_cast<uint16_t> (channel & 0x1f),
 			   static_cast<uint16_t> (coarse  & 0x7ffff)};
-  uint16_t inputPos[4]  = {headerPos, 24, 19, 0};
+  uint16_t inputPos[4]  = {HEADERPOS, 24, 19, 0};
   uint16_t nData = 4;
 
   return setBits(nData,inputData,inputPos);
@@ -133,12 +133,12 @@ uint32_t MdtHptdcReadOut::makeTSM(uint16_t tdcId, uint16_t channel, bool leading
 uint32_t MdtHptdcReadOut::makeTCM(uint16_t tdcId, uint16_t channel, uint16_t width,
 		   uint16_t coarse, uint16_t /*fine*/)
 {
-  uint16_t inputData[5] = {TCMvalue,
+  uint16_t inputData[5] = {TCMVALUE,
 			   static_cast<uint16_t> (tdcId   & 0xf),
 			   static_cast<uint16_t> (channel & 0x1f),
 			   static_cast<uint16_t> (width   & 0x7f),
 			   static_cast<uint16_t> (coarse  & 0xfff) };
-  uint16_t inputPos[5]  = {headerPos, 24, 19, 12, 0};
+  uint16_t inputPos[5]  = {HEADERPOS, 24, 19, 12, 0};
   uint16_t nData = 5;
 
   return setBits(nData,inputData,inputPos);
diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtHptdcReadOut.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtHptdcReadOut.h
index 9ce70d6dbbc..f9f5bd67b45 100755
--- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtHptdcReadOut.h
+++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtHptdcReadOut.h
@@ -41,26 +41,26 @@ class MdtHptdcReadOut : public MdtReadOut {
 
   // Word header Position and values
   // The word header occupies the 4 highest bits of each TDC data word
-  static const uint16_t headerPos  = 28;
-  static const uint16_t headerBits = 0xf;
+  static const uint16_t HEADERPOS  = 28;
+  static const uint16_t HEADERBITS = 0xf;
 
   // Beginning of TDC: two possible header values
   // for channels 00-15 and 16-17 respectively
-  static const uint16_t BOTvalue1  = 0xa;
-  static const uint16_t BOTvalue2  = 0xb;
+  static const uint16_t BOTVALUE1  = 0xa;
+  static const uint16_t BOTVALUE2  = 0xb;
 
   // End of TDC
-  static const uint16_t EOTvalue   = 0xc;
+  static const uint16_t EOTVALUE   = 0xc;
 
   // TDC single measurement
-  static const uint16_t TSMvalue_lead   = 0x4;
-  static const uint16_t TSMvalue_tail   = 0x5;
+  static const uint16_t TSMVALUE_LEAD   = 0x4;
+  static const uint16_t TSMVALUE_TAIL   = 0x5;
 
   // TDC combined measurement
-  static const uint16_t TCMvalue   = 0x9;
+  static const uint16_t TCMVALUE   = 0x9;
 
   // TDC error status
-  static const uint16_t TESvalue   = 0x6;
+  static const uint16_t TESVALUE   = 0x6;
 
  public:
 
@@ -74,17 +74,17 @@ class MdtHptdcReadOut : public MdtReadOut {
 
   // Methods to identify the word type
   // Beginning of TDC
-  bool is_BOT() {return ((m_wordHeader == BOTvalue1) ||
-                         (m_wordHeader == BOTvalue2));};
+  bool is_BOT() {return ((m_wordHeader == BOTVALUE1) ||
+                         (m_wordHeader == BOTVALUE2));};
   // End of TDC
-  bool is_EOT() {return (m_wordHeader == EOTvalue);};
+  bool is_EOT() {return (m_wordHeader == EOTVALUE);};
   // TDC single measurement
-  bool is_TSM() {return ( (m_wordHeader == TSMvalue_lead) ||
-                          (m_wordHeader == TSMvalue_tail) );};
+  bool is_TSM() {return ( (m_wordHeader == TSMVALUE_LEAD) ||
+                          (m_wordHeader == TSMVALUE_TAIL) );};
   // TDC combined measurement
-  bool is_TCM() {return (m_wordHeader == TCMvalue);};
+  bool is_TCM() {return (m_wordHeader == TCMVALUE);};
   // TDC error status
-  bool is_TES() {return (m_wordHeader == TESvalue);};
+  bool is_TES() {return (m_wordHeader == TESVALUE);};
 
   // Methods to retrieve the decoded word content
   uint16_t tdcId() {return m_tdcId;}
diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/IMuonIdCutTool.h b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/IMuonIdCutTool.h
index 1e2d14801b4..56bd45a6ec7 100644
--- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/IMuonIdCutTool.h
+++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/IMuonIdCutTool.h
@@ -25,8 +25,8 @@ class IMuonIdCutTool : virtual public IAlgTool
   /** access to tool interface */
   static const InterfaceID& interfaceID();
 
-  virtual bool isCut(Identifier ID)=0;
-  virtual bool isCut(MuonCalib::MuonFixedId id)=0;
+  virtual bool isCut(Identifier ID) const = 0;
+  virtual bool isCut(MuonCalib::MuonFixedId id) const = 0;
   
   
 };
diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h
index 9024131fc2a..c6dd86ff8b2 100644
--- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h
+++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h
@@ -53,8 +53,8 @@ class MuonIdCutTool :  virtual public IMuonIdCutTool, public AthAlgTool   {
     /** finialize method, method taken from bass-class AlgTool */
     StatusCode finalize();
     
-    virtual bool isCut(Identifier ID);
-    virtual bool isCut(MuonCalib::MuonFixedId id);
+    virtual bool isCut(Identifier ID) const;
+    virtual bool isCut(MuonCalib::MuonFixedId id) const;
     
     bool m_cutStationRegion;
     bool m_cutStationName;
@@ -93,7 +93,7 @@ class MuonIdCutTool :  virtual public IMuonIdCutTool, public AthAlgTool   {
 
   private:
  
-    int FindSector(unsigned int staName, unsigned int staPhi);
+    int FindSector(unsigned int staName, unsigned int staPhi) const;
 
 
 
diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx
index d97b8255fa2..16db7f6cfa2 100644
--- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx
@@ -140,7 +140,7 @@ StatusCode MuonIdCutTool::finalize()
 
 
 
-bool MuonIdCutTool::isCut(Identifier ID) { //false indicates all cuts are passed
+bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are passed
   
   //some checks to see if the tool is configured in a state that makes sense 
   if (m_cutStationName && m_cutStationRegion){
@@ -419,7 +419,7 @@ bool MuonIdCutTool::isCut(Identifier ID) { //false indicates all cuts are passed
 
 //overloaded function to take in MuonFixedId
 
-bool MuonIdCutTool::isCut(MuonCalib::MuonFixedId mfid) {
+bool MuonIdCutTool::isCut(MuonCalib::MuonFixedId mfid) const {
 //  std::cout << "testing if IdCuts called" << std::endl;
 Identifier ID = m_idToFixedIdTool->fixedIdToId(mfid);
 bool iscut = MuonIdCutTool::isCut(ID);
@@ -427,7 +427,7 @@ return iscut;
 }
 
 //function to find phi sector (1-16) from phi station (1-8)
-int MuonIdCutTool::FindSector(unsigned int staName, unsigned int staPhi){
+int MuonIdCutTool::FindSector(unsigned int staName, unsigned int staPhi) const {
 
   int sector=-1;
   
diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx
index 95cd5ed5225..0c80bb74312 100644
--- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx
@@ -80,7 +80,7 @@ StatusCode MuonPrdSelectorAlg::initialize()
   
   try {     
     m_mdtPRDs_out = new Muon::MdtPrepDataContainer(m_mdtIdHelper->module_hash_max());
-  } catch(std::bad_alloc) {
+  } catch(const std::bad_alloc&) {
     ATH_MSG_FATAL( "Could not create a new MDT PrepRawData container!" );
     return StatusCode::FAILURE;
   }
@@ -90,7 +90,7 @@ StatusCode MuonPrdSelectorAlg::initialize()
     
     try {
       m_rpcPRDs_out = new Muon::RpcPrepDataContainer(m_rpcIdHelper->module_hash_max());
-    } catch(std::bad_alloc) {
+    } catch(const std::bad_alloc&) {
       ATH_MSG_FATAL( "Could not create a new RPC PrepRawData container!" );
       return StatusCode::FAILURE;
     }
@@ -98,7 +98,7 @@ StatusCode MuonPrdSelectorAlg::initialize()
 
     try {
       m_tgcPRDs_out = new Muon::TgcPrepDataContainer(m_tgcIdHelper->module_hash_max());
-    } catch(std::bad_alloc) {
+    } catch(const std::bad_alloc&) {
       ATH_MSG_FATAL( "Could not create a new TGC PrepRawData container!" );
       return StatusCode::FAILURE;
     }
@@ -107,7 +107,7 @@ StatusCode MuonPrdSelectorAlg::initialize()
     
     try {
       m_cscPRDs_out = new Muon::CscStripPrepDataContainer(m_cscIdHelper->module_hash_max());
-    } catch(std::bad_alloc) {
+    } catch(const std::bad_alloc&) {
       ATH_MSG_FATAL( "Could not create a new CSC PrepRawData container!" );
       return StatusCode::FAILURE;
     }
diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx
index b47a11dc9d1..1c9bfd9efd8 100644
--- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx
@@ -37,7 +37,6 @@ Muon::TGC_RawDataProviderTool::TGC_RawDataProviderTool(
 {
   declareInterface<IMuonRawDataProviderTool>(this);
   declareProperty("Decoder",     m_decoder);
-  declareProperty("RdoLocation", m_rdoContainerKey);
 }
 
 //================ Destructor =================================================
@@ -146,38 +145,25 @@ StatusCode Muon::TGC_RawDataProviderTool::initialize()
     
   // register the container only when the imput from ByteStream is set up     
   m_activeStore->setStore( &*evtStore() );
-  if(has_bytestream || m_rdoContainerKey != "TGCRDO") {   
-    TgcRdoContainer* m_container = Muon::MuonRdoContainerAccess::retrieveTgcRdo(m_rdoContainerKey);
-
-    // create and register the container only once
-    if(m_container==0) {
-      try {
-	m_container = 
-	  new TgcRdoContainer(m_muonMgr->tgcIdHelper()->module_hash_max());
-      } catch(std::bad_alloc) {
-	ATH_MSG_FATAL( "Could not create a new TGC RDO container!" );
-	return StatusCode::FAILURE;
-      }
-	
-      // record the container for being used by the convert method
-
-      sc = Muon::MuonRdoContainerAccess::record(m_container,
-						m_rdoContainerKey,
-						serviceLocator(),
-						msg(),
-						&*evtStore());
-      if(sc.isFailure()) {
-	ATH_MSG_FATAL( "Recording of container " 
-		       << m_rdoContainerKey
-		       << " into MuonRdoContainerManager has failed" );
-	return StatusCode::FAILURE;
+  m_useContainer = (has_bytestream || m_rdoContainerKey.key() != "TGCRDO") && !m_rdoContainerKey.key().empty();
+
+  if (!m_useContainer) {
+    ATH_MSG_DEBUG( "TGC RDO container not registered." );
+    if (!has_bytestream){
+      ATH_MSG_DEBUG( "ByteStream conversion service not found." );
+    } 
+    if (m_rdoContainerKey.key().empty()){
+      ATH_MSG_DEBUG( "The RDO key is empty." );
+    } else {
+      if (m_rdoContainerKey.key() != "TGCRDO"){
+        ATH_MSG_DEBUG( "The RDO key isn't TGCRDO but " << m_rdoContainerKey.key() );
       }
     }
   } else {
-    ATH_MSG_DEBUG( "ByteStream conversion service not found." );
-    ATH_MSG_DEBUG( "TGC RDO container not registered." );
+    m_maxhashtoUse = m_muonMgr->tgcIdHelper()->module_hash_max();
   }
-  
+
+  ATH_CHECK(m_rdoContainerKey.initialize());
   
   //try to configure the cabling service
   sc = getCabling();
@@ -205,9 +191,8 @@ StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs
   // if the MuonByteStream CNV has to be used, the container must have been
   // registered there!
   m_activeStore->setStore( &*evtStore() );
-  TgcRdoContainer* TGC = Muon::MuonRdoContainerAccess::retrieveTgcRdo(m_rdoContainerKey);
       
-  if(TGC==0) {
+  if (m_useContainer==false) {
     ATH_MSG_DEBUG( "Container " << m_rdoContainerKey 
 		   << " for bytestream conversion not available." );
     ATH_MSG_DEBUG( "Try retrieving it from the Store" );
@@ -217,13 +202,19 @@ StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs
     // have been called .... but this depends
     // on the user experience
   }
-  
+
+  SG::WriteHandle<TgcRdoContainer> handle(m_rdoContainerKey); 
+  if (handle.isPresent()) {
+    return StatusCode::SUCCESS;
+  }
+  auto tgc = std::make_unique<TgcRdoContainer>(m_maxhashtoUse);
+ 
   static int DecodeErrCount = 0;
 
   ROBFragmentList::const_iterator itFrag   = vecRobs.begin();
   ROBFragmentList::const_iterator itFrag_e = vecRobs.end();
   for(; itFrag!=itFrag_e; itFrag++) {
-    if(m_decoder->fillCollection(**itFrag, *TGC).isFailure()) {
+    if(m_decoder->fillCollection(**itFrag, *tgc).isFailure()) {
       if(DecodeErrCount < 100) {
 	ATH_MSG_INFO( "Problem with TGC ByteStream Decoding!" );
 	DecodeErrCount++;
@@ -234,6 +225,7 @@ StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs
     }
   }
 
+  ATH_CHECK(handle.record(std::move(tgc)));
   return StatusCode::SUCCESS;
 }
 
diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.h
index 60b7f940e13..5ae45b39186 100644
--- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.h
+++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.h
@@ -69,7 +69,10 @@ namespace Muon
        */
       //TgcRdoContainer*                    m_rdoContainer;
       /** RDO container key */
-      std::string                         m_rdoContainerKey;
+      SG::WriteHandleKey<TgcRdoContainer> m_rdoContainerKey{
+	this, "RdoLocation", "TGCRDO", "Name of the TGCRDO produced by RawDataProvider"};	//MT
+      bool 		m_useContainer;	//MT
+      unsigned int 	m_maxhashtoUse;	//MT
       /** Active Store Service */ 
       ActiveStoreSvc*                     m_activeStore;
       /** ID converter */
diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx
index 69c7b35132a..6e04e72b5ac 100644
--- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx
@@ -49,7 +49,7 @@ StatusCode Muon::TgcPrepDataReplicationTool::initialize()
   for(int ibc = 0; ibc < BC_NUM; ibc++) {
     try {
       m_tgcPrepDataContainer[ibc] = new TgcPrepDataContainer(m_tgcHelper->module_hash_max());
-    } catch(std::bad_alloc) {
+    } catch(const std::bad_alloc&) {
       ATH_MSG_FATAL("Could not create a new TGC PrepRawData container!");
       return StatusCode::FAILURE;
     }
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDD/MuonAGDD/MuonAGDDToolHelper.h b/MuonSpectrometer/MuonDetDescr/MuonAGDD/MuonAGDD/MuonAGDDToolHelper.h
index b04354cc27a..99e811797ab 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDD/MuonAGDD/MuonAGDDToolHelper.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDD/MuonAGDD/MuonAGDDToolHelper.h
@@ -34,7 +34,7 @@ public:
 	bool BuildMScomponents() const;
 	bool BuildReadoutGeometry(MuonGM::MuonDetectorManager* mgr) const;
 
-	std::string TagInfoKey() {return tagInfoKey;}
+	std::string TagInfoKey() {return m_tagInfoKey;}
 
 private:
 
@@ -43,7 +43,7 @@ private:
 	
 	
 	ITagInfoMgr* m_tagInfoMgr;
-	std::string tagInfoKey;
+	std::string m_tagInfoKey;
 	
 };
 
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/MuonAGDDToolHelper.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/MuonAGDDToolHelper.cxx
index 79b20e2ab68..89424db3a66 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/MuonAGDDToolHelper.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/MuonAGDDToolHelper.cxx
@@ -59,20 +59,20 @@ MuonAGDDToolHelper::MuonAGDDToolHelper()
     {
     	std::cout<<"unable to access RBDAccessSvc "<<std::endl;
     }
-	tagInfoKey="";
+	m_tagInfoKey="";
 	result=Gaudi::svcLocator()->service("TagInfoMgr",m_tagInfoMgr);
   	if (result.isFailure()) 
   	{
     	std::cout<<"Unable to retrieve TagInfoMgr!"<<std::endl;
   	}
   	else
-  		tagInfoKey=m_tagInfoMgr->tagInfoKey();
+  		m_tagInfoKey=m_tagInfoMgr->tagInfoKey();
 }
 
 std::vector<std::string>& MuonAGDDToolHelper::ReadAGDDFlags()
 {
-	static std::vector<std::string> m_structuresFromFlags;
-	m_structuresFromFlags.clear();
+	static std::vector<std::string> structuresFromFlags;
+	structuresFromFlags.clear();
    std::string agdd2geoVersion = p_RDBAccessSvc->getChildTag("AGDD2GeoSwitches",p_GeoModelSvc->muonVersion(),"MuonSpectrometer");
 
 //   m_AGDD2GeoSwitches.clear();
@@ -91,7 +91,7 @@ std::vector<std::string>& MuonAGDDToolHelper::ReadAGDDFlags()
        {
 //        std::cout<<"  Add to m_AGDD2GeoSwitches " << TheKEYNAME <<std::endl;
 //		 if (aliases->IsAliased(TheKEYNAME))
-         m_structuresFromFlags.push_back(TheKEYNAME);
+         structuresFromFlags.push_back(TheKEYNAME);
        }
      }
    }
@@ -99,7 +99,7 @@ std::vector<std::string>& MuonAGDDToolHelper::ReadAGDDFlags()
    {
       std::cout<<"  agdd2geoVersion is empty " <<std::endl;
    }	
-   return m_structuresFromFlags;
+   return structuresFromFlags;
 }
 
 
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h
index a7edf35ca3a..3d585c25661 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h
@@ -14,30 +14,30 @@ class GeoMaterial;
 
 class AGDDMMSpacer: public AGDDVolume {
 public:
-	AGDDMMSpacer(std::string s):AGDDVolume(s),_small_x(0),_large_x(0),_y(0),_z(0) {}
+	AGDDMMSpacer(std::string s):AGDDVolume(s),m_small_x(0),m_large_x(0),m_y(0),m_z(0) {}
 	void SetXYZ(std::vector<double> v) 
 	{
-		_small_x=v[0];
-		_large_x=v[1];
-		_y=v[2];
-		_z=v[3];
+		m_small_x=v[0];
+		m_large_x=v[1];
+		m_y=v[2];
+		m_z=v[3];
 	}
-	void small_x(double x) {_small_x=x;}
-	void large_x(double x) {_large_x=x;}
-	void y(double yval) {_y=yval;}
-	void z(double zval) {_z=zval;}
-	double small_x() {return _small_x;}
-	double large_x() {return _large_x;}
-	double y() {return _y;}
-	double z() {return _z;}
+	void small_x(double x) {m_small_x=x;}
+	void large_x(double x) {m_large_x=x;}
+	void y(double yval) {m_y=yval;}
+	void z(double zval) {m_z=zval;}
+	double small_x() {return m_small_x;}
+	double large_x() {return m_large_x;}
+	double y() {return m_y;}
+	double z() {return m_z;}
 	std::string tech;
 	void CreateVolume();
 	void CreateSolid();
 private:
-	double _small_x;
-	double _large_x;
-	double _y;
-	double _z;
+	double m_small_x;
+	double m_large_x;
+	double m_y;
+	double m_z;
 	
 	GeoMaterial* GetMMMaterial(std::string);
 };
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMuonStation.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMuonStation.h
index c0852158316..2c8249903dd 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMuonStation.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMuonStation.h
@@ -14,29 +14,29 @@ class GeoMaterial;
 
 class AGDDMuonStation: public AGDDVolume {
 public:
-	AGDDMuonStation(std::string s):AGDDVolume(s),_small_x(0),_large_x(0),_y(0),_z(0) {}
+	AGDDMuonStation(std::string s):AGDDVolume(s),m_small_x(0),m_large_x(0),m_y(0),m_z(0) {}
 	void SetXYZ(std::vector<double> v) 
 	{
-		_small_x=v[0];
-		_large_x=v[1];
-		_y=v[2];
-		_z=v[3];
+		m_small_x=v[0];
+		m_large_x=v[1];
+		m_y=v[2];
+		m_z=v[3];
 	}
-	void small_x(double x) {_small_x=x;}
-	void large_x(double x) {_large_x=x;}
-	void y(double yval) {_y=yval;}
-	void z(double zval) {_z=zval;}
-	double small_x() {return _small_x;}
-	double large_x() {return _large_x;}
-	double y() {return _y;}
-	double z() {return _z;}
+	void small_x(double x) {m_small_x=x;}
+	void large_x(double x) {m_large_x=x;}
+	void y(double yval) {m_y=yval;}
+	void z(double zval) {m_z=zval;}
+	double small_x() {return m_small_x;}
+	double large_x() {return m_large_x;}
+	double y() {return m_y;}
+	double z() {return m_z;}
 	void CreateVolume();
 	void CreateSolid();
 private:
-	double _small_x;
-	double _large_x;
-	double _y;
-	double _z;
+	double m_small_x;
+	double m_large_x;
+	double m_y;
+	double m_z;
 	
 	GeoMaterial* GetMMMaterial(std::string);
 };
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMMSpacer.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMMSpacer.cxx
index 152fc345312..e75edb27a1e 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMMSpacer.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMMSpacer.cxx
@@ -31,9 +31,9 @@ void AGDDMMSpacer::CreateVolume()
 	
 	MuonGM::MMSpacerComponent *mm_comp=new MuonGM::MMSpacerComponent;
 	mm_comp->name=tech;
-	mm_comp->dx1=_small_x;
-	mm_comp->dx2=_large_x;
-	mm_comp->dy=_y;
+	mm_comp->dx1=m_small_x;
+	mm_comp->dx2=m_large_x;
+	mm_comp->dy=m_y;
 	
 	MuonGM::MMSpacer cham(mm_comp);
 	GeoPhysVol *vvv=cham.build(1);
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMicromegas.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMicromegas.cxx
index 90c1deab53c..f1c0bfd5e4d 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMicromegas.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMicromegas.cxx
@@ -40,8 +40,8 @@ void AGDDMicromegas::CreateSolid()
 //	if (!p)
 //	{
 //		std::cout<<" creating solid with dimensions "<<
-//		_small_x<<" "<<_large_x<<" "<<_y<<" "<<_z<<std::endl;
-//		GeoShape* solid=new GeoTrd(_small_x/2.,_large_x/2.,_y/2.,_y/2.,_z/2.);
+//		m_small_x<<" "<<m_large_x<<" "<<m_y<<" "<<m_z<<std::endl;
+//		GeoShape* solid=new GeoTrd(m_small_x/2.,m_large_x/2.,m_y/2.,m_y/2.,m_z/2.);
 //		SetSolid(solid);
 //	}
 
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMuonStation.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMuonStation.cxx
index 11e1da7c2a2..9660320df17 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMuonStation.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMuonStation.cxx
@@ -23,8 +23,8 @@ void AGDDMuonStation::CreateSolid()
 	if (!p)
 	{
 		std::cout<<" creating solid with dimensions "<<
-		_small_x<<" "<<_large_x<<" "<<_y<<" "<<_z<<std::endl;
-		GeoShape* solid=new GeoTrd(_small_x/2.,_large_x/2.,_y/2.,_y/2.,_z/2.);
+		m_small_x<<" "<<m_large_x<<" "<<m_y<<" "<<m_z<<std::endl;
+		GeoShape* solid=new GeoTrd(m_small_x/2.,m_large_x/2.,m_y/2.,m_y/2.,m_z/2.);
 		SetSolid(solid);
 	}
 }
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorDescription.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorDescription.h
index c009b0655d7..4e019dc9f31 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorDescription.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorDescription.h
@@ -91,7 +91,7 @@ protected:
 	double m_ylFrame;
 
 	static sTGCDetectorDescription* s_current;
-	void SetDetectorAddress(AGDDDetectorPositioner*);
+	virtual void SetDetectorAddress(AGDDDetectorPositioner*) override;
 };
 
 #endif
diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx
index 43de437083a..11443121059 100644
--- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx
+++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx
@@ -166,7 +166,7 @@ StatusCode CscDigitizationTool::initialize() {
   // create an empty CSC digit container for filling
   try{
     m_container = new CscDigitContainer(m_cscIdHelper->module_hash_max());
-  } catch(std::bad_alloc){
+  } catch(const std::bad_alloc&){
     ATH_MSG_FATAL ( "Could not create a new CscDigitContainer!");
     return StatusCode::FAILURE;
   }
diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx
index 54d7139de50..a561bc6c17e 100644
--- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx
+++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx
@@ -243,7 +243,7 @@ StatusCode MdtDigitizationTool::initialize() {
   try{
     m_digitContainer = new MdtDigitContainer(m_idHelper->module_hash_max());
   } 
-  catch(std::bad_alloc){
+  catch(const std::bad_alloc&){
     ATH_MSG_FATAL ( "Could not create a new MdtDigitContainer!" );
     return StatusCode::FAILURE;
   }
diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/sTGC_Digitization/sTgcSimDigitData.h b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/sTGC_Digitization/sTgcSimDigitData.h
new file mode 100644
index 00000000000..cb1dc0e1112
--- /dev/null
+++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/sTGC_Digitization/sTgcSimDigitData.h
@@ -0,0 +1,44 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/** 
+ * Class for storing sTGC hit and digit information
+ *
+ */
+
+#ifndef STGC_DIGITIZATION_SIMDIGITDATA_H
+#define STGC_DIGITIZATION_SIMDIGITDATA_H
+
+#include "MuonSimData/MuonSimData.h"
+#include "MuonDigitContainer/sTgcDigit.h"
+
+
+class sTgcSimDigitData 
+{
+public:
+    sTgcSimDigitData();
+    sTgcSimDigitData(const sTgcSimDigitData& simDigit);
+    sTgcSimDigitData(const MuonSimData& hit, const sTgcDigit& digit);
+    ~sTgcSimDigitData();
+
+    /// set SimData
+    void setSimData(MuonSimData hit) { m_sTGCSimData = hit; }
+
+    /// Set sTGC digit
+    void setSTGCDigit(sTgcDigit digit) { m_sTGCDigit = digit; }
+
+    /// Get the SimData
+    MuonSimData getSimData() const { return m_sTGCSimData; }
+
+    /// Get the sTGC digit
+    sTgcDigit getSTGCDigit() const { return m_sTGCDigit; }
+
+private:
+
+    MuonSimData m_sTGCSimData;
+    sTgcDigit m_sTGCDigit;
+
+};
+
+#endif
diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx
index 07a11824a7d..e514fa3bfc4 100644
--- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx
+++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx
@@ -20,6 +20,7 @@
 #include "sTGC_Digitization/sTgcDigitizationTool.h"
 #include "sTGC_Digitization/sTgcDigitMaker.h"
 #include "sTGC_Digitization/sTgcVMMSim.h"
+#include "sTGC_Digitization/sTgcSimDigitData.h"
 
 //Gaudi - Core
 #include "GaudiKernel/MsgStream.h"
@@ -96,8 +97,12 @@ inline bool sort_EarlyToLate(tempDigitType a, tempDigitType b){
   return a.first < b.first;
 }
 
-inline bool sort_digitsEarlyToLate(sTgcDigit a, sTgcDigit b){
-  return a.time() < b.time();
+//inline bool sort_digitsEarlyToLate(sTgcDigit a, sTgcDigit b){
+//  return a.time() < b.time();
+//}
+
+inline bool sort_digitsEarlyToLate(sTgcSimDigitData a, sTgcSimDigitData b){
+  return (a.getSTGCDigit()).time() < (b.getSTGCDigit()).time();
 }
 
 /*******************************************************************************/
@@ -182,7 +187,7 @@ StatusCode sTgcDigitizationTool::initialize() {
   ATH_MSG_INFO ( "MCStore                " << m_sgSvc               );
   ATH_MSG_INFO ( "InputObjectName        " << m_inputHitCollectionName );
   ATH_MSG_INFO ( "OutputObjectName       " << m_outputDigitCollectionName );
-  //ATH_MSG_INFO ( "OutputSDOName          " << m_outputSDO_CollectionName  ); //Skip SDO to bypass Trigger Tool error
+  ATH_MSG_INFO ( "OutputSDOName          " << m_outputSDO_CollectionName  ); 
 
   // initialize transient event store 
   if(m_sgSvc.retrieve().isFailure()) { 
@@ -451,7 +456,6 @@ StatusCode sTgcDigitizationTool::recordDigitAndSdoContainers() {
   }
   ATH_MSG_DEBUG("sTgcDigitContainer recorded in StoreGate.");
   
-  /*** Skip SDO to bypass an error in Trigger tool
   // create and record the SDO container in StoreGate
   m_sdoContainer = new MuonSimDataCollection();
   status = m_sgSvc->record(m_sdoContainer, m_outputSDO_CollectionName);
@@ -461,7 +465,6 @@ StatusCode sTgcDigitizationTool::recordDigitAndSdoContainers() {
   } else {
     ATH_MSG_DEBUG("sTgcSDOCollection recorded in StoreGate.");
   }
-  ***/
 
   m_digitInfoCollection = new sTgcDigitInfoCollection();
 
@@ -540,11 +543,15 @@ StatusCode sTgcDigitizationTool::doDigitization() {
   TimedHitCollection<GenericMuonSimHit>::const_iterator i, e; 
 
   // Collections of digits by digit type associated with a detector element
-  std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > > unmergedPadDigits;
-  std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > > unmergedStripDigits;
-  std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > > unmergedWireDigits;
+  //std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > > unmergedPadDigits;
+  //std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > > unmergedStripDigits;
+  //std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > > unmergedWireDigits;
+  std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcSimDigitData> > > unmergedPadDigits;
+  std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcSimDigitData> > > unmergedStripDigits;
+  std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcSimDigitData> > > unmergedWireDigits;
   
   std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > > outputDigits;
+  //std::map< IdentifierHash, std::map< Identifier, std:vector<sTgcSimDigitData> > > outputDigits;
 
   sTgcDigitCollection* digitCollection = 0;  //output digits
 
@@ -740,23 +747,38 @@ StatusCode sTgcDigitizationTool::doDigitization() {
 			if(it_SimHit->second!= 0)  //hit not from the main signal subevent
 				  isPileup = 1;
                   
-            sTgcDigit* newDigit = new sTgcDigit(newDigitId, newBcTag, newTime, newCharge, isDead, isPileup);  //Create the digit with updated time and BCTag
+            // Create a new digit with updated time and BCTag
+            sTgcDigit* newDigit = new sTgcDigit(newDigitId, newBcTag, newTime, newCharge, isDead, isPileup);  
 			IdentifierHash coll_hash;  //Hash defining the detector element
             ATH_MSG_VERBOSE("Unmerged Digit") ;
             ATH_MSG_VERBOSE(" BC tag = "    << newDigit->bcTag()) ;
 			ATH_MSG_VERBOSE(" digitTime = " << newDigit->time()) ;
 			ATH_MSG_VERBOSE(" charge = "    << newDigit->charge()) ;
 
-//
+            // Create a MuonSimData (SDO) corresponding to the digit
+            MuonSimData::Deposit deposit(hit.particleLink(), MuonMCData(hit.depositEnergy(), tof));
+            std::vector<MuonSimData::Deposit> deposits;
+            deposits.push_back(deposit);
+            MuonSimData simData(deposits, hit.particleEncoding());
+            simData.setPosition(hit.globalPosition());
+            simData.setTime(globalHitTime);
+
+            // Associate the digit to the appropriate readout channel
 			m_idHelper->get_detectorElement_hash(elemId, coll_hash);
             if(newChannelType == 0){ //Pad Digit
-                unmergedPadDigits[coll_hash][newDigitId].push_back(*newDigit);  //Put the digit in a vector associated with the RE 
+                //unmergedPadDigits[coll_hash][newDigitId].push_back(*newDigit);  //Put the digit in a vector associated with the RE 
+                //Put the hit and digit in a vector associated with the RE
+                unmergedPadDigits[coll_hash][newDigitId].push_back(sTgcSimDigitData(simData, *newDigit));   
             }
             else if(newChannelType == 1){ //Strip Digit
-                unmergedStripDigits[coll_hash][newDigitId].push_back(*newDigit);  //Put the digit in a vector associated with the RE 
+                //unmergedStripDigits[coll_hash][newDigitId].push_back(*newDigit);  //Put the digit in a vector associated with the RE 
+                //Put the hit and digit in a vector associated with the RE
+                unmergedStripDigits[coll_hash][newDigitId].push_back(sTgcSimDigitData(simData, *newDigit));   
             }
             else if(newChannelType == 2){ //Wire Digit
-                unmergedWireDigits[coll_hash][newDigitId].push_back(*newDigit);  //Put the digit in a vector associated with the RE 
+                //unmergedWireDigits[coll_hash][newDigitId].push_back(*newDigit);  //Put the digit in a vector associated with the RE 
+                //Put the hit and digit in a vector associated with the RE
+                unmergedWireDigits[coll_hash][newDigitId].push_back(sTgcSimDigitData(simData, *newDigit));   
             }
             delete newDigit;
 		} // end of loop digiHits
@@ -776,44 +798,80 @@ StatusCode sTgcDigitizationTool::doDigitization() {
         */
    ATH_MSG_VERBOSE("Processing Pad Digits");
    int nPadDigits = 0;
-   for (std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > >::iterator it_DETEL = unmergedPadDigits.begin(); it_DETEL!= unmergedPadDigits.end(); ++it_DETEL) {
-   for (std::map< Identifier, std::vector<sTgcDigit> >::iterator it_REID = it_DETEL->second.begin(); it_REID != it_DETEL->second.end(); ++it_REID) {  //loop on Pads
+   //for (std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > >::iterator it_DETEL = unmergedPadDigits.begin(); it_DETEL!= unmergedPadDigits.end(); ++it_DETEL) {
+   for (std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcSimDigitData> > >::iterator it_DETEL = unmergedPadDigits.begin(); it_DETEL!= unmergedPadDigits.end(); ++it_DETEL) {
+   //for (std::map< Identifier, std::vector<sTgcDigit> >::iterator it_REID = it_DETEL->second.begin(); it_REID != it_DETEL->second.end(); ++it_REID) {  //loop on Pads
+   for (std::map< Identifier, std::vector<sTgcSimDigitData> >::iterator it_REID = it_DETEL->second.begin(); it_REID != it_DETEL->second.end(); ++it_REID) {  //loop on Pads
        std::stable_sort(it_REID->second.begin(), it_REID->second.end(), sort_digitsEarlyToLate);  //Sort digits on this RE in time
        
        /*******************
        * Merge Pad Digits *
        *******************/       
    
-       std::vector<sTgcDigit>::iterator i = it_REID->second.begin();
-       std::vector<sTgcDigit>::iterator e = it_REID->second.end();
+       //std::vector<sTgcDigit>::iterator i = it_REID->second.begin();
+       //std::vector<sTgcDigit>::iterator e = it_REID->second.end();
+       std::vector<sTgcSimDigitData>::iterator i = it_REID->second.begin();
+       std::vector<sTgcSimDigitData>::iterator e = it_REID->second.end();
        e--;  //decrement e to be the last element and not the beyond the last element iterator
        
        while( i!=e ) { 
-           sTgcDigit digit1 = (*i);
-           sTgcDigit digit2 = (*(i+1));
+           //sTgcDigit digit1 = (*i);
+           //sTgcDigit digit2 = (*(i+1));
+           sTgcDigit digit1 = i->getSTGCDigit();
+           sTgcDigit digit2 = (i+1)->getSTGCDigit();
            if(digit2.time() - digit1.time() < m_hitTimeMergeThreshold ) { //two consecutive hits are close enough for merging
                ATH_MSG_VERBOSE("Merging Digits on REID[" << it_REID->first.getString() << "]");
                ATH_MSG_VERBOSE("digit1: " << digit1.time() << ", " << digit1.charge());
                ATH_MSG_VERBOSE("digit2: " << digit2.time() << ", " << digit2.charge());
+
+               // Update the digit info
                bool mergedIsPileup = (digit1.isPileup() && digit2.isPileup());
-               i->set_isPileup(mergedIsPileup);
+               //i->set_isPileup(mergedIsPileup);
+               digit1.set_charge( digit1.charge()+digit2.charge() );
+               digit1.set_isPileup(mergedIsPileup);
+               i->setSTGCDigit(digit1);
+
                it_REID->second.erase (i+1); //remove the later time digit
                e = it_REID->second.end();  //update the end iterator
                e--; //decrement e to be the last element and not the beyond the last element iterator
                ATH_MSG_VERBOSE(it_REID->second.size() << " digits on the channel after merge step");
            }
-           else ++i; //There was not a hit to merge: move onto the next one
+           else {
+               ++i; //There was not a hit to merge: move onto the next one
+           }
        }
        ATH_MSG_VERBOSE("Merging complete for Pad REID[" << it_REID->first.getString() << "]");
+       //ATH_MSG_VERBOSE(it_REID->second.size() << " digits on the channel after merging");
        ATH_MSG_VERBOSE(it_REID->second.size() << " digits on the channel after merging");
+
+        // Record SimData for pad channels and reate a temporary container 
+        // to store merged digits for VMM operation
+        std::vector<sTgcDigit> merged_pad_digits;
+        for ( const sTgcSimDigitData& digit_hit: it_REID->second) {
+            // Add element to SDO container
+            Identifier channel_id = (digit_hit.getSTGCDigit()).identify();
+            m_sdoContainer->insert(std::make_pair(channel_id, digit_hit.getSimData()));
+
+            // List of digits for VMM
+            merged_pad_digits.push_back( digit_hit.getSTGCDigit() );
+        }
+       unsigned int size_mergedDigits = merged_pad_digits.size();
+       unsigned int size_channelDigits = it_REID->second.size();
+       if (size_mergedDigits != size_channelDigits) {
+            ATH_MSG_WARNING("Critical: Number of merged pad digits (" << size_mergedDigits << ") is not equal to the number of digits on pad channel (" << size_channelDigits << ") after merging. Please verify.");
+        }
+
+
        /*************************
        * Calculate Pad deadtime *
        **************************/
        ATH_MSG_VERBOSE("Calculating deadtime for Pad REID[" << it_REID->first.getString() << "]");
        
-       float vmmStartTime = (*(it_REID->second.begin())).time();
+       //float vmmStartTime = (*(it_REID->second.begin())).time();
+       float vmmStartTime = (*(merged_pad_digits.begin())).time();
        
-       sTgcVMMSim* theVMM = new sTgcVMMSim(it_REID->second, vmmStartTime, m_deadtimePad, m_readtimePad, m_produceDeadDigits, 0);  // object to simulate the VMM response
+       //sTgcVMMSim* theVMM = new sTgcVMMSim(it_REID->second, vmmStartTime, m_deadtimePad, m_readtimePad, m_produceDeadDigits, 0);  // object to simulate the VMM response
+       sTgcVMMSim* theVMM = new sTgcVMMSim(merged_pad_digits, vmmStartTime, m_deadtimePad, m_readtimePad, m_produceDeadDigits, 0);  // object to simulate the VMM response
        theVMM->setMessageLevel(static_cast<MSG::Level>(msgLevel()));
        theVMM->initialReport();
        
@@ -862,39 +920,64 @@ StatusCode sTgcDigitizationTool::doDigitization() {
    ATH_MSG_VERBOSE("Processing Strip Digits");
    std::map< IdentifierHash, std::map< Identifier, std::pair <bool, sTgcVMMSim* > > > vmmArray; // map holding the VMMSim objects and a bool indicating if the channel is done processing
    int nStripDigits = 0;
-    for (std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > >::iterator it_DETEL = unmergedStripDigits.begin(); it_DETEL!= unmergedStripDigits.end(); ++it_DETEL) {
-    for (std::map< Identifier, std::vector<sTgcDigit> >::iterator it_REID = it_DETEL->second.begin(); it_REID != it_DETEL->second.end(); ++it_REID) {  //loop on Pads
+    //for (std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > >::iterator it_DETEL = unmergedStripDigits.begin(); it_DETEL!= unmergedStripDigits.end(); ++it_DETEL) {
+    //for (std::map< Identifier, std::vector<sTgcDigit> >::iterator it_REID = it_DETEL->second.begin(); it_REID != it_DETEL->second.end(); ++it_REID) {  //loop on Pads
+    for (std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcSimDigitData> > >::iterator it_DETEL = unmergedStripDigits.begin(); it_DETEL!= unmergedStripDigits.end(); ++it_DETEL) {
+    for (std::map< Identifier, std::vector<sTgcSimDigitData> >::iterator it_REID = it_DETEL->second.begin(); it_REID != it_DETEL->second.end(); ++it_REID) {  //loop on Pads
        std::stable_sort(it_REID->second.begin(), it_REID->second.end(), sort_digitsEarlyToLate);  //Sort digits on this RE in time
        
        /*******************
        * Merge Strip Digits *
        *******************/       
    
-       std::vector<sTgcDigit>::iterator i = it_REID->second.begin();
-       std::vector<sTgcDigit>::iterator e = it_REID->second.end();
+       std::vector<sTgcSimDigitData>::iterator i = it_REID->second.begin();
+       std::vector<sTgcSimDigitData>::iterator e = it_REID->second.end();
        e--;
-       
+
        while( i!=e ) { 
-           sTgcDigit digit1 = (*i);
-           sTgcDigit digit2 = (*(i+1));
+           sTgcDigit digit1 = i->getSTGCDigit();
+           sTgcDigit digit2 = (i+1)->getSTGCDigit();
            if(digit2.time() - digit1.time() < m_hitTimeMergeThreshold ) { //two consecutive hits are close enough for merging
                ATH_MSG_VERBOSE("Merging Digits on REID[" << it_REID->first.getString() << "]");
-               float mergedCharge = digit1.charge() + digit2.charge();
+               //float mergedCharge = digit1.charge() + digit2.charge();
                bool mergedIsPileup = (digit1.isPileup() && digit2.isPileup());
-               i->set_charge(mergedCharge);
-               i->set_isPileup(mergedIsPileup);
+               digit1.set_charge( digit1.charge()+digit2.charge() );
+               digit1.set_isPileup(mergedIsPileup);
+               i->setSTGCDigit(digit1);
+
                it_REID->second.erase (i+1); //remove the later time digit
                e = it_REID->second.end();  //update the end iterator
                e--; //decrement e to be the last element and not the beyond the last element iterator
                ATH_MSG_VERBOSE(it_REID->second.size() << " digits on the channel after merge step");
            }
-           else ++i; //There was not a hit to merge: move onto the next one
+           else {
+               ++i; //There was not a hit to merge: move onto the next one
+           }
        }
+
+        // Record SimData for pad channels and create a temporary container 
+        // to store merged digits for VMM operation
+        std::vector<sTgcDigit> merged_strip_digits;
+        for ( const sTgcSimDigitData& digit_hit: it_REID->second) {
+            // Add element to SDO container
+            Identifier channel_id = (digit_hit.getSTGCDigit()).identify();
+            m_sdoContainer->insert(std::make_pair(channel_id, digit_hit.getSimData()));
+
+            // Save digit for further processing with VMM
+            merged_strip_digits.push_back( digit_hit.getSTGCDigit() );
+        }
+       unsigned int size_mergedDigits = merged_strip_digits.size();
+       unsigned int size_channelDigits = it_REID->second.size();
+       if (size_mergedDigits != size_channelDigits) {
+            ATH_MSG_WARNING("Number of merged pad digits (" << size_mergedDigits << ") is not equal to the number of digits on pad channel (" << size_channelDigits << ") after merging. Please verify.");
+        }
+
+
        ATH_MSG_VERBOSE("Merging complete for Strip REID[" << it_REID->first.getString() << "]");
        ATH_MSG_VERBOSE(it_REID->second.size() << " digits on the channel after merging");
 //       float vmmStartTime = (*(it_REID->second.begin())).time();
        vmmArray[it_DETEL->first][it_REID->first].first = true;
-       vmmArray[it_DETEL->first][it_REID->first].second = new sTgcVMMSim(it_REID->second, (earliestEventTime-25), m_deadtimeStrip, m_readtimeStrip, m_produceDeadDigits, 1);  // object to simulate the VMM response
+       vmmArray[it_DETEL->first][it_REID->first].second = new sTgcVMMSim(merged_strip_digits, (earliestEventTime-25), m_deadtimeStrip, m_readtimeStrip, m_produceDeadDigits, 1);  // object to simulate the VMM response
        vmmArray[it_DETEL->first][it_REID->first].second->setMessageLevel(static_cast<MSG::Level>(msgLevel()));
        ATH_MSG_VERBOSE("VMM instantiated for Strip REID[" << it_REID->first.getString() << "]");
     }
@@ -974,9 +1057,9 @@ StatusCode sTgcDigitizationTool::doDigitization() {
     */
    
    int nWGDigits = 0;
-   for (std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcDigit> > >::iterator it_DETEL = unmergedWireDigits.begin(); it_DETEL!= unmergedWireDigits.end(); ++it_DETEL) {
+   for (std::map< IdentifierHash, std::map< Identifier, std::vector<sTgcSimDigitData> > >::iterator it_DETEL = unmergedWireDigits.begin(); it_DETEL!= unmergedWireDigits.end(); ++it_DETEL) {
      // loop on digits of same wiregroup
-     for (std::map< Identifier, std::vector<sTgcDigit> >::iterator it_REID = it_DETEL->second.begin(); it_REID != it_DETEL->second.end(); ++it_REID) {
+     for (std::map< Identifier, std::vector<sTgcSimDigitData> >::iterator it_REID = it_DETEL->second.begin(); it_REID != it_DETEL->second.end(); ++it_REID) {
          sort(it_REID->second.begin(), it_REID->second.end(), sort_digitsEarlyToLate);  //Sort digits on this RE in time
 
          /*************************
@@ -985,36 +1068,61 @@ StatusCode sTgcDigitizationTool::doDigitization() {
          // No merging is done, just removing subsequent digits close in time
          // to the first digit. TODO: Have to be updated
 
-         std::vector<sTgcDigit>::iterator i = it_REID->second.begin();
-         std::vector<sTgcDigit>::iterator e = it_REID->second.end();
+         std::vector<sTgcSimDigitData>::iterator i = it_REID->second.begin();
+         std::vector<sTgcSimDigitData>::iterator e = it_REID->second.end();
          e--;  //decrement e to be the last element and not the beyond the last element iterator
 
          while( i!=e ) {
-             sTgcDigit digit1 = (*i);
-             sTgcDigit digit2 = (*(i+1));
+             sTgcDigit digit1 = i->getSTGCDigit();
+             sTgcDigit digit2 = (i+1)->getSTGCDigit();
              if(digit2.time() - digit1.time() < m_hitTimeMergeThreshold ) { //two consecutive hits are close enough for merging
                  ATH_MSG_VERBOSE("Merging Digits on REID[" << it_REID->first.getString() << "]");
                  ATH_MSG_VERBOSE("digit1: " << digit1.time() << ", " << digit1.charge());
                  ATH_MSG_VERBOSE("digit2: " << digit2.time() << ", " << digit2.charge());
+
                  bool mergedIsPileup = (digit1.isPileup() && digit2.isPileup());
-                 i->set_isPileup(mergedIsPileup);
+                 digit1.set_charge( digit1.charge()+digit2.charge() );
+                 digit1.set_isPileup(mergedIsPileup);
+                 i->setSTGCDigit(digit1);
+
                  it_REID->second.erase (i+1); //remove the later time digit
                  e = it_REID->second.end();  //update the end iterator
                  e--; //decrement e to be the last element and not the beyond the last element iterator
                  ATH_MSG_VERBOSE(it_REID->second.size() << " digits on the channel after merge step");
              }
-             else ++i; //There was not a hit to merge: move onto the next one
+             else {
+                 ++i; //There was not a hit to merge: move onto the next one
+             }
          }
+
+        // Record SimData for pad channels and create a temporary container to 
+        // store merged digits for VMM operation
+        std::vector<sTgcDigit> merged_wire_digits;
+        for ( const sTgcSimDigitData& digit_hit: it_REID->second) {
+            Identifier channel_id = (digit_hit.getSTGCDigit()).identify();
+            m_sdoContainer->insert(std::make_pair(channel_id, digit_hit.getSimData()));
+
+            // Save digit for further processing with VMM
+            merged_wire_digits.push_back( digit_hit.getSTGCDigit() );
+        }
+       unsigned int size_mergedDigits = merged_wire_digits.size();
+       unsigned int size_channelDigits = it_REID->second.size();
+       if (size_mergedDigits != size_channelDigits) {
+            ATH_MSG_WARNING("Number of merged pad digits (" << size_mergedDigits << ") is not equal to the number of digits on pad channel (" << size_channelDigits << ") after merging. Please verify.");
+        }
+
+
          ATH_MSG_VERBOSE("Merging complete for Wiregroup REID[" << it_REID->first.getString() << "]");
          ATH_MSG_VERBOSE(it_REID->second.size() << " digits on the channel after merging");
+
          /*******************************
          * Calculate wiregroup deadtime *
          *******************************/
          ATH_MSG_VERBOSE("Calculating deadtime for wiregroup REID[" << it_REID->first.getString() << "]");
 
-         float vmmStartTime = (*(it_REID->second.begin())).time();
+         float vmmStartTime = (*(merged_wire_digits.begin())).time();
 
-         sTgcVMMSim* theVMM = new sTgcVMMSim(it_REID->second, vmmStartTime, m_deadtimeWire, m_readtimeWire, m_produceDeadDigits, 2);  // object to simulate the VMM response
+         sTgcVMMSim* theVMM = new sTgcVMMSim(merged_wire_digits, vmmStartTime, m_deadtimeWire, m_readtimeWire, m_produceDeadDigits, 2);  // object to simulate the VMM response
          theVMM->setMessageLevel(msgLevel());
          theVMM->initialReport();
 
@@ -1173,16 +1281,6 @@ uint16_t sTgcDigitizationTool::bcTagging(const float digitTime, const int /*chan
 
   uint16_t bctag = 0;
 
-//  double offset, window;
-//  if(channelType == 1) { //strips 
-//    offset = m_timeWindowOffsetStrip;
-//    window = m_timeWindowStrip;
-//  }
-//  else { // wire gangs or pads
-//    offset = m_timeWindowOffsetPad;
-//    window = m_timeWindowPad;
-//  }
-
 //  if(-m_bunchCrossingTime+offset < digitTime && digitTime < -m_bunchCrossingTime+offset+window) {
 //    bctag = (bctag | 0x1);
 //  }
diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcSimDigitData.cxx b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcSimDigitData.cxx
new file mode 100644
index 00000000000..e2aeb4644d8
--- /dev/null
+++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcSimDigitData.cxx
@@ -0,0 +1,25 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "sTGC_Digitization/sTgcSimDigitData.h"
+
+
+// Constructor
+sTgcSimDigitData::sTgcSimDigitData() { }
+
+sTgcSimDigitData::sTgcSimDigitData(const sTgcSimDigitData& simDigit) {
+
+    m_sTGCSimData = simDigit.getSimData();
+    m_sTGCDigit = simDigit.getSTGCDigit();
+}
+
+sTgcSimDigitData::sTgcSimDigitData(const MuonSimData& hit, const sTgcDigit& digit): 
+    m_sTGCSimData(hit),
+    m_sTGCDigit(digit)
+{
+}
+
+// Destructor
+sTgcSimDigitData::~sTgcSimDigitData() {}
+
diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Dbam.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Dbam.cxx
index 58d697a964c..bd3dae580b0 100644
--- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Dbam.cxx
+++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Dbam.cxx
@@ -50,7 +50,7 @@ DblQ00Dbam::DblQ00Dbam(std::unique_ptr<IRDBQuery>&& dbam)
         try {
             sprintf(m_d[i].test,"%s",dbam->data<std::string>("DBAM_DATA.TEST").c_str());
         }
-        catch (std::runtime_error)
+        catch (const std::runtime_error&)
         {
             //std::cerr<<"no TEST field available in DBAM"<<std::endl;
             sprintf(m_d[i].test,"unknown");
@@ -63,7 +63,7 @@ DblQ00Dbam::DblQ00Dbam(std::unique_ptr<IRDBQuery>&& dbam)
             try {
                 sprintf(m_d[i].name[j],"%s",dbam->data<std::string>(tag).c_str());
             }
-            catch (std::runtime_error)
+            catch (const std::runtime_error&)
             {
                 //std::cerr<<"End of station-name list"<<std::endl;
                 break;
diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcsc.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcsc.cxx
index eb0e7318b4e..d267064eb3f 100644
--- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcsc.cxx
+++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcsc.cxx
@@ -76,7 +76,7 @@ DblQ00Wcsc::DblQ00Wcsc(std::unique_ptr<IRDBQuery>&& wcsc)
             //m_d[i].psndco =  m_d[i].azcat;
             //std::cerr<<" redefined psndco = "<<m_d[i].psndco<<std::endl;
         }
-        catch (std::runtime_error)
+        catch (const std::runtime_error&)
         {
             std::cerr<<" azcat field does not exists !"<<std::endl;
             m_d[i].azcat =   0.;
diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wtgc.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wtgc.cxx
index acb6c59e0b4..31dbaa8c3cf 100644
--- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wtgc.cxx
+++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wtgc.cxx
@@ -57,7 +57,7 @@ DblQ00Wtgc::DblQ00Wtgc(std::unique_ptr<IRDBQuery>&& wtgc)
             try {
 	      sprintf(m_d[i].allname[j],"%s",wtgc->data<std::string>(tag).c_str());
             }
-            catch (std::runtime_error)
+            catch (const std::runtime_error&)
             {
                 //std::cerr<<"MuonGM::DblQ00-Wtgc- End of material-name list"<<std::endl;
                 break;
diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx
index 535526c9917..20aa75bb175 100755
--- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx
+++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx
@@ -389,7 +389,7 @@ MuonDetectorTool::create()
             GeoPhysVol *world=&*theExpt->getPhysVol();
             theFactory.create(world);
             //      log << MSG::INFO << "CREATING MuonDetectorNode; MM=" << &*theMaterialManager<< endmsg;
-        } catch (std::bad_alloc) {
+        } catch (const std::bad_alloc&) {
             msg(MSG::FATAL)<< "Could not create new MuonDetectorNode!" << endmsg;
             return StatusCode::FAILURE; 
         }
diff --git a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx
index d7e17e4b38a..c211f976d38 100644
--- a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx
+++ b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx
@@ -433,8 +433,8 @@ void MuonGMCheck::checkreadoutrpcgeo()
 
 
 
-                                 bool m_localToGlobal_rpc=true;
-                                 if (m_localToGlobal_rpc) 
+                                 bool localToGlobal_rpc=true;
+                                 if (localToGlobal_rpc) 
                                  {                                     
                                      //here (gasgap-level) perform checks on local to global transform
                                      // BMF1 at stEta = 3 stPhi = 6, dbR=1,dbZ=1,dbPhi=1->should be 2 gg=1 or 2
@@ -2710,7 +2710,7 @@ void MuonGMCheck::buildRpcRegionSelectorMap()
 
         std::string new_extid="";
         int aux0, aux1, aux2, aux3, aux4, aux5;
-        char _dot[5];
+        char dot[5];
         std::string::size_type loc_o;
         std::string::size_type loc_c;
         std::string leftover="";
@@ -2719,7 +2719,7 @@ void MuonGMCheck::buildRpcRegionSelectorMap()
             if ((loc_c = extid.find("]", loc_o+1)) != std::string::npos) 
             {
                 mystream rpcid_stream(extid.substr(loc_o+1, loc_c-loc_o-1));
-                rpcid_stream >>aux0>>_dot[0]>>aux1>>_dot[1]>>aux2>>_dot[2]>>aux3>>_dot[3]>>aux4>>_dot[4]>>aux5>>leftover;
+                rpcid_stream >>aux0>>dot[0]>>aux1>>dot[1]>>aux2>>dot[2]>>aux3>>dot[3]>>aux4>>dot[4]>>aux5>>leftover;
                 std::ostringstream rpcid_nstr;
                 rpcid_nstr <<aux0 <<"/" << aux1 <<"/" << aux2 <<"/"<< aux3 <<"/" <<aux4 <<"/"<<aux5;
                 new_extid = rpcid_nstr.str();
@@ -2749,22 +2749,22 @@ void MuonGMCheck::buildRpcRegionSelectorMap()
         unsigned int nmodules = 0;
         for (int dbz=1; dbz<=ndbz; dbz++)
         {
-            const RpcReadoutElement* _rpcold = NULL;
+            const RpcReadoutElement* rpcold = NULL;
             int ndbp = Set.NPhimodules(dbz);
             for (int dbp=1; dbp<=ndbp; dbp++)
             {
                 std::cout<<" dbz, dbp = "<<dbz<<" "<<dbp<<std::endl;
-                const RpcReadoutElement* _rpc = Set.readoutElement(dbz, dbp);
-                std::cout<<"_rpc = "<<_rpc<<std::endl;
-                if ( _rpc != _rpcold )
+                const RpcReadoutElement* rpc = Set.readoutElement(dbz, dbp);
+                std::cout<<"_rpc = "<<rpc<<std::endl;
+                if ( rpc != rpcold )
                 {
                     nmodules ++;
-                    _rpcold = _rpc;
+                    rpcold = rpc;
                     // here a new module
-                    Amg::Vector3D rpcPos = _rpc->center();
-                    double zminMod = rpcPos.z()-_rpc->getZsize()/2.;
-                    double zmaxMod = rpcPos.z()+_rpc->getZsize()/2.;
-                    double dphi = atan2(_rpc->getSsize()/2.,rpcPos.perp());
+                    Amg::Vector3D rpcPos = rpc->center();
+                    double zminMod = rpcPos.z()-rpc->getZsize()/2.;
+                    double zmaxMod = rpcPos.z()+rpc->getZsize()/2.;
+                    double dphi = atan2(rpc->getSsize()/2.,rpcPos.perp());
                     double pminMod = rpcPos.phi() - dphi;
                     double pmaxMod = rpcPos.phi() + dphi;
                     
@@ -2834,7 +2834,7 @@ void MuonGMCheck::buildMdtRegionSelectorMap()
 
         std::string new_extid="";
         int aux0, aux1, aux2, aux3, aux4, aux5;
-        char _dot[5];
+        char dot[5];
         std::string::size_type loc_o;
         std::string::size_type loc_c;
         std::string leftover="";
@@ -2843,7 +2843,7 @@ void MuonGMCheck::buildMdtRegionSelectorMap()
             if ((loc_c = extid.find("]", loc_o+1)) != std::string::npos) 
             {
                 mystream mdtid_stream(extid.substr(loc_o+1, loc_c-loc_o-1));
-                mdtid_stream >>aux0>>_dot[0]>>aux1>>_dot[1]>>aux2>>_dot[2]>>aux3>>_dot[3]>>aux4>>_dot[4]>>aux5>>leftover;
+                mdtid_stream >>aux0>>dot[0]>>aux1>>dot[1]>>aux2>>dot[2]>>aux3>>dot[3]>>aux4>>dot[4]>>aux5>>leftover;
                 std::ostringstream mdtid_nstr;
                 mdtid_nstr <<aux0 <<"/" << aux1 <<"/" << aux2 <<"/"<< aux3 <<"/" <<aux4;
                 new_extid = mdtid_nstr.str();
@@ -2910,31 +2910,31 @@ void MuonGMCheck::buildMdtRegionSelectorMap()
         for (int i=0; i<4; i++)
         {
             //
-            const MdtReadoutElement* _mdt = NULL;
-            i<2 ? _mdt = mdt1: _mdt = mdt2;
-            if (_mdt == NULL) {
+            const MdtReadoutElement* mdt = NULL;
+            i<2 ? mdt = mdt1: mdt = mdt2;
+            if (mdt == NULL) {
                 std::cout<<" element not found for index i = "<<i<<" --------- "<<std::endl;
                 if (i==2) {
                     Idv[2] = p_MdtIdHelper->channelID(Id, 1, ntlay, 1);
-                    _mdt = p_MuonMgr->getMdtReadoutElement(Idv[2]);
+                    mdt = p_MuonMgr->getMdtReadoutElement(Idv[2]);
                 }
                 else if (i==3) {
                     Idv[3] = p_MdtIdHelper->channelID(Id, 1, ntlay, ntubesl1);
-                    _mdt = p_MuonMgr->getMdtReadoutElement(Idv[3]);
+                    mdt = p_MuonMgr->getMdtReadoutElement(Idv[3]);
                 }
             }
-            if (_mdt == NULL) {
+            if (mdt == NULL) {
                     std::cout<<" Skipping element; i = "<<i<<" ----- "<<std::endl;
                     continue;
             }            
-            Amg::Vector3D mdtPos = _mdt->tubePos(Idv[i]);
+            Amg::Vector3D mdtPos = mdt->tubePos(Idv[i]);
             std::cout<<p_MdtIdHelper->show_to_string(Idv[i])<<" index "<<i<<" posx,y,z "<<mdtPos<<" R = "<<mdtPos.perp()<<std::endl;
             //
             Amg::Vector3D mdtPos1 = mdtPos;
             Amg::Vector3D mdtPos2 = mdtPos;
 	    double scaleMin  = (mdtPos.perp()-tubePitch/2.)/mdtPos.perp();
 	    double scalePlus = (mdtPos.perp()+tubePitch/2.)/mdtPos.perp();
-            if (_mdt->barrel())
+            if (mdt->barrel())
             {
                 // these are z ranges of the first or last tube layer 
                 mdtPos1[2] = mdtPos.z()-tubePitch/2.;
@@ -2994,7 +2994,7 @@ void MuonGMCheck::buildMdtRegionSelectorMap()
                 }
                 if (i<2) 
                 {
-                    if (_mdt->sideA())
+                    if (mdt->sideA())
                     {
                         mdtPos1[2] = mdtPos.z()-tubePitch/2.;
                         mdtPos2[2] = mdtPos.z()-tubePitch/2.;
@@ -3007,7 +3007,7 @@ void MuonGMCheck::buildMdtRegionSelectorMap()
                 }
                 else
                 {
-                    if (_mdt->sideA())
+                    if (mdt->sideA())
                     {
                         mdtPos1[2] = mdtPos.z()+tubePitch/2.;
                         mdtPos2[2] = mdtPos.z()+tubePitch/2.;
@@ -3027,7 +3027,7 @@ void MuonGMCheck::buildMdtRegionSelectorMap()
             double rminMod = 0.;
             double rmaxMod = 0.;
             double dphi = 0.;
-            if (_mdt->barrel())
+            if (mdt->barrel())
             {
                 eminMod = mdtPos1.eta(); 
                 emaxMod = mdtPos2.eta(); 
@@ -3038,11 +3038,11 @@ void MuonGMCheck::buildMdtRegionSelectorMap()
                 rminMod = mdtPos1.perp();   
                 rmaxMod = mdtPos2.perp();
                 
-                dphi = atan2(_mdt->getSsize()/2., (mdtPos.perp()-tubePitch/2.));
+                dphi = atan2(mdt->getSsize()/2., (mdtPos.perp()-tubePitch/2.));
             }            
             else 
             {
-                if (_mdt->sideA())
+                if (mdt->sideA())
                 {
                     eminMod = mdtPos2.eta(); 
                     emaxMod = mdtPos1.eta(); 
@@ -3064,7 +3064,7 @@ void MuonGMCheck::buildMdtRegionSelectorMap()
                     rminMod = mdtPos1.perp();   
                     rmaxMod = mdtPos2.perp();                       
                 }
-                dphi = atan2(_mdt->tubeLength(Idv[i])/2., (mdtPos.perp()-tubePitch/2.));
+                dphi = atan2(mdt->tubeLength(Idv[i])/2., (mdtPos.perp()-tubePitch/2.));
             }
             double pminMod = mdtPos.phi() - dphi;
             double pmaxMod = mdtPos.phi() + dphi;
@@ -3140,7 +3140,7 @@ void MuonGMCheck::buildTgcRegionSelectorMap()
 
       std::string new_extid = "";
       int aux0, aux1, aux2, aux3, aux4, aux5;
-      char _dot[5];
+      char dot[5];
       std::string::size_type loc_o;
       std::string::size_type loc_c;
       std::string leftover="";
@@ -3149,7 +3149,7 @@ void MuonGMCheck::buildTgcRegionSelectorMap()
 	  if ((loc_c = extid.find("]", loc_o+1)) != std::string::npos) 
 	    {
 	      std::istringstream tgcid_stream(extid.substr(loc_o+1, loc_c-loc_o-1));
-	      tgcid_stream >>aux0>>_dot[0]>>aux1>>_dot[1]>>aux2>>_dot[2]>>aux3>>_dot[3]>>aux4>>_dot[4]>>aux5>>leftover;
+	      tgcid_stream >>aux0>>dot[0]>>aux1>>dot[1]>>aux2>>dot[2]>>aux3>>dot[3]>>aux4>>dot[4]>>aux5>>leftover;
 	      std::ostringstream mdtid_nstr;
 	      mdtid_nstr <<aux0 <<"/" << aux1 <<"/" << aux2 <<"/"<< aux3 <<"/" <<aux4;
 	      new_extid = mdtid_nstr.str();
@@ -3252,7 +3252,7 @@ void MuonGMCheck::buildCscRegionSelectorMap()
  
          std::string new_extid="";
          int aux0, aux1=0, aux2, aux3=0, aux4, aux5;
-         char _dot[5];
+         char dot[5];
          std::string::size_type loc_o;
          std::string::size_type loc_c;
          std::string leftover="";
@@ -3261,7 +3261,7 @@ void MuonGMCheck::buildCscRegionSelectorMap()
              if ((loc_c = extid.find("]", loc_o+1)) != std::string::npos) 
              {
                  mystream cscid_stream(extid.substr(loc_o+1, loc_c-loc_o-1));
-                 cscid_stream >>aux0>>_dot[0]>>aux1>>_dot[1]>>aux2>>_dot[2]>>aux3>>_dot[3]>>aux4>>_dot[4]>>aux5>>leftover;
+                 cscid_stream >>aux0>>dot[0]>>aux1>>dot[1]>>aux2>>dot[2]>>aux3>>dot[3]>>aux4>>dot[4]>>aux5>>leftover;
                  std::ostringstream cscid_nstr;
                  cscid_nstr <<aux0 <<"/" << aux1 <<"/" << aux2 <<"/"<< aux3 <<"/" <<aux4;
                  new_extid = cscid_nstr.str();
@@ -3517,8 +3517,8 @@ void MuonGMCheck::buildCscRegionSelectorMap()
 
 void MuonGMCheck::checkRegionSelectorMap()
 {
-    IRegSelSvc* m_pRegionSelector;
-    StatusCode status = service("RegSelSvc", m_pRegionSelector);
+    IRegSelSvc* pRegionSelector;
+    StatusCode status = service("RegSelSvc", pRegionSelector);
     if(status.isFailure()) {
       ATH_MSG_FATAL( "Unable to retrieve RegionSelector Svc" );
       return;
@@ -3812,7 +3812,7 @@ void MuonGMCheck::testMdtDetectorElementHash()
 
         std::string new_extid="";
         int aux0 = 0, aux1 = 0, aux2 = 0, aux3 = 0, aux4 = 0, aux5 = 0, aux6 = 0;
-        char _dot[6];
+        char dot[6];
         std::string::size_type loc_o;
         std::string::size_type loc_c;
         std::string leftover="";
@@ -3821,8 +3821,8 @@ void MuonGMCheck::testMdtDetectorElementHash()
             if ((loc_c = extid.find("]", loc_o+1)) != std::string::npos) 
             {
                 mystream mdtid_stream(extid.substr(loc_o+1, loc_c-loc_o-1));
-                mdtid_stream >>aux0>>_dot[0]>>aux1>>_dot[1]>>aux2>>_dot[2]>>aux3>>_dot[3]>>aux4>>_dot[4]
-                             >>aux5>>_dot[5]>>aux6>>leftover;
+                mdtid_stream >>aux0>>dot[0]>>aux1>>dot[1]>>aux2>>dot[2]>>aux3>>dot[3]>>aux4>>dot[4]
+                             >>aux5>>dot[5]>>aux6>>leftover;
                 std::ostringstream mdtid_nstr;
                 mdtid_nstr <<aux0 <<"/" << aux1 <<"/" << aux2 <<"/"<< aux3 <<"/" <<aux4 <<"/"<<aux5 <<"/"<<aux6 ;
                 new_extid = mdtid_nstr.str();
@@ -3836,8 +3836,8 @@ void MuonGMCheck::testMdtDetectorElementHash()
         }
         ATH_MSG_VERBOSE(extid<<" hash Id "<<Idhash<<" new format "<<new_extid );
 
-        const MdtReadoutElement* _mdt = p_MuonMgr->getMdtReadoutElement(Idhash);
-        if (_mdt == NULL) 
+        const MdtReadoutElement* mdt = p_MuonMgr->getMdtReadoutElement(Idhash);
+        if (mdt == NULL) 
         {
             ATH_MSG_ERROR("MuonManager->getMdtReadoutElement(Idhash) fails ! for id = "<<extid<<" detElemhash "<<Idhash );
             continue;
@@ -3845,10 +3845,10 @@ void MuonGMCheck::testMdtDetectorElementHash()
         
         
         // here a new module
-        Amg::Vector3D mdtPos = _mdt->center();
-        double zminMod = mdtPos.z()-_mdt->getZsize()/2.;
-        double zmaxMod = mdtPos.z()+_mdt->getZsize()/2.;
-        double dphi = atan2(_mdt->getSsize()/2.,mdtPos.perp());
+        Amg::Vector3D mdtPos = mdt->center();
+        double zminMod = mdtPos.z()-mdt->getZsize()/2.;
+        double zmaxMod = mdtPos.z()+mdt->getZsize()/2.;
+        double dphi = atan2(mdt->getSsize()/2.,mdtPos.perp());
         double phimin = mdtPos.phi() - dphi;
         double phimax = mdtPos.phi() + dphi;
         Amg::Vector3D Pzmin = mdtPos;
@@ -3906,7 +3906,7 @@ void MuonGMCheck::testRpcDetectorElementHash()
 
         std::string new_extid="";
         int aux0, aux1, aux2, aux3, aux4, aux5, aux6, aux7;
-        char _dot[7];
+        char dot[7];
         std::string::size_type loc_o;
         std::string::size_type loc_c;
         std::string leftover="";
@@ -3915,8 +3915,8 @@ void MuonGMCheck::testRpcDetectorElementHash()
             if ((loc_c = extid.find("]", loc_o+1)) != std::string::npos) 
             {
                 mystream rpcid_stream(extid.substr(loc_o+1, loc_c-loc_o-1));
-                rpcid_stream >>aux0>>_dot[0]>>aux1>>_dot[1]>>aux2>>_dot[2]>>aux3>>_dot[3]>>aux4>>_dot[4]
-                             >>aux5>>_dot[5]>>aux6>>_dot[6]>>aux7>>leftover;
+                rpcid_stream >>aux0>>dot[0]>>aux1>>dot[1]>>aux2>>dot[2]>>aux3>>dot[3]>>aux4>>dot[4]
+                             >>aux5>>dot[5]>>aux6>>dot[6]>>aux7>>leftover;
                 std::ostringstream rpcid_nstr;
                 rpcid_nstr <<aux0 <<"/" << aux1 <<"/" << aux2 <<"/"<< aux3 <<"/" <<aux4 <<"/"<<aux5 <<"/"<<aux6<<"/"<<aux7 ;
                 new_extid = rpcid_nstr.str();
@@ -3924,8 +3924,8 @@ void MuonGMCheck::testRpcDetectorElementHash()
         }
         ATH_MSG_VERBOSE(extid<<" hash Id "<<Idhash<<" new format "<<new_extid );
 
-        const RpcReadoutElement* _rpc = p_MuonMgr->getRpcReadoutElement(Idhash);
-        if (_rpc == NULL) 
+        const RpcReadoutElement* rpc = p_MuonMgr->getRpcReadoutElement(Idhash);
+        if (rpc == NULL) 
         {
             ATH_MSG_ERROR("MuonManager->getRpcReadoutElement(Idhash) fails ! for id = "<<extid<<" detElemhash "<<Idhash );
             continue;
@@ -3934,10 +3934,10 @@ void MuonGMCheck::testRpcDetectorElementHash()
         
         
         // here a new module
-        Amg::Vector3D rpcPos = _rpc->center();
-        double zminMod = rpcPos.z()-_rpc->getZsize()/2.;
-        double zmaxMod = rpcPos.z()+_rpc->getZsize()/2.;
-        double dphi = atan2(_rpc->getSsize()/2.,rpcPos.perp());
+        Amg::Vector3D rpcPos = rpc->center();
+        double zminMod = rpcPos.z()-rpc->getZsize()/2.;
+        double zmaxMod = rpcPos.z()+rpc->getZsize()/2.;
+        double dphi = atan2(rpc->getSsize()/2.,rpcPos.perp());
         double phimin = rpcPos.phi() - dphi;
         double phimax = rpcPos.phi() + dphi;
         Amg::Vector3D Pzmin = rpcPos;
@@ -3997,7 +3997,7 @@ void MuonGMCheck::testTgcDetectorElementHash()
 
         std::string new_extid="";
         int aux0, aux1, aux2, aux3, aux4, aux5;
-        char _dot[5];
+        char dot[5];
         std::string::size_type loc_o;
         std::string::size_type loc_c;
         std::string leftover="";
@@ -4006,7 +4006,7 @@ void MuonGMCheck::testTgcDetectorElementHash()
             if ((loc_c = extid.find("]", loc_o+1)) != std::string::npos) 
             {
                 mystream tgcid_stream(extid.substr(loc_o+1, loc_c-loc_o-1));
-                tgcid_stream >>aux0>>_dot[0]>>aux1>>_dot[1]>>aux2>>_dot[2]>>aux3>>_dot[3]>>aux4>>_dot[4]
+                tgcid_stream >>aux0>>dot[0]>>aux1>>dot[1]>>aux2>>dot[2]>>aux3>>dot[3]>>aux4>>dot[4]
                              >>aux5>>leftover;
                 std::ostringstream tgcid_nstr;
                 tgcid_nstr <<aux0 <<"/" << aux1 <<"/" << aux2 <<"/"<< aux3 <<"/" <<aux4 <<"/"<<aux5;
@@ -4015,18 +4015,18 @@ void MuonGMCheck::testTgcDetectorElementHash()
         }
         ATH_MSG_VERBOSE(extid<<" hash Id "<<Idhash<<" new format "<<new_extid );
 
-        const TgcReadoutElement* _tgc = p_MuonMgr->getTgcReadoutElement(Idhash);
-        if (_tgc == NULL) 
+        const TgcReadoutElement* tgc = p_MuonMgr->getTgcReadoutElement(Idhash);
+        if (tgc == NULL) 
         {
             ATH_MSG_ERROR("MuonManager->getTgcReadoutElement(Idhash) fails ! for id = "<<extid<<" detElemhash "<<Idhash );
             continue;
         }
         
         // here a new module
-        Amg::Vector3D tgcPos = _tgc->center();
-        double zminMod = tgcPos.z()-_tgc->getZsize()/2.;
-        double zmaxMod = tgcPos.z()+_tgc->getZsize()/2.;
-        double dphi = atan2(_tgc->getSsize()/2.,tgcPos.perp());
+        Amg::Vector3D tgcPos = tgc->center();
+        double zminMod = tgcPos.z()-tgc->getZsize()/2.;
+        double zmaxMod = tgcPos.z()+tgc->getZsize()/2.;
+        double dphi = atan2(tgc->getSsize()/2.,tgcPos.perp());
         double phimin = tgcPos.phi() - dphi;
         double phimax = tgcPos.phi() + dphi;
         Amg::Vector3D Pzmin = tgcPos;
@@ -4085,7 +4085,7 @@ void MuonGMCheck::testCscDetectorElementHash()
 
         std::string new_extid="";
         int aux0, aux1, aux2, aux3, aux4, aux5, aux6;
-        char _dot[6];
+        char dot[6];
         std::string::size_type loc_o;
         std::string::size_type loc_c;
         std::string leftover="";
@@ -4094,8 +4094,8 @@ void MuonGMCheck::testCscDetectorElementHash()
             if ((loc_c = extid.find("]", loc_o+1)) != std::string::npos) 
             {
                 mystream cscid_stream(extid.substr(loc_o+1, loc_c-loc_o-1));
-                cscid_stream >>aux0>>_dot[0]>>aux1>>_dot[1]>>aux2>>_dot[2]>>aux3>>_dot[3]>>aux4>>_dot[4]
-                             >>aux5>>_dot[5]>>aux6>>leftover;
+                cscid_stream >>aux0>>dot[0]>>aux1>>dot[1]>>aux2>>dot[2]>>aux3>>dot[3]>>aux4>>dot[4]
+                             >>aux5>>dot[5]>>aux6>>leftover;
                 std::ostringstream cscid_nstr;
                 cscid_nstr <<aux0 <<"/" << aux1 <<"/" << aux2 <<"/"<< aux3 <<"/" <<aux4 <<"/"<<aux5 <<"/"<<aux6 ;
                 new_extid = cscid_nstr.str();
@@ -4103,18 +4103,18 @@ void MuonGMCheck::testCscDetectorElementHash()
         }
         ATH_MSG_VERBOSE(extid<<" hash Id "<<Idhash<<" new format "<<new_extid );
 
-        const CscReadoutElement* _csc = p_MuonMgr->getCscReadoutElement(Idhash);
-        if (_csc == NULL) 
+        const CscReadoutElement* csc = p_MuonMgr->getCscReadoutElement(Idhash);
+        if (csc == NULL) 
         {
             ATH_MSG_ERROR("MuonManager->getCscReadoutElement(Idhash) fails ! for id = "<<extid<<" detElemhash "<<Idhash );
             continue;
         }
         
         // here a new module
-        Amg::Vector3D cscPos = _csc->center();
-        double zminMod = cscPos.z()-_csc->getZsize()/2.;
-        double zmaxMod = cscPos.z()+_csc->getZsize()/2.;
-        double dphi = atan2(_csc->getSsize()/2.,cscPos.perp());
+        Amg::Vector3D cscPos = csc->center();
+        double zminMod = cscPos.z()-csc->getZsize()/2.;
+        double zmaxMod = cscPos.z()+csc->getZsize()/2.;
+        double dphi = atan2(csc->getSsize()/2.,cscPos.perp());
         double phimin = cscPos.phi() - dphi;
         double phimax = cscPos.phi() + dphi;
         Amg::Vector3D Pzmin = cscPos;
diff --git a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMTestOnPrd.cxx b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMTestOnPrd.cxx
index 85eaac25a6c..305cd047407 100644
--- a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMTestOnPrd.cxx
+++ b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMTestOnPrd.cxx
@@ -292,7 +292,7 @@ void MuonGMTestOnPrd::processMdtCollection(const Muon::MdtPrepDataCollection* md
         ATH_MSG_ERROR("Impossible to retrieve MdtDetectorElement for collection with hashId = "<<(int)collidh );
         return;
     }
-    for (Muon::MdtPrepData *mdtPrepDatum : *mdtColl)
+    for (const Muon::MdtPrepData *mdtPrepDatum : *mdtColl)
     {
         Identifier idchannel = mdtPrepDatum->identify();
 
@@ -309,7 +309,7 @@ void MuonGMTestOnPrd::processMdtCollectionOld(const Muon::MdtPrepDataCollection*
                                               Identifier& collid,
                                               IdentifierHash& /*collidh*/) const 
 {
-    for (Muon::MdtPrepData *mdtPrepDatum : *mdtColl)
+    for (const Muon::MdtPrepData *mdtPrepDatum : *mdtColl)
     {
         Identifier idchannel = mdtPrepDatum->identify();
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h
index 7096bfd3121..2d1aa92c5c6 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h
@@ -33,7 +33,6 @@ namespace MuonGM {
 namespace Muon {
   class MuonIdHelperTool;
   class MuonEDMPrinterTool;
-  class IMuonPatternSegmentAssociationTool;
 }
 
 class RpcIdHelper;
@@ -99,9 +98,6 @@ namespace Muon {
     /** convert and add tgc preprawdata collection (1 chamber) */
     void addTgcCollection(Muon::TgcPrepDataCollection::const_iterator cit_begin, Muon::TgcPrepDataCollection::const_iterator cit_end, MuonHoughHitContainer* hitcontainer) const;
 
-    /** construct and record csc asso map to storegate */
-    void storeCscAssMap(const MuonPatternCombinationCollection*) const;
-
     /** finds best segment for given driftcircle vector (nl1/2 = number of dc's in ml 1 and 2, angledif is difference between angle of segment and chamberangle, sel is vector of selected hits (0 not selected, 1 selected) */
     void fastSegmentFinder(TrkDriftCircleMath::DCVec& dcs,int &nl1, int &nl2, double &angleDif, std::vector <int> &sel)const;
 
@@ -145,7 +141,6 @@ namespace Muon {
     ToolHandle <Muon::MuonIdHelperTool>  m_idHelperTool;  //!< Pointer to concrete tool
     /** ToolHandle for EDM printing of segments */
     ToolHandle<Muon::MuonEDMPrinterTool> m_printer;
-    ToolHandle< IMuonPatternSegmentAssociationTool> m_assocTool;
  
     /** reweight hits (true) */
     bool       m_hit_reweights;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx
index 65293ae0e57..be1fd673530 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx
@@ -42,7 +42,6 @@
 #include "TrkDriftCircleMath/MatchDCWithLine.h"
 #include "TrkDriftCircleMath/TangentToCircles.h"
 
-#include "MuonRecToolInterfaces/IMuonPatternSegmentAssociationTool.h"
 #include "GeoPrimitives/GeoPrimitives.h"
 #include "EventPrimitives/EventPrimitivesHelpers.h"
 
@@ -58,7 +57,6 @@ namespace Muon {
     m_muonCombinePatternTool("MuonCombinePatternTool"), 
     m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), 
     m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
-    m_assocTool("Muon::MuonPatternSegmentAssociationTool/MuonPatternSegmentAssociationTool"),
     m_hit_reweights(true),
     m_mdt_adc_cut(true), 
     m_mdt_adc_min(50), 
@@ -165,14 +163,6 @@ namespace Muon {
       return sc;
     }
   
-    sc = m_assocTool.retrieve();
-    if (sc.isSuccess()){
-      ATH_MSG_DEBUG ("Retrieved " << m_assocTool);
-    }else{
-      ATH_MSG_FATAL ("Could not get " << m_assocTool);
-      return sc;
-    }
-
     StoreGateSvc* detStore=0;
     sc = serviceLocator()->service("DetectorStore", detStore);
 
@@ -328,8 +318,6 @@ namespace Muon {
     record( etapatterns, m_CosmicEtaPatternsKey );
     record( combinedpatterns, m_COMBINED_PATTERNSKey );
     
-    if( patterncombinations ) storeCscAssMap( patterncombinations );
-
     return patterncombinations;
   }
 
@@ -1389,43 +1377,6 @@ namespace Muon {
     }
   }
 
-  void MuonHoughPatternFinderTool::storeCscAssMap(const MuonPatternCombinationCollection* combinedpatterns) const
-  {
-    //Muon::MuonSegPatAssMap* cscAssMap = new Muon::MuonSegPatAssMap();
-
-    MuonPatternCombinationCollection::const_iterator it = combinedpatterns->begin();
-	for( ; it!=combinedpatterns->end();++it )
-	{
-		std::vector< Muon::MuonPatternChamberIntersect >::const_iterator mpcit = (*it)->chamberData().begin();
-		for (; mpcit!=(*it)->chamberData().end(); ++mpcit)
-		{
-			std::vector< const Trk::PrepRawData* >::const_iterator pit = (*mpcit).prepRawDataVec().begin();
-			for (; pit!=(*mpcit).prepRawDataVec().end(); ++pit)
-			{
-				if (m_cscIdHelper->is_csc((*pit)->identify()))
-				{
-					std::map <const Trk::PrepRawData*, const Muon::MuonSegmentCombination*>::const_iterator cscSegment = m_cschitsegassociation.find(*pit); 
-					if ( cscSegment != m_cschitsegassociation.end())
-					{
-						ATH_MSG_VERBOSE ("Hit CSC Association Found");
-						//cscAssMap->addAssociation( combinedpatterns, *it, m_csc_segments, (*cscSegment).second );
-						m_assocTool->insert( (*cscSegment).second, *it);
-						break;
-					}
-				}
-			}
-		}
-	}
-    // if (evtStore()->record(cscAssMap,m_cscAssoOutputLocation).isSuccess())
-    // {
-    //     msg() << MSG::DEBUG << "stored Csc MuonSegPatAssociations at " << m_cscAssoOutputLocation  << endmsg;
-    // }
-    // else 
-    // {
-    //     msg() << MSG::DEBUG << "Failed to store Csc MuonSegPatAssociations at " << m_cscAssoOutputLocation << endmsg;
-    // }
-  }
-
   void MuonHoughPatternFinderTool::updateRpcMdtStationMap(const Identifier rpcid, const int hit_begin, const int hit_end) const
   {
     //  input is a RPC identifier, begin container and end container
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
index 6d6720e56b7..4aecba904e8 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
@@ -1807,23 +1807,23 @@ namespace Muon {
         HashVec::const_iterator iit_end = hashes.end();
         for( ;iit!=iit_end;++iit ){
           // !?! else if made by Felix
-          if( mdtCont && tech == MuonStationIndex::MDT ) {
+          if( mdtCont && mdtCont->size()>0 && tech == MuonStationIndex::MDT ) {
             MdtPrepDataContainer::const_iterator pos = mdtCont->indexFind(*iit);
             if( pos != mdtCont->end() ) fill(**pos,houghData.hitVec[layerHash]);
           }
-          else if( rpcCont && tech == MuonStationIndex::RPC ) {
+          else if( rpcCont && rpcCont->size()>0 && tech == MuonStationIndex::RPC ) {
             RpcPrepDataContainer::const_iterator pos = rpcCont->indexFind(*iit);
             if( pos != rpcCont->end() ) fill(**pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first]);
           }
-          else if( tgcCont && tech == MuonStationIndex::TGC ) {
+          else if( tgcCont && tgcCont->size()>0 && tech == MuonStationIndex::TGC ) {
             TgcPrepDataContainer::const_iterator pos = tgcCont->indexFind(*iit);
             if( pos != tgcCont->end() ) fill(**pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first],collectionsPerSector.sector);
           }
-          else if( stgcCont && tech == MuonStationIndex::STGC ) {
+          else if( stgcCont && stgcCont->size()>0 && tech == MuonStationIndex::STGC ) {
             sTgcPrepDataContainer::const_iterator pos = stgcCont->indexFind(*iit);
             if( pos != stgcCont->end() ) fill(**pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first],collectionsPerSector.sector);
           }
-          else if( mmCont && tech == MuonStationIndex::MM ) {
+          else if( mmCont && mmCont->size()>0 && tech == MuonStationIndex::MM ) {
             MMPrepDataContainer::const_iterator pos = mmCont->indexFind(*iit);
             if( pos != mmCont->end() ) fill(**pos,houghData.hitVec[layerHash]);
           }
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataCollection.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataCollection.h
index 74761ce22ec..3ab7e3284e1 100755
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataCollection.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataCollection.h
@@ -59,9 +59,9 @@ public:
   typedef Identifier ID;
 
   // identifier of this detector element:
-  virtual Identifier identify() const;
+  virtual Identifier identify() const override final;
 
-  virtual IdentifierHash identifyHash() const;
+  virtual IdentifierHash identifyHash() const override final;
 
   virtual void setIdentifier(Identifier id);
   // plottable
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataCollection.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataCollection.h
index bb9a64a3976..0bfc60db9e1 100755
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataCollection.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataCollection.h
@@ -48,11 +48,11 @@ public:
   typedef Identifier ID;
 
   // identifier of this detector element:
-  virtual Identifier identify() const;
+  Identifier identify() const;
 
-  virtual IdentifierHash identifyHash() const;
+  IdentifierHash identifyHash() const;
 
-  virtual void setIdentifier(Identifier id);
+  void setIdentifier(Identifier id);
   // plottable
   virtual std::string type() const;
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/TgcCoinData.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/TgcCoinData.h
index d92d197da10..fa865de6f17 100755
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/TgcCoinData.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/TgcCoinData.h
@@ -125,16 +125,16 @@ namespace Muon
 		 const bool isPositiveDeltaR);
 
     /// Destructor:
-      virtual ~TgcCoinData();
+      ~TgcCoinData();
       
       /** return OfflineID of Outer Hit */
-      virtual Identifier identify() const;
+      Identifier identify() const;
 
       /** return the identifierHash of Outer Hit*/
-      virtual IdentifierHash identifyHash() const;
+      IdentifierHash identifyHash() const;
 
       /** set the OfflineID of Inner and Outer Hits*/
-      virtual void setIdentifier(Identifier in, Identifier out);
+      void setIdentifier(Identifier in, Identifier out);
 
 
       void setHashAndIndex(unsigned short collHash, unsigned short objIndex);
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt
index 4e691e4fe9c..34042568373 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt
@@ -26,6 +26,7 @@ atlas_depends_on_subdirs( PRIVATE
                           MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker
                           MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces
                           MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerUtils
+			  MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonEDM_AssociationObjects
                           Tracking/TrkDetDescr/TrkSurfaces
                           Tracking/TrkEvent/TrkEventPrimitives
                           Tracking/TrkEvent/TrkParameters
@@ -45,5 +46,5 @@ atlas_add_component( MooSegmentCombinationFinder
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonChamberT0s MuonPattern MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils TrkSurfaces TrkEventPrimitives TrkParameters TrkSegment TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonChamberT0s MuonPattern MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils MuonEDM_AssociationObjects TrkSurfaces TrkEventPrimitives TrkParameters TrkSegment TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces )
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx
index fb26ad2a7a8..9308e8df2b9 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx
@@ -8,7 +8,6 @@
 
 #include "MooSegmentCombinationFinder.h"
 
-#include "MuonRecToolInterfaces/IMuonPatternSegmentAssociationTool.h"
 #include "CscSegmentMakers/ICscSegmentFinder.h"
 #include "MuonRecToolInterfaces/IMuonHoughPatternFinderTool.h"
 #include "MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h"
@@ -47,7 +46,6 @@ Muon::MooSegmentCombinationFinder::MooSegmentCombinationFinder(const std::string
     :
   AthAlgTool(t,n,p),
     m_auditorExecute(false),
-    m_assocTool("Muon::MuonPatternSegmentAssociationTool/MuonPatternSegmentAssociationTool"),
     m_edmPrinter("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
     m_helperTool("Muon::MuonEDMHelperTool/MuonEDMHelperTool"),
     m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"),
@@ -59,10 +57,6 @@ Muon::MooSegmentCombinationFinder::MooSegmentCombinationFinder(const std::string
     m_segmentCombinationCleaner("Muon::MuonSegmentCombinationCleanerTool/MuonSegmentCombinationCleanerTool"),
     m_overlapRemovalTool("Muon::MuonSegmentOverlapRemovalTool/MuonSegmentOverlapRemovalTool"),
     m_segmentSelector("Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool"),
-    m_csc2dLocation("Csc2dSegmentCombinations"),
-    m_csc4dLocation("Csc4dSegmentCombinations"),
-    m_mdtSegmentCombinationLocation("MdtSegmentCombinations"),
-    m_curvedCombinationLocation("CurvedSegmentCombinations"),
     m_nevents(0),
     m_ncsc2SegmentCombinations(0),
     m_ncsc4SegmentCombinations(0),
@@ -88,18 +82,12 @@ Muon::MooSegmentCombinationFinder::MooSegmentCombinationFinder(const std::string
     declareProperty("SegmentCombiner",           m_curvedSegmentCombiner);
     declareProperty("SegmentCombinationCleaner", m_segmentCombinationCleaner);
     declareProperty("SegmentOverlapRemovalTool", m_overlapRemovalTool, "tool to removal overlaps in segment combinations" );
-    declareProperty("PatternAssociationTool", m_assocTool, "tool to keep track of associations between pattern and segment combinations" );
 
     declareProperty("DoCscSegments", m_doCscSegments = true );
     declareProperty("DoMdtSegments", m_doMdtSegments = true );
     declareProperty("DoSegmentCombinations", m_doSegmentCombinations = true );
     declareProperty("DoSegmentCombinationCleaning", m_doSegmentCombinationCleaning = true );
 
-    declareProperty("WriteIntermediateResults",         m_writeAll = false );
-    declareProperty("Csc2dSegmentCombinationLocation",  m_csc2dLocation  );
-    declareProperty("Csc4dSegmentCombinationLocation",  m_csc4dLocation  );
-    declareProperty("MdtSegmentCombinationLocation",    m_mdtSegmentCombinationLocation);
-    declareProperty("CurvedSegmentCombinationLocation", m_curvedCombinationLocation);
     declareProperty("CloneSegments",                    m_cloneSegments = false );
   }
 
@@ -118,11 +106,6 @@ Muon::MooSegmentCombinationFinder::initialize()
     if (AthAlgTool::initialize().isFailure()) return StatusCode::FAILURE;
     m_auditorExecute = dynamic_cast<const BooleanProperty&>(getProperty("AuditTools")).value();
     
-    if( m_assocTool.retrieve().isFailure()){
-      ATH_MSG_FATAL("Could not get " << m_assocTool); 
-      return StatusCode::FAILURE;
-    }
-
     if(m_edmPrinter.retrieve().isFailure()){
       ATH_MSG_FATAL("Could not get " << m_edmPrinter); 
       return StatusCode::FAILURE;
@@ -149,6 +132,10 @@ Muon::MooSegmentCombinationFinder::initialize()
         return StatusCode::FAILURE;
       }
     }
+    else{
+      m_csc2dSegmentFinder.disable();
+      m_csc4dSegmentFinder.disable();
+    }
 
     if( m_doMdtSegments ){
 
@@ -202,11 +189,6 @@ Muon::MooSegmentCombinationFinder::initialize()
       m_segmentCombinationCleaner.disable();
     }
 
-    ATH_CHECK( m_csc2dLocation.initialize() );
-    ATH_CHECK( m_csc4dLocation.initialize() );
-    ATH_CHECK( m_mdtSegmentCombinationLocation.initialize() );
-    ATH_CHECK( m_curvedCombinationLocation.initialize() );
-
     return StatusCode::SUCCESS;
 }
 
@@ -310,7 +292,7 @@ Muon::MooSegmentCombinationFinder::findSegments( const std::vector<const MdtPrep
       // search for MDT segments 
       if (patternCombinations) {
 	auditorBefore( m_patternSegmentMaker );
-	mdtSegmentCombinations = m_patternSegmentMaker->find( *patternCombinations );
+	mdtSegmentCombinations = m_patternSegmentMaker->find( *patternCombinations, &m_segmentPatternMap );
 	auditorAfter( m_patternSegmentMaker, mdtSegmentCombinations );
 	if( msgLvl(MSG::DEBUG) ) printSummary( "MDT segment finding", mdtSegmentCombinations );
       } else {
@@ -340,7 +322,8 @@ Muon::MooSegmentCombinationFinder::findSegments( const std::vector<const MdtPrep
 	auditorBefore( m_curvedSegmentCombiner );
 	curvedSegmentCombinations = m_curvedSegmentCombiner->combineSegments(*mdtSegmentCombinations, 
 									     *csc4dSegmentCombinations, 
-									     *csc2dSegmentCombinations);
+									     *csc2dSegmentCombinations,
+									     &m_segmentPatternMap);
 	auditorAfter( m_curvedSegmentCombiner, curvedSegmentCombinations );
 	if( msgLvl(MSG::DEBUG) ) printSummary( "Segment combining", curvedSegmentCombinations );
 
@@ -355,7 +338,7 @@ Muon::MooSegmentCombinationFinder::findSegments( const std::vector<const MdtPrep
       // clean segment combinations
       if ( finalSegmentCombinations ) {
 	auditorBefore( m_segmentCombinationCleaner );
-	cleanedSegmentCombinations = m_segmentCombinationCleaner->clean(*finalSegmentCombinations);
+	cleanedSegmentCombinations = m_segmentCombinationCleaner->clean(*finalSegmentCombinations, &m_segmentPatternMap);
 	auditorAfter( m_segmentCombinationCleaner, cleanedSegmentCombinations );
 	printSummary( "Segment combination cleaning", cleanedSegmentCombinations );
 
@@ -387,16 +370,18 @@ Muon::MooSegmentCombinationFinder::findSegments( const std::vector<const MdtPrep
 
     // clean up intermediate steps
     if( csc2dSegmentCombinations ) 
-      postProcess( csc2dSegmentCombinations,  m_writeAll, m_csc2dLocation );
+      postProcess( csc2dSegmentCombinations );
 
     if( csc4dSegmentCombinations && finalSegmentCombinations != csc4dSegmentCombinations ) 
-      postProcess( csc4dSegmentCombinations,  m_writeAll, m_csc4dLocation );
+      postProcess( csc4dSegmentCombinations );
 
     if( mdtSegmentCombinations && finalSegmentCombinations != mdtSegmentCombinations ) 
-      postProcess( mdtSegmentCombinations,    m_writeAll, m_mdtSegmentCombinationLocation );
+      postProcess( mdtSegmentCombinations );
 
     if( curvedSegmentCombinations && finalSegmentCombinations != curvedSegmentCombinations )
-      postProcess( curvedSegmentCombinations, m_writeAll, m_curvedCombinationLocation );
+      postProcess( curvedSegmentCombinations );
+
+    m_segmentPatternMap.clear();
     
     Muon::IMooSegmentCombinationFinder::Output* output = new Muon::IMooSegmentCombinationFinder::Output();
     output->patternCombinations = patternCombinations;
@@ -406,34 +391,16 @@ Muon::MooSegmentCombinationFinder::findSegments( const std::vector<const MdtPrep
   }
 
 void 
-Muon::MooSegmentCombinationFinder::postProcess(  MuonSegmentCombinationCollection* col, bool write, SG::WriteHandleKey<MuonSegmentCombinationCollection> &colLocation ) {
-  if( !write ) {
-    // hack to remove old combies before deleting them
-    const IMuonPatternSegmentAssociationTool::AssociationMap& assMap = m_assocTool->map();
-    IMuonPatternSegmentAssociationTool::AssociationMap* noneConstMap = const_cast<IMuonPatternSegmentAssociationTool::AssociationMap*>(&assMap);
-    if( noneConstMap ){
-      MuonSegmentCombinationCollection::const_iterator cit = col->begin();
-      MuonSegmentCombinationCollection::const_iterator cit_end = col->end();
-      for(; cit!=cit_end;++cit ){
-	noneConstMap->erase(*cit);
-      }
-    }
-    delete col;
-    return;
-  }
-
-  if( !col ) col = new MuonSegmentCombinationCollection();
-  
-  SG::WriteHandle<MuonSegmentCombinationCollection> handle(colLocation);
-  if( handle.record(std::unique_ptr<MuonSegmentCombinationCollection> (col)).isSuccess() ){
-    ATH_MSG_VERBOSE("stored MuonSegmentCombinationCollection " << col->size() 
-			   << " at " << colLocation.key());
-  }else{
-    ATH_MSG_ERROR("Failed to store MuonSegmentCombinationCollection at " << colLocation.key());
+Muon::MooSegmentCombinationFinder::postProcess(  MuonSegmentCombinationCollection* col){
+  MuonSegmentCombinationCollection::const_iterator cit = col->begin();
+  MuonSegmentCombinationCollection::const_iterator cit_end = col->end();
+  for(; cit!=cit_end;++cit ){
+    m_segmentPatternMap.erase(*cit);
   }
+  delete col;
+  return;
 }
 
-
 void 
 Muon::MooSegmentCombinationFinder::printStage( std::string stageTag) const {
   ATH_MSG_INFO("Reco stage: " << stageTag);
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h
index 7dbfb7457d9..0b8f1fecc22 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h
@@ -13,6 +13,7 @@
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/ToolHandle.h"
 
+#include "MuonEDM_AssociationObjects/MuonSegmentCombPatternCombAssociationMap.h"
 #include "MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h"
 #include "MuonSegment/MuonSegmentCombinationCollection.h"
 #include "MuonPattern/MuonPatternCombinationCollection.h"
@@ -32,7 +33,6 @@ class MdtIdHelper;
 
 namespace Muon 
 {
-    class IMuonPatternSegmentAssociationTool;
     class IMuonHoughPatternFinderTool;
     class IMuonPatternSegmentMaker;
     class IMuonCurvedSegmentCombiner;
@@ -82,7 +82,7 @@ namespace Muon
       void printSummary( std::string stageTag, const Trk::SegmentCollection* col ) const;
 
       /** helper functions to write out intermediate results */
-      void postProcess(  MuonSegmentCombinationCollection* col, bool write, SG::WriteHandleKey<MuonSegmentCombinationCollection> &colLocation );
+      void postProcess(  MuonSegmentCombinationCollection* col);
 
       /** extract a segment collection from a segment combination collection */
       void extractSegmentCollection( const MuonSegmentCombinationCollection& combiCol, Trk::SegmentCollection& segments  ) const;
@@ -113,7 +113,6 @@ namespace Muon
       bool                                            m_doSegmentCombinationCleaning; //<! run segment combination cleaning
       bool                                            m_auditorExecute; //<! audit the subtools during "execute"
       
-      ToolHandle<IMuonPatternSegmentAssociationTool> m_assocTool;
       ToolHandle<MuonEDMPrinterTool>                 m_edmPrinter;
       ToolHandle<MuonEDMHelperTool>                  m_helperTool;
       ToolHandle<MuonIdHelperTool>                   m_idHelperTool;
@@ -126,11 +125,7 @@ namespace Muon
       ToolHandle<IMuonSegmentOverlapRemovalTool>     m_overlapRemovalTool;    
       ToolHandle<IMuonSegmentSelectionTool>          m_segmentSelector;    
 
-      bool m_writeAll;
-      SG::WriteHandleKey<MuonSegmentCombinationCollection> m_csc2dLocation;
-      SG::WriteHandleKey<MuonSegmentCombinationCollection> m_csc4dLocation;
-      SG::WriteHandleKey<MuonSegmentCombinationCollection> m_mdtSegmentCombinationLocation;
-      SG::WriteHandleKey<MuonSegmentCombinationCollection> m_curvedCombinationLocation;
+      MuonSegmentCombPatternCombAssociationMap m_segmentPatternMap;
       bool m_cloneSegments;
 
       /** counters */
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx
index 002cf4dd4db..77df574752c 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx
@@ -5,7 +5,6 @@
 #include "MooSegmentFinderAlg.h"
 #include "MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h"
 
-#include "MuonRecToolInterfaces/IMuonPatternSegmentAssociationTool.h"
 #include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinder.h"
 
 #include "MuonSegment/MuonSegment.h"
@@ -28,7 +27,6 @@ MooSegmentFinderAlg::MooSegmentFinderAlg(const std::string& name, ISvcLocator* p
   m_segmentLocation("MooreSegments"),
   m_segmentCombiLocation("MooreSegmentCombinations"),
   m_segmentFinder("Muon::MooSegmentCombinationFinder/MooSegmentCombinationFinder"),
-  m_assocTool("Muon::MuonPatternSegmentAssociationTool/MuonPatternSegmentAssociationTool"),
   m_clusterSegMaker("Muon::MuonClusterSegmentFinder/MuonClusterSegmentFinder")
 {
   declareProperty("UseRPC",m_useRpc = true);
@@ -77,11 +75,6 @@ StatusCode MooSegmentFinderAlg::initialize()
     return StatusCode::FAILURE;
   }
 
-  if (m_assocTool.retrieve().isFailure()){
-    ATH_MSG_FATAL("Could not get " << m_assocTool); 
-    return StatusCode::FAILURE;
-  }
-
   ATH_CHECK( m_keyMdt.initialize(m_useMdt) ); //Nullify key from scheduler if not needed
   ATH_CHECK( m_keyCsc.initialize(m_useCsc) );
   ATH_CHECK( m_keyRpc.initialize(m_useRpc) );
@@ -105,8 +98,6 @@ StatusCode MooSegmentFinderAlg::initialize()
 StatusCode MooSegmentFinderAlg::execute()
 {
 
-  m_assocTool->reset(); // clear all prior associations.
-
   std::vector<const Muon::MdtPrepDataCollection*> mdtCols;
   std::vector<const Muon::CscPrepDataCollection*> cscCols;
   std::vector<const Muon::TgcPrepDataCollection*> tgcCols; 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.h
index 279770dae0e..330722a3d8b 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.h
@@ -24,7 +24,6 @@ class StoreGateSvc;
 
 namespace Muon {
   class IMuonClusterSegmentFinder;
-  class IMuonPatternSegmentAssociationTool;
   class IMooSegmentCombinationFinder;
 }
 
@@ -75,7 +74,6 @@ class MooSegmentFinderAlg : public AthAlgorithm
   SG::WriteHandleKey<MuonSegmentCombinationCollection>   m_segmentCombiLocation;
 
   ToolHandle<Muon::IMooSegmentCombinationFinder> m_segmentFinder;     //<! pointer to the segment finder
-  ToolHandle<Muon::IMuonPatternSegmentAssociationTool> m_assocTool;
   ToolHandle<Muon::IMuonClusterSegmentFinder> m_clusterSegMaker;
 
 };
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h
index 6b5a3b0e390..3016434a476 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h
@@ -38,8 +38,6 @@ namespace Muon
 {
 
   class MuonEDMPrinterTool;
-  class IMuonPatternSegmentAssociationTool;
-
 
   /** @class MuonCurvedSegmentCombiner 
 
@@ -68,7 +66,8 @@ namespace Muon
     /** INSERT main method here.*/
     MuonSegmentCombinationCollection* combineSegments(    const MuonSegmentCombinationCollection& mdtCombiColl, 
 							  const MuonSegmentCombinationCollection& csc4DCombiColl, 
-							  const MuonSegmentCombinationCollection& csc2DCombiColl);      
+							  const MuonSegmentCombinationCollection& csc2DCombiColl,
+							  MuonSegmentCombPatternCombAssociationMap* segPattMap);
 
     void trackParameters( const Muon::MuonSegment& seg ,double &theta,double &curvature,int &imeth );
     //    void fulltrackParameters( const Muon::MuonSegment& seg ,HepMatrix & T , HepMatrix & CovT ,int &imeth );
@@ -80,11 +79,11 @@ namespace Muon
 
   private:
           
-    MuonSegmentCombinationCollection*  processCombinationCollection(const MuonSegmentCombinationCollection& mdtCombiCol);
-    void processCscCombinationCollection( const MuonSegmentCombinationCollection& cscCombiCol) ;
+    MuonSegmentCombinationCollection*  processCombinationCollection(const MuonSegmentCombinationCollection& mdtCombiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap);
+    void processCscCombinationCollection( const MuonSegmentCombinationCollection& cscCombiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap) ;
     void process2DCscCombinationCollection( const MuonSegmentCombinationCollection& csc2DcombiCol);
 
-    void muonCurvedSegmentCombinations(MuonSegmentCombinationCollection* curvedCombiCol);
+    void muonCurvedSegmentCombinations(MuonSegmentCombinationCollection* curvedCombiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap);
 
     Muon::MCSCSegmentInfo segInfo( const Muon::MuonSegment* seg );
 
@@ -105,8 +104,6 @@ namespace Muon
 
     ToolHandle< MuonEDMPrinterTool> m_printer;
 
-    ToolHandle< IMuonPatternSegmentAssociationTool> m_assocTool;
-
     bool m_debug;    
     bool m_doCosmics;
     bool m_summary;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx
index 6301d5cc55d..d6f23cbf553 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx
@@ -21,7 +21,6 @@
 #include "MuonPattern/MuonPatternCombination.h"
 #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h"
 #include "MuonRecHelperTools/MuonEDMPrinterTool.h"
-#include "MuonRecToolInterfaces/IMuonPatternSegmentAssociationTool.h"
 
 #include "MuonIdHelpers/MdtIdHelper.h"
 #include "MuonIdHelpers/RpcIdHelper.h"
@@ -54,8 +53,7 @@ Muon::MuonCurvedSegmentCombiner::MuonCurvedSegmentCombiner(const std::string& t,
     m_tgcIdHelper(0),
     m_cscIdHelper(0),
     m_mdtIdHelper(0),
-    m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
-    m_assocTool("Muon::MuonPatternSegmentAssociationTool/MuonPatternSegmentAssociationTool")
+    m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool")
 {
     declareInterface<IMuonCurvedSegmentCombiner>(this);
     declareInterface<IMuonSegmentPairFittingTool>(this);
@@ -128,14 +126,6 @@ StatusCode Muon::MuonCurvedSegmentCombiner::initialize()
         return sc;
     }
     
-    sc = m_assocTool.retrieve();
-    if (sc.isSuccess()){
-        ATH_MSG_DEBUG("Retrieved " << m_assocTool );
-    }else{
-        ATH_MSG_FATAL("Could not get " << m_assocTool ); 
-        return sc;
-    }
-
     ATH_MSG_INFO("initialize() successful in " << name() );
     return StatusCode::SUCCESS;
 }
@@ -153,7 +143,8 @@ StatusCode Muon::MuonCurvedSegmentCombiner::finalize()
 MuonSegmentCombinationCollection* 
 Muon::MuonCurvedSegmentCombiner::combineSegments(   const MuonSegmentCombinationCollection& mdtCombiColl, 
                                                     const MuonSegmentCombinationCollection& csc4DCombiColl, 
-                                                    const MuonSegmentCombinationCollection& csc2DCombiColl) 
+                                                    const MuonSegmentCombinationCollection& csc2DCombiColl,
+						    MuonSegmentCombPatternCombAssociationMap* segPattMap) 
 {
     m_segInfoMap.clear();
     m_seg2DCscInfoMap.clear();
@@ -180,7 +171,7 @@ Muon::MuonCurvedSegmentCombiner::combineSegments(   const MuonSegmentCombination
             if( csc4DCombiColl.empty() ) ATH_MSG_INFO(" summarizing input: Csc MuonSegment combinations empty" );
             else ATH_MSG_INFO(" summarizing input: Csc MuonSegment combinations " << std::endl << m_printer->print( csc4DCombiColl ) );
         }
-        processCscCombinationCollection(csc4DCombiColl);
+        processCscCombinationCollection(csc4DCombiColl,segPattMap);
 
         // Csc 2D segments
 
@@ -191,11 +182,12 @@ Muon::MuonCurvedSegmentCombiner::combineSegments(   const MuonSegmentCombination
         process2DCscCombinationCollection(csc2DCombiColl);
     }
 
-    return processCombinationCollection(mdtCombiColl);
+    return processCombinationCollection(mdtCombiColl,segPattMap);
 
 }
 
-MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentCombinationCollection& mdtCol){
+MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentCombinationCollection& mdtCol, 
+												MuonSegmentCombPatternCombAssociationMap* segPattMap){
 
     MuonSegmentCombinationCollection* curvedCombiCol = new MuonSegmentCombinationCollection();
 
@@ -215,9 +207,7 @@ MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombin
 
   // get association to pattern
 
-//        IMuonPatternSegmentAssociationTool::ObjectList combiAssos = m_assocTool->getAssociatedObjects();
-
-        IMuonPatternSegmentAssociationTool::AssociationMapRange range = m_assocTool->find(combi);
+	std::pair<MuonSegmentCombPatternCombAssociationMap::const_iterator, MuonSegmentCombPatternCombAssociationMap::const_iterator> range = segPattMap->equal_range(combi);
         if ((range.first)==(range.second)) {
             ATH_MSG_WARNING("MDT Combination missing from the map - something is wrong! Skip combination");
             continue;
@@ -231,7 +221,7 @@ MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombin
 //        Muon::MuonSegPatAssMap::object_list combiAssos; 
         // if (assMap) {
         //     assMap->getObjects( combi, combiAssos );
-        if( m_assocTool->count(combi) != 1 ){
+        if( segPattMap->count(combi) != 1 ){
             ATH_MSG_INFO(" This MuonSegPatAssMap for MDTs should only have one entry!! ");
         }
 // Take 2D Csc segments
@@ -277,7 +267,7 @@ MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombin
 	  }
 	}
         
-        if ( addedMdtSegments ) muonCurvedSegmentCombinations(curvedCombiCol);
+        if ( addedMdtSegments ) muonCurvedSegmentCombinations(curvedCombiCol,segPattMap);
     }
     if (m_debug) std::cout << " First stage muonCurvedSegmentCombinations " << curvedCombiCol->size() << " Mdt segments " << nmdtsegments << " Csc segments " << ncscsegments << std::endl;
    
@@ -298,12 +288,12 @@ MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombin
         if( !combi ) continue;
 	if (combi->numberOfStations() == 0) continue;
   // get association to pattern
-        IMuonPatternSegmentAssociationTool::AssociationMapRange range = m_assocTool->find(combi);
+	std::pair<MuonSegmentCombPatternCombAssociationMap::const_iterator, MuonSegmentCombPatternCombAssociationMap::const_iterator> range = segPattMap->equal_range(combi);
         if ((range.first)==(range.second)) {
             continue;
         }
         const MuonPatternCombination* pattern = (range.first)->second;
-        if( m_assocTool->count(combi) != 1 ){
+        if( segPattMap->count(combi) != 1 ){
             ATH_MSG_INFO(" This MuonSegPatAssMap for MDTs should only have one entry!! ");
         }
 
@@ -320,12 +310,12 @@ MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombin
 
           if (combi1 == combi) continue;
   // get association to pattern
-          IMuonPatternSegmentAssociationTool::AssociationMapRange range1 = m_assocTool->find(combi1);
+	  std::pair<MuonSegmentCombPatternCombAssociationMap::const_iterator, MuonSegmentCombPatternCombAssociationMap::const_iterator> range1 = segPattMap->equal_range(combi1);
           if ((range1.first)==(range1.second)) {
               continue;
           }
           const MuonPatternCombination* pattern1 = (range1.first)->second;
-          if( m_assocTool->count(combi1) != 1 ){
+          if( segPattMap->count(combi1) != 1 ){
             ATH_MSG_INFO(" This MuonSegPatAssMap for MDTs should only have one entry!! ");
          } 
 
@@ -484,7 +474,7 @@ MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombin
 	    }
 	  }
 	  
-          if ( addedMdtSegments ) muonCurvedSegmentCombinations(curvedCombiCol);
+          if ( addedMdtSegments ) muonCurvedSegmentCombinations(curvedCombiCol,segPattMap);
         }
      }
      if (m_debug) std::cout << " Second stage muonCurvedSegmentCombinations " << curvedCombiCol->size() << std::endl;
@@ -498,7 +488,7 @@ MuonSegmentCombinationCollection* Muon::MuonCurvedSegmentCombiner::processCombin
 }
 
 void
-Muon::MuonCurvedSegmentCombiner::processCscCombinationCollection( const MuonSegmentCombinationCollection& combiCol) {
+Muon::MuonCurvedSegmentCombiner::processCscCombinationCollection( const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap) {
     MuonSegmentCombinationCollection::const_iterator cit = combiCol.begin();
     MuonSegmentCombinationCollection::const_iterator cit_end = combiCol.end();
     for(; cit!=cit_end;++cit ){
@@ -513,7 +503,7 @@ Muon::MuonCurvedSegmentCombiner::processCscCombinationCollection( const MuonSegm
             // if (m_assCscMap) {
             //     m_assCscMap->getObjects( combi, combiAssos );
             // }
-            IMuonPatternSegmentAssociationTool::AssociationMapRange range = m_assocTool->find(combi);
+	  std::pair<MuonSegmentCombPatternCombAssociationMap::const_iterator, MuonSegmentCombPatternCombAssociationMap::const_iterator> range = segPattMap->equal_range(combi);
             if ((range.first)==(range.second)) {
                 ATH_MSG_DEBUG("CSC Combination missing from the map - can happen");
                 return;
@@ -545,8 +535,8 @@ Muon::MuonCurvedSegmentCombiner::processCscCombinationCollection( const MuonSegm
                     Muon::MCSCSegmentInfo info = segInfo(segs[si]);
                     m_segmentIndex++;
                     info.index = m_segmentIndex;
-                    IMuonPatternSegmentAssociationTool::AssociationMap::const_iterator ia_it = range.first;
-                    IMuonPatternSegmentAssociationTool::AssociationMap::const_iterator ia_it_end = range.second;
+                    MuonSegmentCombPatternCombAssociationMap::const_iterator ia_it = range.first;
+                    MuonSegmentCombPatternCombAssociationMap::const_iterator ia_it_end = range.second;
                     for(; ia_it != ia_it_end; ++ia_it){
                       info.patPointers.push_back((*ia_it).second);
                     }
@@ -601,7 +591,7 @@ Muon::MuonCurvedSegmentCombiner::process2DCscCombinationCollection( const MuonSe
     }
 }
 
-void Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombinationCollection* curvedCombiCol) {
+void Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombinationCollection* curvedCombiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap) {
 
   // Strategy for makening trackcandidates: combinations of segments
   // Fill vectors with segment information MCSCSegmentInfo: 
@@ -1294,7 +1284,7 @@ void Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentC
                 }       
 
                 // if (patc) assCurvedMap->addAssociation( patternCol, patc, combiCol, combination );
-                m_assocTool->insert(combination, patc);
+                segPattMap->insert(std::make_pair(combination, patc));
                 
                 curvedCombiCol->push_back( combination );
             }
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h
index 5dc5d7c7569..081bb5e7265 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h
@@ -10,6 +10,7 @@
 
 #include "GaudiKernel/IAlgTool.h"
 #include "MuonSegment/MuonSegmentCombinationCollection.h"
+#include "MuonEDM_AssociationObjects/MuonSegmentCombPatternCombAssociationMap.h"
 
 namespace Muon 
 {
@@ -21,7 +22,8 @@ namespace Muon
 
     virtual MuonSegmentCombinationCollection* combineSegments(  const MuonSegmentCombinationCollection& mdtCombiColl, 
                                                                 const MuonSegmentCombinationCollection& csc4DCombiColl, 
-                                                                const MuonSegmentCombinationCollection& csc2DCombiColl)=0;
+                                                                const MuonSegmentCombinationCollection& csc2DCombiColl,
+								MuonSegmentCombPatternCombAssociationMap* segPattMap)=0;
   };
 
   inline const InterfaceID& Muon::IMuonCurvedSegmentCombiner::interfaceID()
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h
index 73ecc93c2ae..9170361c559 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h
@@ -8,7 +8,7 @@
 #include "GaudiKernel/IAlgTool.h"
 
 #include "MuonSegment/MuonSegmentCombinationCollection.h"
-
+#include "MuonEDM_AssociationObjects/MuonSegmentCombPatternCombAssociationMap.h"
 
 static const InterfaceID IID_IMuonSegmentCombinationCleanerTool("Muon::IMuonSegmentCombinationCleanerTool",1,0);
 
@@ -26,7 +26,7 @@ namespace Muon {
     static const InterfaceID& interfaceID();
 
     /** clean phi hits on a segment combination */
-    virtual MuonSegmentCombinationCollection* clean( const MuonSegmentCombinationCollection& combiCol ) = 0;
+    virtual MuonSegmentCombinationCollection* clean( const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap ) = 0;
 
   };
   
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/CMakeLists.txt
index dc667d18d58..cf533ec19c1 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/CMakeLists.txt
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_depends_on_subdirs( PUBLIC
                           MuonSpectrometer/MuonIdHelpers
                           MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack
                           MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools
+			  MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonEDM_AssociationObjects
                           Tracking/TrkEvent/TrkParameters
                           Tracking/TrkEvent/TrkSegment
                           Tracking/TrkTools/TrkToolInterfaces )
@@ -33,7 +34,7 @@ atlas_add_component( MuonPatternSegmentMaker
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel MuonPattern MuonPrepRawData MuonSegment MuonRecToolInterfaces MuonReadoutGeometry MuonIdHelpersLib MuonRIO_OnTrack MuonRecHelperToolsLib TrkParameters TrkSegment TrkToolInterfaces )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel MuonPattern MuonPrepRawData MuonSegment MuonRecToolInterfaces MuonReadoutGeometry MuonIdHelpersLib MuonRIO_OnTrack MuonRecHelperToolsLib MuonEDM_AssociationObjects TrkParameters TrkSegment TrkToolInterfaces )
 
 # Install files from the package:
 atlas_install_headers( MuonPatternSegmentMaker )
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h
index 013ccde976f..4229755c7d5 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h
@@ -55,7 +55,6 @@ namespace Muon {
   class MuonSegment;
   class MuonIdHelperTool;
   class MuonEDMPrinterTool;
-  class IMuonPatternSegmentAssociationTool;
 
   class MuonPatternSegmentMaker : virtual public IMuonPatternSegmentMaker, public AthAlgTool
   {
@@ -122,7 +121,7 @@ namespace Muon {
 
     MuonSegmentCombination* find( const MuonPatternCombination& pattern ) const;
 
-    MuonSegmentCombinationCollection* find( const MuonPatternCombinationCollection& patternCol ) const;
+    MuonSegmentCombinationCollection* find( const MuonPatternCombinationCollection& patternCol, MuonSegmentCombPatternCombAssociationMap* segPattMap) const;
 
   private:
     void createRegionMap( const MuonPatternCombination& pat, RegionMap& regionMap, bool hasPhiMeasurements ) const;
@@ -155,7 +154,6 @@ namespace Muon {
     ToolHandle<IMuonClusterOnTrackCreator>    m_clusterCreator;  //<! pointer to muon cluster rio ontrack creator
     ToolHandle<MuonEDMPrinterTool>            m_printer;         //<! tool to print EDM objects
     ToolHandle<MuonIdHelperTool>              m_idHelper;    //<! tool to interpret and print Identifiers
-    ToolHandle<IMuonPatternSegmentAssociationTool> m_assocTool;       //<! tool to associate pattern combinations with segment combinations 
 
     bool m_doNtuple; //<! write ntuple for standalone pattern finding
     bool m_doMultiAnalysis; //<! use neighbouring chambers during segment finding
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx
index d6eee453f20..c66820572bc 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx
@@ -2,13 +2,13 @@
 
 #include "MuonRecHelperTools/MuonEDMPrinterTool.h"
 #include "MuonIdHelpers/MuonIdHelperTool.h"
-#include "MuonRecToolInterfaces/IMuonPatternSegmentAssociationTool.h"
 
 #include <iostream>
 #include <sstream>
 #include <vector>
 #include <map>
 #include <set>
+#include <utility>
 
 #include "MuonPattern/MuonPatternChamberIntersect.h"
 
@@ -40,7 +40,6 @@ namespace Muon {
     m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"),
     m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
     m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"),
-    m_assocTool("Muon::MuonPatternSegmentAssociationTool/MuonPatternSegmentAssociationTool"),
     m_keyRpc("RPC_Measurements"),
     m_keyTgc("TGC_Measurements")
   {
@@ -105,7 +104,7 @@ namespace Muon {
   }
 
 
-  MuonSegmentCombinationCollection* MuonPatternSegmentMaker::find( const MuonPatternCombinationCollection& patterns ) const {
+  MuonSegmentCombinationCollection* MuonPatternSegmentMaker::find( const MuonPatternCombinationCollection& patterns, MuonSegmentCombPatternCombAssociationMap* segPattMap ) const {
 
     if( m_recoverTriggerHits ) retrieveTriggerHitContainers();
   
@@ -126,7 +125,7 @@ namespace Muon {
       combiCol->push_back( combi );
 
       // create link between pattern and segment combination
-      m_assocTool->insert( combi, pattern );
+      segPattMap->insert(std::make_pair( combi, pattern) );
 
     } // end loop over patterns
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/CMakeLists.txt
index fca35948c26..c3afd476ae3 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/CMakeLists.txt
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/CMakeLists.txt
@@ -16,7 +16,8 @@ atlas_depends_on_subdirs( PUBLIC
                           MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData
                           MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack
                           MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment
-                          MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces )
+                          MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces 
+			  MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonEDM_AssociationObjects)
 
 # External dependencies:
 find_package( Eigen )
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h
index 44075dbb279..92efbd45ef0 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h
@@ -8,6 +8,7 @@
 #include "GaudiKernel/IAlgTool.h"
 #include "MuonSegment/MuonSegmentCombinationCollection.h"
 #include "MuonPattern/MuonPatternCombinationCollection.h"
+#include "MuonEDM_AssociationObjects/MuonSegmentCombPatternCombAssociationMap.h"
 
 #include <vector>
 
@@ -37,7 +38,7 @@ namespace Muon {
 	@param combiCol a reference to a MuonSegmentCombinationCollection
 	@return a pointer to a vector of tracks, the ownership of the tracks is passed to the client calling the tool.
     */
-    virtual MuonSegmentCombinationCollection* find( const MuonPatternCombinationCollection& patterns ) const = 0;
+    virtual MuonSegmentCombinationCollection* find( const MuonPatternCombinationCollection& patterns, MuonSegmentCombPatternCombAssociationMap* segPattMap ) const = 0;
 
   };
   
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx
index 3c0be8a2c1f..8df7ee9ff8b 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx
@@ -21,7 +21,6 @@
 #include "MuonIdHelpers/MuonIdHelperTool.h"
 #include "MuonIdHelpers/MuonStationIndex.h"
 
-#include "MuonRecToolInterfaces/IMuonPatternSegmentAssociationTool.h"
 #include "MuonSegmentMakerToolInterfaces/IMuonSegmentOverlapRemovalTool.h"
 
 #include "MuonSegmentMakerUtils/MuonSegmentKey.h"
@@ -36,13 +35,11 @@ namespace Muon {
     m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
     m_helperTool("Muon::MuonEDMHelperTool/MuonEDMHelperTool"),
     m_idHelperTool("Muon::MuonIdHelpers/MuonIdHelperTool"),
-    m_overlapRemovalTool("Muon::MuonSegmentOverlapRemovalTool/MuonSegmentOverlapRemovalTool"),
-    m_assocTool("Muon::MuonPatternSegmentAssociationTool/MuonPatternSegmentAssociationTool")
+    m_overlapRemovalTool("Muon::MuonSegmentOverlapRemovalTool/MuonSegmentOverlapRemovalTool")
   {
     declareInterface<IMuonSegmentCombinationCleanerTool>(this);
 
     declareProperty("SegmentOverlapRemovalTool", m_overlapRemovalTool, "tool to removal overlaps in segment combinations" );
-    declareProperty("PatternAssociationTool", m_assocTool, "tool to keep track of associations between pattern and segment combinations" );
     declareProperty("MergeAllCombis", m_mergeAllCombis = false, "merge all combinations into one large combination" );
 
   }
@@ -89,23 +86,16 @@ namespace Muon {
       return sc;
     }
 
-    sc = m_assocTool.retrieve();
-    if (sc.isSuccess()){
-      ATH_MSG_DEBUG("Retrieved " << m_assocTool );
-    }else{
-      ATH_MSG_FATAL("Could not get " << m_assocTool ); 
-      return sc;
-    }
-
     ATH_MSG_VERBOSE("End of Initializing");
     return StatusCode::SUCCESS; 
   }
 
-  MuonSegmentCombinationCollection* MuonSegmentCombinationCleanerTool::clean( const MuonSegmentCombinationCollection& combiCol ){
+  MuonSegmentCombinationCollection* MuonSegmentCombinationCleanerTool::clean( const MuonSegmentCombinationCollection& combiCol,
+									      MuonSegmentCombPatternCombAssociationMap* segPattMap ){
 
     MuonSegmentCombinationCollection* combiCleanCol = new MuonSegmentCombinationCollection;
     
-    cleanAndMergeCombis(combiCol,combiCleanCol);
+    cleanAndMergeCombis(combiCol,combiCleanCol,segPattMap);
     
     return combiCleanCol;
   }
@@ -118,7 +108,8 @@ namespace Muon {
   }
 
   void MuonSegmentCombinationCleanerTool::cleanAndMergeCombis( const MuonSegmentCombinationCollection& combiCol,
-							       MuonSegmentCombinationCollection* combiCleanCol ) {
+							       MuonSegmentCombinationCollection* combiCleanCol,
+							       MuonSegmentCombPatternCombAssociationMap* segPattMap) {
 
     ATH_MSG_DEBUG(" cleaning combis " << combiCol.size() );
 
@@ -190,13 +181,13 @@ namespace Muon {
       if( finalCombi != newCombi ) delete newCombi;
 
       // lookup the patterncombi and add association
-      unsigned int count = m_assocTool->count(originalCombi);
+      unsigned int count = segPattMap->count(originalCombi);
       if(count != 1 ){
 	ATH_MSG_INFO(" This list should only have one entry!! ");
       }else{
-	IMuonPatternSegmentAssociationTool::AssociationMapRange range = m_assocTool->find(originalCombi);
+	std::pair<MuonSegmentCombPatternCombAssociationMap::const_iterator, MuonSegmentCombPatternCombAssociationMap::const_iterator> range = segPattMap->equal_range(originalCombi);
 	const Muon::MuonPatternCombination* pat = (range.first)->second;
-	if( pat ) m_assocTool->insert(finalCombi, pat);
+	if( pat ) segPattMap->insert(std::make_pair(finalCombi, pat));
 	else ATH_MSG_INFO(" The pattern pointer should never be zero!!!! ");
       }
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.h
index 791fcfc3bf1..66ed92623c7 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.h
@@ -25,7 +25,6 @@ namespace Muon {
   class MuonEDMPrinterTool;
   class MuonEDMHelperTool;
   class MuonIdHelperTool;
-  class IMuonPatternSegmentAssociationTool;
   class IMuonSegmentOverlapRemovalTool;
 
   class MuonSegmentCombinationCleanerTool : virtual public IMuonSegmentCombinationCleanerTool, public AthAlgTool
@@ -45,14 +44,15 @@ namespace Muon {
     virtual StatusCode finalize();
 
     /** clean segment combination collections */
-    MuonSegmentCombinationCollection* clean( const MuonSegmentCombinationCollection& combiCol );
+    MuonSegmentCombinationCollection* clean( const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap );
 
     /** remove duplicates from a segment combination, returns a pointer to the original combi if unchanged */
     MuonSegmentCombination* removeDuplicateSegments( MuonSegmentCombination& combi ) const;
 
   private:
     /** remove overlaps between combination and merge combinations with large overlap */
-    void cleanAndMergeCombis( const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombinationCollection* combiCleanCol );
+    void cleanAndMergeCombis( const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombinationCollection* combiCleanCol,
+			      MuonSegmentCombPatternCombAssociationMap* segPattMap );
 
     /** check whether current summary is a subset of the previous once */
     bool subSetOfPrevious( MuonSegmentCombiSummary& summary, std::vector<MuonSegmentCombiSummary>& summaries) const;
@@ -76,7 +76,6 @@ namespace Muon {
     ToolHandle<Muon::MuonEDMHelperTool>  m_helperTool;
     ToolHandle<Muon::MuonIdHelperTool>   m_idHelperTool;
     ToolHandle<IMuonSegmentOverlapRemovalTool> m_overlapRemovalTool;    
-    ToolHandle<IMuonPatternSegmentAssociationTool> m_assocTool;
 
     /** If set to true, all combinaties will be merged into one big one */ 
     bool m_mergeAllCombis;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx
index 36fa7b965dd..f2a3616f00e 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx
@@ -87,7 +87,6 @@ namespace Muon {
     declareProperty( "DoSummary", m_doSummary = false );
     declareProperty( "MuonTrackSelector",   m_trackSelector );
     declareProperty( "HoleRecoveryTool",   m_muonHoleRecoverTool);
-    declareProperty( "WriteMergedSegments", m_writeMergedSegments = false );
     declareProperty( "UseTightSegmentMatching", m_useTightMatching = true );
     declareProperty( "SegmentThreshold", m_segThreshold = 8);
     declareProperty( "OnlyMdtSeeding", m_onlyMDTSeeding = true );
@@ -246,18 +245,6 @@ namespace Muon {
     MuonSegmentCollection theSegments;
     if( !m_segmentMerger.empty() ) {
       theSegments = m_segmentMerger->findDuplicates(coll);
-      if( m_writeMergedSegments){
-        Trk::SegmentCollection* segmentCollection = new Trk::SegmentCollection();
-        for( MuonSegmentCollection::const_iterator sit=theSegments.begin();sit!=theSegments.end();++sit ){
-          segmentCollection->push_back(const_cast<MuonSegment*>(*sit));
-        }
-        if (evtStore()->record(segmentCollection,"MergedMuonSegments").isFailure() ){
-          ATH_MSG_WARNING("failed to recoded MergedMuonSegments");
-          m_constsegmentsToDelete.insert(m_constsegmentsToDelete.end(),theSegments.begin(),theSegments.end());
-        }
-      }else{
-        m_constsegmentsToDelete.insert(m_constsegmentsToDelete.end(),theSegments.begin(),theSegments.end());
-      }
     }else{
       theSegments = coll;
     }
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h
index 0124c2713d2..92ec348c1c8 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h
@@ -175,7 +175,6 @@ namespace Muon {
     bool m_outputSingleStationTracks;
     bool m_combinedSLOverlaps;
     bool m_doSummary;
-    bool m_writeMergedSegments;
     bool m_useTightMatching;
     bool m_onlyMDTSeeding;
     int m_segThreshold;
diff --git a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h
index ba953e68692..f37df4368b1 100644
--- a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h
+++ b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h
@@ -14,6 +14,8 @@
 #include "MuonSimData/CscSimDataCollection.h"
 #include "TrackRecord/TrackRecordCollection.h"
 #include "TrkTrack/TrackCollection.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "GeneratorObjects/McEventCollection.h"
 
 #include <string>
 #include <vector>
@@ -115,15 +117,8 @@ namespace Muon {
     MuonTrackTruth getTruth( const std::vector<const Trk::MeasurementBase*>& measurements,
 			     TruthTreeEntry& truthEntry, bool restrictedTruth ) const;
 
-
-    const TrackRecordCollection* getTruthTrackCollection() const;
-    
-    const MuonSimDataCollection* retrieveTruthCollection( std::string colName ) const;
-
-    const CscSimDataCollection* retrieveCscTruthCollection( std::string colName ) const;
-
-    void addSimDataToTree( const std::string& name ) const;
-    void addCscSimDataToTree( const std::string& name ) const;
+    void addSimDataToTree( const MuonSimDataCollection* simDataCol ) const;
+    void addCscSimDataToTree( const CscSimDataCollection* simDataCol ) const;
 
     void addMdtTruth( MuonTechnologyTruth& trackTruth, const Identifier& id, const Trk::MeasurementBase& meas, 
 		      const MuonSimDataCollection& simCol ) const;
@@ -156,8 +151,10 @@ namespace Muon {
     ToolHandle<Muon::MuonIdHelperTool>           m_idHelperTool;
     ToolHandle<Trk::ITruthTrajectoryBuilder>     m_truthTrajectoryBuilder;
 
-    std::vector<std::string> m_simDataMapNames;
-    std::string m_CSC_SimDataMapName;
+    SG::ReadHandleKey<McEventCollection> m_mcEventColl{this,"McEventCollectionKey","TruthEvent","McEventCollection"};
+    SG::ReadHandleKeyArray<MuonSimDataCollection> m_muonSimData{this,"MuonSimDataNames",{ "MDT_SDO", "RPC_SDO", "TGC_SDO" },"Muon SDO maps"};
+    SG::ReadHandleKey<CscSimDataCollection> m_cscSimData{this,"CSC_SDO_Container","CSC_SDO","CSC SDO"};
+    SG::ReadHandleKey<TrackRecordCollection> m_trackRecord{this,"TrackRecord","MuonEntryLayerFilter","Track Record Collection"};
 
     mutable TruthTree m_truthTree;
     mutable std::vector<TruthTrajectory*> m_truthTrajectoriesToBeDeleted;
diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx
index 59d08b6ec16..0fd525f15f8 100644
--- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx
+++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx
@@ -8,7 +8,6 @@
 #include "MuonRecHelperTools/MuonEDMPrinterTool.h"
 
 #include "TrkToolInterfaces/ITruthTrajectoryBuilder.h"
-#include "GeneratorObjects/McEventCollection.h"
 #include "HepMC/GenEvent.h"
 #include "HepMC/GenParticle.h"
 #include "TrkTruthData/TruthTrajectory.h"
@@ -46,13 +45,11 @@ namespace Muon {
   {
     declareInterface<IMuonTrackTruthTool>(this);
 
-    declareProperty("CSC_SDO_Container",          m_CSC_SimDataMapName = "CSC_SDO" );
     declareProperty("DoSummary",                  m_doSummary = false );
     declareProperty("ManipulateBarCode",          m_manipulateBarCode = false );
     declareProperty("MinHits",                    m_minHits = 4 );
     declareProperty("MatchAllParticles",          m_matchAllParticles = true );
     declareProperty("ConsideredPDGs",             m_pdgsToBeConsidered );
-    m_simDataMapNames = { "MDT_SDO", "RPC_SDO", "TGC_SDO", "STGC_SDO", "MM_SDO" };
   }
 
 
@@ -66,6 +63,11 @@ namespace Muon {
     ATH_CHECK(m_printer.retrieve());
     ATH_CHECK(m_truthTrajectoryBuilder.retrieve());
 
+    ATH_CHECK(m_mcEventColl.initialize());
+    ATH_CHECK(m_muonSimData.initialize());
+    ATH_CHECK(m_cscSimData.initialize());
+    ATH_CHECK(m_trackRecord.initialize());
+
     // add muons 
     if( m_pdgsToBeConsidered.value().empty() ){
       m_selectedPdgs.insert(13);
@@ -158,24 +160,29 @@ namespace Muon {
     
     clear();
 
-    const TrackRecordCollection* truthTrackCol = getTruthTrackCollection();
-    if( !truthTrackCol ) {
+    SG::ReadHandle<TrackRecordCollection> truthTrackCol(m_trackRecord);
+    if(!truthTrackCol.isValid()){
       ATH_MSG_WARNING(" failed to retrieve TrackRecordCollection ");
       return m_truthTree;
     }
-
+    if(!truthTrackCol.isPresent()){
+      ATH_MSG_WARNING("failed to retrieve TrackRecordCollection");
+      return m_truthTree;
+    }
     if( truthTrackCol->empty() ) {
       ATH_MSG_WARNING(" TrackRecordCollection is empty ");
       return m_truthTree;
     }
 
-    const McEventCollection* mcEventCollection = 0;
-    std::string mcLocation = "TruthEvent";
+    SG::ReadHandle<McEventCollection> mcEventCollection(m_mcEventColl);
     const HepMC::GenEvent*    genEvent = 0;
-    if ( evtStore()->contains<McEventCollection>(mcLocation) ) {
-      if( evtStore()->retrieve(mcEventCollection,mcLocation ).isSuccess() ){
+    if(!mcEventCollection.isValid()){
+      ATH_MSG_WARNING("MC event collection not valid");
+    }
+    else{
+      if ( mcEventCollection.isPresent()){
 	if( !mcEventCollection->empty() ) {
-	  ATH_MSG_VERBOSE( "McEventCollection retrieved at location " << mcLocation << " size " << mcEventCollection->size());
+	  ATH_MSG_VERBOSE( "McEventCollection retrieved at location " << m_mcEventColl.key() << " size " << mcEventCollection->size());
 	  if( mcEventCollection->size() == 1 ) genEvent = mcEventCollection ->front();
 	}
       }
@@ -265,10 +272,21 @@ namespace Muon {
     }
     
     // add sim data collections
-    for( const auto& name : m_simDataMapNames ){
-      addSimDataToTree(name);
+    for(SG::ReadHandle<MuonSimDataCollection>& simDataMap : m_muonSimData.makeHandles()){
+      if(!simDataMap.isValid()){
+	ATH_MSG_WARNING(simDataMap.key()<<" not valid");
+	continue;
+      }
+      if(!simDataMap.isPresent()) continue;
+      addSimDataToTree(simDataMap.cptr());
+    }
+    SG::ReadHandle<CscSimDataCollection> cscSimDataMap(m_cscSimData);
+    if(!cscSimDataMap.isValid()){
+      ATH_MSG_WARNING(cscSimDataMap.key()<<" not valid");
+    }
+    else{
+      if(cscSimDataMap.isPresent()) addCscSimDataToTree(cscSimDataMap.cptr());
     }
-    addCscSimDataToTree(m_CSC_SimDataMapName);
 
     unsigned int ngood(0);
     std::vector<int> badBarcodes;
@@ -329,15 +347,7 @@ namespace Muon {
   }
 
 
-  void MuonTrackTruthTool::addSimDataToTree( const std::string& name ) const {
-
-    if( !evtStore()->contains<MuonSimDataCollection>(name) ) return;
-
-    const MuonSimDataCollection* simDataCol = retrieveTruthCollection( name );
-    if( !simDataCol) {
-      ATH_MSG_WARNING(" failed to retrieve MuonSimDataCollection: " << name );
-      return;
-    }
+  void MuonTrackTruthTool::addSimDataToTree( const MuonSimDataCollection* simDataCol ) const {
 
     // loop over sim collection and check whether identifiers are on track
     MuonSimDataCollection::const_iterator it = simDataCol->begin();
@@ -417,15 +427,7 @@ namespace Muon {
     }    
   }
 
-  void MuonTrackTruthTool::addCscSimDataToTree( const std::string& name ) const {
-
-    if( !evtStore()->contains<CscSimDataCollection>(name) ) return;
-
-    const CscSimDataCollection* simDataCol = retrieveCscTruthCollection( name );
-    if( !simDataCol) {
-      ATH_MSG_WARNING(" failed to retrieve MuonSimDataCollection: " << name);
-      return;
-    }
+  void MuonTrackTruthTool::addCscSimDataToTree( const CscSimDataCollection* simDataCol ) const {
 
     // loop over sim collection and check whether identifiers are on track
     CscSimDataCollection::const_iterator it = simDataCol->begin();
@@ -464,46 +466,6 @@ namespace Muon {
     }    
   }
 
-
-  const TrackRecordCollection* MuonTrackTruthTool::getTruthTrackCollection() const {
-    
-    const TrackRecordCollection* truthCollection = 0;
-    std::vector<std::string> locations = { "MuonEntryLayerFilter" };
-    for( const auto& location : locations ){
-      if ( evtStore()->contains<TrackRecordCollection>(location) && evtStore()->retrieve(truthCollection,location ).isSuccess() && !truthCollection->empty() ) {
-        ATH_MSG_VERBOSE("TrackRecordCollection retrieved at location " << location);
-        return truthCollection;
-      }
-      ATH_MSG_VERBOSE("location " << location << " discarded");
-    }
-    return truthCollection;
-  }
-  
-  const MuonSimDataCollection* MuonTrackTruthTool::retrieveTruthCollection( std::string colName ) const {
-    // Retrieve SDO map for this event
-    if(!evtStore()->contains<MuonSimDataCollection>(colName)) return 0;
-
-    const MuonSimDataCollection* truthCol(0);
-    if(!evtStore()->retrieve(truthCol, colName).isSuccess()) {
-      ATH_MSG_VERBOSE("Could NOT find the MuonSimDataMap map key = "<< colName);
-    }	else {
-      ATH_MSG_VERBOSE("Retrieved MuonSimDataCollection for key = " << colName);
-    }
-    return truthCol;
-  }
-
-  const CscSimDataCollection* MuonTrackTruthTool::retrieveCscTruthCollection( std::string colName ) const {
-    // Retrieve SDO map for this event
-    if(!evtStore()->contains<CscSimDataCollection>(colName)) return 0;
-    const CscSimDataCollection* truthCol(0);
-    if(!evtStore()->retrieve(truthCol, colName).isSuccess()) {
-      ATH_MSG_VERBOSE("Could NOT find the CscSimDataMap map key = "<< colName);
-    }	else {
-      ATH_MSG_VERBOSE("Retrieved CscSimDataCollection for key = " << colName);
-    }
-    return truthCol;
-  }
-
   MuonTrackTruth MuonTrackTruthTool::getTruth( const Muon::MuonSegment& segment ) const {
 
     return getTruth(segment.containedMeasurements(),true);
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/src/MuonEventInfoMonTool.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/src/MuonEventInfoMonTool.cxx
index 0d9a2389c67..397b52ec2c2 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/src/MuonEventInfoMonTool.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/src/MuonEventInfoMonTool.cxx
@@ -161,7 +161,7 @@ namespace MuonDQA {
   { 
   
     StatusCode sc = StatusCode::SUCCESS;  
-    const EventInfo* eventInfo;
+    const EventInfo* eventInfo = nullptr;
     ATH_MSG_VERBOSE( "MuonEventInfoMonTool::retrieveEventInfo() called" );
 
    
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h
index 74b7113fc8f..96b4f2b70b5 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h
@@ -75,7 +75,7 @@ class TubeTraversedBySegment {
 // JG remove expensive hardware_name comparison w/ idHash comparison
 // Hope I was careful ;)
 struct TubeTraversedBySegment_cmp {
-  bool operator()(const TubeTraversedBySegment & A, const TubeTraversedBySegment & B) {
+  bool operator()(const TubeTraversedBySegment & A, const TubeTraversedBySegment & B) const {
     if( A.idHash > B.idHash ) {
       return true;
     }
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx
index 043c45fc9f9..e8a29f91a84 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx
@@ -566,11 +566,8 @@ StatusCode MdtRawDataValAlg::fillHistograms()
 	  tp->summaryValue(n_phi, xAOD::numberOfPhiLayers); 
 	  if(ntri_eta+n_phi==0) continue;
 	  
-	  std::vector< const Trk::MeasurementBase* >::const_iterator hit = trk->measurementsOnTrack()->begin();
-	  std::vector< const Trk::MeasurementBase* >::const_iterator hit_end = trk->measurementsOnTrack()->end();
-	  for( ;hit!=hit_end;++hit ){
-	   
-	    const Trk::RIO_OnTrack* rot_from_track = dynamic_cast<const Trk::RIO_OnTrack*>(*hit);
+          for (const Trk::MeasurementBase* hit : *trk->measurementsOnTrack()) {
+	    const Trk::RIO_OnTrack* rot_from_track = dynamic_cast<const Trk::RIO_OnTrack*>(hit);
 	    if(!rot_from_track) continue;
 	    //              rot_from_track->dump(msg());
 	    Identifier rotId = rot_from_track->identify();
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcLv1RawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcLv1RawDataValAlg.h
index 9f2eabbe883..42017686de0 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcLv1RawDataValAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcLv1RawDataValAlg.h
@@ -429,7 +429,7 @@ class TgcLv1RawDataValAlg: public ManagedMonitorToolBase {
     // and other miscellaneous functions
 
     // reads etaroi and phi roi from TgcCoinData
-    void roi2etaphi(Muon::TgcCoinData& cd, //input
+    void roi2etaphi(const Muon::TgcCoinData& cd, //input
 	int& etaroi, int& phiroi);//output
 
     // calculates sector number from phi index and forward/endcap index
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataValAlg.h
index 790910b8f80..675548eaf98 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataValAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataValAlg.h
@@ -44,7 +44,6 @@
 #include <vector>
 #include <map>
 
-using namespace std;
 
 class TFile;
 class Identifier;
@@ -117,20 +116,20 @@ private:
   
   // Vectors of TgcElement ids per chamber, wire/strip, BCID, layer
   // in case of multiple hits from the same channel, only the first is added
-  vector<Identifier> m_hitIdVects[3][2][2][6][48][9];//[pcn][ac][ws][eta][phi48][layer]
+  std::vector<Identifier> m_hitIdVects[3][2][2][6][48][9];//[pcn][ac][ws][eta][phi48][layer]
   
   // Vectors of variables read from the PRD Container
-  vector<int>    m_hitStation[2][2];   //[ac][ws]
-  vector<int>    m_hitLayer[2][2];     //[ac][ws]
-  vector<int>    m_hitChannel[2][2];   //[ac][ws]
-  vector<int>    m_hitSector[2][2];    //[ac][ws]
-  vector<int>    m_hitSectorPhi[2][2]; //[ac][ws]
-  vector<int>    m_hitEtaIndex[2][2];  //[ac][ws]
-  vector<int>    m_hitPhiIndex[2][2];  //[ac][ws]
-  vector<int>    m_hitPhi48[2][2];     //[ac][ws]
-  vector<int>    m_hitPhi4[2][2];      //[ac][ws]
-  vector<double> m_hitPosR[2][2];      //[ac][ws]
-  vector<double> m_hitPosPhi[2][2];    //[ac][ws]
+  std::vector<int>    m_hitStation[2][2];   //[ac][ws]
+  std::vector<int>    m_hitLayer[2][2];     //[ac][ws]
+  std::vector<int>    m_hitChannel[2][2];   //[ac][ws]
+  std::vector<int>    m_hitSector[2][2];    //[ac][ws]
+  std::vector<int>    m_hitSectorPhi[2][2]; //[ac][ws]
+  std::vector<int>    m_hitEtaIndex[2][2];  //[ac][ws]
+  std::vector<int>    m_hitPhiIndex[2][2];  //[ac][ws]
+  std::vector<int>    m_hitPhi48[2][2];     //[ac][ws]
+  std::vector<int>    m_hitPhi4[2][2];      //[ac][ws]
+  std::vector<double> m_hitPosR[2][2];      //[ac][ws]
+  std::vector<double> m_hitPosPhi[2][2];    //[ac][ws]
   
   // read Tgc PRD Container
   void readTgcPrepDataContainer(const Muon::TgcPrepDataContainer *tgc_prep_container, int pcn);
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Functions.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Functions.cxx
index c8ef7120e05..8f6efd6015d 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Functions.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Functions.cxx
@@ -41,7 +41,7 @@ using namespace std;
 ///////////////////////////////////////////////////////////////////////////
 // RoI Eta&Phi extractor function
 void
-TgcLv1RawDataValAlg::roi2etaphi(Muon::TgcCoinData& cd, int& etaroi, int& phiroi){
+TgcLv1RawDataValAlg::roi2etaphi(const Muon::TgcCoinData& cd, int& etaroi, int& phiroi){
   int roi=cd.roi();//[0:147]([0:63])
   //int localeta=roi/4;
 
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx
index 6eb4eeafc23..c47696ac418 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx
@@ -147,7 +147,7 @@ TgcLv1RawDataValAlg::readTgcCoinDataContainer(const Muon::TgcCoinDataContainer*
       for(Muon::TgcCoinDataCollection::const_iterator itc=(*it)->begin();
 	  itc!= itc_end;
 	  ++itc){
-	Muon::TgcCoinData* tcd=*itc;
+	const Muon::TgcCoinData* tcd=*itc;
 
 	// Get Variables from TgcCoinData object
 	int ac = (tcd->isAside()==false);  //isNotAside   a:0, c:1
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Efficiency.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Efficiency.cxx
index 60f52422ef7..351580d0fbf 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Efficiency.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Efficiency.cxx
@@ -376,14 +376,14 @@ TgcRawDataValAlg::bookHistogramsEfficiency(){
 StatusCode
 TgcRawDataValAlg::fillEfficiency(){
 
-  vector<double> LptEta[2][2];//[ws][ac]        Eta associated lpt
-  vector<double> LptPhi[2][2];//[ws][ac]        Phi associated lpt
+  std::vector<double> LptEta[2][2];//[ws][ac]        Eta associated lpt
+  std::vector<double> LptPhi[2][2];//[ws][ac]        Phi associated lpt
 
-  vector<double> EIFIEta[2][2];//[ws][ac]        Eta associated lpt
-  vector<double> EIFIPhi[2][2];//[ws][ac]        Phi associated lpt
+  std::vector<double> EIFIEta[2][2];//[ws][ac]        Eta associated lpt
+  std::vector<double> EIFIPhi[2][2];//[ws][ac]        Phi associated lpt
 
-  //vector<double> MDTSegmentEta[2][3];//[ac][IMO]
-  //vector<double> CSCSegmentEta[2][3];//[ac][IMO]
+  //std::vector<double> MDTSegmentEta[2][3];//[ac][IMO]
+  //std::vector<double> CSCSegmentEta[2][3];//[ac][IMO]
 
   // Retrieve current coincidence container from storegate
   const Muon::TgcCoinDataContainer* tgc_trg_container(0);
@@ -402,7 +402,7 @@ TgcRawDataValAlg::fillEfficiency(){
     for( Muon::TgcCoinDataCollection::const_iterator itc=(*it)->begin();
          itc!= itc_end;
          ++itc){
-      Muon::TgcCoinData* tcd=*itc;
+      const Muon::TgcCoinData* tcd=*itc;
       
       // Only interested in LpT coincidences
       if( tcd->type() == Muon::TgcCoinData::TYPE_TRACKLET ){
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Profile.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Profile.cxx
index 7a9d8aeb2bc..03735622efc 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Profile.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Profile.cxx
@@ -108,8 +108,8 @@ TgcRawDataValAlg::bookHistogramsProfile(){
     
     int n=1;
     
-    string tdname[12] = {"ETphi0","ETphi1","ETphi2","ETphi3","FTphi0","FTphi1",
-                         "EDphi0","EDphi1","EDphi2","EDphi3","FDphi0","FDphi1"};
+    std::string tdname[12] = {"ETphi0","ETphi1","ETphi2","ETphi3","FTphi0","FTphi1",
+                              "EDphi0","EDphi1","EDphi2","EDphi3","FDphi0","FDphi1"};
     for(int sec=1;sec<=12;sec++){
       for(int id=0;id<12;id++){
         ss.str(""); ss << side[ac];
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_JPsi_no_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_JPsi_no_pileup.sh
deleted file mode 100755
index 348b6029316..00000000000
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_JPsi_no_pileup.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_JPsi_no_pileup
-#
-# art-type: grid
-
-Reco_tf.py --maxEvents=500 --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/* --outputAODFile=my.AOD.pool.root --outputNTUP_PHYSVALFile my.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_JPsi_with_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_JPsi_with_pileup.sh
deleted file mode 100755
index f01ac1dfbb3..00000000000
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_JPsi_with_pileup.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_JPsi_with_pileup
-#
-# art-type: grid
-
-Reco_tf.py --maxEvents=500 --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/* --outputAODFile=my.AOD.pool.root --outputNTUP_PHYSVALFile my.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ZPrime_no_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ZPrime_no_pileup.sh
deleted file mode 100755
index bd5a455ff6f..00000000000
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ZPrime_no_pileup.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_ZPrime_no_pileup
-#
-# art-type: grid
-
-Reco_tf.py --maxEvents=500 --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/* --outputAODFile=my.AOD.pool.root --outputNTUP_PHYSVALFile my.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ZPrime_with_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ZPrime_with_pileup.sh
deleted file mode 100755
index 22e04923c57..00000000000
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ZPrime_with_pileup.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_ZPrime_with_pileup
-#
-# art-type: grid
-
-Reco_tf.py --maxEvents=500 --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/* --outputAODFile=my.AOD.pool.root --outputNTUP_PHYSVALFile my.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_Z_no_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_Z_no_pileup.sh
deleted file mode 100755
index 62bb402b739..00000000000
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_Z_no_pileup.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_Z_no_pileup
-#
-# art-type: grid
-
-Reco_tf.py --maxEvents=500 --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/* --outputAODFile=my.AOD.pool.root --outputNTUP_PHYSVALFile my.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_Z_with_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_Z_with_pileup.sh
deleted file mode 100755
index 34cf5d10710..00000000000
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_Z_with_pileup.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_Z_with_pileup
-#
-# art-type: grid
-
-Reco_tf.py --maxEvents=500 --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/* --outputAODFile=my.AOD.pool.root --outputNTUP_PHYSVALFile my.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'	      
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ttbar_no_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ttbar_no_pileup.sh
deleted file mode 100755
index 7b46b8f4b06..00000000000
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ttbar_no_pileup.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_ttbar_no_pileup
-#
-# art-type: grid
-
-Reco_tf.py --maxEvents=500 --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/* --outputAODFile=my.AOD.pool.root --outputNTUP_PHYSVALFile my.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ttbar_with_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ttbar_with_pileup.sh
deleted file mode 100755
index 9314a527e15..00000000000
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_MuonRecRTT_ttbar_with_pileup.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_ttbar_with_pileup
-#
-# art-type: grid
-
-Reco_tf.py --maxEvents=500 --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/* --outputAODFile=my.AOD.pool.root --outputNTUP_PHYSVALFile my.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_jpsi_no_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_jpsi_no_pileup.sh
new file mode 100755
index 00000000000..51731d4af15
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_jpsi_no_pileup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_JPsi_no_pileup
+#
+# art-type: grid
+# art-input: user.zhidong.valid1.424100.Pythia8B_A14_CTEQ6L1_Jpsimu4mu4.RDO.recon.no_pileup.e5112_s3195_tid12019932_01_EXT0
+# art-input-nfiles: 10
+# art-input-split: 10
+
+Reco_tf.py --maxEvents=10000 --inputRDOFile=*.root --outputAODFile=valid1.424100.Pythia8B_A14_CTEQ6L1_Jpsimu4mu4_no_pileup.AOD.pool.root --outputNTUP_PHYSVALFile valid1.424100.Pythia8B_A14_CTEQ6L1_Jpsimu4mu4_no_pileup.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_jpsi_with_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_jpsi_with_pileup.sh
new file mode 100755
index 00000000000..af6c252b755
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_jpsi_with_pileup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_JPsi_with_pileup
+#
+# art-type: grid
+# art-input: valid1.424100.Pythia8B_A14_CTEQ6L1_Jpsimu4mu4.recon.RDO_TRIG.e5112_s3195_r9723_tid12019940_00
+# art-input-nfiles: 10
+# art-input-split: 10
+
+Reco_tf.py --maxEvents=5000 --inputRDOFile=*.root.1 --outputAODFile=valid1.424100.Pythia8B_A14_CTEQ6L1_Jpsimu4mu4_with_pileup.AOD.pool.root --outputNTUP_PHYSVALFile valid1.424100.Pythia8B_A14_CTEQ6L1_Jpsimu4mu4_with_pileup.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_ttbar_no_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_ttbar_no_pileup.sh
new file mode 100755
index 00000000000..203b43f6bf1
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_ttbar_no_pileup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_ttbar_no_pileup
+#
+# art-type: grid
+# art-input: user.zhidong.valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.no_pileup.e4993_s3195_tid12020024_01_EXT0
+# art-input-nfiles: 10
+# art-input-split: 10
+
+Reco_tf.py --maxEvents=10000 --inputRDOFile=*.root --outputAODFile=valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad_no_pileup.AOD.pool.root --outputNTUP_PHYSVALFile valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad_no_pileup.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_ttbar_with_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_ttbar_with_pileup.sh
new file mode 100755
index 00000000000..8f66a09b984
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_ttbar_with_pileup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_ttbar_with_pileup
+#
+# art-type: grid
+# art-input: valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO_TRIG.e4993_s3195_r9723_tid12020031_00
+# art-input-nfiles: 10
+# art-input-split: 10
+
+Reco_tf.py --maxEvents=5000 --inputRDOFile=*.root.1 --outputAODFile=valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad_with_pileup.AOD.pool.root --outputNTUP_PHYSVALFile valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad_with_pileup.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_z_no_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_z_no_pileup.sh
new file mode 100755
index 00000000000..e2c2354f679
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_z_no_pileup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_Z_no_pileup
+#
+# art-type: grid
+# art-input: user.zhidong.valid1.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.no_pileup.e5112_s3195_tid12019815_01_EXT0
+# art-input-nfiles: 10
+# art-input-split: 10
+
+Reco_tf.py --maxEvents=10000 --inputRDOFile=*.root --outputAODFile=valid1.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu_no_pileup.AOD.pool.root --outputNTUP_PHYSVALFile valid1.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu_no_pileup.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_z_with_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_z_with_pileup.sh
new file mode 100755
index 00000000000..079275abfe5
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_z_with_pileup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_Z_with_pileup
+#
+# art-type: grid
+# art-input: valid1.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO_TRIG.e5112_s3195_r9723_tid12019822_00
+# art-input-nfiles: 10
+# art-input-split: 10
+
+Reco_tf.py --maxEvents=5000 --inputRDOFile=*.root.1 --outputAODFile=valid1.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu_with_pileup.AOD.pool.root --outputNTUP_PHYSVALFile valid1.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu_with_pileup.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'	      
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_zprime_no_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_zprime_no_pileup.sh
new file mode 100755
index 00000000000..d8a89d1720d
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_zprime_no_pileup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_ZPrime_no_pileup
+#
+# art-type: grid
+# art-input: user.zhidong.valid1.361405.Sherpa_CT10_Zmumu_Pt280_500_CVetoBVeto.recon.RDO.no_pileup.e5112_s3195_tid12019961_00_EXT0
+# art-input-nfiles: 10
+# art-input-split: 10
+
+Reco_tf.py --maxEvents=10000 --inputRDOFile=*.root --outputAODFile=valid1.361405.Sherpa_CT10_Zmumu_Pt280_500_CVetoBVeto_no_pileup.AOD.pool.root --outputNTUP_PHYSVALFile valid1.361405.Sherpa_CT10_Zmumu_Pt280_500_CVetoBVeto_no_pileup.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_zprime_with_pileup.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_zprime_with_pileup.sh
new file mode 100755
index 00000000000..6e34a03e783
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrecrtt_zprime_with_pileup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# art-description: Run reconstruction on a input RDO file, migrated from RTT job: MuonRecRTT_ZPrime_with_pileup
+#
+# art-type: grid
+# art-input: valid1.361405.Sherpa_CT10_Zmumu_Pt280_500_CVetoBVeto.recon.RDO_TRIG.e5112_s3195_r9723_tid12019967_00
+# art-input-nfiles: 10
+# art-input-split: 10
+
+Reco_tf.py --maxEvents=5000 --inputRDOFile=*.root.1 --outputAODFile=valid1.361405.Sherpa_CT10_Zmumu_Pt280_500_CVetoBVeto_with_pileup.AOD.pool.root --outputNTUP_PHYSVALFile valid1.361405.Sherpa_CT10_Zmumu_Pt280_500_CVetoBVeto_with_pileup.PHYSVAL.root --validationFlags noExample doMuon --preExec 'from RecExConfig.RecFlags  import rec; rec.doTrigger=False; import MuonCombinedRecExample.MuonCombinedRecOnlySetup'
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h
index 502b9f4eeab..33d96021810 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h
@@ -209,7 +209,6 @@ private:
 
   std::string print( const Muon::IMuonTrackTruthTool::TruthTreeEntry& trackTruth ) const;
 
-  void         getEventInfo();
   std::string  eventInfo() const;
   int eventNumber() const;
 
@@ -268,9 +267,10 @@ private:
 
   bool selectPdg( int pdg ) const { return m_selectedPdgs.count(pdg); }
 
-  SG::ReadHandleKey<TrackCollection>         m_trackKey;            //!< Location of the track output location
-  SG::ReadHandleKey<MuonSegmentCombinationCollection>    m_segmentCombiKey;     //!< Location of the segment combination collections
-  xAOD::EventInfo*    m_eventInfo;                //!< pointer to the event info
+  SG::ReadHandleKey<TrackCollection> m_trackKey{this,"TrackInputLocation","MuonSpectrometerTracks","input tracks"};            //!< Location of the track input container
+  SG::ReadHandleKey<MuonSegmentCombinationCollection> m_segmentCombiKey{this,"SegmentLocation","MuonSegments","segments"};     //!< Location of the segments
+  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this,"EventInfoKey","EventInfo","EventInfo key"};
+  const xAOD::EventInfo*    m_eventInfo;                //!< pointer to the event info
 
   // member set by Joboptions 
   int  m_doSummary;
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackStatisticsAlg.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackStatisticsAlg.h
index e95180d83c6..b8cfaf8f762 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackStatisticsAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackStatisticsAlg.h
@@ -7,11 +7,12 @@
 
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "GaudiKernel/ToolHandle.h"
+#include "StoreGate/ReadHandleKeyArray.h"
+#include "TrkTrack/TrackCollection.h"
+#include "TrkTruthData/DetailedTrackTruthCollection.h"
 #include <string>
 #include <fstream>
 
-class MsgStream;
-class StoreGateSvc;
 class MuonTrackStatisticsTool;
 
 class MuonTrackStatisticsAlg : public AthAlgorithm
@@ -26,14 +27,9 @@ class MuonTrackStatisticsAlg : public AthAlgorithm
   StatusCode initialize();
   StatusCode execute();
   StatusCode finalize();
-  //statistics to be counted
-  std::vector<std::string> m_trackLocationList;
   
  private:
 
-    // Cache the StoreGateSvc ptr for efficiency
-    StoreGateSvc*	p_SGevent;
-
     //ToolHandle<Muon::MuonEDMHelperTool>   m_helperTool;
     ToolHandle <MuonTrackStatisticsTool>    m_statisticsTool;
     
@@ -43,12 +39,11 @@ class MuonTrackStatisticsAlg : public AthAlgorithm
     /** output file*/
     std::ofstream  m_fileOutput;  
 
-    int			m_print_level;
     bool                m_writeToFile;
     bool                m_doTruth;
-    MsgStream*          m_log;
-
 
+    SG::ReadHandleKeyArray<TrackCollection> m_trackKeys{this,"TrackLocationList",{"MuonSpectrometerTracks"},"track collections to track"};
+    SG::ReadHandleKeyArray<DetailedTrackTruthCollection> m_truthKeys{this,"TruthTrackLocationList",{"MuonSpectrometerTracksTruth"},"truth track collections"};
 
     void storeTruthTracks(void);
  
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackStatisticsTool.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackStatisticsTool.h
index 47db42a6e2e..508d51bd789 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackStatisticsTool.h
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackStatisticsTool.h
@@ -16,9 +16,6 @@
 
 #include <string>
 
-class MsgStream;
-class StoreGateSvc;
-
 /* namespace Muon { */
 /*   class MuonEDMHelperTool; */
 /* }     */
@@ -96,16 +93,12 @@ public:
     };
 	
 	//function to access tracks and update counters
-	//first version updates all track counters (for all selected algorithms), used by MuonTrackStatisticsAlg
-	//second version updates a single counter
-	//third version updates a single counter with the specified track collection   
-	//(useful for debugging within a reconstruction algorithm)  
-	
-	StatusCode updateTrackCounters() const;
-	StatusCode updateTrackCounters(TrackCounters& counters) const;
+	//First function is an interface to MuonTrackStatisticsAlg, which passes in the retrieved collection from SG and the name, which it uses to find the appropriate counter
+	//The counter and collection are then passed to the 2nd function, which does the updating
+	StatusCode updateTrackCounters(std::string name, const TrackCollection* tracks) const;
 	StatusCode updateTrackCounters(TrackCounters& counters, const TrackCollection& tracks) const;
 	
-	StatusCode updateTruthTrackCounters(TruthTrackCounters& counters) const;
+	StatusCode updateTruthTrackCounters(std::string name,const DetailedTrackTruthCollection* truthMap) const;
 	StatusCode updateTruthTrackCounters(TruthTrackCounters& counters, const DetailedTrackTruthCollection& TruthMap) const;
 	
 	void addTrackCounters( std::string trkLoc ) const;
@@ -114,18 +107,12 @@ public:
 	
 private:
 	
-	// Cache the StoreGateSvc ptr for efficiency
-	
 	// access to Id Helpers
 	ToolHandle<Muon::MuonEDMHelperTool>   m_helperTool;
 	ToolHandle<Trk::ITruthToTrack>        m_truthToTrack;
 	
 	
-    
-	
 	bool                m_doTruth;
-	//bool                m_debug;
-	//bool                m_verbose;
 	
 	mutable std::vector<MuonTrackStatisticsTool::TrackCounters* > m_allCounters;
 	mutable std::vector<MuonTrackStatisticsTool::TruthTrackCounters* > m_allTruthCounters;
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/share/MuonTrackStatistics_jobOptions.py b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/share/MuonTrackStatistics_jobOptions.py
index 0cd442d8de2..43d2f30f787 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/share/MuonTrackStatistics_jobOptions.py
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/share/MuonTrackStatistics_jobOptions.py
@@ -32,11 +32,11 @@ if muonRecFlags.doStandalone():
 
 if rec.doTruth():
    if muonRecFlags.doMoore():
-      MuonTrackStatistics.TrackLocationList += ["MooreTracksTruth"]
+      MuonTrackStatistics.TruthTrackLocationList += ["MooreTracksTruth"]
    if muonRecFlags.doMuonboy():
-      MuonTrackStatistics.TrackLocationList += ["ConvertedMBoyTracksTruth"]
+      MuonTrackStatistics.TruthTrackLocationList += ["ConvertedMBoyTracksTruth"]
    if muonRecFlags.doStandalone(): 
-      MuonTrackStatistics.TrackLocationList += ["MuonSpectrometerTracksTruth"]
+      MuonTrackStatistics.TruthTrackLocationList += ["MuonSpectrometerTracksTruth"]
 
 #MuonTrackStatistics.TrackLocationList += ["ConvertedMuIdCBTracksTruth"]
 #MuonTrackStatistics.TrackLocationList += ["ConvertedStacoTracksTruth"]
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonPerformanceAlg.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonPerformanceAlg.cxx
index 52930ebf929..97a7746da01 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonPerformanceAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonPerformanceAlg.cxx
@@ -19,7 +19,6 @@ MuonPerformanceAlg
 #include "xAODTruth/TruthParticleContainer.h"
 #include "xAODTruth/TruthParticleAuxContainer.h"
 #include "AthenaBaseComps/AthCheckMacros.h"
-#include "MuonRecHelperTools/MuonEDMPrinterTool.h"
 
 #include "xAODMuon/MuonSegmentContainer.h"
 #include "xAODMuon/MuonSegment.h"
@@ -32,18 +31,10 @@ MuonPerformanceAlg::MuonPerformanceAlg(const std::string& name, ISvcLocator* pSv
   : 
   AthAlgorithm(name, pSvcLocator),
   m_writeToFile (false),
-  m_muonsNameKey("Muons"),
   m_nevents(0),
-  m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
-  //m_storeGate(NULL),
-  m_eventInfo(NULL), 
   m_runNumber(0),
   m_eventNumber(0)
 {
-  declareProperty( "MuonContainerName", m_muonsNameKey );
-
-  //m_muonLocationList.push_back("Muons");
-  //declareProperty("MuonLocationList",   m_muonLocationList);
   declareProperty("writeToFile",        m_writeToFile = false);
   declareProperty("FileName",           m_fileName = "MuonPerformanceAlg.txt" );
   declareProperty("ConsideredPDGs",             m_pdgsToBeConsidered );
@@ -73,9 +64,6 @@ StatusCode MuonPerformanceAlg::initialize()
   m_nreco10.resize(nbins);
   m_hitCutString = { "SA 2.0   ", "CB all   ", "MuidCB   ", "MuGirl   ", "Tag      ","Calo     ", "ID       ","SA(no ID)","Tight    ", "Medium   ", "Loose    ","Combined " };
 
-  ATH_CHECK(m_printer.retrieve()); 
-  
-
   // add muons 
   if( m_pdgsToBeConsidered.value().empty() ){
     m_selectedPdgs.insert(13);
@@ -85,6 +73,9 @@ StatusCode MuonPerformanceAlg::initialize()
     for( auto pdg : m_pdgsToBeConsidered.value() ) m_selectedPdgs.insert(pdg);
   }
   if(!m_muonsNameKey.key().empty()) ATH_CHECK(m_muonsNameKey.initialize());
+
+  ATH_CHECK(m_eventInfo.initialize());
+  ATH_CHECK(m_truthMuons.initialize());
   return StatusCode::SUCCESS;
 }
  
@@ -161,16 +152,20 @@ bool MuonPerformanceAlg::passID(const xAOD::TrackParticle* tp, bool debug) const
 StatusCode MuonPerformanceAlg::execute()
 {
 
-  ATH_CHECK(evtStore()->retrieve(m_eventInfo));
+  SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfo);
 
-  m_runNumber = m_eventInfo->runNumber();
-  m_eventNumber = m_eventInfo->eventNumber();
+  m_runNumber = eventInfo->runNumber();
+  m_eventNumber = eventInfo->eventNumber();
 
-  const xAOD::TruthParticleContainer* TruthMuons = evtStore()->tryRetrieve< xAOD::TruthParticleContainer >("MuonTruthParticles");
-  if (!TruthMuons) {
-    ATH_MSG_VERBOSE ("Couldn't retrieve TruthMuons container with key: " << "MuonTruthParticles");
+  SG::ReadHandle<xAOD::TruthParticleContainer> TruthMuons(m_truthMuons);
+  if(!TruthMuons.isPresent()){
+    ATH_MSG_DEBUG("no truth muon collection present");
     return StatusCode::SUCCESS;
   }
+  if(!TruthMuons.isValid()){
+    ATH_MSG_WARNING(m_truthMuons.key()<<" not valid");
+    return StatusCode::FAILURE;
+  }
   ATH_MSG_VERBOSE("Retrieved truth muons " << TruthMuons->size());
   typedef ElementLink< xAOD::MuonContainer > MuonLink;
 
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonPerformanceAlg.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonPerformanceAlg.h
index 43de771c59a..fb84b308d40 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonPerformanceAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonPerformanceAlg.h
@@ -13,13 +13,10 @@
 #include "xAODMuon/Muon.h"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTruth/TruthParticle.h"
-#include "MuonRecHelperTools/MuonEDMPrinterTool.h"
+#include "xAODTruth/TruthParticleContainer.h"
 #include "xAODEventInfo/EventInfo.h"
 #include "xAODMuon/MuonContainer.h"
-
-class StoreGate;
-class StoreGateSvc;
-
+#include "StoreGate/ReadHandleKey.h"
 
 class MuonPerformanceAlg : public AthAlgorithm {
  public:
@@ -48,7 +45,7 @@ class MuonPerformanceAlg : public AthAlgorithm {
   std::ofstream  m_fileOutput;  
 
   // Containers
-  SG::ReadHandleKey<xAOD::MuonContainer> m_muonsNameKey;
+  SG::ReadHandleKey<xAOD::MuonContainer> m_muonsNameKey{this,"MuonContainerName","Muons","muon container"};
   unsigned int                    m_nevents;
   std::vector<std::string>        m_hitCutString;
   std::vector<int>                m_ntruth;
@@ -64,9 +61,8 @@ class MuonPerformanceAlg : public AthAlgorithm {
   std::vector<int>                m_nreco5;
   std::vector<int>                m_nreco10;
 
-  ToolHandle<Muon::MuonEDMPrinterTool> m_printer;
-  //StoreGateSvc*       m_storeGate;
-  const xAOD::EventInfo*    m_eventInfo; 
+  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"EventInfo","EventInfo","event info"};
+  SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthMuons{this,"TruthMuons","MuonTruthParticles","truth muons"};
 
   int m_runNumber;
   int m_eventNumber;
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx
index c5d4ab5f5d2..2cadbaadbb2 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx
@@ -25,8 +25,6 @@
 
 MuonTrackPerformanceAlg::MuonTrackPerformanceAlg(const std::string& name, ISvcLocator* pSvcLocator):
   AthAlgorithm(name,pSvcLocator),
-  m_trackKey("MooreTracks"),
-  m_segmentCombiKey("MooreSegmentCombinations"),
   m_eventInfo(0),
   m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"),
   m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
@@ -60,9 +58,6 @@ MuonTrackPerformanceAlg::MuonTrackPerformanceAlg(const std::string& name, ISvcLo
   m_ntruthTracks(0),
   m_ntruthTracksSecondary(0)
 {
-  // MoMu location segments (per chamner)
-  declareProperty("TrackInputLocation",m_trackKey );
-  declareProperty("SegmentCombitLocation",m_segmentCombiKey );
   declareProperty("DoHistos",m_doHistos = false);
   declareProperty("DoSummary",m_doSummary = 0);
   declareProperty("DoHitResiduals",m_doHitResiduals = 0);
@@ -125,6 +120,7 @@ StatusCode MuonTrackPerformanceAlg::initialize()
 
   ATH_CHECK(m_trackKey.initialize());
   ATH_CHECK(m_segmentCombiKey.initialize());
+  ATH_CHECK(m_eventInfoKey.initialize());
 
   return StatusCode::SUCCESS; 
 }
@@ -134,7 +130,12 @@ StatusCode MuonTrackPerformanceAlg::execute()
   
   if( m_verbose ) *m_log << MSG::VERBOSE << " Executing " << endmsg;
 
-  getEventInfo();
+  SG::ReadHandle<xAOD::EventInfo> evInfo(m_eventInfoKey);
+  if(!evInfo.isValid()){
+    ATH_MSG_WARNING("failed to retrieve EventInfo");
+    return StatusCode::FAILURE;
+  }
+  m_eventInfo=evInfo.cptr();
   handleTracks();
   if( m_doSegments ) handleSegmentCombinations();
 
@@ -604,12 +605,6 @@ StatusCode MuonTrackPerformanceAlg::finalize()
   return StatusCode::SUCCESS;
 }
 
-void MuonTrackPerformanceAlg::getEventInfo() {
-  if ( evtStore()->retrieve(m_eventInfo).isFailure() ) {
-    *m_log << MSG::ERROR << "Could not find eventInfo " << endmsg;
-  }
-}
-
 int MuonTrackPerformanceAlg::eventNumber() const {
   if( !m_eventInfo ) return -1;
   return m_eventInfo->eventNumber();
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsAlg.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsAlg.cxx
index d63ad288245..f9ed3bec4fb 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsAlg.cxx
@@ -23,17 +23,12 @@ MuonTrackStatisticsAlg
 MuonTrackStatisticsAlg::MuonTrackStatisticsAlg(const std::string& name, ISvcLocator* pSvcLocator)
   : 
   AthAlgorithm(name, pSvcLocator),
-  p_SGevent(0),
   m_statisticsTool("MuonTrackStatisticsTool"),
   m_writeToFile (false),
-  m_doTruth     (false),
-  m_log(0)  
+  m_doTruth     (false)
 {
-  declareProperty("TrackLocationList",          m_trackLocationList);
   declareProperty("doTruth",         m_doTruth);
   declareProperty("writeToFile",     m_writeToFile);
-  // printout level (0= no printout, 5=max printout)
-  declareProperty("print_level", m_print_level);
   declareProperty("FileName",               m_fileName);
 
 
@@ -43,27 +38,13 @@ MuonTrackStatisticsAlg::MuonTrackStatisticsAlg(const std::string& name, ISvcLoca
  
 StatusCode MuonTrackStatisticsAlg::initialize()
 {
-  // MSGStream object to output messages from your sub algorithm
-  m_log = new MsgStream(msgSvc(), name());
- 
-  // Locate the StoreGateSvc and initialize our local ptr
-  StatusCode sc = service("StoreGateSvc", p_SGevent);
-  if (!sc.isSuccess() || 0 == p_SGevent) 
-    {
-      *m_log << MSG::ERROR << "MuonTrackStatisticsAlg::initialize() :  Could not find StoreGateSvc" << endmsg;
-      return	sc;
-    }
 
-  sc = m_statisticsTool.retrieve();
-  if (sc.isSuccess()){
-    *m_log<<MSG::INFO << "Retrieved " << m_statisticsTool << endmsg;
-  }else{
-    *m_log<<MSG::ERROR<<"Could not get " << m_statisticsTool <<endmsg; 
-    return sc; 
-  }
+  ATH_CHECK(m_statisticsTool.retrieve());
+  ATH_CHECK(m_trackKeys.initialize());
+  ATH_CHECK(m_truthKeys.initialize());
   
-  int listLength = m_trackLocationList.size();
-  for (int i=0; i<listLength ; i++) m_statisticsTool->addTrackCounters(m_trackLocationList[i]);
+  for (unsigned int i=0; i<m_trackKeys.size() ; i++) m_statisticsTool->addTrackCounters(m_trackKeys[i].key());
+  for (unsigned int i=0; i<m_truthKeys.size() ; i++) m_statisticsTool->addTrackCounters(m_truthKeys[i].key());
     
   return StatusCode::SUCCESS;
 }
@@ -71,10 +52,31 @@ StatusCode MuonTrackStatisticsAlg::initialize()
 StatusCode MuonTrackStatisticsAlg::execute()
 {
   
-  *m_log << MSG::DEBUG << "MuonTrackStatisticsAlg in execute() ..." << endmsg;
+  ATH_MSG_DEBUG("MuonTrackStatisticsAlg in execute() ...");
+
+  for(SG::ReadHandle<TrackCollection>& trackColl : m_trackKeys.makeHandles()){
+    if(!trackColl.isPresent()){
+      ATH_MSG_DEBUG("track collection "<<trackColl.key()<<" not present");
+      continue;
+    }
+    if(!trackColl.isValid()){
+      ATH_MSG_WARNING("track collection "<<trackColl.key()<<" not valid!");
+      return StatusCode::FAILURE;
+    }
+    ATH_CHECK( m_statisticsTool->updateTrackCounters(trackColl.key(),trackColl.cptr()) );
+  }
 
-  StatusCode sc = m_statisticsTool->updateTrackCounters();
-  sc.ignore();
+  for(SG::ReadHandle<DetailedTrackTruthCollection>& truthMap : m_truthKeys.makeHandles()){
+    if(!truthMap.isPresent()){
+      ATH_MSG_DEBUG("truth map "<<truthMap.key()<<" not present");
+      continue;
+    }
+    if(!truthMap.isValid()){
+      ATH_MSG_WARNING("truth map "<<truthMap.key()<<" not valid!");
+      return StatusCode::FAILURE;
+    }
+    m_statisticsTool->updateTruthTrackCounters(truthMap.key(),truthMap.cptr());
+  }
   
   return StatusCode::SUCCESS;
   
@@ -89,7 +91,7 @@ StatusCode MuonTrackStatisticsAlg::finalize()
 
 {
 
-  *m_log << MSG::INFO << std::endl << m_statisticsTool->printTrackCounters() << endmsg;
+  ATH_MSG_INFO(std::endl << m_statisticsTool->printTrackCounters());
 
 
   //write to file
@@ -101,11 +103,6 @@ StatusCode MuonTrackStatisticsAlg::finalize()
     m_fileOutput.close();
   }
 
-
-  
-  delete m_log;
-  
-  
   return StatusCode::SUCCESS;
 }
 
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx
index fbb833f7809..28e338bec36 100644
--- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx
@@ -84,118 +84,21 @@ StatusCode MuonTrackStatisticsTool::finalize() {
 	return StatusCode::SUCCESS;
 }
 
-
-StatusCode MuonTrackStatisticsTool::updateTrackCounters() const{
-	
-	std::vector<MuonTrackStatisticsTool::TrackCounters*>::iterator counter_it = m_allCounters.begin();
-	std::vector<MuonTrackStatisticsTool::TrackCounters*>::iterator counter_itEnd = m_allCounters.end();
-	StatusCode sc = StatusCode::SUCCESS;
-	for (; counter_it!=counter_itEnd ; counter_it++) 
-    {
-		
-		sc = MuonTrackStatisticsTool::updateTrackCounters(**counter_it);
-		if(sc.isFailure()){
-			ATH_MSG_FATAL( "Could not update TrackCounters");
-			return sc;
-		}
+StatusCode MuonTrackStatisticsTool::updateTruthTrackCounters(std::string name, const DetailedTrackTruthCollection* truthMap) const{
+  std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::iterator counterTruth_it = m_allTruthCounters.begin();
+  std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::iterator counterTruth_itEnd = m_allTruthCounters.end();
+  for (; counterTruth_it!=counterTruth_itEnd ; counterTruth_it++){
+    if((*counterTruth_it)->trackLocation.compare(name)==0){
+      return updateTruthTrackCounters(**counterTruth_it,*truthMap);
     }
-	
-	if(m_doTruth){
-		std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::iterator counterTruth_it = m_allTruthCounters.begin();
-		std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::iterator counterTruth_itEnd = m_allTruthCounters.end();
-		for (; counterTruth_it!=counterTruth_itEnd ; counterTruth_it++) 
-		{
-			
-			sc = MuonTrackStatisticsTool::updateTruthTrackCounters(**counterTruth_it);
-			if(sc.isFailure()){
-				ATH_MSG_FATAL( "Could not update TruthTrackCounters");
-				return sc;
-			}
-		}
-	}
-	
-	return sc;
-	
-}
-
-StatusCode MuonTrackStatisticsTool::updateTruthTrackCounters(TruthTrackCounters& counters) const{
-	
-	
-	ATH_MSG_INFO("!updateTruthTrackCounters on:"<<counters.trackLocation);
-	StatusCode sc = StatusCode::SUCCESS;
-	
-	//retrieve tracks
-	const DetailedTrackTruthCollection* TruthMap  = NULL;
-	
-	
-	if (evtStore()->contains<DetailedTrackTruthCollection>( counters.trackLocation)){
-		
-		ATH_MSG_INFO( "Acessing DetailedTrackTruthCollection for Truth" <<  counters.trackLocation);
-		
-		if (counters.trackLocation != "") {
-			if (evtStore()->retrieve (TruthMap , counters.trackLocation).isFailure()) {
-				ATH_MSG_INFO( "DetailedTrackTruthCollection \"" << counters.trackLocation<<"\" not found.");
-				return StatusCode::SUCCESS;
-			}
-		}else {
-			ATH_MSG_INFO( "No DetailedTrackTruthCollection key specified to go with this"<<"TrackCollection!");
-			return StatusCode::SUCCESS;
-		}
-		
-		if (TruthMap) {
-			ATH_MSG_INFO( "Retrieved " << TruthMap->size()<< " TrackTruth elements from storegate");
-			
-			sc = MuonTrackStatisticsTool::updateTruthTrackCounters(counters, *TruthMap);
-		}
-	}else{
-		ATH_MSG_INFO( " Track Collection "  <<  counters.trackLocation << "not available to be retrieved" );
-		++counters.nEvents;
-		
-	}
-	
-	
-	return sc;
-}	
-
-
-
-
-
-
-StatusCode MuonTrackStatisticsTool::updateTrackCounters(TrackCounters& counters) const{
-	
-	ATH_MSG_INFO("!updateTrackCounters on:"<<counters.trackLocation);
-	StatusCode sc = StatusCode::SUCCESS;
-	
-	//retrieve tracks
-	const TrackCollection* tracks = 0;	
-	
-	if (evtStore()->contains<TrackCollection>( counters.trackLocation)){
-		sc = evtStore()->retrieve(tracks,counters.trackLocation);
-		if (sc.isFailure() ) {
-			ATH_MSG_FATAL(" Could not retrieve track collection " << counters.trackLocation);
-			
-		}else{
-			ATH_MSG_INFO(" Number of retrieved tracks = "  << tracks->size());
-			sc = MuonTrackStatisticsTool::updateTrackCounters(counters, *tracks);
-			
-		}
-		
-	}else{
-		ATH_MSG_INFO( " Track Collection "  <<  counters.trackLocation << "not available to be retrieved");
-		++counters.nEvents;
-		
-	}
-	
-	
-	return sc;
-	
+  }
+  ATH_MSG_WARNING("Failed to match the collection "<<name<<" to any counter");
+  return StatusCode::SUCCESS;
 }
 
-
 StatusCode MuonTrackStatisticsTool::updateTruthTrackCounters(TruthTrackCounters& counters,  const DetailedTrackTruthCollection& TruthMap) const{
 	
-	ATH_MSG_INFO( "MuonTrackStatisticsTool calling updateTruthTrackCounters: " << counters.trackLocation);
+	ATH_MSG_DEBUG( "MuonTrackStatisticsTool calling updateTruthTrackCounters: " << counters.trackLocation);
 	
 	++counters.nEvents;
 	
@@ -246,16 +149,16 @@ StatusCode MuonTrackStatisticsTool::updateTruthTrackCounters(TruthTrackCounters&
 		counters.nCSChits[2]+=(*it).second.statsTruth()[SubDetHitStatistics::CSC];
 		
 		
-		ATH_MSG_INFO( myindex << ".) " << "Index: "  <<  (*it).first.index() << "		" << (*it).second << " (Pixel, SCT, TRT, MDT, RPC, TGC, CSC) ");
-		ATH_MSG_INFO( "	GenParticle info:" );
+		ATH_MSG_DEBUG( myindex << ".) " << "Index: "  <<  (*it).first.index() << "		" << (*it).second << " (Pixel, SCT, TRT, MDT, RPC, TGC, CSC) ");
+		ATH_MSG_DEBUG( "	GenParticle info:" );
 		for( unsigned int i=0; i< (*it).second.trajectory().size(); i++) {
-			this->msg( MSG::INFO ) << "		Particle "<<i;
+		  ATH_MSG_DEBUG("		Particle "<<i);
 			if( !(*it).second.trajectory().at(i).cptr() ) {
-				this->msg( MSG::INFO ) << " has a null pointer: "<< (*it).second.trajectory().at(i).cptr() << endmsg;
+			  ATH_MSG_DEBUG( " has a null pointer: "<< (*it).second.trajectory().at(i).cptr());
 			}else{
-				this->msg( MSG::INFO ) << endmsg<< "			- pdg_id: "<< (*it).second.trajectory().at(i).cptr()->pdg_id() << endmsg;
-				this->msg( MSG::INFO ) << "			- status: "<< (*it).second.trajectory().at(i).cptr()->status() << endmsg;
-				counters.nTracks++;
+			  ATH_MSG_DEBUG( "			- pdg_id: "<< (*it).second.trajectory().at(i).cptr()->pdg_id());
+			  ATH_MSG_DEBUG( "			- status: "<< (*it).second.trajectory().at(i).cptr()->status());
+			  counters.nTracks++;
 			}
 			
 		}
@@ -268,9 +171,21 @@ StatusCode MuonTrackStatisticsTool::updateTruthTrackCounters(TruthTrackCounters&
 }
 
 
+StatusCode MuonTrackStatisticsTool::updateTrackCounters(std::string name, const TrackCollection* tracks) const{
+  std::vector<MuonTrackStatisticsTool::TrackCounters*>::iterator counter_it = m_allCounters.begin();
+  std::vector<MuonTrackStatisticsTool::TrackCounters*>::iterator counter_itEnd = m_allCounters.end();
+  for (; counter_it!=counter_itEnd ; counter_it++){
+    if((*counter_it)->trackLocation.compare(name)==0){
+      return updateTrackCounters(**counter_it,*tracks);
+    }
+  }
+  ATH_MSG_WARNING("Failed to match the collection "<<name<<" to any counter");
+  return StatusCode::SUCCESS;
+}
+
 StatusCode MuonTrackStatisticsTool::updateTrackCounters(TrackCounters& counters,  const TrackCollection& tracks) const{
 	
-	ATH_MSG_INFO("MuonTrackStatisticsTool calling updateTrackCounters: " << counters.trackLocation);
+	ATH_MSG_DEBUG("MuonTrackStatisticsTool calling updateTrackCounters: " << counters.trackLocation);
 	
 	++counters.nEvents;
 	
diff --git a/PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.cxx b/PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.cxx
index 9310013931f..e274e41c0b0 100644
--- a/PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.cxx
@@ -55,28 +55,28 @@ namespace FSR {
       for( ; mu_itr != mu_end; ++mu_itr ) {
 
           
-	if ( m_fsrTool->getFsrPhoton(*mu_itr, candidate) ==  CP::CorrectionCode::Ok){
+	if ( m_fsrTool->getFsrPhoton(*mu_itr, m_candidate) ==  CP::CorrectionCode::Ok){
 	  ATH_MSG_INFO( " FSR candidate found !!!!!!!! ");
-	  ATH_MSG_INFO( " container = " << candidate.container
+	  ATH_MSG_INFO( " container = " << m_candidate.container
 			//const xAOD::IParticle* particle;
-			<< " deltaR = " << candidate.deltaR
-			<< " Et = " << candidate.Et
-			<<" f1 = " << candidate.f1
-			<<" eta = " << candidate.eta
-			<<" phi = " << candidate.phi
-			<<" phIso = "<< candidate.phIso
-			<<" fsrtype = " << candidate.type
+			<< " deltaR = " << m_candidate.deltaR
+			<< " Et = " << m_candidate.Et
+			<<" f1 = " << m_candidate.f1
+			<<" eta = " << m_candidate.eta
+			<<" phi = " << m_candidate.phi
+			<<" phIso = "<< m_candidate.phIso
+			<<" fsrtype = " << m_candidate.type
 			);
     	 }
 	
-	if (candidate.container == "photon" ) {
-	  if(const xAOD::Photon* photon = dynamic_cast<const xAOD::Photon*>(candidate.particle)){
+	if (m_candidate.container == "photon" ) {
+	  if(const xAOD::Photon* photon = dynamic_cast<const xAOD::Photon*>(m_candidate.particle)){
 	    fsr_energy = photon->e();
 	  }else{
 	    ATH_MSG_WARNING( "Could not cast to Photon " );
 	  }
-	} else if (candidate.container == "electron" ) {
-	  if(const xAOD::Electron* electron = dynamic_cast<const xAOD::Electron*>(candidate.particle)){
+	} else if (m_candidate.container == "electron" ) {
+	  if(const xAOD::Electron* electron = dynamic_cast<const xAOD::Electron*>(m_candidate.particle)){
 	     fsr_energy = electron->e();
 	  }else{
 	    ATH_MSG_WARNING( "Could not cast to Electron " );
@@ -86,7 +86,7 @@ namespace FSR {
 	}
 	if ( fsr_energy > tmp_energy ) {
 	  tmp_energy = fsr_energy;   
-	  fsr_tlv.SetPtEtaPhiE(candidate.Et, candidate.eta, candidate.phi, fsr_energy);
+	  fsr_tlv.SetPtEtaPhiE(m_candidate.Et, m_candidate.eta, m_candidate.phi, fsr_energy);
 	}
 		
       }
diff --git a/PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h b/PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h
index d7931cf058a..b3e6591b838 100644
--- a/PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h
+++ b/PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h
@@ -41,7 +41,7 @@ namespace FSR {
       /// Connection to the fsr tool
       ToolHandle< IFsrPhotonTool > m_fsrTool;
 
-      FsrCandidate candidate;
+      FsrCandidate m_candidate;
 
    }; // class ToolTester
 
diff --git a/PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/IPMGCrossSectionTool.h b/PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/IPMGCrossSectionTool.h
index 207aa6f911a..9223518c355 100644
--- a/PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/IPMGCrossSectionTool.h
+++ b/PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/IPMGCrossSectionTool.h
@@ -18,14 +18,12 @@ namespace PMGTools {
   struct AllSampleInfo{
     int dsid;
     std::string containerName;
-    double amiXSec;
-    double br;
+    double genXsec;
     double filterEff;
-    double higherOrderXsecTotal;
     double kFactor;
-    double higherOrderXsecSample;
   };
 
+
     
   class IPMGCrossSectionTool : public virtual asg::IAsgTool { 
     
@@ -47,15 +45,12 @@ namespace PMGTools {
     virtual std::string getSampleName(const int dsid) const = 0;
     
     /// return the AMI cross-section for DSID
-    virtual double getAMIXsection(const int dsid) const = 0;
-    
-    /// return the branching ratio for DSID
-    virtual double getBR(const int dsid) const = 0;
+    virtual double getGeneratorXsection(const int dsid) const = 0;
     
     /// return the k-factor for DSID
     virtual double getKfactor(const int dsid) const = 0;
     
-    /// return the sample cross-section for DSID
+    /// return the sample cross-section for DSID (can we find a more descriptive name for this, PMG? /CO)
     virtual double getSampleXsection(const int dsid) const = 0;
     
     /// get a list of the DSID for the loaded samples
@@ -65,4 +60,12 @@ namespace PMGTools {
   
 } // namespace PMGTools
 
+// overload the output operator for the AllSampleInfo object
+std::ostream& operator<<(std::ostream& os, const PMGTools::AllSampleInfo& s) {
+  return os << "Name:          " << s.containerName << std::endl
+	    << "DSID:          " << s.dsid << std::endl
+	    << "Cross section: " << s.genXsec << std::endl
+	    << "k-factor:      " << s.kFactor << std::endl
+	    << "Filter eff.:   " << s.filterEff << std::endl;
+}
 #endif //> !PMGTOOLS_IPMGCROSSSECTIONTOOL_H
diff --git a/PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/PMGCrossSectionTool.h b/PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/PMGCrossSectionTool.h
index 6b77d6198e8..d582759f49f 100644
--- a/PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/PMGCrossSectionTool.h
+++ b/PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/PMGCrossSectionTool.h
@@ -51,24 +51,22 @@ namespace PMGTools {
     std::string getSampleName(const int dsid) const;
     
     /// return the AMI cross-section for DSID
-    double getAMIXsection(const int dsid) const;
+    double getGeneratorXsection(const int dsid) const;
     
-    /// return the branching ratio for DSID
-    double getBR(const int dsid) const;
     
     /// return the k-factor for DSID
-   double getKfactor(const int dsid) const;
+    double getKfactor(const int dsid) const;
    
-   /// return the sample cross-section for DSID
-   double getSampleXsection(const int dsid) const;
+    /// return the sample cross-section for DSID
+    double getSampleXsection(const int dsid) const;
    
-   /// get a list of the DSID for the loaded samples
-   std::vector<int> getLoadedDSIDs() const;
+    /// get a list of the DSID for the loaded samples
+    std::vector<int> getLoadedDSIDs() const;
    
   private:
       
     // store vector of structures, each structure contains full info for DSID
-    std::vector<PMGTools::AllSampleInfo> fStoreSampleInfo;
+    std::map<int,PMGTools::AllSampleInfo> fStoreSampleInfo;
     std::string m_InputFileName;
     
   }; // class PMGCrossSectionTool
diff --git a/PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGCrossSectionTool.cxx b/PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGCrossSectionTool.cxx
index e8ac7528ec1..09d5acb81f6 100644
--- a/PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGCrossSectionTool.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGCrossSectionTool.cxx
@@ -2,13 +2,14 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: PMGCrossSectionTool.cxx 764400 2016-07-26 17:47:39Z tripiana $
+// $Id: PMGCrossSectionTool.cxx 810599 2017-09-22 15:50:07Z cohm $
 
 #include <fstream>
 #include <sstream>
 #include <string>
 #include <TSystem.h>
 #include <TString.h>
+#include <TTree.h>
 #include <iostream>
 #include <stdlib.h>
 
@@ -37,60 +38,45 @@ namespace PMGTools {
 
   bool PMGCrossSectionTool::readInfosFromFiles(std::vector<std::string> InputFiles)
   {
-  
     for (const auto& currentFileName : InputFiles) {
 
       std::ifstream currentFile;
       currentFile.open(currentFileName.c_str());
 
-      std::string line;
-      while (currentFile.good()) {
-
-	getline(currentFile, line);
-      
-	std::istringstream input_line(line);
-	std::string str_dsid;
-	std::string containerName;
-	std::string str_amiXsec;
-	std::string str_br;
-	std::string str_filterEff;
-	std::string str_hoXsec;
-	std::string str_kFac;
-	std::string str_hoSampleXsec;
-      
-	input_line >> str_dsid;
-	input_line >> containerName;
-	input_line >> str_amiXsec;
-	input_line >> str_br;
-	input_line >> str_filterEff;
-	input_line >> str_hoXsec;
-	input_line >> str_kFac;
-	input_line >> str_hoSampleXsec; // this is hoXsec * filter eff
-
-	int dsid = TString(str_dsid).Atoi();
-	double BR           = TString(str_br).Atof();
-	double kFactor      = TString(str_kFac).Atof(); 
-	double filterEff    = TString(str_filterEff).Atof(); 
-	double hoXsec       = TString(str_hoXsec).Atof();
-	double hoSampleXsec = TString(str_hoSampleXsec).Atof();
-	double amiXsec      = TString(str_amiXsec).Atof();
-           
-	AllSampleInfo help;
-	help.dsid = dsid;
-	help.containerName = containerName;
-	help.br = BR;
-	help.amiXSec = amiXsec;
-	help.filterEff = filterEff;
-	help.higherOrderXsecTotal = hoXsec;
-	help.kFactor = kFactor;
-	help.higherOrderXsecSample = hoSampleXsec;
-      
-	fStoreSampleInfo.push_back(help);
+      // use the TTree functionality for reading in text files - easy way to remove
+      // dependency on specific order of the columns in the text file
+      TTree* xsecTree = new TTree();
+      xsecTree->ReadFile(currentFileName.c_str());
       
+      // one branch per variable we care about of the existing ones: DSID/I:DSName/C:GenXsec/D:BR:FilterEff:Xsec:Kfactor:TotSampleXsec
+      int dsid(0);
+      double genXsec(0);      
+      double filterEff(0);
+      double kFactor(0);
+      TBranch* dsidBranch = xsecTree->GetBranch("DSID");
+      dsidBranch->SetAddress(&dsid);
+      TBranch* genXsecBranch = xsecTree->GetBranch("crossSection");
+      genXsecBranch->SetAddress(&genXsec);
+      TBranch* filterEffBranch = xsecTree->GetBranch("genFiltEff");
+      filterEffBranch->SetAddress(&filterEff);
+      TBranch* kFactorBranch = xsecTree->GetBranch("kFactor");
+      kFactorBranch->SetAddress(&kFactor);
+
+      auto nEntries = xsecTree->GetEntries();
+      for (Long64_t i = 0; i < nEntries; i++) {
+	xsecTree->GetEntry(i);
+	AllSampleInfo sample;
+	sample.dsid = dsid;
+	sample.genXsec = genXsec;
+	sample.filterEff = filterEff;
+	sample.kFactor = kFactor;
+	//sample.containerName = containerName;
+	fStoreSampleInfo[sample.dsid] = sample;
       }
+
+      delete xsecTree;
     }
-  
-  
+    
     return true;
   }
 
@@ -131,8 +117,8 @@ namespace PMGTools {
   {
   
     for (const auto& info : fStoreSampleInfo){
-      if(dsid == info.dsid)
-	return info.filterEff;
+      if(dsid == info.second.dsid)
+	return info.second.filterEff;
     }
   
     std::cout << "ERROR::getFilterEff --> Sample with DSID " << dsid << " has no info stored!!! ---> EXIT." << std::endl;
@@ -146,8 +132,8 @@ namespace PMGTools {
   {
   
     for (const auto& info : fStoreSampleInfo){
-      if(dsid == info.dsid)
-	return info.containerName;
+      if(dsid == info.second.dsid)
+	return info.second.containerName;
     }
   
     std::cout << "ERROR::getSampleName --> Sample with DSID " << dsid << " has no info stored!!! ---> EXIT." << std::endl;
@@ -157,40 +143,26 @@ namespace PMGTools {
   }
 
 
-  double PMGCrossSectionTool::getAMIXsection(const int dsid) const
+  double PMGCrossSectionTool::getGeneratorXsection(const int dsid) const
   {
 
     for (const auto& info : fStoreSampleInfo){
-      if(dsid == info.dsid)
-	return info.amiXSec;
+      if(dsid == info.second.dsid)
+	return info.second.genXsec;
     }
 
-    std::cout << "ERROR::getAMIXsection --> Sample with DSID " << dsid << " has no info stored!!! ---> EXIT." << std::endl;
+    std::cout << "ERROR::getGeneratorXsection --> Sample with DSID " << dsid << " has no info stored!!! ---> EXIT." << std::endl;
   
     return -1;
 
   } 
 
-  double PMGCrossSectionTool::getBR(const int dsid) const
-  {
-
-    for (const auto& info : fStoreSampleInfo){
-      if(dsid == info.dsid)
-	return info.br;
-    }
-
-    std::cout << "ERROR::getBR --> Sample with DSID " << dsid << " has no info stored!!! ---> EXIT." << std::endl;
-
-    return -1;
-
-  }
-
   double PMGCrossSectionTool::getKfactor(const int dsid) const
   {
 
     for (const auto& info : fStoreSampleInfo){
-      if(dsid == info.dsid)
-	return info.kFactor;
+      if(dsid == info.second.dsid)
+	return info.second.kFactor;
     }
 
     std::cout << "ERROR::getKfactor --> Sample with DSID " << dsid << " has no info stored!!! ---> EXIT." << std::endl;
@@ -203,8 +175,8 @@ namespace PMGTools {
   {
 
     for (const auto& info : fStoreSampleInfo){
-      if(dsid == info.dsid)
-	return info.higherOrderXsecSample;
+      if(dsid == info.second.dsid)
+	return info.second.genXsec * info.second.kFactor * info.second.filterEff;
     }
 
     std::cout << "ERROR::getSampleXsection --> Sample with DSID " << dsid << " has no info stored!!! ---> EXIT." << std::endl;
@@ -216,7 +188,7 @@ namespace PMGTools {
   std::vector<int> PMGCrossSectionTool::getLoadedDSIDs() const {
     std::vector<int> dsids;
     for (const auto& info : fStoreSampleInfo){
-      dsids.push_back(info.dsid);
+      dsids.push_back(info.second.dsid);
     }
     return dsids;
   }
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/src/testPRWTool.C b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/src/testPRWTool.C
index 856074f06b8..168f8c22cc5 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/src/testPRWTool.C
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/src/testPRWTool.C
@@ -98,7 +98,7 @@ int main() {
    
    try {
     prw_bad->initialize();
-   } catch(std::runtime_error e) {
+   } catch(const std::runtime_error& e) {
     std::cout << "correctly caught:" << e.what() << std::endl;
    }
    
@@ -186,4 +186,4 @@ int main() {
 
 
    return 0;
-}
\ No newline at end of file
+}
diff --git a/PhysicsAnalysis/AnalysisCommon/ReweightUtils/share/ut_ParticleScaleFactorTool_test.ref b/PhysicsAnalysis/AnalysisCommon/ReweightUtils/share/ut_ParticleScaleFactorTool_test.ref
index ca6dbbb78da..dea198d7941 100644
--- a/PhysicsAnalysis/AnalysisCommon/ReweightUtils/share/ut_ParticleScaleFactorTool_test.ref
+++ b/PhysicsAnalysis/AnalysisCommon/ReweightUtils/share/ut_ParticleScaleFactorTool_test.ref
@@ -1,19 +1,7 @@
 ToolSvc.tool1       DEBUG Property update for OutputLevel : new value = 1
-ToolSvc.tool1       DEBUG Detected scale factor h
-ToolSvc.tool1       DEBUG   Parameter blah
 ToolSvc.tool2       DEBUG Property update for OutputLevel : new value = 1
-ToolSvc.tool2       DEBUG Detected scale factor h
-ToolSvc.tool2       DEBUG   Parameter pt/GeV
 ToolSvc.tool3       DEBUG Property update for OutputLevel : new value = 1
-ToolSvc.tool3       DEBUG Detected scale factor h
-ToolSvc.tool3       DEBUG   Parameter pt/GeV
-ToolSvc.tool3       DEBUG Detected scale factor h2
-ToolSvc.tool3       DEBUG Combining Electron: f(pt / GeV,eta) = 2*f(pt / GeV)*f(eta)/[f(pt / GeV)+f(eta)]
-ToolSvc.tool3       DEBUG   Parameter eta
 ToolSvc.tool4       DEBUG Property update for OutputLevel : new value = 1
-ToolSvc.tool4       DEBUG Detected systematic mySyst__1up
-ToolSvc.tool4       DEBUG Detected scale factor h
-ToolSvc.tool4       DEBUG   Parameter pt/GeV
 3
 4
 4.44444
diff --git a/PhysicsAnalysis/AnalysisCommon/ThinningUtils/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/ThinningUtils/CMakeLists.txt
index e5b650f3bc5..289ca2486b1 100644
--- a/PhysicsAnalysis/AnalysisCommon/ThinningUtils/CMakeLists.txt
+++ b/PhysicsAnalysis/AnalysisCommon/ThinningUtils/CMakeLists.txt
@@ -35,6 +35,7 @@ atlas_depends_on_subdirs(
    PhysicsAnalysis/CommonTools/ExpressionEvaluation
    PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces
    Tracking/TrkTools/TrkToolInterfaces	
+   PhysicsAnalysis/MCTruthClassifier	
    ${extra_deps} )
 
 # Component(s) in the package:
@@ -42,7 +43,7 @@ atlas_add_component(ThinningUtils
    src/*.h src/*.cxx src/components/*.cxx
    LINK_LIBRARIES AthLinks AthenaBaseComps AthenaKernel EventInfo xAODBase
    xAODCaloEvent xAODEgamma xAODJet xAODMuon xAODParticleEvent xAODTau
-   xAODTracking xAODTruth GaudiKernel ExpressionEvaluationLib TrkToolInterfaces ${extra_libs})
+   xAODTracking xAODTruth GaudiKernel ExpressionEvaluationLib TrkToolInterfaces MCTruthClassifierLib ${extra_libs})
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/ThinGeantTruthAlg.cxx b/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/ThinGeantTruthAlg.cxx
index 9b7dbb6ca51..81cb709dc8e 100644
--- a/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/ThinGeantTruthAlg.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/ThinGeantTruthAlg.cxx
@@ -27,7 +27,9 @@
 #include "xAODMuon/MuonContainer.h"
 #include "xAODEgamma/ElectronContainer.h"
 #include "xAODEgamma/PhotonContainer.h"
-
+#include "xAODEgamma/PhotonContainer.h"
+#include "xAODEgamma/EgammaTruthxAODHelpers.h"
+#include "MCTruthClassifier/MCTruthClassifierDefs.h"
 // STL includes
 #include <algorithm> 
 
@@ -35,6 +37,9 @@
 #include "GaudiKernel/Property.h"
 #include "GaudiKernel/IJobOptionsSvc.h"
 
+//Standard includes
+#include <cstdlib>
+
 ///////////////////////////////////////////////////////////////////
 // Public methods:
 ///////////////////////////////////////////////////////////////////
@@ -53,6 +58,7 @@ m_truthVerticesKey("TruthVertices"),
 m_muonsKey("Muons"),
 m_electronsKey("Electrons"),
 m_photonsKey("Photons"),
+m_egammaTruthKey("egammaTruthParticles"),
 m_nEventsProcessed(0),
 m_nParticlesProcessed(0),
 m_nVerticesProcessed(0),
@@ -60,7 +66,7 @@ m_nParticlesThinned(0),
 m_nVerticesThinned(0)
 {
    
-    declareProperty("ThinningSvc",          m_thinningSvc,
+    declareProperty("ThinningSvc", m_thinningSvc,
                     "The ThinningSvc instance for a particular output stream" );
     
     declareProperty("ThinGeantTruth", m_doThinning,
@@ -87,6 +93,9 @@ m_nVerticesThinned(0)
     declareProperty("PhotonsKey", m_photonsKey,
                     "StoreGate key for photons container");
 
+    declareProperty("EGammaTruthKey", m_egammaTruthKey,
+                    "StoreGate key for e-gamma truth container");
+
 }
 
 // Destructor
@@ -202,6 +211,43 @@ StatusCode ThinGeantTruthAlg::execute()
         } 
     }
 
+    //Set up the indices for the egamma Truth Particles to keep
+    const xAOD::TruthParticleContainer* egammaTruthParticles(0);
+    if (evtStore()->contains<xAOD::TruthParticleContainer>(m_egammaTruthKey)) {
+      CHECK( evtStore()->retrieve( egammaTruthParticles , m_egammaTruthKey ) );
+    } else {
+      ATH_MSG_WARNING("No e-gamma truth container with key "+m_egammaTruthKey+" found.");
+    }
+
+    std::vector<int> egammaTruthIndices{};
+    if (egammaTruthParticles!=nullptr) {
+
+      for (auto egTruthParticle : *egammaTruthParticles) {
+
+	static const SG::AuxElement::ConstAccessor<int> accType("truthType");
+
+	if(!accType.isAvailable(*egTruthParticle) || 
+	   accType(*egTruthParticle)!=MCTruthPartClassifier::IsoElectron || 
+	   std::abs(egTruthParticle->eta()) > 2.525){
+	  continue;
+	}
+
+
+	//Only central isolated true electrons	
+	typedef ElementLink<xAOD::TruthParticleContainer> TruthLink_t;
+	static SG::AuxElement::ConstAccessor<TruthLink_t> linkToTruth("truthParticleLink");
+	if (!linkToTruth.isAvailable(*egTruthParticle)) {
+	  continue;
+	}
+
+	const TruthLink_t& truthegamma = linkToTruth(*egTruthParticle);
+	if (!truthegamma.isValid()) {
+	  continue;
+	} 
+
+	egammaTruthIndices.push_back( (*truthegamma)->index());
+	}
+    }     
     // Set up masks
     std::vector<bool> particleMask, vertexMask;
     int nTruthParticles = truthParticles->size();
@@ -243,6 +289,7 @@ StatusCode ThinGeantTruthAlg::execute()
                 }        
             }
         }  
+
         // Retain particles and their descendants/ancestors associated with the reconstructed objects
         if ( std::find(recoParticleTruthIndices.begin(), recoParticleTruthIndices.end(), i) != recoParticleTruthIndices.end() ) { 
             if (abs(particle->barcode()) > m_geantOffset) { // only need to do this for Geant particles since non-Geant are kept anyway 
@@ -252,6 +299,13 @@ StatusCode ThinGeantTruthAlg::execute()
                 encounteredBarcodes.clear();
             }
         }
+
+        // Retain particles and their descendants  associated with the egamma Truth Particles
+        if ( std::find(egammaTruthIndices.begin(), egammaTruthIndices.end(), i) != egammaTruthIndices.end() ) { 
+	  descendants(particle,particleMask,encounteredBarcodes);
+	  encounteredBarcodes.clear();
+        }
+
         if (abs(particle->barcode()) < m_geantOffset) {
             particleMask[i] = true;
         }         
diff --git a/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/ThinGeantTruthAlg.h b/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/ThinGeantTruthAlg.h
index ea11eafaea4..15c4eac3059 100644
--- a/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/ThinGeantTruthAlg.h
+++ b/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/ThinGeantTruthAlg.h
@@ -24,10 +24,10 @@
 #include "xAODTruth/TruthParticleContainer.h"
 
 class ThinGeantTruthAlg
-: public ::AthAlgorithm
+  : public ::AthAlgorithm
 {
 public:
-    
+  
     /// Constructor with parameters:
     ThinGeantTruthAlg( const std::string& name, ISvcLocator* pSvcLocator );
     
@@ -73,6 +73,7 @@ private:
     std::string m_muonsKey;
     std::string m_electronsKey;
     std::string m_photonsKey;   
+    std::string m_egammaTruthKey;
  
     /// Counters
     unsigned long m_nEventsProcessed;
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx
index 60c0f4b7040..28be8e13df7 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx
@@ -83,7 +83,7 @@ namespace DerivationFramework {
 	  return StatusCode::FAILURE;
       }
       
-      xAOD::IParticle* pCopy = *pItr;
+      const xAOD::IParticle* pCopy = *pItr;
 
       // this should be computed based on some property of the tool or the existence of the ElectronPhotonShowerShapeFudgeTool
       bool applyFF = (!m_fudgeMCTool.empty());
@@ -109,7 +109,7 @@ namespace DerivationFramework {
 	else if (correctionCode==CP::CorrectionCode::OutOfValidityRange)
 	    Warning("addBranches()","Current photon has no valid fudge factors due to out-of-range");
 	else
-	    Warning("addBranches()",Form("Unknown correction code %d from ElectronPhotonShowerShapeFudgeTool",(int) correctionCode));
+	    Warning("addBranches()","Unknown correction code %d from ElectronPhotonShowerShapeFudgeTool",(int) correctionCode);
       }
 
       // compute the output of the selector
diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/CMakeLists.txt b/PhysicsAnalysis/EventTag/EventTagAlgs/CMakeLists.txt
index bd33cc1be44..700da2aa382 100644
--- a/PhysicsAnalysis/EventTag/EventTagAlgs/CMakeLists.txt
+++ b/PhysicsAnalysis/EventTag/EventTagAlgs/CMakeLists.txt
@@ -13,11 +13,7 @@ atlas_depends_on_subdirs( PUBLIC
                           PhysicsAnalysis/EventTag/TagEvent
                           PRIVATE
                           Control/StoreGate
-                          Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
                           Database/APR/POOLCore
-                          Database/APR/PersistencySvc
-                          Database/APR/StorageSvc
                           Event/xAOD/xAODEventInfo
                           PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent
                           PhysicsAnalysis/ElectronPhotonID/ElectronPhotonTagTools
@@ -45,7 +41,7 @@ atlas_add_component( EventTagAlgs
                      src/EventSplitter.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GaudiKernel TagEvent StoreGateLib SGtests CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc xAODEventInfo AnalysisTriggerEvent ElectronPhotonTagToolsLib EventTagUtilsLib JetMissingEtTagToolsLib MuonTagToolsLib TauTagToolsLib )
+                     LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GaudiKernel TagEvent StoreGateLib SGtests POOLCore xAODEventInfo AnalysisTriggerEvent ElectronPhotonTagToolsLib EventTagUtilsLib JetMissingEtTagToolsLib MuonTagToolsLib TauTagToolsLib )
 
 # Install files from the package:
 atlas_install_headers( EventTagAlgs )
diff --git a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2DPDUtils/python/HSG2D3PD.py b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2DPDUtils/python/HSG2D3PD.py
index 59803bfc92d..0364889bae1 100644
--- a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2DPDUtils/python/HSG2D3PD.py
+++ b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2DPDUtils/python/HSG2D3PD.py
@@ -142,6 +142,7 @@ MissingETD3PDMakerFlags.METDefaultJetPrefix = "jet_AntiKt4LCTopo_MET_" # Change
 MissingETD3PDMakerFlags.METMuonsPrefix = "mu_muon_MET_" # Change mu_MET_ to mu_muon_MET_ 
 from MissingETD3PDMaker.MissingETD3PDObject            import *
 from MissingETD3PDMaker.MissingETD3PDTriggerBitsObject import *
+from MissingET.METRefGetter_plup import *
 
 # Trigger
 from TriggerD3PDMaker.TrigDecisionD3PDObject           import TrigDecisionD3PDObject
@@ -316,7 +317,6 @@ def HSG2physicsD3PD (name,file,
     # For H->ZZ->llqq analysis
     # PhysicsAnalysis/D3PDMaker/PhysicsD3PDMaker/python/SMWZD3PD.py
     if jobproperties.HSG2.doHSG5METInD3PD():
-        from MissingET.METRefGetter_plup import *
         METRefAlg_HSG5 = make_METRefAlg(_suffix='_HSG5')
         METRefAlg_HSG5.sequence                    = AlgSequence( D3PDMakerFlags.PreD3PDAlgSeqName() )
         METRefAlg_HSG5.jet_JetInputCollectionKey   = "AntiKt4TopoEMJets"+JetTagD3PD_CollectionPostfix
diff --git a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2DPDUtils/python/METRefGetter_plup.py b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2DPDUtils/python/METRefGetter_plup.py
index 50cc5481046..9bf07bcdf7c 100644
--- a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2DPDUtils/python/METRefGetter_plup.py
+++ b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2DPDUtils/python/METRefGetter_plup.py
@@ -14,6 +14,8 @@ from AthenaCommon.Constants import *      # Loads DEBUG INFO etc..
 from AthenaCommon.Logging import logging  # loads logger 
 import traceback                          # to allow printout of trace back
 from AthenaCommon.AlgSequence import AlgSequence
+from JetRec.FastJetInterfaceConfig import *
+from EventShapeTools.EventEtClusterDensityConfig import * 
 
 from RecExConfig.Configured import Configured # import base class
 
@@ -542,7 +544,6 @@ class METRefGetter_plup ( Configured ):
             # a la Simoniello/Loch
             
             #from AthenaCommon.AppMgr import ToolSvc
-            from JetRec.FastJetInterfaceConfig import *
 
             ##############################################################
             # Set up FastJet tool for SoftTerm jets for extrapolated rho #
@@ -630,8 +631,7 @@ class METRefGetter_plup ( Configured ):
             	# Use EventShapeTool #
             	######################
             	
-            	from EventShapeTools.EventEtClusterDensityConfig import * 
-            	    
+           	    
             	rhoConfigDict = dict(defaultJetAreaConfigDict)
             	rhoConfigDict['Algorithm']	       = "kt"
             	rhoConfigDict['Radius'] 	       = 0.4
diff --git a/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.cxx b/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.cxx
index 0b5a89c6281..6a728094732 100644
--- a/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.cxx
+++ b/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.cxx
@@ -745,9 +745,13 @@ namespace MissingEtDQA {
     	ATH_MSG_ERROR ( "Failed to retrieve Jet container: " << name_jet << ". Exiting." );
     	return StatusCode::FAILURE;
       }
+      for(auto jet : *jets) {
+	float newjvt = m_jvtTool->updateJvt(*jet); 
+	jet->auxdecor<float>("NewJvt") = newjvt;
+      }
       ConstDataVector<JetContainer> metJets(SG::VIEW_ELEMENTS);
       for(const auto& jet : *jets) {
-	    metJets.push_back(jet);
+	metJets.push_back(jet);
       }
       //Overlap Removal
       ConstDataVector<JetContainer> metJetsOR(SG::VIEW_ELEMENTS);
diff --git a/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/DiMuonTPSelectionTool.cxx b/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/DiMuonTPSelectionTool.cxx
index 279f1e9df41..da2ae785840 100644
--- a/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/DiMuonTPSelectionTool.cxx
+++ b/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/DiMuonTPSelectionTool.cxx
@@ -145,7 +145,7 @@ ProbeContainer* DiMuonTPSelectionTool::selectProbes(const xAOD::MuonContainer* t
     else if (m_TruthMatchedProbe){
         FillCutFlows("Trigger",evtWeight);
         have_tag = true;
-        for(auto & probe : *probes) {
+        for(const xAOD::IParticle* probe : *probes) {
 
             FillCutFlows("TagCandidates",evtWeight);
             FillCutFlows("TagQuality",evtWeight);
@@ -159,7 +159,7 @@ ProbeContainer* DiMuonTPSelectionTool::selectProbes(const xAOD::MuonContainer* t
             FillCutFlows("TagIsolation",evtWeight);
 
             // Add trigger matching info
-            xAOD::Muon* probemu = dynamic_cast<xAOD::Muon*> (probe);
+            const xAOD::Muon* probemu = dynamic_cast<const xAOD::Muon*> (probe);
             if(probemu) {
                 this->TagTriggerMatch(probemu);
                 this->TagTriggerMatch_RerunMode(probemu);
@@ -278,12 +278,12 @@ ProbeContainer* DiMuonTPSelectionTool::selectProbes(const xAOD::MuonContainer* t
                 // remove the probe track matched to the tag
                 if(isTag(tag, probe)) continue;
                 // ID hits
-                xAOD::Muon* probemu = dynamic_cast<xAOD::Muon*> (probe);
+                const xAOD::Muon* probemu = dynamic_cast<const xAOD::Muon*> (probe);
                 if (m_probe_ID_hits && probemu) {
                     if (!m_selection_tool->passedIDCuts(*probemu)) continue;
                 }
                 if (m_IDProbe && m_probe_ID_hits){
-                    xAOD::TrackParticle *trk = dynamic_cast<xAOD::TrackParticle*>(probe);
+                    const xAOD::TrackParticle *trk = dynamic_cast<const xAOD::TrackParticle*>(probe);
                     if (!m_selection_tool->passedIDCuts(*trk)) continue;
                 }
                 FillCutFlows("ProbeQuality",evtWeight);
diff --git a/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/HighPtSingleMuonSelectionTool.cxx b/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/HighPtSingleMuonSelectionTool.cxx
index 55983100028..a2f17ba7655 100644
--- a/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/HighPtSingleMuonSelectionTool.cxx
+++ b/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/HighPtSingleMuonSelectionTool.cxx
@@ -91,12 +91,12 @@ ProbeContainer* HighPtSingleMuonSelectionTool::selectProbes(const xAOD::MuonCont
         FillCutFlows("ProbeKinematics",evtWeight);
 
         // ID hits
-        xAOD::Muon* probemu = dynamic_cast<xAOD::Muon*> (probe);
+        const xAOD::Muon* probemu = dynamic_cast<const xAOD::Muon*> (probe);
 		if (m_probe_ID_hits && probemu) {
 			if (!m_selection_tool->passedIDCuts(*probemu)) continue;
 		}
 		if (!probemu && m_probe_ID_hits) {
-			xAOD::TrackParticle *trk = dynamic_cast<xAOD::TrackParticle*>(probe);
+			const xAOD::TrackParticle *trk = dynamic_cast<const xAOD::TrackParticle*>(probe);
 			if (!m_selection_tool->passedIDCuts(*trk)) continue;
 		}
 		// reject CaloTags failing the Loose WP
diff --git a/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/MuonRecoTPEfficiencyTool.cxx b/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/MuonRecoTPEfficiencyTool.cxx
index f103bc0245d..a271cc44356 100644
--- a/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/MuonRecoTPEfficiencyTool.cxx
+++ b/PhysicsAnalysis/MuonID/MuonPerformanceAnalysis/MuonTPTools/Root/MuonRecoTPEfficiencyTool.cxx
@@ -56,14 +56,14 @@ void MuonRecoTPEfficiencyTool::dRMatching(ProbeContainer* probes, const xAOD::IP
 
 			if (!GoodMatchMuonType(match)) continue;
 
-			xAOD::Muon* matchmuon = dynamic_cast <xAOD::Muon*>(match);
+			const xAOD::Muon* matchmuon = dynamic_cast <const xAOD::Muon*>(match);
 			if (matchmuon && m_do_IDHits){
 				if (!m_selection_tool->passedIDCuts(*matchmuon)) continue;
 			}
 			// ID tracks
 
 			if (m_match_ID){
-				xAOD::TrackParticle *trk = dynamic_cast<xAOD::TrackParticle*>(match);
+				const xAOD::TrackParticle *trk = dynamic_cast<const xAOD::TrackParticle*>(match);
 				if(!trk || (m_do_IDHits && !m_selection_tool->passedIDCuts(*trk))) continue;
 			}
 
@@ -115,14 +115,14 @@ void MuonRecoTPEfficiencyTool::ptrMatching(ProbeContainer* probes, const xAOD::I
 
 			if (!GoodMatchMuonType(match)) continue;
 
-			xAOD::Muon* matchmuon = dynamic_cast <xAOD::Muon*>(match);
+			const xAOD::Muon* matchmuon = dynamic_cast <const xAOD::Muon*>(match);
 			if (matchmuon && m_do_IDHits){
 				if (!m_selection_tool->passedIDCuts(*matchmuon)) continue;
 			}
 
 			// ID tracks
 			if (m_match_ID){
-				xAOD::TrackParticle *trk = dynamic_cast<xAOD::TrackParticle*>(match);
+				const xAOD::TrackParticle *trk = dynamic_cast<const xAOD::TrackParticle*>(match);
 				if(!trk || (m_do_IDHits && !m_selection_tool->passedIDCuts(*trk))) continue;
 				// match MS to ID
 				if (probemuon){
diff --git a/PhysicsAnalysis/MuonID/MuonSelectorTools/Root/MuonSelectionTool.cxx b/PhysicsAnalysis/MuonID/MuonSelectorTools/Root/MuonSelectionTool.cxx
index 4ad7ea57871..6897e0783d9 100644
--- a/PhysicsAnalysis/MuonID/MuonSelectorTools/Root/MuonSelectionTool.cxx
+++ b/PhysicsAnalysis/MuonID/MuonSelectorTools/Root/MuonSelectionTool.cxx
@@ -291,7 +291,7 @@ namespace CP {
 	    static SG::AuxElement::Accessor<float> idPt_acc("InnerDetectorPt");
 	    mePt = mePt_acc(mu);
 	    idPt = idPt_acc(mu);
-	  } catch ( SG::ExcNoAuxStore b ) {
+	  } catch ( const SG::ExcNoAuxStore& b ) {
 	    ATH_MSG_FATAL( "No MomentumCorrections decorations available! MuonSelectionTool can not work!!! " <<
 			   "Please apply MuonMomentumCorrections before feeding the muon to MuonSelectorTools." );
 	    throw std::runtime_error( "No MomentumCorrections decorations available, throwing a runtime error" );
@@ -730,7 +730,7 @@ namespace CP {
 	  static SG::AuxElement::Accessor<float> idPt_acc("InnerDetectorPt");
 	  mePt = mePt_acc(mu);
 	  idPt = idPt_acc(mu);
-	} catch ( SG::ExcNoAuxStore b ) {
+	} catch ( const SG::ExcNoAuxStore& b ) {
 	  ATH_MSG_FATAL( "No MomentumCorrections decorations available! MuonSelectionTool can not work!!! " <<
 			 "Please apply MuonMomentumCorrections before feeding the muon to MuonSelectorTools." );
 	  throw std::runtime_error( "No MomentumCorrections decorations available, throwing a runtime error" );
@@ -902,7 +902,7 @@ namespace CP {
       }
       return ( CaloMuonIDTag > 10 ); 
     }
-    catch (SG::ExcBadAuxVar b) {
+    catch (const SG::ExcBadAuxVar& b) {
       return false; 
     }
   }
diff --git a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMET_jobOptions.py b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMET_jobOptions.py
index 126a0e31dfd..20d4b9a6888 100644
--- a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMET_jobOptions.py
+++ b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMET_jobOptions.py
@@ -16,12 +16,14 @@ tool1.JVTTool = jvtTool
 
 mettoolTopo = CfgMgr.met__METMaker('METMaker_AntiKt4Topo',
                                    JetSelection="Default",
+                                   JetJvtMomentName="NewJvt",
                                    DoPFlow=False)
 ToolSvc += mettoolTopo
 tool1.METMakerTopo = mettoolTopo
 
 mettoolPFlow = CfgMgr.met__METMaker('METMaker_AntiKt4PFlow',
                                     JetSelection="PFlow",
+                                    JetJvtMomentName="NewJvt",
                                     DoPFlow=True)
 ToolSvc += mettoolPFlow
 tool1.METMakerPFlow = mettoolPFlow
diff --git a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValPFlow_jobOptions.py b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValPFlow_jobOptions.py
index 9d8b32cbb55..13ce309403b 100644
--- a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValPFlow_jobOptions.py
+++ b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValPFlow_jobOptions.py
@@ -1,3 +1,7 @@
+#Please note that to access LC PFlow container, one should run the below tool to combine the two neutral containers into one
+#That then puts a new container in StoreGate, which PhysValPFO_neutral could be updated to access
+#from PFlowUtils.PFlowUtilsConf import CombinePFO
+
 from PFODQA.PFODQAConf import PhysValPFO
 
 PhysValPFO_charged = PhysValPFO("PhysValPFO_charged")
@@ -5,11 +9,6 @@ PhysValPFO_charged.OutputLevel = WARNING
 PhysValPFO_charged.DetailLevel = 10
 PhysValPFO_charged.EnableLumi = False
 
-from PFlowUtils.PFlowUtilsConf import CP__RetrievePFOTool
-RetrievePFOTool = CP__RetrievePFOTool()
-ToolSvc += RetrievePFOTool
-PhysValPFO_charged.RetrievePFOTool = RetrievePFOTool
-
 from AthenaCommon.AppMgr import ToolSvc
 ToolSvc += PhysValPFO_charged
 monMan.AthenaMonTools += [ PhysValPFO_charged ]
@@ -19,7 +18,6 @@ PhysValPFO_neutral_EM.OutputLevel = WARNING
 PhysValPFO_neutral_EM.DetailLevel = 10
 PhysValPFO_neutral_EM.EnableLumi = False
 PhysValPFO_neutral_EM.useNeutralPFO = True
-PhysValPFO_neutral_EM.RetrievePFOTool = RetrievePFOTool
 
 ToolSvc += PhysValPFO_neutral_EM
 monMan.AthenaMonTools += [ PhysValPFO_neutral_EM ]
diff --git a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/procedures/RingerProcedureWrapper.icc b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/procedures/RingerProcedureWrapper.icc
index f271a344c71..aad807ff303 100644
--- a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/procedures/RingerProcedureWrapper.icc
+++ b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/procedures/RingerProcedureWrapper.icc
@@ -377,6 +377,7 @@ void getTrackSegmentFromTransformVec(
     case Ringer::TrackCalJointSections:                                        \
       READ_ETA_ET_DEP_WRAPPER(vec, wrapType, Ringer::TrackCalJointSections,    \
           etaDep, etDep, configDir, version)                                   \
+      break;                                                                   \
     default:                                                                   \
       throw std::runtime_error(std::string("Unknown segmentation type"));      \
   }
@@ -426,6 +427,7 @@ void getTrackSegmentFromTransformVec(
       READ_ETA_ET_DEP_WRAPPER(vec, wrapType,                                   \
           Ringer::TrackCalJointSections, etaDep,                               \
           etDep, configDir, version)                                           \
+      break;                                                                   \
     default:                                                                   \
       throw std::runtime_error(std::string("Unknown segmentation type"));      \
   }
diff --git a/PhysicsAnalysis/TauID/TauTrackEvent/TauTrackEvent/TruthTau.h b/PhysicsAnalysis/TauID/TauTrackEvent/TauTrackEvent/TruthTau.h
index 3f84d483929..c0424d733bb 100644
--- a/PhysicsAnalysis/TauID/TauTrackEvent/TauTrackEvent/TruthTau.h
+++ b/PhysicsAnalysis/TauID/TauTrackEvent/TauTrackEvent/TruthTau.h
@@ -213,7 +213,7 @@ protected:
 
 inline bool TauID::TruthTau::type( const TruthTauType& type ) const
 {
-    if ((1<<static_cast<const int>(type))&m_typeFlags) return true;
+    if ((1<<static_cast<int>(type))&m_typeFlags) return true;
     return false;
 }
 
diff --git a/Projects/AthSimulation/externals.txt b/Projects/AthSimulation/externals.txt
index f51859151e7..d84bab384e9 100644
--- a/Projects/AthSimulation/externals.txt
+++ b/Projects/AthSimulation/externals.txt
@@ -9,4 +9,4 @@
 AthSimulationExternalsVersion = 0712e177
 
 # The version of atlas/Gaudi to use:
-GaudiVersion = v30r0.003
+GaudiVersion = v30r1.002
diff --git a/Projects/Athena/externals.txt b/Projects/Athena/externals.txt
index 2a26bab9599..42711ebdb74 100644
--- a/Projects/Athena/externals.txt
+++ b/Projects/Athena/externals.txt
@@ -9,4 +9,4 @@
 AthenaExternalsVersion = 0712e177
 
 # The version of atlas/Gaudi to use: 
-GaudiVersion = v30r0.003
+GaudiVersion = v30r1.002
diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt
index 92ca99f4a50..173b9f0dfe6 100644
--- a/Projects/Athena/package_filters.txt
+++ b/Projects/Athena/package_filters.txt
@@ -20,13 +20,10 @@
 - Generators/Herwigpp_i
 
 # Temporary VP1 compilation issues
-- graphics/VP1/VP1Systems/VP1UtilitySystems
 - graphics/VP1/VP1Systems/VP1TriggerSystems
 - graphics/VP1/VP1Systems/VP12DGeometrySystems
 - graphics/VP1/VP1Systems/VP1MCSystems
-- graphics/VP1/VP1Systems/VP1CaloSystems 
 - graphics/VP1/VP1Systems/VP1TriggerDecisionSystems
-- graphics/VP1/VP1Systems/VP1BPhysSystems
 + graphics/VP1/.*
 
 # Some analysis packages that are not part of Athena
@@ -53,3 +50,6 @@
 - Reconstruction/Jet/JetReclustering
 - Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauMatching
 - Trigger/TrigFTK/FTKStandaloneMonitoring
+
+# obsolete packages to be removed in a second step
+- Tracking/TrkTools/TrkSegmentConverter
diff --git a/Reconstruction/MET/METReconstruction/util/example_METAssoc.cxx b/Reconstruction/MET/METReconstruction/util/example_METAssoc.cxx
deleted file mode 100644
index 979857de407..00000000000
--- a/Reconstruction/MET/METReconstruction/util/example_METAssoc.cxx
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//Author: Matt Klein
-//Email : matthew.henry.klein@cern.ch
-//Date  : March 2015
-
-//this will only run in RootCore
-#ifdef ROOTCORE
-#include "xAODRootAccess/Init.h"
-#include "xAODRootAccess/TEvent.h"
-#include "xAODRootAccess/TStore.h"
-
-// FrameWork includes
-#include "AsgTools/ToolHandle.h"
-#include "AsgTools/AsgTool.h"
-#include "xAODBase/IParticleContainer.h"
-#include "xAODBase/IParticleHelpers.h"
-
-#include "xAODMissingET/MissingETAuxContainer.h"
-#include "xAODMissingET/MissingETAssociationMap.h"
-#include "xAODMissingET/MissingETContainer.h"
-
-#include "xAODCore/ShallowAuxContainer.h"
-#include "xAODCore/ShallowCopy.h"
-
-#include "assert.h"
-#include "TFile.h"
-
-#include "METReconstruction/METAssociationTool.h"
-#include "METReconstruction/METElectronAssociator.h"
-#include "METReconstruction/METPhotonAssociator.h"
-#include "METReconstruction/METTauAssociator.h"
-#include "METReconstruction/METMuonAssociator.h"
-#include "METReconstruction/METJetAssocTool.h"
-#include "METReconstruction/METSoftAssociator.h"
-
-#include "PFlowUtils/RetrievePFOTool.h"
-#include "InDetTrackSelectionTool/InDetTrackSelectionTool.h"
-#include "xAODCaloEvent/CaloClusterChangeSignalState.h"
-
-//The arguments can be used to specify which MET type we want to calculate:
-//arg 1: Tag name
-//arg 2: Jet container name
-//arg 3: isPFlow
-//arg 4: signal state of clusters (EM=0,LC=1)
-//Examples: 
-//To run default LC Reco, call "./example_METAssoc AntiKt4LCTopo AntiKt4LCTopoJets" (default if no args are provided)
-//To run default EM Reco, call "./example_METAssoc AntiKt4EMTopo AntiKt4EMTopoJets 0 0"
-//To run default PF Reco, call "./example_METAssoc AntiKt4EMPFlow AntiKt4EMPFlowJets 1"
-
-
-int main(int argc,char *argv[]){
-
-   // Initialize the application
-  xAOD::Init() ;
-  
-  //enable status code failures
-  StatusCode::enableFailure();
-  xAOD::TReturnCode::enableFailure();
-
-  int signalstate = argc >4 ? std::atoi(argv[4]) : 1;
-  int signalstate_matching = argc >5 ? std::atoi(argv[5]) : signalstate; //only set for experimental purposes
-  bool ispflow     = argc >3 ? std::atoi(argv[3]) : false;
-  std::string jettype = argc >2 ? argv[2] : "AntiKt4LCTopoJets";
-  std::string tag     = argc >1 ? argv[1] : "AntiKt4LCTopo";
-
-  //this test file should work.  Feel free to contact me if there is a problem with the file.
-  TString const fileName = "/afs/cern.ch/work/m/maklein/public/mc14_13TeV.110401.PowhegPythia_P2012_ttbar_nonallhad.merge.AOD.e2928_s1982_s2008_r6114_r6104_tid04859512_00/AOD.04859512._000001.pool.root";
-  std::auto_ptr< TFile > ifile( TFile::Open( fileName, "READ" ) );
-  assert( ifile.get() );
-
-  // Create a TEvent object.
-  xAOD::TEvent * event = new xAOD::TEvent( xAOD::TEvent::kClassAccess );
-  assert( event->readFrom( ifile.get(), xAOD::TEvent::kClassAccess  ) );
-
-  // Create a transient object store. Needed for the tools.  
-  xAOD::TStore store;
-
-  CP::RetrievePFOTool *pfotool = new CP::RetrievePFOTool("PFOtool_RCREC");
-  assert(pfotool->initialize());
-  ToolHandle<CP::IRetrievePFOTool> hpfotool(pfotool);
-
-  InDet::InDetTrackSelectionTool *trackTool = new InDet::InDetTrackSelectionTool("trackSel_RCREC");
-  assert(trackTool->setProperty("CutLevel","TightPrimary"));
-  assert(trackTool->setProperty("maxZ0SinTheta",1.5));
-  assert(trackTool->setProperty("maxD0overSigmaD0",3.0));
-  assert(trackTool->initialize());
-  ToolHandle<InDet::IInDetTrackSelectionTool> htrackTool(trackTool);
-
-  met::METElectronAssociator *electronTool = new met::METElectronAssociator("ElectronTool_RCREC");
-  assert(electronTool->setProperty("InputCollection","Electrons"));
-  assert(electronTool->setProperty("TrackSelectorTool",htrackTool));
-  assert(electronTool->setProperty("PFlow",ispflow));
-  assert(electronTool->setProperty("PFOTool",hpfotool));
-  assert(electronTool->initialize());
-  ToolHandle<IMETAssocToolBase> helectronTool(electronTool);
-
-  met::METPhotonAssociator *photonTool = new met::METPhotonAssociator("PhotonTool_RCREC");
-  assert(photonTool->setProperty("InputCollection","Photons"));
-  assert(photonTool->setProperty("TrackSelectorTool",htrackTool));
-  assert(photonTool->setProperty("PFlow",ispflow));
-  assert(photonTool->setProperty("PFOTool",hpfotool));
-  assert(photonTool->initialize());
-  ToolHandle<IMETAssocToolBase> hphotonTool(photonTool);
-
-  met::METMuonAssociator *muonTool = new met::METMuonAssociator("MuonTool_RCREC");
-  assert(muonTool->setProperty("InputCollection","Muons"));
-  assert(muonTool->setProperty("TrackSelectorTool",htrackTool));
-  assert(muonTool->setProperty("PFlow",ispflow));
-  assert(muonTool->setProperty("PFOTool",hpfotool));
-  assert(muonTool->initialize());
-  ToolHandle<IMETAssocToolBase> hmuonTool(muonTool);
-
-  met::METTauAssociator *tauTool = new met::METTauAssociator("TauTool_RCREC");
-  assert(tauTool->setProperty("InputCollection","TauJets"));
-  assert(tauTool->setProperty("TrackSelectorTool",htrackTool));
-  assert(tauTool->setProperty("PFlow",ispflow));
-  assert(tauTool->setProperty("PFOTool",hpfotool));
-  assert(tauTool->initialize());
-  ToolHandle<IMETAssocToolBase> htauTool(tauTool);
-
-  met::METJetAssocTool *jetTool = new met::METJetAssocTool("JetTool_RCREC");
-  assert(jetTool->setProperty("InputCollection",jettype));
-  assert(jetTool->setProperty("TrackSelectorTool",htrackTool));
-  assert(jetTool->setProperty("PFlow",ispflow));
-  assert(jetTool->setProperty("PFOTool",hpfotool));
-  assert(jetTool->initialize());
-  ToolHandle<IMETAssocToolBase> hjetTool(jetTool);
-
-  met::METSoftAssociator *softTool = new met::METSoftAssociator("SoftTool_RCREC");
-  assert(softTool->setProperty("TrackSelectorTool",htrackTool));
-  assert(softTool->setProperty("PFlow",ispflow));
-  assert(softTool->setProperty("PFOTool",hpfotool));
-  assert(softTool->initialize());
-  ToolHandle<IMETAssocToolBase> hsoftTool(softTool);
-
-  // output xAOD
-  std::string outputString = "example_METAssoc_"+tag+".root";
-  TFile *outfile = new TFile(outputString.c_str(), "RECREATE");
-  assert(event->writeTo(outfile));
-
-  for(Long64_t ievent = 0;  ievent < std::min(int(event->getEntries()), 100); ++ievent){
-    if(ievent % 10 == 0) std::cout << "event number: " << ievent << std::endl; 
-    assert(    event->getEntry(ievent) >= 0 );
-
-    xAOD::MissingETAssociationMap* metMap = new xAOD::MissingETAssociationMap();
-    xAOD::MissingETAuxAssociationMap* metAuxMap = new xAOD::MissingETAuxAssociationMap();
-    metMap->setStore(metAuxMap);
-
-    xAOD::MissingETContainer* metCont = new xAOD::MissingETContainer();
-    xAOD::MissingETAuxContainer* metAuxCont = new xAOD::MissingETAuxContainer();
-    metCont->setStore(metAuxCont);
-
-
-    CaloClusterChangeSignalStateList stateHelperList;    
-    const xAOD::CaloClusterContainer* clusters(0);
-    assert(event->retrieve( clusters,    "CaloCalTopoClusters"    )); 
-
-    for(const auto& clus : *clusters) stateHelperList.add(clus,xAOD::CaloCluster::State(signalstate_matching));
-    assert(hjetTool->execute(metCont,metMap));
-    assert(helectronTool->execute(metCont,metMap));
-    assert(hphotonTool->execute(metCont,metMap));
-    assert(htauTool->execute(metCont,metMap));
-    assert(hmuonTool->execute(metCont,metMap));
-    for(const auto& clus : *clusters) stateHelperList.add(clus,xAOD::CaloCluster::State(signalstate));
-    assert(hsoftTool->execute(metCont,metMap));
-    metMap->identifyOverlaps();
-
-    assert(event->record( metMap,    "METAssoc_" + tag   )); 
-    assert(event->record( metAuxMap, "METAssoc_" + tag + "Aux.")); 
-
-    assert(event->record( metCont,    "MET_Core_" + tag  )); 
-    assert(event->record( metAuxCont, "MET_Core_" + tag + "Aux.")); 
-
-    assert(event->copy(jettype));
-    assert(event->copy("Electrons"));
-    assert(event->copy("Photons"));
-    assert(event->copy("Muons"));
-    assert(event->copy("TauJets"));
-    assert(event->copy("EventInfo"));
-    assert(event->copy("MET_Truth"));
-    assert(event->copy("CombinedMuonTrackParticles"));
-    assert(event->copy("ExtrapolatedMuonTrackParticles"));
-    assert(event->copy("MuonSpectrometerTrackParticles"));
-    assert(event->copy("InDetTrackParticles"));
-
-    //fill the containers stored in the store
-    //to the output file
-    assert(event->fill());
-  }
-
-  assert(event->finishWritingTo(outfile) );
-  outfile->Close();
-
-  delete outfile;
-  delete event;
-
-  return 0;
- }
-
-#endif
diff --git a/Reconstruction/MissingETGoodness/src/JetVarTool.cxx b/Reconstruction/MissingETGoodness/src/JetVarTool.cxx
index c381d799aca..730808b373f 100644
--- a/Reconstruction/MissingETGoodness/src/JetVarTool.cxx
+++ b/Reconstruction/MissingETGoodness/src/JetVarTool.cxx
@@ -188,7 +188,7 @@ float JetVarTool::EventEMFraction()
    const CaloClusterContainer* clusters;   
    if ( evtStore()->retrieve(clusters,"CaloCalTopoCluster").isFailure() ) {
      ATH_MSG_WARNING ( " Could not get pointer to CaloClusterContainer " ) ;
-      return StatusCode::SUCCESS;
+      return 0.;
    }
    
    float EM = 0.;
diff --git a/Reconstruction/MissingETPerformance/src/JetVariablesTool.cxx b/Reconstruction/MissingETPerformance/src/JetVariablesTool.cxx
index 36f6c819a8e..2e05287a16a 100644
--- a/Reconstruction/MissingETPerformance/src/JetVariablesTool.cxx
+++ b/Reconstruction/MissingETPerformance/src/JetVariablesTool.cxx
@@ -205,7 +205,7 @@ float JetVariablesTool::EventEMFraction()
    const CaloClusterContainer* clusters;   
    if ( evtStore()->retrieve(clusters,"CaloCalTopoCluster").isFailure() ) {
       msg() << MSG::WARNING << " Could not get pointer to CaloClusterContainer " << endmsg;
-      return StatusCode::SUCCESS;
+      return 0.;
    }
    
    float EM = 0.;
diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h
index 14f2f186a56..5adc58c4803 100644
--- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h
+++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h
@@ -48,7 +48,6 @@ private:
   mutable int       m_cnt_warn;
 
   std::vector<std::string>  m_fileNames;
-  std::string               m_caloClusterContainerName;
 
   ToolHandle<ITrackEnergyInCaloTool>  m_trkEnergyInCalo;
 };
diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h
index 619e271f5a5..914029fd6e2 100755
--- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h
+++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h
@@ -146,10 +146,12 @@ class TrackDepositInCaloTool: public AthAlgTool, virtual public ITrackDepositInC
     */
     StatusCode bookHistos();
 
-    const CaloCell* getClosestCellLAr(const Trk::TrackParameters* par, const CaloDetDescriptor* descr) const;
+    const CaloCell* getClosestCellLAr(const Trk::TrackParameters* par, const CaloDetDescriptor* descr, const CaloCellContainer* caloCellCont) const;
     const CaloCell* getClosestCellTile(const Trk::TrackParameters* par, const CaloDetDescriptor* descr) const;
-    std::vector<const CaloCell*>* getCaloCellsForLayer(const CaloDetDescriptor* descr, const Trk::TrackParameters* parEntrance, const Trk::TrackParameters* parExit) const;
-    std::vector<const CaloCell*>* getCaloCellsForTile(const CaloDetDescriptor* descr, const Trk::TrackParameters* parEntrance, const Trk::TrackParameters* parExit) const;
+    std::vector<const CaloCell*>* getCaloCellsForLayer(const CaloDetDescriptor* descr, const Trk::TrackParameters* parEntrance, 
+						       const Trk::TrackParameters* parExit, const CaloCellContainer* caloCellCont) const;
+    std::vector<const CaloCell*>* getCaloCellsForTile(const CaloDetDescriptor* descr, const Trk::TrackParameters* parEntrance, 
+						      const Trk::TrackParameters* parExit, const CaloCellContainer* caloCellCont) const;
 
     const Trk::TrackParameters* extrapolateToEntranceOfLayer(const Trk::TrackParameters* par, const CaloDetDescriptor* descr) const;
 	  const Trk::TrackParameters* extrapolateToExitOfLayer(const Trk::TrackParameters* par, const CaloDetDescriptor* descr) const;
@@ -174,9 +176,8 @@ class TrackDepositInCaloTool: public AthAlgTool, virtual public ITrackDepositInC
     ToolHandle <Rec::IParticleCaloCellAssociationTool> m_caloCellAssociationTool; //!< Tool to make the step-wise extrapolation
     
     // Members
-    mutable const CaloCellContainer*    m_cellContainer;                       //!< CaloCell container.
+    const CaloCellContainer*    m_cellContainer;                       //!< CaloCell container.
 
-    std::string     m_cellContainerName;                                       //!< CaloCell container key.
     bool            m_doExtr;                                                  //!< Flag to perform extrapolations using m_extrapolator
     bool            m_doHist;                                                  //!< Flag to write histograms to track performance
     bool            m_debugMode;                                               //!< Flag to run in specialized debug mode
diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx
index d9ad0f07866..ededf06bc55 100644
--- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx
+++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx
@@ -54,7 +54,6 @@ CaloMuonLikelihoodTool::CaloMuonLikelihoodTool(const std::string& type, const st
   
   declareProperty("RootFileNames", m_fileNames);
   declareProperty("TrackEnergyInCaloTool",m_trkEnergyInCalo);
-  declareProperty("CaloClusterContainerName", m_caloClusterContainerName = "CaloTopoCluster");
 }
 
 
@@ -320,17 +319,9 @@ double CaloMuonLikelihoodTool::getLHR( const Trk::TrackParameters* trkpar, const
       }
     }
 
+    if(!ClusContainer) return 0;
     
-    const xAOD::CaloClusterContainer* clusCont = ClusContainer;
-    if(clusCont == nullptr) {
-      if ( evtStore()->retrieve(clusCont, m_caloClusterContainerName).isFailure() ) {
-        ATH_MSG_WARNING("Could not retrieve CaloClusterContainer with key <" << m_caloClusterContainerName << " >");
-        return 0;
-      }
-    }
-    if(clusCont == nullptr) return 0;
-    
-    double LR = getLHR( clusCont, eta_trk, p_trk, eta_trkAtCalo, phi_trkAtCalo, dR_CUT);
+    double LR = getLHR( ClusContainer, eta_trk, p_trk, eta_trkAtCalo, phi_trkAtCalo, dR_CUT);
     return LR;
   }
     
diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
index db5c7e65938..27cee017543 100755
--- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
+++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
@@ -48,7 +48,6 @@ TrackDepositInCaloTool::TrackDepositInCaloTool( const std::string& type, const s
 {
   declareInterface<ITrackDepositInCaloTool>(this);
   declareProperty("ExtrapolatorHandle", m_extrapolator );   
-  declareProperty("CaloCellContainerName", m_cellContainerName="AllCalo");
   declareProperty("doExtrapolation",m_doExtr = true);
   declareProperty("doEDeposHist",m_doHist = false);
   declareProperty("DebugMode", m_debugMode = false);
@@ -130,7 +129,7 @@ StatusCode TrackDepositInCaloTool::finalize() {
 ///////////////////////////////////////////////////////////////////////////////
 // getDeposits
 ///////////////////////////////////////////////////////////////////////////////
-std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const Trk::TrackParameters* par, const CaloCellContainer* caloCellCont) const {
+std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const Trk::TrackParameters* par, const CaloCellContainer* caloCellCont) const{
 
   ATH_MSG_DEBUG("In TrackDepositInCaloTool::getDeposits()");
   std::vector<DepositInCalo> result;
@@ -139,20 +138,8 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const Trk::TrackP
   if (!par) {
     return result;
   }
-  // --- Get the CaloCellContainer from storegate every event ---
-  if(caloCellCont == nullptr) {
-    if ( evtStore()->retrieve(m_cellContainer, m_cellContainerName).isFailure() ) {
-      ATH_MSG_WARNING("Could not retrieve CaloCellContainer, key <" << m_cellContainerName << ">");
-      return result;
-    }
-    if (!m_cellContainer) {
-      ATH_MSG_WARNING("Cell container retrieved, but pointer is 0.");
-      return result;
-    }
-  }
-  else {
-    m_cellContainer = caloCellCont;
-  }
+
+  if(!caloCellCont) return result;
   
   const Trk::ParticleHypothesis muonHypo = Trk::muon;
 
@@ -199,7 +186,7 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const Trk::TrackP
     //   ATH_MSG_INFO("Distance = " << distance << " => Eloss/CLHEP::mm = " << energyLoss/distance);
 
     // --- Retrieve crossed cells ---  
-    std::vector<const CaloCell*>* cells = getCaloCellsForLayer(descr, parEntrance, parExit);
+    std::vector<const CaloCell*>* cells = getCaloCellsForLayer(descr, parEntrance, parExit, caloCellCont);
 
     // --- Add contributions ---
     double sumEnergy = 0;
@@ -344,15 +331,15 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const xAOD::Track
 ///////////////////////////////////////////////////////////////////////////////
 // getCaloCellsForLayer
 ///////////////////////////////////////////////////////////////////////////////
-std::vector<const CaloCell*>* TrackDepositInCaloTool::getCaloCellsForLayer(const CaloDetDescriptor* descr, const Trk::TrackParameters* parEntrance, const Trk::TrackParameters* parExit) const {
+std::vector<const CaloCell*>* TrackDepositInCaloTool::getCaloCellsForLayer(const CaloDetDescriptor* descr, const Trk::TrackParameters* parEntrance, const Trk::TrackParameters* parExit, const CaloCellContainer* caloCellCont) const {
   if (descr->is_tile()) {
     // --- Tile implemention is lengthy and therefore put in seperate function ---
-    return getCaloCellsForTile(descr, parEntrance, parExit);
+    return getCaloCellsForTile(descr, parEntrance, parExit, caloCellCont);
   }
   else {
     // --- LAr implementation is short, quick and simple ---
-    const CaloCell* cellEntrance = getClosestCellLAr(parEntrance, descr);
-    const CaloCell* cellExit     = getClosestCellLAr(parExit, descr);
+    const CaloCell* cellEntrance = getClosestCellLAr(parEntrance, descr, caloCellCont);
+    const CaloCell* cellExit     = getClosestCellLAr(parExit, descr, caloCellCont);
     std::vector<const CaloCell*>* result = new std::vector<const CaloCell*>();
     result->push_back(cellEntrance);
     if (cellEntrance!=cellExit) {
@@ -370,7 +357,7 @@ std::vector<const CaloCell*>* TrackDepositInCaloTool::getCaloCellsForLayer(const
 ///////////////////////////////////////////////////////////////////////////////
 // getCaloCellsForTile
 ///////////////////////////////////////////////////////////////////////////////
-std::vector<const CaloCell*>* TrackDepositInCaloTool::getCaloCellsForTile(const CaloDetDescriptor* descr, const Trk::TrackParameters* parEntrance, const Trk::TrackParameters* parExit) const {
+std::vector<const CaloCell*>* TrackDepositInCaloTool::getCaloCellsForTile(const CaloDetDescriptor* descr, const Trk::TrackParameters* parEntrance, const Trk::TrackParameters* parExit, const CaloCellContainer* caloCellCont) const {
 /*
   ...to be written...
 */
@@ -408,7 +395,7 @@ std::vector<const CaloCell*>* TrackDepositInCaloTool::getCaloCellsForTile(const
   std::map<double, const CaloCell*> neighbourMap1;
 
   while (it!=vecHash.end()) {
-    const CaloCell* cell = m_cellContainer->findCell(*it);
+    const CaloCell* cell = caloCellCont->findCell(*it);
     if (cell) {
       const CaloDetDescrElement* dde = cell->caloDDE();
       if (dde) {
@@ -714,11 +701,7 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::deposits(const Trk::TrackPara
   if (!par) {
     return result;
   }
-  // --- Get the CaloCellContainer from storegate every event ---
-  if ( evtStore()->retrieve(m_cellContainer, m_cellContainerName).isFailure() ) {
-    ATH_MSG_WARNING("Could not retrieve CaloContainer = " << m_cellContainerName);
-    return result;
-  }
+
   if (!m_cellContainer) {
     ATH_MSG_WARNING("Cell container retrieved, but pointer = 0");
     return result;
@@ -1191,17 +1174,13 @@ For the non-projective tile cells one has to select cells in a certain (eta,phi)
 that is closest to the track.
 */
 
-  if ( evtStore()->retrieve(m_cellContainer, m_cellContainerName).isFailure() ) {
-    ATH_MSG_WARNING("Could not retrieve CaloContainer = " << m_cellContainerName);
-    return 0;
-  }
   // --- Determine cell type ---
   const CaloCell* cell = 0;
   if (descr->is_tile()) {
     cell = getClosestCellTile(par, descr);
   }
   else {
-    cell = getClosestCellLAr(par, descr);
+    cell = getClosestCellLAr(par, descr, m_cellContainer);
   }
   // ATH_MSG_INFO("cell = " << cell);
   return cell;
@@ -1211,14 +1190,14 @@ that is closest to the track.
 ///////////////////////////////////////////////////////////////////////////////
 // getClosestCellLAr()
 ///////////////////////////////////////////////////////////////////////////////
-const CaloCell* TrackDepositInCaloTool::getClosestCellLAr(const Trk::TrackParameters* par, const CaloDetDescriptor* descr) const {
+const CaloCell* TrackDepositInCaloTool::getClosestCellLAr(const Trk::TrackParameters* par, const CaloDetDescriptor* descr, const CaloCellContainer* caloCellCont) const {
 
   CaloCell_ID::CaloSample sample = const_cast<CaloDetDescriptor*>(descr)->getSampling();
   // ATH_MSG_INFO("Sampling = " << sample);
   const CaloDetDescrElement* cellDescr = m_caloDDM->get_element(sample, par->position().eta(), par->position().phi());
   if (cellDescr) {
     IdentifierHash hash = cellDescr->calo_hash();
-    const CaloCell* cell = m_cellContainer->findCell(hash);
+    const CaloCell* cell = caloCellCont->findCell(hash);
     if (cell) {
       // ATH_MSG_INFO("Energy = " << cell->energy());
       return cell;
diff --git a/Reconstruction/MuonIdentification/MuGirl/src/MuGirlRecoTool.cxx b/Reconstruction/MuonIdentification/MuGirl/src/MuGirlRecoTool.cxx
index 98810e64984..53fd684bec9 100644
--- a/Reconstruction/MuonIdentification/MuGirl/src/MuGirlRecoTool.cxx
+++ b/Reconstruction/MuonIdentification/MuGirl/src/MuGirlRecoTool.cxx
@@ -305,7 +305,8 @@ StatusCode MuGirlRecoTool::MuGirlReco(const InDetCandidateCollection& InDetSeeds
 
         ATH_MSG_DEBUG("CaloExtensionTool: pt_calo_local " << pt_calo_local.x() << ", z=" << pt_calo_local.z());
 
-        CaloParticle* pParticle = new CaloParticle((*ipIt), &tp_id, extrParameters, pt_calo_local.eta(), pt_calo_local.phi());
+        // FIXME: const_cast
+        CaloParticle* pParticle = new CaloParticle(const_cast<MuonCombined::InDetCandidate*>(*ipIt), &tp_id, extrParameters, pt_calo_local.eta(), pt_calo_local.phi());
         m_caloParticles.push_back(pParticle);
     }
     ATH_MSG_DEBUG("CaloExtensionTool: size of CaloParticles " << m_caloParticles.size());
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.cxx
index 58930c70f6e..1a3563738a1 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.cxx
@@ -25,6 +25,7 @@ MuonCombinedInDetCandidateAlg::MuonCombinedInDetCandidateAlg(const std::string&
   declareProperty("MuonSystemExtensionTool",m_muonSystemExtensionTool );
   declareProperty("InDetCandidateLocation", m_candidateCollectionName = "InDetCandidates");
   declareProperty("DoSiliconAssocForwardMuons", m_doSiliconForwardMuons = false);
+  declareProperty("ExtensionPtThreshold",m_extThreshold=2500);
 }
 
 MuonCombinedInDetCandidateAlg::~MuonCombinedInDetCandidateAlg(){}
@@ -115,8 +116,8 @@ void MuonCombinedInDetCandidateAlg::create( const xAOD::TrackParticleContainer&
     }
     InDetCandidate* candidate = new InDetCandidate(link);
     if (flagCandidateAsSiAssociated)
-      candidate->setSiliconAssociated(true);
-    else{ //Si-associated candidates don't need these
+      candidate->setSiliconAssociated(true);  //Si-associated candidates don't need these
+    else if(tp->pt()>m_extThreshold){ //MuGirl only operates on ID tracks with pt at least this high
       const Muon::MuonSystemExtension* muonSystemExtension = 0;
       m_muonSystemExtensionTool->muonSystemExtension( candidate->indetTrackParticle(), muonSystemExtension );
       candidate->setExtension(muonSystemExtension);
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.h b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.h
index 5764d0c07f5..0526485386c 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.h
@@ -33,6 +33,8 @@ class MuonCombinedInDetCandidateAlg : public AthAlgorithm
 
  private:
   bool m_doSiliconForwardMuons;
+
+  float m_extThreshold;
   
   SG::ReadHandleKeyArray<xAOD::TrackParticleContainer> m_indetTrackParticleLocation;
   SG::ReadHandleKey<xAOD::TrackParticleContainer>  m_indetForwardTrackParticleLocation;
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx
index f4035e47989..9335065050d 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx
@@ -12,21 +12,21 @@ MuonCombinedInDetExtensionAlg::MuonCombinedInDetExtensionAlg(const std::string&
 {  
   declareProperty("MuonCombinedInDetExtensionTools",m_muonCombinedInDetExtensionTools);
   declareProperty("usePRDs",m_usePRDs=false);
+  declareProperty("useNSW", m_useNSW=false);
 }
 
 MuonCombinedInDetExtensionAlg::~MuonCombinedInDetExtensionAlg(){}
 
 StatusCode MuonCombinedInDetExtensionAlg::initialize()
 {
-
   ATH_CHECK(m_muonCombinedInDetExtensionTools.retrieve());
   ATH_CHECK(m_indetCandidateCollectionName.initialize());
   ATH_CHECK(m_MDT_ContainerName.initialize(m_usePRDs));
   ATH_CHECK(m_RPC_ContainerName.initialize(m_usePRDs));
   ATH_CHECK(m_TGC_ContainerName.initialize(m_usePRDs));
-  ATH_CHECK(m_CSC_ContainerName.initialize(m_usePRDs));
-  ATH_CHECK(m_sTGC_ContainerName.initialize(m_usePRDs));
-  ATH_CHECK(m_MM_ContainerName.initialize(m_usePRDs));
+  ATH_CHECK(m_CSC_ContainerName.initialize(m_usePRDs && !m_useNSW));
+  ATH_CHECK(m_sTGC_ContainerName.initialize(m_usePRDs && m_useNSW));
+  ATH_CHECK(m_MM_ContainerName.initialize(m_usePRDs && m_useNSW));
 
   return StatusCode::SUCCESS; 
 }
@@ -45,14 +45,16 @@ StatusCode MuonCombinedInDetExtensionAlg::execute()
     SG::ReadHandle<Muon::CscPrepDataContainer> cscPRDContainer(m_CSC_ContainerName);
     SG::ReadHandle<Muon::RpcPrepDataContainer> rpcPRDContainer(m_RPC_ContainerName);
     SG::ReadHandle<Muon::TgcPrepDataContainer> tgcPRDContainer(m_TGC_ContainerName);
-    SG::ReadHandle<Muon::sTgcPrepDataContainer> stgcPRDContainer(m_sTGC_ContainerName);
-    SG::ReadHandle<Muon::MMPrepDataContainer> mmPRDContainer(m_MM_ContainerName);
-
-    for(auto& tool : m_muonCombinedInDetExtensionTools)
-      tool->extendWithPRDs(*indetCandidateCollection,mdtPRDContainer.cptr(),cscPRDContainer.cptr(),rpcPRDContainer.cptr(),tgcPRDContainer.cptr(),stgcPRDContainer.cptr(),mmPRDContainer.cptr());
-  }
-  else{
-
+    if (m_useNSW) {
+      SG::ReadHandle<Muon::sTgcPrepDataContainer> stgcPRDContainer(m_sTGC_ContainerName);
+      SG::ReadHandle<Muon::MMPrepDataContainer> mmPRDContainer(m_MM_ContainerName);
+      for(auto& tool : m_muonCombinedInDetExtensionTools)
+        tool->extendWithPRDs(*indetCandidateCollection,mdtPRDContainer.cptr(),cscPRDContainer.cptr(),rpcPRDContainer.cptr(),tgcPRDContainer.cptr(),stgcPRDContainer.cptr(),mmPRDContainer.cptr());
+     } else {
+       for(auto& tool : m_muonCombinedInDetExtensionTools)
+         tool->extendWithPRDs(*indetCandidateCollection,mdtPRDContainer.cptr(),cscPRDContainer.cptr(),rpcPRDContainer.cptr(),tgcPRDContainer.cptr(),0,0);
+     }
+  } else{
     for(auto& tool : m_muonCombinedInDetExtensionTools)
       tool->extend(*indetCandidateCollection);
   }
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h
index 205b20620de..1233215345b 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h
@@ -39,6 +39,7 @@ class MuonCombinedInDetExtensionAlg : public AthAlgorithm
   SG::ReadHandleKey<Muon::sTgcPrepDataContainer> m_sTGC_ContainerName{this,"sTGCPrepDataLocation","sTGC_Clusters","sTGC prep data"};
   SG::ReadHandleKey<Muon::MMPrepDataContainer> m_MM_ContainerName{this,"MMPrepDataLocation","MM_Clusters","MM prep data"};
   bool m_usePRDs;
+  bool m_useNSW;
 };
 
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx
index 06fb3630de5..39868c8e030 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx
@@ -57,9 +57,6 @@ namespace MuonCombined {
   {
     declareInterface<IMuonCombinedInDetExtensionTool>(this);
     declareInterface<IMuonCombinedTrigCaloTagExtensionTool>(this);
-    // --- Collections ---
-    declareProperty("TrackParticleName",                 m_TrackParticleName             =  "TrackParticleCandidate"    );
-    declareProperty("VertexContainerName",               m_VertexContainerName           =  "VxPrimaryCandidate"        );
     
     // --- Muon Dressing ---    //declareProperty("CoreDeltaR",                        m_coreDR       =  0.05                );
     //declareProperty("doMuonDressing",                    m_doDressing   =  true                );
@@ -116,17 +113,16 @@ namespace MuonCombined {
     //  msg(MSG::ERROR) << "Detector service not found !" << endmsg;
     //  return StatusCode::FAILURE;
     //}
-    if( true ){
-      if( m_doCaloLR ) ATH_CHECK( m_caloMuonLikelihood.retrieve() );
-      ATH_CHECK( m_caloMuonTagLoose.retrieve()   );
-      ATH_CHECK( m_caloMuonTagTight.retrieve()   );
-      ATH_CHECK( m_trkDepositInCalo.retrieve()   );
-      if(!m_trackIsolationTool.empty()) ATH_CHECK( m_trackIsolationTool.retrieve() );
-      ATH_CHECK( m_trkSelTool.retrieve()         );
-    }
-    if(m_doTrkSelection && m_doCosmicTrackSelection) {
-      ATH_MSG_WARNING("Inconsistent setup: track selection for collisions AND cosmics requested.");
-    } 
+    if( m_doCaloLR ) ATH_CHECK( m_caloMuonLikelihood.retrieve() );
+    else m_caloMuonLikelihood.disable();
+    ATH_CHECK( m_caloMuonTagLoose.retrieve()   );
+    ATH_CHECK( m_caloMuonTagTight.retrieve()   );
+    ATH_CHECK( m_trkDepositInCalo.retrieve()   );
+    if(!m_trackIsolationTool.empty()) ATH_CHECK( m_trackIsolationTool.retrieve() );
+    else m_trackIsolationTool.disable();
+    ATH_CHECK( m_trkSelTool.retrieve()         );
+    ATH_CHECK(m_caloClusterCont.initialize(m_doCaloLR));
+    ATH_CHECK(m_caloCellCont.initialize(m_doOldExtrapolation));
     
     return StatusCode::SUCCESS;
   }
@@ -150,7 +146,21 @@ namespace MuonCombined {
   }
 
   void MuonCaloTagTool::extend( const InDetCandidateCollection& inDetCandidates ) {
-    extend(inDetCandidates, nullptr, nullptr);
+    const xAOD::CaloClusterContainer* caloClusterCont=0;
+    const CaloCellContainer* caloCellCont=0;
+    if(m_doCaloLR){ //retrieve the xAOD::CaloClusterContainer
+      SG::ReadHandle<xAOD::CaloClusterContainer> clusters(m_caloClusterCont);
+      if(!clusters.isValid()) ATH_MSG_WARNING("CaloClusterContainer "<<m_caloClusterCont.key()<<" not valid");
+      else if(!clusters.isPresent()) ATH_MSG_DEBUG("CaloClusterContainer "<<m_caloClusterCont.key()<<" not present");
+      else caloClusterCont=clusters.cptr();
+    }
+    if(m_doOldExtrapolation){ //retrieve the CaloCellContainer
+      SG::ReadHandle<CaloCellContainer> cells(m_caloCellCont);
+      if(!cells.isValid()) ATH_MSG_WARNING("CaloCellContainer "<<m_caloCellCont.key()<<" not valid");
+      else if(!cells.isPresent()) ATH_MSG_DEBUG("CaloCellContainer "<<m_caloCellCont.key()<<" not present");
+      else caloCellCont=cells.cptr();
+    }
+    extend(inDetCandidates, caloCellCont, caloClusterCont);
   }
 
   void MuonCaloTagTool::extend( const InDetCandidateCollection& inDetCandidates,
@@ -160,8 +170,8 @@ namespace MuonCombined {
 
     //return;
     //
-    // --- Retrieve primary vertex ---
-    const Trk::Vertex* vertex = 0;// retrievePrimaryVertex();
+    // --- Retrieve primary vertex (not retrieving for now) ---
+    const Trk::Vertex* vertex = 0;
 //    const Trk::TrackParticleOrigin prtOrigin =  Trk::TrackParticleOrigin::PriVtx; // we only consider trks form primary vtx
     
     // --- Big loop over all the particles in the container ---                                                                                                              
@@ -270,7 +280,8 @@ namespace MuonCombined {
 	continue;
       }
       
-	createMuon(*idTP,  deposits, tag, likelihood);
+      // FIXME const-cast  changes object passed in as const
+      createMuon(const_cast<InDetCandidate&>(*idTP),  deposits, tag, likelihood);
 
       // --- Count number of muons written to container 
       if ( abs(pdgId) == 13 )  m_nMuonsTagged++;
@@ -281,32 +292,6 @@ namespace MuonCombined {
   } //end of the extend method
 
   
-  //retrievePrimaryVertex -> SHOULD BE OK
-  const Trk::Vertex* MuonCaloTagTool::retrievePrimaryVertex() const {
-    
-    // --- No need to retrieve the primary vertex when no track selection is applied ---
-    if (!m_doTrkSelection) 
-      return 0;
-    
-    // --- Retrieve vertex container ---
-    const VxContainer* vxContainer = 0;
-    StatusCode sc = evtStore()->retrieve(vxContainer, m_VertexContainerName);
-    if(sc.isFailure() || vxContainer==0) {
-      ATH_MSG_DEBUG("Vertex container " << m_VertexContainerName << " not found in StoreGate!");
-      return 0;
-    }
-    // --- Retrieve vertex ---
-    const Trk::Vertex* vertex = 0;
-    if(vxContainer->size()> 0)
-      vertex = &((*vxContainer)[0]->recVertex());
-    else{
-      ATH_MSG_DEBUG("No vertices in vertex container.");
-    }
-  
-    return vertex;
-    
-  }
-  
   //getTrackParameters -> SHOULD BE OK
   const Trk::TrackParameters* MuonCaloTagTool::getTrackParameters(const Trk::Track* trk) const{
     
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h
index db62590dd7b..1337eab2451 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h
@@ -33,6 +33,8 @@
 #include "ICaloTrkMuIdTools/ITrackDepositInCaloTool.h"
 #include "TrkToolInterfaces/ITrackSelectorTool.h"
 
+#include "StoreGate/ReadHandleKey.h"
+
 // - STL
 #include <vector>
 
@@ -66,7 +68,6 @@ namespace MuonCombined {
   private:
     
     void createMuon(InDetCandidate & muonCandidate, const std::vector<DepositInCalo>& deposits, int tag, float likelihood) const;
-    const Trk::Vertex* retrievePrimaryVertex() const;
     const Trk::TrackParameters* getTrackParameters(const Trk::Track* trk) const;
     //bool applyEnergyIsolation(const xAOD::IParticle* muon);
     bool selectTrack(const Trk::Track* trk, const Trk::Vertex* vertex) const;
@@ -76,10 +77,8 @@ namespace MuonCombined {
 //    std::vector<DepositInCalo> getDeposits(const xAOD::TrackParticle* tp, const CaloCellContainer* caloCellCont) const;
     
     // --- StoreGate keys ---
-    std::string m_TrackParticleName;                 //!< TrackParticle container name
-    std::string m_VertexContainerName;               //!< name of the vertex container
-    //std::string m_MuonContainerOutputName;           //!< Calo Muon Collection name
-    //std::string m_muonCaloEnergyCollectionName;      //!< Muon CaloEnergy Collection
+    SG::ReadHandleKey<xAOD::CaloClusterContainer> m_caloClusterCont{this,"CaloClusters","CaloTopoCluster","calo cluster container"};
+    SG::ReadHandleKey<CaloCellContainer> m_caloCellCont{this,"CaloCells","AllCalo","calo cell container"};
     
     // --- Internal cache ---
     mutable int m_nTrueMuons;          //!< Counts the number true muons
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx
index 0f9b86b6282..969db192e99 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx
@@ -15,7 +15,6 @@
 #include "MuonRecHelperTools/MuonEDMPrinterTool.h"
 #include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h"
 #include "MuonRecToolInterfaces/IMuonTrackExtrapolationTool.h"
-#include "xAODEventInfo/EventInfo.h"
 
 namespace MuonCombined {
  
@@ -44,8 +43,11 @@ namespace MuonCombined {
   StatusCode MuonCandidateTool::initialize() {
     ATH_CHECK(m_printer.retrieve());
     if( !m_trackBuilder.empty() )           ATH_CHECK(m_trackBuilder.retrieve());
+    else m_trackBuilder.disable();
     if( !m_trackExtrapolationTool.empty() ) ATH_CHECK(m_trackExtrapolationTool.retrieve());
+    else m_trackExtrapolationTool.disable();
     ATH_CHECK(m_ambiguityProcessor.retrieve());
+    ATH_CHECK(m_evInfo.initialize());
     return StatusCode::SUCCESS;
   }
 
@@ -56,12 +58,12 @@ namespace MuonCombined {
   void MuonCandidateTool::create( const xAOD::TrackParticleContainer& tracks, MuonCandidateCollection& outputCollection ) {
     ATH_MSG_DEBUG("Producing MuonCandidates for " << tracks.size() );
     unsigned int ntracks = 0;
-    const xAOD::EventInfo* eventInfo; 
+    SG::ReadHandle<xAOD::EventInfo> eventInfo(m_evInfo); 
     float beamSpotX = 0.;
     float beamSpotY = 0.;
     float beamSpotZ = 0.;
 
-    if(evtStore()->retrieve(eventInfo).isSuccess()){
+    if(eventInfo.isValid()){
       beamSpotX = eventInfo->beamPosX();
       beamSpotY = eventInfo->beamPosY();
       beamSpotZ = eventInfo->beamPosZ();
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h
index c7ae8ebc07b..27505db94f9 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h
@@ -10,6 +10,8 @@
 #include "MuonCombinedToolInterfaces/IMuonCandidateTool.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include "MuonCombinedEvent/InDetCandidateCollection.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "xAODEventInfo/EventInfo.h"
 
 namespace Trk {
   class ITrackAmbiguityProcessorTool;
@@ -45,6 +47,8 @@ namespace MuonCombined {
     ToolHandle<Muon::IMuonTrackExtrapolationTool> m_trackExtrapolationTool;
     ToolHandle<Trk::ITrackAmbiguityProcessorTool> m_ambiguityProcessor;
 
+    SG::ReadHandleKey<xAOD::EventInfo> m_evInfo{this,"EventInfo","EventInfo","event info"};
+
     unsigned int m_extrapolationStrategy;
   };
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.cxx
index 2d586a694d2..d3c9772151c 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.cxx
@@ -120,7 +120,8 @@ namespace MuonCombined {
       if (deltaEta            > m_deltaEtaPreSelection)  continue;
       if (fabs(deltaPhi)      > m_deltaPhiPreSelection)  continue;
       if (ptBal               > m_ptBalance) continue;
-      associatedIdCandidates.push_back(x);
+      // FIXME: changing objects recorded in SG.
+      associatedIdCandidates.push_back(const_cast<InDetCandidate*>(x));
     }
   }
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx
index 26c96217292..b37c168caac 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx
@@ -132,6 +132,7 @@ namespace MuonCombined {
     declareProperty("CaloMaterialProvider", m_caloMaterialProvider);
     declareProperty("FillTimingInformation", m_fillTimingInformation = true );
     declareProperty("FillTimingInformationOnMuon", m_fillTimingInformationOnMuon = false );
+    declareProperty("AssociateSegmentsToLowBetaMuons",m_segLowBeta = false);
     //declareProperty("FillMuonTruthLinks", m_fillMuonTruthLinks = true );
      
   }
@@ -158,9 +159,13 @@ namespace MuonCombined {
     ATH_CHECK(m_trackSegmentAssociationTool.retrieve());
     ATH_CHECK(m_trackQuery.retrieve());
     if(!m_momentumBalanceTool.empty()) ATH_CHECK(m_momentumBalanceTool.retrieve());
+    else m_momentumBalanceTool.disable();
     if(!m_scatteringAngleTool.empty()) ATH_CHECK(m_scatteringAngleTool.retrieve());   
+    else m_scatteringAngleTool.disable();
     if(!m_selectorTool.empty()) ATH_CHECK(m_selectorTool.retrieve());
+    else m_selectorTool.disable();
     if(!m_meanMDTdADCTool.empty()) ATH_CHECK(m_meanMDTdADCTool.retrieve());
+    else m_meanMDTdADCTool.disable();
     if(m_applyCaloNoiseCut) {
         // apply CaloNoiseTool to cell collected for ET_Core
         if(!m_caloNoiseTool.empty()) ATH_CHECK(m_caloNoiseTool.retrieve());
@@ -169,6 +174,7 @@ namespace MuonCombined {
             m_applyCaloNoiseCut = false;
         }
     }
+    else m_caloNoiseTool.disable();
     ATH_MSG_INFO("ET_Core calculation: tool, doNoiseCut, sigma - " << m_caloNoiseTool.name() << " "
                  << m_applyCaloNoiseCut << " " << m_sigmaCaloNoiseCut);
 
@@ -1468,7 +1474,7 @@ namespace MuonCombined {
 
     if( m_fillTimingInformationOnMuon  ) addRpcTiming(muon);
     
-    if( !m_trackSegmentAssociationTool.empty() ) addSegmentsOnTrack(muon);
+    if( !m_trackSegmentAssociationTool.empty() && (muon.author()!=xAOD::Muon::MuGirlLowBeta || m_segLowBeta)) addSegmentsOnTrack(muon);
 
     addMSIDScatteringAngles(muon);
     if(muon.combinedTrackParticleLink().isValid()) addMSIDScatteringAngles(**(muon.combinedTrackParticleLink()));
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.h
index 0ccf6aa432c..012287985a0 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.h
@@ -182,6 +182,9 @@ namespace MuonCombined {
     bool m_fillTimingInformation;
     bool m_fillTimingInformationOnMuon;
 
+    //associate segments to MuGirlLowBeta muons;
+    bool m_segLowBeta;
+
     /// copy truth links from primary track particle (or put dummy link if this is missing)
     //bool m_fillMuonTruthLinks;
     
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx
index a585cbd1b33..6ca87d74edf 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx
@@ -782,7 +782,7 @@ namespace MuonCombined {
 
     }
 
-    InDetCandidate*     tagCandidate = 0;
+    const InDetCandidate*     tagCandidate = 0;
     for( auto idTP : inDetCandidates ){
  
       if( ! idTP->indetTrackParticle().track() ) continue;
@@ -803,7 +803,8 @@ namespace MuonCombined {
       if(match) {     
         ATH_MSG_DEBUG( "make Segment Tag object for " << m_printer->print(*track) << " nr segments " << segmentsInfoTag.size() );          
         SegmentTag* tag = new SegmentTag(segmentsInfoTag);
-        tagCandidate->addTag(*tag);
+        // FIXME const-cast changes object passed in as const
+        const_cast<InDetCandidate*>(tagCandidate)->addTag(*tag);
       } 
     }   
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.cxx
index d20be4b2a09..f0a693a7bd4 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.cxx
@@ -28,8 +28,6 @@ namespace Muon {
 
     declareProperty("MuonEDMHelperTool",m_helper);
     declareProperty("MuonEDMPrinterTool",m_printer);
-    declareProperty("MuonSegmentLocation",m_segmentLocation="MuonSegments");
-    declareProperty("StauSegmentLocation",m_stauSegmentLocation="StauSegments");
   }
 
   //Destructor
@@ -41,6 +39,7 @@ namespace Muon {
   StatusCode TrackSegmentAssociationTool::initialize() {
     ATH_CHECK(m_helper.retrieve());
     ATH_CHECK(m_printer.retrieve());
+    ATH_CHECK(m_segments.initialize());
     return StatusCode::SUCCESS;
   }
 
@@ -70,15 +69,16 @@ namespace Muon {
   bool TrackSegmentAssociationTool::associatedSegments(const xAOD::Muon& muon, 
                                                        std::vector< ElementLink<xAOD::MuonSegmentContainer> >& associatedSegments ) const {
 
-    // don't do this for MuGirlLowBeta
-    if( muon.author() == xAOD::Muon::MuGirlLowBeta ){
+    // get segments 
+    SG::ReadHandle<xAOD::MuonSegmentContainer> segments(m_segments);
+    if(!segments.isPresent()){
+      ATH_MSG_DEBUG(m_segments.key()<<" not present");
+      return false;
+    }
+    if(!segments.isValid()){
+      ATH_MSG_WARNING(m_segments.key()<<" not valid");
       return false;
     }
-    
-    // get segments 
-    std::string location = (muon.author() == xAOD::Muon::MuGirlLowBeta) ? m_stauSegmentLocation : m_segmentLocation;
-    const xAOD::MuonSegmentContainer* segments = retrieveSegments(location);
-    if( !segments ) return false;
 
     // only fill if the primary track particle is not equal to the ID track particle and 
     // it has an associated track with track states 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.h
index 3527c402513..0da2298c6bc 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.h
@@ -13,7 +13,7 @@
 #include "xAODMuon/MuonSegment.h"
 #include "MuonRecHelperTools/MuonEDMPrinterTool.h"
 #include "MuonRecHelperTools/MuonEDMHelperTool.h"
-
+#include "StoreGate/ReadHandleKey.h"
 
 /** @class TrackSegmentAssociationTool
     
@@ -52,8 +52,8 @@ namespace Muon{
     ToolHandle<Muon::MuonEDMHelperTool>  m_helper;
     ToolHandle<Muon::MuonEDMPrinterTool> m_printer;
 
-    std::string m_segmentLocation;
-    std::string m_stauSegmentLocation;
+    SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_segments{this,"MuonSegmentLocation","MuonSegments","muon segments"};
+
   };
 }
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
index 26b722c7f33..81f84e57b8f 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
@@ -3,6 +3,9 @@
 from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
 from AthenaCommon.CfgGetter import getPublicTool, getAlgorithm,getPublicToolClone
 from MuonRecExample.ConfiguredMuonRec import ConfiguredMuonRec
+from MuonRecExample.MuonRecFlags import muonRecFlags
+muonRecFlags.setDefaults()
+
 from AthenaCommon.AlgSequence import AlgSequence
 from AthenaCommon import CfgMgr
 from AthenaCommon.BeamFlags import jobproperties
@@ -14,6 +17,7 @@ def MuonCombinedInDetExtensionAlg(name="MuonCombinedInDetExtensionAlg",**kwargs)
     if muonCombinedRecFlags.doCaloTrkMuId():
         tools.append(getPublicTool("MuonCaloTagTool"))
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
+    kwargs.setdefault("useNSW", muonRecFlags.dosTGCs() and muonRecFlags.doMicromegas() )
     return CfgMgr.MuonCombinedInDetExtensionAlg(name,**kwargs)
 
 def MuGirlAlg(name="MuGirlAlg",**kwargs):
diff --git a/Reconstruction/PFlow/PFlowUtils/CMakeLists.txt b/Reconstruction/PFlow/PFlowUtils/CMakeLists.txt
index 25c65842a97..ee5a65eff16 100644
--- a/Reconstruction/PFlow/PFlowUtils/CMakeLists.txt
+++ b/Reconstruction/PFlow/PFlowUtils/CMakeLists.txt
@@ -15,9 +15,10 @@ endif()
 # Declare the package's dependencies:
 atlas_depends_on_subdirs(
   PUBLIC
-  Control/AthToolSupport/AsgTools
+  Control/AthToolSupport/AsgTools  
   Event/xAOD/xAODPFlow
   PRIVATE
+  Control/AthContainers
   Event/xAOD/xAODJet
   ${extra_deps} )
 
diff --git a/Reconstruction/PFlow/PFlowUtils/src/CombinePFO.cxx b/Reconstruction/PFlow/PFlowUtils/src/CombinePFO.cxx
new file mode 100644
index 00000000000..87697d00b0e
--- /dev/null
+++ b/Reconstruction/PFlow/PFlowUtils/src/CombinePFO.cxx
@@ -0,0 +1,41 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "CombinePFO.h"
+#include "AthContainers/ConstDataVector.h"
+#include "xAODCore/ShallowCopy.h"
+
+CombinePFO::CombinePFO(const std::string& name, ISvcLocator* pSvcLocator) :  AthAlgorithm(name, pSvcLocator) {}
+
+StatusCode CombinePFO::initialize(){
+
+  ATH_CHECK(m_PFOContainerReadHandleKeyA.initialize());
+  ATH_CHECK(m_PFOContainerReadHandleKeyB.initialize());
+  ATH_CHECK(m_PFOContainerWriteHandleKey.initialize());
+
+  return StatusCode::SUCCESS;  
+}
+
+StatusCode CombinePFO::execute(){
+
+  SG::WriteHandle<xAOD::PFOContainer> PFOContainerWriteHandle(m_PFOContainerWriteHandleKey);
+
+  ATH_CHECK(PFOContainerWriteHandle.record(std::make_unique<xAOD::PFOContainer>(SG::VIEW_ELEMENTS)));
+  
+  SG::ReadHandle<xAOD::PFOContainer> PFOContainerReadHandleA(m_PFOContainerReadHandleKeyA);
+  SG::ReadHandle<xAOD::PFOContainer> PFOContainerReadHandleB(m_PFOContainerReadHandleKeyB);
+
+  std::pair< xAOD::PFOContainer*, xAOD::ShallowAuxContainer* > shallowCopyOfPFOContainerA =  xAOD::shallowCopyContainer(*PFOContainerReadHandleA);    
+  std::pair< xAOD::PFOContainer*, xAOD::ShallowAuxContainer* > shallowCopyOfPFOContainerB =  xAOD::shallowCopyContainer(*PFOContainerReadHandleB);    
+
+  PFOContainerWriteHandle->assign(shallowCopyOfPFOContainerA.first->begin(),shallowCopyOfPFOContainerA.first->end());
+  PFOContainerWriteHandle->insert(PFOContainerWriteHandle->end(),shallowCopyOfPFOContainerB.first->begin(),shallowCopyOfPFOContainerB.first->end());
+  
+  return StatusCode::SUCCESS;  
+  
+}
+
+StatusCode CombinePFO::finalize(){
+  return StatusCode::SUCCESS;
+}
diff --git a/Reconstruction/PFlow/PFlowUtils/src/CombinePFO.h b/Reconstruction/PFlow/PFlowUtils/src/CombinePFO.h
new file mode 100644
index 00000000000..843e59f0310
--- /dev/null
+++ b/Reconstruction/PFlow/PFlowUtils/src/CombinePFO.h
@@ -0,0 +1,37 @@
+/*                                                                                                                                                                                                                                           
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration                                                                                                                                                                    
+*/
+
+#ifndef COMBINEPFO_H
+#define COMBINEPFO_H
+
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "xAODPFlow/PFOContainer.h"
+
+class CombinePFO : public AthAlgorithm {
+
+public:
+ /** Default constructor */
+  CombinePFO(const std::string& name, ISvcLocator* pSvcLocator);
+
+  /** Default destructor */
+  ~CombinePFO() {};
+ 
+  /** Gaudi AthAlgorithm hooks */
+  StatusCode initialize();
+  StatusCode execute();
+  StatusCode finalize();
+
+private:
+
+  /** ReadHandleKey for first PFOContainer to be combined */
+  SG::ReadHandleKey<xAOD::PFOContainer> m_PFOContainerReadHandleKeyA{this,"PFOInputContainerNameA","JetETMissLCNeutralParticleFlowObjects","ReadHandleKey for xAOD::PFOContainer"};
+
+  /** ReadHandleKey for second PFOContainer to be combined */
+  SG::ReadHandleKey<xAOD::PFOContainer> m_PFOContainerReadHandleKeyB{this,"PFOInputContainerNameB","JetETMissLCNeutralParticleFlowObjectsNonModified","ReadHandleKey for xAOD::PFOContainer"};
+
+  /** WriteHandleKey for PFOContainer, which is VIEW container combining containers A and B referenced above */
+  SG::WriteHandleKey<xAOD::PFOContainer> m_PFOContainerWriteHandleKey{this,"PFOOutputContainerName","JetETMissLCCombinedNeutralParticleFlowObjects","WriteHandleKey for xAOD::PFOContainer"};
+  
+};
+#endif
diff --git a/Reconstruction/PFlow/PFlowUtils/src/components/PFlowUtils_entries.cxx b/Reconstruction/PFlow/PFlowUtils/src/components/PFlowUtils_entries.cxx
index 52de5c889e0..54efb890a95 100644
--- a/Reconstruction/PFlow/PFlowUtils/src/components/PFlowUtils_entries.cxx
+++ b/Reconstruction/PFlow/PFlowUtils/src/components/PFlowUtils_entries.cxx
@@ -1,8 +1,9 @@
 #include "PFlowUtils/RetrievePFOTool.h"
 #include "PFlowUtils/WeightPFOTool.h"
 #include "../ParticleFlowEventFilter_r207.h"
+#include "../CombinePFO.h"
 
 DECLARE_COMPONENT( CP::RetrievePFOTool )
 DECLARE_COMPONENT( CP::WeightPFOTool )
 DECLARE_COMPONENT( ParticleFlowEventFilter_r207 )
-
+DECLARE_COMPONENT( CombinePFO )
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/CMakeLists.txt b/Reconstruction/PFlow/PFlowValidation/PFODQA/CMakeLists.txt
index 4212942edcb..1ba0b67b81c 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFODQA/CMakeLists.txt
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/CMakeLists.txt
@@ -10,10 +10,10 @@ atlas_depends_on_subdirs( PUBLIC
                           GaudiKernel
                           PRIVATE
                           Control/AthenaMonitoring
+			  Control/StoreGate
                           Event/xAOD/xAODCaloEvent
                           Event/xAOD/xAODPFlow
 			  Event/xAOD/xAODTracking
-                          Reconstruction/PFlow/PFlowUtils
                           Reconstruction/PFlow/PFlowValidation/PFOHistUtils
                           Tracking/TrkValidation/TrkValHistUtils )
 
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValPFO.cxx b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValPFO.cxx
index 0efae73a673..a2ed45c58e2 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValPFO.cxx
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValPFO.cxx
@@ -5,8 +5,7 @@
 #include "PhysValPFO.h"
 #include "xAODPFlow/PFOContainer.h"
 
-PhysValPFO::PhysValPFO (const std::string& type, const std::string& name, const IInterface* parent ) : ManagedMonitorToolBase( type, name, parent ), m_vertexContainerReadHandle("PrimaryVertices"),m_retrievePFOTool("RetrievePFOTool",this), m_useLCScale(false), m_useNeutralPFO(false) {
-  declareProperty("RetrievePFOTool",m_retrievePFOTool,"Name of PFO getter");
+PhysValPFO::PhysValPFO (const std::string& type, const std::string& name, const IInterface* parent ) : ManagedMonitorToolBase( type, name, parent ), m_useLCScale(false), m_useNeutralPFO(false) {
   declareProperty("useLCScale",m_useLCScale, " Select which PFO setup to use - LC or EM ");
   declareProperty("useNeutralPFO", m_useNeutralPFO, "Select whether to use neutral or charged PFO");
 }
@@ -15,7 +14,10 @@ PhysValPFO::~PhysValPFO() {}
 
 StatusCode PhysValPFO::initialize(){
   ATH_CHECK(ManagedMonitorToolBase::initialize());
-  ATH_CHECK(m_retrievePFOTool.retrieve());
+
+  ATH_CHECK(m_vertexContainerReadHandleKey.initialize());
+  ATH_CHECK(m_PFOContainerHandleKey.initialize());
+
   return StatusCode::SUCCESS;
 }
 
@@ -57,15 +59,16 @@ StatusCode PhysValPFO::bookHistograms(){
 StatusCode PhysValPFO::fillHistograms(){
 
   const xAOD::Vertex* theVertex = nullptr;
-
+  
   if (!m_useNeutralPFO){
-    if(!m_vertexContainerReadHandle.isValid()){
-      ATH_MSG_WARNING("Invalid ReadHandle for xAOD::VertexContainer with key: " << m_vertexContainerReadHandle.key());
+    SG::ReadHandle<xAOD::VertexContainer> vertexContainerReadHandle(m_vertexContainerReadHandleKey);
+    if(!vertexContainerReadHandle.isValid()){
+      ATH_MSG_WARNING("Invalid ReadHandle for xAOD::VertexContainer with key: " << vertexContainerReadHandle.key());
     }
     else {
       //Vertex finding logic based on logic in JetRecTools/PFlowPseudoJetGetter tool
       //Usually the 0th vertex is the primary one, but this is not always the case. So we will choose the first vertex of type PriVtx
-      for (auto vertex : (*m_vertexContainerReadHandle.ptr())) {
+      for (auto vertex : *vertexContainerReadHandle) {
 	if (xAOD::VxType::PriVtx == vertex->vertexType() ) {
 	theVertex = vertex;
 	break;
@@ -77,29 +80,31 @@ StatusCode PhysValPFO::fillHistograms(){
     }//if valid read handle
   }
 
-  
-  const xAOD::PFOContainer* thePFOContainer = nullptr;
-
-  if (!m_useNeutralPFO) thePFOContainer = m_retrievePFOTool->retrievePFO(CP::EM,CP::charged);
-  else{
-    if (!m_useLCScale) thePFOContainer = m_retrievePFOTool->retrievePFO(CP::EM,CP::neutral);
-    else thePFOContainer = m_retrievePFOTool->retrievePFO(CP::LC,CP::neutral);
+  StatusCode sc = StatusCode::SUCCESS;
+  if (m_useNeutralPFO) {    
+    if (m_useLCScale) sc = m_PFOContainerHandleKey.assign("JetETMiss_LCNeutralParticleFlowObjects");
+    else sc = m_PFOContainerHandleKey.assign("JetETMissNeutralParticleFlowObjects");
   }
-
-  if (!thePFOContainer){
-    ATH_MSG_WARNING(" Have NULL pointer to xAOD::PFOContainer");
-    return StatusCode::SUCCESS;
+    
+  if (StatusCode::SUCCESS != sc) {
+    ATH_MSG_ERROR("Could not assign PFO Container key name");
+    return sc;
+  }
+    
+  SG::ReadHandle<xAOD::PFOContainer> PFOContainerReadHandle(m_PFOContainerHandleKey);
+  if(!PFOContainerReadHandle.isValid()){
+     ATH_MSG_WARNING("Invalid ReadHandle for xAOD::PFOContainer with key: " << PFOContainerReadHandle.key());
+     return StatusCode::SUCCESS;
   }
   
-  xAOD::PFOContainer::const_iterator firstPFO = thePFOContainer->begin();
-  xAOD::PFOContainer::const_iterator lastPFO = thePFOContainer->end();
-
-  for (; firstPFO != lastPFO; ++firstPFO) {
-    const xAOD::PFO* thePFO = *firstPFO;
-    if (!m_useNeutralPFO) m_PFOChargedValidationPlots->fill(*thePFO,theVertex);
-    else if (m_useNeutralPFO) m_PFONeutralValidationPlots->fill(*thePFO);
+  for (auto thePFO : *PFOContainerReadHandle){
+    if(thePFO){
+       if (!m_useNeutralPFO) m_PFOChargedValidationPlots->fill(*thePFO,theVertex);
+       else if (m_useNeutralPFO) m_PFONeutralValidationPlots->fill(*thePFO);
+    }
+    else ATH_MSG_WARNING("Invalid pointer to xAOD::PFO");
   }
-
+  
   return StatusCode::SUCCESS;
 
 }
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValPFO.h b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValPFO.h
index 638dc763098..c5d35c070d2 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValPFO.h
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValPFO.h
@@ -9,8 +9,9 @@
 #include "PFONeutralValidationPlots.h"
 #include "AthenaMonitoring/ManagedMonitorToolBase.h"
 #include <string>
-#include "PFlowUtils/IRetrievePFOTool.h"
 #include "xAODTracking/VertexContainer.h"
+#include "xAODPFlow/PFOContainer.h"
+#include "StoreGate/ReadHandleKey.h"
 
 class PhysValPFO : public ManagedMonitorToolBase {
 
@@ -31,17 +32,17 @@ public:
  private:
 
   /** ReadHandle to retrieve xAOD::VertexContainer */
-  SG::ReadHandle<xAOD::VertexContainer> m_vertexContainerReadHandle;
-  
+  SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainerReadHandleKey{this,"primaryVerticesName","PrimaryVertices","ReadHandleKey for the PrimaryVertices container"};
+
+  /** ReadHandle to retrieve xAOD::PFOContainer */
+  SG::ReadHandleKey<xAOD::PFOContainer> m_PFOContainerHandleKey{this,"PFOContainerName","JetETMissChargedParticleFlowObjects","ReadHandleKey for the PFO container"};
+    
   /** Pointer to class that deals with histograms for charged PFO */
   std::unique_ptr<PFOChargedValidationPlots> m_PFOChargedValidationPlots;
 
   /** Pointer to class that deals with histograms for neutral PFO */
   std::unique_ptr<PFONeutralValidationPlots> m_PFONeutralValidationPlots;
   
-  /** Tool to retrieve PFO */
-  ToolHandle<CP::IRetrievePFOTool> m_retrievePFOTool;
-
   /** Select which PFO setup to use - LC or EM */
   bool m_useLCScale;
   
diff --git a/Reconstruction/PanTau/PanTauEvent/PanTauEvent/CorrectedEflowMomentum.h b/Reconstruction/PanTau/PanTauEvent/PanTauEvent/CorrectedEflowMomentum.h
index 86b13012f18..431a0404ed2 100644
--- a/Reconstruction/PanTau/PanTauEvent/PanTauEvent/CorrectedEflowMomentum.h
+++ b/Reconstruction/PanTau/PanTauEvent/PanTauEvent/CorrectedEflowMomentum.h
@@ -158,7 +158,7 @@ protected:
 
 inline bool PanTau::CorrectedEflowMomentum::type( const CorrectedEflowMomentumType& type ) const
 {
-    if ( ( 1<<static_cast<const int>(type) ) &m_typeFlags ) return true;
+    if ( ( 1<<static_cast<int>(type) ) &m_typeFlags ) return true;
     return false;
 }
 
diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h b/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h
index f00a9730182..860685247a0 100755
--- a/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h
+++ b/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h
@@ -184,7 +184,7 @@ namespace VKalVrtAthena {
     double               m_mcTrkResolution;
     double               m_TruthTrkLen;
     bool                 m_extrapPV; //extrapolate reco and prim truth trks to PV (for testing only)
-    xAOD::Vertex*        m_thePV;
+    const xAOD::Vertex*  m_thePV;
     
     
     ToolHandle < Trk::ITrkVKalVrtFitter >  m_fitSvc;       // VKalVrtFitter tool
diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/AANT_Tools.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/AANT_Tools.cxx
index f4180aa32d3..e8bee707f94 100644
--- a/Reconstruction/VKalVrt/VrtSecInclusive/src/AANT_Tools.cxx
+++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/AANT_Tools.cxx
@@ -295,10 +295,10 @@ namespace VKalVrtAthena {
   //____________________________________________________________________________________________________
   StatusCode VrtSecInclusive::fillAANT_SelectedBaseTracks() {
     
-    xAOD::TrackParticleContainer *m_selectedBaseTracks ( nullptr );
-    ATH_CHECK( evtStore()->retrieve(m_selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
+    xAOD::TrackParticleContainer *selectedBaseTracks ( nullptr );
+    ATH_CHECK( evtStore()->retrieve(selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
     
-    for ( const auto& trk : *m_selectedBaseTracks ) {
+    for ( const auto& trk : *selectedBaseTracks ) {
       
       if( m_FillNtuple ) {
         uint8_t tmpT;
diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/TrackSelectionAlgs.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/TrackSelectionAlgs.cxx
index 3553d808d75..24891f30f6e 100644
--- a/Reconstruction/VKalVrt/VrtSecInclusive/src/TrackSelectionAlgs.cxx
+++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/TrackSelectionAlgs.cxx
@@ -28,8 +28,8 @@ namespace VKalVrtAthena {
     
     ATH_MSG_DEBUG( " > SelGoodTrkParticle: begin"  );
 
-    xAOD::TrackParticleContainer *m_selectedBaseTracks ( nullptr );
-    ATH_CHECK( evtStore()->retrieve(m_selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
+    xAOD::TrackParticleContainer *selectedBaseTracks ( nullptr );
+    ATH_CHECK( evtStore()->retrieve(selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
     
     //std::vector<const xAOD::TrackParticle*>::const_iterator   i_ntrk;
     AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
@@ -195,7 +195,7 @@ namespace VKalVrtAthena {
       // Here we firstly need to register the empty pointer to the container,
       // then need to do deep copy after then. This is the feature of xAOD.
       xAOD::TrackParticle *a_trk = new xAOD::TrackParticle;
-      m_selectedBaseTracks->emplace_back( a_trk );
+      selectedBaseTracks->emplace_back( a_trk );
       *a_trk = *trk;
       a_trk->auxdata<unsigned long>("trk_id")  = trk->index();
       a_trk->auxdata<int>("truth_barcode")     = static_cast<long int>( barcode );
diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx
index eda37a05cb4..376753c339f 100644
--- a/Reconstruction/VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx
+++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx
@@ -29,8 +29,8 @@ namespace VKalVrtAthena {
 
     ATH_MSG_DEBUG( "> VrtSecInclusive getNewTruthInfo()" );
 
-    xAOD::TrackParticleContainer *m_selectedBaseTracks ( nullptr );
-    ATH_CHECK( evtStore()->retrieve(m_selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
+    xAOD::TrackParticleContainer *selectedBaseTracks ( nullptr );
+    ATH_CHECK( evtStore()->retrieve(selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
     
     // Truth Vertex
     const xAOD::TruthVertexContainer*   truthVertices ( nullptr );//SS has worked but test below // Hide: moved to local scope
@@ -464,7 +464,7 @@ namespace VKalVrtAthena {
 	// if there are >=2 matched reco trks at vertex, do a quick fit
 	// 
 	ATH_MSG_DEBUG( "> getNewTruthInfo() : numReco "   <<   numReco );
-	ATH_MSG_DEBUG( "> getNewTruthInfo() : Selected trk size "   <<   m_selectedBaseTracks->size() );
+	ATH_MSG_DEBUG( "> getNewTruthInfo() : Selected trk size "   <<   selectedBaseTracks->size() );
 	ATH_MSG_DEBUG( "> getNewTruthInfo() : size of SelTrk_barcode "   <<   seltrk_barcode_list.size() );
 	//
 	int RefitSt =0;
@@ -475,7 +475,7 @@ namespace VKalVrtAthena {
 	double RefitChi2=0;
 	double RefitMass=0;
 	//
-	if( numReco>=2 && numReco<10 && m_selectedBaseTracks->size()>=2 ) {
+	if( numReco>=2 && numReco<10 && selectedBaseTracks->size()>=2 ) {
 
 	  vector<const xAOD::TrackParticle*>  ListMatBaseTracks( 0 );
 	  vector<const xAOD::NeutralParticle*>  dummyNeutrals( 0 );
@@ -484,8 +484,8 @@ namespace VKalVrtAthena {
 	  // first fill vector with selected tracks.
 	  for ( int itmp=0; itmp<numReco; ++itmp ) {
 
-	    for(  auto itrk = m_selectedBaseTracks->begin(); itrk!= m_selectedBaseTracks->end(); ++itrk ) {
-	      size_t isel = itrk - m_selectedBaseTracks->begin();
+	    for(  auto itrk = selectedBaseTracks->begin(); itrk!= selectedBaseTracks->end(); ++itrk ) {
+	      size_t isel = itrk - selectedBaseTracks->begin();
 	      
 	      ATH_MSG_DEBUG( "> getNewTruthInfo() : itmp/bcode of RecoTrks/SelTrk "
                              <<   itmp   <<   ","
diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/VertexingAlgs.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/VertexingAlgs.cxx
index 6a093e27cfe..d22b7ebc5c0 100644
--- a/Reconstruction/VKalVrt/VrtSecInclusive/src/VertexingAlgs.cxx
+++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/VertexingAlgs.cxx
@@ -47,11 +47,11 @@ namespace VKalVrtAthena {
     //ATH_CHECK( evtStore()->record( m_twoTrksVertexContainer, "VrtSecInclusive_All2TrksVertices" ) );
     //ATH_CHECK( evtStore()->record( m_twoTrksVertexAuxContainer, "VrtSecInclusive_All2TrksVerticesAux." ) );
 
-    xAOD::TrackParticleContainer *m_selectedBaseTracks ( nullptr );
-    ATH_CHECK( evtStore()->retrieve(m_selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
+    xAOD::TrackParticleContainer *selectedBaseTracks ( nullptr );
+    ATH_CHECK( evtStore()->retrieve(selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
     
-    xAOD::VertexContainer *m_twoTrksVertexContainer( nullptr );
-    ATH_CHECK( evtStore()->retrieve( m_twoTrksVertexContainer, "VrtSecInclusive_All2TrksVertices" ) );
+    xAOD::VertexContainer *twoTrksVertexContainer( nullptr );
+    ATH_CHECK( evtStore()->retrieve( twoTrksVertexContainer, "VrtSecInclusive_All2TrksVertices" ) );
     
     // Work variables
     vector<const xAOD::TrackParticle*>    ListBaseTracks;
@@ -64,17 +64,17 @@ namespace VKalVrtAthena {
     long int           Charge;
     double             Chi2 = 0.;
     
-    ATH_MSG_DEBUG(" > extractIncompatibleTracks: Selected Tracks = "<< m_selectedBaseTracks->size());
+    ATH_MSG_DEBUG(" > extractIncompatibleTracks: Selected Tracks = "<< selectedBaseTracks->size());
 
 
     // first make all 2-track vertices
-    for( auto itrk = m_selectedBaseTracks->begin(); itrk != m_selectedBaseTracks->end(); ++itrk ) {
-      for( auto jtrk = itrk; jtrk != m_selectedBaseTracks->end(); ++jtrk ) {
+    for( auto itrk = selectedBaseTracks->begin(); itrk != selectedBaseTracks->end(); ++itrk ) {
+      for( auto jtrk = itrk; jtrk != selectedBaseTracks->end(); ++jtrk ) {
 
         if( itrk == jtrk ) continue;
 
-        int itrk_id = itrk - m_selectedBaseTracks->begin();
-        int jtrk_id = jtrk - m_selectedBaseTracks->begin();
+        int itrk_id = itrk - selectedBaseTracks->begin();
+        int jtrk_id = jtrk - selectedBaseTracks->begin();
 
         // Attempt to think the combination is incompatible by default
         Incomp.emplace_back( itrk_id );
@@ -120,12 +120,12 @@ namespace VKalVrtAthena {
 
         // Create a xAOD::Vertex instance
         xAOD::Vertex *vertex = new xAOD::Vertex;
-        m_twoTrksVertexContainer->emplace_back( vertex );
+        twoTrksVertexContainer->emplace_back( vertex );
 
         for( auto *trk: ListBaseTracks ) {
 
           // Acquire link to the track
-          ElementLink<xAOD::TrackParticleContainer>  trackElementLink( *m_selectedBaseTracks, trk->index() );
+          ElementLink<xAOD::TrackParticleContainer>  trackElementLink( *selectedBaseTracks, trk->index() );
 
           // Register link to the vertex
           vertex->addTrackAtVertex( trackElementLink, 1. );
@@ -192,8 +192,8 @@ namespace VKalVrtAthena {
   {
     ATH_MSG_DEBUG(" > reconstruct2TrackVertices(): begin");
 
-    xAOD::TrackParticleContainer *m_selectedBaseTracks ( nullptr );
-    ATH_CHECK( evtStore()->retrieve(m_selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
+    xAOD::TrackParticleContainer *selectedBaseTracks ( nullptr );
+    ATH_CHECK( evtStore()->retrieve(selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
     
     // Graph method: Trk::pgraphm_()
     // used in order to find compatible sub-graphs from the incompatible graph
@@ -209,14 +209,14 @@ namespace VKalVrtAthena {
 
     // Solution of the graph method routine (minimal covering of the graph)
     // The size of the solution is returned by NPTR (see below)
-    long int* Solution = new long int[ m_selectedBaseTracks->size() ];
+    long int* Solution = new long int[ selectedBaseTracks->size() ];
 
     // Number of edges in the list
     // This is two-folded (a pair of incompatible tracks composes an edge).
     long int edges = Incomp.size()/2; 
 
     // input number of nodes in the graph.
-    long int NTracks = static_cast<long int>( m_selectedBaseTracks->size() );
+    long int NTracks = static_cast<long int>( selectedBaseTracks->size() );
 
     // Input variable; the threshold. Solutions shorter than nth are not returned (ignored).
     long int nth=2;    //VK some speed up
@@ -254,7 +254,7 @@ namespace VKalVrtAthena {
       newvrt.SelTrk.clear();
       for(int i=0; i<NPTR; i++) {
         newvrt.SelTrk.emplace_back(Solution[i]-1);
-        ListBaseTracks.emplace_back( m_selectedBaseTracks->at(Solution[i]-1) );
+        ListBaseTracks.emplace_back( selectedBaseTracks->at(Solution[i]-1) );
       }
 
       // Perform vertex fitting
@@ -291,7 +291,7 @@ namespace VKalVrtAthena {
     for(int iv=0; iv< static_cast<int>( (*WrkVrtSet).size() ); iv++) {
       if( (*WrkVrtSet)[iv].Chi2 > (4.*(*WrkVrtSet)[iv].SelTrk.size()) )
       {
-	StatusCode sc = DisassembleVertex( WrkVrtSet, iv, m_selectedBaseTracks );
+	StatusCode sc = DisassembleVertex( WrkVrtSet, iv, selectedBaseTracks );
 	if ( !sc.isSuccess() )
 	{
 	  REPORT_ERROR(sc) << "DisassembleVertex()";
@@ -358,13 +358,13 @@ namespace VKalVrtAthena {
   StatusCode VrtSecInclusive::reconstructNTrackVertices( std::vector<WrkVrt> *WrkVrtSet )
   {
     
-    xAOD::TrackParticleContainer *m_selectedBaseTracks ( nullptr );
-    ATH_CHECK( evtStore()->retrieve(m_selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
+    xAOD::TrackParticleContainer *selectedBaseTracks ( nullptr );
+    ATH_CHECK( evtStore()->retrieve(selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
     
     //
     //  Rearrangement of solutions
     //
-    const long int NTracks = static_cast<long int>( m_selectedBaseTracks->size() );
+    const long int NTracks = static_cast<long int>( selectedBaseTracks->size() );
 
     // TrkInVrt has IDs of each track which can contain array of vertices.
     // e.g. TrkInVrt->at( track_id ).size() gives the number of vertices which use the track [track_id].
@@ -397,12 +397,12 @@ namespace VKalVrtAthena {
 
         MergeVertices( WrkVrtSet, foundV1, foundV2 );
 
-        StatusCode sc = RefitVertex( WrkVrtSet->at(foundV1), m_selectedBaseTracks);
+        StatusCode sc = RefitVertex( WrkVrtSet->at(foundV1), selectedBaseTracks);
         if( sc.isFailure() )  continue;                            /* Bad fit - goto next solution */
 
         while ( minVrtVrtDistNext( WrkVrtSet, foundV1, foundV2) < m_VertexMergeCut) {
           MergeVertices( WrkVrtSet, foundV1, foundV2);
-          sc = RefitVertex( WrkVrtSet->at(foundV1), m_selectedBaseTracks);
+          sc = RefitVertex( WrkVrtSet->at(foundV1), selectedBaseTracks);
           if( sc.isFailure() )  break;                            /* Bad fit - goto next solution */
         }
 
@@ -415,7 +415,7 @@ namespace VKalVrtAthena {
 
         RemoveTrackFromVertex(WrkVrtSet, TrkInVrt, SelectedTrack, SelectedVertex);
 
-        StatusCode sc = RefitVertex( WrkVrtSet->at(SelectedVertex), m_selectedBaseTracks);
+        StatusCode sc = RefitVertex( WrkVrtSet->at(SelectedVertex), selectedBaseTracks);
         if( sc.isFailure() )  continue;                            /* Bad fit - goto next solution */
       }
 
@@ -431,7 +431,7 @@ namespace VKalVrtAthena {
       double tmpProb=TMath::Prob( (*WrkVrtSet)[iv].Chi2, 2*(*WrkVrtSet)[iv].SelTrk.size()-3 ); //Chi2 of the original vertex
 
       if(tmpProb<0.001){
-        tmpProb=improveVertexChi2( WrkVrtSet, iv, m_selectedBaseTracks);
+        tmpProb=improveVertexChi2( WrkVrtSet, iv, selectedBaseTracks);
         if(tmpProb<0.001)(*WrkVrtSet)[iv].Good=false;
       }
 
@@ -466,11 +466,11 @@ namespace VKalVrtAthena {
     //ATH_CHECK( evtStore()->record( m_secondaryVertexContainer, "VrtSecInclusive_SecondaryVertices" ) );
     //ATH_CHECK( evtStore()->record( m_secondaryVertexAuxContainer, "VrtSecInclusive_SecondaryVerticesAux." ) );
 
-    xAOD::TrackParticleContainer *m_selectedBaseTracks ( nullptr );
-    ATH_CHECK( evtStore()->retrieve(m_selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
+    xAOD::TrackParticleContainer *selectedBaseTracks ( nullptr );
+    ATH_CHECK( evtStore()->retrieve(selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
 
-    xAOD::VertexContainer *m_secondaryVertexContainer( nullptr );
-    ATH_CHECK( evtStore()->retrieve( m_secondaryVertexContainer, "VrtSecInclusive_SecondaryVertices" ) );
+    xAOD::VertexContainer *secondaryVertexContainer( nullptr );
+    ATH_CHECK( evtStore()->retrieve( secondaryVertexContainer, "VrtSecInclusive_SecondaryVertices" ) );
     
     // A weight parameter used in the algorithm.
     const double w_1 = 1.0;
@@ -489,7 +489,7 @@ namespace VKalVrtAthena {
 
       if(nth <= 1) continue;               /* Bad vertices */
 
-      StatusCode sc = RefitVertex( WrkVrt, m_selectedBaseTracks);
+      StatusCode sc = RefitVertex( WrkVrt, selectedBaseTracks);
       if( sc.isFailure() )  continue;   /* Bad fit - goto next solution */
 
 
@@ -545,7 +545,7 @@ namespace VKalVrtAthena {
       // Pre-check before storing vertex if the SV perigee is available
       bool good_flag = true;
       for(int itrk=0; itrk<nth; itrk++) {
-        xAOD::TrackParticle* trk = m_selectedBaseTracks->at( WrkVrt.SelTrk[itrk] );
+        xAOD::TrackParticle* trk = selectedBaseTracks->at( WrkVrt.SelTrk[itrk] );
         const Trk::Perigee* sv_perigee = m_trackToVertexTool->perigeeAtVertex( *trk, WrkVrt.vertex );
         if( !sv_perigee ) {
           ATH_MSG_INFO(" > refitAndSelectGoodQualityVertices: > Track index " << trk->index() << ": Failed in obtaining the SV perigee!" );
@@ -565,7 +565,7 @@ namespace VKalVrtAthena {
       for(int itrk=0; itrk<nth; itrk++) {
 
         // Here trk is not const - will augment SV perigee variables in the loop.
-        xAOD::TrackParticle* trk = m_selectedBaseTracks->at( WrkVrt.SelTrk[itrk] );
+        xAOD::TrackParticle* trk = selectedBaseTracks->at( WrkVrt.SelTrk[itrk] );
 
         ATH_MSG_DEBUG(" > refitAndSelectGoodQualityVertices: > Track index " << trk->index() << ": start." );
 
@@ -718,7 +718,7 @@ namespace VKalVrtAthena {
       // Firstly store the new vertex to the container before filling properties.
       // (This is the feature of xAOD.)
       xAOD::Vertex* vertex = new xAOD::Vertex;
-      m_secondaryVertexContainer->emplace_back( vertex );
+      secondaryVertexContainer->emplace_back( vertex );
 
       // Registering the vertex position to xAOD::Vertex
       vertex->setPosition( WrkVrt.vertex );
@@ -758,10 +758,10 @@ namespace VKalVrtAthena {
       // loop over the tracks comprising the vertex
       for( auto trk_id : WrkVrt.SelTrk ) {
 
-        const xAOD::TrackParticle *trk = m_selectedBaseTracks->at( trk_id );
+        const xAOD::TrackParticle *trk = selectedBaseTracks->at( trk_id );
 
         // Acquire link the track to the vertex
-        ElementLink<xAOD::TrackParticleContainer> link_trk( *m_selectedBaseTracks, static_cast<long unsigned int>(trk->index()) );
+        ElementLink<xAOD::TrackParticleContainer> link_trk( *selectedBaseTracks, static_cast<long unsigned int>(trk->index()) );
 
         // Register the link to the vertex
         vertex->addTrackAtVertex( link_trk, 1. );
@@ -798,7 +798,7 @@ namespace VKalVrtAthena {
 
 
     if( m_FillNtuple ) {
-      ATH_CHECK( fillAANT_SecondaryVertices( m_secondaryVertexContainer ) );
+      ATH_CHECK( fillAANT_SecondaryVertices( secondaryVertexContainer ) );
     }
 
     return StatusCode::SUCCESS;
@@ -807,8 +807,8 @@ namespace VKalVrtAthena {
   StatusCode VrtSecInclusive::mergeFinalVertices( std::vector<WrkVrt> *WrkVrtSet )
   {
     
-    xAOD::TrackParticleContainer *m_selectedBaseTracks ( nullptr );
-    ATH_CHECK( evtStore()->retrieve(m_selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
+    xAOD::TrackParticleContainer *selectedBaseTracks ( nullptr );
+    ATH_CHECK( evtStore()->retrieve(selectedBaseTracks, "VrtSecInclusive_SelectedTrackParticles") );
 
     while (true) {
       int foundV1(-9999), foundV2(-9999);
@@ -853,7 +853,7 @@ namespace VKalVrtAthena {
         ATH_MSG_DEBUG( "Merging FINAL vertices " << foundV1 << " and " << foundV2
             <<" which are separated by distance "<< foundMinVrtDst );
         MergeVertices( WrkVrtSet, foundV1, foundV2 );
-        StatusCode sc = RefitVertex( WrkVrtSet->at(foundV1), m_selectedBaseTracks);
+        StatusCode sc = RefitVertex( WrkVrtSet->at(foundV1), selectedBaseTracks);
         if( sc.isFailure() ) {
           //ATH_MSG_WARNING("Final merging vertex refit failed!!!!!");
           //return StatusCode::FAILURE;
diff --git a/Reconstruction/eflowRec/share/PFlowHiveExOpts.py b/Reconstruction/eflowRec/share/PFlowHiveExOpts.py
index f4437672df0..d1d0851963d 100644
--- a/Reconstruction/eflowRec/share/PFlowHiveExOpts.py
+++ b/Reconstruction/eflowRec/share/PFlowHiveExOpts.py
@@ -18,7 +18,6 @@ DetFlags.detdescr.ID_setOn()
 if hasattr(DetFlags,'BField_on'): DetFlags.BField_setOn()
 from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc
 AtlasTrackingGeometrySvc  = svcMgr.AtlasTrackingGeometrySvc
-include('RecExCond/AllDet_detDescr.py')
 
 #---------------------------------------------------------------------------------#
 # MT-specific code
diff --git a/Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py b/Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py
index 4c3b9c857d2..2d2cc273477 100644
--- a/Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py
+++ b/Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py
@@ -21,6 +21,9 @@ from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobpro
 from AthenaCommon.GlobalFlags import globalflags
 globalflags.Luminosity.set_Off()
 
+# Logging
+from AthenaCommon.Logging import logging
+_sflog = logging.getLogger('SimFlags')
 
 class InitFunctions(JobProperty):
     """
@@ -217,14 +220,14 @@ class PhysicsList(JobProperty):
                 n_value = n_value.replace("_VALIDATION", "")
                 if n_value not in self.allowedValues:
                     self.allowedValues.append(n_value)
-        from AthenaCommon.Logging import logging
-        _sflog = logging.getLogger('SimFlags')
         if n_value == 'FTFP_BERT_G4Precompound':
-            _sflog.warning( 'Setting G4CASCADE_USE_PRECOMPOUND for use of precompound model' )
+            _sflog.warning('Setting G4CASCADE_USE_PRECOMPOUND for use of ' +
+                           'precompound model' )
             os.environ['G4CASCADE_USE_PRECOMPOUND'] = '1'
             n_value = 'FTFP_BERT'
         elif 'G4CASCADE_USE_PRECOMPOUND' in os.environ:
-            _sflog.warning( 'Setting G4CASCADE_USE_PRECOMPOUND back to 0 (why was it set?)' )
+            _sflog.warning('Setting G4CASCADE_USE_PRECOMPOUND back to 0 ' +
+                           '(why was it set?)')
             os.environ['G4CASCADE_USE_PRECOMPOUND'] = '0'
         JobProperty.__setattr__(self, name, n_value)
 
@@ -368,14 +371,13 @@ class RandomSeedList(JobProperty):
         """Add seeds to internal seedlist. Seeds will be incremented by offset values."""
         newseed = name + " OFFSET " + str(jobproperties.SimFlags.RandomSeedOffset.get_Value()) + " " + str(seed1) + " " + str(seed2) #option 1b
 
-        from AthenaCommon.Logging import logging
-        _sflog = logging.getLogger('SimFlags')
         _sflog.info("Adding Simulation random number seed '" + newseed + "'")
 
         ## Ensure that each stream is only initialized once
         found = self.checkForExistingSeed(name)
         if found:
-            _sflog.error ("Initialization values for random number stream " + name + " already exist!")
+            _sflog.error("Initialization values for random number stream " +
+                         name + " already exist!")
         else:
             seedlist = self.get_Value()
             seedlist += [newseed]
@@ -385,10 +387,10 @@ class RandomSeedList(JobProperty):
         """print random seeds """
         from AthenaCommon.ConfigurableDb import getConfigurable
         rndmSvc = getConfigurable(jobproperties.SimFlags.RandomSvc.get_Value())()
-        from AthenaCommon.Logging import logging
-        _sflog = logging.getLogger('SimFlags')
-        _sflog.info ("Random Number Seeds stored in simFlag: " + str(self.get_Value()))
-        _sflog.info ("Random Number Seeds attached to Service '" + rndmSvc.name() + "': " + str(rndmSvc.Seeds))
+        _sflog.info("Random Number Seeds stored in simFlag: " +
+                    str(self.get_Value()))
+        _sflog.info("Random Number Seeds attached to Service '" +
+                    rndmSvc.name() + "': " + str(rndmSvc.Seeds))
 
     def checkRndmSvc(self):
         """Check if the random number service has already been defined"""
@@ -397,22 +399,26 @@ class RandomSeedList(JobProperty):
             from AthenaCommon.ConfigurableDb import getConfigurable
             rndmSvc = getConfigurable(jobproperties.SimFlags.RandomSvc.get_Value())()
             if len(rndmSvc.Seeds)!=0:
-                from AthenaCommon.Logging import logging
-                _sflog = logging.getLogger('SimFlags')
-                _sflog.warn (rndmSvc.name() + ".Seeds is not empty!")
-                _sflog.warn ("Random Number Seeds already attached to Service '" + rndmSvc.name() + "': " + str(rndmSvc.Seeds))
-                _sflog.warn ( "Please use simFlags.RandomSeedList.addSeed() instead!")
+                _sflog.warn(rndmSvc.name() + ".Seeds is not empty!")
+                _sflog.warn("Random Number Seeds already attached to Service '" +
+                            rndmSvc.name() + "': " + str(rndmSvc.Seeds))
+                _sflog.warn("Please use simFlags.RandomSeedList.addSeed() instead!")
                 for seedstring in rndmSvc.Seeds:
                     if 'OFFSET' not in seedstring:
-                        _sflog.warn ( "Existing Seed:'" + seedstring + "' incorrectly defined - missing OFFSET! Removing...")
+                        _sflog.warn("Existing Seed: '" + seedstring +
+                                    "' incorrectly defined - missing OFFSET! " +
+                                    "Removing...")
                     else:
-                        ## If seed is correctly formatted add seed properly
-                        ## after checking it hasn't already been defined in the stream list.
+                        # If seed is correctly formatted add seed properly after
+                        # checking it hasn't already been defined in the stream list.
                         splitseedstring = seedstring.split()
                         if self.checkForExistingSeed(splitseedstring[0]):
-                            _sflog.error ("Initialization values for random number stream " + splitseedstring[0] + " already exist!")
+                            _sflog.error("Initialization values for random " +
+                                         "number stream " + splitseedstring[0] +
+                                         " already exist!")
                         else:
-                            self.addSeed( splitseedstring[0], splitseedstring[3], splitseedstring[4] )
+                            self.addSeed( splitseedstring[0], splitseedstring[3],
+                                          splitseedstring[4] )
                 rndmSvc.Seeds = []
 
     def addtoService(self):
@@ -420,9 +426,8 @@ class RandomSeedList(JobProperty):
         """
         from AthenaCommon.ConfigurableDb import getConfigurable
         rndmSvc = getConfigurable(jobproperties.SimFlags.RandomSvc.get_Value())()
-        from AthenaCommon.Logging import logging
-        _sflog = logging.getLogger('SimFlags')
-        _sflog.info ("Adding Simulation random number seed stored in jobProperties to Random Number Service '" + rndmSvc.name() + "'")
+        _sflog.info("Adding Simulation random number seed stored in jobProperties " +
+                    "to Random Number Service '" + rndmSvc.name() + "'")
         self.checkRndmSvc()
         rndmSvc.Seeds += self.get_Value()
         from GaudiKernel.Configurable import WARNING
@@ -557,9 +562,8 @@ class RunDict(JobProperty):
         Get a run number based on the runs in the dictionary.  Returns
         as though we process a linear sequence for the moment
         """
-        _sflog = logging.getLogger('SimFlags')
         if len(self.get_Value())==0:
-            _sflog.warning ('No run dictionary - giving back run number -1')
+            _sflog.warning('No run dictionary - giving back run number -1')
             return -1
         else:
             total=0
@@ -568,7 +572,8 @@ class RunDict(JobProperty):
             for a in self.get_Value():
                 if baseJN<=self.get_Value()[a]: return a
                 else: baseJN-= self.get_Value()[a]
-        _sflog.warning ( 'Something went wrong with job '+str(a_job)+'. Returning run number -1.' )
+        _sflog.warning('Something went wrong with job ' + str(a_job) +
+                       '. Returning run number -1.' )
         return -1
 
 class DoLArBirk(JobProperty):
@@ -666,23 +671,30 @@ class OptionalUserActionList(JobProperty):
     # FIXME: why do we add the LoopKillerTool here???
     StoredValue = {'Run':[], 'Event':[], 'Tracking':[], 'Step':[],
                    'General':['G4UA::LooperKillerTool']}
-    def addAction(self,actionTool,roles=[]):
-        #Add the action to the end of the list of actions for each role.
+    def addAction(self, actionTool, roles=[]):
+        # If no roles specified, assume 'General'.
+        if len(roles) == 0:
+            self.StoredValue['General'] += [actionTool]
+        # Add the action to the end of the list of actions for each role.
         for role in roles:
             try:
-                self.StoredValue[role]+=[actionTool]
+                self.StoredValue[role] += [actionTool]
             except KeyError:
-                print "WARNING Attempt to assign to action",actionTool,"a role ",role,"which is not allowed"
+                _sflog.warn('Attempt to assign action %s to role %s not allowed' %
+                            (actionTool, role))
 
     def removeAction(self, actionTool, roles=['Run', 'Event', 'Tracking', 'Step']):
-         #Remove the action from the lists of actions for each role (remove from all by default) - no error if it isn't in the list.
+        # Remove the action from the lists of actions for each role
+        # (remove from all by default) - no error if it isn't in the list.
         for role in roles:
             try:
                 self.StoredValue[role].remove(actionTool)
             except KeyError:
-                print "WARNING Attempt to remove action",actionTool," from role ",role,"which is not allowed"
+                _sflog.warn('Attempt to remove action %s from role %s not allowed' %
+                            (actionTool, role))
             except ValueError:
-                print "WARNING Attempt to remove unkown action",actionTool,"from role ",role
+                _sflog.warn('Attempt to remove unknown action %s from role %s' %
+                            (actionTool, role))
 
 class G4Commands(JobProperty):
     """
@@ -818,8 +830,6 @@ class SimFlags(JobPropertyContainer):
 
 ## Register and populate the SimFlags container
 jobproperties.add_Container(SimFlags)
-from AthenaCommon.Logging import logging
-_sflog = logging.getLogger('SimFlags')
 for jpname in dir():
     jp = eval(jpname)
     import inspect
diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfig.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfig.py
index 73f1858fbab..eb246e9e709 100644
--- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfig.py
+++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfig.py
@@ -12,9 +12,14 @@ def getDefaultRunActions():
 # begin of event
 def getDefaultEventActions():
     from G4AtlasApps.SimFlags import simFlags
+    from AthenaCommon.BeamFlags import beamFlags
     defaultUA=[]
     if hasattr(simFlags, 'CalibrationRun') and simFlags.CalibrationRun() == 'LAr+Tile':
         defaultUA+=['G4UA::CaloG4::CalibrationDefaultProcessingTool']
+    # Cosmic filter
+    if flag_on('StoppedParticleFile') or (
+       beamFlags.beamType() == 'cosmics' and not simFlags.ISFRun):
+        defaultUA += ['G4UA::G4CosmicFilterTool']
     return defaultUA
 
 # stepping
@@ -70,10 +75,6 @@ def getDefaultActions():
     # Hit wrapper action
     if flag_on('CavernBG') and simFlags.CavernBG.get_Value() == 'Read':
         actions += ['G4UA::HitWrapperTool']
-    # Cosmic filter
-    if flag_on('StoppedParticleFile') or (
-       beamFlags.beamType() == 'cosmics' and not simFlags.ISFRun):
-        actions += ['G4UA::G4CosmicFilterTool']
     # Photon killer
     if simFlags.PhysicsList == 'QGSP_BERT_HP':
         actions += ['G4UA::PhotonKillerTool']
diff --git a/Simulation/G4Utilities/G4UserActions/python/G4UserActionsConfig.py b/Simulation/G4Utilities/G4UserActions/python/G4UserActionsConfig.py
index e87d90b4d92..a7b576184c3 100644
--- a/Simulation/G4Utilities/G4UserActions/python/G4UserActionsConfig.py
+++ b/Simulation/G4Utilities/G4UserActions/python/G4UserActionsConfig.py
@@ -29,7 +29,7 @@ def getFastMBKillerTool(name="G4UA::FastMBKillerTool", **kwargs):
 
 
 def addFastIDKillerTool(name="G4UA::FastIDKillerTool",system=False):
-    G4AtlasServicesConfig.addAction(name,['Run','Step'],system)
+    G4AtlasServicesConfig.addAction(name, ['General'], system)
 
 
 def getHIPKillerTool(name="G4UA::HIPKillerTool", **kwargs):
@@ -37,7 +37,7 @@ def getHIPKillerTool(name="G4UA::HIPKillerTool", **kwargs):
 
 
 def addHIPKillerTool(name="G4UA::HIPKillerTool",system=False):
-    G4AtlasServicesConfig.addAction(name,['Step'],system)
+    G4AtlasServicesConfig.addAction(name, ['General'], system)
 
 
 def getHIPLArVolumeAcceptTool(name="G4UA::HIPLArVolumeAcceptTool", **kwargs):
@@ -45,7 +45,7 @@ def getHIPLArVolumeAcceptTool(name="G4UA::HIPLArVolumeAcceptTool", **kwargs):
 
 
 def addHIPLArVolumeAcceptTool(name="G4UA::HIPLArVolumeAcceptTool", system=False):
-    G4AtlasServicesConfig.addAction(theTool,['Step','Event'],system)
+    G4AtlasServicesConfig.addAction(theTool, ['General'], system)
 
 
 def getLooperKillerTool(name="G4UA::LooperKillerTool", **kwargs):
@@ -69,7 +69,7 @@ def getMonopoleLooperKillerTool(name="G4UA::MonopoleLooperKillerTool", **kwargs)
 
 
 def addLooperKillerTool(name="G4UA::LooperKillerTool", system=False):
-    G4AtlasServicesConfig.addAction(name,['Step'],system)
+    G4AtlasServicesConfig.addAction(name, ['General'], system)
 
 
 def getMomentumConservationTool(name="G4UA::MomentumConservationTool", **kwargs):
@@ -77,7 +77,7 @@ def getMomentumConservationTool(name="G4UA::MomentumConservationTool", **kwargs)
 
 
 def addMomentumConservationTool(name="G4UA::MomentumConservationTool", system=False):
-    G4AtlasServicesConfig.addAction(name,['Step','Event'],system)
+    G4AtlasServicesConfig.addAction(name, ['General'], system)
 
 
 def getScoringVolumeTrackKillerTool(name="G4UA::ScoringVolumeTrackKillerTool", **kwargs):
@@ -85,7 +85,7 @@ def getScoringVolumeTrackKillerTool(name="G4UA::ScoringVolumeTrackKillerTool", *
 
 
 def addScoringVolumeTrackKillerTool(name="G4UA::ScoringVolumeTrackKillerTool", system=False):
-    G4AtlasServicesConfig.addAction(theTool,['Step','Event'],system)
+    G4AtlasServicesConfig.addAction(theTool, ['General'], system)
 
 
 def getScoringPlaneTool(name="G4UA::ScoringPlaneTool", **kwargs):
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
index 49a186f47a7..0dea0a22f87 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
@@ -83,3 +83,4 @@ atlas_add_component( ISF_FastCaloSimParametrization
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/*.py )
+atlas_install_runtime( scripts/*.py )
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h
index a5a60d826c1..a89cb928323 100755
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h
@@ -81,7 +81,7 @@ class ISF_HitAnalysis : public AthAlgorithm {
    virtual StatusCode execute();
    virtual StatusCode updateMetaData(IOVSVC_CALLBACK_ARGS);
 
-   IFastCaloSimGeometryHelper* GetCaloGeometry() const {return &(*m_CaloGeometryHelper);};
+   const IFastCaloSimGeometryHelper* GetCaloGeometry() const {return &(*m_CaloGeometryHelper);};
 
    const static int MAX_LAYER = 25;
 
@@ -173,14 +173,20 @@ class ISF_HitAnalysis : public AthAlgorithm {
    std::vector<std::vector<float> >* m_newTTC_entrance_phi;
    std::vector<std::vector<float> >* m_newTTC_entrance_r;
    std::vector<std::vector<float> >* m_newTTC_entrance_z;
+   std::vector<std::vector<float> >* m_newTTC_entrance_detaBorder;
+   std::vector<std::vector<bool> >* m_newTTC_entrance_OK;
    std::vector<std::vector<float> >* m_newTTC_back_eta;
    std::vector<std::vector<float> >* m_newTTC_back_phi;
    std::vector<std::vector<float> >* m_newTTC_back_r;
    std::vector<std::vector<float> >* m_newTTC_back_z;
+   std::vector<std::vector<float> >* m_newTTC_back_detaBorder;
+   std::vector<std::vector<bool> >* m_newTTC_back_OK;
    std::vector<std::vector<float> >* m_newTTC_mid_eta;
    std::vector<std::vector<float> >* m_newTTC_mid_phi;
    std::vector<std::vector<float> >* m_newTTC_mid_r;
    std::vector<std::vector<float> >* m_newTTC_mid_z;
+   std::vector<std::vector<float> >* m_newTTC_mid_detaBorder;
+   std::vector<std::vector<bool> >* m_newTTC_mid_OK;
    std::vector<float>* m_newTTC_IDCaloBoundary_eta;
    std::vector<float>* m_newTTC_IDCaloBoundary_phi;
    std::vector<float>* m_newTTC_IDCaloBoundary_r;
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCS1DRegression.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCS1DRegression.cxx
deleted file mode 100644
index cb881836b9c..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCS1DRegression.cxx
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-#include "TFCS1DRegression.h"
-#include "ISF_FastCaloSimEvent/TFCS1DFunction.h"
-
-#include "TMVA/Config.h"
-#include "TMVA/Tools.h"
-#include "TMVA/Reader.h"
-#include "TMVA/Factory.h"
-#include "TRandom1.h"
-#include "TFile.h"
-#include "TString.h"
-#include "TMath.h"
-
-#include "TMVA/DataLoader.h"
-
-#include "TMVA/IMethod.h"
-#include "TMVA/MethodMLP.h"
-
-using namespace std;
-
-
-void TFCS1DRegression::storeRegression(string weightfilename, vector<vector<double> > &fWeightMatrix0to1, vector<vector<double> > &fWeightMatrix1to2)
-{
-  
-	get_weights(weightfilename, fWeightMatrix0to1, fWeightMatrix1to2);
- 	
-  //for testing:
-  //validate(10,weightfilename);
- 
-}
-
-void TFCS1DRegression::validate(int Ntoys,string weightfilename)
-{
- 
- TRandom1* myRandom=new TRandom1(); myRandom->SetSeed(0);
- 
- //calculate regression from the weights and compare to TMVA value:
- cout<<endl;
- cout<<"--- Validating the regression value:"<<endl;
- for(int i=0;i<Ntoys;i++)
- {
-  double random=myRandom->Uniform(1);
-  //double myval=regression_value(random);
-  double myval=-1;
-  double tmvaval=tmvaregression_application(random,weightfilename);
-  cout<<"myvalue "<<myval<<" TMVA value "<<tmvaval<<endl;
- }
-}
-
-TH1* TFCS1DRegression::transform(TH1* h_input, float &rangeval, float& startval)
-{
-
-  bool do_transform=false;
-  float xmin=h_input->GetXaxis()->GetXmin();
-  float xmax=h_input->GetXaxis()->GetXmax();
-  if(xmin<0 || xmax>1) do_transform=true;
-
-  TH1D* h_out;
-
-  if(do_transform)
-  {
-    int nbins=h_input->GetNbinsX();
-    double min=0;
-    double max=1;
-    h_out=new TH1D("h_out","h_out",nbins,min,max);
-
-    for(int b=1;b<=nbins;b++)
-      h_out->SetBinContent(b,h_input->GetBinContent(b));
-
-    //store the inital range
-    rangeval=xmax-xmin;
-    startval=xmin;
-  }
-  if(!do_transform)
-  {
-    rangeval=-1;
-    h_out=(TH1D*)h_input->Clone("h_out");
-  }
-  return h_out;
-
-}
-
-double TFCS1DRegression::get_range_low(TH1* hist)
-{
-  double range_low=0.0;
-  int bin_start=-1;
-  for(int b=1;b<=hist->GetNbinsX();b++)
-  {
-    if(hist->GetBinContent(b)>0 && bin_start<0)
-    {
-      bin_start=b;
-      range_low=hist->GetBinContent(b);
-      b=hist->GetNbinsX()+1;
-    }
-  }
-  return range_low;
-}
-
-TH1* TFCS1DRegression::get_cumul(TH1* hist)
-{
-  TH1D* h_cumul=(TH1D*)hist->Clone("h_cumul");
-  double sum=0;
-  for(int b=1;b<=h_cumul->GetNbinsX();b++)
-  {
-    sum+=hist->GetBinContent(b);
-    h_cumul->SetBinContent(b,sum);
-  }
-  return h_cumul; 
-}
-
-int TFCS1DRegression::testHisto(TH1* hist, std::string weightfilename, float &rangeval, float &startval, std::string outfilename, int neurons_start, int neurons_end, double cut_maxdev, int ntoys)
-{
-  //int debug=1;
-
-  //transform the histogram
-  TH1* h_transf=transform(hist, rangeval, startval); h_transf->SetName("h_transf");
-  
-  //new! map the y-axis to 0-1:
-  
-  
-  //Turn the histogram into a tree:
-  std::vector<double> contents;
-  std::vector<double> centers;
-  for(int b=1;b<=h_transf->GetNbinsX();b++)
-  {
-    contents.push_back(h_transf->GetBinContent(b));
-    centers.push_back(h_transf->GetBinCenter(b));
-  }
-
-  TTree* tree=new TTree("tree","tree");
-  Float_t x,y;
-  tree->Branch("x",&x,"x/F");
-  tree->Branch("y",&y,"y/F");
-
-  for(unsigned int i=0;i<centers.size();i++)
-  {
-    y=(Float_t)(contents[i]);   //xvals are the BinContents
-    x=(Float_t)(centers[i]);    //yvals are the BinCenters
-
-    tree->Fill();
-  }
-  
-  double range_low=get_range_low(h_transf);
-
-  TRandom1* myRandom=new TRandom1(); myRandom->SetSeed(0);
-  
-  int do_range=1;
-  double maxdev=1000;
-  int neurons=neurons_start;
-  std::vector<TH1*> histos;
-  while(maxdev>cut_maxdev && neurons<=neurons_end)
-  {
-  	
-   int pass_training=0;
-   try
-   {
-    TFCS1DRegression::tmvaregression_training(neurons, tree, weightfilename, outfilename, pass_training);
-   }
-   catch(std::runtime_error &e)
-   {
-    std::cout<<"An exception occured: "<<e.what()<<std::endl;
-    std::cout<<"Continuing anyway :P"<<std::endl;
-    pass_training=0;
-   }
-    
-   if(pass_training)
-   {
-    
-    std::cout<<"Testing the regression with "<<ntoys<<" toys"<<std::endl;
-    TH1* h_output=(TH1*)h_transf->Clone("h_output");
-    h_output->Reset();
-    for(int i=0;i<ntoys;i++)
-    {
-     double random=myRandom->Uniform(1);
-     if(do_range && random<range_low) random=range_low;
-     double value=TFCS1DRegression::tmvaregression_application(random,weightfilename);
-     h_output->Fill(value);    
-    }
-     
-    TH1* h_cumul=get_cumul(h_output);
-    h_cumul->SetName(Form("h_cumul_neurons%i",neurons));
-    histos.push_back(h_cumul);
-     
-    maxdev=TFCS1DFunction::get_maxdev(h_transf,h_cumul);
-    std::cout<<"---> Neurons="<<neurons<<" MAXDEV="<<maxdev<<"%"<<std::endl;
-   }
-   
-   neurons++;
-   
-  }
-  
-  //TH1* histclone=(TH1*)hist->Clone("histclone");
-
-  /* 
-     TFile* out_iteration=new TFile(Form("output/iteration_%s.root",label.c_str()),"RECREATE");
-     for(int h=0;h<histos.size();h++)
-     {
-     out_iteration->Add(histos[h]);
-     }
-     out_iteration->Add(histclone);
-     out_iteration->Write();
-     out_iteration->Close();
-     */
-
-  int regression_success=1;
-  if(maxdev>cut_maxdev) regression_success=0;
-
-  int status=0;
-  if(regression_success)
-  {
-    std::cout<<"Regression successful. Weights are stored."<<std::endl;
-    if(rangeval<0)  status=1;
-    if(rangeval>=0) status=2;
-  }
-
-  if(!regression_success)
-  {
-    std::cout<<"Regression failed. Histogram is stored."<<std::endl;
-    status=3;
-  } //!success
-
-  return status;
-
-}
-
-
-double TFCS1DRegression::tmvaregression_application(double uniform, std::string weightfile)
-{
-
- using namespace TMVA;
- 
- TString myMethodList = "" ;
- TMVA::Tools::Instance();
- 
- std::map<std::string,int> Use;
- 
- Use["PDERS"]           = 0;   Use["PDEFoam"]         = 0;   Use["KNN"]            = 0;
- Use["LD"]             = 0;   Use["FDA_GA"]          = 0;   Use["FDA_MC"]          = 0;
- Use["FDA_MT"]          = 0;   Use["FDA_GAMT"]        = 0;   Use["MLP"]             = 1; 
- Use["SVM"]             = 0;   Use["BDT"]             = 0;   Use["BDTG"]            = 0;
- 
- // Select methods (don't look at this code - not of interest)
- if(myMethodList != "")
- {
-  for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;
-  std::vector<TString> mlist = gTools().SplitString( myMethodList, ',' );
-  for (UInt_t i=0; i<mlist.size(); i++)
-  {
-   std::string regMethod(mlist[i]);
-   if (Use.find(regMethod) == Use.end())
-   {
-    std::cout << "Method \"" << regMethod << "\" not known in TMVA under this name. Choose among the following:" << std::endl;
-    for(std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first << " ";
-    std::cout << std::endl;
-    return 0;
-   }
-   Use[regMethod] = 1;
-  }
- }
- 
- // --------------------------------------------------------------------------------------------------
- 
- TMVA::Reader *reader = new TMVA::Reader( "!Color:Silent");    
- 
- Float_t y=uniform;
- reader->AddVariable( "y", &y );
- 
- TString dir    = Form("dl/%s/",weightfile.c_str());
- TString prefix = "TMVARegression";
- 
- // Book method(s)
- for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++)
- {
-  if (it->second)
-  {
-   TString methodName = it->first + " method";
-   TString weightfilename = dir + prefix + "_" + TString(it->first) + ".weights.xml";
-   reader->BookMVA( methodName, weightfilename ); 
-  }
- }
- 
- Float_t val = (reader->EvaluateRegression("MLP method"))[0];
- 
- delete reader;
- return val;
-
-  return 0;
-}
-
-void TFCS1DRegression::tmvaregression_training(int neurons, TTree *regTree, std::string weightfile, std::string outfilename, int& pass_training)
-{
-
-  using namespace TMVA;
-
-  TString myMethodList = "" ;
-  TMVA::Tools::Instance();
-  std::map<std::string,int> Use;
-
-  Use["PDERS"] = 0;  Use["PDEFoam"] = 0; Use["KNN"] = 0;  Use["LD"]  = 0; Use["FDA_GA"] = 0; Use["FDA_MC"] = 0;
-  Use["FDA_MT"] = 0; Use["FDA_GAMT"] = 0; Use["MLP"] = 1; Use["SVM"] = 0; Use["BDT"] = 0; Use["BDTG"] = 0;
-
-  std::cout << std::endl; std::cout << "==> Start TMVARegression with "<<neurons<<" Neurons "<<std::endl;
-
-  if(myMethodList != "")
-  {
-    for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;
-    std::vector<TString> mlist = gTools().SplitString( myMethodList, ',' );
-    for (UInt_t i=0; i<mlist.size(); i++)
-    {
-      std::string regMethod(mlist[i]);
-      if (Use.find(regMethod) == Use.end())
-      {
-        std::cout << "Method \"" << regMethod << "\" not known in TMVA under this name. Choose among the following:" << std::endl;
-        for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first << " ";
-        std::cout << std::endl;
-        return;
-      }
-      Use[regMethod] = 1;
-    }
-  }
-  
-  TFile* outputFile = TFile::Open( outfilename.c_str(), "RECREATE" );
-
-  TMVA::DataLoader *dl=new TMVA::DataLoader("dl");
-
-  TMVA::Factory *factory = new TMVA::Factory( "TMVARegression", outputFile, "!V:!Silent:Color:DrawProgressBar:AnalysisType=Regression" );
-
-  TString dirname=Form("%s/",weightfile.c_str());
-  (TMVA::gConfig().GetIONames()).fWeightFileDir = dirname;
-  
-  dl->AddVariable( "y", "y", 'F' );
-  dl->AddTarget( "x" );
-  
-  Double_t regWeight  = 1.0;   
-
-  dl->AddRegressionTree( regTree, regWeight );
-  TCut mycut = "";
-  //dl->PrepareTrainingAndTestTree( mycut,"nTrain_Regression=0:nTest_Regression=1:SplitMode=Block:NormMode=NumEvents:!V" );
-  dl->PrepareTrainingAndTestTree( mycut,"nTrain_Regression=0:nTest_Regression=0:SplitMode=Alternate:NormMode=NumEvents:!V" );
-  
-  factory->BookMethod(dl, TMVA::Types::kMLP, "MLP",
-  Form("!H:!V:VerbosityLevel=Info:NeuronType=sigmoid:NCycles=20000:HiddenLayers=%i:TestRate=6:TrainingMethod=BFGS:Sampling=0.3:SamplingEpoch=0.8:ConvergenceImprove=1e-6:ConvergenceTests=15:!UseRegulator",neurons)); 
-
-  // Train MVAs using the set of training events
-  factory->TrainAllMethods();
-  
-  // ---- Evaluate all MVAs using the set of test events
-  //factory->TestAllMethods();
-
-  // ----- Evaluate and compare performance of all configured MVAs
-  //factory->EvaluateAllMethods();
-
-  // Save the output
-  outputFile->Close();
-
-  std::cout << "==> Wrote root file: " << outputFile->GetName() << std::endl;
-  std::cout << "==> TMVARegression is done!" << std::endl;      
-  
-  delete factory;  
-  delete dl;
-  
-  pass_training=1;
-
-}
-
-
-void TFCS1DRegression::get_weights(string weightfile, vector<vector<double> > &fWeightMatrix0to1, vector<vector<double> > &fWeightMatrix1to2)
-{
- 
- using namespace TMVA;
- int debug=1;
- 
- TString myMethodList = "" ;
- TMVA::Tools::Instance();
- 
- std::map<std::string,int> Use;
-
- // --- Mutidimensional likelihood and Nearest-Neighbour methods
- Use["PDERS"]           = 0;   Use["PDEFoam"]         = 0;   Use["KNN"]            = 0;
- Use["LD"]		          = 0;   Use["FDA_GA"]          = 0;   Use["FDA_MC"]          = 0;
- Use["FDA_MT"]          = 0;   Use["FDA_GAMT"]        = 0;   Use["MLP"]             = 1; 
- Use["SVM"]             = 0;   Use["BDT"]             = 0;   Use["BDTG"]            = 0;
- // ---------------------------------------------------------------
-
- // Select methods (don't look at this code - not of interest)
- if (myMethodList != "")
- {
-  for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;
-  std::vector<TString> mlist = gTools().SplitString( myMethodList, ',' );
-  for (UInt_t i=0; i<mlist.size(); i++)
-  {
-   std::string regMethod(mlist[i]);
-   if (Use.find(regMethod) == Use.end())
-   {
-    std::cout << "Method \"" << regMethod << "\" not known in TMVA under this name. Choose among the following:" << std::endl;
-    for(std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first << " ";
-    std::cout << std::endl;
-   }
-   Use[regMethod] = 1;
-  }
- }
- 
- // --------------------------------------------------------------------------------------------------
- 
- TMVA::Reader *reader = new TMVA::Reader( "!Color:Silent");    
- 
- Float_t y=0.5; //just a dummy
- reader->AddVariable( "y", &y );
- 
- TString dir   = Form("dl/%s/",weightfile.c_str());
- TString prefix = "TMVARegression";
- 
- for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++)
- {
-  if (it->second)
-  {
-   TString methodName = it->first + " method";
-   TString weightfilename = dir + prefix + "_" + TString(it->first) + ".weights.xml";
-   reader->BookMVA( methodName, weightfilename ); 
-  }
- }
- 
- TMVA::IMethod* m=reader->FindMVA("MLP method");
- TMVA::MethodMLP *mlp = dynamic_cast<TMVA::MethodMLP*>(m);
- TObjArray* Network=mlp->fNetwork;
- int num_neurons_input=((TObjArray*)Network->At(1))->GetEntriesFast()-1;
- if(debug) cout<<"num_neurons_input "<<num_neurons_input<<endl;
-// mlp->MakeClass(Form("mlpcode_neurons%i.C",num_neurons_input));
- 
- int fLayers = Network->GetEntriesFast();
- 
- for(int a=0;a<((TObjArray*)Network->At(1))->GetEntriesFast();a++)
- {
-  vector<double> thisvector;
-  for(int b=0;b<((TObjArray*)Network->At(0))->GetEntriesFast();b++)
-   thisvector.push_back(0);
-  fWeightMatrix0to1.push_back(thisvector);
- }
- 
- for(int a=0;a<((TObjArray*)Network->At(2))->GetEntriesFast();a++)
- {
-  vector<double> thisvector;
-  for(int b=0;b<((TObjArray*)Network->At(1))->GetEntriesFast();b++)
-   thisvector.push_back(0);
-  fWeightMatrix1to2.push_back(thisvector);
- }
- 
- 
- TObjArray* curLayer= (TObjArray*)Network->At(0);
- Int_t numNeurons = curLayer->GetEntriesFast();
- for (Int_t n = 0; n < numNeurons; n++)
- {  
-  TMVA::TNeuron* neuron = (TMVA::TNeuron*)curLayer->At(n);
-  int numSynapses = neuron->NumPostLinks();
-  for (int s = 0; s < numSynapses; s++)
-  {
-   TMVA::TSynapse* synapse = neuron->PostLinkAt(s);  
-   fWeightMatrix0to1[s][n]=synapse->GetWeight();
-   if(debug) cout<<"fWeightMatrix0to1["<<s<<"]["<<n<<"] "<<synapse->GetWeight()<<endl;
-  }
- }
- 
- curLayer= (TObjArray*)Network->At(1);
- numNeurons = curLayer->GetEntriesFast();
- for (Int_t n = 0; n < numNeurons; n++)
- {  
-  TMVA::TNeuron* neuron = (TMVA::TNeuron*)curLayer->At(n);
-  int numSynapses = neuron->NumPostLinks();
-  for (int s = 0; s < numSynapses; s++)
-  {
-   TMVA::TSynapse* synapse = neuron->PostLinkAt(s);  
-   fWeightMatrix1to2[s][n]=synapse->GetWeight();
-   if(debug) cout<<"fWeightMatrix1to2["<<s<<"]["<<n<<"] "<<synapse->GetWeight()<<endl;
-  }
- }
- 
- delete reader;
- 
-}
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCS1DRegression.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCS1DRegression.h
deleted file mode 100644
index 61c41d95a12..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCS1DRegression.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef TFCS1DRegression_h
-#define TFCS1DRegression_h
-
-// STL includes
-#include <string>
-
-#include "TH1.h"
-#include "TTree.h"
-
-class TFCS1DRegression
-{
-  public:
-    TFCS1DRegression() {};
-    ~TFCS1DRegression() {};
-    
-    static int testHisto(TH1* hist, std::string, float&, float&, std::string, int, int, double, int);
-    static void storeRegression(string, vector<vector<double> > &fWeightMatrix0to1, vector<vector<double> > &fWeightMatrix1to2);
-    static void get_weights(string weightfile, vector<vector<double> > &fWeightMatrix0to1, vector<vector<double> > &fWeightMatrix1to2);
-    
-    static TH1* transform(TH1* h_input, float &rangeval, float& startval);
-    static double get_range_low(TH1* hist);
-    static void tmvaregression_training(int, TTree *regTree, std::string, std::string, int&);
-    static TH1* get_cumul(TH1* hist);
-    static double tmvaregression_application(double, std::string);
-    static void validate(int,string);
-    
-};
-
-#if defined(__MAKECINT__)
-#pragma link C++ class TFCS1DRegression+;
-#endif
-
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCSFunction.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCSFunction.cxx
deleted file mode 100644
index 234903d818e..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCSFunction.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "ISF_FastCaloSimEvent/TFCS1DFunctionRegression.h"
-#include "ISF_FastCaloSimEvent/TFCS1DFunctionRegressionTF.h"
-#include "ISF_FastCaloSimEvent/TFCS1DFunctionHistogram.h"
-#include "ISF_FastCaloSimEvent/TFCS1DFunction.h"
-
-#include "TFCSFunction.h"
-#include "TFCS1DRegression.h"
-
-#include "TFile.h"
-#include "TRandom1.h"
-
-
-#include <iostream>
-
-//#include <string>
-#include <sstream>
-
-using namespace std;
-
-//=============================================
-//======= TFCSFunction =========
-//=============================================
-
-
-TFCS1DFunction* TFCSFunction::Create(TH1* hist,int skip_regression,int neurons_start, int neurons_end, double maxdev_regression, double maxdev_smartrebin, int ntoys)
-{
- int verbose_level=1;
- 
- // This function is called by the user when he wants a histogram to be transformed into a space efficient variant for the parametrization.
- // All code that decides whether a histogram should be transformed into a TFCS1DFunctionRegression or TFCS1DFunctionHistogram
- // should go here. 
- 
- TRandom1* random=new TRandom1();
- random->SetSeed(0);
- int myrand=floor(random->Uniform()*1000000);
- stringstream ss;
- ss << myrand;
- string myrandstr = ss.str();
- 
- string xmlweightfilename="regressionweights"+myrandstr;
- string outfilename="TMVAReg"+myrandstr+".root";
- float rangeval, startval;
- 
- TFCS1DFunctionRegression* freg=0;
- TFCS1DFunctionRegressionTF* fregTF=0;
- TFCS1DFunctionHistogram* fhis=0;
- 
- int status=3;
- 
- if(!skip_regression)
-  status=TFCS1DRegression::testHisto(hist,xmlweightfilename,rangeval,startval,outfilename,neurons_start,neurons_end,maxdev_regression,ntoys);
- 
- if(verbose_level==1) cout<<"--- testHisto status="<<status<<endl;
- if(status==1)
- {
- 	if(verbose_level==1) cout<<"Regression"<<endl;
-  freg=new TFCS1DFunctionRegression();
-  vector<vector<double> > fWeightMatrix0to1;
-  vector<vector<double> > fWeightMatrix1to2;
-  TFCS1DRegression::storeRegression(xmlweightfilename, fWeightMatrix0to1, fWeightMatrix1to2);
-  freg->set_weights(fWeightMatrix0to1, fWeightMatrix1to2);
-  remove(outfilename.c_str());
-  remove(Form("dl/%s/TMVARegression_MLP.weights.xml",xmlweightfilename.c_str()));
-  remove(Form("dl/%s",xmlweightfilename.c_str()));
-  return freg;
- }
- if(status==2)
- {
- 	if(verbose_level==1) cout<<"Regression and Transformation"<<endl;
-  fregTF=new TFCS1DFunctionRegressionTF(rangeval,startval);
-  vector<vector<double> > fWeightMatrix0to1;
-  vector<vector<double> > fWeightMatrix1to2;
-  TFCS1DRegression::storeRegression(xmlweightfilename, fWeightMatrix0to1, fWeightMatrix1to2);
-  fregTF->set_weights(fWeightMatrix0to1, fWeightMatrix1to2);
-  remove(outfilename.c_str());
-  remove(Form("dl/%s/TMVARegression_MLP.weights.xml",xmlweightfilename.c_str()));
-  remove(Form("dl/%s",xmlweightfilename.c_str()));
-  return fregTF;
- }
- if(status==3)
- {
-  cout<<"xmlweightfilename: "<<xmlweightfilename<<endl;
-  remove(outfilename.c_str());
-  remove(Form("dl/%s/TMVARegression_MLP.weights.xml",xmlweightfilename.c_str()));
-  remove(Form("dl/%s",xmlweightfilename.c_str()));
- 	if(verbose_level==1) cout<<"Histogram"<<endl;
-  fhis=new TFCS1DFunctionHistogram(hist, verbose_level,maxdev_smartrebin);
-  return fhis;
- }
- if(status==0)
- {
- 	cout<<"something went wrong :("<<endl;
-  return 0;	
- }
- 
- return 0;
- 
-}
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCSFunction.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCSFunction.h
deleted file mode 100644
index 623e8f036f7..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/TFCSFunction.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef TFCSFunction_h
-#define TFCSFunction_h
-
-#include "ISF_FastCaloSimEvent/TFCS1DFunction.h"
-
-class TFCSFunction
-{
-  public:
-    TFCSFunction() {};
-    //virtual ~TFCSFunction() {};
-    ~TFCSFunction() {};
-    
-    static TFCS1DFunction* Create(TH1* hist,int,int,int,double,double,int);
-  
-  private:
-
-  ClassDef(TFCSFunction,1)
- 
-};
-
-#if defined(__MAKECINT__)
-#pragma link C++ class TFCSFunction+;
-#endif
-
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/firstPCA.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/firstPCA.cxx
deleted file mode 100644
index 83a74beb242..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/firstPCA.cxx
+++ /dev/null
@@ -1,597 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-using namespace std;
-
-#include "TMatrixD.h"
-#include "TVectorD.h"
-#include "TH1D.h"
-#include "TFile.h"
-#include "TROOT.h"
-#include "TSystem.h"
-#include "TApplication.h"
-#include "TTree.h"
-#include "TSystem.h"
-#include "TH2D.h"
-#include "TPrincipal.h"
-#include "TMath.h"
-#include "TBrowser.h"
-#include "firstPCA.h"
-#include "ISF_FastCaloSimParametrization/TreeReader.h"
-#include "TLorentzVector.h"
-#include "TChain.h"
-
-#include <iostream>
-
-firstPCA::firstPCA()
-{
-  //default parameters:
-  m_numberfinebins=5000;
-  m_edepositcut=0.001;
-  m_cut_eta_low=-100;
-  m_cut_eta_high=100;
-  m_nbins1=5;
-  m_nbins2=1;
-  m_debuglevel=0;
-  m_apply_etacut=1;
-  
-  m_outfilename="";
-  m_chain = 0;
-}
-
-firstPCA::firstPCA(TChain* chain,string outfilename)
-{
-  //default parameters:
-  m_numberfinebins=5000;
-  m_edepositcut=0.001;
-  m_cut_eta_low=-100;
-  m_cut_eta_high=100;
-  m_nbins1=5;
-  m_nbins2=1;
-  m_debuglevel=0;
-
-  m_outfilename=outfilename;
-  m_chain=chain;
-
-}
-
-void firstPCA::apply_etacut(int flag)
-{
- m_apply_etacut=flag;
-}
-
-void firstPCA::set_cumulativehistobins(int bins)
-{
-  m_numberfinebins=bins;
-}
-
-void firstPCA::set_edepositcut(double cut)
-{
-  m_edepositcut=cut;
-}
-
-void firstPCA::set_etacut(double cut_low, double cut_high)
-{
-  m_cut_eta_low=cut_low;
-  m_cut_eta_high=cut_high;
-}
-
-void firstPCA::set_pcabinning(int bin1,int bin2)
-{
-  m_nbins1=bin1;
-  m_nbins2=bin2;
-}
-
-void firstPCA::run()
-{
-  cout<<endl;
-  cout<<"****************"<<endl;
-  cout<<"     1st PCA"<<endl;
-  cout<<"****************"<<endl;
-  cout<<endl;
-  cout<<"Now running firstPCA with the following parameters:"<<endl;
-  cout<<"  Energy deposit cut: "<<m_edepositcut<<endl;
-  cout<<"  PCA binning: 1st compo "<<m_nbins1<<", 2nd compo "<<m_nbins2<<endl;
-  cout<<"  Number of bins in the cumulative histograms "<<m_numberfinebins<<endl;
-  cout<<"  Eta cut: "<<m_cut_eta_low<<" "<<m_cut_eta_high<<endl;
-  cout<<"  Apply eta cut: "<<m_apply_etacut<<endl;
-  cout<<endl;
-  if(m_debuglevel) cout<<"initialize input tree reader"<<endl;
-  TreeReader* read_inputTree = new TreeReader();
-  read_inputTree->SetTree(m_chain);
-
-  vector<int> layerNr;
-  cout<<"--- Get relevant layers and Input Histograms"<<endl;
-  vector<TH1D*> histos_data=get_relevantlayers_inputs(layerNr,read_inputTree);
-
-  vector<string> layer;
-  for(unsigned int l=0;l<layerNr.size();l++)
-    layer.push_back(Form("layer%i",layerNr[l]));
-  layer.push_back("totalE");
-
-  vector<TH1D*> cumul_data =get_cumul_histos(layer, histos_data);
-
-  cout<<"--- Now define the TPrincipal"<<endl;
-  TPrincipal* principal = new TPrincipal(layer.size(),"ND");  //ND means normalize cov matrix and store data
-
-  TTree *T_Gauss = new TTree("T_Gauss","T_Gauss");
-  double* data_Gauss = new double[layer.size()];
-  int eventNumber;
-  for(unsigned int l=0;l<layer.size();l++)
-  {
-    T_Gauss->Branch(Form("data_Gauss_%s",layer[l].c_str()),&data_Gauss[l],Form("data_Gauss_%s/D",layer[l].c_str()));
-    T_Gauss->Branch("eventNumber",&eventNumber,"eventNumber/I");
-  }
-
-  cout<<"--- Uniformization/Gaussianization"<<endl;
-  for(int event=0;event<read_inputTree->GetEntries();event++)
-  {
-    read_inputTree->GetEntry(event);
-    eventNumber=event;
-
-    double E  = read_inputTree->GetVariable("TruthE");
-    double px = read_inputTree->GetVariable("TruthPx");
-    double py = read_inputTree->GetVariable("TruthPy");
-    double pz = read_inputTree->GetVariable("TruthPz");
-
-    TLorentzVector tlv;  tlv.SetPxPyPzE(px,py,pz,E);
-    bool pass_eta=0;
-    if(!m_apply_etacut) pass_eta=1;
-    if(m_apply_etacut)  pass_eta=(fabs(tlv.Eta())>m_cut_eta_low && fabs(tlv.Eta())<m_cut_eta_high);
-    if(pass_eta)
-    {
-      double total_e=read_inputTree->GetVariable("total_cell_energy");
-      for(unsigned int l=0;l<layer.size();l++)
-      {
-        double data = 0.;
-        //double data_uniform;
-
-        if(l==layer.size()-1)
-          data = total_e;
-        else
-          data = read_inputTree->GetVariable(Form("cell_energy[%d]",layerNr[l]))/total_e;
-
-        //Uniformization
-        double cumulant = get_cumulant(data,cumul_data[l]);
-        cumulant = TMath::Min(cumulant,1.-10e-10);
-        cumulant = TMath::Max(cumulant,0.+10e-10);
-        //data_uniform = cumulant;
-
-        //Gaussianization
-        double maxErfInvArgRange = 0.99999999;
-        double arg = 2.0*cumulant - 1.0;
-        arg = TMath::Min(+maxErfInvArgRange,arg);
-        arg = TMath::Max(-maxErfInvArgRange,arg);
-        data_Gauss[l] = 1.414213562*TMath::ErfInverse(arg);
-
-      } //for layers
-
-      //Add this datapoint to the PCA
-      principal->AddRow(data_Gauss);
-      T_Gauss->Fill();
-
-    } //pass eta
-    if(event%2000==0) cout<<event<<" from "<<read_inputTree->GetEntries()<<" done "<<endl;
-  } //event loop
-
-  cout<<"--- MakePrincipals()"<<endl;
-  principal->MakePrincipals();
-
-  cout<<"--- PCA Results"<<endl;
-  principal->Print("MSE");
-
-  cout<<"--- PCA application and binning of first principal component"<<endl;
-
-  TreeReader* tree_Gauss = new TreeReader();
-  tree_Gauss->SetTree(T_Gauss);
-
-  int Bin_1stPC1=0;
-  int Bin_1stPC2=0;
-
-  TH1D* hPCA_first_component = new TH1D("hPCA_first_component","hPCA_first_component",10000,-20,20);
-
-  for(int event=0;event<tree_Gauss->GetEntries();event++)
-  {
-    tree_Gauss->GetEntry(event);
-
-    double* data_PCA = new double[layer.size()];
-    double* input_data = new double[layer.size()];
-
-    for (unsigned int l=0;l<layer.size(); l++)
-      input_data[l] = tree_Gauss->GetVariable(Form("data_Gauss_%s",layer[l].c_str()));
-
-    principal->X2P(input_data,data_PCA);  
-    hPCA_first_component->Fill(data_PCA[0]); 
-  }
-
-  cout<<"--- Binning 1st Principal Component" <<endl;
-  double xq[m_nbins1]; double yq[m_nbins1];
-
-  //2D binning:
-  quantiles( hPCA_first_component, m_nbins1, xq , yq );
-  for (int m = 0; m < m_nbins1 ; m++)
-  {
-    int a=1;
-    if(m>0) a=hPCA_first_component->FindBin(yq[m-1]);
-    int b=hPCA_first_component->FindBin(yq[m]);
-    cout<<"Quantiles "<<m+1<<"  "<<xq[m]<<" "<<yq[m]<<" -> Events "<<hPCA_first_component->Integral(a,b-1)<<endl;
-  }
-
-  std::vector<TH1D*> h_compo1;
-  for(int m=0;m<m_nbins1;m++)
-    h_compo1.push_back(new TH1D(Form("h_compo1_bin%i",m),Form("h_compo1_bin%i",m),20000,-20,20));
-
-  cout<<"--- PCA application and binning 2nd principal component"<<endl;
-  for(int event=0;event<tree_Gauss->GetEntries();event++)
-  {
-    tree_Gauss->GetEntry(event);
-    double* data_PCA = new double[layer.size()];
-    double* input_data = new double[layer.size()];
-
-    for (unsigned int l=0;l<layer.size();l++)
-      input_data[l] = tree_Gauss->GetVariable(Form("data_Gauss_%s",layer[l].c_str()));
-
-    principal->X2P(input_data,data_PCA);
-
-    int firstbin=-42;
-    //Binning 1st PC
-    for(int m = 0 ; m < m_nbins1 ; m++)
-    {
-      if(m==0 && data_PCA[0] <= yq[0])
-        firstbin = 0;
-      if(m > 0 && data_PCA[0] > yq[m-1] && data_PCA[0] <= yq[m])
-        firstbin = m;
-    }
-
-    if (firstbin >= 0) h_compo1[firstbin]->Fill(data_PCA[1]);
-
-  }
-
-  // non-standard
-  //double yq2d[m_nbins1][m_nbins2];
-  std::vector<std::vector<double> > yq2d (m_nbins1, std::vector<double>(m_nbins2));
-
-  for(int m=0;m<m_nbins1;m++)
-  {
-    if(m_debuglevel) cout<<"now do m "<<m<<endl;
-    double xq2[m_nbins2]; double yq2[m_nbins2];
-    quantiles( h_compo1[m], m_nbins2, xq2 , yq2);
-    if(m_debuglevel) {
-      cout<<"1stPCA bin# "<<m<<" Events "<<h_compo1[m]->Integral()<<endl;
-    }
-
-    for (int u = 0; u < m_nbins2 ; u++)
-    {
-      int a=0;
-      if(u>0) a=h_compo1[m]->FindBin(yq2[u-1]);
-      int b=h_compo1[m]->FindBin(yq2[u]);
-      cout<<"Quantile # "<<u<<"  "<<xq2[u]<<" "<<yq2[u]<<" -> Events "<<h_compo1[m]->Integral(a,b-1)<<endl;
-    }
-
-    for(int u=0;u<m_nbins2;u++)
-      yq2d[m][u]=yq2[u];
-  }
-
-  // cleanup
-  for (auto it = h_compo1.begin(); it != h_compo1.end(); ++it)
-    delete *it;
-  h_compo1.clear();
-
-  cout<<"--- Fill a tree that has the bin information"<<endl;
-  int firstPCAbin;
-  double* data = new double[layer.size()];
-  TTree* tree_1stPCA=new TTree(Form("tree_1stPCA"),Form("tree_1stPCA"));
-  tree_1stPCA->Branch("firstPCAbin",&firstPCAbin,"firstPCAbin/I");
-  for(unsigned int l=0;l<layer.size();l++)
-    tree_1stPCA->Branch(Form("energy_%s",layer[l].c_str()),&data[l],Form("energy_%s/D",layer[l].c_str()));
-
-  for(int event=0;event<tree_Gauss->GetEntries();event++)
-  {
-    tree_Gauss->GetEntry(event);
-    double* data_PCA = new double[layer.size()];
-    double* input_data = new double[layer.size()];
-    int eventNumber=tree_Gauss->GetVariable("eventNumber");
-
-    for(unsigned int l=0; l<layer.size();l++)
-      input_data[l] = tree_Gauss->GetVariable(Form("data_Gauss_%s",layer[l].c_str()));
-
-    //PCA Application
-    principal->X2P(input_data,data_PCA);
-
-    //Binning 1st and 2nd PC
-    for(int m = 0 ; m < m_nbins1 ; m++)
-    {
-      if(m==0 && data_PCA[0]<=yq[m])
-      {
-        Bin_1stPC1 = 0;
-        for(int u=0;u<m_nbins2;u++)
-        {
-          if(u==0 && data_PCA[1]<=yq2d[0][u])
-            Bin_1stPC2 = 0;
-          if(u>0 && data_PCA[1]>yq2d[0][u-1] && data_PCA[1]<=yq2d[0][u])
-            Bin_1stPC2 = u;
-        }
-      }
-      if(m>0 && data_PCA[0]>yq[m-1] && data_PCA[0]<=yq[m])
-      {
-        Bin_1stPC1 = m;
-        for(int u=0;u<m_nbins2;u++)
-        {
-          if(u==0 && data_PCA[1]<=yq2d[m][u])
-            Bin_1stPC2 = 0;
-          if(u>0 && data_PCA[1]>yq2d[m][u-1] && data_PCA[1]<=yq2d[m][u])
-            Bin_1stPC2 = u;
-        }
-      }   
-    }
-
-    firstPCAbin=Bin_1stPC1+m_nbins1*Bin_1stPC2+1;
-
-    //find the energy fractions and total energy for that given event
-    read_inputTree->GetEntry(eventNumber);
-    for(unsigned int l=0;l<layer.size();l++)
-    {
-      if(l==layer.size()-1)
-        data[l] = read_inputTree->GetVariable("total_cell_energy");
-      else
-        data[l] = read_inputTree->GetVariable(Form("cell_energy[%d]",layerNr[l]))/read_inputTree->GetVariable("total_cell_energy");
-    }
-
-    tree_1stPCA->Fill();
-
-  } //for events in gauss
-
-  //add a histogram that holds the relevant layer:
-
-  int totalbins=m_nbins1*m_nbins2;
-
-  TH2I* h_layer=new TH2I("h_layer","h_layer",totalbins,0.5,totalbins+0.5,25,-0.5,24.5);
-  h_layer->GetXaxis()->SetTitle("PCA bin");
-  h_layer->GetYaxis()->SetTitle("Layer");
-  for(int b=0;b<totalbins;b++)
-  {
-    for(int l=0;l<25;l++)
-    {
-      int is_relevant=0;
-      for(unsigned int i=0;i<layerNr.size();i++)
-      {
-        if(l==layerNr[i]) is_relevant=1;
-      }
-      h_layer->SetBinContent(b+1,l+1,is_relevant);
-    }
-  }
-
-  TFile* output=new TFile(m_outfilename.c_str(),"RECREATE");
-  output->Add(h_layer);
-  output->Add(tree_1stPCA);
-  output->Write();
-
-  cout<<"1st PCA is done. Output file: "<<m_outfilename<<endl;
-
-  // cleanup
-  delete read_inputTree;
-  delete tree_Gauss;
-
-} // run
-
-vector<TH1D*> firstPCA::get_cumul_histos(vector<string> layer, vector<TH1D*> histos)
-{
-
-  vector<TH1D*> cumul;
-
-  for(unsigned int i=0;i<histos.size();i++)
-  {
-    TH1D* h_cumul=(TH1D*)histos[i]->Clone(Form("h_cumul_%s",layer[i].c_str()));
-    for (int b=1; b<=h_cumul->GetNbinsX(); b++)
-    {
-      h_cumul->SetBinContent(b,histos[i]->Integral(1,b));
-      h_cumul->SetBinError(b,0);
-    }
-    cumul.push_back(h_cumul);
-  }
-
-  return cumul;
-
-}
-
-vector<TH1D*> firstPCA::get_relevantlayers_inputs(vector<int> &layerNr, TreeReader* read_inputTree)
-{
-
-  int NLAYER=25;
-
-  vector<TH1D*>  data;
-  vector<double> MaxInputs;
-  vector<double> MinInputs;
-
-  double max_e=0.0;
-  double min_e=100000000;
-
-  vector<double> sum_efraction;
-  for(int l=0;l<NLAYER;l++)
-  {
-    sum_efraction.push_back(0.0);
-    MaxInputs.push_back(0.0);
-    MinInputs.push_back(1000000.0);
-  }
-
-  int N_pass_eta=0;
-  for(int event=0;event<read_inputTree->GetEntries();event++ )
-  {
-    read_inputTree->GetEntry(event);
-    double E  = read_inputTree->GetVariable("TruthE");
-    double px = read_inputTree->GetVariable("TruthPx");
-    double py = read_inputTree->GetVariable("TruthPy");
-    double pz = read_inputTree->GetVariable("TruthPz");
-    TLorentzVector tlv; tlv.SetPxPyPzE(px,py,pz,E);
-    bool pass_eta=0;
-    if(!m_apply_etacut) pass_eta=1;
-    if(m_apply_etacut)  pass_eta=(fabs(tlv.Eta())>m_cut_eta_low && fabs(tlv.Eta())<m_cut_eta_high);
-    if(pass_eta)
-    {
-      N_pass_eta++;
-      double total_e=read_inputTree->GetVariable("total_cell_energy");
-      for(int l=0;l<NLAYER;l++)
-      {
-        double efraction = read_inputTree->GetVariable(Form("cell_energy[%d]",l))/total_e;
-        sum_efraction[l] += efraction;
-        if(efraction>MaxInputs[l]) MaxInputs[l]=efraction;
-        if(efraction<MinInputs[l]) MinInputs[l]=efraction;
-        if(total_e>max_e) max_e=total_e;
-        if(total_e<min_e) min_e=total_e;
-      }
-    }
-    if(event%2000==0) cout<<event<<" from "<<read_inputTree->GetEntries()<<" done"<<endl;
-  }
-
-  cout<<"rel. layer"<<endl;
-
-  for(int l=0;l<NLAYER;l++)
-  {
-    if(N_pass_eta>0)
-    {
-      if(sum_efraction[l]/N_pass_eta>=m_edepositcut)
-      {
-        layerNr.push_back(l);
-        cout<<"Layer "  <<l <<" is relevant! sum_efraction= "<<sum_efraction[l]<<" sum/entries= "<<sum_efraction[l]/N_pass_eta<<endl;
-      }
-    }
-  }
-
-  for(unsigned int k=0;k<layerNr.size();k++)
-    cout<<"Relevant "<<layerNr[k]<<endl;
-
-  cout<<"init data histos"<<endl;
-
-  for(int l=0;l<NLAYER;l++)
-  {
-    int is_rel=0;
-    for(unsigned int k=0;k<layerNr.size();k++)
-    {
-      if(l==layerNr[k])
-        is_rel=1;
-    }
-    if(is_rel)
-    {
-      TH1D* h_data=new TH1D(Form("h_data_layer%i",l),Form("h_data_layer%i",l),m_numberfinebins,MinInputs[l],MaxInputs[l]);
-      h_data->Sumw2();
-      data.push_back(h_data);
-    }
-  }
-  TH1D* h_data_total=new TH1D("h_data_totalE","h_data_totalE",m_numberfinebins,min_e,max_e);
-  data.push_back(h_data_total);
-
-  cout<<"fill data histos"<<endl;
-
-  for(int event=0;event<read_inputTree->GetEntries();event++)
-  {
-    read_inputTree->GetEntry(event);
-    TLorentzVector tlv;  tlv.SetPxPyPzE(read_inputTree->GetVariable("TruthPx"),read_inputTree->GetVariable("TruthPy"),read_inputTree->GetVariable("TruthPz"),read_inputTree->GetVariable("TruthE"));
-    bool pass_eta=0;
-    if(!m_apply_etacut) pass_eta=1;
-    if(m_apply_etacut)  pass_eta=(fabs(tlv.Eta())>m_cut_eta_low && fabs(tlv.Eta())<m_cut_eta_high);
-    if(pass_eta)
-    {
-      double total_e=read_inputTree->GetVariable("total_cell_energy");
-      ((TH1D*)data[data.size()-1])->Fill(total_e);
-      for(unsigned int l=0;l<layerNr.size();l++)
-      {
-        ((TH1D*)data[l])->Fill(read_inputTree->GetVariable(Form("cell_energy[%d]",layerNr[l]))/total_e);
-      }
-    }
-    if(event%2000==0) cout<<event<<" from "<<read_inputTree->GetEntries()<<" done"<<endl;
-  }
-  
-  for(unsigned int l=0;l<data.size();l++)
-  {
-    ((TH1D*)data[l])->Scale(1.0/data[l]->Integral());
-  }
-  
-  return data;
- 
-}
-
-
-double firstPCA::get_cumulant(double x, TH1D* h)
-{
-
-  //Cumulant "à la TMVA"
-
-  int nbin = h->GetNbinsX();
-  int bin = h->FindBin(x);
-  bin = TMath::Max(bin,1);
-  bin = TMath::Min(bin,h->GetNbinsX());
-
-
-  double AvNuEvPerBin;
-  double Tampon = 0 ;
-  for (int i=1; i<=nbin; i++) {
-    Tampon += h->GetBinContent(i);
-  }
-
-  AvNuEvPerBin = Tampon/nbin;
-
-  double cumulant;
-  double x0, x1, y0, y1;
-  double total = h->GetNbinsX()*AvNuEvPerBin;
-  double supmin = 0.5/total;
-
-  x0 = h->GetBinLowEdge(TMath::Max(bin,1));
-  x1 = h->GetBinLowEdge(TMath::Min(bin,h->GetNbinsX())+1);
-
-  y0 = h->GetBinContent(TMath::Max(bin-1,0)); // Y0 = F(x0); Y0 >= 0
-  y1 = h->GetBinContent(TMath::Min(bin, h->GetNbinsX()+1));  // Y1 = F(x1);  Y1 <= 1
-
-  //Zero bin
-  if (bin == 0) {
-    y0 = supmin;
-    y1 = supmin;
-  }
-  if (bin == 1) {
-    y0 = supmin;
-  }
-  if (bin > h->GetNbinsX()) {
-    y0 = 1.-supmin;
-    y1 = 1.-supmin;
-  }
-  if (bin == h->GetNbinsX()) {
-    y1 = 1.-supmin;
-  }
-
-  ////////////////////////
-
-  if (x0 == x1) {
-    cumulant = y1;
-  } else {
-    cumulant = y0 + (y1-y0)*(x-x0)/(x1-x0);
-  }
-
-  if (x <= h->GetBinLowEdge(1)){
-    cumulant = supmin;
-  }
-  if (x >= h->GetBinLowEdge(h->GetNbinsX()+1)){
-    cumulant = 1-supmin;
-  }
-
-  return cumulant;
-
-}
-
-
-void firstPCA::quantiles(TH1D* h, int nq, double* xq, double* yq)
-{
-
-  //Function for quantiles
-  // h Input histo
-  // nq number of quantiles
-  // xq position where to compute the quantiles in [0,1]
-  // yq array to contain the quantiles
-
-  for (int i=0;i<nq;i++)
-  {
-    xq[i] = double(i+1)/nq;
-    h->GetQuantiles(nq,yq,xq);
-  }
-
-}
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/firstPCA.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/firstPCA.h
deleted file mode 100644
index 6bc044711a0..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/firstPCA.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef firstPCA_h
-#define firstPCA_h
-#include "TChain.h"
-#include "ISF_FastCaloSimParametrization/TreeReader.h"
-
-using namespace std;
-
-class firstPCA
-{
-  public:
-  	
-    firstPCA(TChain*, string);
-    firstPCA();
-    virtual ~firstPCA() {}
-    void run();
-    vector<TH1D*> get_relevantlayers_inputs(vector<int> &, TreeReader*);
-    vector<TH1D*> get_cumul_histos(vector<string> layer, vector<TH1D*>);
-    static double get_cumulant(double x, TH1D* h);
-    void quantiles(TH1D* h, int nq, double* xq, double* yq);
-
-    void set_cumulativehistobins(int);
-    void set_edepositcut(double);
-    void set_etacut(double,double);
-    void apply_etacut(int);
-    void set_pcabinning(int,int);
-    
-  private:
-  	
-  	int    m_debuglevel;
-  	double m_cut_eta_low;
-  	double m_cut_eta_high;
-  	int    m_apply_etacut;
-  	int    m_nbins1;
-  	int    m_nbins2;
-  	int    m_numberfinebins;
-  	double m_edepositcut;
-  	string m_outfilename;
-  	TChain* m_chain;
-  	
-  ClassDef(firstPCA,1);
-  
-};
-
-#if defined(__MAKECINT__)
-#pragma link C++ class firstPCA+;
-#endif
-
-#endif
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/secondPCA.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/secondPCA.cxx
deleted file mode 100644
index 7b85b0c10bc..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/secondPCA.cxx
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TMatrixF.h"
-#include "TMatrixD.h"
-#include "TMatrixDSym.h"
-#include "TMatrixDSymEigen.h"
-#include "TVectorF.h"
-#include "TH1D.h"
-#include "TFile.h"
-#include "TROOT.h"
-#include "TSystem.h"
-#include "TApplication.h"
-#include "TTree.h"
-#include "TSystem.h"
-#include "TH2D.h"
-#include "TPrincipal.h"
-#include "TMath.h"
-#include "TBrowser.h"
-#include "secondPCA.h"
-#include "firstPCA.h"
-#include "TFCSFunction.h"
-#include "ISF_FastCaloSimEvent/TFCS1DFunction.h"
-#include "ISF_FastCaloSimParametrization/TreeReader.h"
-#include "ISF_FastCaloSimEvent/IntArray.h"
-
-#include <iostream>
-#include <sstream>
-
-using namespace std;
-
-secondPCA::secondPCA(string firstpcafilename, string outfilename)
-{
- m_firstpcafilename=firstpcafilename;
- m_outfilename=outfilename;
- 
- m_numberfinebins   =5000;
- m_storeDetails     =0;
- m_PCAbin           =-1; //-1 means all bins
- m_skip_regression  =0;
- m_neurons_start    =2;
- m_neurons_end      =8;
- m_ntoys            =1000;
- m_maxdev_regression=5;
- m_maxdev_smartrebin=5;
-}
-
-void secondPCA::set_cut_maxdeviation_regression(double val)
-{
- m_maxdev_regression=val;
-}
-
-void secondPCA::set_cut_maxdeviation_smartrebin(double val)
-{
- m_maxdev_smartrebin=val;
-}
-
-void secondPCA::set_Ntoys(int val)
-{
- m_ntoys=val;
-}
-
-void secondPCA::set_neurons_iteration(int start,int end)
-{
- m_neurons_start=start;
- m_neurons_end=end;
-}
-
-void secondPCA::set_storeDetails(int flag)
-{
- m_storeDetails=flag;
-}
-
-void secondPCA::set_cumulativehistobins(int bins)
-{
- m_numberfinebins=bins;
-}
-
-void secondPCA::set_PCAbin(int bin)
-{
- m_PCAbin=bin;
-}
-
-void secondPCA::set_skip_regression(int flag)
-{
- m_skip_regression=flag;
-}
-
-void secondPCA::run()
-{
- 
- //Open inputfile:
- TFile* inputfile=TFile::Open(m_firstpcafilename.c_str(),"READ");
- if(!inputfile) {
-   cout<<"ERROR: Inputfile could not be opened"<<endl;
-   // I don't think we can continue...
-   return;
- }
- 
- int nbins; int nbins0=1;
- vector<int> layerNr=getLayerBins(inputfile, nbins);
- //if a specific PCA bin was set,check if this is available, and set nbins to that
- if(m_PCAbin>0)
- {
- 	if(m_PCAbin<=nbins)
- 	{
- 	 nbins =m_PCAbin;
- 	 nbins0=m_PCAbin;
- 	 string binlabel=Form("_bin%i",m_PCAbin);
-   m_outfilename=m_outfilename+binlabel;
- 	}
- 	else cout<<"ERROR: The PCA bin you set is not available"<<endl;
- }
- 
- vector<string> layer;
- for(unsigned int l=0;l<layerNr.size();l++)
-  layer.push_back(Form("layer%i",layerNr[l]));
- layer.push_back("totalE");
- 
- int* samplings=new int[layerNr.size()];
- for(unsigned int i=0;i<layerNr.size();i++)
-  samplings[i]=layerNr[i];
- 
- cout<<endl;
- cout<<"****************"<<endl;
- cout<<"     2nd PCA"<<endl;
- cout<<"****************"<<endl;
- cout<<endl;
- cout<<"Now running 2nd PCA with the following parameters:"<<endl;
- cout<<"   Input file (1st PCA): "<<m_firstpcafilename<<endl;
- cout<<"   Number of bins of the cumulative histos: "<<m_numberfinebins<<endl;
- cout<<"   storeDetails: "<<m_storeDetails<<endl;
- cout<<"   PCA bin number(s): ";
- for(int b=nbins0;b<=nbins;b++) cout<<b<<" "; cout<<endl;
- cout<<"   skip regression: "<<m_skip_regression<<endl;
- cout<<"   Regression test toys:" <<m_ntoys<<endl;
- cout<<"   Neurons in the regression iteration:" <<m_neurons_start<<" - "<<m_neurons_end<<endl;
- cout<<"   Maximal deviation of approximated histogram (regression):  "<<m_maxdev_regression<<"%"<<endl;
- cout<<"   Maximal deviation of approximated histogram (smart-rebin): "<<m_maxdev_smartrebin<<"%"<<endl;
- cout<<endl;
- cout<<"--- Init the TreeReader"<<endl;
- TTree* InputTree = (TTree*)inputfile->Get("tree_1stPCA");
- TreeReader* read_inputTree = new TreeReader();
- read_inputTree->SetTree(InputTree);
- 
- TFile* output=new TFile(m_outfilename.c_str(),"RECREATE");
- for(int b=nbins0;b<=nbins;b++)
- {
-  output->mkdir(Form("bin%i",b));
-  output->mkdir(Form("bin%i/pca",b));
-	for(unsigned int l=0;l<layer.size();l++)
-   output->mkdir(Form("bin%i/%s",b,layer[l].c_str()));
- }
- output->Write();
- output->Close();
-
- for(int b=nbins0;b<=nbins;b++)
- {
-  cout<<"--- now performing 2nd PCA in bin "<<b<<endl;
-  do_pca(layer, b, read_inputTree, samplings);
- }
- 
- cout<<"2nd PCA is done. Output: "<<m_outfilename<<endl;
-
- // cleanup
- delete read_inputTree;
- delete[] samplings;
- 
-}
-
-void secondPCA::do_pca(vector<string> layer, int bin, TreeReader* read_inputTree, int* samplings)
-{
- 
- //make a tree that holds only the events for that 
- TTree* bintree=new TTree("bintree","bintree");
- double* data=new double[layer.size()];
- for(unsigned int l=0;l<layer.size();l++)
-  bintree->Branch(Form("energy_%s",layer[l].c_str()),&data[l],Form("energy_%s/D",layer[l].c_str()));
- for(int event=0;event<read_inputTree->GetEntries();event++)
- {
-  read_inputTree->GetEntry(event);
-  int firstPCAbin=read_inputTree->GetVariable("firstPCAbin");
-  if(firstPCAbin==bin)
-  {
-   for(unsigned int l=0;l<layer.size();l++)
-    data[l]=read_inputTree->GetVariable(Form("energy_%s",layer[l].c_str()));
-   bintree->Fill();
-  }
- }
- 
- //initialize the reader for this bintree
- TreeReader* read_bintree = new TreeReader();
- read_bintree->SetTree(bintree);
- 
- vector<TH1D*> histos_data=get_histos_data(layer, read_bintree);
- vector<TH1D*> cumul_data =get_cumul_histos(layer, histos_data);
- 
- TPrincipal* principal = new TPrincipal(layer.size(),"ND"); //ND means normalize cov matrix and store data
- TTree* T_Gauss=new TTree("T_Gauss","T_Gauss");
- double* data_Gauss=new double[layer.size()];
- for(unsigned int l=0;l<layer.size();l++)
-  T_Gauss->Branch(Form("energy_gauss_%s",layer[l].c_str()),&data_Gauss[l],Form("energy_gauss_%s/D",layer[l].c_str()));
- for(int event=0;event<read_bintree->GetEntries();event++)
- {
-  read_bintree->GetEntry(event);
-  for(unsigned int l=0;l<layer.size();l++)
-  {
-   double data=read_bintree->GetVariable(Form("energy_%s",layer[l].c_str()));
-   double cumulant = get_cumulant(data,cumul_data[l]);
-   cumulant = TMath::Min(cumulant,1.-10e-10);
-   cumulant = TMath::Max(cumulant,0.+10e-10);
-   //Gaussianization
-   double maxErfInvArgRange = 0.99999999;
-   double arg = 2.0*cumulant - 1.0;
-   arg = TMath::Min(+maxErfInvArgRange,arg);
-   arg = TMath::Max(-maxErfInvArgRange,arg);
-   data_Gauss[l] = 1.414213562*TMath::ErfInverse(arg);
-  }
-  principal->AddRow(data_Gauss);
-  T_Gauss->Fill();
- } //event loop
- 
- principal->MakePrincipals();
- cout<<std::endl <<"- Principal Component Analysis Results in bin "<<bin<<endl;
- principal->Print("MSE");
- 
- cout<<"--- Application to get Mean and RMS of the PCA transformed data"<<endl;
- TreeReader* reader_treeGauss = new TreeReader();
-
- cout<<"check1"<<endl;
- reader_treeGauss->SetTree(T_Gauss);
- 
- vector<double> data_PCA_min; vector<double> data_PCA_max;
- for(unsigned int l=0;l<layer.size();l++)
- {
- 	data_PCA_min.push_back(100000.0);
- 	data_PCA_max.push_back(-100000.0);
- }
- 
- for(int event=0;event<reader_treeGauss->GetEntries();event++)
- { 
-  reader_treeGauss->GetEntry(event);
-  double input_data[layer.size()];
-  double data_PCA[layer.size()];
-  for(unsigned int l=0;l<layer.size();l++)
-   input_data[l]=reader_treeGauss->GetVariable(Form("energy_gauss_%s",layer[l].c_str()));
-  principal->X2P(input_data,data_PCA);
-  for(unsigned int l=0;l<layer.size();l++)
-  {
-   if(data_PCA[l]>data_PCA_max[l]) data_PCA_max[l]=data_PCA[l];
-   if(data_PCA[l]<data_PCA_min[l]) data_PCA_min[l]=data_PCA[l];
-  }
- }
-
- //fill histograms
- std::vector<TH1D*> h_data_PCA;
- for(unsigned int l=0;l<layer.size();l++)
- {
- 	h_data_PCA.push_back(new TH1D(Form("h_data_PCA_%s",layer[l].c_str()),Form("h_data_PCA_%s",layer[l].c_str()),1000,data_PCA_min[l],data_PCA_max[l]));
- }
- for(int event=0;event<reader_treeGauss->GetEntries();event++)
- {
-  reader_treeGauss->GetEntry(event);
-  double input_data[layer.size()];
-  double data_PCA[layer.size()];
-  for(unsigned int l=0;l<layer.size();l++)
-   input_data[l]=reader_treeGauss->GetVariable(Form("energy_gauss_%s",layer[l].c_str()));
-  principal->X2P(input_data,data_PCA);
-  for(unsigned int l=0;l<layer.size();l++)
- 	 h_data_PCA[l]->Fill(data_PCA[l]);
- }
- double* gauss_means=new double[layer.size()];
- double* gauss_rms=new double[layer.size()];
- for(unsigned int l=0;l<layer.size();l++)
- {
- 	gauss_means[l]=h_data_PCA[l]->GetMean();
- 	gauss_rms[l]=h_data_PCA[l]->GetRMS();
- }
- 
- if(m_storeDetails)
- {
-  TFile* output=TFile::Open(m_outfilename.c_str(),"UPDATE");
-  output->cd(Form("bin%i/",bin));
-  for(unsigned int l=0;l<layer.size();l++)
-  {
-   h_data_PCA[l]->Write(Form("h_PCA_component%i",l));
-   histos_data[l]->Write(Form("h_input_%s",layer[l].c_str()));
-   cumul_data[l]->Write(Form("h_cumul_%s",layer[l].c_str()));
-  }
-  output->Write();
-  output->Close();
- }
- 
- // cleanup
- delete bintree;
- delete read_bintree;
- delete reader_treeGauss;
- delete T_Gauss;
- delete[] data;
- delete[] data_Gauss;
- for (auto it = h_data_PCA.begin(); it != h_data_PCA.end(); ++it)
-  delete *it;
- h_data_PCA.clear();
- 
- //get the lower ranges and store them:
- double* lowerBound=new double[layer.size()];
- for(unsigned int l=0;l<layer.size();l++)
- {
-  lowerBound[l]=get_lowerBound(cumul_data[l]);
- }
- 
- //Save EigenValues/EigenVectors/CovarianceMatrix in the output file
- IntArray* myArray=new IntArray((int)(layer.size()-1));
- myArray->Set(layer.size()-1,samplings);
- 
- TMatrixD* EigenVectors =(TMatrixD*)principal->GetEigenVectors();
- TMatrixD* CovarianceMatrix =(TMatrixD*)principal->GetCovarianceMatrix();
- TMatrixDSym *symCov=new TMatrixDSym();
- symCov->Use(CovarianceMatrix->GetNrows(),CovarianceMatrix->GetMatrixArray());  //symCov to be stored!
- 
- TVectorD* MeanValues  =(TVectorD*)principal->GetMeanValues();
- TVectorD* SigmaValues =(TVectorD*)principal->GetSigmas();
- TVectorD* Gauss_means =new TVectorD((int)(layer.size()),gauss_means); 
- TVectorD* Gauss_rms   =new TVectorD((int)(layer.size()),gauss_rms); 
- TVectorD* LowerBounds =new TVectorD((int)(layer.size()),lowerBound); 
- 
- TFile* output=TFile::Open(m_outfilename.c_str(),"UPDATE");
- output->cd(Form("bin%i/pca",bin));
- symCov->Write("symCov");
- //EigenVectors->Write("EigenVectors");
- MeanValues  ->Write("MeanValues");
- SigmaValues ->Write("SigmaValues");
- Gauss_means ->Write("Gauss_means");
- Gauss_rms   ->Write("Gauss_rms");
- myArray     ->Write("RelevantLayers");
- LowerBounds ->Write("LowerBounds");
- output->Write();
- output->Close();
- 
- //call the TFCS1DFunction to decide whether or not to use regression:
- for(unsigned int l=0;l<layer.size();l++)
- {
- 	cout<<endl;
- 	cout<<"====> Now create the fct object for "<<layer[l]<<" <===="<<endl;
-  cout<<endl;
-  stringstream ss;
-  ss << bin;
-  string binstring = ss.str();
-  TFCS1DFunction* fct=TFCSFunction::Create(cumul_data[l],m_skip_regression,m_neurons_start,m_neurons_end,m_maxdev_regression,m_maxdev_smartrebin,m_ntoys);
-  
-  //Store it:
-  TFile* output=TFile::Open(m_outfilename.c_str(),"UPDATE");
-  output->cd(Form("bin%i/%s/",bin,layer[l].c_str()));
-  fct->Write();
-  output->Write();
-  output->Close();
-  
- }
-  
-} //do_pca
-
-
-double secondPCA::get_lowerBound(TH1D* h_cumulative)
-{
- 
- /*
- double range_low=0;
- int bin_start,bin_end;
- bin_start=bin_end=-1;
- 
- for(int b=1;b<=h_cumulative->GetNbinsX();b++)
- {
- 	if(h_cumulative->GetBinContent(b)>0 && bin_start<0)
- 	{
- 	 bin_start=b;
- 	 range_low=(double)(h_cumulative->GetBinContent(b));
- 	}
- 	if(h_cumulative->GetBinContent(b)>0.9999999 && bin_end<0)
- 	{
- 	 bin_end=b;
- 	}
- }
- return range_low;
- */
- return h_cumulative->GetBinContent(1);
- 
-}
-
-
-vector<TH1D*> secondPCA::get_histos_data(vector<string> layer, TreeReader* read_bintree)
-{
- 
- vector<TH1D*> data;
- 
- //get the maxima per layer:
- vector<double> MaxInputs;
- for(unsigned int l=0;l<layer.size();l++) MaxInputs.push_back(0.0);
- 
- vector<double> MinInputs;
- for(unsigned int l=0;l<layer.size();l++) MinInputs.push_back(1000000.0);
-
- for(int event=0;event<read_bintree->GetEntries();event++)
- {
- 	read_bintree->GetEntry(event);
-  for(unsigned int l=0;l<layer.size();l++)
-  {
-   double val = read_bintree->GetVariable(Form("energy_%s",layer[l].c_str()));
-   if(val>MaxInputs[l])
-    MaxInputs[l]=val;
-   if(val<MinInputs[l])
-    MinInputs[l]=val;
-  }
- }
- 
- for(unsigned int l=0; l<layer.size(); l++)
- {
- 	TH1D* h_data;
-  h_data = new TH1D(Form("h_data_%s",layer[l].c_str()),Form("h_data_%s",layer[l].c_str()),m_numberfinebins,MinInputs[l],MaxInputs[l]);
-  for(int event=0;event<read_bintree->GetEntries();event++)
-  {
-   read_bintree->GetEntry(event);
-   h_data->Fill(read_bintree->GetVariable(Form("energy_%s",layer[l].c_str())));
-  }
-  
-  h_data->Sumw2();
-  h_data->Scale(1.0/h_data->Integral());
-  data.push_back(h_data);
-  
- } //for layer
- 
- return data;
- 
-}
-
-vector<int> secondPCA::getLayerBins(TFile* file, int &bins)
-{
- 
- vector<int> layer;
- 
- TH2I* h_layer=(TH2I*)file->Get("h_layer");
- 
- //the layers are stored in the y axis
- for(int i=1;i<=h_layer->GetNbinsY();i++)
- {
- 	if(h_layer->GetBinContent(1,i)==1) 
- 	 layer.push_back(h_layer->GetYaxis()->GetBinCenter(i));
- }
- 
- bins=h_layer->GetNbinsX();
- 
- return layer;
- 
-}
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/secondPCA.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/secondPCA.h
deleted file mode 100644
index a8993ba5c3b..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/epara/secondPCA.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef secondPCA_h
-#define secondPCA_h
-
-#include "ISF_FastCaloSimParametrization/TreeReader.h"
-#include "firstPCA.h"
-
-using namespace std;
-
-class secondPCA: public firstPCA
-{
-  public:
-  	
-    secondPCA(string,string);
-    //virtual ~secondPCA();
-    void run();
-    vector<int> getLayerBins(TFile* file, int &bins);
-		void do_pca(vector<string>, int, TreeReader*, int*);
-    vector<TH1D*> get_histos_data(vector<string> layer, TreeReader*);
-	  double get_lowerBound(TH1D* h_cumulative);
-	  
-	  void set_cumulativehistobins(int);
-	  void set_storeDetails(int);
-	  void set_skip_regression(int);
-    void set_PCAbin(int);
-    void set_cut_maxdeviation_regression(double val);
-    void set_cut_maxdeviation_smartrebin(double val);
-    void set_Ntoys(int val);
-    void set_neurons_iteration(int start,int end);
-	  
-  private:
-    
-    int m_numberfinebins;
-    int m_storeDetails;
-    int m_PCAbin;
-    int m_skip_regression;
-    string m_outfilename,m_firstpcafilename;
-    int m_neurons_start,m_neurons_end,m_ntoys;
-    double m_maxdev_regression,m_maxdev_smartrebin;
-    
-  ClassDef(secondPCA,2);
-  
-};
-
-#if defined(__MAKECINT__)
-#pragma link C++ class secondPCA+;
-#endif
-
-#endif
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
new file mode 100644
index 00000000000..2dfd9fa2392
--- /dev/null
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
@@ -0,0 +1,22 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import argparse
+import logging
+msg = logging.getLogger(__name__)
+import unittest
+import pickle
+import os
+
+from PyJobTransforms.trfArgClasses import argFactory, argFile, argInt, argFloat, argString, argSubstep, trfArgParser, argList, argBool, argPOOLFile, argHITSFile, argRDOFile, argSubstepInt, argSubstepBool
+## Add FCS Ntuple transform arguments
+def addFCS_NtupArgs(parser):
+    parser.defineArgGroup('FCS_Ntup_tf', 'FCS_Ntup_tf specific options')
+    parser.add_argument('--inputESDFile', nargs = '+',
+                        type=argFactory(argPOOLFile, io='input'),
+                        help='Input ESD files', group='FCS_Ntup_tf')
+    parser.add_argument('--outputNTUP_FCSFile', nargs = '+',
+                        type=argFactory(argFile, io='output'),
+                        help='Output NTUP_FCS files', group='FCS_Ntup_tf')
+    parser.add_argument('--outputGeoFileName',
+                        type=argFactory(argString),
+                        help='Optional geometry file', group='FCS_Ntup_tf')
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py
new file mode 100755
index 00000000000..15f51e0ca81
--- /dev/null
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py
@@ -0,0 +1,50 @@
+#! /usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+"""
+Run HITS file and produce histograms.
+"""
+
+import os.path
+import sys
+import time
+import logging
+
+# Setup core logging here
+from PyJobTransforms.trfLogger import msg
+msg.info('logging set in %s' % sys.argv[0])
+from PyJobTransforms.transform import transform
+from PyJobTransforms.trfExe import athenaExecutor
+from PyJobTransforms.trfArgs import addAthenaArguments, addDetectorArguments, addTriggerArguments
+from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace
+import PyJobTransforms.trfArgClasses as trfArgClasses
+from ISF_FastCaloSimParametrization.fcsTrfArgs import addFCS_NtupArgs
+
+@stdTrfExceptionHandler
+@sigUsrStackTrace
+def main():
+
+    msg.info('This is %s' % sys.argv[0])
+
+    trf = getTransform()
+    trf.parseCmdLineArgs(sys.argv[1:])
+    trf.execute()
+    trf.generateReport()
+
+    msg.info("%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode))
+    sys.exit(trf.exitCode)
+
+def getTransform():
+    executorSet = set()
+    executorSet.add(athenaExecutor(name = 'FCS_Ntup',
+                                   skeletonFile = 'ISF_FastCaloSimParametrization/skeleton.ESDtoNTUP_FCS.py',
+                                   inData = ['ESD'], outData = ['NTUP_FCS'],))
+    trf = transform(executor = executorSet, description = 'FastCaloSim V2 Parametrization ntuple transform. Inputs must be ESD. Outputs must bentuple files.')
+    addAthenaArguments(trf.parser)
+    addFCS_NtupArgs(trf.parser)
+    return trf
+
+
+if __name__ == '__main__':
+    main()
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple.py
index d36533ce642..0abd7f6f7c9 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple.py
@@ -11,107 +11,11 @@ import sys
 from glob import glob
 from AthenaCommon.AthenaCommonFlags  import athenaCommonFlags
 #specify input file here
-#athenaCommonFlags.FilesInput = glob( "ESDpion_eta1.pool.root" )
-#athenaCommonFlags.FilesInput = glob( "ESD_calo__211__E10000_10000__eta20_20_Evts0-1000_z03350.pool.root" )
-#athenaCommonFlags.FilesInput = glob( "ESD_*root" )
-#athenaCommonFlags.FilesInput = ["/afs/cern.ch/user/c/cmills/public/pions20GeV_fulldet.ESD.pool.root"]
-#athenaCommonFlags.FilesInput = ["/afs/cern.ch/user/c/cmills/public/pions20GeV_z0150_fulldet.ESD.pool.root"]
-#athenaCommonFlags.FilesInput = ["root://eosatlas//eos/atlas/user/z/zhubacek/FastCaloSim/ForMichael/ESD_evgen_calo__211_E50000_50000_eta20_25_Evts0-5500_vz_0_origin_calo.pool.root"]
 athenaCommonFlags.FilesInput = ["/afs/cern.ch/work/a/ahasib/public/photon.50GeV.ESD.pool.root"]
 
-ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-# To set up a geometry
-from RecExConfig.AutoConfiguration import *
-ConfigureFieldAndGeo() # Configure the settings for the geometry
-include("RecExCond/AllDet_detDescr.py") # Actually load the geometry
-
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-DetFlags.Calo_setOn()
-DetFlags.Muon_setOff()
-DetFlags.Forward_setOff()
-#include ('TrkDetDescrSvc/AtlasTrackingGeometrySvc.py')
-
-from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import ISF_HitAnalysis
-topSequence += ISF_HitAnalysis()
-
-#This can be used to text dump the TruthEvent container
-#from TruthExamples.TruthExamplesConf import DumpMC
-#dumpMC = DumpMC();
-#dumpMC.MCEventKey = "TruthEvent"
-#topSequence += DumpMC(McEventKey = "TruthEvent")
-
-ISF_HitAnalysis = ISF_HitAnalysis()
-ISF_HitAnalysis.NtupleFileName = 'ISF_HitAnalysis'
-
-##############################
-#ISF_HitAnalysis.CaloBoundaryR = [ 0., 1148., 1148., 0. ]
-#ISF_HitAnalysis.CaloBoundaryZ = [ -3475., -3475., 3475., 3475. ]
-
-ISF_HitAnalysis.CaloBoundaryR = 1148.0
-ISF_HitAnalysis.CaloBoundaryZ = 3549.5 #before: 3475.0
-ISF_HitAnalysis.CaloMargin=100 #=10cm
-ISF_HitAnalysis.NTruthParticles = 1 # Copy only one truth particle to the ntuples for now
-#ISF_HitAnalysis.OutputLevel = WARNING
-ISF_HitAnalysis.SaveAllBranches = False
-ISF_HitAnalysis.DoAllCells = False
-ISF_HitAnalysis.DoLayers = True
-ISF_HitAnalysis.DoLayerSums = True
-ISF_HitAnalysis.DoG4Hits = False
-ISF_HitAnalysis.TimingCut = 999999
-ISF_HitAnalysis.OutputLevel = DEBUG
-
-#############################
-##### NEW TRACKING SETUP ####
-#############################
-mlog = logging.getLogger( 'ISF_HitAnalysis::configure:' )
-mlog.info("now configure the non-interacting propagator...")
-from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator
-niPropagator = Trk__STEP_Propagator()
-niPropagator.MaterialEffects = False
-ToolSvc+=niPropagator
-mlog.info("configure nono-interacting propagator finished")
-
-mlog.info("now configure the TimedExtrapolator...")
-from TrkExTools.TimedExtrapolator import TimedExtrapolator
-timedExtrapolator=TimedExtrapolator()
-timedExtrapolator.STEP_Propagator = niPropagator
-timedExtrapolator.ApplyMaterialEffects = False
-ToolSvc+=timedExtrapolator
-mlog.info("configure TimedExtrapolator finished")
-
-from CaloTrackingGeometry.CaloTrackingGeometryConf import CaloSurfaceHelper
-caloSurfaceHelper = CaloSurfaceHelper()
-ToolSvc+=caloSurfaceHelper
-
-from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
-
-ISF_HitAnalysis.CaloEntrance=TrkDetFlags.InDetContainerName()
-ISF_HitAnalysis.CaloSurfaceHelper=caloSurfaceHelper
-ISF_HitAnalysis.Extrapolator=timedExtrapolator
-
-#############################
-
-from AthenaCommon.CfgGetter import getPublicTool
-
-#from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimGeometryHelper
-#FCSgeoHelper=FastCaloSimGeometryHelper()
-#ToolSvc+=FCSgeoHelper
-#ISF_HitAnalysis.CaloGeometryHelper=FCSgeoHelper
-fcsgeohelper= getPublicTool('FastCaloSimGeometryHelper')
-ToolSvc+=fcsgeohelper
-ISF_HitAnalysis.CaloGeometryHelper=fcsgeohelper
-
-ISF_HitAnalysis.FastCaloSimCaloExtrapolation= getPublicTool('FastCaloSimCaloExtrapolation')
-#ISF_HitAnalysis.FastCaloSimCaloExtrapolation.OutputLevel = DEBUG
-#ToolSvc.FastCaloSimCaloExtrapolation.OutputLevel = DEBUG
-ISF_HitAnalysis.FastCaloSimCaloExtrapolation.OutputLevel = ERROR
-ToolSvc.FastCaloSimCaloExtrapolation.OutputLevel = ERROR
+include("ISF_FastCaloSimParametrization/ISF_ntuple_core.py")
 
+theApp.EvtMax = 100 # Set to -1 for all events
 
 from GaudiSvc.GaudiSvcConf import THistSvc
 ServiceMgr += THistSvc()
@@ -122,17 +26,5 @@ print OutputName
 #Use this to automatically name the output file (rename ESD->ISF_HitAnalysis)
 ServiceMgr.THistSvc.Output += [ "ISF_HitAnalysis DATAFILE='"+OutputName+"' OPT='RECREATE'" ]
 from AthenaCommon.GlobalFlags import jobproperties
-ServiceMgr.THistSvc.Output += [ "ISF_Geometry DATAFILE='output_geo.root' OPT='RECREATE'" ]
-
-#ServiceMgr.MessageSvc.OutputLevel = INFO
-ServiceMgr.MessageSvc.OutputLevel = ERROR
-ServiceMgr.MessageSvc.defaultLimit = 9999999
-
-#All events by default
-#theApp.EvtMax = -1
-theApp.EvtMax = 100
-
-ServiceMgr.AuditorSvc.Auditors  += [ "ChronoAuditor"]
+# ServiceMgr.THistSvc.Output += [ "ISF_Geometry DATAFILE='output_geo.root' OPT='RECREATE'" ]
 
-AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc")
-AthenaPoolCnvSvc.UseDetailChronoStat = TRUE
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py
new file mode 100644
index 00000000000..f72c563bb64
--- /dev/null
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py
@@ -0,0 +1,98 @@
+from AthenaCommon.AppMgr import ServiceMgr
+import AthenaPoolCnvSvc.ReadAthenaPool
+
+from PartPropSvc.PartPropSvcConf import PartPropSvc
+
+include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py")
+include( "EventAthenaPool/EventAthenaPool_joboptions.py" )
+
+import os
+import sys
+from glob import glob
+from AthenaCommon.AthenaCommonFlags  import athenaCommonFlags
+
+ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary
+
+from AthenaCommon.AlgSequence import AlgSequence
+topSequence = AlgSequence()
+
+# To set up a geometry
+from RecExConfig.AutoConfiguration import *
+ConfigureFieldAndGeo() # Configure the settings for the geometry
+include("RecExCond/AllDet_detDescr.py") # Actually load the geometry
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.ID_setOn()
+DetFlags.Calo_setOn()
+DetFlags.Muon_setOff()
+DetFlags.Forward_setOff()
+
+from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import ISF_HitAnalysis
+topSequence += ISF_HitAnalysis()
+
+ISF_HitAnalysis = ISF_HitAnalysis()
+ISF_HitAnalysis.NtupleFileName = 'ISF_HitAnalysis'
+ISF_HitAnalysis.GeoFileName = 'ISF_Geometry'
+
+##############################
+
+ISF_HitAnalysis.CaloBoundaryR = 1148.0
+ISF_HitAnalysis.CaloBoundaryZ = 3549.5 #before: 3475.0
+ISF_HitAnalysis.CaloMargin=100 #=10cm
+ISF_HitAnalysis.NTruthParticles = 1 # Copy only one truth particle to the ntuples for now
+ISF_HitAnalysis.SaveAllBranches = False
+ISF_HitAnalysis.DoAllCells = False
+ISF_HitAnalysis.DoLayers = True
+ISF_HitAnalysis.DoLayerSums = True
+ISF_HitAnalysis.DoG4Hits = False
+ISF_HitAnalysis.TimingCut = 999999
+ISF_HitAnalysis.OutputLevel = ERROR
+
+#############################
+##### NEW TRACKING SETUP ####
+#############################
+mlog = logging.getLogger( 'ISF_HitAnalysis::configure:' )
+mlog.info("now configure the non-interacting propagator...")
+from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator
+niPropagator = Trk__STEP_Propagator()
+niPropagator.MaterialEffects = False
+ToolSvc+=niPropagator
+mlog.info("configure nono-interacting propagator finished")
+
+mlog.info("now configure the TimedExtrapolator...")
+from TrkExTools.TimedExtrapolator import TimedExtrapolator
+timedExtrapolator=TimedExtrapolator()
+timedExtrapolator.STEP_Propagator = niPropagator
+timedExtrapolator.ApplyMaterialEffects = False
+ToolSvc+=timedExtrapolator
+mlog.info("configure TimedExtrapolator finished")
+
+from CaloTrackingGeometry.CaloTrackingGeometryConf import CaloSurfaceHelper
+caloSurfaceHelper = CaloSurfaceHelper()
+ToolSvc+=caloSurfaceHelper
+
+from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
+
+ISF_HitAnalysis.CaloEntrance=TrkDetFlags.InDetContainerName()
+ISF_HitAnalysis.CaloSurfaceHelper=caloSurfaceHelper
+ISF_HitAnalysis.Extrapolator=timedExtrapolator
+
+#############################
+
+from AthenaCommon.CfgGetter import getPublicTool
+
+fcsgeohelper= getPublicTool('FastCaloSimGeometryHelper')
+ToolSvc+=fcsgeohelper
+ISF_HitAnalysis.CaloGeometryHelper=fcsgeohelper
+
+ISF_HitAnalysis.FastCaloSimCaloExtrapolation= getPublicTool('FastCaloSimCaloExtrapolation')
+ISF_HitAnalysis.FastCaloSimCaloExtrapolation.OutputLevel = ERROR
+ToolSvc.FastCaloSimCaloExtrapolation.OutputLevel = ERROR
+
+ServiceMgr.MessageSvc.OutputLevel = ERROR
+ServiceMgr.MessageSvc.defaultLimit = 9999999
+
+ServiceMgr.AuditorSvc.Auditors  += [ "ChronoAuditor"]
+
+AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc")
+AthenaPoolCnvSvc.UseDetailChronoStat = TRUE
\ No newline at end of file
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py
new file mode 100644
index 00000000000..9ad54491241
--- /dev/null
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py
@@ -0,0 +1,79 @@
+include("SimuJobTransforms/CommonSkeletonJobOptions.py")
+
+# Get a handle to the ApplicationManager
+from AthenaCommon.AppMgr import theApp
+# Number of events to be processed (default is 10)
+theApp.EvtMax = jobproperties.AthenaCommonFlags.EvtMax.get_Value()
+
+# get the logger
+from AthenaCommon.Logging import logging
+fcsntuplog = logging.getLogger('FCS_Ntup_tf')
+fcsntuplog.info( '****************** STARTING Ntuple Production *****************' )
+fcsntuplog.info( str(runArgs) )
+
+#==============================================================
+# Job definition parameters:
+#==============================================================
+#already in CommonSkeletonJobOptions.py
+#from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+from AthenaCommon.AppMgr import ToolSvc
+from AthenaCommon.AppMgr import ServiceMgr
+import AthenaPoolCnvSvc.ReadAthenaPool
+
+from PartPropSvc.PartPropSvcConf import PartPropSvc
+
+import os
+from glob import glob
+if hasattr(runArgs,"inputESDFile"):
+    globalflags.InputFormat.set_Value_and_Lock('pool')
+    athenaCommonFlags.FilesInput = runArgs.inputESDFile
+    ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput()
+    pass
+
+
+from GaudiSvc.GaudiSvcConf import THistSvc
+ServiceMgr += THistSvc()
+## Output NTUP_FCS File
+if hasattr(runArgs,"outputNTUP_FCSFile"):
+    print "Output is"
+    print  runArgs.outputNTUP_FCSFile
+    ServiceMgr.THistSvc.Output +=["ISF_HitAnalysis DATAFILE='"+runArgs.outputNTUP_FCSFile+"' OPT='RECREATE'"] # FIXME top level directory name
+else:
+    fcsntuplog.warning('No output file set')
+    ServiceMgr.THistSvc.Output +=["ISF_HitAnalysis DATAFILE='output.NTUP_FCS.root' OPT='RECREATE'"] # FIXME top level directory name
+
+
+## Optional output Geometry File
+if hasattr(runArgs,"outputGeoFileName"):
+    ServiceMgr.THistSvc.Output +=["ISF_Geometry DATAFILE='"+runArgs.outputGeoFileName+"' OPT='RECREATE'"] # FIXME top level directory name
+
+
+#==============================================================
+# Job Configuration parameters:
+#==============================================================
+## Pre-exec
+if hasattr(runArgs,"preExec"):
+    fcsntuplog.info("transform pre-exec")
+    for cmd in runArgs.preExec:
+        fcsntuplog.info(cmd)
+        exec(cmd)
+
+## Pre-include
+if hasattr(runArgs,"preInclude"):
+    for fragment in runArgs.preInclude:
+        include(fragment)
+
+
+include("ISF_FastCaloSimParametrization/ISF_ntuple_core.py") # Main job options
+
+## Post-include
+if hasattr(runArgs,"postInclude"):
+    for fragment in runArgs.postInclude:
+        include(fragment)
+
+## Post-exec
+if hasattr(runArgs,"postExec"):
+    digilog.info("transform post-exec")
+    for cmd in runArgs.postExec:
+        fcsntuplog.info(cmd)
+        exec(cmd)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.h
index 38366e17ed0..758e08e5e1f 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.h
@@ -46,7 +46,7 @@ public:
   virtual void extrapolate(TFCSExtrapolationState& result,const TFCSTruthState* truth) override final;
 
 protected:
-  IFastCaloSimGeometryHelper* GetCaloGeometry() const {return &(*m_CaloGeometryHelper);};
+  const IFastCaloSimGeometryHelper* GetCaloGeometry() const {return &(*m_CaloGeometryHelper);};
 
   // extrapolation through Calo
   std::vector<Trk::HitInfo>* caloHits(const TFCSTruthState* truth) const;
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
index f9e0f1aef67..b0e5e132c04 100755
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
@@ -141,14 +141,20 @@ ISF_HitAnalysis::ISF_HitAnalysis(const std::string& name, ISvcLocator* pSvcLocat
    , m_newTTC_entrance_phi(0)
    , m_newTTC_entrance_r(0)
    , m_newTTC_entrance_z(0)
+   , m_newTTC_entrance_detaBorder(0)
+   , m_newTTC_entrance_OK(0)
    , m_newTTC_back_eta(0)
    , m_newTTC_back_phi(0)
    , m_newTTC_back_r(0)
    , m_newTTC_back_z(0)
+   , m_newTTC_back_detaBorder(0)
+   , m_newTTC_back_OK(0)
    , m_newTTC_mid_eta(0)
    , m_newTTC_mid_phi(0)
    , m_newTTC_mid_r(0)
    , m_newTTC_mid_z(0)
+   , m_newTTC_mid_detaBorder(0)
+   , m_newTTC_mid_OK(0)
    , m_newTTC_IDCaloBoundary_eta(0)
    , m_newTTC_IDCaloBoundary_phi(0)
    , m_newTTC_IDCaloBoundary_r(0)
@@ -484,14 +490,20 @@ if( detStore()->contains< AthenaAttributeList >( m_MC_DIGI_PARAM ) )
   m_newTTC_entrance_phi = new std::vector<std::vector<float> >;
   m_newTTC_entrance_r = new std::vector<std::vector<float> >;
   m_newTTC_entrance_z = new std::vector<std::vector<float> >;
+  m_newTTC_entrance_detaBorder = new std::vector<std::vector<float> >;
+  m_newTTC_entrance_OK = new std::vector<std::vector<bool> >;
   m_newTTC_back_eta = new std::vector<std::vector<float> >;
   m_newTTC_back_phi = new std::vector<std::vector<float> >;
   m_newTTC_back_r = new std::vector<std::vector<float> >;
   m_newTTC_back_z = new std::vector<std::vector<float> >;
+  m_newTTC_back_detaBorder = new std::vector<std::vector<float> >;
+  m_newTTC_back_OK = new std::vector<std::vector<bool> >;
   m_newTTC_mid_eta = new std::vector<std::vector<float> >;
   m_newTTC_mid_phi = new std::vector<std::vector<float> >;
   m_newTTC_mid_r = new std::vector<std::vector<float> >;
   m_newTTC_mid_z = new std::vector<std::vector<float> >;
+  m_newTTC_mid_detaBorder = new std::vector<std::vector<float> >;
+  m_newTTC_mid_OK = new std::vector<std::vector<bool> >;
   m_newTTC_IDCaloBoundary_eta = new std::vector<float>;
   m_newTTC_IDCaloBoundary_phi = new std::vector<float>;
   m_newTTC_IDCaloBoundary_r = new std::vector<float>;
@@ -569,14 +581,20 @@ if( detStore()->contains< AthenaAttributeList >( m_MC_DIGI_PARAM ) )
   m_tree->Branch("newTTC_back_phi",&m_newTTC_back_phi);
   m_tree->Branch("newTTC_back_r",&m_newTTC_back_r);
   m_tree->Branch("newTTC_back_z",&m_newTTC_back_z);
+  m_tree->Branch("newTTC_back_detaBorder",&m_newTTC_back_detaBorder);
+  m_tree->Branch("newTTC_back_OK",&m_newTTC_back_OK);
   m_tree->Branch("newTTC_entrance_eta",&m_newTTC_entrance_eta);
   m_tree->Branch("newTTC_entrance_phi",&m_newTTC_entrance_phi);
   m_tree->Branch("newTTC_entrance_r",&m_newTTC_entrance_r);
   m_tree->Branch("newTTC_entrance_z",&m_newTTC_entrance_z);
+  m_tree->Branch("newTTC_entrance_detaBorder",&m_newTTC_entrance_detaBorder);
+  m_tree->Branch("newTTC_entrance_OK",&m_newTTC_entrance_OK);
   m_tree->Branch("newTTC_mid_eta",&m_newTTC_mid_eta);
   m_tree->Branch("newTTC_mid_phi",&m_newTTC_mid_phi);
   m_tree->Branch("newTTC_mid_r",&m_newTTC_mid_r);
   m_tree->Branch("newTTC_mid_z",&m_newTTC_mid_z);
+  m_tree->Branch("newTTC_mid_detaBorder",&m_newTTC_mid_detaBorder);
+  m_tree->Branch("newTTC_mid_OK",&m_newTTC_mid_OK);
   m_tree->Branch("newTTC_IDCaloBoundary_eta",&m_newTTC_IDCaloBoundary_eta);
   m_tree->Branch("newTTC_IDCaloBoundary_phi",&m_newTTC_IDCaloBoundary_phi);
   m_tree->Branch("newTTC_IDCaloBoundary_r",&m_newTTC_IDCaloBoundary_r);
@@ -760,14 +778,20 @@ StatusCode ISF_HitAnalysis::execute()
  m_newTTC_back_phi->clear();
  m_newTTC_back_r->clear();
  m_newTTC_back_z->clear();
+ m_newTTC_back_detaBorder->clear();
+ m_newTTC_back_OK->clear();
  m_newTTC_entrance_eta->clear();
  m_newTTC_entrance_phi->clear();
  m_newTTC_entrance_r->clear();
  m_newTTC_entrance_z->clear();
+ m_newTTC_entrance_detaBorder->clear();
+ m_newTTC_entrance_OK->clear();
  m_newTTC_mid_eta->clear();
  m_newTTC_mid_phi->clear();
  m_newTTC_mid_r->clear();
  m_newTTC_mid_z->clear();
+ m_newTTC_mid_detaBorder->clear();
+ m_newTTC_mid_OK->clear();
  m_newTTC_IDCaloBoundary_eta->clear();
  m_newTTC_IDCaloBoundary_phi->clear();
  m_newTTC_IDCaloBoundary_r->clear();
@@ -929,16 +953,22 @@ StatusCode ISF_HitAnalysis::execute()
                  std::vector<float> phi_vec_ENT;
                  std::vector<float> r_vec_ENT;
                  std::vector<float> z_vec_ENT;
+                 std::vector<float> detaBorder_vec_ENT;
+                 std::vector<bool>  OK_vec_ENT;
 
      std::vector<float> eta_vec_EXT;
                  std::vector<float> phi_vec_EXT;
                  std::vector<float> r_vec_EXT;
                  std::vector<float> z_vec_EXT;
+                 std::vector<float> detaBorder_vec_EXT;
+                 std::vector<bool>  OK_vec_EXT;
 
      std::vector<float> eta_vec_MID;
                  std::vector<float> phi_vec_MID;
                  std::vector<float> r_vec_MID;
                  std::vector<float> z_vec_MID;
+                 std::vector<float> detaBorder_vec_MID;
+                 std::vector<bool>  OK_vec_MID;
 
      float phi_MID;
 
@@ -949,6 +979,8 @@ StatusCode ISF_HitAnalysis::execute()
                         ATH_MSG_DEBUG(" phi ENT "<<result.phi(sample,1)<<" phi EXT "<<result.phi(sample,2));
                         ATH_MSG_DEBUG(" r   ENT "<<result.r(sample,1)  <<" r   EXT "<<result.r(sample,2)  );
                         ATH_MSG_DEBUG(" z   ENT "<<result.z(sample,1)  <<" z   EXT "<<result.z(sample,2)  );
+                        ATH_MSG_DEBUG(" detaBorder   ENT "<<result.detaBorder(sample,1)  <<" detaBorder   EXT "<<result.detaBorder(sample,2)  );
+                        ATH_MSG_DEBUG(" OK   ENT "<<result.OK(sample,1)  <<" OK   EXT "<<result.OK(sample,2)  );
                         eta_vec_ENT.push_back(float(result.eta(sample,1)));
                         eta_vec_EXT.push_back(float(result.eta(sample,2)));
                         eta_vec_MID.push_back(float((result.eta(sample,1)+result.eta(sample,2))/2));
@@ -966,20 +998,32 @@ StatusCode ISF_HitAnalysis::execute()
                         z_vec_ENT.push_back(float(result.z(sample,1)));
                         z_vec_EXT.push_back(float(result.z(sample,2)));
                         z_vec_MID.push_back(float((result.z(sample,1)+result.z(sample,2))/2));
+                        detaBorder_vec_ENT.push_back(float(result.detaBorder(sample,1)));
+                        detaBorder_vec_EXT.push_back(float(result.detaBorder(sample,2)));
+                        detaBorder_vec_MID.push_back(float((result.detaBorder(sample,1)+result.detaBorder(sample,2))/2));
+                        OK_vec_ENT.push_back(float(result.OK(sample,1)));
+                        OK_vec_EXT.push_back(float(result.OK(sample,2)));
+                        OK_vec_MID.push_back(float(result.OK(sample,1)&&result.OK(sample,2)));
      }
 
      m_newTTC_back_eta->push_back(eta_vec_EXT);
                  m_newTTC_back_phi->push_back(phi_vec_EXT);
                  m_newTTC_back_r  ->push_back(r_vec_EXT);
                  m_newTTC_back_z  ->push_back(z_vec_EXT);
+                 m_newTTC_back_detaBorder  ->push_back(detaBorder_vec_EXT);
+                 m_newTTC_back_OK  ->push_back(OK_vec_EXT);
                  m_newTTC_entrance_eta->push_back(eta_vec_ENT);
                  m_newTTC_entrance_phi->push_back(phi_vec_ENT);
                  m_newTTC_entrance_r  ->push_back(r_vec_ENT);
                  m_newTTC_entrance_z  ->push_back(z_vec_ENT);
+                 m_newTTC_entrance_detaBorder  ->push_back(detaBorder_vec_ENT);
+                 m_newTTC_entrance_OK  ->push_back(OK_vec_ENT);
                  m_newTTC_mid_eta->push_back(eta_vec_MID);
                  m_newTTC_mid_phi->push_back(phi_vec_MID);
                  m_newTTC_mid_r  ->push_back(r_vec_MID);
                  m_newTTC_mid_z  ->push_back(z_vec_MID);
+                 m_newTTC_mid_detaBorder  ->push_back(detaBorder_vec_MID);
+                 m_newTTC_mid_OK  ->push_back(OK_vec_MID);
 
      //*******************************************************************************************************************************
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/IntArray_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/IntArray_linkdef.h
deleted file mode 100644
index 2b21fb9198d..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/IntArray_linkdef.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//This linkdef file gets used by ALCliC only
-//see https://root.cern.ch/root/html/guides/users-guide/Cling.html#dictionary-generation
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class IntArray+;
-#endif
-
-
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionHistogram_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionHistogram_linkdef.h
deleted file mode 100644
index b0a1f3bb9c3..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionHistogram_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCS1DFunctionHistogram+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionRegressionTF_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionRegressionTF_linkdef.h
deleted file mode 100644
index 1dc83a7c4fb..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionRegressionTF_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCS1DFunctionRegressionTF+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionRegression_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionRegression_linkdef.h
deleted file mode 100644
index 04780edcbcb..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunctionRegression_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCS1DFunctionRegression+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunction_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunction_linkdef.h
deleted file mode 100644
index 6363a438e27..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCS1DFunction_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCS1DFunction+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSEnergyParametrization_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSEnergyParametrization_linkdef.h
deleted file mode 100644
index 8c6aaf266a2..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSEnergyParametrization_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCSEnergyParametrization+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSExtrapolationState_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSExtrapolationState_linkdef.h
deleted file mode 100644
index 34f78c34d95..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSExtrapolationState_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCSExtrapolationState+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSPCAEnergyParametrization_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSPCAEnergyParametrization_linkdef.h
deleted file mode 100644
index 5a307ccdbe6..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSPCAEnergyParametrization_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCSPCAEnergyParametrization+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSParametrizationBase_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSParametrizationBase_linkdef.h
deleted file mode 100644
index f43bb8e7de4..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSParametrizationBase_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCSParametrizationBase+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSParametrization_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSParametrization_linkdef.h
deleted file mode 100644
index 3622ed5d1d9..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSParametrization_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCSParametrization+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSSimulationState_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSSimulationState_linkdef.h
deleted file mode 100644
index bcafcdd7f41..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSSimulationState_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCSSimulationState+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSTruthState_linkdef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSTruthState_linkdef.h
deleted file mode 100644
index 880c61ef8cb..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TFCSTruthState_linkdef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#if defined(__ROOTCLING__)
-#pragma link C++ class TFCSTruthState+;
-#endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/epara_validation_plots.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/epara_validation_plots.C
deleted file mode 100644
index f3361a10f1e..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/epara_validation_plots.C
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void plots_public();
-void epara_validation_plots();
-TH1* get_cumul(TH1* hist);
-void ATLAS_LABEL(double x,double y);
-
-void epara_validation_plots()
-{
- 
-  string descr,samplename;
-  
-  //samplename="pions"; descr="#scale[0.9]{#splitline{Pions 50 GeV}{0.2 < |#eta| < 0.25}}";
-  //samplename="s2865";   descr="#scale[0.9]{#splitline{Electrons 65 GeV}{0.2 < |#eta| < 0.25}}";
-  //samplename="photons"; descr="#scale[0.9]{#splitline{Photons 50 GeV}{0.2 < |#eta| < 0.25}}";
-  //samplename="photons0809"; descr="#scale[0.9]{#splitline{Photons 50 GeV}{0.2 < |#eta| < 0.25}}";
-  //samplename="pionplus0809"; descr="#scale[0.9]{#splitline{Pions+ 50 GeV}{0.2 < |#eta| < 0.25}}";
-  samplename="pionminus0809"; descr="#scale[0.9]{#splitline{Pions- 50 GeV}{0.2 < |#eta| < 0.25}}";
-  
-  int col_para=2;
-  
-  //string dirname ="/afs/cern.ch/user/s/schaarsc/public/fastcalo/epara_storage";
-  string dirname ="../../../../../../epara_storage";
-  
-  //get layers:
-  TFile* file1=TFile::Open(Form("%s/%s/firstPCA.root",dirname.c_str(),samplename.c_str()));
-  TH2I* h_layer=(TH2I*)file1->Get("h_layer");
-  int pcabins=h_layer->GetNbinsX();
-  vector<int> layerNr;
-  for(int i=1;i<=h_layer->GetNbinsY();i++)
-  {
- 	 if(h_layer->GetBinContent(1,i)==1) 
- 	  layerNr.push_back(h_layer->GetYaxis()->GetBinCenter(i));
-  }
-  vector<string> layer;
-  for(unsigned int l=0;l<layerNr.size();l++)
-   layer.push_back(Form("layer%i",layerNr[l]));
-  layer.push_back("totalE");
-  
-  vector<string> name;
-  vector<string> title;
-  for(unsigned int l=0;l<layer.size()-1;l++)
-  {
-   cout<<"layer "<<layer[l]<<endl;
-   name.push_back(layer[l].c_str());
-   title.push_back(Form("Energy fraction in Layer %i",layerNr[l]));
-  }
-  name.push_back("Total energy");  title.push_back("total E [MeV]");
-  
-  TFile* file=TFile::Open(Form("eparavalidation/%s/validation.root",samplename.c_str()));
-
-  int use_autozoom=1;
-  int one_canvas=1;
-  
-  for(unsigned int l=0;l<layer.size();l++)
-  {
-   double min,max,rmin,rmax;
-   TH1D* h_output_lin;
-   TH1D* h_input_lin;
-   if(use_autozoom)
-   {
-   	h_output_lin=(TH1D*)file->Get(Form("h_output_zoom_%s",layer[l].c_str())); h_output_lin->SetName("h_output_lin");
-   	h_input_lin =(TH1D*)file->Get(Form("h_input_zoom_%s",layer[l].c_str()));  h_input_lin->SetName("h_input_lin");
-   }
-   else
-   {
-   	h_output_lin=(TH1D*)file->Get(Form("h_output_%s",layer[l].c_str())); h_output_lin->SetName("h_output_lin");
-   	h_input_lin =(TH1D*)file->Get(Form("h_input_%s",layer[l].c_str()));  h_input_lin->SetName("h_input_lin");
-   }
-   
-   //linear:
-   double kolmo=-1;double chi2=-1;
-   double ymax=1000;
-   
-   kolmo=h_input_lin->KolmogorovTest(h_output_lin);
-   chi2= h_input_lin->Chi2Test(h_output_lin,"UW");
-   h_input_lin->SetMarkerSize(1.1);
-   h_output_lin->SetMarkerSize(1.1);
-   h_input_lin->SetMarkerStyle(24);
-   
-   h_input_lin->SetLineWidth(1);
-   h_output_lin->SetLineWidth(1);
-   h_output_lin->SetFillColor(col_para);
-   h_output_lin->SetLineColor(col_para);
-   h_output_lin->SetMarkerColor(col_para);
-   h_output_lin->Scale(h_input_lin->Integral()/h_output_lin->Integral());
-   h_input_lin->GetXaxis()->SetNdivisions(506,kTRUE);
-   double ymax=h_input_lin->GetBinContent(h_input_lin->GetMaximumBin());
-   h_input_lin->GetYaxis()->SetRangeUser(0,ymax*1.4);
-   h_input_lin->GetYaxis()->SetTitle("a.u.");
-   h_input_lin->GetXaxis()->SetTitle(title[l].c_str());
-   
-   //log:
-   TH1D* h_output_log=(TH1D*)h_output_lin->Clone("h_output_log");
-   TH1D* h_input_log=(TH1D*)h_input_lin->Clone("h_input_log");
-   h_input_log->GetYaxis()->SetRangeUser(0.1,ymax*5.0);
-   h_input_log->GetYaxis()->SetTitle("a.u.");
-   
-   //cumulative:
-   TH1D* h_output_cumul=(TH1D*)get_cumul(h_output_lin); h_output_cumul->SetName("h_output_cumul");
-   TH1D* h_input_cumul =(TH1D*)get_cumul(h_input_lin);  h_input_cumul->SetName("h_input_cumul");
-   double sf=h_input_cumul->GetBinContent(h_input_cumul->GetNbinsX());
-   h_output_cumul->Scale(1.0/sf);
-   h_input_cumul->Scale(1.0/sf);
-   h_input_cumul->GetYaxis()->SetRangeUser(0,1.2);
-   h_input_cumul->GetYaxis()->SetTitle("a.u. cumulative");
-   
-   if(one_canvas)
-   {
-    TCanvas* can=new TCanvas("can","can",0,0,1600,600);
-    can->Divide(3,1);
-    can->cd(1);
-    h_input_lin->Draw("e");
-    h_output_lin->Draw("esame");
-    h_input_lin->Draw("esame");
-    
-    TLegend* leg=new TLegend(0.65,0.82,0.99,0.93);
-    leg->SetBorderSize(0);
-    leg->SetFillStyle(0);
-    leg->SetHeader(Form("KS: %.2f, Chi2: %.2f",kolmo,chi2));
-    leg->AddEntry(h_output_lin,"Parametrisation","lpe");
-    leg->AddEntry(h_input_lin,"G4 Input","lpe");
-    leg->Draw();
-    
-    can->cd(2);
-    h_input_log->Draw("e");
-    h_output_log->Draw("esame");
-    h_input_log->Draw("esame");
-    can->cd(2)->SetLogy();
-
-    can->cd(3);
-    h_input_cumul->Draw("e");
-    h_output_cumul->Draw("esame");
-    h_input_cumul->Draw("esame");
-    
-    can->cd(1)->RedrawAxis();
-    can->cd(2)->RedrawAxis();
-    can->cd(3)->RedrawAxis();
-    can->Print(Form("eparavalidation/%s/%s.pdf",samplename.c_str(),name[l].c_str()));
-    delete can;
-   } //one_canvas
-   
-   
-   if(!one_canvas)
-   {
-   	TCanvas* can_lin=new TCanvas(Form("can_lin_%s",layer[l].c_str()),Form("can_lin_%s",layer[l].c_str()),0,0,800,600);
-   	
-   	h_input_lin ->Draw("e");
-    h_output_lin->Draw("esame");
-    h_input_lin ->Draw("esame");
-    
-    TLegend* leg1=new TLegend(0.65,0.82,0.99,0.93);
-    leg1->SetBorderSize(0);
-    leg1->SetFillStyle(0);
-    leg1->SetHeader(Form("#bf{KS: %.2f, Chi2: %.2f}",kolmo,chi2));
-    leg1->AddEntry(h_output_lin,"#bf{Parametrisation}","lpe");
-    leg1->AddEntry(h_input_lin,"#bf{G4 Input}","lpe");
-    leg1->Draw();
-    TLatex* la1=new TLatex(0.2,0.5,descr.c_str());    la1->SetNDC();    la1->Draw();
-    ATLAS_LABEL(0.2,0.9);
-    Prelim_LABEL(0.2,0.85);
-    
-   	can_lin->RedrawAxis();
-    can_lin->Print(Form("eparavalidation/%s/%s_lin.pdf",samplename.c_str(),name[l].c_str()));
-    
-    TCanvas* can_log=new TCanvas("can_log","can_log",0,0,800,600);
-    h_input_log ->Draw("e");
-    h_output_log->Draw("esame");
-    h_input_log ->Draw("esame");
-    can_log->SetLogy();
-    TLegend* leg2=new TLegend(0.65,0.82,0.99,0.93);
-    leg2->SetBorderSize(0);
-    leg2->SetFillStyle(0);
-    leg2->SetHeader(Form("#bf{KS: %.2f, Chi2: %.2f}",kolmo,chi2));
-    leg2->AddEntry(h_output_log,"#bf{Parametrisation}","lpe");
-    leg2->AddEntry(h_input_log,"#bf{G4 Input}","lpe");
-    leg2->Draw();
-   	TLatex* la2=new TLatex(0.2,0.5,descr.c_str());    la2->SetNDC();    la2->Draw();
-    can_log->RedrawAxis();
-    can_log->Print(Form("eparavalidation/%s/%s_log.pdf",samplename.c_str(),name[l].c_str()));
-   	
-   	/*
-   	TCanvas* can_cum=new TCanvas("can_cum","can_cum",0,0,800,600);
-    h_input_cumul ->Draw("e");
-    h_output_cumul->Draw("histsame");
-    h_input_cumul ->Draw("esame");
-    {
-     TLegend* leg=new TLegend(0.65,0.82,0.99,0.93);
-     leg->SetBorderSize(0);
-     leg->SetFillStyle(0);
-     leg->SetHeader(Form("KS: %.2f, Chi2: %.2f",kolmo,chi2));
-     leg->AddEntry(h_output_lin,"Parametrisation","f");
-     leg->AddEntry(h_input_lin,"G4 Input","lpe");
-     leg->Draw();
-    }
-   	can_cum->RedrawAxis();
-    can_cum->Print(Form("eparavalidation/%s/%s_cum.pdf",samplename.c_str(),name[l].c_str()));
-    */
-   } //separate canvases
-   
-  } //for layer
- 
-}
-
-TH1* get_cumul(TH1* hist)
-{
-  TH1D* h_cumul=(TH1D*)hist->Clone("h_cumul");
-  double sum=0;
-  for(int b=1;b<=h_cumul->GetNbinsX();b++)
-  {
-    sum+=hist->GetBinContent(b);
-    h_cumul->SetBinContent(b,sum);
-  }
-  return h_cumul; 
-}
-
-void ATLAS_LABEL(double x,double y) 
-{
-  TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.SetTextFont(72);
-  l.SetTextColor(1);
-  l.DrawLatex(x,y,"ATLAS #bf{#it{#scale[0.9]{Simulation}}}");
-}
-
-void Prelim_LABEL(double x,double y) 
-{
-  TLatex l;
-  l.SetNDC();
-  l.SetTextFont(72);
-  l.SetTextColor(1);
-  l.DrawLatex(x,y,"#bf{#it{#scale[0.9]{Preliminary}}}");
-}
-
-void photon()
-{
- 
- int zoom=1;
- string zname="";
- if(zoom) zname="_zoom";
- 
- TFile* file=TFile::Open("eparavalidation/photons/validation.root");
- TH1D* h_input=(TH1D*)file->Get(Form("h_input%s_totalE",zname.c_str()));   h_input->SetName("h_input");
- TH1D* h_output=(TH1D*)file->Get(Form("h_output%s_totalE",zname.c_str())); h_output->SetName("h_output");
- 
- h_input->SetMarkerSize(1.0);
- h_input->SetLineWidth(1);
- h_output->SetLineWidth(1);
- h_output->SetFillColor(7);
- h_output->Scale(h_input->Integral()/h_output->Integral());
- h_input->GetXaxis()->SetNdivisions(506,kTRUE);
- double ymax=h_input->GetBinContent(h_input->GetMaximumBin());
- h_input->GetYaxis()->SetRangeUser(0,ymax*1.4);
- h_input->GetYaxis()->SetTitle("Events");
- h_input->GetXaxis()->SetTitle("Total cell energy [MeV]");
- 
- TCanvas* can=new TCanvas("can","can",0,0,800,600);
- h_input ->Draw("e");
- h_input->GetYaxis()->SetRangeUser(0.5,10000);
- h_input->GetXaxis()->SetRangeUser(43000,52000);
- h_output->Draw("histsame");
- h_input ->Draw("esame");
- can->SetLogy();
- TLegend* leg=new TLegend(0.65,0.82,0.95,0.93);
- leg->SetBorderSize(0);
- leg->SetFillStyle(0);
- leg->AddEntry(h_output,"#bf{Parametrisation}","f");
- leg->AddEntry(h_input,"#bf{G4 Input}","lpe");
- leg->Draw();
- TLatex* la=new TLatex(0.2,0.5,"#splitline{Photons 50 GeV}{0.2 < |#eta| < 0.25}");
- la->SetNDC();
- la->Draw();
- ATLAS_LABEL(0.2,0.88);
- Prelim_LABEL(0.2,0.83);
- can->RedrawAxis();
- can->Print("eparavalidation/photon_totalE.pdf");
- 
-}
-
-void pion()
-{
- 
- int zoom=1;
- string zname="";
- if(zoom) zname="_zoom";
- 
- TFile* file=TFile::Open("eparavalidation/pions/validation.root");
- TH1D* h_input=(TH1D*)file->Get(Form("h_input%s_layer12",zname.c_str()));   h_input->SetName("h_input");
- TH1D* h_output=(TH1D*)file->Get(Form("h_output%s_layer12",zname.c_str())); h_output->SetName("h_output");
- 
- h_input->SetMarkerSize(1.0);
- h_input->SetLineWidth(1);
- h_output->SetLineWidth(1);
- h_output->SetFillColor(7);
- h_output->Scale(h_input->Integral()/h_output->Integral());
- h_input->GetXaxis()->SetNdivisions(506,kTRUE);
- double ymax=h_input->GetBinContent(h_input->GetMaximumBin());
- h_input->GetYaxis()->SetRangeUser(0,ymax*1.4);
- h_input->GetYaxis()->SetTitle("Events");
- h_input->GetXaxis()->SetTitle("Fraction of energy deposited in TileBarrel1");
- 
- TCanvas* can=new TCanvas("can","can",0,0,800,600);
- h_input ->Draw("e");
- h_output->Draw("histsame");
- h_input ->Draw("esame");
- TLegend* leg=new TLegend(0.65,0.82,0.95,0.93);
- leg->SetBorderSize(0);
- leg->SetFillStyle(0);
- leg->AddEntry(h_output,"#bf{Parametrisation}","f");
- leg->AddEntry(h_input,"#bf{G4 Input}","lpe");
- leg->Draw();
- TLatex* la=new TLatex(0.6,0.5,"#splitline{Pions 50 GeV}{0.2 < |#eta| < 0.25}");
- la->SetNDC();
- la->Draw();
- ATLAS_LABEL(0.2,0.88);
- Prelim_LABEL(0.2,0.83);
- can->RedrawAxis();
- can->Print("eparavalidation/pion_layer12.pdf");
- 
-}
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/init_epara.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/init_epara.C
deleted file mode 100644
index cf8613d791d..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/init_epara.C
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TSystem.h"
-#include "TROOT.h"
-#include <iostream>
-
-#include "TLorentzVector.h"
-#include "TMatrixD.h"
-
-void init_epara();
-
-void init_epara()
-{
- 
- cout<<"hello"<<endl;
- 
- TLorentzVector *t;
- TMatrixD *m;
- 
- gInterpreter->AddIncludePath("..");
- gInterpreter->AddIncludePath("../epara");
- gInterpreter->AddIncludePath("../../ISF_FastCaloSimEvent");
- 
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/IntArray.cxx+");
- gROOT->LoadMacro("../Root/TreeReader.cxx+");
- gROOT->LoadMacro("../epara/firstPCA.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCS1DFunction.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCS1DFunctionRegression.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCS1DFunctionRegressionTF.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCS1DFunctionHistogram.cxx+");
- gROOT->LoadMacro("../epara/TFCSFunction.cxx+");
- gROOT->LoadMacro("../epara/TFCS1DRegression.cxx+");
- gROOT->LoadMacro("../epara/secondPCA.cxx+");
- 
- cout<<"init done"<<endl;
- 
-}
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/init_epara_validation.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/init_epara_validation.C
deleted file mode 100644
index 57be29d40ef..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/init_epara_validation.C
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TSystem.h"
-#include "TROOT.h"
-#include <iostream>
-
-#include "TLorentzVector.h"
-#include "TMatrixD.h"
-
-void init_epara_validation();
-
-void init_epara_validation()
-{
- 
- cout<<"hello"<<endl;
- 
- TLorentzVector *t;
- TMatrixD *m;
- 
- gInterpreter->AddIncludePath("..");
- gInterpreter->AddIncludePath("../../ISF_FastCaloSimEvent");
-
- gROOT->LoadMacro("../Root/TreeReader.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCS1DFunction.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCS1DFunctionRegression.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCS1DFunctionRegressionTF.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCS1DFunctionHistogram.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/IntArray.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCSExtrapolationState.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCSTruthState.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCSSimulationState.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCSParametrization.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCSEnergyParametrization.cxx+");
- gROOT->LoadMacro("../../ISF_FastCaloSimEvent/src/TFCSPCAEnergyParametrization.cxx+");
- gROOT->LoadMacro("../Root/EnergyParametrizationValidation.cxx+");
-
- cout<<"init done"<<endl;
- 
-}
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run_epara.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run_epara.C
deleted file mode 100644
index 30ef6018f31..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run_epara.C
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TChain.h"
-#include <iostream>
-
-void run_epara();
-
-void run_epara()
-{
- 
- //how to run in root 6.08 on lxplus7:
- //source setup_root608.sh
- //.x init_epara.C+
- //.x run_epara.C
- 
- string label;
- vector<string> input;
- 
- //label="pions";
- //input.push_back("root://eosatlas//eos/atlas/user/z/zhubacek/FastCaloSim/NTUP_090315/ISF_HitAnalysis_evgen_calo__211_E50000_50000_eta20_25_Evts0-5500_vz_0_origin_calo.standard.matched.pool.root");
- 
- //label="photons";
- //input.push_back("/eos/atlas/user/z/zhubacek/FastCaloSim/NTUP_040315/ISF_HitAnalysis_evgen_calo__22_E50000_50000_eta20_25_Evts0-5500_vz_0_origin_calo.merged.pool.root");
- 
- //label="s2864";
- //input.push_back("root://eosatlas.cern.ch//eos/atlas/user/s/schaarsc/FCS/user.fladias.428137.FastCalo_pid11_E65536_etam35_35_zv_m100.e4001_s2864_r7736.w0_162706_matched_output.root/*.root");
- 
- //label="s2865";
- //input.push_back("root://eosatlas.cern.ch//eos/atlas/user/s/schaarsc/FCS/user.fladias.428137.FastCalo_pid11_E65536_etam35_35_zv_m100.e4001_s2865_r7736.w0_162706_matched_output.root/*.root");
- 
- //label="photons";
- //input.push_back("/eos/atlas/user/z/zhubacek/FastCaloSim/NTUP_040315/ISF_HitAnalysis_evgen_calo__22_E50000_50000_eta20_25_Evts0-5500_vz_0_origin_calo.merged.pool.root");
- 
- //label="photons0809";   input.push_back("/afs/cern.ch/atlas/groups/Simulation/FastCaloSimV2/InputSamples/photon.ISF_CaloHitAnalysis_50GeV_eta02_25.merged_1mm.pool.root");
- //label="pionplus0809";  input.push_back("/afs/cern.ch/atlas/groups/Simulation/FastCaloSimV2/InputSamples/pionplus.ISF_CaloHitAnalysis_50GeV_eta02_25.merged_1mm.pool.root");
- label="pionminus0809"; input.push_back("/afs/cern.ch/atlas/groups/Simulation/FastCaloSimV2/InputSamples/pionminus.ISF_CaloHitAnalysis_50GeV_eta02_25.merged_1mm.pool.root");
- 
- cout<<"*** Preparing to run on "<<label<<" ***"<<endl;
- TChain* mychain= new TChain("FCS_ParametrizationInput");
- for(int i=0;i<input.size();i++)
- {
- 	cout<<"input: "<<input[i]<<endl;
-  mychain->Add(input[i].c_str());
- }
- cout<<"TChain entries: "<<mychain->GetEntries()<<endl;
-  
- system(("mkdir /afs/cern.ch/user/s/schaarsc/public/fastcalo/epara_storage/"+label).c_str());
- string pca1_outfilename="/afs/cern.ch/user/s/schaarsc/public/fastcalo/epara_storage/"+label+"/firstPCA.root";
- string pca2_outfilename="/afs/cern.ch/user/s/schaarsc/public/fastcalo/epara_storage/"+label+"/secondPCA.root";
- 
- /*
- firstPCA *myfirstPCA=new firstPCA(mychain,pca1_outfilename);
- myfirstPCA->set_cumulativehistobins(5000);
- myfirstPCA->set_edepositcut(0.001);
- myfirstPCA->apply_etacut(0); //this flag is for the old files, which are already sliced in eta
- myfirstPCA->set_etacut(0.2,0.25);
- myfirstPCA->set_pcabinning(5,1);
- myfirstPCA->run();
- */
- cout<<"1st pca done"<<endl;
- 
- secondPCA* mysecondPCA=new secondPCA(pca1_outfilename,pca2_outfilename);
- mysecondPCA->set_PCAbin(0);
- mysecondPCA->set_storeDetails(0);
- mysecondPCA->set_cumulativehistobins(1000);
- mysecondPCA->set_cut_maxdeviation_regression(5);
- mysecondPCA->set_cut_maxdeviation_smartrebin(5);
- mysecondPCA->set_Ntoys(5000);
- mysecondPCA->set_neurons_iteration(2,16); //2,6
- mysecondPCA->set_skip_regression(1);
- mysecondPCA->run();
- 
-}
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run_epara_validation.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run_epara_validation.C
deleted file mode 100644
index a477ac8f6ce..00000000000
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/run_epara_validation.C
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-TH1* get_cumul(TH1* hist);
-void run_epara_validation();
-void check();
-
-void ATLAS_LABEL(double x,double y) ;
-
-//Instructions:
-//.x init_epara_validation.C+
-//.x run_epara_validation.C
-
-
-void run_epara_validation()
-{
- 	
- 	//parametrization input files:
- 	
-  //string samplename="pions";
-  //string samplename="photons";
-  //string samplename="pions_s2864";
-  //string samplename="s2865";
-  //string samplename="photons0809";
-  //string samplename="pionplus0809";
-  string samplename="pionminus0809";
-  
- 	string dirname ="/afs/cern.ch/user/s/schaarsc/public/fastcalo/epara_storage";
-  
-  system("mkdir eparavalidation");
-  system(("mkdir eparavalidation/"+samplename).c_str());
-  /*
-  int setbin=-1;
-  cout<<"PCA bin (-1 if random)? "<<endl;
-  cin>>setbin;
-  */
-  //Prepare the Histograms
-  cout<<"Preparing validation histograms"<<endl;
-  TFile* file1=TFile::Open(Form("%s/%s/firstPCA.root",dirname.c_str(),samplename.c_str()));
-  TH2I* h_layer=(TH2I*)file1->Get("h_layer");
-  int pcabins=h_layer->GetNbinsX();
-  vector<int> layerNr;
-  for(int i=1;i<=h_layer->GetNbinsY();i++)
-  {
- 	 if(h_layer->GetBinContent(1,i)==1) 
- 	  layerNr.push_back(h_layer->GetYaxis()->GetBinCenter(i));
-  }
-  vector<string> layer;
-  for(unsigned int l=0;l<layerNr.size();l++)
-   layer.push_back(Form("layer%i",layerNr[l]));
-  layer.push_back("totalE");
-  
-  for(unsigned int l=0;l<layer.size();l++)
-   cout<<"l "<<l<<" "<<layer[l]<<endl;
-  
-  int nbins=100;
-  TH1D* h_input[layer.size()+2];
-  TH1D* h_output[layer.size()+2];
-  for(unsigned int l=0;l<layerNr.size();l++)
-  {
-   h_input[l]=new TH1D(Form("h_input_%s",layer[l].c_str()),Form("h_input_%s",layer[l].c_str()),nbins,0,1);
-   h_output[l]=new TH1D(Form("h_output_%s",layer[l].c_str()),Form("h_output_%s",layer[l].c_str()),nbins,0,1);
-  }
-  //Total E
-  TTree* InputTree = (TTree*)file1->Get("tree_1stPCA");
-  TreeReader* read_inputTree = new TreeReader();
-  read_inputTree->SetTree(InputTree);
-
-  double minE=InputTree->GetMinimum("energy_totalE");
-  double maxE=InputTree->GetMaximum("energy_totalE");
-  cout<<"************************"<<endl;
-  cout<<"minE "<<minE<<" maxE "<<maxE<<endl;
-  h_input[layerNr.size()] =new TH1D("h_input_totalE","h_input_totalE",nbins,minE,maxE);
-  h_output[layerNr.size()]=new TH1D("h_output_totalE","h_output_totalE",nbins,minE,maxE);
-  //Fractions:
-  h_input[layer.size()]   =new TH1D("h_input_sumfractions_elmag","h_input_sumfractions_elmag",nbins,-1,2);
-  h_output[layer.size()]  =new TH1D("h_output_sumfractions_elmag","h_output_sumfractions_elmag",nbins,-1,2);
-  h_input[layer.size()+1] =new TH1D("h_input_sumfractions_had","h_input_sumfractions_had",nbins,-1,2);
-  h_output[layer.size()+1]=new TH1D("h_output_sumfractions_had","h_output_sumfractions_had",nbins,-1,2);
-  //correlation
-  TH2D* h_input_layer1_layer2;
-  TH2D* h_output_layer1_layer2;
-  h_input_layer1_layer2=new TH2D("h_input_layer1_layer2","h_input_layer1_layer2",100,0,1,100,0,1);
-  h_output_layer1_layer2=new TH2D("h_output_layer1_layer2","h_output_layer1_layer2",100,0,1,100,0,1);
-  
-  //Fill the Input Histograms:
-  vector<int> elmag; //0-8
-  for(int e=0;e<=8;e++) elmag.push_back(e);
-  vector<int> had;   //9-24
-  for(int h=9;h<25;h++) had.push_back(h);
-  
-  cout<<"Now fill input histograms"<<endl;
-  for(int event=0;event<read_inputTree->GetEntries();event++)
-  {
-   read_inputTree->GetEntry(event);
-   //if(setbin<0 || (setbin>=1 && read_inputTree->GetVariable("firstPCAbin")==setbin))
-   //{
-   double sum_fraction_elmag=0.0;
-   double sum_fraction_had=0.0;
-   double data = read_inputTree->GetVariable("energy_totalE");
-   h_input[layerNr.size()]->Fill(data);
-   for(unsigned int l=0;l<layerNr.size();l++)
-   {
-   	double data = read_inputTree->GetVariable(Form("energy_%s",layer[l].c_str()));
-   	h_input[l]->Fill(data);
-   	
-   	int is_elmag,is_had;
-   	is_elmag=is_had=0;
-    
-    for(int e=0;e<elmag.size();e++)
-    { 	  if(elmag[e]==layerNr[l]) is_elmag=1;   }
-    for(int h=0;h<had.size();h++)
-    { 	  if(had[h]==layerNr[l]) is_had=1;   }
-    if(is_elmag) sum_fraction_elmag+=data;
-    if(is_had)   sum_fraction_had+=data;
-   }
-   h_input[layerNr.size()+1]->Fill(sum_fraction_elmag);
-   h_input[layerNr.size()+2]->Fill(sum_fraction_had);
-   h_input_layer1_layer2->Fill(read_inputTree->GetVariable("energy_layer1"),read_inputTree->GetVariable("energy_layer2"));
-  } //loop over g4
-  
-  TH1D* h_randombin=new TH1D("h_randombin","h_randombin",pcabins,-0.5,pcabins-0.5);
-  
-   
-  TFCSPCAEnergyParametrization etest("etest","etest");
-  //TFile* file2 = TFile::Open("/afs/cern.ch/atlas/groups/Simulation/FastCaloSimV2/FCSParams.root");
-
-  TFile* file2 = TFile::Open(Form("%s/%s/secondPCA.root",dirname.c_str(),samplename.c_str()));
-
-  cout<<"pca bins before load "<<etest.n_pcabins()<<endl;
-  etest.loadInputs(file2);
-  cout<<"number of pca bins after load "<<etest.n_pcabins()<<" , number from firstPCA file: "<<pcabins<<endl;
-  file2->Close();
-  delete file2;
-
-  //Run the loop:
-  int ntoys=2000;
-  TRandom3* Random=new TRandom3();
-  Random->SetSeed(0);
-  const TFCSTruthState* truth=new TFCSTruthState();
-  const TFCSExtrapolationState* extrapol=new TFCSExtrapolationState();
-
-  TFCSSimulationState simulstate;
-  for(int i=0;i<ntoys;i++)
-  {
-   if(i%100==0) cout<<"Now run simulation for Toy "<<i<<endl;
-   
-   int randombin=0;
-   double uniform=Random->Uniform(1);
-   for(int n=0;n<pcabins;n++)
-   {
-    if(uniform>n*1.0/(double)pcabins && uniform<(n+1.)*1.0/(double)pcabins)
-     randombin=n+1;
-   }
-   h_randombin->Fill(randombin);
-         
-   simulstate.set_Ebin(randombin);
-   
-   etest.simulate(simulstate, truth, extrapol);
-   
-   //fill the Histograms:
-   double sum_fraction_elmag=0.0;
-   double sum_fraction_had=0.0;
-   
-   /*
-   for(int s=0;s<30;s++) //30 is a dummy number, sth big
-   {
-   	int is_elmag,is_had;
-   	is_elmag=is_had=0;
-   	for(unsigned int l=0;l<layerNr.size();l++)
-    {
-     if(s==layerNr[l])
-     {
-   	  h_output[l]->Fill(simulstate.Efrac(s));
-      for(int e=0;e<elmag.size();e++)
-      { 	  if(elmag[e]==layerNr[l]) is_elmag=1;   }
-      for(int h=0;h<had.size();h++)
-      { 	  if(had[h]==layerNr[l]) is_had=1;   }
-      if(is_elmag) sum_fraction_elmag+=simulstate.Efrac(s);
-      if(is_had)   sum_fraction_had+=simulstate.Efrac(s);
-     }
-    }
-   }
-   h_output[layerNr.size()]->Fill(simulstate.E());
-   h_output[layerNr.size()+1]->Fill(sum_fraction_elmag);
-   h_output[layerNr.size()+2]->Fill(sum_fraction_had);
-   */
-   
-   for(unsigned int l=0;l<layerNr.size();l++)
-   {
-    h_output[l]->Fill(simulstate.Efrac(layerNr[l]));
-   }
-   h_output[layerNr.size()]->Fill(simulstate.E());
-   
-   //correlation plots:
-   h_output_layer1_layer2->Fill(simulstate.Efrac(1),simulstate.Efrac(2));
-   
-   if(simulstate.Efrac(1)>0.8)
-   {
-   	cout<<"in toy nr "<<i<<" efrac1 "<<simulstate.Efrac(1)<<" efrac2 "<<simulstate.Efrac(2)<<endl;
-   	int enter; cin>>enter;
-   }
-   
-  } //loop over toys
-  
-  //save the histograms in an output file
-  TFile* outfile=new TFile(Form("eparavalidation/%s/validation.root",samplename.c_str()),"RECREATE");
-  cout<<"writing output to file "<<outfile->GetName()<<endl;
-  for(unsigned int l=0;l<layer.size();l++)
-  {
-   cout<<"l "<<l<<" layer[l] "<<layer[l]<<endl;
-   outfile->Add(h_output[l]);
-   outfile->Add(h_input[l]);
-   double min,max,rmin,rmax;
-   EnergyParametrizationValidation::autozoom(h_input[l],min,max,rmin,rmax);
-   TH1D* h_output_zoom=EnergyParametrizationValidation::refill(h_output[l],min,max,rmin,rmax);
-   h_output_zoom->SetName(Form("h_output_zoom_%s",layer[l].c_str()));
-   TH1D* h_input_zoom=EnergyParametrizationValidation::refill(h_input[l],min,max,rmin,rmax);
-   h_input_zoom->SetName(Form("h_input_zoom_%s",layer[l].c_str()));
-   outfile->Add(h_output_zoom);
-   outfile->Add(h_input_zoom);
-  }
-  outfile->Add(h_input_layer1_layer2);
-  outfile->Add(h_output_layer1_layer2);
-  outfile->Write();
-  
-  /*
-  
-  cout<<"Now making validation plots"<<endl;
-  
-  vector<string> name;
-  vector<string> title;
-  for(unsigned int l=0;l<layer.size()-1;l++)
-  {
-   name.push_back(layer[l].c_str());
-   title.push_back(Form("E fraction in Layer %i",layerNr[l]));
-  }
-  name.push_back("totalE");
-  name.push_back("sumfraction_elmag");
-  name.push_back("sumfraction_had");
-  title.push_back("total E [MeV]");
-  title.push_back("Sum of E fractions in elmag. layers");
-  title.push_back("Sum of E fractions in had. layers");
-  
-  for(unsigned int l=0;l<layer.size()+2;l++)
-  {
-   int use_autozoom=1;
-   int one_canvas=0;
-   double min,max,rmin,rmax;
-   TH1D* h_output_lin;
-   TH1D* h_input_lin;
-   if(use_autozoom)
-   {
-    EnergyParametrizationValidation::autozoom(h_input[l],min,max,rmin,rmax);
-    h_output_lin=EnergyParametrizationValidation::refill(h_output[l],min,max,rmin,rmax);  h_output_lin->SetName("h_output_lin");
-    h_input_lin=EnergyParametrizationValidation::refill(h_input[l],min,max,rmin,rmax); h_input_lin->SetName("h_input_lin");
-   }
-   else
-   {
-    h_output_lin=(TH1D*)h_output[l]->Clone("h_output_lin");
-    h_input_lin=(TH1D*)h_input[l]->Clone("h_input_lin");
-   }
-   
-   //linear:
-   double kolmo=h_input[l]->KolmogorovTest(h_output[l]);
-   double chi2=h_input[l]->Chi2Test(h_output[l],"UW");
-   h_input_lin->SetMarkerSize(1.0);
-   h_input_lin->SetLineWidth(1);
-   h_output_lin->SetLineWidth(1);
-   h_output_lin->SetFillColor(7);
-   h_output_lin->Scale(h_input[l]->Integral()/h_output_lin->Integral());
-   h_input_lin->GetXaxis()->SetNdivisions(504,kFALSE);
-   double ymax=h_input_lin->GetBinContent(h_input_lin->GetMaximumBin());
-   h_input_lin->GetYaxis()->SetRangeUser(0,ymax*1.4);
-   h_input_lin->GetYaxis()->SetTitle("Linear");
-   h_input_lin->GetXaxis()->SetTitle(title[l].c_str());
-   
-   //log:
-   TH1D* h_output_log=(TH1D*)h_output_lin->Clone("h_output_log");
-   TH1D* h_input_log=(TH1D*)h_input_lin->Clone("h_input_log");
-   h_input_log->GetYaxis()->SetRangeUser(0.1,ymax*5.0);
-   h_input_log->GetYaxis()->SetTitle("Log");
-      
-   //cumulative:
-   TH1D* h_output_cumul=(TH1D*)get_cumul(h_output_lin); h_output_cumul->SetName("h_output_cumul");
-   TH1D* h_input_cumul =(TH1D*)get_cumul(h_input_lin);  h_input_cumul->SetName("h_input_cumul");
-   double sf=h_input_cumul->GetBinContent(h_input_cumul->GetNbinsX());
-   h_output_cumul->Scale(1.0/sf);
-   h_input_cumul->Scale(1.0/sf);
-   h_input_cumul->GetYaxis()->SetRangeUser(0,1.2);
-   h_input_cumul->GetYaxis()->SetTitle("Cumulative");
-   
-   if(one_canvas)
-   {
-    TCanvas* can=new TCanvas("can","can",0,0,1600,600);
-    can->Divide(3,1);
-    can->cd(1);
-    h_input_lin->Draw("e");
-    h_output_lin->Draw("histsame");
-    h_input_lin->Draw("esame");
-    
-    TLegend* leg=new TLegend(0.65,0.82,0.99,0.93);
-    leg->SetBorderSize(0);
-    leg->SetFillStyle(0);
-    leg->SetHeader(Form("KS: %.2f, Chi2: %.2f",kolmo,chi2));
-    leg->AddEntry(h_output_lin,"Parametrisation","f");
-    leg->AddEntry(h_input_lin,"G4 Input","lpe");
-    leg->Draw();
-    
-    can->cd(2);
-    h_input_log->Draw("e");
-    h_output_log->Draw("histsame");
-    h_input_log->Draw("esame");
-    can->cd(2)->SetLogy();
-
-    can->cd(3);
-    h_input_cumul->Draw("e");
-    h_output_cumul->Draw("histsame");
-    h_input_cumul->Draw("esame");
-    
-    can->cd(1)->RedrawAxis();
-    can->cd(2)->RedrawAxis();
-    can->cd(3)->RedrawAxis();
-    can->Print(Form("eparavalidation/%s/%s.pdf",samplename.c_str(),name[l].c_str()));
-    delete can;
-   } //one_canvas
-   else
-   {
-   	TCanvas* can_lin=new TCanvas("can_lin","can_lin",0,0,800,600);
-    h_input_lin ->Draw("e");
-    h_output_lin->Draw("histsame");
-    h_input_lin ->Draw("esame");
-    {
-     TLegend* leg=new TLegend(0.65,0.82,0.99,0.93);
-     leg->SetBorderSize(0);
-     leg->SetFillStyle(0);
-     leg->SetHeader(Form("KS: %.2f, Chi2: %.2f",kolmo,chi2));
-     leg->AddEntry(h_output_lin,"Parametrisation","f");
-     leg->AddEntry(h_input_lin,"G4 Input","lpe");
-     leg->Draw();
-     TLatex* la=new TLatex(0.2,0.5,"#splitline{Photons 50 GeV}{0.2 < |#eta| < 0.25}");
-     la->SetNDC();
-     la->Draw();
-     ATLAS_LABEL(0.2,0.9);
-    }
-   	can_lin->RedrawAxis();
-    can_lin->Print(Form("eparavalidation/%s/%s_lin.pdf",samplename.c_str(),name[l].c_str()));
-
-   	TCanvas* can_log=new TCanvas("can_log","can_log",0,0,800,600);
-    h_input_log ->Draw("e");
-    h_output_log->Draw("histsame");
-    h_input_log ->Draw("esame");
-    can_log->SetLogy();
-    {
-     TLegend* leg=new TLegend(0.65,0.82,0.99,0.93);
-     leg->SetBorderSize(0);
-     leg->SetFillStyle(0);
-     leg->SetHeader(Form("KS: %.2f, Chi2: %.2f",kolmo,chi2));
-     leg->AddEntry(h_output_lin,"Parametrisation","f");
-     leg->AddEntry(h_input_lin,"G4 Input","lpe");
-     leg->Draw();
-    }
-   	can_log->RedrawAxis();
-    can_log->Print(Form("eparavalidation/%s/%s_log.pdf",samplename.c_str(),name[l].c_str()));
-   	
-    TCanvas* can_cum=new TCanvas("can_cum","can_cum",0,0,800,600);
-    h_input_cumul ->Draw("e");
-    h_output_cumul->Draw("histsame");
-    h_input_cumul ->Draw("esame");
-    {
-     TLegend* leg=new TLegend(0.65,0.82,0.99,0.93);
-     leg->SetBorderSize(0);
-     leg->SetFillStyle(0);
-     leg->SetHeader(Form("KS: %.2f, Chi2: %.2f",kolmo,chi2));
-     leg->AddEntry(h_output_lin,"Parametrisation","f");
-     leg->AddEntry(h_input_lin,"G4 Input","lpe");
-     leg->Draw();
-    }
-   	can_cum->RedrawAxis();
-    //can_cum->Print(Form("eparavalidation/%s/%s_cum.pdf",samplename.c_str(),name[l].c_str()));
-   	
-   } //separate canvases
-   
-  } //for layer
-  
-  */
-  
-}
-
-
-TH1* get_cumul(TH1* hist)
-{
-  TH1D* h_cumul=(TH1D*)hist->Clone("h_cumul");
-  double sum=0;
-  for(int b=1;b<=h_cumul->GetNbinsX();b++)
-  {
-    sum+=hist->GetBinContent(b);
-    h_cumul->SetBinContent(b,sum);
-  }
-  return h_cumul; 
-}
-
-void ATLAS_LABEL(double x,double y) 
-{
-  TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.SetTextFont(72);
-  l.SetTextColor(1);
-  l.DrawLatex(x,y,"#bf{ATLAS} Simulation");
-  l.DrawLatex(x,y-10,"Preliminary");
-}
-
-void check()
-{
- 
- //plot the TFCS1DFunctionHistogram
- 
- //TFile* file=TFile::Open("/afs/cern.ch/user/s/schaarsc/public/fastcalo/epara_storage/photons/secondPCA.root");
- //TFCS1DFunctionHistogram* hf=(TFCS1DFunctionHistogram*)file->Get("bin3/layer2/TFCS1DFunctionHistogram");
- 
- TFile* file=TFile::Open("/afs/cern.ch/user/s/schaarsc/public/fastcalo/athena/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCSParams.root");
- TFCS1DFunctionHistogram* hf=(TFCS1DFunctionHistogram*)file->Get("EnergyParams/pdgid_22/EN_50000/eta_0_20/bin3/layer2/TFCS1DFunctionHistogram");
-
- cout<<"hf "<<hf<<endl;
- 
- TH1D* hist=(TH1D*)(hf->vector_to_histo());
- hist->Draw();
- 
-}
-
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel/ISF_FatrasDetDescrModel/PlanarDetElement.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel/ISF_FatrasDetDescrModel/PlanarDetElement.h
index 83d4eeffac5..c2340d80584 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel/ISF_FatrasDetDescrModel/PlanarDetElement.h
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel/ISF_FatrasDetDescrModel/PlanarDetElement.h
@@ -83,10 +83,10 @@ namespace iFatras {
     //@{
     
     // Identifier
-    virtual Identifier identify() const;
+    Identifier identify() const;
 
     // Identifier hash
-    virtual IdentifierHash identifyHash() const;
+    IdentifierHash identifyHash() const;
 
     //@}
 
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/ISF_PRD_AssociationTool.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/ISF_PRD_AssociationTool.h
index d840a792bae..20b9d839b14 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/ISF_PRD_AssociationTool.h
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/ISF_PRD_AssociationTool.h
@@ -70,7 +70,7 @@ namespace iFatras {
 	IMPORTANT: Please use the typedefs IPRD_AssociationTool::PrepRawDataRange and 
 	IPRD_AssociationTool::ConstPRD_MapIt (defined in the interface) to access the 
 	tracks, as the way the data is stored internally may change.*/
-    virtual Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange onTracks(const Trk::PrepRawData& prd) ;
+    virtual Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange onTracks(const Trk::PrepRawData& prd) const;
     
     /** resets the tool - should be called before using tool (and maybe afterwards to free up 
 	memory)*/
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRD_AssociationTool.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRD_AssociationTool.cxx
index d56f834937f..7e89c3fa577 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRD_AssociationTool.cxx
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRD_AssociationTool.cxx
@@ -95,8 +95,8 @@ StatusCode iFatras::ISF_PRD_AssociationTool::removePRDs( const Trk::Track& track
       Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange 
 	range = m_prepRawDataTrackMap.equal_range(prd);
       // get iterators for range
-      PRD_MapIt mapIt    = range.first;
-      PRD_MapIt mapItEnd = range.second;
+      ConstPRD_MapIt mapIt    = range.first;
+      ConstPRD_MapIt mapItEnd = range.second;
       // simple for loop instead of fancier remove_if above
       for ( ;mapIt!=mapItEnd; ++mapIt) {
 	if ( mapIt->second==&track ) {
@@ -176,7 +176,7 @@ std::vector< const Trk::PrepRawData* > iFatras::ISF_PRD_AssociationTool::getPrds
    return vec;
 }
  
-Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange iFatras::ISF_PRD_AssociationTool::onTracks(const Trk::PrepRawData& prd) 
+Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange iFatras::ISF_PRD_AssociationTool::onTracks(const Trk::PrepRawData& prd) const
 {
      return m_prepRawDataTrackMap.equal_range(&prd);
 }
diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
index ff91e4b98ce..8ffe6d862ed 100644
--- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
+++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
@@ -249,7 +249,7 @@ except:
 
 ## Always enable the looper killer, unless it's been disabled
 if not hasattr(runArgs, "enableLooperKiller") or runArgs.enableLooperKiller:
-    simFlags.OptionalUserActionList.addAction('G4UA::LooperKillerTool', ['Step'])
+    simFlags.OptionalUserActionList.addAction('G4UA::LooperKillerTool')
 else:
     atlasG4log.warning("The looper killer will NOT be run in this job.")
 
diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
index 0c5bd7961fb..3898b9a59bb 100644
--- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
+++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
@@ -223,7 +223,7 @@ include("G4AtlasApps/G4Atlas.flat.configuration.py")
 
 ## Always enable the looper killer, unless it's been disabled
 if not hasattr(runArgs, "enableLooperKiller") or runArgs.enableLooperKiller:
-    simFlags.OptionalUserActionList.addAction('G4UA::LooperKillerTool', ['Step'])
+    simFlags.OptionalUserActionList.addAction('G4UA::LooperKillerTool')
 else:
     atlasG4log.warning("The looper killer will NOT be run in this job.")
 
diff --git a/Simulation/Tests/SimCoreTests/test/SimCoreTests_TestConfiguration.xml b/Simulation/Tests/SimCoreTests/test/SimCoreTests_TestConfiguration.xml
index c772bf277a9..613c048bbd3 100644
--- a/Simulation/Tests/SimCoreTests/test/SimCoreTests_TestConfiguration.xml
+++ b/Simulation/Tests/SimCoreTests/test/SimCoreTests_TestConfiguration.xml
@@ -521,7 +521,7 @@
             <jobTransform userJobId="CavernBg_TR2HITS">
               <doc>Reading cavern background track record, creating cav bg hits.</doc>
               <jobTransformJobName>CavernBg_TR2HITS</jobTransformJobName>
-              <jobTransformCmd>AtlasG4_tf.py --inputEVNT_CAVERNFile '/afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/cavernbg-pythia8-7000.evgen.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '5' --skipEvents '0' --randomSeed '8765' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --DataRunNumber '222525' --physicsList 'QGSP_BERT_HP' --postInclude 'PyJobTransforms/UseFrontier.py'
+              <jobTransformCmd>AtlasG4_tf.py --inputEVNT_TRFile '/afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/cavernbg-pythia8-7000.evgen.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '5' --skipEvents '0' --randomSeed '8765' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --DataRunNumber '222525' --physicsList 'QGSP_BERT_HP' --postInclude 'PyJobTransforms/UseFrontier.py'
               </jobTransformCmd>
               <group>SimCoreJobTransformTests</group>
               <queue>medium</queue>
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh
index 21acd5574c1..fc6e7159d0f 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh
@@ -3,7 +3,7 @@
 # art-description: Run simulation outside ISF, reading cavern background track records, writing cavern background HITS, using 2015 geometry and conditions
 # art-type: grid
 
-AtlasG4_tf.py --inputEVNT_CAVERNFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/cavernbg-pythia8-7000.evgen.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '5' --skipEvents '0' --randomSeed '8765' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --DataRunNumber '222525' --physicsList 'QGSP_BERT_HP' --postInclude 'PyJobTransforms/UseFrontier.py'
+AtlasG4_tf.py --inputEVNT_TRFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/cavernbg-pythia8-7000.evgen.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '5' --skipEvents '0' --randomSeed '8765' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --DataRunNumber '222525' --physicsList 'QGSP_BERT_HP' --postInclude 'PyJobTransforms/UseFrontier.py'
 
 SCRIPT_DIRECTORY=$1
 PACKAGE=$2
diff --git a/Simulation/Tools/AtlasCLHEP_RandomGenerators/AtlasCLHEP_RandomGenerators/dSFMTEngine.h b/Simulation/Tools/AtlasCLHEP_RandomGenerators/AtlasCLHEP_RandomGenerators/dSFMTEngine.h
index 6fe4e550fae..8943d52dc8c 100755
--- a/Simulation/Tools/AtlasCLHEP_RandomGenerators/AtlasCLHEP_RandomGenerators/dSFMTEngine.h
+++ b/Simulation/Tools/AtlasCLHEP_RandomGenerators/AtlasCLHEP_RandomGenerators/dSFMTEngine.h
@@ -30,9 +30,9 @@ namespace CLHEP {
 class dSFMTEngine : public HepRandomEngine {
 
 public:
-  dSFMTEngine() throw(std::runtime_error);
-  dSFMTEngine( long seed ) throw(std::runtime_error);
-  dSFMTEngine( const long * seeds ) throw(std::runtime_error);
+  dSFMTEngine();
+  dSFMTEngine( long seed );
+  dSFMTEngine( const long * seeds );
   virtual ~dSFMTEngine();
   // Constructors and destructor.
 
diff --git a/Simulation/Tools/AtlasCLHEP_RandomGenerators/src/dSFMTEngine.cxx b/Simulation/Tools/AtlasCLHEP_RandomGenerators/src/dSFMTEngine.cxx
index 402c50caac7..a3ea6f76e4a 100755
--- a/Simulation/Tools/AtlasCLHEP_RandomGenerators/src/dSFMTEngine.cxx
+++ b/Simulation/Tools/AtlasCLHEP_RandomGenerators/src/dSFMTEngine.cxx
@@ -29,7 +29,7 @@ int dSFMTEngine::maxIndex = 215;
 
 const unsigned int VECTOR_STATE_SIZE = 2 + (DSFMT_N + 1)*4;
 
-dSFMTEngine::dSFMTEngine() throw(std::runtime_error):m_dsfmt(0) 
+dSFMTEngine::dSFMTEngine():m_dsfmt(0) 
 {
   init_dsfmt();
   
@@ -45,7 +45,7 @@ dSFMTEngine::dSFMTEngine() throw(std::runtime_error):m_dsfmt(0)
   for( int i=0; i < 2000; ++i ) flat();      // Warm up just a bit
 }
 
-dSFMTEngine::dSFMTEngine(long seed) throw(std::runtime_error):m_dsfmt(0)  
+dSFMTEngine::dSFMTEngine(long seed):m_dsfmt(0)  
 {
   init_dsfmt();
   
@@ -53,7 +53,7 @@ dSFMTEngine::dSFMTEngine(long seed) throw(std::runtime_error):m_dsfmt(0)
   for( int i=0; i < 2000; ++i ) flat();      // Warm up just a bit
 }
 
-dSFMTEngine::dSFMTEngine(const long * seeds) throw(std::runtime_error):m_dsfmt(0) 
+dSFMTEngine::dSFMTEngine(const long * seeds):m_dsfmt(0) 
 {
   init_dsfmt();
   
diff --git a/TestBeam/TBConditions/TBCaloConditions/src/TBCaloCoolPosTool.cxx b/TestBeam/TBConditions/TBCaloConditions/src/TBCaloCoolPosTool.cxx
index ee5290492f8..e0daeb7db6d 100755
--- a/TestBeam/TBConditions/TBCaloConditions/src/TBCaloCoolPosTool.cxx
+++ b/TestBeam/TBConditions/TBCaloConditions/src/TBCaloCoolPosTool.cxx
@@ -124,7 +124,7 @@ double TBCaloCoolPosTool::eta()
   try {
     e=(* m_etaTable)["eta"].data<float>();
   }
-  catch (std::exception ex) {
+  catch (const std::exception& ex) {
      ATH_MSG_ERROR("eta AttributeList access failed");
      return 0 ; 
   }
@@ -137,7 +137,7 @@ double TBCaloCoolPosTool::theta()
   try {
     t=(* m_thetaTable)["theta"].data<float>();
   }
-  catch (std::exception ex) {
+  catch (const std::exception& ex) {
      ATH_MSG_ERROR("theta AttributeList access failed");
      return 0 ; 
   }
@@ -150,7 +150,7 @@ double TBCaloCoolPosTool::z()
   try {
     z=(* m_zTable)["z"].data<float>();
   }
-  catch (std::exception ex) {
+  catch (const std::exception& ex) {
      ATH_MSG_ERROR("z AttributeList access failed");
      return 0 ; 
   }
@@ -163,7 +163,7 @@ double TBCaloCoolPosTool::delta()
   try {
     d=(* m_deltaTable)["delta"].data<float>();
   }
-  catch (std::exception ex) {
+  catch (const std::exception& ex) {
      ATH_MSG_ERROR("delta AttributeList access failed");
      return 0 ; 
   }
diff --git a/TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx b/TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx
index f8ebc1935ad..d85bc684b62 100644
--- a/TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx
+++ b/TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx
@@ -917,8 +917,8 @@ StatusCode TBTree_CaloClusterH6::getNoise(CaloCluster const * const cluster) {
     try {
       chid = m_larCablingSvc->createSignalChannelID(id);
     }
-    catch ( LArID_Exception except) {
-      ATH_MSG_ERROR("HWId not found: "<<(std::string)except);
+    catch ( const LArID_Exception& except) {
+      ATH_MSG_ERROR("HWId not found: "<<(const std::string&)except);
       return StatusCode::FAILURE;
     }
     // Find the cell data in the DigitContainer
diff --git a/TileCalorimeter/TileConditions/TileConditions/TileCablingService.h b/TileCalorimeter/TileConditions/TileConditions/TileCablingService.h
index c38d9273a3a..90b87fe79f8 100644
--- a/TileCalorimeter/TileConditions/TileConditions/TileCablingService.h
+++ b/TileCalorimeter/TileConditions/TileConditions/TileCablingService.h
@@ -40,12 +40,12 @@ public:
     
     // Conversion between TileID and Trigger Tower ID
 
-    Identifier          cell2tt_id              ( const Identifier & id ) const throw (CaloID_Exception, TileID_Exception);
-    Identifier          pmt2tt_id               ( const Identifier & id ) const throw (CaloID_Exception);
-    Identifier          cell2mt_id              ( const Identifier & id ) const throw (CaloID_Exception, TileID_Exception);
-    Identifier          pmt2mt_id               ( const Identifier & id ) const throw (CaloID_Exception);
+    Identifier          cell2tt_id              ( const Identifier & id ) const;
+    Identifier          pmt2tt_id               ( const Identifier & id ) const;
+    Identifier          cell2mt_id              ( const Identifier & id ) const;
+    Identifier          pmt2mt_id               ( const Identifier & id ) const;
 
-    Identifier          drawer2MBTS_id          ( const HWIdentifier & id ) const throw (TileID_Exception);
+    Identifier          drawer2MBTS_id          ( const HWIdentifier & id ) const;
 
     // Conversion between TileID and TileHWID
 
@@ -53,16 +53,16 @@ public:
 //  Identifier          h2s_region_id           ( const HWIdentifier & id );
 //  Identifier          h2s_module_id           ( const HWIdentifier & id );
 //  Identifier          h2s_tower_id            ( const HWIdentifier & id );
-    Identifier          h2s_cell_id_index       ( const HWIdentifier & id, int & index, int & pmt ) const throw (TileID_Exception);
-    Identifier          h2s_cell_id_index       ( int ros, int drawer, int channel, int & index, int & pmt ) const throw (TileID_Exception);
-    Identifier          h2s_cell_id             ( const HWIdentifier & id ) const throw (TileID_Exception);
-    Identifier          h2s_pmt_id              ( const HWIdentifier & id ) const throw (TileID_Exception);
-    Identifier          h2s_adc_id              ( const HWIdentifier & id ) const throw (TileID_Exception);
+    Identifier          h2s_cell_id_index       ( const HWIdentifier & id, int & index, int & pmt ) const;
+    Identifier          h2s_cell_id_index       ( int ros, int drawer, int channel, int & index, int & pmt ) const;
+    Identifier          h2s_cell_id             ( const HWIdentifier & id ) const;
+    Identifier          h2s_pmt_id              ( const HWIdentifier & id ) const;
+    Identifier          h2s_adc_id              ( const HWIdentifier & id ) const;
                                                                   
 //  HWIdentifier        s2h_ros_id              ( const Identifier & id );
     HWIdentifier        s2h_drawer_id           ( const Identifier & id ) const;
-    HWIdentifier        s2h_channel_id          ( const Identifier & id ) const throw (TileID_Exception);
-    HWIdentifier        s2h_adc_id              ( const Identifier & id ) const throw (TileID_Exception);
+    HWIdentifier        s2h_channel_id          ( const Identifier & id ) const;
+    HWIdentifier        s2h_adc_id              ( const Identifier & id ) const;
 
     int                 frag                    ( const HWIdentifier & id ) const;
     int                 frag                    ( const Identifier & id )   const;
@@ -246,7 +246,7 @@ private:
     std::vector<int> m_ch2pmt;
     std::vector<int> m_ch2index;
 
-   Identifier h2s_cell_id_index_find ( int ros, int drawer, int channel, int & index, int & pmt ) const throw (TileID_Exception);
+   Identifier h2s_cell_id_index_find ( int ros, int drawer, int channel, int & index, int & pmt ) const;
    Identifier h2s_cell_id_index_from_cache (int ros, int drawer, int channel, int & index, int & pmt ) const;
 
    // returns index used for caching (for ros != TileHWID::BEAM_ROS) and calculated as 
diff --git a/TileCalorimeter/TileConditions/src/TileCablingService.cxx b/TileCalorimeter/TileConditions/src/TileCablingService.cxx
index 21d4a4701a9..0eabd476050 100644
--- a/TileCalorimeter/TileConditions/src/TileCablingService.cxx
+++ b/TileCalorimeter/TileConditions/src/TileCablingService.cxx
@@ -257,7 +257,6 @@ TileCablingService::setConnected(int ros, int draMin, int draMax)
 
 Identifier
 TileCablingService::cell2tt_id ( const Identifier & id ) const
-  throw (CaloID_Exception, TileID_Exception)
 {
   // take only first pmt - might be wrong for D-cells
   return pmt2tt_id(m_tileID->pmt_id(id,0));
@@ -265,7 +264,6 @@ TileCablingService::cell2tt_id ( const Identifier & id ) const
 
 Identifier
 TileCablingService::pmt2tt_id ( const Identifier & id ) const
-  throw (CaloID_Exception)
 {
   int mineta[4] = { 0, 0,  9,  9 };
   int maxeta[4] = { 0, 8, 14, 14 };
@@ -331,7 +329,6 @@ TileCablingService::pmt2tt_id ( const Identifier & id ) const
 
 Identifier
 TileCablingService::cell2mt_id ( const Identifier & id ) const
-  throw (CaloID_Exception, TileID_Exception)
 {
   // take only first pmt - might be wrong for D0 cell
   return pmt2mt_id(m_tileID->pmt_id(id,0));
@@ -339,7 +336,6 @@ TileCablingService::cell2mt_id ( const Identifier & id ) const
 
 Identifier
 TileCablingService::pmt2mt_id ( const Identifier & id ) const
-  throw (CaloID_Exception)
 {
 //  int section  = m_tileID->section  (id);
   int side     = m_tileID->side     (id);
@@ -390,7 +386,6 @@ TileCablingService::pmt2mt_id ( const Identifier & id ) const
 
 Identifier
 TileCablingService::drawer2MBTS_id ( const HWIdentifier & hwid ) const
-  throw (TileID_Exception)
 {
   int ros      = m_tileHWID->ros     (hwid);
   int drawer   = m_tileHWID->drawer  (hwid);
@@ -454,7 +449,6 @@ TileCablingService::drawer2MBTS_id ( const HWIdentifier & hwid ) const
 
 Identifier
 TileCablingService::h2s_cell_id ( const HWIdentifier & hwid ) const
-  throw (TileID_Exception)
 {
   int ros      = m_tileHWID->ros     (hwid);
   int drawer   = m_tileHWID->drawer  (hwid);
@@ -554,7 +548,6 @@ TileCablingService::h2s_cell_id ( const HWIdentifier & hwid ) const
 
 Identifier
 TileCablingService::h2s_cell_id_index_find ( int ros, int drawer, int channel, int & index, int & pmt ) const
-  throw (TileID_Exception)
 {
   if ( EB_special(ros,drawer) ) {
     if ( D4(channel) ) { index = pmt = -1; return m_invalid_id; }
@@ -685,7 +678,6 @@ TileCablingService::h2s_cell_id_index_find ( int ros, int drawer, int channel, i
 
 Identifier
 TileCablingService::h2s_pmt_id ( const HWIdentifier & hwid ) const
-  throw (TileID_Exception)
 {
   int ros      = m_tileHWID->ros     (hwid);
   int drawer   = m_tileHWID->drawer  (hwid);
@@ -793,7 +785,6 @@ TileCablingService::h2s_pmt_id ( const HWIdentifier & hwid ) const
 
 Identifier
 TileCablingService::h2s_adc_id ( const HWIdentifier & hwid ) const
-  throw (TileID_Exception)
 {
   int ros      = m_tileHWID->ros     (hwid);
   int drawer   = m_tileHWID->drawer  (hwid);
@@ -972,7 +963,6 @@ TileCablingService::s2h_drawer_id ( const Identifier & swid ) const
 
 HWIdentifier
 TileCablingService::s2h_channel_id ( const Identifier & swid ) const
-  throw (TileID_Exception)
 {
   int section  = m_tileID->section  (swid);
   int ros, drawer, channel;
@@ -1055,7 +1045,6 @@ TileCablingService::s2h_channel_id ( const Identifier & swid ) const
 
 HWIdentifier
 TileCablingService::s2h_adc_id ( const Identifier & swid ) const
-  throw (TileID_Exception)
 {
   int section  = m_tileID->section  (swid);
   int ros, drawer, channel;
@@ -2216,7 +2205,7 @@ TileCablingService::fillH2SIdCache(void) {
 
 Identifier
 TileCablingService::h2s_cell_id_index ( const HWIdentifier & hwid, int & index, int & pmt ) const
-  throw (TileID_Exception) {
+{
   int ros      = m_tileHWID->ros     (hwid);
   int drawer   = m_tileHWID->drawer  (hwid);
   int channel  = m_tileHWID->channel (hwid);  
@@ -2230,7 +2219,7 @@ TileCablingService::h2s_cell_id_index ( const HWIdentifier & hwid, int & index,
 
 Identifier
 TileCablingService::h2s_cell_id_index (int ros, int drawer, int channel, int& index, int& pmt ) const  
-  throw (TileID_Exception) {
+{
 
   if (m_isCacheFilled && ros != TileHWID::BEAM_ROS) {
     return h2s_cell_id_index_from_cache(ros, drawer, channel, index, pmt);
diff --git a/TileCalorimeter/TileCosmicAlgs/TileCosmicAlgs/TileCosmicsTrigger.h b/TileCalorimeter/TileCosmicAlgs/TileCosmicAlgs/TileCosmicsTrigger.h
index de149b8314d..7e43ed1b8b6 100755
--- a/TileCalorimeter/TileCosmicAlgs/TileCosmicAlgs/TileCosmicsTrigger.h
+++ b/TileCalorimeter/TileCosmicAlgs/TileCosmicAlgs/TileCosmicsTrigger.h
@@ -24,11 +24,16 @@
 //  
 //  
 //****************************************************************************
-#ifndef TileCosmicsTrigger_H
-#define TileCosmicsTrigger_H
+#ifndef TILECOSMICALGS_TILECOSMICSTRIGGER_H
+#define TILECOSMICALGS_TILECOSMICSTRIGGER_H
+//TileCalo include
+#include "TileEvent/TileTTL1Container.h"
+#include "TileEvent/TileTriggerContainer.h"
 
 // Athena includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
 class CaloLVL1_ID;
 class TileTTL1Hash;
@@ -66,7 +71,6 @@ class TileCosmicsTrigger: public AthAlgorithm {
 
 // Input variables
 //
-    std::string m_ttl1Container;
     std::vector<std::string> m_connectedDrawers[8];
     std::vector<std::string> m_connectedDrawers1;
     std::vector<std::string> m_connectedDrawers2;
@@ -92,11 +96,13 @@ class TileCosmicsTrigger: public AthAlgorithm {
 
 // Store Gate & Auxiliary algorithms 
 //
-    std::string m_tileTriggerContainer;
 
     const CaloLVL1_ID* m_TT_ID;
     TileTTL1Hash* m_TTHash;
 
+    SG::ReadHandleKey<TileTTL1Container> m_ttl1ContainerKey{this, "TileTTL1Container", "TileTTL1Cnt", "Input TileTTL1Container name"};
+    SG::WriteHandleKey<TileTriggerContainer> m_triggerContainerKey{this, "TileTriggerContainer","TileTriggerCnt", "Output TileTriggerContainer name"};
+
 };
 
-#endif
+#endif // TILECOSMICALGS_TILECOSMICSTRIGGER_H
diff --git a/TileCalorimeter/TileCosmicAlgs/TileCosmicAlgs/TileMuonFitter.h b/TileCalorimeter/TileCosmicAlgs/TileCosmicAlgs/TileMuonFitter.h
index ea952a3b6d4..d89f20351ce 100755
--- a/TileCalorimeter/TileCosmicAlgs/TileCosmicAlgs/TileMuonFitter.h
+++ b/TileCalorimeter/TileCosmicAlgs/TileCosmicAlgs/TileMuonFitter.h
@@ -26,23 +26,30 @@
  *  Output: TileEvent/TileCosmicMuon object
  *   
  ********************************************************************/
-// Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
-
-// Athena includes
-#include "AthenaBaseComps/AthAlgorithm.h"
 
 // Tile includes
 #include "TileCosmicAlgs/TileMuonTrackDistance.h"
+#include "TileEvent/TileContainer.h"
 
+// Calo includes
 #include "CaloIdentifier/CaloCell_ID.h"
+#include "CaloEvent/CaloCellContainer.h"
+
+// Athena includes
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+#include "CommissionEvent/ComTime.h"
+
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
+
 
 // forward declarations
 class HWIdentifier;
 class IdentifierHash;
 class TileID;
 class TileHWID;
-class CaloCellContainer;
 class TileDetDescrManager;
 
 // C++ STL includes
@@ -183,13 +190,6 @@ class TileMuonFitter: public AthAlgorithm {
 
   protected:
 
-    /** Name of input CaloCellContainer. */
-    std::string m_cellContainer;
-    /** Name of output TileCosmicMuon object. */
-    std::string m_tileCosmicMuonKey;
-    /** Name of output ComTime object. */
-    std::string m_comTimeKey;
-
     // Tile objects
     const TileID* m_tileID;
     const TileHWID* m_tileHWID;
@@ -261,6 +261,16 @@ class TileMuonFitter: public AthAlgorithm {
 
     static CaloCell_ID::SUBCALO m_caloIndex;
 
+    SG::ReadHandleKey<CaloCellContainer> m_cellContainerKey{this, "CaloCellContainer", "AllCalo",
+                                                            "Input CaloCellContainer name" };
+
+    SG::WriteHandleKey<TileCosmicMuonContainer> m_cosmicMuonContainerKey{this,
+                                                                         "TileCosmicMuonKey",
+                                                                         "TileCosmicMuonMF",
+                                                                         "Output TileCosmicMuonContainer name"};
+
+    SG::WriteHandleKey<ComTime> m_comTimeKey{this, "ComTimeKey", "ComTimeTileMuon", "Output ComTime name"};
+
 };
 
 #endif
diff --git a/TileCalorimeter/TileCosmicAlgs/src/TileCosmicsTrigger.cxx b/TileCalorimeter/TileCosmicAlgs/src/TileCosmicsTrigger.cxx
index 4d512fb9a80..1d42ce42326 100755
--- a/TileCalorimeter/TileCosmicAlgs/src/TileCosmicsTrigger.cxx
+++ b/TileCalorimeter/TileCosmicAlgs/src/TileCosmicsTrigger.cxx
@@ -18,34 +18,32 @@
 //
 //*****************************************************************************
 
+//TileCalo include
+#include "TileCosmicAlgs/TileCosmicsTrigger.h"
+#include "TileIdentifier/TileTTL1Hash.h"
+
+// Calo include
+#include "CaloIdentifier/CaloLVL1_ID.h" 
+
+// Athena includes
+#include "AthenaKernel/errorcheck.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+
 //Gaudi includes
 #include "GaudiKernel/Bootstrap.h"
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/IDataProviderSvc.h"
 #include "GaudiKernel/SmartDataPtr.h"
 
-// Athena includes
-#include "AthenaKernel/errorcheck.h"
-
-// Calo include
-#include "CaloIdentifier/CaloLVL1_ID.h" 
-
-//TileCalo include
-#include "TileEvent/TileTTL1Container.h"  
-#include "TileEvent/TileTriggerContainer.h"  
-#include "TileCosmicAlgs/TileCosmicsTrigger.h"
-#include "TileIdentifier/TileTTL1Hash.h"
-
 const int TileCosmicsTrigger::m_NMaxTowers = NMAXTOWERS;
 
 TileCosmicsTrigger::TileCosmicsTrigger(const std::string name, ISvcLocator* pSvcLocator)
     : AthAlgorithm(name, pSvcLocator)
-  , m_ttl1Container("TileTTL1Cnt")
   , m_TThreshold(5.0)
   , m_NBOARDS(8)
   , m_NDRAWERSPERBOARD(12)
   //, m_NTOWERSPERDRAWER(8)
-  , m_tileTriggerContainer("TileTriggerCnt")
   , m_TT_ID(0)
   , m_TTHash(0)
 {
@@ -180,8 +178,6 @@ TileCosmicsTrigger::TileCosmicsTrigger(const std::string name, ISvcLocator* pSvc
   m_connectedDrawers8[10] = "EBC21";
   m_connectedDrawers8[11] = "EBC22";
 
-  declareProperty("TileTTL1Container", m_ttl1Container);
-  declareProperty("TileTriggerContainer", m_tileTriggerContainer);
   declareProperty("ConnectedDrawers1", m_connectedDrawers1);
   declareProperty("ConnectedDrawers2", m_connectedDrawers2);
   declareProperty("ConnectedDrawers3", m_connectedDrawers3);
@@ -297,6 +293,9 @@ StatusCode TileCosmicsTrigger::initialize() {
     if (m_connectedTowers[i] == 1) nt++;
   }
 
+  ATH_CHECK( m_ttl1ContainerKey.initialize() );
+  ATH_CHECK( m_triggerContainerKey.initialize() );
+
   ATH_MSG_INFO( "Initialization completed, number of towers " << nt );
 
   return StatusCode::SUCCESS;
@@ -309,13 +308,12 @@ StatusCode TileCosmicsTrigger::initialize() {
 StatusCode TileCosmicsTrigger::execute() {
 
   // step1: read TileTTL1s from TDS
-  const TileTTL1Container* TTL1Cnt;
-  CHECK( evtStore()->retrieve(TTL1Cnt, m_ttl1Container) );
+  SG::ReadHandle<TileTTL1Container> ttl1Container;
+  ATH_CHECK( ttl1Container.isValid() );
+  ATH_MSG_DEBUG( "Loaded TileTTL1Container: " <<  ttl1Container.key() );
 
-  ATH_MSG_DEBUG( "loaded TileTTL1Container: " <<  m_ttl1Container );
-
-  TileTriggerContainer* pTileTriggerContainer = new TileTriggerContainer();
-  TileTrigger* pTileTrigger;
+  SG::WriteHandle<TileTriggerContainer> triggerContainer (m_triggerContainerKey);
+  ATH_CHECK( triggerContainer.record(std::make_unique<TileTriggerContainer>()) );
 
   // step2: reset towers 
   for (int i = 0; i < m_NMaxTowers; i++) {
@@ -338,8 +336,8 @@ StatusCode TileCosmicsTrigger::execute() {
   p_backTowerSum.resize(NMAXTOWERS);
 
   // step3: check which towers fired the discriminator
-  TileTTL1Container::const_iterator it = TTL1Cnt->begin();
-  TileTTL1Container::const_iterator end = TTL1Cnt->end();
+  TileTTL1Container::const_iterator it = ttl1Container->begin();
+  TileTTL1Container::const_iterator end = ttl1Container->end();
 
   for (; it != end; ++it) {
     const TileTTL1 * cinp = (*it);
@@ -414,14 +412,12 @@ StatusCode TileCosmicsTrigger::execute() {
 
   p_backTowerID.resize(nbacktowers);
   p_backTowerSum.resize(nbacktowers);
-  pTileTrigger = new TileTrigger(p_maxTowerID, p_maxTowerSum, p_boardTowerID, p_boardTowerSum, p_backTowerID, p_backTowerSum);
-
-  pTileTriggerContainer->push_back(pTileTrigger);
 
-  // step8: register the TileTrigger container in the TES
-  CHECK( evtStore()->record(pTileTriggerContainer, m_tileTriggerContainer, false) );
-  ATH_MSG_DEBUG( "TileTriggerContainer registered successfully (" << m_tileTriggerContainer << ")" );
+  triggerContainer->push_back(std::make_unique<TileTrigger>(p_maxTowerID, p_maxTowerSum,
+                                                            p_boardTowerID, p_boardTowerSum,
+                                                            p_backTowerID, p_backTowerSum));
 
+  ATH_MSG_DEBUG( "TileTriggerContainer registered successfully (" << triggerContainer.key() << ")" );
   // Execution completed.
   ATH_MSG_DEBUG( "execute() completed successfully" );
 
diff --git a/TileCalorimeter/TileCosmicAlgs/src/TileMuonFitter.cxx b/TileCalorimeter/TileCosmicAlgs/src/TileMuonFitter.cxx
index 4d087384de9..870d41d3da7 100755
--- a/TileCalorimeter/TileCosmicAlgs/src/TileMuonFitter.cxx
+++ b/TileCalorimeter/TileCosmicAlgs/src/TileMuonFitter.cxx
@@ -31,30 +31,29 @@
  *    
  *   
  ********************************************************************/
-// External includes
-#include "Minuit2/MnMigrad.h"
-#include "Minuit2/MnUserParameterState.h"
-#include "Minuit2/FunctionMinimum.h"
-
-// Gaudi includes
-#include "GaudiKernel/ISvcLocator.h"
-
-// Athena includes
-#include "EventContainers/SelectAllObject.h" 
-#include "CommissionEvent/ComTime.h"
+// Tile includes
+#include "TileCosmicAlgs/TileMuonFitter.h"
+#include "TileIdentifier/TileHWID.h"
+#include "TileDetDescr/TileDetDescrManager.h"
+#include "TileEvent/TileCosmicMuon.h"
 
 // Calo includes
-#include "CaloEvent/CaloCellContainer.h"
 #include "CaloDetDescr/CaloDetDescrElement.h"
 #include "CaloIdentifier/CaloID.h"
 
-// Tile includes
+// Athena includes
+#include "EventContainers/SelectAllObject.h" 
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
 #include "Identifier/HWIdentifier.h"
-#include "TileIdentifier/TileHWID.h"
-#include "TileDetDescr/TileDetDescrManager.h"
-#include "TileCosmicAlgs/TileMuonFitter.h"
-#include "TileEvent/TileCosmicMuon.h"
-#include "TileEvent/TileContainer.h"
+
+// Gaudi includes
+#include "GaudiKernel/ISvcLocator.h"
+
+// External includes
+#include "Minuit2/MnMigrad.h"
+#include "Minuit2/MnUserParameterState.h"
+#include "Minuit2/FunctionMinimum.h"
 
 // ROOT includes
 #include "CLHEP/Vector/ThreeVector.h"
@@ -93,11 +92,11 @@ CaloCell_ID::SUBCALO TileMuonFitter::m_caloIndex = CaloCell_ID::TILE;
 //
 TileMuonFitter::TileMuonFitter(std::string name, ISvcLocator* pSvcLocator)
     : AthAlgorithm(name, pSvcLocator)
-  , m_tileID(0)
-  , m_tileHWID(0)
-  , m_tileMgr(0)
-  , m_caloCells(0)
-  , m_theTrack(0)
+  , m_tileID(nullptr)
+  , m_tileHWID(nullptr)
+  , m_tileMgr(nullptr)
+  , m_caloCells(nullptr)
+  , m_theTrack(nullptr)
   , m_nCells(0)
   , m_meanX(0.0)
   , m_meanY(0.0)
@@ -109,21 +108,13 @@ TileMuonFitter::TileMuonFitter(std::string name, ISvcLocator* pSvcLocator)
   , m_maxTopIndex(0)
   , m_reg1to2(false)
 {
-  declareProperty("CaloCellContainer", m_cellContainer = "AllCalo");
   declareProperty("DoHoughTransform", m_doHoughTransform = true);
-  if (m_doHoughTransform) {
-    m_tileCosmicMuonKey = "TileCosmicMuonHT";
-  } else {
-    m_tileCosmicMuonKey = "TileCosmicMuonMF";
-  }
-  declareProperty("TileCosmicMuonKey", m_tileCosmicMuonKey);
   declareProperty("EThreshold", m_eThreshold = 250.);
   declareProperty("DeltaTimeCut", m_deltaTimeCut = 6.);
   declareProperty("MinimumCells", m_minimumCells = 2);
   declareProperty("DoWeighted", m_doWeighted = true);
   declareProperty("DoDensityWeighting", m_doDensity = true);
   declareProperty("BeamType", m_beamType = "cosmics");
-  declareProperty("ComTimeKey", m_comTimeKey = "ComTimeTileMuon");
 }
 
 // ********************************************************************
@@ -141,6 +132,13 @@ StatusCode TileMuonFitter::initialize() {
   CHECK( detStore()->retrieve(m_tileID) );
   CHECK( detStore()->retrieve(m_tileHWID) );
 
+  if (m_doHoughTransform) {
+    m_cosmicMuonContainerKey = "TileCosmicMuonHT";
+  }
+
+  ATH_CHECK( m_cellContainerKey.initialize() );
+  ATH_CHECK( m_cosmicMuonContainerKey.initialize() );
+  ATH_CHECK( m_comTimeKey.initialize() );
 
   m_cellEnergy.resize(m_tileID->cell_hash_max());
   m_cellWeight.resize(m_tileID->cell_hash_max());
@@ -151,8 +149,8 @@ StatusCode TileMuonFitter::initialize() {
 
   if (m_minimumCells < 2) m_minimumCells = 2;
 
-  ATH_MSG_INFO( "Loading:   " << m_cellContainer );
-  ATH_MSG_INFO( "Recording: " << m_tileCosmicMuonKey << " and " << m_comTimeKey );
+  ATH_MSG_INFO( "Loading:   " << m_cellContainerKey.key() );
+  ATH_MSG_INFO( "Recording: " << m_cosmicMuonContainerKey.key() << " and " << m_comTimeKey.key() );
   ATH_MSG_INFO( "Cell Energy Threshold: " << m_eThreshold << " (MeV)" );
   ATH_MSG_INFO( "Delta Time Cell Cut: " << m_deltaTimeCut << " (ns)" );
   ATH_MSG_INFO( "Minimum Number of cells for fit: " << m_minimumCells );
@@ -257,14 +255,17 @@ StatusCode TileMuonFitter::execute() {
   int fitStatus = 2; //not even try
   setEventDefaults();
 
-  if (evtStore()->retrieve(m_caloCells, m_cellContainer).isFailure()) {
-    ATH_MSG_WARNING( " Could not find container " << m_cellContainer );
+  SG::ReadHandle<CaloCellContainer> cellContainer(m_cellContainerKey);
+  if (!cellContainer.isValid()) {
+    ATH_MSG_WARNING( " Could not find container " << m_cellContainerKey.key() );
   } else {
-    ATH_MSG_DEBUG( "Container " << m_cellContainer << " with CaloCells found " );
+    ATH_MSG_DEBUG( "Container " << m_cellContainerKey.key() << " with CaloCells found " );
+
+    m_caloCells = cellContainer.cptr();
 
     // check on number of tile cells
     if (m_caloCells->nCellsCalo(m_caloIndex) == 0) {
-      ATH_MSG_DEBUG( "no TileCells in CellContainer " << m_cellContainer << "> for this event!" );
+      ATH_MSG_DEBUG( "no TileCells in CellContainer " << m_cellContainerKey.key() << "> for this event!" );
     } else {
       buildCells();
     }
@@ -685,7 +686,11 @@ void TileMuonFitter::buildTileCosmicMuonAtYequal0(int fitok) {
   //
   // Then put the result in a ComTime object
 
-  TileCosmicMuonContainer* tcmContainer = new TileCosmicMuonContainer;
+  SG::WriteHandle<TileCosmicMuonContainer> cosmicMuonContainer (m_cosmicMuonContainerKey);
+  StatusCode sc = cosmicMuonContainer.record(std::make_unique<TileCosmicMuonContainer>());
+  if (sc.isFailure()) {
+    ATH_MSG_FATAL( "Cannot record TileCosmicMuonContainer" << cosmicMuonContainer.key() );
+  }
 
   for (unsigned int n = 0; n < m_linePar.size(); n++) {
     double p0 = m_linePar[n][0];
@@ -699,8 +704,7 @@ void TileMuonFitter::buildTileCosmicMuonAtYequal0(int fitok) {
     TileCosmicMuon *theTileCosmicMuon = new TileCosmicMuon();
 
     if (!(fitok == 1) || p1 == 0.0) {
-      tcmContainer->push_back(theTileCosmicMuon);
-      //sc = m_storeGate->record(theTileCosmicMuon, m_tileCosmicMuonKey);
+      cosmicMuonContainer->push_back(theTileCosmicMuon);
     } else {
       Hep3Vector theDirection(1.0, p1, p3);
       theDirection = theDirection.unit();
@@ -734,16 +738,11 @@ void TileMuonFitter::buildTileCosmicMuonAtYequal0(int fitok) {
       theTileCosmicMuon->SetEnergyBottom(ebot);
       theTileCosmicMuon->SetTrackCellHash(cells);
 
-      tcmContainer->push_back(theTileCosmicMuon);
-      //sc = m_storeGate->record(theTileCosmicMuon, m_tileCosmicMuonKey);
+      cosmicMuonContainer->push_back(theTileCosmicMuon);
     }
 
   }
 
-  if (evtStore()->record(tcmContainer, m_tileCosmicMuonKey).isFailure()) {
-    ATH_MSG_FATAL( "Cannot record TileCosmicMuonContainer" );
-  }
-
   if (fitok != 2) delete m_theTrack;
 }
 // ********************************************************************
@@ -760,7 +759,11 @@ void TileMuonFitter::buildTileCosmicMuonAtZequal0(int fitok) {
   //
   // Then put the result in a ComTime object
 
-  TileCosmicMuonContainer* tcmContainer = new TileCosmicMuonContainer;
+  SG::WriteHandle<TileCosmicMuonContainer> cosmicMuonContainer (m_cosmicMuonContainerKey);
+  StatusCode sc = cosmicMuonContainer.record(std::make_unique<TileCosmicMuonContainer>());
+  if (sc.isFailure()) {
+    ATH_MSG_FATAL( "Cannot record TileCosmicMuonContainer" << cosmicMuonContainer.key() );
+  }
 
   for (unsigned int n = 0; n < m_linePar.size(); n++) {
     double p0 = m_linePar[n][0];
@@ -774,8 +777,7 @@ void TileMuonFitter::buildTileCosmicMuonAtZequal0(int fitok) {
     TileCosmicMuon *theTileCosmicMuon = new TileCosmicMuon();
 
     if (!(fitok == 1) || p3 == 0.0) {
-      tcmContainer->push_back(theTileCosmicMuon);
-      //sc = m_storeGate->record(theTileCosmicMuon, m_tileCosmicMuonKey);
+      cosmicMuonContainer->push_back(theTileCosmicMuon);
     } else {
       Hep3Vector theDirection(1.0, p1, p3);
       theDirection = theDirection.unit();
@@ -809,16 +811,11 @@ void TileMuonFitter::buildTileCosmicMuonAtZequal0(int fitok) {
       theTileCosmicMuon->SetEnergyBottom(ebot);
       theTileCosmicMuon->SetTrackCellHash(cells);
 
-      tcmContainer->push_back(theTileCosmicMuon);
-      //sc = m_storeGate->record(theTileCosmicMuon, m_tileCosmicMuonKey);
+      cosmicMuonContainer->push_back(theTileCosmicMuon);
     }
 
   }
 
-  if (evtStore()->record(tcmContainer, m_tileCosmicMuonKey).isFailure()) {
-    ATH_MSG_FATAL( "Cannot record TileCosmicMuonContainer" );
-  }
-
   if (fitok != 2) delete m_theTrack;
 }
 
@@ -1476,16 +1473,17 @@ void TileMuonFitter::buildComTimeAtYequal0(int fitok) {
   ATH_MSG_DEBUG( "Starting BuildComTime at y=0 m_linePar: "
                 << p0 << " " << p1 << " " << p2 << " " << p3 );
 
-  ComTime *theComTime;
+  SG::WriteHandle<ComTime> theComTime (m_comTimeKey);
+  StatusCode sc;
   if (!(fitok == 1) || p1 == 0.0) {
-    theComTime = new ComTime();
+    sc = theComTime.record(std::make_unique<ComTime>());
   } else {
     Hep3Vector theZeroCrossingPosition(-1.0 * p0 / p1, 0.0, p2 - 1.0 * p3 * p0 / p1);
     Hep3Vector theDirection(1.0, p1, p3);
     theDirection = theDirection.unit();
     if ((m_reg1to2 && p1 > 0.0) || (!m_reg1to2 && p1 < 0.0)) theDirection *= -1.0;
 
-    theComTime = new ComTime(0.0, ztime, theZeroCrossingPosition, theDirection);
+    sc = theComTime.record(std::make_unique<ComTime>(0.0, ztime, theZeroCrossingPosition, theDirection));
 
     if (msgLvl(MSG::DEBUG)) {
 
@@ -1500,7 +1498,7 @@ void TileMuonFitter::buildComTimeAtYequal0(int fitok) {
     }
   }
 
-  if (evtStore()->record(theComTime, m_comTimeKey).isFailure()) {
+  if (sc.isFailure()) {
     ATH_MSG_FATAL( "Cannot record ComTime" );
   }
 }
@@ -1539,16 +1537,17 @@ void TileMuonFitter::buildComTimeAtZequal0(int fitok) {
   ATH_MSG_DEBUG( "Starting BuildComTime at z=0 m_linePar: "
                 << p0 << " " << p1 << " " << p2 << " " << p3 );
 
-  ComTime* theComTime;
+  SG::WriteHandle<ComTime> theComTime (m_comTimeKey);
+  StatusCode sc;
   if (!(fitok == 1) || p3 == 0.0) {
-    theComTime = new ComTime();
+    sc = theComTime.record(std::make_unique<ComTime>());
   } else {
     Hep3Vector theZeroCrossingPosition(-1.0 * p2 / p3, p0 - 1.0 * p1 * p2 / p3, 0.0);
     Hep3Vector theDirection(1.0, p1, p3);
     theDirection = theDirection.unit();
     if ((m_reg1to2 && p3 > 0.0) || (!m_reg1to2 && p3 < 0.0)) theDirection *= -1.0;
 
-    theComTime = new ComTime(0.0, ztime, theZeroCrossingPosition, theDirection);
+    sc = theComTime.record(std::make_unique<ComTime>(0.0, ztime, theZeroCrossingPosition, theDirection));
 
     if (msgLvl(MSG::DEBUG)) {
 
@@ -1563,7 +1562,7 @@ void TileMuonFitter::buildComTimeAtZequal0(int fitok) {
     }
   }
 
-  if (evtStore()->record(theComTime, m_comTimeKey).isFailure()) {
+  if (sc.isFailure()) {
     ATH_MSG_FATAL( "Cannot record ComTime" );
   }
 }
diff --git a/TileCalorimeter/TileDetDescr/src/TileDetDescrManager.cxx b/TileCalorimeter/TileDetDescr/src/TileDetDescrManager.cxx
index fc1fe810213..0319c4d5810 100755
--- a/TileCalorimeter/TileDetDescr/src/TileDetDescrManager.cxx
+++ b/TileCalorimeter/TileDetDescr/src/TileDetDescrManager.cxx
@@ -354,7 +354,7 @@ void TileDetDescrManager::create_elements(MsgStream *log)
 	modDescr->set_depth_in(delr);
         add_module(idhash,modDescr);
         ++n_modules;
-      } catch ( TileID_Exception ) {
+      } catch ( const TileID_Exception& ) {
         (*log) << MSG::ERROR  << "can't build module ID from ("
                << section << ","
                << side << ","
@@ -839,7 +839,7 @@ void TileDetDescrManager::create_elements(MsgStream *log)
               
               add_cell(elt);
               ++n_cells;
-            } catch ( TileID_Exception ) {
+            } catch ( const TileID_Exception& ) {
               (*log) << MSG::ERROR << "can't build cell ID from ("
                      << section << "," << side << "," << module << ","
                      << tower << "," << sample << ")" << endmsg;
diff --git a/TileCalorimeter/TileIdentifier/TileIdentifier/TileHWID.h b/TileCalorimeter/TileIdentifier/TileIdentifier/TileHWID.h
index 8f1cfb16121..0aa10e42043 100755
--- a/TileCalorimeter/TileIdentifier/TileIdentifier/TileHWID.h
+++ b/TileCalorimeter/TileIdentifier/TileIdentifier/TileHWID.h
@@ -79,25 +79,25 @@ public:
   /**
    * @brief ROS HWIdentifer
    */
-  HWIdentifier        ros_id                  ( int ros)                      const throw(TileID_Exception);
+  HWIdentifier        ros_id                  ( int ros)                      const;
   /**
    * @brief ROS HWIdentifer
    */
-  HWIdentifier        drawer_id               ( int frag )                    const throw(TileID_Exception);
+  HWIdentifier        drawer_id               ( int frag )                    const;
   /**
    * @brief drawer HWIdentifer
    */
-  HWIdentifier        drawer_id               ( int ros, int drawer )         const throw(TileID_Exception);
+  HWIdentifier        drawer_id               ( int ros, int drawer )         const;
   /**
    * @brief channel HWIdentifer
    */
   HWIdentifier        channel_id              ( int ros, int drawer, 
-                                                int channel )                 const throw(TileID_Exception);
+                                                int channel )                 const;
   /**
    * @brief adc HWIdentifer
    */
   HWIdentifier        adc_id                  ( int ros, int drawer,
-                                                int channel, int adc )        const throw(TileID_Exception);
+                                                int channel, int adc )        const;
 
   /**
    * @brief extract drawer ID from adc ID or channel ID 
@@ -111,17 +111,17 @@ public:
    * @brief create channel ID from drawer ID
    */
   HWIdentifier        channel_id              ( const HWIdentifier& id,
-                                                int channel )                 const throw(TileID_Exception); 
+                                                int channel )                 const;
   /**
    * @brief create adc ID from drawer ID
    */
   HWIdentifier        adc_id                  ( const HWIdentifier& id,
-                                                int channel, int adc )        const throw(TileID_Exception); 
+                                                int channel, int adc )        const; 
   /**
    * @brief create adc ID from channel ID
    */
   HWIdentifier        adc_id                  ( const HWIdentifier& id,
-                                                int adc )                     const throw(TileID_Exception); 
+                                                int adc )                     const;
 
   /**
    * @brief create channel ID from channel hash ID
@@ -135,7 +135,7 @@ public:
    * @brief validity of the hash_id is not checked, assuming that it is done outside
    */
   HWIdentifier        adc_id                  ( IdentifierHash hash_id,
-                                                int adc )                     const throw(TileID_Exception)
+                                                int adc )                     const
     { return adc_id(m_channel_vec[hash_id],adc); }
         
 
diff --git a/TileCalorimeter/TileIdentifier/src/TileHWID.cxx b/TileCalorimeter/TileIdentifier/src/TileHWID.cxx
index 5d8aab631c5..7cb8ee98dfd 100755
--- a/TileCalorimeter/TileIdentifier/src/TileHWID.cxx
+++ b/TileCalorimeter/TileIdentifier/src/TileHWID.cxx
@@ -126,7 +126,7 @@ TileHWID::tilehw_id     ()      const
 // Build ros & drawer id
 //
 HWIdentifier
-TileHWID::ros_id       ( int ros )      const throw(TileID_Exception)
+TileHWID::ros_id       ( int ros )      const
 {
 
     HWIdentifier compactID(m_base_tile_ros);
@@ -165,7 +165,7 @@ TileHWID::ros_id       ( int ros )      const throw(TileID_Exception)
 }
 
 HWIdentifier
-TileHWID::drawer_id       ( int ros, int drawer )       const throw(TileID_Exception)
+TileHWID::drawer_id       ( int ros, int drawer )       const
 {
 
     HWIdentifier compactID(m_base_tile_ros);
@@ -205,7 +205,7 @@ TileHWID::drawer_id       ( int ros, int drawer )       const throw(TileID_Excep
 }
 
 HWIdentifier
-TileHWID::drawer_id ( int frag ) const throw(TileID_Exception)
+TileHWID::drawer_id ( int frag ) const
 {
     int ros = (frag >> 8) & 0xFF;
     int drawer = frag & 0xFF;
@@ -217,7 +217,7 @@ TileHWID::drawer_id ( int frag ) const throw(TileID_Exception)
 // Build channel & adc id
 //
 HWIdentifier
-TileHWID::channel_id ( int ros, int drawer, int channel ) const throw(TileID_Exception)
+TileHWID::channel_id ( int ros, int drawer, int channel ) const
 {
 
     HWIdentifier compactID(m_base_tile_ros);
@@ -258,7 +258,7 @@ TileHWID::channel_id ( int ros, int drawer, int channel ) const throw(TileID_Exc
 }
 
 HWIdentifier
-TileHWID::adc_id ( int ros, int drawer, int channel, int adc ) const throw(TileID_Exception)
+TileHWID::adc_id ( int ros, int drawer, int channel, int adc ) const
 {
         
     HWIdentifier compactID(m_base_tile_ros);
@@ -319,7 +319,7 @@ TileHWID::channel_id     ( const HWIdentifier & any_id )   const
 
 HWIdentifier
 TileHWID::channel_id    ( const HWIdentifier & drawer_id, 
-                          int channel )                     const throw(TileID_Exception)
+                          int channel )                     const
 {
         
     HWIdentifier compactId(drawer_id);
@@ -370,7 +370,7 @@ TileHWID::channel_id    ( const HWIdentifier & drawer_id,
 
 HWIdentifier
 TileHWID::adc_id        ( const HWIdentifier & channel_id,
-                          int adc )                     const throw(TileID_Exception)
+                          int adc )                     const
 {
         
     HWIdentifier compactId(channel_id);
@@ -421,7 +421,7 @@ TileHWID::adc_id        ( const HWIdentifier & channel_id,
 
 HWIdentifier
 TileHWID::adc_id        ( const HWIdentifier & drawer_id,
-                          int channel, int adc )                const throw(TileID_Exception)
+                          int channel, int adc )                const
 {
         
     HWIdentifier compactId(drawer_id);
diff --git a/TileCalorimeter/TileL2Algs/TileL2Algs/TileL2Builder.h b/TileCalorimeter/TileL2Algs/TileL2Algs/TileL2Builder.h
index c1e9b5afe9f..a3e33baba7c 100644
--- a/TileCalorimeter/TileL2Algs/TileL2Algs/TileL2Builder.h
+++ b/TileCalorimeter/TileL2Algs/TileL2Algs/TileL2Builder.h
@@ -19,22 +19,23 @@
 #ifndef TILEL2ALGS_TILEL2BUILDER_H
 #define TILEL2ALGS_TILEL2BUILDER_H
 
-// Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
+// Tile includes
+#include "TileEvent/TileContainer.h"
+#include "TileEvent/TileRawChannelContainer.h"
+#include "TileIdentifier/TileFragHash.h"
 
 // Athena includes
 #include "AthenaBaseComps/AthAlgTool.h"
+#include "StoreGate/ReadHandleKey.h"
 
-// Tile includes
-#include "TileEvent/TileContainer.h"
-#include "TileIdentifier/TileFragHash.h"
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
 
 // C++ STL includes
 #include <string>
 #include <vector>
 
 // forward declarations
-class TileRawChannel;
 class TileHWID;
 class TileCondToolEmscale;
 class TileCondToolNoiseRawChn;
@@ -54,7 +55,7 @@ class TileL2Builder: public AthAlgTool {
 
     virtual StatusCode finalize();
 
-    virtual StatusCode process(int fragmin, int fragmax, TileL2Container *cont);
+    virtual StatusCode process(int fragmin, int fragmax, TileL2Container *l2Container);
 
     /** Return colllection ID for a given index  */
     inline int indexToId(int i) {
@@ -175,7 +176,12 @@ class TileL2Builder: public AthAlgTool {
   protected:
 
     // properties
-    std::string m_rawChannelContainer;
+    /** TileRawChannelContainer in event store */
+    SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer",
+                                                                        "TileRawChannelCnt",
+                                                                        "Input Tile raw channel container key"};
+
+
     float m_noiseThreshold;
     int m_noiseType;
 
diff --git a/TileCalorimeter/TileL2Algs/TileL2Algs/TileMuRODToNtuple.h b/TileCalorimeter/TileL2Algs/TileL2Algs/TileMuRODToNtuple.h
index 80f901d80bb..01b9e1157cb 100755
--- a/TileCalorimeter/TileL2Algs/TileL2Algs/TileMuRODToNtuple.h
+++ b/TileCalorimeter/TileL2Algs/TileL2Algs/TileMuRODToNtuple.h
@@ -17,14 +17,19 @@
 //    
 //*****************************************************************************
 
-#ifndef TILEMUID_TILEMURODTONTUPLE_H
-#define TILEMUID_TILEMURODTONTUPLE_H
+#ifndef TILEL2ALGS_TILEMURODTONTUPLE_H
+#define TILEL2ALGS_TILEMURODTONTUPLE_H
 
-// Gaudi includes
-#include "GaudiKernel/NTuple.h"
+// Tile includes
+#include "TileEvent/TileContainer.h"
 
 // Athena includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+
+// Gaudi includes
+#include "GaudiKernel/NTuple.h"
+
 
 /**
  * @class TileMuRODToNtuple
@@ -66,6 +71,10 @@ class TileMuRODToNtuple: public AthAlgorithm {
     /** Name of TileL2Container in detector store */
     std::string m_tileL2Container;
 
+        /** TileL2Container in detector store */
+    SG::ReadHandleKey<TileL2Container> m_l2ContainerKey{this,"TileL2Container","TileL2Cnt",
+                                                        "Input Tile L2 container key"};
+
 };
 
-#endif  //TILEMUID_TILEMURODTONTUPLE_H
+#endif  //TILEL2ALGS_TILEMURODTONTUPLE_H
diff --git a/TileCalorimeter/TileL2Algs/TileL2Algs/TileRawChannelToL2.h b/TileCalorimeter/TileL2Algs/TileL2Algs/TileRawChannelToL2.h
index 545d4bcdc18..43389886032 100755
--- a/TileCalorimeter/TileL2Algs/TileL2Algs/TileRawChannelToL2.h
+++ b/TileCalorimeter/TileL2Algs/TileL2Algs/TileRawChannelToL2.h
@@ -19,11 +19,15 @@
 #ifndef TILEL2ALGS_TILERAWCHANNELTOL2_H
 #define TILEL2ALGS_TILERAWCHANNELTOL2_H
 
-// Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
+// Tile includes
+#include "TileEvent/TileContainer.h"
 
 // Athena includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
 
 // C++ STL includes
 #include <string>
@@ -62,11 +66,10 @@ class TileRawChannelToL2: public AthAlgorithm {
     /** Pointer to TileL2Builder */
     ToolHandle<TileL2Builder> m_tileL2Builder;
 
-    /** Name of TileRawChannelContainer in detector store */
-    std::string m_rawChannelContainer;
+    /** TileL2Container in detector store */
+    SG::WriteHandleKey<TileL2Container> m_l2ContainerKey{this,"TileL2Container","TileL2Cnt",
+                                                         "Output Tile L2 container key"};
 
-    /** Name of TileL2Container in detector store */
-    std::string m_l2Container;
 
 };
 
diff --git a/TileCalorimeter/TileL2Algs/python/TileL2FromRawChGetter.py b/TileCalorimeter/TileL2Algs/python/TileL2FromRawChGetter.py
index 8b10887fb62..10bdcea20c3 100755
--- a/TileCalorimeter/TileL2Algs/python/TileL2FromRawChGetter.py
+++ b/TileCalorimeter/TileL2Algs/python/TileL2FromRawChGetter.py
@@ -51,9 +51,6 @@ class TileL2FromRawChGetter ( Configured )  :
         theTileRawChannelToL2=TileRawChannelToL2()
         self._TileRawChannelToL2Handle = theTileRawChannelToL2 ;
 
-        # Configure TileRawChannelToL2 here
-        theTileRawChannelToL2.TileRawChannelContainer="TileRawChannelCnt"
-
         # sets output key  
         theTileRawChannelToL2.TileL2Container=self.outputKey()        
 
diff --git a/TileCalorimeter/TileL2Algs/src/TileL2Builder.cxx b/TileCalorimeter/TileL2Algs/src/TileL2Builder.cxx
index 1940c41e018..577d5150620 100644
--- a/TileCalorimeter/TileL2Algs/src/TileL2Builder.cxx
+++ b/TileCalorimeter/TileL2Algs/src/TileL2Builder.cxx
@@ -17,20 +17,12 @@
 //
 //*****************************************************************************
 
-// Gaudi incldes
-#include "GaudiKernel/ServiceHandle.h"
-
-// Athena includes
-#include "AthenaKernel/errorcheck.h"
-
 // Tile includes
+#include "TileL2Algs/TileL2Builder.h"
 #include "TileEvent/TileL2.h"
 #include "TileEvent/TileRawChannel.h"
-#include "TileEvent/TileRawChannelContainer.h"
 #include "TileIdentifier/TileRawChannelUnit.h"
 #include "TileIdentifier/TileHWID.h"
-#include "CaloIdentifier/TileTBID.h"
-#include "CaloIdentifier/TileID.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileConditions/TileCondToolNoiseRawChn.h"
@@ -38,8 +30,19 @@
 #include "TileConditions/TileCablingSvc.h"
 #include "TileConditions/ITileBadChanTool.h"
 #include "TileDetDescr/TileDetDescrManager.h"
+
+// Calo includes
 #include "CaloDetDescr/CaloDetDescrElement.h"
-#include "TileL2Algs/TileL2Builder.h"
+#include "CaloIdentifier/TileTBID.h"
+#include "CaloIdentifier/TileID.h"
+
+// Athena includes
+#include "AthenaKernel/errorcheck.h"
+#include "StoreGate/ReadHandle.h"
+
+// Gaudi incldes
+#include "GaudiKernel/ServiceHandle.h"
+
 
 static const InterfaceID IID_ITileL2Builder("TileL2Builder", 1, 0);
 
@@ -50,7 +53,6 @@ const InterfaceID& TileL2Builder::interfaceID() {
 TileL2Builder::TileL2Builder(const std::string& type, const std::string& name,
     const IInterface* parent)
     : AthAlgTool(type, name, parent)
-  , m_rawChannelContainer("TileRawChannelCnt")
   , m_noiseThreshold(100.0) // 100 MeV universal cut for now
   , m_noiseType(9999)       // this huge value means that noise cut is taken from JO
   , m_tileHWID(0)
@@ -61,7 +63,6 @@ TileL2Builder::TileL2Builder(const std::string& type, const std::string& name,
 
   declareInterface<TileL2Builder>(this);
 
-  declareProperty("TileRawChannelContainer", m_rawChannelContainer);  // Raw channels to convert.
   declareProperty("NoiseThreshold", m_noiseThreshold);       // use channels only above noise cut
   declareProperty("Noise", m_noiseType);            // choose between electronic or total noise
   declareProperty("TileCondToolEmscale", m_tileToolEmscale);      // Name of calibration tool
@@ -165,16 +166,18 @@ StatusCode TileL2Builder::initialize() {
     }
   }
 
+  ATH_CHECK( m_rawChannelContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileL2Builder initialization completed" );
 
   return StatusCode::SUCCESS;
 }
 
-StatusCode TileL2Builder::process(int fragmin, int fragmax, TileL2Container *cont) {
+StatusCode TileL2Builder::process(int fragmin, int fragmax, TileL2Container *l2Container) {
 
   // Get TileRawChannels
-  const TileRawChannelContainer* rawChannels;
-  CHECK( evtStore()->retrieve(rawChannels, m_rawChannelContainer) );
+  SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
+  ATH_CHECK( rawChannelContainer.isValid() );
 
   std::vector<unsigned int> extraWord;
   std::vector<float> EtaMuons;
@@ -188,18 +191,15 @@ StatusCode TileL2Builder::process(int fragmin, int fragmax, TileL2Container *con
   bool bad[48];
   int gain[48];
 
-  TileRawChannelUnit::UNIT rChUnit = rawChannels->get_unit();
+  TileRawChannelUnit::UNIT rChUnit = rawChannelContainer->get_unit();
   bool dspCont = (rChUnit >= TileRawChannelUnit::OnlineOffset);
   bool recalibrate = (rChUnit != TileRawChannelUnit::MegaElectronVolts
                       && rChUnit != TileRawChannelUnit::OnlineMegaElectronVolts);
 
   // iterate over all collections in a container
-  TileRawChannelContainer::const_iterator collItr = rawChannels->begin();
-  TileRawChannelContainer::const_iterator lastColl = rawChannels->end();
+  for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
 
-  for (; collItr != lastColl; ++collItr) {
-
-    HWIdentifier drawer_id = m_tileHWID->drawer_id((*collItr)->identify());
+    HWIdentifier drawer_id = m_tileHWID->drawer_id(rawChannelCollection->identify());
     int ros = m_tileHWID->ros(drawer_id);
     int drawer = m_tileHWID->drawer(drawer_id);
     int fragId = m_tileHWID->frag(ros, drawer);
@@ -214,15 +214,11 @@ StatusCode TileL2Builder::process(int fragmin, int fragmax, TileL2Container *con
       memset(gain, -1, sizeof(gain));
 
       // iterate over all raw channels in a collection
-      TileRawChannelCollection::const_iterator rawItr = (*collItr)->begin();
-      TileRawChannelCollection::const_iterator lastRaw = (*collItr)->end();
-
-      for (; rawItr != lastRaw; ++rawItr) {
-        const TileRawChannel * pChannel = (*rawItr);
-        HWIdentifier adc_id = (*rawItr)->adc_HWID();
+      for (const TileRawChannel* rawChannel : *rawChannelCollection) {
+        HWIdentifier adc_id = rawChannel->adc_HWID();
         int channel = m_tileHWID->channel(adc_id);
         int adc = m_tileHWID->adc(adc_id);
-        float ampl = pChannel->amplitude();
+        float ampl = rawChannel->amplitude();
         if (recalibrate) {
           E_MeV[channel] = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc, ampl, rChUnit
                                                           , TileRawChannelUnit::MegaElectronVolts);
@@ -230,7 +226,7 @@ StatusCode TileL2Builder::process(int fragmin, int fragmax, TileL2Container *con
           E_MeV[channel] = ampl; // no conversion since energy is in MeV already
         }
         if (dspCont) {
-          bad[channel] = pChannel->quality() > 15.99;
+          bad[channel] = rawChannel->quality() > 15.99;
         } else {
           bad[channel] = m_tileBadChanTool->getAdcStatus(drawerIdx, channel, adc).isBad();
         }
@@ -242,7 +238,7 @@ StatusCode TileL2Builder::process(int fragmin, int fragmax, TileL2Container *con
 
       // MET
       SumE(ros, drawer, TileRawChannelUnit::MegaElectronVolts, E_MeV, gain, sumE);
-      (*cont)[m_hashFunc(fragId)]->setEt(sumE);
+      (*l2Container)[m_hashFunc(fragId)]->setEt(sumE);
 
       // MTag
 
@@ -272,7 +268,7 @@ StatusCode TileL2Builder::process(int fragmin, int fragmax, TileL2Container *con
       }
 
       if (EtaMuons.size())
-        (*cont)[m_hashFunc(fragId)]->setMu(EtaMuons, EMuons0, EMuons1, EMuons2, qf, extraWord);
+        (*l2Container)[m_hashFunc(fragId)]->setMu(EtaMuons, EMuons0, EMuons1, EMuons2, qf, extraWord);
 
     } // end loop over collections
 
diff --git a/TileCalorimeter/TileL2Algs/src/TileMuRODToNtuple.cxx b/TileCalorimeter/TileL2Algs/src/TileMuRODToNtuple.cxx
index b38ae5ba2b6..3488b323d49 100755
--- a/TileCalorimeter/TileL2Algs/src/TileMuRODToNtuple.cxx
+++ b/TileCalorimeter/TileL2Algs/src/TileMuRODToNtuple.cxx
@@ -17,19 +17,18 @@
 //    
 //*****************************************************************************
 
+// Tile includes
+#include "TileL2Algs/TileMuRODToNtuple.h"
+
+// Athena includes
+#include "AthenaKernel/errorcheck.h"
+#include "StoreGate/ReadHandle.h"
+
 // Gaudi includes
-#include "GaudiKernel/Bootstrap.h"
 #include "GaudiKernel/INTupleSvc.h"
 #include "GaudiKernel/IDataProviderSvc.h"
 #include "GaudiKernel/SmartDataPtr.h"
 
-// Athena includes
-#include "AthenaKernel/errorcheck.h"
-
-// Tile includes
-#include "TileEvent/TileContainer.h"
-#include "TileEvent/TileDigitsContainer.h"
-#include "TileL2Algs/TileMuRODToNtuple.h"
 
 TileMuRODToNtuple::TileMuRODToNtuple(std::string name, ISvcLocator* pSvcLocator)
     : AthAlgorithm(name, pSvcLocator)
@@ -38,9 +37,7 @@ TileMuRODToNtuple::TileMuRODToNtuple(std::string name, ISvcLocator* pSvcLocator)
   , m_maxNMuons(50)
   , m_close(1)
   , m_ntupleLoc("/FILE1/TileMuRODTag")
-  , m_tileL2Container("TileL2Cnt")
 {
-  declareProperty("TileMuRODTagsOutputName", m_tileL2Container);
   declareProperty("NTupleLoc", m_ntupleLoc);
   declareProperty("NTupleID", m_ntupleID);
   declareProperty("MaxNMuons", m_maxNMuons);
@@ -74,6 +71,8 @@ StatusCode TileMuRODToNtuple::initialize() {
   CHECK(m_ntuplePtr->addItem("TileMuROD/EtaMuons", m_ntag, m_eta, -1.5, 1.5));
   CHECK(m_ntuplePtr->addItem("TileMuROD/PhiMuons", m_ntag, m_phi, 0., 6.3));
 
+  ATH_CHECK( m_l2ContainerKey.initialize() );
+
   ATH_MSG_INFO( "Initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -82,18 +81,14 @@ StatusCode TileMuRODToNtuple::initialize() {
 StatusCode TileMuRODToNtuple::execute() {
 
   // step1: read from TDS
-  const TileL2Container* mutags_ROD;
-  CHECK( evtStore()->retrieve(mutags_ROD, m_tileL2Container) );
-
-  TileL2Container::const_iterator it = mutags_ROD->begin();
-  TileL2Container::const_iterator end = mutags_ROD->end();
+  SG::ReadHandle<TileL2Container> l2Container(m_l2ContainerKey);
+  ATH_CHECK( l2Container.isValid() );
 
   m_ntag = 0;
-
-  for (; it != end; ++it) {
-    for (unsigned int a = 0; a < ((*it)->NMuons()); ++a) {
-      m_eta[m_ntag] = ((*it)->eta(a));
-      m_phi[m_ntag] = ((*it)->phi(a));
+  for (const TileL2* l2 : *l2Container) {
+    for (unsigned int a = 0; a < l2->NMuons(); ++a) {
+      m_eta[m_ntag] = l2->eta(a);
+      m_phi[m_ntag] = l2->phi(a);
       m_ntag++;
     }
     if (m_ntag >= m_maxNMuons) break;
diff --git a/TileCalorimeter/TileL2Algs/src/TileRawChannelToL2.cxx b/TileCalorimeter/TileL2Algs/src/TileRawChannelToL2.cxx
index b28644cc9fd..bf43747f005 100755
--- a/TileCalorimeter/TileL2Algs/src/TileRawChannelToL2.cxx
+++ b/TileCalorimeter/TileL2Algs/src/TileRawChannelToL2.cxx
@@ -24,26 +24,22 @@
 //
 //*****************************************************************************
 
-// Gaudi includes
-#include "GaudiKernel/IToolSvc.h"
+// Tile includes
+#include "TileL2Algs/TileRawChannelToL2.h"
+#include "TileEvent/TileL2.h"
+#include "TileL2Algs/TileL2Builder.h"
 
 // Athena includes
 #include "AthenaKernel/errorcheck.h"
+#include "StoreGate/WriteHandle.h"
 
-// Tile includes
-#include "TileEvent/TileContainer.h"
-#include "TileEvent/TileL2.h"
-#include "TileL2Algs/TileRawChannelToL2.h"
-#include "TileL2Algs/TileL2Builder.h"
+
+#include <memory>
 
 TileRawChannelToL2::TileRawChannelToL2(const std::string& name, ISvcLocator* pSvcLocator)
     : AthAlgorithm(name, pSvcLocator)
   , m_tileL2Builder("TileL2Builder")
-  , m_rawChannelContainer("TileRawChannelCnt")
-  , m_l2Container("TileL2Cnt")
 {
-  declareProperty("TileRawChannelContainer", m_rawChannelContainer);  // Raw channels to convert.
-  declareProperty("TileL2Container", m_l2Container);                  // Name of output container
 }
 
 TileRawChannelToL2::~TileRawChannelToL2() {
@@ -53,6 +49,8 @@ StatusCode TileRawChannelToL2::initialize() {
 
   CHECK( m_tileL2Builder.retrieve() );
 
+  ATH_CHECK( m_l2ContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileRawChannelToL2 initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -60,63 +58,50 @@ StatusCode TileRawChannelToL2::initialize() {
 
 StatusCode TileRawChannelToL2::execute() {
 
-  if (evtStore()->contains < TileL2Container > (m_l2Container)) {
-    ATH_MSG_DEBUG( m_l2Container << " already exists" );
-    return StatusCode::SUCCESS;
-  }
+  SG::WriteHandle<TileL2Container> l2Container(m_l2ContainerKey);
+  ATH_CHECK( l2Container.record(std::make_unique<TileL2Container>()) );
+
+  ATH_MSG_VERBOSE( "TileL2 container registered to the TES with name " << m_l2ContainerKey.key() );
 
-  TileL2Container* cont = new TileL2Container;
-  cont->reserve(256);
+  l2Container->reserve(256);
   for (int i = 0; i < 256; i++) {
     int collId = m_tileL2Builder->indexToId(i);
-    TileL2* l2 = new TileL2(collId);
-    cont->push_back(l2);
+    std::unique_ptr<TileL2> l2 = std::make_unique<TileL2>(collId);
+    l2Container->push_back(l2.release());
   }
 
   // TileL2Builder is called
-  if (m_tileL2Builder->process(0, 0xFFFF, cont).isFailure()) {
-    ATH_MSG_ERROR( "Could not call TileL2Builder" );
-    cont->clear();
-    delete cont;
-    return StatusCode::FAILURE;
-  }
-
-  // Register the set of TileL2 to the event store
-  CHECK( evtStore()->record(cont, m_l2Container, false) );
-
+  CHECK( m_tileL2Builder->process(0, 0xFFFF, l2Container.ptr()) );
 
   // Debug
-//
-//  if (msgLvl(MSG::DEBUG)) {
-//    TileL2Container::const_iterator ind = cont->begin();
-//    TileL2Container::const_iterator lastpippo = cont->end();
-//
-//    for (; ind != lastpippo; ++ind) {
-//
-//      msg(MSG::DEBUG) << "frag ID = 0x" << MSG::hex << ((*ind)->identify()) << MSG::dec
-//                      << "  phi = " << ((*ind)->phi(0))
-//                      << "  Et = " << ((*ind)->Et())
-//                      << "  word = 0x" << MSG::hex << ((*ind)->val(0)) << MSG::dec << endmsg;
-//
-//      for (unsigned int i = 0; i < ((*ind)->NMuons()); ++i) {
-//        msg(MSG::DEBUG) << "Muon found:"
-//                        << " frag ID = 0x" << MSG::hex << ((*ind)->identify()) << MSG::dec
-//                        << " word1 = 0x" << MSG::hex << ((*ind)->val(1 + 2 * i)) << MSG::dec
-//                        << " word2 = 0x" << MSG::hex << ((*ind)->val(2 + 2 * i)) << MSG::dec
-//                        << " eta = " << ((*ind)->eta(i))
-//                        << " phi = " << ((*ind)->phi(i)) << endmsg;
-//
-//        msg(MSG::DEBUG) << "Muon found:"
-//                        << " E[0] = " << ((*ind)->enemu0(i)) << " MeV"
-//                        << " E[1] = " << ((*ind)->enemu1(i)) << " MeV"
-//                        << " E[2] = " << ((*ind)->enemu2(i)) << " MeV"
-//                        << " QF = " << ((*ind)->qual(i)) << endmsg;
-//
-//      }
-//    }
-//  }
+  if (msgLvl(MSG::VERBOSE)) {
+
+    for (const TileL2* l2 : *l2Container) {
+
+      msg(MSG::VERBOSE) << "frag ID = 0x" << MSG::hex << l2->identify() << MSG::dec
+                      << "  phi = " << l2->phi(0)
+                      << "  Et = " << l2->Et()
+                      << "  word = 0x" << MSG::hex << l2->val(0) << MSG::dec << endmsg;
+
+      for (unsigned int i = 0; i < l2->NMuons(); ++i) {
+        msg(MSG::VERBOSE) << "Muon found:"
+                        << " frag ID = 0x" << MSG::hex << l2->identify() << MSG::dec
+                        << " word1 = 0x" << MSG::hex << l2->val(1 + 2 * i) << MSG::dec
+                        << " word2 = 0x" << MSG::hex << l2->val(2 + 2 * i) << MSG::dec
+                        << " eta = " << l2->eta(i)
+                        << " phi = " << l2->phi(i) << endmsg;
+
+        msg(MSG::VERBOSE) << "Muon found:"
+                        << " E[0] = " << l2->enemu0(i) << " MeV"
+                        << " E[1] = " << l2->enemu1(i) << " MeV"
+                        << " E[2] = " << l2->enemu2(i) << " MeV"
+                        << " QF = " << l2->qual(i) << endmsg;
+
+      }
+    }
+  }
+
 
-  ATH_MSG_VERBOSE( "TileL2 container registered to the TES with name " << m_l2Container );
 
   // Execution completed
   ATH_MSG_DEBUG( "TileRawChannelToL2 execution completed" );
diff --git a/TileCalorimeter/TileMuId/TileMuId/TileLookForMuAlg.h b/TileCalorimeter/TileMuId/TileMuId/TileLookForMuAlg.h
index a071ead4dbc..cc66d828836 100755
--- a/TileCalorimeter/TileMuId/TileMuId/TileLookForMuAlg.h
+++ b/TileCalorimeter/TileMuId/TileMuId/TileLookForMuAlg.h
@@ -22,8 +22,16 @@
 #ifndef  TILEMUID_TILELOOKFORMUALG_H
 #define  TILEMUID_TILELOOKFORMUALG_H 
 
-// includes 
+// Tile includes
+#include "TileEvent/TileContainer.h"
+
+// Calo includes
+#include "CaloEvent/CaloCellContainer.h"
+
+// Athena includes 
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
 // C++ STL includes
 #include  <vector> 
@@ -73,9 +81,15 @@ class TileLookForMuAlg: public AthAlgorithm {
     std::vector<double> m_hiThrD;
     std::vector<double> m_hiThrBC;
     std::vector<double> m_hiThrA;
-    std::string m_cellContainer; // Cell container names 
-    std::string m_tileTagContainer;
-//std::string m_CellCollName;
+
+    SG::ReadHandleKey<CaloCellContainer> m_cellContainerKey{this,"CellsNames",
+                                                            "AllCalo",
+                                                            "Input Calo cell container key"};
+
+    SG::WriteHandleKey<TileMuContainer> m_muContainerKey{this,"TileMuTagsOutputName",
+                                                         "TileMuObj",
+                                                         "Output Tile mu container key"};
+
 
 };
 #endif // TILEMUID_TILELOOKFORMUALG_H
diff --git a/TileCalorimeter/TileMuId/TileMuId/TileMuToNtuple.h b/TileCalorimeter/TileMuId/TileMuId/TileMuToNtuple.h
index 89ac9bc083c..c7daaca12ea 100755
--- a/TileCalorimeter/TileMuId/TileMuId/TileMuToNtuple.h
+++ b/TileCalorimeter/TileMuId/TileMuId/TileMuToNtuple.h
@@ -17,11 +17,16 @@
 #ifndef TILEMUID_TILEMUTONTUPLE_H
 #define TILEMUID_TILEMUTONTUPLE_H
 
-// Gaudi includes
-#include "GaudiKernel/NTuple.h"
+// Tile includes
+#include "TileEvent/TileContainer.h"
 
 // Athena includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+
+// Gaudi includes
+#include "GaudiKernel/NTuple.h"
+
 
 #include <string>
 
@@ -55,6 +60,10 @@ class TileMuToNtuple: public AthAlgorithm {
 
     std::string m_tileMuContainer;
 
+    SG::ReadHandleKey<TileMuContainer> m_muContainerKey{this,"TileMuContainer",
+                                                        "TileMuObj",
+                                                        "Input Tile mu container key"};
+
 };
 
 #endif
diff --git a/TileCalorimeter/TileMuId/src/TileLookForMuAlg.cxx b/TileCalorimeter/TileMuId/src/TileLookForMuAlg.cxx
index 118f9331344..227e93dcae7 100755
--- a/TileCalorimeter/TileMuId/src/TileLookForMuAlg.cxx
+++ b/TileCalorimeter/TileMuId/src/TileLookForMuAlg.cxx
@@ -7,19 +7,23 @@
 // Author   : G Usai
 // Created  : June 2003 
 //***************************************************************************
-//Library Includes
-#include <algorithm>
-#include <cmath>
-// Athena includes
-#include "AthenaKernel/errorcheck.h"
+
+// Tile includes
+#include "TileMuId/TileLookForMuAlg.h"
+#include "TileEvent/TileCell.h"
+
 // Calo includes
-#include "CaloEvent/CaloCellContainer.h"
 #include "CaloIdentifier/TileID.h"
 #include "CaloIdentifier/CaloCell_ID.h"
-// Tile includes
-#include "TileEvent/TileCell.h"
-#include "TileEvent/TileMuContainer.h"
-#include "TileMuId/TileLookForMuAlg.h"
+
+// Athena includes
+#include "AthenaKernel/errorcheck.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+
+//Library Includes
+#include <algorithm>
+#include <cmath>
 
 TileLookForMuAlg::TileLookForMuAlg(const std::string& name,
     ISvcLocator* pSvcLocator) 
@@ -30,8 +34,6 @@ TileLookForMuAlg::TileLookForMuAlg(const std::string& name,
   , m_etaA()
   , m_nMuMax(30)
 {
-  declareProperty("CellsNames", m_cellContainer);
-  declareProperty("TileMuTagsOutputName", m_tileTagContainer);
   declareProperty("LowerTresh0MeV", m_loThrA=80.0);
   declareProperty("LowerTresh1MeV", m_loThrBC=80.0);
   declareProperty("LowerTresh2MeV", m_loThrD=80.0);
@@ -41,7 +43,7 @@ TileLookForMuAlg::TileLookForMuAlg(const std::string& name,
   declareProperty("UpperTresh0MeV", m_hiThrA);
   declareProperty("From3to2", m_fromDtoBC);
   declareProperty("From2to1", m_fromBCtoA);
-  return;
+
 }
 
 TileLookForMuAlg::~TileLookForMuAlg() {
@@ -86,6 +88,10 @@ StatusCode TileLookForMuAlg::initialize() {
     }
   }
 
+
+  ATH_CHECK( m_cellContainerKey.initialize() );
+  ATH_CHECK( m_muContainerKey.initialize() );
+
   ATH_MSG_DEBUG("TileLookForMuAlg initialization completed");
 
   return StatusCode::SUCCESS;
@@ -95,6 +101,9 @@ StatusCode TileLookForMuAlg::initialize() {
 //Execution                                                                     /
 /////////////////////////////////////////////////////////////////////////////////
 StatusCode TileLookForMuAlg::execute() {
+
+  ATH_MSG_DEBUG("TileLookForMuAlg execution  started");
+
   double eneA[N_CELLS_A][N_MODULES]; // calorimeter cell matrices  
   double eneBC[N_CELLS_BC][N_MODULES];
   double eneD[N_CELLS_D][N_MODULES];
@@ -103,28 +112,24 @@ StatusCode TileLookForMuAlg::execute() {
   memset(eneBC, 0, sizeof(eneBC));
   memset(eneD, 0, sizeof(eneD));
 
-  TileMuContainer* muons = new TileMuContainer; //muon tag container
+  SG::WriteHandle<TileMuContainer> muContainer(m_muContainerKey);
+  ATH_CHECK( muContainer.record(std::make_unique<TileMuContainer>()) );
 
-  ATH_MSG_DEBUG("TileLookForMuAlg execution  started");
 
   //  Get CaloCell  Container
-
   std::vector<const CaloCell*> cellList;
-  const CaloCellContainer* cell_container;
 
-  if (evtStore()->retrieve(cell_container, m_cellContainer).isFailure()) {
-    ATH_MSG_WARNING("Unable to retrieve the   " << m_cellContainer);
-    return StatusCode::SUCCESS;
-  }
+  SG::ReadHandle<CaloCellContainer> cellContainer(m_cellContainerKey);
+  ATH_CHECK( cellContainer.isValid() );
 
   CaloCell_ID::SUBCALO tileCell_ID = CaloCell_ID::TILE;
   CaloCellContainer::const_iterator currentCell =
-      cell_container->beginConstCalo(tileCell_ID);
+      cellContainer->beginConstCalo(tileCell_ID);
   CaloCellContainer::const_iterator lastCell = 
-      cell_container->endConstCalo(tileCell_ID);
+      cellContainer->endConstCalo(tileCell_ID);
 
   ATH_MSG_DEBUG( "Calo Container size "
-                << cell_container->nCellsCalo(tileCell_ID));
+                << cellContainer->nCellsCalo(tileCell_ID));
 
   double phi[64] = { 0 };
 //  TileID::SAMPLE cellSample;
@@ -363,10 +368,11 @@ StatusCode TileLookForMuAlg::execute() {
                 }
 
                 muEnergy.push_back(eneAround);
+                std::unique_ptr<TileMu> muon = std::make_unique<TileMu>((float) muEta, 
+                                                                        (float) muPhi, 
+                                                                        muEnergy, 
+                                                                        muQuality);
 
-                TileMu* muon = new TileMu((float) muEta, (float) muPhi,
-                    muEnergy, muQuality);
-                muons->push_back(muon);
                 ATH_MSG_VERBOSE( "muon tag eta=" << muon->eta()
                                 << " muon tag phi=" << muon->phi()
                                 << " energydepVec[0]=" << muon->enedep()[0]
@@ -376,6 +382,7 @@ StatusCode TileLookForMuAlg::execute() {
                                 << " muon tag Q factor=" << muon->quality()
                                 << " ene around= " << eneAround);
 
+                muContainer->push_back(muon.release());
               }
 
             } else {
@@ -411,24 +418,19 @@ StatusCode TileLookForMuAlg::execute() {
   //debug--------------------------------------------------- 
   // check the mu tag container  
   if (msgLvl(MSG::DEBUG)) {
-    TileMuContainer::const_iterator ind = muons->begin();
-    TileMuContainer::const_iterator lastpippo = muons->end();
-    for (; ind != lastpippo; ++ind) {
-      msg(MSG::DEBUG) << "Container name = " << m_tileTagContainer
-                      << "  eta = " << (*ind)->eta()
-                      << "  phi = " << (*ind)->phi()
-                      << "  enedep[0] = " << ((*ind)->enedep())[0]
-                      << "  enedep[1] = " << ((*ind)->enedep())[1]
-                      << "  enedep[2] = " << ((*ind)->enedep())[2]
-                      << "  enedep[3] = " << ((*ind)->enedep())[3]
-                      << "  quality = " << (*ind)->quality() << endmsg;
+    for (const TileMu* mu : *muContainer) {
+      msg(MSG::DEBUG) << "Container name = " << m_muContainerKey.key()
+                      << "  eta = " << mu->eta()
+                      << "  phi = " << mu->phi()
+                      << "  enedep[0] = " << (mu->enedep())[0]
+                      << "  enedep[1] = " << (mu->enedep())[1]
+                      << "  enedep[2] = " << (mu->enedep())[2]
+                      << "  enedep[3] = " << (mu->enedep())[3]
+                      << "  quality = " << mu->quality() << endmsg;
     }
   }
   //-------------------debug-------------------------
 
-  //store the muon tags container  on the  TDS 
-  CHECK( evtStore()->record(muons, m_tileTagContainer, false) );
-
   return StatusCode::SUCCESS;
 }
 
diff --git a/TileCalorimeter/TileMuId/src/TileMuToNtuple.cxx b/TileCalorimeter/TileMuId/src/TileMuToNtuple.cxx
index 289c849b256..866c897f23a 100755
--- a/TileCalorimeter/TileMuId/src/TileMuToNtuple.cxx
+++ b/TileCalorimeter/TileMuId/src/TileMuToNtuple.cxx
@@ -6,6 +6,12 @@
 //  Filename : TileMuToNtuple.cxx
 //*****************************************************************************
 
+//Tile includes
+#include "TileMuId/TileMuToNtuple.h"
+
+// Athena incldues
+#include "StoreGate/ReadHandle.h"
+
 //Gaudi Includes
 #include "GaudiKernel/Bootstrap.h"
 #include "GaudiKernel/INTupleSvc.h"
@@ -13,11 +19,6 @@
 #include "GaudiKernel/IDataProviderSvc.h"
 #include "GaudiKernel/SmartDataPtr.h"
 
-//TileCalo include
-#include "TileEvent/TileMuContainer.h"
-#include "TileMuId/TileMuToNtuple.h"
-
-//const int max_ntag=50;
 
 // Constructor & deconstructor
 TileMuToNtuple::TileMuToNtuple(std::string name, ISvcLocator* pSvcLocator)
@@ -30,7 +31,6 @@ TileMuToNtuple::TileMuToNtuple(std::string name, ISvcLocator* pSvcLocator)
   , m_tileMuContainer("TileMuObj")
 {
 
-  declareProperty("TileMuTagsOutputName", m_tileMuContainer);
   declareProperty("NTupleLoc", m_ntupleLoc);
   declareProperty("NTupleID", m_ntupleID);
   declareProperty("MaxNtag", m_maxNtag);
@@ -66,6 +66,8 @@ StatusCode TileMuToNtuple::initialize() {
   CHECK( m_ntuplePtr->addItem("TileMu/energydepVec", m_ntag, m_energy, 4) );
   CHECK( m_ntuplePtr->addItem("TileMu/quality", m_ntag, m_quality, 0., 1.) );
 
+  ATH_CHECK( m_muContainerKey.initialize() );
+
   ATH_MSG_INFO( "initialisation completed" );
 
   return StatusCode::SUCCESS;
@@ -74,24 +76,21 @@ StatusCode TileMuToNtuple::initialize() {
 StatusCode TileMuToNtuple::execute() {
 
   // step1: read  from TDS
-  const TileMuContainer* mutags_cont;
-  CHECK( evtStore()->retrieve(mutags_cont, m_tileMuContainer) );
+  SG::ReadHandle<TileMuContainer> muContainer(m_muContainerKey);
+  ATH_CHECK( muContainer.isValid() );
 
-  TileMuContainer::const_iterator it = mutags_cont->begin();
-  TileMuContainer::const_iterator end = mutags_cont->end();
   m_ntag = 0;
-  for (; it != end; ++it) {
-    m_eta[m_ntag] = (*it)->eta();
-    //   std::vector<double> ene;
-    // ene.reserve(4);
-    // ene.push_back( ((*it)->enedep()) [0]);
-
-    m_energy[m_ntag][0] = ((*it)->enedep())[0];
-    m_energy[m_ntag][1] = ((*it)->enedep())[1];
-    m_energy[m_ntag][2] = ((*it)->enedep())[2];
-    m_energy[m_ntag][3] = ((*it)->enedep())[3];
-    m_phi[m_ntag] = (*it)->phi();
-    m_quality[m_ntag] = (*it)->quality();
+
+  for (const TileMu* mu : *muContainer) {
+
+    m_eta[m_ntag] = mu->eta();
+
+    m_energy[m_ntag][0] = (mu->enedep())[0];
+    m_energy[m_ntag][1] = (mu->enedep())[1];
+    m_energy[m_ntag][2] = (mu->enedep())[2];
+    m_energy[m_ntag][3] = (mu->enedep())[3];
+    m_phi[m_ntag] = mu->phi();
+    m_quality[m_ntag] = mu->quality();
     m_ntag++;
 
     if (m_ntag >= m_maxNtag) break;
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/MBTSTimeDiffEventInfoAlg.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/MBTSTimeDiffEventInfoAlg.h
index 4237f3c5408..3fbead6bab7 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/MBTSTimeDiffEventInfoAlg.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/MBTSTimeDiffEventInfoAlg.h
@@ -5,7 +5,14 @@
 #ifndef MBTSTIMEDIFFEVENTINFOALG
 #define MBTSTIMEDIFFEVENTINFOALG
 
+// Tile includes
+#include "TileEvent/TileContainer.h"
+#include "TileEvent/MBTSCollisionTime.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
 class TileTBID;
 
@@ -30,7 +37,10 @@ class MBTSTimeDiffEventInfoAlg: public AthAlgorithm {
     unsigned m_minhitsperside;
     float m_mbts_threshold;
     const TileTBID* m_tileTBID;
-    std::string m_mbtsContainerName;
+
+    SG::ReadHandleKey<TileCellContainer> m_mbtsContainerKey{this,"MBTSContainer","MBTSContainer","Input MBTS container key"};
+    SG::WriteHandleKey<MBTSCollisionTime> m_mbtsCollisionTimeKey{this,"MBTSCollisionTime","MBTSCollisionTime","Output MBTS collision time key"};
+
     const uint8_t m_mask, m_pattern;
 };
 
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileBeamElemToCell.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileBeamElemToCell.h
index 677588023a9..cd83a6174c9 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileBeamElemToCell.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileBeamElemToCell.h
@@ -42,7 +42,17 @@
 #ifndef TILERECALGS_TILEBEAMELEMTOCELL_H
 #define TILERECALGS_TILEBEAMELEMTOCELL_H
 
+// Tile includes
+#include "TileEvent/TileBeamElemContainer.h"
+
+// Calo includes
+#include "CaloEvent/CaloCellContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
 
 // Avoid pushing dependencies into clients- just fwd declare the following:
 
@@ -70,8 +80,15 @@ class TileBeamElemToCell: public AthAlgorithm {
     StatusCode finalize();
 
   private:
-    std::string m_beamElemContainer;
-    std::string m_cellContainer;
+
+    SG::ReadHandleKey<TileBeamElemContainer> m_beamElemContainerKey{this,"TileBeamElemContainer",
+                                                                     "TileBeamElemCnt",
+                                                                     "Input Tile beam elements container key"};
+
+    SG::WriteHandleKey<CaloCellContainer> m_cellContainerKey{this,"TileTBCellContainer",
+                                                             "TileTBCellCnt", "Output Calo cell container key"};
+
+
     std::string m_infoName;
 
     const TileTBID* m_tileTBID;
@@ -83,7 +100,7 @@ class TileBeamElemToCell: public AthAlgorithm {
 
 // Compute calibrated energy, time, etc. for TileCell and adjust it.
     void correctCell(TileCell* pCell, int correction, int pmt, int gain,
-        double ener, double time, double qual);
+                       double ener, double time, double qual);
 };
 
 #endif // TILERECALGS_TILEBEAMELEMTOCELL_H
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellSelector.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellSelector.h
index cc426bde35d..1da159d2333 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellSelector.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellSelector.h
@@ -4,11 +4,26 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef TileRecAlgs_TileCellSelector_H
-#define TileRecAlgs_TileCellSelector_H
+#ifndef TILERECALGS_TILESELECTOR_H
+#define TILERECALGS_TILESELECTOR_H
 
-#include "GaudiKernel/ToolHandle.h"
+// Tile includes
+#include "TileEvent/TileDigitsContainer.h"
+#include "TileEvent/TileRawChannelContainer.h"
+
+// Calo includes
+#include "CaloEvent/CaloCellContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "xAODEventInfo/EventInfo.h"
+
+// Gaudi incldues
+#include "GaudiKernel/ToolHandle.h"
+
+#include <string>
+#include <vector>
 
 class TileID;
 class TileHWID;
@@ -18,8 +33,6 @@ class ITileBadChanTool;
 class TileDCSSvc;
 class TileBeamInfoProvider;
 
-#include <string>
-#include <vector>
 
 /////////////////////////////////////////////////////////////////////////////
 
@@ -89,6 +102,20 @@ class TileCellSelector: public AthAlgorithm {
     std::string m_cellsContName;
     std::string m_digitsContName;
     std::string m_rchContName;
+
+    SG::ReadHandleKey<CaloCellContainer> m_cellContainerKey{this,"CellContainerName",
+                                                            "AllCalo", "Input Calo cell container key"};
+
+    SG::ReadHandleKey<TileDigitsContainer> m_digitsContainerKey{this,"DigitsContainerName",
+                                                               "TileDigitsFlt", "Input Tile digits container key"};
+
+    SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"RawChannelContainerName",
+                                                                        "TileRawChannelCnt", 
+                                                                        "Input Tile raw channel container key"};
+
+    SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this,"EventInfo",
+                                                      "EventInfo", "Input event info key"};
+
     float m_minEneCell;
     float m_maxEneCell;
     float m_minEneChan[3];
@@ -132,4 +159,4 @@ class TileCellSelector: public AthAlgorithm {
     std::vector<int> m_nDrawerOff;
 };
 
-#endif //
+#endif // TILERECALGS_TILESELECTOR_H
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellToTTL1.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellToTTL1.h
index 1e8430e5fc9..61a99b41500 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellToTTL1.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellToTTL1.h
@@ -27,8 +27,20 @@
 #ifndef TILERECALGS_TILECELLTOTTL1_H
 #define TILERECALGS_TILECELLTOTTL1_H
 
-#include "GaudiKernel/ToolHandle.h"
+// Tile includes
+#include "TileEvent/TileDigitsContainer.h"
+#include "TileEvent/TileContainer.h"
+
+// Calo includes
+#include "CaloEvent/CaloCellContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
 
 class TileID;
 class CaloLVL1_ID;
@@ -51,8 +63,15 @@ class TileCellToTTL1: public AthAlgorithm {
 
   private:
 
-    std::string m_caloCellContainer;    // name of CaloCellContainer
-    std::string m_cellTTL1Container;   // name of TileCellTTL1Container
+
+    SG::ReadHandleKey<CaloCellContainer> m_cellContainerKey{this,"CaloCellContainer",
+                                                            "AllCalo", "Input Calo cell container key"};
+
+    SG::WriteHandleKey<TileTTL1CellContainer> m_ttl1CellContainerKey{this,"TileTTL1CellContainer",
+                                                                     "TileTTL1CellContainer",
+                                                                     "Output Tile TTL1 cell container key"};
+
+
 
     const TileID* m_tileID;
     const CaloLVL1_ID* m_TT_ID;
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellVerify.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellVerify.h
index 364866b5c79..c1441fec2da 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellVerify.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellVerify.h
@@ -32,12 +32,17 @@
 #ifndef TILERECALGS_TILECELLVERIFY_H
 #define TILERECALGS_TILECELLVERIFY_H
 
-#include "AthenaBaseComps/AthAlgorithm.h"
+// Calo includes
+#include "CaloEvent/CaloCellContainer.h"
 
-class TileID;
+// Atlas includes
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
 
 #include <string>
 
+class TileID;
+
 class TileCellVerify : public AthAlgorithm {
 public:
     // Constructor
@@ -53,8 +58,14 @@ public:
 
 private:
 
-    std::string m_cellContainer1;
-    std::string m_cellContainer2;
+    SG::ReadHandleKey<CaloCellContainer> m_cellContainer1Key{this,"TileCellContainer1",
+                                                              "TileCellContainer1",
+                                                              "Input Calo cell container 1 key"};
+
+    SG::ReadHandleKey<CaloCellContainer> m_cellContainer2Key{this,"TileCellContainer2",
+                                                              "TileCellContainer1",
+                                                              "Input Calo cell container 2 key"};
+
 
     const TileID* m_tileID;
   
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsFilter.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsFilter.h
index 615cfa4472e..480b9d09900 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsFilter.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsFilter.h
@@ -32,7 +32,14 @@
 #ifndef TILERECALGS_TILEDIGITSFILTER_H
 #define TILERECALGS_TILEDIGITSFILTER_H
 
+// Tile includes
+#include "TileEvent/TileDigitsContainer.h"
+#include "TileEvent/TileRawChannelContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
 class TileHWID;
 
@@ -63,6 +70,22 @@ class TileDigitsFilter: public AthAlgorithm {
     std::string m_inRchContainer; //!< Name of the input TileRawChannelContainer
     std::string m_outRchContainer; //!< Name of the output TileRawChannelContainer
 
+    SG::ReadHandleKey<TileDigitsContainer> m_inputDigitsContainerKey{this,"InputDigitsContainer",
+                                                                       "TileDigitsCnt", "Input Tile digits container key"};
+
+    SG::WriteHandleKey<TileDigitsContainer> m_outputDigitsContainerKey{this,"OutputDigitsContainer",
+                                                                       "TileDigitsFlt","Output Tile digits container key"};
+
+
+    SG::ReadHandleKey<TileRawChannelContainer> m_inputRawChannelContainerKey{this,"InputRawChannelContainer",
+                                                                             "TileRawChannelCnt", 
+                                                                             "Input Tile raw channels container key"};
+
+    SG::WriteHandleKey<TileRawChannelContainer> m_outputRawChannelContainerKey{this,"OutputRawChannelContainer",
+                                                                               "TileRawChannelFlt",
+                                                                               "Output Tile digits container key"};
+
+
     const TileHWID* m_tileHWID;
 
     int m_threshold[2];  //!< Threshold value for low and high gain
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsThresholdFilter.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsThresholdFilter.h
index 058d1c1160b..32435463c75 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsThresholdFilter.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsThresholdFilter.h
@@ -25,7 +25,15 @@
 #ifndef TILERECALGS_TILEDIGITSTHRESHOLDFILTER_H
 #define TILERECALGS_TILEDIGITSTHRESHOLDFILTER_H
 
+// Tile includes
+#include "TileEvent/TileDigitsContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
 #include "GaudiKernel/ToolHandle.h"
 
 class TileHWID;
@@ -57,8 +65,11 @@ class TileDigitsThresholdFilter: public AthAlgorithm {
     const TileHWID*    m_tileHWID;
     ToolHandle<ITileCondToolDspThreshold> m_tileDspThreshold;
 
-    std::string m_inputContainer;  //!< Name of the input TileDigitsContainer
-    std::string m_outputContainer; //!< Name of the output TileDigitsContainer
+    SG::ReadHandleKey<TileDigitsContainer> m_inputDigitsContainerKey{this,"InputDigitsContainer",
+                                                                       "TileDigitsCnt", "Input Tile digits container key"};
+
+    SG::WriteHandleKey<TileDigitsContainer> m_outputDigitsContainerKey{this,"OutputDigitsContainer",
+                                                                         "TileDigitsFiltered","Output Tile digits container key"};
 
 };
 
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsToTTL1.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsToTTL1.h
index 2f874343ddb..623662dbaab 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsToTTL1.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileDigitsToTTL1.h
@@ -27,10 +27,18 @@
 #ifndef TILERECALGS_TILEDIGITSTOTTL1_H
 #define TILERECALGS_TILEDIGITSTOTTL1_H
 
-#include "GaudiKernel/ToolHandle.h"
+// Tile includes
+#include "TileIdentifier/TileFragHash.h"
+#include "TileEvent/TileDigitsContainer.h"
+#include "TileEvent/TileTTL1Container.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
-#include "TileIdentifier/TileFragHash.h"
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
 
 #include <string>
 
@@ -55,8 +63,13 @@ class TileDigitsToTTL1: public AthAlgorithm {
     StatusCode finalize();
 
   private:
-    std::string m_digitsContainer; // name of TileDigitsContainer
-    std::string m_TTL1Container;   // name of TileTTL1Container
+
+    SG::ReadHandleKey<TileDigitsContainer> m_digitsContainerKey{this,"TileDigitsContainer",
+                                                                "TileDigitsCnt", "Input Tile digits container key"};
+
+    SG::WriteHandleKey<TileTTL1Container> m_ttl1ContainerKey{this,"TileTTL1Container",
+                                                            "TileTTL1Container","Output Tile TTL1 container key"};
+
     std::string m_infoName;        // name of TileInfo object in TES
 
     TileFragHash::TYPE m_rChType;
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileMuonReceiverReadCnt.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileMuonReceiverReadCnt.h
index e9818b3aad5..4c5651e7540 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileMuonReceiverReadCnt.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileMuonReceiverReadCnt.h
@@ -24,13 +24,20 @@
 #ifndef TILERECALGS_TILEMUONRECEIVERREADCNT_H
 #define TILERECALGS_TILEMUONRECEIVERREADCNT_H
 
+// Tile includes
+#include "TileEvent/TileDigitsContainer.h"
+#include "TileEvent/TileRawChannelContainer.h"
+#include "TileEvent/TileMuonReceiverContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+
+#include <string>
 
 class TileID;
 class TileHWID;
 
-#include <string>
-
 class TileMuonReceiverReadCnt : public AthAlgorithm {
 public:
     // Constructor
@@ -46,9 +53,18 @@ public:
 
 private:
 
-    std::string m_TileMuRcvContainer;    
-    std::string m_TileRawChannelContainer;    
-    std::string m_TileDigitsContainer;
+    SG::ReadHandleKey<TileDigitsContainer> m_digitsContainerKey{this,"TileDigitsContainer",
+                                                                "MuRcvDigitsCnt", "Input Tile digits container key"};
+
+    SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer",
+                                                                        "MuRcvRawChCnt", 
+                                                                        "Input Tile raw channel container key"};
+
+    SG::ReadHandleKey<TileMuonReceiverContainer> m_muonReceiverContainerKey{this,"TileMuonReceiverContainer",
+                                                                           "TileMuRcvCnt", 
+                                                                           "Input Tile muon receiver container key"};
+
+
 
     const TileID* m_tileID;
     const TileHWID* m_tileHWID;
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileRawChannelToHit.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileRawChannelToHit.h
index 5c242dee8e7..4071113fc38 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileRawChannelToHit.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileRawChannelToHit.h
@@ -28,8 +28,20 @@
 #ifndef TILERECALGS_TILERAWCHANNELTOHIT_H
 #define TILERECALGS_TILERAWCHANNELTOHIT_H
 
-#include "GaudiKernel/ToolHandle.h"
+// Tile includes
+#include "TileEvent/TileRawChannelContainer.h"
+#include "TileSimEvent/TileHitVector.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
+
+// C++ STL includes
+#include <string>
 
 // Avoid pushing dependencies into clients- just fwd declare the following:
 
@@ -40,8 +52,6 @@ class TileInfo;
 class TileCablingService;
 class TileCondToolEmscale;
 
-// C++ STL includes
-#include <string>
 
 class TileRawChannelToHit: public AthAlgorithm {
   public:
@@ -58,8 +68,14 @@ class TileRawChannelToHit: public AthAlgorithm {
 
   private:
 
-    std::string m_rawChannelContainer;
-    std::string m_hitContainer;
+    SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer",
+                                                                        "TileRawChannelCnt", 
+                                                                        "Input Tile raw channel container key"};
+
+    SG::WriteHandleKey<TileHitVector> m_hitVectorKey{this,"TileHitContainer",
+                                                      "TileHitVec","Output Tile hit container key"};
+
+
     std::string m_infoName;
     bool m_useSamplFract;
 
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileRawChannelToTTL1.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileRawChannelToTTL1.h
index cf0cbe8c5d0..eaf144a7161 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileRawChannelToTTL1.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileRawChannelToTTL1.h
@@ -27,8 +27,18 @@
 #ifndef TILERECALGS_TILERAWCHANNELTOTTL1_H
 #define TILERECALGS_TILERAWCHANNELTOTTL1_H
 
-#include "GaudiKernel/ToolHandle.h"
+// Tile includes
+//#include "TileEvent/TileRawChannelContainer.h"
+#include "TileEvent/TileTTL1Container.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
+
 
 class TileID;
 class TileHWID;
@@ -37,6 +47,7 @@ class CaloLVL1_ID;
 class TileCablingService;
 class ITileBadChanTool;
 class TileCondToolEmscale;
+class TileRawChannelContainer;
 
 #include <string>
 
@@ -54,8 +65,14 @@ class TileRawChannelToTTL1: public AthAlgorithm {
     StatusCode finalize();
 
   private:
-    std::string m_rawChannelContainer;    // name of TileRawChannelContainer
-    std::string m_TTL1Container;   // name of TileTTL1Container
+
+    SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer",
+                                                                        "TileRawChannelCnt", 
+                                                                        "Input Tile raw channel container key"};
+
+    SG::WriteHandleKey<TileTTL1Container> m_ttl1ContainerKey{this,"TileTTL1Container",
+                                                             "TileTTL1Container","Output Tile TTL1 container key"};
+
     std::string m_infoName;        // name of TileInfo object in TES
     bool m_constantTTL1shape; // true by default, so only gets ttl1 shape once at initialization, with phase=0 for all towers.
 
diff --git a/TileCalorimeter/TileRecAlgs/share/TileDigitsThresholdFilter_test.ref b/TileCalorimeter/TileRecAlgs/share/TileDigitsThresholdFilter_test.ref
index ae6c582fece..eedc91a0fde 100644
--- a/TileCalorimeter/TileRecAlgs/share/TileDigitsThresholdFilter_test.ref
+++ b/TileCalorimeter/TileRecAlgs/share/TileDigitsThresholdFilter_test.ref
@@ -4,12 +4,12 @@ Initializing Gaudi ApplicationMgr using job opts ./TileDigitsThresholdFilter_tes
 JobOptionsSvc        INFO Job options successfully read in from ./TileDigitsThresholdFilter_test_generated.txt
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v28r2)
-                                          running on lxplus000.cern.ch on Mon Jul 10 16:48:20 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on pcatl06.cern.ch on Sun Dec 10 13:55:36 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : StoreGate
 ApplicationMgr       INFO Application Manager Configured successfully
-ClassIDSvc           INFO  getRegistryEntries: read 4130 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 4140 CLIDRegistry entries for module ALL
 StoreGateSvc        DEBUG Property update for OutputLevel : new value = 2
 StoreGateSvc        DEBUG Service base class initialized successfully
 StoreGateSvc        DEBUG trying to create store SGImplSvc/StoreGateSvc_Impl
@@ -41,7 +41,7 @@ AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionar
 AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! 
 AtlasDetectorID      DEBUG Could not get value for label 'no_side' of field 'DetZside' in dictionary Calorimeter
  AtlasDetectorID::initialize_from_dictionary - OK 
-ClassIDSvc           INFO  getRegistryEntries: read 371 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 372 CLIDRegistry entries for module ALL
 TileDigitsThres...   INFO Input digits container: 'TileDigitsCnt'  output container: 'TileDigitsFiltered'
 TileDigitsThres...   INFO initialization completed
 TILE => 5/0/1/1/0/0
@@ -54,11 +54,7 @@ TILE => 5/0/1/2/1/1
 TILE => 5/0/1/2/2/1
 TILE => 5/0/1/2/3/1
 TILE => 5/0/1/2/4/1
-StoreGateSvc_Impl   DEBUG Recorded object @0x238c9f0 with key TileDigitsCnt of type TileDigitsContainer(CLID 2925)
- in DataObject @0x2371410
- object not modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Retrieved const handle to object TileDigitsCnt  of type TileDigitsContainer(CLID 2925)
-StoreGateSvc_Impl   DEBUG Recorded object @0x23ba0b0 with key TileDigitsFiltered of type TileDigitsContainer(CLID 2925)
- in DataObject @0x22ec880
+StoreGateSvc_Impl   DEBUG Recorded object @0x13b0770 with key TileDigitsCnt of type TileDigitsContainer(CLID 2925)
+ in DataObject @0x1303050
  object not modifiable when retrieved
 StoreGateSvc_Impl   DEBUG Retrieved const handle to object TileDigitsFiltered  of type TileDigitsContainer(CLID 2925)
diff --git a/TileCalorimeter/TileRecAlgs/src/MBTSTimeDiffEventInfoAlg.cxx b/TileCalorimeter/TileRecAlgs/src/MBTSTimeDiffEventInfoAlg.cxx
index 9f70e0ac08b..e141ceb5f2a 100644
--- a/TileCalorimeter/TileRecAlgs/src/MBTSTimeDiffEventInfoAlg.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/MBTSTimeDiffEventInfoAlg.cxx
@@ -2,13 +2,17 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
+// Tile includes
 #include "TileRecAlgs/MBTSTimeDiffEventInfoAlg.h"
+#include "TileIdentifier/TileTBID.h"
 
+// Atlas includes
 #include "xAODEventInfo/EventInfo.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
 #include "AthenaKernel/errorcheck.h"
-#include "TileIdentifier/TileTBID.h"
-#include "TileEvent/TileContainer.h"
-#include "TileEvent/MBTSCollisionTime.h"
+
+#include <memory>
 
 using xAOD::EventInfo;
 
@@ -26,25 +30,28 @@ MBTSTimeDiffEventInfoAlg::MBTSTimeDiffEventInfoAlg(const std::string &name,
   , m_minhitsperside(2)
   , m_mbts_threshold(40.0 / 222.0)
   , m_tileTBID(0)
-  , m_mbtsContainerName("MBTSContainer")
   , m_mask(TileCell::MASK_BADCH | TileCell::MASK_OVER | TileCell::MASK_TIME)
   , m_pattern(TileCell::MASK_TIME)
 {
   declareProperty("MBTS_Threshold", m_mbts_threshold);  // Value in pC
   declareProperty("MinHitsPerSide", m_minhitsperside);
   declareProperty("TimeDiffThreshold", m_timeDiffThreshold);
-  declareProperty("MBTSContainer", m_mbtsContainerName);
 }
 
 StatusCode MBTSTimeDiffEventInfoAlg::initialize() {
-  if (m_minhitsperside == 0)
+  if (m_minhitsperside == 0) {
     m_minhitsperside = 1; //Avoid div-by-zero later
+  }
+
   ATH_MSG_INFO("Initializing. MBTS_Threshold=" << m_mbts_threshold
                << ", MinHitsPerSide=" << m_minhitsperside
                << ",TimeDiffThreshold=" << m_timeDiffThreshold );
 
   CHECK( detStore()->retrieve(m_tileTBID));
 
+  ATH_CHECK( m_mbtsContainerKey.initialize() );
+  ATH_CHECK( m_mbtsCollisionTimeKey.initialize() );
+
   return StatusCode::SUCCESS;
 }
 
@@ -59,7 +66,6 @@ StatusCode MBTSTimeDiffEventInfoAlg::execute() {
 
   EventInfo* eventInfo = const_cast<EventInfo*>(eventInfo_c);
 
-  const TileCellContainer *tileCellCnt = 0;
   float eneA = 0.F;
   float eneC = 0.F;
   float timeA = 0.F;
@@ -67,25 +73,23 @@ StatusCode MBTSTimeDiffEventInfoAlg::execute() {
   unsigned countA = 0;
   unsigned countC = 0;
 
-  CHECK( evtStore()->retrieve(tileCellCnt, m_mbtsContainerName) );
+  SG::ReadHandle<TileCellContainer> mbtsContainer (m_mbtsContainerKey);
+  ATH_CHECK( mbtsContainer.isValid() );
 
-  // ATH_MSG_DEBUG( "Mask:" << (int)mask << " Pattern:" << (int)pattern );
+  for (const TileCell* mbtsCell : *mbtsContainer) {
 
-  TileCellContainer::const_iterator itr = tileCellCnt->begin();
-  TileCellContainer::const_iterator itr_end = tileCellCnt->end();
-  for (; itr != itr_end; ++itr) {
-    if ((*itr)->energy() < m_mbts_threshold) continue;
+    if (mbtsCell->energy() < m_mbts_threshold) continue;
     //Got cell above threshold
 
-    const uint8_t qbit1 = (*itr)->qbit1();
-    const Identifier& id = (*itr)->ID();
+    const uint8_t qbit1 = mbtsCell->qbit1();
+    const Identifier& id = mbtsCell->ID();
 
     if (msgLvl(MSG::VERBOSE)) {
       msg(MSG::VERBOSE) << "Working on MBTS cell side=" << m_tileTBID->type(id)
           << " module_id=" << m_tileTBID->module(id)
           << " channel_id=" << m_tileTBID->channel(id)
-          << " Energy=" << (*itr)->energy()
-          << " Time=" << (*itr)->time()
+          << " Energy=" << mbtsCell->energy()
+          << " Time=" << mbtsCell->time()
           << " Qbit1=" << (int) qbit1
           << " Q1Mask(BC|OF|AP|TM)=[" << ((qbit1 & TileCell::MASK_BADCH) != 0)
           << "|" << ((qbit1 & TileCell::MASK_OVER) != 0) << "|"
@@ -105,12 +109,12 @@ StatusCode MBTSTimeDiffEventInfoAlg::execute() {
     // MBTS Id type is  "side"  +/- 1
     const int type_id = m_tileTBID->type(id);
     if (type_id == 1) { //A-side
-      eneA += (*itr)->energy();
-      timeA += (*itr)->time();
+      eneA += mbtsCell->energy();
+      timeA += mbtsCell->time();
       countA++;
     } else if (type_id == -1) { //C-side
-      eneC += (*itr)->energy();
-      timeC += (*itr)->time();
+      eneC += mbtsCell->energy();
+      timeC += mbtsCell->time();
       countC++;
     } else {
       ATH_MSG_WARNING( "Unexpected 'side' from MBTS identifier " );
@@ -125,29 +129,29 @@ StatusCode MBTSTimeDiffEventInfoAlg::execute() {
     ATH_MSG_DEBUG( "Got MBTS cells above threshold on both sides" );
     const float timediff = fabs(timeA - timeC);
     ATH_MSG_DEBUG( "Time diff " << timediff << "(" << m_timeDiffThreshold << ")");
-
+    
     if (timediff > m_timeDiffThreshold) {
       ATH_MSG_DEBUG( "Event identified as background, set bit 'MBTSTimeDiffHalo' in EventInfo Background word" );
-
+      
       if (eventInfo->setEventFlagBit(EventInfo::Background,
-          EventInfo::MBTSTimeDiffHalo) == false)
-
+                                     EventInfo::MBTSTimeDiffHalo) == false)
+        
         ATH_MSG_WARNING( "Failed to set EventInfo Background word!" );
     } //end if above theshold
     else {
       ATH_MSG_DEBUG( "Event identified as collision, set bit 'MBTSTimeDiffCol' in EventInfo Background word" );
-
+      
       if (eventInfo->setEventFlagBit(EventInfo::Background,
-          EventInfo::MBTSTimeDiffCol) == false)
+                                     EventInfo::MBTSTimeDiffCol) == false)
         ATH_MSG_WARNING( "Failed to set EventInfo Background word!" );
     } //end if below threshold
-  } // end if have counts on both sides
-  else
+  } else {
     ATH_MSG_DEBUG( "Not enough hits above threshold to distinguish halo from collision event");
+  }
+
+  SG::WriteHandle<MBTSCollisionTime> mbtsTime(m_mbtsCollisionTimeKey);
 
-  MBTSCollisionTime * mbtsTime = new MBTSCollisionTime(countA, countC, eneA,
-      eneC, timeA, timeC);
-  if (evtStore()->record(mbtsTime, "MBTSCollisionTime").isFailure()) {
+  if (mbtsTime.record(std::make_unique<MBTSCollisionTime>(countA, countC, eneA, eneC, timeA, timeC)).isFailure()) {
     ATH_MSG_WARNING( "Cannot record MBTSCollisionTime " );
   } else {
     ATH_MSG_DEBUG( "MBTSCollisionTime recorded in event store" );
diff --git a/TileCalorimeter/TileRecAlgs/src/TileBeamElemToCell.cxx b/TileCalorimeter/TileRecAlgs/src/TileBeamElemToCell.cxx
index f8321c9695e..ab497e3d4d6 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileBeamElemToCell.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileBeamElemToCell.cxx
@@ -16,25 +16,26 @@
 //
 //*****************************************************************************
 
-// Atlas include
-#include "AthenaKernel/errorcheck.h"
 
-// access all RawChannels inside container
-#include "EventContainers/SelectAllObject.h" 
+// Tile includes
+#include "TileRecAlgs/TileBeamElemToCell.h"
+#include "TileIdentifier/TileHWID.h"
+#include "TileDetDescr/TileDetDescrManager.h"
+#include "TileConditions/TileInfo.h"
+#include "TileEvent/TileCell.h"
 
 // Calo includes
 #include "CaloIdentifier/TileTBID.h"
-#include "CaloEvent/CaloCellContainer.h"
 #include "CaloDetDescr/CaloDetDescrElement.h"
+
+// Atlas include
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
 #include "Identifier/IdentifierHash.h"
+// access all RawChannels inside container
+#include "EventContainers/SelectAllObject.h" 
 
-// Tile includes
-#include "TileIdentifier/TileHWID.h"
-#include "TileDetDescr/TileDetDescrManager.h"
-#include "TileConditions/TileInfo.h"
-#include "TileEvent/TileBeamElemContainer.h"
-#include "TileEvent/TileCell.h"
-#include "TileRecAlgs/TileBeamElemToCell.h"
 
 // C++ STL includes
 #include <map>
@@ -49,12 +50,8 @@ TileBeamElemToCell::TileBeamElemToCell(const std::string& name, ISvcLocator* pSv
   , m_tileInfo(0)
   , m_tileMgr(0)
 {
-  m_beamElemContainer = "TileBeamElemCnt";
-  m_cellContainer = "TileTBCellCnt";
   m_infoName = "TileInfo";
 
-  declareProperty("TileBeamElemContainer", m_beamElemContainer);   // Name of input container
-  declareProperty("TileTBCellContainer", m_cellContainer);         // Name of output container
   declareProperty("TileInfoName", m_infoName);                     // name of TileInfo store
 }
 
@@ -73,8 +70,11 @@ StatusCode TileBeamElemToCell::initialize()
   CHECK( detStore()->retrieve(m_tileTBID) );
   CHECK( detStore()->retrieve(m_tileHWID) );
   CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
+
+  ATH_CHECK( m_beamElemContainerKey.initialize() );
+  ATH_CHECK( m_cellContainerKey.initialize() );
   
-  ATH_MSG_INFO( "TileBeamElemToCell initialization completed" );
+  ATH_MSG_INFO( "initialization completed" );
 
   return StatusCode::SUCCESS;
 }
@@ -88,48 +88,47 @@ StatusCode TileBeamElemToCell::execute()
 {
 
   // create new container
-  CaloCellContainer* cells = new CaloCellContainer;
+  SG::WriteHandle<CaloCellContainer> cellContainer(m_cellContainerKey);
+
+  /* Register the set of TileCells to the event store. */
+  ATH_CHECK( cellContainer.record(std::make_unique<CaloCellContainer>()) );
 
   //**
   //* Get TileBeamElems
   //**
-    
-  const TileBeamElemContainer* beamElemCnt;
+  SG::ReadHandle<TileBeamElemContainer> beamElemContainer(m_beamElemContainerKey);
 
- if(evtStore()->retrieve(beamElemCnt, m_beamElemContainer).isFailure()) {
+  if(!beamElemContainer.isValid()) {
    ATH_MSG_WARNING( "No signal from beam elements; container '"
-       << m_beamElemContainer << "' doesn't exist in StoreGate" );
+                    << m_beamElemContainerKey.key() << "' doesn't exist in StoreGate" );
 
   } else {
 
     //* Iterate over BeamElem, creating new TileCells (or incrementing
     //* existing ones). Add each new TileCell to the CaloCellContainer.
       
-    SelectAllObject<TileBeamElemContainer> beamElems(beamElemCnt);
-    SelectAllObject<TileBeamElemContainer>::const_iterator itr=beamElems.begin(); 
-    SelectAllObject<TileBeamElemContainer>::const_iterator end=beamElems.end(); 
+    SelectAllObject<TileBeamElemContainer> beamElems(beamElemContainer.cptr());
 
-    for( ; itr != end; ++itr) {
+    for (const TileBeamElem* beamElem : beamElems) {
 	
-      HWIdentifier adc_id = (*itr)->adc_HWID();
-      std::vector<unsigned int> amp = (*itr)->get_digits();
+      HWIdentifier adc_id = beamElem->adc_HWID();
+      std::vector<unsigned int> amp = beamElem->get_digits();
       float ener = amp[0] * m_tileInfo->BeamElemChannelCalib(adc_id);
 
-      Identifier cell_ID = (*itr)->pmt_ID();
-      TileCell * pCell = new TileCell(NULL,cell_ID,ener); // CaloDDE is NULL pointer here
-	
-      cells->push_back(pCell); // store cell in container
+      Identifier cell_ID = beamElem->pmt_ID();
+
+      // CaloDDE is NULL pointer here
+      // store cell in container
+      std::unique_ptr<TileCell> cell = std::make_unique<TileCell>(nullptr, cell_ID, ener);
+      cellContainer->push_back(cell.release());
     }
   }
  
-  /* Register the set of TileCells to the event store. */
-    
- CHECK( evtStore()->record(cells, m_cellContainer, false) );
 
  // Execution completed.
 
  ATH_MSG_VERBOSE( "TileCell container registered to the TES with name"
-      << m_cellContainer);
+                  << m_cellContainerKey.key());
     
     
   return StatusCode::SUCCESS;
@@ -144,7 +143,7 @@ StatusCode TileBeamElemToCell::execute()
 StatusCode TileBeamElemToCell::finalize()
 {
   
-  ATH_MSG_INFO( "TileBeamElemToCell::finalize() end" );
+  ATH_MSG_INFO( "finalize() end" );
   
   return StatusCode::SUCCESS;
 }
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx
index daff5bbd102..d46bbcfb81e 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx
@@ -2,24 +2,23 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-
-#include "CaloIdentifier/TileID.h"
+// Tile includes
+#include "TileRecAlgs/TileCellSelector.h"
+#include "TileRecUtils/TileRawChannelBuilder.h"
+#include "TileRecUtils/TileBeamInfoProvider.h"
 #include "TileEvent/TileCell.h"
-#include "CaloEvent/CaloCellContainer.h"
-#include "TileIdentifier/TileHWID.h"
 #include "TileEvent/TileDigits.h"
-#include "TileEvent/TileDigitsContainer.h"
-#include "TileEvent/TileRawChannelContainer.h"
+#include "TileIdentifier/TileHWID.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileConditions/TileCablingService.h"
 #include "TileConditions/ITileBadChanTool.h"
 #include "TileConditions/TileDCSSvc.h"
-#include "TileRecUtils/TileRawChannelBuilder.h"
-#include "TileRecUtils/TileBeamInfoProvider.h"
 
-#include "xAODEventInfo/EventInfo.h"
+// Calo includes
+#include "CaloIdentifier/TileID.h"
 
-#include "TileRecAlgs/TileCellSelector.h"
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
 
 #include "boost/date_time/local_time/local_time.hpp"
 #include "boost/date_time/posix_time/posix_time.hpp"
@@ -63,9 +62,6 @@ TileCellSelector::TileCellSelector(const std::string& name, ISvcLocator* pSvcLoc
   , m_tileFlag(0)
   , m_tileError(0)
 {
-  declareProperty( "CellContainerName", m_cellsContName = "AllCalo");
-  declareProperty( "DigitsContainerName", m_digitsContName = "TileDigitsFlt");
-  declareProperty( "RawChannelContainerName", m_rchContName = "TileRawChannelCnt");
 
   declareProperty( "MinEnergyCell", m_minEneCell = -5000.);   // cut on cell energy
   declareProperty( "MaxEnergyCell", m_maxEneCell = 1000000.); // cut on cell energy
@@ -144,9 +140,12 @@ StatusCode TileCellSelector::initialize() {
     CHECK(m_tileDCSSvc.retrieve());
   }
 
-  ATH_MSG_INFO( "Cell container " << ((m_cellsContName.size()>0)?m_cellsContName:"NOT SET"));
-  ATH_MSG_INFO( "Digits container " << ((m_digitsContName.size()>0)?m_digitsContName:"NOT SET"));
-  ATH_MSG_INFO( "RawChannel container " << ((m_rchContName.size()>0)?m_rchContName:"NOT SET"));
+  ATH_MSG_INFO( "Cell container " 
+                << ((m_cellContainerKey.key().empty()) ? "NOT SET" : m_cellContainerKey.key()) );
+  ATH_MSG_INFO( "Digits container " 
+                << ((m_digitsContainerKey.key().empty()) ? "NOT SET" : m_digitsContName));
+  ATH_MSG_INFO( "RawChannel container " 
+                << ((m_rawChannelContainerKey.key().empty()) ? "NOT SET" : m_rawChannelContainerKey.key()));
 
   ATH_MSG_INFO( "CheckJumps " << ((m_checkJumps) ? "true" : "false"));
   ATH_MSG_INFO( "CheckDMUs " << ((m_checkDMUs) ? "true" : "false"));
@@ -157,16 +156,19 @@ StatusCode TileCellSelector::initialize() {
   ATH_MSG_INFO( "SkipMBTS " << ((m_skipMBTS) ? "true" : "false"));
   ATH_MSG_INFO( "CheckDCS " << ((m_checkDCS) ? "true" : "false"));
 
-  if (m_cellsContName.size() > 0) {
+  if (!m_cellContainerKey.key().empty()) {
     ATH_MSG_INFO( "MinEnergyCell < " << m_minEneCell);
     ATH_MSG_INFO( "MaxEnergyCell > " << m_maxEneCell);
     ATH_MSG_INFO( "PtnEnergyCell = " << m_ptnEneCell);
     ATH_MSG_INFO( "MinTimeCell < " << m_minTimeCell);
     ATH_MSG_INFO( "MaxTimeCell > " << m_maxTimeCell);
     ATH_MSG_INFO( "PtnTimeCell = " << m_ptnTimeCell);
+    
+    ATH_CHECK( m_cellContainerKey.initialize() );
+
   }
 
-  if (m_cellsContName.size() > 0 || m_rchContName.size() > 0) {
+  if (!(m_cellContainerKey.key().empty() && m_rawChannelContainerKey.key().empty())) {
     ATH_MSG_INFO( "MinEnergyChan < " << m_minEneChan[0]);
     ATH_MSG_INFO( "MaxEnergyChan > " << m_maxEneChan[0]);
     ATH_MSG_INFO( "PtnEnergyChan = " << m_ptnEneChan[0]);
@@ -181,24 +183,32 @@ StatusCode TileCellSelector::initialize() {
     ATH_MSG_INFO( "PtnTimeGap  = " << m_ptnTimeChan[1]);
   }
 
-  if (m_rchContName.size() > 0) {
+  if (!m_rawChannelContainerKey.key().empty()) {
     ATH_MSG_INFO( "MinEnergyMBTS < " << m_minEneChan[2]);
     ATH_MSG_INFO( "MaxEnergyMBTS > " << m_maxEneChan[2]);
     ATH_MSG_INFO( "PtnEnergyMBTS = " << m_ptnEneChan[2]);
     ATH_MSG_INFO( "MinTimeMBTS < " << m_minTimeChan[2]);
     ATH_MSG_INFO( "MaxTimeMBTS > " << m_maxTimeChan[2]);
     ATH_MSG_INFO( "PtnTimeMBTS = " << m_ptnTimeChan[2]);
+
+    ATH_CHECK( m_rawChannelContainerKey.initialize() );
+
   }
 
-  if (m_digitsContName.size() > 0 && m_checkJumps) {
-    ATH_MSG_INFO( "JumpDeltaHG " << m_jumpDeltaHG);
-    ATH_MSG_INFO( "JumpDeltaLG " << m_jumpDeltaLG);
-    ATH_MSG_INFO( "PedDetlaHG " << m_pedDeltaHG);
-    ATH_MSG_INFO( "PedDetlaLG " << m_pedDeltaLG);
-    ATH_MSG_INFO( "ConstLength " << m_constLength);
+  if (!m_digitsContainerKey.key().empty()) {
+    if (m_checkJumps) {
+      ATH_MSG_INFO( "JumpDeltaHG " << m_jumpDeltaHG);
+      ATH_MSG_INFO( "JumpDeltaLG " << m_jumpDeltaLG);
+      ATH_MSG_INFO( "PedDetlaHG " << m_pedDeltaHG);
+      ATH_MSG_INFO( "PedDetlaLG " << m_pedDeltaLG);
+      ATH_MSG_INFO( "ConstLength " << m_constLength);
+    }
+
+    ATH_CHECK( m_digitsContainerKey.initialize() );
+
   }
 
-  if (m_rchContName.size() > 0) {
+  if (!m_rawChannelContainerKey.key().empty()) {
     if (m_checkDMUs) {
       ATH_MSG_INFO( "MinBadDMU " << m_minBadDMU);
       ATH_MSG_INFO( "MaxBadDMU " << m_maxBadDMU);
@@ -252,21 +262,21 @@ StatusCode TileCellSelector::execute() {
 
   ++m_counter;
 
-  const DataHandle<EventInfo> eventInfo(0);
-  if (evtStore()->retrieve(eventInfo).isFailure()) {
-    m_runNum = 0;
-    m_evtNum = 0;
-    m_lumiBlock = 0;
-    m_evtBCID = 0;
-    m_tileFlag = 0;
-    m_tileError = 0;
-  } else {
+  SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey);
+  if ( eventInfo.isValid() ) {
     m_runNum = eventInfo->runNumber();
     m_lumiBlock = eventInfo->lumiBlock();
     m_evtNum = eventInfo->eventNumber();
     m_evtBCID = eventInfo->bcid();
     m_tileFlag = eventInfo->eventFlags(EventInfo::Tile);
     m_tileError = eventInfo->errorState(EventInfo::Tile);
+  } else {
+    m_runNum = 0;
+    m_evtNum = 0;
+    m_lumiBlock = 0;
+    m_evtBCID = 0;
+    m_tileFlag = 0;
+    m_tileError = 0;
   }
 
   std::ostringstream evState;
@@ -435,20 +445,18 @@ StatusCode TileCellSelector::execute() {
   const TileCell* tcellminCh = 0;
   const TileCell* tcellmaxCh = 0;
 
-  if (m_cellsContName.size() > 0) {
+  if (!m_cellContainerKey.key().empty()) {
 
-    // Pointer to a Tile cell container
-    const CaloCellContainer* cell_container;
+    // Get Calo cell container
+    SG::ReadHandle<CaloCellContainer> cellContainer(m_cellContainerKey);
 
-    if ( evtStore()->retrieve(cell_container, m_cellsContName).isFailure() ) {
+    if (!cellContainer.isValid()) {
+      
       ATH_MSG_WARNING("Unable to read CaloCellContainer from EventStore, disable reading of this container");
       m_cellsContName = "";
 
     } else {
 
-      CaloCellContainer::const_iterator iCell = cell_container->begin();
-      CaloCellContainer::const_iterator lastCell  = cell_container->end();
-
       float emin = 0.;
       float emax = 0.;
       float tmin = 0.;
@@ -467,15 +475,15 @@ StatusCode TileCellSelector::execute() {
       // both for overflow and underflow and underflow is HG are very often in gap cells
       // also, overflow in HG might be masked if quality is too bad, so we'll not select all overflows...
       // that's why only overflow in LG are checked
-      bool checkOver = (m_checkOverLG && m_digitsContName.size()==0);
+      bool checkOver = (m_checkOverLG && m_digitsContainerKey.key().empty());
+
+      for (const CaloCell* cell : *cellContainer) {
 
-      for ( ; iCell != lastCell; ++iCell) {
-        const CaloCell* cell_ptr = *iCell;
-        Identifier id = cell_ptr->ID();
+        Identifier id = cell->ID();
         if ( m_tileID->is_tile(id) ) {
-          const TileCell* tile_cell = dynamic_cast<const TileCell*> (cell_ptr);
+          const TileCell* tile_cell = dynamic_cast<const TileCell*> (cell);
           if (tile_cell==0) continue;
-          const CaloDetDescrElement * caloDDE = cell_ptr->caloDDE();
+          const CaloDetDescrElement * caloDDE = cell->caloDDE();
           IdentifierHash hash1 = caloDDE->onl1();
           IdentifierHash hash2 = caloDDE->onl2();
           int ch_type = (hash2 == TileHWID::NOT_VALID_HASH) ? 1 : 0;
@@ -755,14 +763,13 @@ StatusCode TileCellSelector::execute() {
 
   const TileDQstatus* DQstatus(0);
 
-  if (m_rchContName.size()>0) {
+  if (!m_rawChannelContainerKey.key().empty()) {
 
-    // Pointer to a Tile RawChannel container
-    const TileRawChannelContainer* rch_container;
+    // Get Tile RawChannel container
+    SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
 
-    if ( evtStore()->retrieve(rch_container, m_rchContName).isFailure() ) {
+    if ( !rawChannelContainer.isValid() ) {
       ATH_MSG_WARNING("Unable to read TileRawChannelContainer from EventStore, disable reading of this container");
-      m_rchContName = "";
 
     } else {
 
@@ -774,7 +781,7 @@ StatusCode TileCellSelector::execute() {
       const TileRawChannel* maxCh = 0;
       const TileRawChannel* tminCh = 0;
       const TileRawChannel* tmaxCh = 0;
-      TileRawChannelUnit::UNIT rChUnit = rch_container->get_unit();
+      TileRawChannelUnit::UNIT rChUnit = rawChannelContainer->get_unit();
       bool allowAmpCheck = ( ( rChUnit == TileRawChannelUnit::MegaElectronVolts || // allow MeV only as units
                                rChUnit == TileRawChannelUnit::OnlineMegaElectronVolts ) ) ;
       bool fillChanEne = ( m_cellsContName.size()==0 && allowAmpCheck ); // use amplitude from channel if cell container was not checked
@@ -794,9 +801,6 @@ StatusCode TileCellSelector::execute() {
       IdentifierHash hash;
       int index=0, pmt;
 
-      TileRawChannelContainer::const_iterator collItr=rch_container->begin();
-      TileRawChannelContainer::const_iterator lastColl=rch_container->end();
-
       int nbadMax = 0;
       int nbadMBMax = 0;
       const TileRawChannelCollection * collMax = 0;
@@ -804,11 +808,9 @@ StatusCode TileCellSelector::execute() {
 
       bool someDQerrors = false;
 
-      for(; collItr!=lastColl; ++collItr) {
+      for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
 
-        const TileRawChannelCollection * coll  = (*collItr);
-
-        int frag = coll->identify();
+        int frag = rawChannelCollection->identify();
         bool eb = (frag > 0x2ff);
         bool ebsp = (frag == 0x30e || frag == 0x411);
 
@@ -825,29 +827,29 @@ StatusCode TileCellSelector::execute() {
 
         // all error words contains information in last 16 bits only
         // but they are stored in collection as 32 bit numbers
-        uint32_t RODBCID         = coll->getRODBCID();
-        uint32_t DSPBCID         = coll->getFragDSPBCID();
-        uint32_t GlobalCRCErr    = coll->getFragGlobalCRC() & 0x1;
-        uint32_t FE_DMUmask      = coll->getFragFEChipMask();
-        uint32_t ROD_DMUmask     = coll->getFragRODChipMask();
-        uint32_t BCIDErr         = coll->getFragBCID();
-        uint32_t MemoryParityErr = coll->getFragMemoryPar();
-        uint32_t HeaderFormatErr = coll->getFragHeaderBit();
-        uint32_t HeaderParityErr = coll->getFragHeaderPar();
-        uint32_t SampleFormatErr = coll->getFragSampleBit();
-        uint32_t SampleParityErr = coll->getFragSamplePar();
-        uint32_t SingleStrobeErr = coll->getFragSstrobe();
-        uint32_t DoubleStrobeErr = coll->getFragDstrobe();
+        uint32_t RODBCID         = rawChannelCollection->getRODBCID();
+        uint32_t DSPBCID         = rawChannelCollection->getFragDSPBCID();
+        uint32_t GlobalCRCErr    = rawChannelCollection->getFragGlobalCRC() & 0x1;
+        uint32_t FE_DMUmask      = rawChannelCollection->getFragFEChipMask();
+        uint32_t ROD_DMUmask     = rawChannelCollection->getFragRODChipMask();
+        uint32_t BCIDErr         = rawChannelCollection->getFragBCID();
+        uint32_t MemoryParityErr = rawChannelCollection->getFragMemoryPar();
+        uint32_t HeaderFormatErr = rawChannelCollection->getFragHeaderBit();
+        uint32_t HeaderParityErr = rawChannelCollection->getFragHeaderPar();
+        uint32_t SampleFormatErr = rawChannelCollection->getFragSampleBit();
+        uint32_t SampleParityErr = rawChannelCollection->getFragSamplePar();
+        uint32_t SingleStrobeErr = rawChannelCollection->getFragSstrobe();
+        uint32_t DoubleStrobeErr = rawChannelCollection->getFragDstrobe();
 
         if (RODBCID!=0 && RODBCID != m_evtBCID ) {
           if (m_nDrawerOff[drawerIdx] < m_maxVerboseCnt) {
             ATH_MSG_VERBOSE(  evtnum.str()
-                << "  drw " << drwname(coll->identify())
+                << "  drw " << drwname(rawChannelCollection->identify())
                 << " ROD BCID " << RODBCID << " is wrong - skipping");
 
             if (++m_nDrawerOff[drawerIdx] == m_maxVerboseCnt)
               ATH_MSG_VERBOSE( nevtnum.str()
-                  << "   suppressing further messages about drawer 0x" << std::hex << coll->identify()
+                  << "   suppressing further messages about drawer 0x" << std::hex << rawChannelCollection->identify()
                   << std::dec << " being bad");
           }
           someDQerrors = true;
@@ -869,12 +871,14 @@ StatusCode TileCellSelector::execute() {
 
           if (m_nDrawerOff[drawerIdx] < m_maxVerboseCnt) {
             ATH_MSG_VERBOSE( evtnum.str()
-                << "  drw " << drwname(coll->identify()) << " is OFF - skipping");
+                             << "  drw " << drwname(rawChannelCollection->identify()) 
+                             << " is OFF - skipping");
 
             if (++m_nDrawerOff[drawerIdx] == m_maxVerboseCnt)
               ATH_MSG_VERBOSE( nevtnum.str()
-                  << "   suppressing further messages about drawer 0x" << std::hex << coll->identify()
-                  << std::dec << " being bad");
+                               << "   suppressing further messages about drawer 0x" << std::hex 
+                               << rawChannelCollection->identify()
+                               << std::dec << " being bad");
           }
           continue;
         }
@@ -894,12 +898,13 @@ StatusCode TileCellSelector::execute() {
 
           if (m_nDrawerOff[drawerIdx] < m_maxVerboseCnt) {
             ATH_MSG_VERBOSE( evtnum.str()
-                << "  drw " << drwname(coll->identify()) << " is MISSING - skipping");
+                             << "  drw " << drwname(rawChannelCollection->identify()) 
+                             << " is MISSING - skipping");
 
             if (++m_nDrawerOff[drawerIdx] == m_maxVerboseCnt)
               ATH_MSG_VERBOSE( nevtnum.str()
-                  << "   suppressing further messages about drawer 0x" << std::hex << coll->identify()
-                  << std::dec << " being bad");
+                               << "   suppressing further messages about drawer 0x" << std::hex 
+                               << rawChannelCollection->identify() << std::dec << " being bad");
           }
           continue;
         }
@@ -909,13 +914,13 @@ StatusCode TileCellSelector::execute() {
           if (m_maxBadDMU<16) {
             if (m_nDrawerOff[drawerIdx] < m_maxVerboseCnt) {
               ATH_MSG_VERBOSE( evtnum.str()
-                  << "  drw " << drwname(coll->identify())
-                  << " global CRC error - skipping");
+                               << "  drw " << drwname(rawChannelCollection->identify())
+                               << " global CRC error - skipping");
 
               if (++m_nDrawerOff[drawerIdx] == m_maxVerboseCnt)
                 ATH_MSG_VERBOSE( nevtnum.str()
-                    << "   suppressing further messages about drawer 0x" << std::hex << coll->identify()
-                    << std::dec << " being bad");
+                                 << "   suppressing further messages about drawer 0x" << std::hex 
+                                 << rawChannelCollection->identify() << std::dec << " being bad");
             }
             someDQerrors = true;
             continue;
@@ -939,13 +944,13 @@ StatusCode TileCellSelector::execute() {
           if (m_maxBadDMU < 16) {
             if (m_nDrawerOff[drawerIdx] < m_maxVerboseCnt) {
               ATH_MSG_VERBOSE( evtnum.str()
-                  << "  drw " << drwname(coll->identify())
-                  << " BCID in DMU1 is bad - skipping");
+                               << "  drw " << drwname(rawChannelCollection->identify())
+                               << " BCID in DMU1 is bad - skipping");
 
               if (++m_nDrawerOff[drawerIdx] == m_maxVerboseCnt)
                 ATH_MSG_VERBOSE( nevtnum.str()
-                    << "   suppressing further messages about drawer 0x"
-                    << std::hex << coll->identify() << std::dec << " being bad");
+                                 << "   suppressing further messages about drawer 0x"
+                                 << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
             }
             someDQerrors = true;
             continue;
@@ -958,13 +963,13 @@ StatusCode TileCellSelector::execute() {
             if (m_maxBadDMU < 16) {
               if (m_nDrawerOff[drawerIdx] < m_maxVerboseCnt) {
                 ATH_MSG_VERBOSE( evtnum.str()
-                    << "  drw " << drwname(coll->identify())
-                    << " DSP BCID is wrong - skipping");
+                                 << "  drw " << drwname(rawChannelCollection->identify())
+                                 << " DSP BCID is wrong - skipping");
 
                 if (++m_nDrawerOff[drawerIdx] == m_maxVerboseCnt)
                   ATH_MSG_VERBOSE(  nevtnum.str()
-                      << "   suppressing further messages about drawer 0x"
-                      << std::hex << coll->identify() << std::dec << " being bad");
+                                    << "   suppressing further messages about drawer 0x"
+                                    << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
               }
               someDQerrors = true;
               continue;
@@ -978,13 +983,13 @@ StatusCode TileCellSelector::execute() {
         if (error==0xFFFF && m_maxBadDMU<16) {
           if (m_nDrawerOff[drawerIdx] < m_maxVerboseCnt) {
             ATH_MSG_VERBOSE( evtnum.str()
-                << "  drw " << drwname(coll->identify())
+                << "  drw " << drwname(rawChannelCollection->identify())
                 << " whole drawer is bad - skipping");
 
             if (++m_nDrawerOff[drawerIdx] == m_maxVerboseCnt)
               ATH_MSG_VERBOSE( nevtnum.str()
                   << "   suppressing further messages about drawer 0x"
-                  << std::hex << coll->identify() << std::dec << " being bad");
+                  << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
           }
           someDQerrors = true;
           continue;
@@ -995,8 +1000,9 @@ StatusCode TileCellSelector::execute() {
           if (++m_nDrawerOff[drawerIdx] == 2*m_maxVerboseCnt) {
             m_nDrawerOff[drawerIdx] = 0;
             ATH_MSG_VERBOSE( nevtnum.str()
-                << "   enabling messages about drawer 0x" << std::hex << coll->identify()
-                << std::dec << " being bad after " << m_maxVerboseCnt << " good events");
+                             << "   enabling messages about drawer 0x" << std::hex 
+                             << rawChannelCollection->identify()
+                             << std::dec << " being bad after " << m_maxVerboseCnt << " good events");
           }
         }
 
@@ -1016,7 +1022,7 @@ StatusCode TileCellSelector::execute() {
         someDQerrors = (nbadMB >= m_minBadMB);
         if (nbadMB > nbadMBMax) {
           nbadMBMax = nbadMB;
-          collMBMax = coll;
+          collMBMax = rawChannelCollection;
         }
 
         int nerr = 0;
@@ -1041,7 +1047,7 @@ StatusCode TileCellSelector::execute() {
           someDQerrors = true;
           if (nbad > nbadMax) {
             nbadMax = nbad;
-            collMax = coll;
+            collMax = rawChannelCollection;
           }
         }
         if (someDQerrors) { // will print later samples for all channels in a drawer
@@ -1052,13 +1058,9 @@ StatusCode TileCellSelector::execute() {
 
         if (allowAmpCheck || emptyBad) {
 
-          TileRawChannelCollection::const_iterator chItr=coll->begin();
-          TileRawChannelCollection::const_iterator lastCh=coll->end();
+          for (const TileRawChannel* rawChannel : *rawChannelCollection) {
 
-          for(; chItr!=lastCh; ++chItr) {
-
-            const TileRawChannel * pCh = (*chItr);
-            HWIdentifier adcId = pCh->adc_HWID();
+            HWIdentifier adcId = rawChannel->adc_HWID();
             HWIdentifier chId = m_tileHWID->channel_id(adcId);
             m_tileHWID->get_hash(chId, hash, &chan_context);
             int channel = m_tileHWID->channel(adcId);
@@ -1078,12 +1080,12 @@ StatusCode TileCellSelector::execute() {
 
             if (allowAmpCheck) {
 
-              float amp = pCh->amplitude();
-              float time = pCh->time();
+              float amp = rawChannel->amplitude();
+              float time = rawChannel->time();
               if (fillChanEne) {
                 m_chanEne[hash] = amp;
                 m_chanTime[hash] = time;
-                m_chanQua[hash] = pCh->quality();
+                m_chanQua[hash] = rawChannel->quality();
               } else {
                 m_chanDsp[hash] = amp;
                 m_chanTDsp[hash] = time;
@@ -1120,19 +1122,19 @@ StatusCode TileCellSelector::execute() {
 
                 if (amp < chmin) {
                   chmin = amp;
-                  minCh = pCh;
+                  minCh = rawChannel;
                 } else if (amp > chmax) {
                   chmax = amp;
-                  maxCh = pCh;
+                  maxCh = rawChannel;
                 }
 
                 if (time<tcmin) {
                   tcmin = time;
-                  tminCh = pCh;
+                  tminCh = rawChannel;
                 }
                 else if (time>tcmax) {
                   tcmax = time;
-                  tmaxCh = pCh;
+                  tmaxCh = rawChannel;
                 }
               }
             }
@@ -1142,21 +1144,21 @@ StatusCode TileCellSelector::execute() {
         for (index = hashNext - 48; index < hashNext; ++index) {
           if ((m_chanSel[index] && rawdata) || someDQerrors) {
             ATH_MSG_VERBOSE(evtnum.str()
-                            << "  drw " << drwname(coll->identify())
+                            << "  drw " << drwname(rawChannelCollection->identify())
                             << " nBadMB = " <<  nbadMB
                             << " nBadDMU = " <<  nbad
                             << " EvtBCID = " << m_evtBCID
-                            << " DSPBCID = " << coll->getFragDSPBCID()
-                            << " GlobCRC = " << coll->getFragGlobalCRC() << " " << GlobalCRCErr
+                            << " DSPBCID = " << rawChannelCollection->getFragDSPBCID()
+                            << " GlobCRC = " << rawChannelCollection->getFragGlobalCRC() << " " << GlobalCRCErr
                             << " error = 0x" << std::hex << error
-                            << " FE_CRC = 0x"  << coll->getFragFEChipMask()  << " 0x" << FE_DMUmask
-                            << " ROD_CRC = 0x" << coll->getFragRODChipMask() << " 0x" << ROD_DMUmask
-                            << " BCIDErr = 0x" << coll->getFragBCID()        << " 0x" << BCIDErr
-                            << " MemPar = 0x"  << coll->getFragMemoryPar()
-                            << " HeadForm = 0x"<< coll->getFragHeaderBit()
-                            << " HeadPar = 0x" << coll->getFragHeaderPar()
-                            << " SampForm = 0x"<< coll->getFragSampleBit()
-                            << " SampPar = 0x" << coll->getFragSamplePar()
+                            << " FE_CRC = 0x"  << rawChannelCollection->getFragFEChipMask()  << " 0x" << FE_DMUmask
+                            << " ROD_CRC = 0x" << rawChannelCollection->getFragRODChipMask() << " 0x" << ROD_DMUmask
+                            << " BCIDErr = 0x" << rawChannelCollection->getFragBCID()        << " 0x" << BCIDErr
+                            << " MemPar = 0x"  << rawChannelCollection->getFragMemoryPar()
+                            << " HeadForm = 0x"<< rawChannelCollection->getFragHeaderBit()
+                            << " HeadPar = 0x" << rawChannelCollection->getFragHeaderPar()
+                            << " SampForm = 0x"<< rawChannelCollection->getFragSampleBit()
+                            << " SampPar = 0x" << rawChannelCollection->getFragSamplePar()
                             << std::dec);
             break;
           }
@@ -1219,12 +1221,12 @@ StatusCode TileCellSelector::execute() {
   }
 
 
-  if (m_digitsContName.size()>0) {
+  if (!m_digitsContainerKey.key().empty()) {
 
     // Pointer to a Tile digits container
-    const TileDigitsContainer* digits_container;
+    SG::ReadHandle<TileDigitsContainer> digitsContainer(m_digitsContainerKey);
 
-    if (evtStore()->retrieve(digits_container, m_digitsContName).isFailure()) {
+    if (!digitsContainer.isValid()) {
       ATH_MSG_WARNING("Unable to read TileDigitsContainer from EventStore, disable reading of this container");
       m_digitsContName = "";
 
@@ -1239,14 +1241,9 @@ StatusCode TileCellSelector::execute() {
       int nOverLG = 0;
       int nOverHG = 0;
 
-      TileDigitsContainer::const_iterator collItr=digits_container->begin();
-      TileDigitsContainer::const_iterator lastColl=digits_container->end();
-
-      for(; collItr!=lastColl; ++collItr) {
-
-        const TileDigitsCollection * coll  = (*collItr);
+      for (const TileDigitsCollection * digitsCollection : *digitsContainer) {
 
-        int frag = coll->identify();
+        int frag = digitsCollection->identify();
         bool eb = (frag > 0x2ff);
         bool ebsp = (frag == 0x30e || frag == 0x411);
 
@@ -1266,15 +1263,11 @@ StatusCode TileCellSelector::execute() {
         int nChDmu[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
         int nChBadDmu[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
-        TileDigitsCollection::const_iterator digitItr=coll->begin();
-        TileDigitsCollection::const_iterator lastDigit=coll->end();
-
-        for(; digitItr!=lastDigit; ++digitItr) {
+        for (const TileDigits* tile_digits : *digitsCollection) {
 
           ++nChTot;
 
-          const TileDigits * pDig = (*digitItr);
-          HWIdentifier adcId = pDig->adc_HWID();
+          HWIdentifier adcId = tile_digits->adc_HWID();
           HWIdentifier chId = m_tileHWID->channel_id(adcId);
           m_tileHWID->get_hash(chId, hash, &chan_context);
           int channel = m_tileHWID->channel(adcId);
@@ -1344,11 +1337,11 @@ StatusCode TileCellSelector::execute() {
           sprintf(badnm," BADDIGIEX%s",badname);
           float dmin,dmax;
 
-          std::vector<float> fdigits = pDig->samples();
-          int nSamp = fdigits.size();
+          std::vector<float> samples = tile_digits->samples();
+          int nSamp = samples.size();
           if (nSamp > 6) {
 
-            int err = TileRawChannelBuilder::CorruptedData(ros,drawer,channel,adc,fdigits,dmin,dmax);
+            int err = TileRawChannelBuilder::CorruptedData(ros,drawer,channel,adc,samples,dmin,dmax);
 
             if (badname[0]==0) {
               if (err && err>-3) { // do not consider all zeros in empty samples as error
@@ -1371,7 +1364,7 @@ StatusCode TileCellSelector::execute() {
               } else {
                 // old error types, used for tests in August 2012
                 // expect to see only warningE7 and warningE8 for gap/crack
-                int warn = Are3FF(fdigits, adc, ch_type);
+                int warn = Are3FF(samples, adc, ch_type);
                 if (warn) {
                   m_chanSel[hash] = m_checkJumps;
                   sprintf(badnm," warningE%d%s",warn,badname);
@@ -1408,7 +1401,7 @@ StatusCode TileCellSelector::execute() {
               float pedDelta = (adc ? m_pedDeltaHG : m_pedDeltaLG);
               float jumpDelta = (adc ? m_jumpDeltaHG : m_jumpDeltaLG);
 
-              float ped = fdigits[0];
+              float ped = samples[0];
               float dmin = ped;
               float dmax = ped;
               int nped = 1;
@@ -1416,7 +1409,7 @@ StatusCode TileCellSelector::execute() {
               bool cnstPed = true;
               bool cnstPedmax = true;
               for (int i = 1; i < nSamp; ++i) {
-                float smp = fdigits[i];
+                float smp = samples[i];
                 float dped = smp - ped;
                 if (fabs(dped) < pedDelta) {
                   ++nped;
@@ -1469,7 +1462,7 @@ StatusCode TileCellSelector::execute() {
                 float abovemin = dmax;
                 float belowmax = dmin;
                 for (int i = 0; i < nSamp; ++i) {
-                  float smp = fdigits[i];
+                  float smp = samples[i];
                   if (smp - dmin < pedDelta) {
                     ++nmin;
                     pmin = i;
@@ -1530,7 +1523,7 @@ StatusCode TileCellSelector::execute() {
                   jumpOve = true;
                 }
                 float secondMax = (dmax-dmin)*m_secondMaxLevel;
-                if (pmax > 0 && pmax < nSamp-1 && std::max(fdigits[pmax-1], fdigits[pmax+1]) < dmin+secondMax) {
+                if (pmax > 0 && pmax < nSamp-1 && std::max(samples[pmax-1], samples[pmax+1]) < dmin+secondMax) {
                   if (!accJump) {
                     ++nJump;
                     accJump = true;
@@ -1541,7 +1534,7 @@ StatusCode TileCellSelector::execute() {
                   }
                   narrowUp = true;
                 }
-                if (pmin > 0 && pmin < nSamp - 1 && std::min(fdigits[pmin - 1], fdigits[pmin + 1]) > dmax - secondMax) {
+                if (pmin > 0 && pmin < nSamp - 1 && std::min(samples[pmin - 1], samples[pmin + 1]) > dmax - secondMax) {
                   if (!accJump) {
                     ++nJump;
                     accJump = true;
@@ -1557,9 +1550,9 @@ StatusCode TileCellSelector::execute() {
                   someSampErrors = true;
                   ATH_MSG_VERBOSE (evtnum.str()
                                    << " chan " << std::left << std::setw(14) << m_tileHWID->to_string(adcId)
-                                   << enename << m_chanEne[hash] << "  samp = " << fdigits[0]
-                                   << " " << fdigits[1] << " " << fdigits[2] << " " << fdigits[3]
-                                   << " " << fdigits[4] << " " << fdigits[5] << " " << fdigits[6]
+                                   << enename << m_chanEne[hash] << "  samp = " << samples[0]
+                                   << " " << samples[1] << " " << samples[2] << " " << samples[3]
+                                   << " " << samples[4] << " " << samples[5] << " " << samples[6]
                                    << timename << m_chanTime[hash]
                                    << qualname << m_chanQua[hash]
                                    << cellname << badname
@@ -1588,9 +1581,9 @@ StatusCode TileCellSelector::execute() {
               bool jumpOve = (dmax>1022.9);
               ATH_MSG_VERBOSE(evtnum.str()
                               << " chan " << std::left << std::setw(14) << m_tileHWID->to_string(adcId)
-                              << enename << m_chanEne[hash] << "  samp = " << fdigits[0]
-                              << " " << fdigits[1] << " " << fdigits[2] << " " << fdigits[3]
-                              << " " << fdigits[4] << " " << fdigits[5] << " " << fdigits[6]
+                              << enename << m_chanEne[hash] << "  samp = " << samples[0]
+                              << " " << samples[1] << " " << samples[2] << " " << samples[3]
+                              << " " << samples[4] << " " << samples[5] << " " << samples[6]
                               << timename << m_chanTime[hash]
                               << qualname << m_chanQua[hash]
                               << cellname << badname
@@ -1632,18 +1625,14 @@ StatusCode TileCellSelector::execute() {
 
             ++nDmuErr;
 
-            TileDigitsCollection::const_iterator digitItr = coll->begin();
-            TileDigitsCollection::const_iterator lastDigit = coll->end();
-
-            for (; digitItr != lastDigit; ++digitItr) {
+            for (const TileDigits* tile_digits : *digitsCollection) {
 
-              const TileDigits * pDig = (*digitItr);
-              HWIdentifier adcId = pDig->adc_HWID();
+              HWIdentifier adcId = tile_digits->adc_HWID();
               HWIdentifier chId = m_tileHWID->channel_id(adcId);
               m_tileHWID->get_hash(chId, hash, &chan_context);
-              std::vector<float> fdigits = pDig->samples();
+              std::vector<float> samples = tile_digits->samples();
 
-              if (!m_chanSel[hash] && fdigits.size()>6) {
+              if (!m_chanSel[hash] && samples.size()>6) {
                 int channel = m_tileHWID->channel(adcId);
                 int adc = m_tileHWID->adc(adcId);
                 const char *cellname = "";
@@ -1679,7 +1668,7 @@ StatusCode TileCellSelector::execute() {
                 float dmin, dmax;
 
                 int err = TileRawChannelBuilder::CorruptedData(ros, drawer,
-                    channel, adc, fdigits, dmin, dmax);
+                    channel, adc, samples, dmin, dmax);
 
                 if (err) {
                   bool isConnected = (TileDQstatus::isChEmpty(ros, drawer,
@@ -1719,9 +1708,9 @@ StatusCode TileCellSelector::execute() {
 
                 ATH_MSG_VERBOSE(evtnum.str()
                                 << " chan " << std::left << std::setw(14) << m_tileHWID->to_string(adcId)
-                                << enename << m_chanEne[hash] << "  samp = " << fdigits[0]
-                                << " " << fdigits[1] << " " << fdigits[2] << " " << fdigits[3]
-                                << " " << fdigits[4] << " " << fdigits[5] << " " << fdigits[6]
+                                << enename << m_chanEne[hash] << "  samp = " << samples[0]
+                                << " " << samples[1] << " " << samples[2] << " " << samples[3]
+                                << " " << samples[4] << " " << samples[5] << " " << samples[6]
                                 << timename << m_chanTime[hash]
                                 << qualname << m_chanQua[hash]
                                 << cellname << badname
@@ -1742,7 +1731,7 @@ StatusCode TileCellSelector::execute() {
             }
           }
           ATH_MSG_VERBOSE (evtnum.str()
-                           << "  drw " << drwname(coll->identify()) << badstr.str());
+                           << "  drw " << drwname(digitsCollection->identify()) << badstr.str());
         }
       }
 
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.cxx
index 7acaa4649b4..19da598446f 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.cxx
@@ -19,20 +19,18 @@
 //
 //*****************************************************************************
 
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
+// Tile includes
+#include "TileRecAlgs/TileCellToTTL1.h"
+#include "TileConditions/TileCablingService.h"
 
 // Calo includes
 #include "CaloIdentifier/TileID.h"
 #include "CaloIdentifier/CaloLVL1_ID.h"
-#include "CaloEvent/CaloCellContainer.h"
 
-// Tile includes
-#include "TileEvent/TileContainer.h"
-#include "TileEvent/TileTTL1Container.h"
-#include "TileEvent/TileTTL1CellContainer.h"
-#include "TileConditions/TileCablingService.h"
-#include "TileRecAlgs/TileCellToTTL1.h"
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
 
 //C++ STL includes
 #include <vector>
@@ -46,8 +44,7 @@ TileCellToTTL1::TileCellToTTL1(std::string name, ISvcLocator* pSvcLocator)
   , m_TT_ID(0)
   , m_tileCablingService(0)
 {
-  declareProperty("CaloCellContainer", m_caloCellContainer = "AllCalo");
-  declareProperty("TileCellTTL1Container", m_cellTTL1Container = "TileCellTTL1Container");
+
 }
 
 TileCellToTTL1::~TileCellToTTL1() {
@@ -64,6 +61,9 @@ StatusCode TileCellToTTL1::initialize() {
 
   m_tileCablingService = TileCablingService::getInstance();
 
+  ATH_CHECK( m_cellContainerKey.initialize() );
+  ATH_CHECK( m_ttl1CellContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileCellToTTL1 initialization completed");
 
   return StatusCode::SUCCESS;
@@ -79,17 +79,18 @@ StatusCode TileCellToTTL1::execute() {
   // -------------------------------------------------
   // Load the TileCell container
   // -------------------------------------------------
-  typedef CaloCellContainer CONTAINER;
 
-  const CONTAINER* cellcoll;
-  CHECK( evtStore()->retrieve(cellcoll, m_caloCellContainer));
+  SG::ReadHandle<CaloCellContainer> cellContainer(m_cellContainerKey);
+  ATH_CHECK( cellContainer.isValid() );
 
   // -------------------------------------------------
   // Create TTL1 container and other arrays
   // -------------------------------------------------
+  SG::WriteHandle<TileTTL1CellContainer> ttl1CellContainer(m_ttl1CellContainerKey);
 
-  TileTTL1CellContainer* pTTL1Container = new TileTTL1CellContainer();
-  TileTTL1Cell* pTTL1;
+  // Register the TTL1 container in the TES
+  ATH_CHECK( ttl1CellContainer.record(std::make_unique<TileTTL1CellContainer>()) );
+  ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_ttl1CellContainerKey.key() << ")");
 
   int ttNpmt[32][64];       // array of TT occupancy
   Identifier ttId[32][64];  // array of TT identifiers
@@ -116,10 +117,7 @@ StatusCode TileCellToTTL1::execute() {
   // Loop over all cells
   // -------------------------------------------------
 
-  CONTAINER::const_iterator f_cell = cellcoll->begin();
-  CONTAINER::const_iterator l_cell = cellcoll->end();
-  for (; f_cell != l_cell; ++f_cell) {
-    const CaloCell* cell = (*f_cell);
+  for (const CaloCell* cell : *cellContainer) {
 
     // keep only cells from TileCal calorimeter barrel or extended barrel
     Identifier cell_id = cell->ID();
@@ -200,17 +198,15 @@ StatusCode TileCellToTTL1::execute() {
       if (ttStatusChans[ieta][iphi] > 0)
         qual += TileTTL1Cell::MASK_BADCHAN;
 
-      pTTL1 = new TileTTL1Cell(ttId[ieta][iphi], ttAmp[ieta][iphi], time_ave,
-          ttCorrFact[ieta][iphi], qual);
-      pTTL1Container->push_back(pTTL1);
+      ttl1CellContainer->push_back(std::make_unique<TileTTL1Cell>(ttId[ieta][iphi], 
+                                                                  ttAmp[ieta][iphi], 
+                                                                  time_ave,
+                                                                  ttCorrFact[ieta][iphi], 
+                                                                  qual));
 
     }
   }
 
-  // Register the TTL1 container in the TES
-  CHECK( evtStore()->record(pTTL1Container, m_cellTTL1Container, false) );
-
-  ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_cellTTL1Container << ")");
 
   // Execution completed
   ATH_MSG_DEBUG( "TileCellToTTL1 execution completed.");
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx
index 4020a71473b..d7f3628da20 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx
@@ -16,16 +16,17 @@
 //
 //*****************************************************************************
 
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
+// Tile includes
+#include "TileEvent/TileCell.h"
+#include "TileRecAlgs/TileCellVerify.h"
 
 // Calo includes
-#include "CaloEvent/CaloCellContainer.h"
 #include "CaloIdentifier/TileID.h"
 
-// Tile includes
-#include "TileEvent/TileCell.h"
-#include "TileRecAlgs/TileCellVerify.h"
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "AthenaKernel/errorcheck.h"
+
 
 //C++ STL includes
 #include <vector>
@@ -47,16 +48,11 @@ class CompCell: public binary_function<const CaloCell*, const CaloCell*, bool> {
 // Constructor
 TileCellVerify::TileCellVerify(string name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
-  , m_cellContainer1("TileCellContainer1")
-  , m_cellContainer2("TileCellContainer2")
   , m_tileID(0)
   , m_dumpCells(false)
   , m_sortFlag(false)
 
 {
-
-  declareProperty("TileCellContainer1", m_cellContainer1);
-  declareProperty("TileCellContainer2", m_cellContainer2);
   declareProperty("DumpCells", m_dumpCells);
   declareProperty("SortFlag", m_sortFlag);
 }
@@ -70,6 +66,9 @@ StatusCode TileCellVerify::initialize() {
   // retrieve TileID helper from det store
   CHECK( detStore()->retrieve(m_tileID) );
 
+  ATH_CHECK( m_cellContainer1Key.initialize() );
+  ATH_CHECK( m_cellContainer2Key.initialize() );
+
   ATH_MSG_INFO( "TileCellVerify initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -78,42 +77,43 @@ StatusCode TileCellVerify::initialize() {
 StatusCode TileCellVerify::execute() {
 
   // step1: read two cell containers from TES
-  const CaloCellContainer* pCellContainer1;
-  const CaloCellContainer* pCellContainer2;
-  CHECK( evtStore()->retrieve(pCellContainer1, m_cellContainer1) );
-  CHECK( evtStore()->retrieve(pCellContainer2, m_cellContainer2) );
+  SG::ReadHandle<CaloCellContainer> cellContainer1(m_cellContainer1Key);
+  ATH_CHECK(cellContainer1.isValid());
+
+  SG::ReadHandle<CaloCellContainer> cellContainer2(m_cellContainer2Key);
+  ATH_CHECK(cellContainer2.isValid());
 
   // step2: first compare the number of cells in the two containers
-  int nCells1 = pCellContainer1->size();
-  int nCells2 = pCellContainer2->size();
-  ATH_MSG_INFO( "The number of cells in " << m_cellContainer1 << " is " << nCells1 );
-  ATH_MSG_INFO( "The number of cells in " << m_cellContainer2 << " is " << nCells2 );
+  int nCells1 = cellContainer1->size();
+  int nCells2 = cellContainer2->size();
+  ATH_MSG_INFO( "The number of cells in " << m_cellContainer1Key.key() << " is " << nCells1 );
+  ATH_MSG_INFO( "The number of cells in " << m_cellContainer2Key.key() << " is " << nCells2 );
 
   if (nCells1 != nCells2) {
     ATH_MSG_ERROR( "The number of cells is not equal in the two cell "
-        << "containers: " << m_cellContainer1 << " and " << m_cellContainer2 );
+                   << "containers: " << m_cellContainer1Key.key() 
+                   << " and " << m_cellContainer2Key.key() );
 
     return (StatusCode::SUCCESS);
   }
 
   // step3: to sort the cells in the container read above by energy
-  vector<const CaloCell*> v1;
-  vector<const CaloCell*> v2;
-  const CaloCell* pCell1;
-  const CaloCell* pCell2;
+  vector<const CaloCell*> cells1;
+  vector<const CaloCell*> cells2;
+  const CaloCell* cell1(nullptr);
+  const CaloCell* cell2(nullptr);
   if (m_sortFlag) {
-    CaloCellContainer::const_iterator it = pCellContainer1->begin();
-    CaloCellContainer::const_iterator itLast = pCellContainer1->end();
-    for (; it != itLast; ++it) {
-      v1.push_back(*it);
+
+    for (const CaloCell* cell : *cellContainer1) {
+      cells1.push_back(cell);
     }
-    it = pCellContainer2->begin();
-    itLast = pCellContainer2->end();
-    for (; it != itLast; ++it) {
-      v2.push_back(*it);
+
+    for (const CaloCell* cell : *cellContainer2) {
+      cells2.push_back(cell);
     }
-    sort(v1.begin(), v1.end(), CompCell());
-    sort(v2.begin(), v2.end(), CompCell());
+
+    sort(cells1.begin(), cells1.end(), CompCell());
+    sort(cells2.begin(), cells2.end(), CompCell());
   }
 
   // step4: then compare every cell-pair in the containers
@@ -123,28 +123,28 @@ StatusCode TileCellVerify::execute() {
   for (int i = 0; i < nCells1; ++i) {
 
     if (m_sortFlag) {
-      pCell1 = v1[i];
-      pCell2 = v2[i];
+      cell1 = cells1[i];
+      cell2 = cells2[i];
     } else {
-      pCell1 = (*pCellContainer1)[i];
-      pCell2 = (*pCellContainer2)[i];
+      cell1 = (*cellContainer1)[i];
+      cell2 = (*cellContainer2)[i];
     }
 
-    Identifier id1 = pCell1->ID();
-    Identifier id2 = pCell2->ID();
+    Identifier id1 = cell1->ID();
+    Identifier id2 = cell2->ID();
     if (id1 != id2) bErrorFlag = true;
     if (lVerbose && (m_dumpCells || bErrorFlag)) {
 
       if (!bOnlyOnceFlag) {
-        msg(MSG::VERBOSE) << "  ===" << m_cellContainer1 << "===      ===" << m_cellContainer2 << "===" << endmsg;
+        msg(MSG::VERBOSE) << "  ===" << m_cellContainer1Key.key() << "===      ===" << m_cellContainer2Key.key() << "===" << endmsg;
         msg(MSG::VERBOSE) << "  Index      e1            id1        |        e2           id2" << endmsg;
         msg(MSG::VERBOSE) << "--------------------------------------------------------------------------------" << endmsg;
         bOnlyOnceFlag = true;
       }
 
-      msg(MSG::VERBOSE) << setw(5) << i << "   " << setw(12) << pCell1->energy() << "   [";
+      msg(MSG::VERBOSE) << setw(5) << i << "   " << setw(12) << cell1->energy() << "   [";
       msg(MSG::VERBOSE) << m_tileID->to_string(id1, -2) << "]";
-      msg(MSG::VERBOSE) << "  |  " << setw(12) << pCell2->energy() << "   [";
+      msg(MSG::VERBOSE) << "  |  " << setw(12) << cell2->energy() << "   [";
       msg(MSG::VERBOSE) << m_tileID->to_string(id2, -2) << "]";
 
       if (bErrorFlag) msg(MSG::VERBOSE) << " * ";
@@ -159,11 +159,11 @@ StatusCode TileCellVerify::execute() {
     msg(MSG::VERBOSE) << "--------------------------------------------------------------------------------" << endmsg;
   }
   if (!bErrorFlag) {
-    ATH_MSG_INFO( "The two cellContainers (" << m_cellContainer1
-        << " and " << m_cellContainer2 << ") are same!!!" );
+    ATH_MSG_INFO( "The two cellContainers (" << m_cellContainer1Key.key()
+                  << " and " << m_cellContainer2Key.key() << ") are same!!!" );
   } else {
-    ATH_MSG_INFO( "The two cellContainers (" << m_cellContainer1
-        << " and " << m_cellContainer2 << ") are not same!!!" );
+    ATH_MSG_INFO( "The two cellContainers (" << m_cellContainer1Key.key()
+                  << " and " << m_cellContainer2Key.key() << ") are not same!!!" );
   }
 
   // Execution completed.
diff --git a/TileCalorimeter/TileRecAlgs/src/TileDigitsFilter.cxx b/TileCalorimeter/TileRecAlgs/src/TileDigitsFilter.cxx
index 93f697bd650..69b57489676 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileDigitsFilter.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileDigitsFilter.cxx
@@ -18,15 +18,15 @@
 //
 //*****************************************************************************
 
+// Tile includes
+#include "TileRecAlgs/TileDigitsFilter.h"
+
 // Atlas includes
 #include "AthContainers/ConstDataVector.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
 #include "AthenaKernel/errorcheck.h"
 
-// Tile includes
-#include "TileEvent/TileDigitsContainer.h"
-#include "TileEvent/TileRawChannelContainer.h"
-#include "TileRecAlgs/TileDigitsFilter.h"
-
 //C++ STL includes
 #include <vector>
 #include <set>
@@ -38,10 +38,6 @@ TileDigitsFilter::TileDigitsFilter(std::string name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
   , m_tileHWID(0)
 {
-  declareProperty("InputDigitsContainer", m_inputContainer = "TileDigitsCnt");
-  declareProperty("OutputDigitsContainer", m_outputContainer = "TileDigitsFlt");
-  declareProperty("InputRawChannelContainer", m_inRchContainer = "TileRawChannelCnt");
-  declareProperty("OutputRawChannelContainer", m_outRchContainer = "TileRawChannelFlt");
   declareProperty("LowGainThereshold", m_threshold[0] = 0); // keep all LG except zeros
   declareProperty("HighGainThereshold", m_threshold[1] = 10); // keep signals above ~128(106) MeV in A,BC(D) samplings
 }
@@ -56,15 +52,33 @@ StatusCode TileDigitsFilter::initialize() {
 
   CHECK( detStore()->retrieve(m_tileHWID) );
 
-  ATH_MSG_INFO( "Input digits container: '" << m_inputContainer
-                << "'  output container: '" << m_outputContainer << "'" );
+  ATH_MSG_INFO( "Input digits container: '" << m_inputDigitsContainerKey.key()
+                << "'  output container: '" << m_outputDigitsContainerKey.key() << "'" );
 
-  ATH_MSG_INFO( "Input raw channel container: '" << m_inRchContainer
-                << "'  output container: '" << m_outRchContainer << "'" );
+  ATH_MSG_INFO( "Input raw channel container: '" << m_inputRawChannelContainerKey.key()
+                << "'  output container: '" << m_outputRawChannelContainerKey.key() << "'" );
 
   ATH_MSG_INFO( "Threshold low gain: " << m_threshold[0]
                 << " counts,  high gain: " << m_threshold[1] << " counts" );
 
+
+  if (!m_inputDigitsContainerKey.key().empty()) {
+    ATH_CHECK( m_inputDigitsContainerKey.initialize() );
+  }
+
+  if (!m_outputDigitsContainerKey.key().empty()) {
+    ATH_CHECK( m_outputDigitsContainerKey.initialize() );
+  }
+
+  if (!m_inputRawChannelContainerKey.key().empty()) {
+    ATH_CHECK( m_inputRawChannelContainerKey.initialize() );
+  }
+
+  if (!m_outputRawChannelContainerKey.key().empty()) {
+    ATH_CHECK( m_outputRawChannelContainerKey.initialize() );
+  }
+
+
   ATH_MSG_INFO( "initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -75,10 +89,11 @@ StatusCode TileDigitsFilter::initialize() {
 //
 StatusCode TileDigitsFilter::execute() {
 
+  ATH_MSG_DEBUG( "in execute()" );
+
   int digCounter = 0;
   int rchCounter = 0;
 
-  ATH_MSG_DEBUG( "in execute()" );
 
   // Create new container for filtered digits
   auto outputCont = std::make_unique<TileDigitsContainer>(false, SG::VIEW_ELEMENTS);
@@ -92,15 +107,17 @@ StatusCode TileDigitsFilter::execute() {
   collItr = lastColl = outputCont->end();
 
   // Get digit container from TES
-  if (m_inputContainer.size() > 0) {
-    const TileDigitsContainer* inputCont;
-    if (evtStore()->retrieve(inputCont, m_inputContainer).isFailure()) {
-      ATH_MSG_WARNING( "can't retrieve TileDigitsContainer with name '"
-                       << m_inputContainer << "' from TDS" );
+  if (!m_inputDigitsContainerKey.key().empty()) {
+    SG::ReadHandle<TileDigitsContainer> inputDigitsContainer(m_inputDigitsContainerKey);
+
+    if (inputDigitsContainer.isValid()) {
+      collItr = inputDigitsContainer->begin();
+      lastColl = inputDigitsContainer->end();
     } else {
-      collItr = inputCont->begin();
-      lastColl = inputCont->end();
+      ATH_MSG_WARNING( "can't retrieve TileDigitsContainer with name '"
+                       << m_inputDigitsContainerKey.key() << "' from TDS" );
     }
+
   }
 
   TileRawChannelContainer::const_iterator firstRchColl, lastRchColl, collRchItr;
@@ -109,18 +126,20 @@ StatusCode TileDigitsFilter::execute() {
   bool emptyRch = true;
 
   // Get rawChannel container from TES
-  if (m_inRchContainer.size() > 0) {
-    const TileRawChannelContainer* inRchCont;
-    if (evtStore()->retrieve(inRchCont, m_inRchContainer).isFailure()) {
-      ATH_MSG_WARNING( "can't retrieve TileRawChannelContainer with name '"
-                       << m_inRchContainer << "' from TDS" );
-    } else {
-      collRchItr = firstRchColl = inRchCont->begin();
-      lastRchColl = inRchCont->end();
+  if (!m_inputRawChannelContainerKey.key().empty()) {
+    SG::ReadHandle<TileRawChannelContainer> inputRawChannelContainer(m_inputRawChannelContainerKey);
+
+    if (inputRawChannelContainer.isValid()) {
+      collRchItr = firstRchColl = inputRawChannelContainer->begin();
+      lastRchColl = inputRawChannelContainer->end();
       emptyRch = (firstRchColl == lastRchColl);
-      type = inRchCont->get_type();
-      unit = inRchCont->get_unit();
+      type = inputRawChannelContainer->get_type();
+      unit = inputRawChannelContainer->get_unit();
+    } else {
+      ATH_MSG_WARNING( "can't retrieve TileRawChannelContainer with name '"
+                       << m_inputRawChannelContainerKey.key() << "' from TDS" );
     }
+
   }
 
   // Create new container for filtered raw channels
@@ -195,8 +214,7 @@ StatusCode TileDigitsFilter::execute() {
           << " and TileRawChannelCollection ID 0x" << (*collRchItr)->identify()
           << " do not match " << MSG::dec );
 
-    }
-    else {
+    } else {
       const TileRawChannelCollection* collRch = *collRchItr;
       auto outRchColl = std::make_unique<ConstDataVector<TileRawChannelCollection> >
         (SG::VIEW_ELEMENTS, collRch->identify());
@@ -220,17 +238,22 @@ StatusCode TileDigitsFilter::execute() {
   ATH_MSG_DEBUG( digCounter << " digits and "
                 << rchCounter << " raw channels stored in output containers");
 
-  if (m_outputContainer.size() > 0) {
+  if (!m_outputDigitsContainerKey.key().empty()) {
     // register new container in the TES
-    CHECK( evtStore()->record(std::move(outputCont), m_outputContainer, false));
-    ATH_MSG_DEBUG( "TileDigitsContainer registered successfully (" << m_outputContainer << ")");
+    SG::WriteHandle<TileDigitsContainer> outputDigitsContainer(m_outputDigitsContainerKey);
+    ATH_CHECK( outputDigitsContainer.record(std::move(outputCont)) );
+
+    ATH_MSG_DEBUG( "TileDigitsContainer registered successfully (" << m_outputDigitsContainerKey.key() << ")");
 
   }
 
-  if (m_outRchContainer.size() > 0) {
+  if (!m_outputRawChannelContainerKey.key().empty()) {
     // register new container in the TES
-    CHECK( evtStore()->record(std::move(outRchCont), m_outRchContainer, false));
-    ATH_MSG_DEBUG( "TileRawChannelContainer registered successfully (" << m_outRchContainer << ")");
+    SG::WriteHandle<TileRawChannelContainer> outputRawChannelContainer(m_outputRawChannelContainerKey);
+    ATH_CHECK( outputRawChannelContainer.record(std::move(outRchCont)) );
+
+    ATH_MSG_DEBUG( "TileRawChannelContainer registered successfully (" 
+                   << m_outputRawChannelContainerKey.key() << ")");
   }
 
   // Execution completed.
diff --git a/TileCalorimeter/TileRecAlgs/src/TileDigitsThresholdFilter.cxx b/TileCalorimeter/TileRecAlgs/src/TileDigitsThresholdFilter.cxx
index 3a897733ecc..4e1a1855b63 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileDigitsThresholdFilter.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileDigitsThresholdFilter.cxx
@@ -17,7 +17,7 @@
 
 // Tile includes
 #include "TileRecAlgs/TileDigitsThresholdFilter.h"
-#include "TileEvent/TileDigitsContainer.h"
+
 #include "TileEvent/TileRawChannelContainer.h"
 #include "TileConditions/TileCondToolDspThreshold.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
@@ -25,10 +25,11 @@
 
 // Atlas includes
 #include "AthContainers/ConstDataVector.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
 #include "AthenaKernel/errorcheck.h"
 
 
-
 //C++ STL includes
 #include <vector>
 #include <algorithm>
@@ -42,8 +43,6 @@ TileDigitsThresholdFilter::TileDigitsThresholdFilter(std::string name, ISvcLocat
   , m_tileHWID(nullptr)
   , m_tileDspThreshold("TileCondToolDspThreshold")
 {
-  declareProperty("InputDigitsContainer", m_inputContainer = "TileDigitsCnt");
-  declareProperty("OutputDigitsContainer", m_outputContainer = "TileDigitsFiltered");
   declareProperty("TileCondToolDspThreshold", m_tileDspThreshold);
 }
 
@@ -59,9 +58,11 @@ StatusCode TileDigitsThresholdFilter::initialize() {
 
   CHECK( m_tileDspThreshold.retrieve() );
 
-  ATH_MSG_INFO( "Input digits container: '" << m_inputContainer
-                << "'  output container: '" << m_outputContainer << "'" );
+  ATH_MSG_INFO( "Input digits container: '" << m_inputDigitsContainerKey.key()
+                << "'  output container: '" << m_outputDigitsContainerKey.key() << "'" );
 
+  ATH_CHECK( m_inputDigitsContainerKey.initialize() );
+  ATH_CHECK( m_outputDigitsContainerKey.initialize() );
 
   ATH_MSG_INFO( "initialization completed" );
 
@@ -76,29 +77,29 @@ StatusCode TileDigitsThresholdFilter::initialize() {
 StatusCode TileDigitsThresholdFilter::execute() {
 
   // Create new container for filtered digits
-  auto outputContainer = std::make_unique<TileDigitsContainer>(false, SG::VIEW_ELEMENTS);
+  SG::WriteHandle<TileDigitsContainer> outputDigitsContainer(m_outputDigitsContainerKey);
+  ATH_CHECK( outputDigitsContainer.record(std::make_unique<TileDigitsContainer>(false, SG::VIEW_ELEMENTS)) );
   
+  SG::ReadHandle<TileDigitsContainer> inputDigitsContainer(m_inputDigitsContainerKey);
+  ATH_CHECK( inputDigitsContainer.isValid() );
 
-  const TileDigitsContainer* inputContainer(nullptr);
-  CHECK( evtStore()->retrieve(inputContainer, m_inputContainer) );
+  outputDigitsContainer->set_unit(inputDigitsContainer->get_unit());
+  outputDigitsContainer->set_type(inputDigitsContainer->get_type());
+  outputDigitsContainer->set_bsflags(inputDigitsContainer->get_bsflags());
 
-  outputContainer->set_unit(inputContainer->get_unit());
-  outputContainer->set_type(inputContainer->get_type());
-  outputContainer->set_bsflags(inputContainer->get_bsflags());
+  TileDigitsContainer::const_iterator collItr = inputDigitsContainer->begin();
+  TileDigitsContainer::const_iterator collEnd = inputDigitsContainer->end();
 
-  TileDigitsContainer::const_iterator collItr = inputContainer->begin();
-  TileDigitsContainer::const_iterator collEnd = inputContainer->end();
   for (; collItr != collEnd; ++collItr) {
-    const TileDigitsCollection* digitsCollection = *collItr;
+    const TileDigitsCollection* digitsCollection = *collItr; 
 
-    auto outColl = std::make_unique<ConstDataVector<TileDigitsCollection> >
+    auto outputDigitsCollection = std::make_unique<ConstDataVector<TileDigitsCollection> >
       (SG::VIEW_ELEMENTS, digitsCollection->identify());
 
     int fragId = digitsCollection->identify();
     unsigned int drawerIdx = TileCalibUtils::getDrawerIdxFromFragId(fragId);
 
-    for (const TileDigits* tile_digits : *digitsCollection)
-    {
+    for (const TileDigits* tile_digits : *digitsCollection) {
       HWIdentifier adcId = tile_digits->adc_HWID();
       int channel = m_tileHWID->channel(adcId);
       int gain = m_tileHWID->adc(adcId);
@@ -111,16 +112,15 @@ StatusCode TileDigitsThresholdFilter::execute() {
       float maxDigit = *minMaxDigits.second;
 
       if (maxDigit - minDigit > dspThreshold) {
-        outColl->push_back(tile_digits);
+        outputDigitsCollection->push_back(tile_digits);
       }
 
     }
-    ATH_CHECK( outputContainer->addCollection (outColl.release()->asDataVector(),
-                                               collItr.hashId()) );
+    ATH_CHECK( outputDigitsContainer->addCollection (outputDigitsCollection.release()->asDataVector(), 
+                                                     collItr.hashId()) );
     
   }
 
-  CHECK( evtStore()->record(std::move(outputContainer), m_outputContainer, false) );
 
   return StatusCode::SUCCESS;
 }
diff --git a/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.cxx b/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.cxx
index d1286f42eae..a47e6e6960f 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.cxx
@@ -30,29 +30,29 @@
 //
 //*****************************************************************************
 
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
-
-// Calo includes
-#include "CaloIdentifier/TileID.h"
-#include "CaloIdentifier/CaloLVL1_ID.h"
-
 // Tile includes
+#include "TileRecAlgs/TileDigitsToTTL1.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileConditions/TileInfo.h"
 #include "TileConditions/TileCondToolEmscale.h"
-#include "TileEvent/TileDigitsContainer.h"
-#include "TileEvent/TileTTL1Container.h"
-#include "TileRecAlgs/TileDigitsToTTL1.h"
+
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+#include "CaloIdentifier/CaloLVL1_ID.h"
+
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
 
 //CLHEP includes
 #include <CLHEP/Random/Randomize.h>
 
-using namespace CLHEP;
-
 //C++ STL includes
 #include <vector>
+#include <memory>
+
 
 //
 // Constructor
@@ -69,8 +69,6 @@ TileDigitsToTTL1::TileDigitsToTTL1(std::string name, ISvcLocator* pSvcLocator)
   m_rChType = TileFragHash::FitFilter;
 
   declareProperty("TileInfoName", m_infoName = "TileInfo");
-  declareProperty("TileDigitsContainer", m_digitsContainer = "TileDigitsCnt");    
-  declareProperty("TileTTL1Container", m_TTL1Container = "TileTTL1Container");
   declareProperty("TileCondToolEmscale"    , m_tileToolEmscale);
 }
 
@@ -93,6 +91,9 @@ StatusCode TileDigitsToTTL1::initialize() {
 
   CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
 
+  ATH_CHECK(m_digitsContainerKey.initialize());
+  ATH_CHECK(m_ttl1ContainerKey.initialize());
+
   ATH_MSG_INFO( "TileDigitsToTTL1 initialisation completed" );
 
   return StatusCode::SUCCESS;
@@ -128,11 +129,12 @@ StatusCode TileDigitsToTTL1::execute() {
   // step 3:  Get digit container from TES and create TTL1 container
   /* Note that digit container has 256 collections (one for each drawer),
    but TTL1 container has no collections and no structure. */
-  const TileDigitsContainer* digitCont;
-  CHECK( evtStore()->retrieve(digitCont, m_digitsContainer) );
+  SG::ReadHandle<TileDigitsContainer> digitsContainer(m_digitsContainerKey);
+  ATH_CHECK( digitsContainer.isValid() );
 
-  TileTTL1Container * pTTL1Container = new TileTTL1Container();
-  TileTTL1 * pTTL1;
+  SG::WriteHandle<TileTTL1Container> ttl1Container(m_ttl1ContainerKey);
+  ATH_CHECK( ttl1Container.record(std::make_unique<TileTTL1Container>()) );
+  ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_ttl1ContainerKey.key() << ")" );
 
   /*......................................................*/
   // Step 4: Create temporary arrays for processing signals.
@@ -154,12 +156,9 @@ StatusCode TileDigitsToTTL1::execute() {
 
   /*......................................................*/
   // Step 5: Begin loop over all collections (collection = electronic drawer). 
-  TileDigitsContainer::const_iterator collItr = digitCont->begin();
-  TileDigitsContainer::const_iterator lastColl = digitCont->end();
-
-  for (; collItr != lastColl; ++collItr) {
+  for (const TileDigitsCollection* digitsCollection : *digitsContainer) {
 
-    HWIdentifier drawer_id = m_tileHWID->drawer_id((*collItr)->identify());
+    HWIdentifier drawer_id = m_tileHWID->drawer_id(digitsCollection->identify());
     int ros = m_tileHWID->ros(drawer_id);
     int drawer = m_tileHWID->drawer(drawer_id);
     int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
@@ -199,36 +198,34 @@ StatusCode TileDigitsToTTL1::execute() {
 
     /*......................................................*/
     // Step 6: Iterate over all digits in this collection, summing amps for each tower.
-    TileDigitsCollection::const_iterator digitItr = (*collItr)->begin();
-    TileDigitsCollection::const_iterator lastDigit = (*collItr)->end();
+    for (const TileDigits* tile_digits : *digitsCollection) {
 
-    for (; digitItr != lastDigit; ++digitItr) {
       // get digits
-      std::vector<float> digits = (*digitItr)->samples();
+      std::vector<float> samples = tile_digits->samples();
       // get number of time samples & compare with 
       // int nSamp = m_tileInfo->NdigitSamples();
-      int nSamp2 = digits.size();
+      int nSamp2 = samples.size();
       if (nSamp2 != nSamp) {
         ATH_MSG_ERROR( "nSamp from TileInfo=" << nSamp
                       << " nSamp from digits= " << nSamp2 );
       }
       /* Get digit HWIdentifier (= channel_id) */
-      HWIdentifier adcId = (*digitItr)->adc_HWID();
+      HWIdentifier adcId = tile_digits->adc_HWID();
       int channel = m_tileHWID->channel(adcId);
       int adc = m_tileHWID->adc(adcId);
-      // Subtract pedestal, that is sample[0] and convert from ADC counts to pCb. 
-      float pedestal = digits[0];
+      // Subtract pedestal, that is samples[0] and convert from ADC counts to pCb. 
+      float pedestal = samples[0];
       for (int jsamp = 0; jsamp < nSamp; ++jsamp) {
 
-        digits[jsamp] = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc,
-            (digits[jsamp] - pedestal), TileRawChannelUnit::ADCcounts, TileRawChannelUnit::PicoCoulombs);
+        samples[jsamp] = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc,
+            (samples[jsamp] - pedestal), TileRawChannelUnit::ADCcounts, TileRawChannelUnit::PicoCoulombs);
 
       }
-      Identifier pmt_id = (*digitItr)->pmt_ID();
+      Identifier pmt_id = tile_digits->pmt_ID();
       if (pmt_id.is_valid()) {
 
         /* Get TT Identifier for this pmt */
-        Identifier tt_id = (*digitItr)->tt_ID();
+        Identifier tt_id = tile_digits->tt_ID();
         /* Get eta-phi  indices of TTL1 for this channel. */
         int ieta = m_TT_ID->eta(tt_id);
         int iphi = m_TT_ID->phi(tt_id); // (same as module).
@@ -237,13 +234,13 @@ StatusCode TileDigitsToTTL1::execute() {
 
         if (ttDigit[ieta]) { // already exists - just add charge for each sample
           for (int jsamp = 0; jsamp < nSamp; ++jsamp) {
-            myttAmp[ieta][jsamp] += digits[jsamp];
+            myttAmp[ieta][jsamp] += samples[jsamp];
           }
         } else { // digit in new TT
           ttId[ieta] = tt_id;
           ttDigit[ieta] = true;
           for (int jsamp = 0; jsamp < nSamp; ++jsamp) {
-            myttAmp[ieta][jsamp] = digits[jsamp];
+            myttAmp[ieta][jsamp] = samples[jsamp];
           }
           if (ieta >= minieta && ieta <= maxieta)
             ++nTT; // count only valid TT
@@ -255,7 +252,7 @@ StatusCode TileDigitsToTTL1::execute() {
         //Sum cell energy for comparison to other algos.
         // convert pCb to MeV
         float e = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc,
-            digits[iTrig], TileRawChannelUnit::PicoCoulombs, TileRawChannelUnit::MegaElectronVolts);
+            samples[iTrig], TileRawChannelUnit::PicoCoulombs, TileRawChannelUnit::MegaElectronVolts);
 
         if (ieta >= minieta && ieta <= maxieta) {
           ttAmpTot += e;
@@ -329,7 +326,7 @@ StatusCode TileDigitsToTTL1::execute() {
 
         /* Include shaping fuction, pedestal, and noise. */
         if (tileNoise)
-          RandGauss::shootArray(nSamp, Rndm);
+          CLHEP::RandGauss::shootArray(nSamp, Rndm);
         float ttL1Ped = m_tileInfo->TTL1Ped(ttId[ieta]);
         float ttL1NoiseSigma = m_tileInfo->TTL1NoiseSigma(ttId[ieta]);
         for (int jsamp = 0; jsamp < nSamp; ++jsamp) {
@@ -373,17 +370,11 @@ StatusCode TileDigitsToTTL1::execute() {
          The preceding lines are commented out.
          */
 
-        pTTL1 = new TileTTL1(ttId[ieta], ttL1samples);
-        pTTL1Container->push_back(pTTL1);
+        ttl1Container->push_back(std::make_unique<TileTTL1>(ttId[ieta], ttL1samples));
       }  // end second "Good" section.
     } // end loop over towers
   } // end loop over collections
 
-  // step8: register the TTL1 container in the TES
-  CHECK( evtStore()->record(pTTL1Container, m_TTL1Container, false) );
-
-  ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_TTL1Container << ")" );
-
 
   // Execution completed.
   ATH_MSG_DEBUG( "TileDigitsToTTL1 execution completed." );
diff --git a/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.cxx b/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.cxx
index e8398063bc1..f47efc0bbaf 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.cxx
@@ -20,23 +20,21 @@
 //
 //*****************************************************************************
 
-#include "GaudiKernel/ISvcLocator.h"
-#include "AthenaKernel/errorcheck.h"
-#include "AthenaKernel/IAtRndmGenSvc.h"
-
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
+// Tile includes
+//#include "TileEvent/TileContainer.h"
+#include "TileRecAlgs/TileMuonReceiverReadCnt.h"
 
 // Calo includes
 #include "CaloIdentifier/TileID.h"
 #include "TileIdentifier/TileHWID.h"
 
-// Tile includes
-//#include "TileEvent/TileContainer.h"
-#include "TileEvent/TileMuonReceiverContainer.h"
-#include "TileEvent/TileRawChannelContainer.h"
-#include "TileEvent/TileDigitsContainer.h"
-#include "TileRecAlgs/TileMuonReceiverReadCnt.h"
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "AthenaKernel/errorcheck.h"
+#include "AthenaKernel/IAtRndmGenSvc.h"
+
+// Gaudi includes
+#include "GaudiKernel/ISvcLocator.h"
 
 //C++ STL includes
 #include <vector>
@@ -51,9 +49,6 @@ using namespace std;
 // Constructor
 TileMuonReceiverReadCnt::TileMuonReceiverReadCnt(string name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
-  , m_TileMuRcvContainer("TileMuRcvCnt")
-  , m_TileRawChannelContainer("MuRcvRawChCnt")
-  , m_TileDigitsContainer("MuRcvDigitsCnt")
   , m_tileID(0)
   , m_tileHWID(0)
 {
@@ -69,6 +64,10 @@ StatusCode TileMuonReceiverReadCnt::initialize() {
   CHECK( detStore()->retrieve(m_tileID) );
   CHECK( detStore()->retrieve(m_tileHWID) );
 
+  ATH_CHECK( m_digitsContainerKey.initialize() );
+  ATH_CHECK( m_rawChannelContainerKey.initialize() );
+  ATH_CHECK( m_muonReceiverContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileMuonReceiverReadCnt initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -78,119 +77,110 @@ StatusCode TileMuonReceiverReadCnt::execute() {
 
   // step1: read the tile muon receiver container from TES
   //
-  const TileMuonReceiverContainer *container0 = evtStore()->tryConstRetrieve<TileMuonReceiverContainer>(m_TileMuRcvContainer);
-  if (container0) {
+  SG::ReadHandle<TileMuonReceiverContainer> muonReceiverContainer(m_muonReceiverContainerKey);
+  if (muonReceiverContainer.isValid()) {
 
-    ATH_MSG_INFO( "Reading the TileMuRcvContainer: " << m_TileMuRcvContainer);
+    ATH_MSG_INFO( "Reading the TileMuRcvContainer: " << m_muonReceiverContainerKey.key());
 
     // step2: check the number of entries that should be 128 per event
     //
-    int nentries = container0->size();
-    ATH_MSG_INFO( "--- The number of container elements in " <<  m_TileMuRcvContainer << " is " << nentries );
+    int nentries = muonReceiverContainer->size();
+    ATH_MSG_INFO( "--- The number of container elements in " <<  m_muonReceiverContainerKey.key() << " is " << nentries );
 
     // step3: check container contents
     //
-    TileMuonReceiverContainer::const_iterator it = container0->begin();
-    TileMuonReceiverContainer::const_iterator itLast = container0->end();
 
-    for (; it != itLast; ++it) {
+    for (const TileMuonReceiverObj* muonReceiverObj : *muonReceiverContainer) {
 
-      const TileMuonReceiverObj * obj = (*it);
-
-      int id = obj->GetID();
+      int id = muonReceiverObj->GetID();
       ATH_MSG_INFO( "+-- Identifier of module: 0x" <<MSG::hex<< id <<MSG::dec<< " ros:" << (id>>8) << " module:"<< (id&0xff));
 
       // -- read thresholds
-      const std::vector<float> & thresh = obj->GetThresholds();
+      const std::vector<float> & thresh = muonReceiverObj->GetThresholds();
       if (thresh.size()>=4)
         ATH_MSG_INFO( "--- thresholds' vector size : " << thresh.size() << " value: " << thresh[0] << " " << thresh[1] << " " << thresh[2] << " " << thresh[3] );
       else
         ATH_MSG_DEBUG( "--- thresholds' vector size : " << thresh.size() );
 
       // -- read energy
-      const std::vector<float> & ene = obj->GetEne(); 
+      const std::vector<float> & ene = muonReceiverObj->GetEne(); 
       if (ene.size()==2)
         ATH_MSG_INFO( "--- energy vector size : " << ene.size() << " value: " << ene[0] << " " << ene[1] );
       else
         ATH_MSG_DEBUG( "--- energy vector size : " << ene.size() ); 
 
       // -- read time
-      const std::vector<float> & time = obj->GetTime(); 
+      const std::vector<float> & time = muonReceiverObj->GetTime(); 
       if (time.size()>=2)
         ATH_MSG_INFO( "--- time vector size : " << time.size() << " value: " << time[0] << " " << time[1] );
       else
         ATH_MSG_DEBUG( "--- time vector size : " << time.size() );
 
       // -- read decision
-      const std::vector<bool> & decision = obj->GetDecision(); 
+      const std::vector<bool> & decision = muonReceiverObj->GetDecision(); 
       if (decision.size()>=4)
-        ATH_MSG_INFO( "--- decision vector size : " << decision.size() << " value: " << decision[0] << " " << decision[1] << " " << decision[2] << " " << decision[3] ); 
+        ATH_MSG_INFO( "--- decision vector size : " << decision.size() 
+                      << " value: " << decision[0] << " " << decision[1] << " " << decision[2] << " " << decision[3] ); 
       else
         ATH_MSG_DEBUG( "--- decision vector size : " << decision.size() ); 
     }
   } else {
-    ATH_MSG_INFO("Container " << m_TileMuRcvContainer << " not found") ;
+    ATH_MSG_INFO("Container " << m_muonReceiverContainerKey.key() << " not found") ;
   }
 
-  const TileRawChannelContainer *container1 = evtStore()->tryConstRetrieve<TileRawChannelContainer>("TileRawChannelCnt");
-  container1 = evtStore()->tryConstRetrieve<TileRawChannelContainer>(m_TileRawChannelContainer);
-  if (container1) {
+  SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
+  if (rawChannelContainer.isValid()) {
 
     const float TMDB_AMPLITUDE_FACTOR = 1.0;
 
-    ATH_MSG_INFO( "Reading the TileRawChannelContainer: " << m_TileRawChannelContainer);
+    ATH_MSG_INFO( "Reading the TileRawChannelContainer: " << m_rawChannelContainerKey.key());
+
+    for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
 
-    TileRawChannelContainer::const_iterator collItr1  = container1->begin(); 
-    TileRawChannelContainer::const_iterator lastColl1 = container1->end();
+      for(const TileRawChannel* rawChannel : *rawChannelCollection) {
+        int frag_id = rawChannelCollection->identify();
+        int ros=frag_id>>8;
+        int drawer=(frag_id&0xFF);
 
-    for ( ; collItr1 != lastColl1; ++collItr1 ){
-      TileRawChannelCollection::const_iterator chanItr1  = (*collItr1)->begin();
-      TileRawChannelCollection::const_iterator lastChan1 = (*collItr1)->end();
-      if (chanItr1==lastChan1) continue;
-      int frag_id = (*collItr1)->identify();
-      int ros=frag_id>>8;
-      int drawer=(frag_id&0xFF);
-      for ( ; chanItr1 != lastChan1; ++chanItr1 ){
-        HWIdentifier hwid = (*chanItr1)->adc_HWID() ;
+        HWIdentifier hwid = rawChannel->adc_HWID() ;
         int channel       = m_tileHWID->channel(hwid) ;
         ATH_MSG_INFO("+-- hwid   : " << m_tileHWID->to_string(hwid,-1)) ;
-        //ATH_MSG_INFO("---- channel: " << channel << " ros: " << ros << " drawer: " << drawer<< " E[MeV]: " <<(*chanItr1)->amplitude()<<" t[ns]: "<<(*chanItr1)->time()<<" QF: "<<(*chanItr1)->quality());
-        ATH_MSG_INFO("---- channel: " << channel << " ros: " << ros << " drawer: " << drawer<< " E[MeV]: " <<lround((*chanItr1)->amplitude()*TMDB_AMPLITUDE_FACTOR));
+        ATH_MSG_INFO("---- channel: " << channel 
+                     << " ros: " << ros 
+                     << " drawer: " << drawer
+                     << " E[MeV]: " << lround(rawChannel->amplitude()*TMDB_AMPLITUDE_FACTOR));
       }
     }
-  } else {
-    ATH_MSG_INFO("Container " << m_TileRawChannelContainer << " not found") ;
+    } else {
+      ATH_MSG_INFO("Container " << m_rawChannelContainerKey.key() << " not found") ;
   }
   
-  const TileDigitsContainer *container2 = evtStore()->tryConstRetrieve<TileDigitsContainer>("TileDigitsCnt");
-  container2 = evtStore()->tryConstRetrieve<TileDigitsContainer>(m_TileDigitsContainer);
-  if (container2) {
-
-    TileDigitsContainer::const_iterator collItr2  = container2->begin(); 
-    TileDigitsContainer::const_iterator lastColl2 = container2->end();
-
-    ATH_MSG_INFO( "Reading the TileDigitsContainer: " << m_TileDigitsContainer);
-
-    for ( ; collItr2 != lastColl2; ++collItr2 ){
-      TileDigitsCollection::const_iterator chanItr2  = (*collItr2)->begin();
-      TileDigitsCollection::const_iterator lastChan2 = (*collItr2)->end();
-      if (chanItr2==lastChan2) continue;
-      int frag_id = (*collItr2)->identify();
-      int ros=frag_id>>8;
-      int drawer=(frag_id&0xFF);
-      for ( ; chanItr2 != lastChan2; ++chanItr2 ){
-        HWIdentifier hwid = (*chanItr2)->adc_HWID() ;
+  SG::ReadHandle<TileDigitsContainer> digitsContainer(m_digitsContainerKey);
+  if (digitsContainer.isValid()) {
+
+    ATH_MSG_INFO( "Reading the TileDigitsContainer: " << m_digitsContainerKey.key());
+
+    for(const TileDigitsCollection* digitsCollection : *digitsContainer) {
+      
+      for (const TileDigits* tile_digits : *digitsCollection) {
+        
+        int frag_id = digitsCollection->identify();
+        int ros=frag_id>>8;
+        int drawer=(frag_id&0xFF);
+        
+        HWIdentifier hwid = tile_digits->adc_HWID() ;
         int channel       = m_tileHWID->channel(hwid) ;
         ATH_MSG_INFO("+-- hwid    : " << m_tileHWID->to_string(hwid,-1)) ;
         ATH_MSG_INFO("---- channel : " << channel << " ros: " << ros << " drawer: " << drawer);
-        const std::vector<float> digits = (*chanItr2)->samples();
-        for (uint ismp=0;ismp<digits.size();ismp++) ATH_MSG_INFO( "----- sample " << ismp << ": " << digits.at(ismp));
+        const std::vector<float> digits = tile_digits->samples();
+        for (uint ismp=0;ismp<digits.size();ismp++) 
+          ATH_MSG_INFO( "----- sample " << ismp << ": " << digits.at(ismp));
       }
     }
   } else {
-    ATH_MSG_INFO("Container " << m_TileDigitsContainer << " not found") ;
+    ATH_MSG_INFO("Container " << m_digitsContainerKey.key() << " not found") ;
   }
-
+  
   // Execution completed.
   ATH_MSG_INFO( "TileMuonReceiverReadCnt execution completed successfully" );
 
diff --git a/TileCalorimeter/TileRecAlgs/src/TileRawChannelToHit.cxx b/TileCalorimeter/TileRecAlgs/src/TileRawChannelToHit.cxx
index 6c79517fff8..afc1960e8ab 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileRawChannelToHit.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileRawChannelToHit.cxx
@@ -16,25 +16,28 @@
 //
 //*****************************************************************************
 
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
-
-// access all RawChannels inside container
-#include "EventContainers/SelectAllObject.h" 
-
 // Tile includes
-#include "CaloIdentifier/TileID.h"
+#include "TileRecAlgs/TileRawChannelToHit.h"
+
 #include "TileIdentifier/TileHWID.h"
 #include "TileIdentifier/TileFragHash.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileConditions/TileInfo.h"
 #include "TileSimEvent/TileHit.h"
-#include "TileSimEvent/TileHitVector.h"
 #include "TileEvent/TileRawChannel.h"
-#include "TileEvent/TileRawChannelContainer.h"
-#include "TileRecAlgs/TileRawChannelToHit.h"
 
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
+// access all RawChannels inside container
+#include "EventContainers/SelectAllObject.h" 
+
+#include <memory>
 
 //
 // Constructor
@@ -46,8 +49,6 @@ TileRawChannelToHit::TileRawChannelToHit(const std::string& name, ISvcLocator* p
   , m_tileInfo(0)
   , m_tileToolEmscale("TileCondToolEmscale")
 {
-  declareProperty("TileRawChannelContainer", m_rawChannelContainer = "TileRawChannelCnt");  // Raw chan to convert.
-  declareProperty("TileHitContainer", m_hitContainer = "TileHitVec");                       // Name of output container
   declareProperty("TileInfoName", m_infoName = "TileInfo");                                 // name of TileInfo store
   declareProperty("UseSamplFract", m_useSamplFract = false);  // if true energy in TileHit is the as it is coming from G4 simulation
                                                               // and by default it is equal to final - TileCell energy
@@ -77,6 +78,9 @@ StatusCode TileRawChannelToHit::initialize() {
 
   CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
 
+  ATH_CHECK( m_rawChannelContainerKey.initialize() );
+  ATH_CHECK( m_hitVectorKey.initialize() );
+
   ATH_MSG_INFO( "TileRawChannelToHit initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -99,47 +103,43 @@ StatusCode TileRawChannelToHit::execute() {
   float eCh = 0.0;
   float eHitTot = 0.0;
 
-  TileHitVector* hits = new TileHitVector;
+  SG::WriteHandle<TileHitVector> hitVector(m_hitVectorKey);
+
+  /* Register the set of TileHits to the event store. */
+  ATH_CHECK( hitVector.record(std::make_unique<TileHitVector>()) );
 
   //**
   //* Get TileRawChannels
   //**
-  const TileRawChannelContainer* rawChannels;
+  SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
 
-  if (evtStore()->retrieve(rawChannels, m_rawChannelContainer).isFailure()) {
-    ATH_MSG_WARNING( " Could not find container " << m_rawChannelContainer );
+  if (!rawChannelContainer.isValid()) {
+    ATH_MSG_WARNING( " Could not find container " << m_rawChannelContainerKey.key() );
     ATH_MSG_WARNING( " creating empty TileHitVector container " );
 
   } else {
 
-    TileRawChannelUnit::UNIT rChUnit = rawChannels->get_unit();
-    //TileFragHash::TYPE rChType = rawChannels->get_type();
+    TileRawChannelUnit::UNIT rChUnit = rawChannelContainer->get_unit();
+    //TileFragHash::TYPE rChType = rawChannelContainer->get_type();
 
     // iterate over all collections in a container
-    TileRawChannelContainer::const_iterator collItr = rawChannels->begin();
-    TileRawChannelContainer::const_iterator lastColl = rawChannels->end();
-
-    for (; collItr != lastColl; ++collItr) {
+    for(const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
 
-      HWIdentifier drawer_id = m_tileHWID->drawer_id((*collItr)->identify());
+      HWIdentifier drawer_id = m_tileHWID->drawer_id(rawChannelCollection->identify());
       int ros = m_tileHWID->ros(drawer_id);
       int drawer = m_tileHWID->drawer(drawer_id);
       int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
 
-      bool is_calibration = ((*collItr)->size() == 96);
+      bool is_calibration = (rawChannelCollection->size() == 96);
       if (is_calibration)
         ATH_MSG_DEBUG( "Calibration mode, ignore high gain" );
 
       // iterate over all raw channels in a collection, creating new TileHits
       // Add each new TileHit to the TileHitContainer.
 
-      TileRawChannelCollection::const_iterator rawItr = (*collItr)->begin();
-      TileRawChannelCollection::const_iterator end = (*collItr)->end();
+      for (const TileRawChannel* rawChannel : *rawChannelCollection) {
 
-      for (; rawItr != end; ++rawItr) {
-
-        const TileRawChannel * pChannel = (*rawItr);
-        HWIdentifier adc_id = pChannel->adc_HWID();
+        HWIdentifier adc_id = rawChannel->adc_HWID();
         int channel = m_tileHWID->channel(adc_id);
         int adc = m_tileHWID->adc(adc_id);
 
@@ -147,22 +147,23 @@ StatusCode TileRawChannelToHit::execute() {
         if (is_calibration && TileHWID::HIGHGAIN == adc)
           continue;
 
-        float amp = pChannel->amplitude();
-        float time = pChannel->time();
+        float amp = rawChannel->amplitude();
+        float time = rawChannel->time();
 
         ++nChan;
         eCh += amp;
 
-        Identifier pmt_id = pChannel->pmt_ID();
+        Identifier pmt_id = rawChannel->pmt_ID();
         if (pmt_id.is_valid()) {
 
           float ener = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc,
-              amp, rChUnit, TileRawChannelUnit::MegaElectronVolts);
+                                                       amp, rChUnit, 
+                                                       TileRawChannelUnit::MegaElectronVolts);
 
           if (m_useSamplFract) // divide by sampling fraction (about 40) 
             ener /= m_tileInfo->HitCalib(pmt_id);
 
-          TileHit * pHit = new TileHit(pmt_id, ener, time);
+          TileHit hit(pmt_id, ener, time);
           eHitTot += ener;
           ++nHit;
 
@@ -174,23 +175,20 @@ StatusCode TileRawChannelToHit::execute() {
                           << " ene=" << ener
                           << " time=" << time );
 
-          hits->push_back(*pHit);
-          delete pHit;
+          hitVector->push_back(hit);
 
         } else {
 
           ATH_MSG_VERBOSE( "TileRawChannelToHit: "
-                << " channel with adc_id=" << m_tileHWID->to_string(adc_id)
-                << " is not connected" );
+                           << " channel with adc_id=" << m_tileHWID->to_string(adc_id)
+                           << " is not connected" );
         }
       }
     }
   }
   
 
-  /* Register the set of TileHits to the event store. */
 
-  CHECK( evtStore()->record(hits, m_hitContainer, false ) );
 
   // Execution completed.
   ATH_MSG_DEBUG( "TileRawChannelToHit execution completed." );
@@ -201,7 +199,7 @@ StatusCode TileRawChannelToHit::execute() {
 
 
   ATH_MSG_VERBOSE( "TileHitVector container registered to the TES with name"
-                  << m_hitContainer );
+                   << m_hitVectorKey.key() );
 
   m_tileID->set_do_checks(do_checks); // set back this flag to TileID
 
diff --git a/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.cxx b/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.cxx
index ebb02b58119..373934bc4c7 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.cxx
@@ -26,18 +26,14 @@
 //
 //*****************************************************************************
 
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
-
-// Calo includes
-#include "CaloIdentifier/TileID.h"
-#include "CaloIdentifier/CaloLVL1_ID.h"
-
 // Tile includes
 // small hack to be able to modify original TileRawChannel
+#include "TileRecAlgs/TileRawChannelToTTL1.h"
+
 #define private public
 #include "TileEvent/TileRawChannel.h"
 #undef private
+
 #include "TileIdentifier/TileHWID.h"
 #include "TileIdentifier/TileFragHash.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
@@ -46,8 +42,15 @@
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileConditions/TileInfo.h"
 #include "TileEvent/TileRawChannelContainer.h"
-#include "TileEvent/TileTTL1Container.h"
-#include "TileRecAlgs/TileRawChannelToTTL1.h"
+
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+#include "CaloIdentifier/CaloLVL1_ID.h"
+
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
 
 //CLHEP includes
 #include <CLHEP/Random/Randomize.h>
@@ -73,8 +76,6 @@ TileRawChannelToTTL1::TileRawChannelToTTL1(std::string name, ISvcLocator* pSvcLo
   , m_tileToolEmscale("TileCondToolEmscale")
 {
   declareProperty("TileInfoName", m_infoName = "TileInfo");
-  declareProperty("TileRawChannelContainer", m_rawChannelContainer = "TileRawChannelCnt");
-  declareProperty("TileTTL1Container", m_TTL1Container = "TileTTL1Container");
   declareProperty("TileConstantTTL1Shape", m_constantTTL1shape = true);
   declareProperty("maskBadChannels", m_maskBadChannels = false);
   declareProperty("TileBadChanTool", m_tileBadChanTool);
@@ -116,6 +117,9 @@ StatusCode TileRawChannelToTTL1::initialize() {
     }
   }
 
+  ATH_CHECK( m_rawChannelContainerKey.initialize() );
+  ATH_CHECK( m_ttl1ContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileRawChannelToTTL1 initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -149,14 +153,15 @@ StatusCode TileRawChannelToTTL1::execute() {
   // step 3:  Get rawChannel container from TES and create TTL1 container
   /* Note that rawChannel container has 256 collections (one for each drawer),
    but TTL1 container has no collections and no structure. */
-  const TileRawChannelContainer* rawChannelCont;
-  CHECK( evtStore()->retrieve(rawChannelCont, m_rawChannelContainer) );
+  SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
+  ATH_CHECK( rawChannelContainer.isValid() );
 
-  TileRawChannelUnit::UNIT rChUnit = rawChannelCont->get_unit();
-  //TileFragHash::TYPE rChType = rawChannelCont->get_type();
+  TileRawChannelUnit::UNIT rChUnit = rawChannelContainer->get_unit();
+  //TileFragHash::TYPE rChType = rawChannelContainer->get_type();
 
-  TileTTL1Container* pTTL1Container = new TileTTL1Container();
-  TileTTL1* pTTL1;
+  SG::WriteHandle<TileTTL1Container> ttl1Container(m_ttl1ContainerKey);
+  ATH_CHECK( ttl1Container.record(std::make_unique<TileTTL1Container>()) );
+  ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_ttl1ContainerKey.key() << ")" );
 
   /*......................................................*/
   // Step 4: Create temporary arrays for processing signals.
@@ -179,12 +184,9 @@ StatusCode TileRawChannelToTTL1::execute() {
 
   /*......................................................*/
   // Step 5: Begin loop over all collections (collection = electronic drawer). 
-  TileRawChannelContainer::const_iterator collItr = rawChannelCont->begin();
-  TileRawChannelContainer::const_iterator lastColl = rawChannelCont->end();
-
-  for (; collItr != lastColl; ++collItr) {
+  for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
 
-    HWIdentifier drawer_id = m_tileHWID->drawer_id((*collItr)->identify());
+    HWIdentifier drawer_id = m_tileHWID->drawer_id(rawChannelCollection->identify());
     int ros = m_tileHWID->ros(drawer_id);
     int drawer = m_tileHWID->drawer(drawer_id);
     int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
@@ -221,12 +223,10 @@ StatusCode TileRawChannelToTTL1::execute() {
 
     /*......................................................*/
     // Step 6: Iterate over all rawChannels in this collection, summing amps for each tower.
-    TileRawChannelCollection::const_iterator rawChannelItr = (*collItr)->begin();
-    TileRawChannelCollection::const_iterator lastRawChannel = (*collItr)->end();
+    for (const TileRawChannel* rawChannel : *rawChannelCollection) {
 
-    for (; rawChannelItr != lastRawChannel; ++rawChannelItr) {
       /* Get rawChannel Identifier */
-      HWIdentifier hwid = (*rawChannelItr)->adc_HWID();
+      HWIdentifier hwid = rawChannel->adc_HWID();
       int channel = m_tileHWID->channel(hwid);
       int adc = m_tileHWID->adc(hwid);
 
@@ -234,7 +234,8 @@ StatusCode TileRawChannelToTTL1::execute() {
       // put zero amplitude in all bad channels 
       // so that zero amplitude will be written to the ByteStream 
       if (m_maskBadChannels) {
-        TileRawChannel * pRch = static_cast<TileRawChannel *>(*rawChannelItr);
+        // FIXME: const-cast modifying const SG object
+        TileRawChannel * pRch = const_cast<TileRawChannel*>(rawChannel);
         TileBchStatus status = m_tileBadChanTool->getAdcStatus(hwid);
 
         if (status.isBad()) {
@@ -247,18 +248,18 @@ StatusCode TileRawChannelToTTL1::execute() {
             pRch->m_time[0] = 0.0;
             pRch->m_quality[0] = 15.;
             pRch->m_pedestal = 0.0;
-          }
+          } else {
           //=== dead channel, put zero energy
-          else {
+
             pRch->m_amplitude[0] = 0.0;
             pRch->m_time[0] = 0.0;
             pRch->m_quality[0] = 0.0;
             pRch->m_pedestal = 0.0;
           }
-        }
+        } else if (status.isNoisy()) { // noisy channel ...
 
         //=== not bad, but noisy channel
-        else if (status.isNoisy()) { // noisy channel ...
+
           float noise = 0.0; // FIXME::add some noise - but don't know what to add
           pRch->m_amplitude[0] += m_tileToolEmscale->channelCalib(drawerIdx,
               channel, adc, noise, TileRawChannelUnit::ADCcounts, rChUnit);
@@ -268,7 +269,9 @@ StatusCode TileRawChannelToTTL1::execute() {
 
       // note that amplitude() is in unknown units (can be even online MeV), convert it to MeV first
       float e = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc,
-          (*rawChannelItr)->amplitude(), rChUnit, TileRawChannelUnit::MegaElectronVolts);
+                                                rawChannel->amplitude(), 
+                                                rChUnit, 
+                                                TileRawChannelUnit::MegaElectronVolts);
 
       // convert MeV to pCb
       float q = e / m_tileToolEmscale->channelCalib(drawerIdx, channel, adc, 1.0,
@@ -277,12 +280,12 @@ StatusCode TileRawChannelToTTL1::execute() {
       int ieta = 999;
       int iphi = 999;
 
-      Identifier pmt_id = (*rawChannelItr)->pmt_ID();
+      Identifier pmt_id = rawChannel->pmt_ID();
       if (pmt_id.is_valid() && m_tileID->section(pmt_id) < 4
           && m_tileID->section(pmt_id) > 0) {
 
         /* Get TT Identifier for this pmt */
-        Identifier tt_id = (*rawChannelItr)->tt_ID();
+        Identifier tt_id = rawChannel->tt_ID();
         /* Get eta-phi  indices of TTL1 for this channel. */
         ieta = m_TT_ID->eta(tt_id);
         iphi = m_TT_ID->phi(tt_id); // (same as module).
@@ -423,17 +426,11 @@ StatusCode TileRawChannelToTTL1::execute() {
         The preceding lines are commented out
         */
 
-        pTTL1 = new TileTTL1(ttId[ieta], ttL1samples);
-        pTTL1Container->push_back(pTTL1);
+        ttl1Container->push_back(std::make_unique<TileTTL1>(ttId[ieta], ttL1samples));
       }  // end second "Good" section.
     } // end loop over towers
   } // end loop over collections
 
-  // step8: register the TTL1 container in the TES
-  CHECK( evtStore()->record(pTTL1Container, m_TTL1Container, false) );
-
-  ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_TTL1Container << ")" );
-
   // Execution completed.
   ATH_MSG_DEBUG( "TileRawChannelToTTL1 execution completed." );
   ATH_MSG_DEBUG( " nTTTot=" << nTTTot
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/ITileRawChannelTool.h b/TileCalorimeter/TileRecUtils/TileRecUtils/ITileRawChannelTool.h
index 8389b927aee..27b58b3894e 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/ITileRawChannelTool.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/ITileRawChannelTool.h
@@ -19,7 +19,7 @@ class ITileRawChannelTool: virtual public IAlgTool {
 
 public:
   // update TileRawChannelContainer, subtract common mode noise for example
-  virtual StatusCode process( const TileRawChannelContainer * rchCnt)=0 ;
+  virtual StatusCode process(TileRawChannelContainer * rchCnt)=0 ;
 
   static const InterfaceID& interfaceID() { return IID_ITileRawChannelTool;}
 };
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileBeamInfoProvider.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileBeamInfoProvider.h
index 98a269c161b..90c085a9c07 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileBeamInfoProvider.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileBeamInfoProvider.h
@@ -22,19 +22,33 @@
  *   
  ********************************************************************/
 
+// Tile includes
+#include "TileEvent/TileBeamElemContainer.h"
+#include "TileEvent/TileDigitsContainer.h"
+#include "TileEvent/TileRawChannelContainer.h"
+#include "TileEvent/TileTriggerContainer.h"
+#include "TileEvent/TileLaserObject.h"
+
 // Atlas includes
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
 #include "AthenaBaseComps/AthAlgTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
+// Gaudi includes
 #include "GaudiKernel/IIncidentListener.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "GaudiKernel/ToolHandle.h"
+
+#include <string>
+#include <vector>
+#include <inttypes.h>
+
+
 class TileHWID;
 class TileRawChannelCollection;
 class StoreGateSvc;
 class TileBeamInfoProvider;
-class TileDigitsContainer;
-class TileRawChannelContainer;
-class TileBeamElemContainer;
 class TileDCSSvc;
 class ITileBadChanTool;
 class IAtRndmGenSvc;
@@ -43,10 +57,6 @@ namespace CLHEP {
 }
 
 
-#include <string>
-#include <vector>
-
-#include <inttypes.h>
 
 /**
 @class coincBoard
@@ -290,11 +300,24 @@ class TileBeamInfoProvider: public AthAlgTool
   bool m_checkDCS;  //!< if false, do not use TileDCSSvc at all
   bool m_simulateTrips;  //! if true simulate drawer trips
 
-  std::string m_TileBeamContainerID;    //!< Name of the TileBeamElemContainer
-  std::string m_TileDigitsContainerID;  //!< Name of the TileDigitsContainer
-  std::string m_TileRawChContainerID;   //!< Name of the TileRawChannelContainer
-  std::string m_TileTriggerContainerID; //!< Name of the TileTriggerContainer
-  std::string m_TileLaserObjectID;      //!< Name of the TileLaserObject
+  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfo", 
+                                                    "EventInfo", "Input Event info key"};
+
+  SG::ReadHandleKey<TileBeamElemContainer> m_beamElemContainerKey{this, "TileBeamElemContainer", 
+                                                                  "", "Input Tile beam elements container key"};
+
+  SG::ReadHandleKey<TileDigitsContainer> m_digitsContainerKey{this, "TileDigitsContainer", 
+                                                              "", "Input Tile digits container key"};
+
+  SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this, "TileRawChannelContainer", 
+                                                                      "", "Input Tile raw channel container key"};
+
+  SG::WriteHandleKey<TileTriggerContainer> m_triggerContainerKey{this, "TileTriggerContainer", 
+                                                                 "", "Output Tile trigger container key"};
+
+  SG::WriteHandleKey<TileLaserObject> m_laserObjectKey{this, "TileLaserObject", 
+                                                       "", "Output Tile laser object key"};
+  
 
   ServiceHandle<TileDCSSvc>   m_tileDCSSvc; //!< Pointer to TileDCSSvc
   ServiceHandle<IAtRndmGenSvc> m_rndmSvc;  //!< Random number service to use
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilder.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilder.h
index a1199a3be35..55bf5157f1c 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilder.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilder.h
@@ -22,24 +22,32 @@
  *   
  ********************************************************************/
 
-// Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
+// Tile includes
+#include "TileEvent/TileCellContainer.h"
+#include "TileEvent/TileRawChannelContainer.h"
+#include "TileIdentifier/TileFragHash.h"
+#include "TileIdentifier/TileRawChannelUnit.h"
+//#include "TileRecUtils/TileBeamInfoProvider.h"
+
+// Calo includes
+#include "CaloInterface/ICaloCellMakerTool.h"
+#include "CaloConditions/CaloAffectedRegionInfo.h"
 
 // Atlas includes
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "Identifier/HWIdentifier.h"
 #include "AthenaKernel/IOVSvcDefs.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
-// Calo includes
-#include "CaloInterface/ICaloCellMakerTool.h"
-#include "CaloConditions/CaloAffectedRegionInfo.h"
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/ServiceHandle.h"
 
-// Tile includes
-#include "TileEvent/TileCellContainer.h"
-#include "TileIdentifier/TileFragHash.h"
-#include "TileIdentifier/TileRawChannelUnit.h"
-//#include "TileRecUtils/TileBeamInfoProvider.h"
+// C++ STL includes
+#include <string>
+#include <vector>
+#include <memory>
 
 // forward declarations
 class TileID;
@@ -59,9 +67,6 @@ class TileBeamInfoProvider;
 class TileDQstatus;
 
 
-// C++ STL includes
-#include <string>
-#include <vector>
 
 /**
  @class TileDrawerEvtStatus
@@ -137,10 +142,25 @@ class TileCellBuilder: public AthAlgTool, virtual public ICaloCellMakerTool {
     friend class TileHid2RESrcID;
 
     // properties
-    std::string m_rawChannelContainer;
+    SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this, "TileRawChannelContainer", 
+                                                                        "TileRawChannelCnt", 
+                                                                        "Input Tile raw channel container key"};
+
+    SG::ReadHandleKey<TileRawChannelContainer> m_dspRawChannelContainerKey{this, "TileDSPRawChannelContainer", 
+                                                                           "TileRawChannelCnt", 
+                                                                           "Input Tile DSP raw channel container key"};
+
+
+    SG::WriteHandleKey<TileCellContainer> m_MBTSContainerKey{this, "MBTSContainer", 
+                                                             "MBTSContainer", 
+                                                             "Output Tile MBTS container key"};
+
+    SG::WriteHandleKey<TileCellContainer> m_E4prContainerKey{this, "E4prContainer", 
+                                                             "E4prContainer",
+                                                             "Output Tile E4 prime container key"};
+
+
     std::string m_infoName;
-    std::string m_MBTSContainer;
-    std::string m_E4prContainer;
     std::string m_dspRawChannelContainer;
 
     float m_eneForTimeCut;        //!< keep time for channels with energy above cut
@@ -185,8 +205,8 @@ class TileCellBuilder: public AthAlgTool, virtual public ICaloCellMakerTool {
     const MbtsDetDescrManager* m_mbtsMgr; //!< Pointer to MbtsDetDescrManager
 
     std::vector<TileCell*> m_allCells;  //!< vector to of pointers to TielCells
-    TileCellContainer* m_MBTSCells;     //!< Pointer to MBTS cell container
-    TileCellContainer* m_E4prCells;     //!< Pointer to E4'  cell container
+    std::unique_ptr<TileCellContainer> m_MBTSCells;     //!< Pointer to MBTS cell container
+    std::unique_ptr<TileCellContainer> m_E4prCells;     //!< Pointer to E4'  cell container
 
     TileFragHash::TYPE m_RChType;        //!< Type of TileRawChannels (Fit, OF2, etc.)
     TileRawChannelUnit::UNIT m_RChUnit;  //!< Unit for TileRawChannels (ADC, pCb, etc.)
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilderFromHit.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilderFromHit.h
index a68ffb9d273..93c6ae17414 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilderFromHit.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilderFromHit.h
@@ -22,25 +22,33 @@
  *   
  ********************************************************************/
 
-// Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "CLHEP/Random/RandomEngine.h"
+// Tile includes
+#include "TileEvent/TileCellContainer.h"
+#include "TileEvent/TileHitContainer.h"
+#include "TileIdentifier/TileFragHash.h"
+#include "TileIdentifier/TileRawChannelUnit.h"
+#include "TileRecUtils/TileCellBuilder.h"
+
+// Calo includes
+#include "CaloInterface/ICaloCellMakerTool.h"
+#include "CaloConditions/CaloAffectedRegionInfo.h"
 
 // Atlas includes
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "Identifier/HWIdentifier.h"
 #include "AthenaKernel/IOVSvcDefs.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
-// Calo includes
-#include "CaloInterface/ICaloCellMakerTool.h"
-#include "CaloConditions/CaloAffectedRegionInfo.h"
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "CLHEP/Random/RandomEngine.h"
 
-// Tile includes
-#include "TileEvent/TileCellContainer.h"
-#include "TileIdentifier/TileFragHash.h"
-#include "TileIdentifier/TileRawChannelUnit.h"
-#include "TileRecUtils/TileCellBuilder.h"
+// C++ STL includes
+#include <string>
+#include <vector>
+#include <memory>
 
 // forward declarations
 class TileID;
@@ -58,9 +66,6 @@ class TileCablingService;
 class ICalorimeterNoiseTool;
 class IAtRndmGenSvc;
 
-// C++ STL includes
-#include <string>
-#include <vector>
 
 /**
  @class TileCellBuilderFromHit
@@ -95,9 +100,21 @@ class TileCellBuilderFromHit: public AthAlgTool, virtual public ICaloCellMakerTo
   private:
 
     // properties
-    std::string m_hitContainer;
-    std::string m_MBTSContainer;
-    std::string m_E4prContainer;
+    // properties
+    SG::ReadHandleKey<TileHitContainer> m_hitContainerKey{this, "TileHitContainer", 
+                                                          "TileHitCnt", 
+                                                          "Input Tile hit container key"};
+
+
+    SG::WriteHandleKey<TileCellContainer> m_MBTSContainerKey{this, "MBTSContainer", 
+                                                             "MBTSContainer", 
+                                                             "Output Tile MBTS container key"};
+
+    SG::WriteHandleKey<TileCellContainer> m_E4prContainerKey{this, "E4prContainer", 
+                                                             "E4prContainer",
+                                                             "Output Tile E4 prime container key"};
+
+
     std::string m_infoName;
 
     float m_eneForTimeCut;        //!< keep time for channels with energy above cut
@@ -130,8 +147,8 @@ class TileCellBuilderFromHit: public AthAlgTool, virtual public ICaloCellMakerTo
     std::vector<TileCell*> m_allCells;  //!< vector to of pointers to TielCells
     std::vector<TileCell*> m_MBTSVec;   //!< vector to of pointers to MBTS cells
     std::vector<TileCell*> m_E4prVec;   //!< vector to of pointers to E4' cells
-    TileCellContainer* m_MBTSCells;     //!< Pointer to MBTS cell container
-    TileCellContainer* m_E4prCells;     //!< Pointer to E4'  cell container
+    std::unique_ptr<TileCellContainer> m_MBTSCells;     //!< Pointer to MBTS cell container
+    std::unique_ptr<TileCellContainer> m_E4prCells;     //!< Pointer to E4'  cell container
 
     TileFragHash::TYPE m_RChType;        //!< Type of TileRawChannels (Fit, OF2, etc.)
     //unsigned int m_bsflags;              //!< other flags stored in TileRawChannelContainer
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilder.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilder.h
index 47fd047b17e..4f45f750582 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilder.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilder.h
@@ -22,15 +22,23 @@
  *   
  ********************************************************************/
 
-//Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
+// Tile includes
+#include "TileIdentifier/TileFragHash.h"
+#include "TileIdentifier/TileRawChannelUnit.h"
+#include "TileEvent/TileRawChannelContainer.h"
+#include "TileEvent/TileDigitsCollection.h"
 
 // Atlas includes
 #include "AthenaBaseComps/AthAlgTool.h"
 
+//Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "StoreGate/WriteHandleKey.h"
+
 #include <utility>
 #include <vector>
+#include <memory>
 
 class TileDigits;
 class TileRawChannel;
@@ -40,15 +48,6 @@ class TileInfo;
 class TileBeamInfoProvider;
 class ITileRawChannelTool;
 class StoreGateSvc;
-class MsgStream;
-
-//class vector;
-
-#include "TileIdentifier/TileFragHash.h"
-#include "TileIdentifier/TileRawChannelUnit.h"
-#include "TileEvent/TileRawChannelContainer.h"
-#include "TileEvent/TileDigitsCollection.h"
-
 
 typedef std::vector<std::pair<TileRawChannel*, const TileDigits*> > Overflows_t;
 
@@ -66,7 +65,7 @@ class TileRawChannelBuilder: public AthAlgTool {
 
     /**
      * Create container in SG with name given by
-     * parameter (m_TileRawChannelContainerID)
+     * parameter (m_rawChannelContainerKey)
      */
     virtual StatusCode createContainer();
 
@@ -136,10 +135,12 @@ class TileRawChannelBuilder: public AthAlgTool {
     friend class TileHid2RESrcID;
 
     // properties
-    std::string m_TileRawChannelContainerID;
+    // name of TDS container with output TileRawChannels
+    SG::WriteHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer","TileRawChannelFiltered",
+                                                                         "Output Tile raw channels container key"};
 
     // RawChannelContainer
-    TileRawChannelContainer* m_rawChannelCnt;
+    std::unique_ptr<TileRawChannelContainer> m_rawChannelCnt;
 
     // parameters for RawChannelContainer
     TileFragHash::TYPE m_rChType;
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelMaker.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelMaker.h
index 2c39ffe9b8d..2dffc9e5385 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelMaker.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelMaker.h
@@ -24,11 +24,16 @@
  *   
  ********************************************************************/
 
-// Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
+// Tile includes
+#include "TileEvent/TileDigitsContainer.h"
 
 // Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
+
 
 class TileRawChannelBuilder;
 
@@ -49,7 +54,8 @@ class TileRawChannelMaker: public AthAlgorithm {
     void fitOverflowedChannels(void);
 
     // name of TDS container with TileDigits
-    std::string m_TileDigitsContainerID;
+    SG::ReadHandleKey<TileDigitsContainer> m_digitsContainerKey{this,"TileDigitsContainer","TileDigitsCnt",
+                                                                "Input Tile digits container key"};
 
     /**
      * Vector with class name[/instance name] of builder sub-algs
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h
index 72eac34f9a9..4b77aea3255 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h
@@ -51,7 +51,7 @@ class TileRawChannelNoiseFilter: public AthAlgTool, virtual public ITileRawChann
     virtual StatusCode finalize();
 
     /** proceed the coherent noise subtruction algorithm and correct TileRawChannel amplitudes */
-    virtual StatusCode process(const TileRawChannelContainer *rchCnt);
+    virtual StatusCode process(TileRawChannelContainer *rchCnt);
 
   private:
 
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelOF1Corrector.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelOF1Corrector.h
index a1a2bbaaa77..6aa0872edf0 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelOF1Corrector.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelOF1Corrector.h
@@ -8,13 +8,18 @@
 #ifndef TILERECUTILS_TILERAWCHANNELOF1CORRECTOR_H
 #define TILERECUTILS_TILERAWCHANNELOF1CORRECTOR_H
 
+// Tile includes
+#include "TileRecUtils/ITileRawChannelTool.h"
+#include "TileEvent/TileDigitsContainer.h"
+#include "TileConditions/ITileCondToolDspThreshold.h"
+
 // Atlas includes
 #include "AthenaBaseComps/AthAlgTool.h"
+#include "StoreGate/ReadHandleKey.h"
+
+// Gaudi includes
 #include "GaudiKernel/ToolHandle.h"
 
-// Tile includes
-#include "TileRecUtils/ITileRawChannelTool.h"
-#include "TileConditions/ITileCondToolDspThreshold.h"
 
 // forward declarations
 class TileRawChannel;
@@ -49,7 +54,7 @@ class TileRawChannelOF1Corrector: public AthAlgTool, virtual public ITileRawChan
     virtual StatusCode finalize() override;
 
     /** Correct TileRawChannel amplitudes if pedestal changed */
-    virtual StatusCode process(const TileRawChannelContainer* rawChannelContainer) override;
+    virtual StatusCode process(TileRawChannelContainer* rawChannelContainer) override;
 
 
   private:
@@ -62,7 +67,11 @@ class TileRawChannelOF1Corrector: public AthAlgTool, virtual public ITileRawChan
     ToolHandle<TileCondToolEmscale> m_tileToolEms;
     ToolHandle<ITileCondToolDspThreshold> m_tileDspThreshold;
 
-    std::string m_digitsContainerName;
+    
+    SG::ReadHandleKey<TileDigitsContainer> m_digitsContainerKey{this, "TileDigitsContainer", 
+                                                                "TileDigitsCnt", "Input Tile digits container key"};
+
+
     bool m_zeroAmplitudeWithoutDigits;
     bool m_correctPedestalDifference;
 };
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelVerify.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelVerify.h
index a31cb06829e..2df15cc362a 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelVerify.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelVerify.h
@@ -31,7 +31,11 @@
 #define TILERECUTILS_TILERAWCHANNELVERIFY_H
 
 // Tile includes
+#include "TileEvent/TileRawChannelContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
 
 class TileHWID;
 
@@ -58,8 +62,13 @@ class TileRawChannelVerify: public AthAlgorithm {
 
     const TileHWID* m_tileHWID; //!< Pointer to TileHWID  
 
-    std::string m_rawChannelContainer2; //!< name of one of the TileRawChannelContainer
-    std::string m_rawChannelContainer1; //!< name of one of the TileRawChannelContainer
+    SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainer1Key{this, "TileRawChannelContainer1", 
+                                                                         "", "Input Tile raw channel container 1 key"};
+
+
+    SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainer2Key{this, "TileRawChannelContainer2", 
+                                                                         "", "Input Tile raw channel container 2 key"};
+
 
     double m_precision; //!< maximum difference between the amplitudes of the TileRawChannels to be compared
 
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawCorrelatedNoise.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawCorrelatedNoise.h
index e969be5aab0..fa601293bac 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawCorrelatedNoise.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawCorrelatedNoise.h
@@ -15,13 +15,16 @@
  *
  ********************************************************************/
 
-// Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
+#include "TileEvent/TileDigitsContainer.h"
 
 // Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
+#include "GaudiKernel/ToolHandle.h"
 
-class TileRawChannelBuilder;
 
 class TileRawCorrelatedNoise: public AthAlgorithm {
 
@@ -37,11 +40,13 @@ class TileRawCorrelatedNoise: public AthAlgorithm {
 
   private:
 
-    // name of TDS container with input TileDigits
-    std::string m_tileDigitsInputContainer;
+    SG::ReadHandleKey<TileDigitsContainer> m_inputDigitsContainerKey{this, "TileDigitsContainer", 
+                                                                    "TileDigitsCnt", 
+                                                                    "Input Tile digits container key"};
 
-    // name of TDS container with output TileDigits
-    std::string m_tileDigitsOutputContainer;
+    SG::WriteHandleKey<TileDigitsContainer> m_outputDigitsContainerKey{this, "OutputTileDigitsContainer", 
+                                                                      "NewDigitsContainer", 
+                                                                      "Output Tile digits container key"};
 
     // RMS threshold
     float m_nRMS_threshold;
diff --git a/TileCalorimeter/TileRecUtils/src/TileBeamInfoProvider.cxx b/TileCalorimeter/TileRecUtils/src/TileBeamInfoProvider.cxx
index 2654b6ae545..76eb3a754ae 100644
--- a/TileCalorimeter/TileRecUtils/src/TileBeamInfoProvider.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileBeamInfoProvider.cxx
@@ -2,41 +2,36 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// Atlas includes
-#include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/Property.h"
-#include "GaudiKernel/IToolSvc.h"
-#include "GaudiKernel/IIncidentSvc.h"
-#include "StoreGate/StoreGateSvc.h"
-#include "AthenaKernel/errorcheck.h"
-//EventInfo
-#include "xAODEventInfo/EventInfo.h"
-// For the Athena-based random numbers.
-#include "AthenaKernel/IAtRndmGenSvc.h"
-
-//CLHEP includes
-#include <CLHEP/Random/Randomize.h>
-
-
-// Calo include
-#include "CaloIdentifier/CaloLVL1_ID.h" 
-
 // TileCal includes
 #include "TileRecUtils/TileBeamInfoProvider.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileIdentifier/TileTBFrag.h"
 #include "TileIdentifier/TileTTL1Hash.h"
 #include "TileEvent/TileTrigger.h"
-#include "TileEvent/TileTriggerContainer.h"
-#include "TileEvent/TileBeamElemContainer.h"
-#include "TileEvent/TileDigitsContainer.h"
-#include "TileEvent/TileRawChannelContainer.h"
-#include "TileEvent/TileLaserObject.h"
 #include "TileConditions/TileDCSSvc.h"
 #include "TileConditions/TileBadChanTool.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 
+// Calo include
+#include "CaloIdentifier/CaloLVL1_ID.h" 
+
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
+
+#include "AthenaKernel/IAtRndmGenSvc.h"
+
+// Gaudi includes
+#include "GaudiKernel/IIncidentSvc.h"
+
+
+//CLHEP includes
+#include <CLHEP/Random/Randomize.h>
+
+
 #include <iomanip>
+#include <memory>
 
 // uncomment line below for debug output
 // #define TILECELL_DEBUG 1
@@ -54,14 +49,6 @@ TileBeamInfoProvider::interfaceID() {
 TileBeamInfoProvider::TileBeamInfoProvider(const std::string& type,
     const std::string& name, const IInterface* parent)
     : AthAlgTool(type, name, parent)
-    //  , m_TileBeamContainerID("TileBeamElemCnt")
-    //  , m_TileDigitsContainerID("TileDigitsCnt")
-    //  , m_TileRawChContainerID("TileRawChannelCnt")
-    , m_TileBeamContainerID("")
-    , m_TileDigitsContainerID("")
-    , m_TileRawChContainerID("")
-    , m_TileTriggerContainerID("")
-    , m_TileLaserObjectID("")
     , m_tileDCSSvc("TileDCSSvc", name)
     , m_rndmSvc ("AtRndmGenSvc", name)
     , m_tileBadChanTool("TileBadChanTool")
@@ -81,12 +68,6 @@ TileBeamInfoProvider::TileBeamInfoProvider(const std::string& type,
 
   declareInterface < TileBeamInfoProvider > (this);
 
-  declareProperty("TileBeamElemContainer", m_TileBeamContainerID);
-  declareProperty("TileDigitsContainer", m_TileDigitsContainerID);
-  declareProperty("TileRawChannelContainer", m_TileRawChContainerID);
-  declareProperty("TileTriggerContainer", m_TileTriggerContainerID);
-  declareProperty("TileLaserObject", m_TileLaserObjectID);
-
   declareProperty("CheckDCS", m_checkDCS = false);
   declareProperty("SimulateTrips", m_simulateTrips = false, "Simulate drawer trips (default=false)");
   declareProperty("RndmSvc", m_rndmSvc, "Random Number Service used in TileCondToolTrip");
@@ -136,9 +117,9 @@ StatusCode TileBeamInfoProvider::initialize() {
     ATH_MSG_INFO("Drawer trips will be simulated");
   }
 
-  if (m_TileBeamContainerID.length() > 0 
-      || m_TileDigitsContainerID.length() > 0
-      || m_TileRawChContainerID.length() > 0
+  if (!(m_beamElemContainerKey.key().empty() 
+        && m_digitsContainerKey.key().empty()
+        && m_rawChannelContainerKey.key().empty())
       || m_simulateTrips) {
 
     // Listen for begin of event
@@ -149,18 +130,39 @@ StatusCode TileBeamInfoProvider::initialize() {
     incSvc->addListener(this, "BeginRun", 101);
     incSvc->addListener(this, "BeginEvent", PRIORITY);
 
-    if (msgLvl(MSG::DEBUG)) {
-      msg(MSG::DEBUG) << "TileBeamInfoProvider created, taking info from '"
-                      << m_TileBeamContainerID << "'" << endmsg;
-      msg(MSG::DEBUG) << " from '" << m_TileDigitsContainerID << "'"
-                      << " and from '" << m_TileRawChContainerID << "'"
-                      << ((m_simulateTrips) ? ", and from drawer trips simulation" : "") << endmsg;
-    }
+    ATH_MSG_DEBUG( "TileBeamInfoProvider created, taking info from '"
+                   << m_beamElemContainerKey.key()
+                   << "', '" << m_digitsContainerKey.key()
+                   << "', and from '" << m_rawChannelContainerKey.key()
+                   << ((m_simulateTrips) ? "', and from drawer trips simulation" : "'") );
 
   } else {
     ATH_MSG_DEBUG("TileBeamInfoProvider created, but BeginOfEvent incident not activated");
   }
 
+  ATH_CHECK( m_eventInfoKey.initialize() );
+
+  if (!m_beamElemContainerKey.key().empty()) {
+    ATH_CHECK( m_beamElemContainerKey.initialize() ); 
+  }
+
+  if (!m_digitsContainerKey.key().empty()) {
+    ATH_CHECK( m_digitsContainerKey.initialize() ); 
+  }
+
+  if (!m_rawChannelContainerKey.key().empty()) {
+    ATH_CHECK( m_rawChannelContainerKey.initialize() ); 
+  }
+
+  if (!m_triggerContainerKey.key().empty()) {
+    ATH_CHECK( m_triggerContainerKey.initialize() ); 
+  }
+
+  if (!m_laserObjectKey.key().empty()) {
+    ATH_CHECK( m_laserObjectKey.initialize() ); 
+  }
+
+
   return StatusCode::SUCCESS;
 }
 
@@ -215,9 +217,9 @@ void TileBeamInfoProvider::handle(const Incident& inc) {
 
   if (m_evt == 0) {
     //enable DQstatus checks
-    m_checkDQ = (m_TileRawChContainerID.length() > 0);
-    m_checkDigi = (m_TileDigitsContainerID.length() > 0);
-    m_checkBeam = (m_TileBeamContainerID.length() > 0);
+    m_checkDQ = (!m_rawChannelContainerKey.key().empty());
+    m_checkDigi = (!m_digitsContainerKey.key().empty());
+    m_checkBeam = (!m_beamElemContainerKey.key().empty());
     if (msgLvl(MSG::DEBUG)) {
       msg(MSG::DEBUG) << "Check DQ=" << m_checkDQ << endmsg;
       msg(MSG::DEBUG) << "Check Digi=" << m_checkDigi << endmsg;
@@ -226,17 +228,19 @@ void TileBeamInfoProvider::handle(const Incident& inc) {
     m_DQstatus.setCheckDigi(m_checkDigi);
   }
 
-  m_rcCnt = NULL;
-  m_digitsCnt = NULL;
-  m_beamElemCnt = NULL;
+  m_rcCnt = nullptr;
+  m_digitsCnt = nullptr;
+  m_beamElemCnt = nullptr;
   m_noiseFilterApplied = false;
 
   // retrive all containers from detector store and cache pointers for future use
 
   if (m_checkBeam) {
-    StatusCode sc = evtStore()->retrieve(m_beamElemCnt, m_TileBeamContainerID);
-    if (sc.isFailure()) {
-      ATH_MSG_ERROR("can't retrieve BeamElem from TDS");
+    SG::ReadHandle<TileBeamElemContainer> beamElemContainer(m_beamElemContainerKey);
+    if (beamElemContainer.isValid()) {
+      m_beamElemCnt = beamElemContainer.cptr();
+    } else {
+      ATH_MSG_ERROR("can't retrieve BeamElem '" << m_beamElemContainerKey.key() << "' from TDS");
       if (m_evt == 0) {
         m_checkBeam = false;
       }
@@ -244,9 +248,11 @@ void TileBeamInfoProvider::handle(const Incident& inc) {
   }
 
   if (m_checkDigi) {
-    StatusCode sc = evtStore()->retrieve(m_digitsCnt, m_TileDigitsContainerID);
-    if (sc.isFailure()) {
-      ATH_MSG_ERROR("can't retrieve Digits from TDS");
+    SG::ReadHandle<TileDigitsContainer> digitsContainer(m_digitsContainerKey);
+    if (digitsContainer.isValid()) {
+      m_digitsCnt = digitsContainer.cptr();
+    } else {
+      ATH_MSG_ERROR("can't retrieve Digits '" << m_digitsContainerKey.key() << "' from TDS");
       if (m_evt == 0) {
         m_checkDigi = false;
         m_DQstatus.setCheckDigi(false);
@@ -256,9 +262,11 @@ void TileBeamInfoProvider::handle(const Incident& inc) {
 
   if (m_checkDQ) {
     m_DQstatus.setAllGood();
-    StatusCode sc = evtStore()->retrieve(m_rcCnt, m_TileRawChContainerID);
-    if (sc.isFailure()) {
-      ATH_MSG_ERROR("can't retrieve RawChannels '" << m_TileRawChContainerID << "' from TDS");
+    SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
+    if (rawChannelContainer.isValid()) {
+      m_rcCnt = rawChannelContainer.cptr();
+    } else {
+      ATH_MSG_ERROR("can't retrieve RawChannels '" << m_rawChannelContainerKey.key() << "' from TDS");
       if (m_evt == 0) {
         m_checkDQ = false;
         m_DQstatus.setFilled(true);
@@ -446,49 +454,49 @@ void TileBeamInfoProvider::handle(const Incident& inc) {
    }
    */
   // we are going to put TileTrigger to StoreGate
-  if (m_TileTriggerContainerID.length() > 0) {
-
-    TileTriggerContainer* pTileTriggerContainer = new TileTriggerContainer();
-
-    int maxboard = m_coincTrig.size();
-    if (maxboard > 0) {
-      Identifier mtid;
-      double mtsum(0.0);
-      std::vector < Identifier > boardtid(maxboard);
-      std::vector<double> boardtsum(maxboard);
-      std::vector < Identifier > backtid(maxboard);
-      std::vector<double> backtsum(maxboard);
-
-      // FIXME:: convert coincTrig to TileTrigger
-
-      TileTrigger * tileTrigger = new TileTrigger(mtid, mtsum, boardtid,
-          boardtsum, backtid, backtsum);
-      pTileTriggerContainer->push_back(tileTrigger);
-    }
-
-    StatusCode sc = evtStore()->record(pTileTriggerContainer,
-        m_TileTriggerContainerID, false);
-    if (sc.isFailure()) {
+  if (!m_triggerContainerKey.key().empty()) {
+
+    SG::WriteHandle<TileTriggerContainer> triggerContainer(m_triggerContainerKey);
+    if (triggerContainer.record( std::make_unique<TileTriggerContainer>() ).isSuccess()) {
+
+      int maxboard = m_coincTrig.size();
+      if (maxboard > 0) {
+        Identifier mtid;
+        double mtsum(0.0);
+        std::vector < Identifier > boardtid(maxboard);
+        std::vector<double> boardtsum(maxboard);
+        std::vector < Identifier > backtid(maxboard);
+        std::vector<double> backtsum(maxboard);
+        
+        // FIXME:: convert coincTrig to TileTrigger
+        
+        TileTrigger* tileTrigger = new TileTrigger(mtid, mtsum, boardtid,
+                                                   boardtsum, backtid, backtsum);
+        triggerContainer->push_back(tileTrigger);
+      }
+    } else {
       ATH_MSG_ERROR("failed to register the TileTrigger container: "
-                    << m_TileTriggerContainerID << " in StoreGate");
+                    << m_triggerContainerKey.key() << " in StoreGate");
+
     }
+    
   }
 
   // we are going to put TileLaserObject to StoreGate
-  if (m_TileLaserObjectID.length() > 0) {
+  if (!m_laserObjectKey.key().empty()) {
 
-    TileLaserObject* pTileLaserObject = new TileLaserObject();
+    SG::WriteHandle<TileLaserObject> laserObject(m_laserObjectKey);
+    if(laserObject.record( std::make_unique<TileLaserObject>() ).isSuccess()) {
+      laserObject->setBCID(m_BCID);
 
-    pTileLaserObject->setBCID(m_BCID);
+      // FIXME: a lot of set methods here 
+      // to copy m_laspar to TileLaserObject
 
-    // FIXME: a lot of set methods here 
-    // to copy m_laspar to TileLaserObject
-
-    StatusCode sc = evtStore()->record(pTileLaserObject, m_TileLaserObjectID, false);
-    if (sc.isFailure()) {
+    } else {
       ATH_MSG_ERROR("failed to register the TileLaserObject: "
-                    << m_TileLaserObjectID << " in StoreGate");
+                    << m_laserObjectKey.key() << " in StoreGate");
     }
+
   }
 
   if (m_calibMode == 0xFFFFFFFF) {
@@ -600,9 +608,8 @@ const TileDQstatus * TileBeamInfoProvider::getDQstatus() {
     return &m_DQstatus;
 
   //Fill BCID from the EventInfo, if available
-  const DataHandle<xAOD::EventInfo> eventInfo(0);
-  StatusCode sc = evtStore()->retrieve(eventInfo);
-  if (sc.isSuccess()) {
+  SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey);
+  if (eventInfo.isValid()) {
     m_DQstatus.setRODBCID(eventInfo->bcid());
   }
 
diff --git a/TileCalorimeter/TileRecUtils/src/TileCellBuilder.cxx b/TileCalorimeter/TileRecUtils/src/TileCellBuilder.cxx
index d5d741b513a..9fb5d46afcb 100644
--- a/TileCalorimeter/TileRecUtils/src/TileCellBuilder.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileCellBuilder.cxx
@@ -2,36 +2,24 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-
 // Tile includes
 #include "TileRecUtils/TileCellBuilder.h"
+#include "TileRecUtils/TileRawChannelBuilder.h"
+#include "TileRecUtils/TileBeamInfoProvider.h"
+#include "TileRecUtils/ITileRawChannelTool.h"
 #include "TileEvent/TileCell.h"
+#include "TileEvent/TileCellCollection.h"
+#include "TileEvent/TileRawChannel.h"
 #include "CaloIdentifier/TileID.h"
 #include "CaloIdentifier/TileTBID.h"
 #include "TileIdentifier/TileHWID.h"
 #include "CaloDetDescr/MbtsDetDescrManager.h"
 #include "TileDetDescr/TileDetDescrManager.h"
 #include "TileConditions/ITileBadChanTool.h"
-#include "TileEvent/TileRawChannel.h"
-#include "TileEvent/TileRawChannelContainer.h"
-#include "TileRecUtils/TileRawChannelBuilder.h"
-#include "TileEvent/TileCellCollection.h"
-#include "TileRecUtils/TileBeamInfoProvider.h"
-#include "TileRecUtils/ITileRawChannelTool.h"
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileConditions/TileCondToolTiming.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
-
-// Gaudi includes
-//#include "GaudiKernel/Bootstrap.h"
-
-// Atlas includes
-#include "AthAllocators/DataPool.h"
-// access all RawChannels inside container
-#include "EventContainers/SelectAllObject.h" 
-#include "xAODEventInfo/EventInfo.h"
-#include "AthenaKernel/errorcheck.h"
-
+ 
 // Calo includes
 #include "CaloIdentifier/CaloCell_ID.h"
 #include "CaloEvent/CaloCellContainer.h"
@@ -39,6 +27,14 @@
 #include "CaloConditions/CaloAffectedRegionInfoVec.h"
 #include "Identifier/IdentifierHash.h"
 
+// Atlas includes
+#include "AthAllocators/DataPool.h"
+#include "EventContainers/SelectAllObject.h" 
+#include "xAODEventInfo/EventInfo.h"
+#include "AthenaKernel/errorcheck.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+
 //using xAOD::EventInfo;
 using CLHEP::MeV;
  
@@ -55,9 +51,6 @@ const InterfaceID& TileCellBuilder::interfaceID( ) {
 TileCellBuilder::TileCellBuilder(const std::string& type, const std::string& name,
     const IInterface* parent)
   : AthAlgTool(type, name, parent)
-  , m_rawChannelContainer("TileRawChannelCnt")
-  , m_MBTSContainer("MBTSContainer")
-  , m_E4prContainer("E4prContainer")
   , m_eneForTimeCut(35. * MeV) // keep time only for cells above 70 MeV (more than 35 MeV in at least one PMT to be precise)
   , m_eneForTimeCutMBTS(0.03675) // the same cut for MBTS, but in pC, corresponds to 3 ADC counts or 35 MeV
   , m_qualityCut(254) // cut on overflow in quality (if quality is 255 - assume that channel is bad)
@@ -82,8 +75,6 @@ TileCellBuilder::TileCellBuilder(const std::string& type, const std::string& nam
   , m_noiseFilterTools() // "TileRawChannelNoiseFilter/TileRawChannelNoiseFilter")
   , m_tileMgr(0)
   , m_mbtsMgr(0)
-  , m_MBTSCells(0)
-  , m_E4prCells(0)
   , m_RChType(TileFragHash::Default)
   , m_RChUnit(TileRawChannelUnit::ADCcounts)
   , m_maxTimeCorr(75.0)
@@ -108,10 +99,6 @@ TileCellBuilder::TileCellBuilder(const std::string& type, const std::string& nam
   //!< MBTS channel energy threshold for masking (not used currently(
   m_minEneChan[2] = -999999. * MeV;
 
-  declareProperty("TileRawChannelContainer", m_rawChannelContainer);  // Raw channel to convert
-  declareProperty("MBTSContainer",           m_MBTSContainer);        // Where to put MBTS cells
-  declareProperty("E4prContainer",           m_E4prContainer);        // Where to put E4'  cells
-  declareProperty("TileDSPRawChannelContainer", m_dspRawChannelContainer = "TileRawChannelCnt");
   declareProperty("TileBadChanTool"        , m_tileBadChanTool);
   declareProperty("TileCondToolEmscale"    , m_tileToolEmscale);
   declareProperty("TileCondToolTiming"     , m_tileToolTiming);
@@ -162,7 +149,7 @@ TileCellBuilder::TileCellBuilder(const std::string& type, const std::string& nam
   declareProperty("OF2", m_of2 = true);
 
   // merge DSP results with offline reco results
-  declareProperty("mergeChannels", m_mergeChannels = false);
+  declareProperty("mergeChannels", m_mergeChannels = true);
 
   // thresholds for parabolic amplitude correction 
   declareProperty("AmpMinForAmpCorrection", m_ampMinThresh = 15.0);
@@ -186,13 +173,17 @@ TileCellBuilder::~TileCellBuilder(){
 StatusCode TileCellBuilder::initialize() {
   
   // retrieve MBTS and Tile detector manager, TileID helper and TileIfno from det store
-  if (m_MBTSContainer.size() > 0) {
+  if (m_MBTSContainerKey.key().empty()) {
+    m_mbtsMgr = nullptr;
+  } else {
+
+    ATH_CHECK( m_MBTSContainerKey.initialize() );
+    ATH_MSG_INFO( "Storing MBTS cells in " << m_MBTSContainerKey.key() );
+    
     if (detStore()->retrieve(m_mbtsMgr).isFailure()) {
       ATH_MSG_WARNING( "Unable to retrieve MbtsDetDescrManager from DetectorStore" );
-      m_mbtsMgr = 0;
+      m_mbtsMgr = nullptr;
     }
-  } else {
-    m_mbtsMgr = 0;
   }
 
   CHECK( detStore()->retrieve(m_tileMgr) );
@@ -220,13 +211,11 @@ StatusCode TileCellBuilder::initialize() {
   m_run2 = ((TileCablingService::getInstance())->getCablingType() == TileCablingService::RUN2Cabling
             || (TileCablingService::getInstance())->getCablingType() == TileCablingService::UpgradeABC);
 
-  if (m_MBTSContainer.size() > 0)
-    ATH_MSG_INFO( "Storing MBTS cells in " << m_MBTSContainer );
-
-  if (!m_run2) {
-    m_E4prContainer = ""; // no E4' container for RUN1
-  } else if (m_E4prContainer.size() > 0) {
-    ATH_MSG_INFO( "Storing E4'  cells in " << m_E4prContainer );
+  if (m_run2 && !m_E4prContainerKey.key().empty()) {
+    ATH_CHECK( m_E4prContainerKey.initialize() );
+    ATH_MSG_INFO( "Storing E4'  cells in " << m_E4prContainerKey.key() );
+  } else {
+    m_E4prContainerKey = ""; // no E4' container for RUN1
   }
 
   if ((TileCablingService::getInstance())->getCablingType() == TileCablingService::UpgradeABC) {
@@ -234,6 +223,15 @@ StatusCode TileCellBuilder::initialize() {
     m_notUpgradeCabling = false;
   }
 
+  ATH_CHECK( m_rawChannelContainerKey.initialize() );
+
+  if (m_mergeChannels && (m_dspRawChannelContainerKey.key() == m_rawChannelContainerKey.key()
+                          || m_dspRawChannelContainerKey.key().empty())) {
+      m_mergeChannels = false;
+  }
+
+  ATH_CHECK( m_dspRawChannelContainerKey.initialize(m_mergeChannels) );
+
   ATH_MSG_INFO( "TileCellBuilder initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -270,7 +268,7 @@ void TileCellBuilder::reset(bool /* fullSizeCont */, bool printReset) {
   m_E4prCells = NULL;
 
   ATH_MSG_INFO( "size of temp vector set to " << m_allCells.size() );
-  ATH_MSG_INFO( "taking RawChannels from '" << m_rawChannelContainer << "'" );
+  ATH_MSG_INFO( "taking RawChannels from '" << m_rawChannelContainerKey.key() << "'" );
 }
 
 void TileCellBuilder::set_type_and_unit(TileFragHash::TYPE type
@@ -302,19 +300,19 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
 
   memset(m_drawerEvtStatus, 0, sizeof(m_drawerEvtStatus));
 
-  const TileRawChannelContainer* rawChannels;
-  if (evtStore()->retrieve(rawChannels, m_rawChannelContainer).isFailure()) {
+  SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
 
-    ATH_MSG_WARNING( " Could not find container " << m_rawChannelContainer );
+  if (!rawChannelContainer.isValid()) {
+    ATH_MSG_WARNING( " Could not find container " << m_rawChannelContainerKey.key() );
     ATH_MSG_WARNING( " do not fill CaloCellContainer " );
 
   } else {
     
-    ATH_MSG_DEBUG( "Container " << m_rawChannelContainer << " with TileRawChannles found ");
+    ATH_MSG_DEBUG( "Container " << m_rawChannelContainerKey.key() << " with TileRawChannles found ");
 
-    m_RChType = rawChannels->get_type();
-    m_RChUnit = rawChannels->get_unit();
-    unsigned int bsflags = rawChannels->get_bsflags();
+    m_RChType = rawChannelContainer->get_type();
+    m_RChUnit = rawChannelContainer->get_unit();
+    unsigned int bsflags = rawChannelContainer->get_bsflags();
     if (m_correctAmplitude || m_correctTime) {
       int DataType = (bsflags & 0x30000000) >> 28;
       if (DataType < 3) { // real data
@@ -345,45 +343,43 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
       }
     }
 
-    if (m_MBTSContainer.size() > 0)
-      m_MBTSCells = new TileCellContainer(SG::VIEW_ELEMENTS);
-    else
-      m_MBTSCells = NULL;
+    if (!m_MBTSContainerKey.key().empty()) {
+      m_MBTSCells = std::make_unique<TileCellContainer>(SG::VIEW_ELEMENTS);
+    }
 
-    if (m_E4prContainer.size() > 0)
-      m_E4prCells = new TileCellContainer(SG::VIEW_ELEMENTS);
-    else
-      m_E4prCells = NULL;
+    if (!m_E4prContainerKey.key().empty()) {
+      m_E4prCells = std::make_unique<TileCellContainer>(SG::VIEW_ELEMENTS);
+    }
 
-    SelectAllObject<TileRawChannelContainer> selAll(rawChannels);
+    SelectAllObject<TileRawChannelContainer> selAll(rawChannelContainer.cptr());
     SelectAllObject<TileRawChannelContainer>::const_iterator begin = selAll.begin();
     SelectAllObject<TileRawChannelContainer>::const_iterator end = selAll.end();
 
     if (m_mergeChannels
-        && m_dspRawChannelContainer != m_rawChannelContainer
-        && m_dspRawChannelContainer.size() > 0) {
+        && m_dspRawChannelContainerKey.key() != m_rawChannelContainerKey.key()
+        && !m_dspRawChannelContainerKey.key().empty()) {
+
+      ATH_MSG_DEBUG( "Merging " << m_rawChannelContainerKey.key()
+                     << " and " << m_dspRawChannelContainerKey.key() );
+
+      SG::ReadHandle<TileRawChannelContainer> dspRawChannelContainer(m_dspRawChannelContainerKey);
 
-      ATH_MSG_DEBUG( "Merging " << m_rawChannelContainer
-                    << " and " << m_dspRawChannelContainer );
-      const TileRawChannelContainer* dspChannels;
-      if (evtStore()->retrieve(dspChannels, m_dspRawChannelContainer).isFailure()) {
+      if (!dspRawChannelContainer.isValid()) {
         // no DSP channels, build cells from primary container
-        ATH_MSG_DEBUG( " No " << m_dspRawChannelContainer << " found, nothing to merge " );
+        ATH_MSG_DEBUG( " No " << m_dspRawChannelContainerKey.key() << " found, nothing to merge " );
 
       } else {
 
         if (m_beamInfo->noiseFilterApplied()) {
-          ATH_MSG_DEBUG( " Noise filter for " << m_dspRawChannelContainer 
+          ATH_MSG_DEBUG( " Noise filter for " << m_dspRawChannelContainerKey.key()
                          << " was already applied, use it directly " );
         } else if (m_noiseFilterTools.size() > 0) {
-          ATH_MSG_DEBUG( " Running noise filter on " << m_dspRawChannelContainer 
+          ATH_MSG_DEBUG( " Running noise filter on " << m_dspRawChannelContainerKey.key()
                          << " (i.e. on second container only) " );
           // apply noise filter on dsp container before merging it with offline contaier
-          ToolHandleArray<ITileRawChannelTool>::iterator itrTool=m_noiseFilterTools.begin();
-          ToolHandleArray<ITileRawChannelTool>::iterator endTool=m_noiseFilterTools.end();
-
-          for (; itrTool != endTool; ++itrTool) {
-            if ((*itrTool)->process(dspChannels).isFailure()) {
+          for (ToolHandle<ITileRawChannelTool>& noiseFilterTool : m_noiseFilterTools) {
+            /// FIXME: const_cast; tools can change the container!
+            if (noiseFilterTool->process(const_cast<TileRawChannelContainer*>(dspRawChannelContainer.cptr())).isFailure()) {
               ATH_MSG_ERROR( " Error status returned from noise filter " );
             } else {
               ATH_MSG_DEBUG( "Noise filter applied to the container" );
@@ -392,9 +388,9 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
           m_beamInfo->setNoiseFilterApplied(true);
         }
         
-        TileFragHash::TYPE dspType = dspChannels->get_type();
-        TileRawChannelUnit::UNIT dspUnit = dspChannels->get_unit();
-        unsigned int dspFlags = dspChannels->get_bsflags();
+        TileFragHash::TYPE dspType = dspRawChannelContainer->get_type();
+        TileRawChannelUnit::UNIT dspUnit = dspRawChannelContainer->get_unit();
+        unsigned int dspFlags = dspRawChannelContainer->get_bsflags();
         int DataType = (dspFlags & 0x30000000) >> 28;
         float dspTimeCut = m_maxTimeCorr;
         bool dspCorrectAmplitude = false, dspCorrectTime = false, dspOf2 = true;
@@ -408,7 +404,7 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
           dspTimeCut = ((dspFlags >> 27) & 1) ? 100.0 : 75.0; // 100 or 75 ns is the limit for 9 or 7 samples
         }
 
-        SelectAllObject<TileRawChannelContainer> selAllDsp(dspChannels);
+        SelectAllObject<TileRawChannelContainer> selAllDsp(dspRawChannelContainer.cptr());
         SelectAllObject<TileRawChannelContainer>::const_iterator beginDsp = selAllDsp.begin();
         SelectAllObject<TileRawChannelContainer>::const_iterator endDsp = selAllDsp.end();
 
@@ -475,11 +471,10 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
             &oflVec, m_RChType, m_RChUnit, m_maxTimeCorr, m_correctAmplitude, m_correctTime, m_of2,
             &dspVec, dspType, dspUnit, dspTimeCut, dspCorrectAmplitude, dspCorrectTime, dspOf2, this, 2);
 
-        if (msgLvl(MSG::DEBUG)) {
-          msg(MSG::DEBUG) << " Calling build() method for rawChannels from two vectors" << endmsg;
-          msg(MSG::DEBUG) << " offline vector size = " << oflVec.size()
-                          << " dsp vector size = " << dspVec.size() << endmsg;
-        }
+        ATH_MSG_DEBUG("Build raw channels from two vectors:"
+                      << " offline vector size = " << oflVec.size()
+                      << ", dsp vector size = " << dspVec.size() );
+
         build(vecBeg, vecEnd, theCellContainer);
         begin = end;
       }
@@ -487,44 +482,37 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
     }
 
     if (begin != end) { // no merging applied, use original raw channel container
-        
+      
       if (m_noiseFilterTools.size() > 0) {
-        ATH_MSG_DEBUG( " Running noise filter on " << m_rawChannelContainer );
+        ATH_MSG_DEBUG( " Running noise filter on " << m_rawChannelContainerKey.key() );
         // apply noise filter on input container before sending it to the build() method
-        ToolHandleArray<ITileRawChannelTool>::iterator itrTool = m_noiseFilterTools.begin();
-        ToolHandleArray<ITileRawChannelTool>::iterator endTool = m_noiseFilterTools.end();
-
-        for (; itrTool != endTool; ++itrTool) {
-          if ((*itrTool)->process(rawChannels).isFailure()) {
+        for (ToolHandle<ITileRawChannelTool>& noiseFilterTool : m_noiseFilterTools) {
+            /// FIXME: const_cast; tools can change the container!
+          if (noiseFilterTool->process(const_cast<TileRawChannelContainer*>(rawChannelContainer.cptr())).isFailure()) {
             ATH_MSG_ERROR( " Error status returned from noise filter " );
           } else {
             ATH_MSG_DEBUG( "Noise filter applied to the container" );
           }
         }
       }
-
-      ATH_MSG_DEBUG( " Calling build() method for rawChannels from " << m_rawChannelContainer );
+      
+      ATH_MSG_DEBUG( " Calling build() method for rawChannels from " << m_rawChannelContainerKey.key() );
       build(begin, end, theCellContainer);
     }
     
-    if (m_MBTSContainer.size() > 0) {
-      if (evtStore()->record(m_MBTSCells, m_MBTSContainer, false).isFailure()) {
-        ATH_MSG_ERROR( " Could not register TileCellContainer for MBTS with name " << m_MBTSContainer );
-      }
+    if (!m_MBTSContainerKey.key().empty()) {
+      SG::WriteHandle<TileCellContainer> MBTSContainer(m_MBTSContainerKey);
+      ATH_CHECK( MBTSContainer.record(std::move(m_MBTSCells)) );
     }
-
-    if (m_E4prContainer.size() > 0) {
-      if (evtStore()->record(m_E4prCells, m_E4prContainer, false).isFailure()) {
-        ATH_MSG_ERROR( " Could not register TileCellContainer for E4'  with name " << m_E4prContainer );
-      }
+    
+    if (!m_E4prContainerKey.key().empty()) {
+      SG::WriteHandle<TileCellContainer> E4prContainer(m_E4prContainerKey);
+      ATH_CHECK( E4prContainer.record(std::move(m_E4prCells)) );
     }
     
     CaloCell_ID::SUBCALO caloNum = CaloCell_ID::TILE;
+
     //specify that a given calorimeter has been filled
-    if (theCellContainer->hasCalo(caloNum)) {
-      // log << MSG::WARNING << "CaloCellContainer has already been filled with TileCells (caloNum = " 
-      //  <<	caloNum << ")" << endmsg ;    
-    }
     theCellContainer->setHasCalo(caloNum);
   }
   
@@ -648,6 +636,7 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
   }
   xAOD::EventInfo* eventInfo = 0;
   if (eventInfo_c) {
+    /// FIXME: const_cast; changing EventInfo.
     eventInfo = const_cast<xAOD::EventInfo*>(eventInfo_c);
     if (!eventInfo->getStore()) {
       const SG::IAuxStore* store = dynamic_cast<const SG::IAuxStore*> (eventInfo->getConstStore());
diff --git a/TileCalorimeter/TileRecUtils/src/TileCellBuilderFromHit.cxx b/TileCalorimeter/TileRecUtils/src/TileCellBuilderFromHit.cxx
index 67e0818f068..60cd38aba7b 100644
--- a/TileCalorimeter/TileRecUtils/src/TileCellBuilderFromHit.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileCellBuilderFromHit.cxx
@@ -21,26 +21,26 @@
 #include "TileConditions/TileCondToolTiming.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 
-// Gaudi includes
-//#include "GaudiKernel/Bootstrap.h"
+// Calo includes
+#include "CaloIdentifier/CaloCell_ID.h"
+#include "CaloEvent/CaloCellContainer.h"
+#include "CaloDetDescr/CaloDetDescrElement.h"
+#include "CaloInterface/ICalorimeterNoiseTool.h"
+#include "CaloConditions/CaloAffectedRegionInfoVec.h"
+#include "Identifier/IdentifierHash.h"
 
 // Atlas includes
 #include "AthAllocators/DataPool.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+
 // access all Hits inside container
 #include "EventContainers/SelectAllObject.h" 
 #include "xAODEventInfo/EventInfo.h"
 #include "AthenaKernel/errorcheck.h"
-
 // For the Athena-based random numbers.
 #include "AthenaKernel/IAtRndmGenSvc.h"
 
-// Calo includes
-#include "CaloIdentifier/CaloCell_ID.h"
-#include "CaloEvent/CaloCellContainer.h"
-#include "CaloDetDescr/CaloDetDescrElement.h"
-#include "CaloInterface/ICalorimeterNoiseTool.h"
-#include "CaloConditions/CaloAffectedRegionInfoVec.h"
-#include "Identifier/IdentifierHash.h"
 
 //CLHEP includes
 #include <CLHEP/Random/Randomize.h>
@@ -76,9 +76,6 @@ const InterfaceID& TileCellBuilderFromHit::interfaceID( ) {
 TileCellBuilderFromHit::TileCellBuilderFromHit(const std::string& type, const std::string& name,
     const IInterface* parent)
   : AthAlgTool(type, name, parent)
-  , m_hitContainer("TileHitCnt")
-  , m_MBTSContainer("MBTSContainer")
-  , m_E4prContainer("E4prContainer")
   , m_infoName("TileInfo")
   , m_eneForTimeCut(35. * MeV) // keep time only for cells above 70 MeV (more than 35 MeV in at least one PMT to be precise)
   , m_eneForTimeCutMBTS(0.03675) // the same cut for MBTS, but in pC, corresponds to 3 ADC counts or 35 MeV
@@ -99,8 +96,6 @@ TileCellBuilderFromHit::TileCellBuilderFromHit(const std::string& type, const st
   , m_noiseTool("CaloNoiseTool")
   , m_tileMgr(0)
   , m_mbtsMgr(0)
-  , m_MBTSCells(0)
-  , m_E4prCells(0)
   , m_RChType(TileFragHash::Default)
 {
   declareInterface<ICaloCellMakerTool>( this );
@@ -114,9 +109,6 @@ TileCellBuilderFromHit::TileCellBuilderFromHit(const std::string& type, const st
   // this will help TopoCluster to assign proper weight to the cell if needed
   m_zeroEnergy = 0.5 * MeV; // half a MeV in both PMTs i.e. one MeV in a cell
 
-  declareProperty("TileHitContainer"            ,m_hitContainer);         // Hits to convert
-  declareProperty("MBTSContainer"               ,m_MBTSContainer);        // Where to put MBTS cells
-  declareProperty("E4prContainer"               ,m_E4prContainer);        // Where to put E4'  cells
   declareProperty("TileInfoName"                ,m_infoName);        // Name of TileInfo store (default=TileInfo);
   declareProperty("TileBadChanTool"        , m_tileBadChanTool);
   declareProperty("TileCondToolEmscale"         , m_tileToolEmscale);
@@ -157,13 +149,20 @@ TileCellBuilderFromHit::~TileCellBuilderFromHit(){
 StatusCode TileCellBuilderFromHit::initialize() {
   
   // retrieve MBTS and Tile detector manager, TileID helper and TileIfno from det store
-  if (m_MBTSContainer.size() > 0) {
+  // retrieve MBTS and Tile detector manager, TileID helper and TileIfno from det store
+  if (m_MBTSContainerKey.key().empty()) {
+    m_mbtsMgr = nullptr;
+    m_MBTSVec.resize(0);
+  } else {
+
+    ATH_CHECK( m_MBTSContainerKey.initialize() );
+    ATH_MSG_INFO( "Storing MBTS cells in " << m_MBTSContainerKey.key() );
+    m_MBTSVec.resize(NCELLMBTS);
+    
     if (detStore()->retrieve(m_mbtsMgr).isFailure()) {
       ATH_MSG_WARNING( "Unable to retrieve MbtsDetDescrManager from DetectorStore" );
-      m_mbtsMgr = 0;
+      m_mbtsMgr = nullptr;
     }
-  } else {
-    m_mbtsMgr = 0;
   }
 
   CHECK( detStore()->retrieve(m_tileMgr) );
@@ -182,8 +181,7 @@ StatusCode TileCellBuilderFromHit::initialize() {
   if (m_useNoiseTool) {
     ATH_MSG_INFO( "Reading electronic noise from DB" );
     CHECK( m_noiseTool.retrieve() );
-  }
-  else {
+  } else {
     ATH_MSG_INFO( "Noise Sigma " << m_noiseSigma << " MeV is selected!" );
   }
 
@@ -197,30 +195,22 @@ StatusCode TileCellBuilderFromHit::initialize() {
   m_allCells.resize(m_tileID->cell_hash_max(), 0);
   m_E1_TOWER = (m_allCells.size() < 10000) ? 10 : 40;
 
-  m_MBTSCells = NULL;
-  m_E4prCells = NULL;
-
   ATH_MSG_INFO( "size of temp vector set to " << m_allCells.size() );
-  ATH_MSG_INFO( "taking hits from '" << m_hitContainer << "'" );
+  ATH_MSG_INFO( "taking hits from '" << m_hitContainerKey.key() << "'" );
 
-  if (m_MBTSContainer.size() > 0) {
-    ATH_MSG_INFO( "Storing MBTS cells in " << m_MBTSContainer );
-    m_MBTSVec.resize(NCELLMBTS);
-  } else {
-    m_MBTSVec.resize(0);
-  }
-  
   m_cabling = TileCablingService::getInstance();
   m_RUN2 = (m_cabling->getCablingType() == TileCablingService::RUN2Cabling);
 
-  if ( m_RUN2 && m_E4prContainer.size() > 0) {
-    ATH_MSG_INFO( "Storing E4'  cells in " << m_E4prContainer );
+  if (m_RUN2 && !m_E4prContainerKey.key().empty()) {
+    ATH_CHECK( m_E4prContainerKey.initialize() );
+    ATH_MSG_INFO( "Storing E4'  cells in " << m_E4prContainerKey.key() );
     m_E4prVec.resize(NCELLE4PR);
   } else {
-    m_E4prContainer = ""; // no E4' container for RUN1
+    m_E4prContainerKey = ""; // no E4' container for RUN1
     m_E4prVec.resize(0);
   }
 
+
   ATH_MSG_INFO( "TileCellBuilderFromHit initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -241,47 +231,44 @@ StatusCode TileCellBuilderFromHit::process(CaloCellContainer * theCellContainer)
 
   memset(m_drawerEvtStatus, 0, sizeof(m_drawerEvtStatus));
 
-  const TileHitContainer* hits;
-  if (evtStore()->retrieve(hits, m_hitContainer).isFailure()) {
+  SG::ReadHandle<TileHitContainer> hitContainer(m_hitContainerKey);
+
+  if (!hitContainer.isValid()) {
 
-    ATH_MSG_WARNING( " Could not find container " << m_hitContainer );
+    ATH_MSG_WARNING( " Could not find container " << m_hitContainerKey.key() );
     ATH_MSG_WARNING( " do not fill CaloCellContainer " );
 
   } else {
     
-    ATH_MSG_DEBUG( "Container " << m_hitContainer << " with TileHits found ");
+    ATH_MSG_DEBUG( "Container " << m_hitContainerKey.key() << " with TileHits found ");
 
-    if (m_MBTSContainer.size() > 0)
-      m_MBTSCells = new TileCellContainer(SG::VIEW_ELEMENTS);
-    else
-      m_MBTSCells = NULL;
-    
-    if (m_E4prContainer.size() > 0)
-      m_E4prCells = new TileCellContainer(SG::VIEW_ELEMENTS);
-    else
-      m_E4prCells = NULL;
+    if (!m_MBTSContainerKey.key().empty()) {
+      m_MBTSCells = std::make_unique<TileCellContainer>(SG::VIEW_ELEMENTS);
+    }
+
+    if (!m_E4prContainerKey.key().empty()) {
+      m_E4prCells = std::make_unique<TileCellContainer>(SG::VIEW_ELEMENTS);
+    }
     
-    SelectAllObject<TileHitContainer> selAll(hits);
+    SelectAllObject<TileHitContainer> selAll(hitContainer.cptr());
     SelectAllObject<TileHitContainer>::const_iterator begin = selAll.begin();
     SelectAllObject<TileHitContainer>::const_iterator end = selAll.end();
 
     if (begin != end) {
-      ATH_MSG_DEBUG( " Calling build() method for hits from " << m_hitContainer );
+      ATH_MSG_DEBUG( " Calling build() method for hits from " << m_hitContainerKey.key() );
       build(begin, end, theCellContainer);
     }
     
-    if (m_MBTSContainer.size() > 0) {
-      if (evtStore()->record(m_MBTSCells, m_MBTSContainer, false).isFailure()) {
-        ATH_MSG_ERROR( " Could not register TileCellContainer for MBTS with name " << m_MBTSContainer );
-      }
-    }
-
-    if (m_E4prContainer.size() > 0) {
-      if (evtStore()->record(m_E4prCells, m_E4prContainer, false).isFailure()) {
-        ATH_MSG_ERROR( " Could not register TileCellContainer for E4'  with name " << m_E4prContainer );
-      }
+    if (!m_MBTSContainerKey.key().empty()) {
+      SG::WriteHandle<TileCellContainer> MBTSContainer(m_MBTSContainerKey);
+      ATH_CHECK( MBTSContainer.record(std::move(m_MBTSCells)) );
     }
     
+    if (!m_E4prContainerKey.key().empty()) {
+      SG::WriteHandle<TileCellContainer> E4prContainer(m_E4prContainerKey);
+      ATH_CHECK( E4prContainer.record(std::move(m_E4prCells)) );
+    }
+
     CaloCell_ID::SUBCALO caloNum = CaloCell_ID::TILE;
     //specify that a given calorimeter has been filled
     if (theCellContainer->hasCalo(caloNum)) {
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilder.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilder.cxx
index c6aec277d3a..730e1ed7dc2 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilder.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilder.cxx
@@ -8,20 +8,15 @@
 #include "TileRecUtils/ITileRawChannelTool.h"
 #include "TileEvent/TileDigits.h"
 #include "TileEvent/TileRawChannel.h"
-#include "CaloIdentifier/TileID.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileConditions/TileInfo.h"
-#include "TileConditions/TileCablingService.h"
-#include "TileConditions/TileCablingSvc.h"
-
-#include "TileEvent/TileRawChannel.h"
-
+#include "CaloIdentifier/TileID.h"
 
 // Atlas includes
 #include "AthenaKernel/errorcheck.h"
+#include "StoreGate/WriteHandle.h"
 
 // Gaudi includes
-#include "GaudiKernel/Property.h"
 
 
 static const InterfaceID IID_ITileRawChannelBuilder("TileRawChannelBuilder", 1, 0);
@@ -50,7 +45,7 @@ Overflows_t& TileRawChannelBuilder::getOverflowedChannels() {
 }
 
 std::string TileRawChannelBuilder::getTileRawChannelContainerID() {
-  return m_TileRawChannelContainerID;
+  return m_rawChannelContainerKey.key();
 }
 
 /**
@@ -59,8 +54,6 @@ std::string TileRawChannelBuilder::getTileRawChannelContainerID() {
 TileRawChannelBuilder::TileRawChannelBuilder(const std::string& type
     , const std::string& name, const IInterface* parent)
   : AthAlgTool(type, name, parent)
-  , m_TileRawChannelContainerID("TileRawChannelFiltered")
-  , m_rawChannelCnt(0)
   , m_rChType(TileFragHash::Default)
   , m_rChUnit(TileRawChannelUnit::ADCcounts)
   , m_bsflags(0)
@@ -88,7 +81,6 @@ TileRawChannelBuilder::TileRawChannelBuilder(const std::string& type
   memset(s_error, 0, sizeof(s_error));
   memset(s_dmuerr, 0, sizeof(s_dmuerr));
 
-  declareProperty("TileRawChannelContainer", m_TileRawChannelContainerID);
   declareProperty("calibrateEnergy", m_calibrateEnergy = false);
   declareProperty("correctTime", m_correctTime = false);
   declareProperty("AmpMinForAmpCorrection", m_ampMinThresh = 15.0);
@@ -112,6 +104,9 @@ TileRawChannelBuilder::~TileRawChannelBuilder() {
  * Initializer
  */
 StatusCode TileRawChannelBuilder::initialize() {
+
+  ATH_MSG_INFO( "TileRawChannelBuilder::initialize()" );
+
   m_trigType = m_runType;
   m_idophys = ((m_trigType == 0) || (m_trigType == 1));
   m_idolas = ((m_trigType == 2) || (m_trigType == 3));
@@ -125,8 +120,6 @@ StatusCode TileRawChannelBuilder::initialize() {
   m_nChL = m_nChH = 0;
   m_RChSumL = m_RChSumH = 0.0;
 
-  ATH_MSG_INFO( "TileRawChannelBuilder::initialize()" );
-
   // retrieve TileID helpers and TileIfno from det store
   CHECK( detStore()->retrieve(m_tileID, "TileID") );
   CHECK( detStore()->retrieve(m_tileHWID, "TileHWID") );
@@ -165,7 +158,7 @@ StatusCode TileRawChannelBuilder::initialize() {
 
   if (msgLvl(MSG::DEBUG)) {
     msg(MSG::DEBUG) << "TileRawChannelBuilder created, storing rc in '"
-                    << m_TileRawChannelContainerID << "'" << endmsg;
+                    << m_rawChannelContainerKey.key() << "'" << endmsg;
     msg(MSG::DEBUG) << " calibrate energy = " << m_calibrateEnergy << endmsg;
     msg(MSG::DEBUG) << " correct time = " << m_correctTime << endmsg;
     msg(MSG::DEBUG) << " run type = " << m_runType << endmsg;
@@ -184,6 +177,8 @@ StatusCode TileRawChannelBuilder::initialize() {
   
   m_notUpgradeCabling = (cabling->getCablingType() != TileCablingService::UpgradeABC);
 
+  ATH_CHECK( m_rawChannelContainerKey.initialize() );
+
   return StatusCode::SUCCESS;
 }
 
@@ -195,17 +190,11 @@ StatusCode TileRawChannelBuilder::finalize() {
 StatusCode TileRawChannelBuilder::createContainer() {
   initLog();
 
-  // create TRC container and record in TES
-  m_rawChannelCnt = new TileRawChannelContainer(true, m_rChType, m_rChUnit, SG::VIEW_ELEMENTS);
+  // create TRC container
+  m_rawChannelCnt = std::make_unique<TileRawChannelContainer>(true, m_rChType, m_rChUnit, SG::VIEW_ELEMENTS);
   m_rawChannelCnt->set_bsflags(m_bsflags);
-  StatusCode sc = evtStore()->record(m_rawChannelCnt, m_TileRawChannelContainerID);
-  if (sc.isFailure()) {
-    ATH_MSG_ERROR( "Error registering TileRawChannelCnt" );
-    delete m_rawChannelCnt;
-    m_rawChannelCnt = NULL;
-    return sc;
-  }
-  ATH_MSG_DEBUG( "Created TileRawChannelContainer '" << m_TileRawChannelContainerID << "'" );
+
+  ATH_MSG_DEBUG( "Created TileRawChannelContainer '" << m_rawChannelContainerKey.key() << "'" );
 
   return StatusCode::SUCCESS;
 }
@@ -493,6 +482,7 @@ void TileRawChannelBuilder::build(const TileDigitsCollection* coll) {
 }
 
 StatusCode TileRawChannelBuilder::commitContainer() {
+
   ToolHandleArray<ITileRawChannelTool>::iterator itrTool = m_noiseFilterTools.begin();
   ToolHandleArray<ITileRawChannelTool>::iterator endTool = m_noiseFilterTools.end();
 
@@ -504,7 +494,8 @@ StatusCode TileRawChannelBuilder::commitContainer() {
       ATH_MSG_DEBUG( "Noise filter was already applied to DSP container before, use it as it is" );
     } else {
       for (;itrTool!=endTool;++itrTool){
-        if ((*itrTool)->process(dspCnt).isFailure()) {
+        /// FIXME: const_cast
+        if ((*itrTool)->process(const_cast<TileRawChannelContainer*>(dspCnt)).isFailure()) {
           ATH_MSG_ERROR( " Error status returned from noise filter " );
         } else {
           ATH_MSG_DEBUG( "Noise filter applied to DSP container" );
@@ -540,7 +531,7 @@ StatusCode TileRawChannelBuilder::commitContainer() {
       TileRawChannelCollection::const_iterator dspLast=dcoll->end();
 
       for(; rchItr!=lastRch; ++rchItr) {
-        TileRawChannel* rch = (*rchItr);
+        const TileRawChannel* rch = (*rchItr);
         HWIdentifier adc_id = rch->adc_HWID();
         while (dspItr != dspLast && adc_id != (*dspItr)->adc_HWID()) {
           ++dspItr;
@@ -550,8 +541,9 @@ StatusCode TileRawChannelBuilder::commitContainer() {
           ATH_MSG_VERBOSE( "Ch "<<m_tileHWID->to_string(adc_id)
                            <<" amp " << rch->amplitude() << " ped " << rch->pedestal() 
                            << " corr " << corr );
-          rch->setAmplitude (rch->amplitude() - corr);
-          rch->setPedestal (rch->pedestal() + corr);
+          /// FIXME: const_cast
+          const_cast<TileRawChannel*>(rch)->setAmplitude (rch->amplitude() - corr);
+          const_cast<TileRawChannel*>(rch)->setPedestal (rch->pedestal() + corr);
         } else {
           ATH_MSG_WARNING(" Problem in applying noise corrections " 
                         << " can not find channel in DSP container with HWID "
@@ -563,34 +555,26 @@ StatusCode TileRawChannelBuilder::commitContainer() {
     
   } else {
 
-    for (; itrTool != endTool; ++itrTool) {
-      if ((*itrTool)->process(m_rawChannelCnt).isFailure()) {
+    for (ToolHandle<ITileRawChannelTool>& noiseFilterTool : m_noiseFilterTools) {
+      if (noiseFilterTool->process(m_rawChannelCnt.get()).isFailure()) {
         ATH_MSG_ERROR( " Error status returned from noise filter " );
       } else {
         ATH_MSG_DEBUG( "Noise filter applied to the container" );
       }
     }
+
   }
   
   ATH_MSG_DEBUG( " nCh=" << m_chCounter
                 << " nChH/L=" << m_nChH << "/" << m_nChL
                 << " RChSumH/L=" << m_RChSumH << "/" << m_RChSumL );
 
-    // ATH_MSG_DEBUG( m_chCounter << " channels stored in '"
-    //                  << m_TileRawChannelContainerID << "' " );
-
-
-  //lock RawChannel container
-  StatusCode sc = evtStore()->setConst(m_rawChannelCnt);
-  if (sc.isFailure()) {
-    ATH_MSG_ERROR( " Could not lock TileRawChannelContainer '"
-                  << m_TileRawChannelContainerID << "'" );
-  }
-  m_rawChannelCnt = NULL;
+  SG::WriteHandle<TileRawChannelContainer> rawChannelsContainer(m_rawChannelContainerKey);
+  ATH_CHECK( rawChannelsContainer.record(std::move(m_rawChannelCnt)) );
 
   endLog();
 
-  return sc;
+  return StatusCode::SUCCESS;
 }
 
 void TileRawChannelBuilder::endLog() {
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFitFilter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFitFilter.cxx
index 2d11c6296f2..d3b740db41b 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFitFilter.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFitFilter.cxx
@@ -53,7 +53,7 @@ TileRawChannelBuilderFitFilter::TileRawChannelBuilderFitFilter(const std::string
   declareInterface< TileRawChannelBuilder >( this );
   declareInterface< TileRawChannelBuilderFitFilter >(this);
 
-  m_TileRawChannelContainerID = "TileRawChannelFit";
+  m_rawChannelContainerKey = "TileRawChannelFit";
 
   //declare properties
   declareProperty("FrameLength",m_frameLength = 9);
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFitFilterCool.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFitFilterCool.cxx
index dec6def6924..85254c85ca7 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFitFilterCool.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFitFilterCool.cxx
@@ -60,7 +60,7 @@ TileRawChannelBuilderFitFilterCool::TileRawChannelBuilderFitFilterCool(const std
   declareInterface< TileRawChannelBuilder >( this );
   declareInterface< TileRawChannelBuilderFitFilterCool >(this);
 
-  m_TileRawChannelContainerID = "TileRawChannelFitCool";
+  m_rawChannelContainerKey = "TileRawChannelFitCool";
 
   //declare properties
   declareProperty("FrameLength",m_frameLength = 9);
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFlatFilter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFlatFilter.cxx
index 1b47b549e12..1741a737fe2 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFlatFilter.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderFlatFilter.cxx
@@ -46,7 +46,7 @@ TileRawChannelBuilderFlatFilter::TileRawChannelBuilderFlatFilter(const std::stri
   declareInterface< TileRawChannelBuilder >( this );
   declareInterface< TileRawChannelBuilderFlatFilter >(this);
     
-  m_TileRawChannelContainerID = "TileRawChannelFlat";
+  m_rawChannelContainerKey = "TileRawChannelFlat";
 
   //declare properties
   declareProperty("PedStart",m_pedStart = 0);
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderMF.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderMF.cxx
index 6f88b191331..3a0ce947ba9 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderMF.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderMF.cxx
@@ -53,7 +53,7 @@ TileRawChannelBuilderMF::TileRawChannelBuilderMF(const std::string& type, const
   declareInterface<TileRawChannelBuilder>(this);
   declareInterface<TileRawChannelBuilderMF>(this);
 
-  m_TileRawChannelContainerID = "TileRawChannelMF";
+  m_rawChannelContainerKey = "TileRawChannelMF";
 
   //declare properties
   declareProperty("TileCondToolTiming", m_tileToolTiming);
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderManyAmps.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderManyAmps.cxx
index 9c0d6012394..73f7ec2cddb 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderManyAmps.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderManyAmps.cxx
@@ -43,7 +43,7 @@ TileRawChannelBuilderManyAmps::TileRawChannelBuilderManyAmps(const std::string&
   declareInterface< TileRawChannelBuilder >( this );
   declareInterface< TileRawChannelBuilderManyAmps >(this);
     
-  m_TileRawChannelContainerID = "TileRawChannelManyAmps";
+  m_rawChannelContainerKey = "TileRawChannelManyAmps";
 
   //declare properties
   declareProperty("FilterMode",  m_digitFilterMode = 2);  // can be 2 or 3
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderOpt2Filter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderOpt2Filter.cxx
index e47408432dd..505bcc263cc 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderOpt2Filter.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderOpt2Filter.cxx
@@ -72,7 +72,7 @@ TileRawChannelBuilderOpt2Filter::TileRawChannelBuilderOpt2Filter(const std::stri
   declareInterface< TileRawChannelBuilder >( this );
   declareInterface< TileRawChannelBuilderOpt2Filter >(this);
 
-  m_TileRawChannelContainerID = "TileRawChannelOpt2";
+  m_rawChannelContainerKey = "TileRawChannelOpt2";
   
   //declare properties
   declareProperty("TileCondToolTiming", m_tileToolTiming);
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderOptFilter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderOptFilter.cxx
index 1fb6ad676b5..434fd7eb8f9 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderOptFilter.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderOptFilter.cxx
@@ -66,7 +66,7 @@ TileRawChannelBuilderOptFilter::TileRawChannelBuilderOptFilter(const std::string
   declareInterface< TileRawChannelBuilder >( this );
   declareInterface< TileRawChannelBuilderOptFilter >(this);
 
-  m_TileRawChannelContainerID = "TileRawChannelOpt";
+  m_rawChannelContainerKey = "TileRawChannelOpt";
 
   //declare properties
   declareProperty("MaxIterations", m_maxIterations = 5);
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderQIEFilter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderQIEFilter.cxx
index e5bbadd5a02..55135953a6e 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderQIEFilter.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderQIEFilter.cxx
@@ -72,7 +72,7 @@ TileRawChannelBuilderQIEFilter::TileRawChannelBuilderQIEFilter(const std::string
 	declareInterface < TileRawChannelBuilder > (this);
 	declareInterface < TileRawChannelBuilderQIEFilter > (this);
 
-	m_TileRawChannelContainerID = "TileRawChannelQIE";
+	m_rawChannelContainerKey = "TileRawChannelQIE";
 
 	//declare properties
 //  declareProperty("TileCondToolTiming", m_tileToolTiming);
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelMaker.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelMaker.cxx
index 328a3e27dcd..a3f2d64598e 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelMaker.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelMaker.cxx
@@ -2,21 +2,17 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// Gaudi includes
-#include "GaudiKernel/Property.h"
-#include "GaudiKernel/ListItem.h"
-#include "GaudiKernel/ToolHandle.h"
-
+// Tile includes
+#include "TileRecUtils/TileRawChannelMaker.h"
+#include "TileRecUtils/TileRawChannelBuilder.h"
+ 
 // Atlas includes
 #include "AthenaKernel/errorcheck.h"
-
 // access all RawChannels inside container
 #include "EventContainers/SelectAllObject.h"
-
-// Tile includes
-#include "TileEvent/TileDigitsContainer.h"
-#include "TileRecUtils/TileRawChannelBuilder.h"
-#include "TileRecUtils/TileRawChannelMaker.h"
+#include "StoreGate/ReadHandle.h"
+ 
+// Gaudi includes
 
 #include <algorithm>
 #include <set>
@@ -29,13 +25,10 @@
 TileRawChannelMaker::TileRawChannelMaker(const std::string& name,
     ISvcLocator* pSvcLocator)
     : AthAlgorithm(name, pSvcLocator)
-    , m_TileDigitsContainerID("TileDigitsCnt")
     , m_tileRawChannelBuilderList()
     , m_fitOverflow(false)      
     , m_tileRawChannelBuilderFitOverflow("TileRawChannelBuilder")
 {
-  // declareProperty("TileRawChannelBuilder",m_TileRawChannelBuilderIDVec);
-  declareProperty("TileDigitsContainer", m_TileDigitsContainerID);
   declareProperty("TileRawChannelBuilder", m_tileRawChannelBuilderList, "List Of Tools");
   declareProperty("FitOverflow", m_fitOverflow, "Fit or not overflows");
   declareProperty("TileRawChannelBuilderFitOverflow", m_tileRawChannelBuilderFitOverflow, "Tool to fit overflows");
@@ -72,6 +65,8 @@ StatusCode TileRawChannelMaker::initialize() {
     m_tileRawChannelBuilderFitOverflow.disable();
   }
 
+  ATH_CHECK( m_digitsContainerKey.initialize() );
+
   ATH_MSG_INFO( "Initialization completed successfully");
 
   return StatusCode::SUCCESS;
@@ -83,24 +78,20 @@ StatusCode TileRawChannelMaker::initialize() {
 StatusCode TileRawChannelMaker::execute() {
 
   // get named TileDigitsContaner from TES
-  const TileDigitsContainer *digiCnt;
-  if (evtStore()->retrieve(digiCnt, m_TileDigitsContainerID).isFailure()) {
+  SG::ReadHandle<TileDigitsContainer> digitsContaner(m_digitsContainerKey);
+
+  if (!digitsContaner.isValid()) {
     ATH_MSG_WARNING( "Can't retrieve TileDigitsContainer '"
-                    << m_TileDigitsContainerID << "' from TDS" );
+                    << m_digitsContainerKey.key() << "' from TDS" );
 
     return StatusCode::SUCCESS;
   }
 
-  ATH_MSG_DEBUG( "Got TileDigitsContainer '" << m_TileDigitsContainerID << "'" );
-
-  ToolHandleArray<TileRawChannelBuilder>::iterator itRChB =
-      m_tileRawChannelBuilderList.begin();
-  ToolHandleArray<TileRawChannelBuilder>::iterator itRChBEnd =
-      m_tileRawChannelBuilderList.end();
+  ATH_MSG_DEBUG( "Got TileDigitsContainer '" << m_digitsContainerKey.key() << "'" );
 
   // create  RawChannel Containers for all sub-algs
-  for (; itRChB != itRChBEnd; ++itRChB) {
-    CHECK( (*itRChB)->createContainer() );
+  for (ToolHandle<TileRawChannelBuilder>& rawChannelBuilder : m_tileRawChannelBuilderList) {
+    CHECK( rawChannelBuilder->createContainer() );
   }
 
   //make sure that we clean memory about errors in a drawer
@@ -108,25 +99,20 @@ StatusCode TileRawChannelMaker::execute() {
 
   // clean memory about overflows
   if (m_fitOverflow) {
-    itRChB = m_tileRawChannelBuilderList.begin();
-    for (; itRChB != itRChBEnd; ++itRChB) {
-      (*itRChB)->resetOverflows();
+    for (ToolHandle<TileRawChannelBuilder>& rawChannelBuilder : m_tileRawChannelBuilderList) {
+      rawChannelBuilder->resetOverflows();
     }
   }
 
   // Iterate over all collections (drawers) with digits
-  TileDigitsContainer::const_iterator collItr = digiCnt->begin();
-  TileDigitsContainer::const_iterator lastColl = digiCnt->end();
-
-  for (; collItr != lastColl; ++collItr) {
-    const TileDigitsCollection * coll = (*collItr);
+  for (const TileDigitsCollection* digitsCollection : *digitsContaner) {
 
     // Iterate over all sub-algs
-    itRChB = m_tileRawChannelBuilderList.begin();
-    for (; itRChB != itRChBEnd; ++itRChB) {
+    for (ToolHandle<TileRawChannelBuilder>& rawChannelBuilder : m_tileRawChannelBuilderList) {
       // reconstruct all channels in one drawer
-      (*itRChB)->build(coll);
+      rawChannelBuilder->build(digitsCollection);
     }
+
   }
 
   if (m_fitOverflow
@@ -135,9 +121,8 @@ StatusCode TileRawChannelMaker::execute() {
   }
 
   // commit RawChannel Containers for all sub-algs
-  itRChB = m_tileRawChannelBuilderList.begin();
-  for (; itRChB != itRChBEnd; ++itRChB) {
-    CHECK( (*itRChB)->commitContainer() );
+  for (ToolHandle<TileRawChannelBuilder>& rawChannelBuilder : m_tileRawChannelBuilderList) {
+    CHECK( rawChannelBuilder->commitContainer() );
   }
 
   ATH_MSG_DEBUG( "execute completed successfully" );
@@ -157,20 +142,15 @@ StatusCode TileRawChannelMaker::finalize() {
 
 void TileRawChannelMaker::fitOverflowedChannels() {
 
-  ToolHandleArray<TileRawChannelBuilder>::iterator itRChB =
-      m_tileRawChannelBuilderList.begin();
-  ToolHandleArray<TileRawChannelBuilder>::iterator itRChBEnd =
-      m_tileRawChannelBuilderList.end();
+  for (ToolHandle<TileRawChannelBuilder> rawChannelBuilder : m_tileRawChannelBuilderList) {
+
+    Overflows_t overflows = rawChannelBuilder->getOverflowedChannels();
+
+    for (std::pair<TileRawChannel*, const TileDigits*>& overflow : overflows) {
 
-  // Iterate over all sub-algs  
-	itRChB = m_tileRawChannelBuilderList.begin();
-  for (; itRChB != itRChBEnd; ++itRChB) {
+      TileRawChannel* rwCh = overflow.first;
+      const TileDigits* pDigits = overflow.second;
 
-    Overflows_t overflows = (*itRChB)->getOverflowedChannels();
-    Overflows_t::const_iterator itOverflow = overflows.begin();
-    for (; itOverflow != overflows.end(); ++itOverflow) {
-      TileRawChannel* rwCh = (*itOverflow).first;
-      const TileDigits* pDigits = (*itOverflow).second;
       TileRawChannel* fittedRwCh = m_tileRawChannelBuilderFitOverflow->rawChannel(pDigits);
 
       bool fitOK = ( ( fabs(fittedRwCh->time()) < m_overflowReplaceTimeCut     ) &&
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx
index 860b7b5b516..bde807b6800 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx
@@ -88,7 +88,8 @@ StatusCode TileRawChannelNoiseFilter::initialize() {
 
 // ============================================================================
 // process container
-StatusCode TileRawChannelNoiseFilter::process(const TileRawChannelContainer *rchCont) {
+StatusCode TileRawChannelNoiseFilter::process(
+    TileRawChannelContainer *rchCont) {
 
   ATH_MSG_DEBUG("in process()");
 
@@ -281,7 +282,8 @@ StatusCode TileRawChannelNoiseFilter::process(const TileRawChannelContainer *rch
 
     // iterate over all channels in a collection again
     for (rchItr = coll->begin(); rchItr != lastRch; ++rchItr) {
-      TileRawChannel* rch = (*rchItr);
+      /// FIXME: const_cast
+      TileRawChannel* rch = const_cast<TileRawChannel*>(*rchItr);
       int chan = m_tileHWID->channel(rch->adc_HWID());
       int gain = m_tileHWID->adc(rch->adc_HWID());
 
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelOF1Corrector.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelOF1Corrector.cxx
index ec3f5b09d9f..2b183ebf04f 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelOF1Corrector.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelOF1Corrector.cxx
@@ -5,7 +5,6 @@
 // Tile includes
 #include "TileRecUtils/TileRawChannelOF1Corrector.h"
 #include "TileEvent/TileRawChannelContainer.h"
-#include "TileEvent/TileDigitsContainer.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileIdentifier/TileRawChannelUnit.h"
 #include "TileIdentifier/TileHWID.h"
@@ -16,6 +15,7 @@
 #include "TileConditions/TileCondToolDspThreshold.h"
 
 // Atlas includes
+#include "StoreGate/ReadHandle.h"
 #include "AthenaKernel/errorcheck.h"
 
 static const InterfaceID IID_ITileRawChannelOF1Corrector("TileRawChannelOF1Corrector", 1, 0);
@@ -45,7 +45,6 @@ TileRawChannelOF1Corrector::TileRawChannelOF1Corrector(const std::string& type,
   declareProperty("TileCondToolEmscale", m_tileToolEms);
   declareProperty("TileCondToolDspThreshold", m_tileDspThreshold);
 
-  declareProperty("TileDigitsContainer", m_digitsContainerName = "TileDigitsCnt");
   declareProperty("ZeroAmplitudeWithoutDigits", m_zeroAmplitudeWithoutDigits = true);
   declareProperty("CorrectPedestalDifference", m_correctPedestalDifference = true);
 }
@@ -78,6 +77,12 @@ StatusCode TileRawChannelOF1Corrector::initialize() {
     CHECK( m_tileDspThreshold.retrieve() );
   }
 
+  if (m_zeroAmplitudeWithoutDigits) {
+    ATH_CHECK( m_digitsContainerKey.initialize() );
+  } else {
+    m_digitsContainerKey = "";
+  }
+
   return StatusCode::SUCCESS;
 }
 
@@ -85,7 +90,7 @@ StatusCode TileRawChannelOF1Corrector::initialize() {
 
 // ============================================================================
 // process container
-StatusCode TileRawChannelOF1Corrector::process(const TileRawChannelContainer* rawChannelContainer) {
+StatusCode TileRawChannelOF1Corrector::process(TileRawChannelContainer* rawChannelContainer) {
 
   ATH_MSG_DEBUG("in process()");
 
@@ -100,7 +105,11 @@ StatusCode TileRawChannelOF1Corrector::process(const TileRawChannelContainer* ra
     ATH_MSG_VERBOSE( "Units in container is " << rawChannelUnit );
 
     const TileDigitsContainer* digitsContainer(nullptr);
-    if (m_zeroAmplitudeWithoutDigits) CHECK( evtStore()->retrieve(digitsContainer, m_digitsContainerName) );
+
+    if (m_zeroAmplitudeWithoutDigits) {
+      SG::ReadHandle<TileDigitsContainer> allDigits(m_digitsContainerKey);
+      digitsContainer = allDigits.cptr();
+    }
 
     for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
 
@@ -127,7 +136,8 @@ StatusCode TileRawChannelOF1Corrector::process(const TileRawChannelContainer* ra
         }
       }
 
-      for (TileRawChannel* rawChannel : *rawChannelCollection) {
+      /// FIXME: const_cast
+      for (TileRawChannel* rawChannel : const_cast<TileRawChannelCollection&>(*rawChannelCollection)) {
         HWIdentifier adcId = rawChannel->adc_HWID();
         int channel = m_tileHWID->channel(adcId);
         int gain = m_tileHWID->adc(adcId);
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelVerify.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelVerify.cxx
index 51024e36bae..8aa4db83b7f 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelVerify.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelVerify.cxx
@@ -16,19 +16,19 @@
 //
 //*****************************************************************************
 
-// Gaudi includes
-#include "GaudiKernel/Bootstrap.h"
-#include "GaudiKernel/ISvcLocator.h"
+// Tile includes
+#include "TileRecUtils/TileRawChannelVerify.h"
+#include "TileIdentifier/TileHWID.h"
+#include "StoreGate/ReadHandle.h"
 
 // Atlas includes
 // access all RawChannels inside container
 #include "EventContainers/SelectAllObject.h" 
 #include "AthenaKernel/errorcheck.h"
 
-// Tile includes
-#include "TileIdentifier/TileHWID.h"
-#include "TileEvent/TileRawChannelContainer.h"
-#include "TileRecUtils/TileRawChannelVerify.h"
+// Gaudi includes
+#include "GaudiKernel/Bootstrap.h"
+#include "GaudiKernel/ISvcLocator.h"
 
 // C++ STL includes
 #include <vector>
@@ -61,8 +61,6 @@ TileRawChannelVerify::TileRawChannelVerify(string name, ISvcLocator* pSvcLocator
   : AthAlgorithm(name, pSvcLocator)
   , m_tileHWID(0)
 {
-  declareProperty("TileRawChannelContainer1", m_rawChannelContainer1 = "TileRawChannelContainer1");
-  declareProperty("TileRawChannelContainer2", m_rawChannelContainer2 = "TileRawChannelContainer2");
   declareProperty("Precision", m_precision = 0);
   declareProperty("DumpRawChannels", m_dumpRawChannels = false);
   declareProperty("SortFlag", m_sortFlag = false);
@@ -77,6 +75,9 @@ StatusCode TileRawChannelVerify::initialize() {
   // retrieve TileHWID helper from det store
   CHECK( detStore()->retrieve(m_tileHWID) );
 
+  ATH_CHECK( m_rawChannelContainer1Key.initialize() );
+  ATH_CHECK( m_rawChannelContainer2Key.initialize() );
+
   ATH_MSG_INFO( "TileRawChannelVerify initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -85,16 +86,14 @@ StatusCode TileRawChannelVerify::initialize() {
 StatusCode TileRawChannelVerify::execute() {
 
   // step1: read two cell containers from TES
-  const TileRawChannelContainer* pRawChannels1;
-  const TileRawChannelContainer* pRawChannels2;
-  CHECK( evtStore()->retrieve(pRawChannels1, m_rawChannelContainer1) );
-  CHECK( evtStore()->retrieve(pRawChannels2, m_rawChannelContainer2) );
+  SG::ReadHandle<TileRawChannelContainer> rawChannelContainer1(m_rawChannelContainer1Key);
+  SG::ReadHandle<TileRawChannelContainer> rawChannelContainer2(m_rawChannelContainer2Key);
 
-  SelectAllObject<TileRawChannelContainer> selAll1(pRawChannels1);
+  SelectAllObject<TileRawChannelContainer> selAll1(rawChannelContainer1.cptr());
   SelectAllObject<TileRawChannelContainer>::const_iterator rawItr1 = selAll1.begin();
   SelectAllObject<TileRawChannelContainer>::const_iterator end1 = selAll1.end();
 
-  SelectAllObject<TileRawChannelContainer> selAll2(pRawChannels2);
+  SelectAllObject<TileRawChannelContainer> selAll2(rawChannelContainer2.cptr());
   SelectAllObject<TileRawChannelContainer>::const_iterator rawItr2 = selAll2.begin();
   SelectAllObject<TileRawChannelContainer>::const_iterator end2 = selAll2.end();
 
@@ -105,8 +104,8 @@ StatusCode TileRawChannelVerify::execute() {
   int nSize2 = 0;
   for (; rawItr2 != end2; ++rawItr2) ++nSize2;
 
-  ATH_MSG_INFO( "The number of cells in " << m_rawChannelContainer1 << " is " << nSize1 );
-  ATH_MSG_INFO( "The number of cells in " << m_rawChannelContainer2 << " is " << nSize2 );
+  ATH_MSG_INFO( "The number of cells in " << m_rawChannelContainer1Key.key() << " is " << nSize1 );
+  ATH_MSG_INFO( "The number of cells in " << m_rawChannelContainer2Key.key() << " is " << nSize2 );
 
   if (nSize1 != nSize2) {
     ATH_MSG_ERROR( "The number of rawChannels is not equal in the two containers" );
@@ -114,24 +113,24 @@ StatusCode TileRawChannelVerify::execute() {
   }
 
   // step3: to sort the cells in the containers by amplitude
-  vector<const TileRawChannel*> v1;
-  vector<const TileRawChannel*> v2;
-  const TileRawChannel* p1;
-  const TileRawChannel* p2;
+  vector<const TileRawChannel*> rawChannels1;
+  vector<const TileRawChannel*> rawChannels2;
+  const TileRawChannel* rawChannel1;
+  const TileRawChannel* rawChannel2;
   if (m_sortFlag) {
     rawItr1 = selAll1.begin();
     end1 = selAll1.end();
     for (; rawItr1 != end1; ++rawItr1)
-      v1.push_back((*rawItr1));
+      rawChannels1.push_back((*rawItr1));
 
-    sort(v1.begin(), v1.end(), CompRawChannel());
+    sort(rawChannels1.begin(), rawChannels1.end(), CompRawChannel());
 
     rawItr2 = selAll2.begin();
     end2 = selAll2.end();
     for (; rawItr2 != end2; ++rawItr2)
-      v2.push_back((*rawItr2));
+      rawChannels2.push_back((*rawItr2));
 
-    sort(v2.begin(), v2.end(), CompRawChannel());
+    sort(rawChannels2.begin(), rawChannels2.end(), CompRawChannel());
   }
 
   rawItr1 = selAll1.begin();
@@ -145,23 +144,24 @@ StatusCode TileRawChannelVerify::execute() {
   bool bHeaderFlag = true;
   for (int i = 0; i < nSize1; ++i) {
     if (m_sortFlag) {
-      p1 = v1[i];
-      p2 = v2[i];
+      rawChannel1 = rawChannels1[i];
+      rawChannel2 = rawChannels2[i];
     } else {
-      p1 = (*rawItr1);
+      rawChannel1 = (*rawItr1);
       ++rawItr1;
-      p2 = (*rawItr2);
+      rawChannel2 = (*rawItr2);
       ++rawItr2;
     }
-    HWIdentifier id1 = p1->adc_HWID();
-    HWIdentifier id2 = p2->adc_HWID();
-    double amp1 = p1->amplitude();
-    double amp2 = p2->amplitude();
+    HWIdentifier id1 = rawChannel1->adc_HWID();
+    HWIdentifier id2 = rawChannel2->adc_HWID();
+    double amp1 = rawChannel1->amplitude();
+    double amp2 = rawChannel2->amplitude();
     double diff = fabs(amp1 - amp2);
     if (id1 != id2 || diff > m_precision) bErrorFlag = true;
     if (msgLvl(MSG::VERBOSE) && (m_dumpRawChannels || bErrorFlag)) {
       if (bHeaderFlag) {
-        msg(MSG::VERBOSE) << "             ===" << m_rawChannelContainer1 << "===      ===" << m_rawChannelContainer2 << "===" << endmsg;
+        msg(MSG::VERBOSE) << "             ===" << m_rawChannelContainer1Key.key() 
+                          << "===      ===" << m_rawChannelContainer2Key.key() << "===" << endmsg;
         msg(MSG::VERBOSE) << "  Index      e1            id1        |        e2           id2" << endmsg;
         msg(MSG::VERBOSE) << "--------------------------------------------------------------------------------" << endmsg;
         bHeaderFlag = false;
@@ -186,11 +186,11 @@ StatusCode TileRawChannelVerify::execute() {
     msg(MSG::VERBOSE) << "--------------------------------------------------------------------------------" << endmsg;
   }
   if (!bErrorFlag) {
-    ATH_MSG_INFO( "The two cellContainers (" << m_rawChannelContainer1
-                 << " and " << m_rawChannelContainer2 << ") are the same!!!" );
+    ATH_MSG_INFO( "The two cellContainers (" << m_rawChannelContainer1Key.key()
+                  << " and " << m_rawChannelContainer2Key.key() << ") are the same!!!" );
   } else {
-    ATH_MSG_INFO( "The two cellContainers (" << m_rawChannelContainer1
-                 << " and " << m_rawChannelContainer2 << ") are not the same!!!" );
+    ATH_MSG_INFO( "The two cellContainers (" << m_rawChannelContainer1Key.key()
+                  << " and " << m_rawChannelContainer2Key.key() << ") are not the same!!!" );
   }
 
   // Execution completed.
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawCorrelatedNoise.cxx b/TileCalorimeter/TileRecUtils/src/TileRawCorrelatedNoise.cxx
index 4b85b2eeb01..82b56141cba 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawCorrelatedNoise.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawCorrelatedNoise.cxx
@@ -2,34 +2,30 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// Gaudi includes
-#include "GaudiKernel/Property.h"
-#include "GaudiKernel/ListItem.h"
-
-// Atlas includes
-// access all RawChannels inside container
-#include "EventContainers/SelectAllObject.h"
-#include "AthenaKernel/errorcheck.h"
-
 // Tile includes
 #include "TileRecUtils/TileRawCorrelatedNoise.h"
-#include "TileEvent/TileDigitsContainer.h"
 #include "TileEvent/TileDigits.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileConditions/TileInfo.h"
 
+// Atlas includes
+// access all RawChannels inside container
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "EventContainers/SelectAllObject.h"
+#include "AthenaKernel/errorcheck.h"
 #include "PathResolver/PathResolver.h"
 
+
+
+#include <memory>
+
 // #############################################################################
 TileRawCorrelatedNoise::TileRawCorrelatedNoise(const std::string& name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
-  , m_tileDigitsInputContainer("TileDigitsCnt")
-  , m_tileDigitsOutputContainer("NewDigitsContainer")
 {
 // #############################################################################
 
-  declareProperty("TileDigitsContainer",m_tileDigitsInputContainer);
-  declareProperty("TileDigitsOutputContainer",m_tileDigitsOutputContainer);
   declareProperty("nRMSThreshold", m_nRMS_threshold = 2.);
   declareProperty("AlphaMatrixFilePrefix", m_alphaMatrixFilePrefix  = "AlphaMatrix");
   declareProperty("MeanFilePrefix", m_meanFilePrefix  = "Mean");
@@ -290,6 +286,9 @@ StatusCode TileRawCorrelatedNoise::initialize() {
     }
   }
 
+  ATH_CHECK( m_inputDigitsContainerKey.initialize() );
+  ATH_CHECK( m_outputDigitsContainerKey.initialize() );
+
   ATH_MSG_INFO( "Initialization completed successfully" );
 
   return StatusCode::SUCCESS;
@@ -300,13 +299,9 @@ StatusCode TileRawCorrelatedNoise::execute() {
 // #############################################################################
 
   // get named TileDigitsContaner from TES
-  const TileDigitsContainer *digiCnt;
-  if (evtStore()->retrieve(digiCnt, m_tileDigitsInputContainer).isFailure()) {
-    ATH_MSG_WARNING( "Can't retrieve TileDigitsContainer '" << m_tileDigitsInputContainer << "' from TDS" );
-    return StatusCode::SUCCESS;
-  }
+  SG::ReadHandle<TileDigitsContainer> inputDigitsContainer(m_inputDigitsContainerKey);
 
-  ATH_MSG_DEBUG( "Got TileDigitsContainer '" << m_tileDigitsInputContainer << "'" );
+  ATH_MSG_DEBUG( "Got TileDigitsContainer '" << m_inputDigitsContainerKey.key() << "'" );
 
   const TileHWID* tileHWID;
   CHECK( detStore()->retrieve(tileHWID, "TileHWID") );
@@ -319,7 +314,7 @@ StatusCode TileRawCorrelatedNoise::execute() {
   const TileDigits* OriginalDigits[4][64][48];
 
   // go through ALL TileDigits in container
-  SelectAllObject<TileDigitsContainer> selAll(digiCnt);
+  SelectAllObject<TileDigitsContainer> selAll(inputDigitsContainer.cptr());
   SelectAllObject<TileDigitsContainer>::const_iterator digItr = selAll.begin();
   SelectAllObject<TileDigitsContainer>::const_iterator lastDig = selAll.end();
 
@@ -384,8 +379,9 @@ StatusCode TileRawCorrelatedNoise::execute() {
   }
 
   // create new container
-  TileDigits * NewDigits[4][64][48];
-  TileDigitsContainer* NewDigitsContainer = new TileDigitsContainer();
+  TileDigits* NewDigits[4][64][48];
+  SG::WriteHandle<TileDigitsContainer> outputDigitsContainer(m_outputDigitsContainerKey);
+  ATH_CHECK( outputDigitsContainer.record( std::make_unique<TileDigitsContainer>() ) );
 
   // fill new container
   for (int Ros = 1; Ros < 5; ++Ros) {
@@ -399,19 +395,12 @@ StatusCode TileRawCorrelatedNoise::execute() {
           }
           NewDigits[Ros - 1][Drawer][Channel] = new TileDigits(
               (OriginalDigits[Ros - 1][Drawer][Channel])->adc_HWID(), digits);
-          NewDigitsContainer->push_back(NewDigits[Ros - 1][Drawer][Channel]);
+          outputDigitsContainer->push_back(NewDigits[Ros - 1][Drawer][Channel]);
         }
       }
     }
   }
 
-  // register new container in TES
-  CHECK( evtStore()->record(NewDigitsContainer, "NewDigitsContainer") );
-
-  // lock new container
-  CHECK( evtStore()->setConst(NewDigitsContainer) );
-
-  NewDigitsContainer = NULL;
 
   ATH_MSG_DEBUG( "execute completed successfully" );
 
diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsMaker.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsMaker.h
index 7e2a79184ec..f85d871bd93 100644
--- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsMaker.h
+++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsMaker.h
@@ -27,9 +27,19 @@
 #ifndef TILESIMALGS_TILEDIGITSMAKER_H
 #define TILESIMALGS_TILEDIGITSMAKER_H
 
+// Tile includes
+#include "TileEvent/TileHitContainer.h"
+#include "TileEvent/TileDigitsContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gauid includes
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
+
 #include "CLHEP/Random/RandomEngine.h"
 
 class IAtRndmGenSvc;
@@ -70,9 +80,18 @@ class TileDigitsMaker: public AthAlgorithm {
     StatusCode finalize();   //!< finalize method
 
   private:
-    std::string m_hitContainer;    //!< Name of the TileHitContainer
-    std::string m_digitsContainer; //!< Name of the TileDigitsContainer
-    std::string m_filteredContainer; //!< Name of the TileDigitsContainer with filtered digits
+
+    SG::ReadHandleKey<TileHitContainer> m_hitContainerKey{this,"TileHitContainer","TileHitCnt",
+                                                          "input Tile hit container key"};
+
+    SG::WriteHandleKey<TileDigitsContainer> m_digitsContainerKey{this,"TileDigitsContainer",
+                                                                 "TileDigitsCnt",
+                                                                 "Output Tile digits container key"};
+
+    SG::WriteHandleKey<TileDigitsContainer> m_filteredDigitsContainerKey{this,"TileFilteredContainer",
+                                                                         "TileDigitsFlt",
+                                                                         "Output filtered Tile digits container key"};
+
     std::string m_infoName;        //!< Name of TileInfo object in TES
     double m_filterThreshold;      //!< theshold on hit energy to store digit in filtered container
     double m_filterThresholdMBTS; //!< theshold on MBTS hit energy to store digit in filtered container
diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToCell.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToCell.h
index 34b8fc167c9..45a403e694f 100644
--- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToCell.h
+++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToCell.h
@@ -12,13 +12,23 @@
 #ifndef TILESIMALGS_TILEHITTOCELL_H
 #define TILESIMALGS_TILEHITTOCELL_H
 
+// Tile includes
+#include "TileEvent/TileHitContainer.h"
+
+// Calo includes
+#include "CaloEvent/CaloCellContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+#include <string>
 
 class TileID;
 class TileInfo;
 class TileDetDescrManager;
 
-#include <string>
 
 /**
  @class TileHitToCell
@@ -52,8 +62,15 @@ class TileHitToCell: public AthAlgorithm {
     StatusCode finalize();   //!< finalize method
 
   private:
-    std::string m_hitContainer;  //!< Name of the TileHitContainer
-    std::string m_cellContainer; //!< Name of the TileCellContainer
+
+    SG::ReadHandleKey<TileHitContainer> m_hitContainerKey{this,"TileHitContainer","TileHitContainer",
+                                                          "input Tile hit container key"};
+
+    SG::WriteHandleKey<CaloCellContainer> m_cellContainerKey{this,"TileCellContainer",
+                                                             "TileCellContainer",
+                                                             "Output Tile cell container key"};
+
+
     std::string m_infoName;      //!< Name for TileInfo
 
     const TileID* m_tileID;    //!< Pointer to TileID helper
diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToRawChannel.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToRawChannel.h
index b56da8dc113..609697f9fee 100644
--- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToRawChannel.h
+++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToRawChannel.h
@@ -27,11 +27,27 @@
 #ifndef TILESIMALGS_TILEHITTORAWCHANNEL_H
 #define TILESIMALGS_TILEHITTORAWCHANNEL_H
 
+// Tile includes
+#include "TileEvent/TileHitContainer.h"
+#include "TileEvent/TileRawChannelContainer.h"
+#include "TileIdentifier/TileFragHash.h"
+#include "TileIdentifier/TileRawChannelUnit.h"
+
+// Atlas includes
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
+
 #include "CLHEP/Random/RandomEngine.h"
 
-#include "AthenaBaseComps/AthAlgorithm.h"
+
+#include <string>
+#include <vector>
+
 
 class IAtRndmGenSvc;
 class TileID;
@@ -42,11 +58,6 @@ class HWIdentifier;
 class TileCablingService;
 class TileCondToolEmscale;
 
-#include "TileIdentifier/TileFragHash.h"
-#include "TileIdentifier/TileRawChannelUnit.h"
-
-#include <string>
-#include <vector>
 
 /**
  @class TileHitToRawChannel
@@ -71,8 +82,14 @@ class TileHitToRawChannel: public AthAlgorithm {
     StatusCode finalize();   //!< finalize method   
 
   private:
-    std::string m_hitContainer;         //!< name of TileHitContainer
-    std::string m_rawChannelContainer;  //!< name of TileRawChannelContainer
+
+    SG::ReadHandleKey<TileHitContainer> m_hitContainerKey{this,"TileHitContainer","TileHitCnt",
+                                                          "input Tile hit container key"};
+
+    SG::WriteHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer",
+                                                                         "TileRawChannelCnt",
+                                                                         "Output Tile raw channel container key"};
+
     std::string m_infoName;             //!< name of the TileInfo object
     double m_deltaT;                    //!< if true, keep only hits in deltaT range
     bool m_calibrateEnergy;             //!< if true, amplitude is converted to pCb
diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToTTL1.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToTTL1.h
index e332ab6b151..0791fb1d92a 100644
--- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToTTL1.h
+++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToTTL1.h
@@ -27,11 +27,22 @@
 #ifndef TILESIMALGS_TILEHITTOTTL1_H
 #define TILESIMALGS_TILEHITTOTTL1_H
 
+// Tile includes
+#include "TileEvent/TileHitContainer.h"
+#include "TileEvent/TileTTL1Container.h"
+
+// Atlas includes
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
+
 #include "CLHEP/Random/RandomEngine.h"
 
-#include "AthenaBaseComps/AthAlgorithm.h"
+#include <string>
 
 class IAtRndmGenSvc;
 class TileID;
@@ -43,8 +54,6 @@ class TileCablingService;
 class TileCondToolEmscale;
 class ITileBadChanTool;
 
-#include <string>
-
 /**
  @class TileHitToTTL1
  @brief This algorithm builds TileTTL1 objects from TileHits.
@@ -71,9 +80,18 @@ class TileHitToTTL1: public AthAlgorithm {
     StatusCode finalize();   //!< finalize method   
 
   private:
-    std::string m_hitContainer;      //!< name of TileHitContainer
-    std::string m_TTL1Container;     //!< name of TileTTL1Container
-    std::string m_MBTSTTL1Container; //!< name of TileTTL1Container for MBTS
+
+    SG::ReadHandleKey<TileHitContainer> m_hitContainerKey{this,"TileHitContainer","TileHitCnt",
+                                                          "input Tile hit container key"};
+
+    SG::WriteHandleKey<TileTTL1Container> m_ttl1ContainerKey{this,"TileTTL1Container",
+                                                             "TileTTL1Cnt",
+                                                             "Output Tile TTL1 container key"};
+
+    SG::WriteHandleKey<TileTTL1Container> m_mbtsTTL1ContainerKey{this,"TileMBTSTTL1Container",
+                                                                 "TileTTL1MBTS",
+                                                                 "Output Tile MBTS TTL1 container key"};
+
     std::string m_infoName;          //!< name of TileInfo object in TES
     std::string m_TileTTL1Type;      //!< name of Trigger Type
     bool m_cosmicsType;              //!< if true => use dediated cosmcis TTL1
diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitVecToCntTool.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitVecToCntTool.h
index 78bec3b88f1..a642a013bc9 100644
--- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitVecToCntTool.h
+++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitVecToCntTool.h
@@ -28,15 +28,17 @@
 #ifndef TILESIMALGS_TILEHITVECTOCNTTOOL_H
 #define TILESIMALGS_TILEHITVECTOCNTTOOL_H
 
-// Gaudi includes
-#include "GaudiKernel/ServiceHandle.h"
+// Tile includes
+#include "TileIdentifier/TileFragHash.h"
+#include "TileSimEvent/TileHitVector.h"
+#include "TileEvent/TileHitContainer.h"
 
 // Athena includes
 #include "PileUpTools/PileUpToolBase.h"
+#include "StoreGate/WriteHandleKey.h"
 
-// Tile includes
-#include "TileIdentifier/TileFragHash.h"
-#include "TileSimEvent/TileHitVector.h"
+// Gaudi includes
+#include "GaudiKernel/ServiceHandle.h"
 
 
 // Avoid pushing dependencies into clients- just fwd declare the following:
@@ -98,7 +100,11 @@ class TileHitVecToCntTool: public PileUpToolBase {
     void findAndMergeMBTS(TileHitCollection* coll, int frag_id);
 
     std::vector<std::string> m_hitVectorNames;  //!< vector with the names of TileHitVectors to use
-    std::string m_hitContainer;                 //!< name of the TileHitCointainer
+
+    SG::WriteHandleKey<TileHitContainer> m_hitContainerKey{this,"TileHitContainer","TileHitCnt",
+                                                           "Output Tile hit container key"};
+
+
     std::string m_infoName;                     //!< name of TileInfo object in TES
     bool m_run2;                                //!< if true => RUN2 geometry with E4' and merged E1
     bool m_pileUp;                              //!< if true => pileup mode is activated
diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileMuonReceiverDecision.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileMuonReceiverDecision.h
index fb94d224c81..d3cb4372d08 100644
--- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileMuonReceiverDecision.h
+++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileMuonReceiverDecision.h
@@ -30,7 +30,16 @@
 #ifndef TILESIMALGS_TILEMUONRECEIVERDECISION_H
 #define TILESIMALGS_TILEMUONRECEIVERDECISION_H
 
+// Tile includes
+#include "TileEvent/TileRawChannelContainer.h"
+#include "TileEvent/TileContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
 
@@ -55,8 +64,17 @@ class TileMuonReceiverDecision: public AthAlgorithm {
   StatusCode finalize();   //!< finalize method
 
  private:
-  std::string m_MuRcvRawChContainer;  //!< Name of the algorithm raw channel container 
-  std::string m_TileMuRcvContainer;
+
+  SG::ReadHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer",
+                                                                      "MuRcvRawChCnt",
+                                                                      "Input Tile raw channel container key"};
+
+
+  SG::WriteHandleKey<TileMuonReceiverContainer> m_muonReceiverContainerKey{this,"TileMuonReceiverContainer",
+                                                                           "TileMuRcvCnt",
+                                                                           "Output Tile muon receiver container key"};
+
+
   std::string m_infoName;             //!< Name of tile info object in TES
 
   const TileID*             m_tileID;
@@ -72,6 +90,7 @@ class TileMuonReceiverDecision: public AthAlgorithm {
 
   ToolHandle<TileCondToolEmscale> m_tileToolEmscale;         //!< main Tile Calibration tool
 
+  bool m_run2;
 };
 
 #endif
diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TilePulseForTileMuonReceiver.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TilePulseForTileMuonReceiver.h
index 0fe121eb8fb..bba6100b5e3 100644
--- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TilePulseForTileMuonReceiver.h
+++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TilePulseForTileMuonReceiver.h
@@ -35,9 +35,20 @@
 #ifndef TILESIMALGS_TILEPULSEFORTILEMUONRECEIVER_H
 #define TILESIMALGS_TILEPULSEFORTILEMUONRECEIVER_H
 
+// Tile includes
+#include "TileEvent/TileHitContainer.h"
+#include "TileEvent/TileDigitsContainer.h"
+#include "TileEvent/TileRawChannelContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+// Gaudi includes
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
+
 #include "CLHEP/Random/RandomEngine.h"
 
 class IAtRndmGenSvc;
@@ -78,6 +89,20 @@ class TilePulseForTileMuonReceiver: public AthAlgorithm {
     std::string m_hitContainer;         //!< Name of the tile hit container
     std::string m_MuRcvDigitsContainer; //!< Name of the algorithm digits container
     std::string m_MuRcvRawChContainer;  //!< Name of the algorithm raw channel container
+
+    SG::ReadHandleKey<TileHitContainer> m_hitContainerKey{this,"TileHitContainer","TileHitCnt",
+                                                          "input Tile hit container key"};
+
+
+    SG::WriteHandleKey<TileDigitsContainer> m_muRcvDigitsContainerKey{this,"MuonReceiverDigitsContainer",
+                                                                      "MuRcvDigitsCnt",
+                                                                      "Output Tile muon receiver digits container key"};
+
+    SG::WriteHandleKey<TileRawChannelContainer> m_muRcvRawChannelContainerKey{this,"MuonReceiverRawChannelContainer",
+                                                                              "MuRcvRawChCnt",
+                                                                              "Output Tile muon receiver raw channel container key"};
+
+
     std::string m_infoName;             //!< Name of tile info object in TES
     bool m_integerDigits;               //!< If true => round digits to integer
     bool m_useCoolPulseShapes;          //!< If true => use of pulse shapes from db
@@ -115,6 +140,8 @@ class TilePulseForTileMuonReceiver: public AthAlgorithm {
     ToolHandle<ITileBadChanTool> m_tileBadChanTool;            //!< tool which provides status of every channel
     ToolHandle<TileBeamInfoProvider> m_beamInfo;               //!< tool which provides DQstatus (for overlay)
     ToolHandle<TileRawChannelBuilderMF> m_MuRcvBuildTool;      //!< tool to set up the reconstruction algorithm
+    
+    bool m_run2;
 };
 
 #endif
diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileTBHitToBeamElem.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileTBHitToBeamElem.h
index b086ec5fac6..f164a9601ce 100644
--- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileTBHitToBeamElem.h
+++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileTBHitToBeamElem.h
@@ -27,7 +27,14 @@
 #ifndef TILESIMALGS_TILETBHITTOBEAMELEM_H
 #define TILESIMALGS_TILETBHITTOBEAMELEM_H
 
+// Tile includes
+#include "TileSimEvent/TileHitVector.h"
+#include "TileEvent/TileBeamElemContainer.h"
+
+// Atlas includes
 #include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
 
 class TileTBID;
 class TileHWID;
@@ -54,8 +61,15 @@ class TileTBHitToBeamElem: public AthAlgorithm {
     StatusCode finalize();    //!< finalize method  
 
   private:
-    std::string m_hitVector;            //!< name of TileHitVector
-    std::string m_beamElemContainer;    //!< name of TileBeamElemContainer
+
+    SG::ReadHandleKey<TileHitVector> m_hitVectorKey{this,"TileTBHitVector","TileTBHits",
+                                                   "input Tile hit vector key"};
+
+    SG::WriteHandleKey<TileBeamElemContainer> m_beamElemContainerKey{this,"TileBeamElemContainer",
+                                                                     "TileBeamElemCnt",
+                                                                     "Output Tile beam elements container key"};
+
+
     std::string m_infoName;             //!< name of the TileInfo object in TES
 
     const TileTBID* m_tileTBID; //!< Pointer to TileID helper
diff --git a/TileCalorimeter/TileSimAlgs/src/TileDigitsMaker.cxx b/TileCalorimeter/TileSimAlgs/src/TileDigitsMaker.cxx
index 49e0bcbf2a1..66b67121102 100644
--- a/TileCalorimeter/TileSimAlgs/src/TileDigitsMaker.cxx
+++ b/TileCalorimeter/TileSimAlgs/src/TileDigitsMaker.cxx
@@ -17,17 +17,8 @@
 //
 //*****************************************************************************
 
-// Gaudi includes
-#include "GaudiKernel/ISvcLocator.h"
-
-// Atlas include
-#include "AthenaKernel/errorcheck.h"
-
-// Calo includes
-#include "CaloIdentifier/TileID.h"
-#include "CaloIdentifier/TileTBID.h"
-
 // Tile includes
+#include "TileSimAlgs/TileDigitsMaker.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileConditions/TileInfo.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
@@ -37,23 +28,30 @@
 #include "TileConditions/TilePulseShapes.h"
 #include "TileConditions/TileCondToolPulseShape.h"
 #include "TileConditions/ITileBadChanTool.h"
-#include "TileEvent/TileHitContainer.h"
-#include "TileEvent/TileDigitsContainer.h"
 #include "TileEvent/TileRawChannelContainer.h"
 #include "TileRecUtils/TileBeamInfoProvider.h"
-#include "TileSimAlgs/TileDigitsMaker.h"
 
-//CLHEP includes
-#include <CLHEP/Random/Randomize.h>
-#include <CLHEP/Units/SystemOfUnits.h>
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+#include "CaloIdentifier/TileTBID.h"
 
+// Atlas include
+#include "AthenaKernel/errorcheck.h"
 // For the Athena-based random numbers.
 #include "AthenaKernel/IAtRndmGenSvc.h"
 #include "AthenaKernel/Units.h"
-
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
 // Pile up
 #include "PileUpTools/PileUpMergeSvc.h"
 
+// Gaudi includes
+
+//CLHEP includes
+#include <CLHEP/Random/Randomize.h>
+#include <CLHEP/Units/SystemOfUnits.h>
+
+
 #include "TMatrixF.h"
 #include "TDecompChol.h"
 #include "cmath"
@@ -101,9 +99,6 @@ TileDigitsMaker::TileDigitsMaker(std::string name, ISvcLocator* pSvcLocator)
     m_tileBadChanTool("TileBadChanTool"),
     m_beamInfo("TileBeamInfoProvider/TileBeamInfoProvider")
 {
-  declareProperty("TileHitContainer",      m_hitContainer = "TileHitCnt");
-  declareProperty("TileDigitsContainer",   m_digitsContainer = "TileDigitsCnt");
-  declareProperty("TileFilteredContainer", m_filteredContainer = "TileDigitsFlt");
   declareProperty("FilterThreshold",       m_filterThreshold = 100.0 * MeV, "Threshold on filtered digits (default - 100 MeV)");
   declareProperty("FilterThresholdMBTS",   m_filterThresholdMBTS = 0.0 * MeV, "Threshold on filtered digits of MBTS (default - 0 MeV)");
   declareProperty("TileInfoName",   m_infoName = "TileInfo");
@@ -236,13 +231,18 @@ StatusCode TileDigitsMaker::initialize() {
     }
   }
 
-  if (m_calibRun)
-    m_filteredContainer = "";
-  if (m_filteredContainer.size() > 0) {
+  if (m_calibRun) {
+    m_filteredDigitsContainerKey = "";
+  }
+
+  if (!m_filteredDigitsContainerKey.key().empty()) {
     ATH_MSG_INFO( "Keep digits with hit energy above " << m_filterThreshold / MeV
-                 << " MeV in " << m_filteredContainer << " container");
+                  << " MeV in " << m_filteredDigitsContainerKey.key() << " container");
     ATH_MSG_INFO( "Keep digits from MBTS with original G4 hit energy above "
                  << m_filterThresholdMBTS / MeV << " MeV ");
+
+    ATH_CHECK( m_filteredDigitsContainerKey.initialize() );
+
   } else {
     m_filterThreshold = HUGE_VALL;
     m_filterThresholdMBTS = HUGE_VALL;
@@ -325,6 +325,11 @@ StatusCode TileDigitsMaker::initialize() {
   }
 
   /* ==================================*/
+
+
+  ATH_CHECK( m_hitContainerKey.initialize() );
+  ATH_CHECK( m_digitsContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileDigitsMaker initialization completed");
 
   return StatusCode::SUCCESS;
@@ -376,8 +381,8 @@ StatusCode TileDigitsMaker::execute() {
   double RndmLo_dG[1];  // uniform random number for the double gaussian
 
   // step1: Get hit container from TES 
-  const TileHitContainer* hitCont;
-  CHECK( evtStore()->retrieve(hitCont, m_hitContainer) );
+  SG::ReadHandle<TileHitContainer> hitContainer(m_hitContainerKey);
+  ATH_CHECK( hitContainer.isValid() );
 
   // Zero sums for monitoring.
   int nChSum = 0;
@@ -398,12 +403,14 @@ StatusCode TileDigitsMaker::execute() {
   double RChSum = 0.;
 
   /* step2: Set up  Digits container */
-  TileDigitsContainer* pDigitsContainer;
-  pDigitsContainer = new TileDigitsContainer(true);
 
-  TileDigitsContainer* pFilteredContainer = 0;
-  if (m_filteredContainer.size() > 0)
-    pFilteredContainer = new TileDigitsContainer(true, SG::VIEW_ELEMENTS);
+  SG::WriteHandle<TileDigitsContainer> digitsContainer(m_digitsContainerKey);
+  ATH_CHECK( digitsContainer.record(std::make_unique<TileDigitsContainer>(true)) );
+
+  std::unique_ptr<TileDigitsContainer> filteredContainer;
+  if (!m_filteredDigitsContainerKey.key().empty()) {
+    filteredContainer = std::make_unique<TileDigitsContainer>(true, SG::VIEW_ELEMENTS);
+  }
 
   /* Set up buffers for handling information in a single collection. */
   IdentifierHash idhash;
@@ -482,8 +489,8 @@ StatusCode TileDigitsMaker::execute() {
   }
 
   // iterate over all collections in a container
-  TileHitContainer::const_iterator collItr = hitCont->begin();
-  TileHitContainer::const_iterator lastColl = hitCont->end();
+  TileHitContainer::const_iterator collItr = hitContainer->begin();
+  TileHitContainer::const_iterator lastColl = hitContainer->end();
 
   /* ----------------------------------------------------------------- */
   /* Begin loop over the Hit collections.  All collections are defined */
@@ -1108,7 +1115,7 @@ StatusCode TileDigitsMaker::execute() {
           ATH_MSG_DEBUG( "Masking Channel " << ros << '/' << drawer << '/' << ich << "/1 HG" );
         }
         TileDigits* pDigits = new TileDigits(adc_id, digitsBuffer);
-        pDigitsContainer->push_back(pDigits);
+        digitsContainer->push_back(pDigits);
 
         if (chanLoIsBad) {
           for (int js = 0; js < m_nSamples; ++js) {
@@ -1117,7 +1124,7 @@ StatusCode TileDigitsMaker::execute() {
           ATH_MSG_DEBUG( "Masking Channel " << ros << '/' << drawer << '/' << ich << "/0 LG");
         }
         TileDigits* pDigitsLo = new TileDigits(adc_id_lo, digitsBufferLo);
-        pDigitsContainer->push_back(pDigitsLo);
+        digitsContainer->push_back(pDigitsLo);
 
       } else { //normal run
 
@@ -1190,10 +1197,10 @@ StatusCode TileDigitsMaker::execute() {
           }
 
           TileDigits* pDigits = new TileDigits(adc_id, digitsBuffer);
-          pDigitsContainer->push_back(pDigits);
+          digitsContainer->push_back(pDigits);
 
           if (ech_int[ich] > m_filterThreshold || ech_int[ich] < -m_filterThresholdMBTS) {
-            pFilteredContainer->push_back(pDigits);
+            if (filteredContainer) filteredContainer->push_back(pDigits);
             if (hiGain) {
               ++nChHiFlt;
             } else {
@@ -1274,11 +1281,9 @@ StatusCode TileDigitsMaker::execute() {
     }
   }
 
-  // step3: register the Digit container in the TES
-  CHECK( evtStore()->record(pDigitsContainer, m_digitsContainer, false) );
-
-  if (m_filteredContainer.size() > 0) {
-    CHECK( evtStore()->record(pFilteredContainer, m_filteredContainer, false) );
+  if (filteredContainer) {
+    SG::WriteHandle<TileDigitsContainer> filteredDigitsContainer(m_filteredDigitsContainerKey);
+    ATH_CHECK( filteredDigitsContainer.record(std::move(filteredContainer)) );
   }
 
   return StatusCode::SUCCESS;
diff --git a/TileCalorimeter/TileSimAlgs/src/TileHitToCell.cxx b/TileCalorimeter/TileSimAlgs/src/TileHitToCell.cxx
index 847252a74ba..14efc07269f 100644
--- a/TileCalorimeter/TileSimAlgs/src/TileHitToCell.cxx
+++ b/TileCalorimeter/TileSimAlgs/src/TileHitToCell.cxx
@@ -16,20 +16,22 @@
 //
 //*****************************************************************************
 
-// access all Hits inside container
-#include "EventContainers/SelectAllObject.h"
+// Tile includes
+#include "TileSimAlgs/TileHitToCell.h"
+#include "TileDetDescr/TileDetDescrManager.h"
+#include "TileConditions/TileInfo.h"
+#include "TileEvent/TileCell.h"
 
 // Calo includes
 #include "CaloIdentifier/TileID.h"
-#include "CaloEvent/CaloCellContainer.h"
 #include "CaloDetDescr/CaloDetDescrElement.h"
 
-// Tile includes
-#include "TileDetDescr/TileDetDescrManager.h"
-#include "TileConditions/TileInfo.h"
-#include "TileEvent/TileHitContainer.h"
-#include "TileEvent/TileCell.h"
-#include "TileSimAlgs/TileHitToCell.h"
+// Atlas includes
+// access all Hits inside container
+#include "EventContainers/SelectAllObject.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+
 
 //
 // Constructor
@@ -40,12 +42,7 @@ TileHitToCell::TileHitToCell(std::string name, ISvcLocator* pSvcLocator)
   , m_tileInfo(0)
   , m_tileMgr(0)
 {
-  m_hitContainer = "TileHitContainer";
-  m_cellContainer = "TileCellContainer";
   m_infoName = "TileInfo";
-
-  declareProperty("TileHitContainer", m_hitContainer);    
-  declareProperty("TileCellContainer", m_cellContainer);
   declareProperty("TileInfoName", m_infoName);
 }
 
@@ -65,6 +62,9 @@ StatusCode TileHitToCell::initialize() {
 
   CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
 
+  ATH_CHECK( m_hitContainerKey.initialize() );
+  ATH_CHECK( m_cellContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileHitToCell initialisation completed" );
 
   return StatusCode::SUCCESS;
@@ -78,8 +78,8 @@ StatusCode TileHitToCell::execute() {
   ATH_MSG_DEBUG( "Executing TileHitToCell" );
 
   // step1: read hits from TES
-  const TileHitContainer* hitCont;
-  CHECK( evtStore()->retrieve(hitCont, m_hitContainer) );
+  SG::ReadHandle<TileHitContainer> hitContainer(m_hitContainerKey);
+  ATH_CHECK( hitContainer.isValid() );
 
   //Zero sums for monitoring.
   int nTwo = 0;
@@ -95,7 +95,7 @@ StatusCode TileHitToCell::execute() {
   enePmt1.resize(nCellMax);
   enePmt2.resize(nCellMax);
 
-  SelectAllObject<TileHitContainer> selAll(hitCont);
+  SelectAllObject<TileHitContainer> selAll(hitContainer.cptr());
   SelectAllObject<TileHitContainer>::const_iterator hitItr = selAll.begin();
   SelectAllObject<TileHitContainer>::const_iterator lastHit = selAll.end();
 
@@ -141,22 +141,19 @@ StatusCode TileHitToCell::execute() {
   }
 
   // step3: form cells, and put them in container
-  CaloCellContainer* pCellContainer = new CaloCellContainer;
+
+  SG::WriteHandle<CaloCellContainer> cellContainer(m_cellContainerKey);
+  ATH_CHECK( cellContainer.record(std::make_unique<CaloCellContainer>()) );
+  ATH_MSG_VERBOSE( "TileCell container registered to the TES with name" << m_cellContainerKey.key() );
+
   for (unsigned int i = 0; i < nCellMax; ++i) {
     const CaloDetDescrElement* caloDDE = m_tileMgr->get_cell_element(i);
     TileCell* pCell = new TileCell(caloDDE, enePmt1[i], enePmt2[i], 0.0, 0.0, 0, 0
                                    , TileCell::MASK_AMPL, TileCell::MASK_AMPL
                                    , CaloGain::INVALIDGAIN, CaloGain::INVALIDGAIN); // gain is not known
-    pCellContainer->push_back(pCell);
+    cellContainer->push_back(pCell);
   }
 
-  // step4: calibration
-  // empty for later
-
-  // step5: register the cell container in the TES
-  CHECK( evtStore()->record(pCellContainer, m_cellContainer, false) );
-
-
   // Execution completed.
   if (msgLvl(MSG::DEBUG))  {
     msg(MSG::DEBUG) << "TileHitToCell execution completed." << endmsg;
@@ -167,7 +164,7 @@ StatusCode TileHitToCell::execute() {
                     << " eneTot=" << eCellTot << endmsg;
   }
 
-  ATH_MSG_VERBOSE( "TileCell container registered to the TES with name" << m_cellContainer );
+
 
   return StatusCode::SUCCESS;
 }
diff --git a/TileCalorimeter/TileSimAlgs/src/TileHitToRawChannel.cxx b/TileCalorimeter/TileSimAlgs/src/TileHitToRawChannel.cxx
index 83081f92161..1e5cdca1fe7 100644
--- a/TileCalorimeter/TileSimAlgs/src/TileHitToRawChannel.cxx
+++ b/TileCalorimeter/TileSimAlgs/src/TileHitToRawChannel.cxx
@@ -16,32 +16,29 @@
 //
 //*****************************************************************************
 
-// Gaudi Includes
-#include "GaudiKernel/ISvcLocator.h"
-
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
-
-// Calo includes
-#include "CaloIdentifier/TileID.h"
-#include "CaloIdentifier/TileTBID.h"
-
 // Tile includes
+#include "TileSimAlgs/TileHitToRawChannel.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileConditions/TileInfo.h"
 #include "TileConditions/TileCablingService.h"
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileEvent/TileHitContainer.h"
-#include "TileEvent/TileRawChannelContainer.h"
-#include "TileSimAlgs/TileHitToRawChannel.h"
 
-//CLHEP includes
-#include <CLHEP/Random/Randomize.h>
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+#include "CaloIdentifier/TileTBID.h"
 
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
 // For the Athena-based random numbers.
 #include "AthenaKernel/IAtRndmGenSvc.h"
 
+//CLHEP includes
+#include <CLHEP/Random/Randomize.h>
+
 
 using CLHEP::RandGaussQ;
 
@@ -69,8 +66,6 @@ TileHitToRawChannel::TileHitToRawChannel(std::string name, ISvcLocator* pSvcLoca
   m_rChUnit = TileRawChannelUnit::ADCcounts;
   m_rChType = TileFragHash::Default;
 
-  declareProperty("TileHitContainer", m_hitContainer = "TileHitCnt");    
-  declareProperty("TileRawChannelContainer", m_rawChannelContainer  = "TileRawChannelCnt");
   declareProperty("TileInfoName", m_infoName  = "TileInfo");
   declareProperty("DeltaT",m_deltaT = -1.0); // keep hits only within deltaT;
   declareProperty("calibrateEnergy",m_calibrateEnergy = false); // convert or not to pCb
@@ -159,6 +154,9 @@ StatusCode TileHitToRawChannel::initialize() {
     m_all_ids.push_back(adc_ids);
   }
 
+  ATH_CHECK( m_hitContainerKey.initialize() );
+  ATH_CHECK( m_rawChannelContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileHitToRawChannel initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -172,8 +170,8 @@ StatusCode TileHitToRawChannel::execute() {
   ATH_MSG_DEBUG( "Executing TileHitToRawChannel" );
 
   // step1: read hits from TES
-  const TileHitContainer* hitCont;
-  CHECK( evtStore()->retrieve(hitCont, m_hitContainer) );
+  SG::ReadHandle<TileHitContainer> hitContainer(m_hitContainerKey);
+  ATH_CHECK( hitContainer.isValid() );
 
   //Zero sums for monitoring.
   int nChan = 0;
@@ -197,17 +195,13 @@ StatusCode TileHitToRawChannel::execute() {
   IdContext drawer_context = m_tileHWID->drawer_context();
 
   // step2: form raw channels, and put them in container
-  TileRawChannel * pRawChannel;
-  TileRawChannelContainer * pRawChannelContainer;
-  pRawChannelContainer = new TileRawChannelContainer(true, m_rChType, m_rChUnit);
+  SG::WriteHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
+  ATH_CHECK( rawChannelContainer.record(std::make_unique<TileRawChannelContainer>(true, m_rChType, m_rChUnit)));
 
   // iterate over all collections in a container
-  TileHitContainer::const_iterator collItr = hitCont->begin();
-  TileHitContainer::const_iterator lastColl = hitCont->end();
+  for (const TileHitCollection* hitCollection : *hitContainer) {
 
-  for (; collItr != lastColl; ++collItr) {
-
-    HWIdentifier drawer_id = m_tileHWID->drawer_id((*collItr)->identify());
+    HWIdentifier drawer_id = m_tileHWID->drawer_id(hitCollection->identify());
     int ros = m_tileHWID->ros(drawer_id);
     int drawer = m_tileHWID->drawer(drawer_id);
     int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
@@ -221,7 +215,7 @@ StatusCode TileHitToRawChannel::execute() {
     int ch;
 
     ATH_MSG_VERBOSE( MSG::hex
-                    << "Collection = 0x" << (*collItr)->identify() << MSG::dec
+                    << "Collection = 0x" << hitCollection->identify() << MSG::dec
                     << " : ROS=" << ros
                     << ", drawer=" << drawer );
 
@@ -247,31 +241,27 @@ StatusCode TileHitToRawChannel::execute() {
     memset(adc_qual, 0, sizeof(adc_qual));
 
     // iterate over all hits in a collection
-    TileHitCollection::const_iterator hitItr = (*collItr)->begin();
-    TileHitCollection::const_iterator lastHit = (*collItr)->end();
-
-    for (; hitItr != lastHit; ++hitItr) {
+    for (const TileHit* tile_hit : *hitCollection) {
 
       // Get hit Identifier (= identifier of pmt)
-      const TileHit * phit = (*hitItr);
-      Identifier pmt_id = phit->pmt_ID();
-      HWIdentifier channel_id = phit->pmt_HWID();
+      Identifier pmt_id = tile_hit->pmt_ID();
+      HWIdentifier channel_id = tile_hit->pmt_HWID();
 
       // index for array is the channel number
       ch = m_tileHWID->channel(channel_id);
 
       /* Get hit amplitude and convert to energy (cell-dependent) */
-      double e_hit = phit->energy();
-      double time = phit->time();
+      double e_hit = tile_hit->energy();
+      double time = tile_hit->time();
       if (m_deltaT > 0.0) {
         if (fabs(time) >= m_deltaT) { // reset first hit if it's outside deltaT window
           e_hit = 0.0;
           time = 0.0;
         }
         double etime = e_hit * time;
-        for (int i = phit->size() - 1; i > 0; --i) { // don't use first hit (i=0)
-          double en = phit->energy(i);
-          double ti = phit->time(i);
+        for (int i = tile_hit->size() - 1; i > 0; --i) { // don't use first hit (i=0)
+          double en = tile_hit->energy(i);
+          double ti = tile_hit->time(i);
           if (fabs(ti) < m_deltaT && en > 0.0) {
             e_hit += en;
             etime += en * ti;
@@ -358,8 +348,8 @@ StatusCode TileHitToRawChannel::execute() {
 
         if (lrcGood) {
 
-          pRawChannel = new TileRawChannel(adc_id, amp, adc_time[ch], adc_qual[ch]);
-          pRawChannelContainer->push_back(pRawChannel);
+          std::unique_ptr<TileRawChannel> rawChannel = std::make_unique<TileRawChannel>(adc_id, amp, adc_time[ch], adc_qual[ch]);
+          rawChannelContainer->push_back(rawChannel.release());
 
           if (TileID::HIGHGAIN == gain) {
             ++nChHG;
@@ -383,8 +373,6 @@ StatusCode TileHitToRawChannel::execute() {
     }
   }
 
-  // step3: register the cell container in the TES
-  CHECK( evtStore()->record(pRawChannelContainer, m_rawChannelContainer, false) );
 
   // Execution completed.
   if (msgLvl(MSG::DEBUG)) {
diff --git a/TileCalorimeter/TileSimAlgs/src/TileHitToTTL1.cxx b/TileCalorimeter/TileSimAlgs/src/TileHitToTTL1.cxx
index 39d38b19648..381133e24d2 100644
--- a/TileCalorimeter/TileSimAlgs/src/TileHitToTTL1.cxx
+++ b/TileCalorimeter/TileSimAlgs/src/TileHitToTTL1.cxx
@@ -22,30 +22,30 @@
 //
 //*****************************************************************************
 
-// Gaudi includes
-#include "GaudiKernel/ISvcLocator.h"
-
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
-// For the Athena-based random numbers.
-#include "AthenaKernel/IAtRndmGenSvc.h"
-
-// Calo includes
-#include "CaloIdentifier/TileID.h"
-#include "CaloIdentifier/TileTBID.h"
-#include "CaloIdentifier/CaloLVL1_ID.h"
-
 // Tile includes
+#include "TileSimAlgs/TileHitToTTL1.h"
+#include "TileEvent/TileLogicalOrdering.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileConditions/TileInfo.h"
-#include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileConditions/TileCablingService.h"
 #include "TileConditions/TileCondToolEmscale.h"
-#include "TileEvent/TileHitContainer.h"
-#include "TileEvent/TileTTL1Container.h"
-#include "TileEvent/TileLogicalOrdering.h"
-#include "TileSimAlgs/TileHitToTTL1.h"
 #include "TileConditions/ITileBadChanTool.h"
+#include "TileCalibBlobObjs/TileCalibUtils.h"
+
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+#include "CaloIdentifier/TileTBID.h"
+#include "CaloIdentifier/CaloLVL1_ID.h"
+
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
+// For the Athena-based random numbers.
+#include "AthenaKernel/IAtRndmGenSvc.h"
+
+// Gaudi includes
+#include "GaudiKernel/ISvcLocator.h"
 
 //CLHEP includes
 #include <CLHEP/Random/Randomize.h>
@@ -82,15 +82,9 @@ TileHitToTTL1::TileHitToTTL1(std::string name, ISvcLocator* pSvcLocator)
   , m_tileBadChanTool("TileBadChanTool")
 {
   m_infoName = "TileInfo";
-  m_hitContainer = "TileHitCnt";
-  m_TTL1Container = "TileTTL1Cnt";
-  m_MBTSTTL1Container = "TileTTL1MBTS";
   m_TileTTL1Type = "Standard";
 
   declareProperty("TileInfoName", m_infoName);
-  declareProperty("TileHitContainer", m_hitContainer);    
-  declareProperty("TileTTL1Container", m_TTL1Container);
-  declareProperty("TileMBTSTTL1Container", m_MBTSTTL1Container);
   declareProperty("TileTTL1Type",m_TileTTL1Type);
   declareProperty("RndmSvc", m_rndmSvc, "Random Number Service used in TileHitToTTL1");
   declareProperty("TileCondToolEmscale"    , m_tileToolEmscale);
@@ -148,15 +142,18 @@ StatusCode TileHitToTTL1::initialize() {
     return StatusCode::FAILURE;
   }
 
-  if (m_MBTSTTL1Container.size() > 0)
-    ATH_MSG_INFO( "Storing MBTS TileTTL1 in separate container " << m_MBTSTTL1Container );
-  else
-    ATH_MSG_INFO( "TileTTL1 from MBTS will not be produced" );
+  if (m_mbtsTTL1ContainerKey.key().empty()) {
+    ATH_MSG_INFO( "TileTTL1 from MBTS will not be produced" ); 
+  } else {
+    ATH_MSG_INFO( "Storing MBTS TileTTL1 in separate container " << m_mbtsTTL1ContainerKey.key() );
+    ATH_CHECK( m_mbtsTTL1ContainerKey.initialize() );
+  }
 
-  if (m_maskBadChannels)
+  if (m_maskBadChannels) {
     ATH_MSG_INFO( "Bad Channel trigger status will be applied" );
-  else
+  } else {
     ATH_MSG_INFO(  "Bad Channel trigger status will be ignored" );
+  }
 
   /*............................................................................*/
   // Get all global parameters that will be needed for processing
@@ -205,6 +202,9 @@ StatusCode TileHitToTTL1::initialize() {
                     << ", tileThresh=" << ((m_tileThresh) ? "true" : "false") << endmsg;
   }
 
+  ATH_CHECK( m_hitContainerKey.initialize() );
+  ATH_CHECK( m_ttl1ContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileHitToTTL1 initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -226,15 +226,18 @@ StatusCode TileHitToTTL1::execute() {
   // but TTL1 container has no collections and no structure
   /*........................................................................*/
 
-  const TileHitContainer* hitCont;
-  CHECK( evtStore()->retrieve(hitCont, m_hitContainer) );
+  SG::ReadHandle<TileHitContainer> hitContainer(m_hitContainerKey);
+  ATH_CHECK( hitContainer.isValid() );
 
+  SG::WriteHandle<TileTTL1Container> ttl1Container(m_ttl1ContainerKey);
+  // Register the TTL1 container in the TES
+  ATH_CHECK( ttl1Container.record(std::make_unique<TileTTL1Container>()) );
+  ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_ttl1ContainerKey.key() << ")" );
 
-  TileTTL1Container * pTTL1Container = new TileTTL1Container();
-  TileTTL1 * pTTL1;
-  TileTTL1Container * mbtsTTL1Container = NULL;
-  if (m_MBTSTTL1Container.size() > 0)
-    mbtsTTL1Container = new TileTTL1Container();
+  std::unique_ptr<TileTTL1Container>  mbtsTTL1Container;
+  if (!m_mbtsTTL1ContainerKey.key().empty()) {
+    mbtsTTL1Container = std::make_unique<TileTTL1Container>();
+  }
 
   /*........................................................................*/
   // Create temporary arrays for processing signals.
@@ -273,13 +276,11 @@ StatusCode TileHitToTTL1::execute() {
   /*........................................................................*/
   // Begin loop over all collections (collection = electronic drawer). 
   /*........................................................................*/
-  TileHitContainer::const_iterator collItr = hitCont->begin();
-  TileHitContainer::const_iterator lastColl = hitCont->end();
 
-  for (; collItr != lastColl; ++collItr) {
+  for (const TileHitCollection* hitCollection : *hitContainer) {
 
     // get drawer and ros number
-    HWIdentifier drawer_id = m_tileHWID->drawer_id((*collItr)->identify());
+    HWIdentifier drawer_id = m_tileHWID->drawer_id(hitCollection->identify());
     int ros = m_tileHWID->ros(drawer_id);
     int drawer = m_tileHWID->drawer(drawer_id);
     int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
@@ -336,15 +337,12 @@ StatusCode TileHitToTTL1::execute() {
     /*........................................................................*/
     // Iterate over all hits in this collection, summing amps for each tower.
     /*........................................................................*/
-    TileHitCollection::const_iterator hitItr = (*collItr)->begin();
-    TileHitCollection::const_iterator lastHit = (*collItr)->end();
-
-    for (; hitItr != lastHit; ++hitItr) {
+    for (const TileHit* tile_hit : *hitCollection) {
 
       // Get hit Identifier (= pmt_id)
-      Identifier pmt_id = (*hitItr)->pmt_ID();
+      Identifier pmt_id = tile_hit->pmt_ID();
       // Get hit HWIdentifier (= channel_id)
-      HWIdentifier pmt_HWid = (*hitItr)->pmt_HWID();
+      HWIdentifier pmt_HWid = tile_hit->pmt_HWID();
       // Get channel and ADC number
       int channel = m_tileHWID->channel(pmt_HWid);
 
@@ -386,14 +384,14 @@ StatusCode TileHitToTTL1::execute() {
           for (int js = 0; js < m_MBTSnSamples; ++js)
             hitSamples[js] = 0.0;
 
-          int n_hits = (*hitItr)->size();
+          int n_hits = tile_hit->size();
           for (int ihit = 0; ihit < n_hits; ++ihit) {
             // Need to pass the negative of t_hit, this is because ttl1Shape returns the amplitude at 
             // a given phase, whereas the t_hit from t=0 when the hit took place
-            double t_hit = -((*hitItr)->time(ihit));
+            double t_hit = -(tile_hit->time(ihit));
             m_tileInfo->ttl1Shape(m_MBTSnSamples, m_MBTSiTrig, t_hit, m_TTL1Shape);
 
-            double e_hit = (*hitItr)->energy(ihit);
+            double e_hit = tile_hit->energy(ihit);
             for (int js = 0; js < m_MBTSnSamples; ++js) {
               hitSamples[js] += e_hit * m_TTL1Shape[js];
             } // end of loop over MBTS samples
@@ -432,7 +430,7 @@ StatusCode TileHitToTTL1::execute() {
       } // end of MBTS loop
 
       // Get TT Identifier for this pmt 
-      Identifier tt_id = (*hitItr)->tt_ID();
+      Identifier tt_id = tile_hit->tt_ID();
 
       // Get eta-phi indices of TTL1 for this channel.
       int ieta = m_TT_ID->eta(tt_id);
@@ -444,14 +442,14 @@ StatusCode TileHitToTTL1::execute() {
       // convolute with shaping function and add to digitSamples.
       for (int js = 0; js < m_nSamples; ++js)
         hitSamples[js] = 0.0;
-      int n_hits = (*hitItr)->size();
+      int n_hits = tile_hit->size();
       for (int ihit = 0; ihit < n_hits; ++ihit) {
         // Need to pass the negative of t_hit, this is because ttl1Shape returns the amplitude at 
         // a given phase, whereas the t_hit from t=0 when the hit took place
-        double t_hit = -((*hitItr)->time(ihit));
+        double t_hit = -(tile_hit->time(ihit));
         m_tileInfo->ttl1Shape(m_nSamples, m_iTrig, t_hit, m_TTL1Shape);
 
-        double e_hit = (*hitItr)->energy(ihit);
+        double e_hit = tile_hit->energy(ihit);
         for (int js = 0; js < m_nSamples; ++js) {
           hitSamples[js] += e_hit * m_TTL1Shape[js];
         } // end of loop over samples
@@ -567,8 +565,8 @@ StatusCode TileHitToTTL1::execute() {
               Good = false;
 
           if (Good) {
-            TileTTL1 * mbtsTTL1 = new TileTTL1(MBTS_id, MBTSsamples);
-            mbtsTTL1Container->push_back(mbtsTTL1);
+            std::unique_ptr<TileTTL1> mbtsTTL1 = std::make_unique<TileTTL1>(MBTS_id, MBTSsamples);
+            mbtsTTL1Container->push_back(mbtsTTL1.release());
             ATH_MSG_DEBUG( "mbtsTTL1 saved. Is MBTS hit " << MBTSHit
                           << " Is noise " << m_tileNoise );
           }
@@ -663,27 +661,24 @@ StatusCode TileHitToTTL1::execute() {
 
       /* Create the new TTL1 object and store in TTL1Container. */
       if (Good) {
-        pTTL1 = new TileTTL1(ttId[ieta], ttL1samples);
-        pTTL1Container->push_back(pTTL1);
+        std::unique_ptr<TileTTL1> ttl1 = std::make_unique<TileTTL1>(ttId[ieta], ttL1samples);
+        ttl1Container->push_back(ttl1.release());
       }  // end second "Good" section.
     } // end loop over towers
   } // end loop over collections
 
   // sort all trigger towers according to identifier
   if (m_cosmicsType) {
-    ATH_MSG_DEBUG( "Sorting container of size " << pTTL1Container->size() );
+    ATH_MSG_DEBUG( "Sorting container of size " << ttl1Container->size() );
     TileLogicalOrdering<TileTTL1> order;
-    pTTL1Container->sort(order);
+    ttl1Container->sort(order);
   }
 
-  // step8: register the TTL1 container in the TES
-  CHECK( evtStore()->record(pTTL1Container, m_TTL1Container, false) );
-  ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_TTL1Container << ")" );
-
-
   if (mbtsTTL1Container) {
-    CHECK( evtStore()->record(mbtsTTL1Container, m_MBTSTTL1Container, false) );
-    ATH_MSG_DEBUG( "MBTS TileTTL1Container registered successfully (" << m_MBTSTTL1Container << ")" );
+    SG::WriteHandle<TileTTL1Container> mbtsContainer(m_mbtsTTL1ContainerKey);
+    ATH_CHECK( mbtsContainer.record(std::move(mbtsTTL1Container)));
+
+    ATH_MSG_DEBUG( "MBTS TileTTL1Container registered successfully (" << m_mbtsTTL1ContainerKey.key() << ")" );
   }
 
   // Execution completed.
diff --git a/TileCalorimeter/TileSimAlgs/src/TileHitVecToCntTool.cxx b/TileCalorimeter/TileSimAlgs/src/TileHitVecToCntTool.cxx
index 6808aee1ebb..11c14460767 100644
--- a/TileCalorimeter/TileSimAlgs/src/TileHitVecToCntTool.cxx
+++ b/TileCalorimeter/TileSimAlgs/src/TileHitVecToCntTool.cxx
@@ -8,42 +8,39 @@
 // Created  : Dec. 2009
 //************************************************************
 
-#include <algorithm>
+// Tile includes
+#include "TileSimAlgs/TileHitVecToCntTool.h"
+#include "TileIdentifier/TileHWID.h"
+#include "TileDetDescr/TileDetDescrManager.h"
+#include "TileEvent/TileHitNonConstContainer.h"
+#include "TileConditions/TileInfo.h"
+#include "TileConditions/TileCablingService.h"
+#include "TileConditions/TileCablingSvc.h"
 
-// Gaudi includes
-#include "GaudiKernel/SystemOfUnits.h"
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+#include "CaloIdentifier/TileTBID.h"
 
 // Athena includes
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
+#include "StoreGate/WriteHandle.h"
 
 // Pile up
 #include "PileUpTools/PileUpMergeSvc.h"
-
 // Trigger time
 #include "AthenaKernel/ITriggerTime.h"
 #include "AthenaKernel/errorcheck.h"
-
 // For the Athena-based random numbers.
 #include "AthenaKernel/IAtRndmGenSvc.h"
 
-// Calo includes
-#include "CaloIdentifier/TileID.h"
-#include "CaloIdentifier/TileTBID.h"
-
-// Tile includes
-#include "TileSimAlgs/TileHitVecToCntTool.h"
-#include "TileIdentifier/TileHWID.h"
-#include "TileDetDescr/TileDetDescrManager.h"
-#include "TileConditions/TileInfo.h"
-#include "TileEvent/TileHitContainer.h"
-#include "TileEvent/TileHitNonConstContainer.h"
-#include "TileConditions/TileCablingService.h"
-#include "TileConditions/TileCablingSvc.h"
+// Gaudi includes
+#include "GaudiKernel/SystemOfUnits.h"
 
 
 #include "CLHEP/Random/Randomize.h"
 #include "CLHEP/Random/RandomEngine.h"
 
+#include <algorithm>
 
 using CLHEP::RandFlat;
 using CLHEP::RandGaussQ; // FIXME CLHEP::RandGaussZiggurat is faster and more accurate.
@@ -54,7 +51,6 @@ TileHitVecToCntTool::TileHitVecToCntTool(const std::string& type,
                                          const std::string& name,
                                          const IInterface* parent)
     : PileUpToolBase(type,name,parent)
-    , m_hitContainer("TileHitCnt")
     , m_infoName("TileInfo")
     , m_run2(false)
     , m_pileUp(false)
@@ -87,7 +83,6 @@ TileHitVecToCntTool::TileHitVecToCntTool(const std::string& type,
     m_hitVectorNames.push_back("TileHitVec");
 
     declareProperty("TileHitVectors", m_hitVectorNames,  "Name of input hit vectors (default=TileHitVec)" );
-    declareProperty("TileHitContainer", m_hitContainer,  "Name of output container (default=TileHitCnt)" );
     declareProperty("TileInfoName", m_infoName,          "Name of TileInfo store (default=TileInfo");
     declareProperty("PileUp",m_pileUp,                   "To switch on pileup (default=false)");
     declareProperty("DeltaT",m_deltaT,                   "Minimal Time granularity in TileHit (default=1ns)");
@@ -304,6 +299,9 @@ StatusCode TileHitVecToCntTool::initialize() {
     ATH_MSG_INFO("Number of MBTS cell to be merged: " << std::count (m_MBTSmerged.begin(), m_MBTSmerged.end(), true));
   }
 
+
+  ATH_CHECK( m_hitContainerKey.initialize() );
+
   ATH_MSG_DEBUG("TileHitVecToCntTool initialization completed");
 
   if (error)
@@ -915,9 +913,11 @@ StatusCode TileHitVecToCntTool::mergeEvent() {
   for (std::unique_ptr<TileHitCollection>& coll : *m_hits ) {
     CHECK(hits->addCollection (coll.release(), hashId++));
   }
-  CHECK(evtStore()->record(std::move(hits), m_hitContainer, false));
 
-  ATH_MSG_DEBUG("TileHit container registered to the TES with name" << m_hitContainer);
+  SG::WriteHandle<TileHitContainer> hitContainer(m_hitContainerKey);
+  ATH_CHECK( hitContainer.record(std::move(hits)) );
+
+  ATH_MSG_DEBUG("TileHit container registered to the TES with name" << m_hitContainerKey.key());
 
   //  if (m_skipNoHit && nHit==0) {
   //    setFilterPassed(false);
diff --git a/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx b/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx
index 6856fbf6891..829f162337d 100644
--- a/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx
+++ b/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx
@@ -21,35 +21,33 @@
 //  
 //****************************************************************************
 
-#include "GaudiKernel/ISvcLocator.h"
-#include "AthenaKernel/errorcheck.h"
-#include "AthenaKernel/IAtRndmGenSvc.h"
-
-// Calo includes
-
-#include "CaloIdentifier/TileID.h"
-#include "TileConditions/TileInfo.h"
 // Tile includes
-
+#include "TileSimAlgs/TileMuonReceiverDecision.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileConditions/TileCablingService.h"
-#include "TileEvent/TileRawChannelContainer.h"
 #include "TileConditions/TileCondToolEmscale.h"
-
-#include "TileSimAlgs/TileMuonReceiverDecision.h"
-#include "TileEvent/TileContainer.h"
+#include "TileConditions/TileInfo.h"
 #include "TileEvent/TileMuonReceiverObj.h"
 
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
+#include "AthenaKernel/IAtRndmGenSvc.h"
+
+
 TileMuonReceiverDecision::TileMuonReceiverDecision(std::string name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator),
-    m_MuRcvRawChContainer("MuRcvRawChCnt"),
-    m_TileMuRcvContainer("TileMuRcvCnt"),
     m_tileID(0),
     m_tileHWID(0),
     m_cablingService(0),
     m_tileInfo(0),
-    m_tileToolEmscale("TileCondToolEmscale")
+    m_tileToolEmscale("TileCondToolEmscale"),
+    m_run2(true)
 {
   // declare properties...
   declareProperty( "MuonReceiverEneThreshCellD6Low"       , m_threshold_d6_lo   = 500. , "Setting the lowest trigger threshold for cell D6 in MeV (Def=500 MeV)");
@@ -57,7 +55,6 @@ TileMuonReceiverDecision::TileMuonReceiverDecision(std::string name, ISvcLocator
   declareProperty( "MuonReceiverEneThreshCellD6High"      , m_threshold_d6_hi   = 600. , "Setting the highest trigger threshold for cell D6 in MeV (Def=600 MeV)");
   declareProperty( "MuonReceiverEneThreshCellD6andD5High" , m_threshold_d5d6_hi = 600. , "Setting the highest trigger threshold for cell D5+D6 in MeV (Def=600 MeV)");
   declareProperty( "SelectionCutForMatchedFilterQf"       , m_selCutQf=0.              , "Selection cut for the quality factor of the matched filters");
-  declareProperty( "TileMuonReceiverContainer"            , m_TileMuRcvContainer       , "Tile Calorimeter decision to TGC Sector Logic");
   declareProperty( "TileCondToolEmscale"                  , m_tileToolEmscale          , "Service to calibrate all channels");
   declareProperty( "TileInfoName"                         , m_infoName = "TileInfo" );
 }
@@ -72,6 +69,7 @@ StatusCode TileMuonReceiverDecision::initialize() {
 
   if (m_cablingService->getCablingType() != TileCablingService::RUN2Cabling) {
      ATH_MSG_INFO("TileMuonReceiverDecision should not be used for RUN1 simulations");
+     m_run2 = false;
      return StatusCode::SUCCESS;
   } else {
      ATH_MSG_INFO("Initializing TileMuonReceiverDecision");
@@ -84,13 +82,16 @@ StatusCode TileMuonReceiverDecision::initialize() {
 
   CHECK(m_tileToolEmscale.retrieve());
 
+  ATH_CHECK( m_rawChannelContainerKey.initialize(m_run2));
+  ATH_CHECK( m_muonReceiverContainerKey.initialize(m_run2));
+
   ATH_MSG_INFO("TileMuonReceiverDecision initialization completed" );
   return StatusCode::SUCCESS;
 }
 
 StatusCode TileMuonReceiverDecision::execute() {
   
-  if (m_cablingService->getCablingType() != TileCablingService::RUN2Cabling) {
+  if (!m_run2) {
      ATH_MSG_VERBOSE( "ATT: RUN1 settings TileMuonReceiverDecision will end now" );
      return StatusCode::SUCCESS;
   } else {
@@ -100,14 +101,9 @@ StatusCode TileMuonReceiverDecision::execute() {
 
   // Get the container with the matched filter reconstructed raw channels in MeV
   //
-  const TileRawChannelContainer * MuonReceiverRawChannelContainer;
-  CHECK( evtStore()->retrieve(MuonReceiverRawChannelContainer, m_MuRcvRawChContainer) ); 
+  SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey);
+  ATH_CHECK( rawChannelContainer.isValid() );
   
-  // The collection of raw channel containers are the drawers of extended barrel
-  //
-  TileRawChannelContainer::const_iterator collItr  = MuonReceiverRawChannelContainer->begin();
-  TileRawChannelContainer::const_iterator lastColl = MuonReceiverRawChannelContainer->end();
-
   // Vectors for managemnt for TMDB 2015 configuration with inclusion in trigger in 1.1<eta<1.3
   //
   std::vector<bool>  tile2SL(4,false);
@@ -122,10 +118,12 @@ StatusCode TileMuonReceiverDecision::execute() {
 
   // Create the container to store the decision from the algorithm
   //  
-  TileMuonReceiverContainer * decisionContainer = new TileMuonReceiverContainer();  
+  SG::WriteHandle<TileMuonReceiverContainer> decisionContainer(m_muonReceiverContainerKey);
+  ATH_CHECK( decisionContainer.record(std::make_unique<TileMuonReceiverContainer>()) );
 
-  TileMuonReceiverObj * TileMuRcvObj = new TileMuonReceiverObj(0,thresholds); // Special object with thresholds
-  decisionContainer->push_back(TileMuRcvObj);
+ // Special object with thresholds
+  std::unique_ptr<TileMuonReceiverObj> tileMuRcvObj = std::make_unique<TileMuonReceiverObj>(0,thresholds);
+  decisionContainer->push_back(tileMuRcvObj.release());
 
   // Conversion from TMDB channel number the index to channel number in a drawer
   //
@@ -143,13 +141,11 @@ StatusCode TileMuonReceiverDecision::execute() {
   float energy_HLX[maxCell]={0.,0.,0.,0.,0.};
   float time_HLX[maxCell]={0.,0.,0.,0.,0.};
 
-  for ( ; collItr != lastColl; ++collItr ) {
+  for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
 
-    TileRawChannelCollection::const_iterator chanItr  = (*collItr)->begin();
-    TileRawChannelCollection::const_iterator lastChan = (*collItr)->end();
+    if (rawChannelCollection->empty()) continue;
 
-    if (chanItr==lastChan) continue;
-    int frag_id   = (*collItr)->identify();
+    int frag_id   = rawChannelCollection->identify();
     int drawerIdx = TileCalibUtils::getDrawerIdxFromFragId(frag_id);
     int ros       = frag_id>>8;
     bool eb_ros   = ((ros == TileHWID::EXTBAR_POS) || (ros == TileHWID::EXTBAR_NEG));
@@ -171,11 +167,11 @@ StatusCode TileMuonReceiverDecision::execute() {
     int jch6  = 0;
     int jch56 = 0;
 
-    for ( ; chanItr != lastChan; ++chanItr ) {
+    for (const TileRawChannel* rawChannel : *rawChannelCollection) {
        
       ++ich;
       // For TMDB channel numbers are being set differently (17,16,37,38)->(D5L,D5r,D6L,D6R)->(0,1,2,3)
-      HWIdentifier adc_id = (*chanItr)->adc_HWID() ;
+      HWIdentifier adc_id = rawChannel->adc_HWID() ;
       // TMDB channel is used in COOL and goes from 0..n with n=5 for EB and n=8 in LB
       int TMDBchan = m_tileHWID->channel(adc_id) ;
       if ( TMDBchan >= upperLim ) {
@@ -190,11 +186,11 @@ StatusCode TileMuonReceiverDecision::execute() {
                                                                       , TileRawChannelUnit::MegaElectronVolts) 
                            / m_tileInfo->MuRcvCalib(adc_id);
 
-      float energy = (*chanItr)->amplitude()*ADC2MeV_factor;
-      float time   = (*chanItr)->time();
+      float energy = rawChannel->amplitude()*ADC2MeV_factor;
+      float time   = rawChannel->time();
 
       ATH_MSG_DEBUG( "(E.1."<< ich <<") hwid: "<< m_tileHWID->to_string(adc_id,-1) <<" ch: "<< TMDBchan <<" --> Tile ch: "<< TILEchan  );
-      ATH_MSG_DEBUG( "        E[ADC]: "<<(*chanItr)->amplitude()<<" E[MeV]: "<<energy<<" t[ns]: "<<time<<" QF: "<<(*chanItr)->quality()  );
+      ATH_MSG_DEBUG( "        E[ADC]: "<<rawChannel->amplitude()<<" E[MeV]: "<<energy<<" t[ns]: "<<time<<" QF: "<<rawChannel->quality()  );
 
       if ( eb_ros ) {
         if ( TMDBchan<4 ) {
@@ -274,8 +270,8 @@ StatusCode TileMuonReceiverDecision::execute() {
       time[0] = time_d5d6;
       time[1] = time_d6;
 
-      TileMuonReceiverObj * TileMuRcvObj = new TileMuonReceiverObj(frag_id,ene,time,tile2SL);
-      decisionContainer->push_back(TileMuRcvObj);
+      std::unique_ptr<TileMuonReceiverObj> tileMuRcvObj = std::make_unique<TileMuonReceiverObj>(frag_id,ene,time,tile2SL);
+      decisionContainer->push_back(tileMuRcvObj.release());
       
     } else {
       ATH_MSG_VERBOSE( "== NULL trigger not include in container " );
@@ -286,7 +282,7 @@ StatusCode TileMuonReceiverDecision::execute() {
     ATH_MSG_DEBUG( "== Print TileD decision container output to SL"  );
     decisionContainer->print();
   }
-  CHECK(evtStore()->record( decisionContainer, m_TileMuRcvContainer, false));
+
 
   ATH_MSG_DEBUG("TileMuonReceiverDecision execution completed" );
   return StatusCode::SUCCESS;
diff --git a/TileCalorimeter/TileSimAlgs/src/TilePulseForTileMuonReceiver.cxx b/TileCalorimeter/TileSimAlgs/src/TilePulseForTileMuonReceiver.cxx
index 25dd7963a2a..9cf33e1ba2f 100644
--- a/TileCalorimeter/TileSimAlgs/src/TilePulseForTileMuonReceiver.cxx
+++ b/TileCalorimeter/TileSimAlgs/src/TilePulseForTileMuonReceiver.cxx
@@ -29,38 +29,31 @@
 //
 //****************************************************************************************
 
-#include "GaudiKernel/ISvcLocator.h"
-#include "AthenaKernel/errorcheck.h"
-#include "AthenaKernel/IAtRndmGenSvc.h"
-
-// Calo includes
-
-#include "CaloIdentifier/TileID.h"
-
 // Tile includes
-
+#include "TileSimAlgs/TilePulseForTileMuonReceiver.h"
 #include "TileIdentifier/TileHWID.h"
 #include "TileConditions/TileInfo.h"
-#include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileConditions/TileCablingService.h"
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileConditions/TileCondToolNoiseSample.h"
 #include "TileConditions/TilePulseShapes.h"
 #include "TileConditions/TileCondToolPulseShape.h"
 #include "TileConditions/ITileBadChanTool.h"
-#include "TileEvent/TileHitContainer.h"
-#include "TileEvent/TileDigitsContainer.h"
-#include "TileEvent/TileRawChannel.h"
-#include "TileEvent/TileRawChannelContainer.h"
+#include "TileCalibBlobObjs/TileCalibUtils.h"
 #include "TileRecUtils/TileRawChannelBuilder.h"
 #include "TileRecUtils/TileRawChannelBuilderMF.h"
-
 #include "TileRecUtils/TileBeamInfoProvider.h"
 
-#include "TileSimAlgs/TilePulseForTileMuonReceiver.h"
+// Calo includes
+#include "CaloIdentifier/TileID.h"
+
+// Atlas includes
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+#include "AthenaKernel/errorcheck.h"
+#include "AthenaKernel/IAtRndmGenSvc.h"
 
 // external
-#include "cmath"
 #include <CLHEP/Random/Randomize.h>
 #include <CLHEP/Units/SystemOfUnits.h>
 
@@ -68,6 +61,8 @@ using CLHEP::RandGaussQ;
 using CLHEP::RandFlat;
 using CLHEP::MeV;
 
+#include "cmath"
+
 // constructor
 //
 TilePulseForTileMuonReceiver::TilePulseForTileMuonReceiver(std::string name, ISvcLocator* pSvcLocator)
@@ -92,12 +87,10 @@ TilePulseForTileMuonReceiver::TilePulseForTileMuonReceiver(std::string name, ISv
   , m_tileBadChanTool("TileBadChanTool")
   , m_beamInfo("TileBeamInfoProvider/TileBeamInfoProvider")
   , m_MuRcvBuildTool("TileRawChannelBuilderMF")
+  , m_run2(true)
 {
   // declare properties...
 
-  declareProperty("TileHitContainer"               , m_hitContainer         = "TileHitCnt");
-  declareProperty("MuonReceiverDigitsContainer"    , m_MuRcvDigitsContainer = "MuRcvDigitsCnt");
-  declareProperty("MuonReceiverRawChannelContainer", m_MuRcvRawChContainer  = "MuRcvRawChCnt");
   declareProperty("TileInfoName"                   , m_infoName             = "TileInfo");
   declareProperty("IntegerDigits"                  , m_integerDigits        = false, "Round digits (default=false)");
   declareProperty("TileBadChanTool"                , m_tileBadChanTool);
@@ -127,6 +120,7 @@ StatusCode TilePulseForTileMuonReceiver::initialize() {
 
   if (m_cablingService->getCablingType() != TileCablingService::RUN2Cabling) {
     ATH_MSG_INFO("TilePulseForTileMuonReceiver should not be used for RUN1 simulations");
+    m_run2 = false;
     return StatusCode::SUCCESS;
   } else {
     ATH_MSG_INFO("Initializing TilePulseForTileMuonReceiver");
@@ -190,6 +184,10 @@ StatusCode TilePulseForTileMuonReceiver::initialize() {
     m_tileBadChanTool.disable();
   }
 
+  ATH_CHECK( m_hitContainerKey.initialize(m_run2) );
+  ATH_CHECK( m_muRcvDigitsContainerKey.initialize(m_run2) );
+  ATH_CHECK( m_muRcvRawChannelContainerKey.initialize(m_run2) );
+
   ATH_MSG_VERBOSE("TilePulseForTileMuonReceiver initialization completed");
   return StatusCode::SUCCESS;
 }
@@ -199,12 +197,12 @@ StatusCode TilePulseForTileMuonReceiver::initialize() {
 
 StatusCode TilePulseForTileMuonReceiver::execute() {
 
-  if (m_cablingService->getCablingType() != TileCablingService::RUN2Cabling) {
-    ATH_MSG_VERBOSE( "ATT: RUN1 settings TilePulseForTileMuonReceiver will end now" );
-    return StatusCode::SUCCESS;
-  } else {
+  if (m_run2) {
     ATH_MSG_VERBOSE( "ATT: RUN2 settings TilePulseForTileMuonReceiver will run now" );
     ATH_MSG_DEBUG( "Executing TilePulseForTileMuonReceiver" );
+  } else {
+    ATH_MSG_VERBOSE( "ATT: RUN1 settings TilePulseForTileMuonReceiver will end now" );
+    return StatusCode::SUCCESS;
   }
 
   // Conversion from TMDB channel number to channel number in a drawer: EB (0-3) LB(0-13)
@@ -249,8 +247,8 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
 
   // Get hit container from TES
   //
-  const TileHitContainer* hitCont;
-  CHECK(evtStore()->retrieve(hitCont, m_hitContainer));
+  SG::ReadHandle<TileHitContainer> hitContainer(m_hitContainerKey);
+  ATH_CHECK( hitContainer.isValid() );
 
   // Set up buffers for handling information in a single collection.
   //
@@ -259,11 +257,18 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
 
   // Get a container for the digits
   //
-  TileDigitsContainer* MuonReceiverDigitsContainer = new TileDigitsContainer(true);
+  SG::WriteHandle<TileDigitsContainer> muRcvDigitsContainer(m_muRcvDigitsContainerKey);
+  ATH_CHECK( muRcvDigitsContainer.record(std::make_unique<TileDigitsContainer>(true)) );
     
   // Get a container for the raw channels
   //
-  TileRawChannelContainer* MuonReceiverRawChannelContainer = new TileRawChannelContainer(true, TileFragHash::MF, TileRawChannelUnit::MegaElectronVolts, SG::VIEW_ELEMENTS);
+  SG::WriteHandle<TileRawChannelContainer> muRcvRawChannelContainer(m_muRcvRawChannelContainerKey);
+  ATH_CHECK( muRcvRawChannelContainer.record(std::make_unique<TileRawChannelContainer>(true, 
+                                                                                       TileFragHash::MF, 
+                                                                                       TileRawChannelUnit::MegaElectronVolts, 
+                                                                                       SG::VIEW_ELEMENTS)) );
+  
+
 
   // Vector of digits to set into the container
   //
@@ -272,14 +277,12 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
   /////////////////////////////////////////////////////////////////////////////////
   // (a.0) iterate over collections in the HIT container: access 'ros' and 'drawer'
   //
-  TileHitContainer::const_iterator collItr = hitCont->begin();
-  TileHitContainer::const_iterator lastColl = hitCont->end();
 
-  for (; collItr != lastColl; ++collItr) {
+  for (const TileHitCollection* hitCollection : *hitContainer) {
 
     // Get array of HWID's for this drawer (stored locally).
     //
-    HWIdentifier drawer_id = m_tileHWID->drawer_id((*collItr)->identify());
+    HWIdentifier drawer_id = m_tileHWID->drawer_id(hitCollection->identify());
     int ros = m_tileHWID->ros(drawer_id);
     int drawer = m_tileHWID->drawer(drawer_id);
     int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
@@ -306,16 +309,13 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
     //////////////////////////////////////////////////////////////////////////////
     // (a.1) Iterate over all hits in a collection : access 'channel'
     //
-    TileHitCollection::const_iterator hitItr = (*collItr)->begin();
-    TileHitCollection::const_iterator lastHit = (*collItr)->end();
+    if ( hitCollection->empty() ) ATH_MSG_DEBUG("-- No hits in this drawer! Filling channels with noise and pedestal. --");
 
-    if ( !(*collItr)->size() ) ATH_MSG_DEBUG("-- No hits in this drawer! Filling channels with noise and pedestal. --");
-
-    for (; hitItr != lastHit; ++hitItr) {
+    for (const TileHit* tile_hit : *hitCollection) {
 
       // Get the pmt ID
       //
-      Identifier pmt_id = (*hitItr)->pmt_ID();
+      Identifier pmt_id = tile_hit->pmt_ID();
 
       // keep only D-cells and in addition cell BC8
       // 
@@ -376,7 +376,7 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
       //       Calibrations are applied per subhit and energy added per subhit of a channel
       //
 
-      int n_hits = (*hitItr)->size();
+      int n_hits = tile_hit->size();
 
       ATH_MSG_VERBOSE("------ Number of hits in channel: " << n_hits);
 
@@ -384,7 +384,7 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
 
         ATH_MSG_VERBOSE("(C.00) ++ Iterating over the hits of channel " << TILEchan  <<": hit #" << ihit);
 
-        double e_hit = (*hitItr)->energy(ihit); // [MeV] energy deposited in scintillator
+        double e_hit = tile_hit->energy(ihit); // [MeV] energy deposited in scintillator
         double e_pmt = e_hit * hit_calib;       // [MeV] true cell energy
 
         ATH_MSG_VERBOSE("(C.01) Energy in scintillator [MeV]: " << e_hit << " true cell energy [MeV]: " << e_pmt);
@@ -392,7 +392,7 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
         // Need to pass the negative of t_hit, this is because the trigger returns the amplitude
         // at a given phase whereas the t_hit returns it from t=0 when the hit took place
         //
-        double t_hit = (*hitItr)->time(ihit);
+        double t_hit = tile_hit->time(ihit);
 
         ATH_MSG_VERBOSE("(C.02.01) Phase " << t_hit);
 
@@ -521,7 +521,12 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
 
       ATH_MSG_VERBOSE( "(D.02.00)   Channel: "<<ros<<'/'<<drawer<<'/'<< TMDBchan
                       << " adc/pCb: "<< muRcv_Calib
-                      << " Mev/pCb: "<< m_tileToolEmscale->channelCalib( drawerIdx, TILEchan, TileID::LOWGAIN, 1., TileRawChannelUnit::PicoCoulombs, TileRawChannelUnit::MegaElectronVolts)
+                      << " Mev/pCb: "<< m_tileToolEmscale->channelCalib( drawerIdx, 
+                                                                         TILEchan, 
+                                                                         TileID::LOWGAIN, 
+                                                                         1., 
+                                                                         TileRawChannelUnit::PicoCoulombs, 
+                                                                         TileRawChannelUnit::MegaElectronVolts)
                       << " final calibration factor adc/MeV: "<< mev2ADC_factor);
 
       // Collecting pedestal from the database
@@ -587,12 +592,13 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
       } else {
         ATH_MSG_VERBOSE( "(D.03)   Good Channel: "<< ros << '/' << drawer << '/' << TILEchan <<" ("<< TMDBchan <<") LowGain" );
       }
-      ATH_MSG_VERBOSE( "(D.04)   Changed to TMDB adc_id: " << m_tileHWID->to_string(adc_id) << " and create a TileDigits object and set it into a container." );
-      TileDigits* MuonReceiverDigits = new TileDigits(adc_id, digitsBuffer);
-      MuonReceiverDigitsContainer->push_back(MuonReceiverDigits);
+      ATH_MSG_VERBOSE( "(D.04)   Changed to TMDB adc_id: " << m_tileHWID->to_string(adc_id) 
+                       << " and create a TileDigits object and set it into a container." );
+      std::unique_ptr<TileDigits> muonReceiverDigits = std::make_unique<TileDigits>(adc_id, digitsBuffer);
       ATH_MSG_VERBOSE( "(D.05)   Create a TileRawChannelObject object and set it into a container " );
-      TileRawChannel* MuRcvRawChannel = m_MuRcvBuildTool->rawChannel(MuonReceiverDigits);
-      MuonReceiverRawChannelContainer->push_back(MuRcvRawChannel);
+      TileRawChannel* muRcvRawChannel = m_MuRcvBuildTool->rawChannel(muonReceiverDigits.get());
+      muRcvDigitsContainer->push_back(muonReceiverDigits.release());
+      muRcvRawChannelContainer->push_back(muRcvRawChannel);
       if (msgLvl(MSG::DEBUG)){
         ATH_MSG_DEBUG( " Channel " << m_tileHWID->to_string(adc_id,-1) 
                        << " Digitized pulse [ADC] "<< digitsBuffer[0]
@@ -603,18 +609,17 @@ StatusCode TilePulseForTileMuonReceiver::execute() {
                        << "/" << digitsBuffer[5]
                        << "/" << digitsBuffer[6]  );
         ATH_MSG_DEBUG( " Raw channel reconstruction Ch: "<< m_tileHWID->to_string(adc_id,-1)
-                       <<" E [ADC]: "<< MuRcvRawChannel->amplitude()
-                       <<" Time [ns]: "<< MuRcvRawChannel->time()
-                       <<" Qf: "<< MuRcvRawChannel->quality()  );
+                       <<" E [ADC]: "<< muRcvRawChannel->amplitude()
+                       <<" Time [ns]: "<< muRcvRawChannel->time()
+                       <<" Qf: "<< muRcvRawChannel->quality()  );
       }
     }
   } // END loop over all HIT collections in container
-  if (msgLvl(MSG::VERBOSE)) MuonReceiverDigitsContainer->print();
+  if (msgLvl(MSG::VERBOSE)) muRcvDigitsContainer->print();
   // (b) Register the digits container in the TES
   //
   ATH_MSG_VERBOSE ( "(A.05)   Send to event store all collected objects " );
-  CHECK(evtStore()->record(MuonReceiverDigitsContainer, m_MuRcvDigitsContainer, false));
-  CHECK(evtStore()->record(MuonReceiverRawChannelContainer, m_MuRcvRawChContainer, false));
+
   ATH_MSG_VERBOSE( "TilePulseForTileMuonReceiver execution completed" );
 
   return StatusCode::SUCCESS;
diff --git a/TileCalorimeter/TileSimAlgs/src/TileTBHitToBeamElem.cxx b/TileCalorimeter/TileSimAlgs/src/TileTBHitToBeamElem.cxx
index 395ad5d0fb8..5f856b3275a 100644
--- a/TileCalorimeter/TileSimAlgs/src/TileTBHitToBeamElem.cxx
+++ b/TileCalorimeter/TileSimAlgs/src/TileTBHitToBeamElem.cxx
@@ -16,36 +16,30 @@
 //
 //*****************************************************************************
 
-// Gaudi Includes
-#include "GaudiKernel/ISvcLocator.h"
-
-// Atlas includes
-#include "AthenaKernel/errorcheck.h"
+// Tile includes
+#include "TileSimAlgs/TileTBHitToBeamElem.h"
+#include "TileConditions/TileInfo.h"
 
 // Calo includes
 #include "CaloIdentifier/TileTBID.h"
 #include "TileIdentifier/TileHWID.h"
 
-// Tile includes
-#include "TileConditions/TileInfo.h"
-#include "TileSimEvent/TileHitVector.h"
-#include "TileEvent/TileBeamElemContainer.h"
-#include "TileSimAlgs/TileTBHitToBeamElem.h"
+// Atlas includes
+#include "AthenaKernel/errorcheck.h"
+#include "StoreGate/ReadHandle.h"
+#include "StoreGate/WriteHandle.h"
+
 
 //
 // Constructor
 //
 TileTBHitToBeamElem::TileTBHitToBeamElem(std::string name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
-  , m_hitVector("TileTBHits")
-  , m_beamElemContainer("TileBeamElemCnt")
   , m_infoName("TileInfo")
   , m_tileTBID(0)
   , m_tileHWID(0)
   , m_tileInfo(0)
 {
-  declareProperty("TileTBHitVector", m_hitVector);    
-  declareProperty("TileBeamElemContainer", m_beamElemContainer);
   declareProperty("TileInfoName", m_infoName);
 }
 
@@ -65,6 +59,9 @@ StatusCode TileTBHitToBeamElem::initialize() {
 
   CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
 
+  ATH_CHECK( m_hitVectorKey.initialize() );
+  ATH_CHECK( m_beamElemContainerKey.initialize() );
+
   ATH_MSG_INFO( "TileTBHitToBeamElem initialization completed" );
 
   return StatusCode::SUCCESS;
@@ -78,32 +75,29 @@ StatusCode TileTBHitToBeamElem::execute() {
   ATH_MSG_DEBUG( "Executing TileTBHitToBeamElem" );
 
   // create new container
-  TileBeamElemContainer * pBeamElemContainer = new TileBeamElemContainer(true);
+  SG::WriteHandle<TileBeamElemContainer> beamElemContainer(m_beamElemContainerKey);
+  ATH_CHECK( beamElemContainer.record(std::make_unique<TileBeamElemContainer>(true)) );
 
   //**
   //* Get TileHits from TileHitVector
   //**
-  const TileHitVector * inputHits;
-  CHECK( evtStore()->retrieve(inputHits, m_hitVector) );
-
-  TileHitVecConstIterator hitItr = inputHits->begin();
-  TileHitVecConstIterator end = inputHits->end();
+  SG::ReadHandle<TileHitVector> hitVector(m_hitVectorKey);
+  ATH_CHECK( hitVector.isValid() );
 
   //**
   //* Iterate over hits
   //**
-
-  for (; hitItr != end; ++hitItr) {
+  for (const TileHit& tile_hit : *hitVector) {
 
     // Get hit Identifier (= identifier of pmt)
-    Identifier pmt_id = hitItr->pmt_ID();
+    Identifier pmt_id = tile_hit.pmt_ID();
     // adc_id and channel_id for beam elem are the same
     // because there is only one gain, i.e. gain bit is always 0
-    HWIdentifier adc_id = hitItr->pmt_HWID();
+    HWIdentifier adc_id = tile_hit.pmt_HWID();
 
     /* Get hit amplitude and convert to energy (cell-dependent) */
     double hit_calib = m_tileInfo->BeamElemHitCalib(pmt_id);
-    double e_hit = hitItr->energy();
+    double e_hit = tile_hit.energy();
     double e_ch = e_hit * hit_calib;
 
     /* Convert to amplitude of channel */
@@ -116,14 +110,10 @@ StatusCode TileTBHitToBeamElem::execute() {
                     << " adc=" << m_tileHWID->to_string(adc_id)
                     << " amp=" << amp_ch);
 
-    TileBeamElem * pBeamElem = new TileBeamElem(adc_id, amp_ch);
-    pBeamElemContainer->push_back(pBeamElem);
-
+    std::unique_ptr<TileBeamElem> beamElem = std::make_unique<TileBeamElem>(adc_id, amp_ch);
+    beamElemContainer->push_back(beamElem.release());
   }
 
-  // step3: register the cell container in the TES
-  CHECK( evtStore()->record(pBeamElemContainer, m_beamElemContainer, false) );
-
   // Execution completed.
   ATH_MSG_DEBUG( "TileTBHitToBeamElem execution completed." );
 
diff --git a/Tools/LWHists/src/LWBinLabels.cxx b/Tools/LWHists/src/LWBinLabels.cxx
index b5d37d99ada..6067c26f9d6 100644
--- a/Tools/LWHists/src/LWBinLabels.cxx
+++ b/Tools/LWHists/src/LWBinLabels.cxx
@@ -100,7 +100,7 @@ void LWBinLabels::grow()
   assert(m_allocated==m_size);
   unsigned l = std::min<unsigned>(m_size+4,static_cast<unsigned>(m_allocated*1.5+0.5));
   Entry * new_list = LWPools::acquire<Entry>(l);
-  memcpy(new_list,m_list,m_size*sizeof(m_list[0]));
+  std::copy (m_list, m_list + m_size, new_list);
   LWPools::release<Entry>(m_list,m_allocated);
   m_list = new_list;
   m_allocated = l;
diff --git a/Tools/PathResolver/Root/PathResolver.cxx b/Tools/PathResolver/Root/PathResolver.cxx
index b6be0d31050..c8aae45fb99 100644
--- a/Tools/PathResolver/Root/PathResolver.cxx
+++ b/Tools/PathResolver/Root/PathResolver.cxx
@@ -145,7 +145,7 @@ PathResolver::PR_find( const std::string& logical_file_name, const string& searc
         result = bf::system_complete(fp).string();
         return true;
       }
-    } catch (bf::filesystem_error /*err*/) {
+    } catch (const bf::filesystem_error& /*err*/) {
     }
 
 
@@ -168,7 +168,7 @@ PathResolver::PR_find( const std::string& logical_file_name, const string& searc
             return true;
           }
         }
-      } catch (bf::filesystem_error /*err*/) {
+      } catch (const bf::filesystem_error& /*err*/) {
       }
     }
 
@@ -288,7 +288,7 @@ PathResolver::check_search_path (const std::string& search_path)
         return (UnknownDirectory);
       }
     }
-  } catch(bf::filesystem_error /*err*/) {
+  } catch(const bf::filesystem_error& /*err*/) {
     return (UnknownDirectory);
   }
 
diff --git a/Tracking/TrkAlgorithms/TrkTrackCollectionMerger/src/TrackCollectionMerger.cxx b/Tracking/TrkAlgorithms/TrkTrackCollectionMerger/src/TrackCollectionMerger.cxx
index 37ff3dc0267..a2d6cdde9e3 100644
--- a/Tracking/TrkAlgorithms/TrkTrackCollectionMerger/src/TrackCollectionMerger.cxx
+++ b/Tracking/TrkAlgorithms/TrkTrackCollectionMerger/src/TrackCollectionMerger.cxx
@@ -107,12 +107,10 @@ StatusCode Trk::TrackCollectionMerger::execute_r(const EventContext& ctx) const
 
   ATH_MSG_DEBUG("Update summaries");  
   // now loop over all tracks and update summaries with new shared hit counts
-  TrackCollection::iterator rf  = outputCol->begin();
-  TrackCollection::iterator rfE = outputCol->end();
-  for(  ; rf != rfE; ++rf){ 
-    if (m_updateAdditionalInfo)  m_trkSummaryTool->updateAdditionalInfo(**rf);
-    else if (m_updateSharedHitsOnly) m_trkSummaryTool->updateSharedHitCount(**rf);
-    else  m_trkSummaryTool->updateTrack(**rf);
+  for (Trk::Track* trk : *outputCol) {
+    if (m_updateAdditionalInfo)  m_trkSummaryTool->updateAdditionalInfo(*trk);
+    else if (m_updateSharedHitsOnly) m_trkSummaryTool->updateSharedHitCount(*trk);
+    else  m_trkSummaryTool->updateTrack(*trk);
   }
 
   SG::WriteHandle<TrackCollection> h_write(m_outtracklocation,ctx);
@@ -208,9 +206,11 @@ StatusCode Trk::TrackCollectionMerger::mergeTrack(const TrackCollection* trackCo
     ATH_MSG_DEBUG("Size of track collection " << trackCol->size());
 
     // loop over tracks
-    for(auto& rf: *trackCol){
+    for(const auto& rf: *trackCol){
       // add track into output
-      Trk::Track* newTrack = m_createViewCollection ? rf : new Trk::Track(*rf);
+      // FIXME: const_cast
+      // These objects are modified in the `Update summaries' section
+      Trk::Track* newTrack = m_createViewCollection ? const_cast<Trk::Track*>(rf) : new Trk::Track(*rf);
       outputCol->push_back(newTrack);
       // add tracks into PRD tool
       if (m_assoTool->addPRDs(*newTrack).isFailure())
diff --git a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSelector.cxx b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSelector.cxx
index bd3029cf9e5..615e8343f64 100755
--- a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSelector.cxx
+++ b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSelector.cxx
@@ -62,8 +62,8 @@ StatusCode TrackTruthSelector::execute() {
 
   fillOutput(out,detailed);
 
-  ATH_CHECK(wh_output.record(std::make_unique<TrackTruthCollection>(*out)));
-  
+  ATH_CHECK(wh_output.record(std::unique_ptr<TrackTruthCollection>(out)));
+
   return StatusCode::SUCCESS;
 
 }
diff --git a/Tracking/TrkAlignment/TrkAlgebraUtils/src/IPCMat.cxx b/Tracking/TrkAlignment/TrkAlgebraUtils/src/IPCMat.cxx
index 10db380b884..bf78ca46d47 100644
--- a/Tracking/TrkAlignment/TrkAlgebraUtils/src/IPCMat.cxx
+++ b/Tracking/TrkAlignment/TrkAlgebraUtils/src/IPCMat.cxx
@@ -309,7 +309,7 @@ StatusCode IPCMat::write(const std::string ipcname, bool isMatrix){
 	   << endmsg;
 
   m_ipcmat_msgp.mtype = isMatrix ? M_WRITE_M : M_WRITE_V;
-  strncpy(m_ipcmat_msgp.data.fname, ipcname.c_str(), sizeof(m_ipcmat_msgp.data.fname));
+  strncpy(m_ipcmat_msgp.data.fname, ipcname.c_str(), sizeof(m_ipcmat_msgp.data.fname)-1);
   m_ipcmat_msgp.data.fname[sizeof(m_ipcmat_msgp.data.fname) - 1] = '\0';
 
   if (msgsnd(m_msgid, &m_ipcmat_msgp, sizeof(m_ipcmat_msgp)-sizeof(long), IPC_NOWAIT) < 0) {
diff --git a/Tracking/TrkAlignment/TrkAlignEvent/src/AlignTrack.cxx b/Tracking/TrkAlignment/TrkAlignEvent/src/AlignTrack.cxx
index c4821eb8094..d93f2047563 100644
--- a/Tracking/TrkAlignment/TrkAlignEvent/src/AlignTrack.cxx
+++ b/Tracking/TrkAlignment/TrkAlignEvent/src/AlignTrack.cxx
@@ -269,21 +269,15 @@ namespace Trk {
   //________________________________________________________________________
   void AlignTrack::dumpTrackInfo(const Track& track, MsgStream& msg) 
   {
-    std::vector<const TrackStateOnSurface*>::const_iterator itsos     = track.trackStateOnSurfaces()->begin();
-    std::vector<const TrackStateOnSurface*>::const_iterator itsos_end = track.trackStateOnSurfaces()->end();
-    for ( ; itsos != itsos_end; ++itsos)
-      msg<<**itsos;
+    for (const TrackStateOnSurface* tsos : *track.trackStateOnSurfaces())
+      msg<<*tsos;
   }
 
   //________________________________________________________________________
   void AlignTrack::dumpLessTrackInfo(const Track& track, MsgStream& msg) 
   {
     int ntsos(0);
-    std::vector<const TrackStateOnSurface*>::const_iterator itsos     = track.trackStateOnSurfaces()->begin();
-    std::vector<const TrackStateOnSurface*>::const_iterator itsos_end = track.trackStateOnSurfaces()->end();
-    for ( ; itsos != itsos_end; ++itsos, ++ntsos) {
-
-      const TrackStateOnSurface* tsos = *itsos;
+    for (const TrackStateOnSurface* tsos : *track.trackStateOnSurfaces()) {
       msg<<"ntsos "<<ntsos<<":"<<", type "<<tsos->dumpType();
       //msg << " perigee center of this TSOS: "<< tsos->trackParameters()->associatedSurface()->center() << endmsg;
 
@@ -318,6 +312,7 @@ namespace Trk {
         else
           msg << ", hmm... no material effects on track!"<<endmsg;
       }
+      ++ntsos;
     }
   }
 
diff --git a/Tracking/TrkAlignment/TrkAlignGenAlgs/python/AlignAlgGetter.py b/Tracking/TrkAlignment/TrkAlignGenAlgs/python/AlignAlgGetter.py
deleted file mode 100644
index 4692a9991f5..00000000000
--- a/Tracking/TrkAlignment/TrkAlignGenAlgs/python/AlignAlgGetter.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   AlignAlgGetter.py
-## @brief:  to instantiate the AlignAlg
-## 	    with the default configuration
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags as align
-
-## AlignAlgGetter configures the AlignAlg with default tools and
-#  options and adds to topSequence.  (Detector-specific tools 
-#  must be configured after AlignAlg is created.)
-class AlignAlgGetter ( Configured ) :
-
-    _name = 'AlignAlgGetter'
-
-    ## create and configure AlignAlg
-    def configure(self):
-        mlog = logging.getLogger( self._name+'::configure :')
-
-        from TrkAlignGenTools.AlignTrackCreatorGetter import AlignTrackCreatorGetter
-        alignTrackCreator = AlignTrackCreatorGetter().AlignTrackCreatorHandle()
-
-        from TrkAlignGenTools.AlignTrackDresserGetter import AlignTrackDresserGetter
-        alignTrackDresser = AlignTrackDresserGetter().AlignTrackDresserHandle()
-        
-        from TrkAlignGenTools.AlignTrackDresserGetter import AlignTrackDresserGetter
-        alignTrackDresser = AlignTrackDresserGetter().AlignTrackDresserHandle()
-
-        from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignAlg
-        alignAlg = Trk__AlignAlg("AlignAlg",
-                                 OutputLevel = align.OutputLevel(),
-                                 AlignTrackCreator = alignTrackCreator,
-                                 AlignTrackDresser = alignTrackDresser,
-                                 AlignTool = self.getAlignTool(),
-                                 WriteNtuple = align.writeNtuple(),
-                                 FileName = align.ntupleFileName(),
-                                 FilePath = align.ntupleFilePath(),
-                                 SolveOnly = align.solveOnly())
-
-        self._alignAlgHandle = alignAlg
-
-        # add to topSequence
-        mlog.info(" now adding to topSequence" )
-        from AthenaCommon.AlgSequence import AlgSequence
-        topSequence = AlgSequence()
-        topSequence += self.AlignAlgHandle()
-
-        mlog.info(" leaving configure" )
-
-        return True
-
-    ## returns handle to AlignAlg
-    def AlignAlgHandle(self):
-        return self._alignAlgHandle
-
-    ## returns align tool
-    def getAlignTool(self) :
-        
-        if align.alignmentType() == 'GlobalChi2' :
-            from TrkGlobalChi2AlignTools.GlobalChi2AlignToolGetter import GlobalChi2AlignToolGetter
-            return GlobalChi2AlignToolGetter().GlobalChi2AlignToolHandle()
-        
-        else:
-            print "only global chi2 supported for now!"
-            return
-          
diff --git a/Tracking/TrkAlignment/TrkAlignGenTools/python/AlignTrackDresserGetter.py b/Tracking/TrkAlignment/TrkAlignGenTools/python/AlignTrackDresserGetter.py
deleted file mode 100644
index a3d0e0df00e..00000000000
--- a/Tracking/TrkAlignment/TrkAlignGenTools/python/AlignTrackDresserGetter.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   AlignTrackDresserGetter.py
-## @brief:  to instantiate the AlignTrackDresser
-## 	    with the default configuration
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags
-
-## AlignTrackDresserGetter creates an AlignTrackDresser
-#  but does not add to ToolSvc, so user has to use as a
-#  private or add to ToolSvc as public tool
-class AlignTrackDresserGetter ( Configured ) :
-  
-  _name = 'AlignTrackDresserGetter'
-
-  def configure(self):
-    mlog = logging.getLogger( self._name+'::configure :' )
-            
-    # create tool instance
-    from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackDresser
-    alignTrackDresser=Trk__AlignTrackDresser("AlignTrackDresser",
-                                             OutputLevel = AlignmentFlags.OutputLevel(),
-                                             DerivCalcTool = self.derivativeCalcTool())
-
-    self._AlignTrackDresserHandle = alignTrackDresser
-    
-    #mlog.info(" now adding to ToolSvc")
-    #from __main__ import ToolSvc 
-    #ToolSvc += self.AlignTrackDresserHandle()
-    
-    mlog.info(" leaving configure")
-    
-    return True
-  
-  ## returns AlignTrackDresser
-  def AlignTrackDresserHandle(self):
-    return self._AlignTrackDresserHandle
-
-  ## returns derivative calculator owned by AlignTrackDresser.  If it does
-  #  exist, creates new one based on AlignmentFlags.
-  def derivativeCalcTool(self):
-    try: 
-      self._derivCalcTool
-    except:
-      derivativeType = AlignmentFlags.derivativeType()
-      if derivativeType == 'Analytical' :      
-        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AnalyticalDerivCalcTool
-        self._derivCalcTool = Trk__AnalyticalDerivCalcTool("AnalyticalDerivCalcTool",
-                                                           OutputLevel=AlignmentFlags.OutputLevel())
-      elif derivativeType == 'Numerical' :
-        from TrkAlignGenTools.ShiftingDerivCalcToolGetter import ShiftingDerivCalcToolGetter
-        self._derivCalcTool = ShiftingDerivCalcToolGetter().ShiftingDerivCalcToolHandle()
-      else:
-        print "bad option!"
-    print "have derivCalcTool"
-    return self._derivCalcTool
-
-
-
diff --git a/Tracking/TrkAlignment/TrkAlignGenTools/python/ShiftingDerivCalcToolGetter.py b/Tracking/TrkAlignment/TrkAlignGenTools/python/ShiftingDerivCalcToolGetter.py
deleted file mode 100644
index 7403dfe4e6f..00000000000
--- a/Tracking/TrkAlignment/TrkAlignGenTools/python/ShiftingDerivCalcToolGetter.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-## @file:   ShiftingDerivCalcToolGetter.py
-## @brief:  to instantiate the ShiftingDerivCalcToolDresser
-## 	    with the default configuration
-## @author: Robert Harrington <roberth@bu.edu>
-## @date:   10/19/2009
-
-from AthenaCommon.Logging import logging
-from RecExConfig.Configured import Configured
-from TrkAlignGenTools.AlignmentFlags import AlignmentFlags
-from MuonAlignGenTools.MuonAlignmentFlags import MuonAlignmentFlags as mualign
-
-## ShiftingDerivCalcToolGetter creates and configures the 
-#  ShiftingDerivCalcTool with default parameters.  The tool 
-#  is not added to ToolSvc so user must use it as a private 
-#  tool or add to ToolSvc as a public tool.
-class ShiftingDerivCalcToolGetter ( Configured ) :
-
-    _name = 'ShiftingDerivCalcToolGetter'
-
-    ## creates and configures tool
-    def configure(self):
-        mlog = logging.getLogger( self._name+'::configure :' )
-    
-        # create tool instance
-        from TrkAlignGenTools.AlignResidualCalculatorGetter import AlignResidualCalculatorGetter
-        resCalc = AlignResidualCalculatorGetter().AlignResidualCalculatorHandle()
-
-        from TrkAlignGenTools.AlignmentTrackFitter import AlignmentTrackFitter
-        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__ShiftingDerivCalcTool
-        shiftingDerivCalcTool=Trk__ShiftingDerivCalcTool("ShiftingDerivCalcTool",
-                                                         OutputLevel=AlignmentFlags.OutputLevel(),
-                                                         TrackFitterTool = AlignmentTrackFitter().fitter(),
-                                                         ResidualCalculator = resCalc,
-                                                         TranslationSize = mualign.shiftSizeTranslations(),
-                                                         RotationSize = mualign.shiftSizeRotations(),
-                                                         NumberOfShifts = mualign.numberOfShifts(),
-                                                         doChi2VChamberShiftsMeasType = mualign.doChi2VChamberShiftsMeasType())
-        if AlignmentFlags.useSLFitter() :
-            shiftingDerivCalcTool.SLTrackFitterTool = AlignmentTrackFitter().slfitter()
-
-        # configure other jobOptions
-        shiftingDerivCalcTool.RunOutlierRemoval    = AlignmentFlags.runOutlierRemoval()
-        shiftingDerivCalcTool.ParticleNumber       = AlignmentFlags.particleNumber()
-        shiftingDerivCalcTool.TrackAlignParamCut   = AlignmentFlags.trackAlignParamCut()
-        shiftingDerivCalcTool.SetMinIterations     = AlignmentFlags.setMinIterations()
-
-        self._ShiftingDerivCalcToolHandle = shiftingDerivCalcTool
-        
-        mlog.info(" now adding to ToolSvc")
-        from __main__ import ToolSvc 
-        ToolSvc += self.ShiftingDerivCalcToolHandle()
-        
-        mlog.info(" leaving configure")
-
-        return True
-
-    ## returns handle to ShiftingDerivCalcTool
-    def ShiftingDerivCalcToolHandle(self):
-        return self._ShiftingDerivCalcToolHandle
diff --git a/Tracking/TrkDetDescr/TrkDetDescrAlgs/TrkDetDescrAlgs/MaterialValidation.h b/Tracking/TrkDetDescr/TrkDetDescrAlgs/TrkDetDescrAlgs/MaterialValidation.h
index 086f121f96f..388c8fd6daa 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrAlgs/TrkDetDescrAlgs/MaterialValidation.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrAlgs/TrkDetDescrAlgs/MaterialValidation.h
@@ -84,7 +84,6 @@ namespace Trk {
         
         /** Mapper and Inspector */                          
         ToolHandle<IMaterialMapper>                          m_materialMapper;            //!< Pointer to an IMaterialMapper algTool
-        int                                                  m_materialMappingEvents;     //!< count the number of validation records to avoid 2G files
         int                                                  m_maxMaterialMappingEvents;  //!< limit the number of validation records to avoid 2G files
         
 
diff --git a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.cxx b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.cxx
index a965fe0540f..fb4f7d9c942 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.cxx
+++ b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.cxx
@@ -241,7 +241,7 @@ StatusCode Trk::MaterialMapping::execute()
                 // layers are ordered, hence you can move the starting point along
                 size_t currentLayer = 0;
                 // loop through hits and find the closest layer, the start point moves outwards as we go 
-                for ( auto& step : (*materialStepCollection) ) {
+                for ( const Trk::MaterialStep* step : *materialStepCollection ) {
                    // verbose output    
                    ATH_MSG_VERBOSE("[L] starting from layer " << currentLayer << " from layer collection for this step.");
                    // step length and position
diff --git a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx
index 102d5e9e105..4a1ad42709a 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx
+++ b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx
@@ -32,7 +32,6 @@ Trk::MaterialValidation::MaterialValidation(const std::string& name, ISvcLocator
   m_trackingGeometrySvc("AtlasTrackingGeometrySvc",name),
   m_trackingGeometry(0),
   m_materialMapper("Trk::MaterialMapper/MappingMaterialMapper"),
-  m_materialMappingEvents(0),
   m_maxMaterialMappingEvents(25000),
   m_flatDist(0),
   m_etaMin(-3.),
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinUtility.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinUtility.h
index 5c410fdfe05..8bad4ec12ef 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinUtility.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinUtility.h
@@ -127,7 +127,7 @@ namespace Trk {
         }
         
         /** Operator++ to make multidimensional BinUtility */
-        BinUtility& operator+= ( const BinUtility& gbu) throw (GaudiException) {
+        BinUtility& operator+= ( const BinUtility& gbu) {
             const std::vector<BinningData>& bData = gbu.binningData(); 
             if (m_binningData.size() + bData.size() > 3) 
                 throw GaudiException("BinUtility does not support dim > 3", "FATAL", StatusCode::FAILURE);
@@ -145,7 +145,7 @@ namespace Trk {
         const std::vector<BinningData>& binningData() const { return m_binningData; }
           
         /** Bin from a 3D vector (already in binning frame) */
-        size_t bin(const Amg::Vector3D& position, size_t ba=0) const throw (GaudiException)
+        size_t bin(const Amg::Vector3D& position, size_t ba=0) const
         {
           if (ba >= m_binningData.size()) 
                 throw GaudiException("BinUtility", "dimension out of bounds", StatusCode::FAILURE); 
@@ -154,7 +154,7 @@ namespace Trk {
         }
         
         /** Bin from a 3D vector (already in binning frame) */
-        size_t entry(const Amg::Vector3D& position, size_t ba=0) const throw (GaudiException)
+        size_t entry(const Amg::Vector3D& position, size_t ba=0) const
         { if (ba >= m_binningData.size()) 
                 throw GaudiException("BinUtility", "dimension out of bounds", StatusCode::FAILURE); 
           return m_binningData[ba].entry(position);
@@ -162,21 +162,21 @@ namespace Trk {
         
         
         /** Bin from a 3D vector (already in binning frame) */
-        size_t next(const Amg::Vector3D& position, const Amg::Vector3D& direction, size_t ba=0) const throw (GaudiException)
+        size_t next(const Amg::Vector3D& position, const Amg::Vector3D& direction, size_t ba=0) const
         { if (ba >= m_binningData.size()) 
                 throw GaudiException("BinUtility", "dimension out of bounds", StatusCode::FAILURE); 
           return m_binningData[ba].next(position, direction);
         }       
 
         /** Distance estimate to next bin  */
-	    std::pair<size_t,float> distanceToNext(const Amg::Vector3D& position, const Amg::Vector3D& direction, size_t ba=0) const throw (GaudiException)
+	    std::pair<size_t,float> distanceToNext(const Amg::Vector3D& position, const Amg::Vector3D& direction, size_t ba=0) const
         { if (ba >= m_binningData.size()) 
                 throw GaudiException("BinUtility", "dimension out of bounds", StatusCode::FAILURE); 
           return m_binningData[ba].distanceToNext(position, direction);
         }       
         
         /** Return the oder direciton for fast interlinking */
-        LayerOrder orderDirection(const Amg::Vector3D& position, const Amg::Vector3D& direction, size_t ba=0) const throw (GaudiException)  {
+        LayerOrder orderDirection(const Amg::Vector3D& position, const Amg::Vector3D& direction, size_t ba=0) const  {
              if (ba >= m_binningData.size()) 
                     throw GaudiException("BinUtility", "dimension out of bounds", StatusCode::FAILURE); 
               return m_binningData[ba].orderDirection(position, direction);
@@ -186,7 +186,7 @@ namespace Trk {
             - USE WITH CARE !!
               You need to check if your local position is actually in the binning frame of the BinUtility
         */
-        size_t bin(const Amg::Vector2D& lposition, size_t ba=0) const throw (GaudiException) 
+        size_t bin(const Amg::Vector2D& lposition, size_t ba=0) const 
         {    
             if (ba >= m_binningData.size()) 
                     throw GaudiException("BinUtility", "dimension out of bounds", StatusCode::FAILURE); 
@@ -229,7 +229,7 @@ namespace Trk {
         }
 
         /** The type/value of the binning */
-        BinningValue binningValue(size_t ba=0) const throw (GaudiException) {
+        BinningValue binningValue(size_t ba=0) const {
             if (ba >= m_binningData.size()) 
                 throw GaudiException("BinUtility", "dimension out of bounds", StatusCode::FAILURE); 
             return (m_binningData[ba].binvalue);
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray.h
index d6efca8aaa5..5e2b590d0ec 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray.h
@@ -33,8 +33,7 @@ namespace Trk {
 
     public:
      /**Default Constructor - needed for inherited classes */
-     BinnedArray() throw (GaudiException)
-      {}
+     BinnedArray() {}
 
      /**Virtual Destructor*/
      virtual ~BinnedArray(){}
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D.h
index 7f085296aba..ecb342630fd 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D.h
@@ -32,7 +32,7 @@ namespace Trk {
 
     public:
      /**Default Constructor - needed for inherited classes */
-     BinnedArray1D() throw (GaudiException):
+     BinnedArray1D():
       BinnedArray<T>(),
       m_array(0),
       m_arrayObjects(0),
@@ -41,7 +41,7 @@ namespace Trk {
      /**Constructor with std::vector and a  BinUtility - reference counted, will delete objects at the end,
         if this deletion should be turned off, the boolean deletion should be switched to false
         the global position is given by object */
-     BinnedArray1D(const std::vector< std::pair< SharedObject<const T>, Amg::Vector3D > >& tclassvector, BinUtility* bingen) throw (GaudiException) :
+     BinnedArray1D(const std::vector< std::pair< SharedObject<const T>, Amg::Vector3D > >& tclassvector, BinUtility* bingen) :
       BinnedArray<T>(),
       m_array(0),
       m_arrayObjects(0),
@@ -62,7 +62,7 @@ namespace Trk {
      }
 
      /**Copy Constructor - copies only pointers !*/
-     BinnedArray1D(const BinnedArray1D& barr) throw (GaudiException) :
+     BinnedArray1D(const BinnedArray1D& barr) :
       BinnedArray<T>(),
       m_array(0),
       m_arrayObjects(0),
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D.h
index 61049ba7cd3..7248f70a01e 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D.h
@@ -34,7 +34,7 @@ namespace Trk {
 
     public:
       /** Default Constructor - needed for inherited classes */
-      BinnedArray1D1D() throw (GaudiException)
+      BinnedArray1D1D()
       : BinnedArray<T>(),
         m_array(0),
         m_arrayObjects(0),
@@ -47,7 +47,7 @@ namespace Trk {
           the global position is given by object! */
       BinnedArray1D1D(const std::vector< std::pair< SharedObject<const T>, Amg::Vector3D > >& tclassvector,
                      BinUtility* steeringBinGen1D,
-                     std::vector<BinUtility*>* singleBinGen) throw (GaudiException)
+                     std::vector<BinUtility*>* singleBinGen)
       : BinnedArray<T>(),
         m_array(0),
         m_arrayObjects(0),
@@ -79,7 +79,7 @@ namespace Trk {
       }
 
       /** Copy Constructor - copies only pointers! */
-      BinnedArray1D1D(const BinnedArray1D1D& barr) throw (GaudiException)
+      BinnedArray1D1D(const BinnedArray1D1D& barr)
       : BinnedArray<T>(),
         m_array(0),
         m_arrayObjects(0),
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D1D.h
index 68d3dbe21d0..c0c0c488ec1 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D1D.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D1D.h
@@ -92,7 +92,7 @@ namespace Trk {
       }
 
       /** Copy Constructor - copies only pointers! */
-      BinnedArray1D1D1D(const BinnedArray1D1D1D& barr) throw (GaudiException)
+      BinnedArray1D1D1D(const BinnedArray1D1D1D& barr)
       : BinnedArray<T>(),
         m_array(0),
         m_arrayObjects(0),
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray2D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray2D.h
index 3f3bca3eecd..41cca920dc3 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray2D.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray2D.h
@@ -35,7 +35,7 @@ namespace Trk {
 
     public:
      /**Default Constructor - needed for inherited classes */
-     BinnedArray2D() throw (GaudiException) :
+     BinnedArray2D() :
       BinnedArray<T>(),
       m_array(0),
       m_arrayObjects(0),
@@ -45,7 +45,7 @@ namespace Trk {
      /**Constructor with std::vector and a BinUtility - reference counted, will delete objects at the end,
         if this deletion should be turned off, the boolean deletion should be switched to false
         the global position is given by object! */
-     BinnedArray2D(const std::vector< std::pair< SharedObject<const T>, Amg::Vector3D > >& tclassvector, BinUtility* bingen)  throw (GaudiException) :
+     BinnedArray2D(const std::vector< std::pair< SharedObject<const T>, Amg::Vector3D > >& tclassvector, BinUtility* bingen) :
       BinnedArray<T>(),
       m_array(0),
       m_arrayObjects(0),
@@ -72,7 +72,7 @@ namespace Trk {
       }
 
      /**Copy Constructor - copies only pointers !*/
-     BinnedArray2D(const BinnedArray2D& barr) throw (GaudiException) :
+     BinnedArray2D(const BinnedArray2D& barr) :
       BinnedArray<T>(),
       m_array(0),
       m_arrayObjects(0),
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArrayArray.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArrayArray.h
index 7930ec9ae6f..8644e6f4bb5 100644
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArrayArray.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArrayArray.h
@@ -36,7 +36,7 @@ namespace Trk {
     public:
      
      /**Default Constructor  */
-     BinnedArrayArray( const std::vector< std::pair< BinnedArray<T>* , Amg::Vector3D > >& tbas, BinUtility* bUtility ) throw (GaudiException) :
+     BinnedArrayArray( const std::vector< std::pair< BinnedArray<T>* , Amg::Vector3D > >& tbas, BinUtility* bUtility ) :
          m_binUtility(bUtility),
          m_binnedArrays(bUtility->bins(0), NULL),
          m_arrayObjects()
@@ -55,7 +55,7 @@ namespace Trk {
       }
     
      /** Copy Constructor */
-     BinnedArrayArray(const BinnedArrayArray& baa ) throw (GaudiException) :
+     BinnedArrayArray(const BinnedArrayArray& baa ) :
          m_binUtility(baa.m_binUtility->clone()),
          m_arrayObjects(baa.m_arrayObjects)
       { copyBinnedArrays( baa.m_binnedArrays ); }
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray.h
index 1bbf1d5cc51..d354df8c2d8 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray.h
@@ -30,7 +30,7 @@ namespace Trk {
 
   public:
     /**Default Constructor - needed for inherited classes */
-    CompactBinnedArray() throw (GaudiException):
+    CompactBinnedArray():
     BinnedArray<T>()
       {}
     
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray1D.h
index eb0a48b04bf..854b9f4a453 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray1D.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray1D.h
@@ -31,12 +31,12 @@ namespace Trk {
 
   public:
     /**Default Constructor - needed for inherited classes */
-    CompactBinnedArray1D() throw (GaudiException):
+    CompactBinnedArray1D():
     CompactBinnedArray<T>(),
       m_binUtility(0){}
     
     /**Constructor with std::vector and a BinUtility */
-    CompactBinnedArray1D(const std::vector< const T*>& tclassvector, const std::vector<size_t>& indexvector,  BinUtility* bingen) throw (GaudiException) :
+    CompactBinnedArray1D(const std::vector< const T*>& tclassvector, const std::vector<size_t>& indexvector,  BinUtility* bingen) :
       CompactBinnedArray<T>(),
       m_array(indexvector),
       m_arrayObjects(tclassvector),
@@ -53,7 +53,7 @@ namespace Trk {
       }
 
      /**Copy Constructor - copies only pointers !*/
-     CompactBinnedArray1D(const CompactBinnedArray1D& barr) throw (GaudiException) :
+     CompactBinnedArray1D(const CompactBinnedArray1D& barr) :
       CompactBinnedArray<T>(),
       m_binUtility(0)
       {
diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray2D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray2D.h
index 9c2451ad98c..feb0ea5ee0d 100755
--- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray2D.h
+++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray2D.h
@@ -30,13 +30,13 @@ namespace Trk {
 
   public:
     /**Default Constructor - needed for inherited classes */
-    CompactBinnedArray2D() throw (GaudiException):
+    CompactBinnedArray2D():
     CompactBinnedArray<T>(),
       m_binUtility(0){}
     
     /**Constructor with std::vector and a BinUtility */
     CompactBinnedArray2D(const std::vector< const T*>& tclassvector, const std::vector<std::vector<size_t> >& indexarray,
-			 const BinUtility* bingen,  const std::vector< Trk::BinUtility*>& bVec) throw (GaudiException) :
+			 const BinUtility* bingen,  const std::vector< Trk::BinUtility*>& bVec) :
       CompactBinnedArray<T>(),
       m_array(indexarray),
       m_arrayObjects(tclassvector),
@@ -59,7 +59,7 @@ namespace Trk {
       }
   
       /**Copy Constructor - copies only pointers !*/
-      CompactBinnedArray2D(const CompactBinnedArray2D& barr) throw (GaudiException) :
+      CompactBinnedArray2D(const CompactBinnedArray2D& barr) :
       CompactBinnedArray<T>(),
       m_array(),
       m_arrayObjects(),
diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MagneticFieldProperties.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MagneticFieldProperties.h
index 29e4a0da26c..76ca21aac86 100755
--- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MagneticFieldProperties.h
+++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MagneticFieldProperties.h
@@ -53,7 +53,7 @@ namespace Trk {
       MagneticFieldMode magneticFieldMode() const;
             
       /** Get the magnetic field - in case of constant field only - throws exception if mode is not constant */
-      const Amg::Vector3D& magneticField() const throw (GaudiException);
+      const Amg::Vector3D& magneticField() const;
 
     protected:
       mutable MagneticFieldMode              m_magneticFieldMode;
@@ -65,7 +65,7 @@ namespace Trk {
 
   inline MagneticFieldMode MagneticFieldProperties::magneticFieldMode() const { return m_magneticFieldMode; }  
   
-  inline const Amg::Vector3D& MagneticFieldProperties::magneticField() const throw (GaudiException) { 
+  inline const Amg::Vector3D& MagneticFieldProperties::magneticField() const { 
       if ( m_magneticFieldMode != Trk::ConstantField ) 
           throw GaudiException("Trk::MagneticFieldProperties", "You can only ask for a field value if you have a constant field!", StatusCode::FAILURE);
       return m_magneticField;
diff --git a/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawDataCollection.h b/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawDataCollection.h
index fc82a3de805..a9f0f432088 100755
--- a/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawDataCollection.h
+++ b/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawDataCollection.h
@@ -33,7 +33,7 @@ namespace Trk{
 class PrepRawDataCollectionCopyConstructorCalled{};
 
 template< class PrepRawDataT >
-class PrepRawDataCollection : public DataVector< PrepRawDataT > {
+class PrepRawDataCollection :  public Identifiable, public DataVector< PrepRawDataT > {
 
 	///////////////////////////////////////////////////////////////////
 	// Public methods:
@@ -56,11 +56,11 @@ class PrepRawDataCollection : public DataVector< PrepRawDataT > {
 	///////////////////////////////////////////////////////////////////
 	
 	// identifier of this detector element:
-	virtual Identifier identify() const;
+	virtual Identifier identify() const override final;
 
-	virtual IdentifierHash identifyHash() const;
+	virtual IdentifierHash identifyHash() const override final;
 
-	virtual void setIdentifier(Identifier id);	
+	void setIdentifier(Identifier id);	
 
 	// plottable
 	virtual std::string type() const;
diff --git a/Tracking/TrkEvent/TrkRIO_OnTrack/TrkRIO_OnTrack/RIO_OnTrack.h b/Tracking/TrkEvent/TrkRIO_OnTrack/TrkRIO_OnTrack/RIO_OnTrack.h
index b85501c9616..1ecace0b9d4 100755
--- a/Tracking/TrkEvent/TrkRIO_OnTrack/TrkRIO_OnTrack/RIO_OnTrack.h
+++ b/Tracking/TrkEvent/TrkRIO_OnTrack/TrkRIO_OnTrack/RIO_OnTrack.h
@@ -102,7 +102,7 @@ namespace Trk {
     
        /** return the identifier
       -extends MeasurementBase */
-      virtual Identifier identify() const;              
+      virtual Identifier identify() const final;
 
       /**return number of parameters currently created*/
       static unsigned int numberOfInstantiations() ;
diff --git a/Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePointCollection.h b/Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePointCollection.h
index d03d74a0998..4248f77d842 100755
--- a/Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePointCollection.h
+++ b/Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePointCollection.h
@@ -23,6 +23,7 @@
 
 // Base classes
 #include "Identifier/Identifier.h"
+#include "Identifier/Identifiable.h"
 #include "Identifier/IdentifierHash.h"
 #include "DataModel/DataVector.h"
 #include "GaudiKernel/DataObject.h"
@@ -34,7 +35,7 @@ class SpacePointCollectionCopyConstructorCalled{};
 
 
 class SpacePointCollection 
-	: 
+	: public Identifiable,
 	public DataVector< Trk::SpacePoint >
 {
 	///////////////////////////////////////////////////////////////////
@@ -56,11 +57,11 @@ class SpacePointCollection
 	// Const methods:
 	///////////////////////////////////////////////////////////////////
 
-	virtual Identifier identify() const;
+	virtual Identifier identify() const override final;
 	
-	virtual IdentifierHash identifyHash() const;
+	virtual IdentifierHash identifyHash() const override final;
 	
-	virtual void setIdentifier(Identifier id);
+	void setIdentifier(Identifier id);
 
 	virtual std::string type() const;
 	
diff --git a/Tracking/TrkEvent/TrkVertexOnTrack/TrkVertexOnTrack/VertexOnTrack.h b/Tracking/TrkEvent/TrkVertexOnTrack/TrkVertexOnTrack/VertexOnTrack.h
index 75276675f98..625b4bd4840 100755
--- a/Tracking/TrkEvent/TrkVertexOnTrack/TrkVertexOnTrack/VertexOnTrack.h
+++ b/Tracking/TrkEvent/TrkVertexOnTrack/TrkVertexOnTrack/VertexOnTrack.h
@@ -59,7 +59,7 @@ namespace Trk{
                      SurfaceUniquePtrT<const PerigeeSurface> assocSurf);
 
       /** Constructor from: RedVertex, Perigee - the perigee is needed for the measurement frame */
-      VertexOnTrack( const Trk::RecVertex& rvertex, const Trk::Perigee& mperigee) throw (GaudiException);
+      VertexOnTrack( const Trk::RecVertex& rvertex, const Trk::Perigee& mperigee);
 
       /** Destructor */
       virtual ~VertexOnTrack();
diff --git a/Tracking/TrkEvent/TrkVertexOnTrack/src/VertexOnTrack.cxx b/Tracking/TrkEvent/TrkVertexOnTrack/src/VertexOnTrack.cxx
index d457b328892..0e9ebee53b6 100755
--- a/Tracking/TrkEvent/TrkVertexOnTrack/src/VertexOnTrack.cxx
+++ b/Tracking/TrkEvent/TrkVertexOnTrack/src/VertexOnTrack.cxx
@@ -39,7 +39,7 @@ Trk::VertexOnTrack::VertexOnTrack( const LocalParameters& locpars,
 
 // Constructor with parameters:
 Trk::VertexOnTrack::VertexOnTrack( const Trk::RecVertex& rvertex,
-                                   const Trk::Perigee& perigee ) throw (GaudiException) :
+                                   const Trk::Perigee& perigee ) :
   Trk::MeasurementBase(),
   m_associatedSurface(perigee.associatedSurface().clone()),
   m_globalPosition(new Amg::Vector3D(perigee.position()))
diff --git a/Tracking/TrkEventCnv/TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx b/Tracking/TrkEventCnv/TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx
index daabb8ad3d7..2764ee06a3f 100644
--- a/Tracking/TrkEventCnv/TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx
+++ b/Tracking/TrkEventCnv/TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx
@@ -92,9 +92,9 @@ class TestElement
 {
 public:
   TestElement (unsigned int val);
-  virtual Identifier identify() const override;
+  virtual Identifier identify() const override final;
     
-  virtual IdentifierHash identifyHash() const override
+  virtual IdentifierHash identifyHash() const override final
   { std::abort(); }
   virtual const Amg::Transform3D & transform() const override
   { std::abort(); }
diff --git a/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/SegmentRetriever.h b/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/SegmentRetriever.h
index 30651bdf2ab..e3058c5b504 100644
--- a/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/SegmentRetriever.h
+++ b/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/SegmentRetriever.h
@@ -36,11 +36,11 @@ namespace JiveXML {
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
   };
     
 }
diff --git a/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/TrackRetriever.h b/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/TrackRetriever.h
index eac5a6085d3..de4ef6fe5f4 100644
--- a/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/TrackRetriever.h
+++ b/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/TrackRetriever.h
@@ -70,14 +70,14 @@ namespace JiveXML{
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
       ///Default AthAlgTool methods
       StatusCode initialize();
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       //@name Property members
       //@{
diff --git a/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/VertexRetriever.h b/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/VertexRetriever.h
index 2b22ce364d7..034c0b4df2c 100644
--- a/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/VertexRetriever.h
+++ b/Tracking/TrkEventCnv/TrkJiveXML/TrkJiveXML/VertexRetriever.h
@@ -42,7 +42,7 @@ namespace JiveXML{
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
 
@@ -65,9 +65,9 @@ namespace JiveXML{
       float m_chi2Cut;
 
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
       
-      std::vector<const Trk::Perigee*> perigeeVector;
+      std::vector<const Trk::Perigee*> m_perigeeVector;
       virtual StatusCode fillPerigeeList(); 
   };
 
diff --git a/Tracking/TrkEventCnv/TrkJiveXML/src/SegmentRetriever.cxx b/Tracking/TrkEventCnv/TrkJiveXML/src/SegmentRetriever.cxx
index 9f77474de55..73cd7385470 100644
--- a/Tracking/TrkEventCnv/TrkJiveXML/src/SegmentRetriever.cxx
+++ b/Tracking/TrkEventCnv/TrkJiveXML/src/SegmentRetriever.cxx
@@ -22,7 +22,7 @@ namespace JiveXML {
    **/
   SegmentRetriever::SegmentRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("Segment"){
+    m_typeName("Segment"){
 
       //Only declare the interface
       declareInterface<IDataRetriever>(this);
@@ -103,22 +103,22 @@ namespace JiveXML {
       }
 
       //Add data to our map
-      DataMap m_DataMap;
-      m_DataMap["x"] = x;
-      m_DataMap["y"] = y;
-      m_DataMap["z"] = z;
-      m_DataMap["phi"] = phi;
-      m_DataMap["theta"] = theta;
-      m_DataMap["numHits"] = numHits;
+      DataMap DataMap;
+      DataMap["x"] = x;
+      DataMap["y"] = y;
+      DataMap["z"] = z;
+      DataMap["phi"] = phi;
+      DataMap["theta"] = theta;
+      DataMap["numHits"] = numHits;
 
       //Hits are stored as multiple with average size given in XML header
       if (NSegs > 0) {
         std::string multiple = "hits multiple=\"" + DataType( hits.size()*1./numHits.size()).toString() + "\"";
-        m_DataMap[multiple] = hits;
+        DataMap[multiple] = hits;
       }
     
       //forward data to formating tool
-      if ( FormatTool->AddToEvent(dataTypeName(), CollectionItr.key(), &m_DataMap).isFailure())
+      if ( FormatTool->AddToEvent(dataTypeName(), CollectionItr.key(), &DataMap).isFailure())
             return StatusCode::RECOVERABLE;
       
       //Be verbose
diff --git a/Tracking/TrkEventCnv/TrkJiveXML/src/TrackRetriever.cxx b/Tracking/TrkEventCnv/TrkJiveXML/src/TrackRetriever.cxx
index f8373470f37..95abf92150c 100644
--- a/Tracking/TrkEventCnv/TrkJiveXML/src/TrackRetriever.cxx
+++ b/Tracking/TrkEventCnv/TrkJiveXML/src/TrackRetriever.cxx
@@ -336,7 +336,7 @@ namespace JiveXML {
 		**/
 		TrackRetriever::TrackRetriever(const std::string& type,const std::string& name,const IInterface* parent):
 		  AthAlgTool(type,name,parent),
-		  typeName("Track"),
+		  m_typeName("Track"),
 		  m_residualPullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"),
 		  m_idHelper(nullptr) {
 				//Declare the interface
@@ -639,58 +639,58 @@ namespace JiveXML {
 			} // end loop over tracks in collection
 
 			//Now fill everything in a datamap
-			DataMap m_DataMap;
+			DataMap DataMap;
 			// Start with mandatory entries
-			m_DataMap["id"] = id;
-			m_DataMap["chi2"] = chi2;
-			m_DataMap["numDoF"] = numDoF;
-			m_DataMap["trackAuthor"] = trackAuthor;
-			m_DataMap["barcode"] = barcode;
-			m_DataMap["numHits"] = numHits;
-			m_DataMap["nBLayerHits"] = nBLayerHits;
-			m_DataMap["nPixHits"] = nPixHits;
-			m_DataMap["nSCTHits"] = nSCTHits;
-			m_DataMap["nTRTHits"] = nTRTHits;
-			m_DataMap["numPolyline"] = numPolyline;
+			DataMap["id"] = id;
+			DataMap["chi2"] = chi2;
+			DataMap["numDoF"] = numDoF;
+			DataMap["trackAuthor"] = trackAuthor;
+			DataMap["barcode"] = barcode;
+			DataMap["numHits"] = numHits;
+			DataMap["nBLayerHits"] = nBLayerHits;
+			DataMap["nPixHits"] = nPixHits;
+			DataMap["nSCTHits"] = nSCTHits;
+			DataMap["nTRTHits"] = nTRTHits;
+			DataMap["numPolyline"] = numPolyline;
 
 			// if perigee parameters are not available, leave the corresponding subtags empty.
 			// This way atlantis knows that such tracks can only be displayed as polylines.
 			if (pt.size() > 0){
-				m_DataMap["pt"] = pt;
-				m_DataMap["d0"] = d0;
-				m_DataMap["z0"] = z0;
-				m_DataMap["phi0"] = phi0;
-				m_DataMap["cotTheta"] = cotTheta;
-				m_DataMap["covMatrix multiple=\"15\""] = covMatrix;
+				DataMap["pt"] = pt;
+				DataMap["d0"] = d0;
+				DataMap["z0"] = z0;
+				DataMap["phi0"] = phi0;
+				DataMap["cotTheta"] = cotTheta;
+				DataMap["covMatrix multiple=\"15\""] = covMatrix;
 			}
 
 			// vectors with measurement- or TrackStateOnSurface-wise entries
 			if ( polylineX.size() > 0){
 				std::string numPolyPerTrack = DataType(polylineX.size()/((double)id.size())).toString();
-				m_DataMap["polylineX multiple=\"" + numPolyPerTrack + "\""] = polylineX;
-				m_DataMap["polylineY multiple=\"" + numPolyPerTrack + "\""] = polylineY;
-				m_DataMap["polylineZ multiple=\"" + numPolyPerTrack + "\""] = polylineZ;
+				DataMap["polylineX multiple=\"" + numPolyPerTrack + "\""] = polylineX;
+				DataMap["polylineY multiple=\"" + numPolyPerTrack + "\""] = polylineY;
+				DataMap["polylineZ multiple=\"" + numPolyPerTrack + "\""] = polylineZ;
 			}
 
 			if ( hits.size() > 0){
 				std::string numHitsPerTrack = DataType(hits.size()/((double)id.size())).toString();
-				m_DataMap["hits multiple=\"" + numHitsPerTrack + "\""] = hits;
-				m_DataMap["isOutlier multiple=\""+numHitsPerTrack+"\""] = isOutlier;
-				m_DataMap["driftSign multiple=\""+numHitsPerTrack+"\""] = driftSign;
+				DataMap["hits multiple=\"" + numHitsPerTrack + "\""] = hits;
+				DataMap["isOutlier multiple=\""+numHitsPerTrack+"\""] = isOutlier;
+				DataMap["driftSign multiple=\""+numHitsPerTrack+"\""] = driftSign;
 
 				if (m_doWriteResiduals){
 					// hits counter in principle not needed anymore:
-					m_DataMap["numTsos"] = numHits;
-					m_DataMap["tsosResLoc1 multiple=\""+numHitsPerTrack+"\""] = tsosResLoc1;
-					m_DataMap["tsosResLoc2 multiple=\""+numHitsPerTrack+"\""] = tsosResLoc2;
-					m_DataMap["tsosPullLoc1 multiple=\""+numHitsPerTrack+"\""] = tsosPullLoc1;
-					m_DataMap["tsosPullLoc2 multiple=\""+numHitsPerTrack+"\""] = tsosPullLoc2;
-					m_DataMap["tsosDetType multiple=\""+numHitsPerTrack+"\""] = tsosDetType;
+					DataMap["numTsos"] = numHits;
+					DataMap["tsosResLoc1 multiple=\""+numHitsPerTrack+"\""] = tsosResLoc1;
+					DataMap["tsosResLoc2 multiple=\""+numHitsPerTrack+"\""] = tsosResLoc2;
+					DataMap["tsosPullLoc1 multiple=\""+numHitsPerTrack+"\""] = tsosPullLoc1;
+					DataMap["tsosPullLoc2 multiple=\""+numHitsPerTrack+"\""] = tsosPullLoc2;
+					DataMap["tsosDetType multiple=\""+numHitsPerTrack+"\""] = tsosDetType;
 				}
 			}
 
 			//forward data to formating tool
-			if ( FormatTool->AddToEvent(dataTypeName(), collectionName, &m_DataMap).isFailure())
+			if ( FormatTool->AddToEvent(dataTypeName(), collectionName, &DataMap).isFailure())
 			  return StatusCode::RECOVERABLE;
 
 			//Be verbose
diff --git a/Tracking/TrkEventCnv/TrkJiveXML/src/VertexRetriever.cxx b/Tracking/TrkEventCnv/TrkJiveXML/src/VertexRetriever.cxx
index b31f20bea2c..2775996d20f 100644
--- a/Tracking/TrkEventCnv/TrkJiveXML/src/VertexRetriever.cxx
+++ b/Tracking/TrkEventCnv/TrkJiveXML/src/VertexRetriever.cxx
@@ -36,7 +36,7 @@ namespace JiveXML {
    **/
   VertexRetriever::VertexRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("RVx"){
+    m_typeName("RVx"){
 
     //Declare the interface
     declareInterface<IDataRetriever>(this);
@@ -105,7 +105,7 @@ namespace JiveXML {
     std::string searchStr = "TrackParticle";
     found=m_trackCollection.find(searchStr);
 
-    perigeeVector.clear(); // need to clear, otherwise accumulates over events
+    m_perigeeVector.clear(); // need to clear, otherwise accumulates over events
     if (found!=std::string::npos){ // User selected a Rec::TrackParticle Collection
       if (evtStore()->retrieve(tracks, m_trackCollection).isFailure()){
         if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to retrieve track collection"
@@ -118,7 +118,7 @@ namespace JiveXML {
          for(track=tracks->begin();track!=tracks->end();++track) {
 	    const Trk::Perigee *perigee = (*track)->perigee();
 //          if(perigee == 0) continue; // not skip ! need to keep order for index !
-            perigeeVector.push_back( perigee ); // this perigee match works !
+            m_perigeeVector.push_back( perigee ); // this perigee match works !
          }
       }
     }else{ // it's a Trk::Tracks collection
@@ -135,8 +135,8 @@ namespace JiveXML {
           const Trk::Perigee* trackPerigee = (*track)->perigeeParameters();
           //const Trk::Perigee *perigee = dynamic_cast<const Trk::Perigee*>( trackPerigee );
 //          if(perigee == 0) continue; // not skip ! need to keep order for index !
-//          perigeeVector.push_back( perigee ); 
-          perigeeVector.push_back( trackPerigee ); 
+//          m_perigeeVector.push_back( perigee ); 
+          m_perigeeVector.push_back( trackPerigee ); 
         }
       }
     }
@@ -187,8 +187,6 @@ namespace JiveXML {
     DataVect tracks;
     DataVect vertexType; 
 
-    float m_chi2 = 0.;
-
     //Loop over all vertex containers
     for ( ; vtxCollectionItr != vtxCollectionsEnd; ++vtxCollectionItr ) {
 
@@ -218,7 +216,7 @@ namespace JiveXML {
 
       StatusCode sc = fillPerigeeList();
       if (!sc.isFailure()) {
-         if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Perigee list filled with " << perigeeVector.size()
+         if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Perigee list filled with " << m_perigeeVector.size()
                           << " entries " << endmsg;
       }    
 
@@ -239,28 +237,27 @@ namespace JiveXML {
         Trk::FitQuality fitQuality = (*vertexItr)->recVertex().fitQuality();
 
         //degrees of freedom might be zero - beware
+        float this_chi2 = -1;
         if ( fitQuality.doubleNumberDoF() != 0 ){
-          m_chi2 = fitQuality.chiSquared()/fitQuality.doubleNumberDoF();
-        }else{
-          m_chi2 = -1.;
+          this_chi2 = fitQuality.chiSquared()/fitQuality.doubleNumberDoF();
         }
         //Cut: on Chi^2 over NumberOfDegreesOfFreedom only for ConversionCandidate 
-        if ( m_chi2 > m_chi2Cut && ( vtxCollectionItr.key() == m_conversionVertexKey  )) continue;
+        if ( this_chi2 > m_chi2Cut && ( vtxCollectionItr.key() == m_conversionVertexKey  )) continue;
 
-        float m_x =  (*vertexItr)->recVertex().position().x()/10.; //Atlantis units are cm
-        float m_y =  (*vertexItr)->recVertex().position().y()/10.;
-        float m_z =  (*vertexItr)->recVertex().position().z()/10.;
-        float R = sqrt( pow(m_x,2) + pow(m_y,2) ); // distance from beamline
+        float this_x =  (*vertexItr)->recVertex().position().x()/10.; //Atlantis units are cm
+        float this_y =  (*vertexItr)->recVertex().position().y()/10.;
+        float this_z =  (*vertexItr)->recVertex().position().z()/10.;
+        float R = std::hypot (this_x, this_y); // distance from beamline
 
         if (msgLvl(MSG::DEBUG)){ msg(MSG::DEBUG) << " Collection: " << vtxCollectionItr.key() 
-            << ", m_chi2: " << m_chi2 << " - chi2: " << fitQuality.chiSquared() 
+            << ", this_chi2: " << this_chi2 << " - chi2: " << fitQuality.chiSquared() 
 //            << " ," << (*vertexItr)->recVertex().position().x()/10. << " ," << (*vertexItr)->recVertex().position().x()*CLHEP::cm 
             << ", R: " << R << endmsg; }
 
-        chi2.push_back(DataType( m_chi2 ));
-        x.push_back(DataType( m_x ));
-        y.push_back(DataType( m_y ));
-        z.push_back(DataType( m_z ));
+        chi2.push_back(DataType( this_chi2 ));
+        x.push_back(DataType( this_x ));
+        y.push_back(DataType( this_y ));
+        z.push_back(DataType( this_z ));
 
         // from: Tracking/TrkEvent/TrkEventPrimitives/VertexType.h
 	const Trk::VertexType vtx_type = (*vertexItr)->vertexType();
@@ -299,7 +296,7 @@ namespace JiveXML {
 //---- association from:
 //---- from http://alxr.usatlas.bnl.gov/lxr/source/atlas/Reconstruction/tauRec/src/PhotonConversionPID.cxx
 
-    std::vector<Trk::VxTrackAtVertex*>* trklist = (*vertexItr)->vxTrackAtVertex();
+    const std::vector<Trk::VxTrackAtVertex*>* trklist = (*vertexItr)->vxTrackAtVertex();
 
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Tracks at vertex: " << trklist->size() << endmsg;
 
diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx
index edbf0f447fd..7437282e03a 100755
--- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx
+++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx
@@ -1027,7 +1027,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::makeTrack(const Trk::ParticleHypo
             if (msgLvl(MSG::VERBOSE) && trkState->measurementOnTrack()) {
                 msg(MSG::VERBOSE) << "TrackStateOnSurface: measurement: " << trkState->measurementOnTrack();
                 const CompetingRIOsOnTrack* compRot = dynamic_cast<const CompetingRIOsOnTrack*> (trkState->measurementOnTrack());
-                if (compRot) ATH_MSG_VERBOSE( " compROT maxProb=" << compRot->assignmentProbability(compRot->indexOfMaxAssignProb()) << " on surface " << &(compROT->associatedSurface()));
+                if (compRot) ATH_MSG_VERBOSE( " compRot maxProb=" << compRot->assignmentProbability(compRot->indexOfMaxAssignProb()) << " on surface " << &(compRot->associatedSurface()));
                 else ATH_MSG_VERBOSE( " on surface " << &(trkState->measurementOnTrack()->associatedSurface()));
             }
              finalTrajectory->push_back( trkState );
diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx
index 50efaa22e2b..f8c16e96ac6 100644
--- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx
+++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx
@@ -1093,7 +1093,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::overlapppingTracks()
     if (msgLvl(MSG::VERBOSE)) {
       TString tracks("---- number of tracks with this shared Prd: ");
       tracks += numberOfTracksWithThisPrd;
-      for (Trk::IPRD_AssociationTool::PRD_MapIt it =range.first; it != range.second;++it ){
+      for (Trk::IPRD_AssociationTool::ConstPRD_MapIt it =range.first; it != range.second;++it ){
        tracks += "    ";
        tracks += Form( " %p",(void*)(it->second)); 
       }
@@ -1130,7 +1130,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::overlapppingTracks()
     if (msgLvl(MSG::VERBOSE)) {
       TString tracks("---- number of tracks with this shared Prd: ");
       tracks += numberOfTracksWithThisPrd;
-      for (Trk::IPRD_AssociationTool::PRD_MapIt it =range.first; it != range.second;++it ){
+      for (Trk::IPRD_AssociationTool::ConstPRD_MapIt it =range.first; it != range.second;++it ){
        tracks += "    ";
        tracks += Form( " %p",(void*)(it->second)); 
       }
diff --git a/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRD_AssociationTool.h b/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRD_AssociationTool.h
index 5e0be28f8ac..b219380755b 100755
--- a/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRD_AssociationTool.h
+++ b/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRD_AssociationTool.h
@@ -68,7 +68,7 @@ namespace Trk {
     IMPORTANT: Please use the typedefs IPRD_AssociationTool::PrepRawDataRange and 
     IPRD_AssociationTool::ConstPRD_MapIt (defined in the interface) to access the 
     tracks, as the way the data is stored internally may change.*/
-    virtual IPRD_AssociationTool::PrepRawDataTrackMapRange onTracks(const PrepRawData& prd) ;
+    virtual IPRD_AssociationTool::PrepRawDataTrackMapRange onTracks(const PrepRawData& prd) const;
 
       /** resets the tool - should be called before using tool (and maybe afterwards to free up 
     memory)*/
diff --git a/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx b/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx
index 27fd62672f1..589ecc66aa0 100755
--- a/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx
+++ b/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx
@@ -107,8 +107,8 @@ StatusCode Trk::PRD_AssociationTool::removePRDs( const Trk::Track& track )
         range = m_prepRawDataTrackMap.equal_range(prd);
 
     // get iterators for range
-    PRD_MapIt mapIt    = range.first;
-    PRD_MapIt mapItEnd = range.second;
+    ConstPRD_MapIt mapIt    = range.first;
+    ConstPRD_MapIt mapItEnd = range.second;
 
 // FIXME - doesn't compile. Out of time -  come back to it later
 // 		remove_if(
@@ -212,7 +212,7 @@ std::vector< const Trk::PrepRawData* > Trk::PRD_AssociationTool::getPrdsOnTrack(
 }
 
 Trk::IPRD_AssociationTool::PrepRawDataTrackMapRange 
-    Trk::PRD_AssociationTool::onTracks(const PrepRawData& prd) 
+    Trk::PRD_AssociationTool::onTracks(const PrepRawData& prd) const
 {
 //	std::pair<IPRD_AssociationTool::PRD_MapIt, IPRD_AssociationTool::PRD_MapIt>       range = 
   return m_prepRawDataTrackMap.equal_range(&prd);
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPRD_AssociationTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPRD_AssociationTool.h
index f0c1844ed8f..a16d8ac1ae7 100755
--- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPRD_AssociationTool.h
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPRD_AssociationTool.h
@@ -41,7 +41,7 @@ The user is responsible for informing the tool about the Tracks in question, by
       typedef PrepRawDataTrackMap::iterator                        PRD_MapIt;
       typedef PrepRawDataTrackMap::const_iterator                  ConstPRD_MapIt;
       /**the first element is the beginning iterator of the range, the second is the end*/
-      typedef std::pair<PRD_MapIt, PRD_MapIt>       PrepRawDataTrackMapRange;
+      typedef std::pair<ConstPRD_MapIt, ConstPRD_MapIt>       PrepRawDataTrackMapRange;
 
       //      typedef std::multimap<const Track*, const PrepRawData*> TrackPrepRawDataMap;
       typedef std::map<const Track*, std::vector<const PrepRawData*> > TrackPrepRawDataMap;
@@ -93,7 +93,7 @@ The user is responsible for informing the tool about the Tracks in question, by
       IMPORTANT: Please use the typedefs IPRD_AssociationTool::PrepRawDataTrackMapRange and 
       IPRD_AssociationTool::ConstPRD_MapIt to access the tracks, as the internal 
       representation may change.*/
-      virtual PrepRawDataTrackMapRange onTracks(const PrepRawData& prd)  =0 ;
+      virtual PrepRawDataTrackMapRange onTracks(const PrepRawData& prd) const=0 ;
 
       /**this may well go, but at the moment it resets the tool*/
       virtual void reset()=0;
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITRT_ElectronPidTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITRT_ElectronPidTool.h
index 1d8aa5814c3..12091989f1e 100644
--- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITRT_ElectronPidTool.h
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITRT_ElectronPidTool.h
@@ -41,8 +41,8 @@ namespace Trk {
     /** @brief return high threshold probability 
         @returns double of probability
     */
-    virtual double probHT( const double p, const Trk::ParticleHypothesis hypothesis, const int HitPart, const int Layer, const int Strawlayer) = 0;
-    virtual double probHTRun2( float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy ) = 0;
+    virtual double probHT( const double p, const Trk::ParticleHypothesis hypothesis, const int HitPart, const int Layer, const int Strawlayer) const = 0;
+    virtual double probHTRun2( float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy ) const = 0;
 
 
 
diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx b/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx
index d14a2455ae8..8ce706412fe 100644
--- a/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx
+++ b/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx
@@ -172,7 +172,7 @@ StatusCode Trk::TruthTrackCreation::execute()
     
     // If configured : update the track summary
     if (!m_trackSummaryTool.empty()) {
-        TrackCollection::const_iterator rf,rfe=outputTrackCollection->end();
+        TrackCollection::iterator rf,rfe=outputTrackCollection->end();
         for (rf=outputTrackCollection->begin();rf!=rfe; ++rf) {
             ATH_MSG_VERBOSE("Updating the TrackSummary with shared hits.");
             m_trackSummaryTool->updateTrack(**rf);
diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrkObserverTool.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrkObserverTool.h
index 6d267572a3d..751d6b973d6 100644
--- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrkObserverTool.h
+++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrkObserverTool.h
@@ -42,8 +42,8 @@ namespace Trk {
 
 			virtual void updateTrackMap(const Trk::Track& track, double score, int rejectPlace) = 0;
 			virtual void updateScore(const Trk::Track& track, double score) = 0;
-			virtual void updateHolesSharedHits(const Trk::Track& track, int numPixelHoles, int numSCTHoles, int numSplitSharedPixel, int numSplitSharedSCT, int numSharedOrSplit, int numSharedOrSplitPixels, int numShared) = 0;
-			virtual void rejectTrack(const Trk::Track& track, int rejectPlace) = 0;
+			virtual void updateHolesSharedHits(const Trk::Track& track, int numPixelHoles, int numSCTHoles, int numSplitSharedPixel, int numSplitSharedSCT, int numSharedOrSplit, int numSharedOrSplitPixels, int numShared) const = 0;
+			virtual void rejectTrack(const Trk::Track& track, int rejectPlace) const = 0;
 
 			virtual void addSubTrack(const Trk::Track& track, const Trk::Track& parentTrack) = 0;
 			virtual void reset() = 0;
diff --git a/Tracking/TrkValidation/TrkValTools/TrkValTools/TrkObserverTool.h b/Tracking/TrkValidation/TrkValTools/TrkValTools/TrkObserverTool.h
index 6190936f42e..2bb6edf0927 100644
--- a/Tracking/TrkValidation/TrkValTools/TrkValTools/TrkObserverTool.h
+++ b/Tracking/TrkValidation/TrkValTools/TrkValTools/TrkObserverTool.h
@@ -70,8 +70,8 @@ namespace Trk {
 
 		void updateTrackMap(const Trk::Track& track, double score, int rejectPlace);
 		void updateScore(const Trk::Track& track, double score);
-		void updateHolesSharedHits(const Trk::Track& track, int numPixelHoles, int numSCTHoles, int numSplitSharedPixel, int numSplitSharedSCT, int numSharedOrSplit, int numSharedOrSplitPixels, int numShared);
-		void rejectTrack(const Trk::Track& track, int rejectPlace);
+		void updateHolesSharedHits(const Trk::Track& track, int numPixelHoles, int numSCTHoles, int numSplitSharedPixel, int numSplitSharedSCT, int numSharedOrSplit, int numSharedOrSplitPixels, int numShared) const;
+		void rejectTrack(const Trk::Track& track, int rejectPlace) const;
 
 		void addSubTrack(const Trk::Track& track, const Trk::Track& parentTrack);
 		void storeInputTracks(const TrackCollection& trackCollection);
diff --git a/Tracking/TrkValidation/TrkValTools/src/TrkObserverTool.cxx b/Tracking/TrkValidation/TrkValTools/src/TrkObserverTool.cxx
index dac5da5b9e8..befd7af659f 100644
--- a/Tracking/TrkValidation/TrkValTools/src/TrkObserverTool.cxx
+++ b/Tracking/TrkValidation/TrkValTools/src/TrkObserverTool.cxx
@@ -232,7 +232,7 @@ void Trk::TrkObserverTool::updateScore(const Trk::Track& track, double score) {
 	}
 }
 
-void Trk::TrkObserverTool::updateHolesSharedHits(const Trk::Track& track, int numPixelHoles, int numSCTHoles, int numSplitSharedPixel, int numSplitSharedSCT, int numSharedOrSplit, int numSharedOrSplitPixels, int numShared) {
+void Trk::TrkObserverTool::updateHolesSharedHits(const Trk::Track& track, int numPixelHoles, int numSCTHoles, int numSplitSharedPixel, int numSplitSharedSCT, int numSharedOrSplit, int numSharedOrSplitPixels, int numShared) const {
 	auto it_range = m_observedTrkMap->equal_range(&track);		// because same address is used multiple times we have to search by range
 
 	if (it_range.first == it_range.second) {
@@ -252,7 +252,7 @@ void Trk::TrkObserverTool::updateHolesSharedHits(const Trk::Track& track, int nu
 	}
 }
 
-void Trk::TrkObserverTool::rejectTrack(const Trk::Track& track, int rejectPlace) {
+void Trk::TrkObserverTool::rejectTrack(const Trk::Track& track, int rejectPlace) const {
 	auto it_range = m_observedTrkMap->equal_range(&track);		// because same address is used multiple times we have to search by range
 
 	if (it_range.first == it_range.second) {
diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/FullCaloCellContMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/FullCaloCellContMaker.cxx
index 52801c85248..44151c696ce 100755
--- a/Trigger/TrigAlgorithms/TrigCaloRec/src/FullCaloCellContMaker.cxx
+++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/FullCaloCellContMaker.cxx
@@ -323,8 +323,13 @@ StatusCode FullCaloCellContMaker::addFullDetCells(CaloCellContainer& pCaloCellCo
   } // with noise suppression
   else{
 
-    pCaloCellContainer.insert(pCaloCellContainer.end(),
-        m_icBegin,m_icEnd);
+    // FIXME: const-cast allows changing cells in SG.
+    for (CaloCellContainer::const_iterator it = m_icBegin;
+         it != m_icEnd;
+         ++it)
+    {
+      pCaloCellContainer.push_back (const_cast<CaloCell*>(*it));
+    }
   } // without noise suppression
 
   pCaloCellContainer.setHasCalo(CaloCell_ID::LAREM);
diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
index 2f979eae628..24707697c35 100644
--- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
+++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
@@ -426,6 +426,12 @@ HLT::ErrorCode TrigFastTrackFinder::hltBeginRun()
 }
 
 StatusCode TrigFastTrackFinder::execute() {
+  if (m_tcs.m_layerGeometry.empty()) {
+    HLT::ErrorCode ec = hltBeginRun();
+    if(ec != HLT::OK) {
+      return StatusCode::FAILURE;
+    }
+  }
   //RoI preparation/update 
   SG::ReadHandle<TrigRoiDescriptorCollection> roiCollection(m_roiCollectionKey);
   ATH_CHECK(roiCollection.isValid());
@@ -451,6 +457,13 @@ StatusCode TrigFastTrackFinder::execute() {
 //-------------------------------------------------------------------------
 HLT::ErrorCode TrigFastTrackFinder::hltExecute(const HLT::TriggerElement* /*inputTE*/,
     HLT::TriggerElement* outputTE) {
+
+  if (m_tcs.m_layerGeometry.empty()) {
+    HLT::ErrorCode ec = hltBeginRun();
+    if(ec != HLT::OK) {
+      return ec;
+    }
+  }
   const IRoiDescriptor* internalRoI;
   HLT::ErrorCode ec = getRoI(outputTE, internalRoI);
   if(ec != HLT::OK) {
diff --git a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.cxx b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.cxx
index 401840fffa5..cf90ef93bc0 100644
--- a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.cxx
+++ b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.cxx
@@ -197,7 +197,7 @@ HLT::ErrorCode AcceptL1TopoMonitor::hltExecute(std::vector<HLT::TEVec>& /*fake_s
             return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::MISSING_FEATURE);
         }
         // get event ID
-        EventID* eventId;
+        const EventID* eventId;
         if ( !(eventId = event->event_ID())){
             ATH_MSG_WARNING( "Could not find EventID object" );
             return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::MISSING_FEATURE);
@@ -646,7 +646,7 @@ StatusCode AcceptL1TopoMonitor::doCnvMon(bool prescalForDAQROBAccess)
             m_hasGenericDaqError = true;
         } else {
             // loop over and print RDOs
-            for (auto & rdo : *rdos){
+            for (const L1TopoRDO* rdo : *rdos){
                 ATH_MSG_VERBOSE( *rdo );
                 ATH_MSG_DEBUG( "CnvMon: Found DAQ RDO with source ID "<<L1Topo::formatHex8(rdo->getSourceID()) );
                 m_histSIDsViaConverters->Fill(m_allSIDLabelsToInts.at(rdo->getSourceID()));
diff --git a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.h b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.h
index 36c764ccf14..605b0399a9c 100644
--- a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.h
+++ b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.h
@@ -159,8 +159,6 @@ private:
     TH1F* m_histTopoHdwNotSimOverflow;
     TH1F* m_histTopoProblems;
     TH1F* m_histInputLinkCRCfromROIConv;
-    TH1F* m_histTopoSimOverfl;
-    TH1F* m_histTopoHdwOverfl;
     TH1F* m_histTopoDaqRobSimResult;
     TH1F* m_histTopoDaqRobHdwResult;
     TH1F* m_histTopoDaqRobSimNotHdwResult;
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h
index d64b0384550..54d383eb0bf 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h
@@ -99,6 +99,9 @@ namespace TrigL2MuonSA {
     ToolHandle<Muon::IMuonRdoToPrepDataTool> m_cscPrepDataProvider;
     ToolHandle<ICscClusterBuilder>           m_cscClusterProvider;
 
+    SG::ReadHandleKey<Muon::CscPrepDataContainer> m_cscPrepContainerKey{
+	this, "CSCPrepDataContainer", "CSC_Clusters", "Name of the CSCContainer to read in"};
+
     bool m_use_RoIBasedDataAccess;
   };
   
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h
index 6f000350af2..46e34ffb35d 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h
@@ -30,6 +30,8 @@
 
 #include "MuonMDT_Cabling/MuonMDT_CablingSvc.h"
 
+#include "MuonPrepRawData/MuonPrepDataContainer.h"
+
 class StoreGateSvc;
 class MdtIdHelper;
 namespace MuonGM{
@@ -151,6 +153,11 @@ namespace TrigL2MuonSA {
     // handles to data access
     ToolHandle<Muon::IMuonRdoToPrepDataTool> m_mdtPrepDataProvider;
 
+    SG::ReadHandleKey<MdtCsmContainer> m_mdtCsmContainerKey{
+	this, "MDTCSMContainer", "MDTCSM", "Name of the MDTRDO to read in"};
+    SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_mdtPrepContainerKey{
+	this, "MDTPrepDataContainer","MDT_DriftCircles", "Name of the MDTContainer to read in"};
+
     bool m_use_mdtcsm;
     bool m_use_RoIBasedDataAccess;
     bool m_BMGpresent;
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h
index 26266cea3d2..f063d66d76d 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h
@@ -199,22 +199,28 @@ class MuFastSteering : public HLT::FexAlgo,
 
   //adding a part of DataHandle for AthenaMT
   //ReadHandle MURoIs
-  SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey;
+  SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey{
+	this, "MuRoIs", "MURoIs", "Name of the input data from L1Decoder"};
 
   //ReadHandle RecMuonRoIs
-  SG::ReadHandleKey<DataVector<LVL1::RecMuonRoI>> m_recRoiCollectionKey;
+  SG::ReadHandleKey<DataVector<LVL1::RecMuonRoI>> m_recRoiCollectionKey{
+	this, "RecMuonRoI", "RecMURoIs", "Name of the input data on LVL1::RecMuonRoI produced by L1Decoder"};
 
   //WriteHandle <xAOD::L2StandAloneMuonContainer>
-  SG::WriteHandleKey<xAOD::L2StandAloneMuonContainer> m_muFastContainerKey;
+  SG::WriteHandleKey<xAOD::L2StandAloneMuonContainer> m_muFastContainerKey{
+	this, "MuFastDecisions", "MuFastAlg_MuonData", "Name of the output data on xAOD::L2StandAloneMuonContainer"};
 
   //WriteHandle <xAOD::L2StandAloneMuonContainer>
-  SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_muCompositeContainerKey;
+  SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_muCompositeContainerKey{
+	this, "MuFastComposite", "MuFastAlg_Decisions", "Name of the decisions object attached by MuFastSteering"};
 
   //WriteHandle <TrigRoiDescriptor> for ID
-  SG::WriteHandleKey<TrigRoiDescriptorCollection> m_muIdContainerKey;
+  SG::WriteHandleKey<TrigRoiDescriptorCollection> m_muIdContainerKey{
+	this, "MuFastForID", "MuFastAlg_IdData", "Name of the output data for Inner Detector"};
 
   //WriteHandle <TrigRoiDescriptor> for MS
-  SG::WriteHandleKey<TrigRoiDescriptorCollection> m_muMsContainerKey;
+  SG::WriteHandleKey<TrigRoiDescriptorCollection> m_muMsContainerKey{
+	this, "MuFastForMS", "MuFastAlg_MsData", "Name of the output data for MS"};
 
   // Monitor system
   ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" };
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h
index a1b584d2add..c15eb8e1f78 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h
@@ -101,6 +101,9 @@ class RpcDataPreparator: public AthAlgTool
       
       ToolHandle <Muon::MuonIdHelperTool>  m_idHelperTool;  //!< Pointer to concrete tool
 
+      SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_rpcPrepContainerKey{
+	this, "RpcPrepDataContainer", "RPC_Measurements", "Neme of the RPCContainer to read in"};
+
       // Declare the keys used to access the data: one for reading and one
       // for writing.
       bool m_use_RoIBasedDataAccess;
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h
index 8e4b5b0c08f..928f01687f1 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h
@@ -24,6 +24,8 @@
 
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
 
+#include "MuonPrepRawData/MuonPrepDataContainer.h"
+
 class StoreGateSvc;
 class TgcIdHelper;
 
@@ -117,6 +119,9 @@ class TgcDataPreparator: public AthAlgTool
       // utils
       TrigL2MuonSA::RecMuonRoIUtils m_recMuonRoIUtils;
 
+      SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_tgcContainerKey{
+	this, "TGCPrepDataContainer", "TGC_Measurements", "Name of the TGCContainer to read in"};
+
       bool m_use_RoIBasedDataAccess;
 };
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx
index 7d8a9998682..159ffaddcd2 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx
@@ -133,6 +133,8 @@ StatusCode TrigL2MuonSA::CscDataPreparator::initialize()
    }
    ATH_MSG_DEBUG("Retrieved service " << serviceName);
 
+   ATH_CHECK(m_cscPrepContainerKey.initialize());
+
    // 
    return StatusCode::SUCCESS; 
 }
@@ -200,13 +202,12 @@ StatusCode TrigL2MuonSA::CscDataPreparator::prepareData(const TrigRoiDescriptor*
 
   // Get CSC container
   if( !cscHashIDs_cluster.empty() ){
-    const CscPrepDataContainer* cscPrepContainer = 0;
-    StatusCode sc = (*p_ActiveStore)->retrieve( cscPrepContainer, "CSC_Clusters" );
-    if( sc.isFailure() ){
-      ATH_MSG_ERROR(" Cannot retrieve CSC PRD Container ");
-      return sc;
-    }
-    
+    auto cscPrepContainerHandle = SG::makeHandle(m_cscPrepContainerKey);
+    const CscPrepDataContainer* cscPrepContainer = cscPrepContainerHandle.cptr();
+    if (!cscPrepContainerHandle.isValid()) {
+      ATH_MSG_ERROR("Cannot retrieve CSC PRD Container key: " << m_cscPrepContainerKey.key());
+      return StatusCode::FAILURE;
+    }    
     // Loop over collections
     CscPrepDataContainer::const_iterator it = cscPrepContainer->begin();
     CscPrepDataContainer::const_iterator it_end = cscPrepContainer->end();
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx
index 285f67819f9..9dc395084d7 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx
@@ -198,6 +198,9 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::initialize()
      }
    }
 
+   ATH_CHECK(m_mdtCsmContainerKey.initialize());
+
+   ATH_CHECK(m_mdtPrepContainerKey.initialize());
    
    // 
    return StatusCode::SUCCESS; 
@@ -349,15 +352,11 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::getMdtHits(const LVL1::RecMuonRoI*
     mdtHits_overlap.clear();
     
     // get MdtCsmContainer
-    const MdtCsmContainer* pMdtCsmContainer =
-      Muon::MuonRdoContainerAccess::retrieveMdtCsm("MDTCSM");
-    if( pMdtCsmContainer==0 ) {
-      ATH_MSG_DEBUG("MDT CSM container not registered by MuonRdoContainerManager; retrieving it from the store! ");
-      StatusCode sc = m_storeGateSvc->retrieve(pMdtCsmContainer, "MDTCSM");
-      if (sc.isFailure()) {
-	ATH_MSG_WARNING("Retrieval of MdtCsmContainer failed");
-	return sc;
-      }
+    auto mdtCsmContainerHandle = SG::makeHandle(m_mdtCsmContainerKey);
+    const MdtCsmContainer* pMdtCsmContainer = mdtCsmContainerHandle.cptr();
+    if (!mdtCsmContainerHandle.isValid()) {
+      ATH_MSG_ERROR("Retrieval of MdtCsmContainer key: " << m_mdtCsmContainerKey.key() << " failed");
+      return StatusCode::FAILURE;
     }
     
     // get IdHashes
@@ -429,7 +428,6 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::getMdtHits(const LVL1::RecMuonRoI*
    // preload ROBs
     std::vector<uint32_t> v_robIds;
     std::vector<IdentifierHash> mdtHashList;
-
     if (m_use_RoIBasedDataAccess) {
       
       ATH_MSG_DEBUG("Use RoI based data access");
@@ -960,15 +958,13 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::collectMdtHitsFromPrepData(const std
     return StatusCode::SUCCESS;
   }
   
-  const MdtPrepDataContainer* mdtPrds = 0;
-  std::string mdtKey = "MDT_DriftCircles";
-  
+  const MdtPrepDataContainer* mdtPrds;
   if (m_activeStore) {
-    if((*m_activeStore)->retrieve(mdtPrds, mdtKey).isFailure()) {
-      ATH_MSG_ERROR(" Cannot retrieve MDT PRD Container " << mdtKey);
+    auto mdtPrepContainerHandle = SG::makeHandle(m_mdtPrepContainerKey);
+    mdtPrds = mdtPrepContainerHandle.cptr();
+    if (!mdtPrepContainerHandle.isValid()) {    
+      ATH_MSG_ERROR(" Cannot retrieve MDT PRD Container " << m_mdtPrepContainerKey.key());
       return StatusCode::FAILURE;
-    } else {
-      ATH_MSG_DEBUG(" MDT PRD Container retrieved with key " << mdtKey);	 
     }
   } else {
     ATH_MSG_ERROR("Null pointer to ActiveStore");
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx
index de9cd8a0435..2926a6381c2 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx
@@ -94,14 +94,6 @@ MuFastSteering::MuFastSteering(const std::string& name, ISvcLocator* svc)
   declareProperty("RpcErrToDebugStream",m_rpcErrToDebugStream = false);
 
   declareProperty("UseEndcapInnerFromBarrel",m_use_endcapInnerFromBarrel = false);
-
-  //adding a part of DataHandle for AthenaMT
-  declareProperty("MuRoIs", m_roiCollectionKey = std::string("MURoIs"), "MuRoIs to read in"); 
-  declareProperty("RecMuonRoI", m_recRoiCollectionKey = std::string("RecMuonRoI"), "RecMuonRoI to read in"); 
-  declareProperty("MuFastDecisions",m_muFastContainerKey = std::string("xAOD::L2StandAloneMuonContainer"),"xAOD::L2StandAloneMuonContainer to record");	
-  declareProperty("MuFastComposite",m_muCompositeContainerKey = std::string("xAOD::TrigCompositeContainer"),"xAOD::TrigCompositeContainer to record");	
-  declareProperty("MuFastForID",m_muIdContainerKey = std::string("TrigRoiDescriptorCollection"),"TrigRoiDescriptor for ID to record");
-  declareProperty("MuFastForMS",m_muMsContainerKey = std::string("TrigRoiDescriptorCollection"),"TrigRoiDescriptor for MS to record");
 }
 
 // --------------------------------------------------------------------------------
@@ -1152,6 +1144,8 @@ bool MuFastSteering::updateOutput(const LVL1::RecMuonRoI*                  roi,
     muonSA->setRoiEta( roi->eta() );
     /// Set RoIp phi
     muonSA->setRoiPhi( roi->phi() );
+    /// Set RoI word
+    muonSA->setRoIWord( roi->roiWord() );
 
     /// Set size of storages to be reserved
     muonSA->setRpcHitsCapacity( m_esd_rpc_size );
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx
index ce4a94e90a0..0e72a0546e2 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx
@@ -50,7 +50,6 @@ TrigL2MuonSA::RpcDataPreparator::RpcDataPreparator(const std::string& type,
 {
    declareInterface<TrigL2MuonSA::RpcDataPreparator>(this);
    declareProperty("RpcPrepDataProvider", m_rpcPrepDataProvider);
-
 }
 
 // --------------------------------------------------------------------------------
@@ -145,6 +144,8 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::initialize()
      return StatusCode::FAILURE;
    } 
    
+   ATH_CHECK(m_rpcPrepContainerKey.initialize());
+   
    // 
    return StatusCode::SUCCESS; 
 }
@@ -235,17 +236,16 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor*
    if (!rpcHashList.empty()) {
      
      // Get RPC container
-     const RpcPrepDataContainer* rpcPrds = 0;
-     std::string rpcKey = "RPC_Measurements";
-     
+     const RpcPrepDataContainer* rpcPrds;
      if (m_activeStore) {		//m_activeStore->m_storeGateSvc
-       StatusCode sc = (*m_activeStore)->retrieve(rpcPrds, rpcKey);	//m_activeStore->m_storeGateSvc
-       if ( sc.isFailure() ) {
-         ATH_MSG_ERROR(" Cannot retrieve RPC PRD Container " << rpcKey);
-         return StatusCode::FAILURE;;
-       } else {       
-         ATH_MSG_DEBUG(" RPC PRD Container retrieved with key " << rpcKey);
-       }
+       auto rpcPrepContainerHandle = SG::makeHandle(m_rpcPrepContainerKey);
+       rpcPrds = rpcPrepContainerHandle.cptr();                                 
+       if (!rpcPrepContainerHandle.isValid()) {
+         ATH_MSG_ERROR("Cannot retrieve RPC PRD Container key: " << m_rpcPrepContainerKey.key());
+         return StatusCode::FAILURE;
+       } else {
+         ATH_MSG_DEBUG(" RPC PRD Container retrieved with key: " << m_rpcPrepContainerKey.key());
+       }         
      } else {
        ATH_MSG_ERROR("Null pointer to ActiveStore");
        return StatusCode::FAILURE;;
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
index 72c3485f6a1..e2d35009976 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
@@ -137,6 +137,8 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::initialize()
      return sc ;
    }
    ATH_MSG_DEBUG("Retrieved ActiveStoreSvc." );
+
+   ATH_CHECK(m_tgcContainerKey.initialize());
       
    // 
    return StatusCode::SUCCESS; 
@@ -173,7 +175,8 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI*
    TrigRoiDescriptor* roi = new TrigRoiDescriptor( p_roi->eta(), etaMin, etaMax, p_roi->phi(), phiMin, phiMax ); 
    const IRoiDescriptor* iroi = (IRoiDescriptor*) roi;
    
-   const Muon::TgcPrepDataContainer* tgcPrepContainer = 0;
+   //const Muon::TgcPrepDataContainer* tgcPrepContainer = 0;
+   const Muon::TgcPrepDataContainer* tgcPrepContainer;
    int gasGap;
    int channel;
    
@@ -204,12 +207,14 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI*
    }
    
    if ( m_activeStore ) {
-     StatusCode sc_read = (*m_activeStore)->retrieve( tgcPrepContainer, "TGC_Measurements" );
-     if (sc_read.isFailure()){
-       ATH_MSG_ERROR("Could not retrieve PrepDataContainer.");
-       return sc_read;
+     auto tgcContainerHandle = SG::makeHandle(m_tgcContainerKey);
+     tgcPrepContainer = tgcContainerHandle.cptr();
+     if (!tgcContainerHandle.isValid()) { 
+       ATH_MSG_ERROR("Could not retrieve PrepDataContainer key:" << m_tgcContainerKey.key());
+       return StatusCode::FAILURE;
+     } else {
+       ATH_MSG_DEBUG("Retrieved PrepDataContainer: " << tgcPrepContainer->numberOfCollections());
      }
-     ATH_MSG_DEBUG("Retrieved PrepDataContainer: " << tgcPrepContainer->numberOfCollections());
    } else {
      ATH_MSG_ERROR("Null pointer to ActiveStore");
      return StatusCode::FAILURE;;
diff --git a/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfig.py b/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfig.py
index e63562d7bce..eb8ee20c04f 100644
--- a/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfig.py
+++ b/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfig.py
@@ -267,13 +267,13 @@ def TrigMuSuperEF_MuonCaloTagTool( name='OnlineMuonCaloTagTool', **kwargs ):
     kwargs.setdefault("doCaloLR",               False)
     kwargs.setdefault("doOldExtrapolation",     True)
     kwargs.setdefault("ShowTruth",              False)
+    kwargs.setdefault("CaloCells",              "TrigCaloCellMaker")
     return CfgMgr.MuonCombined__MuonCaloTagTool(name,**kwargs )
 
 def TrigMuSuperEF_TrackIsolationTool( name = "TrigMuSuperEF_TrackIsolationTool", **kwargs):
     return TrigMuonEFTrackIsolationTool(name, deltaZCut = 6.0*mm, removeSelf=True, useAnnulus=False)
 
 def TrigMuSuperEF_TrackDepositInCaloTool(name = "TrigMuSuperEF_TrackDepositInCaloTool", **kwargs):
-    kwargs.setdefault("CaloCellContainerName", "TrigCaloCellMaker")
     return CfgMgr.TrackDepositInCaloTool(name, **kwargs)
 
 def TrigMuSuperEF_CaloTrkSelectorTool( name = 'TrigMuSuperEF_CaloTrkSelectorTool', **kwargs):
diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py
index 70fa52a0d92..d07a1a6c771 100755
--- a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py
+++ b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py
@@ -40,15 +40,6 @@ IsoCorrectionTool = PublicToolFactory(ICT,
                                 name = "NewLeakageCorrTool",
                                 IsMC = isMC)
 
-from PFlowUtils.PFlowUtilsConf import CP__RetrievePFOTool as RetrievePFOTool
-pfoTool = RetrievePFOTool();
-ToolSvc += pfoTool
-
-from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__PFlowObjectsInConeTool
-PFlowObjectsInConeTool = PublicToolFactory(xAOD__PFlowObjectsInConeTool,
-                                     name = "PFlowObjectsInConeTool",
-                                     RetrievePFOTool = pfoTool)
-
 from CaloIdentifier import SUBCALO
 from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool, xAOD__TrackIsolationTool
 
@@ -426,7 +417,6 @@ class TrigMuonEFStandaloneTrackToolConfig (TrigMuonEFStandaloneTrackTool):
         self.CscClusterProvider = CfgGetter.getPublicTool("CscThresholdClusterBuilderTool")
 
         self.SegmentsFinderTool = CfgGetter.getPublicToolClone( "TMEF_SegmentsFinderTool","MooSegmentFinder",
-                                                                WriteIntermediateResults = False,
                                                                 HoughPatternFinder = CfgGetter.getPublicTool("MuonLayerHoughTool"),DoSegmentCombinations=True )
 
         CfgGetter.getPublicTool("MuonHoughPatternFinderTool").RecordAll=False
diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFCosmicConfig.py b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFCosmicConfig.py
index 5c897e6cdd2..7c5aa1e07f9 100755
--- a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFCosmicConfig.py
+++ b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFCosmicConfig.py
@@ -359,9 +359,7 @@ class TrigMuonEFSegmentFinderCosmicConfig (TrigMuonEFSegmentFinder):
         self.CscClusterProvider = CfgGetter.getPublicTool("CscThresholdClusterBuilderTool")
 
         from MuonRecExample.MooreTools import MooSegmentCombinationFinder        
-        self.SegmentsFinderTool = MooSegmentCombinationFinder("SegmentsFinderToolCosmic",
-                                                             WriteIntermediateResults = False
-                                                             )
+        self.SegmentsFinderTool = MooSegmentCombinationFinder("SegmentsFinderToolCosmic")
         
         # use seeded decoding
         if (TriggerFlags.MuonSlice.doEFRoIDrivenAccess()):
diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx
index b67253c7f18..ce8515b8327 100644
--- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx
+++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx
@@ -1767,8 +1767,12 @@ TrigMuonEFStandaloneTrackTool::buildTracks(const MuonSegmentCombinationCollectio
 
 
       const Trk::Track* trk = *itTrk;
-      // create track particle
+      // create track particle - this is needed because later on we use the track particle container (m_spectrometerTrackParticles)
+      // for the extrapolation of the muons
       const ElementLink<TrackCollection> trackLink(*m_spectrometerTracks, nTrack);
+      m_TrackToTrackParticleConvTool->createParticle( trackLink, m_spectrometerTrackParticles, 0, xAOD::muon);
+
+
       ATH_MSG_DEBUG("REGTEST MuonEF - track " << nTrack
 		    << " has Author " << trk->info().dumpInfo());
       ++nTrack;
diff --git a/Trigger/TrigAlgorithms/TrigmuComb/TrigmuComb/muCombMT.h b/Trigger/TrigAlgorithms/TrigmuComb/TrigmuComb/muCombMT.h
new file mode 100755
index 00000000000..f3443f0cebd
--- /dev/null
+++ b/Trigger/TrigAlgorithms/TrigmuComb/TrigmuComb/muCombMT.h
@@ -0,0 +1,216 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// ********************************************************************
+// 
+// NAME:     muCombMT.h
+// PACKAGE:  Trigger/TrigAlgorithms/TrigmuComb
+// 
+// AUTHORS:   S. Giagu <stefano.giagu@cern.ch>
+// 
+// PURPOSE:  LVL2 Combined Muon FEX Algorithm (MT version)
+// ********************************************************************
+
+#ifndef MUCOMBMT_H
+#define MUCOMBMT_H
+
+// standard stuff
+#include <vector>
+#include <cmath> 
+
+// general athena stuff
+#include "GaudiKernel/IToolSvc.h"
+
+//Gaudi
+#include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/ServiceHandle.h"
+
+// Base class
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+#include "TrkExInterfaces/IExtrapolator.h"
+#include "MagFieldInterfaces/IMagFieldSvc.h"
+
+#include "xAODTrigMuon/L2CombinedMuonContainer.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTracking/TrackParticle.h"
+
+//#include "TrigSteeringEvent/TrigRoiDescriptor.h"
+//#include "TrigT1Interfaces/RecMuonRoI.h"
+
+#include "AthenaMonitoring/GenericMonitoringTool.h"
+
+/** Main LVL2 Algorithm. Sided by a xAOD::L2StandaloneMuon, match the muon spectrometer track with an ID track, and produces a xAOD::L2CombinedMuon. */
+class muCombMT : public AthAlgorithm
+{
+ public:
+  /** Constructor */
+  muCombMT(const std::string&, ISvcLocator*);
+  /** Destructor */
+  ~muCombMT(){};
+   
+  /** initialize. Called by the Steering. */
+  StatusCode initialize();
+  /** finalize. Called by the Steering. */
+  StatusCode finalize();
+  /** execute execute the combined muon FEX. */ 
+  StatusCode execute();
+   
+ private:
+
+  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_TrackParticleContainerKey{ this,
+      "TrackParticlesContainerName",            // property name
+      "InDetTrigTrackingxAODCnv_Muon_FTF",      // default value of StoreGate key
+      "input TrackParticle container name"};
+
+  SG::ReadHandleKey<xAOD::L2StandAloneMuonContainer> m_muonCollKey{ this,
+      "L2StandAloneMuonContainerName",          // property name
+      "xAOD::L2StandAloneMuonContainer",        // default value of StoreGate key
+      "input L2StandAloneMuon Container name"};
+
+
+  SG::WriteHandleKey<xAOD::L2CombinedMuonContainer> m_outputCBmuonCollKey{ this,
+      "L2CombinedMuonContainerName",           // property name
+      "MuonL2CBInfo",                          // default value of StoreGate key
+      "output CB Muon container name"};
+
+  ToolHandle<GenericMonitoringTool> m_monTool;
+
+  /** Handle to the G4 backExtrapolator tool */
+  //ToolHandle<Trk::IExtrapolator>  m_backExtrapolatorG4;  
+  PublicToolHandle<Trk::IExtrapolator> m_backExtrapolatorG4 {this,
+     "AtlasExtrapolator",
+     "Trk::Extrapolator/AtlasExtrapolator",
+     "Tool to backextrapolate muon from MS to IP (G4 based)"};
+
+  /** Handle to the Magnetic field service */
+  //ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc;       //!< helper tool to get the magnetic field
+  MagField::IMagFieldSvc* m_MagFieldSvc; 
+
+
+  int    drptMatch(double, double, double,
+                   double, double, double, int, 
+		   double&, double&, double&, double&, double&);
+
+  int    drptMatch(const xAOD::L2StandAloneMuon* feature, 
+                   double, double, double, int, 
+		   double&, double&, double&, double&, double&);
+
+  int    mfMatch(const xAOD::L2StandAloneMuon* feature, 
+                 double, double, double, double,
+		 double&, double&, double&, double&, double&, int&);
+
+  int    g4Match(const xAOD::L2StandAloneMuon* feature,
+                 double, double, double, double, double, double, double,
+		 double&, double&, double&, double&, double&, int&);
+
+ private:
+
+  // Properties
+
+  /** flag to switch between G4 and LUT based back-extrapolation */
+   Gaudi::Property<bool> m_useBackExtrapolatorG4 {this, "UseBackExtrapolatorG4", true, "Use g4-based back-extraploator"};
+
+  /** flag to assume B_Toroid=0 anyway */
+   Gaudi::Property<bool> m_assumeToroidOff       {this, "AssumeToroidOff",       false, "Force assumption toroid off"};
+  /** flag to assume B_Solenoid=0 anyway */
+   Gaudi::Property<bool> m_assumeSolenoidOff     {this, "AssumeSolenoidOff",     false, "Force assumption solenoid off"};
+
+
+  /** muComb matching strategy:
+   *  0: auto select best option
+   *  1: simplified R,(Pt) matching
+   */
+   Gaudi::Property<int> m_AlgoStrategy {this, "MuCombStrategy", 0, "Algoritgm strategy [0=auto select best option,1=simple angular match]"};
+
+  /** muComb charge assignment strategy:
+   *  0: useMuFast
+   *  1: use ID
+   *  2: use resolution model
+   */
+   Gaudi::Property<int> m_ChargeStrategy {this, "ChargeStrategy", 0, "Charge assignement strategy [0=muFast,1=ID,2=resolution based]"};
+
+  /** ID Track collection used for matching */
+   Gaudi::Property<std::string> m_ID_algo_to_use {this, "IDalgo", "InDetTrigTrackingxAODCnv_Muon_FTF","ID trk xAOD collection to use"};
+
+  /** Min Pt to select the ID track for matching */
+   Gaudi::Property<double> m_PtMinTrk  {this, "MinPtTRK",     1.*CLHEP::GeV, "ID track minimum pT"}; //GeV/c
+  /** Max abs(eta) to select the ID track for matching */
+   Gaudi::Property<double> m_EtaMaxTrk {this, "MaxAbsEtaTRK", 2.5, "ID tracks max |eta|"};
+
+   // Matching Parameters
+   //Common
+  /** Min Number of DOF to apply the chi2 cut on macthing based on LUT and G4 backextrapolators */
+   Gaudi::Property<int>  m_NdofMin   {this, "NdofMin",     9999, "matching parameter: min ndof"};
+  /** Use Absolute value of the Pt in chi2 calculation (i.e. not use muon charge) */
+   Gaudi::Property<bool> m_UseAbsPt  {this, "UseAbsPt",    false, "matching parameter: use absolute pT"};
+
+   // LUT based backextrapolator
+  /** Number of sigmas for the Eta matching window LUT backextrapolator (Barrel) */
+   Gaudi::Property<double>  m_WinEta         {this, "WinEtaSigma",          4.0, "matching parameter: LUT-based"};
+  /** Number of sigmas for the Phi matching window LUT backextrapolator (Barrel) */
+   Gaudi::Property<double>  m_WinPhi         {this, "WinPhiSigma",          4.0, "matching parameter: LUT-based"};
+  /** Max Chi2 for the combined muon in LUT backextrapolator (Barrel) */
+   Gaudi::Property<double>  m_Chi2Max        {this, "Chi2Max",              1.e33, "matching parameter: LUT-based"};
+  /** Number of sigmas for the Eta matching window LUT backextrapolator (EndCaps) */
+   Gaudi::Property<double>  m_WinEta_EC      {this, "WinEtaSigmaEndCaps",   4.0, "matching parameter: LUT-based"};
+  /** Number of sigmas for the Phi matching window LUT backextrapolator (EndCaps) */
+   Gaudi::Property<double>  m_WinPhi_EC      {this, "WinPhiSigmaEndCaps",   10., "matching parameter: LUT-based"};
+  /** Max Chi2 for the combined muon in LUT backextrapolator (EndCaps) */
+   Gaudi::Property<double>  m_Chi2Max_EC     {this, "Chi2MaxEndCaps",       1.e33, "matching parameter: LUT-based"};
+  /** Number of sigmas for the Eta matching window LUT backextrapolator (Trigger Stations) */
+   Gaudi::Property<double>  m_WinEta_TS      {this, "WinEtaSigmaTS",        5.0, "matching parameter: LUT-based"};
+  /** Number of sigmas for the Phi matching window LUT backextrapolator (Trigger Stations) */
+   Gaudi::Property<double>  m_WinPhi_TS      {this, "WinPhiSigmaTS",        5.0, "matching parameter: LUT-based"};
+  /** Max Chi2 for the combined muon in LUT backextrapolator (Trigger Stations) */
+   Gaudi::Property<double>  m_Chi2Max_TS     {this, "Chi2MaxTS",            1.e33, "matching parameter: LUT-based"};
+  /** Number of sigmas for the Eta matching window LUT backextrapolator (MS Feet region) */
+   Gaudi::Property<double>  m_WinEta_FE      {this, "WinEtaSigmaFE",        10.0, "matching parameter: LUT-based"};
+  /** Number of sigmas for the Phi matching window LUT backextrapolator (MS Feet region) */
+   Gaudi::Property<double>  m_WinPhi_FE      {this, "WinPhiSigmaFE",        10.0, "matching parameter: LUT-based"};
+  /** Max Chi2 for the combined muon in LUT backextrapolator (MS Feet region) */
+   Gaudi::Property<double>  m_Chi2Max_FE     {this, "Chi2MaxFE",            1.e33, "matching parameter: LUT-based"};
+  /** Scale factor for the Eta matching window in LUT backextrapolator */
+   Gaudi::Property<double>  m_WeightEta      {this, "WeightEta",            2.0, "matching parameter: LUT-based"};
+  /** Scale factor for the Phi matching window in LUT backextrapolator */
+   Gaudi::Property<double>  m_WeightPhi      {this, "WeightPhi",            2.0, "matching parameter: LUT-based"};
+                                             
+   // g4 based backextrapolator
+  /** Number of sigmas for the Eta matching window LUT backextrapolator (Barrel) */
+   Gaudi::Property<double>  m_WinEta_g4      {this, "WinEtaSigma_g4",       7.0, "matching parameter: G4-based"};
+  /** Number of sigmas for the Phi matching window LUT backextrapolator (Barrel) */
+   Gaudi::Property<double>  m_WinPhi_g4      {this, "WinPhiSigma_g4",       7.0, "matching parameter: G4-based"};
+  /** Max Chi2 for the combined muon in LUT backextrapolator (Barrel) */
+   Gaudi::Property<double>  m_Chi2Max_g4     {this, "Chi2Max_g4",           1.e33, "matching parameter: G4-based"};
+  /** Number of sigmas for the Eta matching window LUT backextrapolator (EndCaps) */
+   Gaudi::Property<double>  m_WinEta_EC_g4   {this, "WinEtaSigmaEndCaps_g4",7.0, "matching parameter: G4-based"};
+  /** Number of sigmas for the Phi matching window LUT backextrapolator (EndCaps) */
+   Gaudi::Property<double>  m_WinPhi_EC_g4   {this, "WinPhiSigmaEndCaps_g4",7.0, "matching parameter: G4-based"};
+  /** Max Chi2 for the combined muon in LUT backextrapolator (EndCaps) */
+   Gaudi::Property<double>  m_Chi2Max_EC_g4  {this, "Chi2MaxEndCaps_g4",    1.e33, "matching parameter: G4-based"};
+  /** Scale factor for the Eta matching window in LUT backextrapolator */
+   Gaudi::Property<double>  m_WeightEta_g4   {this, "WeightEta_g4",         2.0, "matching parameter: G4-based"};
+  /** Scale factor for the Phi matching window in LUT backextrapolator */
+   Gaudi::Property<double>  m_WeightPhi_g4   {this, "WeightPhi_g4",         2.0, "matching parameter: G4-based"};
+  /** Scale factor for the Chi2 1/pt resolutions (MS and ID) (Barrel) */
+   Gaudi::Property<double>  m_Chi2Weight_g4  {this, "Chi2Weight_g4",        2.0, "matching parameter: G4-based"};
+
+   // Simplified DeltaR(/Pt) based match
+  /** max deltaPt for simpified matching */
+   Gaudi::Property<double> m_winPt {this, "WinPt",       -1.0*CLHEP::GeV, "matching parameter (simplifed): pT windows in geV (disabled if < 0)"};
+  /** max deltaR for simplified matching */
+   Gaudi::Property<double> m_winDR {this, "WinDelta",     0.2, "matching parameter (simplifed): strategy dependent"};
+
+   // ID parametrized rsolution for matching
+   Gaudi::Property<std::vector<double>> m_IDSCANRes_barrel  {this, "IDSCANBarrelRes", {0.017, 0.000000418}, "ID parametrized rsolution for matching (barrel)"};
+   Gaudi::Property<std::vector<double>> m_IDSCANRes_endcap1 {this, "IDSCANEndcap1Res",{0.025, 0.0000002}, "ID parametrized rsolution for matching (ec1)"};
+   Gaudi::Property<std::vector<double>> m_IDSCANRes_endcap2 {this, "IDSCANEndcap2Res",{0.030, 0.0000002}, "ID parametrized rsolution for matching (ec2)"};
+   Gaudi::Property<std::vector<double>> m_IDSCANRes_endcap3 {this, "IDSCANEndcap3Res",{0.036, 0.0000004}, "ID parametrized rsolution for matching (ec3)"};
+   Gaudi::Property<std::vector<double>> m_IDSCANRes_endcap4 {this, "IDSCANEndcap4Res",{0.046, 0.0000002}, "ID parametrized rsolution for matching (ec4)"};
+
+};
+DECLARE_ALGORITHM_FACTORY( muCombMT )
+#endif // MUCOMB_H
diff --git a/Trigger/TrigAlgorithms/TrigmuComb/python/TrigmuCombMTConfig.py b/Trigger/TrigAlgorithms/TrigmuComb/python/TrigmuCombMTConfig.py
new file mode 100755
index 00000000000..6e2e00500ce
--- /dev/null
+++ b/Trigger/TrigAlgorithms/TrigmuComb/python/TrigmuCombMTConfig.py
@@ -0,0 +1,92 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+##############################
+# L2 muCombMT Fex Algorithm Configuration:
+# Stefano Giagu <stefano.giagu@cern.ch>
+##############################
+
+
+from TrigmuComb.TrigmuCombConf import TrigmuCombMTConfig
+from AthenaCommon.SystemOfUnits import GeV
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from AthenaCommon.GlobalFlags import globalflags
+from MuonByteStream.MuonByteStreamFlags import muonByteStreamFlags
+from AthenaCommon.AppMgr import ServiceMgr
+from AthenaCommon.AppMgr import ToolSvc
+from AthenaMonitoring.GenericMonitoringTool import GenericMonitoringTool,defineHistogram
+
+class TrigmuCombMTConfig (muCombMT):
+    __slots__ = []
+    def __new__( cls, *args, **kwargs ):
+      newargs = ['%s_%s_%s' % (cls.getType(),args[0],args[1]) ] + list(args)
+      if len(args) == 3:
+        if args[2] == 'OLDextr':
+          newargs = ['%s_%s_%s_%s' % (cls.getType(),args[0],args[1],args[2]) ] + list(args)
+      return super( TrigmuCombMTConfig, cls ).__new__( cls, *newargs, **kwargs )
+
+    def __init__( self, name, *args, **kwargs ):
+      super( TrigmuCombMTConfig, self ).__init__( name )
+
+      self.MuCombStrategy = 0
+
+      self.UseBackExtrapolatorG4 = True
+      if len(args) == 3:
+        if args[2] == 'OLDextr':
+          self.UseBackExtrapolatorG4 = False
+
+      self.MinPtTRK = 0.* GeV
+
+      # matchign windows parameters tuned in 2016 and 2015 data (T&P Z  and J/psi samples)
+      self.WinEtaSigma_g4 = 7.0
+      self.WinPhiSigma_g4 = 7.0
+      self.Chi2Weight_g4  = 2.0
+      if TriggerFlags.run2Config=='2016':
+        self.WinEtaSigma_g4 = 4.0
+        self.WinPhiSigma_g4 = 4.0
+        self.Chi2Weight_g4  = 1.0
+
+      # pt resolution parameters for ID-SAmuon match from SAmuon developers (2016 data)
+      if globalflags.DetDescrVersion().find('CSC')!=-1:
+        self.IDSCANBarrelRes  = [0.02169,0.0004186]
+        self.IDSCANEndcap1Res = [0.03054,0.000325]
+        self.IDSCANEndcap2Res = [0.03557,0.0005383]
+        self.IDSCANEndcap3Res = [0.04755,0.0007718]
+        self.IDSCANEndcap4Res = [0.06035,0.0001145]
+
+      if 'Validation' in TriggerFlags.enableMonitoring():
+        monTool = GenericMonitoringTool('MonTool')
+        monTool.Histograms = [ defineHistogram('Efficiency', path='EXPERT', type='TH1F', title="Monitored Track matching efficiency from #muComb", xbins=3, xmin=-1.5, xmax=1.5) ]
+        monTool.Histograms += [ defineHistogram('ErrorFlagMC', path='EXPERT', type='TH1F', title="Error Flags during event processing from #muComb; Error Code", xbins=12, xmin=-1.5, xmax=10.5) ]
+        monTool.Histograms += [ defineHistogram('MatchFlagMC', path='EXPERT', type='TH1F', title="Match Flags during matching algo from #muComb; Error Code", xbins=12, xmin=-1.5, xmax=10.5) ]
+        monTool.Histograms += [ defineHistogram('StrategyMC', path='EXPERT', type='TH1F', title="Combination Strategy from #muComb; Strategy Code", xbins=12, xmin=-1.5, xmax=10.5) ]
+        monTool.Histograms += [ defineHistogram('PtMS', path='EXPERT', type='TH1F', title="p_{T} MS from #muComb; p_{T} (GeV/c)", xbins=210, xmin=-105., xmax=105.) ]
+        monTool.Histograms += [ defineHistogram('PtID', path='EXPERT', type='TH1F', title="p_{T} ID from #muComb; p_{T} (GeV/c)", xbins=210, xmin=-105., xmax=105.) ]
+        monTool.Histograms += [ defineHistogram('PtMC', path='EXPERT', type='TH1F', title="p_{T} Combined from #muComb; p_{T} (GeV/c)", xbins=210, xmin=-105., xmax=105.) ]
+        monTool.Histograms += [ defineHistogram('PtFL', path='EXPERT', type='TH1F', title="MS p_{T} failed matches from #muComb; p_{T} (GeV/c)", xbins=210, xmin=-105., xmax=105.) ]
+        monTool.Histograms += [ defineHistogram('EtaFL', path='EXPERT', type='TH1F', title="MS Eta failed matchs from #muComb; Eta", xbins=108, xmin=-2.7, xmax=2.7) ]
+        monTool.Histograms += [ defineHistogram('PhiFL', path='EXPERT', type='TH1F', title="MS Phi failed matches from #muComb; Phi (rad)", xbins=96, xmin=-3.1416, xmax=3.1416) ]
+        monTool.Histograms += [ defineHistogram('EtaID', path='EXPERT', type='TH1F', title="Eta ID from #muComb; Eta", xbins=108, xmin=-2.7, xmax=2.7) ]
+        monTool.Histograms += [ defineHistogram('ZetaID', path='EXPERT', type='TH1F', title="z0 ID from #muComb; z0 (mm)", xbins=100, xmin=-200., xmax=200.) ]
+        monTool.Histograms += [ defineHistogram('EtaMS', path='EXPERT', type='TH1F', title="Eta MS from #muComb; Eta", xbins=108, xmin=-2.7, xmax=2.7) ]
+        monTool.Histograms += [ defineHistogram('ZetaMS', path='EXPERT', type='TH1F', title="z0 MS from #muComb; z0 (mm)", xbins=100, xmin=-200., xmax=200.) ]
+        monTool.Histograms += [ defineHistogram('DEta', path='EXPERT', type='TH1F', title="Eta difference between muon and matched ID track from #muComb; DeltaEta", xbins=100, xmin=0.0, xmax=0.2) ]
+        monTool.Histograms += [ defineHistogram('DPhi', path='EXPERT', type='TH1F', title="Phi difference between muon and matched ID track from #muComb; DeltaPhi (rad)", xbins=100, xmin=0.0, xmax=0.2) ]
+        monTool.Histograms += [ defineHistogram('DZeta', path='EXPERT', type='TH1F', title="Zeta difference between muon and matched ID track from #muComb; DeltaZeta (cm)", xbins=100, xmin=-60, xmax=60) ]
+        monTool.Histograms += [ defineHistogram('DeltaR', path='EXPERT', type='TH1F', title="DeltaR between muon and matched ID track from #muComb; DeltaR", xbins=100, xmin=0., xmax=0.5) ]
+        monTool.Histograms += [ defineHistogram('PtMS, PtID', path='EXPERT', type='TH2F', title="PtID vs PtMS from #muComb", xbins=105, xmin=-105.0, xmax=105.0, ybins=105, ymin=-105.0, ymax=105.0) ]
+        monTool.Histograms += [ defineHistogram('EtaMS, DEta', path='EXPERT', type='TH2F', title="Eta diff (MS-ID) vs Eta(MS) from #muComb", xbins=100, xmin=-3, xmax=3, ybins=100, ymin=0.0, ymax=0.2) ]
+        monTool.Histograms += [ defineHistogram('EtaMS, DPhi', path='EXPERT', type='TH2F', title="Phi diff (MS-ID) vs Eta(MS) from #muComb", xbins=100, xmin=-3, xmax=3, ybins=100, ymin=0.0, ymax=0.2) ]
+        self.MonTool = monTool
+
+      if 'Online' in  TriggerFlags.enableMonitoring():
+        monTool = GenericMonitoringTool('MonTool')
+        monTool.Histograms += [ defineHistogram('ErrorFlagMC', path='EXPERT', type='TH1F', title="Error Flags during event processing from #muComb; Error Code", xbins=12, xmin=-1.5, xmax=10.5) ]
+        monTool.Histograms += [ defineHistogram('MatchFlagMC', path='EXPERT', type='TH1F', title="Match Flags during matching algo from #muComb; Error Code", xbins=12, xmin=-1.5, xmax=10.5) ]
+        monTool.Histograms += [ defineHistogram('StrategyMC', path='EXPERT', type='TH1F', title="Combination Strategy from #muComb; Strategy Code", xbins=12, xmin=-1.5, xmax=10.5) ]
+        monTool.Histograms += [ defineHistogram('PtMC', path='EXPERT', type='TH1F', title="p_{T} Combined from #muComb; p_{T} (GeV/c)", xbins=210, xmin=-105., xmax=105.) ]
+        monTool.Histograms += [ defineHistogram('PtFL', path='EXPERT', type='TH1F', title="MS p_{T} failed matches from #muComb; p_{T} (GeV/c)", xbins=210, xmin=-105., xmax=105.) ]
+        monTool.Histograms += [ defineHistogram('EtaFL', path='EXPERT', type='TH1F', title="MS Eta failed matchs from #muComb; Eta", xbins=108, xmin=-2.7, xmax=2.7) ]
+        monTool.Histograms += [ defineHistogram('PhiFL', path='EXPERT', type='TH1F', title="MS Phi failed matches from #muComb; Phi (rad)", xbins=96, xmin=-3.1416, xmax=3.1416) ]
+        monTool.Histograms += [ defineHistogram('DEta', path='EXPERT', type='TH1F', title="Eta difference between muon and matched ID track from #muComb; DeltaEta", xbins=100, xmin=0.0, xmax=0.2) ]
+        monTool.Histograms += [ defineHistogram('DPhi', path='EXPERT', type='TH1F', title="Phi difference between muon and matched ID track from #muComb; DeltaPhi (rad)", xbins=100, xmin=0.0, xmax=0.2) ]
+        self.MonTool = monTool
diff --git a/Trigger/TrigAlgorithms/TrigmuComb/src/muCombMT.cxx b/Trigger/TrigAlgorithms/TrigmuComb/src/muCombMT.cxx
new file mode 100755
index 00000000000..7ae5eb88201
--- /dev/null
+++ b/Trigger/TrigAlgorithms/TrigmuComb/src/muCombMT.cxx
@@ -0,0 +1,862 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// ********************************************************************
+//
+// NAME:     muCombMT.cxx
+// PACKAGE:  Trigger/TrigAlgorithms/TrigmuComb
+// VERSION:  V3 (MT Version)
+//
+// AUTHOR:   S.Giagu <stefano.giagu@cern.ch>
+//
+// ********************************************************************
+#include <sstream>
+#include <math.h>
+
+#include "TrigmuComb/muCombMT.h"
+#include "TrigmuComb/muCombUtil.h"
+#include "PathResolver/PathResolver.h"
+#include "TrigConfHLTData/HLTTriggerElement.h"
+#include "xAODTrigMuon/TrigMuonDefs.h"
+#include "xAODTrigMuon/L2StandAloneMuonContainer.h"
+#include "xAODTrigMuon/L2StandAloneMuonAuxContainer.h"
+#include "xAODTrigMuon/L2CombinedMuonAuxContainer.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "TrigSiSpacePointTool/ISpacePointProvider.h"
+#include "AthenaMonitoring/MonitoredScope.h"
+
+#include "CLHEP/Units/SystemOfUnits.h"
+class ISvcLocator;
+
+muCombMT::muCombMT(const std::string& name, ISvcLocator* pSvcLocator):
+   AthAlgorithm(name, pSvcLocator),
+   m_MagFieldSvc(0)
+{
+   declareProperty("MonTool", m_monTool=VoidMonitoringTool(this), "Monitoring tool");
+}
+
+StatusCode muCombMT::initialize()
+{
+   ATH_MSG_DEBUG("Initialization:");
+
+   //Filed service
+   if (!m_MagFieldSvc) service("AtlasFieldSvc", m_MagFieldSvc, /*createIf=*/ false).ignore();
+   if (m_MagFieldSvc) {
+      ATH_MSG_DEBUG( "Retrieved AtlasFieldSvc" );
+   } else {
+      ATH_MSG_ERROR( "Could not retrieve AtlasFieldSvc --> Abort" );
+      return StatusCode::FAILURE; 
+   }
+
+   if (!m_monTool.empty()) {
+      ATH_MSG_DEBUG("Retrieving monTool");
+      CHECK(m_monTool.retrieve());
+   } else {
+      ATH_MSG_INFO("No monTool configured => NO MONITORING");
+   }
+
+   // BackExtrapolator services
+   if ( m_backExtrapolatorG4.retrieve().isFailure() ) {  
+        ATH_MSG_ERROR("Unable to locate G4 BackExtrapolator tool ");
+        return StatusCode::FAILURE; 
+   }
+
+   ATH_CHECK( m_muonCollKey.initialize() );
+   //ATH_CHECK( m_muonROICollKey.initialize() );
+   ATH_CHECK( m_TrackParticleContainerKey.initialize() );
+   ATH_CHECK( m_outputCBmuonCollKey.initialize() );
+
+   return StatusCode::SUCCESS;
+}
+
+StatusCode muCombMT::finalize()
+{
+   return StatusCode::SUCCESS;
+}
+
+// muon-trk match based on angular distance
+// return 0 --> match,  1 --> no match
+int muCombMT::drptMatch(const xAOD::L2StandAloneMuon* feature, double id_pt, double id_eta, double id_phi, int algo,
+                      double& combPtInv, double& combPtRes, double& deta, double& dphi, double& dr)
+{
+   double pt     = feature->pt() * CLHEP::GeV;
+   double phi    = feature->phiMS();
+   double eta    = feature->etaMS();
+   return muCombMT::drptMatch(pt, eta, phi, id_pt, id_eta, id_phi, algo, combPtInv, combPtRes, deta, dphi, dr);
+}
+int muCombMT::drptMatch(double pt, double eta, double phi, double id_pt, double id_eta, double id_phi, int algo,
+                      double& combPtInv, double& combPtRes, double& deta, double& dphi, double& dr)
+{
+
+   // algo: 1 --> R (+ pt), combined pt
+   // algo: 2 --> R match, Id pt
+   // algo: 3 --> R match, MS pt
+   // algo: 4 --> R match, infinite pt
+   if (algo < 1 || algo > 4) {
+      ATH_MSG_DEBUG(" muComb::drptMatch wrong algo parameter, it is: " << algo
+            << " while must be in the range [1,4], match failed!!!" );
+      return 1;
+   }
+
+   double winDR = m_winDR;
+   double winPt = m_winPt;
+
+   combPtRes = 0.0;
+   if (algo == 1) combPtInv = ((1. / pt) + (1. / id_pt)) * 0.5;
+   if (algo == 2) combPtInv = 1. / id_pt;
+   if (algo == 3) combPtInv = 1. / pt;
+   if (algo == 4) combPtInv = 1.e-33;
+
+   double tmp_deta = std::max(eta, id_eta) - std::min(eta, id_eta);
+   double tmp_dphi = std::max(phi, id_phi) - std::min(phi, id_phi);
+   if (tmp_dphi >= M_PI) tmp_dphi = 2 * M_PI - tmp_dphi;
+   double tmp_dr = sqrt(tmp_deta * tmp_deta + tmp_dphi * tmp_dphi);
+
+   dphi      = tmp_dphi;
+   deta      = tmp_deta;
+   dr        = tmp_dr;
+
+   bool passDR = true;
+   bool passPt = true;
+
+   if (tmp_dr > winDR)  passDR = false;
+
+   ATH_MSG_DEBUG(" REGTEST Angular MU-ID match / dR / threshold / result:"
+         << " / " << tmp_dr
+         << " / " << winDR
+         << " / " << (passDR ? "true" : "false"));
+
+   if (algo == 1 && winPt > 0) {
+      double tmp_dpt = fabs(fabs(pt) - fabs(id_pt)) / CLHEP::GeV; //don't use charge info
+      if (tmp_dpt > winPt) passPt = false;
+      ATH_MSG_DEBUG( " REGTEST MU-ID match / dpt (GeV) / threshold (GeV) / result:"
+            << " / " << tmp_dpt
+            << " / " << winPt
+            << " / " << (passPt ? "true" : "false"));
+   }
+
+   if (passDR && passPt) return 0;
+   else                  return 1;
+}
+
+// muon-trk match based on Geant4 backextrapolated SA Muon matched with ID track
+// return 0 --> match,  1/2/3/4/5/6 --> no match (muon pt zero, muon angle zero, ID pt zero, fail eta match, fail phi match, fail chi2 match)
+int muCombMT::g4Match(const xAOD::L2StandAloneMuon* feature,
+                    double id_eta, double id_phi, double id_pt, double id_charge, double id_eeta, double id_ephi, double id_eipt,
+                    double& combPtInv, double& combPtRes, double& deta, double& dphi, double& chi2, int& ndof)
+{
+
+   chi2 = 1.0e30;
+   ndof = 0;
+
+   //muFast parameters (in MeV!)
+   double phi    = feature->phiMS();
+   //double eta    = feature->etaMS();
+   double theta  = 2.*atan(exp(-feature->etaMS()));
+   double p      = 0.0;
+   if (sin(theta) != 0) {
+      p = (feature->pt() * CLHEP::GeV) / sin(theta);
+   } else {
+      return 2; //No match if muon angle is zero
+   }
+   double charge = 1.0;
+   double q_over_p = 0.;
+   if (p != 0.)  {
+      q_over_p = 1. / p;
+      charge = p / fabs(p);
+   } else {
+      return 1; //No match if muon Pt is zero
+   }
+   double pt = feature->pt() * CLHEP::GeV;
+   //double ptinv  = 1/pt;
+   double eptinv = feature->deltaPt() * CLHEP::GeV / pt / pt;
+
+   bool   isBarrel = ((feature->sAddress() != -1) ? true : false);
+   double etaShift = (isBarrel ? 0 : charge * 0.01);
+   bool   doFix = kFALSE;
+
+   //Superpoints
+   int inner  = (feature->sAddress() == -1) ? xAOD::L2MuonParameters::Chamber::EndcapInner : xAOD::L2MuonParameters::Chamber::BarrelInner;
+   int middle = (feature->sAddress() == -1) ? xAOD::L2MuonParameters::Chamber::EndcapMiddle : xAOD::L2MuonParameters::Chamber::BarrelMiddle;
+   //int outer  = (feature->sAddress() == -1) ? xAOD::L2MuonParameters::Chamber::EndcapOuter : xAOD::L2MuonParameters::Chamber::BarrelOuter;
+
+   double sp1_z = feature->superPointZ(inner);
+   double sp1_R = feature->superPointR(inner);
+   double sp2_z = feature->superPointZ(middle);
+   double sp2_R = feature->superPointR(middle);
+
+   if ((fabs(sp1_R) < 1000.)) {
+      sp1_z *= 10.;
+      sp1_R *= 10.;
+   }
+   if ((fabs(sp2_R) < 1300.)) {
+      sp2_z *= 10.;
+   }
+
+   double R = sp1_R;
+   double z = sp1_z;
+
+   if (R == 0. && z == 0.) { //treat patological endcap cases
+      doFix = kTRUE;
+      if (fabs(sp2_R) > 1300.) {
+         z = sp2_z;
+         if (z == 0.) z = 7600.;
+         R = z * tan(theta);
+         theta  = 2.*atan(exp(-(feature->etaMS() - etaShift)));
+      }
+   }
+
+   double x = R * cos(phi);
+   double y = R * sin(phi);
+
+   Amg::Vector3D vertex(x, y, z);
+   Trk::PerigeeSurface beamSurface;
+   Trk::PerigeeSurface pgsf(vertex);
+   Trk::Perigee perigeeMS(0., 0., phi, theta, q_over_p, pgsf);
+
+   //ID parameters
+   double id_eptinv_OLD = muCombUtil::getIDSCANRes(m_IDSCANRes_barrel,  m_IDSCANRes_endcap1, m_IDSCANRes_endcap2,
+                                               m_IDSCANRes_endcap3, m_IDSCANRes_endcap4, id_pt, id_eta);
+   double id_ptinv  = 1.0e33;
+   if (id_pt != 0) {
+      id_ptinv  = 1. / id_pt;
+   } else {
+      return 3; //no match if ID track Pt zero
+   }
+
+   double id_eptinv = id_eipt; //now taken from Track itself ...
+
+   const Trk::Perigee* muonPerigee = (Trk::Perigee*) m_backExtrapolatorG4->extrapolate(perigeeMS, beamSurface, Trk::oppositeMomentum, true, Trk::muon);
+
+
+   //Protection against failing extrapolation
+   double extr_eta;
+   double extr_phi;
+   double extr_pt;
+   if (!muonPerigee) { //G4 probably failed, getting LUT extrapolated values
+      extr_eta    = feature->eta();
+      extr_phi    = feature->phi();
+      extr_pt = pt;
+   } else {
+      double extr_theta    = muonPerigee -> parameters()[Trk::theta];
+      extr_phi      = muonPerigee -> parameters()[Trk::phi0];
+      double extr_q_over_p = muonPerigee -> parameters()[Trk::qOverP];
+      extr_eta      = -log(tan(extr_theta / 2.));
+      if (doFix) extr_eta = -log(tan(theta / 2.));
+      int    extr_q        = (extr_q_over_p > 0 ? 1 : -1);
+      extr_pt       = extr_q * 1.0e33;
+      if (extr_q_over_p != 0.) {
+         extr_pt = (1. / extr_q_over_p) * sin(extr_theta);
+         if (doFix) extr_pt = (1. / extr_q_over_p) * sin(theta);
+      }
+   }
+
+   double extr_eeta = muCombUtil::getG4ExtEtaRes(feature->pt(), feature->etaMS());
+   double extr_ephi = muCombUtil::getG4ExtPhiRes(feature->pt(), feature->etaMS());
+   double extr_ptinv  = 1.0e33;
+   if (extr_pt != 0) extr_ptinv = 1. / extr_pt;
+   double extr_eptinv = eptinv;
+
+   if (isBarrel) {//retuned ptinv resolution (only for barrel)
+      extr_eptinv *= m_Chi2Weight_g4;
+      id_eptinv   *= m_Chi2Weight_g4;
+   }
+
+   //avoid memory leak
+   delete muonPerigee;
+
+   //Combined muon parameters
+   combPtInv = muCombUtil::getCombinedAverage(extr_ptinv, extr_eptinv, id_ptinv, id_eptinv);
+   combPtRes = muCombUtil::getCombinedAverageSigma(extr_eptinv, id_eptinv);
+   double q_tmp = charge;
+   if (m_ChargeStrategy == 1) q_tmp = id_charge;
+   else if (m_ChargeStrategy == 2) {
+      if (1. / combPtInv > 50000.) q_tmp = charge;
+      else                         q_tmp = id_charge;
+   }
+   combPtInv *= q_tmp;
+
+   //Masaki/Kunihiro treatment of TGC/RPC readout problems
+   ATH_MSG_DEBUG( " Enlarge phi matching error in case TGC/RPC readout failed. : " << feature->isRpcFailure() << " / " << feature->isTgcFailure() );
+
+   if (feature->isTgcFailure() || feature->isRpcFailure()) extr_ephi *= 2.0;
+
+   //Match
+   deta = muCombUtil::getDeltaEta(extr_eta, id_eta);
+   dphi = muCombUtil::getDeltaPhi(extr_phi, id_phi);
+   int ndof_OLD = 0;
+   double chi2_OLD = muCombUtil::getChi2(ndof_OLD, combPtInv, 
+                                         extr_eta, extr_eeta, extr_phi, extr_ephi, extr_ptinv, extr_eptinv,
+                                         id_eta, 0.0, id_phi, 0.0, id_ptinv, id_eptinv, true);
+   chi2 = muCombUtil::getStdChi2(ndof, extr_eta, extr_eeta, extr_phi, extr_ephi, extr_ptinv, extr_eptinv,
+                              id_eta, id_eeta, id_phi, id_ephi, id_ptinv, id_eptinv, m_UseAbsPt);
+
+
+   ATH_MSG_DEBUG(" REGTEST Resolution / OLDIdRes / IdRes / muFastRes / combRes:"
+         << " / " << std::setw(11) << id_eptinv_OLD / CLHEP::GeV
+         << " / " << std::setw(11) << id_eptinv / CLHEP::GeV
+         << " / " << std::setw(11) << extr_eptinv / CLHEP::GeV
+         << " / " << std::setw(11) << combPtRes / CLHEP::GeV );
+
+   ATH_MSG_DEBUG(" REGTEST Momentum / IdPt / muFastPt  / CombPt :"
+         << " / " << std::setw(11) << 1. / id_ptinv / CLHEP::GeV
+         << " / " << std::setw(11) << 1. / extr_ptinv / CLHEP::GeV
+         << " / " << std::setw(11) << 1. / combPtInv / CLHEP::GeV );
+
+   ATH_MSG_DEBUG(" REGTEST Chi2 / ndof // Chi2OLD / ndofOLD :"
+         << " / " << std::setw(11) << chi2
+         << " / " << std::setw(11) << ndof
+         << " // " << std::setw(11) << chi2_OLD
+         << " / " << std::setw(11) << ndof_OLD );
+
+   //Cuts
+   double winEtaSigma = m_WinEta_g4;
+   double winPhiSigma = m_WinPhi_g4;
+   double maxChi2     = m_Chi2Max_g4;
+   if (!isBarrel) {//EC
+      winEtaSigma = m_WinEta_EC_g4;
+      winPhiSigma = m_WinPhi_EC_g4;
+      maxChi2     = m_Chi2Max_EC_g4;
+   }
+
+   ATH_MSG_DEBUG(" REGTEST DeltaEta / DeltaPhi / WinEta / WinPhi:"
+         << " / " << std::setw(11) << fabs(deta)
+         << " / " << std::setw(11) << fabs(dphi)
+         << " / " << std::setw(11) << m_WeightEta_g4*winEtaSigma*sqrt(extr_eeta * extr_eeta)
+         << " / " << std::setw(11) << m_WeightPhi_g4*winPhiSigma*sqrt(extr_ephi * extr_ephi) );
+
+   if (fabs(deta) > m_WeightEta_g4 * winEtaSigma * sqrt(extr_eeta * extr_eeta)) {
+      return 4;
+   }
+   if (fabs(dphi) > m_WeightPhi_g4 * winPhiSigma * sqrt(extr_ephi * extr_ephi)) {
+      return 5;
+   }
+   if (ndof >= m_NdofMin) {
+      if (chi2 > maxChi2) return 6;
+   }
+
+   return 0; //match OK
+}
+
+// muon-trk match based on LUT backextrapolated SA Muon matched with ID track
+// return 0 --> match,  1/2/3/4/5/6 --> no match (muon pt zero, muon angle zero, ID pt zero, fail eta match, fail phi match, fail chi2 match)
+int muCombMT::mfMatch(const xAOD::L2StandAloneMuon* feature,
+                    double id_eta, double id_phi, double id_pt, double id_charge,
+                    double& combPtInv, double& combPtRes, double& deta, double& dphi, double& chi2, int& ndof)
+{
+
+   chi2 = 1.0e30;
+   ndof = 0;
+   //muFast parameters
+
+   double    pt = feature->pt() * CLHEP::GeV;
+   if (pt == 0.)  {
+      return 1; //No match if muFast Pt is zero
+   }
+
+   bool   isTS     = ((feature->rMS() <= 10.) ? true : false);
+   bool   isBarrel = ((feature->sAddress() != -1) ? true : false);
+
+   double charge = pt / fabs(pt);
+   double ptinv  = 1. / pt;
+   double eptinv = feature->deltaPt() * CLHEP::GeV / pt / pt;
+
+   //ID parameters
+   double id_eptinv    = muCombUtil::getIDSCANRes(m_IDSCANRes_barrel, m_IDSCANRes_endcap1, m_IDSCANRes_endcap2,
+                                                  m_IDSCANRes_endcap3, m_IDSCANRes_endcap4, id_pt, id_eta);
+   double id_ptinv     = 1.0e33;
+   //double id_ept       = 1.0e33;
+   if (id_pt != 0) {
+      id_ptinv  = 1. / id_pt;
+      //id_ept    = id_eptinv * id_pt * id_pt;
+   } else {
+      return 3; //no match if ID track Pt zero
+   }
+
+   //Combined muon parameters
+   combPtInv = muCombUtil::getCombinedAverage(ptinv, eptinv, id_ptinv, id_eptinv);
+   combPtRes = muCombUtil::getCombinedAverageSigma(eptinv, id_eptinv);
+   double q_tmp = charge;
+   if (m_ChargeStrategy == 1) q_tmp = id_charge;
+   else if (m_ChargeStrategy == 2) {
+      if (1. / combPtInv > 50000.) q_tmp = charge;
+      else                         q_tmp = id_charge;
+   }
+   combPtInv *= q_tmp;
+
+   // Extrapolated (LUT) quantities (now stored in the xAOD::L2StandAloneMuon container)
+   double extr_eta    = feature->eta();
+   double extr_eeta   = feature->deltaEta();
+   double extr_phi    = feature->phi();
+   double extr_ephi   = feature->deltaPhi();
+   double extr_ptinv  = ptinv;
+   double extr_eptinv = eptinv;
+
+   //Masaki/Kunihiro treatment of TGC/RPC readout problems
+   ATH_MSG_DEBUG(" Enlarge phi matching error in case TGC/RPC readout failed. : " << feature->isRpcFailure() << " / " << feature->isTgcFailure() );
+
+   if (feature->isTgcFailure() || feature->isRpcFailure()) extr_ephi *= 2.0;
+
+   //Match
+   deta = muCombUtil::getDeltaEta(extr_eta, id_eta);
+   dphi = muCombUtil::getDeltaPhi(extr_phi, id_phi);
+   chi2 = muCombUtil::getChi2(ndof, combPtInv, extr_eta, extr_eeta, extr_phi, extr_ephi, extr_ptinv, extr_eptinv,
+                              id_eta, 0.0, id_phi, 0.0, id_ptinv, id_eptinv, m_UseAbsPt);
+
+
+   ATH_MSG_DEBUG(" REGTEST Resolution / IdRes / muFastRes / combRes:"
+         << " / " << std::setw(11) << id_eptinv / CLHEP::GeV
+         << " / " << std::setw(11) << extr_eptinv / CLHEP::GeV
+         << " / " << std::setw(11) << combPtRes / CLHEP::GeV );
+
+   ATH_MSG_DEBUG(" REGTEST Momentum / IdPt / muFastPt  / CombPt :"
+         << " / " << std::setw(11) << 1. / id_ptinv / CLHEP::GeV
+         << " / " << std::setw(11) << 1. / ptinv / CLHEP::GeV
+         << " / " << std::setw(11) << 1. / combPtInv / CLHEP::GeV );
+
+   ATH_MSG_DEBUG(" REGTEST Chi2 / ndof :"
+         << " / " << std::setw(11) << chi2
+         << " / " << std::setw(11) << ndof );
+
+   //Cuts
+   double winEtaSigma = m_WinEta;
+   double winPhiSigma = m_WinPhi;
+   double maxChi2     = m_Chi2Max;
+   if (isTS) { //Trigger Station (barrel/EC)
+      winEtaSigma = m_WinEta_TS;
+      winPhiSigma = m_WinPhi_TS;
+      maxChi2     = m_Chi2Max_TS;
+   } else { //if endcaps and not TS
+      if (!isBarrel) {
+         winEtaSigma = m_WinEta_EC;
+         winPhiSigma = m_WinPhi_EC;
+         maxChi2     = m_Chi2Max_EC;
+      }
+   }
+   bool isFT = false;
+   if (isBarrel)
+      if ((id_phi >= -2.60 && id_phi <= -2.10) || (id_phi >= -1.10 && id_phi <= -0.50)) isFT = true;
+   if (isFT) { //if MS-feet region
+      winEtaSigma = m_WinEta_FE;
+      winPhiSigma = m_WinPhi_FE;
+      maxChi2     = m_Chi2Max_FE;
+   }
+
+   ATH_MSG_DEBUG(" REGTEST DeltaEta / DeltaPhi / WinEta / WinPhi:"
+         << " / " << std::setw(11) << fabs(deta)
+         << " / " << std::setw(11) << fabs(dphi)
+         << " / " << std::setw(11) << m_WeightEta*winEtaSigma*sqrt(extr_eeta * extr_eeta)
+         << " / " << std::setw(11) << m_WeightPhi*winPhiSigma*sqrt(extr_ephi * extr_ephi) );
+
+   if (fabs(deta) > m_WeightEta * winEtaSigma * sqrt(extr_eeta * extr_eeta)) {
+      return 4;
+   }
+   if (fabs(dphi) > m_WeightPhi * winPhiSigma * sqrt(extr_ephi * extr_ephi)) {
+      return 5;
+   }
+   if (ndof >= m_NdofMin) {
+      if (chi2 > maxChi2) return 6;
+   }
+
+   return 0; //match OK
+}
+
+
+/** @fn bool muCombMT::execute()
+ * @brief Execute() method.
+ * @return bool
+ */
+StatusCode muCombMT::execute()
+{
+   using namespace Monitored;
+   using namespace xAOD;
+
+   auto ctx = getContext();
+
+   // Monitoring variables
+   //Timer
+   auto timer = MonitoredTimer::declare("TIME_execute");
+   //Input
+   auto m_ptMS = MonitoredScalar::declare("PtMS",        -9999.);
+   auto m_etaMS = MonitoredScalar::declare("EtaMS",      -9999.);
+   auto m_phiMS = MonitoredScalar::declare("PhiMS",      -9999.);
+   auto m_zetaMS = MonitoredScalar::declare("ZetaMS",    -9999.);
+   //ID
+   auto m_ptID = MonitoredScalar::declare("PtID",        -9999.);
+   auto m_etaID = MonitoredScalar::declare("EtaID",      -9999.);
+   auto m_phiID = MonitoredScalar::declare("PhiID",      -9999.);
+   auto m_zetaID = MonitoredScalar::declare("ZetaID",    -9999.);
+   //Combined
+   auto m_ptMC = MonitoredScalar::declare("PtMC",        -9999.);
+   auto m_dEta = MonitoredScalar::declare("DEta",        -9999.);
+   auto m_dPhi = MonitoredScalar::declare("DPhi",        -9999.);
+   auto m_dZeta = MonitoredScalar::declare("DZeta",      -9999.);
+   auto m_dR = MonitoredScalar::declare("DeltaR",        -9999.);
+   //Failed
+   auto m_ptFL = MonitoredScalar::declare("PtFL",        -9999.);
+   auto m_etaFL = MonitoredScalar::declare("EtaFL",      -9999.);
+   auto m_phiFL = MonitoredScalar::declare("PhiFL",      -9999.);
+   //Info
+   auto m_efficiency = MonitoredScalar::declare<int>("Efficiency",  -1);
+   auto m_StrategyMC = MonitoredScalar::declare<int>("StrategyMC",  -1);
+   auto m_ErrorFlagMC = MonitoredScalar::declare<int>("ErrorFlagMC", 0);
+   auto m_MatchFlagMC = MonitoredScalar::declare<int>("MatchFlagMC", 0);
+
+
+   auto mon = MonitoredScope::declare(m_monTool, timer, m_ptMS, m_etaMS, m_phiMS, m_zetaMS, 
+                                                        m_ptID, m_etaID, m_phiID, m_zetaID, 
+                                                        m_ptMC, m_dEta, m_dPhi, m_dZeta, m_dR,
+                                                        m_ptFL, m_etaFL, m_phiFL,
+                                                        m_efficiency, m_StrategyMC, m_ErrorFlagMC, m_MatchFlagMC);
+
+
+   m_StrategyMC  = m_AlgoStrategy;
+
+   //Magnetic field status
+   bool toroidOn   = !m_assumeToroidOff;
+   bool solenoidOn = !m_assumeSolenoidOff;
+   if (m_MagFieldSvc) {
+      toroidOn  = m_MagFieldSvc->toroidOn() && !m_assumeToroidOff;
+      solenoidOn = m_MagFieldSvc->solenoidOn() && !m_assumeSolenoidOff;
+   }
+   ATH_MSG_DEBUG( "=========== Magnetic Field Status ========== " );
+   ATH_MSG_DEBUG( " Assuming Toroid OFF is:                  " << (m_assumeToroidOff ? "TRUE" : "FALSE") );
+   ATH_MSG_DEBUG( " Assuming Solenoid OFF is:                " << (m_assumeSolenoidOff ? "TRUE" : "FALSE") );
+   ATH_MSG_DEBUG( " ---> Solenoid : " << ((solenoidOn) ? "ON" : "OFF") );
+   ATH_MSG_DEBUG( " ---> Toroid   : " << ((toroidOn) ?   "ON" : "OFF") );
+
+   // Algorithm strategy
+   // select best matchinig strategy
+   int usealgo = 0;                           //extrapolated muon - ID match (default)
+   if (solenoidOn) {
+      if (toroidOn) {
+         if (m_AlgoStrategy == 0)  usealgo = 0;           //extrapolated muon - ID match
+         else                      usealgo = 1;           //simple R-match w/o extrapolation (pt from combined MS-ID)
+      } else {
+         usealgo = 2;   //simple R-match w/o extrapolation (pt from ID)
+      }
+   } else {
+      if (toroidOn) usealgo = 3;           //simple R-match w/o extrapolation (pt from MS)
+      else          usealgo = 4;           //simple R-match w/o extrapolation (pt inf)
+   }
+
+   ATH_MSG_DEBUG( "MuCombStrategy: " << usealgo );
+
+   ATH_MSG_DEBUG( "=========== Matching windows g4 ========== " );
+   ATH_MSG_DEBUG( " WinEtaSigma g4: " << m_WinEta_g4 );
+   ATH_MSG_DEBUG( " WinPhiSigma g4: " << m_WinPhi_g4 );
+   ATH_MSG_DEBUG( " WinEtaSigma g4 EC: " << m_WinEta_EC_g4 );
+   ATH_MSG_DEBUG( " WinPhiSigma g4 EC: " << m_WinPhi_EC_g4 );
+   ATH_MSG_DEBUG( " WeightEta g4: " << m_WeightEta_g4 );
+   ATH_MSG_DEBUG( " WeightPhi g4: " << m_WeightPhi_g4 );
+   ATH_MSG_DEBUG( " Chi2Weight g4: " << m_Chi2Weight_g4 );
+   ATH_MSG_DEBUG( " " );
+
+   // Create Combined muon collection and record it with WriteHandle
+   auto muonCBColl = SG::makeHandle (m_outputCBmuonCollKey, ctx);
+   ATH_CHECK( muonCBColl.record (std::make_unique<xAOD::L2CombinedMuonContainer>(),
+                                 std::make_unique<xAOD::L2CombinedMuonAuxContainer>()) );
+
+   // Get input for seeding
+   auto muonColl = SG::makeHandle(m_muonCollKey, ctx);  //SA muons
+
+   // useL1 commented code to be removed once full muon chain with MT tested (SG)
+   //Bool_t useL1 = false;
+   if (muonColl->size() == 0) {
+     //ATH_MSG_DEBUG(" L2 SA Muon collection size = 0");
+     //if (usealgo == 2) {
+     //    ATH_MSG_DEBUG(" L2StandAloneMuonContainer not found -> use L1 ROI " );
+     //    useL1 = true;
+     //} else {
+     ATH_MSG_DEBUG(" L2StandAloneMuonContainer empty -> stop processing RoI, no match" );
+     return StatusCode::SUCCESS;
+     //}
+   }
+
+   // useL1 commented code to be removed once full muon chain with MT tested (SG)
+   //xAOD::L2StandAloneMuonContainer* muonColl = const_cast<xAOD::L2StandAloneMuonContainer*>(const_muonColl);
+
+   // retrieve L2StandAloneMuon (assumed to be the first element)
+   const xAOD::L2StandAloneMuon* muonSA = muonColl->front();
+
+   xAOD::L2CombinedMuon* muonCB = new xAOD::L2CombinedMuon();
+   muonCB->makePrivateStore();
+   muonCB->setPt(0.0);
+   muonCB->setStrategy(usealgo);
+
+   // check muonSA pt != 0
+   if (muonSA->pt() == 0.) {
+      m_ErrorFlagMC = 1;
+      if (usealgo == 2 || usealgo == 4) {
+         ATH_MSG_DEBUG(" L2StandAloneMuon pt = 0 --> using angular match" );
+         //if (usealgo == 2) useL1 = true;
+      } else {
+         ATH_MSG_DEBUG(" L2StandAloneMuon pt = 0 --> stop processing RoI, no match" );
+         muonCB->setErrorFlag(m_ErrorFlagMC);
+         muonCBColl->push_back(muonCB);
+         return StatusCode::SUCCESS;
+      }
+   }
+
+   // useL1 commented code to be removed once full muon chain with MT tested (SG)
+   //double ptL1    = -999.;
+   //double etaL1   = -999.;
+   //double phiL1   = -999.;
+   double pt      = -999.;
+   double eta     = -999.;
+   double phi     = -999.;
+   double eta_ms  = -999.;
+   double phi_ms  = -999.;
+   double zeta_ms = -999.;
+   // useL1 commented code to be removed once full muon chain with MT tested (SG)
+   //if (useL1) {
+   //   auto muonROIColl = SG::makeHandle(m_muonROICollKey, ctx); // L1 muon ROI
+   //   if (muonROIColl->size() == 0) {
+   //      ATH_MSG_DEBUG(" L1 Muon RoI collection size = 0");
+   //      ATH_MSG_DEBUG(" L2StandAloneMuon pt == 0. && no L1 && torid=OFF --> no match" );
+   //      m_ErrorFlagMC = 1;
+   //      muonCB->setErrorFlag(m_ErrorFlagMC);
+   //      return StatusCode::SUCCESS;
+   //   } else {
+   //      const TrigRoiDescriptor* muonROI = *(muonROIColl->begin());
+   //      ptL1  = (muonRoI)->getThresholdValue();
+   //      etaL1 = (muonRoI)->eta();
+   //      phiL1 = (muonRoI)->phi();
+   //      ATH_MSG_DEBUG( " Input L1 muon pt (GeV) = " << (muonROI)->getThresholdValue()
+   //           <<  " / eta   = " << (muonROI)->eta()
+   //           <<  " / phi   = " << (muonROI)->phi()
+   //           <<  " / roiID = " << (muonROI)->roiId() );
+   //   }
+   //} else {
+      // Save SA muon EL into CB muon
+      ElementLink<xAOD::L2StandAloneMuonContainer> muonSAEL(*muonColl, 0);
+      muonCB->setMuSATrackLink(muonSAEL);
+
+      pt       = muonSA->pt();
+      eta      = muonSA->eta();
+      phi      = muonSA->phi();
+      eta_ms   = muonSA->etaMS();
+      phi_ms   = muonSA->phiMS();
+      zeta_ms  = muonSA->zMS();
+
+      ATH_MSG_DEBUG(" Input L2StandaloneMuon pt (GeV) = " << pt
+               << " / eta = "                    << eta
+               << " / phi = "                    << phi
+               << " / etaMS = "                  << eta_ms
+               << " / phiMS = "                  << phi_ms
+               << " / zMS = "                    << zeta_ms);
+   //}
+
+   // ID tracks Decoding
+
+   // how to retrieve a specific colection name?
+   SG::ReadHandle<xAOD::TrackParticleContainer> idTrackParticles(m_TrackParticleContainerKey, ctx); //L2 ID trks
+   if (!idTrackParticles.isValid()){
+      ATH_MSG_DEBUG(" Failed to get xAOD::TrackParticleContainer --> no match" );
+      m_ErrorFlagMC = 2;
+      muonCB->setErrorFlag(m_ErrorFlagMC);
+      muonCBColl->push_back(muonCB);
+      return StatusCode::SUCCESS;
+   }
+   if (idTrackParticles->size() < 1){
+      ATH_MSG_DEBUG(" xAOD::TrackParticleContainer has 0 tracks --> no match" );
+      m_ErrorFlagMC = 2;
+      muonCB->setErrorFlag(m_ErrorFlagMC);
+      muonCBColl->push_back(muonCB);
+      return StatusCode::SUCCESS;
+   }
+
+   ATH_MSG_DEBUG( " Found xAOD::TrackParticleContainer with size: " << idTrackParticles->size() );
+
+   // matching
+   double ptinv_comb = 0.;
+   double ptres_comb = 0.001;
+   double chi2_comb  = 1.0e33;
+   int    ndof_comb  = -1;
+   double best_dr    = 1.0e33;
+   double best_deta  = 1.0e33;
+   double best_dphi  = 1.0e33;
+   bool   has_match  = false;
+   int    imatch     = -1;
+   int    matched_trk_idx = -1;
+   int    matched_trk_idx_tmp = -1;
+
+
+   for(const auto trkit:(*idTrackParticles)) {
+
+      matched_trk_idx_tmp++;
+      double ptinv_tmp = 0.;
+      double ptres_tmp = 0.001;
+      double deta_tmp  = 0.;
+      double dphi_tmp  = 0.;
+      double dr_tmp    = 0.;
+      double chi2_tmp  = 0.;
+      int    ndof_tmp  = 0;
+      bool   has_match_tmp = false;
+      int    imatch_tmp    = -1;
+
+      //Select tracks
+      double phi_id    = (trkit)->phi();
+      double eta_id    = (trkit)->eta();
+      double qoverp_id = (trkit)->qOverP();
+      double q_id      = ((trkit)->qOverP() > 0 ? 1.0 : -1.0);
+      double pt_id     = (trkit)->pt() * q_id;
+
+      double e_qoverp_id = std::sqrt((trkit)->definingParametersCovMatrix()(Trk::qOverP,Trk::qOverP));
+      double e_phi_id = std::sqrt((trkit)->definingParametersCovMatrix()(Trk::phi0,Trk::phi0));
+      double e_theta_id = std::sqrt((trkit)->definingParametersCovMatrix()(Trk::theta,Trk::theta));
+      double tanthetaov2 = fabs(std::exp(-eta));
+      double e_eta_id = fabs(0.5 * (1./tanthetaov2 + tanthetaov2) * e_theta_id);
+
+      double e_qoverpt_id = e_qoverp_id;
+      double theta_id = (trkit)->theta();
+      if (sin(theta_id) != 0) e_qoverpt_id /= fabs(sin(theta_id)); //approximate
+
+      ATH_MSG_DEBUG( " Found track: "
+               << "  with pt (GeV) = " << pt_id / CLHEP::GeV
+               << ", q    = " << q_id
+               << ", eta  = " << eta_id
+               << ", phi  = " << phi_id
+               << ", th   = " << theta_id
+               << ", ephi = " << e_phi_id
+               << ", eth  = " << e_theta_id
+               << ", eeta = " << e_eta_id
+               << ", ip   = " << qoverp_id
+               << ", eip  = " << e_qoverp_id
+               << ", eipt = " << e_qoverpt_id );
+
+      if (usealgo != 3) {
+         if ((fabs(pt_id) / CLHEP::GeV) < m_PtMinTrk)       continue;
+      }
+      if (fabs(eta_id)  > m_EtaMaxTrk)      continue;
+
+      ATH_MSG_DEBUG(" Track selected " );
+
+      if (usealgo > 0) {//DeltaR match
+         // commented code (useL1) to be removed once full muon chain with MT tested
+         //if (useL1) {
+         //   imatch_tmp = drptMatch(ptL1, etaL1, phiL1, pt_id, eta_id, phi_id, usealgo, ptinv_tmp, ptres_tmp, deta_tmp, dphi_tmp, chi2_tmp);
+         //} else {
+            imatch_tmp = drptMatch(muonSA, pt_id, eta_id, phi_id, usealgo, ptinv_tmp, ptres_tmp, deta_tmp, dphi_tmp, chi2_tmp);
+         //}
+         if (imatch_tmp == 0) has_match_tmp = true;
+      } else { //Std match
+         if (!m_useBackExtrapolatorG4) {
+            imatch_tmp = mfMatch(muonSA, eta_id, phi_id, pt_id, q_id, ptinv_tmp, ptres_tmp, deta_tmp, dphi_tmp, chi2_tmp, ndof_tmp);
+            if (imatch_tmp == 0) has_match_tmp = true;
+         } else { //G4 match
+            imatch_tmp = g4Match(muonSA, eta_id, phi_id, pt_id, q_id, e_eta_id, e_phi_id, e_qoverpt_id, ptinv_tmp, ptres_tmp, deta_tmp, dphi_tmp, chi2_tmp, ndof_tmp);
+            if (imatch_tmp == 0) has_match_tmp = true;
+         }
+      }
+
+      imatch = imatch_tmp;
+      if (!has_match_tmp) continue;
+
+      // select nearest track
+      dr_tmp = sqrt(deta_tmp * deta_tmp + dphi_tmp * dphi_tmp);
+
+      if (chi2_tmp <= chi2_comb) {//Select nearest track
+         has_match  = true;
+         chi2_comb  = chi2_tmp;
+         ndof_comb  = ndof_tmp;
+         ptinv_comb = ptinv_tmp;
+         ptres_comb = ptres_tmp;
+         best_deta  = deta_tmp;
+         best_dphi  = dphi_tmp;
+         best_dr    = dr_tmp;
+         imatch     = imatch_tmp;
+         matched_trk_idx  = matched_trk_idx_tmp;
+      }
+
+   }//Tracks loop
+
+   //Set monitored quantities (monitor only pt>6 GeV/c && standard matching)
+   if (usealgo == 0 && fabs(pt) >= 6.) {
+      m_ptMS       = pt;
+      m_etaMS      = eta;
+      m_phiMS      = phi;
+      m_zetaMS     = zeta_ms;
+      m_ptFL       = pt;
+      m_etaFL      = eta;
+      m_phiFL      = phi;
+      if (m_ptMS >  100.) m_ptMS =  101.5;
+      if (m_ptMS < -100.) m_ptMS = -101.5;
+      if (m_ptFL >  100.) m_ptFL =  101.5;
+      if (m_ptFL < -100.) m_ptFL = -101.5;
+   }
+
+   if (!has_match) {
+      m_ErrorFlagMC = 3;
+      m_MatchFlagMC = imatch;
+      if (usealgo == 0 && fabs(pt) >= 6.)  m_efficiency = 0; //monitor only efficiency for mu6 && standard matching
+      ATH_MSG_DEBUG( " No matched ID tracks --> no match" );
+      muonCB->setErrorFlag(m_ErrorFlagMC);
+      muonCB->setMatchFlag(m_MatchFlagMC);
+      muonCBColl->push_back(muonCB);
+      return StatusCode::SUCCESS;
+   }
+
+   //Save EL to ID trk into CB muon
+   ElementLink<xAOD::TrackParticleContainer> idtrkEL(*idTrackParticles, matched_trk_idx);
+   muonCB->setIdTrackLink(idtrkEL);
+
+   double pt_id        = muonCB->idTrack()->pt();
+   double q_id         = ((muonCB->idTrack()->qOverP()) > 0 ? 1.0 : -1.0);
+   double phi_id       = muonCB->idTrack()->phi();
+   double eta_id       = muonCB->idTrack()->eta();
+   //const Trk::Perigee& idtrk_perigee = muonCB->idTrack()->perigeeParameters();
+   double zPos_id      = muonCB->idTrack()->z0(); //idtrk_perigee.parameters()[Trk::z0];
+
+   ATH_MSG_DEBUG(" SA muon macthed to ID track ..." );
+
+   //Update monitored vars
+   m_MatchFlagMC = imatch;
+   m_ptFL        = -9999.;
+   m_etaFL       = -9999.;
+   m_phiFL       = -9999.;
+   if (usealgo == 0 && fabs(pt) >= 6.) {
+      m_efficiency = 1;
+      m_ptID       = pt_id / CLHEP::GeV; //in GeV/c
+      m_etaID      = eta_id;
+      m_phiID      = phi_id;
+      m_zetaID     = zPos_id;
+      m_ptMC       = 1. / (ptinv_comb * CLHEP::GeV); //in GeV/c
+      m_dZeta      = zeta_ms - zPos_id;
+      m_dPhi       = best_dphi;
+      m_dEta       = best_deta;
+      m_dR         = best_dr;
+
+      if (m_ptMC >  100.) m_ptMC =  101.5;
+      if (m_ptMC < -100.) m_ptMC = -101.5;
+      if (m_ptID >  100.) m_ptID =  101.5;
+      if (m_ptID < -100.) m_ptID = -101.5;
+   }
+
+   double prt_pt = pt;
+   // commented code (useL1) to be removed once full muon chain with MT tested
+   //if (useL1) prt_pt = ptL1;
+   ATH_MSG_DEBUG( " REGTEST Combination chosen: "
+         << " usealgo / IdPt (GeV) / muonPt (GeV) / CombPt (GeV) / chi2 / ndof: "
+         << " / " << usealgo << " / " << pt_id*q_id / CLHEP::GeV << " / " << prt_pt << " / " << 1. / ptinv_comb / CLHEP::GeV << " / " << chi2_comb << " / " << ndof_comb );
+
+   muonCB->setPt(fabs(1. / ptinv_comb));
+   muonCB->setEta(eta_id);
+   muonCB->setPhi(phi_id);
+
+   float mcq = -1.0;
+   if (ptinv_comb > 0) mcq = 1.0;
+
+   muonCB->setCharge(mcq);
+
+   float mcresu = fabs(ptres_comb / (ptinv_comb * ptinv_comb));
+   ATH_MSG_DEBUG( " SigmaPt (GeV) is: " << mcresu / CLHEP::GeV );
+   muonCB->setSigmaPt(mcresu);
+
+   muonCB->setErrorFlag(m_ErrorFlagMC);
+   muonCB->setMatchFlag(m_MatchFlagMC);
+
+   muonCBColl->push_back(muonCB);
+   return StatusCode::SUCCESS;
+}
diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/Root/FeatureContainer.cxx b/Trigger/TrigAnalysis/TrigDecisionTool/Root/FeatureContainer.cxx
index 7bea9e139d8..183181a0ac6 100644
--- a/Trigger/TrigAnalysis/TrigDecisionTool/Root/FeatureContainer.cxx
+++ b/Trigger/TrigAnalysis/TrigDecisionTool/Root/FeatureContainer.cxx
@@ -79,7 +79,7 @@ Trig::FeatureContainer::navigation() const {
 
 bool 
 Trig::FeatureContainer::ordering_by_objects_attached2::weakOrder(const HLT::TriggerElement* a, const HLT::TriggerElement* b,
-                                                                 void* obj_a, void* obj_b) {
+                                                                 void* obj_a, void* obj_b) const {
   // returning False -> no insertion into set
   // returning True -> insertion into set
   // each pair of candidates is tested twice (if test returns False twice, then no insertion into set)
@@ -117,7 +117,7 @@ Trig::FeatureContainer::ordering_by_objects_attached2::weakOrder(const HLT::Trig
 //this is a helper method to weakly order feature access helpers.
 class order_by_clid_and_index {
 public:
-  bool operator()(const Trig::TypelessFeature& a,const Trig::TypelessFeature& b){
+  bool operator()(const Trig::TypelessFeature& a,const Trig::TypelessFeature& b) const {
     if ( a.accessHelper().getCLID() == b.accessHelper().getCLID()) {
       return a.accessHelper().getIndex() < b.accessHelper().getIndex();
     }
diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/FeatureContainer.h b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/FeatureContainer.h
index 22bd3c3ef8e..b8871f0adf7 100644
--- a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/FeatureContainer.h
+++ b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/FeatureContainer.h
@@ -144,8 +144,8 @@ namespace Trig {
     class ordering_by_objects_attached2 {
     public:
       template<class T>
-      bool operator()(Feature<T> a, Feature<T> b);
-      bool weakOrder(const HLT::TriggerElement* te_a, const HLT::TriggerElement* te_b, void* obj_a, void* obj_b);
+      bool operator()(Feature<T> a, Feature<T> b) const;
+      bool weakOrder(const HLT::TriggerElement* te_a, const HLT::TriggerElement* te_b, void* obj_a, void* obj_b) const;
     };
 
   };
@@ -155,7 +155,7 @@ namespace Trig {
 
 template<class T> 
 bool
-Trig::FeatureContainer::ordering_by_objects_attached2::operator()(Feature<T> a, Feature<T> b) {
+Trig::FeatureContainer::ordering_by_objects_attached2::operator()(Feature<T> a, Feature<T> b) const {
   bool ret = weakOrder(a.te(), b.te(), (void*) a.cptr(), (void*) b.cptr());
   //std::cout << " ==> " << (ret?"TRUE":"FALSE") << std::endl;
   return ret;
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaAnalysisBaseTool.cxx b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaAnalysisBaseTool.cxx
index 74d6bcf195f..95a8cfd5eb2 100644
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaAnalysisBaseTool.cxx
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaAnalysisBaseTool.cxx
@@ -90,7 +90,7 @@ TrigEgammaAnalysisBaseTool( const std::string& myname )
 void TrigEgammaAnalysisBaseTool::updateDetail(Property& /*p*/){
     plot()->setDetail(m_detailedHists);
     // Detail for tools needs to be reset for every call in Analysis
-    for( const auto& tool : m_tools) {
+    for( auto& tool : m_tools) {
         tool->setDetail(m_detailedHists); 
     }
 }
@@ -101,14 +101,14 @@ void TrigEgammaAnalysisBaseTool::updateAltBinning(Property& /*p*/){
 
 void TrigEgammaAnalysisBaseTool::updateTP(Property& /*p*/){
     plot()->setTP(m_tp);
-    for( const auto& tool : m_tools) {
+    for( auto& tool : m_tools) {
         tool->setTP(m_tp);
     }
 }
 
 void TrigEgammaAnalysisBaseTool::updateEmulation(Property& /*p*/){
     plot()->setEmulation(m_doEmulation);
-    for( const auto& tool : m_tools) {
+    for( auto& tool : m_tools) {
         tool->setEmulation(m_doEmulation);
         ATH_MSG_INFO("updateEmulation() property for tool with name: " << tool->name());
         tool->setEmulationTool(m_emulationTool);
@@ -175,7 +175,7 @@ StatusCode TrigEgammaAnalysisBaseTool::initialize() {
 
     // propagate the emulation tool for all tools
     if( m_doEmulation ){
-      for( const auto& tool : m_tools) {
+      for( auto& tool : m_tools) {
         ATH_MSG_INFO("Propagate emulation tool handler to: " << tool->name() );
         tool->setEmulationTool(m_emulationTool);  
       }
@@ -201,7 +201,7 @@ StatusCode TrigEgammaAnalysisBaseTool::initialize() {
 
 StatusCode TrigEgammaAnalysisBaseTool::book() {
     StatusCode sc = StatusCode::FAILURE;
-    for( const auto& tool : m_tools) {
+    for( auto& tool : m_tools) {
         tool->setPlotTool(m_plot);
     }
 
@@ -247,7 +247,7 @@ StatusCode TrigEgammaAnalysisBaseTool::finalize() {
 
     ATH_MSG_VERBOSE( "Finalizing tool " << name() );
     StatusCode sc;
-    for( const auto& tool : m_tools) {
+    for( auto& tool : m_tools) {
         try {
             ATH_MSG_DEBUG("child Finalize " << tool->name());
             sc = tool->childFinalize();
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavAnalysisTool.cxx b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavAnalysisTool.cxx
index e645c30bb65..0c030885532 100644
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavAnalysisTool.cxx
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavAnalysisTool.cxx
@@ -99,7 +99,7 @@ StatusCode TrigEgammaNavAnalysisTool::childExecute(){
             return StatusCode::SUCCESS;
         }
         // Fill distributions / trigger
-        for( const auto& tool : m_tools) {
+        for( auto& tool : m_tools) {
             // Set detail level from analysis tool each time
             tool->setDetail(getDetail()); 
             tool->setTP(getTP()); 
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavTPAnalysisTool.cxx b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavTPAnalysisTool.cxx
index 22ad1dad5f1..50d2e171e12 100644
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavTPAnalysisTool.cxx
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavTPAnalysisTool.cxx
@@ -163,7 +163,7 @@ StatusCode TrigEgammaNavTPAnalysisTool::childExecute()
 
         // Just for counting
         ATH_MSG_DEBUG("Probes " << m_probeElectrons.size() << " Pairs " << m_pairObj.size() );
-        for( const auto& tool : m_tools) {
+        for( auto& tool : m_tools) {
             tool->setDetail(getDetail()); 
             tool->setTP(getTP()); 
             tool->setEmulation(getEmulation());
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/TrigEgammaAnalysisTools/TrigEgammaAnalysisBaseTool.h b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/TrigEgammaAnalysisTools/TrigEgammaAnalysisBaseTool.h
index 3c52f9393f9..c6abee3996d 100644
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/TrigEgammaAnalysisTools/TrigEgammaAnalysisBaseTool.h
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/TrigEgammaAnalysisTools/TrigEgammaAnalysisBaseTool.h
@@ -185,9 +185,9 @@ protected:
   Trig::ITrigEgammaEmulationTool *emulation(){return &*m_emulationTool;}
 
   // Retrieve Properties
-  bool getDetail(){return m_detailedHists;}
-  bool getTP(){return m_tp;}
-  bool getEmulation(){return m_doEmulation;}
+  bool getDetail() const {return m_detailedHists;}
+  bool getTP() const {return m_tp;}
+  bool getEmulation() const {return m_doEmulation;}
 
   // TAccept
   Root::TAccept getAccept(){return m_accept;}
diff --git a/Trigger/TrigAnalysis/TrigJiveXML/TrigJiveXML/LVL1ResultRetriever.h b/Trigger/TrigAnalysis/TrigJiveXML/TrigJiveXML/LVL1ResultRetriever.h
index 6a3145b968a..85e8191bc30 100755
--- a/Trigger/TrigAnalysis/TrigJiveXML/TrigJiveXML/LVL1ResultRetriever.h
+++ b/Trigger/TrigAnalysis/TrigJiveXML/TrigJiveXML/LVL1ResultRetriever.h
@@ -32,8 +32,8 @@ namespace JiveXML{
     StatusCode initialize(); 
 
     /// Subroutine for constructing the item list string
-    StatusCode getItemLists(const Trig::ChainGroup* m_chains, 
-                            std::string& m_listName, std::string& m_prescaleName);
+    StatusCode getItemLists(const Trig::ChainGroup* chains, 
+                            std::string& listName, std::string& prescaleName);
 
   private:
 
diff --git a/Trigger/TrigAnalysis/TrigJiveXML/src/EmTauROIRetriever.cxx b/Trigger/TrigAnalysis/TrigJiveXML/src/EmTauROIRetriever.cxx
index 35e21f2e9fe..67025b1880b 100755
--- a/Trigger/TrigAnalysis/TrigJiveXML/src/EmTauROIRetriever.cxx
+++ b/Trigger/TrigAnalysis/TrigJiveXML/src/EmTauROIRetriever.cxx
@@ -85,7 +85,6 @@ namespace JiveXML {
 
     const DataVector<LVL1::CPMRoI>* cpmRoICollection = 0;
     LVL1::CPRoIDecoder decoder;
-    double m_roiPhi=0.;
     // L1JetObject -not- available
     m_sgKey = "CPMRoIs";
     if ( evtStore()->retrieve(cpmRoICollection, m_sgKey).isFailure() ) {
@@ -98,17 +97,20 @@ namespace JiveXML {
       DataVector<LVL1::CPMRoI>::const_iterator roi_end = cpmRoICollection->end();
 	
       for(;roi_it!=roi_end;++roi_it) {
-        LVL1::CPMRoI* roi = (*roi_it);
+        const LVL1::CPMRoI* roi = (*roi_it);
+
+        // different coordinates in phi, correct for this:
+        auto fixphi = [] (double phi)
+        {
+          if (phi > M_PI) return phi - 2*M_PI;
+          return phi;
+        };
 
   	const LVL1::CoordinateRange coord(decoder.coordinate(roi->roiWord()));
 	const double roiEta = coord.eta();
-	const double roiPhi = coord.phi();
-        m_roiPhi = roiPhi;  
-
-        // different coordinates in phi, correct for this:
-        if (m_roiPhi > M_PI ){ m_roiPhi = m_roiPhi-2*M_PI; }
+	const double roiPhi = fixphi (coord.phi());
 
-	phi.push_back(DataType( m_roiPhi ));
+	phi.push_back(DataType( roiPhi ));
 	eta.push_back(DataType( roiEta ));
 
          // info from Alan Watson: energy would need to be decoded
diff --git a/Trigger/TrigAnalysis/TrigJiveXML/src/JetROIRetriever.cxx b/Trigger/TrigAnalysis/TrigJiveXML/src/JetROIRetriever.cxx
index e5bf07dc0ab..b9cae88b01c 100755
--- a/Trigger/TrigAnalysis/TrigJiveXML/src/JetROIRetriever.cxx
+++ b/Trigger/TrigAnalysis/TrigJiveXML/src/JetROIRetriever.cxx
@@ -79,7 +79,6 @@ namespace JiveXML {
 
     const DataVector<LVL1::JEMRoI>* jemRoICollection = 0;
     LVL1::JEPRoIDecoder decoder;
-    double m_roiPhi=0.;
     // L1JetObject -not- available
     m_sgKey = "JEMRoIs";
     if ( evtStore()->retrieve(jemRoICollection, m_sgKey).isFailure() ) {
@@ -92,17 +91,20 @@ namespace JiveXML {
       DataVector<LVL1::JEMRoI>::const_iterator roi_end = jemRoICollection->end();
 	
       for(;roi_it!=roi_end;++roi_it) {
-        LVL1::JEMRoI* roi = (*roi_it);
+        const LVL1::JEMRoI* roi = (*roi_it);
+
+        // different coordinates in phi, correct for this:
+        auto fixphi = [] (double phi)
+        {
+          if (phi > M_PI) return phi - 2*M_PI;
+          return phi;
+        };
 
   	const LVL1::CoordinateRange coord(decoder.coordinate(roi->roiWord()));
 	const double roiEta = coord.eta();
-	const double roiPhi = coord.phi();
-        m_roiPhi = roiPhi;  
-
-        // different coordinates in phi, correct for this:
-        if (m_roiPhi > M_PI ){ m_roiPhi = m_roiPhi-2*M_PI; }
+	const double roiPhi = fixphi (coord.phi());
 
-	phi.push_back(DataType( m_roiPhi ));
+	phi.push_back(DataType( roiPhi ));
 	eta.push_back(DataType( roiEta ));
 
          // info from Alan Watson: energy would need to be decoded
diff --git a/Trigger/TrigAnalysis/TrigJiveXML/src/LVL1ResultRetriever.cxx b/Trigger/TrigAnalysis/TrigJiveXML/src/LVL1ResultRetriever.cxx
index 9f7308bb54f..78553cb0ae7 100755
--- a/Trigger/TrigAnalysis/TrigJiveXML/src/LVL1ResultRetriever.cxx
+++ b/Trigger/TrigAnalysis/TrigJiveXML/src/LVL1ResultRetriever.cxx
@@ -67,13 +67,13 @@ namespace JiveXML {
    * Get a long strong with all the item lists and prescales that are passed by
    * the given chain group
    **/
-  StatusCode LVL1ResultRetriever::getItemLists(const Trig::ChainGroup* m_chains, 
-      std::string& m_itemList, std::string& m_prescaleList) {
+  StatusCode LVL1ResultRetriever::getItemLists(const Trig::ChainGroup* chains, 
+      std::string& itemList, std::string& prescaleList) {
 
     std::string sig_name;
 
     //Get a list of L1 items
-    std::vector<std::string> chainList = m_chains->getListOfTriggers();
+    std::vector<std::string> chainList = chains->getListOfTriggers();
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of items in chain is " << chainList.size() << endmsg;
 
     for (std::vector<std::string>::iterator itemItr = chainList.begin();
@@ -104,20 +104,20 @@ namespace JiveXML {
       if ( m_trigDec->isPassed((*itemItr)) ) { 
 
         //Add item to list
-        m_itemList += "-" + myItem; 
+        itemList += "-" + myItem; 
 
         // prescale factor
-        m_prescaleList += "-" + DataType(  m_trigDec->getPrescale(*itemItr) ).toString(); 
+        prescaleList += "-" + DataType(  m_trigDec->getPrescale(*itemItr) ).toString(); 
       }
     }
 
     //Mark empty item lists
-    if ( m_itemList.empty() ){ m_itemList = "empty"; }
-    if ( m_prescaleList.empty() ){ m_prescaleList = "empty"; }
+    if ( itemList.empty() ){ itemList = "empty"; }
+    if ( prescaleList.empty() ){ prescaleList = "empty"; }
 
     //print debug information
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " itemList: " << m_itemList << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " prescaleList: " << m_prescaleList << endmsg;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " itemList: " << itemList << endmsg;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " prescaleList: " << prescaleList << endmsg;
 
     return StatusCode::SUCCESS;
   }
diff --git a/Trigger/TrigAnalysis/TrigJiveXML/src/MuonROIRetriever.cxx b/Trigger/TrigAnalysis/TrigJiveXML/src/MuonROIRetriever.cxx
index 33288939f52..18e047b7290 100755
--- a/Trigger/TrigAnalysis/TrigJiveXML/src/MuonROIRetriever.cxx
+++ b/Trigger/TrigAnalysis/TrigJiveXML/src/MuonROIRetriever.cxx
@@ -58,9 +58,9 @@ namespace JiveXML {
         thrNumber.push_back(DataType( itMU->getThrNumber()));
 
      // prevent empty threshold name list
-	std::string m_thrName = itMU->getThrName();
-        if (m_thrName ==""){ m_thrName = "empty"; };
-        thrName.push_back(DataType( m_thrName ));
+	std::string thisThrName = itMU->getThrName();
+        if (thisThrName ==""){ thisThrName = "empty"; };
+        thrName.push_back(DataType( thisThrName ));
 
         thrValue.push_back(DataType( itMU->getThrValue()));
         energy.push_back(DataType( itMU->getThrValue()/CLHEP::GeV));
diff --git a/Trigger/TrigAnalysis/TrigJiveXML/src/TrigSiSpacePointRetriever.cxx b/Trigger/TrigAnalysis/TrigJiveXML/src/TrigSiSpacePointRetriever.cxx
index 0e6a7e2e95f..29e07f4a96a 100755
--- a/Trigger/TrigAnalysis/TrigJiveXML/src/TrigSiSpacePointRetriever.cxx
+++ b/Trigger/TrigAnalysis/TrigJiveXML/src/TrigSiSpacePointRetriever.cxx
@@ -109,14 +109,14 @@ namespace JiveXML {
   
   StatusCode TrigSiSpacePointRetriever::initialize(){
 
-    const InDetDD::PixelDetectorManager* m_pixel_geomanager;
-    if (detStore()->retrieve(m_pixel_geomanager, "Pixel").isFailure() ){
+    const InDetDD::PixelDetectorManager* pixel_geomanager;
+    if (detStore()->retrieve(pixel_geomanager, "Pixel").isFailure() ){
 	if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not get Pixel GeoModel Manager!" << endmsg;
 	return StatusCode::RECOVERABLE;
     }
 
-    const InDetDD::SCT_DetectorManager* m_sct_geomanager;
-    if ( detStore()->retrieve(m_sct_geomanager, "SCT").isFailure() ){
+    const InDetDD::SCT_DetectorManager* sct_geomanager;
+    if ( detStore()->retrieve(sct_geomanager, "SCT").isFailure() ){
 	if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not get SCT GeoModel Manager!" << endmsg;
 	return StatusCode::RECOVERABLE;
       } 
diff --git a/Trigger/TrigAnalysis/TrigJiveXML/src/TriggerInfoRetriever.cxx b/Trigger/TrigAnalysis/TrigJiveXML/src/TriggerInfoRetriever.cxx
index a3d34450d41..2f3e68a191d 100755
--- a/Trigger/TrigAnalysis/TrigJiveXML/src/TriggerInfoRetriever.cxx
+++ b/Trigger/TrigAnalysis/TrigJiveXML/src/TriggerInfoRetriever.cxx
@@ -172,17 +172,17 @@ namespace JiveXML {
         LVL1_ROI::energysums_type::const_iterator itES  = (roi->getEnergySumROIs()).begin();
         LVL1_ROI::energysums_type::const_iterator itESe = (roi->getEnergySumROIs()).end();
         for (; itES != itESe; ++itES){
-	  float m_Et = itES->getEnergyT()/CLHEP::GeV;
-	  float m_Ex = itES->getEnergyX()/CLHEP::GeV;
-	  float m_Ey = itES->getEnergyY()/CLHEP::GeV;
-	  energySumEtVec.push_back(DataType( m_Et ) );
-	  energyExVec.push_back(DataType( m_Ex ) );
-	  energyEyVec.push_back(DataType( m_Ey ) );
-	  float m_EtMiss = static_cast<long>(sqrt(static_cast<double>(m_Ex*m_Ex + m_Ey*m_Ey)));
-	  energyEtMissVec.push_back(DataType( m_EtMiss ) );
-
-	  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "EnergySum from LVL1_ROI: X:" << m_Ex << ", Y:"
-	      << m_Ey << ", T:" << m_Et << ", ETMiss:" << m_EtMiss << endmsg;
+	  float Et = itES->getEnergyT()/CLHEP::GeV;
+	  float Ex = itES->getEnergyX()/CLHEP::GeV;
+	  float Ey = itES->getEnergyY()/CLHEP::GeV;
+	  energySumEtVec.push_back(DataType( Et ) );
+	  energyExVec.push_back(DataType( Ex ) );
+	  energyEyVec.push_back(DataType( Ey ) );
+	  float EtMiss = static_cast<long>(sqrt(static_cast<double>(Ex*Ex + Ey*Ey)));
+	  energyEtMissVec.push_back(DataType( EtMiss ) );
+
+	  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "EnergySum from LVL1_ROI: X:" << Ex << ", Y:"
+	      << Ey << ", T:" << Et << ", ETMiss:" << EtMiss << endmsg;
         }
       }else{ // empty container
         if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TriggerInfo: LVL1_ROI for EnergySum empty !" << endmsg;
diff --git a/Trigger/TrigAnalysis/TrigMuonMatching/Root/TrigMuonMatching.cxx b/Trigger/TrigAnalysis/TrigMuonMatching/Root/TrigMuonMatching.cxx
index f8740af925e..062535a4c4b 100644
--- a/Trigger/TrigAnalysis/TrigMuonMatching/Root/TrigMuonMatching.cxx
+++ b/Trigger/TrigAnalysis/TrigMuonMatching/Root/TrigMuonMatching.cxx
@@ -242,7 +242,7 @@ namespace Trig {
   Bool_t TrigMuonMatching::isPassedRerun(const std::string& trigger)
   {
     const unsigned int bits = m_trigDecTool->isPassedBits(trigger);
-    if( (bits & TrigDefs::EF_passedRaw) && ! ( bits & TrigDefs::EF_passThrough) && ( bits && TrigDefs::EF_resurrected)){
+    if( (bits & TrigDefs::EF_passedRaw) && ! ( bits & TrigDefs::EF_passThrough) && ( bits & TrigDefs::EF_resurrected)){
       return true;
     }
     return false;
diff --git a/Trigger/TrigConfiguration/TrigConfHLTData/TrigConfHLTData/HLTTriggerElement.h b/Trigger/TrigConfiguration/TrigConfHLTData/TrigConfHLTData/HLTTriggerElement.h
index d2a1027fa0c..40108c331f9 100644
--- a/Trigger/TrigConfiguration/TrigConfHLTData/TrigConfHLTData/HLTTriggerElement.h
+++ b/Trigger/TrigConfiguration/TrigConfHLTData/TrigConfHLTData/HLTTriggerElement.h
@@ -72,8 +72,8 @@ namespace TrigConf {
       void setL2(bool on=true) const { set(); if(on) m_level |= 0x1; else m_level &= 0x2; }
       void setEF(bool on=true) const { set(); if(on) m_level |= 0x2; else m_level &= 0x1; }
       void reset() const { m_level = 0x4; }
-      bool inL2() const { return (m_level|0x1) != 0; }
-      bool inEF() const { return (m_level|0x2) != 0; }
+      bool inL2() const { return (m_level&0x1) != 0; }
+      bool inEF() const { return (m_level&0x2) != 0; }
       bool isSet() const { return (m_level&0x4) == 0; }
 
    private:
diff --git a/Trigger/TrigConfiguration/TrigConfL1Data/Root/HelperFunctions.cxx b/Trigger/TrigConfiguration/TrigConfL1Data/Root/HelperFunctions.cxx
index d9033ec3bdb..b789c4f3a43 100644
--- a/Trigger/TrigConfiguration/TrigConfL1Data/Root/HelperFunctions.cxx
+++ b/Trigger/TrigConfiguration/TrigConfL1Data/Root/HelperFunctions.cxx
@@ -74,13 +74,14 @@ namespace {
    parseToken(const std::string& givenlogic,
               std::string::size_type& pos,
               const std::vector<std::string>& conditions,
-              const std::vector<TrigConf::TriggerThreshold*>& thrs) throw (std::logic_error);
+              const std::vector<TrigConf::TriggerThreshold*>& thrs);
 
 
    TrigConf::TriggerItemNode *
    parseExpr(const std::string& expr,
              const std::vector<std::string>& conditions,
-             const std::vector<TrigConf::TriggerThreshold*>& thrs) throw (std::logic_error) {
+             const std::vector<TrigConf::TriggerThreshold*>& thrs)
+   {
 
 
       std::string::size_type pos  = 0;
@@ -156,7 +157,7 @@ namespace {
    parseToken(const std::string& logic,
               std::string::size_type& pos,
               const std::vector<std::string>& conditions,
-              const std::vector<TrigConf::TriggerThreshold*>& thrs) throw (std::logic_error) {
+              const std::vector<TrigConf::TriggerThreshold*>& thrs) {
 
       // logic should be the definition of a node
       //
@@ -221,7 +222,7 @@ namespace {
 TrigConf::TriggerItemNode *
 TrigConf::buildObjNode(uint32_t condIdx,
                        const vector<string>& conditions, 
-                       const vector<TrigConf::TriggerThreshold*>& thrs) throw (logic_error) {
+                       const vector<TrigConf::TriggerThreshold*>& thrs) {
 
    TriggerItemNode* newNode = new TriggerItemNode(TriggerItemNode::OBJ);
    
@@ -250,7 +251,7 @@ TrigConf::buildObjNode(uint32_t condIdx,
          }
       }
    }
-   catch(std::exception e) {
+   catch(const std::exception& e) {
       std::cout << "Exeption caught in buildObjNode for " << conditions[condIdx-1] << ": " << e.what() << std::endl;
       throw;
    }
@@ -261,7 +262,7 @@ TrigConf::buildObjNode(uint32_t condIdx,
 TrigConf::TriggerItemNode *
 TrigConf::parse(const std::string& givenlogic,
                 const std::vector<std::string>& conditions,
-                const std::vector<TrigConf::TriggerThreshold*>& thrs) throw (std::logic_error) {
+                const std::vector<TrigConf::TriggerThreshold*>& thrs) {
 
    // balance expression
    std::string expr = insertParenthesis(givenlogic);
@@ -287,7 +288,7 @@ TrigConf::parse(const std::string& givenlogic,
 // pos: position of the current opening bracket
 std::string::size_type
 TrigConf::findClosingBracket(std::string::size_type pos,
-                             const std::string& logic) throw (std::logic_error) {
+                             const std::string& logic) {
 
    pos++;
    uint32_t openBrackets = 1;
diff --git a/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerItem.cxx b/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerItem.cxx
index b3180910123..9c65e465143 100644
--- a/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerItem.cxx
+++ b/Trigger/TrigConfiguration/TrigConfL1Data/Root/TriggerItem.cxx
@@ -165,7 +165,7 @@ TriggerItem::setCondition(const string& logic,
    try {
       m_TopNode = TrigConf::parse(logic, conditions, thrs);
    }
-   catch(exception e) {
+   catch(const exception& e) {
       cout << "WARNING: Could not set condition of triggeritem " << name() << " because: " << e.what() << endl;
    }
 }
diff --git a/Trigger/TrigConfiguration/TrigConfL1Data/TrigConfL1Data/HelperFunctions.h b/Trigger/TrigConfiguration/TrigConfL1Data/TrigConfL1Data/HelperFunctions.h
index 0894854a2d7..e717beb2e1e 100644
--- a/Trigger/TrigConfiguration/TrigConfL1Data/TrigConfL1Data/HelperFunctions.h
+++ b/Trigger/TrigConfiguration/TrigConfL1Data/TrigConfL1Data/HelperFunctions.h
@@ -43,14 +43,14 @@ namespace TrigConf {
    TrigConf::TriggerItemNode*
    parse(const std::string& logic,
          const std::vector<std::string>& conditions,
-         const std::vector<TrigConf::TriggerThreshold*>& thrs) throw (std::logic_error);
+         const std::vector<TrigConf::TriggerThreshold*>& thrs);
 
    // returns position of corresponding ')' parenthesis
    // 
    // opening parenthisis is at pos (or before)
    std::string::size_type
    findClosingBracket(std::string::size_type pos,
-                      const std::string& logic) throw (std::logic_error);
+                      const std::string& logic);
    
    // builds an TriggerItemNode(OBJ), set's the TriggerThreshold, multiplicity, and InternalTrigger (if applicable)
    //
@@ -59,7 +59,7 @@ namespace TrigConf {
    TrigConf::TriggerItemNode*
    buildObjNode(uint32_t condIdx,
                 const std::vector<std::string>& conditions, 
-                const std::vector<TrigConf::TriggerThreshold*>& thrs) throw (std::logic_error);
+                const std::vector<TrigConf::TriggerThreshold*>& thrs);
 
    std::string insertParenthesis(const std::string& givenlogic);
 
diff --git a/Trigger/TrigConfiguration/TrigConfStorage/src/TrigConfCoolWriter.cxx b/Trigger/TrigConfiguration/TrigConfStorage/src/TrigConfCoolWriter.cxx
index afda769bab6..41bfa588fc0 100755
--- a/Trigger/TrigConfiguration/TrigConfStorage/src/TrigConfCoolWriter.cxx
+++ b/Trigger/TrigConfiguration/TrigConfStorage/src/TrigConfCoolWriter.cxx
@@ -1286,7 +1286,7 @@ TrigConfCoolWriter::readHLTPayload( unsigned int run,
       hltFrame.setSMK(smk);
       hltFrame.setConfigSource(configSource);
    }
-   catch(cool::ObjectNotFound o) {
+   catch(const cool::ObjectNotFound& o) {
       m_ostream << "<readHLTPayload> No entry found in HLT keys folder for run " << run  << endl;
    }
 }
diff --git a/Trigger/TrigConfiguration/TrigConfStorage/src/XMLBoostHelper.cxx b/Trigger/TrigConfiguration/TrigConfStorage/src/XMLBoostHelper.cxx
index 3317cb21ce5..524dab43605 100644
--- a/Trigger/TrigConfiguration/TrigConfStorage/src/XMLBoostHelper.cxx
+++ b/Trigger/TrigConfiguration/TrigConfStorage/src/XMLBoostHelper.cxx
@@ -21,10 +21,10 @@ TrigConf::readAttribute(const boost::property_tree::ptree& pt, const char* attrn
    try {
       value = pt.get<int>(path);
    }
-   catch(ptree_bad_path) {
+   catch(const ptree_bad_path&) {
       return false;
    }
-   catch(ptree_bad_data e) {
+   catch(const ptree_bad_data& e) {
       cerr << "Attribute '" << attrname << "' is not an int value: " << e.data<string>() << endl;
       throw;
    }
@@ -37,10 +37,10 @@ TrigConf::readAttribute(const boost::property_tree::ptree& pt, const char* attrn
    try {
       value = pt.get<unsigned int>(path);
    }
-   catch(ptree_bad_path) {
+   catch(const ptree_bad_path&) {
       return false;
    }
-   catch(ptree_bad_data e) {
+   catch(const ptree_bad_data& e) {
       cerr << "Attribute '" << attrname << "' is not an int value: " << e.data<string>() << endl;
       throw;
    }
@@ -53,10 +53,10 @@ TrigConf::readAttribute(const boost::property_tree::ptree& pt, const char* attrn
    try {
       value = pt.get<float>(path);
    }
-   catch(ptree_bad_path) { 
+   catch(const ptree_bad_path&) { 
       return false;
    }
-   catch(ptree_bad_data e) {
+   catch(const ptree_bad_data& e) {
       cerr << "Attribute '" << attrname << "' is not a float value: " << e.data<string>() << endl;
       throw;
    }
@@ -69,10 +69,10 @@ TrigConf::readAttribute(const boost::property_tree::ptree& pt, const char* attrn
    try {
       value = pt.get<string>(path);
    }
-   catch(ptree_bad_path) {
+   catch(const ptree_bad_path&) {
       return false;
    }
-   catch(ptree_bad_data e) {
+   catch(const ptree_bad_data& e) {
       cerr << "Attribute '" << attrname << "' is not an string value: " << e.data<string>() << endl;
       throw;
    }
@@ -95,7 +95,7 @@ TrigConf::readAttribute(const boost::property_tree::ptree& pt, const char* attrn
          ( x == "yes" ) ||
          ( x == "YES" );
    }
-   catch(ptree_bad_path) { return false; }
+   catch(const ptree_bad_path&) { return false; }
 
    return true;
 }
diff --git a/Trigger/TrigConfiguration/TrigConfStorage/src/test/2COOLApp.cxx b/Trigger/TrigConfiguration/TrigConfStorage/src/test/2COOLApp.cxx
index c629d6ab8ce..81c59745b9f 100755
--- a/Trigger/TrigConfiguration/TrigConfStorage/src/test/2COOLApp.cxx
+++ b/Trigger/TrigConfiguration/TrigConfStorage/src/test/2COOLApp.cxx
@@ -533,7 +533,7 @@ void JobConfig::PrintCompleteSetup(std::ostream & log, std::ostream& (*lineend)
 // --------------------------------------------------------------------------------
 // parseProgramOptions
 // --------------------------------------------------------------------------------
-void parseProgramOptions(int argc, char* argv[]) throw(TrigConfError) {
+void parseProgramOptions(int argc, char* argv[]) {
 
   // building the option map
   std::string currentPar("");
diff --git a/Trigger/TrigConfiguration/TrigConfStorage/src/test/ConsistencyChecker.cxx b/Trigger/TrigConfiguration/TrigConfStorage/src/test/ConsistencyChecker.cxx
index 9563c54a8fb..f4951f5c7e9 100755
--- a/Trigger/TrigConfiguration/TrigConfStorage/src/test/ConsistencyChecker.cxx
+++ b/Trigger/TrigConfiguration/TrigConfStorage/src/test/ConsistencyChecker.cxx
@@ -274,7 +274,7 @@ float convertStringToFloat(const std::string & s) {
 // --------------------------------------------------------------------------------
 // parseProgramOptions
 // --------------------------------------------------------------------------------
-void parseProgramOptions(int argc, char* argv[]) throw(TrigConfError) {
+void parseProgramOptions(int argc, char* argv[]) {
 
   // building the option map
   std::string currentPar("");
diff --git a/Trigger/TrigConfiguration/TrigConfStorage/src/test/ReadWrite.cxx b/Trigger/TrigConfiguration/TrigConfStorage/src/test/ReadWrite.cxx
index 3a3714e4a9b..1d5a1f24dd2 100644
--- a/Trigger/TrigConfiguration/TrigConfStorage/src/test/ReadWrite.cxx
+++ b/Trigger/TrigConfiguration/TrigConfStorage/src/test/ReadWrite.cxx
@@ -684,7 +684,7 @@ int main( int argc, char* argv[] ) {
 	if(hltFrame)
 	  coolWriter->writeHLTPayload(runNr, *hltFrame, configSource);
       }   
-      catch(cool::StorageTypeStringTooLong e){
+      catch(const cool::StorageTypeStringTooLong& e){
 	log << "FATAL: Unable to write data to COOL";
 	exit(1);
       }
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/CMakeLists.txt b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/CMakeLists.txt
new file mode 100644
index 00000000000..994e92ce41d
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/CMakeLists.txt
@@ -0,0 +1,73 @@
+################################################################################
+# Package: TrigCaloDataAccessSvc
+################################################################################
+
+# Declare the package name:
+atlas_subdir( TrigCaloDataAccessSvc )
+
+# Declare the package's dependencies:
+atlas_depends_on_subdirs( PUBLIC
+                          Control/AthenaBaseComps
+                          Control/AthenaKernel
+                          LArCalorimeter/LArRecEvent
+
+                          PRIVATE
+                     	   Calorimeter/CaloEvent
+                           Calorimeter/CaloGeoHelpers
+                           Calorimeter/CaloIdentifier
+                           Calorimeter/CaloInterface
+                           Control/StoreGate
+                           DetectorDescription/IRegionSelector
+                           DetectorDescription/Identifier
+                           Event/ByteStreamCnvSvcBase
+                           Event/EventInfo
+                           Event/xAOD/xAODTrigCalo
+                           ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream
+                           ForwardDetectors/ZDC/ZdcEvent
+                           ForwardDetectors/ZDC/ZdcRec
+                           GaudiKernel
+                           LArCalorimeter/LArCnv/LArByteStream
+                           LArCalorimeter/LArRawUtils
+                           LArCalorimeter/LArCabling
+                           TileCalorimeter/TileEvent
+                           TileCalorimeter/TileSvc/TileByteStream
+                           Trigger/TrigEvent/TrigSteeringEvent
+                           Trigger/TrigSteer/TrigInterfaces
+                           Trigger/TrigTools/TrigTimeAlgs
+			   Trigger/TrigAlgorithms/TrigT2CaloCommon
+			   #
+                          Calorimeter/CaloDetDescr
+                          Calorimeter/CaloUtils
+                          Database/AthenaPOOL/AthenaPoolUtilities
+                          Event/ByteStreamData
+                          LArCalorimeter/LArElecCalib
+                          LArCalorimeter/LArIdentifier
+                          LArCalorimeter/LArRecConditions
+                          LArCalorimeter/LArRecUtils
+                          Trigger/TrigT1/TrigT1Interfaces
+			  AtlasTest/TestTools
+			  Control/AthenaMonitoring )
+
+# External dependencies:
+find_package( tdaq-common )
+
+# Component(s) in the package:
+atlas_add_library( TrigCaloDataAccessSvcLib
+                   src/*.cxx
+                   PUBLIC_HEADERS TrigCaloDataAccessSvc
+                   INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} CaloEvent CaloGeoHelpers CaloIdentifier AthenaBaseComps AthenaKernel IRegionSelector Identifier EventInfo xAODTrigCalo ZdcEvent GaudiKernel LArRecEvent TileEvent TrigSteeringEvent StoreGateLib SGtests ByteStreamCnvSvcBaseLib ZdcByteStreamLib ZdcRecLib LArByteStreamLib LArRawUtilsLib LArCablingLib TileByteStreamLib TrigInterfacesLib TrigTimeAlgsLib CaloDetDescrLib CaloUtilsLib ByteStreamData_test LArRecUtilsLib TrigT2CaloCommonLib
+                   PRIVATE_LINK_LIBRARIES AthenaPoolUtilities ByteStreamData LArIdentifier LArRecConditions TrigT1Interfaces )
+
+atlas_add_component( TrigCaloDataAccessSvc
+                     src/components/*.cxx
+                     INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} CaloEvent CaloGeoHelpers CaloIdentifier AthenaBaseComps AthenaKernel StoreGateLib SGtests IRegionSelector Identifier ByteStreamCnvSvcBaseLib EventInfo xAODTrigCalo ZdcByteStreamLib ZdcEvent ZdcRecLib GaudiKernel LArByteStreamLib LArRawUtilsLib LArRecEvent LArCablingLib TileEvent TileByteStreamLib TrigSteeringEvent TrigInterfacesLib TrigTimeAlgsLib CaloDetDescrLib CaloUtilsLib AthenaPoolUtilities ByteStreamData ByteStreamData_test LArIdentifier LArRecConditions LArRecUtilsLib TrigT1Interfaces TrigT2CaloCommonLib  TrigCaloDataAccessSvcLib )
+
+# Install files from the package:
+atlas_install_python_modules( python/*.py )
+atlas_install_joboptions( share/*.py )
+
+atlas_add_test( TestService 
+		SCRIPT test/test_dataaccess.sh
+		PROPERTIES TIMEOUT 300)
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/TrigCaloDataAccessSvc/ITrigCaloDataAccessSvc.h b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/TrigCaloDataAccessSvc/ITrigCaloDataAccessSvc.h
new file mode 100755
index 00000000000..ed6062211c5
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/TrigCaloDataAccessSvc/ITrigCaloDataAccessSvc.h
@@ -0,0 +1,207 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+#ifndef TrigCaloDataAccessSvc_ITrigCaloDataAccessSvc_h
+#define TrigCaloDataAccessSvc_ITrigCaloDataAccessSvc_h
+
+#include "LArRawUtils/LArTT_Selector.h"
+#include "TileByteStream/TileCellCont.h"
+#include "TrigT2CaloCommon/LArCellCont.h"
+#include "LArRecEvent/LArFebEnergyCollection.h"
+#include "TileEvent/TileCellCollection.h"
+#include "TileEvent/TileL2Container.h"
+#include "IRegionSelector/RegSelEnums.h"
+#include "CaloEvent/CaloCellContainer.h"
+#include "ZdcEvent/ZdcRawChannelCollection.h"
+#include "GaudiKernel/EventContext.h"
+#include "GaudiKernel/IService.h"
+
+// For callbacks
+#include "AthenaKernel/IOVSvcDefs.h"
+
+class ITrigCaloDataAccessSvc: virtual public IService {
+ public:
+  /** Interface for Virtual Class */
+  DeclareInterfaceID(ITrigCaloDataAccessSvc, 1, 0);
+  
+  class Status {
+  public:
+    Status() {}
+    Status( uint32_t x) : m_mask( x ) {}
+
+    //! possible, predefined errors
+    enum Mask { MissingROB = 0x10000000, RawDataCorrupted = 0x20000000, InternalError = 0x40000000 };
+    
+    inline void addError( uint32_t m ) { m_mask |= m; }
+    inline bool hasError( uint32_t m ) const { return m & m_mask; }
+    inline bool success() const { return mask() == 0; }
+
+    //!< to be usable with the ATH_CHECK
+    inline operator StatusCode() const { 
+      return success() ? StatusCode::SUCCESS : StatusCode::FAILURE;  
+    }
+    void operator += ( const Status& rhs ) { m_mask &= rhs.m_mask; }
+    //!< raw mask
+    inline uint32_t mask() const { return m_mask; }
+  private:
+    uint32_t m_mask = 0;
+  };
+
+  /**
+   * Will we ever need layer here
+   */
+  virtual Status prepareCollections( const EventContext& context,
+				     const IRoiDescriptor& roi, 
+				     DETID detector ) = 0;
+
+
+  
+  /** 
+   * @brief downloads the LAr data for an RoI and makes sure the cache collection is filled wiht decoded cells   
+   */
+  virtual Status loadCollections( const EventContext& context,
+				  const IRoiDescriptor& roi,
+				  LArTT_Selector<LArCellCont>& loadedCells ) = 0;
+	/* /\**  */
+	/* * @brief LoadCollections fetches data via ROBDataProvider */
+	/* * and really provides ByteStream Conversion by calling  */
+	/* * detector specific (LAr or Tile) ByteStream Conversion */
+	/* * Tools within RoI as defined in the above method. */
+	/* * @param[out] TileCellCollection::const_iterator outputs */
+	/* *	begin, end interator to TileCells. */
+	/* * @param[in] sample (deprecated) maintained for compatibility. */
+	/* * @param[in] prepare if container should be prepared or */
+	/* *	considered as already existing (multilayer HEC or Tile */
+	/* *	access). */
+	/* *\/ */
+	/* virtual ExtendedStatusCode loadCollections (const EventContext& context, */
+	/* 					    TileCellCollection::const_iterator&, */
+	/* 					    TileCellCollection::const_iterator&, */
+	/* 					    const unsigned int sample = 0, bool prepare=true) = 0; */
+        /* /\** MBTS loading *\/ */
+	/* virtual ExtendedStatusCode loadMBTS(const EventContext& context, */
+	/* 				    TileCellCollection::const_iterator&, */
+	/* 				    TileCellCollection::const_iterator&) = 0; */
+        /* /\** Load Zdc Collection *\/ */
+	/* virtual ExtendedStatusCode loadZdcCollection( const EventContext& context, */
+	/* 					      ZdcRawChannelCollection::const_iterator&, */
+	/* 					      ZdcRawChannelCollection::const_iterator&)=0; */
+
+	/* /\** */
+	/* * @brief LoadCollections fetches data via ROBDataProvider */
+	/* * and really provides ByteStream Conversion by calling */
+	/* * detector specific (LAr or Tile) ByteStream Conversion */
+	/* * Tools within RoI as defined in the above method. */
+	/* * @param[out] LArFebEnergyCollection::const_iterator outputs */
+	/* *	begin, end interator to LArFebEnergy Collections. */
+	/* * @param[in] sample (deprecated) maintained for compatibility. */
+	/* * @param[in] prepare if container should be prepared or */
+	/* *	considered as already existing (multilayer HEC or Tile */
+	/* *	access). */
+	/* *\/ */
+	/* virtual ExtendedStatusCode loadCollections ( const EventContext& context, */
+	/* 					     LArFebEnergyCollection::const_iterator&, */
+	/* 					     LArFebEnergyCollection::const_iterator&, */
+	/* 					     const unsigned int sample = 0, bool prepare=true) = 0; */
+        /**
+        * @brief Loads the full collection for the missing et computation
+        */
+
+  virtual Status prepareFullCollections( const EventContext& context, DETID detid ) = 0;
+  
+  virtual Status loadFullCollections ( const EventContext& context,
+				       DETID detid,
+				       LArTT_Selector<LArCellCont>::const_iterator& begin,
+				       LArTT_Selector<LArCellCont>::const_iterator& end ) = 0;
+
+        /* /\** */
+        /* * @brief Loads the full collection for the missing et computation */
+        /* *\/ */
+	/* virtual ExtendedStatusCode loadFullCollections ( const EventContext& context, */
+	/* 						 TileCellCollection::const_iterator&, */
+	/* 						 TileCellCollection::const_iterator&, */
+	/* 						 const unsigned int sample = 0, bool prepare=true ) = 0; */
+        /* /\** */
+        /* * @brief Loads the full collection for the missing et computation */
+        /* *\/ */
+	/* virtual ExtendedStatusCode loadFullCollections ( const EventContext& context, */
+	/* 						 LArFebEnergyCollection::const_iterator&, */
+	/* 						 LArFebEnergyCollection::const_iterator&, */
+	/* 						 DETID detid, bool prepare=true ) = 0; */
+        /* /\** */
+        /* * @brief Loads the full collection for the missing et computation */
+        /* *\/ */
+	/* virtual ExtendedStatusCode loadFullCollections ( const  EventContext& context, */
+	/* 						 TileL2Container::const_iterator& Begin, */
+	/* 						 TileL2Container::const_iterator& End ) = 0; */
+        /* /\** */
+        /* * @brief Loads the full collection fast */
+        /* *\/ */
+	/* virtual ExtendedStatusCode loadFullCollections ( const EventContext& context, */
+	/* 						 CaloCellContainer::const_iterator&, */
+	/* 						 CaloCellContainer::const_iterator& ) = 0; */
+
+	
+	/* /\** */
+	/*  * //TB numberof Tile identifiers */
+	/*  *  Number of Tile Calorimeter modules found in */
+	/*  * the Region of Interest *\/ */
+	/* virtual unsigned int TileContSize ( void ) const = 0; */
+
+	/* /\** */
+	/*  * //TB afain this is not depending on RoIs */
+	/*  * Number of Tile Calorimeter modules found in */
+	/*  * the Region of Interest MET case -> All Calo*\/ */
+	/* virtual unsigned int TileFullContSize ( void ) const = 0; */
+
+	/**
+	 * //TB errors cound should be accosiated with each conversion step
+	 * this is now returned from each loadCollection method
+	 * Error reporting from BSCnv 
+	 */
+	
+	//virtual uint32_t report_error( void ) = 0;
+
+	
+	/* //TB this methods should be updated/replaced and use new conditions infrastructure */
+        /* /\** begin run handle for conditions *\/ */
+        /* virtual StatusCode beginRunHandle(IOVSVC_CALLBACK_ARGS) = 0; */
+        /* /\** begin run handle for conditions and RegSelSvc *\/ */
+        /* virtual StatusCode beginRunHandle_RegSelSvc(IOVSVC_CALLBACK_ARGS) = 0; */
+
+	/*
+        method to store cells in a container with
+	a given key. The hottest number cells are placed in the
+	  container or all if number=-1, no Key makes the default
+	  key to be RoICells 
+	*/
+        /*
+        template <class T>
+        void  storeCells( const EventContext& context, T Begin, T End, CaloCellContainer*& pContainer,
+        const float threshold = 0., const uint32_t maxsize=1000 );
+        */	
+	/*
+	Expose list of ROBs
+	 // TB unclear if this is meant to be the list of ROBs already downloaded or all robs covering RoI,
+	 // if the former then it makes no sense in MT, if the later then context is not needed
+	 */
+	//	virtual void ROBList( const IRoiDescriptor& roi, std::vector<uint32_t>& vec) const = 0;
+
+
+private :
+	// Dummy method just to help compilation
+  /*
+	void comp (const EventContext& context) {
+	  LArTT_Selector<LArCellCont>::const_iterator l;
+	  TileCellCollection::const_iterator t;
+	  CaloCellContainer * cont=NULL;
+	  l=l;
+	  t=t;
+	  storeCells(context, l,l,cont);
+	  storeCells(context, t,t,cont);
+	}
+  */
+protected:
+};
+
+#endif
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/share/testDataAccessService.py b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/share/testDataAccessService.py
new file mode 100644
index 00000000000..8db0adc9e32
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/share/testDataAccessService.py
@@ -0,0 +1,30 @@
+#
+#  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+#
+
+include("TrigUpgradeTest/testHLT_MT.py")
+
+from AthenaCommon.AlgSequence import AlgSequence
+topSequence = AlgSequence()
+
+
+from AthenaMonitoring.GenericMonitoringTool import GenericMonitoringTool, defineHistogram
+
+from TrigCaloDataAccessSvc.TrigCaloDataAccessSvcConf import TrigCaloDataAccessSvc, TestCaloDataAccess
+import math
+mon = GenericMonitoringTool("CaloDataAccessSvcMon")
+mon.Histograms += [defineHistogram( "TIME_locking_LAr_RoI", title="Time spent in unlocking the LAr collection", xbins=100, xmin=0, xmax=100 ),
+                   defineHistogram( "roiROBs_LAr", title="Number of ROBs unpacked in RoI requests", xbins=20, xmin=0, xmax=20 ),
+                   defineHistogram( "TIME_locking_LAr_FullDet", title="Time spent in unlocking the LAr collection", xbins=100, xmin=0, xmax=100 ),
+                   defineHistogram( "roiEta_LAr,roiPhi_LAr", type="TH2F", title="Geometric usage", xbins=50, xmin=-5, xmax=5, ybins=64, ymin=-math.pi, ymax=math.pi )]
+
+svcMgr += TrigCaloDataAccessSvc()
+svcMgr.TrigCaloDataAccessSvc.OutputLevel=DEBUG
+svcMgr.TrigCaloDataAccessSvc.MonTool = mon
+
+
+algo = TestCaloDataAccess()
+algo.OutputLevel=DEBUG
+
+
+topSequence += algo
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TestCaloDataAccess.cxx b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TestCaloDataAccess.cxx
new file mode 100644
index 00000000000..71db165dca6
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TestCaloDataAccess.cxx
@@ -0,0 +1,242 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+#include <iostream>
+#include "tbb/parallel_reduce.h"
+#include "tbb/blocked_range.h"
+#include "TestTools/expect.h"
+#include "TestTools/ParallelCallTest.h"
+#include "GaudiKernel/Property.h"
+#include "TrigT2CaloCommon/LArCellCont.h"
+#include "TrigSteeringEvent/TrigRoiDescriptor.h"
+#include "TestCaloDataAccess.h"
+
+
+#define DIFF(_name, _a, _b) if ( _a != _b ) \
+    m_msg << MSG::WARNING << "Difference in " << _name << " " << _a << "  ref " << _b  << endmsg;  \
+  else									\
+    m_msg << MSG::DEBUG  << "Identical " << _name << " " << _a << "  ref " << _b  << endmsg; 
+
+
+/**
+ * @brief The test calls for RoI data access
+ * for each RoI returned bunch of quantiries are checked, RoI et, actual RoI span, and cells count
+ **/
+
+class AskForRoI : public ParallelCallTest {
+public:
+  AskForRoI( const EventContext& context, const ServiceHandle<ITrigCaloDataAccessSvc>& svc,  	     
+	     MsgStream& msg,
+	     double eta, double phi, double width ) 
+    : m_context( context ),
+      m_svc( svc ),
+      m_msg( msg ),
+      m_eta( eta ),
+      m_phi( phi ),
+      m_width( width ) {}
+
+  ITrigCaloDataAccessSvc::Status request( LArTT_Selector<LArCellCont>& sel ) const {
+      TrigRoiDescriptor roi( m_eta, -m_width, m_width, // eta
+			     m_phi, -m_width, m_width, // phi
+			     0 ); // z            
+
+      return m_svc->loadCollections( m_context, roi, sel );    
+    }
+
+  // calculate reference quantities in the first call
+  void firstCall() override { 
+    m_statusRef = request( m_selRef );
+
+    for ( const LArCell* cell : m_selRef ) {
+      m_etSumRef += cell->et();
+      m_countRef ++;
+      m_minEtaRef = std::min( m_minEtaRef, cell->eta() );
+      m_maxEtaRef = std::max( m_maxEtaRef, cell->eta() );
+      m_minPhiRef = std::min( m_minPhiRef, cell->phi() );
+      m_maxPhiRef = std::max( m_maxPhiRef, cell->phi() );
+    }
+  }
+  
+  bool callAndCompare() const override {
+
+    LArTT_Selector<LArCellCont> sel;
+    ITrigCaloDataAccessSvc::Status status = request( sel );      
+    double etSum  = 0;      
+    size_t count = 0;
+    double minEta = 100;
+    double maxEta = -100;
+    double minPhi = 100;
+    double maxPhi = -100;
+
+    for ( const LArCell* cell : sel ) {
+      etSum  += cell->et();
+      count ++;
+      minEta  = std::min( minEta, cell->eta() );
+      maxEta  = std::max( maxEta, cell->eta() );
+      minPhi  = std::min( minPhi, cell->phi() );
+      maxPhi  = std::max( maxPhi, cell->phi() );
+    }
+
+
+    DIFF( "RoI mask", status.mask(), m_statusRef.mask() );    
+    DIFF( "RoI count ", count , m_countRef );
+    DIFF( "RoI etSum ", etSum , m_etSumRef );
+    DIFF( "RoI minEta", minEta, m_minEtaRef );
+    DIFF( "RoI maxEta", maxEta, m_maxEtaRef );
+    DIFF( "RoI minPhi", minPhi, m_minPhiRef );
+    DIFF( "RoI maxPhi", maxPhi, m_maxPhiRef );
+    
+    bool checkStatus = m_statusRef.mask() == status.mask()
+      and m_countRef == count
+      and m_etSumRef == etSum 
+      and m_minEtaRef == minEta
+      and m_maxEtaRef == maxEta
+      and m_minPhiRef == minPhi
+      and m_maxPhiRef == maxPhi;
+
+    if ( checkStatus == false ) {
+      
+      // iterate over two slectors and compare cell by cell
+      for ( LArTT_Selector<LArCellCont>::const_iterator refIter = m_selRef.begin(), thisIter = sel.begin(); 
+	    refIter != m_selRef.end() and thisIter != sel.end(); ++refIter, ++thisIter ) {	
+	const LArCell* refCell = *refIter;
+	const LArCell* thisCell = *thisIter;
+	if ( thisCell->et() != refCell->et() ) {
+	  m_msg << MSG::WARNING <<"eta/phi/et Reference cell " << refCell->eta() << "/" << refCell->phi() << "/" << refCell->et() 
+		<<    " differ from the one in this request " << thisCell->eta() << "/" << thisCell->phi() << "/" << thisCell->et() << endmsg;
+	}
+      }
+    }
+
+    return checkStatus;
+  }
+
+private:
+  const EventContext& m_context;
+  const ServiceHandle<ITrigCaloDataAccessSvc>& m_svc;
+  MsgStream& m_msg;
+  MsgStream& msg(){ return m_msg; }
+  const double m_eta;
+  const double m_phi;
+  const double m_width;
+
+  LArTT_Selector<LArCellCont> m_selRef;
+  ITrigCaloDataAccessSvc::Status m_statusRef;
+  double m_etSumRef = 0;
+  size_t m_countRef = 0;
+  double m_minEtaRef = 100;
+  double m_maxEtaRef = -100;
+  double m_minPhiRef = 100;
+  double m_maxPhiRef = -100;
+};
+
+/**
+ * @brief This test reads entire LAr subdetectors and checks if repeated calls point to the same cells (i.e. by total energy sum)
+ **/
+class TestFullLAr : public ParallelCallTest {
+public:
+  TestFullLAr( const EventContext& context, const ServiceHandle<ITrigCaloDataAccessSvc>& svc,  	     
+	       MsgStream& msg, DETID detid )
+    : m_context( context ),
+      m_svc( svc ),
+      m_msg( msg ),
+      m_detid( detid ){}
+
+  void firstCall() override { 
+
+    LArTT_Selector<LArCellCont>::const_iterator i;
+    LArTT_Selector<LArCellCont>::const_iterator end;
+    m_statusRef = m_svc->loadFullCollections( m_context, m_detid, i, end);
+
+    for ( ; i != end; ++i ) {
+      const LArCell* cell =  *i;
+      m_etSumRef += cell->et();
+      m_countRef ++;      
+    }
+  }
+  
+  
+  bool callAndCompare() const override {
+    LArTT_Selector<LArCellCont>::const_iterator i;
+    LArTT_Selector<LArCellCont>::const_iterator end;
+    ITrigCaloDataAccessSvc::Status status = m_svc->loadFullCollections( m_context, m_detid, i, end);
+    double etSum = 0;
+    size_t count = 0;
+
+    for ( ; i != end; ++i ) {
+      const LArCell* cell = *i;
+      etSum += cell->et();
+      count ++;      
+    }
+
+    DIFF( "loadFull mask", status.mask(), m_statusRef.mask() );    
+    DIFF( "loadFull count ", count , m_countRef );
+    DIFF( "loadFull etSum ", etSum , m_etSumRef );
+
+    return status.mask() == m_statusRef.mask() 
+      and count == m_countRef
+      and etSum == m_etSumRef;    
+  }
+
+    private:
+  const EventContext& m_context;
+  const ServiceHandle<ITrigCaloDataAccessSvc>& m_svc;
+  MsgStream& m_msg;
+  const DETID m_detid;
+
+  // reference values
+  ITrigCaloDataAccessSvc::Status m_statusRef;
+  double m_etSumRef = 0;
+  size_t m_countRef = 0;  
+};
+
+
+
+TestCaloDataAccess::TestCaloDataAccess( const std::string& name, 
+			  ISvcLocator* pSvcLocator ) : 
+  ::AthReentrantAlgorithm( name, pSvcLocator ),
+  m_dataAccessSvc( "TrigCaloDataAccessSvc/TrigCaloDataAccessSvc", name )
+{}
+
+TestCaloDataAccess::~TestCaloDataAccess() {}
+
+StatusCode TestCaloDataAccess::initialize() {
+  CHECK( m_dataAccessSvc.retrieve() );
+  return StatusCode::SUCCESS;
+}
+
+
+
+StatusCode TestCaloDataAccess::execute_r( const EventContext& context ) const {  
+  ATH_MSG_DEBUG ( "Executing " << name() << "..." );
+  
+  AskForRoI t1( context, m_dataAccessSvc, msg(), 0.7, 0.1, 0.1);
+  AskForRoI t2( context, m_dataAccessSvc, msg(), 0.7, 0.1, 0.1);  // second identical request
+  AskForRoI t3( context, m_dataAccessSvc, msg(), 0.8, 0.2, 0.2);  // overlaping request
+  AskForRoI t4( context, m_dataAccessSvc, msg(), -1.7, 2.1, 0.4);  // bigger request
+  AskForRoI t5( context, m_dataAccessSvc, msg(), -1., 1.1, 1.4);  // large request with overlap
+
+  TestFullLAr f1( context, m_dataAccessSvc, msg(), TTEM );
+  TestFullLAr f2( context, m_dataAccessSvc, msg(), TTEM ); // ask twice for this part
+  TestFullLAr f3( context, m_dataAccessSvc, msg(), TTHEC ); 
+  TestFullLAr f4( context, m_dataAccessSvc, msg(), FCALEM ); 
+  TestFullLAr f5( context, m_dataAccessSvc, msg(), FCALHAD ); 
+  TestFullLAr f6( context, m_dataAccessSvc, msg(), FCALHAD ); 
+
+    
+  bool result = ParallelCallTest::launchTests( 100, 
+					       { &t1, &t2, &t3, &t4, &t5,
+						   &f1, &f2, &f3, &f4, &f5, &f6
+						   } 
+					       );
+  
+  if ( result == false ) {
+    ATH_MSG_ERROR( "Test of data access failed " );
+    return StatusCode::FAILURE;
+  } 
+
+
+  return StatusCode::SUCCESS;
+}
+
+
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TestCaloDataAccess.h b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TestCaloDataAccess.h
new file mode 100644
index 00000000000..389505467f9
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TestCaloDataAccess.h
@@ -0,0 +1,35 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+#ifndef TrigCaloDataAccessSvc_TestCaloDataAccess_h
+#define TrigCaloDataAccessSvc_TestCaloDataAccess_h
+
+#include <string>
+
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
+#include "TrigCaloDataAccessSvc/ITrigCaloDataAccessSvc.h"
+
+
+/**
+ * @class Test algorithm for the data access svc
+ * @brief It is supposed to try out all the methods + do that from several threads to assure 
+ * service robustness
+ **/
+
+class TestCaloDataAccess
+  : public ::AthReentrantAlgorithm
+{ 
+ public: 
+
+  TestCaloDataAccess( const std::string& name, ISvcLocator* pSvcLocator );
+  virtual ~TestCaloDataAccess(); 
+  virtual StatusCode  initialize() override;
+  virtual StatusCode  execute_r(const EventContext& context) const override;
+ 
+ private: 
+  TestCaloDataAccess();
+  ServiceHandle<ITrigCaloDataAccessSvc> m_dataAccessSvc; 
+}; 
+
+
+#endif 
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TrigCaloDataAccessSvc.cxx b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TrigCaloDataAccessSvc.cxx
new file mode 100644
index 00000000000..7fc8cc6f577
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TrigCaloDataAccessSvc.cxx
@@ -0,0 +1,357 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+#include "AthenaMonitoring/MonitoredScope.h"
+#include "TrigCaloDataAccessSvc.h"
+
+
+TrigCaloDataAccessSvc::TrigCaloDataAccessSvc( const std::string& name, ISvcLocator* pSvcLocator )
+  : base_class( name, pSvcLocator ) {
+}
+
+TrigCaloDataAccessSvc::~TrigCaloDataAccessSvc() {}
+
+StatusCode TrigCaloDataAccessSvc::initialize() {
+  CHECK( m_roiMapTool.retrieve() );
+  CHECK( m_larDecoder.retrieve() );
+  CHECK( m_robDataProvider.retrieve() );
+  CHECK( m_regionSelector.retrieve() );
+
+  return StatusCode::SUCCESS;
+}
+
+static const std::vector<unsigned> LAr { TTEM, TTHEC, FCALEM, FCALHAD };
+
+TrigCaloDataAccessSvc::Status 
+TrigCaloDataAccessSvc::prepareCollections( const EventContext& context,
+					   const IRoiDescriptor& roi, 
+					   DETID detid ) {
+  if ( std::count( LAr.begin(), LAr.end(),  detid ) )
+    return prepareLArCollections( context, roi, detid );
+  else
+    return Status::InternalError;
+}
+
+TrigCaloDataAccessSvc::Status 
+TrigCaloDataAccessSvc::prepareFullCollections( const EventContext& context, DETID detid ) {
+
+  if ( std::count( LAr.begin(), LAr.end(),  detid ) )
+    return prepareLArFullCollections( context, detid );
+  else
+    return Status::InternalError;
+  
+}
+
+
+TrigCaloDataAccessSvc::Status 
+TrigCaloDataAccessSvc::loadCollections ( const EventContext& context,
+					 const IRoiDescriptor& roi,
+					 LArTT_Selector<LArCellCont>& loadedCells ) {
+
+  std::vector<IdentifierHash> requestHashIDs;  
+  Status status;
+
+  ATH_MSG_DEBUG( "LArTT requested for event " << context << " and RoI " << roi );  
+  status += prepareLArCollections( context, roi, TTEM );
+  status += prepareLArCollections( context, roi, TTHEC );
+  status += prepareLArCollections( context, roi, FCALEM );
+  status += prepareLArCollections( context, roi, FCALHAD );
+  
+  if ( not status.success() )
+    return status;
+  
+  
+  m_regionSelector->DetHashIDList( TTEM, roi, requestHashIDs );
+  
+  ATH_MSG_DEBUG( "requestHashIDs.size() in LoadColl = " << requestHashIDs.size()  << " hash checksum " 
+    		 << std::accumulate( requestHashIDs.begin(), requestHashIDs.end(), IdentifierHash( 0 ),  
+    				     []( IdentifierHash h1, IdentifierHash h2 ){  return h1+h2; } ) );
+  if ( msgLvl( MSG::VERBOSE ) ) {    
+    for( unsigned int i = 0 ; i < requestHashIDs.size() ; i++ )
+      ATH_MSG_VERBOSE( "m_rIds[" << i << "]=" << requestHashIDs[i] );
+  }
+  loadedCells.setContainer( & ( m_larcell.get( context )->container ) );
+  loadedCells.setMap( m_roiMapTool.operator->() );    
+
+  { 
+    // this has to be guarded because getTT called on the LArCollection bu other threads updates internal map
+    std::lock_guard<std::mutex> getCollClock{ m_larcell.get( context )->mutex };       
+    loadedCells.setRoIs( requestHashIDs );
+  }
+  return status;
+}
+
+
+
+
+
+TrigCaloDataAccessSvc::Status 
+TrigCaloDataAccessSvc::loadFullCollections ( const EventContext& context,
+					     DETID detid,
+					     LArTT_Selector<LArCellCont>::const_iterator& begin,
+					     LArTT_Selector<LArCellCont>::const_iterator& end ) {
+  std::lock_guard<std::mutex> getCollClock{ m_getCollMutex };   
+  Status status = prepareLArFullCollections( context, detid );
+  auto setIterators = [&]( const LArTT_Selector<LArCellCont>& selector ) {
+    begin = selector.begin();
+    end   = selector.end();
+  };
+
+  if ( detid == 0 ) {
+    setIterators( m_larcell.get( context )->allSelector );
+  } else if ( detid == TTEM ) {
+    setIterators ( m_larcell.get( context )->ttemSelector );
+  } else if ( detid == TTHEC ) {
+    setIterators(  m_larcell.get( context )->tthecSelector );
+  } else if ( detid == FCALEM ) {
+    setIterators( m_larcell.get( context )->fcalemSelector );
+  } else if ( detid == FCALHAD ) {
+    setIterators( m_larcell.get( context )->fcalhadSelector );
+  } else {
+    ATH_MSG_ERROR( "Impossible detector ID " << detid );
+    return Status::InternalError;
+  }
+      
+  return status;
+}
+
+
+TrigCaloDataAccessSvc::Status 
+TrigCaloDataAccessSvc::prepareLArFullCollections( const EventContext& context, DETID detid ) {
+
+  ATH_MSG_DEBUG( "Full LArTT " << detid << " requested for event " << context );
+  if ( lateInit().isFailure() ) {
+    return Status::InternalError;
+  }
+  
+  m_roiMapTool->CollectionID( 0 ); // triggers init of the inner structures
+
+  const std::vector<uint32_t>* requestROBs = nullptr;
+  if ( detid == 0 ) {
+    requestROBs =  &m_allLArIDs.robs;
+  } else {
+    DETIDtoIdentifiers::const_iterator ids = m_detectorIDs.find( detid );
+    if ( ids == m_detectorIDs.end() ) {
+      ATH_MSG_ERROR( "Impossible detector ID " << detid );
+      return Status::InternalError;
+    }    
+    requestROBs = &( ids->second.robs );
+  }
+
+  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
+  {
+    std::lock_guard<std::mutex> dataPrepLock { m_dataPrepMutex };
+    m_robDataProvider->addROBData( *requestROBs );
+    m_robDataProvider->getROBData( *requestROBs, robFrags );      
+  }
+
+  LArEventCache* cache = m_larcell.get( context );
+  
+  auto lockTime = Monitored::MonitoredTimer::declare ( "TIME_locking_LAr_FullDet" );  
+  std::lock_guard<std::mutex> collectionLock { cache->mutex };  
+  lockTime.stop();
+
+  cache->container.eventNumber( context.evt() );
+  
+  Status status = convertROBs( robFrags, &( cache->container ) );
+
+  if ( requestROBs->size() != robFrags.size() ) {
+    ATH_MSG_DEBUG( "Missing ROBs, requested " << requestROBs->size() << " obtained " << robFrags.size() );
+    status.addError( Status::MissingROB );
+    clearMissing( *requestROBs, robFrags, &( cache->container ) );
+  }
+  auto detidMon = Monitored::MonitoredScalar::declare<int>( "det", detid );
+
+  Monitored::MonitoredScope::declare( m_monTool, lockTime, detidMon );
+  return status;  
+}
+
+
+
+StatusCode TrigCaloDataAccessSvc::lateInit() {
+  std::lock_guard<std::mutex> lock( m_initMutex );
+  if ( m_lateInitDone ) 
+    return StatusCode::SUCCESS;
+  
+  ATH_MSG_DEBUG( "Performing late init" );
+  // filling all sub det selectors
+  for ( auto detector: {TTEM, TTHEC, FCALEM, FCALHAD } ) {
+    m_regionSelector->DetROBIDListUint( detector, m_detectorIDs[detector].robs );
+    m_regionSelector->DetHashIDList(    detector, m_detectorIDs[detector].ids );
+    m_allLArIDs.merge( { m_detectorIDs[detector] } );
+  }
+    
+
+  for ( LArEventCache& cache: m_larcell ) { 
+    CHECK( cache.container.initialize( m_applyOffsetCorrection ) );
+
+    auto prepareSelectors = [&]( LArTT_Selector<LArCellCont>& selector, const FullDetIDs& i ) {
+      selector.setContainer( &( cache.container ) );
+      selector.setMap( m_roiMapTool.operator->() );
+      selector.setRoIs( i.ids );      
+
+    };
+    prepareSelectors( cache.allSelector,     m_allLArIDs );
+    prepareSelectors( cache.ttemSelector,    m_detectorIDs[TTEM] );
+    prepareSelectors( cache.tthecSelector,   m_detectorIDs[TTHEC] );
+    prepareSelectors( cache.fcalemSelector,  m_detectorIDs[FCALEM] );
+    prepareSelectors( cache.fcalhadSelector, m_detectorIDs[FCALHAD] );    
+  }
+
+
+
+  m_lateInitDone = true;
+  return StatusCode::SUCCESS;
+}
+
+TrigCaloDataAccessSvc::Status 
+TrigCaloDataAccessSvc::convertROBs( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags, LArCellCont* larcell ) {
+
+  Status status;
+  ATH_MSG_DEBUG( "start decoding" );
+  for ( auto rob: robFrags ) {
+    uint32_t sourceID = rob->source_id();
+    const std::vector<LArCellCollection*>::const_iterator it = larcell->find( sourceID );
+    //TB The find also switches the state of the collection to "decoded" so repeated decoding is avoided
+
+    if ( it != larcell->end() && ( *it )->size() != 0 ) { // Already decoded collection
+
+      // TB if we have entered here it means the decoding did not occur yet ( or failed )
+      // 
+      LArCellCollection* coll = *it; 
+      ATH_MSG_DEBUG( "ROB of ID " << sourceID << " to be decoded"   );
+
+      //TB next two lines seem danger, as they seem to rely on the decoder state 
+      m_larDecoder->setsecfeb( larcell->findsec( sourceID ) );
+      if ( ! m_larDecoder->check_valid( rob, msg() ) ){
+      	ATH_MSG_WARNING( "Error reading bytestream"<<
+      			 "event: Bad ROB block ( eformat checks ) : 0x"
+      			 << std::hex << sourceID << std::dec );
+      	// Data seems corrupted
+      	status.addError( Status::RawDataCorrupted );
+      	reset_LArCol ( coll );
+
+      } else {
+	// Get Rod Data and size of fragment
+	const uint32_t* roddata = 0;
+	rob->rod_data( roddata );
+	size_t roddatasize = rob->rod_ndata();
+	if ( roddatasize < 3 ) {
+	  ATH_MSG_WARNING( "Error reading bytestream"<<
+			   "event: Empty ROD block ( less than 3 words ) : 0x"
+			   << std::hex << sourceID << std::dec );
+	  // Data seems corrupted
+	  status.addError( Status::RawDataCorrupted );
+	  reset_LArCol ( coll );
+	  //return StatusCode::SUCCESS;
+	} else { // End of if small size
+	  //TB the converter has state
+	  m_larDecoder->setRobFrag( rob );
+	  m_larDecoder->fillCollectionHLT( roddata, roddatasize, *coll );
+
+
+	  // size_t collsize = coll->size();	  
+	  // for(int i=0;i<collsize;i++) {
+	  //   std::cout << sourceID << " " << collsize << " " << i << " ";
+	  //   std::cout << coll->at(i) << "ID " << coll->at(i)->ID() << " ";
+	  //   std::cout << coll->at(i)->energy() << " DDE ";
+	  //   std::cout << coll->at(i)->caloDDE() << "\n";
+	  //   if ( coll->at(i)->caloDDE() ) {
+	  //     std::cout << coll->at(i)->eta() << " ";
+	  //     std::cout << coll->at(i)->phi() << " \n";
+	  //   }
+	  // }
+	  
+
+	  // Accumulates inferior byte from ROD Decoder
+	  // TB the converter has state! we need to fix it
+	  status.addError( m_larDecoder->report_error() );
+
+	  if ( m_applyOffsetCorrection ) larcell->applyBCIDCorrection( sourceID );
+	} 
+	
+      }
+    } else {
+      ATH_MSG_VERBOSE( "ROB of ID " <<  sourceID << " already decoded" );
+    }
+  }
+  ATH_MSG_DEBUG( "finished decoding" );
+  return status;  
+}
+
+void TrigCaloDataAccessSvc::missingROBs( const std::vector<uint32_t>& request,
+					 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
+					 std::set<uint32_t>& missing ) const {
+
+  std::set<uint32_t> receivedROBsSet;
+  for ( auto rob: response ) 
+    receivedROBsSet.insert( rob->source_id() );
+  std::set<uint32_t> requestedROBsSet( request.begin(), request.end() );
+  
+  std::set_difference( requestedROBsSet.begin(), requestedROBsSet.end(),
+		       receivedROBsSet.begin(), receivedROBsSet.end(),
+		       std::inserter( missing, missing.begin() ) );  
+}
+
+
+void TrigCaloDataAccessSvc::clearMissing( const std::vector<uint32_t>& request,
+					  const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response, 
+					  LArCellCont* larcell ) {
+  std::set<uint32_t> missing;
+  missingROBs( request, response, missing );
+  for ( uint32_t robID : missing ) {
+    const std::vector<LArCellCollection*>::const_iterator it = larcell->find( robID );
+    if ( it != larcell->end() && ( *it )->size()!=0 ) { // Already decoded collection
+      reset_LArCol ( *it );
+    } 
+  }  
+}
+
+
+TrigCaloDataAccessSvc::Status 
+TrigCaloDataAccessSvc::prepareLArCollections( const EventContext& context,
+					      const IRoiDescriptor& roi, 
+					      DETID detector ) {
+  if ( lateInit().isFailure() ) {
+    return Status::InternalError;
+  }
+
+  std::vector<uint32_t> requestROBs;
+
+  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
+  {
+    std::lock_guard<std::mutex> dataPrepLock { m_dataPrepMutex };
+    m_regionSelector->DetROBIDListUint( detector, roi, requestROBs ); // we know that the RegSelSvc is thread safe   
+    m_robDataProvider->getROBData( requestROBs, robFrags );
+  }
+  if ( robFrags.empty() ) {
+    return Status();
+  }
+
+  LArEventCache* cache = m_larcell.get( context );
+
+  auto lockTime = Monitored::MonitoredTimer::declare ( "TIME_locking_LAr_RoI" );  
+  std::lock_guard<std::mutex> collectionLock { cache->mutex };  
+  lockTime.stop();
+
+  // TB, what would happen from now inside the collection unapcking
+  // if this event number is different than the one for each collection the unpacking will happen, 
+  // if it is the same the unpacking will not be repeated
+  // same in prepareLArFullCollections
+  cache->container.eventNumber( context.evt() );
+  
+  Status status = convertROBs( robFrags, &( cache->container ) );
+
+  if ( requestROBs.size() != robFrags.size() ) {
+    ATH_MSG_DEBUG( "Missing ROBs, requested " << requestROBs.size() << " obtained " << robFrags.size() );
+    status.addError( Status::MissingROB );
+    clearMissing( requestROBs, robFrags, &( cache->container ) );
+  }
+  auto roiROBs = Monitored::MonitoredScalar::declare( "roiROBs_LAr", robFrags.size() );
+  auto roiEta = Monitored::MonitoredScalar::declare( "roiEta_LAr", roi.eta() );
+  auto roiPhi = Monitored::MonitoredScalar::declare( "roiPhi_LAr", roi.phi() );
+
+  Monitored::MonitoredScope::declare( m_monTool, lockTime, roiEta, roiPhi, roiROBs );
+  return status;
+}
+
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TrigCaloDataAccessSvc.h b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TrigCaloDataAccessSvc.h
new file mode 100644
index 00000000000..909d806f5f8
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/TrigCaloDataAccessSvc.h
@@ -0,0 +1,154 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TrigCaloDataAccessSvc_TrigCaloDataAccessSvc_h
+#define TrigCaloDataAccessSvc_TrigCaloDataAccessSvc_h
+
+#include <mutex>
+#include "AthenaBaseComps/AthService.h"
+#include "AthenaKernel/SlotSpecificObj.h"
+#include "LArByteStream/LArRodDecoder.h"
+#include "LArRawUtils/LArTT_Selector.h"
+#include "TileByteStream/TileCellCont.h"
+#include "TrigT2CaloCommon/LArCellCont.h"
+#include "LArRecEvent/LArFebEnergyCollection.h"
+#include "TileEvent/TileCellCollection.h"
+#include "TileEvent/TileL2Container.h"
+#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
+#include "IRegionSelector/IRoiDescriptor.h"
+#include "IRegionSelector/IRegSelSvc.h"
+#include "TrigCaloDataAccessSvc/ITrigCaloDataAccessSvc.h"
+#include "AthenaMonitoring/GenericMonitoringTool.h"
+
+
+class TrigCaloDataAccessSvc : public extends<AthService, ITrigCaloDataAccessSvc> {
+ public:
+  TrigCaloDataAccessSvc(const std::string& name, ISvcLocator* pSvcLocator);
+  virtual ~TrigCaloDataAccessSvc();
+  
+  using ITrigCaloDataAccessSvc::Status;
+
+
+  virtual StatusCode initialize() override;
+  
+  virtual Status prepareCollections( const EventContext& context,
+				     const IRoiDescriptor& roi, 
+				     DETID detector ) override;
+  
+  virtual Status loadCollections ( const EventContext& context,
+				   const IRoiDescriptor& roi,
+				   LArTT_Selector<LArCellCont>& loadedCells ) override;
+  
+
+
+  virtual Status prepareFullCollections( const EventContext& context, DETID detid ) override;
+  
+  virtual Status loadFullCollections ( const EventContext& context,
+				       DETID detid,
+				       LArTT_Selector<LArCellCont>::const_iterator& begin,
+				       LArTT_Selector<LArCellCont>::const_iterator& end ) override;
+  
+ private:
+  
+  PublicToolHandle<LArRodDecoder> m_larDecoder { this, "LArDecoderTool", "LArRodDecoder/LArRodDecoder", "Tool to decode LAr raw data" };
+
+  //!< LArRoI_Map used by LArTT_Selector, TB this is apparently a tool!
+  PublicToolHandle<LArRoI_Map> m_roiMapTool { this, "LArRoIMapTool", "LArRoI_Map/LArRoI_Map", "Tool used by selectors" };           
+
+  ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Tool to monitor performance of the service" };
+
+  ServiceHandle<IROBDataProviderSvc>  m_robDataProvider{ this, "ROBDataProvider", "ROBDataProviderSvc/ROBDataProviderSvc", ""};
+  ServiceHandle<IRegSelSvc>         m_regionSelector{ this, "RegionSelector", "RegSelSvc/RegSelSvc", ""};
+  
+  Gaudi::Property<bool> m_applyOffsetCorrection { this, "ApplyOffsetCorrection", false, "Enable offset correction" };
+
+  void reset_LArCol ( LArCellCollection* coll ){
+    for(LArCellCollection::iterator ii=coll->begin();ii!=coll->end();++ii)
+      (*ii)->setEnergyFast(0.0);
+  }
+
+  /**
+   * @brief Convenience structure to keep together all ROBs and IdentifierHashes 
+   * for whole detectors.
+   **/
+  struct FullDetIDs {
+    std::vector<uint32_t> robs;
+    std::vector<IdentifierHash> ids;
+    DETID detid;
+    void merge( const std::initializer_list<FullDetIDs>& list ) {
+      for ( auto& el: list ) {
+	std::copy( el.robs.begin(), el.robs.end(), std::back_inserter(robs) );
+	std::copy( el.ids.begin(), el.ids.end(), std::back_inserter(ids) );
+      }
+    }
+
+  };
+  typedef std::map<DETID, FullDetIDs> DETIDtoIdentifiers;
+  DETIDtoIdentifiers m_detectorIDs; 
+  
+  FullDetIDs m_allLArIDs;
+  
+  /* FullDetIDs m_ttemIDs; */
+  /* FullDetIDs m_tthecIDs; */
+  /* FullDetIDs m_fcalemIDs; */
+  /* FullDetIDs m_fcalhadIDs; */
+
+
+  /**
+   * @brief convience structure to keep together a collection and auxiliar full collection selectors
+   */
+  struct  LArEventCache {
+    LArCellCont container;
+    std::mutex mutex;    
+    LArTT_Selector<LArCellCont> allSelector;
+    LArTT_Selector<LArCellCont> ttemSelector;
+    LArTT_Selector<LArCellCont> tthecSelector;
+    LArTT_Selector<LArCellCont> fcalemSelector;
+    LArTT_Selector<LArCellCont> fcalhadSelector;
+  };
+
+  
+  SG::SlotSpecificObj< LArEventCache > m_larcell;
+
+  std::mutex m_initMutex; // this will be gone once we move to new conditions
+  std::mutex m_dataPrepMutex; // this will be gone when reg sel & Rob DP will become thread safe
+  std::mutex m_getCollMutex; // this will be gone
+
+  StatusCode lateInit();
+  bool m_lateInitDone = false;
+
+  Status convertROBs(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags, LArCellCont* larcell );
+
+
+  /**
+   * @brief fill the set of missing robs given the request and response from RoBDatProvider
+   **/
+  void missingROBs( const std::vector<uint32_t>& request,
+		    const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
+		    std::set<uint32_t>& missing ) const;
+
+  /**
+   * @brief clear fragments of the collection for which ROBs were not available
+   **/
+  void clearMissing( const std::vector<uint32_t>& request,
+		     const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response, 
+		     LArCellCont* larcell );
+
+  /**
+   * @brief LAr TT collections preparation code
+   **/
+  Status prepareLArCollections( const EventContext& context,
+				const IRoiDescriptor& roi, 
+				DETID detector );
+
+
+  Status prepareLArFullCollections( const EventContext& context, DETID detid );
+
+
+};
+
+
+#endif
+
+
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/components/TrigCaloDataAccessSvc_entries.cxx b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/components/TrigCaloDataAccessSvc_entries.cxx
new file mode 100644
index 00000000000..ca728cd3a66
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/src/components/TrigCaloDataAccessSvc_entries.cxx
@@ -0,0 +1,5 @@
+#include "../TrigCaloDataAccessSvc.h"
+#include "../TestCaloDataAccess.h"
+
+DECLARE_COMPONENT( TrigCaloDataAccessSvc) 
+DECLARE_COMPONENT( TestCaloDataAccess )
diff --git a/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/test/test_dataaccess.sh b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/test/test_dataaccess.sh
new file mode 100755
index 00000000000..f9ec4ac69f2
--- /dev/null
+++ b/Trigger/TrigDataAccess/TrigCaloDataAccessSvc/test/test_dataaccess.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+# art-type: build
+# art-ci: master
+
+athena.py --concurrent-events=1 --threads=1 -c 'EvtMax=10;enableViews=False;doMuon=False;doID=False;FilesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"' TrigCaloDataAccessSvc/testDataAccessService.py
diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.cxx b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.cxx
index a141ea0baea..e9d52353d91 100755
--- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.cxx
+++ b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.cxx
@@ -1201,6 +1201,12 @@ int TrigROBDataProviderSvc::collectCompleteEventData(const std::string callerNam
   return retrievedRobIds.size();
 } // end int collectCompleteEventData(...)
 
+int TrigROBDataProviderSvc::collectCompleteEventData(const EventContext&, 
+                                                     const std::string callerName)
+{
+  return collectCompleteEventData (callerName);
+}
+
 /// set the name of the program which uses the ROBDataProviderSvc
 void TrigROBDataProviderSvc::setCallerName(std::string callerName)
 {
diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.h b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.h
index f61546dd48a..53ff06c64a4 100755
--- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.h
+++ b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.h
@@ -66,11 +66,11 @@ public:
 
     virtual ~TrigROBDataProviderSvc(void);
   
-    virtual StatusCode initialize();
+    virtual StatusCode initialize() override;
 
-    virtual StatusCode finalize();
+    virtual StatusCode finalize() override;
 
-    virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
+    virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ) override;
 
     /// --- Implementation of IROBDataProviderSvc interface ---    
 
@@ -100,35 +100,39 @@ public:
     /// --- Implementation of ITrigROBDataProviderSvc interface ---
 
     /// Return vector with all ROBFragments stored in the cache 
-    virtual void getAllROBData(std::vector<const ROBF*>& robFragments) ;
+    virtual void getAllROBData(std::vector<const ROBF*>& robFragments) override;
 
     // Dump ROB cache
-    virtual std::string dumpROBcache() const ;
+    virtual std::string dumpROBcache() const override;
 
     /// Return size of ROBFragments cache 
-    virtual int sizeROBCache() { return m_online_robmap.size(); }
+    virtual int sizeROBCache() override { return m_online_robmap.size(); }
 
     /// iterators over cache entries
-    virtual std::map<uint32_t, ROBF>::iterator beginROBCache() { return m_online_robmap.begin(); }
-    virtual std::map<uint32_t, ROBF>::iterator endROBCache()   { return m_online_robmap.end(); }
+    virtual std::map<uint32_t, ROBF>::iterator beginROBCache() override { return m_online_robmap.begin(); }
+    virtual std::map<uint32_t, ROBF>::iterator endROBCache()   override { return m_online_robmap.end(); }
 
     /// Check if complete event data are already in cache
     virtual bool isEventComplete() { return m_isEventComplete; }
+    virtual bool isEventComplete() const { return m_isEventComplete; }
+    virtual bool isEventComplete(const EventContext&) const override
+    { return m_isEventComplete; }
 
     /// Collect all data for an event from the ROS and put them into the cache
     /// Return value: number of ROBs which were retrieved to complete the event
-    virtual int collectCompleteEventData(const std::string callerName="UNKNOWN");
+    virtual int collectCompleteEventData(const std::string callerName="UNKNOWN") override;
+    virtual int collectCompleteEventData(const EventContext&, const std::string callerName="UNKNOWN") override;
 
     /// set the name of the program which uses the ROBDataProviderSvc
-    virtual void setCallerName(const std::string);
+    virtual void setCallerName(const std::string) override;
 
     /// get the name of the program which is presently registered in the ROBDataProviderSvc
-    virtual std::string getCallerName() { return m_callerName; };
+    virtual std::string getCallerName() override { return m_callerName; };
 
     /// --- Implementation of IIncidentListener interface ---
 
     // handler for BeginRun actions
-    void handle(const Incident& incident);
+    void handle(const Incident& incident) override;
 
 protected:
     /**
diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.h b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.h
index 0f0ba0bcc8a..4d75083340d 100644
--- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.h
+++ b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.h
@@ -88,12 +88,18 @@ class TrigROBDataProviderSvc_RTT : public TrigROBDataProviderSvc,
   void handle(const Incident& incident);
 
   /// Check if complete event data are already in cache
-  bool isEventComplete() { return TrigROBDataProviderSvc::isEventComplete();} ;
+  virtual bool isEventComplete() { return TrigROBDataProviderSvc::isEventComplete(); }
+  virtual bool isEventComplete() const { return TrigROBDataProviderSvc::isEventComplete(); }
+  virtual bool isEventComplete(const EventContext& ctx) const override
+  { return TrigROBDataProviderSvc::isEventComplete(ctx); }
 
   /// Collect all data for an event from the ROS and put them into the cache
   /// Return value: number of ROBs which were retrieved to complete the event
   /// Optinonally the name of the caller of this method can be specified for cost monitoring
-  int collectCompleteEventData(const std::string callerName="UNKNOWN") {return TrigROBDataProviderSvc::collectCompleteEventData(callerName);};
+  virtual int collectCompleteEventData(const std::string callerName="UNKNOWN") override
+  { return TrigROBDataProviderSvc::collectCompleteEventData (callerName); }
+  virtual int collectCompleteEventData(const EventContext& ctx, const std::string callerName="UNKNOWN") override
+  { return TrigROBDataProviderSvc::collectCompleteEventData (ctx, callerName); }
 
   bool isMissingPrefetching()     { return 0;};// m_missingPrefetchingPerEvent; };
 
diff --git a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/CMakeLists.txt b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/CMakeLists.txt
index 2c0cb5aa4ea..f616a6f0f95 100644
--- a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/CMakeLists.txt
+++ b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/CMakeLists.txt
@@ -16,10 +16,6 @@ atlas_depends_on_subdirs( PUBLIC
                           Control/CxxUtils
                           Control/AthenaKernel
                           Control/DataModelRoot
-                          Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
-                          Database/APR/PersistencySvc
                           Database/APR/StorageSvc
                           Database/PersistentDataModel
                           Trigger/TrigDataAccess/TrigSerializeResult
@@ -34,10 +30,10 @@ atlas_add_library( TrigSerializeCnvSvcLib
                    PUBLIC_HEADERS TrigSerializeCnvSvc
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
                    LINK_LIBRARIES AthContainers AthenaBaseComps SGTools GaudiKernel StoreGateLib SGtests TrigSerializeResultLib TrigSerializeTPLib
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaKernel DataModelRoot CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc PersistentDataModel )
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaKernel DataModelRoot StorageSvc PersistentDataModel )
 
 atlas_add_component( TrigSerializeCnvSvc
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaBaseComps SGTools StoreGateLib SGtests GaudiKernel AthenaKernel DataModelRoot CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc PersistentDataModel TrigSerializeResultLib TrigSerializeTPLib TrigSerializeCnvSvcLib )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaBaseComps SGTools StoreGateLib SGtests GaudiKernel AthenaKernel DataModelRoot StorageSvc PersistentDataModel TrigSerializeResultLib TrigSerializeTPLib TrigSerializeCnvSvcLib )
 
diff --git a/Trigger/TrigEvent/TrigInDetEvent/CMakeLists.txt b/Trigger/TrigEvent/TrigInDetEvent/CMakeLists.txt
index e2acfb7c2e7..06b9760a052 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigInDetEvent/CMakeLists.txt
@@ -7,10 +7,9 @@ atlas_subdir( TrigInDetEvent )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
-                          Control/CLIDSvc
-                          Control/DataModel
+                          Control/AthenaKernel
+                          Control/AthContainers
                           Control/Navigation
-                          Control/SGTools
                           DetectorDescription/Identifier
                           Event/EventKernel
                           Event/FourMom
@@ -43,33 +42,33 @@ atlas_add_library( TrigInDetEvent
                    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
                    DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES ${CLHEP_LIBRARIES} DataModel Navigation SGTools Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack TrigSerializeCnvSvcLib TrigNavigationLib
+                   LINK_LIBRARIES ${CLHEP_LIBRARIES} AthContainers Navigation AthenaKernel Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack TrigSerializeCnvSvcLib TrigNavigationLib
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex )
 
 atlas_add_sercnv_library( TrigInDetEventSerCnv
                           FILES TrigInDetEvent/TrigInDetTrack.h TrigInDetEvent/TrigInDetTrackCollection.h TrigInDetEvent/TrigInDetTrackFitPar.h TrigInDetEvent/TrigVertex.h TrigInDetEvent/TrigVertexCollection.h TrigInDetEvent/TrigTrackCounts.h TrigInDetEvent/TrigTrackCountsCollection.h TrigInDetEvent/TrigVertexCounts.h TrigInDetEvent/TrigVertexCountsCollection.h TrigInDetEvent/TrigTauTracksInfo.h TrigInDetEvent/TrigTauTracksInfoCollection.h TrigInDetEvent/TrigHisto1D.h TrigInDetEvent/TrigHisto2D.h TrigInDetEvent/TrigSpacePointCounts.h TrigInDetEvent/TrigSpacePointCountsCollection.h TrigInDetEvent/TrigTrtHitCounts.h TrigInDetEvent/TrigTrtHitCountsCollection.h TrkTrack/TrackCollection.h TrkTrack/TrackExtensionMap.h VxVertex/VxContainer.h TrkSegment/SegmentCollection.h Particle/TrackParticleContainer.h
                           TYPES_WITH_NAMESPACE Rec::TrackParticleContainer Trk::SegmentCollection
                           INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                          LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel Navigation SGTools Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex TrigSerializeCnvSvcLib TrigNavigationLib TrigInDetEvent )
+                          LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers Navigation AthenaKernel Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex TrigSerializeCnvSvcLib TrigNavigationLib TrigInDetEvent )
 
 atlas_add_sercnv_library( TrigInDetEventxAODSerCnv
                           FILES xAODTracking/VertexContainer.h xAODTracking/VertexAuxContainer.h xAODTracking/TrackParticleContainer.h xAODTracking/TrackParticleAuxContainer.h xAODTrigMinBias/TrigSpacePointCounts.h xAODTrigMinBias/TrigSpacePointCountsContainer.h xAODTrigMinBias/TrigSpacePointCountsAuxContainer.h xAODTrigMinBias/TrigHisto2D.h xAODTrigMinBias/TrigHisto2DContainer.h xAODTrigMinBias/TrigHisto2DAuxContainer.h xAODTrigMinBias/TrigVertexCounts.h xAODTrigMinBias/TrigVertexCountsContainer.h xAODTrigMinBias/TrigVertexCountsAuxContainer.h xAODTrigMinBias/TrigTrackCounts.h xAODTrigMinBias/TrigTrackCountsContainer.h xAODTrigMinBias/TrigTrackCountsAuxContainer.h
                           TYPES_WITH_NAMESPACE xAOD::TrackParticle xAOD::TrackParticleContainer xAOD::TrackParticleAuxContainer xAOD::Vertex xAOD::VertexContainer xAOD::VertexAuxContainer xAOD::TrigSpacePointCounts xAOD::TrigSpacePointCountsContainer xAOD::TrigSpacePointCountsAuxContainer xAOD::TrigHisto2D xAOD::TrigHisto2DContainer xAOD::TrigHisto2DAuxContainer xAOD::TrigVertexCounts xAOD::TrigVertexCountsContainer xAOD::TrigVertexCountsAuxContainer xAOD::TrigTrackCounts xAOD::TrigTrackCountsContainer xAOD::TrigTrackCountsAuxContainer
                           CNV_PFX xAOD
                           INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                          LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel Navigation SGTools Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex TrigSerializeCnvSvcLib TrigNavigationLib TrigInDetEvent )
+                          LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers Navigation AthenaKernel Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex TrigSerializeCnvSvcLib TrigNavigationLib TrigInDetEvent )
 
 atlas_add_dictionary( TrigInDetEvent_cDict
                       TrigInDetEvent/TrigInDetEvent_cDict.h
                       TrigInDetEvent/selection_c.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel Navigation SGTools Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex TrigSerializeCnvSvcLib TrigNavigationLib TrigInDetEvent )
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers Navigation AthenaKernel Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex TrigSerializeCnvSvcLib TrigNavigationLib TrigInDetEvent )
 
 atlas_add_dictionary( TrigInDetEventDict
                       TrigInDetEvent/TrigInDetEventDict.h
                       TrigInDetEvent/selection.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel Navigation SGTools Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex TrigSerializeCnvSvcLib TrigNavigationLib TrigInDetEvent
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers Navigation AthenaKernel Identifier EventKernel FourMom GaudiKernel InDetPrepRawData TrkPrepRawData TrkSpacePoint TrkTrack xAODTracking xAODTrigMinBias Particle ParticleTruth TrkParameters TrkSegment TrkTruthData VxSecVertex VxVertex TrigSerializeCnvSvcLib TrigNavigationLib TrigInDetEvent
                       DATA_LINKS TrigTrackCounts TrigVertexCounts TrigTauTracksInfo TrigSpacePointCounts TrigTrtHitCounts TrigVertexCollection
                       ELEMENT_LINKS TrigInDetTrackCollection )
 
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1D.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1D.h
index f6840dfc271..bcf731edc12 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1D.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1D.h
@@ -5,7 +5,7 @@
 #ifndef TRIGINDETEVENT_TRIGHISTO1D_H
 #define TRIGINDETEVENT_TRIGHISTO1D_H
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 
 #include "TrigHisto.h"
 
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1DContainer.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1DContainer.h
index a570a505171..8ffd3a7ca90 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1DContainer.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1DContainer.h
@@ -5,10 +5,10 @@
 #ifndef TRIGINDETEVENT_TRIGHISTO1DCONTAINER_H
 #define TRIGINDETEVENT_TRIGHISTO1DCONTAINER_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigHisto1D.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 /** @class TrigHistoContainer
  * @author W. H. Bell <W.Bell@cern.ch>
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2D.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2D.h
index ff724536ff4..124fe10b65d 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2D.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2D.h
@@ -5,7 +5,7 @@
 #ifndef TRIGINDETEVENT_TRIGHISTO2D_H
 #define TRIGINDETEVENT_TRIGHISTO2D_H
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 
 #include "TrigHisto.h"
 #include "TrigHisto1D.h"
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2DContainer.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2DContainer.h
index 64b56a0d0ae..6b43f0addb3 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2DContainer.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2DContainer.h
@@ -5,10 +5,10 @@
 #ifndef TRIGINDETEVENT_TRIGHISTO2DCONTAINER_H
 #define TRIGINDETEVENT_TRIGHISTO2DCONTAINER_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigHisto2D.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 /** @class TrigHistoContainer
  * @author W. H. Bell <W.Bell@cern.ch>
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrack.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrack.h
index 47d9d1d9f87..13f0be9efce 100755
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrack.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrack.h
@@ -4,7 +4,7 @@
 
 #ifndef TRIGINDETTRACK_H
 #define TRIGINDETTRACK_H
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "TrigInDetEvent/TrigSiSpacePoint.h"
 #include "TrigInDetEvent/TrigInDetTrackFitPar.h"
 #include "InDetPrepRawData/TRT_DriftCircle.h"
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackCollection.h
index d39cf925170..b48ff0a1604 100755
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackCollection.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackCollection.h
@@ -5,10 +5,10 @@
 #ifndef TRIG_IN_DET_TRACK_COLLECTION_H
 #define TRIG_IN_DET_TRACK_COLLECTION_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigInDetTrack.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 class TrigInDetTrackCollection : public DataVector<TrigInDetTrack> {
 
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackFitPar.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackFitPar.h
index 7f40c06250a..f490c4b9007 100755
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackFitPar.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackFitPar.h
@@ -4,8 +4,8 @@
 
 #ifndef TRIGINDETTRACKFITPAR_H
 #define TRIGINDETTRACKFITPAR_H
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include <vector>
 
 /** @class TrigInDetTrackFitPar
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointCollection.h
index 385f5a27078..29e6a43b064 100755
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointCollection.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointCollection.h
@@ -5,7 +5,7 @@
 #ifndef TRIGSISPACEPOINTCOLLECTION_H
 #define TRIGSISPACEPOINTCOLLECTION_H
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "TrkPrepRawData/PrepRawDataCollection.h"
 #include "TrkPrepRawData/PrepRawDataContainer.h"
 #include "TrigInDetEvent/TrigSiSpacePoint.h"
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCounts.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCounts.h
index ce40668dac0..c990570e246 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCounts.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCounts.h
@@ -8,7 +8,7 @@
 #include "TrigInDetEvent/TrigHisto2D.h"
 #include "Identifier/Identifier.h"
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 
 /** @class TrigSpacePointCounts
  * @author Regina Kwee <regina.kwee@cern.ch>
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCountsCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCountsCollection.h
index 8d1598563fd..9a7f04efcc9 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCountsCollection.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCountsCollection.h
@@ -5,10 +5,10 @@
 #ifndef TRIGINDETEVENT_TRIGSPACEPOINTCOUNTSCOLLECTION_H
 #define TRIGINDETEVENT_TRIGSPACEPOINTCOUNTSCOLLECTION_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigSpacePointCounts.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 /** @class TrigSctSpCountsCollection
  * @author Regina Kwee <Regina.Kwee@cern.ch>
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfo.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfo.h
index cbce08f4f1d..67bdc66b963 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfo.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfo.h
@@ -15,7 +15,7 @@
 
 
 */
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "FourMom/P4PtEtaPhiM.h"
 #include "FourMom/P4PxPyPzE.h"
 #include "Navigation/Navigable.h"
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfoCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfoCollection.h
index d7dd4db8398..cf67d986ce6 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfoCollection.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfoCollection.h
@@ -5,10 +5,10 @@
 #ifndef TRIGTAUTRACKSINFOCOLLECTION_H
 #define TRIGTAUTRACKSINFOCOLLECTION_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigTauTracksInfo.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 class TrigTauTracksInfoCollection : public DataVector<TrigTauTracksInfo> { }; 
 
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCounts.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCounts.h
index aa9d0c3a3f8..dc6a44b5fa8 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCounts.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCounts.h
@@ -7,7 +7,7 @@
 
 #include "TrigInDetEvent/TrigHisto2D.h"
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 
 /** @class TrigTrackCounts
  * @author Regina Kwee <regina.kwee@cern.ch>
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCountsCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCountsCollection.h
index ea34f5eb2cd..a75d8a4b34b 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCountsCollection.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCountsCollection.h
@@ -5,10 +5,10 @@
 #ifndef TRIGINDETEVENT_TRIGTRACKCOUNTSCOLLECTION_H
 #define TRIGINDETEVENT_TRIGTRACKCOUNTSCOLLECTION_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigTrackCounts.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 class TrigTrackCountsCollection : public DataVector<TrigTrackCounts> { }; 
 
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCounts.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCounts.h
index 4c5b3d4a6ee..298001cf4f4 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCounts.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCounts.h
@@ -7,7 +7,7 @@
 
 #include "TrigInDetEvent/TrigHisto1D.h"
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 
 /** @class TrigTrtHitCounts
  * @author Regina Kwee <regina.kweeATcern.ch>
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCountsCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCountsCollection.h
index b3813d4ad1c..714356226ee 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCountsCollection.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCountsCollection.h
@@ -5,10 +5,10 @@
 #ifndef TRIGINDETEVENT_TRIGTRTHITCOUNTSCOLLECTION_H
 #define TRIGINDETEVENT_TRIGTRTHITCOUNTSCOLLECTION_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigTrtHitCounts.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 /** @class TrigTrtHitCountsCollection
  * @author Samir Ferrag <S.Ferrag@physics.gla.ac.uk>
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCollection.h
index ad2b523e915..3def7b1dd2e 100755
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCollection.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCollection.h
@@ -5,10 +5,10 @@
 #ifndef TRIGINDETEVENT_TRIGVERTEXCOLLECTION_H
 #define TRIGINDETEVENT_TRIGVERTEXCOLLECTION_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigVertex.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 class TrigVertexCollection: public DataVector< TrigVertex > {};
 //typedef   DataVector<TrigVertex>  TrigVertexCollection;
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCounts.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCounts.h
index 6db56021d3b..9a8cd71af72 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCounts.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCounts.h
@@ -5,7 +5,7 @@
 #ifndef TRIGINDETEVENT_TRIGVERTEXCOUNTS_H
 #define TRIGINDETEVENT_TRIGVERTEXCOUNTS_H
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 
 /** @class TrigVertexCounts
  * @author W. H. Bell <W.Bell@cern.ch>
diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCountsCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCountsCollection.h
index 46f75516139..7a6b7f1c8b8 100644
--- a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCountsCollection.h
+++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCountsCollection.h
@@ -5,10 +5,10 @@
 #ifndef TRIGINDETEVENT_TRIGVERTEXCOUNTSCOLLECTION_H
 #define TRIGINDETEVENT_TRIGVERTEXCOUNTSCOLLECTION_H
 
-#include "CLIDSvc/CLASS_DEF.h"
-#include "DataModel/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthContainers/DataVector.h"
 #include "TrigInDetEvent/TrigVertexCounts.h"
-#include "SGTools/BaseInfo.h"
+#include "AthenaKernel/BaseInfo.h"
 
 class TrigVertexCountsCollection : public DataVector<TrigVertexCounts> { }; 
 
diff --git a/Trigger/TrigEvent/TrigNavigation/TrigNavigation/Holder.icc b/Trigger/TrigEvent/TrigNavigation/TrigNavigation/Holder.icc
index bfa1e7d3481..68a180b7b8c 100644
--- a/Trigger/TrigEvent/TrigNavigation/TrigNavigation/Holder.icc
+++ b/Trigger/TrigEvent/TrigNavigation/TrigNavigation/Holder.icc
@@ -105,7 +105,7 @@ HLTNavDetails::HolderImp<STORED, CONTAINER>::HolderImp(const std::string& prefix
 /////////////////////////////////////////////////////////////////////////////
 template<class STORED, class CONTAINER>
 HLTNavDetails::HolderImp<STORED, CONTAINER>::~HolderImp() {  
-  typedef Holder<STORED> H;
+  //typedef Holder<STORED> H;
   // Don't touch m_log here --- if we're running global dtors, then
   // it may have already been deleted.
   //if (H::m_log) HMLOG(VERBOSE) << "~HolderImp clearing memory manager" << endmsg;
diff --git a/Trigger/TrigFTK/FastTrackSimWrap/src/FTKRegionalWrapper.cxx b/Trigger/TrigFTK/FastTrackSimWrap/src/FTKRegionalWrapper.cxx
index d7c92f6d170..cd17127a431 100644
--- a/Trigger/TrigFTK/FastTrackSimWrap/src/FTKRegionalWrapper.cxx
+++ b/Trigger/TrigFTK/FastTrackSimWrap/src/FTKRegionalWrapper.cxx
@@ -26,6 +26,18 @@
 #include <algorithm>
 #include <sstream> 
 
+using std::endl;
+using std::vector;
+using std::string;
+using std::stringstream;
+using std::ofstream;
+using std::ios;
+using std::hex;
+using std::dec;
+using std::setprecision;
+using std::setw;
+
+
 FTKRegionalWrapper::FTKRegionalWrapper (const std::string& name, ISvcLocator* pSvcLocator) :
   AthAlgorithm(name, pSvcLocator), 
   m_hitInputTool("FTK_SGHitInput/FTK_SGHitInput"),
diff --git a/Trigger/TrigFTK/TrigFTKByteStream/TrigFTKByteStream/TrigFTKByteStreamTool.h b/Trigger/TrigFTK/TrigFTKByteStream/TrigFTKByteStream/TrigFTKByteStreamTool.h
index 5f5efa19116..42ca33d852b 100755
--- a/Trigger/TrigFTK/TrigFTKByteStream/TrigFTKByteStream/TrigFTKByteStreamTool.h
+++ b/Trigger/TrigFTK/TrigFTKByteStream/TrigFTKByteStream/TrigFTKByteStreamTool.h
@@ -34,9 +34,9 @@
 // forward declarations
 class IROBDataProviderSvc;
 
-
 namespace FTK {
 
+  class FTKByteStreamDecoderEncoderTool;
   /**
      @class TrigFTKByteStreamTool
      @brief An AlgTool class to provide conversion from TrigFTK to ByteStream, and fill it in RawEvent
@@ -68,6 +68,7 @@ namespace FTK {
 			const std::string& objName);
   private:
     FullEventAssembler<> m_fea;
+    ToolHandle <FTK::FTKByteStreamDecoderEncoderTool> m_decoder;
 
   };
 }
diff --git a/Trigger/TrigFTK/TrigFTKByteStream/src/FTKByteStreamDecoderEncoder.cxx b/Trigger/TrigFTK/TrigFTKByteStream/src/FTKByteStreamDecoderEncoder.cxx
index c6c4afc9be9..c380e0cfdab 100644
--- a/Trigger/TrigFTK/TrigFTKByteStream/src/FTKByteStreamDecoderEncoder.cxx
+++ b/Trigger/TrigFTK/TrigFTKByteStream/src/FTKByteStreamDecoderEncoder.cxx
@@ -2,66 +2,122 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
+
+/**
+ * FTKByteStreamDecoderEncoder bytestream encoding and decoding for the FTK
+ *
+ *              original version by B. Mindur and T. Bold
+ *  2017/03/14  trailer [en,de]coding  / J. Masik
+ */
+
 #include "GaudiKernel/MsgStream.h"
 #include "FTKByteStreamDecoderEncoder.h"
+#include "AthenaBaseComps/AthMessaging.h"
+
+static const InterfaceID IID_FTKByteStreamDecoderEncoderTool("FTK::FTKByteStreamDecoderEncoderTool", 1, 0);
+
 using namespace FTKByteStreamDecoderEncoder;
 
-namespace {
-  void unpackNumberOfTracks(OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData, 
-			    uint16_t& nTracksLowPt, uint16_t& nTracksHighPt, uint32_t& nTracks) {
+
+namespace FTK {
+
+
+  FTKByteStreamDecoderEncoderTool::FTKByteStreamDecoderEncoderTool(const std::string& toolname, 
+								   const std::string& type, 
+								   const IInterface* parent) 
+    : AthAlgTool(toolname, type, parent),
+      m_doHeader(false),
+      m_doTrailer(false)
+  {
+    declareInterface< FTK::FTKByteStreamDecoderEncoderTool  >( this );
+    declareProperty("doHeader", m_doHeader);
+    declareProperty("doTrailer", m_doTrailer);
+  }
+
+  const InterfaceID& FTKByteStreamDecoderEncoderTool::interfaceID( )
+  {
+    return IID_FTKByteStreamDecoderEncoderTool;
+  }
+
+  FTKByteStreamDecoderEncoderTool::~FTKByteStreamDecoderEncoderTool(){;}
+
+  StatusCode   FTKByteStreamDecoderEncoderTool::initialize(){
+    return StatusCode::SUCCESS;
+  }
+
+  StatusCode   FTKByteStreamDecoderEncoderTool::finalize(){
+    return StatusCode::SUCCESS;
+  }
+
+  //not used
+  void FTKByteStreamDecoderEncoderTool::packNumberOfTracks(uint16_t nTracksLowPt, uint16_t nTracksHighPt, 
+							   std::vector<uint32_t>& rod ){
+    uint32_t size_data = nTracksHighPt;
+    size_data <<= 16;
+    size_data |= nTracksLowPt;
+    rod.push_back( size_data );
+  }
+
+  //not used
+  void FTKByteStreamDecoderEncoderTool::unpackNumberOfTracks(OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData, 
+							     uint16_t& nTracksLowPt, uint16_t& nTracksHighPt, uint32_t& nTracks){
     nTracksLowPt  =  rodData[0] & 0xffff; 
     nTracksHighPt =  (rodData[0]>>16) & 0xffff; 
-    
+  
     nTracks = nTracksLowPt; // conversion to 32 + assignement
     nTracksLowPt += nTracksHighPt; // adding to more capable type
   }
 
-
-  void packPixelCluster(const FTK_RawPixelCluster& cluster, std::vector<uint32_t>& payload) {
+  
+  void FTKByteStreamDecoderEncoderTool::packPixelCluster(const FTK_RawPixelCluster& cluster, 
+							 std::vector<uint32_t>& payload){
     payload.push_back( cluster.getWordA() );
     payload.push_back( cluster.getWordB() );
   }
-  
-  
-  void unpackPixCluster(OFFLINE_FRAGMENTS_NAMESPACE::PointerType data, FTK_RawPixelCluster& cluster) {
+
+
+  void FTKByteStreamDecoderEncoderTool::unpackPixCluster(OFFLINE_FRAGMENTS_NAMESPACE::PointerType data, 
+							 FTK_RawPixelCluster& cluster){
     cluster.setWordA(*data);
     cluster.setWordB(*(data+1));
   }
 
-  void packSCTCluster(const FTK_RawSCT_Cluster& cluster, std::vector<uint32_t>& payload) {
+  void FTKByteStreamDecoderEncoderTool::packSCTCluster(const FTK_RawSCT_Cluster& cluster, 
+						       std::vector<uint32_t>& payload){
     payload.push_back( cluster.getWord() );
   }
 
-  void unpackSCTCluster(OFFLINE_FRAGMENTS_NAMESPACE::PointerType data, FTK_RawSCT_Cluster& cluster) {
+  void FTKByteStreamDecoderEncoderTool::unpackSCTCluster(OFFLINE_FRAGMENTS_NAMESPACE::PointerType data, 
+							 FTK_RawSCT_Cluster& cluster){
     cluster.setWord(*data);
   }
 
-
-  void packTrack(const FTK_RawTrack* track, std::vector<uint32_t>& payload) {
+  void FTKByteStreamDecoderEncoderTool::packTrack(const FTK_RawTrack* track, 
+						  std::vector<uint32_t>& payload){
     payload.push_back( track->getTH1() );
     payload.push_back( track->getTH2() );
     payload.push_back( track->getTH3() );
     payload.push_back( track->getTH4() );
     payload.push_back( track->getTH5() );
     payload.push_back( track->getTH6() );
-    
+  
     for ( std::vector<FTK_RawPixelCluster>::const_iterator it = track->getPixelClusters().begin();
 	  it != track->getPixelClusters().end(); ++it ) {
       packPixelCluster(*it, payload);
     }
-    
+  
     for ( std::vector<FTK_RawSCT_Cluster>::const_iterator it = track->getSCTClusters().begin();
 	  it != track->getSCTClusters().end(); ++it ) {
       packSCTCluster(*it, payload);
     }
   }
 
-
-
-  FTK_RawTrack* unpackFTTrack( OFFLINE_FRAGMENTS_NAMESPACE::PointerType data) {  
+  FTK_RawTrack* FTKByteStreamDecoderEncoderTool::unpackFTTrack( OFFLINE_FRAGMENTS_NAMESPACE::PointerType data){
     FTK_RawTrack* track = new FTK_RawTrack(data[0], data[1], data[2], data[3], data[4], data[5]); // first six words are track params
+    ATH_MSG_DEBUG("[Track: " << track->getInvPt() << " " << track->getPhi() << " " 
+		  << track->getCotTh() << " " << track->getD0() << "]");
     data += TrackParamsBlobSize;
-    
+  
     // get pixel hits  
     track->getPixelClusters().resize(NPixLayers);
     for ( size_t i = 0; i < size_t(NPixLayers); ++i) {
@@ -69,56 +125,153 @@ namespace {
       unpackPixCluster(data+offset, track->getPixelCluster(i) );    
     }
     data += PixHitParamsBlobSize*NPixLayers;
-    
+  
     // gets SCT hits
     track->getSCTClusters().resize(NSCTLayers);
     for ( size_t i = 0; i < size_t(NSCTLayers); ++i) {
       size_t offset = SCTHitParamsBlobSize*i;
       unpackSCTCluster(data+offset, track->getSCTCluster(i) );    
     }
-    // no more shifts needed
+    // data pointer  shifted in the unpackFTTrack loop
     return track;
-  }  
-} // eof internal namespace
+  }
 
+  
+  void FTKByteStreamDecoderEncoderTool::packHeader(std::vector<uint32_t> &payload){
+    payload.push_back(FTKByteStreamDecoderEncoder::headerMarker);
+    payload.push_back(FTKByteStreamDecoderEncoder::headerSize);
+    payload.push_back(1);     //major and minor number
+    payload.push_back(11);    //source identifier
+    payload.push_back(2);     //run number
+    payload.push_back(3);     //extended lvl1 ID
+    payload.push_back(3);     //bunch crossing ID
+    payload.push_back(3);     //lvl1 trigger type 
+    payload.push_back(3);     //detector event type
+  
+    if (payload.size() != FTKByteStreamDecoderEncoder::headerSize){
+      ATH_MSG_ERROR("Inconsistent header size");
+    }
+  }
+
+  void FTKByteStreamDecoderEncoderTool::unpackHeader(OFFLINE_FRAGMENTS_NAMESPACE::PointerType &rodData){
+    //marker
+    uint32_t marker = rodData[0];
+    if (marker!=FTKByteStreamDecoderEncoder::headerMarker){
+      ATH_MSG_DEBUG("Not dealing with an FTK fragment " << std::hex << marker << " vs the marker " << FTKByteStreamDecoderEncoder::headerMarker << std::dec );
+      //rodData += FTKByteStreamDecoderEncoder::headerSize -1;
+      return;
+    }
+    //skip to the end
+    rodData += 9;
+  }
+
+  void FTKByteStreamDecoderEncoderTool::packTrailer(std::vector<uint32_t> &payload){
+
+    //    packMonitoring()
+    payload.push_back(1);   //extL1id
+    payload.push_back(0);   //error_flag
+    payload.push_back(10);   //reserved word #1
+    payload.push_back(20);   //reserved word #2
+    payload.push_back(0);    //FLIC status
+    payload.push_back(0);    //numelements
+    payload.push_back(0);    //numdataelements
+    payload.push_back(0x1);  //statusBlock
+    
+  }
+
+  void FTKByteStreamDecoderEncoderTool::unpackMonitoring(OFFLINE_FRAGMENTS_NAMESPACE::PointerType &rodData){
+    if ( (rodData[0] & 0xFFFF0000) == 0xE0DA0000) {
+      ATH_MSG_DEBUG("marker 0xE0DA0000 found");
+      //while (
+    }
+    return;
+  }
+
+
+  void FTKByteStreamDecoderEncoderTool::unpackTrailer(OFFLINE_FRAGMENTS_NAMESPACE::PointerType &rodData){
+    auto beforeMonitoring = rodData;
+    unpackMonitoring(rodData);
+    if (rodData == beforeMonitoring){
+      ATH_MSG_DEBUG("Extra monitoring records not found");
+    } else {
+      ATH_MSG_DEBUG("Monitoring records of size " << (rodData-beforeMonitoring)/sizeof(OFFLINE_FRAGMENTS_NAMESPACE::PointerType));
+    }
+
+    uint32_t extL1id = rodData[0];     rodData++;
+    ATH_MSG_DEBUG("extL1id " << extL1id);
+
+    uint32_t error_flag = rodData[0];  rodData++;
+    ATH_MSG_DEBUG("error_flag " << error_flag);
+    //2 reserved words
+    ATH_MSG_DEBUG("reserved " << rodData[0]);   rodData++;
+    ATH_MSG_DEBUG("reserved " << rodData[0]);   rodData++;
+
+    //FLIC status  (TBD)
+    ATH_MSG_DEBUG("FLIC " << rodData[0]);   rodData++;
+    rodData++;
 
-namespace FTKByteStreamDecoderEncoder {
-  StatusCode encode(const FTK_RawTrackContainer* container, std::vector<uint32_t>& payload,  
-		    MsgStream& /*msg*/) {
+    //
+    uint32_t  numStatusElems = rodData[0]; rodData++;
+    ATH_MSG_DEBUG("Number of Status Elements " << numStatusElems);
 
+    uint32_t  numDataElems  = rodData[0]; rodData++;
+    ATH_MSG_DEBUG("Number of Data Elements " << numDataElems);
+    
+    //status block position
+    uint32_t  statusBlock = rodData[0]; rodData++;
+    if (statusBlock != 0x1){
+      ATH_MSG_ERROR("Status block position should read 0x1");
+    }
+  }
+
+  StatusCode FTKByteStreamDecoderEncoderTool::encode(const FTK_RawTrackContainer* container, std::vector<uint32_t>& payload) {
+  
     // We used to have a word defining the number of low/high pt tracks, that is no longer necessary
     // // do not know yet what tracks are high pT, so all will be low pT
     // payload.reserve( 1 + TrackParamsBlobSize * container->size() );
     // packNumberOfTracks( container->size(), 0, payload );  
-
+  
     payload.reserve(TrackParamsBlobSize * container->size() );
+  
+    if (m_doHeader){
+      packHeader(payload);
+    }
     
     for ( FTK_RawTrackContainer::const_iterator track = container->begin(); 
 	  track != container->end(); ++track ) {
       packTrack(*track, payload);
     }
+
+    if (m_doTrailer){
+      packTrailer(payload);
+    }
+    
     return StatusCode::SUCCESS;
+  
   }  
 
 
-
-  StatusCode decode(uint32_t nTracks, OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData, FTK_RawTrackContainer* result, 
-		    MsgStream& /*msg*/) {
+  StatusCode FTKByteStreamDecoderEncoderTool::decode(uint32_t nTracks, OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData, FTK_RawTrackContainer* result) {
     
+
+    ATH_MSG_DEBUG("rodData: " << rodData);
+    if (m_doHeader){
+      unpackHeader(rodData);
+    }
+    ATH_MSG_DEBUG("rodData: " << rodData);
     result->reserve(result->size() + nTracks);
     for ( size_t i = 0; i < nTracks; ++i ) {
       FTK_RawTrack* track = unpackFTTrack( rodData );
       rodData += TrackBlobSize;
       result->push_back(track);
     }
+
+    if (m_doTrailer){
+      unpackTrailer(rodData);
+    }
+    
     return StatusCode::SUCCESS;
   }
 
-  size_t decodeNumberOfTracks(OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData) {
-    uint16_t low, high;
-    uint32_t all;
-    unpackNumberOfTracks(rodData, low, high, all);
-    return all;
-  }
 
 }
diff --git a/Trigger/TrigFTK/TrigFTKByteStream/src/FTKByteStreamDecoderEncoder.h b/Trigger/TrigFTK/TrigFTKByteStream/src/FTKByteStreamDecoderEncoder.h
index 9b26a7696d3..84361f6f1f8 100644
--- a/Trigger/TrigFTK/TrigFTKByteStream/src/FTKByteStreamDecoderEncoder.h
+++ b/Trigger/TrigFTK/TrigFTKByteStream/src/FTKByteStreamDecoderEncoder.h
@@ -5,13 +5,17 @@
 #ifndef FTKBYTESTREAMDECODERENCODER_H
 #define FTKBYTESTREAMDECODERENCODER_H
 
+#include "AthenaBaseComps/AthAlgTool.h"
 #include "ByteStreamData/RawEvent.h"
 
 #include "TrigFTK_RawData/FTK_RawTrackContainer.h"
 #include "TrigFTK_RawData/FTK_RawPixelCluster.h"
 #include "TrigFTK_RawData/FTK_RawSCT_Cluster.h"
 
+
 namespace FTKByteStreamDecoderEncoder {
+  const uint32_t headerMarker = 0xee1234ee; 
+  const uint32_t headerSize   = 0x9;
   const size_t TrackBlobSize = 22; // magic number from BS specification
   const size_t TrackParamsBlobSize = 6; // --||--
   const size_t PixHitParamsBlobSize = 2; // --||--
@@ -19,13 +23,52 @@ namespace FTKByteStreamDecoderEncoder {
   const size_t NPixLayers=4;
   const size_t NSCTLayers=8;
 
-  StatusCode decode(uint32_t nTracks, OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData, FTK_RawTrackContainer* result,
-  		    MsgStream& msg);
+}
+
+namespace FTK {
 
-  size_t decodeNumberOfTracks(OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData);
+  class FTKByteStreamDecoderEncoderTool : public AthAlgTool {
+    
+  public:
+    FTKByteStreamDecoderEncoderTool(const std::string& name, const std::string& type,
+				    const IInterface* parent);
+    virtual ~FTKByteStreamDecoderEncoderTool();
+    
+    StatusCode initialize();
+    StatusCode finalize();
+    
+    StatusCode decode(uint32_t nTracks, OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData, FTK_RawTrackContainer* result);
+    StatusCode encode(const FTK_RawTrackContainer* result, std::vector<uint32_t>& payload);
+    
+    static const InterfaceID& interfaceID( ) ; 
+    
+  private:
+    //to be removed
+    void packNumberOfTracks(uint16_t nTracksLowPt, uint16_t nTracksHighPt, std::vector<uint32_t>& rod );
+    void unpackNumberOfTracks(OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData, 
+			      uint16_t& nTracksLowPt, uint16_t& nTracksHighPt, uint32_t& nTracks);
 
-  StatusCode encode(const FTK_RawTrackContainer* result, std::vector<uint32_t>& payload,
-  		    MsgStream& msg);
-}
+    //
+    void packPixelCluster(const FTK_RawPixelCluster& cluster, std::vector<uint32_t>& payload);
+    void unpackPixCluster(OFFLINE_FRAGMENTS_NAMESPACE::PointerType data, FTK_RawPixelCluster& cluster);
+    
+    void packSCTCluster(const FTK_RawSCT_Cluster& cluster, std::vector<uint32_t>& payload);
+    void unpackSCTCluster(OFFLINE_FRAGMENTS_NAMESPACE::PointerType data, FTK_RawSCT_Cluster& cluster);
+    
+    void packTrack(const FTK_RawTrack* track, std::vector<uint32_t>& payload);
+    FTK_RawTrack* unpackFTTrack( OFFLINE_FRAGMENTS_NAMESPACE::PointerType data);
+    
+    void packHeader(std::vector<uint32_t> &payload);
+    void unpackHeader(OFFLINE_FRAGMENTS_NAMESPACE::PointerType &rodData);
+    
+    void packTrailer(std::vector<uint32_t> &payload);
+    void unpackTrailer(OFFLINE_FRAGMENTS_NAMESPACE::PointerType &rodData);
 
+    void unpackMonitoring(OFFLINE_FRAGMENTS_NAMESPACE::PointerType &rodData);
+
+    bool m_doHeader;
+    bool m_doTrailer;
+  };
+
+}
 #endif
diff --git a/Trigger/TrigFTK/TrigFTKByteStream/src/FTKDump.cxx b/Trigger/TrigFTK/TrigFTKByteStream/src/FTKDump.cxx
index 4ac78436e67..163c08debe4 100644
--- a/Trigger/TrigFTK/TrigFTKByteStream/src/FTKDump.cxx
+++ b/Trigger/TrigFTK/TrigFTKByteStream/src/FTKDump.cxx
@@ -2,31 +2,35 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "FTKDump.h"
-#include "TrigFTK_RawData/FTK_RawTrackContainer.h"
-#include "AthenaKernel/errorcheck.h"
-#include "GaudiKernel/MsgStream.h"
-
-FTKDump::FTKDump(const std::string &name, ISvcLocator *pSvcLocator)
-   : AthAlgorithm( name, pSvcLocator ) {
-
-}
-
-FTKDump::~FTKDump(){
-}
-
-StatusCode FTKDump::initialize() {
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode FTKDump::execute() {
-
-  const FTK_RawTrackContainer* tracks_ptr;
-
-  CHECK(evtStore()->retrieve(tracks_ptr, "dummy_tracks"));
-
-  ATH_MSG_INFO( "Got no of tracks: " << tracks_ptr->size() );
-
-  return StatusCode::SUCCESS;
-}
+#include "FTKDump.h"
+#include "TrigFTK_RawData/FTK_RawTrackContainer.h"
+#include "AthenaKernel/errorcheck.h"
+#include "AthenaBaseComps/AthMessaging.h"
+
+FTKDump::FTKDump(const std::string &name, ISvcLocator *pSvcLocator)
+   : AthAlgorithm( name, pSvcLocator ) {
+
+
+}
+
+FTKDump::~FTKDump(){
+
+}
+
+StatusCode FTKDump::initialize() {
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode FTKDump::execute() {
+
+  const FTK_RawTrackContainer* tracks_ptr;
+
+  CHECK(evtStore()->retrieve(tracks_ptr, "FTK_RDO_Tracks"));
+
+
+  ATH_MSG_INFO( "Got the tracks " << tracks_ptr->size() );
+
+  return StatusCode::SUCCESS;
+}
+
diff --git a/Trigger/TrigFTK/TrigFTKByteStream/src/FTKDump.h b/Trigger/TrigFTK/TrigFTKByteStream/src/FTKDump.h
index 9f44ff00fcb..8880e2192b5 100644
--- a/Trigger/TrigFTK/TrigFTKByteStream/src/FTKDump.h
+++ b/Trigger/TrigFTK/TrigFTKByteStream/src/FTKDump.h
@@ -20,8 +20,6 @@ class MsgStream;
 *
 * @author Bartosz Mindur <bartosz.mindur@cern.ch> AGH-UST Krakow
 *
-* $Revision$
-* $Date$
 */
 class FTKDump : public AthAlgorithm {
 
@@ -34,6 +32,9 @@ public:
   virtual StatusCode initialize();
   /// Function called at each event
   virtual StatusCode execute();
+
+private:
+  //
 }; // class FTKDump
 
 #endif // FTK_DUMP_EXAMPLE_H
diff --git a/Trigger/TrigFTK/TrigFTKByteStream/src/TrigFTKByteStreamTool.cxx b/Trigger/TrigFTK/TrigFTKByteStream/src/TrigFTKByteStreamTool.cxx
index 3f464757438..d5943002e37 100755
--- a/Trigger/TrigFTK/TrigFTKByteStream/src/TrigFTKByteStreamTool.cxx
+++ b/Trigger/TrigFTK/TrigFTKByteStream/src/TrigFTKByteStreamTool.cxx
@@ -20,7 +20,8 @@ static const InterfaceID IID_ITrigFTKByteStreamTool("TrigFTKByteStreamTool", 1,
 
 //------------------------------------------------------------------------------
 FTK::TrigFTKByteStreamTool::TrigFTKByteStreamTool( const std::string& type, const std::string& name, const IInterface* parent )
-   :  AthAlgTool(type,name,parent)
+  :  AthAlgTool(type,name,parent),
+     m_decoder("FTK::FTKByteStreamDecoderEncoderTool")
 {
   declareInterface< FTK::TrigFTKByteStreamTool  >( this );
 }
@@ -40,6 +41,14 @@ const InterfaceID& FTK::TrigFTKByteStreamTool::interfaceID( )
 StatusCode FTK::TrigFTKByteStreamTool::initialize()
 {
    ATH_MSG_DEBUG( "TrigFTKByteStreamTool has been loaded");
+   if (m_decoder.retrieve().isFailure()){
+     ATH_MSG_ERROR("could not retrieve " << m_decoder);
+     return StatusCode::FAILURE;
+   }
+   else {
+     ATH_MSG_DEBUG(m_decoder.name() << " retrieved successfully");
+   }
+
    return AlgTool::initialize();
 }
 
@@ -68,8 +77,9 @@ StatusCode FTK::TrigFTKByteStreamTool::convert( const FTK_RawTrackContainer* con
   FullEventAssembler<SrcIdMap>::RODDATA* theROD = m_fea.getRodData( ftkROBID() );
   std::vector<uint32_t>& payload = *theROD ;
   
-  CHECK(FTKByteStreamDecoderEncoder::encode(container, payload, msg()));
-    
+  //  CHECK(FTKByteStreamDecoderEncoder::encode(container, payload, msg()));
+  m_decoder->encode(container, payload);
+
   m_fea.fill(re, msg());
 
   return StatusCode::SUCCESS;
@@ -103,7 +113,7 @@ StatusCode FTK::TrigFTKByteStreamTool::convert(IROBDataProviderSvc& dataProvider
     const uint32_t nData  = (*rob)->rod_ndata();
     const size_t sourceID = (*rob)->rod_source_id();
     ATH_MSG_DEBUG ( "[convert to FTK_RawTrackContainer] Reading fragment of size " << nData
-		    << " from source " << std::hex << sourceID );
+		    << " from source " << std::hex << sourceID << std::dec);
 
     if ( nData == 0 ) {
       ATH_MSG_DEBUG( "[convert to FTK_RawTrackContainer] empty data payload" );      
@@ -118,7 +128,7 @@ StatusCode FTK::TrigFTKByteStreamTool::convert(IROBDataProviderSvc& dataProvider
     OFFLINE_FRAGMENTS_NAMESPACE::PointerType rodData = 0;
     (*rob)->rod_data(rodData);
 
-    uint32_t nTracks = nData / 22; //22: TrackBlobSize, FTKByteStreamDecoderEncoder.h
+    uint32_t nTracks = nData / FTKByteStreamDecoderEncoder::TrackBlobSize;
     
     // sanity check about the sizes
     // if ( nData == nTracks * FTKByteStreamDecoderEncoder::TrackBlobSize + 1) {
@@ -128,7 +138,11 @@ StatusCode FTK::TrigFTKByteStreamTool::convert(IROBDataProviderSvc& dataProvider
     //   return StatusCode::FAILURE;
     // }
 
-    CHECK( FTKByteStreamDecoderEncoder::decode(nTracks, rodData, result, msg()));    
+
+    StatusCode scdc = m_decoder->decode(nTracks, rodData, result);    
+    if (scdc.isFailure()){
+      ATH_MSG_WARNING("problem in decoding the rob fragment");
+    }
   }
   return StatusCode::SUCCESS;
 }
diff --git a/Trigger/TrigFTK/TrigFTKByteStream/src/components/TrigTrigFTKByteStream_entries.cxx b/Trigger/TrigFTK/TrigFTKByteStream/src/components/TrigTrigFTKByteStream_entries.cxx
index 37fe07ce97f..9b274365e3c 100644
--- a/Trigger/TrigFTK/TrigFTKByteStream/src/components/TrigTrigFTKByteStream_entries.cxx
+++ b/Trigger/TrigFTK/TrigFTKByteStream/src/components/TrigTrigFTKByteStream_entries.cxx
@@ -1,9 +1,10 @@
-
 #include "TrigFTKByteStream/TrigFTKByteStreamCnv.h"
 #include "TrigFTKByteStream/TrigFTKByteStreamTool.h"
+#include "../FTKByteStreamDecoderEncoder.h"
 #include "../FTKDump.h"
 
 DECLARE_CONVERTER_FACTORY( FTK::TrigFTKByteStreamCnv )
 DECLARE_COMPONENT( FTK::TrigFTKByteStreamTool )
+DECLARE_COMPONENT( FTK::FTKByteStreamDecoderEncoderTool )
 DECLARE_COMPONENT( FTKDump )
 
diff --git a/Trigger/TrigFTK/TrigFTKPool/TrigFTKPool/FTKAthTrack.h b/Trigger/TrigFTK/TrigFTKPool/TrigFTKPool/FTKAthTrack.h
index ef4b7cfb72b..07b77f1398e 100644
--- a/Trigger/TrigFTK/TrigFTKPool/TrigFTKPool/FTKAthTrack.h
+++ b/Trigger/TrigFTK/TrigFTKPool/TrigFTKPool/FTKAthTrack.h
@@ -110,7 +110,7 @@ public:
 
   // Function used by the HW to compare similar combinations
   unsigned int getNCommonHits(const FTKAthTrack &, const float*) const;
-  int HWChoice(const FTKAthTrack&,const float*,const unsigned int,int);
+  int HWChoice(const FTKAthTrack&,const float*,const unsigned int,int) const;
 
   FTKAthTrack& operator=(const FTKAthTrack&);
 };
diff --git a/Trigger/TrigFTK/TrigFTKPool/src/FTKAthTrack.cxx b/Trigger/TrigFTK/TrigFTKPool/src/FTKAthTrack.cxx
index 9ba3aebcf8b..a3541342400 100644
--- a/Trigger/TrigFTK/TrigFTKPool/src/FTKAthTrack.cxx
+++ b/Trigger/TrigFTK/TrigFTKPool/src/FTKAthTrack.cxx
@@ -5,9 +5,8 @@
 #include "TrigFTKPool/FTKAthTrack.h"
 
 #include <iostream>
-using namespace std;
-
 #include <TMath.h>
+using namespace std;
 
 FTKAthTrack::FTKAthTrack() :
    m_bankID(-1), m_roadID(-1),
@@ -163,7 +162,7 @@ unsigned int FTKAthTrack::getNCommonHits(const FTKAthTrack &track, const float *
      1 are similar and the other has a worse quality parameter
      -1 are similar and the other has a better quality parameter */
 int FTKAthTrack::HWChoice(const FTKAthTrack &other, const float *HW_dev,
-		       const unsigned int HW_ndiff, int HW_level)
+		       const unsigned int HW_ndiff, int HW_level) const
 {
   int accepted(0);
 
diff --git a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKObjectInput.h b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKObjectInput.h
index d8725f44e09..71557ec9013 100644
--- a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKObjectInput.h
+++ b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKObjectInput.h
@@ -17,7 +17,6 @@
 #include <TFile.h>
 #include <TTree.h>
 
-using namespace std;
 
 template<class FTKObjectStream, class FTKObject>
 class FTKObjectInput {
@@ -99,17 +98,17 @@ int FTKObjectInput<FTKObjectStream,FTKObject>::addFile(const char *path)
   int res = access(path,R_OK);
   if (!res) { // add the file
     m_files_path.push_back(path);
-    cout << "Added input file: " << path << endl;
+    std::cout << "Added input file: " << path << std::endl;
     return 0;
   }
   else if (res==EACCES) {
-    cerr << "*** warning: accessing the file: " << path << endl;    
+    std::cerr << "*** warning: accessing the file: " << path << std::endl;    
   }
   else if (res==ENOENT) {
-    cerr << "*** warning: doesn't exist: " << path << endl;
+    std::cerr << "*** warning: doesn't exist: " << path << std::endl;
   }
   else {
-        cerr << "*** error reading: " << path << endl;
+    std::cerr << "*** error reading: " << path << std::endl;
   }
 
   return -1;
@@ -119,15 +118,15 @@ template<class FTKObjectStream, class FTKObject>
 int FTKObjectInput<FTKObjectStream,FTKObject>::addFileList(const char *pathsfile)
 {
 
-  ifstream filelist(pathsfile);
+  std::ifstream filelist(pathsfile);
   if (!filelist) {
-    cerr << "*** error reading list of paths in: " << pathsfile << endl;
+    std::cerr << "*** error reading list of paths in: " << pathsfile << std::endl;
     return 0;
   }
 
-  string line;
+  std::string line;
   int nfiles(0);
-  while(getline(filelist,line)) {
+  while(std::getline(filelist,line)) {
     if (line[0]=='#') {
       // comment, skip tis line
       continue;
diff --git a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKObjectOutput.h b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKObjectOutput.h
index 06c2e1614c0..7e50d1e48b1 100644
--- a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKObjectOutput.h
+++ b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKObjectOutput.h
@@ -15,7 +15,6 @@
 #include <TBranch.h>
 #include <TROOT.h>
 
-using namespace std;
 
 template<class FTKObjectStream>
 class FTKObjectOutput {
@@ -131,7 +130,7 @@ void FTKObjectOutput<FTKObjectStream>::init(int bufsize, bool *goodRegions)
       // skip bad regions (with no real simulation done)
       if (!goodRegions[ib]) continue;
 
-      const string bname1 = Form(m_datafmt.c_str(),ib);
+      const std::string bname1 = Form(m_datafmt.c_str(),ib);
       if(bufsize)
 	// if buffer size is specified (eg, 16000)
 	tmpBranch = m_tree->Branch(bname1.c_str(),&m_data[ib],bufsize);
@@ -156,7 +155,7 @@ void FTKObjectOutput<FTKObjectStream>::beginFile(const char *fname)
   if (!fname) 
     m_file = TFile::Open(m_filename.c_str(),"recreate");
   else {
-    string realname("");
+    std::string realname("");
     if (m_multifile)
       realname = m_outdir+"/";
     realname += fname;
diff --git a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTK_AMBank.h b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTK_AMBank.h
index 5a1f2d49584..6660b9e2329 100644
--- a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTK_AMBank.h
+++ b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTK_AMBank.h
@@ -26,8 +26,8 @@
 // alternative ss_patt_lookup implementation using a GCC hashmap (controlled via m_use_lookup_map)
 // this is necessary for SCTtrk case, where (int)SS encodes 3 parameters
 // note: this makes road_finder ~30% slower, so use only when needed!
+// FIXME: Why not use unordered_map?
 #include <ext/hash_map>
-using namespace __gnu_cxx;
 
 /** class that define an associative memory */
 class FTK_AMBank : public FTK_AMsimulation_base {
@@ -71,7 +71,7 @@ private:
    const int * getPatterns() const {return m_patterns; }// list of the patterns
  protected:
    // lookup table between ss and patterns:
-   hash_map<int, std::vector<int> > *m_ss_patt_lookup_map;  /*[plane]*/
+   __gnu_cxx::hash_map<int, std::vector<int> > *m_ss_patt_lookup_map;  /*[plane]*/
    int m_lutsepplane;
    bool m_upperindex;
 
diff --git a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTK_RegionalRawInput.h b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTK_RegionalRawInput.h
index 5f39f1945ef..b8b67a0acca 100644
--- a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTK_RegionalRawInput.h
+++ b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTK_RegionalRawInput.h
@@ -42,7 +42,7 @@ class FTK_RegionalRawInput : public FTKDataInput
 
   bool m_readTruthTracks;
   TTree *m_truthTracksTree;
-  vector<FTKTruthTrack> *m_truthTracks;
+  std::vector<FTKTruthTrack> *m_truthTracks;
   
 public:
   FTK_RegionalRawInput(const FTKPlaneMap *pmap, const FTKPlaneMap *pmap_unused = 0x0,bool readTruthTracks=false);
diff --git a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/tsp/TSPROOTBankGenerator.h b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/tsp/TSPROOTBankGenerator.h
index 160796ad50c..68dd97a841b 100644
--- a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/tsp/TSPROOTBankGenerator.h
+++ b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/tsp/TSPROOTBankGenerator.h
@@ -43,7 +43,7 @@ public:
   TSPROOTBankGenerator(FTKSetup* setup, const std::vector<FTKSSMap*> & ssMaps, const std::string& inputBank, const std::string& outBank, unsigned planes = 7, int maxPatterns = -1,int mincoverage=1);
   ~TSPROOTBankGenerator();
 
-	void generate() throw (TSPPatternReadException);
+	void generate();
 	void showstats(int ipatt, int npatterns) const;
         void writeSSMapsToFile();  //!< write maps to root file
 	void SetRemoveTSP(int remtsp) { m_RemoveTSP = remtsp; }
@@ -53,8 +53,8 @@ public:
         void SetSubregion(int iSub, int nSub) {m_iSub = iSub; m_nSub=nSub; }; //!< Get current subregion
 private:
 
-	void readNextPattern(FTKPattern& pattern, int patternID) throw (TSPPatternReadException);
-	void generateChildren(int bankID, int planes) throw (TSPPatternReadException);
+	void readNextPattern(FTKPattern& pattern, int patternID);
+	void generateChildren(int bankID, int planes);
 	int addAMPattern(int bankID, int childID, const std::string& patternKey, TTree *ambank);
 
 	typedef boost::unordered_map<std::string, long> PatternMap;
diff --git a/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneMerge.py b/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneMerge.py
index dd375c552bb..cc528691fcc 100644
--- a/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneMerge.py
+++ b/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneMerge.py
@@ -57,9 +57,12 @@ nb=64
 # prestore some common configurations that can be called through the option FTKSetupTag
 FTKTagOptions = {}
 
-FTKTagOptions['SectorsAsPatterns12L32b3DHWMode2'] = \
-     {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW3D.pmap',
+FTKTagOptions['SaP_Reb64_12L'] = \
+     {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW3D.pmap',
       'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
+FTKTagOptions['SaP_Reb64_8L'] = \
+     {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl3D123.pmap',
+      'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
 FTKTagOptions["TDRv0"] = \
     {'NBanks': 64, 'NSubRegions': 4, 'pmap_path': 'raw_11L.pmap', \
          'loadHWConf_path': 'raw_11L.hw'}
@@ -90,24 +93,6 @@ FTKTagOptions['SectorsAsPatterns32Tower12L3D'] = \
 FTKTagOptions['SectorsAsPatterns32Tower8L3D'] = \
     {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl3D123.pmap',
      'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
-FTKTagOptions['SectorsAsPatterns3D'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl3D123.pmap',
-     'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
-FTKTagOptions['SectorsAsPatterns12L3D'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12Libl3D.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
-FTKTagOptions['SectorsAsPatterns3Dv2'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl3D123.pmap',
-     'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
-FTKTagOptions['SectorsAsPatterns12L3Dv2'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12Libl3D.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
-FTKTagOptions['SectorsAsPatterns8L64b3DHWMode2'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl3D123.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
-FTKTagOptions['SectorsAsPatterns12L64b3DHWMode2'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW3D.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False, 'MergeRoadsDetailed': False}
 FTKTagOptions["HWMode2Test32Tower"] = \
    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW3D.pmap', \
          'loadHWConf_path': 'raw_8LcIbl123.hw'}
@@ -126,42 +111,6 @@ FTKTagOptions["64Tower2017.v1"] = \
 FTKTagOptions["64Tower2017.v2"] = \
    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW3D.pmap', \
          'loadHWConf_path': 'raw_8LcIbl123.hw'}
-FTKTagOptions['SectorsAsPatterns'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl123.pmap',
-     'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns12L'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12Libl.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns12L64b'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns12L64bHWMode2'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns12L32b'] = \
-    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns12L32bHWMode2'] = \
-    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns8L64b'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl123.pmap',
-     'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns8L64bHWMode2'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl123.pmap',
-     'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns8L32b'] = \
-    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl123.pmap',
-     'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns8L32bHWMode2'] = \
-    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl123.pmap',
-     'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatternsHWMode2'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl123.pmap',
-     'loadHWConf_path': 'raw_8Lc.hw', 'MergeRoads': False}
-FTKTagOptions['SectorsAsPatterns12LHWMode2'] = \
-    {'NBanks': 64, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW.pmap',
-     'loadHWConf_path': 'raw_12L.hw', 'MergeRoads': False}
 
 FTKTagOptions['FitITk'] = {
     'MergeRoads' : True ,
diff --git a/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneSim.py b/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneSim.py
index 9ab03a704a9..8b982296086 100644
--- a/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneSim.py
+++ b/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneSim.py
@@ -63,11 +63,11 @@ FTKRoadFinder.DBBankLevel = 1 # read-only
 FTKRoadFinder.IBLMode = IBLMode
 FTKRoadFinder.FixEndCapL0 = FixEndCapL0
 FTKRoadFinder.InputFromWrapper = True
-FTKRoadFinder.MaxMissingSCTPairs = 1
+FTKRoadFinder.MaxMissingSCTPairs = 0
 #FTKRoadFinder.NBanks = NBanks  # is read-only (??)
 #FTKRoadFinderAlgo.NSubRegions = NSubRegions
 #FTKRoadFinderAlgo.OutputLevel
-FTKRoadFinder.PixelClusteringMode = 1
+FTKRoadFinder.PixelClusteringMode = 101
 FTKRoadFinder.Ibl3DRealistic = False
 FTKRoadFinder.RegionalWrapper = True
 FTKRoadFinder.RestrictSctPairLayer = True
@@ -78,7 +78,7 @@ FTKRoadFinder.RestrictSctPairModule = True
 #FTKRoadFinderAlgo.RoadMarket
 FTKRoadFinder.RoadWarrior = 0
 FTKRoadFinder.SaveRoads = False
-FTKRoadFinder.SctClustering = 0
+FTKRoadFinder.SctClustering = 1
 FTKRoadFinder.Clustering = True
 FTKRoadFinder.ReadClusters = False
 FTKRoadFinder.SetAMSize = 0
@@ -135,14 +135,14 @@ runArgsFromTrfOptionalRF = {
     'StoreAllSS' : True,
     'FixEndCapL0': False,
     'ITkMode': False,
-    'PixelClusteringMode': 0,
+    'PixelClusteringMode': 101,
     'Ibl3DRealistic': False,
     'GangedPatternReco' : 0,
     'DuplicateGanged' : 1,
-    'SctClustering': 0,
+    'SctClustering': 1,
     'Clustering': True,
     'ReadClusters': False,
-    'MaxMissingSCTPairs': 1,
+    'MaxMissingSCTPairs': 0,
     'RestrictSctPairModule': True,
     'RestrictSctPairLayer': True,
     'SectorsAsPatterns' : 0,
@@ -656,221 +656,34 @@ FTKTagOptions["TDAQTDRv2HWMode2"] = {
     'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
     'GangedPatternReco': 0, 'DuplicateGanged': 1
     }
-FTKTagOptions['SectorsAsPatterns3D'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl3D123.pmap', 'rmap_path': 'raw_12Libl3D.tmap',
-    'ssmap_path': 'raw_30x32x72Ibl.ss',
-    'ssmapunused_path': 'raw_8LcIBL123_unusedmedium.ss',
-    'pmapunused_path': 'raw_8LcIbl3D123_unused.pmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmaptsp_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw','SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns12L3D'] = {
+
+FTKTagOptions['SaP_Reb64_12L'] = {
     'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_12Libl3D.pmap', 'rmap_path': 'raw_12Libl3D.tmap',
+    'pmap_path': 'raw_12LiblHW3D.pmap', 'rmap_path': 'raw_12Libl64TmodB_3D_t13.tmap',
     'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_12L.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns3Dv2'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl3D123.pmap', 'rmap_path': 'raw_12Libl3Dv2.tmap',
     'ssmap_path': 'raw_30x32x72Ibl.ss',
-    'ssmapunused_path': 'raw_8LcIBL123_unusedmedium.ss',
-    'pmapunused_path': 'raw_8LcIbl3D123_unused.pmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmaptsp_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns12L3Dv2'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_12Libl3D.pmap', 'rmap_path': 'raw_12Libl3Dv2.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_12L.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns12L'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_12Libl.pmap', 'rmap_path': 'raw_12Libl.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_12L.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl123.pmap',
-    'rmap_path': 'raw_12Libl.tmap', 'ssmap_path': 'raw_30x32x72Ibl.ss',
-    'ssmapunused_path': 'raw_8LcIBL123_unusedmedium.ss',
-    'pmapunused_path': 'raw_8LcIbl123_unused.pmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmaptsp_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns12LHWMode2'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_12LiblHW.pmap', 'rmap_path': 'raw_12Libl.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_12L.hw','SecondStageFit': False,
-    'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1,
-    'MaxMissingSCTPairs': 0,
-    'HWModeSS': 2,'ModuleLUTPath': 'raw_12Libl.moduleidmap',
-    'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatternsHWMode2'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl123.pmap', 'rmap_path': 'raw_12Libl.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw','SecondStageFit': False,
-    'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1,
-    'MaxMissingSCTPairs': 0,
-    'HWModeSS': 2,'ModuleLUTPath': 'raw_8LcIbl123.moduleidmap',
-    'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns12L64b3DHWMode2'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_12LiblHW3D.pmap',
-    'rmap_path': 'raw_12Libl64TmodB_3D_t1.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False, \
-    'loadHWConf_path': 'raw_12L.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'MaxMissingSCTPairs': 1,
-    'HWModeSS': 2, 'ModuleLUTPath': 'raw_12Libl.moduleidmap',
-    'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns8L64b3DHWMode2'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl3D123.pmap',
-    'rmap_path': 'raw_12Libl64TmodB_3D_t1.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw','SecondStageFit': False,
-    'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1,
+    'SctClustering': 1,
     'MaxMissingSCTPairs': 0,
-    'HWModeSS': 2,'ModuleLUTPath': 'raw_8LcIbl123.moduleidmap',
-    'SaveRoads': True
-    }
-
-
-FTKTagOptions['SectorsAsPatterns12L32b3DHWMode2'] = \
-    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW3D.pmap', 'rmap_path': 'raw_12Libl32TmodB_3D_t13.tmap', 'bankpatterns': [-1]*NumberOfSubregions, \
-     'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False, \
-     'loadHWConf_path': 'raw_12L.hw','SecondStageFit': False, 'TRACKFITTER_MODE': 1,
-     'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1 , 'MaxMissingSCTPairs': 1, 'HWModeSS': 2,'ModuleLUTPath': 'raw_12Libl.moduleidmap', 'SaveRoads': True}
-FTKTagOptions['SectorsAsPatterns8L32b3DHWMode2'] = \
-    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl3D123.pmap', 'rmap_path': 'raw_12Libl32TmodB_3D_t13.tmap',
-     'bankpatterns': [-1]*NumberOfSubregions, \
-     'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False, \
-     'loadHWConf_path': 'raw_8Lc.hw','SecondStageFit': False,
-     'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1,
-     'MaxMissingSCTPairs': 0,
-     'HWModeSS': 2,'ModuleLUTPath': 'raw_8LcIbl123.moduleidmap', 'SaveRoads': True}
-
-FTKTagOptions['SectorsAsPatterns12L32b3D'] = \
-    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_12LiblHW3D.pmap', 'rmap_path': 'raw_12Libl32TmodB_3D_t13.tmap', 'bankpatterns': [-1]*NumberOfSubregions, \
-     'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False, \
-     'loadHWConf_path': 'raw_12L.hw','SecondStageFit': False, 'TRACKFITTER_MODE': 1,
-     'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1 , 'SaveRoads': True}
-FTKTagOptions['SectorsAsPatterns8L32b3D'] = \
-    {'NBanks': 32, 'NSubRegions': 1, 'pmap_path': 'raw_8LcIbl3D123.pmap', 'rmap_path': 'raw_12Libl32TmodB_3D_t13.tmap',
-     'bankpatterns': [-1]*NumberOfSubregions, \
-     'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False, \
-     'loadHWConf_path': 'raw_8Lc.hw','SecondStageFit': False,
-     'FixEndCapL0': False, 'IBLMode': 2, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1, 'SaveRoads': True}
-
-FTKTagOptions['SectorsAsPatterns12L64b'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_12LiblHW.pmap', 'rmap_path': 'raw_12Libl64TmodB.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_12L.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1, 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns8L64b'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl123.pmap', 'rmap_path': 'raw_12Libl64TmodB.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
+    'UseTSPBank': False, 'Ibl3DRealistic': True,
+    'UseCompressedBank': False,
+    'ModuleLUTPath': 'raw_8LcIbl123_64.moduleidmap', 'ModuleLUTPath2nd': 'raw_12Libl3D.moduleidmap','loadHWConf_path': 'raw_12L.hw','SecondStageFit': False,
+    'HWModeSS': 2,'TRACKFITTER_MODE': 1, 'FixEndCapL0': True, 'IBLMode': 2, 'PixelClusteringMode': 101,
     'SectorsAsPatterns': 1 , 'SaveRoads': True
     }
-FTKTagOptions['SectorsAsPatterns12L64bHWMode2'] = {
-    'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_12LiblHW.pmap', 'rmap_path': 'raw_12Libl64TmodB.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_12L.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'MaxMissingSCTPairs': 1, 'HWModeSS': 2,
-    'ModuleLUTPath': 'raw_12Libl.moduleidmap', 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns8L64bHWMode2'] = {
+
+FTKTagOptions['SaP_Reb64_8L'] = {
     'NBanks': 64, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl123.pmap', 'rmap_path': 'raw_12Libl64TmodB.tmap',
+    'pmap_path': 'raw_8LcIbl3D123.pmap', 'rmap_path': 'raw_12Libl64TmodB_3D_t13.tmap',
     'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw','SecondStageFit': False,
-    'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1,
+    'ssmap_path': 'raw_30x32x72Ibl.ss',
+    'SctClustering': 1,
     'MaxMissingSCTPairs': 0,
-    'HWModeSS': 2,'ModuleLUTPath': 'raw_8LcIbl123.moduleidmap',
-    'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns12L32b'] = {
-    'NBanks': 32, 'NSubRegions': 1,
-    'pmap_path': 'raw_12LiblHW.pmap', 'rmap_path': 'raw_12Libl32TmodB.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_12L.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns8L32b'] = {
-    'NBanks': 32, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl123.pmap', 'rmap_path': 'raw_12Libl32TmodB.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
+    'UseTSPBank': False, 'Ibl3DRealistic': True,
+    'UseCompressedBank': False,
+    'ModuleLUTPath': 'raw_8LcIbl123_64.moduleidmap', 'ModuleLUTPath2nd': 'raw_12Libl3D.moduleidmap','loadHWConf_path': 'raw_8Lc.hw','SecondStageFit': False,
+    'HWModeSS': 2,'TRACKFITTER_MODE': 1, 'FixEndCapL0': True, 'IBLMode': 2, 'PixelClusteringMode': 101,
     'SectorsAsPatterns': 1 , 'SaveRoads': True
     }
-FTKTagOptions['SectorsAsPatterns12L32bHWMode2'] = {
-    'NBanks': 32, 'NSubRegions': 1,
-    'pmap_path': 'raw_12LiblHW.pmap', 'rmap_path': 'raw_12Libl32TmodB.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_12L.hw', 'SecondStageFit': False,
-    'TRACKFITTER_MODE': 1, 'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False,
-    'SectorsAsPatterns': 1 , 'HWModeSS': 2,
-    'ModuleLUTPath': 'raw_12Libl.moduleidmap', 'SaveRoads': True
-    }
-FTKTagOptions['SectorsAsPatterns8L32bHWMode2'] = {
-    'NBanks': 32, 'NSubRegions': 1,
-    'pmap_path': 'raw_8LcIbl123.pmap', 'rmap_path': 'raw_12Libl32TmodB.tmap',
-    'bankpatterns': [-1]*NumberOfSubregions,
-    'ssmap_path': 'raw_15x16x36Ibl.ss', 'UseTSPBank': False,
-    'loadHWConf_path': 'raw_8Lc.hw', 'SecondStageFit': False,
-    'FixEndCapL0': False, 'IBLMode': 1, 'PixelClusteringMode': 1, 'Ibl3DRealistic': False, 'SectorsAsPatterns': 1,
-    'MaxMissingSCTPairs': 0,
-    'HWModeSS': 2,'ModuleLUTPath': 'raw_8LcIbl123.moduleidmap',
-    'SaveRoads': True
-    }
 
 FTKTagOptions['FitITk'] = {
     'MaxMissingSCTPairs': 0,
diff --git a/Trigger/TrigFTK/TrigFTKSim/src/FTKTrackFitterAlgo.cxx b/Trigger/TrigFTK/TrigFTKSim/src/FTKTrackFitterAlgo.cxx
index a02f99d2b28..0d5a1a49833 100644
--- a/Trigger/TrigFTK/TrigFTKSim/src/FTKTrackFitterAlgo.cxx
+++ b/Trigger/TrigFTK/TrigFTKSim/src/FTKTrackFitterAlgo.cxx
@@ -451,12 +451,12 @@ StatusCode FTKTrackFitterAlgo::initialize(){
     
     int ir = m_bankregion[ibank];
     int is = m_banksubregion[ibank];
-    const string &bankpath8L = m_fitconstantspath[ibank];
+    const std::string &bankpath8L = m_fitconstantspath[ibank];
     
     log << MSG::INFO << "*** set bank *** region:" << ir << "\t subregions:" << is << "\t bank path:" << bankpath8L.c_str() << endmsg;
     if(m_SecondStageFit){
-      const string &bankpath11L = m_fit711constantspath[ibank];
-      const string &sectorpath_s = m_sectorpath[ibank];
+      const std::string &bankpath11L = m_fit711constantspath[ibank];
+      const std::string &sectorpath_s = m_sectorpath[ibank];
       log << MSG::INFO << "*** set bank *** region:" << ir << "\t subregions:" << is << "\t bank path:" << bankpath11L.c_str() << endmsg;
 
       FTKConstantBank* bank8 = new FTKConstantBank(dynamic_cast<TrackFitter711*>(m_tfpobj)->getNCoordsIncomplete(),bankpath8L.c_str());
@@ -471,19 +471,19 @@ StatusCode FTKTrackFitterAlgo::initialize(){
 
 	log << MSG::INFO << "*** Printing EXP and TF constants in a txt file ****" << endmsg;
 
-	ofstream myfile;
+        std::ofstream myfile;
 	myfile.open (Form("EXPConstants_reg%d.txt",ir));
 
-	ofstream myfileTF;
+        std::ofstream myfileTF;
 	myfileTF.open (Form("TFConstants_reg%d.txt",ir));
 
-	std::vector<map <int, int> > vecOfMapSecID;
-	std::vector<map <int, int> > vecOfMapNconn;
+	std::vector<std::map <int, int> > vecOfMapSecID;
+	std::vector<std::map <int, int> > vecOfMapNconn;
 	vecOfMapSecID.clear();
 	vecOfMapNconn.clear();
 
 	log << MSG::INFO << "*** Reading the connection file and mapping 8L -> 12L " << endmsg;
-	vector<vector<int>> moduleIDvec;
+        std::vector<std::vector<int>> moduleIDvec;
 	moduleIDvec.clear();
 
 	Int_t Max_1stStage_sectors = 16383;
@@ -500,7 +500,7 @@ StatusCode FTKTrackFitterAlgo::initialize(){
 	    Map_temp[TwelveLsecid] = (int)sector->getNSimilarSectors(isec) ;
 	    vecOfMapNconn.push_back(Map_temp);
 	    vecOfMapSecID.push_back(Map_secid_Nconn);
-	    vector<int> module_temp;
+            std::vector<int> module_temp;
 	    module_temp.clear();
 	    for (int ip=0; ip!=(m_pmap_complete->getNPlanes()-m_pmap->getNPlanes()); ++ip) {
 	      module_temp.push_back(sector->getSimilarStereoIDs(isec,Nconn)[ip]);
diff --git a/Trigger/TrigFTK/TrigFTKSim/src/FTK_AMBank.cxx b/Trigger/TrigFTK/TrigFTKSim/src/FTK_AMBank.cxx
index 809b3dd055c..4225a064631 100644
--- a/Trigger/TrigFTK/TrigFTKSim/src/FTK_AMBank.cxx
+++ b/Trigger/TrigFTK/TrigFTKSim/src/FTK_AMBank.cxx
@@ -8,7 +8,6 @@
 #include "TrigFTKSim/ftk_dcap.h"
 #include "TrigFTKSim/FTKPattern.h"
 #include "TrigFTKSim/FTKPatternBySector.h"
-using namespace ftk;
 
 #include <TFile.h>
 #include <TTree.h>
@@ -26,6 +25,8 @@ using namespace ftk;
 #include <map>
 
 using namespace std;
+using namespace ftk;
+using __gnu_cxx::hash_map;
 
 //#define USEAMIN2
 //#define PRINT_SS 1
@@ -1217,9 +1218,9 @@ void FTK_AMBank::am_in_minimal() {
   const unsigned int biasinit(ftkset.getMaxMissingPlanes()+FTKSetup::getFTKSetup().getMaxMissingSctPairs()+1);
 
   for (int ipatt=0;ipatt!=m_npatterns;++ipatt) { // loop over the patterns
-    register unsigned int bias(biasinit); // initialize the bias
+    unsigned int bias(biasinit); // initialize the bias
     // retrieve the status word for the current pattern
-    register pattstatus_t word(0);
+    pattstatus_t word(0);
 
     /* loop over the layers of the pattern, stop if too many layers are missing, causing the bias to go to 0 */
     for (int iplane=0;iplane!=m_nplanes&&bias;++iplane) { // lopp over the layers
diff --git a/Trigger/TrigFTK/TrigFTKSim/src/tsp/FTKTSPBank.cxx b/Trigger/TrigFTK/TrigFTKSim/src/tsp/FTKTSPBank.cxx
index 2189e4670b0..c8ec09cc4c7 100644
--- a/Trigger/TrigFTK/TrigFTKSim/src/tsp/FTKTSPBank.cxx
+++ b/Trigger/TrigFTK/TrigFTKSim/src/tsp/FTKTSPBank.cxx
@@ -19,6 +19,7 @@
 using namespace ftk;
 using namespace std;
 using namespace boost;
+using __gnu_cxx::hash_map;
 
 #define PRINT_ROADS_SECTOR -1
 #define PRINT_ROADS_NUM 100
diff --git a/Trigger/TrigFTK/TrigFTKSim/src/tsp/TSPROOTBankGenerator.cxx b/Trigger/TrigFTK/TrigFTKSim/src/tsp/TSPROOTBankGenerator.cxx
index 081040d9c2b..3f07751bd2f 100644
--- a/Trigger/TrigFTK/TrigFTKSim/src/tsp/TSPROOTBankGenerator.cxx
+++ b/Trigger/TrigFTK/TrigFTKSim/src/tsp/TSPROOTBankGenerator.cxx
@@ -103,7 +103,7 @@ void TSPROOTBankGenerator::writeSSMapsToFile() {
 
 
 /** produce the banks and the relations */
-void TSPROOTBankGenerator::generate() throw (TSPPatternReadException){
+void TSPROOTBankGenerator::generate() {
   // read the head of the oroginal pattern bank
    FTKSetup::PrintMessageFmt(ftk::info, "Leaf bank db copy started\nInput bank: %d Patterns, %d Planes, %d MaxPatterns\n", m_npatterns, m_nplanes, m_maxPatterns);
 
@@ -191,7 +191,7 @@ void TSPROOTBankGenerator::generate() throw (TSPPatternReadException){
   m_setup->usageStat();
 }
 
-void TSPROOTBankGenerator::generateChildren(int bankID, int planes) throw (TSPPatternReadException){
+void TSPROOTBankGenerator::generateChildren(int bankID, int planes) {
   // check which HW format should be used (0: global SSID, 1: not supported, 2: local compressed SSID
   int hwmode =  FTKSetup::getFTKSetup().getHWModeSS();
   TTree *TSPbank = dynamic_cast<TTree*>(m_bankfile->Get(Form("Bank%d",bankID-1)));
@@ -500,7 +500,7 @@ void TSPROOTBankGenerator::showstats(int ipatt, int npatterns) const{
 	}
 }
 
-void TSPROOTBankGenerator::readNextPattern(FTKPattern& pattern, int patternID) throw (TSPPatternReadException) {
+void TSPROOTBankGenerator::readNextPattern(FTKPattern& pattern, int patternID) {
 	m_inputBank >> pattern;
 	if (!m_inputBank) throw TSPPatternReadException("Stream error reading pattern");
 	if (pattern.getPatternID() != patternID) throw TSPPatternReadException("Synch error: read pattern id doesn't correspond to the expected id");
diff --git a/Trigger/TrigFTK/TrigFTKSim/standalone/dataflow.cc b/Trigger/TrigFTK/TrigFTKSim/standalone/dataflow.cc
index 11a4319ccab..7f0efae21f1 100644
--- a/Trigger/TrigFTK/TrigFTKSim/standalone/dataflow.cc
+++ b/Trigger/TrigFTK/TrigFTKSim/standalone/dataflow.cc
@@ -8,6 +8,7 @@
 #include <iomanip>
 #include <cmath>
 #include <TFile.h>
+using namespace std;
 
 int SIGDIGITS=2;
 
diff --git a/Trigger/TrigFTK/TrigFTKSim/standalone/dataflow.h b/Trigger/TrigFTK/TrigFTKSim/standalone/dataflow.h
index ef22c9466f4..81229ee7ba6 100644
--- a/Trigger/TrigFTK/TrigFTKSim/standalone/dataflow.h
+++ b/Trigger/TrigFTK/TrigFTKSim/standalone/dataflow.h
@@ -20,10 +20,9 @@
 
 #define TTREE_NAME "ftkdata"
 
-using namespace std;
 
-ofstream myfile;
-ofstream myfileTeX;
+std::ofstream myfile;
+std::ofstream myfileTeX;
 
 // [tower]
 float nRoad[MAXTOWER], nFit[MAXTOWER], nFitI[MAXTOWER], nTrack[MAXTOWER], nTrackI[MAXTOWER], nTrackBeforeHW[MAXTOWER], nFitRecovery[MAXTOWER], nFitRecoveryI[MAXTOWER];
@@ -33,7 +32,7 @@ float nConn[MAXTOWER], nExtrapAUX[MAXTOWER];
 FTKRoadStream *stream[MAXTOWER];
 FTKTrackStream *trackstream[MAXTOWER];
 
-vector<float> nRoad_tow_evt[MAXTOWER], nFitI_tow_evt[MAXTOWER];
+std::vector<float> nRoad_tow_evt[MAXTOWER], nFitI_tow_evt[MAXTOWER];
 
 
 // events to run over
diff --git a/Trigger/TrigFTK/TrigFTKSim/standalone/efficiency.cc b/Trigger/TrigFTK/TrigFTKSim/standalone/efficiency.cc
index 8b3a31d3473..3784c6359e2 100644
--- a/Trigger/TrigFTK/TrigFTKSim/standalone/efficiency.cc
+++ b/Trigger/TrigFTK/TrigFTKSim/standalone/efficiency.cc
@@ -14,6 +14,7 @@
 #include "boost/filesystem.hpp"
 
 #include <vector>
+using namespace std;
 
 void printpsfile(std::string, TFile* f);
 
diff --git a/Trigger/TrigFTK/TrigFTKSim/standalone/efficiency.h b/Trigger/TrigFTK/TrigFTKSim/standalone/efficiency.h
index 8e5bea844dc..dd3fba31501 100644
--- a/Trigger/TrigFTK/TrigFTKSim/standalone/efficiency.h
+++ b/Trigger/TrigFTK/TrigFTKSim/standalone/efficiency.h
@@ -14,7 +14,6 @@
 #include "TFile.h"
 #include "TProfile.h"
 
-using namespace std;
 
 class MatchInfo {
 private:
@@ -28,7 +27,7 @@ public:
   bool operator<(const MatchInfo& o) const { if (m_evtindex!=o.m_evtindex) return (m_evtindex<o.m_evtindex); else return m_barcode<o.m_barcode; }
 };
 
-typedef multimap<MatchInfo,const FTKTrack*> FTKBarcodeMM;
+typedef std::multimap<MatchInfo,const FTKTrack*> FTKBarcodeMM;
 unsigned nbins;
 double maxntracks;
 double d0min, d0max;
diff --git a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/MultiLayerPerceptron.cxx b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/MultiLayerPerceptron.cxx
index 3233492beec..0f508b4eec3 100755
--- a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/MultiLayerPerceptron.cxx
+++ b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/MultiLayerPerceptron.cxx
@@ -54,21 +54,21 @@ MultiLayerPerceptron::MultiLayerPerceptron(std::vector<unsigned int> &n,
   //First weight dimension
   try{
     m_weights = new REAL **[n.size()-1]; //number of layers excluding input
-  }catch (std::bad_alloc xa){
+  }catch (const std::bad_alloc& xa){
     m_weights = nullptr;
     throw;
   }
   //First bias dimension
   try{    
     m_bias = new REAL *[n.size()-1]; //number of layers excluding input
-  }catch (std::bad_alloc xa){
+  }catch (const std::bad_alloc& xa){
     m_bias = nullptr;
     throw;    
   }
   //First multiplication dimension
   try{
     m_layerOutputs = new REAL *[n.size()]; //number of layers including input
-  } catch (std::bad_alloc xa){
+  } catch (const std::bad_alloc& xa){
     m_layerOutputs = nullptr;    
     throw;
   }
@@ -79,7 +79,7 @@ MultiLayerPerceptron::MultiLayerPerceptron(std::vector<unsigned int> &n,
       try{
         //Second and last dimension of layerOutputs
         m_layerOutputs[l] = new REAL[n[l]]; //number of nodes in current layer
-      } catch (std::bad_alloc xa){
+      } catch (const std::bad_alloc& xa){
         m_layerOutputs[l] = nullptr;
         throw;
       }
@@ -93,7 +93,7 @@ MultiLayerPerceptron::MultiLayerPerceptron(std::vector<unsigned int> &n,
       try{
         //Second and last dimension of bias
         m_bias[l] = new REAL[n[l+1]]; //number of nodes in next layer
-      } catch (std::bad_alloc xa){
+      } catch (const std::bad_alloc& xa){
         m_bias[l] = nullptr;
         throw;
       }
@@ -103,7 +103,7 @@ MultiLayerPerceptron::MultiLayerPerceptron(std::vector<unsigned int> &n,
       try{
         //Second dimension of weights
         m_weights[l] = new REAL*[n[l+1]]; //number of nodes in next layer
-      } catch (std::bad_alloc xa){
+      } catch (const std::bad_alloc& xa){
         m_weights[l] = nullptr;
         throw;
       }
@@ -115,7 +115,7 @@ MultiLayerPerceptron::MultiLayerPerceptron(std::vector<unsigned int> &n,
           try{
             //Third and last dimension of weights
             m_weights[l][i]=new REAL [n[l]]; //number of nodes in current layer
-          } catch (std::bad_alloc xa){
+          } catch (const std::bad_alloc& xa){
             m_weights[l][i] = nullptr;
             throw;
           }
diff --git a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerFex.cxx b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerFex.cxx
index d1ec02a3bbd..ad8e54dac78 100755
--- a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerFex.cxx
+++ b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerFex.cxx
@@ -107,7 +107,7 @@ HLT::ErrorCode TrigL2CaloRingerFex::hltInitialize()
                                        m_etBins[i][0], m_etBins[i][1], m_etaBins[i][0],
                                        m_etaBins[i][1]);
     }
-    catch(std::bad_alloc xa){
+    catch(const std::bad_alloc& xa){
       msg() << MSG::ERROR << "Weight vector size is not compatible with nodes vector." << endmsg;
       return HLT::BAD_JOB_SETUP;
     }
@@ -138,7 +138,7 @@ HLT::ErrorCode TrigL2CaloRingerFex::hltInitialize()
 
       preproc = new TrigRingerPreprocessor(nrings,normrings,sectionrings);
     }
-    catch(std::bad_alloc xa){
+    catch(const std::bad_alloc& xa){
       msg() << MSG::ERROR << "Bad alloc for TrigRingerPrepoc." << endmsg;
       return HLT::BAD_JOB_SETUP;
     }
diff --git a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerHypo.cxx b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerHypo.cxx
index 124f5cbf634..132a6248a05 100755
--- a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerHypo.cxx
@@ -49,7 +49,7 @@ HLT::ErrorCode TrigL2CaloRingerHypo::hltInitialize()
     try{
       m_cutDefs.push_back(new TrigL2CaloRingerHypo::CutDefsHelper(m_thresholds[i],m_etaBins[i][0],/*
                                               */m_etaBins[i][1], m_etBins[i][0],m_etBins[i][1]));
-    }catch(std::bad_alloc xa){
+    }catch(const std::bad_alloc& xa){
       msg() << MSG::ERROR << "Can not alloc cutDefs on memory." << endmsg;
       return HLT::BAD_JOB_SETUP;
     }
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/MufastOTRHypo.h b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/MufastOTRHypo.h
index b577e73e786..0808a72d7c1 100755
--- a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/MufastOTRHypo.h
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/MufastOTRHypo.h
@@ -24,7 +24,7 @@ class MufastOTRHypo: public HLT::HypoAlgo {
     
   private:
   
-    std::pair<unsigned int, int> getRoIFeature(uint32_t) const;
+    std::pair<unsigned int, int> getRoIFeature(uint32_t);
   
     ToolHandle<ITrigMuonRoITool> m_trigMuonRoITool;
     
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMufastHypoAlg.h b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMufastHypoAlg.h
index bbf9f767c2e..75a0111db30 100755
--- a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMufastHypoAlg.h
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMufastHypoAlg.h
@@ -6,7 +6,6 @@
 #define TRIGMUFASTHYPO_TRIGMUFASTHYPOALG_H 1 
 
 #include <string>
-#include "TrigInterfaces/HypoAlgo.h"
 
 #include "AthenaBaseComps/AthReentrantAlgorithm.h" 
 #include "AthViews/View.h"
@@ -39,14 +38,22 @@ class TrigMufastHypoAlg
   private:
  
     TrigMufastHypoAlg(); 
-    ToolHandleArray<TrigMufastHypoTool> m_hypoTools;
+    ToolHandleArray<TrigMufastHypoTool> m_hypoTools {this, "HypoTools", {}, "Tools to perform selection"}; 
 
-    SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_decisionsKey;
+    SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_decisionsKey{
+	this, "Decisions", "MufastHypo_Decisions", "Name of the decisions object attached by TrigMufastHypo"};
 
-    SG::ReadHandleKey<std::vector< SG::View*>> m_viewsKey;
-    SG::ReadHandleKey<xAOD::L2StandAloneMuonContainer> m_muFastKey;
-    SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiKey;
-    SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_previousDecisionsKey;
+    SG::ReadHandleKey<std::vector< SG::View*>> m_viewsKey{
+	this, "ViewRoIs", "MUViewRoIs", "Name of the input data on Views produced by EventCreatorAlgorithms"};
+
+    SG::ReadHandleKey<xAOD::L2StandAloneMuonContainer> m_muFastKey{
+	this, "MuFastDecisions", "MuFastAlg_MuonData", "Name of the input data on xAOD::L2StandAloneMuonContainer produced by MuFastSteering"};
+
+    SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiKey{
+	this, "RoIs", "MURoIs", "Name of the input data from L1Decoder"};
+
+    SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_previousDecisionsKey{
+	this, "L1Decisions", "MuFastAlg_Decisions", "Name of the input decisions object produced by MuFastSteering"};
 };
 
 DECLARE_ALGORITHM_FACTORY( TrigMufastHypoAlg )
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMufastHypoTool.h b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMufastHypoTool.h
index 974df580189..1aa64ca4cc9 100755
--- a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMufastHypoTool.h
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMufastHypoTool.h
@@ -6,9 +6,9 @@
 #define TRIGMUFASTHYPO_TRIGMUFASTHYPOTOOL_H 1
 
 #include <string>
-#include "CLHEP/Units/SystemOfUnits.h"
 #include "AthenaBaseComps/AthAlgTool.h" 
 #include "DecisionHandling/HLTIdentifier.h"
+#include "CLHEP/Units/SystemOfUnits.h"
 
 #include "xAODTrigMuon/L2StandAloneMuonContainer.h"
 #include "TrigSteeringEvent/TrigRoiDescriptor.h" 
@@ -71,8 +71,8 @@ class TrigMufastHypoTool: public ::AthAlgTool {
     std::vector<float> m_ptThresholds;
     BooleanProperty m_acceptAll;
     BooleanProperty m_selectPV;
-    float m_Z_PV;
-    float m_R_PV;
+    float m_ZPV;
+    float m_RPV;
     
     float m_ptThresholdForECWeakBRegionA;
     float m_ptThresholdForECWeakBRegionB;
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigmuCombHypoAlg.h b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigmuCombHypoAlg.h
new file mode 100644
index 00000000000..4618a01b6b4
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigmuCombHypoAlg.h
@@ -0,0 +1,52 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGMUCOMBHYPO_TRIGMUCOMBHYPOALG_H 
+#define TRIGMUCOMBHYPO_TRIGMUCOMBHYPOALG_H 1 
+
+#include <string>
+
+#include "AthenaBaseComps/AthReentrantAlgorithm.h" 
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+#include "xAODTrigMuon/L2CombinedMuonContainer.h"
+#include "DecisionHandling/TrigCompositeUtils.h"
+#include "AthViews/View.h"
+
+#include "TrigMuonHypo/TrigmuCombHypoTool.h"
+
+class StoreGateSvc;
+class TriggerElement;
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+class TrigmuCombHypoAlg
+   : public ::AthReentrantAlgorithm
+{
+  public:
+
+   TrigmuCombHypoAlg( const std::string& name, ISvcLocator* pSvcLocator );   
+
+   virtual ~TrigmuCombHypoAlg();
+
+   virtual StatusCode  initialize() override;
+   virtual StatusCode  execute_r( const EventContext& context ) const override;
+   virtual StatusCode  finalize() override;
+    
+  private:
+ 
+    TrigmuCombHypoAlg(); 
+    ToolHandleArray<TrigmuCombHypoTool> m_hypoTools {this, "HypoTools", {}, "Tools to perform selection"}; 
+
+    SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_decisionsKey;
+
+    SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_muonDecisionsKey;
+    SG::ReadHandleKey<std::vector< SG::View*>> m_viewsKey;
+    SG::ReadHandleKey<xAOD::L2CombinedMuonContainer> m_combinedKey;
+};
+
+DECLARE_ALGORITHM_FACTORY( TrigmuCombHypoAlg )
+#endif
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigmuCombHypoTool.h b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigmuCombHypoTool.h
new file mode 100644
index 00000000000..ddfadbbe1f6
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigmuCombHypoTool.h
@@ -0,0 +1,82 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGMUCOMBHYPO_TRIGMUCOMBHYPOTOOL_H 
+#define TRIGMUCOMBHYPO_TRIGMUCOMBHYPOTOOL_H 1
+
+#include <string>
+#include "AthenaBaseComps/AthAlgTool.h" 
+#include "DecisionHandling/HLTIdentifier.h"
+#include "CLHEP/Units/SystemOfUnits.h"
+
+#include "xAODTrigMuon/L2CombinedMuonContainer.h"
+#include "xAODTrigMuon/versions/L2CombinedMuonContainer_v1.h"
+#include "xAODTrigMuon/L2CombinedMuon.h" 
+
+#include "DecisionHandling/TrigCompositeUtils.h" 
+
+#include "AthenaMonitoring/GenericMonitoringTool.h"
+
+class StoreGateSvc;
+class TriggerElement;
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+namespace TrigmuCombHypoToolConsts {
+}
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+class TrigmuCombHypoTool: public ::AthAlgTool {	
+  enum { MaxNumberTools = 20 }; 
+  public:
+
+    TrigmuCombHypoTool(const std::string& type, 
+		       const std::string & name,
+		       const IInterface* parent );
+
+    struct CombinedMuonInfo {
+      TrigCompositeUtils::Decision* decision; 
+      const xAOD::L2CombinedMuon* cluster;
+      const xAOD::L2StandAloneMuon* muon;
+      const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs;
+    };
+
+    virtual ~TrigmuCombHypoTool();
+
+    virtual StatusCode initialize() override;    
+    
+    virtual StatusCode decide(TrigmuCombHypoTool::CombinedMuonInfo& input) const;
+
+    virtual StatusCode decide(std::vector<TrigmuCombHypoTool::CombinedMuonInfo>& hypoToolInput) const;
+    
+  private:
+
+    HLT::Identifier m_decisionId;
+    
+    ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" };   
+
+    // Properties:
+    std::vector<float> m_ptBins;
+    std::vector<float> m_ptThresholds;
+   
+    BooleanProperty m_acceptAll;
+   
+    // pi/K rejections flags
+    BooleanProperty m_pikCuts;
+    DoubleProperty  m_maxPtToApplyPik;
+    DoubleProperty  m_chi2MaxID;
+   
+    // Apply strategy dependent pT cuts (B/T/S = 0 fields, L1 seeded, ...)
+    BooleanProperty     m_strategydependent;
+    DoubleArrayProperty m_strategyDependentPtCuts;
+   
+    // Other members:   
+    std::vector<float>::size_type m_bins;
+};
+
+DECLARE_TOOL_FACTORY( TrigmuCombHypoTool )
+#endif
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/python/TrigMuonHypoConfig.py b/Trigger/TrigHypothesis/TrigMuonHypo/python/TrigMuonHypoConfig.py
index efe0ea6d5f7..4755238e967 100755
--- a/Trigger/TrigHypothesis/TrigMuonHypo/python/TrigMuonHypoConfig.py
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/python/TrigMuonHypoConfig.py
@@ -451,21 +451,23 @@ class TrigMufastHypoConfig(TrigMufastHypoAlg) :
 
     __slots__ = []
 
-    def TrigMufastHypoToolFromName( self, name, nath ):	# nath: name threshold, for example HLT_mu6 etc
+    # nath: name threshold, for example HLT_mu6 etc
+    def TrigMufastHypoToolFromName( self, name, nath ):	
 
         from AthenaCommon.Constants import DEBUG
         tool = TrigMufastHypoTool( nath )  
         tool.OutputLevel = DEBUG
         bname = nath.split('_') 
 
+        # this needs to be correct denied, as this is defined for test run
         if len(bname) == 2: 
             th = re.findall(r'[0-9]+', bname[1])           
             threshold = str(th[0]) + 'GeV'
-            TrigMufastHypoConfig().ConfigrationHypoTool( nath, threshold )
+            TrigMufastHypoConfig().ConfigrationHypoTool( name, nath, threshold )
         #if len(bname) == 3:
         #    th = re.findall(r'[0-9]+', bname[1])           
         #    threshold = str(th[0]) + 'GeV_' + str(bname[2])
-        #    TrigMufastHypoConfig().ConfigrationHypoTool( nath, threshold )
+        #    TrigMufastHypoConfig().ConfigrationHypoTool( name, nath, threshold )
         else:
             print """ Configration ERROR: Can't configure threshold at TrigMufastHypoTool """
             return tool
@@ -479,11 +481,9 @@ class TrigMufastHypoConfig(TrigMufastHypoAlg) :
             tool.MonTool = ""
             print name, ' Monitoring Tool failed'
     
-        from AthenaCommon.AppMgr import ToolSvc
-        ToolSvc += tool
         return tool
     
-    def ConfigrationHypoTool( self, nath, threshold ): 
+    def ConfigrationHypoTool( self, name, nath, threshold ): 
         
         tool = TrigMufastHypoTool( nath )  
     
@@ -678,6 +678,57 @@ class MucombHypoConfig(MucombHypo) :
                 print handle.name," eta bins doesn't match the Pt thresholds!"
 
 
+class TrigmuCombHypoConfig(TrigmuCombHypoAlg):
+
+    __slots__ = []
+
+    # nath: name threshold, for example HLT_mu6 etc
+    def TrigmuCombHypoToolFromName( self, name, nath ):
+
+        from AthenaCommon.Constants import DEBUG
+        tool = TrigmuCombHypoTool( nath )  
+        tool.OutputLevel = DEBUG
+        bname = nath.split('_')
+
+        # this needs to be correct denied, as this is defined for test run
+        if len(bname) == 2: 
+            th = re.findall(r'[0-9]+', bname[1])           
+            threshold = str(th[0]) + 'GeV'
+            tight = False
+            TrigmuCombHypoConfig().ConfigrationHypoTool( name, nath, threshold, tight )        
+        else: 
+            print """ Configration ERROR: Can't configure threshold at TrigmuCombHypoTool """
+            return tool
+
+        print """ Configration SUCCESS: Configure threshold """, threshold, """ at TrigmuCombHypoTool """
+        return tool
+ 
+    def ConfigrationHypoTool( self, name, nath, threshold, tight ):
+
+        tool = TrigmuCombHypoTool( nath )
+        print 'MucombHypoConfig configured for threshold: ',threshold
+
+        try:
+            values = muCombThresholds[threshold]
+            tool.PtBins = values[0]
+            tool.PtThresholds = [ x * GeV for x in values[1] ]
+        except LookupError:
+            if (threshold=='passthrough'):
+                tool.AcceptAll = True
+                tool.PtBins = [-10000.,10000.]
+                tool.PtThresholds = [ -1. * GeV ]
+                tool.ApplyStrategyDependentCuts = True
+                tool.ApplyPikCuts = False
+            else:
+                raise Exception('MuComb Hypo Misconfigured: threshold %r not supported' % threshold)
+
+        if (tight == True): 
+            tool.ApplyPikCuts        = True
+            tool.MaxPtToApplyPik      = 25.
+            tool.MaxChi2IDPik         = 3.5
+
+        return threshold
+
 class MucombStauHypoConfig(MucombStauHypo) :
 
     __slots__ = []
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/MufastOTRHypo.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/MufastOTRHypo.cxx
index ac2d22ae923..bcc0291ffeb 100755
--- a/Trigger/TrigHypothesis/TrigMuonHypo/src/MufastOTRHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/MufastOTRHypo.cxx
@@ -95,7 +95,7 @@ HLT::ErrorCode MufastOTRHypo::hltFinalize(){
 
 
 std::pair<unsigned int, int> 
-MufastOTRHypo::getRoIFeature(uint32_t roiWord) const {
+MufastOTRHypo::getRoIFeature(uint32_t roiWord) {
  
     int BCID_diff = 0;
     unsigned int sysID = 0;
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoAlg.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoAlg.cxx
index 487e13ab7f8..d6b66bcba51 100755
--- a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoAlg.cxx
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoAlg.cxx
@@ -10,9 +10,6 @@
 #include "xAODTrigMuon/L2StandAloneMuonContainer.h"
 #include "TrigMuonHypo/TrigMufastHypoAlg.h"
 
-#include "CLHEP/Units/SystemOfUnits.h"
-#include "CLHEP/Units/PhysicalConstants.h"
-
 using namespace TrigCompositeUtils; 
 
 // --------------------------------------------------------------------------------
@@ -22,12 +19,7 @@ TrigMufastHypoAlg::TrigMufastHypoAlg( const std::string& name,
 				      ISvcLocator* pSvcLocator ) :
   ::AthReentrantAlgorithm( name, pSvcLocator )
 {
-   declareProperty("ViewRoIs", m_viewsKey = std::string("ViewRoIs"), "MUViewRoIs to read in");
-   declareProperty("MuFastDecisions", m_muFastKey = std::string("MufastDecisions"), "xAOD::L2StandAloneMuonContainer to read in");
-   declareProperty("RoIs", m_roiKey = std::string("RoIs"), "TrigRoiDescriptor RoIs to read in");
-   declareProperty("Decisions", m_decisionsKey = std::string("TrigMufastHypoAlgDesicions"), "Decisions");
-   declareProperty("L1Decisions", m_previousDecisionsKey = std::string("L1Decisions"), "Key for L1 decisions per RoI");
-   declareProperty("HypoTools", m_hypoTools, "Hypo Tools");
+
 } 
 
 TrigMufastHypoAlg::~TrigMufastHypoAlg() 
@@ -134,7 +126,7 @@ StatusCode TrigMufastHypoAlg::execute_r( const EventContext& context ) const
         ATH_MSG_ERROR("ReadHandle for TrigRoiDescriptorCollection key:" << m_roiKey.key() << " isn't Valid");
         return StatusCode::FAILURE;
       } else {
-        d->setObjectLink( "feature", element );
+        d->setObjectLink( "roi", element );
         ATH_MSG_DEBUG("REGTEST: " << m_roiKey.key() << " eta/phi = " << (*element)->eta() << "/" << (*element)->phi());
       }
     }
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoTool.cxx
index 6ae6096657e..191ab3fb1f4 100755
--- a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoTool.cxx
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoTool.cxx
@@ -13,9 +13,6 @@
 #include "DecisionHandling/TrigCompositeUtils.h"
 #include "TrigMuonHypo/TrigMufastHypoTool.h"
 
-#include "CLHEP/Units/SystemOfUnits.h"
-#include "CLHEP/Units/PhysicalConstants.h"
-
 using namespace TrigCompositeUtils;
 // --------------------------------------------------------------------------------
 // --------------------------------------------------------------------------------
@@ -26,18 +23,18 @@ TrigMufastHypoTool::TrigMufastHypoTool(const std::string& type,
    : AthAlgTool( type, name, parent ),
      m_decisionId( HLT::Identifier::fromToolName( name ) ) 
 {
-   std::vector<float> def_bins;
-   def_bins.push_back(0);
-   def_bins.push_back(2.5); 
-   std::vector<float> def_thrs;
-   def_thrs.push_back(5.49*CLHEP::GeV);
-
-   declareProperty("PtBins",       m_ptBins=def_bins);
-   declareProperty("PtThresholds", m_ptThresholds=def_thrs);
+   std::vector<float> defBins;
+   defBins.push_back(0);
+   defBins.push_back(2.5); 
+   std::vector<float> defThrs;
+   defThrs.push_back(5.49*CLHEP::GeV);
+
+   declareProperty("PtBins",       m_ptBins=defBins);
+   declareProperty("PtThresholds", m_ptThresholds=defThrs);
    declareProperty("AcceptAll",    m_acceptAll=false);
    declareProperty("SelectPV",     m_selectPV=false);
-   declareProperty("Z_PV_Bins",    m_Z_PV=400.);
-   declareProperty("R_PV_Bins",    m_R_PV=200.);
+   declareProperty("ZPVBins",    m_ZPV=400.);
+   declareProperty("RPVBins",    m_RPV=200.);
 
    declareProperty("PtThresholdForECWeakBRegionA", m_ptThresholdForECWeakBRegionA=3.);
    declareProperty("PtThresholdForECWeakBRegionB", m_ptThresholdForECWeakBRegionB=3.);
@@ -98,25 +95,25 @@ StatusCode TrigMufastHypoTool::decide(TrigMufastHypoTool::MuonClusterInfo& input
 {
    using namespace Monitored;
 
-   auto fex_pt 		= MonitoredScalar::declare("Pt", -9999.);
-   auto fex_eta 	= MonitoredScalar::declare("Eta", -9999.);
-   auto fex_phi 	= MonitoredScalar::declare("Phi", -9999.);
-   auto x_at_station	= MonitoredScalar::declare("XatSt", -9999.);
-   auto y_at_station	= MonitoredScalar::declare("YatSt", -9999.);
-   auto z_at_station	= MonitoredScalar::declare("ZatSt", -9999.);
-   auto x_at_beam	= MonitoredScalar::declare("XatBe", -9999.);
-   auto z_at_beam	= MonitoredScalar::declare("ZatBe", -9999.);
+   auto fexPt 		= MonitoredScalar::declare("Pt", -9999.);
+   auto fexEta 		= MonitoredScalar::declare("Eta", -9999.);
+   auto fexPhi 		= MonitoredScalar::declare("Phi", -9999.);
+   auto xatStation	= MonitoredScalar::declare("XatSt", -9999.);
+   auto yatStation	= MonitoredScalar::declare("YatSt", -9999.);
+   auto zatStation	= MonitoredScalar::declare("ZatSt", -9999.);
+   auto xatBeam		= MonitoredScalar::declare("XatBe", -9999.);
+   auto zatBeam		= MonitoredScalar::declare("ZatBe", -9999.);
 
-   auto monitorIt	= MonitoredScope::declare(m_monTool, fex_pt, fex_eta, fex_phi, 
-   					          x_at_station, y_at_station, z_at_station, 
-					          x_at_beam, z_at_beam);
+   auto monitorIt	= MonitoredScope::declare(m_monTool, fexPt, fexEta, fexPhi, 
+   					          xatStation, yatStation, zatStation, 
+					          xatBeam, zatBeam);
 
    bool result = false;
    // if accept All flag is on, just pass it
    if(m_acceptAll) {
       result = true;
       ATH_MSG_DEBUG("Accept property is set: taking all the events");
-      return StatusCode::SUCCESS;
+      return StatusCode(result);
    } else {
       result = false;
       ATH_MSG_DEBUG("Accept property not set: applying selection!");
@@ -131,39 +128,39 @@ StatusCode TrigMufastHypoTool::decide(TrigMufastHypoTool::MuonClusterInfo& input
    }
 
    // fill Monitoring histos
-   fex_pt  = (pMuon->pt())?  pMuon->pt()  : -9999.;
-   fex_eta = (pMuon->etaMS())? pMuon->etaMS() : -9999.;
-   fex_phi = (pMuon->etaMS())? pMuon->phiMS() : -9999.;
+   fexPt  = (pMuon->pt())?  pMuon->pt()  : -9999.;
+   fexEta = (pMuon->etaMS())? pMuon->etaMS() : -9999.;
+   fexPhi = (pMuon->etaMS())? pMuon->phiMS() : -9999.;
 
    if( pMuon->etaMS() ) {
       float localPhi = getLocalPhi(pMuon->etaMS(),pMuon->phiMS(),pMuon->rMS());
       float radius = pMuon->rMS()/cos(fabs(localPhi));
       float DirZ = (pMuon->dirZMS())? pMuon->dirZMS() : .000001;
       float DirF = (pMuon->dirPhiMS())?  pMuon->dirPhiMS()  : .000001;
-      x_at_station = radius * cos(pMuon->phiMS());
-      y_at_station = radius * sin(pMuon->phiMS());
-      z_at_station = pMuon->zMS();
-      float xb = x_at_station - y_at_station/DirF;
-      float de = x_at_station - xb;
-      float ds = sqrt(y_at_station*y_at_station+de*de);
-      x_at_beam = xb;
-      z_at_beam = z_at_station - ds*DirZ;
+      xatStation = radius * cos(pMuon->phiMS());
+      yatStation = radius * sin(pMuon->phiMS());
+      zatStation = pMuon->zMS();
+      float xb = xatStation - yatStation/DirF;
+      float de = xatStation - xb;
+      float ds = sqrt(yatStation*yatStation+de*de);
+      xatBeam = xb;
+      zatBeam = zatStation - ds*DirZ;
    } else {
-      x_at_station = -9999.;
-      y_at_station = -9999.;
-      z_at_station = -9999.;
-      x_at_beam = -9999.;
-      z_at_beam = -9999.;
+      xatStation = -9999.;
+      yatStation = -9999.;
+      zatStation = -9999.;
+      xatBeam = -9999.;
+      zatBeam = -9999.;
    }
 
    //Get the Pt cut for that eta bin
    float threshold = 0;
-   float absEta = fabs(fex_eta);
+   float absEta = fabs(fexEta);
    for (std::vector<float>::size_type i=0; i<m_bins; ++i)
       if ( absEta > m_ptBins[i] && absEta < m_ptBins[i+1] ) threshold = m_ptThresholds[i]; 
 
    // if in the weak Bfield regions at endcap, set special threshold
-   TrigMufastHypoToolConsts::ECRegions ecRegion = whichECRegion( fex_eta, fex_phi );
+   TrigMufastHypoToolConsts::ECRegions ecRegion = whichECRegion( fexEta, fexPhi );
    if( ecRegion == TrigMufastHypoToolConsts::WeakBFieldA ) {
       ATH_MSG_DEBUG("threshold is set for EC WeakBField A");
       threshold = m_ptThresholdForECWeakBRegionA;
@@ -180,7 +177,7 @@ StatusCode TrigMufastHypoTool::decide(TrigMufastHypoTool::MuonClusterInfo& input
    if ( std::abs(pMuon->pt()) > (threshold/CLHEP::GeV)){
       // selects only tracks coming from a region around PV
       if( m_selectPV ){
-	 if((fabs(x_at_beam)<m_R_PV) && (fabs(z_at_beam)<m_Z_PV))
+	 if((fabs(xatBeam)<m_RPV) && (fabs(zatBeam)<m_ZPV))
 	    result = true;
       } else {
 	 result = true;
@@ -233,13 +230,13 @@ float TrigMufastHypoTool::getLocalPhi(float eta, float phi, float rad) const
    {
       float Dphi = 999999.;
       float sign = 0.;
-      const float ZERO_LIMIT = 1e-6;
+      const float ZEROLIMIT = 1e-6;
       if(rad < 800.)
       {
          for(int i=0;i<8;++i) if(fabs(i*step-phi)<=Dphi)
 	 { 
 	    Dphi=fabs(i*step-phi);
-	    sign = (fabs(Dphi) > ZERO_LIMIT) ? (i*step-phi)/fabs(i*step-phi) : 0;
+	    sign = (fabs(Dphi) > ZEROLIMIT) ? (i*step-phi)/fabs(i*step-phi) : 0;
 	 }
 	 return sign*Dphi;
       }else
@@ -247,7 +244,7 @@ float TrigMufastHypoTool::getLocalPhi(float eta, float phi, float rad) const
          for(int i=1;i<8;++i) if(fabs(i*step+offs-phi)<=Dphi)
 	 { 
 	    Dphi=fabs(i*step+offs-phi);
-	    sign = (fabs(Dphi) > ZERO_LIMIT) ? (i*step+offs-phi)/fabs(i*step+offs-phi) : 0;
+	    sign = (fabs(Dphi) > ZEROLIMIT) ? (i*step+offs-phi)/fabs(i*step+offs-phi) : 0;
 	 }     
 	 return sign*Dphi;
       }
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigmuCombHypoAlg.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigmuCombHypoAlg.cxx
new file mode 100644
index 00000000000..c407d2eac22
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigmuCombHypoAlg.cxx
@@ -0,0 +1,163 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include <math.h>
+
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/StatusCode.h"
+
+#include "DecisionHandling/TrigCompositeUtils.h"
+#include "xAODTrigMuon/L2StandAloneMuonContainer.h" 
+
+#include "TrigMuonHypo/TrigmuCombHypoAlg.h"
+
+using namespace TrigCompositeUtils; 
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+TrigmuCombHypoAlg::TrigmuCombHypoAlg( const std::string& name,
+				      ISvcLocator* pSvcLocator ) :
+  ::AthReentrantAlgorithm( name, pSvcLocator )
+{
+   declareProperty("Decisions", m_decisionsKey = std::string("Decisions"), "Decision on muCombHypo to write in");
+   declareProperty("MuonSADecisions", m_muonDecisionsKey = std::string("MuonSADecisions"), "Decisions from MufastHypo to read in");
+   declareProperty("ViewRoIs", m_viewsKey = std::string("ViewRoIs"), "MUViewRoIs to read in");
+   declareProperty("MuCombContainer", m_combinedKey = std::string("MuCombContainer"), "xAOD::L2CombinedMuonContainer to read in");
+} 
+
+TrigmuCombHypoAlg::~TrigmuCombHypoAlg() 
+{}
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+StatusCode TrigmuCombHypoAlg::initialize()
+{
+  ATH_MSG_INFO ( "Initializing " << name() << "..." );
+  ATH_CHECK(m_hypoTools.retrieve());
+
+  ATH_CHECK(m_decisionsKey.initialize());
+
+  ATH_CHECK(m_muonDecisionsKey.initialize());
+
+  ATH_CHECK(m_viewsKey.initialize());
+
+  renounce(m_combinedKey);
+  ATH_CHECK(m_combinedKey.initialize());
+
+  ATH_MSG_INFO( "Initialization completed successfully" );
+  return StatusCode::SUCCESS;
+}
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+StatusCode TrigmuCombHypoAlg::finalize() 
+{   
+  ATH_MSG_INFO( "Finalizing " << name() << "..." );
+  ATH_MSG_INFO( "Finalization completed successfully" );
+  return StatusCode::SUCCESS;
+}
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+StatusCode TrigmuCombHypoAlg::execute_r(const EventContext& context) const
+{
+
+  ATH_MSG_DEBUG("StatusCode TrigmuCombHypoAlg::execute_r start");
+
+  // prepare decisions container
+  auto decisions = std::make_unique<DecisionContainer>();
+  auto aux = std::make_unique<DecisionAuxContainer>();
+  decisions->setStore(aux.get());
+
+  // extract mapping of cluster pointer to an index in the cluster decision collection
+  auto clusterDecisionsHandle= SG::makeHandle( m_muonDecisionsKey, context );
+  std::map<const xAOD::L2StandAloneMuon*, size_t> clusterToIndexMap;
+
+  size_t clusterCounter = 0;
+  for (auto cluIter = clusterDecisionsHandle->begin(); cluIter != clusterDecisionsHandle->end(); ++cluIter) {
+    ATH_CHECK((*cluIter)->hasObjectLink("feature"));
+    const xAOD::L2StandAloneMuon* cluster = (*cluIter)->object<xAOD::L2StandAloneMuon>("feature");
+    clusterToIndexMap.insert(std::make_pair(cluster, clusterCounter));
+ 
+    ++clusterCounter;
+  }
+  ATH_MSG_DEBUG( "Cluster ptr to decision map has size " << clusterToIndexMap.size() );
+
+  // prepare imput for tools  
+  std::vector<TrigmuCombHypoTool::CombinedMuonInfo> hypoToolInput;
+
+  // retrieve views created on l2muCombViewsCreator
+  auto viewsHandle = SG::makeHandle(m_viewsKey, context);
+  if (!viewsHandle.isValid()) {
+    ATH_MSG_ERROR("ReadHandle for std::vector< SG::View*> key:" << m_viewsKey.key() << " is failed");
+    return StatusCode::FAILURE;
+  }
+
+  for (auto view: *viewsHandle) {
+    size_t muonCounter = 0;
+
+    // retrieve xAOD::CombinedMuonContaier created on muComb algorithm
+    auto muonHandle = SG::makeHandle(m_combinedKey, context);
+    ATH_CHECK(muonHandle.setProxyDict(view));
+    if(!muonHandle.isValid()) {
+      ATH_MSG_ERROR("ReadHandle for xAOD::L2CombinedMuonContainer key:" << m_combinedKey.key() << " is failed");
+      return StatusCode::FAILURE;
+    }
+
+    xAOD::L2CombinedMuonContainer::const_iterator muIter;
+    for (muIter = muonHandle->begin(); muIter != muonHandle->end(); ++muIter) {
+      auto d = newDecisionIn(decisions.get());
+      auto element = ElementLink<xAOD::L2CombinedMuonContainer>(view->name()+"_"+m_combinedKey.key(), muonCounter);
+      d->setObjectLink("feature", element);
+
+      // get muSATracks from xAOD::CombinedMuonContainer
+      auto clusterPtr = (*muIter)->muSATrack();
+      ATH_CHECK(clusterPtr != nullptr);
+
+      ATH_MSG_DEBUG("REGTEST: muSATrack pt in " << m_combinedKey.key() << " = " << clusterPtr->pt() << " GeV");
+      ATH_MSG_DEBUG("REGTEST: muSATrack eta/phi in " << m_combinedKey.key() << " = " << clusterPtr->eta() << "/" << clusterPtr->phi());
+      
+      ATH_MSG_DEBUG("REGTEST: muCBTrack pt in " << m_combinedKey.key() << " = " << (*muIter)->pt() << " GeV");
+      ATH_MSG_DEBUG("REGTEST: muCBTrack eta/phi in " << m_combinedKey.key() << " = " << (*muIter)->eta() << "/" << (*muIter)->phi());
+      
+      // now find matching cluster could use geometric matching 
+      // but in fact the cluster owned by the decision object and the cluster owned by the electron should be the same       
+      // since we have a map made in advance we can make use of the index lookup w/o the need for additional loop 
+      auto origCluster = clusterToIndexMap.find(clusterPtr);
+      ATH_CHECK(origCluster != clusterToIndexMap.end());
+      linkToPrevious(d, m_muonDecisionsKey.key(), origCluster->second);
+
+      // now we have DecisionObject ready to be passed to hypo tool. 
+      // it has link to electron, and decisions on clusters 
+      // we shall avoid calling the tools for chains which were already rejected on certain cluster, but this is left to hypo tools
+      DecisionIDContainer clusterDecisionIDs;
+      decisionIDs(clusterDecisionsHandle->at(origCluster->second), clusterDecisionIDs);
+      
+      auto el = TrigmuCombHypoTool::CombinedMuonInfo{d, *muIter, origCluster->first, clusterDecisionIDs}; 
+      hypoToolInput.emplace_back(el);
+    } 
+    ++muonCounter;
+  }
+
+  // hypo tools
+  for ( auto & tool: m_hypoTools ) {
+    ATH_MSG_DEBUG("Go to " << tool);
+    ATH_CHECK( tool->decide( hypoToolInput ) );
+  }
+
+  // recorded decision objects on TrigmuCombHypo
+  auto handle =  SG::makeHandle( m_decisionsKey, context );
+  ATH_CHECK( handle.record( std::move( decisions ), std::move( aux ) ) );
+
+  ATH_MSG_DEBUG("StatusCode TrigmuCombHypoAlg::execute_r success");
+  return StatusCode::SUCCESS;
+}
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigmuCombHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigmuCombHypoTool.cxx
new file mode 100644
index 00000000000..c3bdcd7a2f7
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigmuCombHypoTool.cxx
@@ -0,0 +1,243 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include <math.h>
+#include <algorithm>
+
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/StatusCode.h"
+#include "AthenaMonitoring/MonitoredScope.h"
+
+#include "DecisionHandling/TrigCompositeUtils.h"
+#include "TrigMuonHypo/TrigmuCombHypoTool.h"
+
+using namespace TrigCompositeUtils;
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+TrigmuCombHypoTool::TrigmuCombHypoTool(const std::string& type, 
+				       const std::string & name,
+				       const IInterface* parent )
+   : AthAlgTool( type, name, parent ),
+     m_decisionId( HLT::Identifier::fromToolName( name ) ) 
+{
+   std::vector<float> defBins;
+   defBins.push_back(0);
+   defBins.push_back(2.5);
+   std::vector<float> defThrs;
+   defThrs.push_back(5.83 * CLHEP::GeV);
+
+   declareProperty("PtBins", m_ptBins = defBins);
+   declareProperty("PtThresholds", m_ptThresholds = defThrs);
+
+   declareProperty("AcceptAll", m_acceptAll = false);
+
+   // Enable pi/K decay rejection
+   declareProperty("ApplyPikCuts",        m_pikCuts = false);
+   declareProperty("MaxPtToApplyPik",      m_maxPtToApplyPik = 25.);
+   declareProperty("MaxChi2IDPik",         m_chi2MaxID = 3.5);
+
+   // strategy dependent pT cuts
+   //0: Std
+   //1: simplified match Pt combined
+   //2: simplified match Pt ID
+   //3: simplified match Pt MU
+   //4: simplified match Pt infinite
+   declareProperty("ApplyStrategyDependentCuts", m_strategydependent = false);
+   declareProperty("StrategyDependentPtCuts",    m_strategyDependentPtCuts);
+
+   std::vector<double> defStrategyDependentPtCuts;
+   defStrategyDependentPtCuts.push_back(0.0);     //strategy 1 (in GeV) (if<0 do not apply the standard signature cut)
+   defStrategyDependentPtCuts.push_back(0.0);     //strategy 2 (in GeV) 
+   defStrategyDependentPtCuts.push_back(0.0);     //strategy 3 (in GeV)
+   defStrategyDependentPtCuts.push_back(-3.0);    //strategy 4 (in GeV)
+   m_strategyDependentPtCuts.set(defStrategyDependentPtCuts);
+
+   m_bins = 0;
+}
+
+TrigmuCombHypoTool::~TrigmuCombHypoTool(){
+}
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+StatusCode TrigmuCombHypoTool::initialize()
+{
+  ATH_MSG_INFO("Initializing " << name() << " - package version " << PACKAGE_VERSION);
+
+  ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId );
+
+  if (m_acceptAll) {
+     ATH_MSG_INFO("Accepting all the events with not cut!");
+  } else {
+     m_bins = m_ptBins.size() - 1;
+     if (m_bins != m_ptThresholds.size()) {
+        ATH_MSG_INFO("bad thresholds setup .... exiting!");
+        return StatusCode::FAILURE;
+     }
+
+     for (std::vector<float>::size_type i = 0; i < m_bins; ++i) {
+
+        ATH_MSG_INFO("bin " << m_ptBins[i] << " - " <<  m_ptBins[i + 1]
+           	  << " with Pt Threshold of " << (m_ptThresholds[i]) / CLHEP::GeV << " GeV");
+     }
+
+  }
+
+  if ( not m_monTool.name().empty() ) {
+     ATH_CHECK( m_monTool.retrieve() );
+     ATH_MSG_DEBUG("MonTool name: " << m_monTool);
+  }
+
+  ATH_MSG_INFO("Initializing" << name() << "successfully");
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode TrigmuCombHypoTool::decide(TrigmuCombHypoTool::CombinedMuonInfo& input) const
+{
+  ATH_MSG_DEBUG("StatusCode decide() start");
+
+  using namespace Monitored;
+
+  // defined Monitoring variables
+  auto fexPt	= MonitoredScalar::declare("Pt", -9999.);
+  auto ptFL	= MonitoredScalar::declare("PtFL", -9999.);
+  auto Strategy	= MonitoredScalar::declare("StrategyFlag", 0);
+  auto idEta 	= MonitoredScalar::declare("Eta", -9999.);
+  auto idPhi 	= MonitoredScalar::declare("Phi", -9999.);
+  auto idZ0 	= MonitoredScalar::declare("Z0", -9999.);
+  auto idA0 	= MonitoredScalar::declare("A0", -9999.);
+
+  auto monitorIt = MonitoredScope::declare(m_monTool, fexPt, ptFL, Strategy, 
+					   idEta, idPhi, idZ0, idA0);
+  // flag to pass or not
+  bool result = false;
+
+  if(m_acceptAll) {
+    result = true;
+    ATH_MSG_DEBUG("Accept property is set: taking all the events");
+    return StatusCode(result);
+  } else {
+    result = false;
+    ATH_MSG_DEBUG("Accept property not set: applying selection!");
+  }
+
+  //Retrieve combined muon
+  //xAOD::L2CombinedMuon
+  auto pMuon = input.cluster;
+  if (!pMuon) {
+     ATH_MSG_ERROR("Retrieval of xAOD::L2CombinedMuon from vector failed");
+     return StatusCode::FAILURE;
+  }
+
+  auto ptValue = pMuon->pt() * pMuon->charge() / CLHEP::GeV;
+
+  fexPt    = ptValue;
+  ptFL      = ptValue;
+  idEta    = pMuon->eta();
+  idPhi    = pMuon->phi();
+  int usealgo      = pMuon->strategy();
+  float ptresComb = pMuon->sigmaPt() / CLHEP::GeV;
+  Strategy  = usealgo;
+  ATH_MSG_DEBUG("combined muon pt (GeV)/ sigma_pt (GeV)/ eta / phi / usedalgo: " 
+              << fexPt << " (GeV) / " << ptresComb << " (GeV) / " << idEta << " / " << idPhi 
+              << " / " << usealgo);
+
+  if (pMuon->pt() == 0) {
+     ATH_MSG_DEBUG("L2CombinedMuon pt == 0, empty container -> rejected");
+     result = false;
+     return StatusCode(result);
+  }
+
+  // check the pointers to the L2StandAloneMuon
+  if (!pMuon->muSATrack()) {
+     ATH_MSG_DEBUG("L2CombinedMuon has no valid xaOD::L2StandaloneMuon -> rejected");
+     result = false;
+     return StatusCode(result);
+  }
+
+  // check the pointer to the ID track
+  if (!pMuon->idTrack()) {
+     ATH_MSG_DEBUG("L2CombinedMuon has no valid xAOD:TrackParticle IDtrack -> rejected");
+     result = false;
+     return StatusCode(result);
+  }
+
+  idA0     = pMuon->idTrack()->d0();
+  idZ0     = pMuon->idTrack()->z0();
+
+  //Get the Pt cut for that eta bin
+  float threshold = (idEta != -9999) ? 0 : 99999999;
+  float absEta = fabs(idEta);
+  for (std::vector<float>::size_type i = 0; i < m_bins; ++i) {
+     if (absEta > m_ptBins[i] && absEta < m_ptBins[i + 1]) threshold = m_ptThresholds[i];
+  }
+
+  // Check pt threshold for hypothesis and pi/k rejection cuts,
+  // convert units since Muonfeature is in GeV
+
+  //Kpi rejection
+  bool pikCut = true;
+  if (m_pikCuts && (fabsf(fexPt) < m_maxPtToApplyPik)) {
+     if (pMuon->idTrack()->chiSquared() > m_chi2MaxID) pikCut = false;
+  }
+
+  //Std Pt cut
+  bool stdCut = true;
+  if (fabsf(fexPt) <= (threshold / CLHEP::GeV)) stdCut = false;
+  ATH_MSG_DEBUG("REGTEST muon pt is " << fexPt
+             << " GeV and threshold cut is " << threshold / CLHEP::GeV
+             << " GeV and pik_cut is " << (pikCut ? "true" : "false"));
+
+  //Strategy dependent Pt cuts
+  bool sdpCut = true;
+  if (m_strategydependent && usealgo > 0) {
+     if (usealgo >= 1 && usealgo <= 4) {
+        double tmpcut = m_strategyDependentPtCuts.value()[usealgo - 1];
+        if (std::abs(fexPt) <= std::abs(tmpcut)) sdpCut = false;
+        if (tmpcut < 0) stdCut = true; //Do not apply std Pt cut
+        ATH_MSG_DEBUG("REGTEST muon pt is " << fexPt << " GeV"
+                   << " and threshold for strategy dependent cut is " << tmpcut
+                   << " GeV and strategy dependent / std cuts are " << (sdpCut ? "true" : "false") << " / " << (stdCut ? "true" : "false"));
+     } else {
+        ATH_MSG_DEBUG("usealgo out of range, is: " << usealgo << " while should be in [1, 4]");
+     }
+  }
+
+  result = stdCut && pikCut && sdpCut;
+
+  if (result) ptFL = -9999.;
+
+  ATH_MSG_DEBUG("REGTEST muon passed pt threshold: " << (stdCut ? "true" : "false")
+             << " and pik_cut is " << (pikCut ? "true" : "false")
+             << " and strategy dependent cuts is " << (sdpCut ? "true" : "false")
+             << " so hypothesis is " << (result ? "true" : "false"));
+
+  return StatusCode(result);
+}
+
+// from TrigmuCombHypoTool 
+StatusCode TrigmuCombHypoTool::decide(std::vector<TrigmuCombHypoTool::CombinedMuonInfo>& hypoToolInput) const
+{
+  ATH_MSG_DEBUG("Applying selection of single << " << m_decisionId.numeric());
+
+  for ( auto& i: hypoToolInput) {
+    if (TrigCompositeUtils::passed(m_decisionId.numeric(), i.previousDecisionIDs)) {
+      if ( decide(i) ) {
+        ATH_MSG_DEBUG("hypothesis is true, so object passed selection");
+        TrigCompositeUtils::addDecisionID(m_decisionId, i.decision);
+      } else {
+        ATH_MSG_DEBUG("hypothesis is false, so no objest passed selection");
+      } // End of TrigMufastHypoTool decide()
+    } 
+  } // End of MuonClusterInfo loops 
+
+  return StatusCode::SUCCESS;
+}
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+
diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/EFPhotonTauFex.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/EFPhotonTauFex.cxx
index 89cbf56ffae..eb6c5e25a82 100644
--- a/Trigger/TrigHypothesis/TrigTauHypo/src/EFPhotonTauFex.cxx
+++ b/Trigger/TrigHypothesis/TrigTauHypo/src/EFPhotonTauFex.cxx
@@ -155,7 +155,7 @@ HLT::ErrorCode EFPhotonTauFex::acceptInputs(HLT::TEConstVec& inputTE, bool& pass
         				trk = (*tau)->track(i)->track();
 					#endif
       				}
-      				catch(std::exception e)
+      				catch(const std::exception& e)
       				{
         				msg() << MSG::WARNING << " REGTEST: EFPhotonTauFex, failed to get tau track link! " <<endmsg;
       				} 
diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/EFTauDiKaonHypo.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/EFTauDiKaonHypo.cxx
index e1dc03558cc..5e7ed6981d1 100644
--- a/Trigger/TrigHypothesis/TrigTauHypo/src/EFTauDiKaonHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigTauHypo/src/EFTauDiKaonHypo.cxx
@@ -291,7 +291,7 @@ HLT::ErrorCode EFTauDiKaonHypo::hltExecute(const HLT::TriggerElement* outputTE,
 	trk = (*tauIt)->track(i)->track();
 	#endif
       }
-      catch(std::exception e)
+      catch(const std::exception& e)
       {
         msg() << MSG::WARNING << " REGTEST: EFTauDiKaonHypo, failed to get tau track link! " <<endmsg;
       } 
diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/HLTVertexPreSelHypo.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/HLTVertexPreSelHypo.cxx
index 99241b04c3d..5f0f18f3c63 100644
--- a/Trigger/TrigHypothesis/TrigTauHypo/src/HLTVertexPreSelHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigTauHypo/src/HLTVertexPreSelHypo.cxx
@@ -134,7 +134,7 @@ HLT::ErrorCode HLTVertexPreSelHypo::hltExecute(const HLT::TriggerElement* inputT
 			z0Jet1 = vertex1->z();
 			ATH_MSG_DEBUG("Found Vertex 1, Z0: " << z0Jet1);
 		}
-		catch(std::exception e)
+		catch(const std::exception& e)
 		{
 			//do nothing
 		}
@@ -144,7 +144,7 @@ HLT::ErrorCode HLTVertexPreSelHypo::hltExecute(const HLT::TriggerElement* inputT
 			z0Jet2 = vertex2->z();
 			ATH_MSG_DEBUG("Found Vertex 2, Z0: " << z0Jet2);
 		}
-		catch(std::exception e)
+		catch(const std::exception& e)
 		{
 			//do nothing
 		}
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleLArDigitsChecks.cxx b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleLArDigitsChecks.cxx
index b8574643d07..46dc8b3fec5 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleLArDigitsChecks.cxx
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleLArDigitsChecks.cxx
@@ -36,7 +36,7 @@ StatusCode SimpleLArDigitsChecks::initialize(){
 	msg << MSG::DEBUG << "initializing SimpleLArDigitsChecks" << endmsg;
 	std::string filename=name();
 	filename+=".BasicCheck.root";
-        counter=0;
+        m_counter=0;
 	m_file = new TFile (filename.c_str(),"RECREATE");
 	m_file->mkdir("EMB");
 	m_file->cd("EMB");
@@ -267,7 +267,7 @@ StatusCode SimpleLArDigitsChecks::execute(){
 	m_nSCells_perLayer[10]->Fill ( count_sCells_Layer10 );
 	m_nSCells_perLayer[11]->Fill ( count_sCells_Layer11 );
 	
-	counter++;
+	m_counter++;
 	return StatusCode::SUCCESS;
 }
 
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleLArDigitsChecks.h b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleLArDigitsChecks.h
index ca26318a068..0449a5d86ef 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleLArDigitsChecks.h
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleLArDigitsChecks.h
@@ -51,7 +51,7 @@ private :
 	std::vector<TH1F*> m_EtSCells_perLayer;
 	std::vector<TH2F*> m_SSamples_perLayer;
 	std::vector<TH2F*> m_NorSSamples_perLayer;
-        int counter;
+        int m_counter;
 
 };
 
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleSuperCellChecks.cxx b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleSuperCellChecks.cxx
index dacd6df2dd7..52cce6c4294 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleSuperCellChecks.cxx
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleSuperCellChecks.cxx
@@ -34,7 +34,7 @@ StatusCode SimpleSuperCellChecks::initialize(){
 	msg << MSG::DEBUG << "initializing SimpleSuperCellChecks" << endmsg;
 	std::string filename=name();
 	filename+=".BasicCheck.root";
-        counter=0;
+        m_counter=0;
 	m_file = new TFile (filename.c_str(),"RECREATE");
 	m_nSCells = new TH1I("nSCells","nSCells",400,0,40000);
 	m_EtSCells = new TH1F("EtSCells","EtSCells",60,0,30e3);
@@ -417,12 +417,12 @@ StatusCode SimpleSuperCellChecks::execute(){
 		msg << MSG::ERROR << "Nothing more to be done, finish here" << endmsg;
 		return StatusCode::SUCCESS;
 	}
-	const CaloIdManager* m_calo_id_manager;
-	if ( (detStore()->retrieve(m_calo_id_manager,"CaloIdManager")).isFailure() ){
+	const CaloIdManager* calo_id_manager;
+	if ( (detStore()->retrieve(calo_id_manager,"CaloIdManager")).isFailure() ){
 		msg << MSG::ERROR << "Not able to map Calo IDs." << endmsg;
 		return StatusCode::SUCCESS;
 	}
-	const CaloCell_SuperCell_ID* calo_sc_id = m_calo_id_manager->getCaloCell_SuperCell_ID();
+	const CaloCell_SuperCell_ID* calo_sc_id = calo_id_manager->getCaloCell_SuperCell_ID();
 	std::vector<float> sc_ets; sc_ets.resize(40000,0.);
 	std::vector<std::vector<float> > sc_etsk; sc_etsk.resize(40000);
 	std::vector<std::vector<float> > sc_times; sc_times.resize(40000);
@@ -568,7 +568,7 @@ StatusCode SimpleSuperCellChecks::execute(){
 	m_QualityNCells->Fill( ccQual );
 	
 	
-	counter++;
+	m_counter++;
 	return StatusCode::SUCCESS;
 }
 
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleSuperCellChecks.h b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleSuperCellChecks.h
index 943915f114b..55b0a228fc1 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleSuperCellChecks.h
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/SimpleSuperCellChecks.h
@@ -82,7 +82,7 @@ private :
 	std::vector<TH2F*> m_resol_vs_eta_perLayer;
 	std::vector<TH2F*> m_resol_vs_nvtx_perLayer;
 	std::vector<TH1F*> m_TimeResolAT_perLayer;
-        int counter;
+        int m_counter;
 
 };
 
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.cxx b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.cxx
index a26b5d684b8..3b427626686 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.cxx
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.cxx
@@ -41,7 +41,8 @@ StatusCode TrigT1CaloBaseFex::finalize(){
 	return StatusCode::SUCCESS;
 }
 
-StatusCode TrigT1CaloBaseFex::getContainers(CaloCellContainer*& scells, const xAOD::TriggerTowerContainer*& TTs){
+StatusCode TrigT1CaloBaseFex::getContainers(std::vector<const CaloCell*>& scells,
+                                            const xAOD::TriggerTowerContainer*& TTs){
 	
 	MsgStream msg(msgSvc(), name());
         const CaloCellContainer* scells_from_sg;
@@ -55,18 +56,16 @@ StatusCode TrigT1CaloBaseFex::getContainers(CaloCellContainer*& scells, const xA
 	}
 
 	if ( m_useProvenance ) {
-		if ( !scells ) scells = new CaloCellContainer();
         	for(auto scell : *scells_from_sg) {
-			if ( scell->provenance() & 0x40 ) scells->push_back( scell );
+			if ( scell->provenance() & 0x40 ) scells.push_back( scell );
 		}
 	}
 	else {
-		if ( !scells ) scells = new CaloCellContainer();
         	for(auto scell : *scells_from_sg) {
-			scells->push_back( scell );
+			scells.push_back( scell );
 		}
 	}
-        for(auto scell : *scells) {
+        for(auto scell : scells) {
 		if ( scell->et() < 3e3 ) continue;
 		msg << MSG::DEBUG << "scell : " << scell->et() << " " << scell->eta() << " " << scell->phi() << endmsg;
 	}
@@ -77,7 +76,8 @@ StatusCode TrigT1CaloBaseFex::getContainers(CaloCellContainer*& scells, const xA
 	return StatusCode::SUCCESS;
 }
 
-StatusCode TrigT1CaloBaseFex::getContainers(CaloCellContainer*& scells, const xAOD::TriggerTowerContainer*& TTs, float etThresholdGeV){
+StatusCode TrigT1CaloBaseFex::getContainers(std::vector<const CaloCell*>& scells,
+                                            const xAOD::TriggerTowerContainer*& TTs, float etThresholdGeV){
 
         MsgStream msg(msgSvc(), name());
         const CaloCellContainer* scells_from_sg;
@@ -91,20 +91,18 @@ StatusCode TrigT1CaloBaseFex::getContainers(CaloCellContainer*& scells, const xA
         }
 
         if ( m_useProvenance ) {
-                if ( !scells ) scells = new CaloCellContainer();
                 for(auto scell : *scells_from_sg) {
-                        if ( scell->provenance() & 0x40 ) scells->push_back( scell );
+                        if ( scell->provenance() & 0x40 ) scells.push_back( scell );
                 }
         }
         else {
-                if ( !scells ) scells = new CaloCellContainer();
                 for(auto scell : *scells_from_sg) {
-                        scells->push_back( scell );
+                        scells.push_back( scell );
                 }
         }
 	// TODO: add more quality cuts? ...
 
-        for(auto scell : *scells) {
+        for(auto scell : scells) {
                 if ( scell->et() < etThresholdGeV*1e3 ) continue;
                 msg << MSG::DEBUG << "scell : " << scell->et() << " " << scell->eta() << " " << scell->phi() << endmsg;
         }
@@ -127,21 +125,27 @@ StatusCode TrigT1CaloBaseFex::getContainers(const xAOD::TruthParticleContainer*&
 }
 
 
-void TrigT1CaloBaseFex::findCellsAbove(const CaloCellContainer* scells, const float& Thr, std::vector<CaloCell*>& out) {
+void TrigT1CaloBaseFex::findCellsAbove(const std::vector<const CaloCell*>& scells,
+                                       const float Thr,
+                                       std::vector<const CaloCell*>& out) {
 	out.clear();
-	for(auto scell : *scells) {
+	for(auto scell : scells) {
 		if ( scell->et() < Thr )  continue;
 		out.push_back(scell);
 	}
 	return;
 }
 
-void TrigT1CaloBaseFex::findCellsAround(const CaloCellContainer* scells, const CaloCell* cell, std::vector<CaloCell*>& out, const float detaSize, const float dphiSize) const {
+void TrigT1CaloBaseFex::findCellsAround(const std::vector<const CaloCell*>& scells,
+                                        const CaloCell* cell,
+                                        std::vector<const CaloCell*>& out,
+                                        const float detaSize,
+                                        const float dphiSize) const {
 	out.clear();
 	if ( !cell ) return;
 	float etacell = cell->eta();
 	float phicell = cell->phi();
-	for(auto scell : *scells) {
+	for(auto scell : scells) {
 		if ( fabsf( scell->eta() - etacell) > detaSize ) continue;
 		float dphi = fabsf( scell->phi() - phicell);
 		dphi = fabsf( M_PI - dphi );
@@ -152,9 +156,14 @@ void TrigT1CaloBaseFex::findCellsAround(const CaloCellContainer* scells, const C
 	return;
 }
 
-void TrigT1CaloBaseFex::findCellsAround(const CaloCellContainer* scells, const float etacell, const float phicell, std::vector<CaloCell*>& out, const float detaSize, const float dphiSize) const {
+void TrigT1CaloBaseFex::findCellsAround(const std::vector<const CaloCell*>& scells,
+                                        const float etacell,
+                                        const float phicell,
+                                        std::vector<const CaloCell*>& out,
+                                        const float detaSize,
+                                        const float dphiSize) const {
         out.clear();
-        for(auto scell : *scells) {
+        for(auto scell : scells) {
                 if ( fabsf( scell->eta() - etacell) > detaSize ) continue;
                 float dphi = fabsf( scell->phi() - phicell);
                 dphi = fabsf( M_PI - dphi );
@@ -194,7 +203,7 @@ void TrigT1CaloBaseFex::findTTsAround(const xAOD::TriggerTowerContainer* scells,
         return;
 }
 
-bool TrigT1CaloBaseFex::isCellEmMaximum(const std::vector<CaloCell*>& scells, const CaloCell* cell) const {
+bool TrigT1CaloBaseFex::isCellEmMaximum(const std::vector<const CaloCell*>& scells, const CaloCell* cell) const {
         if ( !cell ) return false;
 	if ( cell->caloDDE()->getSampling() >= 8 ) return false;
 	float cellpt = cell->et()+0.001; //make sure you don't get thecell itself
@@ -205,7 +214,7 @@ bool TrigT1CaloBaseFex::isCellEmMaximum(const std::vector<CaloCell*>& scells, co
 	return true;
 }
 
-float TrigT1CaloBaseFex::sumEmCells(const std::vector<CaloCell*>& scells) const {
+float TrigT1CaloBaseFex::sumEmCells(const std::vector<const CaloCell*>& scells) const {
 	float totalSum = 0.0;
 	for(auto scell : scells) {
 		if ( scell->caloDDE()->getSampling() <8 ) totalSum+= scell->energy();
@@ -213,7 +222,7 @@ float TrigT1CaloBaseFex::sumEmCells(const std::vector<CaloCell*>& scells) const
 	return totalSum;
 }
 
-float TrigT1CaloBaseFex::sumEmCells2nd(const std::vector<CaloCell*>& scells) const {
+float TrigT1CaloBaseFex::sumEmCells2nd(const std::vector<const CaloCell*>& scells) const {
 	float totalSum = 0.0;
 	for(auto scell : scells) {
 		if ( (scell->caloDDE()->getSampling()==2) ||(scell->caloDDE()->getSampling()==6) ) {
@@ -224,7 +233,7 @@ float TrigT1CaloBaseFex::sumEmCells2nd(const std::vector<CaloCell*>& scells) con
 }
 
 
-float TrigT1CaloBaseFex::sumHadCells(const std::vector<CaloCell*>& scells) const {
+float TrigT1CaloBaseFex::sumHadCells(const std::vector<const CaloCell*>& scells) const {
 	float totalSum = 0.0;
 	for(auto scell : scells){
              if ( (scell->caloDDE()->getSampling() <8) || ( scell->caloDDE()->getSampling()>=20) ) continue;
@@ -244,7 +253,7 @@ float TrigT1CaloBaseFex::sumHadTTs(const std::vector<const xAOD::TriggerTower*>&
 	return totalSum * 1e3; // express in MeV
 }
 
-void TrigT1CaloBaseFex::findCluster(const std::vector<CaloCell*>& scells, float &etaCluster, float &phiCluster) const {
+void TrigT1CaloBaseFex::findCluster(const std::vector<const CaloCell*>& scells, float &etaCluster, float &phiCluster) const {
 	etaCluster=0.0;
 	phiCluster=0.0;
 	float energyCluster=0.0;
@@ -264,9 +273,11 @@ void TrigT1CaloBaseFex::findCluster(const std::vector<CaloCell*>& scells, float
 	}
 }
 
-void TrigT1CaloBaseFex::NoiseThreshold(const CaloCellContainer* scells, const float& significance, std::vector<CaloCell*>& out) {
+void TrigT1CaloBaseFex::NoiseThreshold(const std::vector<const CaloCell*>& scells,
+                                       const float significance,
+                                       std::vector<const CaloCell*>& out) {
 	out.clear();
-	for(auto scell : *scells) {
+	for(auto scell : scells) {
 	  float thr(0.);
 	  //energy = scell->et();
 	  float energy = scell->e();
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.h b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.h
index 2afcf584a02..cfeb28a3218 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.h
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloBaseFex.h
@@ -46,38 +46,53 @@ public :
 
 protected :
 	/** method to get the containers */
-	StatusCode getContainers(CaloCellContainer*& scells, const xAOD::TriggerTowerContainer*& TTs);
-	StatusCode getContainers(CaloCellContainer*& scells, const xAOD::TriggerTowerContainer*& TTs, float etThresholdGeV);
+	StatusCode getContainers(std::vector<const CaloCell*>& scells,
+                                 const xAOD::TriggerTowerContainer*& TTs);
+	StatusCode getContainers(std::vector<const CaloCell*>& scells,
+                                 const xAOD::TriggerTowerContainer*& TTs, float etThresholdGeV);
 	StatusCode getContainers(const xAOD::TruthParticleContainer*& truthContainer);
 	/** find the cells above a given threshold in an event to be used as seeds to build electron candidates */
-	void findCellsAbove(const CaloCellContainer*, const float& thr, std::vector<CaloCell*>& out) ;
+	void findCellsAbove(const std::vector<const CaloCell*>&,
+                            const float thr,
+                            std::vector<const CaloCell*>& out) ;
 	/** finds cells around a seed cell. These cells will be part of the cluster */
-	void findCellsAround(const CaloCellContainer*, const CaloCell* cell, std::vector<CaloCell*>& out, const float deta, const float dphi) const;
-	void findCellsAround(const CaloCellContainer*, const float eta, const float phi, std::vector<CaloCell*>& out, const float deta, const float dphi) const ;
+	void findCellsAround(const std::vector<const CaloCell*>&,
+                             const CaloCell* cell,
+                             std::vector<const CaloCell*>& out,
+                             const float deta,
+                             const float dphi) const;
+	void findCellsAround(const std::vector<const CaloCell*>&,
+                             const float eta,
+                             const float phi,
+                             std::vector<const CaloCell*>& out,
+                             const float deta,
+                             const float dphi) const ;
 	/** finds TTs around a seed cell. These TTs will be part of the cluster. This helps to cover the part related to TileCall */
 	void findTTsAround(const xAOD::TriggerTowerContainer*, const CaloCell* cell, std::vector<const xAOD::TriggerTower*>& out) const ;
 	void findTTsAround(const xAOD::TriggerTowerContainer*, const float eta, const float phi, std::vector<const xAOD::TriggerTower*>& out) const ;
 	/** checks if a give (seed) cell is the highest in a vector of cells. This is to make sure we have a real local EM maximum */
-	bool isCellEmMaximum(const std::vector<CaloCell*>& scells, const CaloCell* cell) const ;
+	bool isCellEmMaximum(const std::vector<const CaloCell*>& scells, const CaloCell* cell) const ;
 	/** sum all cells from the vector that are in the EM calorimeter part */
-	float sumEmCells(const std::vector<CaloCell*>& scells) const ;
+	float sumEmCells(const std::vector<const CaloCell*>& scells) const ;
 	/** sum all cells from the vector that are in the EM calorimeter part (only 2nd layer) */
-	float sumEmCells2nd(const std::vector<CaloCell*>& scells) const ;
+	float sumEmCells2nd(const std::vector<const CaloCell*>& scells) const ;
 	/** sum all cells from the vector that are in the HAD calorimeter part */
-	float sumHadCells(const std::vector<CaloCell*>& scells) const ;
+	float sumHadCells(const std::vector<const CaloCell*>& scells) const ;
 	/** sum all TTs from the vector that are in the HAD calorimeter part, but only for |eta|<1.72 (tile region) */
 	float sumHadTTs(const std::vector<const xAOD::TriggerTower*>& scells) const ;
 	/** detect central cluster position */
-	void findCluster(const std::vector<CaloCell*>& scells, float &etaCluster, float &phiCluster) const;
+	void findCluster(const std::vector<const CaloCell*>& scells, float &etaCluster, float &phiCluster) const;
         /** find cells above E/sigm threshold */
-	void NoiseThreshold(const CaloCellContainer*, const float& significance, std::vector<CaloCell*>& out);
+	void NoiseThreshold(const std::vector<const CaloCell*>&,
+                            const float significance,
+                            std::vector<const CaloCell*>& out);
 
 	/** list of seeds */
-	std::vector<CaloCell*> m_cellsAboveThr;
+	std::vector<const CaloCell*> m_cellsAboveThr;
 	/** list of cells around a cell (seed) */
-	std::vector<CaloCell*> m_cellsAround;
+	std::vector<const CaloCell*> m_cellsAround;
 	/** list of cells around a cell (seed again) */
-	std::vector<CaloCell*> m_cellsAround2;
+	std::vector<const CaloCell*> m_cellsAround2;
 	/** list of TTs around a cell (seed) */
 	std::vector<const xAOD::TriggerTower*> m_TTsAround;
 	/** deta for the cluster definition */
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloEFex.cxx b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloEFex.cxx
index 5f902e78542..d9ddaac1ec9 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloEFex.cxx
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloEFex.cxx
@@ -68,7 +68,7 @@ StatusCode TrigT1CaloEFex::execute(){
         MsgStream msg(msgSvc(), name());
 	msg << MSG::DEBUG << "execute TrigT1CaloEFex" << endmsg;
 
-	CaloCellContainer* scells(0);
+        std::vector<const CaloCell*> scells;
 	const xAOD::TriggerTowerContainer* TTs(0);
 	if ( getContainers(scells, TTs).isFailure() || (TTs==0) ) {
 		msg << MSG::WARNING << " Could not get containers" << endmsg;
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloTauFex.cxx b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloTauFex.cxx
index 597903e68a8..03fc0219daf 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloTauFex.cxx
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloTauFex.cxx
@@ -122,11 +122,11 @@ StatusCode TrigT1CaloTauFex::execute(){
         MsgStream msg(msgSvc(), name());
 	msg << MSG::DEBUG << "execute TrigT1CaloTauFex" << endmsg;
 
-	CaloCellContainer* scells(0);
+        std::vector<const CaloCell*> scells;
 	const xAOD::TriggerTowerContainer* TTs(0);
 	const xAOD::TruthParticleContainer *truthContainer(0);
 
-	if ( getContainers(scells, TTs, m_cellsEtThrehold).isFailure() || (TTs==0) || (scells==0) ) {
+	if ( getContainers(scells, TTs, m_cellsEtThrehold).isFailure() || (TTs==0) ) {
 		msg << MSG::WARNING << " Could not get scell or TT containers" << endmsg;
 		return StatusCode::SUCCESS;
 	}
@@ -290,7 +290,10 @@ void TrigT1CaloTauFex::Truth(const xAOD::TruthParticleContainer *truthContainer)
 }
 
 
-void TrigT1CaloTauFex::IsolationCorett(const CaloCellContainer* scells, const CaloCell* cell, std::vector<CaloCell*>& out1, std::vector<CaloCell*>& out2) {
+void TrigT1CaloTauFex::IsolationCorett(const std::vector<const CaloCell*>& scells,
+                                       const CaloCell* cell,
+                                       std::vector<const CaloCell*>& out1,
+                                       std::vector<const CaloCell*>& out2) {
         out1.clear();
         out2.clear();
         if ( !cell ) return;
@@ -300,16 +303,16 @@ void TrigT1CaloTauFex::IsolationCorett(const CaloCellContainer* scells, const Ca
         bool pres = true;
         // use maps (only barrel)
         if (maps) {
-          int m_phiBin(64), m_etaBin(54);
-          std::vector<int> m_map;
-          for(int i=0;i<(m_etaBin*m_phiBin);i++) m_map.push_back(-1);
-          float m_phiBin_size(2.*TMath::Pi()/m_phiBin), m_etaBin_size(0.1);
+          int nPhiBin(64), nEtaBin(54);
+          std::vector<int> map;
+          for(int i=0;i<(nEtaBin*nPhiBin);i++) map.push_back(-1);
+          float phiBin_size(2.*TMath::Pi()/nPhiBin), etaBin_size(0.1);
           etacell +=2.5;
           phicell +=TMath::Pi();
-          int m_eta_bin = (int) (etacell/m_etaBin_size);
-          int m_phi_bin = (int) (phicell/m_phiBin_size);
-          if(m_eta_bin*m_phiBin+m_phi_bin>(m_etaBin*m_phiBin)) {std::cout << "bin outside map!! "<< m_eta_bin << "," << m_phi_bin<<std::endl;return;}
-          if(m_map.at(m_eta_bin*m_phiBin+m_phi_bin)==-1) {m_map.at(m_eta_bin*m_phiBin+m_phi_bin) = 2;}
+          int eta_bin = (int) (etacell/etaBin_size);
+          int phi_bin = (int) (phicell/phiBin_size);
+          if(eta_bin*nPhiBin+phi_bin>(nEtaBin*nPhiBin)) {std::cout << "bin outside map!! "<< eta_bin << "," << phi_bin<<std::endl;return;}
+          if(map.at(eta_bin*nPhiBin+phi_bin)==-1) {map.at(eta_bin*nPhiBin+phi_bin) = 2;}
           else return;
         }
         // use coordinates of pre-sampler
@@ -321,7 +324,7 @@ void TrigT1CaloTauFex::IsolationCorett(const CaloCellContainer* scells, const Ca
         float deltaphiOuter = 0.15;
         float deltaetaInner = 0.05;
         float deltaphiInner = 0.05;
-        for(auto scell : *scells) {
+        for(auto scell : scells) {
                 if ( fabsf( scell->eta() - etacell) > deltaetaOuter2 ) continue;
                 if (scell->caloDDE()->getSampling()!=1 && scell->caloDDE()->getSampling()!=5 && cell->caloDDE()->getSampling()!=4 && cell->caloDDE()->getSampling()!=8) deltaetaOuter1 = 1.0; // tighter isolation in 1° and 2° layers
                 float dphi = fabsf( scell->phi() - phicell);
@@ -336,7 +339,11 @@ void TrigT1CaloTauFex::IsolationCorett(const CaloCellContainer* scells, const Ca
 }
 
 
-void TrigT1CaloTauFex::IsolationCore(const CaloCellContainer* scells, const CaloCell* cell, std::vector<CaloCell*>& out1, std::vector<CaloCell*>& out2, std::vector<std::vector<float>>& out) {
+void TrigT1CaloTauFex::IsolationCore(const std::vector<const CaloCell*>& scells,
+                                     const CaloCell* cell,
+                                     std::vector<const CaloCell*>& out1,
+                                     std::vector<const CaloCell*>& out2,
+                                     std::vector<std::vector<float>>& out) {
         out1.clear();
         out2.clear();
         out.clear();
@@ -354,7 +361,7 @@ void TrigT1CaloTauFex::IsolationCore(const CaloCellContainer* scells, const Calo
         float AvEta = 0;
         float AvPhi = 0;
         std::vector<float> RoIVar;
-        for(auto scell : *scells) {
+        for(auto scell : scells) {
           float eta = scell->eta();
           float phi = scell->phi();
           if ( fabsf( scell->eta() - etacell) > deltaetaOuter2 ) continue;
@@ -379,7 +386,7 @@ void TrigT1CaloTauFex::IsolationCore(const CaloCellContainer* scells, const Calo
 }
 
 
-void TrigT1CaloTauFex::sumEMCoreCells(const std::vector<CaloCell*>& scells, std::vector<CaloCell*>& out1, std::vector<float>& out2) {
+void TrigT1CaloTauFex::sumEMCoreCells(const std::vector<const CaloCell*>& scells, std::vector<const CaloCell*>& out1, std::vector<float>& out2) {
   out1.clear();
   out2.clear();
   float totalEMCoreSum = 0.0;
@@ -388,7 +395,7 @@ void TrigT1CaloTauFex::sumEMCoreCells(const std::vector<CaloCell*>& scells, std:
       return;
 }
 
-void TrigT1CaloTauFex::sumEMIsoCells(const std::vector<CaloCell*>& scells, std::vector<float>& out) {
+void TrigT1CaloTauFex::sumEMIsoCells(const std::vector<const CaloCell*>& scells, std::vector<float>& out) {
   out.clear();
   float totalEMIsoSum = 0.0;
   for(auto scell : scells) totalEMIsoSum+= scell->energy();
diff --git a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloTauFex.h b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloTauFex.h
index 87c9bb33bd8..4d14d7577ed 100644
--- a/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloTauFex.h
+++ b/Trigger/TrigL1Upgrade/TrigL1CaloUpgrade/src/TrigT1CaloTauFex.h
@@ -40,11 +40,11 @@ private :
         /** list of visible true taus */
         std::vector<TLorentzVector> m_true_vistau;
         /** list of Isolation cells */
-        std::vector<CaloCell*> m_IsoCells;
+        std::vector<const CaloCell*> m_IsoCells;
         /** list of Isolation cells */
-        std::vector<CaloCell*> m_CoreCells;
+        std::vector<const CaloCell*> m_CoreCells;
         /** list of RoI */
-        std::vector<CaloCell*> m_RoICells;
+        std::vector<const CaloCell*> m_RoICells;
         /** list of Core  energy */
         std::vector<float> m_CoreEnergy;
         /** list of Iso energy */
@@ -56,10 +56,17 @@ private :
 
         void ExamineTruthTau(const xAOD::TruthParticle& xTruthParticle) const;
         void Truth(const xAOD::TruthParticleContainer* truthContainer);
-        void IsolationCorett(const CaloCellContainer* scells, const CaloCell* cell, std::vector<CaloCell*>& out1, std::vector<CaloCell*>& out2);
-        void IsolationCore(const CaloCellContainer* scells, const CaloCell* cell, std::vector<CaloCell*>& out1, std::vector<CaloCell*>& out2, std::vector<std::vector<float>>& out);
-        void sumEMCoreCells(const std::vector<CaloCell*>& cell, std::vector<CaloCell*>& out1, std::vector<float>& out2);
-        void sumEMIsoCells(const std::vector<CaloCell*>& cell, std::vector<float>& out);
+        void IsolationCorett(const std::vector<const CaloCell*>& scells,
+                             const CaloCell* cell,
+                             std::vector<const CaloCell*>& out1,
+                             std::vector<const CaloCell*>& out2);
+        void IsolationCore(const std::vector<const CaloCell*>& scells,
+                           const CaloCell* cell,
+                           std::vector<const CaloCell*>& out1,
+                           std::vector<const CaloCell*>& out2,
+                           std::vector<std::vector<float>>& out);
+        void sumEMCoreCells(const std::vector<const CaloCell*>& cell, std::vector<const CaloCell*>& out1, std::vector<float>& out2);
+        void sumEMIsoCells(const std::vector<const CaloCell*>& cell, std::vector<float>& out);
 
 	// sorting utils
         template <typename T, typename Compare> std::vector<std::size_t> sort_permutation( const std::vector<T>& vec, Compare compare);
diff --git a/Trigger/TrigMonitoring/TrigCostMonitor/src/TrigCostRun.cxx b/Trigger/TrigMonitoring/TrigCostMonitor/src/TrigCostRun.cxx
index 4d98b87da7c..25f63d351a1 100644
--- a/Trigger/TrigMonitoring/TrigCostMonitor/src/TrigCostRun.cxx
+++ b/Trigger/TrigMonitoring/TrigCostMonitor/src/TrigCostRun.cxx
@@ -14,7 +14,7 @@
 #include "TrigConfHLTData/HLTUtils.h"
 #include "TrigTimeAlgs/TrigTimer.h"
 
-// Trigger daata
+// Trigger data
 #include "TrigMonitoringEvent/TrigMonConfigCollection.h"
 #include "TrigMonitoringEvent/TrigMonEventCollection.h"
 #include "TrigNavigation/Navigation.h"
@@ -502,7 +502,7 @@ bool TrigCostRun::ReadHLTResult::ReadConfig(ServiceHandle<StoreGateSvc> &storeGa
   }
 
   for(TrigMonConfigCollection::const_iterator it = configCol->begin(); it != configCol->end(); ++it) {
-    TrigMonConfig *ptr = *it;
+    const TrigMonConfig *ptr = *it;
     if(!ptr) continue;
 
     // Have we already saved this config?
@@ -515,7 +515,8 @@ bool TrigCostRun::ReadHLTResult::ReadConfig(ServiceHandle<StoreGateSvc> &storeGa
     //
     const std::vector<uint32_t> &ids = ptr->getVarId();
     if(!std::count(ids.begin(), ids.end(), appId)) {
-      ptr->add<TrigConfVar>(TrigConfVar(appName, appId));
+      // FIXME: const_cast changing SG
+      const_cast<TrigMonConfig*>(ptr)->add<TrigConfVar>(TrigConfVar(appName, appId));
       if(outputLevel <= MSG::DEBUG) log() << MSG::DEBUG << "Attaching App Name map to Config " << appName << " = " << appId << endmsg;
     }
 
@@ -568,14 +569,16 @@ bool TrigCostRun::ReadHLTResult::ReadEvent(ServiceHandle<StoreGateSvc> &storeGat
   std::vector<uint32_t>    &vals = globalConfig->getVarId();
 
   for(TrigMonEventCollection::const_iterator it = eventCol->begin(); it != eventCol->end(); ++it) {
-    TrigMonEvent *ptr = *it;
+    const TrigMonEvent *ptr = *it;
     if(!ptr) continue;
 
     // Add my HLT node
-    ptr->addWord(appId); //Backward compatability
+    // FIXME: const_cast changing SG
+    const_cast<TrigMonEvent*>(ptr)->addWord(appId); //Backward compatability
 
     if(fill_size) {
-      ptr->addVar(Trig::kEventBufferSize, float(eventCol->size()));
+      // FIXME: const_cast changing SG
+      const_cast<TrigMonEvent*>(ptr)->addVar(Trig::kEventBufferSize, float(eventCol->size()));
       fill_size = false;
     }
     
@@ -604,7 +607,8 @@ bool TrigCostRun::ReadHLTResult::ReadEvent(ServiceHandle<StoreGateSvc> &storeGat
         log() << MSG::INFO << "Reading lumi length" << endmsg;
         m_readLumiBlock.updateLumiBlocks( ptr->getRun() );
       }
-      ptr->addVar(Trig::kEventLumiBlockLength, m_readLumiBlock.getLumiBlockLength(ptr->getLumi())); // 43 is lumi block length
+      // FIXME: const-cast changing SG
+      const_cast<TrigMonEvent*>(ptr)->addVar(Trig::kEventLumiBlockLength, m_readLumiBlock.getLumiBlockLength(ptr->getLumi())); // 43 is lumi block length
       if(outputLevel <= MSG::DEBUG) log() << MSG::DEBUG << "Decorating Event:" << ptr->getEvent() << "  LB:"<< ptr->getLumi()<<" with LB Length " << m_readLumiBlock.getLumiBlockLength( ptr->getLumi()) << endmsg;
       std::string msg = m_readLumiBlock.infos();
       if (msg.size()) log() << MSG::INFO << msg;
diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonTool.cxx b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonTool.cxx
index 39676f7bb04..c41f22e97b2 100755
--- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonTool.cxx
+++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonTool.cxx
@@ -810,7 +810,7 @@ unsigned HLTMinBiasMonTool::howManyGoodTracks(const ToolHandle< InDet::IInDetTra
 	StatusCode sc = StatusCode::SUCCESS;
 	// Get the InDetTrackParticles from the event:
 	const xAOD::TrackParticleContainer* tracks = nullptr;
-	sc = m_storeGate->retrieve(tracks,m_inDetTrackParticleContainerName);
+	sc = evtStore()->retrieve(tracks,m_inDetTrackParticleContainerName);
 	unsigned goodTracks(0);
 	if (acceptedTracksPt) acceptedTracksPt->clear();
 	
@@ -843,7 +843,7 @@ void HLTMinBiasMonTool::fillPurityForItem(const std::string &item, const ToolHan
 	StatusCode sc = StatusCode::SUCCESS;
 	// Get the InDetTrackParticles from the event:
 	const xAOD::TrackParticleContainer* tracks = nullptr;
-	sc = m_storeGate->retrieve(tracks,m_inDetTrackParticleContainerName);
+	sc = evtStore()->retrieve(tracks,m_inDetTrackParticleContainerName);
 	unsigned goodTracks(0);
 	if (sc.isFailure() || tracks->empty()) {
 		if (sc.isFailure())
@@ -970,7 +970,7 @@ StatusCode HLTMinBiasMonTool::fillZDCInfo()
 	// Unapcking Calorimeter energy:
 
 	const CaloCellContainer * cellColl = 0;
-	sc = m_storeGate->retrieve(cellColl,m_CaloCellContainerName);
+	sc = evtStore()->retrieve(cellColl,m_CaloCellContainerName);
 	if (sc.isFailure()) {
 	  return(StatusCode::SUCCESS); // to fix no-Calo datasets (bug #90180)
 	}
@@ -1007,7 +1007,7 @@ StatusCode HLTMinBiasMonTool::fillZDCInfo()
 	double E_A = 0; //ZDC energy on Side A
 	double E_C = 0; //ZDC energy on Side C
 
-	sc = m_storeGate->retrieve(zdcChannelCollection, m_ZdcContainerName);
+	sc = evtStore()->retrieve(zdcChannelCollection, m_ZdcContainerName);
 
 	if (sc.isFailure() || zdcChannelCollection->empty()) {
 		if (sc.isFailure())
@@ -1089,7 +1089,7 @@ StatusCode HLTMinBiasMonTool::fillLUCIDInfo()
 	int hitsAn      = 0, hitsCn     = 0;
         
 	const LUCID_RawDataContainer* LUCID_RawDataContainer;
-	sc = m_storeGate->retrieve(LUCID_RawDataContainer, m_LUCID_RawDataContainerName);
+	sc = evtStore()->retrieve(LUCID_RawDataContainer, m_LUCID_RawDataContainerName);
 
 	if (sc.isFailure() || LUCID_RawDataContainer->empty()) {
 		if (sc.isFailure())
@@ -1187,7 +1187,7 @@ StatusCode HLTMinBiasMonTool::fillBCMInfo()
 	//we should check that the both triggers are in the same state!
 
 	const BCM_RDO_Container* bcmRDOcont = 0;
-	StatusCode sc_bcm = m_storeGate->retrieve(bcmRDOcont, m_bcmContainerName);
+	StatusCode sc_bcm = evtStore()->retrieve(bcmRDOcont, m_bcmContainerName);
 	if (sc_bcm.isFailure() || (bcmRDOcont->empty())) {
 		if (sc_bcm.isFailure())
 			(*m_log) << MSG::WARNING << "Failed to retrieve BcmMinBiasMonTool for BCM_RDO_Container" << endmsg;
@@ -1376,7 +1376,7 @@ StatusCode HLTMinBiasMonTool::fillHLTMbtsInfo()
 	//==============================================================================
 	
 	const xAOD::TrigT2MbtsBitsContainer* mbTScont = 0;
-	sc = m_storeGate->retrieve(mbTScont, m_t2mbtsContainerName);
+	sc = evtStore()->retrieve(mbTScont, m_t2mbtsContainerName);
 	
 	if (sc.isFailure() || mbTScont->empty()) {
 		if (sc.isFailure())
@@ -1390,7 +1390,7 @@ StatusCode HLTMinBiasMonTool::fillHLTMbtsInfo()
 		xAOD::TrigT2MbtsBitsContainer::const_iterator mbTS_coll_itr = mbTScont->begin();
 		for (; mbTS_coll_itr != mbTScont->end(); ++mbTS_coll_itr) {
 	
-			xAOD::TrigT2MbtsBits *mbtsFeature = (*mbTS_coll_itr);
+                        const xAOD::TrigT2MbtsBits *mbtsFeature = (*mbTS_coll_itr);
 	
 			mbtsHitEnergies = mbtsFeature->triggerEnergies();
 			mbtsHitTimes = mbtsFeature->triggerTimes();
@@ -1520,7 +1520,7 @@ StatusCode HLTMinBiasMonTool::fillMbtsInfo(const std::string& /*item*/)
 	// MBTS BITS INFORMATION
 	//==============================================================================
 	const xAOD::TrigT2MbtsBitsContainer* mbTScont = 0;
-	StatusCode sc = m_storeGate->retrieve(mbTScont, m_t2mbtsContainerName);
+	StatusCode sc = evtStore()->retrieve(mbTScont, m_t2mbtsContainerName);
 
 	if (sc.isFailure() || mbTScont->empty()) {
 		if (sc.isFailure())
@@ -1534,7 +1534,7 @@ StatusCode HLTMinBiasMonTool::fillMbtsInfo(const std::string& /*item*/)
 		xAOD::TrigT2MbtsBitsContainer::const_iterator mbTS_coll_itr = mbTScont->begin();
 		for (; mbTS_coll_itr != mbTScont->end(); ++mbTS_coll_itr) {
 
-			xAOD::TrigT2MbtsBits *mbtsFeature = (*mbTS_coll_itr);
+			const xAOD::TrigT2MbtsBits *mbtsFeature = (*mbTS_coll_itr);
 
 			mbtsHitEnergies = mbtsFeature->triggerEnergies();
 			mbtsHitTimes = mbtsFeature->triggerTimes();
@@ -1620,7 +1620,7 @@ StatusCode HLTMinBiasMonTool::fillMbtsInfo(const std::string& /*item*/)
 	//Retrieve MBTS container collection from SG
 
 	const TileCellContainer* theMBTScontainer;
-	sc = m_storeGate->retrieve(theMBTScontainer, m_mbtsContainerName);
+	sc = evtStore()->retrieve(theMBTScontainer, m_mbtsContainerName);
 	if (sc.isFailure() || theMBTScontainer->empty()) {
 		if (sc.isFailure())
 			(*m_log) << MSG::WARNING << "Cannot find TileCellContainer object with name " << m_mbtsContainerName << " in TDS"
@@ -1744,7 +1744,7 @@ StatusCode HLTMinBiasMonTool::fillSpacePointInfo(const std::string &item)
 	m_sctSpECC = 0;
 
 	const xAOD::TrigSpacePointCountsContainer* mbSPcont = 0;
-	StatusCode sc_mbsp = m_storeGate->retrieve(mbSPcont, m_spContainerName);
+	StatusCode sc_mbsp = evtStore()->retrieve(mbSPcont, m_spContainerName);
 
 	if (sc_mbsp.isFailure() || mbSPcont->empty()) {
 		if (sc_mbsp.isFailure())
@@ -1761,7 +1761,7 @@ StatusCode HLTMinBiasMonTool::fillSpacePointInfo(const std::string &item)
 		xAOD::TrigSpacePointCountsContainer::const_iterator mbSP_coll_itrE = mbSPcont->end();
 
 		for (; mbSP_coll_itr != mbSP_coll_itrE; ++mbSP_coll_itr) {
-			xAOD::TrigSpacePointCounts *id_mbFeature = (*mbSP_coll_itr);
+			const xAOD::TrigSpacePointCounts *id_mbFeature = (*mbSP_coll_itr);
 			unsigned totBins = id_mbFeature->pixelClusTotBins();
 			if ( totBins > 0){
 				m_pixSpBarr = (int) id_mbFeature->pixelClusBarrelSumEntries(m_timeOverThresholdCut, 0., xAOD::TrigHistoCutType::ABOVE_X_ABOVE_Y);
@@ -1815,7 +1815,7 @@ StatusCode HLTMinBiasMonTool::fillTrackingInfo()
 
 	// EF ID (it is the same for trt and pixel+sct)
 	const xAOD::TrigTrackCountsContainer* mbTTcont = 0;
-	StatusCode sc_mbtt = m_storeGate->retrieve(mbTTcont, m_tcContainerName);
+	StatusCode sc_mbtt = evtStore()->retrieve(mbTTcont, m_tcContainerName);
 
 	if (sc_mbtt.isFailure() || mbTTcont->empty()) {
 		if (sc_mbtt.isFailure())
@@ -1833,7 +1833,7 @@ StatusCode HLTMinBiasMonTool::fillTrackingInfo()
 		// Loop over EF TrigMinBias objects
 		xAOD::TrigTrackCountsContainer::const_iterator mbTT_coll_itr = mbTTcont->begin();
 		for (; mbTT_coll_itr != mbTTcont->end(); ++mbTT_coll_itr) {
-			xAOD::TrigTrackCounts *mbTT = (*mbTT_coll_itr);
+			const xAOD::TrigTrackCounts *mbTT = (*mbTT_coll_itr);
 
 			if (mbTT->z0Bins() > 0) {
 				m_mbTracks = (int) (mbTT->z0_ptSumEntries(m_max_z0, m_min_pt, xAOD::TrigHistoCutType::BELOW_X_ABOVE_Y));
@@ -1859,7 +1859,7 @@ StatusCode HLTMinBiasMonTool::fillHMTSpacePointsInfo()
 	for (auto &i: multiplicity) i = 0.0;
 	
 	const xAOD::TrigSpacePointCountsContainer* mbSPcont = nullptr;
-	sc = m_storeGate->retrieve(mbSPcont, m_spContainerName);
+	sc = evtStore()->retrieve(mbSPcont, m_spContainerName);
 	
 	if (sc.isFailure() || !mbSPcont) {
 		if (sc.isFailure())
@@ -1874,7 +1874,7 @@ StatusCode HLTMinBiasMonTool::fillHMTSpacePointsInfo()
 		unsigned tmp = 0;
 		for (; mbSP_coll_itr != mbSP_coll_itrE; ++mbSP_coll_itr) 
 		{
-			xAOD::TrigSpacePointCounts *trigSpacePointCounts = (*mbSP_coll_itr);
+			const xAOD::TrigSpacePointCounts *trigSpacePointCounts = (*mbSP_coll_itr);
 			++tmp;
 	
 			totNumSctSP = trigSpacePointCounts->sctSpEndcapC() + trigSpacePointCounts->sctSpEndcapA() + trigSpacePointCounts->sctSpBarrel();
@@ -1938,7 +1938,7 @@ StatusCode HLTMinBiasMonTool::fillHMTVertexCountsInfo()
     
     //const xAOD::TrigVertexCounts* trigVertexCounts = nullptr;
 	const xAOD::TrigVertexCountsContainer* vcCont = nullptr;
-    sc = m_storeGate->retrieve(vcCont, m_vcContainerName);
+    sc = evtStore()->retrieve(vcCont, m_vcContainerName);
 
     if (sc.isFailure() || !vcCont) {
 		if (sc.isFailure())
@@ -1953,7 +1953,7 @@ StatusCode HLTMinBiasMonTool::fillHMTVertexCountsInfo()
 		
 		for (; vc_coll_itr != vc_coll_itrE; ++vc_coll_itr) 
 		{
-			xAOD::TrigVertexCounts *trigVertexCounts = (*vc_coll_itr);
+			const xAOD::TrigVertexCounts *trigVertexCounts = (*vc_coll_itr);
 		
 			// Get the number of tracks per vertex
 			std::vector<unsigned int> vtxNtrks = trigVertexCounts->vtxNtrks();
@@ -1976,7 +1976,7 @@ StatusCode HLTMinBiasMonTool::fillHMTTrigVertexCollectionInfo()
 	StatusCode sc = StatusCode::SUCCESS;
 	
 	const TrigVertexCollection* vertexCollection = nullptr;
-	sc = m_storeGate->retrieve(vertexCollection, m_vcolContainerName);
+	sc = evtStore()->retrieve(vertexCollection, m_vcolContainerName);
 	
 	double vertex_weight=0.;
 	double max_vertex_weight=0.;
diff --git a/Trigger/TrigSteer/L1Decoder/src/FakeRoI.cxx b/Trigger/TrigSteer/L1Decoder/src/FakeRoI.cxx
index e4f9eaa4f35..3e8f552cdb8 100644
--- a/Trigger/TrigSteer/L1Decoder/src/FakeRoI.cxx
+++ b/Trigger/TrigSteer/L1Decoder/src/FakeRoI.cxx
@@ -56,7 +56,7 @@ StatusCode FakeRoI::initialize() {
   return StatusCode::SUCCESS;
 }
 
-StatusCode FakeRoI::beginRun() {
+StatusCode FakeRoI::start() {
 	if (m_inputFilename.empty()) {
 		ATH_MSG_WARNING("Provided InputFilename parameter is empty");
 		return StatusCode::RECOVERABLE;
diff --git a/Trigger/TrigSteer/L1Decoder/src/FakeRoI.h b/Trigger/TrigSteer/L1Decoder/src/FakeRoI.h
index f0261afdf71..7d35aa03ba3 100644
--- a/Trigger/TrigSteer/L1Decoder/src/FakeRoI.h
+++ b/Trigger/TrigSteer/L1Decoder/src/FakeRoI.h
@@ -34,10 +34,10 @@ private:
 	};
 public:
 	FakeRoI(const std::string& name, ISvcLocator* pSvcLocator);
-	StatusCode initialize();
-	StatusCode beginRun();
-	StatusCode execute();
-	StatusCode finalize();
+    virtual StatusCode initialize() override;
+	virtual StatusCode start() override;
+	virtual StatusCode execute() override;
+	virtual StatusCode finalize() override;
 private:
 	std::vector<std::vector<SingleFakeRoI>> parseInputFile();
 	std::vector<SingleFakeRoI> parseInputFileLine(const std::string& line, unsigned lineNumber);
diff --git a/Trigger/TrigSteer/L1Decoder/src/FakeRoIView.cxx b/Trigger/TrigSteer/L1Decoder/src/FakeRoIView.cxx
index 7bac9ef2707..d4123ba7017 100644
--- a/Trigger/TrigSteer/L1Decoder/src/FakeRoIView.cxx
+++ b/Trigger/TrigSteer/L1Decoder/src/FakeRoIView.cxx
@@ -78,7 +78,7 @@ namespace AthViews {
     return StatusCode::SUCCESS;
   }
 
-  StatusCode FakeRoIView::beginRun() {
+  StatusCode FakeRoIView::start() {
     if (m_inputFilename.empty()) {
       ATH_MSG_WARNING("Provided InputFilename parameter is empty");
       return StatusCode::RECOVERABLE;
diff --git a/Trigger/TrigSteer/L1Decoder/src/FakeRoIView.h b/Trigger/TrigSteer/L1Decoder/src/FakeRoIView.h
index 63a2d30588e..c0aaf537130 100644
--- a/Trigger/TrigSteer/L1Decoder/src/FakeRoIView.h
+++ b/Trigger/TrigSteer/L1Decoder/src/FakeRoIView.h
@@ -32,10 +32,10 @@ namespace AthViews {
     {
     public:
       FakeRoIView(const std::string& name, ISvcLocator* pSvcLocator);
-      StatusCode initialize();
-      StatusCode beginRun();
-      StatusCode execute();
-      StatusCode finalize();
+      virtual StatusCode initialize() override;
+      virtual StatusCode start() override;
+      virtual StatusCode execute() override;
+      virtual StatusCode finalize() override;
       
     private:
       
diff --git a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h
index 6b15fadeb8b..604519c348f 100644
--- a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h
+++ b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h
@@ -20,7 +20,7 @@ class IRoIsUnpackingTool : virtual public IAlgTool {
 public: 
   DeclareInterfaceID(IRoIsUnpackingTool, 1, 0);
     
-  /// Invoked when there is a potential change of the configuration. Typically beginRun.
+  /// Invoked when there is a potential change of the configuration. Typically start().
   virtual StatusCode updateConfiguration() = 0; 
   
   /**
diff --git a/Trigger/TrigSteer/L1Decoder/src/L1CaloDecoder.cxx b/Trigger/TrigSteer/L1Decoder/src/L1CaloDecoder.cxx
index 8a9b90d2e27..cbd2ee47308 100644
--- a/Trigger/TrigSteer/L1Decoder/src/L1CaloDecoder.cxx
+++ b/Trigger/TrigSteer/L1Decoder/src/L1CaloDecoder.cxx
@@ -47,7 +47,7 @@ StatusCode L1CaloDecoder::initialize() {
   return StatusCode::SUCCESS;
 }
 
-StatusCode L1CaloDecoder::beginRun() {
+StatusCode L1CaloDecoder::start() {
   using namespace TrigConf;
   const ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig();
   for( auto caloType : std::vector<L1DataDef::TriggerType>{ L1DataDef::EM/*, L1DataDef::TAU*/} ) {    
diff --git a/Trigger/TrigSteer/L1Decoder/src/L1CaloDecoder.h b/Trigger/TrigSteer/L1Decoder/src/L1CaloDecoder.h
index 17feb32e097..ee3befbae48 100644
--- a/Trigger/TrigSteer/L1Decoder/src/L1CaloDecoder.h
+++ b/Trigger/TrigSteer/L1Decoder/src/L1CaloDecoder.h
@@ -23,10 +23,10 @@
 class L1CaloDecoder : public AthAlgorithm {
 public:
   L1CaloDecoder(const std::string& name, ISvcLocator* pSvcLocator);
-  StatusCode initialize();
-  StatusCode beginRun();
-  StatusCode execute();
-  StatusCode finalize();
+  virtual StatusCode initialize() override;
+  virtual StatusCode start() override;
+  virtual StatusCode execute() override;
+  virtual StatusCode finalize() override;
 private:
   std::vector<TrigConf::TriggerThreshold*> m_emtauThresholds;
 
diff --git a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx
index e2560be0b32..cd2e5f7495f 100644
--- a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx
+++ b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx
@@ -24,15 +24,14 @@ StatusCode L1Decoder::initialize() {
   CHECK( m_roiUnpackers.retrieve() );
   //  CHECK( m_prescaler.retrieve() );
 
-  // this code should be in th ebeginRun but the later does not seem to be called
-  for ( auto t: m_roiUnpackers )
-    CHECK( t->updateConfiguration() );
-  
-
   return StatusCode::SUCCESS;
 }
 
-StatusCode L1Decoder::beginRun() {
+StatusCode L1Decoder::start() {
+
+  for ( auto t: m_roiUnpackers )
+    CHECK( t->updateConfiguration() );
+
   return StatusCode::SUCCESS;
 }
 
diff --git a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.h b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.h
index 8507b77b71b..4d16fce9cde 100644
--- a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.h
+++ b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.h
@@ -26,7 +26,7 @@ class L1Decoder : public AthReentrantAlgorithm {
 public:
   L1Decoder(const std::string& name, ISvcLocator* pSvcLocator);
   virtual StatusCode initialize() override;
-  virtual StatusCode beginRun() override;
+  virtual StatusCode start() override;
   virtual StatusCode execute_r (const EventContext& ctx) const override;
   virtual StatusCode finalize() override;
 
diff --git a/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx b/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx
index 0cc4f72e984..b6c93d63951 100755
--- a/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx
+++ b/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx
@@ -265,7 +265,7 @@ StatusCode TrigSteer::initialize()
       try {
          m_topoSteer->setupFromConfiguration(*topomenu);
       }
-      catch(TCS::Exception e) {
+      catch(const TCS::Exception& e) {
          ATH_MSG_FATAL("Caught std::exception when configuring steering from menu: " << e.what() );
       }
    }
diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx
index 55c8da3619c..80bcb4d79b3 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx
+++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx
@@ -26,6 +26,7 @@ StatusCode EventViewCreatorAlgorithm::initialize()
   CHECK( m_inViewRoIs.initialize() );
   renounce( m_inViewDecisions );
   CHECK( m_inViewDecisions.initialize() );
+  CHECK( m_scheduler.retrieve() );
 
   //  CHECK( m_viewAlgorithmsPool.retrieve() );
 
@@ -97,10 +98,10 @@ StatusCode EventViewCreatorAlgorithm::execute()
 
   }
   ATH_MSG_DEBUG( "Launching execution in " << viewVector->size() << " views" );
-  // Run the views
-  CHECK( ViewHelper::runInViews( contexts,				// Vector containing views
-				 m_viewAlgorithmNames,			// Algorithms to run in each view
-				 serviceLocator()->service( m_algPoolName ) ) );	// Service to retrieve algorithms by name
+  CHECK( ViewHelper::ScheduleViews( *viewVector,           // Vector containing views
+         m_viewNodeName,                                   // CF node to attach views to
+         ctx,                                              // Source context
+         m_scheduler.get() ) );
   
   // store views
   auto viewsHandle = SG::makeHandle( m_viewsKey );
diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h
index 43d8f277eb7..1a4e5c925af 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h
+++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h
@@ -16,6 +16,7 @@
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 
 #include "GaudiKernel/IAlgResourcePool.h"
+#include "GaudiKernel/IScheduler.h"
 #include "AthViews/View.h"
 
 class EventViewCreatorAlgorithm : public AthAlgorithm
@@ -26,6 +27,8 @@ class EventViewCreatorAlgorithm : public AthAlgorithm
     StatusCode execute();
 
   private:
+    ServiceHandle< IScheduler > m_scheduler{ this, "Scheduler", "AvalancheSchedulerSvc", "The Athena scheduler" };
+
     //Input trig composite collection to split into views
     SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > m_inputDecisionsKey{ this, "Decisions", "Unspecified", "The name of decision container to use in making views" };
 
@@ -36,13 +39,10 @@ class EventViewCreatorAlgorithm : public AthAlgorithm
     SG::WriteHandleKey< ConstDataVector<TrigRoiDescriptorCollection> > m_inViewRoIs{ this, "InViewRoIs", "Unspecified", "Name with which the RoIs shoudl be inserted into the views" };
     SG::WriteHandleKey< ConstDataVector<TrigCompositeUtils::DecisionContainer> > m_inViewDecisions{ this, "InViewDecisions", "Unspecified", "The name of decision container placed in the view" };
 
-    Gaudi::Property< std::vector<std::string> > m_viewAlgorithmNames{ this, "AlgorithmNameSequence", std::vector<std::string>(), "Algorithms to run in each view" };
-
     Gaudi::Property<bool> m_viewPerRoI{ this, "ViewPerRoI", false, "Create one View per RoI as opposed to one View per Decision object, needs to be true when multiple decisions per RoI exists" };
-    
-    Gaudi::Property< std::string > m_algPoolName{ this, "AlgPoolName", "ViewAlgPool", "" };
+    Gaudi::Property< std::string > m_viewNodeName{ this, "ViewNodeName", "", "Name of the CF node to attach a view to" };
     Gaudi::Property< std::string > m_roisLink{ this, "RoIsLink", "Unspecified", "Name of EL to RoI object lined to the decision" };
-    Gaudi::Property< bool > m_viewFallThrough { this, "ViewFallThrough", false, "Set whether views may access StoreGate directly to retrieve data" };
+    Gaudi::Property< bool > m_viewFallThrough { this, "ViewFallThrough", false, "Set whether views may accesas StoreGate directly to retrieve data" };
 };
 
 #endif
diff --git a/Trigger/TrigSteer/ViewAlgsTest/share/EVTest.py b/Trigger/TrigSteer/ViewAlgsTest/share/EVTest.py
index 0f42063a36c..e18ed5a2077 100644
--- a/Trigger/TrigSteer/ViewAlgsTest/share/EVTest.py
+++ b/Trigger/TrigSteer/ViewAlgsTest/share/EVTest.py
@@ -48,12 +48,6 @@ include( "TrigUpgradeTest/HLTCF.py" )
 
 # definition of a hide corner for view algs
 viewAlgsContainer = seqAND( "ViewAlgsContainer" )
-alwaysFail = CfgMgr.AthPrescaler( "alwaysFail" )
-alwaysFail.PercentPass = 0.0
-viewAlgsContainer += alwaysFail
-alwaysPass = CfgMgr.AthPrescaler( "alwaysPass" )
-alwaysPass.PercentPass = 100.0
-TopHLTSeq += parOR( "viewAlgsHide", [alwaysPass, viewAlgsContainer])
 
 
 steps = [ parOR("step0Filtering"), parOR("step1InViewReco") ]
@@ -61,33 +55,19 @@ steps[0] += seqFilter( "Step0EM", Inputs=["L1EM"], Outputs=["step0EM"],
                       Chains=[ x.split(':')[-1].strip() for x in emUnpacker.ThresholdToChainMapping ] ) # all chains
 
 
-
-# this is a piece which is intended to be eliminated hopefully
-from GaudiHive.GaudiHiveConf import AlgResourcePool
-svcMgr += AlgResourcePool( "ViewAlgPool" )
-
-from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-allViewAlgs = AlgSequence( "allViewAlgs" )
-allViewAlgs += seqFilter( "NoExec" )
-#allViewAlgs += CfgMgr.AthPrescaler( "alwaysFail" )
-#allViewAlgs.alwaysFail.PercentPass = 0.0
-
-
 from ViewAlgsTest.ViewAlgsTestConf import SchedulerProxyAlg
 viewAlg = SchedulerProxyAlg( "algInView", OutputLevel = DEBUG, RoIsContainer = "InViewRoI", OutputClusterContainer="ViewClusters")
 
-#allViewAlgs += viewAlg
 viewAlgsContainer += viewAlg
-svcMgr.ViewAlgPool.TopAlg += [ viewAlg.getFullName() ]
-#topSequence += allViewAlgs
 
-algs=[]
+algs=[ useExisting( "Step0EM" ) ]
 from ViewAlgsTest.ViewAlgsTestConf import TestViewDriver
 EMViewsMaker = TestViewDriver( "EMViewsMaker", OutputLevel = DEBUG, 
                                RoIsContainer = 'L1EMRoIs', RoIsViewOutput="InViewRoI", 
                                ClustersViewInput="ViewClusters", Views="EMClusterViews", 
-                               ViewAlgorithmNames = [ viewAlg.name() ] )
+                               ViewNodeName = viewAlgsContainer.name(), Scheduler = AlgScheduler.getScheduler() )
 algs.append( EMViewsMaker )
+algs.append( viewAlgsContainer )
 
 if 'doMerging' in dir() and  doMerging == True:
     from ViewAlgsTest.ViewAlgsTestConf import TestViewMerger    
@@ -97,7 +77,7 @@ if 'doMerging' in dir() and  doMerging == True:
     algs.append( EMViewsMerger )
 
 
-steps[1] += stepSeq("emViewReco", useExisting( "Step0EM" ), algs ) 
+steps[1] += seqAND("emViewReco", algs )
 
 TopHLTSeq += addSteps( steps )
 
diff --git a/Trigger/TrigSteer/ViewAlgsTest/share/creatingEVTest.ref b/Trigger/TrigSteer/ViewAlgsTest/share/creatingEVTest.ref
index 9112aecc6be..767b666c5dd 100644
--- a/Trigger/TrigSteer/ViewAlgsTest/share/creatingEVTest.ref
+++ b/Trigger/TrigSteer/ViewAlgsTest/share/creatingEVTest.ref
@@ -2,21 +2,20 @@ EMViewsMaker                                      DEBUG Property update for Outp
 EMViewsMaker                                      DEBUG input handles: 1
 EMViewsMaker                                      DEBUG output handles: 2
 EMViewsMaker                                      DEBUG Data Deps for EMViewsMaker
+EMViewsMaker                                      DEBUG input handles: 1
+EMViewsMaker                                      DEBUG output handles: 2
+EMViewsMaker                                      DEBUG Data Deps for EMViewsMaker
 EMViewsMaker                            0   0     DEBUG Placed RoICollection with a single RoI  RoIid: 0 RoIword: 1	 z: 0 (-225 - 225) eta: -0.6 (-0.7 - -0.5) phi: 0.2 (0.1 - 0.3) in the view EMViewsMaker_view 0
 EMViewsMaker                            0   0     DEBUG Placed RoICollection with a single RoI  RoIid: 0 RoIword: 1	 z: 0 (-225 - 225) eta: 1 (0.9 - 1.1) phi: -1.1 (-1.2 - -1) in the view EMViewsMaker_view 1
-algInView                               0   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
-algInView                               0   0     DEBUG .. The alg operates on the view EMViewsMaker_view 1
 EMViewsMaker                            0   0     DEBUG Execution in 2 Views performed
-EMViewsMaker                            0   0     DEBUG Cluster of ET -4
-EMViewsMaker                            0   0     DEBUG Cluster of ET -1
 EMViewsMaker                            0   0     DEBUG Recorded views under the key: EMClusterViews
+algInView                               0   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
+algInView                               0   0     DEBUG .. The alg operates on the view EMViewsMaker_view 1
 EMViewsMaker                            2   0     DEBUG Placed RoICollection with a single RoI  RoIid: 0 RoIword: 2	 z: 0 (-225 - 225) eta: -0.6 (-0.7 - -0.5) phi: 1.5 (1.4 - 1.6) in the view EMViewsMaker_view 0
-algInView                               2   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
 EMViewsMaker                            2   0     DEBUG Execution in 1 Views performed
-EMViewsMaker                            2   0     DEBUG Cluster of ET 9
 EMViewsMaker                            2   0     DEBUG Recorded views under the key: EMClusterViews
+algInView                               2   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
 EMViewsMaker                            3   0     DEBUG Placed RoICollection with a single RoI  RoIid: 0 RoIword: 3	 z: 0 (-225 - 225) eta: -1 (-1.1 - -0.9) phi: -1 (-1.1 - -0.9) in the view EMViewsMaker_view 0
-algInView                               3   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
 EMViewsMaker                            3   0     DEBUG Execution in 1 Views performed
-EMViewsMaker                            3   0     DEBUG Cluster of ET -20
 EMViewsMaker                            3   0     DEBUG Recorded views under the key: EMClusterViews
+algInView                               3   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
diff --git a/Trigger/TrigSteer/ViewAlgsTest/share/menuRun.py b/Trigger/TrigSteer/ViewAlgsTest/share/menuRun.py
index 71bef317edd..b1279bee030 100755
--- a/Trigger/TrigSteer/ViewAlgsTest/share/menuRun.py
+++ b/Trigger/TrigSteer/ViewAlgsTest/share/menuRun.py
@@ -17,7 +17,10 @@
 ## basic job configuration
 import AthenaCommon.AtlasUnixStandardJob
 
-
+# Configure the scheduler
+from AthenaCommon.AlgScheduler import AlgScheduler
+AlgScheduler.ShowControlFlow( True )
+AlgScheduler.ShowDataDependencies( True )
 
 ## get a handle on the ServiceManager
 from AthenaCommon.AppMgr import ServiceMgr as svcMgr
@@ -105,18 +108,14 @@ if ( testViewAlgorithm ):
   viewAlg.RoIsContainer = "InViewRoI"
   allViewAlgorithms += viewAlg
 
-  # The pool to retrieve the view algorithm from
-  from GaudiHive.GaudiHiveConf import AlgResourcePool
-  viewAlgPoolName = "ViewAlgPool"
-  svcMgr += AlgResourcePool( viewAlgPoolName )
-  svcMgr.ViewAlgPool.TopAlg = [ viewAlgName ]
-
   # The algorithm to launch the views
   from ViewAlgsTest.ViewAlgsTestConf import TestViewDriver
   runInViews = TestViewDriver( "runInViews" )
   connectAlgorithmsIO ( producer=(caloFakeRoI, "OutputRoIs"), consumer=(runInViews, "RoIsContainer") ) 
   runInViews.OutputLevel = DEBUG
-  runInViews.ViewAlgorithmNames = [ viewAlgName ]
+  runInViews.ViewNodeName = "allViewAlgorithms"
+  runInViews.RoIsViewOutput = "InViewRoI"
+  runInViews.Scheduler = AlgScheduler.getScheduler()
   topSequence += runInViews
   topSequence += allViewAlgorithms
 
diff --git a/Trigger/TrigSteer/ViewAlgsTest/share/mergingEVTest.ref b/Trigger/TrigSteer/ViewAlgsTest/share/mergingEVTest.ref
index fea4db0703b..5e7ebc78803 100644
--- a/Trigger/TrigSteer/ViewAlgsTest/share/mergingEVTest.ref
+++ b/Trigger/TrigSteer/ViewAlgsTest/share/mergingEVTest.ref
@@ -2,25 +2,24 @@ EMViewsMaker                                      DEBUG Property update for Outp
 EMViewsMaker                                      DEBUG input handles: 1
 EMViewsMaker                                      DEBUG output handles: 2
 EMViewsMaker                                      DEBUG Data Deps for EMViewsMaker
+EMViewsMaker                                      DEBUG input handles: 1
+EMViewsMaker                                      DEBUG output handles: 2
+EMViewsMaker                                      DEBUG Data Deps for EMViewsMaker
 EMViewsMaker                            0   0     DEBUG Placed RoICollection with a single RoI  RoIid: 0 RoIword: 1	 z: 0 (-225 - 225) eta: -0.6 (-0.7 - -0.5) phi: 0.2 (0.1 - 0.3) in the view EMViewsMaker_view 0
 EMViewsMaker                            0   0     DEBUG Placed RoICollection with a single RoI  RoIid: 0 RoIword: 1	 z: 0 (-225 - 225) eta: 1 (0.9 - 1.1) phi: -1.1 (-1.2 - -1) in the view EMViewsMaker_view 1
-algInView                               0   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
-algInView                               0   0     DEBUG .. The alg operates on the view EMViewsMaker_view 1
 EMViewsMaker                            0   0     DEBUG Execution in 2 Views performed
-EMViewsMaker                            0   0     DEBUG Cluster of ET -4
-EMViewsMaker                            0   0     DEBUG Cluster of ET -1
 EMViewsMaker                            0   0     DEBUG Recorded views under the key: EMClusterViews
+algInView                               0   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
+algInView                               0   0     DEBUG .. The alg operates on the view EMViewsMaker_view 1
 EMViewsMerger                           0   0     DEBUG Reading fromt he view: EMViewsMaker_view 0
 EMViewsMerger                           0   0     DEBUG Reading fromt he view: EMViewsMaker_view 1
 EMViewsMaker                            2   0     DEBUG Placed RoICollection with a single RoI  RoIid: 0 RoIword: 2	 z: 0 (-225 - 225) eta: -0.6 (-0.7 - -0.5) phi: 1.5 (1.4 - 1.6) in the view EMViewsMaker_view 0
-algInView                               2   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
 EMViewsMaker                            2   0     DEBUG Execution in 1 Views performed
-EMViewsMaker                            2   0     DEBUG Cluster of ET 9
 EMViewsMaker                            2   0     DEBUG Recorded views under the key: EMClusterViews
+algInView                               2   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
 EMViewsMerger                           2   0     DEBUG Reading fromt he view: EMViewsMaker_view 0
 EMViewsMaker                            3   0     DEBUG Placed RoICollection with a single RoI  RoIid: 0 RoIword: 3	 z: 0 (-225 - 225) eta: -1 (-1.1 - -0.9) phi: -1 (-1.1 - -0.9) in the view EMViewsMaker_view 0
-algInView                               3   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
 EMViewsMaker                            3   0     DEBUG Execution in 1 Views performed
-EMViewsMaker                            3   0     DEBUG Cluster of ET -20
 EMViewsMaker                            3   0     DEBUG Recorded views under the key: EMClusterViews
+algInView                               3   0     DEBUG .. The alg operates on the view EMViewsMaker_view 0
 EMViewsMerger                           3   0     DEBUG Reading fromt he view: EMViewsMaker_view 0
diff --git a/Trigger/TrigSteer/ViewAlgsTest/src/TestFEXAlgView.cxx b/Trigger/TrigSteer/ViewAlgsTest/src/TestFEXAlgView.cxx
index 9d204627103..96d9de9dc03 100644
--- a/Trigger/TrigSteer/ViewAlgsTest/src/TestFEXAlgView.cxx
+++ b/Trigger/TrigSteer/ViewAlgsTest/src/TestFEXAlgView.cxx
@@ -13,7 +13,7 @@
 namespace AthViews {
 
 TestFEXAlgView::TestFEXAlgView(const std::string& name, ISvcLocator* pSvcLocator) 
-  : AthViewAlgorithm(name, pSvcLocator),
+  : AthAlgorithm(name, pSvcLocator),
     m_inputContainer("RoIsContainer"), 
     m_outputClusterContainer("OutputClusters"), 
     m_outputClusterContainerAux("OutputClusterAux."),
@@ -73,8 +73,11 @@ StatusCode TestFEXAlgView::execute() {
       ATH_MSG_DEBUG("Created cluster of Et " << etVal);
       xAOD::TrigComposite* proxy  = new xAOD::TrigComposite();          
       m_outputProxyContainer->push_back(proxy);
-      proxy->setObjectLink("cluster", ElementLink<TestClusterContainer>(m_outputClusterContainer.name(), nRoI, eventView(ctx)) );
-      proxy->setObjectLink("seed", ElementLink<xAOD::TrigCompositeContainer>(m_inputContainer.name(), nRoI, eventView(ctx)) );
+
+      // This retrieval and cast could use some protection, but do we actually need this alg?
+      SG::View * myView = dynamic_cast< SG::View * >( ctx.getExtension<Atlas::ExtendedEventContext>()->proxy() );
+      proxy->setObjectLink("cluster", ElementLink<TestClusterContainer>(m_outputClusterContainer.name(), nRoI, myView ) );
+      proxy->setObjectLink("seed", ElementLink<xAOD::TrigCompositeContainer>(m_inputContainer.name(), nRoI, myView ) );
     } else {
       ATH_MSG_DEBUG("No path to RoI object");
     }
diff --git a/Trigger/TrigSteer/ViewAlgsTest/src/TestFEXAlgView.h b/Trigger/TrigSteer/ViewAlgsTest/src/TestFEXAlgView.h
index c6043ee47f4..9583b44fd37 100644
--- a/Trigger/TrigSteer/ViewAlgsTest/src/TestFEXAlgView.h
+++ b/Trigger/TrigSteer/ViewAlgsTest/src/TestFEXAlgView.h
@@ -8,8 +8,7 @@
 #define ViewAlgs_TestFexAlgView_h
 
 #include <string>
-//#include "AthenaBaseComps/AthAlgorithm.h"
-#include "AthViews/AthViewAlgorithm.h"
+#include "AthenaBaseComps/AthAlgorithm.h"
 #include "xAODTrigger/TrigCompositeContainer.h"
 #include "xAODTrigger/TrigCompositeAuxContainer.h"
 #include "AthViews/View.h"
@@ -17,7 +16,7 @@
 #include "./TestEDM.h"
 
 namespace AthViews {
-class TestFEXAlgView : public ::AthViewAlgorithm {
+class TestFEXAlgView : public ::AthAlgorithm {
 
 public:
   TestFEXAlgView(const std::string& name, ISvcLocator* pSvcLocator);
diff --git a/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.cxx b/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.cxx
index b332d8388ea..0448c4dcba9 100644
--- a/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.cxx
+++ b/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.cxx
@@ -17,32 +17,16 @@
 enum RoIsInView { BareRoIDescriptor = 0, CollectionWithOneElement = 1, CollectionWithAllElements = 2, SuperRoI=3 };
 
 TestViewDriver::TestViewDriver( const std::string& name, ISvcLocator* pSvcLocator )
-  : AthAlgorithm( name, pSvcLocator ),
-    m_roisContainer( "RoIsContainer" ),
-    m_roisViewOutput( "RoIsViewOutput" ),
-    m_clustersViewInput( "ClustersViewInput" ),
-    m_views( "Views" ),
-    //    m_outputClusterContainer( "OutputClusters" ),
-    m_viewAlgorithmsPool( "AlgResourcePool/ViewAlgPool", name ) {
-   
-  declareProperty( "RoIsContainer", m_roisContainer, "Input RoIs" );
-  declareProperty( "RoIsViewOutput", m_roisViewOutput, "Name of the collection that will be placed in each view" );
-  declareProperty( "ClustersViewInput", m_clustersViewInput );
-  declareProperty( "Views", m_views, "Name of the generated view" );
-  //  declareProperty( "OutputClusterContainer", m_outputClusterContainer, "Output collection for clusters" );
-  declareProperty( "ViewAlgorithmsPool", m_viewAlgorithmsPool );
-  declareProperty( "ViewAlgorithmNames", m_viewAlgorithmNames, "Names of algorithms to run in the views" );
-  declareProperty( "RoITypeInViews", m_roITypeInViews = 1, "0 - place TrigRoiDesciptor in views, 1 - place Collections wiht single RoI, 2 - place entrie collection in the view, 3 - place SuperRoI in single view " );
+  : AthAlgorithm( name, pSvcLocator ) {
 }
 
 StatusCode TestViewDriver::initialize( ) {
-  CHECK( m_viewAlgorithmsPool.retrieve( ) );
+  CHECK( m_scheduler.retrieve( ) );
   CHECK( m_roisContainer.initialize( ) );
   CHECK( m_roisViewOutput.initialize( ) );
   m_clustersViewInputHandle.assign( m_clustersViewInput );
   CHECK( m_clustersViewInputHandle.initialize( ) );
   CHECK( m_views.initialize( ) );
-  //  CHECK( m_outputClusterContainer.initialize( ) );
   return StatusCode::SUCCESS;
 }
 
@@ -56,13 +40,13 @@ StatusCode TestViewDriver::execute( ) {
   unsigned int conditionsRun = getContext().getExtension<Atlas::ExtendedEventContext>()->conditionsRun();
   for ( const auto roi: *roisContainer.cptr( ) ) {
 
-    contexts.push_back( getContext( ) );    
+    contexts.push_back( getContext( ) );
     viewVector->push_back( ViewHelper::makeView( name( )+"_view", viewCounter++ ) );
     contexts.back( ).setExtension( Atlas::ExtendedEventContext( viewVector->back( ),
                                                                 conditionsRun));
 
-    
-    auto oneRoIColl = std::make_unique< ConstDataVector<TrigRoiDescriptorCollection> >( );    
+
+    auto oneRoIColl = std::make_unique< ConstDataVector<TrigRoiDescriptorCollection> >( );
     oneRoIColl->clear( SG::VIEW_ELEMENTS ); //Don't delete the RoIs
     oneRoIColl->push_back( roi );
     auto handle = SG::makeHandle( m_roisViewOutput, contexts.back( ) );
@@ -73,9 +57,10 @@ StatusCode TestViewDriver::execute( ) {
 
 
   // Run the views
-  CHECK( ViewHelper::runInViews( contexts,
-				 m_viewAlgorithmNames,				  // Algorithms to run in each view
-				 serviceLocator( )->service( "ViewAlgPool" ) ) );  //FIXME this should realy be service handle, else we do costly retrival each execution, needs api change of ViewHelper
+  CHECK( ViewHelper::ScheduleViews( *viewVector,
+                                    m_viewNodeName,
+                                    getContext(),
+                                    m_scheduler.get() ) );
 
   ATH_MSG_DEBUG( "Execution in " << viewVector->size( ) << " Views performed" );
   
@@ -84,8 +69,8 @@ StatusCode TestViewDriver::execute( ) {
   //  auto outputClusterContainerAux = std::make_unique< TestClusterAuxContainer>( );
   //  outputClusterContainer->setStore( outputClusterContainerAux.get( ) );
 
-
-  for ( auto& viewCtx: contexts ) {
+  // This won't work because the views are now scheduled, not run immediately
+  /*for ( auto& viewCtx: contexts ) {
     auto handle = SG::makeHandle( m_clustersViewInputHandle, viewCtx );
     if ( not handle.isValid( ) ) {
       ATH_MSG_ERROR( "Can not bind handle to a view context" );
@@ -94,8 +79,8 @@ StatusCode TestViewDriver::execute( ) {
     for ( auto cluster: *handle.get( ) ) {
       ATH_MSG_DEBUG( "Cluster of ET " << TestEDM::getClusterEt( cluster ) );
       //outputClusterContainer->push_back(cluster);  // FIXME this is not as simple, we need some trick to do copy
-    }    
-  }
+    }
+  }*/
 
   // for now we are not outputting
   //  {
diff --git a/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.h b/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.h
index 6ec96701887..340b14f238e 100644
--- a/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.h
+++ b/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.h
@@ -9,7 +9,7 @@
 
 #include <vector>
 #include <string>
-#include "GaudiKernel/IAlgResourcePool.h"
+#include "GaudiKernel/IScheduler.h"
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "AthContainers/ConstDataVector.h"
 //#include "xAODTrigger/TrigCompositeContainer.h"
@@ -26,19 +26,19 @@ public:
   StatusCode execute();
 
 private:
-  SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roisContainer;
+  SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roisContainer { this, "RoIsContainer", "RoIsContainer", "Input RoIs" };
 
-  SG::WriteHandleKey< ConstDataVector<TrigRoiDescriptorCollection> > m_roisViewOutput;
+  SG::WriteHandleKey< ConstDataVector<TrigRoiDescriptorCollection> > m_roisViewOutput { this, "RoIsViewOutput", "RoIsViewOutput", "Name of the collection that will be placed in each view" };
   // this is problematic and we need to use plain string for the moment
   SG::ReadHandleKey< TestClusterContainer > m_clustersViewInputHandle;
-  std::string m_clustersViewInput;
+  Gaudi::Property< std::string > m_clustersViewInput { this, "ClustersViewInput", "ClustersViewInput", "" };
+  Gaudi::Property< std::string > m_viewNodeName { this, "ViewNodeName", "", "Name of CF node to attach views to" };
 
-  SG::WriteHandleKey< std::vector<SG::View*> > m_views;
-  
-  ServiceHandle<IAlgResourcePool> m_viewAlgorithmsPool;
-  std::vector<std::string> m_viewAlgorithmNames;
-  int m_roITypeInViews;
+  SG::WriteHandleKey< std::vector< SG::View* > > m_views { this, "Views", "Views", "Name of the generated view collection" };
   
+  ServiceHandle< IScheduler > m_scheduler { this, "Scheduler", "AvalancheSchedulerSvc", "The Athena scheduler" };
+  Gaudi::Property< int > m_roITypeInViews { this, "RoITypeInViews", 1, "0 - place TrigRoiDesciptor in views, 1 - place Collections wiht single RoI, 2 - place entrie collection in the view, 3 - place SuperRoI in single view " };
+
 };
 
 #endif
diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/GenericArrayCreator.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/GenericArrayCreator.cxx
index 03d17aa2e9e..a35a8146f32 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/GenericArrayCreator.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/GenericArrayCreator.cxx
@@ -35,7 +35,7 @@ TCS::GenericArrayCreator::sort(const InputTOBArray & input, TOBArray & output) {
          output.push_back( GenericTOB(*cluster) );
       }
    }
-   catch(std::bad_cast bc) {
+   catch(const std::bad_cast& bc) {
       try {
          const JetTOBArray & in = dynamic_cast<const JetTOBArray &>(input);
          foreach(const JetTOB * jet, in) {
@@ -43,7 +43,7 @@ TCS::GenericArrayCreator::sort(const InputTOBArray & input, TOBArray & output) {
          }
          return StatusCode::SUCCESS;
       }
-      catch(std::bad_cast bc) {
+      catch(const std::bad_cast& bc) {
          TCS_EXCEPTION("GenericArrayCreator: neither ClusterArray nor JetArray")
       }
    }
diff --git a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/Root/ConfigurableAlg.cxx b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/Root/ConfigurableAlg.cxx
index b2c6e0cf5b3..c965e822279 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/Root/ConfigurableAlg.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/Root/ConfigurableAlg.cxx
@@ -109,7 +109,7 @@ ConfigurableAlg::setParameters(const ParameterSpace & parameters) {
       try {
          m_parameters.setParameter(p);
       }
-      catch(TCS::Exception e) {
+      catch(const TCS::Exception& e) {
          TCS_EXCEPTION("Algorithm configuration failed for " << name() << "! Caught exception: " << e.what());
       }
    }
diff --git a/Trigger/TrigT1/L1Topo/L1TopoMonitoring/src/L1TopoTestAlg.cxx b/Trigger/TrigT1/L1Topo/L1TopoMonitoring/src/L1TopoTestAlg.cxx
index 443eb2e6abf..5ac734342ae 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoMonitoring/src/L1TopoTestAlg.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoMonitoring/src/L1TopoTestAlg.cxx
@@ -35,7 +35,7 @@ StatusCode L1TopoTestAlg::execute()
   }
   else {
     // loop over and print RDOs
-    for (auto & rdo : *rdos){
+    for (const L1TopoRDO* rdo : *rdos){
       ATH_MSG_VERBOSE( *rdo );
       const std::vector<uint32_t> &cDataWords = rdo->getDataWords();
       if ( cDataWords.size() == 0 ) {
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/CMakeLists.txt
index da79b3a5548..c2b90db9e50 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/CMakeLists.txt
@@ -10,6 +10,8 @@ atlas_depends_on_subdirs(
    PUBLIC
    Trigger/TrigT1/L1Topo/L1TopoEvent )
 
+find_package( Boost )
+
 # Component(s) in the package:
 atlas_add_library( L1TopoSimulationUtils
    L1TopoSimulationUtils/*.h Root/*.cxx
@@ -20,4 +22,4 @@ atlas_add_test( L1TopoSimulationUtils_test
                 SOURCES
                 test/L1TopoSimulationUtils_test.cxx
                 INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                LINK_LIBRARIES TestTools DataModel SGTools L1TopoEvent L1TopoSimulationUtils)
+                LINK_LIBRARIES L1TopoEvent L1TopoSimulationUtils)
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/share/L1TopoSimulationUtils_test.ref b/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/share/L1TopoSimulationUtils_test.ref
new file mode 100644
index 00000000000..d1b6cc93a6e
--- /dev/null
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/share/L1TopoSimulationUtils_test.ref
@@ -0,0 +1,41 @@
+** test1: L1TopoSimulationUtils cosh at different delta-eta values**
+delta eta:  abs(0 - 23) = 23, cosh 000000001010000101
+delta eta:  abs(0 - 23) = 23, cosh 000000001010000101
+delta eta:  abs(0 - 24) = 24, cosh 000000001011000111
+** test2: L1TopoSimulationUtils KFLUT correction vs. et and eta**
+** test3: L1TopoSimulationUtils KFLUT saturation**
+This out_of_range is expected for ET values beyond 1024 : vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)
+** test4: L1TopoSimulationUtils quadraticSumBW bitshift**
+ sum2(1, 1) : std = 1 bw = 1
+ sum2(-1, -1) : std = 1 bw = 1
+ sum2(3, 3) : std = 4 bw = 4
+ sum2(-3, -3) : std = 4 bw = 4
+ sum2(7, 7) : std = 9 bw = 9
+ sum2(-7, -7) : std = 9 bw = 9
+ sum2(15, 15) : std = 21 bw = 21
+ sum2(-15, -15) : std = 21 bw = 21
+ sum2(31, 31) : std = 43 bw = 43
+ sum2(-31, -31) : std = 43 bw = 43
+ sum2(63, 63) : std = 89 bw = 89
+ sum2(-63, -63) : std = 89 bw = 89
+ sum2(127, 127) : std = 179 bw = 179
+ sum2(-127, -127) : std = 179 bw = 179
+ sum2(255, 255) : std = 360 bw = 360
+ sum2(-255, -255) : std = 360 bw = 360
+ sum2(511, 511) : std = 722 bw = 722
+ sum2(-511, -511) : std = 722 bw = 722
+ sum2(1023, 1023) : std = 1446 bw = 1446
+ sum2(-1023, -1023) : std = 1446 bw = 1446
+ sum2(2047, 2047) : std = 2894 bw = 2894
+ sum2(-2047, -2047) : std = 2894 bw = 2894
+ sum2(4095, 4095) : std = 5791 bw = 5791
+ sum2(-4095, -4095) : std = 5791 bw = 5791
+ sum2(8191, 8191) : std = 11583 bw = 11583
+ sum2(-8191, -8191) : std = 11583 bw = 11583
+ sum2(16383, 16383) : std = 23169 bw = 23169
+ sum2(-16383, -16383) : std = 23169 bw = 23169
+ sum2(32767, 32767) : std = 46339 bw = 46339
+ sum2(-32767, -32767) : std = 46339 bw = 46339
+ sum2(0, 65535) : std = 65535 bw = 65535
+ sum2(362, 65535) : std = 65535 bw = 65535
+ sum2(46340, 46340) : std = 65534 bw = 65534
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/test/L1TopoSimulationUtils_test.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/test/L1TopoSimulationUtils_test.cxx
index bcfb14a9cd2..3153ce0007e 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/test/L1TopoSimulationUtils_test.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/test/L1TopoSimulationUtils_test.cxx
@@ -26,6 +26,7 @@
 #include <cassert>
 #include <cstdint>
 #include <exception>
+#include <cmath>
 
 using std::cout;
 using std::endl;
@@ -59,7 +60,7 @@ void test2()
     for(const double eta : {0.05, 0.2, 0.41, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.9, 3.1, 3.5}) {
         for(const unsigned int et : {4, 12, 24, 48, 96, 360}) {
             int iet = kflut.getetbin(et);
-            int ieta = kflut.getetabin(abs(eta));
+            int ieta = kflut.getetabin(std::abs(eta));
             double corrfactor = kflut.getcorrKF(iet, ieta);
             const bool large = corrfactor>+0.5;
             const bool small = corrfactor<-0.5;
@@ -84,7 +85,7 @@ void test3()
         const int et = 1024+1; // 2**10 + 1 : JetTOB has 10bits for E8x8
         const double eta = 0.5;
         int iet = kflut.getetbin(et);
-        int ieta = kflut.getetabin(abs(eta));
+        int ieta = kflut.getetabin(std::abs(eta));
         double corrfactor = kflut.getcorrKF(iet, ieta);
         cout<<" et "<<et<<" ["<<iet<<"], "
             <<" eta "<<eta<<" ["<<ieta<<"] : "
@@ -127,8 +128,10 @@ int floorSqrt(unsigned int x)
 }
 int test4_compare(int u, int v){
     int bw_result = TSU::Kinematics::quadraticSumBW(u,v);
-    unsigned int uu = u*u;
-    unsigned int uv = v*v;
+    unsigned int u_u = u;
+    unsigned int v_u = v;
+    unsigned int uu = u_u*u_u;
+    unsigned int uv = v_u*v_u;
     int fl_result = floorSqrt(uu+uv);
     cout<<" sum2("<<u<<", "<<v<<") :"
         <<" std = "<<fl_result
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/src/DeriveSimulationInputs.cxx b/Trigger/TrigT1/TrigT1CTMonitoring/src/DeriveSimulationInputs.cxx
index 0a030b672a0..ec263cd8ab0 100644
--- a/Trigger/TrigT1/TrigT1CTMonitoring/src/DeriveSimulationInputs.cxx
+++ b/Trigger/TrigT1/TrigT1CTMonitoring/src/DeriveSimulationInputs.cxx
@@ -749,7 +749,7 @@ TrigT1CTMonitoring::DeriveSimulationInputs::DeriveL1CaloInput() {
     
    ATH_MSG_DEBUG("Rederiving L1 Calo input to CTP from hits info" );
 		
-   const CMMCPHitsCollection* CMMCPHits;
+   const CMMCPHitsCollection* CMMCPHits = nullptr;
    ATH_MSG_DEBUG("Retrieving CMMCP hits from storegate location "  << LVL1::TrigT1CaloDefs::CMMCPHitsLocation);
    sc = evtStore()->retrieve(CMMCPHits, LVL1::TrigT1CaloDefs::CMMCPHitsLocation);
     
@@ -769,7 +769,7 @@ TrigT1CTMonitoring::DeriveSimulationInputs::DeriveL1CaloInput() {
          }
       }
 			
-      const CMMJetHitsCollection* CMMJetHits;
+      const CMMJetHitsCollection* CMMJetHits = nullptr;
       sc = evtStore()->retrieve(CMMJetHits, LVL1::TrigT1CaloDefs::CMMJetHitsLocation);
       if (sc.isFailure()) {
          ATH_MSG_WARNING("No CMM JetHits found in TES at "  << LVL1::TrigT1CaloDefs::CMMJetHitsLocation);
@@ -795,7 +795,7 @@ TrigT1CTMonitoring::DeriveSimulationInputs::DeriveL1CaloInput() {
          return sc;
       }
 			
-      const CMMEtSumsCollection* CMMEtSums;
+      const CMMEtSumsCollection* CMMEtSums = nullptr;
       sc = evtStore()->retrieve(CMMEtSums, LVL1::TrigT1CaloDefs::CMMEtSumsLocation);
       if (sc.isFailure()) {
          ATH_MSG_WARNING("No CMMEtSums found in TES at " << LVL1::TrigT1CaloDefs::CMMEtSumsLocation);
diff --git a/Trigger/TrigT1/TrigT1CaloCalibToolInterfaces/TrigT1CaloCalibToolInterfaces/IL1CaloLArTowerEnergy.h b/Trigger/TrigT1/TrigT1CaloCalibToolInterfaces/TrigT1CaloCalibToolInterfaces/IL1CaloLArTowerEnergy.h
index a7701f258d9..cf2b508dd1a 100644
--- a/Trigger/TrigT1/TrigT1CaloCalibToolInterfaces/TrigT1CaloCalibToolInterfaces/IL1CaloLArTowerEnergy.h
+++ b/Trigger/TrigT1/TrigT1CaloCalibToolInterfaces/TrigT1CaloCalibToolInterfaces/IL1CaloLArTowerEnergy.h
@@ -35,12 +35,12 @@ namespace LVL1{
     
     public:
       virtual bool initL1CaloLArTowerEnergy(const CaloCellContainer& cellContainer, const TriggerTowerCollection &triggerTowerCollection) = 0;
-      virtual float EtLArg(const Identifier& TTid) = 0;
-      virtual bool hasMissingFEB(const Identifier& TTid) = 0;
+      virtual float EtLArg(const Identifier& TTid) const = 0;
+      virtual bool hasMissingFEB(const Identifier& TTid) const = 0;
 
     protected:
       virtual void reset() = 0;
-      virtual double IDeta(const Identifier& TTid) = 0;
+      virtual double IDeta(const Identifier& TTid) const = 0;
   };
 } // end of namespace
 #endif
diff --git a/Trigger/TrigT1/TrigT1CaloCalibTools/TrigT1CaloCalibTools/L1CaloLArTowerEnergy.h b/Trigger/TrigT1/TrigT1CaloCalibTools/TrigT1CaloCalibTools/L1CaloLArTowerEnergy.h
index 07f021914b0..52c421601aa 100644
--- a/Trigger/TrigT1/TrigT1CaloCalibTools/TrigT1CaloCalibTools/L1CaloLArTowerEnergy.h
+++ b/Trigger/TrigT1/TrigT1CaloCalibTools/TrigT1CaloCalibTools/L1CaloLArTowerEnergy.h
@@ -54,12 +54,12 @@ public:
   virtual StatusCode finalize();
 
   bool initL1CaloLArTowerEnergy(const CaloCellContainer& cellContainer, const TriggerTowerCollection &triggerTowerCollection);
-  float EtLArg(const Identifier& TTid);
-  bool hasMissingFEB(const Identifier& TTid);
+  float EtLArg(const Identifier& TTid) const;
+  bool hasMissingFEB(const Identifier& TTid) const;
 
 protected:
   void reset();
-  double IDeta(const Identifier& TTid);
+  double IDeta(const Identifier& TTid) const;
 
 private:
 
diff --git a/Trigger/TrigT1/TrigT1CaloCalibTools/src/L1CaloLArTowerEnergy.cxx b/Trigger/TrigT1/TrigT1CaloCalibTools/src/L1CaloLArTowerEnergy.cxx
index d5af1c05159..faf6b6df944 100644
--- a/Trigger/TrigT1/TrigT1CaloCalibTools/src/L1CaloLArTowerEnergy.cxx
+++ b/Trigger/TrigT1/TrigT1CaloCalibTools/src/L1CaloLArTowerEnergy.cxx
@@ -162,15 +162,15 @@ namespace LVL1{
     return true;
   }
 
-  float L1CaloLArTowerEnergy::EtLArg(const Identifier& TTid) {
+  float L1CaloLArTowerEnergy::EtLArg(const Identifier& TTid) const {
 
     float energy = 0;
 
-    mapTT::iterator it_mapTT;
-    mapSum::iterator it_mapSum;
+    mapTT::const_iterator it_mapTT;
+    mapSum::const_iterator it_mapSum;
 
     int sampling = m_lvl1Helper->sampling(TTid);
-    double eta = this-> IDeta(TTid);
+    double eta = this->IDeta(TTid);
 
     //electromagnetic sampling
     if(sampling==0) {
@@ -209,7 +209,7 @@ namespace LVL1{
     return energy;
   }
 
-  double L1CaloLArTowerEnergy::IDeta(const Identifier& TTid) {
+  double L1CaloLArTowerEnergy::IDeta(const Identifier& TTid) const {
     int region = m_lvl1Helper->region(TTid);
     int ieta = m_lvl1Helper->eta(TTid);
     int sign = m_lvl1Helper->pos_neg_z(TTid);
@@ -228,7 +228,7 @@ namespace LVL1{
   }
 
 
-  bool L1CaloLArTowerEnergy::hasMissingFEB(const Identifier& TTid) {
+  bool L1CaloLArTowerEnergy::hasMissingFEB(const Identifier& TTid) const {
 
     bool result = false;
 
diff --git a/Trigger/TrigT1/TrigT1CaloCalibUtils/src/L1CaloPprPhos4ShapeMaker.cxx b/Trigger/TrigT1/TrigT1CaloCalibUtils/src/L1CaloPprPhos4ShapeMaker.cxx
index b276cbc3ed6..6b9e0181547 100644
--- a/Trigger/TrigT1/TrigT1CaloCalibUtils/src/L1CaloPprPhos4ShapeMaker.cxx
+++ b/Trigger/TrigT1/TrigT1CaloCalibUtils/src/L1CaloPprPhos4ShapeMaker.cxx
@@ -628,7 +628,7 @@ bool L1CaloPprPhos4ShapeMaker::IsCoolIdValid(const L1CaloCoolChannelId coolId){
       const unsigned int channel = coolId.channel();
       m_ttOnlineIdHelper->channelId(crate,moduleSlot,subModule,channel);
    }
-   catch(CaloID_Exception) {
+   catch(const CaloID_Exception&) {
       return false;
    }
    
diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.cxx b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.cxx
index e40ba08b841..5272e211e49 100644
--- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.cxx
+++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.cxx
@@ -160,7 +160,7 @@ bool PpmCoolMappingTool::mapping(const int crate, const int module,
         msg(MSG::VERBOSE) << "tower_id: " << ttId << endmsg;
       }
     }
-    catch (CaloID_Exception) { ttId = invalidId; }
+    catch (const CaloID_Exception&) { ttId = invalidId; }
     if (ttId == invalidId) return false;
 
     const int side   = (m_lvl1Helper->pos_neg_z(ttId) == 1) ? 1 : 2;
@@ -237,7 +237,7 @@ bool PpmCoolMappingTool::mapping(const double eta, const double phi,
       msg(MSG::VERBOSE) << "hardware_id: " << id << endmsg;
     }
   }
-  catch (CaloID_Exception) { id = invalidId; }
+  catch (const CaloID_Exception&) { id = invalidId; }
   if (id == invalidId) return false;
 
   const int slot = m_l1ttonlineHelper->module(id);
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPCMX.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPCMX.h
index 8a5713ba33f..b41f850aa42 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPCMX.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPCMX.h
@@ -64,9 +64,6 @@
 
    CPCMX( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-   virtual ~CPCMX();
-
-
    //------------------------------------------------------
    // Methods used by Athena to run the algorithm
    //------------------------------------------------------
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMSim.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMSim.h
index 9a34eda9933..1126320f610 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMSim.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMSim.h
@@ -69,9 +69,6 @@
 
    CPMSim( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-   virtual ~CPMSim();
-
-
    //------------------------------------------------------
    // Methods used by Athena to run the algorithm
    //------------------------------------------------------
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMTowerMaker.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMTowerMaker.h
index 692996f19e6..80c3e805d60 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMTowerMaker.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMTowerMaker.h
@@ -65,9 +65,6 @@ class CPMTowerMaker : public AthAlgorithm
 
   CPMTowerMaker( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-  virtual ~CPMTowerMaker();
-
-
   //------------------------------------------------------
   // Methods used by Athena to run the algorithm
   //------------------------------------------------------
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/EnergyCMX.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/EnergyCMX.h
index 04648f745fe..d793700c441 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/EnergyCMX.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/EnergyCMX.h
@@ -63,8 +63,6 @@
 
    EnergyCMX( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-   virtual ~EnergyCMX();
-
 
    //------------------------------------------------------
    // Methods used by Athena to run the algorithm
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JEMEnergySim.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JEMEnergySim.h
index 6d996883243..aefeafa3599 100644
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JEMEnergySim.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JEMEnergySim.h
@@ -58,8 +58,6 @@
 
    JEMEnergySim( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-   virtual ~JEMEnergySim();
-
 
    //------------------------------------------------------
    // Methods used by Athena to run the algorithm
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JEMJetSim.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JEMJetSim.h
index f4ecb78b13a..6a2c6eb2486 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JEMJetSim.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JEMJetSim.h
@@ -63,8 +63,6 @@
 
    JEMJetSim( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-   virtual ~JEMJetSim();
-
 
    //------------------------------------------------------
    // Methods used by Athena to run the algorithm
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JetCMX.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JetCMX.h
index 7f3e57f4729..d5368900a28 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JetCMX.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JetCMX.h
@@ -64,9 +64,6 @@
 
    JetCMX( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-   virtual ~JetCMX();
-
-
    //------------------------------------------------------
    // Methods used by Athena to run the algorithm
    //------------------------------------------------------
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JetElementMaker.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JetElementMaker.h
index 22f8d8372fe..ca3fa7a6c92 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JetElementMaker.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/JetElementMaker.h
@@ -65,8 +65,6 @@ class JetElementMaker : public AthAlgorithm
 
   JetElementMaker( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-  virtual ~JetElementMaker();
-
 
   //------------------------------------------------------
   // Methods used by Athena to run the algorithm
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/ReprocessTriggerTowers.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/ReprocessTriggerTowers.h
index 2c293beb989..781cf138857 100644
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/ReprocessTriggerTowers.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/ReprocessTriggerTowers.h
@@ -57,8 +57,6 @@
 
    ReprocessTriggerTowers( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-   virtual ~ReprocessTriggerTowers();
-
 
    //------------------------------------------------------
    // Methods used by Athena to run the algorithm
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2CPMTowerMaker.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2CPMTowerMaker.h
index d5bf99e2fcf..3ac29449ec3 100644
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2CPMTowerMaker.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2CPMTowerMaker.h
@@ -68,9 +68,6 @@ class Run2CPMTowerMaker : public AthAlgorithm
 
   Run2CPMTowerMaker( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-  virtual ~Run2CPMTowerMaker();
-
-
   //------------------------------------------------------
   // Methods used by Athena to run the algorithm
   //------------------------------------------------------
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2JetElementMaker.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2JetElementMaker.h
index 56a7d6a92ae..a81ac33afba 100644
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2JetElementMaker.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2JetElementMaker.h
@@ -67,9 +67,6 @@ class Run2JetElementMaker : public AthAlgorithm
 
   Run2JetElementMaker( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-  virtual ~Run2JetElementMaker();
-
-
   //------------------------------------------------------
   // Methods used by Athena to run the algorithm
   //------------------------------------------------------
diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Tester.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Tester.h
index e2632638942..fb75035288c 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Tester.h
+++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Tester.h
@@ -81,8 +81,6 @@ class Tester : public AthAlgorithm
 
   Tester( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-  virtual ~Tester();
-
 
   //------------------------------------------------------
   // Methods used by Athena to run the algorithm
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/CPCMX.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/CPCMX.cxx
index 7e174ed2b75..a34b09a8136 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/CPCMX.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/CPCMX.cxx
@@ -74,11 +74,6 @@ CPCMX::CPCMX
 
 }
 
-// Destructor
-CPCMX::~CPCMX() {
-  ATH_MSG_INFO("Destructor called" );
-}
-
 
 //---------------------------------
 // initialise()
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.cxx
index da5c5d1cdf1..7f45fb1b2e7 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.cxx
@@ -71,11 +71,6 @@ CPMSim::CPMSim
     }
 }
 
-// Destructor
-CPMSim::~CPMSim() {
-  ATH_MSG_INFO("Destructor called" );
-}
-
 
 //---------------------------------
 // initialise()
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/CPMTowerMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/CPMTowerMaker.cxx
index 140218cf8e1..68fcf62ec9b 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/CPMTowerMaker.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/CPMTowerMaker.cxx
@@ -44,11 +44,6 @@ CPMTowerMaker::CPMTowerMaker( const std::string& name, ISvcLocator* pSvcLocator
   declareProperty( "CPMTowerLocation", m_cpmTowerLocation ) ;
 }
   
-CPMTowerMaker::~CPMTowerMaker() {
-  
-  ATH_MSG_INFO( "Destructor called" );
-} 
-
 
   /** the initialise() method is called at the start of processing, so we set up any histograms
       etc. here*/
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/EnergyCMX.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/EnergyCMX.cxx
index 765f8dfec44..18f117a81f1 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/EnergyCMX.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/EnergyCMX.cxx
@@ -65,12 +65,6 @@ EnergyCMX::EnergyCMX
   declareProperty("EnergyCMXDataLocation",   m_energyCMXDataLocation );
 }
 
-// Destructor
-EnergyCMX::~EnergyCMX() {
-  ATH_MSG_INFO("Destructor called");
-	
-}
-
 
 //---------------------------------
 // initialise()
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/JEMEnergySim.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/JEMEnergySim.cxx
index 2fd4fbe6080..dc91e9924aa 100644
--- a/Trigger/TrigT1/TrigT1CaloSim/src/JEMEnergySim.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/JEMEnergySim.cxx
@@ -54,12 +54,6 @@ JEMEnergySim::JEMEnergySim
   declareProperty( "EnergyCMXDataLocation", m_energyCMXDataLocation );
 }
 
-// Destructor
-JEMEnergySim::~JEMEnergySim() {
-  ATH_MSG_INFO("Destructor called" );
-	
-}
-
 
 //---------------------------------
 // initialise()
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/JEMJetSim.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/JEMJetSim.cxx
index fdea247886f..01ce3931d19 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/JEMJetSim.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/JEMJetSim.cxx
@@ -69,11 +69,6 @@ JEMJetSim::JEMJetSim
 
 }
 
-// Destructor
-JEMJetSim::~JEMJetSim() {
-  ATH_MSG_INFO("Destructor called" );
-}
-
 
 //---------------------------------
 // initialise()
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/JetCMX.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/JetCMX.cxx
index 60eb9e03d42..dcb531d1f6a 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/JetCMX.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/JetCMX.cxx
@@ -65,11 +65,6 @@ JetCMX::JetCMX
     declareProperty( "LVL1ConfigSvc", m_configSvc, "LVL1 Config Service");
 }
 
-// Destructor
-JetCMX::~JetCMX() {
-  ATH_MSG_INFO("Destructor called" );
-}
-
 
 //---------------------------------
 // initialise()
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/JetElementMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/JetElementMaker.cxx
index 29d848571c1..61b7b6f3864 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/JetElementMaker.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/JetElementMaker.cxx
@@ -42,11 +42,6 @@ JetElementMaker::JetElementMaker( const std::string& name, ISvcLocator* pSvcLoca
   declareProperty( "JetElementLocation", m_jetElementLocation ) ;
 }
   
-JetElementMaker::~JetElementMaker() {
-  
-  ATH_MSG_INFO( "Destructor called" );
-} 
-
 
   /** the initialise() method is called at the start of processing, so we set up any histograms
       etc. here*/
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/ReprocessTriggerTowers.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/ReprocessTriggerTowers.cxx
index 1aac30d525e..1a17f53f01f 100644
--- a/Trigger/TrigT1/TrigT1CaloSim/src/ReprocessTriggerTowers.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/ReprocessTriggerTowers.cxx
@@ -90,12 +90,6 @@ ReprocessTriggerTowers::ReprocessTriggerTowers
 
 }
 
-// Destructor
-ReprocessTriggerTowers::~ReprocessTriggerTowers() {
-  
-  ATH_MSG_INFO( "Destructor called" );
-}
-
 
 //---------------------------------
 // initialise()
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/Run2CPMTowerMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/Run2CPMTowerMaker.cxx
index 4acf7838445..c31525a9645 100644
--- a/Trigger/TrigT1/TrigT1CaloSim/src/Run2CPMTowerMaker.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/Run2CPMTowerMaker.cxx
@@ -43,10 +43,6 @@ Run2CPMTowerMaker::Run2CPMTowerMaker( const std::string& name, ISvcLocator* pSvc
   declareProperty( "CPMTowerLocation", m_cpmTowerLocation ) ;
 }
   
-Run2CPMTowerMaker::~Run2CPMTowerMaker() {
-  ATH_MSG_INFO("Destructor called" );
-} 
-
 
   /** the initialise() method is called at the start of processing, so we set up any histograms
       etc. here*/
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/Run2JetElementMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/Run2JetElementMaker.cxx
index b54e21c8003..786743b7c7b 100644
--- a/Trigger/TrigT1/TrigT1CaloSim/src/Run2JetElementMaker.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/Run2JetElementMaker.cxx
@@ -40,10 +40,6 @@ Run2JetElementMaker::Run2JetElementMaker( const std::string& name, ISvcLocator*
   declareProperty( "JetElementLocation", m_jetElementLocation ) ;
 }
   
-Run2JetElementMaker::~Run2JetElementMaker() {
-  ATH_MSG_INFO( "Destructor called" );
-} 
-
 
   /** the initialise() method is called at the start of processing, so we set up any histograms
       etc. here*/
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/Tester.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/Tester.cxx
index 32a55d3c24b..25b6d908d87 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/Tester.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/Tester.cxx
@@ -118,13 +118,6 @@ Tester::Tester
 }
 
 
-
-// Destructor
-Tester::~Tester() {
-    ATH_MSG_INFO( "Destructor called" );
-} 
-
-
 //---------------------------------
 // initialise() 
 //---------------------------------
diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/TriggerTowerMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/TriggerTowerMaker.cxx
index ed177600684..85c465f00ca 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/TriggerTowerMaker.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/TriggerTowerMaker.cxx
@@ -607,7 +607,6 @@ TriggerTowerMaker::TriggerTowerMaker( const std::string& name, ISvcLocator* pSvc
 }
   
 TriggerTowerMaker::~TriggerTowerMaker() {
-  ATH_MSG_INFO( "Destructor called" );
   
   delete [] m_sinThetaHash;
   m_sinThetaHash = 0;
diff --git a/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1EtTools.h b/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1EtTools.h
index 0125294a963..7e241bfe599 100755
--- a/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1EtTools.h
+++ b/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1EtTools.h
@@ -34,20 +34,20 @@ Interface definition for L1EtTools
 
     // enter declaration of your interface-defining member functions here
     virtual void moduleSums(const xAOD::JetElementContainer* jetelements,
-                            DataVector<ModuleEnergy>* modules, int slice = -1) = 0;
+                            DataVector<ModuleEnergy>* modules, int slice = -1) const = 0;
     virtual void moduleSums(const xAOD::JetElementMap_t* jemap,
-                            DataVector<ModuleEnergy>* modules, int slice = -1) = 0;
+                            DataVector<ModuleEnergy>* modules, int slice = -1) const = 0;
     virtual void crateSums(const DataVector<ModuleEnergy>* modules,
-                            DataVector<CrateEnergy>* crates, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) = 0 ;
+                            DataVector<CrateEnergy>* crates, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const = 0 ;
     virtual void crateSums(const DataVector<EnergyCMXData>* modules,
-                            DataVector<CrateEnergy>* crates, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) = 0 ;
+                            DataVector<CrateEnergy>* crates, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const = 0 ;
     virtual void crateSums(const xAOD::JetElementContainer* jetelements,
-                           DataVector<CrateEnergy>* crates, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) = 0;
+                           DataVector<CrateEnergy>* crates, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const = 0;
     virtual void crateSums(const xAOD::JetElementMap_t* jemap,
-                           DataVector<CrateEnergy>* crates, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) = 0;
-    virtual SystemEnergy systemSums(const DataVector<CrateEnergy>* crates)  = 0;
-    virtual SystemEnergy systemSums(const xAOD::JetElementContainer* jetelements, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) = 0;
-    virtual SystemEnergy systemSums(const xAOD::JetElementMap_t* jemap, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) = 0;
+                           DataVector<CrateEnergy>* crates, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const = 0;
+    virtual SystemEnergy systemSums(const DataVector<CrateEnergy>* crates) const = 0;
+    virtual SystemEnergy systemSums(const xAOD::JetElementContainer* jetelements, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const = 0;
+    virtual SystemEnergy systemSums(const xAOD::JetElementMap_t* jemap, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const = 0;
   
   };
 
diff --git a/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1JetElementTools.h b/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1JetElementTools.h
index feba221b620..5db88d51b26 100755
--- a/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1JetElementTools.h
+++ b/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1JetElementTools.h
@@ -39,11 +39,11 @@ Interface definition for L1JetTools
     static const InterfaceID& interfaceID( ) ;
 
     // enter declaration of your interface-defining member functions here
-    virtual void makeJetElements(const xAOD::TriggerTowerContainer* tts, xAOD::JetElementContainer* jetElements) = 0;
-    virtual void mapJetElements(const xAOD::JetElementContainer* jetElements, xAOD::JetElementMap_t* map) = 0;
+    virtual void makeJetElements(const xAOD::TriggerTowerContainer* tts, xAOD::JetElementContainer* jetElements) const = 0;
+    virtual void mapJetElements(const xAOD::JetElementContainer* jetElements, xAOD::JetElementMap_t* map) const = 0;
 
     // depricated methods
-    virtual void makeJetElements(const DataVector<TriggerTower>* tts, DataVector<JetElement>* jetElements) = 0;
+    virtual void makeJetElements(const DataVector<TriggerTower>* tts, DataVector<JetElement>* jetElements) const = 0;
     
   };
 
diff --git a/Trigger/TrigT1/TrigT1CaloTools/TrigT1CaloTools/L1EtTools.h b/Trigger/TrigT1/TrigT1CaloTools/TrigT1CaloTools/L1EtTools.h
index 6b25b9cec65..93404888476 100755
--- a/Trigger/TrigT1/TrigT1CaloTools/TrigT1CaloTools/L1EtTools.h
+++ b/Trigger/TrigT1/TrigT1CaloTools/TrigT1CaloTools/L1EtTools.h
@@ -72,30 +72,30 @@ namespace LVL1
       virtual StatusCode finalize();
       /** Returns a vector of LVL1::ModuleEnergy objects */
       virtual void moduleSums(const xAOD::JetElementContainer* jetelements,
-                              DataVector<ModuleEnergy>* modules, int slice = -1) ;
+                              DataVector<ModuleEnergy>* modules, int slice = -1) const;
       virtual void moduleSums(const xAOD::JetElementMap_t* jemap,
-                              DataVector<ModuleEnergy>* modules, int slice = -1) ;
+                              DataVector<ModuleEnergy>* modules, int slice = -1) const;
       /** Returns a vector of LVL1::CrateEnergy objects */
       virtual void crateSums(const DataVector<ModuleEnergy>* modules,
-                             DataVector<CrateEnergy>* crates, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) ;
+                             DataVector<CrateEnergy>* crates, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const;
       virtual void crateSums(const DataVector<EnergyCMXData>* modules,
-                             DataVector<CrateEnergy>* crates, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) ;
+                             DataVector<CrateEnergy>* crates, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const;
       /** Directly obtain LVL1::CrateEnergy objects */
       virtual void crateSums(const xAOD::JetElementContainer* jetelements,
-                             DataVector<CrateEnergy>* crates, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) ;
+                             DataVector<CrateEnergy>* crates, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const;
       virtual void crateSums(const xAOD::JetElementMap_t* jemap,
-                             DataVector<CrateEnergy>* crates, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) ;
+                             DataVector<CrateEnergy>* crates, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const;
       /** Returns a LVL1::SystemEnergy object */
-      virtual SystemEnergy systemSums(const DataVector<CrateEnergy>* crates) ;
+      virtual SystemEnergy systemSums(const DataVector<CrateEnergy>* crates) const;
       /** Directly obtain a LVL1::SystemEnergy object */
-      virtual SystemEnergy systemSums(const xAOD::JetElementContainer* jetelements, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) ;
-      virtual SystemEnergy systemSums(const xAOD::JetElementMap_t* jemap, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) ;
+      virtual SystemEnergy systemSums(const xAOD::JetElementContainer* jetelements, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const;
+      virtual SystemEnergy systemSums(const xAOD::JetElementMap_t* jemap, int slice = -1, float etaMaxXE = 5., float etaMaxTE = 5., bool restricted = false) const;
             
     private:
 
       /** Return a map of JetElements */
       void mapJetElements(const xAOD::JetElementContainer* jetelements,
-                          xAOD::JetElementMap_t* m_jeContainer);
+                          xAOD::JetElementMap_t* m_jeContainer) const;
       /** Fill masked out JetElements map */
       void fillMaskedOutMap();
       
diff --git a/Trigger/TrigT1/TrigT1CaloTools/TrigT1CaloTools/L1JetElementTools.h b/Trigger/TrigT1/TrigT1CaloTools/TrigT1CaloTools/L1JetElementTools.h
index b7015bbd2cb..02ff1db19d4 100755
--- a/Trigger/TrigT1/TrigT1CaloTools/TrigT1CaloTools/L1JetElementTools.h
+++ b/Trigger/TrigT1/TrigT1CaloTools/TrigT1CaloTools/L1JetElementTools.h
@@ -51,11 +51,11 @@ namespace LVL1
       virtual StatusCode finalize  ();
 
       /** Fill DataVector of JetElements from user-supplied TriggerTowers */
-      virtual void makeJetElements(const xAOD::TriggerTowerContainer* tts, xAOD::JetElementContainer* jetElements);
-      virtual void mapJetElements(const xAOD::JetElementContainer* jetElements, xAOD::JetElementMap_t* map);
+      virtual void makeJetElements(const xAOD::TriggerTowerContainer* tts, xAOD::JetElementContainer* jetElements) const;
+      virtual void mapJetElements(const xAOD::JetElementContainer* jetElements, xAOD::JetElementMap_t* map) const;
 
       // @DEPRICATED(amazurov)
-      virtual void makeJetElements(const DataVector<TriggerTower>* tts, DataVector<JetElement>* jetElements);
+      virtual void makeJetElements(const DataVector<TriggerTower>* tts, DataVector<JetElement>* jetElements) const;
             
     private:
 
diff --git a/Trigger/TrigT1/TrigT1CaloTools/src/L1EtTools.cxx b/Trigger/TrigT1/TrigT1CaloTools/src/L1EtTools.cxx
index 8f24d04929b..e35bce24fbe 100755
--- a/Trigger/TrigT1/TrigT1CaloTools/src/L1EtTools.cxx
+++ b/Trigger/TrigT1/TrigT1CaloTools/src/L1EtTools.cxx
@@ -98,7 +98,7 @@ void L1EtTools::fillMaskedOutMap() {
 //================ Having map of JetElements facilitates JE->JEM association =====
 
 void L1EtTools::mapJetElements(const xAOD::JetElementContainer* jetelements,
-                                     xAOD::JetElementMap_t* jeContainer){
+                                     xAOD::JetElementMap_t* jeContainer) const {
 
   // Clear map before filling
   jeContainer->clear();
@@ -126,11 +126,11 @@ void L1EtTools::mapJetElements(const xAOD::JetElementContainer* jetelements,
 //=====================Form JEM ET sums ====================
 
 void L1EtTools::moduleSums(const xAOD::JetElementContainer* jetelements,
-                           DataVector<ModuleEnergy>* modules, int slice) {
+                           DataVector<ModuleEnergy>* modules, int slice) const {
 
   modules->clear();
-  if (m_TEMasks) delete m_TEMasks;
-  m_TEMasks = 0;
+  //if (m_TEMasks) delete m_TEMasks;
+  //m_TEMasks = 0;
   //if (!m_TEMasks) fillMaskedOutMap();
   
   // Need map of JetElements as input to ModuleEnergy class creator
@@ -152,11 +152,11 @@ void L1EtTools::moduleSums(const xAOD::JetElementContainer* jetelements,
 //=====================Form JEM ET sums ====================
 
 void L1EtTools::moduleSums(const xAOD::JetElementMap_t* jemap,
-                           DataVector<ModuleEnergy>* modules, int slice) {
+                           DataVector<ModuleEnergy>* modules, int slice) const {
 
   modules->clear();
-  if (m_TEMasks) delete m_TEMasks;
-  m_TEMasks = 0;
+  //if (m_TEMasks) delete m_TEMasks;
+  //m_TEMasks = 0;
   //if (!m_TEMasks) fillMaskedOutMap();
   
   // Loop over crates, modules and create set of ModuleEnergy objects
@@ -170,7 +170,7 @@ void L1EtTools::moduleSums(const xAOD::JetElementMap_t* jemap,
 
 //=====================Form JE Crate ET sums ====================
 
-void L1EtTools::crateSums(const DataVector<ModuleEnergy>* modules, DataVector<CrateEnergy>* crates, float etaMaxXE, float etaMaxTE, bool restricted) {
+void L1EtTools::crateSums(const DataVector<ModuleEnergy>* modules, DataVector<CrateEnergy>* crates, float etaMaxXE, float etaMaxTE, bool restricted) const {
 
   crates->clear();
   // Loop over crates and create set of CrateEnergy objects
@@ -183,7 +183,7 @@ void L1EtTools::crateSums(const DataVector<ModuleEnergy>* modules, DataVector<Cr
 
 //=====================Form JE Crate ET sums ====================
 
-void L1EtTools::crateSums(const DataVector<EnergyCMXData>* modules, DataVector<CrateEnergy>* crates, float etaMaxXE, float etaMaxTE, bool restricted) {
+void L1EtTools::crateSums(const DataVector<EnergyCMXData>* modules, DataVector<CrateEnergy>* crates, float etaMaxXE, float etaMaxTE, bool restricted) const {
 
   crates->clear();
   // Loop over crates and create set of CrateEnergy objects
@@ -196,7 +196,7 @@ void L1EtTools::crateSums(const DataVector<EnergyCMXData>* modules, DataVector<C
 
 //=====================Form System ET sums ====================
 
-SystemEnergy L1EtTools::systemSums(const DataVector<CrateEnergy>* crates) {
+SystemEnergy L1EtTools::systemSums(const DataVector<CrateEnergy>* crates) const {
 
   // This class will take crate sums and form system sums, apply thresholds, etc
   SystemEnergy result(crates, m_configSvc);
@@ -207,7 +207,7 @@ SystemEnergy L1EtTools::systemSums(const DataVector<CrateEnergy>* crates) {
 //=====================Return JE Crate ET sums directly =============
 
 void L1EtTools::crateSums(const xAOD::JetElementContainer* jetelements,
-                          DataVector<CrateEnergy>* crates, int slice, float etaMaxXE, float etaMaxTE, bool restricted) {
+                          DataVector<CrateEnergy>* crates, int slice, float etaMaxXE, float etaMaxTE, bool restricted) const {
 
   crates->clear();
   
@@ -229,7 +229,7 @@ void L1EtTools::crateSums(const xAOD::JetElementContainer* jetelements,
 //=====================Return JE Crate ET sums directly =============
 
 void L1EtTools::crateSums(const xAOD::JetElementMap_t* jemap,
-                          DataVector<CrateEnergy>* crates, int slice, float etaMaxXE, float etaMaxTE, bool restricted) {
+                          DataVector<CrateEnergy>* crates, int slice, float etaMaxXE, float etaMaxTE, bool restricted) const {
 
   crates->clear();
   
@@ -250,7 +250,7 @@ void L1EtTools::crateSums(const xAOD::JetElementMap_t* jemap,
 
 //=====================Return final System ET sums directly =============
 
-SystemEnergy L1EtTools::systemSums(const xAOD::JetElementContainer* jetelements, int slice, float etaMaxXE, float etaMaxTE, bool restricted) {
+SystemEnergy L1EtTools::systemSums(const xAOD::JetElementContainer* jetelements, int slice, float etaMaxXE, float etaMaxTE, bool restricted) const {
 
   // First need to form modules and crates
   DataVector<CrateEnergy>* crates = new DataVector<CrateEnergy>;
@@ -266,7 +266,7 @@ SystemEnergy L1EtTools::systemSums(const xAOD::JetElementContainer* jetelements,
 
 //=====================Return final System ET sums directly =============
 
-SystemEnergy L1EtTools::systemSums(const xAOD::JetElementMap_t* jemap, int slice, float etaMaxXE, float etaMaxTE, bool restricted) {
+SystemEnergy L1EtTools::systemSums(const xAOD::JetElementMap_t* jemap, int slice, float etaMaxXE, float etaMaxTE, bool restricted) const {
 
   // First need to form modules and crates
   DataVector<CrateEnergy>* crates = new DataVector<CrateEnergy>;
diff --git a/Trigger/TrigT1/TrigT1CaloTools/src/L1JetElementTools.cxx b/Trigger/TrigT1/TrigT1CaloTools/src/L1JetElementTools.cxx
index f5a10adb6f2..0c5fef63837 100755
--- a/Trigger/TrigT1/TrigT1CaloTools/src/L1JetElementTools.cxx
+++ b/Trigger/TrigT1/TrigT1CaloTools/src/L1JetElementTools.cxx
@@ -50,7 +50,7 @@ StatusCode L1JetElementTools::finalize()
 }
 
 /** Fill DataVector of JetElements from user-supplied vector of TriggerTowers */
-void L1JetElementTools::makeJetElements(const xAOD::TriggerTowerContainer* tts, xAOD::JetElementContainer* jetElements){
+void L1JetElementTools::makeJetElements(const xAOD::TriggerTowerContainer* tts, xAOD::JetElementContainer* jetElements) const {
 
   // Clear collection before filling
   jetElements->clear();
@@ -130,7 +130,7 @@ void L1JetElementTools::makeJetElements(const xAOD::TriggerTowerContainer* tts,
 
 
 /** Fill map of JetElements from user-supplied vector of TriggerTowers */
-void L1JetElementTools::mapJetElements(const xAOD::JetElementContainer* jetElements, xAOD::JetElementMap_t* map){
+void L1JetElementTools::mapJetElements(const xAOD::JetElementContainer* jetElements, xAOD::JetElementMap_t* map) const {
 
   // Clear map before filling
   map->clear();
@@ -148,7 +148,7 @@ void L1JetElementTools::mapJetElements(const xAOD::JetElementContainer* jetEleme
 }
 
 /** Fill DataVector of JetElements from user-supplied vector of TriggerTowers */
-void L1JetElementTools::makeJetElements(const DataVector<TriggerTower>* tts, DataVector<JetElement>* jetElements){
+void L1JetElementTools::makeJetElements(const DataVector<TriggerTower>* tts, DataVector<JetElement>* jetElements) const {
   
   // Clear collection before filling
   jetElements->clear();
diff --git a/Trigger/TrigT1/TrigT1CaloTools/src/L1TriggerTowerTool.cxx b/Trigger/TrigT1/TrigT1CaloTools/src/L1TriggerTowerTool.cxx
index a18188087f8..932bd09e4d8 100644
--- a/Trigger/TrigT1/TrigT1CaloTools/src/L1TriggerTowerTool.cxx
+++ b/Trigger/TrigT1/TrigT1CaloTools/src/L1TriggerTowerTool.cxx
@@ -1287,7 +1287,7 @@ HWIdentifier L1TriggerTowerTool::hwIdentifier(const Identifier& id)
    HWIdentifier hwId(0);
    if (m_ttSvc) {
      try   { hwId = m_ttSvc->createTTChannelID(id, false); }
-     catch (CaloID_Exception) { hwId = HWIdentifier(0); }
+     catch (const CaloID_Exception&) { hwId = HWIdentifier(0); }
    }
    return hwId;
 }
@@ -1345,7 +1345,7 @@ L1CaloCoolChannelId L1TriggerTowerTool::channelID(const Identifier& id)
       HWIdentifier hwId = hwIdentifier(id);
       coolId = m_ttSvc->createL1CoolChannelId(hwId);
     }
-    catch (CaloID_Exception) { coolId = L1CaloCoolChannelId(0); }
+    catch (const CaloID_Exception&) { coolId = L1CaloCoolChannelId(0); }
   }
   return coolId;
 }
diff --git a/Trigger/TrigT1/TrigT1Muctpi/src/Mioct/SectorLogicReader.cxx b/Trigger/TrigT1/TrigT1Muctpi/src/Mioct/SectorLogicReader.cxx
index 7f0a6655972..ae53bc59bec 100644
--- a/Trigger/TrigT1/TrigT1Muctpi/src/Mioct/SectorLogicReader.cxx
+++ b/Trigger/TrigT1/TrigT1Muctpi/src/Mioct/SectorLogicReader.cxx
@@ -60,7 +60,7 @@ namespace LVL1MUCTPI {
                      << "EventSource"  << MsgLogger::endmsg;
          }
 
-      } catch ( std::bad_cast ) {
+      } catch ( const std::bad_cast& ) {
          REPORT_ERROR_MSG( "The SectorLogicReader needs a SectorLogicSource as "
                            "EventSource !" );
          return;
diff --git a/Trigger/TrigTools/TrigInDetToolInterfaces/TrigInDetToolInterfaces/ITrigTRT_DriftCircleProvider.h b/Trigger/TrigTools/TrigInDetToolInterfaces/TrigInDetToolInterfaces/ITrigTRT_DriftCircleProvider.h
index 4170c034e98..efd43988a45 100755
--- a/Trigger/TrigTools/TrigInDetToolInterfaces/TrigInDetToolInterfaces/ITrigTRT_DriftCircleProvider.h
+++ b/Trigger/TrigTools/TrigInDetToolInterfaces/TrigInDetToolInterfaces/ITrigTRT_DriftCircleProvider.h
@@ -31,10 +31,10 @@ class ITrigTRT_DriftCircleProviderTool : virtual public IAlgTool {
   virtual StatusCode  fillCollections( const IRoiDescriptor &roi) = 0;
   virtual StatusCode  fillCollections( std::vector<IdentifierHash> ,std::vector<const ROBF*>) = 0;
   virtual std::string trtContainerName() = 0;
-  virtual double getTRTTotalTime() = 0;
-  virtual double getTRTRegSelTime() = 0;
-  virtual double getTRTTrtCnvTime() = 0;
-  virtual double getTRTRobProvTime() = 0;
+  virtual double getTRTTotalTime() const = 0;
+  virtual double getTRTRegSelTime() const = 0;
+  virtual double getTRTTrtCnvTime() const = 0;
+  virtual double getTRTRobProvTime() const = 0;
 
   virtual const std::vector<int>* fillTRT_DataErrors() = 0;
 };
diff --git a/Trigger/TrigTools/TrigInDetTrackFitter/src/TrigInDetTrackFitter.cxx b/Trigger/TrigTools/TrigInDetTrackFitter/src/TrigInDetTrackFitter.cxx
index 15d7d73d22a..a8097f09a9b 100755
--- a/Trigger/TrigTools/TrigInDetTrackFitter/src/TrigInDetTrackFitter.cxx
+++ b/Trigger/TrigTools/TrigInDetTrackFitter/src/TrigInDetTrackFitter.cxx
@@ -579,7 +579,6 @@ Trk::TrkTrackState* TrigInDetTrackFitter::extrapolate(Trk::TrkTrackState* pTS,
   AmgSymMatrix(5) Gi;
   for(i=0;i<5;i++) for(j=i;j<5;j++)
     {
-      Gi(i,j)=pTE->m_getTrackCovariance(i,j);
       Gi.fillSymmetric(i, j, pTE->m_getTrackCovariance(i,j));
     }
   Gi = Gi.inverse();
@@ -1078,7 +1077,7 @@ Trk::Track* TrigInDetTrackFitter::fitTrack(const Trk::Track& recoTrack, const Tr
         break;
         ATH_MSG_DEBUG("REGTEST: cov(" << i << "," << i << ") =" << cov_diag << " < 0, reject track");
       }
-      cov->fillSymmetric(i, i, pTS->m_getTrackCovariance(i,i));
+      (*cov)(i, i) = pTS->m_getTrackCovariance(i,i);
       for(int j=i+1;j<5;j++) {
         cov->fillSymmetric(i, j, pTS->m_getTrackCovariance(i,j));
       }
diff --git a/Trigger/TrigTools/TrigInDetVxInJetTool/TrigInDetVxInJetTool/TrigInDetVxInJetTool.h b/Trigger/TrigTools/TrigInDetVxInJetTool/TrigInDetVxInJetTool/TrigInDetVxInJetTool.h
index e38b5ef6fd2..f4917a77e5a 100755
--- a/Trigger/TrigTools/TrigInDetVxInJetTool/TrigInDetVxInJetTool/TrigInDetVxInJetTool.h
+++ b/Trigger/TrigTools/TrigInDetVxInJetTool/TrigInDetVxInJetTool/TrigInDetVxInJetTool.h
@@ -158,14 +158,14 @@ private:
                       Amg::Vector3D        & FitVertex,
                       std::vector<double>  & ErrorMatrix,
                       CLHEP::HepLorentzVector     & Momentum,
-                      std::vector< std::vector<double> >  & TrkAtVrt) const; 
+                      std::vector< std::vector<double> >  & TrkAtVrt);
 
   void RemoveEntryInList(std::vector<const TrigInDetTrack*>& , int) const;
 
   int SelGoodTrigTrack(const std::vector<const TrigInDetTrack*>& InpPart,
 		       const Trk::RecVertex                    & PrimVrt,
 		       const CLHEP::HepLorentzVector                  & JetDir,
-		       std::vector<const TrigInDetTrack*>      & SelPart) const;
+		       std::vector<const TrigInDetTrack*>      & SelPart);
 
   template <class Track>
   void Select2TrVrt(std::vector<const Track*>  & SelectedTracks,
@@ -176,7 +176,7 @@ private:
                     std::vector<const Track*>  & TrkFromV0,
                     std::vector<const Track*>  & ListSecondTracks);
 
-  StatusCode VKalVrtFitFastBase(const std::vector<const TrigInDetTrack*>& listPart,Amg::Vector3D& Vertex) const;
+  StatusCode VKalVrtFitFastBase(const std::vector<const TrigInDetTrack*>& listPart,Amg::Vector3D& Vertex);
     
   StatusCode VKalVrtFitBase(const std::vector<const TrigInDetTrack*> & listPart,
                             Amg::Vector3D                            & Vertex,
@@ -185,7 +185,7 @@ private:
                             std::vector<double>                      & ErrorMatrix,
                             std::vector<double>                      & Chi2PerTrk,
                             std::vector< std::vector<double> >       & TrkAtVrt,
-                            double                                   & Chi2 ) const;
+                            double                                   & Chi2 );
 
 };
 
diff --git a/Trigger/TrigTools/TrigInDetVxInJetTool/src/CutTrk.cxx b/Trigger/TrigTools/TrigInDetVxInJetTool/src/CutTrk.cxx
index 956aac8cc17..58155c1ff04 100755
--- a/Trigger/TrigTools/TrigInDetVxInJetTool/src/CutTrk.cxx
+++ b/Trigger/TrigTools/TrigInDetVxInJetTool/src/CutTrk.cxx
@@ -13,7 +13,7 @@
 int  TrigInDetVxInJetTool::SelGoodTrigTrack( const std::vector<const TrigInDetTrack*>& InpTrk,
                                              const Trk::RecVertex                    & PrimVrt,
                                              const CLHEP::HepLorentzVector                  & JetDir,
-                                             std::vector<const TrigInDetTrack*>& SelectedTracks) const {    
+                                             std::vector<const TrigInDetTrack*>& SelectedTracks) {
   
   std::vector<const TrigInDetTrack*>::const_iterator i_ntrk = InpTrk.begin();
   const TrigInDetTrackFitPar* mPer=0;
diff --git a/Trigger/TrigTools/TrigInDetVxInJetTool/src/TrigVrtSec.cxx b/Trigger/TrigTools/TrigInDetVxInJetTool/src/TrigVrtSec.cxx
index bacf95a3a2b..3a0ea1e44eb 100755
--- a/Trigger/TrigTools/TrigInDetVxInJetTool/src/TrigVrtSec.cxx
+++ b/Trigger/TrigTools/TrigInDetVxInJetTool/src/TrigVrtSec.cxx
@@ -344,7 +344,6 @@ double TrigInDetVxInJetTool::FitCommonVrt(std::vector<const Track*>          & L
                                           std::vector<double>                & ErrorMatrix,
                                           CLHEP::HepLorentzVector            & Momentum,
                                           std::vector< std::vector<double> > & TrkAtVrt)
-  const
 {
 
   if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "FitCommonVrt() called " <<ListSecondTracks.size()<< endmsg;
diff --git a/Trigger/TrigTools/TrigInDetVxInJetTool/src/Utilities.cxx b/Trigger/TrigTools/TrigInDetVxInJetTool/src/Utilities.cxx
index 1ba8b8a698d..3848ff85e1e 100755
--- a/Trigger/TrigTools/TrigInDetVxInJetTool/src/Utilities.cxx
+++ b/Trigger/TrigTools/TrigInDetVxInJetTool/src/Utilities.cxx
@@ -232,7 +232,6 @@ void TrigInDetVxInJetTool::RemoveEntryInList(std::vector<const TrigInDetTrack*>&
 
 StatusCode TrigInDetVxInJetTool::VKalVrtFitFastBase(const std::vector<const TrigInDetTrack*>& listPart,
                                                     Amg::Vector3D  & FitVertex)
-  const
 {  
   return m_fitSvc->VKalVrtFitFast(listPart,FitVertex);    /* Fast crude estimation */
 }
@@ -244,7 +243,7 @@ StatusCode TrigInDetVxInJetTool::VKalVrtFitBase(const std::vector<const TrigInDe
                                                 std::vector<double>&                       ErrorMatrix,
                                                 std::vector<double>&                       Chi2PerTrk,
                                                 std::vector< std::vector<double> >&        TrkAtVrt,
-                                                double& Chi2 ) const
+                                                double& Chi2 )
 {
   return m_fitSvc->VKalVrtFit( listPart, Vertex, Momentum, Charge,
                                ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2);
diff --git a/Trigger/TrigTools/TrigOfflineDriftCircleTool/TrigOfflineDriftCircleTool/TrigTRT_DriftCircleProviderTool.h b/Trigger/TrigTools/TrigOfflineDriftCircleTool/TrigOfflineDriftCircleTool/TrigTRT_DriftCircleProviderTool.h
index 42de2bf17e3..41558a6df8b 100755
--- a/Trigger/TrigTools/TrigOfflineDriftCircleTool/TrigOfflineDriftCircleTool/TrigTRT_DriftCircleProviderTool.h
+++ b/Trigger/TrigTools/TrigOfflineDriftCircleTool/TrigOfflineDriftCircleTool/TrigTRT_DriftCircleProviderTool.h
@@ -48,10 +48,10 @@ class TrigTRT_DriftCircleProviderTool: public AthAlgTool, virtual public ITrigTR
 
   std::string trtContainerName(); 
 
-  inline double getTRTTotalTime(void) {return (double) m_time_total;}
-  inline double getTRTRobProvTime(void) {return (double) m_time_robprov;}
-  inline double getTRTRegSelTime(void) {return (double) m_time_regsel;}
-  inline double getTRTTrtCnvTime(void) {return (double) m_time_trtcnv;}
+  inline double getTRTTotalTime(void) const {return (double) m_time_total;}
+  inline double getTRTRobProvTime(void) const {return (double) m_time_robprov;}
+  inline double getTRTRegSelTime(void) const {return (double) m_time_regsel;}
+  inline double getTRTTrtCnvTime(void) const {return (double) m_time_trtcnv;}
 
   const std::vector<int>* fillTRT_DataErrors();
 
diff --git a/Trigger/TrigTruthEvent/TrigTruthEventAthenaPool/CMakeLists.txt b/Trigger/TrigTruthEvent/TrigTruthEventAthenaPool/CMakeLists.txt
index 5a82e1dab24..b2138e52769 100644
--- a/Trigger/TrigTruthEvent/TrigTruthEventAthenaPool/CMakeLists.txt
+++ b/Trigger/TrigTruthEvent/TrigTruthEventAthenaPool/CMakeLists.txt
@@ -38,7 +38,7 @@ find_package( AthenaPoolUtilitiesTest )
 
 if( ATHENAPOOLUTILITIESTEST_FOUND )
   set( TRIGTRUTHEVENTATHENAPOOL_REFERENCE_TAG
-       TrigTruthEventAthenaPoolReference-01-00-00 )
+       TrigTruthEventAthenaPool-01-00-00 )
   run_tpcnv_test( TrigTruthEventTPCnv_15.8.0   AOD-15.8.0-full
                   REFERENCE_TAG ${TRIGTRUTHEVENTATHENAPOOL_REFERENCE_TAG} )
   run_tpcnv_test( TrigTruthEventTPCnv_18.0.0   AOD-18.0.0-full
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt
index 9175b69a968..cbf885f1dab 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt
+++ b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt
@@ -8,11 +8,11 @@ atlas_subdir( TrigUpgradeTest )
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
                           TestPolicy
-			  AtlasPolicy	
-			  GaudiKernel
-			  PRIVATE
-			  Control/AthenaBaseComps
-			  Trigger/TrigEvent/TrigSteeringEvent
+                          AtlasPolicy
+                          GaudiKernel
+                          PRIVATE
+                          Control/AthenaBaseComps
+                          Trigger/TrigEvent/TrigSteeringEvent
                           )
 
 find_package( Boost COMPONENTS filesystem thread system )
@@ -20,56 +20,56 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 
 atlas_add_library( TrigUpgradeTestLib
                    src/*.cxx
-		   PUBLIC_HEADERS TrigUpgradeTest
-		   INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-		   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES}
-		   GaudiKernel AthenaBaseComps TrigSteeringEvent DecisionHandlingLib )
-										                    
+                   PUBLIC_HEADERS TrigUpgradeTest
+                   INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES}
+                   GaudiKernel AthenaBaseComps TrigSteeringEvent DecisionHandlingLib )
+
 atlas_add_component( TrigUpgradeTest
                      src/components/*.cxx
-		     INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-		     LINK_LIBRARIES ${Boost_LIBRARIES}
-		     ${ROOT_LIBRARIES} GaudiKernel
-		     AthenaBaseComps TrigUpgradeTestLib )
+                     INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${Boost_LIBRARIES}
+                     ${ROOT_LIBRARIES} GaudiKernel
+                     AthenaBaseComps TrigUpgradeTestLib )
 
 
-atlas_add_test( GraphView1 SCRIPT test/test_graph_view.sh
-                ENVIRONMENT THREADS=1     )
-atlas_add_test( GraphView2 SCRIPT test/test_graph_view.sh
-                ENVIRONMENT THREADS=2     )
-atlas_add_test( GraphView64 SCRIPT test/test_graph_view.sh
-                ENVIRONMENT THREADS=64              )
+atlas_add_test( ViewSchedule1 SCRIPT test/test_view_schedule.sh
+                ENVIRONMENT THREADS=1 )
+atlas_add_test( ViewSchedule2 SCRIPT test/test_view_schedule.sh
+                ENVIRONMENT THREADS=2 )
+atlas_add_test( ViewSchedule64 SCRIPT test/test_view_schedule.sh
+                ENVIRONMENT THREADS=64 )
 
-# out untill we find a way to properly invoke tests from other packages
-# atlas_add_test( creatingEVTest SCRIPT  forward.sh ViewAlgsTest/test/creatingEVTest.sh )
+# out until we find a way to properly invoke tests from other packages
+# atlas_add_test( creatingEVTest SCRIPT forward.sh ViewAlgsTest/test/creatingEVTest.sh )
 
 atlas_add_test( merge SCRIPT test/test_merge.sh)
 
-atlas_add_test( IDRunMC     SCRIPT test/test_id_run_mc.sh
-                PROPERTIES TIMEOUT 500 
+atlas_add_test( IDRunMC SCRIPT test/test_id_run_mc.sh
+                PROPERTIES TIMEOUT 500
               )
 
-atlas_add_test( IDRunData     SCRIPT test/test_id_run_data.sh
-                PROPERTIES TIMEOUT 500 
+atlas_add_test( IDRunData SCRIPT test/test_id_run_data.sh
+                PROPERTIES TIMEOUT 500
               )
 
-#atlas_add_test( caloRunData   SCRIPT test/test_calo_run_data.sh
-#                PROPERTIES TIMEOUT 500 
+#atlas_add_test( caloRunData SCRIPT test/test_calo_run_data.sh
+#                PROPERTIES TIMEOUT 500
 #              )
 # replaced by complete egamma test
 
-atlas_add_test( egammaRunData   SCRIPT test/test_egamma_run_data.sh
-                PROPERTIES TIMEOUT 500 
+atlas_add_test( egammaRunData SCRIPT test/test_egamma_run_data.sh
+                PROPERTIES TIMEOUT 500
               )
 
-atlas_add_test( muRunData   SCRIPT test/test_mu_run_data.sh
-                PROPERTIES TIMEOUT 500 
+atlas_add_test( muRunData SCRIPT test/test_mu_run_data.sh
+                PROPERTIES TIMEOUT 500
               )
 
 
 
 atlas_add_test( idCaloRunData   SCRIPT test/test_id_calo_run_data.sh
-                PROPERTIES TIMEOUT 500 
+                PROPERTIES TIMEOUT 500
               )
 
 atlas_add_test( EmuL1Decoding SCRIPT test/test_emu_l1_decoding.sh)
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/IDCalo.py b/Trigger/TrigValidation/TrigUpgradeTest/share/IDCalo.py
index f525f9d68e3..0fbe00acc7f 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/IDCalo.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/IDCalo.py
@@ -4,32 +4,47 @@
 
 include("TrigUpgradeTest/testHLT_MT.py")
 
-viewTest = opt.enableViews   # from testHLT_MT.py
 from AthenaCommon.AlgSequence import AlgSequence
 topSequence = AlgSequence()
-AthViewSeq = topSequence.AthViewSeq
 
 isData = False
 if globalflags.InputFormat.is_bytestream():
   isData = True
 
-InDetCacheCreatorTrigViews= AthViewSeq.InDetCacheCreatorTrigViews
-if viewTest:
-  viewMaker = CfgMgr.AthViews__RoiCollectionToViews( "viewMaker" )
-  viewMaker.ViewBaseName = "testView"
-  viewMaker.AlgPoolName = svcMgr.ViewAlgPool.name()
-  viewMaker.InputRoICollection = "EMRoIs"
-  viewMaker.OutputRoICollection = "EMViewRoIs"
-  viewMaker.ViewFallThrough = True
-  topSequence.AthViewSeq += viewMaker
+# ----------------------------------------------------------------
+# Setup Views
+# ----------------------------------------------------------------
+viewSeq = AthSequencer("AthViewSeq", Sequential=True, ModeOR=False, StopOverride=False)
+topSequence += viewSeq
 
+#Create IdentifiableCaches
+from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__CacheCreator
+InDetCacheCreatorTrigViews = InDet__CacheCreator(name = "InDetCacheCreatorTrigViews",
+                                     Pixel_ClusterKey = "PixelTrigClustersCache",
+                                     SCT_ClusterKey   = "SCT_ClustersCache",
+                                     SpacePointCachePix = "PixelSpacePointCache",
+                                     SpacePointCacheSCT   = "SctSpacePointCache",
+                                     SCTRDOCacheKey       = "SctRDOCache",
+                                     PixRDOCacheKey = "PixRDOCache",
+                                     OutputLevel=DEBUG)
+viewSeq += InDetCacheCreatorTrigViews
 
-from InDetRecExample.InDetKeys import InDetKeys
+# View maker alg
+viewNodeName = "allViewAlgorithms"
+viewMaker = CfgMgr.AthViews__RoiCollectionToViews("viewMaker")
+viewMaker.ViewBaseName = "testView"
+viewMaker.InputRoICollection = "EMRoIs"
+viewMaker.ViewNodeName = viewNodeName
+viewMaker.OutputRoICollection = "EMViewRoIs"
+viewMaker.ViewFallThrough = True
+viewSeq += viewMaker
+
+# Set of view algs
+allViewAlgorithms = AthSequencer(viewNodeName, Sequential=False, ModeOR=False, StopOverride=False)
+viewSeq += allViewAlgorithms
 
 
-allViewAlgorithms = None
-if viewTest:
-  allViewAlgorithms = topSequence.allViewAlgorithms
+from InDetRecExample.InDetKeys import InDetKeys
 
 
 
@@ -82,17 +97,10 @@ if TriggerFlags.doID:
                                                      ProviderTool = InDetPixelRawDataProviderTool,
                                                      OutputLevel = INFO)
     
-    if ( viewTest ):
-      allViewAlgorithms += InDetPixelRawDataProvider
-      allViewAlgorithms.InDetPixelRawDataProvider.isRoI_Seeded = True
-      allViewAlgorithms.InDetPixelRawDataProvider.RoIs = "EMViewRoIs"
-      allViewAlgorithms.InDetPixelRawDataProvider.RDOCacheKey = InDetCacheCreatorTrigViews.PixRDOCacheKey
-      svcMgr.ViewAlgPool.TopAlg += [ "InDetPixelRawDataProvider" ]
-      AthViewSeq.viewMaker.AlgorithmNameSequence += [ "InDetPixelRawDataProvider" ]
-    else:
-      topSequence += InDetPixelRawDataProvider
-      topSequence.InDetPixelRawDataProvider.isRoI_Seeded = True
-      topSequence.InDetPixelRawDataProvider.RoIs = "EMRoIs"
+    allViewAlgorithms += InDetPixelRawDataProvider
+    allViewAlgorithms.InDetPixelRawDataProvider.isRoI_Seeded = True
+    allViewAlgorithms.InDetPixelRawDataProvider.RoIs = "EMViewRoIs"
+    allViewAlgorithms.InDetPixelRawDataProvider.RDOCacheKey = InDetCacheCreatorTrigViews.PixRDOCacheKey
     
     
     if (InDetFlags.doPrintConfigurables()):
@@ -119,17 +127,10 @@ if TriggerFlags.doID:
                                                 ProviderTool = InDetSCTRawDataProviderTool,
                                                 OutputLevel = INFO)
     
-    if ( viewTest ):
-      allViewAlgorithms += InDetSCTRawDataProvider
-      allViewAlgorithms.InDetSCTRawDataProvider.isRoI_Seeded = True
-      allViewAlgorithms.InDetSCTRawDataProvider.RoIs = "EMViewRoIs"
-      allViewAlgorithms.InDetSCTRawDataProvider.RDOCacheKey = InDetCacheCreatorTrigViews.SCTRDOCacheKey
-      svcMgr.ViewAlgPool.TopAlg += [ "InDetSCTRawDataProvider" ]
-      AthViewSeq.viewMaker.AlgorithmNameSequence += [ "InDetSCTRawDataProvider" ]
-    else:
-      topSequence += InDetSCTRawDataProvider
-      topSequence.InDetSCTRawDataProvider.isRoI_Seeded = True
-      topSequence.InDetSCTRawDataProvider.RoIs = "EMRoIs"
+    allViewAlgorithms += InDetSCTRawDataProvider
+    allViewAlgorithms.InDetSCTRawDataProvider.isRoI_Seeded = True
+    allViewAlgorithms.InDetSCTRawDataProvider.RoIs = "EMViewRoIs"
+    allViewAlgorithms.InDetSCTRawDataProvider.RDOCacheKey = InDetCacheCreatorTrigViews.SCTRDOCacheKey
     
     
     #TRT
@@ -158,16 +159,9 @@ if TriggerFlags.doID:
                                                  RDOKey       = "TRT_RDOs",
                                                   ProviderTool = InDetTRTRawDataProviderTool)
     
-    if ( viewTest ):
-      allViewAlgorithms += InDetTRTRawDataProvider
-      allViewAlgorithms.InDetTRTRawDataProvider.isRoI_Seeded = True
-      allViewAlgorithms.InDetTRTRawDataProvider.RoIs = "EMViewRoIs"
-      svcMgr.ViewAlgPool.TopAlg += [ "InDetTRTRawDataProvider" ]
-      AthViewSeq.viewMaker.AlgorithmNameSequence += [ "InDetTRTRawDataProvider" ]
-    else:
-      topSequence += InDetTRTRawDataProvider
-      topSequence.InDetTRTRawDataProvider.isRoI_Seeded = True
-      topSequence.InDetTRTRawDataProvider.RoIs = "EMRoIs"
+    allViewAlgorithms += InDetTRTRawDataProvider
+    allViewAlgorithms.InDetTRTRawDataProvider.isRoI_Seeded = True
+    allViewAlgorithms.InDetTRTRawDataProvider.RoIs = "EMViewRoIs"
   
   
   #Pixel clusterisation
@@ -202,17 +196,10 @@ if TriggerFlags.doID:
                                                         DetectorManagerName     = InDetKeys.PixelManager(),
                                                         DataObjectName          = InDetKeys.PixelRDOs(),
                                                         ClustersName            = "PixelTrigClusters", OutputLevel = INFO)
-  if ( viewTest ):
-    allViewAlgorithms += InDetPixelClusterization
-    allViewAlgorithms.InDetPixelClusterization.isRoI_Seeded = True
-    allViewAlgorithms.InDetPixelClusterization.RoIs = "EMViewRoIs"
-    allViewAlgorithms.InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.Pixel_ClusterKey 
-    svcMgr.ViewAlgPool.TopAlg += [ "InDetPixelClusterization" ]
-    AthViewSeq.viewMaker.AlgorithmNameSequence += [ "InDetPixelClusterization" ]
-  else:
-    topSequence += InDetPixelClusterization
-    topSequence.InDetPixelClusterization.isRoI_Seeded = True
-    topSequence.InDetPixelClusterization.RoIs = "EMRoIs"
+  allViewAlgorithms += InDetPixelClusterization
+  allViewAlgorithms.InDetPixelClusterization.isRoI_Seeded = True
+  allViewAlgorithms.InDetPixelClusterization.RoIs = "EMViewRoIs"
+  allViewAlgorithms.InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.Pixel_ClusterKey 
   
   
   
@@ -236,17 +223,10 @@ if TriggerFlags.doID:
                                                       conditionsService       = InDetSCT_ConditionsSummarySvc,
                                                       FlaggedConditionService = InDetSCT_FlaggedConditionSvc, OutputLevel = INFO)
   
-  if ( viewTest ):
-    allViewAlgorithms += InDetSCT_Clusterization
-    allViewAlgorithms.InDetSCT_Clusterization.isRoI_Seeded = True
-    allViewAlgorithms.InDetSCT_Clusterization.RoIs = "EMViewRoIs"
-    allViewAlgorithms.InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.SCT_ClusterKey 
-    svcMgr.ViewAlgPool.TopAlg += [ "InDetSCT_Clusterization" ]
-    AthViewSeq.viewMaker.AlgorithmNameSequence += [ "InDetSCT_Clusterization" ]
-  else:
-    topSequence += InDetSCT_Clusterization
-    topSequence.InDetSCT_Clusterization.isRoI_Seeded = True
-    topSequence.InDetSCT_Clusterization.RoIs = "EMRoIs"
+  allViewAlgorithms += InDetSCT_Clusterization
+  allViewAlgorithms.InDetSCT_Clusterization.isRoI_Seeded = True
+  allViewAlgorithms.InDetSCT_Clusterization.RoIs = "EMViewRoIs"
+  allViewAlgorithms.InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.SCT_ClusterKey 
   
   
   #Space points and FTF
@@ -272,19 +252,12 @@ if TriggerFlags.doID:
   from TrigFastTrackFinder.TrigFastTrackFinder_Config import TrigFastTrackFinder_eGamma
   theFTF = TrigFastTrackFinder_eGamma()
   
-  if ( viewTest ):
-    allViewAlgorithms += InDetSiTrackerSpacePointFinder
-    allViewAlgorithms += theFTF
-    allViewAlgorithms.TrigFastTrackFinder_eGamma.isRoI_Seeded = True
-    allViewAlgorithms.TrigFastTrackFinder_eGamma.RoIs = "EMViewRoIs"
-    svcMgr.ViewAlgPool.TopAlg += [ "InDetSiTrackerSpacePointFinder", "TrigFastTrackFinder_eGamma" ]
-    AthViewSeq.viewMaker.AlgorithmNameSequence += [ "InDetSiTrackerSpacePointFinder", "TrigFastTrackFinder_eGamma" ]
-    InDetSiTrackerSpacePointFinder.SpacePointCacheSCT = InDetCacheCreatorTrigViews.SpacePointCacheSCT
-    InDetSiTrackerSpacePointFinder.SpacePointCachePix = InDetCacheCreatorTrigViews.SpacePointCachePix
-  else:
-    topSequence += InDetSiTrackerSpacePointFinder
-    theFTF.RoIs = "EMRoIs"
-    topSequence += theFTF
+  allViewAlgorithms += InDetSiTrackerSpacePointFinder
+  allViewAlgorithms += theFTF
+  allViewAlgorithms.TrigFastTrackFinder_eGamma.isRoI_Seeded = True
+  allViewAlgorithms.TrigFastTrackFinder_eGamma.RoIs = "EMViewRoIs"
+  InDetSiTrackerSpacePointFinder.SpacePointCacheSCT = InDetCacheCreatorTrigViews.SpacePointCacheSCT
+  InDetSiTrackerSpacePointFinder.SpacePointCachePix = InDetCacheCreatorTrigViews.SpacePointCachePix
 
 if TriggerFlags.doCalo:
   svcMgr.ToolSvc.TrigDataAccess.ApplyOffsetCorrection=False
@@ -294,12 +267,6 @@ if TriggerFlags.doCalo:
   algo.OutputLevel=VERBOSE
   #TopHLTSeq += algo
 
-  if ( viewTest ):
-    algo.RoIs="EMViewRoIs"
-    allViewAlgorithms += algo
-    svcMgr.ViewAlgPool.TopAlg += [ "testFastAlgo" ]
-    AthViewSeq.viewMaker.AlgorithmNameSequence += [ "testFastAlgo" ]
-  else:
-    algo.RoIs="EMRoIs"
-    topSequence += algo
+  algo.RoIs="EMViewRoIs"
+  allViewAlgorithms += algo
 
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
index 62aea32fb1e..5278f7c1a2f 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
@@ -27,13 +27,9 @@ InDetFlags.init()
 # PixelLorentzAngleSvc and SCTLorentzAngleSvc
 include("InDetRecExample/InDetRecConditionsAccess.py")
 
-viewTest = opt.enableViews   # from testHLT_MT.py
 from AthenaCommon.AlgSequence import AlgSequence
 topSequence = AlgSequence()
-AthViewSeq = None
-if viewTest:
-  allViewAlgorithms = topSequence.allViewAlgorithms
-  AthViewSeq = topSequence.AthViewSeq
+
 
 from InDetRecExample.InDetKeys import InDetKeys
 
@@ -55,52 +51,64 @@ from AthenaCommon.CFElements import parOR, seqOR, seqAND, stepSeq
 from DecisionHandling.DecisionHandlingConf import RoRSeqFilter, DumpDecisions
 
 from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
-if viewTest:
-  filterL1RoIsAlg = RoRSeqFilter("filterL1RoIsAlg")
-  filterL1RoIsAlg.Input = ["EMRoIDecisions"]
-  filterL1RoIsAlg.Output = ["FilteredEMRoIDecisions"]
-  filterL1RoIsAlg.Chains = testChains
-  filterL1RoIsAlg.OutputLevel = DEBUG
+
+fastCaloInViewAlgs = seqAND("fastCaloInViewAlgs", [ theFastCaloAlgo ])
+
+
+filterL1RoIsAlg = RoRSeqFilter("filterL1RoIsAlg")
+filterL1RoIsAlg.Input = ["EMRoIDecisions"]
+filterL1RoIsAlg.Output = ["FilteredEMRoIDecisions"]
+filterL1RoIsAlg.Chains = testChains
+filterL1RoIsAlg.OutputLevel = DEBUG
+
+
   
-  allViewAlgorithms += theFastCaloAlgo
-  svcMgr.ViewAlgPool.TopAlg += [ theFastCaloAlgo.getName() ]
-  l2CaloViewsMaker = EventViewCreatorAlgorithm("l2CaloViewsMaker", OutputLevel=DEBUG)
-  l2CaloViewsMaker.ViewFallThrough = True
-  l2CaloViewsMaker.Decisions = "FilteredEMRoIDecisions" # from EMRoIsUnpackingTool
-  l2CaloViewsMaker.RoIsLink = "initialRoI" # -||-
-  l2CaloViewsMaker.InViewRoIs = "EMCaloRoIs" # contract with the fastCalo
-  l2CaloViewsMaker.Views = "EMCaloViews"
-  l2CaloViewsMaker.AlgorithmNameSequence = [ theFastCaloAlgo.getName() ]
-  theFastCaloAlgo.RoIs = l2CaloViewsMaker.InViewRoIs
-
-
-  from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlg
-  from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromName
-  theFastCaloHypo = TrigL2CaloHypoAlg("L2CaloHypo")
-  theFastCaloHypo.OutputLevel = DEBUG
-  theFastCaloHypo.L1Decisions = "EMRoIDecisions"
-  theFastCaloHypo.Views = l2CaloViewsMaker.Views
-  theFastCaloHypo.CaloClusters = theFastCaloAlgo.ClustersName
-  theFastCaloHypo.RoIs = l2CaloViewsMaker.InViewRoIs
-  theFastCaloHypo.Decisions = "EgammaCaloDecisions"
-  theFastCaloHypo.HypoTools =  [ TrigL2CaloHypoToolFromName( c ) for c in testChains ]
-#[ TrigL2CaloHypoToolFromName("HLT_e5_etcut"),   TrigL2CaloHypoToolFromName("HLT_e7_etcut") , TrigL2CaloHypoToolFromName("HLT_2e3_etcut"), TrigL2CaloHypoToolFromName("HLT_e3e5_etcut") ]
 
-  for t in theFastCaloHypo.HypoTools:
-    t.OutputLevel = DEBUG
 
-  # topSequence += theFastCaloHypo
+fastCaloViewsMaker = EventViewCreatorAlgorithm("fastCaloViewsMaker", OutputLevel=DEBUG)
+fastCaloViewsMaker.ViewFallThrough = True
+fastCaloViewsMaker.Decisions = "FilteredEMRoIDecisions" # from EMRoIsUnpackingTool
+fastCaloViewsMaker.RoIsLink = "initialRoI" # -||-
+fastCaloViewsMaker.InViewRoIs = "EMCaloRoIs" # contract with the fastCalo
+fastCaloViewsMaker.Views = "EMCaloViews"
+fastCaloViewsMaker.ViewNodeName = "fastCaloInViewAlgs"
+theFastCaloAlgo.RoIs = fastCaloViewsMaker.InViewRoIs
 
-  caloDecisionsDumper = DumpDecisions("caloDecisionsDumper", OutputLevel=DEBUG, Decisions = theFastCaloHypo.Decisions )  
 
-  egammaCaloStep = stepSeq("egammaCaloStep", filterL1RoIsAlg, [ l2CaloViewsMaker, theFastCaloHypo, caloDecisionsDumper ])
 
-else:
-  topSequence += theFastCaloAlgo
+from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlg
+from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromName
+theFastCaloHypo = TrigL2CaloHypoAlg("L2CaloHypo")
+theFastCaloHypo.OutputLevel = DEBUG
+theFastCaloHypo.L1Decisions = "EMRoIDecisions"
+theFastCaloHypo.Views = fastCaloViewsMaker.Views
+theFastCaloHypo.CaloClusters = theFastCaloAlgo.ClustersName
+theFastCaloHypo.RoIs = fastCaloViewsMaker.InViewRoIs
+theFastCaloHypo.Decisions = "EgammaCaloDecisions"
+theFastCaloHypo.HypoTools =  [ TrigL2CaloHypoToolFromName( c ) for c in testChains ]
+#[ TrigL2CaloHypoToolFromName("HLT_e5_etcut"),   TrigL2CaloHypoToolFromName("HLT_e7_etcut") , TrigL2CaloHypoToolFromName("HLT_2e3_etcut"), TrigL2CaloHypoToolFromName("HLT_e3e5_etcut") ]
 
+for t in theFastCaloHypo.HypoTools:
+  t.OutputLevel = DEBUG
+  
+# topSequence += theFastCaloHypo
 
-InDetCacheCreatorTrigViews = topSequence.AthViewSeq.InDetCacheCreatorTrigViews
+caloDecisionsDumper = DumpDecisions("caloDecisionsDumper", OutputLevel=DEBUG, Decisions = theFastCaloHypo.Decisions )  
 
+fastCaloSequence = seqAND("fastCaloSequence", [fastCaloViewsMaker, fastCaloInViewAlgs, theFastCaloHypo ])
+  
+egammaCaloStep = stepSeq("egammaCaloStep", filterL1RoIsAlg, [ fastCaloSequence,  caloDecisionsDumper ])
+
+
+from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__CacheCreator
+InDetCacheCreatorTrigViews = InDet__CacheCreator(name = "InDetCacheCreatorTrigViews",
+                                                 Pixel_ClusterKey = "PixelTrigClustersCache",
+                                                 SCT_ClusterKey   = "SCT_ClustersCache",
+                                                 SpacePointCachePix = "PixelSpacePointCache",
+                                                 SpacePointCacheSCT   = "SctSpacePointCache",
+                                                 SCTRDOCacheKey       = "SctRDOCache",
+                                                 PixRDOCacheKey = "PixRDOCache",
+                                                 OutputLevel=DEBUG)
 #Pixel
 
 from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRodDecoder
@@ -209,8 +217,8 @@ InDetPixelClusterization = InDet__PixelClusterization(name                    =
                                                       ClustersName            = "PixelTrigClusters",
                                                       isRoI_Seeded            = True)
 
-if viewTest:
-   InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.Pixel_ClusterKey
+
+InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.Pixel_ClusterKey
 
 #
 # --- SCT_ClusteringTool (public)
@@ -233,8 +241,8 @@ InDetSCT_Clusterization = InDet__SCT_Clusterization(name                    = "I
                                                     FlaggedConditionService = InDetSCT_FlaggedConditionSvc, 
                                                     isRoI_Seeded            = True )
 
-if viewTest:
-   InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.SCT_ClusterKey
+
+InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.SCT_ClusterKey
 
 #Space points and FTF
 
@@ -254,14 +262,19 @@ InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name
                                                                   ProcessSCTs            = DetFlags.haveRIO.SCT_on(),
                                                                   ProcessOverlaps        = DetFlags.haveRIO.SCT_on(),
                                                                   OutputLevel=DEBUG)
-if viewTest:
-   InDetSiTrackerSpacePointFinder.SpacePointCacheSCT = InDetCacheCreatorTrigViews.SpacePointCacheSCT
-   InDetSiTrackerSpacePointFinder.SpacePointCachePix = InDetCacheCreatorTrigViews.SpacePointCachePix
+
+InDetSiTrackerSpacePointFinder.SpacePointCacheSCT = InDetCacheCreatorTrigViews.SpacePointCacheSCT
+InDetSiTrackerSpacePointFinder.SpacePointCachePix = InDetCacheCreatorTrigViews.SpacePointCachePix
 
 from TrigFastTrackFinder.TrigFastTrackFinder_Config import TrigFastTrackFinder_eGamma
 theFTF = TrigFastTrackFinder_eGamma()
 theFTF.OutputLevel = DEBUG
 
+# A simple algorithm to confirm that data has been inherited from parent view
+# Required to satisfy data dependencies
+ViewVerify = CfgMgr.AthViews__ViewDataVerifier("electronViewDataVerifier")
+ViewVerify.DataObjects = [('xAOD::TrigEMClusterContainer','StoreGateSvc+L2CaloClusters')]
+
 from TrigInDetConf.TrigInDetRecCommonTools import InDetTrigFastTrackSummaryTool
 from TrigInDetConf.TrigInDetPostTools import  InDetTrigParticleCreatorToolFTF
 
@@ -272,7 +285,10 @@ theTrackParticleCreatorAlg = InDet__TrigTrackingxAODCnvMT(name = "InDetTrigTrack
                                                          TrackParticlesName = "xAODTracks",
                                                          ParticleCreatorTool = InDetTrigParticleCreatorToolFTF)
 
-IDSequence = [ InDetPixelRawDataProvider, InDetSCTRawDataProvider, InDetTRTRawDataProvider, InDetPixelClusterization, InDetSCT_Clusterization, InDetSiTrackerSpacePointFinder, theFTF, theTrackParticleCreatorAlg ]
+IDSequence = [  InDetPixelRawDataProvider, InDetSCTRawDataProvider, InDetTRTRawDataProvider, InDetPixelClusterization, InDetSCT_Clusterization, InDetSiTrackerSpacePointFinder, theFTF, ViewVerify, theTrackParticleCreatorAlg ]
+
+
+
 
 
 from TrigEgammaHypo.TrigL2ElectronFexMTConfig import L2ElectronFex_1
@@ -283,57 +299,52 @@ theElectronFex.ElectronsName="Electrons"
 theElectronFex.OutputLevel=VERBOSE
 
 
-if viewTest:
-  filterCaloRoIsAlg = RoRSeqFilter("filterCaloRoIsAlg")
-  filterCaloRoIsAlg.Input = [theFastCaloHypo.Decisions]
-  filterCaloRoIsAlg.Output = ["Filtered"+theFastCaloHypo.Decisions]
-  filterCaloRoIsAlg.Chains = testChains
-  filterCaloRoIsAlg.OutputLevel = DEBUG
-
-
-  l2ElectronViewsMaker = EventViewCreatorAlgorithm("l2ElectronViewsMaker", OutputLevel=DEBUG)
-  # topSequence += l2ElectronViewsMaker
-  l2ElectronViewsMaker.Decisions = filterCaloRoIsAlg.Output[0] # output of L2CaloHypo
-  l2ElectronViewsMaker.RoIsLink = "roi" # -||-
-  l2ElectronViewsMaker.InViewRoIs = "EMIDRoIs" # contract with the fastCalo
-  l2ElectronViewsMaker.Views = "EMElectronViews"
-  l2ElectronViewsMaker.ViewFallThrough = True
-
-  theTrackParticleCreatorAlg.roiCollectionName = l2ElectronViewsMaker.InViewRoIs
-  for idAlg in IDSequence:
-    if idAlg.properties().has_key("RoIs"):
-      idAlg.RoIs = l2ElectronViewsMaker.InViewRoIs
-
-    allViewAlgorithms += idAlg
-    svcMgr.ViewAlgPool.TopAlg += [ idAlg.getName() ]
-    l2ElectronViewsMaker.AlgorithmNameSequence += [ idAlg.getName() ]    
-
-
-  theElectronFex.RoIs = l2ElectronViewsMaker.InViewRoIs
-  allViewAlgorithms += theElectronFex
-  svcMgr.ViewAlgPool.TopAlg += [ theElectronFex.getName() ]
-  l2ElectronViewsMaker.AlgorithmNameSequence += [ theElectronFex.getName() ]    
-
-
-  from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2ElectronHypoAlg
-  from TrigEgammaHypo.TrigL2ElectronHypoTool import TrigL2ElectronHypoToolFromName
-  theElectronHypo = TrigL2ElectronHypoAlg()
-  theElectronHypo.Views = l2ElectronViewsMaker.Views
-  theElectronHypo.Electrons = theElectronFex.ElectronsName
-  theElectronHypo.ClusterDecisions = theFastCaloHypo.Decisions 
-  theElectronHypo.ElectronDecisions = "ElectronL2Decisions"
-  theElectronHypo.OutputLevel = VERBOSE
-  theElectronHypo.HypoTools = [ TrigL2ElectronHypoToolFromName( c ) for c in testChains ]
-
-  for t in theElectronHypo.HypoTools:
-    t.OutputLevel = VERBOSE
-  # topSequence += theElectronHypo
-  electronDecisionsDumper = DumpDecisions("electronDecisionsDumper", OutputLevel=DEBUG, Decisions = theElectronHypo.ElectronDecisions )    
-  egammaIDStep = stepSeq("egammaIDStep", filterCaloRoIsAlg, [ l2ElectronViewsMaker, theElectronHypo, electronDecisionsDumper ] )
-
-else:
-  # ID algs can't run w/o views yet
-  pass
+
+filterCaloRoIsAlg = RoRSeqFilter("filterCaloRoIsAlg")
+filterCaloRoIsAlg.Input = [theFastCaloHypo.Decisions]
+filterCaloRoIsAlg.Output = ["Filtered"+theFastCaloHypo.Decisions]
+filterCaloRoIsAlg.Chains = testChains
+filterCaloRoIsAlg.OutputLevel = DEBUG
+
+
+l2ElectronViewsMaker = EventViewCreatorAlgorithm("l2ElectronViewsMaker", OutputLevel=DEBUG)
+# topSequence += l2ElectronViewsMaker
+l2ElectronViewsMaker.Decisions = filterCaloRoIsAlg.Output[0] # output of L2CaloHypo
+l2ElectronViewsMaker.RoIsLink = "roi" # -||-
+l2ElectronViewsMaker.InViewRoIs = "EMIDRoIs" # contract with the fastCalo
+l2ElectronViewsMaker.Views = "EMElectronViews"
+l2ElectronViewsMaker.ViewFallThrough = True
+
+
+theTrackParticleCreatorAlg.roiCollectionName = l2ElectronViewsMaker.InViewRoIs
+for idAlg in IDSequence:
+  if idAlg.properties().has_key("RoIs"):
+    idAlg.RoIs = l2ElectronViewsMaker.InViewRoIs
+theElectronFex.RoIs = l2ElectronViewsMaker.InViewRoIs    
+
+electronInViewAlgs = parOR("electronInViewAlgs", IDSequence + [ theElectronFex ])
+
+l2ElectronViewsMaker.ViewNodeName = "electronInViewAlgs"
+
+
+from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2ElectronHypoAlg
+from TrigEgammaHypo.TrigL2ElectronHypoTool import TrigL2ElectronHypoToolFromName
+theElectronHypo = TrigL2ElectronHypoAlg()
+theElectronHypo.Views = l2ElectronViewsMaker.Views
+theElectronHypo.Electrons = theElectronFex.ElectronsName
+theElectronHypo.ClusterDecisions = theFastCaloHypo.Decisions 
+theElectronHypo.ElectronDecisions = "ElectronL2Decisions"
+theElectronHypo.OutputLevel = VERBOSE
+theElectronHypo.HypoTools = [ TrigL2ElectronHypoToolFromName( c ) for c in testChains ]
+
+for t in theElectronHypo.HypoTools:
+  t.OutputLevel = VERBOSE
+# topSequence += theElectronHypo
+# InDetCacheCreatorTrigViews,
+electronSequence = seqAND("electronSequence", [ InDetCacheCreatorTrigViews, l2ElectronViewsMaker, electronInViewAlgs, theElectronHypo ] )
+
+electronDecisionsDumper = DumpDecisions("electronDecisionsDumper", OutputLevel=DEBUG, Decisions = theElectronHypo.ElectronDecisions )    
+egammaIDStep = stepSeq("egammaIDStep", filterCaloRoIsAlg, [ electronSequence,  electronDecisionsDumper ] )
 
 
 # CF construction
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py
index ef8a0648c6c..2efa5c2ee2f 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py
@@ -6,23 +6,28 @@
   
 include("TrigUpgradeTest/testHLT_MT.py") 
 
-viewTest = opt.enableViews   # from testHLT_MT.py
 from AthenaCommon.AlgSequence import AlgSequence
 topSequence = AlgSequence()
-if viewTest:
-  allViewAlgorithms = topSequence.allViewAlgorithms
 
-# provide a minimal menu information
-topSequence.L1DecoderTest.ctpUnpacker.OutputLevel=DEBUG
-topSequence.L1DecoderTest.roiUnpackers[0].OutputLevel=DEBUG
-topSequence.L1DecoderTest.roiUnpackers[1].OutputLevel=DEBUG
+### If inputFile is BS(ByteStream), the bool is true. ###
+isData = False 
+if globalflags.InputFormat.is_bytestream():
+  isData = True
+
+### provide a minimal menu information ###
+if isData:
+  topSequence.L1DecoderTest.ctpUnpacker.OutputLevel=DEBUG
+  topSequence.L1DecoderTest.roiUnpackers[0].OutputLevel=DEBUG
+  topSequence.L1DecoderTest.roiUnpackers[1].OutputLevel=DEBUG
+else:
+  pass
  
-# for Desplaying StoreGate Dump
+### for Desplaying StoreGate Dump ###
 from AthenaCommon.AppMgr import ServiceMgr
 ServiceMgr.StoreGateSvc=Service("StoreGateSvc") 
 ServiceMgr.StoreGateSvc.Dump=True 
  
-# for Control Flow
+### for Control Flow ###
 from AthenaCommon.CFElements import parOR, seqAND, seqOR, stepSeq
  
 from AthenaCommon.AlgScheduler import AlgScheduler
@@ -30,6 +35,14 @@ AlgScheduler.CheckDependencies( True )
 AlgScheduler.OutputLevel( DEBUG )
 AlgScheduler.ShowDataDependencies( True )
 AlgScheduler.setDataLoaderAlg( 'SGInputLoader' )
+
+
+from AthenaCommon.CfgGetter import getPublicTool, getPublicToolClone
+from AthenaCommon import CfgMgr
+
+doL2SA=True
+domuComb=False
+doEFSA=False
  
 if TriggerFlags.doMuon:
 # ==================================================================================================================================
@@ -37,48 +50,298 @@ if TriggerFlags.doMuon:
 # ==================================================================================================================================
   # Load data from Muon detectors
   #topSequence.SGInputLoader.Load = [ ('MdtCsmContainer','MDTCSM'), ('RpcPadContainer','RPCPAD'), ('TgcRdoContainer','TGCRDO'), ('CscRawDataContainer','CSCRDO')]
+  import MuonRecExample.MuonRecStandaloneOnlySetup
+  from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
+  muonRecFlags.doTrackPerformance    = True
+  muonRecFlags.TrackPerfSummaryLevel = 2
+  muonRecFlags.TrackPerfDebugLevel   = 5
+  muonRecFlags.doCSCs                = True
+  muonRecFlags.doNSWNewThirdChain    = False
+  muonCombinedRecFlags.doCaloTrkMuId = False
+  muonCombinedRecFlags.printSummary = False
+  from RecExConfig.RecFlags import rec
+
+  if doL2SA:
+    from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+    l2MuViewNode = AthSequencer("l2MuViewNode", Sequential=False, ModeOR=False, StopOverride=False)
+    l2MuViewsMaker = EventViewCreatorAlgorithm("l2MuViewsMaker", OutputLevel=DEBUG)
+    l2MuViewsMaker.ViewFallThrough = True
  
-  from AthenaCommon.CfgGetter import getAlgorithm
-  if muonRecFlags.doCSCs():
-    CscDecoder = getAlgorithm("CscRdoToCscPrepData", tryDefaultConfigurable=True)
-    CscDecoder.DoSeededDecoding=True
-    CscDecoder.RoIs="MURoIs"
-    topSequence += CscDecoder
- 
-  if muonRecFlags.doMDTs():
-    MdtDecoder = getAlgorithm("MdtRdoToMdtPrepData", tryDefaultConfigurable=True)
-    MdtDecoder.DoSeededDecoding=True
-    MdtDecoder.RoIs="MURoIs"
-    topSequence += MdtDecoder
- 
-  if muonRecFlags.doRPCs():
-    RpcDecoder = getAlgorithm("RpcRdoToRpcPrepData", tryDefaultConfigurable=True)
-    RpcDecoder.DoSeededDecoding=True
-    RpcDecoder.RoIs="MURoIs"
-    topSequence += RpcDecoder
-
-  if muonRecFlags.doTGCs():
-    TgcDecoder = getAlgorithm("TgcRdoToTgcPrepData", tryDefaultConfigurable=True)
-    TgcDecoder.DoSeededDecoding=True
-    TgcDecoder.RoIs="MURoIs"
-    topSequence += TgcDecoder
+    l2MuViewsMaker.Decisions = "MURoIDecisions"
+    l2MuViewsMaker.RoIsLink = "initialRoI" # -||-
+    l2MuViewsMaker.InViewRoIs = "MURoIs" # contract with the consumer
+    l2MuViewsMaker.Views = "MUViewRoIs"
+    l2MuViewsMaker.ViewNodeName = l2MuViewNode.name()
+
+  if doL2SA or doEFSA:
+    ### ==================== Input=BSfile ==================== ###
+    if isData:
+      ### CSC RDO date ###
+      if muonRecFlags.doCSCs():
+        from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscROD_Decoder
+        CSCRodDecoder = Muon__CscROD_Decoder(name		= "CSCRodDecoder",
+                                             IsCosmics		= False,
+                                             IsOldCosmics 	= False,
+                                             OutputLevel 	= INFO )
+        ToolSvc += CSCRodDecoder
+  
+        from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CSC_RawDataProviderTool
+        MuonCscRawDataProviderTool = Muon__CSC_RawDataProviderTool(name        = "MuonCscRawDataProviderTool",
+                                                                   Decoder     = ToolSvc.CSCRodDecoder,
+                                                                   OutputLevel = INFO )
+        ToolSvc += MuonCscRawDataProviderTool
+  
+        from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscRdoToCscPrepDataTool
+        CscRdoToCscPrepDataTool = Muon__CscRdoToCscPrepDataTool(name                = "CscRdoToPrepDataTool",
+                                                                OutputLevel         = INFO,
+                                                                RawDataProviderTool = MuonCscRawDataProviderTool,
+                                                                useBStoRdoTool	    = True)
+        ToolSvc += CscRdoToCscPrepDataTool
+  
+        from MuonRdoToPrepData.MuonRdoToPrepDataConf import CscRdoToCscPrepData
+        CscRdoToCscPrepData = CscRdoToCscPrepData(name                    = "CscRdoToCscPrepDataProvider",
+                                                  CscRdoToCscPrepDataTool = CscRdoToCscPrepDataTool,
+                                                  PrintPrepData	    	  = False,
+                                                  OutputLevel             = INFO)
+        CscRdoToCscPrepData.DoSeededDecoding = True
+        CscRdoToCscPrepData.RoIs = "MUViewRoIs"
+   
+        from MuonByteStream.MuonByteStreamConf import Muon__CscRawDataProvider
+        CscRawDataProvider = Muon__CscRawDataProvider(name         = "CscRawDataProvider",
+                                                      ProviderTool = MuonCscRawDataProviderTool,
+                                                      OutputLevel  = INFO)
+        l2MuViewNode += CscRawDataProvider  
+   
+      ### MDT RDO date ###
+      if muonRecFlags.doMDTs():
+        from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import MdtROD_Decoder
+        MDTRodDecoder = MdtROD_Decoder(name	   = "MDTRodDecoder",
+                                       OutputLevel = INFO )
+        ToolSvc += MDTRodDecoder
+  
+        from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MDT_RawDataProviderTool
+        MuonMdtRawDataProviderTool = Muon__MDT_RawDataProviderTool(name        = "MuonMdtRawDataProviderTool",
+                                                                   Decoder     = ToolSvc.MDTRodDecoder,
+                                                                   OutputLevel = INFO )
+        ToolSvc += MuonMdtRawDataProviderTool
+  
+        from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MdtRdoToPrepDataTool
+        MdtRdoToMdtPrepDataTool = Muon__MdtRdoToPrepDataTool(name                = "MdtRdoToPrepDataTool",
+                                                             OutputLevel         = INFO,
+                                                             RawDataProviderTool = MuonMdtRawDataProviderTool,
+                                                             useBStoRdoTool      = True)
+        ToolSvc += MdtRdoToMdtPrepDataTool
+  
+        from MuonRdoToPrepData.MuonRdoToPrepDataConf import MdtRdoToMdtPrepData
+        MdtRdoToMdtPrepData = MdtRdoToMdtPrepData(name          = "MdtRdoToMdtPrepDataProvider",
+                                                  DecodingTool  = MdtRdoToMdtPrepDataTool,
+                                                  PrintPrepData = False,
+                                                  OutputLevel   = INFO)  
+        MdtRdoToMdtPrepData.DoSeededDecoding = True
+        MdtRdoToMdtPrepData.RoIs = "MUViewRoIs"
+  
+        from MuonByteStream.MuonByteStreamConf import Muon__MdtRawDataProvider
+        MdtRawDataProvider = Muon__MdtRawDataProvider(name         = "MdtRawDataProvider",
+                                                      ProviderTool = MuonMdtRawDataProviderTool,
+                                                      OutputLevel  = INFO)
+        l2MuViewNode += MdtRawDataProvider 
+  
+      ### RPC RDO date ###
+      if muonRecFlags.doRPCs():
+        from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcROD_Decoder
+        RPCRodDecoder = Muon__RpcROD_Decoder(name	 = "RPCRodDecoder",
+                                             OutputLevel = INFO )
+        ToolSvc += RPCRodDecoder
+  
+        from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RPC_RawDataProviderTool
+        MuonRpcRawDataProviderTool = Muon__RPC_RawDataProviderTool(name    = "MuonRpcRawDataProviderTool",
+                                                                   Decoder = RPCRodDecoder )
+        ToolSvc += MuonRpcRawDataProviderTool
+  
+        from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataTool
+        RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataTool(name                = "RpcRdoToPrepDataTool",
+                                                             OutputLevel         = INFO,
+                                                             RawDataProviderTool = MuonRpcRawDataProviderTool,
+                                                             useBStoRdoTool      = True)
+        ToolSvc += RpcRdoToRpcPrepDataTool
+  
+        from MuonRdoToPrepData.MuonRdoToPrepDataConf import RpcRdoToRpcPrepData
+        RpcRdoToRpcPrepData = RpcRdoToRpcPrepData(name          = "RpcRdoToRpcPrepDataProvider",
+                                                  DecodingTool  = RpcRdoToRpcPrepDataTool,
+                                                  PrintPrepData = False,
+                                                  OutputLevel   = INFO)    
+        RpcRdoToRpcPrepData.DoSeededDecoding = True
+        RpcRdoToRpcPrepData.RoIs = "MUViewRoIs"
+  
+        from MuonByteStream.MuonByteStreamConf import Muon__RpcRawDataProvider
+        RpcRawDataProvider = Muon__RpcRawDataProvider(name         = "RpcRawDataProvider",
+                                                      ProviderTool = MuonRpcRawDataProviderTool,
+                                                      OutputLevel  = INFO)
+        l2MuViewNode += RpcRawDataProvider 
     
-  if muonRecFlags.doCSCs():
-    topSequence += getAlgorithm("CscThresholdClusterBuilder")
+      ### TGC RDO date ###
+      if muonRecFlags.doTGCs():
+        from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TGC_RodDecoderReadout
+        TGCRodDecoder = Muon__TGC_RodDecoderReadout(name		= "TGCRodDecoder",
+                                                    OutputLevel 	= INFO )
+        ToolSvc += TGCRodDecoder
+  
+        from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TGC_RawDataProviderTool
+        MuonTgcRawDataProviderTool = Muon__TGC_RawDataProviderTool(name    = "MuonTgcRawDataProviderTool",
+                                                                   Decoder = TGCRodDecoder )
+        ToolSvc += MuonTgcRawDataProviderTool
+        
+        from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcRdoToPrepDataTool
+        TgcRdoToTgcPrepDataTool = Muon__TgcRdoToPrepDataTool(name                = "TgcRdoToPrepDataTool",
+                                                             OutputLevel         = INFO,
+                                                             RawDataProviderTool = MuonTgcRawDataProviderTool,
+                                                             useBStoRdoTool      = True)
+        ToolSvc += TgcRdoToTgcPrepDataTool
+  
+        from MuonRdoToPrepData.MuonRdoToPrepDataConf import TgcRdoToTgcPrepData
+        TgcRdoToTgcPrepData = TgcRdoToTgcPrepData(name          = "TgcRdoToTgcPrepDataProvider",
+                                                  DecodingTool  = TgcRdoToTgcPrepDataTool,
+                                                  PrintPrepData = False,
+                                                  OutputLevel   = INFO)
+        TgcRdoToTgcPrepData.DoSeededDecoding = True
+        TgcRdoToTgcPrepData.RoIs = "MUViewRoIs"
+   
+        from MuonByteStream.MuonByteStreamConf import Muon__TgcRawDataProvider
+        TgcRawDataProvider = Muon__TgcRawDataProvider(name         = "TgcRawDataProvider",
+                                                      ProviderTool = MuonTgcRawDataProviderTool,
+                                                      OutputLevel  = INFO)
+        l2MuViewNode += TgcRawDataProvider 
 
-  if muonRecFlags.doCreateClusters():
-    from AthenaCommon.CfgGetter import getPublicTool
-    from AthenaCommon import CfgMgr
-    getPublicTool("MuonClusterizationTool")
-    topSequence += CfgMgr.MuonClusterizationAlg("MuonClusterizationAlg",TgcPrepDataContainer="TGC_MeasurementsAllBCs" )
+    ### ==================== Input=RDOfile ==================== ###
+    else:
+      ### CSC RDO date ###
+      if muonRecFlags.doCSCs():
+        from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscRDO_Decoder
+        CscRdoDecoder = Muon__CscRDO_Decoder(name        = "CscRdoDecoder",
+                                             OutputLevel = INFO)
+        ToolSvc += CscRdoDecoder
+   
+        from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscRdoToCscPrepDataTool
+        CscRdoToCscPrepDataTool = Muon__CscRdoToCscPrepDataTool(name              = "CscRdoToCscPrepDataTool",
+                                                                OutputLevel       = INFO,
+                                                                CscRdoDecoderTool = CscRdoDecoder,
+                                                                useBStoRdoTool	  = False)
+        ToolSvc += CscRdoToCscPrepDataTool
+     
+        from MuonRdoToPrepData.MuonRdoToPrepDataConf import CscRdoToCscPrepData
+        CscRdoToCscPrepData = CscRdoToCscPrepData(name                    = "CscRdoToCscPrepDataProvider",
+                                                  CscRdoToCscPrepDataTool = CscRdoToCscPrepDataTool,
+                                                  PrintPrepData	  	  = False,
+                                                  OutputLevel             = INFO)
+    
+        CscRdoToCscPrepData.DoSeededDecoding = True
+        CscRdoToCscPrepData.RoIs = "MUViewRoIs"
+        l2MuViewNode += CscRdoToCscPrepData 
+      
+      ### MDT RDO date ###
+      if muonRecFlags.doMDTs():
+        from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MdtRDO_Decoder
+        MdtRdoDecoder = Muon__MdtRDO_Decoder(name        = "MdtRdoDecoder",
+                                             OutputLevel = INFO)
+        ToolSvc += MdtRdoDecoder
+   
+        from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MdtRdoToPrepDataTool
+        MdtRdoToMdtPrepDataTool = Muon__MdtRdoToPrepDataTool(name           = "MdtRdoToMdtPrepDataTool",
+                                                             OutputLevel    = INFO,
+                                                             useBStoRdoTool = False)
+        ToolSvc += MdtRdoToMdtPrepDataTool
+     
+        from MuonRdoToPrepData.MuonRdoToPrepDataConf import MdtRdoToMdtPrepData
+        MdtRdoToMdtPrepData = MdtRdoToMdtPrepData(name          = "MdtRdoToMdtPrepDataProvider",
+                                                  DecodingTool  = MdtRdoToMdtPrepDataTool,
+                                                  PrintPrepData = False,
+                                                  OutputLevel   = INFO)
+  
+        MdtRdoToMdtPrepData.DoSeededDecoding = True
+        MdtRdoToMdtPrepData.RoIs = "MUViewRoIs"
+        l2MuViewNode += MdtRdoToMdtPrepData 
+  
+      ### RPC RDO date ###
+      if muonRecFlags.doRPCs():
+        from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRDO_Decoder
+        RpcRdoDecoder = Muon__RpcRDO_Decoder(name        = "RpcRdoDecoder",
+                                             OutputLevel = INFO)
+        ToolSvc += RpcRdoDecoder
+   
+        from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataTool
+        RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataTool(name           = "RpcRdoToRpcPrepDataTool",
+                                                             OutputLevel    = INFO,
+                                                             RdoDecoderTool = RpcRdoDecoder,
+                                                             useBStoRdoTool = False)
+        ToolSvc += RpcRdoToRpcPrepDataTool
+     
+        from MuonRdoToPrepData.MuonRdoToPrepDataConf import RpcRdoToRpcPrepData
+        RpcRdoToRpcPrepData = RpcRdoToRpcPrepData(name          = "RpcRdoToRpcPrepDataProvider",
+                                                  DecodingTool  = RpcRdoToRpcPrepDataTool,
+                                                  PrintPrepData = False,
+                                                  OutputLevel   = INFO)
+      
+        RpcRdoToRpcPrepData.DoSeededDecoding = True
+        RpcRdoToRpcPrepData.RoIs = "MUViewRoIs"
+        l2MuViewNode += RpcRdoToRpcPrepData 
+     
+      ### TGC RDO date ###
+      if muonRecFlags.doTGCs():
+        from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcRDO_Decoder
+        TgcRdoDecoder = Muon__TgcRDO_Decoder(name        = "TgcRdoDecoder",
+                                             OutputLevel = INFO)
+        ToolSvc += TgcRdoDecoder
+   
+        from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcRdoToPrepDataTool
+        TgcRdoToTgcPrepDataTool = Muon__TgcRdoToPrepDataTool(name           = "TgcRdoToTgcPrepDataTool",
+                                                             OutputLevel    = INFO,
+                                                             useBStoRdoTool = False)
+        ToolSvc += TgcRdoToTgcPrepDataTool
+     
+        from MuonRdoToPrepData.MuonRdoToPrepDataConf import TgcRdoToTgcPrepData
+        TgcRdoToTgcPrepData = TgcRdoToTgcPrepData(name          = "TgcRdoToTgcPrepDataProvider",
+                                                  DecodingTool  = TgcRdoToTgcPrepDataTool,
+                                                  PrintPrepData = False,
+                                                  OutputLevel   = INFO)
+      
+        TgcRdoToTgcPrepData.DoSeededDecoding = True
+        TgcRdoToTgcPrepData.RoIs = "MUViewRoIs"
+        l2MuViewNode += TgcRdoToTgcPrepData 
+  
+      ### CSC CscCluster date ###
+      if muonRecFlags.doCSCs():
+        from CscClusterization.CscClusterizationConf import CscThresholdClusterBuilderTool
+        CscClusterBuilderTool = CscThresholdClusterBuilderTool(name        = "CscThesholdClusterBuilderTool",
+                                                               OutputLevel = INFO)
+        ToolSvc += CscClusterBuilderTool
+    
+        from CscClusterization.CscClusterizationConf import CscThresholdClusterBuilder
+        CscClusterBuilder = CscThresholdClusterBuilder(name            = "CscThesholdClusterBuilder",
+                                                       OutputLevel     = INFO,
+                                                       cluster_builder = CscClusterBuilderTool)    
+     
+        l2MuViewNode += CscClusterBuilder 
+    
+      ### TGC TGC_MeasurementsAllBCs date ###
+      if muonRecFlags.doCreateClusters():
+        from MuonClusterization.MuonClusterizationConf import MuonClusterizationTool
+        MuonClusterTool = MuonClusterizationTool(name        = "MuonClusterizationTool",
+                                                 OutputLevel = INFO)
+        ToolSvc += MuonClusterTool
+    
+        from MuonClusterization.MuonClusterizationConf import MuonClusterizationAlg
+        MuonClusterAlg = MuonClusterizationAlg(name                 = "MuonClusterizationAlg",
+                                               OutputLevel          = INFO,
+                                               ClusterTool          = MuonClusterTool,
+                                               TgcPrepDataContainer = "TGC_MeasurementsAllBCs")
+    
+        l2MuViewNode += MuonClusterAlg 
 
-# ==================================================================================================================================
-#               Setup L2MuonSA
-# ==================================================================================================================================
-  # muon thresholds
+
+  ### muon thresholds ###
   testChains = ["HLT_mu6"]
 
-  # set up L1RoIsFilter 
+  ### set up L1RoIsFilter ###
   from DecisionHandling.DecisionHandlingConf import RoRSeqFilter, DumpDecisions
   filterL1RoIsAlg = RoRSeqFilter("filterL1RoIsAlg")
   filterL1RoIsAlg.Input = ["MURoIDecisions"]
@@ -86,26 +349,18 @@ if TriggerFlags.doMuon:
   filterL1RoIsAlg.Chains = testChains
   filterL1RoIsAlg.OutputLevel = DEBUG
 
-  # set up MuFastSteering
-  from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
-  from TrigL2MuonSA.TrigL2MuonSAConfig import TrigL2MuonSAConfig
-  muFastAlg = TrigL2MuonSAConfig("Muon")
-  muFastAlg.OutputLevel = DEBUG
+# ==================================================================================================================================
+#               Setup L2MuonSA
+# ==================================================================================================================================
+  if doL2SA:
+    ### set up MuFastSteering ###
+    from TrigL2MuonSA.TrigL2MuonSAConfig import TrigL2MuonSAConfig
+    muFastAlg = TrigL2MuonSAConfig("Muon")
+    muFastAlg.OutputLevel = DEBUG
 
-  svcMgr.ToolSvc.TrigDataAccess.ApplyOffsetCorrection = False
+    svcMgr.ToolSvc.TrigDataAccess.ApplyOffsetCorrection = False
 
-  if viewTest:
-    allViewAlgorithms += muFastAlg
-    svcMgr.ViewAlgPool.TopAlg += [ muFastAlg.getName() ]
-    l2MuViewsMaker = EventViewCreatorAlgorithm("l2MuViewsMaker", OutputLevel=DEBUG)
-    l2MuViewsMaker.ViewFallThrough = True
- 
-    l2MuViewsMaker.Decisions = "MURoIDecisions"
-    l2MuViewsMaker.RoIsLink = "initialRoI" # -||-
-    l2MuViewsMaker.InViewRoIs = "MURoIs" # contract with the consumer
-    l2MuViewsMaker.Views = "MUViewRoIs"
- 
-    l2MuViewsMaker.AlgorithmNameSequence = [ muFastAlg.getName() ]
+    l2MuViewNode += muFastAlg
 
     muFastAlg.MuRoIs = l2MuViewsMaker.InViewRoIs
     muFastAlg.RecMuonRoI = "RecMURoIs"
@@ -114,16 +369,7 @@ if TriggerFlags.doMuon:
     muFastAlg.MuFastForID = "MuFastAlg_IdDecisions"
     muFastAlg.MuFastForMS = "MuFastAlg_MsDecisions"
 
-  else:
-    muFastAlg.MuRoIs = "MURoIs"
-    muFastAlg.RecMuonRoI = "RecMURoIs"
-    muFastAlg.MuFastDecisions = "MuFastAlg_Decisions"
-    muFastAlg.MuFastComposite = "MuFastAlg_Composite"
-    muFastAlg.MuFastForID = "MuFastAlg_IdDecisions"
-    muFastAlg.MuFastForMS = "MuFastAlg_MsDecisions"
-
-  # set up MuFastHypo
-  if viewTest:
+    # set up MuFastHypo
     from TrigMuonHypo.TrigMuonHypoConfig import TrigMufastHypoConfig
     trigMufastHypo = TrigMufastHypoConfig("L2MufastHypoAlg")
     trigMufastHypo.OutputLevel = DEBUG
@@ -137,20 +383,137 @@ if TriggerFlags.doMuon:
     trigMufastHypo.HypoTools = [ trigMufastHypo.TrigMufastHypoToolFromName( "L2MufastHypoTool", c ) for c in testChains ] 
 
     muFastDecisionsDumper = DumpDecisions("muFastDecisionsDumper", OutputLevel=DEBUG, Decisions = trigMufastHypo.Decisions )
-    muFastStep = stepSeq("muFastStep", filterL1RoIsAlg, [ l2MuViewsMaker, trigMufastHypo, muFastDecisionsDumper])
+    muFastStep = seqAND("muFastStep", [filterL1RoIsAlg, l2MuViewsMaker, l2MuViewNode, trigMufastHypo, muFastDecisionsDumper])
+
+
+# ==================================================================================================================================
+#               Setup muComb
+# ==================================================================================================================================
+  if domuComb:
+    ### please read out TrigmuCombMTConfig file ###
+    ### and set up to run muCombMT algorithm    ###
+
+ 
+    ### if we wold like to run muComb chain after muFast chain, ###
+    ### please try the bellow lines.                            ###
+   
+    ### set up muCombHypo algorithm ###
+    #from TrigMuonHypo.TrigMuonHypoConfig import TrigmuCombHypoConfig
+    #trigmuCombHypo = TrigmuCombHypoConfig()
+    #trigmuCombHypo.OutputLevel = DEBUG
+  
+    #trigmuCombHypo.Decisions = "L2muCombDecisions"
+    #trigmuCombHypo.MuonSADecisions = trigMufastHypo.Decisions
+    #trigmuCombHypo.ViewRoIs = l2muCombViewsMaker.Views
+    #trigmuCombHypo.MuCombContainer = muCombAlg.Decisions
+  
+    #trigmuCombHypo.HypoTools = [ trigmuCombHypo.TrigmuCombHypoToolFromName( name = "L2muCombHypoTool", nath = c ) for c in testChains ] 
+  
+    #muCombDecisionsDumper = DumpDecisions("muCombDecisionsDumper", OutputLevel=DEBUG, Decisions = trigmuCombHypo.Decisions )
+ 
+    ### need to use ViewNode ### 
+    #muCombStep = stepSeq("muCombStep", filterL2MuonSARoIsAlg, [ l2muCombViewsMaker, trigmuCombHypo, muCombDecisionsDumper ])
 
-  else:
     pass 
 
-  # CF construction
-  if viewTest:
-    step0 = parOR("step0", [ muFastStep ] )
+# ==================================================================================================================================
+#               Setup EFMuonSA
+# ==================================================================================================================================
+  if doEFSA:
+    from TrkDetDescrSvc.TrkDetDescrSvcConf import Trk__TrackingVolumesSvc
+    ServiceMgr += Trk__TrackingVolumesSvc("TrackingVolumesSvc",BuildVolumesFromTagInfo = False)
+
+    theSegmentFinder = CfgGetter.getPublicToolClone("MuonSegmentFinder","MooSegmentFinder")
+    theSegmentFinder.DoSummary=True
+    CfgGetter.getPublicTool("MuonLayerHoughTool").DoTruth=False
+    theSegmentFinderAlg=CfgMgr.MooSegmentFinderAlg( "MuonSegmentMaker",
+                                                    SegmentFinder=theSegmentFinder,
+                                                    MuonSegmentOutputLocation = "MuonSegmentCollection",
+                                                    UseCSC = muonRecFlags.doCSCs(),
+                                                    UseMDT = muonRecFlags.doMDTs(),
+                                                    UseRPC = muonRecFlags.doRPCs(),
+                                                    UseTGC = muonRecFlags.doTGCs(),
+                                                    doClusterTruth=False,
+                                                    UseTGCPriorBC = False,
+                                                    UseTGCNextBC  = False,
+                                                    doTGCClust = muonRecFlags.doTGCClusterSegmentFinding(),
+                                                    doRPCClust = muonRecFlags.doRPCClusterSegmentFinding(), OutputLevel=DEBUG )
+    
+
+ 
+    theNCBSegmentFinderAlg=CfgMgr.MooSegmentFinderAlg( "MuonSegmentMaker_NCB",
+                                                       SegmentFinder = getPublicToolClone("MooSegmentFinder_NCB","MuonSegmentFinder",
+                                                                                          DoSummary=False,
+                                                                                          Csc2dSegmentMaker = getPublicToolClone("Csc2dSegmentMaker_NCB","Csc2dSegmentMaker",
+                                                                                                                                 segmentTool = getPublicToolClone("CscSegmentUtilTool_NCB",
+                                                                                                                                                                  "CscSegmentUtilTool",
+                                                                                                                                                                  TightenChi2 = False, 
+                                                                                                                                                                  IPconstraint=False)),
+                                                                                          Csc4dSegmentMaker = getPublicToolClone("Csc4dSegmentMaker_NCB","Csc4dSegmentMaker",
+                                                                                                                                 segmentTool = getPublicTool("CscSegmentUtilTool_NCB")),
+                                                                                          DoMdtSegments=False,DoSegmentCombinations=False,DoSegmentCombinationCleaning=False),
+                                                       MuonPatternCombinationLocation = "NCB_MuonHoughPatternCombinations", 
+                                                       MuonSegmentOutputLocation = "NCB_MuonSegments", 
+                                                       MuonSegmentCombinationOutputLocation = "NCB_MooreSegmentCombinations",
+                                                       UseCSC = muonRecFlags.doCSCs(),
+                                                       UseMDT = False,
+                                                       UseRPC = False,
+                                                       UseTGC = False,
+                                                       UseTGCPriorBC = False,
+                                                       UseTGCNextBC  = False,
+                                                       doTGCClust = False,
+                                                       doRPCClust = False)
+
+    from MuonRecExample.MuonStandalone import MuonTrackSteering
+    MuonTrackSteering.DoSummary=True
+    MuonTrackSteering.DoSummary=DEBUG
+    TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder" )
+    TrackBuilder.TrackSteering=CfgGetter.getPublicToolClone("MuonTrackSteering", "MuonTrackSteering")
+
+    from AthenaCommon.Include import include
+    include("InDetBeamSpotService/BeamCondSvc.py" )        
+    from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg, xAODMaker__TrackCollectionCnvTool, xAODMaker__RecTrackParticleContainerCnvTool
+  
+    muonParticleCreatorTool = getPublicTool("MuonParticleCreatorTool")
+  
+    muonTrackCollectionCnvTool = xAODMaker__TrackCollectionCnvTool( name = "MuonTrackCollectionCnvTool", TrackParticleCreator = muonParticleCreatorTool )
+  
+    muonRecTrackParticleContainerCnvTool = xAODMaker__RecTrackParticleContainerCnvTool(name = "MuonRecTrackParticleContainerCnvTool", TrackParticleCreator = muonParticleCreatorTool )
+ 
+    xAODTrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg( name = "MuonStandaloneTrackParticleCnvAlg", 
+                                                              TrackParticleCreator = muonParticleCreatorTool,
+                                                              TrackCollectionCnvTool=muonTrackCollectionCnvTool,
+                                                              RecTrackParticleContainerCnvTool = muonRecTrackParticleContainerCnvTool,
+                                                              TrackContainerName = "MuonSpectrometerTracks",
+                                                              xAODTrackParticlesFromTracksContainerName = "MuonSpectrometerTrackParticles",
+                                                              ConvertTrackParticles = False,
+                                                              ConvertTracks = True)
 
+
+    thetrkbuilder = getPublicToolClone("CombinedMuonTrackBuilder_SA", "CombinedMuonTrackBuilder", MuonHoleRecovery="", CaloMaterialProvider='TMEF_TrkMaterialProviderTool')
+
+    theCandidateTool = getPublicToolClone("MuonCandidateTool_SA", "MuonCandidateTool", TrackBuilder=thetrkbuilder)
+    theMuonCandidateAlg=CfgMgr.MuonCombinedMuonCandidateAlg("MuonCandidateAlg",MuonCandidateTool=theCandidateTool)
+
+
+    thecreatortool= getPublicToolClone("MuonCreatorTool_SA", "MuonCreatorTool", ScatteringAngleTool="", CaloMaterialProvider='TMEF_TrkMaterialProviderTool', MuonSelectionTool="", FillTimingInformation=False, OutputLevel=DEBUG)
+
+    themuoncreatoralg = CfgMgr.MuonCreatorAlg("MuonCreatorAlg")
+    themuoncreatoralg.MuonCreatorTool=thecreatortool
+    themuoncreatoralg.CreateSAmuons=True
+
+
+# ==================================================================================================================================
+#               Setup CF(Control Flow)
+# ==================================================================================================================================
+  ### CF construction ###
+  if doL2SA:
     from DecisionHandling.DecisionHandlingConf import TriggerSummaryAlg 
     summary = TriggerSummaryAlg( "TriggerSummaryAlg" ) 
     summary.L1Decision = "HLTChains" 
     summary.FinalDecisions = ["L2MuonFastDecisions"]
     summary.OutputLevel = DEBUG 
+    step0 = parOR("step0", [ muFastStep ] )
     HLTsteps = seqAND("HLTsteps", [ step0, summary ]  ) 
 
     mon = TriggerSummaryAlg( "TriggerMonitoringAlg" ) 
@@ -161,6 +524,9 @@ if TriggerFlags.doMuon:
     hltTop = seqOR( "hltTop", [ HLTsteps, mon] )
 
     topSequence += hltTop   
-  else:
-    topSequence += muFastAlg
+    
 
+def TMEF_TrkMaterialProviderTool(name='TMEF_TrkMaterialProviderTool',**kwargs):
+    from TrkMaterialProvider.TrkMaterialProviderConf import Trk__TrkMaterialProviderTool
+    kwargs.setdefault("UseCaloEnergyMeasurement", False)
+    return Trk__TrkMaterialProviderTool(name,**kwargs)
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/testHLT_MT.py b/Trigger/TrigValidation/TrigUpgradeTest/share/testHLT_MT.py
index 4c775885428..205c81c2059 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/testHLT_MT.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/testHLT_MT.py
@@ -28,7 +28,6 @@ class opt :
     doID             = True           # TriggerFlags.doID
     doCalo           = True           # TriggerFlags.doCalo
     doMuon           = True           # TriggerFlags.doMuon
-    enableViews      = True           # setup infrastructre for Views
     doDBConfig       = None           # dump trigger configuration
     trigBase         = None           # file name for trigger config dump
     enableCostD3PD   = False          # enable cost monitoring
@@ -232,7 +231,7 @@ for mod in modifierList:
 from IOVSvc.IOVSvcConf import CondSvc 
 svcMgr += CondSvc()
 
-from AthenaCommon.AlgSequence import AthSequencer 
+from AthenaCommon.AlgSequence import AthSequencer
 condSeq = AthSequencer("AthCondSeq") 
 
 from IOVSvc.IOVSvcConf import CondInputLoader 
@@ -336,54 +335,6 @@ else:
     from TrigUpgradeTest.TestUtils import L1EmulationTest
     topSequence += L1EmulationTest(OutputLevel = opt.HLTOutputLevel)
 
-# ----------------------------------------------------------------
-# Setup Views
-# ----------------------------------------------------------------
-viewSeq = AthSequencer("AthViewSeq", Sequential = True)
-topSequence+=viewSeq
-
-if opt.enableViews:
-    log.info('Setting up Views...')
-    # Make a separate alg pool for the view algs
-    from GaudiHive.GaudiHiveConf import AlgResourcePool
-    svcMgr += AlgResourcePool('ViewAlgPool')
-    #Create IdentifiableCaches
-    from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__CacheCreator
-    InDetCacheCreatorTrigViews = InDet__CacheCreator(name = "InDetCacheCreatorTrigViews",
-                                        Pixel_ClusterKey = "PixelTrigClustersCache",
-                                        SCT_ClusterKey   = "SCT_ClustersCache",
-                                        SpacePointCachePix = "PixelSpacePointCache",
-                                        SpacePointCacheSCT   = "SctSpacePointCache",
-                                        SCTRDOCacheKey       = "SctRDOCache",
-                                        PixRDOCacheKey = "PixRDOCache",
-                                        OutputLevel=DEBUG)
-    viewSeq += InDetCacheCreatorTrigViews    
-    
-    # Set of view algs
-    allViewAlgs = AthSequencer( "allViewAlgorithms" )
-    allViewAlgs.ModeOR = False
-    allViewAlgs.Sequential = True
-    allViewAlgs.StopOverride = False
-    topSequence += allViewAlgs
-    
-    # Filter to stop view algs from running on whole event
-    allViewAlgs += CfgMgr.AthPrescaler( "alwaysFail" )
-    allViewAlgs.alwaysFail.PercentPass = 0.0
-
-    # dummy alg that just says you're running in a view
-    # allViewAlgs += CfgMgr.AthViews__ViewTestAlg( "viewTest" )
-    # svcMgr.ViewAlgPool.TopAlg += [ "viewTest" ]
-    # viewMaker.AlgorithmNameSequence = [ "viewTest" ] #Eventually scheduler will do this
-else:
-    #This is to workaround the problem CondHandle bug, this can be removed once a proper solution is made
-    from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__CacheCreator
-    InDetCacheCreatorTrigViews = InDet__CacheCreator(name = "InDetCacheCreatorTrigViews",
-                                        Pixel_ClusterKey = "",
-                                        SCT_ClusterKey   = "",
-                                        SpacePointCachePix = "",
-                                        SpacePointCacheSCT   = "",
-                                        OutputLevel=INFO)
-    viewSeq += InDetCacheCreatorTrigViews    
 # ---------------------------------------------------------------
 # Monitoring
 # ---------------------------------------------------------------
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_egamma_run_data.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_egamma_run_data.sh
index d25d672aef4..379ecd7d7b7 100755
--- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_egamma_run_data.sh
+++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_egamma_run_data.sh
@@ -2,4 +2,4 @@
 # art-type: build
 # art-ci: master
 
-athena --threads=1 -c 'EvtMax=10;enableViews=True;FilesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"' TrigUpgradeTest/egamma.withViews.py
+athena --threads=1 -c 'EvtMax=10;FilesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"' TrigUpgradeTest/egamma.withViews.py
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_graph_view.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_graph_view.sh
deleted file mode 100755
index a6bcb6bbd0b..00000000000
--- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_graph_view.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-# art-type: build
-# art-ci: master
-
-athena.py --threads=$THREADS AthViews/GraphViews.py
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_id_run_mc.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_id_run_mc.sh
index 13b0aea3015..68240cf9eb6 100755
--- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_id_run_mc.sh
+++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_id_run_mc.sh
@@ -2,4 +2,4 @@
 # art-type: build
 # art-ci: master
 
-athena.py --threads=1 -c 'enableViews=False;doCalo=False;EvtMax=10;FilesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TriggerTest/valid1.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.RDO.e3099_s2578_r7572_tid07644622_00/RDO.07644622._000001.pool.root.1"' TrigUpgradeTest/IDCalo.py
+athena.py --threads=1 -c 'doCalo=False;EvtMax=10;FilesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TriggerTest/valid1.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.RDO.e3099_s2578_r7572_tid07644622_00/RDO.07644622._000001.pool.root.1"' TrigUpgradeTest/IDCalo.py
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_mu_run_data.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_mu_run_data.sh
index 74944307821..fe69eb286d7 100755
--- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_mu_run_data.sh
+++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_mu_run_data.sh
@@ -2,4 +2,7 @@
 # art-type: build
 # art-ci: master
 
-athena --threads=1 -c 'EvtMax=50;enableViews=True;FilesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"' TrigUpgradeTest/mu.withViews.py
+### BSfile ###
+athena --threads=1 -c 'EvtMax=50;FilesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"' TrigUpgradeTest/mu.withViews.py
+### RDOfile ###
+#athena --threads=1 -c 'EvtMax=50;FilesInput="/afs/cern.ch/user/s/shhayash/workspace/public/RDOfile/ttbar/RDO_TRIG.root"' TrigUpgradeTest/mu.withViews.py
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_view_schedule.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_view_schedule.sh
new file mode 100755
index 00000000000..1ffa447475b
--- /dev/null
+++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_view_schedule.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+# art-type: build
+# art-ci: master
+
+athena.py --threads=$THREADS AthViews/ViewScheduling.py
diff --git a/graphics/JiveXML/src/ONCRPCServerSvc.cxx b/graphics/JiveXML/src/ONCRPCServerSvc.cxx
index 36877e83ad1..b2d75d104f6 100644
--- a/graphics/JiveXML/src/ONCRPCServerSvc.cxx
+++ b/graphics/JiveXML/src/ONCRPCServerSvc.cxx
@@ -368,7 +368,7 @@ namespace JiveXML {
       //Now add the new event
       m_eventStreamMap.insert(EventStreamPair(evtStreamID,event));
     
-    } catch ( std::exception e ) {
+    } catch ( const std::exception& e ) {
       ATH_MSG_ERROR( "Exception caught while updating event for stream " << evtStreamID.StreamName()
                      << ": " << e.what()  );
       //Also release the lock in this case
diff --git a/graphics/VP1/VP1AlgsBatch/CMakeLists.txt b/graphics/VP1/VP1AlgsBatch/CMakeLists.txt
index c287fbce804..1590642a274 100644
--- a/graphics/VP1/VP1AlgsBatch/CMakeLists.txt
+++ b/graphics/VP1/VP1AlgsBatch/CMakeLists.txt
@@ -11,10 +11,6 @@ atlas_depends_on_subdirs( PUBLIC
                           Database/AthenaPOOL/PoolSvc
                           GaudiKernel
                           PRIVATE
-                          Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
-                          Database/APR/PersistencySvc
                           Database/APR/StorageSvc
                           Event/EventInfo
                           Tools/PathResolver
@@ -29,7 +25,7 @@ find_package( Qt5 COMPONENTS Core OpenGL Gui HINTS ${QT5_ROOT} )
 atlas_add_component( VP1AlgsBatch
                      src/*.cxx
                      src/components/*.cxx
-                   LINK_LIBRARIES ${QT5_LIBRARIES} GL AthenaBaseComps GaudiKernel CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc EventInfo PathResolver VP1UtilsBase )
+                   LINK_LIBRARIES ${QT5_LIBRARIES} GL AthenaBaseComps GaudiKernel StorageSvc EventInfo PathResolver VP1UtilsBase )
 
 # Install files from the package:
 atlas_install_headers( VP1AlgsBatch )
diff --git a/graphics/VP1/VP1AlgsEventProd/CMakeLists.txt b/graphics/VP1/VP1AlgsEventProd/CMakeLists.txt
index 5cf1eaf013d..6372eb122fd 100644
--- a/graphics/VP1/VP1AlgsEventProd/CMakeLists.txt
+++ b/graphics/VP1/VP1AlgsEventProd/CMakeLists.txt
@@ -11,10 +11,6 @@ atlas_depends_on_subdirs( PUBLIC
                           Database/AthenaPOOL/PoolSvc
                           GaudiKernel
                           PRIVATE
-                          Database/APR/CollectionBase
-                          Database/APR/CollectionUtilities
-                          Database/APR/POOLCore
-                          Database/APR/PersistencySvc
                           Database/APR/StorageSvc
                           Event/EventInfo
                           Tools/PathResolver
@@ -29,7 +25,7 @@ find_package( Qt5 COMPONENTS Core OpenGL Gui HINTS ${QT5_ROOT} )
 atlas_add_component( VP1AlgsEventProd
                      src/*.cxx
                      src/components/*.cxx
-                   LINK_LIBRARIES GL AthenaBaseComps GaudiKernel CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc EventInfo PathResolver VP1UtilsBase )
+                   LINK_LIBRARIES GL AthenaBaseComps GaudiKernel StorageSvc EventInfo PathResolver VP1UtilsBase )
 
 # Install files from the package:
 atlas_install_headers( VP1AlgsEventProd )
diff --git a/graphics/VP1/VP1Base/src/VP1ColorSelectButton.cxx b/graphics/VP1/VP1Base/src/VP1ColorSelectButton.cxx
index ffb713354f0..078e3e29335 100644
--- a/graphics/VP1/VP1Base/src/VP1ColorSelectButton.cxx
+++ b/graphics/VP1/VP1Base/src/VP1ColorSelectButton.cxx
@@ -47,16 +47,20 @@ void VP1ColorSelectButton::updateButton()
 
 //____________________________________________________________________
 void VP1ColorSelectButton::setColButtonProperties(QPushButton* pb,const QColor& col,int dim) {
-  if (VP1Msg::verbose())
-    VP1Msg::messageVerbose("setColButtonProperties: button="+VP1Msg::str(pb)+", color="+VP1Msg::str(col));
+
+//  if (VP1Msg::verbose())
+//    VP1Msg::messageVerbose("setColButtonProperties: button="+VP1Msg::str(pb)+", color="+VP1Msg::str(col));
+
   if (pb->objectName().isEmpty()) {
     VP1Msg::messageDebug("VP1ColorSelectButton::setColButtonProperties() WARNING: Empty objectName()!!");
     pb->setObjectName("VP1ColorSelectButton_setColButtonProperties");
   }
+
   if (!pb->text().isEmpty()) {
     VP1Msg::messageDebug("VP1ColorSelectButton::setColButtonProperties() WARNING: Noticed non-empty text field. Clearing!");
     pb->QPushButton::setText("");
   }
+
   pb->setStyleSheet("QPushButton#"+pb->objectName()+" { background-color: "
 		+col.name()+"; border-color: "+col.name()+"; }");
   pb->setFocusPolicy(Qt::NoFocus);
diff --git a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/CMakeLists.txt b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/CMakeLists.txt
index 65f26436b99..73ec2ad7697 100644
--- a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/CMakeLists.txt
+++ b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/CMakeLists.txt
@@ -10,25 +10,47 @@ atlas_depends_on_subdirs( PUBLIC
                           graphics/VP1/VP1Base
                           PRIVATE
                           graphics/VP1/VP1Plugins/VP1PlugUtils
-                          graphics/VP1/VP1Systems/VP1AODSystems
-                          graphics/VP1/VP1Systems/VP1BPhysSystems
-                          graphics/VP1/VP1Systems/VP1CaloClusterSystems
-                          graphics/VP1/VP1Systems/VP1CaloReadoutSystems
-                          graphics/VP1/VP1Systems/VP1CaloSystems
                           graphics/VP1/VP1Systems/VP1GeometrySystems
                           graphics/VP1/VP1Systems/VP1GuideLineSystems
                           graphics/VP1/VP1Systems/VP1PRDSystems
+                          graphics/VP1/VP1Systems/VP1TrackSystems
+                          graphics/VP1/VP1Systems/VP1AODSystems
+                          graphics/VP1/VP1Systems/VP1BPhysSystems
+                          graphics/VP1/VP1Systems/VP1CaloSystems
+                          graphics/VP1/VP1Systems/VP1UtilitySystems 
                           graphics/VP1/VP1Systems/VP1RawDataSystems
+                          graphics/VP1/VP1Systems/VP1CaloReadoutSystems
                           graphics/VP1/VP1Systems/VP1SimHitSystems
-                          graphics/VP1/VP1Systems/VP1TrackSystems
                           graphics/VP1/VP1Systems/VP1TrackingGeometrySystems
-                          graphics/VP1/VP1Systems/VP1UtilitySystems )
+                          )
+                          #graphics/VP1/VP1Systems/VP1CaloClusterSystems --> now in the xAOD/VP1AODSystems
 
 # External dependencies:
-find_package( Qt5 COMPONENTS Core OpenGL Gui HINTS ${QT5_ROOT} )
+find_package( Qt5 COMPONENTS Core OpenGL Gui Widgets )
+find_package( SoQt )
+find_package( Coin3D )
+
+# Generate UI files automatically:
+set( CMAKE_AUTOUIC TRUE )
+# Generate MOC files automatically:
+set( CMAKE_AUTOMOC TRUE )
+
+# get the package name into the variable 'pkgName', to be used below
+atlas_get_package_name( pkgName )
+
+   
+# Build the library. // TODO: I removed the TrackCalo plugin so far, because it does not compile with the new plugin system. I should get it back, later.
+atlas_add_library( ${pkgName} ${pkgName}/VP13DCocktail*.h src/VP13DCocktail*.cxx src/*.qrc 
+   PUBLIC_HEADERS ${pkgName}
+   INCLUDE_DIRS ${SOQT_INCLUDE_DIRS} ${COIN3D_INCLUDE_DIRS} ${QT5_INCLUDE_DIRS} 
+   PRIVATE_INCLUDE_DIRS tmpqt_extraheaders/  ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets ${SOQT_LIBRARIES} ${COIN3D_LIBRARIES} GeoPrimitives
+   PRIVATE_LINK_LIBRARIES VP1PlugUtils VP1GuideLineSystems VP1GeometrySystems VP1PRDSystems VP1TrackSystems VP1AODSystems VP1BPhysSystems VP1CaloSystems VP1CaloReadoutSystems VP1UtilitySystems VP1RawDataSystems VP1SimHitSystems VP1TrackingGeometrySystems
+)
 
+# Make the package target depend on this one:
+#add_dependencies( Package_VP13DCocktailPlugin Package_VP1PlugUtils Package_VP1PRDSystems Package_VP1TrackSystems Package_VP1AODSystems Package_VP1BPhysSystems )
+add_dependencies( VP13DCocktailPlugin VP1PlugUtils VP1GeometrySystems VP1GuideLineSystems VP1PRDSystems VP1TrackSystems VP1AODSystems VP1BPhysSystems VP1CaloSystems VP1CaloReadoutSystems VP1UtilitySystems VP1RawDataSystems VP1SimHitSystems VP1TrackingGeometrySystems)
 
 
-# Install files from the package:
-atlas_install_headers( VP13DCocktailPlugin )
 
diff --git a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/VP13DCocktailPlugin/VP13DCocktailPlugin_VP1AutoFactory.h b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/VP13DCocktailPlugin/VP13DCocktailPlugin_VP1AutoFactory.h
new file mode 100644
index 00000000000..b8bc098e62e
--- /dev/null
+++ b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/VP13DCocktailPlugin/VP13DCocktailPlugin_VP1AutoFactory.h
@@ -0,0 +1,29 @@
+// Originally autogenerated by CMT with VP1 Factory Code Header File (Fri Aug 19 13:36:52 CEST 2016)
+// Now we add this file to plugins by hand, to simplify the CMake compilation
+
+#ifndef VP13DCocktailPlugin_VP1AutoFactory_H
+#define VP13DCocktailPlugin_VP1AutoFactory_H
+
+#include <QObject>
+#include <QStringList>
+
+#include "VP1Base/IVP1ChannelWidgetFactory.h"
+
+class VP13DCocktailPlugin_VP1AutoFactory : public QObject, public IVP1ChannelWidgetFactory
+{
+  Q_OBJECT
+
+  #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "VP13DCocktailPlugin" FILE "") // apparently, FILE can be empty
+  # else
+    Q_EXPORT_PLUGIN2(pnp_vp13dcocktailplugin_vp1autofactory, VP13DCocktailPlugin_VP1AutoFactory)
+  #endif
+
+  Q_INTERFACES(IVP1ChannelWidgetFactory)
+
+public:
+  virtual QStringList channelWidgetsProvided() const;
+  virtual IVP1ChannelWidget * getChannelWidget(const QString & channelwidget);
+};
+
+#endif
diff --git a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/VP13DCocktailPlugin/VP1TrackCaloPlugin_VP1AutoFactory.h b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/VP13DCocktailPlugin/VP1TrackCaloPlugin_VP1AutoFactory.h
new file mode 100644
index 00000000000..e3f4b9ea979
--- /dev/null
+++ b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/VP13DCocktailPlugin/VP1TrackCaloPlugin_VP1AutoFactory.h
@@ -0,0 +1,29 @@
+// Originally autogenerated by CMT with VP1 Factory Code Header File (Fri Aug 19 13:36:52 CEST 2016)
+// Now we add this file to plugins by hand, to simplify the CMake compilation
+
+#ifndef VP1TrackCaloPlugin_VP1AutoFactory_H
+#define VP1TrackCaloPlugin_VP1AutoFactory_H
+
+#include <QObject>
+#include <QStringList>
+
+#include "VP1Base/IVP1ChannelWidgetFactory.h"
+
+class VP1TrackCaloPlugin_VP1AutoFactory : public QObject, public IVP1ChannelWidgetFactory
+{
+  Q_OBJECT
+
+  #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "VP1TrackCaloPlugin" FILE "") // apparently, FILE can be empty
+  # else
+    Q_EXPORT_PLUGIN2(pnp_vp1trackcaloplugin_vp1autofactory, VP1TrackCaloPlugin_VP1AutoFactory)
+  #endif
+
+  Q_INTERFACES(IVP1ChannelWidgetFactory)
+
+public:
+  virtual QStringList channelWidgetsProvided() const;
+  virtual IVP1ChannelWidget * getChannelWidget(const QString & channelwidget);
+};
+
+#endif
diff --git a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP13DCocktailChannel.cxx b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP13DCocktailChannel.cxx
index 9a352323157..c0afa027a99 100755
--- a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP13DCocktailChannel.cxx
+++ b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP13DCocktailChannel.cxx
@@ -45,7 +45,7 @@
 VP13DCocktailChannel::VP13DCocktailChannel()
   : IVP13DStandardChannelWidget(VP1CHANNELNAMEINPLUGIN(VP13DCocktailChannel,"3DCocktail"),
 				"This channel shows essentially all functional 3D systems.",
-				"Thomas.Kittelmann@cern.ch")
+				"Riccardo.Maria.Bianchi@cern.ch, Thomas.Kittelmann@cern.ch")
 {
 }
 
diff --git a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP13DCocktailPlugin_VP1AutoFactory.cxx b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP13DCocktailPlugin_VP1AutoFactory.cxx
new file mode 100644
index 00000000000..dfbe503c09c
--- /dev/null
+++ b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP13DCocktailPlugin_VP1AutoFactory.cxx
@@ -0,0 +1,38 @@
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////
+//                                                             //
+//  Implementation of class VP13DCocktailPlugin_VP1AutoFactory //
+//                                                             //
+//  Author: Riccardo Maria BIANCHI <rbianchi@cern.ch>          //
+//                                                             //
+//  Update version: Dec 2017                                   //
+//                                                             //
+/////////////////////////////////////////////////////////////////
+
+
+// Originally, this file was autogenerated by CMT with VP1 Factory Code Header File
+// Now we add this file to plugins by hand, to simplify the CMake compilation
+
+#include <QtPlugin>
+#include "VP13DCocktailPlugin/VP13DCocktailPlugin_VP1AutoFactory.h"
+#include "VP13DCocktailPlugin/VP13DCocktailChannel.h"
+
+QStringList VP13DCocktailPlugin_VP1AutoFactory::channelWidgetsProvided() const
+{
+  return QStringList()
+        << "3DCocktail"
+         ;
+}
+
+IVP1ChannelWidget * VP13DCocktailPlugin_VP1AutoFactory::getChannelWidget(const QString & channelwidget)
+{
+  if (channelwidget == "3DCocktail")
+    return new VP13DCocktailChannel();
+
+  return 0;
+}
+
diff --git a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP1TrackCaloChannel.cxx b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP1TrackCaloChannel.cxx
index 498979b2971..03f97fbde70 100644
--- a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP1TrackCaloChannel.cxx
+++ b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP1TrackCaloChannel.cxx
@@ -11,13 +11,15 @@
 #include "VP1PRDSystems/VP1PrepRawDataSystem.h"
 //#include "VP1FatrasSystems/VP1FatrasSingleTrackSimSystem.h" // TODO: to be updated when the new Fatras will be available
 
-#include "VP1CaloClusterSystems/VP1CaloClusterSystem.h"
+//#include "VP1CaloClusterSystems/VP1CaloClusterSystem.h" // it's now in the xAOD/VP1AODSystems
+#include "VP1AODSystems/VP1AODSystem.h"
+
 #include "VP1PlugUtils/VP1SysConf.h"
 
 VP1TrackCaloChannel::VP1TrackCaloChannel()
   : IVP13DStandardChannelWidget(VP1CHANNELNAMEINPLUGIN(VP1TrackCaloChannel,"TrackCalo"),
                 "This channel displays various systems related to Tracking and Calo.",
-                "Thomas.Kittelmann@cern.ch, Edward.moyse@cern.ch, Vakhtang.Tsulaia@cern.ch")
+                "Riccardo.Maria.Bianchi@cern.ch, Thomas.Kittelmann@cern.ch, Edward.moyse@cern.ch, Vakhtang.Tsulaia@cern.ch")
 {
 }
 
@@ -44,7 +46,9 @@ void VP1TrackCaloChannel::init()
   addSystem(prdsys);
 
   addSystem(new VP1CaloCellSystem());
-  addSystem(new VP1CaloClusterSystem,IVP13DStandardChannelWidget::StartDisabled);
+
+//  addSystem(new VP1CaloClusterSystem,IVP13DStandardChannelWidget::StartDisabled);
+  addSystem(new VP1AODSystem,IVP13DStandardChannelWidget::StartDisabled);
 
   foreach(QString n,VP1SysConf::extraGeometrySystems())
     addSystem(new VP1GeometrySystem(VP1GeoFlags::None,n),IVP13DStandardChannelWidget::StartDisabled);
diff --git a/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP1TrackCaloPlugin_VP1AutoFactory.cxx b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP1TrackCaloPlugin_VP1AutoFactory.cxx
new file mode 100644
index 00000000000..cec8d82b8ca
--- /dev/null
+++ b/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/src/VP1TrackCaloPlugin_VP1AutoFactory.cxx
@@ -0,0 +1,38 @@
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////
+//                                                             //
+//  Implementation of class VP1TrackCaloPlugin_VP1AutoFactory  //
+//                                                             //
+//  Author: Riccardo Maria BIANCHI <rbianchi@cern.ch>          //
+//                                                             //
+//  Update version: Dec 2017                                   //
+//                                                             //
+/////////////////////////////////////////////////////////////////
+
+
+// Originally, this file was autogenerated by CMT with VP1 Factory Code Header File
+// Now we add this file to plugins by hand, to simplify the CMake compilation
+
+#include <QtPlugin>
+#include "VP13DCocktailPlugin/VP1TrackCaloPlugin_VP1AutoFactory.h"
+#include "VP13DCocktailPlugin/VP1TrackCaloChannel.h"
+
+QStringList VP1TrackCaloPlugin_VP1AutoFactory::channelWidgetsProvided() const
+{
+  return QStringList()
+        << "TrackCalo"
+         ;
+}
+
+IVP1ChannelWidget * VP1TrackCaloPlugin_VP1AutoFactory::getChannelWidget(const QString & channelwidget)
+{
+  if (channelwidget == "TrackCalo")
+    return new VP1TrackCaloChannel();
+
+  return 0;
+}
+
diff --git a/graphics/VP1/VP1Plugins/VP1AODPlugin/VP1AODPlugin/VP1AODPlugin_VP1AutoFactory.h b/graphics/VP1/VP1Plugins/VP1AODPlugin/VP1AODPlugin/VP1AODPlugin_VP1AutoFactory.h
index 773ee3b6572..17d5527741f 100644
--- a/graphics/VP1/VP1Plugins/VP1AODPlugin/VP1AODPlugin/VP1AODPlugin_VP1AutoFactory.h
+++ b/graphics/VP1/VP1Plugins/VP1AODPlugin/VP1AODPlugin/VP1AODPlugin_VP1AutoFactory.h
@@ -1,4 +1,5 @@
-//Autogenerated VP1 Factory Code Header File (Fri Aug 19 13:36:52 CEST 2016)
+// Originally autogenerated by CMT with VP1 Factory Code Header File (Fri Aug 19 13:36:52 CEST 2016)
+// Now we add this file to plugins by hand, to simplify the CMake compilation
 
 #ifndef VP1AODPlugin_VP1AutoFactory_H
 #define VP1AODPlugin_VP1AutoFactory_H
diff --git a/graphics/VP1/VP1Plugins/VP1AODPlugin/src/VP1AODPlugin_VP1AutoFactory.cxx b/graphics/VP1/VP1Plugins/VP1AODPlugin/src/VP1AODPlugin_VP1AutoFactory.cxx
index fdea491eb90..eb03753bc2c 100644
--- a/graphics/VP1/VP1Plugins/VP1AODPlugin/src/VP1AODPlugin_VP1AutoFactory.cxx
+++ b/graphics/VP1/VP1Plugins/VP1AODPlugin/src/VP1AODPlugin_VP1AutoFactory.cxx
@@ -1,4 +1,5 @@
-//Autogenerated VP1 Factory Code Implementation File (Fri Aug 19 13:36:52 CEST 2016)
+// Originally autogenerated by CMT with VP1 Factory Code Header File (Fri Aug 19 13:36:52 CEST 2016)
+// Now we add this file to plugins by hand, to simplify the CMake compilation
 
 #include <QtPlugin>
 #include "VP1AODPlugin/VP1AODPlugin_VP1AutoFactory.h"
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/IParticleCollHandle_Jet.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/IParticleCollHandle_Jet.cxx
index 2db1cc47b84..35133db21f6 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/IParticleCollHandle_Jet.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/IParticleCollHandle_Jet.cxx
@@ -445,8 +445,11 @@ bool IParticleCollHandle_Jet::load()
   if (!VP1SGAccessHelper(systemBase()).retrieve(coll, name())) {
     message("Error: Could not retrieve Jet collection with key="+name());
     return false;
+  } else {
+     messageDebug("Jet collection '"+name()+"' loaded");
   }
 
+
   // // Retrieve the xAOD particles:
   //  const xAOD::JetContainer* xaod = evtStore()->retrieve<const xAOD::JetContainer>( m_JetCollection );
 
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/IParticleHandle_Jet.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/IParticleHandle_Jet.cxx
index 68f032d1c23..da3d7af6c87 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/IParticleHandle_Jet.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/IParticleHandle_Jet.cxx
@@ -691,7 +691,7 @@ void IParticleHandle_Jet::updateBTagging(const std::string& bTaggingTagger, cons
 	//double bTaggingWeight = 0.99; // dummy value for debug only!!!
 	double bTaggingWeight = getBTaggingWeight(bTaggingTagger); // actual value
 
-	std::cout << "BTAG UPDATE - tagger: " << bTaggingTagger << " - cut: " << bTaggingCut << " - weight: " << bTaggingWeight;
+    std::cout << "B-TAG UPDATE - jet eta: " << d->eta() << ", phi: " << d->phi() << " - tagger: " << bTaggingTagger << " - cut: " << bTaggingCut << " - weight: " << bTaggingWeight;
 
 	if (bTaggingWeight > bTaggingCut) {
 		d->m_bTagged->whichChild = SO_SWITCH_ALL;
@@ -709,13 +709,23 @@ void IParticleHandle_Jet::updateBTagging(const std::string& bTaggingTagger, cons
 //____________________________________________________________________
 double IParticleHandle_Jet::getBTaggingWeight(std::string tagger)
 {
-	const xAOD::BTagging * myBTag = d->m_jet->btagging();
+    double weight = 0.0;
 
-	double weight = 0.0;
+	const xAOD::BTagging * myBTag = nullptr;
+    myBTag = d->m_jet->btagging();
+
+   if (myBTag == nullptr) {
+    VP1Msg::messageWarningRed("It was not possible to access the pointer to b-tagging info, for the selected collection! Returning 'weight': 0.0"); //("It was not possible to access the tagger '"+ tagger +"' for the selected collection: " + d->m_jet->getInputType() + d->m_jet->getAlgorithmType() );
+    return weight;
+   }
+    
+	
 
 	// TODO: add the other taggers
-	if (tagger == "MV1")
-		weight = myBTag->MV1_discriminant();
+
+//    if (tagger == "MV1")
+//		weight = myBTag->MV1_discriminant();
+
 	/* these methods have been removed in xAODBTagging-00-00-35 (cfr. SVN changesets 797165 + 801102)
 	else if (tagger == "JetFitterCombNN_pb")
 		weight = myBTag->JetFitterCombNN_pb();
@@ -724,11 +734,13 @@ double IParticleHandle_Jet::getBTaggingWeight(std::string tagger)
 	else if (tagger == "JetFitterCombNN_pu")
 		weight = myBTag->JetFitterCombNN_pu();
 	*/
-	else if (tagger=="MV2c20")
+
+//    else if (tagger=="MV2c20")
+    if (tagger=="MV2c20")
 		/*const bool hasMv2c20 =*/ myBTag->MVx_discriminant("MV2c20", weight);
-	else if ("MV2c10")
+    else if (tagger=="MV2c10")
 		/*const bool hasMv2c10 =*/ myBTag->MVx_discriminant("MV2c10", weight);
-	else if ("MV2c00")
+    else if (tagger=="MV2c00")
 	    /*const bool hasMv2c00 =*/ myBTag->MVx_discriminant("MV2c00", weight);
 	else
 		VP1Msg::message("Tagger '" + QString::fromStdString(tagger) + "' not found! Returning weight=0.0 ...");
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/JetCollectionSettingsButton.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/JetCollectionSettingsButton.cxx
index 69cecca70e2..69fa1a0e3b8 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/JetCollectionSettingsButton.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/JetCollectionSettingsButton.cxx
@@ -157,7 +157,8 @@ void JetCollectionSettingsButton::Imp::initEditWindow()
 	QStringList bTagList;
 	//bTagList << "MV2c20" << "MV2c10" << "MV1" << "JetFitterCombNN_pb" << "JetFitterCombNN_pc" << "JetFitterCombNN_pu";
 	//bTagList << "MV2c20" << "MV2c10" << "MV2c00" << "MV1" << "JetFitterCombNN_pb" << "JetFitterCombNN_pc" << "JetFitterCombNN_pu"; // the JetFitter helpers have been removed in xAODBTagging-00-00-35
-	bTagList << "MV2c20" << "MV2c10" << "MV2c00" << "MV1"; // (cfr. SVN changesets 797165 + 801102)
+//	bTagList << "MV2c20" << "MV2c10" << "MV2c00" << "MV1"; // (cfr. SVN changesets 797165 + 801102)
+    bTagList << "MV2c20" << "MV2c10" << "MV2c00"; // 28 Sep 2017
 	ui_disp.bTaggingComboBox->insertItems(0, bTagList);
 
 	// set b-tagging "Material" checked by default ("Skin" will be optional)
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/jet_settings_display_form.ui b/graphics/VP1/VP1Systems/VP1AODSystems/src/jet_settings_display_form.ui
index a1705600a50..e4730d32187 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/jet_settings_display_form.ui
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/jet_settings_display_form.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>470</width>
-    <height>411</height>
+    <height>436</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -244,7 +244,7 @@
           <widget class="QComboBox" name="bTaggingComboBox">
            <item>
             <property name="text">
-             <string>MV1</string>
+             <string>MV2c20</string>
             </property>
            </item>
           </widget>
diff --git a/graphics/VP1/VP1Systems/VP1BPhysSystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1BPhysSystems/CMakeLists.txt
index 0b5f88a5cd3..05c1a29339b 100644
--- a/graphics/VP1/VP1Systems/VP1BPhysSystems/CMakeLists.txt
+++ b/graphics/VP1/VP1Systems/VP1BPhysSystems/CMakeLists.txt
@@ -23,7 +23,7 @@ atlas_depends_on_subdirs( PUBLIC
 find_package( Coin3D )
 find_package( Eigen )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 )
-
+find_package( Qt5 COMPONENTS Core Widgets)
 
 
 # Generate UI files automatically:
diff --git a/graphics/VP1/VP1Systems/VP1CaloSystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1CaloSystems/CMakeLists.txt
index 41eb4a0ab4c..d2bc10e5d61 100644
--- a/graphics/VP1/VP1Systems/VP1CaloSystems/CMakeLists.txt
+++ b/graphics/VP1/VP1Systems/VP1CaloSystems/CMakeLists.txt
@@ -22,11 +22,12 @@ atlas_depends_on_subdirs(
    GaudiKernel
    LArCalorimeter/LArIdentifier
    LArCalorimeter/LArRawEvent
-   LArCalorimeter/LArTools
+   LArCalorimeter/LArCabling
    TileCalorimeter/TileConditions
    TileCalorimeter/TileDetDescr
    TileCalorimeter/TileEvent
    TileCalorimeter/TileIdentifier
+   graphics/VP1/VP1Systems/VP1UtilitySystems
    graphics/VP1/VP1HEPVis
    graphics/VP1/VP1Utils )
 
@@ -34,7 +35,7 @@ atlas_depends_on_subdirs(
 find_package( CLHEP )
 find_package( Coin3D )
 find_package( Qt5 COMPONENTS Core Gui Widgets )
-find_package( Qwt )
+#find_package( Qwt )
 
 # Generate UI files automatically:
 set( CMAKE_AUTOUIC TRUE )
@@ -51,7 +52,7 @@ atlas_add_library( VP1CaloSystems
    DEFINITIONS ${CLHEP_DEFINITIONS}
    LINK_LIBRARIES ${CLHEP_LIBRARIES} Identifier VP1Base Qt5::Core
    PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${QWT_LIBRARIES} CaloDetDescrLib
-   StoreGateLib LArToolsLib TileConditionsLib CaloConditions CaloEvent
+   StoreGateLib LArCablingLib TileConditionsLib CaloConditions CaloEvent
    CaloIdentifier GeoModelKernel GeoModelUtilities GaudiKernel LArIdentifier
    LArRawEvent TileDetDescr TileEvent TileIdentifier VP1HEPVis VP1Utils
    Qt5::Gui )
diff --git a/graphics/VP1/VP1Systems/VP1CaloSystems/VP1CaloSystems/VP1CaloCellController.h b/graphics/VP1/VP1Systems/VP1CaloSystems/VP1CaloSystems/VP1CaloCellController.h
index 0ccac75fdf2..2ee50d4237e 100644
--- a/graphics/VP1/VP1Systems/VP1CaloSystems/VP1CaloSystems/VP1CaloCellController.h
+++ b/graphics/VP1/VP1Systems/VP1CaloSystems/VP1CaloSystems/VP1CaloCellController.h
@@ -17,7 +17,7 @@ class TileHWID;
 class TileInfo;
 class TileCablingService;
 
-class QwtPlot;
+//class QwtPlot; // FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
 class QLabel;
 class SoGroup;
 
@@ -116,15 +116,17 @@ class VP1CaloCellController : public VP1Controller
   static QString toString(const QPair<bool,double>& par) { return "<"+QString(par.first?"log":"linear")+", "+QString::number(par.second/(CLHEP::cm/CLHEP::GeV))+" cm/GeV>"; }
   static QString toString(const VP1CC_GlobalCuts& cuts) { return "VP1CC global cuts: sideA=" + QString(cuts.sideA?"True":"False") + ", sideC=" + QString(cuts.sideC?"True":"False") + ", allowedEta=" + VP1Controller::toString(cuts.allowedEta) + ", allowedPhi="  + VP1Controller::toString(cuts.allowedEta); }
 
-  void DrawTileDigits(QwtPlot* plot,
-		      int n_samples,
-		      std::vector<float> samples);
-
-  void DrawTilePulse(QwtPlot* plot,
-		     QLabel* gainlabel,
-		     const TileRawChannel* rawchannel,
-		     const TileRawChannelContainer* rawchannel_cont,
-		     size_t digitsize);
+//  // FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//  void DrawTileDigits(QwtPlot* plot,
+//		      int n_samples,
+//		      std::vector<float> samples);
+
+//  // FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//  void DrawTilePulse(QwtPlot* plot,
+//		     QLabel* gainlabel,
+//		     const TileRawChannel* rawchannel,
+//		     const TileRawChannelContainer* rawchannel_cont,
+//		     size_t digitsize);
 
  private slots:
   void possibleChange_selectionIntervals();
diff --git a/graphics/VP1/VP1Systems/VP1CaloSystems/src/VP1CaloCellController.cxx b/graphics/VP1/VP1Systems/VP1CaloSystems/src/VP1CaloCellController.cxx
index c4c37701758..3e9dbd1a3c1 100644
--- a/graphics/VP1/VP1Systems/VP1CaloSystems/src/VP1CaloCellController.cxx
+++ b/graphics/VP1/VP1Systems/VP1CaloSystems/src/VP1CaloCellController.cxx
@@ -5,8 +5,8 @@
 #include "VP1CaloSystems/VP1CaloCellController.h"
 #include "VP1CaloSystems/VP1CaloCells.h"
 #include "ui_calocellcontrollerform.h"
-#include "ui_calodigitssingle.h"
-#include "ui_calodigitsdouble.h"
+//#include "ui_calodigitssingle.h" // FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//#include "ui_calodigitsdouble.h" // FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
 #include "ui_calocell_badchannels_form.h"
 #include "ui_calocell_mbtsthresholds_form.h"
 #include "ui_calocell_tilethresholds_form.h"
@@ -26,12 +26,15 @@
 #include "TileEvent/TileRawChannelContainer.h"
 #include "TileConditions/Exception.h"
 
+/*
+ * FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
 #include <qwt_legend.h>
 #include <qwt_plot.h>
 #include <qwt_plot_curve.h>
 #include <qwt_plot_marker.h>
 #include <qwt_symbol.h>
 #include <qwt_text.h>
+*/
 
 #include <QVector>
 
@@ -75,8 +78,9 @@ public:
 	// Digits display
 	QWidget*                   digit_form_single;
 	QWidget*                   digit_form_double;
-	Ui::frmCaloDigitsSingle*   UiDigitsSingle;
-	Ui::frmCaloDigitsDouble*   UiDigitsDouble;
+
+//	Ui::frmCaloDigitsSingle*   UiDigitsSingle; // FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//	Ui::frmCaloDigitsDouble*   UiDigitsDouble; // FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
 
 	// at the beginning of every event reset these flags to FALSE
 	bool singlePlotHasData;
@@ -319,19 +323,21 @@ VP1CaloCellController::VP1CaloCellController(IVP1System* sys):
 	d->digit_form_double = new QWidget(0,Qt::WindowStaysOnTopHint);
 	d->digit_form_double->setVisible(false);
 
-	messageDebug("setting up digits box (s)");
-	d->UiDigitsSingle = new Ui::frmCaloDigitsSingle();
-	d->UiDigitsSingle->setupUi(d->digit_form_single);
-	d->UiDigitsSingle->plotDigits->setAxisTitle(QwtPlot::xBottom,"Bunch crossing");
-	d->UiDigitsSingle->plotDigits->setAxisTitle(QwtPlot::yLeft,"ADC counts");
-
-	messageDebug("setting up digits box (d)");
-	d->UiDigitsDouble = new Ui::frmCaloDigitsDouble();
-	d->UiDigitsDouble->setupUi(d->digit_form_double);
-	d->UiDigitsDouble->plotDigits_1->setAxisTitle(QwtPlot::xBottom,"Bunch crossing");
-	d->UiDigitsDouble->plotDigits_1->setAxisTitle(QwtPlot::yLeft,"ADC counts");
-	d->UiDigitsDouble->plotDigits_2->setAxisTitle(QwtPlot::xBottom,"Bunch crossing");
-	d->UiDigitsDouble->plotDigits_2->setAxisTitle(QwtPlot::yLeft,"ADC counts");
+//	// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//	messageDebug("setting up digits box (s)");
+//	d->UiDigitsSingle = new Ui::frmCaloDigitsSingle();
+//	d->UiDigitsSingle->setupUi(d->digit_form_single);
+//	d->UiDigitsSingle->plotDigits->setAxisTitle(QwtPlot::xBottom,"Bunch crossing");
+//	d->UiDigitsSingle->plotDigits->setAxisTitle(QwtPlot::yLeft,"ADC counts");
+//
+	// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//	messageDebug("setting up digits box (d)");
+//	d->UiDigitsDouble = new Ui::frmCaloDigitsDouble();
+//	d->UiDigitsDouble->setupUi(d->digit_form_double);
+//	d->UiDigitsDouble->plotDigits_1->setAxisTitle(QwtPlot::xBottom,"Bunch crossing");
+//	d->UiDigitsDouble->plotDigits_1->setAxisTitle(QwtPlot::yLeft,"ADC counts");
+//	d->UiDigitsDouble->plotDigits_2->setAxisTitle(QwtPlot::xBottom,"Bunch crossing");
+//	d->UiDigitsDouble->plotDigits_2->setAxisTitle(QwtPlot::yLeft,"ADC counts");
 	// --------------------- Digits Display -------------------------
 
 	// Fill Sel2Gui maps
@@ -845,6 +851,9 @@ void VP1CaloCellController::ClearHideDigitForms()
 void VP1CaloCellController::DeleteDigitForms()
 {
 	messageDebug("DeleteDigitForms()");
+
+	// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+	/*
 	if (d) {
 		messageDebug("delete digit_form_single...");
 		if (d->digit_form_single) {
@@ -868,6 +877,7 @@ void VP1CaloCellController::DeleteDigitForms()
 		}
 		messageDebug("DeleteDigitForms(). End.");
 	}
+    */
 }
 
 void VP1CaloCellController::EnableDigitsCheckbox(bool enable)
@@ -876,11 +886,14 @@ void VP1CaloCellController::EnableDigitsCheckbox(bool enable)
 }
 
 void VP1CaloCellController::displayLArDigits(
-		int n_samples,
-		std::vector<short> samples,
-		std::vector<std::string>& msg)
+		int /* n_samples */,
+		std::vector<short> /* samples */,
+		std::vector<std::string>& /* msg */)
 {
-	messageDebug("VP1CaloCellController::displayLArDigits()...");
+	message("VP1CaloCellController::displayLArDigits()... not be ported to 'master' yet, because of failing dependencies (LCG's Qwt has to be ported to Qt5, still)");
+
+	// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+/*
 
 	QwtPlot* plot = d->UiDigitsSingle->plotDigits;
 
@@ -932,18 +945,21 @@ void VP1CaloCellController::displayLArDigits(
 	// set the flag for the plot data
 	d->singlePlotHasData = true;
 	d->doublePlotHasData = false;
+    */
 
 	messageDebug("display LAr digits end.");
 }
 
-void VP1CaloCellController::displayTileDigits(int n_samples,
-		std::vector<float> samples1,
-		std::vector<float> samples2,
-		std::vector<std::string>& msg)
+void VP1CaloCellController::displayTileDigits(int /*n_samples*/,
+                                              std::vector<float> /*samples1*/,
+                                              std::vector<float> /*samples2*/,
+                                              std::vector<std::string>& /*msg*/)
 {
 
 	messageDebug("VP1CaloCellController::displayTileDigits(A)...");
 
+	// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+	/*
 	// Pop up the widget
 	d->digit_form_double->setVisible(true);
 	d->digit_form_single->setVisible(false);
@@ -963,13 +979,17 @@ void VP1CaloCellController::displayTileDigits(int n_samples,
 	// set the flag for the plot data
 	d->doublePlotHasData = true;
 	d->singlePlotHasData = false;
+	*/
 }
 
-void VP1CaloCellController::displayTileDigits(int n_samples,
-		std::vector<float> samples,
-		std::vector<std::string>& msg)
+void VP1CaloCellController::displayTileDigits(int /*n_samples*/,
+                                              std::vector<float> /*samples*/,
+                                              std::vector<std::string>& /*msg*/)
 {
 	messageDebug("VP1CaloCellController::displayTileDigits(B)...");
+
+	// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+	/*
 	// Pop up the widget
 	d->digit_form_single->setVisible(true);
 	d->digit_form_double->setVisible(false);
@@ -990,12 +1010,13 @@ void VP1CaloCellController::displayTileDigits(int n_samples,
 	// set the flag for the plot data
 	d->doublePlotHasData = true;
 	d->singlePlotHasData = false;
+	*/
 }
 
-void VP1CaloCellController::displayTilePulse(const TileRawChannel* rawchannel1,
-		const TileRawChannel* rawchannel2,
-		const TileRawChannelContainer* rawchannel_cont,
-		size_t digitsize)
+void VP1CaloCellController::displayTilePulse(const TileRawChannel* /*rawchannel1*/,
+                                             const TileRawChannel* /*rawchannel2*/,
+                                             const TileRawChannelContainer* /*rawchannel_cont*/,
+                                             size_t /*digitsize*/)
 {
 	messageDebug("VP1CaloCellController::displayTilePulse(A)...");
 
@@ -1010,32 +1031,35 @@ void VP1CaloCellController::displayTilePulse(const TileRawChannel* rawchannel1,
 	//			<< "h:" << digitsize
 	//			<< std::endl;
 
-	DrawTilePulse(d->UiDigitsDouble->plotDigits_1,
-			d->UiDigitsDouble->lblPMTGain_1,
-			rawchannel1,
-			rawchannel_cont,
-			digitsize);
-	std::cout << "Drawn digits_1" << std::endl;
-
-	DrawTilePulse(d->UiDigitsDouble->plotDigits_2,
-			d->UiDigitsDouble->lblPMTGain_2,
-			rawchannel2,
-			rawchannel_cont,
-			digitsize);
-	std::cout << "Drawn digits_2" << std::endl;
+
+	// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//	DrawTilePulse(d->UiDigitsDouble->plotDigits_1,
+//			d->UiDigitsDouble->lblPMTGain_1,
+//			rawchannel1,
+//			rawchannel_cont,
+//			digitsize);
+//	std::cout << "Drawn digits_1" << std::endl;
+//
+//	DrawTilePulse(d->UiDigitsDouble->plotDigits_2,
+//			d->UiDigitsDouble->lblPMTGain_2,
+//			rawchannel2,
+//			rawchannel_cont,
+//			digitsize);
+//	std::cout << "Drawn digits_2" << std::endl;
 }
 
-void VP1CaloCellController::displayTilePulse(const TileRawChannel* rawchannel,
-		const TileRawChannelContainer* rawchannel_cont,
-		size_t digitsize)
+void VP1CaloCellController::displayTilePulse(const TileRawChannel* /*rawchannel*/,
+                                             const TileRawChannelContainer* /*rawchannel_cont*/,
+                                             size_t /*digitsize*/)
 {
 	messageDebug("VP1CaloCellController::displayTilePulse(B)...");
 
-	DrawTilePulse(d->UiDigitsSingle->plotDigits,
-			d->UiDigitsSingle->lblPMTGain,
-			rawchannel,
-			rawchannel_cont,
-			digitsize);
+	// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//	DrawTilePulse(d->UiDigitsSingle->plotDigits,
+//			d->UiDigitsSingle->lblPMTGain,
+//			rawchannel,
+//			rawchannel_cont,
+//			digitsize);
 
 	messageDebug("displayTilePulse(). End.");
 }
@@ -1155,120 +1179,124 @@ VP1CC_GlobalCuts VP1CaloCellController::globalCuts() const
 	return globalCuts;
 }
 
-void VP1CaloCellController::DrawTileDigits(QwtPlot* plot,
-		int n_samples,
-		std::vector<float> samples)
-{
-	messageDebug("VP1CaloCellController::DrawTileDigits()...");
-
-	// Get data
-	QVector<QPointF> _data;
-	for(int ii=0; ii<n_samples;ii++) {
-		_data.push_back(QPointF(ii,samples[ii]));
-	}
-
-	// Create symbol
-	QwtSymbol* sym = new QwtSymbol();
-	sym->setStyle(QwtSymbol::Star1);
-	sym->setPen(QColor(Qt::red));
-	sym->setSize(5);
-
-	// Create curve
-	QwtPlotCurve* _curve = new QwtPlotCurve("ADC Counts");
-	_curve->setRenderHint(QwtPlotItem::RenderAntialiased);
-	_curve->setSamples(_data);
-	_curve->setStyle(QwtPlotCurve::NoCurve);
-	_curve->setPen(QPen(Qt::red));
-	_curve->setSymbol(sym);
-
-	// Attach curve to the hosting plot
-	_curve->attach(plot);
-
-	// Set the canvas background color
-	plot->setCanvasBackground( QBrush(Qt::white) );
-
-	// Refresh the plot
-	plot->replot();
-}
-
-void VP1CaloCellController::DrawTilePulse(QwtPlot* plot,
-		QLabel* gainlabel,
-		const TileRawChannel* rawchannel,
-		const TileRawChannelContainer* rawchannel_cont,
-		size_t digitsize)
-{
-	messageDebug("VP1CaloCellController::DrawTilePulse()...");
-
-	// convert amplitude
-	double _amplitude1 = rawchannel->amplitude();
-	HWIdentifier adc_hwid1 = rawchannel->adc_HWID();
-
-	std::ostringstream pmtgain1;
-
-//	std::cout << "DEBUG - "
-//			<< "_amplitude1: " <<_amplitude1 << " - "
-//			<< "adc_hwid1: " << adc_hwid1 << " - "
-//			<< "tile_hw_id ros: " << tile_hw_id->ros(adc_hwid1) << " - "
-//			<< "tile_hw_id channel: " << tile_hw_id->channel(adc_hwid1)
-//			<< std::endl;
-
-	pmtgain1 << " PMT " << tile_cabling->channel2hole(tile_hw_id->ros(adc_hwid1),tile_hw_id->channel(adc_hwid1))
-			   << "   Gain " << tile_hw_id->adc(adc_hwid1);
-
-	gainlabel->setText(pmtgain1.str().c_str());
-
-	std::cout << "DEBUG - Getting TileInfo..." << std::endl;
-	try {
-		_amplitude1 /= tile_info->ChannelCalib(adc_hwid1,
-				TileRawChannelUnit::ADCcounts,
-				rawchannel_cont->get_unit(),
-				rawchannel_cont->get_type());
-	} catch (TileCalib::InvalidRawChanUnit& e) {
-		std::cout << "ERROR!!! Exception caught from Tile! --> " << e.what() << std::endl;
-		std::cout << "re-throwing it..." << std::endl;
-		throw e;
-	}
-
-
-
-	// Get correct vector of values depending on the gain
-	std::vector<double> *xval, *yval;
-	if(tile_hw_id->adc(adc_hwid1) == 0)
-	{
-		xval = &(tile_info->getPulseShapes()->m_tlphys);
-		yval = &(tile_info->getPulseShapes()->m_ylphys);
-	}
-	else if(tile_hw_id->adc(adc_hwid1) == 1)
-	{
-		xval = &(tile_info->getPulseShapes()->m_thphys);
-		yval = &(tile_info->getPulseShapes()->m_yhphys);
-	}
-	else
-		return;
-
-	// Prepare data for plotting
-	QVector<QPointF> _data;
-	for(size_t i=0; i<xval->size(); i++) {
-		double xpoint = ((*xval)[i] + rawchannel->time())/25. + (digitsize - 1)/2.;
-		double ypoint = rawchannel->pedestal() + _amplitude1*(*yval)[i];
-
-		if(xpoint >= 0 && xpoint <= digitsize -1)
-			_data.push_back(QPointF(xpoint,ypoint));
-	}
-
-	// Create curve
-	QwtPlotCurve* _curve = new QwtPlotCurve("Pulse");
-	_curve->setRenderHint(QwtPlotItem::RenderAntialiased);
-	_curve->setSamples(_data);
-	_curve->setStyle(QwtPlotCurve::Dots);
-	_curve->setPen(QPen(Qt::blue));
-
-	// Attach the curve to the hosting plot
-	_curve->attach(plot);
-
-	// Refresh the plot
-	plot->replot();
-}
+// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//void VP1CaloCellController::DrawTileDigits(QwtPlot* plot,
+//		int n_samples,
+//		std::vector<float> samples)
+//{
+//	messageDebug("VP1CaloCellController::DrawTileDigits()...");
+//
+//	// Get data
+//	QVector<QPointF> _data;
+//	for(int ii=0; ii<n_samples;ii++) {
+//		_data.push_back(QPointF(ii,samples[ii]));
+//	}
+//
+//	// Create symbol
+//	QwtSymbol* sym = new QwtSymbol();
+//	sym->setStyle(QwtSymbol::Star1);
+//	sym->setPen(QColor(Qt::red));
+//	sym->setSize(5);
+//
+//	// Create curve
+//	QwtPlotCurve* _curve = new QwtPlotCurve("ADC Counts");
+//	_curve->setRenderHint(QwtPlotItem::RenderAntialiased);
+//	_curve->setSamples(_data);
+//	_curve->setStyle(QwtPlotCurve::NoCurve);
+//	_curve->setPen(QPen(Qt::red));
+//	_curve->setSymbol(sym);
+//
+//	// Attach curve to the hosting plot
+//	_curve->attach(plot);
+//
+//	// Set the canvas background color
+//	plot->setCanvasBackground( QBrush(Qt::white) );
+//
+//	// Refresh the plot
+//	plot->replot();
+//}
+//
+
+
+// FIXME:You have to compile Qwt with Qt5. LCG's Qwt is compiled with Qt4 only...
+//void VP1CaloCellController::DrawTilePulse(QwtPlot* plot,
+//		QLabel* gainlabel,
+//		const TileRawChannel* rawchannel,
+//		const TileRawChannelContainer* rawchannel_cont,
+//		size_t digitsize)
+//{
+//	messageDebug("VP1CaloCellController::DrawTilePulse()...");
+//
+//	// convert amplitude
+//	double _amplitude1 = rawchannel->amplitude();
+//	HWIdentifier adc_hwid1 = rawchannel->adc_HWID();
+//
+//	std::ostringstream pmtgain1;
+//
+////	std::cout << "DEBUG - "
+////			<< "_amplitude1: " <<_amplitude1 << " - "
+////			<< "adc_hwid1: " << adc_hwid1 << " - "
+////			<< "tile_hw_id ros: " << tile_hw_id->ros(adc_hwid1) << " - "
+////			<< "tile_hw_id channel: " << tile_hw_id->channel(adc_hwid1)
+////			<< std::endl;
+//
+//	pmtgain1 << " PMT " << tile_cabling->channel2hole(tile_hw_id->ros(adc_hwid1),tile_hw_id->channel(adc_hwid1))
+//			   << "   Gain " << tile_hw_id->adc(adc_hwid1);
+//
+//	gainlabel->setText(pmtgain1.str().c_str());
+//
+//	std::cout << "DEBUG - Getting TileInfo..." << std::endl;
+//	try {
+//		_amplitude1 /= tile_info->ChannelCalib(adc_hwid1,
+//				TileRawChannelUnit::ADCcounts,
+//				rawchannel_cont->get_unit(),
+//				rawchannel_cont->get_type());
+//	} catch (TileCalib::InvalidRawChanUnit& e) {
+//		std::cout << "ERROR!!! Exception caught from Tile! --> " << e.what() << std::endl;
+//		std::cout << "re-throwing it..." << std::endl;
+//		throw e;
+//	}
+//
+//
+//
+//	// Get correct vector of values depending on the gain
+//	std::vector<double> *xval, *yval;
+//	if(tile_hw_id->adc(adc_hwid1) == 0)
+//	{
+//		xval = &(tile_info->getPulseShapes()->m_tlphys);
+//		yval = &(tile_info->getPulseShapes()->m_ylphys);
+//	}
+//	else if(tile_hw_id->adc(adc_hwid1) == 1)
+//	{
+//		xval = &(tile_info->getPulseShapes()->m_thphys);
+//		yval = &(tile_info->getPulseShapes()->m_yhphys);
+//	}
+//	else
+//		return;
+//
+//	// Prepare data for plotting
+//	QVector<QPointF> _data;
+//	for(size_t i=0; i<xval->size(); i++) {
+//		double xpoint = ((*xval)[i] + rawchannel->time())/25. + (digitsize - 1)/2.;
+//		double ypoint = rawchannel->pedestal() + _amplitude1*(*yval)[i];
+//
+//		if(xpoint >= 0 && xpoint <= digitsize -1)
+//			_data.push_back(QPointF(xpoint,ypoint));
+//	}
+//
+//	// Create curve
+//	QwtPlotCurve* _curve = new QwtPlotCurve("Pulse");
+//	_curve->setRenderHint(QwtPlotItem::RenderAntialiased);
+//	_curve->setSamples(_data);
+//	_curve->setStyle(QwtPlotCurve::Dots);
+//	_curve->setPen(QPen(Qt::blue));
+//
+//	// Attach the curve to the hosting plot
+//	_curve->attach(plot);
+//
+//	// Refresh the plot
+//	plot->replot();
+//}
 
 // --------------------- SLOTS ------------------------
 void VP1CaloCellController::enableUpperThreshold()
diff --git a/graphics/VP1/VP1Systems/VP1CaloSystems/src/VP1CaloCellSystem.cxx b/graphics/VP1/VP1Systems/VP1CaloSystems/src/VP1CaloCellSystem.cxx
index 4db9693a521..c3bcc75d44d 100644
--- a/graphics/VP1/VP1Systems/VP1CaloSystems/src/VP1CaloCellSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1CaloSystems/src/VP1CaloCellSystem.cxx
@@ -40,7 +40,7 @@
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/Bootstrap.h"
 #include "GaudiKernel/IToolSvc.h"
-#include "LArTools/LArCablingService.h"
+#include "LArCabling/LArCablingService.h"
 #include "LArIdentifier/LArOnlineID.h"
 #include "LArRawEvent/LArDigitContainer.h"
 #include "TileEvent/TileDigitsContainer.h"
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandleBase.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandleBase.h
index b91e0500172..df4ca2956f5 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandleBase.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandleBase.h
@@ -87,7 +87,7 @@ private slots:
   void detailComboBoxItemChanged();
 
 protected:
-  virtual PRDHandleBase* addPRD(Trk::PrepRawData*) = 0;//Return pointer to the handle. Base class (this) will own it.
+  virtual PRDHandleBase* addPRD(const Trk::PrepRawData*) = 0;//Return pointer to the handle. Base class (this) will own it.
 
   virtual DETAIL defaultDetailLevel() const { return AUTO; }
   //Use to loop over prds in derived classes:
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_CSC.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_CSC.h
index 30aafad901e..30aa14bc55b 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_CSC.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_CSC.h
@@ -24,7 +24,7 @@ public slots:
   void setProjectionMode( bool );
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
   bool cut(PRDHandleBase*) { return true; }//accept all
   void setupSettingsFromControllerSpecific(PRDSystemController*);
   float lodArea() const { return 800.0f*800.0f; }
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_CSC_Strip.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_CSC_Strip.h
index 544b0129731..13a98e390e7 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_CSC_Strip.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_CSC_Strip.h
@@ -24,7 +24,7 @@ public slots:
   void setProjectionMode( bool );
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
   bool cut(PRDHandleBase*) { return true; }//accept all
   void setupSettingsFromControllerSpecific(PRDSystemController*);
   float lodArea() const { return 800.0f*800.0f; }
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_MDT.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_MDT.h
index 1e162281033..9c24536f216 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_MDT.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_MDT.h
@@ -38,9 +38,9 @@ public slots:
   void muonChambersTouchedByTracksChanged(void);//!< Inform this handle that it might need to recheck cuts 
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
 
-  virtual DETAIL defaultDetailLevel() const { return DETAILED; }
+  virtual DETAIL defaultDetailLevel() const override { return DETAILED; }
 
   bool cut(PRDHandleBase*);
 
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_MM.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_MM.h
index b3569ec42ae..328b2f2f68a 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_MM.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_MM.h
@@ -38,9 +38,9 @@ public slots:
   void muonChambersTouchedByTracksChanged(void);//!< Inform this handle that it might need to recheck cuts 
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
 
-  virtual DETAIL defaultDetailLevel() const { return DETAILED; }
+  virtual DETAIL defaultDetailLevel() const override { return DETAILED; }
 
   bool cut(PRDHandleBase*);
 
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_Pixel.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_Pixel.h
index 638a0f660e6..d2d690b67a3 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_Pixel.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_Pixel.h
@@ -24,13 +24,13 @@ public slots:
   void setMinNRDOPerCluster(unsigned);
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
   bool cut(PRDHandleBase*);
 
   void setupSettingsFromControllerSpecific(PRDSystemController*);
   float lodArea() const { return 800.0f*800.0f; }
   QColor defaultColor() const;
-  virtual DETAIL defaultDetailLevel() const { return AUTO; }
+  virtual DETAIL defaultDetailLevel() const override { return AUTO; }
   //  virtual DETAIL defaultDetailLevel() const { return SIMPLE; }
 
 private:
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_RPC.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_RPC.h
index 8a40a5c1f31..cfdc9a8d094 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_RPC.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_RPC.h
@@ -24,7 +24,7 @@ public slots:
   void setProjectionMode( bool );
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
   bool cut(PRDHandleBase*) { return true; }//accept all
   void setupSettingsFromControllerSpecific(PRDSystemController*);
   float lodArea() const { return 650.0f*650.0f; }
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_SCT.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_SCT.h
index ecafde3ae21..65affc50ab6 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_SCT.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_SCT.h
@@ -24,7 +24,7 @@ public slots:
   void setExcludeIsolatedClusters(bool);
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
   bool cut(PRDHandleBase*);
 
   void eraseEventDataSpecific();
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_SpacePoints.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_SpacePoints.h
index 2ab88bf9336..b1ae4ab32de 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_SpacePoints.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_SpacePoints.h
@@ -34,7 +34,7 @@ public:
   virtual ~PRDCollHandle_SpacePoints();
 
 protected:
-  PRDHandleBase* addPRD(Trk::PrepRawData*) { return 0; }
+  virtual PRDHandleBase* addPRD(const Trk::PrepRawData*) override { return 0; }
   bool load();
   bool cut(PRDHandleBase*);
   void eraseEventDataSpecific();
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_TGC.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_TGC.h
index 87b0e80d14e..31f82957541 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_TGC.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_TGC.h
@@ -24,7 +24,7 @@ public slots:
   void setProjectionMode( bool );
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
   bool cut(PRDHandleBase*) { return true; }//accept all
   void setupSettingsFromControllerSpecific(PRDSystemController*);
   float lodArea() const { return 1000.0f*1000.0f; }
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_TRT.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_TRT.h
index 52736ea01cf..3f642736b9c 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_TRT.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_TRT.h
@@ -36,7 +36,7 @@ public slots:
   void setAppropriateProjection(InDetProjFlags::InDetProjPartsFlags);
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
   bool cut(PRDHandleBase*);
 
   void setupSettingsFromControllerSpecific(PRDSystemController*);
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_sTGC.h b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_sTGC.h
index b1bf85b00b6..40c0cc1e1b2 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_sTGC.h
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/VP1PRDSystems/PRDCollHandle_sTGC.h
@@ -24,7 +24,7 @@ public slots:
   void setProjectionMode( bool );
 
 protected:
-  PRDHandleBase * addPRD(Trk::PrepRawData*);
+  virtual PRDHandleBase * addPRD(const Trk::PrepRawData*) override;
   bool cut(PRDHandleBase*) { return true; }//accept all
   void setupSettingsFromControllerSpecific(PRDSystemController*);
   float lodArea() const { return 1000.0f*1000.0f; }
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_CSC.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_CSC.cxx
index 3bac9a12cb4..0bf9c193529 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_CSC.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_CSC.cxx
@@ -59,10 +59,10 @@ void PRDCollHandle_CSC::setupSettingsFromControllerSpecific(PRDSystemController*
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_CSC::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_CSC::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<Muon::CscPrepData*>(prd));
-  return new PRDHandle_CSC(this,static_cast<Muon::CscPrepData*>(prd));
+  assert(dynamic_cast<const Muon::CscPrepData*>(prd));
+  return new PRDHandle_CSC(this,static_cast<const Muon::CscPrepData*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_CSC_Strip.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_CSC_Strip.cxx
index 3a758adee70..67e4281479b 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_CSC_Strip.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_CSC_Strip.cxx
@@ -59,10 +59,10 @@ void PRDCollHandle_CSC_Strip::setupSettingsFromControllerSpecific(PRDSystemContr
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_CSC_Strip::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_CSC_Strip::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<Muon::CscStripPrepData*>(prd));
-  return new PRDHandle_CSC_Strip(this,static_cast<Muon::CscStripPrepData*>(prd));
+  assert(dynamic_cast<const Muon::CscStripPrepData*>(prd));
+  return new PRDHandle_CSC_Strip(this,static_cast<const Muon::CscStripPrepData*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_MDT.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_MDT.cxx
index cb979b756d2..2a1913dfc80 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_MDT.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_MDT.cxx
@@ -63,10 +63,10 @@ QColor PRDCollHandle_MDT::defaultColor() const
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_MDT::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_MDT::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<Muon::MdtPrepData*>(prd));
-  return new PRDHandle_MDT(this,static_cast<Muon::MdtPrepData*>(prd));
+  assert(dynamic_cast<const Muon::MdtPrepData*>(prd));
+  return new PRDHandle_MDT(this,static_cast<const Muon::MdtPrepData*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_MM.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_MM.cxx
index f256b301c62..905b98fc505 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_MM.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_MM.cxx
@@ -63,10 +63,10 @@ QColor PRDCollHandle_MM::defaultColor() const
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_MM::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_MM::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<Muon::MMPrepData*>(prd));
-  return new PRDHandle_MM(this,static_cast<Muon::MMPrepData*>(prd));
+  assert(dynamic_cast<const Muon::MMPrepData*>(prd));
+  return new PRDHandle_MM(this,static_cast<const Muon::MMPrepData*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_Pixel.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_Pixel.cxx
index 71d20391316..25e95f88244 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_Pixel.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_Pixel.cxx
@@ -46,10 +46,10 @@ QColor PRDCollHandle_Pixel::defaultColor() const
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_Pixel::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_Pixel::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<InDet::PixelCluster*>(prd));
-  return new PRDHandle_Pixel(this,static_cast<InDet::PixelCluster*>(prd));
+  assert(dynamic_cast<const InDet::PixelCluster*>(prd));
+  return new PRDHandle_Pixel(this,static_cast<const InDet::PixelCluster*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_RPC.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_RPC.cxx
index d535c498083..5714113d059 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_RPC.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_RPC.cxx
@@ -57,10 +57,10 @@ void PRDCollHandle_RPC::setupSettingsFromControllerSpecific(PRDSystemController*
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_RPC::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_RPC::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<Muon::RpcPrepData*>(prd));
-  return new PRDHandle_RPC(this,static_cast<Muon::RpcPrepData*>(prd));
+  assert(dynamic_cast<const Muon::RpcPrepData*>(prd));
+  return new PRDHandle_RPC(this,static_cast<const Muon::RpcPrepData*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_SCT.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_SCT.cxx
index 7ce6ea0bce2..5b43f497a1f 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_SCT.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_SCT.cxx
@@ -48,10 +48,10 @@ QColor PRDCollHandle_SCT::defaultColor() const
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_SCT::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_SCT::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<InDet::SCT_Cluster*>(prd));
-  return new PRDHandle_SCT(this,static_cast<InDet::SCT_Cluster*>(prd));
+  assert(dynamic_cast<const InDet::SCT_Cluster*>(prd));
+  return new PRDHandle_SCT(this,static_cast<const InDet::SCT_Cluster*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_TGC.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_TGC.cxx
index e1edb8a1dc2..e2255049f21 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_TGC.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_TGC.cxx
@@ -57,10 +57,10 @@ void PRDCollHandle_TGC::setupSettingsFromControllerSpecific(PRDSystemController*
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_TGC::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_TGC::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<Muon::TgcPrepData*>(prd));
-  return new PRDHandle_TGC(this,static_cast<Muon::TgcPrepData*>(prd));
+  assert(dynamic_cast<const Muon::TgcPrepData*>(prd));
+  return new PRDHandle_TGC(this,static_cast<const Muon::TgcPrepData*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_TRT.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_TRT.cxx
index 62b7d1703f2..587f3969b00 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_TRT.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_TRT.cxx
@@ -73,10 +73,10 @@ QColor PRDCollHandle_TRT::defaultColor() const
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_TRT::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_TRT::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<InDet::TRT_DriftCircle*>(prd));
-  return new PRDHandle_TRT(this,static_cast<InDet::TRT_DriftCircle*>(prd));
+  assert(dynamic_cast<const InDet::TRT_DriftCircle*>(prd));
+  return new PRDHandle_TRT(this,static_cast<const InDet::TRT_DriftCircle*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_sTGC.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_sTGC.cxx
index 023a2678b91..c41b2717a48 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_sTGC.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandle_sTGC.cxx
@@ -57,10 +57,10 @@ void PRDCollHandle_sTGC::setupSettingsFromControllerSpecific(PRDSystemController
 }
 
 //____________________________________________________________________
-PRDHandleBase* PRDCollHandle_sTGC::addPRD( Trk::PrepRawData * prd )
+PRDHandleBase* PRDCollHandle_sTGC::addPRD( const Trk::PrepRawData * prd )
 {
-  assert(dynamic_cast<Muon::sTgcPrepData*>(prd));
-  return new PRDHandle_sTGC(this,static_cast<Muon::sTgcPrepData*>(prd));
+  assert(dynamic_cast<const Muon::sTgcPrepData*>(prd));
+  return new PRDHandle_sTGC(this,static_cast<const Muon::sTgcPrepData*>(prd));
 }
 
 //____________________________________________________________________
diff --git a/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem3.h b/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem3.h
index b155ac7c169..25b6b140eef 100755
--- a/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem3.h
+++ b/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem3.h
@@ -35,7 +35,7 @@ public:
   void userPickedNode(SoNode* pickedNode, SoPath * pickedPath);
 
 private:
-  std::map<SoNode*,Trk::Track *> m_nodeToTrack;
+  std::map<SoNode*,const Trk::Track *> m_nodeToTrack;
 
 };
 
diff --git a/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem4.h b/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem4.h
index 74d694dff12..cab48294f62 100755
--- a/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem4.h
+++ b/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem4.h
@@ -40,7 +40,7 @@ private slots:
   void ptCutChanged(double);
 
 private:
-  std::map<SoNode*,Trk::Track *> m_nodeToTrack;
+  std::map<SoNode*,const Trk::Track *> m_nodeToTrack;
   std::map<SoSwitch*,double> m_switchToPt;
   double m_ptcut;
 };
diff --git a/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem5.h b/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem5.h
index b11aa7a8c6e..837238aed7a 100755
--- a/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem5.h
+++ b/graphics/VP1/VP1Systems/VP1TestSystems/VP1TestSystems/Example3DSystem5.h
@@ -43,7 +43,7 @@ private slots:
   void updateSelectionMode( bool single );
 
 private:
-  std::map<SoNode*,Trk::Track *> m_nodeToTrack;
+  std::map<SoNode*,const Trk::Track *> m_nodeToTrack;
   std::map<SoSwitch*,double> m_switchToPt;
   double m_ptcut;
   SoCooperativeSelection * m_multiselection;
diff --git a/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem2.cxx b/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem2.cxx
index b4d54aa5599..837bdb67916 100755
--- a/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem2.cxx
+++ b/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem2.cxx
@@ -57,7 +57,7 @@ void Example3DSystem2::buildEventSceneGraph(StoreGateSvc* sg, SoSeparator *root)
   TrackCollection::const_iterator trackItr, trackItrEnd = trackColl->end();
 
   for ( trackItr = trackColl->begin() ; trackItr != trackItrEnd; ++trackItr) {
-      Trk::Track *track = (*trackItr);
+      const Trk::Track *track = (*trackItr);
       const DataVector<const Trk::TrackParameters> *params = track->trackParameters();
 
       //Just a sanity check:
diff --git a/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem3.cxx b/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem3.cxx
index e954825a35e..83574aea7db 100755
--- a/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem3.cxx
+++ b/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem3.cxx
@@ -63,7 +63,7 @@ void Example3DSystem3::buildEventSceneGraph(StoreGateSvc* sg, SoSeparator *root)
   TrackCollection::const_iterator trackItr, trackItrEnd = trackColl->end();
 
   for ( trackItr = trackColl->begin() ; trackItr != trackItrEnd; ++trackItr) {
-      Trk::Track *track = (*trackItr);
+      const Trk::Track *track = (*trackItr);
       const DataVector<const Trk::TrackParameters> *params = track->trackParameters();
 
       //Just a sanity check (we need at least two points on the track):
diff --git a/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem4.cxx b/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem4.cxx
index 1bf3feb800b..2d704eb94dc 100755
--- a/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem4.cxx
+++ b/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem4.cxx
@@ -66,7 +66,7 @@ void Example3DSystem4::buildEventSceneGraph(StoreGateSvc* sg, SoSeparator *root)
   TrackCollection::const_iterator trackItr, trackItrEnd = trackColl->end();
 
   for ( trackItr = trackColl->begin() ; trackItr != trackItrEnd; ++trackItr) {
-      Trk::Track *track = (*trackItr);
+      const Trk::Track *track = (*trackItr);
       const DataVector<const Trk::TrackParameters> *params = track->trackParameters();
 
       //Just a sanity check (we need at least two points on the track):
diff --git a/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem5.cxx b/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem5.cxx
index bc02f3a41e2..3a0f52bf1f7 100755
--- a/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem5.cxx
+++ b/graphics/VP1/VP1Systems/VP1TestSystems/src/Example3DSystem5.cxx
@@ -90,7 +90,7 @@ void Example3DSystem5::buildEventSceneGraph(StoreGateSvc* sg, SoSeparator *root)
   TrackCollection::const_iterator trackItr, trackItrEnd = trackColl->end();
 
   for ( trackItr = trackColl->begin() ; trackItr != trackItrEnd; ++trackItr) {
-      Trk::Track *track = (*trackItr);
+      const Trk::Track *track = (*trackItr);
       const DataVector<const Trk::TrackParameters> *params = track->trackParameters();
 
       //Just a sanity check (we need at least two points on the track):
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TruthTracks.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TruthTracks.cxx
index 857c709af2d..dca12c3d770 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TruthTracks.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TruthTracks.cxx
@@ -359,7 +359,7 @@ bool TrackCollHandle_TruthTracks::Imp::loadGenParticles( std::map<SimBarCode,con
 
   for (;itEvt!=itEvtEnd;++itEvt) {
     //NB: Signal is always the first event in collection!
-    HepMC::GenEvent * evt = *itEvt;
+    const HepMC::GenEvent * evt = *itEvt;
     if (!evt)
       continue;
     HepMC::GenEvent::vertex_const_iterator itVtx(evt->vertices_begin()), itVtxEnd(evt->vertices_end());
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TrkTrack.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TrkTrack.cxx
index 37a9c3f7be9..b860730af6a 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TrkTrack.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TrkTrack.cxx
@@ -123,11 +123,10 @@ void TrackHandle_TrkTrack::ensureTouchedMuonChambersInitialiasedFromMeas( const
 //____________________________________________________________________
 Amg::Vector3D TrackHandle_TrkTrack::momentum() const
 {
-  std::vector<const Trk::TrackParameters*>::const_iterator it,itE=m_trk->trackParameters()->end();
-  for (it=m_trk->trackParameters()->begin();it!=itE;++it) {
-    if (!common()->trackSanityHelper()->isSafe(*it))
+  for (const Trk::TrackParameters* param : *m_trk->trackParameters()) {
+    if (!common()->trackSanityHelper()->isSafe(param))
       continue;
-    return (*it)->momentum();
+    return param->momentum();
   }
   return TrackHandleBase::momentum();
 }
diff --git a/graphics/VP1/VP1Systems/VP1UtilitySystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1UtilitySystems/CMakeLists.txt
index bc32b82c87d..02d6519ada7 100644
--- a/graphics/VP1/VP1Systems/VP1UtilitySystems/CMakeLists.txt
+++ b/graphics/VP1/VP1Systems/VP1UtilitySystems/CMakeLists.txt
@@ -16,7 +16,7 @@ atlas_depends_on_subdirs( PUBLIC
 # External dependencies:
 find_package( Coin3D )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
-find_package( Qt5 COMPONENTS Core Gui  Widgets )
+find_package( Qt5 COMPONENTS Core Gui  Widgets PrintSupport)
 
 # Generate UI files automatically:
 set( CMAKE_AUTOUIC TRUE )
@@ -33,6 +33,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
 atlas_add_library( VP1UtilitySystems VP1UtilitySystems/*.h src/*.h src/*.cxx src/*.qrc  
                    PUBLIC_HEADERS VP1UtilitySystems
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${COIN3D_INCLUDE_DIRS}
-                   LINK_LIBRARIES VP1Base GL
+                   LINK_LIBRARIES VP1Base GL Qt5::PrintSupport
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${COIN3D_LIBRARIES} QatDataAnalysis QatPlotWidgets QatPlotting )
 
diff --git a/graphics/VP1/VP1Systems/VP1UtilitySystems/VP1UtilitySystems/VP1PartSpectSystem.h b/graphics/VP1/VP1Systems/VP1UtilitySystems/VP1UtilitySystems/VP1PartSpectSystem.h
index 30232e73c46..087a8a84935 100644
--- a/graphics/VP1/VP1Systems/VP1UtilitySystems/VP1UtilitySystems/VP1PartSpectSystem.h
+++ b/graphics/VP1/VP1Systems/VP1UtilitySystems/VP1UtilitySystems/VP1PartSpectSystem.h
@@ -15,6 +15,7 @@
 /////////////////////////////////////////////////////////////////////////
 
 #include "VP1Base/IVP13DSystemSimple.h"
+
 #include <QStack>
 #include <QString>
 
diff --git a/graphics/VP1/VP1Systems/VP1UtilitySystems/src/VP1ExtraInputSystem.cxx b/graphics/VP1/VP1Systems/VP1UtilitySystems/src/VP1ExtraInputSystem.cxx
index a21f58f955a..615202af556 100644
--- a/graphics/VP1/VP1Systems/VP1UtilitySystems/src/VP1ExtraInputSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1UtilitySystems/src/VP1ExtraInputSystem.cxx
@@ -3,16 +3,19 @@
 */
 
 #include "VP1UtilitySystems/VP1ExtraInputSystem.h"
+#include "ui_extrainputcontrollerform.h"
+
 #include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
 #include "VP1Base/VP1Settings.h"
-#include "ui_extrainputcontrollerform.h"
+
 #include <Inventor/nodes/SoSeparator.h>
 #include <Inventor/nodes/SoPickStyle.h>
 #include <Inventor/nodes/SoLightModel.h>
 #include <Inventor/nodes/SoMaterial.h>
 #include <Inventor/nodes/SoSwitch.h>
+
 #include <QFileDialog>
 #include <QDir>
 #include <map>
diff --git a/graphics/VP1/VP1Systems/VP1UtilitySystems/src/VP1PartSpectSystem.cxx b/graphics/VP1/VP1Systems/VP1UtilitySystems/src/VP1PartSpectSystem.cxx
index a8819efb07f..0a740943ce4 100644
--- a/graphics/VP1/VP1Systems/VP1UtilitySystems/src/VP1PartSpectSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1UtilitySystems/src/VP1PartSpectSystem.cxx
@@ -8,11 +8,14 @@
 #include "VP1Base/VP1Deserialise.h"
 #include "VP1Base/VP1Serialise.h"
 
+/* --- FIXME: Qat has still to be ported to Qt5 I think...
 // Plotting
-#include "QatPlotting/PlotStream.h"
-#include "QatPlotWidgets/PlotView.h"
-#include "QatDataAnalysis/Hist1D.h"
-#include "QatPlotting/PlotHist1D.h"
+//#include "QatPlotting/PlotStream.h"
+//#include "QatPlotWidgets/PlotView.h"
+//#include "QatDataAnalysis/Hist1D.h"
+//#include "QatPlotting/PlotHist1D.h"
+ */
+
 #include <QMainWindow>
 #include <QToolBar>
 #include <QAction>
@@ -22,6 +25,8 @@
 #include "TH1F.h"
 #include "TKey.h"
 #include <sstream>
+
+
 class VP1PartSpectSystem::Imp {
 public:
   Imp();
@@ -159,11 +164,11 @@ void VP1PartSpectSystem::plotSpectrum(QStack<QString>& path, int copyNumber)
   while(path.size()>1){
     QString dirBase= path.pop().replace(QString("::"),QString("_"));
     QString directory=dirBase;
-    if(!gDirectory->cd(directory.toAscii())) {
+    if(!gDirectory->cd(directory.toLatin1())) {
       directory = (dirBase.toStdString()+"_"+copyNumberStream.str()).c_str();
-      if (!gDirectory->cd(directory.toAscii())) {
+      if (!gDirectory->cd(directory.toLatin1())) {
 	directory = (dirBase.toStdString()+"_0").c_str();
-	if (!gDirectory->cd(directory.toAscii())) {
+	if (!gDirectory->cd(directory.toLatin1())) {
 	  message(QString("Unable to cd to ") + directory);
 	  return;
 	} else {
@@ -239,6 +244,7 @@ void VP1PartSpectSystem::plotSpectrum(QStack<QString>& path, int copyNumber)
     return;
   }
 
+  /* FIXME: Qat has to be ported to Qt5...
   // ___________ Plotting _______________
 
   // Create new window for the plot
@@ -315,6 +321,11 @@ void VP1PartSpectSystem::plotSpectrum(QStack<QString>& path, int copyNumber)
   delete prop;
   prop=nullptr;
   // ___________ Plotting _______________
+  */
+
+
+
+
 }
 
 void VP1PartSpectSystem::fileUpdated(const QString& fileName)
-- 
GitLab