diff --git a/Calorimeter/CaloG4Sim/CMakeLists.txt b/Calorimeter/CaloG4Sim/CMakeLists.txt
index 53468bfb437eacc021d1192cafc167fe52fbb977..7e03ef082d010d520b212cecd69e73d0ad4fca07 100644
--- a/Calorimeter/CaloG4Sim/CMakeLists.txt
+++ b/Calorimeter/CaloG4Sim/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_add_library( CaloG4SimLib
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} AthenaBaseComps GaudiKernel G4AtlasInterfaces G4AtlasToolsLib
                    PRIVATE_LINK_LIBRARIES CxxUtils MCTruth )
+set_target_properties( CaloG4SimLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( CaloG4Sim
                    src/components/*.cxx
@@ -28,6 +29,7 @@ atlas_add_library( CaloG4Sim
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} AthenaBaseComps GaudiKernel G4AtlasInterfaces G4AtlasToolsLib CxxUtils CaloG4SimLib )
+set_target_properties( CaloG4Sim PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Control/AthenaMonitoring/python/AthenaMonitoringCfg.py b/Control/AthenaMonitoring/python/AthenaMonitoringCfg.py
index 4f48f4401c22ee793d0d50ddbe923a4e8b08272d..87e3cf4f87108fb944b0fe95f9facefcd7442e1a 100644
--- a/Control/AthenaMonitoring/python/AthenaMonitoringCfg.py
+++ b/Control/AthenaMonitoring/python/AthenaMonitoringCfg.py
@@ -9,6 +9,7 @@ def AthenaMonitoringCfg(flags):
     local_logger = logging.getLogger('AthenaMonitoringCfg')
     info = local_logger.info
     debug = local_logger.debug
+    warning = local_logger.warning
     error = local_logger.error
     result = ComponentAccumulator()
 
@@ -62,6 +63,11 @@ def AthenaMonitoringCfg(flags):
 
     if flags.DQ.Steering.doHLTMon:
         info('Set up HLT monitoring')
+        if flags.DQ.Environment == 'AOD':
+            warning("HLT Monitoring enabled on AOD: this might cause issues as not all HLT collections are written to standard AOD!")
+            if not flags.Input.isMC:
+                error("HLT monitoring on data AOD input is not allowed - not all HLT collections are recorded to AOD!")
+                raise ValueError("HLT monitoring enabled on data AOD input.")
         from TrigHLTMonitoring.TrigHLTMonitorAlgorithm import TrigHLTMonTopConfig
         result.merge(TrigHLTMonTopConfig(flags))
 
diff --git a/Control/AthenaMonitoring/python/DQConfigFlags.py b/Control/AthenaMonitoring/python/DQConfigFlags.py
index f75753e366c374837a04f020458649eb1ff9f4ad..41a64e17cfa150402a986a3e36dd16e5ee559ede 100644
--- a/Control/AthenaMonitoring/python/DQConfigFlags.py
+++ b/Control/AthenaMonitoring/python/DQConfigFlags.py
@@ -63,7 +63,8 @@ def createDQConfigFlags():
             arg = lambda x: x.DQ.DataType is not DQDataType.Cosmics # noqa: E731
         if flag == 'doHLTMon':
             # new HLT monitoring not yet compatible with pre-Run 3 data
-            arg = lambda x: x.Trigger.EDMVersion == 3 # noqa: E731
+            # disable HLT monitoring if input is data AOD as not all HLT collections in AOD - ATR-28781
+            arg = lambda x: x.Trigger.EDMVersion == 3 and x.DQ.Environment != 'AOD' # noqa: E731
         if flag == 'LVL1Calo.doValidation':
             arg = False
             
diff --git a/ForwardDetectors/AFP/AFP_G4_SD/CMakeLists.txt b/ForwardDetectors/AFP/AFP_G4_SD/CMakeLists.txt
index 3abc926c731f865c0fa4742240f67b759cd247b6..b4b6444db3ccef471dbf28942f04bd762352bebb 100644
--- a/ForwardDetectors/AFP/AFP_G4_SD/CMakeLists.txt
+++ b/ForwardDetectors/AFP/AFP_G4_SD/CMakeLists.txt
@@ -14,12 +14,14 @@ atlas_add_library( AFP_G4_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} AFP_Geometry AFP_SimEv G4AtlasToolsLib StoreGateLib )
+set_target_properties( AFP_G4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( AFP_G4_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES AFP_G4_SDLib )
+set_target_properties( AFP_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/ForwardDetectors/ALFA/ALFA_G4_SD/CMakeLists.txt b/ForwardDetectors/ALFA/ALFA_G4_SD/CMakeLists.txt
index ef0ca4b672d26a31cbd71d65a096b09dc6b13fb0..6505cf089ada824f35244e13048c9e50255e7b8f 100644
--- a/ForwardDetectors/ALFA/ALFA_G4_SD/CMakeLists.txt
+++ b/ForwardDetectors/ALFA/ALFA_G4_SD/CMakeLists.txt
@@ -14,12 +14,14 @@ atlas_add_library( ALFA_G4_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} ALFA_SimEv G4AtlasToolsLib StoreGateLib )
+set_target_properties( ALFA_G4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( ALFA_G4_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES ALFA_G4_SDLib )
+set_target_properties( ALFA_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/CMakeLists.txt b/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/CMakeLists.txt
index 655a9d9e138eeffd70baaad731f1164540ad408b..afab10201523202abebfca4660db4b424f89db67 100644
--- a/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/CMakeLists.txt
+++ b/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/CMakeLists.txt
@@ -15,6 +15,7 @@ atlas_add_library( ForwardRegionMgField
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps MagFieldInterfaces PathResolver ForwardRegionGeoModelLib )
+set_target_properties( ForwardRegionMgField PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_runtime( share/*.dat )
diff --git a/ForwardDetectors/ForwardTransport/CMakeLists.txt b/ForwardDetectors/ForwardTransport/CMakeLists.txt
index a016d57c2917be46ea659680cf074856dbadd4d6..cf17047e87a33f111fef142f55980a8b0d41ca6a 100644
--- a/ForwardDetectors/ForwardTransport/CMakeLists.txt
+++ b/ForwardDetectors/ForwardTransport/CMakeLists.txt
@@ -14,6 +14,7 @@ atlas_add_library( ForwardTransport
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} AtlasHepMCLib  TruthUtils ForwardTracker GaudiKernel GeneratorObjects G4AtlasToolsLib ForwardTransportSvcLib ISF_Event MCTruth )
+set_target_properties( ForwardTransport PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/ForwardDetectors/ForwardTransportSvc/CMakeLists.txt b/ForwardDetectors/ForwardTransportSvc/CMakeLists.txt
index a1d9fba5f990558c3eb6fc9cf62d8fb439ca160c..d077739b67229b161fcacc11e4c022d2153ec168 100644
--- a/ForwardDetectors/ForwardTransportSvc/CMakeLists.txt
+++ b/ForwardDetectors/ForwardTransportSvc/CMakeLists.txt
@@ -14,6 +14,7 @@ atlas_add_library( ForwardTransportSvcLib
                    PUBLIC_HEADERS ForwardTransportSvc
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ForwardTracker GaudiKernel )
+set_target_properties( ForwardTransportSvcLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Component(s) in the package:
 atlas_add_library( ForwardTransportSvc
@@ -23,6 +24,7 @@ atlas_add_library( ForwardTransportSvc
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps ForwardTracker ForwardTransportSvcLib GaudiKernel GeneratorObjects )
+set_target_properties( ForwardTransportSvc PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/ForwardDetectors/LUCID/LUCID_G4_SD/CMakeLists.txt b/ForwardDetectors/LUCID/LUCID_G4_SD/CMakeLists.txt
index 58f15e694f3434d10d3e2f990d80ef629fdbac51..57e027b4a52b0c41f60da212276c1fcdcb1797fe 100644
--- a/ForwardDetectors/LUCID/LUCID_G4_SD/CMakeLists.txt
+++ b/ForwardDetectors/LUCID/LUCID_G4_SD/CMakeLists.txt
@@ -15,12 +15,14 @@ atlas_add_library( LUCID_G4_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib HitManagement LUCID_GeoModelLib LUCID_SimEvent MCTruth StoreGateLib )
+set_target_properties( LUCID_G4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( LUCID_G4_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES LUCID_G4_SDLib )
+set_target_properties( LUCID_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_test( LUCID_SensitiveDetector_gtest
                 SOURCES test/LUCID_SensitiveDetector_gtest.cxx
diff --git a/ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_OpProcess/CMakeLists.txt b/ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_OpProcess/CMakeLists.txt
index 133c4fe964b09015944822d7716504e825eb273d..d49bb54a49680640c0bfc76243bcacae63b046b8 100644
--- a/ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_OpProcess/CMakeLists.txt
+++ b/ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_OpProcess/CMakeLists.txt
@@ -14,6 +14,7 @@ atlas_add_library( LUCID_OpProcess
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} GaudiKernel AthenaBaseComps G4AtlasInterfaces )
+set_target_properties( LUCID_OpProcess PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/ForwardDetectors/ZDC/ZDC_SD/CMakeLists.txt b/ForwardDetectors/ZDC/ZDC_SD/CMakeLists.txt
index 224f962a7278fe8d11fa983a845f7d7915c8112c..fd9c46609ff78fb39cd1ff9c68cbd2964ca4c136 100644
--- a/ForwardDetectors/ZDC/ZDC_SD/CMakeLists.txt
+++ b/ForwardDetectors/ZDC/ZDC_SD/CMakeLists.txt
@@ -15,12 +15,14 @@ atlas_add_library( ZDC_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib StoreGateLib ZDC_SimEvent ZdcIdentifier CaloG4SimLib CaloSimEvent CaloIdentifier MCTruth )
+set_target_properties( ZDC_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( ZDC_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES ZDC_SDLib )
+set_target_properties( ZDC_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
@@ -35,4 +37,4 @@ atlas_add_test( ZDC_FiberSD_gtest
 atlas_add_test( ZDC_G4CalibSD_gtest
                 SOURCES test/ZDC_G4CalibSD_gtest.cxx
                 LINK_LIBRARIES TestTools ZDC_SDLib G4AtlasToolsLib CxxUtils CaloG4SimLib
-                POST_EXEC_SCRIPT nopost.sh )
\ No newline at end of file
+                POST_EXEC_SCRIPT nopost.sh )
diff --git a/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/CMakeLists.txt b/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/CMakeLists.txt
index 550e02c65875159e11026c74d875c14641ae0602..75c3426473f50d54d913d16aa9c5eb965afc7d8e 100644
--- a/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/CMakeLists.txt
+++ b/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/CMakeLists.txt
@@ -16,6 +16,7 @@ atlas_add_library( HGTD_G4_SD
                    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GEOMODEL_LIBRARIES} StoreGateLib
                    HGTD_Identifier InDetSimEvent G4AtlasToolsLib MCTruth GeoModelInterfaces GeoPrimitives )
+set_target_properties( HGTD_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
index ad3ece75f6d91de51abdceadfdc57479cf3f5aab..24f6dedfacfd978c69adac434ab2c85451629686 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
@@ -15,12 +15,14 @@ atlas_add_library( BCM_G4_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} AthenaKernel G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib )
+set_target_properties( BCM_G4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( BCM_G4_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES BCM_G4_SDLib )
+set_target_properties( BCM_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Test(s) in the package:
 atlas_add_test( BCM_G4_SDToolConfig_test
diff --git a/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
index 90b0e3b473bf445907677d26196faf5db7ee9bf1..c32ba2e919870537a71b7e1dcebf81d56c5c00ad 100644
--- a/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
@@ -15,12 +15,14 @@ atlas_add_library( BLM_G4_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib )
+set_target_properties( BLM_G4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( BLM_G4_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES BLM_G4_SDLib )
+set_target_properties( BLM_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Test(s) in the package:
 atlas_add_test( BLM_G4_SDToolConfig_test
diff --git a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
index d025fd6dd7b2006100f73e364b6395c3651713ca..af77794fdab861ccb77628996c38d88e805f4a22 100644
--- a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
@@ -16,12 +16,14 @@ atlas_add_library( PixelG4_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} ${GEOMODEL_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib GeoModelInterfaces GeoPrimitives)
+set_target_properties( PixelG4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( PixelG4_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES PixelG4_SDLib )
+set_target_properties( PixelG4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Test(s) in the package:
 atlas_add_test( PixelG4_SDToolConfig_test
diff --git a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
index 5340faa5a0122d1ec8dae32dbda3369dac4fc9c7..e3834fd4d81d101b20032bb7bb129f9a0eb1b403 100644
--- a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
@@ -16,12 +16,14 @@ atlas_add_library( SCT_G4_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} ${GEOMODEL_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib GeoModelInterfaces GeoPrimitives )
+set_target_properties( SCT_G4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( SCT_G4_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES SCT_G4_SDLib )
+set_target_properties( SCT_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Test(s) in the package:
 atlas_add_test( SCT_G4_SDToolConfig_test
diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt b/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
index 70651151a747b9595a6a9dacc8cc507f1e3490c3..7972b4b788009f4e93f66d44f03de784453a6fae 100644
--- a/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
+++ b/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( TRT_G4Utilities
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} AthenaKernel CxxUtils
                    PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} PathResolver )
+set_target_properties( TRT_G4Utilities PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_runtime( share/TRT_G4Utilities_management.txt share/TRT_G4Utilities_geometry.txt )
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
index 08b912a5b98280b1e5c8c838d2d93763e8b263e4..20c76dda3f275bbf5f403e84302fcaa5c453a425 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
@@ -14,12 +14,14 @@ atlas_add_library( TRT_G4_SDLib
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} AthenaKernel CxxUtils G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib TRT_G4Utilities )
+set_target_properties( TRT_G4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( TRT_G4_SD
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES TRT_G4_SDLib )
+set_target_properties( TRT_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Test(s) in the package:
 atlas_add_test( TRT_G4_SDToolConfig_test
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/ATLAS_CHECK_THREAD_SAFETY
deleted file mode 100644
index 824ee39b82f5e6c25abe9589e279b44246d4b8f9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/ATLAS_CHECK_THREAD_SAFETY
+++ /dev/null
@@ -1 +0,0 @@
-InnerDetector/InDetMonitoring/InDetAlignmentMonitoring
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt
deleted file mode 100644
index 5705f2f8e9bb984416fce202f76de32be8ce232a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-################################################################################
-# Package: InDetAlignmentMonitoring
-################################################################################
-
-# Declare the package name:
-atlas_subdir( InDetAlignmentMonitoring )
-
-# External dependencies:
-find_package( CLHEP )
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO MathMore Gpad Matrix )
-
-# Component(s) in the package:
-atlas_add_component( InDetAlignmentMonitoring
-   src/*.h src/*.cxx src/components/*.cxx
-   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
-   LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib
-   GaudiKernel CommissionEvent AthenaBaseComps AthenaMonitoringLib AthContainers
-   AtlasDetDescr Identifier EventPrimitives xAODEventInfo xAODTracking
-   TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometryLib SCT_ReadoutGeometry
-   InDetPrepRawData InDetRIO_OnTrack Particle LWHists TrkGeometry TrkSurfaces
-   TrkEventPrimitives TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack
-   TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData VxVertex TrkExInterfaces
-   TrkToolInterfaces TrkVertexFitterInterfaces InDetTrackSelectionToolLib
-   BeamSpotConditionsData InDetAlignGenToolsLib InDetTrackSplitterToolLib )
-
-# Install files from the package:
-atlas_install_joboptions( share/*.py )
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/4approval_MakeAlignmentMonitoringPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/4approval_MakeAlignmentMonitoringPlots.py
deleted file mode 100755
index 235812b274414876669d4a9ed02f27286001efd0..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/4approval_MakeAlignmentMonitoringPlots.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# small adds Priscilla Pani ppani@nikhef.nl
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-# need to provide a configuration file - see makeMonitoringPlotsExampleConfigFile.py
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c <configurationFile>
-#
-##--------------------------
-
-import sys
-from ROOT import *
-from utilities import *
-import AtlasStyle
-gStyle.SetOptStat(0)
-
-
-
-#some initialization
-configFileName = ""
-makeOutput = True
-
-#reading in the root file names from input arguments
-for i in range(len(sys.argv)):
-    if sys.argv[i]=="-c":
-        configFileName = sys.argv[i+1]
-
-# reading in configuration file
-fd = open(configFileName)
-config = fd.readlines()
-exec(''.join(config))
-
-print "Reading in from .root files:"
-for i in range(3) :
-    print rootFileNames[i]
-
-
-if makeOutput:
-    print "Producing output in directory:", outputDir
-
-#getting the TFile objects using the rootFileNames
-rootFiles = [TFile,TFile,TFile]
-nFiles = 0
-for i in range(3):
-    if rootFileNames[i]!="": 
-        rootFiles[i] = TFile(rootFileNames[i])
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print "nFiles = ",nFiles
-
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-# Basic Barrel Residual distributions
-
-# parameter explanation:
-# def DrawPlots(inputTuple, outputName, plotTitle, yAxisTitle, xAxisTitle, legendLeftX, legendUpperY, units, 
-#              canvasText, makeOutput, textBoxLeftX=0.60, textBoxUpperY=0.91, dynamicYRange=True):
-
-
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXX, outputDir+"/"+"PIXX."+oFext, "Pixel barrel", "Hits on tracks / 3 #mum",
-          "Local x residual [mm]", 0.2, 0.87, "#mum",canvasText,makeOutput,0.60,0.91)
-
-# Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXY, outputDir+"/"+"PIXY."+oFext, "Pixel barrel", "Hits on tracks / 20 #mum",
-          "Local y residual [mm]", 0.2, 0.87, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTX, outputDir+"/"+"SCTX."+oFext, "SCT barrel", "Hits on tracks / 3 #mum",
-          "Local x residual [mm]", 0.2, 0.87, "#mum",canvasText,makeOutput,0.60,0.91)
-
-TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTR, outputDir+"/"+"TRTR."+oFext, "TRT barrel", "Hits on tracks / 22 #mum",
-          "Local residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput, 0.65, 0.9)
-
-## Basic Endcap Residual distributions
-
-# draws combined ECA and ECC residual distribution
-PIXECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXECX, outputDir+"/"+"PIXECX."+oFext, "Pixel end-caps", "Hits on tracks / 3 #mum",
-          "Local x residual [mm]", 0.21, 0.87, "#mum",canvasText,makeOutput,0.62,0.91)
-
-# Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXECY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXECY, outputDir+"/"+"PIXECY."+oFext, "Pixel end-caps", "Hits on tracks / 20 #mum",
-          "Local y residual [mm]", 0.21, 0.87, "#mum",canvasText,makeOutput,0.62,0.91)
-
-
-# draws combined ECA and ECC residual distribution
-SCTECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTECX, outputDir+"/"+"SCTECX."+oFext, "SCT Endcap", "Hits on tracks / 3 #mum",
-          "Local x residual [mm]", 0.21, 0.87, "#mum",canvasText,makeOutput,0.62,0.91)
-
-
-TRTEC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTEC, outputDir+"/"+"TRTEC."+oFext, "TRT end-caps", "Hits on track / 22 #mums",
-          "Local residual [mm]", 0.18, 0.89, "#mum",canvasText,makeOutput, 0.65, 0.9)
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/AtlasStyle.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/AtlasStyle.py
deleted file mode 100644
index 44d9df69521a4caaa1ddd792d68acfd54ccc6848..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/AtlasStyle.py
+++ /dev/null
@@ -1,85 +0,0 @@
-from ROOT import *
-atlasStyle= TStyle("ATLAS","Atlas style")
-
-# use plain black on white colors
-icol=0
-atlasStyle.SetFrameBorderMode(icol)
-atlasStyle.SetCanvasBorderMode(icol)
-atlasStyle.SetPadBorderMode(icol)
-atlasStyle.SetPadColor(icol)
-atlasStyle.SetCanvasColor(icol)
-atlasStyle.SetStatColor(icol)
-#atlasStyle.SetFillColor(icol)
-
-# set the paper & margin sizes
-atlasStyle.SetPaperSize(20,26) 
-atlasStyle.SetPadTopMargin(0.05)
-atlasStyle.SetPadRightMargin(0.05)
-atlasStyle.SetPadBottomMargin(0.16)
-atlasStyle.SetPadLeftMargin(0.12)
-
-# use large fonts
-#font=72
-font=42
-tsize=0.05
-tzsize = 0.035
-atlasStyle.SetTextFont(font)
-
-
-atlasStyle.SetTextSize(tsize)
-atlasStyle.SetLabelFont(font,"x")
-atlasStyle.SetTitleFont(font,"x")
-atlasStyle.SetLabelFont(font,"y")
-atlasStyle.SetTitleFont(font,"y")
-atlasStyle.SetLabelFont(font,"z")
-atlasStyle.SetTitleFont(font,"z")
-
-atlasStyle.SetTitleOffset(1.2,"y")
-atlasStyle.SetTitleOffset(1.04,"x")
-
-atlasStyle.SetLabelSize(tsize,"x")
-atlasStyle.SetTitleSize(tsize,"x")
-atlasStyle.SetLabelSize(tsize,"y")
-atlasStyle.SetTitleSize(tsize,"y")
-atlasStyle.SetLabelSize(tzsize,"z")
-atlasStyle.SetTitleSize(tzsize,"z")
-
-
-#use bold lines and markers
-atlasStyle.SetMarkerStyle(20)
-atlasStyle.SetMarkerSize(1.2)
-atlasStyle.SetHistLineWidth(2)
-atlasStyle.SetLineStyleString(2,"[12 12]") # postscript dashes
-
-#get rid of X error bars and y error bar caps
-#atlasStyle.SetErrorX(0.001)
-
-#do not display any of the standard histogram decorations
-atlasStyle.SetOptTitle(0)
-#atlasStyle.SetOptStat(1111)
-atlasStyle.SetOptStat(0)
-#atlasStyle.SetOptFit(1111)
-atlasStyle.SetOptFit(0)
-
-# put tick marks on top and RHS of plots
-atlasStyle.SetPadTickX(1) 
-atlasStyle.SetPadTickY(1)
-
-gROOT.SetStyle("Plain")
-
-#gStyle.SetPadTickX(1)
-#gStyle.SetPadTickY(1)
-gROOT.SetStyle("ATLAS")
-gROOT.ForceStyle() 
-gStyle.SetOptTitle(0)
-gStyle.SetOptStat(0) 
-gStyle.SetOptFit(0) 
-
-
-# overwrite atlas styles
-atlasStyle.SetMarkerSize(0.9)
-atlasStyle.SetPadLeftMargin(0.12)
-atlasStyle.SetPadRightMargin(0.09)    
-atlasStyle.SetPadBottomMargin(0.12)     
-atlasStyle.SetPadTopMargin(0.06) 
-atlasStyle.SetFrameFillColor(0)
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareAll.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareAll.py
deleted file mode 100644
index 27a2021776977b703bbaced588f4854225ed8aa8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareAll.py
+++ /dev/null
@@ -1,131 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  This file loops over all the histograms in the monitoring file and makes
-#   the comparison.
-#
-#  By default all profile, 1D and 2D histograms are processed using
-#   the function in rootArtist (procProfile, procHistogram, and procHitMap)
-#  To See how exceptions are dealt with read CompareAllExceptions.py
-#
-# Author:
-#  John Alison <johnda@hep.upenn.edu>
-#===========================================================================
-
-# Load the Root artist
-include("InDetAlignmentMonitoring/rootArtist.py")
-
-# Load the Exceptions
-include("InDetAlignmentMonitoring/CompareAllExceptions.py")
-
-# Make the directories in the rootfile
-include("InDetAlignmentMonitoring/makeDirectories.py")
-
-# Function that writes out the canvases 
-include("InDetAlignmentMonitoring/writeOutput.py")
-
-# Main script to loop over the contents of the monitoring.root file.
-# ==================================================================
-a_mainDir = a_file.GetDirectory("IDAlignMon")
-b_mainDir = b_file.GetDirectory("IDAlignMon")
-
-# Get the list of track collections and make it a set
-a_trackCollections = set([ k.GetTitle() for k in a_mainDir.GetListOfKeys() ])
-b_trackCollections = set([ k.GetTitle() for k in b_mainDir.GetListOfKeys() ])
-
-# Getting the track collections which are in both files
-allTrackCollections = a_trackCollections.intersection(b_trackCollections)
-
-# Loop over track collections
-for thisTrackCollection in allTrackCollections:
-    print "Doing Track Collection",thisTrackCollection
-    print "=================================================================="
-    a_trackColDir = a_file.GetDirectory("IDAlignMon/"+thisTrackCollection)
-    b_trackColDir = b_file.GetDirectory("IDAlignMon/"+thisTrackCollection)
-
-    # Get the list of modules for this track collection and make it a set
-    a_modules = set([ k.GetTitle() for k in a_trackColDir.GetListOfKeys() ])
-    b_modules = set([ k.GetTitle() for k in b_trackColDir.GetListOfKeys() ])
-
-    # Getting the modules common to both files
-    allModules = a_modules.intersection(b_modules)
-
-    if not madeDirectories:
-        madeDirectories = True
-        makeDirectories(allModules,allTrackCollections)
-    
-    # Loop over modules
-    for thisModule in allModules:
-        print "\tDoing Module",thisModule
-        thisDir = "IDAlignMon/"+thisTrackCollection+"/"+thisModule
-        a_modulesDir = a_file.GetDirectory(thisDir)
-        b_modulesDir = b_file.GetDirectory(thisDir)
-
-        # Get the list of histograms in this module
-        a_hists = set([ k.GetName() for k in a_modulesDir.GetListOfKeys() ])
-                
-        b_hists = set([ k.GetName() for k in b_modulesDir.GetListOfKeys() ])
-        
-        # Getting the histograms common to both files
-        allHists = a_hists.intersection(b_hists)
-                
-        for thisHist in allHists:
-            a_thisHist = a_file.Get(thisDir+"/"+thisHist)
-
-            # Skip empty hists
-            if not a_thisHist:
-                print "Warning ",thisHist," is NULL"
-                print "Skipping it..."
-                continue
-
-            # Need to skip the metadata
-            if isinstance(a_thisHist,TTree):
-                #print "Skipping",thisHist
-                continue
-
-            thisCan = TCanvas(a_thisHist.GetTitle(),a_thisHist.GetTitle(),1100,800) 
-            
-            # print thisHist
-            if isinstance(a_thisHist,TProfile):
-                thisCan.cd()
-                if thisHist in isAnException:
-                    isAnException[thisHist][0](thisHist,thisDir+"/",isAnException[thisHist][1])
-                else:
-                    procProfile(thisHist,thisDir+"/")
-            elif isinstance(a_thisHist,TH2):
-                # For 2-D hist we write Out two canvases
-                
-                # Before
-                beforeCan = TCanvas(a_thisHist.GetTitle()+" Before Alignment"
-                                    ,a_thisHist.GetTitle()+" Before Alignment",1100,800)
-                beforeCan.cd()
-                procHitMap(thisHist,thisDir+"/",0)
-                writeCan(beforeCan,thisHist,thisModule,thisTrackCollection)
-
-                # After 
-                afterCan = TCanvas(a_thisHist.GetTitle()+" After Alignment"
-                                   ,a_thisHist.GetTitle()+" After Alignment",1100,800)
-                afterCan.cd()
-                procHitMap(thisHist,thisDir+"/",1)
-                writeCan(afterCan,thisHist,thisModule,thisTrackCollection)
-
-                # Dont write out the other canvases
-                continue
-                
-            elif isinstance(a_thisHist,TH1):
-                thisCan.cd()
-                if thisHist in isAnException:
-                    isAnException[thisHist][0](thisHist,thisDir+"/",isAnException[thisHist][1])
-                else:
-                    procHistogram(thisHist,thisDir+"/")
-            else:
-                print "Havent classified",thisHist
-                print "It is of type:",type(a_thisHist)
-                continue
-                
-            writeCan(thisCan,thisHist,thisModule,thisTrackCollection)
-
-
-                
-            
-            
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareAllExceptions.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareAllExceptions.py
deleted file mode 100644
index b3b54db95e6771c4aaccf8fd488e5bc359bcfced..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareAllExceptions.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  File is loaded from CompareAll.py and deal with the "special" plots
-#
-# Author:
-#  John Alison <johnda@hep.upenn.edu>
-#===========================================================================
-
-# List of the histograms were we want ot do more that the standard procProfile or procHistogram
-# This is a dictionarry of the histogram names and a list
-#  The list has as its first elemet the function object to be called instead of procProfile or procHistogram
-#         the second object is an argument to pass the function object. (This can be extended if needed)
-isAnException = {"trt_b_residualR":[processAndFitTRTResiduals,"#mum"]
-                 ,"trt_b_residualRSide_A":[processAndFitTRTResiduals,"#mum"]
-                 ,"trt_b_residualRSide_C":[processAndFitTRTResiduals,"#mum"]
-                 ,"trt_b_residualRSide_A":[processAndFitTRTResiduals,"#mum"]
-                 ,"trt_b_residualR_Endcap_A":[processAndFitTRTResiduals,"#mum"]
-                 ,"trt_b_residualR_Endcap_C":[processAndFitTRTResiduals,"#mum"]
-                 }
-
-trackParamNames = ["delta_d0","delta_z0","delta_eta0","delta_phi0","delta_qOverPt"]
-trackParamUnits = ["mm","mm","eta","rad","GeV^{-1}"]
-trackParamMiddles = ["","_Pull"]
-trackParamEndings = ["","_n","_p"]
-
-for tp in range(len(trackParamNames)):
-    for tm in range(len(trackParamMiddles)):
-        for te in range(len(trackParamEndings)):
-            isAnException[trackParamNames[tp]+trackParamMiddles[tm]+trackParamEndings[te]] = [processAndQuoteHistogram,trackParamUnits[tp]]
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareEfficiencies.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareEfficiencies.py
deleted file mode 100644
index cf8bf782c1df13ccc45a816e26c0e6b7e277357a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareEfficiencies.py
+++ /dev/null
@@ -1,188 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  This file compares the Efficiency distributions, is called from makeComparision
-#
-# Author:
-#  John Alison johnda@hep.upenn.edu
-#===========================================================================
-
-endcapName = ["Endcap_A","Endcap_C"]
-
-# Ratio Hits Vs phi Sector
-# Barrel 
-cHitsPhiSec = TCanvas("Hits Vs PhiSector","Hits vs Phi Sec", 1100,800)
-cHitsPhiSec.Divide(1,3)
-hitsVsPhiSectorName = ["hits_eff_vs_phiSector_trt_b0","hits_eff_vs_phiSector_trt_b1","hits_eff_vs_phiSector_trt_b2"]
-
-# Endcap
-cHitsPhiSecEndcap = [TCanvas("Hits Vs PhiSector (Endcap A)","Hits vs Phi Sec", 1100,800)
-                     ,TCanvas("Hits Vs PhiSector (Endcap C)","Hits vs Phi Sec", 1100,800)]
-
-hitsVsPhiSectorEndcapName = "hits_eff_vs_phiSector_trt_ec_"
-
-# Ratio tube Hits Vs phi Sector
-# Barrel
-cTubeHitsPhiSec = TCanvas("Tube Hits Vs PhiSector","Tube Hits vs Phi Sec", 1100,800)
-cTubeHitsPhiSec.Divide(1,3)
-tubeHitsVsPhiSectorName = ["tubeHits_eff_vs_phiSector_trt_b0","tubeHits_eff_vs_phiSector_trt_b1","tubeHits_eff_vs_phiSector_trt_b2"]
-
-# Endcap
-cTubeHitsPhiSecEndcap = [TCanvas("Tube Hits Vs PhiSector (Endcap A)","Tube Hits vs Phi Sec", 1100,800)
-                         ,TCanvas("Tube Hits Vs PhiSector (Endcap C)","Tube Hits vs Phi Sec", 1100,800)]
-
-tubeHitsVsPhiSectorEndcapName = "tubeHits_eff_vs_phiSector_trt_ec_"
-
-# Ratio tube Hits Vs phi Sector
-# Barrel
-cOutliersPhiSec = TCanvas("Outliers Vs PhiSector","Outliers vs Phi Sec", 1100,800)
-cOutliersPhiSec.Divide(1,3)
-outliersVsPhiSectorName = ["outliers_eff_vs_phiSector_trt_b0","outliers_eff_vs_phiSector_trt_b1","outliers_eff_vs_phiSector_trt_b2"]
-
-# Endcap 
-cOutliersPhiSecEndcap = [TCanvas("Outliers Vs PhiSector (Endcap A)","Outliers vs Phi Sec", 1100,800)
-                         ,TCanvas("Outliers Vs PhiSector (Endcap C)","Outliers vs Phi Sec", 1100,800)]
-outliersVsPhiSectorEndcapName = "outliers_eff_vs_phiSector_trt_ec_"
-
-# Ratio Hits Vs phi Sector
-# Barrel
-cTotalHitsPhiSec = TCanvas("Total Hits Vs PhiSector","TotalHits vs Phi Sec", 1100,800)
-cTotalHitsPhiSec.Divide(1,3)
-totalHitsVsPhiSectorName = ["hits_vs_phiSector_trt_b0","hits_vs_phiSector_trt_b1","hits_vs_phiSector_trt_b2"]
-
-# Endcap
-cTotalHitsPhiSecEndcap = [TCanvas("Total Hits Vs PhiSector (EndcapA)","TotalHits vs Phi Sec", 1100,800)
-                          ,TCanvas("Total Hits Vs PhiSector (EndcapC)","TotalHits vs Phi Sec", 1100,800)]
-totalHitsVsPhiSectorEndcapName = "hits_vs_phiSector_trt_ec_"
-
-# Ratio tube TotalHits Vs phi Sector
-# Barrel
-cTotalTubeHitsPhiSec = TCanvas("Total Tube Hits Vs PhiSector","Total Tube Hits vs Phi Sec", 1100,800)
-cTotalTubeHitsPhiSec.Divide(1,3)
-totalTubeHitsVsPhiSectorName = ["tubeHits_vs_phiSector_trt_b0","tubeHits_vs_phiSector_trt_b1","tubeHits_vs_phiSector_trt_b2"]
-
-# Endcap
-cTotalTubeHitsPhiSecEndcap = [TCanvas("Total Tube Hits Vs PhiSector (EndcapA)","Total Tube Hits vs Phi Sec", 1100,800)
-                              ,TCanvas("Total Tube Hits Vs PhiSector (EndcapC)","Total Tube Hits vs Phi Sec", 1100,800)]
-totalTubeHitsVsPhiSectorEndcapName = "tubeHits_vs_phiSector_trt_ec_"
-
-# Total Outliers Vs phi Sector
-# Barrel
-cTotalOutliersPhiSec = TCanvas("Total Outliers Vs PhiSector","Outliers vs Phi Sec", 1100,800)
-cTotalOutliersPhiSec.Divide(1,3)
-totalOutliersVsPhiSectorName = ["outliers_vs_phiSector_trt_b0","outliers_vs_phiSector_trt_b1","outliers_vs_phiSector_trt_b2"]
-
-# Endcap 
-cTotalOutliersPhiSecEndcap = [TCanvas("Total Outliers Vs PhiSector (EndcapA)","Outliers vs Phi Sec", 1100,800)
-                               ,TCanvas("Total Outliers Vs PhiSector (EndcapC)","Outliers vs Phi Sec", 1100,800)]
-totalOutliersVsPhiSectorEndcapName = "outliers_vs_phiSector_trt_ec_"
-
-# Ratios Vs Straw Layer
-cRatioStrawLayer = TCanvas("Ratios Vs Straw Layer","Ratios vs Straw Layer", 1100,800)
-cRatioStrawLayer.Divide(1,3)
-ratioNames = ["hits_eff_vs_StrawLayer_trt_b","tubeHits_eff_vs_StrawLayer_trt_b","outliers_eff_vs_StrawLayer_trt_b"]
-
-# Ratios Vs Ring number
-# Endcap
-cRatioRingNumberEndcap = [TCanvas("Ratios Vs Ring Number (Endcap A)","Ratios Vs Ring Number",1100,800)
-                          ,TCanvas("Ratios Vs Ring Number (Endcap C)","Ratios Vs Ring Number",1100,800)]
-for i in range(2):
-    cRatioRingNumberEndcap[i].Divide(1,3)
-
-ratioRingNumberEndcapNames = ["hits_eff_vs_ring_trt_ec_","tubeHits_eff_vs_ring_trt_ec_","outliers_eff_vs_ring_trt_ec_"]
-
-# Numbers Vs Ring number
-# Endcap A
-cNumberVsRingNumberEndcap = [TCanvas("Total number Vs Ring Number (Endcap A)","Number Vs Ring Number",1100,800)
-                             ,TCanvas("Total number Vs Ring Number (Endcap C)","Number Vs Ring Number",1100,800)]
-for i in range(2):
-    cNumberVsRingNumberEndcap[i].Divide(1,3)
-
-numberRingNumberEndcapNames = ["hits_vs_ring_trt_ec_","tubeHits_vs_ring_trt_ec_","outliers_vs_ring_trt_ec_"]
-
-for thisTrackSelection in trackSelections:
-    # Barrel
-    for i in range(3):
-
-        cHitsPhiSec.cd(i+1)
-        procProfile(hitsVsPhiSectorName[i],thisTrackSelection+"HitEfficiencies/")
-
-        cTubeHitsPhiSec.cd(i+1)
-        procProfile(tubeHitsVsPhiSectorName[i],thisTrackSelection+"HitEfficiencies/")
-
-        cOutliersPhiSec.cd(i+1)
-        procProfile(outliersVsPhiSectorName[i],thisTrackSelection+"HitEfficiencies/")
-
-        cTotalHitsPhiSec.cd(i+1)
-        procProfile(totalHitsVsPhiSectorName[i],thisTrackSelection+"HitEfficiencies/")
-
-        cTotalTubeHitsPhiSec.cd(i+1)
-        procProfile(totalTubeHitsVsPhiSectorName[i],thisTrackSelection+"HitEfficiencies/")
-
-        cTotalOutliersPhiSec.cd(i+1)
-        procProfile(totalOutliersVsPhiSectorName[i],thisTrackSelection+"HitEfficiencies/")
-        
-        cRatioStrawLayer.cd(i+1)
-        procProfile(ratioNames[i],thisTrackSelection+"HitEfficiencies/")
-
-    dirName = thisTrackSelection.split('/')[1]+"BarrelHitEfficiencies"
-    rootfile.cd(thisTrackSelection.split('/')[1])
-    gDirectory.cd("Barrel")
-    gDirectory.mkdir("HitEfficiencies",dirName).cd()
-    
-    cHitsPhiSec.Write()
-    cTubeHitsPhiSec.Write()
-    cOutliersPhiSec.Write()
-    cTotalHitsPhiSec.Write()
-    cTotalTubeHitsPhiSec.Write()
-    cTotalOutliersPhiSec.Write()
-    cRatioStrawLayer.Write()
-
-    for endcap in range(2):
-        cHitsPhiSecEndcap[endcap].cd()
-        procProfile(hitsVsPhiSectorEndcapName+endcapName[endcap],thisTrackSelection+"HitEfficiencies/")
-
-        cTubeHitsPhiSecEndcap[endcap].cd()
-        procProfile(tubeHitsVsPhiSectorEndcapName+endcapName[endcap],thisTrackSelection+"HitEfficiencies/")
-    
-        cOutliersPhiSecEndcap[endcap].cd()
-        procProfile(outliersVsPhiSectorEndcapName+endcapName[endcap],thisTrackSelection+"HitEfficiencies/")
-    
-        cTotalHitsPhiSecEndcap[endcap].cd()
-        procProfile(totalHitsVsPhiSectorEndcapName+endcapName[endcap],thisTrackSelection+"HitEfficiencies/")
-    
-        cTotalTubeHitsPhiSecEndcap[endcap].cd()
-        procProfile(totalTubeHitsVsPhiSectorEndcapName+endcapName[endcap],thisTrackSelection+"HitEfficiencies/")
-    
-        cTotalOutliersPhiSecEndcap[endcap].cd()
-        procProfile(totalOutliersVsPhiSectorEndcapName+endcapName[endcap],thisTrackSelection+"HitEfficiencies/")
-
-        for i in range(3):
-            cRatioRingNumberEndcap[endcap].cd(i+1)
-            procProfile(ratioRingNumberEndcapNames[i]+endcapName[endcap],thisTrackSelection+"HitEfficiencies/")
-            
-            cNumberVsRingNumberEndcap[endcap].cd(i+1)
-            procProfile(numberRingNumberEndcapNames[i]+endcapName[endcap],thisTrackSelection+"HitEfficiencies/")
-
-        if not endcap:
-            dirName = thisTrackSelection.split('/')[1]+"EncapAHitEfficiencies"
-            rootfile.cd(thisTrackSelection.split('/')[1])
-            gDirectory.cd("EndcapA")
-            gDirectory.mkdir("HitEfficiencies",dirName).cd()
-        else:
-            dirName = thisTrackSelection.split('/')[1]+"EncapCHitEfficiencies"
-            rootfile.cd(thisTrackSelection.split('/')[1])
-            gDirectory.cd("EndcapC")
-            gDirectory.mkdir("HitEfficiencies",dirName).cd()
-
-
-
-        cHitsPhiSecEndcap[endcap].Write()
-        cTubeHitsPhiSecEndcap[endcap].Write()
-        cOutliersPhiSecEndcap[endcap].Write()
-        cTotalHitsPhiSecEndcap[endcap].Write()
-        cTotalTubeHitsPhiSecEndcap[endcap].Write()
-        cTotalOutliersPhiSecEndcap[endcap].Write()
-        cRatioRingNumberEndcap[endcap].Write()
-        cNumberVsRingNumberEndcap[endcap].Write()
-    
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareGenericTracks.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareGenericTracks.py
deleted file mode 100644
index b9b984c973dbc86286145f7847dca627c6819eb4..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareGenericTracks.py
+++ /dev/null
@@ -1,145 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  This file compares the GenericTrack distributions, is called from makeComparision
-#
-# Author:
-#  John Alison johnda@hep.upenn.edu
-#===========================================================================
-
-# Generic Tracks
-#==============================
-
-
-# Barrel and Endcaps
-cGenTracks = []
-genericTracksName = ["pTRes","pT","phi"]
-canvasName = ["pT Resolution","pT Spectrum","Phi Distribution"]
-
-for i in range(len(genericTracksName)):
-    cGenTracks.append(TCanvas(canvasName[i],"Generic Tracks", 1100,800))
-
-# Barrel 
-cGenTracksBarrel = []
-genericTracksBarrelName = ["Ntrthits_per_track_barrel","chi2oDoF_barrel","trk_pT_asym_barrel"]
-canvasBarrelName = ["Number of TRT hits (Barrel)","Chi2 per DoF (Barrel)","pT Asymetry (Barrel)"]
-
-for i in range(len(genericTracksBarrelName)):
-    cGenTracksBarrel.append(TCanvas(canvasBarrelName[i],"Generic Tracks", 1100,800))
-    
-# EndcapA
-cGenTracksEndcapA = []
-genericTracksEndcapAName = ["Ntrthits_per_track_eca","chi2oDoF_eca","trk_pT_asym_eca"]
-canvasEndcapAName = ["Number of TRT hits (Endcap A)","Chi2 per DoF (Endcap A)","pT Asymetry (Endcap A)"]
-
-for i in range(len(genericTracksEndcapAName)):
-    cGenTracksEndcapA.append(TCanvas(canvasEndcapAName[i],"Generic Tracks", 1100,800))
-
-# EndcapC
-cGenTracksEndcapC = []
-genericTracksEndcapCName = ["Ntrthits_per_track_ecc","chi2oDoF_ecc","trk_pT_asym_ecc"]
-canvasEndcapCName = ["Number of TRT hits (Endcap C)","Chi2 per DoF (Endcap C)","pT Asymetry (Endcap C)"]
-
-for i in range(len(genericTracksEndcapCName)):
-    cGenTracksEndcapC.append(TCanvas(canvasEndcapCName[i],"Generic Tracks", 1100,800))
-
-cHitMapB = TCanvas("Hit Map Before Alignment","Hit Map Before Alignment",1100,800)
-cHitMapA = TCanvas("Hit Map After Alignment","Hit Map After Alignment",1100,800)
-
-cHitMapEndcapA_B = TCanvas("Hit Map Before Alignment (Endcap A)","Hit Map Before Alignment",1100,800)
-cHitMapEndcapA_A = TCanvas("Hit Map After Alignment (Endcap A)","Hit Map After Alignment",1100,800)
-
-cHitMapEndcapC_B = TCanvas("Hit Map Before Alignment (Endcap C)","Hit Map Before Alignment",1100,800)
-cHitMapEndcapC_A = TCanvas("Hit Map After Alignment (Endcap C)","Hit Map After Alignment",1100,800)
-
-
-for thisTrackSelection in trackSelections:
-    # Both Barrel and Endcap
-    # =====================
-    for i in range(len(genericTracksName)):
-        
-        # Residuals Vs Phi
-        cGenTracks[i].cd()
-        procHistogram(genericTracksName[i],thisTrackSelection+"GenericTracks/",1)
-                        
-    dirName = thisTrackSelection.split('/')[1]+"BarrelGenericTracks"
-    rootfile.cd(thisTrackSelection.split('/')[1])
-    gDirectory.mkdir("GenericTracks",dirName).cd()
-
-    for j in range(len(genericTracksName)):
-        cGenTracks[j].Write()
-
-    # Barrel
-    # ================
-    for i in range(len(genericTracksBarrelName)):
-        
-        # Residuals Vs Phi
-        cGenTracksBarrel[i].cd()
-        procHistogram(genericTracksBarrelName[i],thisTrackSelection+"GenericTracks/",1)
-
-    cHitMapB.cd()
-    procHitMap("hitMap_barrel",thisTrackSelection+"GenericTracks/",0)
-
-    cHitMapA.cd()
-    procHitMap("hitMap_barrel",thisTrackSelection+"GenericTracks/",1)
-
-
-    dirName = thisTrackSelection.split('/')[1]+"BarrelGenericTracks"
-    rootfile.cd(thisTrackSelection.split('/')[1])
-    gDirectory.cd("Barrel")
-    gDirectory.mkdir("GenericTracks",dirName).cd()
-
-    for j in range(len(genericTracksBarrelName)):
-        cGenTracks[j].Write()
-
-    cHitMapA.Write()
-    cHitMapB.Write()
-    
-
-    # EndcapA
-    # =====================
-    for i in range(len(genericTracksEndcapAName)):
-        
-        cGenTracksEndcapA[i].cd()
-        procHistogram(genericTracksEndcapAName[i],thisTrackSelection+"GenericTracks/",1)
-    
-    cHitMapEndcapA_B.cd()
-    procHitMap("hitMap_endcapA",thisTrackSelection+"GenericTracks/",0)
-
-    cHitMapEndcapA_A.cd()
-    procHitMap("hitMap_endcapA",thisTrackSelection+"GenericTracks/",1)
-
-    dirName = thisTrackSelection.split('/')[1]+"EndcapAGenericTracks"
-    rootfile.cd(thisTrackSelection.split('/')[1])
-    gDirectory.cd("EndcapA")
-    gDirectory.mkdir("GenericTracks",dirName).cd()
-
-    for j in range(len(genericTracksEndcapAName)):
-        cGenTracksEndcapA[j].Write()
-
-    cHitMapEndcapA_B.Write()
-    cHitMapEndcapA_A.Write()
-
-    # EndcapC
-    # =====================
-    for i in range(len(genericTracksEndcapCName)):
-        
-        cGenTracksEndcapC[i].cd()
-        procHistogram(genericTracksEndcapCName[i],thisTrackSelection+"GenericTracks/",1)
-
-    cHitMapEndcapC_B.cd()
-    procHitMap("hitMap_endcapC",thisTrackSelection+"GenericTracks/",0)
-
-    cHitMapEndcapC_A.cd()
-    procHitMap("hitMap_endcapC",thisTrackSelection+"GenericTracks/",1)
-
-    dirName = thisTrackSelection.split('/')[1]+"EndcapCGenericTracks"
-    rootfile.cd(thisTrackSelection.split('/')[1])
-    gDirectory.cd("EndcapC")
-    gDirectory.mkdir("GenericTracks",dirName).cd()
-
-    for j in range(len(genericTracksEndcapCName)):
-        cGenTracksEndcapC[j].Write()
-
-    cHitMapEndcapC_B.Write()
-    cHitMapEndcapC_A.Write()
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareIDAlignmentMonitoring.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareIDAlignmentMonitoring.py
deleted file mode 100644
index 5475bc8766a9627012b07e60b23f866e3d82a900..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareIDAlignmentMonitoring.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  This file is the steering file used to compare two monitoring.root files
-# Usage:
-#   - specify the two files to be compared, afterAlignmentFile, beforeAlignmentFile
-#   - specify the outputfile
-#   - run:
-#         athena CompareIDAlignemntMonitoring.py
-#
-#   - examine the outputfile
-#
-# Author:
-#  John Alison <johnda@hep.upenn.edu>
-#===========================================================================
-
-#====================================
-# The Reference File (Black)
-afterAlignmentFile = "/afs/cern.ch/user/a/atlidali/w1/users/johnda/testNewIterator/Iter10/TotalMonitoring.root"
-
-#====================================
-# The Monitored File (Red)
-beforeAlignmentFile = "/afs/cern.ch/user/a/atlidali/w1/users/johnda/testNewIterator/Iter0/TotalMonitoring.root"
-
-#====================================
-# The Output File
-outputFile = "AlignmentOutput.root"
-
-#====================================
-include("InDetAlignmentMonitoring/makeComparision.py")
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareResiduals.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareResiduals.py
deleted file mode 100644
index 9770075f8de9b12cbe3f85705c2e7db5d59a3ffb..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareResiduals.py
+++ /dev/null
@@ -1,270 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  This file compares the Residual distributions, is called from makeComparision
-#
-# Author:
-#  John Alison johnda@hep.upenn.edu
-#===========================================================================
-
-# Residual Window
-#==============================
-minResWin = -0.1
-maxResWin = 0.1
-
-sideNames = ["","Side_A","Side_C"]
-endcapNames = ["Endcap_A","Endcap_C"]
-
-# Fitted Residual
-#==============================
-cTRTFittedResidual = [TCanvas("Fitted Residual","TRT Residual", 1100,800),
-                      TCanvas("Fitted Residual A-Side","TRT Residual A", 1100,800),
-                      TCanvas("Fitted Residual C-Side","TRT Residual C", 1100,800)]
-barrelResidualName = ["trt_b_residualR","trt_b_residualR"+sideNames[1],"trt_b_residualR"+sideNames[2]]
-
-cTRTFittedResidualEndcap = [TCanvas("Fitted Residual Endcap A","TRT Residual Endcap A", 1100,800)
-                            ,TCanvas("Fitted Residual Endcap C","TRT Residual Endcap C", 1100,800)]
-endcapResidualName = "trt_ec_residualR_"
-
-endcapARingRes = []
-endcapCRingRes = []
-for i in range(40):
-    endcapARingRes.append(TCanvas("Fitted Residual A-Side Ring "+str(i),"TRT Residual A Ring "+str(i), 1100,800))
-    endcapCRingRes.append(TCanvas("Fitted Residual C-Side Ring "+str(i),"TRT Residual C Ring "+str(i), 1100,800))
-cTRTEndcapRingResiduals = [endcapARingRes,endcapCRingRes]
-
-# Residual RMS Vs Phi Sector
-#==============================
-
-# Barrel
-# Both A and C
-# Residuals Vs phi Sector
-cTRTResidualsPhiSec = [TCanvas("Residuals Vs PhiSector","TRT Residuals vs Phi Sec", 1100,800)
-                       ,TCanvas("Residuals Vs PhiSector A-Side","TRT Residuals vs Phi Sec (A-side)", 1100,800)
-                       ,TCanvas("Residuals Vs PhiSector C-Side","TRT Residuals vs Phi Sec (C-side)", 1100,800)]
-
-for i in range(len(cTRTResidualsPhiSec)):
-    cTRTResidualsPhiSec[i].Divide(1,3)
-
-residualsVsPhiSectorName = ["trt_b_aveRes_l0","trt_b_aveRes_l1","trt_b_aveRes_l2"]
-
-
-# RMS Vs phi Sector
-cTRTResidualRMSPhiSec = [TCanvas("Residual RMS Vs PhiSector","TRT Residual RMS vs Phi Sec", 1100,800)
-                         ,TCanvas("Residual RMS Vs PhiSector A-Side","TRT Residual RMS vs Phi Sec (A-side)", 1100,800)
-                         ,TCanvas("Residual RMS Vs PhiSector C-Side","TRT Residual RMS vs Phi Sec (C-side)", 1100,800)]
-
-for i in range(len(cTRTResidualRMSPhiSec)):
-    cTRTResidualRMSPhiSec[i].Divide(1,3)
-
-residualRMSVsPhiSectorName = ["trt_b_rmsRes_l0","trt_b_rmsRes_l1","trt_b_rmsRes_l2"]
-
-#Endcap 
-# Res Vs phi Sector
-cTRTResidualsVSPhiSecEndcap = [TCanvas("Residuals Vs PhiSector Endcap A","TRT Residuals vs Phi Sec Endcap A", 1100,800)
-                               ,TCanvas("Residuals Vs PhiSector Endcap C","TRT Residuals vs Phi Sec Endcap C", 1100,800)]
-
-residualsVsPhiSectorEndcapName = "trt_ec_aveResVsPhiSec_"
-
-# RMS Vs phi Sector
-cTRTResidualRMSPhiSecEndcap = [TCanvas("Residual RMS Vs PhiSector Endcap A","TRT Residual RMS vs Phi Sec Endcap A", 1100,800)
-                                ,TCanvas("Residual RMS Vs PhiSector Endcap C","TRT Residual RMS vs Phi Sec Endcap C", 1100,800)]
-residualRMSVsPhiSectorEndcapName = "trt_ec_rmsResVsPhiSec_"
-
-#Endcap 
-# Res Vs ring
-cTRTResidualsVSRingEndcap = [TCanvas("Residuals Vs Ring Endcap A","TRT Residuals vs Ring Endcap A", 1100,800)
-                               ,TCanvas("Residuals Vs Ring Endcap C","TRT Residuals vs Ring Endcap C", 1100,800)]
-
-residualsVsRingEndcapName = "trt_ec_aveResVsRing_"
-
-# RMS Vs ring
-cTRTResidualRMSRingEndcap = [TCanvas("Residual RMS Vs Ring Endcap A","TRT Residual RMS vs Ring Endcap A", 1100,800)
-                                ,TCanvas("Residual RMS Vs Ring Endcap C","TRT Residual RMS vs Ring Endcap C", 1100,800)]
-residualRMSVsRingEndcapName = "trt_ec_rmsResVsRing_"
-
-
-# Residual Vs Straw Layer
-#==============================
-cTRTResidualsStrawLayer = []
-canvasName = ["Residuals Vs Straw Layer","Residuals Vs StrawLayer (Upper)","Residuals Vs StrawLayer (Lower)","Residuals Vs StrawLayer (Right)","Residuals Vs StrawLayer (Left)"]
-
-for i in range(5):
-    cTRTResidualsStrawLayer.append(TCanvas(canvasName[i],"TRT Residuals vs StrawLayer", 1100,800))
-    cTRTResidualsStrawLayer[i].Divide(3,2)
-  
-posName = [""," Upper"," Lower"," Left"," Right"]
-residualsVsStrawLayerName = "trt_b_aveResOverPhiVsStrawLayer"
-
-cTRTResidualsStrawLayerStackLevel = []
-residualsVsStrawLayerStackLevelName = []
-residualRMSVsStrawLayerStackLevelName = []
-
-for i in range(32):
-    residualsVsStrawLayerStackLevelName.append("trt_b_aveResVsStrawLayerStackLevel_"+str(i))
-    residualRMSVsStrawLayerStackLevelName.append("trt_b_rmsResVsStrawLayerStackLevel_"+str(i))
-
-    cTRTResidualsStrawLayerStackLevel.append(TCanvas("Residuals Vs Straw Layer Phi Sector "+str(i),"TRT Residual Vs Straw Later Phi Sector "+str(i),1100,800))
-    cTRTResidualsStrawLayerStackLevel[i].Divide(3,2)
-
-
-# RMS  Vs Straw Layer
-#=========================
-residualRMSVsStrawLayerName = "trt_b_rmsResOverPhiVsStrawLayer"
-
-#  L/R 
-#=========================
-cLRBreakDownName = TCanvas("hitTypeBreakDown","Hit Type Break Down",1100,800)
-lRBreakDownName = "trt_b_lr"
-
-cLRBreakDownNameEndcap = [TCanvas("Hit Type Break Down (EndcapA)","Hit Type Break Down",1100,800)
-                          ,TCanvas("Hit Type Break Down (EndcapC)","Hit Type Break Down",1100,800)]
-
-lRBreakDownNameEndcap = "trt_ec_lr_"
-
-# rT relation
-#=========================
-cRTRelation = [TCanvas("rT Relation (Before Alignment)","Rt relation (Before Alignment)",1100,800),TCanvas("rT Relation (After Alignment)","Rt relation (After Alignment)",1100,800)]
-rTRelationName = "trt_b_rt"
-
-cRTRelationEndcap = [[TCanvas("rT Relation (EndcapA) Before Alignment","Rt relation (Before Alignment)",1100,800),
-                      TCanvas("rT Relation (EndcapA) After Alignment","Rt relation (After Alignment)",1100,800)],
-                     [TCanvas("rT Relation (EndcapC) Before Alignment","Rt relation (Before Alignment)",1100,800),
-                      TCanvas("rT Relation (EndcapC) After Alignment","Rt relation (After Alignment)",1100,800)]
-                     ]
-    
-rTRelationNameEndcap = "trt_ec_rt_"
-
-for thisTrackSelection in trackSelections:
-    for side in range(len(sideNames)):
-
-        cTRTFittedResidual[side].cd()
-        cTRTFittedResidual[side].SetLogy(1)
-        processAndFitTRTResiduals(barrelResidualName[side],thisTrackSelection+"Residuals/")
-        
-        for lay in range(3):
-            # Residuals Vs Phi
-            cTRTResidualsPhiSec[side].cd(lay+1)
-            procProfile(residualsVsPhiSectorName[lay]+sideNames[side],thisTrackSelection+"Residuals/",minResWin,maxResWin)
-        
-            # RMS Vs Phi
-            cTRTResidualRMSPhiSec[side].cd(lay+1)
-            procProfile(residualRMSVsPhiSectorName[lay]+sideNames[side],thisTrackSelection+"Residuals/")
-        
-        for region in range(5):
-            # Residuals Vs Straw Layer
-            # =========================
-            cTRTResidualsStrawLayer[region].cd(side+1)
-            procProfile(residualsVsStrawLayerName+sideNames[side]+posName[region],thisTrackSelection+"Residuals/")
-            
-            # Residual RMS Vs Straw Layer
-            # ============================
-            cTRTResidualsStrawLayer[region].cd(side+4)
-            procProfile(residualRMSVsStrawLayerName+sideNames[side]+posName[region],thisTrackSelection+"Residuals/")
-            
-                
-        for phi in range(32):
-            cTRTResidualsStrawLayerStackLevel[phi].cd(2*side+1)
-            procProfile(residualsVsStrawLayerStackLevelName[phi]+"_"+sideNames[side],thisTrackSelection+"Residuals/",minResWin,maxResWin)
-            cTRTResidualsStrawLayerStackLevel[phi].cd(2*side+2)
-            procProfile(residualRMSVsStrawLayerStackLevelName[phi]+"_"+sideNames[side],thisTrackSelection+"Residuals/")
-
-
-    cLRBreakDownName.cd()
-    cLRBreakDownName.SetLogy(1)
-    procHistogram(lRBreakDownName, thisTrackSelection+"Residuals/")
-
-    cRTRelation[0].cd()
-    procHitMap(rTRelationName, thisTrackSelection+"Residuals/",0)
-
-    cRTRelation[1].cd()
-    procHitMap(rTRelationName, thisTrackSelection+"Residuals/",1)
-
-    for endcap in range(2):
-
-        cTRTFittedResidualEndcap[endcap].cd()
-        cTRTFittedResidualEndcap[endcap].SetLogy(1)
-        processAndFitTRTResiduals(endcapResidualName+endcapNames[endcap],thisTrackSelection+"Residuals/","#mum")
-        
-        cTRTResidualsVSPhiSecEndcap[endcap].cd()
-        procProfile(residualsVsPhiSectorEndcapName+endcapNames[endcap],thisTrackSelection+"Residuals/")
-        
-        cTRTResidualRMSPhiSecEndcap[endcap].cd()
-        procProfile(residualRMSVsPhiSectorEndcapName+endcapNames[endcap],thisTrackSelection+"Residuals/")
-
-        cTRTResidualsVSRingEndcap[endcap].cd()
-        procProfile(residualsVsRingEndcapName+endcapNames[endcap],thisTrackSelection+"Residuals/")
-        
-        cTRTResidualRMSRingEndcap[endcap].cd()
-        procProfile(residualRMSVsRingEndcapName+endcapNames[endcap],thisTrackSelection+"Residuals/")
-        
-        cLRBreakDownNameEndcap[endcap].cd()
-        cLRBreakDownNameEndcap[endcap].SetLogy(1)
-        procHistogram(lRBreakDownNameEndcap+endcapNames[endcap], thisTrackSelection+"Residuals/")
-        
-        cRTRelationEndcap[endcap][0].cd()
-        procHitMap(rTRelationNameEndcap+endcapNames[endcap], thisTrackSelection+"Residuals/",0)
-        
-        cRTRelationEndcap[endcap][1].cd()
-        procHitMap(rTRelationNameEndcap+endcapNames[endcap], thisTrackSelection+"Residuals/",1)
-
-        for ring in range(40):
-            cTRTEndcapRingResiduals[endcap][ring].cd()
-            processAndFitTRTResiduals(endcapResidualName+"ring_"+str(ring)+"_"+endcapNames[endcap],thisTrackSelection+"Residuals/","#mum")
-        
-    #Write out the histograms
-
-    # Barrel 
-    dirName = thisTrackSelection.split('/')[1]+"BarrelResiduals"
-    rootfile.cd(thisTrackSelection.split('/')[1])
-    gDirectory.cd("Barrel")
-    gDirectory.mkdir("Residuals",dirName).cd()
-
-    for side in range(len(sideNames)):
-        cTRTResidualsPhiSec[side].Write()
-        cTRTResidualRMSPhiSec[side].Write()
-
-    for i in range(3):
-        cTRTFittedResidual[i].Write()
-
-    for i in range(5):
-        cTRTResidualsStrawLayer[i].Write()
-        
-    for i in range(32):
-        cTRTResidualsStrawLayerStackLevel[i].Write()
-
-    cLRBreakDownName.Write()
-
-    cRTRelation[0].Write()
-    cRTRelation[1].Write()
-    
-    # Endcaps
-
-    for endcap in range(2):
-        if not endcap:
-            dirName = thisTrackSelection.split('/')[1]+"EndcapAResiduals"
-            rootfile.cd(thisTrackSelection.split('/')[1])
-            gDirectory.cd("EndcapA")
-            gDirectory.mkdir("Residuals",dirName).cd()
-        else:
-            dirName = thisTrackSelection.split('/')[1]+"EndcapCResiduals"
-            rootfile.cd(thisTrackSelection.split('/')[1])
-            gDirectory.cd("EndcapC")
-            gDirectory.mkdir("Residuals",dirName).cd()
-
-                        
-        cTRTFittedResidualEndcap[endcap].Write()
-        for ring in range(40):
-            cTRTEndcapRingResiduals[endcap][ring].Write()
-
-        cTRTResidualsVSPhiSecEndcap[endcap].Write()
-        cTRTResidualRMSPhiSecEndcap[endcap].Write()
-
-        cTRTResidualsVSRingEndcap[endcap].Write()
-        cTRTResidualRMSRingEndcap[endcap].Write()
-
-        cLRBreakDownNameEndcap[endcap].Write()
-
-        cRTRelationEndcap[endcap][0].Write()
-        cRTRelationEndcap[endcap][1].Write()
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareTrackSegments.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareTrackSegments.py
deleted file mode 100644
index ed381fe11546aac9a8a0a25fcef343f2beda5350..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/CompareTrackSegments.py
+++ /dev/null
@@ -1,139 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  This file compares the Track Segments distributions, is called from makeComparision
-#
-# Author:
-#  John Alison johnda@hep.upenn.edu
-#===========================================================================
-
-# Charge Mis-Id rates
-cChargeID = []
-chargeCanvasName = ["Charge mis-ID Vs D0","Charge mis-ID Vs Z0","Charge mis-ID Vs Pt Low","Charge mis-ID Vs Pt Up"]
-for i in range(len(chargeCanvasName)):
-    cChargeID.append(TCanvas(chargeCanvasName[i],"Charge Mis ID",1100, 800))
-    
-chargeHistName = ["ratio_delta_chargeVsD0",
-                  "ratio_delta_chargeVsZ0",
-                  "ratio_delta_chargeVsPtLow",
-                  "ratio_delta_chargeVsPtUp"]
-
-
-# Delta Track Parameters
-cDeltaTrackParam = []
-deltaCanvasName = ["Delta D0","Delta Phi0","Delta z0","Delta qOverpT","Delta Eta","Delta nHits"]
-m_units = ["mm","radians","mm","GeV^{-1}","",""]
-m_canvasNameHelper = [""," (Positive Tracks)"," (Negative Tracks)"]
-for j in range(3):
-    for i in range(6):
-        cDeltaTrackParam.append(TCanvas(deltaCanvasName[i]+m_canvasNameHelper[j],"Track Segment Comparison", 1100,800))
-      
-
-trackSegmentsName = ["delta_d0","delta_phi0","delta_z0","delta_qOverPt","delta_eta0","delta_nHits"]
-
-cAveVsTrackParam = []
-cSigVsTrackParam = []
-vsCanvasName = [" D0 vs D0", " D0 vs Phi", " D0 vs Pt"," D0 vs Z0"," D0 vs Eta",
-                " Eta0 vs D0", " Eta0 vs Phi", " Eta0 vs Pt"," Eta0 vs Z0"," Eta0 vs Eta0",
-                " Phi0 vs D0", " Phi0 vs Phi", " Phi0 vs Pt"," Phi0 vs Z0"," Phi0 vs Eta0",
-                " qOverPt vs D0", " qOverPt vs Phi", " qOverPt vs Pt"," qOverPt vs Z0"," qOverPt vs Eta0",
-                " Z0 vs D0", " Z0 vs Phi", " Z0 vs Pt"," Z0 vs Z0"," Z0 vs Eta0",
-                " nHits vs D0", " nHits vs Phi", " nHits vs Pt"," nHits vs Z0"," nHits vs Eta0"]
-
-for j in range(3):
-    for i in range(30):
-        cAveVsTrackParam.append(TCanvas("Delta "+vsCanvasName[i]+m_canvasNameHelper[j],"Track Segment Comparison Vs Track Parameter",1100,800))
-        cSigVsTrackParam.append(TCanvas("Sigma "+vsCanvasName[i]+m_canvasNameHelper[j],"Track Segment Comparison Vs Track Parameter",1100,800))
-        
-vsTrackParamName = ["_delta_d0VsD0","_delta_d0VsPhi0","_delta_d0VsPt","_delta_d0VsZ0","_delta_d0VsEta",
-                    "_delta_eta0VsD0","_delta_eta0VsPhi0","_delta_eta0VsPt","_delta_eta0VsZ0","_delta_eta0VsEta",
-                    "_delta_phi0VsD0","_delta_phi0VsPhi0","_delta_phi0VsPt","_delta_phi0VsZ0","_delta_phi0VsEta",
-                    "_delta_qOverPtVsD0","_delta_qOverPtVsPhi0","_delta_qOverPtVsPt","_delta_qOverPtVsZ0","_delta_qOverPtVsEta",
-                    "_delta_z0VsD0","_delta_z0VsPhi0","_delta_z0VsPt","_delta_z0VsZ0","_delta_z0VsEta",
-                    "_delta_nHitsVsD0","_delta_nHitsVsPhi0","_delta_nHitsVsPt","_delta_nHitsVsZ0","_delta_nHitsVsEta"]
-
-m_histNameHelper = ["","_p","_n"]
-
-cAveVsTrackParamAll_mon = []
-cAveVsTrackParamAll_ref = []
-for i in range(30):
-    cAveVsTrackParamAll_ref.append(TCanvas("Delta "+vsCanvasName[i]+" All (Ref)", "Track Segment Comparison Vs Track Parameter", 550,400))
-    cAveVsTrackParamAll_mon.append(TCanvas("Delta "+vsCanvasName[i]+" All (Mon)", "Track Segment Comparison Vs Track Parameter", 550,400))
-
-tpMins = [-0.4,-0.4,-0.4,-0.4,-0.4,
-          -1,-1,-1,-1,-1,
-          -0.003,-0.003,-0.003,-0.003,-0.003,
-          -0.005,-0.005,-0.005,-0.005,-0.005,
-          -1,-1,-1,-1,-1,
-          -5,-5,-5,-5,-5]
-
-tpMaxes = [0.4,0.4,0.4,0.4,0.4,
-           1,1,1,1,1,
-           0.003,0.003,0.003,0.003,0.003,
-           0.005,0.005,0.005,0.005,0.005,
-           1,1,1,1,1,
-           5,5,5,5,5]
-
-for thisTrackSelection in trackSegmentsTrackSelection:
-    for i in range(3):
-        for j in range(6):
-        
-            cDeltaTrackParam[6*i+j].cd()
-            #processAndQuoteHistogram(trackSegmentsName[j]+m_histNameHelper[i],thisTrackSelection+"TrackSegments/",m_units[j])
-            processAndFitHistogram(trackSegmentsName[j]+m_histNameHelper[i],thisTrackSelection+"TrackSegments/",m_units[j])
-
-    if PostProcessing:
-        for i in range(len(chargeCanvasName)):
-            cChargeID[i].cd()
-            procProfile(chargeHistName[i],thisTrackSelection+"TrackSegments/")
-            
-        for i in range(3):
-            for j in range(30):
-                cAveVsTrackParam[(30*i+j)].cd()
-                procProfile("average"+vsTrackParamName[j]+m_histNameHelper[i],thisTrackSelection+"TrackSegments/")
-                if i ==2:
-                    cAveVsTrackParamAll_ref[j].cd()
-                    procAllProfiles(["average"+vsTrackParamName[j]+m_histNameHelper[0],
-                                    "average"+vsTrackParamName[j]+m_histNameHelper[1],
-                                    "average"+vsTrackParamName[j]+m_histNameHelper[2]],
-                                    thisTrackSelection+"TrackSegments/",
-                                    a_file,
-                                    [kBlack, kRed+1,kBlue+1],
-                                    "All (Black), Positive(Red), Negative(Blue)",
-                                    tpMins[i],
-                                    tpMaxes[i])
-
-                    cAveVsTrackParamAll_mon[j].cd()
-                    procAllProfiles(["average"+vsTrackParamName[j]+m_histNameHelper[0],
-                                    "average"+vsTrackParamName[j]+m_histNameHelper[1],
-                                    "average"+vsTrackParamName[j]+m_histNameHelper[2]],
-                                    thisTrackSelection+"TrackSegments/",
-                                    b_file,
-                                    [kBlack, kRed+1,kBlue+1],
-                                    "All (Black), Positive(Red), Negative(Blue)",
-                                    tpMins[i],
-                                    tpMaxes[i])
-
-                                        
-                cSigVsTrackParam[(30*i+j)].cd()
-                procProfile("sigma"+vsTrackParamName[j]+m_histNameHelper[i],thisTrackSelection+"TrackSegments/")
-                                
-    dirName = thisTrackSelection.split('/')[1]+"TrackSegments"
-    rootfile.cd(thisTrackSelection.split('/')[1])
-    gDirectory.cd("Barrel")
-    gDirectory.mkdir("TrackSegments",dirName).cd()
-    for i in range(len(chargeCanvasName)):
-        cChargeID[i].Write()
-
-    for i in range(3*6):
-        cDeltaTrackParam[i].Write()
-
-    if PostProcessing:
-        for i in range(30*3):
-            cAveVsTrackParam[i].Write()
-            cSigVsTrackParam[i].Write()
-
-        for i in range(30):
-            cAveVsTrackParamAll_mon[i].Write()
-            cAveVsTrackParamAll_ref[i].Write()
-        
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots.py
deleted file mode 100755
index 272376ad2601b22d8bd3969c41af1b257a94b1e9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots.py
+++ /dev/null
@@ -1,969 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-# need to provide a configuration file - see makeMonitoringPlotsExampleConfigFile.py
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c <configurationFile>
-#
-##--------------------------
-
-import sys
-from ROOT import *
-from utilities import *
-import AtlasStyle
-gStyle.SetOptStat(0)
-#gROOT.SetBatch(True)
-
-
-#some initialization
-configFileName = ""
-makeOutput = True
-
-#reading in the root file names from input arguments
-for i in range(len(sys.argv)):
-    if sys.argv[i]=="-c":
-        configFileName = sys.argv[i+1]
-
-# reading in configuration file
-fd = open(configFileName)
-config = fd.readlines()
-exec(''.join(config))
-
-print "Reading in from .root files:", rootFileNames[0], rootFileNames[1], rootFileNames[2]
-if makeOutput:
-    print "Producing output in directory:", outputDir
-
-#getting the TFile objects using the rootFileNames
-rootFiles = [TFile,TFile,TFile,TFile]
-nFiles = 0
-for i in range(4):
-    if rootFileNames[i]!="": 
-        rootFiles[i] = TFile(rootFileNames[i])
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print "nFiles = ",nFiles
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-# Basic Barrel Residual distributions
-
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX, outputDir+"/"+"PIXX.png", "Pixel Barrel", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY, outputDir+"/"+"PIXY.png", "Pixel Barrel", "Number of hits on tracks",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX, outputDir+"/"+"SCTX.png", "SCT Barrel", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTR, outputDir+"/"+"TRTR.png", "TRT Barrel", "Number of hits on tracks",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput)
-
-# Basic Pull distributions
-
-PIXPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX, outputDir+"/"+"PIXPULLX.png", "Pixel Barrel", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-#PIXPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-#DrawPlots(PIXPULLY, outputDir+"/"+"PIXPULLY.png", "Pixel Barrel", "Number of hits on tracks",
-#          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-TRTBPULL = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_b_pullR","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTBPULL, outputDir+"/"+"TRTBPULL.png", "TRT Barrel", "Number of hits on tracks",
-          "pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-TRTBPULLNOTUBE = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_b_pullR_notube","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTBPULLNOTUBE, outputDir+"/"+"TRTBPULLNOTUBE.png", "TRT Barrel (NoTube)", "Number of non-tube hits on tracks",
-          "pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-TRTECAPULL = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_Endcap_A","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECAPULL, outputDir+"/"+"TRTECAPULL.png", "TRT Endcap A", "Number of hits on tracks",
-          "pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-TRTECCPULL = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_Endcap_C","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECCPULL, outputDir+"/"+"TRTECCPULL.png", "TRT Endcap C", "Number of hits on tracks",
-          "pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-TRTECAPULLNOTUBE = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_notube_Endcap_A","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECAPULLNOTUBE, outputDir+"/"+"TRTECAPULLNOTUBE.png", "TRT Endcap A (NoTube)", "Number of non-tube hits on tracks",
-          "pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-TRTECCPULLNOTUBE = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_notube_Endcap_C","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECCPULLNOTUBE, outputDir+"/"+"TRTECCPULLNOTUBE.png", "TRT Endcap C (NoTube)", "Number of non-tube hits on tracks",
-          "pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX0, outputDir+"/"+"PIXPULLX0.png", "Pixel Barrel L0", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX1, outputDir+"/"+"PIXPULLX1.png", "Pixel Barrel L1", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX2, outputDir+"/"+"PIXPULLX2.png", "Pixel Barrel L2", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY0, outputDir+"/"+"PIXPULLY0.png", "Pixel Barrel L0", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY1, outputDir+"/"+"PIXPULLY1.png", "Pixel Barrel L1", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY2, outputDir+"/"+"PIXPULLY2.png", "Pixel Barrel L2", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-
-PIXPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECA, outputDir+"/"+"PIXPULLXECA.png", "Pixel Endcap A", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLECAY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECAY, outputDir+"/"+"PIXPULLYECA.png", "Pixel Endcap A", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECC, outputDir+"/"+"PIXPULLXECC.png", "Pixel Endcap C", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-PIXPULLECCY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECCY, outputDir+"/"+"PIXPULLYECC.png", "Pixel Endcap C", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-
-SCTPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX, outputDir+"/"+"SCTPULLX.png", "SCT Barrel", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-SCTPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX0, outputDir+"/"+"SCTPULLX0.png", "SCT Barrel L0", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-SCTPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX1, outputDir+"/"+"SCTPULLX1.png", "SCT Barrel L1", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-SCTPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX2, outputDir+"/"+"SCTPULLX2.png", "SCT Barrel L2", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-SCTPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX3, outputDir+"/"+"SCTPULLX3.png", "SCT Barrel L3", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-SCTPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECA, outputDir+"/"+"SCTPULLXECA.png", "SCT Endcap A", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-SCTPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECC, outputDir+"/"+"SCTPULLXECC.png", "SCT Endcap C", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.60,0.91)
-
-SiBarrelPullXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_pullX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelPullXMean, outputDir+"/"+"SiBarrelPullXMean.png", "Pixel/SCT Barrel", "pull x mean",
-          "", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SiEcaPullXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_pullX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaPullXMean, outputDir+"/"+"SiEcaPullXMean.png", "Pixel/SCT Endcap A", "pull x mean",
-          "", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SiEccPullXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_pullX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccPullXMean, outputDir+"/"+"SiEccPullXMean.png", "Pixel/SCT Endcap C", "pull x mean",
-          "", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SiBarrelPullXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_pullX_width","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelPullXWidth, outputDir+"/"+"SiBarrelPullXWidth.png", "Pixel/SCT Barrel", "pull x width",
-          "", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-#SiEcaPullXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_pullX_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(SiEcaPullXWidth, outputDir+"/"+"SiEcaPullXWidth.png", "Pixel/SCT Endcap A", "pull x width",
-#          "", 0.19, 0.9, "",
-#          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SiEccPullXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_pullX_width","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccPullXWidth, outputDir+"/"+"SiEccPullXWidth.png", "Pixel/SCT Endcap C", "pull x width",
-          "", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-# Residual mean and width distributions as a function of layer, ring, stave in barrel 
-
-SiBarrelResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXMean, outputDir+"/"+"SiBarrelResXMean.png", "Pixel/SCT Barrel", "residual mean [mm]",
-          "", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SiBarrelResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXWidth, outputDir+"/"+"SiBarrelResXWidth.png", "Pixel/SCT Barrel", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PixelXEta = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xresvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXEta, outputDir+"/"+"PixelXvsModEta.png", "Pixel Barrel", "residual mean [mm]",
-          "Module Eta", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PixelXEtaW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xresvsmodeta_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXEtaW, outputDir+"/"+"PixelXvsModEtaWidth.png", "Pixel Barrel", "residual width [mm]",
-          "Module Eta", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-PixelXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhi, outputDir+"/"+"PixelXvsModPhi.png", "Pixel Barrel", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PixelXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhiW, outputDir+"/"+"PixelXvsModPhiWidth.png", "Pixel Barrel", "residual width [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTXEta = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_xresvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTXEta, outputDir+"/"+"SCTXvsModEta.png", "SCT Barrel", "residual mean [mm]",
-          "Module Eta", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTXEtaW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_xresvsmodeta_width","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTXEtaW, outputDir+"/"+"SCTXvsModEtaWidth.png", "SCT Barrel", "residual width [mm]",
-          "Module Eta", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-SCTXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTXPhi, outputDir+"/"+"SCTXvsModPhi.png", "SCT Barrel", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTXPhiW, outputDir+"/"+"SCTXvsModPhiWidth.png", "SCT Barrel", "residual width [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-# Individual Barrel Layer Residual Distributions
-
-PIXX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX0, outputDir+"/"+"PIXX0.png", "Pixel Barrel L0", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX1, outputDir+"/"+"PIXX1.png", "Pixel Barrel L1", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX2, outputDir+"/"+"PIXX2.png", "Pixel Barrel L2", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX0, outputDir+"/"+"SCTX0.png", "SCT Barrel L0", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX1, outputDir+"/"+"SCTX1.png", "SCT Barrel L1", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX2, outputDir+"/"+"SCTX2.png", "SCT Barrel L2", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX3, outputDir+"/"+"SCTX3.png", "SCT Barrel L3", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-# Basic Endcap Residual distributions
-
-## draws combined ECA and ECC residual distribution
-PIXECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECX, outputDir+"/"+"PIXECX.png", "Pixel Endcap", "Number of hits on tracks",
-          "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.62,0.91)
-
-PIXECAX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECAX, outputDir+"/"+"PIXECAX.png", "PIX Endcap A", "Number of hits on tracks",
-          "x residual [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-PIXECCX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECCX, outputDir+"/"+"PIXECCX.png", "PIX Endcap C", "Number of hits on tracks",
-          "x residual [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-PIXECY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualy_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECY, outputDir+"/"+"PIXECY.png", "Pixel Endcap", "Number of hits on tracks",
-          "Local y residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.62,0.91)
-
-PIXECAY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualy_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECAY, outputDir+"/"+"PIXECAY.png", "PIX Endcap A", "Number of hits on tracks",
-          "y residual [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-PIXECCY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualy_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECCY, outputDir+"/"+"PIXECCY.png", "PIX Endcap C", "Number of hits on tracks",
-          "y residual [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-
-# draws combined ECA and ECC residual distribution
-SCTECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECX, outputDir+"/"+"SCTECX.png", "SCT Endcap", "Number of hits on tracks",
-          "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.62,0.91)
-
-SCTECAX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX, outputDir+"/"+"SCTECAX.png", "SCT Endcap A", "Number of hits on tracks",
-          "x residual [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91)
-
-SCTECCX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX, outputDir+"/"+"SCTECCX.png", "SCT Endcap C", "Number of hits on tracks",
-          "x residual [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91)
-
-TRTEC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTEC, outputDir+"/"+"TRTEC.png", "TRT Endcap", "Number of hits on tracks",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput, 0.62, 0.91)
-
-TRTECA = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_Endcap_A","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECA, outputDir+"/"+"TRTECA.png", "TRT Endcap A", "Number of hits on tracks",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput)
-
-TRTECC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_Endcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECC, outputDir+"/"+"TRTECC.png", "TRT Endcap C", "Number of hits on tracks",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput)
-
-# Residual mean and width distributions as a function of endcap disk
-SiEcaResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXMean, outputDir+"/"+"SiEcaResXMean.png", "Pixel/SCT Endcap A", "residual mean [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SiEcaResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXWidth, outputDir+"/"+"SiEcaResXWidth.png", "Pixel/SCT Endcap A", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SiEccResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXMean, outputDir+"/"+"SiEccResXMean.png", "Pixel/SCT Endcap C", "residual mean [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SiEccResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXWidth, outputDir+"/"+"SiEccResXWidth.png", "Pixel/SCT Endcap C", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-# endcap residual distributions for each silicon disk
-
-PIXECAX_DISK1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualx_disk1","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECAX_DISK1, outputDir+"/"+"PIXECAX_DISK1.png", "Pixel X ECA Disk 1", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXECAX_DISK2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualx_disk2","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECAX_DISK2, outputDir+"/"+"PIXECAX_DISK2.png", "Pixel X ECA Disk 2", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXECAX_DISK3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualx_disk3","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECAX_DISK3, outputDir+"/"+"PIXECAX_DISK3.png", "Pixel X ECA Disk 3", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXECCX_DISK1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualx_disk1","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECCX_DISK1, outputDir+"/"+"PIXECCX_DISK1.png", "Pixel X ECC Disk 1", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXECCX_DISK2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualx_disk2","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECCX_DISK2, outputDir+"/"+"PIXECCX_DISK2.png", "Pixel X ECC Disk 2", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXECCX_DISK3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualx_disk3","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECCX_DISK3, outputDir+"/"+"PIXECCX_DISK3.png", "Pixel X ECC Disk 3", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-
-
-SCTECAX_DISK1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_disk1","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX_DISK1, outputDir+"/"+"SCTECAX_DISK1.png", "SCT X ECA Disk 1", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECAX_DISK2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_disk2","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX_DISK2, outputDir+"/"+"SCTECAX_DISK2.png", "SCT X ECA Disk 2", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECAX_DISK3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_disk3","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX_DISK3, outputDir+"/"+"SCTECAX_DISK3.png", "SCT X ECA Disk 3", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECAX_DISK4 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_disk4","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX_DISK4, outputDir+"/"+"SCTECAX_DISK4.png", "SCT X ECA Disk 4", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECAX_DISK5 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_disk5","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX_DISK5, outputDir+"/"+"SCTECAX_DISK5.png", "SCT X ECA Disk 5", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECAX_DISK6 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_disk6","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX_DISK6, outputDir+"/"+"SCTECAX_DISK6.png", "SCT X ECA Disk 6", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECAX_DISK7 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_disk7","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX_DISK7, outputDir+"/"+"SCTECAX_DISK7.png", "SCT X ECA Disk 7", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECAX_DISK8 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_disk8","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX_DISK8, outputDir+"/"+"SCTECAX_DISK8.png", "SCT X ECA Disk 8", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-
-SCTECCX_DISK1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_disk1","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX_DISK1, outputDir+"/"+"SCTECCX_DISK1.png", "SCT X ECC Disk 1", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECCX_DISK2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_disk2","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX_DISK2, outputDir+"/"+"SCTECCX_DISK2.png", "SCT X ECC Disk 2", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECCX_DISK3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_disk3","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX_DISK3, outputDir+"/"+"SCTECCX_DISK3.png", "SCT X ECC Disk 3", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECCX_DISK4 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_disk4","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX_DISK4, outputDir+"/"+"SCTECCX_DISK4.png", "SCT X ECC Disk 4", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECCX_DISK5 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_disk5","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX_DISK5, outputDir+"/"+"SCTECCX_DISK5.png", "SCT X ECC Disk 5", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECCX_DISK6 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_disk6","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX_DISK6, outputDir+"/"+"SCTECCX_DISK6.png", "SCT X ECC Disk 6", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECCX_DISK7 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_disk7","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX_DISK7, outputDir+"/"+"SCTECCX_DISK7.png", "SCT X ECC Disk 7", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTECCX_DISK8 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_disk8","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX_DISK8, outputDir+"/"+"SCTECCX_DISK8.png", "SCT X ECC Disk 8", "Number of hits on tracks",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-
-## Residual mean/width as a function of internal endcap disks
-
-PixelECAXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelECAXPhi, outputDir+"/"+"PixelECAXvsModPhi.png", "Pixel Endcap A", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-PixelECCXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelECCXPhi, outputDir+"/"+"PixelECCXvsModPhi.png", "Pixel Endcap C", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTECAXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTECAXPhi, outputDir+"/"+"SCTECAXvsModPhi.png", "SCT Endcap A", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-SCTECCXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTECCXPhi, outputDir+"/"+"SCTECCXvsModPhi.png", "SCT Endcap C", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-## TRT residual mean and width distributions
-
-TRTBL0PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHI, outputDir+"/"+"TRTBLayer0vsPhi.png", "TRT Barrel Layer 0", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBL0PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHIRMS, outputDir+"/"+"TRTBLayer0vsPhiRMS.png", "TRT Barrel Layer 0", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBL1PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHI, outputDir+"/"+"TRTBLayer1vsPhi.png", "TRT Barrel Layer 1", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBL1PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHIRMS, outputDir+"/"+"TRTBLayer1vsPhiRMS.png", "TRT Barrel Layer 1", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBL2PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHI, outputDir+"/"+"TRTBLayer2vsPhi.png", "TRT Barrel Layer 2", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBL2PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHIRMS, outputDir+"/"+"TRTBLayer2vsPhiRMS.png", "TRT Barrel Layer 2", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBRADIUS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveResOverPhiVsStrawLayer","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBRADIUS, outputDir+"/"+"TRTBVsStrawLayer.png", "TRT Barrel", "residual mean [mm]",
-          "Straw Layer", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBRADIUSRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsResOverPhiVsStrawLayer","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBRADIUSRMS, outputDir+"/"+"TRTBVsStrawLayerRMS.png", "TRT Barrel", "residual RMS [mm]",
-          "Straw Layer", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECAPHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsPhiSec_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECAPHI, outputDir+"/"+"TRTECAvsPhi.png", "TRT Endcap A", "residual mean [mm]",
-          "Phi Sector", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECCPHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsPhiSec_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECCPHI, outputDir+"/"+"TRTECCvsPhi.png", "TRT Endcap C", "residual mean [mm]",
-          "Phi Sector", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECAPHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsPhiSec_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECAPHIRMS, outputDir+"/"+"TRTECAvsPhiRMS.png", "TRT Endcap A", "residual RMS [mm]",
-          "Phi Sector", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECCPHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsPhiSec_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECCPHIRMS, outputDir+"/"+"TRTECCvsPhiRMS.png", "TRT Endcap C", "residual RMS [mm]",
-          "Phi Sector", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECARING = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsRing_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECARING, outputDir+"/"+"TRTECAvsRing.png", "TRT Endcap A", "residual mean [mm]",
-          "Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECCRING = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsRing_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECCRING, outputDir+"/"+"TRTECCvsRing.png", "TRT Endcap C", "residual mean [mm]",
-          "Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECARINGRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsRing_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECARINGRMS, outputDir+"/"+"TRTECAvsRingRMS.png", "TRT Endcap A", "residual RMS [mm]",
-          "Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECCRINGRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsRing_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECCRINGRMS, outputDir+"/"+"TRTECCvsRingRMS.png", "TRT Endcap C", "residual RMS [mm]",
-          "Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-## Generic Track
-
-TrackD0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0, outputDir+"/"+"d0.png", "", "N Tracks",
-          "Impact Parameter [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-TrackZ0PV = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0_pvcorr","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0PV, outputDir+"/"+"z0PV.png", "", "N Tracks",
-          "z0 w.r.t PV [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-
-TrackZ0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0, outputDir+"/"+"z0.png", "", "N Tracks",
-          "z0 [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-TrackPHI = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"phi","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPHI, outputDir+"/"+"phi.png", "", "N Tracks",
-          "phi [radians]", 0.19, 0.9, "radians",
-          canvasText,makeOutput)
-
-TrackETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"eta","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackETA, outputDir+"/"+"eta.png", "", "N Tracks",
-          "eta", 0.19, 0.9, "",
-          canvasText,makeOutput)
-
-TrackPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT.png", "", "N Tracks",
-          "pT", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False)
-
-TrackPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT_nolog","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT_nolog.png", "", "N Tracks",
-          "pT", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False)
-
-TrackSUMMARY = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"summary","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackSUMMARY, outputDir+"/"+"summary.png", "N Hits Summary", "N Tracks",
-          "", 0.19, 0.9, "",
-          canvasText,makeOutput)
-
-TrackCHI2DOF = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"chi2oDoF","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackCHI2DOF, outputDir+"/"+"chi2oDoF.png", "", "N Tracks",
-          "Chi2/DOF", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNTRACKS = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"ntracks","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNTRACKS, outputDir+"/"+"ntracks.png", "Tracks/Event", "N Events",
-          "N Tracks", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNTRTHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Ntrthits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNTRTHits, outputDir+"/"+"nTRTHits.png", "", "N Tracks",
-          "N TRT Hits", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHits, outputDir+"/"+"nSCTHits.png", "", "N Tracks",
-          "N SCT Hits", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsBarrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_barrel","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsBarrel, outputDir+"/"+"nSCTHitsBarrel.png", "", "N Tracks",
-          "N SCT Hits Barrel", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsEca = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_eca","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsEca, outputDir+"/"+"nSCTHitsEca.png", "", "N Tracks",
-          "N SCT Hits Eca", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsEcc = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_ecc","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsEcc, outputDir+"/"+"nSCTHitsEcc.png", "", "N Tracks",
-          "N SCT Hits Ecc", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHits, outputDir+"/"+"nPIXHits.png", "", "N Tracks",
-          "N PIX Hits", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHitsBarrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_barrel","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsBarrel, outputDir+"/"+"nPIXHitsBarrel.png", "", "N Tracks",
-          "N PIX Hits Barrel", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHitsEca = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_eca","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsEca, outputDir+"/"+"nPIXHitsEca.png", "", "N Tracks",
-          "N PIX Hits ECA", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-
-TrackNPIXHitsEcc = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_ecc","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsEcc, outputDir+"/"+"nPIXHitsEcc.png", "", "N Tracks",
-          "N PIX Hits ECC", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-
-
-
-# Hit Efficiencies
-
-SiBarrelHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"measurements_eff_vs_layer_barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelHitEff, outputDir+"/"+"SiBarrelHitEff.png", "Si Barrel Hit Eff.", "Hit Efficiency",
-          "Barrel Layer", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False,"SmallLegend")
-
-SiEcaHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"measurements_eff_vs_layer_eca","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaHitEff, outputDir+"/"+"SiEcaHitEff.png", "Si Endcap A Hit Eff.", "Hit Efficiency",
-          "ECA Disk", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False,"SmallLegend")
-
-SiEccHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"measurements_eff_vs_layer_ecc","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccHitEff, outputDir+"/"+"SiEccHitEff.png", "Si Endcap C Hit Eff.", "Hit Efficiency",
-          "ECC Disk", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False,"SmallLegend")
-
-TRTB0HitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_phiSector_trt_b0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB0HitEff, outputDir+"/"+"TRTB0HitEff.png", "TRT Barrel Layer 0 Hit Eff.", "Hit Efficiency",
-          "Barrel Layer 0 Phi Sector", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False,"SmallLegend")
-
-TRTB1HitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_phiSector_trt_b1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB1HitEff, outputDir+"/"+"TRTB1HitEff.png", "TRT Barrel Layer 1 Hit Eff.", "Hit Efficiency",
-          "Barrel Layer 1 Phi Sector", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False,"SmallLegend")
-
-TRTB2HitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_phiSector_trt_b2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB2HitEff, outputDir+"/"+"TRTB2HitEff.png", "TRT Barrel Layer 2 Hit Eff.", "Hit Efficiency",
-          "Barrel Layer 2 Phi Sector", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False,"SmallLegend")
-
-TRTECAHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_ring_trt_ec_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECAHitEff, outputDir+"/"+"TRTECAHitEff.png", "TRT Endcap A Hit Eff.", "Hit Efficiency",
-          "Endcap A Wheel", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False,"SmallLegend")
-
-TRTECCHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_ring_trt_ec_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECCHitEff, outputDir+"/"+"TRTECCHitEff.png", "TRT Endcap C Hit Eff.", "Hit Efficiency",
-          "Endcap C Wheel", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False,"SmallLegend")
-
-## SivsTRT
-
-TRTExtEffEta = MakePlots(siTRTDir,legendTitles,markerColors,markerStyles,"eff_trthits_eta0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTExtEffEta, outputDir+"/"+"TRTExtEffVsEta.png", "TRT Extension Eff.", "TRT Extension Eff.",
-          "Track Eta", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False)
-
-TRTExtEffPhi = MakePlots(siTRTDir,legendTitles,markerColors,markerStyles,"eff_trthits_phi0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTExtEffPhi, outputDir+"/"+"TRTExtEffVsPhi.png", "TRT Extension Eff.", "TRT Extension Eff.",
-          "Track Phi", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False)
-
-## Generic Tracks asymmetry plots
-#
-# charge asymmetry vs track pT
-ASYM_PT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_pT_asym","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_PT, outputDir+"/"+"TrackAsym_pT.png", "Full ID", "(neg-pos)/pos+neg",
-          "Track p_{T} [GeV]", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_PT_BARREL = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_pT_asym_barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_PT_BARREL, outputDir+"/"+"TrackAsym_barrel_pT.png", "Barrel", "(neg-pos)/pos+neg",
-          "Track p_{T} [GeV]", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_PT_ECA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_pT_asym_eca","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_PT_ECA, outputDir+"/"+"TrackAsym_eca_pT.png", "Endcap A", "(neg-pos)/pos+neg",
-          "Track p_{T} [GeV]", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_PT_ECC = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_pT_asym_ecc","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_PT_ECC, outputDir+"/"+"TrackAsym_ecc_pT.png", "Endcap C", "(neg-pos)/pos+neg",
-          "Track p_{T} [GeV]", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-# charge asymmetry vs track phi0
-
-#there is no overall ID phi0 asymmetry plot
-ASYM_PHI_BARREL = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_phi0_asym_barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_PHI_BARREL, outputDir+"/"+"TrackAsym_phi_barrel.png", "Barrel", "(neg-pos)/pos+neg",
-          "Track Phi0", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_PHI_ECA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_phi0_asym_eca","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_PHI_ECA, outputDir+"/"+"TrackAsym_phi_eca.png", "Endcap A", "(neg-pos)/pos+neg",
-          "Track Phi0", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_PHI_ECC = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_phi0_asym_ecc","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_PHI_ECC, outputDir+"/"+"TrackAsym_phi_ecc.png", "Endcap C", "(neg-pos)/pos+neg",
-          "Track Phi0", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-# charge asymmetry vs track d0 (corrected for primary vtx)
-
-ASYM_D0C = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_d0c_asym","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_D0C, outputDir+"/"+"TrackAsym_d0c.png", "Full ID", "(neg-pos)/pos+neg",
-          "Track d0 [mm] (corrected for pvtx)", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_D0C_BARREL = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_d0c_asym_barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_D0C_BARREL, outputDir+"/"+"TrackAsym_barrel_d0c.png", "Barrel", "(neg-pos)/pos+neg",
-          "Track d0 [mm] (corrected for pvtx)", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_D0C_ECA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_d0c_asym_eca","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_D0C_ECA, outputDir+"/"+"TrackAsym_eca_d0c.png", "Endcap A", "(neg-pos)/pos+neg",
-          "Track d0 [mm] (corrected for pvtx)", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_D0C_ECC = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_d0c_asym_ecc","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_D0C_ECC, outputDir+"/"+"TrackAsym_ecc_d0c.png", "Endcap C", "(neg-pos)/pos+neg",
-          "Track d0 [mm] (corrected for pvtx)", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-# charge asymmetry vs track z0 (corrected for primary vtx)
-
-ASYM_Z0C = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_z0c_asym","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_Z0C, outputDir+"/"+"TrackAsym_z0c.png", "Full ID", "(neg-pos)/pos+neg",
-          "Track z0 [mm] (corrected for pvtx)", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_Z0C_BARREL = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_z0c_asym_barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_Z0C_BARREL, outputDir+"/"+"TrackAsym_barrel_z0c.png", "Barrel", "(neg-pos)/pos+neg",
-          "Track z0 [mm] (corrected for pvtx)", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_Z0C_ECA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_z0c_asym_eca","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_Z0C_ECA, outputDir+"/"+"TrackAsym_eca_z0c.png", "Endcap A", "(neg-pos)/pos+neg",
-          "Track z0 [mm] (corrected for pvtx)", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ASYM_Z0C_ECC = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"trk_z0c_asym_ecc","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_Z0C_ECC, outputDir+"/"+"TrackAsym_ecc_z0c.png", "Endcap C", "(neg-pos)/pos+neg",
-          "Track z0 [mm] (corrected for pvtx)", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-# charge asymmetry vs track eta0
-
-ASYM_ETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"eta_asym","noFit",rootFiles,nFiles,False)
-DrawPlots(ASYM_ETA, outputDir+"/"+"TrackAsym_eta.png", "Full ID", "(neg-pos)/pos+neg",
-          "Track #eta", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-# residual means as a function of track pT 
-
-PIXBRESX_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXBRESX_PT, outputDir+"/"+"PixBarrelResXMeanVsPt.png", "Pixel Barrel", "mean local residual x [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PIXBRESXFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXBRESXFWHM_PT, outputDir+"/"+"PixBarrelResXFWHMVsPt.png", "Pixel Barrel", "local residual x FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PIXECARESX_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualx_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXECARESX_PT, outputDir+"/"+"PixECAResXMeanVsPt.png", "Pixel ECA", "mean local residual x [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PIXECARESXFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualx_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXECARESXFWHM_PT, outputDir+"/"+"PixECAResXFWHMVsPt.png", "Pixel ECA", "local residual x FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PIXECCRESX_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualx_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXECCRESX_PT, outputDir+"/"+"PixECCResXMeanVsPt.png", "Pixel ECC", "mean local residual x [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PIXECCRESXFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualx_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXECCRESXFWHM_PT, outputDir+"/"+"PixECCResXFWHMVsPt.png", "Pixel ECC", "local residual x FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTBRESX_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTBRESX_PT, outputDir+"/"+"SctBarrelResXMeanVsPt.png", "SCT Barrel", "mean local residual x [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTBRESXFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTBRESXFWHM_PT, outputDir+"/"+"SctBarrelResXFWHMVsPt.png", "SCT Barrel", "local residual x FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTECARESX_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTECARESX_PT, outputDir+"/"+"SctECAResXMeanVsPt.png", "SCT ECA", "mean local residual x [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTECARESXFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTECARESXFWHM_PT, outputDir+"/"+"SctECAResXFWHMVsPt.png", "SCT ECA", "local residual x FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTECCRESX_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTECCRESX_PT, outputDir+"/"+"SctECCResXMeanVsPt.png", "SCT ECC", "mean local residual x [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTECCRESXFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTECCRESXFWHM_PT, outputDir+"/"+"SctECCResXFWHMVsPt.png", "SCT ECC", "local residual x FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBRES_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_b_residual_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBRES_PT, outputDir+"/"+"TRTBarrelResMeanVsPt.png", "TRT Barrel", "mean residual [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTBRESFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_b_residual_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBRESFWHM_PT, outputDir+"/"+"TRTBarrelResFWHMVsPt.png", "TRT Barrel", "residual FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECARES_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_eca_residual_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECARES_PT, outputDir+"/"+"TRTECAResMeanVsPt.png", "TRT Endcap A", "mean residual [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECARESFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_eca_residual_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECARESFWHM_PT, outputDir+"/"+"TRTECAResFWHMVsPt.png", "TRT Endcap A", "residual FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECCRES_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ecc_residual_pt_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECCRES_PT, outputDir+"/"+"TRTECCResMeanVsPt.png", "TRT Endcap C", "mean residual [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-TRTECCRESFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ecc_residual_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECCRESFWHM_PT, outputDir+"/"+"TRTECCResFWHMVsPt.png", "TRT Endcap C", "residual FWHM/2.35 [mm]",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-## Pixel Pull widths as a function of track pT
-PIXBPULLXWIDTH_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx_pt_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXBPULLXWIDTH_PT, outputDir+"/"+"PixBarrelPullXWidthVsPt.png", "Pixel Barrel", "width pull x",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PIXECAPULLXWIDTH_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pullx_pt_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXECAPULLXWIDTH_PT, outputDir+"/"+"PixECAPullXWidthVsPt.png", "Pixel ECA", "width pull x",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-PIXECCPULLXWIDTH_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pullx_pt_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXECCPULLXWIDTH_PT, outputDir+"/"+"PixECCPullXWidthVsPt.png", "Pixel ECC", "width pull x",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTBPULLXWIDTH_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_pullx_pt_width","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTBPULLXWIDTH_PT, outputDir+"/"+"SctBarrelPullXWidthVsPt.png", "SCT Barrel", "width pull x",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTECAPULLXWIDTH_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_pullx_pt_width","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTECAPULLXWIDTH_PT, outputDir+"/"+"SctECAPullXWidthVsPt.png", "SCT ECA", "width pull x",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-SCTECCPULLXWIDTH_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_pullx_pt_width","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTECCPULLXWIDTH_PT, outputDir+"/"+"SctECCPullXWidthVsPt.png", "SCT ECC", "width pull x",
-          "Track p_{T}", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-
-# track parameter errors
-
-ERRD0_PT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"errD0VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(ERRD0_PT, outputDir+"/"+"errD0vspT.png", "Full ID", "#sigma_{d0} [mm]",
-          "Track p_{T}", 0.35, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ERRTHETA_PT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"errCotThetaVsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(ERRTHETA_PT, outputDir+"/"+"errCotThetavspT.png", "Full ID", "#sigma_{cot#theta}",
-          "Track p_{T}", 0.35, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ERRPHI0_PT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"errPhi0VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(ERRPHI0_PT, outputDir+"/"+"errPhivspT.png", "Full ID", "#sigma_{#phi}",
-          "Track p_{T}", 0.35, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ERRPT_PT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"errPtVsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(ERRPT_PT, outputDir+"/"+"errPtvspT.png", "Full ID", "#sigma_{p_{T}} [GeV]",
-          "Track p_{T}", 0.35, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-ERRCURV_PT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"errPt_Pt2VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(ERRCURV_PT, outputDir+"/"+"errCurvaturevspT.png", "Full ID", "#sigma_{q/p_{T}} [1/GeV]",
-          "Track p_{T}", 0.35, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-# plots of impact parameter (corrected for beamspot) versus other track parameters
-
-TrackD0BS = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0_bscorr","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0BS, outputDir+"/"+"d0BS.png", "", "N Tracks",
-          "Impact Parameter w.r.t BS [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-TrackD0PV = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0_pvcorr","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0PV, outputDir+"/"+"d0PV.png", "", "N Tracks",
-          "Impact Parameter w.r.t PV [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-D0BSvsPHI = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPHI, outputDir+"/"+"d0BSvsPHI.png", "Full ID", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-D0BSvsPHI_Barrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0_Barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPHI_Barrel, outputDir+"/"+"d0BSvsPHI_Barrel.png", "ID Barrel", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-D0BSvsPHI_ECA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0_ECA","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPHI_ECA, outputDir+"/"+"d0BSvsPHI_ECA.png", "ID ECA", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-D0BSvsPHI_ECC = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0_ECC","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPHI_ECC, outputDir+"/"+"d0BSvsPHI_ECC.png", "ID ECC", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-D0BSvsPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPT, outputDir+"/"+"d0BSvsPT.png", "Full ID", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track p_{T} [GeV]", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-D0BSvsPT_Barrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPt_Barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPT_Barrel, outputDir+"/"+"d0BSvsPT_Barrel.png", "ID Barrel", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track p_{T} [GeV]", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-D0BSvsPT_ECA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPt_ECA","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPT_ECA, outputDir+"/"+"d0BSvsPT_ECA.png", "ID ECA", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track p_{T} [GeV]", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-D0BSvsPT_ECC = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPt_ECC","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPT_ECC, outputDir+"/"+"d0BSvsPT_ECC.png", "ID ECC", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track p_{T} [GeV]", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-D0BSvsETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsEta","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsETA, outputDir+"/"+"d0BSvsETA.png", "Full ID", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #eta", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False,"SmallLegend")
-
-
-
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots_ForApprovedPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots_ForApprovedPlots.py
deleted file mode 100755
index c6af9dc9cf95cee3f60c9398030a7a7c8006ddef..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots_ForApprovedPlots.py
+++ /dev/null
@@ -1,237 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c <configurationFile>
-#
-##--------------------------
-
-import sys
-from ROOT import *
-from utilities import *
-#import AtlasStyle
-gStyle.SetOptStat(0)
-
-
-
-#some initialization
-configFileName = ""
-makeOutput = True
-
-#reading in the root file names from input arguments
-for i in range(len(sys.argv)):
-    if sys.argv[i]=="-c":
-        configFileName = sys.argv[i+1]
-
-# reading in configuration file
-fd = open(configFileName)
-config = fd.readlines()
-exec(''.join(config))
-
-print "Reading in from .root files:", rootFileNames[0], rootFileNames[1], rootFileNames[2]
-if makeOutput:
-    print "Producing output in directory:", outputDir
-
-#getting the TFile objects using the rootFileNames
-rootFiles = [TFile,TFile,TFile]
-nFiles = 0
-for i in range(3):
-    if rootFileNames[i]!="": 
-        rootFiles[i] = TFile(rootFileNames[i])
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print "nFiles = ",nFiles
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-#PIXB_XRESMEAN_1D = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xres_mean1d","noFit",rootFiles,nFiles,normaliseHistos,unitArea)
-#DrawPlots(PIXB_XRESMEAN_1D, outputDir+"/"+"PIXB_XRESMEAN_1D.png", "Pixel barrel", "Number of Modules",
-#          "<Local x residual> [#mum]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-#
-#PIXB_XRESMEANERROR_1D = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xres_meanerror1d","noFit",rootFiles,nFiles,normaliseHistos,unitArea)
-#DrawPlots(PIXB_XRESMEANERROR_1D, outputDir+"/"+"PIXB_XRESMEANERROR_1D.png", "Pixel barrel", "Number of Modules",
-#          "<Local x residual> Error [#mum]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-#
-#PIXB_XRESNENTRIES_1D = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xres_nentries1d","noFit",rootFiles,nFiles,normaliseHistos,unitArea)
-#DrawPlots(PIXB_XRESNENTRIES_1D, outputDir+"/"+"PIXB_XRESNENTRIES_1D.png", "Pixel barrel", "Number of Modules",
-#          "<Local x residual> Error [#mum]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-#
-#PIXB_YRESMEAN_1D = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_yres_mean1d","noFit",rootFiles,nFiles,normaliseHistos,unitArea)
-#DrawPlots(PIXB_YRESMEAN_1D, outputDir+"/"+"PIXB_YRESMEAN_1D.png", "Pixel barrel", "Number of Modules",
-#          "<Local x residual> [#mum]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-
-# Basic Barrel Residual distributions
-
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX, outputDir+"/"+"PIXX.eps", "Pixel barrel", "Hits on tracks / 4 #mum ",
-          "Local x residual [mm]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-PIXECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECX, outputDir+"/"+"PIXECX.eps", "Pixel end-caps", "Hits on tracks / 4 #mum ",
-          "Local x residual [mm]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY, outputDir+"/"+"PIXY.eps", "Pixel barrel", "Hits on tracks / 8 #mum ",
-          "Local y residual [mm]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-PIXECY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualy_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECY, outputDir+"/"+"PIXECY.eps", "Pixel end-caps", "Hits on tracks / 32 #mum ",
-          "Local y residual [mm]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-SCTX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX, outputDir+"/"+"SCTX.eps", "SCT barrel", "Hits on tracks / 4 #mum ",
-          "Local x residual [mm]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-SCTECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_residualx_fine","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECX, outputDir+"/"+"SCTECX.eps", "SCT end-caps", "Hits on tracks / 4 #mum ",
-          "Local x residual [mm]", 0.22, 0.90, "#mum",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-
-TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTR, outputDir+"/"+"TRTR.eps", "TRT barrel", "Hits on tracks / 12 #mum ",
-          "Residual [mm]", 0.21, 0.90, "#mum",canvasText,makeOutput, 0.62, 0.87,True,"ApprovedPlotsMay")
-
-TRTEC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTEC, outputDir+"/"+"TRTEC.eps", "TRT end-caps", "Hits on tracks / 12 #mum ",
-          "Residual [mm]", 0.21, 0.90, "#mum",canvasText,makeOutput, 0.62, 0.87,True,"ApprovedPlotsMay")
-
-
-TRTECA = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_Endcap_A","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECA, outputDir+"/"+"TRTECA.eps", "TRT endcap A", "Hits on tracks / 12 #mum ",
-          "Residual [mm]", 0.21, 0.90, "#mum",canvasText,makeOutput, 0.62, 0.87,True,"ApprovedPlotsMay")
-
-TRTECC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_Endcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECC, outputDir+"/"+"TRTECC.eps", "TRT endcap C", "Hits on tracks / 12 #mum ",
-          "Residual [mm]", 0.21, 0.90, "#mum",canvasText,makeOutput, 0.62, 0.87,True,"ApprovedPlotsMay")
-
-# Residual Mean as a function of barrel layer, endcap disk.
-
-SiBarrelResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXMean, outputDir+"/"+"SiBarrelResXMean.eps", "Pixel/SCT Barrel", "Residual mean [mm]",
-          "Barrel Layer", 0.22, 0.9, "#mum",
-          canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-SiEcaResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXMean, outputDir+"/"+"SiEcaResXMean.eps", "Pixel/SCT Endcap A", "Residual mean [mm]",
-          "", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-SiEccResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXMean, outputDir+"/"+"SiEccResXMean.eps", "Pixel/SCT Endcap A", "Residual mean [mm]",
-          "", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-TRTBRADIUS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveResOverPhiVsStrawLayer","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBRADIUS, outputDir+"/"+"TRTBVsStrawLayer.eps", "TRT Barrel", "Residual mean [mm]",
-          "Straw Layer", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-TRTECAPHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsPhiSec_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECAPHI, outputDir+"/"+"TRTECAvsPhi.eps", "TRT Endcap A", "Residual mean [mm]",
-          "Phi Sector", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-TRTECCPHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsPhiSec_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTECCPHI, outputDir+"/"+"TRTECCvsPhi.eps", "TRT Endcap C", "Residual mean [mm]",
-          "Phi Sector", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-# Residual Width as a function of track pT
-
-PIXBRESXFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(PIXBRESXFWHM_PT, outputDir+"/"+"PixBarrelResXFWHMVsPt.eps", "Pixel Barrel", "Local residual x FWHM/2.35 [mm]",
-          "Track p_{T}", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-SCTBRESXFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTBRESXFWHM_PT, outputDir+"/"+"SctBarrelResXFWHMVsPt.eps", "SCT Barrel", "Local residual x FWHM/2.35 [mm]",
-          "Track p_{T}", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-TRTBRESFWHM_PT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_b_residual_pt_fwhm","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBRESFWHM_PT, outputDir+"/"+"TRTBarrelResFWHMVsPt.eps", "TRT Barrel", "Residual FWHM/2.35 [mm]",
-          "Track p_{T}", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-# Basic Pull distributions
-
-PIXPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX, outputDir+"/"+"PIXPULLX.eps", "Pixel Barrel", "Hits on tracks",
-          "x Pull", 0.22, 0.9, "",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-PIXPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY, outputDir+"/"+"PIXPULLY.eps", "Pixel Barrel", "Hits on tracks",
-          "y Pull", 0.22, 0.9, "",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-PIXECPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECPULLX, outputDir+"/"+"PIXECPULLX.eps", "Pixel Endcaps", "Hits on tracks",
-          "x Pull", 0.22, 0.9, "",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-PIXECPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECPULLY, outputDir+"/"+"PIXECPULLY.eps", "Pixel Endcaps", "Hits on tracks",
-          "y Pull", 0.22, 0.9, "",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-SCTPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX, outputDir+"/"+"SCTPULLX.eps", "SCT Barrel", "Hits on tracks",
-          "x Pull", 0.22, 0.9, "",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-SCTECPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECPULLX, outputDir+"/"+"SCTECPULLX.eps", "SCT Endcaps", "Hits on tracks",
-          "x Pull", 0.22, 0.9, "",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-TRTBPULLNOTUBE = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_b_pullR_notube","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTBPULLNOTUBE, outputDir+"/"+"TRTBPULLNOTUBE.eps", "TRT Barrel", "Precision hits on tracks",
-          "Pull", 0.22, 0.9, "",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-TRTECPULLNOTUBE = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_notube","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECPULLNOTUBE, outputDir+"/"+"TRTECPULLNOTUBE.eps", "TRT Endcaps", "Precision hits on tracks",
-          "Pull", 0.22, 0.9, "",canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-
-# Impact parameter plots
-
-TrackD0BS = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0_bscorr","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0BS, outputDir+"/"+"d0BS.eps", "", "N Tracks",
-          "Impact Parameter (corrected for beamspot) [mm]", 0.22, 0.9, "#mum",
-          canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-TrackD0PV = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0_pvcorr","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0PV, outputDir+"/"+"d0PV.eps", "", "N Tracks",
-          "Impact Parameter (corrected for primary vertex) [mm]", 0.22, 0.9, "#mum",
-          canvasText,makeOutput,0.62,0.87,True,"ApprovedPlotsMay")
-
-D0BSvsPHI = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPHI, outputDir+"/"+"d0BSvsPHI.eps", "", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #phi", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-D0BSvsPHI_Barrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0_Barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPHI_Barrel, outputDir+"/"+"d0BSvsPHI_Barrel.eps", "Barrel Tracks", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #phi", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-D0BSvsPHI_ECA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0_ECA","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPHI_ECA, outputDir+"/"+"d0BSvsPHI_ECA.eps", "Endcap A Tracks", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #phi", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-D0BSvsPHI_ECC = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0_ECC","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsPHI_ECC, outputDir+"/"+"d0BSvsPHI_ECC.eps", "Endcap C Tracks", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #phi", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87 ,False,"ApprovedPlotsMay")
-
-D0BSvsETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsEta","noFit",rootFiles,nFiles,False)
-DrawPlots(D0BSvsETA, outputDir+"/"+"d0BSvsETA.eps", "Full ID", "mean d_{0} (corrected for beamspot) [mm]",
-          "Track #eta", 0.22, 0.9, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-# Track parameter errors
-
-ERRD0_PT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"errD0VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(ERRD0_PT, outputDir+"/"+"errD0vspT.eps", "", "#sigma_{d0} [mm]",
-          "Track p_{T}", 0.55, 0.6, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
-
-ERRCURV_PT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"errPt_Pt2VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(ERRCURV_PT, outputDir+"/"+"errCurvaturevspT.eps", "", "#sigma_{q/p_{T}} [1/GeV]",
-          "Track p_{T}", 0.55, 0.6, "#mum",canvasText,makeOutput,0.62,0.87,False,"ApprovedPlotsMay")
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots_HandsOn.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots_HandsOn.py
deleted file mode 100755
index f0c0ff2b195eabb35df8a4e445082e7ba3853b71..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots_HandsOn.py
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# small adds Pierfrancesco Butti pbutti@nikhef.nl
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-# need to provide a configuration file - see makeMonitoringPlotsExampleConfigFile.py
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c <configurationFile>
-#
-##--------------------------
-
-import sys
-from ROOT import *
-from utilities_ZmumuCosmics import *
-import AtlasStyle
-gStyle.SetOptStat(0)
-
-oFext=""
-nMAXFiles = 2
-#some initialization
-configFileName = ""
-makeOutput = True
-
-#reading in the root file names from input arguments
-for i in range(len(sys.argv)):
-    if sys.argv[i]=="-c":
-        configFileName = sys.argv[i+1]
-
-# reading in configuration file
-fd = open(configFileName)
-config = fd.readlines()
-exec(''.join(config))
-
-print "Reading in from .root files:"
-for i in range(nMAXFiles) :
-    print rootFileNames[i]
-
-
-if makeOutput:
-    print "Producing output in directory:", outputDir
-
-#getting the TFile objects using the rootFileNames
-rootFiles = [TFile,TFile,TFile,TFile] 
-nFiles = 0
-for i in range(nMAXFiles):
-    if rootFileNames[i]!="": 
-        rootFiles[i] = TFile(rootFileNames[i])
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print "nFiles = ",nFiles
-
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-#options set in utilities_ZmumuCosmics.py
-#residualsDir is the path to the residuals dir in the monitoring root file.
-#legendTitles,markerColors,markerStyles,rootFiles are all seld explanatory.
-#
-
-
-##########################################
-
-############HANDS ON PART#################
-
-##########################################
-
-
-#use this macro to produce some plots for the monitoring exercise. Use the example shown to include:
-#1) some kinematics properties of tracks (pT,d0,z0,eta,phi)
-#2) X and Y residuals as a function of the pixel Layers
-#3) X residuals as a function of the sct layers. Compare the width of the residuals.
-#4) Plots the residuals as a function of the incident angle theta and phi. What differences do you observe between
-#Collisions and Cosmics?
-#5) Plots everything you think is interesting to check on the basis of the
-
-
-## # Basic Barrel Residual distributions
-
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXX, outputDir+"/"+"PIXX.png"+oFext, "Pixel barrel", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXY, outputDir+"/"+"PIXY.png"+oFext, "Pixel barrel", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-# Basic Pull distributions
-
-PIXPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX, outputDir+"/"+"PIXPULLX.png", "Pixel Barrel", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY, outputDir+"/"+"PIXPULLY.png", "Pixel Barrel", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-
-## # Residual mean and width distributions as a function of layer, ring, stave in barrel 
-
-SiBarrelResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXMean, outputDir+"/"+"SiBarrelResXMean.png"+oFext, "Pixel/SCT Barrel", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.63,0.86,False)
-
-
-SiBarrelResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXWidth, outputDir+"/"+"SiBarrelResXWidth.png"+oFext, "Pixel/SCT Barrel", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.63,0.86,False)
-
-
-        
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeBeamSpotPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeBeamSpotPlots.py
deleted file mode 100644
index 33cb69c8c9c824308dea8c52102723c8cadaedff..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeBeamSpotPlots.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# start with lumiblock
-#
-LUMIBLOCK = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"LumiBlock","noFit",rootFiles,nFiles,False) 
-DrawPlots(LUMIBLOCK, outputDir+"/"+"LumiBlock."+oFext, "", "Events",
-          "LumiBlock", 0.65, 0.80, "",
-          canvasText,makeOutput,0.60,0.85,True)
-
-BSPAR = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"XBs","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(BSPAR, outputDir+"/"+"BeamSpot_X.png", "", "Events", "Beam Spot X [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-BSPAR = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"YBs","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(BSPAR, outputDir+"/"+"BeamSpot_Y.png", "", "Events", "Beam Spot Y [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-BSPAR = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"ZBs","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(BSPAR, outputDir+"/"+"BeamSpot_Z.png", "", "Events", "Beam Spot Z [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-BSPAR = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"TiltX_Bs","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(BSPAR, outputDir+"/"+"BeamSpot_TiltX.png", "", "Events", "Beam Spot Tilt X", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-BSPAR = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"TiltY_Bs","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(BSPAR, outputDir+"/"+"BeamSpot_TiltY.png", "", "Events", "Beam Spot Tilt Y", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-TrackD0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0, outputDir+"/"+"d0.png", "", "N Tracks",
-          "Impact Parameter [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-TrackZ0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0, outputDir+"/"+"z0.png", "", "N Tracks",
-          "z0 [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-D0VSPHI0 = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"D0VsPhi0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(D0VSPHI0,outputDir+"/"+"D0vsPHI0.png","","d_{0} [mm]", "#phi_{0} [rad]",0.2,0.9,"", canvasText,makeOutput, 0.60, 0.91, False);
-
-#D0VSPHI0 = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"D0bsVsPhi0_Barrel","noFit",rootFiles,nFiles,normaliseHistos)
-#DrawPlots(D0VSPHI0,outputDir+"/"+"D0vsPHI0_BAR.png","Barrel","d_{0} [mm]", "#phi_{0} [rad]",0.2,0.9,"", canvasText,makeOutput, 0.60, 0.91, False);
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeClusterSizePlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeClusterSizePlots.py
deleted file mode 100644
index b5a5b89bfd842ed676e8765e1fffff49862e9c1a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeClusterSizePlots.py
+++ /dev/null
@@ -1,99 +0,0 @@
-
-for i in range(nFiles):    
-    SCTBAR_Maps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "BAR",0, True, 3, "clustersize")
-    outputFileName = outputDir+"/"+"SCTBAR_s0ClusterSizeMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(SCTBAR_Maps, outputFileName, "#eta id", "#phi id", "Average cluster size", 0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","BAR")
-
-    SCTBAR_Maps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "BAR",1, True, 3, "clustersize")
-    outputFileName = outputDir+"/"+"SCTBAR_s1ClusterSizeMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(SCTBAR_Maps, outputFileName, "#eta id", "#phi id", "Average cluster size", 0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","BAR")
-    
-
-    #PIX
-
-    
-    PIXX0vsCLUSIZPHI = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX0vsCLUSIZPHI,outputDir+"/"+"PIXX0vsCLUSIZEPHI."+oFext,"PIX Barrel layer 0","Local x residual [mm]","Cluster size #phi",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-    PIXX1vsCLUSIZPHI = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX1vsCLUSIZPHI,outputDir+"/"+"PIXX1vsCLUSIZEPHI."+oFext,"PIX Barrel layer 1","Local x residual [mm]","Cluster size #phi",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-    
-    PIXX2vsCLUSIZPHI = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX2vsCLUSIZPHI,outputDir+"/"+"PIXX2vsCLUSIZEPHI."+oFext,"PIX Barrel layer 2","Local x residual [mm]","Cluster size #phi",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-    PIXX3vsCLUSIZPHI = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX3vsCLUSIZPHI,outputDir+"/"+"PIXX3vsCLUSIZEPHI."+oFext,"PXI Barrel layer 3","Local x residual [mm]","Cluster size #phi",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-
-
-    PIXX0vsCLUSIZZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx_clustersizeZ","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX0vsCLUSIZZ,outputDir+"/"+"PIXX0vsCLUSIZEZ."+oFext,"PIX Barrel layer 0","Local x residual [mm]","Cluster size z",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-    PIXX1vsCLUSIZZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx_clustersizeZ","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX1vsCLUSIZZ,outputDir+"/"+"PIXX1vsCLUSIZEZ."+oFext,"PIX Barrel layer 1","Local x residual [mm]","Cluster size z",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-    
-    PIXX2vsCLUSIZZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx_clustersizeZ","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX2vsCLUSIZZ,outputDir+"/"+"PIXX2vsCLUSIZEZ."+oFext,"PIX Barrel layer 2","Local x residual [mm]","Cluster size z",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-    PIXX3vsCLUSIZZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualx_clustersizeZ","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX3vsCLUSIZZ,outputDir+"/"+"PIXX3vsCLUSIZEZ."+oFext,"PXI Barrel layer 3","Local x residual [mm]","Cluster size z",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-    
-    PIXY0vsCLUSIZPHI = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualy_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXY0vsCLUSIZPHI,outputDir+"/"+"PIXY0vsCLUSIZEPHI."+oFext,"PIX Barrel layer 0","Local y residual [mm]","Cluster size #phi",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-    PIXY1vsCLUSIZPHI = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualy_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXY1vsCLUSIZPHI,outputDir+"/"+"PIXY1vsCLUSIZEPHI."+oFext,"PIX Barrel layer 1","Local y residual [mm]","Cluster size #phi",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-    
-    PIXY2vsCLUSIZPHI = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualy_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXY2vsCLUSIZPHI,outputDir+"/"+"PIXY2vsCLUSIZEPHI."+oFext,"PIX Barrel layer 2","Local y residual [mm]","Cluster size #phi",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-    PIXY3vsCLUSIZPHI = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualy_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXY3vsCLUSIZPHI,outputDir+"/"+"PIXY3vsCLUSIZEPHI."+oFext,"PXI Barrel layer 3","Local y residual [mm]","Cluster size #phi",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-
-
-    PIXY0vsCLUSIZZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualy_clustersizeZ","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXY0vsCLUSIZZ,outputDir+"/"+"PIXY0vsCLUSIZEZ."+oFext,"PIX Barrel layer 0","Local y residual [mm]","Cluster size z",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-    PIXY1vsCLUSIZZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualy_clustersizeZ","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXY1vsCLUSIZZ,outputDir+"/"+"PIXY1vsCLUSIZEZ."+oFext,"PIX Barrel layer 1","Local y residual [mm]","Cluster size z",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-    
-    PIXY2vsCLUSIZZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualy_clustersizeZ","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXY2vsCLUSIZZ,outputDir+"/"+"PIXY2vsCLUSIZEZ."+oFext,"PIX Barrel layer 2","Local y residual [mm]","Cluster size z",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-    PIXY3vsCLUSIZZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualy_clustersizeZ","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXY3vsCLUSIZZ,outputDir+"/"+"PIXY3vsCLUSIZEZ."+oFext,"PXI Barrel layer 3","Local y residual [mm]","Cluster size z",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-
-    
-
-    
-    
-    # SCT 
-    SCTX0vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTX0vsCLUSIZ,outputDir+"/"+"SCTX0vsCLUSIZE."+oFext,"SCT Barrel layer 0","Local x residual [mm]","Cluster size",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-    SCTX1vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTX1vsCLUSIZ,outputDir+"/"+"SCTX1vsCLUSIZE."+oFext,"SCT Barrel layer 1","Local x residual [mm]","Cluster size",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-    SCTX2vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTX2vsCLUSIZ,outputDir+"/"+"SCTX2vsCLUSIZE."+oFext,"SCT Barrel layer 2","Local x residual [mm]","Cluster size",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-    SCTX3vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTX3vsCLUSIZ,outputDir+"/"+"SCTX3vsCLUSIZE."+oFext,"SCT Barrel layer 3","Local x residual [mm]","Cluster size",0.15,0.89,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitErrorPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitErrorPlots.py
deleted file mode 100644
index 6662cffb758308ea2ddd2353ae7e4914500a902a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitErrorPlots.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# MakeHitErrorPlots.py
-#
-
-# Pixel barrel
-PIXBAR_HitError_x = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_x_pix_b","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXBAR_HitError_x, outputDir+"/"+"PIXBAR_HitError_x."+oFext, "Pixel barrel", "Pixel hits errors (local x)",
-          "Hit error (local x) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXBAR_HitError_x_WR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_x_pix_b_WideRange","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXBAR_HitError_x_WR, outputDir+"/"+"PIXBAR_HitError_x_WideRange."+oFext, "Pixel barrel", "Pixel hits errors (local x)",
-          "Hit error (local x) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXBAR_HitError_y = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_y_pix_b","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXBAR_HitError_y, outputDir+"/"+"PIXBAR_HitError_y."+oFext, "Pixel barrel", "Pixel hits errors (local y)",
-          "Hit error (local y) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXBAR_HitError_y_WR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_y_pix_b_WideRange","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXBAR_HitError_y_WR, outputDir+"/"+"PIXBAR_HitError_y_WideRange."+oFext, "Pixel barrel", "Pixel hits errors (local y)",
-          "Hit error (local y) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-# IBL
-IBL_HitError_x = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_x_ibl_b","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(IBL_HitError_x, outputDir+"/"+"IBL_HitError_x."+oFext, "IBL", "IBL hits errors (local x)",
-          "Hit error (local x) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-IBL_HitError_x_WR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_x_ibl_b_WideRange","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(IBL_HitError_x_WR, outputDir+"/"+"IBL_HitError_x_WideRange."+oFext, "IBL", "IBL hits errors (local x)",
-          "Hit error (local x) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-IBL_HitError_y = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_y_ibl_b","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(IBL_HitError_y, outputDir+"/"+"IBL_HitError_y."+oFext, "IBL", "IBL hits errors (local y)",
-          "Hit error (local y) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-IBL_HitError_y_WR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_y_ibl_b_WideRange","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(IBL_HitError_y_WR, outputDir+"/"+"IBL_HitError_y_WideRange."+oFext, "IBL", "IBL hits errors (local x)",
-          "Hit error (local y) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-# PIX end caps
-PIXEC_HitError_x = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_x_pix_ec","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXBAR_HitError_x, outputDir+"/"+"PIXEC_HitError_x."+oFext, "Pixel end caps", "Pixel hits errors (local x)",
-          "Hit error (local x) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-PIXEC_HitError_y = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_y_pix_ec","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXBAR_HitError_y, outputDir+"/"+"PIXEC_HitError_y."+oFext, "Pixel end caps", "Pixel hits errors (local y)",
-          "Hit error (local y) [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-# SCT
-SCTBAR_HitErrorWR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_sct_b_WideRange","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTBAR_HitErrorWR, outputDir+"/"+"SCTBAR_HitErrorWR."+oFext, "SCT barrel", "SCT Hits errors",
-          "Hit error [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTBAR_HitError = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_sct_b","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTBAR_HitError, outputDir+"/"+"SCTBAR_HitError."+oFext, "SCT barrel", "SCT Hits errors",
-          "Hit error [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
-
-SCTEC_HitError = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"m_hiterror_sct_ec_WideRange","noFit",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTEC_HitError, outputDir+"/"+"SCTEC_HitError."+oFext, "SCT end caps", "SCT Hits errors",
-          "Hit error [mm]", 0.65, 0.7, "#mum",canvasText,makeOutput,0.60,0.91)
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitMapsPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitMapsPlots.py
deleted file mode 100644
index 5490dfadea8aec6336566d62a603246e7ae69948..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitMapsPlots.py
+++ /dev/null
@@ -1,186 +0,0 @@
-#
-print " <MakeResidualPlots.MakeHitMapsPlots> userCollectOutput=",userCollectOutput
-print "                                      userWebMonitoring=",userWebMonitoring
-
-psname = "/Users/martis/projectes/atlas/alineament/webmonitoringtest/InDetAlignmentWebMonitor/trunk/WebPage/detailed_plots/2016/HitMaps.pdf"
-if (userWebMonitoring):
-    psname = "/var/vhost/atlas-alignment/secure/detailed_plots/2016/HitMaps.pdf"
-#
-
-def initPsFile():
-    NullCanvas = TCanvas()
-    NullCanvas.Print(psname+"[")
-    return NullCanvas
-	
-def closePsFile(NullCanvas):
-    NullCanvas.Print(psname+"]")
-
-Canvases = []
-if (userCollectOutput):    
-    NullCanvas = initPsFile()
-
-    
-for i in range(nFiles):    
-
-    PIXBAR_HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "BAR", True, 0, "measurements")
-    outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_HitMaps_File_"+str(i)+"."+oFext
-    outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(PIXBAR_HitMaps, outputFileName, "#eta ring", "#phi stave", "Hits", 
-                          0.2, 0.96, "#mum",canvasText,makeOutput)
-    if (userCollectOutput): Canvases.append(thiscan)
-    
-    PIXECA_HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "ECA")
-    outputFileName =  outputDir+"/"+userPrefix+"PIXECA_HitMaps_File_"+str(i)+"."+oFext
-    outputFileName =  outputDir+"/"+userPrefix+"PIXECA_HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(PIXECA_HitMaps, outputFileName, "", "", "Hits", 
-                          0.2, 0.96, "#mum",canvasText,makeOutput,"PIX","ECA")
-    if (userCollectOutput): Canvases.append(thiscan)
-
-    PIXECC_HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "ECC")
-    outputFileName =  outputDir+"/"+userPrefix+"PIXECC_HitMaps_File_"+str(i)+"."+oFext
-    outputFileName =  outputDir+"/"+userPrefix+"PIXECC_HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")     
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(PIXECC_HitMaps, outputFileName, "", "", "Hits", 
-                          0.2, 0.96, "#mum",canvasText,makeOutput,"PIX","ECC")
-    if (userCollectOutput): Canvases.append(thiscan)
-
-    # SCT barrel side 0 and side 1
-    SCTBAR_s0HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "SCT", "BAR", True, 0)
-    outputFileName =  outputDir+"/"+userPrefix+"SCTBAR_s0HitMaps_File_"+str(i)+"."+oFext
-    outputFileName =  outputDir+"/"+userPrefix+"SCTBAR_s0HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(SCTBAR_s0HitMaps, outputFileName, "#eta ring", "#phi sector", "Hits", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"SCT","BAR")
-    if (userCollectOutput): Canvases.append(thiscan)
-
-    SCTBAR_s1HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "sct", "BAR", True, 1)
-    outputFileName =  outputDir+"/"+userPrefix+"SCTBAR_s1HitMaps_File_"+str(i)+"."+oFext
-    outputFileName =  outputDir+"/"+userPrefix+"SCTBAR_s1HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(SCTBAR_s1HitMaps, outputFileName, "#eta ring", "#phi sector", "Hits", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"SCT","BAR")
-    if (userCollectOutput): Canvases.append(thiscan)
-    
-    # SCT ECA side 0 and sie 1
-    SCTECA_s0HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "sct", "ECA", True, 0)
-    outputFileName = outputDir+"/"+userPrefix+"SCTECA_s0HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(SCTECA_s0HitMaps, outputFileName, "", "", "Hits", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"SCT","ECA")
-    if (userCollectOutput): Canvases.append(thiscan)
-    
-    SCTECA_s1HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "sct", "ECA", True, 1)
-    outputFileName = outputDir+"/"+userPrefix+"SCTECA_s1HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(SCTECA_s1HitMaps, outputFileName, "", "", "Hits", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"SCT","ECA")
-    if (userCollectOutput): Canvases.append(thiscan)
-    
-    # SCT ECC side 0 and sie 1
-    outputFileName = outputDir+"/"+userPrefix+"SCTECC_s0HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    SCTECC_s0HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "sct", "ECC", True, 0)
-    thiscan = DrawHitMaps(SCTECC_s0HitMaps, outputFileName, "", "", "Hits", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"SCT","ECA")
-    if (userCollectOutput): Canvases.append(thiscan)
-        
-    outputFileName = outputDir+"/"+userPrefix+"SCTECC_s1HitMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    SCTECC_s1HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "sct", "ECC", True, 1)
-    thiscan = DrawHitMaps(SCTECC_s1HitMaps, outputFileName, "", "", "Hits", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"SCT","ECA")
-    if (userCollectOutput): Canvases.append(thiscan)
-
-    #
-    # HIT EFFICIENCY PER MODULE AND PLANE
-    #
-    # pixel barrel hit efficiency map
-    PIXBAR_HitEffMaps = MakeHitEffMaps(hitEffDir, legendTitles, rootFiles, i, "PIX", "BAR", True, 0)
-    outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_HitEffMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(PIXBAR_HitEffMaps, outputFileName, "#eta ring", "#phi sector", "Hit eff.", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"PIX","BAR", 3)
-    if (userCollectOutput): Canvases.append(thiscan)
-    
-    # SCT barrel side 0 and side 1
-    SCTBAR_s0HitEffMaps = MakeHitEffMaps(hitEffDir, legendTitles, rootFiles, i, "SCT", "BAR", True, 0)
-    outputFileName =  outputDir+"/"+userPrefix+"SCTBAR_s0HitEffMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(SCTBAR_s0HitEffMaps, outputFileName, "#eta ring", "#phi sector", "Hit eff.", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"SCT","BAR", 3)
-    if (userCollectOutput): Canvases.append(thiscan)
-
-    SCTBAR_s1HitEffMaps = MakeHitEffMaps(hitEffDir, legendTitles, rootFiles, i, "sct", "BAR", True, 1)
-    outputFileName =  outputDir+"/"+userPrefix+"SCTBAR_s1HitEffMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    thiscan = DrawHitMaps(SCTBAR_s1HitEffMaps, outputFileName, "#eta ring", "#phi sector", "Hit eff.", 
-                          0.2, 0.96, "#mum",canvasText, makeOutput,"SCT","BAR", 3)
-    if (userCollectOutput): Canvases.append(thiscan)
-
-    #
-    # Extended
-    #    
-    if (userExtended):
-        print " <MakeHitMapsPlots> Extended = True "
-        PIXBAR_ExpectedHitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "BAR", True, 0, "hits")
-        outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_ExpectedHitMaps_File_"+str(i)+"."+oFext
-        outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_ExpectedHitMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(PIXBAR_ExpectedHitMaps, outputFileName, "#eta ring", "#phi stave", "Expected hits", 
-                    0.2, 0.96, "#mum",canvasText,makeOutput)
-        
-        PIXBAR_HoleMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "BAR", True, 0, "holes")
-        outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_HoleMaps_File_"+str(i)+"."+oFext
-        outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_HoleMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(PIXBAR_HoleMaps, outputFileName, "#eta ring", "#phi stave", "Holes", 
-                    0.2, 0.96, "#mum",canvasText,makeOutput)
-        
-        PIXBAR_OutliersMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "BAR", True, 0, "outliers")
-        outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_OutlierMaps_File_"+str(i)+"."+oFext
-        outputFileName =  outputDir+"/"+userPrefix+"PIXBAR_OutlierMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(PIXBAR_OutliersMaps, outputFileName, "#eta ring", "#phi stave", "Outliers", 
-                    0.2, 0.96, "#mum",canvasText,makeOutput)
-
-if (userCollectOutput):
-    print " <MakeResidualPlots> PsFile = ",psname
-    for canvas in Canvases:
-        print "  <MakeResidualPlots> storing canvas: ", canvas 
-        PsFile = canvas.Print(psname)
-    closePsFile(NullCanvas)
-        
-# reset the plots style
-execfile("AtlasStyle.py")
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitPlots.py
deleted file mode 100644
index feada312f4a4b25c0b90f17531798e40e857f64e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeHitPlots.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#
-# MakeHitPlots.py
-#
-
-print " <MakeResidualPlots.MakeResidualPlots> userCollectOutput=",userCollectOutput
-print "                                       userWebMonitoring=",userWebMonitoring
-#
-psname = "/Users/martis/projectes/atlas/alineament/webmonitoringtest/InDetAlignmentWebMonitor/trunk/WebPage/detailed_plots/2016/PlotsOfHits.pdf"
-if (userWebMonitoring):
-    psname = "/var/vhost/atlas-alignment/secure/detailed_plots/2016/PlotsOfHits.pdf"
-
-def initPsFile():
-    NullCanvas = TCanvas()
-    NullCanvas.Print(psname+"[")
-    return NullCanvas
-	
-def closePsFile(NullCanvas):
-    NullCanvas.Print(psname+"]")
-
-Canvases = []
-if (userCollectOutput):    
-    NullCanvas = initPsFile()
-
-##########################
-TrackNPIXHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-thiscan = DrawPlots(TrackNPIXHits, outputDir+"/"+userPrefix+"nPIXHits."+oFext, "", "N Tracks",
-                    "N PIX Hits", 0.69, 0.6, "",
-                    canvasText,makeOutput)
-if (userCollectOutput): Canvases.append(thiscan)
-
-TrackNSCTHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-thiscan = DrawPlots(TrackNSCTHits, outputDir+"/"+userPrefix+"nSCTHits."+oFext, "", "N Tracks",
-                    "N SCT Hits", 0.69, 0.6, "",
-                    canvasText,makeOutput)
-if (userCollectOutput): Canvases.append(thiscan)
-
-TrackNTRTHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Ntrthits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-thiscan = DrawPlots(TrackNTRTHits, outputDir+"/"+userPrefix+"nTRTHits."+oFext, "TRT hits on track", "N Tracks",
-                    "N TRT Hits", 0.18, 0.68, "",
-                    canvasText,makeOutput, 0.15,0.88)
-if (userCollectOutput): Canvases.append(thiscan)
-
-TrackNSCTHitsBarrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_barrel","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsBarrel, outputDir+"/"+userPrefix+"nSCTHitsBarrel."+oFext, "", "N Tracks",
-          "N SCT Hits Barrel", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsEca = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_eca","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsEca, outputDir+"/"+userPrefix+"nSCTHitsEca."+oFext, "", "N Tracks",
-          "N SCT Hits Eca", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsEcc = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_ecc","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsEcc, outputDir+"/"+userPrefix+"nSCTHitsEcc."+oFext, "", "N Tracks",
-          "N SCT Hits Ecc", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHitsBarrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_barrel","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsBarrel, outputDir+"/"+userPrefix+"nPIXHitsBarrel."+oFext, "", "N Tracks",
-          "N PIX Hits Barrel", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHitsEca = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_eca","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsEca, outputDir+"/"+userPrefix+"nPIXHitsEca."+oFext, "", "N Tracks",
-          "N PIX Hits ECA", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-
-TrackNPIXHitsEcc = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_ecc","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsEcc, outputDir+"/"+userPrefix+"nPIXHitsEcc."+oFext, "", "N Tracks",
-          "N PIX Hits ECC", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-# Hit Efficiencies
-SiBarrelHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"measurements_eff_vs_layer_barrel","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelHitEff, outputDir+"/"+userPrefix+"SiBarrelHitEff."+oFext, "Si Barrel Hit Eff.", "Hit Efficiency",
-          "Barrel Layer", 0.53, 0.37, "",
-          canvasText,makeOutput,0.50,0.80,False)
-
-SiBarrelSeenHits = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"measurements_vs_layer_barrel","noFit",rootFiles,nFiles,False) 
-DrawPlots(SiBarrelSeenHits, outputDir+"/"+userPrefix+"SiBarrelSeenHits."+oFext, "Si Barrel measurements", "Seen hits",
-          "Barrel Layer", 0.20, 0.87, "",
-          canvasText,makeOutput,0.55,0.41,True)
-
-SiBarrelExpectedHits = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_vs_layer_barrel","noFit",rootFiles,nFiles,False) 
-DrawPlots(SiBarrelExpectedHits, outputDir+"/"+userPrefix+"SiBarrelExpectedHits."+oFext, "Si Barrel expected hits", "Expected hits",
-          "Barrel Layer", 0.20, 0.87, "",
-          canvasText,makeOutput,0.55,0.41,True)
-
-SiEcaHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"measurements_eff_vs_layer_eca","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaHitEff, outputDir+"/"+userPrefix+"SiEcaHitEff."+oFext, "Si Endcap A Hit Eff.", "Hit Efficiency",
-          "ECA Disk", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False)
-
-SiEccHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"measurements_eff_vs_layer_ecc","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccHitEff, outputDir+"/"+userPrefix+"SiEccHitEff."+oFext, "Si Endcap C Hit Eff.", "Hit Efficiency",
-          "ECC Disk", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False)
-
-TRTB0HitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_phiSector_trt_b0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB0HitEff, outputDir+"/"+userPrefix+"TRTB0HitEff."+oFext, "TRT Barrel Layer 0 Hit Eff.", "Hit Efficiency",
-          "Barrel Layer 0 Phi Sector", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False)
-
-TRTB1HitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_phiSector_trt_b1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB1HitEff, outputDir+"/"+userPrefix+"TRTB1HitEff."+oFext, "TRT Barrel Layer 1 Hit Eff.", "Hit Efficiency",
-          "Barrel Layer 1 Phi Sector", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False)
-
-TRTB2HitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_phiSector_trt_b2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB2HitEff, outputDir+"/"+userPrefix+"TRTB2HitEff."+oFext, "TRT Barrel Layer 2 Hit Eff.", "Hit Efficiency",
-          "Barrel Layer 2 Phi Sector", 0.19, 0.41, "",
-          canvasText,makeOutput,0.60,0.41,False)
-
-#TRTECAHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_wheel_trt_ea","noFit",rootFiles,nFiles,False)
-#DrawPlots(TRTECAHitEff, outputDir+"/"+userPrefix+"TRTECAHitEff."+oFext, "TRT Endcap A Hit Eff.", "Hit Efficiency",
-#          "Endcap A Wheel", 0.19, 0.41, "",
-#          canvasText,makeOutput,0.60,0.41,False)
-
-#TRTECCHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_wheel_trt_ec","noFit",rootFiles,nFiles,False)
-#DrawPlots(TRTECCHitEff, outputDir+"/"+userPrefix+"TRTECCHitEff."+oFext, "TRT Endcap C Hit Eff.", "Hit Efficiency",
-#          "Endcap C Wheel", 0.19, 0.41, "",
-#          canvasText,makeOutput,0.60,0.41,False)
-
-
-
-if (userExtended):
-    PIXHits = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"PIXHitsvEta","noFit",rootFiles,nFiles, False)
-    DrawPlots(PIXHits,outputDir+"/"+userPrefix+"NPIXvsETA.png","","Average PIX hits", "#eta",0.2,0.9,"", canvasText,makeOutput, 0.60, 0.91, False);
-    SCTHits = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"SCTHitsvEta","noFit",rootFiles,nFiles, False)
-    DrawPlots(SCTHits,outputDir+"/"+userPrefix+"NSCTvsETA.png","","Average SCT hits", "#eta",0.2,0.9,"", canvasText,makeOutput, 0.60, 0.91, False);
-    TRTHits = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"TRTHitsvEta","noFit",rootFiles,nFiles, False)
-    DrawPlots(TRTHits,outputDir+"/"+userPrefix+"NTRTvsETA.png","","Average TRT hits", "#eta",0.2,0.9,"", canvasText,makeOutput, 0.60, 0.91, False);
-
-
-# SivsTRT
-if siTRTDir[0] != "":
-    TRTExtEffEta = MakePlots(siTRTDir,legendTitles,markerColors,markerStyles,"eff_trthits_eta0","noFit",rootFiles,nFiles,False)
-    DrawPlots(TRTExtEffEta, outputDir+"/"+userPrefix+"TRTExtEffVsEta."+oFext, "TRT Extension Eff.", "TRT Extension Eff.",
-              "Track Eta", 0.19, 0.41, "",
-              canvasText,makeOutput,0.60,0.41,False)
-
-    TRTExtEffPhi = MakePlots(siTRTDir,legendTitles,markerColors,markerStyles,"eff_trthits_phi0","noFit",rootFiles,nFiles,False)
-    DrawPlots(TRTExtEffPhi, outputDir+"/"+userPrefix+"TRTExtEffVsPhi."+oFext, "TRT Extension Eff.", "TRT Extension Eff.",
-              "Track Phi", 0.19, 0.41, "",
-              canvasText,makeOutput,0.60,0.41,False)
-
-#    
-NTracks = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"NPixPerLumiBlock","noFit",rootFiles,nFiles,False)
-thiscan = DrawPlots(NTracks, outputDir+"/"+userPrefix+"NPixPerLumiBlock.png", "Pixel hits vs LumiBlock", "#PIXEL hits", "LumiBlock", 0.19, 0.9, "#mum", canvasText,makeOutput)
-if (userCollectOutput): Canvases.append(thiscan)
-
-NTracks = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"NSCTPerLumiBlock","noFit",rootFiles,nFiles,False)
-thiscan = DrawPlots(NTracks, outputDir+"/"+userPrefix+"NSCTPerLumiBlock.png", "SCT hits vs LumiBlock", "#SCT hits", "LumiBlock", 0.19, 0.9, "#mum", canvasText,makeOutput)
-if (userCollectOutput): Canvases.append(thiscan)
-    
-NTracks = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"NTRTPerLumiBlock","noFit",rootFiles,nFiles,False)
-thiscan = DrawPlots(NTracks, outputDir+"/"+userPrefix+"NTRTPerLumiBlock.png", "TRT hits vs LumiBlock", "#TRT hits", "LumiBlock", 0.19, 0.9, "#mum", canvasText,makeOutput)
-if (userCollectOutput): Canvases.append(thiscan)
-
-if (userCollectOutput):
-    print " <MakeHitPlots> PsFile = ",psname
-    for canvas in Canvases:
-        print "  <MakeHitPlots> storing canvas: ", canvas 
-        PsFile = canvas.Print(psname)
-    closePsFile(NullCanvas)
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots.py
deleted file mode 100755
index 6eda5e9b1fc9471a20c248dbcb35457afb16952c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots.py
+++ /dev/null
@@ -1,249 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# small adds Priscilla Pani ppani@nikhef.nl
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-# need to provide a configuration file - see makeMonitoringPlotsExampleConfigFile.py
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c \<configurationFile\>
-#
-##--------------------------
-userCosmetics = ""
-
-import sys, os
-from ROOT import *
-from utilities import *
-#import utilities 
-import AtlasStyle
-gStyle.SetOptStat(0)
-nMAXFiles = 3
-
-#gROOT.SetBatch()
-
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-	from optparse import OptionParser
-	parser = OptionParser()
-	parser.add_option("--ALL", dest="inputALL", help="Do plot all categories apart from Track Segments", action="store_true", default = False)
-	parser.add_option("--BeamSpot", dest="inputBeamSpot", help="Plot beam spot related histograms", action="store_true",default=False)
-	parser.add_option("--canvasText", dest="canvasText", help="Global labels for all the plots (max 4 labels)", default="")
-	parser.add_option("--Clusters", dest="inputClusters", help="Plot of cluster size and residuals vs cluster size", action="store_true",default=False)
-	parser.add_option("--collectOutput", dest="collectOutput", help= "if output is stored as pdf, then they are collected in one single file", action="store_true", default = False)
-	parser.add_option("--Cosmetics", dest="inputCosmetics", help="choose among listed plot cosmetics (Default, ApprovedPlots...", default="")
-	parser.add_option("--eps", dest="inputEPS", help="output files saved as EPSs", action="store_true", default = False)
-	parser.add_option("--Extended", dest="inputExtended", help="Draw more plots", action="store_true", default = False)
-	parser.add_option("--HitErrors", dest="inputHitErrors", help="Do hit error plots for all systems", action="store_true",default=False)
-	parser.add_option("--HitMaps", dest="inputHitMaps", help="Do hit maps plots for all systems layer by layer", action="store_true",default=False)
-	parser.add_option("--Hits", dest="inputHits", help="Do hit plots for all systems and layer by layer", action="store_true",default=False)
-	parser.add_option("--IBLresiduals", dest="inputIBL", help="print detailed residual distributions in IBL", action="store_true", default = False)
-	parser.add_option("--inputColors",dest="inputColors",help="colors to be used with the input files", default = "")
-	parser.add_option("--inputFiles",dest="inputFiles",help="list of files", default = "")
-	parser.add_option("--inputLabels",dest="inputLabels",help="labels to be used with the input files", default = "")
-	parser.add_option("--inputMarkers",dest="inputMarkers",help="markers to be used with the input files", default = "")
-	parser.add_option("--inputTrackCollection", dest="inputTrackCollection",help = "Track collection to be drawn from an input file", default ="")
-	parser.add_option("--inputFolder", dest="inputFolder",help = "Main folder of the input files where monitoring histograms are kept", default ="")
-	parser.add_option("--Modules", dest="inputResByModule", help="Print the residuals module by module", action="store_true", default=False)
-	parser.add_option("--outputFolder", dest="outputFolder", help= "Name of the folder where output files are kept", default ="../plots")
-	parser.add_option("--pdf", dest="inputPDF", help="output files saved as PDFs", action="store_true", default = False)
-	parser.add_option("--Prefix", dest="inputPrefix", help="prexif added to all output file names", default = "")
-	parser.add_option("--Pulls", dest="inputPulls", help="Do pulls plots for all systems and then layer by layer", action="store_true",default=False)
-	parser.add_option("--ResidualMaps", dest="inputResidualMaps", help="Do residuals plots for all systems layer by layer", action="store_true",default=False)
-	parser.add_option("--Residuals", dest="inputResiduals", help="Do residuals plots for all systems and then layer by layer", action="store_true",default=False)
-	parser.add_option("--Overlaps", dest="inputOverlaps", help="Do Overlap residuals plots for all systems and then layer by layer", action="store_true",default=False)
-	parser.add_option("--Script", dest="inputScript", help="The user may provie its own script", default="")
-	parser.add_option("--SetBatch", dest="inputSetBatch", help="When SetBatch is used histogram displays are not open", action="store_true", default=True)
-	parser.add_option("--ShowPlots", dest="inputSetBatch", help="When ShowPlots is used the histogram display is open", action="store_false", default=True)
-	parser.add_option("--TrackParams", dest="inputTrackParams", help="Do track parameter plots", action="store_true",default=False)
-	parser.add_option("--TrackSegments", dest="inputTrackSegments", help="Do track segment matching plots", action="store_true",default=False)
-	parser.add_option("--WebMonitoring", dest="WebMonitoring", help="to be set in case of producing output for the web monitoring", action="store_true",default=False)
-    
-	(config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-	return config
-
-
-##########################################################
-#            dealing with the options                    #
-##########################################################
-config = optParsing()
-userHitErrors = config.inputHitErrors
-userHits = config.inputHits
-userHitMaps = config.inputHitMaps
-userIBL = config.inputIBL
-userPulls = config.inputPulls
-userResidualMaps = config.inputResidualMaps
-userResiduals = config.inputResiduals
-userOverlaps = config.inputOverlaps
-userTrackParams = config.inputTrackParams
-userTrackSegments = config.inputTrackSegments
-userExtended = config.inputExtended
-userPDF = config.inputPDF
-userEPS = config.inputEPS
-userScript = config.inputScript
-userSetBatch = config.inputSetBatch 
-userResByModule = config.inputResByModule
-userBeamSpot = config.inputBeamSpot
-userClusters = config.inputClusters
-userCosmetics = config.inputCosmetics
-userInputFiles = config.inputFiles.split()
-userInputLabels = config.inputLabels.split()
-userInputMarkers = config.inputMarkers.split()
-userColors = config.inputColors.split()
-userInputTrackCollection = config.inputTrackCollection.split()
-userInputFolder = config.inputFolder.split()
-userOuputFolder = config.outputFolder
-userCollectOutput = config.collectOutput and userPDF
-userWebMonitoring = config.WebMonitoring
-userCanvasText = config.canvasText.split()
-userPrefix = config.inputPrefix    
-
-if (config.inputALL):
-    userHitErrors = False
-    userHitMaps = True
-    userHits = True
-    userIBL = False
-    userPulls = True
-    userResidualMaps = False
-    userResiduals = True
-    userOverlaps  = True
-    userTrackParams = True
-    userExtended = True
-    userResByModule = False # as this plots to many histograms, this can be only activated on purpose
-    userBeamSpot = False
-    userClusters = False
-
-
-
-#some initialization
-configFileName = ""
-makeOutput = True
-if (userSetBatch): 
-    gROOT.SetBatch()
-#
-outputFileExtension = "png"
-if (userPDF): outputFileExtension="pdf"
-
-#
-doResiduals = False or userResiduals 
-doOverlaps  = False or userOverlaps
-doResidualProfiles = False 
-doPulls = False or userPulls
-doTrackParams = False or userTrackParams
-doCosmicTrackSegments = False or userTrackSegments
-doHitMaps = False or userHitMaps
-doResidualMaps = False or userResidualMaps
-doHits = False or userHits
-doHitErrors = False or userHitErrors
-doIBL = False or userIBL
-doBeamSpot = False or userBeamSpot
-doResByModule = False or userResByModule
-doClusters = False or userClusters
-
-print "\n ****************************"
-print " ** MakeMajorAlignMonPlots **"
-print " **************************** \n"
-
-
-#reading in the root file names from input arguments
-for i in range(len(sys.argv)):
-    if sys.argv[i]=="-c":
-        configFileName = sys.argv[i+1]
-
-#if not configfile is given take the default configuration file:
-if (configFileName == ""):
-    configFileName = "userConfig.py"
-    print " -- MakeMajorAlignMonPlots -- using the default configuration file: ", configFileName
-
-# reading in configuration file
-execfile(configFileName) 
-
-print "Reading in from .root files:"
-print " -- MakeMajorAlignMonPlots -- List of input monitoring files: "
-for thisfile in rootFileNames:
-    print thisfile
-    
-
-if makeOutput:
-    if not os.path.isdir(outputDir):
-       print " -- MakeMajorAlignMonPlots -- Producing output in new directory:", outputDir
-       os.mkdir(outputDir)
-    else:
-        print " -- MakeMajorAlignMonPlots -- Producing output in existing directory:", outputDir
-
-
-#getting the TFile objects using the rootFileNames
-rootFiles = []
-nFiles = 0
-for thisfile in rootFileNames:
-    if (rootFileNames[nFiles] != ""):
-        rootFiles.append(TFile(rootFileNames[nFiles]))
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print " -- MakeMajorAlignMonPlots -- Using in total ",nFiles, " input files "
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-# Basic Barrel Residual distributions
-if (doResiduals): execfile("MakeResidualPlots.py")
-if (doOverlaps): execfile("MakeResidualOverlapPlots.py")
-if (doResidualProfiles): execfile("MakeResidualProfilesPlots.py") 
-if (doIBL): execfile("MakeResidualsIBL.py")
-if (doPulls): execfile("MakePullPlots.py") 
-    
-# track parameters
-if (doTrackParams): execfile("MakeTrackParamsPlots.py")
-    
-# hit maps
-if (doHitMaps): execfile("MakeHitMapsPlots.py")
-
-# residual maps
-if (doResidualMaps): execfile("MakeResidualMapsPlots.py")
-
-# hits per detector and hit efficiencies
-if (doHits): execfile("MakeHitPlots.py")   
-
-#short cut for track-segments plots with cosmic Rays
-if (doCosmicTrackSegments): execfile("MakeTrackSegmentsPlots.py")
-
-# hit errors
-if (doHitErrors): execfile("MakeHitErrorPlots.py") 
-
-# beam spot, lumiblocks etc
-if (doBeamSpot): execfile("MakeBeamSpotPlots.py") 
-
-# beam spot, lumiblocks etc
-if (doClusters): execfile("MakeClusterSizePlots.py") 
-
-# Residuals module by module
-if (doResByModule): execfile("MakeResidualsPerModule.py") 
-
-#user script
-if (len(userScript)>0):
-    if (os.path.isfile(userScript)):
-        execfile(userScript)
-    else:
-        print " -- MakeMajorAlignMonPlots -- user script ", userScript, " does not exist "
-    
-    
-# extract statistics:
-execfile("MakeStatisticsTable.py")
-
-print " -- MakeMajorAlignMonPlots -- Game over. Insert coin. -- "
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_MSStudies.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_MSStudies.py
deleted file mode 100755
index 2730c50621227ec158b556cae1b2c334ee50254b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_MSStudies.py
+++ /dev/null
@@ -1,629 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# small adds Pierfrancesco Butti pbutti@nikhef.nl
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-# need to provide a configuration file - see makeMonitoringPlotsExampleConfigFile.py
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c <configurationFile>
-#
-##--------------------------
-
-import sys
-from ROOT import *
-from utilities_MS import *
-import AtlasStyle
-gStyle.SetOptStat(0)
-
-oFext=""
-nMAXFiles = 7
-#some initialization
-configFileName = ""
-makeOutput = True
-
-#reading in the root file names from input arguments
-for i in range(len(sys.argv)):
-    if sys.argv[i]=="-c":
-        configFileName = sys.argv[i+1]
-
-# reading in configuration file
-fd = open(configFileName)
-config = fd.readlines()
-exec(''.join(config))
-
-print "Reading in from .root files:"
-for i in range(nMAXFiles) :
-    print rootFileNames[i]
-
-
-if makeOutput:
-    print "Producing output in directory:", outputDir
-
-#getting the TFile objects using the rootFileNames
-rootFiles = [TFile,TFile,TFile,TFile,TFile,TFile,TFile,TFile,TFile] 
-nFiles = 0
-for i in range(nMAXFiles):
-    if rootFileNames[i]!="": 
-        rootFiles[i] = TFile(rootFileNames[i])
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print "nFiles = ",nFiles
-
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-
-## # Basic Barrel Residual distributions
-
-print "PIXX"
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXX, outputDir+"/"+"PIXX.png"+oFext, "Pixel barrel", "Hits on tracks / 2#mum",
-           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-print "PIXY"
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXY, outputDir+"/"+"PIXY.png"+oFext, "Pixel barrel", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-# Basic Pull distributions
-print "PIXPULLX"
-PIXPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX, outputDir+"/"+"PIXPULLX.png", "Pixel Barrel", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-print "PIXPULLY"
-PIXPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY, outputDir+"/"+"PIXPULLY.png", "Pixel Barrel", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-print "PIXPULLX0"
-PIXPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX0, outputDir+"/"+"PIXPULLX0.png", "Pixel Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-print "pix_b1_pullx"
-PIXPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX1, outputDir+"/"+"PIXPULLX1.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-print "PIXPULLX2"
-PIXPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX2, outputDir+"/"+"PIXPULLX2.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY0, outputDir+"/"+"PIXPULLY0.png", "Pixel Barrel L0", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY1, outputDir+"/"+"PIXPULLY1.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY2, outputDir+"/"+"PIXPULLY2.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-PIXPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECA, outputDir+"/"+"PIXPULLXECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECAY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECAY, outputDir+"/"+"PIXPULLYECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECC, outputDir+"/"+"PIXPULLXECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECCY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECCY, outputDir+"/"+"PIXPULLYECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-SCTX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTX, outputDir+"/"+"SCTX.png"+oFext, "SCT barrel", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-SCTPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX, outputDir+"/"+"SCTPULLX.png", "SCT Barrel", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX0, outputDir+"/"+"SCTPULLX0.png", "SCT Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX1, outputDir+"/"+"SCTPULLX1.png", "SCT Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX2, outputDir+"/"+"SCTPULLX2.png", "SCT Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX3, outputDir+"/"+"SCTPULLX3.png", "SCT Barrel L3", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECA, outputDir+"/"+"SCTPULLXECA.png", "SCT Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECC, outputDir+"/"+"SCTPULLXECC.png", "SCT Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTR, outputDir+"/"+"TRTR.png"+oFext, "TRT barrel", "Hits on tracks / 22#mum",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-
-## ## Individual Barrel Layer Residual Distributions
-
-PIXX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX0, outputDir+"/"+"PIXX0.png"+oFext, "Pixel Barrel L0", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX1, outputDir+"/"+"PIXX1.png"+oFext, "Pixel Barrel L1", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX2, outputDir+"/"+"PIXX2.png"+oFext, "Pixel Barrel L2", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX0, outputDir+"/"+"SCTX0.png"+oFext, "SCT Barrel L0", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX1, outputDir+"/"+"SCTX1.png"+oFext, "SCT Barrel L1", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX2, outputDir+"/"+"SCTX2.png"+oFext, "SCT Barrel L2", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX3, outputDir+"/"+"SCTX3.png"+oFext, "SCT Barrel L3", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## ## Basic Endcap Residual distributions
-
-## # draws combined ECA and ECC residual distribution
-PIXECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECX, outputDir+"/"+"PIXECX.png"+oFext, "Pixel end-caps", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## # Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXECY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXECY, outputDir+"/"+"PIXECY.png"+oFext, "Pixel end-caps", "Hits on tracks / 20#mum",
-          "Local y residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-# draws combined ECA and ECC residual distribution
-SCTECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTECX, outputDir+"/"+"SCTECX.png"+oFext, "SCT Endcap", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-
-TRTEC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTEC, outputDir+"/"+"TRTEC.png"+oFext, "TRT end-caps", "Hits on tracks",
-          "residual [mm]", 0.2, 0.85, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-SiBarrelResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXMean, outputDir+"/"+"SiBarrelResXMean.png"+oFext, "Pixel/SCT Barrel", "residual mean [mm]",
-         "", 0.19, 0.9, "#mum",
-         canvasText,makeOutput,0.60,0.91,False)
-
-
-SiBarrelResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXWidth, outputDir+"/"+"SiBarrelResXWidth.png"+oFext, "Pixel/SCT Barrel", "residual width [mm]",
-         "", 0.19, 0.9, "#mum",
-         canvasText,makeOutput,0.60,0.91,False)
-
-
-
-    #R#esidual mean and width distributions as a function of endcap disk
-SiEcaResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXMean, outputDir+"/"+"SiEcaResXMean.png"+oFext, "Pixel/SCT Endcap A", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEcaResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXWidth, outputDir+"/"+"SiEcaResXWidth.png"+oFext, "Pixel/SCT Endcap A", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEccResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXMean, outputDir+"/"+"SiEccResXMean.png"+oFext, "Pixel/SCT Endcap C", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEccResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXWidth, outputDir+"/"+"SiEccResXWidth.png"+oFext, "Pixel/SCT Endcap C", "residual width [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-
-# TRT residual mean and width distributions
-
-TRTBL0PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHI, outputDir+"/"+"TRTBLayer0vsPhi.png", "TRT Barrel Layer 0", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL0PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHIRMS, outputDir+"/"+"TRTBLayer0vsPhiRMS.png", "TRT Barrel Layer 0", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL1PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHI, outputDir+"/"+"TRTBLayer1vsPhi.png", "TRT Barrel Layer 1", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL1PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHIRMS, outputDir+"/"+"TRTBLayer1vsPhiRMS.png", "TRT Barrel Layer 1", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL2PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHI, outputDir+"/"+"TRTBLayer2vsPhi.png", "TRT Barrel Layer 2", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL2PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHIRMS, outputDir+"/"+"TRTBLayer2vsPhiRMS.png", "TRT Barrel Layer 2", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TrackZ0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0, outputDir+"/"+"z0.png"+oFext, "", "N Tracks",
-          "z0 [mm]", 0.22, 0.9, "#mum",
-          canvasText,makeOutput,0.66,0.86)
-
-TrackETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"eta","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackETA, outputDir+"/"+"eta.png"+oFext, "", "N Tracks / 0.05",
-"Track #eta", 0.19, 0.9, "",
-          canvasText,makeOutput,0.66,0.86)
-
-TrackPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT.png", "", "N Tracks",
-          "Track pT [GeV]", 0.19, 0.5, "",
-          canvasText,makeOutput,0.66,0.86,False)
-
-    #TRT MEAN/AVG as a function of the rings
-
-    #CORRECT THE Y AXIS!! SCALE BY FACTOR 1000 ################
-
-
-TRTEcaMeanR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsRing_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEcaMeanR, outputDir+"/"+"TRTEcaMeanR.png"+oFext, "TRT Endcap A", "residual Mean [#mum]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEcaRmsR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsRing_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEcaRmsR, outputDir+"/"+"TRTEcaRmsR.png"+oFext, "TRT Endcap A", "residual Rms [mm]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEccMeanR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsRing_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEccMeanR, outputDir+"/"+"TRTEccMeanR.png"+oFext, "TRT Endcap C", "residual Mean [#mum]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEccRmsR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsRing_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEccRmsR, outputDir+"/"+"TRTEccRmsR.png"+oFext, "TRT Endcap C", "residual Rms [mm]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-
-#TRT PLOTS AS A FUNCTION OF THE RINGS
-
-for i in range(0,40):
-    TRTA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_ring_"+str(i)+"_Endcap_A","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(TRTA, outputDir+"/"+"TRT_ECA_R"+str(i)+".png"+oFext, "TRT Endcap A Ring " +str(i), "Number of hits on tracks / 60#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    del TRTA
-
-    TRTC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_ring_"+str(i)+"_Endcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(TRTC, outputDir+"/"+"TRT_ECC_R"+str(i)+".png"+oFext, "TRT Endcap C Ring " +str(i), "Number of hits on tracks / 60#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    
-    
-
-
-Zmumu = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Zmumu","noFit",rootFiles,nFiles,True)
-DrawPlots(Zmumu,outputDir+"/"+"Zmumu.png","Full ID", "Events","Dimuon Invariant Mass GeV/c2",0.19,0.9,"#mum",canvasText,makeOutput,0.66,0.86)
-
-for i in range(0,3):
-  for j in range(1,14):
-    PIXETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b"+str(i)+"_xresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-    DrawPlots(PIXETA,outputDir+"/"+"PIXXETAB"+str(i)+"_"+str(j)+".png","Pix B L"+str(i)+" #eta mod"+str(j),"Hits on track / 2#mum","Local x residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-    del PIXETA
-
-for i in range(0,3):
-  for j in range(1,14):
-    PIXETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b"+str(i)+"_yresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-    DrawPlots(PIXETA,outputDir+"/"+"PIXYETAB"+str(i)+"_"+str(j)+".png","Pix B L"+str(i)+" #eta mod"+str(j),"Hits on track / 10#mum","Local y residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-    del PIXETA
-    
-
-for i in range(0,4):
-  for j in range(1,14):
-    SCTETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b"+str(i)+"_xresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-    DrawPlots(SCTETA,outputDir+"/"+"SCTETAB"+str(i)+"_"+str(j)+".png","SCT B L0 #eta mod"+str(j),"Hits on track / 2#mum","Local x residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-    del SCTETA
-
-## for i in range(0,3):
-##  MEANPIX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_barrel_pix_b"+str(i)+"_xresvsmodetaphi_3d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##  DrawPlots(MEANPIX,outputDir+"/"+"MEANPIXB"+str(i)+".png","Pixel Barrel L"+str(i),"Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-  
-## for i in range(0,4):
-##  MEANSCT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_barrel_sct_b"+str(i)+"_xresvsmodetaphi_3d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##  DrawPlots(MEANSCT,outputDir+"/"+"MEANSCTB"+str(i)+".png","SCT Barrel L"+str(i),"Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-  
-
-## ECAPIXMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcappix_eca_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(ECAPIXMEAN,outputDir+"/"+"ECAPIXMEAN.png","Pixel Endcap A","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-## ECCPIXMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcappix_ecc_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(ECCPIXMEAN,outputDir+"/"+"ECCPIXMEAN.png","Pixel Endcap C","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-## ECASCTMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcapsct_eca_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(ECASCTMEAN,outputDir+"/"+"ECASCTMEAN.png","SCT Endcap A","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-## ECCSCTMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcapsct_ecc_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-
-## DrawPlots(ECCSCTMEAN,outputDir+"/"+"ECCSCTMEAN.png","SCT Endcap C","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-## MEANPIXBAR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_pix_barrel","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANPIXBAR,outputDir+"/"+"MEANPIXBAR.png","Pixel Barrel","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANPIXEndCap = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_pix_endcap","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANPIXEndCap,outputDir+"/"+"MEANPIXEndCap.png","Pixel EndCaps","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANSCTBAR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_sct_barrel","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANSCTBAR,outputDir+"/"+"MEANSCTBAR.png","SCT Barrel","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANSCTEndCap = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_sct_endcap","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANSCTEndCap,outputDir+"/"+"MEANSCTEndCap.png","SCT EndCaps","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-
-
-
-## #SCT REQUESTED PLOTS RESIDUALS
-
-PIXXL0BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.png"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.eps"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.C"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXXL1BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L1","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.png"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.eps"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.C"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-PIXXL2BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L2","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.png"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.eps"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.C"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-#L0
-
-SCTL0S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L0_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.png"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.eps"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.C"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-SCTL0S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L0_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.png"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.eps"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.C"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-#L1
-
-SCTL1S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L1_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.png"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.eps"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.C"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTL1S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L1_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.png"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.eps"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.C"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-#L2
-
-SCTL2S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L2_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.png"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.eps"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.C"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTL2S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L2_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.png"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.eps"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.C"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-#L3
-
-SCTL3S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L3_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.png"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.eps"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.C"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTL3S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L3_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.png"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.eps"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.C"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-
-PIXYL0BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.png"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.eps"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.C"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXYL1BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L1","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.png"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.eps"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.C"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXYL2BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L2","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.png"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.eps"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.C"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-#PIX ECA X 
-
-for i in range(0,3):
-    
-    PIXXECALRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_ECA_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.png"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-              "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.eps"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-              "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.C"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-              "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-    del PIXXECALRes
-
-
-#PIX ECA Y
-
-for i in range(0,3):
-    
-    PIXYECALRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_ECA_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.png"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-              "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.eps"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-              "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.C"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-              "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-    del PIXYECALRes
-
-
-#PIX ECC X 
-
-for i in range(0,3):
-    
-    PIXXECCLRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_ECC_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.png"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-              "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.eps"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-              "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.C"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-              "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    
-    del PIXXECCLRes   
-    
-
-#PIX ECC Y
-
-for i in range(0,3):
-    
-    PIXYECCLRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_ECC_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.png"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-              "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.eps"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-              "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.C"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-              "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-    del PIXYECCLRes
-
-
-
-#SCT EndCaps X I became smarter I guess..
-
-EndCaps = ["ECA","ECC"]
-
-for EndC in EndCaps:   #endcaps cycle
-    for i in range(0,9): #layer cycle
-        
-        SCTECRes0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_"+EndC+"_LayerSCT_L"+str(i)+"_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-        DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.png"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-                  "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.eps"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-                  "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-
-        DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.C"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-                  "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        
-        SCTECRes1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_"+EndC+"_LayerS1SCT_L"+str(i)+"_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-        DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.png"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-                  "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.eps"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-                  "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.C"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-                  "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        
-
-
-        del SCTECRes1
-        del SCTECRes0
-        
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_Zmumu.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_Zmumu.py
deleted file mode 100755
index 25a72b728832bcf8dfb3572afb8dd93b7f3ef0ff..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_Zmumu.py
+++ /dev/null
@@ -1,626 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# small adds Pierfrancesco Butti pbutti@nikhef.nl
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-# need to provide a configuration file - see makeMonitoringPlotsExampleConfigFile.py
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c <configurationFile>
-#
-##--------------------------
-
-import sys
-from ROOT import *
-from utilities import *
-import AtlasStyle
-gStyle.SetOptStat(0)
-
-oFext=""
-nMAXFiles = 1
-#some initialization
-configFileName = ""
-makeOutput = True
-
-#reading in the root file names from input arguments
-for i in range(len(sys.argv)):
-    if sys.argv[i]=="-c":
-        configFileName = sys.argv[i+1]
-
-# reading in configuration file
-fd = open(configFileName)
-config = fd.readlines()
-exec(''.join(config))
-
-print "Reading in from .root files:"
-for i in range(nMAXFiles) :
-    print rootFileNames[i]
-
-
-if makeOutput:
-    print "Producing output in directory:", outputDir
-
-#getting the TFile objects using the rootFileNames
-rootFiles = [TFile,TFile,TFile,TFile] 
-nFiles = 0
-for i in range(nMAXFiles):
-    if rootFileNames[i]!="": 
-        rootFiles[i] = TFile(rootFileNames[i])
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print "nFiles = ",nFiles
-
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-## MEANPIXBAR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_pix_barrel","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANPIXBAR,outputDir+"/"+"MEANPIXBAR.png","Pixel Barrel","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANPIXEndCap = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_pix_endcap","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANPIXEndCap,outputDir+"/"+"MEANPIXEndCap.png","Pixel EndCaps","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANSCTBAR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_sct_barrel","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANSCTBAR,outputDir+"/"+"MEANSCTBAR.png","SCT Barrel","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANSCTEndCap = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_sct_endcap","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANSCTEndCap,outputDir+"/"+"MEANSCTEndCap.png","SCT EndCaps","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-
-
-
-
-## # Basic Barrel Residual distributions
-
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXX, outputDir+"/"+"PIXX.png"+oFext, "Pixel barrel", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-# Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXY, outputDir+"/"+"PIXY.png"+oFext, "Pixel barrel", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-# Basic Pull distributions
-
-PIXPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX, outputDir+"/"+"PIXPULLX.png", "Pixel Barrel", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY, outputDir+"/"+"PIXPULLY.png", "Pixel Barrel", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-PIXPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX0, outputDir+"/"+"PIXPULLX0.png", "Pixel Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX1, outputDir+"/"+"PIXPULLX1.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX2, outputDir+"/"+"PIXPULLX2.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY0, outputDir+"/"+"PIXPULLY0.png", "Pixel Barrel L0", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY1, outputDir+"/"+"PIXPULLY1.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY2, outputDir+"/"+"PIXPULLY2.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-PIXPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECA, outputDir+"/"+"PIXPULLXECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECAY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECAY, outputDir+"/"+"PIXPULLYECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECC, outputDir+"/"+"PIXPULLXECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECCY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECCY, outputDir+"/"+"PIXPULLYECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-SCTX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTX, outputDir+"/"+"SCTX.png"+oFext, "SCT barrel", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-SCTPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX, outputDir+"/"+"SCTPULLX.png", "SCT Barrel", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX0, outputDir+"/"+"SCTPULLX0.png", "SCT Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX1, outputDir+"/"+"SCTPULLX1.png", "SCT Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX2, outputDir+"/"+"SCTPULLX2.png", "SCT Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX3, outputDir+"/"+"SCTPULLX3.png", "SCT Barrel L3", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECA, outputDir+"/"+"SCTPULLXECA.png", "SCT Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECC, outputDir+"/"+"SCTPULLXECC.png", "SCT Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTR, outputDir+"/"+"TRTR.png"+oFext, "TRT barrel", "Hits on tracks / 22#mum",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(TRTR, outputDir+"/"+"TRTR.C"+oFext, "TRT barrel", "Hits on tracks / 22#mum",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-## # Residual mean and width distributions as a function of layer, ring, stave in barrel 
-
-SiBarrelResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXMean, outputDir+"/"+"SiBarrelResXMean.png"+oFext, "Pixel/SCT Barrel", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.63,0.86,False)
-
-
-SiBarrelResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXWidth, outputDir+"/"+"SiBarrelResXWidth.png"+oFext, "Pixel/SCT Barrel", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.63,0.86,False)
-
-
-## ## Individual Barrel Layer Residual Distributions
-
-PIXX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX0, outputDir+"/"+"PIXX0.png"+oFext, "Pixel Barrel L0", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX1, outputDir+"/"+"PIXX1.png"+oFext, "Pixel Barrel L1", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX2, outputDir+"/"+"PIXX2.png"+oFext, "Pixel Barrel L2", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX0, outputDir+"/"+"SCTX0.png"+oFext, "SCT Barrel L0", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX1, outputDir+"/"+"SCTX1.png"+oFext, "SCT Barrel L1", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX2, outputDir+"/"+"SCTX2.png"+oFext, "SCT Barrel L2", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX3, outputDir+"/"+"SCTX3.png"+oFext, "SCT Barrel L3", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## ## Basic Endcap Residual distributions
-
-## # draws combined ECA and ECC residual distribution
-PIXECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECX, outputDir+"/"+"PIXECX.png"+oFext, "Pixel end-caps", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## # Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXECY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXECY, outputDir+"/"+"PIXECY.png"+oFext, "Pixel end-caps", "Hits on tracks / 20#mum",
-          "Local y residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-# draws combined ECA and ECC residual distribution
-SCTECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTECX, outputDir+"/"+"SCTECX.png"+oFext, "SCT Endcap", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-
-TRTEC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTEC, outputDir+"/"+"TRTEC.png"+oFext, "TRT end-caps", "Hits on tracks",
-          "residual [mm]", 0.2, 0.85, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-# Residual mean and width distributions as a function of endcap disk
-SiEcaResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXMean, outputDir+"/"+"SiEcaResXMean.png"+oFext, "Pixel/SCT Endcap A", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEcaResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXWidth, outputDir+"/"+"SiEcaResXWidth.png"+oFext, "Pixel/SCT Endcap A", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEccResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXMean, outputDir+"/"+"SiEccResXMean.png"+oFext, "Pixel/SCT Endcap C", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEccResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXWidth, outputDir+"/"+"SiEccResXWidth.png"+oFext, "Pixel/SCT Endcap C", "residual width [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-
-## # TRT residual mean and width distributions
-
-TRTBL0PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHI, outputDir+"/"+"TRTBLayer0vsPhi.png", "TRT Barrel Layer 0", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL0PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHIRMS, outputDir+"/"+"TRTBLayer0vsPhiRMS.png", "TRT Barrel Layer 0", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL1PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHI, outputDir+"/"+"TRTBLayer1vsPhi.png", "TRT Barrel Layer 1", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL1PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHIRMS, outputDir+"/"+"TRTBLayer1vsPhiRMS.png", "TRT Barrel Layer 1", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL2PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHI, outputDir+"/"+"TRTBLayer2vsPhi.png", "TRT Barrel Layer 2", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL2PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHIRMS, outputDir+"/"+"TRTBLayer2vsPhiRMS.png", "TRT Barrel Layer 2", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TrackZ0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0, outputDir+"/"+"z0.png"+oFext, "", "N Tracks",
-          "z0 [mm]", 0.22, 0.9, "#mum",
-          canvasText,makeOutput,0.66,0.86)
-
-TrackETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"eta","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackETA, outputDir+"/"+"eta.png"+oFext, "", "N Tracks / 0.05",
-"Track #eta", 0.19, 0.9, "",
-          canvasText,makeOutput,0.66,0.86)
-
-TrackPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT.png", "", "N Tracks",
-          "Track pT [GeV]", 0.19, 0.5, "",
-          canvasText,makeOutput,0.66,0.86,False)
-
-    #TRT MEAN/AVG as a function of the rings
-
-    #CORRECT THE Y AXIS!! SCALE BY FACTOR 1000 ################
-
-
-TRTEcaMeanR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsRing_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEcaMeanR, outputDir+"/"+"TRTEcaMeanR.png"+oFext, "TRT Endcap A", "residual Mean [#mum]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEcaRmsR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsRing_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEcaRmsR, outputDir+"/"+"TRTEcaRmsR.png"+oFext, "TRT Endcap A", "residual Rms [mm]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEccMeanR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsRing_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEccMeanR, outputDir+"/"+"TRTEccMeanR.png"+oFext, "TRT Endcap C", "residual Mean [#mum]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEccRmsR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsRing_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEccRmsR, outputDir+"/"+"TRTEccRmsR.png"+oFext, "TRT Endcap C", "residual Rms [mm]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-
-#TRT PLOTS AS A FUNCTION OF THE RINGS
-
-for i in range(0,40):
-    TRTA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_ring_"+str(i)+"_Endcap_A","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(TRTA, outputDir+"/"+"TRT_ECA_R"+str(i)+".png"+oFext, "TRT Endcap A Ring " +str(i), "Number of hits on tracks / 60#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    del TRTA
-
-    TRTC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_ring_"+str(i)+"_Endcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(TRTC, outputDir+"/"+"TRT_ECC_R"+str(i)+".png"+oFext, "TRT Endcap C Ring " +str(i), "Number of hits on tracks / 60#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    
-    
-
-
-Zmumu = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Zmumu","noFit",rootFiles,nFiles,True)
-DrawPlots(Zmumu,outputDir+"/"+"Zmumu.png","Full ID", "Events","Dimuon Invariant Mass GeV/c2",0.19,0.9,"#mum",canvasText,makeOutput,0.66,0.86)
-
-## for i in range(0,3):
-##   for j in range(1,14):
-##     PIXETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b"+str(i)+"_xresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##     DrawPlots(PIXETA,outputDir+"/"+"PIXXETAB"+str(i)+"_"+str(j)+".png","Pix B L"+str(i)+" #eta mod"+str(j),"Hits on track / 2#mum","Local x residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-##     del PIXETA
-
-## for i in range(0,3):
-##   for j in range(1,14):
-##     PIXETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b"+str(i)+"_yresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##     DrawPlots(PIXETA,outputDir+"/"+"PIXYETAB"+str(i)+"_"+str(j)+".png","Pix B L"+str(i)+" #eta mod"+str(j),"Hits on track / 10#mum","Local y residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-##     del PIXETA
-    
-
-## for i in range(0,4):
-##   for j in range(1,14):
-##     SCTETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b"+str(i)+"_xresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##     DrawPlots(SCTETA,outputDir+"/"+"SCTETAB"+str(i)+"_"+str(j)+".png","SCT B L0 #eta mod"+str(j),"Hits on track / 2#mum","Local x residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-##     del SCTETA
-
-## for i in range(0,3):
-##  MEANPIX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_barrel_pix_b"+str(i)+"_xresvsmodetaphi_3d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##  DrawPlots(MEANPIX,outputDir+"/"+"MEANPIXB"+str(i)+".png","Pixel Barrel L"+str(i),"Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-  
-## for i in range(0,4):
-##  MEANSCT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_barrel_sct_b"+str(i)+"_xresvsmodetaphi_3d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##  DrawPlots(MEANSCT,outputDir+"/"+"MEANSCTB"+str(i)+".png","SCT Barrel L"+str(i),"Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-  
-
-##ECAPIXMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcappix_eca_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##DrawPlots(ECAPIXMEAN,outputDir+"/"+"ECAPIXMEAN.png","Pixel Endcap A","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-##ECCPIXMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcappix_ecc_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##DrawPlots(ECCPIXMEAN,outputDir+"/"+"ECCPIXMEAN.png","Pixel Endcap C","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-##ECASCTMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcapsct_eca_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##DrawPlots(ECASCTMEAN,outputDir+"/"+"ECASCTMEAN.png","SCT Endcap A","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-##ECCSCTMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcapsct_ecc_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##DrawPlots(ECCSCTMEAN,outputDir+"/"+"ECCSCTMEAN.png","SCT Endcap C","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-
-
-## #SCT REQUESTED PLOTS RESIDUALS
-
-PIXXL0BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.png"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.eps"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.C"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXXL1BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L1","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.png"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.eps"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.C"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-PIXXL2BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L2","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.png"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.eps"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.C"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-#L0
-
-SCTL0S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L0_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.png"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.eps"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.C"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-SCTL0S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L0_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.png"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.eps"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.C"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-#L1
-
-SCTL1S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L1_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.png"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.eps"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.C"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTL1S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L1_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.png"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.eps"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.C"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-#L2
-
-SCTL2S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L2_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.png"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.eps"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.C"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTL2S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L2_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.png"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.eps"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.C"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-#L3
-
-SCTL3S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L3_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.png"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.eps"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.C"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTL3S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L3_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.png"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.eps"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.C"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-
-PIXYL0BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.png"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.eps"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.C"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXYL1BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L1","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.png"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.eps"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.C"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXYL2BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L2","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.png"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.eps"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.C"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-## #PIX ECA X 
-
-## for i in range(0,3):
-    
-##     PIXXECALRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_ECA_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##     DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.png"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.eps"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.C"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-##     del PIXXECALRes
-
-
-## #PIX ECA Y
-
-## for i in range(0,3):
-    
-##     PIXYECALRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_ECA_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##     DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.png"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.eps"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.C"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-##     del PIXYECALRes
-
-
-## #PIX ECC X 
-
-## for i in range(0,3):
-    
-##     PIXXECCLRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_ECC_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##     DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.png"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.eps"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.C"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    
-##     del PIXXECCLRes   
-    
-
-## #PIX ECC Y
-
-## for i in range(0,3):
-    
-##     PIXYECCLRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_ECC_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##     DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.png"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.eps"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.C"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-##     del PIXYECCLRes
-
-
-
-## #SCT EndCaps X I became smarter I guess..
-
-## EndCaps = ["ECA","ECC"]
-
-## for EndC in EndCaps:   #endcaps cycle
-##     for i in range(0,9): #layer cycle
-        
-##         SCTECRes0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_"+EndC+"_LayerSCT_L"+str(i)+"_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##         DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.png"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-##         DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.eps"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-
-##         DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.C"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        
-##         SCTECRes1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_"+EndC+"_LayerS1SCT_L"+str(i)+"_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##         DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.png"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-##         DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.eps"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-##         DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.C"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        
-
-
-##         del SCTECRes1
-##         del SCTECRes0
-        
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_Zmumu_IBL.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_Zmumu_IBL.py
deleted file mode 100755
index 50a908dac97dd999e33587b9c4a1001e3f7252cb..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots_Zmumu_IBL.py
+++ /dev/null
@@ -1,666 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# small adds Pierfrancesco Butti pbutti@nikhef.nl
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-# need to provide a configuration file - see makeMonitoringPlotsExampleConfigFile.py
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c <configurationFile>
-#
-##--------------------------
-
-import sys
-from ROOT import *
-from utilities import *
-import AtlasStyle
-gStyle.SetOptStat(0)
-
-oFext=""
-nMAXFiles = 1
-#some initialization
-configFileName = ""
-makeOutput = True
-
-#reading in the root file names from input arguments
-for i in range(len(sys.argv)):
-    if sys.argv[i]=="-c":
-        configFileName = sys.argv[i+1]
-
-# reading in configuration file
-fd = open(configFileName)
-config = fd.readlines()
-exec(''.join(config))
-
-print "Reading in from .root files:"
-for i in range(nMAXFiles) :
-    print rootFileNames[i]
-
-
-if makeOutput:
-    print "Producing output in directory:", outputDir
-
-#getting the TFile objects using the rootFileNames
-rootFiles = [TFile,TFile,TFile,TFile] 
-nFiles = 0
-for i in range(nMAXFiles):
-    if rootFileNames[i]!="": 
-        rootFiles[i] = TFile(rootFileNames[i])
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print "nFiles = ",nFiles
-
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-## MEANPIXBAR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_pix_barrel","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANPIXBAR,outputDir+"/"+"MEANPIXBAR.png","Pixel Barrel","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANPIXEndCap = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_pix_endcap","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANPIXEndCap,outputDir+"/"+"MEANPIXEndCap.png","Pixel EndCaps","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANSCTBAR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_sct_barrel","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANSCTBAR,outputDir+"/"+"MEANSCTBAR.png","SCT Barrel","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-## MEANSCTEndCap = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_sct_endcap","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-## DrawPlots(MEANSCTEndCap,outputDir+"/"+"MEANSCTEndCap.png","SCT EndCaps","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine") 
-
-
-
-
-
-## # Basic Barrel Residual distributions
-
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXX, outputDir+"/"+"PIXX.png"+oFext, "Pixel barrel", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-# Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXY, outputDir+"/"+"PIXY.png"+oFext, "Pixel barrel", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-# Basic Pull distributions
-
-PIXPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX, outputDir+"/"+"PIXPULLX.png", "Pixel Barrel", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY, outputDir+"/"+"PIXPULLY.png", "Pixel Barrel", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-PIXPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX0, outputDir+"/"+"PIXPULLX0.png", "Pixel Barrel IBL", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX1, outputDir+"/"+"PIXPULLX1.png", "Pixel Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX2, outputDir+"/"+"PIXPULLX2.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX3, outputDir+"/"+"PIXPULLX3.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY0, outputDir+"/"+"PIXPULLY0.png", "Pixel Barrel IBL", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY1, outputDir+"/"+"PIXPULLY1.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY2, outputDir+"/"+"PIXPULLY2.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY3, outputDir+"/"+"PIXPULLY3.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-PIXPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECA, outputDir+"/"+"PIXPULLXECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECAY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECAY, outputDir+"/"+"PIXPULLYECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECC, outputDir+"/"+"PIXPULLXECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECCY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECCY, outputDir+"/"+"PIXPULLYECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-SCTX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTX, outputDir+"/"+"SCTX.png"+oFext, "SCT barrel", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-SCTPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX, outputDir+"/"+"SCTPULLX.png", "SCT Barrel", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX0, outputDir+"/"+"SCTPULLX0.png", "SCT Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX1, outputDir+"/"+"SCTPULLX1.png", "SCT Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX2, outputDir+"/"+"SCTPULLX2.png", "SCT Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX3, outputDir+"/"+"SCTPULLX3.png", "SCT Barrel L3", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECA, outputDir+"/"+"SCTPULLXECA.png", "SCT Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECC, outputDir+"/"+"SCTPULLXECC.png", "SCT Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTR, outputDir+"/"+"TRTR.png"+oFext, "TRT barrel", "Hits on tracks / 22#mum",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-DrawPlots(TRTR, outputDir+"/"+"TRTR.C"+oFext, "TRT barrel", "Hits on tracks / 22#mum",
-          "residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-## # Residual mean and width distributions as a function of layer, ring, stave in barrel 
-
-SiBarrelResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXMean, outputDir+"/"+"SiBarrelResXMean.png"+oFext, "Pixel/SCT Barrel", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.63,0.86,False)
-
-
-SiBarrelResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXWidth, outputDir+"/"+"SiBarrelResXWidth.png"+oFext, "Pixel/SCT Barrel", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.63,0.86,False)
-
-
-## ## Individual Barrel Layer Residual Distributions
-
-PIXX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX0, outputDir+"/"+"PIXX0.png"+oFext, "Pixel Barrel IBL", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX1, outputDir+"/"+"PIXX1.png"+oFext, "Pixel Barrel L0", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX2, outputDir+"/"+"PIXX2.png"+oFext, "Pixel Barrel L1", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX3, outputDir+"/"+"PIXX3.png"+oFext, "Pixel Barrel L2", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY0, outputDir+"/"+"PIXY0.png"+oFext, "Pixel Barrel IBL", "Number of hits on tracks / 2#mum",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY1, outputDir+"/"+"PIXY1.png"+oFext, "Pixel Barrel L0", "Number of hits on tracks / 2#mum",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY2, outputDir+"/"+"PIXY2.png"+oFext, "Pixel Barrel L1", "Number of hits on tracks / 2#mum",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY3, outputDir+"/"+"PIXY3.png"+oFext, "Pixel Barrel L2", "Number of hits on tracks / 2#mum",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX0, outputDir+"/"+"SCTX0.png"+oFext, "SCT Barrel L0", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX1, outputDir+"/"+"SCTX1.png"+oFext, "SCT Barrel L1", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX2, outputDir+"/"+"SCTX2.png"+oFext, "SCT Barrel L2", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX3, outputDir+"/"+"SCTX3.png"+oFext, "SCT Barrel L3", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## ## Basic Endcap Residual distributions
-
-## # draws combined ECA and ECC residual distribution
-PIXECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECX, outputDir+"/"+"PIXECX.png"+oFext, "Pixel end-caps", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## # Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXECY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXECY, outputDir+"/"+"PIXECY.png"+oFext, "Pixel end-caps", "Hits on tracks / 20#mum",
-          "Local y residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-# draws combined ECA and ECC residual distribution
-SCTECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTECX, outputDir+"/"+"SCTECX.png"+oFext, "SCT Endcap", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-
-TRTEC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTEC, outputDir+"/"+"TRTEC.png"+oFext, "TRT end-caps", "Hits on tracks",
-          "residual [mm]", 0.2, 0.85, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-# Residual mean and width distributions as a function of endcap disk
-SiEcaResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXMean, outputDir+"/"+"SiEcaResXMean.png"+oFext, "Pixel/SCT Endcap A", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEcaResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXWidth, outputDir+"/"+"SiEcaResXWidth.png"+oFext, "Pixel/SCT Endcap A", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEccResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXMean, outputDir+"/"+"SiEccResXMean.png"+oFext, "Pixel/SCT Endcap C", "residual mean [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-SiEccResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXWidth, outputDir+"/"+"SiEccResXWidth.png"+oFext, "Pixel/SCT Endcap C", "residual width [#mum]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-
-## # TRT residual mean and width distributions
-
-TRTBL0PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHI, outputDir+"/"+"TRTBLayer0vsPhi.png", "TRT Barrel Layer 0", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL0PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHIRMS, outputDir+"/"+"TRTBLayer0vsPhiRMS.png", "TRT Barrel Layer 0", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL1PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHI, outputDir+"/"+"TRTBLayer1vsPhi.png", "TRT Barrel Layer 1", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL1PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHIRMS, outputDir+"/"+"TRTBLayer1vsPhiRMS.png", "TRT Barrel Layer 1", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL2PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHI, outputDir+"/"+"TRTBLayer2vsPhi.png", "TRT Barrel Layer 2", "residual mean [#mum]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TRTBL2PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHIRMS, outputDir+"/"+"TRTBLayer2vsPhiRMS.png", "TRT Barrel Layer 2", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False,"SmallLegend")
-
-TrackZ0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0, outputDir+"/"+"z0.png"+oFext, "", "N Tracks",
-          "z0 [mm]", 0.22, 0.9, "#mum",
-          canvasText,makeOutput,0.66,0.86)
-
-TrackZ0sintheta = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0sintheta","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0sintheta, outputDir+"/"+"z0sintheta.png"+oFext, "", "N Tracks",
-"z0sin#theta [mm]", 0.22, 0.9, "#mum",
-          canvasText,makeOutput,0.66,0.86)
-
-TrackD0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0, outputDir+"/"+"d0.png"+oFext, "", "N Tracks",
-          "d0 [mm]", 0.22, 0.9, "#mum",
-          canvasText,makeOutput,0.66,0.86)
-
-
-TrackETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"eta","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackETA, outputDir+"/"+"eta.png"+oFext, "", "N Tracks / 0.05",
-"Track #eta", 0.19, 0.9, "",
-          canvasText,makeOutput,0.66,0.86)
-
-TrackPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT.png", "", "N Tracks",
-          "Track pT [GeV]", 0.19, 0.5, "",
-          canvasText,makeOutput,0.66,0.86,False)
-
-    #TRT MEAN/AVG as a function of the rings
-
-    #CORRECT THE Y AXIS!! SCALE BY FACTOR 1000 ################
-
-
-TRTEcaMeanR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsRing_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEcaMeanR, outputDir+"/"+"TRTEcaMeanR.png"+oFext, "TRT Endcap A", "residual Mean [#mum]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEcaRmsR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsRing_Endcap_A","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEcaRmsR, outputDir+"/"+"TRTEcaRmsR.png"+oFext, "TRT Endcap A", "residual Rms [mm]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEccMeanR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_aveResVsRing_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEccMeanR, outputDir+"/"+"TRTEccMeanR.png"+oFext, "TRT Endcap C", "residual Mean [#mum]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-TRTEccRmsR =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_rmsResVsRing_Endcap_C","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTEccRmsR, outputDir+"/"+"TRTEccRmsR.png"+oFext, "TRT Endcap C", "residual Rms [mm]",
-          "Endcap Ring", 0.19, 0.9, "#mum",canvasText,makeOutput,0.63,0.86,False)
-
-
-#TRT PLOTS AS A FUNCTION OF THE RINGS
-
-for i in range(0,40):
-    TRTA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_ring_"+str(i)+"_Endcap_A","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(TRTA, outputDir+"/"+"TRT_ECA_R"+str(i)+".png"+oFext, "TRT Endcap A Ring " +str(i), "Number of hits on tracks / 60#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    del TRTA
-
-    TRTC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_ring_"+str(i)+"_Endcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(TRTC, outputDir+"/"+"TRT_ECC_R"+str(i)+".png"+oFext, "TRT Endcap C Ring " +str(i), "Number of hits on tracks / 60#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    
-    
-
-
-Zmumu = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Zmumu","noFit",rootFiles,nFiles,True)
-DrawPlots(Zmumu,outputDir+"/"+"Zmumu.png","Full ID", "Events","Dimuon Invariant Mass GeV/c2",0.19,0.9,"#mum",canvasText,makeOutput,0.66,0.86)
-
-## for i in range(0,3):
-##   for j in range(1,14):
-##     PIXETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b"+str(i)+"_xresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##     DrawPlots(PIXETA,outputDir+"/"+"PIXXETAB"+str(i)+"_"+str(j)+".png","Pix B L"+str(i)+" #eta mod"+str(j),"Hits on track / 2#mum","Local x residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-##     del PIXETA
-
-## for i in range(0,3):
-##   for j in range(1,14):
-##     PIXETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b"+str(i)+"_yresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##     DrawPlots(PIXETA,outputDir+"/"+"PIXYETAB"+str(i)+"_"+str(j)+".png","Pix B L"+str(i)+" #eta mod"+str(j),"Hits on track / 10#mum","Local y residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-##     del PIXETA
-    
-
-## for i in range(0,4):
-##   for j in range(1,14):
-##     SCTETA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b"+str(i)+"_xresvsmodetaphi_3deta_module_"+str(j),"noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##     DrawPlots(SCTETA,outputDir+"/"+"SCTETAB"+str(i)+"_"+str(j)+".png","SCT B L0 #eta mod"+str(j),"Hits on track / 2#mum","Local x residual [mm]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86)
-##     del SCTETA
-
-## for i in range(0,3):
-##  MEANPIX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_barrel_pix_b"+str(i)+"_xresvsmodetaphi_3d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##  DrawPlots(MEANPIX,outputDir+"/"+"MEANPIXB"+str(i)+".png","Pixel Barrel L"+str(i),"Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-  
-## for i in range(0,4):
-##  MEANSCT = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_barrel_sct_b"+str(i)+"_xresvsmodetaphi_3d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##  DrawPlots(MEANSCT,outputDir+"/"+"MEANSCTB"+str(i)+".png","SCT Barrel L"+str(i),"Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-  
-
-##ECAPIXMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcappix_eca_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##DrawPlots(ECAPIXMEAN,outputDir+"/"+"ECAPIXMEAN.png","Pixel Endcap A","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-##ECCPIXMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcappix_ecc_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##DrawPlots(ECCPIXMEAN,outputDir+"/"+"ECCPIXMEAN.png","Pixel Endcap C","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-##ECASCTMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcapsct_eca_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##DrawPlots(ECASCTMEAN,outputDir+"/"+"ECASCTMEAN.png","SCT Endcap A","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-##ECCSCTMEAN = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mean_endcapsct_ecc_xresvsmodphi_2d","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-##DrawPlots(ECCSCTMEAN,outputDir+"/"+"ECCSCTMEAN.png","SCT Endcap C","Number of modules / 0.08#mum","Residual Mean [#mum]",0.2,0.9,"#mum",canvasText,makeOutput,0.63,0.86,True,"SeparateLine")
-
-
-
-## #SCT REQUESTED PLOTS RESIDUALS
-
-
-## PIXXL0BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.png"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.eps"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXXL0BRes, outputDir+"/"+"PIXXL0BRes.C"+oFext, "Pixel barrel X Res L0", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## PIXXL1BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L1","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.png"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.eps"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXXL1BRes, outputDir+"/"+"PIXXL1BRes.C"+oFext, "Pixel barrel X Res L1", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-## PIXXL2BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerPix_L2","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.png"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.eps"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXXL2BRes, outputDir+"/"+"PIXXL2BRes.C"+oFext, "Pixel barrel X Res L2", "Hits on tracks / 2#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-## #L0
-
-## SCTL0S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L0_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.png"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.eps"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL0S0Res, outputDir+"/"+"SCTL0S0BRes.C"+oFext, "SCT barrel X Res L0_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-## SCTL0S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L0_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.png"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.eps"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL0S1Res, outputDir+"/"+"SCTL0S1BRes.C"+oFext, "SCT barrel X Res L0_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-## #L1
-
-## SCTL1S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L1_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.png"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.eps"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL1S0Res, outputDir+"/"+"SCTL1S0BRes.C"+oFext, "SCT barrel X Res L1_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## SCTL1S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L1_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.png"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.eps"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL1S1Res, outputDir+"/"+"SCTL1S1BRes.C"+oFext, "SCT barrel X Res L1_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-## #L2
-
-## SCTL2S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L2_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.png"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.eps"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL2S0Res, outputDir+"/"+"SCTL2S0BRes.C"+oFext, "SCT barrel X Res L2_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## SCTL2S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L2_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.png"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.eps"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL2S1Res, outputDir+"/"+"SCTL2S1BRes.C"+oFext, "SCT barrel X Res L2_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-## #L3
-
-## SCTL3S0Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerSCT_L3_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.png"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.eps"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL3S0Res, outputDir+"/"+"SCTL3S0BRes.C"+oFext, "SCT barrel X Res L3_S0", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## SCTL3S1Res = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_Barrel_LayerS1SCT_L3_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.png"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.eps"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(SCTL3S1Res, outputDir+"/"+"SCTL3S1BRes.C"+oFext, "SCT barrel X Res L3_S1", "Hits on tracks / 4#mum",
-##           "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-
-## PIXYL0BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.png"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.eps"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXYL0BRes, outputDir+"/"+"PIXYL0BRes.C"+oFext, "Pixel barrel Y Res L0", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## PIXYL1BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L1","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.png"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.eps"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXYL1BRes, outputDir+"/"+"PIXYL1BRes.C"+oFext, "Pixel barrel Y Res L1", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## PIXYL2BRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_Barrel_LayerPix_L2","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-## DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.png"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.eps"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-## DrawPlots(PIXYL2BRes, outputDir+"/"+"PIXYL2BRes.C"+oFext, "Pixel barrel Y Res L2", "Hits on tracks / 10#mum",
-##           "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-## #PIX ECA X 
-
-## for i in range(0,3):
-    
-##     PIXXECALRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_ECA_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##     DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.png"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.eps"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXXECALRes, outputDir+"/"+"PIXXL"+str(i)+"ECARes.C"+oFext, "Pixel ECA X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-##     del PIXXECALRes
-
-
-## #PIX ECA Y
-
-## for i in range(0,3):
-    
-##     PIXYECALRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_ECA_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##     DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.png"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.eps"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXYECALRes, outputDir+"/"+"PIXYL"+str(i)+"ECARes.C"+oFext, "Pixel ECA Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-##     del PIXYECALRes
-
-
-## #PIX ECC X 
-
-## for i in range(0,3):
-    
-##     PIXXECCLRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_ECC_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##     DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.png"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.eps"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXXECCLRes, outputDir+"/"+"PIXXL"+str(i)+"ECCRes.C"+oFext, "Pixel ECC X Res L"+str(i), "Hits on tracks / 4#mum",
-##               "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-    
-##     del PIXXECCLRes   
-    
-
-## #PIX ECC Y
-
-## for i in range(0,3):
-    
-##     PIXYECCLRes = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_Y_vs_Silicon_ECC_LayerPix_L"+str(i),"noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##     DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.png"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.eps"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-##     DrawPlots(PIXYECCLRes, outputDir+"/"+"PIXYL"+str(i)+"ECCRes.C"+oFext, "Pixel ECC Y Res L"+str(i), "Hits on tracks / 20#mum",
-##               "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-##     del PIXYECCLRes
-
-
-
-## #SCT EndCaps X I became smarter I guess..
-
-## EndCaps = ["ECA","ECC"]
-
-## for EndC in EndCaps:   #endcaps cycle
-##     for i in range(0,9): #layer cycle
-        
-##         SCTECRes0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_"+EndC+"_LayerSCT_L"+str(i)+"_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##         DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.png"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-##         DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.eps"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-
-##         DrawPlots(SCTECRes0, outputDir+"/"+"SCTL"+str(i)+"S0"+EndC+"Res.C"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S0", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        
-##         SCTECRes1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"Residual_X_vs_Silicon_"+EndC+"_LayerS1SCT_L"+str(i)+"_S0","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-##         DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.png"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-##         DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.eps"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-##         DrawPlots(SCTECRes1, outputDir+"/"+"SCTL"+str(i)+"S1"+EndC+"Res.C"+oFext, "SCT "+EndC+" X Res L"+str(i)+"_S1", "Hits on tracks / 4#mum",
-##                   "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-        
-
-
-##         del SCTECRes1
-##         del SCTECRes0
-        
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakePullPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakePullPlots.py
deleted file mode 100644
index 2cc3c290a0fb8695d045c802d593f8c3ba53cac8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakePullPlots.py
+++ /dev/null
@@ -1,140 +0,0 @@
-#
-# Basic Pull distributions
-
-PIXPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX, outputDir+"/"+"PIXPULLX.png", "Pixel Barrel", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY, outputDir+"/"+"PIXPULLY.png", "Pixel Barrel", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-# layer by layer
-PIXPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX0, outputDir+"/"+"PIXPULLX0.png", "Pixel Barrel IBL", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX1, outputDir+"/"+"PIXPULLX1.png", "Pixel Barrel L0", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX2, outputDir+"/"+"PIXPULLX2.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX3, outputDir+"/"+"PIXPULLX3.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY0, outputDir+"/"+"PIXPULLY0.png", "Pixel Barrel IBL", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY1, outputDir+"/"+"PIXPULLY1.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY2, outputDir+"/"+"PIXPULLY2.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY3, outputDir+"/"+"PIXPULLY3.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-PIXPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECA, outputDir+"/"+"PIXPULLXECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECAY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECAY, outputDir+"/"+"PIXPULLYECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECC, outputDir+"/"+"PIXPULLXECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECCY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECCY, outputDir+"/"+"PIXPULLYECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-# SCT
-SCTPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX, outputDir+"/"+"SCTPULLX.png", "SCT Barrel", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX0, outputDir+"/"+"SCTPULLX0.png", "SCT Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX1, outputDir+"/"+"SCTPULLX1.png", "SCT Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX2, outputDir+"/"+"SCTPULLX2.png", "SCT Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX3, outputDir+"/"+"SCTPULLX3.png", "SCT Barrel L3", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECA, outputDir+"/"+"SCTPULLXECA.png", "SCT Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECC, outputDir+"/"+"SCTPULLXECC.png", "SCT Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-# TRT barrel
-TRTPULLR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_b_pullR","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTPULLR, outputDir+"/"+"TRTPULLR.png", "TRT Barrel", "Number of hits on tracks",
-          "R pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-TRTPULLNOTUBER = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_b_pullR_notube","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTPULLNOTUBER, outputDir+"/"+"TRTPULLNOTUBER.png", "TRT Barrel", "Number of hits on tracks",
-          "R pull (no tube)", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-# TRT end caps
-TRTECAPULLR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_Endcap_A","singleGaus",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTECAPULLR, outputDir+"/"+"TRTECAPULLR.png", "TRT Endcap A", "Number of hits on tracks",
-          "R pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-TRTECAPULLR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_notube_Endcap_A","singleGaus",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTECAPULLR, outputDir+"/"+"TRTECAPULLRNOTUBE.png", "TRT Endcap A", "Number of hits on tracks",
-          "R pull (no tube)", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-
-TRTECCPULLR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_Endcap_C","singleGaus",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTECCPULLR, outputDir+"/"+"TRTECCPULLR.png", "TRT Endcap C", "Number of hits on tracks",
-          "R pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-TRTECCPULLR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_notube_Endcap_C","singleGaus",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTECCPULLR, outputDir+"/"+"TRTECCPULLRNOTUBE.png", "TRT Endcap C", "Number of hits on tracks",
-          "R pull (no tube)", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-TRTECSPULLR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR","singleGaus",rootFiles,nFiles,normaliseHistos)#unitArea)
-DrawPlots(TRTECAPULLR, outputDir+"/"+"TRTECSPULLR.png", "TRT Endcaps", "Number of hits on tracks",
-          "R pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-TRTECSPULLR = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"trt_ec_pullR_notube","singleGaus",rootFiles,nFiles,normaliseHistos)#unitArea)
-DrawPlots(TRTECAPULLR, outputDir+"/"+"TRTECSPULLRNOTUBE.png", "TRT Endcaps", "Number of hits on tracks",
-          "R pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-
-PullRes =  MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"si_barrel_pullX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(PullRes, outputDir+"/"+"SiBarrelPullMean."+oFext, "PIX & SCT Barrel", "local x pull", "", 
-          0.18, 0.88, " ", canvasText,makeOutput,0.59, 0.87,False) 
-
-PullRes =  MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"si_barrel_pullX_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PullRes, outputDir+"/"+"SiBarrelPullWidth."+oFext, "PIX & SCT Barrel", "local x pull", "", 
-          0.18, 0.88, " ", canvasText,makeOutput,0.59, 0.87,False) 
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualMapsPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualMapsPlots.py
deleted file mode 100644
index 1c415c539b2973346eb6f53a4bb0889673f08fa5..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualMapsPlots.py
+++ /dev/null
@@ -1,185 +0,0 @@
-# MakeResidualMapsPlots
-#
-MinEntriesPerModule = 20
-
-for i in range(nFiles):
-    
-    print " -- MakeResidualMapsPlots -- file ", i
-    PIXBAR_xResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "BAR", 0, True, 175)
-    outputFileName = outputDir+"/"+userPrefix+"PIXBAR_xResMeanMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(PIXBAR_xResMeanMaps, outputFileName, "#eta id", "#phi id", "Local x residual [#mu m]", 
-                0.2, 0.96, "#mum",canvasText,makeOutput)
-    
-    PIXBAR_yResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "BAR", 1, True, 100)
-    outputFileName = outputDir+"/"+userPrefix+"PIXBAR_yResMeanMaps_File_"+str(i)+"."+oFext
-    outputFileName = outputDir+"/"+userPrefix+"PIXBAR_yResMeanMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(PIXBAR_yResMeanMaps, outputFileName, "#eta id", "#phi id", "Local y residual [#mu m]", 
-                0.2, 0.96, "#mum",canvasText,makeOutput)
-
-    if (userExtended):
-        PIXECA_xResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "ECA", 0)
-        outputFileName = outputDir+"/"+userPrefix+"PIXECA_xResMeanMaps_File_"+str(i)+"."+oFext
-        outputFileName = outputDir+"/"+userPrefix+"PIXECA_xResMeanMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(PIXECA_xResMeanMaps, outputFileName, "", "", "Local x residual [#mu m]", 
-                    0.2, 0.96, "#mum",canvasText,makeOutput,"PIX","ECA")
-
-        PIXECA_yResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "ECA", 1, True, 40)
-        outputFileName =  outputDir+"/"+userPrefix+"PIXECA_yResMeanMaps_File_"+str(i)+"."+oFext
-        outputFileName =  outputDir+"/"+userPrefix+"PIXECA_yResMeanMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(PIXECA_yResMeanMaps, outputFileName, "", "", "Local y residual [#mu m]", 
-                    0.2, 0.96, "#mum",canvasText,makeOutput,"PIX","ECA")
-
-    # PIX ECC doesn't work because histogrma is empty !
-        PIXECC_xResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "ECC", 0)
-        outputFileName =  outputDir+"/"+userPrefix+"PIXECC_xResMeanMaps_File_"+str(i)+"."+oFext
-        outputFileName =  outputDir+"/"+userPrefix+"PIXECC_xResMeanMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(PIXECC_xResMeanMaps, outputFileName, "", "", "Local x residual [#mu m]", 
-                    0.2, 0.96, "#mum",canvasText,makeOutput,"PIX","ECC")
-
-        PIXECC_yResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "ECC", 1, True, 40)
-        outputFileName =  outputDir+"/"+userPrefix+"PIXECC_yResMeanMaps_File_"+str(i)+"."+oFext
-        outputFileName =  outputDir+"/"+userPrefix+"PIXECC_yResMeanMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(PIXECC_yResMeanMaps, outputFileName, "", "", "Local x residual [#mu m]", 
-                    0.2, 0.96, "#mum",canvasText,makeOutput,"PIX","ECC")
-
-    # SCT Barrel: unbiased residual maps 
-    SCTBAR_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "BAR",0, True, 20)
-    outputFileName = outputDir+"/"+userPrefix+"SCTBAR_s0ResMeanMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(SCTBAR_ResMeanMaps, outputFileName, "#eta id", "#phi id", "Local x residual [#mu m]", 
-                0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","BAR")
-
-    SCTBAR_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "BAR", 1, True, 20)
-    outputFileName = outputDir+"/"+userPrefix+"SCTBAR_s1ResMeanMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(SCTBAR_ResMeanMaps, outputFileName, "#eta id", "#phi id", "Local x residual [#mu m]", 
-                0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","BAR")
-
-    ###########################
-    # pixel barrel residual width
-    PIXBAR_xResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "BAR", 0, True, 80, "width")
-    outputFileName = outputDir+"/"+userPrefix+"PIXBAR_xResWidthMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(PIXBAR_xResMeanMaps, outputFileName, "#eta id", "#phi id", "Width of local x residual [#mu m]", 
-                0.2, 0.96, "#mum",canvasText,makeOutput,"PIX","BAR",4)
-    
-    PIXBAR_yResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "BAR", 1, True, 350, "width")
-    outputFileName = outputDir+"/"+userPrefix+"PIXBAR_yResWidthMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(PIXBAR_yResMeanMaps, outputFileName, "#eta id", "#phi id", "Width of local y residual [#mu m]", 
-                0.2, 0.96, "#mum",canvasText,makeOutput,"PIX","BAR", 4)
-    
-    # SCT barrel residual width
-    SCTBAR_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "BAR", 0, True, 80, "width")
-    outputFileName = outputDir+"/"+userPrefix+"SCTBAR_s0ResWidthMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(SCTBAR_ResMeanMaps, outputFileName, "#eta id", "#phi id", "Width of local x residual [#mu m]", 
-                0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","BAR", 4)
-
-    SCTBAR_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "BAR", 1, True, 80, "width")
-    outputFileName = outputDir+"/"+userPrefix+"SCTBAR_s1ResWidthMaps_File_"+legendTitles[i]+"."+oFext
-    outputFileName = outputFileName.replace(" ","_")    
-    outputFileName = outputFileName.replace("(","_")    
-    outputFileName = outputFileName.replace(")","_")    
-    DrawHitMaps(SCTBAR_ResMeanMaps, outputFileName, "#eta id", "#phi id", "Width of local x residual [#mu m]", 
-                0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","BAR", 4)
-
-    if (userExtended):       
-        SCTECAs0_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "ECA", 0, True, 10)
-        outputFileName = outputDir+"/"+userPrefix+"SCTECA_s0ResMeanMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(SCTECAs0_ResMeanMaps, outputFileName, "", "", "Local x residual [#mu m]", 
-                    0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","ECC")
-
-        SCTECAs1_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "ECA", 1, True, 10)
-        outputFileName = outputDir+"/"+userPrefix+"SCTECA_s1ResMeanMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(SCTECAs1_ResMeanMaps, outputFileName, "", "", "Local x residual [#mu m]", 
-                0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","ECC")
-
-        SCTECCs0_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "ECC", 0, True, 10)
-        outputFileName = outputDir+"/"+userPrefix+"SCTECC_s0ResMeanMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(SCTECCs0_ResMeanMaps, outputFileName, "", "", "Local x residual [#mu m]", 
-                0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","ECC")
-        
-        SCTECCs1_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "ECC", 1, True, 10)
-        outputFileName = outputDir+"/"+userPrefix+"SCTECC_s1ResMeanMaps_File_"+legendTitles[i]+"."+oFext
-        outputFileName = outputFileName.replace(" ","_")    
-        outputFileName = outputFileName.replace("(","_")    
-        outputFileName = outputFileName.replace(")","_")    
-        DrawHitMaps(SCTECCs1_ResMeanMaps, outputFileName, "", "", "Local x residual [#mu m]", 
-                0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","ECC")
-        
-        if (False):
-            #########################
-            # detailed residual maps
-            PIXBAR_xResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "BAR", 0, True, 40, "detailed")
-            outputFileName = outputDir+"/"+userPrefix+"PIXBAR_xResMeanDetailedMaps_File_"+legendTitles[i]+"."+oFext
-            outputFileName = outputFileName.replace(" ","_")    
-            outputFileName = outputFileName.replace("(","_")    
-            outputFileName = outputFileName.replace(")","_")    
-            DrawHitMaps(PIXBAR_xResMeanMaps, outputFileName, "#eta id", "#phi id", "Local x residual [#mu m]", 
-                        0.2, 0.96, "#mum",canvasText,makeOutput)
-        
-            PIXBAR_yResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "pixels", "BAR", 1, True, 100, "detailed")
-            outputFileName = outputDir+"/"+userPrefix+"PIXBAR_yResMeanDetailedMaps_File_"+legendTitles[i]+"."+oFext
-            outputFileName = outputFileName.replace(" ","_")    
-            outputFileName = outputFileName.replace("(","_")    
-            outputFileName = outputFileName.replace(")","_")    
-            DrawHitMaps(PIXBAR_yResMeanMaps, outputFileName, "#eta id", "#phi id", "Local y residual [#mu m]", 
-                        0.2, 0.96, "#mum",canvasText,makeOutput)
-            
-            SCTBAR_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "BAR", 0, True, 25, "detailed")
-            outputFileName = outputDir+"/"+userPrefix+"SCTBAR_s0ResMeanDetailedMaps_File_"+legendTitles[i]+"."+oFext
-            outputFileName = outputFileName.replace(" ","_")    
-            outputFileName = outputFileName.replace("(","_")    
-            outputFileName = outputFileName.replace(")","_")    
-            DrawHitMaps(SCTBAR_ResMeanMaps, outputFileName, "#eta id", "#phi id", "Local x residual [#mu m]", 
-                        0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","BAR")
-            
-            SCTBAR_ResMeanMaps = MakeResidualMaps(residualsDir, legendTitles, rootFiles, i, "sct", "BAR", 1, True, 25, "detailed")
-            outputFileName = outputDir+"/"+userPrefix+"SCTBAR_s1ResMeanDetailedMaps_File_"+legendTitles[i]+"."+oFext
-            outputFileName = outputFileName.replace(" ","_")    
-            outputFileName = outputFileName.replace("(","_")    
-            outputFileName = outputFileName.replace(")","_")    
-            DrawHitMaps(SCTBAR_ResMeanMaps, outputFileName, "#eta id", "#phi id", "Local x residual [#mu m]", 
-                        0.2, 0.95, "#mum",canvasText,makeOutput,"SCT","BAR")
-        
-# reset the plots style
-execfile("AtlasStyle.py")
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualOverlapPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualOverlapPlots.py
deleted file mode 100644
index 18181783dcf8985b158e68e22dd73a27cf6c19ea..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualOverlapPlots.py
+++ /dev/null
@@ -1,244 +0,0 @@
-#Script to plot Overlap Plots. (PF)
-
-#Pixel
-#round is not the best function to use for this scope. For the moment I use this. Think about pass to Decimal.
-
-mmToum=1000.
-
-if (userExtended):
-    PIX_OXRX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OXRX0, outputDir+"/"+userPrefix+"PIXIBL_OXRX."+oFext, "IBL", "Hits on tracks / "+str(round(PIX_OXRX0[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OXRX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OXRX1, outputDir+"/"+userPrefix+"PIX0_OXRX."+oFext, "B Layer", "Hits on tracks / "+str(round(PIX_OXRX1[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OXRX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OXRX2, outputDir+"/"+userPrefix+"PIX1_OXRX."+oFext, "PIX Layer 1", "Hits on tracks / "+str(round(PIX_OXRX2[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OXRX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OXRX3, outputDir+"/"+userPrefix+"PIX3_OXRX."+oFext, "PIX Layer 3", "Hits on tracks / "+str(round(PIX_OXRX3[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-    PIX_OXRY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_xoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OXRY0, outputDir+"/"+userPrefix+"PIXIBL_OXRY."+oFext, "IBL", "Hits on tracks / "+str(round(PIX_OXRY0[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "X Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OXRY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_xoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OXRY1, outputDir+"/"+userPrefix+"PIX0_OXRY."+oFext, "B Layer", "Hits on tracks / "+str(round(PIX_OXRY1[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "X Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OXRY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_xoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OXRY2, outputDir+"/"+userPrefix+"PIX1_OXRY."+oFext, "PIX Layer 1", "Hits on tracks / "+str(round(PIX_OXRY2[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "X Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OXRY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_xoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OXRY3, outputDir+"/"+userPrefix+"PIX3_OXRY."+oFext, "PIX Layer 3", "Hits on tracks / "+str(round(PIX_OXRY3[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "X Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    
-
-    
-#This histogram should be empty but there are entries
-    PIX_OYRX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OYRX0, outputDir+"/"+userPrefix+"PIXIBL_OYRX."+oFext, "IBL", "Hits on tracks / "+str(round(PIX_OYRX0[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "Y Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-    
-    PIX_OYRX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OYRX1, outputDir+"/"+userPrefix+"PIX0_OYRX."+oFext, "B Layer", "Hits on tracks / "+str(round(PIX_OYRX1[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "Y Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OYRX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OYRX2, outputDir+"/"+userPrefix+"PIX1_OYRX."+oFext, "PIX Layer 1", "Hits on tracks / "+str(round(PIX_OYRX2[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "Y Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OYRX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OYRX3, outputDir+"/"+userPrefix+"PIX3_OYRX."+oFext, "PIX Layer 3", "Hits on tracks / "+str(round(PIX_OYRX3[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "Y Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-    
-
-#This histogram shouldn't be filled
-#PIX_OYRY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_yoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-#thiscan = DrawPlots(PIX_OYRY0, outputDir+"/"+userPrefix+"PIXIBL_OYRY."+oFext, "IBL", "Hits on tracks / "+str(round(PIX_OYRY0[1].GetBinWidth(1)*mmToum,1))+" #mum",
-#                    "Y Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OYRY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_yoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OYRY1, outputDir+"/"+userPrefix+"PIX0_OYRY."+oFext, "B Layer", "Hits on tracks / "+str(round(PIX_OYRY1[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "Y Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OYRY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_yoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OYRY2, outputDir+"/"+userPrefix+"PIX1_OYRY."+oFext, "PIX Layer 1", "Hits on tracks / "+str(round(PIX_OYRY2[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "Y Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-    PIX_OYRY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_yoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    thiscan = DrawPlots(PIX_OYRY3, outputDir+"/"+userPrefix+"PIX3_OYRY."+oFext, "PIX Layer 3", "Hits on tracks / "+str(round(PIX_OYRY3[1].GetBinWidth(1)*mmToum,1))+" #mum",
-                        "Y Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-#
-# Overlap Residual mean as a function of eta / phi modified modules
-# 
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oxresxvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRXvsModEta."+oFext, "Pixel Barrel", "X Overlap local x residual mean [#mum]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oyresxvsmodeta","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRXvsModEta."+oFext, "Pixel Barrel", "Y Overlap local x residual mean [mm]",
-#          "Module Eta", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oxresyvsmodeta","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRYvsModEta."+oFext, "Pixel Barrel", "X Overlap local y residual mean [mm]",
-#          "Module Eta", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False) #False
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oyresyvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRYvsModEta."+oFext, "Pixel Barrel", "Y Overlap local y residual mean [#mum]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oxresxvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRXvsModPhi."+oFext, "Pixel Barrel", "X Overlap local x residual mean [#mum]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oyresxvsmodphi","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRXvsModPhi."+oFext, "Pixel Barrel", "Y Overlap local x residual mean [mm]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False) #False
-
-#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oxresyvsmodphi","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRYvsModPhi."+oFext, "Pixel Barrel", "X Overlap local y residual mean [mm]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False) #False
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oyresyvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRYvsModPhi."+oFext, "Pixel Barrel", "Y Overlap local y residual mean [#mum]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_eca_Oxresxvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRXvsModPhiECA."+oFext, "Pixel Endcap A", "X Overlap local x residual mean [#mum]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-#This plot is empty
-#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_eca_Oyresyvsmodphi","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRYvsModPhiECA."+oFext, "Pixel Endcap A", "Y Overlap local y residual mean [#mum]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_ecc_Oxresxvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRXvsModPhiECC."+oFext, "Pixel Endcap C", "X Overlap local x residual mean [#mum]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-#This plot is empty.
-#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_ecc_Oyresyvsmodphi","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRYvsModPhiECC."+oFext, "Pixel Endcap C", "Y Overlap local y residual mean [#mum]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-
-
-#Barrel Endcap Overlap residuals and mean for Pixel
-
-
-#General SCT Overlap Residuals
-if (userExtended):
-    SCT_OXRX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(SCT_OXRX0, outputDir+"/"+userPrefix+"SCT0_OXRX."+oFext, "SCT Layer 0", "Hits on tracks / "+str(round(SCT_OXRX0[1].GetBinWidth(1)*mmToum,1))+" #mum",
-              "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-    SCT_OXRX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(SCT_OXRX1, outputDir+"/"+userPrefix+"SCT1_OXRX."+oFext, "SCT Layer 1", "Hits on tracks / "+str(round(SCT_OXRX1[1].GetBinWidth(1)*mmToum,1))+" #mum",
-              "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-    SCT_OXRX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(SCT_OXRX2, outputDir+"/"+userPrefix+"SCT2_OXRX."+oFext, "SCT Layer 2", "Hits on tracks / "+str(round(SCT_OXRX2[1].GetBinWidth(1)*mmToum,1))+" #mum",
-              "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-    SCT_OXRX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(SCT_OXRX3, outputDir+"/"+userPrefix+"SCT3_OXRX."+oFext, "SCT Layer 3", "Hits on tracks / "+str(round(SCT_OXRX3[1].GetBinWidth(1)*mmToum,1))+" #mum",
-              "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-
-    SCT_OYRX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(SCT_OXRX0, outputDir+"/"+userPrefix+"SCT0_OYRX."+oFext, "SCT Layer 0", "Hits on tracks / "+str(round(SCT_OYRX0[1].GetBinWidth(1)*mmToum,1))+" #mum",
-              "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-    SCT_OYRX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(SCT_OXRX1, outputDir+"/"+userPrefix+"SCT1_OYRX."+oFext, "SCT Layer 1", "Hits on tracks / "+str(round(SCT_OYRX1[1].GetBinWidth(1)*mmToum,1))+" #mum",
-              "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-    SCT_OYRX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(SCT_OXRX2, outputDir+"/"+userPrefix+"SCT2_OYRX."+oFext, "SCT Layer 2", "Hits on tracks / "+str(round(SCT_OYRX2[1].GetBinWidth(1)*mmToum,1))+" #mum",
-              "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-    SCT_OYRX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-    DrawPlots(SCT_OXRX3, outputDir+"/"+userPrefix+"SCT3_OYRX."+oFext, "SCT Layer 3", "Hits on tracks / "+str(round(SCT_OYRX3[1].GetBinWidth(1)*mmToum,1))+" #mum",
-              "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-
-# SCT Overlap residuals mean vs eta and phi
-
-
-SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_Oxresxvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOXRXvsModEta."+oFext, "SCT Barrel", "X Overlap local x residual mean [#mum]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_Oyresxvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOYRXvsModEta."+oFext, "SCT Barrel", "Y Overlap local x residual mean [#mum]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-
-SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_Oxresxvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOXRXvsModPhi."+oFext, "SCT Barrel", "X Overlap local x residual mean [#mum]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_Oyresxvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOYRXvsModPhi."+oFext, "SCT Barrel", "Y Overlap local x residual mean [#mum]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_eca_Oxresxvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOXRXvsModPhiECA."+oFext, "SCT Endcap A", "X Overlap local x residual mean [#mum]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_ecc_Oxresxvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOXRXvsModPhiECC."+oFext, "SCT Endcap C", "X Overlap local x residual mean [#mum]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-
-
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualPlots.py
deleted file mode 100644
index 8d4ea4664c61510103865f7afd1cdc66ca8cbc37..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualPlots.py
+++ /dev/null
@@ -1,480 +0,0 @@
-#--
-#
-# Basic Barrel Residual distributions
-#
-print " <MakeResidualPlots.MakeResidualPlots> userCollectOutput=",userCollectOutput
-print "                                       userWebMonitoring=",userWebMonitoring
-#
-psname = "/Users/martis/projectes/atlas/alineament/webmonitoringtest/InDetAlignmentWebMonitor/trunk/WebPage/detailed_plots/2016/ResidualDistributions.pdf"
-if (userWebMonitoring):
-    psname = "/var/vhost/atlas-alignment/secure/detailed_plots/2016/ResidualDistributions.pdf"
-
-def initPsFile():
-    NullCanvas = TCanvas()
-    NullCanvas.Print(psname+"[")
-    return NullCanvas
-	
-def closePsFile(NullCanvas):
-    NullCanvas.Print(psname+"]")
-
-Canvases = []
-if (userCollectOutput):    
-    NullCanvas = initPsFile()
-    
-
-# Pixel
-PIXX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-thiscan = DrawPlots(PIXX0, outputDir+"/"+userPrefix+"PIXIBL_X."+oFext, "IBL", "Hits on tracks / 12 #mum",
-                    "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-if (userCollectOutput): Canvases.append(thiscan)
-
-thiscan = DrawEvolutionPlot(PIXX0, outputDir+"/"+userPrefix+"Evol_PIXIBL_X."+oFext, "Pixel Barrel IBL", "Mean local x residual [mm]", 0.15, 0.89, "#mum",canvasText,makeOutput,0.60, 0.88)    
-if (userCollectOutput): Canvases.append(thiscan)
-
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-thiscan = DrawPlots(PIXX, outputDir+"/"+userPrefix+"PIXX."+oFext, "Pixel barrel + IBL", "Hits on tracks / 12 #mum",
-                    "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-if (userCollectOutput): Canvases.append(thiscan)
-    
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-thiscan = DrawPlots(PIXY, outputDir+"/"+userPrefix+"PIXY."+oFext, "Pixel barrel + IBL", "Hits on tracks / 16 #mum",
-                    "Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-if (userCollectOutput): Canvases.append(thiscan)
-
-# SCT
-SCTX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-thiscan = DrawPlots(SCTX, outputDir+"/"+userPrefix+"SCTX."+oFext, "SCT barrel", "Hits on tracks / 8 #mum",
-                    "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-if (userCollectOutput): Canvases.append(thiscan)
-print " <MakeResidualPlots> canvases: ",len(Canvases), " --> ", Canvases 
-
-#SCTY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-#DrawPlots(SCTY, outputDir+"/"+userPrefix+"SCTY."+oFext, "SCT barrel", "Hits on tracks / 10 #mum",
-#          "Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-# TRT
-TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-thiscan = DrawPlots(TRTR, outputDir+"/"+userPrefix+"TRTR."+oFext, "TRT barrel", "Hits on tracks / 22 #mum",
-                    "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-if (userCollectOutput): Canvases.append(thiscan)
-
-#TRT no Tube
-TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR_notube","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-thiscan = DrawPlots(TRTR, outputDir+"/"+userPrefix+"TRTR_notube."+oFext, "TRT barrel", "Hits on tracks / 22 #mum",
-                    "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-if (userCollectOutput): Canvases.append(thiscan)
-    
-## Individual Barrel Layer Residual Distributions
-PIXX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-thiscan = DrawPlots(PIXX1, outputDir+"/"+userPrefix+"PIXX1."+oFext, "Pixel Barrel L0", "Hits on tracks / 12 #mum",
-                    "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-if (userCollectOutput): Canvases.append(thiscan)
-    
-PIXX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-thiscan = DrawPlots(PIXX2, outputDir+"/"+userPrefix+"PIXX2."+oFext, "Pixel Barrel L1", "Hits on tracks / 12 #mum",
-                    "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-if (userCollectOutput): Canvases.append(thiscan)
-    
-PIXX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX3, outputDir+"/"+userPrefix+"PIXX3."+oFext, "Pixel Barrel L2", "Hits on tracks / 12 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-# pixel barrel local y
-PIXY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY0, outputDir+"/"+userPrefix+"PIXIBL_Y."+oFext, "IBL", "Hits on tracks / 16 #mum",
-          "Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-PIXY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY1, outputDir+"/"+userPrefix+"PIXY1."+oFext, "Pixel Barrel L0", "Hits on tracks / 16 #mum",
-          "Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-PIXY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY2, outputDir+"/"+userPrefix+"PIXY2."+oFext, "Pixel Barrel L1", "Hits on tracks / 16 #mum",
-          "Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-PIXY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY3, outputDir+"/"+userPrefix+"PIXY3."+oFext, "Pixel Barrel L2", "Hits on tracks / 16 #mum",
-          "Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-# Pixel L1 L2 L3                                                                                                                                                                              
-OLDPIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"oldpix_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)                                    
-DrawPlots(OLDPIXX, outputDir+"/"+userPrefix+"OLDPIXX."+oFext, "Pixel Barrel", "Hits on tracks / 12 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-OLDPIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"oldpix_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)                                    
-DrawPlots(OLDPIXY, outputDir+"/"+userPrefix+"OLDPIXY."+oFext, "Pixel Barrel", "Hits on tracks / 16 #mum",
-          "Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-# sct barrel
-SCTX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX0, outputDir+"/"+userPrefix+"SCTX0."+oFext, "SCT Barrel L0", "Hits on tracks / 8 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-SCTX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX1, outputDir+"/"+userPrefix+"SCTX1."+oFext, "SCT Barrel L1", "Hits on tracks / 8 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-SCTX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX2, outputDir+"/"+userPrefix+"SCTX2."+oFext, "SCT Barrel L2", "Hits on tracks / 8 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-SCTX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX3, outputDir+"/"+userPrefix+"SCTX3."+oFext, "SCT Barrel L3", "Hits on tracks / 8 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-
-
-
-
-
-
-
-## Basic Endcap Residual distributions
-
-# draws combined ECA and ECC residual distribution
-PIXECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECX, outputDir+"/"+userPrefix+"PIXECX."+oFext, "Pixel end-caps", "Hits on tracks / 12 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-# Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXECY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXECY, outputDir+"/"+userPrefix+"PIXECY."+oFext, "Pixel end-caps", "Hits on tracks / 16 #mum",
-          "Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-PIXECAX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECAX, outputDir+"/"+userPrefix+"PIXECAX."+oFext, "PIX Endcap A", "Hits on tracks / 12 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",
-          canvasText,makeOutput)
-
-PIXECCX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECCX, outputDir+"/"+userPrefix+"PIXECCX."+oFext, "PIX Endcap C", "Hits on tracks / 12 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",
-          canvasText,makeOutput)
-
-PIXECAY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECAY, outputDir+"/"+userPrefix+"PIXECAY."+oFext, "PIX Endcap A", "Hits on tracks / 16 #mum",
-          "Local y residual [mm]", 0.18, 0.88, "#mum",
-          canvasText,makeOutput)
-
-PIXECCY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECCY, outputDir+"/"+userPrefix+"PIXECCY."+oFext, "PIX Endcap C", "Hits on tracks / 16 #mum",
-          "Local y residual [mm]", 0.18, 0.88, "#mum",
-          canvasText,makeOutput)
-
-
-# draws combined ECA and ECC residual distribution
-SCTECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTECX, outputDir+"/"+userPrefix+"SCTECX."+oFext, "SCT Endcap", "Hits on tracks / 8 #mum",
-          "Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87)
-
-
-SCTECAX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECAX, outputDir+"/"+userPrefix+"SCTECAX."+oFext, "SCT Endcap A", "Hits on tracks / 8 #mum",
-          "x residual [mm]", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87)
-
-SCTECCX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTECCX, outputDir+"/"+userPrefix+"SCTECCX."+oFext, "SCT Endcap C", "Hits on tracks / 8 #mum",
-          "x residual [mm]", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87)
-
-TRTECA = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_Endcap_A","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECA, outputDir+"/"+userPrefix+"TRTECA."+oFext, "TRT Endcap A", "Hits on tracks / 22 #mum",
-          "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput)
-
-TRTECA = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_notubeEndcap_A","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECA, outputDir+"/"+userPrefix+"TRTECA_notube."+oFext, "TRT Endcap A", "Hits on tracks / 22 #mum",
-          "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput)
-
-TRTECC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_Endcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECC, outputDir+"/"+userPrefix+"TRTECC."+oFext, "TRT Endcap C", "Hits on tracks / 22 #mum",
-          "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput)
-
-TRTECC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_notubeEndcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(TRTECC, outputDir+"/"+userPrefix+"TRTECC_notube."+oFext, "TRT Endcap C", "Hits on tracks / 22 #mum",
-          "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput)
-
-TRTEC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(TRTEC, outputDir+"/"+userPrefix+"TRTEC."+oFext, "TRT end-caps", "Hits on tracks / 22 #mum",
-          "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput)
-
-
-TRTBprof = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveResOverPhiVsStrawLayer","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBprof, outputDir+"/"+userPrefix+"TRTBprof."+oFext, "TRT Barrel", "residual [#mum]", "wire number", 
-          0.18, 0.88, "#mum", canvasText, makeOutput, 0.59, 0.87, False)
-
-TRTB0R = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB0R, outputDir+"/"+userPrefix+"TRTB0R."+oFext, "TRT Barrel layer 0", "residual [#mum]", "sector", 
-          0.18, 0.88, "#mum", canvasText, makeOutput, 0.59, 0.87, False)
-
-TRTB1R = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB1R, outputDir+"/"+userPrefix+"TRTB1R."+oFext, "TRT Barrel layer 1", "residual [#mum]", "sector", 
-          0.18, 0.88, "#mum", canvasText, makeOutput, 0.59, 0.87, False)
-
-TRTB2R = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTB2R, outputDir+"/"+userPrefix+"TRTB2R."+oFext, "TRT Barrel layer 2", "residual [#mum]", "sector", 
-          0.18, 0.88, "#mum", canvasText, makeOutput, 0.59, 0.87, False)
-
-
-#Modified eta/phi plots
-
-
-#PIXMODETA =  MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_"
-
-#
-# Residual mean and width distributions as a function of layer, ring, stave in barrel 
-#
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_xresvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelXvsModEta."+oFext, "Pixel Barrel", "local x residual mean [mm]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_yresvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelYvsModEta."+oFext, "Pixel Barrel", "local y residual mean [mm]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelXvsModPhi."+oFext, "Pixel Barrel", "local x residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_yresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelYvsModPhi."+oFext, "Pixel Barrel", "local y residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-PixelXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhi, outputDir+"/"+userPrefix+"PixelECAXvsModPhi."+oFext, "Pixel Endcap A", "residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-PixelXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhi, outputDir+"/"+userPrefix+"PixelECCXvsModPhi."+oFext, "Pixel Endcap C", "residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-PixelXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_yresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhi, outputDir+"/"+userPrefix+"PixelECAYvsModPhi."+oFext, "Pixel Endcap A", "residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-PixelXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_yresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhi, outputDir+"/"+userPrefix+"PixelECCYvsModPhi."+oFext, "Pixel Endcap C", "residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_xresvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTXvsModEta."+oFext, "SCT Barrel", "local x residual mean [mm]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTXvsModPhi."+oFext, "SCT Barrel", "local x residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False) #False
-
-
-SCTXPhi_eca = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTXPhi_eca, outputDir+"/"+userPrefix+"SCTECAXvsModPhi_eca."+oFext, "SCT Endcap A", "local x residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-SCTXPhi_ecc = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTXPhi_ecc, outputDir+"/"+userPrefix+"SCTECCXvsModPhi_ecc."+oFext, "SCT Endcap C", "local x residual mean [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-          
-
-PixelXEtaW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xresvsmodeta_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXEtaW, outputDir+"/"+userPrefix+"PixelXvsModEtaWidth."+oFext, "Pixel Barrel", "residual width [mm]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-PixelXEtaW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_yresvsmodeta_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXEtaW, outputDir+"/"+userPrefix+"PixelYvsModEtaWidth."+oFext, "Pixel Barrel", "residual width [mm]",
-          "Module Eta", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-
-PixelXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhiW, outputDir+"/"+userPrefix+"PixelXvsModPhiWidth."+oFext, "Pixel Barrel", "residual width [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-PixelXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_yresvsmodphi_width","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhiW, outputDir+"/"+userPrefix+"PixelYvsModPhiWidth."+oFext, "Pixel Barrel", "residual width [mm]",
-          "Module Phi", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-
-#PixelXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelXPhiW, outputDir+"/"+userPrefix+"PixelECAXvsModPhiWidth."+oFext, "Pixel Endcap A", "residual width [mm]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False)
-
-#PixelXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_yresvsmodphi_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelXPhiW, outputDir+"/"+userPrefix+"PixelECAYvsModPhiWidth."+oFext, "Pixel Endcap A", "residual width [mm]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False)
-
-#PixelXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelXPhiW, outputDir+"/"+userPrefix+"PixelECCXvsModPhiWidth."+oFext, "Pixel Endcap C", "residual width [mm]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False)
-
-#PixelXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_yresvsmodphi_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(PixelXPhiW, outputDir+"/"+userPrefix+"PixelECCYvsModPhiWidth."+oFext, "Pixel Endcap C", "residual width [mm]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False)
-
-
-#SCTXPhiW_eca = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(SCTXPhiW_eca, outputDir+"/"+userPrefix+"SCTECAXvsModPhiWidth_eca."+oFext, "SCT Endcap A", "local x residual width [mm]","Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False)
-
-
-#SCTXPhiW_ecc = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(SCTXPhiW_ecc, outputDir+"/"+userPrefix+"SCTECCXvsModPhiWidth_ecc."+oFext, "SCT Endcap C", "residual width [mm]",
-#          "Module Phi", 0.18, 0.88, "#mum",
-#          canvasText,makeOutput,0.59, 0.87,False)
-
-SiBarrelResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXMean, outputDir+"/"+userPrefix+"SiBarrelResXMean."+oFext, "Pixel/SCT Barrel", "residual mean [mm]",
-          "", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-SiBarrelResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_barrel_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiBarrelResXWidth, outputDir+"/"+userPrefix+"SiBarrelResXWidth."+oFext, "Pixel/SCT Barrel", "residual width [mm]",
-          "", 0.18, 0.88, "#mum",
-          canvasText,makeOutput,0.59, 0.87,False)
-
-
-
-#
-# -- Extended plots
-#
-if (userExtended or True):
-    # IBL split per 3D and planar sensors
-    # -- local x
-    PIXIBL_3DC_xRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualx_3DCSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXIBL_3DC_xRES, outputDir+"/"+userPrefix+"PIXIBL_3DC_xRES."+oFext, "IBL 3D sensors. C side", "Hits on track", "Local x residual [mm]",0.18, 0.88, "#mum",
-              canvasText,makeOutput,0.59, 0.87)
-
-    PIXIBL_3DA_xRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualx_3DASensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXIBL_3DA_xRES, outputDir+"/"+userPrefix+"PIXIBL_3DA_xRES."+oFext, "IBL 3D sensors. A side", "Hits on track", "Local x residual [mm]",0.18, 0.88, "#mum",
-              canvasText,makeOutput,0.59, 0.87)
-
-    PIXIBL_3D_xRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualx_3DSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXIBL_3D_xRES, outputDir+"/"+userPrefix+"PIXIBL_3D_xRES."+oFext, "IBL 3D sensors", "Hits on track", "Local x residual [mm]",0.18, 0.88, "#mum",
-              canvasText,makeOutput,0.59, 0.87)
-    
-    PIXIBL_Planar_xRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualx_PlanarSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXIBL_Planar_xRES, outputDir+"/"+userPrefix+"PIXIBL_Planar_xRES."+oFext, "IBL Planar sensors", "Hits on track", "Local x residual [mm]",0.18, 0.88, "#mum",
-              canvasText,makeOutput,0.59, 0.87)
-    
-    # -- local y
-    PIXIBL_3D_yRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualy_3DSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXIBL_3D_yRES, outputDir+"/"+userPrefix+"PIXIBL_3D_yRES."+oFext, "IBL 3D sensors", "Hits on track", "Local y residual [mm]",0.18, 0.88, "#mum",
-              canvasText,makeOutput,0.59, 0.87)
-    
-    PIXIBL_Planar_yRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualy_PlanarSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-    DrawPlots(PIXIBL_Planar_yRES, outputDir+"/"+userPrefix+"PIXIBL_Planar_yRES."+oFext, "IBL Planar sensors", "Hits on track", "Local y residual [mm]",0.18, 0.88, "#mum",
-              canvasText,makeOutput,0.59, 0.87)
-    
-
-
-
-
-
-if (userExtended and userClusters):
-    PIXX0vsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx_inciphi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX0vsINCANG,outputDir+"/"+userPrefix+"PIXIBL_XvsINCANG."+oFext,"IBL","Local x residual [mm]","Incident angle [radians]",0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    PIXX1vsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx_inciphi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX1vsINCANG,outputDir+"/"+userPrefix+"PIXX1vsINCANG."+oFext,"PIXEL Layer 0","Local x residual [mm]","Incident angle [radians]",0.15,0.88,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    PIXX2vsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx_inciphi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX2vsINCANG,outputDir+"/"+userPrefix+"PIXX2vsINCANG."+oFext,"PIXEL Layer 1","Local x residual [mm]","Incident angle [radians]",0.15,0.88,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    PIXX3vsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualx_inciphi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX3vsINCANG,outputDir+"/"+userPrefix+"PIXX3vsINCANG."+oFext,"PIXEL Layer 2","Local x residual [mm]","Incident angle [radians]",0.15,0.88,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    PIXX0vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX0vsCLUSIZ,outputDir+"/"+userPrefix+"PIXX0vsCLUSIZE."+oFext,"IBL","Local x residual [mm]","Cluster size",0.15,0.88,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    PIXX1vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX1vsCLUSIZ,outputDir+"/"+userPrefix+"PIXX1vsCLUSIZE."+oFext,"PIXEL Layer 0","Local x residual [mm]","Cluster size",0.15,0.88,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    PIXX2vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX2vsCLUSIZ,outputDir+"/"+userPrefix+"PIXX2vsCLUSIZE."+oFext,"PIXEL Layer 1","Local x residual [mm]","Cluster size",0.15,0.88,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    PIXX3vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(PIXX3vsCLUSIZ,outputDir+"/"+userPrefix+"PIXX3vsCLUSIZE."+oFext,"PIXEL Layer 2","Local x residual [mm]","Cluster size",0.15,0.88,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-	# SCT 
-    SCTX0vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTX0vsCLUSIZ,outputDir+"/"+userPrefix+"SCTX0vsCLUSIZE."+oFext,"SCT Barrel layer 0","Local x residual [mm]","Cluster size",0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    SCTX1vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTX1vsCLUSIZ,outputDir+"/"+userPrefix+"SCTX1vsCLUSIZE."+oFext,"SCT Barrel layer 1","Local x residual [mm]","Cluster size",0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    SCTX2vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTX2vsCLUSIZ,outputDir+"/"+userPrefix+"SCTX2vsCLUSIZE."+oFext,"SCT Barrel layer 2","Local x residual [mm]","Cluster size",0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    SCTX3vsCLUSIZ = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualx_clustersizePhi","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTX3vsCLUSIZ,outputDir+"/"+userPrefix+"SCTX3vsCLUSIZE."+oFext,"SCT Barrel layer 3","Local x residual [mm]","Cluster size",0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    # SCT vs incident angle across strips
-    SCTXvsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualsx_incidentAnglePhi_s0","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTXvsINCANG,outputDir+"/"+userPrefix+"SCTX0s0vsIncAng."+oFext,"SCT Barrel layer 0 side 0","Local x residual [mm]","Incident angle [rad]",
-              0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    SCTXvsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualsx_incidentAnglePhi_s0","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTXvsINCANG,outputDir+"/"+userPrefix+"SCTX1s0vsIncAng."+oFext,"SCT Barrel layer 1 side 0","Local x residual [mm]","Incident angle [rad]",
-              0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    SCTXvsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualsx_incidentAnglePhi_s0","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTXvsINCANG,outputDir+"/"+userPrefix+"SCTX2s0vsIncAng."+oFext,"SCT Barrel layer 2 side 0","Local x residual [mm]","Incident angle [rad]",
-              0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    SCTXvsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualsx_incidentAnglePhi_s0","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTXvsINCANG,outputDir+"/"+userPrefix+"SCTX3s0vsIncAng."+oFext,"SCT Barrel layer 3 side 0","Local x residual [mm]","Incident angle [rad]",
-              0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    SCTXvsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualsx_incidentAnglePhi_s1","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTXvsINCANG,outputDir+"/"+userPrefix+"SCTX0s1vsIncAng."+oFext,"SCT Barrel layer 0 side 1","Local x residual [mm]","Incident angle [rad]",
-              0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    SCTXvsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualsx_incidentAnglePhi_s1","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTXvsINCANG,outputDir+"/"+userPrefix+"SCTX1s1vsIncAng."+oFext,"SCT Barrel layer 1 side 1","Local x residual [mm]","Incident angle [rad]",
-              0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    SCTXvsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualsx_incidentAnglePhi_s1","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTXvsINCANG,outputDir+"/"+userPrefix+"SCTX2s1vsIncAng."+oFext,"SCT Barrel layer 2 side 1","Local x residual [mm]","Incident angle [rad]",
-              0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-    
-    SCTXvsINCANG = MakeProfPlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualsx_incidentAnglePhi_s1","noFit",rootFiles,nFiles,True)
-    DrawPlots(SCTXvsINCANG,outputDir+"/"+userPrefix+"SCTX3s1vsIncAng."+oFext,"SCT Barrel layer 3 side 1","Local x residual [mm]","Incident angle [rad]",
-              0.15,0.89,"#mum", canvasText,makeOutput, 0.59, 0.87, False);
-
-    # SCT barrel layer 0 Upper sectors (useful for cosmics)
-    SCTUpper = MakePlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "sct_b0_xresvsmodetaphi_3d", "noFitWithStats", rootFiles, nFiles, False, 7, 10) 
-    DrawPlots(SCTUpper, outputDir+"/"+userPrefix+"SCT_upper."+oFext, "SCT Layer 0 upper", "Average local x residual [mm]",
-              "local x residual [mm]", 0.17, 0.89, "#mum",canvasText,makeOutput,0.65,0.89, False)
-    
-    SCTSides = MakePlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "sct_b0_xresvsmodetaphi_3d", "noFitWithStats", rootFiles, nFiles, False, 0, 4) 
-    DrawPlots(SCTSides, outputDir+"/"+userPrefix+"SCT_sides."+oFext, "SCT Layer 0 sides", "Average local x residual [mm]",
-              "local x residual [mm]", 0.17, 0.89, "#mum",canvasText,makeOutput,0.65,0.89, False)
-
-if (userCollectOutput):
-    print " <MakeResidualPlots> PsFile = ",psname
-    for canvas in Canvases:
-        print "  <MakeResidualPlots> storing canvas: ", canvas 
-        PsFile = canvas.Print(psname)
-    closePsFile(NullCanvas)
-
-print " -- MakeResidualPlots -- completed "
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualProfilesPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualProfilesPlots.py
deleted file mode 100644
index 5d31cba67a1b14199e5a0b3657ebc183b8f62fe5..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualProfilesPlots.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#Priscilla's add
-
-PixelYPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_yresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelYPhi, outputDir+"/"+"PixelYvsModPhi."+oFext, "Pixel Barrel", "residual Y mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False)
-
-# PixelYPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_yresvsmodphi_width","noFit",rootFiles,nFiles,False)
-# DrawPlots(PixelYPhiW, outputDir+"/"+"PixelYvsModPhiWidth."+oFext, "Pixel Barrel", "residual Y width [mm]",
-#           "Module Phi", 0.19, 0.9, "#mum",
-#           canvasText,makeOutput,0.60,0.91,False)
-
-
-PixelXPhi_eca = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhi_eca, outputDir+"/"+"PixelXvsModPhi_eca."+oFext, "Pixel Endcap A", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False)
-
-# PixelXPhiW_eca = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-# DrawPlots(PixelXPhiW_eca, outputDir+"/"+"PixelXvsModPhiWidth_eca."+oFext, "Pixel Endcap A", "residual width [mm]",
-#           "Module Phi", 0.19, 0.9, "#mum",
-#           canvasText,makeOutput,0.60,0.91,False)
-
-PixelYPhi_eca = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_yresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelYPhi_eca, outputDir+"/"+"PixelYvsModPhi_eca."+oFext, "Pixel Endcap A", "residual Y mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False)
-
-# PixelYPhiW_eca = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_yresvsmodphi_width","noFit",rootFiles,nFiles,False)
-# DrawPlots(PixelYPhiW_eca, outputDir+"/"+"PixelYvsModPhiWidth_eca."+oFext, "Pixel Endcap A", "residual Y width [mm]",
-#           "Module Phi", 0.19, 0.9, "#mum",
-#           canvasText,makeOutput,0.60,0.91,False)
-
-PixelXPhi_ecc = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelXPhi_ecc, outputDir+"/"+"PixelXvsModPhi_ecc."+oFext, "Pixel Endcap C", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False)
-
-# PixelXPhiW_ecc = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-# DrawPlots(PixelXPhiW_ecc, outputDir+"/"+"PixelXvsModPhiWidth_ecc."+oFext, "Pixel Endcap C", "residual width [mm]",
-#           "Module Phi", 0.19, 0.9, "#mum",
-#           canvasText,makeOutput,0.60,0.91,False)
-
-PixelYPhi_ecc = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_yresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(PixelYPhi_ecc, outputDir+"/"+"PixelYvsModPhi_ecc."+oFext, "Pixel Endcap C", "residual Y mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False)
-
-# PixelYPhiW_ecc = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_yresvsmodphi_width","noFit",rootFiles,nFiles,False)
-# DrawPlots(PixelYPhiW_ecc, outputDir+"/"+"PixelYvsModPhiWidth_ecc."+oFext, "Pixel Endcap C", "residual Y width [mm]",
-#           "Module Phi", 0.19, 0.9, "#mum",
-#           canvasText,makeOutput,0.60,0.91,False)
-# --
-
-
-SCTXEta = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_xresvsmodeta","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTXEta, outputDir+"/"+"SCTXvsModEta."+oFext, "SCT Barrel", "residual mean [mm]",
-          "Module Eta", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False)
-
-#SCTXEtaW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_xresvsmodeta_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(SCTXEtaW, outputDir+"/"+"SCTXvsModEtaWidth."+oFext, "SCT Barrel", "residual width [mm]",
-#          "Module Eta", 0.19, 0.9, "#mum",
-#          canvasText,makeOutput,0.60,0.91,False)
-
-
-SCTXPhi = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_xresvsmodphi","noFit",rootFiles,nFiles,False)
-DrawPlots(SCTXPhi, outputDir+"/"+"SCTXvsModPhi."+oFext, "SCT Barrel", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",
-          canvasText,makeOutput,0.60,0.91,False)
-
-#SCTXPhiW = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_xresvsmodphi_width","noFit",rootFiles,nFiles,False)
-#DrawPlots(SCTXPhiW, outputDir+"/"+"SCTXvsModPhiWidth."+oFext, "SCT Barrel", "residual width [mm]",
-#          "Module Phi", 0.19, 0.9, "#mum",
-#          canvasText,makeOutput,0.60,0.91,False)
-
-# Residual mean and width distributions as a function of endcap disk
-#SiEcaResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_mean","noFit",rootFiles,nFiles,False)
-#DrawPlots(SiEcaResXMean, outputDir+"/"+"SiEcaResXMean."+oFext, "Pixel/SCT Endcap A", "residual mean [mm]",
-#          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-SiEcaResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_eca_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEcaResXWidth, outputDir+"/"+"SiEcaResXWidth."+oFext, "Pixel/SCT Endcap A", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-SiEccResXMean = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_mean","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXMean, outputDir+"/"+"SiEccResXMean."+oFext, "Pixel/SCT Endcap C", "residual mean [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-SiEccResXWidth = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"si_ecc_resX_rms","noFit",rootFiles,nFiles,False)
-DrawPlots(SiEccResXWidth, outputDir+"/"+"SiEccResXWidth."+oFext, "Pixel/SCT Endcap C", "residual width [mm]",
-          "", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-# TRT residual mean and width distributions
-
-TRTBL0PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHI, outputDir+"/"+"TRTBLayer0vsPhi."+oFext, "TRT Barrel Layer 0", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-TRTBL0PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l0","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL0PHIRMS, outputDir+"/"+"TRTBLayer0vsPhiRMS."+oFext, "TRT Barrel Layer 0", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-TRTBL1PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHI, outputDir+"/"+"TRTBLayer1vsPhi."+oFext, "TRT Barrel Layer 1", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-TRTBL1PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l1","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL1PHIRMS, outputDir+"/"+"TRTBLayer1vsPhiRMS."+oFext, "TRT Barrel Layer 1", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-TRTBL2PHI = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHI, outputDir+"/"+"TRTBLayer2vsPhi."+oFext, "TRT Barrel Layer 2", "residual mean [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-TRTBL2PHIRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsRes_l2","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBL2PHIRMS, outputDir+"/"+"TRTBLayer2vsPhiRMS."+oFext, "TRT Barrel Layer 2", "residual RMS [mm]",
-          "Module Phi", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-TRTBRADIUS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_aveResOverPhiVsStrawLayer","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBRADIUS, outputDir+"/"+"TRTBVsStrawLayer."+oFext, "TRT Barrel", "residual mean [mm]",
-          "Straw Layer", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-TRTBRADIUSRMS = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_rmsResOverPhiVsStrawLayer","noFit",rootFiles,nFiles,False)
-DrawPlots(TRTBRADIUSRMS, outputDir+"/"+"TRTBVsStrawLayerRMS."+oFext, "TRT Barrel", "residual RMS [mm]",
-          "Straw Layer", 0.19, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,False)
-
-
-print " -- MakeResidualProfilesPlots -- completed "
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualsIBL.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualsIBL.py
deleted file mode 100644
index eecd1c562a3b326ca5de68dd3d441cf175a5ea0a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualsIBL.py
+++ /dev/null
@@ -1,153 +0,0 @@
-#
-#
-#
-#
-PIXX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX0, outputDir+"/"+userPrefix+"PIXIBL_X."+oFext, "Pixel Barrel IBL", "#hits on track",
-          "Local x residual [mm]", 0.17, 0.89, "#mum",canvasText,makeOutput,0.60, 0.88)
-
-DrawEvolutionPlot(PIXX0, outputDir+"/"+userPrefix+"Evol_PIXIBL_X."+oFext, "Pixel Barrel IBL", "Mean local x residual [mm]", 0.15, 0.89, "#mum",canvasText,makeOutput,0.60, 0.88)
-
-PIXY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY0, outputDir+"/"+userPrefix+"PIXIBL_Y."+oFext, "Pixel Barrel IBL", "#hits on track",
-          "Local y residual [mm]", 0.17, 0.89, "#mum",canvasText,makeOutput,0.60, 0.88)
-
-#
-
-IBL_xRESvsETA =  MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True)
-DrawPlots(IBL_xRESvsETA, outputDir+"/"+userPrefix+"IBL_xRESvsETA."+oFext, "IBL", "Average local x residual [mm]",
-          "ring along stave [#eta-index]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60,0.88, False) # 0.41, 0.40
-
-IBL_yRESvsETA =  MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_yresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True)
-DrawPlots(IBL_yRESvsETA, outputDir+"/"+userPrefix+"IBL_yRESvsETA."+oFext, "IBL", "Average local y residual [mm]",
-          "ring along stave [#eta-index]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60, 0.88, False)
-
-
-PIX1_xRESvsETA =  MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b1_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True)
-DrawPlots(PIX1_xRESvsETA, outputDir+"/"+userPrefix+"PIX1_xRESvsETA."+oFext, "Pixel layer 1", "Average local x residual [mm]",
-          "ring along stave [#eta-index]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60, 0.88, False)
-
-PIX2_xRESvsETA =  MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b2_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True)
-DrawPlots(PIX2_xRESvsETA, outputDir+"/"+userPrefix+"PIX2_xRESvsETA."+oFext, "Pixel layer 2", "Average local x residual [mm]",
-          "ring along stave [#eta-index]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60, 0.88, False)
-
-PIX3_xRESvsETA =  MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b3_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True)
-DrawPlots(PIX3_xRESvsETA, outputDir+"/"+userPrefix+"PIX3_xRESvsETA."+oFext, "Pixel layer 3", "Average local x residual [mm]",
-          "ring along stave [#eta-index]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60, 0.88, False)
-
-IBL_xRESvsETAupper =  MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True, 3, 6)
-DrawPlots(IBL_xRESvsETAupper, outputDir+"/"+userPrefix+"IBL_xRESvsETAupper."+oFext, "Upper IBL", "Average local x residual [mm]",
-          "ring along stave [#eta-index]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60, 0.88, False)
-
-IBL_xRESvsETAlower =  MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True, 10, 13)
-DrawPlots(IBL_xRESvsETAlower, outputDir+"/"+userPrefix+"IBL_xRESvsETAlower."+oFext, "Lower IBL", "Average local x residual [mm]",
-          "ring along stave [#eta-index]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60, 0.88, False)
-
-PIXIBL_3D_xRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualx_3DSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXIBL_3D_xRES, outputDir+"/"+userPrefix+"PIXIBL_3D_xRES."+oFext, "IBL 3D sensors", "Hits on track", "Local x residual [mm]", 0.16, 0.90, "#mum",
-          canvasText,makeOutput,0.64,0.89)
-    
-PIXIBL_Planar_xRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualx_PlanarSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXIBL_Planar_xRES, outputDir+"/"+userPrefix+"PIXIBL_Planar_xRES."+oFext, "IBL Planar sensors", "Hits on track", "Local x residual [mm]", 0.16, 0.90, "#mum",
-          canvasText,makeOutput,0.64,0.89)
-    
-# -- local y
-PIXIBL_3D_yRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualy_3DSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXIBL_3D_yRES, outputDir+"/"+userPrefix+"PIXIBL_3D_yRES."+oFext, "IBL 3D sensors", "Hits on track", "Local y residual [mm]", 0.16, 0.90, "#mum",
-          canvasText,makeOutput,0.64,0.89)
-
-PIXIBL_Planar_yRES = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"IBL_residualy_PlanarSensors","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXIBL_Planar_yRES, outputDir+"/"+userPrefix+"PIXIBL_Planar_yRES."+oFext, "IBL Planar sensors", "Hits on track", "Local y residual [mm]", 0.16, 0.90, "#mum",
-          canvasText,makeOutput,0.64,0.89)
-
-for stave in range(14): 
-    IBLStave = MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True, stave+1, stave+1) 
-    DrawPlots(IBLStave, outputDir+"/"+userPrefix+"IBL_xRESvsETA_stave"+str(stave+1)+"."+oFext, "IBL stave "+str(stave+1), "Average local x residual [mm]",
-              "ring along stave [#eta-index]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60, 0.88, False)
-
-    IBLStave = MakeModuleResPlotsFrom3D  (residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_xresvsmodetaphi_3d", 
-                                         "noFitWithStats", rootFiles, nFiles, True, stave+1)
-    DrawPlots(IBLStave, outputDir+"/"+userPrefix+"IBL_xRES_stave"+str(stave+1)+"."+oFext, "IBL stave "+str(stave), "Hits", "Local x residual [#mum]",
-              0.18, 0.88, "#mum", canvasText, makeOutput, 0.65, 0.89, True)
-
-    IBLStave = MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_yresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True, stave+1, stave+1) 
-    DrawPlots(IBLStave, outputDir+"/"+userPrefix+"IBL_yRESvsETA_stave"+str(stave+1)+"."+oFext, "IBL stave "+str(stave+1), "Average local y residual [mm]",
-              "ring along stave [#eta]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.65,0.89, False)
-
-    IBLStave = MakeModuleResPlotsFrom3D  (residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_yresvsmodetaphi_3d", 
-                                         "noFitWithStats", rootFiles, nFiles, True, stave+1)
-    DrawPlots(IBLStave, outputDir+"/"+userPrefix+"IBL_yRES_stave"+str(stave+1)+"."+oFext, "IBL stave "+str(stave+1), "Hits", "Local y residual [#mum]",
-              0.18, 0.88, "#mum", canvasText, makeOutput, 0.65, 0.89, True)
-
-# stave bending plot for upper staves
-IBLStave = MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True, 3, 6) 
-DrawPlots(IBLStave, outputDir+"/"+userPrefix+"IBL_xRESvsETA_stave_upper."+oFext, "Upper IBL staves", "Average local x residual [mm]",
-          "ring along stave [#eta]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.65,0.89, False)
-
-IBLStave = MakeProfPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, True, 11, 14) 
-DrawPlots(IBLStave, outputDir+"/"+userPrefix+"IBL_xRESvsETA_stave_lower."+oFext, "Lower IBL staves", "Average local x residual [mm]",
-          "ring along stave [#eta]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.65,0.89, False)
-
-IBL_xSagitta =  MakexResSagittaPlotsFrom3D(residualsDir,legendTitles,markerColors,markerStyles, "pix_b0_xresvsmodetaphi_3d", "noFit", rootFiles, nFiles, False)
-DrawPlots(IBL_xSagitta, outputDir+"/"+userPrefix+"IBL_xSagitta."+oFext, "IBL", "Local x residual Sagitta [#mum]",
-          "sector [#stave]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.60, 0.88, False)
-
-
-MAGH = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"mag_vs_LB","noFit",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(MAGH, outputDir+"/"+userPrefix+"MagnitudeVsLB."+oFext, "Distortion magnitude", "Magnitude [#mu m]", "LumiBlock", 0.15, 0.89, "#mum",canvasText,makeOutput,0.60, 0.88)
-
-if (userExtended):
-    IBLvsLB = MakePlots2D(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_resXvsetaLumiBlock",rootFiles,nFiles)
-    DrawPlots2D(IBLvsLB,outputDir+"/"+userPrefix,"IBL_resXvsetaLumiBlock."+oFext,"LumiBlock","Local X residual",0.18,0.88,"[mm]",canvasText,True)
-    
-    IBLvsLB_planars = MakePlots2D(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_resXvsetaLumiBlock_planars",rootFiles,nFiles)
-    DrawPlots2D(IBLvsLB,outputDir+"/"+userPrefix,"IBL_resXvsetaLumiBlock_planars."+oFext,"LumiBlock","Local X residual",0.18,0.88,"[mm]",canvasText,True)
-
-
-if (userExtended):
-    par = [-999,-999,-999,-999]
-    par2 = [-999,-999,-999,-999]
-
-    magVSLB  = TH1F("magvslb","magvslb",IBLvsLB_planars[0].GetXaxis().GetNbins(),IBLvsLB_planars[0].GetXaxis().GetXmin(),IBLvsLB_planars[0].GetXaxis().GetXmax())
-    baseVSLB = TH1F("basevslb","basevslb",IBLvsLB_planars[0].GetXaxis().GetNbins(),IBLvsLB_planars[0].GetXaxis().GetXmin(),IBLvsLB_planars[0].GetXaxis().GetXmax())
-    for ibin in range(1,IBLvsLB_planars[0].GetXaxis().GetNbins()+1):
-        proj=IBLvsLB_planars[0].ProjectionY("Projection_IBL_LB"+str(ibin)+"-"+str(ibin),ibin,ibin)
-        par = MakeStaveShapeFit(proj,True,True,True,outputDir+"/"+userPrefix+"Projection_IBL_LB"+str(ibin)+"-"+str(ibin)+"."+oFext)
-        magVSLB.SetBinContent(ibin, par[0]*1000)
-        magVSLB.SetBinError(ibin,par[1]*1000)
-        baseVSLB.SetBinContent(ibin,par[2]*1000)
-        baseVSLB.SetBinError(ibin,par[3]*1000)
-
-    magVSLB.GetYaxis().SetRangeUser(-10,10)
-    baseVSLB.GetYaxis().SetRangeUser(-10,10)
-
-    par2 = MakeMagnitudeLinearFit(magVSLB,False,True,False,outputDir+"/"+userPrefix+"LinearFitToMagnitude"+"."+oFext)
-    par2 = MakeMagnitudeLinearFit(magVSLB,False,True,True,outputDir+"/"+userPrefix+"ConstantFitToMagnitude"+"."+oFext)
-    simpleDrawSingleHist(magVSLB,"magnitude [#mum]","Luminosity Block","",canvasText,markerStyles[0],markerColors[0],outputDir+"/"+userPrefix+"magvslb_planars."+oFext)
-    simpleDrawSingleHist(baseVSLB,"baseline [#mum]","Luminosity Block","",canvasText,markerStyles[0],markerColors[0],outputDir+"/"+userPrefix+"basevslb_planars."+oFext)
-
-    
-
-    par = [-999,-999,-999,-999]
-    magVSLB  = TH1F("magvslb","magvslb",IBLvsLB[0].GetXaxis().GetNbins(),IBLvsLB[0].GetXaxis().GetXmin(),IBLvsLB[0].GetXaxis().GetXmax())
-    baseVSLB = TH1F("basevslb","basevslb",IBLvsLB[0].GetXaxis().GetNbins(),IBLvsLB[0].GetXaxis().GetXmin(),IBLvsLB[0].GetXaxis().GetXmax())
-    for ibin in range(1,IBLvsLB[0].GetXaxis().GetNbins()+1):
-        proj=IBLvsLB_planars[0].ProjectionY("Projection_IBL_LB"+str(ibin)+"-"+str(ibin),ibin,ibin)
-        par = MakeStaveShapeFit(proj,True,True,True,outputDir+"/"+userPrefix+"Projection_IBL_LB"+str(ibin)+"-"+str(ibin)+"."+oFext)
-        magVSLB.SetBinContent(ibin, par[0]*1000)
-        magVSLB.SetBinError(ibin,par[1]*1000)
-        baseVSLB.SetBinContent(ibin,par[2]*1000)
-        baseVSLB.SetBinError(ibin,par[3]*1000)
-
-    magVSLB.GetYaxis().SetRangeUser(-10,10)
-    baseVSLB.GetYaxis().SetRangeUser(-10,10)
-
-    par2 = MakeMagnitudeLinearFit(magVSLB,False,True,False,outputDir+"/"+userPrefix+"LinearFitToMagnitude"+"."+oFext)
-    par2 = MakeMagnitudeLinearFit(magVSLB,False,True,True,outputDir+"/"+userPrefix+"ConstantFitToMagnitude"+"."+oFext)
-    simpleDrawSingleHist(magVSLB,"magnitude [#mum]","Luminosity Block","",canvasText,markerStyles[0],markerColors[0],outputDir+"/"+userPrefix+"magvslb."+oFext)
-    simpleDrawSingleHist(baseVSLB,"baseline [#mum]","Luminosity Block","",canvasText,markerStyles[0],markerColors[0],outputDir+"/"+userPrefix+"basevslb."+oFext)
-
-print " -- MakeResidualIBL -- completed "
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualsPerModule.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualsPerModule.py
deleted file mode 100644
index 8e63bd90c0dfd1bf33f362e1fc36622f08ce8d8e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualsPerModule.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-doIBL = False
-doSCT = True
-
-if (doIBL):
-    # IBL 
-    IBLStave = []
-    nstaves = [5] # 14 
-    nrings = [5] # 20
-    outputDirIBL = outputDir + '/ModulesIBL'
-    if not os.path.isdir(outputDirIBL):
-        print " -- MakeResidualsPerModule -- Producing output in new directory:", outputDirIBL
-        os.mkdir(outputDirIBL)
-        
-    for stave in range(nstaves[0]):
-        for ring in range(nrings[0]):
-            logicalRing = ring-10
-            IBLStaveTemp = MakeModuleResPlotsFrom3D (residualsDir, legendTitles, markerColors, markerStyles, "pix_b0_xresvsmodetaphi_3d", "noFit", 
-                                                     rootFiles, nFiles, True, stave+1, logicalRing)
-            IBLStave.append(IBLStaveTemp)
-            #print " == IBLStave[stave=",stave," ring=",ring,"] = ",IBLStaveTemp 
-            #print " == IBLStave[stave=",stave," ring=",ring,"] = ",IBLStave[ring]
-            outputFileName =  outputDirIBL+"/"+"IBL_xRES_Module_stave"+str(stave)+"_ring"+str(logicalRing)+"."+oFext
-            outputFileName.replace(" ","_")    
-            outputFileName.replace("(","-")    
-            outputFileName.replace(")","-")    
-            DrawPlots(IBLStaveTemp, outputFileName, "IBL stave "+str(stave)+" ring "+str(logicalRing), 
-                      "Hits", "Local x residual [mm]", 0.17, 0.89, "#mum", canvasText, makeOutput, 0.62, 0.89, False)
-        DrawResPerStave(IBLStave,"IBL_xRESperModule_stave"+str(stave),outputDir+"/"+"IBL_xRESperModule_stave"+str(stave)+"."+oFext, nFiles)
-
-if (doSCT):
-    nlayers = 4#4
-    nsectors = [32, 40, 48, 56]# [32, 40, 48, 56]
-    nrings =  [12, 12, 12, 12]
-    firstRing = -6
-
-    outputDirSCT = outputDir + '/ModulesSCT'
-    if not os.path.isdir(outputDirSCT):
-        print " -- MakeResidualsPerModule -- Producing output in new directory:", outputDirSCT
-        os.mkdir(outputDirSCT)
-    #for layer in range(nlayers):
-    layer = 3
-    if (layer==3):
-         print " -- MakeResidualsPerModule -- SCT module residuals for layer === ", layer, ' === '
-         for sector in range(nsectors[layer]):
-             for ring in range(nrings[layer]):
-                 logicalRing = ring+firstRing
-                 if (logicalRing >= 0): logicalRing = logicalRing+1
-                 print " -- MakeResidualsPerModule -- SCT module: layer ", layer, ' sector:', sector, ' ring:', ring, "(logical ring:",logicalRing,")"
-                 targetHisto = "sct_b"+str(layer)+"_xresvsmodetaphi_3d"
-                 SCTModuleXRes = MakeModuleResPlotsFrom3D (residualsDir, legendTitles, markerColors, markerStyles, targetHisto, "noFitWithStats", 
-                                                           rootFiles, nFiles, True, sector+1, logicalRing)
-                 outputFileName =  outputDirSCT+"/"+"SCT_xRES_Module_layer"+str(layer)+"_sector"+str(sector)+"_ring"+str(logicalRing)+"."+oFext
-                 outputFileName.replace(" ","_")    
-                 outputFileName.replace("(","-")    
-                 outputFileName.replace(")","-")    
-                 print " -- MakeResidualsPerModule -- SCT module: output file -> ", outputFileName
-                 DrawPlots(SCTModuleXRes, outputFileName, "SCT L"+str(layer)+" sector "+str(sector)+" ring "+str(logicalRing), 
-                      "Hits", "Local x residual [mm]", 0.17, 0.89, "#mum", canvasText, makeOutput, 0.62, 0.89, False)
-    
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeStatisticsTable.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeStatisticsTable.py
deleted file mode 100644
index a579179415ce4979241cf180cb6f317e713cfe68..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeStatisticsTable.py
+++ /dev/null
@@ -1,29 +0,0 @@
-
-#
-nProcessedEvents = []
-nRecoTracks = []
-nAlignTracks = []
-nIBLHits = []
-
-# loop on all files and get entries from relevant histograms    
-for i in range(nFiles):
-    histoGram = GetHistogram(rootFiles[i],genericTracksDir[i],"LumiBlock",markerColors[i],markerStyles[i], i)
-    nProcessedEvents.append(histoGram.GetEntries()) 
-
-    histoGram = GetHistogram(rootFiles[i],genericTracksDir[i],"Nhits_per_track",markerColors[i],markerStyles[i], i)
-    nRecoTracks.append(histoGram.GetEntries()) 
-
-    histoGram = GetHistogram(rootFiles[i],genericTracksDir[i],"Nhits_per_track",markerColors[i],markerStyles[i], i)
-    nAlignTracks.append(histoGram.GetEntries())
-    
-    histoGram = GetHistogram(rootFiles[i],residualsDir[i],"pix_b0_residualx",markerColors[i],markerStyles[i], i)
-    nIBLHits.append(histoGram.GetEntries()) 
-    
-# print the results
-print ""
-
-for i in range(nFiles):
-    print " File ", i, legendTitles[i], 
-    print "    # Events: ", nProcessedEvents[i], "  # tracks: ", nRecoTracks[i], "  # AlignTracks: ", nAlignTracks[i],  "  # IBL hits: ", nIBLHits[i]
-    
-print ""
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeTrackParamsPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeTrackParamsPlots.py
deleted file mode 100644
index 44634c5b703360bcd681951cbce02c47697c8dc7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeTrackParamsPlots.py
+++ /dev/null
@@ -1,151 +0,0 @@
-# track parameters
-
-TrackD0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0, outputDir+"/"+"d0.png", "", "N Tracks",
-          "Impact Parameter [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-TrackD0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0_bscorr","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0, outputDir+"/"+"d0BS.png", "", "N Tracks", "Impact Parameter [mm]", 0.19, 0.9, "#mum", canvasText, makeOutput)
-
-#TrackD0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0_pvcorr","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-#DrawPlots(TrackD0, outputDir+"/"+"d0PV.png", "", "N Tracks",
-#          "Impact Parameter [mm]", 0.19, 0.9, "#mum",
-#          canvasText,makeOutput)
-
-#TrackZ0PV = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0_pvcorr","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-#DrawPlots(TrackZ0PV, outputDir+"/"+"z0PV.png", "", "N Tracks",
-#          "z0 w.r.t PV [mm]", 0.19, 0.9, "#mum",
-#          canvasText,makeOutput)
-
-
-TrackZ0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0, outputDir+"/"+"z0.png", "", "N Tracks",
-          "z0 [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-TrackPHI = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"phi","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPHI, outputDir+"/"+"phi.png", "", "N Tracks",
-          "phi [radians]", 0.19, 0.9, "radians",
-          canvasText,makeOutput)
-
-TrackETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"eta","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackETA, outputDir+"/"+"eta.png", "", "N Tracks",
-          "#eta", 0.19, 0.9, "",
-          canvasText,makeOutput)
-
-TrackETAAsym = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"eta_asym","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackETAAsym, outputDir+"/"+"eta_asym.png", "", "(pos-neg)/(pos+neg)",
-          "#eta", 0.19, 0.9, "",
-          canvasText,makeOutput)
-
-TrackPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT.png", "", "N Tracks", "q p_{T} [GeV]", 0.19, 0.9, "", canvasText,makeOutput,0.60,0.86,False)
-
-TrackPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT_nolog","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT_nolog.png", "", "N Tracks",
-          "q p_{T} [GeV]", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False)
-
-TrackPTqdiff = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT_diff","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPTqdiff, outputDir+"/"+"pTAqdiff.png", "Positive - Negative", "N Tracks", "p_{T} [GeV]", 0.19, 0.9, "", canvasText, makeOutput, 0.60,0.85,False)
-
-TrackPT_NQ = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT_n","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT_NQ, outputDir+"/"+"pT_negativeQ.png", "", "N Tracks",
-          "p_{T} negative charged tracks [GeV]", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False)
-
-TrackPT_PQ = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT_p","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT_PQ, outputDir+"/"+"pT_positiveQ.png", "", "N Tracks",
-          "p_{T} positive charged tracks [GeV]", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False)
-
-TrackSUMMARY = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"summary","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackSUMMARY, outputDir+"/"+"summary.png", "N Hits Summary", "N Tracks",
-          "", 0.19, 0.9, "",
-          canvasText,makeOutput)
-
-TrackCHI2DOF = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"chi2oDoF","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackCHI2DOF, outputDir+"/"+"chi2oDoF.png", "", "N Tracks",
-          "Chi2/DOF", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-errD0 = False
-if (userExtended and errD0):
-    ERRD0VSP = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"errD0VsP","noFit",rootFiles,nFiles,False)
-    DrawPlots(ERRD0VSP,outputDir+"/"+"D0ErrorVsP.png","","#sigma d_{0} [mm]", "p [GeV]",0.2,0.9,"#mum", canvasText,makeOutput, 0.60, 0.80, False);
-
-    ERRD0VSEta = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"errD0VsEta","noFit",rootFiles,nFiles,False)
-    DrawPlots(ERRD0VSEta,outputDir+"/"+"D0ErrorVsEta.png","","#sigma d_{0} [mm]", "#eta",0.2,0.9," ", canvasText,makeOutput, 0.60, 0.91, False);
-
-    ERRD0VSPhi = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"errD0VsPhi","noFit",rootFiles,nFiles,False)
-    DrawPlots(ERRD0VSPhi,outputDir+"/"+"D0ErrorVsPhi.png","","#sigma d_{0} [mm]", "#phi_{0} [rad]",0.2,0.9," ", canvasText,makeOutput, 0.60, 0.91, False);
-
-    ERRD0VSPhi = MakeProfPlots (genericTracksDir,legendTitles,markerColors,markerStyles,"errD0VsPhiBarrel","noFit",rootFiles,nFiles,False)
-    DrawPlots(ERRD0VSPhi,outputDir+"/"+"D0ErrorVsPhiBarrel.png","","#sigma d_{0} [mm]", "#phi_{0} [rad]",0.2,0.9," ", canvasText,makeOutput, 0.60, 0.91, False);
-
-TrackNTRACKS = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"ntracks","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNTRACKS, outputDir+"/"+"ntracks.png", "Tracks/Event", "N Events",
-          "N Tracks", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNTRTHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Ntrthits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNTRTHits, outputDir+"/"+"nTRTHits.png", "", "N Tracks",
-          "N TRT Hits", 0.17, 0.87, "",
-          canvasText,makeOutput)
-
-TrackNSCTHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHits, outputDir+"/"+"nSCTHits.png", "", "N Tracks",
-          "N SCT Hits", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsBarrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_barrel","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsBarrel, outputDir+"/"+"nSCTHitsBarrel.png", "", "N Tracks",
-          "N SCT Hits Barrel", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsEca = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_eca","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsEca, outputDir+"/"+"nSCTHitsEca.png", "", "N Tracks",
-          "N SCT Hits Eca", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsEcc = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_ecc","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsEcc, outputDir+"/"+"nSCTHitsEcc.png", "", "N Tracks",
-          "N SCT Hits Ecc", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHits, outputDir+"/"+"nPIXHits.png", "", "N Tracks",
-          "N PIX Hits", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHitsBarrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_barrel","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsBarrel, outputDir+"/"+"nPIXHitsBarrel.png", "", "N Tracks",
-          "N PIX Hits Barrel", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHitsEca = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_eca","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsEca, outputDir+"/"+"nPIXHitsEca.png", "", "N Tracks",
-          "N PIX Hits ECA", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-
-TrackNPIXHitsEcc = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_ecc","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsEcc, outputDir+"/"+"nPIXHitsEcc.png", "", "N Tracks",
-          "N PIX Hits ECC", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-NTracks = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"TracksPerLumiBlock","noFit",rootFiles,nFiles,False)
-DrawPlots(NTracks, outputDir+"/"+"NTracksPerLumiBlock.png", "", "N Tracks", "LumiBlock", 0.19, 0.9, "#mum", canvasText,makeOutput)
-
-NTracks = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"NPixPerLumiBlock","noFit",rootFiles,nFiles,False)
-DrawPlots(NTracks, outputDir+"/"+"NPixPerLumiBlock.png", "", "# pixel hits", "LumiBlock", 0.19, 0.9, "#mum", canvasText,makeOutput)
-
-NTracks = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"NSCTPerLumiBlock","noFit",rootFiles,nFiles,False)
-DrawPlots(NTracks, outputDir+"/"+"NSCTPerLumiBlock.png", "", "#SCT hits", "LumiBlock", 0.19, 0.9, "#mum", canvasText,makeOutput)
-
-NTracks = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"NTRTPerLumiBlock","noFit",rootFiles,nFiles,False)
-DrawPlots(NTracks, outputDir+"/"+"NTRTPerLumiBlock.png", "", "#TRT hits", "LumiBlock", 0.19, 0.9, "#mum", canvasText,makeOutput)
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeTrackSegmentsPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeTrackSegmentsPlots.py
deleted file mode 100644
index 79284587212e54502dbfc19a15a8c759230f6a97..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeTrackSegmentsPlots.py
+++ /dev/null
@@ -1,130 +0,0 @@
-# 
-# This script steers the option to produce the track-segment matching and properties plots
-#
-xLabels = 0.18
-yLabels = 0.88
-#
-DELTAD0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_d0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAD0,outputDir+"/"+"DELTAD0."+oFext,"#Delta(Up-Down) Tracks","Number of tracks",
-          "#Delta d_{0} [mm]",xLabels,yLabels,"#mum",
-          canvasText,makeOutput);
-
-DELTAPHI0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_phi0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAPHI0,outputDir+"/"+"DELTAPHI0."+oFext,"#Delta(Up-Down) Tracks","Number of tracks",
-          "#Delta #phi_{0} [rad]",xLabels,yLabels,"mrad",
-          canvasText,makeOutput);
-
-DELTAETA = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_eta0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAETA,outputDir+"/"+"DELTAETA."+oFext,"#Delta(Up-Down) Tracks","Number of tracks",
-          "#Delta #eta",xLabels,yLabels,"",
-          canvasText,makeOutput);
-
-DELTAQOPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_qOverPt","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAQOPT,outputDir+"/"+"DELTAQOPT."+oFext,"#Delta(Up-Down) Tracks","Number of tracks",
-          "#Delta q/p_{T}  [GeV^{-1}]",xLabels,yLabels,"TeV^{-1}",
-          canvasText,makeOutput);
-
-DELTAPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_pt","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAPT,outputDir+"/"+"DELTAPT."+oFext,"#Delta(Up-Down) Tracks","Number of tracks",
-          "#Delta p_{T}  [GeV]",xLabels,yLabels,"GeV",
-          canvasText,makeOutput);
-
-DELTAZ0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_z0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAZ0,outputDir+"/"+"DELTAZ0."+oFext,"#Delta(Up-Down) Tracks","Number of tracks"
-          ,"#Delta z_{0} [mm]",xLabels,yLabels,"#mum",
-          canvasText,makeOutput);
-
-DELTAQ = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_charge","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAQ,outputDir+"/"+"DELTAQ."+oFext,"#Delta(Up-Down) Tracks","Number of tracks"
-          ,"#Delta q",xLabels,yLabels,"#Delta q ",
-          canvasText,makeOutput);
-
-DELTANHITS = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_nHits","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTANHITS,outputDir+"/"+"DELTANHITS."+oFext,"#Delta(Up-Down) Tracks","Number of tracks"
-          ,"#Delta N_{hits}",xLabels,yLabels,"#Delta N_{hits} ",
-          canvasText,makeOutput);
-
-# profiles vs pt
-DELTAD0VSPT = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_d0VsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAD0VSPT,outputDir+"/"+"DELTAD0vsPT."+oFext,"#Delta(Up-Down) Tracks","#Delta d_{0} [mm]", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-DELTAZ0VSPT = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_z0VsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAZ0VSPT,outputDir+"/"+"DELTAZ0vsPT."+oFext,"#Delta(Up-Down) Tracks","#Delta z_{0} [mm]", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-DELTAPHIVSPT = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_phi0VsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAPHIVSPT,outputDir+"/"+"DELTAPHIvsPT."+oFext,"#Delta(Up-Down) Tracks","#Delta #phi_{0} [rad]", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-DELTAETAVSPT = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_eta0VsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAETAVSPT,outputDir+"/"+"DELTAETAvsPT."+oFext,"#Delta(Up-Down) Tracks","#Delta #eta", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.881, False);
-
-DELTAQOPTVSPT = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_qOverPtVsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAQOPTVSPT,outputDir+"/"+"DELTAQOPTvsPT."+oFext,"#Delta(Up-Down) Tracks","#Delta q/p_{T} [GeV^{-1}]", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-# profiles vs z0
-DELTAD0 = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_d0VsZ0","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAD0,outputDir+"/"+"DELTAD0vsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta d_{0} [mm]", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-DELTAZ0 = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_z0VsZ0","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAZ0,outputDir+"/"+"DELTAZ0vsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta z_{0} [mm]", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-DELTAPHI = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_phi0VsZ0","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAPHI,outputDir+"/"+"DELTAPHIvsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta #phi_{0} [rad]", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-DELTAETA = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_eta0VsZ0","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAETA,outputDir+"/"+"DELTAETAvsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta #eta", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.881, False);
-
-DELTAQOPT = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_qOverPtVsZ0","noFit",rootFiles,nFiles,True)
-DrawPlots(DELTAQOPT,outputDir+"/"+"DELTAQOPTvsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta q/p_{T} [GeV^{-1}]", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-# sigma vs pt (From TH2, using RMS)
-SIGMAD0VSPT = MakeProfSigmaPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_d0VsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(SIGMAD0VSPT,outputDir+"/"+"SIGMAD0vsPT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta d_{0} [mm]", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-SIGMAZ0VSPT = MakeProfSigmaPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_z0VsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(SIGMAZ0VSPT,outputDir+"/"+"SIGMAZ0vsPT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta z_{0} [mm]", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-SIGMAPHIVSPT = MakeProfSigmaPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_phi0VsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(SIGMAPHIVSPT,outputDir+"/"+"SIGMAPHIvsPT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta #phi_{0} [rad]", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-SIGMAETAVSPT = MakeProfSigmaPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_eta0VsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(SIGMAETAVSPT,outputDir+"/"+"SIGMAETAvsPT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta #eta", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-SIGMAQOPTVSPT = MakeProfSigmaPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_qOverPtVsPt","noFit",rootFiles,nFiles,True)
-DrawPlots(SIGMAQOPTVSPT,outputDir+"/"+"SIGMAQOPTvsPT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta q/p_{T} [GeV^{-1}]", "p_{T} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-
-#profiles vs z0
-if (userExtended):
-    DELTAD0VSZ0 = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_d0VsZ0","noFit",rootFiles,nFiles,True)
-    DrawPlots(DELTAD0VSZ0,outputDir+"/"+"DELTAD0vsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta d_{0} [mm]", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-    DELTAZ0VSZ0 = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_z0VsZ0","noFit",rootFiles,nFiles,True)
-    DrawPlots(DELTAZ0VSZ0,outputDir+"/"+"DELTAZ0vsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta z_{0} [mm]", "z_{0} [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-    DELTAPHIVSZ0 = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_phi0VsZ0","noFit",rootFiles,nFiles,True)
-    DrawPlots(DELTAPHIVSZ0,outputDir+"/"+"DELTAPHIvsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta #phi_{0} [rad]", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-    DELTAETAVSZ0 = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_eta0VsZ0","noFit",rootFiles,nFiles,True)
-    DrawPlots(DELTAETAVSZ0,outputDir+"/"+"DELTAETAvsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta #eta", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.881, False);
-    DELTAQOPTVSZ0 = MakeProfPlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_qOverPtVsZ0","noFit",rootFiles,nFiles,True)
-    DrawPlots(DELTAQOPTVSZ0,outputDir+"/"+"DELTAQOPTvsZ0."+oFext,"#Delta(Up-Down) Tracks","#Delta q/p_{T} [GeV^{-1}]", "z_{0} [mm]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-    
-
-# sigma vs pt (Reprocessed plots: This plots are only available if the collection has been reprocessed)
-#print "<MakeTrackSegmentsPlots> TrackSegmentCollection = ", TrackSegmentCollection
-#if (TrackSegmentCollection == "AlignTracks_NoTriggerSelection" and userExtended):
-if (userExtended):
-	SIGMAD0VSPT_FIT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"sigma_delta_d0VsPt","noFit",rootFiles,nFiles,True)
-	DrawPlots(SIGMAD0VSPT_FIT,outputDir+"/"+"SIGMAD0vsPT_FIT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta d_{0} [mm]", "p_{T}  [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-	SIGMAZ0VSPT_FIT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"sigma_delta_z0VsPt","noFit",rootFiles,nFiles,True)
-	DrawPlots(SIGMAZ0VSPT_FIT,outputDir+"/"+"SIGMAZ0vsPT_FIT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta z_{0} [mm]", "p_{T}  [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-	SIGMAPHIVSPT_FIT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"sigma_delta_phi0VsPt","noFit",rootFiles,nFiles,True)
-	DrawPlots(SIGMAPHIVSPT_FIT,outputDir+"/"+"SIGMAPHIvsPT_FIT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta #phi_{0} [rad]", "p_{T}  [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-	SIGMAETAVSPT_FIT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"sigma_delta_eta0VsPt","noFit",rootFiles,nFiles,True)
-	DrawPlots(SIGMAETAVSPT_FIT,outputDir+"/"+"SIGMAETAvsPT_FIT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta #eta", "p_{T}  [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-
-	SIGMAQOPTVSPT_FIT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"sigma_delta_qOverPtVsPt","noFit",rootFiles,nFiles,True)
-	DrawPlots(SIGMAQOPTVSPT_FIT,outputDir+"/"+"SIGMAQOPTvsPT_FIT."+oFext,"#Delta(Up-Down) Tracks","#sigma #Delta q/p_{T} [GeV^{-1}]", "p_{T}  [GeV]",xLabels,yLabels,"#mum", canvasText,makeOutput, 0.60, 0.88, False);
-print " -- MakeTrackSegmentsPlots -- completed "
-#exit()
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MultiDQHistogramMerge.sh b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MultiDQHistogramMerge.sh
deleted file mode 100644
index 17213e9d9b2178ae2b4133893bb72328fb7cf6b5..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MultiDQHistogramMerge.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-help() {
-
-echo "Thank you for asking for help, "
-echo "useage is:  ./MultiDQHistogramMerge.sh <dir>"
-}
-
-dir=$1
-
-# Test args
-if [ "$1" == "-h" ] || [ "$1" == '--help' ]
-then
-    help
-    exit 0
-fi
-
-if [ $# -lt 1 ]
-then
-    echo "Too few arguments.  Usage is:"
-    help
-    exit 1
-fi
-
-echo "merging .root files in directory ${dir}"
-echo "WARNING YOU SHOULD USE FULL PATH FOR THE DIRECTORY"
-
-cd $dir
-
-echo "making root file list in $dir"
-
-#making the list of files to be merged
-rm list.txt
-touch list.txt
-COUNTALL=0
-for name in `ls $dir | grep root | grep -v out | grep -v merged | grep -v list`
-do
-    echo $((++COUNTALL))
-    echo "write ${dir}/${name} into list"
-    echo "${dir}/${name}" >> list.txt
-done
-
-echo "made list file"
-DQHistogramMerge.py list.txt merged_monitoring-$COUNTALL.root True
-
-echo "finished merging"
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/PlotsForClustering.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/PlotsForClustering.py
deleted file mode 100644
index 05287a4644cec246e3c21c4bbc04a641248f54ae..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/PlotsForClustering.py
+++ /dev/null
@@ -1,437 +0,0 @@
-#!/usr/bin/env python
-# Author
-# John Alison johnda@hep.upenn.edu
-# Ben Cooper b.d.cooper@qmul.ac.uk
-# small adds Pierfrancesco Butti pbutti@nikhef.nl
-# this file also needs the utilities.py and AtlasStyle.py files
-
-# used to draw the alignment monitoring plots side-by-side of up to 3 monitoring.root files (number of files can be 1,2 or 3)
-# need to provide a configuration file - see makeMonitoringPlotsExampleConfigFile.py
-
-##--------------------------
-# usage:
-#
-# ./MakeAlignmentMonitoringPlots.py -c <configurationFile>
-#
-##--------------------------
-
-import sys,os
-from datetime import datetime
-from ROOT import *
-from utilities import *
-import AtlasStyle
-gStyle.SetOptStat(0)
-
-def optParsing():
-    from optparse import OptionParser
-    Now=datetime.now()
-    parser=OptionParser()
-    parser.add_option("--Tracks",dest="Tracks",help="Track Collection to use for plotting",default="ExtendedTracks_all")
-    parser.add_option("--inFiles",dest="inFiles",help="Comma separated list of files",default="")
-    parser.add_option("--outDir",dest="outDir",help="Output directory where to place the plots",default="Outputs"+Now.strftime('%Y_%m_%d_%H_%M_%S'))
-    #parser.add_option("--legendTitles",dest="legendTitles",help="Comma Separated list of titles to give to the plots",default="Default Legend")
-    #parser.add_option("--canvasText",dest="canvasText",help="Comma separated list of  canvas texts",default="#bf{#it{ATLAS}} Internal")
-    (config,sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-    return config
-
-
-config=optParsing()
-outputDir=config.outDir
-normaliseHistos = True
-rootFileNames=(config.inFiles).split(',')
-
-print rootFileNames
-
-if not os.path.exists(outputDir):
-    os.makedirs(outputDir)
-
-
-runN="run_242651"
-residualsDir=[runN+"/IDAlignMon/"+config.Tracks+"/Residuals/",
-              runN+"/IDAlignMon/"+config.Tracks+"/Residuals/",
-              runN+"/IDAlignMon/"+config.Tracks+"/Residuals/",
-              runN+"/IDAlignMon/"+config.Tracks+"/Residuals/"
-              ]
-
-trtResidualsDir=[
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/Residuals/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/Residuals/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/Residuals/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/Residuals/"
-    ]
-
-genericTracksDir = [
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/GenericTracks/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/GenericTracks/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/GenericTracks/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/GenericTracks/"
-    ]
-
-hitEffDir = [
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/HitEfficiencies/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/HitEfficiencies/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/HitEfficiencies/",
-    "/"+runN+"/IDAlignMon/"+config.Tracks+"/HitEfficiencies/"
-    ]
-
-
-markerStyles = [kFullCircle,kOpenCircle,kOpenSquare, kFullSquare] #determines marker styles for plots
-markerColors = [kBlue,kRed,kBlack,kBlack] #determines marker colors for plots
-#legendTitles = ["Nominal Geometry MC","Misaligned MC","Realigned MC",""] #determines legend titles
-legendTitles = ["BC_Error=False","Commissioning"]
-#legendTitles   = ["Rel19","Rel17"]
-canvasText = ["#bf{#it{ATLAS}} Internal","Cosmics","Reco_tf x277","19.1.3.7"]
-
-
-
-oFext=""
-nMAXFiles = len(rootFileNames)
-#some initialization
-configFileName = ""
-makeOutput = True
-unitArea = True
-
-#reading in the root file names from input arguments
-#for i in range(len(sys.argv)):
-#    if sys.argv[i]=="-c":
-#        configFileName = sys.argv[i+1]
-
-# reading in configuration file
-#fd = open(configFileName)
-#config = fd.readlines()
-#exec(''.join(config))
-
-
-print "Reading in from .root files:"
-for i in range(nMAXFiles) :
-    print rootFileNames[i]
-
-
-if makeOutput:
-    print "Producing output in directory:", outputDir
-
-#getting the TFile objects using the rootFileNames
-rootFiles = [TFile,TFile,TFile,TFile] 
-nFiles = 0
-for i in range(nMAXFiles):
-    if rootFileNames[i]!="": 
-        rootFiles[i] = TFile(rootFileNames[i])
-        rootFiles[i].GetListOfKeys()
-        nFiles = nFiles + 1
-
-#nFiles is used in the drawing of the plots
-print "nFiles = ",nFiles
-
-
-# Drawing and saving of the plots....
-# Plots are first "made" using MakePlots - that is, the plots are fetched from the input 
-# files and any fits that should be done are made. MakePlots returns a tuple object which 
-# contains the histogram and fit. MakePlots also performs normalisation if specified (see config options)
-# tuple is passed to DrawPlots where the plots are drawn on top of each other, with legend, axistitles etc
-# DrawPlots is also where the figure is saved 
-
-
-## # Basic Barrel Residual distributions
-
-PIXX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXX, outputDir+"/"+"PIXX.png"+oFext, "Pixel barrel", "Hits on tracks / 2#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-# Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXY, outputDir+"/"+"PIXY.png"+oFext, "Pixel barrel", "Hits on tracks / 10#mum",
-          "Local y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-# Basic Pull distributions
-
-PIXPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX, outputDir+"/"+"PIXPULLX.png", "Pixel Barrel", "Number of hits on tracks",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY, outputDir+"/"+"PIXPULLY.png", "Pixel Barrel", "Number of hits on tracks",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-PIXPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX0, outputDir+"/"+"PIXPULLX0.png", "Pixel Barrel IBL", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX1, outputDir+"/"+"PIXPULLX1.png", "Pixel Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX2, outputDir+"/"+"PIXPULLX2.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLX3, outputDir+"/"+"PIXPULLX3.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY0, outputDir+"/"+"PIXPULLY0.png", "Pixel Barrel IBL", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY1, outputDir+"/"+"PIXPULLY1.png", "Pixel Barrel L1", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY2, outputDir+"/"+"PIXPULLY2.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLY3, outputDir+"/"+"PIXPULLY3.png", "Pixel Barrel L2", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-PIXPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECA, outputDir+"/"+"PIXPULLXECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECAY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECAY, outputDir+"/"+"PIXPULLYECA.png", "Pixel Endcap A", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECC, outputDir+"/"+"PIXPULLXECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-PIXPULLECCY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ecc_pully","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXPULLECCY, outputDir+"/"+"PIXPULLYECC.png", "Pixel Endcap C", "Number of hits on tracks / 0.1",
-          "y pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-SCTX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTX, outputDir+"/"+"SCTX.png"+oFext, "SCT barrel", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-SCTPULLX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX, outputDir+"/"+"SCTPULLX.png", "SCT Barrel", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX0, outputDir+"/"+"SCTPULLX0.png", "SCT Barrel L0", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX1, outputDir+"/"+"SCTPULLX1.png", "SCT Barrel L1", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX2, outputDir+"/"+"SCTPULLX2.png", "SCT Barrel L2", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLX3, outputDir+"/"+"SCTPULLX3.png", "SCT Barrel L3", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECA = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECA, outputDir+"/"+"SCTPULLXECA.png", "SCT Endcap A", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-SCTPULLECC = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ecc_pullx","singleGaus",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTPULLECC, outputDir+"/"+"SCTPULLXECC.png", "SCT Endcap C", "Number of hits on tracks / 0.1",
-          "x pull", 0.2, 0.9, "",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-## ## Individual Barrel Layer Residual Distributions
-
-PIXX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX0, outputDir+"/"+"PIXX0.png"+oFext, "Pixel Barrel IBL", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX1, outputDir+"/"+"PIXX1.png"+oFext, "Pixel Barrel L0", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX2, outputDir+"/"+"PIXX2.png"+oFext, "Pixel Barrel L1", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXX3, outputDir+"/"+"PIXX3.png"+oFext, "Pixel Barrel L2", "Number of hits on tracks / 2#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY0, outputDir+"/"+"PIXY0.png"+oFext, "Pixel Barrel IBL", "Number of hits on tracks / 2#mum",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY1, outputDir+"/"+"PIXY1.png"+oFext, "Pixel Barrel L0", "Number of hits on tracks / 2#mum",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY2, outputDir+"/"+"PIXY2.png"+oFext, "Pixel Barrel L1", "Number of hits on tracks / 2#mum",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-PIXY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXY3, outputDir+"/"+"PIXY3.png"+oFext, "Pixel Barrel L2", "Number of hits on tracks / 2#mum",
-          "y residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX0, outputDir+"/"+"SCTX0.png"+oFext, "SCT Barrel L0", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX1, outputDir+"/"+"SCTX1.png"+oFext, "SCT Barrel L1", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX2, outputDir+"/"+"SCTX2.png"+oFext, "SCT Barrel L2", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-SCTX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(SCTX3, outputDir+"/"+"SCTX3.png"+oFext, "SCT Barrel L3", "Number of hits on tracks / 4#mum",
-          "x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## ## Basic Endcap Residual distributions
-
-## # draws combined ECA and ECC residual distribution
-PIXECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea)
-DrawPlots(PIXECX, outputDir+"/"+"PIXECX.png"+oFext, "Pixel end-caps", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-## # Priscilla, for approval plot like in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/CONFNOTES/ATLAS-CONF-2011-012/fig_14b.png
-PIXECY = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_ec_residualy","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(PIXECY, outputDir+"/"+"PIXECY.png"+oFext, "Pixel end-caps", "Hits on tracks / 20#mum",
-          "Local y residual [mm]", 0.18, 0.9, "#mum",canvasText,makeOutput,0.63,0.86)
-
-# draws combined ECA and ECC residual distribution
-SCTECX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_ec_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea)
-DrawPlots(SCTECX, outputDir+"/"+"SCTECX.png"+oFext, "SCT Endcap", "Hits on tracks / 4#mum",
-          "Local x residual [mm]", 0.21, 0.93, "#mum",canvasText,makeOutput,0.63,0.86)
-
-
-
-
-TrackD0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"d0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackD0, outputDir+"/"+"d0.png", "", "N Tracks",
-          "Impact Parameter [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-
-TrackZ0 = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"z0","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackZ0, outputDir+"/"+"z0.png", "", "N Tracks",
-          "z0 [mm]", 0.19, 0.9, "#mum",
-          canvasText,makeOutput)
-
-
-TrackPHI = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"phi","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPHI, outputDir+"/"+"phi.png", "", "N Tracks",
-          "phi [radians]", 0.19, 0.9, "radians",
-          canvasText,makeOutput)
-
-TrackETA = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"eta","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackETA, outputDir+"/"+"eta.png", "", "N Tracks",
-          "eta", 0.19, 0.9, "",
-          canvasText,makeOutput)
-
-TrackPT = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"pT","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT.png", "", "N Tracks",
-          "pT", 0.19, 0.9, "",
-          canvasText,makeOutput,0.60,0.91,False)
-
-
-TrackSUMMARY = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"summary","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackSUMMARY, outputDir+"/"+"summary.png", "N Hits Summary", "N Tracks",
-          "", 0.19, 0.9, "",
-          canvasText,makeOutput)
-
-TrackCHI2DOF = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"chi2oDoF","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackCHI2DOF, outputDir+"/"+"chi2oDoF.png", "", "N Tracks",
-          "Chi2/DOF", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNTRACKS = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"ntracks","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNTRACKS, outputDir+"/"+"ntracks.png", "Tracks/Event", "N Events",
-          "N Tracks", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNTRTHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Ntrthits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNTRTHits, outputDir+"/"+"nTRTHits.png", "", "N Tracks",
-          "N TRT Hits", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHits, outputDir+"/"+"nSCTHits.png", "", "N Tracks",
-          "N SCT Hits", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsBarrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_barrel","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsBarrel, outputDir+"/"+"nSCTHitsBarrel.png", "", "N Tracks",
-          "N SCT Hits Barrel", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsEca = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_eca","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsEca, outputDir+"/"+"nSCTHitsEca.png", "", "N Tracks",
-          "N SCT Hits Eca", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNSCTHitsEcc = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Nscthits_per_track_ecc","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNSCTHitsEcc, outputDir+"/"+"nSCTHitsEcc.png", "", "N Tracks",
-          "N SCT Hits Ecc", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHits = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHits, outputDir+"/"+"nPIXHits.png", "", "N Tracks",
-          "N PIX Hits", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHitsBarrel = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_barrel","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsBarrel, outputDir+"/"+"nPIXHitsBarrel.png", "", "N Tracks",
-          "N PIX Hits Barrel", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-TrackNPIXHitsEca = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_eca","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsEca, outputDir+"/"+"nPIXHitsEca.png", "", "N Tracks",
-          "N PIX Hits ECA", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-
-TrackNPIXHitsEcc = MakePlots(genericTracksDir,legendTitles,markerColors,markerStyles,"Npixhits_per_track_ecc","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackNPIXHitsEcc, outputDir+"/"+"nPIXHitsEcc.png", "", "N Tracks",
-          "N PIX Hits ECC", 0.69, 0.6, "",
-          canvasText,makeOutput)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-paletteType = 1
-for i in range(nFiles):
-    PIXBAR_HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "BAR")
-    DrawHitMaps(PIXBAR_HitMaps, outputDir+"/"+"PIXBAR_HitMaps_File_"+str(i+1)+"."+oFext, "Pixel barrel", "Hits on tracks",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91)
-
-    PIXECA_HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "ECA")
-    DrawHitMaps(PIXECA_HitMaps, outputDir+"/"+"PIXECA_HitMaps_File_"+str(i+1)+"."+oFext, "Pixel barrel", "Hits on tracks",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,"PIX","ECA")
-
-    PIXECC_HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "pixels", "ECC")
-    DrawHitMaps(PIXECC_HitMaps, outputDir+"/"+"PIXECC_HitMaps_File_"+str(i+1)+"."+oFext, "Pixel barrel", "Hits on tracks",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText,makeOutput,0.60,0.91,"PIX","ECC")
-
-    SCTBAR_HitMaps = MakeHitMaps(hitEffDir, legendTitles, rootFiles, i, "sct", "BAR")
-    DrawHitMaps(SCTBAR_HitMaps, outputDir+"/"+"SCTBAR_HitMaps_File_"+str(i+1)+"."+oFext, "SCT barrel", "Hits on tracks",
-          "Local x residual [mm]", 0.2, 0.9, "#mum",canvasText, makeOutput,0.60,0.91)
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/README-Rel17.txt b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/README-Rel17.txt
deleted file mode 100644
index 78eed560174627ace9d3bf0932bc14770043e30b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/README-Rel17.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-
-The config file for the Release 17 is confRel17.py
-
-For the plots to be approved use the following macro:
-./4approval_MakeAlignmentMonitoringPlots.py -c confRel17.py
-
-For all the other 
-./MakeMajorAlignMonPlots.py -c confRel17.py
-
-Old py job
-./MakeAlignmentMonitoringPlots.py -c makeMonitoringPlotsExampleConfigFile.py
\ No newline at end of file
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/confMC11Rel17.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/confMC11Rel17.py
deleted file mode 100644
index eaad9800cf89a58599b7731e75137cb2f5cbea87..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/confMC11Rel17.py
+++ /dev/null
@@ -1,156 +0,0 @@
-
-# specify the ROOT histogram files containing the monitoring plots here
-# Strings can be empty BUT MUST BE 3
-#rootFileNames = ["../run/MonMerge-05.root",
-#                 "../run/MonMerge-EoPCalib.root",
-#                 "../run/MonMerge-EoPCal_v2.root"
-#                 ]
-
-rootFileNames = [#"180636Rel17_v3-Merge.root",
-#                 "180636_JetTau-Merge.root",
-#                 "180636_JetTau_grl-Merge.root",
-                  "189822JetTau_NovRel17_weight-Merge.root",
-#  "j1mc-Merge.root",
-#                 "j4mc-Merge.root",
-#                 "j2mc-Merge.root",
-#                 "j0mc-Merge.root"
-#                 "j5mc-Merge.root",
-#                 "j7mc-Merge.root",
-#                 "j8mc-Merge.root"
-                 "j4mc_reweighted_normW-Merge.root",
-                 "189822JetTau_JulyRel17-Merge.root",
-                 ""
-                 ]
-
-# this sets the output directory where plot gifs will be saved
-
-
-normaliseHistos = True # set to true if you want to normalise to same area
-unitArea = True # set to true if you want to draw residual histos to unit area
-
-oFext="png" # output file extention without the dot
-use15GevSelection = True
-
-if not use15GevSelection :
-  outputDir = "../run/testResults"
-  #following array determines ROOT file directory from which Si residual plots are taken
-  #for each of the 3 files 
-  residualsDir = [
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/"#,
-    #    "/run_105001/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/"
-    ] 
-  #following array determines ROOT file directory from which TRT residual plots are taken
-  #for each of the 3 files 
-  trtResidualsDir = [
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/"
-    ] 
-  #following array determines ROOT file directory from which GenericTracks plots are taken
-  #for each of the 3 files 
-  genericTracksDir = [
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/"
-    ] 
-  #following array determines ROOT file directory from which HitEfficiency plots are taken
-  #for each of the 3 files 
-  hitEffDir = [
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/"
-    ] 
-  #following array determines ROOT file directory from which SivsTRT plots are taken
-  #for each of the 3 files 
-  siTRTDir = [
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/",
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/",
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/",
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/",
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/"#,
-    ] 
-
-  #following array determines ROOT file directory from which cosmic SplitTracks plots are taken
-  #for each of the 3 files 
-  splitTracksDir = [
-    "/IDAlignMon/ResolvedTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/ResolvedTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/ResolvedTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/ResolvedTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/ResolvedTracks_NoTriggerSelection/TrackSegments/"#,
-    ] 
-  canvasText = ["run 180636 ","Collisions '11 Alignment","",""] #specifies additional canvas text
-else: #  for 15 gev selection
-  outputDir = "../run/testResults15Gev"
-  #following array determines ROOT file directory from which Si residual plots are taken
-  #for each of the 3 files 
-  residualsDir = [
-#    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/"#,
-    ] 
-  #following array determines ROOT file directory from which TRT residual plots are taken
-  #for each of the 3 files 
-  trtResidualsDir = [
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/",
-#    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/Residuals/"
-    ] 
-  #following array determines ROOT file directory from which GenericTracks plots are taken
-  #for each of the 3 files 
-  genericTracksDir = [
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/GenericTracks/",
- #   "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/GenericTracks/"
-    ] 
-  #following array determines ROOT file directory from which HitEfficiency plots are taken
-  #for each of the 3 files 
-  hitEffDir = [
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/HitEfficiencies/",
-  #  "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_noTrigSel_15GeV/HitEfficiencies/"
-    ] 
-  #following array determines ROOT file directory from which SivsTRT plots are taken
-  #for each of the 3 files 
-  siTRTDir = [
-    "/IDAlignMon/SivsTRT/noTrigSel_15GeV/",
-   # "/IDAlignMon/SivsTRT/noTrigSel_15GeV/",
-    "/IDAlignMon/SivsTRT/noTrigSel_15GeV/",
-    "/IDAlignMon/SivsTRT/noTrigSel_15GeV/",
-    "/IDAlignMon/SivsTRT/noTrigSel_15GeV/"
-    ] 
-   
-  #following array determines ROOT file directory from which cosmic SplitTracks plots are taken
-  #for each of the 3 files 
-  splitTracksDir = [
-    "/IDAlignMon/ResolvedTracks_noTrigSel_15GeV/TrackSegments/",
-    "/IDAlignMon/ResolvedTracks_noTrigSel_15GeV/TrackSegments/",
-    "/IDAlignMon/ResolvedTracks_noTrigSel_15GeV/TrackSegments/",
- #   "/IDAlignMon/ResolvedTracks_noTrigSel_15GeV/TrackSegments/",
-    "/IDAlignMon/ResolvedTracks_noTrigSel_15GeV/TrackSegments/"#,
-    ]
-  canvasText = ["ATLAS Preliminary","#sqrt{s} = 7 TeV","Track pT > 15 GeV",""] #specifies additional canvas text
-   
-markerStyles = [kFullCircle,kOpenCircle,kOpenSquare,kOpenSquare] #determines marker styles for plots
-markerColors = [kBlue,kRed,kBlack, kViolet] #determines marker colors for plots
-legendTitles = [" Reprocessing 2011 Fall", "jet reweighted MC", "Reprocessing 2011 Summer", ""] #determines legend titles
-
-##----------------------------
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/confRel17.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/confRel17.py
deleted file mode 100644
index fed843ccbbf18465dd806250c8f4db8c22bdda5b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/confRel17.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# output type
-
-oFext="png" # output file extention without the dot
-outputDir = "../plots" # this sets the output directory where plot gifs will be saved
-
-# specify the ROOT histogram files containing the monitoring plots here
-# Strings can be empty BUT MUST BE 3
-#rootFileNames = ["../run/MonMerge-05.root",
-#                 "../run/MonMerge-EoPCalib.root",
-#                 "../run/MonMerge-EoPCal_v2.root"
-#                 ]
-
-rootFileNames = ["/afs/cern.ch/user/m/martis/Athena/release/19.1.3.7/run/monitoring.root", 
-                 "",
-                 ""]
-
-markerStyles = [kFullCircle,kOpenCircle,kFullSquare] #determines marker styles for plots
-markerColors = [kRed+2,kBlack,kBlack] #determines marker colors for plots
-legendTitles = ["Run 242651","legend 2", "legend 3"] #determines legend titles
-canvasText   = ["M6 cosmic rays","","",""] #specifies additional canvas text
-
-normaliseHistos = True # set to true if you want to normalise to same area
-unitArea = True # set to true if you want to draw residual histos to unit area
-
-#following array determines ROOT file directory from which Si residual plots are taken
-#for each of the input files 
-residualsDir = [
-    "/IDAlignMon/CombinedInDetTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/"
-    ] 
-
-#following array determines ROOT file directory from which TRT residual plots are taken
-#for each of the 3 files 
-trtResidualsDir = [
-    "/IDAlignMon/CombinedInDetTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/"
-    ] 
-#following array determines ROOT file directory from which GenericTracks plots are taken
-#for each of the 3 files 
-genericTracksDir = [
-    "/IDAlignMon/CombinedInDetTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/"
-    ] 
-#following array determines ROOT file directory from which HitEfficiency plots are taken
-#for each of the 3 files 
-hitEffDir = [
-    "/IDAlignMon/CombinedInDetTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/"
-    ] 
-#following array determines ROOT file directory from which SivsTRT plots are taken
-#for each of the 3 files 
-siTRTDir = [
-    "",
-    "",
-    ""
-    ] 
-
-#following array determines ROOT file directory from which cosmic SplitTracks plots are taken
-#for each of the 3 files 
-splitTracksDir = [
-    "/IDAlignMon/ResolvedSCTTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/Tracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/Tracks_NoTriggerSelection/TrackSegments/"#,
-    ] 
-
-##----------------------------
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/fittingFunctions.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/fittingFunctions.py
deleted file mode 100644
index 9d95e7810950cfe7de83b7da326805d9e1f92110..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/fittingFunctions.py
+++ /dev/null
@@ -1,184 +0,0 @@
-# Author:
-#  John Alison johnda@hep.upenn.edu
-
-from ROOT import TF1,TLatex,TCanvas
-writeOut = False
-
-def TRTResidualFit(hist,units,color,xLeft,yLow,same):
-    hist.SetAxisRange(-1,1)
-
-    # To get the fit range
-    fitRange = TF1("fitRange", "gaus", -0.3,0.3)
-    hist.Fit("fitRange", "ORQ","same")
-    min = -1.5*fitRange.GetParameter(2);
-    max = 1.5*fitRange.GetParameter(2);
-    
-    #print "Fitting from",min,"to",max
-
-    FZ01 = TF1("FZ01", "gaus", min,max)
-    FZ01.SetLineColor(color)
-    FZ01.SetLineWidth(1)
-    hist.Fit("FZ01", "ORQ","same")
-    
-    FZ01.Draw("same")
-    hist.Draw("same")
-    
-    # Draw the after mean and sigma
-    text = "#mu="
-    #text += str((1000*round(FZ01.GetParameter(1),5)))
-    text += str(int(1000*FZ01.GetParameter(1)))
-    text += " "+units+", #sigma="
-    #text += str((1000*round(FZ01.GetParameter(2),4)))
-    text += str(int(1000*FZ01.GetParameter(2)))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetTextSize(0.04)
-    m_l.SetLineColor(color)
-    m_l.SetTextColor(color)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.DrawLatex(xLeft,yLow,text)
-
-
-def singleGaus(hist,units,color,xLeft,yLow,same,title):
-    #print "InSingle gaus"
-
-    can = TCanvas(title,title)
-    can.cd()
-    hist.Draw()
-    
-    min = -0.5#hist.GetMinimum()
-    max = 0.5#hist.GetMaximum()
-    
-    print "Fitting from",min,"to",max
-    FZ01 = TF1("FZ01", "gaus", min,max)
-    FZ01.SetLineColor(color)
-    FZ01.SetLineWidth(1)
-    hist.Fit("FZ01", "ORQ","same")
-    
-    FZ01.Draw("same")
-    hist.Draw("same")
-    
-    # Draw the after mean and sigma
-    text = "#mu="
-    text += str(int(1000*FZ01.GetParameter(1)))
-    #text += str(round(FZ01.GetParameter(1),4))
-    text += " "+units+", #sigma="
-    text += str(int(1000*FZ01.GetParameter(2)))
-    #text += str(round(FZ01.GetParameter(2),4))
-    text += " "+units
-
-    m_l = TLatex()
-    m_l.SetTextSize(0.04)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.DrawLatex(xLeft,yLow,text)
-
-    if writeOut:
-        can.SaveAs(title+".png")
-
-    return m_l,can,FZ01,hist 
-
-def doubleGaus(hist,units,color,xLeft,yLow,same,fitInput,title):
-
-    can = TCanvas(title,title)
-    can.cd()
-    hist.Draw()
-
-    #min = hist.GetMean() - 1 * hist.GetRMS()
-    #max = hist.GetMean() + 1 * hist.GetRMS()
-    min = -0.5
-    max = 0.5
-    #print "Fitting from",min,"to",max
-    FZ01 = TF1("FZ01","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min,max)
-    FZ01.SetParameter(0,fitInput[0])
-    FZ01.SetParameter(1,fitInput[1])
-    FZ01.SetParameter(2,fitInput[2])
-    FZ01.SetParameter(3,fitInput[3])
-    FZ01.SetParameter(4,fitInput[4])
-    FZ01.SetParameter(5,fitInput[5])
-    
-    FZ01.SetLineColor(color)
-    FZ01.SetLineWidth(1)
-    hist.Fit("FZ01", "ORQ","same")
-
-    
-    FZ01.Draw("same")
-    hist.Draw("same")
-    
-    text = "#mu="
-    text += str(int(1000*FZ01.GetParameter(1)))
-    
-    print 1000*FZ01.GetParameter(1)
-    print 1000*FZ01.GetParameter(2)
-    print 1000*FZ01.GetParameter(4)
-    print 1000*FZ01.GetParameter(5)
-
-    #text += str(round(FZ01.GetParameter(1),4))
-    text += " "+units+", #sigma="
-    text += str(int(1000*FZ01.GetParameter(2)))
-    #text += str(round(FZ01.GetParameter(2),4))    
-    text += " "+units
-
-    m_l = TLatex()
-    m_l.SetTextSize(0.04)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.DrawLatex(xLeft,yLow,text)
-
-    if writeOut:
-        can.SaveAs(title+".png")
-    
-    return m_l,can,FZ01,hist 
-
-def doubleFit(hist,units,color,xLeft,yLow,same):
-    min_temp = hist.GetBinLowEdge(0)
-    max_temp = hist.GetBinLowEdge(hist.GetNbinsX())
-    fit_temp = TF1("fit_temp","gaus",min_temp,max_temp)
-    if same:
-        hist.Fit("fit_temp", "ORQ","same")
-    else:
-        hist.Fit("fit_temp", "ORQ","")
-    fitMean_temp = fit_temp.GetParameter(1)
-    fitSig_temp  = fit_temp.GetParameter(2)
-    min = fitMean_temp - 1.5* fitSig_temp
-    max = fitMean_temp + 1.5 * fitSig_temp
-    fit = TF1("fit","gaus",min,max )
-    fit.SetLineColor(color)
-    if same:
-        hist.Fit("fit", "ORQ","same")
-    else:
-        hist.Fit("fit", "ORQ","")
-    fit.Draw("same")
-
-    # Draw the after mean and sigma
-    text = "#mu="
-    text += str(round(fit.GetParameter(1),5))
-    text += " "+units+", #sigma="
-    text += str(round(fit.GetParameter(2),4))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetLineColor(color)
-    m_l.SetTextSize(0.03)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.SetTextColor(color)
-    print text
-    m_l.DrawLatex(xLeft,yLow,text)
-
-def quoteMeanAndRMS(hist,units,color,xLeft,yLow,same):
-    
-    # Draw the after mean and sigma
-    text = "mean = "
-    text += str(round(hist.GetMean(),5))
-    text += " "+units+", RMS = "
-    text += str(round(hist.GetRMS(),4))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetLineColor(color)
-    m_l.SetTextSize(0.03)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.SetTextColor(color)
-    #print text
-    m_l.DrawLatex(xLeft,yLow,text)
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeClusterPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeClusterPlots.py
deleted file mode 100644
index 47f01577b44897c40784f6ff8e68d6d29a939b8c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeClusterPlots.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# specify the ROOT histogram files containing the monitoring plots here that you want to compare
-# Anything from 1 file to 4 files can be specified
-#rootFileNames = ["/afs/cern.ch/user/p/pbutti/spacework/MultiMuonsMonitoring.root"]
-    
-rootFileNames = ["/afs/cern.ch/user/p/pbutti/spacework/IBLAlignDev_19/run_Analog/Zmumu_Rel19_Analog.root",
-                 "/afs/cern.ch/user/p/pbutti/spacework/IBLAlignDevV2/run_Analog/Zmumu_Rel19_Digital.root",
-                 ""
-                 ]
-# this sets the output directory where plot gifs will be saved.
-outputDir="Clustering_Rel19vsRel7_Digital"
-#outputDir="Comparison"
-normaliseHistos = True # set to true if you want to normalise to same area
-unitArea = False # set to true if you want to draw residual histos to unit area
-
-residualsDir = [
-    "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/"
-    ]
-
-trtResidualsDir =[
-    "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/"
-    ]
-genericTracksDir = [
-    "/IDAlignMon/ExtendedTracks_alignSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_alignSelection/GenericTracks/"
-    ]
-
-#for each of the (up to) 4 files
-markerStyles = [kFullCircle,kOpenCircle,kOpenSquare, kFullSquare] #determines marker styles for plots
-markerColors = [kBlue,kRed,kBlack,kBlack] #determines marker colors for plots
-#legendTitles = ["Nominal Geometry MC","Misaligned MC","Realigned MC",""] #determines legend titles
-#legendTitles = ["Analog","Digital"]
-legendTitles   = ["Rel19","Rel17"]
-canvasText = ["#bf{#it{ATLAS}} Internal","Digital Clustering","",""] #specifies additional canvas text
-##----------------------------
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeComparision.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeComparision.py
deleted file mode 100644
index 2d6ab388cdcdeb78cb6d7dacfe7817404d5c1ca7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeComparision.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  This file runs the comparision configured in CompareIDAlignemntMonitoring.py
-#
-# Author:
-#  John Alison <johnda@hep.upenn.edu>
-#===========================================================================
-
-from ROOT import *
-include("InDetAlignmentMonitoring/AtlasStyle.py")
-
-gStyle.SetOptFit(110)
-monitoredColor = kRed+1
-referenceColor = kBlack
-
-# read in the monitoring plots 
-if not os.access(afterAlignmentFile,os.F_OK):
-    print afterAlignmentFile,"does not exist!"
-    sys.exit(0)
-a_file = TFile(afterAlignmentFile)
-
-if not os.access(beforeAlignmentFile,os.F_OK):
-    print beforeAlignmentFile,"does not exist!"
-    sys.exit(0)
-b_file = TFile(beforeAlignmentFile)
-
-# Create the output file
-rootfile = TFile(outputFile, "RECREATE")
-
-include("InDetAlignmentMonitoring/CompareAll.py")
-rootfile.Close()
-sys.exit()
-
-
-# IGNORRE THE OLD STUFF BELOW
-#for i in trackSelections:
-#    thisDir = rootfile.mkdir(i.split('/')[1],i.split('/')[1])
-#    thisDir.mkdir("Barrel")
-#    thisDir.mkdir("EndcapA")
-#    thisDir.mkdir("EndcapC")
-#
-#for i in trackSegmentsTrackSelection:
-#    test = rootfile.cd(i.split('/')[1]) 
-#    if test:
-#        rootfile.cd()
-#    else:
-#        rootfile.mkdir(i.split('/')[1],i.split('/')[1])
-#
-## Load the drawing functions
-#include("InDetAlignmentMonitoring/rootArtist.py")
-#
-## Compare the residuals
-#include("InDetAlignmentMonitoring/CompareResiduals.py")
-#
-## Compare the Generic Track Parameters
-#include("InDetAlignmentMonitoring/CompareGenericTracks.py")
-#
-## Compare the Generic Track Parameters
-#include("InDetAlignmentMonitoring/CompareEfficiencies.py")
-#
-## Compare the Track Segments
-#if trackSegmentsTrackSelection.__len__() > 0:
-#    include("InDetAlignmentMonitoring/CompareTrackSegments.py")
-#
-## Exit
-#rootfile.Close()
-#sys.exit()
-#===============================
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeDirectories.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeDirectories.py
deleted file mode 100644
index 1ab9adaec4fe69fe8641be06c5d7ab3adaeb98cf..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeDirectories.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  File create the subdirectories in the output file
-#
-# Author:
-#  John Alison <johnda@hep.upenn.edu>
-#===========================================================================
-
-madeDirectories = False
-def makeDirectories(moduleNames,trackCollectionNames):
-    subSystemDirs = ["General","TRT","SCT","Pixel"]
-    becNames = ["Barrel","Endcap_A","Endcap_C","General"]
-    sideNames = ["Side_A","Side_C"]
-
-    for sub in subSystemDirs:
-        thisSubDir = rootfile.mkdir(sub)
-        if sub == "TRT":
-            for bec in becNames:
-                if bec == "Barrel":
-                    thisBecDir = thisSubDir.mkdir(bec)
-                    for track in trackCollectionNames:
-                        thisTrakDir = thisBecDir.mkdir(track)
-                        for mod in moduleNames:
-                            thisTrakDir.mkdir(mod)
-
-                    for side in sideNames:
-                        thisSideDir = thisBecDir.mkdir(side)
-                        for track in trackCollectionNames:
-                            thisTrakDir = thisSideDir.mkdir(track)
-                            for mod in moduleNames:
-                                thisTrakDir.mkdir(mod)
-                            
-                else:
-                    thisBecDir = thisSubDir.mkdir(bec)
-                    for track in trackCollectionNames:
-                        thisTrakDir = thisBecDir.mkdir(track)
-                        for mod in moduleNames:
-                            thisTrakDir.mkdir(mod)
-        else:
-            for track in trackCollectionNames:
-                thisTrakDir = thisSubDir.mkdir(track)
-                for mod in moduleNames:
-                    thisTrakDir.mkdir(mod)
-        rootfile.cd()
-                
-    return
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeMonitoringPlotsExampleConfigFile.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeMonitoringPlotsExampleConfigFile.py
deleted file mode 100644
index 620710aef9a346c2e8ad37671cefa7b0e562ba08..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeMonitoringPlotsExampleConfigFile.py
+++ /dev/null
@@ -1,68 +0,0 @@
-
-# specify the ROOT histogram files containing the monitoring plots here that you want to compare
-# Anything from 1 file to 4 files can be specified
-rootFileNames = ["FilesForNov2010ValidationPlots/user.bencooper.periodEMinBias.t0pro04_v01.minbiasGRL.15.6.9.8_B.merged_monitoring-387.root",
-                 "FilesForNov2010ValidationPlots/user.bencooper.periodEJetTauEtmiss.repro05_v02.jetetmissGRL.TriggerAware.merged_monitoring-455.root",
-                 "",
-                 ""
-                 ]
-
-# this sets the output directory where plot gifs will be saved
-outputDir = "AlignmentValidationResults"
-
-normaliseHistos = True # set to true if you want to normalise to same area
-unitArea = False # set to true if you want to draw residual histos to unit area
-
-#following array determines ROOT file directory from which Si residual plots are taken
-#for each of the (up to) 4 files 
-residualsDir = [
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/"
-                ] 
-#following array determines ROOT file directory from which TRT residual plots are taken
-#for each of the (up to) 4 files 
-trtResidualsDir = [
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals/"
-                ] 
-#following array determines ROOT file directory from which GenericTracks plots are taken
-#for each of the (up to) 4 files 
-genericTracksDir = [
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/GenericTracks/"
-                ] 
-#following array determines ROOT file directory from which HitEfficiency plots are taken
-#for each of the (up to) 4 files 
-hitEffDir = [
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/",
-    "/IDAlignMon/ExtendedTracks_NoTriggerSelection/HitEfficiencies/"
-                ] 
-#following array determines ROOT file directory from which SivsTRT plots are taken
-#for each of the (up to) 4 files 
-siTRTDir = [
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/",
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/",
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/",
-    "/IDAlignMon/SivsTRT/NoTriggerSelection/"
-                ] 
-
-#following array determines ROOT file directory from which cosmic SplitTracks plots are taken
-#for each of the (up to) 4 files 
-splitTracksDir = ["/IDAlignMon/Tracks_NoTriggerSelection/TrackSegments/",
-                  "/IDAlignMon/Tracks_NoTriggerSelection/TrackSegments/",
-                  "/IDAlignMon/Tracks_NoTriggerSelection/TrackSegments/",                  
-                  "/IDAlignMon/Tracks_NoTriggerSelection/TrackSegments/"] 
-
-markerStyles = [kFullCircle,kOpenCircle,kOpenSquare, kFullSquare] #determines marker styles for plots
-markerColors = [kBlue,kRed,kBlack,kBlack] #determines marker colors for plots
-legendTitles = ["Monitoring A","Monitoring B", "", ""] #determines legend titles
-canvasText = ["Data Runs","Collisions '10 Alignment","",""] #specifies additional canvas text
-##----------------------------
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/rootArtist.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/rootArtist.py
deleted file mode 100644
index dd3576bfb56e5fa2d882c7b0d887feda8c52c0fb..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/rootArtist.py
+++ /dev/null
@@ -1,220 +0,0 @@
-# Description:
-#  This file contains functions used for comparing to monitoring.root files 
-# Author:
-#  John Alison johnda@hep.upenn.edu
-
-include("InDetAlignmentMonitoring/fittingFunctions.py")
-
-SetStats = 0
-ScaleReference = False
-thirdFile = False
-thirdColor = 1
-t_hist = 0    
-
-def procProfile(profileName, path, min = 0, max = 0):
-    m_prof = b_file.Get(path+profileName)
-    if m_prof:
-        m_prof.SetMarkerStyle(20)
-        m_prof.SetMarkerColor(monitoredColor)
-        m_prof.SetLineColor(monitoredColor)
-        m_prof.GetXaxis().SetLabelSize(0.07)
-        m_prof.GetYaxis().SetLabelSize(0.07)
-        if min != 0 and max != 0:
-            m_prof.SetMinimum(min)
-            m_prof.SetMaximum(max)
-        m_prof.SetStats(SetStats)
-        m_prof.Draw()
-    else:
-        print path+profileName, "not found in",beforeAlignmentFile
-    
-    r_prof = a_file.Get(path+profileName)
-    if r_prof:
-        r_prof.SetMarkerStyle(20)
-        r_prof.SetMarkerColor(referenceColor)
-        r_prof.SetLineColor(referenceColor)
-        r_prof.SetStats(SetStats)
-        r_prof.Draw("sames")
-    else:
-        print path+profileName, "not found in",afterAlignmentFile
-
-    if thirdFile: 
-        t_prof = t_file.Get(path+profileName)
-        if t_prof:
-            t_prof.SetMarkerStyle(20)
-            t_prof.SetMarkerColor(thirdColor)
-            t_prof.SetLineColor(thirdColor)
-            t_prof.SetStats(SetStats)
-            t_prof.Draw("sames")
-        else:
-            print path+profileName, "not found."
-
-
-
-def procAllProfiles(profileNames, path, file, colors, title, min = 0, max = 0):
-    prof = []
-    for i in range(len(profileNames)):
-        prof.append(file.Get(path+profileNames[i]))
-        if prof[i]:
-            prof[i].SetMarkerStyle(20)
-            prof[i].SetMarkerColor(colors[i])
-            prof[i].SetLineColor(colors[i])
-            prof[i].SetLineWidth(2)
-            prof[i].GetXaxis().SetLabelSize(0.07)
-            prof[i].GetYaxis().SetLabelSize(0.07)
-            if min != 0 and max != 0:
-                prof[i].SetMinimum(min)
-                prof[i].SetMaximum(max)
-            prof[i].SetStats(SetStats)
-            if i==0:
-                prof[i].Draw()
-            else:
-                prof[i].Draw("sames")
-        else:
-            print path+profileNames[0], "not found."
-    
-
-def processAndFitHistogram(histName, path, units):
-    print "Called on " ,histName
-    r_hist = a_file.Get(path+histName)
-    m_hist = b_file.Get(path+histName)
-    if thirdFile: 
-        t_hist= t_file.Get(path+histName)
-    
-    if r_hist and m_hist:
-        if ScaleReference and r_hist.GetEntries():
-            r_hist.Scale(m_hist.GetEntries()/r_hist.GetEntries())
-        r_hist.SetMarkerColor(referenceColor)
-        r_hist.SetMarkerStyle(20)
-        r_hist.SetLineColor(referenceColor)
-        r_hist.Draw("")
-        #doubleFit(r_hist,units,referenceColor,0.2,0.88,0)
-    else:
-        print path+histName, "not found."
-
-
-    if m_hist:
-        m_hist.SetMarkerColor(monitoredColor)
-        m_hist.SetMarkerStyle(20)
-        m_hist.SetLineColor(monitoredColor)
-        m_hist.Draw("sames")
-        #doubleFit(m_hist,units,monitoredColor,0.2,0.78,1)
-    else:
-        print path+histName, "not found."
-
-    if thirdFile and t_hist:
-        t_hist.SetMarkerColor(thirdColor)
-        t_hist.SetMarkerStyle(20)
-        t_hist.SetLineColor(thirdColor)
-        t_hist.Draw("sames")
-        #doubleFit(m_hist,units,monitoredColor,0.2,0.78,1)
-    elif thirdFile:
-        print path+histName, "not found."
-
-
-
-def processAndFitTRTResiduals(histName, path, units="#mum"):
-    r_hist = a_file.Get(path+histName)
-    m_hist = b_file.Get(path+histName)
-    if thirdFile: 
-        t_hist= t_file.Get(path+histName)
-        
-    if r_hist and m_hist:
-        if ScaleReference:
-            r_hist.Scale(m_hist.GetEntries()/r_hist.GetEntries())
-        r_hist.SetMarkerColor(referenceColor)
-        r_hist.SetMarkerStyle(7)
-        r_hist.SetLineColor(referenceColor)
-        r_hist.Draw("")
-        TRTResidualFit(r_hist,units,referenceColor,0.2,0.88,0)
-    else:
-        print path+histName, "not found."
-
-    if m_hist:
-        m_hist.SetMarkerColor(monitoredColor)
-        m_hist.SetMarkerStyle(7)
-        m_hist.SetLineColor(monitoredColor)
-        m_hist.Draw("sames")
-        TRTResidualFit(m_hist,units,monitoredColor,0.2,0.83,1)
-    else:
-        print path+histName, "not found."
-
-    if thirdFile and t_hist:
-        t_hist.SetMarkerColor(thirdColor)
-        t_hist.SetMarkerStyle(7)
-        t_hist.SetLineColor(thirdColor)
-        t_hist.Draw("sames")
-        TRTResidualFit(t_hist,units,thirdColor,0.2,0.78,1)
-    elif thirdFile:
-        print path+histName, "not found."
-
-def processAndQuoteHistogram(histName, path, units):
-    r_hist = a_file.Get(path+histName)
-    if r_hist:
-        r_hist.SetMarkerColor(referenceColor)
-        r_hist.SetLineColor(referenceColor)
-        r_hist.Draw("")
-        quoteMeanAndRMS(r_hist,units,referenceColor,0.12,0.85,0)
-    else:
-        print path+histName, "not found in",afterAlignmentFile
-        
-    m_hist = b_file.Get(path+histName)
-    if m_hist:
-        m_hist.SetMarkerColor(monitoredColor)
-        m_hist.SetLineColor(monitoredColor)
-        m_hist.Draw("sames")
-        quoteMeanAndRMS(m_hist,units,monitoredColor,0.12,0.8,1)
-    else:
-        print path+histName, "not found in",beforeAlignmentFile
-    
-
-def procHistogram(histName, path, stats=0):
-    r_hist = a_file.Get(path+histName)
-    m_hist = b_file.Get(path+histName)
-    if thirdFile: 
-        t_hist= t_file.Get(path+histName)
-
-    if m_hist:
-        m_hist.SetMarkerStyle(20)
-        m_hist.SetMarkerColor(monitoredColor)
-        m_hist.SetLineColor(monitoredColor)
-        # m_hist.SetMaximum(0.2)
-        # m_hist.SetMinimum(-0.2)
-        m_hist.SetStats(stats)
-        m_hist.Draw()
-    else:
-        print path+histName, "not found in",beforeAlignmentFile
-    
-    if r_hist and m_hist:
-        if ScaleReference:
-            r_hist.Scale(m_hist.GetEntries()/r_hist.GetEntries())
-        r_hist.SetMarkerStyle(20)
-        r_hist.SetMarkerColor(referenceColor)
-        r_hist.SetLineColor(referenceColor)
-        r_hist.SetStats(stats)
-        r_hist.Draw("same")
-    else:
-        print path+histName, "not found in",afterAlignmentFile 
-
-    if thirdFile and t_hist:
-        t_hist.SetMarkerStyle(20)
-        t_hist.SetMarkerColor(thirdColor)
-        t_hist.SetLineColor(thirdColor)
-        t_hist.SetStats(stats)
-        t_hist.Draw("same")
-    elif thirdFile:
-        print path+histName, "not found."
-
-def procHitMap(histName,path, after):
-    hist = 0
-    if after:
-        hist = a_file.Get(path+histName)
-    else:
-        hist = b_file.Get(path+histName)
-    if hist:
-        hist.SetStats(0)
-        gStyle.SetPalette(1)
-        hist.Draw("colz")
-    else:
-        print path+histName, "not found."
-
-    
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/userConfig.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/userConfig.py
deleted file mode 100644
index 657b70214925d4a5b3109a65f90f87867960eb7e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/userConfig.py
+++ /dev/null
@@ -1,197 +0,0 @@
-#
-# userConfig.py
-#
-# in this file the user configures the input files, the directories from where the histograms are imported and the kind of output
-#
-doDebug = True
-
-print " <userConfig> -- START -- "
-print "           userPDF:", userPDF
-print "   userOuputFolder:", userOuputFolder
-
-outputDir = "../ZmumuTracks" # this sets the output directory where plot gifs will be saved
-if (userOuputFolder):
-    outputDir = userOuputFolder
-    if (doDebug): print " <userConfig> output folder set to: ", outputDir
-
-# output type
-oFext="png" # output file extention without the dot
-if (userPDF): oFext="pdf"
-
-####
-#canvasText   = ["Zmumu Selection", "Muon Tracks", "p_{T}>25 GeV",""] #specifies additional canvas text
-canvasText   = ["Data 2016 exp", "AlignTracks", "p_{T}>5 GeV (?)",""] #specifies additional canvas text
-if (len(userCanvasText)>=1):
-    canvasText = SetCanvasText(userCanvasText)
-
-####
-normaliseHistos = True # set to true if you want to normalise to same area
-unitArea = False # set to true if you want to draw residual histos to unit area
-
-    
-# specify the ROOT histogram files containing the monitoring plots here
-
-#SetNextInputFile("/Users/martis/scratch/Run301973_IDCosmics_Monitoring_PostTS1_2.root", "Reco with Post_TS1_June2016", kOpenSquare, kRed-7,"AlignTracks_all","run_301973")
-
-
-#SetNextInputFile("/afs/cern.ch/user/p/pbutti/spacework/public/Maps_v2/GRL_TotalMonitoring.root", "Data GRL",kOpenSquare, kRed+1,"SelectedMuonsRefit1_AlignTracks","")
-#SetNextInputFile("/afs/cern.ch/user/p/pbutti/spacework/public/Maps_v2/MC_TotalMonitoring_pp.root", "MC", kOpenSquare, kBlue-4,"SelectedMuonsRefit1_Tracks","")
-
-SetNextInputFile("/afs/cern.ch/user/m/mdanning/hias/public/13TeV/2016/20.7.6.2/fixd0Bias/L3/Iter2_L3/collisions/TotalMonitoring.root", "2016_fixd0Bias", kOpenSquare, kRed+1,"AlignTracks_all","run_multiple")
-
-
-#SetNextInputFile("/afs/cern.ch/user/p/pbutti/spacework/public/Maps_v2/NoGRL_TotalMonitoring.root", "Data noGRL",kOpenSquare, kGreen+4,"SelectedMuonsRefit1_AlignTracks","")
-#SetNextInputFile("/Users/martis/scratch/Run301973_IDCosmics_Monitoring.root", "Lower segment", kOpenSquare, kRed-4,"AlignTracks_Lower_all","run_301973")
-#SetNextInputFile("/afs/cern.ch/user/h/hoide/workdir/alignment/2016InitialAlign/20.7.5.7/run297041/Iter0pass1/collisions/TotalMonitoring.root", "297041 Iter0", kOpenSquare, kOrange+3,"AlignTracks_all","run_297041")
-
-
-# when arguments are passed from command line
-print " <userConfig> Number of input files = ", len(userInputFiles)
-if (len(userInputFiles)>0):
-    # clean current list
-    theInputFileList[:]= []
-    theMarkerList[:] = []
-    theColorList[:] = []
-    theLegendList[:] = []
-    thePrefix[:] = []
-    
-    # define parameters
-    basicTrackCollection = "AlignTracks_all"
-    if (len(userInputTrackCollection)>0): basicTrackCollection = userInputTrackCollection[0]
-
-    if (len(userInputFolder)==0):
-        print " ** ERROR ** no input folder given. Please provide an input folder ** "
-        exit()
-    else:
-        print " --> userInputFolder:", userInputFolder
-        basicInputFolder = userInputFolder[0]
-        
-    for i in range(len(userInputFiles)):
-        defaultLabel = "File_"+str(i+1)
-        defaultMarker = kOpenCircle
-        defaultColor = kGray+3
-        defaultTrackCollection = basicTrackCollection
-        defaultInputFolder = basicInputFolder
-        
-        thisLabel = defaultLabel
-        if (i+1<=len(userInputLabels)): thisLabel = userInputLabels[i]
-
-        thisMarker = defaultMarker
-        if (i+1<=len(userInputMarkers)): thisMarker = userInputMarkers[i]
-
-        thisTrackCollection = defaultTrackCollection 
-        if (i+1<=len(userInputTrackCollection)): thisTrackCollection = userInputTrackCollection[i]   
-
-        thisInputFolder = defaultInputFolder
-        if (i+1<=len(userInputFolder)): thisInputFolder = userInputFolder[i]   
-
-        thisColor = defaultColor
-        if (i+1<=len(userColors)): thisColor = userColors[i]   
-
-        if (True):    
-            print " file ", i, " --> ", userInputFiles[i]
-            print "         label  --> ", thisLabel
-            print "         marker --> ", thisMarker
-            print "         color  --> ", defaultColor
-            print "         trks   --> ", thisTrackCollection
-            print "         folder --> ", thisInputFolder
-        
-        SetNextInputFile(userInputFiles[i], thisLabel, thisMarker, thisColor, thisTrackCollection, thisInputFolder)
-
-
-#following array determines ROOT file folders. 
-# Silicon (IBL, PIX & SCT residuals)
-residualsDir = [
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/"
-    ] 
-
-# TRT residuals
-trtResidualsDir = [
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/",
-    "/IDAlignMon/AlignTracks_all/Residuals/"
-    ] 
-
-# Track parameters, hits, etc
-genericTracksDir = [
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    "/IDAlignMon/AlignTracks_all/GenericTracks/",
-    ] 
-
-# Hit efficiency 
-hitEffDir = [
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    "/IDAlignMon/AlignTracks_all/HitEfficiencies/",
-    ] 
-#following array determines ROOT file directory from which SivsTRT plots are taken
-#for each of the 3 files 
-siTRTDir = [
-    "",
-    "",
-    ""
-    ] 
-
-#following array determines ROOT file directory from which cosmic SplitTracks plots are taken
-splitTracksDir = [
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/",
-    "/IDAlignMon/AlignTracks_NoTriggerSelection/TrackSegments/"
-    ] 
-
-#
-# in case user give files in the new format (March-April 2015)
-#
-
-if len(theInputFileList)>0:
-    rootFileNames = []
-    markerStyles = []
-    markerColors = []
-    legendTitles = []
-    for i in range(len(theInputFileList)):
-        rootFileNames.append(theInputFileList[i])
-        markerStyles.append(theMarkerList[i])
-        markerColors.append(theColorList[i])
-        legendTitles.append(theLegendList[i])
-        if (len(theTrackCollectionList[i])>0):
-            residualsDir[i] = "/"+thePrefix[i]+"/IDAlignMon/"+ theTrackCollectionList[i] + "/Residuals/"
-            trtResidualsDir[i] = "/"+thePrefix[i]+"/IDAlignMon/"+ theTrackCollectionList[i] + "/Residuals/"
-            genericTracksDir[i] ="/"+thePrefix[i]+"/IDAlignMon/"+ theTrackCollectionList[i] + "/GenericTracks/"
-            hitEffDir[i] = "/"+thePrefix[i]+"/IDAlignMon/"+ theTrackCollectionList[i] + "/HitEfficiencies/"
-            splitTracksDir[i] = "/"+thePrefix[i]+splitTracksDir[i]
-            
-            
-##----------------------------
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities.py
deleted file mode 100644
index 80149d66321151e8a0bfa8f109dacfa8db757bdc..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities.py
+++ /dev/null
@@ -1,4471 +0,0 @@
-# Author:
-#  John Alison johnda@hep.upenn.edu
-#  Ben Cooper b.d.cooper@qmul.ac.uk
-
-
-import sys, math
-from array import array
-
-from ROOT import *
-import AtlasStyle 
-TGaxis.SetMaxDigits(4)
-
-# if this is true then legends are drawn in order of the input files
-# if it is false then legends are drawn in order of max histogram first
-# no need for this ever to be False really
-forceDrawOrder = True
-
-normaliserHisto = 0 #histogram which other hists are normalised to if normalisation is used. e.g. 0 is hist from first file
-statsMethod = 3 #how width is calculated if don't use fit. 0 = plain RMS, 1 = RMS(95%), 2 = RMS within range (sigmaIterativeGaus), 3 = FWHM/2.35
-interpolateFWHM = True # use linear interpolation in FWHM estimation
-sigmaIterativeGaus = 1.5 #controls sigma range used for iterative single Gaussian fit
-ZmumuVal = False #flag for ZmumuValidation particular things (axes range etc)
-pTmin = 0       #the minimum pT for ZmumuValidation
-pTmax = 100     #the maximum pT for ZmumuValidation
-MinEntriesPerModule = 5 #Min number of entries per module to compute the residual maps values
-
-theInputFileList = []
-theLegendList = []
-theMarkerList = []
-theColorList = []
-theTrackCollectionList = []
-thePrefix = []
-
-z_fix=366.5
-
-##########################################################################################################
-def DrawPlots(inputTuple, outputName, plotTitle, yAxisTitle, xAxisTitle, legendLeftX, legendUpperY, units, 
-              canvasText, makeOutput, textBoxLeftX=0.59, textBoxUpperY=0.87, dynamicYRange=True, plotCosmetics="Default"):
-
-    debug = False
-    if (debug): print " \n <DrawPlots> -- start -- drawing \n   inputTuple = ",inputTuple
-
-    # dynamicYRange=True means that the y-range of the histogram drawn first is adjusted so that 
-    # all the histograms will fit into this range. If False then the default y-range of the first histogram is used.
-
-    #print MakeMajorAlignMonPlots.userCosmetics
-    userCosmetics = "SmallLegend" # trying to pass a global variable... still I don't know how (Salva 20/May/2015)
-    if (len(userCosmetics)==0): 
-        plotCosmetics = "Default"
-    else:
-        plotCosmetics = userCosmetics
-    
-    if(plotCosmetics=="Default"):
-        legendMarkerSize = 1.5
-        legendTextSize = 0.04
-        legendMarkerSize = 1.25
-        legendYLineSpacing = 0.05 # determines how spaced out in y the legend entries are (may want to increase/decrease depending on legend text size)
-        legendYLineSpacing = 0.045 # determines how spaced out in y the legend entries are (may want to increase/decrease depending on legend text size)
-        legendMarkerYPosMod = [0.0,0.0,0.0,0.0] #for some reason the marker doesn't appear next to legend text in Y without some modification
-        meanWidthOnSeparateLine = True# if true mean and width are displayed in legend on separate lines, if false they are on the same line
-        showMean = True
-        plotTitleOnFirstLine = False # puts the plotTitle next to the first text on the plot e.g. ATLAS
-                                     #yAxisTitleOffset = 1.42 # NOT USED now handled by AtlasStyle
-        yAxisTitleOffset = 1.8
-        
-    if(plotCosmetics=="ApprovedPlots"):
-        legendTextSize = 0.05
-        legendMarkerSize = 1.7
-        legendYLineSpacing = 0.07 
-        legendMarkerYPosMod = [-0.004,-0.004,-0.004,-0.004]
-        meanWidthOnSeparateLine = False
-        showMean = False
-        plotTitleOnFirstLine = False 
-        yAxisTitleOffset = 1.55 # NOT USED now handled by AtlasStyle
-
-    if(plotCosmetics=="SmallLegend"):
-        legendTextSize = 0.025
-        legendMarkerSize = 1.5
-        legendYLineSpacing = 0.035
-        legendMarkerYPosMod = [-0.002,0.0,0.0,0.0]
-        meanWidthOnSeparateLine = False
-        showMean = True
-        plotTitleOnFirstLine = False
-        yAxisTitleOffset = 1.25 # NOT USED now handled by AtlasStyle
-
-    if(plotCosmetics=="SeparateLine"):
-        legendTextSize = 0.035
-        legendMarkerSize = 1.5
-        legendYLineSpacing = 0.05 # determines how spaced out in y the legend entries are (may want to increase/decrease depending on legend text size)
-        legendMarkerYPosMod = [0.0,0.0,0.0,0.0] #for some reason the marker doesn't appear next to legend text in Y without some modification
-        meanWidthOnSeparateLine = True # if true mean and width are displayed in legend on separate lines, if false they are on the same line
-        showMean = True
-        plotTitleOnFirstLine = False 
-        yAxisTitleOffset = 1.8 # NOT USED now handled by AtlasStyle
-
-    can = TCanvas(outputName,outputName,800,600)
-    can.cd()
-    if (debug): print " <DrawPlots> cosmetics set and canvas already open :)" 
-
-        
-    # determining the max and min histograms
-    maxYVal = -9999999.0
-    minYVal = 9999999.0
-    for i in range(len(inputTuple)):
-        
-        if i==1 or i==4 or i==7 or i==10:
-             #Fixing the Overflow problem. - Hack, can be done better 
-            inputTuple[i].SetBinContent(inputTuple[i].GetNbinsX()+1,inputTuple[i].GetBinContent(inputTuple[i].GetNbinsX()))
-            #Fixing the Underflow problem - Hack, can be done better 
-            inputTuple[i].SetBinContent(0,inputTuple[i].GetBinContent(1))
-            if inputTuple[i].GetMaximum() > maxYVal:
-                #maxYVal = inputTuple[i].GetMaximum()
-                maxYVal = inputTuple[i].GetBinContent(inputTuple[i].GetMaximumBin())
-            if inputTuple[i].GetMinimum() < minYVal:
-                #minYVal = inputTuple[i].GetMinimum()
-                minYVal = inputTuple[i].GetBinContent(inputTuple[i].GetMinimumBin())
-    #minYVal = 0.0 #overriding for now 
-    if (debug or True): print " <DrawPlots> maxYVal = ",maxYVal,", minYVal = ",minYVal
-
-    # drawing the first histogram
-    hist = inputTuple[1]
-    if (debug): print " <DrawPlots> going to draw ", hist, " ....." 
-    if hist.GetName()=="pT":
-        gPad.SetLogy()
-        #I was asked to set y linear 19/06/13
-        # gPad.SetLogy()
-        #I am trying to fix the X range for Pt plots. Please do it in a better way!! (PF 28/03/13)
-    if hist.GetName()=="pT_n":
-        gPad.SetLogy()
-    if hist.GetName()=="pT_p":
-        gPad.SetLogy()
-
-    histoTitle = hist.GetName()
-    #if histoTitle.find('pT')!=-1  and ZmumuVal:
-    #    hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-    #hist.GetXaxis().SetRangeUser(-0.4,0.4)
-    if dynamicYRange:
-        if hist.GetName()=="pix_b_residualy":
-            hist.GetYaxis().SetRangeUser(minYVal,maxYVal*1.33)
-        else:
-            thisMin = minYVal*0.7+0.01
-            thisMax = maxYVal*1.38
-            if (debug): print " <DrawPlots> DynamicRange = False --> user range from:",thisMin, " --> ", thisMax
-            #hist.GetYaxis().SetRangeUser(minYVal*1.10,maxYVal*1.10)
-            hist.GetYaxis().SetRangeUser(thisMin, thisMax)
-            
-            
-    hist.GetXaxis().SetTitle(xAxisTitle)
-    if hist.GetYaxis().GetTitle()!="Arbitrary units":
-        hist.GetYaxis().SetTitle(yAxisTitle)
-    #hist.GetYaxis().SetTitleOffset(yAxisTitleOffset) # now handled by ATLAS style
-    if "D0bsVsPhi0" in hist.GetName() or "D0bsVsEta" in hist.GetName():
-        hist.GetYaxis().SetLabelOffset(0.015)
-        hist.GetYaxis().SetLabelSize(0.045)
-    if "mean_" in hist.GetName():
-        hist.Draw("histo")
-    else:
-        if (debug): print " <DrawPlots> going to draw ",hist.GetName()
-        hist.Draw()
-
-    if (debug): print " <DrawPlots> drawn !!! "
-        
-    # drawing function associated with first histogram
-    tf1 = inputTuple[0]
-    if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-    if (debug): print " <DrawPlots> function drawn !!! "
-
-    # canvas text (right hand side)
-    latexAtlas = TLatex()
-    latexAtlas.SetNDC()
-    #latexAtlas.SetTextFont(72)
-    latexAtlas.SetTextColor(1)
-    latexAtlas2 = TLatex()
-    latexAtlas2.SetNDC()
-
-    if(plotTitleOnFirstLine):
-        latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0] + "  " + plotTitle)
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,canvasText[1])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[2])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[3])    
-    else:
-        latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,plotTitle)
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[1])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[2])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.24,canvasText[3])  
-        #latexAtlas3 = TLatex()
-        #latexAtlas3.SetNDC()
-        #latexAtlas3.SetTextSize(0.08)
-        #latexAtlas3.DrawLatex(textBoxLeftX,textBoxUpperY-0.40,canvasText[3])    
-
-    if (debug): print " <DrawPlots> first set of legends drawn !!! "
-
-    # drawing legend associated with first histogram
-    legendTitle = inputTuple[2]
-    m_l = TLatex()
-    m_l.SetTextSize(legendTextSize)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-    m_l2 = TLatex()
-    m_l2.SetTextSize(legendTextSize)
-    m_l2.SetTextAlign(12)
-    m_l2.SetNDC()
-    if (debug): print " <DrawPlots> calling to defineLegend hist:",hist
-    legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[0],legendMarkerSize)
-    m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-    if (debug): print " <DrawPlots> back from defineLegend "
-    if meanWidthOnSeparateLine==True:
-        m_width = TLatex()
-        m_width.SetTextSize(legendTextSize)
-        m_width.SetTextAlign(12)
-        m_width.SetNDC()
-        m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-    marker = legendTuple[0]
-    marker.Draw("same")
-    SetOwnership(marker, False)
-
-    if (debug): print " <DrawPlots> second set of legends drawn !!! "
- 
-    #determining how far offset in Y the next legend entry should be
-    legendYOffset = 2*legendYLineSpacing
-    if meanWidthOnSeparateLine==True:
-        legendYOffset = 3*legendYLineSpacing
-
-    ## uncomment to display fraction of histogram within sigma range
-    #m_l3 = TLatex()
-    #m_l3.SetTextSize(legendTextSize)
-    #m_l3.SetTextAlign(12)
-    #m_l3.SetNDC()
-    #m_l3.SetTextColor(hist.GetMarkerColor())
-    #text = "Frac. = " + str(round(findFractionWithinSigmaRange(hist,sigmaIterativeGaus),3)*100) + "%" 
-    #m_l3.DrawLatex(legendLeftX,legendUpperY-0.35,text)    
-
-    ## uncomment to display fit properties
-    #print "fit for ",hist.GetName()," ",legendTitle,": chi2/DOF = ",tf1.GetChisquare(),"/",tf1.GetNDF()," = ",tf1.GetChisquare()/tf1.GetNDF()
-    #m_l3 = TLatex()
-    #m_l3.SetTextSize(legendTextSize)
-    #m_l3.SetTextAlign(12)
-    #m_l3.SetNDC()
-    #m_l3.SetTextColor(hist.GetMarkerColor())
-    #text = "#chi^{2}/DOF = " + str(round(tf1.GetChisquare()/tf1.GetNDF(),2)) 
-    #m_l3.DrawLatex(legendLeftX,legendUpperY-0.35,text)
-
-    ## uncomment to draw core and tail functions on 
-    #coreFunc = TF1("coreFunc","gaus",-0.5,0.5)
-    #coreFunc.SetParameter(0,tf1.GetParameter(0))
-    #coreFunc.SetParameter(1,tf1.GetParameter(1))
-    #coreFunc.SetParameter(2,tf1.GetParameter(2))
-    #coreFunc.SetLineColor(hist.GetMarkerColor())
-    #coreFunc.SetLineStyle(2)
-    #coreFunc.Draw("same")
-    #integralCore = coreFunc.Integral(-0.5,0.5)
-    #print "integralCore = ",integralCore
-    #tailFunc = TF1("tailFunc","gaus",-0.5,0.5)
-    #tailFunc.SetParameter(0,tf1.GetParameter(3))
-    #tailFunc.SetParameter(1,tf1.GetParameter(4))
-    #tailFunc.SetParameter(2,tf1.GetParameter(5))
-    #tailFunc.SetLineColor(hist.GetMarkerColor())
-    #tailFunc.SetLineStyle(2)
-    #tailFunc.Draw("same")
-    #integralTail = tailFunc.Integral(-0.5,0.5)
-    #fracCore = integralCore/(integralCore+integralTail)
-    #print "integralTail = ",integralTail
-    #print "fracCore = " ,fracCore
-    #m_l4 = TLatex()
-    #m_l4.SetTextSize(legendTextSize)
-    #m_l4.SetTextAlign(12)
-    #m_l4.SetNDC()
-    #m_l4.SetTextColor(hist.GetMarkerColor())
-    #text = "Core Frac. = " + str(round(fracCore,2)) 
-    #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.35,text)
-
-    # drawing second histogram and its legend
-    if (len(inputTuple)) > 3:
-        hist = inputTuple[3+1]
-        histoTitle = hist.GetName()
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-           hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-        #hist.Draw("same,e")
-        tf1 = inputTuple[3+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[3+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[1],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker2 = legendTuple[0]
-        marker2.Draw("same")
-
-        ## uncomment to display fraction of histogram within sigma range
-        #m_l3.SetTextColor(hist.GetMarkerColor())
-        #text = "Frac. = " + str(round(findFractionWithinSigmaRange(hist,sigmaIterativeGaus),3)*100) + "%" 
-        #m_l3.DrawLatex(legendLeftX,legendUpperY-0.4,text)    
-
-        ## uncomment to display fit properties
-        #print "fit for ",hist.GetName()," ",legendTitle,": chi2/DOF = ",tf1.GetChisquare(),"/",tf1.GetNDF()," = ",tf1.GetChisquare()/tf1.GetNDF()
-        #m_l3.SetTextColor(hist.GetMarkerColor())
-        #text = "#chi^{2}/DOF = " + str(round(tf1.GetChisquare()/tf1.GetNDF(),2)) 
-        #m_l3.DrawLatex(legendLeftX,legendUpperY-0.4,text)
-
-        ## uncomment to print fraction of data covered by 1-sigma of fit (assumes mean of fit = 0.0)
-        #maxFitRange = tf1.GetParameter(1) + (tf1.GetParameter(2)*sigmaIterativeGaus)
-        #minFitRange = tf1.GetParameter(1) - (tf1.GetParameter(2)*sigmaIterativeGaus)
-        #maxFitBin = hist.FindBin(maxFitRange)
-        #minFitBin = hist.FindBin(minFitRange)
-        #intGral = hist.Integral(minFitBin,maxFitBin)
-        #fullIntGral = hist.Integral(1,hist.GetNbinsX())
-        #print "histo ",hist.GetName()," fraction covered by fit = ",intGral/fullIntGral
-        #m_l4.SetTextColor(hist.GetMarkerColor())
-        #text = "Fit Frac. = " + str(round(intGral/fullIntGral,2)) 
-        #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.4,text)
-
-        ### uncomment to draw core and tail functions on 
-        #coreFunc2 = TF1("coreFunc","gaus",-0.5,0.5)
-        #coreFunc2.SetParameter(0,tf1.GetParameter(0))
-        #coreFunc2.SetParameter(1,tf1.GetParameter(1))
-        #coreFunc2.SetParameter(2,tf1.GetParameter(2))
-        #coreFunc2.SetLineColor(hist.GetMarkerColor())
-        #coreFunc2.SetLineStyle(2)
-        ##coreFunc2.Draw("same")
-        #integralCore2 = coreFunc2.Integral(-0.5,0.5)
-        #print "integralCore = ",integralCore
-        #tailFunc2 = TF1("tailFunc","gaus",-0.5,0.5)
-        #tailFunc2.SetParameter(0,tf1.GetParameter(3))
-        #tailFunc2.SetParameter(1,tf1.GetParameter(4))
-        #tailFunc2.SetParameter(2,tf1.GetParameter(5))
-        #tailFunc2.SetLineColor(hist.GetMarkerColor())
-        #tailFunc2.SetLineStyle(2)
-        ##tailFunc2.Draw("same")
-        #integralTail2 = tailFunc2.Integral(-0.5,0.5)
-        #fracCore2 = integralCore2/(integralCore2+integralTail2)
-        #print "integralTail = ",integralTail2
-        #print "fracCore = " , fracCore2
-        #m_l4.SetTextColor(hist.GetMarkerColor())
-        #text = "Core Frac. = " + str(round(fracCore2,2)) 
-        #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.4,text)
-
-
-
-    # drawing third histogram and its legend
-    if (len(inputTuple)) > 6:
-        hist = inputTuple[6+1]
-        histoTitle = hist.GetName()
-        if histoTitle.find('pT')!=-1  and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-        #hist.Draw("same,e")
-        tf1 = inputTuple[6+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[6+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[2],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker3 = legendTuple[0]
-        marker3.Draw("same")
-
-    # drawing fourth histogram and its legend
-    if (len(inputTuple)) > 9:
-        hist = inputTuple[9+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[9+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[9+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker4 = legendTuple[0]
-        marker4.Draw("same")
-
-    # drawing fith histogram and its legend
-    if (len(inputTuple)) > 12:
-        hist = inputTuple[12+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[12+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[12+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker5 = legendTuple[0]
-        marker5.Draw("same")
-
-    # drawing sixth histogram and its legend
-    if (len(inputTuple)) > 15:
-        hist = inputTuple[15+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[12+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[15+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker6 = legendTuple[0]
-        marker6.Draw("same")
-
-    # drawing seventh histogram and its legend
-    if (len(inputTuple)) > 18:
-        hist = inputTuple[18+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[15+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[18+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker7 = legendTuple[0]
-        marker7.Draw("same")
-
-    # drawing eigth histogram and its legend
-    if (len(inputTuple)) > 21:
-        hist = inputTuple[21+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[18+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[21+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker8 = legendTuple[0]
-        marker8.Draw("same")
-
-    # drawing nineth histogram and its legend
-    if (len(inputTuple)) > 24:
-        hist = inputTuple[24+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[21+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[24+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker9 = legendTuple[0]
-        marker9.Draw("same")
-
-    if (debug): print " <DrawPlots> going to save file ... as ", outputName
-    print " <DrawPlots> going to save file ... as ", outputName
-
-    if makeOutput:
-        can.SaveAs(outputName)
-        print " <DrawPlots> file ", outputName, " succesfuly stored "
-
-    if (debug): print " <DrawPlots> -- completed -- "
-    return can    
-        
-##########################################################################################################
-def DrawEvolutionPlot(inputTuple, outputName, plotTitle, yAxisTitle, legendLeftX, legendUpperY, units, 
-              canvasText, makeOutput, textBoxLeftX=0.59, textBoxUpperY=0.87, dynamicYRange=True, plotCosmetics="Default"):
-    debug = False
-    if (debug): print " \n <DrawEvolutionPlots> -- start -- drawing \n   inputTuple = ",inputTuple
-
-    nPoints = len(inputTuple)/3 # for each file there are 3 entries in the Tuple
-    if (debug): print " \n <DrawEvolutionPlots> nPoints = ",nPoints
-
-    # capture the histograms    
-    histoGram = [TH1,TH1,TH1,TH1,TH1,TH1,TH1,TH1,TH1]
-    theLegend = []
-    for i in range(0,nPoints):
-        j = 1 + i*3
-        histoGram[i] = inputTuple[j]
-        theLegend.append(inputTuple[j+1])
-        print " capturing histo ", i, " at index ",j, "  histo -> ", histoGram[i].GetName(), "  legend: ",theLegend[i]
-        
-    #create the histogram to store the evolution. 
-    # one entry per file
-    evolutionHisto = TH1F("evolution_"+histoGram[0].GetName(), "Evolution of "+histoGram[0].GetTitle(), nPoints, -0.5, nPoints-0.5)                                 
-
-    # change the x-axis bin labels
-    for i in range(0,nPoints):
-      evolutionHisto.GetXaxis().SetBinLabel(i+1, str(theLegend[i]))
-
-    # Y axis title  
-    evolutionHisto.GetYaxis().SetTitle(yAxisTitle)
-        
-    theMaximum = 0.
-    # fill the evolution histogram 
-    for i in range(0,nPoints):
-        newval = histoGram[i].GetMean()
-        newerr = histoGram[i].GetRMS()/math.sqrt(histoGram[i].GetEntries())
-        thismax = abs(newval) + abs(newerr)
-        evolutionHisto.SetBinContent(i+1, newval) 
-        evolutionHisto.SetBinError(i+1, newerr) 
-        if (thismax >theMaximum): theMaximum = thismax
-
-    # rescale the maximum
-    theMaximum *= 1.10
-    
-    # symmetrize range
-    evolutionHisto.SetMaximum(theMaximum)
-    evolutionHisto.SetMinimum(-theMaximum)
-
-    # open the canvas
-    canvasName = "evolutionCanvas_"+outputName    
-    can = TCanvas(canvasName,outputName,800,600)
-    can.cd()
-    evolutionHisto.Draw()
-
-    if makeOutput:
-        can.SaveAs(outputName)
-        
-    if (debug): print " <DrawEvolutionPlot> -- completed -- "
-    return can
-###########################################################################################################################################
-def MakePlots2D(histogramDir,legendTitles,markerColors,markerStyles,histogramName,rootFiles,nFiles,profile=False):
-    debug = False
-    maxval = 0.0
-    max_hist = 0
-
-    histoGram = [TH2,TH2,TH2,TH2,TH2,TH2,TH2,TH2,TH2]
-    if profile:
-        histoGram = [TProfile2D,TProfile2D,TProfile2D,TProfile2D,TProfile2D,TProfile2D,TProfile2D,TProfile2D,TProfile2D]
-    Tuples = []
-    
-    for i in range(nFiles):
-        print "<MakePlots2D> === ", histogramName, "==="
-        histoGram[i] = GetHistogram(rootFiles[i],histogramDir[i],histogramName,markerColors[i],markerStyles[i], i)
-        Tuples.append(histoGram[i])
-        
-    return Tuples
-
-def DrawPlots2D(inputTuple, outputDir,outputName, xAxisTitle, yAxisTitle, legendLeftX, legendUpperY, units, 
-              canvasText, makeOutput,textBoxLeftX=0.59, textBoxUpperY=0.87, dynamicYRange=True, plotCosmetics="Default"):
-
-    debug = False
-
-    nHist = len(inputTuple)
-    
-    for i in range(nHist):
-        can = TCanvas("Canvas_"+str(i),"Canvas_"+str(i),1200,900)
-        gStyle.SetPadTopMargin(0.08)
-        gStyle.SetPadRightMargin(0.12)
-        gStyle.SetLabelOffset(0.015,"y")
-        gStyle.SetLabelSize(0.045,"x")
-        gStyle.SetLabelSize(0.045,"y")
-        Palette_EffiPlots = TExec("SetPalette_TrafficLights","gStyle->SetPalette(1)")
-        #if(paletteStyle != 1):
-        #    Palette_EffiPlots = TExec("Palette_TrafficLights",'TPython::Exec("preparePalette('+str(paletteStyle)+')")')
-    
-        myDrawOptions = "colz"
-        inputTuple[i].GetXaxis().SetTitle(xAxisTitle)
-        inputTuple[i].GetYaxis().SetTitle(yAxisTitle)
-        inputTuple[i].GetZaxis().SetRangeUser(-0.03,0.03)
-        inputTuple[i].Draw(myDrawOptions)
-        Palette_EffiPlots.Draw();
-        gPad.Update()
-        
-        if makeOutput:
-            can.SaveAs(outputDir+"File_"+str(i)+"_"+outputName)
-
-    return
-###########################
-def MakePlots(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles, normaliseHistos=False, unitArea=False):
-
-    debug = False
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = 0.0
-    max_hist = 0
-    
-    histoGram = [TH1,TH1,TH1,TH1,TH1,TH1,TH1,TH1,TH1]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple]
-
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-        print " <MakePlots> ===  ",histogramName,"  ==="
-        if (debug): 
-            print " <MakePlots> retriveing ",histogramName," from file i= ",i," --> ",rootFiles[i]
-            print " length of rootFiles array: ", len(rootFiles) ,"  rootFile[",i,"] =", rootFiles[i]
-            print " length of histogramDir array: ", len(histogramDir) 
-            print " length of histoGram array: ", len(histoGram)     
-            print " length of markerColors array: ", len(markerColors) ,"   color[",i,"] =", markerColors[i]
-            print " length of markerStyles array: ", len(markerStyles) ,"   style[",i,"] =", markerStyles[i]
-            print " histogramName: ", histogramName
-            print " GetHistogram(",rootFiles[i],",", histogramDir[i],")"
-        histoGram[i] = GetHistogram(rootFiles[i],histogramDir[i],histogramName,markerColors[i],markerStyles[i], i)
-        
-    for i in range(nFiles):
-        #normalise histograms to unit area if desired
-        if histoGram[i].Integral() > 0:
-            if unitArea:
-                #print "for hist ",i, " scaling" 
-                histoGram[i].Scale(1/histoGram[i].Integral())
-                histoGram[i].GetYaxis().SetTitle("Arbitrary units")
-            elif normaliseHistos:
-                histoGram[i].Scale(histoGram[normaliserHisto].Integral()/histoGram[i].Integral())
-
-        # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-        RemoveNegativeYAxis(histoGram[i],histogramName)
-
-        # find which histogram has largest y-value - this will be drawn first
-        if histoGram[i].GetMaximum() > maxval:
-            max_hist = i
-            maxval = histoGram[i].GetMaximum()
-
-        # perform the deired fit to the histogram
-        fit = MakeFit(histoGram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,histoGram[i],legendTitles[i])
-
-        
-
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-    if nFiles==5:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-    if nFiles==6:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-    if nFiles==7:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6]
-        elif max_hist==6:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-    if nFiles==8:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-    if nFiles==9:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[8] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-
-
-
-
-
-    if (debug): print "  <MakePlots> for ",histogramName, " **  COMPLETED  ** "
-    return totalTuple #returning histograms and fits
-
-###########################################################################################################################################        
-def MakeProfPlots(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles, symmetricRange=False):
-
-    
-    # this function takes as argument a TH2 and draws the mean profile or the rms profile 
-    debug = False
-    normaliseHistos = False # not normalization
-    unitArea = False # not unit area
-
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = 0.0
-    max_hist = 0
-    
-    histoGram = [TH2,TH2,TH2, TH2,TH2,TH2, TH2,TH2,TH2]
-    returnHistogram = [TH1, TH1, TH1, TH1, TH1, TH1, TH1, TH1, TH1]
-    myProfile = [TProfile,TProfile,TProfile,TProfile,TProfile,TProfile,TProfile,TProfile,TProfile]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple]
-
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-        print " <MakeProfPlots> ===  ",histogramName,"  ==="
-        if (debug): print " <MakeProfPlots> retriveing ",histogramName," from file ",i," --> ",rootFiles[i]
-        histoGram[i] = GetHistogram(rootFiles[i],histogramDir[i],histogramName,markerColors[i],markerStyles[i])
-
-        
-    for i in range(nFiles):
-        # make the profile
-        myProfile[i] = histoGram[i].ProfileX()
-
-        # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-        #RemoveNegativeYAxis(histoGram[i],histogramName)
-
-        # find which histogram has largest y-value - this will be drawn first
-        if myProfile[i].GetMaximum() > maxval:
-            maxval = myProfile[i].GetMaximum()
-        if myProfile[i].GetMinimum() < -maxval:
-            maxval = -myProfile[i].GetMinimum()
-        maxval = 1.10 * maxval
-
-        # buld the returned histograms
-        returnHistogram[i] = TH1F("new_"+histoGram[i].GetName(), histoGram[i].GetTitle(),                                  
-                           histoGram[i].GetNbinsX(), histoGram[i].GetXaxis().GetXmin(), histoGram[i].GetXaxis().GetXmax())
-        returnHistogram[i].SetMarkerStyle(markerStyles[i])
-        returnHistogram[i].SetMarkerColor(markerColors[i])
-        returnHistogram[i].SetLineColor(markerColors[i])
-
-        for bin in range(histoGram[i].GetNbinsX()):
-            returnHistogram[i].SetBinContent(bin+1, myProfile[i].GetBinContent(bin+1))
-            returnHistogram[i].SetBinError(bin+1, myProfile[i].GetBinError(bin+1))
-        
-        # perform the deired fit to the histogram
-        fit = MakeFit(returnHistogram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,returnHistogram[i],legendTitles[i])
-
-    #unify range
-    if (debug): print " <MakeProfPlots> maxval = ",maxval
-    for i in range(nFiles):
-        if (symmetricRange): 
-            returnHistogram[i].GetYaxis().SetRangeUser(-maxval,maxval)
-        else:
-            returnHistogram[i].GetYaxis().SetRangeUser(0,maxval)
-        
-
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-    if nFiles==5:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-    if nFiles==6:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-    if nFiles==7:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6]
-        elif max_hist==6:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-    if nFiles==8:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-    if nFiles==9:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[8] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-
-
-
-    if (debug): print "  <MakeProfPlots> for ",histogramName, " **  COMPLETED  ** "
-    return totalTuple #returning histograms and fits
-
-###########################################################################################################################################   
-
-###########################################################################################################################################        
-def MakeProfSigmaPlots(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles, symmetricRange=False):
-
-    # this function takes as argument a TH2 and draws the mean profile or the rms profile 
-    debug = False
-    normaliseHistos = False # not normalization
-    unitArea = False # not unit area
-
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = 0.0
-    max_hist = 0
-    
-    histoGram = [TH2,TH2,TH2,TH2,TH2, TH2]
-    returnHistogram = [TH1, TH1, TH1, TH1, TH1, TH1]
-    myProfile = [TProfile,TProfile,TProfile,TProfile,TProfile, TProfile]
-    #myProject = [TH1, TH1, TH1, TH1, TH1, TH1]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple]
-
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-        print " <MakeProfSigmaPlots> ===  ",histogramName,"  ==="
-        if (debug): print " <MakeProfSigmaPlots> retriveing ",histogramName," from file ",i," --> ",rootFiles[i]
-        histoGram[i] = GetHistogram(rootFiles[i],histogramDir[i],histogramName,markerColors[i],markerStyles[i])
-        
-    for i in range(nFiles):
-        # make the profile
-        myProfile[i] = histoGram[i].ProfileX()
-
-        # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-        #RemoveNegativeYAxis(histoGram[i],histogramName)
-
-        # find which histogram has largest y-value - this will be drawn first
-        if myProfile[i].GetMaximum() > maxval:
-            maxval = myProfile[i].GetMaximum()
-        if myProfile[i].GetMinimum() < -maxval:
-            maxval = -myProfile[i].GetMinimum()
-        maxval = 1.10 * maxval
-
-        # buld the returned histograms
-        returnHistogram[i] = TH1F("new_"+histoGram[i].GetName(), histoGram[i].GetTitle(),                                  
-                           histoGram[i].GetNbinsX(), histoGram[i].GetXaxis().GetXmin(), histoGram[i].GetXaxis().GetXmax())
-        returnHistogram[i].SetMarkerStyle(markerStyles[i])
-        returnHistogram[i].SetMarkerColor(markerColors[i])
-        returnHistogram[i].SetLineColor(markerColors[i])
-
-        for bin in range(histoGram[i].GetNbinsX()):
-            #returnHistogram[i].SetBinContent(bin+1, myProfile[i].GetBinContent(bin+1))
-            #returnHistogram[i].SetBinError(bin+1, myProfile[i].GetBinError(bin+1))
-            returnHistogram[i].SetBinContent(bin+1, histoGram[i].ProjectionY("_py",bin+1,bin+1).GetRMS())
-            returnHistogram[i].SetBinError(bin+1, histoGram[i].ProjectionY("_py",bin+1,bin+1).GetRMSError())
-        
-        # perform the deired fit to the histogram
-        fit = MakeFit(returnHistogram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,returnHistogram[i],legendTitles[i])
-
-    '''#unify range
-    if (debug): print " <MakeProfSigmaPlots> maxval = ",maxval
-    for i in range(nFiles):
-        if (symmetricRange): 
-            returnHistogram[i].GetYaxis().SetRangeUser(-maxval,maxval)
-        else:
-            returnHistogram[i].GetYaxis().SetRangeUser(0,maxval)'''
-        
-
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-    if nFiles==5:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-    if nFiles==6:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-
-
-
-
-    if (debug): print "  <MakeProfSigmaPlots> for ",histogramName, " **  COMPLETED  ** "
-    return totalTuple #returning histograms and fits
-
-###########################################################################################################################################   
-     
-def MakePlotsFrom3D(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles,  symmetricRange=False, binRangeLower=-1, binRangeUpper=-1):
-
-    # this function takes as argument a TH3 and obtains the profile in one of its axis. 
-    debug = False
-    normaliseHistos = True # not normalization
-    unitArea = False # not unit area
-
-    # in case we limit the range of bins
-    rangeLimit = False
-    if (binRangeLower > 0): rangeLimit = True
-    if (binRangeUpper >0 and binRangeUpper >= binRangeLower): rangeLimit = True     
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = 0.0
-    max_hist = 0
-    
-    histoGram = [TH3,TH3,TH3,TH3,TH3,TH3]
-    returnHistogram = [TH1, TH1, TH1, TH1, TH1,TH1]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple]
-    
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-        print " <MakeProfPlotsFrom3D> ===  ",histogramName,"  ==="
-        if (debug): print " <MakeProfPlotsFrom3D> retriveing ",histogramName," from file ",i," --> ",rootFiles[i]
-        histoGram[i] =GetHistogram3D(rootFiles[i],histogramDir[i],histogramName)
-
-
-    for i in range(nFiles):
-        # make the profile
-        if (rangeLimit): histoGram[i].GetYaxis().SetRange(binRangeLower,binRangeUpper);
-        hname = "residuals_" + str(i)    
-        returnHistogram[i] = histoGram[i].ProjectionZ(hname, 4, 10, binRangeLower, binRangeUpper)            
-            
-        # find which histogram has largest y-value - this will be drawn first
-        if returnHistogram[i].GetMaximum() > maxval:
-            maxval = returnHistogram[i].GetMaximum()
-            max_hist = i
-        if returnHistogram[i].GetMinimum() < -maxval:
-            maxval = -returnHistogram[i].GetMinimum()
-            max_hist = i
-        maxval = 1.05 * maxval
-
-        # build the returned histograms
-        returnHistogram[i].SetMarkerStyle(markerStyles[i])
-        returnHistogram[i].SetMarkerColor(markerColors[i])
-        returnHistogram[i].SetLineColor(markerColors[i])
-
-        # perform the desired fit to the histogram
-        fit = MakeFit(returnHistogram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,returnHistogram[i],legendTitles[i])
-
-    #unify range
-    if (debug): print " <MakePlotsFrom3D> maxval = ",maxval
-    for i in range(nFiles):
-        if (symmetricRange): 
-            if (debug): print " <MakePlotsFrom3D> symmetric range with maxval = ",maxval
-            returnHistogram[i].GetYaxis().SetRangeUser(-maxval,maxval)
-            #returnHistogram[i].GetYaxis().SetRangeUser(-maxval/4,maxval)
-        else:
-            if (debug): print " <MakePlotsFrom3D> range from 0 --> maxval = ",maxval
-            returnHistogram[i].GetYaxis().SetRangeUser(0,maxval)
-        if (normaliseHistos):
-            returnHistogram[i].Scale(returnHistogram[normaliserHisto].Integral()/returnHistogram[i].Integral())            
-
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-
-    if nFiles==5:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-    if nFiles==6:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-
-
-
-    if (debug): print "  <MakeProfPlots> for ",histogramName, " **  COMPLETED  ** "
-    return totalTuple #returning histograms and fits
-
-###########################################################################################################################################        
-def MakeProfPlotsFrom3D(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles,  symmetricRange=False, binRangeLower=-1, binRangeUpper=-1):
-
-    # this function takes as argument a TH3 and obtains the profile in one of its axis. 
-    debug = False
-    normaliseHistos = False # not normalization
-    unitArea = False # not unit area
-
-    # make sure the styles are integers
-    markerStyle = []
-    for marker in markerStyles:
-        markerStyle.append(int(marker))
-    markerColor = []
-    for marker in markerColors:
-        markerColor.append(int(marker))
-    
-    # in case we limit the range of bins
-    rangeLimit = False
-    if (binRangeLower > 0): rangeLimit = True
-    if (binRangeUpper >0 and binRangeUpper >= binRangeLower): rangeLimit = True     
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = 0.0
-    max_hist = 0
-    
-    histoGram = [TH3,TH3,TH3,TH3,TH3,TH3, TH3,TH3,TH3]
-    returnHistogram = [TH1, TH1, TH1, TH1, TH1,TH1, TH1, TH1, TH1]
-    myProfile = [TH2D,TH2D,TH2D,TH2D,TH2D,TH2D, TH2D, TH2D, TH2D]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple, tuple, tuple, tuple]
-    tempProf = [TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F]
-    
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-        print " <MakeProfPlotsFrom3D> ===  ",histogramName,"  ==="
-        if (debug): print " <MakeProfPlotsFrom3D> retriveing ",histogramName," from file ",i," --> ",rootFiles[i]
-        histoGram[i] =GetHistogram3D(rootFiles[i],histogramDir[i],histogramName)
-        thisName = "IBLStavesSagitta_File_"+str(i)
-        tempProf[i] = TH1F(thisName,"IBL staves residuals",histoGram[i].GetXaxis().GetNbins(),histoGram[i].GetXaxis().GetXmin(),histoGram[i].GetXaxis().GetXmin());
-
-
-    SubtractFirstHistoTest = False
-
-    
-    for i in range(nFiles):
-        # make the profile
-        if (rangeLimit): histoGram[i].GetYaxis().SetRange(binRangeLower,binRangeUpper);
-        myProfile[i] = histoGram[i].Project3D("ZX")
-        #now project ring by ring
-        for ring in range(myProfile[i].GetNbinsX()):
-            residualsdist = myProfile[i].ProjectionY("res_by_ring",ring+1,ring+1)
-            if (debug): print ">> ring ",ring, " mean = ", residualsdist.GetMean(), "+-", residualsdist.GetMeanError()
-            tempProf[i].SetBinContent(ring+1, residualsdist.GetMean())
-            tempProf[i].SetBinError(ring+1, residualsdist.GetMeanError())
-            
-        if (SubtractFirstHistoTest and i==0):
-            #copy thishisto as reference
-            RefHisto = tempProf[i].Clone()
-        if (SubtractFirstHistoTest):
-            tempProf[i].Add(RefHisto,-1)
-            tempProf[i].Fit("pol0")
-
-            
-        # find which histogram has largest y-value - this will be drawn first
-        if tempProf[i].GetMaximum() > maxval:
-            maxval = tempProf[i].GetMaximum()
-        if tempProf[i].GetMinimum() < -maxval:
-            maxval = -tempProf[i].GetMinimum()
-        maxval = 1.20 * maxval
-        maxval = 0.020
-        if (SubtractFirstHistoTest): maxval = 0.020
-        #if (maxval < 0.45): maxval = 0.450
-        #if (maxval < 0.10): maxval = 0.100
-
-        # build the returned histograms
-        returnHistogram[i] = TH1F("new_"+histoGram[i].GetName(), histoGram[i].GetTitle(),                                  
-                           histoGram[i].GetNbinsX(), histoGram[i].GetXaxis().GetXmin(), histoGram[i].GetXaxis().GetXmax())
-        returnHistogram[i].SetMarkerStyle(markerStyle[i])
-        returnHistogram[i].SetMarkerColor(markerColor[i])
-        returnHistogram[i].SetLineColor(markerColor[i])
-
-        for bin in range(histoGram[i].GetNbinsX()):
-            returnHistogram[i].SetBinContent(bin+1, tempProf[i].GetBinContent(bin+1))
-            returnHistogram[i].SetBinError(bin+1, tempProf[i].GetBinError(bin+1))
-            if (debug): print ">> ring_2 ",bin," mean = ", tempProf[i].GetBinContent(bin+1), "+-",tempProf[i].GetBinError(bin+1)
-        
-        # perform the deired fit to the histogram
-        fit = MakeFit(returnHistogram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,returnHistogram[i],legendTitles[i])
-
-    #unify range
-    if (debug): print " <MakeProfPlotsFrom3D> maxval = ",maxval
-    for i in range(nFiles):
-        if (symmetricRange): 
-            if (debug): print " <MakeProfPlotsFrom3D> symmetric range with maxval = ",maxval
-            returnHistogram[i].GetYaxis().SetRangeUser(-maxval,maxval)
-            #returnHistogram[i].GetYaxis().SetRangeUser(-maxval/4,maxval)
-        else:
-            if (debug): print " <MakeProfPlotsFrom3D> range from 0 --> maxval = ",maxval
-            returnHistogram[i].GetYaxis().SetRangeUser(0,maxval)
-            
-
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-
-    if nFiles==5:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-    if nFiles==6:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-    if nFiles==7:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6]
-        elif max_hist==6:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-    if nFiles==8:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-    if nFiles==9:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[8] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-
-
-    if (debug): print "  <MakeProfPlots> for ",histogramName, " **  COMPLETED  ** "
-    return totalTuple #returning histograms and fits
-
-###########################################################################################################################################        
-def MakexResSagittaPlotsFrom3D(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles,  symmetricRange=False, binRangeLower=-1, binRangeUpper=-1):
-
-    # this function takes as argument a TH3 and obtains the profile in one of its axis. 
-    debug = False
-    normaliseHistos = False # not normalization
-    unitArea = False # not unit area
-
-    # make sure the styles are integers
-    markerStyle = []
-    for marker in markerStyles:
-        markerStyle.append(int(marker))
-    markerColor = []
-    for marker in markerColors:
-        markerColor.append(int(marker))
-    
-
-    # in case we limit the range of bins
-    rangeLimit = False
-    if (binRangeLower > 0): rangeLimit = True
-    if (binRangeUpper >0 and binRangeUpper >= binRangeLower): rangeLimit = True     
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = 0.0
-    minval = 0.0
-    max_hist = 0
-    
-    histoGram = [TH3,TH3,TH3,TH3,TH3,TH3, TH3, TH3, TH3]
-    returnHistogram = [TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F]
-    myProfile = [TH2, TH2, TH2, TH2, TH2, TH2, TH2, TH2, TH2]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple]
-    tempProf = [TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F, TH1F]
-    
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-        print " <MakexResSagittaPlotsFrom3D> ===  ",histogramName,"  ==="
-        if (debug): print " <MakexResSagittaPlotsFrom3D> retriveing ",histogramName," from file ",i," --> ",rootFiles[i]
-        histoGram[i] =GetHistogram3D(rootFiles[i],histogramDir[i],histogramName)
-        thisName = "IBLStavesSagitta_File_"+str(i)
-        tempProf[i] = TH1F(thisName,"IBL Staves sagitta",histoGram[i].GetYaxis().GetNbins()+2,histoGram[i].GetYaxis().GetXmin(),histoGram[i].GetYaxis().GetXmin()+2);
-                 
-        # adding two extra bins. One will be leaved blank. The second filled with the 
-        
-    for i in range(nFiles):
-        for stave in range(16):
-            if (debug): print " ---- stave --- ", stave
-            lowerbin = stave+1
-            upperbin = stave+1
-            if (stave == 14): continue; #leave blank bin
-            if (stave == 15): #last point corresponds to the entire detector
-                lowerbin = 0
-                upperbin = 0
-                # make the profile
-            #if (rangeLimit): histoGram[i].GetYaxis().SetRange(binRangeLower,binRangeUpper);
-            histoGram[i].GetYaxis().SetRange(lowerbin,upperbin)
-            myProfile[i] = histoGram[i].Project3D("ZX")
-        
-            # profile with the middle bins:
-            #print " myProfile[i] Nxbins = ",myProfile[i].GetNbinsX()
-            myProfile[i].GetXaxis().SetRangeUser(-1.5,0.5)
-            middleProf = myProfile[i].ProjectionY("middle_r",9,10)
-            middlepointValue = middleProf.GetMean()
-            middlepointError = middleProf.GetMeanError()
-            if (debug): print " middlepoint=", middlepointValue, "+-", middlepointError
-            
-            edgeProf1 =  myProfile[i].ProjectionY("edge_r1",1,2)
-            edgepointValue = edgeProf1.GetMean()
-            edgepointError = edgeProf1.GetMeanError()
-            if (debug): print " edgepoint=", edgepointValue, "+-", edgepointError
-            
-            edgeProf2 =  myProfile[i].ProjectionY("edge_r2",19,20)
-            edgepointValue = edgeProf2.GetMean()
-            edgepointError = edgeProf2.GetMeanError()
-            if (debug): print " edgepoint=", edgepointValue, "+-", edgepointError
-            
-            edgeProf1.Add(edgeProf2);
-            edgepointValue = edgeProf1.GetMean()
-            edgepointError = edgeProf1.GetMeanError()
-            if (debug): print " edgepoint=", edgepointValue, "+-", edgepointError
-
-            sagittaValue =  middlepointValue -  edgepointValue;
-            sagittaError = math.sqrt(middlepointError*middlepointError + edgepointError*edgepointError)
-            if (debug or stave == 15): print " >> sagitta= [ File",i,",",legendTitles[i],"] =", sagittaValue, "+-", sagittaError
-
-            tempProf[i].SetBinContent(stave+1,1000*sagittaValue); # values in microns
-            tempProf[i].SetBinError(stave+1,1000*sagittaError);
-            # end of loop on staves
-            
-            # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-            #RemoveNegativeYAxis(histoGram[i],histogramName)
-
-        # find which histogram has largest y-value - this will be drawn first
-        if tempProf[i].GetMaximum() > maxval:
-            maxval = 1.05 * tempProf[i].GetMaximum()
-            if tempProf[i].GetMinimum() < -maxval:
-                maxval = -tempProf[i].GetMinimum()
-                maxval = 1.05 * maxval
-
-        minbin = tempProf[i].GetMinimumBin()
-        minWithErr = tempProf[i].GetBinContent(minbin) - tempProf[i].GetBinError(minbin)/2        
-        if minWithErr < minval:
-            minval = minWithErr
-
-        #if (maxval < 0.45): maxval = 0.450
-        #if (maxval < 0.10): maxval = 0.100
-
-        # buld the returned histograms
-        returnHistogram[i] = TH1F("new_"+histoGram[i].GetName()+"_"+str(i), histoGram[i].GetTitle(),                                  
-                           tempProf[i].GetNbinsX(), tempProf[i].GetXaxis().GetXmin(), tempProf[i].GetXaxis().GetXmax())
-        returnHistogram[i].SetMarkerStyle(markerStyle[i])
-        returnHistogram[i].SetMarkerColor(markerColor[i])
-        returnHistogram[i].SetLineColor(markerColor[i])
-        
-        for bin in range(tempProf[i].GetNbinsX()):
-            if (bin == 14): continue
-            returnHistogram[i].SetBinContent(bin+1, tempProf[i].GetBinContent(bin+1))
-            returnHistogram[i].SetBinError(bin+1, tempProf[i].GetBinError(bin+1))
-            if (bin<histoGram[i].GetNbinsY()):
-                returnHistogram[i].GetXaxis().SetBinLabel(bin+1, str(bin))
-            if (bin == histoGram[i].GetNbinsY()+1):
-                returnHistogram[i].GetXaxis().SetBinLabel(bin+1, "IBL")
-        
-        # perform the deired fit to the histogram
-        fit = MakeFit(returnHistogram[i],fitType, markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,returnHistogram[i],legendTitles[i])
-
-    #unify range
-    if (debug): print " <MakeProfPlotsFrom3D> maxval = ",maxval
-    for i in range(nFiles):
-        if (symmetricRange): 
-            if (debug): print " <MakeProfPlotsFrom3D> symmetric range with maxval = ",maxval
-            returnHistogram[i].GetYaxis().SetRangeUser(-maxval,maxval)
-        else:
-            if (debug): print " <MakeProfPlotsFrom3D> range from minval=",mival," --> maxval= ",maxval
-            returnHistogram[i].GetYaxis().SetRangeUser(minval,maxval)
-        
-
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-
-    if nFiles==5:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-    if nFiles==6:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-    if nFiles==7:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6]
-        elif max_hist==6:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-    if nFiles==8:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-    if nFiles==9:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[8] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-
-
-    if (debug): print "  <MakeProfPlots> for ",histogramName, " **  COMPLETED  ** "
-    return totalTuple #returning histograms and fits
-
-###########################################################################################################################################        
-def MakeModuleResPlotsFrom3D(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles,  normaliseHistos=False, sector=0, ring=-50):
-
-    # this function takes as argument a TH3 and obtains the profile in one of its axis. 
-    debug = False
-    #normaliseHistos = True # not normalization
-    unitArea = False # not unit area
-    doStave = False
-    #if ring = -50 --> entire stave
-    if (ring == -50): doStave = True
-    if (True and doStave): print " <MakeModuleResPlotsFrom3D> === Draw the entire stave", sector
-
-    # make sure the styles are integers
-    markerStyle = []
-    for marker in markerStyles:
-        markerStyle.append(int(marker))
-    markerColor = []
-    for marker in markerColors:
-        markerColor.append(int(marker))
-        
-    # in case we limit the range of bins
-    if ("pix_b0" in histogramName): # IBL
-        if (sector > 13): sector = 13
-        if (sector <  0): sector = 0
-        if (ring  > 9): ring = 9
-        if (ring < -10): ring = -10
-        logicalRing = ring+11
-    if ("sct_b" in histogramName): # SCT layer
-        if (sector<0): sector = 0 
-        logicalRing = ring+6+1 # (staringt at ring -6 --> bin 1) 
-            
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = -999999
-    max_hist = 0
-    
-    histoGram = [TH3,TH3,TH3,TH3,TH3, TH3, TH3, TH3, TH3]
-    returnHistogram = [TH1, TH1, TH1, TH1, TH1, TH1, TH1, TH1, TH1]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple, tuple, tuple, tuple]
-
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-        print " <MakeModuleResPlotsFrom3D> ===  ",histogramName,"  ===  sector:", sector, " ring:",ring, " (logical ring/bin:",logicalRing,")" 
-        if (debug): print " <MakeModuleResPlotsFrom3D> retriveing ",histogramName," from file ",i," --> ",rootFiles[i]
-        histoGram[i] =GetHistogram3D(rootFiles[i],histogramDir[i],histogramName)
-
-    for i in range(nFiles):
-        # make the profile
-        if (doStave): logicalRing = 0 # all staves
-        histName = "LocalXRes_sector_" + str(sector) + "_ring_" + str(ring) + "_File_" + str(i)
-        if (ring<0 and not doStave): histName = "LocalXRes_sector_" + str(sector-1) + "_ring__" + str(-ring) + "_File_" + str(i)
-        returnHistogram[i] = histoGram[i].ProjectionZ(histName,logicalRing,logicalRing,sector,sector)
-        #rebinned histograms
-        #returnHistogram[i] = (histoGram[i].ProjectionZ(histName,logicalRing,logicalRing,sector,sector)).RebinX()
-        
-        
-        # perform the deired fit to the histogram
-        fit = MakeFit(returnHistogram[i], fitType, markerColor[i])
-        returnHistogram[i].SetMarkerStyle(markerStyle[i])
-        returnHistogram[i].SetMarkerColor(markerColor[i])
-        returnHistogram[i].SetLineColor(markerColor[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit, returnHistogram[i], legendTitles[i])
-
-    for i in range(nFiles):
-        #normalise histograms to unit area if desired
-        if returnHistogram[i].Integral() > 0:
-            if unitArea:
-                #print "for hist ",i, " scaling" 
-                returnHistogram[i].Scale(1/returnHistogram[i].Integral())
-                returnHhistogram[i].GetYaxis().SetTitle("Arbitrary units")
-            #elif  i > 0 and normaliseHistos:
-            elif normaliseHistos:
-                returnHistogram[i].Scale(returnHistogram[normaliserHisto].Integral()/returnHistogram[i].Integral())
-
-        # find which histogram has largest y-value - this will be drawn first
-        if returnHistogram[i].GetMaximum() > maxval:
-            max_hist = i
-            maxval = returnHistogram[i].GetMaximum()
-
-    if (True): print " < MakeModuleResPlotsFrom3D> max_hist = ", max_hist, "  max_val = ", maxval 
-    
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-    if nFiles==5:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-    if nFiles==6:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-    if nFiles==7:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6]
-        elif max_hist==6:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-    if nFiles==8:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-    if nFiles==9:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6] + Tuples[7] + Tuples[8]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[7] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[8] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6] + Tuples[7]
-
-
-    if (debug): print " <MakeModuleResPlotsFrom3D> totalTuple:", totalTuple
-    if (debug): print "  <MakeModuleResPlotsFrom3D> for ",histogramName, " **  COMPLETED  ** "
-    return totalTuple #returning histograms and fits
-
-##############################################################################################################
-def MakeTwoPlotsFromSameFile(histogramDir,legendTitles,markerColors,markerStyles,histogramNames, fitType, rootFiles, fileToUse, normaliseHistos, unitArea=False):
-    
-    #gets 2 histograms from same file, normalises if desired and makes fits
-    #returns histograms and fits
-
-    maxval = 0.0
-    max_hist = 0
-
-    histoGram = [TH1,TH1]
-    Tuples = [tuple,tuple]
-
-    histoGram[0] = GetHistogram(rootFiles[fileToUse],histogramDir[fileToUse],histogramNames[0],markerColors[0],markerStyles[0])
-    histoGram[1] = GetHistogram(rootFiles[fileToUse],histogramDir[fileToUse],histogramNames[1],markerColors[1],markerStyles[1])
-
-    for i in range(2):
-
-        #normalise histograms to unit area if desired
-        if histoGram[i].Integral() > 0:
-            if unitArea:
-                histoGram[i].Scale(1/histoGram[i].Integral())
-                histoGram[i].GetYaxis().SetTitle("Arbitrary units")
-            elif  i > 0 and normaliseHistos:
-                histoGram[i].Scale(histoGram[0].Integral()/histoGram[i].Integral())
-        
-        # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-        RemoveNegativeYAxis(histoGram[i],histogramNames[i])
-
-        if histoGram[i].GetMaximum() > maxval:
-            max_hist = i
-            maxval = histoGram[i].GetMaximum()
-
-        # perform the deired fit to the histogram
-        fit = MakeFit(histoGram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,histoGram[i],legendTitles[i])
-
-
-    if max_hist==0:
-        totalTuple = Tuples[0] + Tuples[1]
-    if max_hist==1:
-        totalTuple = Tuples[1] + Tuples[0]
-
-    return totalTuple #returning histograms and fits
-
-###########################################################################################################################
-def preparePalette(paletteStyle, targetGreen=25, ScaleMax=100):
-    debug = False;
-    if (paletteStyle == 3): 
-    #trafic lights: black -> red -> orange -> green for efficiency plots
-        NRGBs = 5
-        NCont = 99
-        stops = array("d", [ 0.05, 0.50, 0.75, 0.90, 1.00])
-        red   = array("d", [ 0.10, 0.80, 0.99, 0.99, 0.04])
-        green = array("d", [ 0.10, 0.05, 0.95, 0.90, 0.95])
-        blue  = array("d", [ 0.10, 0.05, 0.05, 0.05, 0.04])
-    
-        TColor.CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
-        gStyle.SetNumberContours(NCont);
-
-    if (paletteStyle == 4): 
-    #widht plots lights: blue -> green -> orange -> red but not linear
-        NRGBs = 5
-        NCont = 99
-        if (ScaleMax < 4*targetGreen): ScaleMax = 4*targetGreen
-        stops = array("d", [ 0.5*targetGreen/ScaleMax, 1.*targetGreen/ScaleMax, 2.0*targetGreen/ScaleMax, 3.*targetGreen/ScaleMax, 1.00])
-        red   = array("d", [ 0.20, 0.02, 1.00, 0.99, 0.20])# 0.95
-        green = array("d", [ 0.00, 0.99, 0.99, 0.05, 0.05])# 0.95
-        blue  = array("d", [ 0.99, 0.02, 0.01, 0.02, 0.05])# 0.02
-    
-        TColor.CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
-        gStyle.SetNumberContours(NCont);
-
-    if (debug):
-        for i in range(len(stops)):
-            print " i=",i,stops[i]," target:", targetGreen," scalemax:", ScaleMax
-    return;
-
-###########################################################################################################################
-def MakeSiEndcapResidualDistribution(histogramName,histogramDir,rootFile):
-
-    print "making Si endcap residuals"
-
-    if "eca" in histogramName:
-        h2d = rootFile.Get(histogramDir + "si_eca_resX")
-    elif "ecc" in histogramName:
-        h2d = rootFile.Get(histogramDir + "si_ecc_resX")
-    else:
-        print "EXITING because endcap not recognised in MakeSiEndcapResidualDistribution"
-        sys.exit()
-
-    if "pix" in histogramName:
-        if "residualx_disk1" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,1,1,"e")).Clone()
-        elif "residualx_disk2" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,2,2,"e")).Clone()
-        elif "residualx_disk3" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,3,3,"e")).Clone()
-        else:
-            print "EXITING because pixel disk not recognised in MakeSiEndcapResidualDistribution"
-            sys.exit()
-
-    if "sct" in histogramName:
-        if "residualx_disk1" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,4,4,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,5,5,"e")).Clone()
-        elif "residualx_disk2" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,6,6,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,7,7,"e")).Clone()
-        elif "residualx_disk3" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,8,8,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,9,9,"e")).Clone()
-        elif "residualx_disk4" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,10,10,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,11,11,"e")).Clone()
-        elif "residualx_disk5" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,12,12,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,13,13,"e")).Clone()
-        elif "residualx_disk6" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,14,14,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,15,15,"e")).Clone()
-        elif "residualx_disk7" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,16,16,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,17,17,"e")).Clone()
-        elif "residualx_disk8" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,18,18,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,19,19,"e")).Clone()
-        else:
-            print "EXITING because SCT disk not recognised in MakeSiEndcapResidualDistribution"
-            sys.exit()
-        endcapHist = sctEndcapSide0
-        endcapHist.Sumw2()
-        endcapHist.Add(sctEndcapSide1)
-
-
-    return endcapHist
-
-def FindCutBin(axis, cut, maxOrMin):
-
-
-  cutBin = 0
-
-  for i in range(axis.GetNbins()+1):
-    
-    edge = 0.0
-    if maxOrMin < 0:
-      edge = axis.GetBinLowEdge(i)
-    else:
-      edge = axis.GetBinUpEdge(i)
-      
-    if math.fabs(edge - cut) < 0.00001:
-      cutBin = i
-      break
-
-    if i==axis.GetNbins():
-      print "ERROR - cannot find cut bin!!!! Set to -100!!!"
-
-  return cutBin
-
-####################################################################
-def MakeResidualMean1dHisto(histogramName,histogramDir,rootFile):
-
-    debug = False
-
-    xAxisLimit = 10.0
-    nBins1d = 100
-    meanOrError=0
-
-    if "mean1d" in histogramName:
-        if "pix" in histogramName and "yres" in histogramName:
-            xAxisLimit = 50.0
-            nBins1d = 500
-        h1d = TH1F(histogramName,histogramName,nBins1d,-xAxisLimit,xAxisLimit)
-        meanOrError=0
-    if "meanerror1d" in histogramName:
-        h1d = TH1F(histogramName,histogramName,300,0.,30.)
-        meanOrError=1
-    if "nentries1d" in histogramName:
-        h1d = TH1F(histogramName,histogramName,100,0.,100000.)
-        meanOrError=2
-    if debug:
-        print "histogramName = ",histogramName 
-
-    if "xres" in histogramName:
-        resStr = "xres"
-    if "yres" in histogramName:
-        resStr = "yres"
-
-    if "pix_b" in histogramName:
-        if "b0" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b0_" + resStr + "vsmodetaphi_3d")
-        elif "b1" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b1_" + resStr + "vsmodetaphi_3d")
-        elif "b2" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b2_" + resStr + "vsmodetaphi_3d")                                
-        else:
-            print "don't recognise histo name in MakeResidualMean1dHisto - EXITING"
-            sys.exit()
-
-    nBinsX = h3d.GetNbinsX()
-    nBinsY = h3d.GetNbinsY()
-
-    nModules = 0
-
-    for i in range(nBinsX):
-
-        for j in range(nBinsY):
-
-            hProj = h3d.ProjectionZ("proj",i,i,j,j,"e")
-
-            if hProj.GetEntries() <= 0:
-                if debug:
-                    print "Module has zero entries - probably a dead module"
-                continue
-            
-            if(meanOrError==0):
-                h1d.Fill((hProj.GetMean())*1000.)#fill with mean in microns
-                if abs(hProj.GetMean()*1000.) > xAxisLimit:
-                    print "WARNING: in MakeResidualMean1dHisto have a module with residual mean > ",xAxisLimit," microns"
-            elif(meanOrError==1):
-                h1d.Fill(hProj.GetMeanError()*1000.)
-            else:
-                h1d.Fill(hProj.GetEntries())
-            nModules = nModules + 1
-
-    if debug:
-        print "nModules =",nModules 
-
-    return h1d
-        
-def MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,meanOrFWHM=0):
-
-    # this method will usually fill a 1-d histogram with the mean or FWHM of residual/pull distributions as a function of track pT
-    # however, if the histogramName ends with string "bin-X", where X is an integer, it will return the actual residual/pull
-    # distribution in the bin X
-
-    # binning used for the x-axis (pT)
-    #nBins = 20
-    #newBins = array('d',[-20.0,-15.0,-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0,15.0,20.0])
-
-    nBins = 20
-    newBins = array('d',[-20.0,-15.0,-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0,15.0,20.0])
-
-    debug = False
-    makeDistribution = False #gets set to true if histogramName contains "bin-X"
-
-    if "residual" in histogramName:
-        if "pix_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_b_residualx_pt")
-        if "pix_b0_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_b0_residualx_pt")
-        elif "pix_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_eca_residualx_pt")
-        elif "pix_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_ecc_residualx_pt")
-        elif "sct_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_b_residualx_pt")
-        elif "sct_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_eca_residualx_pt")
-        elif "sct_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_ecc_residualx_pt")
-        elif "trt_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_b_residualR_pt_")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        elif "trt_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_ec_residualR_pt_Endcap_A")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        elif "trt_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_ec_residualR_pt_Endcap_C")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        else:
-            print "don't recognise histo name in MakeResidualVsPtHisto - EXITING"
-            sys.exit()
-    elif "pullx" in histogramName:
-        if "pix_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_b_pullx_pt")
-        elif "pix_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_eca_pullx_pt")
-        elif "pix_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_ecc_pullx_pt")
-        elif "sct_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_b_pullx_pt")
-        elif "sct_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_eca_pullx_pt")
-        elif "sct_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_ecc_pullx_pt")
-        else:
-            print "don't recognise histo name in MakeResidualVsPtHisto - EXITING"
-            sys.exit()
-
-    
-    
-    newHist = TH1F("newHist","newHist",nBins,newBins)
-
-    #check to see if histogramName contains "bin-X"
-    #if so we just return the projection for that bin
-    binNum = 0
-    if "bin-" in histogramName:
-        makeDistribution = True
-        binNumStr = (histogramName.split('-'))[1]
-        binNum = int(binNumStr)
-        print "binNumStr = ", binNumStr, ", binNum = ",binNum
-    if makeDistribution:
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[binNum-1],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[binNum],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        #projHist.Rebin(2)
-        return projHist
-
-    #otherwise fill 1-d histo with mean/width vs pT
-    for i in range(nBins):
-
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[i],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[i+1],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        #projHist.Rebin(2)
-        mean = projHist.GetMean()
-        rms = projHist.GetRMS()
-        entries = projHist.GetEntries()
-        meanErr = 1000.0
-        if entries > 0:
-            sqrtEntries = math.sqrt(entries);
-            meanErr = rms/sqrtEntries
-            fwhmArray = findMeanRMSUsingFWHM(projHist)
-            fWHM = fwhmArray[1]
-            #gausFit = singleGaus(projHist)
-            gausFit = singleGausIterative(projHist,sigmaIterativeGaus)
-            gausSigma = gausFit.GetParameter(2)
-            gausSigmaErr = gausFit.GetParError(2)
-
-        if debug: print "lowRange = ", newBins[i],", lowBin = ",lowBin,", highRange = ",newBins[i+1],", highBin = ",highBin,", content = ",projHist.GetEntries(),", mean = ",mean
-
-        if entries > 0 and newBins[i] < -2.0 or newBins[i] >= 2.0:#we don't show bins below 2 GeV (can have handful of entries)
-            if meanOrFWHM==0:
-                newHist.SetBinContent(i+1,mean)
-                newHist.SetBinError(i+1,meanErr)
-            elif meanOrFWHM==1:
-                if entries > 1000:
-                    newHist.SetBinContent(i+1,fWHM)
-                    newHist.SetBinError(i+1,0.000000001)
-            else:
-                if entries > 1000:
-                    newHist.SetBinContent(i+1,gausSigma)
-                    newHist.SetBinError(i+1,gausSigmaErr)
-
-    return newHist
-        
-def MakeErrVsPtHisto(histogramName,histogramDir,rootFile):
-
-    #print "making residual vs pt"
-
-    
-    h2d = rootFile.Get(histogramDir + histogramName)
-
-    nBins = 20
-    newBins = array('d',[0.0,0.8*2.0,0.8*4.0,0.8*6.0,0.8*8.0,0.8*10.0,0.8*12.0,0.8*14.0,0.8*16.0,0.8*18.0,0.8*20.0,0.8*22.0,0.8*24.0,0.8*26.0,
-                         0.8*28.0,0.8*30.0,0.8*32.0,0.8*36.0,0.8*40.0,0.8*44.0,0.8*50.0])
-    
-    newHist = TH1F("newHist","newHist",nBins,newBins)
-    
-    
-    for i in range(nBins):
-
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[i],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[i+1],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        mean = projHist.GetMean()
-        rms = projHist.GetRMS()
-        entries = projHist.GetEntries()
-        meanErr = 1000.0
-        if entries > 0:
-            sqrtEntries = math.sqrt(entries);
-            meanErr = rms/sqrtEntries
-            #fwhmArray = findMeanRMSUsingFWHM(projHist)
-            #fWHM = fwhmArray[1]
-
-        #print "lowRange = ", newBins[i],", lowBin = ",lowBin,", highRange = ",newBins[i+1],", highBin = ",highBin,", content = ",projHist.GetEntries(),", mean = ",mean
-
-        if entries > 0:
-            newHist.SetBinContent(i+1,mean)
-            newHist.SetBinError(i+1,meanErr)
-
-    return newHist
-
-#########################################################################################
-def GetHistogram(rootFile,histogramDir,histogramName,markerColor,markerStyle, fileID=0):
-
-    debug = False
-
-    # make sure the styles are integers
-    markerStyle = int(markerStyle)
-    markerColor = int(markerColor)
-
-    if (debug): 
-        print " -- GetHistogram -- -- START -- -- "
-        print "    rootFile = ", rootFile
-        print "    histogramDir = ", histogramDir
-        print "    histogramName = ", histogramName
-        print "    markerColor = ", markerColor
-        print "    markerStyle = ",markerStyle
-        print "    fileID = ",fileID
-    
-    if histogramName=="oldpix_b_residualx":
-        histoGramL1X=rootFile.Get(histogramDir + "pix_b1_residualx")
-        histoGramL2X=rootFile.Get(histogramDir + "pix_b2_residualx")
-        histoGramL3X=rootFile.Get(histogramDir + "pix_b3_residualx")
-        histoGram = histoGramL1X.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramL2X)
-        histoGram.Add(histoGramL3X)
-        
-        
-    elif histogramName=="oldpix_b_residualy":
-        histoGramL1Y=rootFile.Get(histogramDir + "pix_b1_residualy")
-        histoGramL2Y=rootFile.Get(histogramDir + "pix_b2_residualy")
-        histoGramL3Y=rootFile.Get(histogramDir + "pix_b3_residualy")
-        histoGram = histoGramL1Y.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramL2Y)
-        histoGram.Add(histoGramL3Y)
-        
-    elif histogramName=="pix_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualx_fine":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualx_fine")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualx_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualy_fine":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualy_fine")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualy_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualy":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualy")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualy")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx_fine":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx_fine")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_residualR":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_residualR_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_residualR_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-
-    elif histogramName=="pix_b_pullx":
-        histoGramB0 = rootFile.Get(histogramDir + "pix_b0_pullx")
-        histoGramB1 = rootFile.Get(histogramDir + "pix_b1_pullx")
-        histoGramB2 = rootFile.Get(histogramDir + "pix_b2_pullx")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_b_pully":
-        histoGramB0 = rootFile.Get(histogramDir + "pix_b0_pully")
-        histoGramB1 = rootFile.Get(histogramDir + "pix_b1_pully")
-        histoGramB2 = rootFile.Get(histogramDir + "pix_b2_pully")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_ec_pullx":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_pullx")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_pullx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_pully":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_pully")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_pully")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_b_pullx":
-        histoGramB0 = rootFile.Get(histogramDir + "sct_b0_pullx")
-        histoGramB1 = rootFile.Get(histogramDir + "sct_b1_pullx")
-        histoGramB2 = rootFile.Get(histogramDir + "sct_b2_pullx")
-        histoGramB3 = rootFile.Get(histogramDir + "sct_b3_pullx")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-        histoGram.Add(histoGramB3)
-    elif histogramName=="sct_ec_pullx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_pullx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_pullx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_pullR":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_pullR_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_pullR_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_pullR_notube":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_pullR_notube_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_pullR_notube_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pT_nolog":
-        histoGram = rootFile.Get(histogramDir + "pT")
-        histoGram.SetName("pT_nolog")
-    elif "D0bsVs" in histogramName:
-        histoGram =  ((rootFile.Get(histogramDir + histogramName)).ProfileX()).Clone()
-    elif "residualx_disk" in histogramName:
-        histoGram = MakeSiEndcapResidualDistribution(histogramName,histogramDir,rootFile)
-    elif "residualx_pt_mean" in histogramName or "residual_pt_mean" in histogramName  or "pullx_pt_mean" in histogramName or "residualx_pt_bin" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile)
-    elif "residualx_pt_fwhm" in histogramName or "residual_pt_fwhm" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,1)
-    elif "pix_b0_residualx_pt" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,1)
-    elif "pullx_pt_width" in histogramName or "residual_pt_width" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,2)
-    elif histogramName=="pix_b_xres_mean1d" or  histogramName=="pix_b_xres_meanerror1d" or  histogramName=="pix_b_xres_nentries1d":
-        confStr = "mean1d"
-        if "meanerror1d" in histogramName:
-            confStr = "meanerror1d"
-        if "nentries1d" in histogramName:
-            confStr = "nentries1d"            
-        histoGramB0 = MakeResidualMean1dHisto("pix_b0_xres_"+confStr,histogramDir,rootFile)
-        histoGramB1 = MakeResidualMean1dHisto("pix_b1_xres_"+confStr,histogramDir,rootFile)
-        histoGramB2 = MakeResidualMean1dHisto("pix_b2_xres_"+confStr,histogramDir,rootFile)
-        histoGram = histoGramB0.Clone()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_b_yres_mean1d":
-        histoGramB0 = MakeResidualMean1dHisto("pix_b0_yres_mean1d",histogramDir,rootFile)
-        histoGramB1 = MakeResidualMean1dHisto("pix_b1_yres_mean1d",histogramDir,rootFile)
-        histoGramB2 = MakeResidualMean1dHisto("pix_b2_yres_mean1d",histogramDir,rootFile)
-        histoGram = histoGramB0.Clone()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif "err" in histogramName and "VsPt" in histogramName:
-        histoGram = MakeErrVsPtHisto(histogramName,histogramDir,rootFile)
-    elif "pix_b0_resXvsetaLumiBlock" in histogramName:
-        histoGram = rootFile.Get(histogramDir + histogramName)
-        histoGram.RebinX(32)
-        print "histogram",histoGram
-    else:
-        histoGram = rootFile.Get(histogramDir + histogramName)
-
-    # IBL residuals    
-    if "IBL_residual" in histogramName:
-        if histogramName=="IBL_residualx_3DSensors":
-            histoGram3D = GetHistogram3D(rootFile, histogramDir, "pix_b0_xresvsmodetaphi_3d") # retrieve the 3D histogram
-            histoGram = getIBLResidualBySensorType(histoGram3D, 0, True, False, fileID)
-        if histogramName=="IBL_residualx_PlanarSensors":
-            histoGram3D = GetHistogram3D(rootFile, histogramDir, "pix_b0_xresvsmodetaphi_3d") # retrieve the 3D histogram
-            histoGram = getIBLResidualBySensorType(histoGram3D, 0, False, True, fileID)
-        if histogramName=="IBL_residualy_3DSensors":
-            histoGram3D = GetHistogram3D(rootFile, histogramDir, "pix_b0_yresvsmodetaphi_3d") # retrieve the 3D histogram
-            histoGram = getIBLResidualBySensorType(histoGram3D, 0, True, False, fileID)
-        if histogramName=="IBL_residualy_PlanarSensors":
-            histoGram3D = GetHistogram3D(rootFile, histogramDir, "pix_b0_yresvsmodetaphi_3d") # retrieve the 3D histogram
-            histoGram = getIBLResidualBySensorType(histoGram3D, 0, False, True, fileID)
-        if histogramName=="IBL_residualx_3DASensors":
-            histoGram3D = GetHistogram3D(rootFile, histogramDir, "pix_b0_xresvsmodetaphi_3d") # retrieve the 3D histogram
-            histoGram = getIBLResidualBySensorType(histoGram3D, 0, True, False, fileID, "ASide")
-        if histogramName=="IBL_residualx_3DCSensors":
-            histoGram3D = GetHistogram3D(rootFile, histogramDir, "pix_b0_xresvsmodetaphi_3d") # retrieve the 3D histogram
-            histoGram = getIBLResidualBySensorType(histoGram3D, 0, True, False, fileID, "CSide")
-        histoGram.SetMarkerColor(markerColor)
-        histoGram.SetMarkerStyle(markerStyle)
-
-
-    #
-    # - end of searching histograms
-    # - now... let's do some basic crosschecks
-    #    
-    if not histoGram : #is None:#checking histograms exist    
-        print "EXITING because failed to find histogram ",histogramDir + histogramName
-        sys.exit()
-         
-    if histoGram.Integral()==0:#checking for empty histos
-        print "WARNING zero entries in histogram ",histogramDir + histogramName
-
- #    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-#     if histogramName=="trt_b_pullR" or histogramName=="trt_ec_pullR_Endcap_A" or histogramName=="trt_ec_pullR_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-#     if histogramName=="trt_b_pullR_notube" or histogramName=="trt_ec_pullR_notube_Endcap_A" or histogramName=="trt_ec_pullR_notube_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-
-
-    histoGram.Sumw2()#so have errors
-    histoGram.SetMarkerColor(markerColor)
-    histoGram.SetMarkerStyle(markerStyle)
-    histoGram.SetLineColor(markerColor)
-
-
-    # rebinning histograms used for the approved plots
-#     if histogramName=="pix_b_residualy":
-#         histoGram.Rebin(2)
-#     if histogramName=="pix_b_residualx_fine" or histogramName=="pix_ec_residualx_fine" or histogramName=="pix_eca_residualx_fine" or histogramName=="pix_ecc_residualx_fine":
-#         histoGram.Rebin(2)
-#         histoGram.SetAxisRange(-.25,.25)
-#     if histogramName=="pix_b_residualy_fine":
-#         histoGram.Rebin(4)
-#         histoGram.SetAxisRange(-.75,.75)
-#     if histogramName=="pix_eca_residualy_fine" or histogramName=="pix_ecc_residualy_fine" or histogramName=="pix_ec_residualy_fine":
-#         histoGram.Rebin(16)
-#         histoGram.SetAxisRange(-.75,.75)
-#     if histogramName=="sct_b_residualx_fine" or histogramName=="sct_ec_residualx_fine" or histogramName=="sct_eca_residualx_fine" or histogramName=="sct_ecc_residualx_fine":
-#         histoGram.Rebin(2)
-#         histoGram.SetAxisRange(-.25,.25)
-#     if histogramName=="pix_b_residualx" or histogramName=="pix_ec_residualx" or histogramName=="sct_b_residualx" or histogramName=="sct_ec_residualx":
-#         histoGram.SetAxisRange(-.5,.5)
-
-  
- 
-    # uncomment to rebin histograms
-    #histoGram.Rebin(16);
-#    if histogramName=="pix_b_residualy" :
-#        histoGram.Rebin(2);
-    if histogramName=="trt_b_residualR":
-        histoGram.Rebin(2);
-        
-    if histogramName=="sct_b_residualx_fine":
-        histoGram.Rebin()
-
-        # comment this while aligning cosmic ray data 2014. Salvador Marti. 24/October/2014
-        #    if histogramName=="pix_b_residualy_fine" or \
-        #   histogramName=="sct_b_residualx_fine" or \
-        #   histogramName=="pix_b_residualx":
-        #histoGram.SetAxisRange(-0.15,0.15)
-
-        
-    if histogramName=="pix_b_residualx_fine" or \
-           histogramName=="pix_ec_residualx_fine":
-        histoGram.SetAxisRange(-.1,.1) 
-
-    # if histogramName=="pix_b0_residualx" or histogramName=="pix_b1_residualx" or histogramName=="pix_b2_residualx" or histogramName=="pix_ec_residualx" or histogramName=="pix_eca_residualx" or histogramName=="pix_ecc_residualx" :#or histogramName=="pix_b_residualy":
-    #histoGram.SetAxisRange(-.25,.25) #pri res
-
-        # if histogramName=="sct_b_residualx" or histogramName=="sct_b0_residualx" or histogramName=="sct_b1_residualx" or histogramName=="sct_b2_residualx" or histogramName=="sct_b3_residualx" or histogramName=="sct_ec_residualx" or histogramName=="sct_eca_residualx" or histogramName=="sct_ecc_residualx":
-        #histoGram.SetAxisRange(-.25,.25) #pri res
-
-    if histogramName=="sct_ec_residualx_fine":
-        histoGram.Rebin()
-        histoGram.SetAxisRange(-.2,.2)
-
-    # Following lines commented by Salva for Cosmic 2014 data --> need broader ranges 24/October/2014
-    # #changing the x or y axis range of certain histograms from their defaults
-    # if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C" or histogramName=="trt_ec_residualR" :
-    # histoGram.SetAxisRange(-0.5,0.5)
-    # if "asym" in histogramName:
-    # histoGram.GetYaxis().SetRangeUser(-0.3,0.3)
-    # priscilla
-
-
-
-
-    if histogramName=="delta_z0":
-        histoGram.SetAxisRange(-1.,1.)
-
-    #Overlaps mean
-    if histogramName=="pix_b_Oyresyvsmodeta":
-        histoGram.Scale(1000.)
-        histoGram.GetYaxis().SetRangeUser(-300,200)
-
-    if histogramName=="pix_b_Oyresyvsmodphi":
-        histoGram.Scale(1000.)
-        histoGram.GetYaxis().SetRangeUser(-300,300)
-
-    if histogramName=="pix_b_Oxresxvsmodeta" or histogramName=="pix_b_Oxresxvsmodphi" or histogramName=="pix_eca_Oxresxvsmodphi" or histogramName=="pix_ecc_Oxresxvsmodphi" or histogramName=="pix_eca_Oyresyvsmodphi" or histogramName=="pix_ecc_Oyresyvsmodphi":
-        histoGram.Scale(1000.)
-        
-
-    if histogramName=="sct_b_Oxresxvsmodeta" or histogramName=="sct_b_Oyresxvsmodeta" or histogramName=="sct_b_Oyresxvsmodphi" or histogramName=="sct_b_Oxresxvsmodphi" or histogramName=="sct_b_yresxvsmodphi" or histogramName=="sct_eca_Oxresxvsmodphi" or histogramName=="sct_ecc_Oxresxvsmodphi":
-        histoGram.Scale(1000.)
-        
-
-
-    if histogramName=="si_barrel_resX_mean" or histogramName=="si_eca_resX_mean" or histogramName=="si_ecc_resX_mean":
-        #Patch for the mean
-        histoGram.Scale(1000)
-        histoGram.GetYaxis().SetRangeUser(-10,10)
-    if histogramName=="pix_b_xresvsmodphi" or  histogramName=="pix_ecc_xresvsmodphi" or histogramName=="pix_eca_xresvsmodphi":
-        #or histogramName=="si_ecc_resX_mean" or histogramName=="si_eca_resX_mean" or histogramName=="si_barrel_resX_mean": Peo 
-        histoGram.GetYaxis().SetRangeUser(-.02,.02) #pri
-    if histogramName=="pix_b_yresvsmodphi" or histogramName=="pix_eca_yresvsmodphi" or histogramName=="pix_ecc_yresvsmodphi":
-        histoGram.GetYaxis().SetRangeUser(-.1,.1) #pri
-    if histogramName=="sct_b_xresvsmodeta" or histogramName=="pix_b_xresvsmodeta": 
-        histoGram.GetYaxis().SetRangeUser(-.02,.02) #pri
-    if histogramName=="sct_b_xresvsmodphi" or histogramName=="sct_eca_xresvsmodphi" or histogramName=="sct_ecc_xresvsmodphi":   
-        histoGram.GetYaxis().SetRangeUser(-.02,.02) #pri
-
-    if histogramName=="sct_b_Oxresxvsmodeta_mean" or histogramName=="pix_b_Oxresxvsmodeta_mean" or histogramName=="pix_b_Oyresyvsmodphi_mean":
-        histoGram.GetYaxis().SetRangeUser(-.15,.15)
-    if histogramName=="pix_b_xresvsmodeta_width" or histogramName=="pix_b_xresvsmodphi_width" or histogramName=="sct_b_xresvsmodeta_width" or histogramName=="sct_b_xresvsmodphi_width" or histogramName=="si_barrel_resX_rms" or histogramName=="si_eca_resX_rms" or histogramName=="si_ecc_resX_rms":
-        histoGram.GetYaxis().SetRangeUser(0.00,0.050)
-        
-    if histogramName=="si_barrel_pullX_mean" or histogramName=="si_eca_pullX_mean" or histogramName=="si_ecc_pullX_mean":
-        histoGram.GetYaxis().SetRangeUser(-.5,.5)
-
-    if histogramName=="si_barrel_pullX_width": 
-        histoGram.GetYaxis().SetRangeUser(0,1.5)
-
-        
-    if histogramName=="measurements_eff_vs_layer_ecc" or histogramName=="measurements_eff_vs_layer_eca" or histogramName=="measurements_eff_vs_layer_barrel":
-        histoGram.GetYaxis().SetRangeUser(0.9,1.01)
-    if  histogramName=="hits_eff_vs_phiSector_trt_b0"  or histogramName=="hits_eff_vs_phiSector_trt_b1" or histogramName=="hits_eff_vs_phiSector_trt_b2":
-        histoGram.GetYaxis().SetRangeUser(0.7,1.02)
-
-    if histogramName=="eff_trthits_eta0" or histogramName=="eff_trthits_phi0":
-        histoGram.GetYaxis().SetRangeUser(0.6,1.05)
-    if histogramName=="trt_b_rmsRes_l0" or histogramName=="trt_b_rmsRes_l1" or histogramName=="trt_b_rmsRes_l2" or histogramName=="trt_b_rmsResOverPhiVsStrawLayer": 
-        histoGram.GetYaxis().SetRangeUser(.16,.29)
-    if "trt_ec_rms" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(.16,.29)
-        
-    if histogramName=="trt_b_aveResOverPhiVsStrawLayer" or histogramName=="trt_b_aveRes_l0" or histogramName=="trt_b_aveRes_l1" or histogramName=="trt_b_aveRes_l2":
-        histoGram.Scale(1000.)
-        histoGram.GetYaxis().SetRangeUser(-11,11)
-        
-    if histogramName=="trt_ec_aveResVsPhiSec_Endcap_C" or histogramName=="trt_ec_aveResVsPhiSec_Endcap_A" or histogramName=="trt_ec_aveResVsRing_Endcap_C" or histogramName=="trt_ec_aveResVsRing_Endcap_A":
-        histoGram.Scale(1000.)
-        histoGram.GetYaxis().SetRangeUser(-5,5)
-    if histogramName=="ntracks":
-        histoGram.SetAxisRange(0.,10.)
- #   if histogramName=="pT" or histogramName=="pT_nolog":
- #       histoGram.SetAxisRange(-50.0,50.0)
- # commented for cosmic ray data 2014 (M6) Salvador Marti 24/October/2014
- #if histogramName=="d0":
- #       histoGram.SetAxisRange(-25.0,25.0)
-    if histogramName=="d0_bscorr" or histogramName=="d0_pvcorr":
-        histoGram.SetAxisRange(-1.0,1.0)
-    if histogramName=="z0_pvcorr":
-        histoGram.SetAxisRange(-1.0,1.0)
-
-        #if histogramName=="delta_eta0":
-        #histoGram.SetAxisRange(-0.02,0.02)
-    if histogramName=="delta_d0" or histogramName=="delta_phi0" or histogramName=="delta_eta0" or histogramName=="delta_z0" or histogramName=="delta_qOverPt":
-        histoGram.Sumw2()
-    if histogramName=="delta_eta0" or histogramName=="delta_z0":
-        histoGram.Rebin(2)
-    if histogramName=="delta_d0" or histogramName=="delta_phi0" or histogramName=="delta_qOverPt":
-        histoGram.Rebin(4)
-    if "hits_eff" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(0.6,1.0)
-
-    #if "err" in histogramName and "VsPt" in histogramName:
-    #    newBins = array('d',[0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,12.0,14.0,16.0,18.0,20.0,25.0,30.0,35.0,40.0])
-    #    histoGram = histoGram.Rebin(19,"new",newBins)
-    #    if "D0" in histogramName:
-    #        histoGram.GetYaxis().SetRangeUser(0.0,0.15)
-
-
-    if "D0bsVs" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-0.04,0.04)
-        if "VsPt" in histogramName:
-            #newBins = array('d',[-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0])
-            #histoGram = histoGram.Rebin(16,"new",newBins)
-            histoGram.SetAxisRange(-10.,10.)
-        if "VsEta" in histogramName:
-            histoGram.SetAxisRange(-2.6,2.6)
-    if "residualx_pt" in histogramName:#silicon histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.005,0.005)
-        if "fwhm" in histogramName:
-            if "sct" in histogramName:
-                histoGram.GetYaxis().SetRangeUser(0.02,0.05)
-            if "pix" in histogramName:
-                histoGram.GetYaxis().SetRangeUser(0.005,0.035)
-    if "residual_pt" in histogramName:#trt histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.005,0.005)
-        if "fwhm" in histogramName or "width" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(0.100,0.150)
-    if "pullx_pt" in histogramName:#silicon histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.03,0.03)
-        if "width" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(0.90,1.05)
-
-            #if "aveResVsPhiSec" in histogramName or "aveResVsRing" in histogramName: 
-            #histoGram.GetYaxis().SetRangeUser(-0.005,0.005)       
-
-    if "average_delta_d0" in histogramName or "average_delta_z0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.1,.1)
-    if "average_delta_phi0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.002,.002)  
-
-    if "average_delta_qOverPt" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.0015,.0015)  
-    if "average_delta_eta0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.02,.02)  
-
-    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.5*max_bin_val))
-        histoGram.SetAxisRange(-1.,1.)
-
-    #print "bin size for ",histogramName," = " , histoGram.GetBinWidth(50)        
-
-
-    if (debug): print " -- GetHistogram -- -- COMPLETED -- -- "
-    return histoGram
-
-###########################################################################
-def GetHistogram3D(rootFile,histogramDir,histogramName):
-    histoGram = rootFile.Get(histogramDir + histogramName)
-    return histoGram
-
-    
-###########################################################################
-def RemoveNegativeYAxis(histoGram,histogramName):
-
-    ## This is to ensure that the y-axis doesn't go negative for e.g. residuals plots
-    ## (sometimes ROOT likes to do this)
-    if histogramName=="pix_b_residualx" or histogramName=="pix_eca_residualx" or histogramName=="pix_ecc_residualx" or histogramName=="sct_b_residualx" or histogramName=="sct_eca_residualx" or histogramName=="sct_ecc_residualx" or histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C" or histogramName=="pix_b0_residualx" or histogramName=="pix_b1_residualx" or histogramName=="pix_b2_residualx" or histogramName=="sct_b0_residualx" or histogramName=="sct_b1_residualx" or histogramName=="sct_b2_residualx" or histogramName=="sct_b3_residualx" or histogramName=="delta_qOverPt" or histogramName=="delta_d0" or histogramName=="delta_z0" or histogramName=="delta_phi0" or histogramName=="delta_eta0" or histogramName=="chi2oDoF" or histogramName=="pix_b_residualx_fine" or histogramName=="sct_b_residualx_fine":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.1*max_bin_val))
-
-    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.5*max_bin_val))
-
-###########################################################################        
-def MakeFit(histoGram, fitType, markerColor):
-
-    # make sure the styles are integers
-    markerColor = int(markerColor)
-    
-    if fitType=="noFit": #do not perform a fit
-        fit = noFit(histoGram)
-
-    elif fitType=="noFitWithStats": #do not perform a fit
-        fit = noFitWithStats(histoGram)
-
-    elif fitType=="doubleGaus": #double Gaussian fit
-        fit = doubleGaus(histoGram)
-
-    elif fitType=="freeDoubleGaus": #this fit is unstable, not recommended
-        fit = freeDoubleGaus(histoGram,[500.,0.,0.05,1000.,0.,0.1])
-
-    elif fitType=="singleGaus": #single Gaussian fit
-        fit = singleGaus(histoGram)
-
-    elif fitType=="singleGausRestricted": #single Gaussian fit
-        fit = singleGausRestricted(histoGram)
-
-    elif fitType=="singleGausIterative": #single Gaussian fit iterated
-        fit = singleGausIterative(histoGram,sigmaIterativeGaus)
-
-    else:
-        print "EXITING: fitType - ",fitType," does not exist" 
-        sys.exit()
-
-    fit.SetLineColor(markerColor)
-
-    return fit
-
-
-
-####################################################################
-def defineLegendTextMarker(units, histoGram, funcTion, legendLeftX, legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod,legendMarkerSize):
-
-    debug = False
-    if (debug): print " ** defineLegendTextMarker ** START \n     units:", units," histogram:",histoGram," funcTion:",funcTion," showMean:",showMean
-    text = ""
-    text2 = ""
-
-    if(funcTion.GetName()!=""):
-        if(funcTion.GetName()!="noFitWithStats"):
-
-            newMean = funcTion.GetParameter(1)
-            newRMS = funcTion.GetParameter(2)
-
-        else: 
-            if (debug): print " ** defineLegendTextMarker ** finding mean with method: ", statsMethod
-            if statsMethod==0:
-                ## Just using straight Mean/RMS for full bin range
-                newMean = histoGram.GetMean()
-                newRMS = histoGram.GetRMS()
-
-            elif statsMethod==1:
-                ### using integral method to determine 95% range for mean/rms calculation
-                meanRMSTuple = findMeanRMSFromTruncatedDistribution(histoGram)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-
-            elif statsMethod==2:
-                ### using a range defined by RMS of histogram
-                meanRMSTuple = findMeanRMSUsingRange(histoGram,sigmaIterativeGaus)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-
-            elif statsMethod==3:
-                ### using FWHM corrected to Gaussian sigma
-                meanRMSTuple = findMeanRMSUsingFWHM(histoGram)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-                if (debug):
-                     print "mean = ",newMean
-                     print "FWHM/2.35 = ",newRMS
-
-            else:
-                print "no valid statsMethod set!!!!"
-            
-        #adding the mean to the legend text object
-        if showMean:
-            if (debug): print " ** defineLegendTextMarker ** dealing with showMean"
-            text = "#mu="
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text += str(round(1000*newMean,2))
-            elif "pull" in histoGram.GetName():
-                text += str(round(newMean,2))
-            elif "mean_" in histoGram.GetName():
-                text += str(round(newMean,2))
-            else:
-            #text += str(int(1000*newMean))
-                text += str(int(round(newMean,3)*1000))
-            text += " "+units
-            if (debug): print " ** defineLegendTextMarker ** showMean completed"
-            
-                
-
-
-        #adding the "width" to the legend text object
-        #unless have requested they are on a separate line
-        if meanWidthOnSeparateLine==False:
-            if showMean:
-                #if "mean_" in histoGram.GetName(): 
-                 #   text += "\\n"
-                #else:
-                text += ", "
-
-            if funcTion.GetName()!="noFitWithStats" : 
-                #text += ", #sigma="
-                text += "#sigma="
-            else:
-                if statsMethod==0 or statsMethod==2:
-                    text += "RMS="
-                if statsMethod==1:
-                    text += "RMS_{95%}="
-                if statsMethod==3:                
-                    text += "FWHM/2.35="
-
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text += str(round(1000*newRMS,2))
-            elif "pull" in histoGram.GetName():
-                text += str(round(newRMS,2))
-            elif "mean_" in histoGram.GetName():
-                text += str(round(newRMS,2))
-            else:
-                text += str(int(round(round(newRMS,4)*1000,0))) #will produce correctly rounded to 1 micron accuracy
-                #text += str(round(newRMS,4)*1000) # to see 0.1 micron accuracy in width
-#                if (int(newRMS*1000/10) > 1):
-#                    text += str(int(round(newRMS*1000, 1)))
-#                else: ####b priscilla!!!!!!!!!!!!
-#                    text += str(round(newRMS*1000, 1))
-#            if ("mu" in units): text += "  "
-            text += " "+units
-        
-        else: #have requested mean width on separate line, so fill separate text object
-            if funcTion.GetName()!="noFitWithStats" : 
-                text2 += "#sigma="
-            else:
-                if statsMethod==0 or statsMethod==2:
-                    text2 += "RMS="
-                if statsMethod==1:
-                    text2 += "RMS_{95%}="
-                if statsMethod==3:                
-                    text2 += "FWHM/2.35="
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text2 += str(round(1000*newRMS,2))
-            elif "pull" in histoGram.GetName():
-                text2 += str(round(newRMS,2))
-            elif "mean_" in histoGram.GetName():
-                text2 += str(round(newRMS,2))
-            else:
-                text2 += str(int(round(newRMS,3)*1000))
-            text2 += " "+units
-                
-    tsize=0.06
-    marker = TMarker(legendLeftX-(0.4*tsize),legendUpperY+legendMarkerYPosMod,8)
-    marker.SetNDC()
-    marker.SetMarkerStyle(histoGram.GetMarkerStyle())
-    marker.SetMarkerSize(legendMarkerSize)
-    marker.SetMarkerColor(histoGram.GetMarkerColor())
-
-    return marker, text, text2
-
-def findMeanRMSFromTruncatedDistribution(histoGram):
-    # this finds the statistical mean/rms using a truncated distribution such that contains 95% of the entries of the 
-    # full range (including overflow/underflow)
-    # i.e. the mean and RMS defined using bins which contain 95% of entries (symmetrically) around the mean bin
-    # NOTE - if there is significant underflow/overflow this will not be reliable (see explicit check below)
-
-    cloneHist = histoGram.Clone()
-
-    hmean = cloneHist.GetMean()
-    print "*************************************************************************"
-    print "mean = ",hmean, ", RMS = ",cloneHist.GetRMS(), ", nBins = ",cloneHist.GetNbinsX()
-    hFullIntegral = cloneHist.Integral(0,cloneHist.GetNbinsX()+1)
-    print "full integral = ",hFullIntegral,", nentries = ",cloneHist.GetEntries()
-
-    print "underflow = ",cloneHist.GetBinContent(0), ", overflow = ",cloneHist.GetBinContent(cloneHist.GetNbinsX()+1)
-    totalOverflow = cloneHist.GetBinContent(0) + cloneHist.GetBinContent(cloneHist.GetNbinsX()+1)
-
-    hTargetIntegral = 0.95*hFullIntegral
-    print "target integral = ",hTargetIntegral
-    hMeanBin = cloneHist.FindBin(hmean)
-    print "meanbin = ",hMeanBin
-
-    # this prescription to calculate 95% RMS from a histogram is only valid if the overflow/underflow is 
-    # sufficiently small. If overflow/underflow is too large, then the targetIntegral may lie within the underflow/overflow
-    # and thus we cannot reliably compute the spread
-    if hFullIntegral - hTargetIntegral < totalOverflow:
-        print "WARNING - potentially 95% range will go into overflow bins and not be valid. 95% RMS set to zero!!!"
-        #return 0.0,0.0
-        
-
-    lowBin = hMeanBin
-    highBin = hMeanBin
-    hIntegral = 0.0
-    while hIntegral < hTargetIntegral:
-        # find the bin which contains the mean
-        # then integrate symmetrically around this bin, increasing the range 
-        # until the integral is larger than the target
-        # this defines your upper and lower bounds for mean/rms.
-        lowBin = lowBin - 1
-        highBin = highBin + 1
-        hIntegral = cloneHist.Integral(lowBin,highBin)
-        #print "integral between bins ",lowBin,"-",highBin," = ",hIntegral
-
-    print "For Histogram " , cloneHist.GetName(), "Mean/RMS bin range is",lowBin,"-",highBin, ", axis range ",cloneHist.GetBinLowEdge(lowBin)," - ", cloneHist.GetBinLowEdge(highBin) + cloneHist.GetBinWidth(highBin)
-
-    cloneHist.GetXaxis().SetRange(lowBin,highBin)
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = cloneHist.GetRMS()
-    print "mean after constrained axis = ",hNewMean
-    print "RMS after constrained axis = ",hNewRMS
-    
-    return hNewMean, hNewRMS
-        
-
-####################################################
-def findMeanRMSUsingRange(histoGram, sigmaRange):
-
-    cloneHist = histoGram.Clone()
-
-    hMean = cloneHist.GetMean()
-    hRMS = cloneHist.GetRMS()
-    print "original mean = ", hMean," RMS = ",hRMS
-
-    lowBin = cloneHist.FindBin(hMean - hRMS*sigmaRange)
-    highBin = cloneHist.FindBin(hMean + hRMS*sigmaRange)
-
-    #print "lowBin = ",lowBin,", highBin = ",highBin, ", nBins = ", cloneHist.GetNbinsX()
-    
-    cloneHist.GetXaxis().SetRange(lowBin,highBin)
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = cloneHist.GetRMS()
-    #print "mean after constrained axis = ",hNewMean
-    #print "RMS after constrained axis = ",hNewRMS
-
-    return hNewMean, hNewRMS
-
-def findFractionWithinSigmaRange(histoGram, sigmaRange):
-
-    hMean = histoGram.GetMean()
-    hRMS = histoGram.GetRMS()
-    #print "original mean = ", hMean," RMS = ",hRMS
-
-    lowBin = histoGram.FindBin(hMean - hRMS*sigmaRange)
-    highBin = histoGram.FindBin(hMean + hRMS*sigmaRange)
-
-    #print "lowBin = ",lowBin,", highBin = ",highBin, ", nBins = ", histoGram.GetNbinsX()
-    
-    intGral = histoGram.Integral(lowBin,highBin)
-    fullIntGral = histoGram.Integral(1,histoGram.GetNbinsX())
-    print "histo ",histoGram.GetName()," fraction covered by fit = ",intGral/fullIntGral
-
-    return intGral/fullIntGral
-
-####################################################################
-def findMeanRMSUsingFWHM(histoGram):
-
-    # we clone the histogram here because otherwise the original histogram will be rebinned
-    # unfortunately this rebinning happens after the y-axis range has been defined in DrawPlots()
-    # and so messes up drawing of histograms
-    cloneHist = histoGram.Clone()
-    debug = False
-
-    if debug: print " ** findMeanRMSUsingFWHM ** original bin width = ",cloneHist.GetBinWidth(1)
-
-
-    rebinHistogram = True
-    rebinCount = 0
-    
-    while rebinHistogram==True:
-        rebinCount += 1
-        rebinHistogram = False
-
-        hMaxBin = cloneHist.GetMaximumBin()
-        hMax = cloneHist.GetBinContent(hMaxBin)
-        hHalfMax = hMax/2.0
-
-        if debug: print " ** findMeanRMSUsingFWHM ** hNBins = ", cloneHist.GetNbinsX(), ", hMaxBin =  ", hMaxBin, ", hMax = ", hMax, ", hHalfMax = ",hHalfMax
-
-        lowBin = hMaxBin
-        highBin = hMaxBin
-        hLowContent = hMax
-        hHighContent = hMax
-        while (hLowContent > hHalfMax and lowBin > 0) :
-            lowBin = lowBin - 1
-            hLowContent = cloneHist.GetBinContent(lowBin)
-            if debug: print "lowcotent =  ",hLowContent
-        while (hHighContent > hHalfMax and highBin <= cloneHist.GetNbinsX()):
-            highBin = highBin + 1
-            hHighContent = cloneHist.GetBinContent(highBin)
-            if debug: print "highcotent =  ",hHighContent
-
-        lowBinTest = lowBin - abs(hMaxBin - lowBin)
-        highBinTest = highBin + abs(highBin - hMaxBin)
-
-        while lowBinTest < hMaxBin:
-            if cloneHist.GetBinContent(lowBinTest) > cloneHist.GetBinContent(lowBinTest+1):
-                rebinHistogram = True
-                lowBinTest = hMaxBin #exits while loop
-            lowBinTest = lowBinTest + 1
-
-        while highBinTest > hMaxBin:
-            if cloneHist.GetBinContent(highBinTest) > cloneHist.GetBinContent(highBinTest-1):
-                rebinHistogram = True
-                highBinTest = hMaxBin #exits while loop
-            highBinTest = highBinTest - 1
-
-        if (cloneHist.GetNbinsX()<9): rebinHistogram = False
-            
-        if rebinHistogram==True:
-            rebinfactorisgood = False
-            rebinfactor = 2
-            if (cloneHist.GetNbinsX() % 2 == 0 and not rebinfactorisgood):
-                rebinfactorisgood = True
-            if (cloneHist.GetNbinsX() % 3 == 0 and not rebinfactorisgood):
-                rebinfactor = 3
-                rebinfactorisgood = True
-            if (cloneHist.GetNbinsX() % 5 == 0 and not rebinfactorisgood):
-                rebinfactor = 5
-                rebinfactorisgood = True
-            if (not rebinfactorisgood):
-               rebinfactor = 1
-               rebinfactorisgood = True
-            if (debug): print "rebinning histogram:",cloneHist.GetName()," of Nbins: ", cloneHist.GetNbinsX(), " with rebin factor: ",rebinfactor
-            if (rebinfactorisgood): cloneHist.Rebin(rebinfactor)
-
-
-
-    # analytical solution to linear interpolation between the two bins where the half max threshold is crossed
-    # using y1 = A*x1 + B, and y2 = A*x2 + B, solving for A and B
-    lowFuncA = (cloneHist.GetBinContent(lowBin) - cloneHist.GetBinContent(lowBin+1))/(cloneHist.GetBinCenter(lowBin) - cloneHist.GetBinCenter(lowBin+1))
-    lowFuncB = cloneHist.GetBinContent(lowBin) - lowFuncA*(cloneHist.GetBinCenter(lowBin))
-
-    highFuncA = (cloneHist.GetBinContent(highBin-1) - cloneHist.GetBinContent(highBin))/(cloneHist.GetBinCenter(highBin-1) - cloneHist.GetBinCenter(highBin))
-    highFuncB = cloneHist.GetBinContent(highBin-1) - highFuncA*(cloneHist.GetBinCenter(highBin-1))
-
-    lowFWHM = -99999.0
-    highFWHM = 99999.0
-
-    if interpolateFWHM:
-        # using x = (y - B)/A
-        if lowFuncA != 0.0:
-            lowFWHM = (hHalfMax - lowFuncB)/lowFuncA
-        if highFuncA != 0.0:
-            highFWHM = (hHalfMax - highFuncB)/highFuncA
-    else:
-        lowFWHM = cloneHist.GetBinLowEdge(lowBin) + cloneHist.GetBinWidth(lowBin)
-        highFWHM = cloneHist.GetBinLowEdge(highBin)
-
-    if debug: print "lowBin = ", lowBin-hMaxBin, ", lowFWHM =  ", lowFWHM, " || highBin = ",highBin-hMaxBin, ", highFWHM = ", highFWHM, ", FWHM = ",(highFWHM - lowFWHM)/2.35482
-
-
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = (highFWHM - lowFWHM)/2.35482 #divide to make equivalent to Gaussian sigma
-
-    return hNewMean, hNewRMS
-
-
-def returnTuple(FZ01,hist,legendTitle):
-
-    return FZ01,hist,legendTitle
-
-
-def noFit(hist):
-    #dummy function, does not preform a fit
-    FZ01 = TF1()
-    return FZ01
-
-def noFitWithStats(hist):
-    #dummy function, this fit will not be drawn
-    FZ01 = TF1("noFitWithStats","gaus",-1.0,1.0)
-    return FZ01
-
-
-def singleGaus(hist):
-
-    #min = -1.5
-    #max = 1.5
-
-    min = hist.GetBinLowEdge(1)
-    max = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    min = -2.0
-    max =  2.0
-    FZ01 = TF1("FZ01", "gaus", min,max)
-
-    FZ01.SetLineWidth(2)
-    hist.Fit("FZ01", "ORQ","same")
-    
-    return FZ01
-
-def singleGausRestricted(hist):
-
-    # performs single Gaussian fit within 1.5*RMS range
-    max = hist.GetMean() + 1.5*hist.GetRMS()
-    min = hist.GetMean() - 1.5*hist.GetRMS()
-    
-    FZ01 = TF1("FZ01", "gaus", min,max)
-
-    FZ01.SetLineWidth(2)
-    hist.Fit("FZ01", "ORQ","same")
-    
-    return FZ01
-
-def singleGausIterative(hist, sigmaRange):
-
-    debug = False
-
-    # first perform a single Gaus fit across full range of histogram
-    min = hist.GetBinLowEdge(1)
-    max = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    fitA = TF1("fitA", "gaus", min,max)
-    hist.Fit("fitA","ORQN","same")
-    fitAMean = fitA.GetParameter(1)
-    fitASig = fitA.GetParameter(2)
-
-    # performs a second fit with range determined by first fit
-    max = fitAMean + (fitASig*sigmaRange)
-    min = fitAMean - (fitASig*sigmaRange)
-    fitB = TF1("fitB", "gaus", min,max)
-    hist.Fit("fitB","ORQN","same")
-    fitMean = fitB.GetParameter(1)
-    fitSig = fitB.GetParameter(2)
-    
-    newFitSig = 99999
-    newFitMean = 99999
-    i = 0
-    max = fitMean + (fitSig*sigmaRange)
-    min = fitMean - (fitSig*sigmaRange)
-    fit = TF1("fit", "gaus", min,max)
-
-    while abs(fitSig - newFitSig) > 0.0005 or abs(fitMean - newFitMean) > 0.0005:
-        
-        if(i > 0):
-            fitMean = newFitMean
-            fitSig = newFitSig
-        #print "i = ",i," fitMean = ",fitMean," fitSig = ",fitSig
-        max = fitMean + (fitSig*sigmaRange)
-        min = fitMean - (fitSig*sigmaRange)
-        fit.SetRange(min,max)
-        hist.Fit("fit","ORQN","same")
-        newFitMean = fit.GetParameter(1)
-        newFitSig = fit.GetParameter(2)
-        #print "i = ",i," newFitMean = ", newFitMean, " newFitSig = ",newFitSig
-        if(i > 50):
-            if debug:
-                print "WARNING terminate iterative gaus fit because of convergence problems"
-                print "final mean =  ", newFitMean, ", previous iter mean = ", fitMean
-                print "final sigma =  ", newFitSig, ", previous iter sigma = ", fitSig
-            break
-
-        i = i + 1
-
-
-
-    if debug:
-        print "Final i = ",i," finalFitMean = ", fit.GetParameter(1), " finalFitSig = ",fit.GetParameter(2)
-
-    fit.SetLineWidth(2)
-    
-    return fit
-
-
-def freeDoubleGaus(hist,fitInput):
-
-    #this fit is not very stable, very sensitive to 
-    #initial fitInput parameters (width,mean, normalisation etc)
-    #use instead the doubleGaus method below
-
-    min = -0.5
-    max = 0.5
-    #print "Fitting from",min,"to",max
-    FZ01 = TF1("FZ01","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min,max)
-    FZ01.SetParameter(0,fitInput[0])
-    FZ01.SetParameter(1,fitInput[1])
-    FZ01.SetParameter(2,fitInput[2])
-    FZ01.SetParameter(3,fitInput[3])
-    FZ01.SetParameter(4,fitInput[4])
-    FZ01.SetParameter(5,fitInput[5])
-    FZ01.SetLineWidth(2)
-
-    hist.Fit("FZ01", "ORQ","same")
-
-    return FZ01
-
-def doubleGaus(hist):
-
-    #first we make a single Gauss fit over entire range
-    #to determine the range for the core Gauss fit below
-    min_temp = hist.GetBinLowEdge(1)
-    max_temp = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    fit_temp = TF1("fit_temp","gaus",min_temp,max_temp)
-    hist.Fit("fit_temp", "RQON")
-    fitMean_temp = fit_temp.GetParameter(1)
-    fitSig_temp  = fit_temp.GetParameter(2)
-
-    #we make a single Gauss fit to the core
-    minCore = fitMean_temp - 1.0*fitSig_temp
-    maxCore = fitMean_temp + 1.0*fitSig_temp
-    FCore = TF1("FCore","gaus",minCore,maxCore)
-    hist.Fit("FCore","RQON")
-
-    #we make the first double Gauss fit, fixing the mean and width of one 
-    #of the Gaussians to that of the core Gauss fit, and letting the second
-    #Gauss vary but with some sensible starting point
-    FFixCore = TF1("FFixCore","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min_temp,max_temp)
-    FFixCore.SetParameter(0,FCore.GetParameter(0))
-    FFixCore.FixParameter(1,FCore.GetParameter(1))
-    FFixCore.FixParameter(2,FCore.GetParameter(2))
-    #FFixCore.SetParameter(3,FCore.GetParameter(0)/3.0) #normalisation
-    FFixCore.SetParameter(3,FCore.GetParameter(0)/5.0) #normalisation
-    FFixCore.SetParameter(4,FCore.GetParameter(1))     #mean
-    #FFixCore.SetParameter(5,FCore.GetParameter(2)*5.0) #width
-    FFixCore.SetParameter(5,FCore.GetParameter(2)*2.0) #width
-    hist.Fit("FFixCore","RQON")
-        
-    #we do the final double Gaussian fit letting everything vary but using 
-    #as inputs the result of the previous constrained fit
-    FFull = TF1("FFull","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min_temp,max_temp)
-    FFull.SetParameter(0,FFixCore.GetParameter(0))
-    FFull.SetParameter(1,FFixCore.GetParameter(1))
-    FFull.SetParameter(2,FFixCore.GetParameter(2))
-    FFull.SetParameter(3,FFixCore.GetParameter(3))
-    FFull.SetParameter(4,FFixCore.GetParameter(4))
-    FFull.SetParameter(5,FFixCore.GetParameter(5))
-    hist.Fit("FFull","RQO","same")
-    
-    #print "FFull core mean = ",FFull.GetParameter(1)," width = ",FFull.GetParameter(2)
-    #print "FFull tail mean = ",FFull.GetParameter(4)," width = ",FFull.GetParameter(5)
-        
-    
-    return FFull
-
-def doubleFit(hist,units,color,xLeft,yLow,same):
-    min_temp = hist.GetBinLowEdge(0)
-    max_temp = hist.GetBinLowEdge(hist.GetNbinsX())
-    fit_temp = TF1("fit_temp","gaus",min_temp,max_temp)
-    if same:
-        hist.Fit("fit_temp", "ORQ","same")
-    else:
-        hist.Fit("fit_temp", "ORQ","")
-    fitMean_temp = fit_temp.GetParameter(1)
-    fitSig_temp  = fit_temp.GetParameter(2)
-    min = fitMean_temp - 1.5* fitSig_temp
-    max = fitMean_temp + 1.5 * fitSig_temp
-    fit = TF1("fit","gaus",min,max )
-    fit.SetLineColor(color)
-    if same:
-        hist.Fit("fit", "ORQ","same")
-    else:
-        hist.Fit("fit", "ORQ","")
-    fit.Draw("same")
-
-    # Draw the after mean and sigma
-    text = "#mu="
-    text += str(round(fit.GetParameter(1),5))
-    text += " "+units+", #sigma="
-    text += str(round(fit.GetParameter(2),4))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetLineColor(color)
-    m_l.SetTextSize(0.03)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.SetTextColor(color)
-    print text
-    m_l.DrawLatex(xLeft,yLow,text)
-
-def quoteMeanAndRMS(hist,units,color,xLeft,yLow,same):
-    
-    # Draw the after mean and sigma
-    text = "mean = "
-    text += str(round(hist.GetMean(),5))
-    text += " "+units+", RMS = "
-    text += str(round(hist.GetRMS(),4))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetLineColor(color)
-    m_l.SetTextSize(0.03)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.SetTextColor(color)
-    print text
-    m_l.DrawLatex(xLeft,yLow,text)
-
-
-def plotStatVersusFile(rootFiles, histDirectories, fileLabels, nFiles, histogramName, meanFWHM=0):
-
-    # plots mean of a particular histogram for different files as separate 
-    # entries on x-axis
-
-    statHist = TH1F("statHist","statHist",3,0.,3.)
-
-    for i in range(nFiles):
-
-        hist = GetHistogram(rootFiles[i],histDirectories[i],histogramName,1,29)
-        #RemoveNegativeYAxis(hist,histogramName)
-        #hist.Scale(2.0)
-        mean = hist.GetMean()
-        rms = hist.GetRMS()
-        entries = hist.GetEntries()
-        sqrtEntries = math.sqrt(entries);
-        meanErr = rms/sqrtEntries
-        print "mean = ", mean, ", rms = ", rms, ", entries = ",entries, ", sqrtEntries = ", sqrtEntries, ", meanErr = ", meanErr
-        
-        if meanFWHM==0:
-            statHist.SetBinContent(i+1,mean)
-            statHist.SetBinError(i+1,meanErr)
-        else:
-            meanFWHMTuple = findMeanRMSUsingFWHM(hist)
-            print "mean =", meanFWHMTuple[0]
-            print "FWHM/2.35 = ", meanFWHMTuple[1]
-            statHist.SetBinContent(i+1,meanFWHMTuple[1])
-            statHist.SetBinError(i+1,0.00000001)#no error defined for FWHM
-
-        statHist.GetXaxis().SetBinLabel(i+1,fileLabels[i])
-        
-    if meanFWHM==0:
-        statHist.GetYaxis().SetRangeUser(-0.005,0.005)
-    #else:
-    #    statHist.GetYaxis().SetRangeUser(0.0,0.2)
-    statHist.GetXaxis().SetLabelSize(0.06)
-
-
-    return statHist
-
-
-def simpleDrawSingleHist(hist, yAxisTitle, xAxisTitle, plotTitle,  
-              canvasText,markerStyle,markerColor,outputName="test.png", textBoxLeftX=0.55, textBoxUpperY=0.84):
-
-    can = TCanvas(outputName,outputName,800,600)
-    can.cd()
-    plotTitleOnFirstLine = True
-
-    hist.GetXaxis().SetTitle(xAxisTitle)
-    hist.GetYaxis().SetTitle(yAxisTitle)
-    hist.GetYaxis().SetTitleOffset(1.2)
-    hist.SetMarkerStyle(markerStyle)
-    hist.SetMarkerColor(markerColor)
-    hist.Draw()
-  
-    # canvas text (right hand side)
-    latexAtlas = TLatex()
-    latexAtlas.SetNDC()
-    latexAtlas.SetTextColor(1)
-    latexAtlas2 = TLatex()
-    latexAtlas2.SetNDC()
-
-    if(plotTitleOnFirstLine):
-        latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0] + "  " + plotTitle)
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,canvasText[1])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[2])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[3])    
-    else:
-        latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,plotTitle)
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[1])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[2])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.24,canvasText[3])
-  
-    can.SaveAs(outputName)
-
-
-def Test(histogramName):
-
-    print "histoName = ", histogramName
-
-    if "bin-" in histogramName:
-#        binNum = (histogramName.split('-'))
-#        print "binNum = ", binNum[1]
-        binNum = (histogramName.split('-'))[1]
-        print "binNum = ", binNum        
-
-#############################################################################################################
-def niceSCTBarrelMap (inputHisto):
-    #remove the ugly bin at eta=0 of the sct barrel maps and label the eta rings properly
-    debug = False
-    outputHisto = inputHisto.Clone()
-    if (inputHisto.GetNbinsX() == 13):
-        if (debug): print " -- niceSCTBarrelMap -- input histogram ",inputHisto.GetTitle()," has 13 bins"
-        outputHisto = TH2D("new"+inputHisto.GetName(), inputHisto.GetTitle(), 12, -6.5, 5.5, 
-                           inputHisto.GetNbinsY(), inputHisto.GetYaxis().GetXmin(), inputHisto.GetYaxis().GetXmax())
-        #change the X axis bin labels
-        thisetaring = -7 # init with a value one below
-        for bin in range(outputHisto.GetNbinsX()):
-            thisetaring += 1
-            if (thisetaring == 0): thisetaring = 1
-            outputHisto.GetXaxis().SetBinLabel(bin+1, str(thisetaring))
-
-        # fill the histogram
-        logicbinx = 0
-        for binx in range(outputHisto.GetNbinsX()):
-            logicbinx +=1
-            if (logicbinx == 7): logicbinx += 1 #avoid the bin of the unexistent ring 0
-            for biny in range(outputHisto.GetNbinsY()):    
-                outputHisto.SetBinContent(binx+1, biny+1, inputHisto.GetBinContent(logicbinx, biny+1)) 
-
-        outputHisto.SetXTitle(inputHisto.GetXaxis().GetTitle())
-        outputHisto.SetYTitle(inputHisto.GetYaxis().GetTitle())
-                
-    return outputHisto
-
-###########################################################################################################
-def getPIXEndCapMapHisto (inputHisto, disk):
-    
-    #split the pixels hit maps histo of the end caps as all the disks are kept in the same histogram
-    debug = False
-    if (debug): print " -- getPIXEndCapMapHisto -- start -- extracting disk ", disk ," from histo ",inputHisto.GetName()
-
-    outputHisto = TH2F(inputHisto.GetName()+"_d"+str(disk),inputHisto.GetTitle()+" disk "+str(disk), 
-                       inputHisto.GetNbinsY(), inputHisto.GetYaxis().GetXmin(), inputHisto.GetYaxis().GetXmax(),
-                       1, inputHisto.GetYaxis().GetXmin(), inputHisto.GetYaxis().GetXmax()) # same range to facilitate drawing on top
-
-    if (debug): print " -- getPIXEndCapMapHisto -- outputHisto = ",outputHisto.GetName()," xbins:", outputHisto.GetNbinsX()," ybins:",outputHisto.GetNbinsY()
-    for i in range(inputHisto.GetNbinsY()):
-        outputHisto.SetBinContent(i+1,1,inputHisto.GetBinContent(disk+1,i+1))
-
-    return outputHisto
-
-###########################################################################################################
-def getSCTEndCapMapHisto (inputHisto, disk):
-    
-    #split the pixels hit maps histo of the end caps as all the disks are kept in the same histogram
-    debug = False
-    if (debug): print " -- getSCTEndCapMapHisto -- start -- extracting disk ", disk ," from histo ",inputHisto.GetName()
-        
-    #inputHist consist in a TH3 with:
-    # x axis is disk (9)
-    # y axis is ring (up to 3 rings per disk)
-    # z axis is module phi (up to 52 modules per ring)
-    outputHisto = TH2F(inputHisto.GetName()+"_d"+str(disk),inputHisto.GetTitle()+" disk "+str(disk), 
-                       inputHisto.GetNbinsY(), inputHisto.GetYaxis().GetXmin(), inputHisto.GetYaxis().GetXmax(),
-                       inputHisto.GetNbinsZ(), inputHisto.GetZaxis().GetXmin(), inputHisto.GetZaxis().GetXmax()) 
-
-    if (debug): print " -- getSCTEndCapMapHisto -- outputHisto = ",outputHisto.GetName()," xbins:", outputHisto.GetNbinsX()," ybins:",outputHisto.GetNbinsY()
-    for ring in range(outputHisto.GetNbinsX()):
-        for module in range(outputHisto.GetNbinsY()):
-            outputHisto.SetBinContent(ring+1,module+1,inputHisto.GetBinContent(disk+1,ring+1,module+1))
-            if (debug): print " -- getSCTEndCapMapHisto -- disk: ", disk," ring:",ring," phi:",module,"  entries:",inputHisto.GetBinContent(disk+1,ring+1,module+1)
-
-    return outputHisto
-
-###########################################################################################################
-def getPIXEndCapResMapHisto (inputHisto, disk):
-                             
-    isPixel = True
-    #split the pixels hit maps histo of the end caps as all the disks are kept in the same histogram
-    debug = False
-    if (debug): print "\n\n -- getPIXEndCapResMapHisto -- remember to set debug = False \n\n" 
-    if (debug): print " -- getPIXEndCapResMapHisto -- start -- extracting disk ", disk ," from histo ",inputHisto.GetName()
-    if ("sct" in inputHisto.GetName()):  
-        isPixel = False
-        print " -- getPIXEndCapResMapHisto -- ERROR -- dealing with SCT histogram ", inputHisto.GetName()
-        
-    print " -- getPIXEndCapResMapHisto -- start -- extracting disk ", disk ," from histo ",inputHisto.GetName()
-
-    if (isPixel):
-        outputHisto = TH2F("d"+str(disk)+"_"+inputHisto.GetName(), inputHisto.GetTitle()+" disk "+str(disk), 
-                           inputHisto.GetNbinsY(), inputHisto.GetYaxis().GetXmin(), inputHisto.GetYaxis().GetXmax(),
-                           1, inputHisto.GetYaxis().GetXmin(), inputHisto.GetYaxis().GetXmax()) # same range to facilitate drawing on top
-        
-    if (debug): print " -- getPIXEndCapResMapHisto -- ouputHisto= ", outputHisto.GetName(), "  Xbins=", outputHisto.GetNbinsX(), "  Ybins=", outputHisto.GetNbinsY()    
-    for i in range(outputHisto.GetNbinsX()):
-        #project the histo per disk and module
-        thisHisto = inputHisto.ProjectionZ(inputHisto.GetName()+"_d"+str(disk)+"_m"+str(i),disk+1,disk+1,i+1,i+1)
-        if (thisHisto.GetEntries() >= MinEntriesPerModule): # min number of entries
-            outputHisto.SetBinContent(i+1, 1, 1000.*thisHisto.GetMean())
-            if (debug): print " -- getPIXEndCapResMapHisto -- disk: ", disk," module: ",i," entries:",thisHisto.GetEntries(),"  res:",1000.*thisHisto.GetMean()," bincontent=",outputHisto.GetBinContent(i+1,disk+1)
-
-                
-
-    # this is a crosscheck to avoid crashes
-    if (outputHisto.GetEntries() == 0): outputHisto.SetBinContent(1,1,0.)
-                
-    if (debug): print " -- getPIXEndCapResMapHisto -- completed -- "
-        
-    return outputHisto
-
-###########################################################################################################
-def getSCTEndCapResMapHisto (inputHisto, disk):
-                            
-    #split the sct hit maps histo of the end caps as all the disks are kept in the same histogram
-    debug = False
-    if (debug): print "\n\n -- getSCTEndCapResMapHisto -- remember to set debug = False \n\n" 
-    if (debug): 
-        print " -- getSCTEndCapResMapHisto -- start -- extracting disk ", disk ," from histo ",inputHisto.GetName()
-        print " -- getSCTEndCapResMapHisto -- start -- extracting disk ", disk ," from histo ",inputHisto.GetName()
-
-    outputHisto = TH2F("d"+str(disk)+"_"+inputHisto.GetName(), inputHisto.GetTitle()+" disk "+str(disk), 
-                       inputHisto.GetNbinsX(), inputHisto.GetXaxis().GetXmin(), inputHisto.GetXaxis().GetXmax(),
-                       inputHisto.GetNbinsY(), inputHisto.GetYaxis().GetXmin(), inputHisto.GetYaxis().GetXmax()) # same range to facilitate drawing on top
-        
-    if (debug): 
-        print " -- getSCTEndCapResMapHisto -- ouputHisto= ", outputHisto.GetName(), "  Xbins=", outputHisto.GetNbinsX(), "  Ybins=", outputHisto.GetNbinsY()
-        print "    loop on rings ", outputHisto.GetNbinsX(), " and modules ",outputHisto.GetNbinsY() 
-    for i in range(outputHisto.GetNbinsX()):
-        for j in range(outputHisto.GetNbinsY()):
-        #project the histo per disk and module
-            thisHisto = inputHisto.ProjectionZ(inputHisto.GetName()+"_d"+str(disk)+"_r"+str(i)+"_m"+str(j),i+1,i+1,j+1,j+1)
-            if (thisHisto.GetEntries() >= MinEntriesPerModule): # min number of entries
-                outputHisto.SetBinContent(i+1, j+1, 1000.*thisHisto.GetMean())
-                if (debug): print " -- getSCTEndCapResMapHisto -- disk: ", disk," ring",i," module: ",j," entries:",thisHisto.GetEntries(),"  res:",1000.*thisHisto.GetMean()," bincontent=",outputHisto.GetBinContent(i+1,j+1)
-
-                
-
-    # this is a crosscheck to avoid crashes
-    if (outputHisto.GetEntries() == 0): outputHisto.SetBinContent(1,1,0.)
-                
-    if (debug): print " -- getSCTEndCapResMapHisto -- completed -- "
-        
-    return outputHisto
-
-######################################################################################################################################        
-def MakeHitMaps(histogramDir, legendTitles, rootFiles, fileID, detecName="pixels", barrelEndCap="BAR", unifiedScale = True, coordinate=0, inputType="measurements"):
-    # The hit maps have to be plotted for each track collection
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-
-    # in this case coordinate is irrelevant for the pixels
-    # for sct, coordiante can take two values
-    # 0 --> side 0 
-    # 1 --> side 1
-    debug = False
-    totalMaxEntries = -9999999
-    totalMinEntries = 99999999
-
-    histoGram = [TH2,TH2,TH2,TH2,TH2,TH2,TH2,TH2,TH2]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple]
-
-    detecName = detecName.upper() # set to upper case
-    detecName = detecName[0:3] #truncate
-    barrelEndCap = barrelEndCap.upper()
-    barrelEndCap = barrelEndCap[0:3]
-    if (debug): print " -- MakeHitMaps -- detecName= ",detecName,"  barrelEndCap= ",barrelEndCap
-
-    # handle coordinate
-    if (coordinate < 0): coordinate = 0
-    if (coordinate > 1): coordinate = 1        
-
-    #handle type
-    tsosType = "measurements" # default
-    typeName = inputType.lower() # set to lower case    
-    typeName = typeName[0:3] #truncate
-    if (debug):print " -- MakeHitMaps -- typeName= ", typeName
-    if (typeName == "mea"): tsosType = "measurements"  
-    if (typeName == "hit"): tsosType = "hits"  
-    if (typeName == "hol"): tsosType = "holes"
-    if (typeName == "out"): tsosType = "outliers"
-                  
-    nLayers = 4 #default 4 layers 
-    if (detecName=="PIX" and barrelEndCap=="BAR"): nLayers = 4 
-    if (detecName=="PIX" and barrelEndCap=="ECA"): nLayers = 3 
-    if (detecName=="PIX" and barrelEndCap=="ECC"): nLayers = 3 
-    if (detecName=="SCT" and barrelEndCap=="BAR"): nLayers = 4 
-    if (detecName=="SCT" and barrelEndCap=="ECA"): nLayers = 9 
-    if (detecName=="SCT" and barrelEndCap=="ECC"): nLayers = 9 
-
-    shortName = "measurements_vs_Eta_Phi_pix_b"
-    if (detecName=="PIX" and barrelEndCap=="BAR"): shortName = tsosType + "_vs_Eta_Phi_pix_b" 
-    if (detecName=="PIX" and barrelEndCap=="ECA"): shortName = "measurements_vs_Eta_Phi_pix_eca"
-    if (detecName=="PIX" and barrelEndCap=="ECC"): shortName = "measurements_vs_Eta_Phi_pix_ecc"
-    if (detecName=="SCT" and barrelEndCap=="BAR"): shortName = "measurements_vs_Eta_Phi_sct_b" 
-    if (detecName=="SCT" and barrelEndCap=="ECA"): shortName = "measurements_vs_Eta_Phi_sct_eca_3d_s" 
-    if (detecName=="SCT" and barrelEndCap=="ECC"): shortName = "measurements_vs_Eta_Phi_sct_ecc_3d_s" 
-        
-        
-    # first one has to retrieve all histograms because they may be used to normalise each other, etc.     
-    if (detecName == "PIX" and barrelEndCap == "BAR"):
-        for i in range(nLayers):
-            myHistoName = shortName + str(i)
-            if (debug): print " -- MakeHitMaps -- fetching histogram names: detector ",detecName,"  layer/disk ",i,"   histo=",myHistoName 
-            print " lenght of histoGram: ", len(histoGram)     
-            histoGram[i] = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0)
-
-    if (detecName == "SCT" and barrelEndCap == "BAR"):
-        for i in range(nLayers):
-            myHistoName = shortName + str(i) + "_s" +str(coordinate)
-            if (debug): print " -- MakeHitMaps -- fetching histogram names: detector ",detecName,"  layer/disk ",i,"   histo=",myHistoName 
-            histoGram[i] = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0)
-            if (detecName=="SCT" and barrelEndCap=="BAR"): histoGram[i] = niceSCTBarrelMap (histoGram[i])
-
-    if (detecName == "PIX" and barrelEndCap != "BAR"):
-        histoEChits = GetHistogram(rootFiles[fileID],histogramDir[fileID],shortName,0,0)             
-        for disk in range(nLayers):
-            histoGram[disk] = getPIXEndCapMapHisto (histoEChits, disk)
-
-    if (detecName == "SCT" and barrelEndCap != "BAR"):
-        myHistoName = shortName + str(coordinate)
-        histoEChits = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0)             
-        print " -- MakeHitMaps -- sct end cap -- shortName = ",shortName,"   layers (disks)= ", nLayers
-        for disk in range(nLayers):
-            if (debug): print " -- MakeHitMaps -- sct end cap -- retrieving histo for disk: ",disk, " -> ", histoEChits.GetName()
-            histoGram[disk] = getSCTEndCapMapHisto (histoEChits, disk)
-            
-    #Now, the histograms are available
-    if (unifiedScale):
-        for layer in range(nLayers):
-            thismax = histoGram[layer].GetMaximum()
-            if (thismax > totalMaxEntries): totalMaxEntries = thismax
-            thismin = histoGram[layer].GetMinimum()
-            if (thismax < totalMinEntries): totalMinEntries = thismin
-        if (debug): print " -- MakeHitMaps -- entries= ",totalMinEntries, " --> ",totalMaxEntries
-        # now set the common maximum & minimum
-        if (totalMinEntries == 0): totalMinEntries = -1  
-        totalMinEntries = 1          
-        for layer in range(nLayers):
-            histoGram[layer].SetMaximum(totalMaxEntries)
-            histoGram[layer].SetMinimum(totalMinEntries)
-
-    # make a tuple object that can be passed to draw method
-    totalTuple = (histoGram[0], histoGram[1], histoGram[2], histoGram[3]) # default for 4 layers in the barel        
-    if (nLayers == 3): totalTuple = (histoGram[0], histoGram[1], histoGram[2]) # pixel end caps (3 disks)
-    if (nLayers == 9): totalTuple = (histoGram[0], histoGram[1], histoGram[2],  histoGram[3],  histoGram[4],  histoGram[5],  histoGram[6],  histoGram[7],  histoGram[8])
-        
-    return totalTuple #returning histograms and fits
-
-######################################################################################################################################        
-def MakeHitEffMaps(histogramDir, legendTitles, rootFiles, fileID, detecName="pixels", barrelEndCap="BAR", unifiedScale = True, coordinate=0):
-    # The hit maps have to be plotted for each track collection
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-
-    # in this case coordinate is irrelevant for the pixels
-    # for sct, coordiante can take two values
-    # 0 --> side 0 
-    # 1 --> side 1
-    debug = False
-    totalMaxEntries = -9999999
-    totalMinEntries = 99999999
-
-    histoGram = [TH2,TH2,TH2,TH2,TH2,TH2,TH2,TH2,TH2]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple]
-
-    detecName = detecName.upper() # set to upper case
-    detecName = detecName[0:3] #truncate
-    barrelEndCap = barrelEndCap.upper()
-    barrelEndCap = barrelEndCap[0:3]
-    if (debug): print " -- MakeHitMaps -- detecName= ",detecName,"  barrelEndCap= ",barrelEndCap
-
-    # handle coordinate
-    if (coordinate < 0): coordinate = 0
-    if (coordinate > 1): coordinate = 1        
-        
-    nLayers = 4 #default 4 layers 
-    if (detecName=="PIX" and barrelEndCap=="BAR"): nLayers = 4 
-    if (detecName=="PIX" and barrelEndCap=="ECA"): nLayers = 3 
-    if (detecName=="PIX" and barrelEndCap=="ECC"): nLayers = 3 
-    if (detecName=="SCT" and barrelEndCap=="BAR"): nLayers = 4 
-    if (detecName=="SCT" and barrelEndCap=="ECA"): nLayers = 9 
-    if (detecName=="SCT" and barrelEndCap=="ECC"): nLayers = 9 
-
-    shortName = "measurements_vs_Eta_Phi_pix_b"
-    if (detecName=="PIX" and barrelEndCap=="BAR"): shortName = "measurements_eff_vs_Eta_Phi_pix_b" 
-    if (detecName=="PIX" and barrelEndCap=="ECA"): shortName = "NO_measurements_vs_Eta_Phi_pix_eca"
-    if (detecName=="PIX" and barrelEndCap=="ECC"): shortName = "NO_measurements_vs_Eta_Phi_pix_ecc"
-    if (detecName=="SCT" and barrelEndCap=="BAR"): shortName = "measurements_eff_vs_Eta_Phi_sct_b" 
-    if (detecName=="SCT" and barrelEndCap=="ECA"): shortName = "NO_measurements_vs_Eta_Phi_sct_eca_3d_s" 
-    if (detecName=="SCT" and barrelEndCap=="ECC"): shortName = "NO_measurements_vs_Eta_Phi_sct_ecc_3d_s" 
-        
-        
-    #first have to get all the histograms because they may be used to normalise each other etc     
-    if (detecName == "PIX" and barrelEndCap == "BAR"):
-        for i in range(nLayers):
-            myHistoName = shortName + str(i)
-            if (debug): print " -- MakeHitMaps -- fetching histogram names: detector ",detecName,"  layer/disk ",i,"   histo=",myHistoName 
-            histoGram[i] = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0)
-            if (detecName=="SCT" and barrelEndCap=="BAR"): histoGram[i] = niceSCTBarrelMap (histoGram[i])
-
-    if (detecName == "SCT" and barrelEndCap == "BAR"):
-        for i in range(nLayers):
-            myHistoName = shortName + str(i) + "_s" +str(coordinate)
-            if (debug): print " -- MakeHitMaps -- fetching histogram names: detector ",detecName,"  layer/disk ",i,"   histo=",myHistoName 
-            histoGram[i] = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0)
-            if (detecName=="SCT" and barrelEndCap=="BAR"): histoGram[i] = niceSCTBarrelMap (histoGram[i])
-
-    if (detecName == "PIX" and barrelEndCap != "BAR"):
-        histoEChits = GetHistogram(rootFiles[fileID],histogramDir[fileID],shortName,0,0)             
-        for disk in range(nLayers):
-            histoGram[disk] = getPIXEndCapMapHisto (histoEChits, disk)
-
-    if (detecName == "SCT" and barrelEndCap != "BAR"):
-        myHistoName = shortName + str(coordinate)
-        histoEChits = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0)             
-        print " -- MakeHitMaps -- sct end cap -- shortName = ",shortName,"   layers (disks)= ", nLayers
-        for disk in range(nLayers):
-            if (debug): print " -- MakeHitMaps -- sct end cap -- retrieving histo for disk: ",disk, " -> ", histoEChits.GetName()
-            histoGram[disk] = getSCTEndCapMapHisto (histoEChits, disk)
-            
-    #Now, the histograms are available
-    if (unifiedScale):
-        for layer in range(nLayers):
-            thismax = histoGram[layer].GetMaximum()
-            if (thismax > totalMaxEntries): totalMaxEntries = thismax
-            thismin = histoGram[layer].GetMinimum()
-            if (thismax < totalMinEntries): totalMinEntries = thismin
-        if (debug): print " -- MakeHitMaps -- entries= ",totalMinEntries, " --> ",totalMaxEntries
-        # now set the common maximum & minimum
-        if (totalMinEntries == 0): totalMinEntries = -1 
-        totalMaxEntries = 1
-        totalMinEntries = 0          
-        for layer in range(nLayers):
-            histoGram[layer].SetMaximum(totalMaxEntries)
-            histoGram[layer].SetMinimum(totalMinEntries)
-
-    # make a tuple object that can be passed to draw method
-    totalTuple = (histoGram[0], histoGram[1], histoGram[2], histoGram[3]) # default for 4 layers in the barel        
-    if (nLayers == 3): totalTuple = (histoGram[0], histoGram[1], histoGram[2]) # pixel end caps (3 disks)
-    if (nLayers == 9): totalTuple = (histoGram[0], histoGram[1], histoGram[2],  histoGram[3],  histoGram[4],  histoGram[5],  histoGram[6],  histoGram[7],  histoGram[8])
-        
-    return totalTuple #returning histograms and fits
-
-######################################################################################################################################        
-def MakeResidualMaps(histogramDir, legendTitles, rootFiles, fileID, detecName="pixels", barrelEndCap="BAR", coordinate=0, unifiedScale = True, zAxisRange= 25, 
-                     Type = "mean", SeparateSides=True, IsRun1=False):
-    # The hit maps have to be plotted for each track collection
-    # this gets histograms from the files, normalises if desired and makes fits
-    # and returns histograms and fits
-    debug = False
-    totalMax = -9999999
-    totalMin = 99999999
-    totalRange = totalMin #intialize to an arbitrary large value
-
-    histoGram = [TH2,TH2,TH2,TH2,TH2,TH2,TH2,TH2,TH2]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple]
-
-    detecName = detecName.upper() # set to upper case
-    detecName = detecName[0:3] #truncate
-    barrelEndCap = barrelEndCap.upper()
-    barrelEndCap = barrelEndCap[0:3]
-    myCoordinate = "x" # local x residual 
-    if (detecName=="PIX" and coordinate==1): myCoordinate = "y" # local y residual of pixel modules
-
-    if (debug): print " -- MakeResidualMaps -- detecName= ",detecName,"  barrelEndCap= ",barrelEndCap
-        
-    nLayers = 4 #default 4 layers 
-    if (detecName=="PIX" and barrelEndCap=="BAR"): 
-        if (IsRun1):
-            nLayers = 3
-        else:
-            nLayers = 4
-        
-    if (detecName=="PIX" and barrelEndCap=="ECA"): nLayers = 3 
-    if (detecName=="PIX" and barrelEndCap=="ECC"): nLayers = 3 
-    if (detecName=="SCT" and barrelEndCap=="BAR"): nLayers = 4 
-    if (detecName=="SCT" and barrelEndCap=="ECA"): nLayers = 9 
-    if (detecName=="SCT" and barrelEndCap=="ECC"): nLayers = 9 
-
-    shortName = "pix_b"
-    if (detecName=="PIX" and barrelEndCap=="BAR"): shortName = "pix_b" 
-    if (detecName=="PIX" and barrelEndCap=="ECA"): shortName = "pix_eca_" # 3d histogram contains 3 disks and 48 modules per disk
-    if (detecName=="PIX" and barrelEndCap=="ECC"): shortName = "pix_ecc_" 
-    if (detecName=="SCT" and barrelEndCap=="BAR"): shortName = "sct_b" 
-    if (detecName=="SCT" and barrelEndCap=="ECA"): shortName = "sct_eca_d" 
-    if (detecName=="SCT" and barrelEndCap=="ECC"): shortName = "sct_ecc_d" 
-        
-    if (Type == "clustersize"):
-        print " good clustersize :)"
-
-    if (Type == "detailed"):
-        print " detailed maps :) "
-                
-    #first have to get all the histograms because they may be used to normalise each other etc     
-    if (barrelEndCap == "BAR"):
-        for i in range(nLayers):
-            myHistoName = shortName + str(i) + "_" + myCoordinate +"resvsmodetaphi_3d"   
-            if (detecName=="SCT"): 
-                myHistoName = shortName + str(i) + "_" + "s"+str(coordinate) + "_" + myCoordinate +"resvsmodetaphi_3d"
-                if (Type == "clustersize"): 
-                    myHistoName = shortName + str(i) + "_clustersizePhivsmodetaphi_3d_" + "s"+str(coordinate)
-                if (Type == "detailed"): 
-                    myHistoName = shortName + str(i) + "_" + "s"+str(coordinate) + "_biased_" + myCoordinate +"resvsmodetaphi_3d"
-            if (detecName=="PIX"):
-                myHistoName = shortName + str(i) + "_" + myCoordinate +"resvsmodetaphi_3d"            
-                if (Type == "detailed"): 
-                    myHistoName = shortName + str(i) + "_detailed_" + myCoordinate +"resvsmodetaphi_3d"            
-            myHistoName = Check3DHistoExists(rootFiles[fileID],histogramDir[fileID],myHistoName)
-            if (debug): print " -- MakeResidualMaps -- fetching histogram names: detector ",detecName,"  layer/disk ",i,"   histo=",myHistoName 
-            histoGram3D = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0) # retrieve the 3D histogram
-            hname = myHistoName+"_proj"
-            htitle = detecName + " residual map " + "(" + Type +")" 
-            histoGram[i] = get2DResidualMap(histoGram3D, i, Type)
-            if (detecName=="SCT" and barrelEndCap=="BAR"): histoGram[i] = niceSCTBarrelMap (histoGram[i])
-
-    if (detecName == "PIX" and barrelEndCap != "BAR"):
-        myHistoName = shortName + myCoordinate + "resvsmodphidisk_3d" 
-        histoECResi = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0)             
-        for disk in range(nLayers):
-            histoGram[disk] = getPIXEndCapResMapHisto (histoECResi, disk)
-
-    if (detecName == "SCT" and barrelEndCap != "BAR"):
-        for disk in range(nLayers):
-            myHistoName = shortName + str(disk) + "_s" + str(coordinate)+ "_xresvsmodetaphi_3d" 
-            histoEChits = GetHistogram(rootFiles[fileID],histogramDir[fileID],myHistoName,0,0)
-            if (debug): print " -- MakeResidualMaps --> histoEChits:",myHistoName ," Bins X = ", histoEChits.GetNbinsX(), "   Bins Y= ", histoEChits.GetNbinsY()            
-            histoGram[disk] = getSCTEndCapResMapHisto (histoEChits, disk)
-
-
-    #Now, the histograms are available
-    if (unifiedScale):
-        for layer in range(nLayers):
-            if (debug): print " -- MakeResidualMaps -- histoGram[",layer,"].GetName()= ",histoGram[layer].GetName()
-            thismax = histoGram[layer].GetMaximum()
-            if (thismax > totalMax): totalMax = thismax
-            thismin = histoGram[layer].GetMinimum()
-            if (thismax < totalMin): totalMin = thismin
-        if (debug): print " -- MakeResidualMaps -- computed Z range= ",totalMin, " --> ",totalMax
-        totalRange = math.fabs(totalMax)
-        if (math.fabs(totalMin) > totalRange): totalRange = math.fabs(totalMin)
-        if (totalRange > zAxisRange): totalRange = zAxisRange
-        if (totalRange < zAxisRange): totalRange = zAxisRange
-
-        # now set the common maximum & minimum
-        if (debug): print " -- MakeResidualMaps -- drawing Z range= ",-totalRange," --> ",totalRange
-        for layer in range(nLayers):
-            histoGram[layer].SetMaximum(totalRange)
-            histoGram[layer].SetMinimum(-totalRange)
-                
-    else:
-        # each layer has its own range, but it should be symmetric
-        for layer in range(nLayers):
-            thismax = histoGram[layer].GetMaximum()
-            thismin = histoGram[layer].GetMinimum()
-            if (math.fabs(thismin) > math.fabs(thismax)):
-                thismax = math.fabs(thismin)
-            histoGram[layer].SetMaximum(thismax)
-            histoGram[layer].SetMinimum(-thismax)
-                  
-    if (Type == "width" or Type== "clustersize"): 
-        for layer in range(nLayers):
-            histoGram[layer].SetMinimum(0)
-
-    # make a tuple object that can be passed to draw method
-    totalTuple = (histoGram[0], histoGram[1], histoGram[2], histoGram[3]) # default for 4 layers in the barel        
-    if (nLayers == 3): totalTuple = (histoGram[0], histoGram[1], histoGram[2]) # pixel end caps (3 disks)
-    if (nLayers == 9): totalTuple = (histoGram[0], histoGram[1], histoGram[2],  histoGram[3],  histoGram[4],  histoGram[5],  histoGram[6],  histoGram[7],  histoGram[8])
-        
-    return totalTuple #returning histograms and fits
-
-###########################################################################################################################
-def getIBLResidualBySensorType(inputHisto, layer, draw3DSensors, drawPlanarSensors, fileID=0, side = "all"):
-    sideFor3DSensors = side.upper()
-    sideFor3DSensors = sideFor3DSensors[0:3]
-    drawCSide = False
-    drawASise = False
-    if (draw3DSensors and sideFor3DSensors == "ALL"):
-        drawCSide = True
-        drawASide = True
-    if (draw3DSensors and sideFor3DSensors == "ASI"):
-        drawCSide = False
-        drawASide = True
-    if (draw3DSensors and sideFor3DSensors == "CSI"):
-        drawCSide = True
-        drawASide = False
-
-    # the input histo is a 3D
-    hname = inputHisto.GetName() + "_ResMean"
-    if (draw3DSensors): hname = hname + "_3D_F" + str(fileID) 
-    if (drawPlanarSensors): hname = hname + "_Planar" + str(fileID)     
-    htitle = " residual map " + "(mean)" 
-
-    # define the 2d map
-    outputHisto = TH2F(hname, htitle, inputHisto.GetXaxis().GetNbins(), 
-                       inputHisto.GetXaxis().GetXmin(),
-                       inputHisto.GetXaxis().GetXmax(),
-                       inputHisto.GetYaxis().GetNbins(), 
-                       inputHisto.GetYaxis().GetXmin(),
-                       inputHisto.GetYaxis().GetXmax());
-
-    outputHisto1D = TH1F(hname, htitle, inputHisto.GetZaxis().GetNbins(), 
-                       inputHisto.GetZaxis().GetXmin(),
-                       inputHisto.GetZaxis().GetXmax());
-    # fill the map
-    for i in range (outputHisto.GetXaxis().GetNbins()):
-        for j in range (outputHisto.GetYaxis().GetNbins()):
-            thisHisto = inputHisto.ProjectionZ(hname+"_zmean"+str(layer)+str(i)+str(j),i+1,i+1,j+1,j+1)
-            #if (i < 4 ): thisHisto = inputHisto.ProjectionZ(hname+"_zmean"+str(layer)+str(i)+str(j), 1, 4, 1, outputHisto.GetYaxis().GetNbins())
-            #if (4<= i and i <= 15): thisHisto = inputHisto.ProjectionZ(hname+"_zmean"+str(layer)+str(i)+str(j), 5, 16, 1, outputHisto.GetYaxis().GetNbins())
-            #if (16 <= i): thisHisto = inputHisto.ProjectionZ(hname+"_zmean"+str(layer)+str(i)+str(j), 17, 20, 1, outputHisto.GetYaxis().GetNbins())
-            if (thisHisto.GetEntries() >= MinEntriesPerModule): # min number of entries
-                outputHisto.SetBinContent(i+1,j+1,1000.*thisHisto.GetMean())
-
-
-    if (draw3DSensors): 
-        outputHisto1D = inputHisto.ProjectionZ(hname+"_zmean"+str(layer)+str(i)+str(j), 1, 4, 1, outputHisto.GetYaxis().GetNbins())
-        outputHisto1D_2 = inputHisto.ProjectionZ(hname+"_zmean2"+str(layer)+str(i)+str(j), 17, 20, 1, outputHisto.GetYaxis().GetNbins())
-        if ( not drawCSide): outputHisto1D.Reset()
-        if ( not drawASide): outputHisto1D_2.Reset()
-        outputHisto1D.Add(outputHisto1D_2)
-
-    if (drawPlanarSensors): 
-        outputHisto1D = inputHisto.ProjectionZ(hname+"_zmean"+str(layer)+str(i)+str(j), 5, 16, 1, outputHisto.GetYaxis().GetNbins())
-
-    return outputHisto1D
-
-def get1DFrom2D(inputHisto, thistype = "mean",custombins=[]):
-    hname = inputHisto.GetName()+"_ResMean"
-    htitle= "residual map " + "(" + thistype +")"
-    
-    outputHisto = TH1F(hname,htitle,inputHisto.GetXaxis().GetNbins(),
-                       inputHisto.GetXaxis().GetXmin(),
-                       inputHisto.GetZaxis().GetXmax())
-
-    #fill the histo
-
-    for i in range (outputHisto.GetXaxis().GetNbins()):
-        thisHisto =inputHisto.ProjectionY(hname+"_ymean"+str(i),i+1,i+1)
-        if (thishist.GetEntries()>=MinEntriesPerModule):
-            meeanFWHMTuple = findMeanRMSUsingFWHM(thisHisto)
-            if (thistype=="mean"):  outputHisto.SetBinContent(i+1,1000.*meanFWHMTuple[0])
-            if (thistype=="width"): outputHisto.SetBinContent(i+1,1000.*meanFWHMTuple[1])
-    return outputHisto
-###########################################################################################################################
-def get2DResidualMap(inputHisto, layer, thistype = "mean"):
-    # the input histo is a 3D
-    hname = inputHisto.GetName() + "_ResMean"
-    htitle = " residual map " + "(" + thistype +")"  
-
-    # define the 2d map
-    outputHisto = TH2F(hname, htitle, inputHisto.GetXaxis().GetNbins(), 
-                       inputHisto.GetXaxis().GetXmin(),
-                       inputHisto.GetXaxis().GetXmax(),
-                       inputHisto.GetYaxis().GetNbins(), 
-                       inputHisto.GetYaxis().GetXmin(),
-                       inputHisto.GetYaxis().GetXmax());
-    # fill the map
-    for i in range (outputHisto.GetXaxis().GetNbins()):
-        for j in range (outputHisto.GetYaxis().GetNbins()):
-            thisHisto = inputHisto.ProjectionZ(hname+"_zmean_"+str(layer)+str(i)+str(j),i+1,i+1,j+1,j+1)
-            if (thisHisto.GetEntries() >= MinEntriesPerModule): # min number of entries
-                #FindMeanRMSUsingFWHM
-                meanFWHMTuple = findMeanRMSUsingFWHM(thisHisto)
-                #print "mean =", meanFWHMTuple[0]
-                #print "FWHM/2.35 = ", meanFWHMTuple[1]
-                #outputHisto.SetBinContent(i+1,j+1,1000.*thisHisto.GetMean())
-                if (thistype == "mean"): outputHisto.SetBinContent(i+1,j+1,1000.*meanFWHMTuple[0])
-                if (thistype == "width"): outputHisto.SetBinContent(i+1,j+1,1000.*meanFWHMTuple[1])
-                if (thistype == "clustersize"): outputHisto.SetBinContent(i+1,j+1, thisHisto.GetMean())#outputHisto.SetBinContent(i+1,j+1, meanFWHMTuple[0])
-                if (thistype == "detailed"): outputHisto.SetBinContent(i+1,j+1,1000.*meanFWHMTuple[0])
-
-    return outputHisto
-
-###########################################################################################################################
-def Check3DHistoExists(rootFile,histogramDir,histogramName):
-    # this function is basically to avoid an execution error after splitting the sct barrel residual histograms in side 0 and 1
-
-    myhist = rootFile.Get(histogramDir + histogramName)
-    #print " myhist = ", myhist, "  id(myhist)=",id(myhist)
-    
-    if (not not myhist): 
-        # print " 1) exists :)"
-        outputName = histogramName
-    else: 
-        # print " 1) does not exist !!! :("
-       if (histogramName == "sct_b0_s0_xresvsmodetaphi_3d"): histogramName = "sct_b0_xresvsmodetaphi_3d"
-       if (histogramName == "sct_b0_s1_xresvsmodetaphi_3d"): histogramName = "sct_b0_xresvsmodetaphi_3d"
-       if (histogramName == "sct_b1_s0_xresvsmodetaphi_3d"): histogramName = "sct_b1_xresvsmodetaphi_3d"
-       if (histogramName == "sct_b1_s1_xresvsmodetaphi_3d"): histogramName = "sct_b1_xresvsmodetaphi_3d"
-       if (histogramName == "sct_b2_s0_xresvsmodetaphi_3d"): histogramName = "sct_b2_xresvsmodetaphi_3d"
-       if (histogramName == "sct_b2_s1_xresvsmodetaphi_3d"): histogramName = "sct_b2_xresvsmodetaphi_3d"
-       if (histogramName == "sct_b3_s0_xresvsmodetaphi_3d"): histogramName = "sct_b3_xresvsmodetaphi_3d"
-       if (histogramName == "sct_b3_s1_xresvsmodetaphi_3d"): histogramName = "sct_b3_xresvsmodetaphi_3d"
-    
-    outputName = histogramName
-    return outputName
-
-###########################################################################################################################
-def PrintHitMapExtraAxis (i, inputHis, detecName = "PIX", barrelEndCap = "BAR"):
-    debug = False
-    if (barrelEndCap == "BAR" and True):            
-        whereInY = inputHis.GetYaxis().GetXmax()
-        whereInXmin = inputHis.GetXaxis().GetXmin()
-        whereInXmax = inputHis.GetXaxis().GetXmax()
-        if (debug): print " WhereInY: ", whereInY, '  whereInXmin:',  whereInXmin,'  whereInXmax:', whereInXmax
-        zAxisRange = 840 # in mm and for SCT
-        if (detecName == "PIX"): zAxisRange = 400
-        if (detecName == "PIX" and i == 0): zAxisRange = 330 #IBL   
-        ATLZaxis = TGaxis(whereInXmin,whereInY,whereInXmax,whereInY,-zAxisRange, zAxisRange, 510,"-")
-        SetOwnership(ATLZaxis, False)
-        ATLZaxis.SetName("Z")
-        ATLZaxis.SetLabelSize(inputHis.GetZaxis().GetLabelSize());
-        ATLZaxis.SetLabelOffset(0.0);
-        ATLZaxis.SetLabelFont(inputHis.GetZaxis().GetLabelFont());
-        ATLZaxis.SetTitleSize(inputHis.GetZaxis().GetTitleSize());
-        ATLZaxis.SetTitleFont(inputHis.GetZaxis().GetTitleFont());
-        ATLZaxis.SetTitle(" z [mm]");
-        if (not (detecName == "PIX" and i == 0)):ATLZaxis.Draw();
-    return
-            
-###########################################################################################################################
-def DrawHitMaps(inputTuple, outputName, xAxisTitle, yAxisTitle, zAxisTitle, legendLeftX, legendUpperY, units, 
-              canvasText, makeOutput, detecName = "PIX", barrelEndCap = "BAR", paletteStyle = 1):
-
-    debug = False
-    # dynamicYRange=True means that the y-range of the histogram drawn first is adjusted so that 
-    # all the histograms will fit into this range. If False then the default y-range of the first histogram is used.
-    
-    detecName = detecName.upper() # set to upper case
-    detecName = detecName[0:3] #truncate
-    barrelEndCap = barrelEndCap.upper()
-    barrelEndCap = barrelEndCap[0:3]
-    
-    if (debug): print " -- DrawHitMaps -- start --- output name = ",outputName,"   detec=",detecName,"   Barrel/Endcap= ",barrelEndCap 
-
-    nHist = len(inputTuple)
-    if (debug): print " -- DrawHitMaps -- nHist= ", nHist,"  inputTuple= ",inputTuple
-    
-    can = TCanvas(outputName,outputName,1200,900)
-    gStyle.SetPadTopMargin(0.08)
-    gStyle.SetPadRightMargin(0.12)
-    gStyle.SetLabelOffset(0.015,"y")
-    gStyle.SetLabelSize(0.045,"x")
-    gStyle.SetLabelSize(0.045,"y")
-    gStyle.SetPadTickX(0) # no X axis ticks in the top 
-    can.Divide(2,2)
-    if (detecName == "PIX" and barrelEndCap != "BAR"): 
-        del can
-        can = TCanvas(outputName,outputName,900,300)
-        can.Divide(3,1)
-
-    if (detecName == "SCT" and barrelEndCap != "BAR"): 
-        del can
-        can = TCanvas(outputName,outputName,900,900)
-        can.Divide(3,3)
-
-    if (debug): print " -- DrawHitMaps -- canvas ", outputName," created :)"
-        
-    if (debug): print " -- DrawHitMaps -- going to loop over ",nHist," histograms of detec=",detecName,"   Barrel/Endcap= ",barrelEndCap 
-    # colors
-    gStyle.SetPalette(1) # 53= dark body radiator; 1= standard; 55 = rainbow
-    Palette_EffiPlots = TExec("SetPalette_TrafficLights","gStyle->SetPalette(1)")
-    if(paletteStyle != 1): Palette_EffiPlots = TExec("Palette_TrafficLights",'TPython::Exec("preparePalette('+str(paletteStyle)+')")') 
-    Palette_EffiPlots.Draw();
-
-    # title of the histograms
-    latexTitle = TLatex()
-    latexTitle.SetNDC()
-    latexTitle.SetTextColor(1)
-    gStyle.SetPaintTextFormat("4.0f")
-    if ("eff") in zAxisTitle: gStyle.SetPaintTextFormat("4.2f")
-    if ("cluster" in zAxisTitle): gStyle.SetPaintTextFormat("4.1f")
-
-    for i in range(nHist):
-        can.cd(i+1)
-        myDrawOptions = "colz text"
-        if ("detailed" in inputTuple[i].GetTitle()): 
-            myDrawOptions = "colz" #do not print the values
-            print " detailed found --> no numbers "
-        print " histo ",i," title: ", inputTuple[i].GetTitle() 
-        inputTuple[i].GetXaxis().SetTitle(xAxisTitle)
-        inputTuple[i].GetYaxis().SetTitle(yAxisTitle)
-        inputTuple[i].GetZaxis().SetTitle(zAxisTitle)
-        # --> it is not working # gStyle.SetPadTickX(0) # hitmaps have a different axis on top
-        if (debug): print " -- DrawHitMaps -- i=",i,"   detec=",detecName,"   Barrel/Endcap= ",barrelEndCap 
-        if (detecName == "PIX" and barrelEndCap == "BAR"): 
-            inputTuple[i].Draw(myDrawOptions)    
-            myTitle = "Pixel barrel layer " + str(i-1)
-            if (i == 0): myTitle = " IBL " # special case   
-        if (detecName == "SCT" and barrelEndCap == "BAR"): 
-            inputTuple[i].Draw(myDrawOptions)    
-            myTitle = "SCT barrel layer " + str(i)
-        if (detecName == "PIX" and barrelEndCap != "BAR"): 
-            DrawPixelECMap(inputTuple[i])
-            myTitle = "Pixel end cap disk " + str(i)
-        if (detecName == "SCT" and barrelEndCap != "BAR"): 
-            DrawSCTECMap(inputTuple[i], i)
-            myTitle = "SCT end cap disk " + str(i)
-        Palette_EffiPlots.Draw();
-        gPad.Update()
-        PrintHitMapExtraAxis(i, inputTuple[i], detecName, barrelEndCap)
-            
-        # legend
-        if (debug): print " -- DrawHitMaps -- histogram title =",myTitle 
-        latexTitle.DrawLatex(legendLeftX, legendUpperY, myTitle)
-           
-        if ("detailed" in inputTuple[i].GetTitle()):
-            DrawModuleGrid ( detecName, inputTuple[i], i);    
-            
-            
-    if (debug): print " -- DrawHitMaps -- completed -- "    
-    if makeOutput:
-        can.SaveAs(outputName)
-
-    return can
-
-###########################################################################################################################
-def DrawModuleGrid(detecName, inputHisto, layer=0):
-    debug = False
-    if (debug): print " -- DrawModuleGrid -- start -- for detect", detecName, " NbinsX:",inputHisto.GetNbinsX()
-
-    nbinsx = inputHisto.GetNbinsX()
-    nbinsy = inputHisto.GetNbinsY()
-    xmin = inputHisto.GetXaxis().GetBinLowEdge(1)    
-    xmax = inputHisto.GetXaxis().GetBinUpEdge(nbinsx)    
-    ymin = inputHisto.GetYaxis().GetBinLowEdge(1)    
-    ymax = inputHisto.GetYaxis().GetBinUpEdge(nbinsy)    
-    nCells = 1
-    firstRing = -6
-    nRings = 12
-
-    if (detecName == "SCT"): 
-        nCells = inputHisto.GetNbinsX()/12
-        print " -- DrawModuleGrid --  NbinsX:",inputHisto.GetNbinsX()," --> module cells:", nCells, "x", nCells
-    if (detecName == "PIX"): 
-        nCells = inputHisto.GetNbinsX()/13
-        firstRing = -6
-        nRings = 13
-        if (layer==0):
-            nCells = inputHisto.GetNbinsX()/20
-            firstRing = -10
-            nRings = 20
-            
-        print " -- DrawModuleGrid -- detector:", detecName," layer:",layer,"  NbinsX:",inputHisto.GetNbinsX()," --> module cells:", nCells, "x", nCells
-
-    nSectors = inputHisto.GetNbinsY()/nCells
-    
-    for ring in range(nRings):
-        logicRing = firstRing+ring
-        thisx = inputHisto.GetXaxis().GetBinLowEdge((ring+1)*nCells+1) 
-        xline = TLine(thisx,ymin,thisx,ymax)
-        xline.SetLineColor(kBlue)
-        xline.Draw()    
-        print " ring: ",ring, "  logic ring: ",firstRing+ring," bin:",(ring+1)*nCells+1," x=",thisx
-        SetOwnership(xline, False)
-
-    for sector in range(nSectors):
-        thisy = inputHisto.GetYaxis().GetBinLowEdge((sector+1)*nCells+1) 
-        yline = TLine(xmin,thisy,xmax,thisy)
-        yline.Draw()    
-        print " sector: ", sector," bin:",sector*nCells+1," y=",thisy
-        SetOwnership(yline, False)
-    
-
-    return
-###########################################################################################################################
-def DrawSCTECMap(inputHisto, disk):
-    debug = False
-    if (debug): print " -- DrawSCTECMap -- start -- for disk ", disk, " entries:",inputHisto.GetEntries(),"  binsX=",inputHisto.GetNbinsX(),"  binsY=",inputHisto.GetNbinsY()
-
-    if (debug): print "define boxsct"
-    boxsct = TH2F(inputHisto.GetName()+"_box_"+str(disk), inputHisto.GetTitle(), 52, -10, 10, 52, -10, 10);
-    for i in range(inputHisto.GetNbinsX()):
-        for j in range(inputHisto.GetNbinsY()):
-            boxsct.SetBinContent(i+1,j+1,inputHisto.GetBinContent(i+1,j+1))
-    boxsct.GetXaxis().SetLabelColor(kWhite)
-    boxsct.GetYaxis().SetLabelColor(kWhite)
-    boxsct.GetXaxis().SetTitle("X axis")
-    boxsct.GetYaxis().SetTitle("Y axis")
-    boxsct.SetMaximum(inputHisto.GetMaximum())
-    boxsct.SetMinimum(inputHisto.GetMinimum())
-    SetOwnership(boxsct, False)
-    boxsct.Draw("colz text")    
-    gPad.Update()
-    
-    #now draw a blank on top
-    blank = TBox(boxsct.GetXaxis().GetXmin(),boxsct.GetYaxis().GetXmin(), boxsct.GetXaxis().GetXmax(), boxsct.GetYaxis().GetXmax())
-    blank.SetFillStyle(1001) # solid
-    blank.SetFillColor(kWhite)
-    SetOwnership(blank, False)
-    blank.Draw()
-    gPad.Update()
-    #blank.Print()
-
-    # Let's draw the wheels 
-    # -parameters
-    nrings = [2,3,3,3,3,3,2,2,1] # number of rings per disk     
-    nmods = [52, 40, 40] # number of modules in each ring (outer, middle, inner) 
-  
-    inner_radius_f = [0.75, 0.49, 0.34];
-    outer_radius_f = [0.99, 0.74, 0.48];
-    if (disk==7): inner_radius_f[1]= 0.60;   # the one before the last wheel has short middle modules
-
-
-    for ring in range (nrings[disk]):    
-        if (debug): print " -- DrawSCTECMap -- ring: ", ring, "  modules= ", nmods[ring]
-        phistep = 2*3.14159265/nmods[ring]
-        outerR = outer_radius_f[ring] * (boxsct.GetXaxis().GetXmax()-boxsct.GetXaxis().GetXmin())/2
-        innerR = inner_radius_f[ring] * (boxsct.GetXaxis().GetXmax()-boxsct.GetXaxis().GetXmin())/2
-        xCenter = (boxsct.GetXaxis().GetXmax()-boxsct.GetXaxis().GetXmin())/2 + boxsct.GetXaxis().GetXmin()
-        yCenter = (boxsct.GetYaxis().GetXmax()-boxsct.GetYaxis().GetXmin())/2 + boxsct.GetYaxis().GetXmin()
-        xmod = array("f",[0.0]*5)
-        ymod = array("f",[0.0]*5) 
-        pmod = [None] * nmods[ring]
-        for module in range(nmods[ring]):
-            phi = module * phistep
-            xmod[0] = xCenter + innerR*math.cos(phi-phistep/2)
-            xmod[1] = xCenter + innerR*math.cos(phi+phistep/2)
-            xmod[2] = xCenter + outerR*math.cos(phi+phistep/2)
-            xmod[3] = xCenter + outerR*math.cos(phi-phistep/2)
-            xmod[4] = xmod[0]
-            ymod[0] = yCenter + innerR*math.sin(phi-phistep/2)
-            ymod[1] = yCenter + innerR*math.sin(phi+phistep/2)
-            ymod[2] = yCenter + outerR*math.sin(phi+phistep/2)
-            ymod[3] = yCenter + outerR*math.sin(phi-phistep/2)
-            ymod[4] = ymod[0]
-            if (debug): print " -- DrawSCTECMap -- disk:",disk," ring:",ring," module:",module,"  entries:",inputHisto.GetBinContent(ring+1,module+1)
-            pmod[module] = TPolyLine(5, xmod, ymod)
-            pmod[module].SetFillColor(locateColor(boxsct,ring+1,module+1))
-            if (inputHisto.GetBinContent(ring+1,module+1) == 0): 
-                pmod[module].SetFillColor(kGray+1)
-            pmod[module].Draw("Fsame")
-            
-            SetOwnership(pmod[module], False)
-
-    gPad.Modified()    
-    gPad.Update()
-    #inputHisto.Draw("colz")
-    #gPad.Update()
-    
-    if (debug): print " -- DrawSCTECMap -- completed -- disk ", disk
-
-    return
-
-###########################################################################################################################
-def DrawPixelECMap(inputHisto):
-    debug = False
-    if (debug): print " -- DrawPixelECMap -- start -- inputHisto=",inputHisto.GetName()
-
-    # hide the labels
-    inputHisto.GetXaxis().SetLabelColor(kWhite)
-    inputHisto.GetYaxis().SetLabelColor(kWhite)
-    inputHisto.GetXaxis().SetTitle("X axis")
-    inputHisto.GetYaxis().SetTitle("Y axis")
-    # first draw the histogram in colz mode to obtain the Z axis scale
-    inputHisto.Draw("colz text")
-
-    #now draw a blank on top
-    blank = TBox(inputHisto.GetXaxis().GetXmin(),inputHisto.GetYaxis().GetXmin(), inputHisto.GetXaxis().GetXmax(), inputHisto.GetYaxis().GetXmax())
-    blank.SetFillStyle(1001) # solid
-    blank.SetFillColor(kWhite)
-    SetOwnership(blank, False)
-    blank.Draw()
-    gPad.Update()
-    if (debug): blank.Print()
-
-    # Let's draw the wheel
-    # -parameters
-    npixmods = 48 # each wheel has 48 modules 
-    phistep = 2*3.14159265/npixmods
-    outerR = (inputHisto.GetXaxis().GetXmax()-inputHisto.GetXaxis().GetXmin())/2
-    innerR = outerR/2
-    xCenter = (inputHisto.GetXaxis().GetXmax()-inputHisto.GetXaxis().GetXmin())/2
-    yCenter = (inputHisto.GetYaxis().GetXmax()-inputHisto.GetYaxis().GetXmin())/2
-    xmod = array("f",[0.0]*5)
-    ymod = array("f",[0.0]*5) 
-    pmod = [None] * npixmods
-    for module in range(npixmods):
-        phi = module * phistep
-        xmod[0] = xCenter + innerR*math.cos(phi-phistep/2)
-        xmod[1] = xCenter + innerR*math.cos(phi+phistep/2)
-        xmod[2] = xCenter + outerR*math.cos(phi+phistep/2)
-        xmod[3] = xCenter + outerR*math.cos(phi-phistep/2)
-        xmod[4] = xmod[0]
-        ymod[0] = yCenter + innerR*math.sin(phi-phistep/2)
-        ymod[1] = yCenter + innerR*math.sin(phi+phistep/2)
-        ymod[2] = yCenter + outerR*math.sin(phi+phistep/2)
-        ymod[3] = yCenter + outerR*math.sin(phi-phistep/2)
-        ymod[4] = ymod[0]
-        if (debug): print " -- DrawPixelECMap -- module ", module, "  (x0,y0) = (",xmod[0],", ",ymod[0],") "  
-        pmod[module] = TPolyLine(5, xmod, ymod)
-        pmod[module].SetFillColor(locateColor(inputHisto,module+1))
-        pmod[module].Draw("Fsame")    
-        SetOwnership(pmod[module], False)
-
-    gPad.Modified()    
-    gPad.Update()
-    if (debug): print " -- DrawPixelECMap -- completed -- "
-
-    return
-
-###########################################################################################################################
-def DrawResPerStave(inputTuple, outputName, outputFile, nFiles):
-    debug = False
-    can = TCanvas(outputName, outputName, 900, 800)
-    can.Divide(4,5)
-
-    for i in range(len(inputTuple)):
-        if (debug): print " == DrawResPerStave == index",i," histogram in 3*i+1=",3*i+1,"   total Tuple size:", len(inputTuple)
-        mytuple = inputTuple[i]
-        can.cd(i+1)
-        maxval = 0
-        for file in range (nFiles):
-            hist = mytuple[3*file+1]
-            if (hist.GetMaximum() > maxval):
-                firstHisto = hist
-                maxval = hist.GetMaximum()
-
-        print " == DrawResPerStave == Max histo --> ",  firstHisto.GetTitle()          
-        firstHisto.Draw()
-        
-        for file in range (nFiles):         
-            hist = mytuple[3*file+1]
-            hist.Draw("same")
-                
-    can.SaveAs(outputFile)
-
-    return
-###########################################################################################################################
-def locateColor(inputHisto, xbin, ybin=1):
-
-    colorIndex = (inputHisto.GetListOfFunctions().FindObject("palette")).GetValueColor(inputHisto.GetBinContent(xbin,ybin))
-
-    return colorIndex
-##########################################################################################################
-def SetNextInputFile(myFile, myLegend, myMarker, myColor, myTrackColl="", myPrefix=""):
-
-    theInputFileList.append(myFile)
-    theLegendList.append(myLegend)
-    theMarkerList.append(myMarker)
-    theColorList.append(myColor)
-    theTrackCollectionList.append(myTrackColl)
-    thePrefix.append(myPrefix)
-
-    return
-
-##########################################################################################################
-def SetCanvasText(userText):
-    newcanvastext = ["","","",""]
-    if (len(userText)>=1): newcanvastext[0] = userText[0] 
-    if (len(userText)>=2): newcanvastext[1] = userText[1] 
-    if (len(userText)>=3): newcanvastext[2] = userText[2] 
-    if (len(userText)>=4): newcanvastext[3] = userText[3]
-    
-    return newcanvastext
-##########################################################################################################
-def nFilesGiven():
-
-    return len(theInputFileLis)
-
-#####################
-## IBL wise plots
-
-def ConvertHistoInGraph(histo,planar=False):
-    z_axis = [-322.8975, -301.7925, -280.6875,-259.5825,-228.2775,-186.7725,-145.2675,-103.7625,-62.2575,-20.7525,20.7525,62.2575,103.7625,145.2675,186.7725,228.2775,259.5825,280.6875,301.7925,322.8975]
-    nbins_h = 21
-    shift=0
-    if planar:
-        nbins_h=13
-        shift=4
-    graph = TGraphErrors()
-    filled_bins = []
-    for etabin in range(1,nbins_h):
-        if (histo.GetBinContent(etabin) != 0 ):
-            filled_bins.append(etabin)
-    for ibin in range(len(filled_bins)):
-        graph.Set(ibin+1)
-        graph.SetPoint(ibin,z_axis[filled_bins[ibin]-1+shift],histo.GetBinContent(filled_bins[ibin]))
-        graph.SetPointError(ibin,0,histo.GetBinError(filled_bins[ibin]))
-    graph.GetXaxis().SetRangeUser(-z_fix,z_fix)
-    return graph
-
-def MakeStaveShapeFit(projection,planar=False,savePlot=True,Fixbase=False,outputname=""):
-    g = ConvertHistoInGraph(projection,planar)
-    g.GetXaxis().SetRangeUser(-z_fix,z_fix)
-    g.GetYaxis().SetRangeUser(-0.01,0.01)
-    fit = TF1("fit", "[1] - ([2]*(x*x-[0]*[0]))/([0]*[0])",z_fix,z_fix);
-    fit.FixParameter(0, z_fix);
-    if (Fixbase):
-        fit.FixParameter(1,0)
-    r = g.Fit(fit,"EXSQS");
-    mag   =fit.GetParameter(2);
-    mag_er=fit.GetParError(2);
-
-    base     =fit.GetParameter(1);
-    base_er  =fit.GetParError(1);
-    chi = r.Chi2()
-
-    dof =r.Ndf()
-
-    if (savePlot):
-        can = TCanvas("c","c",800,600)
-        g.GetXaxis().SetTitle("Global z Position[mm]")
-        g.GetYaxis().SetTitle("Local X Residual mean [mm]")
-        g.Draw("AP")
-        text = TLatex()
-        text.SetTextFont(42)
-        text.SetTextSize(0.04)
-        text.SetTextColor(kBlack)
-        text.SetNDC()
-        text1 = "Chi2/Dof = "  + str(round(chi,2)) +"/"+ str(dof)
-        text2 = "Magnitude = " + str(round(mag*1000,2)) + " #pm " + str(round(mag_er*1000,2)) + " #mum"
-        text3 = "Baseline  = " + str(round(base*1000,2)) + " #pm " + str(round(base_er*1000,2)) + " #mum"
-        fitType = "Parabolic"
-        text4 = "Fit type =" + fitType
-        text.DrawLatex(0.18,0.86,text1)
-        text.DrawLatex(0.18,0.80,text2)
-        text.DrawLatex(0.18,0.74,text3)
-        text.DrawLatex(0.18,0.68,text4)
-        can.SaveAs(outputname)
-    
-    return [mag,mag_er,base,base_er]
-
-def MakeStaveShapeFitLinear(projection,planar=False,savePlot=True,Fixbase=False,outputname=""):
-    g = ConvertHistoInGraph(projection,planar)
-    g.GetXaxis().SetRangeUser(-z_fix,z_fix)
-    g.GetYaxis().SetRangeUser(-0.003,0.003)
-    fit = TF1("fit", "x*[0]+[1]",z_fix,z_fix);
-    if (Fixbase):
-        fit.FixParameter(1,0)
-    r = g.Fit(fit,"EXSQS");
-    mag   =fit.GetParameter(0);
-    mag_er=fit.GetParError(0);
-
-    base     =fit.GetParameter(1);
-    base_er  =fit.GetParError(1);
-    chi = r.Chi2()
-
-    dof =r.Ndf()
-
-    if (savePlot):
-        can = TCanvas("c","c",800,600)
-        g.GetXaxis().SetTitle("Global z Position[mm]")
-        g.GetYaxis().SetTitle("Local X Residual mean [mm]")
-        g.Draw("AP")
-        text = TLatex()
-        text.SetTextFont(42)
-        text.SetTextSize(0.04)
-        text.SetTextColor(kBlack)
-        text.SetNDC()
-        text1 = "Chi2/Dof = "  + str(round(chi,2)) +"/"+ str(dof)
-        text2 = "Slope = " + str(round(mag*1000,2)) + " #pm " + str(round(mag_er*1000,2)) + " #mum"
-        text3 = "Intercept  = " + str(round(base*1000,2)) + " #pm " + str(round(base_er,2)) + " #mum"
-        fitType = "Linear"
-        text4 = "Fit type =" + fitType
-        text.DrawLatex(0.18,0.86,text1)
-        text.DrawLatex(0.18,0.80,text2)
-        text.DrawLatex(0.18,0.74,text3)
-        text.DrawLatex(0.18,0.68,text4)
-        can.SaveAs(outputname)
-    
-    return [mag,mag_er,base,base_er]
-
-def MakeMagnitudeLinearFit(histogram,planar=False,savePlot=True,FixSlope=False,outputname=""):
-    histo = TH1
-    histo = histogram.Clone() 
-    fit = TF1("fit", "x*[0]+[1]",z_fix,z_fix);
-    if (FixSlope):
-        fit.FixParameter(0,0)
-    r = histo.Fit(fit,"EXSQS");
-    mag   =fit.GetParameter(0);
-    mag_er=fit.GetParError(0);
-
-    base     =fit.GetParameter(1);
-    base_er  =fit.GetParError(1);
-    chi = r.Chi2()
-
-    dof =r.Ndf()
-
-    if (savePlot):
-        can = TCanvas("c","c",800,600)
-        histo.GetXaxis().SetTitle("Lumiblock")
-        histo.GetYaxis().SetTitle("Magnitude [#mum]")
-        histo.Draw()
-        text = TLatex()
-        text.SetTextFont(42)
-        text.SetTextSize(0.04)
-        text.SetTextColor(kBlack)
-        text.SetNDC()
-        text1 = "Chi2/Dof = "  + str(round(chi,2)) +"/"+ str(dof)
-        text2 = "Slope = " + str(round(mag,4)) + " #pm " + str(round(mag_er,4)) + " #mum"
-        text3 = "Intercept  = " + str(round(base,2)) + " #pm " + str(round(base_er,2)) + " #mum"
-        fitType = "Linear"
-        text4 = "Fit type =" + fitType
-        text.DrawLatex(0.18,0.86,text1)
-        text.DrawLatex(0.18,0.80,text2)
-        text.DrawLatex(0.18,0.74,text3)
-        text.DrawLatex(0.18,0.68,text4)
-        can.SaveAs(outputname)
-    
-    return [mag,mag_er,base,base_er]
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities_MS.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities_MS.py
deleted file mode 100644
index f570fc26368baec01a149501e7987f02aa22d124..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities_MS.py
+++ /dev/null
@@ -1,2019 +0,0 @@
-# Author:
-#  John Alison johnda@hep.upenn.edu
-#  Ben Cooper b.d.cooper@qmul.ac.uk
-
-
-import sys, math
-#from ROOT import TH1,TF1,TLatex,TCanvas,TMarker,TH1F, gROOT
-from array import array
-
-from ROOT import *
-from AtlasStyle import *
-#SetAtlasStyle()
-TGaxis.SetMaxDigits(4)
-
-
-# if this is true then legends are drawn in order of the input files
-# if it is false then legends are drawn in order of max histogram first
-# no need for this ever to be False really
-forceDrawOrder = True
-
-normaliserHisto = 0 #histogram which other hists are normalised to if normalisation is used. e.g. 0 is hist from first file
-statsMethod = 3 #how width is calculated if don't use fit. 0 = plain RMS, 1 = RMS(95%), 2 = RMS within range (sigmaIterativeGaus), 3 = FWHM/2.35
-interpolateFWHM = True # use linear interpolation in FWHM estimation
-sigmaIterativeGaus = 1.5 #controls sigma range used for iterative single Gaussian fit
-ZmumuVal = True #flag for ZmumuValidation particular things (axes range etc)
-pTmin = 0 #the minimum pT for ZmumuValidation
-pTmax = 1000 #the maximum pT for ZmumuValidation
-
-
-def DrawPlots(inputTuple, outputName, plotTitle, yAxisTitle, xAxisTitle, legendLeftX, legendUpperY, units, 
-              canvasText, makeOutput, textBoxLeftX=0.60, textBoxUpperY=0.91, dynamicYRange=True, plotCosmetics="Default"):
-
-    print outputName
-
-
-    # dynamicYRange=True means that the y-range of the histogram drawn first is adjusted so that 
-    # all the histograms will fit into this range. If False then the default y-range of the first histogram is used.
-
-    if(plotCosmetics=="Default"):
-        legendTextSize = 0.035
-        legendMarkerSize = 1.5
-        legendYLineSpacing = 0.05 # determines how spaced out in y the legend entries are (may want to increase/decrease depending on legend text size)
-        legendMarkerYPosMod = [0.0,0.0,0.0,0.0] #for some reason the marker doesn't appear next to legend text in Y without some modification
-        meanWidthOnSeparateLine = False# if true mean and width are displayed in legend on separate lines, if false they are on the same line
-        showMean = True
-        plotTitleOnFirstLine = False # puts the plotTitle next to the first text on the plot e.g. ATLAS
-                                     #yAxisTitleOffset = 1.42 # NOT USED now handled by AtlasStyle
-        yAxisTitleOffset = 1.8
-    if(plotCosmetics=="ApprovedPlots"):
-        legendTextSize = 0.05
-        legendMarkerSize = 1.7
-        legendYLineSpacing = 0.07 
-        legendMarkerYPosMod = [-0.004,-0.004,-0.004,-0.004]
-        meanWidthOnSeparateLine = False
-        showMean = False
-        plotTitleOnFirstLine = False 
-        yAxisTitleOffset = 1.55 # NOT USED now handled by AtlasStyle
-
-    if(plotCosmetics=="ApprovedPlotsMay"):
-        legendTextSize = 0.04
-        legendMarkerSize = 1.7
-        legendYLineSpacing = 0.05 
-        legendMarkerYPosMod = [0.0,0.0,0.0,0.0]
-        meanWidthOnSeparateLine = False
-        showMean = False
-        plotTitleOnFirstLine = False 
-        yAxisTitleOffset = 1.55 # NOT USED now handled by AtlasStyle
-    
-    if(plotCosmetics=="SmallLegend"):
-        legendTextSize = 0.04
-        legendMarkerSize = 1.7
-        legendYLineSpacing = 0.035
-        #legendMarkerYPosMod = -0.000
-        legendMarkerYPosMod = [-0.002,0.0,0.0,0.0]
-        meanWidthOnSeparateLine = False
-        showMean = False
-        plotTitleOnFirstLine = False
-        yAxisTitleOffset = 1.55 # NOT USED now handled by AtlasStyle
-
-    if(plotCosmetics=="SeparateLine"):
-        legendTextSize = 0.035
-        legendMarkerSize = 1.5
-        legendYLineSpacing = 0.05 # determines how spaced out in y the legend entries are (may want to increase/decrease depending on legend text size)
-        legendMarkerYPosMod = [0.0,0.0,0.0,0.0] #for some reason the marker doesn't appear next to legend text in Y without some modification
-        meanWidthOnSeparateLine = True # if true mean and width are displayed in legend on separate lines, if false they are on the same line
-        showMean = True
-        plotTitleOnFirstLine = False 
-        yAxisTitleOffset = 1.8 # NOT USED now handled by AtlasStyle
-
-    can = TCanvas(outputName,outputName,800,600)
-    can.cd()
-
-        
-    # determining the max and min histograms
-    maxYVal = -9999999.0
-    minYVal = 9999999.0
-    for i in range(len(inputTuple)):
-        
-        if i==1 or i==4 or i==7 or i==10:
-            if inputTuple[i].GetMaximum() > maxYVal:
-                #maxYVal = inputTuple[i].GetMaximum()
-                maxYVal = inputTuple[i].GetBinContent(inputTuple[i].GetMaximumBin())
-            if inputTuple[i].GetMinimum() < minYVal:
-                #minYVal = inputTuple[i].GetMinimum()
-                minYVal = inputTuple[i].GetBinContent(inputTuple[i].GetMinimumBin())
-    #minYVal = 0.0 #overriding for now 
-    #print "maxYVal = ",maxYVal,", minYVal = ",minYVal
-
-    # drawing the first histogram
-    hist = inputTuple[1]
-    #if hist.GetName()=="pT":
-
-        #I was asked to set y linear 19/06/13
-        # gPad.SetLogy()
-        #I am trying to fix the X range for Pt plots. Please do it in a better way!! (PF 28/03/13)
-    histoTitle = hist.GetName()
-    if histoTitle.find('pT')!=-1  and ZmumuVal:
-        hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-    if dynamicYRange:
-        if hist.GetName()=="pix_b_residualy":
-            hist.GetYaxis().SetRangeUser(minYVal,maxYVal*1.33)
-        else:
-            #hist.GetYaxis().SetRangeUser(minYVal*1.10,maxYVal*1.10)
-            hist.GetYaxis().SetRangeUser(minYVal*0.8,maxYVal*1.20)
-            
-            
-                
-            
-    hist.GetXaxis().SetTitle(xAxisTitle)
-    if hist.GetYaxis().GetTitle()!="Arbitrary units":
-        hist.GetYaxis().SetTitle(yAxisTitle)
-    #hist.GetYaxis().SetTitleOffset(yAxisTitleOffset) # now handled by ATLAS style
-    if "D0bsVsPhi0" in hist.GetName() or "D0bsVsEta" in hist.GetName():
-        hist.GetYaxis().SetLabelOffset(0.015)
-        hist.GetYaxis().SetLabelSize(0.045)
-    if "mean_" in hist.GetName():
-        hist.Draw("histo")
-    else:
-        hist.Draw()
-        
-    # drawing function associated with first histogram
-    tf1 = inputTuple[0]
-    if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-    # canvas text (right hand side)
-    latexAtlas = TLatex()
-    latexAtlas.SetNDC()
-    #latexAtlas.SetTextFont(72)
-    latexAtlas.SetTextColor(1)
-    latexAtlas2 = TLatex()
-    latexAtlas2.SetNDC()
-
-    if(plotTitleOnFirstLine):
-        latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0] + "  " + plotTitle)
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,canvasText[1])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[2])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[3])    
-    else:
-        latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,plotTitle)
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[1])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[2])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.24,canvasText[3])  
-        #latexAtlas3 = TLatex()
-        #latexAtlas3.SetNDC()
-        #latexAtlas3.SetTextSize(0.08)
-        #latexAtlas3.DrawLatex(textBoxLeftX,textBoxUpperY-0.40,canvasText[3])    
-
-    # drawing legend associated with first histogram
-    legendTitle = inputTuple[2]
-    m_l = TLatex()
-    m_l.SetTextSize(legendTextSize)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-    m_l2 = TLatex()
-    m_l2.SetTextSize(legendTextSize)
-    m_l2.SetTextAlign(12)
-    m_l2.SetNDC()
-    legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[0],legendMarkerSize)
-    m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-    if meanWidthOnSeparateLine==True:
-        m_width = TLatex()
-        m_width.SetTextSize(legendTextSize)
-        m_width.SetTextAlign(12)
-        m_width.SetNDC()
-        m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-    marker = legendTuple[0]
-    marker.Draw("same")
-
-    #determining how far offset in Y the next legend entry should be
-    legendYOffset = 2*legendYLineSpacing
-    if meanWidthOnSeparateLine==True:
-        legendYOffset = 3*legendYLineSpacing
-
-    ## uncomment to display fraction of histogram within sigma range
-    #m_l3 = TLatex()
-    #m_l3.SetTextSize(legendTextSize)
-    #m_l3.SetTextAlign(12)
-    #m_l3.SetNDC()
-    #m_l3.SetTextColor(hist.GetMarkerColor())
-    #text = "Frac. = " + str(round(findFractionWithinSigmaRange(hist,sigmaIterativeGaus),3)*100) + "%" 
-    #m_l3.DrawLatex(legendLeftX,legendUpperY-0.35,text)    
-
-    ## uncomment to display fit properties
-    #print "fit for ",hist.GetName()," ",legendTitle,": chi2/DOF = ",tf1.GetChisquare(),"/",tf1.GetNDF()," = ",tf1.GetChisquare()/tf1.GetNDF()
-    #m_l3 = TLatex()
-    #m_l3.SetTextSize(legendTextSize)
-    #m_l3.SetTextAlign(12)
-    #m_l3.SetNDC()
-    #m_l3.SetTextColor(hist.GetMarkerColor())
-    #text = "#chi^{2}/DOF = " + str(round(tf1.GetChisquare()/tf1.GetNDF(),2)) 
-    #m_l3.DrawLatex(legendLeftX,legendUpperY-0.35,text)
-
-    ## uncomment to print fraction of data covered by 1-sigma of fit (assumes mean of fit = 0.0)
-    #maxFitRange = tf1.GetParameter(1) + (tf1.GetParameter(2)*sigmaIterativeGaus)
-    #minFitRange = tf1.GetParameter(1) - (tf1.GetParameter(2)*sigmaIterativeGaus)
-    #maxFitBin = hist.FindBin(maxFitRange)
-    #minFitBin = hist.FindBin(minFitRange)
-    #intGral = hist.Integral(minFitBin,maxFitBin)
-    #fullIntGral = hist.Integral(1,hist.GetNbinsX())
-    ##print "maxFitRange =  ",maxFitRange,", minFitRange = ", minFitRange
-    ##print "maxFitBin =  ",maxFitBin,", minFitBin = ", minFitBin
-    #print "histo ",hist.GetName()," fraction covered by fit = ",intGral/fullIntGral
-    #m_l4 = TLatex()
-    #m_l4.SetTextSize(legendTextSize)
-    #m_l4.SetTextAlign(12)
-    #m_l4.SetNDC()
-    #m_l4.SetTextColor(hist.GetMarkerColor())
-    #text = "Fit Frac. = " + str(round(intGral/fullIntGral,2)) 
-    #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.35,text)
-
-    ## uncomment to draw core and tail functions on 
-    #coreFunc = TF1("coreFunc","gaus",-0.5,0.5)
-    #coreFunc.SetParameter(0,tf1.GetParameter(0))
-    #coreFunc.SetParameter(1,tf1.GetParameter(1))
-    #coreFunc.SetParameter(2,tf1.GetParameter(2))
-    #coreFunc.SetLineColor(hist.GetMarkerColor())
-    #coreFunc.SetLineStyle(2)
-    #coreFunc.Draw("same")
-    #integralCore = coreFunc.Integral(-0.5,0.5)
-    #print "integralCore = ",integralCore
-    #tailFunc = TF1("tailFunc","gaus",-0.5,0.5)
-    #tailFunc.SetParameter(0,tf1.GetParameter(3))
-    #tailFunc.SetParameter(1,tf1.GetParameter(4))
-    #tailFunc.SetParameter(2,tf1.GetParameter(5))
-    #tailFunc.SetLineColor(hist.GetMarkerColor())
-    #tailFunc.SetLineStyle(2)
-    #tailFunc.Draw("same")
-    #integralTail = tailFunc.Integral(-0.5,0.5)
-    #fracCore = integralCore/(integralCore+integralTail)
-    #print "integralTail = ",integralTail
-    #print "fracCore = " ,fracCore
-    #m_l4 = TLatex()
-    #m_l4.SetTextSize(legendTextSize)
-    #m_l4.SetTextAlign(12)
-    #m_l4.SetNDC()
-    #m_l4.SetTextColor(hist.GetMarkerColor())
-    #text = "Core Frac. = " + str(round(fracCore,2)) 
-    #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.35,text)
-
-    # drawing second histogram and its legend
-    if (len(inputTuple)) > 3:
-        hist = inputTuple[3+1]
-        histoTitle = hist.GetName()
-        if histoTitle.find('pT')!=-1  and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-        #hist.Draw("same,e")
-        tf1 = inputTuple[3+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[3+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[1],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker2 = legendTuple[0]
-        marker2.Draw("same")
-
-        ## uncomment to display fraction of histogram within sigma range
-        #m_l3.SetTextColor(hist.GetMarkerColor())
-        #text = "Frac. = " + str(round(findFractionWithinSigmaRange(hist,sigmaIterativeGaus),3)*100) + "%" 
-        #m_l3.DrawLatex(legendLeftX,legendUpperY-0.4,text)    
-
-        ## uncomment to display fit properties
-        #print "fit for ",hist.GetName()," ",legendTitle,": chi2/DOF = ",tf1.GetChisquare(),"/",tf1.GetNDF()," = ",tf1.GetChisquare()/tf1.GetNDF()
-        #m_l3.SetTextColor(hist.GetMarkerColor())
-        #text = "#chi^{2}/DOF = " + str(round(tf1.GetChisquare()/tf1.GetNDF(),2)) 
-        #m_l3.DrawLatex(legendLeftX,legendUpperY-0.4,text)
-
-        ## uncomment to print fraction of data covered by 1-sigma of fit (assumes mean of fit = 0.0)
-        #maxFitRange = tf1.GetParameter(1) + (tf1.GetParameter(2)*sigmaIterativeGaus)
-        #minFitRange = tf1.GetParameter(1) - (tf1.GetParameter(2)*sigmaIterativeGaus)
-        #maxFitBin = hist.FindBin(maxFitRange)
-        #minFitBin = hist.FindBin(minFitRange)
-        #intGral = hist.Integral(minFitBin,maxFitBin)
-        #fullIntGral = hist.Integral(1,hist.GetNbinsX())
-        #print "histo ",hist.GetName()," fraction covered by fit = ",intGral/fullIntGral
-        #m_l4.SetTextColor(hist.GetMarkerColor())
-        #text = "Fit Frac. = " + str(round(intGral/fullIntGral,2)) 
-        #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.4,text)
-
-        ### uncomment to draw core and tail functions on 
-        #coreFunc2 = TF1("coreFunc","gaus",-0.5,0.5)
-        #coreFunc2.SetParameter(0,tf1.GetParameter(0))
-        #coreFunc2.SetParameter(1,tf1.GetParameter(1))
-        #coreFunc2.SetParameter(2,tf1.GetParameter(2))
-        #coreFunc2.SetLineColor(hist.GetMarkerColor())
-        #coreFunc2.SetLineStyle(2)
-        ##coreFunc2.Draw("same")
-        #integralCore2 = coreFunc2.Integral(-0.5,0.5)
-        #print "integralCore = ",integralCore
-        #tailFunc2 = TF1("tailFunc","gaus",-0.5,0.5)
-        #tailFunc2.SetParameter(0,tf1.GetParameter(3))
-        #tailFunc2.SetParameter(1,tf1.GetParameter(4))
-        #tailFunc2.SetParameter(2,tf1.GetParameter(5))
-        #tailFunc2.SetLineColor(hist.GetMarkerColor())
-        #tailFunc2.SetLineStyle(2)
-        ##tailFunc2.Draw("same")
-        #integralTail2 = tailFunc2.Integral(-0.5,0.5)
-        #fracCore2 = integralCore2/(integralCore2+integralTail2)
-        #print "integralTail = ",integralTail2
-        #print "fracCore = " , fracCore2
-        #m_l4.SetTextColor(hist.GetMarkerColor())
-        #text = "Core Frac. = " + str(round(fracCore2,2)) 
-        #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.4,text)
-
-
-
-    # drawing third histogram and its legend
-    if (len(inputTuple)) > 6:
-        hist = inputTuple[6+1]
-        histoTitle = hist.GetName()
-        if histoTitle.find('pT')!=-1  and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-        #hist.Draw("same,e")
-        tf1 = inputTuple[6+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[6+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[2],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker3 = legendTuple[0]
-        marker3.Draw("same")
-
-    # drawing fourth histogram and its legend
-    if (len(inputTuple)) > 9:
-        hist = inputTuple[9+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[9+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[9+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker4 = legendTuple[0]
-        marker4.Draw("same")
-
-        # drawing fifth histogram and its legend
-    if (len(inputTuple)) > 12:
-        hist = inputTuple[12+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[12+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[12+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker5 = legendTuple[0]
-        marker5.Draw("same")
-
-        # drawing sixth histogram and its legend
-    if (len(inputTuple)) > 15:
-        hist = inputTuple[15+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[15+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[15+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker6 = legendTuple[0]
-        marker6.Draw("same")
-
-        # drawing seventh histogram and its legend
-    if (len(inputTuple)) > 18:
-        hist = inputTuple[18+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[18+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[18+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker7 = legendTuple[0]
-        marker7.Draw("same")
-
-        # drawing eighth histogram and its legend
-    if (len(inputTuple)) > 21:
-        hist = inputTuple[21+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[21+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[21+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker8 = legendTuple[0]
-        marker8.Draw("same")
-
-        # drawing fifth histogram and its legend
-    if (len(inputTuple)) > 24:
-        hist = inputTuple[24+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[24+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[24+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker9 = legendTuple[0]
-        marker9.Draw("same")
-
-
-
-        
-
-    
-    if makeOutput:
-        can.SaveAs(outputName)
-
-def MakePlots(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles, normaliseHistos, unitArea=False):
-    
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = 0.0
-    max_hist = 0
-
-    histoGram = [TH1,TH1,TH1,TH1,TH1,TH1,TH1,TH1,TH1,TH1]
-    Tuples = [tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple,tuple]
-
-
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-        histoGram[i] = GetHistogram(rootFiles[i],histogramDir[i],histogramName,markerColors[i],markerStyles[i])
-
-    for i in range(nFiles):
-
-        #normalise histograms to unit area if desired
-        if histoGram[i].Integral() > 0:
-            if unitArea:
-                #print "for hist ",i, " scaling" 
-                histoGram[i].Scale(1/histoGram[i].Integral())
-                histoGram[i].GetYaxis().SetTitle("Arbitrary units")
-            #elif  i > 0 and normaliseHistos:
-            elif normaliseHistos:
-                histoGram[i].Scale(histoGram[normaliserHisto].Integral()/histoGram[i].Integral())
-
-        # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-        RemoveNegativeYAxis(histoGram[i],histogramName)
-
-        # find which histogram has largest y-value - this will be drawn first
-        if histoGram[i].GetMaximum() > maxval:
-            max_hist = i
-            maxval = histoGram[i].GetMaximum()
-
-        # perform the deired fit to the histogram
-        fit = MakeFit(histoGram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,histoGram[i],legendTitles[i])
-
-        
-
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-
-    if nFiles==5:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[4]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-
-    if nFiles==6:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[4] + Tuples[5]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4]
-
-    if nFiles==7:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[4] + Tuples[5] + Tuples[6]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]
-
-    if nFiles==8:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]+ Tuples[7]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]+ Tuples[7]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]+ Tuples[7]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[4] + Tuples[5] + Tuples[6]+ Tuples[7]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]+ Tuples[7]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6]+ Tuples[7]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]+ Tuples[7]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]+ Tuples[6]
-
-    if nFiles==9:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]+ Tuples[7]+ Tuples[8]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]+ Tuples[7]+ Tuples[8]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3] + Tuples[4] + Tuples[5] + Tuples[6]+ Tuples[7]+ Tuples[8]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[4] + Tuples[5] + Tuples[6]+ Tuples[7]+ Tuples[8]
-        elif max_hist==4:
-            totalTuple = Tuples[4] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[5] + Tuples[6]+ Tuples[7]+ Tuples[8]
-        elif max_hist==5:
-            totalTuple = Tuples[5] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[6]+ Tuples[7]+ Tuples[8]
-        elif max_hist==6:
-            totalTuple = Tuples[6] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]+ Tuples[7]+ Tuples[8]
-        elif max_hist==7:
-            totalTuple = Tuples[7] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]+ Tuples[6]+ Tuples[8]
-        elif max_hist==8:
-            totalTuple = Tuples[8] + Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3] + Tuples[4] + Tuples[5]+ Tuples[6]+ Tuples[7]
-    
-
-
-    return totalTuple #returning histograms and fits
-
-def MakeTwoPlotsFromSameFile(histogramDir,legendTitles,markerColors,markerStyles,histogramNames, fitType, rootFiles, fileToUse, normaliseHistos, unitArea=False):
-    
-    #gets 2 histograms from same file, normalises if desired and makes fits
-    #returns histograms and fits
-
-    maxval = 0.0
-    max_hist = 0
-
-    histoGram = [TH1,TH1]
-    Tuples = [tuple,tuple]
-
-    histoGram[0] = GetHistogram(rootFiles[fileToUse],histogramDir[fileToUse],histogramNames[0],markerColors[0],markerStyles[0])
-    histoGram[1] = GetHistogram(rootFiles[fileToUse],histogramDir[fileToUse],histogramNames[1],markerColors[1],markerStyles[1])
-
-    for i in range(2):
-
-        #normalise histograms to unit area if desired
-        if histoGram[i].Integral() > 0:
-            if unitArea:
-                histoGram[i].Scale(1/histoGram[i].Integral())
-                histoGram[i].GetYaxis().SetTitle("Arbitrary units")
-            elif  i > 0 and normaliseHistos:
-                histoGram[i].Scale(histoGram[0].Integral()/histoGram[i].Integral())
-        
-        # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-        RemoveNegativeYAxis(histoGram[i],histogramNames[i])
-
-        if histoGram[i].GetMaximum() > maxval:
-            max_hist = i
-            maxval = histoGram[i].GetMaximum()
-
-        # perform the deired fit to the histogram
-        fit = MakeFit(histoGram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,histoGram[i],legendTitles[i])
-
-
-    if max_hist==0:
-        totalTuple = Tuples[0] + Tuples[1]
-    if max_hist==1:
-        totalTuple = Tuples[1] + Tuples[0]
-
-    return totalTuple #returning histograms and fits
-
-
-def MakeSiEndcapResidualDistribution(histogramName,histogramDir,rootFile):
-
-    print "making Si endcap residuals"
-
-    if "eca" in histogramName:
-        h2d = rootFile.Get(histogramDir + "si_eca_resX")
-    elif "ecc" in histogramName:
-        h2d = rootFile.Get(histogramDir + "si_ecc_resX")
-    else:
-        print "EXITING because endcap not recognised in MakeSiEndcapResidualDistribution"
-        sys.exit()
-
-    if "pix" in histogramName:
-        if "residualx_disk1" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,1,1,"e")).Clone()
-        elif "residualx_disk2" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,2,2,"e")).Clone()
-        elif "residualx_disk3" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,3,3,"e")).Clone()
-        else:
-            print "EXITING because pixel disk not recognised in MakeSiEndcapResidualDistribution"
-            sys.exit()
-
-    if "sct" in histogramName:
-        if "residualx_disk1" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,4,4,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,5,5,"e")).Clone()
-        elif "residualx_disk2" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,6,6,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,7,7,"e")).Clone()
-        elif "residualx_disk3" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,8,8,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,9,9,"e")).Clone()
-        elif "residualx_disk4" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,10,10,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,11,11,"e")).Clone()
-        elif "residualx_disk5" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,12,12,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,13,13,"e")).Clone()
-        elif "residualx_disk6" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,14,14,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,15,15,"e")).Clone()
-        elif "residualx_disk7" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,16,16,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,17,17,"e")).Clone()
-        elif "residualx_disk8" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,18,18,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,19,19,"e")).Clone()
-        else:
-            print "EXITING because SCT disk not recognised in MakeSiEndcapResidualDistribution"
-            sys.exit()
-        endcapHist = sctEndcapSide0
-        endcapHist.Sumw2()
-        endcapHist.Add(sctEndcapSide1)
-
-
-    return endcapHist
-
-def FindCutBin(axis, cut, maxOrMin):
-
-
-  cutBin = -100
-
-  for i in range(axis.GetNbins()+1):
-    
-    edge = 0.0
-    if maxOrMin < 0:
-      edge = axis.GetBinLowEdge(i)
-    else:
-      edge = axis.GetBinUpEdge(i)
-      
-    if math.fabs(edge - cut) < 0.00001:
-      cutBin = i
-      break
-
-    if i==axis.GetNbins():
-      print "ERROR - cannot find cut bin!!!! Set to -100!!!"
-
-  return cutBin
-
-def MakeResidualMean1dHisto(histogramName,histogramDir,rootFile):
-
-    debug = False
-
-    xAxisLimit = 10.0
-    nBins1d = 100
-    meanOrError=0
-
-    if "mean1d" in histogramName:
-        if "pix" in histogramName and "yres" in histogramName:
-            xAxisLimit = 50.0
-            nBins1d = 500
-        h1d = TH1F(histogramName,histogramName,nBins1d,-xAxisLimit,xAxisLimit)
-        meanOrError=0
-    if "meanerror1d" in histogramName:
-        h1d = TH1F(histogramName,histogramName,300,0.,30.)
-        meanOrError=1
-    if "nentries1d" in histogramName:
-        h1d = TH1F(histogramName,histogramName,100,0.,100000.)
-        meanOrError=2
-    if debug:
-        print "histogramName = ",histogramName 
-
-    if "xres" in histogramName:
-        resStr = "xres"
-    if "yres" in histogramName:
-        resStr = "yres"
-
-    if "pix_b" in histogramName:
-        if "b0" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b0_" + resStr + "vsmodetaphi_3d")
-        elif "b1" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b1_" + resStr + "vsmodetaphi_3d")
-        elif "b2" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b2_" + resStr + "vsmodetaphi_3d")                                
-        else:
-            print "don't recognise histo name in MakeResidualMean1dHisto - EXITING"
-            sys.exit()
-
-    nBinsX = h3d.GetNbinsX()
-    nBinsY = h3d.GetNbinsY()
-
-    nModules = 0
-
-    for i in range(nBinsX):
-
-        for j in range(nBinsY):
-
-            hProj = h3d.ProjectionZ("proj",i,i,j,j,"e")
-
-            if hProj.GetEntries() <= 0:
-                if debug:
-                    print "Module has zero entries - probably a dead module"
-                continue
-            
-            if(meanOrError==0):
-                h1d.Fill((hProj.GetMean())*1000.)#fill with mean in microns
-                if abs(hProj.GetMean()*1000.) > xAxisLimit:
-                    print "WARNING: in MakeResidualMean1dHisto have a module with residual mean > ",xAxisLimit," microns"
-            elif(meanOrError==1):
-                h1d.Fill(hProj.GetMeanError()*1000.)
-            else:
-                h1d.Fill(hProj.GetEntries())
-            nModules = nModules + 1
-
-    if debug:
-        print "nModules =",nModules 
-
-    return h1d
-        
-def MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,meanOrFWHM=0):
-
-    # this method will usually fill a 1-d histogram with the mean or FWHM of residual/pull distributions as a function of track pT
-    # however, if the histogramName ends with string "bin-X", where X is an integer, it will return the actual residual/pull
-    # distribution in the bin X
-
-    # binning used for the x-axis (pT)
-    #nBins = 20
-    #newBins = array('d',[-20.0,-15.0,-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0,15.0,20.0])
-
-    nBins = 22
-    newBins = array('d',[-30.0,-20.0,-15.0,-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0,15.0,20.0,30.0])
-
-    debug = False
-    makeDistribution = False #gets set to true if histogramName contains "bin-X"
-
-    if "residual" in histogramName:
-        if "pix_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_b_residualx_pt")
-        elif "pix_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_eca_residualx_pt")
-        elif "pix_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_ecc_residualx_pt")
-        elif "sct_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_b_residualx_pt")
-        elif "sct_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_eca_residualx_pt")
-        elif "sct_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_ecc_residualx_pt")
-        elif "trt_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_b_residualR_pt_")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        elif "trt_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_ec_residualR_pt_Endcap_A")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        elif "trt_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_ec_residualR_pt_Endcap_C")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        else:
-            print "don't recognise histo name in MakeResidualVsPtHisto - EXITING"
-            sys.exit()
-    elif "pullx" in histogramName:
-        if "pix_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_b_pullx_pt")
-        elif "pix_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_eca_pullx_pt")
-        elif "pix_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_ecc_pullx_pt")
-        elif "sct_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_b_pullx_pt")
-        elif "sct_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_eca_pullx_pt")
-        elif "sct_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_ecc_pullx_pt")
-        else:
-            print "don't recognise histo name in MakeResidualVsPtHisto - EXITING"
-            sys.exit()
-
-    
-    
-    newHist = TH1F("newHist","newHist",nBins,newBins)
-
-    #check to see if histogramName contains "bin-X"
-    #if so we just return the projection for that bin
-    binNum = 0
-    if "bin-" in histogramName:
-        makeDistribution = True
-        binNumStr = (histogramName.split('-'))[1]
-        binNum = int(binNumStr)
-        print "binNumStr = ", binNumStr, ", binNum = ",binNum
-    if makeDistribution:
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[binNum-1],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[binNum],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        #projHist.Rebin(2)
-        return projHist
-
-    #otherwise fill 1-d histo with mean/width vs pT
-    for i in range(nBins):
-
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[i],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[i+1],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        #projHist.Rebin(2)
-        mean = projHist.GetMean()
-        rms = projHist.GetRMS()
-        entries = projHist.GetEntries()
-        meanErr = 1000.0
-        if entries > 0:
-            sqrtEntries = math.sqrt(entries);
-            meanErr = rms/sqrtEntries
-            fwhmArray = findMeanRMSUsingFWHM(projHist)
-            fWHM = fwhmArray[1]
-            #gausFit = singleGaus(projHist)
-            gausFit = singleGausIterative(projHist,sigmaIterativeGaus)
-            gausSigma = gausFit.GetParameter(2)
-            gausSigmaErr = gausFit.GetParError(2)
-
-        if debug: print "lowRange = ", newBins[i],", lowBin = ",lowBin,", highRange = ",newBins[i+1],", highBin = ",highBin,", content = ",projHist.GetEntries(),", mean = ",mean
-
-        if entries > 0 and newBins[i] < -2.0 or newBins[i] >= 2.0:#we don't show bins below 2 GeV (can have handful of entries)
-            if meanOrFWHM==0:
-                newHist.SetBinContent(i+1,mean)
-                newHist.SetBinError(i+1,meanErr)
-            elif meanOrFWHM==1:
-                if entries > 1000:
-                    newHist.SetBinContent(i+1,fWHM)
-                    newHist.SetBinError(i+1,0.000000001)
-            else:
-                if entries > 1000:
-                    newHist.SetBinContent(i+1,gausSigma)
-                    newHist.SetBinError(i+1,gausSigmaErr)
-
-    return newHist
-        
-def MakeErrVsPtHisto(histogramName,histogramDir,rootFile):
-
-    #print "making residual vs pt"
-
-    
-    h2d = rootFile.Get(histogramDir + histogramName)
-
-    nBins = 20
-    newBins = array('d',[0.0,0.8*2.0,0.8*4.0,0.8*6.0,0.8*8.0,0.8*10.0,0.8*12.0,0.8*14.0,0.8*16.0,0.8*18.0,0.8*20.0,0.8*22.0,0.8*24.0,0.8*26.0,
-                         0.8*28.0,0.8*30.0,0.8*32.0,0.8*36.0,0.8*40.0,0.8*44.0,0.8*50.0])
-    
-    newHist = TH1F("newHist","newHist",nBins,newBins)
-    
-    
-    for i in range(nBins):
-
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[i],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[i+1],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        mean = projHist.GetMean()
-        rms = projHist.GetRMS()
-        entries = projHist.GetEntries()
-        meanErr = 1000.0
-        if entries > 0:
-            sqrtEntries = math.sqrt(entries);
-            meanErr = rms/sqrtEntries
-            #fwhmArray = findMeanRMSUsingFWHM(projHist)
-            #fWHM = fwhmArray[1]
-
-        #print "lowRange = ", newBins[i],", lowBin = ",lowBin,", highRange = ",newBins[i+1],", highBin = ",highBin,", content = ",projHist.GetEntries(),", mean = ",mean
-
-        if entries > 0:
-            newHist.SetBinContent(i+1,mean)
-            newHist.SetBinError(i+1,meanErr)
-
-    return newHist
-
-def GetHistogram(rootFile,histogramDir,histogramName,markerColor,markerStyle):
-
-
-    if histogramName=="pix_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualx_fine":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualx_fine")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualx_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualy_fine":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualy_fine")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualy_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualy":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualy")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualy")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx_fine":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx_fine")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_residualR":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_residualR_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_residualR_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-
-    elif histogramName=="pix_b_pullx":
-        histoGramB0 = rootFile.Get(histogramDir + "pix_b0_pullx")
-        histoGramB1 = rootFile.Get(histogramDir + "pix_b1_pullx")
-        histoGramB2 = rootFile.Get(histogramDir + "pix_b2_pullx")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_b_pully":
-        histoGramB0 = rootFile.Get(histogramDir + "pix_b0_pully")
-        histoGramB1 = rootFile.Get(histogramDir + "pix_b1_pully")
-        histoGramB2 = rootFile.Get(histogramDir + "pix_b2_pully")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_ec_pullx":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_pullx")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_pullx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_pully":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_pully")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_pully")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_b_pullx":
-        histoGramB0 = rootFile.Get(histogramDir + "sct_b0_pullx")
-        histoGramB1 = rootFile.Get(histogramDir + "sct_b1_pullx")
-        histoGramB2 = rootFile.Get(histogramDir + "sct_b2_pullx")
-        histoGramB3 = rootFile.Get(histogramDir + "sct_b3_pullx")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-        histoGram.Add(histoGramB3)
-    elif histogramName=="sct_ec_pullx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_pullx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_pullx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_pullR":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_pullR_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_pullR_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_pullR_notube":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_pullR_notube_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_pullR_notube_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pT_nolog":
-        histoGram = rootFile.Get(histogramDir + "pT")
-        histoGram.SetName("pT_nolog")
-    elif "D0bsVs" in histogramName:
-        histoGram =  ((rootFile.Get(histogramDir + histogramName)).ProfileX()).Clone()
-    elif "residualx_disk" in histogramName:
-        histoGram = MakeSiEndcapResidualDistribution(histogramName,histogramDir,rootFile)
-    elif "residualx_pt_mean" in histogramName or "residual_pt_mean" in histogramName  or "pullx_pt_mean" in histogramName or "residualx_pt_bin" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile)
-    elif "residualx_pt_fwhm" in histogramName or "residual_pt_fwhm" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,1)
-    elif "pullx_pt_width" in histogramName or "residual_pt_width" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,2)
-    elif histogramName=="pix_b_xres_mean1d" or  histogramName=="pix_b_xres_meanerror1d" or  histogramName=="pix_b_xres_nentries1d":
-        confStr = "mean1d"
-        if "meanerror1d" in histogramName:
-            confStr = "meanerror1d"
-        if "nentries1d" in histogramName:
-            confStr = "nentries1d"            
-        histoGramB0 = MakeResidualMean1dHisto("pix_b0_xres_"+confStr,histogramDir,rootFile)
-        histoGramB1 = MakeResidualMean1dHisto("pix_b1_xres_"+confStr,histogramDir,rootFile)
-        histoGramB2 = MakeResidualMean1dHisto("pix_b2_xres_"+confStr,histogramDir,rootFile)
-        histoGram = histoGramB0.Clone()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_b_yres_mean1d":
-        histoGramB0 = MakeResidualMean1dHisto("pix_b0_yres_mean1d",histogramDir,rootFile)
-        histoGramB1 = MakeResidualMean1dHisto("pix_b1_yres_mean1d",histogramDir,rootFile)
-        histoGramB2 = MakeResidualMean1dHisto("pix_b2_yres_mean1d",histogramDir,rootFile)
-        histoGram = histoGramB0.Clone()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif "err" in histogramName and "VsPt" in histogramName:
-        histoGram = MakeErrVsPtHisto(histogramName,histogramDir,rootFile)
-    else:
-        histoGram = rootFile.Get(histogramDir + histogramName)
-
-
-    if not histoGram : #is None:#checking histograms exist
-        print "EXITING because failed to find histogram ",histogramDir + histogramName
-        sys.exit()
-         
-    if histoGram.Integral()==0:#checking for empty histos
-        print "WARNING zero entries in histogram ",histogramDir + histogramName
-    
-
- #    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-#     if histogramName=="trt_b_pullR" or histogramName=="trt_ec_pullR_Endcap_A" or histogramName=="trt_ec_pullR_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-#     if histogramName=="trt_b_pullR_notube" or histogramName=="trt_ec_pullR_notube_Endcap_A" or histogramName=="trt_ec_pullR_notube_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-
-
-    histoGram.Sumw2()#so have errors
-    histoGram.SetMarkerColor(markerColor)
-    histoGram.SetMarkerStyle(markerStyle)
-    histoGram.SetLineColor(markerColor)
-
-
-    # rebinning histograms used for the approved plots
-#     if histogramName=="pix_b_residualy":
-#         histoGram.Rebin(2)
-#     if histogramName=="pix_b_residualx_fine" or histogramName=="pix_ec_residualx_fine" or histogramName=="pix_eca_residualx_fine" or histogramName=="pix_ecc_residualx_fine":
-#         histoGram.Rebin(2)
-#         histoGram.SetAxisRange(-.25,.25)
-#     if histogramName=="pix_b_residualy_fine":
-#         histoGram.Rebin(4)
-#         histoGram.SetAxisRange(-.75,.75)
-#     if histogramName=="pix_eca_residualy_fine" or histogramName=="pix_ecc_residualy_fine" or histogramName=="pix_ec_residualy_fine":
-#         histoGram.Rebin(16)
-#         histoGram.SetAxisRange(-.75,.75)
-#     if histogramName=="sct_b_residualx_fine" or histogramName=="sct_ec_residualx_fine" or histogramName=="sct_eca_residualx_fine" or histogramName=="sct_ecc_residualx_fine":
-#         histoGram.Rebin(2)
-#         histoGram.SetAxisRange(-.25,.25)
-#     if histogramName=="pix_b_residualx" or histogramName=="pix_ec_residualx" or histogramName=="sct_b_residualx" or histogramName=="sct_ec_residualx":
-#         histoGram.SetAxisRange(-.5,.5)
-
-  
- 
-    # uncomment to rebin histograms
-    #histoGram.Rebin(16);
-#    if histogramName=="pix_b_residualy" :
-#        histoGram.Rebin(2);
-    if histogramName=="trt_b_residualR":
-        histoGram.Rebin(2);
-        
-    if histogramName=="sct_b_residualx_fine":
-        histoGram.Rebin()
-        
-    if histogramName=="pix_b_residualy_fine" or \
-           histogramName=="sct_b_residualx_fine" or \
-           histogramName=="pix_b_residualx":
-        histoGram.SetAxisRange(-0.15,0.15)
-
-    if histogramName=="pix_b_residualx_fine" or \
-           histogramName=="pix_ec_residualx_fine":
-        histoGram.SetAxisRange(-.1,.1) 
-
-    if histogramName=="pix_b0_residualx" or histogramName=="pix_b1_residualx" or histogramName=="pix_b2_residualx" or histogramName=="pix_ec_residualx" or histogramName=="pix_eca_residualx" or histogramName=="pix_ecc_residualx" :#or histogramName=="pix_b_residualy":
-        histoGram.SetAxisRange(-.25,.25) #pri res
-    if histogramName=="sct_b_residualx" or histogramName=="sct_b0_residualx" or histogramName=="sct_b1_residualx" or histogramName=="sct_b2_residualx" or histogramName=="sct_b3_residualx" or histogramName=="sct_ec_residualx" or histogramName=="sct_eca_residualx" or histogramName=="sct_ecc_residualx":
-        histoGram.SetAxisRange(-.25,.25) #pri res
-
-    if histogramName=="sct_ec_residualx_fine":
-        histoGram.Rebin()
-        histoGram.SetAxisRange(-.2,.2)
-
-
-    #changing the x or y axis range of certain histograms from their defaults
-
-    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C" or histogramName=="trt_ec_residualR" :
-        histoGram.SetAxisRange(-0.5,0.5)
-    if "asym" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-0.3,0.3)
-        # priscilla
-
-#    print " priscilla roofile ", rootFile.GetName()
-
-    if "pT" in histogramName:
-        if "j0" in rootFile.GetName():
-            histoGram.SetAxisRange(15.0,25.0)
-        elif "j1" in rootFile.GetName():
-            histoGram.SetAxisRange(15.0,25.0)
-        else:
-            histoGram.SetAxisRange(15.0,60.0)
-
-    if histogramName=="delta_z0":
-        histoGram.SetAxisRange(-1.,1.)
-
-    if histogramName=="si_barrel_resX_mean" or histogramName=="si_eca_resX_mean" or histogramName=="si_ecc_resX_mean":
-        #Patch for the mean
-        histoGram.Scale(1000)
-        histoGram.GetYaxis().SetRangeUser(-5,5)
-    if histogramName=="pix_b_xresvsmodphi" or  histogramName=="pix_ecc_xresvsmodphi" or histogramName=="pix_eca_xresvsmodphi":
-        #or histogramName=="si_ecc_resX_mean" or histogramName=="si_eca_resX_mean" or histogramName=="si_barrel_resX_mean": Peo 
-        histoGram.GetYaxis().SetRangeUser(-.01,.01) #pri
-    if histogramName=="pix_b_yresvsmodphi" or histogramName=="pix_eca_yresvsmodphi" or histogramName=="pix_ecc_yresvsmodphi":
-        histoGram.GetYaxis().SetRangeUser(-.05,.05) #pri
-    if histogramName=="sct_b_xresvsmodeta" or histogramName=="pix_b_xresvsmodeta": 
-        histoGram.GetYaxis().SetRangeUser(-.005,.005) #pri
-    if histogramName=="sct_b_xresvsmodphi" or histogramName=="sct_eca_xresvsmodphi" or histogramName=="sct_ecc_xresvsmodphi":   
-        histoGram.GetYaxis().SetRangeUser(-.01,.01) #pri
-
-    if histogramName=="sct_b_Oxresxvsmodeta_mean" or histogramName=="pix_b_Oxresxvsmodeta_mean" or histogramName=="pix_b_Oyresyvsmodphi_mean":
-        histoGram.GetYaxis().SetRangeUser(-.05,.05)
-    if histogramName=="pix_b_xresvsmodeta_width" or histogramName=="pix_b_xresvsmodphi_width" or histogramName=="sct_b_xresvsmodeta_width" or histogramName=="sct_b_xresvsmodphi_width" or histogramName=="si_barrel_resX_rms" or histogramName=="si_eca_resX_rms" or histogramName=="si_ecc_resX_rms":
-
-        histoGram.GetYaxis().SetRangeUser(0.00,0.07)
-    if histogramName=="si_barrel_pullX_mean" or histogramName=="si_eca_pullX_mean" or histogramName=="si_ecc_pullX_mean":
-        histoGram.GetYaxis().SetRangeUser(-.4,.4)
-
-    if histogramName=="measurements_eff_vs_layer_ecc" or histogramName=="measurements_eff_vs_layer_eca" or histogramName=="measurements_eff_vs_layer_barrel":
-        histoGram.GetYaxis().SetRangeUser(0.9,1.05)
-    if  histogramName=="hits_eff_vs_phiSector_trt_b0"  or histogramName=="hits_eff_vs_phiSector_trt_b1" or histogramName=="hits_eff_vs_phiSector_trt_b2":
-        histoGram.GetYaxis().SetRangeUser(0.7,1.02)
-
-    if histogramName=="eff_trthits_eta0" or histogramName=="eff_trthits_phi0":
-        histoGram.GetYaxis().SetRangeUser(0.6,1.05)
-    if histogramName=="trt_b_rmsRes_l0" or histogramName=="trt_b_rmsRes_l1" or histogramName=="trt_b_rmsRes_l2" or histogramName=="trt_b_rmsResOverPhiVsStrawLayer": 
-        histoGram.GetYaxis().SetRangeUser(.16,.29)
-    if "trt_ec_rms" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(.16,.29)
-        
-    if histogramName=="trt_b_aveResOverPhiVsStrawLayer" or histogramName=="trt_b_aveRes_l0" or histogramName=="trt_b_aveRes_l1" or histogramName=="trt_b_aveRes_l2":
-        histoGram.Scale(1000.)
-        histoGram.GetYaxis().SetRangeUser(-5,5)
-        
-    if histogramName=="trt_ec_aveResVsPhiSec_Endcap_C" or histogramName=="trt_ec_aveResVsPhiSec_Endcap_A" or histogramName=="trt_ec_aveResVsRing_Endcap_C" or histogramName=="trt_ec_aveResVsRing_Endcap_A":
-        histoGram.Scale(1000.)
-        histoGram.GetYaxis().SetRangeUser(-5,5)
-    if histogramName=="ntracks":
-        histoGram.SetAxisRange(0.,10.)
- #   if histogramName=="pT" or histogramName=="pT_nolog":
- #       histoGram.SetAxisRange(-50.0,50.0)
-    if histogramName=="d0":
-        histoGram.SetAxisRange(-25.0,25.0)
-    if histogramName=="d0_bscorr" or histogramName=="d0_pvcorr":
-        histoGram.SetAxisRange(-1.0,1.0)
-    if histogramName=="z0_pvcorr":
-        histoGram.SetAxisRange(-1.0,1.0)
-
-    if histogramName=="delta_eta0":
-        histoGram.SetAxisRange(-0.02,0.02)
-    if histogramName=="delta_d0" or histogramName=="delta_phi0" or histogramName=="delta_eta0" or histogramName=="delta_z0" or histogramName=="delta_qOverPt":
-        histoGram.Sumw2()
-    if histogramName=="delta_d0" or histogramName=="delta_phi0" or histogramName=="delta_qOverPt":
-        histoGram.Rebin(4)
-    if "hits_eff" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(0.6,1.0)
-
-    #if "err" in histogramName and "VsPt" in histogramName:
-    #    newBins = array('d',[0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,12.0,14.0,16.0,18.0,20.0,25.0,30.0,35.0,40.0])
-    #    histoGram = histoGram.Rebin(19,"new",newBins)
-    #    if "D0" in histogramName:
-    #        histoGram.GetYaxis().SetRangeUser(0.0,0.15)
-
-
-    if "D0bsVs" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-0.04,0.04)
-        if "VsPt" in histogramName:
-            #newBins = array('d',[-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0])
-            #histoGram = histoGram.Rebin(16,"new",newBins)
-            histoGram.SetAxisRange(-10.,10.)
-        if "VsEta" in histogramName:
-            histoGram.SetAxisRange(-2.6,2.6)
-    if "residualx_pt" in histogramName:#silicon histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.005,0.005)
-        if "fwhm" in histogramName:
-            if "sct" in histogramName:
-                histoGram.GetYaxis().SetRangeUser(0.02,0.05)
-            if "pix" in histogramName:
-                histoGram.GetYaxis().SetRangeUser(0.005,0.035)
-    if "residual_pt" in histogramName:#trt histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.005,0.005)
-        if "fwhm" in histogramName or "width" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(0.100,0.150)
-    if "pullx_pt" in histogramName:#silicon histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.03,0.03)
-        if "width" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(0.90,1.05)
-
-
-            #if "aveResVsPhiSec" in histogramName or "aveResVsRing" in histogramName: 
-            #histoGram.GetYaxis().SetRangeUser(-0.005,0.005)       
-
-    if "average_delta_d0" in histogramName or "average_delta_z0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.1,.1)
-    if "average_delta_phi0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.002,.002)  
-
-    if "average_delta_qOverPt" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.0015,.0015)  
-    if "average_delta_eta0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.02,.02)  
-
-    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.5*max_bin_val))
-
-    #print "bin size for ",histogramName," = " , histoGram.GetBinWidth(50)        
-
-    return histoGram
-    
-def RemoveNegativeYAxis(histoGram,histogramName):
-
-    ## This is to ensure that the y-axis doesn't go negative for e.g. residuals plots
-    ## (sometimes ROOT likes to do this)
-    if histogramName=="pix_b_residualx" or histogramName=="pix_eca_residualx" or histogramName=="pix_ecc_residualx" or histogramName=="sct_b_residualx" or histogramName=="sct_eca_residualx" or histogramName=="sct_ecc_residualx" or histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C" or histogramName=="pix_b0_residualx" or histogramName=="pix_b1_residualx" or histogramName=="pix_b2_residualx" or histogramName=="sct_b0_residualx" or histogramName=="sct_b1_residualx" or histogramName=="sct_b2_residualx" or histogramName=="sct_b3_residualx" or histogramName=="delta_qOverPt" or histogramName=="delta_d0" or histogramName=="delta_z0" or histogramName=="delta_phi0" or histogramName=="delta_eta0" or histogramName=="chi2oDoF" or histogramName=="pix_b_residualx_fine" or histogramName=="sct_b_residualx_fine":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.1*max_bin_val))
-
-    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.5*max_bin_val))
-
-def MakeFit(histoGram,fitType,markerColor):
-    
-    if fitType=="noFit": #do not perform a fit
-        fit = noFit(histoGram)
-
-    elif fitType=="noFitWithStats": #do not perform a fit
-        fit = noFitWithStats(histoGram)
-
-    elif fitType=="doubleGaus": #double Gaussian fit
-        fit = doubleGaus(histoGram)
-
-    elif fitType=="freeDoubleGaus": #this fit is unstable, not recommended
-        fit = freeDoubleGaus(histoGram,[500.,0.,0.05,1000.,0.,0.1])
-
-    elif fitType=="singleGaus": #single Gaussian fit
-        fit = singleGaus(histoGram)
-
-    elif fitType=="singleGausRestricted": #single Gaussian fit
-        fit = singleGausRestricted(histoGram)
-
-    elif fitType=="singleGausIterative": #single Gaussian fit iterated
-        fit = singleGausIterative(histoGram,sigmaIterativeGaus)
-
-    else:
-        print "EXITING: fitType - ",fitType," does not exist" 
-        sys.exit()
-
-    fit.SetLineColor(markerColor)
-
-    return fit
-
-
-
-
-def defineLegendTextMarker(units, histoGram, funcTion, legendLeftX, legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod,legendMarkerSize):
-
-
-    text = ""
-    text2 = ""
-
-    if(funcTion.GetName()!=""):
-        if(funcTion.GetName()!="noFitWithStats"):
-
-            newMean = funcTion.GetParameter(1)
-            newRMS = funcTion.GetParameter(2)
-
-        else: 
-
-            if statsMethod==0:
-                ## Just using straight Mean/RMS for full bin range
-                newMean = histoGram.GetMean()
-                newRMS = histoGram.GetRMS()
-
-            elif statsMethod==1:
-                ### using integral method to determine 95% range for mean/rms calculation
-                meanRMSTuple = findMeanRMSFromTruncatedDistribution(histoGram)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-
-            elif statsMethod==2:
-                ### using a range defined by RMS of histogram
-                meanRMSTuple = findMeanRMSUsingRange(histoGram,sigmaIterativeGaus)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-
-            elif statsMethod==3:
-                ### using FWHM corrected to Gaussian sigma
-                meanRMSTuple = findMeanRMSUsingFWHM(histoGram)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-                print "mean = ",newMean
-                print "FWHM/2.35 = ",newRMS
-
-            else:
-                print "no valid statsMethod set!!!!"
-            
-        #adding the mean to the legend text object
-        if showMean:
-            text = "#mu="
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text += str(round(1000*newMean,2))
-            elif "pull" in histoGram.GetName():
-                text += str(round(newMean,2))
-            elif "mean_" in histoGram.GetName():
-                text += str(round(newMean,2))
-            else:
-            #text += str(int(1000*newMean))
-                text += str(int(round(newMean,3)*1000))
-            text += " "+units
-            
-                
-
-
-        #adding the "width" to the legend text object
-        #unless have requested they are on a separate line
-        if meanWidthOnSeparateLine==False:
-            if showMean:
-                #if "mean_" in histoGram.GetName(): 
-                 #   text += "\\n"
-                #else:
-                text += ", "
-
-            if funcTion.GetName()!="noFitWithStats" : 
-                #text += ", #sigma="
-                text += "#sigma="
-            else:
-                if statsMethod==0 or statsMethod==2:
-                    text += "RMS="
-                if statsMethod==1:
-                    text += "RMS_{95%}="
-                if statsMethod==3:                
-                    text += "FWHM/2.35="
-
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text += str(round(1000*newRMS,2))
-            elif "pull" in histoGram.GetName():
-                text += str(round(newRMS,2))
-            elif "mean_" in histoGram.GetName():
-                text += str(round(newRMS,2))
-            else:
-                text += str(int(round(round(newRMS,4)*1000,0))) #will produce correctly rounded to 1 micron accuracy
-                #text += str(round(newRMS,4)*1000) # to see 0.1 micron accuracy in width
-#                if (int(newRMS*1000/10) > 1):
-#                    text += str(int(round(newRMS*1000, 1)))
-#                else: ####b priscilla!!!!!!!!!!!!
-#                    text += str(round(newRMS*1000, 1))
-            text += " "+units
-        
-        else: #have requested mean width on separate line, so fill separate text object
-            if funcTion.GetName()!="noFitWithStats" : 
-                text2 += "#sigma="
-            else:
-                if statsMethod==0 or statsMethod==2:
-                    text2 += "RMS="
-                if statsMethod==1:
-                    text2 += "RMS_{95%}="
-                if statsMethod==3:                
-                    text2 += "FWHM/2.35="
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text2 += str(round(1000*newRMS,2))
-            elif "pull" in histoGram.GetName():
-                text2 += str(round(newRMS,2))
-            elif "mean_" in histoGram.GetName():
-                text2 += str(round(newRMS,2))
-            else:
-                text2 += str(int(round(newRMS,3)*1000))
-            text2 += " "+units
-                
-    tsize=0.06
-    marker = TMarker(legendLeftX-(0.4*tsize),legendUpperY+legendMarkerYPosMod,8)
-    marker.SetNDC()
-    marker.SetMarkerStyle(histoGram.GetMarkerStyle())
-    marker.SetMarkerSize(legendMarkerSize)
-    marker.SetMarkerColor(histoGram.GetMarkerColor())
-
-    return marker, text, text2
-
-def findMeanRMSFromTruncatedDistribution(histoGram):
-    # this finds the statistical mean/rms using a truncated distribution such that contains 95% of the entries of the 
-    # full range (including overflow/underflow)
-    # i.e. the mean and RMS defined using bins which contain 95% of entries (symmetrically) around the mean bin
-    # NOTE - if there is significant underflow/overflow this will not be reliable (see explicit check below)
-
-    cloneHist = histoGram.Clone()
-
-    hmean = cloneHist.GetMean()
-    print "*************************************************************************"
-    print "mean = ",hmean, ", RMS = ",cloneHist.GetRMS(), ", nBins = ",cloneHist.GetNbinsX()
-    hFullIntegral = cloneHist.Integral(0,cloneHist.GetNbinsX()+1)
-    print "full integral = ",hFullIntegral,", nentries = ",cloneHist.GetEntries()
-
-    print "underflow = ",cloneHist.GetBinContent(0), ", overflow = ",cloneHist.GetBinContent(cloneHist.GetNbinsX()+1)
-    totalOverflow = cloneHist.GetBinContent(0) + cloneHist.GetBinContent(cloneHist.GetNbinsX()+1)
-
-    hTargetIntegral = 0.95*hFullIntegral
-    print "target integral = ",hTargetIntegral
-    hMeanBin = cloneHist.FindBin(hmean)
-    print "meanbin = ",hMeanBin
-
-    # this prescription to calculate 95% RMS from a histogram is only valid if the overflow/underflow is 
-    # sufficiently small. If overflow/underflow is too large, then the targetIntegral may lie within the underflow/overflow
-    # and thus we cannot reliably compute the spread
-    if hFullIntegral - hTargetIntegral < totalOverflow:
-        print "WARNING - potentially 95% range will go into overflow bins and not be valid. 95% RMS set to zero!!!"
-        #return 0.0,0.0
-        
-
-    lowBin = hMeanBin
-    highBin = hMeanBin
-    hIntegral = 0.0
-    while hIntegral < hTargetIntegral:
-        # find the bin which contains the mean
-        # then integrate symmetrically around this bin, increasing the range 
-        # until the integral is larger than the target
-        # this defines your upper and lower bounds for mean/rms.
-        lowBin = lowBin - 1
-        highBin = highBin + 1
-        hIntegral = cloneHist.Integral(lowBin,highBin)
-        #print "integral between bins ",lowBin,"-",highBin," = ",hIntegral
-
-    print "For Histogram " , cloneHist.GetName(), "Mean/RMS bin range is",lowBin,"-",highBin, ", axis range ",cloneHist.GetBinLowEdge(lowBin)," - ", cloneHist.GetBinLowEdge(highBin) + cloneHist.GetBinWidth(highBin)
-
-    cloneHist.GetXaxis().SetRange(lowBin,highBin)
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = cloneHist.GetRMS()
-    print "mean after constrained axis = ",hNewMean
-    print "RMS after constrained axis = ",hNewRMS
-    
-    return hNewMean, hNewRMS
-        
-
-def findMeanRMSUsingRange(histoGram, sigmaRange):
-
-    cloneHist = histoGram.Clone()
-
-    hMean = cloneHist.GetMean()
-    hRMS = cloneHist.GetRMS()
-    print "original mean = ", hMean," RMS = ",hRMS
-
-    lowBin = cloneHist.FindBin(hMean - hRMS*sigmaRange)
-    highBin = cloneHist.FindBin(hMean + hRMS*sigmaRange)
-
-    #print "lowBin = ",lowBin,", highBin = ",highBin, ", nBins = ", cloneHist.GetNbinsX()
-    
-    cloneHist.GetXaxis().SetRange(lowBin,highBin)
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = cloneHist.GetRMS()
-    #print "mean after constrained axis = ",hNewMean
-    #print "RMS after constrained axis = ",hNewRMS
-
-    return hNewMean, hNewRMS
-
-def findFractionWithinSigmaRange(histoGram, sigmaRange):
-
-    hMean = histoGram.GetMean()
-    hRMS = histoGram.GetRMS()
-    #print "original mean = ", hMean," RMS = ",hRMS
-
-    lowBin = histoGram.FindBin(hMean - hRMS*sigmaRange)
-    highBin = histoGram.FindBin(hMean + hRMS*sigmaRange)
-
-    #print "lowBin = ",lowBin,", highBin = ",highBin, ", nBins = ", histoGram.GetNbinsX()
-    
-    intGral = histoGram.Integral(lowBin,highBin)
-    fullIntGral = histoGram.Integral(1,histoGram.GetNbinsX())
-    print "histo ",histoGram.GetName()," fraction covered by fit = ",intGral/fullIntGral
-
-    return intGral/fullIntGral
-
-def findMeanRMSUsingFWHM(histoGram):
-
-    # we clone the histogram here because otherwise the original histogram will be rebinned
-    # unfortunately this rebinning happens after the y-axis range has been defined in DrawPlots()
-    # and so messes up drawing of histograms
-    cloneHist = histoGram.Clone()
-    debug = False
-
-    if debug: print "original bin width = ",cloneHist.GetBinWidth(1)
-
-
-    rebinHistogram = True
-
-    while rebinHistogram==True:
-
-        rebinHistogram = False
-
-        hMaxBin = cloneHist.GetMaximumBin()
-        hMax = cloneHist.GetBinContent(hMaxBin)
-        hHalfMax = hMax/2.0
-
-        if debug: print "hNBins = ", cloneHist.GetNbinsX(), ", hMaxBin =  ", hMaxBin, ", hMax = ", hMax, ", hHalfMax = ",hHalfMax
-
-        lowBin = hMaxBin
-        highBin = hMaxBin
-        hLowContent = hMax
-        hHighContent = hMax
-        while hLowContent > hHalfMax:
-            lowBin = lowBin - 1
-            hLowContent = cloneHist.GetBinContent(lowBin)
-            #print "lowcotent =  ",hLowContent
-        while hHighContent > hHalfMax:
-            highBin = highBin + 1
-            hHighContent = cloneHist.GetBinContent(highBin)
-            #print "highcotent =  ",hHighContent
-
-        lowBinTest = lowBin - abs(hMaxBin - lowBin)
-        highBinTest = highBin + abs(highBin - hMaxBin)
-
-        while lowBinTest < hMaxBin:
-            if cloneHist.GetBinContent(lowBinTest) > cloneHist.GetBinContent(lowBinTest+1):
-                rebinHistogram = True
-                lowBinTest = hMaxBin #exits while loop
-            lowBinTest = lowBinTest + 1
-
-        while highBinTest > hMaxBin:
-            if cloneHist.GetBinContent(highBinTest) > cloneHist.GetBinContent(highBinTest-1):
-                rebinHistogram = True
-                highBinTest = hMaxBin #exits while loop
-            highBinTest = highBinTest - 1
-
-        if rebinHistogram==True:
-            cloneHist.Rebin(2)
-            if debug: print "rebinning histogram"
-
-
-
-    # analytical solution to linear interpolation between the two bins where the half max threshold is crossed
-    # using y1 = A*x1 + B, and y2 = A*x2 + B, solving for A and B
-    lowFuncA = (cloneHist.GetBinContent(lowBin) - cloneHist.GetBinContent(lowBin+1))/(cloneHist.GetBinCenter(lowBin) - cloneHist.GetBinCenter(lowBin+1))
-    lowFuncB = cloneHist.GetBinContent(lowBin) - lowFuncA*(cloneHist.GetBinCenter(lowBin))
-
-    highFuncA = (cloneHist.GetBinContent(highBin-1) - cloneHist.GetBinContent(highBin))/(cloneHist.GetBinCenter(highBin-1) - cloneHist.GetBinCenter(highBin))
-    highFuncB = cloneHist.GetBinContent(highBin-1) - highFuncA*(cloneHist.GetBinCenter(highBin-1))
-
-    lowFWHM = -99999.0
-    highFWHM = 99999.0
-
-    if interpolateFWHM:
-        # using x = (y - B)/A
-        if lowFuncA != 0.0:
-            lowFWHM = (hHalfMax - lowFuncB)/lowFuncA
-        if highFuncA != 0.0:
-            highFWHM = (hHalfMax - highFuncB)/highFuncA
-    else:
-        lowFWHM = cloneHist.GetBinLowEdge(lowBin) + cloneHist.GetBinWidth(lowBin)
-        highFWHM = cloneHist.GetBinLowEdge(highBin)
-
-    if debug: print "lowBin = ", lowBin-hMaxBin, ", lowFWHM =  ", lowFWHM, " || highBin = ",highBin-hMaxBin, ", highFWHM = ", highFWHM, ", FWHM = ",(highFWHM - lowFWHM)/2.35482
-
-
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = (highFWHM - lowFWHM)/2.35482 #divide to make equivalent to Gaussian sigma
-
-    return hNewMean, hNewRMS
-
-
-def returnTuple(FZ01,hist,legendTitle):
-
-    return FZ01,hist,legendTitle
-
-
-def noFit(hist):
-    #dummy function, does not preform a fit
-    FZ01 = TF1()
-    return FZ01
-
-def noFitWithStats(hist):
-    #dummy function, this fit will not be drawn
-    FZ01 = TF1("noFitWithStats","gaus",-1.0,1.0)
-    return FZ01
-
-
-def singleGaus(hist):
-
-    #min = -2.5
-    #max = 2.5
-
-    min = hist.GetBinLowEdge(1)
-    max = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    FZ01 = TF1("FZ01", "gaus", min,max)
-
-    FZ01.SetLineWidth(2)
-    hist.Fit("FZ01", "ORQ","same")
-    
-    return FZ01
-
-def singleGausRestricted(hist):
-
-    # performs single Gaussian fit within 1.5*RMS range
-    max = hist.GetMean() + 1.5*hist.GetRMS()
-    min = hist.GetMean() - 1.5*hist.GetRMS()
-    
-    FZ01 = TF1("FZ01", "gaus", min,max)
-
-    FZ01.SetLineWidth(2)
-    hist.Fit("FZ01", "ORQ","same")
-    
-    return FZ01
-
-def singleGausIterative(hist, sigmaRange):
-
-    debug = False
-
-    # first perform a single Gaus fit across full range of histogram
-    min = hist.GetBinLowEdge(1)
-    max = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    fitA = TF1("fitA", "gaus", min,max)
-    hist.Fit("fitA","ORQN","same")
-    fitAMean = fitA.GetParameter(1)
-    fitASig = fitA.GetParameter(2)
-
-    # performs a second fit with range determined by first fit
-    max = fitAMean + (fitASig*sigmaRange)
-    min = fitAMean - (fitASig*sigmaRange)
-    fitB = TF1("fitB", "gaus", min,max)
-    hist.Fit("fitB","ORQN","same")
-    fitMean = fitB.GetParameter(1)
-    fitSig = fitB.GetParameter(2)
-    
-    newFitSig = 99999
-    newFitMean = 99999
-    i = 0
-    max = fitMean + (fitSig*sigmaRange)
-    min = fitMean - (fitSig*sigmaRange)
-    fit = TF1("fit", "gaus", min,max)
-
-    while abs(fitSig - newFitSig) > 0.0005 or abs(fitMean - newFitMean) > 0.0005:
-        
-        if(i > 0):
-            fitMean = newFitMean
-            fitSig = newFitSig
-        #print "i = ",i," fitMean = ",fitMean," fitSig = ",fitSig
-        max = fitMean + (fitSig*sigmaRange)
-        min = fitMean - (fitSig*sigmaRange)
-        fit.SetRange(min,max)
-        hist.Fit("fit","ORQN","same")
-        newFitMean = fit.GetParameter(1)
-        newFitSig = fit.GetParameter(2)
-        #print "i = ",i," newFitMean = ", newFitMean, " newFitSig = ",newFitSig
-        if(i > 50):
-            if debug:
-                print "WARNING terminate iterative gaus fit because of convergence problems"
-                print "final mean =  ", newFitMean, ", previous iter mean = ", fitMean
-                print "final sigma =  ", newFitSig, ", previous iter sigma = ", fitSig
-            break
-
-        i = i + 1
-
-
-
-    if debug:
-        print "Final i = ",i," finalFitMean = ", fit.GetParameter(1), " finalFitSig = ",fit.GetParameter(2)
-
-    fit.SetLineWidth(2)
-    
-    return fit
-
-
-def freeDoubleGaus(hist,fitInput):
-
-    #this fit is not very stable, very sensitive to 
-    #initial fitInput parameters (width,mean, normalisation etc)
-    #use instead the doubleGaus method below
-
-    min = -0.5
-    max = 0.5
-    #print "Fitting from",min,"to",max
-    FZ01 = TF1("FZ01","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min,max)
-    FZ01.SetParameter(0,fitInput[0])
-    FZ01.SetParameter(1,fitInput[1])
-    FZ01.SetParameter(2,fitInput[2])
-    FZ01.SetParameter(3,fitInput[3])
-    FZ01.SetParameter(4,fitInput[4])
-    FZ01.SetParameter(5,fitInput[5])
-    FZ01.SetLineWidth(2)
-
-    hist.Fit("FZ01", "ORQ","same")
-
-    return FZ01
-
-def doubleGaus(hist):
-
-    #first we make a single Gauss fit over entire range
-    #to determine the range for the core Gauss fit below
-    min_temp = hist.GetBinLowEdge(1)
-    max_temp = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    fit_temp = TF1("fit_temp","gaus",min_temp,max_temp)
-    hist.Fit("fit_temp", "RQON")
-    fitMean_temp = fit_temp.GetParameter(1)
-    fitSig_temp  = fit_temp.GetParameter(2)
-
-    #we make a single Gauss fit to the core
-    minCore = fitMean_temp - 1.0*fitSig_temp
-    maxCore = fitMean_temp + 1.0*fitSig_temp
-    FCore = TF1("FCore","gaus",minCore,maxCore)
-    hist.Fit("FCore","RQON")
-
-    #we make the first double Gauss fit, fixing the mean and width of one 
-    #of the Gaussians to that of the core Gauss fit, and letting the second
-    #Gauss vary but with some sensible starting point
-    FFixCore = TF1("FFixCore","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min_temp,max_temp)
-    FFixCore.SetParameter(0,FCore.GetParameter(0))
-    FFixCore.FixParameter(1,FCore.GetParameter(1))
-    FFixCore.FixParameter(2,FCore.GetParameter(2))
-    #FFixCore.SetParameter(3,FCore.GetParameter(0)/3.0) #normalisation
-    FFixCore.SetParameter(3,FCore.GetParameter(0)/5.0) #normalisation
-    FFixCore.SetParameter(4,FCore.GetParameter(1))     #mean
-    #FFixCore.SetParameter(5,FCore.GetParameter(2)*5.0) #width
-    FFixCore.SetParameter(5,FCore.GetParameter(2)*2.0) #width
-    hist.Fit("FFixCore","RQON")
-        
-    #we do the final double Gaussian fit letting everything vary but using 
-    #as inputs the result of the previous constrained fit
-    FFull = TF1("FFull","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min_temp,max_temp)
-    FFull.SetParameter(0,FFixCore.GetParameter(0))
-    FFull.SetParameter(1,FFixCore.GetParameter(1))
-    FFull.SetParameter(2,FFixCore.GetParameter(2))
-    FFull.SetParameter(3,FFixCore.GetParameter(3))
-    FFull.SetParameter(4,FFixCore.GetParameter(4))
-    FFull.SetParameter(5,FFixCore.GetParameter(5))
-    hist.Fit("FFull","RQO","same")
-    
-    #print "FFull core mean = ",FFull.GetParameter(1)," width = ",FFull.GetParameter(2)
-    #print "FFull tail mean = ",FFull.GetParameter(4)," width = ",FFull.GetParameter(5)
-        
-    
-    return FFull
-
-def doubleFit(hist,units,color,xLeft,yLow,same):
-    min_temp = hist.GetBinLowEdge(0)
-    max_temp = hist.GetBinLowEdge(hist.GetNbinsX())
-    fit_temp = TF1("fit_temp","gaus",min_temp,max_temp)
-    if same:
-        hist.Fit("fit_temp", "ORQ","same")
-    else:
-        hist.Fit("fit_temp", "ORQ","")
-    fitMean_temp = fit_temp.GetParameter(1)
-    fitSig_temp  = fit_temp.GetParameter(2)
-    min = fitMean_temp - 1.5* fitSig_temp
-    max = fitMean_temp + 1.5 * fitSig_temp
-    fit = TF1("fit","gaus",min,max )
-    fit.SetLineColor(color)
-    if same:
-        hist.Fit("fit", "ORQ","same")
-    else:
-        hist.Fit("fit", "ORQ","")
-    fit.Draw("same")
-
-    # Draw the after mean and sigma
-    text = "#mu="
-    text += str(round(fit.GetParameter(1),5))
-    text += " "+units+", #sigma="
-    text += str(round(fit.GetParameter(2),4))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetLineColor(color)
-    m_l.SetTextSize(0.03)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.SetTextColor(color)
-    print text
-    m_l.DrawLatex(xLeft,yLow,text)
-
-def quoteMeanAndRMS(hist,units,color,xLeft,yLow,same):
-    
-    # Draw the after mean and sigma
-    text = "mean = "
-    text += str(round(hist.GetMean(),5))
-    text += " "+units+", RMS = "
-    text += str(round(hist.GetRMS(),4))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetLineColor(color)
-    m_l.SetTextSize(0.03)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.SetTextColor(color)
-    print text
-    m_l.DrawLatex(xLeft,yLow,text)
-
-
-def plotStatVersusFile(rootFiles, histDirectories, fileLabels, nFiles, histogramName, meanFWHM=0):
-
-    # plots mean of a particular histogram for different files as separate 
-    # entries on x-axis
-
-    statHist = TH1F("statHist","statHist",3,0.,3.)
-
-    for i in range(nFiles):
-
-        hist = GetHistogram(rootFiles[i],histDirectories[i],histogramName,1,29)
-        #RemoveNegativeYAxis(hist,histogramName)
-        #hist.Scale(2.0)
-        mean = hist.GetMean()
-        rms = hist.GetRMS()
-        entries = hist.GetEntries()
-        sqrtEntries = math.sqrt(entries);
-        meanErr = rms/sqrtEntries
-        print "mean = ", mean, ", rms = ", rms, ", entries = ",entries, ", sqrtEntries = ", sqrtEntries, ", meanErr = ", meanErr
-        
-        if meanFWHM==0:
-            statHist.SetBinContent(i+1,mean)
-            statHist.SetBinError(i+1,meanErr)
-        else:
-            meanFWHMTuple = findMeanRMSUsingFWHM(hist)
-            print "mean =", meanFWHMTuple[0]
-            print "FWHM/2.35 = ", meanFWHMTuple[1]
-            statHist.SetBinContent(i+1,meanFWHMTuple[1])
-            statHist.SetBinError(i+1,0.00000001)#no error defined for FWHM
-
-        statHist.GetXaxis().SetBinLabel(i+1,fileLabels[i])
-        
-    if meanFWHM==0:
-        statHist.GetYaxis().SetRangeUser(-0.005,0.005)
-    #else:
-    #    statHist.GetYaxis().SetRangeUser(0.0,0.2)
-    statHist.GetXaxis().SetLabelSize(0.06)
-
-
-    return statHist
-
-
-def simpleDrawSingleHist(hist, yAxisTitle, xAxisTitle, plotTitle,  
-              canvasText, outputName="test.png", textBoxLeftX=0.60, textBoxUpperY=0.91):
-
-    can = TCanvas(outputName,outputName,800,600)
-    can.cd()
-
-    hist.GetXaxis().SetTitle(xAxisTitle)
-    hist.GetYaxis().SetTitle(yAxisTitle)
-    hist.GetYaxis().SetTitleOffset(1.42)
-    hist.Draw()
-  
-    # canvas text (right hand side)
-    latexAtlas = TLatex()
-    latexAtlas.SetNDC()
-    latexAtlas.SetTextColor(1)
-    latexAtlas2 = TLatex()
-    latexAtlas2.SetNDC()
-
-    latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0])
-    latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,plotTitle)
-    latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[1])
-    latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[2])
-
-    can.SaveAs(outputName)
-
-def Test(histogramName):
-
-    print "histoName = ", histogramName
-
-    if "bin-" in histogramName:
-#        binNum = (histogramName.split('-'))
-#        print "binNum = ", binNum[1]
-        binNum = (histogramName.split('-'))[1]
-        print "binNum = ", binNum        
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities_ZmumuCosmics.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities_ZmumuCosmics.py
deleted file mode 100644
index 153b76b0951830bdd6f94a7aaaf6647a0cb6bbf5..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities_ZmumuCosmics.py
+++ /dev/null
@@ -1,1820 +0,0 @@
-# Author:
-#  John Alison johnda@hep.upenn.edu
-#  Ben Cooper b.d.cooper@qmul.ac.uk
-
-
-import sys, math
-#from ROOT import TH1,TF1,TLatex,TCanvas,TMarker,TH1F, gROOT
-from array import array
-
-from ROOT import *
-from AtlasStyle import *
-#SetAtlasStyle()
-TGaxis.SetMaxDigits(4)
-
-
-# if this is true then legends are drawn in order of the input files
-# if it is false then legends are drawn in order of max histogram first
-# no need for this ever to be False really
-forceDrawOrder = True
-
-normaliserHisto = 0 #histogram which other hists are normalised to if normalisation is used. e.g. 0 is hist from first file
-statsMethod = 3 #how width is calculated if don't use fit. 0 = plain RMS, 1 = RMS(95%), 2 = RMS within range (sigmaIterativeGaus), 3 = FWHM/2.35
-interpolateFWHM = True # use linear interpolation in FWHM estimation
-sigmaIterativeGaus = 1.5 #controls sigma range used for iterative single Gaussian fit
-ZmumuVal = True #flag for ZmumuValidation particular things (axes range etc)
-pTmin = 0 #the minimum pT for ZmumuValidation
-pTmax = 100 #the maximum pT for ZmumuValidation
-
-
-def DrawPlots(inputTuple, outputName, plotTitle, yAxisTitle, xAxisTitle, legendLeftX, legendUpperY, units, 
-              canvasText, makeOutput, textBoxLeftX=0.60, textBoxUpperY=0.91, dynamicYRange=True, plotCosmetics="Default"):
-
-
-
-    # dynamicYRange=True means that the y-range of the histogram drawn first is adjusted so that 
-    # all the histograms will fit into this range. If False then the default y-range of the first histogram is used.
-
-    if(plotCosmetics=="Default"):
-        legendTextSize = 0.035
-        legendMarkerSize = 1.5
-        legendYLineSpacing = 0.05 # determines how spaced out in y the legend entries are (may want to increase/decrease depending on legend text size)
-        legendMarkerYPosMod = [0.0,0.0,0.0,0.0] #for some reason the marker doesn't appear next to legend text in Y without some modification
-        meanWidthOnSeparateLine = False# if true mean and width are displayed in legend on separate lines, if false they are on the same line
-        showMean = True
-        plotTitleOnFirstLine = False # puts the plotTitle next to the first text on the plot e.g. ATLAS
-                                     #yAxisTitleOffset = 1.42 # NOT USED now handled by AtlasStyle
-        yAxisTitleOffset = 1.8
-    if(plotCosmetics=="ApprovedPlots"):
-        legendTextSize = 0.05
-        legendMarkerSize = 1.7
-        legendYLineSpacing = 0.07 
-        legendMarkerYPosMod = [-0.004,-0.004,-0.004,-0.004]
-        meanWidthOnSeparateLine = False
-        showMean = False
-        plotTitleOnFirstLine = False 
-        yAxisTitleOffset = 1.55 # NOT USED now handled by AtlasStyle
-
-    if(plotCosmetics=="ApprovedPlotsMay"):
-        legendTextSize = 0.04
-        legendMarkerSize = 1.7
-        legendYLineSpacing = 0.05 
-        legendMarkerYPosMod = [0.0,0.0,0.0,0.0]
-        meanWidthOnSeparateLine = False
-        showMean = False
-        plotTitleOnFirstLine = False 
-        yAxisTitleOffset = 1.55 # NOT USED now handled by AtlasStyle
-    
-    if(plotCosmetics=="SmallLegend"):
-        legendTextSize = 0.04
-        legendMarkerSize = 1.7
-        legendYLineSpacing = 0.035
-        #legendMarkerYPosMod = -0.000
-        legendMarkerYPosMod = [-0.002,0.0,0.0,0.0]
-        meanWidthOnSeparateLine = False
-        showMean = False
-        plotTitleOnFirstLine = False
-        yAxisTitleOffset = 1.55 # NOT USED now handled by AtlasStyle
-
-    if(plotCosmetics=="SeparateLine"):
-        legendTextSize = 0.035
-        legendMarkerSize = 1.5
-        legendYLineSpacing = 0.05 # determines how spaced out in y the legend entries are (may want to increase/decrease depending on legend text size)
-        legendMarkerYPosMod = [0.0,0.0,0.0,0.0] #for some reason the marker doesn't appear next to legend text in Y without some modification
-        meanWidthOnSeparateLine = True # if true mean and width are displayed in legend on separate lines, if false they are on the same line
-        showMean = True
-        plotTitleOnFirstLine = False 
-        yAxisTitleOffset = 1.8 # NOT USED now handled by AtlasStyle
-
-    can = TCanvas(outputName,outputName,800,600)
-    can.cd()
-
-        
-    # determining the max and min histograms
-    maxYVal = -9999999.0
-    minYVal = 9999999.0
-    for i in range(len(inputTuple)):
-        
-        if i==1 or i==4 or i==7 or i==10:
-            if inputTuple[i].GetMaximum() > maxYVal:
-                #maxYVal = inputTuple[i].GetMaximum()
-                maxYVal = inputTuple[i].GetBinContent(inputTuple[i].GetMaximumBin())
-            if inputTuple[i].GetMinimum() < minYVal:
-                #minYVal = inputTuple[i].GetMinimum()
-                minYVal = inputTuple[i].GetBinContent(inputTuple[i].GetMinimumBin())
-    #minYVal = 0.0 #overriding for now 
-    #print "maxYVal = ",maxYVal,", minYVal = ",minYVal
-
-    # drawing the first histogram
-    hist = inputTuple[1]
-    #if hist.GetName()=="pT":
-
-        #I was asked to set y linear 19/06/13
-        # gPad.SetLogy()
-        #I am trying to fix the X range for Pt plots. Please do it in a better way!! (PF 28/03/13)
-    histoTitle = hist.GetName()
-    if histoTitle.find('pT')!=-1  and ZmumuVal:
-        hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-    if dynamicYRange:
-        if hist.GetName()=="pix_b_residualy":
-            hist.GetYaxis().SetRangeUser(minYVal,maxYVal*1.33)
-        else:
-            #hist.GetYaxis().SetRangeUser(minYVal*1.10,maxYVal*1.10)
-            hist.GetYaxis().SetRangeUser(minYVal*0.8,maxYVal*1.20)
-            
-            
-                
-            
-    hist.GetXaxis().SetTitle(xAxisTitle)
-    if hist.GetYaxis().GetTitle()!="Arbitrary units":
-        hist.GetYaxis().SetTitle(yAxisTitle)
-    #hist.GetYaxis().SetTitleOffset(yAxisTitleOffset) # now handled by ATLAS style
-    if "D0bsVsPhi0" in hist.GetName() or "D0bsVsEta" in hist.GetName():
-        hist.GetYaxis().SetLabelOffset(0.015)
-        hist.GetYaxis().SetLabelSize(0.045)
-    if "mean_" in hist.GetName():
-        hist.Draw("histo")
-    else:
-        hist.Draw()
-        
-    # drawing function associated with first histogram
-    tf1 = inputTuple[0]
-    if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-    # canvas text (right hand side)
-    latexAtlas = TLatex()
-    latexAtlas.SetNDC()
-    #latexAtlas.SetTextFont(72)
-    latexAtlas.SetTextColor(1)
-    latexAtlas2 = TLatex()
-    latexAtlas2.SetNDC()
-
-    if(plotTitleOnFirstLine):
-        latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0] + "  " + plotTitle)
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,canvasText[1])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[2])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[3])    
-    else:
-        latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,plotTitle)
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[1])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[2])
-        latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.24,canvasText[3])  
-        #latexAtlas3 = TLatex()
-        #latexAtlas3.SetNDC()
-        #latexAtlas3.SetTextSize(0.08)
-        #latexAtlas3.DrawLatex(textBoxLeftX,textBoxUpperY-0.40,canvasText[3])    
-
-    # drawing legend associated with first histogram
-    legendTitle = inputTuple[2]
-    m_l = TLatex()
-    m_l.SetTextSize(legendTextSize)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-    m_l2 = TLatex()
-    m_l2.SetTextSize(legendTextSize)
-    m_l2.SetTextAlign(12)
-    m_l2.SetNDC()
-    legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[0],legendMarkerSize)
-    m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-    if meanWidthOnSeparateLine==True:
-        m_width = TLatex()
-        m_width.SetTextSize(legendTextSize)
-        m_width.SetTextAlign(12)
-        m_width.SetNDC()
-        m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-    marker = legendTuple[0]
-    marker.Draw("same")
-
-    #determining how far offset in Y the next legend entry should be
-    legendYOffset = 2*legendYLineSpacing
-    if meanWidthOnSeparateLine==True:
-        legendYOffset = 3*legendYLineSpacing
-
-    ## uncomment to display fraction of histogram within sigma range
-    #m_l3 = TLatex()
-    #m_l3.SetTextSize(legendTextSize)
-    #m_l3.SetTextAlign(12)
-    #m_l3.SetNDC()
-    #m_l3.SetTextColor(hist.GetMarkerColor())
-    #text = "Frac. = " + str(round(findFractionWithinSigmaRange(hist,sigmaIterativeGaus),3)*100) + "%" 
-    #m_l3.DrawLatex(legendLeftX,legendUpperY-0.35,text)    
-
-    ## uncomment to display fit properties
-    #print "fit for ",hist.GetName()," ",legendTitle,": chi2/DOF = ",tf1.GetChisquare(),"/",tf1.GetNDF()," = ",tf1.GetChisquare()/tf1.GetNDF()
-    #m_l3 = TLatex()
-    #m_l3.SetTextSize(legendTextSize)
-    #m_l3.SetTextAlign(12)
-    #m_l3.SetNDC()
-    #m_l3.SetTextColor(hist.GetMarkerColor())
-    #text = "#chi^{2}/DOF = " + str(round(tf1.GetChisquare()/tf1.GetNDF(),2)) 
-    #m_l3.DrawLatex(legendLeftX,legendUpperY-0.35,text)
-
-    ## uncomment to print fraction of data covered by 1-sigma of fit (assumes mean of fit = 0.0)
-    #maxFitRange = tf1.GetParameter(1) + (tf1.GetParameter(2)*sigmaIterativeGaus)
-    #minFitRange = tf1.GetParameter(1) - (tf1.GetParameter(2)*sigmaIterativeGaus)
-    #maxFitBin = hist.FindBin(maxFitRange)
-    #minFitBin = hist.FindBin(minFitRange)
-    #intGral = hist.Integral(minFitBin,maxFitBin)
-    #fullIntGral = hist.Integral(1,hist.GetNbinsX())
-    ##print "maxFitRange =  ",maxFitRange,", minFitRange = ", minFitRange
-    ##print "maxFitBin =  ",maxFitBin,", minFitBin = ", minFitBin
-    #print "histo ",hist.GetName()," fraction covered by fit = ",intGral/fullIntGral
-    #m_l4 = TLatex()
-    #m_l4.SetTextSize(legendTextSize)
-    #m_l4.SetTextAlign(12)
-    #m_l4.SetNDC()
-    #m_l4.SetTextColor(hist.GetMarkerColor())
-    #text = "Fit Frac. = " + str(round(intGral/fullIntGral,2)) 
-    #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.35,text)
-
-    ## uncomment to draw core and tail functions on 
-    #coreFunc = TF1("coreFunc","gaus",-0.5,0.5)
-    #coreFunc.SetParameter(0,tf1.GetParameter(0))
-    #coreFunc.SetParameter(1,tf1.GetParameter(1))
-    #coreFunc.SetParameter(2,tf1.GetParameter(2))
-    #coreFunc.SetLineColor(hist.GetMarkerColor())
-    #coreFunc.SetLineStyle(2)
-    #coreFunc.Draw("same")
-    #integralCore = coreFunc.Integral(-0.5,0.5)
-    #print "integralCore = ",integralCore
-    #tailFunc = TF1("tailFunc","gaus",-0.5,0.5)
-    #tailFunc.SetParameter(0,tf1.GetParameter(3))
-    #tailFunc.SetParameter(1,tf1.GetParameter(4))
-    #tailFunc.SetParameter(2,tf1.GetParameter(5))
-    #tailFunc.SetLineColor(hist.GetMarkerColor())
-    #tailFunc.SetLineStyle(2)
-    #tailFunc.Draw("same")
-    #integralTail = tailFunc.Integral(-0.5,0.5)
-    #fracCore = integralCore/(integralCore+integralTail)
-    #print "integralTail = ",integralTail
-    #print "fracCore = " ,fracCore
-    #m_l4 = TLatex()
-    #m_l4.SetTextSize(legendTextSize)
-    #m_l4.SetTextAlign(12)
-    #m_l4.SetNDC()
-    #m_l4.SetTextColor(hist.GetMarkerColor())
-    #text = "Core Frac. = " + str(round(fracCore,2)) 
-    #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.35,text)
-
-    # drawing second histogram and its legend
-    if (len(inputTuple)) > 3:
-        hist = inputTuple[3+1]
-        histoTitle = hist.GetName()
-        if histoTitle.find('pT')!=-1  and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-        #hist.Draw("same,e")
-        tf1 = inputTuple[3+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[3+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[1],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker2 = legendTuple[0]
-        marker2.Draw("same")
-
-        ## uncomment to display fraction of histogram within sigma range
-        #m_l3.SetTextColor(hist.GetMarkerColor())
-        #text = "Frac. = " + str(round(findFractionWithinSigmaRange(hist,sigmaIterativeGaus),3)*100) + "%" 
-        #m_l3.DrawLatex(legendLeftX,legendUpperY-0.4,text)    
-
-        ## uncomment to display fit properties
-        #print "fit for ",hist.GetName()," ",legendTitle,": chi2/DOF = ",tf1.GetChisquare(),"/",tf1.GetNDF()," = ",tf1.GetChisquare()/tf1.GetNDF()
-        #m_l3.SetTextColor(hist.GetMarkerColor())
-        #text = "#chi^{2}/DOF = " + str(round(tf1.GetChisquare()/tf1.GetNDF(),2)) 
-        #m_l3.DrawLatex(legendLeftX,legendUpperY-0.4,text)
-
-        ## uncomment to print fraction of data covered by 1-sigma of fit (assumes mean of fit = 0.0)
-        #maxFitRange = tf1.GetParameter(1) + (tf1.GetParameter(2)*sigmaIterativeGaus)
-        #minFitRange = tf1.GetParameter(1) - (tf1.GetParameter(2)*sigmaIterativeGaus)
-        #maxFitBin = hist.FindBin(maxFitRange)
-        #minFitBin = hist.FindBin(minFitRange)
-        #intGral = hist.Integral(minFitBin,maxFitBin)
-        #fullIntGral = hist.Integral(1,hist.GetNbinsX())
-        #print "histo ",hist.GetName()," fraction covered by fit = ",intGral/fullIntGral
-        #m_l4.SetTextColor(hist.GetMarkerColor())
-        #text = "Fit Frac. = " + str(round(intGral/fullIntGral,2)) 
-        #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.4,text)
-
-        ### uncomment to draw core and tail functions on 
-        #coreFunc2 = TF1("coreFunc","gaus",-0.5,0.5)
-        #coreFunc2.SetParameter(0,tf1.GetParameter(0))
-        #coreFunc2.SetParameter(1,tf1.GetParameter(1))
-        #coreFunc2.SetParameter(2,tf1.GetParameter(2))
-        #coreFunc2.SetLineColor(hist.GetMarkerColor())
-        #coreFunc2.SetLineStyle(2)
-        ##coreFunc2.Draw("same")
-        #integralCore2 = coreFunc2.Integral(-0.5,0.5)
-        #print "integralCore = ",integralCore
-        #tailFunc2 = TF1("tailFunc","gaus",-0.5,0.5)
-        #tailFunc2.SetParameter(0,tf1.GetParameter(3))
-        #tailFunc2.SetParameter(1,tf1.GetParameter(4))
-        #tailFunc2.SetParameter(2,tf1.GetParameter(5))
-        #tailFunc2.SetLineColor(hist.GetMarkerColor())
-        #tailFunc2.SetLineStyle(2)
-        ##tailFunc2.Draw("same")
-        #integralTail2 = tailFunc2.Integral(-0.5,0.5)
-        #fracCore2 = integralCore2/(integralCore2+integralTail2)
-        #print "integralTail = ",integralTail2
-        #print "fracCore = " , fracCore2
-        #m_l4.SetTextColor(hist.GetMarkerColor())
-        #text = "Core Frac. = " + str(round(fracCore2,2)) 
-        #m_l4.DrawLatex(legendLeftX+0.5,legendUpperY-0.4,text)
-
-
-
-    # drawing third histogram and its legend
-    if (len(inputTuple)) > 6:
-        hist = inputTuple[6+1]
-        histoTitle = hist.GetName()
-        if histoTitle.find('pT')!=-1  and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-        #hist.Draw("same,e")
-        tf1 = inputTuple[6+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[6+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[2],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker3 = legendTuple[0]
-        marker3.Draw("same")
-
-    # drawing fourth histogram and its legend
-    if (len(inputTuple)) > 9:
-        hist = inputTuple[9+1]
-        if histoTitle.find('pT')!=-1 and ZmumuVal:
-            hist.GetXaxis().SetRangeUser(pTmin,pTmax)
-        if "mean_" in hist.GetName():
-            hist.Draw("histosame")
-        else:
-            hist.Draw("same,e")
-            #hist.Draw("same,e")
-        tf1 = inputTuple[9+0]
-        if(tf1.GetName()!="noFitWithStats"): tf1.Draw("same")
-
-        legendUpperY = legendUpperY - legendYOffset
-        legendTitle = inputTuple[9+2]
-        m_l.DrawLatex(legendLeftX,legendUpperY,legendTitle)
-        legendTuple = defineLegendTextMarker(units, hist, tf1,legendLeftX,legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod[3],legendMarkerSize)
-        m_l2.DrawLatex(legendLeftX,legendUpperY-legendYLineSpacing,legendTuple[1])
-        if meanWidthOnSeparateLine==True:
-            m_width.DrawLatex(legendLeftX,legendUpperY-(2*legendYLineSpacing),legendTuple[2])
-        marker4 = legendTuple[0]
-        marker4.Draw("same")
-
-    
-    if makeOutput:
-        can.SaveAs(outputName)
-
-def MakePlots(histogramDir,legendTitles,markerColors,markerStyles,histogramName, fitType, rootFiles, nFiles, normaliseHistos, unitArea=False):
-    
-    #gets histograms from the files, normalises if desired and makes fits
-    #returns histograms and fits
-    maxval = 0.0
-    max_hist = 0
-    
-    histoGram = [TH1,TH1,TH1,TH1,TH1]
-    Tuples = [tuple,tuple,tuple,tuple,tuple]
-
-    #first have to get all the histograms because they may be used to normalise each other etc 
-    for i in range(nFiles):
-      
-
-        histoGram[i] = GetHistogram(rootFiles[i],histogramDir[i],histogramName,markerColors[i],markerStyles[i])
-        print histogramName
-    for i in range(nFiles):
-
-        #normalise histograms to unit area if desired
-        if histoGram[i].Integral() > 0:
-            if unitArea:
-                #print "for hist ",i, " scaling" 
-                histoGram[i].Scale(1/histoGram[i].Integral())
-                histoGram[i].GetYaxis().SetTitle("Arbitrary units")
-            #elif  i > 0 and normaliseHistos:
-            elif normaliseHistos:
-                histoGram[i].Scale(histoGram[normaliserHisto].Integral()/histoGram[i].Integral())
-
-        # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-        RemoveNegativeYAxis(histoGram[i],histogramName)
-
-        # find which histogram has largest y-value - this will be drawn first
-        if histoGram[i].GetMaximum() > maxval:
-            max_hist = i
-            maxval = histoGram[i].GetMaximum()
-
-        # perform the deired fit to the histogram
-        fit = MakeFit(histoGram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,histoGram[i],legendTitles[i])
-
-        
-
-    if nFiles==1:
-        totalTuple = Tuples[0]
-    if nFiles==2:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0]
-    if nFiles==3:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1]
-
-    if nFiles==4:
-        if max_hist==0 or forceDrawOrder:
-            totalTuple = Tuples[0] + Tuples[1] + Tuples[2] + Tuples[3]
-        elif max_hist==1:
-            totalTuple = Tuples[1] + Tuples[0] + Tuples[2] + Tuples[3]
-        elif max_hist==2:
-            totalTuple = Tuples[2] + Tuples[0] + Tuples[1] + Tuples[3]
-        elif max_hist==3:
-            totalTuple = Tuples[3] + Tuples[0] + Tuples[1] + Tuples[2]
-
-
-
-    return totalTuple #returning histograms and fits
-
-def MakeTwoPlotsFromSameFile(histogramDir,legendTitles,markerColors,markerStyles,histogramNames, fitType, rootFiles, fileToUse, normaliseHistos, unitArea=False):
-    
-    #gets 2 histograms from same file, normalises if desired and makes fits
-    #returns histograms and fits
-
-    maxval = 0.0
-    max_hist = 0
-
-    histoGram = [TH1,TH1]
-    Tuples = [tuple,tuple]
-
-    histoGram[0] = GetHistogram(rootFiles[fileToUse],histogramDir[fileToUse],histogramNames[0],markerColors[0],markerStyles[0])
-    histoGram[1] = GetHistogram(rootFiles[fileToUse],histogramDir[fileToUse],histogramNames[1],markerColors[1],markerStyles[1])
-
-    for i in range(2):
-
-        #normalise histograms to unit area if desired
-        if histoGram[i].Integral() > 0:
-            if unitArea:
-                histoGram[i].Scale(1/histoGram[i].Integral())
-                histoGram[i].GetYaxis().SetTitle("Arbitrary units")
-            elif  i > 0 and normaliseHistos:
-                histoGram[i].Scale(histoGram[0].Integral()/histoGram[i].Integral())
-        
-        # sometimes ROOT likes to draw a negative portion of y-axis when no negative entries
-        RemoveNegativeYAxis(histoGram[i],histogramNames[i])
-
-        if histoGram[i].GetMaximum() > maxval:
-            max_hist = i
-            maxval = histoGram[i].GetMaximum()
-
-        # perform the deired fit to the histogram
-        fit = MakeFit(histoGram[i],fitType,markerColors[i])
-
-        # make a tuple object that can be passed to draw method
-        Tuples[i] = returnTuple(fit,histoGram[i],legendTitles[i])
-
-
-    if max_hist==0:
-        totalTuple = Tuples[0] + Tuples[1]
-    if max_hist==1:
-        totalTuple = Tuples[1] + Tuples[0]
-
-    return totalTuple #returning histograms and fits
-
-
-def MakeSiEndcapResidualDistribution(histogramName,histogramDir,rootFile):
-
-    print "making Si endcap residuals"
-
-    if "eca" in histogramName:
-        h2d = rootFile.Get(histogramDir + "si_eca_resX")
-    elif "ecc" in histogramName:
-        h2d = rootFile.Get(histogramDir + "si_ecc_resX")
-    else:
-        print "EXITING because endcap not recognised in MakeSiEndcapResidualDistribution"
-        sys.exit()
-
-    if "pix" in histogramName:
-        if "residualx_disk1" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,1,1,"e")).Clone()
-        elif "residualx_disk2" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,2,2,"e")).Clone()
-        elif "residualx_disk3" in histogramName:
-            endcapHist = (h2d.ProjectionY(histogramName,3,3,"e")).Clone()
-        else:
-            print "EXITING because pixel disk not recognised in MakeSiEndcapResidualDistribution"
-            sys.exit()
-
-    if "sct" in histogramName:
-        if "residualx_disk1" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,4,4,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,5,5,"e")).Clone()
-        elif "residualx_disk2" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,6,6,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,7,7,"e")).Clone()
-        elif "residualx_disk3" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,8,8,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,9,9,"e")).Clone()
-        elif "residualx_disk4" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,10,10,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,11,11,"e")).Clone()
-        elif "residualx_disk5" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,12,12,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,13,13,"e")).Clone()
-        elif "residualx_disk6" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,14,14,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,15,15,"e")).Clone()
-        elif "residualx_disk7" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,16,16,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,17,17,"e")).Clone()
-        elif "residualx_disk8" in histogramName:
-            sctEndcapSide0 = (h2d.ProjectionY(histogramName,18,18,"e")).Clone()
-            sctEndcapSide1 = (h2d.ProjectionY(histogramName,19,19,"e")).Clone()
-        else:
-            print "EXITING because SCT disk not recognised in MakeSiEndcapResidualDistribution"
-            sys.exit()
-        endcapHist = sctEndcapSide0
-        endcapHist.Sumw2()
-        endcapHist.Add(sctEndcapSide1)
-
-
-    return endcapHist
-
-def FindCutBin(axis, cut, maxOrMin):
-
-
-  cutBin = -100
-
-  for i in range(axis.GetNbins()+1):
-    
-    edge = 0.0
-    if maxOrMin < 0:
-      edge = axis.GetBinLowEdge(i)
-    else:
-      edge = axis.GetBinUpEdge(i)
-      
-    if math.fabs(edge - cut) < 0.00001:
-      cutBin = i
-      break
-
-    if i==axis.GetNbins():
-      print "ERROR - cannot find cut bin!!!! Set to -100!!!"
-
-  return cutBin
-
-def MakeResidualMean1dHisto(histogramName,histogramDir,rootFile):
-
-    debug = False
-
-    xAxisLimit = 10.0
-    nBins1d = 100
-    meanOrError=0
-
-    if "mean1d" in histogramName:
-        if "pix" in histogramName and "yres" in histogramName:
-            xAxisLimit = 50.0
-            nBins1d = 500
-        h1d = TH1F(histogramName,histogramName,nBins1d,-xAxisLimit,xAxisLimit)
-        meanOrError=0
-    if "meanerror1d" in histogramName:
-        h1d = TH1F(histogramName,histogramName,300,0.,30.)
-        meanOrError=1
-    if "nentries1d" in histogramName:
-        h1d = TH1F(histogramName,histogramName,100,0.,100000.)
-        meanOrError=2
-    if debug:
-        print "histogramName = ",histogramName 
-
-    if "xres" in histogramName:
-        resStr = "xres"
-    if "yres" in histogramName:
-        resStr = "yres"
-
-    if "pix_b" in histogramName:
-        if "b0" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b0_" + resStr + "vsmodetaphi_3d")
-        elif "b1" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b1_" + resStr + "vsmodetaphi_3d")
-        elif "b2" in histogramName:
-                h3d = rootFile.Get(histogramDir + "pix_b2_" + resStr + "vsmodetaphi_3d")                                
-        else:
-            print "don't recognise histo name in MakeResidualMean1dHisto - EXITING"
-            sys.exit()
-
-    nBinsX = h3d.GetNbinsX()
-    nBinsY = h3d.GetNbinsY()
-
-    nModules = 0
-
-    for i in range(nBinsX):
-
-        for j in range(nBinsY):
-
-            hProj = h3d.ProjectionZ("proj",i,i,j,j,"e")
-
-            if hProj.GetEntries() <= 0:
-                if debug:
-                    print "Module has zero entries - probably a dead module"
-                continue
-            
-            if(meanOrError==0):
-                h1d.Fill((hProj.GetMean())*1000.)#fill with mean in microns
-                if abs(hProj.GetMean()*1000.) > xAxisLimit:
-                    print "WARNING: in MakeResidualMean1dHisto have a module with residual mean > ",xAxisLimit," microns"
-            elif(meanOrError==1):
-                h1d.Fill(hProj.GetMeanError()*1000.)
-            else:
-                h1d.Fill(hProj.GetEntries())
-            nModules = nModules + 1
-
-    if debug:
-        print "nModules =",nModules 
-
-    return h1d
-        
-def MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,meanOrFWHM=0):
-
-    # this method will usually fill a 1-d histogram with the mean or FWHM of residual/pull distributions as a function of track pT
-    # however, if the histogramName ends with string "bin-X", where X is an integer, it will return the actual residual/pull
-    # distribution in the bin X
-
-    # binning used for the x-axis (pT)
-    #nBins = 20
-    #newBins = array('d',[-20.0,-15.0,-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0,15.0,20.0])
-
-    nBins = 22
-    newBins = array('d',[-30.0,-20.0,-15.0,-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0,15.0,20.0,30.0])
-
-    debug = False
-    makeDistribution = False #gets set to true if histogramName contains "bin-X"
-
-    if "residual" in histogramName:
-        if "pix_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_b_residualx_pt")
-        elif "pix_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_eca_residualx_pt")
-        elif "pix_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_ecc_residualx_pt")
-        elif "sct_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_b_residualx_pt")
-        elif "sct_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_eca_residualx_pt")
-        elif "sct_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_ecc_residualx_pt")
-        elif "trt_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_b_residualR_pt_")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        elif "trt_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_ec_residualR_pt_Endcap_A")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        elif "trt_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "trt_ec_residualR_pt_Endcap_C")
-            nBins = 14
-            newBins = array('d',[-30.0,-20.0,-10.0,-8.0,-4.0,-2.0,-1.0,0.0,1.0,2.0,4.0,8.0,10.0,20.0,30.0])    
-        else:
-            print "don't recognise histo name in MakeResidualVsPtHisto - EXITING"
-            sys.exit()
-    elif "pullx" in histogramName:
-        if "pix_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_b_pullx_pt")
-        elif "pix_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_eca_pullx_pt")
-        elif "pix_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "pix_ecc_pullx_pt")
-        elif "sct_b_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_b_pullx_pt")
-        elif "sct_eca_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_eca_pullx_pt")
-        elif "sct_ecc_" in histogramName:
-            h2d = rootFile.Get(histogramDir + "sct_ecc_pullx_pt")
-        else:
-            print "don't recognise histo name in MakeResidualVsPtHisto - EXITING"
-            sys.exit()
-
-    
-    
-    newHist = TH1F("newHist","newHist",nBins,newBins)
-
-    #check to see if histogramName contains "bin-X"
-    #if so we just return the projection for that bin
-    binNum = 0
-    if "bin-" in histogramName:
-        makeDistribution = True
-        binNumStr = (histogramName.split('-'))[1]
-        binNum = int(binNumStr)
-        print "binNumStr = ", binNumStr, ", binNum = ",binNum
-    if makeDistribution:
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[binNum-1],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[binNum],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        #projHist.Rebin(2)
-        return projHist
-
-    #otherwise fill 1-d histo with mean/width vs pT
-    for i in range(nBins):
-
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[i],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[i+1],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        #projHist.Rebin(2)
-        mean = projHist.GetMean()
-        rms = projHist.GetRMS()
-        entries = projHist.GetEntries()
-        meanErr = 1000.0
-        if entries > 0:
-            sqrtEntries = math.sqrt(entries);
-            meanErr = rms/sqrtEntries
-            fwhmArray = findMeanRMSUsingFWHM(projHist)
-            fWHM = fwhmArray[1]
-            #gausFit = singleGaus(projHist)
-            gausFit = singleGausIterative(projHist,sigmaIterativeGaus)
-            gausSigma = gausFit.GetParameter(2)
-            gausSigmaErr = gausFit.GetParError(2)
-
-        if debug: print "lowRange = ", newBins[i],", lowBin = ",lowBin,", highRange = ",newBins[i+1],", highBin = ",highBin,", content = ",projHist.GetEntries(),", mean = ",mean
-
-        if entries > 0 and newBins[i] < -2.0 or newBins[i] >= 2.0:#we don't show bins below 2 GeV (can have handful of entries)
-            if meanOrFWHM==0:
-                newHist.SetBinContent(i+1,mean)
-                newHist.SetBinError(i+1,meanErr)
-            elif meanOrFWHM==1:
-                if entries > 1000:
-                    newHist.SetBinContent(i+1,fWHM)
-                    newHist.SetBinError(i+1,0.000000001)
-            else:
-                if entries > 1000:
-                    newHist.SetBinContent(i+1,gausSigma)
-                    newHist.SetBinError(i+1,gausSigmaErr)
-
-    return newHist
-        
-def MakeErrVsPtHisto(histogramName,histogramDir,rootFile):
-
-    #print "making residual vs pt"
-
-    
-    h2d = rootFile.Get(histogramDir + histogramName)
-
-    nBins = 20
-    newBins = array('d',[0.0,0.8*2.0,0.8*4.0,0.8*6.0,0.8*8.0,0.8*10.0,0.8*12.0,0.8*14.0,0.8*16.0,0.8*18.0,0.8*20.0,0.8*22.0,0.8*24.0,0.8*26.0,
-                         0.8*28.0,0.8*30.0,0.8*32.0,0.8*36.0,0.8*40.0,0.8*44.0,0.8*50.0])
-    
-    newHist = TH1F("newHist","newHist",nBins,newBins)
-    
-    
-    for i in range(nBins):
-
-        lowBin = FindCutBin(h2d.GetXaxis(),newBins[i],-1)
-        highBin = FindCutBin(h2d.GetXaxis(),newBins[i+1],1)
-        projHist = (h2d.ProjectionY(histogramName,lowBin,highBin,"e")).Clone()
-        mean = projHist.GetMean()
-        rms = projHist.GetRMS()
-        entries = projHist.GetEntries()
-        meanErr = 1000.0
-        if entries > 0:
-            sqrtEntries = math.sqrt(entries);
-            meanErr = rms/sqrtEntries
-            #fwhmArray = findMeanRMSUsingFWHM(projHist)
-            #fWHM = fwhmArray[1]
-
-        #print "lowRange = ", newBins[i],", lowBin = ",lowBin,", highRange = ",newBins[i+1],", highBin = ",highBin,", content = ",projHist.GetEntries(),", mean = ",mean
-
-        if entries > 0:
-            newHist.SetBinContent(i+1,mean)
-            newHist.SetBinError(i+1,meanErr)
-
-    return newHist
-
-def GetHistogram(rootFile,histogramDir,histogramName,markerColor,markerStyle):
-
-
-    if histogramName=="pix_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualx_fine":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualx_fine")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualx_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualy_fine":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualy_fine")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualy_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_residualy":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_residualy")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_residualy")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_ec_residualx_fine":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_residualx_fine")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_residualx_fine")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_residualR":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_residualR_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_residualR_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Rebin()
-        histoGram.Add(histoGramECC)
-
-    elif histogramName=="pix_b_pullx":
-        histoGramB0 = rootFile.Get(histogramDir + "pix_b0_pullx")
-        histoGramB1 = rootFile.Get(histogramDir + "pix_b1_pullx")
-        histoGramB2 = rootFile.Get(histogramDir + "pix_b2_pullx")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_b_pully":
-        histoGramB0 = rootFile.Get(histogramDir + "pix_b0_pully")
-        histoGramB1 = rootFile.Get(histogramDir + "pix_b1_pully")
-        histoGramB2 = rootFile.Get(histogramDir + "pix_b2_pully")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_ec_pullx":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_pullx")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_pullx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pix_ec_pully":
-        histoGramECA = rootFile.Get(histogramDir + "pix_eca_pully")
-        histoGramECC = rootFile.Get(histogramDir + "pix_ecc_pully")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="sct_b_pullx":
-        histoGramB0 = rootFile.Get(histogramDir + "sct_b0_pullx")
-        histoGramB1 = rootFile.Get(histogramDir + "sct_b1_pullx")
-        histoGramB2 = rootFile.Get(histogramDir + "sct_b2_pullx")
-        histoGramB3 = rootFile.Get(histogramDir + "sct_b3_pullx")
-        histoGram = histoGramB0.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-        histoGram.Add(histoGramB3)
-    elif histogramName=="sct_ec_pullx":
-        histoGramECA = rootFile.Get(histogramDir + "sct_eca_pullx")
-        histoGramECC = rootFile.Get(histogramDir + "sct_ecc_pullx")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_pullR":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_pullR_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_pullR_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="trt_ec_pullR_notube":
-        histoGramECA = rootFile.Get(histogramDir + "trt_ec_pullR_notube_Endcap_A")
-        histoGramECC = rootFile.Get(histogramDir + "trt_ec_pullR_notube_Endcap_C")
-        histoGram = histoGramECA.Clone()
-        histoGram.Sumw2()
-        histoGram.Add(histoGramECC)
-    elif histogramName=="pT_nolog":
-        histoGram = rootFile.Get(histogramDir + "pT")
-        histoGram.SetName("pT_nolog")
-    elif "D0bsVs" in histogramName:
-        histoGram =  ((rootFile.Get(histogramDir + histogramName)).ProfileX()).Clone()
-    elif "residualx_disk" in histogramName:
-        histoGram = MakeSiEndcapResidualDistribution(histogramName,histogramDir,rootFile)
-    elif "residualx_pt_mean" in histogramName or "residual_pt_mean" in histogramName  or "pullx_pt_mean" in histogramName or "residualx_pt_bin" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile)
-    elif "residualx_pt_fwhm" in histogramName or "residual_pt_fwhm" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,1)
-    elif "pullx_pt_width" in histogramName or "residual_pt_width" in histogramName:
-        histoGram = MakeResidualVsPtHisto(histogramName,histogramDir,rootFile,2)
-    elif histogramName=="pix_b_xres_mean1d" or  histogramName=="pix_b_xres_meanerror1d" or  histogramName=="pix_b_xres_nentries1d":
-        confStr = "mean1d"
-        if "meanerror1d" in histogramName:
-            confStr = "meanerror1d"
-        if "nentries1d" in histogramName:
-            confStr = "nentries1d"            
-        histoGramB0 = MakeResidualMean1dHisto("pix_b0_xres_"+confStr,histogramDir,rootFile)
-        histoGramB1 = MakeResidualMean1dHisto("pix_b1_xres_"+confStr,histogramDir,rootFile)
-        histoGramB2 = MakeResidualMean1dHisto("pix_b2_xres_"+confStr,histogramDir,rootFile)
-        histoGram = histoGramB0.Clone()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif histogramName=="pix_b_yres_mean1d":
-        histoGramB0 = MakeResidualMean1dHisto("pix_b0_yres_mean1d",histogramDir,rootFile)
-        histoGramB1 = MakeResidualMean1dHisto("pix_b1_yres_mean1d",histogramDir,rootFile)
-        histoGramB2 = MakeResidualMean1dHisto("pix_b2_yres_mean1d",histogramDir,rootFile)
-        histoGram = histoGramB0.Clone()
-        histoGram.Add(histoGramB1)
-        histoGram.Add(histoGramB2)
-    elif "err" in histogramName and "VsPt" in histogramName:
-        histoGram = MakeErrVsPtHisto(histogramName,histogramDir,rootFile)
-    else:
-        histoGram = rootFile.Get(histogramDir + histogramName)
-
-
-    if not histoGram : #is None:#checking histograms exist
-        print "EXITING because failed to find histogram ",histogramDir + histogramName
-        sys.exit()
-         
-    if histoGram.Integral()==0:#checking for empty histos
-        print "WARNING zero entries in histogram ",histogramDir + histogramName
-    
-
- #    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-#     if histogramName=="trt_b_pullR" or histogramName=="trt_ec_pullR_Endcap_A" or histogramName=="trt_ec_pullR_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-#     if histogramName=="trt_b_pullR_notube" or histogramName=="trt_ec_pullR_notube_Endcap_A" or histogramName=="trt_ec_pullR_notube_Endcap_C":
-#         histoGram.Sumw2()#so have errors for TRT histograms - all others already have errors defined
-
-
-    histoGram.Sumw2()#so have errors
-    histoGram.SetMarkerColor(markerColor)
-    histoGram.SetMarkerStyle(markerStyle)
-    histoGram.SetLineColor(markerColor)
-
-
-    # rebinning histograms used for the approved plots
-#     if histogramName=="pix_b_residualy":
-#         histoGram.Rebin(2)
-#     if histogramName=="pix_b_residualx_fine" or histogramName=="pix_ec_residualx_fine" or histogramName=="pix_eca_residualx_fine" or histogramName=="pix_ecc_residualx_fine":
-#         histoGram.Rebin(2)
-#         histoGram.SetAxisRange(-.25,.25)
-#     if histogramName=="pix_b_residualy_fine":
-#         histoGram.Rebin(4)
-#         histoGram.SetAxisRange(-.75,.75)
-#     if histogramName=="pix_eca_residualy_fine" or histogramName=="pix_ecc_residualy_fine" or histogramName=="pix_ec_residualy_fine":
-#         histoGram.Rebin(16)
-#         histoGram.SetAxisRange(-.75,.75)
-#     if histogramName=="sct_b_residualx_fine" or histogramName=="sct_ec_residualx_fine" or histogramName=="sct_eca_residualx_fine" or histogramName=="sct_ecc_residualx_fine":
-#         histoGram.Rebin(2)
-#         histoGram.SetAxisRange(-.25,.25)
-#     if histogramName=="pix_b_residualx" or histogramName=="pix_ec_residualx" or histogramName=="sct_b_residualx" or histogramName=="sct_ec_residualx":
-#         histoGram.SetAxisRange(-.5,.5)
-
-  
- 
-    # uncomment to rebin histograms
-    #histoGram.Rebin(16);
-#    if histogramName=="pix_b_residualy" :
-#        histoGram.Rebin(2);
-    if histogramName=="trt_b_residualR":
-        histoGram.Rebin(2);
-        
-    if histogramName=="sct_b_residualx_fine":
-        histoGram.Rebin()
-        
-    if histogramName=="pix_b_residualy_fine" or \
-           histogramName=="sct_b_residualx_fine" or \
-           histogramName=="pix_b_residualx":
-        histoGram.SetAxisRange(-0.15,0.15)
-
-    if histogramName=="pix_b_residualx_fine" or \
-           histogramName=="pix_ec_residualx_fine":
-        histoGram.SetAxisRange(-.1,.1) 
-
-    if histogramName=="pix_b0_residualx" or histogramName=="pix_b1_residualx" or histogramName=="pix_b2_residualx" or histogramName=="pix_ec_residualx" or histogramName=="pix_eca_residualx" or histogramName=="pix_ecc_residualx" :#or histogramName=="pix_b_residualy":
-        histoGram.SetAxisRange(-.25,.25) #pri res
-    if histogramName=="sct_b_residualx" or histogramName=="sct_b0_residualx" or histogramName=="sct_b1_residualx" or histogramName=="sct_b2_residualx" or histogramName=="sct_b3_residualx" or histogramName=="sct_ec_residualx" or histogramName=="sct_eca_residualx" or histogramName=="sct_ecc_residualx":
-        histoGram.SetAxisRange(-.25,.25) #pri res
-
-    if histogramName=="sct_ec_residualx_fine":
-        histoGram.Rebin()
-        histoGram.SetAxisRange(-.2,.2)
-
-
-    #changing the x or y axis range of certain histograms from their defaults
-
-    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C" or histogramName=="trt_ec_residualR" :
-        histoGram.SetAxisRange(-0.5,0.5)
-    if "asym" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-0.3,0.3)
-        # priscilla
-
-#    print " priscilla roofile ", rootFile.GetName()
-
-    if "pT" in histogramName:
-        if "j0" in rootFile.GetName():
-            histoGram.SetAxisRange(15.0,25.0)
-        elif "j1" in rootFile.GetName():
-            histoGram.SetAxisRange(15.0,25.0)
-        else:
-            histoGram.SetAxisRange(15.0,60.0)
-
-    if histogramName=="delta_z0":
-        histoGram.SetAxisRange(-1.,1.)
-
-    if histogramName=="si_barrel_resX_mean" or histogramName=="si_eca_resX_mean" or histogramName=="si_ecc_resX_mean":
-        #Patch for the mean
-        histoGram.Scale(1000)
-        histoGram.GetYaxis().SetRangeUser(-5,5)
-    if histogramName=="pix_b_xresvsmodphi" or  histogramName=="pix_ecc_xresvsmodphi" or histogramName=="pix_eca_xresvsmodphi":
-        #or histogramName=="si_ecc_resX_mean" or histogramName=="si_eca_resX_mean" or histogramName=="si_barrel_resX_mean": Peo 
-        histoGram.GetYaxis().SetRangeUser(-.01,.01) #pri
-    if histogramName=="pix_b_yresvsmodphi" or histogramName=="pix_eca_yresvsmodphi" or histogramName=="pix_ecc_yresvsmodphi":
-        histoGram.GetYaxis().SetRangeUser(-.05,.05) #pri
-    if histogramName=="sct_b_xresvsmodeta" or histogramName=="pix_b_xresvsmodeta": 
-        histoGram.GetYaxis().SetRangeUser(-.005,.005) #pri
-    if histogramName=="sct_b_xresvsmodphi" or histogramName=="sct_eca_xresvsmodphi" or histogramName=="sct_ecc_xresvsmodphi":   
-        histoGram.GetYaxis().SetRangeUser(-.01,.01) #pri
-
-    if histogramName=="sct_b_Oxresxvsmodeta_mean" or histogramName=="pix_b_Oxresxvsmodeta_mean" or histogramName=="pix_b_Oyresyvsmodphi_mean":
-        histoGram.GetYaxis().SetRangeUser(-.05,.05)
-    if histogramName=="pix_b_xresvsmodeta_width" or histogramName=="pix_b_xresvsmodphi_width" or histogramName=="sct_b_xresvsmodeta_width" or histogramName=="sct_b_xresvsmodphi_width" or histogramName=="si_barrel_resX_rms" or histogramName=="si_eca_resX_rms" or histogramName=="si_ecc_resX_rms":
-
-        histoGram.GetYaxis().SetRangeUser(0.00,0.07)
-    if histogramName=="si_barrel_pullX_mean" or histogramName=="si_eca_pullX_mean" or histogramName=="si_ecc_pullX_mean":
-        histoGram.GetYaxis().SetRangeUser(-.4,.4)
-
-    if histogramName=="measurements_eff_vs_layer_ecc" or histogramName=="measurements_eff_vs_layer_eca" or histogramName=="measurements_eff_vs_layer_barrel":
-        histoGram.GetYaxis().SetRangeUser(0.9,1.05)
-    if  histogramName=="hits_eff_vs_phiSector_trt_b0"  or histogramName=="hits_eff_vs_phiSector_trt_b1" or histogramName=="hits_eff_vs_phiSector_trt_b2":
-        histoGram.GetYaxis().SetRangeUser(0.7,1.02)
-
-    if histogramName=="eff_trthits_eta0" or histogramName=="eff_trthits_phi0":
-        histoGram.GetYaxis().SetRangeUser(0.6,1.05)
-    if histogramName=="trt_b_rmsRes_l0" or histogramName=="trt_b_rmsRes_l1" or histogramName=="trt_b_rmsRes_l2" or histogramName=="trt_b_rmsResOverPhiVsStrawLayer": 
-        histoGram.GetYaxis().SetRangeUser(.16,.29)
-    if "trt_ec_rms" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(.16,.29)
-        
-    if histogramName=="trt_b_aveResOverPhiVsStrawLayer" or histogramName=="trt_b_aveRes_l0" or histogramName=="trt_b_aveRes_l1" or histogramName=="trt_b_aveRes_l2":
-        histoGram.Scale(1000.)
-        histoGram.GetYaxis().SetRangeUser(-5,5)
-        
-    if histogramName=="trt_ec_aveResVsPhiSec_Endcap_C" or histogramName=="trt_ec_aveResVsPhiSec_Endcap_A" or histogramName=="trt_ec_aveResVsRing_Endcap_C" or histogramName=="trt_ec_aveResVsRing_Endcap_A":
-        histoGram.Scale(1000.)
-        histoGram.GetYaxis().SetRangeUser(-5,5)
-    if histogramName=="ntracks":
-        histoGram.SetAxisRange(0.,10.)
- #   if histogramName=="pT" or histogramName=="pT_nolog":
- #       histoGram.SetAxisRange(-50.0,50.0)
-    if histogramName=="d0":
-        histoGram.SetAxisRange(-25.0,25.0)
-    if histogramName=="d0_bscorr" or histogramName=="d0_pvcorr":
-        histoGram.SetAxisRange(-1.0,1.0)
-    if histogramName=="z0_pvcorr":
-        histoGram.SetAxisRange(-1.0,1.0)
-
-    if histogramName=="delta_eta0":
-        histoGram.SetAxisRange(-0.02,0.02)
-    if histogramName=="delta_d0" or histogramName=="delta_phi0" or histogramName=="delta_eta0" or histogramName=="delta_z0" or histogramName=="delta_qOverPt":
-        histoGram.Sumw2()
-    if histogramName=="delta_d0" or histogramName=="delta_phi0" or histogramName=="delta_qOverPt":
-        histoGram.Rebin(4)
-    if "hits_eff" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(0.6,1.0)
-
-    #if "err" in histogramName and "VsPt" in histogramName:
-    #    newBins = array('d',[0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,12.0,14.0,16.0,18.0,20.0,25.0,30.0,35.0,40.0])
-    #    histoGram = histoGram.Rebin(19,"new",newBins)
-    #    if "D0" in histogramName:
-    #        histoGram.GetYaxis().SetRangeUser(0.0,0.15)
-
-
-    if "D0bsVs" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-0.04,0.04)
-        if "VsPt" in histogramName:
-            #newBins = array('d',[-10.0,-8.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0,6.0,8.0,10.0])
-            #histoGram = histoGram.Rebin(16,"new",newBins)
-            histoGram.SetAxisRange(-10.,10.)
-        if "VsEta" in histogramName:
-            histoGram.SetAxisRange(-2.6,2.6)
-    if "residualx_pt" in histogramName:#silicon histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.005,0.005)
-        if "fwhm" in histogramName:
-            if "sct" in histogramName:
-                histoGram.GetYaxis().SetRangeUser(0.02,0.05)
-            if "pix" in histogramName:
-                histoGram.GetYaxis().SetRangeUser(0.005,0.035)
-    if "residual_pt" in histogramName:#trt histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.005,0.005)
-        if "fwhm" in histogramName or "width" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(0.100,0.150)
-    if "pullx_pt" in histogramName:#silicon histograms
-        if "mean" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(-0.03,0.03)
-        if "width" in histogramName:
-            histoGram.GetYaxis().SetRangeUser(0.90,1.05)
-
-
-            #if "aveResVsPhiSec" in histogramName or "aveResVsRing" in histogramName: 
-            #histoGram.GetYaxis().SetRangeUser(-0.005,0.005)       
-
-    if "average_delta_d0" in histogramName or "average_delta_z0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.1,.1)
-    if "average_delta_phi0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.002,.002)  
-
-    if "average_delta_qOverPt" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.0015,.0015)  
-    if "average_delta_eta0" in histogramName:
-        histoGram.GetYaxis().SetRangeUser(-.02,.02)  
-
-    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.5*max_bin_val))
-
-    #print "bin size for ",histogramName," = " , histoGram.GetBinWidth(50)        
-
-    return histoGram
-    
-def RemoveNegativeYAxis(histoGram,histogramName):
-
-    ## This is to ensure that the y-axis doesn't go negative for e.g. residuals plots
-    ## (sometimes ROOT likes to do this)
-    if histogramName=="pix_b_residualx" or histogramName=="pix_eca_residualx" or histogramName=="pix_ecc_residualx" or histogramName=="sct_b_residualx" or histogramName=="sct_eca_residualx" or histogramName=="sct_ecc_residualx" or histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR_Endcap_A" or histogramName=="trt_ec_residualR_Endcap_C" or histogramName=="pix_b0_residualx" or histogramName=="pix_b1_residualx" or histogramName=="pix_b2_residualx" or histogramName=="sct_b0_residualx" or histogramName=="sct_b1_residualx" or histogramName=="sct_b2_residualx" or histogramName=="sct_b3_residualx" or histogramName=="delta_qOverPt" or histogramName=="delta_d0" or histogramName=="delta_z0" or histogramName=="delta_phi0" or histogramName=="delta_eta0" or histogramName=="chi2oDoF" or histogramName=="pix_b_residualx_fine" or histogramName=="sct_b_residualx_fine":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.1*max_bin_val))
-
-    if histogramName=="trt_b_residualR" or histogramName=="trt_ec_residualR":
-        max_bin =  histoGram.GetMaximumBin()
-        max_bin_val = (histoGram.GetBinContent(max_bin)) + histoGram.GetBinError(max_bin)
-        histoGram.GetYaxis().SetRangeUser(0.0,max_bin_val + (0.5*max_bin_val))
-
-def MakeFit(histoGram,fitType,markerColor):
-    
-    if fitType=="noFit": #do not perform a fit
-        fit = noFit(histoGram)
-
-    elif fitType=="noFitWithStats": #do not perform a fit
-        fit = noFitWithStats(histoGram)
-
-    elif fitType=="doubleGaus": #double Gaussian fit
-        fit = doubleGaus(histoGram)
-
-    elif fitType=="freeDoubleGaus": #this fit is unstable, not recommended
-        fit = freeDoubleGaus(histoGram,[500.,0.,0.05,1000.,0.,0.1])
-
-    elif fitType=="singleGaus": #single Gaussian fit
-        fit = singleGaus(histoGram)
-
-    elif fitType=="singleGausRestricted": #single Gaussian fit
-        fit = singleGausRestricted(histoGram)
-
-    elif fitType=="singleGausIterative": #single Gaussian fit iterated
-        fit = singleGausIterative(histoGram,sigmaIterativeGaus)
-
-    else:
-        print "EXITING: fitType - ",fitType," does not exist" 
-        sys.exit()
-
-    fit.SetLineColor(markerColor)
-
-    return fit
-
-
-
-
-def defineLegendTextMarker(units, histoGram, funcTion, legendLeftX, legendUpperY,showMean,meanWidthOnSeparateLine,legendMarkerYPosMod,legendMarkerSize):
-
-
-    text = ""
-    text2 = ""
-
-    if(funcTion.GetName()!=""):
-        if(funcTion.GetName()!="noFitWithStats"):
-
-            newMean = funcTion.GetParameter(1)
-            newRMS = funcTion.GetParameter(2)
-
-        else: 
-
-            if statsMethod==0:
-                ## Just using straight Mean/RMS for full bin range
-                newMean = histoGram.GetMean()
-                newRMS = histoGram.GetRMS()
-
-            elif statsMethod==1:
-                ### using integral method to determine 95% range for mean/rms calculation
-                meanRMSTuple = findMeanRMSFromTruncatedDistribution(histoGram)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-
-            elif statsMethod==2:
-                ### using a range defined by RMS of histogram
-                meanRMSTuple = findMeanRMSUsingRange(histoGram,sigmaIterativeGaus)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-
-            elif statsMethod==3:
-                ### using FWHM corrected to Gaussian sigma
-                meanRMSTuple = findMeanRMSUsingFWHM(histoGram)
-                newMean = meanRMSTuple[0]
-                newRMS = meanRMSTuple[1]
-                print "mean = ",newMean
-                print "FWHM/2.35 = ",newRMS
-
-            else:
-                print "no valid statsMethod set!!!!"
-            
-        #adding the mean to the legend text object
-        if showMean:
-            text = "#mu="
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text += str(round(1000*newMean,2))
-            elif "pull" in histoGram.GetName():
-                text += str(round(newMean,2))
-            elif "mean_" in histoGram.GetName():
-                text += str(round(newMean,2))
-            else:
-            #text += str(int(1000*newMean))
-                text += str(int(round(newMean,3)*1000))
-            text += " "+units
-            
-                
-
-
-        #adding the "width" to the legend text object
-        #unless have requested they are on a separate line
-        if meanWidthOnSeparateLine==False:
-            if showMean:
-                #if "mean_" in histoGram.GetName(): 
-                 #   text += "\\n"
-                #else:
-                text += ", "
-
-            if funcTion.GetName()!="noFitWithStats" : 
-                #text += ", #sigma="
-                text += "#sigma="
-            else:
-                if statsMethod==0 or statsMethod==2:
-                    text += "RMS="
-                if statsMethod==1:
-                    text += "RMS_{95%}="
-                if statsMethod==3:                
-                    text += "FWHM/2.35="
-
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text += str(round(1000*newRMS,2))
-            elif "pull" in histoGram.GetName():
-                text += str(round(newRMS,2))
-            elif "mean_" in histoGram.GetName():
-                text += str(round(newRMS,2))
-            else:
-                text += str(int(round(round(newRMS,4)*1000,0))) #will produce correctly rounded to 1 micron accuracy
-                #text += str(round(newRMS,4)*1000) # to see 0.1 micron accuracy in width
-#                if (int(newRMS*1000/10) > 1):
-#                    text += str(int(round(newRMS*1000, 1)))
-#                else: ####b priscilla!!!!!!!!!!!!
-#                    text += str(round(newRMS*1000, 1))
-            text += " "+units
-        
-        else: #have requested mean width on separate line, so fill separate text object
-            if funcTion.GetName()!="noFitWithStats" : 
-                text2 += "#sigma="
-            else:
-                if statsMethod==0 or statsMethod==2:
-                    text2 += "RMS="
-                if statsMethod==1:
-                    text2 += "RMS_{95%}="
-                if statsMethod==3:                
-                    text2 += "FWHM/2.35="
-            if histoGram.GetName()=="delta_phi0" or histoGram.GetName()=="delta_qOverPt" or histoGram.GetName()=="delta_eta0":
-                text2 += str(round(1000*newRMS,2))
-            elif "pull" in histoGram.GetName():
-                text2 += str(round(newRMS,2))
-            elif "mean_" in histoGram.GetName():
-                text2 += str(round(newRMS,2))
-            else:
-                text2 += str(int(round(newRMS,3)*1000))
-            text2 += " "+units
-                
-    tsize=0.06
-    marker = TMarker(legendLeftX-(0.4*tsize),legendUpperY+legendMarkerYPosMod,8)
-    marker.SetNDC()
-    marker.SetMarkerStyle(histoGram.GetMarkerStyle())
-    marker.SetMarkerSize(legendMarkerSize)
-    marker.SetMarkerColor(histoGram.GetMarkerColor())
-
-    return marker, text, text2
-
-def findMeanRMSFromTruncatedDistribution(histoGram):
-    # this finds the statistical mean/rms using a truncated distribution such that contains 95% of the entries of the 
-    # full range (including overflow/underflow)
-    # i.e. the mean and RMS defined using bins which contain 95% of entries (symmetrically) around the mean bin
-    # NOTE - if there is significant underflow/overflow this will not be reliable (see explicit check below)
-
-    cloneHist = histoGram.Clone()
-
-    hmean = cloneHist.GetMean()
-    print "*************************************************************************"
-    print "mean = ",hmean, ", RMS = ",cloneHist.GetRMS(), ", nBins = ",cloneHist.GetNbinsX()
-    hFullIntegral = cloneHist.Integral(0,cloneHist.GetNbinsX()+1)
-    print "full integral = ",hFullIntegral,", nentries = ",cloneHist.GetEntries()
-
-    print "underflow = ",cloneHist.GetBinContent(0), ", overflow = ",cloneHist.GetBinContent(cloneHist.GetNbinsX()+1)
-    totalOverflow = cloneHist.GetBinContent(0) + cloneHist.GetBinContent(cloneHist.GetNbinsX()+1)
-
-    hTargetIntegral = 0.95*hFullIntegral
-    print "target integral = ",hTargetIntegral
-    hMeanBin = cloneHist.FindBin(hmean)
-    print "meanbin = ",hMeanBin
-
-    # this prescription to calculate 95% RMS from a histogram is only valid if the overflow/underflow is 
-    # sufficiently small. If overflow/underflow is too large, then the targetIntegral may lie within the underflow/overflow
-    # and thus we cannot reliably compute the spread
-    if hFullIntegral - hTargetIntegral < totalOverflow:
-        print "WARNING - potentially 95% range will go into overflow bins and not be valid. 95% RMS set to zero!!!"
-        #return 0.0,0.0
-        
-
-    lowBin = hMeanBin
-    highBin = hMeanBin
-    hIntegral = 0.0
-    while hIntegral < hTargetIntegral:
-        # find the bin which contains the mean
-        # then integrate symmetrically around this bin, increasing the range 
-        # until the integral is larger than the target
-        # this defines your upper and lower bounds for mean/rms.
-        lowBin = lowBin - 1
-        highBin = highBin + 1
-        hIntegral = cloneHist.Integral(lowBin,highBin)
-        #print "integral between bins ",lowBin,"-",highBin," = ",hIntegral
-
-    print "For Histogram " , cloneHist.GetName(), "Mean/RMS bin range is",lowBin,"-",highBin, ", axis range ",cloneHist.GetBinLowEdge(lowBin)," - ", cloneHist.GetBinLowEdge(highBin) + cloneHist.GetBinWidth(highBin)
-
-    cloneHist.GetXaxis().SetRange(lowBin,highBin)
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = cloneHist.GetRMS()
-    print "mean after constrained axis = ",hNewMean
-    print "RMS after constrained axis = ",hNewRMS
-    
-    return hNewMean, hNewRMS
-        
-
-def findMeanRMSUsingRange(histoGram, sigmaRange):
-
-    cloneHist = histoGram.Clone()
-
-    hMean = cloneHist.GetMean()
-    hRMS = cloneHist.GetRMS()
-    print "original mean = ", hMean," RMS = ",hRMS
-
-    lowBin = cloneHist.FindBin(hMean - hRMS*sigmaRange)
-    highBin = cloneHist.FindBin(hMean + hRMS*sigmaRange)
-
-    #print "lowBin = ",lowBin,", highBin = ",highBin, ", nBins = ", cloneHist.GetNbinsX()
-    
-    cloneHist.GetXaxis().SetRange(lowBin,highBin)
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = cloneHist.GetRMS()
-    #print "mean after constrained axis = ",hNewMean
-    #print "RMS after constrained axis = ",hNewRMS
-
-    return hNewMean, hNewRMS
-
-def findFractionWithinSigmaRange(histoGram, sigmaRange):
-
-    hMean = histoGram.GetMean()
-    hRMS = histoGram.GetRMS()
-    #print "original mean = ", hMean," RMS = ",hRMS
-
-    lowBin = histoGram.FindBin(hMean - hRMS*sigmaRange)
-    highBin = histoGram.FindBin(hMean + hRMS*sigmaRange)
-
-    #print "lowBin = ",lowBin,", highBin = ",highBin, ", nBins = ", histoGram.GetNbinsX()
-    
-    intGral = histoGram.Integral(lowBin,highBin)
-    fullIntGral = histoGram.Integral(1,histoGram.GetNbinsX())
-    print "histo ",histoGram.GetName()," fraction covered by fit = ",intGral/fullIntGral
-
-    return intGral/fullIntGral
-
-def findMeanRMSUsingFWHM(histoGram):
-
-    # we clone the histogram here because otherwise the original histogram will be rebinned
-    # unfortunately this rebinning happens after the y-axis range has been defined in DrawPlots()
-    # and so messes up drawing of histograms
-    cloneHist = histoGram.Clone()
-    debug = False
-
-    if debug: print "original bin width = ",cloneHist.GetBinWidth(1)
-
-
-    rebinHistogram = True
-
-    while rebinHistogram==True:
-
-        rebinHistogram = False
-
-        hMaxBin = cloneHist.GetMaximumBin()
-        hMax = cloneHist.GetBinContent(hMaxBin)
-        hHalfMax = hMax/2.0
-
-        if debug: print "hNBins = ", cloneHist.GetNbinsX(), ", hMaxBin =  ", hMaxBin, ", hMax = ", hMax, ", hHalfMax = ",hHalfMax
-
-        lowBin = hMaxBin
-        highBin = hMaxBin
-        hLowContent = hMax
-        hHighContent = hMax
-        while hLowContent > hHalfMax:
-            lowBin = lowBin - 1
-            hLowContent = cloneHist.GetBinContent(lowBin)
-            #print "lowcotent =  ",hLowContent
-        while hHighContent > hHalfMax:
-            highBin = highBin + 1
-            hHighContent = cloneHist.GetBinContent(highBin)
-            #print "highcotent =  ",hHighContent
-
-        lowBinTest = lowBin - abs(hMaxBin - lowBin)
-        highBinTest = highBin + abs(highBin - hMaxBin)
-
-        while lowBinTest < hMaxBin:
-            if cloneHist.GetBinContent(lowBinTest) > cloneHist.GetBinContent(lowBinTest+1):
-                rebinHistogram = True
-                lowBinTest = hMaxBin #exits while loop
-            lowBinTest = lowBinTest + 1
-
-        while highBinTest > hMaxBin:
-            if cloneHist.GetBinContent(highBinTest) > cloneHist.GetBinContent(highBinTest-1):
-                rebinHistogram = True
-                highBinTest = hMaxBin #exits while loop
-            highBinTest = highBinTest - 1
-
-        if rebinHistogram==True:
-            cloneHist.Rebin(2)
-            if debug: print "rebinning histogram"
-
-
-
-    # analytical solution to linear interpolation between the two bins where the half max threshold is crossed
-    # using y1 = A*x1 + B, and y2 = A*x2 + B, solving for A and B
-    lowFuncA = (cloneHist.GetBinContent(lowBin) - cloneHist.GetBinContent(lowBin+1))/(cloneHist.GetBinCenter(lowBin) - cloneHist.GetBinCenter(lowBin+1))
-    lowFuncB = cloneHist.GetBinContent(lowBin) - lowFuncA*(cloneHist.GetBinCenter(lowBin))
-
-    highFuncA = (cloneHist.GetBinContent(highBin-1) - cloneHist.GetBinContent(highBin))/(cloneHist.GetBinCenter(highBin-1) - cloneHist.GetBinCenter(highBin))
-    highFuncB = cloneHist.GetBinContent(highBin-1) - highFuncA*(cloneHist.GetBinCenter(highBin-1))
-
-    lowFWHM = -99999.0
-    highFWHM = 99999.0
-
-    if interpolateFWHM:
-        # using x = (y - B)/A
-        if lowFuncA != 0.0:
-            lowFWHM = (hHalfMax - lowFuncB)/lowFuncA
-        if highFuncA != 0.0:
-            highFWHM = (hHalfMax - highFuncB)/highFuncA
-    else:
-        lowFWHM = cloneHist.GetBinLowEdge(lowBin) + cloneHist.GetBinWidth(lowBin)
-        highFWHM = cloneHist.GetBinLowEdge(highBin)
-
-    if debug: print "lowBin = ", lowBin-hMaxBin, ", lowFWHM =  ", lowFWHM, " || highBin = ",highBin-hMaxBin, ", highFWHM = ", highFWHM, ", FWHM = ",(highFWHM - lowFWHM)/2.35482
-
-
-    hNewMean = cloneHist.GetMean()
-    hNewRMS = (highFWHM - lowFWHM)/2.35482 #divide to make equivalent to Gaussian sigma
-
-    return hNewMean, hNewRMS
-
-
-def returnTuple(FZ01,hist,legendTitle):
-
-    return FZ01,hist,legendTitle
-
-
-def noFit(hist):
-    #dummy function, does not preform a fit
-    FZ01 = TF1()
-    return FZ01
-
-def noFitWithStats(hist):
-    #dummy function, this fit will not be drawn
-    FZ01 = TF1("noFitWithStats","gaus",-1.0,1.0)
-    return FZ01
-
-
-def singleGaus(hist):
-
-    #min = -2.5
-    #max = 2.5
-
-    min = hist.GetBinLowEdge(1)
-    max = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    FZ01 = TF1("FZ01", "gaus", min,max)
-
-    FZ01.SetLineWidth(2)
-    hist.Fit("FZ01", "ORQ","same")
-    
-    return FZ01
-
-def singleGausRestricted(hist):
-
-    # performs single Gaussian fit within 1.5*RMS range
-    max = hist.GetMean() + 1.5*hist.GetRMS()
-    min = hist.GetMean() - 1.5*hist.GetRMS()
-    
-    FZ01 = TF1("FZ01", "gaus", min,max)
-
-    FZ01.SetLineWidth(2)
-    hist.Fit("FZ01", "ORQ","same")
-    
-    return FZ01
-
-def singleGausIterative(hist, sigmaRange):
-
-    debug = False
-
-    # first perform a single Gaus fit across full range of histogram
-    min = hist.GetBinLowEdge(1)
-    max = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    fitA = TF1("fitA", "gaus", min,max)
-    hist.Fit("fitA","ORQN","same")
-    fitAMean = fitA.GetParameter(1)
-    fitASig = fitA.GetParameter(2)
-
-    # performs a second fit with range determined by first fit
-    max = fitAMean + (fitASig*sigmaRange)
-    min = fitAMean - (fitASig*sigmaRange)
-    fitB = TF1("fitB", "gaus", min,max)
-    hist.Fit("fitB","ORQN","same")
-    fitMean = fitB.GetParameter(1)
-    fitSig = fitB.GetParameter(2)
-    
-    newFitSig = 99999
-    newFitMean = 99999
-    i = 0
-    max = fitMean + (fitSig*sigmaRange)
-    min = fitMean - (fitSig*sigmaRange)
-    fit = TF1("fit", "gaus", min,max)
-
-    while abs(fitSig - newFitSig) > 0.0005 or abs(fitMean - newFitMean) > 0.0005:
-        
-        if(i > 0):
-            fitMean = newFitMean
-            fitSig = newFitSig
-        #print "i = ",i," fitMean = ",fitMean," fitSig = ",fitSig
-        max = fitMean + (fitSig*sigmaRange)
-        min = fitMean - (fitSig*sigmaRange)
-        fit.SetRange(min,max)
-        hist.Fit("fit","ORQN","same")
-        newFitMean = fit.GetParameter(1)
-        newFitSig = fit.GetParameter(2)
-        #print "i = ",i," newFitMean = ", newFitMean, " newFitSig = ",newFitSig
-        if(i > 50):
-            if debug:
-                print "WARNING terminate iterative gaus fit because of convergence problems"
-                print "final mean =  ", newFitMean, ", previous iter mean = ", fitMean
-                print "final sigma =  ", newFitSig, ", previous iter sigma = ", fitSig
-            break
-
-        i = i + 1
-
-
-
-    if debug:
-        print "Final i = ",i," finalFitMean = ", fit.GetParameter(1), " finalFitSig = ",fit.GetParameter(2)
-
-    fit.SetLineWidth(2)
-    
-    return fit
-
-
-def freeDoubleGaus(hist,fitInput):
-
-    #this fit is not very stable, very sensitive to 
-    #initial fitInput parameters (width,mean, normalisation etc)
-    #use instead the doubleGaus method below
-
-    min = -0.5
-    max = 0.5
-    #print "Fitting from",min,"to",max
-    FZ01 = TF1("FZ01","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min,max)
-    FZ01.SetParameter(0,fitInput[0])
-    FZ01.SetParameter(1,fitInput[1])
-    FZ01.SetParameter(2,fitInput[2])
-    FZ01.SetParameter(3,fitInput[3])
-    FZ01.SetParameter(4,fitInput[4])
-    FZ01.SetParameter(5,fitInput[5])
-    FZ01.SetLineWidth(2)
-
-    hist.Fit("FZ01", "ORQ","same")
-
-    return FZ01
-
-def doubleGaus(hist):
-
-    #first we make a single Gauss fit over entire range
-    #to determine the range for the core Gauss fit below
-    min_temp = hist.GetBinLowEdge(1)
-    max_temp = (hist.GetBinLowEdge(hist.GetNbinsX()))+hist.GetBinWidth(hist.GetNbinsX())
-    fit_temp = TF1("fit_temp","gaus",min_temp,max_temp)
-    hist.Fit("fit_temp", "RQON")
-    fitMean_temp = fit_temp.GetParameter(1)
-    fitSig_temp  = fit_temp.GetParameter(2)
-
-    #we make a single Gauss fit to the core
-    minCore = fitMean_temp - 1.0*fitSig_temp
-    maxCore = fitMean_temp + 1.0*fitSig_temp
-    FCore = TF1("FCore","gaus",minCore,maxCore)
-    hist.Fit("FCore","RQON")
-
-    #we make the first double Gauss fit, fixing the mean and width of one 
-    #of the Gaussians to that of the core Gauss fit, and letting the second
-    #Gauss vary but with some sensible starting point
-    FFixCore = TF1("FFixCore","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min_temp,max_temp)
-    FFixCore.SetParameter(0,FCore.GetParameter(0))
-    FFixCore.FixParameter(1,FCore.GetParameter(1))
-    FFixCore.FixParameter(2,FCore.GetParameter(2))
-    #FFixCore.SetParameter(3,FCore.GetParameter(0)/3.0) #normalisation
-    FFixCore.SetParameter(3,FCore.GetParameter(0)/5.0) #normalisation
-    FFixCore.SetParameter(4,FCore.GetParameter(1))     #mean
-    #FFixCore.SetParameter(5,FCore.GetParameter(2)*5.0) #width
-    FFixCore.SetParameter(5,FCore.GetParameter(2)*2.0) #width
-    hist.Fit("FFixCore","RQON")
-        
-    #we do the final double Gaussian fit letting everything vary but using 
-    #as inputs the result of the previous constrained fit
-    FFull = TF1("FFull","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]*exp(-0.5*((x-[4])/[5])**2)",min_temp,max_temp)
-    FFull.SetParameter(0,FFixCore.GetParameter(0))
-    FFull.SetParameter(1,FFixCore.GetParameter(1))
-    FFull.SetParameter(2,FFixCore.GetParameter(2))
-    FFull.SetParameter(3,FFixCore.GetParameter(3))
-    FFull.SetParameter(4,FFixCore.GetParameter(4))
-    FFull.SetParameter(5,FFixCore.GetParameter(5))
-    hist.Fit("FFull","RQO","same")
-    
-    #print "FFull core mean = ",FFull.GetParameter(1)," width = ",FFull.GetParameter(2)
-    #print "FFull tail mean = ",FFull.GetParameter(4)," width = ",FFull.GetParameter(5)
-        
-    
-    return FFull
-
-def doubleFit(hist,units,color,xLeft,yLow,same):
-    min_temp = hist.GetBinLowEdge(0)
-    max_temp = hist.GetBinLowEdge(hist.GetNbinsX())
-    fit_temp = TF1("fit_temp","gaus",min_temp,max_temp)
-    if same:
-        hist.Fit("fit_temp", "ORQ","same")
-    else:
-        hist.Fit("fit_temp", "ORQ","")
-    fitMean_temp = fit_temp.GetParameter(1)
-    fitSig_temp  = fit_temp.GetParameter(2)
-    min = fitMean_temp - 1.5* fitSig_temp
-    max = fitMean_temp + 1.5 * fitSig_temp
-    fit = TF1("fit","gaus",min,max )
-    fit.SetLineColor(color)
-    if same:
-        hist.Fit("fit", "ORQ","same")
-    else:
-        hist.Fit("fit", "ORQ","")
-    fit.Draw("same")
-
-    # Draw the after mean and sigma
-    text = "#mu="
-    text += str(round(fit.GetParameter(1),5))
-    text += " "+units+", #sigma="
-    text += str(round(fit.GetParameter(2),4))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetLineColor(color)
-    m_l.SetTextSize(0.03)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.SetTextColor(color)
-    print text
-    m_l.DrawLatex(xLeft,yLow,text)
-
-def quoteMeanAndRMS(hist,units,color,xLeft,yLow,same):
-    
-    # Draw the after mean and sigma
-    text = "mean = "
-    text += str(round(hist.GetMean(),5))
-    text += " "+units+", RMS = "
-    text += str(round(hist.GetRMS(),4))
-    text += " "+units
-    m_l = TLatex()
-    m_l.SetLineColor(color)
-    m_l.SetTextSize(0.03)
-    m_l.SetTextAlign(12)
-    m_l.SetNDC()
-    m_l.SetTextColor(color)
-    print text
-    m_l.DrawLatex(xLeft,yLow,text)
-
-
-def plotStatVersusFile(rootFiles, histDirectories, fileLabels, nFiles, histogramName, meanFWHM=0):
-
-    # plots mean of a particular histogram for different files as separate 
-    # entries on x-axis
-
-    statHist = TH1F("statHist","statHist",3,0.,3.)
-
-    for i in range(nFiles):
-
-        hist = GetHistogram(rootFiles[i],histDirectories[i],histogramName,1,29)
-        #RemoveNegativeYAxis(hist,histogramName)
-        #hist.Scale(2.0)
-        mean = hist.GetMean()
-        rms = hist.GetRMS()
-        entries = hist.GetEntries()
-        sqrtEntries = math.sqrt(entries);
-        meanErr = rms/sqrtEntries
-        print "mean = ", mean, ", rms = ", rms, ", entries = ",entries, ", sqrtEntries = ", sqrtEntries, ", meanErr = ", meanErr
-        
-        if meanFWHM==0:
-            statHist.SetBinContent(i+1,mean)
-            statHist.SetBinError(i+1,meanErr)
-        else:
-            meanFWHMTuple = findMeanRMSUsingFWHM(hist)
-            print "mean =", meanFWHMTuple[0]
-            print "FWHM/2.35 = ", meanFWHMTuple[1]
-            statHist.SetBinContent(i+1,meanFWHMTuple[1])
-            statHist.SetBinError(i+1,0.00000001)#no error defined for FWHM
-
-        statHist.GetXaxis().SetBinLabel(i+1,fileLabels[i])
-        
-    if meanFWHM==0:
-        statHist.GetYaxis().SetRangeUser(-0.005,0.005)
-    #else:
-    #    statHist.GetYaxis().SetRangeUser(0.0,0.2)
-    statHist.GetXaxis().SetLabelSize(0.06)
-
-
-    return statHist
-
-
-def simpleDrawSingleHist(hist, yAxisTitle, xAxisTitle, plotTitle,  
-              canvasText, outputName="test.png", textBoxLeftX=0.60, textBoxUpperY=0.91):
-
-    can = TCanvas(outputName,outputName,800,600)
-    can.cd()
-
-    hist.GetXaxis().SetTitle(xAxisTitle)
-    hist.GetYaxis().SetTitle(yAxisTitle)
-    hist.GetYaxis().SetTitleOffset(1.42)
-    hist.Draw()
-  
-    # canvas text (right hand side)
-    latexAtlas = TLatex()
-    latexAtlas.SetNDC()
-    latexAtlas.SetTextColor(1)
-    latexAtlas2 = TLatex()
-    latexAtlas2.SetNDC()
-
-    latexAtlas.DrawLatex(textBoxLeftX,textBoxUpperY,canvasText[0])
-    latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.06,plotTitle)
-    latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.12,canvasText[1])
-    latexAtlas2.DrawLatex(textBoxLeftX,textBoxUpperY-0.18,canvasText[2])
-
-    can.SaveAs(outputName)
-
-def Test(histogramName):
-
-    print "histoName = ", histogramName
-
-    if "bin-" in histogramName:
-#        binNum = (histogramName.split('-'))
-#        print "binNum = ", binNum[1]
-        binNum = (histogramName.split('-'))[1]
-        print "binNum = ", binNum        
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/writeOutput.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/writeOutput.py
deleted file mode 100644
index 9ebd0db29a9475d0e60b64491405486f251ba904..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/writeOutput.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Description:
-#  This File contains the functions to determine where to write the output histogram
-#  and actually do it
-#
-# Author:
-#  John Alison <johnda@hep.upenn.edu>
-#===========================================================================
-
-def getBEC(histName):
-    if histName.find("_b") > -1:
-        return "Barrel"
-    elif (histName.find("Endcap_A") > -1 or histName.find("_eca") > -1):
-        return "Endcap_A"
-    elif (histName.find("Endcap_C") > -1 or histName.find("_ecc") > -1):
-        return "Endcap_C"
-    else:
-        return "General"
-
-def getSide(histName):
-    if histName.find("Side_A") > -1:
-        return "Side_A"
-    elif histName.find("Side_C") > -1:
-        return "Side_C"
-    else:
-        return 0
-    
-def getSubSystem(histName):
-    if histName.find("pix") > -1:
-        return "Pixel"
-    elif histName.find("sct") > -1:
-        return "SCT"
-    elif histName.find("trt") > -1:
-        return "TRT"
-    else:
-        return "General"
-
-def getDir(histName,moduleName,trackCollectionName):
-    tagName = getSubSystem(histName)
-    if tagName == "TRT":
-        becName = getBEC(histName)
-        if becName == "Barrel":
-            sideName = getSide(histName)
-            if sideName:
-                thisDir = rootfile.GetDirectory(tagName+"/"+becName+"/"+sideName+"/"+trackCollectionName+"/"+moduleName)
-            else:
-                thisDir = rootfile.GetDirectory(tagName+"/"+becName+"/"+trackCollectionName+"/"+moduleName)
-                #print tagName+"/"+becName+"/"+trackCollectionName+"/"+moduleName
-        else:
-            thisDir = rootfile.GetDirectory(tagName+"/"+becName+"/"+trackCollectionName+"/"+moduleName)
-            
-    else:
-        thisDir = rootfile.GetDirectory(tagName+"/"+trackCollectionName+"/"+moduleName)
-
-    if not thisDir:
-        print "ERROR: the directory ",tagName+"/"+trackCollectionName+"/"+moduleName, "does noe exist!"
-        #print histName
-        #print becName
-        #print sideName
-        print "exiting...."
-        sys.exit()
-
-    return thisDir
-
-def writeCan(can,histName,moduleName,trackCollectionName):
-    correctDir = getDir(histName,moduleName,trackCollectionName)
-    correctDir.cd()
-    can.Write()
-    return
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx
deleted file mode 100644
index a078b5af3c6a89534cbb350bae4c341f60fe63ce..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx
+++ /dev/null
@@ -1,3011 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// IDAlignMonEfficiencies.cxx
-// AUTHORS: Beate Heinemann, Tobias Golling, John Alison, Lauren Tompkins
-// **********************************************************************
-
-#include "GaudiKernel/MsgStream.h"
-
-#include "TrkParameters/TrackParameters.h"
-
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-#include "TProfile.h"
-#include "TProfile2D.h"
-#include "TMath.h"
-#include "LWHists/TH1F_LW.h"
-#include "LWHists/TH2F_LW.h"
-
-#include "Identifier/Identifier.h"
-#include "AtlasDetDescr/AtlasDetectorID.h"
-#include "InDetIdentifier/PixelID.h"
-#include "InDetIdentifier/SCT_ID.h"
-#include "InDetIdentifier/TRT_ID.h"
-
-#include "TrkTrack/Track.h"
-#include "TrkRIO_OnTrack/RIO_OnTrack.h"
-#include "InDetRIO_OnTrack/SiClusterOnTrack.h"
-#include "InDetPrepRawData/SiCluster.h"
-
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkEventPrimitives/LocalParameters.h"
-#include "TrkTrackSummary/TrackSummary.h"
-
-#include "IDAlignMonEfficiencies.h"
-
-#include "InDetReadoutGeometry/SiDetectorElement.h"
-#include "InDetReadoutGeometry/SiDetectorElementCollection.h"
-
-
-#include "TrkToolInterfaces/ITrackHoleSearchTool.h"
-#include "InDetAlignGenTools/IInDetAlignHitQualSelTool.h"
-#include "TrackSelectionTool.h"
-#include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h"
-
-#include "PixelReadoutGeometry/PixelDetectorManager.h"
-#include "SCT_ReadoutGeometry/SCT_DetectorManager.h"
-
-// *********************************************************************
-// Public Methods
-// *********************************************************************
-
-struct IDAlignMonEfficiencies::TRTBarrelHistograms {
-  /** TubeHits
-
-     When there are hits in the TRT which lie beyond a certian sigma from the track fit
-     (currently 2 sigma), but are not far enough away to be called outliers and not used
-     in the fit, they are marked as "tube" hits.  When a hit becomes a tube hit the drift
-     time information is ignored, the center of the straw is taken as the position of the hit,
-     and an error of 4mm/sqrt(12) is assigned.  */
-
-  /** TRT Barrel */
-  /**  total hits (hits + tubeHits + outliers) in the TRT barel modules(0-2) vs phi sector */
-  TH1F_LW* totHits_vs_phiSector[3] {};
-
-  /** total hits (hits + tubeHits + outliers) in the TRT barel modules(0-2) vs phi sector */
-  TH1F_LW* totHits_vs_StrawLay;
-
-  /** number of (hits/tubeHits/outliers) in the TRT barel modules(0-2) vs phi sector */
-  TH1F_LW* outliers_vs_phiSector[3] {};
-  TH1F_LW* hits_vs_phiSector[3] {};
-  TH1F_LW* tubeHits_vs_phiSector[3] {};
-
-  /** number of (hits/tubeHits/outliers) in the TRT barel modules(0-2) vs straw layer (0-72) */
-  TH1F_LW* outliers_vs_StrawLay;
-  TH1F_LW* hits_vs_StrawLay;
-  TH1F_LW* tubeHits_vs_StrawLay;
-
-  /** ratio of (hits/tubeHits/outliers) to total measurements (outl + hits + tubeHits) in the TRT barrel
-      for the three modules (0-2) */
-  TProfile* outliers_eff_vs_phiSector[3] {};
-  TProfile* hits_eff_vs_phiSector[3] {};
-  TProfile* tubeHits_eff_vs_phiSector[3] {};
-
-  /** ratio of (hits/tubeHits/outliers) to total measurements (outl + hits + tubeHits) vs phi sector
-      in the TRT Barrel for the three modules (0-2) */
-  TProfile* outliers_eff_vs_StrawLay;
-  TProfile* hits_eff_vs_StrawLay;
-  TProfile* tubeHits_eff_vs_StrawLay;
-
-  TRTBarrelHistograms() {
-    totHits_vs_StrawLay = nullptr;
-    outliers_vs_StrawLay = nullptr;
-    hits_vs_StrawLay = nullptr;
-    tubeHits_vs_StrawLay = nullptr;
-    outliers_eff_vs_StrawLay = nullptr;
-    hits_eff_vs_StrawLay = nullptr;
-    tubeHits_eff_vs_StrawLay = nullptr;
-
-    for (unsigned int lay = 0; lay < 3; ++lay) {
-      totHits_vs_phiSector[lay] = nullptr;
-      outliers_vs_phiSector[lay] = nullptr;
-      hits_vs_phiSector[lay] = nullptr;
-      tubeHits_vs_phiSector[lay] = nullptr;
-
-      outliers_eff_vs_phiSector[lay] = nullptr;
-      hits_eff_vs_phiSector[lay] = nullptr;
-      tubeHits_eff_vs_phiSector[lay] = nullptr;
-    }
-  };
-};
-
-struct IDAlignMonEfficiencies::TRTEndcapHistograms {
-  /** TRT Endcap Histograms */
-  /** total hits (measurements+outliers+tubeHits) in the trt endcap vs ring layer */
-  TH1F_LW* totHits_vs_ring[2] {};
-
-  /** outliers/hits/tubeHits in the trt endcap vs ring layer */
-  TH1F_LW* outliers_vs_ring[2] {};
-  TH1F_LW* hits_vs_ring[2] {};
-  TH1F_LW* tubeHits_vs_ring[2] {};
-
-  /** ratio of outliers/hits/tubeHits  to total measurements (outl + hits) vs ring in the TRT Endcap */
-  TProfile* outliers_eff_vs_ring[2] {};
-  TProfile* hits_eff_vs_ring[2] {};
-  TProfile* tubeHits_eff_vs_ring[2] {};
-
-  /** total hits (measurements+outliers+tubeHits) in the trt endcap vs phiSector layer */
-  TH1F_LW* totHits_vs_phiSector[2] {};
-
-  /** outliers/hits/tubeHits in the trt endcap vs phiSector layer */
-  TH1F_LW* outliers_vs_phiSector[2] {};
-  TH1F_LW* hits_vs_phiSector[2] {};
-  TH1F_LW* tubeHits_vs_phiSector[2] {};
-
-  /** ratio of outliers/hits/tubeHits  to total measurements (outl + hits) vs phiSector in the TRT Endcap */
-  TProfile* outliers_eff_vs_phiSector[2] {};
-  TProfile* hits_eff_vs_phiSector[2] {};
-  TProfile* tubeHits_eff_vs_phiSector[2] {};
-
-  TRTEndcapHistograms() {
-    for (unsigned int side = 0; side < 2; ++side) {
-      totHits_vs_ring[side] = nullptr;
-      outliers_vs_ring[side] = nullptr;
-      hits_vs_ring[side] = nullptr;
-      tubeHits_vs_ring[side] = nullptr;
-      outliers_eff_vs_ring[side] = nullptr;
-      hits_eff_vs_ring[side] = nullptr;
-      tubeHits_eff_vs_ring[side] = nullptr;
-
-      totHits_vs_phiSector[side] = nullptr;
-      outliers_vs_phiSector[side] = nullptr;
-      hits_vs_phiSector[side] = nullptr;
-      tubeHits_vs_phiSector[side] = nullptr;
-      outliers_eff_vs_phiSector[side] = nullptr;
-      hits_eff_vs_phiSector[side] = nullptr;
-      tubeHits_eff_vs_phiSector[side] = nullptr;
-    }
-  };
-};
-
-
-
-IDAlignMonEfficiencies::IDAlignMonEfficiencies(const std::string& type, const std::string& name,
-                                               const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent),
-  m_trt_b_hist(new TRTBarrelHistograms),
-  m_trt_ec_hist(new TRTEndcapHistograms),
-  m_idHelper(nullptr),
-  m_pixelID(nullptr),
-  m_sctID(nullptr),
-  m_trtID(nullptr),
-  m_PIX_Mgr(nullptr),
-  m_SCT_Mgr(nullptr),
-  m_NPixLayers(0),
-  m_events(0),
-  m_histosBooked(0),
-  m_doHitQuality(false),
-  m_minLB (-0.5),
-  m_maxLB (3023.5),
-  m_nLB (3024) {
-
-  declareProperty("CheckRate", m_checkrate = 1000);
-  declareProperty("HoleSearch", m_holeSearchTool = ToolHandle<Trk::ITrackHoleSearchTool>("InDetHoleSearchTool"));
-  declareProperty("doHoleSearch", m_doHoleSearch = true);
-  declareProperty("trackSelection", m_trackSelection = ToolHandle<InDetAlignMon::TrackSelectionTool>("InDetAlignMon::TrackSelectionTool"));
-  declareProperty("minSiliconEffWindow", m_minSiliconEffWindow = 0.8);
-  declareProperty("maxSiliconEffWindow", m_maxSiliconEffWindow = 1.05);
-  declareProperty("HitQualityTool", m_hitQualityTool);
-  declareProperty("triggerChainName", m_triggerChainName = "NoTriggerSelection");
-  declareProperty("Pixel_Manager", m_Pixel_Manager);
-  declareProperty("SCT_Manager", m_SCT_Manager);
-  declareProperty("TRT_Manager", m_TRT_Manager);
-  declareProperty("trackSumTool", m_trackSumTool = ToolHandle<Trk::ITrackSummaryTool>("Trk::TrackSummaryTool/InDetTrackSummaryTool"));
-  declareProperty("NSplitMap", m_mapSplit = 1);
-  declareProperty("useExtendedPlots", m_extendedPlots = false);
-
-  InitializeHistograms();
-}
-
-IDAlignMonEfficiencies::~IDAlignMonEfficiencies() {
-  delete m_trt_b_hist;
-  delete m_trt_ec_hist;
-}
-
-void IDAlignMonEfficiencies::InitializeHistograms() {
-  m_hits_vs_layer_barrel = nullptr;
-  m_hits_vs_layer_eca = nullptr;
-  m_hits_vs_layer_ecc = nullptr;
-
-  m_measurements_vs_layer_barrel = nullptr;
-  m_measurements_vs_layer_eca = nullptr;
-  m_measurements_vs_layer_ecc = nullptr;
-
-  m_outliers_vs_layer_barrel = nullptr;
-  m_outliers_vs_layer_eca = nullptr;
-  m_outliers_vs_layer_ecc = nullptr;
-
-  m_holes_vs_layer_barrel = nullptr;
-  m_holes_vs_layer_eca = nullptr;
-  m_holes_vs_layer_ecc = nullptr;
-
-  m_noholes_vs_layer_barrel = nullptr;
-  m_noholes_vs_layer_eca = nullptr;
-  m_noholes_vs_layer_ecc = nullptr;
-
-  m_overlapX_vs_layer_barrel = nullptr;
-  m_overlapX_vs_layer_eca = nullptr;
-  m_overlapX_vs_layer_ecc = nullptr;
-  m_overlapY_vs_layer_barrel = nullptr;
-  m_overlapY_vs_layer_eca = nullptr;
-  m_overlapY_vs_layer_ecc = nullptr;
-
-  m_measurements_eff_vs_layer_barrel = nullptr;
-  m_measurements_eff_vs_layer_eca = nullptr;
-  m_measurements_eff_vs_layer_ecc = nullptr;
-
-  m_outliers_eff_vs_layer_barrel = nullptr;
-  m_outliers_eff_vs_layer_eca = nullptr;
-  m_outliers_eff_vs_layer_ecc = nullptr;
-
-  m_holes_eff_vs_layer_barrel = nullptr;
-  m_holes_eff_vs_layer_eca = nullptr;
-  m_holes_eff_vs_layer_ecc = nullptr;
-
-  m_noholes_eff_vs_layer_barrel = nullptr;
-  m_noholes_eff_vs_layer_eca = nullptr;
-  m_noholes_eff_vs_layer_ecc = nullptr;
-
-  m_overlapX_eff_vs_layer_barrel = nullptr;
-  m_overlapX_eff_vs_layer_eca = nullptr;
-  m_overlapX_eff_vs_layer_ecc = nullptr;
-  m_overlapY_eff_vs_layer_barrel = nullptr;
-  m_overlapY_eff_vs_layer_eca = nullptr;
-  m_overlapY_eff_vs_layer_ecc = nullptr;
-
-  m_measurements_eff_vs_Eta_Phi_pix_eca = nullptr;
-  m_measurements_eff_vs_Eta_Phi_pix_ecc = nullptr;
-  m_measurements_vs_Eta_Phi_pix_eca = nullptr;
-  m_measurements_vs_Eta_Phi_pix_ecc = nullptr;
-  m_hits_vs_Eta_Phi_pix_eca = nullptr;
-  m_hits_vs_Eta_Phi_pix_ecc = nullptr;
-  m_outliers_vs_Eta_Phi_pix_eca = nullptr;
-  m_outliers_vs_Eta_Phi_pix_ecc = nullptr;
-  m_holes_vs_Eta_Phi_pix_eca = nullptr;
-  m_holes_vs_Eta_Phi_pix_ecc = nullptr;
-
-  m_measurements_eff_vs_Eta_Phi_sct_eca = nullptr;
-  m_measurements_eff_vs_Eta_Phi_sct_ecc = nullptr;
-  m_measurements_vs_Eta_Phi_sct_eca = nullptr;
-  m_measurements_vs_Eta_Phi_sct_ecc = nullptr;
-  m_measurements_vs_Eta_Phi_sct_eca_3d_s0 = nullptr;
-  m_measurements_vs_Eta_Phi_sct_eca_3d_s1 = nullptr;
-  m_measurements_vs_Eta_Phi_sct_ecc_3d_s0 = nullptr;
-  m_measurements_vs_Eta_Phi_sct_ecc_3d_s1 = nullptr;
-  m_hits_vs_Eta_Phi_sct_eca = nullptr;
-  m_hits_vs_Eta_Phi_sct_ecc = nullptr;
-  m_outliers_vs_Eta_Phi_sct_eca = nullptr;
-  m_outliers_vs_Eta_Phi_sct_ecc = nullptr;
-  m_holes_vs_Eta_Phi_sct_eca = nullptr;
-  m_holes_vs_Eta_Phi_sct_ecc = nullptr;
-}
-
-StatusCode IDAlignMonEfficiencies::initialize() {
-  StatusCode sc;
-
-  m_events = 0;
-  m_histosBooked = 0;
-
-  //ID Helper
-  sc = detStore()->retrieve(m_idHelper, "AtlasID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get AtlasDetectorID !" << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found AtlasDetectorID" << endmsg;
-  }
-
-  sc = detStore()->retrieve(m_pixelID, "PixelID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get Pixel ID helper !" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized PixelIDHelper" << endmsg;
-
-  sc = detStore()->retrieve(m_sctID, "SCT_ID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get SCT ID helper !" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTIDHelper" << endmsg;
-
-  sc = detStore()->retrieve(m_trtID, "TRT_ID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get TRT ID helper !" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized TRTIDHelper" << endmsg;
-
-  //Pixel Manager
-  sc = detStore()->retrieve(m_PIX_Mgr, m_Pixel_Manager);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get PIX_Manager !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized PixelManager" << endmsg;
-  //SCT Manager
-
-  sc = detStore()->retrieve(m_SCT_Mgr, m_SCT_Manager);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get SCT_Manager !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTManager" << endmsg;
-
-
-  if (m_holeSearchTool.retrieve().isFailure()) {
-    msg(MSG::WARNING) << "Failed to retrieve tool " << m_holeSearchTool << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_holeSearchTool << endmsg;
-  }
-
-  if (m_trackSelection.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve tool " << m_trackSelection << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_trackSelection << endmsg;
-  }
-
-  sc = ManagedMonitorToolBase::initialize();
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to initialize ManagedMonitorToolBase!" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-
-  if (m_hitQualityTool.empty()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
-        "No hit quality tool configured - not hit quality cuts will be imposed"
-                                            << endmsg;
-    m_doHitQuality = false;
-  } else if (m_hitQualityTool.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not retrieve " << m_hitQualityTool
-                                                << " (to apply hit quality cuts to Si hits) " << endmsg;
-    m_doHitQuality = false;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)
-        << "Hit quality tool setup "
-        << "- hit quality cuts will be applied to Si hits" << endmsg;
-    m_doHitQuality = true;
-  }
-
-  // get TrackSummaryTool
-  if (m_trackSumTool.retrieve().isSuccess()) {
-    ATH_MSG_DEBUG("Retrieving success of track summary tool " << m_trackSumTool);
-  } else {
-    ATH_MSG_WARNING("Failed to retrieve track summary tool " << m_trackSumTool);
-    return StatusCode::SUCCESS;
-  }
-
-  // ReadHandleKey initialization
-  ATH_CHECK(m_eventInfoKey.initialize());
-  ATH_CHECK(m_tracksName.initialize());
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonEfficiencies::bookHistograms() {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    // book histograms that are only made in the online environment...
-  }
-
-  if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-    // book histograms that are only relevant for cosmics data...
-  }
-
-  std::string outputDirName = "IDAlignMon/" + m_tracksName.key() + "_" + m_triggerChainName + "/HitEfficiencies";
-  MonGroup al_mon(this, outputDirName, run);
-  MonGroup al_mon_ls(this, outputDirName, lowStat);
-
-
-
-  if (newRunFlag()) {
-    //if user environment specified we don't want to book new histograms at every run boundary
-    //we instead want one histogram per job
-    if (m_histosBooked != 0 && AthenaMonManager::environment() == AthenaMonManager::user) return StatusCode::SUCCESS;
-
-    const Int_t nx = 22;
-    TString siliconLayers[nx] = {
-      "IBL", "Pix L0", "Pix L1", "Pix L2", "SCT L0 S0", "S1", "SCT L1 S0", "S1", "SCT L2 S0", "S1", "SCT L3 S0", "S1",
-      "SCT L4 S0", "S1", "SCT L5 S0", "S1", "SCT L6 S0", "S1", "SCT L7 S0", "S1", "SCT L8 S0", "S1"
-    };
-
-    // do plots by layers
-
-    m_hits_vs_layer_barrel = new TH1F("hits_vs_layer_barrel", "possible hits vs. layer in the barrel", 12, -0.5, 11.5); // 12
-    for (int i = 1; i <= 12; i++) m_hits_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_hits_vs_layer_barrel);
-
-    m_hits_vs_layer_eca = new TH1F("hits_vs_layer_eca", "possible hits vs. layer in the barrel eca", 21, -0.5, 20.5);
-    for (int i = 2; i <= nx; i++) m_hits_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_hits_vs_layer_eca);
-    m_hits_vs_layer_ecc = new TH1F("hits_vs_layer_ecc", "possible hits vs. layer in the barrel ecc", 21, -0.5, 20.5);
-    for (int i = 2; i <= nx; i++) m_hits_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_hits_vs_layer_ecc);
-
-    m_measurements_vs_layer_barrel = new TH1F("measurements_vs_layer_barrel",
-                                              "measurements per possible hit vs. layer in the barrel", 12, -0.5, 11.5);
-    for (int i = 1; i <= 12; i++) m_measurements_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_measurements_vs_layer_barrel);
-    m_measurements_vs_layer_eca = new TH1F("measurements_vs_layer_eca",
-                                           "measurements per possible hit vs. layer in the eca", 21, -0.5, 20.5);
-    for (int i = 2; i <= nx; i++) m_measurements_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_measurements_vs_layer_eca);
-    m_measurements_vs_layer_ecc = new TH1F("measurements_vs_layer_ecc",
-                                           "measurements per possible hit vs. layer in the ecc", 21, -0.5, 20.5);
-    for (int i = 2; i <= nx; i++) m_measurements_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_measurements_vs_layer_ecc);
-
-    m_outliers_vs_layer_barrel = new TH1F("outliers_vs_layer_barrel",
-                                          "outliers per possible hit vs. layer in the barrel", 12, -0.5, 11.5);
-    for (int i = 1; i <= 12; i++) m_outliers_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_outliers_vs_layer_barrel);
-    m_outliers_vs_layer_eca = new TH1F("outliers_vs_layer_eca", "outliers per possible hit vs. layer in the eca", 21,
-                                       -0.5, 20.5);
-    for (int i = 2; i <= nx; i++) m_outliers_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_outliers_vs_layer_eca);
-    m_outliers_vs_layer_ecc = new TH1F("outliers_vs_layer_ecc", "outliers per possible hit vs. layer in the ecc", 21,
-                                       -0.5, 20.5);
-    for (int i = 2; i <= nx; i++) m_outliers_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_outliers_vs_layer_ecc);
-
-    m_holes_vs_layer_barrel = new TH1F("holes_vs_layer_barrel", "holes per possible hit vs. layer in the barrel", 12,
-                                       -0.5, 11.5);
-    for (int i = 1; i <= 12; i++) m_holes_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_holes_vs_layer_barrel);
-    m_holes_vs_layer_eca =
-      new TH1F("holes_vs_layer_eca", "holes per possible hit vs. layer in the eca", 21, -0.5, 20.5);
-    for (int i = 2; i <= nx; i++) m_holes_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_holes_vs_layer_eca);
-    m_holes_vs_layer_ecc =
-      new TH1F("holes_vs_layer_ecc", "holes per possible hit vs. layer in the ecc", 21, -0.5, 20.5);
-    for (int i = 2; i <= nx; i++) m_holes_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_holes_vs_layer_ecc);
-
-    m_noholes_vs_layer_barrel = new TH1F("noholes_vs_layer_barrel", "noholes per possible hit vs. layer in the barrel",
-                                         12, -0.5, 11.5);
-    for (int i = 1; i <= 12; i++) m_noholes_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_noholes_vs_layer_barrel);
-    m_noholes_vs_layer_eca = new TH1F("noholes_vs_layer_eca", "noholes per possible hit vs. layer in the eca", 21, -0.5,
-                                      20.5);
-    for (int i = 2; i <= nx; i++) m_noholes_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_noholes_vs_layer_eca);
-    m_noholes_vs_layer_ecc = new TH1F("noholes_vs_layer_ecc", "noholes per possible hit vs. layer in the ecc", 21, -0.5,
-                                      20.5);
-    for (int i = 2; i <= nx; i++) m_noholes_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_noholes_vs_layer_ecc);
-
-    if (m_extendedPlots) {
-      m_overlapX_vs_layer_barrel = new TH1F("overlapX_vs_layer_barrel",
-                                            "X Overlap Hits (one per overlap) vs. layer in the barrel", 12, -0.5, 11.5);
-      for (int i = 1; i <= 12; i++) m_overlapX_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapX_vs_layer_barrel);
-      m_overlapX_vs_layer_eca = new TH1F("overlapX_vs_layer_eca",
-                                         "X Overlap Hits (one per overlap) vs. layer in the barrel eca", 21, -0.5,
-                                         20.5);
-      for (int i = 2; i <= nx; i++) m_overlapX_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapX_vs_layer_eca);
-      m_overlapX_vs_layer_ecc = new TH1F("overlapX_vs_layer_ecc",
-                                         "X Overlap Hits (one per overlap) vs. layer in the barrel ecc", 21, -0.5,
-                                         20.5);
-      for (int i = 2; i <= nx; i++) m_overlapX_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapX_vs_layer_ecc);
-
-      m_overlapY_vs_layer_barrel = new TH1F("overlapY_vs_layer_barrel",
-                                            "Y Overlap Hits (one per overlap) vs. layer in the barrel", 12, -0.5, 11.5);
-      for (int i = 1; i <= 12; i++) m_overlapY_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapY_vs_layer_barrel);
-      m_overlapY_vs_layer_eca = new TH1F("overlapY_vs_layer_eca",
-                                         "Y Overlap Hits (one per overlap) vs. layer in the barrel eca", 21, -0.5,
-                                         20.5);
-      for (int i = 2; i <= nx; i++) m_overlapY_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapY_vs_layer_eca);
-      m_overlapY_vs_layer_ecc = new TH1F("overlapY_vs_layer_ecc",
-                                         "Y Overlap Hits (one per overlap) vs. layer in the barrel ecc", 21, -0.5,
-                                         20.5);
-      for (int i = 2; i <= nx; i++) m_overlapY_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapY_vs_layer_ecc);
-
-      m_overlapX_eff_vs_layer_barrel = new TProfile("overlapX_eff_vs_layer_barrel",
-                                                    "fraction of OverlapX hits vs. layer in the barrel", 12, -0.5, 11.5,
-                                                    0., 1.);
-      for (int i = 1; i <= 12; i++) m_overlapX_eff_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapX_eff_vs_layer_barrel);
-      m_overlapX_eff_vs_layer_eca = new TProfile("overlapX_eff_vs_layer_eca",
-                                                 "fraction of OverlapX hits vs. layer in the eca", 21, -0.5, 20.5, 0.,
-                                                 1.);
-      for (int i = 2; i <= nx; i++) m_overlapX_eff_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapX_eff_vs_layer_eca);
-      m_overlapX_eff_vs_layer_ecc = new TProfile("overlapX_eff_vs_layer_ecc",
-                                                 "fraction of OverlapX hits vs. layer in the ecc", 21, -0.5, 20.5, 0.,
-                                                 1.);
-      for (int i = 2; i <= nx; i++) m_overlapX_eff_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapX_eff_vs_layer_ecc);
-
-      m_overlapY_eff_vs_layer_barrel = new TProfile("overlapY_eff_vs_layer_barrel",
-                                                    "fraction of OverlapY hits vs. layer in the barrel", 12, -0.5, 11.5,
-                                                    0., 1.);
-      for (int i = 1; i <= 12; i++) m_overlapY_eff_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapY_eff_vs_layer_barrel);
-      m_overlapY_eff_vs_layer_eca = new TProfile("overlapY_eff_vs_layer_eca",
-                                                 "fraction of OverlapY hits vs. layer in the eca", 21, -0.5, 20.5, 0.,
-                                                 1.);
-      for (int i = 2; i <= nx; i++) m_overlapY_eff_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapY_eff_vs_layer_eca);
-      m_overlapY_eff_vs_layer_ecc = new TProfile("overlapY_eff_vs_layer_ecc",
-                                                 "fraction of OverlapY hits vs. layer in the ecc", 21, -0.5, 20.5, 0.,
-                                                 1.);
-      for (int i = 2; i <= nx; i++) m_overlapY_eff_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-      RegisterHisto(al_mon, m_overlapY_eff_vs_layer_ecc);
-    }
-
-
-    //book efficiencie by layers
-    m_measurements_eff_vs_layer_barrel = new TProfile("measurements_eff_vs_layer_barrel",
-                                                      "measurements per possible hit vs. layer in the barrel", 12, -0.5,
-                                                      11.5, 0., 1.);
-    for (int i = 1; i <= 12; i++) m_measurements_eff_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon_ls, m_measurements_eff_vs_layer_barrel);
-    m_measurements_eff_vs_layer_eca = new TProfile("measurements_eff_vs_layer_eca",
-                                                   "measurements per possible hit vs. layer in the eca", 21, -0.5, 20.5,
-                                                   0., 1.);
-    for (int i = 2; i <= nx; i++) m_measurements_eff_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-
-    RegisterHisto(al_mon_ls, m_measurements_eff_vs_layer_eca);
-    m_measurements_eff_vs_layer_ecc = new TProfile("measurements_eff_vs_layer_ecc",
-                                                   "measurements per possible hit vs. layer in the ecc", 21, -0.5, 20.5,
-                                                   0., 1.);
-    for (int i = 2; i <= nx; i++) m_measurements_eff_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-
-    RegisterHisto(al_mon_ls, m_measurements_eff_vs_layer_ecc);
-
-    m_outliers_eff_vs_layer_barrel = new TProfile("outliers_eff_vs_layer_barrel",
-                                                  "outliers per possible hit vs. layer in the barrel", 12, -0.5, 11.5,
-                                                  0., 1.);
-    for (int i = 1; i <= 12; i++) m_outliers_eff_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_outliers_eff_vs_layer_barrel);
-    m_outliers_eff_vs_layer_eca = new TProfile("outliers_eff_vs_layer_eca",
-                                               "outliers per possible hit vs. layer in the eca", 21, -0.5, 20.5, 0.,
-                                               1.);
-    for (int i = 2; i <= nx; i++) m_outliers_eff_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_outliers_eff_vs_layer_eca);
-    m_outliers_eff_vs_layer_ecc = new TProfile("outliers_eff_vs_layer_ecc",
-                                               "outliers per possible hit vs. layer in the ecc", 21, -0.5, 20.5, 0.,
-                                               1.);
-    for (int i = 2; i <= nx; i++) m_outliers_eff_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_outliers_eff_vs_layer_ecc);
-
-    m_holes_eff_vs_layer_barrel = new TProfile("holes_eff_vs_layer_barrel",
-                                               "holes per possible hit vs. layer in the barrel", 12, -0.5, 11.5, 0.,
-                                               1.);
-    for (int i = 1; i <= 12; i++) m_holes_eff_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_holes_eff_vs_layer_barrel);
-    m_holes_eff_vs_layer_eca = new TProfile("holes_eff_vs_layer_eca", "holes per possible hit vs. layer in the eca", 21,
-                                            -0.5, 20.5, 0., 1.);
-    for (int i = 2; i <= nx; i++) m_holes_eff_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_holes_eff_vs_layer_eca);
-    m_holes_eff_vs_layer_ecc = new TProfile("holes_eff_vs_layer_ecc", "holes per possible hit vs. layer in the ecc", 21,
-                                            -0.5, 20.5, 0., 1.);
-    for (int i = 2; i <= nx; i++) m_holes_eff_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_holes_eff_vs_layer_ecc);
-
-    m_noholes_eff_vs_layer_barrel = new TProfile("noholes_eff_vs_layer_barrel",
-                                                 "noholes per possible hit vs. layer in the barrel", 12, -0.5, 11.5, 0.,
-                                                 1.);
-    for (int i = 1; i <= 11; i++) m_noholes_eff_vs_layer_barrel->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_noholes_eff_vs_layer_barrel);
-    m_noholes_eff_vs_layer_eca = new TProfile("noholes_eff_vs_layer_eca",
-                                              "noholes per possible hit vs. layer in the eca", 21, -0.5, 20.5, 0., 1.);
-    for (int i = 2; i <= nx; i++) m_noholes_eff_vs_layer_eca->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_noholes_eff_vs_layer_eca);
-    m_noholes_eff_vs_layer_ecc = new TProfile("noholes_eff_vs_layer_ecc",
-                                              "noholes per possible hit vs. layer in the ecc", 21, -0.5, 20.5, 0., 1.);
-    for (int i = 2; i <= nx; i++) m_noholes_eff_vs_layer_ecc->GetXaxis()->SetBinLabel(i - 1, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_noholes_eff_vs_layer_ecc);
-
-    m_measurements_eff_vs_Eta_Phi_pix_eca = new TProfile2D("measurements_eff_vs_Eta_Phi_pix_eca",
-                                                           "hit eff. vs. Eta-Phi-ID in Pixel ECA", 3, -0.5, 2.5, 48,
-                                                           -0.5, 47.5, 0., 1.);
-    RegisterHisto(al_mon, m_measurements_eff_vs_Eta_Phi_pix_eca);
-    m_measurements_eff_vs_Eta_Phi_pix_ecc = new TProfile2D("measurements_eff_vs_Eta_Phi_pix_ecc",
-                                                           "hit eff. vs. Eta-Phi-ID in Pixel ECC", 3, -0.5, 2.5, 48,
-                                                           -0.5, 47.5, 0., 1.);
-    RegisterHisto(al_mon, m_measurements_eff_vs_Eta_Phi_pix_ecc);
-    m_measurements_vs_Eta_Phi_pix_eca = new TH2F("measurements_vs_Eta_Phi_pix_eca",
-                                                 "measurements vs. Eta-Phi-ID in Pixel ECA", 3, -0.5, 2.5, 48, -0.5,
-                                                 47.5);
-    RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_pix_eca);
-    m_measurements_vs_Eta_Phi_pix_ecc = new TH2F("measurements_vs_Eta_Phi_pix_ecc",
-                                                 "measurements vs. Eta-Phi-ID in Pixel ECC", 3, -0.5, 2.5, 48, -0.5,
-                                                 47.5);
-    RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_pix_ecc);
-    m_hits_vs_Eta_Phi_pix_eca = new TH2F("hits_vs_Eta_Phi_pix_eca", "hits vs. Eta-Phi-ID in Pixel ECA", 3, -0.5, 2.5,
-                                         48, -0.5, 47.5);
-    RegisterHisto(al_mon, m_hits_vs_Eta_Phi_pix_eca);
-    m_hits_vs_Eta_Phi_pix_ecc = new TH2F("hits_vs_Eta_Phi_pix_ecc", "hits vs. Eta-Phi-ID in Pixel ECC", 3, -0.5, 2.5,
-                                         48, -0.5, 47.5);
-    RegisterHisto(al_mon, m_hits_vs_Eta_Phi_pix_ecc);
-    m_outliers_vs_Eta_Phi_pix_eca = new TH2F("outliers_vs_Eta_Phi_pix_eca", "outliers vs. Eta-Phi-ID in Pixel ECA", 3,
-                                             -0.5, 2.5, 48, -0.5, 47.5);
-    RegisterHisto(al_mon, m_outliers_vs_Eta_Phi_pix_eca);
-    m_outliers_vs_Eta_Phi_pix_ecc = new TH2F("outliers_vs_Eta_Phi_pix_ecc", "outliers vs. Eta-Phi-ID in Pixel ECC", 3,
-                                             -0.5, 2.5, 48, -0.5, 47.5);
-    RegisterHisto(al_mon, m_outliers_vs_Eta_Phi_pix_ecc);
-    m_holes_vs_Eta_Phi_pix_eca = new TH2F("holes_vs_Eta_Phi_pix_eca", "holes vs. Eta-Phi-ID in Pixel ECA", 3, -0.5, 2.5,
-                                          48, -0.5, 47.5);
-    RegisterHisto(al_mon, m_holes_vs_Eta_Phi_pix_eca);
-    m_holes_vs_Eta_Phi_pix_ecc = new TH2F("holes_vs_Eta_Phi_pix_ecc", "holes vs. Eta-Phi-ID in Pixel ECC", 3, -0.5, 2.5,
-                                          48, -0.5, 47.5);
-    RegisterHisto(al_mon, m_holes_vs_Eta_Phi_pix_ecc);
-
-    m_measurements_eff_vs_Eta_Phi_sct_eca = new TProfile2D("measurements_eff_vs_Eta_Phi_sct_eca",
-                                                           "hit eff. vs. Eta-Phi-ID in SCT ECA", 9, -0.5, 8.5, 52, -0.5,
-                                                           51.5, 0., 1.);
-    RegisterHisto(al_mon, m_measurements_eff_vs_Eta_Phi_sct_eca);
-    m_measurements_eff_vs_Eta_Phi_sct_ecc = new TProfile2D("measurements_eff_vs_Eta_Phi_sct_ecc",
-                                                           "hit eff. vs. Eta-Phi-ID in SCT ECC", 9, -0.5, 8.5, 52, -0.5,
-                                                           51.5, 0., 1.);
-    RegisterHisto(al_mon, m_measurements_eff_vs_Eta_Phi_sct_ecc);
-
-
-    m_measurements_vs_Eta_Phi_sct_eca = new TH2F("measurements_vs_Eta_Phi_sct_eca",
-                                                 "measurements vs. Eta-Phi-ID in SCT ECA", 9, -0.5, 8.5, 52, -0.5,
-                                                 51.5);
-    RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_eca);
-    m_measurements_vs_Eta_Phi_sct_ecc = new TH2F("measurements_vs_Eta_Phi_sct_ecc",
-                                                 "measurements vs. Eta-Phi-ID in SCT ECC", 9, -0.5, 8.5, 52, -0.5,
-                                                 51.5);
-    RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_ecc);
-
-    if (m_extendedPlots) {
-      // 3d histograms of measurements in SCT end caps
-      m_measurements_vs_Eta_Phi_sct_eca_3d_s0 = new TH3F("measurements_vs_Eta_Phi_sct_eca_3d_s0", "measurements vs. Eta-Phi-ID in SCT ECA (side 0)"
-                                                         , 9, -0.5, 8.5, 3, -0.5, 2.5, 52, -0.5,
-                                                         51.5);
-      m_measurements_vs_Eta_Phi_sct_eca_3d_s0->SetXTitle("Disk");
-      m_measurements_vs_Eta_Phi_sct_eca_3d_s0->SetYTitle("#eta ring");
-      m_measurements_vs_Eta_Phi_sct_eca_3d_s0->SetZTitle("#phi sector");
-      RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_eca_3d_s0);
-
-      m_measurements_vs_Eta_Phi_sct_eca_3d_s1 = new TH3F("measurements_vs_Eta_Phi_sct_eca_3d_s1", "measurements vs. Eta-Phi-ID in SCT ECA (side 1)"
-                                                         , 9, -0.5, 8.5, 3, -0.5, 2.5, 52, -0.5,
-                                                         51.5);
-      m_measurements_vs_Eta_Phi_sct_eca_3d_s1->SetXTitle("Disk");
-      m_measurements_vs_Eta_Phi_sct_eca_3d_s1->SetYTitle("#eta ring");
-      m_measurements_vs_Eta_Phi_sct_eca_3d_s1->SetZTitle("#phi sector");
-      RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_eca_3d_s1);
-
-      m_measurements_vs_Eta_Phi_sct_ecc_3d_s0 = new TH3F("measurements_vs_Eta_Phi_sct_ecc_3d_s0", "measurements vs. Eta-Phi-ID in SCT ECC (side 0)"
-                                                         , 9, -0.5, 8.5, 3, -0.5, 2.5, 52, -0.5,
-                                                         51.5);
-      m_measurements_vs_Eta_Phi_sct_ecc_3d_s0->SetXTitle("Disk");
-      m_measurements_vs_Eta_Phi_sct_ecc_3d_s0->SetYTitle("#eta ring");
-      m_measurements_vs_Eta_Phi_sct_ecc_3d_s0->SetZTitle("#phi sector");
-      RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_ecc_3d_s0);
-
-      m_measurements_vs_Eta_Phi_sct_ecc_3d_s1 = new TH3F("measurements_vs_Eta_Phi_sct_ecc_3d_s1", "measurements vs. Eta-Phi-ID in SCT ECC (side 1)"
-                                                         , 9, -0.5, 8.5, 3, -0.5, 2.5, 52, -0.5,
-                                                         51.5);
-      m_measurements_vs_Eta_Phi_sct_ecc_3d_s1->SetXTitle("Disk");
-      m_measurements_vs_Eta_Phi_sct_ecc_3d_s1->SetYTitle("#eta ring");
-      m_measurements_vs_Eta_Phi_sct_ecc_3d_s1->SetZTitle("#phi sector");
-      RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_ecc_3d_s1);
-    }
-
-    m_hits_vs_Eta_Phi_sct_eca = new TH2F("hits_vs_Eta_Phi_sct_eca", "hits vs. Eta-Phi-ID in SCT ECA", 9, -0.5, 8.5, 52,
-                                         -0.5, 51.5);
-    RegisterHisto(al_mon, m_hits_vs_Eta_Phi_sct_eca);
-    m_hits_vs_Eta_Phi_sct_ecc = new TH2F("hits_vs_Eta_Phi_sct_ecc", "hits vs. Eta-Phi-ID in SCT ECC", 9, -0.5, 8.5, 52,
-                                         -0.5, 51.5);
-    RegisterHisto(al_mon, m_hits_vs_Eta_Phi_sct_ecc);
-    m_outliers_vs_Eta_Phi_sct_eca = new TH2F("outliers_vs_Eta_Phi_sct_eca", "outliers vs. Eta-Phi-ID in SCT ECA", 9,
-                                             -0.5, 8.5, 52, -0.5, 51.5);
-    RegisterHisto(al_mon, m_outliers_vs_Eta_Phi_sct_eca);
-    m_outliers_vs_Eta_Phi_sct_ecc = new TH2F("outliers_vs_Eta_Phi_sct_ecc", "outliers vs. Eta-Phi-ID in SCT ECC", 9,
-                                             -0.5, 8.5, 52, -0.5, 51.5);
-    RegisterHisto(al_mon, m_outliers_vs_Eta_Phi_sct_ecc);
-    m_holes_vs_Eta_Phi_sct_eca = new TH2F("holes_vs_Eta_Phi_sct_eca", "holes vs. Eta-Phi-ID in SCT ECA", 9, -0.5, 8.5,
-                                          52, -0.5, 51.5);
-    RegisterHisto(al_mon, m_holes_vs_Eta_Phi_sct_eca);
-    m_holes_vs_Eta_Phi_sct_ecc = new TH2F("holes_vs_Eta_Phi_sct_ecc", "holes vs. Eta-Phi-ID in SCT ECC", 9, -0.5, 8.5,
-                                          52, -0.5, 51.5);
-    RegisterHisto(al_mon, m_holes_vs_Eta_Phi_sct_ecc);
-
-    /**=============================================
-       //  TRT histograms
-       //============================================= */
-    makePIXBarrelHistograms(al_mon);
-    makePIXEndCapsHistograms(al_mon);
-    makeSCTBarrelHistograms(al_mon);
-    makeSCTEndCapsHistograms(al_mon);
-    makeTRTHistograms(al_mon, al_mon_ls);
-
-    m_histosBooked++;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-/** Convert from an int to a string */
-std::string IDAlignMonEfficiencies::intToString(int input) {
-  return std::to_string(input);
-}
-
-/** Make Histograms */
-TH1F_LW* IDAlignMonEfficiencies::MakeHist(const std::string& name, const std::string& title, int nBins, float xLow,
-                                          float xUp, const std::string& xAxisTitle, const std::string& yAxisTitle) {
-  TH1F_LW* hist = TH1F_LW::create(name.c_str(), title.c_str(), nBins, xLow, xUp);
-
-  hist->SetMinimum(0);
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->GetXaxis()->SetTitle(xAxisTitle.c_str());
-  hist->GetYaxis()->SetTitle(yAxisTitle.c_str());
-  return hist;
-}
-
-/** Make Profiles */
-TProfile* IDAlignMonEfficiencies::MakeProfile(const std::string& name, const std::string& title, int nBins, float xLow,
-                                              float xUp, float yLow, float yUp, const std::string& xAxisTitle,
-                                              const std::string& yAxisTitle, bool setMinZero) {
-  TProfile* profile = new TProfile(name.c_str(), title.c_str(), nBins, xLow, xUp, yLow, yUp);
-
-  if (setMinZero) profile->SetMinimum(0);
-  profile->GetXaxis()->SetLabelSize(0.03);
-  profile->GetYaxis()->SetLabelSize(0.03);
-  profile->GetXaxis()->SetTitle(xAxisTitle.c_str());
-  profile->GetYaxis()->SetTitle(yAxisTitle.c_str());
-
-  return profile;
-}
-
-void IDAlignMonEfficiencies::RegisterHisto(MonGroup& mon, TH1* histo) {
-  histo->Sumw2();
-  StatusCode sc = mon.regHist(histo);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
-  }
-  histo->GetYaxis()->SetTitle("Number of Hits on Tracks");
-  const char* HistName = histo->GetName();
-  if (strncmp(HistName, "outlier", 7) == 0) histo->GetYaxis()->SetTitle("Number of Outlier");
-  if (strncmp(HistName, "hole", 4) == 0) histo->GetYaxis()->SetTitle("Number of Holes");
-  if (strncmp(HistName, "hit", 3) == 0) histo->GetYaxis()->SetTitle("Number of Possible Hits on Tracks");
-
-  const char* pch;
-  pch = strstr(HistName, "Phi");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Module Phi Identifier");
-  pch = strstr(HistName, "Eta");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Module Eta Identifier");
-  pch = strstr(HistName, "pT");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Signed Track pT [GeV]");
-}
-
-void IDAlignMonEfficiencies::RegisterHisto(MonGroup& mon, TH1F_LW* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
-  }
-  histo->GetYaxis()->SetTitle("Number of Hits on Tracks");
-  const char* HistName = histo->GetName();
-  if (strncmp(HistName, "outlier", 7) == 0) histo->GetYaxis()->SetTitle("Number of Outlier");
-  if (strncmp(HistName, "hole", 4) == 0) histo->GetYaxis()->SetTitle("Number of Holes");
-  if (strncmp(HistName, "hit", 3) == 0) histo->GetYaxis()->SetTitle("Number of Possible Hits on Tracks");
-
-  const char* pch;
-  pch = strstr(HistName, "Phi");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Module Phi Identifier");
-  pch = strstr(HistName, "Eta");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Module Eta Identifier");
-  pch = strstr(HistName, "pT");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Signed Track pT [GeV]");
-}
-
-void IDAlignMonEfficiencies::RegisterHisto(MonGroup& mon, TProfile* histo, const std::string& yAxisName) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile Histogram:" << endmsg;
-  }
-
-  if (!yAxisName.empty()) {
-    histo->GetYaxis()->SetTitle(yAxisName.c_str());
-  } else {
-    histo->GetYaxis()->SetTitle("Hit Efficiency");
-  }
-
-  const char* HistName = histo->GetName();
-  if (strncmp(HistName, "outlier", 7) == 0) histo->GetYaxis()->SetTitle("Outlier Fraction");
-  if (strncmp(HistName, "hole", 4) == 0) histo->GetYaxis()->SetTitle("Hole Fraction");
-
-  const char* pch;
-  pch = strstr(HistName, "Phi");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Module Phi Identifier");
-  pch = strstr(HistName, "Eta");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Module Eta Identifier");
-  pch = strstr(HistName, "pT");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Signed Track pT [GeV]");
-}
-
-void IDAlignMonEfficiencies::RegisterHisto(MonGroup& mon, TH2* histo) {
-  histo->Sumw2();
-  StatusCode sc = mon.regHist(histo);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH2 Histogram:" << endmsg;
-  }
-  histo->GetXaxis()->SetTitle("Module Eta Identifier");
-  histo->GetYaxis()->SetTitle("Module Phi Identifier");
-}
-
-void IDAlignMonEfficiencies::RegisterHisto(MonGroup& mon, TProfile2D* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile2D Histogram:" << endmsg;
-  }
-  histo->GetXaxis()->SetTitle("Module Eta Identifier");
-  histo->GetYaxis()->SetTitle("Module Phi Identifier");
-
-  const char* HistName = histo->GetName();
-  const char* pch;
-  pch = strstr(HistName, "pix_eca");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Pixel ECA Disk");
-  pch = strstr(HistName, "pix_ecc");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("Pixel ECC Disk");
-  pch = strstr(HistName, "sct_eca");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("SCT ECA Disk");
-  pch = strstr(HistName, "sct_ecc");
-  if (pch != nullptr) histo->GetXaxis()->SetTitle("SCT ECC Disk");
-}
-
-///////////////////////////////////////////////////
-StatusCode IDAlignMonEfficiencies::fillHistograms() {
-  m_events++;
-  ATH_MSG_DEBUG(
-    "IDAlignMonEfficiencies::fillHistograms ** START ** call for m_events " << m_events << " for track collection: " <<
-  m_tracksName.key());
-
-  SG::ReadHandle<xAOD::EventInfo> eventInfo {
-    m_eventInfoKey
-  };
-  if (not eventInfo.isValid()) {
-    msg(MSG::ERROR) << "Cannot get event info." << endmsg;
-    return StatusCode::FAILURE;
-  }
-  unsigned int LumiBlock = eventInfo->lumiBlock();
-  ATH_MSG_DEBUG("IDAlignMonResiduals::fillHistograms ** Run: " << eventInfo->runNumber()
-                                                               << "   Event: " << eventInfo->eventNumber()
-                                                               << "   LumiBlock: " << LumiBlock);
-
-  // get TrackCollection
-  SG::ReadHandle<TrackCollection> tracks {
-    m_tracksName
-  };
-  if (not tracks.isValid()) {
-    ATH_MSG_WARNING(m_tracksName.key() << " could not be retrieved");
-    ATH_MSG_DEBUG(
-      "IDAlignMonEfficiencies::fillHistograms ** COMPLETED ** for m_events " << m_events << " -- NO track collection: " << m_tracksName.key() <<
-    " -- ");
-    return StatusCode::RECOVERABLE;
-  }
-
-  const DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(tracks);
-  DataVector<Trk::Track>::const_iterator trksItr = trks->begin();
-  DataVector<Trk::Track>::const_iterator trksItrE = trks->end();
-
-  int nTrackCount = 0;
-  ATH_MSG_DEBUG("** IDAlignMonEfficiencies::fillHistograms ** starting loop over tracks. Ntrks: " << tracks->size());
-  for (; trksItr != trksItrE; ++trksItr) {
-    nTrackCount++;
-    ATH_MSG_DEBUG("  dealing with track #" << nTrackCount << " / " << tracks->size());
-    float qOverP = -999;
-    float trkpt = -999;
-    float charge = 0;
-    float abs_trkpt = -999;     //charge*trkpt
-
-    const Trk::Perigee* measPer = (*trksItr)->perigeeParameters();
-    const AmgSymMatrix(5) * covariance = measPer ? measPer->covariance() : nullptr;
-
-    if (measPer && covariance) {
-      AmgVector(5) perigeeParams = measPer->parameters();
-
-      qOverP = perigeeParams(Trk::qOverP) * 1000.;
-      trkpt = measPer->pT() / 1000.;
-      if (qOverP < 0) charge = -1;
-      else charge = +1;
-      abs_trkpt = charge * trkpt;
-    } else {
-      ATH_MSG_WARNING("No measured perigee parameters assigned to the track " << nTrackCount);
-    }
-
-    // loop over all hits on track
-    const Trk::TrackStates* TSOS;
-    TSOS = (*trksItr)->trackStateOnSurfaces();
-    Trk::TrackStates::const_iterator TSOSItr = TSOS->begin();
-    Trk::TrackStates::const_iterator TSOSItrE = TSOS->end();
-
-    ATH_MSG_VERBOSE(
-      "Track #" << nTrackCount << "/" << tracks->size() << " has " << TSOS->size() << " TSOS. Starting loop over TSOS");
-
-    for (; TSOSItr != TSOSItrE; ++TSOSItr) {
-      //check that we have track parameters defined for the surface (pointer is not null)
-      if (!((*TSOSItr)->trackParameters())) {
-        ATH_MSG_DEBUG("hit skipped because no associated track parameters");
-        continue;
-      }
-
-      Identifier surfaceID;
-      const Trk::MeasurementBase* mesb = (*TSOSItr)->measurementOnTrack();
-
-      // hits, outliers
-      if (mesb != nullptr &&
-      mesb->associatedSurface().associatedDetectorElement() !=
-      nullptr) surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify();
-
-      // holes, perigee
-      else surfaceID = (*TSOSItr)->trackParameters()->associatedSurface().associatedDetectorElementIdentifier();
-
-      bool isPseudoMeasurement = dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(mesb);
-      const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*>(mesb);
-      if (!rio) isPseudoMeasurement = true;
-
-      if (isPseudoMeasurement) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "found a pseudomeasurement skipping it!" << endmsg;
-        continue;
-      }
-
-      int detType = 99;
-      int barrelEC = 99;
-      int layerDisk = 99;
-      int sctSide = 99;
-      int modEta = 9999;
-      int modPhi = 9999;
-      if (m_idHelper->is_trt(surfaceID)) detType = 2;
-      else if (m_idHelper->is_sct(surfaceID)) detType = 1;
-      else if (m_idHelper->is_pixel(surfaceID)) detType = 0;
-
-
-      //hit quality cuts for Si hits if tool is configured - default is NO CUTS
-      if (detType == 0 || detType == 1) {
-        if (detType == 0) {//pixel
-          barrelEC = m_pixelID->barrel_ec(surfaceID);
-          layerDisk = m_pixelID->layer_disk(surfaceID);
-          modEta = m_pixelID->eta_module(surfaceID);
-          modPhi = m_pixelID->phi_module(surfaceID);
-        } else {        //sct. Since detType == 0 or detType == 1 here
-          barrelEC = m_sctID->barrel_ec(surfaceID);
-          layerDisk = m_sctID->layer_disk(surfaceID);
-          modEta = m_sctID->eta_module(surfaceID);
-          modPhi = m_sctID->phi_module(surfaceID);
-          sctSide = m_sctID->side(surfaceID);
-        }
-
-        if (m_doHitQuality) {
-          ATH_MSG_DEBUG("applying hit quality cuts to Silicon hit...");
-
-          const Trk::RIO_OnTrack* hit = m_hitQualityTool->getGoodHit(*TSOSItr);
-          if (hit == nullptr) {
-            ATH_MSG_DEBUG(" -- hit failed quality cuts and is rejected.");
-            continue;
-          } else {
-            ATH_MSG_DEBUG(" -- hit passed quality cuts");
-          }
-        } else {
-          ATH_MSG_DEBUG("hit quality cuts NOT APPLIED to Silicon hit.");
-        }
-      }
-
-      /** Get information for the TRT hits */
-      int barrel_ec = 99;
-      int layer_or_wheel = 99;
-      int straw_layer = 99;
-      int phi_module = 99;
-      bool isTubeHit = false;
-      if (detType == 2) {
-        barrel_ec = m_trtID->barrel_ec(surfaceID);
-        layer_or_wheel = m_trtID->layer_or_wheel(surfaceID);
-        straw_layer = m_trtID->straw_layer(surfaceID);
-        phi_module = m_trtID->phi_module(surfaceID);
-        if ((mesb->localCovariance()(Trk::locX, Trk::locX) > 1.0)) isTubeHit = true;
-      }
-
-      // fill histograms with all posible hit types: measurements, outliers & holes
-      if ((*TSOSItr)->type(Trk::TrackStateOnSurface::Measurement) ||
-      (*TSOSItr)->type(Trk::TrackStateOnSurface::Outlier) || (*TSOSItr)->type(Trk::TrackStateOnSurface::Hole)) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "have a measurement/outlier/hole" << endmsg;
-
-        // all possible hits
-        // dealing with PIXEL tsos
-        if (detType == 0) {
-          // barrel
-          if (barrelEC == 0) {
-            m_hits_vs_layer_barrel->Fill(layerDisk);
-            m_hits_vs_Eta_Phi_pix_b[layerDisk]->Fill(modEta, modPhi);
-            m_hits_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-            m_hits_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-            m_hits_vs_LB_pix_b[layerDisk]->Fill(float(LumiBlock));
-            m_hits_vs_pT_pix_b[layerDisk]->Fill(abs_trkpt);
-          } //barrel
-          else if (barrelEC == 2) {
-            m_hits_vs_layer_eca->Fill(layerDisk);
-            m_hits_vs_Phi_pix_eca[layerDisk]->Fill(modPhi);
-            m_hits_vs_LB_pix_eca[layerDisk]->Fill(float(LumiBlock));
-            m_hits_vs_Eta_Phi_pix_eca->Fill(layerDisk, modPhi);
-          } else if (barrelEC == -2) {
-            m_hits_vs_layer_ecc->Fill(layerDisk);
-            m_hits_vs_Phi_pix_ecc[layerDisk]->Fill(modPhi);
-            m_hits_vs_LB_pix_ecc[layerDisk]->Fill(float(LumiBlock));
-            m_hits_vs_Eta_Phi_pix_ecc->Fill(layerDisk, modPhi);
-          }
-        } // end of pix
-          // Let's treat SCT tsos
-        else if (detType == 1) {
-          if (barrelEC == 0) {
-            m_hits_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-            m_hits_vs_Eta_Phi_sct_b[layerDisk]->Fill(modEta, modPhi);
-            if (sctSide == 0) m_hits_vs_Eta_Phi_sct_s0_b[layerDisk]->Fill(modEta, modPhi);
-            if (sctSide == 1) m_hits_vs_Eta_Phi_sct_s1_b[layerDisk]->Fill(modEta, modPhi);
-            m_hits_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-            m_hits_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-            m_hits_vs_LB_sct_b[layerDisk]->Fill(float(LumiBlock));
-
-            m_hits_vs_pT_sct_b[layerDisk]->Fill(abs_trkpt);
-          }//barrel
-          else if (barrelEC == 2) {
-            m_hits_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-            m_hits_vs_Phi_sct_eca[layerDisk]->Fill(modPhi);
-            m_hits_vs_LB_sct_eca->Fill(float(LumiBlock));
-            m_hits_vs_Eta_Phi_sct_eca->Fill(layerDisk, modPhi);
-          } else if (barrelEC == -2) {
-            m_hits_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-            m_hits_vs_Phi_sct_ecc[layerDisk]->Fill(modPhi);
-
-            m_hits_vs_Eta_Phi_sct_ecc->Fill(layerDisk, modPhi);
-            m_hits_vs_LB_sct_ecc->Fill(float(LumiBlock));
-          }
-        }// end of sct
-        else if (detType == 2) {
-          fillTRTTotalMeasurements(barrel_ec, layer_or_wheel, phi_module, straw_layer);
-        }
-      } // end of all type of hits
-
-      // now, let's fill histograms only for hits on track = measurements
-      if ((*TSOSItr)->type(Trk::TrackStateOnSurface::Measurement)) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "starting to find overlaps" << endmsg;
-
-        bool foundXOverlap = false;
-        bool foundYOverlap = false;
-        //look for overlap hits if hit is pixel or SCT
-        //overlaps are defined such that the overlapping module has to be at a greater radius - avoids double counting
-        //for SCT module overlaps there will be two overlaps corresponding to the two different sides
-        //this shouldn't effect the overlap efficiency since an SCT module has two hits, one for each side
-        if (detType == 0 || detType == 1) {
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit is pixel or SCT - looking for overlaps" << endmsg;
-          //const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(mesb);
-          //std::pair<const Trk::TrackStateOnSurface*,const Trk::TrackStateOnSurface*> overlap =
-          // findOverlapHit(*trksItr,hitOnTrack);
-          std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> overlap = findOverlapHit(*trksItr,
-                                                                                                               mesb);
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap search complete" << endmsg;
-          //these will be NULL if no overlap is found
-          if (overlap.first) foundXOverlap = true;
-          if (overlap.second) foundYOverlap = true;
-        }
-
-
-        // measurements per possible hit
-        // --- pixel
-        if (detType == 0) {
-          if (barrelEC == 0) {
-            m_measurements_vs_layer_barrel->Fill(layerDisk);
-            m_noholes_vs_layer_barrel->Fill(layerDisk);
-
-
-
-
-            //msg(MSG::WARNING) <<"Pix barrel, layer_disk=" << m_pixelID->layer_disk(surfaceID) << ", eta=" <<
-            // m_pixelID->eta_module(surfaceID) << ", phi=" << m_pixelID->phi_module(surfaceID) <<endmsg;
-
-            if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "found pixel barrel hit" << endmsg;
-            m_measurements_vs_Eta_Phi_pix_b[layerDisk]->Fill(modEta, modPhi);
-            m_measurements_vs_LB_pix_b[layerDisk]->Fill(float(LumiBlock));
-            m_measurements_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-            m_measurements_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-            m_measurements_vs_pT_pix_b[layerDisk]->Fill(abs_trkpt);
-
-            if (m_extendedPlots) {
-              if (foundXOverlap) {
-                m_overlapX_vs_layer_barrel->Fill(layerDisk);
-                m_overlapX_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-                m_overlapX_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-              }
-              if (foundYOverlap) {
-                m_overlapY_vs_layer_barrel->Fill(layerDisk);
-                m_overlapY_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-                m_overlapY_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-              }
-            }
-          } // end of PIX barrel
-          else if (barrelEC == 2) {
-            if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "found pixel eca hit" << endmsg;
-            m_measurements_vs_layer_eca->Fill(layerDisk);
-            m_noholes_vs_layer_eca->Fill(layerDisk);
-            m_measurements_vs_Phi_pix_eca[layerDisk]->Fill(modPhi);
-            m_measurements_vs_LB_pix_eca[layerDisk]->Fill(float(LumiBlock));
-            if (m_extendedPlots) {
-              if (foundXOverlap) {
-                m_overlapX_vs_layer_eca->Fill(layerDisk);
-                m_overlapX_vs_Phi_pix_eca[layerDisk]->Fill(modPhi);
-              }
-              if (foundYOverlap) {
-                m_overlapY_vs_layer_eca->Fill(layerDisk);
-                m_overlapY_vs_Phi_pix_eca[layerDisk]->Fill(modPhi);
-              }
-            }
-
-            m_measurements_vs_Eta_Phi_pix_eca->Fill(layerDisk, modPhi);
-          } // ECA
-          else if (barrelEC == -2) {
-            if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "found pixel ecc hit" << endmsg;
-            m_measurements_vs_layer_ecc->Fill(layerDisk);
-            m_noholes_vs_layer_ecc->Fill(layerDisk);
-            m_measurements_vs_Phi_pix_ecc[layerDisk]->Fill(modPhi);
-            m_measurements_vs_LB_pix_ecc[layerDisk]->Fill(float(LumiBlock));
-            if (m_extendedPlots) {
-              if (foundXOverlap) {
-                m_overlapX_vs_Phi_pix_ecc[layerDisk]->Fill(modPhi);
-                m_overlapX_vs_layer_ecc->Fill(layerDisk);
-              }
-              if (foundYOverlap) {
-                m_overlapY_vs_layer_ecc->Fill(layerDisk);
-                m_overlapY_vs_Phi_pix_ecc[layerDisk]->Fill(modPhi);
-              }
-            }
-            m_measurements_vs_Eta_Phi_pix_ecc->Fill(layerDisk, modPhi);
-          } //ECC
-        }// End of PIXELS
-         // --- SCT ---- now dealing with SCT
-        else if (detType == 1) {
-          if (barrelEC == 0) {
-            //msg(MSG::WARNING) <<"SCT barrel, layer_disk=" << m_sctID->layer_disk(surfaceID) << ", eta=" <<
-            // m_sctID->eta_module(surfaceID) << ", phi=" << m_sctID->phi_module(surfaceID) << ", side=" <<
-            // m_sctID->side(surfaceID) <<endmsg;
-            if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "found sct barrel hit" << endmsg;
-            m_measurements_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-            m_noholes_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-            m_measurements_vs_Eta_Phi_sct_b[layerDisk]->Fill(modEta, modPhi);
-
-            if (sctSide == 0) m_measurements_vs_Eta_Phi_sct_s0_b[layerDisk]->Fill(modEta, modPhi);
-            if (sctSide == 1) m_measurements_vs_Eta_Phi_sct_s1_b[layerDisk]->Fill(modEta, modPhi);
-            m_measurements_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-            m_measurements_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-            m_measurements_vs_LB_sct_b[layerDisk]->Fill(float(LumiBlock));
-            m_measurements_vs_pT_sct_b[layerDisk]->Fill(abs_trkpt);
-            if (m_extendedPlots) {
-              if (foundXOverlap) {
-                m_overlapX_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-                if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "found sct barrel hit 1" << endmsg;
-                m_overlapX_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-                m_overlapX_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-              }
-              if (foundYOverlap) {
-                m_overlapY_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-                if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "found sct barrel hit 2" << endmsg;
-                m_overlapY_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-                m_overlapY_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-              }
-            }
-          }//barrel
-          else if (barrelEC == 2) {
-            if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "found sct eca hit" << endmsg;
-            m_measurements_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-            m_noholes_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-            m_measurements_vs_Phi_sct_eca[layerDisk]->Fill(modPhi);
-            m_measurements_vs_LB_sct_eca->Fill(float(LumiBlock));
-            m_measurements_vs_Eta_Phi_sct_eca->Fill(layerDisk, modPhi);
-            if (m_extendedPlots) {
-              if (foundXOverlap) {
-                m_overlapX_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-                m_overlapX_vs_Phi_sct_eca[layerDisk]->Fill(modPhi);
-              }
-              if (foundYOverlap) {
-                m_overlapY_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-                m_overlapY_vs_Phi_sct_eca[layerDisk]->Fill(modPhi);
-              }
-              if (sctSide == 0) m_measurements_vs_Eta_Phi_sct_eca_3d_s0->Fill(layerDisk, modEta, modPhi);
-              if (sctSide == 1) m_measurements_vs_Eta_Phi_sct_eca_3d_s1->Fill(layerDisk, modEta, modPhi);
-            }
-          }//ECA
-          else if (barrelEC == -2) {
-            if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "found sct ecc hit" << endmsg;
-            m_measurements_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-            m_noholes_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-            m_measurements_vs_Phi_sct_ecc[layerDisk]->Fill(modPhi);
-            m_measurements_vs_LB_sct_ecc->Fill(float(LumiBlock));
-            m_measurements_vs_Eta_Phi_sct_ecc->Fill(layerDisk, modPhi);
-            if (m_extendedPlots) {
-              if (foundXOverlap) {
-                m_overlapX_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-                m_overlapX_vs_Phi_sct_ecc[layerDisk]->Fill(modPhi);
-              }
-              if (foundYOverlap) {
-                m_overlapY_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-                m_overlapY_vs_Phi_sct_ecc[layerDisk]->Fill(modPhi);
-              }
-              if (sctSide == 0) m_measurements_vs_Eta_Phi_sct_ecc_3d_s0->Fill(layerDisk, modEta, modPhi);
-              if (sctSide == 1) m_measurements_vs_Eta_Phi_sct_ecc_3d_s1->Fill(layerDisk, modEta, modPhi);
-            }
-          }//ECC
-        }//SCT
-
-        if (detType == 2) {
-          fillTRTHits(barrel_ec, layer_or_wheel, phi_module, straw_layer, isTubeHit);
-        }
-      } // end of measurements (hits on track)
-
-      // Now filling outliers histograms
-      if ((*TSOSItr)->type(Trk::TrackStateOnSurface::Outlier)) {
-        // outlier per layer and per hit
-        // --- pixel
-        if (detType == 0) {
-          if (barrelEC == 0) {
-            m_outliers_vs_layer_barrel->Fill(layerDisk);
-            m_noholes_vs_layer_barrel->Fill(layerDisk);
-            m_outliers_vs_Eta_Phi_pix_b[layerDisk]->Fill(modEta, modPhi);
-            m_outliers_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-            m_outliers_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-            m_outliers_vs_LB_pix_b[layerDisk]->Fill(float(LumiBlock));
-            m_outliers_vs_pT_pix_b[layerDisk]->Fill(abs_trkpt);
-          }//barrel
-          else if (barrelEC == 2) {
-            m_outliers_vs_layer_eca->Fill(layerDisk);
-            m_noholes_vs_layer_eca->Fill(layerDisk);
-            m_outliers_vs_LB_pix_eca[layerDisk]->Fill(float(LumiBlock));
-            m_outliers_vs_Eta_Phi_pix_eca->Fill(layerDisk, modPhi);
-          }//ECA
-           // ECC
-          else if (barrelEC == -2) {
-            m_outliers_vs_layer_ecc->Fill(layerDisk);
-            m_outliers_vs_LB_pix_ecc[layerDisk]->Fill(float(LumiBlock));
-            m_noholes_vs_layer_ecc->Fill(layerDisk);
-            m_outliers_vs_Eta_Phi_pix_ecc->Fill(layerDisk, modPhi);
-          }//ecc
-        }//pixels
-         // --- sct -- outliers in SCT
-        else if (detType == 1) {
-          if (barrelEC == 0) {
-            m_outliers_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-            m_noholes_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-            m_outliers_vs_Eta_Phi_sct_b[layerDisk]->Fill(modEta, modPhi);
-            m_outliers_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-            m_outliers_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-            m_outliers_vs_pT_sct_b[layerDisk]->Fill(abs_trkpt);
-          }//barrel
-          else if (barrelEC == 2) {
-            m_outliers_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-            m_noholes_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-            m_outliers_vs_Eta_Phi_sct_eca->Fill(layerDisk, modPhi);
-          } else if (barrelEC == -2) {
-            m_outliers_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-            m_noholes_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-            m_outliers_vs_Eta_Phi_sct_ecc->Fill(layerDisk, modPhi);
-          }
-        } // SCT
-
-        // TRT hits
-        if (detType == 2) {
-          fillTRTOutliers(barrel_ec, layer_or_wheel, phi_module, straw_layer);
-        }
-      } // end of outliers
-    } // TSOS on track
-    ATH_MSG_DEBUG(" End of loop on TSOS of track " << nTrackCount << "  Now searching for holes ");
-
-    if (m_holeSearchTool != 0) {
-      std::unique_ptr<const Trk::TrackStates> HTSOS (m_holeSearchTool->getHolesOnTrack(**trksItr));
-      ATH_MSG_DEBUG(" -- Hole TSOS collection has size " << HTSOS->size());
-      Trk::TrackStates::const_iterator HTSOSItr = HTSOS->begin();
-      Trk::TrackStates::const_iterator HTSOSItrE = HTSOS->end();
-
-      int holeCount = 0;
-      for (; HTSOSItr != HTSOSItrE; ++HTSOSItr) { // Loop on Holes on Track (HTSOS)
-        holeCount++;
-        ATH_MSG_VERBOSE(" -- Hole number " << holeCount);
-
-        Identifier surfaceID;
-        const Trk::MeasurementBase* mesb = (*HTSOSItr)->measurementOnTrack();
-        // hits, outliers
-        if (mesb != nullptr && mesb->associatedSurface().associatedDetectorElement() != nullptr) surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify();
-        // holes, perigee
-        else surfaceID = (*HTSOSItr)->trackParameters()->associatedSurface().associatedDetectorElementIdentifier();
-
-        int detType = 99;
-        int barrelEC = 99;
-        int layerDisk = 99;
-        int sctSide = 99;
-        int modEta = 9999;
-        int modPhi = 9999;
-        if (m_idHelper->is_trt(surfaceID)) detType = 2;
-        else if (m_idHelper->is_sct(surfaceID)) detType = 1;
-        else if (m_idHelper->is_pixel(surfaceID)) detType = 0;
-        //hit quality cuts for Si hits if tool is configured - default is NO CUTS
-        if (detType == 0 || detType == 1) {
-          if (detType == 0) {//pixel
-            barrelEC = m_pixelID->barrel_ec(surfaceID);
-            layerDisk = m_pixelID->layer_disk(surfaceID);
-            modEta = m_pixelID->eta_module(surfaceID);
-            modPhi = m_pixelID->phi_module(surfaceID);
-          } else {        //sct. Since detType == 0 or detType == 1 here
-            barrelEC = m_sctID->barrel_ec(surfaceID);
-            layerDisk = m_sctID->layer_disk(surfaceID);
-            modEta = m_sctID->eta_module(surfaceID);
-            modPhi = m_sctID->phi_module(surfaceID);
-            sctSide = m_sctID->side(surfaceID);
-          }
-          if (m_doHitQuality) {
-            ATH_MSG_DEBUG("applying hole quality cuts to Silicon hole...");
-
-            if (!m_hitQualityTool->getGoodHole(*HTSOSItr)) {
-              ATH_MSG_DEBUG("hole failed quality cuts and is rejected.");
-              continue;
-            } else {
-              ATH_MSG_DEBUG("hole passed quality cuts");
-            }
-          } else {
-            ATH_MSG_DEBUG("hole quality cuts NOT APPLIED to Silicon hole.");
-          }
-        }
-
-        if ((*HTSOSItr)->type(Trk::TrackStateOnSurface::Measurement) || (*HTSOSItr)->type(Trk::TrackStateOnSurface::Outlier) || (*HTSOSItr)->type(Trk::TrackStateOnSurface::Hole)) {
-          // all possible type of holes
-          // --- pixel
-          if (detType == 0) {
-            if (barrelEC == 0) {
-              // msg(MSG::WARNING) << " ** HOLE FOUND ** Pixel barrel ** layer_disk=" <<
-              // m_pixelID->layer_disk(surfaceID) << ", eta=" << m_pixelID->eta_module(surfaceID) << ", phi=" <<
-              // m_pixelID->phi_module(surfaceID) << endmsg;
-
-
-              bool knownType = false;
-              if ((*HTSOSItr)->type(Trk::TrackStateOnSurface::Measurement)) {
-                knownType = true;
-              }
-              if ((*HTSOSItr)->type(Trk::TrackStateOnSurface::Outlier)) {
-                knownType = true;
-              }
-              if ((*HTSOSItr)->type(Trk::TrackStateOnSurface::Hole)) {
-                knownType = true;
-              }
-              if (!knownType) ATH_MSG_DEBUG("IDAlignment Monitoring HitEfficiencies Type: -- UNKNOWN -- ");
-
-
-              m_hits_vs_layer_barrel->Fill(layerDisk);
-              m_hits_vs_Eta_Phi_pix_b[layerDisk]->Fill(modEta, modPhi);
-              m_hits_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-              m_hits_vs_LB_pix_b[layerDisk]->Fill(float(LumiBlock));
-              m_hits_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-              m_hits_vs_pT_pix_b[layerDisk]->Fill(abs_trkpt);
-            }//barrel
-             // ----------- eca
-            else if (barrelEC == 2) {
-              m_hits_vs_layer_eca->Fill(layerDisk);
-              m_hits_vs_Phi_pix_eca[layerDisk]->Fill(modPhi);
-              m_hits_vs_Eta_Phi_pix_eca->Fill(layerDisk, modPhi);
-              m_hits_vs_LB_pix_eca[layerDisk]->Fill(float(LumiBlock));
-            } // eca
-              // ----------- ecc
-            else if (barrelEC == -2) {
-              m_hits_vs_layer_ecc->Fill(layerDisk);
-              m_hits_vs_Phi_pix_ecc[layerDisk]->Fill(modPhi);
-              m_hits_vs_LB_pix_ecc[layerDisk]->Fill(float(LumiBlock));
-              m_hits_vs_Eta_Phi_pix_ecc->Fill(layerDisk, modPhi);
-            } // ecc
-          } // pixels
-            // --- sct
-          else if (detType == 1) {
-            if (barrelEC == 0) {
-              m_hits_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-
-              m_hits_vs_Eta_Phi_sct_b[layerDisk]->Fill(modEta, modPhi);
-              if (sctSide == 0) m_hits_vs_Eta_Phi_sct_s0_b[layerDisk]->Fill(modEta, modPhi);
-              if (sctSide == 1) m_hits_vs_Eta_Phi_sct_s1_b[layerDisk]->Fill(modEta, modPhi);
-              m_hits_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-              m_hits_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-              m_hits_vs_pT_sct_b[layerDisk]->Fill(abs_trkpt);
-              m_hits_vs_LB_sct_b[layerDisk]->Fill(float(LumiBlock));
-            } else if (barrelEC == 2) {
-              m_hits_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-              m_hits_vs_Phi_sct_eca[layerDisk]->Fill(modPhi);
-
-              m_hits_vs_Eta_Phi_sct_eca->Fill(layerDisk, modPhi);
-            } else if (barrelEC == -2) {
-              m_hits_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-              m_hits_vs_Phi_sct_ecc[layerDisk]->Fill(modPhi);
-              m_hits_vs_Eta_Phi_sct_ecc->Fill(layerDisk, modPhi);
-            }
-          }//sct
-        } // all possible holes
-
-        // filling histograms for holes being holes
-        if ((*HTSOSItr)->type(Trk::TrackStateOnSurface::Hole)) {
-          // holes per layer and per hit
-          // --- pixel
-          if (detType == 0) {
-            if (barrelEC == 0) {
-              m_holes_vs_layer_barrel->Fill(layerDisk);
-              m_holes_vs_Eta_Phi_pix_b[layerDisk]->Fill(modEta, modPhi);
-              m_holes_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-              m_holes_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-              m_holes_vs_LB_pix_b[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_pT_pix_b[layerDisk]->Fill(abs_trkpt);
-            }
-            // ----------- eca
-            else if (barrelEC == 2) {
-              m_holes_vs_layer_eca->Fill(layerDisk);
-              m_holes_vs_LB_pix_eca[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_Eta_Phi_pix_eca->Fill(layerDisk, modPhi);
-            }
-            // ----------- ecc
-            else if (barrelEC == -2) {
-              m_holes_vs_layer_ecc->Fill(layerDisk);
-              m_holes_vs_LB_pix_ecc[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_Eta_Phi_pix_ecc->Fill(layerDisk, modPhi);
-            }
-          } // pix
-            // --- sct holes
-          else if (detType == 1) {
-            if (barrelEC == 0) {
-              m_holes_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-
-              m_holes_vs_Eta_Phi_sct_b[layerDisk]->Fill(modEta, modPhi);
-              m_holes_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-              m_holes_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-              m_holes_vs_pT_sct_b[layerDisk]->Fill(abs_trkpt);
-            } else if (barrelEC == 2) {
-              m_holes_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-              m_holes_vs_Eta_Phi_sct_eca->Fill(layerDisk, modPhi);
-            } else if (detType == 1 && barrelEC == -2) {
-              m_holes_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-              m_holes_vs_Eta_Phi_sct_ecc->Fill(layerDisk, modPhi);
-            }
-          } // sct
-        } // holes as holes
-
-        // filling histograms for holes being outliers
-        if ((*HTSOSItr)->type(Trk::TrackStateOnSurface::Outlier)) {
-          //This section has to be removed. There is no hole flagged as outlier. I've checked it (PF)
-
-          // holes per layer and per hit
-          // --- pixel
-          if (detType == 0) {
-            if (barrelEC == 0) {
-              m_holes_vs_layer_barrel->Fill(layerDisk);
-              m_holes_vs_Eta_Phi_pix_b[layerDisk]->Fill(modEta, modPhi);
-              m_holes_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-              m_holes_vs_LB_pix_b[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-              m_holes_vs_pT_pix_b[layerDisk]->Fill(abs_trkpt);
-            }
-            // ----------- eca
-            else if (barrelEC == 2) {
-              m_holes_vs_layer_eca->Fill(layerDisk);
-              m_holes_vs_LB_pix_eca[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_Eta_Phi_pix_eca->Fill(layerDisk, modPhi);
-            }
-            // ----------- ecc
-            else if (barrelEC == -2) {
-              m_holes_vs_layer_ecc->Fill(layerDisk);
-              m_holes_vs_LB_pix_ecc[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_Eta_Phi_pix_ecc->Fill(layerDisk, modPhi);
-            }
-          } // pix
-            // --- sct holes
-          else if (detType == 1) {
-            if (barrelEC == 0) {
-              m_holes_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-
-              m_holes_vs_Eta_Phi_sct_b[layerDisk]->Fill(modEta, modPhi);
-              m_holes_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-              m_holes_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-              m_holes_vs_pT_sct_b[layerDisk]->Fill(abs_trkpt);
-            } else if (barrelEC == 2) {
-              m_holes_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-              m_holes_vs_Eta_Phi_sct_eca->Fill(layerDisk, modPhi);
-            } else if (detType == 1 && barrelEC == -2) {
-              m_holes_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-              m_holes_vs_Eta_Phi_sct_ecc->Fill(layerDisk, modPhi);
-            }
-          } // sct
-        } // holes as outliers
-
-        // filling histograms for holes being measurements
-        if ((*HTSOSItr)->type(Trk::TrackStateOnSurface::Measurement)) {
-          //This has to be removed. There are no holes flagged as measurements. Checked it. PF
-
-          // holes per layer and per hit
-          // --- pixel
-          if (detType == 0) {
-            if (barrelEC == 0) {
-              m_holes_vs_layer_barrel->Fill(layerDisk);
-              m_holes_vs_Eta_Phi_pix_b[layerDisk]->Fill(modEta, modPhi);
-              m_holes_vs_Eta_pix_b[layerDisk]->Fill(modEta);
-              m_holes_vs_Phi_pix_b[layerDisk]->Fill(modPhi);
-              m_holes_vs_LB_pix_b[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_pT_pix_b[layerDisk]->Fill(abs_trkpt);
-            }
-            // ----------- eca
-            else if (barrelEC == 2) {
-              m_holes_vs_layer_eca->Fill(layerDisk);
-              m_holes_vs_LB_pix_eca[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_Eta_Phi_pix_eca->Fill(layerDisk, modPhi);
-            }
-            // ----------- ecc
-            else if (barrelEC == -2) {
-              m_holes_vs_layer_ecc->Fill(layerDisk);
-              m_holes_vs_LB_pix_ecc[layerDisk]->Fill(float(LumiBlock));
-              m_holes_vs_Eta_Phi_pix_ecc->Fill(layerDisk, modPhi);
-            }
-          } // pix
-            // --- sct holes
-          else if (detType == 1) {
-            if (barrelEC == 0) {
-              m_holes_vs_layer_barrel->Fill(m_NPixLayers + 2 * layerDisk + sctSide);
-
-              m_holes_vs_Eta_Phi_sct_b[layerDisk]->Fill(modEta, modPhi);
-              m_holes_vs_Eta_sct_b[layerDisk]->Fill(modEta);
-              m_holes_vs_Phi_sct_b[layerDisk]->Fill(modPhi);
-              m_holes_vs_pT_sct_b[layerDisk]->Fill(abs_trkpt);
-            } else if (barrelEC == 2) {
-              m_holes_vs_layer_eca->Fill(3 + 2 * layerDisk + sctSide);
-              m_holes_vs_Eta_Phi_sct_eca->Fill(layerDisk, modPhi);
-            } else if (detType == 1 && barrelEC == -2) {
-              m_holes_vs_layer_ecc->Fill(3 + 2 * layerDisk + sctSide);
-              m_holes_vs_Eta_Phi_sct_ecc->Fill(layerDisk, modPhi);
-            }
-          } // sct
-        } // holes as measurements (?)
-      }
-      ATH_MSG_DEBUG("end of loop on " << HTSOS->size() << " holes ");
-    } // hole tool exists
-  }
-  ATH_MSG_DEBUG("end of loop on " << nTrackCount << " tracks ok");
-  delete trks;
-
-  ATH_MSG_DEBUG("IDAlignMonEfficiencies::fillHistograms ** COMPLETED ** for m_events " << m_events << " and track collection: " << m_tracksName.key());
-  return StatusCode::SUCCESS;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-void IDAlignMonEfficiencies::makeEffHisto(TH1F* h_num, TH1F* h_denom, TProfile* h_eff) const {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    h_eff->Reset("ICE");
-  }
-
-  int Nbins;
-  Nbins = h_num->GetNbinsX();
-
-  for (int bin = 0; bin != Nbins; ++bin) {
-    int Npass = int(h_num->GetBinContent(bin + 1));
-    int Nfail = int(h_denom->GetBinContent(bin + 1)) - Npass;
-    double x = h_denom->GetBinCenter(bin + 1);
-    for (int pass = 0; pass < Npass; ++pass) {
-      h_eff->Fill(x, 1.);
-    }
-    for (int fail = 0; fail < Nfail; ++fail) {
-      h_eff->Fill(x, 0.);
-    }
-  }
-  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-void IDAlignMonEfficiencies::makeEffHisto(TH1F_LW* h_num, TH1F_LW* h_denom, TProfile* h_eff) {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    h_eff->Reset("ICE");
-  }
-
-  ATH_MSG_DEBUG("in makeEffHisto for " << h_num->GetName() << " / " << h_denom->GetName());
-  int Nbins;
-  Nbins = h_num->GetNbinsX();
-  ATH_MSG_DEBUG("Nbins is: " << Nbins);
-  for (int bin = 0; bin != Nbins; ++bin) {
-    int Npass = int(h_num->GetBinContent(bin + 1));
-    int Nfail = int(h_denom->GetBinContent(bin + 1)) - Npass;
-
-    float binSize = (h_denom->getXMax() - h_denom->getXMin()) / h_denom->GetNbinsX();
-    double x = h_denom->getXMin() + binSize * bin + binSize / 2;
-    for (int pass = 0; pass < Npass; ++pass) {
-      h_eff->Fill(x, 1.);
-    }
-
-    for (int fail = 0; fail < Nfail; ++fail) {
-      h_eff->Fill(x, 0.);
-    }
-  }
-  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow);
-
-  ATH_MSG_DEBUG("leaving makeEffHisto with Nbins " << Nbins);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-void IDAlignMonEfficiencies::makeOverlapFracHisto(TH1F* h_num, TH1F* h_denom, TProfile* h_eff) {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    h_eff->Reset("ICE");
-  }
-
-  int Nbins;
-  Nbins = h_num->GetNbinsX();
-  for (int bin = 0; bin != Nbins; ++bin) {
-    int Npass = int(h_num->GetBinContent(bin + 1));
-    int Nfail = int(h_denom->GetBinContent(bin + 1)) - Npass;
-    float x = h_denom->GetBinCenter(bin + 1);
-    for (int pass = 0; pass < Npass; ++pass) {
-      h_eff->Fill(x, 1.);
-    }
-    for (int fail = 0; fail < Nfail; ++fail) {
-      h_eff->Fill(x, 0.);
-    }
-  }
-  SetMinWindow(h_eff, 0., .3);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-void IDAlignMonEfficiencies::makeEffHisto(TH2F* h_num, TH2F* h_denom, TProfile2D* h_eff) const {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    h_eff->Reset("ICE");
-  }
-
-  int Nbins;
-  int NbinsY;
-  Nbins = h_num->GetNbinsX();
-  NbinsY = h_num->GetNbinsY();
-  for (int bin = 0; bin != Nbins; ++bin) {
-    for (int binY = 0; binY != NbinsY; ++binY) {
-      int Npass = int(h_num->GetBinContent(bin + 1, binY + 1));
-      int Nfail = int(h_denom->GetBinContent(bin + 1, binY + 1)) - Npass;
-      float x = h_denom->GetXaxis()->GetBinCenter(bin + 1);
-      float y = h_denom->GetYaxis()->GetBinCenter(binY + 1);
-      for (int pass = 0; pass < Npass; ++pass) {
-        h_eff->Fill(x, y, 1.);
-      }
-      for (int fail = 0; fail < Nfail; ++fail) {
-        h_eff->Fill(x, y, 0.);
-      }
-    }
-  }
-  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-void IDAlignMonEfficiencies::makeEffHisto(TH2F* h_num, TH2F* h_denom, TH2F* h_eff) {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    h_eff->Reset("ICE");
-  }
-
-  int Nbins = h_num->GetNbinsX();
-  int NbinsY = h_num->GetNbinsY();
-  float NSeenHits, NExpected;
-  float myEff = 0.; // default is 0%
-  bool doComputeEff = false;
-  for (int bin = 0; bin != Nbins; ++bin) {
-    for (int binY = 0; binY != NbinsY; ++binY) {
-      NSeenHits = h_num->GetBinContent(bin + 1, binY + 1);
-      NExpected = h_denom->GetBinContent(bin + 1, binY + 1);
-      doComputeEff = false; // check that there is a mimimum of entries
-      if (NExpected > 10) doComputeEff = true;
-      if (NSeenHits > 5) doComputeEff = true;
-      if (doComputeEff) {
-        myEff = NSeenHits / NExpected;
-        if (myEff < 0.01) myEff = 0.01; //trick to distinguish between few entries and not working modules or too low
-                                        // statistics (doComputeEff = false --> Eff = 0 % )
-        h_eff->SetBinContent(bin + 1, binY + 1, myEff);
-      }
-      ATH_MSG_INFO(" -- eff for module ( " << bin << ", " << binY << ")"
-                                           << "  Nseen= " << NSeenHits
-                                           << "  NExpected= " << NExpected
-                                           << "  Eff= " << h_eff->GetBinContent(bin, binY));
-    }
-  }
-  }
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-void IDAlignMonEfficiencies::makeEffHistoWithCut(TH2F* h_num, TH2F* h_denom, TProfile2D* h_eff) {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    h_eff->Reset("ICE");
-  }
-
-  int Nbins = h_num->GetNbinsX();
-  int NbinsY = h_num->GetNbinsY();
-  float NSeenHits, NExpected;
-  bool doComputeEff = false;
-
-  for (int bin = 0; bin != Nbins; ++bin) {
-    for (int binY = 0; binY != NbinsY; ++binY) {
-      NSeenHits = h_num->GetBinContent(bin + 1, binY + 1);
-      NExpected = h_denom->GetBinContent(bin + 1, binY + 1);
-      doComputeEff = false; // check that there is a mimimum of entries
-      if (NExpected > 10) doComputeEff = true;
-      if (NSeenHits > 5) doComputeEff = true;
-      if (doComputeEff) {
-        float this_x = h_denom->GetXaxis()->GetBinCenter(bin + 1);
-        float this_y = h_denom->GetYaxis()->GetBinCenter(binY + 1);
-        for (int i = 0; i < NExpected; i++) {
-          const float fillValue = (i < NSeenHits) ? 1. : 0.;
-          h_eff->Fill(this_x, this_y, fillValue);
-        }
-      }
-      ATH_MSG_INFO(" -- eff for module ( " << bin << ", " << binY << ")"
-                                           << "  Nseen= " << NSeenHits
-                                           << "  NExpected= " << NExpected
-                                           << "  Eff= " << h_eff->GetBinContent(bin, binY));
-    }
-  }
-  }
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-StatusCode IDAlignMonEfficiencies::procHistograms() {
-  ATH_MSG_DEBUG("-- procHistograms -- START");
-  if (endOfRunFlag() || ((AthenaMonManager::environment() == AthenaMonManager::online) && endOfLumiBlockFlag())) {
-    // -----------------------------------------------------------------------
-    //
-    // normalize: divide measurement / outliers / holes by number of possible hits
-    //
-
-    for (int iLayer = 0; iLayer < m_PIX_Mgr->numerology().numLayers(); ++iLayer) {
-      if (!m_PIX_Mgr->numerology().useLayer(iLayer)) {
-        msg(MSG::WARNING) << "Layer " << iLayer << " Not in Use. No efficiencies plots" << endmsg;
-        continue;
-      }
-      makeEffHisto(m_measurements_vs_Eta_Phi_pix_b[iLayer], m_hits_vs_Eta_Phi_pix_b[iLayer], m_measurements_eff_vs_Eta_Phi_pix_b[iLayer]);
-      makeEffHisto(m_measurements_vs_Eta_pix_b[iLayer], m_hits_vs_Eta_pix_b[iLayer], m_measurements_eff_vs_Eta_pix_b[iLayer]);
-      makeEffHisto(m_measurements_vs_Phi_pix_b[iLayer], m_hits_vs_Phi_pix_b[iLayer], m_measurements_eff_vs_Phi_pix_b[iLayer]);
-      makeEffHisto(m_measurements_vs_pT_pix_b[iLayer], m_hits_vs_pT_pix_b[iLayer], m_measurements_eff_vs_pT_pix_b[iLayer]);
-      makeEffHisto(m_outliers_vs_Eta_pix_b[iLayer], m_hits_vs_Eta_pix_b[iLayer], m_outliers_eff_vs_Eta_pix_b[iLayer]);
-      makeEffHisto(m_holes_vs_Eta_pix_b[iLayer], m_hits_vs_Eta_pix_b[iLayer], m_holes_eff_vs_Eta_pix_b[iLayer]);
-      makeEffHisto(m_outliers_vs_Phi_pix_b[iLayer], m_hits_vs_Phi_pix_b[iLayer], m_outliers_eff_vs_Phi_pix_b[iLayer]);
-      makeEffHisto(m_holes_vs_Phi_pix_b[iLayer], m_hits_vs_Phi_pix_b[iLayer], m_holes_eff_vs_Phi_pix_b[iLayer]);
-      makeEffHisto(m_outliers_vs_pT_pix_b[iLayer], m_hits_vs_pT_pix_b[iLayer], m_outliers_eff_vs_pT_pix_b[iLayer]);
-      makeEffHisto(m_holes_vs_pT_pix_b[iLayer], m_hits_vs_pT_pix_b[iLayer], m_holes_eff_vs_pT_pix_b[iLayer]);
-
-      if (m_extendedPlots) {
-        makeOverlapFracHisto(m_overlapX_vs_Phi_pix_b[iLayer], m_measurements_vs_Phi_pix_b[iLayer], m_overlapX_eff_vs_Phi_pix_b[iLayer]);
-        makeOverlapFracHisto(m_overlapY_vs_Phi_pix_b[iLayer], m_measurements_vs_Phi_pix_b[iLayer], m_overlapY_eff_vs_Phi_pix_b[iLayer]);
-        makeOverlapFracHisto(m_overlapX_vs_Eta_pix_b[iLayer], m_measurements_vs_Eta_pix_b[iLayer], m_overlapX_eff_vs_Eta_pix_b[iLayer]);
-        makeOverlapFracHisto(m_overlapY_vs_Eta_pix_b[iLayer], m_measurements_vs_Eta_pix_b[iLayer], m_overlapY_eff_vs_Eta_pix_b[iLayer]);
-      }
-
-
-
-      //LB plots - Barrel
-      makeEffHisto(m_measurements_vs_LB_pix_b[iLayer], m_hits_vs_LB_pix_b[iLayer], m_measurements_eff_vs_LB_pix_b[iLayer]);
-      makeEffHisto(m_outliers_vs_LB_pix_b[iLayer], m_hits_vs_LB_pix_b[iLayer], m_outliers_eff_vs_LB_pix_b[iLayer]);
-      makeEffHisto(m_holes_vs_LB_pix_b[iLayer], m_hits_vs_LB_pix_b[iLayer], m_holes_eff_vs_LB_pix_b[iLayer]);
-    }// Loop on barrel layers
-
-    for (int iECIndex = 0; iECIndex < m_PIX_Mgr->numerology().numEndcaps(); ++iECIndex) {
-      int iSide = m_PIX_Mgr->numerology().endcapId(iECIndex);
-      for (int iDisk = 0; iDisk < m_PIX_Mgr->numerology().numDisks(); ++iDisk) {
-        if (!m_PIX_Mgr->numerology().useDisk(iDisk)) {//To check if the Disk is in use.
-          msg(MSG::WARNING) << "Disk " << iDisk << " Not in Use" << endmsg;
-          continue;
-        }
-
-        if (iSide > 0) {
-          makeEffHisto(m_measurements_vs_Phi_pix_eca[iDisk], m_hits_vs_Phi_pix_eca[iDisk], m_measurements_eff_vs_Phi_pix_eca[iDisk]);
-          makeEffHisto(m_measurements_vs_LB_pix_eca[iDisk], m_hits_vs_LB_pix_eca[iDisk], m_measurements_eff_vs_LB_pix_eca[iDisk]);
-          makeEffHisto(m_holes_vs_LB_pix_eca[iDisk], m_hits_vs_LB_pix_eca[iDisk], m_holes_eff_vs_LB_pix_eca[iDisk]);
-          makeEffHisto(m_outliers_vs_LB_pix_eca[iDisk], m_hits_vs_LB_pix_eca[iDisk], m_outliers_eff_vs_LB_pix_eca[iDisk]);
-        }
-        if (iSide < 0) {
-          makeEffHisto(m_measurements_vs_Phi_pix_ecc[iDisk], m_hits_vs_Phi_pix_ecc[iDisk], m_measurements_eff_vs_Phi_pix_ecc[iDisk]);
-          makeEffHisto(m_measurements_vs_LB_pix_ecc[iDisk], m_hits_vs_LB_pix_ecc[iDisk], m_measurements_eff_vs_LB_pix_ecc[iDisk]);
-          makeEffHisto(m_holes_vs_LB_pix_ecc[iDisk], m_hits_vs_LB_pix_ecc[iDisk], m_holes_eff_vs_LB_pix_ecc[iDisk]);
-          makeEffHisto(m_outliers_vs_LB_pix_ecc[iDisk], m_hits_vs_LB_pix_ecc[iDisk], m_outliers_eff_vs_LB_pix_ecc[iDisk]);
-        }
-      }//Disk loop
-    }//Endcap loop
-
-
-    for (int iLayer = 0; iLayer < m_SCT_Mgr->numerology().numLayers(); ++iLayer) {
-      if (!m_SCT_Mgr->numerology().useLayer(iLayer)) {
-        msg(MSG::WARNING) << "Layer " << iLayer << " Not in Use. No efficiencies plots" << endmsg;
-        continue;
-      }
-      makeEffHisto(m_measurements_vs_Eta_Phi_sct_b[iLayer], m_hits_vs_Eta_Phi_sct_b[iLayer], m_measurements_eff_vs_Eta_Phi_sct_b[iLayer]);
-      makeEffHisto(m_measurements_vs_Eta_sct_b[iLayer], m_hits_vs_Eta_sct_b[iLayer], m_measurements_eff_vs_Eta_sct_b[iLayer]);
-      makeEffHisto(m_outliers_vs_Eta_sct_b[iLayer], m_hits_vs_Eta_sct_b[iLayer], m_outliers_eff_vs_Eta_sct_b[iLayer]);
-      makeEffHisto(m_holes_vs_Eta_sct_b[iLayer], m_hits_vs_Eta_sct_b[iLayer], m_holes_eff_vs_Eta_sct_b[iLayer]);
-      makeEffHisto(m_measurements_vs_Phi_sct_b[iLayer], m_hits_vs_Phi_sct_b[iLayer], m_measurements_eff_vs_Phi_sct_b[iLayer]);
-      makeEffHisto(m_outliers_vs_Phi_sct_b[iLayer], m_hits_vs_Phi_sct_b[iLayer], m_outliers_eff_vs_Phi_sct_b[iLayer]);
-      makeEffHisto(m_holes_vs_Phi_sct_b[iLayer], m_hits_vs_Phi_sct_b[iLayer], m_holes_eff_vs_Phi_sct_b[iLayer]);
-      makeEffHisto(m_measurements_vs_pT_sct_b[iLayer], m_hits_vs_pT_sct_b[iLayer], m_measurements_eff_vs_pT_sct_b[iLayer]);
-      makeEffHisto(m_outliers_vs_pT_sct_b[iLayer], m_hits_vs_pT_sct_b[iLayer], m_outliers_eff_vs_pT_sct_b[iLayer]);
-      makeEffHisto(m_holes_vs_pT_sct_b[iLayer], m_hits_vs_pT_sct_b[iLayer], m_holes_eff_vs_pT_sct_b[iLayer]);
-
-      // SCT barrel: module by module & plane by plane
-      makeEffHisto(m_measurements_vs_Eta_Phi_sct_s0_b[iLayer], m_hits_vs_Eta_Phi_sct_s0_b[iLayer], m_measurements_eff_vs_Eta_Phi_sct_s0_b[iLayer]);
-      makeEffHisto(m_measurements_vs_Eta_Phi_sct_s1_b[iLayer], m_hits_vs_Eta_Phi_sct_s1_b[iLayer], m_measurements_eff_vs_Eta_Phi_sct_s1_b[iLayer]);
-      makeEffHisto(m_measurements_vs_LB_sct_b[iLayer], m_hits_vs_LB_sct_b[iLayer], m_measurements_eff_vs_LB_sct_b[iLayer]);
-
-      if (m_extendedPlots) {
-        makeOverlapFracHisto(m_overlapX_vs_Phi_sct_b[iLayer], m_measurements_vs_Phi_sct_b[iLayer], m_overlapX_eff_vs_Phi_sct_b[iLayer]);
-        makeOverlapFracHisto(m_overlapY_vs_Phi_sct_b[iLayer], m_measurements_vs_Phi_sct_b[iLayer], m_overlapY_eff_vs_Phi_sct_b[iLayer]);
-        makeOverlapFracHisto(m_overlapX_vs_Eta_sct_b[iLayer], m_measurements_vs_Eta_sct_b[iLayer], m_overlapX_eff_vs_Eta_sct_b[iLayer]);
-        makeOverlapFracHisto(m_overlapY_vs_Eta_sct_b[iLayer], m_measurements_vs_Eta_sct_b[iLayer], m_overlapY_eff_vs_Eta_sct_b[iLayer]);
-      }
-    }
-
-    for (int iECIndex = 0; iECIndex < m_SCT_Mgr->numerology().numEndcaps(); ++iECIndex) {
-      int iSide = m_SCT_Mgr->numerology().endcapId(iECIndex);
-      for (int iWheel = 0; iWheel < m_SCT_Mgr->numerology().numDisks(); ++iWheel) {
-        if (!m_SCT_Mgr->numerology().useDisk(iWheel)) {//To check if the Wheel is in use.
-          msg(MSG::WARNING) << "Wheel " << iWheel << " Not in Use" << endmsg;
-          continue;
-        }
-
-        if (iSide > 0) {
-          makeEffHisto(m_measurements_vs_Phi_sct_eca[iWheel], m_hits_vs_Phi_sct_eca[iWheel], m_measurements_eff_vs_Phi_sct_eca[iWheel]);
-        }
-        if (iSide < 0) {
-          makeEffHisto(m_measurements_vs_Phi_sct_ecc[iWheel], m_hits_vs_Phi_sct_ecc[iWheel], m_measurements_eff_vs_Phi_sct_ecc[iWheel]);
-        }
-      }//Wheel loop
-    }//Endcap loop
-
-    makeEffHisto(m_measurements_vs_Eta_Phi_pix_eca, m_hits_vs_Eta_Phi_pix_eca, m_measurements_eff_vs_Eta_Phi_pix_eca);
-    makeEffHisto(m_measurements_vs_Eta_Phi_pix_ecc, m_hits_vs_Eta_Phi_pix_ecc, m_measurements_eff_vs_Eta_Phi_pix_ecc);
-    makeEffHisto(m_measurements_vs_Eta_Phi_sct_eca, m_hits_vs_Eta_Phi_sct_eca, m_measurements_eff_vs_Eta_Phi_sct_eca);
-    makeEffHisto(m_measurements_vs_Eta_Phi_sct_ecc, m_hits_vs_Eta_Phi_sct_ecc, m_measurements_eff_vs_Eta_Phi_sct_ecc);
-
-    makeEffHisto(m_measurements_vs_LB_sct_eca, m_hits_vs_LB_sct_eca, m_measurements_eff_vs_LB_sct_eca);
-    makeEffHisto(m_measurements_vs_LB_sct_ecc, m_hits_vs_LB_sct_ecc, m_measurements_eff_vs_LB_sct_ecc);
-
-    makeEffHisto(m_measurements_vs_layer_barrel, m_hits_vs_layer_barrel, m_measurements_eff_vs_layer_barrel);
-    makeEffHisto(m_measurements_vs_layer_eca, m_hits_vs_layer_eca, m_measurements_eff_vs_layer_eca);
-    makeEffHisto(m_measurements_vs_layer_ecc, m_hits_vs_layer_ecc, m_measurements_eff_vs_layer_ecc);
-    makeEffHisto(m_outliers_vs_layer_barrel, m_hits_vs_layer_barrel, m_outliers_eff_vs_layer_barrel);
-    makeEffHisto(m_outliers_vs_layer_eca, m_hits_vs_layer_eca, m_outliers_eff_vs_layer_eca);
-    makeEffHisto(m_outliers_vs_layer_ecc, m_hits_vs_layer_ecc, m_outliers_eff_vs_layer_ecc);
-    makeEffHisto(m_holes_vs_layer_barrel, m_hits_vs_layer_barrel, m_holes_eff_vs_layer_barrel);
-    makeEffHisto(m_holes_vs_layer_eca, m_hits_vs_layer_eca, m_holes_eff_vs_layer_eca);
-    makeEffHisto(m_holes_vs_layer_ecc, m_hits_vs_layer_ecc, m_holes_eff_vs_layer_ecc);
-    makeEffHisto(m_noholes_vs_layer_barrel, m_hits_vs_layer_barrel, m_noholes_eff_vs_layer_barrel);
-    makeEffHisto(m_noholes_vs_layer_eca, m_hits_vs_layer_eca, m_noholes_eff_vs_layer_eca);
-    makeEffHisto(m_noholes_vs_layer_ecc, m_hits_vs_layer_ecc, m_noholes_eff_vs_layer_ecc);
-
-    if (m_extendedPlots) {
-      makeEffHisto(m_overlapX_vs_layer_barrel, m_measurements_vs_layer_barrel, m_overlapX_eff_vs_layer_barrel);
-      makeEffHisto(m_overlapX_vs_layer_eca, m_measurements_vs_layer_eca, m_overlapX_eff_vs_layer_eca);
-      makeEffHisto(m_overlapX_vs_layer_ecc, m_measurements_vs_layer_ecc, m_overlapX_eff_vs_layer_ecc);
-      makeEffHisto(m_overlapY_vs_layer_barrel, m_measurements_vs_layer_barrel, m_overlapY_eff_vs_layer_barrel);
-      makeEffHisto(m_overlapY_vs_layer_eca, m_measurements_vs_layer_eca, m_overlapY_eff_vs_layer_eca);
-      makeEffHisto(m_overlapY_vs_layer_ecc, m_measurements_vs_layer_ecc, m_overlapY_eff_vs_layer_ecc);
-    }
-
-    /**  TRT Processing */
-    ATH_MSG_DEBUG("Doing the TRT Barrel pocessing");
-    /** TRT Barrel */
-    for (int i = 0; i < 3; i++) {
-      ATH_MSG_DEBUG(" -- TRT barrel layer is " << i);
-      makeEffHisto(m_trt_b_hist->outliers_vs_phiSector[i], m_trt_b_hist->totHits_vs_phiSector[i], m_trt_b_hist->outliers_eff_vs_phiSector[i]);
-      makeEffHisto(m_trt_b_hist->hits_vs_phiSector[i], m_trt_b_hist->totHits_vs_phiSector[i], m_trt_b_hist->hits_eff_vs_phiSector[i]);
-      makeEffHisto(m_trt_b_hist->tubeHits_vs_phiSector[i], m_trt_b_hist->totHits_vs_phiSector[i], m_trt_b_hist->tubeHits_eff_vs_phiSector[i]);
-    }
-    makeEffHisto(m_trt_b_hist->outliers_vs_StrawLay, m_trt_b_hist->totHits_vs_StrawLay, m_trt_b_hist->outliers_eff_vs_StrawLay);
-    makeEffHisto(m_trt_b_hist->hits_vs_StrawLay, m_trt_b_hist->totHits_vs_StrawLay, m_trt_b_hist->hits_eff_vs_StrawLay);
-    makeEffHisto(m_trt_b_hist->tubeHits_vs_StrawLay, m_trt_b_hist->totHits_vs_StrawLay, m_trt_b_hist->tubeHits_eff_vs_StrawLay);
-
-    ATH_MSG_DEBUG("Doing the TRT EndCap pocessing");
-    /**  TRT Endcap */
-    for (unsigned int endcap = 0; endcap < 2; ++endcap) {
-      ATH_MSG_DEBUG("-- TRT endcap is " << endcap);
-      makeEffHisto(m_trt_ec_hist->outliers_vs_ring[endcap],
-                   m_trt_ec_hist->totHits_vs_ring[endcap],
-                   m_trt_ec_hist->outliers_eff_vs_ring[endcap]);
-
-      makeEffHisto(m_trt_ec_hist->hits_vs_ring[endcap],
-                   m_trt_ec_hist->totHits_vs_ring[endcap],
-                   m_trt_ec_hist->hits_eff_vs_ring[endcap]);
-
-      makeEffHisto(m_trt_ec_hist->tubeHits_vs_ring[endcap],
-                   m_trt_ec_hist->totHits_vs_ring[endcap],
-                   m_trt_ec_hist->tubeHits_eff_vs_ring[endcap]);
-
-      makeEffHisto(m_trt_ec_hist->outliers_vs_phiSector[endcap],
-                   m_trt_ec_hist->totHits_vs_phiSector[endcap],
-                   m_trt_ec_hist->outliers_eff_vs_phiSector[endcap]);
-
-      makeEffHisto(m_trt_ec_hist->hits_vs_phiSector[endcap],
-                   m_trt_ec_hist->totHits_vs_phiSector[endcap],
-                   m_trt_ec_hist->hits_eff_vs_phiSector[endcap]);
-
-      makeEffHisto(m_trt_ec_hist->tubeHits_vs_phiSector[endcap],
-                   m_trt_ec_hist->totHits_vs_phiSector[endcap],
-                   m_trt_ec_hist->tubeHits_eff_vs_phiSector[endcap]);
-    }
-    ATH_MSG_DEBUG("TRT Processing completed");
-    //========================
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//================================================================
-// Establishes a minimim window for the TProfile
-//================================================================
-void IDAlignMonEfficiencies::SetMinWindow(TProfile* hProf, float windowMin, float windowMax) {
-  float min = hProf->GetMinimum();
-  float max = hProf->GetMaximum();
-  float margin = 0.05 * (max - min);
-
-  if (min > windowMin) min = windowMin - margin;
-  if (max < windowMax) max = windowMax + margin;
-  hProf->SetMinimum(min);
-  hProf->SetMaximum(max);
-}
-
-void IDAlignMonEfficiencies::SetMinWindow(TProfile2D* hProf, float windowMin, float windowMax) {
-  float min = hProf->GetMinimum();
-  float max = hProf->GetMaximum();
-  float margin = 0.05 * (max - min);
-
-  if (min > windowMin) min = windowMin - margin;
-  if (max < windowMax) max = windowMax + margin;
-  hProf->SetMinimum(min);
-  hProf->SetMaximum(max);
-}
-
-//---------------------------------------------------------------------------------------------------------------
-
-std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAlignMonEfficiencies::findOverlapHit(const Trk::Track* trk, const Trk::MeasurementBase* hit) {
-  // this method identifies which hits on modules for Trk::Track* trk overlap with Trk::RIO_OnTrack* hit
-  // - only one overlapping module should be returned
-  // - the overlapping module must be at a greater global radius than Trk::RIO_OnTrack* hit
-  //   this avoids double counting when you are trying to find all the unique overlaps for a track
-  // - for SCT overlaps, the overlapping module must have the same axial/stereo orientation as the Trk::RIO_OnTrack* hit
-  //   otherwise the computation of the overlap residual is using two different coordinate frames and will be distorted
-  // returns two Trk::TrackStateOnSurface, one for a potential x overlaps and one for a potential y overlap
-  // if no overlap is found the corresponding Trk::TrackStateOnSurface will be null
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in  IDAlignMonEfficiencies::findOverlapHit()" << endmsg;
-
-  const Trk::TrackStateOnSurface* xOverlap = nullptr;
-  const Trk::TrackStateOnSurface* yOverlap = nullptr;
-
-  if (!hit) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit is NULL; abandoning overlap search" << endmsg;
-    std::pair <const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> result(xOverlap, yOverlap);
-    return result;
-  }
-
-  Identifier hitId;
-  if (hit->associatedSurface().associatedDetectorElement() != nullptr) hitId = hit->associatedSurface().associatedDetectorElement()->identify();
-  else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit doesn't have an associated detector element; abandoning overlap search" << endmsg;
-    std::pair <const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> result(xOverlap, yOverlap);
-    return result;
-  }
-
-  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "obtained hit identifier" << endmsg;
-  int detType = 99;
-  int barrelEC = 99;
-  int layerDisk = 99;
-  int modEta = 99;
-  int modPhi = 99;
-  if (m_idHelper->is_pixel(hitId)) detType = 0;
-  if (m_idHelper->is_sct(hitId)) detType = 1;
-  if (m_idHelper->is_trt(hitId)) detType = 2;
-
-  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "determined hit detector type = " << detType << endmsg;
-
-  //determining Si module physical position
-  if (detType == 0) {//pixel
-    const Identifier& id = m_pixelID->wafer_id(hitId);
-    barrelEC = m_pixelID->barrel_ec(id);
-    layerDisk = m_pixelID->layer_disk(id);
-    modEta = m_pixelID->eta_module(id);
-    modPhi = m_pixelID->phi_module(id);
-  }
-  if (detType == 1) {//sct
-    const Identifier& id = m_sctID->wafer_id(hitId);
-    barrelEC = m_sctID->barrel_ec(id);
-    layerDisk = m_sctID->layer_disk(id);
-    modEta = m_sctID->eta_module(id);
-    modPhi = m_sctID->phi_module(id);
-  }
-
-  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "**************looking for overlaps for new hit detType = " << detType
-                                              << ", modEta = " << modEta << ", modPhi = " << modPhi << endmsg;
-
-
-  int nHits = 0;
-  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();
-    if (hit2 == nullptr) continue; //the first hit on the track never has associated hit information - just stores track
-                                   // parameters
-    nHits++;
-
-    Identifier hitId2;
-    if (hit2->associatedSurface().associatedDetectorElement() != nullptr) hitId2 = hit2->associatedSurface().associatedDetectorElement()->identify();
-    else {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "hit tested for overlap doesn't have an associated detector element" << endmsg;
-      continue;
-    }
-
-    if (m_idHelper->is_pixel(hitId2)) detType2 = 0;
-    if (m_idHelper->is_sct(hitId2)) detType2 = 1;
-    if (m_idHelper->is_trt(hitId2)) detType2 = 2;
-
-    //determining Si module physical position
-    if (detType2 == 0) {//pixel
-      const Identifier& id = m_pixelID->wafer_id(hitId2);
-      barrelEC2 = m_pixelID->barrel_ec(id);
-      layerDisk2 = m_pixelID->layer_disk(id);
-      modEta2 = m_pixelID->eta_module(id);
-      modPhi2 = m_pixelID->phi_module(id);
-    }
-    if (detType2 == 1) {//sct
-      const Identifier& id = m_sctID->wafer_id(hitId2);
-      barrelEC2 = m_sctID->barrel_ec(id);
-      layerDisk2 = m_sctID->layer_disk(id);
-      modEta2 = m_sctID->eta_module(id);
-      modPhi2 = m_sctID->phi_module(id);
-    }
-
-    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 (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because hit is an outlier" << endmsg;
-      continue;
-    }
-
-    if (detType != detType2) {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because not the same detector" << endmsg;
-      continue;
-    }
-    if (barrelEC != barrelEC2) {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because not the same barrel/endcap" << endmsg;
-      continue;
-    }
-    if (layerDisk != layerDisk2) {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because not the same layer/disk" << endmsg;
-      continue;
-    }
-
-    if (modEta == modEta2 && modPhi == modPhi2) {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because this is the original hit (or the opposite side for SCT)" << endmsg;
-      continue;
-    }
-
-    if (detType == 1) {
-      //const InDetDD::SiDetectorElement *siDet = dynamic_cast<const
-      // InDetDD::SiDetectorElement*>(hit->detectorElement());
-      const InDetDD::SiDetectorElement* siDet = dynamic_cast<const InDetDD::SiDetectorElement*>(hit->associatedSurface().associatedDetectorElement());
-      bool stereo = siDet->isStereo();
-      const InDetDD::SiDetectorElement* siDet2 = dynamic_cast<const InDetDD::SiDetectorElement*>(hit2->associatedSurface().associatedDetectorElement());
-      bool stereo2 = siDet2->isStereo();
-      if (stereo != stereo2) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "SCT overlap rejected because the modules are not both stereo/radial modules" << endmsg;
-        continue;
-      }
-    }
-
-
-    const Trk::TrackParameters* TrackParameters = tsos2->trackParameters();
-    if (!TrackParameters) continue;
-    const AmgSymMatrix(5) * covariance = TrackParameters->covariance();
-
-
-    if (covariance == nullptr) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because overlap hit does not have associated measuredTrackParameters" << endmsg;
-      continue;
-    }
-
-    if ((modEta == modEta2 && modPhi != modPhi2) || (modEta - modEta2 == 1 && modPhi == modPhi2)) {
-      //potentially an overlap hit - apply hit quality cuts if tool configured
-      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);
-        if (hit2 == nullptr) {
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because failed hit quality cuts." << endmsg;
-          continue;
-        } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap hit passed quality cuts" << endmsg;
-      } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit quality cuts NOT APPLIED to overlap hit." << endmsg;
-    }
-
-
-    bool close = false; //added by LT
-
-    if (modEta == modEta2 && modPhi != modPhi2) {
-      // begin added by TG
-      // Pixel barrel #phi: 22, 38, 52
-      // Pixel EC #phi: 48
-      // SCT barrel #phi: 32, 40, 48, 56
-      // SCT EC #phi: 52 ???
-      if (modPhi - modPhi2 == 1) {
-        close = true;
-        // Pix barrel special cases
-      } else if ((detType == 0 && barrelEC == 0 && layerDisk == 2) && modPhi - modPhi2 == -51) {
-        close = true;
-      } else if ((detType == 0 && barrelEC == 0 && layerDisk == 1) && modPhi - modPhi2 == -37) {
-        close = true;
-      } else if ((detType == 0 && barrelEC == 0 && layerDisk == 0) && modPhi - modPhi2 == -21) {
-        close = true;
-        // SCT barrel special cases
-      } else if ((detType == 1 && barrelEC == 0 && layerDisk == 3) && modPhi - modPhi2 == -55) {
-        close = true;
-      } else if ((detType == 1 && barrelEC == 0 && layerDisk == 2) && modPhi - modPhi2 == -47) {
-        close = true;
-      } else if ((detType == 1 && barrelEC == 0 && layerDisk == 1) && modPhi - modPhi2 == -39) {
-        close = true;
-      } else if ((detType == 1 && barrelEC == 0 && layerDisk == 0) && modPhi - modPhi2 == -31) {
-        close = true;
-        // Pix EC special cases
-      } else if ((detType == 0 && abs(barrelEC) == 2) && modPhi - modPhi2 == -47) {
-        close = true;
-        // SCT EC special cases: check!!!
-      } else if ((detType == 1 && abs(barrelEC) == 2) && modPhi - modPhi2 == -51) {
-        close = true;
-      }
-      if (close) { //end add by TG
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "***** identified local X overlap" << endmsg;
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "original module phi, eta  = " << modEta << ", " << modPhi << endmsg;
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "second module phi, eta  = " << modEta2 << ", " << modPhi2 << endmsg;
-        xOverlap = (tsos2);
-      } //added by LT
-    }
-    if (modEta - modEta2 == 1 && modPhi == modPhi2) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "***** identified local Y overlap" << endmsg;
-      yOverlap = (tsos2);
-    }
-    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "modEta2 = " << modEta2 << endmsg;
-    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "modPhi2 = " << modPhi2 << endmsg;
-  }
-
-
-
-
-  std::pair <const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> result(xOverlap, yOverlap);
-  return result;
-}
-
-void IDAlignMonEfficiencies::makeTRTHistograms(MonGroup& al_mon, MonGroup& al_mon_ls) {
-  //Make the Barrel histograms
-  makeTRTBarrelHistograms(al_mon, al_mon_ls);
-
-  //Make the Endcap histograms
-  makeTRTEndcapHistograms(al_mon, al_mon_ls);
-}
-
-void IDAlignMonEfficiencies::makePIXBarrelHistograms(MonGroup& al_mon) {
-  m_NPixLayers = m_PIX_Mgr->numerology().numLayers();
-  for (int iLayer = 0; iLayer < m_PIX_Mgr->numerology().numLayers(); ++iLayer) {
-    if (!m_PIX_Mgr->numerology().useLayer(iLayer)) {
-      msg(MSG::WARNING) << "Layer " << iLayer << " Not in Use" << endmsg;
-      continue;
-    }
-    float EtaModules = m_PIX_Mgr->numerology().endEtaModuleForLayer(iLayer) - m_PIX_Mgr->numerology().beginEtaModuleForLayer(iLayer); //(i
-                                                                                                                                      // put
-                                                                                                                                      // float
-                                                                                                                                      // in
-                                                                                                                                      // order
-                                                                                                                                      // to
-                                                                                                                                      // divide
-                                                                                                                                      // by
-                                                                                                                                      // 2)
-    float EtaModulesMin;// = -EtaModules/2-0.5;
-    float EtaModulesMax;// =  EtaModules/2.+0.5; if (iLayer==0) EtaModulesMax--; // IBL eta rings rang from -10 to +9
-    // pixel layers
-    EtaModulesMin = -(EtaModules - 1) / 2 - 0.5;  // so from -6.5 to +6.5 (13 modules)
-    EtaModulesMax = (EtaModules - 1) / 2 + 0.5;
-    // IBL modules
-    if (iLayer == 0) {
-      EtaModules--; // IBL has one ring less total 20: from -10 to +9 (including 0)
-      EtaModulesMin = -EtaModules / 2. - 0.5; // -10.5
-      EtaModulesMax = EtaModules / 2. + 0.5;
-      EtaModulesMax--; // +9.5
-    }
-
-    int maxPhiModulesPerLayer = m_PIX_Mgr->numerology().numPhiModulesForLayer(iLayer);
-    m_measurements_eff_vs_Eta_Phi_pix_b.push_back(new TProfile2D(("measurements_eff_vs_Eta_Phi_pix_b" + intToString(iLayer)).c_str(), ("hit eff. vs. Eta-Phi-ID in Pixel barrel layer" + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax, maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_Eta_Phi_pix_b[iLayer]);
-    //all hits
-    m_hits_vs_Eta_Phi_pix_b.push_back(new TH2F(("hits_vs_Eta_Phi_pix_b" + intToString(iLayer)).c_str(), ("possible hits vs. Eta-Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax, maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_hits_vs_Eta_Phi_pix_b[iLayer]);
-    //hits on track
-    m_measurements_vs_Eta_Phi_pix_b.push_back(new TH2F(("measurements_vs_Eta_Phi_pix_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Eta-Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax, maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_pix_b[iLayer]);
-    //outliers
-    m_outliers_vs_Eta_Phi_pix_b.push_back(new TH2F(("outliers_vs_Eta_Phi_pix_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Eta-Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax, maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_outliers_vs_Eta_Phi_pix_b[iLayer]);
-
-
-
-    //holes
-    m_holes_vs_Eta_Phi_pix_b.push_back(new TH2F(("holes_vs_Eta_Phi_pix_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Eta-Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax, maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_holes_vs_Eta_Phi_pix_b[iLayer]);
-
-
-
-    //hits in barrel by layer
-    m_hits_vs_Phi_pix_b.push_back(new TH1F(("hits_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("possible hits vs. Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_hits_vs_Phi_pix_b[iLayer]);
-    //hits on track by layer
-    m_measurements_vs_Phi_pix_b.push_back(new TH1F(("measurements_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Phi-ID in Pixel barrel layer" + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_measurements_vs_Phi_pix_b[iLayer]);
-    //hits on track by layer Overlap
-
-    if (m_extendedPlots) {
-      m_overlapX_vs_Phi_pix_b.push_back(new TH1F(("overlapX_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("overlapX per possible hits vs. Phi-ID in Pixel barrel layer" + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-      RegisterHisto(al_mon, m_overlapX_vs_Phi_pix_b[iLayer]);
-      m_overlapY_vs_Phi_pix_b.push_back(new TH1F(("overlapY_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("overlapY per possible hits vs. Phi-ID in Pixel barrel layer" + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-      RegisterHisto(al_mon, m_overlapY_vs_Phi_pix_b[iLayer]);
-    }
-    //outliers by layer
-    m_outliers_vs_Phi_pix_b.push_back(new TH1F(("outliers_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_outliers_vs_Phi_pix_b[iLayer]);
-    //holes by layer vs phi
-    m_holes_vs_Phi_pix_b.push_back(new TH1F(("holes_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_holes_vs_Phi_pix_b[iLayer]);
-    //hit efficiency by layer
-    m_measurements_eff_vs_Phi_pix_b.push_back(new TProfile(("measurements_eff_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_Phi_pix_b[iLayer]);
-
-    //hit efficiency vs LB by layer
-
-    m_hits_vs_LB_pix_b.push_back(new TH1F(("hits_vs_LB_pix_b" + intToString(iLayer)).c_str(), ("possible hits vs. LB-ID in PIX barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB));
-    RegisterHisto(al_mon, m_hits_vs_LB_pix_b[iLayer]);
-
-    m_measurements_vs_LB_pix_b.push_back(new TH1F(("measurements_vs_LB_pix_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. LB-ID in PIX barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB));
-    RegisterHisto(al_mon, m_measurements_vs_LB_pix_b[iLayer]);
-
-    m_measurements_eff_vs_LB_pix_b.push_back(new TProfile(("measurements_eff_vs_LB_pix_b" + intToString(iLayer)).c_str(), ("measurements eff per possible hits vs. LB-ID in PIX barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_LB_pix_b[iLayer]);
-
-    //holes vs LB by layer
-    m_holes_vs_LB_pix_b.push_back(new TH1F(("holes_vs_LB_pix_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. LB-ID in PIX barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB));
-    RegisterHisto(al_mon, m_holes_vs_LB_pix_b[iLayer]);
-
-    m_holes_eff_vs_LB_pix_b.push_back(new TProfile(("holes_eff_vs_LB_pix_b" + intToString(iLayer)).c_str(), ("holes eff per possible hits vs. LB-ID in PIX barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-    RegisterHisto(al_mon, m_holes_eff_vs_LB_pix_b[iLayer]);
-
-    //outliers vs LB by layer
-
-    m_outliers_vs_LB_pix_b.push_back(new TH1F(("outliers_vs_LB_pix_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. LB-ID in PIX barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB));
-    RegisterHisto(al_mon, m_outliers_vs_LB_pix_b[iLayer]);
-
-    m_outliers_eff_vs_LB_pix_b.push_back(new TProfile(("outliers_eff_vs_LB_pix_b" + intToString(iLayer)).c_str(), ("outliers eff per possible hits vs. LB-ID in PIX barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-    RegisterHisto(al_mon, m_outliers_eff_vs_LB_pix_b[iLayer]);
-
-
-    //overlap efficiency by layer
-    if (m_extendedPlots) {
-      m_overlapX_eff_vs_Phi_pix_b.push_back(new TProfile(("overlapX_eff_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("overlapX per possible hits vs. Phi-ID in Pixel barrel layer" + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-      RegisterHisto(al_mon, m_overlapX_eff_vs_Phi_pix_b[iLayer]);
-      //overlap efficiency by layer
-      m_overlapY_eff_vs_Phi_pix_b.push_back(new TProfile(("overlapY_eff_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("overlapY per possible hits vs. Phi-ID in Pixel barrel layer" + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-      RegisterHisto(al_mon, m_overlapY_eff_vs_Phi_pix_b[iLayer]);
-    }
-    //outlier eff by layer
-    m_outliers_eff_vs_Phi_pix_b.push_back(new TProfile(("outliers_eff_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-    RegisterHisto(al_mon, m_outliers_eff_vs_Phi_pix_b[iLayer]);
-    //hole frac by layer
-    m_holes_eff_vs_Phi_pix_b.push_back(new TProfile(("holes_eff_vs_Phi_pix_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Phi-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-    RegisterHisto(al_mon, m_holes_eff_vs_Phi_pix_b[iLayer]);
-    //hits vs Eta Layer
-    m_hits_vs_Eta_pix_b.push_back(new TH1F(("hits_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax));
-    RegisterHisto(al_mon, m_hits_vs_Eta_pix_b[iLayer]);
-    //measured hits vs eta
-    m_measurements_vs_Eta_pix_b.push_back(new TH1F(("measurements_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax));
-    RegisterHisto(al_mon, m_measurements_vs_Eta_pix_b[iLayer]);
-    if (m_extendedPlots) {
-      //hits overlap Eta
-      m_overlapX_vs_Eta_pix_b.push_back(new TH1F(("overlapX_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("overlapX per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax));
-      RegisterHisto(al_mon, m_overlapX_vs_Eta_pix_b[iLayer]);
-      m_overlapY_vs_Eta_pix_b.push_back(new TH1F(("overlapY_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("overlapY per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax));
-      RegisterHisto(al_mon, m_overlapY_vs_Eta_pix_b[iLayer]);
-    }
-    //outliers vs Eta
-    m_outliers_vs_Eta_pix_b.push_back(new TH1F(("outliers_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax));
-    RegisterHisto(al_mon, m_outliers_vs_Eta_pix_b[iLayer]);
-    //holes vs eta
-    m_holes_vs_Eta_pix_b.push_back(new TH1F(("holes_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Eta-ID in Pixel barrel layer" + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax));
-    RegisterHisto(al_mon, m_holes_vs_Eta_pix_b[iLayer]);
-    //copy to SCT
-    //measurements eff vs Eta
-    m_measurements_eff_vs_Eta_pix_b.push_back(new TProfile(("measurements_eff_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_Eta_pix_b[iLayer]);
-    if (m_extendedPlots) {
-      //OverlapX eff vs Eta
-      m_overlapX_eff_vs_Eta_pix_b.push_back(new TProfile(("overlapX_eff_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("overlapX per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules, EtaModules, 0., 1.));
-      RegisterHisto(al_mon, m_overlapX_eff_vs_Eta_pix_b[iLayer]);
-      m_overlapY_eff_vs_Eta_pix_b.push_back(new TProfile(("overlapY_eff_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("overlapY per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules, EtaModules, 0., 1.));
-      RegisterHisto(al_mon, m_overlapY_eff_vs_Eta_pix_b[iLayer]);
-    }
-    //Outliers eff vs Eta
-    m_outliers_eff_vs_Eta_pix_b.push_back(new TProfile(("outliers_eff_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax, 0., 1.));
-    RegisterHisto(al_mon, m_outliers_eff_vs_Eta_pix_b[iLayer]);
-    //Holes vs Eta
-    m_holes_eff_vs_Eta_pix_b.push_back(new TProfile(("holes_eff_vs_Eta_pix_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Eta-ID in Pixel barrel layer " + intToString(iLayer)).c_str(), EtaModules, EtaModulesMin, EtaModulesMax, 0., 1.));
-    RegisterHisto(al_mon, m_holes_eff_vs_Eta_pix_b[iLayer]);
-    //hits vs PT
-    m_hits_vs_pT_pix_b.push_back(new TH1F(("hits_vs_pT_pix_b" + intToString(iLayer)).c_str(), ("possible hits vs.pT in Pixel barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100));
-    RegisterHisto(al_mon, m_hits_vs_pT_pix_b[iLayer]);
-    //measurements vs Pt
-    m_measurements_vs_pT_pix_b.push_back(new TH1F(("measurements_vs_pT_pix_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs.pT in Pixel barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100));
-    RegisterHisto(al_mon, m_measurements_vs_pT_pix_b[iLayer]);
-    //outliers vs Pt
-    m_outliers_vs_pT_pix_b.push_back(new TH1F(("outliers_vs_pT_pix_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs.pT in Pixel barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100));
-    RegisterHisto(al_mon, m_outliers_vs_pT_pix_b[iLayer]);
-    //holes vs Pt
-    m_holes_vs_pT_pix_b.push_back(new TH1F(("holes_vs_pT_pix_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs.pT in Pixel barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100));
-    RegisterHisto(al_mon, m_holes_vs_pT_pix_b[iLayer]);
-    //measurement eff vs pT
-    m_measurements_eff_vs_pT_pix_b.push_back(new TProfile(("measurements_eff_vs_pT_pix_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs.pT in Pixel barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_pT_pix_b[iLayer]);
-    //outliers eff vs pT
-    m_outliers_eff_vs_pT_pix_b.push_back(new TProfile(("outliers_eff_vs_pT_pix_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs.pT in Pixel barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100, 0., 1.));
-    RegisterHisto(al_mon, m_outliers_eff_vs_pT_pix_b[iLayer]);
-    //holes eff vs pT
-    m_holes_eff_vs_pT_pix_b.push_back(new TProfile(("holes_eff_vs_pT_pix_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs.pT in Pixel barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100, 0., 1.));
-    RegisterHisto(al_mon, m_holes_eff_vs_pT_pix_b[iLayer]);
-  } //Layer loop
-}
-
-void IDAlignMonEfficiencies::makePIXEndCapsHistograms(MonGroup& al_mon) {
-  for (int iECIndex = 0; iECIndex < m_PIX_Mgr->numerology().numEndcaps(); ++iECIndex) {
-    int iSide = m_PIX_Mgr->numerology().endcapId(iECIndex);
-    for (int iWheel = 0; iWheel < m_PIX_Mgr->numerology().numDisks(); ++iWheel) {
-      int rings = 0;
-      if (!m_PIX_Mgr->numerology().useDisk(iWheel)) {//To check if the Wheel is in use.
-        msg(MSG::WARNING) << "Wheel " << iWheel << " Not in Use" << endmsg;
-        continue;
-      } else {
-        rings = m_PIX_Mgr->numerology().numRingsForDisk(iWheel);
-      }
-      int maxPhiModulesPerRing(0);
-      for (int iEta = 0; iEta < rings; ++iEta) { //actually number of rings for PIX = 1
-        if (maxPhiModulesPerRing < m_PIX_Mgr->numerology().numPhiModulesForDiskRing(iWheel, iEta)) //maybe a !=
-          maxPhiModulesPerRing = m_PIX_Mgr->numerology().numPhiModulesForDiskRing(iWheel, iEta);
-      }
-      if (iSide > 0) {
-        m_hits_vs_Phi_pix_eca.push_back(new TH1F(("hits_vs_Phi_pix_eca" + intToString(iWheel)).c_str(), ("possible hits vs. Phi-ID in Pixel eca Disk " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_hits_vs_Phi_pix_eca[iWheel]);
-
-        //vs LB
-
-        m_hits_vs_LB_pix_eca.push_back(new TH1F(("hits_vs_LB_pix_eca" + intToString(iWheel)).c_str(), ("possible hits vs. LB-ID in Pixel ECA Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB));
-        RegisterHisto(al_mon, m_hits_vs_LB_pix_eca[iWheel]);
-
-        m_measurements_vs_LB_pix_eca.push_back(new TH1F(("measurements_vs_LB_pix_eca" + intToString(iWheel)).c_str(), ("possible measurements vs. LB-ID in Pixel ECA Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB));
-        RegisterHisto(al_mon, m_measurements_vs_LB_pix_eca[iWheel]);
-
-        m_measurements_eff_vs_LB_pix_eca.push_back(new TProfile(("measurements_eff_vs_LB_pix_eca" + intToString(iWheel)).c_str(), ("measurements eff per possible hits vs. LB-ID in PIX Eca Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-        RegisterHisto(al_mon, m_measurements_eff_vs_LB_pix_eca[iWheel]);
-
-        //outliers
-
-        m_outliers_vs_LB_pix_eca.push_back(new TH1F(("outliers_vs_LB_pix_eca" + intToString(iWheel)).c_str(), ("outliers vs. LB-ID in Pixel ECA Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB));
-        RegisterHisto(al_mon, m_outliers_vs_LB_pix_eca[iWheel]);
-
-        m_outliers_eff_vs_LB_pix_eca.push_back(new TProfile(("outliers_eff_vs_LB_pix_eca" + intToString(iWheel)).c_str(), ("outliers eff per possible hits vs. LB-ID in PIX Eca Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-        RegisterHisto(al_mon, m_outliers_eff_vs_LB_pix_eca[iWheel]);
-
-        //holes
-
-        m_holes_vs_LB_pix_eca.push_back(new TH1F(("holes_vs_LB_pix_eca" + intToString(iWheel)).c_str(), ("holes vs. LB-ID in Pixel ECA Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB));
-        RegisterHisto(al_mon, m_holes_vs_LB_pix_eca[iWheel]);
-
-        m_holes_eff_vs_LB_pix_eca.push_back(new TProfile(("holes_eff_vs_LB_pix_eca" + intToString(iWheel)).c_str(), ("holes eff per possible hits vs. LB-ID in PIX Eca Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-        RegisterHisto(al_mon, m_holes_eff_vs_LB_pix_eca[iWheel]);
-
-
-
-        if (m_extendedPlots) {
-          //overlaps by layer
-          m_overlapY_vs_Phi_pix_eca.push_back(new  TH1F(("overlapY_vs_Phi_pix_eca" + intToString(iWheel)).c_str(), (" Y Overlap Eff. vs. Phi-ID in Pixel eca layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-          RegisterHisto(al_mon, m_overlapY_vs_Phi_pix_eca[iWheel]);
-          m_overlapX_vs_Phi_pix_eca.push_back(new  TH1F(("overlapX_vs_Phi_pix_eca" + intToString(iWheel)).c_str(), (" X Overlap Eff. vs. Phi-ID in Pixel eca layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-          RegisterHisto(al_mon, m_overlapX_vs_Phi_pix_eca[iWheel]);
-
-          m_overlapX_eff_vs_Phi_pix_eca.push_back(new  TProfile(("overlapX_eff_vs_Phi_pix_eca" + intToString(iWheel)).c_str(), ("overlapX per possible hits vs. Phi-ID in Pixel eca layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5, 0., 1.));
-          RegisterHisto(al_mon, m_overlapX_eff_vs_Phi_pix_eca[iWheel]);
-          m_overlapY_eff_vs_Phi_pix_eca.push_back(new  TProfile(("overlapY_eff_vs_Phi_pix_eca" + intToString(iWheel)).c_str(), ("overlapY per possible hits vs. Phi-ID in Pixel eca layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5, 0., 1.));
-          RegisterHisto(al_mon, m_overlapY_eff_vs_Phi_pix_eca[iWheel]);
-        }
-        //hits on track for endcaps
-        m_measurements_vs_Phi_pix_eca.push_back(new  TH1F(("measurements_vs_Phi_pix_eca" + intToString(iWheel)).c_str(), ("possible measurements vs. Phi-ID in Pixel eca layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_measurements_vs_Phi_pix_eca[iWheel]);
-        //efficiencies for endcaps
-        m_measurements_eff_vs_Phi_pix_eca.push_back(new  TProfile(("measurements_eff_vs_Phi_pix_eca" + intToString(iWheel)).c_str(), ("measurements per possible hits vs. Phi-ID in Pixel eca layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5, 0., 1.));
-        RegisterHisto(al_mon, m_measurements_eff_vs_Phi_pix_eca[iWheel]);
-      }
-      if (iSide < 0) {
-        //hits for endcaps
-        m_hits_vs_Phi_pix_ecc.push_back(new TH1F(("hits_vs_Phi_pix_ecc" + intToString(iWheel)).c_str(), ("possible hits vs. Phi-ID in Pixel ecc layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_hits_vs_Phi_pix_ecc[iWheel]);
-
-        //vs LB
-
-        m_hits_vs_LB_pix_ecc.push_back(new TH1F(("hits_vs_LB_pix_ecc" + intToString(iWheel)).c_str(), ("possible hits vs. LB-ID in Pixel ECC  Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB));
-        RegisterHisto(al_mon, m_hits_vs_LB_pix_ecc[iWheel]);
-
-        m_measurements_vs_LB_pix_ecc.push_back(new TH1F(("measurements_vs_LB_pix_ecc" + intToString(iWheel)).c_str(), ("possible measurements vs. LB-ID in Pixel ECC Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB));
-        RegisterHisto(al_mon, m_measurements_vs_LB_pix_ecc[iWheel]);
-
-        m_measurements_eff_vs_LB_pix_ecc.push_back(new TProfile(("measurements_eff_vs_LB_pix_ecc" + intToString(iWheel)).c_str(), ("measurements eff per possible hits vs. LB-ID in PIX Ecc Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-        RegisterHisto(al_mon, m_measurements_eff_vs_LB_pix_ecc[iWheel]);
-
-        //outliers
-
-        m_outliers_vs_LB_pix_ecc.push_back(new TH1F(("outliers_vs_LB_pix_ecc" + intToString(iWheel)).c_str(), ("outliers vs. LB-ID in Pixel ECC Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB));
-        RegisterHisto(al_mon, m_outliers_vs_LB_pix_ecc[iWheel]);
-
-        m_outliers_eff_vs_LB_pix_ecc.push_back(new TProfile(("outliers_eff_vs_LB_pix_ecc" + intToString(iWheel)).c_str(), ("outliers eff per possible hits vs. LB-ID in PIX Ecc Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-        RegisterHisto(al_mon, m_outliers_eff_vs_LB_pix_ecc[iWheel]);
-
-        //holes
-
-        m_holes_vs_LB_pix_ecc.push_back(new TH1F(("holes_vs_LB_pix_ecc" + intToString(iWheel)).c_str(), ("holes vs. LB-ID in Pixel ECC Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB));
-        RegisterHisto(al_mon, m_holes_vs_LB_pix_ecc[iWheel]);
-
-        m_holes_eff_vs_LB_pix_ecc.push_back(new TProfile(("holes_eff_vs_LB_pix_ecc" + intToString(iWheel)).c_str(), ("holes eff per possible hits vs. LB-ID in PIX Ecc Disk " + intToString(iWheel)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-        RegisterHisto(al_mon, m_holes_eff_vs_LB_pix_ecc[iWheel]);
-
-
-        if (m_extendedPlots) {
-          //overlaps by layer
-          m_overlapY_vs_Phi_pix_ecc.push_back(new  TH1F(("overlapY_vs_Phi_pix_ecc" + intToString(iWheel)).c_str(), (" Y Overlap Eff. vs. Phi-ID in Pixel ecc layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-          RegisterHisto(al_mon, m_overlapY_vs_Phi_pix_ecc[iWheel]);
-          m_overlapX_vs_Phi_pix_ecc.push_back(new  TH1F(("overlapX_vs_Phi_pix_ecc" + intToString(iWheel)).c_str(), (" X Overlap Eff. vs. Phi-ID in Pixel ecc layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-          RegisterHisto(al_mon, m_overlapX_vs_Phi_pix_ecc[iWheel]);
-          m_overlapX_eff_vs_Phi_pix_ecc.push_back(new  TProfile(("overlapX_eff_vs_Phi_pix_ecc" + intToString(iWheel)).c_str(), ("overlapX per possible hits vs. Phi-ID in Pixel ecc layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5, 0., 1.));
-          RegisterHisto(al_mon, m_overlapX_eff_vs_Phi_pix_ecc[iWheel]);
-          m_overlapY_eff_vs_Phi_pix_ecc.push_back(new  TProfile(("overlapY_eff_vs_Phi_pix_ecc" + intToString(iWheel)).c_str(), ("overlapY per possible hits vs. Phi-ID in Pixel ecc layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5, 0., 1.));
-          RegisterHisto(al_mon, m_overlapY_eff_vs_Phi_pix_ecc[iWheel]);
-        }
-
-
-
-        //hits on track for endcaps
-        m_measurements_vs_Phi_pix_ecc.push_back(new  TH1F(("measurements_vs_Phi_pix_ecc" + intToString(iWheel)).c_str(), ("possible measurements vs. Phi-ID in Pixel ecc layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_measurements_vs_Phi_pix_ecc[iWheel]);
-        //efficiencies for endcaps
-        m_measurements_eff_vs_Phi_pix_ecc.push_back(new  TProfile(("measurements_eff_vs_Phi_pix_ecc" + intToString(iWheel)).c_str(), ("measurements per possible hits vs. Phi-ID in Pixel ecc layer " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5, 0., 1.));
-        RegisterHisto(al_mon, m_measurements_eff_vs_Phi_pix_ecc[iWheel]);
-      }
-    }
-  }
-}
-
-void IDAlignMonEfficiencies::makeSCTBarrelHistograms(MonGroup& al_mon) {
-  for (int iLayer = 0; iLayer < m_SCT_Mgr->numerology().numLayers(); ++iLayer) {
-    //ATH_MSG_INFO("iLayer= " << iLayer);
-    if (!m_SCT_Mgr->numerology().useLayer(iLayer)) {
-      msg(MSG::WARNING) << "Layer " << iLayer << " Not Present" << endmsg;
-      continue;
-    }
-    float maxPhiModulesPerLayer = m_SCT_Mgr->numerology().numPhiModulesForLayer(iLayer);
-    //just for checking purposes. Not useful. I will cancel it soon. Peo
-    for (int iEta = m_SCT_Mgr->numerology().beginEtaModuleForLayer(iLayer); iEta < m_SCT_Mgr->numerology().endEtaModuleForLayer(iLayer); ++iEta) {
-      if (!iEta && m_SCT_Mgr->numerology().skipEtaZeroForLayer(iLayer))
-        //iEta=0 is not defined for the SCT
-        continue;
-      //ATH_MSG_INFO("iEta= " << iEta);
-    }
-    float EtaModules = m_SCT_Mgr->numerology().endEtaModuleForLayer(iLayer) - m_SCT_Mgr->numerology().beginEtaModuleForLayer(iLayer); //(i
-                                                                                                                                      // put
-                                                                                                                                      // float
-                                                                                                                                      // in
-                                                                                                                                      // order
-                                                                                                                                      // to
-                                                                                                                                      // divide
-                                                                                                                                      // by
-                                                                                                                                      // 2.
-                                                                                                                                      // I
-                                                                                                                                      // am
-                                                                                                                                      // not
-                                                                                                                                      // skipping
-                                                                                                                                      // the
-                                                                                                                                      // empty
-                                                                                                                                      // layer.
-                                                                                                                                      // It
-                                                                                                                                      // might
-                                                                                                                                      // be
-                                                                                                                                      // nice
-                                                                                                                                      // to
-                                                                                                                                      // see
-                                                                                                                                      // the
-                                                                                                                                      // separation)
-    m_measurements_eff_vs_Eta_Phi_sct_b.push_back(new TProfile2D(("measurements_eff_vs_Eta_Phi_sct_b" + intToString(iLayer)).c_str(), ("hit eff. vs. Eta-Phi-ID in Sct barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_Eta_Phi_sct_b[iLayer]);
-    //all hits
-    m_hits_vs_Eta_Phi_sct_b.push_back(new TH2F(("hits_vs_Eta_Phi_sct_b" + intToString(iLayer)).c_str(), ("possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_hits_vs_Eta_Phi_sct_b[iLayer]);
-    //hits on track
-    m_measurements_vs_Eta_Phi_sct_b.push_back(new TH2F(("measurements_vs_Eta_Phi_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_b[iLayer]);
-
-
-    m_hits_vs_LB_sct_b.push_back(new TH1F(("hits_vs_LB_sct_b" + intToString(iLayer)).c_str(), ("hits per possible hits vs. LB-ID in SCT barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB));
-    RegisterHisto(al_mon, m_hits_vs_LB_sct_b[iLayer]);
-
-    m_measurements_vs_LB_sct_b.push_back(new TH1F(("measurements_vs_LB_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. LB-ID in SCT barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB));
-    RegisterHisto(al_mon, m_measurements_vs_LB_sct_b[iLayer]);
-
-    m_measurements_eff_vs_LB_sct_b.push_back(new TProfile(("measurements_eff_vs_LB_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. LB-ID in SCT barrel layer " + intToString(iLayer)).c_str(), m_nLB, m_minLB, m_maxLB, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_LB_sct_b[iLayer]);
-
-
-
-
-
-    for (int side = 0; side < 2; side++) {
-      if (side == 0) {
-        // posible hits
-        m_hits_vs_Eta_Phi_sct_s0_b.push_back(new TH2F(("expectedHits_vs_Eta_Phi_sct_b" + intToString(iLayer) + "_s" + intToString(side)).c_str(), ("measurements per possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer) + " side " + intToString(side)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-        RegisterHisto(al_mon, m_hits_vs_Eta_Phi_sct_s0_b[iLayer]);
-        // measurements = seen hits
-        m_measurements_vs_Eta_Phi_sct_s0_b.push_back(new TH2F(("measurements_vs_Eta_Phi_sct_b" + intToString(iLayer) + "_s" + intToString(side)).c_str(), ("measurements per possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer) + " side " + intToString(side)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-        RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_s0_b[iLayer]);
-        // efficiency
-        m_measurements_eff_vs_Eta_Phi_sct_s0_b.push_back(new TProfile2D(("measurements_eff_vs_Eta_Phi_sct_b" + intToString(iLayer) + "_s" + intToString(side)).c_str(), ("measurements per possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer) + " side " + intToString(side)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-        RegisterHisto(al_mon, m_measurements_eff_vs_Eta_Phi_sct_s0_b[iLayer]);
-      }
-      if (side == 1) {
-        // posible hits
-        m_hits_vs_Eta_Phi_sct_s1_b.push_back(new TH2F(("expectedHits_vs_Eta_Phi_sct_b" + intToString(iLayer) + "_s" + intToString(side)).c_str(), ("measurements per possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer) + " side " + intToString(side)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-        RegisterHisto(al_mon, m_hits_vs_Eta_Phi_sct_s1_b[iLayer]);
-        // measurements = seen hits
-        m_measurements_vs_Eta_Phi_sct_s1_b.push_back(new TH2F(("measurements_vs_Eta_Phi_sct_b" + intToString(iLayer) + "_s" + intToString(side)).c_str(), ("measurements per possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer) + " side " + intToString(side)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-        RegisterHisto(al_mon, m_measurements_vs_Eta_Phi_sct_s1_b[iLayer]);
-        // efficiency
-        m_measurements_eff_vs_Eta_Phi_sct_s1_b.push_back(new TProfile2D(("measurements_eff_vs_Eta_Phi_sct_b" + intToString(iLayer) + "_s" + intToString(side)).c_str(), ("measurements per possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer) + " side " + intToString(side)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-        RegisterHisto(al_mon, m_measurements_eff_vs_Eta_Phi_sct_s1_b[iLayer]);
-      }
-    }
-
-    //outliers
-    m_outliers_vs_Eta_Phi_sct_b.push_back(new TH2F(("outliers_vs_Eta_Phi_sct_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Eta-Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_outliers_vs_Eta_Phi_sct_b[iLayer]);
-    //holes
-    m_holes_vs_Eta_Phi_sct_b.push_back(new TH2F(("holes_vs_Eta_Phi_sct_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Eta-Phi-ID in SCT barrel layer" + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_holes_vs_Eta_Phi_sct_b[iLayer]);
-    //hits in barrel by layer
-    m_hits_vs_Phi_sct_b.push_back(new TH1F(("hits_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("possible hits vs. Phi-ID in SCT barrel layer" + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_hits_vs_Phi_sct_b[iLayer]);
-    //hits on track by layer
-    m_measurements_vs_Phi_sct_b.push_back(new TH1F(("measurements_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_measurements_vs_Phi_sct_b[iLayer]);
-    if (m_extendedPlots) {
-      //hits on track by layer Overlap
-      m_overlapX_vs_Phi_sct_b.push_back(new TH1F(("overlapX_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("overlapX per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-      RegisterHisto(al_mon, m_overlapX_vs_Phi_sct_b[iLayer]);
-      m_overlapY_vs_Phi_sct_b.push_back(new TH1F(("overlapY_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("overlapY per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-      RegisterHisto(al_mon, m_overlapY_vs_Phi_sct_b[iLayer]);
-      //overlap efficiency by layer
-      m_overlapX_eff_vs_Phi_sct_b.push_back(new TProfile(("overlapX_eff_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("overlapX per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-      RegisterHisto(al_mon, m_overlapX_eff_vs_Phi_sct_b[iLayer]);
-      m_overlapY_eff_vs_Phi_sct_b.push_back(new TProfile(("overlapY_eff_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("overlapY per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-      RegisterHisto(al_mon, m_overlapY_eff_vs_Phi_sct_b[iLayer]);
-    }
-    //outliers by layer
-    m_outliers_vs_Phi_sct_b.push_back(new TH1F(("outliers_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_outliers_vs_Phi_sct_b[iLayer]);
-    //holes by layer
-    m_holes_vs_Phi_sct_b.push_back(new TH1F(("holes_vs_Phi_sct_b3" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5));
-    RegisterHisto(al_mon, m_holes_vs_Phi_sct_b[iLayer]);
-    //hit efficiency by layer
-    m_measurements_eff_vs_Phi_sct_b.push_back(new TProfile(("measurements_eff_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_Phi_sct_b[iLayer]);
-    //outliers eff by layer
-    m_outliers_eff_vs_Phi_sct_b.push_back(new TProfile(("outliers_eff_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-    RegisterHisto(al_mon, m_outliers_eff_vs_Phi_sct_b[iLayer]);
-    //hole frac by layer
-    m_holes_eff_vs_Phi_sct_b.push_back(new TProfile(("holes_eff_vs_Phi_sct_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Phi-ID in SCT barrel layer " + intToString(iLayer)).c_str(), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 0., 1.));
-    RegisterHisto(al_mon, m_holes_eff_vs_Phi_sct_b[iLayer]);
-    //hits vs Eta Layer
-    m_hits_vs_Eta_sct_b.push_back(new TH1F(("hits_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2.));
-    RegisterHisto(al_mon, m_hits_vs_Eta_sct_b[iLayer]);
-    //measured hits vs eta
-    m_measurements_vs_Eta_sct_b.push_back(new TH1F(("measurements_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2.));
-    RegisterHisto(al_mon, m_measurements_vs_Eta_sct_b[iLayer]);
-    if (m_extendedPlots) {
-      //hits overlap Eta
-      m_overlapX_vs_Eta_sct_b.push_back(new TH1F(("overlapX_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("overlapX per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2.));
-      RegisterHisto(al_mon, m_overlapX_vs_Eta_sct_b[iLayer]);
-      m_overlapY_vs_Eta_sct_b.push_back(new TH1F(("overlapY_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("overlapY per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2.));
-      RegisterHisto(al_mon, m_overlapY_vs_Eta_sct_b[iLayer]);
-      //OverlapX eff vs Eta
-      m_overlapX_eff_vs_Eta_sct_b.push_back(new TProfile(("overlapX_eff_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("overlapX per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules, EtaModules, 0., 1.));
-      RegisterHisto(al_mon, m_overlapX_eff_vs_Eta_sct_b[iLayer]);
-      m_overlapY_eff_vs_Eta_sct_b.push_back(new TProfile(("overlapY_eff_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("overlapY per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules, EtaModules, 0., 1.));
-      RegisterHisto(al_mon, m_overlapY_eff_vs_Eta_sct_b[iLayer]);
-    }
-    //outliers vs eta
-    m_outliers_vs_Eta_sct_b.push_back(new TH1F(("outliers_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2.));
-    RegisterHisto(al_mon, m_outliers_vs_Eta_sct_b[iLayer]);
-    //holes vs eta
-    m_holes_vs_Eta_sct_b.push_back(new TH1F(("holes_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Eta-ID in SCT barrel layer" + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2.));
-    RegisterHisto(al_mon, m_holes_vs_Eta_sct_b[iLayer]);
-    //measurements eff vs Eta
-    m_measurements_eff_vs_Eta_sct_b.push_back(new TProfile(("measurements_eff_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_Eta_sct_b[iLayer]);
-
-    //Outliers eff vs Eta
-    m_outliers_eff_vs_Eta_sct_b.push_back(new TProfile(("outliers_eff_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., 0., 1.));
-    RegisterHisto(al_mon, m_outliers_eff_vs_Eta_sct_b[iLayer]);
-    //Holes vs Eta
-    m_holes_eff_vs_Eta_sct_b.push_back(new TProfile(("holes_eff_vs_Eta_sct_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs. Eta-ID in SCT barrel layer " + intToString(iLayer)).c_str(), EtaModules, -EtaModules / 2., EtaModules / 2., 0., 1.));
-    RegisterHisto(al_mon, m_holes_eff_vs_Eta_sct_b[iLayer]);
-    //hits vs PT
-    m_hits_vs_pT_sct_b.push_back(new TH1F(("hits_vs_pT_sct_b" + intToString(iLayer)).c_str(), ("possible hits vs.pT in SCT barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100));
-    RegisterHisto(al_mon, m_hits_vs_pT_sct_b[iLayer]);
-    //measurements vs Pt
-    m_measurements_vs_pT_sct_b.push_back(new TH1F(("measurements_vs_pT_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs.pT in SCT barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100));
-    RegisterHisto(al_mon, m_measurements_vs_pT_sct_b[iLayer]);
-    //outliers vs Pt
-    m_outliers_vs_pT_sct_b.push_back(new TH1F(("outliers_vs_pT_sct_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs.pT in SCT barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100));
-    RegisterHisto(al_mon, m_outliers_vs_pT_sct_b[iLayer]);
-    //holes vs Pt
-    m_holes_vs_pT_sct_b.push_back(new TH1F(("holes_vs_pT_sct_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs.pT in SCT barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100));
-    RegisterHisto(al_mon, m_holes_vs_pT_sct_b[iLayer]);
-    //measurement eff vs pT
-    m_measurements_eff_vs_pT_sct_b.push_back(new TProfile(("measurements_eff_vs_pT_sct_b" + intToString(iLayer)).c_str(), ("measurements per possible hits vs.pT in SCT barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100, 0., 1.));
-    RegisterHisto(al_mon, m_measurements_eff_vs_pT_sct_b[iLayer]);
-    //outliers eff vs pT
-    m_outliers_eff_vs_pT_sct_b.push_back(new TProfile(("outliers_eff_vs_pT_sct_b" + intToString(iLayer)).c_str(), ("outliers per possible hits vs.pT in SCT barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100, 0., 1.));
-    RegisterHisto(al_mon, m_outliers_eff_vs_pT_sct_b[iLayer]);
-    //holes eff vs pT
-    m_holes_eff_vs_pT_sct_b.push_back(new TProfile(("holes_eff_vs_pT_sct_b" + intToString(iLayer)).c_str(), ("holes per possible hits vs.pT in SCT barrel layer " + intToString(iLayer)).c_str(), 100, -100, 100, 0., 1.));
-    RegisterHisto(al_mon, m_holes_eff_vs_pT_sct_b[iLayer]);
-  }
-}
-
-void IDAlignMonEfficiencies::makeSCTEndCapsHistograms(MonGroup& al_mon) {
-  for (int iECIndex = 0; iECIndex < m_SCT_Mgr->numerology().numEndcaps(); ++iECIndex) {
-    int iSide = m_SCT_Mgr->numerology().endcapId(iECIndex);
-    for (int iWheel = 0; iWheel < m_SCT_Mgr->numerology().numDisks(); ++iWheel) {
-      int rings = 0;
-      if (!m_SCT_Mgr->numerology().useDisk(iWheel)) {//To check if the Wheel is in use.
-        msg(MSG::WARNING) << "Wheel " << iWheel << " Not in Use" << endmsg;
-        continue;
-      } else {
-        rings = m_SCT_Mgr->numerology().numRingsForDisk(iWheel);
-      }
-      int maxModulesPerRing(0);
-      for (int iEta = 0; iEta < rings; ++iEta) { //iEta<m_SCT_Mgr->numerology().numRingsForDisk(iWheel);
-        if (maxModulesPerRing < m_SCT_Mgr->numerology().numPhiModulesForDiskRing(iWheel, iEta)) //maybe a !=
-          maxModulesPerRing = m_SCT_Mgr->numerology().numPhiModulesForDiskRing(iWheel, iEta);
-      }
-      if (iSide > 0) { //ECA
-        m_hits_vs_Phi_sct_eca.push_back(new TH1F(("hits_vs_Phi_sct_eca" + intToString(iWheel)).c_str(), ("possible hits vs. Phi-ID in SCT eca layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_hits_vs_Phi_sct_eca[iWheel]);
-        if (m_extendedPlots) {
-          m_overlapX_vs_Phi_sct_eca.push_back(new TH1F(("overlapX_vs_Phi_sct_eca" + intToString(iWheel)).c_str(), (" X Overlap Eff. vs. Phi-ID in SCT eca layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5));
-          RegisterHisto(al_mon, m_overlapX_vs_Phi_sct_eca[iWheel]);
-          m_overlapY_vs_Phi_sct_eca.push_back(new TH1F(("overlapY_vs_Phi_sct_eca" + intToString(iWheel)).c_str(), (" Y Overlap Eff. vs. Phi-ID in SCT eca layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5));
-          RegisterHisto(al_mon, m_overlapY_vs_Phi_sct_eca[iWheel]);
-          m_overlapX_eff_vs_Phi_sct_eca.push_back(new TProfile(("overlapX_eff_vs_Phi_sct_eca" + intToString(iWheel)).c_str(), ("overlapX per possible hits vs. Phi-ID in SCT eca layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5, 0., 1.));
-          RegisterHisto(al_mon, m_overlapX_eff_vs_Phi_sct_eca[iWheel]);
-          m_overlapY_eff_vs_Phi_sct_eca.push_back(new TProfile(("overlapY_eff_vs_Phi_sct_eca" + intToString(iWheel)).c_str(), ("overlapY per possible hits vs. Phi-ID in SCT eca layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5, 0., 1.));
-          RegisterHisto(al_mon, m_overlapY_eff_vs_Phi_sct_eca[iWheel]);
-        }
-
-        m_measurements_vs_Phi_sct_eca.push_back(new TH1F(("measurements_vs_Phi_sct_eca" + intToString(iWheel)).c_str(), ("possible measurements vs. Phi-ID in SCT eca layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_measurements_vs_Phi_sct_eca[iWheel]);
-        m_measurements_eff_vs_Phi_sct_eca.push_back(new TProfile(("measurements_eff_vs_Phi_sct_eca" + intToString(iWheel)).c_str(), ("measurements per possible hits vs. Phi-ID in SCT eca layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5, 0., 1.));
-        RegisterHisto(al_mon, m_measurements_eff_vs_Phi_sct_eca[iWheel]);
-      } else if (iSide < 0) { //ECC
-        m_hits_vs_Phi_sct_ecc.push_back(new TH1F(("hits_vs_Phi_sct_ecc" + intToString(iWheel)).c_str(), ("possible hits vs. Phi-ID in SCT ecc layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_hits_vs_Phi_sct_ecc[iWheel]);
-        if (m_extendedPlots) {
-          m_overlapX_vs_Phi_sct_ecc.push_back(new TH1F(("overlapX_vs_Phi_sct_ecc" + intToString(iWheel)).c_str(), (" X Overlap Eff. vs. Phi-ID in SCT ecc layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5));
-          RegisterHisto(al_mon, m_overlapX_vs_Phi_sct_ecc[iWheel]);
-          m_overlapY_vs_Phi_sct_ecc.push_back(new TH1F(("overlapY_vs_Phi_sct_ecc" + intToString(iWheel)).c_str(), (" Y Overlap Eff. vs. Phi-ID in SCT ecc layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5));
-          RegisterHisto(al_mon, m_overlapY_vs_Phi_sct_ecc[iWheel]);
-          m_overlapX_eff_vs_Phi_sct_ecc.push_back(new TProfile(("overlapX_eff_vs_Phi_sct_ecc" + intToString(iWheel)).c_str(), ("overlapX per possible hits vs. Phi-ID in SCT ecc layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5, 0., 1.));
-          RegisterHisto(al_mon, m_overlapX_eff_vs_Phi_sct_ecc[iWheel]);
-          m_overlapY_eff_vs_Phi_sct_ecc.push_back(new TProfile(("overlapY_eff_vs_Phi_sct_ecc" + intToString(iWheel)).c_str(), ("overlapY per possible hits vs. Phi-ID in SCT ecc layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5, 0., 1.));
-          RegisterHisto(al_mon, m_overlapY_eff_vs_Phi_sct_ecc[iWheel]);
-        }
-
-        m_measurements_vs_Phi_sct_ecc.push_back(new TH1F(("measurements_vs_Phi_sct_ecc" + intToString(iWheel)).c_str(), ("possible measurements vs. Phi-ID in SCT ecc layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_measurements_vs_Phi_sct_ecc[iWheel]);
-        m_measurements_eff_vs_Phi_sct_ecc.push_back(new TProfile(("measurements_eff_vs_Phi_sct_ecc" + intToString(iWheel)).c_str(), ("measurements per possible hits vs. Phi-ID in SCT ecc layer " + intToString(iWheel)).c_str(), maxModulesPerRing, -0.5, maxModulesPerRing - 0.5, 0., 1.));
-        RegisterHisto(al_mon, m_measurements_eff_vs_Phi_sct_ecc[iWheel]);
-      }
-    }
-  }
-
-  //vs LB
-
-  m_hits_vs_LB_sct_eca = new TH1F("hits_vs_LB_sct_eca", "measurements per possible hits vs. LB-ID in SCT ECA", m_nLB, m_minLB, m_maxLB);
-  RegisterHisto(al_mon, m_hits_vs_LB_sct_eca);
-  m_measurements_vs_LB_sct_eca = new TH1F("measurements_vs_LB_sct_eca", "measurements per possible hits vs. LB-ID in SCT ECA", m_nLB, m_minLB, m_maxLB);
-  RegisterHisto(al_mon, m_measurements_vs_LB_sct_eca);
-  m_measurements_eff_vs_LB_sct_eca = new TProfile("measurements_eff_vs_LB_sct_eca", "measurements per possible hits vs. LB-ID in SCT ECA", m_nLB, m_minLB, m_maxLB, 0., 1.);
-  RegisterHisto(al_mon, m_measurements_eff_vs_LB_sct_eca);
-
-  //vs LB
-
-
-  m_hits_vs_LB_sct_ecc = new TH1F("hits_vs_LB_sct_ecc", "hits vs. LB-ID in SCT ECC disk", m_nLB, m_minLB, m_maxLB);
-  RegisterHisto(al_mon, m_hits_vs_LB_sct_ecc);
-  m_measurements_vs_LB_sct_ecc = new TH1F("measurements_vs_LB_sct_ecc", "measurements per possible hits vs. LB-ID in SCT ECC", m_nLB, m_minLB, m_maxLB);
-  RegisterHisto(al_mon, m_measurements_vs_LB_sct_ecc);
-  m_measurements_eff_vs_LB_sct_ecc = new TProfile("measurements_eff_vs_LB_sct_ecc", "measurements per possible hits vs. LB-ID in SCT ECC", m_nLB, m_minLB, m_maxLB, 0., 1.);
-  RegisterHisto(al_mon, m_measurements_eff_vs_LB_sct_ecc);
-}
-
-void IDAlignMonEfficiencies::makeTRTBarrelHistograms(MonGroup& al_mon, MonGroup& al_mon_ls) {
-  /** Barrel plots
-     //==================== */
-
-  for (int lay = 0; lay < 3; lay++) {
-    /** outliers in the barrel modules */
-    m_trt_b_hist->outliers_vs_phiSector[lay] = MakeHist("outliers_vs_phiSector_trt_b" + intToString(lay), "Outliers vrs phi sector for Barrel layer " + intToString(lay), 32, 0, 32, "Phi Sector", "Outliers");
-    RegisterHisto(al_mon, m_trt_b_hist->outliers_vs_phiSector[lay]);
-
-    m_trt_b_hist->outliers_eff_vs_phiSector[lay] = MakeProfile("outliers_eff_vs_phiSector_trt_b" + intToString(lay), "Ratio Outliers to total measurements vrs phi sector for TRT Barrel layer " + intToString(lay), 32, 0, 32, 0., 1., "Phi Sector", "Ratio of Outliers to Total Measurements");
-    RegisterHisto(al_mon, m_trt_b_hist->outliers_eff_vs_phiSector[lay], "Fraction of Outliers");
-
-    /** hits in the barrel modules */
-    m_trt_b_hist->hits_vs_phiSector[lay] = MakeHist("hits_vs_phiSector_trt_b" + intToString(lay), "Hits vrs phi sector for TRT Barrel layer " + intToString(lay), 32, 0, 32, "Phi Sector", "Number of Hits");
-    RegisterHisto(al_mon, m_trt_b_hist->hits_vs_phiSector[lay]);
-
-    m_trt_b_hist->hits_eff_vs_phiSector[lay] = MakeProfile("hits_eff_vs_phiSector_trt_b" + intToString(lay), "Ratio Hits to total measurements vrs phi sector for TRT Barrel layer " + intToString(lay), 32, 0, 32, 0., 1., "Phi Sector", "Ratio of Hits to Total Measurements");
-    RegisterHisto(al_mon_ls, m_trt_b_hist->hits_eff_vs_phiSector[lay], "Fraction of Precision Hits");
-
-    /** tube hits in the barrel modules */
-    m_trt_b_hist->tubeHits_vs_phiSector[lay] = MakeHist("tubeHits_vs_phiSector_trt_b" + intToString(lay), "Tube Hits vrs phi sector for TRT Barrel layer " + intToString(lay), 32, 0, 32, "Phi Sector", "Number of Tube Hits");
-    RegisterHisto(al_mon, m_trt_b_hist->tubeHits_vs_phiSector[lay]);
-
-    m_trt_b_hist->tubeHits_eff_vs_phiSector[lay] = MakeProfile("tubeHits_eff_vs_phiSector_trt_b" + intToString(lay), "Ratio Tube Hits to total measurements vrs phi sector for TRT Barrel layer " + intToString(lay), 32, 0, 32, 0., 1., "Phi Sector", "Ratio of Tube Hits to Total Measurements");
-    RegisterHisto(al_mon, m_trt_b_hist->tubeHits_eff_vs_phiSector[lay], "Fraction of TubeHits");
-
-    /** Total measurements in the barrel modules */
-    m_trt_b_hist->totHits_vs_phiSector[lay] = MakeHist("totHist_vs_phiSector_trt_b" + intToString(lay), "Total Hits vrs phi sector for TRT Barrel layer " + intToString(lay), 32, 0, 32, "Phi Sector", "Number of Total Hits");
-    RegisterHisto(al_mon, m_trt_b_hist->totHits_vs_phiSector[lay]);
-  }
-
-  m_trt_b_hist->outliers_vs_StrawLay = MakeHist("outliers_vs_StrawLayer_trt_b", "Outliers vrs Straw Layer (Intergrated over Phi) for Barrel layer ", 73, 0, 73, "Straw Layer", "Outliers");
-
-  RegisterHisto(al_mon, m_trt_b_hist->outliers_vs_StrawLay);
-
-  m_trt_b_hist->outliers_eff_vs_StrawLay = MakeProfile("outliers_eff_vs_StrawLayer_trt_b", "Ratio Outliers to total measurements vrs Straw Layer (Intergrated over Phi)  for TRT Barrel layer ", 73, 0, 73, 0., 1., "Straw Layer", "Ratio of Outliers to Total Measurements");
-  RegisterHisto(al_mon, m_trt_b_hist->outliers_eff_vs_StrawLay, "Fraction of Outliers");
-
-  m_trt_b_hist->hits_vs_StrawLay = MakeHist("hits_vs_StrawLayer_trt_b", "Hits vrs Straw Layer (Intergrated over Phi) for Barrel layer ", 73, 0, 73, "Straw Layer", "Hits");
-  RegisterHisto(al_mon, m_trt_b_hist->hits_vs_StrawLay);
-
-  m_trt_b_hist->hits_eff_vs_StrawLay = MakeProfile("hits_eff_vs_StrawLayer_trt_b", "Ratio Hits to total measurements vrs Straw Layer (Intergrated over Phi)  for TRT Barrel layer ", 73, 0, 73, 0., 1., "Straw Layer", "Ratio of Hits to Total Measurements");
-  RegisterHisto(al_mon, m_trt_b_hist->hits_eff_vs_StrawLay, "Fraction of Precision Hits");
-
-  m_trt_b_hist->tubeHits_vs_StrawLay = MakeHist("tubeHits_vs_StrawLayer_trt_b", "TubeHits vrs Straw Layer (Intergrated over Phi) for Barrel layer ", 73, 0, 73, "Straw Layer", "TubeHits");
-  RegisterHisto(al_mon, m_trt_b_hist->tubeHits_vs_StrawLay);
-
-  m_trt_b_hist->tubeHits_eff_vs_StrawLay = MakeProfile("tubeHits_eff_vs_StrawLayer_trt_b", "Ratio TubeHits to total measurements vrs Straw Layer (Intergrated over Phi)  for TRT Barrel layer ", 73, 0, 73, 0., 1., "Straw Layer", "Ratio of TubeHits to Total Measurements");
-  RegisterHisto(al_mon, m_trt_b_hist->tubeHits_eff_vs_StrawLay, "Fraction of Tube Hits");
-
-
-  m_trt_b_hist->totHits_vs_StrawLay = TH1F_LW::create("totHits_vs_StrawLay_trt_b", "Number of total measurements vrs straw layer for TRT Barrel layer", 73, 0, 73);
-  m_trt_b_hist->totHits_vs_StrawLay->SetMinimum(0);
-  m_trt_b_hist->totHits_vs_StrawLay->GetXaxis()->SetLabelSize(0.03);
-  m_trt_b_hist->totHits_vs_StrawLay->GetYaxis()->SetLabelSize(0.03);
-  m_trt_b_hist->totHits_vs_StrawLay->GetXaxis()->SetTitle("Straw Layer");
-  m_trt_b_hist->totHits_vs_StrawLay->GetYaxis()->SetTitle("Total Measurements");
-  RegisterHisto(al_mon, m_trt_b_hist->totHits_vs_StrawLay);
-}
-
-void IDAlignMonEfficiencies::makeTRTEndcapHistograms(MonGroup& al_mon, MonGroup& al_mon_ls) {
-  /** EndCap */
-  std::string endcapName[2] = {
-    "Endcap_A", "Endcap_C"
-  };
-  for (unsigned int endcap = 0; endcap < 2; ++endcap) {
-    /** Total measurements vs ring */
-    m_trt_ec_hist->totHits_vs_ring[endcap] = MakeHist("totHits_vs_ring_trt_ec_" + endcapName[endcap], "Number of Total measurements vs Ring for " + endcapName[endcap], 40, 0, 40, "Endcap Ring", "Total Measurements");
-    RegisterHisto(al_mon, m_trt_ec_hist->totHits_vs_ring[endcap]);
-
-    /** outliers vs ring */
-    m_trt_ec_hist->outliers_vs_ring[endcap] = MakeHist("outliers_vs_ring_trt_ec_" + endcapName[endcap], "Ratio of outliers to Total measurements vrs vs Ring for " + endcapName[endcap], 40, 0, 40, "Endcap Ring", "Outliers");
-    RegisterHisto(al_mon, m_trt_ec_hist->outliers_vs_ring[endcap]);
-
-    m_trt_ec_hist->outliers_eff_vs_ring[endcap] = MakeProfile("outliers_eff_vs_ring_trt_ec_" + endcapName[endcap], "Ratio of outliers to total measurements vs Ring for " + endcapName[endcap], 40, 0, 40, 0., 1., "Endcap Ring", "Ratio of Outliers to Total Measurements");
-    RegisterHisto(al_mon, m_trt_ec_hist->outliers_eff_vs_ring[endcap]);
-
-    /** hits vs ring */
-    m_trt_ec_hist->hits_vs_ring[endcap] = MakeHist("hits_vs_ring_trt_ec_" + endcapName[endcap], "total hits(non-outliers) vs Ring for " + endcapName[endcap], 40, 0, 40, "Endcap Ring", "Hits");
-    RegisterHisto(al_mon, m_trt_ec_hist->hits_vs_ring[endcap]);
-
-    m_trt_ec_hist->hits_eff_vs_ring[endcap] = MakeProfile("hits_eff_vs_ring_trt_ec_" + endcapName[endcap], "Ratio of hits to total measurements vs Ring for " + endcapName[endcap], 40, 0, 40, 0., 1., "Endcap Ring", "Ratio of Hits to Total Measurements");
-    RegisterHisto(al_mon_ls, m_trt_ec_hist->hits_eff_vs_ring[endcap], "Fraction of Precision Hits");
-
-    /** tube hits vs ring */
-    m_trt_ec_hist->tubeHits_vs_ring[endcap] = MakeHist("tubeHits_vs_ring_trt_ec_" + endcapName[endcap], "tube Hits vs Ring for " + endcapName[endcap], 40, 0, 40, "Endcap Ring", "Tube Hits");
-    RegisterHisto(al_mon, m_trt_ec_hist->tubeHits_vs_ring[endcap]);
-
-    m_trt_ec_hist->tubeHits_eff_vs_ring[endcap] = MakeProfile("tubeHits_eff_vs_ring_trt_ec_" + endcapName[endcap], "Ratio of tubeHits to total measurements vs Ring for " + endcapName[endcap], 40, 0, 40, 0., 1., "Endcap Ring", "Ratio of tubeHits to Total Measurements");
-    RegisterHisto(al_mon, m_trt_ec_hist->tubeHits_eff_vs_ring[endcap], "Fraction of Tube Hits");
-
-    /** Total measurements vs phiSector */
-    m_trt_ec_hist->totHits_vs_phiSector[endcap] = MakeHist("totHits_vs_phiSector_trt_ec_" + endcapName[endcap], "Number of Total measurements vs PhiSector for " + endcapName[endcap], 32, 0, 32, "Endcap PhiSector", "Total Measurements");
-    RegisterHisto(al_mon, m_trt_ec_hist->totHits_vs_phiSector[endcap]);
-
-    /** outliers vs phiSector */
-    m_trt_ec_hist->outliers_vs_phiSector[endcap] = MakeHist("outliers_vs_phiSector_trt_ec_" + endcapName[endcap], "Ratio of outliers to Total measurements vrs vs PhiSector for " + endcapName[endcap], 32, 0, 32, "Endcap PhiSector", "Outliers");
-    RegisterHisto(al_mon, m_trt_ec_hist->outliers_vs_phiSector[endcap]);
-
-    m_trt_ec_hist->outliers_eff_vs_phiSector[endcap] = MakeProfile("outliers_eff_vs_phiSector_trt_ec_" + endcapName[endcap], "Ratio of outliers to total measurements vs PhiSector for " + endcapName[endcap], 32, 0, 32, 0., 1., "Endcap PhiSector", "Ratio of Outliers to Total Measurements");
-    RegisterHisto(al_mon, m_trt_ec_hist->outliers_eff_vs_phiSector[endcap], "Fraction of Outliers");
-
-    /** hits vs phiSector */
-    m_trt_ec_hist->hits_vs_phiSector[endcap] = MakeHist("hits_vs_phiSector_trt_ec_" + endcapName[endcap], "total hits(non-outliers) vs PhiSector for " + endcapName[endcap], 32, 0, 32, "Endcap PhiSector", "Hits");
-    RegisterHisto(al_mon, m_trt_ec_hist->hits_vs_phiSector[endcap]);
-
-    m_trt_ec_hist->hits_eff_vs_phiSector[endcap] = MakeProfile("hits_eff_vs_phiSector_trt_ec_" + endcapName[endcap], "Ratio of hits to total measurements vs PhiSector for " + endcapName[endcap], 32, 0, 32, 0., 1., "Endcap PhiSector", "Ratio of Hits to Total Measurements");
-    RegisterHisto(al_mon, m_trt_ec_hist->hits_eff_vs_phiSector[endcap], "Fraction of Precision Hits");
-
-    /** tube hits vs phiSector */
-    m_trt_ec_hist->tubeHits_vs_phiSector[endcap] = MakeHist("tubeHits_vs_phiSector_trt_ec_" + endcapName[endcap], "tube Hits vs PhiSector for " + endcapName[endcap], 32, 0, 32, "Endcap PhiSector", "Tube Hits");
-    RegisterHisto(al_mon, m_trt_ec_hist->tubeHits_vs_phiSector[endcap]);
-
-    m_trt_ec_hist->tubeHits_eff_vs_phiSector[endcap] = MakeProfile("tubeHits_eff_vs_phiSector_trt_ec_" + endcapName[endcap], "Ratio of tubeHits to total measurements vs PhiSector for " + endcapName[endcap], 32, 0, 32, 0., 1., "Endcap PhiSector", "Ratio of tubeHits to Total Measurements");
-    RegisterHisto(al_mon, m_trt_ec_hist->tubeHits_eff_vs_phiSector[endcap], "Fraction of Tube");
-  }
-
-  }
-
-void IDAlignMonEfficiencies::fillTRTTotalMeasurements(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer) {
-  //Barrel
-  if (barrel_ec == 1 || barrel_ec == -1) {
-    fillTRTBarrelTotalMeasurements(layer_or_wheel, phi_module, straw_layer);
-  }
-
-  //Endcap
-  if (barrel_ec == 2 || barrel_ec == -2) {
-    fillTRTEndcapTotalMeasurements(barrel_ec, layer_or_wheel, phi_module, straw_layer);
-  }
-
-  }
-
-void IDAlignMonEfficiencies::fillTRTHits(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer, bool isTubeHit) {
-  //Barrel
-  if (barrel_ec == 1 || barrel_ec == -1) {
-    fillTRTBarrelHits(layer_or_wheel, phi_module, straw_layer, isTubeHit);
-  }
-
-  //Endcap
-  if (barrel_ec == 2 || barrel_ec == -2) {
-    fillTRTEndcapHits(barrel_ec, layer_or_wheel, phi_module, straw_layer, isTubeHit);
-  }
-
-  }
-
-void IDAlignMonEfficiencies::fillTRTOutliers(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer) {
-  //Barrel
-  if (barrel_ec == 1 || barrel_ec == -1) {
-    fillTRTBarrelOutliers(layer_or_wheel, phi_module, straw_layer);
-  }
-
-  //Endcap
-  if (barrel_ec == 2 || barrel_ec == -2) {
-    fillTRTEndcapOutliers(barrel_ec, layer_or_wheel, straw_layer);
-  }
-
-  }
-
-void IDAlignMonEfficiencies::fillTRTBarrelTotalMeasurements(int layer_or_wheel, int phi_module, int straw_layer) {
-  //There are different number of straw layers in the differnt types of module layers
-  // and the TRT_Id helper returns the layer with the current module (not global the layer)
-  if (layer_or_wheel == 0) m_trt_b_hist->totHits_vs_StrawLay->Fill(straw_layer);
-  if (layer_or_wheel == 1) m_trt_b_hist->totHits_vs_StrawLay->Fill(19 + straw_layer);
-  if (layer_or_wheel == 2) m_trt_b_hist->totHits_vs_StrawLay->Fill(19 + 24 + straw_layer);
-
-  for (int i = 0; i < 3; i++)
-    if (layer_or_wheel == i) //Filling phi sectors of layer i
-      m_trt_b_hist->totHits_vs_phiSector[i]->Fill(phi_module);
-}
-
-void IDAlignMonEfficiencies::fillTRTBarrelHits(int layer_or_wheel, int phi_module, int straw_layer, bool isTubeHit) {
-  //There are different number of straw layers in the differnt types of module layers
-  // and the TRT_Id helper returns the layer with the current module (not global the layer)
-  if (!isTubeHit) {
-    if (layer_or_wheel == 0) m_trt_b_hist->hits_vs_StrawLay->Fill(straw_layer);
-    if (layer_or_wheel == 1) m_trt_b_hist->hits_vs_StrawLay->Fill(19 + straw_layer);
-    if (layer_or_wheel == 2) m_trt_b_hist->hits_vs_StrawLay->Fill(19 + 24 + straw_layer);
-  }
-
-  if (isTubeHit) {
-    if (layer_or_wheel == 0) m_trt_b_hist->tubeHits_vs_StrawLay->Fill(straw_layer);
-    if (layer_or_wheel == 1) m_trt_b_hist->tubeHits_vs_StrawLay->Fill(19 + straw_layer);
-    if (layer_or_wheel == 2) m_trt_b_hist->tubeHits_vs_StrawLay->Fill(19 + 24 + straw_layer);
-  }
-
-  for (int i = 0; i < 3; i++) {
-    if (layer_or_wheel == i) {//Filling phi sectors of layer i
-      if (!isTubeHit) m_trt_b_hist->hits_vs_phiSector[i]->Fill(phi_module);
-      if (isTubeHit) m_trt_b_hist->tubeHits_vs_phiSector[i]->Fill(phi_module);
-    }
-  }
-
-  }
-
-void IDAlignMonEfficiencies::fillTRTBarrelOutliers(int layer_or_wheel, int phi_module, int straw_layer) {
-  //There are different number of straw layers in the differnt types of module layers
-  // and the TRT_Id helper returns the layer with the current module (not global the layer)
-  if (layer_or_wheel == 0) m_trt_b_hist->outliers_vs_StrawLay->Fill(straw_layer);
-  if (layer_or_wheel == 1) m_trt_b_hist->outliers_vs_StrawLay->Fill(19 + straw_layer);
-  if (layer_or_wheel == 2) m_trt_b_hist->outliers_vs_StrawLay->Fill(19 + 24 + straw_layer);
-
-  for (int i = 0; i < 3; i++) {
-    if (layer_or_wheel == i) //Filling phi sectors of layer i
-      m_trt_b_hist->outliers_vs_phiSector[i]->Fill(phi_module);
-  }
-
-  }
-
-void IDAlignMonEfficiencies::fillTRTEndcapTotalMeasurements(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer) {
-  for (unsigned int endcap = 0; endcap < 2; ++endcap) {
-    bool doFill = false;
-    if (!endcap && barrel_ec == 2) doFill = true;
-    else if (endcap && barrel_ec == -2) doFill = true;
-
-    if (!doFill) continue;
-
-    unsigned int ring = getRing(layer_or_wheel, straw_layer);
-    m_trt_ec_hist->totHits_vs_ring[endcap]->Fill(ring);
-    m_trt_ec_hist->totHits_vs_phiSector[endcap]->Fill(phi_module);
-  }
-}
-
-void IDAlignMonEfficiencies::fillTRTEndcapHits(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer, bool isTubeHit) {
-  for (unsigned int endcap = 0; endcap < 2; ++endcap) {
-    bool doFill = false;
-    if (!endcap && barrel_ec == 2) doFill = true;
-    else if (endcap && barrel_ec == -2) doFill = true;
-
-    if (!doFill) continue;
-
-    unsigned int ring = getRing(layer_or_wheel, straw_layer);
-    if (!isTubeHit) {
-      m_trt_ec_hist->hits_vs_ring[endcap]->Fill(ring);
-      m_trt_ec_hist->hits_vs_phiSector[endcap]->Fill(phi_module);
-    }
-    if (isTubeHit) {
-      m_trt_ec_hist->tubeHits_vs_ring[endcap]->Fill(ring);
-      m_trt_ec_hist->tubeHits_vs_phiSector[endcap]->Fill(phi_module);
-    }
-  }
-
-  }
-
-void IDAlignMonEfficiencies::fillTRTEndcapOutliers(int barrel_ec, int layer_or_wheel, int straw_layer) {
-  for (unsigned int endcap = 0; endcap < 2; ++endcap) {
-    bool doFill = false;
-    if (!endcap && barrel_ec == 2) doFill = true;
-    else if (endcap && barrel_ec == -2) doFill = true;
-
-    if (!doFill) continue;
-
-    unsigned int ring = getRing(layer_or_wheel, straw_layer);
-    m_trt_ec_hist->outliers_vs_ring[endcap]->Fill(ring);
-    m_trt_ec_hist->outliers_vs_phiSector[endcap]->Fill(ring);
-  }
-  }
-
-unsigned int IDAlignMonEfficiencies::getRing(unsigned int wheel, unsigned int strawlayer) {
-  if (wheel < 6) return (16 * wheel + strawlayer) / 4;
-  else return (16 * 6 + 8 * (wheel - 6) + strawlayer) / 4;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h
deleted file mode 100644
index 047f664c3b10b0cb5f97936783e57e2c0df13a7c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef IDAlignMonEfficiencies_H
-#define IDAlignMonEfficiencies_H
-
-// **********************************************************************
-// IDAlignMonEfficiencies.cxx
-// AUTHORS: Beate Heinemann, Tobias Golling, John Alison
-// **********************************************************************
-
-#include <vector>
-
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "TrkToolInterfaces/ITrackSummaryTool.h"
-#include "TrkTrack/TrackCollection.h"
-#include "xAODEventInfo/EventInfo.h"
-
-#include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/ToolHandle.h"
-
-//forward declaration
-class TH1F;
-class TH2F;
-class TH3F;
-class TProfile;
-class TProfile2D;
-class AtlasDetectorID;
-class PixelID;
-class SCT_ID;
-class TRT_ID;
-class TH1F_LW;
-class TH2F_LW;
-
-namespace InDetDD {
-  class PixelDetectorManager;
-  class SCT_DetectorManager;
-}
-
-namespace Trk {
-  class TrackStateOnSurface;
-  class MeasurementBase;
-  class Track;
-  class ITrackHoleSearchTool;
-}
-//class Identifier;
-class IInDetAlignHitQualSelTool;
-
-namespace InDetAlignMon {
-  class TrackSelectionTool;
-}
-
-class IDAlignMonEfficiencies: public ManagedMonitorToolBase
-{
-public:
-  IDAlignMonEfficiencies(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~IDAlignMonEfficiencies();
-
-  virtual StatusCode initialize();
-  virtual StatusCode bookHistograms();
-  virtual StatusCode fillHistograms();
-  virtual StatusCode procHistograms();
-
-  /** Convert from an int to a string */
-  static std::string intToString(int input);
-
-  /** Make Profiles */
-  static TProfile* MakeProfile(const std::string& name, const std::string& title, int nBins, float xLow, float xUp,
-                               float yLow, float yUp, const std::string& xAxisTitle, const std::string& yAxisTitle,
-                               bool setMinZero = true);
-
-  /** Make Histograms */
-  static TH1F_LW* MakeHist(const std::string& name, const std::string& title, int nBins, float xLow, float xUp,
-                           const std::string& xAxisTitle, const std::string& yAxisTitle);
-
-  void RegisterHisto(MonGroup& mon, TH1* histo);
-  void RegisterHisto(MonGroup& mon, TH1F_LW* histo);
-  void RegisterHisto(MonGroup& mon, TH2* histo);
-  void RegisterHisto(MonGroup& mon, TProfile* histo, const std::string& yAxisName = "");
-  void RegisterHisto(MonGroup& mon, TProfile2D* histo);
-
-  void makeEffHisto(TH1F* h_num, TH1F* h_denom, TProfile* h_eff) const;
-  void makeEffHisto(TH1F_LW* h_num, TH1F_LW* h_denom, TProfile* h_eff);
-  static void makeOverlapFracHisto(TH1F* h_num, TH1F* h_denom, TProfile* h_eff);
-  void makeEffHisto(TH2F* h_num, TH2F* h_denom, TProfile2D* h_eff) const;
-  void makeEffHisto(TH2F* h_num, TH2F* h_denom, TH2F* h_eff);
-  void makeEffHistoWithCut(TH2F* h_num, TH2F* h_denom, TProfile2D* h_eff);
-
-  void makeTRTHistograms(MonGroup& al_monitoring, MonGroup& al_monitoring_ls);
-  void makeTRTBarrelHistograms(MonGroup& al_mon, MonGroup& al_mon_ls);
-  void makeTRTEndcapHistograms(MonGroup& al_mon, MonGroup& al_mon_ls);
-  void makePIXBarrelHistograms(MonGroup& al_mon);
-  void makePIXEndCapsHistograms(MonGroup& al_mon);
-  void makeSCTBarrelHistograms(MonGroup& al_mon);
-  void makeSCTEndCapsHistograms(MonGroup& al_mon);
-  void fillTRTTotalMeasurements(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_straw_layer);
-  void fillTRTBarrelTotalMeasurements(int m_layer_or_wheel, int m_phi_module, int m_straw_layer);
-  void fillTRTEndcapTotalMeasurements(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_straw_layer);
-
-  void fillTRTHits(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_straw_layer, bool isTubeHit);
-  void fillTRTBarrelHits(int m_layer_or_wheel, int m_phi_module, int m_straw_layer, bool isTubeHit);
-  void fillTRTEndcapHits(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_straw_layer, bool isTubeHit);
-
-  void fillTRTOutliers(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_straw_layer);
-  void fillTRTBarrelOutliers(int m_layer_or_wheel, int m_phi_module, int m_straw_layer);
-  void fillTRTEndcapOutliers(int m_barrel_ec, int m_layer_or_wheel, int m_straw_layer);
-
-  void InitializeHistograms();
-
-  static unsigned int getRing(unsigned int wheel, unsigned int strawlayer);
-
-  std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> findOverlapHit(const Trk::Track*,
-                                                                                             const Trk::MeasurementBase*);
-protected:
-  // histograms go here
-
-
-  TH1F* m_hits_vs_layer_barrel {};
-  TH1F* m_hits_vs_layer_eca {};
-  TH1F* m_hits_vs_layer_ecc {};
-
-  TH1F* m_measurements_vs_layer_barrel {};
-  TH1F* m_measurements_vs_layer_eca {};
-  TH1F* m_measurements_vs_layer_ecc {};
-
-  TH1F* m_outliers_vs_layer_barrel {};
-  TH1F* m_outliers_vs_layer_eca {};
-  TH1F* m_outliers_vs_layer_ecc {};
-
-  TH1F* m_holes_vs_layer_barrel {};
-  TH1F* m_holes_vs_layer_eca {};
-  TH1F* m_holes_vs_layer_ecc {};
-
-  TH1F* m_noholes_vs_layer_barrel {};
-  TH1F* m_noholes_vs_layer_eca {};
-  TH1F* m_noholes_vs_layer_ecc {};
-
-  TH1F* m_overlapX_vs_layer_barrel {};
-  TH1F* m_overlapX_vs_layer_eca {};
-  TH1F* m_overlapX_vs_layer_ecc {};
-  TH1F* m_overlapY_vs_layer_barrel {};
-  TH1F* m_overlapY_vs_layer_eca {};
-  TH1F* m_overlapY_vs_layer_ecc {};
-
-  TProfile* m_measurements_eff_vs_layer_barrel {};
-  TProfile* m_measurements_eff_vs_layer_eca {};
-  TProfile* m_measurements_eff_vs_layer_ecc {};
-
-  TProfile* m_outliers_eff_vs_layer_barrel {};
-  TProfile* m_outliers_eff_vs_layer_eca {};
-  TProfile* m_outliers_eff_vs_layer_ecc {};
-
-  TProfile* m_holes_eff_vs_layer_barrel {};
-  TProfile* m_holes_eff_vs_layer_eca {};
-  TProfile* m_holes_eff_vs_layer_ecc {};
-
-  TProfile* m_noholes_eff_vs_layer_barrel {};
-  TProfile* m_noholes_eff_vs_layer_eca {};
-  TProfile* m_noholes_eff_vs_layer_ecc {};
-
-  TProfile* m_overlapX_eff_vs_layer_barrel {};
-  TProfile* m_overlapX_eff_vs_layer_eca {};
-  TProfile* m_overlapX_eff_vs_layer_ecc {};
-  TProfile* m_overlapY_eff_vs_layer_barrel {};
-  TProfile* m_overlapY_eff_vs_layer_eca {};
-  TProfile* m_overlapY_eff_vs_layer_ecc {};
-
-  TProfile2D* m_measurements_eff_vs_Eta_Phi_pix_eca {};
-  TProfile2D* m_measurements_eff_vs_Eta_Phi_pix_ecc {};
-  TH2F* m_measurements_vs_Eta_Phi_pix_eca {};
-  TH2F* m_measurements_vs_Eta_Phi_pix_ecc {};
-  TH2F* m_hits_vs_Eta_Phi_pix_eca {};
-  TH2F* m_hits_vs_Eta_Phi_pix_ecc {};
-  TH2F* m_outliers_vs_Eta_Phi_pix_eca {};
-  TH2F* m_outliers_vs_Eta_Phi_pix_ecc {};
-  TH2F* m_holes_vs_Eta_Phi_pix_eca {};
-  TH2F* m_holes_vs_Eta_Phi_pix_ecc {};
-
-  TProfile2D* m_measurements_eff_vs_Eta_Phi_sct_eca {};
-  TProfile2D* m_measurements_eff_vs_Eta_Phi_sct_ecc {};
-  TH2F* m_measurements_vs_Eta_Phi_sct_eca {};
-  TH2F* m_measurements_vs_Eta_Phi_sct_ecc {};
-  TH3F* m_measurements_vs_Eta_Phi_sct_eca_3d_s0 {};
-  TH3F* m_measurements_vs_Eta_Phi_sct_eca_3d_s1 {};
-  TH3F* m_measurements_vs_Eta_Phi_sct_ecc_3d_s0 {};
-  TH3F* m_measurements_vs_Eta_Phi_sct_ecc_3d_s1 {};
-  TH2F* m_hits_vs_Eta_Phi_sct_eca {};
-  TH2F* m_hits_vs_Eta_Phi_sct_ecc {};
-  TH2F* m_outliers_vs_Eta_Phi_sct_eca {};
-  TH2F* m_outliers_vs_Eta_Phi_sct_ecc {};
-  TH2F* m_holes_vs_Eta_Phi_sct_eca {};
-  TH2F* m_holes_vs_Eta_Phi_sct_ecc {};
-
-  std::vector<TH1F*> m_hits_vs_Phi_pix_eca;
-  std::vector<TH1F*> m_hits_vs_Phi_sct_eca;
-
-  std::vector<TH1F*> m_hits_vs_Phi_pix_ecc;
-  std::vector<TH1F*> m_hits_vs_Phi_sct_ecc;
-
-
-  std::vector<TH1F*> m_measurements_vs_Phi_pix_eca;
-  std::vector<TH1F*> m_measurements_vs_Phi_sct_eca;
-
-  std::vector<TH1F*> m_measurements_vs_Phi_pix_ecc;
-  std::vector<TH1F*> m_measurements_vs_Phi_sct_ecc;
-
-  std::vector<TProfile*> m_measurements_eff_vs_Phi_pix_eca;
-  std::vector<TProfile*> m_measurements_eff_vs_Phi_sct_eca;
-
-
-  std::vector<TProfile*> m_measurements_eff_vs_Phi_pix_ecc;
-  std::vector<TProfile*> m_measurements_eff_vs_Phi_sct_ecc;
-
-
-  std::vector<TH1F*> m_overlapX_vs_Phi_pix_eca;
-  std::vector<TH1F*> m_overlapX_vs_Phi_sct_eca;
-
-
-  std::vector<TH1F*> m_overlapX_vs_Phi_pix_ecc;
-  std::vector<TH1F*> m_overlapX_vs_Phi_sct_ecc;
-
-  std::vector<TProfile*> m_overlapX_eff_vs_Phi_pix_eca;
-  std::vector<TProfile*> m_overlapX_eff_vs_Phi_sct_eca;
-
-
-  std::vector<TProfile*> m_overlapX_eff_vs_Phi_pix_ecc;
-  std::vector<TProfile*> m_overlapX_eff_vs_Phi_sct_ecc;
-
-
-  std::vector<TH1F*> m_overlapY_vs_Phi_pix_eca;
-  std::vector<TH1F*> m_overlapY_vs_Phi_sct_eca;
-
-
-  std::vector<TH1F*> m_overlapY_vs_Phi_pix_ecc;
-  std::vector<TH1F*> m_overlapY_vs_Phi_sct_ecc;
-
-
-  std::vector<TProfile*> m_overlapY_eff_vs_Phi_pix_eca;
-  std::vector<TProfile*> m_overlapY_eff_vs_Phi_sct_eca;
-
-  std::vector<TProfile*> m_overlapY_eff_vs_Phi_pix_ecc;
-  std::vector<TProfile*> m_overlapY_eff_vs_Phi_sct_ecc;
-
-
-  std::vector<TProfile2D*> m_measurements_eff_vs_Eta_Phi_pix_b;
-  std::vector<TProfile2D*> m_measurements_eff_vs_Eta_Phi_sct_b;
-
-  std::vector<TH2F*> m_hits_vs_Eta_Phi_pix_b;
-  std::vector<TH2F*> m_hits_vs_Eta_Phi_sct_b;
-  std::vector<TH2F*> m_hits_vs_Eta_Phi_sct_s0_b;
-  std::vector<TH2F*> m_hits_vs_Eta_Phi_sct_s1_b;
-
-  std::vector<TH2F*> m_measurements_vs_Eta_Phi_pix_b;
-  std::vector<TH2F*> m_measurements_vs_Eta_Phi_sct_b;
-  std::vector<TH2F*> m_measurements_vs_Eta_Phi_sct_s0_b;
-  std::vector<TH2F*> m_measurements_vs_Eta_Phi_sct_s1_b;
-
-  std::vector<TProfile2D*> m_measurements_eff_vs_Eta_Phi_sct_s0_b;
-  std::vector<TProfile2D*> m_measurements_eff_vs_Eta_Phi_sct_s1_b;
-
-  std::vector<TH2F*> m_outliers_vs_Eta_Phi_pix_b;
-  std::vector<TH2F*> m_outliers_vs_Eta_Phi_sct_b;
-
-  std::vector<TH2F*> m_holes_vs_Eta_Phi_pix_b;
-  std::vector<TH2F*> m_holes_vs_Eta_Phi_sct_b;
-
-
-  std::vector<TH1F*> m_hits_vs_Eta_pix_b;
-  std::vector<TH1F*> m_hits_vs_Eta_sct_b;
-
-
-  std::vector<TH1F*> m_measurements_vs_Eta_pix_b;
-  std::vector<TH1F*> m_measurements_vs_Eta_sct_b;
-
-  std::vector<TH1F*> m_overlapY_vs_Eta_pix_b;
-  std::vector<TH1F*> m_overlapY_vs_Eta_sct_b;
-
-  std::vector<TH1F*> m_overlapX_vs_Eta_pix_b;
-  std::vector<TH1F*> m_overlapX_vs_Eta_sct_b;
-
-  std::vector<TH1F*> m_outliers_vs_Eta_pix_b;
-  std::vector<TH1F*> m_outliers_vs_Eta_sct_b;
-
-  std::vector<TH1F*> m_holes_vs_Eta_pix_b;
-  std::vector<TH1F*> m_holes_vs_Eta_sct_b;
-
-  std::vector<TProfile*> m_measurements_eff_vs_Eta_pix_b;
-  std::vector<TProfile*> m_measurements_eff_vs_Eta_sct_b;
-
-  std::vector<TProfile*> m_overlapX_eff_vs_Eta_pix_b;
-  std::vector<TProfile*> m_overlapX_eff_vs_Eta_sct_b;
-
-  std::vector<TProfile*> m_overlapY_eff_vs_Eta_pix_b;
-  std::vector<TProfile*> m_overlapY_eff_vs_Eta_sct_b;
-
-  std::vector<TProfile*> m_outliers_eff_vs_Eta_pix_b;
-  std::vector<TProfile*> m_outliers_eff_vs_Eta_sct_b;
-
-  std::vector<TProfile*> m_holes_eff_vs_Eta_pix_b;
-  std::vector<TProfile*> m_holes_eff_vs_Eta_sct_b;
-  std::vector<TH1F*> m_hits_vs_Phi_pix_b;
-  std::vector<TH1F*> m_hits_vs_Phi_sct_b;
-
-  std::vector<TH1F*> m_measurements_vs_Phi_pix_b;
-  std::vector<TH1F*> m_measurements_vs_Phi_sct_b;
-
-  std::vector<TH1F*> m_overlapX_vs_Phi_pix_b;
-  std::vector<TH1F*> m_overlapX_vs_Phi_sct_b;
-
-  std::vector<TH1F*> m_overlapY_vs_Phi_pix_b;
-  std::vector<TH1F*> m_overlapY_vs_Phi_sct_b;
-
-  std::vector<TH1F*> m_outliers_vs_Phi_pix_b;
-  std::vector<TH1F*> m_outliers_vs_Phi_sct_b;
-
-  std::vector<TH1F*> m_holes_vs_Phi_pix_b;
-  std::vector<TH1F*> m_holes_vs_Phi_sct_b;
-
-  std::vector<TProfile*> m_measurements_eff_vs_Phi_pix_b;
-  std::vector<TProfile*> m_measurements_eff_vs_Phi_sct_b;
-
-  std::vector<TProfile*> m_measurements_eff_vs_LB_pix_b;
-  std::vector<TProfile*> m_holes_eff_vs_LB_pix_b;
-  std::vector<TProfile*> m_outliers_eff_vs_LB_pix_b;
-  std::vector<TH1F*> m_measurements_vs_LB_pix_b;
-  std::vector<TH1F*> m_holes_vs_LB_pix_b;
-  std::vector<TH1F*> m_outliers_vs_LB_pix_b;
-  std::vector<TH1F*> m_hits_vs_LB_pix_b;
-
-  std::vector<TProfile*> m_measurements_eff_vs_LB_sct_b;
-  std::vector<TH1F*> m_measurements_vs_LB_sct_b;
-  std::vector<TH1F*> m_hits_vs_LB_sct_b;
-
-  std::vector<TProfile*> m_measurements_eff_vs_LB_pix_eca;
-  std::vector<TProfile*> m_measurements_eff_vs_LB_pix_ecc;
-  std::vector<TProfile*> m_holes_eff_vs_LB_pix_eca;
-  std::vector<TProfile*> m_holes_eff_vs_LB_pix_ecc;
-  std::vector<TProfile*> m_outliers_eff_vs_LB_pix_eca;
-  std::vector<TProfile*> m_outliers_eff_vs_LB_pix_ecc;
-
-  std::vector<TH1F*>     m_hits_vs_LB_pix_eca;
-  std::vector<TH1F*>     m_outliers_vs_LB_pix_eca;
-  std::vector<TH1F*>     m_holes_vs_LB_pix_eca;
-  std::vector<TH1F*>     m_measurements_vs_LB_pix_eca;
-  std::vector<TH1F*>     m_hits_vs_LB_pix_ecc;
-  std::vector<TH1F*>     m_outliers_vs_LB_pix_ecc;
-  std::vector<TH1F*>     m_holes_vs_LB_pix_ecc;
-  std::vector<TH1F*>     m_measurements_vs_LB_pix_ecc;
-
-
-  TProfile* m_measurements_eff_vs_LB_sct_eca {};
-  TH1F* m_hits_vs_LB_sct_eca {};
-  TH1F* m_measurements_vs_LB_sct_eca {};
-
-
-
-  TProfile* m_measurements_eff_vs_LB_sct_ecc {};
-  TH1F* m_hits_vs_LB_sct_ecc {};
-  TH1F* m_measurements_vs_LB_sct_ecc {};
-
-
-  std::vector<TProfile*> m_overlapX_eff_vs_Phi_pix_b;
-  std::vector<TProfile*> m_overlapX_eff_vs_Phi_sct_b;
-
-  std::vector<TProfile*> m_overlapY_eff_vs_Phi_pix_b;
-  std::vector<TProfile*> m_overlapY_eff_vs_Phi_sct_b;
-
-  std::vector<TProfile*> m_outliers_eff_vs_Phi_pix_b;
-  std::vector<TProfile*> m_outliers_eff_vs_Phi_sct_b;
-
-  std::vector<TProfile*> m_holes_eff_vs_Phi_pix_b;
-  std::vector<TProfile*> m_holes_eff_vs_Phi_sct_b;
-
-  std::vector<TH1F*> m_hits_vs_pT_pix_b;
-  std::vector<TH1F*> m_hits_vs_pT_sct_b;
-
-  std::vector<TH1F*> m_measurements_vs_pT_pix_b;
-  std::vector<TH1F*> m_measurements_vs_pT_sct_b;
-
-
-  std::vector<TH1F*> m_outliers_vs_pT_pix_b;
-  std::vector<TH1F*> m_outliers_vs_pT_sct_b;
-
-  std::vector<TH1F*> m_holes_vs_pT_pix_b;
-  std::vector<TH1F*> m_holes_vs_pT_sct_b;
-
-  std::vector<TProfile*> m_measurements_eff_vs_pT_pix_b;
-  std::vector<TProfile*> m_measurements_eff_vs_pT_sct_b;
-
-  std::vector<TProfile*> m_outliers_eff_vs_pT_pix_b;
-  std::vector<TProfile*> m_outliers_eff_vs_pT_sct_b;
-
-  std::vector<TProfile*> m_holes_eff_vs_pT_pix_b;
-  std::vector<TProfile*> m_holes_eff_vs_pT_sct_b;
-
-
-
-
-  /**
-     //  TRT plots
-   */
-  /* Barrel
-     //======================= */
-  struct TRTBarrelHistograms;
-  TRTBarrelHistograms* m_trt_b_hist;
-
-  /** TRT EndCap
-     //======================= */
-  struct TRTEndcapHistograms;
-  TRTEndcapHistograms* m_trt_ec_hist;
-private:
-  //================================================================
-  // Establishes a minimim window for the TProfile
-  //================================================================
-  static void SetMinWindow(TProfile* hProf, float min, float max);
-  static void SetMinWindow(TProfile2D* hProf, float min, float max);
-
-  const AtlasDetectorID* m_idHelper;
-  const PixelID* m_pixelID;
-  const SCT_ID* m_sctID;
-  const TRT_ID* m_trtID;
-  const InDetDD::PixelDetectorManager* m_PIX_Mgr;
-  const InDetDD::SCT_DetectorManager* m_SCT_Mgr;
-
-  //const InDetDD::TRT_DetectorManager    *m_TRT_Mgr;
-
-  std::string m_stream;
-  SG::ReadHandleKey<TrackCollection> m_tracksName {
-    this, "tracksName", "ExtendedTracks"
-  };
-  ToolHandle<Trk::ITrackSummaryTool> m_trackSumTool;
-  ToolHandle<Trk::ITrackHoleSearchTool>   m_holeSearchTool;
-  ToolHandle<InDetAlignMon::TrackSelectionTool>   m_trackSelection;
-  ToolHandle<IInDetAlignHitQualSelTool>  m_hitQualityTool;
-  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey {
-    this, "EventInfoKey", "EventInfo", "SG Key of EventInfo object"
-  };
-  float m_minSiliconEffWindow;
-  float m_maxSiliconEffWindow;
-  std::string m_triggerChainName;
-  bool m_doHoleSearch;
-  bool m_extendedPlots;
-  std::string m_Pixel_Manager;
-  std::string m_SCT_Manager;
-  std::string m_TRT_Manager;
-  int m_checkrate;
-  int m_NPixLayers;
-  int m_events;
-  int m_mapSplit;
-  int m_histosBooked;
-  bool m_doHitQuality;
-  float m_minLB;
-  float m_maxLB;
-  int m_nLB;
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
deleted file mode 100644
index 32c9d0587423a9c8f5d687e33d5233d8cfe94fab..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
+++ /dev/null
@@ -1,2676 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// AlignmentMonTool.cxx
-// AUTHORS: Beate Heinemann, Tobias Golling
-// **********************************************************************
-
-#include <cmath>
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-#include "TProfile.h"
-#include "TFile.h"
-#include "TMath.h"
-
-#include "GaudiKernel/MsgStream.h"
-
-#include "AtlasDetDescr/AtlasDetectorID.h"
-#include "InDetIdentifier/PixelID.h"
-#include "InDetIdentifier/SCT_ID.h"
-#include "InDetIdentifier/TRT_ID.h"
-
-#include "TrkTrack/TrackCollection.h"
-#include "InDetRIO_OnTrack/SiClusterOnTrack.h"
-#include "InDetPrepRawData/SiCluster.h"
-
-
-#include "Particle/TrackParticle.h"
-#include "TrkParticleBase/LinkToTrackParticleBase.h"
-
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkEventPrimitives/LocalParameters.h"
-
-
-#include "IDAlignMonGenericTracks.h"
-#include "CLHEP/GenericFunctions/CumulativeChiSquare.hh"
-
-#include "InDetAlignGenTools/IInDetAlignHitQualSelTool.h"
-#include "TrackSelectionTool.h"
-
-// *********************************************************************
-// Public Methods
-// *********************************************************************
-
-IDAlignMonGenericTracks::IDAlignMonGenericTracks(const std::string& type, const std::string& name,
-                                                 const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent),
-  m_idHelper(nullptr),
-  m_pixelID(nullptr),
-  m_sctID(nullptr),
-  m_trtID(nullptr),
-  m_events(0),
-  m_histosBooked(0),
-  m_barrelEta(0.8),
-  m_vertices(nullptr),
-  m_doHitQuality(0),
-  m_hWeightInFile(nullptr),
-  m_etapTWeight(nullptr) {
-
-  declareProperty("CheckRate", m_checkrate = 1000);
-  declareProperty("triggerChainName", m_triggerChainName = "NoTriggerSelection");
-  declareProperty("trackSelection", m_trackSelection = ToolHandle< InDetAlignMon::TrackSelectionTool > ("InDetAlignMon::TrackSelectionTool"));
-  declareProperty("Pixel_Manager", m_Pixel_Manager);
-  declareProperty("SCT_Manager", m_SCT_Manager);
-  declareProperty("TRT_Manager", m_TRT_Manager);
-  declareProperty("HitQualityTool", m_hitQualityTool);
-  declareProperty("useExtendedPlots", m_extendedPlots = false);
-  declareProperty("d0Range", m_d0Range = 2.0);
-  declareProperty("d0BsRange", m_d0BsRange = 0.5);
-  declareProperty("d0BsNbins", m_d0BsNbins = 100);
-  declareProperty("z0Range", m_z0Range = 250.0);
-  declareProperty("etaRange", m_etaRange = 3.0);
-  declareProperty("pTRange", m_pTRange = 100.0);
-  declareProperty("NTracksRange", m_NTracksRange = 200);
-  declareProperty("applyHistWeight", m_applyHistWeight = false);
-  declareProperty("hWeightInFileName", m_hWeightInFileName = "hWeight.root");
-  declareProperty("hWeightHistName", m_hWeightHistName = "trk_pT_vs_eta");
-  declareProperty("doIP", m_doIP = false);
-  declareProperty("RangePixHits", m_rangePixHits = 10);
-  declareProperty("RangeSCTHits", m_rangeSCTHits = 20);
-  declareProperty("RangeTRTHits", m_rangeTRTHits = 60);
-  declareProperty("Extrapolator", m_extrapolator = ToolHandle<Trk::IExtrapolator> ("Trk::Extrapolator/AtlasExtrapolator"));
-  declareProperty("TrackToVertexIPEstimatorTool", m_trackToVertexIPEstimatorTool = ToolHandle<Trk::ITrackToVertexIPEstimator>("Trk::TrackToVertexIPEstimator/TrackToVertexIPEstimator"));
-
-  InitializeHistograms();
-}
-
-IDAlignMonGenericTracks::~IDAlignMonGenericTracks() = default;
-
-
-void IDAlignMonGenericTracks::InitializeHistograms() {
-  m_summary = nullptr;
-
-  m_trk_chi2oDoF = nullptr;
-  m_trk_chi2Prob = nullptr;
-
-
-
-  //Histo for self beam spot calculatio = 0n
-  m_trk_d0_vs_phi0_z0 = nullptr;
-
-  // barrel
-  m_trk_d0_barrel = nullptr;
-  m_trk_d0_barrel_zoomin = nullptr;
-  m_trk_d0c_barrel = nullptr;
-  m_trk_z0_barrel = nullptr;
-  m_trk_z0_barrel_zoomin = nullptr;
-  m_trk_qopT_vs_phi_barrel = nullptr;
-  m_trk_d0_vs_phi_barrel = nullptr;
-  m_trk_d0_vs_z0_barrel = nullptr;
-  m_trk_phi0_neg_barrel = nullptr;
-  m_trk_phi0_pos_barrel = nullptr;
-  m_trk_phi0_asym_barrel = nullptr;
-  m_trk_pT_neg_barrel = nullptr;
-  m_trk_pT_pos_barrel = nullptr;
-  m_trk_pT_asym_barrel = nullptr;
-  m_npixhits_per_track_barrel = nullptr;
-  m_nscthits_per_track_barrel = nullptr;
-  m_ntrthits_per_track_barrel = nullptr;
-  m_chi2oDoF_barrel = nullptr;
-  m_phi_barrel = nullptr;
-  m_hitMap_barrel = nullptr;
-  m_hitMap_endcapA = nullptr;
-  m_hitMap_endcapC = nullptr;
-
-  m_trk_d0_vs_phi_vs_eta_barrel = nullptr;
-  m_trk_pT_vs_eta_barrel = nullptr;
-  m_trk_d0_wrtPV_vs_phi_vs_eta_barrel = nullptr;
-  m_trk_z0_wrtPV_vs_phi_vs_eta_barrel = nullptr;
-
-  // endcap A
-  m_trk_d0_eca = nullptr;
-  m_trk_d0_eca_zoomin = nullptr;
-  m_trk_d0c_eca = nullptr;
-  m_trk_z0_eca = nullptr;
-  m_trk_z0_eca_zoomin = nullptr;
-  m_trk_qopT_vs_phi_eca = nullptr;
-  m_trk_d0_vs_phi_eca = nullptr;
-  m_trk_d0_vs_z0_eca = nullptr;
-  m_trk_phi0_neg_eca = nullptr;
-  m_trk_phi0_pos_eca = nullptr;
-  m_trk_phi0_asym_eca = nullptr;
-  m_trk_pT_neg_eca = nullptr;
-  m_trk_pT_pos_eca = nullptr;
-  m_trk_pT_asym_eca = nullptr;
-  m_npixhits_per_track_eca = nullptr;
-  m_nscthits_per_track_eca = nullptr;
-  m_ntrthits_per_track_eca = nullptr;
-  m_chi2oDoF_eca = nullptr;
-  m_phi_eca = nullptr;
-
-  m_trk_d0_vs_phi_vs_eta_eca = nullptr;
-  m_trk_pT_vs_eta_eca = nullptr;
-  m_trk_d0_wrtPV_vs_phi_vs_eta_eca = nullptr;
-  m_trk_z0_wrtPV_vs_phi_vs_eta_eca = nullptr;
-
-
-  // endcap C
-  m_trk_d0_ecc = nullptr;
-  m_trk_d0_ecc_zoomin = nullptr;
-  m_trk_d0c_ecc = nullptr;
-  m_trk_z0_ecc = nullptr;
-  m_trk_z0_ecc_zoomin = nullptr;
-  m_trk_qopT_vs_phi_ecc = nullptr;
-  m_trk_d0_vs_phi_ecc = nullptr;
-  m_trk_d0_vs_z0_ecc = nullptr;
-  m_trk_phi0_neg_ecc = nullptr;
-  m_trk_phi0_pos_ecc = nullptr;
-  m_trk_phi0_asym_ecc = nullptr;
-  m_trk_pT_neg_ecc = nullptr;
-  m_trk_pT_pos_ecc = nullptr;
-  m_trk_pT_asym_ecc = nullptr;
-  m_npixhits_per_track_ecc = nullptr;
-  m_nscthits_per_track_ecc = nullptr;
-  m_ntrthits_per_track_ecc = nullptr;
-  m_chi2oDoF_ecc = nullptr;
-  m_phi_ecc = nullptr;
-
-  m_trk_d0_vs_phi_vs_eta_ecc = nullptr;
-  m_trk_pT_vs_eta_ecc = nullptr;
-
-  m_trk_d0_wrtPV_vs_phi_vs_eta_ecc = nullptr;
-  m_trk_z0_wrtPV_vs_phi_vs_eta_ecc = nullptr;
-
-  // Whole detector
-
-
-  m_nhits_per_event = nullptr;
-  m_nhits_per_track = nullptr;
-  m_ntrk = nullptr;
-  m_ngtrk = nullptr;
-  m_npixhits_per_track = nullptr;
-  m_nscthits_per_track = nullptr;
-  m_ntrthits_per_track = nullptr;
-  m_chi2oDoF = nullptr;
-  m_eta = nullptr;
-  m_phi = nullptr;
-  m_z0 = nullptr;
-  m_z0sintheta = nullptr;
-  m_z0_pvcorr = nullptr;
-  m_z0sintheta_pvcorr = nullptr;
-  m_d0 = nullptr;
-  m_d0_pvcorr = nullptr;
-  m_d0_bscorr = nullptr;
-  m_pT = nullptr;
-  m_pTRes = nullptr;
-  m_pTResOverP = nullptr;
-  m_P = nullptr;
-
-  m_trk_d0_vs_phi_vs_eta = nullptr;
-  m_trk_pT_vs_eta = nullptr;
-
-  m_trk_d0_wrtPV_vs_phi_vs_eta = nullptr;
-  m_trk_z0_wrtPV_vs_phi_vs_eta = nullptr;
-
-
-  // extended plots
-  m_trk_PIXvSCTHits = nullptr;
-  m_trk_PIXHitsvEta = nullptr;
-  m_trk_SCTHitsvEta = nullptr;
-  m_trk_TRTHitsvEta = nullptr;
-  m_trk_chi2oDoF_Phi = nullptr;
-  m_trk_chi2oDoF_Pt = nullptr;
-  m_trk_chi2oDoF_P = nullptr;
-  m_trk_chi2ProbDist = nullptr;
-  m_errCotTheta = nullptr;
-  m_errCotThetaVsD0BS = nullptr;
-  m_errCotThetaVsPt = nullptr;
-  m_errCotThetaVsP = nullptr;
-  m_errCotThetaVsPhi = nullptr;
-  m_errCotThetaVsEta = nullptr;
-  m_errTheta = nullptr;
-  m_errThetaVsD0BS = nullptr;
-  m_errThetaVsPt = nullptr;
-  m_errThetaVsP = nullptr;
-  m_errThetaVsPhi = nullptr;
-  m_errThetaVsEta = nullptr;
-  m_errD0 = nullptr;
-  m_errD0VsD0BS = nullptr;
-  m_errD0VsPt = nullptr;
-  m_errD0VsP = nullptr;
-  m_errD0VsPhi = nullptr;
-  m_errD0VsPhiBarrel = nullptr;
-  m_errD0VsPhiECA = nullptr;
-  m_errD0VsPhiECC = nullptr;
-  m_errD0VsEta = nullptr;
-  m_errPhi0 = nullptr;
-  m_errPhi0VsD0BS = nullptr;
-  m_errPhi0VsPt = nullptr;
-  m_errPhi0VsP = nullptr;
-  m_errPhi0VsPhi0 = nullptr;
-  m_errPhi0VsEta = nullptr;
-  m_errZ0 = nullptr;
-  m_errZ0VsD0BS = nullptr;
-  m_errZ0VsPt = nullptr;
-  m_errZ0VsP = nullptr;
-  m_errZ0VsPhi0 = nullptr;
-  m_errZ0VsEta = nullptr;
-  m_errPt = nullptr;
-  m_PtVsPhi0Pos = nullptr;
-  m_PtVsPhi0Neg = nullptr;
-  m_errPtVsD0BS = nullptr;
-  m_errPtVsPt = nullptr;
-  m_errPtVsP = nullptr;
-  m_errPt_Pt2 = nullptr;
-  m_errPt_Pt2VsPt = nullptr;
-  m_errPt_Pt2VsPhi0 = nullptr;
-  m_errPt_Pt2VsEta = nullptr;
-  m_errPtVsPhi0 = nullptr;
-  m_errPtVsEta = nullptr;
-
-  m_D0VsPhi0 = nullptr;
-  m_Z0VsEta = nullptr;
-  m_QoverPtVsPhi0 = nullptr;
-  m_QoverPtVsEta = nullptr;
-  m_QPtVsPhi0 = nullptr;
-  m_QPtVsEta = nullptr;
-
-  //BeamSpot Plot = 0s
-
-  m_D0bsVsPhi0 = nullptr;
-  m_D0bsVsPhi0ECC = nullptr;
-  m_D0bsVsPhi0ECA = nullptr;
-  m_D0bsVsPhi0Barrel = nullptr;
-  m_D0bsVsEta = nullptr;
-  m_D0bsVsPt = nullptr;
-  m_D0bsVsPtECC = nullptr;
-  m_D0bsVsPtECA = nullptr;
-  m_D0bsVsPtBarrel = nullptr;
-
-
-  //BeamSpot Position Plot = 0s
-
-  m_YBs_vs_XBs = nullptr;
-  m_YBs_vs_ZBs = nullptr;
-  m_XBs_vs_ZBs = nullptr;
-
-  m_XBs = nullptr;
-  m_YBs = nullptr;
-  m_ZBs = nullptr;
-  m_TiltX_Bs = nullptr;
-  m_TiltY_Bs = nullptr;
-
-  //versus lumibloc = 0k
-  m_XBs_vs_LumiBlock = nullptr;
-  m_YBs_vs_LumiBlock = nullptr;
-  m_ZBs_vs_LumiBlock = nullptr;
-  m_BeamSpotTiltX_vs_LumiBlock = nullptr;
-  m_BeamSpotTiltY_vs_LumiBlock = nullptr;
-
-  // End of extended plots
-
-  m_phi_barrel_pos_2_5GeV = nullptr;
-  m_phi_barrel_pos_5_10GeV = nullptr;
-  m_phi_barrel_pos_10_20GeV = nullptr;
-  m_phi_barrel_pos_20plusGeV = nullptr;
-  m_phi_barrel_neg_2_5GeV = nullptr;
-  m_phi_barrel_neg_5_10GeV = nullptr;
-  m_phi_barrel_neg_10_20GeV = nullptr;
-  m_phi_barrel_neg_20plusGeV = nullptr;
-
-  m_phi_eca_pos_2_5GeV = nullptr;
-  m_phi_eca_pos_5_10GeV = nullptr;
-  m_phi_eca_pos_10_20GeV = nullptr;
-  m_phi_eca_pos_20plusGeV = nullptr;
-  m_phi_eca_neg_2_5GeV = nullptr;
-  m_phi_eca_neg_5_10GeV = nullptr;
-  m_phi_eca_neg_10_20GeV = nullptr;
-  m_phi_eca_neg_20plusGeV = nullptr;
-
-  m_phi_ecc_pos_2_5GeV = nullptr;
-  m_phi_ecc_pos_5_10GeV = nullptr;
-  m_phi_ecc_pos_10_20GeV = nullptr;
-  m_phi_ecc_pos_20plusGeV = nullptr;
-  m_phi_ecc_neg_2_5GeV = nullptr;
-  m_phi_ecc_neg_5_10GeV = nullptr;
-  m_phi_ecc_neg_10_20GeV = nullptr;
-  m_phi_ecc_neg_20plusGeV = nullptr;
-
-  m_eta_phi_pos_2_5GeV = nullptr;
-  m_eta_phi_pos_5_10GeV = nullptr;
-  m_eta_phi_pos_10_20GeV = nullptr;
-  m_eta_phi_pos_20plusGeV = nullptr;
-  m_eta_phi_neg_2_5GeV = nullptr;
-  m_eta_phi_neg_5_10GeV = nullptr;
-  m_eta_phi_neg_10_20GeV = nullptr;
-  m_eta_phi_neg_20plusGeV = nullptr;
-
-  m_Zmumu = nullptr;
-  m_Zmumu_barrel = nullptr;
-  m_Zmumu_eca = nullptr;
-  m_Zmumu_ecc = nullptr;
-  m_Zmumu_barrel_eca = nullptr;
-  m_Zmumu_barrel_ecc = nullptr;
-  m_ZpT_n = nullptr;
-  m_ZpT_p = nullptr;
-  m_ZpT_diff = nullptr;
-
-  m_pT_n = nullptr;
-  m_pT_p = nullptr;
-  m_pT_diff = nullptr;
-  m_trk_pT_asym = nullptr;
-
-  m_eta_neg = nullptr;
-  m_eta_pos = nullptr;
-  m_eta_asym = nullptr;
-
-  m_LumiBlock = nullptr;
-  m_Tracks_per_LumiBlock = nullptr;
-
-  m_trk_d0c_pos = nullptr;
-  m_trk_d0c_neg = nullptr;
-  m_trk_d0c_pos_barrel = nullptr;
-  m_trk_d0c_neg_barrel = nullptr;
-  m_trk_d0c_pos_eca = nullptr;
-  m_trk_d0c_neg_eca = nullptr;
-  m_trk_d0c_pos_ecc = nullptr;
-  m_trk_d0c_neg_ecc = nullptr;
-  m_trk_d0c_asym = nullptr;
-  m_trk_d0c_asym_barrel = nullptr;
-  m_trk_d0c_asym_eca = nullptr;
-  m_trk_d0c_asym_ecc = nullptr;
-
-  m_trk_z0c_pos = nullptr;
-  m_trk_z0c_neg = nullptr;
-  m_trk_z0c_pos_barrel = nullptr;
-  m_trk_z0c_neg_barrel = nullptr;
-  m_trk_z0c_pos_eca = nullptr;
-  m_trk_z0c_neg_eca = nullptr;
-  m_trk_z0c_pos_ecc = nullptr;
-  m_trk_z0c_neg_ecc = nullptr;
-  m_trk_z0c_asym = nullptr;
-  m_trk_z0c_asym_barrel = nullptr;
-  m_trk_z0c_asym_eca = nullptr;
-  m_trk_z0c_asym_ecc = nullptr;
-}
-
-StatusCode IDAlignMonGenericTracks::initialize() {
-  StatusCode sc;
-
-  m_events = 0;
-  m_histosBooked = 0;
-
-  sc = ManagedMonitorToolBase::initialize();
-  if (!sc.isSuccess()) return StatusCode::SUCCESS;
-
-  //ID Helper
-  sc = detStore()->retrieve(m_idHelper, "AtlasID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get AtlasDetectorID !" << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found AtlasDetectorID" << endmsg;
-  }
-
-  sc = detStore()->retrieve(m_pixelID, "PixelID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get Pixel ID helper !" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized PixelIDHelper" << endmsg;
-
-  sc = detStore()->retrieve(m_sctID, "SCT_ID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get SCT ID helper !" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTIDHelper" << endmsg;
-
-  sc = detStore()->retrieve(m_trtID, "TRT_ID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get TRT ID helper !" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized TRTIDHelper" << endmsg;
-
-  if (m_trackSelection.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve tool " << m_trackSelection << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSelection << endmsg;
-  }
-
-  if (m_hitQualityTool.empty()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
-        "No hit quality tool configured - not hit quality cuts will be imposed"
-                                            << endmsg;
-    m_doHitQuality = false;
-  } else if (m_hitQualityTool.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not retrieve " << m_hitQualityTool
-                                                << " (to apply hit quality cuts to Si hits) " << endmsg;
-    m_doHitQuality = false;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)
-        << "Hit quality tool setup "
-        << "- hit quality cuts will be applied to Si hits" << endmsg;
-    m_doHitQuality = true;
-  }
-
-  ATH_CHECK( m_extrapolator.retrieve() );
-
-  if (m_doIP) {
-    // extract TrackToVertexIPEstimator extrapolator tool
-    if ( m_trackToVertexIPEstimatorTool.retrieve().isFailure() ) {
-      ATH_MSG_ERROR("initialize: failed to retrieve trackToVertexIPEstimator tool ");
-      return StatusCode::SUCCESS;
-    }
-    else {
-      ATH_MSG_INFO("initialize: Retrieved Trk::TrackToVertexIPEstimator Tool" << m_trackToVertexIPEstimatorTool);
-    }
-  }
-
-  if (m_beamSpotKey.initialize().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve beamspot service " << m_beamSpotKey <<
-        " - will use nominal beamspot at (0,0,0)" << endmsg;
-    m_hasBeamCondSvc = false;
-  } else {
-    m_hasBeamCondSvc = true;
-    ATH_MSG_DEBUG("Retrieved service " << m_beamSpotKey);
-  }
-
-
-
-
-  if (m_applyHistWeight) {
-    ATH_MSG_INFO("applying a weight != 1 for this job");
-    m_hWeightInFile = new TFile(m_hWeightInFileName.c_str(), "read");
-
-    if (m_hWeightInFile->IsZombie() || !(m_hWeightInFile->IsOpen())) {
-      ATH_MSG_FATAL(" Problem reading TFile " << m_hWeightInFileName);
-      return StatusCode::FAILURE;
-    }
-
-    ATH_MSG_INFO("Opened  file containing the contraints" << m_hWeightInFileName);
-
-
-    m_etapTWeight = (TH2F*) m_hWeightInFile->Get(m_hWeightHistName.c_str());
-    if (!m_etapTWeight) {
-      ATH_MSG_FATAL(" Problem getting constraints Hist.  Name " << m_hWeightHistName);
-      m_hWeightInFile->Close();
-      delete m_hWeightInFile;
-      return StatusCode::FAILURE;
-    }
-
-    ATH_MSG_INFO("Opened contraints histogram " << m_hWeightHistName);
-  }
-
-  ATH_CHECK(m_eventInfoKey.initialize());
-  ATH_CHECK(m_VxPrimContainerName.initialize(not m_VxPrimContainerName.key().empty()));
-  ATH_CHECK(m_tracksName.initialize());
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonGenericTracks::bookHistograms() {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    // book histograms that are only made in the online environment...
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Running in online mode " << std::endl;
-  }
-
-  if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-    // book histograms that are only relevant for cosmics data...
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Running in cosmic mode " << std::endl;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Running in collision mode " << std::endl;
-  }
-
-  std::string outputDirName = "IDAlignMon/" + m_tracksName.key() + "_" + m_triggerChainName + "/GenericTracks";
-  MonGroup al_mon(this, outputDirName, run);
-  MonGroup al_mon_ls(this, outputDirName, lowStat);
-
-  //if ( newLowStatFlag ) {    }
-  //if ( newLumiBlockFlag() ) {    }
-  if (newRunFlag()) {
-    //if user environment specified we don't want to book new histograms at every run boundary
-    //we instead want one histogram per job
-    if (m_histosBooked != 0 && AthenaMonManager::environment() == AthenaMonManager::user) return StatusCode::SUCCESS;
-
-    const Int_t nx = 12;
-    TString hitSummary[nx] = {
-      "PixHits #geq 3", "SCTHits #geq 8", "TRTHits #geq 20", "PixHitsB #geq 3", "SCTHitsB #geq 8", "TRTHitsB #geq 20",
-      "PixHitsECA #geq 2", "SCTHitsECA #geq 2", "TRTHitsECA #geq 15", "PixHitsECC #geq 2", "SCTHitsECC #geq 2",
-      "TRTHitsECC #geq 15"
-    };
-
-    m_summary = new TH1F("summary", "summary", 12, -0.5, 11.5);
-    for (int i = 1; i <= m_summary->GetNbinsX(); i++) m_summary->GetXaxis()->SetBinLabel(i, hitSummary[i - 1]);
-    m_summary->GetYaxis()->SetTitle("Number of Tracks");
-    RegisterHisto(al_mon, m_summary);
-
-
-
-    if (m_doIP) {
-      m_trk_d0_wrtPV_vs_phi_vs_eta = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta", "d0 vs phi vs eta", 100, -3., 3., 40, 0,
-                                              2 * M_PI, 100, -0.5, 0.5);
-      m_trk_d0_wrtPV_vs_phi_vs_eta_barrel = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_barrel", "d0 vs phi vs eta (Barrel)",
-                                                     100, -3., 3., 40, 0, 2 * M_PI, 100, -0.5, 0.5);
-      m_trk_d0_wrtPV_vs_phi_vs_eta_ecc = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_ecc", "d0 vs phi vs eta (Endcap C)", 100,
-                                                  -3., 3., 40, 0, 2 * M_PI, 100, -0.5, 0.5);
-      m_trk_d0_wrtPV_vs_phi_vs_eta_eca = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_eca", "d0 vs phi vs eta (Endcap A)", 100,
-                                                  -3., 3., 40, 0, 2 * M_PI, 100, -0.5, 0.5);
-
-      m_trk_z0_wrtPV_vs_phi_vs_eta = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta", "d0 vs phi vs eta", 100, -3., 3., 40, 0,
-                                              2 * M_PI, 100, -1, 1);
-      m_trk_z0_wrtPV_vs_phi_vs_eta_barrel = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta_barrel", "d0 vs phi vs eta (Barrel)",
-                                                     100, -3., 3., 40, 0, 2 * M_PI, 100, -1, 1);
-      m_trk_z0_wrtPV_vs_phi_vs_eta_ecc = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta_ecc", "d0 vs phi vs eta (Endcap C)", 100,
-                                                  -3., 3., 40, 0, 2 * M_PI, 100, -1, 1);
-      m_trk_z0_wrtPV_vs_phi_vs_eta_eca = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta_eca", "d0 vs phi vs eta (Endcap A)", 100,
-                                                  -3., 3., 40, 0, 2 * M_PI, 100, -1, 1);
-
-
-      RegisterHisto(al_mon, m_trk_d0_wrtPV_vs_phi_vs_eta);
-      RegisterHisto(al_mon, m_trk_d0_wrtPV_vs_phi_vs_eta_barrel);
-      RegisterHisto(al_mon, m_trk_d0_wrtPV_vs_phi_vs_eta_ecc);
-      RegisterHisto(al_mon, m_trk_d0_wrtPV_vs_phi_vs_eta_eca);
-
-      RegisterHisto(al_mon, m_trk_z0_wrtPV_vs_phi_vs_eta);
-      RegisterHisto(al_mon, m_trk_z0_wrtPV_vs_phi_vs_eta_barrel);
-      RegisterHisto(al_mon, m_trk_z0_wrtPV_vs_phi_vs_eta_ecc);
-      RegisterHisto(al_mon, m_trk_z0_wrtPV_vs_phi_vs_eta_eca);
-    }
-
-
-    //###############
-
-
-    m_nhits_per_event = new TH1F("Nhits_per_event", "Number of hits per event", 1024, -0.5, 1023.5);
-    RegisterHisto(al_mon, m_nhits_per_event);
-    m_nhits_per_event->GetXaxis()->SetTitle("Number of Hits on Tracks per Event");
-    m_nhits_per_event->GetYaxis()->SetTitle("Number of Events");
-
-    m_ntrk = new TH1F("ntracks", "Number of Tracks", m_NTracksRange + 1, -0.5, m_NTracksRange + 0.5);
-    RegisterHisto(al_mon, m_ntrk);
-    m_ntrk->GetXaxis()->SetTitle("Number of Tracks");
-    m_ntrk->GetYaxis()->SetTitle("Number of Events");
-
-    m_ngtrk = new TH1F("ngtracks", "Number of Good Tracks", m_NTracksRange + 1, -0.5, m_NTracksRange + 0.5);
-    RegisterHisto(al_mon, m_ngtrk);
-    m_ngtrk->GetXaxis()->SetTitle("Number of Good Tracks");
-    m_ngtrk->GetYaxis()->SetTitle("Number of Events");
-
-    m_nhits_per_track = new TH1F("Nhits_per_track", "Number of hits per track", 101, -0.5, 100.5);
-    RegisterHisto(al_mon, m_nhits_per_track);
-    m_nhits_per_track->GetXaxis()->SetTitle("Number of Hits per Track");
-    m_nhits_per_track->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_npixhits_per_track_barrel = new TH1F("Npixhits_per_track_barrel", "Number of pixhits per track (Barrel)",
-                                           m_rangePixHits, -0.5, (m_rangePixHits - 0.5));
-    RegisterHisto(al_mon, m_npixhits_per_track_barrel);
-    m_npixhits_per_track_barrel->GetXaxis()->SetTitle("Number of Pixel Hits per Track in Barrel");
-    m_npixhits_per_track_barrel->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_nscthits_per_track_barrel = new TH1F("Nscthits_per_track_barrel", "Number of scthits per track (Barrel)",
-                                           m_rangeSCTHits, -0.5, (m_rangeSCTHits - 0.5));
-    RegisterHisto(al_mon, m_nscthits_per_track_barrel);
-    m_nscthits_per_track_barrel->GetXaxis()->SetTitle("Number of SCT Hits per Track in Barrel");
-    m_nscthits_per_track_barrel->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_ntrthits_per_track_barrel = new TH1F("Ntrthits_per_track_barrel", "Number of trthits per track (Barrel)",
-                                           m_rangeTRTHits, -0.5, (m_rangeTRTHits - 0.5));
-    RegisterHisto(al_mon, m_ntrthits_per_track_barrel);
-    m_ntrthits_per_track_barrel->GetXaxis()->SetTitle("Number of TRT Hits per Track in Barrel");
-    m_ntrthits_per_track_barrel->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_npixhits_per_track_eca = new TH1F("Npixhits_per_track_eca", "Number of pixhits per track (Eca)", m_rangePixHits,
-                                        -0.5, (m_rangePixHits - 0.5));
-    RegisterHisto(al_mon, m_npixhits_per_track_eca);
-    m_npixhits_per_track_eca->GetXaxis()->SetTitle("Number of Pixel Hits per Track in ECA");
-    m_npixhits_per_track_eca->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_nscthits_per_track_eca = new TH1F("Nscthits_per_track_eca", "Number of scthits per track (Eca)", m_rangeSCTHits,
-                                        -0.5, (m_rangeSCTHits - 0.5));
-    RegisterHisto(al_mon, m_nscthits_per_track_eca);
-    m_nscthits_per_track_eca->GetXaxis()->SetTitle("Number of SCT Hits per Track in ECA");
-    m_nscthits_per_track_eca->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_ntrthits_per_track_eca = new TH1F("Ntrthits_per_track_eca", "Number of trthits per track (Eca)", m_rangeTRTHits,
-                                        -0.5, (m_rangeTRTHits - 0.5));
-    RegisterHisto(al_mon, m_ntrthits_per_track_eca);
-    m_ntrthits_per_track_eca->GetXaxis()->SetTitle("Number of TRT Hits per Track in ECA");
-    m_ntrthits_per_track_eca->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_npixhits_per_track_ecc = new TH1F("Npixhits_per_track_ecc", "Number of pixhits per track (Ecc)", m_rangePixHits,
-                                        -0.5, (m_rangePixHits - 0.5));
-    RegisterHisto(al_mon, m_npixhits_per_track_ecc);
-    m_npixhits_per_track_ecc->GetXaxis()->SetTitle("Number of Pixel Hits per Track in ECC");
-    m_npixhits_per_track_ecc->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_nscthits_per_track_ecc = new TH1F("Nscthits_per_track_ecc", "Number of scthits per track (Ecc)", m_rangeSCTHits,
-                                        -0.5, (m_rangeSCTHits - 0.5));
-    RegisterHisto(al_mon, m_nscthits_per_track_ecc);
-    m_nscthits_per_track_ecc->GetXaxis()->SetTitle("Number of SCT Hits per Track in ECC");
-    m_nscthits_per_track_ecc->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_ntrthits_per_track_ecc = new TH1F("Ntrthits_per_track_ecc", "Number of trthits per track (Ecc)", m_rangeTRTHits,
-                                        -0.5, (m_rangeTRTHits - 0.5));
-    RegisterHisto(al_mon, m_ntrthits_per_track_ecc);
-    m_ntrthits_per_track_ecc->GetXaxis()->SetTitle("Number of TRT Hits per Track in ECC");
-    m_ntrthits_per_track_ecc->GetYaxis()->SetTitle("Number of Tracks");
-
-    ///////////////////////////////////////////////////////////////////////////////////////////////////
-    //Monitoring plots shown in the dqm web page
-    ///////////////////////////////////////////////////////////////////////////////////////////////////
-    m_chi2oDoF = new TH1F("chi2oDoF", "chi2oDoF", 100, 0., 10.);
-    RegisterHisto(al_mon, m_chi2oDoF);
-    m_chi2oDoF->GetXaxis()->SetTitle("Track #chi^{2} / NDoF");
-    m_chi2oDoF->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_eta = new TH1F("eta", "eta", 80, -m_etaRange, m_etaRange);
-    RegisterHisto(al_mon_ls, m_eta);
-    m_eta->GetXaxis()->SetTitle("Track #eta");
-    m_eta->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_phi = new TH1F("phi", "phi", 80, 0, 2 * M_PI);
-    RegisterHisto(al_mon_ls, m_phi);
-    m_phi->SetMinimum(0);
-    m_phi->GetXaxis()->SetTitle("Track #phi");
-    m_phi->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_d0_bscorr = new TH1F("d0_bscorr", "d0 (corrected for beamspot); d0 [mm]", m_d0BsNbins, -m_d0BsRange, m_d0BsRange);
-    RegisterHisto(al_mon_ls, m_d0_bscorr);
-
-    m_z0 = new TH1F("z0", "z0;[mm]", m_d0BsNbins, -m_z0Range, m_z0Range);
-    RegisterHisto(al_mon, m_z0);
-    m_z0sintheta = new TH1F("z0sintheta", "z0sintheta", m_d0BsNbins, -m_z0Range, m_z0Range);
-    RegisterHisto(al_mon, m_z0sintheta);
-
-    m_d0 = new TH1F("d0", "d0;[mm]", 2 * m_d0BsNbins, -m_d0Range, m_d0Range);
-    RegisterHisto(al_mon, m_d0);
-
-
-    m_npixhits_per_track =
-      new TH1F("Npixhits_per_track", "Number of pixhits per track", m_rangePixHits, -0.5, (m_rangePixHits - 0.5));
-    RegisterHisto(al_mon_ls, m_npixhits_per_track);
-    m_npixhits_per_track->GetXaxis()->SetTitle("Number of Pixel Hits per Track");
-    m_npixhits_per_track->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_nscthits_per_track =
-      new TH1F("Nscthits_per_track", "Number of scthits per track", m_rangeSCTHits, -0.5, (m_rangeSCTHits - 0.5));
-    RegisterHisto(al_mon_ls, m_nscthits_per_track);
-    m_nscthits_per_track->GetXaxis()->SetTitle("Number of SCT Hits per Track");
-    m_nscthits_per_track->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_ntrthits_per_track =
-      new TH1F("Ntrthits_per_track", "Number of trthits per track", m_rangeTRTHits, -0.5, (m_rangeTRTHits - 0.5));
-    RegisterHisto(al_mon_ls, m_ntrthits_per_track);
-    m_ntrthits_per_track->GetXaxis()->SetTitle("Number of TRT Hits per Track");
-    m_ntrthits_per_track->GetYaxis()->SetTitle("Number of Tracks");
-    ///////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-
-
-    m_trk_qopT_vs_phi_barrel = new TProfile("trk_qopT_vs_phi_barrel", "Q/pT versus phi0 (Barrel)", 20, 0, 2 * M_PI,
-                                            -10.0, 10.0);
-    RegisterHisto(al_mon, m_trk_qopT_vs_phi_barrel);
-    m_trk_d0_vs_phi_barrel = new TProfile("trk_d0_vs_phi_barrel", "Impact parameter versus phi0 (Barrel)", 20, 0,
-                                          2 * M_PI, -5, 5);
-    RegisterHisto(al_mon, m_trk_d0_vs_phi_barrel);
-    m_trk_d0_vs_z0_barrel = new TProfile("trk_d0_vs_z0_barrel", "Impact parameter versus z0 (Barrel)", 100, -200, 200,
-                                         -5, 5);
-    m_trk_qopT_vs_phi_eca = new TProfile("trk_qopT_vs_phi_eca", "Q/pT versus phi0 (Endcap A)", 20, 0, 2 * M_PI, -10.0,
-                                         10.0);
-    RegisterHisto(al_mon, m_trk_qopT_vs_phi_eca);
-    m_trk_d0_vs_phi_eca = new TProfile("trk_d0_vs_phi_eca", "Impact parameter versus phi0 (Endcap A)", 20, 0, 2 * M_PI,
-                                       -5, 5);
-    RegisterHisto(al_mon, m_trk_d0_vs_phi_eca);
-    m_trk_d0_vs_z0_eca =
-      new TProfile("trk_d0_vs_z0_eca", "Impact parameter versus z0 (Endcap A)", 100, -200, 200, -5, 5);
-    RegisterHisto(al_mon, m_trk_d0_vs_z0_eca);
-    m_trk_qopT_vs_phi_ecc = new TProfile("trk_qopT_vs_phi_ecc", "Q/pT versus phi0 (Endcap C)", 20, 0, 2 * M_PI, -10.0,
-                                         10.0);
-    RegisterHisto(al_mon, m_trk_qopT_vs_phi_ecc);
-    m_trk_d0_vs_phi_ecc = new TProfile("trk_d0_vs_phi_ecc", "Impact parameter versus phi0 (Endcap C)", 20, 0, 2 * M_PI,
-                                       -5, 5);
-    RegisterHisto(al_mon, m_trk_d0_vs_phi_ecc);
-    m_trk_d0_vs_z0_ecc =
-      new TProfile("trk_d0_vs_z0_ecc", "Impact parameter versus z0 (Endcap C)", 100, -200, 200, -5, 5);
-    RegisterHisto(al_mon, m_trk_d0_vs_z0_ecc);
-
-
-    //Negative and positive tracks perigee parameters
-    RegisterHisto(al_mon, m_trk_d0_vs_z0_barrel);
-    m_trk_phi0_neg_barrel = new TH1F("trk_phi0_neg_barrel", "Phi distribution for negative tracks (Barrel)", 20, 0,
-                                     2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_neg_barrel);
-    m_trk_phi0_pos_barrel = new TH1F("trk_phi0_pos_barrel", "Phi distribution for positive tracks (Barrel)", 20, 0,
-                                     2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_pos_barrel);
-    m_trk_pT_neg_barrel = new TH1F("trk_pT_neg_barrel", "pT distribution for negative tracks (Barrel)", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_neg_barrel);
-    m_trk_pT_pos_barrel = new TH1F("trk_pT_pos_barrel", "pT distribution for positive tracks (Barrel)", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_pos_barrel);
-    m_trk_phi0_neg_eca =
-      new TH1F("trk_phi0_neg_eca", "Phi distribution for negative tracks (Endcap A)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_neg_eca);
-    m_trk_phi0_pos_eca =
-      new TH1F("trk_phi0_pos_eca", "Phi distribution for positive tracks (Endcap A)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_pos_eca);
-    m_trk_pT_neg_eca = new TH1F("trk_pT_neg_eca", "pT distribution for negative tracks (Endcap A)", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_neg_eca);
-    m_trk_pT_pos_eca = new TH1F("trk_pT_pos_eca", "pT distribution for positive tracks (Endcap A)", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_pos_eca);
-
-    m_trk_phi0_neg_ecc =
-      new TH1F("trk_phi0_neg_ecc", "Phi distribution for negative tracks (Endcap C)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_neg_ecc);
-    m_trk_phi0_pos_ecc =
-      new TH1F("trk_phi0_pos_ecc", "Phi distribution for positive tracks (Endcap C)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_pos_ecc);
-    m_trk_pT_neg_ecc = new TH1F("trk_pT_neg_ecc", "pT distribution for negative tracks (Endcap C)", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_neg_ecc);
-    m_trk_pT_pos_ecc = new TH1F("trk_pT_pos_ecc", "pT distribution for positive tracks (Endcap C)", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_pos_ecc);
-
-    //Asymmetry plots. Useful to spot weak modes
-    m_trk_phi0_asym_barrel = new TH1F("trk_phi0_asym_barrel", "Track Charge Asymmetry versus phi (Barrel) ", 20, 0,
-                                      2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_asym_barrel);
-    m_trk_phi0_asym_eca =
-      new TH1F("trk_phi0_asym_eca", "Track Charge Asymmetry versus phi (Endcap A) ", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_asym_eca);
-    m_trk_phi0_asym_ecc =
-      new TH1F("trk_phi0_asym_ecc", "Track Charge Asymmetry versus phi (Endcap C) ", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_trk_phi0_asym_ecc);
-    m_trk_pT_asym_barrel = new TH1F("trk_pT_asym_barrel", "Track Charge Asymmetry versus pT (Barrel) ", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_asym_barrel);
-    m_trk_pT_asym_eca = new TH1F("trk_pT_asym_eca", "Track Charge Asymmetry versus pT (Endcap A) ", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_asym_eca);
-    m_trk_pT_asym_ecc = new TH1F("trk_pT_asym_ecc", "Track Charge Asymmetry versus pT (Endcap C) ", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_asym_ecc);
-
-
-    if (m_extendedPlots) {
-      // histo for self beam spot calculation (using the data of the whole run... so nothing to do with the beam spot by
-      // Lumiblock). I think is useless. Remove.
-      m_trk_d0_vs_phi0_z0 = new TH3F("trk_d0_vs_phi0_z0", "Track d_{0} vs #phi_{0} and z_{0}", 30, 0., 2 * M_PI, 20,
-                                     -m_z0Range / 2, m_z0Range / 2, 30, -m_d0Range, m_d0Range);
-      m_trk_d0_vs_phi0_z0->SetXTitle("Track #phi_{0} [rad]");
-      m_trk_d0_vs_phi0_z0->SetYTitle("Track z_{0} [mm]");
-      RegisterHisto(al_mon, m_trk_d0_vs_phi0_z0);
-
-      m_trk_d0_vs_phi_vs_eta = new TH3F("trk_d0_vs_phi_vs_eta", "d0 vs phi vs eta", 100, -3., 3., 40, 0, 2 * M_PI, 100,
-                                        -0.2, 0.2);
-      m_trk_pT_vs_eta = new TH2F("trk_pT_vs_eta", "pT vs eta ", 100, -3., 3., 100, 0., 50.);
-      m_trk_d0_vs_phi_vs_eta_barrel = new TH3F("trk_d0_vs_phi_vs_eta_barrel", "d0 vs phi vs eta (Barrel)", 100, -3., 3.,
-                                               40, 0, 2 * M_PI, 100, -0.2, 0.2);
-      m_trk_pT_vs_eta_barrel = new TH2F("trk_pT_vs_eta_barrel", "pT vs eta barrel", 100, -3., 3., 100, 0., 50.);
-      m_trk_d0_vs_phi_vs_eta_ecc = new TH3F("trk_d0_vs_phi_vs_eta_ecc", "d0 vs phi vs eta (Endcap C)", 100, -3., 3., 40,
-                                            0, 2 * M_PI, 100, -0.2, 0.2);
-      m_trk_pT_vs_eta_ecc = new TH2F("trk_pT_vs_eta_ecc", "pT vs eta ecc", 100, -3., 3., 100, 0., 50.);
-      m_trk_d0_vs_phi_vs_eta_eca = new TH3F("trk_d0_vs_phi_vs_eta_eca", "d0 vs phi vs eta (Endcap A)", 100, -3., 3., 40,
-                                            0, 2 * M_PI, 100, -0.2, 0.2);
-      m_trk_pT_vs_eta_eca = new TH2F("trk_pT_vs_eta_eca", "pT vs eta eca", 100, -3., 3., 100, 0., 50.);
-
-
-      RegisterHisto(al_mon, m_trk_d0_vs_phi_vs_eta);
-      RegisterHisto(al_mon, m_trk_pT_vs_eta);
-      RegisterHisto(al_mon, m_trk_d0_vs_phi_vs_eta_barrel);
-      RegisterHisto(al_mon, m_trk_pT_vs_eta_barrel);
-      RegisterHisto(al_mon, m_trk_d0_vs_phi_vs_eta_ecc);
-      RegisterHisto(al_mon, m_trk_pT_vs_eta_ecc);
-      RegisterHisto(al_mon, m_trk_d0_vs_phi_vs_eta_eca);
-      RegisterHisto(al_mon, m_trk_pT_vs_eta_eca);
-
-      m_trk_d0_barrel = new TH1F("trk_d0_barrel", "Impact parameter: all tracks (Barrel); d_{0} [mm]", 100, -m_d0Range,
-                                 m_d0Range);
-      m_trk_d0c_barrel = new TH1F("trk_d0c_barrel", "Impact parameter (corrected for vertex): all tracks (Barrel)", 100,
-                                  -4., 4.);
-      m_trk_z0_barrel = new TH1F("trk_z0_barrel", "Track z0: all tracks (Barrel)", 100, -m_z0Range, m_z0Range);
-      m_trk_d0_eca = new TH1F("trk_d0_eca", "Impact parameter: all tracks (Endcap A)", 100, -m_d0Range, m_d0Range);
-      m_trk_d0c_eca = new TH1F("trk_d0c_eca", "Impact parameter (corrected for vertex): all tracks  (Endcap A)", 100,
-                               -m_d0Range, m_d0Range);
-      m_trk_z0_eca = new TH1F("trk_z0_eca", "Track z0: all tracks (Endcap A)", 100, -m_z0Range, m_z0Range);
-      m_trk_d0_ecc = new TH1F("trk_d0_ecc", "Impact parameter: all tracks (Endcap C)", 100, -m_d0Range, m_d0Range);
-      m_trk_d0c_ecc = new TH1F("trk_d0c_ecc", "Impact parameter (corrected for vertex): all tracks  (Endcap C)", 100,
-                               -m_d0Range, m_d0Range);
-      m_trk_z0_ecc = new TH1F("trk_z0_ecc", "Track z0: all tracks (Endcap C)", 100, -m_z0Range, m_z0Range);
-
-
-      RegisterHisto(al_mon, m_trk_d0_barrel);
-      RegisterHisto(al_mon, m_trk_d0c_barrel);
-      RegisterHisto(al_mon, m_trk_z0_barrel);
-      RegisterHisto(al_mon, m_trk_d0_eca);
-      RegisterHisto(al_mon, m_trk_d0c_eca);
-      RegisterHisto(al_mon, m_trk_z0_eca);
-      RegisterHisto(al_mon, m_trk_d0_ecc);
-      RegisterHisto(al_mon, m_trk_d0c_ecc);
-      RegisterHisto(al_mon, m_trk_z0_ecc);
-
-
-
-      m_trk_chi2oDoF = new TProfile("trk_chi2oDoF", "chi2oDoF versus eta", 100, -m_etaRange, m_etaRange, -5, 5);
-      RegisterHisto(al_mon, m_trk_chi2oDoF);
-      m_trk_chi2Prob = new TProfile("trk_chi2Prob", "chi2Prob versus eta", 100, -m_etaRange, m_etaRange, -5, 5);
-      RegisterHisto(al_mon, m_trk_chi2Prob);
-
-
-      //Detailed IP Plots. All the PV Corrected are broken and need to be fixed.
-      m_trk_d0_barrel_zoomin = new TH1F("trk_d0_barrel_zoomin", "Impact parameter: all tracks (Barrel)", 100, -5, 5);
-      m_trk_z0_barrel_zoomin = new TH1F("trk_z0_barrel_zoomin", "Track z0: all tracks (Barrel)", 100, -300, 300);
-      m_trk_d0_eca_zoomin = new TH1F("trk_d0_eca_zoomin", "Impact parameter: all tracks (Endcap A)", 100, -5, 5);
-      m_trk_z0_eca_zoomin = new TH1F("trk_z0_eca_zoomin", "Track z0: all tracks (Endcap A)", 100, -300, 300);
-      m_trk_d0_ecc_zoomin = new TH1F("trk_d0_ecc_zoomin", "Impact parameter: all tracks (Endcap C)", 100, -5, 5);
-      m_trk_z0_ecc_zoomin = new TH1F("trk_z0_ecc_zoomin", "Track z0: all tracks (Endcap C)", 100, -300, 300);
-
-      RegisterHisto(al_mon, m_trk_d0_barrel_zoomin);
-      RegisterHisto(al_mon, m_trk_z0_barrel_zoomin);
-      RegisterHisto(al_mon, m_trk_d0_eca_zoomin);
-      RegisterHisto(al_mon, m_trk_z0_eca_zoomin);
-      RegisterHisto(al_mon, m_trk_d0_ecc_zoomin);
-      RegisterHisto(al_mon, m_trk_z0_ecc_zoomin);
-
-
-
-      //###############
-      double z0cRange = 5;
-      double d0cRange = 0.1;
-      m_trk_d0c_neg = new TH1F("trk_d0c_neg", "Impact parameter: all negative charged tracks", 50, -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_neg);
-      m_trk_d0c_pos = new TH1F("trk_d0c_pos", "Impact parameter: all positive charged tracks", 50, -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_pos);
-      m_trk_d0c_neg_barrel = new TH1F("trk_d0c_neg_barrel", "Impact parameter: all negative charged tracks (Barrel)",
-                                      50, -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_neg_barrel);
-      m_trk_d0c_pos_barrel = new TH1F("trk_d0c_pos_barrel", "Impact parameter: all positive charged tracks (Barrel)",
-                                      50, -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_pos_barrel);
-      m_trk_d0c_neg_eca = new TH1F("trk_d0c_neg_eca", "Impact parameter: all negative charged tracks (Endcap A)", 50,
-                                   -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_neg_eca);
-      m_trk_d0c_pos_eca = new TH1F("trk_d0c_pos_eca", "Impact parameter: all positive charged tracks (Endcap A)", 50,
-                                   -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_pos_eca);
-      m_trk_d0c_neg_ecc = new TH1F("trk_d0c_neg_ecc", "Impact parameter: all negative charged tracks (Endcap C)", 50,
-                                   -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_neg_ecc);
-      m_trk_d0c_pos_ecc = new TH1F("trk_d0c_pos_ecc", "Impact parameter: all positive charged tracks (Endcap C)", 50,
-                                   -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_pos_ecc);
-
-      m_trk_d0c_asym = new TH1F("trk_d0c_asym", "Track Charge Asymmetry versus d0 (corrected for vertex)", 50,
-                                -d0cRange, d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_asym);
-      m_trk_d0c_asym->GetYaxis()->SetTitle("d_0 (mm)");
-      m_trk_d0c_asym->GetYaxis()->SetTitle("(pos-neg)/(pos+neg)");
-
-      m_trk_d0c_asym_barrel = new TH1F("trk_d0c_asym_barrel",
-                                       "Track Charge Asymmetry versus d0 (Barrel, corrected for vertex)", 50, -d0cRange,
-                                       d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_asym_barrel);
-      m_trk_d0c_asym_eca = new TH1F("trk_d0c_asym_eca",
-                                    "Track Charge Asymmetry versus d0(Endcap A, corrected for vertex)", 50, -d0cRange,
-                                    d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_asym_eca);
-      m_trk_d0c_asym_ecc = new TH1F("trk_d0c_asym_ecc",
-                                    "Track Charge Asymmetry versus d0(Endcap C, corrected for vertex)", 50, -d0cRange,
-                                    d0cRange);
-      RegisterHisto(al_mon, m_trk_d0c_asym_ecc);
-
-      m_trk_z0c_neg = new TH1F("trk_z0c_neg", "z0: all negative charged tracks", 50, -z0cRange, z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_neg);
-      m_trk_z0c_pos = new TH1F("trk_z0c_pos", "z0: all positive charged tracks", 50, -z0cRange, z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_pos);
-      m_trk_z0c_neg_barrel = new TH1F("trk_z0c_neg_barrel", ":z0 all negative charged tracks (Barrel)", 50, -z0cRange,
-                                      z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_neg_barrel);
-      m_trk_z0c_pos_barrel = new TH1F("trk_z0c_pos_barrel", "z0: all positive charged tracks (Barrel)", 50, -z0cRange,
-                                      z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_pos_barrel);
-      m_trk_z0c_neg_eca = new TH1F("trk_z0c_neg_eca", "z0: all negative charged tracks (Endcap A)", 50, -z0cRange,
-                                   z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_neg_eca);
-      m_trk_z0c_pos_eca = new TH1F("trk_z0c_pos_eca", "z0: all positive charged tracks (Endcap A)", 50, -z0cRange,
-                                   z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_pos_eca);
-      m_trk_z0c_neg_ecc = new TH1F("trk_z0c_neg_ecc", "z0: all negative charged tracks (Endcap C)", 50, -z0cRange,
-                                   z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_neg_ecc);
-      m_trk_z0c_pos_ecc = new TH1F("trk_z0c_pos_ecc", "z0: all positive charged tracks (Endcap C)", 50, -z0cRange,
-                                   z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_pos_ecc);
-      m_trk_z0c_asym = new TH1F("trk_z0c_asym", "Track Charge Asymmetry versus z0 (corrected for vertex)", 50,
-                                -z0cRange, z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_asym);
-      m_trk_z0c_asym_barrel = new TH1F("trk_z0c_asym_barrel",
-                                       "Track Charge Asymmetry versus z0 (Barrel, corrected for vertex)", 50, -z0cRange,
-                                       z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_asym_barrel);
-      m_trk_z0c_asym_eca = new TH1F("trk_z0c_asym_eca",
-                                    "Track Charge Asymmetry versus z0(Endcap A, corrected for vertex)", 50, -z0cRange,
-                                    z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_asym_eca);
-      m_trk_z0c_asym_ecc = new TH1F("trk_z0c_asym_ecc",
-                                    "Track Charge Asymmetry versus z0(Endcap C, corrected for vertex)", 50, -z0cRange,
-                                    z0cRange);
-      RegisterHisto(al_mon, m_trk_z0c_asym_ecc);
-
-
-
-      //PV corrected plots. Broken.
-      m_d0_pvcorr = new TH1F("d0_pvcorr", "d0 (corrected for primVtx); [mm]", 400, -m_d0Range, m_d0Range);
-      RegisterHisto(al_mon, m_d0_pvcorr);
-      m_z0_pvcorr = new TH1F("z0_pvcorr", "z0 (corrected for primVtx);[mm]", 100, -m_z0Range, m_z0Range);
-      RegisterHisto(al_mon, m_z0_pvcorr);
-      m_z0sintheta_pvcorr = new TH1F("z0sintheta_pvcorr", "z*sintheta (corrected for primVtx); [mm]", 100, -m_z0Range,
-                                     m_z0Range);
-      RegisterHisto(al_mon, m_z0sintheta_pvcorr);
-
-
-      //hits
-      m_trk_PIXvSCTHits = new TH2F("PIXvSCTHits", "Hits On track", 30, -0.5, 30 - 0.5, 11, -0.5, 11 - 0.5);
-      RegisterHisto(al_mon, m_trk_PIXvSCTHits);
-      m_trk_PIXvSCTHits->GetXaxis()->SetTitle("# SCT hits on track");
-      m_trk_PIXvSCTHits->GetYaxis()->SetTitle("# PIX hits on track");
-
-      m_trk_PIXHitsvEta = new TH2F("PIXHitsvEta", "PIX Hits On track", 50, -3., 3., 11, -0.5, 11 - 0.5);
-      RegisterHisto(al_mon, m_trk_PIXHitsvEta);
-      m_trk_PIXHitsvEta->GetXaxis()->SetTitle("#eta");
-      m_trk_PIXHitsvEta->GetYaxis()->SetTitle("# PIX hits on track");
-
-      m_trk_SCTHitsvEta = new TH2F("SCTHitsvEta", "SCT Hits On track", 50, -3., 3., 21, -0.5, 21 - 0.5);
-      RegisterHisto(al_mon, m_trk_SCTHitsvEta);
-      m_trk_SCTHitsvEta->GetXaxis()->SetTitle("#eta");
-      m_trk_SCTHitsvEta->GetYaxis()->SetTitle("# SCT hits on track");
-
-      m_trk_TRTHitsvEta = new TH2F("TRTHitsvEta", "TRT Hits On track", 50, -3., 3., 51, -0.5, 51 - 0.5);
-      RegisterHisto(al_mon, m_trk_TRTHitsvEta);
-      m_trk_TRTHitsvEta->GetXaxis()->SetTitle("#eta");
-      m_trk_TRTHitsvEta->GetYaxis()->SetTitle("# TRT hits on track");
-
-
-      m_trk_chi2oDoF_Phi = new TH2F("trk_chi2oDoFvsPhi", "chi2oDoF versus phi", 100, 0, 2 * M_PI, 50, -5, 5);
-      RegisterHisto(al_mon, m_trk_chi2oDoF_Phi);
-      m_trk_chi2oDoF_Phi->GetXaxis()->SetTitle("#phi (rad)");
-      m_trk_chi2oDoF_Phi->GetYaxis()->SetTitle("Chi2");
-
-      m_trk_chi2oDoF_Pt = new TH2F("trk_chi2oDoFvsPt", "chi2oDoF versus Pt", 100, -40, 40, 50, -5, 5);
-      RegisterHisto(al_mon, m_trk_chi2oDoF_Pt);
-      m_trk_chi2oDoF_Pt->GetXaxis()->SetTitle("Pt (GeV)");
-      m_trk_chi2oDoF_Pt->GetYaxis()->SetTitle("Chi2");
-
-      m_trk_chi2oDoF_P = new TH2F("trk_chi2oDoFvsP", "chi2oDoF versus P", 100, -40, 40, 50, -5, 5);
-      RegisterHisto(al_mon, m_trk_chi2oDoF_P);
-      m_trk_chi2oDoF_P->GetXaxis()->SetTitle("P (GeV)");
-      m_trk_chi2oDoF_P->GetYaxis()->SetTitle("Chi2");
-
-      m_trk_chi2ProbDist = new TH1F("trk_chi2ProbDist", "chi2Prob distribution", 50, 0, 1);
-      m_trk_chi2ProbDist->GetXaxis()->SetTitle("Track #chi^{2} prob");
-      m_trk_chi2ProbDist->GetYaxis()->SetTitle("Number of Tracks");
-      RegisterHisto(al_mon, m_trk_chi2ProbDist);
-
-      m_errCotTheta = new TH1F("errCotTheta", "Error of CotTheta", 40, 0, 0.02);
-      RegisterHisto(al_mon, m_errCotTheta);
-      m_errCotTheta->GetXaxis()->SetTitle("Track #Delta(cot(#theta))");
-      m_errCotTheta->GetYaxis()->SetTitle("Number of Tracks");
-
-      m_errCotThetaVsD0BS = new TH2F("errCotThetaVsD0BS", "Error of CotTheta vs d0BS", 50, -m_d0BsRange, m_d0BsRange,
-                                     40, 0., 0.02);
-      RegisterHisto(al_mon, m_errCotThetaVsD0BS);
-      m_errCotThetaVsD0BS->GetXaxis()->SetTitle("d0 (mm)");
-      m_errCotThetaVsD0BS->GetYaxis()->SetTitle("Track #Delta(cot(#theta))");
-
-      m_errCotThetaVsPt = new TH2F("errCotThetaVsPt", "Error of CotTheta vs Pt", 50, 0, 40, 40, 0., 0.02);
-      RegisterHisto(al_mon, m_errCotThetaVsPt);
-      m_errCotThetaVsPt->GetXaxis()->SetTitle("Pt (GeV/c)");
-      m_errCotThetaVsPt->GetYaxis()->SetTitle("Track #Delta(cot(#theta))");
-
-      m_errCotThetaVsP = new TH2F("errCotThetaVsP", "Error of CotTheta vs P", 50, 0, 40, 40, 0., 0.02);
-      RegisterHisto(al_mon, m_errCotThetaVsP);
-      m_errCotThetaVsP->GetXaxis()->SetTitle("P (GeV/c)");
-      m_errCotThetaVsP->GetYaxis()->SetTitle("Track #Delta(cot(#theta))");
-
-      m_errCotThetaVsPhi = new TH2F("errCotThetaVsPhi", "Error of CotTheta vs Phi", 50, 0, 2 * M_PI, 40, 0., 0.02);
-      RegisterHisto(al_mon, m_errCotThetaVsPhi);
-      m_errCotThetaVsPhi->GetXaxis()->SetTitle("#phi0");
-      m_errCotThetaVsPhi->GetYaxis()->SetTitle("Track #Delta(cot(#theta))");
-
-      m_errCotThetaVsEta = new TH2F("errCotThetaVsEta", "Error of CotTheta vs Eta", 50, -3., 3., 40, 0., 0.02);
-      RegisterHisto(al_mon, m_errCotThetaVsEta);
-      m_errCotThetaVsEta->GetXaxis()->SetTitle("#eta");
-      m_errCotThetaVsEta->GetYaxis()->SetTitle("Track #Delta(cot(#theta))");
-
-      m_errTheta = new TH1F("errTheta", "Error of Theta", 50, 0, 0.02);
-      RegisterHisto(al_mon, m_errTheta);
-      m_errTheta->GetXaxis()->SetTitle("Track #Delta(#theta)");
-      m_errTheta->GetYaxis()->SetTitle("Number of Tracks");
-
-      m_errThetaVsD0BS =
-        new TH2F("errThetaVsD0BS", "Error of Theta vs d0BS", 50, -m_d0BsRange, m_d0BsRange, 50, 0, 0.02);
-      RegisterHisto(al_mon, m_errThetaVsD0BS);
-      m_errThetaVsD0BS->GetXaxis()->SetTitle("d0 (mm)");
-      m_errThetaVsD0BS->GetYaxis()->SetTitle("Track #delta(#theta)");
-
-      m_errThetaVsPt = new TH2F("errThetaVsPt", "Error of Theta vs Pt", 50, 0, 50, 50, 0, 0.02);
-      RegisterHisto(al_mon, m_errThetaVsPt);
-      m_errThetaVsPt->GetXaxis()->SetTitle("Pt (GeV/c)");
-      m_errThetaVsPt->GetYaxis()->SetTitle("Track #delta(#theta)");
-
-      m_errThetaVsP = new TH2F("errThetaVsP", "Error of Theta vs P", 50, 0, 50, 50, 0, 0.02);
-      RegisterHisto(al_mon, m_errThetaVsP);
-      m_errThetaVsP->GetXaxis()->SetTitle("P (GeV/c)");
-      m_errThetaVsP->GetYaxis()->SetTitle("Track #delta(#theta)");
-
-      m_errThetaVsPhi = new TH2F("errThetaVsPhi", "Error of Theta vs Phi", 50, 0, 2 * M_PI, 50, 0, 0.02);
-      RegisterHisto(al_mon, m_errThetaVsPhi);
-      m_errThetaVsPhi->GetXaxis()->SetTitle("#phi0");
-      m_errThetaVsPhi->GetYaxis()->SetTitle("Track #delta(#theta)");
-
-      m_errThetaVsEta = new TH2F("errThetaVsEta", "Error of Theta vs Eta", 50, -3., 3., 50, 0, 0.02);
-      RegisterHisto(al_mon, m_errThetaVsEta);
-      m_errThetaVsEta->GetXaxis()->SetTitle("#eta");
-      m_errThetaVsEta->GetYaxis()->SetTitle("Track #delta(#theta)");
-
-      m_errD0 = new TH1F("errD0", "Error of d0", 60, 0, 0.30);
-      RegisterHisto(al_mon, m_errD0);
-      m_errD0->GetXaxis()->SetTitle("d0 error (mm)");
-
-      m_errD0VsD0BS = new TH2F("errD0VsD0BS", "Error of d0 vs d0BS", 50, -m_d0BsRange, m_d0BsRange, 100, 0, 0.50);
-      RegisterHisto(al_mon, m_errD0VsD0BS);
-      m_errD0VsD0BS->GetXaxis()->SetTitle("d0 (mm)");
-      m_errD0VsD0BS->GetYaxis()->SetTitle("d0 error (mm)");
-
-      m_errD0VsPt = new TH2F("errD0VsPt", "Error of d0 vs Pt", 50, 0, 40, 100, 0, 0.50);
-      RegisterHisto(al_mon, m_errD0VsPt);
-      m_errD0VsPt->GetXaxis()->SetTitle("Pt (GeV/c)");
-      m_errD0VsPt->GetYaxis()->SetTitle("d0 error (mm)");
-
-      m_errD0VsP = new TH2F("errD0VsP", "Error of d0 vs P", 50, 0, 40, 100, 0, 0.50);
-      RegisterHisto(al_mon, m_errD0VsP);
-      m_errD0VsP->GetXaxis()->SetTitle("P (GeV/c)");
-      m_errD0VsP->GetYaxis()->SetTitle("d0 error (mm)");
-
-      m_errD0VsPhi = new TH2F("errD0VsPhi", "Error of d0 vs Phi", 90, 0, 2 * M_PI, 100, 0, 0.50);
-      RegisterHisto(al_mon, m_errD0VsPhi);
-      m_errD0VsPhi->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_errD0VsPhi->GetYaxis()->SetTitle("d0 error (mm)");
-
-      m_errD0VsPhiBarrel = new TH2F("errD0VsPhiBarrel", "Error of d0 vs Phi (Barrel)", 90, 0, 2 * M_PI, 100, 0, 0.50);
-      RegisterHisto(al_mon, m_errD0VsPhiBarrel);
-      m_errD0VsPhiBarrel->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_errD0VsPhiBarrel->GetYaxis()->SetTitle("d0 error (mm)");
-
-      m_errD0VsPhiECA = new TH2F("errD0VsPhiECA", "Error of d0 vs Phi (ECA)", 90, 0, 2 * M_PI, 100, 0, 0.50);
-      RegisterHisto(al_mon, m_errD0VsPhiECA);
-      m_errD0VsPhiECA->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_errD0VsPhiECA->GetYaxis()->SetTitle("d0 error (mm)");
-
-      m_errD0VsPhiECC = new TH2F("errD0VsPhiECC", "Error of d0 vs Phi (ECC)", 90, 0, 2 * M_PI, 100, 0, 0.50);
-      RegisterHisto(al_mon, m_errD0VsPhiECC);
-      m_errD0VsPhiECC->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_errD0VsPhiECC->GetYaxis()->SetTitle("d0 error (mm)");
-
-      m_errD0VsEta = new TH2F("errD0VsEta", "Error of d0 vs Eta", 50, -3., 3., 100, 0, 0.50);
-      RegisterHisto(al_mon, m_errD0VsEta);
-      m_errD0VsEta->GetXaxis()->SetTitle("#eta");
-      m_errD0VsEta->GetYaxis()->SetTitle("d0 error (mm)");
-
-      m_errPhi0 = new TH1F("errPhi0", "Error of Phi0", 50, 0, 0.010);
-      RegisterHisto(al_mon, m_errPhi0);
-      m_errPhi0->GetXaxis()->SetTitle("#phi0 error (rad)");
-
-      m_errPhi0VsD0BS = new TH2F("errPhi0VsD0BS", "Error of Phi0 vs d0BS", 50, -m_d0BsRange, m_d0BsRange, 50, 0, 0.010);
-      RegisterHisto(al_mon, m_errPhi0VsD0BS);
-      m_errPhi0VsD0BS->GetXaxis()->SetTitle("d0 (mm)");
-      m_errPhi0VsD0BS->GetYaxis()->SetTitle("#phi0 error (rad)");
-
-      m_errPhi0VsPt = new TH2F("errPhi0VsPt", "Error of Phi0 vs Pt", 50, 0, 40, 50, 0, 0.010);
-      RegisterHisto(al_mon, m_errPhi0VsPt);
-      m_errPhi0VsPt->GetXaxis()->SetTitle("Pt (GeV/c)");
-      m_errPhi0VsPt->GetYaxis()->SetTitle("#phi0 error (rad)");
-
-      m_errPhi0VsP = new TH2F("errPhi0VsP", "Error of Phi0 vs P", 50, 0, 40, 50, 0, 0.010);
-      RegisterHisto(al_mon, m_errPhi0VsP);
-      m_errPhi0VsP->GetXaxis()->SetTitle("P (GeV/c)");
-      m_errPhi0VsP->GetYaxis()->SetTitle("#phi0 error (rad)");
-
-      m_errPhi0VsPhi0 = new TH2F("errPhi0VsPhi0", "Error of Phi0 vs Phi0", 90, 0, 2 * M_PI, 50, 0, 0.010);
-      RegisterHisto(al_mon, m_errPhi0VsPhi0);
-      m_errPhi0VsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_errPhi0VsPhi0->GetYaxis()->SetTitle("#phi0 error (rad)");
-
-      m_errPhi0VsEta = new TH2F("errPhi0VsEta", "Error of Phi0 vs Eta", 50, -3., 3., 50, 0, 0.010);
-      RegisterHisto(al_mon, m_errPhi0VsEta);
-      m_errPhi0VsEta->GetXaxis()->SetTitle("#eta");
-      m_errPhi0VsEta->GetYaxis()->SetTitle("#phi0 error (rad)");
-
-      m_errZ0 = new TH1F("errZ0", "Error of Z0", 50, 0, 0.3);
-      RegisterHisto(al_mon, m_errZ0);
-      m_errZ0->GetXaxis()->SetTitle("z0 error (mm)");
-
-      m_errZ0VsD0BS = new TH2F("errZ0VsD0BS", "Error of Z0 vs D0BS", 50, -m_d0BsRange, m_d0BsRange, 50, 0, 0.3);
-      RegisterHisto(al_mon, m_errZ0VsD0BS);
-      m_errZ0VsD0BS->GetXaxis()->SetTitle("d0 (mm)");
-      m_errZ0VsD0BS->GetYaxis()->SetTitle("z0 error (mm)");
-
-      m_errZ0VsPt = new TH2F("errZ0VsPt", "Error of Z0 vs Pt", 50, 0, 40, 50, 0, 0.3);
-      RegisterHisto(al_mon, m_errZ0VsPt);
-      m_errZ0VsPt->GetXaxis()->SetTitle("Pt (GeV/c)");
-      m_errZ0VsPt->GetYaxis()->SetTitle("z0 error (mm)");
-
-      m_errZ0VsP = new TH2F("errZ0VsP", "Error of Z0 vs P", 50, 0, 40, 50, 0, 0.3);
-      RegisterHisto(al_mon, m_errZ0VsP);
-      m_errZ0VsP->GetXaxis()->SetTitle("P (GeV/c)");
-      m_errZ0VsP->GetYaxis()->SetTitle("z0 error (mm)");
-
-      m_errZ0VsPhi0 = new TH2F("errZ0VsPhi0", "Error of Z0 vs Phi0", 50, 0, 2 * M_PI, 50, 0, 0.3);
-      RegisterHisto(al_mon, m_errZ0VsPhi0);
-      m_errZ0VsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_errZ0VsPhi0->GetYaxis()->SetTitle("z0 error (mm)");
-
-      m_errZ0VsEta = new TH2F("errZ0VsEta", "Error of Z0 vs Eta", 50, -3., 3., 50, 0, 0.3);
-      RegisterHisto(al_mon, m_errZ0VsEta);
-      m_errZ0VsEta->GetXaxis()->SetTitle("#eta");
-      m_errZ0VsEta->GetYaxis()->SetTitle("z0 error (mm)");
-
-      m_errPt = new TH1F("errPt", "Error of Pt", 50, 0., 1.);
-      RegisterHisto(al_mon, m_errPt);
-      m_errPt->GetXaxis()->SetTitle("Pt err (GeV/c)");
-
-      m_errPtVsD0BS = new TH2F("errPtVsD0BS", "Error of Pt Vs doBS", 50, -m_d0BsRange, m_d0BsRange, 50, 0., 0.5);
-      RegisterHisto(al_mon, m_errPtVsD0BS);
-      m_errPtVsD0BS->GetXaxis()->SetTitle("d0 (mm)");
-      m_errPtVsD0BS->GetYaxis()->SetTitle("Pt error (GeV/c)");
-
-      m_errPtVsPt = new TH2F("errPtVsPt", "Error of Pt Vs Pt", 50, 0, 40., 50, 0., 0.5);
-      RegisterHisto(al_mon, m_errPtVsPt);
-      m_errPtVsPt->GetXaxis()->SetTitle("Pt (GeV/c)");
-      m_errPtVsPt->GetYaxis()->SetTitle("Pt error (GeV/c)");
-
-      m_errPtVsP = new TH2F("errPtVsP", "Error of Pt Vs P", 50, 0, 40., 50, 0., 0.5);
-      RegisterHisto(al_mon, m_errPtVsP);
-      m_errPtVsP->GetXaxis()->SetTitle("P (GeV/c)");
-      m_errPtVsP->GetYaxis()->SetTitle("P error (GeV/c)");
-
-      m_errPtVsPhi0 = new TH2F("errPtVsPhi0", "Error of Pt Vs Phi0", 50, 0, 2 * M_PI, 50, 0., 0.5);
-      RegisterHisto(al_mon, m_errPtVsPhi0);
-      m_errPtVsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_errPtVsPhi0->GetYaxis()->SetTitle("Pt error (GeV/c)");
-
-      m_PtVsPhi0Pos = new TH2F("errPtVsPhi0Pos", "Pt Vs Phi0 (q>0)", 50, 0, 2 * M_PI, 50, 0., 40.);
-      RegisterHisto(al_mon, m_PtVsPhi0Pos);
-      m_PtVsPhi0Pos->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_PtVsPhi0Pos->GetYaxis()->SetTitle("Pt (GeV/c)");
-
-      m_PtVsPhi0Neg = new TH2F("errPtVsPhi0Neg", "Pt Vs Phi0 (q<0)", 50, 0, 2 * M_PI, 50, 0., 40.);
-      RegisterHisto(al_mon, m_PtVsPhi0Neg);
-      m_PtVsPhi0Neg->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_PtVsPhi0Neg->GetYaxis()->SetTitle("Pt (GeV/c)");
-
-      m_errPtVsEta = new TH2F("errPtVsEta", "Error of Pt Vs Eta", 50, -3., 3., 50, 0., 0.5);
-      RegisterHisto(al_mon, m_errPtVsEta);
-      m_errPtVsEta->GetXaxis()->SetTitle("#eta");
-      m_errPtVsEta->GetYaxis()->SetTitle("Pt error (GeV/c)");
-
-      m_errPt_Pt2 = new TH1F("errPt_Pt2", "Error of Pt/Pt^{2}", 50, 0., 0.015);
-      RegisterHisto(al_mon, m_errPt_Pt2);
-      m_errPt_Pt2->GetXaxis()->SetTitle("#sigma(Pt)/Pt^{2} (GeV/c)^{-1}");
-
-      m_errPt_Pt2VsPt = new TH2F("errPt_Pt2VsPt", "Error of Pt / Pt^2 Vs Pt", 50, 0, 40., 50, 0., 0.015);
-      RegisterHisto(al_mon, m_errPt_Pt2VsPt);
-      m_errPt_Pt2VsPt->GetXaxis()->SetTitle("Pt (GeV/c)");
-      m_errPt_Pt2VsPt->GetYaxis()->SetTitle("#sigma(Pt)/Pt^{2} (GeV/c)^{-1}");
-
-      m_errPt_Pt2VsEta = new TH2F("errPt_Pt2VsEta", "Error of Pt / Pt^2 Vs Eta", 50, -3., 3., 50, 0., 0.015);
-      RegisterHisto(al_mon, m_errPt_Pt2VsEta);
-      m_errPt_Pt2VsEta->GetXaxis()->SetTitle("#eta");
-      m_errPt_Pt2VsEta->GetYaxis()->SetTitle("#sigma(Pt)/Pt^{2} (GeV/c)^{-1}");
-
-      m_errPt_Pt2VsPhi0 = new TH2F("errPt_Pt2VsPhi0", "Error of Pt / Pt^2 Vs #phi0", 100, 0, 2 * M_PI, 50, 0., 0.015);
-      RegisterHisto(al_mon, m_errPt_Pt2VsPhi0);
-      m_errPt_Pt2VsPhi0->GetXaxis()->SetTitle("#eta");
-      m_errPt_Pt2VsPhi0->GetYaxis()->SetTitle("#sigma(Pt)/Pt^{2} (GeV/c)^{-1}");
-
-      m_D0VsPhi0 = new TH2F("D0VsPhi0", "d0 Vs #phi0 ", 100, 0, 2 * M_PI, 2 * m_d0BsNbins, -m_d0Range, m_d0Range);
-      RegisterHisto(al_mon, m_D0VsPhi0);
-      m_D0VsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_D0VsPhi0->GetYaxis()->SetTitle("d0 (mm)");
-
-      m_Z0VsEta = new TH2F("Z0VsEta", "z0 Vs #eta ", 50, -3., 3., 100, -m_z0Range, m_z0Range);
-      RegisterHisto(al_mon, m_Z0VsEta);
-      m_Z0VsEta->GetXaxis()->SetTitle("#eta");
-      m_Z0VsEta->GetYaxis()->SetTitle("z0 (mm)");
-
-      m_QoverPtVsPhi0 = new TH2F("QoverPtVsPhi0", "q/Pt Vs #phi0 ", 100, 0, 2 * M_PI, 100, -0.5, 0.5);
-      RegisterHisto(al_mon, m_QoverPtVsPhi0);
-      m_QoverPtVsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_QoverPtVsPhi0->GetYaxis()->SetTitle("q/Pt (GeV^{-1})");
-
-      m_QPtVsPhi0 = new TH2F("QPtVsPhi0", "qPt Vs #phi0 ", 100, 0, 2 * M_PI, 100, -40., 40.);
-      RegisterHisto(al_mon, m_QPtVsPhi0);
-      m_QPtVsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-      m_QPtVsPhi0->GetYaxis()->SetTitle("qPt (GeV)");
-
-      m_QoverPtVsEta = new TH2F("QoverPtVsEta", "q/Pt Vs #eta ", 50, -3., 3., 100, -0.5, 0.5);
-      RegisterHisto(al_mon, m_QoverPtVsEta);
-      m_QoverPtVsEta->GetXaxis()->SetTitle("#eta");
-      m_QoverPtVsEta->GetYaxis()->SetTitle("q/Pt (GeV^{-1})");
-
-      m_QPtVsEta = new TH2F("QPtVsEta", "qPt Vs #eta ", 50, -3., 3., 100, -40., 40.);
-      m_QPtVsEta->GetXaxis()->SetTitle("#eta");
-      RegisterHisto(al_mon, m_QPtVsEta);
-      m_QPtVsEta->GetYaxis()->SetTitle("qPt (GeV)");
-
-      //Plots to check the BeamSpot
-      // versus Phi0
-      m_D0bsVsPhi0 = new TH2F("D0bsVsPhi0", "d0_{bs} Vs #phi0 ", 50, 0, 2 * M_PI, 400, -m_d0BsRange, m_d0BsRange);
-      m_D0bsVsPhi0->GetXaxis()->SetTitle("#phi0");
-      RegisterHisto(al_mon, m_D0bsVsPhi0);
-      m_D0bsVsPhi0->GetYaxis()->SetTitle("d0_{bs} (mm)");
-
-      m_D0bsVsPhi0ECC = new TH2F("D0bsVsPhi0_ECC", "d0_{bs} Vs #phi0 (ECC) ", 50, 0, 2 * M_PI, 400, -m_d0BsRange,
-                                 m_d0BsRange);
-      m_D0bsVsPhi0ECC->GetXaxis()->SetTitle("#phi0");
-      RegisterHisto(al_mon, m_D0bsVsPhi0ECC);
-      m_D0bsVsPhi0ECC->GetYaxis()->SetTitle("d0_{bs} (mm)");
-
-      m_D0bsVsPhi0ECA = new TH2F("D0bsVsPhi0_ECA", "d0_{bs} Vs #phi0 (ECA)", 50, 0, 2 * M_PI, 400, -m_d0BsRange,
-                                 m_d0BsRange);
-      m_D0bsVsPhi0ECA->GetXaxis()->SetTitle("#phi0");
-      RegisterHisto(al_mon, m_D0bsVsPhi0ECA);
-      m_D0bsVsPhi0ECA->GetYaxis()->SetTitle("d0_{bs} (mm)");
-
-      m_D0bsVsPhi0Barrel = new TH2F("D0bsVsPhi0_Barrel", "d0_{bs} Vs #phi0 (BA)", 50, 0, 2 * M_PI, 2 * m_d0BsNbins,
-                                    -m_d0BsRange, m_d0BsRange);
-      m_D0bsVsPhi0Barrel->GetXaxis()->SetTitle("#phi0");
-      RegisterHisto(al_mon, m_D0bsVsPhi0Barrel);
-      m_D0bsVsPhi0Barrel->GetYaxis()->SetTitle("d0_{bs} (mm)");
-
-      // versus Eta
-      m_D0bsVsEta = new TH2F("D0bsVsEta", "d0_{bs} Vs #eta", 50, -3., 3., 2 * m_d0BsNbins, -m_d0BsRange, m_d0BsRange);
-      m_D0bsVsEta->GetXaxis()->SetTitle("#eta");
-      RegisterHisto(al_mon, m_D0bsVsEta);
-      m_D0bsVsEta->GetYaxis()->SetTitle("d0_{bs} (mm)");
-
-      //versus Pt
-      m_D0bsVsPt = new TH2F("D0bsVsPt", "d0_{bs} Vs qPt ", 50, -m_pTRange, m_pTRange, 2 * m_d0BsNbins, -m_d0BsRange,
-                            m_d0BsRange);
-      m_D0bsVsPt->GetXaxis()->SetTitle("qPt (GeV)");
-      RegisterHisto(al_mon, m_D0bsVsPt);
-      m_D0bsVsPt->GetYaxis()->SetTitle("d0_{bs} (mm)");
-
-      m_D0bsVsPtECC = new TH2F("D0bsVsPt_ECC", "d0_{bs} Vs qPt (ECC)", 50, -m_pTRange, m_pTRange, 2 * m_d0BsNbins,
-                               -m_d0BsRange, m_d0BsRange);
-      m_D0bsVsPtECC->GetXaxis()->SetTitle("qPt (GeV)");
-      RegisterHisto(al_mon, m_D0bsVsPtECC);
-      m_D0bsVsPtECC->GetYaxis()->SetTitle("d0_{bs} (mm)");
-
-      m_D0bsVsPtECA = new TH2F("D0bsVsPt_ECA", "d0_{bs} Vs qPt (ECA)", 50, -m_pTRange, m_pTRange, 2 * m_d0BsNbins,
-                               -m_d0BsRange, m_d0BsRange);
-      m_D0bsVsPtECA->GetXaxis()->SetTitle("qPt (GeV)");
-      RegisterHisto(al_mon, m_D0bsVsPtECA);
-      m_D0bsVsPtECA->GetYaxis()->SetTitle("d0_{bs} (mm)");
-
-      m_D0bsVsPtBarrel = new TH2F("D0bsVsPt_Barrel", "d0_{bs} Vs qPt (BA)", 50, -m_pTRange, m_pTRange, 2 * m_d0BsNbins,
-                                  -m_d0BsRange, m_d0BsRange);
-      m_D0bsVsPtBarrel->GetXaxis()->SetTitle("qPt (GeV)");
-      RegisterHisto(al_mon, m_D0bsVsPtBarrel);
-      m_D0bsVsPtBarrel->GetYaxis()->SetTitle("d0_{bs} mm )");
-
-      //BeamSpot Position histos
-      m_YBs_vs_XBs = new TH2F("YBs_vs_XBs", "BeamSpot Position: y vs x", 100, -0.9, -0.1, 100, -0.9, -0.1);
-      RegisterHisto(al_mon, m_YBs_vs_XBs);
-      m_YBs_vs_XBs->GetXaxis()->SetTitle("x coordinate (mm)");
-      m_YBs_vs_XBs->GetYaxis()->SetTitle("y coordinate (mm)");
-
-      m_YBs_vs_ZBs = new TH2F("YBs_vs_ZBs", "BeamSpot Position: y vs z", 100, -25., -5., 100, -0.9, -0.1);
-      RegisterHisto(al_mon, m_YBs_vs_ZBs);
-      m_YBs_vs_ZBs->GetXaxis()->SetTitle("z coordinate (mm)");
-      m_YBs_vs_ZBs->GetYaxis()->SetTitle("y coordinate (mm)");
-
-      m_XBs_vs_ZBs = new TH2F("XBs_vs_ZBs", "BeamSpot Position: x vs z", 100, -25., -5., 100, -0.9, -0.1);
-      RegisterHisto(al_mon, m_XBs_vs_ZBs);
-      m_XBs_vs_ZBs->GetXaxis()->SetTitle("z coordinate (mm)");
-      m_XBs_vs_ZBs->GetYaxis()->SetTitle("x coordinate (mm)");
-
-
-      m_XBs = new TH1F("XBs", "BeamSpot Position: x", 100, -1, 0.);
-      RegisterHisto(al_mon, m_XBs);
-      m_XBs->GetXaxis()->SetTitle("x (mm)");
-      m_XBs->GetYaxis()->SetTitle("#events");
-
-      m_YBs = new TH1F("YBs", "BeamSpot Position: y", 100, -1, 0.);
-      RegisterHisto(al_mon, m_YBs);
-      m_YBs->GetXaxis()->SetTitle("y (mm)");
-      m_YBs->GetYaxis()->SetTitle("#events");
-
-      m_ZBs = new TH1F("ZBs", "BeamSpot Position: z", 100, -50, 50);
-      RegisterHisto(al_mon, m_ZBs);
-      m_ZBs->GetXaxis()->SetTitle("z (mm)");
-      m_ZBs->GetYaxis()->SetTitle("#events");
-
-      m_TiltX_Bs = new TH1F("TiltX_Bs", "Beam spot tile angle: x-z plane", 100, -1e3, 1e3);
-      RegisterHisto(al_mon, m_TiltX_Bs);
-      m_TiltX_Bs->GetXaxis()->SetTitle("Tilt angle (#murad)");
-
-      m_TiltY_Bs = new TH1F("TiltY_Bs", "Beam spot tile angle: y-z plane", 100, -1e3, 1e3);
-      RegisterHisto(al_mon, m_TiltY_Bs);
-      m_TiltY_Bs->GetXaxis()->SetTitle("Tilt angle (#murad)");
-
-      //versus lumiblock
-      m_XBs_vs_LumiBlock = new TProfile("XBs_vs_LumiBlock", "Profile of BeamSpot x Coordinate vs LumiBlock", 1024, -0.5,
-                                        1023.5);
-      RegisterHisto(al_mon, m_XBs_vs_LumiBlock);
-      m_XBs_vs_LumiBlock->GetXaxis()->SetTitle("LumiBlock");
-      m_XBs_vs_LumiBlock->GetYaxis()->SetTitle("x coordinate (mm)");
-
-      m_YBs_vs_LumiBlock = new TProfile("YBs_vs_LumiBlock", "Profile of BeamSpot y Coordinate vs LumiBlock", 1024, -0.5,
-                                        1023.5);
-      RegisterHisto(al_mon, m_YBs_vs_LumiBlock);
-      m_YBs_vs_LumiBlock->GetXaxis()->SetTitle("LumiBlock");
-      m_YBs_vs_LumiBlock->GetYaxis()->SetTitle("y coordinate (mm)");
-
-      m_ZBs_vs_LumiBlock = new TProfile("ZBs_vs_LumiBlock", "Profile of BeamSpot z Coordinate vs LumiBlock", 1024, -0.5,
-                                        1023.5);
-      RegisterHisto(al_mon, m_ZBs_vs_LumiBlock);
-      m_ZBs_vs_LumiBlock->GetXaxis()->SetTitle("LumiBlock");
-      m_ZBs_vs_LumiBlock->GetYaxis()->SetTitle("z coordinate (mm)");
-
-      m_BeamSpotTiltX_vs_LumiBlock = new TProfile("BeamSpotTiltX_vs_LumiBlock",
-                                                  "Profile of BeamSpot TiltX vs LumiBlock", 1024, -0.5, 1023.5, -2, 2);
-      RegisterHisto(al_mon, m_BeamSpotTiltX_vs_LumiBlock);
-      m_BeamSpotTiltX_vs_LumiBlock->GetXaxis()->SetTitle("LumiBlock");
-      m_BeamSpotTiltX_vs_LumiBlock->GetYaxis()->SetTitle("TiltX (mrad)");
-      m_BeamSpotTiltX_vs_LumiBlock->GetYaxis()->SetRangeUser(-1, 1);
-
-      m_BeamSpotTiltY_vs_LumiBlock = new TProfile("BeamSpotTiltY_vs_LumiBlock",
-                                                  "Profile of BeamSpot TiltY vs LumiBlock", 1024, -0.5, 1023.5, -2, 2);
-      RegisterHisto(al_mon, m_BeamSpotTiltY_vs_LumiBlock);
-      m_BeamSpotTiltY_vs_LumiBlock->GetXaxis()->SetTitle("LumiBlock");
-      m_BeamSpotTiltY_vs_LumiBlock->GetYaxis()->SetTitle("TiltY (mrad)");
-      m_BeamSpotTiltY_vs_LumiBlock->GetYaxis()->SetRangeUser(-1, 1);
-    }
-
-
-    //These plots are broken. Have to be passed to the PVbiases tool
-    m_trk_d0_wrtPV = new TH1F("d0_pvcorr_est", "d0 (corrected for primVtx v2); [mm]", 400, -0.2, 0.2);
-    RegisterHisto(al_mon, m_trk_d0_wrtPV);
-    m_trk_z0_wrtPV = new TH1F("z0_pvcorr_est", "z0 (corrected for primVtx v2); [mm]", 100, -1, 1);
-    RegisterHisto(al_mon, m_trk_z0_wrtPV);
-
-
-
-    m_phi_barrel_pos_2_5GeV = new TH1F("phi_barrel_pos_2_5GeV", "phi_barrel_pos_2_5GeV", 100, 0, 2 * M_PI);
-    m_phi_barrel_pos_2_5GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel_pos_2_5GeV);
-    m_phi_barrel_pos_2_5GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_barrel_pos_2_5GeV->GetYaxis()->SetTitle("Number of Tracks in barrel, 2-5 GeV");
-    m_phi_barrel_pos_5_10GeV = new TH1F("phi_barrel_pos_5_10GeV", "phi_barrel_pos_5_10GeV", 100, 0, 2 * M_PI);
-    m_phi_barrel_pos_5_10GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel_pos_5_10GeV);
-    m_phi_barrel_pos_5_10GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_barrel_pos_5_10GeV->GetYaxis()->SetTitle("Number of Tracks in barrel, 5-10 GeV");
-    m_phi_barrel_pos_10_20GeV = new TH1F("phi_barrel_pos_10_20GeV", "phi_barrel_pos_10_20GeV", 100, 0, 2 * M_PI);
-    m_phi_barrel_pos_10_20GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel_pos_10_20GeV);
-    m_phi_barrel_pos_10_20GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_barrel_pos_10_20GeV->GetYaxis()->SetTitle("Number of Tracks in barrel, 10-20 GeV");
-    m_phi_barrel_pos_20plusGeV = new TH1F("phi_barrel_pos_20plusGeV", "phi_barrel_pos_20plusGeV", 100, 0, 2 * M_PI);
-    m_phi_barrel_pos_20plusGeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel_pos_20plusGeV);
-    m_phi_barrel_pos_20plusGeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_barrel_pos_20plusGeV->GetYaxis()->SetTitle("Number of Tracks in barrel, >20 GeV");
-
-    m_phi_barrel_neg_2_5GeV = new TH1F("phi_barrel_neg_2_5GeV", "phi_barrel_neg_2_5GeV", 100, 0, 2 * M_PI);
-    m_phi_barrel_neg_2_5GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel_neg_2_5GeV);
-    m_phi_barrel_neg_2_5GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_barrel_neg_2_5GeV->GetYaxis()->SetTitle("Number of Tracks in barrel, 2-5 GeV");
-    m_phi_barrel_neg_5_10GeV = new TH1F("phi_barrel_neg_5_10GeV", "phi_barrel_neg_5_10GeV", 100, 0, 2 * M_PI);
-    m_phi_barrel_neg_5_10GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel_neg_5_10GeV);
-    m_phi_barrel_neg_5_10GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_barrel_neg_5_10GeV->GetYaxis()->SetTitle("Number of Tracks in barrel, 5-10 GeV");
-    m_phi_barrel_neg_10_20GeV = new TH1F("phi_barrel_neg_10_20GeV", "phi_barrel_neg_10_20GeV", 100, 0, 2 * M_PI);
-    m_phi_barrel_neg_10_20GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel_neg_10_20GeV);
-    m_phi_barrel_neg_10_20GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_barrel_neg_10_20GeV->GetYaxis()->SetTitle("Number of Tracks in barrel, 10-20 GeV");
-    m_phi_barrel_neg_20plusGeV = new TH1F("phi_barrel_neg_20plusGeV", "phi_barrel_neg_20plusGeV", 100, 0, 2 * M_PI);
-    m_phi_barrel_neg_20plusGeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel_neg_20plusGeV);
-    m_phi_barrel_neg_20plusGeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_barrel_neg_20plusGeV->GetYaxis()->SetTitle("Number of Tracks in barrel, >20 GeV");
-
-    m_phi_eca_pos_2_5GeV = new TH1F("phi_eca_pos_2_5GeV", "phi_eca_pos_2_5GeV", 100, 0, 2 * M_PI);
-    m_phi_eca_pos_2_5GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca_pos_2_5GeV);
-    m_phi_eca_pos_2_5GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_eca_pos_2_5GeV->GetYaxis()->SetTitle("Number of Tracks in eca, 2-5 GeV");
-    m_phi_eca_pos_5_10GeV = new TH1F("phi_eca_pos_5_10GeV", "phi_eca_pos_5_10GeV", 100, 0, 2 * M_PI);
-    m_phi_eca_pos_5_10GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca_pos_5_10GeV);
-    m_phi_eca_pos_5_10GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_eca_pos_5_10GeV->GetYaxis()->SetTitle("Number of Tracks in eca, 5-10 GeV");
-    m_phi_eca_pos_10_20GeV = new TH1F("phi_eca_pos_10_20GeV", "phi_eca_pos_10_20GeV", 100, 0, 2 * M_PI);
-    m_phi_eca_pos_10_20GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca_pos_10_20GeV);
-    m_phi_eca_pos_10_20GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_eca_pos_10_20GeV->GetYaxis()->SetTitle("Number of Tracks in eca, 10-20 GeV");
-    m_phi_eca_pos_20plusGeV = new TH1F("phi_eca_pos_20plusGeV", "phi_eca_pos_20plusGeV", 100, 0, 2 * M_PI);
-    m_phi_eca_pos_20plusGeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca_pos_20plusGeV);
-    m_phi_eca_pos_20plusGeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_eca_pos_20plusGeV->GetYaxis()->SetTitle("Number of Tracks in eca, >20 GeV");
-
-    m_phi_eca_neg_2_5GeV = new TH1F("phi_eca_neg_2_5GeV", "phi_eca_neg_2_5GeV", 100, 0, 2 * M_PI);
-    m_phi_eca_neg_2_5GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca_neg_2_5GeV);
-    m_phi_eca_neg_2_5GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_eca_neg_2_5GeV->GetYaxis()->SetTitle("Number of Tracks in eca, 2-5 GeV");
-    m_phi_eca_neg_5_10GeV = new TH1F("phi_eca_neg_5_10GeV", "phi_eca_neg_5_10GeV", 100, 0, 2 * M_PI);
-    m_phi_eca_neg_5_10GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca_neg_5_10GeV);
-    m_phi_eca_neg_5_10GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_eca_neg_5_10GeV->GetYaxis()->SetTitle("Number of Tracks in eca, 5-10 GeV");
-    m_phi_eca_neg_10_20GeV = new TH1F("phi_eca_neg_10_20GeV", "phi_eca_neg_10_20GeV", 100, 0, 2 * M_PI);
-    m_phi_eca_neg_10_20GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca_neg_10_20GeV);
-    m_phi_eca_neg_10_20GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_eca_neg_10_20GeV->GetYaxis()->SetTitle("Number of Tracks in eca, 10-20 GeV");
-    m_phi_eca_neg_20plusGeV = new TH1F("phi_eca_neg_20plusGeV", "phi_eca_neg_20plusGeV", 100, 0, 2 * M_PI);
-    m_phi_eca_neg_20plusGeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca_neg_20plusGeV);
-    m_phi_eca_neg_20plusGeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_eca_neg_20plusGeV->GetYaxis()->SetTitle("Number of Tracks in eca, >20 GeV");
-
-    m_phi_ecc_pos_2_5GeV = new TH1F("phi_ecc_pos_2_5GeV", "phi_ecc_pos_2_5GeV", 100, 0, 2 * M_PI);
-    m_phi_ecc_pos_2_5GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc_pos_2_5GeV);
-    m_phi_ecc_pos_2_5GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_ecc_pos_2_5GeV->GetYaxis()->SetTitle("Number of Tracks in ecc, 2-5 GeV");
-    m_phi_ecc_pos_5_10GeV = new TH1F("phi_ecc_pos_5_10GeV", "phi_ecc_pos_5_10GeV", 100, 0, 2 * M_PI);
-    m_phi_ecc_pos_5_10GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc_pos_5_10GeV);
-    m_phi_ecc_pos_5_10GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_ecc_pos_5_10GeV->GetYaxis()->SetTitle("Number of Tracks in ecc, 5-10 GeV");
-    m_phi_ecc_pos_10_20GeV = new TH1F("phi_ecc_pos_10_20GeV", "phi_ecc_pos_10_20GeV", 100, 0, 2 * M_PI);
-    m_phi_ecc_pos_10_20GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc_pos_10_20GeV);
-    m_phi_ecc_pos_10_20GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_ecc_pos_10_20GeV->GetYaxis()->SetTitle("Number of Tracks in ecc, 10-20 GeV");
-    m_phi_ecc_pos_20plusGeV = new TH1F("phi_ecc_pos_20plusGeV", "phi_ecc_pos_20plusGeV", 100, 0, 2 * M_PI);
-    m_phi_ecc_pos_20plusGeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc_pos_20plusGeV);
-    m_phi_ecc_pos_20plusGeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_ecc_pos_20plusGeV->GetYaxis()->SetTitle("Number of Tracks in ecc, >20 GeV");
-
-    m_phi_ecc_neg_2_5GeV = new TH1F("phi_ecc_neg_2_5GeV", "phi_ecc_neg_2_5GeV", 100, 0, 2 * M_PI);
-    m_phi_ecc_neg_2_5GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc_neg_2_5GeV);
-    m_phi_ecc_neg_2_5GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_ecc_neg_2_5GeV->GetYaxis()->SetTitle("Number of Tracks in ecc, 2-5 GeV");
-    m_phi_ecc_neg_5_10GeV = new TH1F("phi_ecc_neg_5_10GeV", "phi_ecc_neg_5_10GeV", 100, 0, 2 * M_PI);
-    m_phi_ecc_neg_5_10GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc_neg_5_10GeV);
-    m_phi_ecc_neg_5_10GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_ecc_neg_5_10GeV->GetYaxis()->SetTitle("Number of Tracks in ecc, 5-10 GeV");
-    m_phi_ecc_neg_10_20GeV = new TH1F("phi_ecc_neg_10_20GeV", "phi_ecc_neg_10_20GeV", 100, 0, 2 * M_PI);
-    m_phi_ecc_neg_10_20GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc_neg_10_20GeV);
-    m_phi_ecc_neg_10_20GeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_ecc_neg_10_20GeV->GetYaxis()->SetTitle("Number of Tracks in ecc, 10-20 GeV");
-    m_phi_ecc_neg_20plusGeV = new TH1F("phi_ecc_neg_20plusGeV", "phi_ecc_neg_20plusGeV", 100, 0, 2 * M_PI);
-    m_phi_ecc_neg_20plusGeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc_neg_20plusGeV);
-    m_phi_ecc_neg_20plusGeV->GetXaxis()->SetTitle("Track #phi");
-    m_phi_ecc_neg_20plusGeV->GetYaxis()->SetTitle("Number of Tracks in ecc, >20 GeV");
-
-    m_eta_phi_pos_2_5GeV = new TH2F("eta_phi_pos_2_5GeV", "eta_phi_pos_2_5GeV", 20, -m_etaRange, m_etaRange, 20, 0,
-                                    2 * M_PI);
-    m_eta_phi_pos_2_5GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_eta_phi_pos_2_5GeV);
-    m_eta_phi_pos_2_5GeV->GetXaxis()->SetTitle("Track #eta");
-    m_eta_phi_pos_2_5GeV->GetYaxis()->SetTitle("Track #phi");
-    m_eta_phi_pos_5_10GeV = new TH2F("eta_phi_pos_5_10GeV", "eta_phi_pos_5_10GeV", 20, -m_etaRange, m_etaRange, 20, 0,
-                                     2 * M_PI);
-    m_eta_phi_pos_5_10GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_eta_phi_pos_5_10GeV);
-    m_eta_phi_pos_5_10GeV->GetXaxis()->SetTitle("Track #eta");
-    m_eta_phi_pos_5_10GeV->GetYaxis()->SetTitle("Track #phi");
-    m_eta_phi_pos_10_20GeV = new TH2F("eta_phi_pos_10_20GeV", "eta_phi_pos_10_20GeV", 20, -m_etaRange, m_etaRange, 20,
-                                      0, 2 * M_PI);
-    m_eta_phi_pos_10_20GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_eta_phi_pos_10_20GeV);
-    m_eta_phi_pos_10_20GeV->GetXaxis()->SetTitle("Track #eta");
-    m_eta_phi_pos_10_20GeV->GetYaxis()->SetTitle("Track #phi");
-    m_eta_phi_pos_20plusGeV = new TH2F("eta_phi_pos_20plusGeV", "eta_phi_pos_20plusGeV", 20, -m_etaRange, m_etaRange,
-                                       20, 0, 2 * M_PI);
-    m_eta_phi_pos_20plusGeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_eta_phi_pos_20plusGeV);
-    m_eta_phi_pos_20plusGeV->GetXaxis()->SetTitle("Track #eta");
-    m_eta_phi_pos_20plusGeV->GetYaxis()->SetTitle("Track #phi");
-
-    m_eta_phi_neg_2_5GeV = new TH2F("eta_phi_neg_2_5GeV", "eta_phi_neg_2_5GeV", 20, -m_etaRange, m_etaRange, 20, 0,
-                                    2 * M_PI);
-    m_eta_phi_neg_2_5GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_eta_phi_neg_2_5GeV);
-    m_eta_phi_neg_2_5GeV->GetXaxis()->SetTitle("Track #eta");
-    m_eta_phi_neg_2_5GeV->GetYaxis()->SetTitle("Track #phi");
-    m_eta_phi_neg_5_10GeV = new TH2F("eta_phi_neg_5_10GeV", "eta_phi_neg_5_10GeV", 20, -m_etaRange, m_etaRange, 20, 0,
-                                     2 * M_PI);
-    m_eta_phi_neg_5_10GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_eta_phi_neg_5_10GeV);
-    m_eta_phi_neg_5_10GeV->GetXaxis()->SetTitle("Track #eta");
-    m_eta_phi_neg_5_10GeV->GetYaxis()->SetTitle("Track #phi");
-    m_eta_phi_neg_10_20GeV = new TH2F("eta_phi_neg_10_20GeV", "eta_phi_neg_10_20GeV", 20, -m_etaRange, m_etaRange, 20,
-                                      0, 2 * M_PI);
-    m_eta_phi_neg_10_20GeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_eta_phi_neg_10_20GeV);
-    m_eta_phi_neg_10_20GeV->GetXaxis()->SetTitle("Track #eta");
-    m_eta_phi_neg_10_20GeV->GetYaxis()->SetTitle("Track #phi");
-    m_eta_phi_neg_20plusGeV = new TH2F("eta_phi_neg_20plusGeV", "eta_phi_neg_20plusGeV", 20, -m_etaRange, m_etaRange,
-                                       20, 0, 2 * M_PI);
-    m_eta_phi_neg_20plusGeV->SetMinimum(0);
-    RegisterHisto(al_mon, m_eta_phi_neg_20plusGeV);
-    m_eta_phi_neg_20plusGeV->GetXaxis()->SetTitle("Track #eta");
-    m_eta_phi_neg_20plusGeV->GetYaxis()->SetTitle("Track #phi");
-
-    m_chi2oDoF_barrel = new TH1F("chi2oDoF_barrel", "chi2oDoF (Barrel)", 100, 0, 10);
-    RegisterHisto(al_mon, m_chi2oDoF_barrel);
-    m_chi2oDoF_barrel->GetXaxis()->SetTitle("Track in Barrel #chi^{2} / NDoF");
-    m_chi2oDoF_barrel->GetYaxis()->SetTitle("Number of Tracks");
-    m_chi2oDoF_eca = new TH1F("chi2oDoF_eca", "chi2oDoF (Eca)", 100, 0, 10);
-    RegisterHisto(al_mon, m_chi2oDoF_eca);
-    m_chi2oDoF_eca->GetXaxis()->SetTitle("Track in ECA #chi^{2} / NDoF");
-    m_chi2oDoF_eca->GetYaxis()->SetTitle("Number of Tracks");
-    m_chi2oDoF_ecc = new TH1F("chi2oDoF_ecc", "chi2oDoF (Ecc)", 100, 0, 10);
-    RegisterHisto(al_mon, m_chi2oDoF_ecc);
-    m_chi2oDoF_ecc->GetXaxis()->SetTitle("Track in ECC #chi^{2} / NDoF");
-    m_chi2oDoF_ecc->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_phi_barrel = new TH1F("phi_barrel", "phi (Barrel)", 100, 0, 2 * M_PI);
-    m_phi_barrel->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_barrel);
-    m_phi_barrel->GetXaxis()->SetTitle("Track in Barrel #phi");
-    m_phi_barrel->GetYaxis()->SetTitle("Number of Tracks");
-    m_phi_eca = new TH1F("phi_eca", "phi (Eca)", 100, 0, 2 * M_PI);
-    m_phi_eca->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_eca);
-    m_phi_eca->GetXaxis()->SetTitle("Track in ECA #phi");
-    m_phi_eca->GetYaxis()->SetTitle("Number of Tracks");
-    m_phi_ecc = new TH1F("phi_ecc", "phi (Ecc)", 100, 0, 2 * M_PI);
-    m_phi_ecc->SetMinimum(0);
-    RegisterHisto(al_mon, m_phi_ecc);
-    m_phi_ecc->GetXaxis()->SetTitle("Track in ECC #phi");
-    m_phi_ecc->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_pT = new TH1F("pT", "pT", 200, -m_pTRange, m_pTRange);
-    RegisterHisto(al_mon_ls, m_pT);
-    m_pT->GetXaxis()->SetTitle("Signed Track pT [GeV]");
-    m_pT->GetYaxis()->SetTitle("Number of Tracks");
-    m_pTRes = new TH1F("pTRes", "pTRes", 100, 0, 1.0);
-    RegisterHisto(al_mon, m_pTRes);
-    m_pTResOverP = new TH1F("pTResOverP", "Momentum resolution / Momentum", 100, 0, 0.05);
-    RegisterHisto(al_mon, m_pTResOverP);
-
-    m_P = new TH1F("P", "Track Momentum P", 200, -m_pTRange, m_pTRange);
-    RegisterHisto(al_mon, m_P);
-    m_P->GetXaxis()->SetTitle("Signed Track P [GeV]");
-    m_P->GetYaxis()->SetTitle("Number of Tracks");
-
-    m_Zmumu = new TH1F("Zmumu", "Zmumu Inv. Mass", 60, 60, 120);
-    RegisterHisto(al_mon, m_Zmumu);
-    m_Zmumu_barrel = new TH1F("Zmumu_barrel", "Zmumu Both Legs Barrel", 60, 60, 120);
-    RegisterHisto(al_mon, m_Zmumu_barrel);
-    m_Zmumu_eca = new TH1F("Zmumu_eca", "Zmumu Both Legs ECA", 60, 60, 120);
-    RegisterHisto(al_mon, m_Zmumu_eca);
-    m_Zmumu_ecc = new TH1F("Zmumu_ecc", "Zmumu Both Legs ECC", 60, 60, 120);
-    RegisterHisto(al_mon, m_Zmumu_ecc);
-    m_Zmumu_barrel_eca = new TH1F("Zmumu_barrel_eca", "Zmumu One Barrel One ECA", 60, 60, 120);
-    RegisterHisto(al_mon, m_Zmumu_barrel_eca);
-    m_Zmumu_barrel_ecc = new TH1F("Zmumu_barrel_ecc", "Zmumu One Barrel One ECC", 60, 60, 120);
-    RegisterHisto(al_mon, m_Zmumu_barrel_ecc);
-
-    m_ZpT_n = new TH1F("ZpT_n", "pT of negative tracks from Z", 100, 0, 100);
-    RegisterHisto(al_mon, m_ZpT_n);
-    m_ZpT_p = new TH1F("ZpT_p", "pT of positive tracks from Z", 100, 0, 100);
-    RegisterHisto(al_mon, m_ZpT_p);
-    m_ZpT_diff = new TH1F("ZpT_diff", "pT difference for negative-positive tracks from Z", 100, 0, 100);
-    RegisterHisto(al_mon, m_ZpT_diff);
-
-    m_pT_n = new TH1F("pT_n", "pT of negative tracks", 50, 0, 100);
-    RegisterHisto(al_mon, m_pT_n);
-    m_pT_p = new TH1F("pT_p", "pT of positive tracks", 50, 0, 100);
-    RegisterHisto(al_mon, m_pT_p);
-    m_pT_diff = new TH1F("pT_diff", "pT difference for negative-positive tracks", 50, 0, 100);
-    RegisterHisto(al_mon, m_pT_diff);
-
-    m_trk_pT_asym = new TH1F("trk_pT_asym", "Track Charge Asymmetry versus pT", 50, 0, 100);
-    RegisterHisto(al_mon, m_trk_pT_asym);
-    m_trk_pT_asym->GetXaxis()->SetTitle("#pt (GeV)");
-    m_trk_pT_asym->GetYaxis()->SetTitle("(pos-neg)/(pos+neg)");
-
-    m_hitMap_barrel = new TH2F("hitMap_barrel", "Hit Map for Barrel", 125, -1100, 1100, 125, -1100, 1100);
-    RegisterHisto(al_mon, m_hitMap_barrel);
-
-    m_hitMap_endcapA = new TH2F("hitMap_endcapA", "Hit Map for Endcap A", 100, 800, 2800, 100, -3.14, 3.14);
-    RegisterHisto(al_mon, m_hitMap_endcapA);
-
-    m_hitMap_endcapC = new TH2F("hitMap_endcapC", "Hit Map for Endcap C", 100, -2800, -800, 100, -3.14, 3.14);
-    RegisterHisto(al_mon, m_hitMap_endcapC);
-
-    //charge asymmetry vs.eta
-    m_eta_neg = new TH1F("eta_neg", "eta for negative tracks; #eta(-)", 25, -m_etaRange, m_etaRange);
-    RegisterHisto(al_mon, m_eta_neg);
-    m_eta_neg->GetXaxis()->SetTitle("#eta");
-    m_eta_neg->GetYaxis()->SetTitle("# tracks");
-
-    m_eta_pos = new TH1F("eta_pos", "eta for positive tracks; #eta(+)", 25, -m_etaRange, m_etaRange);
-    RegisterHisto(al_mon, m_eta_pos);
-    m_eta_pos->GetXaxis()->SetTitle("#eta");
-    m_eta_pos->GetYaxis()->SetTitle("# tracks");
-
-    m_eta_asym = new TH1F("eta_asym", "Track Charge Asymmetry versus eta", 25, -m_etaRange, m_etaRange);
-    RegisterHisto(al_mon, m_eta_asym);
-    m_eta_asym->GetXaxis()->SetTitle("#eta");
-    m_eta_asym->GetYaxis()->SetTitle("(pos-neg)/(pos+neg)");
-
-
-
-    // msg(MSG::INFO) << "lumiblock histos done " <<endmsg;
-
-
-
-
-
-    // lumiblock histos
-    m_LumiBlock = new TH1F("LumiBlock", "Lumi block", 1024, -0.5, 1023.5);
-    RegisterHisto(al_mon, m_LumiBlock);
-    m_LumiBlock->GetXaxis()->SetTitle("Lumi block ID");
-    m_LumiBlock->GetYaxis()->SetTitle("# events");
-
-    m_Tracks_per_LumiBlock = new TH1F("TracksPerLumiBlock", "Tracks per Lumi block", 1024, -0.5, 1023.5);
-    RegisterHisto(al_mon, m_Tracks_per_LumiBlock);
-    m_Tracks_per_LumiBlock->GetXaxis()->SetTitle("Lumi block ID");
-    m_Tracks_per_LumiBlock->GetYaxis()->SetTitle("# tracks");
-
-    m_NPIX_per_LumiBlock = new TH1F("NPixPerLumiBlock", "N pixel hits per Lumi block", 1024, -0.5, 1023.5);
-    RegisterHisto(al_mon, m_NPIX_per_LumiBlock);
-    m_NPIX_per_LumiBlock->GetXaxis()->SetTitle("Lumi block ID");
-    m_NPIX_per_LumiBlock->GetYaxis()->SetTitle("# pixel hits");
-
-    m_NSCT_per_LumiBlock = new TH1F("NSCTPerLumiBlock", "N SCT hits per Lumi block", 1024, -0.5, 1023.5);
-    RegisterHisto(al_mon, m_NSCT_per_LumiBlock);
-    m_NSCT_per_LumiBlock->GetXaxis()->SetTitle("Lumi block ID");
-    m_NSCT_per_LumiBlock->GetYaxis()->SetTitle("# SCT hits");
-
-    m_NTRT_per_LumiBlock = new TH1F("NTRTPerLumiBlock", "N TRT hits per Lumi block", 1024, -0.5, 1023.5);
-    RegisterHisto(al_mon, m_NTRT_per_LumiBlock);
-    m_NTRT_per_LumiBlock->GetXaxis()->SetTitle("Lumi block ID");
-    m_NTRT_per_LumiBlock->GetYaxis()->SetTitle("# TRT hits");
-
-    m_histosBooked++;
-  }
-  return StatusCode::SUCCESS;
-}
-
-void IDAlignMonGenericTracks::RegisterHisto(MonGroup& mon, TH1* histo) {
-  //histo->Sumw2();
-  histo->SetOption("e");
-  StatusCode sc = mon.regHist(histo);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonGenericTracks::RegisterHisto(MonGroup& mon, TProfile* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonGenericTracks::RegisterHisto(MonGroup& mon, TH2* histo) {
-  //histo->Sumw2();
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH2 Histogram:" << endmsg;
-  }
-}
-
-StatusCode IDAlignMonGenericTracks::fillHistograms() {
-  m_events++;
-  ATH_MSG_DEBUG(
-    "IDAlignMonGenericTracks::fillHistograms ** START ** call for m_events " << m_events << " for track collection: " <<
-      m_tracksName.key());
-
-  //get tracks
-  SG::ReadHandle<TrackCollection> tracks {
-    m_tracksName
-  };
-  if (not tracks.isValid()) {
-    ATH_MSG_DEBUG("IDAlignMonGenericTracks::fillHistograms() --" << m_tracksName.key() << " could not be retrieved");
-    return StatusCode::RECOVERABLE;
-  }
-  const DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(tracks);
-  ATH_MSG_DEBUG("IDAlignMonGenericTracks::fillHistograms() -- event: " << m_events
-                                                                       << " with Track collection " << m_tracksName.key()
-                                                                       << " has size =" << tracks->size());
-  float xv = -999;
-  float yv = -999;
-  float zv = -999;
-
-  if (not m_VxPrimContainerName.key().empty()) {
-    SG::ReadHandle<xAOD::VertexContainer> vxContainer {
-      m_VxPrimContainerName
-    };
-    if (not vxContainer.isValid()) {
-      ATH_MSG_DEBUG("No Collection with name  " << m_VxPrimContainerName.key() << " found in StoreGate");
-      return StatusCode::SUCCESS;
-    } else {
-      m_vertices = vxContainer.get();
-
-      ATH_MSG_DEBUG(
-        "Collection with name  " << m_VxPrimContainerName.key() << " with size " << m_vertices->size() <<
-          " found  in StoreGate");
-
-      xAOD::VertexContainer::const_iterator vxItr = m_vertices->begin();
-      xAOD::VertexContainer::const_iterator vxItrE = m_vertices->end();
-      int ntrkMax = 0;
-      for (; vxItr != vxItrE; ++vxItr) {
-        const xAOD::Vertex* theVertex = (*vxItr);
-        if (!theVertex->vxTrackAtVertexAvailable()) continue;
-        const std::vector< Trk::VxTrackAtVertex >& theTrackAtVertex = theVertex->vxTrackAtVertex();
-        int numTracksPerVertex = theTrackAtVertex.size();
-        ATH_MSG_DEBUG("Size of TrackAtVertex: " << numTracksPerVertex);
-        if (numTracksPerVertex > ntrkMax) {
-          ntrkMax = numTracksPerVertex;
-          xv = theVertex->position()[0];
-          yv = theVertex->position()[1];
-          zv = theVertex->position()[2];
-        }
-      }
-    }
-    //std::cout << "xv, yv, zv: " << xv << ", " << yv << ", " << zv << std::endl;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "StoreGate does not contain VxPrimaryCandidate Container" << endmsg;
-
-
-  if (xv == -999 || yv == -999 || zv == -999) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No vertex found => setting it to 0" << endmsg;
-    xv = 0;
-    yv = 0;
-    zv = 0;
-  }
-
-
-  // Code is able to get a weight from an external file and appy it to all histograms
-  double hweight = 1.;
-  // NB the weight is a "per track" weight, so histograms such as BS info are never weighted
-
-  std::map<const xAOD::TrackParticle*, const xAOD::Vertex*> trackVertexMapTP;
-  if (m_doIP) fillVertexInformation(trackVertexMapTP);
-
-  // Get EventInfo
-  SG::ReadHandle<xAOD::EventInfo> eventInfo {
-    m_eventInfoKey
-  };
-  if (not eventInfo.isValid()) {
-    msg(MSG::ERROR) << "Cannot get event info." << endmsg;
-    delete trks;
-    return StatusCode::FAILURE;
-  }
-
-  float beamSpotX = 0.;
-  float beamSpotY = 0.;
-  float beamSpotZ = 0.;
-  float beamTiltX = 0.;
-  float beamTiltY = 0.;
-  ATH_MSG_DEBUG(" retrieveing beam spot information for event " << m_events);
-  if (m_hasBeamCondSvc) {
-    beamSpotX = eventInfo->beamPosX();
-    beamSpotY = eventInfo->beamPosY(); 
-    beamSpotZ = eventInfo->beamPosZ(); 
-    beamTiltX = eventInfo->beamTiltXZ();
-    beamTiltY = eventInfo->beamTiltYZ();
-    ATH_MSG_INFO(" -- Beamspot --  x0 = " << beamSpotX << ", y0 = " << beamSpotY
-                                   << ", z0 = " << beamSpotZ << ", tiltX = " << beamTiltX
-                                   << ", tiltY = " << beamTiltY);
-  }
-
-  //EventID* eventID = eventInfo->event_ID();
-  float LumiBlock = static_cast<float>(eventInfo->lumiBlock());
-
-  ATH_MSG_DEBUG(
-    " Run: " << eventInfo->runNumber() << "   Event: " << eventInfo->eventNumber() << "   LumiBlock: " << LumiBlock);
-
-  m_LumiBlock->Fill(LumiBlock, hweight);
-
-  if (m_extendedPlots) {
-    //Fill BeamSpot Position histos
-    m_YBs_vs_XBs->Fill(beamSpotX, beamSpotY, hweight);
-    m_YBs_vs_ZBs->Fill(beamSpotZ, beamSpotY, hweight);
-    m_XBs_vs_ZBs->Fill(beamSpotZ, beamSpotX, hweight);
-
-    m_XBs->Fill(beamSpotX, hweight);
-    m_YBs->Fill(beamSpotY, hweight);
-    m_ZBs->Fill(beamSpotZ, hweight);
-    m_TiltX_Bs->Fill(1e6 * beamTiltX, hweight);
-    m_TiltY_Bs->Fill(1e6 * beamTiltY, hweight);
-
-    //Fill BeamSpot Position versus lumiblock histos
-    m_XBs_vs_LumiBlock->Fill(LumiBlock, beamSpotX, hweight);
-    m_YBs_vs_LumiBlock->Fill(LumiBlock, beamSpotY, hweight);
-    m_ZBs_vs_LumiBlock->Fill(LumiBlock, beamSpotZ, hweight);
-    m_BeamSpotTiltX_vs_LumiBlock->Fill(LumiBlock, 1e3 * beamTiltX, hweight);
-    m_BeamSpotTiltY_vs_LumiBlock->Fill(LumiBlock, 1e3 * beamTiltY, hweight);
-  }
-
-
-  int nHits = 0;
-  int nTracks = 0;
-  int ngTracks = 0;
-
-  bool z_true = false;
-  float z_E[2] = {
-    0.
-  }, z_px[2] = {
-    0.
-  }, z_py[2] = {
-    0.
-  }, z_pz[2] = {
-    0.
-  }, z_pT[2] = {
-    0.
-  };
-  float z_eta[2] = {
-    0.
-  };
-  float ptlast = 0;
-  int chargefirst = 0;
-
-  DataVector<Trk::Track>::const_iterator trksItr = trks->begin();
-  DataVector<Trk::Track>::const_iterator trksItrE = trks->end();
-
-  //DataVector<xAOD::TrackParticle>::const_iterator trkPsItr  = trkPs->begin();
-  //DataVector<xAOD::TrackParticle>::const_iterator trkPsItrE = trkPs->end();
-
-  if (m_doIP) {
-    SG::ReadHandle<xAOD::VertexContainer> vxContainer {
-      m_VxPrimContainerName
-    };
-    if (not vxContainer.isValid()) {
-      ATH_MSG_DEBUG("Could not retrieve primary vertex info: " << m_VxPrimContainerName.key());
-      return StatusCode::FAILURE;
-    }
-    if (vxContainer.get()) {
-      ATH_MSG_VERBOSE("Nb of reco primary vertex for coll "
-                      << " = " << vxContainer->size());
-
-
-      xAOD::VertexContainer::const_iterator vxI = vxContainer->begin();
-      xAOD::VertexContainer::const_iterator vxE = vxContainer->end();
-      for (; vxI != vxE; ++vxI) {
-        //int nbtk = 0;
-        //const std::vector<Trk::VxTrackAtVertex*>* tracks = (*vxI)->vxTrackAtVertex();
-        if ((*vxI)->type() == 1) {
-          m_pvtx = (*vxI);
-        }
-      }
-    }
-  }
-
-  ATH_MSG_DEBUG("Start loop on tracks. Number of tracks " << tracks->size());
-  for (; trksItr != trksItrE; ++trksItr) {
-    nTracks++;
-    ATH_MSG_DEBUG("    dealing with track " << nTracks << " / " << tracks->size());
-
-    double chi2Prob = 0.;
-    float chisquared = 0.;
-    int DoF = 0;
-    float chi2oDoF = -999;
-    float trkd0 = -999;
-    float Err_d0 = -999;
-    float trkz0 = -999;
-    float Err_z0 = -999;
-    float trkphi = -999;
-    float Err_phi = -999;
-    float trktheta = -999;
-    float Err_cottheta = -999;
-    float Err_theta = -999;
-    float trketa = -999;
-    float qOverP = -999;
-    float qOverPt = -999;
-    float Err_qOverP = -999;
-    float Err_Pt = -999;
-    float trkpt = -999;
-    float trkP = -999;
-    float charge = 0;
-    float trkd0c = -999;
-    float trkz0c = -999;
-    float beamX = 0;
-    float beamY = 0;
-    float d0bscorr = -999;
-    // get fit quality and chi2 probability of track
-    // chi2Prob = TMath::Prob(chi2,DoF) ROOT function
-    const Trk::FitQuality* fitQual = (*trksItr)->fitQuality();
-
-    const Trk::Perigee* measPer = (*trksItr)->perigeeParameters();
-    const AmgSymMatrix(5) * covariance = measPer ? measPer->covariance() : nullptr;
-
-    std::unique_ptr<Trk::ImpactParametersAndSigma> myIPandSigma = nullptr;
-
-
-    if (m_doIP) {
-      //Get unbiased impact parameter
-
-      if (m_pvtx) myIPandSigma = m_trackToVertexIPEstimatorTool->estimate((*trksItr)->perigeeParameters(), m_pvtx, true);
-    }
-
-    if (covariance == nullptr) {
-      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endmsg;
-    } else {
-      AmgVector(5) perigeeParams = measPer->parameters();
-      trkd0 = perigeeParams[Trk::d0];
-      trkz0 = perigeeParams[Trk::z0];
-      trkphi = perigeeParams[Trk::phi0];
-      trktheta = perigeeParams[Trk::theta];
-      trketa = measPer->eta();
-      qOverP = perigeeParams[Trk::qOverP] * 1000.;
-      if (qOverP) trkP = 1 / qOverP;
-      qOverPt = qOverP / sin(trktheta);
-      trkpt = measPer->pT() / 1000.;
-      Err_qOverP = Amg::error(*measPer->covariance(), Trk::qOverP) * 1000;
-      Err_Pt = sin(trktheta) * Err_qOverP / pow(qOverP, 2);
-      Err_d0 = Amg::error(*measPer->covariance(), Trk::d0);
-      Err_z0 = Amg::error(*measPer->covariance(), Trk::z0);
-      Err_phi = Amg::error(*measPer->covariance(), Trk::phi0);
-      Err_cottheta = Amg::error(*measPer->covariance(), Trk::theta) / pow(TMath::Sin(trktheta), 2);
-      Err_theta = Amg::error(*measPer->covariance(), Trk::theta);
-      if (qOverP < 0) charge = -1;
-      else charge = +1;
-
-      // correct the track d0 for the vertex position
-      // would rather corrected for the beamline but could not find beamline
-      trkd0c = trkd0 - (yv * cos(trkphi) - xv * sin(trkphi));
-      trkz0c = trkz0 - zv;
-      ATH_MSG_DEBUG("trkd0, trkd0c" << trkd0 << ", " << trkd0c);
-
-      // correct the track parameters for the beamspot position
-      beamX = beamSpotX + tan(beamTiltX) * (trkz0 - beamSpotZ);
-      beamY = beamSpotY + tan(beamTiltY) * (trkz0 - beamSpotZ);
-      d0bscorr = trkd0 - (-sin(trkphi) * beamX + cos(trkphi) * beamY);
-
-      // per track weight, if required
-      if (m_applyHistWeight) {
-        int binNumber = m_etapTWeight->FindBin(trketa, trkpt);
-        hweight = m_etapTWeight->GetBinContent(binNumber);
-        //ATH_MSG_INFO(Form("weight = %f, for (eta,pT) = (%f,%f)", hweight, trketa, trkpt));
-      }
-    }
-
-    if (fitQual == nullptr) {
-      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No fit quality assigned to the track" << endmsg;
-      chi2Prob = -1e12; // return big value
-    } else {
-      if (fitQual->chiSquared() > 0. && fitQual->numberDoF() > 0) {
-        Genfun::CumulativeChiSquare probabilityFunction(fitQual->numberDoF());
-        chi2Prob = 1 - probabilityFunction(fitQual->chiSquared());
-      }
-    }
-
-    chisquared = (fitQual) ? fitQual->chiSquared() : -1.;
-    DoF = (fitQual) ? fitQual->numberDoF() : -1;
-    if (DoF > 0) chi2oDoF = chisquared / (float) DoF;
-
-    if (trkphi < 0) trkphi += 2 * M_PI;
-
-    ngTracks++;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << nTracks << " is a good track!" << endmsg;
-
-
-
-    int nhpixB = 0, nhpixECA = 0, nhpixECC = 0, nhsctB = 0, nhsctECA = 0, nhsctECC = 0, nhtrtB = 0, nhtrtECA = 0,
-        nhtrtECC = 0;
-    // loop over all hits on track
-    const Trk::TrackStates* TSOS;
-    TSOS = (*trksItr)->trackStateOnSurfaces();
-    Trk::TrackStates::const_iterator TSOSItr = TSOS->begin();
-    Trk::TrackStates::const_iterator TSOSItrE = TSOS->end();
-
-    ATH_MSG_VERBOSE("  starting to loop over TSOS: " << TSOS->size());
-    for (; TSOSItr != TSOSItrE; ++TSOSItr) {
-      //check that we have track parameters defined for the surface (pointer is not null)
-      if (!((*TSOSItr)->trackParameters())) {
-        ATH_MSG_DEBUG(" hit skipped because no associated track parameters");
-        continue;
-      }
-
-      Identifier surfaceID;
-      const Trk::MeasurementBase* mesb = (*TSOSItr)->measurementOnTrack();
-      // hits, outliers
-      if (mesb != nullptr &&
-      mesb->associatedSurface().associatedDetectorElement() !=
-      nullptr) surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify();
-
-      // holes, perigee
-      else continue;
-
-
-      if ((*TSOSItr)->type(Trk::TrackStateOnSurface::Measurement)) {
-        //hit quality cuts for Si hits if tool is configured - default is NO CUTS
-        if (m_idHelper->is_pixel(surfaceID) || m_idHelper->is_sct(surfaceID)) {
-          if (m_doHitQuality) {
-            if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to Silicon hit..." << endmsg;
-
-            const Trk::RIO_OnTrack* hit = m_hitQualityTool->getGoodHit(*TSOSItr);
-            if (hit == nullptr) {
-              ATH_MSG_DEBUG("hit failed quality cuts and is rejected.");
-              continue;
-            } else {
-              ATH_MSG_DEBUG("hit passed quality cuts");
-            }
-          } else {
-            ATH_MSG_DEBUG("hit quality cuts NOT APPLIED to Silicon hit.");
-          }
-        } // hit is Pixel or SCT
-
-        const Trk::Surface& hitSurface = mesb->associatedSurface();
-        float hitSurfaceX = hitSurface.center().x();
-        float hitSurfaceY = hitSurface.center().y();
-
-        const Amg::Vector3D& gp = mesb->globalPosition();
-
-        // --- pixel
-        if (m_idHelper->is_pixel(surfaceID)) {
-          if (m_pixelID->barrel_ec(surfaceID) == 0) {
-            nhpixB++;
-            m_hitMap_barrel->Fill(hitSurfaceX, hitSurfaceY, hweight);
-          } else if (m_pixelID->barrel_ec(surfaceID) == 2) nhpixECA++;
-          else if (m_pixelID->barrel_ec(surfaceID) == -2) nhpixECC++;
-        }
-        // --- sct
-        else if (m_idHelper->is_sct(surfaceID)) {
-          if (m_sctID->barrel_ec(surfaceID) == 0) {
-            nhsctB++;
-            m_hitMap_barrel->Fill(hitSurfaceX, hitSurfaceY, hweight);
-          } else if (m_sctID->barrel_ec(surfaceID) == 2) nhsctECA++;
-          else if (m_sctID->barrel_ec(surfaceID) == -2) nhsctECC++;
-        }
-        // --- trt
-        if (m_idHelper->is_trt(surfaceID)) {
-          int barrel_ec = m_trtID->barrel_ec(surfaceID);
-          if (barrel_ec == 1 || barrel_ec == -1) {
-            nhtrtB++;
-            m_hitMap_barrel->Fill(hitSurfaceX, hitSurfaceY, hweight);
-          } else if (barrel_ec == 2) {
-            nhtrtECA++;
-            m_hitMap_endcapA->Fill(float(gp.z()), float(gp.phi()), hweight);
-          } else if (barrel_ec == -2) {
-            nhtrtECC++;
-            m_hitMap_endcapC->Fill(float(gp.z()), float(gp.phi()), hweight);
-          }
-        }
-      }
-    }
-    int nhpix = nhpixB + nhpixECA + nhpixECC;
-    int nhsct = nhsctB + nhsctECA + nhsctECC;
-    int nhtrt = nhtrtB + nhtrtECA + nhtrtECC;
-    int nhits = nhpix + nhsct + nhtrt;
-
-    nHits += nhits;
-
-    m_nhits_per_track->Fill(nhits, hweight);
-    m_npixhits_per_track->Fill(nhpix, hweight);
-    m_nscthits_per_track->Fill(nhsct, hweight);
-    m_ntrthits_per_track->Fill(nhtrt, hweight);
-    // barrel
-    m_npixhits_per_track_barrel->Fill(nhpixB, hweight);
-    m_nscthits_per_track_barrel->Fill(nhsctB, hweight);
-    m_ntrthits_per_track_barrel->Fill(nhtrtB, hweight);
-    // eca
-    m_npixhits_per_track_eca->Fill(nhpixECA, hweight);
-    m_nscthits_per_track_eca->Fill(nhsctECA, hweight);
-    m_ntrthits_per_track_eca->Fill(nhtrtECA, hweight);
-    // ecc
-    m_npixhits_per_track_ecc->Fill(nhpixECC, hweight);
-    m_nscthits_per_track_ecc->Fill(nhsctECC, hweight);
-    m_ntrthits_per_track_ecc->Fill(nhtrtECC, hweight);
-
-    if (nhpix >= 3) m_summary->Fill(0., hweight);                                                        // Priscilla:
-                                                                                                         // ask anthony
-                                                                                                         // if this is
-                                                                                                         // correct ..
-    if (nhsct >= 8) m_summary->Fill(1., hweight);
-    if (nhtrt >= 20) m_summary->Fill(2., hweight);
-    if (nhpixB >= 3) m_summary->Fill(3., hweight);
-    if (nhsctB >= 8) m_summary->Fill(4., hweight);
-    if (nhtrtB >= 20) m_summary->Fill(5., hweight);
-    if (nhpixECA >= 2) m_summary->Fill(6., hweight);
-    if (nhsctECA >= 2) m_summary->Fill(7., hweight);
-    if (nhtrtECA >= 15) m_summary->Fill(8., hweight);
-    if (nhpixECC >= 2) m_summary->Fill(9., hweight);
-    if (nhsctECC >= 2) m_summary->Fill(10., hweight);
-    if (nhtrtECC >= 15) m_summary->Fill(11., hweight);
-
-    bool hasECAhits = false;
-    if (nhpixECA + nhsctECA + nhtrtECA > 0) hasECAhits = true;
-    bool hasECChits = false;
-    if (nhpixECC + nhsctECC + nhtrtECC > 0) hasECChits = true;
-
-
-    if (!hasECAhits && !hasECChits) { //filling barrel histograms
-      m_chi2oDoF_barrel->Fill(chi2oDoF, hweight);
-      m_phi_barrel->Fill(trkphi, hweight);
-
-
-      if (m_doIP && myIPandSigma) {
-        m_trk_d0_wrtPV_vs_phi_vs_eta_barrel->Fill(trketa, trkphi, myIPandSigma->IPd0, hweight);
-        m_trk_z0_wrtPV_vs_phi_vs_eta_barrel->Fill(trketa, trkphi, myIPandSigma->IPz0, hweight);
-      }
-
-
-      if (charge > 0) {
-        if (trkpt > 2. && trkpt < 5.) m_phi_barrel_pos_2_5GeV->Fill(trkphi, hweight);
-        else if (trkpt > 5. && trkpt < 10.) m_phi_barrel_pos_5_10GeV->Fill(trkphi, hweight);
-        else if (trkpt > 10. && trkpt < 20.) m_phi_barrel_pos_10_20GeV->Fill(trkphi, hweight);
-        else if (trkpt > 20.) m_phi_barrel_pos_20plusGeV->Fill(trkphi, hweight);
-      } else if (charge < 0) {
-        if (trkpt > 2. && trkpt < 5.) m_phi_barrel_neg_2_5GeV->Fill(trkphi, hweight);
-        else if (trkpt > 5. && trkpt < 10.) m_phi_barrel_neg_5_10GeV->Fill(trkphi, hweight);
-        else if (trkpt > 10. && trkpt < 20.) m_phi_barrel_neg_10_20GeV->Fill(trkphi, hweight);
-        else if (trkpt > 20.) m_phi_barrel_neg_20plusGeV->Fill(trkphi, hweight);
-      }
-    } else if (hasECAhits) {//filling endcap A histograms
-      m_chi2oDoF_eca->Fill(chi2oDoF, hweight);
-      m_phi_eca->Fill(trkphi, hweight);
-
-
-
-      if (m_doIP && myIPandSigma) {
-        m_trk_d0_wrtPV_vs_phi_vs_eta_eca->Fill(trketa, trkphi, myIPandSigma->IPd0, hweight);
-        m_trk_z0_wrtPV_vs_phi_vs_eta_eca->Fill(trketa, trkphi, myIPandSigma->IPz0, hweight);
-      }
-
-      if (charge > 0) {
-        if (trkpt > 2. && trkpt < 5.) m_phi_eca_pos_2_5GeV->Fill(trkphi, hweight);
-        else if (trkpt > 5. && trkpt < 10.) m_phi_eca_pos_5_10GeV->Fill(trkphi, hweight);
-        else if (trkpt > 10. && trkpt < 20.) m_phi_eca_pos_10_20GeV->Fill(trkphi, hweight);
-        else if (trkpt > 20.) m_phi_eca_pos_20plusGeV->Fill(trkphi, hweight);
-      } else if (charge < 0) {
-        if (trkpt > 2. && trkpt < 5.) m_phi_eca_neg_2_5GeV->Fill(trkphi, hweight);
-        else if (trkpt > 5. && trkpt < 10.) m_phi_eca_neg_5_10GeV->Fill(trkphi, hweight);
-        else if (trkpt > 10. && trkpt < 20.) m_phi_eca_neg_10_20GeV->Fill(trkphi, hweight);
-        else if (trkpt > 20.) m_phi_eca_neg_20plusGeV->Fill(trkphi, hweight);
-      }
-    } else if (hasECChits) {//filling endcap C histograms
-      m_chi2oDoF_ecc->Fill(chi2oDoF, hweight);
-      m_phi_ecc->Fill(trkphi, hweight);
-
-
-      if (m_doIP && myIPandSigma) {
-        m_trk_d0_wrtPV_vs_phi_vs_eta_ecc->Fill(trketa, trkphi, myIPandSigma->IPd0, hweight);
-        m_trk_z0_wrtPV_vs_phi_vs_eta_ecc->Fill(trketa, trkphi, myIPandSigma->IPz0, hweight);
-      }
-
-
-      if (charge > 0) {
-        if (trkpt > 2. && trkpt < 5.) m_phi_ecc_pos_2_5GeV->Fill(trkphi, hweight);
-        else if (trkpt > 5. && trkpt < 10.) m_phi_ecc_pos_5_10GeV->Fill(trkphi, hweight);
-        else if (trkpt > 10. && trkpt < 20.) m_phi_ecc_pos_10_20GeV->Fill(trkphi, hweight);
-        else if (trkpt > 20.) m_phi_ecc_pos_20plusGeV->Fill(trkphi, hweight);
-      } else if (charge < 0) {
-        if (trkpt > 2. && trkpt < 5.) m_phi_ecc_neg_2_5GeV->Fill(trkphi, hweight);
-        else if (trkpt > 5. && trkpt < 10.) m_phi_ecc_neg_5_10GeV->Fill(trkphi, hweight);
-        else if (trkpt > 10. && trkpt < 20.) m_phi_ecc_neg_10_20GeV->Fill(trkphi, hweight);
-        else if (trkpt > 20.) m_phi_ecc_neg_20plusGeV->Fill(trkphi, hweight);
-      }
-    }
-
-    m_chi2oDoF->Fill(chi2oDoF, hweight);
-    m_eta->Fill(trketa, hweight);
-    if (charge > 0) m_eta_pos->Fill(trketa, hweight);
-    else m_eta_neg->Fill(trketa, hweight);
-    m_phi->Fill(trkphi, hweight);
-    if (charge > 0) {
-      if (trkpt > 2. && trkpt < 5.) m_eta_phi_pos_2_5GeV->Fill(trketa, trkphi, hweight);
-      else if (trkpt > 5. && trkpt < 10.) m_eta_phi_pos_5_10GeV->Fill(trketa, trkphi, hweight);
-      else if (trkpt > 10. && trkpt < 20.) m_eta_phi_pos_10_20GeV->Fill(trketa, trkphi, hweight);
-      else if (trkpt > 20.) m_eta_phi_pos_20plusGeV->Fill(trketa, trkphi, hweight);
-    } else if (charge < 0) {
-      if (trkpt > 2. && trkpt < 5.) m_eta_phi_neg_2_5GeV->Fill(trketa, trkphi, hweight);
-      else if (trkpt > 5. && trkpt < 10.) m_eta_phi_neg_5_10GeV->Fill(trketa, trkphi, hweight);
-      else if (trkpt > 10. && trkpt < 20.) m_eta_phi_neg_10_20GeV->Fill(trketa, trkphi, hweight);
-      else if (trkpt > 20.) m_eta_phi_neg_20plusGeV->Fill(trketa, trkphi, hweight);
-    }
-    m_z0->Fill(trkz0, hweight);
-    m_z0sintheta->Fill(trkz0 * (sin(trktheta)), hweight);
-    m_d0->Fill(trkd0, hweight);
-    m_d0_bscorr->Fill(d0bscorr, hweight);
-
-    if (m_doIP && myIPandSigma) {
-      m_trk_d0_wrtPV->Fill(myIPandSigma->IPd0, hweight);
-      m_trk_z0_wrtPV->Fill(myIPandSigma->IPz0, hweight);
-    }
-    m_pT->Fill(charge * trkpt, hweight);
-    m_P->Fill(trkP, hweight);
-    if (charge > 0) m_pT_p->Fill(trkpt, hweight);
-    if (charge < 0) m_pT_n->Fill(trkpt, hweight);
-
-    m_pTRes->Fill(std::fabs(Err_qOverP / qOverP), hweight);
-    m_pTResOverP->Fill(std::fabs(Err_qOverP / qOverP * qOverP), hweight);
-
-
-
-    m_Tracks_per_LumiBlock->Fill(LumiBlock, hweight);
-    m_NPIX_per_LumiBlock->Fill(LumiBlock, nhpix * hweight);
-    m_NSCT_per_LumiBlock->Fill(LumiBlock, nhsct * hweight);
-    m_NTRT_per_LumiBlock->Fill(LumiBlock, nhtrt * hweight);
-
-
-
-    if (m_doIP && myIPandSigma) {
-      m_trk_d0_wrtPV_vs_phi_vs_eta->Fill(trketa, trkphi, myIPandSigma->IPd0, hweight);
-      m_trk_z0_wrtPV_vs_phi_vs_eta->Fill(trketa, trkphi, myIPandSigma->IPz0, hweight);
-    }
-
-
-    if (m_extendedPlots) {
-      m_d0_pvcorr->Fill(trkd0c, hweight);
-      m_z0_pvcorr->Fill(trkz0c, hweight);
-
-      if (charge > 0) {
-        m_trk_d0c_pos->Fill(trkd0c, hweight);
-        m_trk_z0c_pos->Fill(trkz0c, hweight);
-      }
-      if (charge < 0) {
-        m_trk_d0c_neg->Fill(trkd0c, hweight);
-        m_trk_z0c_neg->Fill(trkz0c, hweight);
-      }
-
-      m_trk_d0_vs_phi0_z0->Fill(trkphi, trkz0, trkd0);
-      m_z0sintheta_pvcorr->Fill(trkz0c * (sin(trktheta)), hweight);
-      m_trk_chi2oDoF->Fill(trketa, chi2oDoF, hweight);
-      m_trk_chi2Prob->Fill(trketa, chi2Prob, hweight);
-      m_trk_d0_vs_phi_vs_eta->Fill(trketa, trkphi, trkd0c, hweight);
-      m_trk_pT_vs_eta->Fill(trketa, trkpt, hweight);
-      m_trk_PIXvSCTHits->Fill(nhsct, nhpix, hweight);
-      m_trk_PIXHitsvEta->Fill(trketa, nhpix, hweight);
-      m_trk_SCTHitsvEta->Fill(trketa, nhsct, hweight);
-      m_trk_TRTHitsvEta->Fill(trketa, nhtrt, hweight);
-      m_trk_chi2oDoF_Phi->Fill(trkphi, chi2oDoF, hweight);
-      m_trk_chi2oDoF_Pt->Fill(charge * trkpt, chi2oDoF, hweight);
-      m_trk_chi2oDoF_P->Fill(charge * std::fabs(trkP), chi2oDoF, hweight);
-      m_trk_chi2ProbDist->Fill(chi2Prob, hweight);
-      m_errCotTheta->Fill(Err_cottheta, hweight);
-      m_errCotThetaVsD0BS->Fill(d0bscorr, Err_cottheta, hweight);
-      m_errCotThetaVsPt->Fill(std::fabs(trkpt), Err_cottheta, hweight);
-      m_errCotThetaVsP->Fill(std::fabs(trkP), Err_cottheta, hweight);
-      m_errCotThetaVsPhi->Fill(trkphi, Err_cottheta, hweight);
-      m_errCotThetaVsEta->Fill(trketa, Err_cottheta, hweight);
-      m_errTheta->Fill(Err_theta, hweight);
-      m_errThetaVsD0BS->Fill(d0bscorr, Err_theta, hweight);
-      m_errThetaVsPt->Fill(std::fabs(trkpt), Err_theta, hweight);
-      m_errThetaVsP->Fill(std::fabs(trkP), Err_theta, hweight);
-      m_errThetaVsPhi->Fill(trkphi, Err_theta, hweight);
-      m_errThetaVsEta->Fill(trketa, Err_theta, hweight);
-      m_errD0->Fill(Err_d0, hweight);
-      m_errD0VsD0BS->Fill(d0bscorr, Err_d0, hweight);
-      m_errD0VsPt->Fill(std::fabs(trkpt), Err_d0, hweight);
-      m_errD0VsP->Fill(std::fabs(trkP), Err_d0, hweight);
-      m_errD0VsPhi->Fill(trkphi, Err_d0, hweight);
-      m_errD0VsEta->Fill(trketa, Err_d0, hweight);
-      m_errPhi0->Fill(Err_phi, hweight);
-      m_errPhi0VsD0BS->Fill(d0bscorr, Err_phi, hweight);
-      m_errPhi0VsPt->Fill(std::fabs(trkpt), Err_phi, hweight);
-      m_errPhi0VsP->Fill(std::fabs(trkP), Err_phi, hweight);
-      m_errPhi0VsPhi0->Fill(trkphi, Err_phi, hweight);
-      m_errPhi0VsEta->Fill(trketa, Err_phi, hweight);
-      m_errZ0->Fill(Err_z0, hweight);
-      //m_errZ0VsD0BS      -> Fill( d0bscorr         , Err_z0   , hweight);
-      m_errZ0VsPt->Fill(std::fabs(trkpt), Err_z0, hweight);
-      m_errZ0VsP->Fill(std::fabs(trkP), Err_z0, hweight);
-      m_errZ0VsPhi0->Fill(trkphi, Err_z0, hweight);
-      m_errZ0VsEta->Fill(trketa, Err_z0, hweight);
-      m_errPt->Fill(Err_Pt, hweight);
-      m_errPtVsD0BS->Fill(d0bscorr, Err_Pt, hweight);
-      m_errPtVsPt->Fill(trkpt, Err_Pt, hweight);
-      m_errPtVsP->Fill(std::fabs(trkP), Err_Pt, hweight);
-      m_errPt_Pt2->Fill(Err_Pt / (trkpt * trkpt), hweight);
-      m_errPt_Pt2VsPt->Fill(trkpt, Err_Pt / (trkpt * trkpt), hweight);
-      m_errPt_Pt2VsEta->Fill(trketa, Err_Pt / (trkpt * trkpt), hweight);
-      m_errPt_Pt2VsPhi0->Fill(trkphi, Err_Pt / (trkpt * trkpt), hweight);
-      m_errPtVsPhi0->Fill(trkphi, Err_Pt, hweight);
-      m_errPtVsEta->Fill(trketa, Err_Pt, hweight);
-      m_D0VsPhi0->Fill(trkphi, trkd0, hweight);
-      m_Z0VsEta->Fill(trketa, trkz0, hweight);
-      m_QoverPtVsPhi0->Fill(trkphi, qOverPt, hweight);
-      m_QoverPtVsEta->Fill(trketa, qOverPt, hweight);
-      m_QPtVsPhi0->Fill(trkphi, charge * trkpt, hweight);
-      m_QPtVsEta->Fill(trketa, charge * trkpt, hweight);
-      //bs plots
-      m_D0bsVsPhi0->Fill(trkphi, d0bscorr, hweight);
-      m_D0bsVsEta->Fill(trketa, d0bscorr, hweight);
-      m_D0bsVsPt->Fill(charge * trkpt, d0bscorr, hweight);
-
-      if (!hasECAhits && !hasECChits) {//filling barrel histograms
-        m_errD0VsPhiBarrel->Fill(trkphi, Err_d0, hweight);
-        m_D0bsVsPhi0Barrel->Fill(trkphi, d0bscorr, hweight);
-        m_D0bsVsPtBarrel->Fill(charge * trkpt, d0bscorr, hweight);
-        m_trk_d0_vs_phi_vs_eta_barrel->Fill(trketa, trkphi, trkd0c, hweight);
-        m_trk_pT_vs_eta_barrel->Fill(trketa, trkpt, hweight);
-        m_trk_d0_barrel->Fill(trkd0, hweight);
-        m_trk_d0_barrel_zoomin->Fill(trkd0, hweight);
-        m_trk_d0c_barrel->Fill(trkd0c, hweight);
-        m_trk_z0_barrel->Fill(trkz0, hweight);
-        m_trk_z0_barrel_zoomin->Fill(trkz0, hweight);
-
-        if (charge < 0) {
-          m_trk_d0c_neg_barrel->Fill(trkd0c, hweight);
-          m_trk_z0c_neg_barrel->Fill(trkz0c, hweight);
-        } else {
-          m_trk_d0c_pos_barrel->Fill(trkd0c, hweight);
-          m_trk_z0c_pos_barrel->Fill(trkz0c, hweight);
-        }
-      } else if (hasECAhits) {//filling ECA histograms
-        m_errD0VsPhiECA->Fill(trkphi, Err_d0, hweight);
-        m_D0bsVsPhi0ECA->Fill(trkphi, d0bscorr, hweight);
-        m_D0bsVsPtECA->Fill(charge * trkpt, d0bscorr, hweight);
-        m_trk_d0_vs_phi_vs_eta_eca->Fill(trketa, trkphi, trkd0c, hweight);
-        m_trk_pT_vs_eta_eca->Fill(trketa, trkpt, hweight);
-        m_trk_d0_eca->Fill(trkd0, hweight);
-        m_trk_d0_eca_zoomin->Fill(trkd0, hweight);
-        m_trk_d0c_eca->Fill(trkd0c, hweight);
-        m_trk_z0_eca->Fill(trkz0, hweight);
-        m_trk_z0_eca_zoomin->Fill(trkz0, hweight);
-
-        if (charge < 0) {
-          m_trk_d0c_neg_eca->Fill(trkd0c, hweight);
-          m_trk_z0c_neg_eca->Fill(trkz0c, hweight);
-        } else {
-          m_trk_d0c_pos_eca->Fill(trkd0c, hweight);
-          m_trk_z0c_pos_eca->Fill(trkz0c, hweight);
-        }
-      } else if (hasECChits) {//filling ECA histograms
-        m_errD0VsPhiECC->Fill(trkphi, Err_d0, hweight);
-        m_D0bsVsPhi0ECC->Fill(trkphi, d0bscorr, hweight);
-        m_D0bsVsPtECC->Fill(charge * trkpt, d0bscorr, hweight);
-        m_trk_d0_vs_phi_vs_eta_ecc->Fill(trketa, trkphi, trkd0c, hweight);
-        m_trk_pT_vs_eta_ecc->Fill(trketa, trkpt, hweight);
-        m_trk_d0_ecc->Fill(trkd0, hweight);
-        m_trk_d0_ecc_zoomin->Fill(trkd0, hweight);
-        m_trk_d0c_ecc->Fill(trkd0c, hweight);
-        m_trk_z0_ecc->Fill(trkz0, hweight);
-        m_trk_z0_ecc_zoomin->Fill(trkz0, hweight);
-
-        if (charge < 0) {
-          m_trk_d0c_neg_ecc->Fill(trkd0c, hweight);
-          m_trk_z0c_neg_ecc->Fill(trkz0c, hweight);
-        } else {
-          m_trk_d0c_pos_ecc->Fill(trkd0c, hweight);
-          m_trk_z0c_pos_ecc->Fill(trkz0c, hweight);
-        }
-      }
-      if (charge > 0) m_PtVsPhi0Pos->Fill(trkphi, trkpt, hweight);
-      else m_PtVsPhi0Neg->Fill(trkphi, trkpt, hweight);
-    }//Closing extended plots
-
-    if (!hasECAhits && !hasECChits) {//filling barrel histograms
-      m_trk_qopT_vs_phi_barrel->Fill(trkphi, qOverPt, hweight);
-      m_trk_d0_vs_phi_barrel->Fill(trkphi, trkd0, hweight);
-      m_trk_d0_vs_z0_barrel->Fill(trkz0, trkd0, hweight);
-      if (charge < 0) {
-        m_trk_phi0_neg_barrel->Fill(trkphi, hweight);
-        m_trk_pT_neg_barrel->Fill(trkpt, hweight);
-      } else {
-        m_trk_phi0_pos_barrel->Fill(trkphi, hweight);
-        m_trk_pT_pos_barrel->Fill(trkpt, hweight);
-      }
-    } else if (hasECAhits) {//filling endcap A histograms
-      m_trk_qopT_vs_phi_eca->Fill(trkphi, qOverPt, hweight);
-      m_trk_d0_vs_phi_eca->Fill(trkphi, trkd0, hweight);
-      m_trk_d0_vs_z0_eca->Fill(trkz0, trkd0, hweight);
-      if (charge < 0) {
-        m_trk_phi0_neg_eca->Fill(trkphi, hweight);
-        m_trk_pT_neg_eca->Fill(trkpt, hweight);
-      } else {
-        m_trk_phi0_pos_eca->Fill(trkphi, hweight);
-        m_trk_pT_pos_eca->Fill(trkpt, hweight);
-      }
-    } else if (hasECChits) {//filling endcap C histograms
-      m_trk_qopT_vs_phi_ecc->Fill(trkphi, qOverPt, hweight);
-      m_trk_d0_vs_phi_ecc->Fill(trkphi, trkd0, hweight);
-      m_trk_d0_vs_z0_ecc->Fill(trkz0, trkd0, hweight);
-      if (charge < 0) {
-        m_trk_phi0_neg_ecc->Fill(trkphi, hweight);
-        m_trk_pT_neg_ecc->Fill(trkpt, hweight);
-      } else {
-        m_trk_phi0_pos_ecc->Fill(trkphi, hweight);
-        m_trk_pT_pos_ecc->Fill(trkpt, hweight);
-      }
-    }
-
-    if (trkpt > ptlast) {
-      z_E[0] = std::fabs(trkpt / sin(trktheta));
-      z_pz[0] = trkpt / tan(trktheta);
-      z_px[0] = trkpt * sin(trkphi);
-      z_py[0] = trkpt * cos(trkphi);
-      z_pT[0] = charge * trkpt;
-      z_eta[0] = trketa;
-      ptlast = trkpt;
-      chargefirst = (int) charge;
-    }
-
-  } // end of loop on trks
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of good tracks from TrackCollection: " << ngTracks << endmsg;
-
-  m_nhits_per_event->Fill(nHits, hweight);
-  m_ntrk->Fill(nTracks, hweight);
-  m_ngtrk->Fill(ngTracks, hweight);
-
-  float ptfirst = ptlast;
-  ptlast = 0;
-  trksItr = trks->begin();
-  for (; trksItr != trksItrE; ++trksItr) {
-    //const Trk::Track* trksItr = (*trkPsItr)->track();
-
-    float trkphi = -999;
-    float trktheta = -999;
-    float trkpt = -999;
-    float trketa = -999;
-    float qOverP = -999;
-    float charge = 0;
-
-
-    // get fit quality and chi2 probability of track
-    // chi2Prob = TMath::Prob(chi2,DoF) ROOT function
-
-    const Trk::Perigee* measPer = (*trksItr)->perigeeParameters();
-    const AmgSymMatrix(5) * covariance = measPer ? measPer->covariance() : nullptr;
-
-    if (covariance == nullptr) {
-      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track or no covariance matrix associated to the perigee" << endmsg;
-    } else {
-      AmgVector(5)  perigeeParams = measPer->parameters();
-      trkphi = perigeeParams[Trk::phi0];
-      trktheta = perigeeParams[Trk::theta];
-      trkpt = measPer->pT() / 1000.;
-      qOverP = perigeeParams[Trk::qOverP] * 1000.;
-      trketa = measPer->eta();
-      if (qOverP < 0) charge = -1;
-      else charge = 1;
-    }
-    if (trkpt > ptlast && trkpt < ptfirst && chargefirst * charge < 0 && trkpt > 20) {
-      z_E[1] = std::fabs(trkpt / sin(trktheta));
-      z_pz[1] = trkpt / tan(trktheta);
-      z_px[1] = trkpt * sin(trkphi);
-      z_py[1] = trkpt * cos(trkphi);
-      z_pT[1] = charge * trkpt;
-      z_eta[1] = trketa;
-      ptlast = trkpt;
-      z_true = true;
-    }
-  }
-
-  if (z_true) {
-    // build invariant mass of two highest pT tracks
-    float M = (z_E[0] + z_E[1]) * (z_E[0] + z_E[1]) - (z_px[0] + z_px[1]) * (z_px[0] + z_px[1]) - (z_py[0] + z_py[1]) * (z_py[0] + z_py[1]) - (z_pz[0] + z_pz[1]) * (z_pz[0] + z_pz[1]);
-    if (M <= 0) M = 0;
-    else M = std::sqrt(M);
-
-
-    m_Zmumu->Fill(M, hweight);
-
-    if (z_pT[0] > 0) {
-      m_ZpT_p->Fill(z_pT[0], hweight);
-      m_ZpT_n->Fill(-z_pT[1], hweight);
-    } else {
-      m_ZpT_p->Fill(z_pT[1], hweight);
-      m_ZpT_n->Fill(-z_pT[0], hweight);
-    }
-
-    if (std::fabs(z_eta[0]) < m_barrelEta && std::fabs(z_eta[1]) < m_barrelEta) m_Zmumu_barrel->Fill(M, hweight);
-    if (z_eta[0] >= m_barrelEta && z_eta[1] >= m_barrelEta) m_Zmumu_eca->Fill(M, hweight);
-    if (z_eta[0] <= -m_barrelEta && z_eta[1] <= -m_barrelEta) m_Zmumu_ecc->Fill(M, hweight);
-
-    if ((std::fabs(z_eta[0]) < m_barrelEta && z_eta[1] >= m_barrelEta) ||
-        (z_eta[0] >= m_barrelEta && std::fabs(z_eta[1]) < m_barrelEta)) m_Zmumu_barrel_eca->Fill(M, hweight);
-
-    if ((std::fabs(z_eta[0]) < m_barrelEta && z_eta[1] <= -m_barrelEta) ||
-        (z_eta[0] <= -m_barrelEta && std::fabs(z_eta[1]) < m_barrelEta)) m_Zmumu_barrel_ecc->Fill(M, hweight);
-  }
-
-  delete trks;
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonGenericTracks::procHistograms() {
-  //if( endOfLowStatFlag() ) {  }
-  //if( endOfLumiBlockFlag() ) {  }
-  if (endOfRunFlag()) {
-    m_ZpT_diff->Add(m_ZpT_p, m_ZpT_n, 1., -1);
-    m_pT_diff->Add(m_pT_p, m_pT_n, 1., -1);
-
-    ProcessAsymHistograms(m_eta_neg, m_eta_pos, m_eta_asym);
-    ProcessAsymHistograms(m_pT_n, m_pT_p, m_trk_pT_asym);
-
-    if (m_extendedPlots) {
-      ProcessAsymHistograms(m_trk_phi0_neg_barrel, m_trk_phi0_pos_barrel, m_trk_phi0_asym_barrel);
-      ProcessAsymHistograms(m_trk_phi0_neg_eca, m_trk_phi0_pos_eca, m_trk_phi0_asym_eca);
-      ProcessAsymHistograms(m_trk_phi0_neg_ecc, m_trk_phi0_pos_ecc, m_trk_phi0_asym_ecc);
-      ProcessAsymHistograms(m_trk_pT_neg_barrel, m_trk_pT_pos_barrel, m_trk_pT_asym_barrel);
-      ProcessAsymHistograms(m_trk_pT_neg_eca, m_trk_pT_pos_eca, m_trk_pT_asym_eca);
-      ProcessAsymHistograms(m_trk_pT_neg_ecc, m_trk_pT_pos_ecc, m_trk_pT_asym_ecc);
-      ProcessAsymHistograms(m_trk_d0c_neg, m_trk_d0c_pos, m_trk_d0c_asym);
-      ProcessAsymHistograms(m_trk_z0c_neg, m_trk_z0c_pos, m_trk_z0c_asym);
-      ProcessAsymHistograms(m_trk_d0c_neg_barrel, m_trk_d0c_pos_barrel, m_trk_d0c_asym_barrel);
-      ProcessAsymHistograms(m_trk_z0c_neg_barrel, m_trk_z0c_pos_barrel, m_trk_z0c_asym_barrel);
-      ProcessAsymHistograms(m_trk_d0c_neg_eca, m_trk_d0c_pos_eca, m_trk_d0c_asym_eca);
-      ProcessAsymHistograms(m_trk_z0c_neg_eca, m_trk_z0c_pos_eca, m_trk_z0c_asym_eca);
-      ProcessAsymHistograms(m_trk_d0c_neg_ecc, m_trk_d0c_pos_ecc, m_trk_d0c_asym_ecc);
-      ProcessAsymHistograms(m_trk_z0c_neg_ecc, m_trk_z0c_pos_ecc, m_trk_z0c_asym_ecc);
-    }
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-void IDAlignMonGenericTracks::ProcessAsymHistograms(TH1F* h_neg, TH1F* h_pos, TH1F* h_asym) {
-  if (h_neg->GetNbinsX() == h_pos->GetNbinsX() && h_neg->GetNbinsX() == h_asym->GetNbinsX()) {
-    for (int i = 1; i <= h_neg->GetNbinsX(); i++) {
-      float nneg = h_neg->GetBinContent(i);
-      float npos = h_pos->GetBinContent(i);
-      float asym = 0;
-      if (nneg + npos > 0) asym = (npos - nneg) / (nneg + npos);
-      h_asym->SetBinContent(i, asym);
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)
-          << ">>ProcessAsymHistograms>> " << h_asym->GetTitle()
-          << "  bin: " << i
-          << "  npos=" << npos
-          << "  nneg=" << nneg
-          << "  asym=" << asym
-          << endmsg;
-    }
-  }
-}
-
-const xAOD::Vertex* IDAlignMonGenericTracks::findAssociatedVertexTP(const std::map<const xAOD::TrackParticle*, const xAOD::Vertex*>& trackVertexMapTP, const xAOD::TrackParticle* track) const {
-  std::map<const xAOD::TrackParticle*, const xAOD::Vertex* >::const_iterator tpVx = trackVertexMapTP.find(track);
-
-  if (tpVx == trackVertexMapTP.end()) {
-    ATH_MSG_VERBOSE("Did not find the vertex. Returning 0");
-    return nullptr;
-  }
-  return (*tpVx).second;
-}
-
-const Trk::Track* IDAlignMonGenericTracks::getTrkTrack(const Trk::VxTrackAtVertex* trkAtVx) {
-  //find the link to the TrackParticleBase
-  const Trk::ITrackLink* trkLink = trkAtVx->trackOrParticleLink();
-  const Trk::TrackParticleBase* trkPB(nullptr);
-
-  if (nullptr != trkLink) {
-    const Trk::LinkToTrackParticleBase* linktrkPB = dynamic_cast<const Trk::LinkToTrackParticleBase*>(trkLink);
-    if (nullptr != linktrkPB) {
-      if (linktrkPB->isValid()) trkPB = linktrkPB->cachedElement();
-    }//end of dynamic_cast check
-  }//end of ITrackLink existance check
-
-  //cast to TrackParticle
-  if (trkPB) {
-    if (trkPB->trackElementLink()->isValid()) {
-      // retrieve and refit original track
-      const Trk::Track* trktrk = trkPB->originalTrack();
-      return trktrk;
-    }
-  }
-  return nullptr;
-}
-
-bool IDAlignMonGenericTracks::fillVertexInformation(std::map<const xAOD::TrackParticle*, const xAOD::Vertex*>& trackVertexMapTP) const {
-  ATH_MSG_DEBUG("Generic Tracks: fillVertexInformation(): Checking ");
-  trackVertexMapTP.clear();
-  SG::ReadHandle<xAOD::VertexContainer> vxContainer {
-    m_VxPrimContainerName
-  };
-  if (not vxContainer.isValid()) {
-    ATH_MSG_DEBUG("Could not retrieve primary vertex info: " << m_VxPrimContainerName.key());
-    return false;
-  }
-
-
-  ATH_MSG_DEBUG("Found primary vertex info: " << m_VxPrimContainerName.key());
-  if (vxContainer.get()) {
-    ATH_MSG_VERBOSE("Nb of reco primary vertex for coll "
-                    << " = " << vxContainer->size());
-
-
-    xAOD::VertexContainer::const_iterator vxI = vxContainer->begin();
-    xAOD::VertexContainer::const_iterator vxE = vxContainer->end();
-    for (; vxI != vxE; ++vxI) {
-      //int nbtk = 0;
-      //const std::vector<Trk::VxTrackAtVertex*>* tracks = (*vxI)->vxTrackAtVertex();
-      auto tpLinks = (*vxI)->trackParticleLinks();
-      ATH_MSG_DEBUG("tpLinks size " << tpLinks.size());
-
-      if (tpLinks.size() > 4) {
-        for (const auto& link: tpLinks) {
-          const xAOD::TrackParticle* TP = *link;
-          if (TP) {
-            trackVertexMapTP.insert(std::make_pair(TP, *vxI));
-          }
-        }
-      }
-    }
-  }
-
-  return true;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h
deleted file mode 100644
index 06e4a9f02c113f5e0343ed865e78a4a4fee8b72f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
-   Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef IDAlignMonGenericTracks_H
-#define IDAlignMonGenericTracks_H
-
-// **********************************************************************
-// IDAlignMonGenericTracks.cxx
-// AUTHORS: Beate Heinemann, Tobias Golling
-// **********************************************************************
-
-#include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h"
-#include "TrkExInterfaces/IExtrapolator.h"
-#include "GaudiKernel/StatusCode.h"
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "EventPrimitives/EventPrimitivesHelpers.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "xAODEventInfo/EventInfo.h"
-#include "xAODTracking/TrackParticle.h"
-#include "xAODTracking/TrackParticleContainer.h"
-#include "xAODTracking/Vertex.h"
-#include "xAODTracking/VertexContainer.h"
-#include "BeamSpotConditionsData/BeamSpotData.h"
-#include "StoreGate/ReadHandleKey.h"
-#include <vector>
-#include <map>
-
-class TH1F;
-class TH2F;
-class TH3F;
-class TProfile;
-class TFile;
-class AtlasDetectorID;
-class PixelID;
-class SCT_ID;
-class TRT_ID;
-
-namespace Trk  {
-  class Track;
-  class VxTrackAtVertex;
-}
-
-class IInDetAlignHitQualSelTool;
-
-namespace InDetAlignMon {
-  class TrackSelectionTool;
-}
-
-class IDAlignMonGenericTracks: public ManagedMonitorToolBase
-{
-public:
-  IDAlignMonGenericTracks(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~IDAlignMonGenericTracks();
-
-  virtual StatusCode initialize();
-  virtual StatusCode bookHistograms();
-  virtual StatusCode fillHistograms();
-  virtual StatusCode procHistograms();
-
-  void RegisterHisto(MonGroup& mon, TH1* histo);
-  void RegisterHisto(MonGroup& mon, TH2* histo);
-  void RegisterHisto(MonGroup& mon, TProfile* histo);
-
-  void ProcessAsymHistograms(TH1F* m_neg, TH1F* m_pos, TH1F* m_asym);
-  void InitializeHistograms();
-protected:
-  bool m_hasBeamCondSvc {};
-  TH1F* m_summary {};
-
-  TProfile* m_trk_chi2oDoF {};
-  TProfile* m_trk_chi2Prob {};
-
-
-
-  //Histo for self beam spot calculation
-  TH3F* m_trk_d0_vs_phi0_z0 {};
-
-  // barrel
-  TH1F* m_trk_d0_barrel {};
-  TH1F* m_trk_d0_barrel_zoomin {};
-  TH1F* m_trk_d0c_barrel {};
-  TH1F* m_trk_z0_barrel {};
-  TH1F* m_trk_z0_barrel_zoomin {};
-  TProfile* m_trk_qopT_vs_phi_barrel {};
-  TProfile* m_trk_d0_vs_phi_barrel {};
-  TProfile* m_trk_d0_vs_z0_barrel {};
-  TH1F* m_trk_phi0_neg_barrel {};
-  TH1F* m_trk_phi0_pos_barrel {};
-  TH1F* m_trk_phi0_asym_barrel {};
-  TH1F* m_trk_pT_neg_barrel {};
-  TH1F* m_trk_pT_pos_barrel {};
-  TH1F* m_trk_pT_asym_barrel {};
-  TH1F* m_npixhits_per_track_barrel {};
-  TH1F* m_nscthits_per_track_barrel {};
-  TH1F* m_ntrthits_per_track_barrel {};
-  TH1F* m_chi2oDoF_barrel {};
-  TH1F* m_phi_barrel {};
-  TH2F* m_hitMap_barrel {};
-  TH2F* m_hitMap_endcapA {};
-  TH2F* m_hitMap_endcapC {};
-
-  TH3F* m_trk_d0_vs_phi_vs_eta_barrel {};
-  TH2F* m_trk_pT_vs_eta_barrel {};
-  TH3F* m_trk_d0_wrtPV_vs_phi_vs_eta_barrel {};
-  TH3F* m_trk_z0_wrtPV_vs_phi_vs_eta_barrel {};
-
-  // endcap A
-  TH1F* m_trk_d0_eca {};
-  TH1F* m_trk_d0_eca_zoomin {};
-  TH1F* m_trk_d0c_eca {};
-  TH1F* m_trk_z0_eca {};
-  TH1F* m_trk_z0_eca_zoomin {};
-  TProfile* m_trk_qopT_vs_phi_eca {};
-  TProfile* m_trk_d0_vs_phi_eca {};
-  TProfile* m_trk_d0_vs_z0_eca {};
-  TH1F* m_trk_phi0_neg_eca {};
-  TH1F* m_trk_phi0_pos_eca {};
-  TH1F* m_trk_phi0_asym_eca {};
-  TH1F* m_trk_pT_neg_eca {};
-  TH1F* m_trk_pT_pos_eca {};
-  TH1F* m_trk_pT_asym_eca {};
-  TH1F* m_npixhits_per_track_eca {};
-  TH1F* m_nscthits_per_track_eca {};
-  TH1F* m_ntrthits_per_track_eca {};
-  TH1F* m_chi2oDoF_eca {};
-  TH1F* m_phi_eca {};
-
-  TH3F* m_trk_d0_vs_phi_vs_eta_eca {};
-  TH2F* m_trk_pT_vs_eta_eca {};
-  TH3F* m_trk_d0_wrtPV_vs_phi_vs_eta_eca {};
-  TH3F* m_trk_z0_wrtPV_vs_phi_vs_eta_eca {};
-
-
-  // endcap C
-  TH1F* m_trk_d0_ecc {};
-  TH1F* m_trk_d0_ecc_zoomin {};
-  TH1F* m_trk_d0c_ecc {};
-  TH1F* m_trk_z0_ecc {};
-  TH1F* m_trk_z0_ecc_zoomin {};
-  TProfile* m_trk_qopT_vs_phi_ecc {};
-  TProfile* m_trk_d0_vs_phi_ecc {};
-  TProfile* m_trk_d0_vs_z0_ecc {};
-  TH1F* m_trk_phi0_neg_ecc {};
-  TH1F* m_trk_phi0_pos_ecc {};
-  TH1F* m_trk_phi0_asym_ecc {};
-  TH1F* m_trk_pT_neg_ecc {};
-  TH1F* m_trk_pT_pos_ecc {};
-  TH1F* m_trk_pT_asym_ecc {};
-  TH1F* m_npixhits_per_track_ecc {};
-  TH1F* m_nscthits_per_track_ecc {};
-  TH1F* m_ntrthits_per_track_ecc {};
-  TH1F* m_chi2oDoF_ecc {};
-  TH1F* m_phi_ecc {};
-
-  TH3F* m_trk_d0_vs_phi_vs_eta_ecc {};
-  TH2F* m_trk_pT_vs_eta_ecc {};
-
-  TH3F* m_trk_d0_wrtPV_vs_phi_vs_eta_ecc {};
-  TH3F* m_trk_z0_wrtPV_vs_phi_vs_eta_ecc {};
-
-  // Whole detector
-
-
-  TH1F* m_nhits_per_event {};
-  TH1F* m_nhits_per_track {};
-  TH1F* m_ntrk {};
-  TH1F* m_ngtrk {};
-  TH1F* m_npixhits_per_track {};
-  TH1F* m_nscthits_per_track {};
-  TH1F* m_ntrthits_per_track {};
-  TH1F* m_chi2oDoF {};
-  TH1F* m_eta {};
-  TH1F* m_phi {};
-  TH1F* m_z0 {};
-  TH1F* m_z0sintheta {};
-  TH1F* m_z0_pvcorr {};
-  TH1F* m_z0sintheta_pvcorr {};
-  TH1F* m_d0 {};
-  TH1F* m_d0_pvcorr {};
-  TH1F* m_d0_bscorr {};
-  TH1F* m_trk_d0_wrtPV {};
-  TH1F* m_trk_z0_wrtPV {};
-  TH1F* m_pT {};
-  TH1F* m_pTRes {};
-  TH1F* m_pTResOverP {};
-  TH1F* m_P {};
-
-  TH3F* m_trk_d0_vs_phi_vs_eta {};
-  TH2F* m_trk_pT_vs_eta {};
-
-  TH3F* m_trk_d0_wrtPV_vs_phi_vs_eta {};
-  TH3F* m_trk_z0_wrtPV_vs_phi_vs_eta {};
-
-
-  // extended plots
-  TH2F* m_trk_PIXvSCTHits {};
-  TH2F* m_trk_PIXHitsvEta {};
-  TH2F* m_trk_SCTHitsvEta {};
-  TH2F* m_trk_TRTHitsvEta {};
-  TH2F* m_trk_chi2oDoF_Phi {};
-  TH2F* m_trk_chi2oDoF_Pt {};
-  TH2F* m_trk_chi2oDoF_P {};
-  TH1F* m_trk_chi2ProbDist {};
-  TH1F* m_errCotTheta {};
-  TH2F* m_errCotThetaVsD0BS {};
-  TH2F* m_errCotThetaVsPt {};
-  TH2F* m_errCotThetaVsP {};
-  TH2F* m_errCotThetaVsPhi {};
-  TH2F* m_errCotThetaVsEta {};
-  TH1F* m_errTheta {};
-  TH2F* m_errThetaVsD0BS {};
-  TH2F* m_errThetaVsPt {};
-  TH2F* m_errThetaVsP {};
-  TH2F* m_errThetaVsPhi {};
-  TH2F* m_errThetaVsEta {};
-  TH1F* m_errD0 {};
-  TH2F* m_errD0VsD0BS {};
-  TH2F* m_errD0VsPt {};
-  TH2F* m_errD0VsP {};
-  TH2F* m_errD0VsPhi {};
-  TH2F* m_errD0VsPhiBarrel {};
-  TH2F* m_errD0VsPhiECA {};
-  TH2F* m_errD0VsPhiECC {};
-  TH2F* m_errD0VsEta {};
-  TH1F* m_errPhi0 {};
-  TH2F* m_errPhi0VsD0BS {};
-  TH2F* m_errPhi0VsPt {};
-  TH2F* m_errPhi0VsP {};
-  TH2F* m_errPhi0VsPhi0 {};
-  TH2F* m_errPhi0VsEta {};
-  TH1F* m_errZ0 {};
-  TH2F* m_errZ0VsD0BS {};
-  TH2F* m_errZ0VsPt {};
-  TH2F* m_errZ0VsP {};
-  TH2F* m_errZ0VsPhi0 {};
-  TH2F* m_errZ0VsEta {};
-  TH1F* m_errPt {};
-  TH2F* m_PtVsPhi0Pos {};
-  TH2F* m_PtVsPhi0Neg {};
-  TH2F* m_errPtVsD0BS {};
-  TH2F* m_errPtVsPt {};
-  TH2F* m_errPtVsP {};
-  TH1F* m_errPt_Pt2 {};
-  TH2F* m_errPt_Pt2VsPt {};
-  TH2F* m_errPt_Pt2VsPhi0 {};
-  TH2F* m_errPt_Pt2VsEta {};
-  TH2F* m_errPtVsPhi0 {};
-  TH2F* m_errPtVsEta {};
-
-  TH2F* m_D0VsPhi0 {};
-  TH2F* m_Z0VsEta {};
-  TH2F* m_QoverPtVsPhi0 {};
-  TH2F* m_QoverPtVsEta {};
-  TH2F* m_QPtVsPhi0 {};
-  TH2F* m_QPtVsEta {};
-
-  //BeamSpot Plots
-
-  TH2F* m_D0bsVsPhi0 {};
-  TH2F* m_D0bsVsPhi0ECC {};
-  TH2F* m_D0bsVsPhi0ECA {};
-  TH2F* m_D0bsVsPhi0Barrel {};
-  TH2F* m_D0bsVsEta {};
-  TH2F* m_D0bsVsPt {};
-  TH2F* m_D0bsVsPtECC {};
-  TH2F* m_D0bsVsPtECA {};
-  TH2F* m_D0bsVsPtBarrel {};
-
-
-  //BeamSpot Position Plots
-
-  TH2F* m_YBs_vs_XBs {};
-  TH2F* m_YBs_vs_ZBs {};
-  TH2F* m_XBs_vs_ZBs {};
-
-  TH1F* m_XBs {};
-  TH1F* m_YBs {};
-  TH1F* m_ZBs {};
-  TH1F* m_TiltX_Bs {};
-  TH1F* m_TiltY_Bs {};
-
-  //versus lumiblock
-  TProfile* m_XBs_vs_LumiBlock {};
-  TProfile* m_YBs_vs_LumiBlock {};
-  TProfile* m_ZBs_vs_LumiBlock {};
-  TProfile* m_BeamSpotTiltX_vs_LumiBlock {};
-  TProfile* m_BeamSpotTiltY_vs_LumiBlock {};
-
-
-
-
-
-  // End of extended plots
-
-  TH1F* m_phi_barrel_pos_2_5GeV {};
-  TH1F* m_phi_barrel_pos_5_10GeV {};
-  TH1F* m_phi_barrel_pos_10_20GeV {};
-  TH1F* m_phi_barrel_pos_20plusGeV {};
-  TH1F* m_phi_barrel_neg_2_5GeV {};
-  TH1F* m_phi_barrel_neg_5_10GeV {};
-  TH1F* m_phi_barrel_neg_10_20GeV {};
-  TH1F* m_phi_barrel_neg_20plusGeV {};
-
-  TH1F* m_phi_eca_pos_2_5GeV {};
-  TH1F* m_phi_eca_pos_5_10GeV {};
-  TH1F* m_phi_eca_pos_10_20GeV {};
-  TH1F* m_phi_eca_pos_20plusGeV {};
-  TH1F* m_phi_eca_neg_2_5GeV {};
-  TH1F* m_phi_eca_neg_5_10GeV {};
-  TH1F* m_phi_eca_neg_10_20GeV {};
-  TH1F* m_phi_eca_neg_20plusGeV {};
-
-  TH1F* m_phi_ecc_pos_2_5GeV {};
-  TH1F* m_phi_ecc_pos_5_10GeV {};
-  TH1F* m_phi_ecc_pos_10_20GeV {};
-  TH1F* m_phi_ecc_pos_20plusGeV {};
-  TH1F* m_phi_ecc_neg_2_5GeV {};
-  TH1F* m_phi_ecc_neg_5_10GeV {};
-  TH1F* m_phi_ecc_neg_10_20GeV {};
-  TH1F* m_phi_ecc_neg_20plusGeV {};
-
-  TH2F* m_eta_phi_pos_2_5GeV {};
-  TH2F* m_eta_phi_pos_5_10GeV {};
-  TH2F* m_eta_phi_pos_10_20GeV {};
-  TH2F* m_eta_phi_pos_20plusGeV {};
-  TH2F* m_eta_phi_neg_2_5GeV {};
-  TH2F* m_eta_phi_neg_5_10GeV {};
-  TH2F* m_eta_phi_neg_10_20GeV {};
-  TH2F* m_eta_phi_neg_20plusGeV {};
-
-  TH1F* m_Zmumu {};
-  TH1F* m_Zmumu_barrel {};
-  TH1F* m_Zmumu_eca {};
-  TH1F* m_Zmumu_ecc {};
-  TH1F* m_Zmumu_barrel_eca {};
-  TH1F* m_Zmumu_barrel_ecc {};
-  TH1F* m_ZpT_n {};
-  TH1F* m_ZpT_p {};
-  TH1F* m_ZpT_diff {};
-
-  TH1F* m_pT_n {};
-  TH1F* m_pT_p {};
-  TH1F* m_pT_diff {};
-  TH1F* m_trk_pT_asym {};
-
-  TH1F* m_eta_neg {};
-  TH1F* m_eta_pos {};
-  TH1F* m_eta_asym {};
-
-  TH1F* m_LumiBlock {};
-  TH1F* m_Tracks_per_LumiBlock {};
-  TH1F* m_NPIX_per_LumiBlock {};
-  TH1F* m_NSCT_per_LumiBlock {};
-  TH1F* m_NTRT_per_LumiBlock {};
-
-  TH1F* m_trk_d0c_pos {};
-  TH1F* m_trk_d0c_neg {};
-  TH1F* m_trk_d0c_pos_barrel {};
-  TH1F* m_trk_d0c_neg_barrel {};
-  TH1F* m_trk_d0c_pos_eca {};
-  TH1F* m_trk_d0c_neg_eca {};
-  TH1F* m_trk_d0c_pos_ecc {};
-  TH1F* m_trk_d0c_neg_ecc {};
-  TH1F* m_trk_d0c_asym {};
-  TH1F* m_trk_d0c_asym_barrel {};
-  TH1F* m_trk_d0c_asym_eca {};
-  TH1F* m_trk_d0c_asym_ecc {};
-
-  TH1F* m_trk_z0c_pos {};
-  TH1F* m_trk_z0c_neg {};
-  TH1F* m_trk_z0c_pos_barrel {};
-  TH1F* m_trk_z0c_neg_barrel {};
-  TH1F* m_trk_z0c_pos_eca {};
-  TH1F* m_trk_z0c_neg_eca {};
-  TH1F* m_trk_z0c_pos_ecc {};
-  TH1F* m_trk_z0c_neg_ecc {};
-  TH1F* m_trk_z0c_asym {};
-  TH1F* m_trk_z0c_asym_barrel {};
-  TH1F* m_trk_z0c_asym_eca {};
-  TH1F* m_trk_z0c_asym_ecc {};
-private:
-  bool fillVertexInformation(std::map<const xAOD::TrackParticle*, const xAOD::Vertex*>& trackVertexMapTP) const;
-  static const Trk::Track* getTrkTrack(const Trk::VxTrackAtVertex*);
-  const xAOD::Vertex* findAssociatedVertexTP(const std::map<const xAOD::TrackParticle*,
-                                                            const xAOD::Vertex*>& trackVertexMapTP,
-                                             const xAOD::TrackParticle*) const;
-
-  const AtlasDetectorID* m_idHelper {};
-  const PixelID* m_pixelID {};
-  const SCT_ID* m_sctID {};
-  const TRT_ID* m_trtID {};
-
-  std::string m_stream;
-  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey {
-    this, "EventInfoKey", "EventInfo", "SG Key of EventInfo object"
-  };
-  SG::ReadHandleKey<xAOD::VertexContainer> m_VxPrimContainerName {
-    this, "VxPrimContainerName", ""
-  };
-  int m_checkrate {};
-  int m_events {};
-  int m_histosBooked {};
-  SG::ReadHandleKey<TrackCollection> m_tracksName {
-    this, "tracksName", "ExtendedTracks"
-  };
-  std::string m_triggerChainName;
-  float m_barrelEta {};
-  const xAOD::VertexContainer* m_vertices {};
-  const xAOD::Vertex* m_pvtx {};
-  bool m_doHitQuality {};
-  bool m_extendedPlots {};
-  float m_d0Range {};
-  float m_d0BsRange {};
-  int m_d0BsNbins {};
-  float m_pTRange {};
-  float m_z0Range {};
-  float m_etaRange {};
-  int m_NTracksRange {};
-  int m_rangePixHits {};
-  int m_rangeSCTHits {};
-  int m_rangeTRTHits {};
-
-  bool m_doIP {};
-
-
-
-  ToolHandle< InDetAlignMon::TrackSelectionTool > m_trackSelection;
-  ToolHandle<IInDetAlignHitQualSelTool>  m_hitQualityTool;
-  SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey {
-    this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"
-  };
-
-  ToolHandle<Trk::ITrackToVertexIPEstimator>  m_trackToVertexIPEstimatorTool;
-  ToolHandle<Trk::IExtrapolator>         m_extrapolator;    //!< track extrapolator
-
-  std::string m_Pixel_Manager;
-  std::string m_SCT_Manager;
-  std::string m_TRT_Manager;
-
-  // Weight variables
-  bool m_applyHistWeight {};
-  std::string m_hWeightInFileName;
-  TFile* m_hWeightInFile {};
-  TH2F* m_etapTWeight {};
-  std::string m_hWeightHistName;
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx
deleted file mode 100644
index 528cf059678aedbe6569c59abcae724952b66433..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx
+++ /dev/null
@@ -1,1011 +0,0 @@
-/*
-   Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// IDAlignMonNtuple.cxx
-// AUTHORS: Ben Cooper
-// **********************************************************************
-
-#include "IDAlignMonNtuple.h"
-
-
-
-
-#include "AtlasDetDescr/AtlasDetectorID.h"
-#include "InDetIdentifier/PixelID.h"
-#include "InDetIdentifier/SCT_ID.h"
-#include "InDetIdentifier/TRT_ID.h"
-
-
-#include "TrkTruthData/TrackTruth.h"
-#include "TrkToolInterfaces/ITruthToTrack.h"
-#include "InDetRIO_OnTrack/SiClusterOnTrack.h"
-#include "InDetPrepRawData/SiCluster.h"
-
-#include "AtlasHepMC/GenParticle.h"
-#include "AtlasHepMC/GenVertex.h"
-
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkEventPrimitives/LocalParameters.h"
-
-#include "TrkGeometry/MagneticFieldProperties.h"
-#include "TrkGeometry/TrackingVolume.h"
-#include "TrkGeometry/Layer.h"
-#include "TrkSurfaces/Surface.h"
-
-#include "TrkToolInterfaces/IResidualPullCalculator.h"
-#include <cmath>
-static const int s_n_maxTracks = 1500;
-static const int s_n_maxHits = 3000;
-static const int s_n_maxEventHits = 50000;
-static const int s_n_ERRORVALUE = 99999;
-
-
-// *********************************************************************
-// Public Methods
-// *********************************************************************
-
-IDAlignMonNtuple::IDAlignMonNtuple(const std::string& type, const std::string& name, const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent),
-  m_doPulls(false),
-  m_idHelper(nullptr),
-  m_pixelID(nullptr),
-  m_sctID(nullptr),
-  m_ntupleSvc(nullptr),
-  m_ntuple(nullptr) {
-  // cppcheck-suppress useInitializationList
-  m_truthToTrack = ToolHandle<Trk::ITruthToTrack>("Trk::TruthToTrack/InDetTruthToTrack");
-  // cppcheck-suppress useInitializationList
-  m_residualPullCalculator = ToolHandle<Trk::IResidualPullCalculator>(
-    "Trk::ResidualPullCalculator/ResidualPullCalculator");
-
-  declareProperty("CheckRate", m_checkrate = 1000);
-  declareProperty("TruthToTrackTool", m_truthToTrack);
-  declareProperty("TrulyUnBiasedSCT", m_unbiasedSCT = true);
-  declareProperty("UsePrepRawData", m_usePRD = false);
-  declareProperty("ResidualPullCalculatorTool", m_residualPullCalculator);
-}
-
-//---------------------------------------------------------------------------------------
-
-IDAlignMonNtuple::~IDAlignMonNtuple() = default;
-
-//---------------------------------------------------------------------------------------
-
-
-StatusCode IDAlignMonNtuple::initialize() {
-  //initialize tools and services
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Calling initialize() to setup tools/services" << endmsg;
-  StatusCode sc = setupTools();
-  if (sc.isFailure()) {
-    msg(MSG::FATAL) << "Failed to initialize tools/services!" << endmsg;
-    return StatusCode::FAILURE;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endmsg;
-
-  if (m_unbiasedSCT) msg(MSG::INFO) << "Using Truly unbiased SCT residuals" << endmsg;
-  if (m_usePRD) msg(MSG::INFO) << "Using PrepRawData for hits information" << endmsg;
-
-  ATH_CHECK(m_tracksName.initialize());
-  ATH_CHECK(m_tracksTruthName.initialize());
-  ATH_CHECK(m_VxPrimContainerName.initialize());
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonNtuple::bookHistograms() {
-  StatusCode sc;
-
-  if (newRunFlag()) {
-  }
-
-  std::string directoryStructure = "/NTUPLES/ALIGNMONITOR";
-  std::string fullNtuplePath = "/NTUPLES/ALIGNMONITOR/" + m_tracksName.key() + "/tree";
-  NTuplePtr nt(m_ntupleSvc, fullNtuplePath);
-
-  //booking m_ntuple
-  if (!nt) {       // Check if already booked
-    nt = m_ntupleSvc->book(fullNtuplePath, CLID_ColumnWiseTuple, "tree");
-    if (nt) {
-      m_ntuple = nt;
-      msg(MSG::INFO) << "Alignment monitoring m_ntuple booked." << endmsg;
-
-      //information per event
-      sc = m_ntuple->addItem("event_ntracks", m_nt_ntrks, 0, s_n_maxTracks);
-      sc = m_ntuple->addItem("event_nhits", m_nt_nhits, 0, s_n_maxEventHits);
-      sc = m_ntuple->addItem("event_nvtx", m_nt_nvtx, 0, 1000);
-      sc = m_ntuple->addItem("event_goodvtxfound", m_nt_goodvtx, 0, 1000);
-      sc = m_ntuple->addItem("event_vtxntrks", m_nt_vtxntrks, 0, s_n_maxTracks);
-      sc = m_ntuple->addItem("event_vtxX", m_nt_vtxX, -1000, 1000);
-      sc = m_ntuple->addItem("event_vtxY", m_nt_vtxY, -1000, 1000);
-      sc = m_ntuple->addItem("event_vtxZ", m_nt_vtxZ, -1000, 1000);
-
-      //information per track
-      sc = m_ntuple->addIndexedItem("track_nhits", m_nt_ntrks, m_nt_trknhits);
-      sc = m_ntuple->addIndexedItem("track_qoverpt", m_nt_ntrks, m_nt_trkqoverpt);
-      sc = m_ntuple->addIndexedItem("track_eta", m_nt_ntrks, m_nt_trketa);
-      sc = m_ntuple->addIndexedItem("track_theta", m_nt_ntrks, m_nt_trktheta);
-      sc = m_ntuple->addIndexedItem("track_phi", m_nt_ntrks, m_nt_trkphi);
-      sc = m_ntuple->addIndexedItem("track_d0", m_nt_ntrks, m_nt_trkd0);
-      sc = m_ntuple->addIndexedItem("track_z0", m_nt_ntrks, m_nt_trkz0);
-      sc = m_ntuple->addIndexedItem("track_charge", m_nt_ntrks, m_nt_trkcharge);
-      sc = m_ntuple->addIndexedItem("track_chi2", m_nt_ntrks, m_nt_trkchi2);
-      sc = m_ntuple->addIndexedItem("track_dof", m_nt_ntrks, m_nt_trkdof);
-      sc = m_ntuple->addIndexedItem("track_vtxd0", m_nt_ntrks, m_nt_trkvtxd0);
-
-      //truth information per track
-      sc = m_ntuple->addIndexedItem("track_istruth", m_nt_ntrks, m_nt_trkistruth);
-      sc = m_ntuple->addIndexedItem("track_truthprob", m_nt_ntrks, m_nt_trktruthprob);
-      sc = m_ntuple->addIndexedItem("track_truthpt", m_nt_ntrks, m_nt_trktruthpt);
-      sc = m_ntuple->addIndexedItem("track_truthphi", m_nt_ntrks, m_nt_trktruthphi);
-      sc = m_ntuple->addIndexedItem("track_trutheta", m_nt_ntrks, m_nt_trktrutheta);
-      sc = m_ntuple->addIndexedItem("track_truthpdg", m_nt_ntrks, m_nt_trktruthpdg);
-
-      sc = m_ntuple->addIndexedItem("track_truthphi0", m_nt_ntrks, m_nt_trktruthphi0);
-      sc = m_ntuple->addIndexedItem("track_truthd0", m_nt_ntrks, m_nt_trktruthd0);
-      sc = m_ntuple->addIndexedItem("track_truthz0", m_nt_ntrks, m_nt_trktruthz0);
-      sc = m_ntuple->addIndexedItem("track_trutheta0", m_nt_ntrks, m_nt_trktrutheta0);
-      sc = m_ntuple->addIndexedItem("track_truthqoverpt", m_nt_ntrks, m_nt_trktruthqoverpt);
-      sc = m_ntuple->addIndexedItem("track_truthpt0", m_nt_ntrks, m_nt_trktruthpt0);
-      sc = m_ntuple->addIndexedItem("track_truthcharge", m_nt_ntrks, m_nt_trktruthcharge);
-      sc = m_ntuple->addIndexedItem("track_truthvtxX", m_nt_ntrks, m_nt_trktruthvtxX);
-      sc = m_ntuple->addIndexedItem("track_truthvtxY", m_nt_ntrks, m_nt_trktruthvtxY);
-      sc = m_ntuple->addIndexedItem("track_truthvtxZ", m_nt_ntrks, m_nt_trktruthvtxZ);
-
-      //int max_hits = 5000;//do not make this smaller!
-
-      //information per hit per track
-      sc = m_ntuple->addItem("hit_dettype", m_nt_ntrks, m_nt_dettype, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_isbarrel", m_nt_ntrks, m_nt_isbarrel, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_layer", m_nt_ntrks, m_nt_layer, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_modphi", m_nt_ntrks, m_nt_hitmodphi, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_modeta", m_nt_ntrks, m_nt_hitmodeta, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_hitx", m_nt_ntrks, m_nt_hitx, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_hity", m_nt_ntrks, m_nt_hity, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_residualx", m_nt_ntrks, m_nt_residualx, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_residualy", m_nt_ntrks, m_nt_residualy, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_biasedresidualx", m_nt_ntrks, m_nt_biasedresidualx, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_biasedresidualy", m_nt_ntrks, m_nt_biasedresidualy, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_hittype", m_nt_ntrks, m_nt_hittype, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_errorx", m_nt_ntrks, m_nt_errorx, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_errory", m_nt_ntrks, m_nt_errory, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_hitxwidth", m_nt_ntrks, m_nt_hitxwidth, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_hitywidth", m_nt_ntrks, m_nt_hitywidth, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_hitolegwidth", m_nt_ntrks, m_nt_hitolegwidth, s_n_maxHits);
-      sc = m_ntuple->addItem("hit_incidangle", m_nt_ntrks, m_nt_hitincidangle, s_n_maxHits);
-    } else {
-      msg(MSG::ERROR) << "Failed to book Alignment monitoring m_ntuple." << endmsg;
-    }
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonNtuple::fillHistograms() {
-  //-------------------------------------------------------------
-  //looking at vertex reconstruction
-
-
-  float xv = 0.0;
-  float yv = 0.0;
-  float zv = 0.0;
-  int ntrkMax = 0;
-  int nVtx = 0;
-
-  SG::ReadHandle<VxContainer> vertices {
-    m_VxPrimContainerName
-  };
-  if (not vertices.isValid()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No Collection with name  " << m_VxPrimContainerName.key() <<
-        " found in StoreGate" << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name  " << m_VxPrimContainerName.key() <<
-      " with size " << vertices->size() << " found  in StoreGate" << endmsg;
-
-    VxContainer::const_iterator vxItr = vertices->begin();
-    VxContainer::const_iterator vxItrE = vertices->end();
-    nVtx = vertices->size();
-    for (; vxItr != vxItrE; ++vxItr) {
-      int numTracksPerVertex = (*vxItr)->vxTrackAtVertex()->size();
-      if (numTracksPerVertex > ntrkMax) {
-        ntrkMax = numTracksPerVertex;
-        xv = (*vxItr)->recVertex().position()[0];
-        yv = (*vxItr)->recVertex().position()[1];
-        zv = (*vxItr)->recVertex().position()[2];
-      }
-    }
-  }
-
-
-  if (xv == -999 || yv == -999 || zv == -999) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No vertex found => setting it to 0" << endmsg;
-    xv = 0;
-    yv = 0;
-    zv = 0;
-  }
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Best vertex (" << ntrkMax << " Tracks) x, y, z = " << xv << ", " << yv <<
-    ", " << zv << endmsg;
-
-  m_nt_nvtx = nVtx;
-  m_nt_vtxntrks = ntrkMax;
-  //these quantities are only 0,0,0 if something has gone wrong with vtx finding
-  //so we don't want these in the m_ntuple
-  if (xv != 0.0 || yv != 0.0 || zv != 0.0) {
-    m_nt_vtxX = xv;
-    m_nt_vtxY = yv;
-    m_nt_vtxZ = zv;
-    m_nt_goodvtx = 1;
-  } else {
-    m_nt_vtxX = 999;
-    m_nt_vtxY = 999;
-    m_nt_vtxZ = 999;
-    m_nt_goodvtx = 0;
-  }
-
-  //-------------------------------------------------------------
-
-  if (m_tracksName.key().empty()) msg(MSG::ERROR) << " no track collection given" << endmsg;
-
-  SG::ReadHandle<TrackCollection> tracks {
-    m_tracksName
-  };
-  if (not tracks.isValid()) {
-    msg(MSG::ERROR) << "No TrackCollection with name " << m_tracksName.key() << " found in StoreGate" << endmsg;
-    return StatusCode::RECOVERABLE;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name " << m_tracksName.key() << " found in StoreGate" << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved " << tracks->size() << " reconstructed tracks from StoreGate" << endmsg;
-  }
-
-  SG::ReadHandle<TrackTruthCollection> truthMap {
-    m_tracksTruthName
-  };
-  if (not truthMap.isValid()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackTruthCollection with name " << m_tracksTruthName.key() << " found in StoreGate" << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Truth information will not be filled in the AlignMonNtuple" << endmsg;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name " << m_tracksTruthName.key() << " found in StoreGate" << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved " << truthMap->size() << " truth tracks from StoreGate" << endmsg;
-  }
-
-
-  int nTracks = 0;
-  int nHitsEvent = 0;
-
-  TrackCollection::const_iterator trackItr = tracks->begin();
-  TrackCollection::const_iterator trackItrE = tracks->end();
-
-  for (; trackItr != trackItrE && nTracks < s_n_maxTracks; ++trackItr) { //looping over tracks
-    //need to get the Trk::Track object from which the TrackParticle object was created
-    //this has the hit information
-
-    //const Trk::Track* track = (*trackItr)->originalTrack();
-    const Trk::Track* track = *trackItr;
-    if (track == nullptr) {
-      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track " << nTracks << endmsg;
-      continue;
-    }
-
-    //sets all track m_ntuple variables to error values
-    //variables will be overwritten later if can be defined
-    setTrackErrorValues(nTracks);
-
-    //trackStateOnSurfaces is a vector of Trk::TrackStateOnSurface objects which contain information
-    //on track at each (inner)detector surface it crosses eg hit used to fit track
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Track = " << nTracks << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found " << track->trackStateOnSurfaces()->size() << " TrkSurfaces " << endmsg;
-
-    int nHits = 0;
-
-    //looping over the 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;
-      float errorX = s_n_ERRORVALUE;
-      float errorY = s_n_ERRORVALUE;
-      float hitX = s_n_ERRORVALUE;
-      float hitY = s_n_ERRORVALUE;
-      int detType = s_n_ERRORVALUE;
-      int barrelEC = s_n_ERRORVALUE;
-      int layerDisk = s_n_ERRORVALUE;
-      int modEta = s_n_ERRORVALUE;
-      int modPhi = s_n_ERRORVALUE;
-      int hitType = s_n_ERRORVALUE;
-      int phiWidth = s_n_ERRORVALUE;
-      int zWidth = s_n_ERRORVALUE;
-      int olegWidth = s_n_ERRORVALUE;
-      float trkIncidAngle = s_n_ERRORVALUE;
-
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TSOS (hit) = " << nHits << endmsg;
-
-      if (tsos == nullptr) continue;
-
-      //determining type of TSOS object - can represent many different track elements
-      if (tsos->type(Trk::TrackStateOnSurface::Measurement)) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Measurement" << endmsg;
-        hitType = 0;
-      } else if (tsos->type(Trk::TrackStateOnSurface::InertMaterial)) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::InertMaterial" << endmsg;
-        hitType = 1;
-      } else if (tsos->type(Trk::TrackStateOnSurface::BremPoint)) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::BremPoint" << endmsg;
-        hitType = 2;
-      } else if (tsos->type(Trk::TrackStateOnSurface::Scatterer)) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Scatterer" << endmsg;
-        hitType = 3;
-      } else if (tsos->type(Trk::TrackStateOnSurface::Perigee)) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Perigee" << endmsg;
-        hitType = 4;
-      } else if (tsos->type(Trk::TrackStateOnSurface::Outlier)) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Outlier" << endmsg;
-        hitType = 5;
-      } else if (tsos->type(Trk::TrackStateOnSurface::Hole)) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Hole" << endmsg;
-        hitType = 6;
-      } 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 = 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
-      const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(mesh);
-
-      if (hit == nullptr) {
-        //for some reason the first tsos has no associated hit - maybe because this contains the defining parameters?
-        if (nHits > 0) if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No hit associated with TrkSurface - probably a hole" << nHits << endmsg;
-        continue;
-      }
-
-      //if desired we can use PrepRawData hits information i.e. before insitu calibration of hits
-      const InDet::SiCluster* hitPRD;
-      if (m_usePRD) {
-        hitPRD = dynamic_cast <const InDet::SiCluster*>(hit->prepRawData());
-      } else {
-        hitPRD = nullptr;
-      }
-
-      const Identifier& hitId = hit->identify();
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined  hit Identifier " << endmsg;
-      if (m_idHelper->is_pixel(hitId)) {
-        detType = 0;
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "This is a Pixel Hit" << endmsg;
-      }
-      if (m_idHelper->is_sct(hitId)) {
-        detType = 1;
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "This is an SCT Hit" << endmsg;
-      }
-      if (m_idHelper->is_trt(hitId)) {
-        detType = 2;
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "This is a TRT Hit" << endmsg;
-      }
-
-      //finding local error on hit
-      if (m_usePRD && hitPRD != nullptr) {
-        errorX = Amg::error(hitPRD->localCovariance(), Trk::locX);
-        errorY = Amg::error(hitPRD->localCovariance(), Trk::locY);
-      } else {
-        errorX = Amg::error(hit->localCovariance(), Trk::locX);
-        errorY = Amg::error(hit->localCovariance(), Trk::locY);
-      }
-
-      if (detType == 0) {//getting pixel hit information
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " This is a PIXEL hit " << hitId << endmsg;
-        const Identifier& id = m_pixelID->wafer_id(hitId);
-
-        barrelEC = m_pixelID->barrel_ec(id);
-        layerDisk = m_pixelID->layer_disk(id);
-        modEta = m_pixelID->eta_module(id);
-        modPhi = m_pixelID->phi_module(id);
-
-        const InDet::SiCluster* pCluster = dynamic_cast <const InDet::SiCluster*>(hit->prepRawData());
-        if (pCluster != nullptr) {
-          const InDet::SiWidth& width = pCluster->width();
-          phiWidth = int(width.colRow().x());
-          zWidth = int(width.colRow().y());
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Pixel hit phi cluster width = " << phiWidth << endmsg;
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Pixel hit z cluster width = " << zWidth << endmsg;
-        }
-      }
-
-
-      if (detType == 1) {//getting SCT hit information
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " This is an SCT hit " << hitId << endmsg;
-        const Identifier& id = m_sctID->wafer_id(hitId);
-
-        barrelEC = m_sctID->barrel_ec(id);
-        layerDisk = m_sctID->layer_disk(id);
-        modEta = m_sctID->eta_module(id);
-        modPhi = m_sctID->phi_module(id);
-
-        const InDet::SiCluster* pCluster = dynamic_cast <const InDet::SiCluster*>(hit->prepRawData());
-        if (pCluster != nullptr) {
-          const InDet::SiWidth& width = pCluster->width();
-          phiWidth = int(width.colRow().x());
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "SCT hit phi cluster width = " << phiWidth << endmsg;
-        }
-      }
-
-      if (detType == 0 || detType == 1) {//have identified pixel or SCT hit
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is pixel or SCT, finding residuals... " << endmsg;
-
-        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();
-        olegWidth = idVec.size();
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Oleg Si clusterSize = " << olegWidth << endmsg;
-
-        //finding residuals
-        if (trackParameter) {
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found Trk::TrackParameters" << endmsg;
-
-          //finding track incidence angle (taken from InDetAlignTools/InDetAlignHitQualSelectTool)
-          const InDetDD::SiDetectorElement* detEle = dynamic_cast<const InDetDD::SiDetectorElement*>(hit->detectorElement());
-
-          if (detEle != nullptr) {
-            Amg::Vector3D trkDir = trackParameter->momentum();
-            const Amg::Vector3D& detElePhi = detEle->phiAxis(); //!< local x axis in global frame
-            const Amg::Vector3D& detEleNormal = detEle->normal(); //!< local z axis in global frame
-            double trkDotPhi = trkDir.dot(detElePhi); //!< scalar product
-            double trkDotNormal = trkDir.dot(detEleNormal);
-            trkIncidAngle = (float) atan(trkDotPhi / trkDotNormal);
-          }
-          if (m_usePRD && hitPRD != nullptr) {
-            hitX = hitPRD->localPosition().x();
-            hitY = hitPRD->localPosition().y();
-          } else {
-            hitX = hit->localParameters()[Trk::locX];
-            hitY = hit->localParameters()[Trk::locY];
-          }
-
-          double unbiasedResXY[4] = {
-            9999.0, 9999.0, 9999.0, 9999.0
-          };
-          double biasedResXY[4] = {
-            9999.0, 9999.0, 9999.0, 9999.0
-          };
-
-          //finding unbiased single residuals
-          StatusCode sc;
-          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;
-            continue;
-          } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "unbiased residuals found ok" << endmsg;
-          residualX = (float) unbiasedResXY[0];
-          residualY = (float) unbiasedResXY[1];
-//    float pullX = (float)unbiasedResXY[2];
-//    float pullY = (float)unbiasedResXY[3];
-
-
-          //finding biased single residuals (for interest)
-          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;
-            continue;
-          } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "biased residuals found ok" << endmsg;
-          biasedResidualX = biasedResXY[0];
-          biasedResidualY = biasedResXY[1];
-        } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackParameters associated with TrkSurface " << nHits << ", hit type = " << hitType << endmsg;
-      }
-
-      //filling m_ntuple
-      m_nt_hittype[nTracks][nHits] = hitType;
-      m_nt_dettype[nTracks][nHits] = detType;
-      m_nt_isbarrel[nTracks][nHits] = barrelEC;
-      m_nt_layer[nTracks][nHits] = layerDisk;
-      m_nt_hitmodphi[nTracks][nHits] = modPhi;
-      m_nt_hitmodeta[nTracks][nHits] = modEta;
-      m_nt_hitx[nTracks][nHits] = hitX;
-      m_nt_hity[nTracks][nHits] = hitY;
-      m_nt_residualx[nTracks][nHits] = residualX;
-      m_nt_residualy[nTracks][nHits] = residualY;
-      m_nt_biasedresidualx[nTracks][nHits] = biasedResidualX;
-      m_nt_biasedresidualy[nTracks][nHits] = biasedResidualY;
-      m_nt_errorx[nTracks][nHits] = errorX;
-      m_nt_errory[nTracks][nHits] = errorY;
-      m_nt_hitxwidth[nTracks][nHits] = phiWidth;
-      m_nt_hitywidth[nTracks][nHits] = zWidth;
-      m_nt_hitolegwidth[nTracks][nHits] = olegWidth;
-      m_nt_hitincidangle[nTracks][nHits] = trkIncidAngle;
-
-      nHits++;
-      nHitsEvent++;
-    }//end of loop on track surfaces
-
-    //bounds checking
-    if (nHits >= s_n_maxHits) {
-      msg(MSG::ERROR) << "WATCH OUT: There are more HITS in this events than fit in the ntuples hits matrix!" << endmsg;
-      msg(MSG::ERROR) << "Set max hits per track = " << s_n_maxHits << ", current track has " << nHits << " or more hits!" << endmsg;
-      return StatusCode::FAILURE;
-    }
-
-    m_nt_trknhits[nTracks] = nHits;
-
-    //filling m_ntuple with some track parameters
-    const Trk::Perigee* startPerigee = track->perigeeParameters();
-    float theta = startPerigee->parameters()[Trk::theta];
-    float d0 = startPerigee->parameters()[Trk::d0];
-    float phi0 = startPerigee->parameters()[Trk::phi0];
-    m_nt_trktheta[nTracks] = theta;
-    m_nt_trkqoverpt[nTracks] = startPerigee->parameters()[Trk::qOverP] / sin(theta);
-    m_nt_trketa[nTracks] = startPerigee->eta();
-    m_nt_trkphi[nTracks] = phi0;
-    m_nt_trkd0[nTracks] = d0;
-    m_nt_trkz0[nTracks] = startPerigee->parameters()[Trk::z0];
-    m_nt_trkcharge[nTracks] = startPerigee->charge();
-
-    //finding d0 wrt the primary vertex if one is well-defined
-    if (xv != 0.0 || yv != 0.0 || zv != 0.0) {
-      //if we found a decent vertex
-      float d0wrtVtx = d0 - (yv * cos(phi0) - xv * sin(phi0));
-      m_nt_trkvtxd0[nTracks] = d0wrtVtx;
-    } else m_nt_trkvtxd0[nTracks] = 999;
-
-    const Trk::FitQuality* fit = track->fitQuality();
-    float chiSquared = (fit) ? fit->chiSquared() : -1.;
-    int DoF = (fit) ? fit->numberDoF() : -1;
-    m_nt_trkchi2[nTracks] = chiSquared;
-    m_nt_trkdof[nTracks] = DoF;
-
-
-    //tracktruth stuff (put in separate method)
-    if (truthMap.get()) {
-      //the key for the truth std::map is an ElementLink<TrackCollection> object
-      //comprises a pointer to the track and reconstructed track collection
-      ElementLink<TrackCollection> trackLink;
-      trackLink.setElement(track);
-      trackLink.setStorableObject(*tracks);
-      const ElementLink<TrackCollection> trackLink2 = trackLink;
-
-      //trying to find the std::map entry for this reconstructed track
-      TrackTruthCollection::const_iterator found = truthMap->find(trackLink2);
-
-      if (found != truthMap->end()) {
-        TrackTruth trkTruth = found->second;//getting the TrackTruth object - the map element
-        float trkTruthProb = trkTruth.probability();//probability of the reco<->truth match
-        const HepMcParticleLink& HMPL = trkTruth.particleLink();
-
-        if (HMPL.isValid()) {
-#ifdef HEPMC3
-          HepMC::ConstGenParticlePtr genParticle = HMPL.scptr();
-#else
-          const HepMC::GenParticle* genParticle = HMPL.cptr();
-#endif
-
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " Particle with PDG " << genParticle->pdg_id() << " Status " << genParticle->status() << " mass " << genParticle->momentum().m() << " pt " << genParticle->momentum().perp() << " eta " << genParticle->momentum().eta() << " phi " << genParticle->momentum().phi() << endmsg;
-
-          m_nt_trkistruth[nTracks] = 1;
-          m_nt_trktruthpdg[nTracks] = genParticle->pdg_id();
-          m_nt_trktruthprob[nTracks] = trkTruthProb;
-          float pX = genParticle->momentum().px();
-          float pY = genParticle->momentum().py();
-          float genParticlePt = sqrt((pX * pX) + (pY * pY));
-          m_nt_trktruthpt[nTracks] = genParticlePt;
-          m_nt_trktrutheta[nTracks] = genParticle->momentum().eta();
-          m_nt_trktruthphi[nTracks] = genParticle->momentum().phi();
-
-
-          if (genParticle->pdg_id() == 0) {
-            if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Particle with PDG 0!" << endmsg;
-          } else if (!genParticle->production_vertex()) {
-            if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No GenVertex (generator level) production vertex found!" << endmsg;
-          } else {
-            //currently cannot configure the TruthToTrack tool properly
-
-            const Trk::TrackParameters* generatedTrackPerigee = m_truthToTrack->makePerigeeParameters(genParticle);
-
-            if (!generatedTrackPerigee) if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to extrapolate genParticle to perigee!" << endmsg;
-
-            if (generatedTrackPerigee) {
-              float phi0 = generatedTrackPerigee->parameters()[Trk::phi0];
-              float d0 = generatedTrackPerigee->parameters()[Trk::d0];
-              float z0 = generatedTrackPerigee->parameters()[Trk::z0];
-              float theta = generatedTrackPerigee->parameters()[Trk::theta];
-              float eta = generatedTrackPerigee->eta();
-              float charge = generatedTrackPerigee->charge();
-              float qoverpt = generatedTrackPerigee->parameters()[Trk::qOverP] / (sin(theta));
-              float pt = (1 / qoverpt) * (charge);
-
-              if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Extrapolated genParticle perigee parameters: q/Pt = " << qoverpt << " d0 = " << d0 << " z0 = " << z0 << " phi0 = " << phi0 << " pt = " << pt << endmsg;
-
-              m_nt_trktruthphi0[nTracks] = phi0;
-              m_nt_trktruthd0[nTracks] = d0;
-              m_nt_trktruthz0[nTracks] = z0;
-              m_nt_trktrutheta0[nTracks] = eta;
-              m_nt_trktruthqoverpt[nTracks] = qoverpt;
-              m_nt_trktruthpt0[nTracks] = pt;
-              m_nt_trktruthcharge[nTracks] = charge;
-              m_nt_trktruthvtxX[nTracks] = genParticle->production_vertex()->position().x();
-              m_nt_trktruthvtxY[nTracks] = genParticle->production_vertex()->position().y();
-              m_nt_trktruthvtxZ[nTracks] = genParticle->production_vertex()->position().z();
-
-              delete  generatedTrackPerigee;
-            }
-          }
-        }
-      }
-    }
-
-    nTracks++;
-  } // end of loop on tracks
-
-  //bounds checking
-  if (nTracks >= s_n_maxTracks) {
-    msg(MSG::ERROR) << "WATCH OUT: There are more TRACKS in this events than fit in the m_ntuple tracks matrix!" << endmsg;
-    msg(MSG::ERROR) << "Set max tracks per event = " << s_n_maxTracks << ", current event has " << nTracks << " or more tracks!" << endmsg;
-    return StatusCode::FAILURE;
-  } else m_nt_ntrks = nTracks;
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of tracks : " << nTracks << endmsg;
-
-  //bounds checking
-  if (nHitsEvent >= s_n_maxEventHits) {
-    msg(MSG::ERROR) << "WATCH OUT: There are more EVENTHITS in this event than fit in the ntuples eventhits!" << endmsg;
-    msg(MSG::ERROR) << "Set max hits per event = " << s_n_maxEventHits << ", current event has " << nHitsEvent << " or more hits!" << endmsg;
-    return StatusCode::FAILURE;
-  } else m_nt_nhits = nHitsEvent;
-
-  //write the m_ntuple record
-  if (!(m_ntupleSvc->writeRecord(m_ntuple)).isSuccess()) {
-    msg(MSG::ERROR) << "problems writing m_ntuple record" << endmsg;
-  }
-
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonNtuple::procHistograms() {
-  return StatusCode::SUCCESS;
-}
-
-//__________________________________________________________________________
-StatusCode IDAlignMonNtuple::getSiResiduals(const Trk::Track* track, const Trk::TrackStateOnSurface* tsos, bool unBias, double* results) {
-  if (!m_doPulls) return StatusCode::FAILURE;
-
-  StatusCode sc = StatusCode::SUCCESS;
-
-  double residualX = -9999.0;
-  double residualY = -9999.0;
-  double pullX = -9999.0;
-  double pullY = -9999.0;
-
-  //extract the hit object from the tsos
-  const Trk::MeasurementBase* mesh = tsos->measurementOnTrack();
-  const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(mesh);
-
-  //get the unbiased track parameters (can fail if no MeasuredTrackParameters exists)
-  const Trk::TrackParameters* trackParameterUnbiased = nullptr;
-  if (unBias) trackParameterUnbiased = getUnbiasedTrackParameters(track, tsos);
-
-  //updator can fail in defining unbiased parameters, in which case we use biased
-  const Trk::TrackParameters* trackParameterForResiduals = nullptr;
-  if (trackParameterUnbiased) trackParameterForResiduals = trackParameterUnbiased;
-  else {
-    //use the original biased track parameters
-    trackParameterForResiduals = tsos->trackParameters();
-  }
-
-  if (!m_residualPullCalculator.empty() && !m_residualPullCalculator.retrieve().isFailure()) {
-    if (hit && trackParameterForResiduals) {
-      ATH_MSG_DEBUG(" got hit and track parameters ");
-
-      std::optional<Trk::ResidualPull> residualPull = std::nullopt;
-      if (unBias) {
-        residualPull = m_residualPullCalculator->residualPull(mesh, trackParameterForResiduals, Trk::ResidualPull::Unbiased);
-      }
-      else {
-        residualPull = m_residualPullCalculator->residualPull(mesh, trackParameterForResiduals, Trk::ResidualPull::Biased);
-      }
-
-      ATH_MSG_DEBUG( " got hit and track parameters...done ");
-      if (residualPull) {
-        residualX = residualPull->residual()[Trk::loc1];
-        if (residualPull->residual().size()>1) {
-          residualY = residualPull->residual()[Trk::loc2];
-        }
-        ATH_MSG_DEBUG(" got residual pull ");
-        if (residualPull->isPullValid()&& !residualPull->pull().empty()) {
-          pullX = residualPull->pull()[Trk::loc1];
-          if (residualPull->pull().size()>1) {
-            pullY = residualPull->pull()[Trk::loc2];
-          }
-        }
-        else {
-          ATH_MSG_DEBUG("ResidualPullCalculator finds invalid Pull!!!");
-          sc = StatusCode::FAILURE;
-        }
-      } else {
-        ATH_MSG_DEBUG("ResidualPullCalculator failed!");
-        sc = StatusCode::FAILURE;
-      }
-    }
-  }
-
-  // for SCT modules the residual pull calculator only finds the (rotated) Rphi residual
-  // for each of the SCT sides; residualPull->dimension()==1 always.
-
-  results[0] = residualX;
-  results[1] = residualY;
-  results[2] = pullX;
-  results[3] = pullY;
-
-  if (pullX != pullX || pullY != pullY) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator finds Pull=NAN!!!" << endmsg;
-    sc = StatusCode::FAILURE;
-  }
-
-  //delete these TrackParameters which are newly created in the getUnbiasedTrackParameters(track,tsos) method
-  delete trackParameterUnbiased;
-
-  return sc;
-}
-
-//__________________________________________________________________________
-const Trk::TrackParameters*
-IDAlignMonNtuple::getUnbiasedTrackParameters(const Trk::Track* trkPnt, const Trk::TrackStateOnSurface* tsos) {
-  const Trk::TrackParameters* TrackParams{};
-  //const Trk::TrackParameters* UnbiasedTrackParams(nullptr);
-  std::unique_ptr< Trk::TrackParameters> propagatedTrackParams{};
-  std::unique_ptr<const Trk::TrackParameters> otherSideUnbiasedTrackParams{};
-
-  //controls if the SCT residuals will be 'truly' unbiased - removing also the opposite side hit.
-  bool trueUnbiased = true;
-
-  Identifier surfaceID;
-
-
-  ATH_MSG_VERBOSE( "original track parameters: " << *(tsos->trackParameters()) );
-
-
-  ATH_MSG_VERBOSE( "Trying to unbias track parameters." );
-  if (not tsos->measurementOnTrack()->type(Trk::MeasurementBaseType::RIO_OnTrack)) return nullptr;
-  const Trk::RIO_OnTrack* hitOnTrack = static_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
-
-  //if (hitOnTrack == nullptr) return nullptr;
-
-
-  surfaceID = hitOnTrack->identify();
-  // if SCT Hit and TrueUnbiased then remove other side hit first
-  if (trueUnbiased && m_idHelper->is_sct(surfaceID)) {  //there's no TrueUnbiased for non-SCT (pixel) hits)
-    ATH_MSG_VERBOSE( "Entering True Unbiased loop.");
-    // check if other module side was also hit and try to remove other hit as well
-    const Trk::TrackStateOnSurface* otherModuleSideHit(nullptr);
-    const Identifier waferID = m_sctID->wafer_id(surfaceID);
-    const IdentifierHash waferHash = m_sctID->wafer_hash(waferID);
-    const IdentifierHash otherSideHash = m_sctID->get_other_side(waferHash);
-    const Identifier otherModuleSideID = m_sctID->wafer_id(otherSideHash);
-
-    for (const Trk::TrackStateOnSurface* TempTsos : *trkPnt->trackStateOnSurfaces()) {
-      if (not TempTsos->measurementOnTrack()->type(Trk::MeasurementBaseType::RIO_OnTrack)) continue;
-      const Trk::RIO_OnTrack* hitOnTrack = static_cast <const Trk::RIO_OnTrack*>(TempTsos->measurementOnTrack());
-      const Identifier& trkID = hitOnTrack->identify();
-      if (m_sctID->wafer_id(trkID) == otherModuleSideID) {
-        ATH_MSG_VERBOSE( "True unbiased residual. Removing OtherModuleSide Hit " << m_idHelper->show_to_string(otherModuleSideID, nullptr, '/') );
-        otherModuleSideHit = TempTsos;
-      }
-    }
-
-    if (otherModuleSideHit) {
-      const Trk::TrackParameters* OMSHmeasuredTrackParameter = otherModuleSideHit->trackParameters();//otherModuleSideHit owns these parameters
-
-      // check that the hit on the other module side has measuredtrackparameters, otherwise it cannot be removed from
-      // the track
-      const AmgSymMatrix(5) * covariance = OMSHmeasuredTrackParameter->covariance();
-      if (covariance) {
-        ATH_MSG_VERBOSE( "OtherSideTrackParameters: " << *(otherModuleSideHit->trackParameters()) );
-        otherSideUnbiasedTrackParams =
-          m_iUpdator->removeFromState(
-          *(otherModuleSideHit->trackParameters()),
-          otherModuleSideHit->measurementOnTrack()->localParameters(),
-          otherModuleSideHit->measurementOnTrack()->localCovariance());
-         //we own these track parameters here
-
-        if (otherSideUnbiasedTrackParams) {
-          ATH_MSG_VERBOSE("Unbiased OtherSideTrackParameters: " << *otherSideUnbiasedTrackParams );
-
-
-          const Trk::Surface& TempSurface = otherModuleSideHit->measurementOnTrack()->associatedSurface();
-
-          const Trk::MagneticFieldProperties* TempField = nullptr;
-
-
-          ATH_MSG_VERBOSE( "After OtherSide surface call. Surface exists" );
-          if (TempSurface.associatedLayer()) {
-            ATH_MSG_VERBOSE( "TempSurface->associatedLayer() exists" );
-            if (TempSurface.associatedLayer()->enclosingTrackingVolume()) {
-              ATH_MSG_VERBOSE( "TempSurface->associatedLayer()->enclosingTrackingVolume exists" );
-
-              TempField = dynamic_cast <const Trk::MagneticFieldProperties*>(TempSurface.associatedLayer()->enclosingTrackingVolume());
-              ATH_MSG_VERBOSE( "After MagneticFieldProperties cast" );
-            } else {
-              ATH_MSG_VERBOSE( "TempSurface->associatedLayer()->enclosingTrackingVolume does not exist" );
-            }
-          } else {
-            ATH_MSG_VERBOSE( "TempSurface->associatedLayer() does not exist" );
-          }
-          ATH_MSG_VERBOSE( "Before other side unbiased propagation" );
-          if (TempSurface.associatedLayer() && TempField) propagatedTrackParams = m_propagator->propagate(
-            Gaudi::Hive::currentContext(),
-            *otherSideUnbiasedTrackParams,
-            tsos->measurementOnTrack()->associatedSurface(),
-            Trk::anyDirection, false,
-            *TempField,
-            Trk::nonInteracting);
-
-          ATH_MSG_VERBOSE( "After other side unbiased propagation" );
-
-          if (propagatedTrackParams) {
-            ATH_MSG_VERBOSE( "Propagated Track Parameters: " << *propagatedTrackParams );
-          } else {
-            ATH_MSG_WARNING( "Propagation of unbiased OtherSideParameters failed" );
-          }
-        } else {
-          ATH_MSG_DEBUG( "RemoveFromState did not work for OtherSideParameters" );
-        }
-      } else {
-         ATH_MSG_VERBOSE( "No otherModuleSideHit Measured Track Parameters found. Covariance Null" );
-      }
-    } else {
-       ATH_MSG_VERBOSE( "No otherModuleSideHit found" );
-    }
-  }
-
-  // if propagation failed or no TrueUnbiased or no SCT then use original TrackParams
-  if (!propagatedTrackParams) {
-    propagatedTrackParams = tsos->trackParameters()->uniqueClone();
-  }
-
-  auto unbiasedTrackParams =
-    m_iUpdator->removeFromState(*propagatedTrackParams,
-                       tsos->measurementOnTrack()->localParameters(),
-                       tsos->measurementOnTrack()->localCovariance());
-  if (unbiasedTrackParams) {
-    ATH_MSG_VERBOSE( "Unbiased residual. Removing original Hit " << m_idHelper->show_to_string(surfaceID, nullptr, '/') );
-    ATH_MSG_VERBOSE( "Unbiased Trackparameters: " << *unbiasedTrackParams );
-
-    TrackParams = unbiasedTrackParams->clone();
-  } else { // Unbiasing went awry.
-    ATH_MSG_WARNING( "RemoveFromState did not work, using original TrackParameters" );
-    TrackParams = tsos->trackParameters()->clone();
-  }
-  return TrackParams; //we hand back ownership, in fact
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonNtuple::setupTools() {
-  //initializing tools
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In initialize()" << endmsg;
-
-  StatusCode sc;
-
-  sc = service("NTupleSvc", m_ntupleSvc);
-  if (sc.isFailure()) {
-    msg(MSG::FATAL) << "Cannot retrieve the NTuple service... Exiting" << endmsg;
-    return StatusCode::FAILURE;
-  }
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined detector service" << endmsg;
-
-  sc = detStore()->retrieve(m_pixelID, "PixelID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get Pixel ID helper !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized PixelIDHelper" << endmsg;
-
-  sc = detStore()->retrieve(m_sctID, "SCT_ID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get SCT ID helper !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTIDHelper" << endmsg;
-
-  //ID Helper
-  sc = detStore()->retrieve(m_idHelper, "AtlasID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get AtlasDetectorID !" << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found AtlasDetectorID" << endmsg;
-  }
-
-
-  if (m_iUpdator.retrieve().isFailure()) {
-    msg(MSG::FATAL) << "Failed to retrieve tool " << m_iUpdator << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_iUpdator << endmsg;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved IUpdator" << endmsg;
-
-
-  if (m_propagator.retrieve().isFailure()) {
-    msg(MSG::FATAL) << "Can not retrieve Propagator tool of type "
-                    << m_propagator.typeAndName() << endmsg;
-    return StatusCode::FAILURE;
-  } else msg(MSG::INFO) << "Retrieved tool " << m_propagator.typeAndName() << endmsg;
-
-  if (m_truthToTrack.retrieve().isFailure()) {
-    msg(MSG::FATAL) << "Failed to retrieve tool " << m_truthToTrack << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_truthToTrack << endmsg;
-  }
-
-  if (m_residualPullCalculator.empty()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
-        "No residual/pull calculator for general hit residuals configured."
-                                            << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
-        "It is recommended to give R/P calculators to the det-specific tool"
-                                            << " handle lists then." << endmsg;
-    m_doPulls = false;
-  } else if (m_residualPullCalculator.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not retrieve " << m_residualPullCalculator
-                                                << " (to calculate residuals and pulls) " << endmsg;
-    m_doPulls = false;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)
-        << "Generic hit residuals&pulls will be calculated in one or both "
-        << "available local coordinates" << endmsg;
-    m_doPulls = true;
-  }
-
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-void IDAlignMonNtuple::setTrackErrorValues(int nTracks) {
-  //for each track ensures that the variable is set to
-  //a defined errorvalue in case it can't be defined
-
-  m_nt_trknhits[nTracks] = s_n_ERRORVALUE;
-
-  m_nt_trktheta[nTracks] = s_n_ERRORVALUE;
-  m_nt_trkqoverpt[nTracks] = s_n_ERRORVALUE;
-  m_nt_trketa[nTracks] = s_n_ERRORVALUE;
-  m_nt_trkphi[nTracks] = s_n_ERRORVALUE;
-  m_nt_trkd0[nTracks] = s_n_ERRORVALUE;
-  m_nt_trkz0[nTracks] = s_n_ERRORVALUE;
-  m_nt_trkcharge[nTracks] = s_n_ERRORVALUE;
-  m_nt_trkvtxd0[nTracks] = s_n_ERRORVALUE;
-  m_nt_trkchi2[nTracks] = s_n_ERRORVALUE;
-  m_nt_trkdof[nTracks] = s_n_ERRORVALUE;
-
-  m_nt_trkistruth[nTracks] = 0;//will be set to one if find a truth
-  m_nt_trktruthpdg[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthprob[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthpt[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktrutheta[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthphi[nTracks] = s_n_ERRORVALUE;
-
-  m_nt_trktruthphi0[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthd0[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthz0[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktrutheta0[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthqoverpt[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthpt0[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthcharge[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthvtxX[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthvtxY[nTracks] = s_n_ERRORVALUE;
-  m_nt_trktruthvtxZ[nTracks] = s_n_ERRORVALUE;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.h
deleted file mode 100644
index 0a81b0d34166c4b21358c808e1f5d0e1709be0bf..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef IDAlignMonNtuple_H
-#define IDAlignMonNtuple_H
-
-// **********************************************************************
-// IDAlignMonNtuple.h
-// AUTHORS: Ben Cooper
-// **********************************************************************
-
-#include "TrkExInterfaces/IPropagator.h"
-#include "TrkToolInterfaces/IUpdator.h"
-#include <vector>
-
-#include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/NTuple.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "EventPrimitives/EventPrimitivesHelpers.h"
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "TrkParameters/TrackParameters.h"
-#include "TrkTrack/TrackCollection.h"
-#include "TrkTruthData/TrackTruthCollection.h"
-#include "VxVertex/VxContainer.h"
-
-class AtlasDetectorID;
-class PixelID;
-class SCT_ID;
-
-namespace Trk {
-  class RIO_OnTrack;
-  class Track;
-  class TrackStateOnSurface;
-  class ITruthToTrack;
-  class IResidualPullCalculator;
-}
-
-class IDAlignMonNtuple: public ManagedMonitorToolBase
-{
-public:
-  IDAlignMonNtuple(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~IDAlignMonNtuple();
-
-  virtual StatusCode initialize();
-  virtual StatusCode bookHistograms();
-  virtual StatusCode fillHistograms();
-  virtual StatusCode procHistograms();
-protected:
-private:
-  StatusCode setupTools();
-  void setTrackErrorValues(int);
-
-  const Trk::TrackParameters* getUnbiasedTrackParameters(const Trk::Track*, const Trk::TrackStateOnSurface*);
-  StatusCode getSiResiduals(const Trk::Track*, const Trk::TrackStateOnSurface*, bool, double*);
-
-  std::string m_stream;
-  SG::ReadHandleKey<TrackCollection> m_tracksName {
-    this, "tracksName", "ExtendedTracks"
-  };
-  SG::ReadHandleKey<TrackTruthCollection> m_tracksTruthName {
-    this, "tracksTruthName", "ExtendedTracksTruthCollection"
-  };
-  int m_checkrate{};
-  bool m_unbiasedSCT{};
-  bool m_usePRD{};  //if desired we can use PrepRawData hits information i.e. before insitu calibration of hits
-  bool m_doPulls{};
-  SG::ReadHandleKey<VxContainer> m_VxPrimContainerName {
-    this, "VxPrimContainerName", ""
-  };
-
-  //tools
-  const AtlasDetectorID* m_idHelper{};
-  const PixelID* m_pixelID{};
-  const SCT_ID* m_sctID{};
-  PublicToolHandle<Trk::IUpdator>             m_iUpdator
-  {
-    this, "KalmanUpdator", "Trk::KalmanUpdator", ""
-  };
-  PublicToolHandle<Trk::IPropagator>          m_propagator
-  {
-    this, "RungeKuttaPropagator", "Trk::RungeKuttaPropagator", ""
-  };
-  ToolHandle<Trk::ITruthToTrack>        m_truthToTrack;
-  ToolHandle<Trk::IResidualPullCalculator>    m_residualPullCalculator;   //!< The residual and pull calculator tool
-                                                                          // handle
-  INTupleSvc* m_ntupleSvc;
-
-
-  //Ntuple related
-  NTuple::Tuple* m_ntuple;
-  NTuple::Item<long> m_nt_ntrks;
-  NTuple::Item<long> m_nt_nhits;
-  NTuple::Item<long> m_nt_nvtx;
-  NTuple::Item<long> m_nt_vtxntrks;
-  NTuple::Item<long> m_nt_goodvtx;
-  NTuple::Item<float> m_nt_vtxX;
-  NTuple::Item<float> m_nt_vtxY;
-  NTuple::Item<float> m_nt_vtxZ;
-
-  NTuple::Array<long> m_nt_trknhits;
-  NTuple::Array<float> m_nt_trkqoverpt;
-  NTuple::Array<float> m_nt_trketa;
-  NTuple::Array<float> m_nt_trktheta;
-  NTuple::Array<float> m_nt_trkphi;
-  NTuple::Array<float> m_nt_trkd0;
-  NTuple::Array<float> m_nt_trkz0;
-  NTuple::Array<float> m_nt_trkcharge;
-  NTuple::Array<float> m_nt_trkchi2;
-  NTuple::Array<long> m_nt_trkdof;
-  NTuple::Array<float> m_nt_trkvtxd0;
-
-  NTuple::Array<long> m_nt_trkistruth;
-  NTuple::Array<long> m_nt_trktruthpdg;
-  NTuple::Array<float> m_nt_trktruthprob;
-  NTuple::Array<float> m_nt_trktruthpt;
-  NTuple::Array<float> m_nt_trktruthphi;
-  NTuple::Array<float> m_nt_trktrutheta;
-  NTuple::Array<float> m_nt_trktruthphi0;
-  NTuple::Array<float> m_nt_trktruthd0;
-  NTuple::Array<float> m_nt_trktruthz0;
-  NTuple::Array<float> m_nt_trktrutheta0;
-  NTuple::Array<float> m_nt_trktruthqoverpt;
-  NTuple::Array<float> m_nt_trktruthpt0;
-  NTuple::Array<float> m_nt_trktruthcharge;
-  NTuple::Array<float> m_nt_trktruthvtxX;
-  NTuple::Array<float> m_nt_trktruthvtxY;
-  NTuple::Array<float> m_nt_trktruthvtxZ;
-
-  NTuple::Matrix<long> m_nt_dettype;
-  NTuple::Matrix<long> m_nt_isbarrel;
-  NTuple::Matrix<long> m_nt_layer;
-  NTuple::Matrix<long> m_nt_hitmodphi;
-  NTuple::Matrix<long> m_nt_hitmodeta;
-  NTuple::Matrix<long> m_nt_hittype;
-  NTuple::Matrix<float> m_nt_residualx;
-  NTuple::Matrix<float> m_nt_residualy;
-  NTuple::Matrix<float> m_nt_hitx;
-  NTuple::Matrix<float> m_nt_hity;
-  NTuple::Matrix<float> m_nt_biasedresidualx;
-  NTuple::Matrix<float> m_nt_biasedresidualy;
-  NTuple::Matrix<float> m_nt_errorx;
-  NTuple::Matrix<float> m_nt_errory;
-  NTuple::Matrix<long> m_nt_hitxwidth;
-  NTuple::Matrix<long> m_nt_hitywidth;
-  NTuple::Matrix<long> m_nt_hitolegwidth;
-  NTuple::Matrix<float> m_nt_hitincidangle;
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx
deleted file mode 100644
index 0c6f4808360781bdb7546d95be396fa903f86ace..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx
+++ /dev/null
@@ -1,805 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// IDAlignMonPVBiases.cxx
-// AUTHORS: Ambrosius  Vermeulen, Pierfrancesco Butti
-// **********************************************************************
-
-#include "TF1.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-#include "TProfile.h"
-#include "TProfile2D.h"
-
-#include "GaudiKernel/MsgStream.h"
-
-#include "AtlasDetDescr/AtlasDetectorID.h"
-#include "InDetIdentifier/PixelID.h"
-#include "InDetIdentifier/SCT_ID.h"
-#include "InDetIdentifier/TRT_ID.h"
-
-#include "TrkTrack/TrackCollection.h"
-#include "InDetRIO_OnTrack/SiClusterOnTrack.h"
-#include "InDetPrepRawData/SiCluster.h"
-
-#include "Particle/TrackParticle.h"
-#include "TrkParticleBase/LinkToTrackParticleBase.h"
-
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkEventPrimitives/LocalParameters.h"
-
-
-#include "IDAlignMonPVBiases.h"
-#include "CLHEP/GenericFunctions/CumulativeChiSquare.hh"
-
-#include "InDetAlignGenTools/IInDetAlignHitQualSelTool.h"
-#include "TrackSelectionTool.h"
-#include <cmath>
-
-// *********************************************************************
-// Public Methods
-// *********************************************************************
-
-IDAlignMonPVBiases::IDAlignMonPVBiases(const std::string& type, const std::string& name, const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent),
-  m_events(0),
-  m_histosBooked(0)
-{
-  declareProperty("tracksName", m_tracksName = "ExtendedTracks");
-  declareProperty("CheckRate", m_checkrate = 1000);
-  declareProperty("triggerChainName", m_triggerChainName = "NoTriggerSelection");
-  declareProperty("trackSelection", m_trackSelection = ToolHandle< InDetAlignMon::TrackSelectionTool >("InDetAlignMon::TrackSelectionTool"));
-  declareProperty("VxPrimContainerName", m_VxPrimContainerName);
-  declareProperty("Extrapolator", m_extrapolator = ToolHandle<Trk::IExtrapolator>("Trk::Extrapolator/AtlasExtrapolator"));
-  declareProperty("TrackToVertexIPEstimatorTool", m_trackToVertexIPEstimatorTool = ToolHandle<Trk::ITrackToVertexIPEstimator>("Trk::TrackToVertexIPEstimator/TrackToVertexIPEstimator"));
-
-  InitializeHistograms();
-}
-
-IDAlignMonPVBiases::~IDAlignMonPVBiases() = default;
-
-void IDAlignMonPVBiases::InitializeHistograms() {
-  /////////////////////////////////////////////////
-  //////Initialize histo's 400MeV until 600MeV/////
-  /////////////////////////////////////////////////
-  m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_phi_400MeV_600MeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_400MeV_600MeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_eta_400MeV_600MeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_eta_400MeV_600MeV_negative = nullptr;
-
-  /////////////////////////////////////////////////
-  ///////Initialize histo's 600MeV until 1GeV//////
-  /////////////////////////////////////////////////
-  m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_phi_600MeV_1GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_600MeV_1GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_eta_600MeV_1GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_eta_600MeV_1GeV_negative = nullptr;
-
-  /////////////////////////////////////////////////
-  ////////Initialize histo's 1GeV until 2GeV///////
-  /////////////////////////////////////////////////
-  m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_phi_1GeV_2GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_1GeV_2GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_eta_1GeV_2GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_eta_1GeV_2GeV_negative = nullptr;
-
-  /////////////////////////////////////////////////
-  ////////Initialize histo's 2GeV until 5GeV///////
-  /////////////////////////////////////////////////
-  m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_phi_2GeV_5GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_2GeV_5GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_eta_2GeV_5GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_eta_2GeV_5GeV_negative = nullptr;
-
-  /////////////////////////////////////////////////
-  ///////Initialize histo's 5GeV until 10GeV///////
-  /////////////////////////////////////////////////
-  m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_phi_5GeV_10GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_5GeV_10GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_eta_5GeV_10GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_eta_5GeV_10GeV_negative = nullptr;
-
-  /////////////////////////////////////////////////
-  ///////Initialize histo's larger than 10GeV//////
-  /////////////////////////////////////////////////
-  m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_phi_10GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_phi_10GeV_negative = nullptr;
-
-  m_trkd0_wrtPV_vs_eta_10GeV_positive = nullptr;
-  m_trkd0_wrtPV_vs_eta_10GeV_negative = nullptr;
-}
-
-StatusCode IDAlignMonPVBiases::initialize() {
-  StatusCode sc;
-
-  m_events = 0;
-  m_histosBooked = 0;
-
-  sc = ManagedMonitorToolBase::initialize();
-  if (!sc.isSuccess()) return StatusCode::SUCCESS;
-
-  if (m_trackSelection.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve tool " << m_trackSelection << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSelection << endmsg;
-  }
-
-  ATH_CHECK(m_eventInfoKey.initialize());
-  ATH_CHECK(m_trackParticleKey.initialize());
-  ATH_CHECK(m_vertexKey.initialize());
-
-  ATH_CHECK( m_extrapolator.retrieve() );
-  
-  // extract TrackToVertexIPEstimator extrapolator tool
-  if ( m_trackToVertexIPEstimatorTool.retrieve().isFailure() ) {
-    ATH_MSG_ERROR("initialize: failed to retrieve trackToVertexIPEstimator tool ");
-    return StatusCode::SUCCESS;
-  }
-  else {
-    ATH_MSG_INFO("initialize: Retrieved Trk::TrackToVertexIPEstimator Tool" << m_trackToVertexIPEstimatorTool);
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonPVBiases::bookHistograms() {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    // book histograms that are only made in the online environment...
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Running in online mode " << std::endl;
-  }
-
-  if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-    // book histograms that are only relevant for cosmics data...
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Running in cosmic mode " << std::endl;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Running in collision mode " << std::endl;
-  }
-
-  std::string outputDirName = "IDAlignMon/" + m_tracksName + "_" + m_triggerChainName + "/GenericTracks";
-  MonGroup al_mon(this, outputDirName, run);
-  MonGroup al_mon_ls(this, outputDirName, lowStat);
-
-  ITHistSvc* tHistSvc = nullptr;
-  if (service("THistSvc", tHistSvc).isFailure()) {
-    ATH_MSG_ERROR("initialize() Could not find Hist Service -> Switching ValidationMode Off !");
-    //m_validationMode = false;
-  }
-
-  //if ( newLowStatFlag() ) {    }
-  //if ( newLumiBlockFlag() ) {    }
-  if (newRunFlag()) {
-    //if user environment specified we don't want to book new histograms at every run boundary
-    //we instead want one histogram per job
-    if (m_histosBooked != 0 && AthenaMonManager::environment() == AthenaMonManager::user) return StatusCode::SUCCESS;
-
-    const int nd0Bins = 10000;
-    double maxD0 = 5;
-
-    const int nphiBins = 50;
-    const int nphiBinsMap = 20;
-    double maxPhi = M_PI;
-
-    const int netaBins = 50;
-    const int netaBinsMap = 20;
-    double maxEta = 2.5;
-
-    /////////////////////////////////////////////////
-    ///Define+register histo's 400MeV until 600MeV///
-    /////////////////////////////////////////////////
-    //TH3D for maps
-    m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive",
-                                                                  "d0 vs phi vs eta 400MeV-600MeV positive; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                                  maxD0);
-    m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative",
-                                                                  "d0 vs phi vs eta 400MeV-600MeV negative; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                                  maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative);
-
-    //TH2D vs phi
-    m_trkd0_wrtPV_vs_phi_400MeV_600MeV_positive = new TH2F("trk_d0_wrtPV_vs_phi_400MeV_600MeV_positive",
-                                                           "d0 vs phi 400MeV-600MeV positive; #phi; d0 [mm]", nphiBins,
-                                                           -maxPhi, maxPhi, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_phi_400MeV_600MeV_negative = new TH2F("trk_d0_wrtPV_vs_phi_400MeV_600MeV_negative",
-                                                           "d0 vs phi 400MeV-600MeV negative; #phi; d0 [mm]", nphiBins,
-                                                           -maxPhi, maxPhi, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_400MeV_600MeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_400MeV_600MeV_negative);
-
-    //TH2D vs eta
-    m_trkd0_wrtPV_vs_eta_400MeV_600MeV_positive = new TH2F("trk_d0_wrtPV_vs_eta_400MeV_600MeV_positive",
-                                                           "d0 vs eta 400MeV-600MeV positive; #eta; d0 [mm]", netaBins,
-                                                           -maxEta, maxEta, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_eta_400MeV_600MeV_negative = new TH2F("trk_d0_wrtPV_vs_eta_400MeV_600MeV_negative",
-                                                           "d0 vs eta 400MeV-600MeV negative; #eta; d0 [mm]", netaBins,
-                                                           -maxEta, maxEta, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_400MeV_600MeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_400MeV_600MeV_negative);
-
-    /////////////////////////////////////////////////
-    ////Define+register histo's 600MeV until 1GeV////
-    /////////////////////////////////////////////////
-    //TH3D for maps
-    m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive",
-                                                                "d0 vs phi vs eta 600MeV-1GeV positive; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                                maxD0);
-    m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative",
-                                                                "d0 vs phi vs eta 600MeV-1GeV negative; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                                maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative);
-
-    //TH2D vs phi
-    m_trkd0_wrtPV_vs_phi_600MeV_1GeV_positive = new TH2F("trk_d0_wrtPV_vs_phi_600MeV_1GeV_positive",
-                                                         "d0 vs phi 600MeV-1GeV positive; #phi; d0 [mm]", nphiBins,
-                                                         -maxPhi, maxPhi, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_phi_600MeV_1GeV_negative = new TH2F("trk_d0_wrtPV_vs_phi_600MeV_1GeV_negative",
-                                                         "d0 vs phi 600MeV-1GeV negative; #phi; d0 [mm]", nphiBins,
-                                                         -maxPhi, maxPhi, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_600MeV_1GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_600MeV_1GeV_negative);
-
-    //TH2D vs eta
-    m_trkd0_wrtPV_vs_eta_600MeV_1GeV_positive = new TH2F("trk_d0_wrtPV_vs_eta_600MeV_1GeV_positive",
-                                                         "d0 vs eta 600MeV-1GeV positive; #eta; d0 [mm]", netaBins,
-                                                         -maxEta, maxEta, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_eta_600MeV_1GeV_negative = new TH2F("trk_d0_wrtPV_vs_eta_600MeV_1GeV_negative",
-                                                         "d0 vs eta 600MeV-1GeV negative; #eta; d0 [mm]", netaBins,
-                                                         -maxEta, maxEta, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_600MeV_1GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_600MeV_1GeV_negative);
-
-    /////////////////////////////////////////////////
-    /////Define+register histo's 1GeV until 2GeV/////
-    /////////////////////////////////////////////////
-    //TH3D for maps
-    m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive",
-                                                              "d0 vs phi vs eta 1GeV-2GeV positive; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                              maxD0);
-    m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative",
-                                                              "d0 vs phi vs eta 1GeV-2GeV negative; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                              maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative);
-
-    //TH2D vs phi
-    m_trkd0_wrtPV_vs_phi_1GeV_2GeV_positive = new TH2F("trk_d0_wrtPV_vs_phi_1GeV_2GeV_positive",
-                                                       "d0 vs phi 1GeV-2GeV positive; #phi; d0 [mm]", nphiBins, -maxPhi,
-                                                       maxPhi, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_phi_1GeV_2GeV_negative = new TH2F("trk_d0_wrtPV_vs_phi_1GeV_2GeV_negative",
-                                                       "d0 vs phi 1GeV-2GeV negative; #phi; d0 [mm]", nphiBins, -maxPhi,
-                                                       maxPhi, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_1GeV_2GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_1GeV_2GeV_negative);
-
-    //TH2D vs eta
-    m_trkd0_wrtPV_vs_eta_1GeV_2GeV_positive = new TH2F("trk_d0_wrtPV_vs_eta_1GeV_2GeV_positive",
-                                                       "d0 vs eta 1GeV-2GeV positive; #eta; d0 [mm]", netaBins, -maxEta,
-                                                       maxEta, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_eta_1GeV_2GeV_negative = new TH2F("trk_d0_wrtPV_vs_eta_1GeV_2GeV_negative",
-                                                       "d0 vs eta 1GeV-2GeV negative; #eta; d0 [mm]", netaBins, -maxEta,
-                                                       maxEta, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_1GeV_2GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_1GeV_2GeV_negative);
-
-    /////////////////////////////////////////////////
-    /////Define+register histo's 2GeV until 5GeV/////
-    /////////////////////////////////////////////////
-    //TH3D for maps
-    m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive",
-                                                              "d0 vs phi vs eta 2GeV-5GeV positive; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                              maxD0);
-    m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative",
-                                                              "d0 vs phi vs eta 2GeV-5GeV negative; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                              maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative);
-
-    //TH2D vs phi
-    m_trkd0_wrtPV_vs_phi_2GeV_5GeV_positive = new TH2F("trk_d0_wrtPV_vs_phi_2GeV_5GeV_positive",
-                                                       "d0 vs phi 2GeV-5GeV positive; #phi; d0 [mm]", nphiBins, -maxPhi,
-                                                       maxPhi, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_phi_2GeV_5GeV_negative = new TH2F("trk_d0_wrtPV_vs_phi_2GeV_5GeV_negative",
-                                                       "d0 vs phi 2GeV-5GeV negative; #phi; d0 [mm]", nphiBins, -maxPhi,
-                                                       maxPhi, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_2GeV_5GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_2GeV_5GeV_negative);
-
-    //TH2D vs eta
-    m_trkd0_wrtPV_vs_eta_2GeV_5GeV_positive = new TH2F("trk_d0_wrtPV_vs_eta_2GeV_5GeV_positive",
-                                                       "d0 vs eta 2GeV-5GeV positive; #eta; d0 [mm]", netaBins, -maxEta,
-                                                       maxEta, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_eta_2GeV_5GeV_negative = new TH2F("trk_d0_wrtPV_vs_eta_2GeV_5GeV_negative",
-                                                       "d0 vs eta 2GeV-5GeV negative; #eta; d0 [mm]", netaBins, -maxEta,
-                                                       maxEta, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_2GeV_5GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_2GeV_5GeV_negative);
-
-    /////////////////////////////////////////////////
-    /////Define+register histo's 5GeV until 10GeV////
-    /////////////////////////////////////////////////
-    //TH3D for maps
-    m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive",
-                                                               "d0 vs phi vs eta 5GeV-10GeV positive; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                               maxD0);
-    m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative",
-                                                               "d0 vs phi vs eta 5GeV-10GeV negative; #phi; #eta; d0 [mm]", nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta, nd0Bins, -maxD0,
-                                                               maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative);
-
-    //TH2D vs phi
-    m_trkd0_wrtPV_vs_phi_5GeV_10GeV_positive = new TH2F("trk_d0_wrtPV_vs_phi_5GeV_10GeV_positive",
-                                                        "d0 vs phi 5GeV-10GeV positive; #phi; d0 [mm]", nphiBins,
-                                                        -maxPhi, maxPhi, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_phi_5GeV_10GeV_negative = new TH2F("trk_d0_wrtPV_vs_phi_5GeV_10GeV_negative",
-                                                        "d0 vs phi 5GeV-10GeV negative; #phi; d0 [mm]", nphiBins,
-                                                        -maxPhi, maxPhi, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_5GeV_10GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_5GeV_10GeV_negative);
-
-    //TH2D vs eta
-    m_trkd0_wrtPV_vs_eta_5GeV_10GeV_positive = new TH2F("trk_d0_wrtPV_vs_eta_5GeV_10GeV_positive",
-                                                        "d0 vs eta 5GeV-10GeV positive; #eta; d0 [mm]", netaBins,
-                                                        -maxEta, maxEta, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_eta_5GeV_10GeV_negative = new TH2F("trk_d0_wrtPV_vs_eta_5GeV_10GeV_negative",
-                                                        "d0 vs eta 5GeV-10GeV negative; #eta; d0 [mm]", netaBins,
-                                                        -maxEta, maxEta, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_5GeV_10GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_5GeV_10GeV_negative);
-
-    /////////////////////////////////////////////////
-    ////Define+register histo's larger than 10GeV////
-    /////////////////////////////////////////////////
-    //TH3D for maps
-    m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_positive = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_10GeV_positive",
-                                                          "d0 vs phi vs eta >10GeV positive; #phi; #eta; d0 [mm]",
-                                                          nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta,
-                                                          nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_negative = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_10GeV_negative",
-                                                          "d0 vs phi vs eta >10GeV negative; #phi; #eta; d0 [mm]",
-                                                          nphiBinsMap, -maxPhi, maxPhi, netaBinsMap, -maxEta, maxEta,
-                                                          nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_negative);
-
-    //TH2D vs phi
-    m_trkd0_wrtPV_vs_phi_10GeV_positive = new TH2F("trk_d0_wrtPV_vs_phi_10GeV_positive",
-                                                   "d0 vs phi >10GeV positive; #phi; d0 [mm]", nphiBins, -maxPhi,
-                                                   maxPhi, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_phi_10GeV_negative = new TH2F("trk_d0_wrtPV_vs_phi_10GeV_negative",
-                                                   "d0 vs phi >10GeV negative; #phi; d0 [mm]", nphiBins, -maxPhi,
-                                                   maxPhi, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_10GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_phi_10GeV_negative);
-
-    //TH2D vs eta
-    m_trkd0_wrtPV_vs_eta_10GeV_positive = new TH2F("trk_d0_wrtPV_vs_eta_10GeV_positive",
-                                                   "d0 vs eta >10GeV positive; #eta; d0 [mm]", netaBins, -maxEta,
-                                                   maxEta, nd0Bins, -maxD0, maxD0);
-    m_trkd0_wrtPV_vs_eta_10GeV_negative = new TH2F("trk_d0_wrtPV_vs_eta_10GeV_negative",
-                                                   "d0 vs eta >10GeV negative; #eta; d0 [mm]", netaBins, -maxEta,
-                                                   maxEta, nd0Bins, -maxD0, maxD0);
-
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_10GeV_positive);
-    RegisterHisto(al_mon, m_trkd0_wrtPV_vs_eta_10GeV_negative);
-
-/*
-    /////////////////////////////////////////////////
-    //Histo's from IDAMonGenericTracks.cxx///////////
-    /////////////////////////////////////////////////
-      m_d0_pt         = new TH2F("d0_pt"       , "d0 vs pt"           , nD0Bins,d0bin,NpTbins,ptBin);
-
-      m_d0_pt = new TProfile("prof", "d0 vs pT;pT (GeV);d0 (mm)", NpTbins, ptBin);
-      m_trk_d0_wrtPV_vs_phi_vs_eta         = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta"       , "d0 vs phi vs eta"
-                   , 100, -3., 3.,  40, 0, 2*M_PI,  100, -0.5, 0.5 );
-      m_trk_d0_wrtPV_vs_phi_vs_eta_barrel  = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_barrel", "d0 vs phi vs eta (Barrel)"
-          , 100, -3., 3.,  40, 0, 2*M_PI,  100, -0.5, 0.5 );
-      m_trk_d0_wrtPV_vs_phi_vs_eta_ecc     = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_ecc"   , "d0 vs phi vs eta (Endcap
-         C)", 100, -3., 3.,  40, 0, 2*M_PI,  100, -0.5, 0.5 );
-      m_trk_d0_wrtPV_vs_phi_vs_eta_eca     = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta_eca"   , "d0 vs phi vs eta (Endcap
-         A)", 100, -3., 3.,  40, 0, 2*M_PI,  100, -0.5, 0.5 );
-
-      m_trk_z0_wrtPV_vs_phi_vs_eta         = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta"       , "d0 vs phi vs eta"
-                   , 100, -3., 3.,  40, 0, 2*M_PI,  100, -1, 1 );
-      m_trk_z0_wrtPV_vs_phi_vs_eta_barrel  = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta_barrel", "d0 vs phi vs eta (Barrel)"
-          , 100, -3., 3.,  40, 0, 2*M_PI,  100, -1, 1 );
-      m_trk_z0_wrtPV_vs_phi_vs_eta_ecc     = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta_ecc"   , "d0 vs phi vs eta (Endcap
-         C)", 100, -3., 3.,  40, 0, 2*M_PI,  100, -1, 1 );
-      m_trk_z0_wrtPV_vs_phi_vs_eta_eca     = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta_eca"   , "d0 vs phi vs eta (Endcap
-         A)", 100, -3., 3.,  40, 0, 2*M_PI,  100, -1, 1 );
-
-      RegisterHisto(al_mon, m_d0_pt );
-
-      RegisterHisto(al_mon, m_trk_d0_wrtPV_vs_phi_vs_eta        );
-      RegisterHisto(al_mon, m_trk_d0_wrtPV_vs_phi_vs_eta_barrel );
-      RegisterHisto(al_mon, m_trk_d0_wrtPV_vs_phi_vs_eta_ecc    );
-      RegisterHisto(al_mon, m_trk_d0_wrtPV_vs_phi_vs_eta_eca    );
-
-      RegisterHisto(al_mon, m_trk_z0_wrtPV_vs_phi_vs_eta        );
-      RegisterHisto(al_mon, m_trk_z0_wrtPV_vs_phi_vs_eta_barrel );
-      RegisterHisto(al_mon, m_trk_z0_wrtPV_vs_phi_vs_eta_ecc    );
-      RegisterHisto(al_mon, m_trk_z0_wrtPV_vs_phi_vs_eta_eca    );
- */
-
-
-    m_histosBooked++;
-  }
-  return StatusCode::SUCCESS;
-}
-
-/*void IDAlignMonPVBiases::RegisterHisto(MonGroup& mon, TH1F_LW* histo) {
-
-   //histo->Sumw2(); this uses a lot of memory and isn't needed!
-   //histo->SetOption("e");
-   StatusCode sc = mon.regHist(histo);
-   if (sc.isFailure() ) {
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1F_LW Histogram:" << endmsg;
-   }
-   }*/
-
-
-void IDAlignMonPVBiases::RegisterHisto(MonGroup& mon, TH1* histo) {
-  //histo->Sumw2();
-  histo->SetOption("e");
-  StatusCode sc = mon.regHist(histo);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonPVBiases::RegisterHisto(MonGroup& mon, TProfile* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonPVBiases::RegisterHisto(MonGroup& mon, TH2* histo) {
-  //histo->Sumw2();
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH2 Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonPVBiases::RegisterHisto(MonGroup& mon, TProfile2D* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile2D Histogram:" << endmsg;
-  }
-}
-
-StatusCode IDAlignMonPVBiases::fillHistograms() {
-  m_events++;
-
-  /******************************************************************
-  ** Event Information
-  *******************************************************************/
-  ATH_MSG_DEBUG("Retrieving event info.");
-  SG::ReadHandle<xAOD::EventInfo> eventInfo {
-    m_eventInfoKey
-  };
-  if (not eventInfo.isValid()) {
-    ATH_MSG_ERROR("Could not retrieve event info.");
-  } else {
-    m_runNumber = eventInfo->runNumber();
-    m_evtNumber = eventInfo->eventNumber();
-    m_lumi_block = eventInfo->lumiBlock();
-    ATH_MSG_DEBUG(" Execute() starting on --> Run: " << m_runNumber << "  event: " << m_evtNumber);
-  }
-
-  /******************************************************************
-  ** Retrieve Trackparticles
-  ******************************************************************/
-  SG::ReadHandle<xAOD::TrackParticleContainer> tracks {
-    m_trackParticleKey
-  };
-  if (not tracks.isValid()) {
-    msg(MSG::WARNING) << "Failed to retrieve track paritcle collection. Exiting." << endmsg;
-    return StatusCode::FAILURE;
-  }
-
-  /**
-   * Retrieve Vertices
-   */
-
-  SG::ReadHandle<xAOD::VertexContainer> vertices {
-    m_vertexKey
-  };
-  if (not vertices.isValid()) {
-    ATH_MSG_WARNING("Failed to retrieve vertex container with key " << m_vertexKey.key());
-    return StatusCode::FAILURE;
-  }
-
-  xAOD::TrackParticleContainer::const_iterator track_itr = tracks->begin();
-  xAOD::TrackParticleContainer::const_iterator track_itrE = tracks->end();
-
-  /******************************************************************
-  ** Trackparticle Loop
-  *******************************************************************/
-  for (; track_itr != track_itrE; ++track_itr) {
-    const xAOD::Vertex* foundVertex = nullptr;
-    for (const auto* const vx : *vertices) {
-      for (const auto& tpLink : vx->trackParticleLinks()) {
-        if (*tpLink == *track_itr) {
-          foundVertex = vx;
-          break;
-        }
-        if (foundVertex) break;
-      }
-    }
-    // require having vertex
-    if (!foundVertex) continue;
-    // require associated with primary vertex
-    if (foundVertex->vertexType() != 1) continue;
-    // require at least 10 tracks associated
-    if (foundVertex->nTrackParticles() < 10) continue;
-
-    std::unique_ptr<Trk::ImpactParametersAndSigma> myIPandSigma(nullptr);
-    myIPandSigma = m_trackToVertexIPEstimatorTool->estimate(*track_itr, foundVertex, true);
-
-    // require d0_pv to be smaller than 4
-    if (myIPandSigma->IPd0 > 4.0) continue;
-    if (myIPandSigma->IPd0 < -4.0) continue;
-
-    /******************************************************************
-    ** Fill TTree
-    *******************************************************************/
-    m_d0 = myIPandSigma->IPd0;
-    m_z0 = myIPandSigma->IPz0;
-    m_z0_err = myIPandSigma->sigmaz0;
-    m_d0_err = myIPandSigma->sigmad0;
-
-    m_charge = (*track_itr)->charge();
-    m_pt = (*track_itr)->pt();
-    m_eta = (*track_itr)->eta();
-    m_phi = (*track_itr)->phi();
-    m_vertex_x = foundVertex->x();
-    m_vertex_y = foundVertex->y();
-    m_vertex_z = foundVertex->z();
-
-    //m_Tree->Fill();
-
-    /******************************************************************
-    ** Fill Histograms
-    *******************************************************************/
-    double pt = (*track_itr)->pt() * 0.001;
-
-    if (pt > 0.4 && pt < 0.6) {
-      //Fill TH3D for positive and negative vs phi vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs phi
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_400MeV_600MeV_positive->Fill(m_phi, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_400MeV_600MeV_negative->Fill(m_phi, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_eta_400MeV_600MeV_positive->Fill(m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_eta_400MeV_600MeV_negative->Fill(m_eta, myIPandSigma->IPd0);
-    }
-
-    if (pt > 0.6 && pt < 1) {
-      //Fill TH3D for positive and negative vs phi vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs phi
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_600MeV_1GeV_positive->Fill(m_phi, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_600MeV_1GeV_negative->Fill(m_phi, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_eta_600MeV_1GeV_positive->Fill(m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_eta_600MeV_1GeV_negative->Fill(m_eta, myIPandSigma->IPd0);
-    }
-
-    if (pt > 1 && pt < 2) {
-      //Fill TH3D for positive and negative vs phi vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs phi
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_1GeV_2GeV_positive->Fill(m_phi, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_1GeV_2GeV_negative->Fill(m_phi, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_eta_1GeV_2GeV_positive->Fill(m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_eta_1GeV_2GeV_negative->Fill(m_eta, myIPandSigma->IPd0);
-    }
-
-    if (pt > 2 && pt < 5) {
-      //Fill TH3D for positive and negative vs phi vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs phi
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_2GeV_5GeV_positive->Fill(m_phi, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_2GeV_5GeV_negative->Fill(m_phi, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_eta_2GeV_5GeV_positive->Fill(m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_eta_2GeV_5GeV_negative->Fill(m_eta, myIPandSigma->IPd0);
-    }
-
-    if (pt > 5 && pt < 10) {
-      //Fill TH3D for positive and negative vs phi vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs phi
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_5GeV_10GeV_positive->Fill(m_phi, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_5GeV_10GeV_negative->Fill(m_phi, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_eta_5GeV_10GeV_positive->Fill(m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_eta_5GeV_10GeV_negative->Fill(m_eta, myIPandSigma->IPd0);
-    }
-
-    if (pt > 10) {
-      //Fill TH3D for positive and negative vs phi vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_positive->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_negative->Fill(m_phi, m_eta, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs phi
-      if (m_charge == 1) m_trkd0_wrtPV_vs_phi_10GeV_positive->Fill(m_phi, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_phi_10GeV_negative->Fill(m_phi, myIPandSigma->IPd0);
-
-      //Fill TH2D for positive and negative vs eta
-      if (m_charge == 1) m_trkd0_wrtPV_vs_eta_10GeV_positive->Fill(m_eta, myIPandSigma->IPd0);
-      if (m_charge == -1) m_trkd0_wrtPV_vs_eta_10GeV_negative->Fill(m_eta, myIPandSigma->IPd0);
-    }
-
-    /******************************************************************
-    ** Divide in barrel, eca, ecc
-    *******************************************************************/
-    /*if((*track_itr)->track()) {
-
-       int nhpixB=0, nhpixECA=0, nhpixECC=0, nhsctB=0, nhsctECA=0, nhsctECC=0, nhtrtB=0, nhtrtECA=0, nhtrtECC=0;
-        // loop over all hits on track
-
-        const Trk::Track* track_itr2 = (*track_itr)->track();
-       const DataVector<const Trk::TrackStateOnSurface>* TSOS;
-
-        TSOS = track_itr2->trackStateOnSurfaces();
-
-       DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItr  = TSOS->begin();
-        DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItrE = TSOS->end();
-
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) <<"starting to loop over TSOS"<<endmsg;
-
-        for (; TSOSItr != TSOSItrE; ++TSOSItr) {
-
-            //check that we have track parameters defined for the surface (pointer is not null)
-            if(!((*TSOSItr)->trackParameters())) {
-                if (msgLvl(MSG::DEBUG)) msg() << "hit skipped because no associated track parameters" << endmsg;
-                continue;
-            }
-
-            Identifier surfaceID;
-            const Trk::MeasurementBase* mesb=(*TSOSItr)->measurementOnTrack();
-            if (mesb != 0 && mesb->associatedSurface().associatedDetectorElement()!=NULL) {
-            surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify();
-        }else{
-                // hits, outliers
-            continue;
-        }
-
-            if ( (*TSOSItr)->type(Trk::TrackStateOnSurface::Measurement) ){
-
-                // --- pixel
-                if (m_idHelper->is_pixel(surfaceID)){
-                    if(m_pixelID->barrel_ec(surfaceID)      ==  0){
-                            nhpixB++;
-                    }
-                    else if(m_pixelID->barrel_ec(surfaceID) ==  2)  nhpixECA++;
-                    else if(m_pixelID->barrel_ec(surfaceID) == -2) nhpixECC++;
-                }
-                // --- sct
-                else if (m_idHelper->is_sct(surfaceID)){
-                    if(m_sctID->barrel_ec(surfaceID)      ==  0){
-                            nhsctB++;
-                    }
-                    else if(m_sctID->barrel_ec(surfaceID) ==  2) nhsctECA++;
-                    else if(m_sctID->barrel_ec(surfaceID) == -2) nhsctECC++;
-                }
-                // --- trt
-                if (m_idHelper->is_trt(surfaceID)){
-                    int m_barrel_ec      = m_trtID->barrel_ec(surfaceID);
-                    if(m_barrel_ec == 1 || m_barrel_ec == -1 ) {
-                            nhtrtB++;
-                    }
-                    else if(m_barrel_ec ==  2){
-                            nhtrtECA++;
-                    }else if(m_barrel_ec == -2){
-                            nhtrtECC++;
-                    }
-                }
-            }
-        }
-
-       int nhpix=nhpixB+nhpixECA+nhpixECC;
-        int nhsct=nhsctB+nhsctECA+nhsctECC;
-        int nhtrt=nhtrtB+nhtrtECA+nhtrtECC;
-        int nhits=nhpix+nhsct+nhtrt;
-
-        // set EC or not
-       bool hasECAhits = false;
-        if(nhpixECA+nhsctECA+nhtrtECA > 0) hasECAhits = true;
-        bool hasECChits = false;
-        if(nhpixECC+nhsctECC+nhtrtECC > 0) hasECChits = true;
-
-        if (!hasECAhits && !hasECChits) { //filling barrel histograms
-            m_trk_d0_wrtPV_vs_phi_vs_eta_barrel->Fill(m_eta, m_phi, myIPandSigma->IPd0);
-            m_trk_z0_wrtPV_vs_phi_vs_eta_barrel->Fill(m_eta, m_phi, myIPandSigma->IPz0);
-       }else if (hasECAhits) {//filling endcap A histograms
-            m_trk_d0_wrtPV_vs_phi_vs_eta_eca -> Fill(m_eta, m_phi, myIPandSigma->IPd0);
-            m_trk_z0_wrtPV_vs_phi_vs_eta_eca -> Fill(m_eta, m_phi, myIPandSigma->IPz0);
-       }else if (hasECChits) {//filling endcap C histograms
-            m_trk_d0_wrtPV_vs_phi_vs_eta_ecc -> Fill(m_eta, m_phi, myIPandSigma->IPd0);
-            m_trk_z0_wrtPV_vs_phi_vs_eta_ecc -> Fill(m_eta, m_phi, myIPandSigma->IPz0);
-       }
-       }*/
-  } // End of track selection loop
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonPVBiases::procHistograms() {
-  //if( endOfLowStatFlag() ) {  }
-  //if( endOfLumiBlockFlag() ) {  }
-  //if( endOfRunFlag() ) {  }
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonPVBiases::finalize() {
-  return StatusCode::SUCCESS;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
deleted file mode 100644
index dc503a09e2c369d049518af9ce049ffec2f1c320..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef IDAlignMonPVBiases_H
-#define IDAlignMonPVBiases_H
-
-// **********************************************************************
-// IDAlignMonPVBIases.cxx
-// AUTHORS: Ambrosius  Vermeulen, Pierfrancesco Butti
-// **********************************************************************
-
-#include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h"
-#include "TrkExInterfaces/IExtrapolator.h"
-
-#include "GaudiKernel/StatusCode.h"
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "EventPrimitives/EventPrimitivesHelpers.h"
-#include "GaudiKernel/AlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-
-#include "StoreGate/ReadHandleKey.h"
-#include "xAODEventInfo/EventInfo.h"
-#include "xAODTracking/TrackParticle.h"
-#include "xAODTracking/TrackParticleContainer.h"
-#include "xAODTracking/Vertex.h"
-#include "xAODTracking/VertexContainer.h"
-#include <map>
-#include <vector>
-
-class TH3F;
-class TH2F;
-
-
-namespace Trk  {
-  class VxCandidate;
-  class Track;
-  class VxTrackAtVertex;
-}
-
-namespace InDetAlignMon {
-  class TrackSelectionTool;
-}
-
-class IDAlignMonPVBiases: public ManagedMonitorToolBase
-{
-public:
-  IDAlignMonPVBiases(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~IDAlignMonPVBiases();
-  virtual StatusCode initialize();
-  virtual StatusCode fillHistograms();
-  virtual StatusCode finalize();
-  virtual StatusCode bookHistograms();
-  virtual StatusCode procHistograms();
-
-  void InitializeHistograms();
-
-  void RegisterHisto(MonGroup& mon, TH1* histo);
-  //void RegisterHisto(MonGroup& mon, TH1F_LW* histo);
-  void RegisterHisto(MonGroup& mon, TH2* histo);
-  void RegisterHisto(MonGroup& mon, TProfile* histo);
-  void RegisterHisto(MonGroup& mon, TProfile2D* histo);
-protected:
-  /////////////////////////////////////////////////
-  ///////Declare histo's 400MeV until 600MeV///////
-  /////////////////////////////////////////////////
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive {};
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_phi_400MeV_600MeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_phi_400MeV_600MeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_eta_400MeV_600MeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_eta_400MeV_600MeV_negative {};
-
-  /////////////////////////////////////////////////
-  ////////Declare histo's 600MeV until 1GeV////////
-  /////////////////////////////////////////////////
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive {};
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_phi_600MeV_1GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_phi_600MeV_1GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_eta_600MeV_1GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_eta_600MeV_1GeV_negative {};
-
-  /////////////////////////////////////////////////
-  /////////Declare histo's 1GeV until 2GeV/////////
-  /////////////////////////////////////////////////
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive {};
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_phi_1GeV_2GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_phi_1GeV_2GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_eta_1GeV_2GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_eta_1GeV_2GeV_negative {};
-
-  /////////////////////////////////////////////////
-  /////////Declare histo's 2GeV until 5GeV/////////
-  /////////////////////////////////////////////////
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive {};
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_phi_2GeV_5GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_phi_2GeV_5GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_eta_2GeV_5GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_eta_2GeV_5GeV_negative {};
-
-  /////////////////////////////////////////////////
-  ////////Declare histo's 5GeV until 10GeV/////////
-  /////////////////////////////////////////////////
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive {};
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_phi_5GeV_10GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_phi_5GeV_10GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_eta_5GeV_10GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_eta_5GeV_10GeV_negative {};
-
-  /////////////////////////////////////////////////
-  /////////Declare histo's larger than 10GeV///////
-  /////////////////////////////////////////////////
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_positive {};
-  TH3F* m_trkd0_wrtPV_vs_phi_vs_eta_10GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_phi_10GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_phi_10GeV_negative {};
-
-  TH2F* m_trkd0_wrtPV_vs_eta_10GeV_positive {};
-  TH2F* m_trkd0_wrtPV_vs_eta_10GeV_negative {};
-private:
-  int m_checkrate {};
-  int m_events {};
-  int m_histosBooked {};
-  std::string m_tracksName;
-  std::string m_triggerChainName;
-  std::string m_VxPrimContainerName;
-  ToolHandle<Trk::ITrackToVertexIPEstimator>  m_trackToVertexIPEstimatorTool;
-  ToolHandle<Trk::IExtrapolator>         m_extrapolator;    //!< track extrapolator
-
-  unsigned int m_runNumber {};
-  unsigned int m_evtNumber {};
-  unsigned int m_lumi_block {};
-
-  double m_charge {};
-  double m_pt {};
-  double m_eta {};
-  double m_phi {};
-  double m_z0 {};
-  double m_d0 {};
-  double m_z0_err {};
-  double m_d0_err {};
-  double m_vertex_x {};
-  double m_vertex_y {};
-  double m_vertex_z {};
-
-  ToolHandle< InDetAlignMon::TrackSelectionTool > m_trackSelection;
-
-  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey {
-    this, "EventInfoKey", "EventInfo", "SG Key of EventInfo object"
-  };
-  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleKey {
-    this, "TrackParticleKey", "InDetTrackParticles"
-  };
-  SG::ReadHandleKey<xAOD::VertexContainer> m_vertexKey {
-    this, "VertexContainer", "PrimaryVertices", "primary vertex container"
-  };
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
deleted file mode 100644
index cbb90ea33223222f3b33a6dcd73ef6b2070b99b3..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
+++ /dev/null
@@ -1,5370 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-// ***************************************************************************************
-// IDAlignMonResiduals.cxx
-// AUTHORS: Beate Heinemann, Tobias Golling, Ben Cooper, John Alison
-// ***************************************************************************************
-
-#include "IDAlignMonResiduals.h"
-
-#include "LWHists/TH1F_LW.h"
-#include "TF1.h"
-#include "TFitResult.h"
-#include "TFitResultPtr.h"
-#include "TGraphErrors.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-#include "TMath.h"
-#include "TProfile.h"
-#include "TProfile2D.h"
-#include "TFile.h"
-
-#include <cmath>
-#include <sstream>
-
-#include "StoreGate/ReadHandle.h"
-#include "AtlasDetDescr/AtlasDetectorID.h"
-#include "InDetIdentifier/PixelID.h"
-#include "InDetIdentifier/SCT_ID.h"
-#include "InDetIdentifier/TRT_ID.h"
-#include "PixelReadoutGeometry/PixelDetectorManager.h"
-
-#include "SCT_ReadoutGeometry/SCT_DetectorManager.h"
-#include "InDetRIO_OnTrack/SiClusterOnTrack.h"
-#include "InDetPrepRawData/SiCluster.h"
-#include "InDetPrepRawData/PixelCluster.h"
-#include "InDetPrepRawData/SCT_Cluster.h"
-
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkEventPrimitives/LocalParameters.h"
-#include "TrkEventPrimitives/ResidualPull.h"
-
-#include "TrkGeometry/MagneticFieldProperties.h"
-#include "TrkGeometry/TrackingVolume.h"
-#include "TrkGeometry/Layer.h"
-#include "TrkSurfaces/Surface.h"
-
-#include "TrkToolInterfaces/IUpdator.h"
-#include "TrkExInterfaces/IPropagator.h"
-#include "TrkToolInterfaces/IResidualPullCalculator.h"
-
-#include "InDetAlignGenTools/IInDetAlignHitQualSelTool.h"
-
-#include "TrackSelectionTool.h"
-
-#include "TRT_ConditionsServices/ITRT_CalDbTool.h"
-#include "InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h"
-
-
-// *********************************************************************
-// Public Methods
-// *********************************************************************
-
-struct IDAlignMonResiduals::TRTBarrelHistograms {
-  /** Residual in the TRT Barrel */
-  TH1F_LW* residualR[3] {};
-  TH1F_LW* residualR_notube[3] {};
-
-  /** Pull in the TRT Barrel */
-  TH1F_LW* pullR[3] {};
-  TH1F_LW* pullR_notube[3] {};
-
-  /** Average residual and residual RMS vs phi sector in the TRT Barrel */
-  /** the fist "3" is for the three layers, the second is for (both A and C, A-side, C-Side)*/
-  TProfile* aveRes_l[3][3] {};
-  TProfile* rmsRes_l[3][3] {};
-
-  /** Average residual and residual RMS vs straw layer for each phiSec(0-31) */
-  TProfile* aveResVsStrawLayerStackLevel[3][32] {};
-  TProfile* rmsResVsStrawLayerStackLevel[3][32] {};
-
-  /** Average residual and residual RMS Intergrated over each phi module vs straw layer */
-  /** the "5" is for (total, upper, lower, left, right)*/
-  TProfile* aveResOverPhiVsStrawLayer[5][3] {};
-  TProfile* rmsResOverPhiVsStrawLayer[5][3] {};
-
-  /** Drift radius from track fit */
-  TH1F_LW* PredictedR[3] {};
-
-  /** Measured drift radius */
-  TH1F_LW* MeasuredR[3] {};
-
-  /** Residual vs eta (of the track) in the module layers(0-2) */
-  TProfile* aveResVsTrackEta_l[3][3] {};
-
-  /** R(t) relation */
-  TH2F* rt[3] {};
-
-  /** Residuals and pulls vs pT in the TRT Barrel */
-  TH2F* residualR_pt[3] {};
-  TH2F* pullR_pt[3] {};
-  TH2F* pullR_notube_pt[3] {};
-
-  /** Residuals and pulls vs mu in the TRT Barrel */
-  TH2F* residualR_mu[3] {};
-  TH2F* pullR_mu[3] {};
-  TH2F* pullR_notube_mu[3] {};
-
-  /** L/R assignment */
-  TH1F_LW* lr[3] {};
-  TProfile* lr_l[3][3] {};
-  TProfile* lrOverPhiVsStrawLayer[3] {};
-
-  /** Residual maps vs phi-sector and z-position in the TRT Barrel */
-  TH3F* resVsPhiZ[3][3] {}; // 3D histogram with residuals vs phi & z, will be used to fill following th2f
-  TH2F* aveResVsPhiZ[3][3] {};
-  TH2F* rmsResVsPhiZ[3][3] {};
-  /** Residual maps vs phi-sector and eta in the TRT Barrel (this is a test until I get z working...) */
-  TH3F* resVsPhiEta[3][3] {}; // 3D histogram with residuals vs phi & z, will be used to fill following th2f
-  TH2F* aveResVsPhiEta[3][3] {};
-  TH2F* rmsResVsPhiEta[3][3] {};
-};
-/////////////////////////////////////////////////
-struct IDAlignMonResiduals::TRTEndcapHistograms {
-  /** Residual in TRT Endcap */
-  /** the 41 is the forty rings plus the total*/
-  /** In the case of no extendedPlots use only the total */
-  TH1F_LW* residualR[2][41] {};
-  TH1F_LW* residualR_notube[2][41] {};
-
-  /** Pull in the TRT Endcap */
-  /** The 41 is the forty rings plus the total*/
-  TH1F_LW* pullR[2][41] {};
-  TH1F_LW* pullR_notube[2][41] {};
-
-  /** Average residual and residual RMS vs endcap ring */
-  TProfile* aveResVsRing[2] {};
-  TProfile* rmsResVsRing[2] {};
-
-  /** Average residual and residual RMS vs phi sector */
-  TProfile* aveResVsPhiSec[2] {};
-  TProfile* rmsResVsPhiSec[2] {};
-
-  /** Drift radius from track fit */
-  TH1F_LW* PredictedR[2] {};
-
-  /** Measured drift radius */
-  TH1F_LW* MeasuredR[2] {};
-
-  /** Residual vs eta (of the track) in the Endcap */
-  TProfile* aveResVsTrackEta[2] {};
-
-  /** Residuals and pulls vs pT in the TRT Endcap */
-  TH2F* residualR_pt[2] {};
-  TProfile* residualR_ptwheel[2][40] {};
-  TH2F* pullR_pt[2] {};
-  TH2F* pullR_notube_pt[2] {};
-
-  /** Residuals and pulls vs mu in the TRT Endcap */
-  TH2F* residualR_mu[2] {};
-  TH2F* pullR_mu[2] {};
-  TH2F* pullR_notube_mu[2] {};
-
-  /** R(t) relation */
-  TH2F* rt[2] {};
-
-  /** L/R assignment */
-  TH1F_LW* lr[2] {};
-  TProfile* lrVsPhiSec[2] {};
-  TProfile* lrVsRing[2] {};
-
-  /** Residual maps of the Endcaps */
-  TH3F* resVsPhiWheel[2] {};
-  TH2F* aveResVsPhiWheel[2] {};
-  TH2F* rmsResVsPhiWheel[2] {};
-
-  TH3F* resVsPhiWheelPos[2] {};
-  TH3F* resVsPhiWheelNeg[2] {};
-
-  /** Residual maps for low pT tracks separated by charge in the TRT Endcap */
-  TH3F* resVsRadiusWheelPos[2] {};
-  TH2F* aveResVsRadiusWheelPos[2] {};
-  TH2F* rmsResVsRadiusWheelPos[2] {};
-  TH3F* resVsRadiusWheelNeg[2] {};
-  TH2F* aveResVsRadiusWheelNeg[2] {};
-  TH2F* rmsResVsRadiusWheelNeg[2] {};
-
-  // Residual vs pt and vs wheel in the endcap
-  TH3F* resVsqPtWheel[2] {};
-};
-
-////////////////////////////////////////
-IDAlignMonResiduals::IDAlignMonResiduals(const std::string& type, const std::string& name, const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent),
-  m_trtcaldbTool("TRT_CalDbTool", this),
-  m_gap_pix(4),
-  m_gap_sct(10),
-  m_ClusterSizeRange(10.),
-  m_IncidentThetaRange(2.),
-  m_IncidentPhiRange(0.8),
-  m_TRTB_nSectorBins(32),
-  m_TRTEC_nSectorBins(8),
-  m_mu(0.),
-  m_hasBeenCalledThisEvent(false),
-  m_nBinsMuRange(101.),
-  m_muRangeMin(-0.5),
-  m_muRangeMax(100.5),
-  m_LBRangeMin(-0.5),
-  m_LBRangeMax(2599.5),
-  m_nIBLHitsPerLB(0),
-  m_trt_b_hist(new TRTBarrelHistograms()),
-  m_trt_ec_hist(new TRTEndcapHistograms()),
-  m_hWeightInFile(nullptr),
-  m_etapTWeight(nullptr),
-  m_z_fix (366.5), // IBL Stave fixing screw position [mm]
-  m_minIBLhits(-1) {
-
-  declareProperty("CheckRate", m_checkrate = 1000);
-  declareProperty("triggerChainName", m_triggerChainName = "NoTriggerSelection");
-  declareProperty("minTRTResidualWindow", m_minTRTResWindow = -1.0);
-  declareProperty("maxTRTResidualWindow", m_maxTRTResWindow = 1.0);
-  declareProperty("iUpdator", m_iUpdator = ToolHandle<Trk::IUpdator>("Trk::KalmanUpdator"));
-  declareProperty("propagator", m_propagator = ToolHandle<Trk::IPropagator>("Trk::RungeKuttaPropagator"));
-  declareProperty("trackSelection", m_trackSelection = ToolHandle<InDetAlignMon::TrackSelectionTool>("InDetAlignMon::TrackSelectionTool"));
-  //declareProperty("idtrackSelection"          , m_idtrackSelection ="InDetTrackSelectionTool/InDetTrackSelectionTool");   //For retreiving from jO
-  declareProperty("ResidualPullCalculatorTool", m_residualPullCalculator = ToolHandle<Trk::IResidualPullCalculator>("Trk::ResidualPullCalculator/ResidualPullCalculator"));
-  declareProperty("HitQualityTool", m_hitQualityTool);
-  declareProperty("Pixel_Manager", m_Pixel_Manager);
-  declareProperty("SCT_Manager", m_SCT_Manager);
-  declareProperty("TRT_Manager", m_TRT_Manager);
-  declareProperty("minSiResFillRange", m_minSiResFillRange = -0.08);
-  declareProperty("maxSiResFillRange", m_maxSiResFillRange =  0.08);
-  declareProperty("do3DOverlapHistos", m_do3DOverlapHistos = false);
-  declareProperty("doClusterSizeHistos", m_doClusterSizeHistos = false);
-  declareProperty("ITRT_CalDbTool", m_trtcaldbTool = ToolHandle<ITRT_CalDbTool>("TRT_CalDbTool"));
-  declareProperty("useExtendedPlots", m_extendedPlots = false);
-  declareProperty("minPIXResXFillRange", m_minPIXResXFillRange = 0); // if 0, it will use the m_minSiResFillRange value
-  declareProperty("maxPIXResXFillRange", m_maxPIXResXFillRange = 0); // if 0, it will use the m_maxSiResFillRange value
-  declareProperty("minPIXResYFillRange", m_minPIXResYFillRange = -0.4);
-  declareProperty("maxPIXResYFillRange", m_maxPIXResYFillRange =  0.4);
-  declareProperty("minSCTResFillRange", m_minSCTResFillRange = 0);
-  declareProperty("maxSCTResFillRange", m_maxSCTResFillRange = 0);
-  declareProperty("RangeOfPullHistos", m_RangeOfPullHistos = 6.);
-  declareProperty("PtRange", m_PtRange = 40.);
-  declareProperty("NBinsPtRange", m_nBinsPtRange = 50);
-  declareProperty("xHitErrorRange", m_xHitErrorRange = 0.08);
-  declareProperty("yHitErrorRange", m_yHitErrorRange = 0.12);
-  declareProperty("NBinsLB", m_nBinsLB = 52);
-  declareProperty("FinerBinningFactor", m_FinerBinningFactor = 1);
-  declareProperty("NSplitMap", m_mapSplit = 1); // Create the residual maps splitting the modules in nxn pieces
-  declareProperty("applyHistWeight", m_applyHistWeight = false);
-  declareProperty("hWeightInFileName", m_hWeightInFileName = "hWeight.root");
-  declareProperty("hWeightHistName", m_hWeightHistName = "trk_pT_vs_eta");
-  declareProperty("doIBLLBPlots", m_doIBLLBPlots = false);
-  declareProperty("useGausFit", m_useGausFit = false);
-  declareProperty("maxPtforECHistos", m_maxPtEC = 10.); // in GeV
-
-  InitializeHistograms();
-}
-
-//---------------------------------------------------------------------------------------
-
-IDAlignMonResiduals::~IDAlignMonResiduals() {
-  delete m_trt_b_hist;
-  delete m_trt_ec_hist;
-}
-
-void IDAlignMonResiduals::InitializeHistograms() {
-  m_totalEvents = nullptr;
-  m_hTotalTracks = nullptr;
-  m_oldlumiblock = 0;
-  m_sirescalcfailure = nullptr;
-  m_pix_eca_xresvsmodphidisk_3d = nullptr;
-  m_pix_ecc_xresvsmodphidisk_3d = nullptr;
-  m_pix_eca_yresvsmodphidisk_3d = nullptr;
-  m_pix_ecc_yresvsmodphidisk_3d = nullptr;
-  m_dbm_xresvsmodphi_2d = nullptr;
-  m_sct_b_pullx_pt = nullptr;
-  m_sct_eca_pullx_pt = nullptr;
-  m_sct_ecc_pullx_pt = nullptr;
-  m_sct_b0_xresvsmodetaphi_3d = nullptr;
-  m_sct_b1_xresvsmodetaphi_3d = nullptr;
-  m_sct_b2_xresvsmodetaphi_3d = nullptr;
-  m_sct_b3_xresvsmodetaphi_3d = nullptr;
-
-  m_si_residualx = nullptr;
-  m_si_b_residualx = nullptr;
-
-  m_si_barrel_resX_mean = nullptr;
-  m_si_eca_resX_mean = nullptr;
-  m_si_ecc_resX_mean = nullptr;
-  m_si_barrel_resY_mean = nullptr;
-  m_si_eca_resY_mean = nullptr;
-  m_si_ecc_resY_mean = nullptr;
-
-  m_si_barrel_resX_mean_profile = nullptr;
-  m_si_barrel_resY_mean_profile = nullptr;
-
-
-  m_si_barrel_resX_rms = nullptr;
-  m_si_eca_resX_rms = nullptr;
-  m_si_ecc_resX_rms = nullptr;
-  m_si_barrel_resY_rms = nullptr;
-  m_si_eca_resY_rms = nullptr;
-  m_si_ecc_resY_rms = nullptr;
-
-  m_si_barrel_pullX = nullptr;
-  m_si_eca_pullX = nullptr;
-  m_si_ecc_pullX = nullptr;
-  m_si_barrel_pullY = nullptr;
-  m_si_eca_pullY = nullptr;
-  m_si_ecc_pullY = nullptr;
-
-  m_si_barrel_resX = nullptr;
-  m_si_eca_resX = nullptr;
-  m_si_ecc_resX = nullptr;
-  m_si_barrel_resY = nullptr;
-  m_si_eca_resY = nullptr;
-  m_si_ecc_resY = nullptr;
-
-  m_si_barrel_pullX_width = nullptr;
-  m_si_eca_pullX_width = nullptr;
-  m_si_ecc_pullX_width = nullptr;
-  m_si_barrel_pullY_width = nullptr;
-  m_si_eca_pullY_width = nullptr;
-  m_si_ecc_pullY_width = nullptr;
-
-  m_si_barrel_pullX_mean = nullptr;
-  m_si_eca_pullX_mean = nullptr;
-  m_si_ecc_pullX_mean = nullptr;
-  m_si_barrel_pullY_mean = nullptr;
-  m_si_eca_pullY_mean = nullptr;
-  m_si_ecc_pullY_mean = nullptr;
-  m_pix_b_residualx = nullptr;
-  m_pix_b_residualy = nullptr;
-  m_pix_b_residualx_fine = nullptr;
-  m_pix_b_residualy_fine = nullptr;
-  m_pix_b_biased_residualx = nullptr;
-  m_pix_b_biased_residualy = nullptr;
-  m_pix_eca_residualx = nullptr;
-  m_pix_eca_residualy = nullptr;
-  m_pix_ecc_residualx = nullptr;
-  m_pix_ecc_residualy = nullptr;
-  m_pix_eca_residualx_fine = nullptr;
-  m_pix_eca_residualy_fine = nullptr;
-  m_pix_ecc_residualx_fine = nullptr;
-  m_pix_ecc_residualy_fine = nullptr;
-
-  m_pix_eca_pullx = nullptr;
-  m_pix_eca_pully = nullptr;
-  m_pix_ecc_pullx = nullptr;
-  m_pix_ecc_pully = nullptr;
-  m_pix_bec_Oxresx_mean = nullptr;
-  m_pix_bec_Oyresx_mean = nullptr;
-  m_pix_bec_Oxresy_mean = nullptr;
-  m_pix_bec_Oyresy_mean = nullptr;
-  m_pix_bec_Oxresx_rms = nullptr;
-  m_pix_bec_Oyresx_rms = nullptr;
-  m_pix_bec_Oxresy_rms = nullptr;
-  m_pix_bec_Oyresy_rms = nullptr;
-
-  m_pix_b_xresvsmodeta = nullptr;
-  m_pix_b_xresvsmodphi = nullptr;
-  m_pix_b_yresvsmodeta = nullptr;
-  m_pix_b_yresvsmodphi = nullptr;
-  m_pix_eca_xresvsmodphi = nullptr;
-  m_pix_ecc_xresvsmodphi = nullptr;
-  m_pix_eca_yresvsmodphi = nullptr;
-  m_pix_ecc_yresvsmodphi = nullptr;
-  m_pix_b_biased_residualx_pt = nullptr;
-  m_pix_b_biased_residualy_pt = nullptr;
-  m_pix_eca_biased_residualx = nullptr;
-  m_pix_eca_biased_residualy = nullptr;
-  m_pix_eca_biased_residualx_pt = nullptr;
-  m_pix_eca_biased_residualy_pt = nullptr;
-  m_pix_ecc_biased_residualx = nullptr;
-  m_pix_ecc_biased_residualy = nullptr;
-  m_pix_ecc_biased_residualx_pt = nullptr;
-  m_pix_ecc_biased_residualy_pt = nullptr;
-  m_pix_eca_xresvsmodphi_2d = nullptr;
-  m_pix_ecc_xresvsmodphi_2d = nullptr;
-  m_pix_eca_yresvsmodphi_2d = nullptr;
-  m_pix_ecc_yresvsmodphi_2d = nullptr;
-
-  m_pix_b_Oxresxvsmodeta = nullptr;
-  m_pix_b_Oxresxvsmodphi = nullptr;
-  m_pix_b_Oyresyvsmodeta = nullptr;
-  m_pix_b_Oyresyvsmodphi = nullptr;
-  m_pix_eca_Oxresxvsmodphi = nullptr;
-  m_pix_ecc_Oxresxvsmodphi = nullptr;
-  m_pix_eca_Oyresyvsmodphi = nullptr;
-  m_pix_ecc_Oyresyvsmodphi = nullptr;
-  m_pix_eca_unbiased_xresvsmodphi = nullptr;
-  m_pix_eca_unbiased_yresvsmodphi = nullptr;
-  m_pix_ecc_unbiased_xresvsmodphi = nullptr;
-  m_pix_ecc_unbiased_yresvsmodphi = nullptr;
-  m_sct_b_residualx = nullptr;
-  m_sct_b_residualx_fine = nullptr;
-  m_sct_b_biasedresidualx = nullptr;
-  m_sct_eca_residualx = nullptr;
-  m_sct_ecc_residualx = nullptr;
-  m_sct_eca_residualx_fine = nullptr;
-  m_sct_ecc_residualx_fine = nullptr;
-
-  m_sct_eca_pullx = nullptr;
-  m_sct_ecc_pullx = nullptr;
-
-  m_sct_bec_Oxresx_mean = nullptr;
-  m_sct_bec_Oyresx_mean = nullptr;
-  m_sct_bec_Oxresx_rms = nullptr;
-  m_sct_bec_Oyresx_rms = nullptr;
-
-  m_sct_eca_xresvsmodphi_2d = nullptr;
-  m_sct_ecc_xresvsmodphi_2d = nullptr;
-
-  m_sct_b_xresvsmodeta = nullptr;
-  m_sct_b_xresvsmodphi = nullptr;
-  m_sct_eca_xresvsmodphi = nullptr;
-  m_sct_ecc_xresvsmodphi = nullptr;
-
-  m_sct_b_Oxresxvsmodeta = nullptr;
-  m_sct_b_Oxresxvsmodphi = nullptr;
-  m_sct_b_Oyresxvsmodeta = nullptr;
-  m_sct_b_Oyresxvsmodphi = nullptr;
-  m_sct_eca_Oxresxvsmodphi = nullptr;
-  m_sct_ecc_Oxresxvsmodphi = nullptr;
-  m_pix_b_residualx_pt = nullptr;
-  m_pix_b_residualy_pt = nullptr;
-  m_pix_eca_residualx_pt = nullptr;
-  m_pix_eca_residualy_pt = nullptr;
-  m_pix_ecc_residualx_pt = nullptr;
-  m_pix_ecc_residualy_pt = nullptr;
-
-  m_sct_b_biased_residualx = nullptr;
-  m_sct_b_biased_residualx_pt = nullptr;
-  m_sct_b_residualx_pt = nullptr;
-  m_sct_b_biased_residualx_qoverp2 = nullptr;
-  m_sct_b_unbiased_residualx_qoverp2 = nullptr;
-
-  m_sct_eca_biased_residualx = nullptr;
-  m_sct_eca_biased_residualy = nullptr;
-  m_sct_ecc_biased_residualx = nullptr;
-  m_sct_ecc_biased_residualy = nullptr;
-
-  m_sct_eca_biased_residualx_pt = nullptr;
-  m_sct_ecc_biased_residualx_pt = nullptr;
-
-  m_sct_eca_residualx_pt = nullptr;
-  m_sct_ecc_residualx_pt = nullptr;
-
-  m_sct_eca_biased_residualx_qoverp2 = nullptr;
-  m_sct_ecc_biased_residualx_qoverp2 = nullptr;
-
-  m_sct_eca_unbiased_residualx_qoverp2 = nullptr;
-  m_sct_ecc_unbiased_residualx_qoverp2 = nullptr;
-  // Local positions (extrapolated)
-  m_pix_b_extrapolated_localx = nullptr;
-  m_pix_b_extrapolated_localy = nullptr;
-  m_sct_b_extrapolated_st_localx = nullptr;
-  m_sct_b_extrapolated_st_localy = nullptr;
-  m_sct_b_extrapolated_nst_localx = nullptr;
-  m_sct_b_extrapolated_nst_localy = nullptr;
-
-  // Local positions (mesasured)
-  m_pix_b_measured_localx = nullptr;
-  m_pix_b_measured_localy = nullptr;
-  m_sct_b_measured_st_localx = nullptr;
-  m_sct_b_measured_st_localy = nullptr;
-  m_sct_b_measured_nst_localx = nullptr;
-  m_sct_b_measured_nst_localy = nullptr;
-
-
-  // Hit errors
-
-  m_hiterror_sct_b = nullptr;
-  m_hiterror_sct_ec = nullptr;
-  m_hiterror_sct_b_WideRange = nullptr;
-  m_hiterror_sct_ec_WideRange = nullptr;
-
-  m_hiterror_x_pix_b = nullptr;
-  m_hiterror_x_pix_ec = nullptr;
-  m_hiterror_x_pix_eca = nullptr;
-  m_hiterror_x_pix_ecc = nullptr;
-  m_hiterror_y_pix_b = nullptr;
-  m_hiterror_y_pix_ec = nullptr;
-  m_hiterror_y_pix_eca = nullptr;
-  m_hiterror_y_pix_ecc = nullptr;
-
-  m_hiterror_x_pix_b_WideRange = nullptr;
-  m_hiterror_x_pix_ec_WideRange = nullptr;
-  m_hiterror_y_pix_b_WideRange = nullptr;
-  m_hiterror_y_pix_ec_WideRange = nullptr;
-
-  m_hiterror_x_ibl_b = nullptr;
-  m_hiterror_x_ibl_ec = nullptr;
-  m_hiterror_y_ibl_b = nullptr;
-  m_hiterror_y_ibl_ec = nullptr;
-
-  m_hiterror_x_ibl_b_WideRange = nullptr;
-  m_hiterror_x_ibl_ec_WideRange = nullptr;
-  m_hiterror_y_ibl_b_WideRange = nullptr;
-  m_hiterror_y_ibl_ec_WideRange = nullptr;
-
-  // Pulls vs pt
-  // Pixel
-
-  m_pix_b_pullx_pt = nullptr;
-  m_pix_b_pully_pt = nullptr;
-  m_pix_eca_pullx_pt = nullptr;
-  m_pix_eca_pully_pt = nullptr;
-  m_pix_ecc_pullx_pt = nullptr;
-  m_pix_ecc_pully_pt = nullptr;
-}
-
-StatusCode IDAlignMonResiduals::initialize() {
-  m_events = 0;
-  m_histosBooked = 0;
-
-  // initialize ranges of residual histograms
-  if (m_maxPIXResXFillRange == 0.) m_maxPIXResXFillRange = m_maxSiResFillRange;
-  if (m_minPIXResXFillRange == 0.) m_minPIXResXFillRange = m_minSiResFillRange;
-  if (m_maxPIXResYFillRange == 0.) m_maxPIXResYFillRange = m_maxSiResFillRange;
-  if (m_minPIXResYFillRange == 0.) m_minPIXResYFillRange = m_minSiResFillRange; // the pixels are broader in Y (400
-                                                                                // microns) than in X (50 microns)
-  if (m_maxSCTResFillRange == 0.) m_maxSCTResFillRange = m_maxSiResFillRange;
-  if (m_minSCTResFillRange == 0.) m_minSCTResFillRange = m_minSiResFillRange;
-
-  // Detector sizes
-  m_PixelBarrelXSize = 16.44;  // mm
-  m_PixelBarrelYSize = 60.2;  // mm
-  m_SCTBarrelXSize = 61.54;  // mm
-  m_SCTBarrelYSize = 128.;  // mm
-
-  ATH_MSG_VERBOSE(">> Range of histograms: m_minSiResFillRange= " << m_minSCTResFillRange);
-  ATH_MSG_VERBOSE(">> Range of histograms: m_maxSiResFillRange= " << m_maxSCTResFillRange);
-  ATH_MSG_VERBOSE(">> Range of histograms: m_RangeOfPullHistos= " << m_RangeOfPullHistos);
-
-  //initialize tools and services
-  ATH_MSG_DEBUG("Calling initialize() to setup tools/services");
-  StatusCode sc = setupTools();
-  if (sc.isFailure()) {
-    ATH_MSG_WARNING("Failed to initialize tools/services!");
-    return StatusCode::SUCCESS;
-  } else ATH_MSG_DEBUG("Successfully initialized tools/services");
-
-  sc = ManagedMonitorToolBase::initialize();
-  if (sc.isFailure()) {
-    ATH_MSG_WARNING("Failed to initialize ManagedMonitorToolBase!");
-    return StatusCode::SUCCESS;
-  }
-
-  /** Get TRTCalDbTool */
-  ATH_CHECK(m_trtcaldbTool.retrieve());
-
-  // Get the weight histogram
-  if (m_applyHistWeight) {
-    m_hWeightInFile = new TFile(m_hWeightInFileName.c_str(), "read");
-
-    if (m_hWeightInFile->IsZombie() || !(m_hWeightInFile->IsOpen())) {
-      ATH_MSG_FATAL(" Problem reading TFile " << m_hWeightInFileName);
-      return StatusCode::FAILURE;
-    }
-
-    ATH_MSG_INFO("Opened  file containing the contraints" << m_hWeightInFileName);
-
-    m_etapTWeight = (TH2F*) m_hWeightInFile->Get(m_hWeightHistName.c_str());
-    if (!m_etapTWeight) {
-      ATH_MSG_FATAL(" Problem getting constraints Hist.  Name " << m_hWeightHistName);
-      m_hWeightInFile->Close();
-      delete m_hWeightInFile;
-      return StatusCode::FAILURE;
-    }
-  }
-
-  ATH_CHECK(m_eventInfoKey.initialize());
-  ATH_CHECK(m_tracksName.initialize());
-  ATH_CHECK(m_comTimeObjectName.initialize(not m_comTimeObjectName.key().empty()));
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonResiduals::bookHistograms() {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    // book histograms that are only made in the online environment...
-  }
-
-  if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-    // book histograms that are only relevant for cosmics data...
-  }
-
-  std::string outputDirName = "IDAlignMon/" + m_tracksName.key() + "_" + m_triggerChainName + "/Residuals";
-
-  MonGroup al_mon(this, outputDirName, run);
-
-  //if ( newLowStatFlag() ) {    }
-  //if ( newLumiBlockFlag() ) {    }
-  if (newRunFlag()) {
-    //if user environment specified we don't want to book new histograms at every run boundary
-    //we instead want one histogram per job
-    if (m_histosBooked != 0 && AthenaMonManager::environment() == AthenaMonManager::user) return StatusCode::SUCCESS;
-
-    //-----------------------------------
-    //
-    // Pixel and SCT Shifter Histograms
-    //
-    //-----------------------------------
-
-    const Int_t nsilay = 21;
-    TString siliconLayers[nsilay] = {
-      "Pix L0", "Pix L1", "Pix L2", "SCT L0 S0", "S1", "SCT L1 S0", "S1", "SCT L2 S0", "S1", "SCT L3 S0", "S1",
-      "SCT L4 S0", "S1", "SCT L5 S0", "S1", "SCT L6 S0", "S1", "SCT L7 S0", "S1", "SCT L8 S0", "S1"
-    };
-
-    //These histograms are filled in post-processing - only initiated here such that they can be registered as "shift".
-
-    //Residual X mean as a function of silicon (Pixel & SCT on one plot) layer for barrel and endcaps
-    // m_si_barrel_resX_mean = new TH1F("si_barrel_resX_mean","Mean Residual X vs Silicon Barrel Layer;Mean Residual
-    // X",11,-0.5,10.5);
-    //for (int i=1;i<=11;i++) m_si_barrel_resX_mean->GetXaxis()->SetBinLabel(i,siliconLayers[i-1]);
-    //RegisterHisto(al_mon,m_si_barrel_resX_mean);
-    m_si_eca_resX_mean = new TH1F("si_eca_resX_mean", "Mean Residual X vs Silicon ECA Layer; Mean Residual X", nsilay,
-                                  -0.5, nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_resX_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_eca_resX_mean);
-    m_si_ecc_resX_mean = new TH1F("si_ecc_resX_mean", "Mean Residual X vs Silicon ECC Layer; Mean Residual X", nsilay,
-                                  -0.5, nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_resX_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_ecc_resX_mean);
-
-
-    m_si_eca_resY_mean = new TH1F("si_eca_resY_mean", "Mean Residual Y vs Silicon ECA Layer;Mean Residual Y", nsilay,
-                                  -0.5, nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_resY_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_eca_resY_mean);
-    m_si_ecc_resY_mean = new TH1F("si_ecc_resY_mean", "Mean Residual Y vs Silicon ECC Layer;Mean Residual Y", nsilay,
-                                  -0.5, nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_resY_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_ecc_resY_mean);
-
-
-    //-----------------------------------
-    //
-    // Pixel and SCT Shift Detail Histograms
-    //
-    //-----------------------------------
-
-    //these go into the DQMF Shift Detail folder - DQMF tests are run on these histograms but the shifter
-    //does not look at them unless they fail
-
-    //These histograms are filled in post-processing - only initiated here such that they can be registered as "shift".
-    //Width of Gaussian fit to pull distribution in each layer of the silicon
-    //m_si_barrel_pullX_width = new TH1F("si_barrel_pullX_width","Pull X Gaussian Width vs Silicon Barrel
-    // Layer",11,-0.5,10.5);
-    //for (int i=1;i<=11;i++) m_si_barrel_pullX_width->GetXaxis()->SetBinLabel(i,siliconLayers[i-1]);
-    //m_si_barrel_pullX_width->GetYaxis()->SetTitle("Pull X Gaussian Width");
-    //RegisterHisto(al_mon,m_si_barrel_pullX_width);
-    m_si_eca_pullX_width = new TH1F("si_eca_pullX_width", "Pull X Gaussian Width vs Silicon ECA Layer", nsilay, -0.5,
-                                    nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_pullX_width->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    m_si_eca_pullX_width->GetYaxis()->SetTitle("Pull X Gaussian Width");
-    RegisterHisto(al_mon, m_si_eca_pullX_width);
-    m_si_ecc_pullX_width = new TH1F("si_ecc_pullX_width", "Pull X Gaussian Width vs Silicon ECC Layer", nsilay, -0.5,
-                                    nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_pullX_width->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    m_si_ecc_pullX_width->GetYaxis()->SetTitle("Pull X Gaussian Width");
-    RegisterHisto(al_mon, m_si_ecc_pullX_width);
-
-    m_si_eca_pullY_width = new TH1F("si_eca_pullY_width", "Pull Y Gaussian Width vs Silicon ECA Layer", nsilay, -0.5,
-                                    nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_pullY_width->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    m_si_eca_pullY_width->GetYaxis()->SetTitle("Pull Y Gaussian Width");
-    RegisterHisto(al_mon, m_si_eca_pullY_width);
-    m_si_ecc_pullY_width = new TH1F("si_ecc_pullY_width", "Pull Y Gaussian Width vs Silicon ECC Layer", nsilay, -0.5,
-                                    nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_pullY_width->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    m_si_ecc_pullY_width->GetYaxis()->SetTitle("Pull Y Gaussian Width");
-    RegisterHisto(al_mon, m_si_ecc_pullY_width);
-
-    //These histograms are filled in post-processing - only initiated here such that they can be registered as "shift".
-    //Residual X RMS as a function of silicon (Pixel & SCT on one plot) layer for barrel and endcaps
-    //m_si_barrel_resX_rms = new TH1F("si_barrel_resX_rms","Residual X RMS vs Silicon Barrel Layer",11,-0.5,10.5);
-    //for (int i=1;i<=11;i++) m_si_barrel_resX_rms->GetXaxis()->SetBinLabel(i,siliconLayers[i-1]);
-    //m_si_barrel_resX_rms->GetYaxis()->SetTitle("Residual X RMS");
-    //RegisterHisto(al_mon,m_si_barrel_resX_rms);
-    m_si_eca_resX_rms = new TH1F("si_eca_resX_rms", "Residual X RMS vs Silicon ECA Layer", nsilay, -0.5, nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_resX_rms->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    m_si_eca_resX_rms->GetYaxis()->SetTitle("Residual X RMS");
-    RegisterHisto(al_mon, m_si_eca_resX_rms);
-    m_si_ecc_resX_rms = new TH1F("si_ecc_resX_rms", "Residual X RMS vs Silicon ECC Layer", nsilay, -0.5, nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_resX_rms->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    m_si_ecc_resX_rms->GetYaxis()->SetTitle("Residual X RMS");
-    RegisterHisto(al_mon, m_si_ecc_resX_rms);
-    //Residual Y (only Pixel is filled currently - don't have SCT Y residuals yet)
-
-    m_si_eca_resY_rms = new TH1F("si_eca_resY_rms", "Residual Y RMS vs Silicon ECA Layer", nsilay, -0.5, nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_resY_rms->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    m_si_eca_resY_rms->GetYaxis()->SetTitle("Residual Y RMS");
-    RegisterHisto(al_mon, m_si_eca_resY_rms);
-    m_si_ecc_resY_rms = new TH1F("si_ecc_resY_rms", "Residual Y RMS vs Silicon ECC Layer", nsilay, -0.5, nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_resY_rms->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    m_si_ecc_resY_rms->GetYaxis()->SetTitle("Residual Y RMS");
-    RegisterHisto(al_mon, m_si_ecc_resY_rms);
-
-    //-----------------------------------
-    //
-    // Pixel and SCT Expert Histograms
-    //
-    //-----------------------------------
-
-    //histogram to record numer of hits which we have problems with ResidualPullCalculator
-    m_sirescalcfailure = new TH1F("sirescalcfailure", "Failed ResidualPullCalc DetType", 2, 0, 2);
-    RegisterHisto(al_mon, m_sirescalcfailure);
-
-    //Si (Pix & SCT) residual histograms
-    m_si_residualx = new TH1F("si_residualx", "Silicon UnBiased X Residual", 100, m_minSiResFillRange,
-                              m_maxSiResFillRange);
-    RegisterHisto(al_mon, m_si_residualx);
-    m_si_b_residualx = new TH1F("si_b_residualx", "Silicon Barrel Only UnBiased X Residual", 100, m_minSiResFillRange,
-                                m_maxSiResFillRange);
-    RegisterHisto(al_mon, m_si_b_residualx);
-
-    //Pull 2D histograms for filling of Pull Gaussian width and mean plots in post-processing
-
-    m_si_eca_pullX = new TH2F("si_eca_pullX", "Pull X vs Silicon ECA Layer", nsilay, -0.5, nsilay - 0.5, 50,
-                              -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_pullX->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_eca_pullX);
-    m_si_ecc_pullX = new TH2F("si_ecc_pullX", "Pull X vs Silicon ECC Layer", nsilay, -0.5, nsilay - 0.5, 50,
-                              -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_pullX->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_ecc_pullX);
-
-    m_si_eca_pullY = new TH2F("si_eca_pullY", "Pull Y vs Silicon ECA Layer", nsilay, -0.5, nsilay - 0.5, 50,
-                              -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_pullY->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_eca_pullY);
-    m_si_ecc_pullY = new TH2F("si_ecc_pullY", "Pull Y vs Silicon ECC Layer", nsilay, -0.5, nsilay - 0.5, 50,
-                              -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_pullY->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_ecc_pullY);
-
-    //Residual 2D histograms for filling of Residual Gaussian width and mean plots in post-processing
-
-    m_si_eca_resX = new TH2F("si_eca_resX", "Residual X vs Silicon ECA Layer", nsilay, -0.5, nsilay - 0.5,
-                             100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_resX->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_eca_resX);
-    m_si_ecc_resX = new TH2F("si_ecc_resX", "Residual X vs Silicon ECC Layer", nsilay, -0.5, nsilay - 0.5,
-                             100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_resX->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_ecc_resX);
-
-    m_si_eca_resY = new TH2F("si_eca_resY", "Residual Y vs Silicon ECA Layer", nsilay, -0.5, nsilay - 0.5,
-                             100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_resY->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_eca_resY);
-    m_si_ecc_resY = new TH2F("si_ecc_resY", "Residual Y vs Silicon ECC Layer", nsilay, -0.5, nsilay - 0.5,
-                             100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_resY->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_ecc_resY);
-
-    //These histograms are filled in post-processing - only initiated here such that they can be registered to dqm
-    //mean of Gaussian fit to pull distribution in each layer of the silicon
-
-    m_si_eca_pullX_mean = new TH1F("si_eca_pullX_mean", "Pull X Gaussian Mean vs Silicon ECA Layer", nsilay, -0.5,
-                                   nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_pullX_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_eca_pullX_mean);
-    m_si_ecc_pullX_mean = new TH1F("si_ecc_pullX_mean", "Pull X Gaussian Mean vs Silicon ECC Layer", nsilay, -0.5,
-                                   nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_pullX_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_ecc_pullX_mean);
-
-    m_si_eca_pullY_mean = new TH1F("si_eca_pullY_mean", "Pull Y Gaussian Mean vs Silicon ECA Layer", nsilay, -0.5,
-                                   nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_eca_pullY_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_eca_pullY_mean);
-    m_si_ecc_pullY_mean = new TH1F("si_ecc_pullY_mean", "Pull Y Gaussian Mean vs Silicon ECC Layer", nsilay, -0.5,
-                                   nsilay - 0.5);
-    for (int i = 1; i <= nsilay; i++) m_si_ecc_pullY_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
-    RegisterHisto(al_mon, m_si_ecc_pullY_mean);
-
-    //Overlap Residual Plots - Pixel Mean and RMS vs Layer histograms (concatenated - both barrel and endcaps in one
-    // plot)
-    m_pix_bec_Oxresx_mean = new TProfile("pix_bec_Oxresx_mean",
-                                         "X_Overlap Residual X Mean vs Pixel Layer (ECC, Barrel, ECA)", 11, -3.0, 8.0,
-                                         m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_bec_Oxresx_mean);
-    m_pix_bec_Oxresx_rms = new TProfile("pix_bec_Oxresx_rms",
-                                        "X_Overlap Residual X RMS vs Pixel Layer (ECC, Barrel, ECA)", 11, -3.0, 8.0,
-                                        m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_bec_Oxresx_rms);
-    m_pix_bec_Oxresy_mean = new TProfile("pix_bec_Oxresy_mean",
-                                         "X_Overlap Residual Y Mean vs Pixel Layer (ECC, Barrel, ECA)", 11, -3.0, 8.0,
-                                         m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_bec_Oxresy_mean);
-    m_pix_bec_Oxresy_rms = new TProfile("pix_bec_Oxresy_rms",
-                                        "X_Overlap Residual Y RMS vs Pixel Layer (ECC, Barrel, ECA)", 11, -3.0, 8.0,
-                                        m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_bec_Oxresy_rms);
-
-    m_pix_bec_Oyresy_mean = new TProfile("pix_bec_Oyresy_mean",
-                                         "Y_Overlap Residual Y Mean vs Pixel Layer (ECC, Barrel, ECA)", 11, -3.0, 8.0,
-                                         m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_bec_Oyresy_mean);
-    m_pix_bec_Oyresy_rms = new TProfile("pix_bec_Oyresy_rms",
-                                        "Y_Overlap Residual Y RMS vs Pixel Layer (ECC, Barrel, ECA)", 11, -3.0, 8.0,
-                                        m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_bec_Oyresy_rms);
-    m_pix_bec_Oyresx_mean = new TProfile("pix_bec_Oyresx_mean",
-                                         "Y_Overlap Residual X Mean vs Pixel Layer (ECC, Barrel, ECA)", 11, -3.0, 8.0,
-                                         m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_bec_Oyresx_mean);
-    m_pix_bec_Oyresx_rms = new TProfile("pix_bec_Oyresx_rms",
-                                        "Y_Overlap Residual X RMS vs Pixel Layer (ECC, Barrel, ECA)", 11, -3.0, 8.0,
-                                        m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_bec_Oyresx_rms);
-
-
-    //Overlap Residual Plots - SCT Mean and RMS vs Layer histograms (concatenated - both barrel and endcaps in one plot)
-    m_sct_bec_Oxresx_mean = new TProfile("sct_bec_Oxresx_mean",
-                                         "X_Overlap Residual X Mean vs SCT Layer (ECC, Barrel, ECA)", 24, -9.0, 15.0,
-                                         m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_bec_Oxresx_mean);
-    m_sct_bec_Oxresx_rms = new TProfile("sct_bec_Oxresx_rms",
-                                        "X_Overlap Residual X RMS vs SCT Layer (ECC, Barrel, ECA)", 24, -9.0, 15.0,
-                                        m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_bec_Oxresx_rms);
-    m_sct_bec_Oyresx_mean = new TProfile("sct_bec_Oyresx_mean",
-                                         "Y_Overlap Residual X Mean vs SCT Layer (ECC, Barrel, ECA)", 24, -9.0, 15.0,
-                                         m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_bec_Oyresx_mean);
-    m_sct_bec_Oyresx_rms = new TProfile("sct_bec_Oyresx_rms",
-                                        "Y_Overlap Residual X RMS vs SCT Layer (ECC, Barrel, ECA)", 24, -9.0, 15.0,
-                                        m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_bec_Oyresx_rms);
-
-    //Special histograms
-    if (m_extendedPlots) {
-      m_totalEvents = new TH1F("TotalEvents", "TotalEvents", 1, -0.5, 0.5);
-      RegisterHisto(al_mon, m_totalEvents);
-
-      m_hTotalTracks = new TH1F("TotalTracks", "TotalTracks", 1, -0.5, 0.5);
-      RegisterHisto(al_mon, m_hTotalTracks);
-
-      m_mu_perEvent = new TH1F("mu_perEvent", "<#mu> per event", m_nBinsMuRange, m_muRangeMin, m_muRangeMax);
-      RegisterHisto(al_mon, m_mu_perEvent);
-    }
-    //Lumi wise histo
-
-    //All modules
-    m_pix_b0_resXvsetaLumiBlock = new TProfile2D("pix_b0_resXvsetaLumiBlock",
-                                                 "2D profile of X unbiased residuals vs IBL eta module per Lumi Block; LumiBlock;Module Eta",
-                                                 m_nBinsLB, m_LBRangeMin, m_LBRangeMax,
-                                                 20, -10.5, 9.5,
-                                                 m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock);
-
-    //Only planars
-
-    m_pix_b0_resXvsetaLumiBlock_planars = new TProfile2D("pix_b0_resXvsetaLumiBlock_planars",
-                                                         "2D profile of X unbiased residuals vs IBL eta module per Lumi Block;LumiBlock; Module Eta",
-                                                         m_nBinsLB, m_LBRangeMin, m_LBRangeMax,
-                                                         12, -6.5, 5.5,
-                                                         m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_planars);
-
-
-    if (m_doIBLLBPlots) {
-      //All modules
-      m_pix_b0_resXvsetaLumiBlock_3d = new TH3F("pix_b0_resXvsetaLumiBlock_3d",
-                                                "TH3 of X unbiased residuals vs IBL eta module per Lumi Block; LumiBlock;Module Eta",
-                                                m_nBinsLB, m_LBRangeMin, m_LBRangeMax,
-                                                20, -10.5, 9.5,
-                                                50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_3d);
-
-      //Only planars
-
-      m_pix_b0_resXvsetaLumiBlock_planars_3d = new TH3F("pix_b0_resXvsetaLumiBlock_planars_3d",
-                                                        "TH3 of X unbiased residuals vs IBL eta module per Lumi Block;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 12, -6.5, 5.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                        m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_planars_3d);
-
-      m_pix_b0_resXvsetaLumiBlock_stave0 = new TH3F("pix_b0_resXvsetaLumiBlock_stave0",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 0;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave0);
-
-      m_pix_b0_resXvsetaLumiBlock_stave1 = new TH3F("pix_b0_resXvsetaLumiBlock_stave1",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 1;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave1);
-
-      m_pix_b0_resXvsetaLumiBlock_stave2 = new TH3F("pix_b0_resXvsetaLumiBlock_stave2",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 2;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave2);
-
-      m_pix_b0_resXvsetaLumiBlock_stave3 = new TH3F("pix_b0_resXvsetaLumiBlock_stave3",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 3;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave3);
-
-      m_pix_b0_resXvsetaLumiBlock_stave4 = new TH3F("pix_b0_resXvsetaLumiBlock_stave4",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 4;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave4);
-
-      m_pix_b0_resXvsetaLumiBlock_stave5 = new TH3F("pix_b0_resXvsetaLumiBlock_stave5",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 5;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave5);
-
-      m_pix_b0_resXvsetaLumiBlock_stave6 = new TH3F("pix_b0_resXvsetaLumiBlock_stave6",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 6;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave6);
-
-      m_pix_b0_resXvsetaLumiBlock_stave7 = new TH3F("pix_b0_resXvsetaLumiBlock_stave7",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 7;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave7);
-
-      m_pix_b0_resXvsetaLumiBlock_stave8 = new TH3F("pix_b0_resXvsetaLumiBlock_stave8",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 8;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave8);
-
-      m_pix_b0_resXvsetaLumiBlock_stave9 = new TH3F("pix_b0_resXvsetaLumiBlock_stave9",
-                                                    "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 9;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                    m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave9);
-
-      m_pix_b0_resXvsetaLumiBlock_stave10 = new TH3F("pix_b0_resXvsetaLumiBlock_stave10",
-                                                     "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 10;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                     m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave10);
-
-      m_pix_b0_resXvsetaLumiBlock_stave11 = new TH3F("pix_b0_resXvsetaLumiBlock_stave11",
-                                                     "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 11;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                     m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave11);
-
-      m_pix_b0_resXvsetaLumiBlock_stave12 = new TH3F("pix_b0_resXvsetaLumiBlock_stave12",
-                                                     "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 12;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                     m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave12);
-
-      m_pix_b0_resXvsetaLumiBlock_stave13 = new TH3F("pix_b0_resXvsetaLumiBlock_stave13",
-                                                     "TH3 of X unbiased residuals vs IBL eta module per Lumi Block for stave 13;LumiBlock; Module Eta", m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 20, -10.5, 9.5, 50 * m_FinerBinningFactor, m_minPIXResXFillRange,
-                                                     m_maxPIXResXFillRange);
-      RegisterHisto(al_mon, m_pix_b0_resXvsetaLumiBlock_stave13);
-    }
-
-
-    //mag + base as function of lb
-
-    m_mag_vs_LB = new TH1F("mag_vs_LB", "IBL 2pi averaged bowing magnitude vs LumiBlock;LumiBlock;Magnitude [mm]",
-                           m_nBinsLB, m_LBRangeMin, m_LBRangeMax);
-    RegisterHisto(al_mon, m_mag_vs_LB);
-
-    m_base_vs_LB = new TH1F("base_vs_LB", "IBL 2pi averaged bowing baseline vs LumiBlock;LumiBlock;Baseline [mm]",
-                            m_nBinsLB, m_LBRangeMin, m_LBRangeMax);
-    RegisterHisto(al_mon, m_base_vs_LB);
-
-
-    m_mag_vs_LB_planars = new TH1F("mag_vs_LB_planars",
-                                   "IBL 2pi averaged bowing magnitude vs LumiBlock;LumiBlock;Magnitude [mm]", m_nBinsLB,
-                                   m_LBRangeMin, m_LBRangeMax);
-    RegisterHisto(al_mon, m_mag_vs_LB_planars);
-
-    m_base_vs_LB_planars = new TH1F("base_vs_LB_planars",
-                                    "IBL 2pi averaged bowing baseline vs LumiBlock;LumiBlock;Baseline [mm]", m_nBinsLB,
-                                    m_LBRangeMin, m_LBRangeMax);
-    RegisterHisto(al_mon, m_base_vs_LB_planars);
-
-
-    ATH_MSG_VERBOSE(" INITIALIZED GENERALHISTOS FOR RESIDUALS ");
-    //PrintIBLGeometry();
-    MakePIXBarrelHistograms(al_mon);
-    MakePIXEndCapsHistograms(al_mon);
-    MakeSCTBarrelHistograms(al_mon);
-    MakeSCTEndcapsHistograms(al_mon);
-
-    //The TRT Histograms
-    MakeTRTHistograms(al_mon);
-
-    MakeSiliconHistograms(al_mon);
-    ATH_MSG_VERBOSE(" INITIALIZED GENERALHISTOS FOR RESIDUALS ");
-    ++m_histosBooked;
-  }
-
-  ATH_MSG_VERBOSE(" Residual histograms booking COMPLETED");
-  return StatusCode::SUCCESS;
-}
-
-/** Convert from an int to a string */
-std::string IDAlignMonResiduals::intToString(int input) {
-  std::ostringstream stm;
-  stm << input;
-  return stm.str();
-}
-
-/** Make Histograms */
-TH1F_LW* IDAlignMonResiduals::MakeHist(const std::string& name, const std::string& title, int nBins, float xLow,
-                                       float xUp, const std::string& xAxisTitle, const std::string& yAxisTitle) {
-  TH1F_LW* hist = TH1F_LW::create(name.c_str(), title.c_str(), nBins, xLow, xUp);
-
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->GetXaxis()->SetTitle(xAxisTitle.c_str());
-  hist->GetYaxis()->SetTitle(yAxisTitle.c_str());
-  return hist;
-}
-
-TH2F* IDAlignMonResiduals::MakeHist(const std::string& name, const std::string& title, int nXBins, float xLow,
-                                    float xUp, int nYBins, float yLow, float yUp, const std::string& xAxisTitle,
-                                    const std::string& yAxisTitle) {
-  TH2F* hist = new TH2F(name.c_str(), title.c_str(), nXBins, xLow, xUp, nYBins, yLow, yUp);
-
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->GetXaxis()->SetTitle(xAxisTitle.c_str());
-  hist->GetYaxis()->SetTitle(yAxisTitle.c_str());
-  return hist;
-}
-
-/** Make Profiles */
-TProfile* IDAlignMonResiduals::MakeProfile(const std::string& name, const std::string& title, int nBins, float xLow,
-                                           float xUp, float yLow, float yUp, const std::string& xAxisTitle,
-                                           const std::string& yAxisTitle, bool setMinZero) {
-  TProfile* profile = new TProfile(name.c_str(), title.c_str(), nBins, xLow, xUp, yLow, yUp);
-
-  if (setMinZero) profile->SetMinimum(0);
-  profile->GetXaxis()->SetLabelSize(0.03);
-  profile->GetYaxis()->SetLabelSize(0.03);
-  profile->GetXaxis()->SetTitle(xAxisTitle.c_str());
-  profile->GetYaxis()->SetTitle(yAxisTitle.c_str());
-
-  return profile;
-}
-
-void IDAlignMonResiduals::RegisterHisto(MonGroup& mon, TProfile2D* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile2D Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonResiduals::RegisterHisto(MonGroup& mon, TH3* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH3 Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonResiduals::RegisterHisto(MonGroup& mon, TH1* histo) {
-  //histo->Sumw2(); this uses a lot of memory and isn't needed!
-  histo->SetOption("e");
-  StatusCode sc = mon.regHist(histo);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonResiduals::RegisterHisto(MonGroup& mon, TH1F_LW* histo) {
-  //histo->Sumw2(); this uses a lot of memory and isn't needed!
-  //histo->SetOption("e");
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1F_LW Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonResiduals::RegisterHisto(MonGroup& mon, TProfile* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonResiduals::RegisterHisto(MonGroup& mon, TH2* histo) {
-  //histo->Sumw2(); this uses a lot of memory and isn't needed!
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH2 Histogram:" << endmsg;
-  }
-}
-
-//---------------------------------------------------------------------------------------
-StatusCode IDAlignMonResiduals::fillHistograms() {
-  const EventContext& ctx = Gaudi::Hive::currentContext();
-
-  ++m_events;
-  ATH_MSG_DEBUG(
-    "IDAlignMonResiduals::fillHistograms ** START ** call for m_events " << m_events << " for track collection: " <<
-      m_tracksName.key());
-
-  m_hasBeenCalledThisEvent = false;
-  m_mu = 0.;
-
-  SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey, ctx);
-
-  m_changedlumiblock = false;
-  if (eventInfo.isValid()) {
-    m_lumiblock = eventInfo->lumiBlock();
-    if (m_lumiblock != m_oldlumiblock) {  //Changes every m_LBGranularity
-      m_oldlumiblock = m_lumiblock;
-      m_changedlumiblock = true;
-    }
-  } else {
-    ATH_MSG_DEBUG("IDAlignMonResiduals::fillHistograms ** eventInfo retrieving failure");
-  }
-
-  if (!m_hasBeenCalledThisEvent) {
-    m_mu = lbAverageInteractionsPerCrossing();
-    m_hasBeenCalledThisEvent = true;
-  } else {
-    m_mu = -999;
-  }
-  ATH_MSG_DEBUG("IDAlignMonResiduals::fillHistograms ** run number: " << eventInfo->runNumber()
-                                                                      << "  event number: " << eventInfo->eventNumber()
-                                                                      << "   lumiblock: " << m_lumiblock << "  mu: " <<
-    m_mu);
-
-  if (m_extendedPlots) {
-    m_mu_perEvent->Fill(m_mu);
-    m_totalEvents->Fill(0.);
-  }
-
-  float timeCor = 0.;
-  if (not m_comTimeObjectName.key().empty()) {
-    SG::ReadHandle<ComTime> theComTime {
-      m_comTimeObjectName
-    };
-    if (theComTime.isValid()) {
-      ATH_MSG_DEBUG("ComTime object found successfully ");
-      timeCor = theComTime->getTime();
-    } else {
-      ATH_MSG_DEBUG("ComTime object not found with name " << m_comTimeObjectName.key() << "!!!");
-      //return StatusCode::FAILURE;
-    }
-  }
-
-  SG::ReadHandle<TrackCollection> inputTracks {
-    m_tracksName
-  };
-  if (not inputTracks.isValid()) {
-    ATH_MSG_DEBUG("IDAlignMonResiduals::fillHistograms ** " << m_tracksName.key() << " could not be retrieved");
-    return StatusCode::RECOVERABLE;
-  }
-
-  const DataVector<Trk::Track>* tracks = m_trackSelection->selectTracks(inputTracks);
-  ATH_MSG_DEBUG("IDAlignMonResiduals::fillHistograms ** event: " << m_events
-                                                                 << "  run: " << eventInfo->runNumber()
-                                                                 << "  event: " << eventInfo->eventNumber()
-                                                                 << "  LB: " << m_lumiblock
-                                                                 << "  --> Track collection " << m_tracksName.key()
-                                                                 << "  has size =" << tracks->size());
-
-  int nTracks = 0;
-
-  for (DataVector<Trk::Track>::const_iterator trackItr = tracks->begin(); trackItr != tracks->end(); ++trackItr) { //looping
-                                                                                                                   // over
-                                                                                                                   // tracks
-    ATH_MSG_DEBUG(" -- looping over track " << nTracks << "/" << tracks->size());
-    //need to get the Trk::Track object from which the TrackParticle object was created
-    //this has the hit information
-    const Trk::Track* track = *trackItr;
-    if (track == nullptr) {
-      ATH_MSG_DEBUG(
-        "** IDAlignMonResiduals::fillHistograms ** No associated Trk::Track object found for track " << nTracks);
-      continue;
-    }
-
-    //check that all TSOS of track have track parameters defined (required to compute residuals/pulls)
-    if (trackRequiresRefit(track)) {
-      ATH_MSG_DEBUG(
-        "** IDAlignMonResiduals::fillHistograms ** Not all TSOS contain track parameters - will be missing residuals/pulls ");
-    } else {
-      ATH_MSG_DEBUG("All TSOS of track " << nTracks << "/" << tracks->size() << " contain track parameters - Good! ");
-    }
-
-    //trackStateOnSurfaces is a vector of Trk::TrackStateOnSurface objects which contain information
-    //on track at each (inner)detector surface it crosses eg hit used to fit track
-    ATH_MSG_DEBUG(
-      "** IDAlignMonResiduals::fillHistograms() ** track: " << nTracks << "  has " << track->trackStateOnSurfaces()->size() <<
-        " TrkSurfaces");
-
-    // Code is able to get a weight from an external file and appy it to all histograms
-    double hweight = 1.;
-    // NB the weight is a "per track" weight, so histograms such as BS info are never weighted
-    int nHits = 0;//counts number of tsos from which we can define residual/pull
-    int nTSOS = -1;//counts all TSOS on the track
-    float trkpt = -999;
-    float trkqoverp2 = -999;
-    float trketa_w = -999;
-    bool countedTrack = false;
-
-    if (m_extendedPlots) {
-      trkqoverp2 = track->perigeeParameters()->parameters()[Trk::qOverP] * fabs(
-        track->perigeeParameters()->parameters()[Trk::qOverP]) * 1000000.;
-    }
-
-    trkpt = (track->perigeeParameters()->charge()) * (track->perigeeParameters()->pT()) / 1000.; // signed and in GeV?
-    trketa_w = track->perigeeParameters()->eta();
-
-    // per track weight, if required
-    if (m_applyHistWeight) {
-      int binNumber = m_etapTWeight->FindBin(trketa_w, trkpt);
-      hweight = m_etapTWeight->GetBinContent(binNumber);
-    }
-    //looping over the hits of this track
-    ATH_MSG_DEBUG("** track " << nTracks << "/" << tracks->size()
-                              << "  pt: " << trkpt
-                              << "  eta: " << trketa_w
-                              << "  weight: " << hweight
-                              << " ** start looping on hits/TSOS ** ");
-    for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
-      ++nTSOS;
-      ATH_MSG_DEBUG(
-        " ====> dealing with hit " << nTSOS << "/" << track->trackStateOnSurfaces()->size() << " of track: " << nTracks << "/" <<
-          tracks->size());
-      if (tsos == nullptr) {
-        ATH_MSG_DEBUG("     TSOS (hit) = " << nTSOS << " is NULL ");
-        continue;
-      }
-
-      //skipping outliers
-      ATH_MSG_DEBUG(
-        " --> testing hit " << nTSOS << "/" << track->trackStateOnSurfaces()->size() << " to be measurement type");
-      if (!tsos->type(Trk::TrackStateOnSurface::Measurement)) {
-        ATH_MSG_DEBUG("Skipping TSOS " << nTSOS << " because it is an outlier (or the first TSOS on the track)");
-        continue;
-      }
-
-      const Trk::MeasurementBase* mesh = tsos->measurementOnTrack();
-      ATH_MSG_DEBUG(
-        " --> Defined hit measurementOnTrack() for hit: " << nTSOS << "/" << track->trackStateOnSurfaces()->size() << " of track " <<
-          nTracks);
-      if (!countedTrack) {
-        ATH_MSG_DEBUG(" --> going to fill: m_hTotalTracks->Fill(0.) ");
-        // m_hTotalTracks->Fill(0.); // count only once
-        countedTrack = true;
-      }
-
-      //Trk::RIO_OnTrack object contains information on the hit used to fit the track at this surface
-      ATH_MSG_DEBUG(" --> Going to retrive the Trk::RIO_OnTrack for hit " << nTSOS);
-      const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(mesh);
-      if (hit == nullptr) {
-        //for some reason the first tsos has no associated hit - maybe because this contains the defining parameters?
-        if (nHits > 0) ATH_MSG_DEBUG("No hit associated with TSOS " << nTSOS);
-        continue;
-      }
-
-      ATH_MSG_DEBUG(" --> Going to retrive the track parameters of this TSOS: " << nTSOS);
-      const Trk::TrackParameters* trackParameter = tsos->trackParameters();
-      if (trackParameter == nullptr) {
-        //if no TrackParameters for TSOS we cannot define residuals
-        ATH_MSG_DEBUG(" Skipping TSOS " << nTSOS << " because it does not have TrackParameters");
-        continue;
-      }
-
-      //getting the incident angle
-      //should be activated only offline
-      float incidencePhi = -999;
-      float incidenceTheta = -999;
-
-      ATH_MSG_DEBUG(
-        " --> going for hit->detectorElement() of hit " << nTSOS << "/" << track->trackStateOnSurfaces()->size());
-      const Trk::TrkDetElementBase* de = hit->detectorElement(); //  rio is the measurment at a particular suface
-      const InDetDD::SiDetectorElement* side = dynamic_cast<const InDetDD::SiDetectorElement*>(de);
-      if (side) {
-        Amg::Vector3D mytrack = trackParameter->momentum(); // track parameters at that surface
-        const Amg::Vector3D& mynormal = side->normal();
-        const Amg::Vector3D& myphiax = side->phiAxis();
-        const Amg::Vector3D& myetaax = side->etaAxis();
-        float trketacomp = mytrack.dot(myetaax);
-        float trkphicomp = mytrack.dot(myphiax);
-        float trknormcomp = mytrack.dot(mynormal);
-        incidencePhi = atan2(trkphicomp, trknormcomp);
-        incidenceTheta = atan2(trketacomp, trknormcomp);
-      }
-
-      const AmgSymMatrix(5) * TrackParCovariance = trackParameter ? trackParameter->covariance() : nullptr;
-
-      if (TrackParCovariance == nullptr) {
-        //if no MeasuredTrackParameters the hit will not have associated convariance error matrix and will not
-        //be able to define a pull or unbiased residual (errors needed for propagation)
-        ATH_MSG_DEBUG("Skipping TSOS " << nTSOS << " because does not have MeasuredTrackParameters");
-        continue;
-      }
-      ATH_MSG_DEBUG(
-        " --> going to define residuals and everything of TSOS  #" << nTSOS << "/" <<
-          track->trackStateOnSurfaces()->size());
-
-      float residualX = 9999.0;
-      float residualY = 9999.0;
-      float pullX = 9999.0;
-      float pullY = 9999.0;
-      float biasedResidualX = 9999.0;
-      float biasedResidualY = 9999.0;
-      float biasedPullX = 9999.0;
-      //float biasedPullY = 9999.0;
-      float overlapXResidualX = 9999.0;
-      float overlapXResidualY = 9999.0;
-      float overlapYResidualX = 9999.0;
-      float overlapYResidualY = 9999.0;
-      float elocalX = 9999.0;
-      float elocalY = 9999.0;
-      float mlocalX = 9999.0;
-      float mlocalY = 9999.0;
-      float hitErrorX = -9999.0;
-      float hitErrorY = -9999.0;
-      //float globR = -9999.0;
-      //Needed for the TRT
-      int detType = 99;
-      //int detType    = 0;
-      int barrelEC = 99;
-      int layerDisk = 99;
-      int sctSide = 99;
-      int modEta = 9999;
-      int modPhi = 9999;
-      bool isStereo = false;
-      bool foundXOverlap = false;
-      bool foundYOverlap = false;
-
-      //Cluster Size
-
-      int ClusSizePhi = -999;
-      int ClusSizeZ = -999;
-      int ClusSize = -999;
-
-      const Identifier& hitId = hit->identify();
-      ATH_MSG_DEBUG("Defining  hit Identifier ");
-      if (m_idHelper->is_trt(hitId)) detType = 2;
-      else if (m_idHelper->is_sct(hitId)) detType = 1;
-      else detType = 0;
-
-      // TRT hits: detType = 2
-      if (detType == 2) {
-        ATH_MSG_DEBUG("** IDAlignMonResiduals::fillHistograms() ** Hit is from the TRT, finding residuals... ");
-        bool isTubeHit = (mesh->localCovariance()(Trk::locX, Trk::locX) > 1.0) ? 1 : 0;
-        const Trk::TrackParameters* trackParameter = tsos->trackParameters();
-        //finding residuals
-        if (!trackParameter) {
-          if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No TrackParameters associated with TRT TrkSurface " <<
-              nTSOS << endmsg;
-          continue;
-        }
-        ATH_MSG_DEBUG("Found Trk::TrackParameters for hit " << nTSOS << " --> TRT hit (detType= " << detType << ")");
-
-        float hitR = hit->localParameters()[Trk::driftRadius];
-        float trketa = trackParameter->eta();
-        float pullR = -9.9;
-
-        const Identifier& id = m_trtID->layer_id(hitId);
-        int barrel_ec = m_trtID->barrel_ec(id);
-        int layer_or_wheel = m_trtID->layer_or_wheel(id);
-        int phi_module = m_trtID->phi_module(id);
-        int straw_layer = m_trtID->straw_layer(id);
-
-        //getting unbiased track parameters by removing the hit from the track and refitting
-        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;
-          continue;
-        }
-        ATH_MSG_DEBUG(" --> TRT UnBiased TrackParameters of hit " << nTSOS << " FOUND");
-
-        float perdictR = trackParameterUnbiased->parameters()[Trk::locR];
-
-        //Theoretically there should be no difference in the pull, but in practice, there can be differences
-        bool isPullUnbiased = true;
-
-        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.
-        std::optional<Trk::ResidualPull> residualPull =
-            m_residualPullCalculator->residualPull(
-                mesh, trackParameterUnbiased,
-                (isPullUnbiased) ? Trk::ResidualPull::Unbiased
-                                 : Trk::ResidualPull::Biased);
-
-        if (residualPull) {
-          pullR = residualPull->pull()[Trk::locR];
-        } else {
-          ATH_MSG_DEBUG(" no covariance of the track parameters given, can not calculate pull!");
-        }
-
-        delete trackParameterUnbiased;
-
-        float residualR = hitR - perdictR;
-
-        const InDet::TRT_DriftCircleOnTrack* trtCircle =
-          dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(tsos->measurementOnTrack());
-
-        const InDet::TRT_DriftCircle* RawDriftCircle(nullptr);
-
-        if (trtCircle != nullptr) {
-          ATH_MSG_DEBUG(" --> Getting TRT RawDriftCircle");
-          RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle*>(trtCircle->prepRawData());
-        } else {
-          ATH_MSG_DEBUG("trtCircle is a NULL pointer");
-        }
-
-        if (trtCircle != nullptr) {
-          bool isValid;
-          float leadingEdge = -999;
-          if (RawDriftCircle != nullptr) {
-            leadingEdge = RawDriftCircle->driftTime(isValid);
-          } else {
-            ATH_MSG_DEBUG("RawDriftCircles are NULL pointer");
-          }
-
-          Identifier DCoTId = trtCircle->identify();
-          float t0 = m_trtcaldbTool->getT0(DCoTId, TRTCond::ExpandedIdentifier::STRAW);
-          ATH_MSG_DEBUG("** fillHistograms() ** Filling TRT HISTOS for hit/tsos " << nTSOS);
-
-          // Global positions
-          float trkz0 = track->perigeeParameters()->parameters()[Trk::z0];
-          float theta = track->perigeeParameters()->parameters()[Trk::theta];
-          /*  Estimates the global Z position of a TRT barrel hit by using the x,y position of the
-              straw and the track theta */
-          float hitZ = -999.;
-          Amg::Vector3D center(-9999., -9999., -9999);
-          if (RawDriftCircle != nullptr) center = RawDriftCircle->detectorElement()->surface(id).center();
-
-          if (fabs(barrel_ec) == 1 && RawDriftCircle != nullptr) {
-            hitZ = sqrt(center.x() * center.x() + center.y() * center.y()) * tan(M_PI / 2. - theta) + trkz0;
-          }
-          /* Estimates the global R position of a TRT EC hit using the global z position of the straw
-             and the track theta */
-          float hitGlobalR = -9999.; // -999. is a possible value :)
-          if (fabs(barrel_ec) == 2 && trtCircle != nullptr) {
-            float center_z = trtCircle->detectorElement()->surface(id).center().z();
-            hitGlobalR = (center_z - trkz0) / tan(M_PI / 2. - theta);
-            ATH_MSG_DEBUG(
-              "** fillHistograms() ** TRT endcap hit in layer_or_wheel: " << layer_or_wheel << "  hitGlobalR: " <<
-            hitGlobalR);
-          }
-
-          ATH_MSG_DEBUG(" fillHistograms() ** filling TRT histos:"
-                        << "  Barrel/EndCap: " << barrel_ec
-                        << "  layer/wheel: " << layer_or_wheel
-                        << "  phi: " << phi_module
-                        << "  Residual: " << residualR);
-          /** filling TRT histograms */
-          fillTRTHistograms(barrel_ec
-                            , layer_or_wheel
-                            , phi_module
-                            , straw_layer
-                            , perdictR
-                            , hitR
-                            , hitZ
-                            , hitGlobalR
-                            , residualR
-                            , pullR
-                            , leadingEdge
-                            , timeCor
-                            , t0
-                            , isTubeHit
-                            , trketa
-                            , trkpt, hweight);
-        }
-      }//if detType ==2 // TRT
-       //if (detType==0 || detType==1)
-      else {//have identified pixel or SCT hit
-        ATH_MSG_DEBUG("** fillHistograms() ** Hit is pixel or SCT, type: " << detType);
-        if (m_doHitQuality) {
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to Silicon hit..." << endmsg;
-
-          hit = m_hitQualityTool->getGoodHit(tsos);
-          if (hit == nullptr) {
-            if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit failed quality cuts and is rejected." << endmsg;
-            continue;
-          } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit passed quality cuts" << endmsg;
-        } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit quality cuts NOT APPLIED to Silicon hit." << endmsg;
-
-        if (de) {
-          const InDetDD::SiDetectorElement* side = dynamic_cast<const InDetDD::SiDetectorElement*>(de);
-          if (side) {
-            Amg::Vector3D mytrack = trackParameter->momentum(); // track parameters at that surface
-            const Amg::Vector3D& mynormal = side->normal();
-            const Amg::Vector3D& myphiax = side->phiAxis();
-            const Amg::Vector3D& myetaax = side->etaAxis();
-            float trketacomp = mytrack.dot(myetaax);
-            float trkphicomp = mytrack.dot(myphiax);
-            float trknormcomp = mytrack.dot(mynormal);
-            incidencePhi = atan2(trkphicomp, trknormcomp);
-            incidenceTheta = atan2(trketacomp, trknormcomp);
-          }
-        }
-
-
-        //determining Si module physical position (can modify residual calculation eg. SCT endcaps)
-        if (detType == 0) {//pixel
-          const Identifier& id = m_pixelID->wafer_id(hitId);
-          barrelEC = m_pixelID->barrel_ec(id);
-          layerDisk = m_pixelID->layer_disk(id);
-          modEta = m_pixelID->eta_module(id);  //For the endcaps these are the rings
-          modPhi = m_pixelID->phi_module(id);
-          const InDet::PixelCluster* clus = dynamic_cast<const InDet::PixelCluster*>(hit->prepRawData());
-          if (clus) {
-            const InDet::SiWidth& cw = clus->width();
-            ClusSizePhi = (int) cw.colRow()[0];
-            ClusSizeZ = (int) cw.colRow()[1];
-            ClusSize = (int) clus->rdoList().size();
-          }
-        } else {//sct. Since detType == 0 or detType == 1 here
-          const Identifier& id = m_sctID->wafer_id(hitId);
-          barrelEC = m_sctID->barrel_ec(id);
-          layerDisk = m_sctID->layer_disk(id);
-          modEta = m_sctID->eta_module(id);
-          modPhi = m_sctID->phi_module(id);
-          sctSide = m_sctID->side(id);
-          const InDetDD::SiDetectorElement* siDet =
-            dynamic_cast<const InDetDD::SiDetectorElement*>(hit->detectorElement());
-          if (siDet) {
-            isStereo = siDet->isStereo();
-            const InDet::SCT_Cluster* clus = dynamic_cast<const InDet::SCT_Cluster*>(hit->prepRawData());
-            if (clus) {
-              const InDet::SiWidth& cw = clus->width();
-              ClusSizePhi = (int) cw.colRow()[0];
-              ClusSize = (int) clus->rdoList().size();
-            }
-          }
-        }
-
-        //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
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found Trk::TrackParameters " << trackParameter << endmsg;
-
-          double unbiasedResXY[4] = {
-            9999.0, 9999.0, 9999.0, 9999.0
-          };
-          double biasedResXY[4] = {
-            9999.0, 9999.0, 9999.0, 9999.0
-          };
-
-          //finding unbiased single residuals
-          StatusCode sc;
-          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);
-            continue;
-          } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "unbiased residuals found ok" << endmsg;
-          residualX = (float) unbiasedResXY[0];
-          residualY = (float) unbiasedResXY[1];
-          pullX = (float) unbiasedResXY[2];
-          pullY = (float) unbiasedResXY[3];
-
-          //finding biased single residuals (for interest)
-          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;
-          } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "biased residuals found ok" << endmsg;
-          biasedResidualX = (float) biasedResXY[0];
-          biasedResidualY = (float) biasedResXY[1];
-          biasedPullX = (float) biasedResXY[2];
-          //biasedPullY = (float)biasedResXY[3];
-          if (m_extendedPlots) {
-            mlocalX = (float) mesh->localParameters()[Trk::locX]; // local X measured position
-            mlocalY = (float) mesh->localParameters()[Trk::locY];     // local Y measured position
-            elocalX = (float) trackParameter->localPosition()[Trk::locX]; // local X extrapolated position
-            elocalY = (float) trackParameter->localPosition()[Trk::locY]; // local Y extrapolated position
-            hitErrorX = (float) sqrt(fabs(mesh->localCovariance()(Trk::loc1, Trk::loc1)));
-            hitErrorY = (float) sqrt(fabs(mesh->localCovariance()(Trk::loc2, Trk::loc2)));
-            //globR =
-            // (float)sqrt(mesh->globalPosition().x()*mesh->globalPosition().x()+mesh->globalPosition().y()*mesh->globalPosition().y());
-
-            if (detType == 1 && barrelEC != 0) { // Hit error calculation for the SCT Endcaps
-              const InDetDD::SiDetectorElement* siDet = dynamic_cast<const InDetDD::SiDetectorElement*>(hit->detectorElement());
-
-              // MeasurementBase --> virtual const Amg::Vector3D& globalPosition() const = 0;
-              /// Angle of strip in local frame with respect to the etaAxis.
-              /// Zero for all elements except trapezoidal detectors (ie SCT forward modules).
-              ////SiDetectorElement -->double sinStereoLocal(const Amg::Vector2D &localPos) const;
-              /// See previous method
-              ////SiDetectorElement -->double sinStereoLocal(const HepGeom::Point3D<double> &globalPos) const;
-
-              if (siDet != nullptr) {
-                double sinAlpha = siDet->sinStereoLocal(siDet->localPosition(mesh->globalPosition()));
-                double cosAlpha = sqrt(1 - sinAlpha * sinAlpha);
-                AmgMatrix(2, 2) RotMat;
-                RotMat.setZero();
-                RotMat(0, 0) = cosAlpha;
-                RotMat(0, 1) = sinAlpha;
-                RotMat(1, 0) = -sinAlpha;
-                RotMat(1, 1) = cosAlpha;
-
-                AmgSymMatrix(2) transformedROTCov = mesh->localCovariance().similarity(RotMat);
-                hitErrorX = sqrt(transformedROTCov(0, 0));
-              }
-            }
-          }
-
-
-          //looking for an overlapping module in the X,Y direction
-          //double counting is avoided by requiring that the overlap is at greater radius
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "looking for overlaps hits..." << endmsg;
-          std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> overlap = findOverlapHit(track, hit);
-          const Trk::TrackStateOnSurface* xOverlap = overlap.first;//will be NULL if no overlap found
-          const Trk::TrackStateOnSurface* yOverlap = overlap.second;//will be NULL if no overlap found
-
-          //find residuals for overlapping modules (if any) and calculate overlap residual
-          if (xOverlap) {//identified outer module overlapping in localX direction
-            foundXOverlap = true;
-            //float overlapXResX = 9999.0;
-            //float overlapXResY = 9999.0;
-            double unbiasedOverlapRes[4] = {
-              9999.0, 9999.0, 9999.0, 9999.0
-            };
-            //calculating unbiased residual for the overlapping module
-            sc = getSiResiduals(track, xOverlap, true, unbiasedOverlapRes);
-            if (sc.isFailure()) {
-              if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining unbiasedOverlapRes! Hit is skipped." << endmsg;
-              //return StatusCode::SUCCESS;
-              continue;
-            } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "unbiasedOverlapRes found ok" << endmsg;
-            /*
-               overlapXResX = (float)unbiasedOverlapRes[0];
-               overlapXResY = (float)unbiasedOverlapRes[1];
-
-               //finally computing the overlap residuals
-               overlapXResidualX = overlapXResX - residualX;
-               overlapXResidualY = overlapXResY - residualY;
-             */
-            overlapXResidualX = (float) unbiasedOverlapRes[0] - residualX;
-            overlapXResidualY = (float) unbiasedOverlapRes[1] - residualY;
-          }
-
-          if (yOverlap) {//identified outer module overlapping in localY direction
-            foundYOverlap = true;
-            //float overlapYResX = 9999.0;
-            //float overlapYResY = 9999.0;
-            double unbiasedOverlapRes[4] = {
-              9999.0, 9999.0, 9999.0, 9999.0
-            };
-            //calculating unbiased residual for the overlapping module
-            sc = getSiResiduals(track, yOverlap, true, unbiasedOverlapRes);
-            if (sc.isFailure()) {
-              if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining unbiasedOverlapRes! Hit is skipped." << endmsg;
-              //return StatusCode::SUCCESS;
-              continue;
-            } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "unbiasedOverlapRes found ok" << endmsg;
-
-            overlapYResidualX = (float) unbiasedOverlapRes[0] - residualX;
-            overlapYResidualY = (float) unbiasedOverlapRes[1] - residualY;
-          }
-        } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackParameters associated with Si TrkSurface " << nTSOS << " - Hit is probably an outlier" << endmsg;
-      }
-
-      //--------------------------------------------
-      //
-      // Filling Residual Histograms for different subsystems
-      //
-      //--------------------------------------------
-
-
-      if (detType == 0) {//filling pixel histograms
-        m_si_residualx->Fill(residualX, hweight);
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " This is a PIXEL hit " << hitId << " - filling histograms" << endmsg;
-
-        if (barrelEC == 0) {//filling pixel barrel histograms
-          if (layerDisk == 0) m_nIBLHitsPerLB++;
-
-          m_si_b_residualx->Fill(residualX, hweight);
-          int layerModEtaShift[4] = {
-            10, 30, 48, 65
-          };       //HARDCODED!
-          int layerModPhiShift[4] = {
-            0, 18, 44, 86
-          };
-          m_si_barrel_pullX->Fill(layerDisk, pullX, hweight);
-          m_si_barrel_pullY->Fill(layerDisk, pullY, hweight);
-          m_si_barrel_resX->Fill(layerDisk, residualX, hweight);
-          m_si_barrel_resY->Fill(layerDisk, residualY, hweight);
-          m_pix_b_residualx->Fill(residualX, hweight);
-          m_pix_b_biased_residualx->Fill(biasedResidualX, hweight);
-          m_pix_b_residualy->Fill(residualY, hweight);
-          m_pix_b_biased_residualy->Fill(biasedResidualY, hweight);
-          m_pix_b_residualsx[layerDisk]->Fill(residualX, hweight);
-          m_pix_b_residualsy[layerDisk]->Fill(residualY, hweight);
-          m_pix_b_pullsx[layerDisk]->Fill(pullX, hweight);
-          m_pix_b_pullsy[layerDisk]->Fill(pullY, hweight);
-
-
-          m_pix_b_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualX, hweight);
-          m_pix_b_yresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualY, hweight);
-
-          if (layerDisk == 0) {
-            m_pix_b0_resXvsetaLumiBlock->Fill(float(m_lumiblock), modEta, residualX, hweight);
-
-            if (modEta <= 6 && modEta >= -6) m_pix_b0_resXvsetaLumiBlock_planars->Fill(float(m_lumiblock), modEta, residualX, hweight);
-
-            if (m_doIBLLBPlots) {
-              m_pix_b0_resXvsetaLumiBlock_3d->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modEta <= 6 && modEta >= -6) m_pix_b0_resXvsetaLumiBlock_planars->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 0) m_pix_b0_resXvsetaLumiBlock_stave0->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 1) m_pix_b0_resXvsetaLumiBlock_stave1->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 2) m_pix_b0_resXvsetaLumiBlock_stave2->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 3) m_pix_b0_resXvsetaLumiBlock_stave3->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 4) m_pix_b0_resXvsetaLumiBlock_stave4->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 5) m_pix_b0_resXvsetaLumiBlock_stave5->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 6) m_pix_b0_resXvsetaLumiBlock_stave6->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 7) m_pix_b0_resXvsetaLumiBlock_stave7->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 8) m_pix_b0_resXvsetaLumiBlock_stave8->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 9) m_pix_b0_resXvsetaLumiBlock_stave9->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 10) m_pix_b0_resXvsetaLumiBlock_stave10->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 11) m_pix_b0_resXvsetaLumiBlock_stave11->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 12) m_pix_b0_resXvsetaLumiBlock_stave12->Fill(float(m_lumiblock), modEta, residualX, hweight);
-              if (modPhi == 13) m_pix_b0_resXvsetaLumiBlock_stave13->Fill(float(m_lumiblock), modEta, residualX, hweight);
-            }
-          }
-
-          if (foundXOverlap) {
-            m_pix_bec_Oxresx_mean->Fill(layerDisk + 1.1, overlapXResidualX, hweight);
-            m_pix_bec_Oxresy_mean->Fill(layerDisk + 1.1, overlapXResidualY, hweight);
-            m_pix_b_Oxresxvsmodeta->Fill(modEta + layerModEtaShift[layerDisk], overlapXResidualX, hweight);
-            m_pix_b_Oxresxvsmodphi->Fill(modPhi + layerModPhiShift[layerDisk], overlapXResidualX, hweight);
-            if (m_do3DOverlapHistos) {
-              m_pix_b_Oxresxvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, overlapXResidualX, hweight);
-              m_pix_b_Oxresyvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, overlapXResidualY, hweight);
-            }
-          }//fXO
-          if (foundYOverlap) {
-            m_pix_bec_Oyresx_mean->Fill(layerDisk + 1.1, overlapYResidualX, hweight);
-            m_pix_bec_Oyresy_mean->Fill(layerDisk + 1.1, overlapYResidualY, hweight);
-            m_pix_b_Oyresyvsmodeta->Fill(modEta + layerModEtaShift[layerDisk], overlapYResidualY, hweight);
-            m_pix_b_Oyresyvsmodphi->Fill(modPhi + layerModPhiShift[layerDisk], overlapYResidualY, hweight);
-            if (m_do3DOverlapHistos) {
-              m_pix_b_Oyresxvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, overlapYResidualX, hweight);
-              m_pix_b_Oyresyvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, overlapYResidualY, hweight);
-            }
-          }//fYO
-        } else if (barrelEC == 2) {//three Pixel endcap disks from 0-2
-          int ModPhiShift[3] = {
-            0, 55, 110
-          };
-          m_si_eca_pullX->Fill(layerDisk, pullX, hweight);
-          m_si_eca_pullY->Fill(layerDisk, pullY, hweight);
-          m_si_eca_resX->Fill(layerDisk, residualX, hweight);
-          m_si_eca_resY->Fill(layerDisk, residualY, hweight);
-          m_pix_eca_residualx->Fill(residualX, hweight);
-          m_pix_eca_residualy->Fill(residualY, hweight);
-          m_pix_eca_pullx->Fill(pullX, hweight);
-          m_pix_eca_pully->Fill(pullY, hweight);
-
-          float disk = layerDisk + 0.1;
-          if (foundXOverlap) {
-            m_pix_bec_Oxresx_mean->Fill(disk + 5.0, overlapXResidualX, hweight);
-            m_pix_bec_Oxresy_mean->Fill(disk + 5.0, overlapXResidualY, hweight);
-            m_pix_eca_Oxresxvsmodphi->Fill(modPhi + ModPhiShift[layerDisk], overlapXResidualX, hweight);
-          }
-
-          if (foundYOverlap) {
-            m_pix_bec_Oyresx_mean->Fill(disk + 5.0, overlapYResidualX, hweight);
-            m_pix_bec_Oyresy_mean->Fill(disk + 5.0, overlapYResidualY, hweight);
-            m_pix_eca_Oyresyvsmodphi->Fill(modPhi + ModPhiShift[layerDisk], overlapYResidualY, hweight);
-          }
-
-          m_pix_eca_xresvsmodphi_2d->Fill(modPhi + ModPhiShift[layerDisk], residualX, hweight);
-          m_pix_eca_yresvsmodphi_2d->Fill(modPhi + ModPhiShift[layerDisk], residualY, hweight);
-          m_pix_eca_unbiased_xresvsmodphi_disks[layerDisk]->Fill(modPhi, residualX, hweight);
-          m_pix_eca_unbiased_yresvsmodphi_disks[layerDisk]->Fill(modPhi, residualY, hweight);
-        } else if (barrelEC == -2) {
-          int ModPhiShift[3] = {
-            0, 55, 110
-          };
-          m_si_ecc_pullX->Fill(layerDisk, pullX, hweight);
-          m_si_ecc_pullY->Fill(layerDisk, pullY, hweight);
-          m_si_ecc_resX->Fill(layerDisk, residualX, hweight);
-          m_si_ecc_resY->Fill(layerDisk, residualY, hweight);
-
-          float disk = (float) layerDisk;
-          disk = -1.0 * (disk + 0.1);
-          m_pix_ecc_residualx->Fill(residualX, hweight);
-          m_pix_ecc_residualy->Fill(residualY, hweight);
-          m_pix_ecc_pullx->Fill(pullX, hweight);
-          m_pix_ecc_pully->Fill(pullY, hweight);
-          if (foundXOverlap) {
-            m_pix_bec_Oxresx_mean->Fill(disk, overlapXResidualX, hweight);
-            m_pix_bec_Oxresy_mean->Fill(disk, overlapXResidualY, hweight);
-            m_pix_ecc_Oxresxvsmodphi->Fill(modPhi + ModPhiShift[layerDisk], overlapXResidualX, hweight);
-          }
-          if (foundYOverlap) {
-            m_pix_bec_Oyresx_mean->Fill(disk, overlapYResidualX, hweight);
-            m_pix_bec_Oyresy_mean->Fill(disk, overlapYResidualY, hweight);
-            m_pix_ecc_Oyresyvsmodphi->Fill(modPhi + ModPhiShift[layerDisk], overlapYResidualY, hweight);
-          }
-          m_pix_ecc_xresvsmodphi_2d->Fill(modPhi + ModPhiShift[layerDisk], residualX, hweight);
-          m_pix_ecc_yresvsmodphi_2d->Fill(modPhi + ModPhiShift[layerDisk], residualY, hweight);
-          //m_pix_ecc_unbiased_xresvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],residualX,hweight);
-          //m_pix_ecc_unbiased_yresvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],residualY,hweight);
-          m_pix_ecc_unbiased_xresvsmodphi_disks[layerDisk]->Fill(modPhi, residualX, hweight);
-          m_pix_ecc_unbiased_yresvsmodphi_disks[layerDisk]->Fill(modPhi, residualY, hweight);
-        }
-      } else if (detType == 1) {//filling SCT histograms
-        m_si_residualx->Fill(residualX, hweight);
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " This is an SCT hit " << hitId << " - filling histograms" << endmsg;
-
-        if (barrelEC == 0) {//filling SCT barrel histograms
-          m_si_b_residualx->Fill(residualX, hweight);
-          int ModPhiShift[4] = {
-            0, 37, 82, 135
-          };
-          int ModEtaShift[4] = {
-            6, 24, 42, 60
-          };
-          m_si_barrel_pullX->Fill(m_NPixLayers + 2 * (layerDisk) + sctSide, pullX, hweight);
-          //m_si_barrel_pullY->Fill(3 + 2*(layerDisk) + sctSide, pullY);//no SCT Y residuals yet
-
-          m_si_barrel_resX->Fill(m_NPixLayers + 2 * (layerDisk) + sctSide, residualX, hweight);
-          //m_si_barrel_resY->Fill(3 + 2*(layerDisk) + sctSide, residualY);//no SCT Y residuals yet
-
-          m_sct_b_residualx->Fill(residualX, hweight);
-          m_sct_b_biasedresidualx->Fill(biasedResidualX, hweight);
-
-          if (foundXOverlap) m_sct_bec_Oxresx_mean->Fill(layerDisk + 1.1, overlapXResidualX, hweight);
-          if (foundYOverlap) m_sct_bec_Oyresx_mean->Fill(layerDisk + 1.1, overlapYResidualX, hweight);
-
-          m_sct_b_residualsx[layerDisk]->Fill(residualX, hweight);
-          m_sct_b_pullsx[layerDisk]->Fill(pullX, hweight);
-
-          m_sct_b_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualX, hweight);
-
-
-          if (foundXOverlap) {
-            m_sct_b_xoverlapresidualsx[layerDisk]->Fill(overlapXResidualX, hweight);
-            m_sct_b_Oxresxvsmodeta->Fill(modEta + ModEtaShift[layerDisk], overlapXResidualX, hweight);
-            m_sct_b_Oxresxvsmodphi->Fill(modPhi + ModPhiShift[layerDisk], overlapXResidualX, hweight);
-            if (m_do3DOverlapHistos) m_sct_b_Oxresxvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, overlapXResidualX, hweight);
-          }
-          if (foundYOverlap) {
-            m_sct_b_yoverlapresidualsx[layerDisk]->Fill(overlapYResidualX, hweight);
-            m_sct_b_Oyresxvsmodeta->Fill(modEta + ModEtaShift[layerDisk], overlapYResidualX, hweight);
-            m_sct_b_Oyresxvsmodphi->Fill(modPhi + ModPhiShift[layerDisk], overlapYResidualX, hweight);
-            if (m_do3DOverlapHistos) m_sct_b_Oyresxvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, overlapYResidualX, hweight);
-          }
-          // if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unexpected SCT layer number "<< layerDisk << endmsg;
-        } else if (barrelEC == 2) {//nine SCT endcap disks from 0-8
-          //ASSUMPTION: the outer rings of the SCT endcap disks have the same number of modules. WARNING! hardcoded!
-          int Nmods = 52;
-          //int ModPhiShift[9] = {0,55,110,165,220,275,330,385,440};
-          m_si_eca_pullX->Fill(3 + 2 * (layerDisk) + sctSide, pullX, hweight);
-          //m_si_eca_pullY->Fill(3 + 2*(layerDisk) + sctSide, pullY);//no SCT Y residuals yet
-          m_si_eca_resX->Fill(3 + 2 * (layerDisk) + sctSide, residualX, hweight);
-          //m_si_eca_resY->Fill(3 + 2*(layerDisk) + sctSide, residualY);//no SCT Y residuals yet
-
-          float disk = layerDisk + 0.1;
-          m_sct_eca_residualx->Fill(residualX, hweight);
-          m_sct_eca_pullx->Fill(pullX, hweight);
-
-          m_sct_eca_xresvsmodphi_2d->Fill(modPhi + (layerDisk) * (m_gap_sct + Nmods), residualX, hweight); // (layerDisk-1)
-
-          if (foundXOverlap) {
-            m_sct_bec_Oxresx_mean->Fill(disk + 6.0, overlapXResidualX);
-            m_sct_eca_Oxresxvsmodphi->Fill(modPhi + (layerDisk) * (m_gap_sct + Nmods), overlapXResidualX, hweight);
-            //                               modPhi+ ModPhiShift[layerDisk],overlapXResidualX    , hweight);
-          }
-        } else if (barrelEC == -2) {
-          int Nmods = 52;
-          m_si_ecc_pullX->Fill(3 + 2 * (layerDisk) + sctSide, pullX, hweight);
-          //m_si_ecc_pullY->Fill(3 + 2*(layerDisk) + sctSide, pullY);//no SCT Y residuals yet
-          m_si_ecc_resX->Fill(3 + 2 * (layerDisk) + sctSide, residualX, hweight);
-          //m_si_ecc_resY->Fill(3 + 2*(layerDisk) + sctSide, residualY);//no SCT Y residuals yet
-
-          float disk = (float) layerDisk;
-          disk = -1.0 * (disk + 0.1);
-          m_sct_ecc_residualx->Fill(residualX, hweight);
-          m_sct_ecc_pullx->Fill(pullX, hweight);
-
-          m_sct_ecc_xresvsmodphi_2d->Fill(modPhi + (layerDisk) * (m_gap_sct + Nmods), residualX, hweight);
-          if (foundXOverlap) {
-            m_sct_bec_Oxresx_mean->Fill(disk, overlapXResidualX);
-            m_sct_ecc_Oxresxvsmodphi->Fill(modPhi + (layerDisk) * (m_gap_sct + Nmods), overlapXResidualX, hweight);
-          }
-        }
-      }
-
-      // Extended pixel histograms
-      if (m_extendedPlots) {
-        if (detType == 0) {  //Pixel histograms
-          if (barrelEC == 0) { // barrel
-            static const int phiIdentifier_min[3] = {
-              0, -1, 22
-            };
-            static const int phiIdentifier_max[3] = {
-              11, 20, 49
-            };// Barrel
-            m_pix_b_biased_residualx_pt->Fill(trkpt, biasedResidualX, hweight);
-            m_pix_b_biased_residualy_pt->Fill(trkpt, biasedResidualY, hweight);
-            m_pix_b_residualx_pt->Fill(trkpt, residualX, hweight);
-            m_pix_b_residualy_pt->Fill(trkpt, residualY, hweight);
-            m_pix_b_pullx_pt->Fill(trkpt, pullX, hweight);
-            m_pix_b_pully_pt->Fill(trkpt, pullY, hweight);
-            m_pix_b_residualx_fine->Fill(residualX, hweight);
-            m_pix_b_residualy_fine->Fill(residualY, hweight);
-            m_pix_b_measured_localx->Fill(mlocalX, hweight);
-            m_pix_b_measured_localy->Fill(mlocalY, hweight);
-            m_pix_b_extrapolated_localx->Fill(elocalX, hweight);
-            m_pix_b_extrapolated_localy->Fill(elocalY, hweight);
-            if (layerDisk != 0) { // Pixel barrel layers
-              m_hiterror_x_pix_b->Fill(hitErrorX, hweight);
-              m_hiterror_x_pix_b_WideRange->Fill(hitErrorX, hweight);
-              m_hiterror_y_pix_b->Fill(hitErrorY, hweight);
-              m_hiterror_y_pix_b_WideRange->Fill(hitErrorY, hweight);
-            }
-            if (layerDisk == 0) { // IBL
-              m_hiterror_x_ibl_b->Fill(hitErrorX, hweight);
-              m_hiterror_y_ibl_b->Fill(hitErrorX, hweight);
-              m_hiterror_x_ibl_b_WideRange->Fill(hitErrorX, hweight);
-              m_hiterror_y_ibl_b_WideRange->Fill(hitErrorX, hweight);
-            }
-
-            if (mlocalY > m_PixelBarrelYSize / 2.05) mlocalY = m_PixelBarrelYSize / 2.05;
-            if (mlocalY < -m_PixelBarrelYSize / 2.05) mlocalY = -m_PixelBarrelYSize / 2.05;
-            if (mlocalX > m_PixelBarrelXSize / 2.05) mlocalX = m_PixelBarrelXSize / 2.05;
-            if (mlocalX < -m_PixelBarrelXSize / 2.05) mlocalX = -m_PixelBarrelXSize / 2.05;
-
-            m_pix_b_residualsx_incitheta[layerDisk]->Fill(incidenceTheta, residualX, hweight);
-            m_pix_b_residualsy_incitheta[layerDisk]->Fill(incidenceTheta, residualY, hweight);
-            m_pix_b_residualsx_inciphi[layerDisk]->Fill(incidencePhi, residualX, hweight);
-            m_pix_b_residualsy_inciphi[layerDisk]->Fill(incidencePhi, residualY, hweight);
-            m_pix_b_residualsx_pt[layerDisk]->Fill(trkpt, residualX, hweight);
-            m_pix_b_residualsy_pt[layerDisk]->Fill(trkpt, residualY, hweight);
-            m_pix_b_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, residualX, hweight);
-            m_pix_b_residualsy_qoverp2[layerDisk]->Fill(trkqoverp2, residualY, hweight);
-            m_pix_b_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-            m_pix_b_biased_residualsy[layerDisk]->Fill(biasedResidualY, hweight);
-            m_pix_b_biased_residualsx_pt[layerDisk]->Fill(trkpt, biasedResidualX, hweight);
-            m_pix_b_biased_residualsy_pt[layerDisk]->Fill(trkpt, biasedResidualY, hweight);
-            m_pix_b_biased_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_pix_b_biased_residualsy_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualY, hweight);
-            m_pix_b_pullsx_pt[layerDisk]->Fill(trkpt, pullX, hweight);
-            m_pix_b_pullsy_pt[layerDisk]->Fill(trkpt, pullY, hweight);
-            if (foundXOverlap) {
-              m_pix_b_xoverlapresidualsx[layerDisk]->Fill(overlapXResidualX, hweight);
-              m_pix_b_xoverlapresidualsy[layerDisk]->Fill(overlapXResidualY, hweight);
-            }
-
-            if (foundYOverlap) {
-              m_pix_b_yoverlapresidualsx[layerDisk]->Fill(overlapYResidualX, hweight);
-              m_pix_b_yoverlapresidualsy[layerDisk]->Fill(overlapYResidualY, hweight);
-            }
-            // int modoffset = 6.5;       // default for old pixel layers
-            m_PixelBarrelXSize = 16.44;  // mm
-            m_PixelBarrelYSize = 60.2;   // mm
-
-            if (layerDisk == 0) { // in case of IBL
-              m_PixelBarrelXSize = 18.75; // Extracted from: arXiv:1209.1906v1, Figure 2
-              m_PixelBarrelYSize = 41.32;
-              // case of 3D sensors have slighlty different size
-              if (modEta < -6 || modEta > 5) {
-                m_PixelBarrelXSize = 20.45; // Extracted from: arXiv:1209.1906v1, Figure 2
-                m_PixelBarrelYSize = 19.20;
-              }
-            }
-
-            float xValueForHist = modEta + mlocalY / m_PixelBarrelYSize;
-            float yValueForHist = modPhi + mlocalX / m_PixelBarrelXSize;
-
-            ATH_MSG_VERBOSE(" -- filling detailed pixel maps -- layer = " << layerDisk
-                                                                          << "  eta: " << modEta
-                                                                          << "  phi " << modPhi
-                                                                          << "  local (" << mlocalX << " / " << m_PixelBarrelXSize
-                                                                          << ", " << mlocalY << " / " << m_PixelBarrelYSize << ") "
-                                                                          << "  normalized (" << mlocalY / m_PixelBarrelYSize * m_mapSplit << ", " << mlocalX / m_PixelBarrelXSize * m_mapSplit << ") ");
-            ATH_MSG_VERBOSE("                                                      "
-                            << " fill (" << xValueForHist << ", " << yValueForHist << ") ");
-
-            // biased 3d histos turned into detailed 3d histos (for the time being use unbiased residuals)
-            //m_pix_b_biased_xresvsmodetaphi_3ds[layerDisk] -> Fill(ModCenterPosX+mlocalY, ModCenterPosY+mlocalX,
-            // residualX, hweight);
-            //m_pix_b_biased_yresvsmodetaphi_3ds[layerDisk] -> Fill(ModCenterPosX+mlocalY, ModCenterPosY+mlocalX,
-            // residualY, hweight);
-            m_pix_b_detailed_xresvsmodetaphi_3ds[layerDisk]->Fill(xValueForHist, yValueForHist, residualX, hweight);
-            m_pix_b_detailed_yresvsmodetaphi_3ds[layerDisk]->Fill(xValueForHist, yValueForHist, residualY, hweight);
-
-            // pixel B-layer halfshell phi identifier association
-            // Layer 0                  Layer 1                     Layer 2
-            // top: 1-10                0-19                        0-22 49-51
-            // bottom: 11-21 and 0      20-37                       23-48
-            if (layerDisk != 2) // Necessary because the logic changes
-              if (modPhi > phiIdentifier_min[layerDisk] && modPhi < phiIdentifier_max[layerDisk]) {
-                m_pix_b_top_residualsx[layerDisk]->Fill(residualX, hweight);
-                m_pix_b_top_residualsy[layerDisk]->Fill(residualY, hweight);
-                m_pix_b_top_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-                m_pix_b_top_biased_residualsy[layerDisk]->Fill(biasedResidualY, hweight);
-              } else {
-                m_pix_b_btm_residualsx[layerDisk]->Fill(residualX, hweight);
-                m_pix_b_btm_residualsy[layerDisk]->Fill(residualY, hweight);
-                m_pix_b_btm_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-                m_pix_b_btm_biased_residualsy[layerDisk]->Fill(biasedResidualY, hweight);
-              }
-            else if (modPhi > phiIdentifier_min[layerDisk] && modPhi < phiIdentifier_max[layerDisk]) {
-              m_pix_b_btm_residualsx[layerDisk]->Fill(residualX, hweight);
-              m_pix_b_btm_residualsy[layerDisk]->Fill(residualY, hweight);
-              m_pix_b_btm_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-              m_pix_b_btm_biased_residualsy[layerDisk]->Fill(biasedResidualY, hweight);
-            } else {
-              m_pix_b_top_residualsx[layerDisk]->Fill(residualX, hweight);
-              m_pix_b_top_residualsy[layerDisk]->Fill(residualY, hweight);
-              m_pix_b_top_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-              m_pix_b_top_biased_residualsy[layerDisk]->Fill(biasedResidualY, hweight);
-            }
-            if (m_doClusterSizeHistos) {
-              m_pix_b_clustersize[layerDisk]->Fill(ClusSize, hweight);
-              m_pix_b_clustersizePhi[layerDisk]->Fill(ClusSizePhi, hweight);
-              m_pix_b_clustersizeZ[layerDisk]->Fill(ClusSizeZ, hweight);
-              m_pix_b_residualsx_clustersize[layerDisk]->Fill(ClusSize, residualX, hweight);
-              m_pix_b_residualsy_clustersize[layerDisk]->Fill(ClusSize, residualY, hweight);
-              m_pix_b_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_pix_b_residualsy_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualY, hweight);
-              m_pix_b_residualsx_clustersizeZ[layerDisk]->Fill(ClusSizeZ, residualX, hweight);
-              m_pix_b_residualsy_clustersizeZ[layerDisk]->Fill(ClusSizeZ, residualY, hweight);
-              m_pix_b_residualsx_clustersizeP[layerDisk]->Fill(ClusSize, residualX, hweight);
-              m_pix_b_residualsy_clustersizeP[layerDisk]->Fill(ClusSize, residualY, hweight);
-              m_pix_b_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_pix_b_residualsy_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualY, hweight);
-              m_pix_b_residualsx_clustersizeZP[layerDisk]->Fill(ClusSizeZ, residualX, hweight);
-              m_pix_b_residualsy_clustersizeZP[layerDisk]->Fill(ClusSizeZ, residualY, hweight);
-              m_pix_b_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizePhi, hweight);
-              m_pix_b_clustersizeZ_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizeZ, hweight);
-              m_pix_b_clustersize_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSize, hweight);
-              m_pix_b_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizePhi, hweight);
-              m_pix_b_clustersizeZ_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizeZ, hweight);
-              m_pix_b_clustersize_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSize, hweight);
-            }
-          } else if (barrelEC == 2) { // Endcap A
-            m_pix_eca_xresvsmodphidisk_3d->Fill(layerDisk, modPhi, residualX, hweight);
-            m_pix_eca_yresvsmodphidisk_3d->Fill(layerDisk, modPhi, residualY, hweight);
-            m_pix_eca_biased_residualx->Fill(biasedResidualX, hweight);
-            m_pix_eca_biased_residualy->Fill(biasedResidualY, hweight);
-            m_pix_eca_residualx_fine->Fill(residualX, hweight);
-            m_pix_eca_residualy_fine->Fill(residualY, hweight);
-            m_pix_eca_biased_residualx_pt->Fill(trkpt, biasedResidualX, hweight);
-            m_pix_eca_biased_residualy_pt->Fill(trkpt, biasedResidualY, hweight);
-            m_pix_eca_residualx_pt->Fill(trkpt, residualX, hweight);
-            m_pix_eca_residualy_pt->Fill(trkpt, residualY, hweight);
-            m_pix_eca_pullx_pt->Fill(trkpt, pullX, hweight);
-            m_pix_eca_pully_pt->Fill(trkpt, pullY, hweight);
-
-            m_hiterror_x_pix_ec->Fill(hitErrorX, hweight);
-            m_hiterror_y_pix_ec->Fill(hitErrorY, hweight);
-            m_hiterror_x_pix_eca->Fill(hitErrorX, hweight);
-            m_hiterror_y_pix_eca->Fill(hitErrorY, hweight);
-            m_hiterror_x_pix_ec_WideRange->Fill(hitErrorX, hweight);
-            m_hiterror_y_pix_ec_WideRange->Fill(hitErrorY, hweight);
-
-            m_pix_eca_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-            m_pix_eca_biased_residualsy[layerDisk]->Fill(biasedResidualY, hweight);
-            m_pix_eca_biased_residualsx_pt[layerDisk]->Fill(trkpt, biasedResidualX, hweight);
-            m_pix_eca_biased_residualsy_pt[layerDisk]->Fill(trkpt, biasedResidualY, hweight);
-            m_pix_eca_residualsx_pt[layerDisk]->Fill(trkpt, residualX, hweight);
-            m_pix_eca_residualsy_pt[layerDisk]->Fill(trkpt, residualY, hweight);
-            m_pix_eca_pullsx_pt[layerDisk]->Fill(trkpt, pullX, hweight);
-            m_pix_eca_pullsy_pt[layerDisk]->Fill(trkpt, pullY, hweight);
-            m_pix_eca_biased_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_pix_eca_biased_residualsy_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualY, hweight);
-            m_pix_eca_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, residualX, hweight);
-            m_pix_eca_residualsy_qoverp2[layerDisk]->Fill(trkqoverp2, residualY, hweight);
-            m_pix_eca_biased_xresvsmodphi_2ds[layerDisk]->Fill(modPhi, biasedResidualX, hweight);
-            m_pix_eca_biased_yresvsmodphi_2ds[layerDisk]->Fill(modPhi, biasedResidualY, hweight);
-
-            if (m_doClusterSizeHistos) {
-              m_pix_eca_clustersize[layerDisk]->Fill(ClusSize, hweight);
-              m_pix_eca_clustersizePhi[layerDisk]->Fill(ClusSizePhi, hweight);
-              m_pix_eca_clustersizeZ[layerDisk]->Fill(ClusSizeZ, hweight);
-              m_pix_eca_residualsx_clustersize[layerDisk]->Fill(ClusSize, residualX, hweight);
-              m_pix_eca_residualsy_clustersize[layerDisk]->Fill(ClusSize, residualY, hweight);
-              m_pix_eca_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_pix_eca_residualsy_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualY, hweight);
-              m_pix_eca_residualsx_clustersizeZ[layerDisk]->Fill(ClusSizeZ, residualX, hweight);
-              m_pix_eca_residualsy_clustersizeZ[layerDisk]->Fill(ClusSizeZ, residualY, hweight);
-              m_pix_eca_residualsx_clustersizeP[layerDisk]->Fill(ClusSize, residualX, hweight);
-              m_pix_eca_residualsy_clustersizeP[layerDisk]->Fill(ClusSize, residualY, hweight);
-              m_pix_eca_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_pix_eca_residualsy_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualY, hweight);
-              m_pix_eca_residualsx_clustersizeZP[layerDisk]->Fill(ClusSizeZ, residualX, hweight);
-              m_pix_eca_residualsy_clustersizeZP[layerDisk]->Fill(ClusSizeZ, residualY, hweight);
-              m_pix_eca_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizePhi, hweight);
-              m_pix_eca_clustersizeZ_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizeZ, hweight);
-              m_pix_eca_clustersize_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSize, hweight);
-              m_pix_eca_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizePhi, hweight);
-              m_pix_eca_clustersizeZ_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizeZ, hweight);
-              m_pix_eca_clustersize_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSize, hweight);
-            }
-          } else if (barrelEC == -2) {
-            m_pix_ecc_xresvsmodphidisk_3d->Fill(layerDisk, modPhi, residualX, hweight);
-            m_pix_ecc_yresvsmodphidisk_3d->Fill(layerDisk, modPhi, residualY, hweight);
-            m_pix_ecc_biased_residualx->Fill(biasedResidualX, hweight);
-            m_pix_ecc_biased_residualy->Fill(biasedResidualY, hweight);
-            m_pix_ecc_residualx_fine->Fill(residualX, hweight);
-            m_pix_ecc_residualy_fine->Fill(residualY, hweight);
-            m_pix_ecc_biased_residualx_pt->Fill(trkpt, biasedResidualX, hweight);
-            m_pix_ecc_biased_residualy_pt->Fill(trkpt, biasedResidualY, hweight);
-            m_pix_ecc_residualx_pt->Fill(trkpt, residualX, hweight);
-            m_pix_ecc_residualy_pt->Fill(trkpt, residualY, hweight);
-            m_pix_ecc_pullx_pt->Fill(trkpt, pullX, hweight);
-            m_pix_ecc_pully_pt->Fill(trkpt, pullY, hweight);
-
-            m_hiterror_x_pix_ec->Fill(hitErrorX, hweight);
-            m_hiterror_y_pix_ec->Fill(hitErrorY, hweight);
-            m_hiterror_x_pix_ecc->Fill(hitErrorX, hweight);
-            m_hiterror_y_pix_ecc->Fill(hitErrorY, hweight);
-            m_hiterror_x_pix_ec_WideRange->Fill(hitErrorX, hweight);
-            m_hiterror_y_pix_ec_WideRange->Fill(hitErrorY, hweight);
-
-            m_pix_ecc_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-            m_pix_ecc_biased_residualsy[layerDisk]->Fill(biasedResidualY, hweight);
-            m_pix_ecc_biased_residualsx_pt[layerDisk]->Fill(trkpt, biasedResidualX, hweight);
-            m_pix_ecc_biased_residualsy_pt[layerDisk]->Fill(trkpt, biasedResidualY, hweight);
-            m_pix_ecc_residualsx_pt[layerDisk]->Fill(trkpt, residualX, hweight);
-            m_pix_ecc_residualsy_pt[layerDisk]->Fill(trkpt, residualY, hweight);
-            m_pix_ecc_pullsx_pt[layerDisk]->Fill(trkpt, pullX, hweight);
-            m_pix_ecc_pullsy_pt[layerDisk]->Fill(trkpt, pullY, hweight);
-            m_pix_ecc_biased_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_pix_ecc_biased_residualsy_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualY, hweight);
-            m_pix_ecc_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, residualX, hweight);
-            m_pix_ecc_residualsy_qoverp2[layerDisk]->Fill(trkqoverp2, residualY, hweight);
-            m_pix_ecc_biased_xresvsmodphi_2ds[layerDisk]->Fill(modPhi, biasedResidualX, hweight);
-            m_pix_ecc_biased_yresvsmodphi_2ds[layerDisk]->Fill(modPhi, biasedResidualY, hweight);
-
-            if (m_doClusterSizeHistos) {
-              m_pix_ecc_clustersize[layerDisk]->Fill(ClusSize, hweight);
-              m_pix_ecc_clustersizePhi[layerDisk]->Fill(ClusSizePhi, hweight);
-              m_pix_ecc_clustersizeZ[layerDisk]->Fill(ClusSizeZ, hweight);
-              m_pix_ecc_residualsx_clustersize[layerDisk]->Fill(ClusSize, residualX, hweight);
-              m_pix_ecc_residualsy_clustersize[layerDisk]->Fill(ClusSize, residualY, hweight);
-              m_pix_ecc_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_pix_ecc_residualsy_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualY, hweight);
-              m_pix_ecc_residualsx_clustersizeZ[layerDisk]->Fill(ClusSizeZ, residualX, hweight);
-              m_pix_ecc_residualsy_clustersizeZ[layerDisk]->Fill(ClusSizeZ, residualY, hweight);
-              m_pix_ecc_residualsx_clustersizeP[layerDisk]->Fill(ClusSize, residualX, hweight);
-              m_pix_ecc_residualsy_clustersizeP[layerDisk]->Fill(ClusSize, residualY, hweight);
-              m_pix_ecc_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_pix_ecc_residualsy_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualY, hweight);
-              m_pix_ecc_residualsx_clustersizeZP[layerDisk]->Fill(ClusSizeZ, residualX, hweight);
-              m_pix_ecc_residualsy_clustersizeZP[layerDisk]->Fill(ClusSizeZ, residualY, hweight);
-              m_pix_ecc_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizePhi, hweight);
-              m_pix_ecc_clustersizeZ_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizeZ, hweight);
-              m_pix_ecc_clustersize_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSize, hweight);
-              m_pix_ecc_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizePhi, hweight);
-              m_pix_ecc_clustersizeZ_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizeZ, hweight);
-              m_pix_ecc_clustersize_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSize, hweight);
-            }
-          }
-        } else if (detType == 1) {
-          if (barrelEC == 0) { // barrel part
-            m_sct_b_residualx_fine->Fill(residualX, hweight);
-            m_sct_b_biased_residualx_pt->Fill(trkpt, biasedResidualX, hweight);
-            m_sct_b_residualx_pt->Fill(trkpt, residualX, hweight);
-            m_sct_b_pullx_pt->Fill(trkpt, pullX, hweight);
-            m_sct_b_biased_residualx_qoverp2->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_sct_b_unbiased_residualx_qoverp2->Fill(trkqoverp2, residualX, hweight);
-            //m_sct_b_residualx_qoverp2 -> Fill(trkqoverp2, residualX   , hweight); !! Not in the original
-
-            m_hiterror_sct_b->Fill(hitErrorX, hweight);
-            m_hiterror_sct_b_WideRange->Fill(hitErrorX, hweight);
-
-            if (isStereo) {
-              m_sct_b_extrapolated_st_localx->Fill(elocalX, hweight);
-              m_sct_b_extrapolated_st_localy->Fill(elocalY, hweight);
-              m_sct_b_measured_st_localx->Fill(mlocalX, hweight);
-              m_sct_b_measured_st_localy->Fill(mlocalY, hweight);
-            } else {
-              m_sct_b_extrapolated_nst_localx->Fill(elocalX, hweight);
-              m_sct_b_extrapolated_nst_localy->Fill(elocalY, hweight);
-              m_sct_b_measured_nst_localx->Fill(mlocalX, hweight);
-              m_sct_b_measured_nst_localy->Fill(mlocalY, hweight);
-            }
-
-            if (fabs(elocalY) > m_SCTBarrelYSize / 2.) {
-              if (elocalY < 0) elocalY = -m_SCTBarrelYSize / 2.05;
-              if (elocalY > 0) elocalY = m_SCTBarrelYSize / 2.05;
-            }
-            if (fabs(mlocalX) > m_SCTBarrelXSize / 2.) {
-              if (mlocalX < 0) mlocalX = -m_SCTBarrelXSize / 2.05;
-              if (mlocalX > 0) mlocalX = m_SCTBarrelXSize / 2.05;
-            }
-            if (elocalY > m_SCTBarrelYSize / 2.05) elocalY = m_SCTBarrelYSize / 2.05;
-            if (elocalY < -m_SCTBarrelYSize / 2.05) elocalY = -m_SCTBarrelYSize / 2.05;
-            if (mlocalX > m_SCTBarrelXSize / 2.05) mlocalX = m_SCTBarrelXSize / 2.05;
-            if (mlocalX < -m_SCTBarrelXSize / 2.05) mlocalX = -m_SCTBarrelXSize / 2.05;
-
-            m_sct_b_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-            m_sct_b_biased_residualsx_pt[layerDisk]->Fill(trkpt, biasedResidualX, hweight);
-            m_sct_b_residualsx_pt[layerDisk]->Fill(trkpt, residualX, hweight);
-            m_sct_b_pullsx_pt[layerDisk]->Fill(trkpt, pullX, hweight);
-            m_sct_b_biased_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_sct_b_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, residualX, hweight);
-            m_sct_b_biased_pullsx[layerDisk]->Fill(biasedPullX, hweight);
-            if (m_doClusterSizeHistos) {
-              m_sct_b_clustersizePhi[layerDisk]->Fill(ClusSizePhi, hweight);
-              m_sct_b_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_sct_b_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              if (sctSide == 0) {
-                m_sct_b_residualsx_incidentAngle_s0 [layerDisk]->Fill(incidenceTheta, residualX, hweight);
-                m_sct_b_residualsx_incidentAnglePhi_s0[layerDisk]->Fill(incidencePhi, residualX, hweight);
-                m_sct_b_clustersizePhivsmodetaphi_3ds_s0[layerDisk]->Fill(modEta, modPhi, ClusSizePhi, hweight);
-              }
-              if (sctSide == 1) {
-                m_sct_b_residualsx_incidentAngle_s1 [layerDisk]->Fill(incidenceTheta, residualX, hweight);
-                m_sct_b_residualsx_incidentAnglePhi_s1[layerDisk]->Fill(incidencePhi, residualX, hweight);
-                m_sct_b_clustersizePhivsmodetaphi_3ds_s1[layerDisk]->Fill(modEta, modPhi, ClusSizePhi, hweight);
-              }
-              m_sct_b_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizePhi, hweight);
-              m_sct_b_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizePhi, hweight);
-            }
-            Float_t corrEta;
-            if (modEta > 0) corrEta = modEta + 5.5;
-            else corrEta = modEta + 6.5;
-            float ModCenterPosX = m_sct_b_s0_biased_xresvsmodetaphi_3ds[layerDisk]->GetXaxis()->GetXmin()
-                                  + corrEta * m_SCTBarrelYSize;
-            float ModCenterPosY = m_sct_b_s0_biased_xresvsmodetaphi_3ds[layerDisk]->GetYaxis()->GetXmin()
-                                  + (modPhi + 0.5) * m_SCTBarrelXSize;
-            if (sctSide == 0) {
-              m_sct_b_s0_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(ModCenterPosX + elocalY, ModCenterPosY + mlocalX, residualX, hweight);
-              m_sct_b_s0_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualX, hweight);
-            } else {
-              m_sct_b_s1_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(ModCenterPosX + elocalY, ModCenterPosY + mlocalX, residualX, hweight);
-              m_sct_b_s1_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualX, hweight);
-            }
-          } else if (barrelEC == 2) {//SCT endcap A
-            //WARNING! hardcoded!
-            int RingShift[3] = {
-              0, 52 + m_gap_sct, 92 + 2 * m_gap_sct
-            };
-            m_sct_eca_residualx_fine->Fill(residualX, hweight);
-            m_sct_eca_biased_residualx->Fill(biasedResidualX, hweight);
-            m_sct_eca_biased_residualx_pt->Fill(trkpt, biasedResidualX, hweight);
-            m_sct_eca_residualx_pt->Fill(trkpt, residualX, hweight);
-            m_sct_eca_pullx_pt->Fill(trkpt, pullX, hweight);
-            m_sct_eca_biased_residualx_qoverp2->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_sct_eca_unbiased_residualx_qoverp2->Fill(trkqoverp2, residualX, hweight);
-            m_hiterror_sct_ec->Fill(hitErrorX, hweight);
-            m_hiterror_sct_ec_WideRange->Fill(hitErrorX, hweight);
-
-            m_sct_eca_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-            m_sct_eca_biased_residualsx_pt[layerDisk]->Fill(trkpt, biasedResidualX, hweight);
-            m_sct_eca_residualsx_pt[layerDisk]->Fill(trkpt, residualX, hweight);
-            m_sct_eca_pullsx_pt[layerDisk]->Fill(trkpt, pullX, hweight);
-            m_sct_eca_biased_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_sct_eca_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, residualX, hweight);
-            m_sct_eca_xresvsmodphi_disks[layerDisk]->Fill(modPhi + RingShift[layerDisk], residualX, hweight);
-            m_sct_eca_biased_xresvsmodphi_disks[layerDisk]->Fill(modPhi + RingShift[layerDisk], biasedResidualX, hweight);
-
-            if (m_doClusterSizeHistos) {
-              m_sct_eca_clustersizePhi[layerDisk]->Fill(ClusSizePhi, hweight);
-              if (sctSide == 0) {
-                m_sct_eca_residualsx_incidentAngle_s0 [layerDisk]->Fill(incidenceTheta, residualX, hweight);
-                m_sct_eca_residualsx_incidentAnglePhi_s0[layerDisk]->Fill(incidencePhi, residualX, hweight);
-              }
-              if (sctSide == 1) {
-                m_sct_eca_residualsx_incidentAngle_s1 [layerDisk]->Fill(incidenceTheta, residualX, hweight);
-                m_sct_eca_residualsx_incidentAnglePhi_s1[layerDisk]->Fill(incidencePhi, residualX, hweight);
-              }
-
-              m_sct_eca_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_sct_eca_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_sct_eca_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizePhi, hweight);
-              m_sct_eca_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizePhi, hweight);
-            }
-            if (sctSide == 0) {
-              m_sct_eca_s0_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualX, hweight);
-              m_sct_eca_s0_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, biasedResidualX, hweight);
-            } else {
-              m_sct_eca_s1_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualX, hweight);
-              m_sct_eca_s1_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, biasedResidualX, hweight);
-            }
-          } else if (barrelEC == -2) {
-            //WARNING! hardcoded!
-            int RingShift[3] = {
-              0, 52 + m_gap_sct, 92 + 2 * m_gap_sct
-            };
-            m_sct_ecc_residualx_fine->Fill(residualX, hweight);
-            m_sct_ecc_biased_residualx->Fill(biasedResidualX, hweight);
-            m_sct_ecc_biased_residualx_pt->Fill(trkpt, biasedResidualX, hweight);
-            m_sct_ecc_residualx_pt->Fill(trkpt, residualX, hweight);
-            m_sct_ecc_pullx_pt->Fill(trkpt, pullX, hweight);
-            m_sct_ecc_biased_residualx_qoverp2->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_sct_ecc_unbiased_residualx_qoverp2->Fill(trkqoverp2, residualX, hweight);
-            m_hiterror_sct_ec->Fill(hitErrorX, hweight);
-            m_hiterror_sct_ec_WideRange->Fill(hitErrorX, hweight);
-
-            m_sct_ecc_biased_residualsx[layerDisk]->Fill(biasedResidualX, hweight);
-            m_sct_ecc_biased_residualsx_pt[layerDisk]->Fill(trkpt, biasedResidualX, hweight);
-            m_sct_ecc_residualsx_pt[layerDisk]->Fill(trkpt, residualX, hweight);
-            m_sct_ecc_pullsx_pt[layerDisk]->Fill(trkpt, pullX, hweight);
-            m_sct_ecc_biased_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, biasedResidualX, hweight);
-            m_sct_ecc_residualsx_qoverp2[layerDisk]->Fill(trkqoverp2, residualX, hweight);
-            m_sct_ecc_xresvsmodphi_disks[layerDisk]->Fill(modPhi + RingShift[layerDisk], residualX, hweight);
-            m_sct_ecc_biased_xresvsmodphi_disks[layerDisk]->Fill(modPhi + RingShift[layerDisk], biasedResidualX, hweight);
-            if (m_doClusterSizeHistos) {
-              m_sct_ecc_clustersizePhi[layerDisk]->Fill(ClusSizePhi, hweight);
-              if (sctSide == 0) {
-                m_sct_ecc_residualsx_incidentAngle_s0 [layerDisk]->Fill(incidenceTheta, residualX, hweight);
-                m_sct_ecc_residualsx_incidentAnglePhi_s0[layerDisk]->Fill(incidencePhi, residualX, hweight);
-              }
-              if (sctSide == 1) {
-                m_sct_ecc_residualsx_incidentAngle_s1 [layerDisk]->Fill(incidenceTheta, residualX, hweight);
-                m_sct_ecc_residualsx_incidentAnglePhi_s1[layerDisk]->Fill(incidencePhi, residualX, hweight);
-              }
-
-              m_sct_ecc_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_sct_ecc_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi, residualX, hweight);
-              m_sct_ecc_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta, ClusSizePhi, hweight);
-              m_sct_ecc_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi, ClusSizePhi, hweight);
-            }
-            if (sctSide == 0) {
-              m_sct_ecc_s0_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualX, hweight);
-              m_sct_ecc_s0_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, biasedResidualX, hweight);
-            } else {
-              m_sct_ecc_s1_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, residualX, hweight);
-              m_sct_ecc_s1_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(modEta, modPhi, biasedResidualX, hweight);
-            }
-          }
-        }
-      }
-      ++nHits;
-    }//end of loop on track surfaces
-
-    // filling of residuals completed
-    // update track number and go for next
-    ++nTracks;
-  } // end of loop on tracks
-
-  if (m_changedlumiblock) {
-    //Making the fit for the IBL bowing. This has to be done at lowest time granularity possible: we will try to make it
-    // lumiBlock wise.
-
-    //If too less events I want to put those ones.
-    float mag = -999., base = -999., mag_er = 0., base_er = 0.;
-    //minimum numbers of entries per m_lumiblock to perform the fit: if -1 don't make the fit. Only for testing.
-
-    int lumibin = m_lumiblock + 1;
-    int thisMinEntries = 20;
-
-    if (m_nIBLHitsPerLB > m_minIBLhits) {
-      TH1D* projection_lumiblock = (TH1D*) m_pix_b0_resXvsetaLumiBlock->ProjectionY(("iblBowingProjection_lumiblock_" + intToString(lumibin - 1)).c_str(), lumibin, lumibin);
-      if (projection_lumiblock->GetEntries() >= thisMinEntries) {
-        MakeStaveShapeFit(mag, mag_er, base, base_er, projection_lumiblock);
-        m_mag_vs_LB->SetBinContent(lumibin, mag);
-        m_mag_vs_LB->SetBinError(lumibin, mag_er);
-        m_base_vs_LB->SetBinContent(lumibin, base);
-        m_base_vs_LB->SetBinError(lumibin, base_er);
-      } else {
-        ATH_MSG_DEBUG("Fit IBL Shape for LumiBlock : " << m_lumiblock << " disabled because of too few entries! " << projection_lumiblock->GetEntries() <<
-                      "  This block has: " << m_nIBLHitsPerLB << " total entries");
-      }
-      TH1D* projection_lumiblock_planars = m_pix_b0_resXvsetaLumiBlock_planars->ProjectionY(("planars_iblBowingProjection_lumiblock_" + intToString(lumibin - 1)).c_str(), lumibin, lumibin);
-      if (projection_lumiblock_planars->GetEntries() >= thisMinEntries) {
-        MakeStaveShapeFit(mag, mag_er, base, base_er, projection_lumiblock_planars);
-        m_mag_vs_LB_planars->SetBinContent(lumibin, mag);
-        m_mag_vs_LB_planars->SetBinError(lumibin, mag_er);
-        m_base_vs_LB_planars->SetBinContent(lumibin, base);
-        m_base_vs_LB_planars->SetBinError(lumibin, base_er);
-      } else {
-        ATH_MSG_DEBUG("Fit IBL Shape for LumiBlock : " << m_lumiblock << " disabled because of too few entries in planars! " << projection_lumiblock_planars->GetEntries() <<
-                      "  This block has: " << m_nIBLHitsPerLB << " total entries");
-      }
-
-      delete projection_lumiblock;
-      delete projection_lumiblock_planars;
-    } else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Fit IBL Shape for LumiBlock : " << m_lumiblock << " disabled. Too Few hits" << endmsg;
-
-
-
-    m_nIBLHitsPerLB = 0;
-  }// End of lumiblock
-
-  delete tracks;
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of tracks : " << nTracks << endmsg;
-
-
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonResiduals::procHistograms() {
-  //if( endOfLowStatFlag() ) {  }
-  //if( endOfLumiBlockFlag() ) {      }
-  if (endOfRunFlag() || ((AthenaMonManager::environment() == AthenaMonManager::online) && endOfLumiBlockFlag())) {
-    for (unsigned int side = 0; side < 3; ++side) {
-      //single TRT residuals
-      for (unsigned int lay = 0; lay < 3; ++lay) {
-        fillRMSFromProfile(m_trt_b_hist->aveRes_l[side][lay], m_trt_b_hist->rmsRes_l[side][lay]);
-        SetMinWindow(m_trt_b_hist->aveRes_l[side][lay], m_minTRTResWindow, m_maxTRTResWindow);
-        SetMinWindow(m_trt_b_hist->aveResVsTrackEta_l[side][lay], m_minTRTResWindow, m_maxTRTResWindow);
-        /* new resVsPhiZ/Eta plots */
-        if (m_extendedPlots) {
-          meanRMSProjection2D(m_trt_b_hist->resVsPhiZ[side][lay], m_trt_b_hist->aveResVsPhiZ[side][lay], 0, m_useGausFit);
-          meanRMSProjection2D(m_trt_b_hist->resVsPhiZ[side][lay], m_trt_b_hist->rmsResVsPhiZ[side][lay], 1, m_useGausFit);
-          meanRMSProjection2D(m_trt_b_hist->resVsPhiEta[side][lay], m_trt_b_hist->aveResVsPhiEta[side][lay], 0, m_useGausFit);
-          meanRMSProjection2D(m_trt_b_hist->resVsPhiEta[side][lay], m_trt_b_hist->rmsResVsPhiEta[side][lay], 1, m_useGausFit);
-        }
-      }
-
-
-      if (m_extendedPlots) {
-        for (unsigned int phi = 0; phi < 32; ++phi) {
-          fillRMSFromProfile(m_trt_b_hist->aveResVsStrawLayerStackLevel[side][phi], m_trt_b_hist->rmsResVsStrawLayerStackLevel[side][phi]);
-          SetMinWindow(m_trt_b_hist->aveResVsStrawLayerStackLevel[side][phi], m_minTRTResWindow, m_maxTRTResWindow);
-        }
-      }
-
-      for (unsigned int position = 0; position < 5; ++position) {
-        fillRMSFromProfile(m_trt_b_hist->aveResOverPhiVsStrawLayer[position][side], m_trt_b_hist->rmsResOverPhiVsStrawLayer[position][side]);
-      }
-    }
-
-    for (unsigned int endcap = 0; endcap < 2; ++endcap) {
-      fillRMSFromProfile(m_trt_ec_hist->aveResVsRing[endcap], m_trt_ec_hist->rmsResVsRing[endcap]);
-      fillRMSFromProfile(m_trt_ec_hist->aveResVsPhiSec[endcap], m_trt_ec_hist->rmsResVsPhiSec[endcap]);
-
-      SetMinWindow(m_trt_ec_hist->aveResVsRing[endcap], m_minTRTResWindow, m_maxTRTResWindow);
-      SetMinWindow(m_trt_ec_hist->aveResVsPhiSec[endcap], m_minTRTResWindow, m_maxTRTResWindow);
-      SetMinWindow(m_trt_ec_hist->aveResVsTrackEta[endcap], m_minTRTResWindow, m_maxTRTResWindow);
-
-      if (m_extendedPlots) {
-        meanRMSProjection2D(m_trt_ec_hist->resVsPhiWheel[endcap], m_trt_ec_hist->aveResVsPhiWheel[endcap], 0, m_useGausFit);
-        meanRMSProjection2D(m_trt_ec_hist->resVsPhiWheel[endcap], m_trt_ec_hist->rmsResVsPhiWheel[endcap], 1, m_useGausFit);
-
-        meanRMSProjection2D(m_trt_ec_hist->resVsRadiusWheelPos[endcap], m_trt_ec_hist->aveResVsRadiusWheelPos[endcap], 0, m_useGausFit);
-        meanRMSProjection2D(m_trt_ec_hist->resVsRadiusWheelPos[endcap], m_trt_ec_hist->rmsResVsRadiusWheelPos[endcap], 1, m_useGausFit);
-        meanRMSProjection2D(m_trt_ec_hist->resVsRadiusWheelNeg[endcap], m_trt_ec_hist->aveResVsRadiusWheelNeg[endcap], 0, m_useGausFit);
-        meanRMSProjection2D(m_trt_ec_hist->resVsRadiusWheelNeg[endcap], m_trt_ec_hist->rmsResVsRadiusWheelNeg[endcap], 1, m_useGausFit);
-
-        // TRT EC Maps
-        meanRMSProjection2D(m_trt_ec_hist->resVsRadiusWheelPos[endcap], m_trt_ec_hist->aveResVsRadiusWheelPos[endcap], 0, m_useGausFit);
-        meanRMSProjection2D(m_trt_ec_hist->resVsRadiusWheelPos[endcap], m_trt_ec_hist->rmsResVsRadiusWheelPos[endcap], 1, m_useGausFit);
-        meanRMSProjection2D(m_trt_ec_hist->resVsRadiusWheelNeg[endcap], m_trt_ec_hist->aveResVsRadiusWheelNeg[endcap], 0, m_useGausFit);
-        meanRMSProjection2D(m_trt_ec_hist->resVsRadiusWheelNeg[endcap], m_trt_ec_hist->rmsResVsRadiusWheelNeg[endcap], 1, m_useGausFit);
-      }
-    }
-    //overlap residuals
-    fillRMSFromProfile(m_pix_bec_Oxresx_mean, m_pix_bec_Oxresx_rms);
-    fillRMSFromProfile(m_pix_bec_Oxresy_mean, m_pix_bec_Oxresy_rms);
-    fillRMSFromProfile(m_pix_bec_Oyresx_mean, m_pix_bec_Oyresx_rms);
-    fillRMSFromProfile(m_pix_bec_Oyresy_mean, m_pix_bec_Oyresy_rms);
-    fillRMSFromProfile(m_sct_bec_Oxresx_mean, m_sct_bec_Oxresx_rms);
-    fillRMSFromProfile(m_sct_bec_Oyresx_mean, m_sct_bec_Oyresx_rms);
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//__________________________________________________________________________
-StatusCode IDAlignMonResiduals::getSiResiduals(const Trk::Track* track, const Trk::TrackStateOnSurface* tsos, bool unBias, double* results) {
-  if (!m_doPulls) return StatusCode::FAILURE;
-
-  StatusCode sc = StatusCode::SUCCESS;
-
-  double residualX = -9999.0;
-  double residualY = -9999.0;
-  double pullX = -9999.0;
-  double pullY = -9999.0;
-
-  //extract the hit object from the tsos
-  const Trk::MeasurementBase* mesh = tsos->measurementOnTrack();
-  const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(mesh);
-
-  //get the unbiased track parameters (can fail if no MeasuredTrackParameters exists)
-  const Trk::TrackParameters* trackParameterUnbiased = nullptr;
-  if (unBias) trackParameterUnbiased = getUnbiasedTrackParameters(track, tsos);
-
-  //updator can fail in defining unbiased parameters, in which case we use biased
-  const Trk::TrackParameters* trackParameterForResiduals = nullptr;
-  if (trackParameterUnbiased) trackParameterForResiduals = trackParameterUnbiased;
-  else {
-    //use the original biased track parameters
-    trackParameterForResiduals = tsos->trackParameters();
-  }
-
-  if (!m_residualPullCalculator.empty() && !m_residualPullCalculator.retrieve().isFailure()) {
-    if (hit && trackParameterForResiduals) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " got hit and track parameters " << endmsg;
-
-      //const Trk::ResidualPull* residualPull = m_residualPullCalculator->residualPull(hit, trackParameterForResiduals,
-      // unBias);
-      std::optional<Trk::ResidualPull> residualPull = std::nullopt;
-      if (unBias) residualPull = m_residualPullCalculator->residualPull(mesh, trackParameterForResiduals, Trk::ResidualPull::Unbiased);
-      else residualPull = m_residualPullCalculator->residualPull(mesh, trackParameterForResiduals, Trk::ResidualPull::Biased);
-
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " got hit and track parameters...done " << endmsg;
-      if (residualPull) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " got residual pull object" << endmsg;
-        residualX = residualPull->residual()[Trk::loc1];
-        if (residualPull->isPullValid()) pullX = residualPull->pull()[Trk::loc1];
-        else {
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator finds invalid X Pull!!!" << endmsg;
-          sc = StatusCode::FAILURE;
-        }
-
-        if (residualPull->dimension() >= 2) {
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " residualPull dim >= 2" << endmsg;
-          residualY = residualPull->residual()[Trk::loc2];
-
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " residual Y = " << residualY << endmsg;
-          if (residualPull->isPullValid()) pullY = residualPull->pull()[Trk::loc2];
-          else {
-            if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator finds invalid Y Pull!!!" << endmsg;
-            sc = StatusCode::FAILURE;
-          }
-        }
-
-      } else {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator failed!" << endmsg;
-        sc = StatusCode::FAILURE;
-      }
-    }
-  }
-
-  // for SCT modules the residual pull calculator only finds the (rotated) Rphi residual
-  // for each of the SCT sides; residualPull->dimension()==1 always.
-
-  //std::pair <double, double> result(residualX, residualY);
-  results[0] = residualX;
-  results[1] = residualY;
-  results[2] = pullX;
-  results[3] = pullY;
-
-  if (pullX != pullX || pullY != pullY) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator finds Pull=NAN!!!" << endmsg;
-    sc = StatusCode::FAILURE;
-  }
-
-  //delete these TrackParameters which are newly created in the getUnbiasedTrackParameters(track,tsos) method
-  delete trackParameterUnbiased;
-
-  return sc;
-}
-
-//_______________________
-
-
-bool IDAlignMonResiduals::isEdge(const Trk::RIO_OnTrack* hit) {
-  bool IsAEdgeChannel = false;
-
-  // check if it is an SCT or Pixel hit
-  const Identifier& hitId = hit->identify();
-  int detType = 99;
-
-  //Since isEdge is called only in silicon detector we have detType = 0 or detType = 1
-  if (m_idHelper->is_sct(hitId)) detType = 1;
-  else detType = 0;
-
-
-  const Trk::PrepRawData* hit_PRD = hit->prepRawData();
-  if (!hit_PRD) return false;
-
-  const std::vector<Identifier>& hit_ID_list = hit_PRD->rdoList();
-
-
-  for (unsigned int i = 0; i != hit_ID_list.size(); ++i) {
-    if (detType == 1) {
-      int stripId = m_sctID->strip(hit_ID_list[i]);
-      if (stripId == 0 || stripId == 767) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "SCT Overlap in Phi" << stripId << endmsg;
-        return true;
-      }
-    } else { //(detType == 0)
-      int pixelIdPhi = m_pixelID->phi_index(hit_ID_list[i]);
-      int pixelIdEta = m_pixelID->eta_index(hit_ID_list[i]);
-
-      if (pixelIdEta == 0 || pixelIdEta == 143) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Pixel Overlap in Eta" << pixelIdEta << endmsg;
-        return true;
-      }
-
-      if (pixelIdPhi == 0 || pixelIdPhi == 327) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Pixel Overlap in Phi" << pixelIdPhi << endmsg;
-        return true;
-      }
-    }
-  }
-
-  return IsAEdgeChannel;
-}
-
-//__________________________________________________________________________
-std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAlignMonResiduals::findOverlapHit(const Trk::Track* trk, const Trk::RIO_OnTrack* hit) {
-  // this method identifies which hits on modules for Trk::Track* trk overlap with Trk::RIO_OnTrack* hit
-  // - only one overlapping module should be returned
-  // - the overlapping module must be at a greater global radius than Trk::RIO_OnTrack* hit
-  //   this avoids double counting when you are trying to find all the unique overlaps for a track
-  // - for SCT overlaps, the overlapping module must have the same axial/stereo orientation as the Trk::RIO_OnTrack* hit
-  //   otherwise the computation of the overlap residual is using two different coordinate frames and will be distorted
-  // returns two Trk::TrackStateOnSurface, one for a potential x overlaps and one for a potential y overlap
-  // if no overlap is found the corresponding Trk::TrackStateOnSurface will be null
-  //For IBL there is noOverlap. So If detType==0 and layerDisk==0 return null xOverlap and yOverlap
-
-
-
-  const Trk::TrackStateOnSurface* xOverlap = nullptr;
-  const Trk::TrackStateOnSurface* yOverlap = nullptr;
-
-  if (isEdge(hit)) {
-    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because hit is an edge hit (1st hit)" << endmsg;
-  } else {
-    const Identifier& hitId = hit->identify();
-    int detType = 99;
-    int barrelEC = 99;
-    int layerDisk = 99;
-    int modEta = 99;
-    int modPhi = 99;
-    if (m_idHelper->is_sct(hitId)) detType = 1;
-    else detType = 0;
-
-    //determining Si module physical position
-    if (detType == 1) {//sct
-      const Identifier& id = m_sctID->wafer_id(hitId);
-      barrelEC = m_sctID->barrel_ec(id);
-      layerDisk = m_sctID->layer_disk(id);
-      modEta = m_sctID->eta_module(id);
-      modPhi = m_sctID->phi_module(id);
-    } else {//pixel
-      const Identifier& id = m_pixelID->wafer_id(hitId);
-      barrelEC = m_pixelID->barrel_ec(id);
-      layerDisk = m_pixelID->layer_disk(id);
-      modEta = m_pixelID->eta_module(id);
-      modPhi = m_pixelID->phi_module(id);
-    }
-    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "******** looking for overlaps for new hit detType = " << detType
-                                                << ", modEta = " << modEta << ", modPhi = " << modPhi << " , layerDisk= " << layerDisk
-                                                << ", barrelEC= " << barrelEC << endmsg;
-
-    int nHits = 0;
-    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 == nullptr) continue; //the first hit on the track never has associated RIO_OnTrack - just stores track
-                                     // parameters
-      ++nHits;
-      int detType2 = -99;
-      int barrelEC2 = -99;
-      int layerDisk2 = -99;
-      int modEta2 = -99;
-      int modPhi2 = -99;
-
-      //const Identifier& hitId2 = (dynamic_cast <const Trk::RIO_OnTrack*>(tsos2->measurementOnTrack()))->identify();
-      const Identifier& hitId2 = hit2->identify();
-
-      if (m_idHelper->is_sct(hitId2)) detType2 = 1;
-      else if (m_idHelper->is_pixel(hitId2)) detType2 = 0;
-      else detType2 = 2;
-
-      //determining Si module physical position
-      if (detType2 == 1) {//sct
-        const Identifier& id = m_sctID->wafer_id(hitId2);
-        barrelEC2 = m_sctID->barrel_ec(id);
-        layerDisk2 = m_sctID->layer_disk(id);
-        modEta2 = m_sctID->eta_module(id);
-        modPhi2 = m_sctID->phi_module(id);
-      } else if (detType2 == 0) {//pixel
-        const Identifier& id = m_pixelID->wafer_id(hitId2);
-        barrelEC2 = m_pixelID->barrel_ec(id);
-        layerDisk2 = m_pixelID->layer_disk(id);
-        modEta2 = m_pixelID->eta_module(id);
-        modPhi2 = m_pixelID->phi_module(id);
-      } else { //hit in the trt so I skip it
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Skipping hit in the trt? " << m_idHelper->is_trt(hitId2) << endmsg;
-        continue;
-      }
-
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "testing hit2 " << nHits << " for overlap detType = " << detType2
-                                                  << ", modEta = " << modEta2 << ", modPhi = " << modPhi2 << " , layerDisk= " << layerDisk2
-                                                  << ", barrelEC= " << barrelEC2 << endmsg;
-
-
-      if (isEdge(hit2)) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because hit is an edge hit (2nd hit)" << endmsg;
-        continue;
-      }
-
-
-      if (!tsos2->type(Trk::TrackStateOnSurface::Measurement)) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because hit is an outlier" << endmsg;
-        continue;
-      }
-
-      if (detType != detType2) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because not the same detector" << endmsg;
-        continue;
-      }
-      if (barrelEC != barrelEC2) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because not the same barrel/endcap" << endmsg;
-        continue;
-      }
-      if (layerDisk != layerDisk2) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because not the same layer/disk" << endmsg;
-        continue;
-      }
-
-      if (modEta == modEta2 && modPhi == modPhi2) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because this is the original hit (or the opposite side for SCT)" << endmsg;
-        continue;
-      }
-
-      if (detType == 1) {
-        const InDetDD::SiDetectorElement* siDet = dynamic_cast<const InDetDD::SiDetectorElement*>(hit->detectorElement());
-        bool stereo = siDet->isStereo();
-        const InDetDD::SiDetectorElement* siDet2 = dynamic_cast<const InDetDD::SiDetectorElement*>(hit2->detectorElement());
-        bool stereo2 = siDet2->isStereo();
-        if (stereo != stereo2) {
-          if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "SCT overlap rejected because the modules are not both stereo/radial modules" << endmsg;
-          continue;
-        }
-      }
-
-
-      const Trk::TrackParameters* measuredTrackParameter = tsos2->trackParameters();
-      const AmgSymMatrix(5) * MeasTrackParCovariance = measuredTrackParameter ? measuredTrackParameter->covariance() : nullptr;
-      if (MeasTrackParCovariance == nullptr) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because overlap hit does not have associated measuredTrackParameters" << endmsg;
-        continue;
-      }
-
-      if ((modEta == modEta2 && modPhi != modPhi2) || (modEta - modEta2 == 1 && modPhi == modPhi2)) {
-        //potentially an overlap hit - apply hit quality cuts if tool configured
-        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);
-          if (hit2 == nullptr) {
-            if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because failed hit quality cuts." << endmsg;
-            continue;
-          } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap hit passed quality cuts" << endmsg;
-        } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit quality cuts NOT APPLIED to overlap hit." << endmsg;
-      }
-
-      bool close = false; //added by LT
-
-      if (modEta == modEta2 && modPhi != modPhi2) {
-        //BAD HARDCODING
-
-
-        //IBL Overlap has to be disabled.
-
-        // begin added by TG
-        // Pixel barrel #phi: 22, 38, 52
-        // Pixel EC #phi: 48
-        // SCT barrel #phi: 32, 40, 48, 56
-        // SCT EC #phi: 52 ???
-        if (modPhi - modPhi2 == 1) {
-          close = true;
-          // Pix barrel special cases
-        } else if ((detType == 0 && barrelEC == 0 && layerDisk == 3) && modPhi - modPhi2 == -51) {
-          close = true;
-        } else if ((detType == 0 && barrelEC == 0 && layerDisk == 2) && modPhi - modPhi2 == -37) {
-          close = true;
-        } else if ((detType == 0 && barrelEC == 0 && layerDisk == 1) && modPhi - modPhi2 == -21) {
-          close = true;
-          // SCT barrel special cases
-        } else if ((detType == 1 && barrelEC == 0 && layerDisk == 3) && modPhi - modPhi2 == -55) {
-          close = true;
-        } else if ((detType == 1 && barrelEC == 0 && layerDisk == 2) && modPhi - modPhi2 == -47) {
-          close = true;
-        } else if ((detType == 1 && barrelEC == 0 && layerDisk == 1) && modPhi - modPhi2 == -39) {
-          close = true;
-        } else if ((detType == 1 && barrelEC == 0 && layerDisk == 0) && modPhi - modPhi2 == -31) {
-          close = true;
-          // Pix EC special cases
-        } else if ((detType == 0 && abs(barrelEC) == 2) && modPhi - modPhi2 == -47) {
-          close = true;
-          // SCT EC special cases: check!!!
-        } else if ((detType == 1 && abs(barrelEC) == 2) && modPhi - modPhi2 == -51) {
-          close = true;
-        }
-        if (close) { //end add by TG
-          //	if(msgLvl(MSG::DEBUG)) msg() <<  "original module radius = " << radius << endmsg;
-          if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "***** identified local X overlap in the IBL" << endmsg;
-          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;
-        } //added by LT
-      }
-      if (modEta - modEta2 == 1 && modPhi == modPhi2) {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "***** identified local Y overlap" << endmsg;
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "modEta2 = " << modEta2 << endmsg;
-        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;
-      }
-    }
-  }
-  //std::pair <const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> result(xOverlap, yOverlap);
-  return std::pair <const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> (xOverlap, yOverlap);
-}
-
-//__________________________________________________________________________
-const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(const Trk::Track* trkPnt, const Trk::TrackStateOnSurface* tsos) {
-  const Trk::TrackParameters* trackParams;
-  std::unique_ptr<const Trk::TrackParameters> propagatedTrackParams{};
-  std::unique_ptr<const Trk::TrackParameters> otherSideUnbiasedTrackParams{};
-
-  //controls if the SCT residuals will be 'truly' unbiased - removing also the opposite side hit.
-  bool trueUnbiased = true;
-
-  Identifier surfaceID;
-
-  ATH_MSG_VERBOSE( "original track parameters: " << *(tsos->trackParameters()) );
-
-  const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
-
-  if (hitOnTrack != nullptr) surfaceID = hitOnTrack->identify();
-
-
-  // if SCT Hit and TrueUnbiased then remove other side hit first
-  if (surfaceID.is_valid() && trueUnbiased && m_idHelper->is_sct(surfaceID)) {  //there's no TrueUnbiased for non-SCT
-                                                                                // (pixel) hits)
-    ATH_MSG_VERBOSE( "Entering True Unbiased loop.");
-    // check if other module side was also hit and try to remove other hit as well
-    const Trk::TrackStateOnSurface* otherModuleSideHit(nullptr);
-    const Identifier waferID = m_sctID->wafer_id(surfaceID);
-    const IdentifierHash waferHash = m_sctID->wafer_hash(waferID);
-    IdentifierHash otherSideHash;
-    m_sctID->get_other_side(waferHash, otherSideHash);
-    const Identifier otherModuleSideID = m_sctID->wafer_id(otherSideHash);
-
-    for (const Trk::TrackStateOnSurface* TempTsos : *trkPnt->trackStateOnSurfaces()) {
-      const Trk::RIO_OnTrack* TempHitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(TempTsos->measurementOnTrack());
-      if (TempHitOnTrack != nullptr) {
-        //const Identifier& trkID = TempHitOnTrack->identify();
-        //if (m_sctID->wafer_id(trkID) == OtherModuleSideID) {
-        if (m_sctID->wafer_id(TempHitOnTrack->identify()) == otherModuleSideID) {
-          ATH_MSG_VERBOSE( "True unbiased residual. Removing OtherModuleSide Hit " << m_idHelper->show_to_string(otherModuleSideID, nullptr, '/') );
-          otherModuleSideHit = TempTsos;
-        }
-      }
-    }
-
-    if (otherModuleSideHit) {
-      const Trk::TrackParameters* OMSHmeasuredTrackParameter = otherModuleSideHit->trackParameters();
-      const AmgSymMatrix(5) * OMSHmeasuredTrackParameterCov = OMSHmeasuredTrackParameter ? OMSHmeasuredTrackParameter->covariance() : nullptr;
-      // check that the hit on the other module side has measuredtrackparameters, otherwise it cannot be removed from
-      // the track
-      if (OMSHmeasuredTrackParameterCov) {
-        ATH_MSG_VERBOSE( "OtherSideTrackParameters: " << *(otherModuleSideHit->trackParameters()) );
-        otherSideUnbiasedTrackParams = m_iUpdator->removeFromState(*(otherModuleSideHit->trackParameters()),
-                                                                   otherModuleSideHit->measurementOnTrack()->localParameters(),
-                                                                   otherModuleSideHit->measurementOnTrack()->localCovariance());
-
-        if (otherSideUnbiasedTrackParams) {
-          ATH_MSG_VERBOSE( "Unbiased OtherSideTrackParameters: " << *otherSideUnbiasedTrackParams );
-
-          const Trk::Surface* TempSurface = &(otherModuleSideHit->measurementOnTrack()->associatedSurface());
-
-          const Trk::MagneticFieldProperties* TempField = nullptr;
-          if (TempSurface) {
-             ATH_MSG_VERBOSE( "After OtherSide surface call. Surface exists" );
-            if (TempSurface->associatedLayer()) {
-              ATH_MSG_VERBOSE( "TempSurface->associatedLayer() exists" );
-              if (TempSurface->associatedLayer()->enclosingTrackingVolume()) {
-                ATH_MSG_VERBOSE( "TempSurface->associatedLayer()->enclosingTrackingVolume exists" );
-                TempField = dynamic_cast <const Trk::MagneticFieldProperties*>(TempSurface->associatedLayer()->enclosingTrackingVolume());
-                ATH_MSG_VERBOSE( "After MagneticFieldProperties cast" );
-                ATH_MSG_VERBOSE( "Before other side unbiased propagation" );
-                if (TempSurface->associatedLayer() && TempField) propagatedTrackParams = m_propagator->propagate(
-                  Gaudi::Hive::currentContext(),
-                  *otherSideUnbiasedTrackParams,
-                  tsos->measurementOnTrack()->associatedSurface(),
-                  Trk::anyDirection, false,
-                  *TempField,
-                  Trk::nonInteracting);
-              } else {
-               ATH_MSG_VERBOSE( "TempSurface->associatedLayer()->enclosingTrackingVolume does not exist" );
-              }
-            } else {
-              ATH_MSG_VERBOSE( "TempSurface->associatedLayer() does not exist" );
-            }
-          } else {
-            ATH_MSG_VERBOSE( "After OtherSide surface call. Surface does not exist" );
-          }
-          ATH_MSG_VERBOSE( "After other side unbiased propagation" );
-          if (propagatedTrackParams) {
-            ATH_MSG_VERBOSE("Propagated Track Parameters: " << *propagatedTrackParams );
-          } else {
-            ATH_MSG_DEBUG( "Propagation of unbiased OtherSideParameters failed" );
-          }
-        } else {
-          ATH_MSG_DEBUG( "RemoveFromState did not work for OtherSideParameters" );
-        }
-      } else {
-        ATH_MSG_VERBOSE( "No otherModuleSideHit Measured Track Parameters found" );
-      }
-    } else {
-      ATH_MSG_VERBOSE( "No otherModuleSideHit found" );
-    }
-  }
-
-  // if propagation failed or no TrueUnbiased or no SCT then use original TrackParams
-  if (!propagatedTrackParams) {
-    propagatedTrackParams = tsos->trackParameters()->uniqueClone();
-  }
-  std::unique_ptr<const Trk::TrackParameters> unbiasedTrackParams =
-    m_iUpdator ->removeFromState(*propagatedTrackParams,
-                       tsos->measurementOnTrack()->localParameters(),
-                       tsos->measurementOnTrack()->localCovariance());
-
-
-  if (unbiasedTrackParams) {
-    if (msgLvl(MSG::VERBOSE) && surfaceID.is_valid()) msg(MSG::VERBOSE) << "Unbiased residual. Removing original Hit " << m_idHelper->show_to_string(surfaceID, nullptr, '/') << endmsg;
-    ATH_MSG_VERBOSE( "Unbiased TrackParameters: " << *unbiasedTrackParams );
-    trackParams = unbiasedTrackParams->clone();
-  } else { // Unbiasing went awry.
-    ATH_MSG_WARNING( "RemoveFromState did not work, using original TrackParameters" );
-    trackParams = tsos->trackParameters()->clone();
-  }
-
-
-  return trackParams;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonResiduals::setupTools() {
-  //initializing tools
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In setupTools()" << endmsg;
-
-  StatusCode sc;
-  //Get the PIX manager from the detector store
-
-  sc = detStore()->retrieve(m_PIX_Mgr, m_Pixel_Manager);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get PIX_Manager !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-
-  //Get the SCT manager from the detector store
-  sc = detStore()->retrieve(m_SCT_Mgr, m_SCT_Manager);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get SCT_Manager !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTManager" << endmsg;
-
-  sc = detStore()->retrieve(m_pixelID, "PixelID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get Pixel ID helper !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized PixelIDHelper" << endmsg;
-
-  sc = detStore()->retrieve(m_sctID, "SCT_ID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get SCT ID helper !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTIDHelper" << endmsg;
-
-  sc = detStore()->retrieve(m_trtID, "TRT_ID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get TRT ID helper !" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized TRTIDHelper" << endmsg;
-
-  //ID Helper
-  sc = detStore()->retrieve(m_idHelper, "AtlasID");
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get AtlasDetectorID !" << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found AtlasDetectorID" << endmsg;
-  }
-
-  if (m_iUpdator.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve tool " << m_iUpdator << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_iUpdator << endmsg;
-  }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved IUpdator" << endmsg;
-
-
-  if (m_propagator.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Can not retrieve Propagator tool of type "
-                                                << m_propagator.typeAndName() << endmsg;
-    return StatusCode::FAILURE;
-  } else msg(MSG::INFO) << "Retrieved tool " << m_propagator.typeAndName() << endmsg;
-
-  if (m_trackSelection.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Can not retrieve TrackSelection tool of type "
-                                                << m_trackSelection.typeAndName() << endmsg;
-    return StatusCode::FAILURE;
-  } else msg(MSG::INFO) << "Retrieved tool " << m_trackSelection.typeAndName() << endmsg;
-
-  if (m_residualPullCalculator.empty()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
-        "No residual/pull calculator for general hit residuals configured."
-                                            << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
-        "It is recommended to give R/P calculators to the det-specific tool"
-                                            << " handle lists then." << endmsg;
-    m_doPulls = false;
-  } else if (m_residualPullCalculator.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not retrieve " << m_residualPullCalculator
-                                                << " (to calculate residuals and pulls) " << endmsg;
-    m_doPulls = false;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)
-        << "Generic hit residuals&pulls will be calculated in one or both "
-        << "available local coordinates" << endmsg;
-    m_doPulls = true;
-  }
-
-  if (m_hitQualityTool.empty()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
-        "No hit quality tool configured - not hit quality cuts will be imposed"
-                                            << endmsg;
-    m_doHitQuality = false;
-  } else if (m_hitQualityTool.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not retrieve " << m_hitQualityTool
-                                                << " (to apply hit quality cuts to Si hits) " << endmsg;
-    m_doHitQuality = false;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)
-        << "Hit quality tool setup "
-        << "- hit quality cuts will be applied to Si hits" << endmsg;
-    m_doHitQuality = true;
-  }
-
-
-  return StatusCode::SUCCESS;
-}
-
-//--------------------------------------------------------------------------------------------
-
-bool IDAlignMonResiduals::trackRequiresRefit(const Trk::Track* track) {
-  // Checks to see if any of the measurements on track do not have track parameters associated
-  // (as happens for certain track collections in e.g. ESD)
-  // If this is the case we cannot define residuals and track needs to be refitted (return true)
-
-  bool refitTrack = false;
-
-  int nHits = 0;
-  int nHitsNoParams = 0;
-
-  ATH_MSG_DEBUG("** IDAlignMonResiduals::trackRequiresRefit ** Testing track to see if requires refit...");
-
-  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
-    if (tsos == nullptr) continue;
-
-    //skipping outliers
-    if (!tsos->type(Trk::TrackStateOnSurface::Measurement)) continue;
-
-    const Trk::MeasurementBase* mesh = tsos->measurementOnTrack();
-    if (mesh == nullptr) continue;
-    const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(mesh);
-    if (hit == nullptr) continue;
-
-    ++nHits;
-
-    const Trk::TrackParameters* trackParameter = tsos->trackParameters();
-    if (trackParameter == nullptr) ++nHitsNoParams; //if no TrackParameters for TSOS we cannot define residuals
-  }
-
-  if (nHitsNoParams > 0) refitTrack = true;
-
-  ATH_MSG_DEBUG("** IDAlignMonResiduals::trackRequiresRefit ** does track requires a refit to access the residuals? " << refitTrack
-                                                                                                                      << " (hits on track: " << nHits
-                                                                                                                      << "  hits without params: " << nHitsNoParams << " ) ");
-
-  return refitTrack;
-}
-
-//--------------------------------------------------------------------------------------------
-
-void IDAlignMonResiduals::meanRMSProjections(TH2F* h2d, TH1F* h, int meanrms) {
-  //fills a 1-D histogram with either the mean or RMS of the residual distribution for each layer in the
-  //barrel. Does this by projecting a 2-D histo of residual vs layer.
-
-  int nbins_2d = h2d->GetNbinsX();
-  int nbins_h = h->GetNbinsX();
-
-  if (nbins_2d != nbins_h) if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Mean/RMS Histograms not set up correctly - nbins mismatch" << endmsg;
-
-  //calling this means that the histogram bin content is flagged
-  //as being an average and so adding histos from different jobs
-  //will produce weighted mean
-  h->SetBit(TH1::kIsAverage);
-
-  for (int i = 1; i != nbins_2d + 1; ++i) {
-    TH1D* hproj = h2d->ProjectionY("proj", i, i, "e");
-
-    //do not fill if there are 5 or less entries in the bin
-    if (hproj->GetEntries() <= 5 || hproj->Integral() <= 5) {
-      delete hproj;
-      continue;
-    }
-
-    if (meanrms == 0) {
-      h->SetBinContent(i, hproj->GetMean());
-      h->SetBinError(i, hproj->GetMeanError());
-    } else if (meanrms == 1) {
-      h->SetBinContent(i, hproj->GetRMS());
-      h->SetBinError(i, hproj->GetRMSError());
-    } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjectionsBarrel()" << endmsg;
-
-    delete hproj;
-  }
-
-  }
-
-//--------------------------------------------------------------------------------------------
-
-void IDAlignMonResiduals::meanRMSProjection2D(TH3F* h3d, TH2F* h2d, int meanrms, bool fitGaus) {
-  int nbins_x_3d = h3d->GetNbinsX();
-  int nbins_y_3d = h3d->GetNbinsY();
-  int nbins_x_2d = h2d->GetNbinsX();
-  int nbins_y_2d = h2d->GetNbinsY();
-
-  if (nbins_x_3d != nbins_x_2d) ATH_MSG_DEBUG("meanRMSProjection2D --> Mean/RMS Histograms not set up correctly - X bins mismatch! " << nbins_x_3d << " vs " << nbins_x_2d);
-  if (nbins_y_3d != nbins_y_2d) ATH_MSG_DEBUG("meanRMSProjection2D --> Mean/RMS Histograms not set up correctly - Y bins mismatch! " << nbins_y_3d << " vs " << nbins_y_2d);
-
-
-  for (int i = 1; i != nbins_x_2d + 1; ++i) {
-    for (int j = 1; j != nbins_y_2d + 1; ++j) {
-      TH1D* hproj = h3d->ProjectionZ("proj", i, i, j, j, "e");
-
-      bool doFit = true;
-      //do not fit & fill if there are too few entries in the projection
-      if (hproj->GetEntries() <= 10) doFit = false;
-      if (hproj->Integral() <= 10) doFit = false;
-      //do not fit & fill if there are too few entries in the bin with maximum entries
-      int binMax = hproj->GetMaximumBin();
-      if (hproj->GetBinContent(binMax) <= 5) doFit = false;
-      // side bins shoud have also some entries
-      if (hproj->GetBinContent(binMax + 1) <= 3) doFit = false;
-      if (hproj->GetBinContent(binMax - 1) <= 3) doFit = false;
-
-      if (!doFit) {
-        delete hproj;
-        continue;
-      }
-
-      if (fitGaus) { // fill histo with mean/sigma from a gaussian fit
-        hproj->Fit("gaus");
-        TF1* fit = hproj->GetFunction("gaus");
-        if (meanrms == 0) {
-          double mean = fit->GetParameter(1);
-          double meanerr = fit->GetParError(1);
-          h2d->SetBinContent(i, j, mean);
-          h2d->SetBinError(i, j, meanerr);
-        } else if (meanrms == 1) {
-          double sigma = fit->GetParameter(2);
-          double sigmaerr = fit->GetParError(2);
-          h2d->SetBinContent(i, j, sigma);
-          h2d->SetBinError(i, j, sigmaerr);
-        } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjections2D()" << endmsg;
-      } else {// !fitGaus
-        if (meanrms == 0) {
-          //std::cout << "Bin (" << i << "," << j << ") has " << hproj->GetEntries() << " entries & mean " <<
-          // hproj->GetMean() << std::endl;
-          h2d->SetBinContent(i, j, hproj->GetMean());
-          h2d->SetBinError(i, j, hproj->GetMeanError());
-        } else if (meanrms == 1) {
-          h2d->SetBinContent(i, j, hproj->GetRMS());
-          h2d->SetBinError(i, j, hproj->GetRMSError());
-        } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjections2D()" << endmsg;
-      }
-      delete hproj;
-    }
-  }
-
-  }
-
-//--------------------------------------------------------------------------------------------
-
-void IDAlignMonResiduals::fillRMSFromProfile(TProfile* hprof, TProfile* h) {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    h->Reset("ICE");
-  }
-
-  //Uses the spread information in an already filled TProfile to fill a second TProfile
-  //with the (correctly weigthed by N events) RMS of each bin
-
-  int nbins = hprof->GetNbinsX();
-
-  //h->BuildOptions(h->GetYmin(),h->GetYmax()," ");
-  //h->SetErrorOption(" ");
-
-  for (int i = 1; i != nbins + 1; ++i) {
-    float centre = (float) hprof->GetBinCenter(i);
-    float err = (float) hprof->GetBinError(i);//By default this is RMS/sqrt(N)
-    float nentries = (float) hprof->GetBinEntries(i);//getting N
-
-    float rms = (float) err * (sqrt(nentries));//calculating the RMS from the above quantities
-
-    //filling the profile with the RMS value N times to get the statistics right
-    //for when RMS TProfile's from several different jobs are merged
-    for (int j = 0; j < nentries; ++j) {
-      h->Fill(centre, rms);      //Need to understand!
-    }
-  }
-  }
-
-//--------------------------------------------------------------------------------------------
-
-void IDAlignMonResiduals::fillGaussianMeanOrWidth(TH2F* h2d, TH1F* h, float fitMin, float fitMax, int iopt) {
-  //Makes a Gaussian fit to each bin of a TH2F and fills a TH1F with
-  //the either the mean or width of this Gaussian
-  // iopt=0; Mean
-  // iopt=1; Width
-
-  //calling this means that the histogram bin content is flagged
-  //as being an average and so adding histos from different jobs
-  //will produce weighted mean
-  h->SetBit(TH1::kIsAverage);
-
-  int nbins_2d = h2d->GetNbinsX();
-  int nbins_h = h->GetNbinsX();
-
-  if (nbins_2d != nbins_h) if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Mean/Width Histograms not set up correctly - nbins mismatch" << endmsg;
-
-  for (int i = 1; i != nbins_2d + 1; ++i) {
-    TH1D* hproj = h2d->ProjectionY("proj", i, i, "e");
-
-    //do not fill if there are 5 or less entries in the bin
-    if (hproj->GetEntries() <= 5 || hproj->Integral() <= 5) {
-      delete hproj;
-      continue;
-    }
-
-    TF1* fit = new TF1("fit", "gaus", fitMin, fitMax);
-
-    hproj->Fit("fit", "RQNM");
-    float mean = fit->GetParameter(1);
-    float meanErr = fit->GetParError(1);
-    float width = fit->GetParameter(2);
-    float widthErr = fit->GetParError(2);
-
-    if (iopt == 0) {
-      h->SetBinContent(i, mean);
-      h->SetBinError(i, meanErr);
-    } else if (iopt == 1) {
-      h->SetBinContent(i, width);
-      h->SetBinError(i, widthErr);
-    } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in fillGaussianMeanOrWidth" << endmsg;
-
-    delete hproj;
-    delete fit;
-  }
-
-  }
-
-//================================================================
-// Establishes a minimim window for the TProfile
-//================================================================
-void IDAlignMonResiduals::SetMinWindow(TProfile* hProf, float windowMin, float windowMax) {
-  float min = hProf->GetMinimum();
-  float max = hProf->GetMaximum();
-  float margin = 0.05 * (max - min);
-
-  if (min > windowMin) min = windowMin - margin;
-  if (max < windowMax) max = windowMax + margin;
-  hProf->SetMinimum(min);
-  hProf->SetMaximum(max);
-}
-
-//================================================================
-// Establishes a minimim window for TH1
-//================================================================
-void IDAlignMonResiduals::SetMinWindow(TH1* h1, float windowMin, float windowMax) {
-  float min = h1->GetMinimum();
-  float max = h1->GetMaximum();
-  float margin = 0.05 * (max - min);
-
-  if (min > windowMin) min = windowMin - margin;
-  if (max < windowMax) max = windowMax + margin;
-  h1->SetMinimum(min);
-  h1->SetMaximum(max);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon) {
-  int totalLayers = m_PIX_Mgr->numerology().numLayers();
-
-  m_NPixLayers = totalLayers;
-
-  int totalEtaModules = m_gap_pix * (totalLayers - 1);  //to allow separation between layers for profiles
-  int totalPhiModules = totalEtaModules;  //to allow separation between layers for profiles
-
-  for (int iLayer = 0; iLayer < totalLayers; ++iLayer) {
-    if (!m_PIX_Mgr->numerology().useLayer(iLayer)) {
-      msg(MSG::WARNING) << "Layer " << iLayer << " Not in Use" << endmsg;
-      continue;
-    }
-    m_siliconBarrelLayersLabels.emplace_back("PIXL" + intToString(iLayer));
-    float EtaModules = m_PIX_Mgr->numerology().endEtaModuleForLayer(iLayer) - m_PIX_Mgr->numerology().beginEtaModuleForLayer(iLayer); //(i
-                                                                                                                                      // put
-                                                                                                                                      // float
-                                                                                                                                      // in
-                                                                                                                                      // order
-                                                                                                                                      // to
-                                                                                                                                      // divide
-                                                                                                                                      // by
-                                                                                                                                      // 2)
-    totalEtaModules += EtaModules;
-
-    float EtaModulesMin = -(EtaModules * 0.5f);
-    float EtaModulesMax = (EtaModules * 0.5f);
-
-    if (iLayer == 0) {
-      // IBL has one ring less (from -10 to +9)
-      EtaModules--;
-      EtaModulesMax--;
-    }
-
-    int maxPhiModulesPerLayer = m_PIX_Mgr->numerology().numPhiModulesForLayer(iLayer);
-    totalPhiModules += maxPhiModulesPerLayer;
-    m_pix_b_residualsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_residualx").c_str(), ("UnBiased X Residual Pixel Barrel " + intToString(iLayer)).c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-    RegisterHisto(al_mon, m_pix_b_residualsx[iLayer]);
-    m_pix_b_residualsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_residualy").c_str(), ("UnBiased Y  Residual Pixel Barrel " + intToString(iLayer)).c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-    RegisterHisto(al_mon, m_pix_b_residualsy[iLayer]);
-    m_pix_b_pullsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_pullx").c_str(), ("UnBiased X Pull Pixel Barrel " + intToString(iLayer)).c_str(), 100 * m_FinerBinningFactor, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-    RegisterHisto(al_mon, m_pix_b_pullsx[iLayer]);
-    m_pix_b_pullsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_pully").c_str(), ("UnBiased Y Pull Pixel Barrel " + intToString(iLayer)).c_str(), 100 * m_FinerBinningFactor, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-    RegisterHisto(al_mon, m_pix_b_pullsy[iLayer]);
-    m_pix_b_xresvsmodetaphi_3ds.push_back(new TH3F(("pix_b" + intToString(iLayer) + "_xresvsmodetaphi_3d").c_str(), ("X Residual Distbn vs Module Eta-Phi-ID Pixel Barrel " + intToString(iLayer)).c_str(),
-                                                   EtaModules, EtaModulesMin, EtaModulesMax,
-                                                   maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                   50 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));  //I
-                                                                                                                               // need
-                                                                                                                               // a
-                                                                                                                               // good
-                                                                                                                               // idea
-                                                                                                                               // for
-                                                                                                                               // the
-                                                                                                                               // x
-                                                                                                                               // axis
-    RegisterHisto(al_mon, m_pix_b_xresvsmodetaphi_3ds[iLayer]);
-
-    m_pix_b_yresvsmodetaphi_3ds.push_back(new TH3F(("pix_b" + intToString(iLayer) + "_yresvsmodetaphi_3d").c_str(), ("Y Residual Distbn vs Module Eta-Phi-ID Pixel Barrel " + intToString(iLayer)).c_str(),
-                                                   EtaModules, EtaModulesMin, EtaModulesMax,
-                                                   maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                   50 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));  //I
-                                                                                                                               // need
-                                                                                                                               // a
-                                                                                                                               // good
-                                                                                                                               // idea
-                                                                                                                               // for
-                                                                                                                               // the
-                                                                                                                               // x
-                                                                                                                               // axis
-    RegisterHisto(al_mon, m_pix_b_yresvsmodetaphi_3ds[iLayer]);
-
-
-    if (m_do3DOverlapHistos) {
-      m_pix_b_Oxresxvsmodetaphi_3ds.push_back(new TH3F(("pix_b" + intToString(iLayer) + "_Oxresxvsmodetaphi_3d").c_str(), ("X_Overlap Residual X Distbn vs Module Eta-Phi-ID Pixel Barrel " + intToString(iLayer) + ";ModEta;ModPhi;OResidual [mm]").c_str(),
-                                                       EtaModules * m_mapSplit, EtaModulesMin, EtaModulesMax,
-                                                       maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                       100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_Oxresxvsmodetaphi_3ds[iLayer]);
-      m_pix_b_Oxresyvsmodetaphi_3ds.push_back(new TH3F(("pix_b" + intToString(iLayer) + "_Oxresyvsmodetaphi_3d").c_str(), ("X_Overlap Residual Y Distbn vs Module Eta-Phi-ID Pixel Barrel " + intToString(iLayer) + ";ModEta;ModPhi;OResidual [mm]").c_str(),
-                                                       EtaModules * m_mapSplit, EtaModulesMin, EtaModulesMax,
-                                                       maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                       100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_Oxresyvsmodetaphi_3ds[iLayer]);
-      m_pix_b_Oyresxvsmodetaphi_3ds.push_back(new TH3F(("pix_b" + intToString(iLayer) + "_Oyresxvsmodetaphi_3d").c_str(), ("Y_Overlap Residual X Distbn vs Module Eta-Phi-ID Pixel Barrel " + intToString(iLayer) + ";ModEta;ModPhi;OResidual [mm]").c_str(),
-                                                       EtaModules * m_mapSplit, EtaModulesMin, EtaModulesMax,
-                                                       maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                       100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_Oyresxvsmodetaphi_3ds[iLayer]);
-      m_pix_b_Oyresyvsmodetaphi_3ds.push_back(new TH3F(("pix_b" + intToString(iLayer) + "_Oyresyvsmodetaphi_3d").c_str(), ("Y_Overlap Residual Y Distbn vs Module Eta-Phi-ID Pixel Barrel " + intToString(iLayer) + ";ModEta;ModPhi;OResidual [mm]").c_str(),
-                                                       EtaModules * m_mapSplit, EtaModulesMin, EtaModulesMax,
-                                                       maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                       100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_Oyresyvsmodetaphi_3ds[iLayer]);
-    }
-
-    if (m_extendedPlots) {
-      Double_t momentum[21] = {
-        15, 18, 21, 25, 29, 34, 40, 48, 59, 77, 0, 77, 59, 48, 40, 34, 29, 25, 21, 18, 15
-      };
-      Double_t customaxis[21];
-      for (int i = 0; i <= 20; ++i) {
-        if (i < 10) customaxis[i] = -1 / (momentum[i] * momentum[i]);
-        else if (i == 10) customaxis[i] = 0;
-        else customaxis[i] = 1 / (momentum[i] * momentum[i]);
-      }
-
-      //Pixel_unbiased residuals vs incident angle theta
-      m_pix_b_residualsx_incitheta.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualx_incitheta").c_str(), ("Unbiased X Residual Vs incident #theta angle Pixel Barrel Layer " + intToString(iLayer) + ";Incident #theta angle;PIX Res (mm)").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_residualsx_incitheta[iLayer]);
-      m_pix_b_residualsy_incitheta.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualy_incitheta").c_str(), ("Unbiased Y Residual Vs incident #theta angle Pixel Barrel Layer " + intToString(iLayer) + ";Incident #theta angle;PIX Res (mm)").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_residualsy_incitheta[iLayer]);
-      //Pixel_unbiased residuals vs incident angle phi
-      m_pix_b_residualsx_inciphi.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualx_inciphi").c_str(), ("Unbiased X Residual Vs incident #phi angle Pixel Barrel Layer " + intToString(iLayer) + ";Incident #phi angle;PIX Res (mm)").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_residualsx_inciphi[iLayer]);
-      m_pix_b_residualsy_inciphi.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualy_inciphi").c_str(), ("Unbiased Y Residual Vs incident #phi angle Pixel Barrel Layer " + intToString(iLayer) + ";Incident #phi angle;PIX Res (mm)").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_residualsy_inciphi[iLayer]);
-      //Pixel unbiased residuals vs pt
-      m_pix_b_residualsx_pt.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualx_pt").c_str(), ("Unbiased X Residual Vs Pt Pixel Barrel Layer " + intToString(iLayer) + ";Track pT (GeV);PIX #eta Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_residualsx_pt[iLayer]);
-      m_pix_b_residualsy_pt.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualy_pt").c_str(), ("Unbiased Y Residual Vs Pt Pixel Barrel Layer " + intToString(iLayer) + ";Track pT (GeV);PIX #eta Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_residualsy_pt[iLayer]);
-      //Pixel unbiased residuals vs qoverp2
-      m_pix_b_residualsx_qoverp2.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_unbiased_residualx_qoverp2").c_str(), ("Unbiased X Residual Vs Q/P^{2} Pixel Barrel Layer " + intToString(iLayer) + ";Track Q/P^{2} (GeV^{-2});PIX Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_residualsx_qoverp2[iLayer]);
-      m_pix_b_residualsy_qoverp2.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_unbiased_residualy_qoverp2").c_str(), ("Unbiased Y Residual Vs Q/P^{2} Pixel Barrel Layer " + intToString(iLayer) + ";Track Q/P^{2} (GeV^{-2});PIX Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_residualsy_qoverp2[iLayer]);
-      // Pixel biased residuals
-      m_pix_b_biased_residualsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_biased_residualx").c_str(), ("Biased X Residual Pixel Barrel " + intToString(iLayer) + ";Residual [mm]").c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_biased_residualsx[iLayer]);
-      m_pix_b_biased_residualsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_biased_residualy").c_str(), ("Biased Y Residual Pixel Barrel " + intToString(iLayer) + ";Residual [mm]").c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_biased_residualsy[iLayer]);
-      //Biased residuals vs pt
-      m_pix_b_biased_residualsx_pt.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_biased_residualx_pt").c_str(), ("Biased X Residual Vs Pt Pixel Barrel Layer " + intToString(iLayer) + ";Track pT (GeV);PIX Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_biased_residualsx_pt[iLayer]);
-      m_pix_b_biased_residualsy_pt.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_biased_residualy_pt").c_str(), ("Biased Y Residual Vs Pt Pixel Barrel Layer " + intToString(iLayer) + ";Track pT (GeV);PIX Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_biased_residualsy_pt[iLayer]);
-      //Pixel biased residuals vs qoverp2
-      m_pix_b_biased_residualsx_qoverp2.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_biased_residualx_qoverp2").c_str(), ("Biased X Residual Vs Q/P^{2} Pixel Barrel Layer " + intToString(iLayer) + ";Track Q/P^{2} (GeV^{-2});PIX Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_biased_residualsx_qoverp2[iLayer]);
-      m_pix_b_biased_residualsy_qoverp2.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_biased_residualy_qoverp2").c_str(), ("Biased Y Residual Vs Q/P^{2} Pixel Barrel Layer " + intToString(iLayer) + ";Track Q/P^{2} (GeV^{-2});PIX Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_biased_residualsy_qoverp2[iLayer]);
-      //Pulls vs pt
-      m_pix_b_pullsx_pt.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_pullx_pt").c_str(), ("X Pull Vs Pt Pixel Barrel Layer" + intToString(iLayer) + ";Track pT (GeV);PIX #phi Pull").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-      RegisterHisto(al_mon, m_pix_b_pullsx_pt[iLayer]);
-      m_pix_b_pullsy_pt.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_pully_pt").c_str(), ("Y Pull Vs Pt Pixel Barrel Layer" + intToString(iLayer) + ";Track pT (GeV);PIX #phi Pull").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-      RegisterHisto(al_mon, m_pix_b_pullsy_pt[iLayer]);
-      //overlap residuals for pixel
-      m_pix_b_xoverlapresidualsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_xoverlapresidualx").c_str(), ("X_Overlap Residual X Pixel Barrel Layer " + intToString(iLayer)).c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_xoverlapresidualsx[iLayer]);
-      m_pix_b_xoverlapresidualsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_xoverlapresidualy").c_str(), ("X_Overlap Residual Y Pixel Barrel Layer " + intToString(iLayer)).c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_xoverlapresidualsy[iLayer]);
-      m_pix_b_yoverlapresidualsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_yoverlapresidualx").c_str(), ("Y_Overlap Residual X Pixel Barrel Layer " + intToString(iLayer)).c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_yoverlapresidualsx[iLayer]);
-      m_pix_b_yoverlapresidualsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_yoverlapresidualy").c_str(), ("Y_Overlap Residual Y Pixel Barrel Layer " + intToString(iLayer)).c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_yoverlapresidualsy[iLayer]);
-      //3d biased residuals modetamodphi
-      //m_pix_b_biased_xresvsmodetaphi_3ds[iLayer] = new
-      // TH3F(("pix_b"+intToString(iLayer)+"_biased_xresvsmodetaphi_3d").c_str(),("X Biased Residual Distbn vs Module
-      // Eta-Phi-ID Pixel Barrel "+intToString(iLayer)+";ModEta;ModPhi").c_str(),
-      //EtaModules,-(EtaModules/2.),(EtaModules/2.),maxPhiModulesPerLayer,0,maxPhiModulesPerLayer,100,m_minPIXResXFillRange,m_maxPIXResXFillRange);
-      //  //I need a good idea for the x axis
-
-      //	m_pix_b_biased_xresvsmodetaphi_3ds.push_back( new
-      // TH3F(("pix_b"+intToString(iLayer)+"_biased_xresvsmodetaphi_3d").c_str(),
-      //						       ("X Biased Residual Distbn vs Module Eta-Phi-ID Pixel Barrel
-      // "+intToString(iLayer)+";ModEta;ModPhi").c_str(),
-      //						       EtaModules*m_mapSplit, -m_PixelBarrelYSize*EtaModules/2,
-      // m_PixelBarrelYSize*EtaModules/2,
-      //						       maxPhiModulesPerLayer*m_mapSplit,0,maxPhiModulesPerLayer*m_PixelBarrelXSize,
-      //						       100*m_FinerBinningFactor,m_minPIXResXFillRange,m_maxPIXResXFillRange));
-      m_pix_b_detailed_xresvsmodetaphi_3ds.push_back(new TH3F(("pix_b" + intToString(iLayer) + "_detailed_xresvsmodetaphi_3d").c_str(),
-                                                              ("Detailed X Residual Distbn vs Module Eta-Phi-ID Pixel Barrel " + intToString(iLayer) + ";ModEta;ModPhi").c_str(),
-                                                              EtaModules * m_mapSplit, EtaModulesMin, EtaModulesMax,
-                                                              maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                              100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_detailed_xresvsmodetaphi_3ds[iLayer]);
-
-      //m_pix_b_biased_yresvsmodetaphi_3ds[iLayer] = new
-      // TH3F(("pix_b"+intToString(iLayer)+"_biased_yresvsmodetaphi_3d").c_str(),("Y Biased Residual Distbn vs Module
-      // Eta-Phi-ID Pixel Barrel "+intToString(iLayer)+";ModEta;ModPhi").c_str(),
-      //EtaModules,-(EtaModules/2.),(EtaModules/2.),maxPhiModulesPerLayer,0,maxPhiModulesPerLayer,100,m_minPIXResXFillRange,m_maxPIXResXFillRange);
-      //  //I need a good idea for the x axis
-      //m_pix_b_biased_yresvsmodetaphi_3ds.push_back( new
-      // TH3F(("pix_b"+intToString(iLayer)+"_biased_yresvsmodetaphi_3d").c_str(),
-      //						       ("Y Biased Residual Distbn vs Module Eta-Phi-ID Pixel Barrel
-      // "+intToString(iLayer)+";ModEta;ModPhi").c_str(),
-      //						       EtaModules*m_mapSplit, -m_PixelBarrelYSize*EtaModules/2,
-      // m_PixelBarrelYSize*EtaModules/2,
-      //						       maxPhiModulesPerLayer*m_mapSplit,0,maxPhiModulesPerLayer*m_PixelBarrelXSize,
-      //						       100*m_FinerBinningFactor,m_minPIXResYFillRange,m_maxPIXResYFillRange));
-      m_pix_b_detailed_yresvsmodetaphi_3ds.push_back(new TH3F(("pix_b" + intToString(iLayer) + "_detailed_yresvsmodetaphi_3d").c_str(),
-                                                              ("Detailed Y residual Distbn vs Module Eta-Phi-ID Pixel Barrel " + intToString(iLayer) + ";ModEta;ModPhi").c_str(),
-                                                              EtaModules * m_mapSplit, EtaModulesMin, EtaModulesMax,
-                                                              maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                              100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_detailed_yresvsmodetaphi_3ds[iLayer]);
-
-      //Half Shell
-      m_pix_b_top_residualsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_top_residualx").c_str(), ("UnBiased X Residual Pixel Barrel Layer " + intToString(iLayer) + " (Top Half Shell)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_top_residualsx[iLayer]);
-      m_pix_b_top_residualsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_top_residualy").c_str(), ("UnBiased Y Residual Pixel Barrel Layer " + intToString(iLayer) + " (Top Half Shell)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_top_residualsy[iLayer]);
-      m_pix_b_btm_residualsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_btm_residualx").c_str(), ("UnBiased X Residual Pixel Barrel Layer " + intToString(iLayer) + " (Btm Half Shell)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_btm_residualsx[iLayer]);
-      m_pix_b_btm_residualsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_btm_residualy").c_str(), ("UnBiased Y Residual Pixel Barrel Layer " + intToString(iLayer) + " (Btm Half Shell)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_btm_residualsy[iLayer]);
-      //Half Shell Biased
-      m_pix_b_top_biased_residualsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_top_biased_residualx").c_str(), ("Biased X Residual Pixel Barrel Layer " + intToString(iLayer) + " (Top Half Shell)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_top_biased_residualsx[iLayer]);
-      m_pix_b_top_biased_residualsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_top_biased_residualy").c_str(), ("Biased Y Residual Pixel Barrel Layer " + intToString(iLayer) + " (Top Half Shell)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_top_biased_residualsy[iLayer]);
-      m_pix_b_btm_biased_residualsx.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_btm_biased_residualx").c_str(), ("Biased X Residual Pixel Barrel Layer " + intToString(iLayer) + " (Btm Half Shell)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-      RegisterHisto(al_mon, m_pix_b_btm_biased_residualsx[iLayer]);
-      m_pix_b_btm_biased_residualsy.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_btm_biased_residualy").c_str(), ("Biased Y Residual Pixel Barrel Layer " + intToString(iLayer) + " (Btm Half Shell)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-      RegisterHisto(al_mon, m_pix_b_btm_biased_residualsy[iLayer]);
-      //finely binned histograms with wide range for calculation of resolution
-
-
-      if (m_doClusterSizeHistos) {
-        m_pix_b_clustersize.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_clustersize").c_str(), ("Cluster size Pixel Barrel Layer " + intToString(iLayer)).c_str(), m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersize[iLayer]);
-        m_pix_b_clustersizePhi.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_clustersizePhi").c_str(), ("Cluster Phi size Pixel Barrel Layer " + intToString(iLayer)).c_str(), m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersizePhi[iLayer]);
-        m_pix_b_clustersizeZ.push_back(new TH1F(("pix_b" + intToString(iLayer) + "_clustersizeZ").c_str(), ("Cluster Z size Pixel Barrel Layer " + intToString(iLayer)).c_str(), m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersizeZ[iLayer]);
-
-        m_pix_b_residualsx_clustersize.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualx_clustersize").c_str(), ("Unbiased X Residual Vs Cluster Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Size;PIX Res (mm)").c_str(),
-                                                          m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                          100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsx_clustersize[iLayer]);
-        m_pix_b_residualsy_clustersize.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualy_clustersize").c_str(), ("Unbiased Y Residual Vs Cluster Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Size;PIX Res (mm)").c_str(),
-                                                          m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                          100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsy_clustersize[iLayer]);
-
-        m_pix_b_residualsx_clustersizeP.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_residualx_clustersize_p").c_str(), ("Unbiased X Residual Vs Cluster Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Size;PIX Res (mm)").c_str(),
-                                                               m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5
-                                                               , m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsx_clustersizeP[iLayer]);
-        m_pix_b_residualsy_clustersizeP.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_residualy_clustersize_p").c_str(), ("Unbiased Y Residual Vs Cluster Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Size;PIX Res (mm)").c_str(),
-                                                               m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5
-                                                               , m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsy_clustersizeP[iLayer]);
-
-        m_pix_b_residualsx_clustersizePhi.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualx_clustersizePhi").c_str(), ("Unbiased X Residual Vs Cluster Phi Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Phi Size;PIX Res (mm)").c_str(),
-                                                             m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5
-                                                             , 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsx_clustersizePhi[iLayer]);
-        m_pix_b_residualsy_clustersizePhi.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualy_clustersizePhi").c_str(), ("Unbiased Y Residual Vs Cluster Phi Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Phi Size;PIX Res (mm)").c_str(),
-                                                             m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                             100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsy_clustersizePhi[iLayer]);
-
-        m_pix_b_residualsx_clustersizePhiP.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_residualx_clustersizePhi_p").c_str(), ("Unbiased X Residual Vs Cluster Phi Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Phi Size;PIX Res (mm)").c_str(),
-                                                                  m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                                  m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsx_clustersizePhiP[iLayer]);
-        m_pix_b_residualsy_clustersizePhiP.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_residualy_clustersizePhi_p").c_str(), ("Unbiased Y Residual Vs Cluster Phi Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Phi Size;PIX Res (mm)").c_str(),
-                                                                  m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                                  m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsy_clustersizePhiP[iLayer]);
-
-
-        m_pix_b_residualsx_clustersizeZ.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualx_clustersizeZ").c_str(), ("Unbiased X Residual Vs Cluster Z Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Z Size;PIX Res (mm)").c_str(),
-                                                           m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                           100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsx_clustersizeZ[iLayer]);
-        m_pix_b_residualsy_clustersizeZ.push_back(new TH2F(("pix_b" + intToString(iLayer) + "_residualy_clustersizeZ").c_str(), ("Unbiased Y Residual Vs Cluster Z Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Z Size;PIX Res (mm)").c_str(),
-                                                           m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                           100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsy_clustersizeZ[iLayer]);
-
-        m_pix_b_residualsx_clustersizeZP.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_residualx_clustersizeZ_p").c_str(), ("Unbiased X Residual Vs Cluster Z Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Z Size;PIX Res (mm)").c_str(),
-                                                                m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                                m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsx_clustersizeZP[iLayer]);
-        m_pix_b_residualsy_clustersizeZP.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_residualy_clustersizeZ_p").c_str(), ("Unbiased Y Residual Vs Cluster Z Size Pixel Barrel Layer " + intToString(iLayer) + ";Cluster Z Size;PIX Res (mm)").c_str(),
-                                                                m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5,
-                                                                m_minPIXResXFillRange, m_maxPIXResXFillRange));
-        RegisterHisto(al_mon, m_pix_b_residualsy_clustersizeZP[iLayer]);
-
-        m_pix_b_clustersize_incidentAngle.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_clustersize_incidentAngle").c_str(), ("Cluster Size Pixel vs Incident Theta Angle Barrel Layer " + intToString(iLayer) + "Incident Theta Angle (rad);Cluster Size").c_str(),
-                                                                 20, -m_IncidentThetaRange, m_IncidentThetaRange, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersize_incidentAngle[iLayer]);
-        m_pix_b_clustersizePhi_incidentAngle.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_clustersizePhi_incidentAngle").c_str(), ("Cluster Phi Size vs Incident Theta Angle Pixel Barrel Layer " + intToString(iLayer) + "Incident Theta Angle (rad);Cluster Phi Size").c_str(),
-                                                                    20, -m_IncidentThetaRange, m_IncidentThetaRange, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersizePhi_incidentAngle[iLayer]);
-        m_pix_b_clustersizeZ_incidentAngle.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_clustersizeZ_incidentAngle").c_str(), ("Cluster Size vs Incident Theta Angle Pixel Barrel Layer " + intToString(iLayer) + "Incident Theta Angle (rad);Cluster Z Size").c_str(),
-                                                                  20, -m_IncidentThetaRange, m_IncidentThetaRange, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersizeZ_incidentAngle[iLayer]);
-
-        m_pix_b_clustersize_incidentAnglePhi.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_clustersize_incidentAnglePhi").c_str(), ("Cluster Size Pixel vs Incident Phi Angle Barrel Layer " + intToString(iLayer) + "Incident Phi Angle (rad);Cluster Size").c_str(),
-                                                                    20, -m_IncidentPhiRange, m_IncidentPhiRange, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersize_incidentAnglePhi[iLayer]);
-        m_pix_b_clustersizePhi_incidentAnglePhi.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_clustersizePhi_incidentAnglePhi").c_str(), ("Cluster Phi Size vs Incident Phi Angle Pixel Barrel Layer " + intToString(iLayer) + "Incident Phi Angle (rad);Cluster Phi Size").c_str(),
-                                                                       20, -m_IncidentPhiRange, m_IncidentPhiRange, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersizePhi_incidentAnglePhi[iLayer]);
-        m_pix_b_clustersizeZ_incidentAnglePhi.push_back(new TProfile(("pix_b" + intToString(iLayer) + "_clustersizeZ_incidentAnglePhi").c_str(), ("Cluster Size vs Incident Phi Angle Pixel Barrel Layer " + intToString(iLayer) + "Incident Phi Angle (rad);Cluster Z Size").c_str(),
-                                                                     20, -m_IncidentPhiRange, m_IncidentPhiRange, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_pix_b_clustersizeZ_incidentAnglePhi[iLayer]);
-      }//doClusterSizeHistos
-    }//Extended Plots
-  } //Layer loop
-
-  //basic residual histograms
-  m_pix_b_residualx = new TH1F("pix_b_residualx", "UnBiased X Residual Pixel Barrel;Residual [mm]", 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_b_residualx);
-  m_pix_b_residualy = new TH1F("pix_b_residualy", "UnBiased Y Residual Pixel Barrel;Residual [mm]", 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-  RegisterHisto(al_mon, m_pix_b_residualy);
-  m_pix_b_biased_residualx = new TH1F("pix_b_biasedresidualx", "Biased X Residual Pixel Barrel;Residual [mm]", 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_b_biased_residualx);
-  m_pix_b_biased_residualy = new TH1F("pix_b_biasedresidualy", "Biased Y Residual Pixel Barrel;Residual [mm]", 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-  RegisterHisto(al_mon, m_pix_b_biased_residualy);
-  // Oxx,Oxy,Oyy,Oyx vs module eta/phi
-  m_pix_b_Oxresxvsmodeta = new TProfile("pix_b_Oxresxvsmodeta", "X_Overlap Residual X Mean vs (Modified) Module Eta Pixel Barrel", totalEtaModules, 0, totalEtaModules, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_b_Oxresxvsmodeta);
-  m_pix_b_Oxresxvsmodphi = new TProfile("pix_b_Oxresxvsmodphi", "X_Overlap Residual X Mean vs (Modified) Module Phi Pixel Barrel", totalPhiModules, 0, totalPhiModules, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_b_Oxresxvsmodphi);
-  m_pix_b_Oyresyvsmodeta = new TProfile("pix_b_Oyresyvsmodeta", "Y_Overlap Residual Y Mean vs (Modified) Module Eta Pixel Barrel", totalEtaModules, 0, totalEtaModules, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-  RegisterHisto(al_mon, m_pix_b_Oyresyvsmodeta);
-  m_pix_b_Oyresyvsmodphi = new TProfile("pix_b_Oyresyvsmodphi", "Y_Overlap Residual Y Mean vs (Modified) Module Phi Pixel Barrel", totalPhiModules, 0, totalPhiModules, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-  RegisterHisto(al_mon, m_pix_b_Oyresyvsmodphi);
-  //These histograms are filled in post-processing - only initiated here such that they can be registered as "shift".
-  //PIXEL histograms for monitoring residual dependence on module eta/phi (stave/ring)
-  m_pix_b_xresvsmodeta = new TH1F("pix_b_xresvsmodeta", "X Residual Mean vs (Modified) Module Eta Pixel Barrel;(Modified) Module Eta Identifier;Mean Residual X",
-                                  totalEtaModules + 2, -1.5, totalEtaModules + 1.5);
-  RegisterHisto(al_mon, m_pix_b_xresvsmodeta);
-  m_pix_b_xresvsmodphi = new TH1F("pix_b_xresvsmodphi", "X Residual Mean vs (Modified) Module Phi Pixel Barrel;(Modified) Module Phi Identifier;Mean Residual X",
-                                  totalPhiModules + 2, -1.5, totalPhiModules + 1.5);
-  RegisterHisto(al_mon, m_pix_b_xresvsmodphi);
-  m_pix_b_yresvsmodeta = new TH1F("pix_b_yresvsmodeta", "Y Residual Mean vs (Modified) Module Eta Pixel Barrel;(Modified) Module Eta Identifier;Mean Residual Y",
-                                  totalEtaModules + 2, -1.5, totalEtaModules + 1.5);
-  RegisterHisto(al_mon, m_pix_b_yresvsmodeta);
-  m_pix_b_yresvsmodphi = new TH1F("pix_b_yresvsmodphi", "Y Residual Mean vs (Modified) Module Phi Pixel Barrel;(Modified) Module Phi Identifier;Mean Residual Y",
-                                  totalPhiModules + 2, -1.5, totalPhiModules + 1.5);
-  RegisterHisto(al_mon, m_pix_b_yresvsmodphi);
-
-  // - x axis should label correct eta ring
-  //int layerModEtaShift[4] = {10,30,48,65};       //HARDCODED!
-  //int layerModPhiShift[4] = {0,18,44,86};
-
-  int phibinid = 0;
-  for (int ibin = 1; ibin <= m_pix_b_xresvsmodphi->GetNbinsX(); ibin++) {
-    // Please note that there is a free bin at the beginning and the end
-    // IBL has 14 staves: starts at bin 2
-    if (2 <= ibin && ibin <= 15) {
-      phibinid++;
-      if (ibin == 2) phibinid = 1; // IBL stave count starts at 1
-      m_pix_b_xresvsmodphi->GetXaxis()->SetBinLabel(ibin, ("IBL_" + intToString(phibinid)).c_str());
-      m_pix_b_yresvsmodphi->GetXaxis()->SetBinLabel(ibin, ("IBL_" + intToString(phibinid)).c_str());
-    }
-    // B layer has 22 staves: starts at bin 24
-    if (24 <= ibin && ibin <= 45) {
-      phibinid++;
-      if (ibin == 24) phibinid = 0;
-      m_pix_b_xresvsmodphi->GetXaxis()->SetBinLabel(ibin, ("BLay_" + intToString(phibinid)).c_str());
-      m_pix_b_yresvsmodphi->GetXaxis()->SetBinLabel(ibin, ("BLay_" + intToString(phibinid)).c_str());
-    }
-  }
-
-  //
-
-  if (m_extendedPlots) {
-    //finely binned histograms with wide range for calculation of resolution
-    m_pix_b_residualx_fine = new TH1F("pix_b_residualx_fine", "UnBiased X Residual Pixel Barrel;Residual [mm]", 2000, -2.0, 2.0);
-    RegisterHisto(al_mon, m_pix_b_residualx_fine);
-    m_pix_b_residualy_fine = new TH1F("pix_b_residualy_fine", "UnBiased Y Residual Pixel Barrel;Residual [mm]", 2000, -2.0, 2.0);
-    RegisterHisto(al_mon, m_pix_b_residualy_fine);
-
-    // Pixel biased residuals vs Pt
-    m_pix_b_biased_residualx_pt = new TH2F("pix_b_biased_residualx_pt", "Biased X Residual Vs Pt Pixel Barrel;Track pT (GeV); Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_b_biased_residualx_pt);
-    m_pix_b_biased_residualy_pt = new TH2F("pix_b_biased_residualy_pt", "Biased Y Residual Vs Pt Pixel Barrel;Track pT (GeV); Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_b_biased_residualy_pt);
-
-    // Pixel unbiased residuals vs Pt
-    m_pix_b_residualx_pt = new TH2F("pix_b_residualx_pt", "X Residual Vs Pt Pixel Barrel;Track pT (GeV);Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    RegisterHisto(al_mon, m_pix_b_residualx_pt);
-    m_pix_b_residualy_pt = new TH2F("pix_b_residualy_pt", "Y Residual Vs Pt Pixel Barrel;Track pT (GeV);Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    RegisterHisto(al_mon, m_pix_b_residualy_pt);
-    // Pixel local positions
-    m_pix_b_extrapolated_localx = new TH1F("pix_b_extrapolated_localx", "Pixel Barrel Extrapolated Local X;localX (mm)", 200, -(m_PixelBarrelXSize / 2) * 1.1, (m_PixelBarrelXSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_pix_b_extrapolated_localx);
-    m_pix_b_extrapolated_localy = new TH1F("pix_b_extrapolated_localy", "Pixel Barrel Extrapolated Local Y;localY (mm)", 200, -(m_PixelBarrelYSize / 2) * 1.1, (m_PixelBarrelYSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_pix_b_extrapolated_localy);
-    m_pix_b_measured_localx = new TH1F("pix_b_measured_localx", "Pixel Barrel Measured Local X;localX (mm)", 200, -(m_PixelBarrelXSize / 2) * 1.1, (m_PixelBarrelXSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_pix_b_measured_localx);
-    m_pix_b_measured_localy = new TH1F("pix_b_measured_localy", "Pixel Barrel Measured Local Y;local Y(mm)", 200, -(m_PixelBarrelYSize / 2) * 1.1, (m_PixelBarrelYSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_pix_b_measured_localy);
-
-    // Pulls vs pt
-    m_pix_b_pullx_pt = new TH2F("pix_b_pullx_pt", "X Pull Vs Pt Pixel Barrel;Track pT (GeV)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_pix_b_pullx_pt);
-    m_pix_b_pully_pt = new TH2F("pix_b_pully_pt", "Y Pull Vs Pt Pixel Barrel;Track pT (GeV)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_pix_b_pully_pt);
-  }
-}
-
-void IDAlignMonResiduals::MakePIXEndCapsHistograms(MonGroup& al_mon) {
-  //Pix endcaps residuals.
-  //std::string diskName[4] = {"d0_","d1_","d2_",""};
-  //std::string diskTitle[4]= {"Disk 0","Disk 1","Disk 2",""};
-  int totalPhiModules = 0;
-  int NDisks = m_PIX_Mgr->numerology().numDisks();
-  int maxPhiModulesPerRing = 0;
-  // Pixel biased residuals vs QoverP^2
-  // Variable binning for res vs qoverp2 plots
-  Double_t momentum[21] = {
-    15, 18, 21, 25, 29, 34, 40, 48, 59, 77, 0, 77, 59, 48, 40, 34, 29, 25, 21, 18, 15
-  };  //this variable has to be created just once. I don't like this replication.
-  Double_t customaxis[21];
-
-  for (int i = 0; i <= 20; i++) {
-    if (i < 10) customaxis[i] = -1 / (momentum[i] * momentum[i]);
-    else if (i == 10) customaxis[i] = 0;
-    else customaxis[i] = 1 / (momentum[i] * momentum[i]);
-  }
-  for (int iECIndex = 0; iECIndex < m_PIX_Mgr->numerology().numEndcaps(); ++iECIndex) {
-    totalPhiModules = m_gap_pix * (NDisks - 1); //I reset to avoid double counting for the Endcaps
-    int iSide = m_PIX_Mgr->numerology().endcapId(iECIndex);
-    for (int iWheel = 0; iWheel < NDisks; ++iWheel) {
-      int rings = 0;
-      if (!m_PIX_Mgr->numerology().useDisk(iWheel)) {//To check if the Wheel is in use.
-        msg(MSG::WARNING) << "Wheel " << iWheel << " Not in Use" << endmsg;
-        continue;
-      } else {
-        rings = m_PIX_Mgr->numerology().numRingsForDisk(iWheel);
-        if (iSide > 0) m_siliconEndcapLayersLabels.emplace_back("PIXL" + intToString(iWheel));
-      }
-      maxPhiModulesPerRing = 0;
-      for (int iEta = 0; iEta < rings; ++iEta) { //actually number of rings for PIX = 1
-        if (maxPhiModulesPerRing < m_PIX_Mgr->numerology().numPhiModulesForDiskRing(iWheel, iEta)) //maybe a !=
-          maxPhiModulesPerRing = m_PIX_Mgr->numerology().numPhiModulesForDiskRing(iWheel, iEta);
-        totalPhiModules += maxPhiModulesPerRing;
-      }
-      if (iSide > 0) {
-        m_pix_eca_unbiased_xresvsmodphi_disks.push_back(new TProfile(("pix_eca_unbiased_xresvsmodphi_disk" + intToString(iWheel)).c_str(), ("UNBIASED X Residual Average vs Module Phi of Pixel Endcap A Disk " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_pix_eca_unbiased_xresvsmodphi_disks[iWheel]);
-        m_pix_eca_unbiased_yresvsmodphi_disks.push_back(new TProfile(("pix_eca_unbiased_yresvsmodphi_disk" + intToString(iWheel)).c_str(), ("UNBIASED Y Residual Average vs Module Phi of Pixel Endcap A Disk " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_pix_eca_unbiased_yresvsmodphi_disks[iWheel]);
-
-        if (m_extendedPlots) {
-          //biased residuals
-          m_pix_eca_biased_residualsx.push_back(new TH1F(("pix_eca_d" + intToString(iWheel) + "_biased_residualx").c_str(), ("Biased X Residual Pixel EndCap A Disk" + intToString(iWheel) + ";Residual (mm)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_eca_biased_residualsx[iWheel]);
-          m_pix_eca_biased_residualsy.push_back(new TH1F(("pix_eca_d" + intToString(iWheel) + "_biased_residualy").c_str(), ("Biased Y Residual Pixel EndCap A Disk " + intToString(iWheel) + ";Residual (mm)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_eca_biased_residualsy[iWheel]);
-          //residual pt
-          m_pix_eca_residualsx_pt.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_residualx_pt").c_str(), ("Unbiased X Residual Vs Pt Pixel EndCap A Disk " + intToString(iWheel) + ";Track pT (GeV);Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_eca_residualsx_pt[iWheel]);
-          m_pix_eca_residualsy_pt.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_residualy_pt").c_str(), ("Unbiased Y Residual Vs Pt Pixel EndCap A Disk " + intToString(iWheel) + ";Track pT (GeV);Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_eca_residualsy_pt[iWheel]);
-          //pull pt
-          m_pix_eca_pullsx_pt.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_pullx_pt").c_str(), ("Unbiased X Pull Vs Pt Pixel EndCap A Disk " + intToString(iWheel) + ";Track pT (GeV)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-          RegisterHisto(al_mon, m_pix_eca_pullsx_pt[iWheel]);
-          m_pix_eca_pullsy_pt.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_pully_pt").c_str(), ("Unbiased Y Pull Vs Pt Pixel EndCap A Disk " + intToString(iWheel) + ";Track pT (GeV)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-          RegisterHisto(al_mon, m_pix_eca_pullsy_pt[iWheel]);
-          // Pixel unbiased residuals vs QoverP^2
-          m_pix_eca_residualsx_qoverp2.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_unbiased_residualx_qoverp2").c_str(), ("Unbiased X Residual Vs Q/P^{2} Pixel EndCap A Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_eca_residualsx_qoverp2[iWheel]);
-          m_pix_eca_residualsy_qoverp2.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_unbiased_residualy_qoverp2").c_str(), ("Unbiased Y Residual Vs Q/P^{2} Pixel EndCap A Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_eca_residualsy_qoverp2[iWheel]);
-          //biased residual pt
-          m_pix_eca_biased_residualsx_pt.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_biased_residualx_pt").c_str(), ("Biased X Residual Vs Pt Pixel EndCap A Disk " + intToString(iWheel) + ";Track pT (GeV);Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_eca_biased_residualsx_pt[iWheel]);
-          m_pix_eca_biased_residualsy_pt.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_biased_residualy_pt").c_str(), ("Biased Y Residual Vs Pt Pixel EndCap A Disk " + intToString(iWheel) + ";Track pT (GeV);Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_eca_biased_residualsy_pt[iWheel]);
-          //biased residual qoverp2
-          m_pix_eca_biased_residualsx_qoverp2.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_biased_residualx_qoverp2").c_str(), ("Biased X Residual Vs Q/P^{2} Pixel EndCap A Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_eca_biased_residualsx_qoverp2[iWheel]);
-          m_pix_eca_biased_residualsy_qoverp2.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_biased_residualy_qoverp2").c_str(), ("Biased Y Residual Vs Q/P^{2} Pixel EndCap A Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_eca_biased_residualsy_qoverp2[iWheel]);
-          //biased resvsmodphi
-          m_pix_eca_biased_xresvsmodphi_2ds.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_biased_xresvsmodphi_2d").c_str(), ("X Biased Residual Distbn vs Module Phi Pixel ECA D" + intToString(iWheel) + ";Module Phi ID; Residual X (mm)").c_str(), maxPhiModulesPerRing, 0, maxPhiModulesPerRing, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_eca_biased_xresvsmodphi_2ds[iWheel]);
-          m_pix_eca_biased_yresvsmodphi_2ds.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_biased_yresvsmodphi_2d").c_str(), ("Y Biased Residual Distbn vs Module Phi Pixel ECA D" + intToString(iWheel) + ";Module Phi ID; Residual Y (mm)").c_str(), maxPhiModulesPerRing, 0, maxPhiModulesPerRing, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_eca_biased_yresvsmodphi_2ds[iWheel]);
-
-          if (m_doClusterSizeHistos) {
-            m_pix_eca_clustersize.push_back(new TH1F(("pix_eca_d" + intToString(iWheel) + "_clustersize").c_str(), ("Cluster size Pixel ECA Disk " + intToString(iWheel)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersize[iWheel]);
-            m_pix_eca_clustersizePhi.push_back(new TH1F(("pix_eca_d" + intToString(iWheel) + "_clustersizePhi").c_str(), ("Cluster Phi size Pixel ECA Disk " + intToString(iWheel)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersizePhi[iWheel]);
-            m_pix_eca_clustersizeZ.push_back(new TH1F(("pix_eca_d" + intToString(iWheel) + "_clustersizeZ").c_str(), ("Cluster Z size Pixel ECA Disk " + intToString(iWheel)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersizeZ[iWheel]);
-
-            m_pix_eca_residualsx_clustersize.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_residualx_clustersize").c_str(), ("Unbiased X Residual Vs Cluster Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsx_clustersize[iWheel]);
-            m_pix_eca_residualsy_clustersize.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_residualy_clustersize").c_str(), ("Unbiased Y Residual Vs Cluster Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsy_clustersize[iWheel]);
-
-            m_pix_eca_residualsx_clustersizePhi.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_residualx_clustersizePhi").c_str(), ("Unbiased X Residual Vs Cluster Phi Size ECA Disk " + intToString(iWheel) + ";Cluster Phi Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsx_clustersizePhi[iWheel]);
-            m_pix_eca_residualsy_clustersizePhi.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_residualy_clustersizePhi").c_str(), ("Unbiased Y Residual Vs Cluster Phi Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Phi Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsy_clustersizePhi[iWheel]);
-
-            m_pix_eca_residualsx_clustersizeZ.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_residualx_clustersizeZ").c_str(), ("Unbiased X Residual Vs Cluster Z Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Z Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsx_clustersizeZ[iWheel]);
-            m_pix_eca_residualsy_clustersizeZ.push_back(new TH2F(("pix_eca_d" + intToString(iWheel) + "_residualy_clustersizeZ").c_str(), ("Unbiased Y Residual Vs Cluster Z Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Z Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsy_clustersizeZ[iWheel]);
-
-            m_pix_eca_residualsx_clustersizeP.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_residualx_clustersize_p").c_str(), ("Unbiased X Residual Vs Cluster Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsx_clustersizeP[iWheel]);
-            m_pix_eca_residualsy_clustersizeP.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_residualy_clustersize_p").c_str(), ("Unbiased Y Residual Vs Cluster Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsy_clustersizeP[iWheel]);
-
-            m_pix_eca_residualsx_clustersizePhiP.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_residualx_clustersizePhi_p").c_str(), ("Unbiased X Residual Vs Cluster Phi Size ECA Disk " + intToString(iWheel) + ";Cluster Phi Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsx_clustersizePhiP[iWheel]);
-            m_pix_eca_residualsy_clustersizePhiP.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_residualy_clustersizePhi_p").c_str(), ("Unbiased Y Residual Vs Cluster Phi Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Phi Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsy_clustersizePhiP[iWheel]);
-
-            m_pix_eca_residualsx_clustersizeZP.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_residualx_clustersizeZ_p").c_str(), ("Unbiased X Residual Vs Cluster Z Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Z Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsx_clustersizeZP[iWheel]);
-            m_pix_eca_residualsy_clustersizeZP.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_residualy_clustersizeZ_p").c_str(), ("Unbiased Y Residual Vs Cluster Z Size Pixel ECA Disk " + intToString(iWheel) + ";Cluster Z Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_eca_residualsy_clustersizeZP[iWheel]);
-
-            m_pix_eca_clustersize_incidentAngle.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_clustersize_incidentAngle").c_str(), ("Cluster Size Pixel Vs Incident Theta Angle Pixel ECA Disk " + intToString(iWheel) + "Incident Theta Angle (rad);Cluster Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersize_incidentAngle[iWheel]);
-            m_pix_eca_clustersizePhi_incidentAngle.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_clustersizePhi_incidentAngle").c_str(), ("Cluster Size Pixel Vs Incident Theta Angle Pixel ECA Disk " + intToString(iWheel) + "Incident Theta Angle (rad);Cluster Phi Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersizePhi_incidentAngle[iWheel]);
-            m_pix_eca_clustersizeZ_incidentAngle.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_clustersizeZ_incidentAngle").c_str(), ("Cluster Size Pixel Vs Incident Theta Angle Pixel ECA Disk " + intToString(iWheel) + "Incident Theta Angle (rad);Cluster Z Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersizeZ_incidentAngle[iWheel]);
-
-            m_pix_eca_clustersize_incidentAnglePhi.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_clustersize_incidentAnglePhi").c_str(), ("Cluster Size Pixel Vs Incident Phi Angle Pixel ECA Disk " + intToString(iWheel) + "Incident Phi Angle (rad);Cluster Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersize_incidentAnglePhi[iWheel]);
-            m_pix_eca_clustersizePhi_incidentAnglePhi.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_clustersizePhi_incidentAnglePhi").c_str(), ("Cluster Phi Size Pixel Vs Incident Phi Angle Pixel ECA Disk " + intToString(iWheel) + "Incident Phi Angle (rad);Cluster Phi Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersizePhi_incidentAnglePhi[iWheel]);
-            m_pix_eca_clustersizeZ_incidentAnglePhi.push_back(new TProfile(("pix_eca_d" + intToString(iWheel) + "_clustersizeZ_incidentAnglePhi").c_str(), ("Cluster Z Size Pixel Vs Incident Phi Angle Pixel ECA Disk " + intToString(iWheel) + "Incident Phi Angle (rad);Cluster Z Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_eca_clustersizeZ_incidentAnglePhi[iWheel]);
-          }
-        }
-      } else if (iSide < 0) {
-        m_pix_ecc_unbiased_xresvsmodphi_disks.push_back(new TProfile(("pix_ecc_unbiased_xresvsmodphi_disk" + intToString(iWheel)).c_str(), ("UNBIASED X Residual Average vs Module Phi of Pixel Endcap C Disk " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_pix_ecc_unbiased_xresvsmodphi_disks[iWheel]);
-        m_pix_ecc_unbiased_yresvsmodphi_disks.push_back(new TProfile(("pix_ecc_unbiased_yresvsmodphi_disk" + intToString(iWheel)).c_str(), ("UNBIASED Y Residual Average vs Module Phi of Pixel Endcap C Disk " + intToString(iWheel)).c_str(), maxPhiModulesPerRing, -0.5, maxPhiModulesPerRing - 0.5));
-        RegisterHisto(al_mon, m_pix_ecc_unbiased_yresvsmodphi_disks[iWheel]);
-
-
-        if (m_extendedPlots) {
-          // Pixel biased residuals
-          m_pix_ecc_biased_residualsx.push_back(new TH1F(("pix_ecc_d" + intToString(iWheel) + "_biased_residualx").c_str(), ("Biased X Residual Pixel EndCap C Disk " + intToString(iWheel) + ";Residual (mm)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_biased_residualsx[iWheel]);
-          m_pix_ecc_biased_residualsy.push_back(new TH1F(("pix_ecc_d" + intToString(iWheel) + "_biased_residualy").c_str(), ("Biased Y Residual Pixel EndCap C Disk " + intToString(iWheel) + ";Residual (mm)").c_str(), 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_biased_residualsy[iWheel]);
-          //residual pt
-          m_pix_ecc_residualsx_pt.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_residualx_pt").c_str(), ("Unbiased X Residual Vs Pt Pixel EndCap C Disk " + intToString(iWheel) + ";Track pT (GeV);Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_residualsx_pt[iWheel]);
-          m_pix_ecc_residualsy_pt.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_residualy_pt").c_str(), ("Unbiased Y Residual Vs Pt Pixel EndCap C Disk " + intToString(iWheel) + ";Track pT (GeV);Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_residualsy_pt[iWheel]);
-          //pull pt
-          m_pix_ecc_pullsx_pt.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_pullx_pt").c_str(), ("Unbiased X Pull Vs Pt Pixel EndCap C Disk " + intToString(iWheel) + ";Track pT (GeV)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-          RegisterHisto(al_mon, m_pix_ecc_pullsx_pt[iWheel]);
-          m_pix_ecc_pullsy_pt.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_pully_pt").c_str(), ("Unbiased Y Pull Vs Pt Pixel EndCap C Disk " + intToString(iWheel) + ";Track pT (GeV)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-          RegisterHisto(al_mon, m_pix_ecc_pullsy_pt[iWheel]);
-          // Pixel unbiased residuals vs QoverP^2
-          m_pix_ecc_residualsx_qoverp2.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_unbiased_residualx_qoverp2").c_str(), ("Unbiased X Residual Vs Q/P^{2} Pixel EndCap C Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_residualsx_qoverp2[iWheel]);
-          m_pix_ecc_residualsy_qoverp2.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_unbiased_residualy_qoverp2").c_str(), ("Unbiased Y Residual Vs Q/P^{2} Pixel EndCap C Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_residualsy_qoverp2[iWheel]);
-          //biased residual pt
-          m_pix_ecc_biased_residualsx_pt.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_biased_residualx_pt").c_str(), ("Biased X Residual Vs Pt Pixel EndCap C Disk " + intToString(iWheel) + ";Track pT (GeV);Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_biased_residualsx_pt[iWheel]);
-          m_pix_ecc_biased_residualsy_pt.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_biased_residualy_pt").c_str(), ("Biased Y Residual Vs Pt Pixel EndCap C Disk " + intToString(iWheel) + ";Track pT (GeV);Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_biased_residualsy_pt[iWheel]);
-          //biased residual qoverp2
-          m_pix_ecc_biased_residualsx_qoverp2.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_biased_residualx_qoverp2").c_str(), ("Biased X Residual Vs Q/P^{2} Pixel EndCap C Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_biased_residualsx_qoverp2[iWheel]);
-          m_pix_ecc_biased_residualsy_qoverp2.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_biased_residualy_qoverp2").c_str(), ("Biased Y Residual Vs Q/P^{2} Pixel EndCap C Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_biased_residualsy_qoverp2[iWheel]);
-          //biased resvsmodphi
-          m_pix_ecc_biased_xresvsmodphi_2ds.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_biased_xresvsmodphi_2d").c_str(), ("X Biased Residual Distbn vs Module Phi Pixel ECC D" + intToString(iWheel) + ";Module Phi ID; Residual X (mm)").c_str(), maxPhiModulesPerRing, 0, maxPhiModulesPerRing, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_biased_xresvsmodphi_2ds[iWheel]);
-          m_pix_ecc_biased_yresvsmodphi_2ds.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_biased_yresvsmodphi_2d").c_str(), ("Y Biased Residual Distbn vs Module Phi Pixel ECC D" + intToString(iWheel) + ";Module Phi ID; Residual Y (mm)").c_str(), maxPhiModulesPerRing, 0, maxPhiModulesPerRing, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange));
-          RegisterHisto(al_mon, m_pix_ecc_biased_yresvsmodphi_2ds[iWheel]);
-          if (m_doClusterSizeHistos) {
-            m_pix_ecc_clustersize.push_back(new TH1F(("pix_ecc_d" + intToString(iWheel) + "_clustersize").c_str(), ("Cluster size Pixel ECC Disk " + intToString(iWheel)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersize[iWheel]);
-            m_pix_ecc_clustersizePhi.push_back(new TH1F(("pix_ecc_d" + intToString(iWheel) + "_clustersizePhi").c_str(), ("Cluster Phi size Pixel ECC Disk " + intToString(iWheel)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersizePhi[iWheel]);
-            m_pix_ecc_clustersizeZ.push_back(new TH1F(("pix_ecc_d" + intToString(iWheel) + "_clustersizeZ").c_str(), ("Cluster Z size Pixel ECC Disk " + intToString(iWheel)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersizeZ[iWheel]);
-
-            m_pix_ecc_residualsx_clustersize.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_residualx_clustersize").c_str(), ("Unbiased X Residual Vs Cluster Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsx_clustersize[iWheel]);
-            m_pix_ecc_residualsy_clustersize.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_residualy_clustersize").c_str(), ("Unbiased Y Residual Vs Cluster Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsy_clustersize[iWheel]);
-
-            m_pix_ecc_residualsx_clustersizePhi.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_residualx_clustersizePhi").c_str(), ("Unbiased X Residual Vs Cluster Phi Size ECC Disk " + intToString(iWheel) + ";Cluster Phi Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsx_clustersizePhi[iWheel]);
-            m_pix_ecc_residualsy_clustersizePhi.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_residualy_clustersizePhi").c_str(), ("Unbiased Y Residual Vs Cluster Phi Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Phi Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsy_clustersizePhi[iWheel]);
-
-            m_pix_ecc_residualsx_clustersizeZ.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_residualx_clustersizeZ").c_str(), ("Unbiased X Residual Vs Cluster Z Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Z Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsx_clustersizeZ[iWheel]);
-            m_pix_ecc_residualsy_clustersizeZ.push_back(new TH2F(("pix_ecc_d" + intToString(iWheel) + "_residualy_clustersizeZ").c_str(), ("Unbiased Y Residual Vs Cluster Z Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Z Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsy_clustersizeZ[iWheel]);
-
-            m_pix_ecc_residualsx_clustersizeP.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_residualx_clustersize_p").c_str(), ("Unbiased X Residual Vs Cluster Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsx_clustersizeP[iWheel]);
-            m_pix_ecc_residualsy_clustersizeP.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_residualy_clustersize_p").c_str(), ("Unbiased Y Residual Vs Cluster Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsy_clustersizeP[iWheel]);
-
-            m_pix_ecc_residualsx_clustersizePhiP.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_residualx_clustersizePhi_p").c_str(), ("Unbiased X Residual Vs Cluster Phi Size ECC Disk " + intToString(iWheel) + ";Cluster Phi Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsx_clustersizePhiP[iWheel]);
-            m_pix_ecc_residualsy_clustersizePhiP.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_residualy_clustersizePhi_p").c_str(), ("Unbiased Y Residual Vs Cluster Phi Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Phi Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsy_clustersizePhiP[iWheel]);
-
-            m_pix_ecc_residualsx_clustersizeZP.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_residualx_clustersizeZ_p").c_str(), ("Unbiased X Residual Vs Cluster Z Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Z Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsx_clustersizeZP[iWheel]);
-            m_pix_ecc_residualsy_clustersizeZP.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_residualy_clustersizeZ_p").c_str(), ("Unbiased Y Residual Vs Cluster Z Size Pixel ECC Disk " + intToString(iWheel) + ";Cluster Z Size;PIX Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minPIXResXFillRange, m_maxPIXResXFillRange));
-            RegisterHisto(al_mon, m_pix_ecc_residualsy_clustersizeZP[iWheel]);
-
-            m_pix_ecc_clustersize_incidentAngle.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_clustersize_incidentAngle").c_str(), ("Cluster Size Pixel Vs Incident Theta Angle Pixel ECC Disk " + intToString(iWheel) + ";Incident Theta Angle [rad];Cluster Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersize_incidentAngle[iWheel]);
-            m_pix_ecc_clustersizePhi_incidentAngle.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_clustersizePhi_incidentAngle").c_str(), ("Cluster Phi Size Pixel Vs Incident Theta Angle Pixel ECC Disk " + intToString(iWheel) + ";Incident Theta Angle [rad];Cluster Phi Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersizePhi_incidentAngle[iWheel]);
-            m_pix_ecc_clustersizeZ_incidentAngle.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_clustersizeZ_incidentAngle").c_str(), ("Cluster Z Size Pixel Vs Incident Theta Angle Pixel ECC Disk " + intToString(iWheel) + ";Incident Theta Angle [rad];Cluster Z Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersizeZ_incidentAngle[iWheel]);
-
-            m_pix_ecc_clustersize_incidentAnglePhi.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_clustersize_incidentAnglePhi").c_str(), ("Cluster Size Pixel Vs Incident Phi Angle Pixel ECC Disk " + intToString(iWheel) + ";Incident Phi Angle [rad];Cluster Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersize_incidentAnglePhi[iWheel]);
-            m_pix_ecc_clustersizePhi_incidentAnglePhi.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_clustersizePhi_incidentAnglePhi").c_str(), ("Cluster Phi Size Pixel Vs Incident Phi Angle Pixel ECC Disk " + intToString(iWheel) + ";Incident Phi Angle [rad];Cluster Phi Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersizePhi_incidentAnglePhi[iWheel]);
-            m_pix_ecc_clustersizeZ_incidentAnglePhi.push_back(new TProfile(("pix_ecc_d" + intToString(iWheel) + "_clustersizeZ_incidentAnglePhi").c_str(), ("Cluster Z Size Pixel Vs Incident Phi Angle Pixel ECC Disk " + intToString(iWheel) + ";Incident Phi Angle [rad];Cluster Z Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_pix_ecc_clustersizeZ_incidentAnglePhi[iWheel]);
-          }
-        }
-      } else ATH_MSG_ERROR(" iSide ==0: Creating endcaps histos but obtained a barrel identifier");
-    } //iWheel
-  }
-  //General Basic plots
-  //Residuals
-  m_pix_eca_residualx = new TH1F("pix_eca_residualx", "UnBiased X Residual Pixel EndCap A", 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_eca_residualx);
-  m_pix_eca_residualy = new TH1F("pix_eca_residualy", "UnBiased Y Residual Pixel EndCap A", 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-  RegisterHisto(al_mon, m_pix_eca_residualy);
-  m_pix_ecc_residualx = new TH1F("pix_ecc_residualx", "UnBiased X Residual Pixel EndCap C", 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_ecc_residualx);
-  m_pix_ecc_residualy = new TH1F("pix_ecc_residualy", "UnBiased Y Residual Pixel EndCap A", 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-  RegisterHisto(al_mon, m_pix_ecc_residualy);
-
-  //pulls
-  m_pix_eca_pullx = new TH1F("pix_eca_pullx", "UnBiased X Pull Pixel Endcap A", 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-  RegisterHisto(al_mon, m_pix_eca_pullx);
-  m_pix_eca_pully = new TH1F("pix_eca_pully", "UnBiased Y Pull Pixel Endcap A", 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-  RegisterHisto(al_mon, m_pix_eca_pully);
-  m_pix_ecc_pullx = new TH1F("pix_ecc_pullx", "UnBiased X Pull Pixel Endcap C", 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-  RegisterHisto(al_mon, m_pix_ecc_pullx);
-  m_pix_ecc_pully = new TH1F("pix_ecc_pully", "UnBiased Y Pull Pixel Endcap C", 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-  RegisterHisto(al_mon, m_pix_ecc_pully);
-  //2d histograms of residual versus module phi in endcaps for filling of Residual mean plots in post-processing
-  //std::cout<<"TOTALPHIMODULES "<<totalPhiModules<<std::endl;
-  m_pix_eca_xresvsmodphi_2d = new TH2F("pix_eca_xresvsmodphi_2d", "X Residual vs (Modified) Module Phi Pixel Endcap A;(modified) Mod Phi;Residual [mm]", totalPhiModules, 0, totalPhiModules, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_eca_xresvsmodphi_2d);
-  m_pix_ecc_xresvsmodphi_2d = new TH2F("pix_ecc_xresvsmodphi_2d", "X Residual vs (Modified) Module Phi Pixel Endcap C;(modified) Mod Phi;Residual [mm]", totalPhiModules, 0, totalPhiModules, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_ecc_xresvsmodphi_2d);
-  m_pix_eca_yresvsmodphi_2d = new TH2F("pix_eca_yresvsmodphi_2d", "Y Residual vs (Modified) Module Phi Pixel Endcap A;(modified) Mod Phi;Residual [mm]", totalPhiModules, 0, totalPhiModules, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_eca_yresvsmodphi_2d);
-  m_pix_ecc_yresvsmodphi_2d = new TH2F("pix_ecc_yresvsmodphi_2d", "Y Residual vs (Modified) Module Phi Pixel Endcap C;(modified) Mod Phi;Residual [mm]", totalPhiModules, 0, totalPhiModules, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_ecc_yresvsmodphi_2d);
-  //Profile histograms that summarizes the unbiased residuals for the endcaps
-  //m_pix_eca_unbiased_xresvsmodphi = new TProfile("pix_eca_unbiased_xresvsmodphi","UNBIASED X Residual Average vs
-  // Module Phi of Pixel Endcap A;(modified) ModPhi; Avg Res
-  // (mm)",totalPhiModules,0,totalPhiModules,m_minPIXResXFillRange,m_maxPIXResXFillRange);
-  //RegisterHisto(al_mon,m_pix_eca_unbiased_xresvsmodphi);
-  //m_pix_ecc_unbiased_xresvsmodphi = new TProfile("pix_ecc_unbiased_xresvsmodphi","UNBIASED X Residual Average vs
-  // Module Phi of Pixel Endcap C;(modified) ModPhi; Avg Res
-  // (mm)",totalPhiModules,0,totalPhiModules,m_minPIXResXFillRange,m_maxPIXResXFillRange);
-  //RegisterHisto(al_mon,m_pix_ecc_unbiased_xresvsmodphi);
-  //m_pix_eca_unbiased_yresvsmodphi = new TProfile("pix_eca_unbiased_yresvsmodphi","UNBIASED Y Residual Average vs
-  // Module Phi of Pixel Endcap A;(modified) ModPhi; Avg Res
-  // (mm)",totalPhiModules,0,totalPhiModules,m_minPIXResYFillRange,m_maxPIXResYFillRange);
-  //RegisterHisto(al_mon,m_pix_eca_unbiased_yresvsmodphi);
-  //m_pix_ecc_unbiased_yresvsmodphi = new TProfile("pix_ecc_unbiased_yresvsmodphi","UNBIASED Y Residual Average vs
-  // Module Phi of Pixel Endcap C;(modified) ModPhi; Avg Res
-  // (mm)",totalPhiModules,0,totalPhiModules,m_minPIXResYFillRange,m_maxPIXResYFillRange);
-  //RegisterHisto(al_mon,m_pix_ecc_unbiased_yresvsmodphi);
-  //Profile histograms that summarizes the overlap residuals for the endcaps
-  m_pix_eca_Oxresxvsmodphi = new TProfile("pix_eca_Oxresxvsmodphi", "X_Overlap Residual X Mean vs (Modified) Module Phi Pixel Endcap A;(mod) ModPhi; Mean Res [mm]", totalPhiModules, 0, totalPhiModules, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_eca_Oxresxvsmodphi);
-  m_pix_eca_Oyresyvsmodphi = new TProfile("pix_eca_Oyresyvsmodphi", "Y_Overlap Residual Y Mean vs (Modified) Module Phi Pixel Endcap A;(mod) ModPhi; Mean Res [mm]", totalPhiModules, 0, totalPhiModules, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-  RegisterHisto(al_mon, m_pix_eca_Oyresyvsmodphi);
-  m_pix_ecc_Oxresxvsmodphi = new TProfile("pix_ecc_Oxresxvsmodphi", "X_Overlap Residual X Mean vs (Modified) Module Phi Pixel Endcap C;(mod) ModPhi; Mean Res [mm]", totalPhiModules, 0, totalPhiModules, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-  RegisterHisto(al_mon, m_pix_ecc_Oxresxvsmodphi);
-  m_pix_ecc_Oyresyvsmodphi = new TProfile("pix_ecc_Oyresyvsmodphi", "Y_Overlap Residual Y Mean vs (Modified) Module Phi Pixel Endcap C;(mod) ModPhi; Mean Res [mm]", totalPhiModules, 0, totalPhiModules, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-  RegisterHisto(al_mon, m_pix_ecc_Oyresyvsmodphi);
-  //These histograms are filled in post-processing - only initiated here such that they can be registered as "shift".
-  //residual mean as function of module eta/phi in endcaps
-  m_pix_eca_xresvsmodphi = new TH1F("pix_eca_xresvsmodphi", "X Residual Mean vs (Modified) Module Phi Pixel Endcap A;(Modified) Module Phi Identifier;Mean Residual X", 165, 0, 165);
-  RegisterHisto(al_mon, m_pix_eca_xresvsmodphi);
-  m_pix_eca_yresvsmodphi = new TH1F("pix_eca_yresvsmodphi", "Y Residual Mean vs (Modified) Module Phi Pixel Endcap A;(Modified) Module Phi Identifier;Mean Residual Y", 165, 0, 165);
-  RegisterHisto(al_mon, m_pix_eca_yresvsmodphi);
-  m_pix_ecc_xresvsmodphi = new TH1F("pix_ecc_xresvsmodphi", "X Residual Mean vs (Modified) Module Phi Pixel Endcap C;(Modified) Module Phi Identifier;Mean Residual X", 165, 0, 165);
-  RegisterHisto(al_mon, m_pix_ecc_xresvsmodphi);
-  m_pix_ecc_yresvsmodphi = new TH1F("pix_ecc_yresvsmodphi", "Y Residual Mean vs (Modified) Module Phi Pixel Endcap C;(Modified) Module Phi Identifier;Mean Residual Y", 165, 0, 165);
-  RegisterHisto(al_mon, m_pix_ecc_yresvsmodphi);
-
-  if (m_extendedPlots) {
-    //Unbiased 3D residuals plots
-    m_pix_eca_xresvsmodphidisk_3d = new TH3F("pix_eca_xresvsmodphidisk_3d", "X Residual Distbn vs Module Eta-Phi-ID Pixel ECA", NDisks, 0, NDisks, maxPhiModulesPerRing, 0, maxPhiModulesPerRing, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_eca_xresvsmodphidisk_3d);
-    m_pix_eca_yresvsmodphidisk_3d = new TH3F("pix_eca_yresvsmodphidisk_3d", "Y Residual Distbn vs Module Eta-Phi-ID Pixel ECA", NDisks, 0, NDisks, maxPhiModulesPerRing, 0, maxPhiModulesPerRing, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_eca_yresvsmodphidisk_3d);
-    m_pix_ecc_xresvsmodphidisk_3d = new TH3F("pix_ecc_xresvsmodphidisk_3d", "X Residual Distbn vs Module Eta-Phi-ID Pixel ECC", NDisks, 0, NDisks, maxPhiModulesPerRing, 0, maxPhiModulesPerRing, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_ecc_xresvsmodphidisk_3d);
-    m_pix_ecc_yresvsmodphidisk_3d = new TH3F("pix_ecc_yresvsmodphidisk_3d", "Y Residual Distbn vs Module Eta-Phi-ID Pixel ECC", NDisks, 0, NDisks, maxPhiModulesPerRing, 0, maxPhiModulesPerRing, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_ecc_yresvsmodphidisk_3d);
-    //biased
-    m_pix_eca_biased_residualx = new TH1F("pix_eca_biased_residualx", "Biased X Residual Pixel EndCap A", 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_eca_biased_residualx);
-    m_pix_eca_biased_residualy = new TH1F("pix_eca_biased_residualy", "Biased Y Residual Pixel EndCap A", 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_eca_biased_residualy);
-    m_pix_ecc_biased_residualx = new TH1F("pix_ecc_biased_residualx", "Biased X Residual Pixel EndCap C", 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_ecc_biased_residualx);
-    m_pix_ecc_biased_residualy = new TH1F("pix_ecc_biased_residualy", "Biased Y Residual Pixel EndCap C", 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_ecc_biased_residualy);
-
-    //finely binned residuals
-    m_pix_eca_residualx_fine = new TH1F("pix_eca_residualx_fine", "UnBiased X Residual Pixel Endcap A;Residual [mm]", 1000, -1.0, 1.0);
-    RegisterHisto(al_mon, m_pix_eca_residualx_fine);
-    m_pix_eca_residualy_fine = new TH1F("pix_eca_residualy_fine", "UnBiased Y Residual Pixel Endcap A;Residual [mm]", 1000, -1.0, 1.0);
-    RegisterHisto(al_mon, m_pix_eca_residualy_fine);
-    m_pix_ecc_residualx_fine = new TH1F("pix_ecc_residualx_fine", "UnBiased X Residual Pixel Endcap C;Residual [mm]", 1000, -1.0, 1.0);
-    RegisterHisto(al_mon, m_pix_ecc_residualx_fine);
-    m_pix_ecc_residualy_fine = new TH1F("pix_ecc_residualy_fine", "UnBiased Y Residual Pixel Endcap C;Residual [mm]", 1000, -1.0, 1.0);
-    RegisterHisto(al_mon, m_pix_ecc_residualy_fine);
-
-    //unbiased vs pt
-    m_pix_eca_residualx_pt = new TH2F("pix_eca_residualx_pt", "X Residual Vs P_{T}: Pixel EndCap A;Track p_{T} [GeV];Local x res [mm]", m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                      100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_eca_residualx_pt);
-    m_pix_eca_residualy_pt = new TH2F("pix_eca_residualy_pt", "Y Residual Vs p_{T}: Pixel EndCap A;Track p_{T} [GeV];Local y res [mm]", m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                      100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_eca_residualy_pt);
-
-    m_pix_ecc_residualx_pt = new TH2F("pix_ecc_residualx_pt", "X Residual Vs P_{T} Pixel EndCap C;Track p_{T} [GeV];Local x residual [mm]", m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                      100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_ecc_residualx_pt);
-    m_pix_ecc_residualy_pt = new TH2F("pix_ecc_residualy_pt", "Y Residual Vs p_{T} Pixel EndCap C;Track p_{T} [GeV];Local y residual [mm]", m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                      100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_ecc_residualy_pt);
-
-    //biased pt
-    m_pix_eca_biased_residualx_pt = new TH2F("pix_eca_biased_residualx_pt", "Biased X Residual Vs Pt Pixel EndCap A;Track pT (GeV); Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_eca_biased_residualx_pt);
-    m_pix_eca_biased_residualy_pt = new TH2F("pix_eca_biased_residualy_pt", "Biased Y Residual Vs Pt Pixel EndCap A;Track pT (GeV); Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_eca_biased_residualy_pt);
-    m_pix_ecc_biased_residualx_pt = new TH2F("pix_ecc_biased_residualx_pt", "Biased X Residual Vs Pt Pixel EndCap C;Track pT (GeV); Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
-    RegisterHisto(al_mon, m_pix_ecc_biased_residualx_pt);
-    m_pix_ecc_biased_residualy_pt = new TH2F("pix_ecc_biased_residualy_pt", "Biased Y Residual Vs Pt Pixel EndCap A;Track pT (GeV); Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
-    RegisterHisto(al_mon, m_pix_ecc_biased_residualy_pt);
-
-    //pull vs pt
-    m_pix_eca_pullx_pt = new TH2F("pix_eca_pullx_pt", "X Pull Vs Pt Pixel EndCap A;Track pT (GeV);X Pull", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_pix_eca_pullx_pt);
-    m_pix_eca_pully_pt = new TH2F("pix_eca_pully_pt", "Y Pull Vs Pt Pixel EndCap A;Track pT (GeV);Y Pull", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_pix_eca_pully_pt);
-    m_pix_ecc_pullx_pt = new TH2F("pix_ecc_pullx_pt", "X Pull Vs Pt Pixel EndCap C;Track pT (GeV);X Pull", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_pix_ecc_pullx_pt);
-    m_pix_ecc_pully_pt = new TH2F("pix_ecc_pully_pt", "Y Pull Vs Pt Pixel EndCap C;Track pT (GeV);Y Pull", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_pix_ecc_pully_pt);
-    // Hit Errors
-    m_hiterror_x_ibl_b = new TH1F("m_hiterror_x_ibl_b", "Pixel Barrel X Hit Error;X Hit Error [mm];IBL Hits", 80, 0., m_xHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_x_ibl_b);
-    m_hiterror_x_pix_b = new TH1F("m_hiterror_x_pix_b", "Pixel Barrel X Hit Error;X Hit Error [mm];PIX Hits", 80, 0., m_xHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_x_pix_b);
-    m_hiterror_x_pix_ec = new TH1F("m_hiterror_x_pix_ec", "Pixel Endcaps X Hit Error;X Hit Error [mm];PIX Hits", 80, 0., m_xHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_x_pix_ec);
-    m_hiterror_x_pix_eca = new TH1F("m_hiterror_x_pix_eca", "Pixel Endcap A X Hit Error;X Hit Error [mm];PIX Hits", 80, 0., m_xHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_x_pix_eca);
-    m_hiterror_x_pix_ecc = new TH1F("m_hiterror_x_pix_ecc", "Pixel Endcap C X Hit Error;X Hit Error [mm];PIX Hits", 80, 0., m_xHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_x_pix_ecc);
-    m_hiterror_y_ibl_b = new TH1F("m_hiterror_y_ibl_b", "Pixel Barrel Y Hit Error;Y Hit Error [mm];IBL Hits", 80, 0., m_yHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_y_ibl_b);
-    m_hiterror_y_pix_b = new TH1F("m_hiterror_y_pix_b", "Pixel Barrel Y Hit Error;Y Hit Error [mm];PIX Hits", 80, 0., m_yHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_y_pix_b);
-    m_hiterror_y_pix_ec = new TH1F("m_hiterror_y_pix_ec", "Pixel Endcaps Y Hit Error;Y Hit Error [mm];PIX Hits", 80, 0., m_yHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_y_pix_ec);
-    m_hiterror_y_pix_eca = new TH1F("m_hiterror_y_pix_eca", "Pixel Endcaps Y Hit Error;Y Hit Error [mm];PIX Hits", 80, 0., m_yHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_y_pix_eca);
-    m_hiterror_y_pix_ecc = new TH1F("m_hiterror_y_pix_ecc", "Pixel Endcaps Y Hit Error;Y Hit Error [mm];PIX Hits", 80, 0., m_yHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_y_pix_ecc);
-    // hit errors in broad range
-    m_hiterror_x_ibl_b_WideRange = new TH1F("m_hiterror_x_ibl_b_WideRange", "Pixel Barrel X Hit Error;X Hit Error [mm];IBL Hits", 100, 0., 1.0);
-    RegisterHisto(al_mon, m_hiterror_x_ibl_b_WideRange);
-    m_hiterror_x_pix_b_WideRange = new TH1F("m_hiterror_x_pix_b_WideRange", "Pixel Barrel X Hit Error;X Hit Error [mm];PIX Hits", 100, 0., 1.0);
-    RegisterHisto(al_mon, m_hiterror_x_pix_b_WideRange);
-    m_hiterror_x_pix_ec_WideRange = new TH1F("m_hiterror_x_pix_ec_WideRange", "Pixel Endcap X Hit Error;X Hit Error [mm];PIX Hits", 100, 0., 1.0);
-    RegisterHisto(al_mon, m_hiterror_x_pix_ec_WideRange);
-    m_hiterror_y_ibl_b_WideRange = new TH1F("m_hiterror_y_ibl_b_WideRange", "Pixel Barrel Y Hit Error;Y Hit Error [mm];IBL Hits", 100, 0., 2.0);
-    RegisterHisto(al_mon, m_hiterror_y_ibl_b_WideRange);
-    m_hiterror_y_pix_b_WideRange = new TH1F("m_hiterror_y_pix_b_WideRange", "Pixel Barrel Y Hit Error;Y Hit Error [mm];PIX Hits", 100, 0., 2.0);
-    RegisterHisto(al_mon, m_hiterror_y_pix_b_WideRange);
-    m_hiterror_y_pix_ec_WideRange = new TH1F("m_hiterror_y_pix_ec_WideRange", "Pixel Endcap Y Hit Error;Y Hit Error [mm];PIX Hits", 100, 0., 2.0);
-    RegisterHisto(al_mon, m_hiterror_y_pix_ec_WideRange);
-  }
-}
-
-void IDAlignMonResiduals::MakeSCTBarrelHistograms(MonGroup& al_mon) {
-  int totalLayers = m_SCT_Mgr->numerology().numLayers();
-  int totalEtaModules = m_gap_sct * (totalLayers - 1);  //to allow separation between layers for profiles
-  int totalPhiModules = totalEtaModules;  //to allow separation between layers for profiles
-  // vs QoverP2
-  Double_t momentum[21] = {
-    15, 18, 21, 25, 29, 34, 40, 48, 59, 77, 0, 77, 59, 48, 40, 34, 29, 25, 21, 18, 15
-  };
-  Double_t customaxis[21];
-
-  for (int i = 0; i <= 20; i++) {
-    if (i < 10) customaxis[i] = -1 / (momentum[i] * momentum[i]);
-    else if (i == 10) customaxis[i] = 0;
-    else customaxis[i] = 1 / (momentum[i] * momentum[i]);
-  }
-  for (int iLayer = 0; iLayer < totalLayers; ++iLayer) {
-    //ATH_MSG_INFO("iLayer= " << iLayer);
-    if (!m_SCT_Mgr->numerology().useLayer(iLayer)) {
-      msg(MSG::WARNING) << "Layer " << iLayer << " Not Present" << endmsg;
-      continue;
-    }
-    float maxPhiModulesPerLayer = m_SCT_Mgr->numerology().numPhiModulesForLayer(iLayer);
-    totalPhiModules += maxPhiModulesPerLayer;
-    //just for checking purposes. Not useful. I will cancel it soon. Peo
-    for (int iEta = m_SCT_Mgr->numerology().beginEtaModuleForLayer(iLayer); iEta < m_SCT_Mgr->numerology().endEtaModuleForLayer(iLayer); ++iEta) {
-      if (!iEta && m_SCT_Mgr->numerology().skipEtaZeroForLayer(iLayer))
-        //iEta=0 is not defined for the SCT
-        continue;
-      //ATH_MSG_INFO("iEta= " << iEta);
-    }
-    m_siliconBarrelLayersLabels.emplace_back("SCTL" + intToString(iLayer) + " S0");
-    m_siliconBarrelLayersLabels.emplace_back("SCTL" + intToString(iLayer) + " S1");
-    float EtaModules = m_SCT_Mgr->numerology().endEtaModuleForLayer(iLayer) - m_SCT_Mgr->numerology().beginEtaModuleForLayer(iLayer); //(i
-                                                                                                                                      // put
-                                                                                                                                      // float
-                                                                                                                                      // in
-                                                                                                                                      // order
-                                                                                                                                      // to
-                                                                                                                                      // divide
-                                                                                                                                      // by
-                                                                                                                                      // 2.
-                                                                                                                                      // I
-                                                                                                                                      // am
-                                                                                                                                      // not
-                                                                                                                                      // skipping
-                                                                                                                                      // the
-                                                                                                                                      // empty
-                                                                                                                                      // layer.
-                                                                                                                                      // It
-                                                                                                                                      // might
-                                                                                                                                      // be
-                                                                                                                                      // nice
-                                                                                                                                      // to
-                                                                                                                                      // see
-                                                                                                                                      // the
-                                                                                                                                      // separation)
-    totalEtaModules += EtaModules;
-    //residuals
-    m_sct_b_residualsx.push_back(new TH1F(("sct_b" + intToString(iLayer) + "_residualx").c_str(), ("Unbiased X Residual SCT Barrel Layer " + intToString(iLayer) + ";Residual [mm]").c_str(), 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-    RegisterHisto(al_mon, m_sct_b_residualsx[iLayer]);
-    //pulls
-    m_sct_b_pullsx.push_back(new TH1F(("sct_b" + intToString(iLayer) + "_pullx").c_str(), ("Unbiased X Pull SCT Barrel Layer " + intToString(iLayer) + ";Pull").c_str(), 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-    RegisterHisto(al_mon, m_sct_b_pullsx[iLayer]);
-    //overlap residuals for SCT
-    m_sct_b_xoverlapresidualsx.push_back(new TH1F(("sct_b" + intToString(iLayer) + "_xoverlapresidualx").c_str(), ("Unbiased X_Overlap Residual X SCT Barrel Layer " + intToString(iLayer) + ";Residual [mm]").c_str(), 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-    RegisterHisto(al_mon, m_sct_b_xoverlapresidualsx[iLayer]);
-    m_sct_b_yoverlapresidualsx.push_back(new TH1F(("sct_b" + intToString(iLayer) + "_yoverlapresidualx").c_str(), ("Unbiased Y_Overlap Residual X SCT Barrel Layer " + intToString(iLayer) + ";Residual [mm]").c_str(), 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-    RegisterHisto(al_mon, m_sct_b_yoverlapresidualsx[iLayer]);
-    //3d histograms of residual distribution versus module eta/phi in barrel - eta on xaxis, phi on yaxis
-    //Used in post-prcessing to fill 2-d residual map histograms of each silicon layer
-    m_sct_b_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_xresvsmodetaphi_3d").c_str(),
-                                                   ("X Residual Distribution vs Module Eta-Phi-ID SCT Barrel L" + intToString(iLayer) + ";Mod Eta; Mod Phi").c_str(),
-                                                   EtaModules * m_mapSplit, -(EtaModules / 2.), (EtaModules / 2.),
-                                                   maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                   100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-    RegisterHisto(al_mon, m_sct_b_xresvsmodetaphi_3ds[iLayer]);
-
-    if (m_do3DOverlapHistos) {
-      m_sct_b_Oxresxvsmodetaphi_3ds.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_Oxresxvsmodetaphi_3d").c_str(),
-                                                       ("X_Overlap Residual X Distbn vs Module Eta-Phi-ID SCT Barrel L" + intToString(iLayer) + ";Mod Eta; Mod Phi").c_str(), EtaModules * m_mapSplit, -(EtaModules / 2.), (EtaModules / 2.),
-                                                       maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                       100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_Oxresxvsmodetaphi_3ds[iLayer]);
-      m_sct_b_Oyresxvsmodetaphi_3ds.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_Oyresxvsmodetaphi_3d").c_str(),
-                                                       ("Y_Overlap Residual X Distbn vs Module Eta-Phi-ID SCT Barrel L0" + intToString(iLayer) + ";Mod Eta; Mod Phi").c_str(), EtaModules * m_mapSplit, -(EtaModules / 2.), (EtaModules / 2.),
-                                                       maxPhiModulesPerLayer * m_mapSplit, -0.5, maxPhiModulesPerLayer - 0.5,
-                                                       100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_Oyresxvsmodetaphi_3ds[iLayer]);
-    }
-
-    /////////////////////////////////////////////////
-    ///////////////////DOUBLE CHECK THIS/////////////
-    /////////////////////////////////////////////////
-
-    // m_sct_b0_s1_biased_xresvsmodetaphi_3d = new TH3F("sct_b0_s1_biased_xresvsmodetaphi_3d","X Biased Residual Distbn
-    // vs Module Eta-Phi-ID SCT Barrel L0 Side1",12*m_mapSplit,-m_SCTBarrelYSize*6,
-    // m_SCTBarrelYSize*6,32*m_mapSplit,0,32.*m_SCTBarrelXSize,100,m_minSCTResFillRange,m_maxSCTResFillRange);
-    //m_sct_b0_s1_biased_xresvsmodetaphi_3d->SetXTitle("Eta module");
-    //m_sct_b0_s1_biased_xresvsmodetaphi_3d->SetXTitle("Phi module");
-    //RegisterHisto(al_mon,m_sct_b0_s1_biased_xresvsmodetaphi_3d);
-
-    if (m_extendedPlots) {
-      m_sct_b_s0_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_s0_xresvsmodetaphi_3d").c_str(), ("X Residual Distbn vs Module Eta-Phi-ID SCT Barrel L" + intToString(iLayer) + " Side 0;Mod Eta; Mod Phi").c_str(), EtaModules, -(EtaModules / 2.), (EtaModules / 2.), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_s0_xresvsmodetaphi_3ds[iLayer]);
-
-      m_sct_b_s1_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_s1_xresvsmodetaphi_3d").c_str(), ("X Residual Distbn vs Module Eta-Phi-ID SCT Barrel L" + intToString(iLayer) + " Side 1;Mod Eta; Mod Phi").c_str(), EtaModules, -(EtaModules / 2.), (EtaModules / 2.), maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer - 0.5, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_s1_xresvsmodetaphi_3ds[iLayer]);
-
-      //3d histograms of biased residual distribution versus module eta/phi in barrel - eta on xaxis, phi on yaxis,
-      // residual in Z    - I am using the mapSplit here!!
-      // side 0
-      m_sct_b_s0_biased_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_s0_biased_xresvsmodetaphi_3d").c_str(), ("Detailed x-residual dist. vs Module Eta-Phi-ID SCT Barrel L" + intToString(iLayer) + " Side0;Eta module;Phi module").c_str(), EtaModules * m_mapSplit, -m_SCTBarrelYSize * 6, m_SCTBarrelYSize * 6, maxPhiModulesPerLayer * m_mapSplit, 0, maxPhiModulesPerLayer * m_SCTBarrelXSize, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_s0_biased_xresvsmodetaphi_3ds[iLayer]);
-      // side 1
-      m_sct_b_s1_biased_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_s1_biased_xresvsmodetaphi_3d").c_str(), ("Detailed x-residual dist. vs Module Eta-Phi-ID SCT Barrel L" + intToString(iLayer) + " Side1;Eta module;Phi module").c_str(), EtaModules * m_mapSplit, -m_SCTBarrelYSize * 6, m_SCTBarrelYSize * 6, maxPhiModulesPerLayer * m_mapSplit, 0, maxPhiModulesPerLayer * m_SCTBarrelXSize, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_s1_biased_xresvsmodetaphi_3ds[iLayer]);
-
-      //unbiased vs pT
-      m_sct_b_residualsx_pt.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_residualx_pt").c_str(), ("Unbiased X Residual Vs Pt SCT Barrel Layer " + intToString(iLayer) + ";Track pT (GeV);SCT Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_residualsx_pt[iLayer]);
-
-      //Unbiased vs  qoverp2
-      m_sct_b_residualsx_qoverp2.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_unbiased_residualx_qoverp2").c_str(), ("Unbiased X Residual Vs Q/P^{2} SCT Barrel Layer " + intToString(iLayer) + ";Track Q/P^{2} (GeV^{-2});SCT Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_residualsx_qoverp2[iLayer]);
-
-      //Unbiased Pull vs pt
-      m_sct_b_pullsx_pt.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_pullx_pt").c_str(), ("X Pull Vs Pt SCT Barrel Layer " + intToString(iLayer) + ";Track pT (GeV);SCT Pull").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-      RegisterHisto(al_mon, m_sct_b_pullsx_pt[iLayer]);
-
-      //biased
-      m_sct_b_biased_residualsx.push_back(new TH1F(("sct_b" + intToString(iLayer) + "_biased_residualx").c_str(), ("Biased X Residual SCT Barrel Layer " + intToString(iLayer) + ";Residual [mm]").c_str(), 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_biased_residualsx[iLayer]);
-
-      //biased pull
-      m_sct_b_biased_pullsx.push_back(new TH1F(("sct_b" + intToString(iLayer) + "_biased_pullx").c_str(), ("Biased X Pull SCT Barrel Layer " + intToString(iLayer)).c_str(), 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-      RegisterHisto(al_mon, m_sct_b_biased_pullsx[iLayer]);
-
-      //biased vs  pT
-      m_sct_b_biased_residualsx_pt.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_biased_residualx_pt").c_str(), ("Biased X Residual Vs Pt SCT Barrel Layer " + intToString(iLayer) + ";Track pT (GeV);SCT Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_biased_residualsx_pt[iLayer]);
-
-      //biased vs  qoverp2
-      m_sct_b_biased_residualsx_qoverp2.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_biased_residualx_qoverp2").c_str(), ("Biased X Residual Vs Q/P^{2} SCT Barrel Layer " + intToString(iLayer) + ";Track Q/P^{2} (GeV^{-2});SCT Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-      RegisterHisto(al_mon, m_sct_b_biased_residualsx_qoverp2[iLayer]);
-
-      if (m_doClusterSizeHistos) {
-        m_sct_b_residualsx_incidentAnglePhi_s0.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_residualsx_incidentAnglePhi_s0").c_str(), ("Residuals X vs Incident Phi Angle SCT Barrel Layer " + intToString(iLayer) + "Incident Phi Angle (rad) Side 0;Local X Residual").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-        RegisterHisto(al_mon, m_sct_b_residualsx_incidentAnglePhi_s0[iLayer]);
-        m_sct_b_residualsx_incidentAngle_s0.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_residualsx_incidentAngle_s0").c_str(), ("Residuals X vs Incident Theta Angle SCT Barrel Layer " + intToString(iLayer) + "Incident Theta Angle (rad) Side 0;Local X Residual").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-        RegisterHisto(al_mon, m_sct_b_residualsx_incidentAngle_s0[iLayer]);
-
-        m_sct_b_residualsx_incidentAnglePhi_s1.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_residualsx_incidentAnglePhi_s1").c_str(), ("Residuals X vs Incident Phi Angle SCT Barrel Layer " + intToString(iLayer) + "Incident Phi Angle (rad) Side 1;Local X Residual").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-        RegisterHisto(al_mon, m_sct_b_residualsx_incidentAnglePhi_s1[iLayer]);
-        m_sct_b_residualsx_incidentAngle_s1.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_residualsx_incidentAngle_s1").c_str(), ("Residuals X vs Incident Theta Angle SCT Barrel Layer " + intToString(iLayer) + "Incident Theta Angle (rad) Side 1;Local X Residual").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-        RegisterHisto(al_mon, m_sct_b_residualsx_incidentAngle_s1[iLayer]);
-
-
-        m_sct_b_clustersizePhi.push_back(new TH1F(("sct_b" + intToString(iLayer) + "_clustersizePhi").c_str(), ("Cluster Phi size SCT Barrel Layer " + intToString(iLayer)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-        RegisterHisto(al_mon, m_sct_b_clustersizePhi[iLayer]);
-        m_sct_b_residualsx_clustersizePhi.push_back(new TH2F(("sct_b" + intToString(iLayer) + "_residualx_clustersizePhi").c_str(), ("Unbiased X Residual Vs Cluster Phi Size SCT Barrel Layer " + intToString(iLayer) + ";Cluster Phi Size;SCT Res (mm)").c_str(), m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-        RegisterHisto(al_mon, m_sct_b_residualsx_clustersizePhi[iLayer]);
-        m_sct_b_residualsx_clustersizePhiP.push_back(new TProfile(("sct_b" + intToString(iLayer) + "_residualx_clustersizePhi_p").c_str(), ("Unbiased X Residual Vs Cluster Phi Size SCT Barrel Layer " + intToString(iLayer) + ";Cluster Phi Size;SCT Res (mm)").c_str(), m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5, m_minSCTResFillRange, m_maxSCTResFillRange));
-        RegisterHisto(al_mon, m_sct_b_residualsx_clustersizePhiP[iLayer]);
-        m_sct_b_clustersizePhi_incidentAngle.push_back(new TProfile(("sct_b" + intToString(iLayer) + "_clustersizePhi_incidentAngle").c_str(), ("Cluster Phi Size vs Incident Theta Angle SCT Barrel Layer " + intToString(iLayer) + "Incident Theta Angle (rad);Cluster Phi Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-        RegisterHisto(al_mon, m_sct_b_clustersizePhi_incidentAngle[iLayer]);
-        m_sct_b_clustersizePhi_incidentAnglePhi.push_back(new TProfile(("sct_b" + intToString(iLayer) + "_clustersizePhi_incidentAnglePhi").c_str(), ("Cluster Phi Size vs Incident Phi Angle SCT Barrel Layer " + intToString(iLayer) + "Incident Phi Angle (rad);Cluster Phi Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-        RegisterHisto(al_mon, m_sct_b_clustersizePhi_incidentAnglePhi[iLayer]);
-
-        m_sct_b_clustersizePhivsmodetaphi_3ds_s0.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_clustersizePhivsmodetaphi_3d_s0").c_str(), ("ClustersizePhi Distribution vs Module Eta-Phi-ID SCT Barrel L" + intToString(iLayer) + " Side 0;Mod Eta; Mod Phi").c_str(), EtaModules * m_mapSplit, -(EtaModules / 2.), (EtaModules / 2.), maxPhiModulesPerLayer * m_mapSplit, 0, maxPhiModulesPerLayer, m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_sct_b_clustersizePhivsmodetaphi_3ds_s0[iLayer]);
-
-        m_sct_b_clustersizePhivsmodetaphi_3ds_s1.push_back(new TH3F(("sct_b" + intToString(iLayer) + "_clustersizePhivsmodetaphi_3d_s1").c_str(), ("ClustersizePhi Distribution vs Module Eta-Phi-ID SCT Barrel L" + intToString(iLayer) + " Side 1;Mod Eta; Mod Phi").c_str(), EtaModules * m_mapSplit, -(EtaModules / 2.), (EtaModules / 2.), maxPhiModulesPerLayer * m_mapSplit, 0, maxPhiModulesPerLayer, m_ClusterSizeRange + 1, -0.5, m_ClusterSizeRange + 0.5));
-        RegisterHisto(al_mon, m_sct_b_clustersizePhivsmodetaphi_3ds_s1[iLayer]);
-      }
-    }
-  }//Layer Loop
-
-  //Overlap Residuals barrel  - check the number of eta Modules. Total Eta = 15 + 4 * 13 (0 included), Total Phi = 15 +
-  // 32+40+48+56
-  m_sct_b_Oxresxvsmodeta = new TProfile("sct_b_Oxresxvsmodeta", "X_Overlap Residual X Mean vs (Modified) Module Eta SCT Barrel", totalEtaModules, 0, totalEtaModules, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_b_Oxresxvsmodeta);
-  m_sct_b_Oxresxvsmodphi = new TProfile("sct_b_Oxresxvsmodphi", "X_Overlap Residual X Mean vs (Modified) Module Phi SCT Barrel", totalPhiModules, 0, totalPhiModules, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_b_Oxresxvsmodphi);
-  m_sct_b_Oyresxvsmodeta = new TProfile("sct_b_Oyresxvsmodeta", "Y_Overlap Residual X Mean vs (Modified) Module Eta SCT Barrel", totalEtaModules, 0, totalEtaModules, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_b_Oyresxvsmodeta);
-  m_sct_b_Oyresxvsmodphi = new TProfile("sct_b_Oyresxvsmodphi", "Y_Overlap Residual X Mean vs (Modified) Module Phi SCT Barrel", totalPhiModules, 0, totalPhiModules, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_b_Oyresxvsmodphi);
-
-  m_sct_b_residualx = new TH1F("sct_b_residualx", "UnBiased X Residual SCT Barrel;Residual [mm]", 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_b_residualx);
-  m_sct_b_biasedresidualx = new TH1F("sct_b_biasedresidualx", "Biased X Residual SCT Barrel;Residual [mm]", 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_b_biasedresidualx);
-
-  //These histograms are filled in post-processing - only initiated here such that they can be registered as "shift".
-  //SCT histograms for monitoring residual dependence on module eta/phi (stave/ring)
-  m_sct_b_xresvsmodeta = new TH1F("sct_b_xresvsmodeta", "X Residual Mean vs (Modified) Module Eta SCT Barrel;(Modified) Module Eta Identifier;Mean Residual X", totalEtaModules, 0, totalEtaModules); //67
-  RegisterHisto(al_mon, m_sct_b_xresvsmodeta);
-  m_sct_b_xresvsmodphi = new TH1F("sct_b_xresvsmodphi", "X Residual Mean vs (Modified) Module Phi SCT Barrel;(Modified) Module Phi Identifier;Mean Residual X", totalPhiModules, 0, totalPhiModules); //191
-  RegisterHisto(al_mon, m_sct_b_xresvsmodphi);
-
-  if (m_extendedPlots) {
-    m_sct_b_residualx_fine = new TH1F("sct_b_residualx_fine", "UnBiased X Residual SCT Barrel;Residual [mm]", 2000, -2.0, 2.0);
-    RegisterHisto(al_mon, m_sct_b_residualx_fine);
-    // SCT local positions - stereo side
-    m_sct_b_extrapolated_st_localx = new TH1F("sct_b_extrapolated_st_localx", "SCT Barrel - Stereo Side - Extrapolated Local X;localX (mm)", 2000, -(m_SCTBarrelXSize / 2) * 1.1, (m_SCTBarrelXSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_sct_b_extrapolated_st_localx);
-    m_sct_b_extrapolated_st_localy = new TH1F("sct_b_extrapolated_st_localy", "SCT Barrel - Stereo Side - Extrapolated Local Y;localY (mm)", 2000, -(m_SCTBarrelYSize / 2) * 1.1, (m_SCTBarrelYSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_sct_b_extrapolated_st_localy);
-    m_sct_b_measured_st_localx = new TH1F("sct_b_measured_st_localx", "SCT Barrel Measured - Stereo Side - Local X;localX (mm)", 2000, -(m_SCTBarrelXSize / 2) * 1.1, (m_SCTBarrelXSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_sct_b_measured_st_localx);
-    m_sct_b_measured_st_localy = new TH1F("sct_b_measured_st_localy", "SCT Barrel Measured - Stereo Side - Local Y;localY (mm)", 2000, -(m_SCTBarrelYSize / 2) * 1.1, (m_SCTBarrelYSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_sct_b_measured_st_localy);
-    // SCT local positions - no stereo side
-    m_sct_b_extrapolated_nst_localx = new TH1F("sct_b_extrapolated_nst_localx", "SCT Barrel - Stereo Side - Extrapolated Local X;localX (mm)", 2000, -(m_SCTBarrelXSize / 2) * 1.1, (m_SCTBarrelXSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_sct_b_extrapolated_nst_localx);
-    m_sct_b_extrapolated_nst_localy = new TH1F("sct_b_extrapolated_nst_localy", "SCT Barrel - Stereo Side - Extrapolated Local Y;localY (mm)", 2000, -(m_SCTBarrelYSize / 2) * 1.1, (m_SCTBarrelYSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_sct_b_extrapolated_nst_localy);
-    m_sct_b_measured_nst_localx = new TH1F("sct_b_measured_nst_localx", "SCT Barrel Measured - Stereo Side - Local X;localX (mm)", 2000, -(m_SCTBarrelXSize / 2) * 1.1, (m_SCTBarrelXSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_sct_b_measured_nst_localx);
-    m_sct_b_measured_nst_localy = new TH1F("sct_b_measured_nst_localy", "SCT Barrel Measured - Stereo Side - Local Y;localY (mm)", 2000, -(m_SCTBarrelYSize / 2) * 1.1, (m_SCTBarrelYSize / 2) * 1.1);
-    RegisterHisto(al_mon, m_sct_b_measured_nst_localy);
-    m_sct_b_biased_residualx_pt = new TH2F("sct_b_biased_residualx_pt", "Biased X Residual Vs Pt SCT Barrel;Track pT (GeV); SCT Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_b_biased_residualx_pt);
-    m_sct_b_residualx_pt = new TH2F("sct_b_residualx_pt", "X Residual Vs Pt SCT Barrel;Track pT (GeV); SCT Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    RegisterHisto(al_mon, m_sct_b_residualx_pt);
-    m_sct_b_biased_residualx_qoverp2 = new TH2F("sct_b_biased_residualx_qoverp2", "Biased X Residual Vs Q/P^{2} SCT Barrel;Track Q/P^{2} (GeV^{-2});SCT Res (mm)", 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_b_biased_residualx_qoverp2);
-    m_sct_b_unbiased_residualx_qoverp2 = new TH2F("sct_b_unbiased_residualx_qoverp2", "Unbiased X Residual Vs Q/P^{2} SCT Barrel;Track Q/P^{2} (GeV^{-2});SCT Res (mm)", 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_b_unbiased_residualx_qoverp2);
-    m_sct_b_pullx_pt = new TH2F("sct_b_pullx_pt", "X Pull Vs Pt SCT Barrel;Track pT (GeV); SCT Pull", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_sct_b_pullx_pt);
-
-    // Hit errors
-    m_hiterror_sct_b = new TH1F("m_hiterror_sct_b", "SCT Barrel Hit Error;Hit Error[mm];SCT Hits", 80, 0., m_xHitErrorRange);
-    RegisterHisto(al_mon, m_hiterror_sct_b);
-    // Hit errors wide range
-    m_hiterror_sct_b_WideRange = new TH1F("m_hiterror_sct_b_WideRange", "SCT Barrel Hit Error;Hit Error[mm];SCT Hits", 80, 0., 2.0);
-    RegisterHisto(al_mon, m_hiterror_sct_b_WideRange);
-  }
-}
-
-void IDAlignMonResiduals::MakeSCTEndcapsHistograms(MonGroup& al_mon) {
-  Double_t momentum[21] = {
-    15, 18, 21, 25, 29, 34, 40, 48, 59, 77, 0, 77, 59, 48, 40, 34, 29, 25, 21, 18, 15
-  };
-  Double_t customaxis[21];
-  int numDisks = m_SCT_Mgr->numerology().numDisks();
-  //int totalPhiModules = 0;
-  int totalPhiModulesOuterLayer = 0;
-
-  for (int i = 0; i <= 20; i++) {
-    if (i < 10) customaxis[i] = -1 / (momentum[i] * momentum[i]);
-    else if (i == 10) customaxis[i] = 0;
-    else customaxis[i] = 1 / (momentum[i] * momentum[i]);
-  }
-
-
-  for (int iECIndex = 0; iECIndex < m_SCT_Mgr->numerology().numEndcaps(); ++iECIndex) {
-    //totalPhiModules = m_gap_sct * (numDisks - 1); //It is resetted to starting value for ECA. Only ECC modules are
-                                                  // counted. This avoid double counting
-    totalPhiModulesOuterLayer = m_gap_sct * (numDisks - 1);
-    int iSide = m_SCT_Mgr->numerology().endcapId(iECIndex);
-    for (int iWheel = 0; iWheel < numDisks; ++iWheel) {
-      int rings = 0;
-      rings = m_SCT_Mgr->numerology().numRingsForDisk(iWheel);
-      if (!m_SCT_Mgr->numerology().useDisk(iWheel)) {//To check if the Wheel is in use.
-        msg(MSG::WARNING) << "Wheel " << iWheel << " Not in Use" << endmsg;
-        continue;
-      } else {
-        //rings=m_SCT_Mgr->numerology().numRingsForDisk(iWheel);
-        if (iSide > 0) {//I assume symmetry between the two endcaps to avoid double counting
-          m_siliconEndcapLayersLabels.emplace_back("SCTL" + intToString(iWheel) + " S0");
-          m_siliconEndcapLayersLabels.emplace_back("SCTL" + intToString(iWheel) + " S1");
-        }
-      }
-
-      int maxModulesPerRing(0);
-      int ModulesPerRing(0);
-      int maxModulesPerDisk(m_gap_sct * (rings - 1));
-      for (int iEta = 0; iEta < rings; ++iEta) { //iEta<m_SCT_Mgr->numerology().numRingsForDisk(iWheel);
-        ModulesPerRing = m_SCT_Mgr->numerology().numPhiModulesForDiskRing(iWheel, iEta);
-        if (maxModulesPerRing < ModulesPerRing) maxModulesPerRing = ModulesPerRing;
-        //totalPhiModules += ModulesPerRing;
-        maxModulesPerDisk += ModulesPerRing;
-      }
-      totalPhiModulesOuterLayer += maxModulesPerRing;
-
-      if (iSide > 0) {
-        if (m_extendedPlots) {
-          //std::cout<<"Checking rings for each endcap that is created iSide:"<<iSide<< "Wheel: "<<iWheel<<" Rings:
-          // "<<rings<<std::endl;
-          m_sct_eca_s0_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_eca_d" + intToString(iWheel) + "_s0_xresvsmodetaphi_3d").c_str(), ("X UnBiased Residual Distbn vs Module Eta-Phi-ID SCT ECA D" + intToString(iWheel) + " Side0;modEta;modPhi").c_str(), rings, 0, rings, maxModulesPerRing, 0, maxModulesPerRing, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_s0_xresvsmodetaphi_3ds[iWheel]);
-
-          m_sct_eca_s1_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_eca_d" + intToString(iWheel) + "_s1_xresvsmodetaphi_3d").c_str(), ("X UnBiased Residual Distbn vs Module Eta-Phi-ID SCT ECA D" + intToString(iWheel) + " Side1;modEta;modPhi").c_str(), rings, 0, rings, maxModulesPerRing, 0, maxModulesPerRing, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_s1_xresvsmodetaphi_3ds[iWheel]);
-          m_sct_eca_xresvsmodphi_disks.push_back(new TProfile(("sct_eca_unbiased_xresvsmodphi_disk" + intToString(iWheel)).c_str(), ("UNBIASED X Residual Average vs Module Phi of SCT Endcap A Disk " + intToString(iWheel) + ";Module Phi Identifier;Residual X (mm)").c_str(), maxModulesPerDisk, 0, maxModulesPerDisk));
-          RegisterHisto(al_mon, m_sct_eca_xresvsmodphi_disks[iWheel]);
-          //3d biased res vs mod eta mod phi
-          m_sct_eca_s0_biased_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_eca_d" + intToString(iWheel) + "_s0_biased_xresvsmodetaphi_3d").c_str(), ("X Biased Residual Distbn vs Module Eta-Phi-ID SCT ECA D" + intToString(iWheel) + " Side0;modEta;modPhi").c_str(), rings, 0, rings, maxModulesPerRing, 0, maxModulesPerRing, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_s0_biased_xresvsmodetaphi_3ds[iWheel]);
-          m_sct_eca_s1_biased_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_eca_d" + intToString(iWheel) + "_s1_biased_xresvsmodetaphi_3d").c_str(), ("X Biased Residual Distbn vs Module Eta-Phi-ID SCT ECA D" + intToString(iWheel) + " Side1;modEta;modPhi").c_str(), rings, 0, rings, maxModulesPerRing, 0, maxModulesPerRing, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_s1_biased_xresvsmodetaphi_3ds[iWheel]);
-          //unbiased residual vs pT
-          m_sct_eca_residualsx_pt.push_back(new TH2F(("sct_eca_d" + intToString(iWheel) + "_residualx_pt").c_str(), ("X Residual Vs Pt SCT Endcap A Disk" + intToString(iWheel) + ";Track pT (GeV);SCT Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_residualsx_pt[iWheel]);
-          //unbiased residual vs QoverP2
-          m_sct_eca_residualsx_qoverp2.push_back(new TH2F(("sct_eca_d" + intToString(iWheel) + "_unbiased_residualx_qoverp2").c_str(), ("UnBiased X Residual Vs Q/P^{2} SCT Endcap a Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});SCT Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_residualsx_qoverp2[iWheel]);
-          //unbiased pulls vs pt
-          m_sct_eca_pullsx_pt.push_back(new TH2F(("sct_eca_d" + intToString(iWheel) + "_pullx_pt").c_str(), ("X Pull Vs Pt SCT Endcap A Disk " + intToString(iWheel) + ";Track pT (GeV); SCT Pull").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-          RegisterHisto(al_mon, m_sct_eca_pullsx_pt[iWheel]);
-          //SCT endcaps BIASED residuals vs modPhi identifier for each disk
-          m_sct_eca_biased_xresvsmodphi_disks.push_back(new TProfile(("sct_eca_BIASED_xresvsmodphi_disk" + intToString(iWheel)).c_str(), ("BIASED X Residual Average vs Module Phi of SCT Endcap A Disk " + intToString(iWheel) + ";Module Phi Identifier;Residual X (mm)").c_str(), maxModulesPerDisk, 0, maxModulesPerDisk));
-          RegisterHisto(al_mon, m_sct_eca_biased_xresvsmodphi_disks[iWheel]);
-          //biased
-          m_sct_eca_biased_residualsx.push_back(new TH1F(("sct_eca_d" + intToString(iWheel) + "_biased_residualx").c_str(), ("Biased X Residual SCT Endcap A Disk " + intToString(iWheel)).c_str(), 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_biased_residualsx[iWheel]);
-          //biased vs pT
-          m_sct_eca_biased_residualsx_pt.push_back(new TH2F(("sct_eca_d" + intToString(iWheel) + "_biased_residualx_pt").c_str(), ("Biased X Residual Vs Pt SCT Endcap A Disk " + intToString(iWheel) + ";Track pT (GeV);SCT Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_biased_residualsx_pt[iWheel]);
-          //biased vs QoverP2
-          m_sct_eca_biased_residualsx_qoverp2.push_back(new TH2F(("sct_eca_d" + intToString(iWheel) + "_biased_residualx_qoverp2").c_str(), ("Biased X Residual Vs Q/P^{2} SCT Endcap A Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});SCT Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_eca_biased_residualsx_qoverp2[iWheel]);
-
-          if (m_doClusterSizeHistos) {
-            m_sct_eca_residualsx_incidentAnglePhi_s0.push_back(new TH2F(("sct_eca" + intToString(iWheel) + "_residualsx_incidentAnglePhi_s0").c_str(), ("Residuals X vs Incident Phi Angle SCT ECA Disk " + intToString(iWheel) + "Incident Phi Angle (rad) Side 0;Local X Residual").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_eca_residualsx_incidentAnglePhi_s0[iWheel]);
-            m_sct_eca_residualsx_incidentAngle_s0.push_back(new TH2F(("sct_eca" + intToString(iWheel) + "_residualsx_incidentAngle_s0").c_str(), ("Residuals X vs Incident Theta Angle SCT ECA Layer " + intToString(iWheel) + "Incident Theta Angle (rad) Side 1;Local X Residual").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_eca_residualsx_incidentAngle_s0[iWheel]);
-
-
-            m_sct_eca_residualsx_incidentAnglePhi_s1.push_back(new TH2F(("sct_eca" + intToString(iWheel) + "_residualsx_incidentAnglePhi_s1").c_str(), ("Residuals X vs Incident Phi Angle SCT ECA Disk " + intToString(iWheel) + "Incident Phi Angle (rad) Side 1;Local X Residual").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_eca_residualsx_incidentAnglePhi_s1[iWheel]);
-            m_sct_eca_residualsx_incidentAngle_s1.push_back(new TH2F(("sct_eca" + intToString(iWheel) + "_residualsx_incidentAngle_s1").c_str(), ("Residuals X vs Incident Theta Angle SCT ECA Layer " + intToString(iWheel) + "Incident Theta Angle (rad) Side 1;Local X Residual").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_eca_residualsx_incidentAngle_s1[iWheel]);
-
-            m_sct_eca_clustersizePhi.push_back(new TH1F(("sct_eca_d" + intToString(iWheel) + "_clustersizePhi").c_str(), ("Cluster Phi size SCT ECA Disk " + intToString(iWheel)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_sct_eca_clustersizePhi[iWheel]);
-
-            m_sct_eca_residualsx_clustersizePhi.push_back(new TH2F(("sct_eca_d" + intToString(iWheel) + "_residualx_clustersizePhi").c_str(), ("Unbiased X Residual Vs Cluster Phi Size SCT ECA Disk " + intToString(iWheel) + ";Cluster Phi Size;SCT Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_eca_residualsx_clustersizePhi[iWheel]);
-
-            m_sct_eca_residualsx_clustersizePhiP.push_back(new TProfile(("sct_eca_d" + intToString(iWheel) + "_residualx_clustersizePhi_p").c_str(), ("Unbiased X Residual Vs Cluster Phi Size SCT ECA Disk " + intToString(iWheel) + ";Cluster Phi Size;SCT Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_eca_residualsx_clustersizePhiP[iWheel]);
-
-
-            m_sct_eca_clustersizePhi_incidentAngle.push_back(new TProfile(("sct_eca_d" + intToString(iWheel) + "_clustersizePhi_incidentAngle").c_str(), ("Cluster Phi Size Vs Incident Theta Angle SCT ECA Disk " + intToString(iWheel) + "Incident Theta Angle (rad);Cluster Phi Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_sct_eca_clustersizePhi_incidentAngle[iWheel]);
-            m_sct_eca_clustersizePhi_incidentAnglePhi.push_back(new TProfile(("sct_eca_d" + intToString(iWheel) + "_clustersizePhi_incidentAnglePhi").c_str(), ("Cluster Phi Size Vs Incident Phi Angle SCT ECA Disk " + intToString(iWheel) + "Incident Phi Angle (rad);Cluster Phi Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_sct_eca_clustersizePhi_incidentAnglePhi[iWheel]);
-          }
-        }
-      } else if (iSide < 0) {
-        if (m_extendedPlots) {
-          //std::cout<<"Checking rings for each endcap that is created iSide:"<<iSide<< "Wheel: "<<iWheel<<" Rings:
-          // "<<rings<<std::endl;
-          m_sct_ecc_s0_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_ecc_d" + intToString(iWheel) + "_s0_xresvsmodetaphi_3d").c_str(), ("X UnBiased Residual Distbn vs Module Eta-Phi-ID SCT ECC D" + intToString(iWheel) + " Side0;modEta;modPhi").c_str(), rings, 0, rings, maxModulesPerRing, 0, maxModulesPerRing, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_s0_xresvsmodetaphi_3ds[iWheel]);
-          m_sct_ecc_s1_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_ecc_d" + intToString(iWheel) + "_s1_xresvsmodetaphi_3d").c_str(), ("X UnBiased Residual Distbn vs Module Eta-Phi-ID SCT ECC D" + intToString(iWheel) + " Side1;modEta;modPhi").c_str(), rings, 0, rings, maxModulesPerRing, 0, maxModulesPerRing, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_s1_xresvsmodetaphi_3ds[iWheel]);
-          m_sct_ecc_xresvsmodphi_disks.push_back(new TProfile(("sct_ecc_unbiased_xresvsmodphi_disk" + intToString(iWheel)).c_str(), ("UNBIASED X Residual Average vs Module Phi of SCT Endcap C Disk " + intToString(iWheel) + ";Module Phi Identifier;Residual X (mm)").c_str(), maxModulesPerDisk, 0, maxModulesPerDisk));
-          RegisterHisto(al_mon, m_sct_ecc_xresvsmodphi_disks[iWheel]);
-          //3d biased res vs mod eta mod phi
-          m_sct_ecc_s0_biased_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_ecc_d" + intToString(iWheel) + "_s0_biased_xresvsmodetaphi_3d").c_str(), ("X Biased Residual Distbn vs Module Eta-Phi-ID SCT ECC D" + intToString(iWheel) + " Side0;modEta;modPhi").c_str(), rings, 0, rings, maxModulesPerRing, 0, maxModulesPerRing, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_s0_biased_xresvsmodetaphi_3ds[iWheel]);
-          m_sct_ecc_s1_biased_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_ecc_d" + intToString(iWheel) + "_s1_biased_xresvsmodetaphi_3d").c_str(), ("X Biased Residual Distbn vs Module Eta-Phi-ID SCT ECC D" + intToString(iWheel) + " Side1;modEta;modPhi").c_str(), rings, 0, rings, maxModulesPerRing, 0, maxModulesPerRing, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_s1_biased_xresvsmodetaphi_3ds[iWheel]);
-          //unbiased residual vs pT
-          m_sct_ecc_residualsx_pt.push_back(new TH2F(("sct_ecc_d" + intToString(iWheel) + "_residualx_pt").c_str(), ("X Residual Vs Pt SCT Endcap C Disk" + intToString(iWheel) + ";Track pT (GeV);SCT Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_residualsx_pt[iWheel]);
-          //unbiased vs Qoverp2
-          m_sct_ecc_residualsx_qoverp2.push_back(new TH2F(("sct_ecc_d" + intToString(iWheel) + "_unbiased_residualx_qoverp2").c_str(), ("UnBiased X Residual Vs Q/P^{2} SCT Endcap C Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});SCT Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_residualsx_qoverp2[iWheel]);
-          //unbiased pulls vs pt
-          m_sct_ecc_pullsx_pt.push_back(new TH2F(("sct_ecc_d" + intToString(iWheel) + "_pullx_pt").c_str(), ("X Pull Vs Pt SCT Endcap C Disk " + intToString(iWheel) + ";Track pT (GeV); SCT Pull").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos));
-          RegisterHisto(al_mon, m_sct_ecc_pullsx_pt[iWheel]);
-          //SCT endcaps BIASED residuals vs modPhi identifier for each disk
-          m_sct_ecc_biased_xresvsmodphi_disks.push_back(new TProfile(("sct_ecc_BIASED_xresvsmodphi_disk" + intToString(iWheel)).c_str(), ("BIASED X Residual Average vs Module Phi of SCT Endcap C Disk " + intToString(iWheel) + ";Module Phi Identifier;Residual X (mm)").c_str(), maxModulesPerDisk, 0, maxModulesPerDisk));
-          RegisterHisto(al_mon, m_sct_ecc_biased_xresvsmodphi_disks[iWheel]);
-
-          //biased
-          m_sct_ecc_biased_residualsx.push_back(new TH1F(("sct_ecc_d" + intToString(iWheel) + "_biased_residualx").c_str(), ("Biased X Residual SCT Endcap C Disk " + intToString(iWheel)).c_str(), 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_biased_residualsx[iWheel]);
-          //biased vs pT
-          m_sct_ecc_biased_residualsx_pt.push_back(new TH2F(("sct_ecc_d" + intToString(iWheel) + "_biased_residualx_pt").c_str(), ("Biased X Residual Vs Pt SCT Endcap C Disk " + intToString(iWheel) + ";Track pT (GeV);SCT Res (mm)").c_str(), m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_biased_residualsx_pt[iWheel]);
-          //biased vs Qoverp2
-          m_sct_ecc_biased_residualsx_qoverp2.push_back(new TH2F(("sct_ecc_d" + intToString(iWheel) + "_biased_residualx_qoverp2").c_str(), ("Biased X Residual Vs Q/P^{2} SCT Endcap C Disk " + intToString(iWheel) + ";Track Q/P^{2} (GeV^{-2});SCT Res (mm)").c_str(), 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-          RegisterHisto(al_mon, m_sct_ecc_biased_residualsx_qoverp2[iWheel]);
-          if (m_doClusterSizeHistos) {
-            m_sct_ecc_residualsx_incidentAnglePhi_s0.push_back(new TH2F(("sct_ecc" + intToString(iWheel) + "_residualsx_incidentAnglePhi_s0").c_str(), ("Residuals X vs Incident Phi Angle SCT ECC Disk " + intToString(iWheel) + "Incident Phi Angle (rad) Side 0;Local X Residual").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_ecc_residualsx_incidentAnglePhi_s0[iWheel]);
-            m_sct_ecc_residualsx_incidentAngle_s0.push_back(new TH2F(("sct_ecc" + intToString(iWheel) + "_residualsx_incidentAngle_s0").c_str(), ("Residuals X vs Incident Theta Angle SCT ECC Layer " + intToString(iWheel) + "Incident Theta Angle (rad) Side 1;Local X Residual").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_ecc_residualsx_incidentAngle_s0[iWheel]);
-
-
-            m_sct_ecc_residualsx_incidentAnglePhi_s1.push_back(new TH2F(("sct_ecc" + intToString(iWheel) + "_residualsx_incidentAnglePhi_s1").c_str(), ("Residuals X vs Incident Phi Angle SCT ECC Disk " + intToString(iWheel) + "Incident Phi Angle (rad) Side 1;Local X Residual").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_ecc_residualsx_incidentAnglePhi_s1[iWheel]);
-            m_sct_ecc_residualsx_incidentAngle_s1.push_back(new TH2F(("sct_ecc" + intToString(iWheel) + "_residualsx_incidentAngle_s1").c_str(), ("Residuals X vs Incident Theta Angle SCT ECC Layer " + intToString(iWheel) + "Incident Theta Angle (rad) Side 1;Local X Residual").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_ecc_residualsx_incidentAngle_s1[iWheel]);
-
-            m_sct_ecc_clustersizePhi.push_back(new TH1F(("sct_ecc_d" + intToString(iWheel) + "_clustersizePhi").c_str(), ("Cluster Phi size SCT ECC Disk " + intToString(iWheel)).c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_sct_ecc_clustersizePhi[iWheel]);
-
-            m_sct_ecc_residualsx_clustersizePhi.push_back(new TH2F(("sct_ecc_d" + intToString(iWheel) + "_residualx_clustersizePhi").c_str(), ("Unbiased X Residual Vs Cluster Phi Size SCT ECC Disk " + intToString(iWheel) + ";Cluster Phi Size;SCT Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_ecc_residualsx_clustersizePhi[iWheel]);
-
-            m_sct_ecc_residualsx_clustersizePhiP.push_back(new TProfile(("sct_ecc_d" + intToString(iWheel) + "_residualx_clustersizePhi_p").c_str(), ("Unbiased X Residual Vs Cluster Phi Size SCT ECC Disk " + intToString(iWheel) + ";Cluster Phi Size;SCT Res (mm)").c_str(), m_ClusterSizeRange, 0, m_ClusterSizeRange, m_minSCTResFillRange, m_maxSCTResFillRange));
-            RegisterHisto(al_mon, m_sct_ecc_residualsx_clustersizePhiP[iWheel]);
-
-            m_sct_ecc_clustersizePhi_incidentAngle.push_back(new TProfile(("sct_ecc_d" + intToString(iWheel) + "_clustersizePhi_incidentAngle").c_str(), ("Cluster Phi Size Vs Incident Theta Angle SCT ECC Disk " + intToString(iWheel) + "Incident Theta Angle (rad);Cluster Phi Size").c_str(), 20, -m_IncidentThetaRange, m_IncidentThetaRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_sct_ecc_clustersizePhi_incidentAngle[iWheel]);
-            m_sct_ecc_clustersizePhi_incidentAnglePhi.push_back(new TProfile(("sct_ecc_d" + intToString(iWheel) + "_clustersizePhi_incidentAnglePhi").c_str(), ("Cluster Phi Size Vs Incident Phi Angle SCT ECC Disk " + intToString(iWheel) + "Incident Phi Angle (rad);Cluster Phi Size").c_str(), 20, -m_IncidentPhiRange, m_IncidentPhiRange, 0, m_ClusterSizeRange));
-            RegisterHisto(al_mon, m_sct_ecc_clustersizePhi_incidentAnglePhi[iWheel]);
-          }
-        }
-      } else ATH_MSG_ERROR(" iSide ==0: Creating endcaps histos but obtained a barrel identifier");
-    }
-  }
-  m_sct_eca_residualx = new TH1F("sct_eca_residualx", "UnBiased X Residual SCT EndCap A;Residual [mm]", 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_eca_residualx);
-  m_sct_ecc_residualx = new TH1F("sct_ecc_residualx", "UnBiased X Residual SCT EndCap C;Residual [mm]", 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_ecc_residualx);
-  m_sct_eca_pullx = new TH1F("sct_eca_pullx", "UnBiased X Pull SCT Endcap A", 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-  RegisterHisto(al_mon, m_sct_eca_pullx);
-  m_sct_ecc_pullx = new TH1F("sct_ecc_pullx", "UnBiased X Pull SCT Endcap C", 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-  RegisterHisto(al_mon, m_sct_ecc_pullx);
-  //Do I need to separate between s0 and s1?
-  //for (std::vector<int>::size_type i=0; i!= m_sct_eca_xresvsmodetaphi_3ds.size(); ++i)
-  //RegisterHisto(al_mon,m_sct_eca_xresvsmodetaphi_3ds[i]); Added
-  //for (std::vector<int>::size_type i=0; i!= m_sct_ecc_xresvsmodetaphi_3ds.size(); ++i)
-  //RegisterHisto(al_mon,m_sct_ecc_xresvsmodetaphi_3ds[i]); Added
-  //std::cout<<"totalPhiModules= "<<totalPhiModules<<std::endl;
-  m_sct_eca_xresvsmodphi_2d = new TH2F("sct_eca_xresvsmodphi_2d", "X Residual Mean vs (Modified) Module Phi SCT Endcap A",
-                                       totalPhiModulesOuterLayer, 0, totalPhiModulesOuterLayer,
-                                       100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_eca_xresvsmodphi_2d);
-  m_sct_ecc_xresvsmodphi_2d = new TH2F("sct_ecc_xresvsmodphi_2d", "X Residual Mean vs (Modified) Module Phi SCT Endcap C",
-                                       totalPhiModulesOuterLayer, 0, totalPhiModulesOuterLayer,
-                                       100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_ecc_xresvsmodphi_2d);
-
-  m_sct_eca_Oxresxvsmodphi = new TProfile("sct_eca_Oxresxvsmodphi", "X_Overlap Residual X Mean vs (Modified) Module Phi SCT Endcap A",
-                                          totalPhiModulesOuterLayer, 0, totalPhiModulesOuterLayer, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_eca_Oxresxvsmodphi);
-  m_sct_ecc_Oxresxvsmodphi = new TProfile("sct_ecc_Oxresxvsmodphi", "X_Overlap Residual X Mean vs (Modified) Module Phi SCT Endcap C",
-                                          totalPhiModulesOuterLayer, 0, totalPhiModulesOuterLayer, m_minSCTResFillRange, m_maxSCTResFillRange);
-  RegisterHisto(al_mon, m_sct_ecc_Oxresxvsmodphi);
-  //These histograms are filled in post-processing - only initiated here such that they can be registered as "shift".
-  //residual mean as function module phi in endcaps
-  m_sct_eca_xresvsmodphi = new TH1F("sct_eca_xresvsmodphi", "X Residual Mean vs (Modified) Module Phi SCT Endcap A;(Modified) Module Phi Identifier;Mean Residual X",
-                                    totalPhiModulesOuterLayer, 0, totalPhiModulesOuterLayer); //495
-  RegisterHisto(al_mon, m_sct_eca_xresvsmodphi);
-  m_sct_ecc_xresvsmodphi = new TH1F("sct_ecc_xresvsmodphi", "X Residual Mean vs (Modified) Module Phi SCT Endcap C;(Modified) Module Phi Identifier;Mean Residual X",
-                                    totalPhiModulesOuterLayer, 0, totalPhiModulesOuterLayer);
-  RegisterHisto(al_mon, m_sct_ecc_xresvsmodphi);
-  if (m_extendedPlots) {
-    m_sct_eca_residualx_fine = new TH1F("sct_eca_residualx_fine", "UnBiased X Residual SCT Endcap A;Residual [mm]", 500, -1.0, 1.0);
-    RegisterHisto(al_mon, m_sct_eca_residualx_fine);
-    m_sct_ecc_residualx_fine = new TH1F("sct_ecc_residualx_fine", "UnBiased X Residual SCT Endcap C;Residual [mm]", 500, -1.0, 1.0);
-    RegisterHisto(al_mon, m_sct_ecc_residualx_fine);
-    m_sct_eca_biased_residualx = new TH1F("sct_eca_biased_residualx", "Biased X Residual SCT Endcap A", 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_eca_biased_residualx);
-    m_sct_ecc_biased_residualx = new TH1F("sct_ecc_biased_residualx", "Biased X Residual SCT Endcap C", 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_ecc_biased_residualx);
-    m_sct_eca_biased_residualx_pt = new TH2F("sct_eca_biased_residualx_pt", "Biased X Residual Vs Pt SCT Endcap A;Track pT (GeV);SCT Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_eca_biased_residualx_pt);
-    m_sct_ecc_biased_residualx_pt = new TH2F("sct_ecc_biased_residualx_pt", "Biased X Residual Vs Pt SCT Endcap C;Track pT (GeV);SCT Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_ecc_biased_residualx_pt);
-    m_sct_eca_residualx_pt = new TH2F("sct_eca_residualx_pt", "X Residual Vs Pt SCT Endcap A;Track pT (GeV);SCT Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    RegisterHisto(al_mon, m_sct_eca_residualx_pt);
-    m_sct_ecc_residualx_pt = new TH2F("sct_ecc_residualx_pt", "X Residual Vs Pt SCT Endcap C;Track pT (GeV);SCT Res (mm)", m_nBinsPtRange, -m_PtRange, m_PtRange, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-    RegisterHisto(al_mon, m_sct_ecc_residualx_pt);
-    m_sct_eca_biased_residualx_qoverp2 = new TH2F("sct_eca_biased_residualx_qoverp2", "Biased X Residual Vs Q/P^{2} SCT Endcap A;Track Q/P^{2} (GeV^{-2});SCT Res (mm)", 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_eca_biased_residualx_qoverp2);
-    m_sct_ecc_biased_residualx_qoverp2 = new TH2F("sct_ecc_biased_residualx_qoverp2", "Biased X Residual Vs Q/P^{2} SCT Endcap C;Track Q/P^{2} (GeV^{-2});SCT Res (mm)", 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_ecc_biased_residualx_qoverp2);
-    m_sct_eca_unbiased_residualx_qoverp2 = new TH2F("sct_eca_unbiased_residualx_qoverp2", "Unbiased X Residual Vs Q/P^{2} SCT Endcap A;Track Q/P^{2} (GeV^{-2});SCT Res (mm)", 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_eca_unbiased_residualx_qoverp2);
-    m_sct_ecc_unbiased_residualx_qoverp2 = new TH2F("sct_ecc_unbiased_residualx_qoverp2", "Unbiased X Residual Vs Q/P^{2} SCT Endcap C;Track Q/P^{2} (GeV^{-2});SCT Res (mm)", 20, customaxis, 100 * m_FinerBinningFactor, m_minSCTResFillRange, m_maxSCTResFillRange);
-    RegisterHisto(al_mon, m_sct_ecc_unbiased_residualx_qoverp2);
-    m_sct_eca_pullx_pt = new TH2F("sct_eca_pullx_pt", "X Pull Vs Pt SCT Endcap A;Track pT (GeV);SCT Pull", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_sct_eca_pullx_pt);
-    m_sct_ecc_pullx_pt = new TH2F("sct_ecc_pullx_pt", "X Pull Vs Pt SCT Endcap C;Track pT (GeV);SCT Pull", m_nBinsPtRange, -m_PtRange, m_PtRange, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-    RegisterHisto(al_mon, m_sct_ecc_pullx_pt);
-    // hit error
-    m_hiterror_sct_ec = new TH1F("m_hiterror_sct_ec", "SCT Endcap Hit Error;Hit Error (mm);SCT Hits", 80, 0., 0.2);
-    RegisterHisto(al_mon, m_hiterror_sct_ec);
-    // hit error wide range
-    m_hiterror_sct_ec_WideRange = new TH1F("m_hiterror_sct_ec_WideRange", "SCT Endcap Hit Error;Hit Error (mm);SCT Hits", 80, 0., 2.0);
-    RegisterHisto(al_mon, m_hiterror_sct_ec_WideRange);
-  }
-}
-
-void IDAlignMonResiduals::MakeSiliconHistograms(MonGroup& al_mon) {
-  //Barrel!!
-  //cppcheck-suppress publicAllocationError
-  m_si_barrel_resX_mean = new TH1F("si_barrel_resX_mean", "Mean Residual X vs Silicon Barrel Layer;;Mean Residual X", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5);
-  m_si_barrel_resY_mean = new TH1F("si_barrel_resY_mean", "Mean Residual Y vs Silicon Barrel Layer;;Mean Residual Y", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5);
-  m_si_barrel_pullX_width = new TH1F("si_barrel_pullX_width", "Pull X Gaussian Width vs Silicon Barrel Layer;;Pull X Gaussian Width", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5);
-  m_si_barrel_pullY_width = new TH1F("si_barrel_pullY_width", "Pull Y Gaussian Width vs Silicon Barrel Layer;;Pull Y Gaussian Width", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5);
-  m_si_barrel_resX_rms = new TH1F("si_barrel_resX_rms", "Residual X RMS vs Silicon Barrel Layer;;Residual X RMS", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5);
-  m_si_barrel_resY_rms = new TH1F("si_barrel_resY_rms", "Residual Y RMS vs Silicon Barrel Layer;;Residual Y RMS", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5);
-  m_si_barrel_resX = new TH2F("si_barrel_resX", "Residual X vs Silicon Barrel Layer", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-  m_si_barrel_resY = new TH2F("si_barrel_resY", "Residual Y vs Silicon Barrel Layer", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5, 100 * m_FinerBinningFactor, m_minSiResFillRange, m_maxSiResFillRange);
-  //Residual Y (only Pixel is filled currently - don't have SCT Y residuals yet)
-  m_si_barrel_pullX_mean = new TH1F("si_barrel_pullX_mean", "Pull X Gaussian Mean vs Silicon Barrel Layer", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5);
-  m_si_barrel_pullY_mean = new TH1F("si_barrel_pullY_mean", "Pull Y Gaussian Mean vs Silicon Barrel Layer", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5);
-  m_si_barrel_pullX = new TH2F("si_barrel_pullX", "Pull X vs Silicon Barrel Layer", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-  m_si_barrel_pullY = new TH2F("si_barrel_pullY", "Pull Y vs Silicon Barrel Layer", m_siliconBarrelLayersLabels.size(), -0.5, m_siliconBarrelLayersLabels.size() - 0.5, 100, -m_RangeOfPullHistos, m_RangeOfPullHistos);
-
-  for (int i = 1; i <= (int) m_siliconBarrelLayersLabels.size(); ++i) {
-    m_si_barrel_resX_mean->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_resY_mean->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_pullX_width->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_pullY_width->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_resX_rms->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_resY_rms->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_resX->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_resY->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_pullX_mean->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_pullY_mean->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_pullX->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-    m_si_barrel_pullY->GetXaxis()->SetBinLabel(i, m_siliconBarrelLayersLabels[i - 1]);
-  }
-  RegisterHisto(al_mon, m_si_barrel_resY_rms);
-  RegisterHisto(al_mon, m_si_barrel_resX_rms);
-  RegisterHisto(al_mon, m_si_barrel_pullY_width);
-  RegisterHisto(al_mon, m_si_barrel_pullX_width);
-  RegisterHisto(al_mon, m_si_barrel_resX_mean);
-  RegisterHisto(al_mon, m_si_barrel_resY_mean);
-  RegisterHisto(al_mon, m_si_barrel_resX);
-  RegisterHisto(al_mon, m_si_barrel_resY);
-  RegisterHisto(al_mon, m_si_barrel_pullX_mean);
-  RegisterHisto(al_mon, m_si_barrel_pullY_mean);
-  RegisterHisto(al_mon, m_si_barrel_pullX);
-  RegisterHisto(al_mon, m_si_barrel_pullY);
-  //EndCaps!  //TO DO
-}
-
-void IDAlignMonResiduals::MakeTRTHistograms(MonGroup& al_mon) {
-  /** Make the barrel hists */
-  MakeTRTBarrelHistograms(al_mon);
-  /** Make the endcap hists */
-  MakeTRTEndcapHistograms(al_mon);
-}
-
-void IDAlignMonResiduals::MakeTRTBarrelHistograms(MonGroup& al_mon) {
-  /** TRT barrel */
-  std::string sideName[3] = {
-    "", "Side_A", "Side_C"
-  };
-  float strawRadius = 2.5; // it is actually 2 mm, but allow some extra gap
-
-  for (unsigned int side = 0; side < 3; ++side) {
-    /** Residual in the TRT Barrel */
-    m_trt_b_hist->residualR[side] = MakeHist("trt_b_residualR" + sideName[side], "UnBiased Residual for the TRT Barrel " + sideName[side],
-                                             100 * m_FinerBinningFactor, m_minTRTResWindow, m_maxTRTResWindow, "Residual [mm]", "Entries");
-    RegisterHisto(al_mon, m_trt_b_hist->residualR[side]);
-
-    m_trt_b_hist->residualR_notube[side] = MakeHist("trt_b_residualR" + sideName[side] + "_notube", "UnBiased Residual (notube) for the TRT Barrel " + sideName[side],
-                                                    100 * m_FinerBinningFactor, m_minTRTResWindow, m_maxTRTResWindow, "Residual [mm]", "Entries");
-    RegisterHisto(al_mon, m_trt_b_hist->residualR_notube[side]);
-
-    /** Pull in the TRT Barrel */
-    m_trt_b_hist->pullR[side] = MakeHist("trt_b_pullR" + sideName[side], "Pull for the TRT Barrel " + sideName[side],
-                                         100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "Pull", "Entries");
-    RegisterHisto(al_mon, m_trt_b_hist->pullR[side]);
-
-    /** Pull in the TRT Barrel */
-    m_trt_b_hist->pullR_notube[side] = MakeHist("trt_b_pullR_notube" + sideName[side], "Pull for the TRT Barrel " + sideName[side],
-                                                100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "Pull", "Entries");
-    RegisterHisto(al_mon, m_trt_b_hist->pullR_notube[side]);
-
-    /** Measured drift radius */
-    m_trt_b_hist->MeasuredR[side] = MakeHist("trt_b_MeasuredR" + sideName[side], "Measured at drift radius for TRT Barrel " + sideName[side],
-                                             100, -strawRadius, strawRadius, "Measured Drift Radius (mm)", "Entries");
-    RegisterHisto(al_mon, m_trt_b_hist->MeasuredR[side]);
-
-    /** Drift radius from track fit */
-    m_trt_b_hist->PredictedR[side] = MakeHist("trt_b_PredictedR" + sideName[side], "Measured drift radius from TRT Barrel " + sideName[side],
-                                              100, -strawRadius, strawRadius, "Predicted Drift Radius [mm]", "Entries");
-    RegisterHisto(al_mon, m_trt_b_hist->PredictedR[side]);
-
-
-    /** L/R assignment */
-    m_trt_b_hist->lr[side] = MakeHist("trt_b_lr" + sideName[side], "|0= LRcor !isTube | 1= LRcor isTube| 2= !LRcor !isTube | 3= !LRcor isTube  " + sideName[side], 4, 0, 4, "", "Entries");
-    RegisterHisto(al_mon, m_trt_b_hist->lr[side]);
-
-    if (m_extendedPlots) {
-      /** R(t) relation */
-      m_trt_b_hist->rt[side] = MakeHist("trt_b_rt" + sideName[side], "rt relation (Barrel) " + sideName[side], 100, -12.5, 59.375, 100, 0, 2, "leading edge [ns] corrected for t0 and EP ", "dist from wire to track [mm]");
-      RegisterHisto(al_mon, m_trt_b_hist->rt[side]);
-
-
-      /**Pull vs mu */
-      m_trt_b_hist->pullR_notube_mu[side] = MakeHist("trt_b_pullRnotube_mu_" + sideName[side], "UnBiased Pull vs mu for the TRT Barrel (no tube hits)" + sideName[side],
-                                                     m_nBinsMuRange, m_muRangeMin, m_muRangeMax,
-                                                     100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "#mu", "Pull");
-      RegisterHisto(al_mon, m_trt_b_hist->pullR_notube_mu[side]);
-
-      /** Residuals and pulls vs pT*/
-      m_trt_b_hist->residualR_pt[side] = MakeHist("trt_b_residualR_pt_" + sideName[side],
-                                                  "Unbiased residual vs pT for the TRT Barrel " + sideName[side],
-                                                  m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                                  100, m_minTRTResWindow, m_minTRTResWindow, "Track p_{T} [GeV]", "Residual [mm]");
-      RegisterHisto(al_mon, m_trt_b_hist->residualR_pt[side]);
-
-      m_trt_b_hist->pullR_pt[side] = MakeHist("trt_b_pullR_pt_" + sideName[side],
-                                              "Unbiased residual Pull vs pT for the TRT Barrel " + sideName[side],
-                                              m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                              100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "Track p_{T} [GeV]", "Pull");
-      RegisterHisto(al_mon, m_trt_b_hist->pullR_pt[side]);
-
-      m_trt_b_hist->pullR_mu[side] = MakeHist("trt_b_pullR_mu_" + sideName[side], "UnBiased Pull vs mu for the TRT Barrel " + sideName[side],
-                                              m_nBinsMuRange, m_muRangeMin, m_muRangeMax,
-                                              100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "#mu", "Pull");
-      RegisterHisto(al_mon, m_trt_b_hist->pullR_mu[side]);
-
-
-      m_trt_b_hist->pullR_notube_pt[side] = MakeHist("trt_b_pullRnotube_pt_" + sideName[side],
-                                                     "UnBiased Pull vs pT for the TRT Barrel (no tube hits)" + sideName[side],
-                                                     m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                                     100, -m_RangeOfPullHistos, m_RangeOfPullHistos,
-                                                     "Track p_{T} [GeV]", "Pull");
-      RegisterHisto(al_mon, m_trt_b_hist->pullR_notube_pt[side]);
-
-      /** Residuals and pulls vs mu*/
-      m_trt_b_hist->residualR_mu[side] = MakeHist("trt_b_residualR_mu_" + sideName[side], "Unbiased Residual vs mu for TRT Barrel " + sideName[side],
-                                                  m_nBinsMuRange, m_muRangeMin, m_muRangeMax,
-                                                  100, m_minTRTResWindow, m_maxTRTResWindow,
-                                                  "#mu", "Residual [mm]");
-      RegisterHisto(al_mon, m_trt_b_hist->residualR_mu[side]);
-    }
-
-    /** Over Barrel Layers*/
-    for (int lay = 0; lay < 3; ++lay) {
-      /** Average Res Vs PhiSector for the 3 Barrel Layers (A and C, A Only, C Only)*/
-      m_trt_b_hist->aveRes_l[side][lay] = MakeProfile("trt_b_aveRes_l" + intToString(lay) + sideName[side],
-                                                      "Average Residual vs Phi Sector for TRT Barrel Layer" + intToString(lay) + " " + sideName[side],
-                                                      m_TRTB_nSectorBins, -0.5, 31.5,
-                                                      m_minTRTResWindow, m_maxTRTResWindow,
-                                                      "Phi Sector", "Average Residual [mm]", false);
-      RegisterHisto(al_mon, m_trt_b_hist->aveRes_l[side][lay]);
-
-      /** Residual RMS Vs PhiSector for the 3 Barrel Layers (A and C, A Only, C Only)*/
-      m_trt_b_hist->rmsRes_l[side][lay] = MakeProfile("trt_b_rmsRes_l" + intToString(lay) + sideName[side],
-                                                      "Residual RMS vs Phi Sector for TRT Barrel Layer" + intToString(lay) + " " + sideName[side],
-                                                      m_TRTB_nSectorBins, -0.5, 31.5,
-                                                      0.0, 2.0, "Phi Sector", "Residual RMS");
-      RegisterHisto(al_mon, m_trt_b_hist->rmsRes_l[side][lay]);
-
-      /** Residual Vs eta (of the track) for the 3 Barrel Layers */
-      m_trt_b_hist->aveResVsTrackEta_l[side][lay] = MakeProfile("trt_b_aveResVsTrackEta_l" + intToString(lay) + sideName[side],
-                                                                "Average Residual vs Track eta for TRT Barrel Module Layer " + intToString(lay) + " " + sideName[side],
-                                                                20, -2.5, 2.5,
-                                                                m_minTRTResWindow, m_maxTRTResWindow,
-                                                                "Track eta", "Average Residual [mm]");
-      RegisterHisto(al_mon, m_trt_b_hist->aveResVsTrackEta_l[side][lay]);
-
-      /** L/R assignment Vs PhiSector for the 3 Barrel Layers (A and C, A Only, C Only)*/
-      m_trt_b_hist->lr_l[side][lay] = MakeProfile("trt_b_lr_l" + intToString(lay) + sideName[side],
-                                                  "LR assignment vs Phi Sector for TRT Barrel Layer " + intToString(lay) + " " + sideName[side],
-                                                  m_TRTB_nSectorBins, -0.5, 31.5,
-                                                  0, 1.0, "Phi Sector", "fraction of LR assignment correct");
-      RegisterHisto(al_mon, m_trt_b_hist->lr_l[side][lay]);
-
-      if (m_extendedPlots) {
-        /** Residuals vs PhiSector & Z for 3 Barrel Layers (A and C, A Only, C Only)*/
-        // it's silly to do side a, and side c for these (since it's a map in Z), but it's how the code is set up. maybe
-        // they'll be useful for something...
-        m_trt_b_hist->resVsPhiZ[side][lay] = new TH3F(("trt_b_resVsPhiZ_l" + intToString(lay) + sideName[side]).c_str(),
-                                                      ("Residual Distribution vs Phi Sector & Z for TRT Barrel Modules in layer " + intToString(lay) + sideName[side]).c_str(),
-                                                      40, -712, 712 /*size of barrel according to TRT SW people*/,
-                                                      m_TRTB_nSectorBins, -0.5, 31.5,
-                                                      50, m_minTRTResWindow, m_maxTRTResWindow);
-        RegisterHisto(al_mon, m_trt_b_hist->resVsPhiZ[side][lay]);
-
-        /** Average residuals vs PhiSector & Z for 3 Barrel Layers (A and C, A Only, C Only)*/
-        m_trt_b_hist->aveResVsPhiZ[side][lay] = MakeHist("trt_b_aveResVsPhiZ_l" + intToString(lay) + sideName[side],
-                                                         "Average Residual vs Phi Sector & Z for TRT Barrel Modules in layer " + intToString(lay) + sideName[side],
-                                                         40, -712, 712,
-                                                         m_TRTB_nSectorBins, -0.5, 31.5, "z [mm]", "#phi Sector");
-        RegisterHisto(al_mon, m_trt_b_hist->aveResVsPhiZ[side][lay]);
-
-        /** Residual RMS vs PhiSector & Z for 3 Barrel Layers (A and C, A Only, C Only)*/
-        m_trt_b_hist->rmsResVsPhiZ[side][lay] = MakeHist("trt_b_rmsResVsPhiZ_l" + intToString(lay) + sideName[side],
-                                                         "Residual RMS vs Phi Sector & Z for TRT Barrel Modules in layer " + intToString(lay) + sideName[side],
-                                                         40, -712, 712,
-                                                         m_TRTB_nSectorBins, -0.5, 31.5, "z [mm]", "#phi Sector");
-        RegisterHisto(al_mon, m_trt_b_hist->rmsResVsPhiZ[side][lay]);
-
-        /** Residuals vs PhiSector & Eta for 3 Barrel Layers (A and C, A Only, C Only)*/
-        m_trt_b_hist->resVsPhiEta[side][lay] = new TH3F(("trt_b_resVsPhiEta_l" + intToString(lay) + sideName[side]).c_str(),
-                                                        ("Residual Distribution vs Phi Sector & Eta for TRT Barrel Modules in layer " + intToString(lay) + sideName[side] + ";#eta;#sector;Res [mm]").c_str(),
-                                                        50, -1.1, 1.1,
-                                                        m_TRTB_nSectorBins, -0.5, 31.5,
-                                                        50 * m_FinerBinningFactor, m_minTRTResWindow, m_maxTRTResWindow);
-        RegisterHisto(al_mon, m_trt_b_hist->resVsPhiEta[side][lay]);
-
-        /** Average residuals vs PhiSector & Eta for 3 Barrel Layers (A and C, A Only, C Only)*/
-        m_trt_b_hist->aveResVsPhiEta[side][lay] = MakeHist("trt_b_aveResVsPhiEta_l" + intToString(lay) + sideName[side],
-                                                           "Average Residual vs Phi Sector & Eta for TRT Barrel Modules in layer " + intToString(lay) + sideName[side],
-                                                           50, -1.1, 1.1,
-                                                           m_TRTB_nSectorBins, -0.5, 31.5, "#eta", "#phi Sector");
-        RegisterHisto(al_mon, m_trt_b_hist->aveResVsPhiEta[side][lay]);
-
-        /** Residual RMS vs PhiSector & Eta for 3 Barrel Layers (A and C, A Only, C Only)*/
-        m_trt_b_hist->rmsResVsPhiEta[side][lay] = MakeHist("trt_b_rmsResVsPhiEta_l" + intToString(lay) + sideName[side],
-                                                           "Residual RMS vs Phi Sector & Eta for TRT Barrel Modules in layer " + intToString(lay) + sideName[side],
-                                                           50, -1.1, 1.1,
-                                                           m_TRTB_nSectorBins, -0.5, 31.5, "#eta", "#phi Sector");
-        RegisterHisto(al_mon, m_trt_b_hist->rmsResVsPhiEta[side][lay]);
-      } // extendedPlots
-    }
-
-    if (m_extendedPlots) {
-      /** Over Phi Sectors*/
-      for (unsigned int phiSec = 0; phiSec < 32; ++phiSec) {
-        /** Average Res Vs Strawlayer for the 3 Barrel Layers (A and C, A Only, C Only)*/
-        m_trt_b_hist->aveResVsStrawLayerStackLevel[side][phiSec] = MakeProfile("trt_b_aveResVsStrawLayerStackLevel_" + intToString(phiSec) + "_" + sideName[side], "Average Residual vs Straw Layer for TRT Barrel Modules in phi sector " + intToString(phiSec) + " " + sideName[side],
-                                                                               73, -0.5, 72.5,
-                                                                               m_minTRTResWindow, m_maxTRTResWindow,
-                                                                               "Straw layer", "Average Residual [mm]", false);
-        RegisterHisto(al_mon, m_trt_b_hist->aveResVsStrawLayerStackLevel[side][phiSec]);
-
-        /** Residual RMS Vs Strawlayer for the 3 Barrel Layers (A and C, A Only, C Only)*/
-        m_trt_b_hist->rmsResVsStrawLayerStackLevel[side][phiSec] = MakeProfile("trt_b_rmsResVsStrawLayerStackLevel_" + intToString(phiSec) + "_" + sideName[side], "Residual RMS vs Straw Layer for TRT Barrel Modules in phi sector " + intToString(phiSec) + " " + sideName[side],
-                                                                               73, -0.5, 72.5,
-                                                                               m_minTRTResWindow, m_maxTRTResWindow,
-                                                                               "Straw layer", "Residual RMS [mm]");
-        RegisterHisto(al_mon, m_trt_b_hist->rmsResVsStrawLayerStackLevel[side][phiSec]);
-      }
-    }
-    std::string posName[5] = {
-      "", " Upper", " Lower", " Left", " Right"
-    };
-    /** Average residual and residual RMS Intergrated over each phi module vs straw layer */
-    for (unsigned int position = 0; position < 5; ++position) {
-      m_trt_b_hist->aveResOverPhiVsStrawLayer[position][side] = MakeProfile("trt_b_aveResOverPhiVsStrawLayer" + sideName[side] + posName[position],
-                                                                            "Average Residual (Integrated over Phi) Vs Straw Layer " + sideName[side] + posName[position],
-                                                                            73, -0.5, 72.5,
-                                                                            m_minTRTResWindow, m_maxTRTResWindow,
-                                                                            "Straw layer", "Average Residual [mm]", false);
-      RegisterHisto(al_mon, m_trt_b_hist->aveResOverPhiVsStrawLayer[position][side]);
-
-      m_trt_b_hist->rmsResOverPhiVsStrawLayer[position][side] = MakeProfile("trt_b_rmsResOverPhiVsStrawLayer" + sideName[side] + posName[position],
-                                                                            "Residual RMS (Integrated over Phi) Vs Straw Layer " + sideName[side] + posName[position],
-                                                                            73, -0.5, 72.5,
-                                                                            m_minTRTResWindow, m_maxTRTResWindow,
-                                                                            "Straw layer", "Residual RMS [mm]");
-      RegisterHisto(al_mon, m_trt_b_hist->rmsResOverPhiVsStrawLayer[position][side]);
-    }
-
-    m_trt_b_hist->lrOverPhiVsStrawLayer[side] = MakeProfile("trt_b_lrOverPhiVsStrawLayer" + sideName[side],
-                                                            "Fraction of LR correct (Integrated over Phi) Vs Straw Layer " + sideName[side],
-                                                            73, -0.5, 72.5,
-                                                            0, 1.0, "", "", false);
-    RegisterHisto(al_mon, m_trt_b_hist->lrOverPhiVsStrawLayer[side]);
-  }//Over sides
-
-  }
-
-void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon) {
-  std::string endcapName[2] = {
-    "Endcap_A", "Endcap_C"
-  };
-
-  /** TRT EndCapC */
-  /** Residual in TRT EndcapC */
-  for (unsigned int endcap = 0; endcap < 2; ++endcap) {
-    if (m_extendedPlots) {
-      /** Pull noTube vs mu */
-      m_trt_ec_hist->pullR_notube_mu[endcap] = MakeHist("trt_ec_pullRnotube_mu_" + endcapName[endcap], "UnBiased Pull vs mu for the TRT Barrel (no tube hits)" + endcapName[endcap],
-                                                        m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                                        m_nBinsMuRange, m_muRangeMin, m_muRangeMax,
-                                                        "#mu", "Pull");
-      RegisterHisto(al_mon, m_trt_ec_hist->pullR_notube_mu[endcap]);
-
-
-      /** Residuals and pulls vs pT*/
-      m_trt_ec_hist->residualR_pt[endcap] = MakeHist("trt_ec_residualR_pt_" + endcapName[endcap],
-                                                     "UnBiased Residual vs pT for the TRT Barrel " + endcapName[endcap],
-                                                     m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                                     100, m_minTRTResWindow, m_maxTRTResWindow,
-                                                     "Track p_{T} [GeV]", "Residual [mm]");
-      RegisterHisto(al_mon, m_trt_ec_hist->residualR_pt[endcap]);
-
-      m_trt_ec_hist->pullR_pt[endcap] = MakeHist("trt_ec_pullR_pt_" + endcapName[endcap], "UnBiased Pull vs pT for the TRT Barrel " + endcapName[endcap],
-                                                 m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                                 100, -m_RangeOfPullHistos, m_RangeOfPullHistos,
-                                                 "Track p_{T} [GeV]", "Pull");
-      RegisterHisto(al_mon, m_trt_ec_hist->pullR_pt[endcap]);
-
-      m_trt_ec_hist->pullR_notube_pt[endcap] = MakeHist("trt_ec_pullRnotube_pt_" + endcapName[endcap],
-                                                        "UnBiased Pull vs pT for the TRT Barrel (no tube hits)" + endcapName[endcap],
-                                                        m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                                        100, -m_RangeOfPullHistos, m_RangeOfPullHistos,
-                                                        "Track p_{T} [GeV]", "Pull");
-      RegisterHisto(al_mon, m_trt_ec_hist->pullR_notube_pt[endcap]);
-
-      /** Residuals vs pt per wheel */
-      for (int iWheel = 0; iWheel < 40; iWheel++) {
-        m_trt_ec_hist->residualR_ptwheel[endcap][iWheel] = MakeProfile("trt_ec_resVspt_wheel_" + intToString(iWheel) + "_" + endcapName[endcap],
-                                                                       "Residual vs p_{T} for TRT " + endcapName[endcap] + " " + intToString(iWheel),
-                                                                       m_nBinsPtRange, -m_PtRange, m_PtRange,
-                                                                       m_minTRTResWindow, m_maxTRTResWindow,
-                                                                       "Track p_{T} [GeV]", "Residual [mm]");
-        SetMinWindow(m_trt_ec_hist->residualR_ptwheel[endcap][iWheel], -0.025, 0.025);
-        RegisterHisto(al_mon, m_trt_ec_hist->residualR_ptwheel[endcap][iWheel]);
-      }
-
-      /** Residuals and pulls vs mu*/
-      m_trt_ec_hist->residualR_mu[endcap] = MakeHist("trt_ec_residualR_mu_" + endcapName[endcap],
-                                                     "UnBiased Residual vs mu for TRT " + endcapName[endcap],
-                                                     m_nBinsMuRange, m_muRangeMin, m_muRangeMax,
-                                                     50, m_minTRTResWindow, m_maxTRTResWindow,
-                                                     "#mu ", "Residual [mm]");
-      RegisterHisto(al_mon, m_trt_ec_hist->residualR_mu[endcap]);
-
-      m_trt_ec_hist->pullR_mu[endcap] = MakeHist("trt_ec_pullR_mu_" + endcapName[endcap], "Unbiased residual pull vs mu for TRT " + endcapName[endcap],
-                                                 m_nBinsMuRange, m_muRangeMin, m_muRangeMax,
-                                                 50, -m_RangeOfPullHistos, m_RangeOfPullHistos,
-                                                 "#mu", "Pull");
-      RegisterHisto(al_mon, m_trt_ec_hist->pullR_mu[endcap]);
-    }
-
-    if (m_extendedPlots) {
-      /** Endcap Residual plots vs Phi & Wheel */
-      m_trt_ec_hist->resVsPhiWheel[endcap] = new TH3F(("trt_ec_resVsPhiWheel_" + endcapName[endcap]).c_str(),
-                                                      ("Residual Distribution vs Phi Sector & Wheel for TRT " + endcapName[endcap] + ";Wheel;#phi sector;Residual [mm]").c_str(),
-                                                      40, -0.5, 39.5,
-                                                      m_TRTEC_nSectorBins, -0.5, 31.5,
-                                                      50, m_minTRTResWindow, m_maxTRTResWindow);
-      RegisterHisto(al_mon, m_trt_ec_hist->resVsPhiWheel[endcap]);
-
-      m_trt_ec_hist->aveResVsPhiWheel[endcap] = MakeHist("trt_ec_aveResVsPhiWheel_" + endcapName[endcap],
-                                                         "Average Residual vs Phi Sector & Wheel for TRT " + endcapName[endcap],
-                                                         40, -0.5, 39.5,
-                                                         m_TRTEC_nSectorBins, -0.5, 31.5,
-                                                         "End-cap 4-plane wheel", "#phi Sector");
-      RegisterHisto(al_mon, m_trt_ec_hist->aveResVsPhiWheel[endcap]);
-
-      m_trt_ec_hist->rmsResVsPhiWheel[endcap] = MakeHist("trt_ec_rmsResVsPhiWheel_" + endcapName[endcap], "Residual RMS vs Phi Sector & Wheel for TRT " + endcapName[endcap],
-                                                         40, -0.5, 39.5,
-                                                         m_TRTEC_nSectorBins, -0.5, 31.5,
-                                                         "End-cap 4-plane wheel", "#phi Sector");
-      RegisterHisto(al_mon, m_trt_ec_hist->rmsResVsPhiWheel[endcap]);
-
-      // same for positive and negative charged particles
-      m_trt_ec_hist->resVsPhiWheelPos[endcap] = new TH3F(("trt_ec_resVsPhiWheelPos_" + endcapName[endcap]).c_str(),
-                                                         ("Residual Distribution vs Phi Sector & Wheel for TRT " + endcapName[endcap] + " positive;Wheel;#phi sector;Residual [mm]").c_str(),
-                                                         40, -0.5, 39.5,
-                                                         m_TRTEC_nSectorBins, -0.5, 31.5,
-                                                         50, m_minTRTResWindow, m_maxTRTResWindow);
-      RegisterHisto(al_mon, m_trt_ec_hist->resVsPhiWheelPos[endcap]);
-      m_trt_ec_hist->resVsPhiWheelNeg[endcap] = new TH3F(("trt_ec_resVsPhiWheelNeg_" + endcapName[endcap]).c_str(),
-                                                         ("Residual Distribution vs Phi Sector & Wheel for TRT " + endcapName[endcap] + " negative;Wheel;#phi sector;Residual [mm]").c_str(),
-                                                         40, -0.5, 39.5,
-                                                         m_TRTEC_nSectorBins, -0.5, 31.5,
-                                                         50, m_minTRTResWindow, m_maxTRTResWindow);
-      RegisterHisto(al_mon, m_trt_ec_hist->resVsPhiWheelNeg[endcap]);
-
-      /** Endcap Residual plots vs Radius & Wheel */
-      m_trt_ec_hist->resVsRadiusWheelPos[endcap] = new TH3F(("trt_ec_resVsRadiusWheelPos_" + endcapName[endcap]).c_str(),
-                                                            ("Residual Distribution vs Wheel & Radius on Wheel for TRT " + endcapName[endcap] + ";Wheel;Radius [mm]; Res [mm]").c_str(),
-                                                            40, -0.5, 39.5,
-                                                            10, 644., 1004. /*these are the radius limits in mm
-                                                                               according to TRT SW*/                                 ,
-                                                            50, m_minTRTResWindow, m_maxTRTResWindow);
-      RegisterHisto(al_mon, m_trt_ec_hist->resVsRadiusWheelPos[endcap]);
-      m_trt_ec_hist->aveResVsRadiusWheelPos[endcap] = MakeHist("trt_ec_aveResVsRadiusWheelPos_" + endcapName[endcap],
-                                                               "Average Residual vs Wheel & Radius on Wheel for TRT " + endcapName[endcap],
-                                                               40, -0.5, 39.5,
-                                                               10, 644., 1004.,
-                                                               "Wheel Number", "Radius on Wheel [mm]");
-      RegisterHisto(al_mon, m_trt_ec_hist->aveResVsRadiusWheelPos[endcap]);
-      m_trt_ec_hist->rmsResVsRadiusWheelPos[endcap] = MakeHist("trt_ec_rmsResVsRadiusWheelPos_" + endcapName[endcap],
-                                                               "Residual RMS vs Wheel & Radius on Wheel for TRT " + endcapName[endcap],
-                                                               40, -0.5, 39.5,
-                                                               10, 644., 1004.,
-                                                               "Wheel Number", "Radius on Wheel [mm]");
-      RegisterHisto(al_mon, m_trt_ec_hist->rmsResVsRadiusWheelPos[endcap]);
-      m_trt_ec_hist->resVsRadiusWheelNeg[endcap] = new TH3F(("trt_ec_resVsRadiusWheelNeg_" + endcapName[endcap]).c_str(),
-                                                            ("Residual Distribution vs Wheel & Radius on Wheel for TRT " + endcapName[endcap] + ";Wheel;Radius [mm]; Res [mm]").c_str(),
-                                                            40, -0.5, 39.5,
-                                                            10, 644., 1004. /*these are the radius limits in mm
-                                                                               according to TRT SW*/                                 ,
-                                                            50, m_minTRTResWindow, m_maxTRTResWindow);
-      RegisterHisto(al_mon, m_trt_ec_hist->resVsRadiusWheelNeg[endcap]);
-      m_trt_ec_hist->aveResVsRadiusWheelNeg[endcap] = MakeHist("trt_ec_aveResVsRadiusWheelNeg_" + endcapName[endcap],
-                                                               "Average Residual vs Wheel & Radius on Wheel for TRT " + endcapName[endcap],
-                                                               40, -0.5, 39.5,
-                                                               10, 644., 1004.,
-                                                               "Wheel Number", "Radius on Wheel [mm]");
-      RegisterHisto(al_mon, m_trt_ec_hist->aveResVsRadiusWheelNeg[endcap]);
-      m_trt_ec_hist->rmsResVsRadiusWheelNeg[endcap] = MakeHist("trt_ec_rmsResVsRadiusWheelNeg_" + endcapName[endcap],
-                                                               "Residual RMS vs Wheel & Radius on Wheel for TRT " + endcapName[endcap],
-                                                               40, -0.5, 39.5,
-                                                               10, 644., 1004.,
-                                                               "Wheel Number", "Radius on Wheel [mm]");
-      RegisterHisto(al_mon, m_trt_ec_hist->rmsResVsRadiusWheelNeg[endcap]);
-
-      /** Endcap residual histograms vs q x pT & Wheel */
-      m_trt_ec_hist->resVsqPtWheel[endcap] = new TH3F(("trt_ec_resVsqPtWheel_" + endcapName[endcap]).c_str(),
-                                                      ("Residual Distribution vs Wheel & p_{T} for TRT " + endcapName[endcap] + ";Wheel;q#timesp_{T} [GeV]; Res [mm]").c_str(),
-                                                      40, -0.5, 39.5,
-                                                      20, -m_PtRange, m_PtRange,
-                                                      50, m_minTRTResWindow, m_maxTRTResWindow);
-      RegisterHisto(al_mon, m_trt_ec_hist->resVsqPtWheel[endcap]);
-
-      /** R(t) relation */
-      m_trt_ec_hist->rt[endcap] = MakeHist("trt_ec_rt_" + endcapName[endcap], "rt relation for TRT " + endcapName[endcap], 100, -12.5, 59.375, 100, 0, 2, "leading edge [ns] corrected for t0 and EP ", "dist from wire to track [mm]");
-      RegisterHisto(al_mon, m_trt_ec_hist->rt[endcap]);
-    } // extended plots
-
-    unsigned int totalRings = (m_extendedPlots) ? 41 : 1;
-
-    for (unsigned int ring = 0; ring < totalRings; ++ring) {//The "extra one is the total"
-      if (!ring) {
-        m_trt_ec_hist->residualR[endcap][ring] = MakeHist("trt_ec_residualR_" + endcapName[endcap], "Unbiased Residual for TRT " + endcapName[endcap],
-                                                          200, m_minTRTResWindow, m_maxTRTResWindow,
-                                                          "Residual [mm]", "Entries");
-        RegisterHisto(al_mon, m_trt_ec_hist->residualR[endcap][ring]);
-        m_trt_ec_hist->residualR_notube[endcap][ring] = MakeHist("trt_ec_residualR_notube" + endcapName[endcap], "Unbiased Residual (notube) for TRT " + endcapName[endcap],
-                                                                 200, m_minTRTResWindow, m_maxTRTResWindow,
-                                                                 "Residual [mm]", "Entries");
-        RegisterHisto(al_mon, m_trt_ec_hist->residualR_notube[endcap][ring]);
-        m_trt_ec_hist->pullR[endcap][ring] = MakeHist("trt_ec_pullR_" + endcapName[endcap], "Pull for TRT " + endcapName[endcap], 100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "Pull", "Entries");
-        RegisterHisto(al_mon, m_trt_ec_hist->pullR[endcap][ring]);
-        m_trt_ec_hist->pullR_notube[endcap][ring] = MakeHist("trt_ec_pullR_notube_" + endcapName[endcap], "Pull for TRT " + endcapName[endcap], 100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "Pull", "Entries");
-        RegisterHisto(al_mon, m_trt_ec_hist->pullR_notube[endcap][ring]);
-      } else {
-        m_trt_ec_hist->residualR[endcap][ring] = MakeHist("trt_ec_residualR_ring_" + intToString(ring - 1) + "_" + endcapName[endcap],
-                                                          "Unbiased Residual for TRT " + endcapName[endcap] + " Ring " + intToString(ring - 1),
-                                                          100, m_minTRTResWindow, m_maxTRTResWindow, "Residual [mm]", "Entries");
-        RegisterHisto(al_mon, m_trt_ec_hist->residualR[endcap][ring]);
-        m_trt_ec_hist->residualR_notube[endcap][ring] = MakeHist("trt_ec_residualR_ring_" + intToString(ring - 1) + "_" + endcapName[endcap] + "_notube", "UnBiased Residual (notube) for TRT " + endcapName[endcap] + " Ring " + intToString(ring - 1), 100, m_minTRTResWindow, m_maxTRTResWindow, "Residual [mm]", "Entries");
-        RegisterHisto(al_mon, m_trt_ec_hist->residualR_notube[endcap][ring]);
-        m_trt_ec_hist->pullR[endcap][ring] = MakeHist("trt_ec_pullR_ring_" + intToString(ring - 1) + "_" + endcapName[endcap], "Pull for TRT " + endcapName[endcap] + " Ring " + intToString(ring - 1), 100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "Pull", "Entries");
-        RegisterHisto(al_mon, m_trt_ec_hist->pullR[endcap][ring]);
-        m_trt_ec_hist->pullR_notube[endcap][ring] = MakeHist("trt_ec_pullR_notube_ring_" + intToString(ring - 1) + "_" + endcapName[endcap], "Pull for TRT " + endcapName[endcap] + " Ring " + intToString(ring - 1), 100, -m_RangeOfPullHistos, m_RangeOfPullHistos, "Pull", "Entries");
-        RegisterHisto(al_mon, m_trt_ec_hist->pullR_notube[endcap][ring]);
-      }
-    }
-
-    /** Measured drift radius */
-    float strawRadius = 2.5; // it is actually 2 mm, but allow some extra gap
-    m_trt_ec_hist->MeasuredR[endcap] = MakeHist("trt_ec_MeasuredR_" + endcapName[endcap], "Measured at line drift radius from TRT " + endcapName[endcap],
-                                                100, -strawRadius, strawRadius, "Measured Drift Radius [mm]", "Entries");
-    RegisterHisto(al_mon, m_trt_ec_hist->MeasuredR[endcap]);
-
-    /** Drift radius from track fit */
-    m_trt_ec_hist->PredictedR[endcap] = MakeHist("trt_ec_PredictedR_" + endcapName[endcap], "Predicted drift radius for TRT " + endcapName[endcap],
-                                                 100, -strawRadius, strawRadius, "Predicted Drift Radius [mm]", "Entries");
-    RegisterHisto(al_mon, m_trt_ec_hist->PredictedR[endcap]);
-
-    /** Average residual and residual RMS vs Ring */
-    m_trt_ec_hist->aveResVsRing[endcap] = MakeProfile("trt_ec_aveResVsRing_" + endcapName[endcap], "Average Residual vs Ring for TRT " + endcapName[endcap], 40, 0, 40, -1.0, 1.0, "Endcap Ring", "Average Residual [mm]", false);
-    RegisterHisto(al_mon, m_trt_ec_hist->aveResVsRing[endcap]);
-
-    m_trt_ec_hist->rmsResVsRing[endcap] = MakeProfile("trt_ec_rmsResVsRing_" + endcapName[endcap], "Residual RMS vs Ring for TRT " + endcapName[endcap], 40, 0, 40, 0, 1.0, "Endcap Ring", "Residual RMS");
-    RegisterHisto(al_mon, m_trt_ec_hist->rmsResVsRing[endcap]);
-
-    /** Average residual and residual RMS vs Phi sector */
-    m_trt_ec_hist->aveResVsPhiSec[endcap] = MakeProfile("trt_ec_aveResVsPhiSec_" + endcapName[endcap],
-                                                        "Average Residual vs PhiSec for TRT " + endcapName[endcap],
-                                                        m_TRTEC_nSectorBins, -0.5, 31.5,
-                                                        -1.0, 1.0, "Phi Sector", "Average Residual [mm]", false);
-    RegisterHisto(al_mon, m_trt_ec_hist->aveResVsPhiSec[endcap]);
-
-    m_trt_ec_hist->rmsResVsPhiSec[endcap] = MakeProfile("trt_ec_rmsResVsPhiSec_" + endcapName[endcap],
-                                                        "Residual RMS vs sector for TRT " + endcapName[endcap],
-                                                        m_TRTEC_nSectorBins, -0.5, 31.5,
-                                                        0, 1.0,
-                                                        "Endcap PhiSec", "Residual RMS");
-    RegisterHisto(al_mon, m_trt_ec_hist->rmsResVsPhiSec[endcap]);
-
-    m_trt_ec_hist->aveResVsTrackEta[endcap] = MakeProfile("trt_ec_aveResVsTrackEta_" + endcapName[endcap],
-                                                          "Average Residual vs Eta for TRT " + endcapName[endcap],
-                                                          20, -2.5, 2.5,
-                                                          -1.0, 1.0, "Track Eta", "Average Residual [mm]", false);
-    RegisterHisto(al_mon, m_trt_ec_hist->aveResVsTrackEta[endcap]);
-
-    /** L/R Assignment */
-    m_trt_ec_hist->lr[endcap] = MakeHist("trt_ec_lr_" + endcapName[endcap], "|0= LRcor !isTube | 1= LRcor isTube| 2= !LRcor !isTube | 3= !LRcor isTube " + endcapName[endcap], 4, 0, 4, "", "Entries");
-    RegisterHisto(al_mon, m_trt_ec_hist->lr[endcap]);
-
-    m_trt_ec_hist->lrVsPhiSec[endcap] = MakeProfile("trt_ec_lrVsPhiSec_" + endcapName[endcap],
-                                                    "LR assignment vs Phi Sector for TRT " + endcapName[endcap],
-                                                    m_TRTEC_nSectorBins, -0.5, 31.5,
-                                                    0, 1.0, "Phi Sector", "fraction of LR assignment correct");
-    RegisterHisto(al_mon, m_trt_ec_hist->lrVsPhiSec[endcap]);
-
-    m_trt_ec_hist->lrVsRing[endcap] = MakeProfile("trt_ec_lrVsRing_" + endcapName[endcap], "LR assignment vs Ring for TRT " + endcapName[endcap], 40, 0, 40, 0, 1.0, "Ring", "fraction of LR assignment correct");
-    RegisterHisto(al_mon, m_trt_ec_hist->lrVsRing[endcap]);
-  }
-
-  }
-
-void IDAlignMonResiduals::fillTRTHistograms(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer, float perdictR, float hitR, float hitZ, float hitGlobalR, float residualR, float pullR, float LE, float EP, float t0, bool isTubeHit, float trketa, float trkpt, double hweight) {
-  bool LRcorrect = true;
-
-  if (perdictR * hitR < 0) LRcorrect = false;
-
-  //Need to correct the TRT residual on the C-side.
-  if (barrel_ec == -1) {
-    residualR *= -1;
-  }
-
-  if (barrel_ec == 1 || barrel_ec == -1)
-    fillTRTBarrelHistograms(barrel_ec
-                            , layer_or_wheel
-                            , phi_module
-                            , straw_layer
-                            , perdictR
-                            , hitR
-                            , hitZ
-                            , residualR
-                            , pullR
-                            , LRcorrect
-                            , LE
-                            , EP
-                            , t0
-                            , isTubeHit
-                            , trketa
-                            , trkpt, hweight);
-
-  /** Filling EndCapA histograms */
-  if (barrel_ec == 2 || barrel_ec == -2)
-    fillTRTEndcapHistograms(barrel_ec
-                            , layer_or_wheel
-                            , phi_module
-                            , straw_layer
-                            , perdictR
-                            , hitR
-                            , hitGlobalR
-                            , residualR
-                            , pullR
-                            , LRcorrect
-                            , LE
-                            , EP
-                            , t0
-                            , isTubeHit
-                            , trketa
-                            , trkpt, hweight);
-}
-
-//Filling barrel histograms
-void IDAlignMonResiduals::fillTRTBarrelHistograms(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer, float perdictR, float hitR, float hitZ, float residualR, float pullR, bool LRcorrect, float LE, float EP, float t0, bool isTubeHit, float trketa, float trkpt, double hweight) {
-  //Logic to determine Left, Right, Upper, Lower
-  bool isUpper = phi_module > 4 && phi_module < 12;
-  bool isLower = phi_module > 20 && phi_module < 28;
-  bool isRight = phi_module <= 4 || phi_module >= 28;
-  bool isLeft = phi_module >= 12 && phi_module <= 20;
-
-  //Loop over the barrel sides
-  for (unsigned int side = 0; side < 3; ++side) {
-    bool doFill = false;
-    if (!side) doFill = true;
-    else if (side == 1 && barrel_ec == 1) doFill = true;
-    else if (side == 2 && barrel_ec == -1) doFill = true;
-
-    if (!doFill) continue;
-
-    m_trt_b_hist->PredictedR[side]->Fill(perdictR, hweight);
-    m_trt_b_hist->MeasuredR[side]->Fill(hitR, hweight);
-    m_trt_b_hist->residualR[side]->Fill(residualR, hweight);
-
-    m_trt_b_hist->pullR[side]->Fill(pullR, hweight);
-    if (!isTubeHit) {
-      m_trt_b_hist->pullR_notube[side]->Fill(pullR, hweight);
-      m_trt_b_hist->residualR_notube[side]->Fill(residualR, hweight);
-    }
-
-
-    if (LRcorrect && !isTubeHit) m_trt_b_hist->lr[side]->Fill(0.5, hweight);
-    if (LRcorrect && isTubeHit) m_trt_b_hist->lr[side]->Fill(1.5, hweight);
-    if (!LRcorrect && !isTubeHit) m_trt_b_hist->lr[side]->Fill(2.5, hweight);
-    if (!LRcorrect && isTubeHit) m_trt_b_hist->lr[side]->Fill(3.5, hweight);
-
-
-
-    if (m_extendedPlots) {
-      if (LE != -999) m_trt_b_hist->rt[side]->Fill(LE - EP - t0, fabs(perdictR), hweight);
-      m_trt_b_hist->residualR_pt[side]->Fill(trkpt, residualR, hweight);
-      m_trt_b_hist->pullR_pt[side]->Fill(trkpt, pullR, hweight);
-      if (!isTubeHit) m_trt_b_hist->pullR_notube_pt[side]->Fill(trkpt, pullR, hweight);
-      m_trt_b_hist->residualR_mu[side]->Fill(m_mu, residualR, hweight);
-      m_trt_b_hist->pullR_mu[side]->Fill(m_mu, pullR, hweight);
-      if (!isTubeHit) m_trt_b_hist->pullR_notube_mu[side]->Fill(m_mu, pullR, hweight);
-    }
-
-    //There are different number of straw layers in the differnt types of module layers
-    // and the TRT_Id helper returns the layer with the current module (not global the layer)
-    unsigned int numStrawLayers[3] = {
-      0, 19, 19 + 24
-    };
-
-    for (int lay = 0; lay < 3; ++lay) {
-      if (lay == layer_or_wheel) {
-        m_trt_b_hist->lrOverPhiVsStrawLayer[side]->Fill(numStrawLayers[lay] + straw_layer, LRcorrect, hweight);
-        if (m_extendedPlots) {
-          m_trt_b_hist->resVsPhiZ[side][lay]->Fill(hitZ, phi_module, residualR, hweight);
-          m_trt_b_hist->resVsPhiEta[side][lay]->Fill(trketa, phi_module, residualR, hweight);
-          for (int testPhi = 0; testPhi < 32; ++testPhi) {
-            if (phi_module == testPhi) m_trt_b_hist->aveResVsStrawLayerStackLevel[side][testPhi]->Fill(numStrawLayers[lay] + straw_layer, residualR, hweight);
-          }
-        }
-
-        for (unsigned int position = 0; position < 5; ++position) {
-          bool doFillPosition = false;
-          if (!position) doFillPosition = true;
-          else if (position == 1 && isUpper) doFillPosition = true;
-          else if (position == 2 && isLower) doFillPosition = true;
-          else if (position == 3 && isLeft) doFillPosition = true;
-          else if (position == 4 && isRight) doFillPosition = true;
-
-          if (!doFillPosition) continue;
-
-          m_trt_b_hist->aveResOverPhiVsStrawLayer[position][side]->Fill(numStrawLayers[lay] + straw_layer, residualR, hweight);
-        }
-      }
-    }//over layers
-
-    for (int lay = 0; lay < 3; ++lay) {//Filling layer lay of barrel
-      if (layer_or_wheel == lay) {
-        m_trt_b_hist->aveResVsTrackEta_l[side][lay]->Fill(trketa, residualR, hweight);
-        for (int phi = 0; phi < 32; ++phi) { //Filling phimodule phi of barrel
-          if (phi_module == phi) {
-            m_trt_b_hist->aveRes_l[side][lay]->Fill(phi, residualR, hweight);
-            m_trt_b_hist->lr_l[side][lay]->Fill(phi, LRcorrect, hweight);
-            //m_trt_b_hist->aveResVsStrawLayer[lay][phi]->Fill(straw_layer, residualR);
-          }
-        }
-      }
-    }
-  }//Over sides
-
-  }//fillTRTBarrelHistograms
-
-void IDAlignMonResiduals::fillTRTEndcapHistograms(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer, float perdictR, float hitR, float hitGlobalR, float residualR, float pullR, bool LRcorrect, float LE, float EP, float t0, bool isTubeHit, float trketa, float trkpt, double hweight) {
-  for (unsigned int endcap = 0; endcap < 2; ++endcap) {
-    bool doFill = false;
-    if (!endcap && barrel_ec == 2) doFill = true;
-    else if (endcap && barrel_ec == -2) doFill = true;
-
-    if (!doFill) continue;
-
-    m_trt_ec_hist->PredictedR[endcap]->Fill(perdictR, hweight);
-    m_trt_ec_hist->MeasuredR[endcap]->Fill(hitR, hweight);
-    m_trt_ec_hist->residualR[endcap][0]->Fill(residualR, hweight);
-    m_trt_ec_hist->pullR[endcap][0]->Fill(pullR, hweight);
-    if (!isTubeHit) {
-      m_trt_ec_hist->pullR_notube[endcap][0]->Fill(pullR, hweight);
-      m_trt_ec_hist->residualR_notube[endcap][0]->Fill(residualR, hweight);
-    }
-    m_trt_ec_hist->aveResVsTrackEta[endcap]->Fill(trketa, residualR, hweight);
-
-    if (m_extendedPlots) {
-      if (LE != -999) m_trt_ec_hist->rt[endcap]->Fill(LE - EP - t0, fabs(perdictR), hweight);
-      m_trt_ec_hist->residualR_pt[endcap]->Fill(trkpt, residualR, hweight);
-      m_trt_ec_hist->residualR_ptwheel[endcap][getRing(layer_or_wheel, straw_layer)]->Fill(trkpt, residualR, hweight);
-      m_trt_ec_hist->pullR_pt[endcap]->Fill(trkpt, pullR, hweight);
-      if (!isTubeHit) m_trt_ec_hist->pullR_notube_pt[endcap]->Fill(trkpt, pullR, hweight);
-
-      m_trt_ec_hist->residualR_mu[endcap]->Fill(m_mu, residualR, hweight);
-      m_trt_ec_hist->pullR_mu[endcap]->Fill(m_mu, pullR, hweight);
-      if (!isTubeHit) m_trt_ec_hist->pullR_notube_mu[endcap]->Fill(m_mu, pullR, hweight);
-    }
-
-    if (LRcorrect && !isTubeHit) m_trt_ec_hist->lr[endcap]->Fill(0.5, hweight);
-    if (LRcorrect && isTubeHit) m_trt_ec_hist->lr[endcap]->Fill(1.5, hweight);
-    if (!LRcorrect && !isTubeHit) m_trt_ec_hist->lr[endcap]->Fill(2.5, hweight);
-    if (!LRcorrect && isTubeHit) m_trt_ec_hist->lr[endcap]->Fill(3.5, hweight);
-
-    for (int phi = 0; phi < 32; ++phi) {
-      if (phi_module == phi) {
-        m_trt_ec_hist->aveResVsPhiSec[endcap]->Fill(phi, residualR, hweight);
-        m_trt_ec_hist->lrVsPhiSec[endcap]->Fill(phi, LRcorrect, hweight);
-      }
-    }
-
-
-    // fill TH3F of ave residual vs phi & wheel
-    if (m_extendedPlots) {
-      float theWheel = static_cast<float>(getRing(layer_or_wheel, straw_layer));
-      float thePhiMod = static_cast<float>(phi_module);
-
-      m_trt_ec_hist->resVsPhiWheel[endcap]->Fill(theWheel, thePhiMod, residualR, hweight);
-
-      // fill TH3F of ave residual vs wheel & radius vs charge & LOW PT ONLY
-      ATH_MSG_DEBUG("Going to fill m_trt_ec_hist->resVsRadiusWheelPos[" << endcap << "] for pt: " << trkpt << "  hitGlobalR= " << hitGlobalR);
-      if (fabs(trkpt) < m_maxPtEC) {
-        int charge = (trkpt > 0 ? 1 : -1);
-        if (hitGlobalR != -9999) {
-          if (charge > 0) {
-            m_trt_ec_hist->resVsPhiWheelPos[endcap]->Fill(theWheel, thePhiMod, residualR, hweight);
-            m_trt_ec_hist->resVsRadiusWheelPos[endcap]->Fill(theWheel, hitGlobalR, residualR, hweight);
-          } else {
-            m_trt_ec_hist->resVsPhiWheelNeg[endcap]->Fill(theWheel, thePhiMod, residualR, hweight);
-            m_trt_ec_hist->resVsRadiusWheelNeg[endcap]->Fill(theWheel, hitGlobalR, residualR, hweight);
-          }
-        } // radius known
-        m_trt_ec_hist->resVsqPtWheel[endcap]->Fill(theWheel, trkpt, residualR, hweight);
-      }
-    }
-
-    unsigned int totalRings = (m_extendedPlots) ? 41 : 1;
-
-    for (unsigned int ring = 0; ring < totalRings - 1; ++ring) {
-      if (getRing(layer_or_wheel, straw_layer) == ring) {
-        m_trt_ec_hist->residualR[endcap][ring + 1]->Fill(residualR, hweight);
-        m_trt_ec_hist->pullR[endcap][ring + 1]->Fill(pullR, hweight);
-        if (!isTubeHit) {
-          m_trt_ec_hist->pullR_notube[endcap][ring + 1]->Fill(pullR, hweight);
-          m_trt_ec_hist->residualR_notube[endcap][ring + 1]->Fill(residualR, hweight);
-        }
-        m_trt_ec_hist->aveResVsRing[endcap]->Fill(ring, residualR, hweight);
-        m_trt_ec_hist->lrVsRing[endcap]->Fill(ring, LRcorrect, hweight);
-      }
-    }
-  }
-
-  }
-
-unsigned int IDAlignMonResiduals::getRing(unsigned int wheel, unsigned int strawlayer) {
-  if (wheel < 6) return (16 * wheel + strawlayer) / 4;
-  else return (16 * 6 + 8 * (wheel - 6) + strawlayer) / 4;
-}
-
-void IDAlignMonResiduals::MakeStaveShapeFit(float& mag, float& mag_er, float& base, float& base_er, TH1* projection) {
-  TGraphErrors* g = ConvertHistoInGraph(projection);
-  TF1 fit("fit", "[1] - ([2]*(x*x-[0]*[0]))/([0]*[0])", -m_z_fix, m_z_fix);
-
-  //fit = new TF1("fit", "[0]-[1]*(x+[2]) * (4.0*[2]*(x+[2])**2 - (x+[2])**3 - (2.0*[2])**3)", -m_z_fix, m_z_fix );
-
-  fit.FixParameter(0, m_z_fix);
-  TFitResultPtr r = g->Fit(&fit, "EX0SQ");
-  //mag       =  5.0 * fit->GetParameter(1) * (m_z_fix*m_z_fix*m_z_fix*m_z_fix);
-  //mag_er    =  5.0 * fit->GetParError(1)  * (m_z_fix*m_z_fix*m_z_fix*m_z_fix);
-
-  mag = fit.GetParameter(2);
-  mag_er = fit.GetParError(2);
-
-  base = fit.GetParameter(1);
-  base_er = fit.GetParError(1);
-
-  delete g;
-}
-
-TGraphErrors* IDAlignMonResiduals::ConvertHistoInGraph(TH1* histo) {
-  TGraphErrors* graph = new TGraphErrors();
-
-  std::vector<int> filled_bins;
-  for (int etabin = 1; etabin < 21; ++etabin) {
-    if (histo->GetBinContent(etabin) != 0.) {
-      filled_bins.push_back(etabin);
-    }
-  }
-  for (int ibin = 0; ibin < (int) filled_bins.size(); ++ibin) {
-    graph->Set(ibin + 1);
-    graph->SetPoint(ibin, m_z_axis[filled_bins.at(ibin) - 1], histo->GetBinContent(filled_bins.at(ibin)));
-    graph->SetPointError(ibin, 0, histo->GetBinError(filled_bins.at(ibin)));
-  }
-  graph->GetXaxis()->SetRangeUser(-m_z_fix, m_z_fix);
-  return graph;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
deleted file mode 100644
index 1924594f7193879c67551ad177374dbe2d5d6aeb..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
+++ /dev/null
@@ -1,910 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef IDAlignMonResiduals_H
-#define IDAlignMonResiduals_H
-
-// **********************************************************************
-// IDAlignMonResiduals.cxx
-// AUTHORS: Beate Heinemann, Tobias Golling, Ben Cooper, John Alison, Pierfrancesco Butti
-// **********************************************************************
-
-#include <vector>
-
-#include "GaudiKernel/StatusCode.h"
-
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "TrkParameters/TrackParameters.h"
-#include "TrkTrack/TrackCollection.h"
-#include "xAODEventInfo/EventInfo.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "CommissionEvent/ComTime.h"
-
-
-class TFile;
-class TH1F;
-class TH1F_LW;
-class TH2F;
-class TH3F;
-class TProfile;
-class TProfile2D;
-class TGraphErrors;
-class ITRT_CalDbTool;
-
-class AtlasDetectorID;
-class PixelID;
-class SCT_ID;
-class TRT_ID;
-
-namespace InDetAlignMon {
-  class TrackSelectionTool;
-}
-
-namespace InDetDD {
-  class PixelDetectorManager;
-  class SCT_DetectorManager;
-}
-
-namespace Trk {
-  class IUpdator;
-  class IPropagator;
-  class RIO_OnTrack;
-  class Track;
-  class TrackStateOnSurface;
-  class IResidualPullCalculator;
-}
-
-class IInDetAlignHitQualSelTool;
-
-
-
-class IDAlignMonResiduals: public ManagedMonitorToolBase
-{
-public:
-  IDAlignMonResiduals(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~IDAlignMonResiduals();
-
-  virtual StatusCode initialize() override;
-  virtual StatusCode bookHistograms() override;
-  virtual StatusCode fillHistograms() override;
-  virtual StatusCode procHistograms() override;
-
-  void MakePIXBarrelHistograms(MonGroup& al_mon);
-  void MakePIXEndCapsHistograms(MonGroup& al_mon);
-  void MakeSCTEndcapsHistograms(MonGroup& al_mon);
-  void MakeSCTBarrelHistograms(MonGroup& al_mon);
-
-  void MakeStaveShapeFit(float& mag, float& mag_er, float& base, float& base_er, TH1* projection);
-  TGraphErrors* ConvertHistoInGraph(TH1*);
-
-  void MakeTRTHistograms(MonGroup& al_mon);
-  void MakeTRTBarrelHistograms(MonGroup& al_mon);
-  void MakeTRTEndcapHistograms(MonGroup& al_mon);
-  void MakeSiliconHistograms(MonGroup&);
-  void fillTRTHistograms(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer, float perdictR, float hitR,
-                         float hitZ, float hitGlobalR, float residualR, float pullR, float LE, float EP, float t0,
-                         bool isTubeHit, float trketa, float trkpt, double hweight);
-  void fillTRTBarrelHistograms(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer, float perdictR,
-                               float hitR, float hitZ, float residualR, float pullR, bool LRcorrect, float LE, float EP,
-                               float t0, bool isTubeHit, float trketa, float trkpt, double hweight);
-  void fillTRTEndcapHistograms(int barrel_ec, int layer_or_wheel, int phi_module, int straw_layer, float perdictR,
-                               float hitR, float hitGlobalR, float residualR, float pullR, bool LRcorrect, float LE,
-                               float EP, float t0, bool isTubeHit, float trketa, float trkpt, double hweight);
-  static unsigned int getRing(unsigned int wheel, unsigned int strawlayer);
-
-  /** Convert from an int to a string */
-  static std::string intToString(int input);
-
-  /** Make Histograms */
-  static TH1F_LW* MakeHist(const std::string& name, const std::string& title, int nBins, float xLow, float xUp,
-                           const std::string& xAxisTitle, const std::string& yAxisTitle);
-  static TH2F* MakeHist(const std::string& name, const std::string& title, int nXBins, float xLow, float xUp,
-                        int nYBins, float yLow, float yUp, const std::string& xAxisTitle,
-                        const std::string& yAxisTitle);
-
-
-  /** Make Profiles */
-  static TProfile* MakeProfile(const std::string& name, const std::string& title, int nBins, float xLow, float xUp,
-                               float yLow, float yUp, const std::string& xAxisTitle, const std::string& yAxisTitle,
-                               bool setMinZero = true);
-
-  void RegisterHisto(MonGroup& mon, TH1* histo);
-  void RegisterHisto(MonGroup& mon, TH1F_LW* histo);
-  void RegisterHisto(MonGroup& mon, TH2* histo);
-  void RegisterHisto(MonGroup& mon, TProfile* histo);
-  void RegisterHisto(MonGroup& mon, TProfile2D* histo);
-  void RegisterHisto(MonGroup& mon, TH3* histo);
-
-  void InitializeHistograms();
-protected:
-  ToolHandle<ITRT_CalDbTool> m_trtcaldbTool;
-private:
-  StatusCode setupTools();
-
-  bool isEdge(const Trk::RIO_OnTrack*);
-
-  std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> findOverlapHit(const Trk::Track*,
-                                                                                             const Trk::RIO_OnTrack*);
-  StatusCode getSiResiduals(const Trk::Track*, const Trk::TrackStateOnSurface*, bool, double*);
-  const Trk::TrackParameters* getUnbiasedTrackParameters(const Trk::Track*, const Trk::TrackStateOnSurface*);
-  void meanRMSProjections(TH2F*, TH1F*, int);
-  void meanRMSProjection2D(TH3F*, TH2F*, int, bool);
-  static void fillRMSFromProfile(TProfile*, TProfile*);
-  void fillGaussianMeanOrWidth(TH2F*, TH1F*, float, float, int);
-  bool trackRequiresRefit(const Trk::Track*);
-
-  //================================================================
-  // Establishes a minimim window for the histograms
-  //================================================================
-  static void SetMinWindow(TProfile* hProf, float min, float max);
-  static void SetMinWindow(TH1* h1, float min, float max);
-
-  std::string m_stream {};
-  SG::ReadHandleKey<TrackCollection> m_tracksName {
-    this, "tracksName", "CombinedInDetTracks"
-  };
-  std::string m_triggerChainName {};
-  std::string m_Pixel_Manager {};
-  std::string m_SCT_Manager {};
-  std::string m_TRT_Manager {};
-
-  //Layer/Disk/Ring Gap for modified module histograms
-  int m_gap_pix {};
-  int m_gap_sct {};
-
-  float m_minTRTResWindow {};
-  float m_maxTRTResWindow {};
-  float m_minSiResFillRange {};
-  float m_maxSiResFillRange {};
-  float m_maxSCTResFillRange {};
-  float m_minSCTResFillRange {};
-  float m_maxPIXResXFillRange {};
-  float m_minPIXResXFillRange {};
-  float m_maxPIXResYFillRange {};
-  float m_minPIXResYFillRange {};
-  float m_RangeOfPullHistos {};
-  float m_PtRange {};
-  float m_xHitErrorRange {};
-  float m_yHitErrorRange {};
-  float m_ClusterSizeRange {};
-  float m_PixelBarrelXSize {};
-  float m_PixelBarrelYSize {};
-  float m_SCTBarrelXSize {};
-  float m_SCTBarrelYSize {};
-  float m_IncidentThetaRange {};
-  float m_IncidentPhiRange {};
-  int m_nBinsPtRange {};
-  int m_histosBooked {};
-  int m_checkrate {};
-  unsigned int m_events {};
-  int m_mapSplit {};
-  int m_NPixLayers {};
-  bool m_doPulls {};
-  bool m_doHitQuality {};
-  bool m_do3DOverlapHistos {};
-  bool m_doClusterSizeHistos {};
-  bool m_extendedPlots {};
-  bool m_changedlumiblock {};
-  int m_oldlumiblock {};
-  float m_FinerBinningFactor {};
-  std::vector<TString> m_siliconBarrelLayersLabels;
-  std::vector<TString> m_siliconEndcapLayersLabels;
-  bool m_useGausFit {};
-  float m_maxPtEC {}; // threshold for low-pt EC distributions
-  int m_TRTB_nSectorBins {};
-  int m_TRTEC_nSectorBins {};
-
-  //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 {};
-  const TRT_ID* m_trtID {};
-  ToolHandle<Trk::IUpdator>             m_iUpdator;
-  ToolHandle<Trk::IPropagator>          m_propagator;
-
-  ToolHandle<InDetAlignMon::TrackSelectionTool>  m_trackSelection;
-  ToolHandle<Trk::IResidualPullCalculator>    m_residualPullCalculator;   //!< The residual and pull calculator tool
-                                                                          // handle
-  ToolHandle<IInDetAlignHitQualSelTool>  m_hitQualityTool;
-
-  //histograms
-
-  TH1F* m_totalEvents {};
-  TH1F* m_hTotalTracks {};
-  TH1F* m_sirescalcfailure {};
-  std::vector<TH3F*> m_sct_b_Oxresxvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_b_Oyresxvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_b_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_b_s0_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_b_s1_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_eca_s0_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_eca_s1_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_ecc_s0_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_ecc_s1_xresvsmodetaphi_3ds;
-  std::vector<TH1F*> m_sct_b_residualsx;
-  //TH1F* m_sct_b0_residualy;
-  std::vector<TH1F*> m_sct_b_pullsx;
-  std::vector<TH1F*> m_sct_b_xoverlapresidualsx;
-  std::vector<TH1F*> m_sct_b_yoverlapresidualsx;
-  std::vector<TProfile*> m_sct_eca_xresvsmodphi_disks;
-  std::vector<TProfile*> m_sct_ecc_xresvsmodphi_disks;
-
-  std::vector<TProfile*> m_sct_eca_biased_xresvsmodphi_disks;
-  std::vector<TProfile*> m_sct_ecc_biased_xresvsmodphi_disks;
-  std::vector<TH3F*> m_sct_b_s0_biased_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_b_s1_biased_xresvsmodetaphi_3ds;
-
-  std::vector<TH3F*> m_sct_eca_s0_biased_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_ecc_s0_biased_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_eca_s1_biased_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_ecc_s1_biased_xresvsmodetaphi_3ds;
-
-  std::vector<TH3F*> m_sct_b_clustersizePhivsmodetaphi_3ds_s0;
-  std::vector<TH3F*> m_sct_b_clustersizePhivsmodetaphi_3ds_s1;
-
-  std::vector<TH3F*> m_sct_eca_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_sct_ecc_xresvsmodetaphi_3ds;
-
-  std::vector<TH1F*> m_sct_b_biased_residualsx;
-  std::vector<TH2F*> m_sct_b_biased_residualsx_pt;
-  std::vector<TH2F*> m_sct_b_residualsx_pt;
-  std::vector<TH2F*> m_sct_b_biased_residualsx_qoverp2;
-  std::vector<TH2F*> m_sct_b_residualsx_qoverp2;
-  std::vector<TH1F*> m_sct_b_biased_pullsx;
-  std::vector<TH1F*> m_sct_eca_biased_residualsx;
-  std::vector<TH1F*> m_sct_ecc_biased_residualsx;
-  std::vector<TH2F*> m_sct_eca_biased_residualsx_pt;
-  std::vector<TH2F*> m_sct_ecc_biased_residualsx_pt;
-  std::vector<TH2F*> m_pix_b_pullsx_pt;
-  std::vector<TH2F*> m_pix_b_pullsy_pt;
-  std::vector<TH2F*> m_pix_b_residualsx_incitheta;
-  std::vector<TH2F*> m_pix_b_residualsx_inciphi;
-  std::vector<TH2F*> m_pix_b_residualsy_incitheta;
-  std::vector<TH2F*> m_pix_b_residualsy_inciphi;
-
-  //Pix Eca unbiased residuals maps
-
-  TH3F* m_pix_eca_xresvsmodphidisk_3d {};
-  TH3F* m_pix_ecc_xresvsmodphidisk_3d {};
-  TH3F* m_pix_eca_yresvsmodphidisk_3d {};
-  TH3F* m_pix_ecc_yresvsmodphidisk_3d {};
-
-
-  //PixCluster Size
-  std::vector<TH1F*> m_pix_b_clustersize;
-  std::vector<TH1F*> m_pix_eca_clustersize;
-  std::vector<TH1F*> m_pix_ecc_clustersize;
-
-  std::vector<TH1F*> m_pix_b_clustersizePhi;
-  std::vector<TH1F*> m_pix_b_clustersizeZ;
-  std::vector<TH1F*> m_pix_eca_clustersizePhi;
-  std::vector<TH1F*> m_pix_eca_clustersizeZ;
-  std::vector<TH1F*> m_pix_ecc_clustersizePhi;
-  std::vector<TH1F*> m_pix_ecc_clustersizeZ;
-
-  std::vector<TH2F*> m_pix_b_residualsx_clustersize;
-  std::vector<TH2F*> m_pix_b_residualsy_clustersize;
-  std::vector<TH2F*> m_pix_b_residualsx_clustersizePhi;
-  std::vector<TH2F*> m_pix_b_residualsy_clustersizePhi;
-  std::vector<TH2F*> m_pix_b_residualsx_clustersizeZ;
-  std::vector<TH2F*> m_pix_b_residualsy_clustersizeZ;
-
-  std::vector<TProfile*> m_pix_b_residualsx_clustersizeP;
-  std::vector<TProfile*> m_pix_b_residualsy_clustersizeP;
-  std::vector<TProfile*> m_pix_b_residualsx_clustersizePhiP;
-  std::vector<TProfile*> m_pix_b_residualsy_clustersizePhiP;
-  std::vector<TProfile*> m_pix_b_residualsx_clustersizeZP;
-  std::vector<TProfile*> m_pix_b_residualsy_clustersizeZP;
-
-  std::vector<TH2F*> m_pix_eca_residualsx_clustersize;
-  std::vector<TH2F*> m_pix_eca_residualsy_clustersize;
-  std::vector<TH2F*> m_pix_eca_residualsx_clustersizePhi;
-  std::vector<TH2F*> m_pix_eca_residualsy_clustersizePhi;
-  std::vector<TH2F*> m_pix_eca_residualsx_clustersizeZ;
-  std::vector<TH2F*> m_pix_eca_residualsy_clustersizeZ;
-
-  std::vector<TH2F*> m_pix_ecc_residualsx_clustersize;
-  std::vector<TH2F*> m_pix_ecc_residualsy_clustersize;
-  std::vector<TH2F*> m_pix_ecc_residualsx_clustersizePhi;
-  std::vector<TH2F*> m_pix_ecc_residualsy_clustersizePhi;
-  std::vector<TH2F*> m_pix_ecc_residualsx_clustersizeZ;
-  std::vector<TH2F*> m_pix_ecc_residualsy_clustersizeZ;
-
-  std::vector<TProfile*> m_pix_eca_residualsx_clustersizeP;
-  std::vector<TProfile*> m_pix_eca_residualsy_clustersizeP;
-  std::vector<TProfile*> m_pix_eca_residualsx_clustersizePhiP;
-  std::vector<TProfile*> m_pix_eca_residualsy_clustersizePhiP;
-  std::vector<TProfile*> m_pix_eca_residualsx_clustersizeZP;
-  std::vector<TProfile*> m_pix_eca_residualsy_clustersizeZP;
-
-  std::vector<TProfile*> m_pix_ecc_residualsx_clustersizeP;
-  std::vector<TProfile*> m_pix_ecc_residualsy_clustersizeP;
-  std::vector<TProfile*> m_pix_ecc_residualsx_clustersizePhiP;
-  std::vector<TProfile*> m_pix_ecc_residualsy_clustersizePhiP;
-  std::vector<TProfile*> m_pix_ecc_residualsx_clustersizeZP;
-  std::vector<TProfile*> m_pix_ecc_residualsy_clustersizeZP;
-
-
-  //DBM plots
-
-  std::vector<TH1F*> m_dbm_residualsx;
-  std::vector<TH1F*> m_dbm_pullsx;
-  std::vector<TH2F*> m_dbm_residualsx_incitheta;
-  std::vector<TH2F*> m_dbm_residualsx_inciphi;
-  std::vector<TH2F*> m_dbm_residualsx_pt;
-  std::vector<TH2F*> m_dbm_residualsx_qoverp2;
-  std::vector<TH1F*> m_dbm_biased_residualsx;
-  std::vector<TH2F*> m_dbm_biased_residualsx_pt;
-  std::vector<TH2F*> m_dbm_biased_residualsx_qoverp2;
-  std::vector<TH2F*> m_dbm_pullsx_pt;
-  std::vector<TH1F*> m_dbm_xoverlapresidualsx;
-
-  TH2F* m_dbm_xresvsmodphi_2d {};
-
-  //SctCluster Size
-
-  std::vector<TH1F*> m_sct_b_clustersizePhi;
-  std::vector<TH1F*> m_sct_eca_clustersizePhi;
-  std::vector<TH1F*> m_sct_ecc_clustersizePhi;
-
-  std::vector<TH2F*> m_sct_b_residualsx_clustersizePhi;
-  std::vector<TH2F*> m_sct_eca_residualsx_clustersizePhi;
-  std::vector<TH2F*> m_sct_ecc_residualsx_clustersizePhi;
-
-
-
-  std::vector<TProfile*> m_sct_b_residualsx_clustersizePhiP;
-  std::vector<TProfile*> m_sct_eca_residualsx_clustersizePhiP;
-  std::vector<TProfile*> m_sct_ecc_residualsx_clustersizePhiP;
-
-
-
-
-
-
-  //Cluster Size vs Incident Angle
-
-  std::vector<TProfile*> m_pix_b_clustersizePhi_incidentAngle;
-  std::vector<TProfile*> m_pix_b_clustersizeZ_incidentAngle;
-  std::vector<TProfile*> m_pix_b_clustersize_incidentAngle;
-
-  std::vector<TProfile*> m_pix_eca_clustersizePhi_incidentAngle;
-  std::vector<TProfile*> m_pix_eca_clustersizeZ_incidentAngle;
-  std::vector<TProfile*> m_pix_eca_clustersize_incidentAngle;
-
-  std::vector<TProfile*> m_pix_ecc_clustersizePhi_incidentAngle;
-  std::vector<TProfile*> m_pix_ecc_clustersizeZ_incidentAngle;
-  std::vector<TProfile*> m_pix_ecc_clustersize_incidentAngle;
-
-  std::vector<TProfile*> m_sct_b_clustersizePhi_incidentAngle;
-  std::vector<TProfile*> m_sct_eca_clustersizePhi_incidentAngle;
-  std::vector<TProfile*> m_sct_ecc_clustersizePhi_incidentAngle;
-
-  std::vector<TH2F*> m_sct_b_residualsx_incidentAnglePhi_s0;
-  std::vector<TH2F*> m_sct_eca_residualsx_incidentAnglePhi_s0;
-  std::vector<TH2F*> m_sct_ecc_residualsx_incidentAnglePhi_s0;
-
-  std::vector<TH2F*> m_sct_b_residualsx_incidentAnglePhi_s1;
-  std::vector<TH2F*> m_sct_eca_residualsx_incidentAnglePhi_s1;
-  std::vector<TH2F*> m_sct_ecc_residualsx_incidentAnglePhi_s1;
-
-  std::vector<TH2F*> m_sct_b_residualsx_incidentAngle_s0;
-  std::vector<TH2F*> m_sct_eca_residualsx_incidentAngle_s0;
-  std::vector<TH2F*> m_sct_ecc_residualsx_incidentAngle_s0;
-
-  std::vector<TH2F*> m_sct_b_residualsx_incidentAngle_s1;
-  std::vector<TH2F*> m_sct_eca_residualsx_incidentAngle_s1;
-  std::vector<TH2F*> m_sct_ecc_residualsx_incidentAngle_s1;
-
-  std::vector<TProfile*> m_pix_b_clustersizePhi_incidentAnglePhi;
-  std::vector<TProfile*> m_pix_b_clustersizeZ_incidentAnglePhi;
-  std::vector<TProfile*> m_pix_b_clustersize_incidentAnglePhi;
-
-  std::vector<TProfile*> m_pix_eca_clustersizePhi_incidentAnglePhi;
-  std::vector<TProfile*> m_pix_eca_clustersizeZ_incidentAnglePhi;
-  std::vector<TProfile*> m_pix_eca_clustersize_incidentAnglePhi;
-
-  std::vector<TProfile*> m_pix_ecc_clustersizePhi_incidentAnglePhi;
-  std::vector<TProfile*> m_pix_ecc_clustersizeZ_incidentAnglePhi;
-  std::vector<TProfile*> m_pix_ecc_clustersize_incidentAnglePhi;
-
-  std::vector<TProfile*> m_sct_b_clustersizePhi_incidentAnglePhi;
-  std::vector<TProfile*> m_sct_eca_clustersizePhi_incidentAnglePhi;
-  std::vector<TProfile*> m_sct_ecc_clustersizePhi_incidentAnglePhi;
-
-
-
-
-  TH1F* m_mu_perEvent {};
-  float m_mu {};
-  bool m_hasBeenCalledThisEvent {};
-  int m_nBinsMuRange {};
-  float m_muRangeMin {};
-  float m_muRangeMax {};
-  int m_nBinsLB {};
-  float m_LBRangeMin {};
-  float m_LBRangeMax {};
-  int m_nIBLHitsPerLB {};
-
-
-  int m_lumiblock {};
-
-  TProfile2D* m_pix_b0_resXvsetaLumiBlock {};
-  TProfile2D* m_pix_b0_resXvsetaLumiBlock_planars {};
-
-  TH3F* m_pix_b0_resXvsetaLumiBlock_3d {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_planars_3d {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave0 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave1 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave2 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave3 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave4 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave5 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave6 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave7 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave8 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave9 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave10 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave11 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave12 {};
-  TH3F* m_pix_b0_resXvsetaLumiBlock_stave13 {};
-
-  //IBL fit magnitude and baseline as a function of LumiBlock
-
-  TH1F* m_mag_vs_LB {};
-  TH1F* m_base_vs_LB {};
-
-  TH1F* m_mag_vs_LB_planars {};
-  TH1F* m_base_vs_LB_planars {};
-
-
-
-
-  // SCT
-  TH2F* m_sct_b_pullx_pt {};
-  std::vector<TH2F*> m_sct_b_pullsx_pt;
-
-  TH2F* m_sct_eca_pullx_pt {};
-  TH2F* m_sct_ecc_pullx_pt {};
-
-
-  std::vector<TH2F*> m_sct_eca_pullsx_pt;
-  std::vector<TH2F*> m_sct_ecc_pullsx_pt;
-
-
-  std::vector<TH2F*> m_sct_eca_residualsx_pt;
-  std::vector<TH2F*> m_sct_ecc_residualsx_pt;
-
-  std::vector<TH2F*> m_sct_eca_biased_residualsx_qoverp2;
-  std::vector<TH2F*> m_sct_ecc_biased_residualsx_qoverp2;
-
-  std::vector<TH2F*> m_sct_eca_residualsx_qoverp2;
-  std::vector<TH2F*> m_sct_ecc_residualsx_qoverp2;
-
-  TH3F* m_sct_b0_xresvsmodetaphi_3d {};
-  TH3F* m_sct_b1_xresvsmodetaphi_3d {};
-  TH3F* m_sct_b2_xresvsmodetaphi_3d {};
-  TH3F* m_sct_b3_xresvsmodetaphi_3d {};
-
-  TH1F* m_si_residualx {};
-  TH1F* m_si_b_residualx {};
-
-  TH1F* m_si_barrel_resX_mean {};
-  TH1F* m_si_eca_resX_mean {};
-  TH1F* m_si_ecc_resX_mean {};
-  TH1F* m_si_barrel_resY_mean {};
-  TH1F* m_si_eca_resY_mean {};
-  TH1F* m_si_ecc_resY_mean {};
-
-  TProfile* m_si_barrel_resX_mean_profile {};
-  TProfile* m_si_barrel_resY_mean_profile {};
-
-
-  TH1F* m_si_barrel_resX_rms {};
-  TH1F* m_si_eca_resX_rms {};
-  TH1F* m_si_ecc_resX_rms {};
-  TH1F* m_si_barrel_resY_rms {};
-  TH1F* m_si_eca_resY_rms {};
-  TH1F* m_si_ecc_resY_rms {};
-
-  TH2F* m_si_barrel_pullX {};
-  TH2F* m_si_eca_pullX {};
-  TH2F* m_si_ecc_pullX {};
-  TH2F* m_si_barrel_pullY {};
-  TH2F* m_si_eca_pullY {};
-  TH2F* m_si_ecc_pullY {};
-
-  TH2F* m_si_barrel_resX {};
-  TH2F* m_si_eca_resX {};
-  TH2F* m_si_ecc_resX {};
-  TH2F* m_si_barrel_resY {};
-  TH2F* m_si_eca_resY {};
-  TH2F* m_si_ecc_resY {};
-
-  TH1F* m_si_barrel_pullX_width {};
-  TH1F* m_si_eca_pullX_width {};
-  TH1F* m_si_ecc_pullX_width {};
-  TH1F* m_si_barrel_pullY_width {};
-  TH1F* m_si_eca_pullY_width {};
-  TH1F* m_si_ecc_pullY_width {};
-
-  TH1F* m_si_barrel_pullX_mean {};
-  TH1F* m_si_eca_pullX_mean {};
-  TH1F* m_si_ecc_pullX_mean {};
-  TH1F* m_si_barrel_pullY_mean {};
-  TH1F* m_si_eca_pullY_mean {};
-  TH1F* m_si_ecc_pullY_mean {};
-
-
-  //Pixel Histograms
-  std::vector<TH1F*> m_pix_b_residualsx;
-  std::vector<TH1F*> m_pix_b_residualsy;
-  std::vector<TH1F*> m_pix_b_pullsx;
-  std::vector<TH1F*> m_pix_b_pullsy;
-  std::vector<TH3F*> m_pix_b_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_pix_b_yresvsmodetaphi_3ds;
-  // -replaced by detailed std::vector<TH3F*> m_pix_b_biased_xresvsmodetaphi_3ds;
-  // std::vector<TH3F*> m_pix_b_biased_yresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_pix_b_detailed_xresvsmodetaphi_3ds;
-  std::vector<TH3F*> m_pix_b_detailed_yresvsmodetaphi_3ds;
-  std::vector<TH1F*> m_pix_b_top_residualsx;
-  std::vector<TH1F*> m_pix_b_top_residualsy;
-  std::vector<TH1F*> m_pix_b_btm_residualsx;
-  std::vector<TH1F*> m_pix_b_btm_residualsy;
-
-  std::vector<TH3F*> m_pix_b_Oxresxvsmodetaphi_3ds;
-  std::vector<TH3F*> m_pix_b_Oxresyvsmodetaphi_3ds;
-  std::vector<TH3F*> m_pix_b_Oyresxvsmodetaphi_3ds;
-  std::vector<TH3F*> m_pix_b_Oyresyvsmodetaphi_3ds;
-
-  std::vector<TH1F*> m_pix_b_xoverlapresidualsx;
-  std::vector<TH1F*> m_pix_b_xoverlapresidualsy;
-  std::vector<TH1F*> m_pix_b_yoverlapresidualsx;
-  std::vector<TH1F*> m_pix_b_yoverlapresidualsy;
-  std::vector<TH1F*> m_pix_b_biased_residualsx;
-  std::vector<TH1F*> m_pix_b_biased_residualsy;
-  // Pixel biased residuals vs pt
-  std::vector<TH2F*> m_pix_b_biased_residualsx_pt;
-  std::vector<TH2F*> m_pix_b_biased_residualsy_pt;
-  std::vector< TH2F*> m_pix_b_residualsx_pt;
-  std::vector<TH2F*> m_pix_b_residualsy_pt;
-  std::vector<TH2F*> m_pix_b_residualsx_qoverp2;
-  std::vector<TH2F*> m_pix_b_residualsy_qoverp2;
-  std::vector<TH2F*> m_pix_b_biased_residualsx_qoverp2;
-  std::vector<TH2F*> m_pix_b_biased_residualsy_qoverp2;
-  // Pixel halfshell residuals
-  std::vector<TH1F*> m_pix_b_top_biased_residualsx;
-  std::vector<TH1F*> m_pix_b_top_biased_residualsy;
-  std::vector<TH1F*> m_pix_b_btm_biased_residualsx;
-  std::vector<TH1F*> m_pix_b_btm_biased_residualsy;
-
-
-
-
-  //Pixel Histograms
-  TH1F* m_pix_b_residualx {};
-  TH1F* m_pix_b_residualy {};
-  TH1F* m_pix_b_residualx_fine {};
-  TH1F* m_pix_b_residualy_fine {};
-  TH1F* m_pix_b_biased_residualx {};
-  TH1F* m_pix_b_biased_residualy {};
-  TH1F* m_pix_eca_residualx {};
-  TH1F* m_pix_eca_residualy {};
-  TH1F* m_pix_ecc_residualx {};
-  TH1F* m_pix_ecc_residualy {};
-  TH1F* m_pix_eca_residualx_fine {};
-  TH1F* m_pix_eca_residualy_fine {};
-  TH1F* m_pix_ecc_residualx_fine {};
-  TH1F* m_pix_ecc_residualy_fine {};
-
-  TH1F* m_pix_eca_pullx {};
-  TH1F* m_pix_eca_pully {};
-  TH1F* m_pix_ecc_pullx {};
-  TH1F* m_pix_ecc_pully {};
-
-
-
-
-
-
-  TProfile* m_pix_bec_Oxresx_mean {};
-  TProfile* m_pix_bec_Oyresx_mean {};
-  TProfile* m_pix_bec_Oxresy_mean {};
-  TProfile* m_pix_bec_Oyresy_mean {};
-  TProfile* m_pix_bec_Oxresx_rms {};
-  TProfile* m_pix_bec_Oyresx_rms {};
-  TProfile* m_pix_bec_Oxresy_rms {};
-  TProfile* m_pix_bec_Oyresy_rms {};
-
-  TH1F* m_pix_b_xresvsmodeta {};
-  TH1F* m_pix_b_xresvsmodphi {};
-  TH1F* m_pix_b_yresvsmodeta {};
-  TH1F* m_pix_b_yresvsmodphi {};
-  TH1F* m_pix_eca_xresvsmodphi {};
-  TH1F* m_pix_ecc_xresvsmodphi {};
-  TH1F* m_pix_eca_yresvsmodphi {};
-  TH1F* m_pix_ecc_yresvsmodphi {};
-
-
-
-
-
-  TH2F* m_pix_b_biased_residualx_pt {};
-  TH2F* m_pix_b_biased_residualy_pt {};
-  TH1F* m_pix_eca_biased_residualx {};
-  TH1F* m_pix_eca_biased_residualy {};
-  TH2F* m_pix_eca_biased_residualx_pt {};
-  TH2F* m_pix_eca_biased_residualy_pt {};
-  TH1F* m_pix_ecc_biased_residualx {};
-  TH1F* m_pix_ecc_biased_residualy {};
-  TH2F* m_pix_ecc_biased_residualx_pt {};
-  TH2F* m_pix_ecc_biased_residualy_pt {};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  TH2F* m_pix_eca_xresvsmodphi_2d {};
-  TH2F* m_pix_ecc_xresvsmodphi_2d {};
-  TH2F* m_pix_eca_yresvsmodphi_2d {};
-  TH2F* m_pix_ecc_yresvsmodphi_2d {};
-
-  TProfile* m_pix_b_Oxresxvsmodeta {};
-  TProfile* m_pix_b_Oxresxvsmodphi {};
-  TProfile* m_pix_b_Oyresyvsmodeta {};
-  TProfile* m_pix_b_Oyresyvsmodphi {};
-  TProfile* m_pix_eca_Oxresxvsmodphi {};
-  TProfile* m_pix_ecc_Oxresxvsmodphi {};
-  TProfile* m_pix_eca_Oyresyvsmodphi {};
-  TProfile* m_pix_ecc_Oyresyvsmodphi {};
-
-  std::vector<TProfile*> m_pix_eca_unbiased_xresvsmodphi_disks;
-  std::vector<TProfile*> m_pix_eca_unbiased_yresvsmodphi_disks;
-  std::vector<TProfile*> m_pix_ecc_unbiased_xresvsmodphi_disks;
-  std::vector<TProfile*> m_pix_ecc_unbiased_yresvsmodphi_disks;
-  TProfile* m_pix_eca_unbiased_xresvsmodphi {};
-  TProfile* m_pix_eca_unbiased_yresvsmodphi {};
-  TProfile* m_pix_ecc_unbiased_xresvsmodphi {};
-  TProfile* m_pix_ecc_unbiased_yresvsmodphi {};
-
-  std::vector<TH1F*> m_pix_b_biasedresidualsx;
-  std::vector<TH1F*> m_pix_b_biasedresidualsy;
-  std::vector<TH1F*> m_pix_eca_biased_residualsx;
-  std::vector<TH1F*> m_pix_eca_biased_residualsy;
-  std::vector<TH1F*> m_pix_ecc_biased_residualsx;
-  std::vector<TH1F*> m_pix_ecc_biased_residualsy;
-
-
-
-  std::vector<TH2F*> m_pix_eca_residualsx_pt;
-  std::vector<TH2F*> m_pix_eca_residualsy_pt;
-  std::vector<TH2F*> m_pix_ecc_residualsx_pt;
-  std::vector<TH2F*> m_pix_ecc_residualsy_pt;
-  std::vector<TH2F*> m_pix_eca_biased_residualsx_pt;
-  std::vector<TH2F*> m_pix_eca_biased_residualsy_pt;
-  std::vector<TH2F*> m_pix_ecc_biased_residualsx_pt;
-  std::vector<TH2F*> m_pix_ecc_biased_residualsy_pt;
-  std::vector<TH2F*> m_pix_eca_pullsx_pt;
-  std::vector<TH2F*> m_pix_eca_pullsy_pt;
-  std::vector<TH2F*> m_pix_ecc_pullsx_pt;
-  std::vector<TH2F*> m_pix_ecc_pullsy_pt;
-
-  std::vector<TH2F*> m_pix_eca_residualsx_qoverp2;
-  std::vector<TH2F*> m_pix_eca_residualsy_qoverp2;
-  std::vector<TH2F*> m_pix_eca_biased_residualsx_qoverp2;
-  std::vector<TH2F*> m_pix_eca_biased_residualsy_qoverp2;
-  std::vector<TH2F*> m_pix_ecc_residualsx_qoverp2;
-  std::vector<TH2F*> m_pix_ecc_residualsy_qoverp2;
-  std::vector<TH2F*> m_pix_ecc_biased_residualsx_qoverp2;
-  std::vector<TH2F*> m_pix_ecc_biased_residualsy_qoverp2;
-  std::vector<TH2F*> m_pix_eca_biased_xresvsmodphi_2ds;
-  std::vector<TH2F*> m_pix_eca_biased_yresvsmodphi_2ds;
-  std::vector<TH2F*> m_pix_ecc_biased_xresvsmodphi_2ds;
-  std::vector<TH2F*> m_pix_ecc_biased_yresvsmodphi_2ds;
-
-  //SCT histograms
-  TH1F* m_sct_b_residualx {};
-  TH1F* m_sct_b_residualx_fine {};
-  TH1F* m_sct_b_biasedresidualx {};
-  TH1F* m_sct_eca_residualx {};
-  TH1F* m_sct_ecc_residualx {};
-  TH1F* m_sct_eca_residualx_fine {};
-  TH1F* m_sct_ecc_residualx_fine {};
-
-
-
-  TH1F* m_sct_eca_pullx {};
-  TH1F* m_sct_ecc_pullx {};
-
-
-  TProfile* m_sct_bec_Oxresx_mean {};
-  TProfile* m_sct_bec_Oyresx_mean {};
-  TProfile* m_sct_bec_Oxresx_rms {};
-  TProfile* m_sct_bec_Oyresx_rms {};
-
-  TH2F* m_sct_eca_xresvsmodphi_2d {};
-  TH2F* m_sct_ecc_xresvsmodphi_2d {};
-
-  TH1F* m_sct_b_xresvsmodeta {};
-  TH1F* m_sct_b_xresvsmodphi {};
-  TH1F* m_sct_eca_xresvsmodphi {};
-  TH1F* m_sct_ecc_xresvsmodphi {};
-
-  TProfile* m_sct_b_Oxresxvsmodeta {};
-  TProfile* m_sct_b_Oxresxvsmodphi {};
-  TProfile* m_sct_b_Oyresxvsmodeta {};
-  TProfile* m_sct_b_Oyresxvsmodphi {};
-  TProfile* m_sct_eca_Oxresxvsmodphi {};
-  TProfile* m_sct_ecc_Oxresxvsmodphi {};
-
-
-
-  // Extended histograms
-
-
-
-  // Pixel unbiased residuals vs pt
-  TH2F* m_pix_b_residualx_pt {};
-  TH2F* m_pix_b_residualy_pt {};
-  TH2F* m_pix_eca_residualx_pt {};
-  TH2F* m_pix_eca_residualy_pt {};
-  TH2F* m_pix_ecc_residualx_pt {};
-  TH2F* m_pix_ecc_residualy_pt {};
-
-
-
-
-  TH1F* m_sct_b_biased_residualx {};
-
-  TH2F* m_sct_b_biased_residualx_pt {};
-
-
-  TH2F* m_sct_b_residualx_pt {};
-
-
-  TH2F* m_sct_b_biased_residualx_qoverp2 {};
-
-
-  TH2F* m_sct_b_unbiased_residualx_qoverp2 {};
-
-
-
-  TH1F* m_sct_eca_biased_residualx {};
-  TH1F* m_sct_eca_biased_residualy {};
-  TH1F* m_sct_ecc_biased_residualx {};
-  TH1F* m_sct_ecc_biased_residualy {};
-
-  TH2F* m_sct_eca_biased_residualx_pt {};
-  TH2F* m_sct_ecc_biased_residualx_pt {};
-
-  TH2F* m_sct_eca_residualx_pt {};
-  TH2F* m_sct_ecc_residualx_pt {};
-
-  TH2F* m_sct_eca_biased_residualx_qoverp2 {};
-  TH2F* m_sct_ecc_biased_residualx_qoverp2 {};
-
-  TH2F* m_sct_eca_unbiased_residualx_qoverp2 {};
-  TH2F* m_sct_ecc_unbiased_residualx_qoverp2 {};
-
-
-
-
-
-  // Local positions (extrapolated)
-  TH1F* m_pix_b_extrapolated_localx {};
-  TH1F* m_pix_b_extrapolated_localy {};
-  TH1F* m_sct_b_extrapolated_st_localx {};
-  TH1F* m_sct_b_extrapolated_st_localy {};
-  TH1F* m_sct_b_extrapolated_nst_localx {};
-  TH1F* m_sct_b_extrapolated_nst_localy {};
-
-  // Local positions (mesasured)
-  TH1F* m_pix_b_measured_localx {};
-  TH1F* m_pix_b_measured_localy {};
-  TH1F* m_sct_b_measured_st_localx {};
-  TH1F* m_sct_b_measured_st_localy {};
-  TH1F* m_sct_b_measured_nst_localx {};
-  TH1F* m_sct_b_measured_nst_localy {};
-
-
-  // Hit errors
-
-  TH1F* m_hiterror_sct_b {};
-  TH1F* m_hiterror_sct_ec {};
-  TH1F* m_hiterror_sct_b_WideRange {};
-  TH1F* m_hiterror_sct_ec_WideRange {};
-
-  TH1F* m_hiterror_x_pix_b {};
-  TH1F* m_hiterror_x_pix_ec {};
-  TH1F* m_hiterror_x_pix_eca {};
-  TH1F* m_hiterror_x_pix_ecc {};
-  TH1F* m_hiterror_y_pix_b {};
-  TH1F* m_hiterror_y_pix_ec {};
-  TH1F* m_hiterror_y_pix_eca {};
-  TH1F* m_hiterror_y_pix_ecc {};
-
-  TH1F* m_hiterror_x_pix_b_WideRange {};
-  TH1F* m_hiterror_x_pix_ec_WideRange {};
-  TH1F* m_hiterror_y_pix_b_WideRange {};
-  TH1F* m_hiterror_y_pix_ec_WideRange {};
-
-  TH1F* m_hiterror_x_ibl_b {};
-  TH1F* m_hiterror_x_ibl_ec {};
-  TH1F* m_hiterror_y_ibl_b {};
-  TH1F* m_hiterror_y_ibl_ec {};
-
-  TH1F* m_hiterror_x_ibl_b_WideRange {};
-  TH1F* m_hiterror_x_ibl_ec_WideRange {};
-  TH1F* m_hiterror_y_ibl_b_WideRange {};
-  TH1F* m_hiterror_y_ibl_ec_WideRange {};
-
-  // Pulls vs pt
-  // Pixel
-
-  TH2F* m_pix_b_pullx_pt {};
-  TH2F* m_pix_b_pully_pt {};
-  TH2F* m_pix_eca_pullx_pt {};
-  TH2F* m_pix_eca_pully_pt {};
-  TH2F* m_pix_ecc_pullx_pt {};
-  TH2F* m_pix_ecc_pully_pt {};
-
-
-
-  /**====================================
-     //TRT histograms
-     //====================================*/
-
-  /* Barrel
-     //======================= */
-  struct TRTBarrelHistograms;
-  TRTBarrelHistograms* m_trt_b_hist {};
-
-  /** TRT EndCap
-     //======================= */
-  struct TRTEndcapHistograms;
-  TRTEndcapHistograms* m_trt_ec_hist {};
-
-
-  // Weight for histograms
-  bool m_applyHistWeight {};
-  std::string m_hWeightInFileName {};
-  TFile* m_hWeightInFile {};
-  TH2F* m_etapTWeight {};
-  std::string m_hWeightHistName {};
-
-  //I don't like an initialisation here.
-  float m_z_axis[20] = {
-    -322.8975, -301.7925, -280.6875, -259.5825, -228.2775, -186.7725, -145.2675, -103.7625, -62.2575, -20.7525, 20.7525,
-    62.2575, 103.7625, 145.2675, 186.7725, 228.2775, 259.5825, 280.6875, 301.7925, 322.8975
-  };
-  float m_z_fix {};
-  int m_minIBLhits {};
-  bool m_doIBLLBPlots {};
-
-  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey
-  {
-    this, "EventInfoKey", "EventInfo", ""
-  };
-  SG::ReadHandleKey<ComTime> m_comTimeObjectName {
-    this, "ComTimeObjectName", "TRT_Phase"
-  };
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx
deleted file mode 100644
index e7e796f48b67f6ec7c06ed167a71b2ffdd0901e1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// IDAlignMonSivsTRT.cxx
-// AUTHORS: Ben Cooper
-// **********************************************************************
-
-#include "IDAlignMonSivsTRT.h"
-
-#include "TH1.h"
-#include "TH2.h"
-#include "TMath.h"
-#include "TProfile.h"
-#include <cmath>
-#include <sstream>
-
-
-
-
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkEventPrimitives/LocalParameters.h"
-#include "TrkTrack/Track.h"
-
-#include "TrkTrackSummary/TrackSummary.h"
-#include "TrackSelectionTool.h"
-
-
-
-// *********************************************************************
-// Public Methods
-// *********************************************************************
-
-IDAlignMonSivsTRT::IDAlignMonSivsTRT(const std::string& type, const std::string& name, const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent) {
-
-  declareProperty("CheckRate", m_checkrate = 1000);
-  declareProperty("triggerChainName", m_triggerChainName = "NoTriggerSelection");
-  declareProperty("trackSelection", m_trackSelection = ToolHandle<InDetAlignMon::TrackSelectionTool>("InDetAlignMon::TrackSelectionTool"));
-  declareProperty("trackSumTool", m_trackSumTool = ToolHandle<Trk::ITrackSummaryTool>("Trk::TrackSummaryTool/InDetTrackSummaryTool"));
-  declareProperty("MatchdRCut", m_matchdRcut = 0.01);
-}
-
-//---------------------------------------------------------------------------------------
-
-
-IDAlignMonSivsTRT::~IDAlignMonSivsTRT() = default;
-
-
-StatusCode IDAlignMonSivsTRT::initialize() {
-  StatusCode sc;
-
-  sc = ManagedMonitorToolBase::initialize();
-  if (!sc.isSuccess()) return sc;
-
-  //initialize tools and services
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Calling initialize() to setup tools/services" << endmsg;
-  sc = setupTools();
-  if (sc.isFailure()) {
-    msg(MSG::FATAL) << "Failed to initialize tools/services!" << endmsg;
-    return StatusCode::FAILURE;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endmsg;
-
-  ATH_CHECK(m_ResolvedTracksKey.initialize());
-  ATH_CHECK(m_ExtendedTracksKey.initialize());
-
-  return sc;
-}
-
-StatusCode IDAlignMonSivsTRT::bookHistograms() {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    // book histograms that are only made in the online environment...
-  }
-
-  if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-    // book histograms that are only relevant for cosmics data...
-  }
-
-  MonGroup al_mon(this, "IDAlignMon/SivsTRT/" + m_triggerChainName, run);
-
-  //if ( newLowStatFlag() || newLumiBlockFlag() ) {  }
-
-  if (newRunFlag()) {
-    //if user environment specified we don't want to book new histograms at every run boundary
-    //we instead want one histogram per job
-    if (m_histosBooked != 0 && AthenaMonManager::environment() == AthenaMonManager::user) return StatusCode::SUCCESS;
-
-    m_nhitstrt = new TH1F("nhits_trt", "Number of TRT hits for every track in ExtendedTracks", 100, 0, 100);
-    RegisterHisto(al_mon, m_nhitstrt);
-
-    m_delta_phi0 = new TH1F("delta_phi0", "#phi_{0}^{TRT} - #phi_{0}^{Si-only}", 200, -0.1, 0.1);
-    RegisterHisto(al_mon, m_delta_phi0);
-    m_delta_eta0 = new TH1F("delta_eta0", "#eta_{0}^{TRT} - #eta_{0}^{Si-only}", 200, -0.1, 0.1);
-    RegisterHisto(al_mon, m_delta_eta0);
-    m_delta_R = new TH1F("delta_R", "deltaR(TRT-SiOnly)", 200, -0.1, 0.1);
-    RegisterHisto(al_mon, m_delta_R);
-    m_delta_qoverp = new TH1F("delta_qoverp", "Q/P^{TRT} - Q/P^{Si-only} (1/GeV)", 200, -0.01, 0.01);
-    RegisterHisto(al_mon, m_delta_qoverp);
-    m_delta_d0 = new TH1F("delta_d0", "d_{0}^{TRT} - d_{0}^{Si-only}", 500, -1.0, 1.0);
-    RegisterHisto(al_mon, m_delta_d0);
-    m_delta_z0 = new TH1F("delta_z0", "z_{0}^{TRT} - z_{0}^{Si-only}", 500, -1.0, 1.0);
-    RegisterHisto(al_mon, m_delta_z0);
-    m_delta_pt = new TH1F("delta_pt", "P_{T}^{TRT} - P_{T}^{Si-only}", 300, -30.0, 30.0);
-    RegisterHisto(al_mon, m_delta_pt);
-    m_reldelta_pt = new TH1F("reldelta_pt", "P_{T}^{TRT} - P_{T}^{Si-only}/P_{T}^{Si-only}", 500, -1.0, 1.0);
-    RegisterHisto(al_mon, m_reldelta_pt);
-    m_delta_charge = new TH1F("delta_charge", "Charge^{TRT} - Charge^{Si-only}", 5, -2.5, 2.5);
-    RegisterHisto(al_mon, m_delta_charge);
-
-    m_delta_phi0_b = new TH1F("delta_phi0_b", "#phi_{0}^{TRT} - #phi_{0}^{Si-only} |#eta|<0.8", 500, -0.1, 0.1);
-    RegisterHisto(al_mon, m_delta_phi0_b);
-    m_delta_eta0_b = new TH1F("delta_eta0_b", "#eta_{0}^{TRT} - #eta_{0}^{Si-only} |#eta|<0.8", 500, -0.1, 0.1);
-    RegisterHisto(al_mon, m_delta_eta0_b);
-    m_delta_R_b = new TH1F("delta_R_b", "deltaR(TRT-SiOnly) |#eta|<0.8", 200, -0.1, 0.1);
-    RegisterHisto(al_mon, m_delta_R_b);
-    m_delta_qoverp_b = new TH1F("delta_qoverp_b", "Q/P^{TRT} - Q/P^{Si-only} |#eta|<0.8 (1/GeV)", 500, -0.01, 0.01);
-    RegisterHisto(al_mon, m_delta_qoverp_b);
-    m_delta_d0_b = new TH1F("delta_d0_b", "d_{0}^{TRT} - d_{0}^{Si-only} |#eta|<0.8", 500, -1.0, 1.0);
-    RegisterHisto(al_mon, m_delta_d0_b);
-    m_delta_z0_b = new TH1F("delta_z0_b", "z_{0}^{TRT} - z_{0}^{Si-only} |#eta|<0.8", 500, -1.0, 1.0);
-    RegisterHisto(al_mon, m_delta_z0_b);
-    m_delta_pt_b = new TH1F("delta_pt_b", "P_{T}^{TRT} - P_{T}^{Si-only} |#eta|<0.8", 300, -30.0, 30.0);
-    RegisterHisto(al_mon, m_delta_pt_b);
-    m_reldelta_pt_b = new TH1F("reldelta_pt_b", "P_{T}^{TRT} - P_{T}^{Si-only}/P_{T}^{Si-only} |#eta|<0.8", 500, -1.0,
-                               1.0);
-    RegisterHisto(al_mon, m_reldelta_pt_b);
-    m_delta_charge_b = new TH1F("delta_charge_b", "Charge^{TRT} - Charge^{Si-only} |#eta|<0.8", 5, -2.5, 2.5);
-    RegisterHisto(al_mon, m_delta_charge_b);
-
-    //for investigation of efficiency for TRT hits and TRT-Si track matching as function of phi,eta
-
-    m_alltrks_phi0 = new TH1F("alltrks_phi0", "#phi_{0} all tracks", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_alltrks_phi0);
-    m_alltrks_phi0_b = new TH1F("alltrks_phi0_b", "#phi_{0} all tracks |#eta| < 1.0", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_alltrks_phi0_b);
-    m_alltrks_phi0_eca = new TH1F("alltrks_phi0_eca", "#phi_{0} all tracks 1.0 < #eta < 2.1", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_alltrks_phi0_eca);
-    m_alltrks_phi0_ecc = new TH1F("alltrks_phi0_ecc", "#phi_{0} all tracks -2.1 < #eta < -1.0", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_alltrks_phi0_ecc);
-    m_alltrks_eta0 = new TH1F("alltrks_eta0", "#eta_{0} all tracks", 10, -2.1, 2.1);
-    RegisterHisto(al_mon, m_alltrks_eta0);
-    m_si_phi0 = new TH1F("si_phi0", "#phi_{0} Si-only tracks with no TRT hits", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_si_phi0);
-    m_si_eta0 = new TH1F("si_eta0", "#eta_{0} Si-only tracks with no TRT hits", 10, -2.1, 2.1);
-    RegisterHisto(al_mon, m_si_eta0);
-    m_trt_phi0 = new TH1F("trt_phi0", "#phi_{0} tracks with TRT hits #eta < 2.1", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_trt_phi0);
-    m_trt_phi0_b = new TH1F("trt_phi0_b", "#phi_{0} tracks with TRT hits |#eta| < 1.0", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_trt_phi0_b);
-    m_trt_phi0_eca = new TH1F("trt_phi0_eca", "#phi_{0} tracks with TRT hits 1.0 < #eta < 2.1", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_trt_phi0_eca);
-    m_trt_phi0_ecc = new TH1F("trt_phi0_ecc", "#phi_{0} tracks with TRT hits -2.1 < #eta < -1.0", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_trt_phi0_ecc);
-    m_trt_eta0 = new TH1F("trt_eta0", "#eta_{0} tracks with TRT hits", 10, -2.1, 2.1);
-    RegisterHisto(al_mon, m_trt_eta0);
-    m_matched_phi0 = new TH1F("matched_phi0", "#phi_{0} tracks with TRT hits that match Sionly", 10, -M_PI, M_PI);
-    RegisterHisto(al_mon, m_matched_phi0);
-    m_matched_eta0 = new TH1F("matched_eta0", "#eta_{0} tracks with TRT hits that match Sionly", 10, -2.1, 2.1);
-    RegisterHisto(al_mon, m_matched_eta0);
-
-    //actual Efficiency histograms are now TProfile to enable merger of histos
-    m_sieff_eta0 = new TProfile("eff_simatch_eta0", "eff #DeltaR matching Sionly to TRT extended track vs #eta_{0}", 10,
-                                -2.1, 2.1, 0.0, 1.0);
-    RegisterHisto(al_mon, m_sieff_eta0);
-    m_sieff_phi0 = new TProfile("eff_simatch_phi0", "eff #DeltaR matching Sionly to TRT extended track vs #phi_{0}", 10,
-                                -M_PI, M_PI, 0.0, 1.0);
-    RegisterHisto(al_mon, m_sieff_phi0);
-    m_trteff_phi0 = new TProfile("eff_trthits_phi0", "eff TRT hits association vs #phi_{0}", 10, -M_PI, M_PI, 0.0, 1.0);
-    RegisterHisto(al_mon, m_trteff_phi0);
-    m_trteff_phi0_b = new TProfile("eff_trthits_phi0_b", "eff TRT hits association vs #phi_{0}, |#eta| < 1.0", 10,
-                                   -M_PI, M_PI, 0.0, 1.0);
-    RegisterHisto(al_mon, m_trteff_phi0_b);
-    m_trteff_phi0_eca = new TProfile("eff_trthits_phi0_eca", "eff TRT hits association vs #phi_{0}, 1.0 < #eta < 2.1",
-                                     10, -M_PI, M_PI, 0.0, 1.0);
-    RegisterHisto(al_mon, m_trteff_phi0_eca);
-    m_trteff_phi0_ecc = new TProfile("eff_trthits_phi0_ecc", "eff TRT hits association vs #phi_{0}, -2.1 < #eta < 1.0",
-                                     10, -M_PI, M_PI, 0.0, 1.0);
-    RegisterHisto(al_mon, m_trteff_phi0_ecc);
-    m_trteff_eta0 = new TProfile("eff_trthits_eta0", "eff TRT hits association vs #eta_{0}", 10, -2.1, 2.1, 0.0, 1.0);
-    RegisterHisto(al_mon, m_trteff_eta0);
-
-    m_histosBooked++;
-  }
-
-
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-void IDAlignMonSivsTRT::RegisterHisto(MonGroup& mon, TH1* histo) {
-  //histo->Sumw2();
-  histo->SetOption("e");
-  StatusCode sc = mon.regHist(histo);
-  if (sc.isFailure()) {
-    msg(MSG::ERROR) << "Cannot book TH1 Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonSivsTRT::RegisterHisto(MonGroup& mon, TProfile* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    msg(MSG::ERROR) << "Cannot book TProfile Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonSivsTRT::RegisterHisto(MonGroup& mon, TH2* histo) {
-  //histo->Sumw2();
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    msg(MSG::ERROR) << "Cannot book TH2 Histogram:" << endmsg;
-  }
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonSivsTRT::fillHistograms() {
-  m_events++;
-
-  //tracks that are fitted to Si hits only, before extension to TRT
-  SG::ReadHandle<TrackCollection> resolvedTracks {
-    m_ResolvedTracksKey
-  };
-  if (not resolvedTracks.isValid()) {
-    ATH_MSG_WARNING(m_ResolvedTracksKey.key() << " could not be retrieved");
-    return StatusCode::RECOVERABLE;
-  }
-  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;
-  }
-  if (msgLvl(MSG::DEBUG)) {
-    msg(MSG::DEBUG) << "Retrieved " << tracksSi->size() << " ResolvedTracks tracks from StoreGate" << endmsg;
-    if (tracksSi->empty()) msg(MSG::DEBUG) <<
-      "Histograms will not be filled because 0 tracks in ResolvedTracks (track collection probably doesn't exist)" <<
-      endmsg;
-  }
-
-  //tracks that are fitted with Si and TRT hits
-  SG::ReadHandle<TrackCollection> extendedTracks {
-    m_ExtendedTracksKey
-  };
-  if (not extendedTracks.isValid()) {
-    ATH_MSG_WARNING(m_ExtendedTracksKey.key() << " could not be retrieved");
-    return StatusCode::RECOVERABLE;
-  }
-  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;
-  }
-  if (msgLvl(MSG::DEBUG)) {
-    msg(MSG::DEBUG) << "Retrieved " << tracksTRT->size() << " ExtendedTracks tracks from StoreGate" << endmsg;
-    if (tracksTRT->empty()) msg(MSG::DEBUG) << "Histograms will not be filled because 0 tracks in ExtendedTracks (track collection probably doesn't exist)" << endmsg;
-  }
-
-  int nTracksTRT = 0;
-
-  DataVector<Trk::Track>::const_iterator trackItr = tracksTRT->begin();
-  DataVector<Trk::Track>::const_iterator trackItrE = tracksTRT->end();
-  for (; trackItr != trackItrE; ++trackItr) { //looping over extended tracks
-    const Trk::Track* trackTRT = *trackItr;
-    if (trackTRT == nullptr) {
-      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track " << nTracksTRT << endmsg;
-      continue;
-    }
-
-    std::unique_ptr<Trk::TrackSummary> summary = m_trackSumTool->summary(*trackTRT);
-    int nhpix = 0, nhsct = 0, nhtrt = 0;
-
-    if (summary) {
-      nhpix = summary->get(Trk::numberOfPixelHits);
-      nhsct = summary->get(Trk::numberOfSCTHits);
-      nhtrt = summary->get(Trk::numberOfTRTHits);
-    }
-
-
-    const Trk::Perigee* TRTPerigee = trackTRT->perigeeParameters();
-
-    if (!TRTPerigee) msg(MSG::WARNING) << "TRTPerigee is NULL. Track Information may be missing" << endmsg;
-
-
-    const AmgSymMatrix(5) * TRTPerCovariance = TRTPerigee ? TRTPerigee->covariance() : nullptr;
-
-    if (TRTPerCovariance == nullptr) msg(MSG::WARNING) << " failed dynamic_cast TRT track perigee to measured perigee, some parameters may be missing" << endmsg;
-
-    double d0 = -999;
-    double phi0 = -999;
-    double qoverp = -999;
-    double eta0 = -999;
-    double z0 = -999;
-    double charge = -999.;
-    double pt = -999;
-
-    if (TRTPerigee) {
-      d0 = TRTPerigee->parameters()[Trk::d0];
-      phi0 = TRTPerigee->parameters()[Trk::phi0];
-      qoverp = TRTPerigee->parameters()[Trk::qOverP] * 1000;
-      eta0 = TRTPerigee->eta();
-      z0 = TRTPerigee->parameters()[Trk::z0];
-      charge = TRTPerigee->charge();
-      if (TRTPerCovariance != nullptr) pt = TRTPerigee->pT() / 1000.;
-    }
-
-
-    //trackStateOnSurfaces is a vector of Trk::TrackStateOnSurface objects which contain information
-    //on track at each (inner)detector surface it crosses eg hit used to fit track
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRT Track = " << nTracksTRT << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRT Track Eta = " << eta0 << ", phi = " << phi0 << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRT Track nhitspix = " << nhpix << ", sct = " << nhsct << ", trt = " << nhtrt << endmsg;
-
-
-    m_nhitstrt->Fill(nhtrt);
-
-    //tracks with eta > 2.1 do not intersect TRT and
-    //thus aren't considered for TRT-Si matching efficiency plots
-    if (fabs(eta0) > 2.1) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ExtendedTracks track is outside eta < 2.1 - skipped" << endmsg;
-      continue;
-    }
-
-    //filling histos for tracks which may or may not have TRT hits
-    m_alltrks_phi0->Fill(phi0);
-    m_alltrks_eta0->Fill(eta0);
-    if (fabs(eta0) < 1.0) m_alltrks_phi0_b->Fill(phi0);
-    if (eta0 > 1.0) m_alltrks_phi0_eca->Fill(phi0);
-    if (eta0 < -1.0) m_alltrks_phi0_ecc->Fill(phi0);
-
-    // we only examine the delta Sionly-TRTextended track quantities for
-    // tracks in ExtendedTracks which actually have some TRT hits associated
-    // i.e. all tracks that are in ResolvedTracks are in ExtendedTracks too, most
-    // without TRT hits
-    if (nhtrt == 0) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ExtendedTracks track has zero TRT hits" << endmsg;
-      //filling histos for tracks which do not have TRT hits (fitted with Si only)
-      m_si_phi0->Fill(phi0);
-      m_si_eta0->Fill(eta0);
-      continue;
-    }
-
-    //filling histos for tracks which have TRT hits
-    m_trt_phi0->Fill(phi0);
-    m_trt_eta0->Fill(eta0);
-    if (fabs(eta0) < 1.0) m_trt_phi0_b->Fill(phi0);
-    if (eta0 > 1.0) m_trt_phi0_eca->Fill(phi0);
-    if (eta0 < -1.0) m_trt_phi0_ecc->Fill(phi0);
-
-    double mindR = 10000;
-    //double Xtheta = -999999;
-    double Xd0 = -999999;
-    double Xphi0 = -999999;
-    double Xqoverp = -999999;
-    double Xeta0 = -999999;
-    double Xz0 = -999999;
-    double Xcharge = -999999;
-    double Xpt = -999999;
-    bool matchFound = false;
-
-    int nTracksSi = 0;
-    DataVector<Trk::Track>::const_iterator trackItr2 = tracksSi->begin();
-    DataVector<Trk::Track>::const_iterator trackItrE2 = tracksSi->end();
-    for (; trackItr2 != trackItrE2; ++trackItr2) { //looping over Sionly tracks
-      const Trk::Track* trackSi = *trackItr2;
-      if (trackSi == nullptr) {
-        if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track " << nTracksSi << endmsg;
-        continue;
-      }
-
-
-      const Trk::Perigee* SiPerigee = trackSi->perigeeParameters();
-
-      if (!SiPerigee) msg(MSG::WARNING) << " SiPerigee is NULL. Track information may be missing" << endmsg;
-
-      const AmgSymMatrix(5) * SiPerCovariance = SiPerigee ? SiPerigee->covariance() : nullptr;
-
-      if (SiPerCovariance == nullptr) msg(MSG::WARNING) << " failed dynamic_cast Si track perigee to measured perigee, some parameters may be missing" << endmsg;
-
-      double Siphi0 = -9999;
-      double Sieta0 = -9999;
-      double dphi2 = -9999;
-      double deta2 = -9999;
-      double dR = -9999;
-
-
-      if (SiPerigee) {
-        Siphi0 = SiPerigee->parameters()[Trk::phi0];
-        Sieta0 = SiPerigee->eta();
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Si Track = " << nTracksSi << endmsg;
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Si Track Eta = " << Sieta0 << ", phi = " << Siphi0 << endmsg;
-        //selecting Sionly track that is closest to TRT in eta-phi
-        dphi2 = (phi0 - Siphi0) * (phi0 - Siphi0);
-        deta2 = (eta0 - Sieta0) * (eta0 - Sieta0);
-        dR = sqrt(dphi2 + deta2);
-        if (dR < mindR) {
-          mindR = dR;
-          //Xtheta = SiPerigee->parameters()[Trk::theta];
-          Xd0 = SiPerigee->parameters()[Trk::d0];
-          Xphi0 = SiPerigee->parameters()[Trk::phi0];
-          Xqoverp = SiPerigee->parameters()[Trk::qOverP] * 1000;
-          Xeta0 = SiPerigee->eta();
-          Xz0 = SiPerigee->parameters()[Trk::z0];
-          Xcharge = SiPerigee->charge();
-          //Xpt = (1/Xqoverp)*Xcharge*sin(Xtheta);
-          if (SiPerCovariance != nullptr) Xpt = SiPerigee->pT() / 1000.;
-          if (dR < m_matchdRcut) matchFound = true;
-        }
-      }
-      nTracksSi++;
-    }
-
-    //filling for closest Si-only match in dR (before dR cut)
-    m_delta_phi0->Fill(phi0 - Xphi0);
-    m_delta_eta0->Fill(eta0 - Xeta0);
-    m_delta_R->Fill(mindR);
-    if (fabs(eta0) < 0.8) {
-      m_delta_phi0_b->Fill(phi0 - Xphi0);
-      m_delta_eta0_b->Fill(eta0 - Xeta0);
-      m_delta_R_b->Fill(mindR);
-    }
-
-    //filling histos for tracks with TRT hits which also match
-    //with a silicon track in dR
-    if (matchFound) {
-      m_delta_qoverp->Fill(qoverp - Xqoverp);
-      m_delta_d0->Fill(d0 - Xd0);
-      m_delta_z0->Fill(z0 - Xz0);
-      m_delta_charge->Fill(charge - Xcharge);
-      m_delta_pt->Fill(pt - Xpt);
-      m_reldelta_pt->Fill((pt - Xpt) / Xpt);
-
-      m_matched_phi0->Fill(phi0);
-      m_matched_eta0->Fill(eta0);
-
-      if (fabs(eta0) < 0.8) {
-        //filling for tracks whose TRT-defined eta is within TRT barrel
-        //helps us to understand if it is a endcap/barrel only relative misalignment
-        m_delta_qoverp_b->Fill(qoverp - Xqoverp);
-        m_delta_d0_b->Fill(d0 - Xd0);
-        m_delta_z0_b->Fill(z0 - Xz0);
-        m_delta_charge_b->Fill(charge - Xcharge);
-        m_delta_pt_b->Fill(pt - Xpt);
-        m_reldelta_pt_b->Fill((pt - Xpt) / Xpt);
-      }
-    }
-
-    nTracksTRT++;
-  } // end of loop on tracks
-
-  delete tracksSi;
-  delete tracksTRT;
-
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonSivsTRT::procHistograms() {
-  if (endOfLowStatFlag() || endOfLumiBlockFlag()) {
-    //StatusCode sc = fillEfficiencyHisto(m_matched_eta0,m_trt_eta0,m_sieff_eta0);
-    //if (sc.isFailure()) return StatusCode::SUCCESS;
-    //sc = fillEfficiencyHisto(m_matched_phi0,m_trt_phi0,m_sieff_phi0);
-    //if (sc.isFailure()) return StatusCode::SUCCESS;
-    //sc = fillEfficiencyHisto(m_trt_eta0,m_alltrks_eta0,m_trteff_eta0);
-    //if (sc.isFailure()) return StatusCode::SUCCESS;
-    //sc = fillEfficiencyHisto(m_trt_phi0,m_alltrks_phi0,m_trteff_phi0);
-    //if (sc.isFailure()) return StatusCode::SUCCESS;
-    //sc = fillEfficiencyHisto(m_trt_phi0_b,m_alltrks_phi0_b,m_trteff_phi0_b);
-    //if (sc.isFailure()) return StatusCode::SUCCESS;
-    //sc = fillEfficiencyHisto(m_trt_phi0_eca,m_alltrks_phi0_eca,m_trteff_phi0_eca);
-    //if (sc.isFailure()) return StatusCode::SUCCESS;
-    //sc = fillEfficiencyHisto(m_trt_phi0_ecc,m_alltrks_phi0_ecc,m_trteff_phi0_ecc);
-    //if (sc.isFailure()) return StatusCode::SUCCESS;
-  }
-
-  if (endOfRunFlag()) {
-    StatusCode sc = fillEfficiencyProfileHisto(m_matched_eta0, m_trt_eta0, m_sieff_eta0);
-    if (sc.isFailure()) return StatusCode::SUCCESS;
-
-    sc = fillEfficiencyProfileHisto(m_matched_phi0, m_trt_phi0, m_sieff_phi0);
-    if (sc.isFailure()) return StatusCode::SUCCESS;
-
-    sc = fillEfficiencyProfileHisto(m_trt_eta0, m_alltrks_eta0, m_trteff_eta0);
-    if (sc.isFailure()) return StatusCode::SUCCESS;
-
-    sc = fillEfficiencyProfileHisto(m_trt_phi0, m_alltrks_phi0, m_trteff_phi0);
-    if (sc.isFailure()) return StatusCode::SUCCESS;
-
-    sc = fillEfficiencyProfileHisto(m_trt_phi0_b, m_alltrks_phi0_b, m_trteff_phi0_b);
-    if (sc.isFailure()) return StatusCode::SUCCESS;
-
-    sc = fillEfficiencyProfileHisto(m_trt_phi0_eca, m_alltrks_phi0_eca, m_trteff_phi0_eca);
-    if (sc.isFailure()) return StatusCode::SUCCESS;
-
-    sc = fillEfficiencyProfileHisto(m_trt_phi0_ecc, m_alltrks_phi0_ecc, m_trteff_phi0_ecc);
-    if (sc.isFailure()) return StatusCode::SUCCESS;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonSivsTRT::fillEfficiencyProfileHisto(TH1* h_num, TH1* h_denom, TProfile* h_eff) {
-  //copied straight from IDAlignMonElectrons::makeEffHisto
-  //means that efficiency histograms are properly combined when merge histos from multiple job segments
-
-  int Nbins;
-
-  Nbins = h_num->GetNbinsX();
-  for (int bin = 0; bin != Nbins; ++bin) {
-    int Npass = int(h_num->GetBinContent(bin + 1));
-    int Nfail = int(h_denom->GetBinContent(bin + 1)) - Npass;//because denominator is total Nevents
-    double x = h_denom->GetBinCenter(bin + 1);
-    for (int pass = 0; pass != Npass; ++pass) {
-      h_eff->Fill(x, 1.);
-    }
-    for (int fail = 0; fail != Nfail; ++fail) {
-      h_eff->Fill(x, 0.);
-    }
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonSivsTRT::fillEfficiencyHisto(TH1* num, TH1* den, TH1* eff) {
-  if (num->GetNbinsX() != den->GetNbinsX() || num->GetNbinsX() != eff->GetNbinsX()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of bins mismatch" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-
-  for (int i = 0; i <= den->GetNbinsX() + 1; i++) {
-    float e = 0.0;
-    if (den->GetBinContent(i) > 0) {
-      e = num->GetBinContent(i) / den->GetBinContent(i);
-    }
-    eff->SetBinContent(i, e);
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonSivsTRT::setupTools() {
-  //initializing tools
-
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In setupTools()" << endmsg;
-
-  if (m_trackSelection.retrieve().isFailure()) {
-    msg(MSG::FATAL) << "Can not retrieve TrackSelection tool of type "
-                    << m_trackSelection.typeAndName() << endmsg;
-    return StatusCode::FAILURE;
-  } else msg(MSG::INFO) << "Retrieved tool " << m_trackSelection.typeAndName() << endmsg;
-
-  // get TrackSummaryTool
-  if (m_trackSumTool.retrieve().isFailure()) {
-    msg(MSG::FATAL) << "Failed to retrieve tool " << m_trackSumTool << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSumTool << endmsg;
-  }
-
-
-  return StatusCode::SUCCESS;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.h
deleted file mode 100644
index 07548931283b27f632f1c05b62cbb1ad1e03beb6..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef IDAlignMonSivsTRT_H
-#define IDAlignMonSivsTRT_H
-
-// **********************************************************************
-// IDAlignMonSivsTRT.cxx
-// AUTHORS: Ben Cooper
-// **********************************************************************
-
-#include <vector>
-
-#include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-
-#include "TrkParameters/TrackParameters.h"
-#include "TrkTrack/TrackCollection.h"
-#include "TrkToolInterfaces/ITrackSummaryTool.h"
-#include "StoreGate/ReadHandleKey.h"
-
-class TH1F;
-class TH2F;
-class TProfile;
-
-class AtlasDetectorID;
-class PixelID;
-
-namespace InDetAlignMon {
-  class TrackSelectionTool;
-}
-
-namespace Trk {
-  class Track;
-  class TrackStateOnSurface;
-}
-
-class IDAlignMonSivsTRT: public ManagedMonitorToolBase
-{
-public:
-  IDAlignMonSivsTRT(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~IDAlignMonSivsTRT();
-
-  virtual StatusCode initialize();
-
-  virtual StatusCode bookHistograms();
-  virtual StatusCode fillHistograms();
-  virtual StatusCode procHistograms();
-
-  void RegisterHisto(MonGroup& mon, TH1* histo);
-  void RegisterHisto(MonGroup& mon, TH2* histo);
-  void RegisterHisto(MonGroup& mon, TProfile* histo);
-  //Not sure should be public
-  void InitializeHistograms();
-protected:
-private:
-  StatusCode setupTools();
-
-  std::string m_stream;
-  std::string m_triggerChainName;
-  int m_checkrate {};
-  float m_matchdRcut {};
-  int m_events {};
-  int m_histosBooked {};
-
-  //private functions
-  StatusCode fillEfficiencyHisto(TH1* num, TH1* den, TH1* eff);
-  static StatusCode fillEfficiencyProfileHisto(TH1*, TH1*, TProfile*);
-
-
-  //tools
-  ToolHandle<InDetAlignMon::TrackSelectionTool>        m_trackSelection;
-  ToolHandle<Trk::ITrackSummaryTool>        m_trackSumTool;
-
-  SG::ReadHandleKey<TrackCollection> m_ResolvedTracksKey {
-    this, "ResolvedTracksKey", "ResolvedTracks"
-  };
-  SG::ReadHandleKey<TrackCollection> m_ExtendedTracksKey {
-    this, "ExtendedTracksKey", "ExtendedTracks"
-  };
-
-  //histograms
-  TH1F* m_delta_phi0 {};
-  TH1F* m_delta_eta0 {};
-  TH1F* m_delta_R {};
-  TH1F* m_delta_qoverp {};
-  TH1F* m_delta_charge {};
-  TH1F* m_delta_d0 {};
-  TH1F* m_delta_z0 {};
-  TH1F* m_delta_pt {};
-  TH1F* m_reldelta_pt {};
-  TH1F* m_nhitstrt {};
-
-  TH1F* m_delta_phi0_b {};
-  TH1F* m_delta_eta0_b {};
-  TH1F* m_delta_R_b {};
-  TH1F* m_delta_qoverp_b {};
-  TH1F* m_delta_charge_b {};
-  TH1F* m_delta_d0_b {};
-  TH1F* m_delta_z0_b {};
-  TH1F* m_delta_pt_b {};
-  TH1F* m_reldelta_pt_b {};
-
-  TH1F* m_alltrks_phi0 {};
-  TH1F* m_alltrks_phi0_b {};
-  TH1F* m_alltrks_phi0_eca {};
-  TH1F* m_alltrks_phi0_ecc {};
-  TH1F* m_alltrks_eta0 {};
-  TH1F* m_si_phi0 {};
-  TH1F* m_si_eta0 {};
-  TH1F* m_trt_phi0 {};
-  TH1F* m_trt_phi0_b {};
-  TH1F* m_trt_phi0_eca {};
-  TH1F* m_trt_phi0_ecc {};
-  TH1F* m_trt_eta0 {};
-  TH1F* m_matched_phi0 {};
-  TH1F* m_matched_eta0 {};
-
-  TProfile* m_sieff_phi0 {};
-  TProfile* m_sieff_eta0 {};
-  TProfile* m_trteff_phi0 {};
-  TProfile* m_trteff_phi0_b {};
-  TProfile* m_trteff_phi0_eca {};
-  TProfile* m_trteff_phi0_ecc {};
-  TProfile* m_trteff_eta0 {};
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.cxx
deleted file mode 100644
index 168674cd2082bdad347c68763a7714b07505b147..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.cxx
+++ /dev/null
@@ -1,1089 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// IDAlignMonTrackSegments.cxx
-// AUTHORS: John Alison (john.alison@cern.ch) johnda
-//          Ben Cooper
-//          Tobias Golling
-// **********************************************************************
-
-#include "TMath.h"
-#include "LWHists/TH1F_LW.h"
-#include "LWHists/TH2F_LW.h"
-#include "TProfile.h"
-#include "GaudiKernel/MsgStream.h"
-#include "IDAlignMonTrackSegments.h"
-#include "TrkTrackSummary/TrackSummary.h"
-#include "InDetTrackSplitterTool/IInDetTrackSplitterTool.h"
-#include "TrackSelectionTool.h"
-#include <iostream>
-
-
-struct IDAlignMonTrackSegments::UpperLowerHistograms {
-  TH1F_LW* nhitstrt;
-  TH1F_LW* nhitsSi;
-  TH1F_LW* nhitsPix;
-  TH1F_LW* nhitsSct;
-  TH1F_LW* phi0;
-  TH1F_LW* eta0;
-  TH1F_LW* qOverPt;
-  TH1F_LW* charge;
-  TH1F_LW* d0;
-  TH1F_LW* z0;
-  TH1F_LW* pt;
-  UpperLowerHistograms() : nhitstrt(nullptr), nhitsSi(nullptr), nhitsPix(nullptr), nhitsSct(nullptr), phi0(nullptr),
-    eta0(nullptr), qOverPt(nullptr), charge(nullptr), d0(nullptr), z0(nullptr), pt(nullptr) {};
-};
-
-struct IDAlignMonTrackSegments::DeltaTrackParamHistograms {
-  // All Tracks, Positive Tracks, Negative Tracks
-  TH1F_LW* dTp[3] {};
-  TH1F_LW* dTpPull[3] {};
-  TH2F_LW* VsD0[3] {};
-  TH2F_LW* VsZ0[3] {};
-  TH2F_LW* VsPhi0[3] {};
-  TH2F_LW* VsPt[3] {};
-  TH2F_LW* VsEta[3] {};
-
-  DeltaTrackParamHistograms() {
-    for (unsigned int charge = 0; charge < 3; ++charge) {
-      dTp[charge] = nullptr;
-      dTpPull[charge] = nullptr;
-      VsD0[charge] = nullptr;
-      VsZ0[charge] = nullptr;
-      VsPhi0[charge] = nullptr;
-      VsPt[charge] = nullptr;
-      VsEta[charge] = nullptr;
-    }
-  };
-};
-
-
-// *********************************************************************
-// Public Methods
-// *********************************************************************
-IDAlignMonTrackSegments::IDAlignMonTrackSegments(const std::string& type, const std::string& name,
-                                                 const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent),
-  m_events(0),
-  m_histosBooked(0),
-  m_upper_hist(new UpperLowerHistograms),
-  m_lower_hist(new UpperLowerHistograms),
-  m_delta_d0(new DeltaTrackParamHistograms),
-  m_delta_z0(new DeltaTrackParamHistograms),
-  m_delta_phi0(new DeltaTrackParamHistograms),
-  m_delta_eta0(new DeltaTrackParamHistograms),
-  m_delta_qOverPt(new DeltaTrackParamHistograms),
-  m_delta_PtqOverPt(new DeltaTrackParamHistograms),
-  m_delta_nHits(new DeltaTrackParamHistograms),
-  m_delta_charge(new DeltaTrackParamHistograms) {
-
-  declareProperty("triggerChainName", m_triggerChainName = "NoTriggerSelection");
-  declareProperty("MatchedRCut", m_matchedRcut = 0.2);
-  declareProperty("UseCTBSplitTracks", m_useCTBSplitTracks = true);
-  declareProperty("TrackSplitter", m_trackSplitter);
-  declareProperty("trackSelectionUp", m_trackSelectionUpper = ToolHandle<InDetAlignMon::TrackSelectionTool>("InDetAlignMon::TrackSelectionTool"));
-  declareProperty("trackSelectionLow", m_trackSelectionLower = ToolHandle<InDetAlignMon::TrackSelectionTool>("Trk::TrackSummaryTool/InDetTrackSummaryTool"));
-  declareProperty("DeltaD0Range", m_deltaD0Range = 0.25);
-  declareProperty("DeltaD0Range2D", m_deltaD0Range2D = 1.0);
-  declareProperty("DeltaPhiRange", m_deltaPhiRange = 0.005);
-  declareProperty("DeltaPhiRange2D", m_deltaPhiRange2D = 0.02);
-  declareProperty("DeltaQoverPtRange", m_deltaQoverPtRange = 0.1);
-  declareProperty("DeltaQoverPtRange2D", m_deltaQoverPtRange2D = 0.4);
-  declareProperty("DeltaQoverPtRange", m_deltaPtQoverPtRange = 0.5);
-  declareProperty("DeltaQoverPtRange2D", m_deltaPtQoverPtRange2D = 0.5);
-  declareProperty("DeltaZ0Range", m_deltaZ0Range = 0.6);
-  declareProperty("D0Range", m_d0Range = 150);
-  declareProperty("UpperPhi", m_upperPhi = 0);
-  declareProperty("trackSumTool", m_trackSumTool = ToolHandle<Trk::ITrackSummaryTool>("Trk::TrackSummaryTool/InDetTrackSummaryTool"));
-
-  InitializeHistograms();
-}
-
-//---------------------------------------------------------------------------------------
-
-IDAlignMonTrackSegments::~IDAlignMonTrackSegments() {
-  delete m_upper_hist;
-  delete m_lower_hist;
-  delete m_delta_d0;
-  delete m_delta_z0;
-  delete m_delta_phi0;
-  delete m_delta_eta0;
-  delete m_delta_qOverPt;
-  delete m_delta_PtqOverPt;
-  delete m_delta_nHits;
-  delete m_delta_charge;
-}
-
-void IDAlignMonTrackSegments::InitializeHistograms() {
-  m_debug_phi0 = nullptr;
-  m_debug_eta0 = nullptr;
-
-  // pt
-  m_delta_pt = nullptr;
-  m_reldelta_pt = nullptr;
-}
-
-StatusCode IDAlignMonTrackSegments::initialize() {
-  //initialize tools and services
-  ATH_MSG_DEBUG("initialize() to setup tools/services");
-
-  if (ManagedMonitorToolBase::initialize().isFailure()) {
-    ATH_MSG_ERROR("unable to initialize ManagedMonitorToolBase class");
-    return StatusCode::FAILURE;
-  }
-
-  if (setupTools().isFailure()) {
-    ATH_MSG_ERROR("Failed to initialize tools/services!");
-    return StatusCode::FAILURE;
-  } else {
-    ATH_MSG_DEBUG("Successfully initialized tools/services");
-  }
-
-  ATH_CHECK(m_inputTracksName.initialize());
-  ATH_CHECK(m_upperTracksName.initialize());
-  ATH_CHECK(m_lowerTracksName.initialize());
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode IDAlignMonTrackSegments::bookHistograms() {
-  m_events = 0;
-
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    // book histograms that are only made in the online environment...
-  }
-
-  if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-    // book histograms that are only relevant for cosmics data...
-  }
-
-  std::string outputDirName = "IDAlignMon/" + m_inputTracksName.key() + "_" + m_triggerChainName + "/TrackSegments";
-  if (m_useCTBSplitTracks) outputDirName = "IDAlignMon/" + m_upperTracksName.key() + "_" + m_lowerTracksName.key() +
-                                           "_" + m_triggerChainName + "/TrackSegments";
-
-  MonGroup al_mon(this, outputDirName, run);
-
-
-  //if ( newLowStatFlag() || newLumiBlockFlag() ) {  }
-
-  if (newRunFlag()) {
-    //if user environment specified we don't want to book new histograms at every run boundary
-    //we instead want one histogram per job
-    if (m_histosBooked != 0 && AthenaMonManager::environment() == AthenaMonManager::user) return StatusCode::SUCCESS;
-
-    //Upper Tracks
-    m_upper_hist->nhitstrt = TH1F_LW::create("nhits_trtUp",
-                                             "Number of TRT hits for every track in Upper Track Collection", 101, -0.5,
-                                             100.5);
-    RegisterHisto(al_mon, m_upper_hist->nhitstrt);
-    m_upper_hist->nhitsSi = TH1F_LW::create("nhits_siUp", "Number of SI hits for every track in Upper Track Collection",
-                                            26, -0.5, 25.5);
-    RegisterHisto(al_mon, m_upper_hist->nhitsSi);
-    m_upper_hist->nhitsPix = TH1F_LW::create("nhits_pixUp",
-                                             "Number of PIX hits for every track in Upper Track Collection", 11, -0.5,
-                                             10.5);
-    RegisterHisto(al_mon, m_upper_hist->nhitsPix);
-    m_upper_hist->nhitsSct = TH1F_LW::create("nhits_sctUp",
-                                             "Number of SCT hits for every track in Upper Track Collection", 21, -0.5,
-                                             20.5);
-    RegisterHisto(al_mon, m_upper_hist->nhitsSct);
-    m_upper_hist->phi0 = TH1F_LW::create("Upper_phi0", "#phi_{0}^{Upper}", 60, -M_PI, m_upperPhi);
-    RegisterHisto(al_mon, m_upper_hist->phi0);
-    m_upper_hist->eta0 = TH1F_LW::create("Upper_eta0", "#eta_{0}^{Upper}", 100, -2.1, 2.1);
-    RegisterHisto(al_mon, m_upper_hist->eta0);
-    m_upper_hist->d0 = TH1F_LW::create("Upper_d0", "d_{0}^{Upper}; d_{0} [mm]", 80, -1 * m_d0Range, m_d0Range);
-    RegisterHisto(al_mon, m_upper_hist->d0);
-    m_upper_hist->z0 = TH1F_LW::create("Upper_z0", "z_{0}^{Upper}; z_{0} [mm]", 50, -500, 500);
-    RegisterHisto(al_mon, m_upper_hist->z0);
-    m_upper_hist->qOverPt = TH1F_LW::create("Upper_qOverPt", "q/p_{T}^{Upper}; q/p_{T} [GeV^{-1}]", 100, -0.05, 0.05);
-    RegisterHisto(al_mon, m_upper_hist->qOverPt);
-    m_upper_hist->pt = TH1F_LW::create("Upper_pt", "p_{T}^{Upper}; p_{T} [GeV]", 100, 0., 100.0);
-    RegisterHisto(al_mon, m_upper_hist->pt);
-
-    //Lower Tracks
-    m_lower_hist->nhitstrt = TH1F_LW::create("nhits_trtLow",
-                                             "Number of TRT hits for every track in Lower Track Collection", 101, -0.5,
-                                             100.5);
-    RegisterHisto(al_mon, m_lower_hist->nhitstrt);
-    m_lower_hist->nhitsSi = TH1F_LW::create("nhits_siLow",
-                                            "Number of SI hits for every track in Lower Track Collection", 26, -0.5,
-                                            25.5);
-    RegisterHisto(al_mon, m_lower_hist->nhitsSi);
-    m_lower_hist->nhitsPix = TH1F_LW::create("nhits_pixLow",
-                                             "Number of PIX hits for every track in Lower Track Collection", 11, -0.5,
-                                             10.5);
-    RegisterHisto(al_mon, m_lower_hist->nhitsPix);
-    m_lower_hist->nhitsSct = TH1F_LW::create("nhits_sctLow",
-                                             "Number of SCT hits for every track in Lower Track Collection", 21, -0.5,
-                                             20.5);
-    RegisterHisto(al_mon, m_lower_hist->nhitsSct);
-    m_lower_hist->phi0 = TH1F_LW::create("Lower_phi0", "#phi_{0}^{Low} ", 60, -M_PI, m_upperPhi);
-    RegisterHisto(al_mon, m_lower_hist->phi0);
-    m_lower_hist->eta0 = TH1F_LW::create("Lower_eta0", "#eta_{0}^{Low} ", 100, -2.1, 2.1);
-    RegisterHisto(al_mon, m_lower_hist->eta0);
-    m_lower_hist->d0 = TH1F_LW::create("Lower_d0", "d_{0}^{Low}; d_{0} [mm]", 80, -1 * m_d0Range, m_d0Range);
-    RegisterHisto(al_mon, m_lower_hist->d0);
-    m_lower_hist->z0 = TH1F_LW::create("Lower_z0", "z_{0}^{Low}; z_{0} [mm]", 50, -500, 500);
-    RegisterHisto(al_mon, m_lower_hist->z0);
-    m_lower_hist->qOverPt = TH1F_LW::create("Lower_qOverPt", "q/p_{T}^{Low}; q/p_{T} [GeV^{-1}]", 100, -0.05, 0.05);
-    RegisterHisto(al_mon, m_lower_hist->qOverPt);
-    m_lower_hist->pt = TH1F_LW::create("Lower_pt", "p_{T}^{Low}; p_{T} [GeV]", 100, 0., 100.0);
-    RegisterHisto(al_mon, m_lower_hist->pt);
-
-
-
-    //  differences in track parameters
-    //==================================
-    std::string chargeNames[3] = {
-      "", " (Positive Tracks)", " (Negative Tracks)"
-    };
-    std::string histNames[3] = {
-      "", "_p", "_n"
-    };
-
-    for (unsigned int charge = 0; charge < 3; ++charge) {
-      //======== d0 =========
-      m_delta_d0->dTp[charge] = MakeHist("delta_d0" + histNames[charge]
-                                         , "d_{0}^{Low} - d_{0}^{Upper}" + chargeNames[charge] + "; #Delta d_{0} [mm]"
-                                         , 50, -m_deltaD0Range, m_deltaD0Range);
-      RegisterHisto(al_mon, m_delta_d0->dTp[charge]);
-
-      m_delta_d0->dTpPull[charge] = MakeHist("delta_d0_Pull" + histNames[charge]
-                                             , "d_{0}^{Low} - d_{0}^{Upper} / #sigma_{d_{0}}" + chargeNames[charge] + "; #Delta d_{0} pull"
-                                             , 100, -3,
-                                             3);
-      RegisterHisto(al_mon, m_delta_d0->dTpPull[charge]);
-
-      m_delta_d0->VsD0[charge] = MakeHist("delta_d0VsD0" + histNames[charge]
-                                          , "d_{0}^{Low} - d_{0}^{Upper} Vs d_{0}^{Upper}" + chargeNames[charge] + "; d_{0}^{Upper} [mm]; #Delta d_{0} [mm]"
-                                          , 9, -m_d0Range, m_d0Range, 50, -1 * m_deltaD0Range2D,
-                                          m_deltaD0Range2D);
-      RegisterHisto(al_mon, m_delta_d0->VsD0[charge]);
-
-      m_delta_d0->VsPhi0[charge] = MakeHist("delta_d0VsPhi0" + histNames[charge]
-                                            , "d_{0}^{Low} - d_{0}^{Upper} Vs #phi_{0}^{Upper}" + chargeNames[charge] + "; #phi_{0}^{Upper} [mm]; #Delta d_{0} [mm]"
-                                            , 9, -M_PI, m_upperPhi, 50, -1 * m_deltaD0Range2D,
-                                            m_deltaD0Range2D);
-      RegisterHisto(al_mon, m_delta_d0->VsPhi0[charge]);
-
-      m_delta_d0->VsPt[charge] = MakeHist("delta_d0VsPt" + histNames[charge]
-                                          , "d_{0}^{Low} - d_{0}^{Upper} Vs p_{T}^{Upper}" + chargeNames[charge] + "; p_{T}^{Upper} [GeV]; #Delta d_{0} [mm]"
-                                          , 10, 0, 100, 50, -1 * m_deltaD0Range2D,
-                                          m_deltaD0Range2D);
-      RegisterHisto(al_mon, m_delta_d0->VsPt[charge]);
-
-      m_delta_d0->VsEta[charge] = MakeHist("delta_d0VsEta" + histNames[charge]
-                                           , "d_{0}^{Low} - d_{0}^{Upper} Vs #eta^{Upper}" + chargeNames[charge] + "; #eta^{Upper}; #Delta d_{0} [mm]"
-                                           , 11, -2.1, 2.1, 50, -1 * m_deltaD0Range2D,
-                                           m_deltaD0Range2D);
-      RegisterHisto(al_mon, m_delta_d0->VsEta[charge]);
-
-      m_delta_d0->VsZ0[charge] = MakeHist("delta_d0VsZ0" + histNames[charge]
-                                          , "d_{0}^{Low} - d_{0}^{Upper} Vs z_{0}^{Upper}" + chargeNames[charge] + "; #z_{0}^{Upper} [mm]; #Delta d_{0} [mm]"
-                                          , 11, -500., 500., 50, -1 * m_deltaD0Range2D,
-                                          m_deltaD0Range2D);
-      RegisterHisto(al_mon, m_delta_d0->VsZ0[charge]);
-
-      //========= z0
-      m_delta_z0->dTp[charge] = MakeHist("delta_z0" + histNames[charge]
-                                         , "z_{0}^{Upper} - z_{0}^{Low}" + chargeNames[charge] + "; #Delta z_{0} [mm]"
-                                         , 50, -m_deltaZ0Range, m_deltaZ0Range);
-      RegisterHisto(al_mon, m_delta_z0->dTp[charge]);
-
-      m_delta_z0->dTpPull[charge] = MakeHist("delta_z0_Pull" + histNames[charge]
-                                             , "z_{0}^{Upper} - z_{0}^{Low} / #sigma_{z_{0}}" + chargeNames[charge] + "; #Delta z_{0} pull"
-                                             , 50, -m_deltaZ0Range,
-                                             m_deltaZ0Range);
-      RegisterHisto(al_mon, m_delta_z0->dTpPull[charge]);
-
-      m_delta_z0->VsD0[charge] = MakeHist("delta_z0VsD0" + histNames[charge]
-                                          , "z_{0}^{Upper} - z_{0}^{low} Vs d_{0}^{Upper}" + chargeNames[charge] + "; z_{0}^{Upper} [mm]; #Delta z_{0} [mm]"
-                                          , 9, -1 * m_d0Range, m_d0Range, 50, -m_deltaZ0Range,
-                                          m_deltaZ0Range);
-      RegisterHisto(al_mon, m_delta_z0->VsD0[charge]);
-
-      m_delta_z0->VsPhi0[charge] = MakeHist("delta_z0VsPhi0" + histNames[charge]
-                                            , "z_{0}^{Upper} - z_{0}^{Low} Vs #phi_{0}^{Upper}" + chargeNames[charge]
-                                            , 9, -M_PI, m_upperPhi, 50, -m_deltaZ0Range, m_deltaZ0Range);
-      RegisterHisto(al_mon, m_delta_z0->VsPhi0[charge]);
-
-      m_delta_z0->VsPt[charge] = MakeHist("delta_z0VsPt" + histNames[charge]
-                                          , "z_{0}^{Upper} - z_{0}^{Low} Vs p_{T}^{Upper}" + chargeNames[charge]
-                                          , 10, 0, 100, 50, -m_deltaZ0Range, m_deltaZ0Range);
-      RegisterHisto(al_mon, m_delta_z0->VsPt[charge]);
-
-      m_delta_z0->VsEta[charge] = MakeHist("delta_z0VsEta" + histNames[charge]
-                                           , "z_{0}^{Upper} - z_{0}^{Low} Vs #eta^{Upper}" + chargeNames[charge]
-                                           , 11, -2.1, 2.1, 50, -m_deltaZ0Range, m_deltaZ0Range);
-      RegisterHisto(al_mon, m_delta_z0->VsEta[charge]);
-
-      m_delta_z0->VsZ0[charge] = MakeHist("delta_z0VsZ0" + histNames[charge]
-                                          , "z_{0}^{Upper} - z_{0}^{Low} Vs z_{0}^{Upper}" + chargeNames[charge]
-                                          , 11, -500., 500., 50, -m_deltaZ0Range, m_deltaZ0Range);
-      RegisterHisto(al_mon, m_delta_z0->VsZ0[charge]);
-
-      //====== phi0 ========
-      m_delta_phi0->dTp[charge] = MakeHist("delta_phi0" + histNames[charge]
-                                           , "#phi_{0}^{Low} - #phi_{0}^{Upper}" + chargeNames[charge]
-                                           , 100, -1 * m_deltaPhiRange, m_deltaPhiRange);
-      RegisterHisto(al_mon, m_delta_phi0->dTp[charge]);
-
-      m_delta_phi0->dTpPull[charge] = MakeHist("delta_phi0_Pull" + histNames[charge]
-                                               , "phi_{0}^{Low} - phi_{0}^{Upper} / #sigma_{phi_{0}}" +
-                                               chargeNames[charge]
-                                               , 100, -3, 3);
-      RegisterHisto(al_mon, m_delta_phi0->dTpPull[charge]);
-
-
-      m_delta_phi0->VsD0[charge] = MakeHist("delta_phi0VsD0" + histNames[charge]
-                                            , "#phi_{0}^{Low} - #phi_{0}^{Upper} Vs D0^{Upper}" + chargeNames[charge]
-                                            , 9, -1 * m_d0Range, m_d0Range, 50, -1 * m_deltaPhiRange2D,
-                                            m_deltaPhiRange2D);
-      RegisterHisto(al_mon, m_delta_phi0->VsD0[charge]);
-
-      m_delta_phi0->VsPhi0[charge] = MakeHist("delta_phi0VsPhi0" + histNames[charge]
-                                              , "#phi_{0}^{Low} - #phi_{0}^{Upper} Vs #phi_0^{Upper}" +
-                                              chargeNames[charge]
-                                              , 9, -M_PI, m_upperPhi, 50, -1 * m_deltaPhiRange2D, m_deltaPhiRange2D);
-      RegisterHisto(al_mon, m_delta_phi0->VsPhi0[charge]);
-
-      m_delta_phi0->VsPt[charge] = MakeHist("delta_phi0VsPt" + histNames[charge]
-                                            , "#phi_{0}^{Low} - #phi_{0}^{Upper} Vs p_{T}^{Upper}" + chargeNames[charge]
-                                            , 11, 0, 100, 50, -1 * m_deltaPhiRange2D, m_deltaPhiRange2D);
-      RegisterHisto(al_mon, m_delta_phi0->VsPt[charge]);
-
-      m_delta_phi0->VsEta[charge] = MakeHist("delta_phi0VsEta" + histNames[charge]
-                                             , "#phi_{0}^{Low} - #phi_{0}^{Upper} Vs #eta^{Upper}" + chargeNames[charge]
-                                             , 11, -2.1, 2.1, 50, -1 * m_deltaPhiRange2D, m_deltaPhiRange2D);
-      RegisterHisto(al_mon, m_delta_phi0->VsEta[charge]);
-
-      m_delta_phi0->VsZ0[charge] = MakeHist("delta_phi0VsZ0" + histNames[charge]
-                                            , "#phi_{0}^{Low} - #phi_{0}^{Upper} Vs Z0^{Upper}" + chargeNames[charge]
-                                            , 11, -500., 500., 50, -1 * m_deltaPhiRange2D, m_deltaPhiRange2D);
-      RegisterHisto(al_mon, m_delta_phi0->VsZ0[charge]);
-
-      //======= eta0 =======
-      m_delta_eta0->dTp[charge] = MakeHist("delta_eta0" + histNames[charge]
-                                           , "#eta_{0}^{Upper} - #eta_{0}^{Low}" + chargeNames[charge]
-                                           , 100, -0.005, 0.005);
-      RegisterHisto(al_mon, m_delta_eta0->dTp[charge]);
-
-      m_delta_eta0->dTpPull[charge] = MakeHist("delta_eta0_Pull" + histNames[charge]
-                                               , "eta_{0}^{Upper} - eta_{0}^{Low} / #sigma_{eta_{0}}" +
-                                               chargeNames[charge]
-                                               , 100, -4, 4);
-      RegisterHisto(al_mon, m_delta_eta0->dTpPull[charge]);
-
-      m_delta_eta0->VsD0[charge] = MakeHist("delta_eta0VsD0" + histNames[charge]
-                                            , "#eta_{0}^{Upper} - #eta_{0}^{Low} Vs D0^{Upper}" + chargeNames[charge]
-                                            , 9, -1 * m_d0Range, m_d0Range, 50, -0.02, 0.02);
-      RegisterHisto(al_mon, m_delta_eta0->VsD0[charge]);
-
-      m_delta_eta0->VsPhi0[charge] = MakeHist("delta_eta0VsPhi0" + histNames[charge]
-                                              , "#eta_{0}^{Upper} - #eta_{0}^{low} Vs Phi0^{Upper}" + chargeNames[charge]
-                                              , 9, -M_PI, m_upperPhi, 50, -0.02,
-                                              0.02);
-      RegisterHisto(al_mon, m_delta_eta0->VsPhi0[charge]);
-
-      m_delta_eta0->VsPt[charge] = MakeHist("delta_eta0VsPt" + histNames[charge]
-                                            , "#eta_{0}^{Upper} - #eta_{0}^{Low} Vs p_{T}^{Upper}" + chargeNames[charge]
-                                            , 11, 0, 100, 50, -0.02, 0.02);
-      RegisterHisto(al_mon, m_delta_eta0->VsPt[charge]);
-
-      m_delta_eta0->VsEta[charge] = MakeHist("delta_eta0VsEta" + histNames[charge]
-                                             , "#eta_{0}^{Upper} - #eta_{0}^{Low} Vs #eta_{0}^{Upper}" +
-                                             chargeNames[charge]
-                                             , 51, -2.1, 2.1, 50, -0.02, 0.02);
-      RegisterHisto(al_mon, m_delta_eta0->VsEta[charge]);
-
-      m_delta_eta0->VsZ0[charge] = MakeHist("delta_eta0VsZ0" + histNames[charge]
-                                            , "#eta_{0}^{Upper} - #eta_{0}^{Low} Vs Z0^{Upper}" + chargeNames[charge]
-                                            , 11, -500., 500., 50, -0.02, 0.02);
-      RegisterHisto(al_mon, m_delta_eta0->VsZ0[charge]);
-
-      //======= qOverPt
-      m_delta_qOverPt->dTp[charge] = MakeHist("delta_qOverPt" + histNames[charge]
-                                              , "Q/p_{T}^{Low} - Q/p_{T}^{Upper} (1/GeV)" + chargeNames[charge]
-                                              , 100, -1 * m_deltaQoverPtRange, m_deltaQoverPtRange);
-      RegisterHisto(al_mon, m_delta_qOverPt->dTp[charge]);
-
-      m_delta_qOverPt->dTpPull[charge] = MakeHist("delta_qOverPt_Pull" + histNames[charge]
-                                                  , "qOverPt^{Low} - qOverPt^{Upper} / #sigma_{qOverPt}" +
-                                                  chargeNames[charge]
-                                                  , 100, -3, 3);
-      RegisterHisto(al_mon, m_delta_qOverPt->dTpPull[charge]);
-
-      m_delta_qOverPt->VsD0[charge] = MakeHist("delta_qOverPtVsD0" + histNames[charge]
-                                               , "Q/p_{T}^{Low} - Q/p_{T}^{Upper} Vs d_{0}^{Upper}" + chargeNames[charge]
-                                               , 8, -1 * m_d0Range, m_d0Range, 50, -1 * m_deltaQoverPtRange2D,
-                                               m_deltaQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_qOverPt->VsD0[charge]);
-
-      m_delta_qOverPt->VsZ0[charge] = MakeHist("delta_qOverPtVsZ0" + histNames[charge]
-                                               , "Q/p_{T}^{Low} - Q/p_{T}^{Upper} Vs z_{0}^{Upper}" + chargeNames[charge]
-                                               , 50, -1000, 1000, 50, -1 * m_deltaQoverPtRange2D,
-                                               m_deltaQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_qOverPt->VsZ0[charge]);
-
-      m_delta_qOverPt->VsPhi0[charge] = MakeHist("delta_qOverPtVsPhi0" + histNames[charge]
-                                                 , "Q/p_{T}^{Low} - Q/p_{T}^{Upper} (1/GeV) Vs #phi_{0}^{Upper}" +
-                                                 chargeNames[charge]
-                                                 , 8, -M_PI, m_upperPhi, 50, -1 * m_deltaQoverPtRange2D,
-                                                 m_deltaQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_qOverPt->VsPhi0[charge]);
-
-      m_delta_qOverPt->VsPt[charge] = MakeHist("delta_qOverPtVsPt" + histNames[charge]
-                                               , "Q/p_{T}^{Low} - Q/p_{T}^{Upper} (1/GeV) Vs p_{T}^{Upper}" +
-                                               chargeNames[charge]
-                                               , 10, 0, 100, 50, -1 * m_deltaQoverPtRange2D,
-                                               m_deltaQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_qOverPt->VsPt[charge]);
-
-      m_delta_qOverPt->VsEta[charge] = MakeHist("delta_qOverPtVsEta" + histNames[charge]
-                                                , "Q/p_{T}^{Low} - Q/p_{T}^{Upper} (1/GeV) Vs #eta^{Upper}" +
-                                                chargeNames[charge]
-                                                , 50, -2.1, 2.1, 50, -1 * m_deltaQoverPtRange2D,
-                                                m_deltaQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_qOverPt->VsEta[charge]);
-
-      //======= PtqOverPt
-      m_delta_PtqOverPt->dTp[charge] = MakeHist("delta_PtqOverPt" + histNames[charge]
-                                                , "p_{T}^{Upper}.(Q/p_{T}^{Low} - Q/p_{T}^{Upper}) " +
-                                                chargeNames[charge]
-                                                , 100, -1 * m_deltaPtQoverPtRange, m_deltaPtQoverPtRange);
-      RegisterHisto(al_mon, m_delta_PtqOverPt->dTp[charge]);
-
-      m_delta_PtqOverPt->dTpPull[charge] = MakeHist("delta_PtqOverPt_Pull" + histNames[charge]
-                                                    , "p_{T}^{Upper}.(qOverPt^{Low} - qOverPt^{Upper} / #sigma_{qOverPt})" +
-                                                    chargeNames[charge]
-                                                    , 100, -3,
-                                                    3);
-      RegisterHisto(al_mon, m_delta_PtqOverPt->dTpPull[charge]);
-
-      m_delta_PtqOverPt->VsD0[charge] = MakeHist("delta_PtqOverPtVsD0" + histNames[charge]
-                                                 , "p_{T}^{Upper}.(Q/p_{T}^{Low} - Q/p_{T}^{Upper}) Vs d_{0}^{Upper}" +
-                                                 chargeNames[charge]
-                                                 , 8, -1 * m_d0Range, m_d0Range, 50, -1 * m_deltaPtQoverPtRange2D,
-                                                 m_deltaPtQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_PtqOverPt->VsD0[charge]);
-
-      m_delta_PtqOverPt->VsZ0[charge] = MakeHist("delta_PtqOverPtVsZ0" + histNames[charge]
-                                                 , "p_{T}^{Upper}.(Q/p_{T}^{Low} - Q/p_{T}^{Upper}) Vs z_{0}^{Upper}" +
-                                                 chargeNames[charge]
-                                                 , 50, -1000, 1000, 50, -1 * m_deltaPtQoverPtRange2D,
-                                                 m_deltaPtQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_PtqOverPt->VsZ0[charge]);
-
-      m_delta_PtqOverPt->VsPhi0[charge] = MakeHist("delta_PtqOverPtVsPhi0" + histNames[charge]
-                                                   , "p_{T}^{Upper}.(Q/p_{T}^{Low} - Q/p_{T}^{Upper}) Vs #phi_{0}^{Upper}" +
-                                                   chargeNames[charge]
-                                                   , 8, -M_PI, m_upperPhi, 50, -1 * m_deltaPtQoverPtRange2D,
-                                                   m_deltaPtQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_PtqOverPt->VsPhi0[charge]);
-
-      m_delta_PtqOverPt->VsPt[charge] = MakeHist("delta_PtqOverPtVsPt" + histNames[charge]
-                                                 , "p_{T}^{Upper}.(Q/p_{T}^{Low} - Q/p_{T}^{Upper}) Vs p_{T}^{Upper}" +
-                                                 chargeNames[charge]
-                                                 , 50, 0, 100, 50, -1 * m_deltaPtQoverPtRange2D,
-                                                 m_deltaPtQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_PtqOverPt->VsPt[charge]);
-
-      m_delta_PtqOverPt->VsEta[charge] = MakeHist("delta_PtqOverPtVsEta" + histNames[charge]
-                                                  , "p_{T}^{Upper}.(Q/p_{T}^{Low} - Q/p_{T}^{Upper}) Vs #eta^{Upper}" +
-                                                  chargeNames[charge]
-                                                  , 50, -2.1, 2.1, 50, -1 * m_deltaPtQoverPtRange2D,
-                                                  m_deltaPtQoverPtRange2D);
-      RegisterHisto(al_mon, m_delta_PtqOverPt->VsEta[charge]);
-
-
-      //========== nHits
-      m_delta_nHits->dTp[charge] = MakeHist("delta_nHits" + histNames[charge]
-                                            , "NHits^{upper} - NHits^{lower}" + chargeNames[charge], 61, -30.5, 30.5);
-      RegisterHisto(al_mon, m_delta_nHits->dTp[charge]);
-
-      m_delta_nHits->VsD0[charge] = MakeHist("delta_nHitsVsD0" + histNames[charge]
-                                             , "NHits^{upper} - NHits^{lower} Vs d_{0}^{Upper}" + chargeNames[charge]
-                                             , 8, -1 * m_d0Range, m_d0Range, 61, -30.5, 30.5);
-      RegisterHisto(al_mon, m_delta_nHits->VsD0[charge]);
-
-      m_delta_nHits->VsPhi0[charge] = MakeHist("delta_nHitsVsPhi0" + histNames[charge]
-                                               , "NHits^{upper} - NHits^{lower} Vs #phi_{0}^{Upper}" +
-                                               chargeNames[charge]
-                                               , 8, -M_PI, m_upperPhi, 61, -30.5, 30.5);
-      RegisterHisto(al_mon, m_delta_nHits->VsPhi0[charge]);
-
-      m_delta_nHits->VsZ0[charge] = MakeHist("delta_nHitsVsZ0" + histNames[charge]
-                                             , "NHits^{upper} - NHits^{lower} Vs z_{0}^{Upper}" + chargeNames[charge]
-                                             , 50, -1000, 1000, 61, -30.5, 30.5);
-      RegisterHisto(al_mon, m_delta_nHits->VsZ0[charge]);
-
-      m_delta_nHits->VsPt[charge] = MakeHist("delta_nHitsVsPt" + histNames[charge]
-                                             , "NHits^{upper} - NHits^{lower} Vs p_{T}^{Upper}" + chargeNames[charge]
-                                             , 10, 0, 100, 61, -30.5, 30.5);
-      RegisterHisto(al_mon, m_delta_nHits->VsPt[charge]);
-
-      m_delta_nHits->VsEta[charge] = MakeHist("delta_nHitsVsEta" + histNames[charge]
-                                              , "NHits^{upper} - NHits^{lower} Vs #eta^{Upper}" + chargeNames[charge]
-                                              , 50, -2.1, 2.1, 61, -30.5, 30.5);
-      RegisterHisto(al_mon, m_delta_nHits->VsEta[charge]);
-    }
-
-    //========== charge
-    m_delta_charge->dTp[0] = MakeHist("delta_charge"
-                                      , "Charge^{upper} - Charge^{lower}; #Delta q"
-                                      , 5, -2.5, 2.5);
-    RegisterHisto(al_mon, m_delta_charge->dTp[0]);
-
-    m_delta_charge->VsD0[0] = MakeHist("delta_chargeVsD0"
-                                       , "Charge^{upper} - Charge^{lower} Vs d_{0}^{Upper}; d_{0} [mm]; #Delta q"
-                                       , 8, -1 * m_d0Range, m_d0Range, 5, -2.5, 2.5);
-    RegisterHisto(al_mon, m_delta_charge->VsD0[0]);
-
-    m_delta_charge->VsPhi0[0] = MakeHist("delta_chargeVsPhi0"
-                                         , "Charge^{upper} - Charge^{lower} Vs #phi_{0}^{Upper}; #phi [rad]; #Delta q"
-                                         , 8, -M_PI, m_upperPhi, 5, -2.5, 2.5);
-    RegisterHisto(al_mon, m_delta_charge->VsPhi0[0]);
-
-    m_delta_charge->VsZ0[0] = MakeHist("delta_chargeVsZ0"
-                                       , "Charge^{upper} - Charge^{lower} Vs z_{0}^{Upper}; z_{0} [mm]; #Delta q"
-                                       , 50, -500, 500, 5, -2.5, 2.5);
-    RegisterHisto(al_mon, m_delta_charge->VsZ0[0]);
-
-    m_delta_charge->VsPt[0] = MakeHist("delta_chargeVsPt"
-                                       , "Charge^{upper} - Charge^{lower} Vs p_{T}^{Upper}; p_{T} [GeV]; #Delta q"
-                                       , 10, 0, 100, 5, -2.5, 2.5);
-    RegisterHisto(al_mon, m_delta_charge->VsPt[0]);
-
-    m_delta_charge->VsEta[0] = MakeHist("delta_chargeVsEta"
-                                        , "Charge^{upper} - Charge^{lower} Vs #eta^{Upper}; #eta; #Delta q"
-                                        , 50, -2.1, 2.1, 5, -2.5, 2.5);
-    RegisterHisto(al_mon, m_delta_charge->VsEta[0]);
-
-    //========== Debugging
-    m_debug_phi0 = TH1F_LW::create("debug_phi0", "#phi_{0} difference for the closest tracks (no match req.) ", 10,
-                                   -M_PI, M_PI);
-    RegisterHisto(al_mon, m_debug_phi0);
-
-    m_debug_eta0 = TH1F_LW::create("debug_eta0", "#eta_{0} difference for the closest tracks (no match req.) ", 10,
-                                   -2.1, 2.1);
-    RegisterHisto(al_mon, m_debug_eta0);
-
-    //========== Pt
-    m_delta_pt = TH1F_LW::create("delta_pt", "P_{T}^{Low} - P_{T}^{Upper}", 100, -3.0, 3.0);
-    RegisterHisto(al_mon, m_delta_pt);
-    m_reldelta_pt = TH1F_LW::create("reldelta_pt", "P_{T}^{upper} - P_{T}^{lower}/P_{T}^{lower}", 100, -1.0, 1.0);
-    RegisterHisto(al_mon, m_reldelta_pt);
-
-    m_histosBooked++;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-// Register the histograms
-//---------------------------------------------------------------------------------------
-void IDAlignMonTrackSegments::RegisterHisto(MonGroup& mon, TH1F_LW* histo) {
-  //histo->Sumw2();//TK: fixme
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Cannot book TH1F_LW Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonTrackSegments::RegisterHisto(MonGroup& mon, TH2F_LW* histo) {
-  //histo->Sumw2();//TK: fixme
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Cannot book TH2F_LW Histogram:" << endmsg;
-  }
-}
-
-//---------------------------------------------------------------------------------------
-// fill the histograms
-//---------------------------------------------------------------------------------------
-StatusCode IDAlignMonTrackSegments::fillHistograms() {
-  m_events++;
-  //Get the track collections
-  const DataVector<Trk::Track>* tracksUpper(nullptr);
-  const DataVector<Trk::Track>* tracksLower(nullptr);
-
-  //if (false) {
-  //  std::cout << " -- SALVA -- IDAlignMonTrackSegments::fillHistograms -- START -- upper track collection = "<<
-  // m_upperTracksName.key() << std::endl
-  //	      << "                                                                 lower track collection = "<<
-  // m_lowerTracksName.key()
-  //	      << std::endl;
-  //}
-
-  if (not m_useCTBSplitTracks) {
-    //We only need the inputTracks if we're splitting them ourselves
-    //Split the tracks.
-    SG::ReadHandle<TrackCollection> tracksIn {
-      m_inputTracksName
-    };
-    if (not tracksIn.isValid()) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name " << m_inputTracksName.key() <<
-          " found in StoreGate" << endmsg;
-    } else {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved " << tracksIn->size() << " Input Tracks from StoreGate" <<
-        endmsg;
-    }
-    //if (false) {
-    //std::cout << " -- SALVA -- IDAlignMonTrackSegments::fillHistograms -- going to split tracks for track collection:
-    // " << m_inputTracksName.key()
-    //		<< " with size: " <<  tracksIn->size()
-    //		<< std::endl;
-    //}
-    //This records the upper and lower track collections to storeGate
-    m_trackSplitter->splitTracks(tracksIn.get());
-    //if (false) {
-    //std::cout << " -- SALVA -- IDAlignMonTrackSegments::fillHistograms -- track collection: " <<
-    // m_inputTracksName.key()
-    //		<< " (size: " <<  tracksIn->size() <<" ) splitting completed "
-    //		<< std::endl;
-    //}
-  }
-
-  //Get the Upper Tracks
-  SG::ReadHandle<TrackCollection> upperTracks {
-    m_upperTracksName
-  };
-  if (not upperTracks.isValid()) {
-    ATH_MSG_ERROR(m_upperTracksName << " could not be retrieved");
-    return StatusCode::RECOVERABLE;
-  }
-  tracksUpper = m_trackSelectionUpper->selectTracks(upperTracks);
-  if (!tracksUpper) {
-    ATH_MSG_DEBUG("TrackCollection with name " << m_upperTracksName.key() << " is NULL");
-  }
-
-  //Get the Lower Tracks
-  SG::ReadHandle<TrackCollection> lowerTracks {
-    m_lowerTracksName
-  };
-  if (not lowerTracks.isValid()) {
-    ATH_MSG_ERROR(m_lowerTracksName << " could not be retrieved");
-    return StatusCode::RECOVERABLE;
-  }
-  tracksLower = m_trackSelectionLower->selectTracks(lowerTracks);
-  if (!tracksLower) {
-    ATH_MSG_DEBUG("TrackCollection with name " << m_lowerTracksName << " is NULL");
-  }
-
-  //if (false) {
-  //std::cout << " -- SALVA -- IDAlignMonTrackSegments::fillHistograms -- retrieve upper and lower track segments that
-  // satisfy the track selection " << std::endl
-  //	      << "                                                     upper track collection = "<< m_upperTracksName <<
-  // "   size: " << tracksUpper->size() << std::endl
-  //	      << "                                                     lower track collection = "<< m_lowerTracksName <<
-  // "   size: " << tracksLower->size()
-  //	      << std::endl;
-  //}
-  //at this point, tracksUpper and tracksLower must have sensible values
-  if ((not tracksUpper)or(not tracksLower)) {
-    ATH_MSG_ERROR("Upper or Lower tracks pointer is null, must terminate!");
-    return StatusCode::FAILURE;
-  }
-  ATH_MSG_DEBUG("Retrieved " << tracksUpper->size() << " Upper Tracks.");
-  ATH_MSG_DEBUG("Retrieved " << tracksLower->size() << " Lower Tracks from Track from StoreGate");
-
-  //===============================================================
-  // Filling the upper and lower tracks and their differences
-  //===============================================================
-
-  //looping over the upper barrel tracks
-  int nTracksUpper = 0;
-
-  DataVector<Trk::Track>::const_iterator trackItrUpper = tracksUpper->begin();
-  DataVector<Trk::Track>::const_iterator trackItrUpperE = tracksUpper->end();
-  for (; trackItrUpper != trackItrUpperE; ++trackItrUpper) {
-    const Trk::Track* trackUpper = *trackItrUpper;
-    if (trackUpper == nullptr) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No associated Trk::Track object found for track " << nTracksUpper <<
-        endmsg;
-      continue;
-    } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Got the " << nTracksUpper << " Upper Track" << endmsg;
-
-    std::unique_ptr<Trk::TrackSummary> summary = m_trackSumTool->summary(*trackUpper);
-    unsigned int nHitsPixUp = 0;
-    unsigned int nHitsSCTUp = 0;
-    unsigned int nHitsTRTUp = 0;
-    nHitsPixUp = summary->get(Trk::numberOfPixelHits);
-    nHitsSCTUp = summary->get(Trk::numberOfSCTHits);
-    nHitsTRTUp = summary->get(Trk::numberOfTRTHits);
-    unsigned int nHitsUp = nHitsPixUp + nHitsSCTUp + nHitsTRTUp;
-
-
-    const Trk::Perigee* measUpperPer = trackUpper->perigeeParameters();
-    const AmgSymMatrix(5) * covariance = measUpperPer ? measUpperPer->covariance() : nullptr;
-
-    float d0Up = -999.;
-    float d0UpErr = -999.;
-    float phi0Up = -999.;
-    float phi0UpErr = -999.;
-    float thetaUp = -999.;
-    float thetaUpErr = -999.;
-    float eta0Up = -999.;
-    float eta0UpErr = -999.;
-    float z0Up = -999.;
-    float z0UpErr = -999.;
-    float qOverPtUp = -999.;
-    float qOverPUpErr = -999.;
-    float qOverPtUpErr2 = -999.;
-    float qOverPtUpErr = -999.;
-    float chargeUp = -999.;
-    float ptUp = -999.;
-
-    //control on the measUpperPer!
-    //Get the track parameters
-    if (covariance != nullptr) {
-      d0Up = measUpperPer->parameters()[Trk::d0];
-      d0UpErr = Amg::error(*measUpperPer->covariance(), Trk::d0);
-
-      phi0Up = measUpperPer->parameters()[Trk::phi0];
-      phi0UpErr = Amg::error(*measUpperPer->covariance(), Trk::phi0);
-
-      thetaUp = measUpperPer->parameters()[Trk::theta];
-      thetaUpErr = Amg::error(*measUpperPer->covariance(), Trk::theta);
-
-      eta0Up = measUpperPer->eta();
-      eta0UpErr = 0.5 * 1.0 / sin(0.5 * thetaUp) * 1.0 / cos(0.5 * thetaUp) * thetaUpErr;
-
-      z0Up = measUpperPer->parameters()[Trk::z0];
-      z0UpErr = Amg::error(*measUpperPer->covariance(), Trk::z0);
-
-      qOverPtUp = measUpperPer->parameters()[Trk::qOverP] * 1000 / sin(thetaUp);
-      qOverPUpErr = Amg::error(*measUpperPer->covariance(), Trk::qOverP);
-
-      qOverPtUpErr2 = pow(1000 / sin(thetaUp) * qOverPUpErr, 2) + pow(qOverPtUp / tan(thetaUp) * thetaUpErr, 2);
-      qOverPtUpErr = pow(qOverPtUpErr2, 0.5);
-
-      chargeUp = measUpperPer->charge();
-      ptUp = measUpperPer->pT() / 1000.;
-    } else {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Measured Upper Perigee not retrieved" << endmsg;
-    }
-
-    //if (false) {
-    //  std::cout << " -- SALVA -- IDAlignMonTrackSegments::fillHistograms() -- upper hits: Pix << " << nHitsPixUp
-    //		<< "  SCT " <<  nHitsSCTUp
-    //		<< "  TRT " << nHitsTRTUp
-    //		<< "  FILLING "
-    //		<< std::endl;
-    //}
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Filling Upper info" << endmsg;
-    m_upper_hist->nhitstrt->Fill(nHitsTRTUp);
-    m_upper_hist->nhitsSi->Fill(nHitsSCTUp + nHitsPixUp);
-    m_upper_hist->nhitsPix->Fill(nHitsPixUp);
-    m_upper_hist->nhitsSct->Fill(nHitsSCTUp);
-    m_upper_hist->phi0->Fill(phi0Up);
-    m_upper_hist->z0->Fill(z0Up);
-    m_upper_hist->d0->Fill(d0Up);
-    m_upper_hist->eta0->Fill(eta0Up);
-    m_upper_hist->qOverPt->Fill(qOverPtUp);
-    m_upper_hist->pt->Fill(ptUp);
-
-    //trackStateOnSurfaces is a vector of Trk::TrackStateOnSurface objects which contain information
-    //on track at each (inner)detector surface it crosses eg hit used to fit track
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Track Upper = " << nTracksUpper << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Upper Track Eta = " << eta0Up << ", phi = " << phi0Up << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Upper Track Pix = " << nHitsPixUp << ", SCT = " << nHitsSCTUp << ", TRT = " << nHitsTRTUp << endmsg;
-
-    float mindR = 10000;
-    float Matched_Low_d0 = -99;
-    float Matched_Low_d0_Err = -99;
-    float Matched_Low_phi0 = -99;
-    float Matched_Low_phi0_Err = -99;
-    float Matched_Low_qOverPt = -99;
-    float Matched_Low_qOverPt_Err = -99;
-    float Matched_Low_eta0 = -99;
-    float Matched_Low_eta0_Err = -99;
-    float Matched_Low_z0 = -99;
-    float Matched_Low_z0_Err = -99;
-    float Matched_Low_charge = -99;
-    float Matched_Low_pt = -99;
-    unsigned int nHitsLow = 0;
-    bool matchFound = false;
-
-    int nTracksLower = 0;
-    DataVector<Trk::Track>::const_iterator trackItrLower = tracksLower->begin();
-    DataVector<Trk::Track>::const_iterator trackItrLowerE = tracksLower->end();
-    for (; trackItrLower != trackItrLowerE; ++trackItrLower) { //looping over Lower tracks
-      const Trk::Track* trackLower = *trackItrLower;
-      if (trackLower == nullptr) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No associated Trk::Track object found for track " << nTracksLower << endmsg;
-        continue;
-      }
-
-      std::unique_ptr<Trk::TrackSummary> summary = m_trackSumTool->summary(*trackLower);
-      unsigned int nHitsPixLow = 0;
-      unsigned int nHitsSCTLow = 0;
-      unsigned int nHitsTRTLow = 0;
-      nHitsPixLow = summary->get(Trk::numberOfPixelHits);
-      nHitsSCTLow = summary->get(Trk::numberOfSCTHits);
-      nHitsTRTLow = summary->get(Trk::numberOfTRTHits);
-      nHitsLow = nHitsPixLow + nHitsSCTLow + nHitsTRTLow;
-
-
-      const Trk::Perigee* measLowerPer = trackLower->perigeeParameters();
-      const AmgSymMatrix(5) * covariance = measLowerPer ? measLowerPer->covariance() : nullptr;
-
-      float d0Low = -999.;
-      float d0LowErr = -999.;
-      float phi0Low = -999.;
-      float phi0LowErr = -999.;
-      float thetaLow = -999.;
-      float thetaLowErr = -999.;
-      float eta0Low = -999.;
-      float eta0LowErr = -999.;
-      float z0Low = -999.;
-      float z0LowErr = -999.;
-      float qOverPtLow = -999.;
-      float qOverPLowErr = -999.;
-      float qOverPtLowErr2 = -999.;
-      float qOverPtLowErr = -999.;
-      float chargeLow = -999.;
-      float ptLow = -999.;
-
-      if (covariance != nullptr) {
-        d0Low = measLowerPer->parameters()[Trk::d0];
-        d0LowErr = Amg::error(*measLowerPer->covariance(), Trk::d0);
-        phi0Low = measLowerPer->parameters()[Trk::phi0];
-        phi0LowErr = Amg::error(*measLowerPer->covariance(), Trk::phi0);
-        thetaLow = measLowerPer->parameters()[Trk::theta];
-        thetaLowErr = Amg::error(*measLowerPer->covariance(), Trk::theta);
-        eta0Low = measLowerPer->eta();
-        eta0LowErr = 0.5 * 1.0 / sin(0.5 * thetaLow) * 1.0 / cos(0.5 * thetaLow) * thetaLowErr;
-        z0Low = measLowerPer->parameters()[Trk::z0];
-        z0LowErr = Amg::error(*measLowerPer->covariance(), Trk::z0);
-        qOverPtLow = measLowerPer->parameters()[Trk::qOverP] * 1000 / sin(thetaLow);
-        qOverPLowErr = Amg::error(*measLowerPer->covariance(), Trk::qOverP);
-        qOverPtLowErr2 = pow(1000 / sin(thetaLow) * qOverPLowErr, 2) + pow(qOverPtLow / tan(thetaLow) * thetaLowErr, 2);
-        qOverPtLowErr = pow(qOverPtLowErr2, 0.5);
-        chargeLow = measLowerPer->charge();
-        ptLow = measLowerPer->pT() / 1000.;
-      } else {
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Measured Lower Perigee not retrieved" << endmsg;
-      }
-
-
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Lower Track = " << nTracksLower << endmsg;
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Lower Track Eta = " << eta0Low << ", phi = " << phi0Low << endmsg;
-
-      if (nTracksUpper == 0) {//only fill the lower tracks once
-        m_lower_hist->nhitstrt->Fill(nHitsTRTLow);
-        m_lower_hist->nhitsSi->Fill(nHitsSCTLow + nHitsPixLow);
-        m_lower_hist->nhitsPix->Fill(nHitsPixLow);
-        m_lower_hist->nhitsSct->Fill(nHitsSCTLow);
-
-        m_lower_hist->phi0->Fill(phi0Low);
-        m_lower_hist->z0->Fill(z0Low);
-        m_lower_hist->d0->Fill(d0Low);
-        m_lower_hist->eta0->Fill(eta0Low);
-        m_lower_hist->qOverPt->Fill(qOverPtLow);
-        m_lower_hist->pt->Fill(ptLow);
-      }//Fill lower tracks once
-
-      //selecting Lower track that is closest to Upper in eta-phi
-      float dphi2 = (phi0Up - phi0Low) * (phi0Up - phi0Low);
-
-      //For TRT only tracks we will ignore the delta eta
-      // and just require a delta phi match
-      float deta2 = (eta0Up - eta0Low) * (eta0Up - eta0Low);
-
-      float dR = sqrt(dphi2 + deta2);
-      if (dR < mindR) {
-        mindR = dR;
-        Matched_Low_d0 = d0Low;
-        Matched_Low_d0_Err = d0LowErr;
-        Matched_Low_phi0 = phi0Low;
-        Matched_Low_phi0_Err = phi0LowErr;
-        Matched_Low_eta0 = eta0Low;
-        Matched_Low_eta0_Err = eta0LowErr;
-        Matched_Low_z0 = z0Low;
-        Matched_Low_z0_Err = z0LowErr;
-        Matched_Low_qOverPt = qOverPtLow;
-        Matched_Low_qOverPt_Err = qOverPtLowErr;
-        Matched_Low_charge = chargeLow;
-        Matched_Low_pt = ptLow;
-
-        if (dR < m_matchedRcut) matchFound = true;
-      }
-
-      nTracksLower++;
-    }//looping over lower tracks
-
-    m_debug_phi0->Fill(phi0Up - Matched_Low_phi0);
-    m_debug_eta0->Fill(eta0Up - Matched_Low_eta0);
-
-    if (matchFound) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "there was a match found " << endmsg;
-
-      for (unsigned int charge = 0; charge < 3; ++charge) {
-        //Skip the postive hist for negative tracks
-        if (charge == 1 && chargeUp < 0) continue;
-
-        //Skip the negative hist for postive tracks
-        if (charge == 2 && chargeUp > 0) continue;
-
-        //===== D0
-        m_delta_d0->dTp[charge]->Fill(d0Up - Matched_Low_d0);
-        m_delta_d0->dTpPull[charge]->Fill((d0Up - Matched_Low_d0) / pow(pow(d0UpErr, 2) + pow(Matched_Low_d0_Err, 2), 0.5));
-        m_delta_d0->VsD0[charge]->Fill(d0Up, d0Up - Matched_Low_d0);
-        m_delta_d0->VsPhi0[charge]->Fill(phi0Up, d0Up - Matched_Low_d0);
-        m_delta_d0->VsPt[charge]->Fill(ptUp, d0Up - Matched_Low_d0);
-        m_delta_d0->VsEta[charge]->Fill(eta0Up, d0Up - Matched_Low_d0);
-        m_delta_d0->VsZ0[charge]->Fill(z0Up, d0Up - Matched_Low_d0);
-
-        //===== Z0
-        m_delta_z0->dTp[charge]->Fill(z0Up - Matched_Low_z0);
-        m_delta_z0->dTpPull[charge]->Fill((z0Up - Matched_Low_z0) / pow(pow(z0UpErr, 2) + pow(Matched_Low_z0_Err, 2), 0.5));
-        m_delta_z0->VsD0[charge]->Fill(d0Up, z0Up - Matched_Low_z0);
-        m_delta_z0->VsPhi0[charge]->Fill(phi0Up, z0Up - Matched_Low_z0);
-        m_delta_z0->VsPt[charge]->Fill(ptUp, z0Up - Matched_Low_z0);
-        m_delta_z0->VsEta[charge]->Fill(eta0Up, z0Up - Matched_Low_z0);
-        m_delta_z0->VsZ0[charge]->Fill(z0Up, z0Up - Matched_Low_z0);
-
-        //===== Phi0
-        m_delta_phi0->dTp[charge]->Fill(phi0Up - Matched_Low_phi0);
-        m_delta_phi0->dTpPull[charge]->Fill((phi0Up - Matched_Low_phi0) / pow(pow(phi0UpErr, 2) + pow(Matched_Low_phi0_Err, 2), 0.5));
-        m_delta_phi0->VsD0[charge]->Fill(d0Up, phi0Up - Matched_Low_phi0);
-        m_delta_phi0->VsPhi0[charge]->Fill(phi0Up, phi0Up - Matched_Low_phi0);
-        m_delta_phi0->VsPt[charge]->Fill(ptUp, phi0Up - Matched_Low_phi0);
-        m_delta_phi0->VsEta[charge]->Fill(eta0Up, phi0Up - Matched_Low_phi0);
-        m_delta_phi0->VsZ0[charge]->Fill(z0Up, phi0Up - Matched_Low_phi0);
-
-        //===== eta0
-        m_delta_eta0->dTp[charge]->Fill(eta0Up - Matched_Low_eta0);
-        m_delta_eta0->dTpPull[charge]->Fill((eta0Up - Matched_Low_eta0) / pow(pow(eta0UpErr, 2) + pow(Matched_Low_eta0_Err, 2), 0.5));
-        m_delta_eta0->VsD0[charge]->Fill(d0Up, eta0Up - Matched_Low_eta0);
-        m_delta_eta0->VsPhi0[charge]->Fill(phi0Up, eta0Up - Matched_Low_eta0);
-        m_delta_eta0->VsPt[charge]->Fill(ptUp, eta0Up - Matched_Low_eta0);
-        m_delta_eta0->VsEta[charge]->Fill(eta0Up, eta0Up - Matched_Low_eta0);
-        m_delta_eta0->VsZ0[charge]->Fill(z0Up, eta0Up - Matched_Low_eta0);
-
-        //====== qOverPt
-        m_delta_qOverPt->dTp[charge]->Fill(qOverPtUp - Matched_Low_qOverPt);
-        m_delta_qOverPt->dTpPull[charge]->Fill((qOverPtUp - Matched_Low_qOverPt) / pow(pow(qOverPtUpErr, 2) + pow(Matched_Low_qOverPt_Err, 2), 0.5));
-        m_delta_qOverPt->VsD0[charge]->Fill(d0Up, qOverPtUp - Matched_Low_qOverPt);
-        m_delta_qOverPt->VsPhi0[charge]->Fill(phi0Up, qOverPtUp - Matched_Low_qOverPt);
-        m_delta_qOverPt->VsPt[charge]->Fill(ptUp, qOverPtUp - Matched_Low_qOverPt);
-        m_delta_qOverPt->VsEta[charge]->Fill(eta0Up, qOverPtUp - Matched_Low_qOverPt);
-        m_delta_qOverPt->VsZ0[charge]->Fill(z0Up, qOverPtUp - Matched_Low_qOverPt);
-
-        //====== PtqOverPt
-        float ptUpperDeltaQOverPt = ptUp * (qOverPtUp - Matched_Low_qOverPt);
-        m_delta_PtqOverPt->dTp[charge]->Fill(ptUpperDeltaQOverPt);
-        m_delta_PtqOverPt->dTpPull[charge]->Fill(ptUp * ((qOverPtUp - Matched_Low_qOverPt) / pow(pow(qOverPtUpErr, 2) + pow(Matched_Low_qOverPt_Err, 2), 0.5)));
-        m_delta_PtqOverPt->VsD0[charge]->Fill(d0Up, ptUpperDeltaQOverPt);
-        m_delta_PtqOverPt->VsPhi0[charge]->Fill(phi0Up, ptUpperDeltaQOverPt);
-        m_delta_PtqOverPt->VsPt[charge]->Fill(ptUp, ptUpperDeltaQOverPt);
-        m_delta_PtqOverPt->VsEta[charge]->Fill(eta0Up, ptUpperDeltaQOverPt);
-        m_delta_PtqOverPt->VsZ0[charge]->Fill(z0Up, ptUpperDeltaQOverPt);
-
-        //===== nHits
-        m_delta_nHits->dTp[charge]->Fill((int) (nHitsUp - nHitsLow));
-        m_delta_nHits->VsD0[charge]->Fill(d0Up, (int) (nHitsUp - nHitsLow));
-        m_delta_nHits->VsPhi0[charge]->Fill(phi0Up, (int) (nHitsUp - nHitsLow));
-        m_delta_nHits->VsPt[charge]->Fill(ptUp, (int) (nHitsUp - nHitsLow));
-        m_delta_nHits->VsEta[charge]->Fill(eta0Up, (int) (nHitsUp - nHitsLow));
-        m_delta_nHits->VsZ0[charge]->Fill(z0Up, (int) (nHitsUp - nHitsLow));
-      }
-
-      //===== charge
-      m_delta_charge->dTp[0]->Fill(chargeUp - Matched_Low_charge);
-      m_delta_charge->VsD0[0]->Fill(d0Up, chargeUp - Matched_Low_charge);
-      m_delta_charge->VsPhi0[0]->Fill(phi0Up, chargeUp - Matched_Low_charge);
-      m_delta_charge->VsPt[0]->Fill(ptUp, chargeUp - Matched_Low_charge);
-      m_delta_charge->VsEta[0]->Fill(eta0Up, chargeUp - Matched_Low_charge);
-      m_delta_charge->VsZ0[0]->Fill(z0Up, chargeUp - Matched_Low_charge);
-
-      //pT
-      m_delta_pt->Fill(ptUp - Matched_Low_pt);
-      m_reldelta_pt->Fill((ptUp - Matched_Low_pt) / Matched_Low_pt);
-    }//match found
-
-    nTracksUpper++;
-  }//looping over upper tracks
-
-  delete tracksLower;
-  delete tracksUpper;
-  //if (true) {
-  //std::cout << " -- SALVA -- IDAlignMonTrackSegments::fillHistograms -- COMPLETED -- "<< m_upperTracksName << " size:
-  // " << tracksUpper->size()
-  //	      << "    "<< m_lowerTracksName << " size: " << tracksLower->size()
-  //	      << std::endl;
-  //}
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-// initializing tools
-//---------------------------------------------------------------------------------------
-StatusCode IDAlignMonTrackSegments::setupTools() {
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In setupTools()" << endmsg;
-
-  if (m_trackSplitter.empty()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No track splitter tool configured" << endmsg;
-  } else if (m_trackSplitter.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not retrieve " << m_trackSplitter.typeAndName() << endmsg;
-  } else if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Retrieved tool " << m_trackSplitter.typeAndName() << endmsg;
-
-  // get TrackSummaryTool
-  if (m_trackSumTool.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve tool " << m_trackSumTool << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSumTool << endmsg;
-  }
-
-  //Get TrackSelectionTools
-
-  if (m_trackSelectionUpper.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Can not retrieve TrackSelection tool of type "
-                                                << m_trackSelectionUpper.typeAndName() << endmsg;
-    return StatusCode::SUCCESS;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSelectionUpper.typeAndName() << endmsg;
-
-  if (m_trackSelectionLower.retrieve().isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Can not retrieve TrackSelection tool of type "
-                                                << m_trackSelectionLower.typeAndName() << endmsg;
-    return StatusCode::SUCCESS;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSelectionLower.typeAndName() << endmsg;
-
-
-  return StatusCode::SUCCESS;
-}
-
-/** Make Histograms */
-TH1F_LW* IDAlignMonTrackSegments::MakeHist(const std::string& name, const std::string& title, int nBins, float xLow, float xUp, const std::string& xAxisTitle, const std::string& yAxisTitle) {
-  TH1F_LW* hist = TH1F_LW::create(name.c_str(), title.c_str(), nBins, xLow, xUp);
-
-  hist->SetMinimum(0);
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->GetXaxis()->SetTitle(xAxisTitle.c_str());
-  hist->GetYaxis()->SetTitle(yAxisTitle.c_str());
-  return hist;
-}
-
-/** Make Histograms */
-TH2F_LW* IDAlignMonTrackSegments::MakeHist(const std::string& name, const std::string& title, int nXBins, float xLow, float xUp, int nYBins, float yLow, float yUp, const std::string& xAxisTitle, const std::string& yAxisTitle) {
-  TH2F_LW* hist = TH2F_LW::create(name.c_str(), title.c_str(), nXBins, xLow, xUp, nYBins, yLow, yUp);
-
-  hist->SetMinimum(0);
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->GetXaxis()->SetTitle(xAxisTitle.c_str());
-  hist->GetYaxis()->SetTitle(yAxisTitle.c_str());
-  return hist;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h
deleted file mode 100644
index 3d4a2be444c57f07357acb484697875abd9ca5e4..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef IDAlignMonTrackSegments_H
-#define IDAlignMonTrackSegments_H
-
-// **********************************************************************
-// IDAlignMonTrackSegments.cxx
-// AUTHORS: John Alison (john.alison@cern.ch) johnda
-//          Ben Cooper
-//          Tobias Golling
-// **********************************************************************
-
-#include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "EventPrimitives/EventPrimitivesHelpers.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "TrkToolInterfaces/ITrackSummaryTool.h"
-#include "TrkTrack/TrackCollection.h"
-
-class TH1F_LW;
-class TH2F_LW;
-
-class AtlasDetectorID;
-class PixelID;
-
-namespace InDetAlignMon {
-  class TrackSelectionTool;
-}
-
-namespace Trk {
-//  class ITrackSummaryTool;
-  class Track;
-  class TrackStateOnSurface;
-}
-
-namespace InDet {
-  class IInDetTrackSplitterTool;
-}
-
-class IDAlignMonTrackSegments: public ManagedMonitorToolBase
-{
-public:
-  IDAlignMonTrackSegments(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~IDAlignMonTrackSegments();
-
-  virtual StatusCode initialize();
-
-  virtual StatusCode bookHistograms();
-  virtual StatusCode fillHistograms();
-  //virtual StatusCode procHistograms();
-  void RegisterHisto(MonGroup& mon, TH1F_LW* histo);
-  void RegisterHisto(MonGroup& mon, TH2F_LW* histo);
-protected:
-private:
-  StatusCode setupTools();
-  static TH1F_LW* MakeHist(const std::string& name, const std::string& title, int nBins, float xLow, float xUp,
-                           const std::string& xAxisTitle = "", const std::string& yAxisTitle = "");
-  static TH2F_LW* MakeHist(const std::string& name, const std::string& title, int nXBins, float xLow, float xUp,
-                           int nYBins, float yLow, float yUp, const std::string& xAxisTitle = "",
-                           const std::string& yAxisTitle = "");
-  void InitializeHistograms();
-  std::string m_stream;
-  SG::ReadHandleKey<TrackCollection> m_inputTracksName {
-    this, "InputTracksName", "InDetCosmic_Tracks"
-  };
-  SG::ReadHandleKey<TrackCollection> m_upperTracksName {
-    this, "UpperTracksName", "InDetCosmic_Tracks_Upper"
-  };
-  SG::ReadHandleKey<TrackCollection> m_lowerTracksName {
-    this, "LowerTracksName", "InDetCosmic_Tracks_Lower"
-  };
-
-  float m_matchedRcut;
-  int m_events;
-  int m_histosBooked;
-
-  //tools
-  ToolHandle<Trk::ITrackSummaryTool> m_trackSumTool;
-  ToolHandle<InDet::IInDetTrackSplitterTool> m_trackSplitter;
-  ToolHandle<InDetAlignMon::TrackSelectionTool> m_trackSelectionUpper;
-  ToolHandle<InDetAlignMon::TrackSelectionTool> m_trackSelectionLower;
-
-  bool m_useCTBSplitTracks;
-  float m_deltaD0Range;
-  float m_deltaD0Range2D;
-  float m_deltaPhiRange;
-  float m_deltaPhiRange2D;
-  float m_deltaQoverPtRange;
-  float m_deltaQoverPtRange2D;
-  float m_deltaPtQoverPtRange;
-  float m_deltaPtQoverPtRange2D;
-  float m_deltaZ0Range;
-  float m_d0Range;
-  float m_upperPhi;
-  std::string m_triggerChainName;
-
-  // Histograms
-  //=============
-
-  // Upper And Lower Histograms
-  struct UpperLowerHistograms;
-  UpperLowerHistograms* m_upper_hist;
-  UpperLowerHistograms* m_lower_hist;
-
-  // Difference in Track Parameters
-  struct DeltaTrackParamHistograms;
-  DeltaTrackParamHistograms* m_delta_d0;
-  DeltaTrackParamHistograms* m_delta_z0;
-  DeltaTrackParamHistograms* m_delta_phi0;
-  DeltaTrackParamHistograms* m_delta_eta0;
-  DeltaTrackParamHistograms* m_delta_qOverPt;
-  DeltaTrackParamHistograms* m_delta_PtqOverPt;
-  DeltaTrackParamHistograms* m_delta_nHits;
-  DeltaTrackParamHistograms* m_delta_charge;
-
-  // Debuging
-  TH1F_LW* m_debug_phi0 {};
-  TH1F_LW* m_debug_eta0 {};
-
-  // pt
-  TH1F_LW* m_delta_pt {};
-  TH1F_LW* m_reldelta_pt {};
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx
deleted file mode 100644
index c2b6dd9d7e8b986c612addc88784f26259830ac9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx
+++ /dev/null
@@ -1,954 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// IDAlignMonTruthComparison.cxx
-// AUTHORS: Beate Heinemann, Tobias Golling
-// **********************************************************************
-
-#include <sstream>
-#include <cmath>
-#include "TH1.h"
-#include "TH2.h"
-#include "TProfile.h"
-#include "TMath.h"
-#include "TROOT.h"
-
-#include "GaudiKernel/MsgStream.h"
-
-#include "AtlasHepMC/GenParticle.h"
-
-#include "TrkTruthData/TrackTruth.h"
-#include "InDetRIO_OnTrack/SiClusterOnTrack.h"
-#include "InDetPrepRawData/SiCluster.h"
-
-
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkEventPrimitives/LocalParameters.h"
-
-#include "IDAlignMonTruthComparison.h"
-
-#include "TrkToolInterfaces/ITruthToTrack.h"
-#include "TrackSelectionTool.h"
-
-// *********************************************************************
-// Public Methods
-// *********************************************************************
-
-IDAlignMonTruthComparison::IDAlignMonTruthComparison(const std::string& type, const std::string& name,
-                                                     const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent) {
-
-  declareProperty("CheckRate", m_checkrate = 1000);
-  declareProperty("TruthToTrackTool", m_truthToTrack = ToolHandle<Trk::ITruthToTrack>("Trk::TruthToTrack/InDetTruthToTrack"));
-  declareProperty("trackSelection", m_trackSelection = ToolHandle<InDetAlignMon::TrackSelectionTool>("InDetAlignMon::TrackSelectionTool"));
-}
-
-IDAlignMonTruthComparison::~IDAlignMonTruthComparison() = default;
-
-
-StatusCode IDAlignMonTruthComparison::initialize() {
-  StatusCode sc;
-
-  sc = ManagedMonitorToolBase::initialize();
-  if (!sc.isSuccess()) return sc;
-
-
-  // AG: init truthToTrack
-  if (m_truthToTrack.retrieve().isFailure()) {
-    msg(MSG::FATAL) << "Failed to retrieve tool " << m_truthToTrack << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_truthToTrack << endmsg;
-  }
-
-  // AG: init trackSelection
-  if (m_trackSelection.retrieve().isFailure()) {
-    msg(MSG::FATAL) << "Failed to retrieve tool " << m_trackSelection << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_trackSelection << endmsg;
-  }
-
-  ATH_CHECK(m_tracksName.initialize());
-  ATH_CHECK(m_tracksTruthName.initialize());
-
-  return sc;
-}
-
-StatusCode IDAlignMonTruthComparison::bookHistograms() {
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    // book histograms that are only made in the online environment...
-  }
-
-  if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-    // book histograms that are only relevant for cosmics data...
-  }
-
-  std::string outputDirName = "IDAlignMon/" + m_tracksName.key() + "_NoTriggerSelection/TruthComparison";
-  MonGroup al_mon(this, outputDirName, run);
-
-  if (newRunFlag()) {
-    // increase d0 and z0 range for cosmics
-    if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-      m_dz0_barrel = new TH1F("dz0_barrel", "Delta z0(Rec - truth)", 1000, -2000, 2000);
-      m_dz0_eca = new TH1F("dz0_eca", "Delta z0(Rec - truth)", 1000, -2000, 2000);
-      m_dz0_ecc = new TH1F("dz0_ecc", "Delta z0(Rec - truth)", 1000, -2000, 2000);
-      m_dd0_barrel = new TH1F("dd0_barrel", "Delta d0(Rec - truth)", 1000, -1000, 1000);
-      m_dd0_eca = new TH1F("dd0_eca", "Delta d0(Rec - truth)", 1000, -1000, 1000);
-      m_dd0_ecc = new TH1F("dd0_ecc", "Delta d0(Rec - truth)", 1000, -1000, 1000);
-    } else {
-      m_dz0_barrel = new TH1F("dz0_barrel", "Delta z0(Rec - truth)", 100, -2, 2);
-      m_dz0_eca = new TH1F("dz0_eca", "Delta z0(Rec - truth)", 100, -2, 2);
-      m_dz0_ecc = new TH1F("dz0_ecc", "Delta z0(Rec - truth)", 100, -2, 2);
-      m_dd0_barrel = new TH1F("dd0_barrel", "Delta d0(Rec - truth)", 100, -1, 1);
-      m_dd0_eca = new TH1F("dd0_eca", "Delta d0(Rec - truth)", 100, -1, 1);
-      m_dd0_ecc = new TH1F("dd0_ecc", "Delta d0(Rec - truth)", 100, -1, 1);
-    }
-
-    m_truthpT = new TH1F("truthpT", "pT truth", 100, 0, 100);
-    RegisterHisto(al_mon, m_truthpT);
-    m_truthphi = new TH1F("truthphi", "phi truth", 100, 0, 6.3);
-    RegisterHisto(al_mon, m_truthphi);
-    m_trutheta = new TH1F("trutheta", "eta truth", 100, -5, 5);
-    RegisterHisto(al_mon, m_trutheta);
-
-    m_dqopt_barrel = new TH1F("dqopt_barrel", "Delta QopT(Rec - truth)", 500, -0.05, 0.05);
-    RegisterHisto(al_mon, m_dqopt_barrel);
-    m_dqopt_eca = new TH1F("dqopt_eca", "Delta QopT(Rec - truth)", 500, -0.05, 0.05);
-    RegisterHisto(al_mon, m_dqopt_eca);
-    m_dqopt_ecc = new TH1F("dqopt_ecc", "Delta QopT(Rec - truth)", 500, -0.05, 0.05);
-    RegisterHisto(al_mon, m_dqopt_ecc);
-
-    m_deta_barrel = new TH1F("deta_barrel", "Delta eta(Rec - truth)", 100, -0.02, 0.02);
-    RegisterHisto(al_mon, m_deta_barrel);
-    m_deta_eca = new TH1F("deta_eca", "Delta eta(Rec - truth)", 100, -0.02, 0.02);
-    RegisterHisto(al_mon, m_deta_eca);
-    m_deta_ecc = new TH1F("deta_ecc", "Delta eta(Rec - truth)", 100, -0.02, 0.02);
-    RegisterHisto(al_mon, m_deta_ecc);
-
-    m_dphi_barrel = new TH1F("dphi_barrel", "Delta phi(Rec - truth)", 100, -0.01, 0.01);
-    RegisterHisto(al_mon, m_dphi_barrel);
-    m_dphi_barrel_vs_phi = new TProfile("dphi_barrel_vs_phi", "Delta phi(Rec - truth) vs truth phi, eta < 1.0", 60, 0,
-                                        6.28, -0.1, 0.1);
-    RegisterHisto(al_mon, m_dphi_barrel_vs_phi);
-    m_dphi_eca = new TH1F("dphi_eca", "Delta phi(Rec - truth)", 100, -0.01, 0.01);
-    RegisterHisto(al_mon, m_dphi_eca);
-    m_dphi_ecc = new TH1F("dphi_ecc", "Delta phi(Rec - truth)", 100, -0.01, 0.01);
-    RegisterHisto(al_mon, m_dphi_ecc);
-    m_dphi_vs_eta = new TProfile("dphi_vs_eta", "Delta phi(Rec - truth) vs truth eta", 60, -2.5, 2.5, -0.1, 0.1);
-    RegisterHisto(al_mon, m_dphi_vs_eta);
-
-    RegisterHisto(al_mon, m_dz0_barrel);
-    RegisterHisto(al_mon, m_dz0_eca);
-    RegisterHisto(al_mon, m_dz0_ecc);
-
-    RegisterHisto(al_mon, m_dd0_barrel);
-    RegisterHisto(al_mon, m_dd0_eca);
-    RegisterHisto(al_mon, m_dd0_ecc);
-
-
-    // Deta vs eta
-    m_Deta_vs_eta = new TH2F("Deta_vs_eta", "eta(Rec - truth) vs. eta", 20, -2.5, 2.5, 100, -0.05, 0.05);
-    RegisterHisto(al_mon, m_Deta_vs_eta);
-    m_deta_vs_eta_1 = new TH1F("deta_vs_eta_1", "Mean eta(Rec - truth) vs. eta", 20, -2.5, 2.5);
-    RegisterHisto(al_mon, m_deta_vs_eta_1);
-    m_deta_vs_eta_2 = new TH1F("deta_vs_eta_2", "RMS eta(Rec - truth) vs. eta", 20, -2.5, 2.5);
-    //RegisterHisto(al_mon,m_deta_vs_eta_2) ;
-    m_deta_vs_eta_chi2 = new TH1F("deta_vs_eta_chi2", "Chi2/NDOF eta(Rec - truth) vs. eta", 20, -2.5, 2.5);
-    RegisterHisto(al_mon, m_deta_vs_eta_chi2);
-
-
-    // vs pT
-    m_Dqopt_vs_pt_barrel = new TH2F("Dqopt_vs_pt_barrel", "QopT(Rec - truth) vs. signed pT (Barrel)", 50, -100, 100, 20,
-                                    -0.1, 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_pt_barrel);
-    m_dqopt_vs_pt_barrel_1 = new TH1F("dqopt_vs_pt_barrel_1", "Mean QopT(Rec - truth) vs. signed pT (Barrel)", 50, -100,
-                                      100);
-    RegisterHisto(al_mon, m_dqopt_vs_pt_barrel_1);
-    m_dqopt_vs_pt_barrel_2 = new TH1F("dqopt_vs_pt_barrel_2", "RMS QopT(Rec - truth) vs. signed pT (Barrel)", 50, -100,
-                                      100);
-    //RegisterHisto(al_mon,m_dqopt_vs_pt_barrel_2) ;
-    m_dqopt_vs_pt_barrel_chi2 = new TH1F("dqopt_vs_pt_barrel_chi2",
-                                         "Chi2/NDOF QopT(Rec - truth) vs. signed pT (Barrel)", 50, -100, 100);
-    RegisterHisto(al_mon, m_dqopt_vs_pt_barrel_chi2);
-    m_dpt_vs_truthpt_barrel = new TProfile("dpt_vs_truthpt_barrel", "pT(Rec/truth) vs. pT truth (Barrel)", 100, -50, 50,
-                                           -20.0, 20.0);
-    RegisterHisto(al_mon, m_dpt_vs_truthpt_barrel);
-
-
-    m_Dqopt_vs_pt_eca = new TH2F("Dqopt_vs_pt_eca", "QopT(Rec - truth) vs. signed pT (Eca)", 50, -100, 100, 20, -0.1,
-                                 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_pt_eca);
-    m_dqopt_vs_pt_eca_1 = new TH1F("dqopt_vs_pt_eca_1", "Mean QopT(Rec - truth) vs. signed pT (Eca)", 50, -100, 100);
-    RegisterHisto(al_mon, m_dqopt_vs_pt_eca_1);
-    m_dqopt_vs_pt_eca_2 = new TH1F("dqopt_vs_pt_eca_2", "RMS QopT(Rec - truth) vs. signed pT (Eca)", 50, -100, 100);
-    //RegisterHisto(al_mon,m_dqopt_vs_pt_eca_2) ;
-    m_dqopt_vs_pt_eca_chi2 = new TH1F("dqopt_vs_pt_eca_chi2", "Chi2/NDOF QopT(Rec - truth) vs. signed pT (Eca)", 50,
-                                      -100, 100);
-    RegisterHisto(al_mon, m_dqopt_vs_pt_eca_chi2);
-    m_dpt_vs_truthpt_eca = new TProfile("dpt_vs_truthpt_eca", "pT(Rec/truth) vs. pT truth (Eca)", 100, -50, 50, -20.0,
-                                        20.0);
-    RegisterHisto(al_mon, m_dpt_vs_truthpt_eca);
-
-    m_Dqopt_vs_pt_ecc = new TH2F("Dqopt_vs_pt_ecc", "QopT(Rec - truth) vs. signed pT (Ecc)", 50, -100, 100, 20, -0.1,
-                                 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_pt_ecc);
-    m_dqopt_vs_pt_ecc_1 = new TH1F("dqopt_vs_pt_ecc_1", "Mean QopT(Rec - truth) vs. signed pT (Ecc)", 50, -100, 100);
-    RegisterHisto(al_mon, m_dqopt_vs_pt_ecc_1);
-    m_dqopt_vs_pt_ecc_2 = new TH1F("dqopt_vs_pt_ecc_2", "RMS QopT(Rec - truth) vs. signed pT (Ecc)", 50, -100, 100);
-    //RegisterHisto(al_mon,m_dqopt_vs_pt_ecc_2) ;
-    m_dqopt_vs_pt_ecc_chi2 = new TH1F("dqopt_vs_pt_ecc_chi2", "Chi2/NDOF QopT(Rec - truth) vs. signed pT (Ecc)", 50,
-                                      -100, 100);
-    RegisterHisto(al_mon, m_dqopt_vs_pt_ecc_chi2);
-    m_dpt_vs_truthpt_ecc = new TProfile("dpt_vs_truthpt_ecc", "pT(Rec/truth) vs. pT truth (Ecc)", 100, -50, 50, -20.0,
-                                        20.0);
-    RegisterHisto(al_mon, m_dpt_vs_truthpt_ecc);
-
-    // vs eta
-    m_Dqopt_vs_eta_highpt = new TH2F("Dqopt_vs_eta_highpt", "QopT(Rec - truth) vs. eta (high pT)", 20, -2.5, 2.5, 20,
-                                     -0.1, 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_eta_highpt);
-    m_dqopt_vs_eta_highpt_1 = new TH1F("dqopt_vs_eta_highpt_1", "Mean QopT(Rec - truth) vs. eta (high pT)", 20, -2.5,
-                                       2.5);
-    RegisterHisto(al_mon, m_dqopt_vs_eta_highpt_1);
-    m_dqopt_vs_eta_highpt_2 =
-      new TH1F("dqopt_vs_eta_highpt_2", "RMS QopT(Rec - truth) vs. eta (high pT)", 20, -2.5, 2.5);
-    //RegisterHisto(al_mon,m_dqopt_vs_eta_highpt_2) ;
-    m_dqopt_vs_eta_highpt_chi2 = new TH1F("dqopt_vs_eta_highpt_chi2", "Chi2/NDOF QopT(Rec - truth) vs. eta (high pT)",
-                                          20, -2.5, 2.5);
-    RegisterHisto(al_mon, m_dqopt_vs_eta_highpt_chi2);
-
-    m_Dqopt_vs_eta_lowpt = new TH2F("Dqopt_vs_eta_lowpt", "QopT(Rec - truth) vs. eta (low pT)", 20, -2.5, 2.5, 20, -0.1,
-                                    0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_eta_lowpt);
-    m_dqopt_vs_eta_lowpt_1 = new TH1F("dqopt_vs_eta_lowpt_1", "Mean QopT(Rec - truth) vs. eta (low pT)", 20, -2.5, 2.5);
-    RegisterHisto(al_mon, m_dqopt_vs_eta_lowpt_1);
-    m_dqopt_vs_eta_lowpt_2 = new TH1F("dqopt_vs_eta_lowpt_2", "RMS QopT(Rec - truth) vs. eta (low pT)", 20, -2.5, 2.5);
-    //RegisterHisto(al_mon,m_dqopt_vs_eta_lowpt_2) ;
-    m_dqopt_vs_eta_lowpt_chi2 = new TH1F("dqopt_vs_eta_lowpt_chi2", "Chi2/NDOF QopT(Rec - truth) vs. eta (low pT)", 20,
-                                         -2.5, 2.5);
-    RegisterHisto(al_mon, m_dqopt_vs_eta_lowpt_chi2);
-
-    // vs phi
-    m_Dqopt_vs_phi_highpt_barrel = new TH2F("Dqopt_vs_phi_highpt_barrel", "QopT(Rec - truth) vs. phi (highpt, Barrel)",
-                                            20, 0, 2 * M_PI, 20, -0.1, 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_phi_highpt_barrel);
-    m_dqopt_vs_phi_highpt_barrel_1 = new TH1F("dqopt_vs_phi_highpt_barrel_1",
-                                              "Mean QopT(Rec - truth) vs. phi (highpt, Barrel)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_highpt_barrel_1);
-    m_dqopt_vs_phi_highpt_barrel_2 = new TH1F("dqopt_vs_phi_highpt_barrel_2",
-                                              "RMS QopT(Rec - truth) vs. phi (highpt, Barrel)", 20, 0, 2 * M_PI);
-    //RegisterHisto(al_mon,m_dqopt_vs_phi_highpt_barrel_2) ;
-    m_dqopt_vs_phi_highpt_barrel_chi2 = new TH1F("dqopt_vs_phi_highpt_barrel_chi2",
-                                                 "Chi2/NDOF QopT(Rec - truth) vs. phi (highpt, Barrel)", 20, 0,
-                                                 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_highpt_barrel_chi2);
-
-    m_Dqopt_vs_phi_highpt_eca = new TH2F("Dqopt_vs_phi_highpt_eca", "QopT(Rec - truth) vs. phi (highpt, Eca)", 20, 0,
-                                         2 * M_PI, 20, -0.1, 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_phi_highpt_eca);
-    m_dqopt_vs_phi_highpt_eca_1 = new TH1F("dqopt_vs_phi_highpt_eca_1", "Mean QopT(Rec - truth) vs. phi (highpt, Eca)",
-                                           20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_highpt_eca_1);
-    m_dqopt_vs_phi_highpt_eca_2 = new TH1F("dqopt_vs_phi_highpt_eca_2", "RMS QopT(Rec - truth) vs. phi (highpt, Eca)",
-                                           20, 0, 2 * M_PI);
-    //RegisterHisto(al_mon,m_dqopt_vs_phi_highpt_eca_2) ;
-    m_dqopt_vs_phi_highpt_eca_chi2 = new TH1F("dqopt_vs_phi_highpt_eca_chi2",
-                                              "Chi2/NDOF QopT(Rec - truth) vs. phi (highpt, Eca)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_highpt_eca_chi2);
-
-    m_Dqopt_vs_phi_highpt_ecc = new TH2F("Dqopt_vs_phi_highpt_ecc", "QopT(Rec - truth) vs. phi (highpt, Ecc)", 20, 0,
-                                         2 * M_PI, 20, -0.1, 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_phi_highpt_ecc);
-    m_dqopt_vs_phi_highpt_ecc_1 = new TH1F("dqopt_vs_phi_highpt_ecc_1", "Mean QopT(Rec - truth) vs. phi (highpt, Ecc)",
-                                           20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_highpt_ecc_1);
-    m_dqopt_vs_phi_highpt_ecc_2 = new TH1F("dqopt_vs_phi_highpt_ecc_2", "RMS QopT(Rec - truth) vs. phi (highpt, Ecc)",
-                                           20, 0, 2 * M_PI);
-    //RegisterHisto(al_mon,m_dqopt_vs_phi_highpt_ecc_2) ;
-    m_dqopt_vs_phi_highpt_ecc_chi2 = new TH1F("dqopt_vs_phi_highpt_ecc_chi2",
-                                              "Chi2/NDOF QopT(Rec - truth) vs. phi (highpt, Ecc)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_highpt_ecc_chi2);
-
-    // vs phi
-    m_Dqopt_vs_phi_lowpt_barrel = new TH2F("Dqopt_vs_phi_lowpt_barrel", "QopT(Rec - truth) vs. phi (lowpt, Barrel)", 20,
-                                           0, 2 * M_PI, 20, -0.1, 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_phi_lowpt_barrel);
-    m_dqopt_vs_phi_lowpt_barrel_1 = new TH1F("dqopt_vs_phi_lowpt_barrel_1",
-                                             "Mean QopT(Rec - truth) vs. phi (lowpt, Barrel)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_lowpt_barrel_1);
-    m_dqopt_vs_phi_lowpt_barrel_2 = new TH1F("dqopt_vs_phi_lowpt_barrel_2",
-                                             "RMS QopT(Rec - truth) vs. phi (lowpt, Barrel)", 20, 0, 2 * M_PI);
-    //RegisterHisto(al_mon,m_dqopt_vs_phi_lowpt_barrel_2) ;
-    m_dqopt_vs_phi_lowpt_barrel_chi2 = new TH1F("dqopt_vs_phi_lowpt_barrel_chi2",
-                                                "Chi2/NDOF QopT(Rec - truth) vs. phi (lowpt, Barrel)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_lowpt_barrel_chi2);
-
-    m_Dqopt_vs_phi_lowpt_eca = new TH2F("Dqopt_vs_phi_lowpt_eca", "QopT(Rec - truth) vs. phi (lowpt, Eca)", 20, 0,
-                                        2 * M_PI, 20, -0.1, 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_phi_lowpt_eca);
-    m_dqopt_vs_phi_lowpt_eca_1 = new TH1F("dqopt_vs_phi_lowpt_eca_1", "Mean QopT(Rec - truth) vs. phi (lowpt, Eca)", 20,
-                                          0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_lowpt_eca_1);
-    m_dqopt_vs_phi_lowpt_eca_2 = new TH1F("dqopt_vs_phi_lowpt_eca_2", "RMS QopT(Rec - truth) vs. phi (lowpt, Eca)", 20,
-                                          0, 2 * M_PI);
-    //RegisterHisto(al_mon,m_dqopt_vs_phi_lowpt_eca_2) ;
-    m_dqopt_vs_phi_lowpt_eca_chi2 = new TH1F("dqopt_vs_phi_lowpt_eca_chi2",
-                                             "Chi2/NDOF cQopT(Rec - truth) vs. phi (lowpt, Eca)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_lowpt_eca_chi2);
-
-    m_Dqopt_vs_phi_lowpt_ecc = new TH2F("Dqopt_vs_phi_lowpt_ecc", "QopT(Rec - truth) vs. phi (lowpt, Ecc)", 20, 0,
-                                        2 * M_PI, 20, -0.1, 0.1);
-    RegisterHisto(al_mon, m_Dqopt_vs_phi_lowpt_ecc);
-    m_dqopt_vs_phi_lowpt_ecc_1 = new TH1F("dqopt_vs_phi_lowpt_ecc_1", "Mean QopT(Rec - truth) vs. phi (lowpt, Ecc)", 20,
-                                          0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_lowpt_ecc_1);
-    m_dqopt_vs_phi_lowpt_ecc_2 = new TH1F("dqopt_vs_phi_lowpt_ecc_2", "RMS QopT(Rec - truth) vs. phi (lowpt, Ecc)", 20,
-                                          0, 2 * M_PI);
-    //RegisterHisto(al_mon,m_dqopt_vs_phi_lowpt_ecc_2) ;
-    m_dqopt_vs_phi_lowpt_ecc_chi2 = new TH1F("dqopt_vs_phi_lowpt_ecc_chi2",
-                                             "Chi2/NDOF QopT(Rec - truth) vs. phi (lowpt, Ecc)", 20, 0, 2 * M_PI);
-    RegisterHisto(al_mon, m_dqopt_vs_phi_lowpt_ecc_chi2);
-
-    m_Zmumu = new TH1F("Zmumu", "Zmumu", 50, 0, 150);
-    RegisterHisto(al_mon, m_Zmumu);
-    m_Zmumu_truth = new TH1F("Zmumu_truth", "Zmumu_truth", 50, 0, 150);
-    RegisterHisto(al_mon, m_Zmumu_truth);
-    m_dZmumu = new TH1F("Delta_Zmumu", "Delta Zmumu", 100, -20, 20);
-    RegisterHisto(al_mon, m_dZmumu);
-
-    m_dZmumu_barrel = new TH1F("Delta_Zmumu_barrel", "#DeltaZmumu Both Legs Barrel", 100, -20, 20);
-    RegisterHisto(al_mon, m_dZmumu_barrel);
-    m_dZmumu_eca = new TH1F("Delta_Zmumu_eca", "#DeltaZmumu Both Legs ECA", 100, -20, 20);
-    RegisterHisto(al_mon, m_dZmumu_eca);
-    m_dZmumu_ecc = new TH1F("Delta_Zmumu_ecc", "#DeltaZmumu Both Legs ECC", 100, -20, 20);
-    RegisterHisto(al_mon, m_dZmumu_ecc);
-    m_dZmumu_barrel_eca = new TH1F("Delta_Zmumu_barrel_eca", "#DeltaZmumu One Leg Barrel One Leg ECA", 100, -20, 20);
-    RegisterHisto(al_mon, m_dZmumu_barrel_eca);
-    m_dZmumu_barrel_ecc = new TH1F("Delta_Zmumu_barrel_ecc", "#DeltaZmumu One Leg Barrel One Leg ECC", 100, -20, 20);
-    RegisterHisto(al_mon, m_dZmumu_barrel_ecc);
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-void IDAlignMonTruthComparison::RegisterHisto(MonGroup& mon, TH1* histo) {
-  histo->Sumw2();
-  StatusCode sc = mon.regHist(histo);
-  if (sc.isFailure()) {
-    msg(MSG::ERROR) << "Cannot book TH1 Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonTruthComparison::RegisterHisto(MonGroup& mon, TProfile* histo) {
-  StatusCode sc = mon.regHist(histo);
-
-  if (sc.isFailure()) {
-    msg(MSG::ERROR) << "Cannot book TProfile Histogram:" << endmsg;
-  }
-}
-
-void IDAlignMonTruthComparison::RegisterHisto(MonGroup& mon, TH2* histo) {
-  histo->Sumw2();
-  StatusCode sc = mon.regHist(histo);
-  if (sc.isFailure()) {
-    msg(MSG::ERROR) << "Cannot book TH2 Histogram:" << endmsg;
-  }
-}
-
-StatusCode IDAlignMonTruthComparison::fillHistograms() {
-  //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
-  SG::ReadHandle<TrackCollection> RecCollection {
-    m_tracksName
-  };
-  if (not RecCollection.isValid()) {
-    if (msgLvl(MSG::VERBOSE)) msg() << "Track collection \"" << m_tracksName.key() << "\" not found." << endmsg;
-    return StatusCode::SUCCESS;
-  }
-  if (RecCollection.get()) {
-    if (msgLvl(MSG::VERBOSE)) msg() << "Retrieved " << m_tracksName.key() << " with size " << RecCollection->size() <<
-        " reconstructed tracks from storegate" << endmsg;
-  } else {
-    if (msgLvl(MSG::VERBOSE)) msg() << "Problem in retrieving " << m_tracksName.key() << endmsg;
-    return StatusCode::SUCCESS;
-  }
-
-  //get TrackCollection using TrackSelectionTool
-  const DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(RecCollection);
-
-  // get TrackTruthCollection
-  SG::ReadHandle<TrackTruthCollection> TruthMap {
-    m_tracksTruthName
-  };
-  if (not TruthMap.isValid()) {
-    if (msgLvl(MSG::VERBOSE)) msg() << "Cannot find " << m_tracksTruthName.key() << endmsg;
-    return StatusCode::SUCCESS;
-  } else {
-    if (msgLvl(MSG::VERBOSE)) msg() << "Track Truth Collection with name " << m_tracksTruthName.key() <<
-        " with size " << TruthMap->size() << " found in StoreGate" << endmsg;
-  }
-
-
-  bool z_true = false;
-  float z_E[2] = {
-    0.
-  }, z_px[2] = {
-    0.
-  }, z_py[2] = {
-    0.
-  }, z_pz[2] = {
-    0.
-  };
-  float z_eta[2] = {
-    0.
-  };
-  float zMC_E[2] = {
-    0.
-  }, zMC_px[2] = {
-    0.
-  }, zMC_py[2] = {
-    0.
-  }, zMC_pz[2] = {
-    0.
-  };
-  float ptlast = 0;
-  int chargefirst = 0;
-
-  DataVector<Trk::Track>::const_iterator trksItr = trks->begin();
-  DataVector<Trk::Track>::const_iterator trksItrE = trks->end();
-  for (; trksItr != trksItrE; ++trksItr) {
-
-    float trkd0 = -999;
-    float trkz0 = -999;
-    float trkphi = -999;
-    float trktheta = -999;
-    float trketa = -999;
-    float qOverPt = -999;
-    float trkpt = -999;
-    float charge = 0;
-
-    // get fit quality and chi2 probability of track
-    // chi2Prob = TMath::Prob(chi2,DoF) ROOT function
-    const Trk::Perigee* measPer = (*trksItr)->perigeeParameters();
-    const AmgSymMatrix(5) * covariance = measPer ? measPer->covariance() : nullptr;
-
-    if (covariance == nullptr) {
-      msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endmsg;
-    } else {
-      AmgVector(5) perigeeParams = measPer->parameters();
-      trkd0 = perigeeParams[Trk::d0];
-      trkz0 = perigeeParams[Trk::z0];
-      trkphi = perigeeParams[Trk::phi0];
-      trktheta = perigeeParams[Trk::theta];
-      trketa = measPer->eta();
-      qOverPt = perigeeParams[Trk::qOverP] * 1000. / sin(trktheta);
-      trkpt = measPer->pT() / 1000.;
-      if (qOverPt < 0) charge = -1;
-      else charge = +1;
-    }
-    if (trkphi < 0) trkphi += 2 * M_PI;
-
-    if (msgLvl(MSG::VERBOSE)) msg() << "Found good track with phi, PT = " << trkphi << ", " << trkpt << endmsg;
-
-    if (TruthMap.get()) {
-      ElementLink<TrackCollection> tracklink;
-      tracklink.setElement(*trksItr);
-      tracklink.setStorableObject(*RecCollection);
-      const ElementLink<TrackCollection> tracklink2 = tracklink;
-
-      TrackTruthCollection::const_iterator found = TruthMap->find(tracklink2);
-      if (found != TruthMap->end()) {
-        TrackTruth trtruth = found->second;
-        const HepMcParticleLink& HMPL = trtruth.particleLink();
-
-        if (HMPL.isValid()) {
-#ifdef HEPMC3
-          HepMC::ConstGenParticlePtr genparptr = HMPL.scptr();
-#else
-          const HepMC::GenParticle* genparptr = HMPL.cptr();
-#endif
-
-          if (genparptr) {
-            if (genparptr->production_vertex()) {
-              if (genparptr->pdg_id() == 0) {
-                msg(MSG::WARNING) << " Particle with PDG ID = 0! Status " << endmsg;
-              } else {
-                const Trk::TrackParameters* generatedTrackPerigee = m_truthToTrack->makePerigeeParameters(genparptr);
-                if (!generatedTrackPerigee) msg(MSG::WARNING) << "Unable to extrapolate genparticle to perigee!" <<
-                  endmsg;
-
-                if (generatedTrackPerigee) {
-                  float track_truth_qoverpt = 1000. * generatedTrackPerigee->parameters()[Trk::qOverP] / sin(
-                    generatedTrackPerigee->parameters()[Trk::theta]);
-                  float track_truth_phi = generatedTrackPerigee->parameters()[Trk::phi0];
-                  float track_truth_d0 = generatedTrackPerigee->parameters()[Trk::d0];
-                  float track_truth_z0 = generatedTrackPerigee->parameters()[Trk::z0];
-                  float track_truth_theta = generatedTrackPerigee->parameters()[Trk::theta];
-                  float track_truth_eta = generatedTrackPerigee->eta();
-                  delete  generatedTrackPerigee;
-                  float track_truth_pt = 1. / fabs(track_truth_qoverpt);
-                  float track_truth_charge = 1;
-                  if (track_truth_qoverpt < 0) track_truth_charge = -1;
-                  if (track_truth_phi < 0) track_truth_phi += 2 * M_PI;
-                  if (msgLvl(MSG::VERBOSE)) msg() << "Found matched truth track with phi, PT = " << track_truth_phi <<
-                    ", " << track_truth_pt << endmsg;
-
-                  m_truthpT->Fill(track_truth_pt);
-                  m_truthphi->Fill(track_truth_phi);
-                  m_trutheta->Fill(track_truth_eta);
-
-                  if (trkpt > ptlast) {
-                    z_E[0] = fabs(trkpt / sin(trktheta));
-                    z_pz[0] = trkpt / tan(trktheta);
-                    z_px[0] = trkpt * sin(trkphi);
-                    z_py[0] = trkpt * cos(trkphi);
-                    z_eta[0] = trketa;
-                    zMC_E[0] = fabs(track_truth_pt / sin(track_truth_theta));
-                    zMC_pz[0] = track_truth_pt / tan(track_truth_theta);
-                    zMC_px[0] = track_truth_pt * sin(track_truth_phi);
-                    zMC_py[0] = track_truth_pt * cos(track_truth_phi);
-                    ptlast = trkpt;
-                    chargefirst = (int) charge;
-                  }
-
-                  // Fill hitos
-                  m_Deta_vs_eta->Fill(track_truth_eta, trketa - track_truth_eta);
-                  m_dphi_vs_eta->Fill(track_truth_eta, trkphi - track_truth_phi);
-
-                  float eta_barrel = 1.;
-                  if (fabs(track_truth_eta) < eta_barrel) {
-                    m_dpt_vs_truthpt_barrel->Fill(track_truth_charge * track_truth_pt, trkpt / track_truth_pt);
-                    m_Dqopt_vs_pt_barrel->Fill(track_truth_charge * track_truth_pt, qOverPt - track_truth_qoverpt);
-                    m_dqopt_barrel->Fill(qOverPt - track_truth_qoverpt);
-                    m_deta_barrel->Fill(trketa - track_truth_eta);
-                    m_dphi_barrel->Fill(trkphi - track_truth_phi);
-                    m_dphi_barrel_vs_phi->Fill(track_truth_phi, trkphi - track_truth_phi);
-                    m_dz0_barrel->Fill(trkz0 - track_truth_z0);
-                    m_dd0_barrel->Fill(trkd0 - track_truth_d0);
-                  } else if (track_truth_eta > eta_barrel) {
-                    m_dpt_vs_truthpt_eca->Fill(track_truth_charge * track_truth_pt, trkpt / track_truth_pt);
-                    m_Dqopt_vs_pt_eca->Fill(track_truth_charge * track_truth_pt, qOverPt - track_truth_qoverpt);
-                    m_dqopt_eca->Fill(qOverPt - track_truth_qoverpt);
-                    m_deta_eca->Fill(trketa - track_truth_eta);
-                    m_dphi_eca->Fill(trkphi - track_truth_phi);
-                    m_dz0_eca->Fill(trkz0 - track_truth_z0);
-                    m_dd0_eca->Fill(trkd0 - track_truth_d0);
-                  } else {
-                    m_dpt_vs_truthpt_ecc->Fill(track_truth_charge * track_truth_pt, trkpt / track_truth_pt);
-                    m_Dqopt_vs_pt_ecc->Fill(track_truth_charge * track_truth_pt, qOverPt - track_truth_qoverpt);
-                    m_dqopt_ecc->Fill(qOverPt - track_truth_qoverpt);
-                    m_deta_ecc->Fill(trketa - track_truth_eta);
-                    m_dphi_ecc->Fill(trkphi - track_truth_phi);
-                    m_dz0_ecc->Fill(trkz0 - track_truth_z0);
-                    m_dd0_ecc->Fill(trkd0 - track_truth_d0);
-                  }
-
-                  float highpt = 10.;
-                  if (track_truth_pt > highpt) {
-                    m_Dqopt_vs_eta_highpt->Fill(track_truth_eta, qOverPt - track_truth_qoverpt);
-
-                    // vs phi
-                    if (fabs(track_truth_eta) < eta_barrel) {
-                      m_Dqopt_vs_phi_highpt_barrel->Fill(track_truth_phi, qOverPt - track_truth_qoverpt);
-                    } else if (track_truth_eta > eta_barrel) {
-                      m_Dqopt_vs_phi_highpt_eca->Fill(track_truth_phi, qOverPt - track_truth_qoverpt);
-                    } else {
-                      m_Dqopt_vs_phi_highpt_ecc->Fill(track_truth_phi, qOverPt - track_truth_qoverpt);
-                    }
-                  } else {
-                    m_Dqopt_vs_eta_lowpt->Fill(track_truth_eta, qOverPt - track_truth_qoverpt);
-
-                    // vs phi
-                    if (fabs(track_truth_eta) < eta_barrel) {
-                      m_Dqopt_vs_phi_lowpt_barrel->Fill(track_truth_phi, qOverPt - track_truth_qoverpt);
-                    } else if (track_truth_eta > eta_barrel) {
-                      m_Dqopt_vs_phi_lowpt_eca->Fill(track_truth_phi, qOverPt - track_truth_qoverpt);
-                    } else {
-                      m_Dqopt_vs_phi_lowpt_ecc->Fill(track_truth_phi, qOverPt - track_truth_qoverpt);
-                    }
-                  }
-                }
-              }
-            } else msg(MSG::WARNING) << " no genparptr->production_vertex() " << endmsg;
-          } else msg(MSG::WARNING) << " no genparptr found " << endmsg;
-        } else msg(MSG::WARNING) << " HMPL not Valid " << endmsg;
-      }
-    } else msg(MSG::WARNING) << " No TruthMap found " << endmsg;
-  }
-
-  float ptfirst = ptlast;
-  ptlast = 0;
-  trksItr = trks->begin();
-  for (; trksItr != trksItrE; ++trksItr) {
-    float trkphi = -999;
-    float trktheta = -999;
-    float trkpt = -999;
-    float qOverP = -999;
-    float trketa = -999;
-    float charge = 0;
-
-    // get fit quality and chi2 probability of track
-    // chi2Prob = TMath::Prob(chi2,DoF) ROOT function
-    const Trk::Perigee* measPer = (*trksItr)->perigeeParameters();
-    const AmgSymMatrix(5) * covariance = measPer ? measPer->covariance() : nullptr;
-
-    if (covariance == nullptr) {
-      msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endmsg;
-    } else {
-      AmgVector(5) perigeeParams = measPer->parameters();
-      trkphi = perigeeParams[Trk::phi0];
-      trktheta = perigeeParams[Trk::theta];
-      trkpt = measPer->pT() / 1000.;
-      trketa = measPer->eta();
-      qOverP = perigeeParams[Trk::qOverP] * 1000.;
-      if (qOverP < 0) charge = -1;
-      else charge = +1;
-    }
-
-    if (TruthMap.get()) {
-      ElementLink<TrackCollection> tracklink;
-      tracklink.setElement(const_cast<Trk::Track*>(*trksItr));
-      tracklink.setStorableObject(*RecCollection);
-      const ElementLink<TrackCollection> tracklink2 = tracklink;
-
-      TrackTruthCollection::const_iterator found = TruthMap->find(tracklink2);
-      if (found != TruthMap->end()) {
-        TrackTruth trtruth = found->second;
-        const HepMcParticleLink& HMPL = trtruth.particleLink();
-
-        if (HMPL.isValid()) {
-#ifdef HEPMC3
-          HepMC::ConstGenParticlePtr genparptr = HMPL.scptr();
-#else
-          const HepMC::GenParticle* genparptr = HMPL.cptr();
-#endif
-
-          if (genparptr) {
-            if (genparptr->production_vertex()) {
-              if (genparptr->pdg_id() == 0) {
-                msg(MSG::WARNING) << " Particle with PDG ID = 0! Status " << endmsg;
-              } else {
-                const Trk::TrackParameters* generatedTrackPerigee = m_truthToTrack->makePerigeeParameters(genparptr);
-                if (!generatedTrackPerigee) msg(MSG::WARNING) << "Unable to extrapolate genparticle to perigee!" << endmsg;
-
-                if (generatedTrackPerigee) {
-                  float track_truth_qoverpt = 1000. * generatedTrackPerigee->parameters()[Trk::qOverP] / sin(generatedTrackPerigee->parameters()[Trk::theta]);
-                  float track_truth_phi = generatedTrackPerigee->parameters()[Trk::phi0];
-                  float track_truth_theta = generatedTrackPerigee->parameters()[Trk::theta];
-                  delete  generatedTrackPerigee;
-                  float track_truth_pt = 1. / fabs(track_truth_qoverpt);
-                  //float track_truth_charge       = 1;
-                  //if(track_truth_qoverpt<0) track_truth_charge = -1;
-                  if (track_truth_phi < 0) track_truth_phi += 2 * M_PI;
-                  if (msgLvl(MSG::VERBOSE)) msg() << "Found matched truth track with phi, PT = " << track_truth_phi << ", " << track_truth_pt << endmsg;
-
-
-                  if (trkpt > ptlast && trkpt < ptfirst && chargefirst * charge < 0 && trkpt > 15) {
-                    z_E[1] = fabs(trkpt / sin(trktheta));
-                    z_pz[1] = trkpt / tan(trktheta);
-                    z_px[1] = trkpt * sin(trkphi);
-                    z_py[1] = trkpt * cos(trkphi);
-                    z_eta[1] = trketa;
-                    zMC_E[1] = fabs(track_truth_pt / sin(track_truth_theta));
-                    zMC_pz[1] = track_truth_pt / tan(track_truth_theta);
-                    zMC_px[1] = track_truth_pt * sin(track_truth_phi);
-                    zMC_py[1] = track_truth_pt * cos(track_truth_phi);
-                    ptlast = trkpt;
-                    z_true = true;
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-
-  if (z_true) {
-    // build invariant mass of two highest pT tracks
-    // M = sqrt(E1*E2 - px1*px2 - py1*py2 - pz1*pz2);
-    float M = sqrt((z_E[0] + z_E[1]) * (z_E[0] + z_E[1]) - (z_px[0] + z_px[1]) * (z_px[0] + z_px[1]) - (z_py[0] + z_py[1]) * (z_py[0] + z_py[1]) - (z_pz[0] + z_pz[1]) * (z_pz[0] + z_pz[1]));
-    float MMC = sqrt((zMC_E[0] + zMC_E[1]) * (zMC_E[0] + zMC_E[1]) - (zMC_px[0] + zMC_px[1]) * (zMC_px[0] + zMC_px[1]) - (zMC_py[0] + zMC_py[1]) * (zMC_py[0] + zMC_py[1]) - (zMC_pz[0] + zMC_pz[1]) * (zMC_pz[0] + zMC_pz[1]));
-    m_Zmumu->Fill(M);
-    m_Zmumu_truth->Fill(MMC);
-    m_dZmumu->Fill(M - MMC);
-
-    if (fabs(z_eta[0]) < 1.0 && fabs(z_eta[1]) < 1.0) m_dZmumu_barrel->Fill(M - MMC);
-    if (z_eta[0] > 1.0 && z_eta[1] > 1.0) m_dZmumu_eca->Fill(M - MMC);
-    if (z_eta[0] < -1.0 && z_eta[1] < -1.0) m_dZmumu_ecc->Fill(M - MMC);
-
-    if ((fabs(z_eta[0]) < 1.0 && z_eta[1] > 1.0) ||
-        (z_eta[0] > 1.0 && fabs(z_eta[1]) < 1.0)) m_dZmumu_barrel_eca->Fill(M - MMC);
-
-    if ((fabs(z_eta[0]) < 1.0 && z_eta[1] < -1.0) ||
-        (z_eta[0] < -1.0 && fabs(z_eta[1]) < 1.0)) m_dZmumu_barrel_ecc->Fill(M - MMC);
-  }
-
-  delete trks;
-  return StatusCode::SUCCESS;
-}
-
-StatusCode IDAlignMonTruthComparison::procHistograms() {
-  //if( endOfLowStatFlag() ) {  }
-  //if( endOfLumiBlockFlag() ) {  }
-  if (endOfRunFlag()) {
-    // deta vs eta
-    m_Deta_vs_eta->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Deta_vs_eta_1 = (TH1F*) gDirectory->Get("Deta_vs_eta_1");
-    TH1F* Deta_vs_eta_2 = (TH1F*) gDirectory->Get("Deta_vs_eta_2");
-    TH1F* Deta_vs_eta_chi2 = (TH1F*) gDirectory->Get("Deta_vs_eta_chi2");
-
-    // vs pt
-    m_Dqopt_vs_pt_barrel->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_pt_barrel_1 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_barrel_1");
-    TH1F* Dqopt_vs_pt_barrel_2 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_barrel_2");
-    TH1F* Dqopt_vs_pt_barrel_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_barrel_chi2");
-
-    m_Dqopt_vs_pt_eca->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_pt_eca_1 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_eca_1");
-    TH1F* Dqopt_vs_pt_eca_2 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_eca_2");
-    TH1F* Dqopt_vs_pt_eca_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_eca_chi2");
-
-    m_Dqopt_vs_pt_ecc->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_pt_ecc_1 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_ecc_1");
-    TH1F* Dqopt_vs_pt_ecc_2 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_ecc_2");
-    TH1F* Dqopt_vs_pt_ecc_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_ecc_chi2");
-
-    // vs eta
-    m_Dqopt_vs_eta_highpt->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_eta_highpt_1 = (TH1F*) gDirectory->Get("Dqopt_vs_eta_highpt_1");
-    TH1F* Dqopt_vs_eta_highpt_2 = (TH1F*) gDirectory->Get("Dqopt_vs_eta_highpt_2");
-    TH1F* Dqopt_vs_eta_highpt_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_eta_highpt_chi2");
-
-    m_Dqopt_vs_eta_lowpt->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_eta_lowpt_1 = (TH1F*) gDirectory->Get("Dqopt_vs_eta_lowpt_1");
-    TH1F* Dqopt_vs_eta_lowpt_2 = (TH1F*) gDirectory->Get("Dqopt_vs_eta_lowpt_2");
-    TH1F* Dqopt_vs_eta_lowpt_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_eta_lowpt_chi2");
-
-    // vs phi
-    m_Dqopt_vs_phi_highpt_barrel->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_phi_highpt_barrel_1 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_barrel_1");
-    TH1F* Dqopt_vs_phi_highpt_barrel_2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_barrel_2");
-    TH1F* Dqopt_vs_phi_highpt_barrel_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_barrel_chi2");
-
-    m_Dqopt_vs_phi_highpt_eca->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_phi_highpt_eca_1 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_eca_1");
-    TH1F* Dqopt_vs_phi_highpt_eca_2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_eca_2");
-    TH1F* Dqopt_vs_phi_highpt_eca_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_eca_chi2");
-
-    m_Dqopt_vs_phi_highpt_ecc->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_phi_highpt_ecc_1 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_ecc_1");
-    TH1F* Dqopt_vs_phi_highpt_ecc_2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_ecc_2");
-    TH1F* Dqopt_vs_phi_highpt_ecc_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_ecc_chi2");
-
-    // vs phi
-    m_Dqopt_vs_phi_lowpt_barrel->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_phi_lowpt_barrel_1 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_barrel_1");
-    TH1F* Dqopt_vs_phi_lowpt_barrel_2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_barrel_2");
-    TH1F* Dqopt_vs_phi_lowpt_barrel_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_barrel_chi2");
-
-    m_Dqopt_vs_phi_lowpt_eca->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_phi_lowpt_eca_1 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_eca_1");
-    TH1F* Dqopt_vs_phi_lowpt_eca_2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_eca_2");
-    TH1F* Dqopt_vs_phi_lowpt_eca_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_eca_chi2");
-
-    m_Dqopt_vs_phi_lowpt_ecc->FitSlicesY(nullptr, 1, 0, 10);
-    TH1F* Dqopt_vs_phi_lowpt_ecc_1 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_ecc_1");
-    TH1F* Dqopt_vs_phi_lowpt_ecc_2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_ecc_2");
-    TH1F* Dqopt_vs_phi_lowpt_ecc_chi2 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_ecc_chi2");
-
-
-    // deta vs eta
-    for (int i = 1; i <= Deta_vs_eta_1->GetNbinsX(); i++) {
-      double tmp = Deta_vs_eta_1->GetBinContent(i);
-      m_deta_vs_eta_1->SetBinContent(i, tmp);
-      tmp = Deta_vs_eta_2->GetBinContent(i);
-      m_deta_vs_eta_2->SetBinContent(i, tmp);
-      m_deta_vs_eta_1->SetBinError(i, tmp);
-      tmp = Deta_vs_eta_chi2->GetBinContent(i);
-      m_deta_vs_eta_chi2->SetBinContent(i, tmp);
-    }
-
-
-    // vs pT
-    for (int i = 1; i <= Dqopt_vs_pt_barrel_1->GetNbinsX(); i++) {
-      double tmp = Dqopt_vs_pt_barrel_1->GetBinContent(i);
-      m_dqopt_vs_pt_barrel_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_pt_barrel_2->GetBinContent(i);
-      m_dqopt_vs_pt_barrel_2->SetBinContent(i, tmp);
-      m_dqopt_vs_pt_barrel_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_pt_barrel_chi2->GetBinContent(i);
-      m_dqopt_vs_pt_barrel_chi2->SetBinContent(i, tmp);
-
-      tmp = Dqopt_vs_pt_eca_1->GetBinContent(i);
-      m_dqopt_vs_pt_eca_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_pt_eca_2->GetBinContent(i);
-      m_dqopt_vs_pt_eca_2->SetBinContent(i, tmp);
-      m_dqopt_vs_pt_eca_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_pt_eca_chi2->GetBinContent(i);
-      m_dqopt_vs_pt_eca_chi2->SetBinContent(i, tmp);
-
-      tmp = Dqopt_vs_pt_ecc_1->GetBinContent(i);
-      m_dqopt_vs_pt_ecc_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_pt_ecc_2->GetBinContent(i);
-      m_dqopt_vs_pt_ecc_2->SetBinContent(i, tmp);
-      m_dqopt_vs_pt_ecc_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_pt_ecc_chi2->GetBinContent(i);
-      m_dqopt_vs_pt_ecc_chi2->SetBinContent(i, tmp);
-    }
-
-    // vs eta
-    for (int i = 1; i <= Dqopt_vs_eta_highpt_1->GetNbinsX(); i++) {
-      double tmp = Dqopt_vs_eta_highpt_1->GetBinContent(i);
-      m_dqopt_vs_eta_highpt_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_eta_highpt_2->GetBinContent(i);
-      m_dqopt_vs_eta_highpt_2->SetBinContent(i, tmp);
-      m_dqopt_vs_eta_highpt_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_eta_highpt_chi2->GetBinContent(i);
-      m_dqopt_vs_eta_highpt_chi2->SetBinContent(i, tmp);
-
-      tmp = Dqopt_vs_eta_lowpt_1->GetBinContent(i);
-      m_dqopt_vs_eta_lowpt_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_eta_lowpt_2->GetBinContent(i);
-      m_dqopt_vs_eta_lowpt_2->SetBinContent(i, tmp);
-      m_dqopt_vs_eta_lowpt_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_eta_lowpt_chi2->GetBinContent(i);
-      m_dqopt_vs_eta_lowpt_chi2->SetBinContent(i, tmp);
-    }
-
-    // vs phi
-    for (int i = 1; i <= Dqopt_vs_phi_highpt_barrel_1->GetNbinsX(); i++) {
-      double tmp = Dqopt_vs_phi_highpt_barrel_1->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_barrel_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_phi_highpt_barrel_2->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_barrel_2->SetBinContent(i, tmp);
-      m_dqopt_vs_phi_highpt_barrel_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_phi_highpt_barrel_chi2->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_barrel_chi2->SetBinContent(i, tmp);
-
-      tmp = Dqopt_vs_phi_highpt_eca_1->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_eca_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_phi_highpt_eca_2->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_eca_2->SetBinContent(i, tmp);
-      m_dqopt_vs_phi_highpt_eca_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_phi_highpt_eca_chi2->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_eca_chi2->SetBinContent(i, tmp);
-
-      tmp = Dqopt_vs_phi_highpt_ecc_1->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_ecc_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_phi_highpt_ecc_2->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_ecc_2->SetBinContent(i, tmp);
-      m_dqopt_vs_phi_highpt_ecc_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_phi_highpt_ecc_chi2->GetBinContent(i);
-      m_dqopt_vs_phi_highpt_ecc_chi2->SetBinContent(i, tmp);
-
-      tmp = Dqopt_vs_phi_lowpt_barrel_1->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_barrel_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_phi_lowpt_barrel_2->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_barrel_2->SetBinContent(i, tmp);
-      m_dqopt_vs_phi_lowpt_barrel_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_phi_lowpt_barrel_chi2->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_barrel_chi2->SetBinContent(i, tmp);
-
-      tmp = Dqopt_vs_phi_lowpt_eca_1->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_eca_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_phi_lowpt_eca_2->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_eca_2->SetBinContent(i, tmp);
-      m_dqopt_vs_phi_lowpt_eca_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_phi_lowpt_eca_chi2->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_eca_chi2->SetBinContent(i, tmp);
-
-      tmp = Dqopt_vs_phi_lowpt_ecc_1->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_ecc_1->SetBinContent(i, tmp);
-      tmp = Dqopt_vs_phi_lowpt_ecc_2->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_ecc_2->SetBinContent(i, tmp);
-      m_dqopt_vs_phi_lowpt_ecc_1->SetBinError(i, tmp);
-      tmp = Dqopt_vs_phi_lowpt_ecc_chi2->GetBinContent(i);
-      m_dqopt_vs_phi_lowpt_ecc_chi2->SetBinContent(i, tmp);
-    }
-
-    TH1F* Deta_vs_eta_0 = (TH1F*) gDirectory->Get("Deta_vs_eta_0");
-    delete Deta_vs_eta_0;
-    delete Deta_vs_eta_1;
-    delete Deta_vs_eta_2;
-    delete Deta_vs_eta_chi2;
-
-    TH1F* Dqopt_vs_pt_barrel_0 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_barrel_0");
-    delete Dqopt_vs_pt_barrel_0;
-    delete Dqopt_vs_pt_barrel_1;
-    delete Dqopt_vs_pt_barrel_2;
-    delete Dqopt_vs_pt_barrel_chi2;
-    TH1F* Dqopt_vs_pt_eca_0 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_eca_0");
-    delete Dqopt_vs_pt_eca_0;
-    delete Dqopt_vs_pt_eca_1;
-    delete Dqopt_vs_pt_eca_2;
-    delete Dqopt_vs_pt_eca_chi2;
-    TH1F* Dqopt_vs_pt_ecc_0 = (TH1F*) gDirectory->Get("Dqopt_vs_pt_ecc_0");
-    delete Dqopt_vs_pt_ecc_0;
-    delete Dqopt_vs_pt_ecc_1;
-    delete Dqopt_vs_pt_ecc_2;
-    delete Dqopt_vs_pt_ecc_chi2;
-
-    TH1F* Dqopt_vs_eta_highpt_0 = (TH1F*) gDirectory->Get("Dqopt_vs_eta_highpt_0");
-    delete Dqopt_vs_eta_highpt_0;
-    delete Dqopt_vs_eta_highpt_1;
-    delete Dqopt_vs_eta_highpt_2;
-    delete Dqopt_vs_eta_highpt_chi2;
-    TH1F* Dqopt_vs_eta_lowpt_0 = (TH1F*) gDirectory->Get("Dqopt_vs_eta_lowpt_0");
-    delete Dqopt_vs_eta_lowpt_0;
-    delete Dqopt_vs_eta_lowpt_1;
-    delete Dqopt_vs_eta_lowpt_2;
-    delete Dqopt_vs_eta_lowpt_chi2;
-
-    TH1F* Dqopt_vs_phi_highpt_barrel_0 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_barrel_0");
-    delete Dqopt_vs_phi_highpt_barrel_0;
-    delete Dqopt_vs_phi_highpt_barrel_1;
-    delete Dqopt_vs_phi_highpt_barrel_2;
-    delete Dqopt_vs_phi_highpt_barrel_chi2;
-    TH1F* Dqopt_vs_phi_highpt_eca_0 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_eca_0");
-    delete Dqopt_vs_phi_highpt_eca_0;
-    delete Dqopt_vs_phi_highpt_eca_1;
-    delete Dqopt_vs_phi_highpt_eca_2;
-    delete Dqopt_vs_phi_highpt_eca_chi2;
-    TH1F* Dqopt_vs_phi_highpt_ecc_0 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_highpt_ecc_0");
-    delete Dqopt_vs_phi_highpt_ecc_0;
-    delete Dqopt_vs_phi_highpt_ecc_1;
-    delete Dqopt_vs_phi_highpt_ecc_2;
-    delete Dqopt_vs_phi_highpt_ecc_chi2;
-
-    TH1F* Dqopt_vs_phi_lowpt_barrel_0 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_barrel_0");
-    delete Dqopt_vs_phi_lowpt_barrel_0;
-    delete Dqopt_vs_phi_lowpt_barrel_1;
-    delete Dqopt_vs_phi_lowpt_barrel_2;
-    delete Dqopt_vs_phi_lowpt_barrel_chi2;
-    TH1F* Dqopt_vs_phi_lowpt_eca_0 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_eca_0");
-    delete Dqopt_vs_phi_lowpt_eca_0;
-    delete Dqopt_vs_phi_lowpt_eca_1;
-    delete Dqopt_vs_phi_lowpt_eca_2;
-    delete Dqopt_vs_phi_lowpt_eca_chi2;
-    TH1F* Dqopt_vs_phi_lowpt_ecc_0 = (TH1F*) gDirectory->Get("Dqopt_vs_phi_lowpt_ecc_0");
-    delete Dqopt_vs_phi_lowpt_ecc_0;
-    delete Dqopt_vs_phi_lowpt_ecc_1;
-    delete Dqopt_vs_phi_lowpt_ecc_2;
-    delete Dqopt_vs_phi_lowpt_ecc_chi2;
-
-    delete m_deta_vs_eta_2;
-    delete m_dqopt_vs_pt_barrel_2;
-    delete m_dqopt_vs_pt_eca_2;
-    delete m_dqopt_vs_pt_ecc_2;
-    delete m_dqopt_vs_eta_highpt_2;
-    delete m_dqopt_vs_eta_lowpt_2;
-    delete m_dqopt_vs_phi_highpt_barrel_2;
-    delete m_dqopt_vs_phi_highpt_eca_2;
-    delete m_dqopt_vs_phi_highpt_ecc_2;
-    delete m_dqopt_vs_phi_lowpt_barrel_2;
-    delete m_dqopt_vs_phi_lowpt_eca_2;
-    delete m_dqopt_vs_phi_lowpt_ecc_2;
-  }
-
-  return StatusCode::SUCCESS;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h
deleted file mode 100644
index 6d89abf2d1a6e51f3193cb9eb032475527f04532..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef IDAlignMonTruthComparison_H
-#define IDAlignMonTruthComparison_H
-
-// **********************************************************************
-// IDAlignMonTruthComparison.cxx
-// AUTHORS: Beate Heinemann, Tobias Golling
-// **********************************************************************
-
-
-#include "GaudiKernel/StatusCode.h"
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "TrkTrack/TrackCollection.h"
-#include "TrkTruthData/TrackTruthCollection.h"
-
-class TH1F;
-class TH2F;
-class TProfile;
-
-namespace Trk {
-  class ITruthToTrack;
-}
-
-namespace InDetAlignMon {
-  class TrackSelectionTool;
-}
-
-class IDAlignMonTruthComparison: public ManagedMonitorToolBase
-{
-public:
-  IDAlignMonTruthComparison(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~IDAlignMonTruthComparison();
-
-  virtual StatusCode initialize();
-  virtual StatusCode bookHistograms();
-  virtual StatusCode fillHistograms();
-  virtual StatusCode procHistograms();
-
-  void RegisterHisto(MonGroup& mon, TH1* histo);
-  void RegisterHisto(MonGroup& mon, TH2* histo);
-  void RegisterHisto(MonGroup& mon, TProfile* histo);
-protected:
-  TH1F* m_truthpT {};
-  TH1F* m_truthphi {};
-  TH1F* m_trutheta {};
-
-  TH1F* m_dqopt_barrel {};
-  TH1F* m_deta_barrel {};
-  TH1F* m_dphi_barrel {};
-  TProfile* m_dphi_barrel_vs_phi {};
-  TH1F* m_dz0_barrel {};
-  TH1F* m_dd0_barrel {};
-
-  TH1F* m_dqopt_eca {};
-  TH1F* m_deta_eca {};
-  TH1F* m_dphi_eca {};
-  TH1F* m_dz0_eca {};
-  TH1F* m_dd0_eca {};
-
-  TH1F* m_dqopt_ecc {};
-  TH1F* m_deta_ecc {};
-  TH1F* m_dphi_ecc {};
-  TH1F* m_dz0_ecc {};
-  TH1F* m_dd0_ecc {};
-
-  TH2F* m_Deta_vs_eta {};
-  TProfile* m_dphi_vs_eta {};
-  TH1F* m_deta_vs_eta_1 {};
-  TH1F* m_deta_vs_eta_2 {};
-  TH1F* m_deta_vs_eta_chi2 {};
-
-  TProfile* m_dpt_vs_truthpt_barrel {};
-  TH2F* m_Dqopt_vs_pt_barrel {};
-  TH1F* m_dqopt_vs_pt_barrel_1 {};
-  TH1F* m_dqopt_vs_pt_barrel_2 {};
-  TH1F* m_dqopt_vs_pt_barrel_chi2 {};
-
-  TProfile* m_dpt_vs_truthpt_eca {};
-  TH2F* m_Dqopt_vs_pt_eca {};
-  TH1F* m_dqopt_vs_pt_eca_1 {};
-  TH1F* m_dqopt_vs_pt_eca_2 {};
-  TH1F* m_dqopt_vs_pt_eca_chi2 {};
-
-  TProfile* m_dpt_vs_truthpt_ecc {};
-  TH2F* m_Dqopt_vs_pt_ecc {};
-  TH1F* m_dqopt_vs_pt_ecc_1 {};
-  TH1F* m_dqopt_vs_pt_ecc_2 {};
-  TH1F* m_dqopt_vs_pt_ecc_chi2 {};
-
-  TH2F* m_Dqopt_vs_eta_highpt {};
-  TH1F* m_dqopt_vs_eta_highpt_1 {};
-  TH1F* m_dqopt_vs_eta_highpt_2 {};
-  TH1F* m_dqopt_vs_eta_highpt_chi2 {};
-
-  TH2F* m_Dqopt_vs_eta_lowpt {};
-  TH1F* m_dqopt_vs_eta_lowpt_1 {};
-  TH1F* m_dqopt_vs_eta_lowpt_2 {};
-  TH1F* m_dqopt_vs_eta_lowpt_chi2 {};
-
-  TH2F* m_Dqopt_vs_phi_highpt_barrel {};
-  TH1F* m_dqopt_vs_phi_highpt_barrel_1 {};
-  TH1F* m_dqopt_vs_phi_highpt_barrel_2 {};
-  TH1F* m_dqopt_vs_phi_highpt_barrel_chi2 {};
-
-  TH2F* m_Dqopt_vs_phi_highpt_eca {};
-  TH1F* m_dqopt_vs_phi_highpt_eca_1 {};
-  TH1F* m_dqopt_vs_phi_highpt_eca_2 {};
-  TH1F* m_dqopt_vs_phi_highpt_eca_chi2 {};
-
-  TH2F* m_Dqopt_vs_phi_highpt_ecc {};
-  TH1F* m_dqopt_vs_phi_highpt_ecc_1 {};
-  TH1F* m_dqopt_vs_phi_highpt_ecc_2 {};
-  TH1F* m_dqopt_vs_phi_highpt_ecc_chi2 {};
-
-  TH2F* m_Dqopt_vs_phi_lowpt_barrel {};
-  TH1F* m_dqopt_vs_phi_lowpt_barrel_1 {};
-  TH1F* m_dqopt_vs_phi_lowpt_barrel_2 {};
-  TH1F* m_dqopt_vs_phi_lowpt_barrel_chi2 {};
-
-  TH2F* m_Dqopt_vs_phi_lowpt_eca {};
-  TH1F* m_dqopt_vs_phi_lowpt_eca_1 {};
-  TH1F* m_dqopt_vs_phi_lowpt_eca_2 {};
-  TH1F* m_dqopt_vs_phi_lowpt_eca_chi2 {};
-
-  TH2F* m_Dqopt_vs_phi_lowpt_ecc {};
-  TH1F* m_dqopt_vs_phi_lowpt_ecc_1 {};
-  TH1F* m_dqopt_vs_phi_lowpt_ecc_2 {};
-  TH1F* m_dqopt_vs_phi_lowpt_ecc_chi2 {};
-
-  TH1F* m_Zmumu {};
-  TH1F* m_Zmumu_truth {};
-  TH1F* m_dZmumu {};
-  TH1F* m_dZmumu_barrel {};
-  TH1F* m_dZmumu_barrel_eca {};
-  TH1F* m_dZmumu_barrel_ecc {};
-  TH1F* m_dZmumu_ecc {};
-  TH1F* m_dZmumu_eca {};
-private:
-  std::string m_stream;
-  SG::ReadHandleKey<TrackCollection> m_tracksName {
-    this, "tracksName", "ExtendedTracks"
-  };
-  SG::ReadHandleKey<TrackTruthCollection> m_tracksTruthName {
-    this, "tracksTruthName", "ExtendedTracksTruthCollection"
-  };
-
-  ToolHandle<Trk::ITruthToTrack>         m_truthToTrack; //!< tool to create track parameters from a gen particle
-  ToolHandle<InDetAlignMon::TrackSelectionTool>         m_trackSelection; //!< tool to get tracks from StoreGate and
-                                                                          // apply selection
-  int m_checkrate;
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx
deleted file mode 100644
index a8e2b6ad5f67a8f51e58054ec87be95c1389a491..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
- */
-
-// $Id: InDetAlignMonBeamSpot.cxx,v 1.6 2009-02-05 20:55:08 beringer Exp $
-
-#include <sstream>
-#include "TH1.h"
-#include "TH2.h"
-#include "TProfile.h"
-
-//#include "GaudiKernel/MsgStream.h"
-
-#include "TrkEventPrimitives/ParamDefs.h"
-#include "TrkParticleBase/TrackParticleBaseCollection.h"
-#include "TrkSurfaces/PerigeeSurface.h"
-#include "TrkParticleBase/TrackParticleBase.h"
-#include "TrkTrack/TrackCollection.h"
-#include "xAODTracking/Vertex.h"
-
-#include "AthenaMonitoring/AthenaMonManager.h"
-#include "InDetAlignMonBeamSpot.h"
-
-
-
-InDetAlignMonBeamSpot::InDetAlignMonBeamSpot(const std::string& type, const std::string& name, const IInterface* parent)
-  : ManagedMonitorToolBase(type, name, parent),
-  m_hasBeamCondSvc(false),
-  m_hTrNPt(nullptr),
-  m_hTrPt(nullptr),
-  m_hTrDPhi(nullptr),
-  m_hTrDPhiCorr(nullptr),
-  m_hBsX(nullptr),
-  m_hBsY(nullptr),
-  m_hBsZ(nullptr),
-  m_hBsTiltX(nullptr),
-  m_hBsTiltY(nullptr),
-  m_hPvN(nullptr),
-  m_hPvNPriVtx(nullptr),
-  m_hPvNPileupVtx(nullptr),
-  m_hPvX(nullptr),
-  m_hPvY(nullptr),
-  m_hPvZ(nullptr),
-  m_hPvErrX(nullptr),
-  m_hPvErrY(nullptr),
-  m_hPvErrZ(nullptr),
-  m_hPvChiSqDoF(nullptr),
-  m_hPvXZ(nullptr),
-  m_hPvYZ(nullptr),
-  m_hPvYX(nullptr),
-  m_hPvNTracksAll(nullptr),
-  m_hPvNTracks(nullptr),
-  m_hPvTrackPt(nullptr),
-  m_hPvTrackEta(nullptr) {
-  declareProperty("useBeamspot", m_useBeamspot = true);
-  declareProperty("vxContainerWithBeamConstraint", m_vxContainerWithBeamConstraint = false);
-  declareProperty("minTracksPerVtx", m_minTracksPerVtx = 10);
-  declareProperty("minTrackPt", m_minTrackPt = 1500);  // MeV
-  declareProperty("triggerChainName", m_triggerChainName = "NoTriggerSelection");
-  declareProperty("histFolder", m_histFolder = "IDAlignMon/BeamSpot/" + m_triggerChainName);
-}
-
-InDetAlignMonBeamSpot::~InDetAlignMonBeamSpot() = default;
-
-StatusCode InDetAlignMonBeamSpot::initialize() {
-  StatusCode sc;
-
-  sc = ManagedMonitorToolBase::initialize();
-  if (!sc.isSuccess()) return sc;
-
-  if (m_beamSpotKey.initialize().isFailure()) {
-    ATH_MSG_WARNING("Failed to retrieve beamspot service - will use nominal beamspot at (0,0,0)");
-  } else {
-    m_hasBeamCondSvc = true;
-    ATH_MSG_INFO("Retrieved service beaspot ");
-  }
-
-  ATH_CHECK(m_vxContainerName.initialize());
-  ATH_CHECK(m_trackContainerName.initialize());
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode InDetAlignMonBeamSpot::bookHistograms() {
-  MonGroup al_beamspot_mon(this, m_histFolder, run);
-
-
-  if (AthenaMonManager::environment() == AthenaMonManager::online) {
-    // book histograms that are only made in the online environment...
-  }
-
-  if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) {
-    // book histograms that are only relevant for cosmics data...
-  }
-
-  if (newLowStatFlag() || newLumiBlockFlag()) {
-  }
-
-  if (newRunFlag()) {
-    // Histograms for track-based beam spot monitoring
-    m_hTrDPhi = makeAndRegisterTH2F(al_beamspot_mon, "trkDPhi", "DCA vs Phi wrt (0,0);#varphi (rad);d_{0} (mm)", 100,
-                                    -3.5, 3.5, 100, -5, 5);
-    m_hTrDPhiCorr = makeAndRegisterTH2F(al_beamspot_mon, "trkDPhiCorr",
-                                        "DCA vs Phi wrt Beamspot;#varphi (rad);d_{0} (#mum)", 100, -3.5, 3.5, 100, -200,
-                                        200);
-
-    m_hTrPt = makeAndRegisterTH1F(al_beamspot_mon, "trkPt", "Track Pt;P_{t} (GeV)", 100, 0, 5);
-    m_hTrNPt = makeAndRegisterTH1F(al_beamspot_mon, "trkNPt",
-                                   "Number of Tracks per event (after Pt cut);Number of tracks", 50, 0, 50);
-
-    // Histograms of assumed beam spot position
-    if (m_useBeamspot) {
-      m_hBsX = makeAndRegisterTH1F(al_beamspot_mon, "bsX", "Beam spot position: x;x (mm)", 100, -3, 3);
-      m_hBsY = makeAndRegisterTH1F(al_beamspot_mon, "bsY", "Beam spot position: y;y (mm)", 100, -3, 3);
-      m_hBsZ = makeAndRegisterTH1F(al_beamspot_mon, "bsZ", "Beam spot position: z;z (mm)", 100, -300, 300);
-      m_hBsTiltX = makeAndRegisterTH1F(al_beamspot_mon, "bsTiltX",
-                                       "Beam spot tile angle: x-z plane; Tilt angle (#murad)", 100, -1e3, 1e3);
-      m_hBsTiltY = makeAndRegisterTH1F(al_beamspot_mon, "bsTiltY",
-                                       "Beam spot tile angle: y-z plane; Tilt angle (#murad)", 100, -1e3, 1e3);
-    }
-
-    // Histograms for vertex-based beam spot monitoring
-    if (!m_vxContainerWithBeamConstraint) {
-      ATH_MSG_DEBUG("Container with Beam constraint");
-      // The following histograms are made either relative to the current beamspot (from BeamCondSvc),
-      // or relative to the nomial beamspot at (0,0,0) without any tilt.
-      if (m_useBeamspot) {
-        m_hPvX = makeAndRegisterTH1F(al_beamspot_mon, "pvX", "Primary vertex: x - x_{beam};x-x_{beam} (#mum)", 100,
-                                     -200, 200);
-        m_hPvY = makeAndRegisterTH1F(al_beamspot_mon, "pvY", "Primary vertex: y - y_{beam};y-y_{beam} (#mum)", 100,
-                                     -200, 200);
-        m_hPvZ = makeAndRegisterTH1F(al_beamspot_mon, "pvZ", "Primary vertex: z - z_{beam};z-z_{beam} (mm)", 100, -200,
-                                     200);
-      } else {
-        m_hPvX = makeAndRegisterTH1F(al_beamspot_mon, "pvX", "Primary vertex: x;x (mm)", 600, -5, 5);
-        m_hPvY = makeAndRegisterTH1F(al_beamspot_mon, "pvY", "Primary vertex: y;y (mm)", 600, -5, 5);
-        m_hPvZ = makeAndRegisterTH1F(al_beamspot_mon, "pvZ", "Primary vertex: z;z (mm)", 100, -200, 200);
-      }
-
-      // Histograms that are independent of the useBeamSpot parameters
-      m_hPvXZ = makeAndRegisterTH2F(al_beamspot_mon, "pvXZ", "Primary vertex: x vs z;z (mm);x (mm)", 100, -200, 200,
-                                    100, -5, 5);
-      m_hPvYZ = makeAndRegisterTH2F(al_beamspot_mon, "pvYZ", "Primary vertex: y vs z;z (mm);y (mm)", 100, -200, 200,
-                                    100, -5, 5);
-      m_hPvYX = makeAndRegisterTH2F(al_beamspot_mon, "pvYX", "Primary vertex: y vs x;x (mm);y (mm)", 100, -5, 5, 100,
-                                    -5, 5);
-      m_hPvN = makeAndRegisterTH1F(al_beamspot_mon, "pvN",
-                                   "Number of vertices (" + m_vxContainerName.key() + ", excluding dummy vertex);Number of vertices", 10, 0,
-                                   10);
-      m_hPvNPriVtx = makeAndRegisterTH1F(al_beamspot_mon, "pvNPriVtx",
-                                         "Number of primary vertices (" + m_vxContainerName.key() + ");Number of vertices", 2, 0,
-                                         2);
-      m_hPvNPileupVtx = makeAndRegisterTH1F(al_beamspot_mon, "pvNPileupVtx",
-                                            "Number of pileup vertices (" + m_vxContainerName.key() + ");Number of vertices", 10, 0,
-                                            10);
-      m_hPvErrX = makeAndRegisterTH1F(al_beamspot_mon, "pvErrX", "Primary vertex: #sigma_{x}; #sigma_{x} (mm)", 100, 0,
-                                      .5);
-      m_hPvErrY = makeAndRegisterTH1F(al_beamspot_mon, "pvErrY", "Primary vertex: #sigma_{y}; #sigma_{y} (mm)", 100, 0,
-                                      .5);
-      m_hPvErrZ = makeAndRegisterTH1F(al_beamspot_mon, "pvErrZ", "Primary vertex: #sigma_{z}; #sigma_{z} (mm)", 100, 0,
-                                      .5);
-      m_hPvChiSqDoF = makeAndRegisterTH1F(al_beamspot_mon, "pvChiSqDof",
-                                          "Primary vertex: #Chi^{2}/DoF of vertex fit;#Chi^{2}/DoF", 100, 0, 10);
-      m_hPvNTracksAll = makeAndRegisterTH1F(al_beamspot_mon, "pvNTracksAll",
-                                            "Number of tracks in primary vertex;Number of tracks", 50, 0, 50);
-      m_hPvNTracks = makeAndRegisterTH1F(al_beamspot_mon, "pvNTracks",
-                                         "Number of tracks in primary vertex;Number of tracks", 50, 0, 50);
-      m_hPvTrackPt = makeAndRegisterTH1F(al_beamspot_mon, "pvTrackPt",
-                                         "Primary vertex: original track p_{t};p_{t} (GeV)", 100, 0, 20);
-      m_hPvTrackEta = makeAndRegisterTH1F(al_beamspot_mon, "pvTrackEta", "Primary vertex: original track #eta; #eta",
-                                          100, -3, 3);
-    }
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode InDetAlignMonBeamSpot::fillHistograms() {
-  // Get beamspot information, if available
-  float beamSpotX = 0.;
-  float beamSpotY = 0.;
-  float beamSpotZ = 0.;
-  float beamTiltX = 0.;
-  float beamTiltY = 0.;
-  float scaleFactor = 1.;
-
-  if (m_useBeamspot && m_hasBeamCondSvc) {
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle {
-      m_beamSpotKey
-    };
-    Amg::Vector3D bpos = beamSpotHandle->beamPos();
-    beamSpotX = bpos.x();
-    beamSpotY = bpos.y();
-    beamSpotZ = bpos.z();
-    beamTiltX = beamSpotHandle->beamTilt(0);
-    beamTiltY = beamSpotHandle->beamTilt(1);
-    scaleFactor = 1000.;   // Use microns for some histograms when showing distance relative to beamspot
-    m_hBsX->Fill(beamSpotX);
-    m_hBsY->Fill(beamSpotY);
-    m_hBsZ->Fill(beamSpotZ);
-    m_hBsTiltX->Fill(1e6 * beamTiltX);
-    m_hBsTiltY->Fill(1e6 * beamTiltY);
-    ATH_MSG_DEBUG("Beamspot : x0 = " << beamSpotX << ", y0 = " << beamSpotY
-                                     << ", z0 = " << beamSpotZ << ", tiltX = " << beamTiltX
-                                     << ", tiltY = " << beamTiltY);
-  }
-
-  SG::ReadHandle<xAOD::TrackParticleContainer> trackCollection {
-    m_trackContainerName
-  };
-  if (not trackCollection.isValid()) {
-    ATH_MSG_DEBUG("Could not retrieve TrackParticleContainer container with key " + m_trackContainerName.key());
-    return StatusCode::SUCCESS;
-  }
-
-
-
-
-
-  // Track monitoring
-  int nTracks = 0;
-  for (xAOD::TrackParticleContainer::const_iterator trkItr = trackCollection->begin(); trkItr != trackCollection->end();
-       ++trkItr) {
-    const xAOD::TrackParticle* tpb = *trkItr;
-    if (!tpb) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Null pointer to TrackParticleBase" << endmsg;
-      continue;
-    }
-    const Trk::Perigee* perigee = &(tpb->perigeeParameters());
-    if (!perigee) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Null pointer to track perigee" << endmsg;
-      continue;
-    }
-
-    float theta = perigee->parameters()[Trk::theta];
-    float qOverPt = perigee->parameters()[Trk::qOverP] / sin(theta);
-    float charge = perigee->charge();
-    float phi0 = perigee->parameters()[Trk::phi0];
-    float d0 = perigee->parameters()[Trk::d0];
-    float z0 = perigee->parameters()[Trk::z0];
-    if (qOverPt != 0) {
-      float pT = (1 / qOverPt) * (charge);
-      // For all tracks
-      m_hTrPt->Fill(pT / 1000.);
-
-      // Select tracks to use for remaining histograms
-      if (pT < m_minTrackPt) continue;
-    }
-
-    nTracks++;
-    m_hTrDPhi->Fill(phi0, d0 * 1000.);
-
-    float beamX = beamSpotX + tan(beamTiltX) * (z0 - beamSpotZ);
-    float beamY = beamSpotY + tan(beamTiltY) * (z0 - beamSpotZ);
-    float d0corr = d0 - (-sin(phi0) * beamX + cos(phi0) * beamY);
-    m_hTrDPhiCorr->Fill(phi0, d0corr * 1e3);
-  }
-  m_hTrNPt->Fill(nTracks);
-
-
-
-  // Primary vertex monitoring - only if we have a primary vertex collection determined
-  // without beam constraint
-  if (!m_vxContainerWithBeamConstraint) {
-    SG::ReadHandle<xAOD::VertexContainer> vxContainer {
-      m_vxContainerName
-    };
-    if (not vxContainer.isValid()) {
-      ATH_MSG_DEBUG("Could not retrieve primary vertex container with key " + m_vxContainerName.key());
-      return StatusCode::SUCCESS;
-    }
-
-    m_hPvN->Fill(vxContainer->size() - 1);  // exclude dummy vertex
-    int nPriVtx = 0;
-    int nPileupVtx = 0;
-    for (const xAOD::Vertex* vx : *vxContainer) {
-      // Count different types of vertices
-      if (vx->vertexType() == xAOD::VxType::PriVtx) nPriVtx++;
-      if (vx->vertexType() == xAOD::VxType::PileUp) nPileupVtx++;
-
-      // Select good primary vertex
-      if (vx->vertexType() != xAOD::VxType::PriVtx) continue;
-      if (vx->numberDoF() <= 0) continue;
-      //      std::vector<Trk::VxTrackAtVertex*>* vxTrackAtVertex = (*vxIter)->vxTrackAtVertex();
-      m_hPvNTracksAll->Fill(vx->nTrackParticles() != 0 ? vx->nTrackParticles() : -1.);
-      if (vx->nTrackParticles() == 0 || vx->nTrackParticles() < m_minTracksPerVtx) continue;
-
-      // Found good VxCandidate to monitor - now fill histograms
-      float x = vx->position().x();
-      float y = vx->position().y();
-      float z = vx->position().z();
-      float beamX = beamSpotX + std::tan(beamTiltX) * (z - beamSpotZ);
-      float beamY = beamSpotY + std::tan(beamTiltY) * (z - beamSpotZ);
-      float beamZ = beamSpotZ;
-
-      m_hPvX->Fill((x - beamX) * scaleFactor);
-      m_hPvY->Fill((y - beamY) * scaleFactor);
-      m_hPvZ->Fill(z - beamZ);
-      //m_hPvErrX->Fill( (*vxIter)->recVertex().errorPosition().error(Trk::x) );  //Check with Anthony
-      //m_hPvErrY->Fill( (*vxIter)->recVertex().errorPosition().error(Trk::y) );
-      //m_hPvErrZ->Fill( (*vxIter)->recVertex().errorPosition().error(Trk::z) );
-
-      m_hPvErrX->Fill(std::sqrt(vx->covariancePosition()(Trk::x, Trk::x)));
-      m_hPvErrY->Fill(std::sqrt(vx->covariancePosition()(Trk::y, Trk::y)));
-      m_hPvErrZ->Fill(std::sqrt(vx->covariancePosition()(Trk::z, Trk::z)));
-
-      //m_hPvErrX->Fill(Amg::error((*vxIter)->recVertex().covariancePosition(),Trk::x));   //Why this doesn't work?
-      //m_hPvErrY->Fill(Amg::error((*vxIter)->recVertex().covariancePosition(),Trk::y));
-      //m_hPvErrZ->Fill(Amg::error((*vxIter)->recVertex().covariancePosition(),Trk::z));
-
-
-
-      m_hPvChiSqDoF->Fill(vx->chiSquared() / vx->numberDoF());
-      //Coverity report. vxTrackAtVertex cannot be NULL. taking out the ? : and setting to thee vxTrackAtVertex->size()
-      // (pbutti: 28Jan15)
-      //m_hPvNTracks->Fill( vxTrackAtVertex!=0 ? vxTrackAtVertex->size() : -1. );
-
-      m_hPvNTracks->Fill(vx->nTrackParticles());
-
-      m_hPvXZ->Fill(z, x);
-      m_hPvYZ->Fill(z, y);
-      m_hPvYX->Fill(x, y);
-
-      // Histograms on original tracks used for primary vertex
-      const std::vector< ElementLink< xAOD::TrackParticleContainer > >& tpLinks = vx->trackParticleLinks();
-      if (!tpLinks.empty()) {
-        for (const auto& tp_elem : tpLinks) {
-          const xAOD::TrackParticle* trkp = *tp_elem;
-          const Trk::Track* trk = trkp->track();
-          //      std::vector<Trk::VxTrackAtVertex*>::iterator trkIter;
-          //      for (trkIter=vxTrackAtVertex->begin(); trkIter!=vxTrackAtVertex->end(); ++trkIter) {
-          //	  const Trk::ITrackLink* trkLink = (*trkIter)->trackOrParticleLink();
-          //	  const Trk::MeasuredPerigee* measuredPerigee = dynamic_cast<const
-          // Trk::MeasuredPerigee*>(trk->initialPerigee());
-          //	  const Trk::TrackParameters* measuredPerigee = trk->initialPerigee();
-          const Trk::TrackParameters* measuredPerigee = trk->perigeeParameters();
-          const AmgSymMatrix(5) * covariance = measuredPerigee ? measuredPerigee->covariance() : nullptr;
-          m_hPvTrackEta->Fill(measuredPerigee != nullptr && covariance != nullptr ? measuredPerigee->eta() : -999.);
-          m_hPvTrackPt->Fill(measuredPerigee != nullptr && covariance ? measuredPerigee->pT() / 1000. : -999.);   // Histo
-                                                                                                                  // is
-                                                                                                                  // in
-                                                                                                                  // GeV,
-                                                                                                                  // not
-                                                                                                                  // MeV
-        }
-      }
-    }
-    m_hPvNPriVtx->Fill(nPriVtx);
-    m_hPvNPileupVtx->Fill(nPileupVtx);
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode InDetAlignMonBeamSpot::procHistograms() {
-//bool isEndOfEventsBlock, bool isEndOfLumiBlock, bool isEndOfRun )
-//if( endOfLowStatFlag() || endOfLumiBlockFlag() ) { }
-
-  //if( endOfRunFlag() ) { }
-
-  return StatusCode::SUCCESS;
-}
-
-TH1F* InDetAlignMonBeamSpot::makeAndRegisterTH1F(MonGroup& mon,
-                                                 const char* hName, const std::string& hTitle, int nBins, float minX,
-                                                 float maxX) {
-  TH1F* h = new TH1F(hName, hTitle.c_str(), nBins, minX, maxX);
-
-  h->Sumw2();
-  if (mon.regHist(h).isFailure()) {
-    ATH_MSG_WARNING("Unable to book histogram with name = " + std::string(hName));
-  }
-  return h;
-}
-
-TH2F* InDetAlignMonBeamSpot::makeAndRegisterTH2F(MonGroup& mon,
-                                                 const char* hName, const std::string& hTitle,
-                                                 int nBinsX, float minX, float maxX,
-                                                 int nBinsY, float minY, float maxY) {
-  TH2F* h = new TH2F(hName, hTitle.c_str(), nBinsX, minX, maxX, nBinsY, minY, maxY);
-
-  h->Sumw2();
-  h->SetOption("colz");
-  if (mon.regHist(h).isFailure()) {
-    ATH_MSG_WARNING("Unable to book histogram with name = " + std::string(hName));
-  }
-  return h;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.h
deleted file mode 100644
index 185368f7978a7b2f433cd2fe26c8ec560fa2d436..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
- */
-
-// ********************************************************************************
-// $Id: InDetAlignMonBeamSpot.h,v 1.5 2009-02-05 20:55:07 beringer Exp $
-//
-// InDetAlignMonBeamSpot is a module to monitor the primary vertex and beam spot in
-// the context of package InnerDetector/InDetMonitoring/InDetAlignmentMonitoring.
-//
-// Written in March 2008 by Juerg Beringer (LBNL)
-//
-// ********************************************************************************
-
-#ifndef InDetAlignMonBeamSpot_H
-#define InDetAlignMonBeamSpot_H
-
-//#include <vector>
-#include <string>
-
-#include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "EventPrimitives/EventPrimitives.h"
-#include "EventPrimitives/EventPrimitivesHelpers.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "xAODTracking/TrackParticleContainer.h"
-#include "xAODTracking/VertexContainer.h"
-#include "BeamSpotConditionsData/BeamSpotData.h"
-
-class TH1F;
-class TH2F;
-
-
-
-class InDetAlignMonBeamSpot: public ManagedMonitorToolBase {
-public:
-  InDetAlignMonBeamSpot(const std::string& type, const std::string& name, const IInterface* parent);
-
-  virtual ~InDetAlignMonBeamSpot();
-
-  virtual StatusCode initialize();
-  virtual StatusCode bookHistograms();
-  virtual StatusCode fillHistograms();
-  //virtual StatusCode procHistograms( bool isEndOfEventsBlock, bool isEndOfLumiBlock, bool isEndOfRun );
-  virtual StatusCode procHistograms();
-protected:
-
-  SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey {
-    this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"
-  };
-  bool m_hasBeamCondSvc;
-
-  TH1F* m_hTrNPt;
-  TH1F* m_hTrPt;
-  TH2F* m_hTrDPhi;
-  TH2F* m_hTrDPhiCorr;
-
-  TH1F* m_hBsX;
-  TH1F* m_hBsY;
-  TH1F* m_hBsZ;
-  TH1F* m_hBsTiltX;
-  TH1F* m_hBsTiltY;
-
-  TH1F* m_hPvN;
-  TH1F* m_hPvNPriVtx;
-  TH1F* m_hPvNPileupVtx;
-
-  TH1F* m_hPvX;
-  TH1F* m_hPvY;
-  TH1F* m_hPvZ;
-  TH1F* m_hPvErrX;
-  TH1F* m_hPvErrY;
-  TH1F* m_hPvErrZ;
-  TH1F* m_hPvChiSqDoF;
-
-  TH2F* m_hPvXZ;
-  TH2F* m_hPvYZ;
-  TH2F* m_hPvYX;
-
-  TH1F* m_hPvNTracksAll;
-  TH1F* m_hPvNTracks;
-  TH1F* m_hPvTrackPt;
-  TH1F* m_hPvTrackEta;
-private:
-  TH1F* makeAndRegisterTH1F(MonGroup& mon, const char* name, const std::string& title, int nBins, float minX,
-                            float maxX);
-  TH2F* makeAndRegisterTH2F(MonGroup& mon, const char* hName, const std::string& hTitle,
-                            int nBinsX, float minX, float maxX,
-                            int nBinsY, float minY, float maxY);
-
-  std::string m_stream;
-  bool m_useBeamspot;
-  SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerName {
-    this, "vxContainerName", "PrimaryVertices"
-  };
-  bool m_vxContainerWithBeamConstraint;
-  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackContainerName {
-    this, "trackContainerName", "InDetTrackParticles"
-  };
-  std::string m_histFolder;
-  std::string m_triggerChainName;
-  unsigned int m_minTracksPerVtx;
-  float m_minTrackPt;
-};
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx
deleted file mode 100644
index 48ebfe67cd39e5281c78260f896081dabc6e81d6..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
-   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// TrackSelectionTool.cxx
-// AUTHORS: Ben Cooper
-// **********************************************************************
-
-#include <cmath>
-
-
-
-#include "TrackSelectionAlg.h"
-
-#include "AthContainers/ConstDataVector.h"
-#include "TrkTrack/Track.h"
-#include "TrkTrackSummary/TrackSummary.h"
-
-//---------------------------------------------------------------------------------------
-
-TrackSelectionAlg::TrackSelectionAlg(const std::string& name, ISvcLocator* pSvcLocator)
-  : AthAlgorithm(name, pSvcLocator) {
-  declareProperty("TrackMinPt", m_trackMinPt = 2.0);
-  declareProperty("TrackMinEta", m_trackMinEta = 0.0);
-  declareProperty("TrackMaxEta", m_trackMaxEta = 10000.0);
-  declareProperty("TrackMaxVtxZ0", m_trackMaxVtxZ0 = 150.0);
-  declareProperty("TrackMaxD0", m_trackMaxD0 = 10.0);
-  declareProperty("MinPixelHits", m_minPixelHits = 0);
-  declareProperty("MinSCTPixHits", m_minSCTPixHits = 0);
-  declareProperty("MinBLayerHits", m_minBLayerHits = 0);
-  declareProperty("MinTRTHits", m_minTRTHits = 0);
-  declareProperty("MinTRTHitsHT", m_minTRTHitsHT = 0);
-}
-
-//---------------------------------------------------------------------------------------
-
-TrackSelectionAlg::~TrackSelectionAlg() = default;
-
-
-//---------------------------------------------------------------------------------------
-
-StatusCode TrackSelectionAlg::initialize() {
-  // get TrackSummaryTool
-  if (m_trackSumTool.retrieve().isFailure()) {
-    msg(MSG::FATAL) << "Failed to retrieve tool " << m_trackSumTool << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSumTool << endmsg;
-  }
-
-  msg(MSG::INFO) << "TrackSelectionAlg initialized" << endmsg;
-
-  ATH_CHECK(m_inputTrackCol.initialize());
-  ATH_CHECK(m_outputTrackCol.initialize());
-  ATH_CHECK(m_vertices.initialize());
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode TrackSelectionAlg::finalize() {
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode TrackSelectionAlg::execute() {
-  //if this method the decision on which trackcollection and whether to require TRT hits
-  //is made from the configuration of the TrackSlectionTool (in jobOptions)
-
-  //retrieving input track collection from Storegate
-  SG::ReadHandle<TrackCollection> tracks {
-    m_inputTrackCol
-  };
-  if (not tracks.isValid()) {
-    msg(MSG::ERROR) << "No TrackCollection with name " << m_inputTrackCol << " found in StoreGate" << endmsg;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name " << m_inputTrackCol.key() <<
-        " found in StoreGate" << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved " << tracks->size() <<
-      " reconstructed tracks from StoreGate" << endmsg;
-  }
-
-  //getting primary vertex collection from Storegate
-  SG::ReadHandle<VxContainer> vertices {
-    m_vertices
-  };
-  if (not vertices.isValid()) {
-    msg(MSG::ERROR) << "No Collection with name " << "VxPrimaryCandidate" << " found in StoreGate" << endmsg;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name " << m_vertices.key() << " with size " <<
-    vertices->size() << " found in StoreGate" << endmsg;
-
-
-  //choosing the primary vertex with the largest number of associated tracks
-  //extract the z coord of this vertex
-  float zVtx = -999.0;
-  VxContainer::const_iterator vxItr = vertices->begin();
-  VxContainer::const_iterator vxItrE = vertices->end();
-  int ntrkMax = 0;
-  for (; vxItr != vxItrE; ++vxItr) {
-    int numTracksPerVertex = (*vxItr)->vxTrackAtVertex()->size();
-    if (numTracksPerVertex > ntrkMax) {
-      ntrkMax = numTracksPerVertex;
-      //xVtx=(*vxItr)->recVertex().position()[0];
-      //yVtx=(*vxItr)->recVertex().position()[1];
-      zVtx = (*vxItr)->recVertex().position()[2];
-    }
-  }
-
-  //if there is no primary vertex set to zero
-  if (vertices->empty()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No vertex found => setting it to 0.0" << endmsg;
-    zVtx = 0.0;
-  }
-
-
-  //this is the track view that will be filled
-  auto selectedTracks = std::make_unique<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) {
-    const Trk::Track* track = *trksItr;
-    bool trackPassed = makeTrackCuts(track, zVtx);
-    if (trackPassed) selectedTracks->push_back(new Trk::Track(*track));
-  }
-
-  SG::WriteHandle<TrackCollection> outputTrackCol {
-    m_outputTrackCol
-  };
-  ATH_CHECK(outputTrackCol.record(std::move(selectedTracks)));
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-bool TrackSelectionAlg::makeTrackCuts(const Trk::Track* track, float zVtx) {
-  bool trackPassed = true;
-
-  const Trk::Perigee* startPerigee = track->perigeeParameters();
-
-  float theta = startPerigee->parameters()[Trk::theta];
-  float qOverPt = startPerigee->parameters()[Trk::qOverP] / std::sin(theta);
-  float charge = startPerigee->charge();
-  float eta = startPerigee->eta();
-  float z0 = startPerigee->parameters()[Trk::z0];
-  float d0 = startPerigee->parameters()[Trk::d0];
-  float pT = (1 / qOverPt) * (charge) / 1000;
-
-  float z0zVtx = (std::fabs(z0 - zVtx)) * std::sin(theta);
-
-  //making kinematic cuts on tracks
-  if (pT < m_trackMinPt) trackPassed = false;
-  if (std::fabs(eta) > m_trackMaxEta) trackPassed = false;
-  if (std::fabs(eta) < m_trackMinEta) trackPassed = false;
-  if (z0zVtx > m_trackMaxVtxZ0) trackPassed = false;
-  if (std::fabs(d0) > m_trackMaxD0) trackPassed = false;
-
-  std::unique_ptr<Trk::TrackSummary> summary = m_trackSumTool->summary(*track);
-
-  int nhtrt = 0;
-  int nhtrtHT = 0;
-  int nhpix = 0;
-  int nhsct = 0;
-  int nhblay = 0;
-
-  if (!summary) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) <<
-      "Could not create TrackSummary  - Track will likely fail hits requirements" << endmsg;
-  } else {
-    nhpix = summary->get(Trk::numberOfPixelHits);
-    nhblay = summary->get(Trk::numberOfInnermostPixelLayerHits);
-    nhsct = summary->get(Trk::numberOfSCTHits);
-    nhtrt = summary->get(Trk::numberOfTRTHits);
-    nhtrtHT = summary->get(Trk::numberOfTRTHighThresholdHits);
-  }
-
-  //making cuts on hit content of track
-  if (nhpix < m_minPixelHits) trackPassed = false;
-  if (nhblay < m_minBLayerHits) trackPassed = false;
-  if ((nhpix + nhsct) < m_minSCTPixHits) trackPassed = false;
-  if (nhtrt < m_minTRTHits) trackPassed = false;
-  if (nhtrtHT < m_minTRTHitsHT) trackPassed = false;
-
-  return trackPassed;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h
deleted file mode 100644
index 2287fb106aedc0bb80161f6c8e88a57cacb26a22..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef TRACKSELECTIONALG_H
-#define TRACKSELECTIONALG_H
-
-// **********************************************************************
-// TrackSelectionAlg.h
-// AUTHORS: Ben Cooper
-// **********************************************************************
-
-#include "AthenaBaseComps/AthAlgorithm.h"
-
-#include "StoreGate/ReadHandleKey.h"
-#include "TrkToolInterfaces/ITrackSummaryTool.h"
-#include "TrkTrack/TrackCollection.h"
-#include "VxVertex/VxContainer.h"
-
-#include "GaudiKernel/ToolHandle.h"
-
-#include <vector>
-
-namespace Trk {
-  class Track;
-}
-
-class TrackSelectionAlg: public AthAlgorithm
-{
-public:
-  TrackSelectionAlg(const std::string& name, ISvcLocator* pSvcLocator);
-  virtual ~TrackSelectionAlg ();
-
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-  virtual StatusCode execute();
-private:
-  bool makeTrackCuts(const Trk::Track*, float);
-
-  PublicToolHandle< Trk::ITrackSummaryTool > m_trackSumTool
-  {
-    this, "TrackSummaryTool", "Trk::TrackSummaryTool/InDetTrackSummaryTool", ""
-  }; //!<  Pointer to Trk::ITrackSummaryTool
-
-  float m_trackMinPt;
-  float m_trackMinEta;
-  float m_trackMaxEta;
-  float m_trackMaxVtxZ0;
-  float m_trackMaxD0;
-  int m_minPixelHits;
-  int m_minSCTPixHits;
-  int m_minBLayerHits;
-  int m_minTRTHits;
-  int m_minTRTHitsHT;
-
-  //these member variables only play a role if use selectTracks() zero argument method above
-  SG::ReadHandleKey<TrackCollection> m_inputTrackCol {
-    this, "InputTrackColName", "ExtendedTracks"
-  };
-  SG::WriteHandleKey<TrackCollection> m_outputTrackCol {
-    this, "OutputTrackColName", "MySelectedTracks"
-  };
-  SG::ReadHandleKey<VxContainer> m_vertices {
-    this, "PrimaryVertexName", "VxPrimaryCandidate"
-  };
-};
-
-
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx
deleted file mode 100644
index 911b53f7aac9a94e8eaa2a929029c7aacb3ae63a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
-   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
- */
-
-// **********************************************************************
-// TrackSelectionTool.cxx
-// AUTHORS: Ben Cooper
-// **********************************************************************
-
-#include "TrkToolInterfaces/ITrackSelectorTool.h"
-#include "TrackSelectionTool.h"
-#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
-
-
-#include "TrkTrack/Track.h"
-#include "TrkTrackSummary/TrackSummary.h"
-#include "VxVertex/RecVertex.h"
-#include "AthContainers/ConstDataVector.h"
-
-
-InDetAlignMon::TrackSelectionTool::TrackSelectionTool(const std::string& type, const std::string& name,
-                                                      const IInterface* parent)
-  : AthAlgTool(type, name, parent) {
-  declareInterface<TrackSelectionTool>(this);
-  declareProperty("PassAllTracks", m_passAllTracks = false);
-  declareProperty("TrackSelectorTool", m_trackSelectorTool = ToolHandle< Trk::ITrackSelectorTool >("InDet::InDetDetailedTrackSelectorTool"));
-  declareProperty("IDTrackSelectionTool", m_idtrackSelectionTool = ToolHandle<InDet::IInDetTrackSelectionTool>("InDetTrackSelectionTool/InDetTrackSelectionTool"));
-  declareProperty("UseIDTrackSelectionTool", m_useIDTrackSelectionTool = false);
-  declareProperty("DoEventPhaseCut", m_doEventPhaseCut = false);
-  declareProperty("MinEventPhase", m_minEventPhase = 5);
-  declareProperty("MaxEventPhase", m_maxEventPhase = 30);
-  declareProperty("UsePrimaryVertex", m_usePrimVtx = false);
-  declareProperty("MinTracksPerVtx", m_minTracksPerVtx = 0);
-}
-
-//---------------------------------------------------------------------------------------
-
-InDetAlignMon::TrackSelectionTool::~TrackSelectionTool() = default;
-
-
-//---------------------------------------------------------------------------------------
-
-StatusCode InDetAlignMon::TrackSelectionTool::initialize() {
-  // get TrackSelectorTool
-
-  if (!m_useIDTrackSelectionTool) {
-    if (m_trackSelectorTool.retrieve().isFailure()) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_trackSelectorTool << endmsg;
-      return StatusCode::FAILURE;
-    } else {
-      if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved tool " << m_trackSelectorTool << endmsg;
-    }
-    m_idtrackSelectionTool.disable();
-  } else {
-    if (m_idtrackSelectionTool.retrieve().isFailure()) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_idtrackSelectionTool << endmsg;
-      return StatusCode::FAILURE;
-    } else {
-      if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved tool " << m_idtrackSelectionTool << endmsg;
-    }
-    m_trackSelectorTool.disable();
-  }
-
-  ATH_CHECK(m_commTimeName.initialize(m_doEventPhaseCut));
-  ATH_CHECK(m_trackColName.initialize(not m_trackColName.key().empty()));
-  ATH_CHECK(m_VtxContainerName.initialize(m_usePrimVtx));
-
-  return StatusCode::SUCCESS;
-}
-
-//---------------------------------------------------------------------------------------
-
-StatusCode InDetAlignMon::TrackSelectionTool::finalize() {
-  return StatusCode::SUCCESS;
-}
-
-const DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(SG::ReadHandle<TrackCollection>& tracks) {
-  //if this method is used the decision on which trackcollection
-  //is made by the calling method
-  //returns a view to a new track collection object which contains the selected tracks
-
-  auto selected_tracks = std::make_unique<ConstDataVector<DataVector<Trk::Track> > >(SG::VIEW_ELEMENTS); //new track
-                                                                                                         // collection
-                                                                                                         // view
-
-  const Trk::RecVertex* pVtx = nullptr;
-
-  if (m_usePrimVtx) {
-    //get primary vertex container
-    SG::ReadHandle<VxContainer> vxContainer {
-      m_VtxContainerName
-    };
-    if (not vxContainer.isValid()) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No PrimVtxCollection with name  " << m_VtxContainerName.key() <<
-          " found in StoreGate" << endmsg;
-      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.key() <<
-        " with nvertices =  " << vxContainer->size() << " found  in StoreGate" << endmsg;
-    }
-
-    //loop over vertices and look for good primary vertex
-    for (VxContainer::const_iterator vxIter = vxContainer->begin(); vxIter != vxContainer->end(); ++vxIter) {
-      // Select good primary vertex
-      if ((*vxIter)->vertexType() != Trk::PriVtx) continue;
-      if ((*vxIter)->recVertex().fitQuality().numberDoF() <= 0) continue;
-      const std::vector<Trk::VxTrackAtVertex*>* vxTrackAtVertex = (*vxIter)->vxTrackAtVertex();
-      if (vxTrackAtVertex == nullptr || 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
-      break;//best pvtx is the first one, so can quit loop once find it
-    }
-  }
-
-  //retrieve the track collection from StoreGate to which the selection will be applied
-  //if track collection cannot be found an empty track collection is returned
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved " << tracks->size() << " reconstructed tracks from StoreGate" << endmsg;
-
-  TrackCollection::const_iterator trksItr = tracks->begin();
-  TrackCollection::const_iterator trksItrE = tracks->end();
-  for (; trksItr != trksItrE; ++trksItr) {
-    const Trk::Track* track = *trksItr;
-
-    if (m_passAllTracks) {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track automatically passes TrackSelectionTool since passAllTracks=True" << endmsg;
-      selected_tracks->push_back(track);//allow all tracks into new collection, regardless of decision
-    } else {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Testing track using trackSelectorTool..." << endmsg;
-
-      bool trackPassed = false;
-      if (pVtx) {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Using primary vertex in track selection" << endmsg;
-
-
-        if (m_useIDTrackSelectionTool) {
-          if (m_idtrackSelectionTool->accept(*track, pVtx)) trackPassed = true;
-        } else trackPassed = m_trackSelectorTool->decision(*track, pVtx);
-      } else {
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not using primary vertex in track selection" << endmsg;
-
-
-        if (m_useIDTrackSelectionTool) {
-          if (m_idtrackSelectionTool->accept(*track)) trackPassed = true;
-        } else trackPassed = m_trackSelectorTool->decision(*track);
-      }
-
-      if (m_doEventPhaseCut) {
-        // cut on the TRT_Phase (ie: the Event Phase)
-        float eventPhase = -99.0;
-
-        SG::ReadHandle<ComTime> theComTime {
-          m_commTimeName
-        };
-        if (not theComTime.isValid()) {
-          if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ComTime object not found with name TRT_Phase !!!" << endmsg;
-          trackPassed = false;
-        }
-
-        // get the event phase (one for the entire event)
-        if (theComTime.get()) {
-          eventPhase = theComTime->getTime();
-        }
-
-        if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Event phase is " << eventPhase << endmsg;
-
-        // Cut on event phase
-        if (eventPhase == -99.0 || eventPhase <= m_minEventPhase || eventPhase >= m_maxEventPhase) {
-          trackPassed = false;
-        }
-      }
-
-      if (trackPassed) {
-        selected_tracks->push_back(track);//allow only tracks that pass decision into the new collection
-        if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track passed trackSelectorTool" << endmsg;
-      } else if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track failed trackSelectorTool" << endmsg;
-    }
-  }
-
-  return selected_tracks.release()->asDataVector();
-}
-
-//---------------------------------------------------------------------------------------
-
-const DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks() {
-  //if this method the decision on which trackcollection
-  //is made from the configuration of the TrackSlectionTool (in jobOptions)
-  //returns a view to a new track collection object which contains the selected tracks
-
-  SG::ReadHandle<TrackCollection> tracks {
-    m_trackColName
-  };
-  auto selected_tracks = std::make_unique<ConstDataVector<DataVector<Trk::Track> > >(SG::VIEW_ELEMENTS);
-
-  if (not tracks.isValid()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name " << m_trackColName.key() << " found in StoreGate" << endmsg;
-    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.key() << " found in StoreGate" << endmsg;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved " << tracks->size() << " reconstructed tracks from StoreGate" << endmsg;
-  }
-
-  TrackCollection::const_iterator trksItr = tracks->begin();
-  TrackCollection::const_iterator trksItrE = tracks->end();
-  for (; trksItr != trksItrE; ++trksItr) {
-    const Trk::Track* track = *trksItr;
-
-    if (m_passAllTracks) {
-      selected_tracks->push_back(track);//allow all tracks into new collection, regardless of decision
-    } else {
-      bool trackPassed = m_trackSelectorTool->decision(*track);
-      if (trackPassed) selected_tracks->push_back(track); //allow only tracks that pass decision into the new collection
-    }
-  }
-
-  return selected_tracks.release()->asDataVector();
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
deleted file mode 100644
index 717c98f217aae7d5b9b3baf19fd623ec64dafb24..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
- */
-
-#ifndef TRACKSELECTIONTOOL_H
-#define TRACKSELECTIONTOOL_H
-
-// **********************************************************************
-// TrackSelectionTool.h
-// AUTHORS: Ben Cooper
-// **********************************************************************
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "AthContainers/DataVector.h"
-#include "CommissionEvent/ComTime.h"
-#include "StoreGate/ReadHandleKey.h"
-#include "TrkTrack/TrackCollection.h"
-#include "VxVertex/VxContainer.h"
-#include "xAODTracking/TrackParticle.h"
-#include "xAODTracking/Vertex.h"
-#include "xAODTracking/VertexContainer.h"
-#include "xAODTracking/TrackParticleContainer.h"
-#include <vector>
-
-namespace Trk {
-  class ITrackSelectorTool;
-  class Track;
-}
-
-namespace InDet {
-  class IInDetTrackSelectionTool;
-}
-
-
-namespace InDetAlignMon {
-  static const InterfaceID IID_TrackSelectionTool("InDetAlignMon::TrackSelectionTool", 1, 0);
-
-  class TrackSelectionTool: public AthAlgTool
-  {
-  public:
-    static const InterfaceID& interfaceID() {return IID_TrackSelectionTool;}
-
-    TrackSelectionTool(const std::string&, const std::string&, const IInterface*);
-    virtual ~TrackSelectionTool ();
-
-    virtual StatusCode initialize();
-    virtual StatusCode finalize();
-
-    //if this method is used the decision on which trackcollection
-    //is made by the calling method
-    const DataVector<Trk::Track>* selectTracks(SG::ReadHandle<TrackCollection>& inputTracks);
-
-    const DataVector<Trk::Track>* selectTracks();
-
-    std::string getTrackColName() {
-      return m_trackColName.key();
-    }
-
-    //Do we cut on the event phase
-    bool m_doEventPhaseCut;
-    bool m_useIDTrackSelectionTool;
-    float m_maxEventPhase;
-    float m_minEventPhase;
-    SG::ReadHandleKey<ComTime> m_commTimeName {
-      this, "CommTimeName", "TRT_Phase"
-    };
-  private:
-    ToolHandle< Trk::ITrackSelectorTool > m_trackSelectorTool; //!<  Pointer to Trk::ITrackSelectorTool
-
-    ToolHandle<InDet::IInDetTrackSelectionTool>   m_idtrackSelectionTool; //!< Pointer to
-                                                                          // InDet::IInDetTraclSelectionTool>
-
-    bool m_passAllTracks;//switch that enables track selection to be bypassed completely
-
-    //these member variables only play a role if use selectTracks() zero argument method above
-    SG::ReadHandleKey<TrackCollection> m_trackColName {
-      this, "TrackColName", ""
-    };
-    SG::ReadHandleKey<VxContainer> m_VtxContainerName {
-      this, "PrimVtxContainerName", "VxPrimaryCandidate"
-    };
-    unsigned int m_minTracksPerVtx;
-    bool m_usePrimVtx;
-  };
-}
-
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/components/InDetAlignmentMonitoring_entries.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/components/InDetAlignmentMonitoring_entries.cxx
deleted file mode 100644
index 2d7d6aa0ad7e3095669d00b37f98787e07c5caf9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/components/InDetAlignmentMonitoring_entries.cxx
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "src/IDAlignMonEfficiencies.h"
-#include "src/IDAlignMonGenericTracks.h"
-#include "src/InDetAlignMonBeamSpot.h"
-#include "src/IDAlignMonResiduals.h"
-#include "src/IDAlignMonTruthComparison.h"
-#include "src/IDAlignMonNtuple.h" 
-#include "src/IDAlignMonTrackSegments.h" 
-#include "src/IDAlignMonSivsTRT.h" 
-#include "src/TrackSelectionTool.h" 
-#include "src/TrackSelectionAlg.h" 
-#include "src/IDAlignMonPVBiases.h"
-
-DECLARE_COMPONENT( IDAlignMonPVBiases )
-DECLARE_COMPONENT( IDAlignMonEfficiencies )
-DECLARE_COMPONENT( IDAlignMonGenericTracks )
-DECLARE_COMPONENT( InDetAlignMonBeamSpot )
-DECLARE_COMPONENT( IDAlignMonResiduals )
-DECLARE_COMPONENT( IDAlignMonTruthComparison )
-DECLARE_COMPONENT( IDAlignMonNtuple )
-DECLARE_COMPONENT( IDAlignMonTrackSegments )
-DECLARE_COMPONENT( IDAlignMonSivsTRT )
-DECLARE_COMPONENT( InDetAlignMon::TrackSelectionTool )
-DECLARE_COMPONENT( TrackSelectionAlg )
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BeamSpotCalculator.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BeamSpotCalculator.C
deleted file mode 100644
index db1833ff464fc515dc728bf9d772c1f2b4dae8d4..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BeamSpotCalculator.C
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-////////////////////////
-//  BeamSpotCalculator
-////////////////////////
-// Wrote by Javier Jimenez Pena
-
-#include "BeamSpotCalculator.h"
-
-//Use: Copy the script into the folder with the TotalMonitoring.root file or viceversa and just run it as "root BeamSpotCalculator.C"
-//     You can also modify the inputfile value (below) to point the file you want to analyse.
-//     It needs to be run with ROOT 5
-
-void BeamSpotCalculator(string inputfile="TotalMonitoring.root", Double_t min = -125 , Double_t max = 125, string trkcollection = "AlignTracks_all")
-{
-  Initialize (inputfile, trkcollection);
-  AnalyseData (min,max);
-  SliceBySliceAnalysis(min,max);
-
-  //compare results with TAG Beamspot information
-  TagBeamSpot();
-
-  //print the results:
-  cout << " "<< endl;
-  cout << "************************************************************" << endl;
-  cout << " X_0 = " << GeneralParam[0]<< " +- " << GeneralParamErrors[0] << endl;
-  cout << " m_x = " << GeneralParam[1]<< " +- " << GeneralParamErrors[1] << endl;
-  cout << " Y_0 = " << GeneralParam[2]<< " +- " << GeneralParamErrors[2] << endl;
-  cout << " m_y = " << GeneralParam[3]<< " +- " << GeneralParamErrors[3] << endl;
-  cout << "************************************************************" << endl;
-
-
-}
-
-////////////////////////////////////////////
-void Initialize (string inputfile, string trkcollection)
-{
-  cout << " ** BeamSpotCalculator::Initialize ** inputfile = " << inputfile.c_str() << endl;
-  cout << "                               Trk Coll = " << trkcollection.c_str() << endl;
-  _InputFile = new TFile (inputfile.c_str());
-  if (_InputFile->IsZombie()) {
-    cout << " ** BeamSpotCalculator::Initialize ** ERROR opening file " << inputfile << endl;
-    exit(-1); // leave program
-  }
-
-  // retrieve the d0 histogram
-  string hisname("IDAlignMon/");
-  hisname.append(trkcollection.c_str());
-  hisname.append("/GenericTracks/trk_d0_vs_phi0_z0");
-
-  //cout << "    hisname = " << hisname.c_str() << endl;
-  _hd0phi0z0 = (TH3F*)_InputFile->Get(hisname.c_str());
-  
-  if (_hd0phi0z0 != nullptr){
-    _hd0phi0z0_prof = _hd0phi0z0->Project3DProfile("yx");
-  } else {
-    cout << " ** BeamSpotCalculator::Initialize ** ERROR ** histogram " << hisname.c_str() << " ** Not found ** " << endl;
-    exit(-1); // leave program
-  }
-  cout << " ** BeamSpotCalculator::Initialize ** SUCCESSFUL **"<< endl;
-  return;
-}
-
-////////////////////////////////////////////
-void AnalyseData (Double_t min , Double_t max)
-{
- 
-  gStyle->SetOptFit(1111);
-  gStyle->SetOptStat(11);
-  // fitting code should follow
-  c1 = new TCanvas("c1","h0_profile_phi0_z0",800,600);
-  // define TF2 holding the d0 calculation
-  TF2 *BSFit = new TF2("BSFit", d0_function, 0., 6.2832, min , max , 4);
-  BSFit->SetParNames("x_{0}", "m_{x}", "y_{0}" , "m_{y}");
-
-  //Set the initial values by fitting the central slide.
-  TF1 *BSFit_slice = new TF1("BSFit_slice", d0_function_slice, 0, 6.2832, 2);
-  BSFit_slice->SetParNames("x_{0}", "y_{0}" );
-
-  if (( _hd0phi0z0_prof->GetYaxis()->GetNbins())%2==0)  int initial= (( _hd0phi0z0_prof->GetYaxis()->GetNbins())/2);
-  else  int initial= (( _hd0phi0z0_prof->GetYaxis()->GetNbins())+1)/2;
-  
-  _hd0_vs_phi0_prof=_hd0phi0z0_prof->ProjectionX("_hd0_vs_phi0_prof",initial,initial);    
-  _hd0_vs_phi0_prof->Fit(BSFit_slice);
-
-  // Use the obtained x0 and y0 values as initial values for the 2-D function, fix them, and fit to obtain m_x and m_y
-
-  double slide_param[2];
-  BSFit_slice->GetParameters(slide_param);
-
-  BSFit->FixParameter(0,slide_param[0]);
-  BSFit->FixParameter(2,slide_param[1]);
-
-  //cout << "FIT CON PARAMETROS FIJADOS" << endl;
-
-  _hd0phi0z0_prof->Fit(BSFit,"R");
-
-  //cout << "FIN DEL FIT CON PARAMETROS FIJADOS" << endl;
-
-  
-  BSFit->GetParameters(GeneralParam);
-  
-  //Finally, the complete 2-D Fit is done.
-
-  BSFit->ReleaseParameter(0);
-  BSFit->ReleaseParameter(2);
-  BSFit->SetParameter(0,GeneralParam[0]);
-  BSFit->SetParameter(1,GeneralParam[1]);
-  BSFit->SetParameter(2,GeneralParam[2]);
-  BSFit->SetParameter(3,GeneralParam[3]);
-
-
-  _hd0phi0z0_prof->Fit(BSFit,"R");
-  cout << " ** BeamSpotCalculator::Initialize ** Fit chi2= " << BSFit->GetChisquare() 
-       << "   NDoF= " <<  BSFit->GetNDF() 
-       << "   Chi2/NDoF= " << BSFit->GetChisquare() / BSFit->GetNDF() 
-       << endl;
-  _hd0phi0z0_prof->Draw("colz"); 
-
-  BSFit->GetParameters(GeneralParam);	// saves the parameters of the 2-D fit for later use in slice by slice analysis 
-  GeneralParamErrors[0]= BSFit->GetParError(0);
-  GeneralParamErrors[1]= BSFit->GetParError(1);
-  GeneralParamErrors[2]= BSFit->GetParError(2);
-  GeneralParamErrors[3]= BSFit->GetParError(3);
-
-
-  return;
-}
-
-////////////////////////////////////////////
-void SliceBySliceAnalysis (Double_t min , Double_t max)
-{
-  c2 = new TCanvas("c2","h0_projection_phi0_z0",200,0,1200,800);
-  TF1 *BSFit_slice = new TF1("BSFit_slice", d0_function_slice, 0, 6.2832, 2);
-  BSFit_slice->SetParNames("x_{0}", "y_{0}" );
-
-  double param[2],param_error[2];	
-
-  if (( _hd0phi0z0_prof->GetYaxis()->GetNbins())%2==0)  int initial= (( _hd0phi0z0_prof->GetYaxis()->GetNbins())/2);
-  else  int initial= (( _hd0phi0z0_prof->GetYaxis()->GetNbins())+1)/2;
-
-  //first iteration is made twice to catch the initial conditions.
-  _hd0_vs_phi0_prof=_hd0phi0z0_prof->ProjectionX("_hd0_vs_phi0_prof",initial,initial);    
-  _hd0_vs_phi0_prof->Fit(BSFit_slice);
-
-  c2->Clear();
-  c2->Divide(6,4);
-
-  int num_of_slices = 21;
-
-  int aaa= num_of_slices/2;
-  int bbb = aaa + num_of_slices%2 ;
-  
-
-  for (int slice=initial-aaa; slice <=initial+bbb ;slice++) 
-  {
-    cout << " test slice " << slice << endl;  
-    
-    c2->cd(slice-initial+1 +aaa);
-
-    m_z0[slice-initial+aaa]=_hd0phi0z0_prof->GetYaxis()->GetBinCenter(slice);
-    m_z0_error[slice-initial+aaa]=(_hd0phi0z0_prof->GetYaxis()->GetBinWidth(slice))/2;
-    
-    _hd0_vs_phi0_prof=_hd0phi0z0_prof->ProjectionX("_hd0_vs_phi0_prof",slice,slice);    
-    _hd0_vs_phi0_prof->Fit(BSFit_slice, "ME");
-    
-    BSFit_slice->GetParameters(param); 
-    m_x0[(slice-initial+aaa)]=param[0]; 
-    m_y0[(slice-initial+aaa)]=param[1]; 
-    m_x0_error[(slice-initial+aaa)]=BSFit_slice->GetParError(0);
-    m_y0_error[(slice-initial+aaa)]=BSFit_slice->GetParError(1);
-
-    _hd0_vs_phi0_prof->DrawClone("colz");
-
-   cout << "Z_{0} = " << m_z0[slice-initial+aaa] << " -> x0 = " << param[0] << endl;
-    
-   }
-
-  TF1 *line = new TF1("line", "x*[1]+[0]", min, max);
-  
-  c3 = new TCanvas("c3","x0_vs_z0",500,0,800,600);
-  TGraphErrors *x0_vs_z0 = new TGraphErrors(21,m_z0,m_x0,m_z0_error,m_x0_error);
-  TGraphErrors *y0_vs_z0 = new TGraphErrors(21,m_z0,m_y0,m_z0_error,m_y0_error);
-
-  line->SetParNames("x_{0}", "m_{x}");
-  line->SetParameter(0,GeneralParam[0]);   
-  line->SetParameter(1,GeneralParam[1]); 	// set the initial value of the slope equal to the 2-D fit m_x and the constant equal to x0
-
-
-  c3->Divide(1,2);
-  c3->cd(1);
-  x0_vs_z0->Fit("line","RE");
-  x0_vs_z0->DrawClone("AP");
-
-  line->SetParNames("y_{0}" , "m_{y}");
-  line->SetParameter(0,GeneralParam[2]); 	// set the initial value of the slope equal to the 2-D fit m_y and the constant equal to y0
-  line->SetParameter(1,GeneralParam[3]); 
-
-  c3->cd(2);
-  y0_vs_z0->Fit("line","RE");
-  y0_vs_z0->DrawClone("AP");
-
-
-  return;
-}
-
-////////////////////////////////////////////
-
-void TagBeamSpot()
-{
-
-  // retrieve the BeamSpot histograms
-  string bsXstring("IDAlignMon/BeamSpot/NoTriggerSelection/bsX");
-  string bsYstring("IDAlignMon/BeamSpot/NoTriggerSelection/bsY");
-  string bsXtiltstring("IDAlignMon/BeamSpot/NoTriggerSelection/bsTiltX");
-  string bsYtiltstring("IDAlignMon/BeamSpot/NoTriggerSelection/bsTiltY");
-  
-  _hbsX = (TH1F*)_InputFile->Get(bsXstring.c_str());
-  _hbsY = (TH1F*)_InputFile->Get(bsYstring.c_str());
-  _hbsTiltX = (TH1F*)_InputFile->Get(bsXtiltstring.c_str());
-  _hbsTiltY = (TH1F*)_InputFile->Get(bsYtiltstring.c_str());
-
-  c4 = new TCanvas("c4","TAG_BeamSpot_info",600,200,800,600);
-  c4->Divide(2,2);
-  c4->cd(1);
-  _hbsX->Draw();
-  _hbsX->SetAxisRange(GeneralParam[0]-20*GeneralParamErrors[0] , GeneralParam[0]+20*GeneralParamErrors[0]);
-
-  DrawLine(0);
-
-  c4->cd(2);
-  _hbsY->Draw();
-  _hbsY->SetAxisRange(GeneralParam[2]-20*GeneralParamErrors[2] ,GeneralParam[2]+20*GeneralParamErrors[2]);
-
-  DrawLine(2);
-
-  c4->cd(3);
-  _hbsTiltX->Draw();
-  _hbsTiltX->SetAxisRange((GeneralParam[1]-8*GeneralParamErrors[1])*1e6 ,(GeneralParam[1]+8*GeneralParamErrors[1])*1e6);
-
-  DrawLineTilt(1);
-
-  c4->cd(4);
-  _hbsTiltY->Draw();
-  _hbsTiltY->SetAxisRange((GeneralParam[3]-8*GeneralParamErrors[3])*1e6 ,(GeneralParam[3]+8*GeneralParamErrors[3])*1e6);
-
-  DrawLineTilt(3);
-  
-  return;
-}
-
-///////////////////////////////////////
-
-void DrawLine(int number)
-{
-  TLine *l = new TLine(GeneralParam[number],1,GeneralParam[number],1000000);
-  l->Draw();
-  l->SetLineColor(2);
-
-  TLine *ld = new TLine(GeneralParam[number]-GeneralParamErrors[number],1,GeneralParam[number]-GeneralParamErrors[number],1000000);
-  ld->Draw();
-  ld->SetLineColor(3);
-
-  TLine *lu = new TLine(GeneralParam[number]+GeneralParamErrors[number],1,GeneralParam[number]+GeneralParamErrors[number],1000000);
-  lu->Draw();
-  lu->SetLineColor(3);
-  
-  return;
-}
-
-void DrawLineTilt(int number)
-{
-  TLine *l = new TLine(1e6*GeneralParam[number],1,1e6*GeneralParam[number],1000000);
-  l->Draw();
-  l->SetLineColor(2);
-
-  TLine *ld = new TLine(1e6*(GeneralParam[number]-GeneralParamErrors[number]),1,1e6*(GeneralParam[number]-GeneralParamErrors[number]),1000000);
-  ld->Draw();
-  ld->SetLineColor(3);
-
-  TLine *lu = new TLine(1e6*(GeneralParam[number]+GeneralParamErrors[number]),1,1e6*(GeneralParam[number]+GeneralParamErrors[number]),1000000);
-  lu->Draw();
-  lu->SetLineColor(3);
-  
-  return;
-}
-
-////////////////////////////////////////////
-double d0_function(double *x, double *par)
-{
-  double x0  = par[0];
-  double m_x = par[1];
-  double y0  = par[2];
-  double m_y = par[3];
-
-  double phi0 = x[0];
-  double z0   = x[1];
-
-  double myVal = -(x0 + m_x*z0) * sin(phi0) + (y0 + m_y*z0) * cos(phi0);
-
-  return myVal;
-}
-
-double d0_function_slice(double *x, double *par)
-{
-  double x0 = par[0];
-  double y0 = par[1];
- 
-  double phi0 = x[0];
-
-  double myVal = -x0 * sin(phi0) + y0 * cos(phi0);
-
-  return myVal;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BeamSpotCalculator.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BeamSpotCalculator.h
deleted file mode 100644
index 416b61a10b30f63bdf93c37ec1ec73cfdff8b009..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BeamSpotCalculator.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-////////////////////////
-//  BeamSpotCalculator
-////////////////////////
-// Wrote by Javier Jimenez Pena
-
-#include <iostream>
-#include <string>
-
-#include "TFile.h"
-#include "TH3F.h"
-#include "TF2.h"
-#include "TProfile2D.h"
-#include <TStyle.h>
-
-//
-// variables
-//
-
-TFile*  _InputFile;
-TH3F*   _hd0phi0z0;
-TProfile2D* _hd0phi0z0_prof;
-TH1D*   _hd0_vs_phi0_prof;
-
-TH1F*  _hbsX;  //TAG BeamSpot Histograms
-TH1F*  _hbsY;
-TH1F*  _hbsTiltX;
-TH1F*  _hbsTiltY;
-
-double GeneralParam[4], GeneralParamErrors[4]; //For saving the parameters of the 2-D fit
-  
-
-double ZZ;
-//
-// Prototypes
-//
-void   Initialize (string inputfile, string trkcollection);
-void   AnalyseData (Double_t min, Double_t max);
-void   SliceBySliceAnalysis (Double_t min , Double_t max);
-void   TagBeamSpot();
-void   DrawLine(int number);
-void   DrawLineTilt(int number);
-
-//Fit Functions
-double d0_function (double *x, double *par);
-double d0_function_slice(double *x, double *par);
-
-//vectors to save the results of slice by slice fits.
-const int vsize=50;
-double m_z0[vsize],m_z0_error[vsize],m_x0[vsize],m_y0[vsize],m_x0_error[vsize],m_y0_error[vsize]; 
-
-
-
-
-//////
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BowingMagEvolForStaveAll2016.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BowingMagEvolForStaveAll2016.C
deleted file mode 100644
index 4a35c631a1d2e5efc229d505b4cba633a38ee6e1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BowingMagEvolForStaveAll2016.C
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-  
-#include "include/AtlasUtils.h"
-#include "include/AtlasStyle.C"
-#include "include/AtlasLabels.C"
-#include "include/Labels.h"
-#include <TCanvas.h>
-#include <TFile.h>
-#include "TLegend.h"
-#include <TString.h>
-#include <TH2D.h>
-#include <map>
-#include <vector>
-
-void BowingMagEvolForStaveAll2016()
-{
-//=========Macro generated from canvas: CanBowingMagEvolForStaveAll/IBL stave All 
-//=========  (Sat Oct 10 02:48:25 2015) by ROOT version6.02/12
-   TCanvas *CanBowingMagEvolForStaveAll = new TCanvas("CanBowingMagEvolForStaveAll", "IBL stave All ",0,0,900,600);
-   CanBowingMagEvolForStaveAll->Range(-4.5,-31.25,35.5,31.25);
-   CanBowingMagEvolForStaveAll->SetFillColor(0);
-   CanBowingMagEvolForStaveAll->SetBorderMode(0);
-   CanBowingMagEvolForStaveAll->SetBorderSize(2);
-   CanBowingMagEvolForStaveAll->SetTickx(1);
-   CanBowingMagEvolForStaveAll->SetTicky(1);
-   CanBowingMagEvolForStaveAll->SetFrameBorderMode(0);
-   CanBowingMagEvolForStaveAll->SetFrameBorderMode(0);
-   CanBowingMagEvolForStaveAll->SetBottomMargin(0.22);
-   CanBowingMagEvolForStaveAll->SetRightMargin(0.05);
-   CanBowingMagEvolForStaveAll->SetTopMargin(0.05);
-  
-  
-   //TH1F *h_bowMagEvolIBL1 = new TH1F("h_bowMagEvolIBL1","",47,-0.5,46.5);
-   int nruns_2015 = 47;
-   int nruns_2016 = 58;
-   int nruns = nruns_2015 + nruns_2016 + 1;
-
-   // vector with the dates:
-   //std::vector<TDatime> me_runDateTime;
-   
-
-   // set 2015 after corrections
-  TH1F *h_bowMagEvolIBL1 = new TH1F("h_bowMagEvolIBL1","", nruns,-0.5, nruns-0.5);
-  h_bowMagEvolIBL1->SetBinContent(1,1.896648e10);
-  h_bowMagEvolIBL1->SetBinContent(2,2.135196e10);
-  h_bowMagEvolIBL1->SetBinContent(3,1.101701e10);
-  h_bowMagEvolIBL1->SetBinContent(4,1.313775e10);
-  h_bowMagEvolIBL1->SetBinContent(5,1.28636e10);
-  h_bowMagEvolIBL1->SetBinContent(6,1.430065e10);
-  h_bowMagEvolIBL1->SetBinContent(7,1.382757e10);
-  h_bowMagEvolIBL1->SetBinContent(8,-0.6470556e10);
-  h_bowMagEvolIBL1->SetBinContent(9,2.134798e10);
-  h_bowMagEvolIBL1->SetBinContent(10,0.8949475e10);
-  h_bowMagEvolIBL1->SetBinContent(11,-0.4941857e10);
-  h_bowMagEvolIBL1->SetBinContent(12,-1.017381e10);
-  
-  h_bowMagEvolIBL1->SetBinContent(13,1.803407);
-  h_bowMagEvolIBL1->SetBinContent(14,1.306839);
-  h_bowMagEvolIBL1->SetBinContent(15,0.07100698);
-  h_bowMagEvolIBL1->SetBinContent(16,-0.2115438);
-  h_bowMagEvolIBL1->SetBinContent(17,0.836698);
-  h_bowMagEvolIBL1->SetBinContent(18,-0.182584);
-  h_bowMagEvolIBL1->SetBinContent(19,0.3558431);
-  h_bowMagEvolIBL1->SetBinContent(20,1.392249);
-  h_bowMagEvolIBL1->SetBinContent(21,0.2004839);
-  h_bowMagEvolIBL1->SetBinContent(22,2.141745);
-  h_bowMagEvolIBL1->SetBinContent(23,2.141745);
-  h_bowMagEvolIBL1->SetBinContent(24,2.141745);
-  h_bowMagEvolIBL1->SetBinContent(25,0.6531002);
-  h_bowMagEvolIBL1->SetBinContent(26,1.13957);
-  h_bowMagEvolIBL1->SetBinContent(27,1.261269);
-  h_bowMagEvolIBL1->SetBinContent(28,1.603248);
-  h_bowMagEvolIBL1->SetBinContent(29,1.718212);
-  h_bowMagEvolIBL1->SetBinContent(30,2.02957);
-  h_bowMagEvolIBL1->SetBinContent(31,2.820183);
-  h_bowMagEvolIBL1->SetBinContent(32,0.2423804);
-  h_bowMagEvolIBL1->SetBinContent(33,2.116418);
-  h_bowMagEvolIBL1->SetBinContent(34,2.073665);
-  h_bowMagEvolIBL1->SetBinContent(35,1.970335);
-  h_bowMagEvolIBL1->SetBinContent(36,2.560627);
-  h_bowMagEvolIBL1->SetBinContent(37,2.358727);
-  h_bowMagEvolIBL1->SetBinContent(38,2.634164);
-  h_bowMagEvolIBL1->SetBinContent(39,2.276105);
-  h_bowMagEvolIBL1->SetBinContent(40,2.131346);
-  h_bowMagEvolIBL1->SetBinContent(41,2.073411);
-  h_bowMagEvolIBL1->SetBinContent(42,2.441031);
-  h_bowMagEvolIBL1->SetBinContent(43,3.6162);
-  h_bowMagEvolIBL1->SetBinContent(44,2.446549);
-  h_bowMagEvolIBL1->SetBinContent(45,2.629768);
-  h_bowMagEvolIBL1->SetBinContent(46,1.866875);
-  h_bowMagEvolIBL1->SetBinContent(47,2.685501);
-
-
-
-
-
-  h_bowMagEvolIBL1->SetBinError(1,0.5413845);
-  h_bowMagEvolIBL1->SetBinError(2,0.5347788);
-  h_bowMagEvolIBL1->SetBinError(3,0.8878446);
-  h_bowMagEvolIBL1->SetBinError(4,0.587181);
-  h_bowMagEvolIBL1->SetBinError(5,0.6501646);
-  h_bowMagEvolIBL1->SetBinError(6,0.6052314);
-  h_bowMagEvolIBL1->SetBinError(7,0.5286695);
-  h_bowMagEvolIBL1->SetBinError(8,0.4673619);
-  h_bowMagEvolIBL1->SetBinError(9,0.5130117);
-  h_bowMagEvolIBL1->SetBinError(10,0.8947007);
-  h_bowMagEvolIBL1->SetBinError(11,0.5348972);
-  h_bowMagEvolIBL1->SetBinError(12,0.5789596);
-  h_bowMagEvolIBL1->SetBinError(13,0.8094525);
-  h_bowMagEvolIBL1->SetBinError(14,0.512046);
-  h_bowMagEvolIBL1->SetBinError(15,0.5325303);
-  h_bowMagEvolIBL1->SetBinError(16,0.4179377);
-  h_bowMagEvolIBL1->SetBinError(17,0.5184069);
-  h_bowMagEvolIBL1->SetBinError(18,0.6530609);
-  h_bowMagEvolIBL1->SetBinError(19,0.4197632);
-  h_bowMagEvolIBL1->SetBinError(20,0.4220131);
-  h_bowMagEvolIBL1->SetBinError(21,0.5363397);
-  h_bowMagEvolIBL1->SetBinError(22,0.6552895);
-  h_bowMagEvolIBL1->SetBinError(23,0.533067);
-  h_bowMagEvolIBL1->SetBinError(24,0.8041184);
-  h_bowMagEvolIBL1->SetBinError(25,0.4130648);
-  h_bowMagEvolIBL1->SetBinError(26,0.3907885);
-  h_bowMagEvolIBL1->SetBinError(27,0.3689131);
-  h_bowMagEvolIBL1->SetBinError(28,0.3656114);
-  h_bowMagEvolIBL1->SetBinError(29,0.5307977);
-  h_bowMagEvolIBL1->SetBinError(30,0.5064833);
-  h_bowMagEvolIBL1->SetBinError(31,0.4247717);
-  h_bowMagEvolIBL1->SetBinError(32,0.6705536);
-  h_bowMagEvolIBL1->SetBinError(33,0.416724);
-  h_bowMagEvolIBL1->SetBinError(34,0.450326);
-  h_bowMagEvolIBL1->SetBinError(35,0.500049);
-  h_bowMagEvolIBL1->SetBinError(36,0.587815);
-  h_bowMagEvolIBL1->SetBinError(37,0.3923438);
-  h_bowMagEvolIBL1->SetBinError(38,0.5066393);
-  h_bowMagEvolIBL1->SetBinError(39,0.4092376);
-  h_bowMagEvolIBL1->SetBinError(40,0.5000976);
-  h_bowMagEvolIBL1->SetBinError(41,0.525107);
-  h_bowMagEvolIBL1->SetBinError(42,0.4034376);
-  h_bowMagEvolIBL1->SetBinError(43,0.3984655);
-  h_bowMagEvolIBL1->SetBinError(44,0.4786002);
-  h_bowMagEvolIBL1->SetBinError(45,0.5275378);
-  h_bowMagEvolIBL1->SetBinError(46,0.4945553);
-  h_bowMagEvolIBL1->SetBinError(47,0.4359028);
-  
-  //
-  h_bowMagEvolIBL1->SetMinimum(-30);
-  h_bowMagEvolIBL1->SetMaximum(30);
-  h_bowMagEvolIBL1->SetEntries(47);
-  h_bowMagEvolIBL1->SetStats(0);
-  
-  //   Int_t ci;      // for color index setting
-  //   TColor *color; // for color definition with alpha
-  //   ci = TColor::GetColor("#0033cc");
-  h_bowMagEvolIBL1->SetLineColor(kRed);
-  h_bowMagEvolIBL1->SetLineWidth(2);
-  
-  //   ci = TColor::GetColor("#0033cc");
-  h_bowMagEvolIBL1->SetMarkerColor(kRed);
-  h_bowMagEvolIBL1->SetMarkerStyle(20);
-
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(1,"279598");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(2,"279685");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(3,"279764");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(4,"279813");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(5,"279867");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(6,"279932");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(7,"279984");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(8,"280231");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(9,"280319");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(10,"280368");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(11,"280423");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(12,"280464");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(13,"280500");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(14,"280520");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(15,"280614");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(16,"280673");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(17,"280753");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(18,"280853");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(19,"280862");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(20,"280950");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(21,"280977");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(22,"281070");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(23,"281074");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(24,"281075");
-//  //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(25,"281130");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(25,"281317");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(26,"281381");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(27,"281385");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(28,"281411");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(29,"282625");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(30,"282631");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(31,"282712");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(32,"282784");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(33,"282992");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(34,"283074");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(35,"283155");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(36,"283270");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(37,"283429");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(38,"283608");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(39,"283780");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(40,"284006");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(41,"284154");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(42,"284213");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(43,"284285");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(44,"284420");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(45,"284427");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(46,"284473");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(47,"284484");
-  h_bowMagEvolIBL1->Draw("");
-  TLine *line = new TLine(h_bowMagEvolIBL1->GetXaxis()->GetXmin(), 0. , h_bowMagEvolIBL1->GetXaxis()->GetXmax(), 0.);
-  
- 
-
-//   Int_t ci;      // for color index setting
-//   TColor *color; // for color definition with alpha
-//   ci = TColor::GetColor("#0033cc");
-   h_bowMagEvolIBL1->SetLineColor(kRed);
-   h_bowMagEvolIBL1->SetLineWidth(2);
-
-//   ci = TColor::GetColor("#0033cc");
-   h_bowMagEvolIBL1->SetMarkerColor(kRed);
-   h_bowMagEvolIBL1->SetMarkerStyle(20);
-  /**
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(1,"278748");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(2,"278880");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(3,"278912");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(4,"278968");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(5,"279169");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(6,"279259");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(7,"279279");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(8,"279284");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(9,"279345");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(10,"279598");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(11,"279685");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(12,"279764");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(13,"279813");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(14,"279867");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(15,"279928");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(16,"279932");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(17,"279984");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(18,"280231");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(19,"280273");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(20,"280319");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(21,"280368");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(22,"280464");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(23,"280500");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(24,"280520");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(25,"280614");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(26,"280673");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(27,"280753");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(28,"280853");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(29,"280862");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(30,"280950");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(31,"280977");
-   h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(32,"281070");
-  **/
-  
-  
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(1,"07/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(2,"08/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(3,"09/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(4,"09/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(5,"11/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(6,"12/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(7,"13/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(8,"14/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(9,"14/09");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(1,"16/09/15");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(11,"17/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(12,"18/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(13,"19/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(14,"19/09");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(6,"20/09/15");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(16,"20/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(17,"21/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(18,"24/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(19,"24/09");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(11,"26/09/15");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(21,"26/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(22,"27/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(23,"28/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(24,"28/09");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(16,"29/09/15");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(26,"29/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(27,"30/09");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(28,"02/10");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(29,"02/10");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(21,"03/10/15");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(26,"09/10/15");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(31,"20/10/15");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(36,"24/10/15");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(41,"29/10/15");
-  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(46,"02/11/15");
-//  
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(1,"07-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(2,"08-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(3,"09-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(4,"09-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(5,"11-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(6,"12-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(7,"13-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(8,"14-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(9,"14-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(10,"16-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(11,"17-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(12,"18-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(13,"19-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(14,"19-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(15,"20-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(16,"20-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(17,"21-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(18,"24-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(19,"24-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(20,"25-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(21,"26-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(22,"27-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(23,"28-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(24,"28-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(25,"29-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(26,"29-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(27,"30-09-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(28,"02-10-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(29,"02-10-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(30,"03-10-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(31,"04-10-2015");
-//  h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(32,"05-10-2015");
-  
-  
-   h_bowMagEvolIBL1->GetXaxis()->SetLabelFont(42);
-   h_bowMagEvolIBL1->GetXaxis()->SetLabelSize(0.06);
-   h_bowMagEvolIBL1->GetXaxis()->SetTitleSize(0.045);
-   h_bowMagEvolIBL1->GetXaxis()->SetTitleFont(42);
-   h_bowMagEvolIBL1->GetYaxis()->SetTitle("Average IBL distortion magnitude [#mum]");
-   h_bowMagEvolIBL1->GetXaxis()->SetTitle("Starting date of LHC Fill");
-   h_bowMagEvolIBL1->GetYaxis()->SetLabelFont(42);
-   h_bowMagEvolIBL1->GetYaxis()->SetLabelSize(0.04);
-   h_bowMagEvolIBL1->GetYaxis()->SetTitleSize(0.045);
-   h_bowMagEvolIBL1->GetYaxis()->SetTitleFont(42);
-   h_bowMagEvolIBL1->GetZaxis()->SetLabelFont(42);
-   h_bowMagEvolIBL1->GetZaxis()->SetLabelSize(0.04);
-   h_bowMagEvolIBL1->GetZaxis()->SetTitleSize(0.04);
-   h_bowMagEvolIBL1->GetZaxis()->SetTitleFont(42);
-   h_bowMagEvolIBL1->GetXaxis()->SetTitleOffset(2.6);
-   h_bowMagEvolIBL1->GetXaxis()->LabelsOption("v");
-   h_bowMagEvolIBL1->GetXaxis()->SetNdivisions(210,false);
-
-   h_bowMagEvolIBL1->Draw("");
-  // TLine *line = new TLine(-0.5,0,31.5,0);
-
-  
-  TH1F *h_bowMagEvolIBL2 = new TH1F("h_bowMagEvolIBL2","IBL all staves bowing magnitude evolution per run",
-				    h_bowMagEvolIBL1->GetNbinsX(), h_bowMagEvolIBL1->GetXaxis()->GetXmin(), h_bowMagEvolIBL1->GetXaxis()->GetXmax()); 
-  h_bowMagEvolIBL2->SetBinContent(1,1.896648);
-  h_bowMagEvolIBL2->SetBinContent(2,2.135196);
-  h_bowMagEvolIBL2->SetBinContent(3,1.101701);
-  h_bowMagEvolIBL2->SetBinContent(4,1.313775);
-  h_bowMagEvolIBL2->SetBinContent(5,1.28636);
-  h_bowMagEvolIBL2->SetBinContent(6,1.430065);
-  h_bowMagEvolIBL2->SetBinContent(7,1.382757);
-  h_bowMagEvolIBL2->SetBinContent(8,-0.6470556);
-  h_bowMagEvolIBL2->SetBinContent(9,2.134798);
-  h_bowMagEvolIBL2->SetBinContent(10,0.5633476);
-  h_bowMagEvolIBL2->SetBinContent(11,-1.317766);
-  h_bowMagEvolIBL2->SetBinContent(12,-1.724783);
-  h_bowMagEvolIBL2->SetBinContent(13,-3.008788);
-  h_bowMagEvolIBL2->SetBinContent(14,-3.153189);
-  h_bowMagEvolIBL2->SetBinContent(15,-4.060569);
-  h_bowMagEvolIBL2->SetBinContent(16,-4.245149);
-  h_bowMagEvolIBL2->SetBinContent(17,-7.168593);
-  h_bowMagEvolIBL2->SetBinContent(18,-5.22915);
-  h_bowMagEvolIBL2->SetBinContent(19,-7.700996);
-  h_bowMagEvolIBL2->SetBinContent(20,-11.08023);
-  h_bowMagEvolIBL2->SetBinContent(21,-18.76935);
-  h_bowMagEvolIBL2->SetBinContent(22,-12.99612);
-  h_bowMagEvolIBL2->SetBinContent(23,-13.48292);
-  h_bowMagEvolIBL2->SetBinContent(24,-14.18536);
-  h_bowMagEvolIBL2->SetBinContent(25,-7.057932);
-  h_bowMagEvolIBL2->SetBinContent(26,-5.950931);
-  h_bowMagEvolIBL2->SetBinContent(27,-6.858956);
-  h_bowMagEvolIBL2->SetBinContent(28,-7.652114);
-  h_bowMagEvolIBL2->SetBinContent(29,-4.604797);
-  h_bowMagEvolIBL2->SetBinContent(30,-5.33258);
-  h_bowMagEvolIBL2->SetBinContent(31,-6.198364);
-  h_bowMagEvolIBL2->SetBinContent(32,-7.662108);
-  h_bowMagEvolIBL2->SetBinContent(33,-6.886216);
-  h_bowMagEvolIBL2->SetBinContent(34,-7.485165);
-  h_bowMagEvolIBL2->SetBinContent(35,-8.084642);
-  h_bowMagEvolIBL2->SetBinContent(36,-7.21821);
-  h_bowMagEvolIBL2->SetBinContent(37,-10.05523);
-  h_bowMagEvolIBL2->SetBinContent(38,-14.47217);
-  h_bowMagEvolIBL2->SetBinContent(39,-15.19572);
-  h_bowMagEvolIBL2->SetBinContent(40,-15.00539);
-  h_bowMagEvolIBL2->SetBinContent(41,-11.90118);
-  h_bowMagEvolIBL2->SetBinContent(42,-15.73882);
-  h_bowMagEvolIBL2->SetBinContent(43,-19.79849);
-  h_bowMagEvolIBL2->SetBinContent(44,-23.14169);
-  h_bowMagEvolIBL2->SetBinContent(45,-22.45906);
-  h_bowMagEvolIBL2->SetBinContent(46,-21.847);
-  h_bowMagEvolIBL2->SetBinContent(47,-26.28523);
-  h_bowMagEvolIBL2->SetBinError(1,0.5413845);
-  h_bowMagEvolIBL2->SetBinError(2,0.5347788);
-  h_bowMagEvolIBL2->SetBinError(3,0.8878446);
-  h_bowMagEvolIBL2->SetBinError(4,0.587181);
-  h_bowMagEvolIBL2->SetBinError(5,0.6501646);
-  h_bowMagEvolIBL2->SetBinError(6,0.6052314);
-  h_bowMagEvolIBL2->SetBinError(7,0.5286695);
-  h_bowMagEvolIBL2->SetBinError(8,0.4673619);
-  h_bowMagEvolIBL2->SetBinError(9,0.5130117);
-  h_bowMagEvolIBL2->SetBinError(10,0.8972625);
-  h_bowMagEvolIBL2->SetBinError(11,0.5339997);
-  h_bowMagEvolIBL2->SetBinError(12,0.5787392);
-  h_bowMagEvolIBL2->SetBinError(13,0.807655);
-  h_bowMagEvolIBL2->SetBinError(14,0.6379336);
-  h_bowMagEvolIBL2->SetBinError(15,0.6833411);
-  h_bowMagEvolIBL2->SetBinError(16,0.4103184);
-  h_bowMagEvolIBL2->SetBinError(17,0.5238094);
-  h_bowMagEvolIBL2->SetBinError(18,0.6558808);
-  h_bowMagEvolIBL2->SetBinError(19,0.4219276);
-  h_bowMagEvolIBL2->SetBinError(20,0.4259876);
-  h_bowMagEvolIBL2->SetBinError(21,0.5522355);
-  h_bowMagEvolIBL2->SetBinError(22,0.6670758);
-  h_bowMagEvolIBL2->SetBinError(23,0.5409073);
-  h_bowMagEvolIBL2->SetBinError(24,0.8137216);
-  h_bowMagEvolIBL2->SetBinError(25,0.418953);
-  h_bowMagEvolIBL2->SetBinError(26,0.3954922);
-  h_bowMagEvolIBL2->SetBinError(27,0.3720939);
-  h_bowMagEvolIBL2->SetBinError(28,0.3689138);
-  h_bowMagEvolIBL2->SetBinError(29,0.5305057);
-  h_bowMagEvolIBL2->SetBinError(30,0.508383);
-  h_bowMagEvolIBL2->SetBinError(31,0.4256861);
-  h_bowMagEvolIBL2->SetBinError(32,0.67439);
-  h_bowMagEvolIBL2->SetBinError(33,0.4187743);
-  h_bowMagEvolIBL2->SetBinError(34,0.452897);
-  h_bowMagEvolIBL2->SetBinError(35,0.5033457);
-  h_bowMagEvolIBL2->SetBinError(36,0.5918881);
-  h_bowMagEvolIBL2->SetBinError(37,0.3907636);
-  h_bowMagEvolIBL2->SetBinError(38,0.5134978);
-  h_bowMagEvolIBL2->SetBinError(39,0.4137497);
-  h_bowMagEvolIBL2->SetBinError(40,0.5084443);
-  h_bowMagEvolIBL2->SetBinError(41,0.5290402);
-  h_bowMagEvolIBL2->SetBinError(42,0.4078279);
-  h_bowMagEvolIBL2->SetBinError(43,0.4048347);
-  h_bowMagEvolIBL2->SetBinError(44,0.4930222);
-  h_bowMagEvolIBL2->SetBinError(45,0.5447291);
-  h_bowMagEvolIBL2->SetBinError(46,0.5092064);
-  h_bowMagEvolIBL2->SetBinError(47,0.4511144);
-
-  // 2016 Initial bowing
-  int noffset = nruns_2015 + 1; 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 1, -1.09319);  h_bowMagEvolIBL2->SetBinError(noffset+ 1, 0.726296); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 2,  0.858415); h_bowMagEvolIBL2->SetBinError(noffset+ 2, 1.13415); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 3,  1.12282);  h_bowMagEvolIBL2->SetBinError(noffset+ 3, 1.20037); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 4,  2.61717);  h_bowMagEvolIBL2->SetBinError(noffset+ 4, 0.630301); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 5,  3.04281);  h_bowMagEvolIBL2->SetBinError(noffset+ 5, 1.68062); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 6,  4.53271);  h_bowMagEvolIBL2->SetBinError(noffset+ 6, 1.31229); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 7,  5.18743);  h_bowMagEvolIBL2->SetBinError(noffset+ 7, 0.893422); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 8,  6.40669);  h_bowMagEvolIBL2->SetBinError(noffset+ 8, 0.645387); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+ 9,  6.46948);  h_bowMagEvolIBL2->SetBinError(noffset+ 9, 0.921436); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+10,  6.96103);  h_bowMagEvolIBL2->SetBinError(noffset+10, 0.967207); 
-
-  h_bowMagEvolIBL2->SetBinContent(noffset+11,  9.61658);  h_bowMagEvolIBL2->SetBinError(noffset+11, 0.63359); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+12,  7.74762);  h_bowMagEvolIBL2->SetBinError(noffset+12, 0.534215); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+13,  7.53439);  h_bowMagEvolIBL2->SetBinError(noffset+13, 0.536437); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+14,  8.53997);  h_bowMagEvolIBL2->SetBinError(noffset+14, 0.615471); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+15,  7.09937);  h_bowMagEvolIBL2->SetBinError(noffset+15, 0.623519); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+16,  9.36805);  h_bowMagEvolIBL2->SetBinError(noffset+16, 0.484097); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+17,  9.46302);  h_bowMagEvolIBL2->SetBinError(noffset+17, 0.852412); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+18,  9.72661);  h_bowMagEvolIBL2->SetBinError(noffset+18, 0.930376); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+19,  9.25499);  h_bowMagEvolIBL2->SetBinError(noffset+19, 0.600801); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+20,  7.61856);  h_bowMagEvolIBL2->SetBinError(noffset+20, 1.28417); 
-
-  h_bowMagEvolIBL2->SetBinContent(noffset+21,  9.13656);  h_bowMagEvolIBL2->SetBinError(noffset+21, 1.01832); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+22,  8.72418);  h_bowMagEvolIBL2->SetBinError(noffset+22, 0.420864); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+23,  6.04773);  h_bowMagEvolIBL2->SetBinError(noffset+23, 3.20476); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+24,  9.13688);  h_bowMagEvolIBL2->SetBinError(noffset+24, 0.510128); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+25,  7.97921);  h_bowMagEvolIBL2->SetBinError(noffset+25, 0.494575); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+26,  7.01375);  h_bowMagEvolIBL2->SetBinError(noffset+26, 0.469563); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+27, 10.2817);   h_bowMagEvolIBL2->SetBinError(noffset+27, 0.496946); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+28,  7.59964);  h_bowMagEvolIBL2->SetBinError(noffset+28, 0.703863); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+29,  6.78474);  h_bowMagEvolIBL2->SetBinError(noffset+29, 0.468381); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+30,  7.85488);  h_bowMagEvolIBL2->SetBinError(noffset+30, 0.439373); 
-
-  h_bowMagEvolIBL2->SetBinContent(noffset+31,  4.57062);  h_bowMagEvolIBL2->SetBinError(noffset+31, 0.455782); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+32,  3.33413);  h_bowMagEvolIBL2->SetBinError(noffset+32, 0.441117); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+33,  0.602291); h_bowMagEvolIBL2->SetBinError(noffset+33, 0.469204); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+34, -0.258273); h_bowMagEvolIBL2->SetBinError(noffset+34, 0.399322); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+35, -1.42844);  h_bowMagEvolIBL2->SetBinError(noffset+35, 0.389006); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+36, -1.90697);  h_bowMagEvolIBL2->SetBinError(noffset+36, 0.405537); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+37, -2.45898);  h_bowMagEvolIBL2->SetBinError(noffset+37, 0.439876); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+38, -3.78498);  h_bowMagEvolIBL2->SetBinError(noffset+38, 0.493806); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+39, -3.44989);  h_bowMagEvolIBL2->SetBinError(noffset+39, 0.549432); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+40, -3.18449);  h_bowMagEvolIBL2->SetBinError(noffset+40, 0.39276); 
-
-  h_bowMagEvolIBL2->SetBinContent(noffset+41, -3.85065);  h_bowMagEvolIBL2->SetBinError(noffset+41, 0.440223); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+42, -3.46377);  h_bowMagEvolIBL2->SetBinError(noffset+42, 0.504711); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+43, -3.45319);  h_bowMagEvolIBL2->SetBinError(noffset+43, 0.480298); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+44, -3.58678);  h_bowMagEvolIBL2->SetBinError(noffset+44, 0.387737); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+45, -3.11562);  h_bowMagEvolIBL2->SetBinError(noffset+45, 0.546831); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+46, -3.37522);  h_bowMagEvolIBL2->SetBinError(noffset+46, 0.392157); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+47, -4.22588);  h_bowMagEvolIBL2->SetBinError(noffset+47, 0.676302); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+48, -4.24833);  h_bowMagEvolIBL2->SetBinError(noffset+48, 0.381939); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+49, -3.57547);  h_bowMagEvolIBL2->SetBinError(noffset+49, 0.575213); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+50, -4.10227);  h_bowMagEvolIBL2->SetBinError(noffset+50, 0.470863); 
-
-  h_bowMagEvolIBL2->SetBinContent(noffset+51, -4.41851);  h_bowMagEvolIBL2->SetBinError(noffset+51, 0.411748); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+52, -3.75934);  h_bowMagEvolIBL2->SetBinError(noffset+52, 0.544677); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+53, -3.60712);  h_bowMagEvolIBL2->SetBinError(noffset+53, 0.522931); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+54, -3.35196);  h_bowMagEvolIBL2->SetBinError(noffset+54, 0.542296); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+55, -4.31438);  h_bowMagEvolIBL2->SetBinError(noffset+55, 0.39307); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+56, -4.65765);  h_bowMagEvolIBL2->SetBinError(noffset+56, 0.915422); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+57, -4.24684);  h_bowMagEvolIBL2->SetBinError(noffset+57, 0.424396); 
-  h_bowMagEvolIBL2->SetBinContent(noffset+58, -4.91104);  h_bowMagEvolIBL2->SetBinError(noffset+58, 0.46234); 
-
-  // 2016 bowing after alignment
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 1, -1.96399);  h_bowMagEvolIBL1->SetBinError(noffset+ 1, 0.724774);  //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+1,"24/04/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 2, -2.72711);  h_bowMagEvolIBL1->SetBinError(noffset+ 2, 1.1182);  //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+2,"25/04/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 3,  0.260247); h_bowMagEvolIBL1->SetBinError(noffset+ 3, 1.202574); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+3,"27/04/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 4,  1.49857);  h_bowMagEvolIBL1->SetBinError(noffset+ 4, 0.627577); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+4,"29/04/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 5, -0.86344);  h_bowMagEvolIBL1->SetBinError(noffset+ 5, 0.971603); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+5,"07/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 6, -0.59015);  h_bowMagEvolIBL1->SetBinError(noffset+ 6, 0.769932); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+6,"08/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 7, -0.219211); h_bowMagEvolIBL1->SetBinError(noffset+ 7, 0.577161); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+7,"09/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 8, -0.551176); h_bowMagEvolIBL1->SetBinError(noffset+ 8, 0.480291); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+8,"10/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+ 9, -0.277831); h_bowMagEvolIBL1->SetBinError(noffset+ 9, 0.724774); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+9,"10/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+10, -0.526703); h_bowMagEvolIBL1->SetBinError(noffset+10, 0.638936); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+10,"11/05/16");
-
-  h_bowMagEvolIBL1->SetBinContent(noffset+11, -0.150444); h_bowMagEvolIBL1->SetBinError(noffset+11, 0.470343);  //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+11,"12/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+12, -0.0634404);  h_bowMagEvolIBL1->SetBinError(noffset+12, 0.427838); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+12,"13/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+13, -0.253839); h_bowMagEvolIBL1->SetBinError(noffset+13, 0.428988); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+13,"14/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+14,  0.121999);  h_bowMagEvolIBL1->SetBinError(noffset+14, 0.461212); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+14,"14/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+15,  0.332271);  h_bowMagEvolIBL1->SetBinError(noffset+15, 0.471041); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+15,"15/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+16,  0.600473);  h_bowMagEvolIBL1->SetBinError(noffset+16, 0.40916); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+16,"16/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+17,  0.468158); h_bowMagEvolIBL1->SetBinError(noffset+17, 0.579008); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+17,"16/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+18,  1.16536); h_bowMagEvolIBL1->SetBinError(noffset+18, 0.615315); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+18,"17/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+19,  0.560783); h_bowMagEvolIBL1->SetBinError(noffset+19, 0.460122); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+19,"18/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+20,  0.795769); h_bowMagEvolIBL1->SetBinError(noffset+20, 0.812581); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+20,"18/05/16");
-
-  h_bowMagEvolIBL1->SetBinContent(noffset+21, 1.27305);  h_bowMagEvolIBL1->SetBinError(noffset+21, 0.670996); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+21,"21/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+22, 0.547907); h_bowMagEvolIBL1->SetBinError(noffset+22, 0.377334); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+22,"27/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+23, 1.42712);  h_bowMagEvolIBL1->SetBinError(noffset+23, 1.91749); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+23,"28/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+24, 1.31194);  h_bowMagEvolIBL1->SetBinError(noffset+24, 0.42303); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+24,"30/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+25, 1.62115);  h_bowMagEvolIBL1->SetBinError(noffset+25, 0.416707); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+25,"31/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+26, 1.3652);  h_bowMagEvolIBL1->SetBinError(noffset+26, 0.404798); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+26,"31/05/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+27,  2.18016);  h_bowMagEvolIBL1->SetBinError(noffset+27, 0.428575); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+27,"01/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+28,  2.25136);   h_bowMagEvolIBL1->SetBinError(noffset+28, 0.531716); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+28,"02/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+29,  2.65414);  h_bowMagEvolIBL1->SetBinError(noffset+29, 0.408073); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+29,"03/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+30, 2.5564);  h_bowMagEvolIBL1->SetBinError(noffset+30, 0.390734); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+30,"04/06/16");
-
-  h_bowMagEvolIBL1->SetBinContent(noffset+31, 1.28252);  h_bowMagEvolIBL1->SetBinError(noffset+31,0.399183); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+31,"05/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+32, 0.59300); h_bowMagEvolIBL1->SetBinError(noffset+32, 0.391888); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+32,"06/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+33, 1.41979);  h_bowMagEvolIBL1->SetBinError(noffset+33, 0.4087); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+33,"15/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+34, -5.83847);  h_bowMagEvolIBL1->SetBinError(noffset+34,0.397381); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+34,"15/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+35, -6.26797);  h_bowMagEvolIBL1->SetBinError(noffset+35, 0.387407); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+35,"15/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+36, -5.41707);   h_bowMagEvolIBL1->SetBinError(noffset+36, 0.402859); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+36,"16/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+37, -5.40687); h_bowMagEvolIBL1->SetBinError(noffset+37, 0.435224); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+37,"17/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+38, -4.13609); h_bowMagEvolIBL1->SetBinError(noffset+38, 0.488578); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+38,"17/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+39, -4.39038); h_bowMagEvolIBL1->SetBinError(noffset+39,0.542634);// h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+39,"18/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+40, -5.04054);   h_bowMagEvolIBL1->SetBinError(noffset+40, 0.39175); // h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+40,"19/06/16");
-
-  h_bowMagEvolIBL1->SetBinContent(noffset+41, -0.640258);  h_bowMagEvolIBL1->SetBinError(noffset+41, 0.437891); // h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+41,"19/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+42, -0.503099); h_bowMagEvolIBL1->SetBinError(noffset+42, 0.498335); // h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+42,"20/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+43, -0.444113);  h_bowMagEvolIBL1->SetBinError(noffset+43, 0.525269); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+43,"21/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+44, -0.159562);  h_bowMagEvolIBL1->SetBinError(noffset+44, 0.387441); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+44,"24/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+45, -0.368219);  h_bowMagEvolIBL1->SetBinError(noffset+45, 0.54017); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+45,"26/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+46, -0.452835);   h_bowMagEvolIBL1->SetBinError(noffset+46, 0.391741); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+46,"26/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+47, -0.663758); h_bowMagEvolIBL1->SetBinError(noffset+47, 0.6772); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+47,"28/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+48, -0.41907); h_bowMagEvolIBL1->SetBinError(noffset+48, 0.381287); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+48,"28/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+49, -0.458063); h_bowMagEvolIBL1->SetBinError(noffset+49, 0.565279); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+49,"28/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+50, -0.636045);   h_bowMagEvolIBL1->SetBinError(noffset+50, 0.467322); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+50,"29/06/16");
-
-  h_bowMagEvolIBL1->SetBinContent(noffset+51, -0.715439);  h_bowMagEvolIBL1->SetBinError(noffset+51, 0.410293); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+51,"29/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+52, -0.57544); h_bowMagEvolIBL1->SetBinError(noffset+52, 0.537664); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+51,"29/06/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+53, -0.404361);  h_bowMagEvolIBL1->SetBinError(noffset+53,0.51515); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+53,"01/07/16"); 
-  h_bowMagEvolIBL1->SetBinContent(noffset+54, -0.462195);  h_bowMagEvolIBL1->SetBinError(noffset+54, 0.531714); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+54,"02/07/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+55, -0.48065);  h_bowMagEvolIBL1->SetBinError(noffset+55, 0.391687); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+55,"03/07/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+56, -0.380608);   h_bowMagEvolIBL1->SetBinError(noffset+56, 0.896067); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+56,"04/07/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+57, -0.214873); h_bowMagEvolIBL1->SetBinError(noffset+57, 0.422862); //h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+57,"04/07/16");
-  h_bowMagEvolIBL1->SetBinContent(noffset+58, -0.712058); h_bowMagEvolIBL1->SetBinError(noffset+58, 0.459442); h_bowMagEvolIBL1->GetXaxis()->SetBinLabel(noffset+58,"04/07/16");
-
-
-  h_bowMagEvolIBL2->SetMinimum(-30);
-  h_bowMagEvolIBL2->SetMaximum(11);
-  //h_bowMagEvolIBL2->SetEntries(47);
-  h_bowMagEvolIBL2->SetStats(0);
-  h_bowMagEvolIBL2->Draw("same");
-  Int_t ci;      // for color index setting
-  TColor *color; // for color definition with alpha
-  ci = TColor::GetColor("#0033cc");
-  h_bowMagEvolIBL2->SetLineColor(ci);
-  h_bowMagEvolIBL2->SetLineWidth(2);
-  
-  ci = TColor::GetColor("#0033cc");
-  h_bowMagEvolIBL2->SetMarkerColor(ci);
-  h_bowMagEvolIBL2->SetMarkerStyle(24);
-  h_bowMagEvolIBL2->Draw("same");
-  
-  
-//  
-//  TH1F *h_bowMagEvolIBL3 = new TH1F("h_bowMagEvolIBL3","IBL all staves bowing magnitude evolution per run",47,-0.5,46.5);
-//  h_bowMagEvolIBL3->SetBinContent(28,-0.4441209);
-//  h_bowMagEvolIBL3->SetBinContent(29,0.7010919);
-//  h_bowMagEvolIBL3->SetBinContent(30,-0.988483);
-//  h_bowMagEvolIBL3->SetBinContent(31,-1.473469);
-//  h_bowMagEvolIBL3->SetBinContent(32,-1.764734);
-//  h_bowMagEvolIBL3->SetBinContent(33,-0.418724);
-//  h_bowMagEvolIBL3->SetBinContent(34,-2.540311);
-//  h_bowMagEvolIBL3->SetBinContent(35,-2.674458);
-//  h_bowMagEvolIBL3->SetBinContent(36,-1.636667);
-//  h_bowMagEvolIBL3->SetBinContent(37,-0.6487529);
-//  h_bowMagEvolIBL3->SetBinContent(38,-1.197403);
-//  h_bowMagEvolIBL3->SetBinContent(39,-1.625576);
-//  h_bowMagEvolIBL3->SetBinContent(40,-0.999604);
-//  h_bowMagEvolIBL3->SetBinContent(41,-1.068903);
-//  h_bowMagEvolIBL3->SetBinContent(42,-0.922247);
-//  h_bowMagEvolIBL3->SetBinContent(43,-1.081638);
-//  h_bowMagEvolIBL3->SetBinContent(44,-0.8787865);
-//  h_bowMagEvolIBL3->SetBinContent(45,-1.286169);
-//  h_bowMagEvolIBL3->SetBinContent(46,-1.784337);
-//  h_bowMagEvolIBL3->SetBinContent(47,-0.763969);
-//  h_bowMagEvolIBL3->SetBinError(28,0.8135155);
-//  h_bowMagEvolIBL3->SetBinError(29,0.7993051);
-//  h_bowMagEvolIBL3->SetBinError(30,1.668258);
-//  h_bowMagEvolIBL3->SetBinError(31,1.255279);
-//  h_bowMagEvolIBL3->SetBinError(32,0.8164883);
-//  h_bowMagEvolIBL3->SetBinError(33,1.440603);
-//  h_bowMagEvolIBL3->SetBinError(34,0.8101156);
-//  h_bowMagEvolIBL3->SetBinError(35,0.8463334);
-//  h_bowMagEvolIBL3->SetBinError(36,1.11358);
-//  h_bowMagEvolIBL3->SetBinError(37,1.46284);
-//  h_bowMagEvolIBL3->SetBinError(38,0.3996555);
-//  h_bowMagEvolIBL3->SetBinError(39,0.5118914);
-//  h_bowMagEvolIBL3->SetBinError(40,0.4131203);
-//  h_bowMagEvolIBL3->SetBinError(41,0.5056021);
-//  h_bowMagEvolIBL3->SetBinError(42,0.5434087);
-//  h_bowMagEvolIBL3->SetBinError(43,0.4497851);
-//  h_bowMagEvolIBL3->SetBinError(44,0.4227611);
-//  h_bowMagEvolIBL3->SetBinError(45,0.5309765);
-//  h_bowMagEvolIBL3->SetBinError(46,0.6609266);
-//  h_bowMagEvolIBL3->SetBinError(47,0.4843258);
-//  h_bowMagEvolIBL3->SetMinimum(-36);
-//  h_bowMagEvolIBL3->SetMaximum(12);
-//  h_bowMagEvolIBL3->SetEntries(20);
-//  h_bowMagEvolIBL3->SetStats(0);
-//  h_bowMagEvolIBL3->SetLineColor(kGray+3);
-//  h_bowMagEvolIBL3->SetLineWidth(2);
-//  
-//  //   ci = TColor::GetColor("#0033cc");
-//  h_bowMagEvolIBL3->SetMarkerColor(kGray+3);
-//  h_bowMagEvolIBL3->SetMarkerStyle(20);
-//  h_bowMagEvolIBL3->Draw("same");
-//  
-  
-  
-   ci = TColor::GetColor("#666666");
-   line->SetLineColor(ci);
-   line->SetLineStyle(2);
-   line->Draw();
-  
-   line->DrawLine(nruns_2015, h_bowMagEvolIBL1->GetMinimum(), nruns_2015, h_bowMagEvolIBL1->GetMaximum());
-
-
-//   TPaveText *pt = new TPaveText(0.15,0.9339831,0.85,0.995,"blNDC");
-//   pt->SetName("title");
-//   pt->SetBorderSize(0);
-//   pt->SetFillColor(0);
-//   pt->SetFillStyle(0);
-//   pt->SetTextFont(42);
-//   TText *AText = pt->AddText("IBL all staves bowing magnitude evolution per run");
-//   pt->Draw();
-//   CanBowingMagEvolForStaveAll->Modified();
-//   CanBowingMagEvolForStaveAll->cd();
-//   CanBowingMagEvolForStaveAll->SetSelected(CanBowingMagEvolForStaveAll);
-  
-
-  
-  ATLASLabel(0.15,0.85,"Internal",1,0.05);
-  TLatex l;
-  l.SetTextSize(0.05);
-  l.SetNDC();
-  l.SetTextColor(1);
-  // l.DrawLatex(0.4,0.95,"Preliminary");
-  l.SetTextSize(0.04);
-  //l.DrawLatex(0.275,0.85,"#sqrt{s}=13 TeV");
- // l.DrawLatex(0.275,0.85,"Preliminary");
-  
-  
-  TLegend* leg = new TLegend(0.15,0.675,0.3,0.825);
-  leg->SetFillColor(0);
-  leg->SetLineColor(0);
-  leg->SetTextSize(0.04);
-  leg->SetShadowColor(0);
-  leg->SetHeader("Data 2015 / 2016");
-  leg->AddEntry(h_bowMagEvolIBL2,"Default alignment","ep");
-  leg->AddEntry(h_bowMagEvolIBL1,"Run averaged alignment","ep");
-  leg->Draw("same");
-  
-  CanBowingMagEvolForStaveAll->Print("BowingMagEvolForStaveAll.pdf");
-  CanBowingMagEvolForStaveAll->Print("BowingMagEvolForStaveAll.png");
-  
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/EigenAna.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/EigenAna.C
deleted file mode 100644
index 8c8f80015941539f0e907c581d45746079d71b6f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/EigenAna.C
+++ /dev/null
@@ -1,3082 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/////////////////////////////////////
-// EigenAna.C
-//
-// Analysis of the eigen values and vectors 
-///////////////////////////////////////
-#include <include/EigenAna.h>
-/////////////////////////////////////////////////
-void EigenAna(char dirname[80]="noname", char SolveOpt[80]="wholeID", Int_t NRemoveModes=-1)
-{
-  //gROOT->SetBatch();
-  StatusCode status = SUCCESS;
-  SetPrintLevel(1);
-
-  SolveOptions = new TString(SolveOpt);
-  HandleSolveOptions();
-  if (QuietMode) SetPrintLevel(0);
-
-  // 
-  status = EigenAna_init(dirname); if (status == FAILURE) return;
-  if (NRemoveModes>=0)   SetNModesToRemove(NRemoveModes); // only for strategy 1, fixed number of weak modes to remove
-  //
-  EigenAna_operate();
-  EigenAna_end();
-
-  return;
-}
-
-//////////////////////////////////////////////
-StatusCode EigenAna_init(const char *dname)
-{
-  StatusCode status = SUCCESS;
-
-  if (GetPrintLevel()>=1) {
-    std::cout << std::endl;
-    std::cout << "              +-------------------------+ " << std::endl;
-    std::cout << "              |        EigenAna         | " << std::endl;
-    std::cout << "              +-------------------------+ " << std::endl;
-    std::cout << std::endl;
-  }
-  
-  // timing
-  TStopwatch *InitTime = new TStopwatch();  InitTime->Start();
-
-  // init graphics style;
-  InitGraphicsStyle();
-    
-  // setting the directory name where the big vector and the big files reside
-  SetDirectory(dname);
-
-  // Input From TFile
-  SetHitCut(10);
-  if (UseTFileInput) { 
-    // ReadTFIle reads the bigmatrix, bigvector, hits and configuration
-     if ( ReadTFile() == FAILURE) {
-       return FAILURE;
-     }
-  }
-  
-  // Once the BigMatrix is read, then plot it as a 2D histogram
-  // Init Canvas
-  if (!QuietMode) OpenCanvas();
-
-  // Set Ndof per module/structure
-  SetActiveNdof(1,1,1,1,1,1);   // This may be used to swicth off some of the dofs from the input matrix
-
-  // Set weak mode removal strategy
-  SetWeakModeRemovalStrategy(1);
-
-  SetNModesToRemove(0); // only for strategy 1, fixed number of weak modes to remove
-  
-  SetPullLimit(1.0); // for strategies 2 and above
-
-  // Init output file
-  InitOutputFile();
-
-  // timing
-  InitTime->Stop();
-  if (GetPrintLevel()>=1) {
-    std::cout << " <ea> Initialization time: ";
-    InitTime->Print();
-    std::cout << std::endl;
-  }
-  return status;
-}
-
-//////////////////////////////////////////////
-void EigenAna_operate()
-{
-  // Now prepare the BigVector and BigMatrix according to the solve options
-  BookBigMatrixHisto(); // plot matrix
-  MatrixAndVectorPreConditioning();  
-  
-  // If required, print the matrix and vector that are used for 
-  // the alignment corrections solving
-  if (GetPrintLevel()>=5) {
-    std::cout << " <ea> ---- OPERATE -------- with  BigMatrix: size " << BigMatrix.GetNrows() 
-	 << " x  " << BigMatrix.GetNcols()  << " ------- " << std::endl; 
-    BigMatrix.Print();
-    std::cout << " <ea> ---- OPERATE -------- EO BigMatrix ------------ " << std::endl; 
-    std::cout << std::endl;
-    std::cout << " <ea> ---- OPERATE -------- with big vector of size " 
-	 << BigVector.GetNoElements() << " --------- " << std::endl;
-    BigVector.Print();
-    std::cout << " <ea> ---- OPERATE -------- EO BigVector ------------ " << std::endl; 
-    std::cout << std::endl;
-  }
-
-  
-  if (DoSolving) {
-    // Now solve by diagonalization
-    SolveInDiagonalBase();
-    
-    // Now solve by diagonalization
-    SolveWithWeakModeRemoval();    
-  }
-}
-
-//////////////////////////////////////////////
-void EigenAna_end()
-{
-  // save histograms
-  EAHistDir->Write("0");
-  //
-  if (GetPrintLevel()>=1){
-    std::cout << std::endl;
-    std::cout << "                +-------------------------+ " << std::endl;
-    std::cout << "                | Game Over. Insert coin  | " << std::endl;
-    std::cout << "                +-------------------------+ " << std::endl;
-  }
-  return;
-}
-
-
-//////////////////////////////////////////////
-//////////////////////////////////////////////
-//////////////////////////////////////////////
-
-StatusCode ReadTFile()
-{
-  StatusCode status=SUCCESS;
-
-  // open the TFile
-
-  if (GetPrintLevel()>=3) std::cout << " <ea> ReadTFile <ea> START " << std::endl;
-  char fname[240];
-
-  sprintf(fname,"%s%s",DirName->Data(),"/AlignmentTFile.root");
-  if(NewAlign) sprintf(fname,"%s%s",DirName->Data(),"vector.bin");
-
-  //////////////////////////////////////
-  // open file
-  //////////////////////////////////////
-  InputTFileName = new TString(DirName->Data());
-  if (!InputTFileName->Contains(".root")) {
-    // if only the direcotry is given, it looks for the default filename: AlignmentTFile.root
-    // otherwise, the file specified by the user is read.
-    InputTFileName->Append("/AlignmentTFile.root"); 
-  }
-
-  InputTFile = new TFile(InputTFileName->Data(),"READ");
-  std::cout << " <ea> reading " << fname << std::endl; 
-
-  // first step -- read the scale factor
-  if (GetPrintLevel()>=3) {
-    std::cout << " <ea> reading ScaleFactor from " << fname << std::endl; 
-  }  
-  Double_t Scale=1.0;
-  Scale = (*(TVectorD*)InputTFile->Get("Scale"))[0]; 
-  SetScaleFactor(Scale);
-
-  if (GetPrintLevel()>=1) {
-    std::cout << std::endl << " <ea> ReadTFile <ea> Scale factor: size " << Scale << std::endl;
-  }
-
-  
-  // second step -- read the big matrix
-  TMatrixDSparse* InputBigMatrix;
-  InputBigMatrix = (TMatrixDSparse*)InputTFile->Get("Matrix");
-  if (GetPrintLevel()>9) {
-    std::cout << " <ea> ------- printing InputBigMatrix: size " 
-    << InputBigMatrix->GetNcols() << " x " << InputBigMatrix->GetNrows() << " ------- " << std::endl; 
-    InputBigMatrix->Print();
-    std::cout << " <ea> ------------ EO InputBigMatrix ------------ " << std::endl; 
-    std::cout << std::endl;
-  }
-
-
-  // The diagonalization step needs to convert the input matris to a TMatrixDSym
-  BigMatrix.ResizeTo(InputBigMatrix->GetNrows(),InputBigMatrix->GetNcols());
-  BigMatrix.Zero();
-  for (int ii=0;ii<InputBigMatrix->GetNcols();ii++) {
-  	const TMatrixTSparseRow_const<double> myRow = (*InputBigMatrix)[ii];
-	int i =  myRow.GetRowIndex();
-	for (int jj=0;jj<=myRow.GetNindex()-1;jj++) {
-		int j = (myRow.GetColPtr())[jj];
-		const double  myElement= (myRow.GetDataPtr())[jj];
-	    BigMatrix(i,j) = myElement;
-	    BigMatrix(j,i) = myElement;
-	}
-  }       
-	    
-
-  // Apply scale factor
-  BigMatrix *= 1./Scale;
-
-  if (GetPrintLevel()>3) {
-    std::cout << " <ea> ReadTFile <ea>   ------- printing BigMatrix (after normalization): size " 
-	      << BigMatrix.GetNcols() << " x " << BigMatrix.GetNrows() << " ------- " << std::endl; 
-    BigMatrix.Print();
-    std::cout << " <ea> ------------ EO BigMatrix ------------ " << std::endl; 
-    std::cout << std::endl;
-  }
-  
-  
-  // Third step -- read the big vector
-  TVectorD* InputBigVector;
-  InputBigVector = (TVectorD*)InputTFile->Get("Vector");
-  if( !InputBigVector ){
-    return FAILURE;	      
-  }
-  if (GetPrintLevel()>9) {
-    std::cout << " <ea> ------- printing InputBigVector: size " 
-	      << InputBigVector->GetNoElements() << " ------- " << std::endl; 
-    InputBigVector->Print();
-    std::cout << " <ea> ------------ EO InputBigVector ------------ " << std::endl; 
-    std::cout << std::endl;
-  }
-  BigVector.ResizeTo(InputBigVector->GetNoElements());
-  for (int i=0; i<InputBigVector->GetNoElements(); i++) {
-    double element = 1;
-    element = (*InputBigVector)[i]; 
-    BigVector(i)= element;
-  }
-
-  // Apply scale factor
-  BigVector *= 1./Scale;
- 
-  if (GetPrintLevel()>3) {
-    std::cout << " <ea> ReadTFile <ea> ------- printing BigVector: size " 
-	      << BigVector.GetNoElements() << " ------- " << std::endl; 
-    BigVector.Print();
-    std::cout << " <ea> ------------ EO BigVector ------------ " << std::endl; 
-    std::cout << std::endl;
-  }
-  
-
-  // fourth step -- Now read the structure identifiers
-  TVectorD* InputIdentifier;
-  InputIdentifier = (TVectorD*)InputTFile->Get("ModuleID");
-  Identifiers.ResizeTo(InputBigVector->GetNoElements());
-  for(int i=0; i<InputBigVector->GetNoElements(); i++) {
-    Identifiers[i] = (*InputIdentifier)[i];
-  }
-  
-  
-  // fith step -- Now read the dof type
-  TVectorD* InputDoFs;
-  InputDoFs = (TVectorD*)InputTFile->Get("dof");
-  double dof_tmp;
-  if (InputDoFs != NULL) {
-    DoFs.ResizeTo(InputBigVector->GetNoElements());
-    for(int i=0; i<InputBigVector->GetNoElements(); i++) {
-      dof_tmp = (*InputDoFs)[i];
-      unsigned long long target;
-      memcpy(&target, &dof_tmp, sizeof(target));
-      unsigned long long dof = target;
-      DoFs[i] = dof;
-    }
-  }
-  
-  
-  // sixth step -- Read Hitmap
-  TVectorD* InputHitmap;
-  InputHitmap = (TVectorD*)InputTFile->Get("Hits");
-  
-  // Fill RowsUsed with 0s if row won't be used or with 1s if it will be used
-  int tmp_i=0;
-  RowsUsed.ResizeTo(InputBigVector->GetNoElements());
-  for(int i=0; i<InputBigVector->GetNoElements(); i++) {
-    RowsUsed[i]=1; // by default rows are used
-    if((*InputHitmap)[tmp_i]<GetHitCut()) RowsUsed[i]=0;
-    // trick to align IBL only if(i>5) RowsUsed[i]=0;
-    if(i<(InputBigVector->GetNoElements()-1) && (*InputIdentifier)[i]!=(*InputIdentifier)[i+1]) tmp_i++;
-  }
-  if (GetPrintLevel()>0) {
-   	std::cout << " Input Hitmap: " << std::endl;
-   	InputHitmap->Print();
-	std::cout << std::endl;
-	std::cout << "Rows to be used using HitCut: "<< GetHitCut() << std::endl;
-  	RowsUsed.Print();
-  	std::cout << std::endl;
-   }  
-  
-  // Remove  rows / columns to remove in case of low statistics
-  if(GetHitCut()>0) RemoveRows();
-
-  if (GetPrintLevel()>=1) {
-    std::cout << " <ea> ReadTFile <ea> big matrix size: " <<  BigMatrix.GetNcols() << " x " << BigMatrix.GetNrows() << std::endl;
-    std::cout << " <ea> ReadTFile <ea> big vector size: " <<  BigVector.GetNoElements() << std::endl;
-  }
-
-  
-  //
-  // Now, let's find the structure names
-  // this is done in two stages
-  // first find how many structures there are
-  // second repeat and set the name of the structure
-  // First pass
-  double id;
-  int nstruct = 0;
-  unsigned long long id_tmp = 0;
-  unsigned long long id_long = 0;
-
-  for(int i=0; i<BigVector.GetNoElements(); i++){
-    id = Identifiers[i];
-    memcpy(&id_tmp, &id, sizeof(id_tmp));
-    if(id_tmp != id_long) nstruct++; // a new structure is found
-    id_long = id_tmp;
-    //    std::cout << " Identifier " << id << std::endl;
-    //std::cout << " Identifier l " << id_long << std::endl;
-    //printf("Valor en binari per a %d: %32b\\n",i,id_long);
-    //cout << i << "nstruct: " << nstruct << endl;
-    FindDetectorType(id_long,nstruct-1,i);
-  }
-  SetNofStructures(nstruct);
-  SetNofStructuresPerDetec();
-
-  // second pass
-  nstruct = 0; // reset
-  id_tmp = 0;
-  id_long = 0;
-  for(int i=0; i<BigVector.GetNoElements(); i++){
-    id = Identifiers[i];
-    memcpy(&id_tmp, &id, sizeof(id_tmp));
-    if(id_tmp != id_long) nstruct++;
-    id_long = id_tmp;
-    // std::cout << " <ea> Identifier " << id << " of element " << i << std::endl;
-    // std::cout << " <ea> Identifier long " << id_long << std::endl;
-    // printf(" << <ea> Valor en binari de l element %d: %64b \n", i, id_long);
-    // std::cout <<  " std::bitset<64>(id_long) = " << std::bitset<64>(id_long) << endl;
-    // cout << " <ea>  element " << i << " is in structure: " << nstruct << endl;
-    ExtractName(id_long,nstruct-1);
-  }
-
-  //
-  SetDoFTypes();
-
-  // That's it !
-  delete InputBigMatrix;
-  delete InputBigVector;
-  delete InputDoFs;
-  
-  if (GetPrintLevel()>=3) std::cout << " <ea> ReadTFile <ea>  COMPLETED " << std::endl;
-  return status;
-}
-
-
-//////////////////////////////////////////////
-void SetPrintLevel(int iLevel)
-{
-  if (iLevel<0) iLevel=0;
-  if (iLevel>10) iLevel=10;
-  PrintLevel = iLevel;
-}
-//////////////////////////////////////////////
-Int_t GetPrintLevel()
-{
-  return PrintLevel;
-}
-
-//////////////////////////////////////////////
-void HandleSolveOptions()
-{
-  SolveOptions->ToLower();
-  if (GetPrintLevel()>=9) {
-    std::cout << " <ea> Handling Solve options --> " << SolveOptions->Data() << std::endl << std::endl;
-  }
-
-  // solve
-  SolveWholeID = SolveOptions->Contains("wholeid");
-  UseSoftModeCut = SolveOptions->Contains("softmodecut");
-  SolveLocalX2Style = SolveOptions->Contains("localx2");
-
-  // input
-  if (SolveOptions->Contains("newalign")){ // input uses the bigmatrix and bigvector binary files
-    NewAlign = true;
-    UseTFileInput = false;
-  }  
-  UseTFileInput = (SolveOptions->Contains("tfile") | UseTFileInput); // the input is from the AlignmentTFile.root  
-  if (UseTFileInput) NewAlign = false; // 
-
-  // special output options
-  QuietMode = SolveOptions->Contains("quiet");
-  PlotEigenVecs = SolveOptions->Contains("ploteigen");
-
-
-  // check that at least one option is recognized
-  Bool_t KnowWhatToDo = false;
-  if (SolveWholeID)    KnowWhatToDo = true;
-
-  // printing and input/output options
-  Bool_t KnownOptions = false;
-  if (UseSoftModeCut) KnownOptions = true;
-  if (SolveLocalX2Style) KnownOptions = true;
-  if (QuietMode)      KnownOptions = true;
-  if (PlotEigenVecs)  KnownOptions = true;
-  if (NewAlign)       KnownOptions = true;
-
-
-  // doest it know what to do ?
-  if (!KnowWhatToDo) {
-    SolveWholeID = true;
-    if (!QuietMode && KnownOptions) {
-      std::cout << std::endl;
-      std::cout << " <ea> Solving options given by user: '" << SolveOptions->Data()
-	   << "' are UNKNOWN --> solve whole ID instead "
-	   << std::endl << std::endl;
-    }
-  }
-  return;
-}
-
-//////////////////////////////////////////////
-void SetDirectory(const char *dname)
-{
-  DirName = new TString(dname);
-  if (GetPrintLevel()>=1) 
-    std::cout << " <ea> Loading files from directory " << DirName->Data() << std::endl;
-  
-  // check that directory exits
-  Long_t id, size, flag, modtime;
-  int status = gSystem->GetPathInfo(DirName->Data(),&id,&size,&flag,&modtime);
-  
-  // this has been superseeded so... use this dirty patch for the time being
-  status = 0;  // this bit of code has to be cleaned up !!!
-
-  // if status == 1 --> non existing
-  if (status == 1) {
-    std::cout << std::endl;
-    std::cout << " <ea> ** SEVERE ERROR ** Directory " << DirName->Data() << " does not exit " << std::endl;
-    std::cout << std::endl;
-  }
-}
-
-
-//////////////////////////////////////////////
-void SetWeakModeRemovalStrategy(Int_t strategy)
-{
-  Bool_t KnownStrategy = false;
-  
-  // No weak mode removal
-  if (strategy == 0) KnownStrategy = true; 
-
-  // Fixed number of modes removal
-  if (strategy == 1) KnownStrategy = true; 
-
-  // removing by pull
-  if (strategy == 2) KnownStrategy = true; 
-
-  // removing by pull, eigen value step, size of the correction;
-  if (strategy == 3) KnownStrategy = true; 
-
-  // User selection
-  if (strategy == 4) KnownStrategy = true; 
-
-  if (!KnownStrategy) {
-    std::cout << std::endl;
-    std::cout << " <ea> ** WARNING ** User requested strategy for weak mode removal "
-	 << " (strategy = " << strategy << " ) "
-	 << " is unknown. Use strategy 0 instead " 
-	 << std::endl;
-    strategy = 0;
-  }
-
-  WeakModeStrategy = strategy; 
-}
-
-//////////////////////////////////////////////
-Int_t GetWeakModeRemovalStrategy()
-{
-  return WeakModeStrategy; 
-}
-
-//////////////////////////////////////////////
-void SetScaleFactor(double myscale)
-{
-  m_ScaleFactor = myscale;
-  return;
-}
-
-//////////////////////////////////////////////
-Double_t GetScaleFactor()
-{
-  return m_ScaleFactor;
-}
-
-//////////////////////////////////////////////
-void SetNModesToRemove(int nmodes)
-{
-  if (nmodes<0) nmodes = 6; // default case: 6 singular modes
-
-  NModesToRemove = nmodes;
-}
-
-//////////////////////////////////////////////
-Int_t GetNModesToRemove()
-{
-  return NModesToRemove;
-}
-
-//////////////////////////////////////////////
-Int_t GetNStruct()
-{
-  return NofAlignableStructures;
-}
-
-//////////////////////////////////////////////
-Int_t GetNMaxStructures()
-{
-  return NMaxStruct;
-}
-
-//////////////////////////////////////////////
-void SetPullLimit(Float_t newPullLimit)
-{
-  if (newPullLimit<0) newPullLimit = 0;
-
-  PullLimit = newPullLimit;
-}
-
-//////////////////////////////////////////////
-Float_t GetPullLimit()
-{
-  return PullLimit;
-}
-
-//////////////////////////////////////////////
-Bool_t IsRotation(int i)
-{
-  Bool_t AmIRotation = false;
-
-  Short_t dof_type = DoFType[i];
-
-  AmIRotation = (dof_type == DoFRx | dof_type==DoFRy | dof_type==DoFRz);
-
-  return AmIRotation;
-}
-
-//////////////////////////////////////////////
-void OpenCanvas()
-{
-  CanDiagonalBase = new TCanvas("diagonal base","EigenAna: diagonal base",1000,700);
-  CanDiagonalBase->Divide(3,2);
-
-  CanAlignCorr = new TCanvas("align corr","EigenAna: alignment corrections",1000,700);
-  CanAlignCorr->Divide();
-
-  CanAlignCorrErr = new TCanvas("align corr errors","EigenAna: alignment correction errors",1000,700);
-  CanAlignCorrErr->Divide();
-
-  CanBigMatrix = new TCanvas("big matrix","EigenAna: big matrix",700,700);
-  CanBigMatrix->Divide();
- 
-  CanBigMatrixInv = new TCanvas("big matrix inv","EigenAna: big matrix inv",700,700);
-  CanBigMatrixInv->Divide();
- 
-  CanCorrelMatrix = new TCanvas("correlation matrix","EigenAna: correlation matrix",700,700);
-  CanCorrelMatrix->Divide();
- 
-  CAliCorrDof = new TCanvas("AliCorrByDof", "EigenAna: Alignment corrections by dof", 1200, 800);
-  CAliCorrDof->Divide(3,2);
-
-  return;
-}
-
-//////////////////////////////////////////////
-void InitGraphicsStyle()
-{
-  // style
-  gStyle->SetPalette(1);
-  gStyle->SetCanvasColor(kWhite);
-  gStyle->SetOptStat(10);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-
-  
-  //gStyle->SetPadColor(kWhite);
-  //gStyle->SetCanvasBorderMode(0);
-  //gStyle->SetCanvasBorderSize(0);
-
-  Float_t isize = 0.04;
-  //Int_t font = 42;
-
-  //gStyle->SetLabelFont(font,"X");
-  //gStyle->SetLabelFont(font,"Y");
-  //gStyle->SetLabelFont(font,"Z");
-  //gStyle->SetLabelSize(isize,"x");
-  //gStyle->SetLabelSize(isize,"y");
-  //gStyle->SetLabelSize(isize-0.01,"z");
- 
-  //gStyle->SetTitleFont(font,"x");
-  //gStyle->SetTitleFont(font,"y");
-  //gStyle->SetTitleFont(font,"z");
-  gStyle->SetTitleSize(isize,"x");  
-  gStyle->SetTitleSize(isize,"y");
-  //gStyle->SetTitleSize(isize,"z");
-  gStyle->SetTitleYOffset(1.3);
-
-
-  //gStyle->SetStatFont(font);
-  //gStyle->SetStatFontSize(isize);
-  //gStyle->SetStatW(0.22);
-  //gStyle->SetStatColor(kWhite);
-  //gStyle->SetStatBorderSize(1);   // remove shade from stat box
-
-  //gStyle->SetStripDecimals(false);
-  //TGaxis::SetMaxDigits(4);
-
-  
-
-  return;
-}
-
-//////////////////////////////////////////////
-void  InitOutputFile()
-{
-  Char_t filename[350];
-
-  sprintf(filename,"EigenAnaOutput.root");
-
-  if (GetPrintLevel()>=0) std::cout << " <ea> ** InitOutputFile ** Creating TDirectories" << std::endl;
-  EAHistFile = new TFile(filename,"RECREATE");
-  EAHistDir = new TDirectoryFile("EigenAna","EigenAna");
-  EAHistDir->cd();
-}
-
-//////////////////////////////////////////////
-void BookBigMatrixHisto()
-{
-  TH2F* hBigMatrix = new TH2F("hBigMatrix","BigMatrix",
-			      BigMatrix.GetNcols(), -0.5, BigMatrix.GetNcols()-0.5,
-			      BigMatrix.GetNrows(), -(BigMatrix.GetNrows()-0.5), 0.5);
-  // change the values in order to make the zeros more visible
-  for (int i = 0; i< BigMatrix.GetNrows(); i++) {
-    for (int j = 0; j< BigMatrix.GetNcols(); j++) {
-      double value = BigMatrix(i,j);
-      if (value == 0) hBigMatrix->Fill(j,-i, 0.);
-      if (value > 0.) hBigMatrix->Fill(j,-i, 1.);
-      if (value < 0.) hBigMatrix->Fill(j,-i,-1.);      
-    }
-  }
-
-  // set the axis labels
-  SetHMatrixLabels(hBigMatrix);
-
-  if (!QuietMode) {
-    CanBigMatrix->cd(1);
-    hBigMatrix->Draw("colz");
-    DrawStructLinesOnHMatrix(hBigMatrix);
-  }
-}
-
-//////////////////////////////////////////////
-void BookBigMatrixInvHisto()
-{
-  hBigMatrixInv = new TH2F("hBigMatrixInv","Inverse of Big Matrix (M^{  -1})",
-			   BigMatrix_Inv.GetNcols(), -0.5, BigMatrix_Inv.GetNcols()-0.5,
-			   BigMatrix_Inv.GetNrows(), -(BigMatrix_Inv.GetNrows()-0.5), 0.5);
-
-  if (BigMatrix_Inv.GetNrows()>0) { // if matrix has been computed
-    float MaxVal = -99999.;
-    float MinVal =  99999.;
-    for (int i = 0; i< BigMatrix_Inv.GetNrows(); i++) {
-      for (int j = 0; j< BigMatrix_Inv.GetNcols(); j++) {
-	double value = BigMatrix_Inv(i,j);
-	hBigMatrixInv->Fill(j,-i,value);
-	if (value>MaxVal) MaxVal = value;
-	if (value<MinVal) MinVal = value;
-      }
-    }
-    
-    float FullRange = MaxVal;
-    if (TMath::Abs(MinVal) > FullRange) FullRange = TMath::Abs(MinVal); 
-    hBigMatrixInv->SetMaximum(FullRange); 
-    hBigMatrixInv->SetMinimum(-FullRange); 
-
-    // set the axis labels
-    SetHMatrixLabels(hBigMatrixInv);
-
-    if (!QuietMode) {
-      CanBigMatrixInv->cd(1);
-      hBigMatrixInv->Draw("colz");
-      DrawStructLinesOnHMatrix(hBigMatrixInv);
-    }
-  }
-}
-
-//////////////////////////////////////////////
-void BookCorrelMatrixHisto()
-{
-  TH2F* hCorrelMatrix = new TH2F("hCorrelMatrix","Correlation matrix",
-			      BigMatrix_Inv.GetNcols(), -0.5, BigMatrix_Inv.GetNcols()-0.5,
-			      BigMatrix_Inv.GetNrows(), -(BigMatrix_Inv.GetNrows()-0.5), 0.5);
-
-  if (BigMatrix_Inv.GetNrows()>0) { // if matrix has been computed
-    float MaxVal = -99999.;
-    float MinVal =  99999.;
-    for (int i = 0; i< BigMatrix_Inv.GetNrows(); i++) {
-      for (int j = 0; j< BigMatrix_Inv.GetNcols(); j++) {
-	double value = BigMatrix_Inv(i,j) / sqrt(BigMatrix_Inv(i,i)*BigMatrix_Inv(j,j));;
-	if (BigMatrix_Inv(i,j) == 0) value = 0; 
-	if (BigMatrix(i,j) == 0) value = 0; 
-	if (fabs(BigMatrix_Inv(i,j)) < ZeroEquivalent) value = 0; 
-	if (fabs(BigMatrix_Inv(i,j)) < (1./(10*BigMatrix_Inv.GetNrows()))) value = 0; 
-	if (false) {
-	  if (fabs(BigMatrix_Inv(i,j)) < 1.0E-6) value = 0; 
-	} 
-	hCorrelMatrix->Fill(j,-i,value);
-	if (value>MaxVal) MaxVal = value;
-	if (value<MinVal) MinVal = value;
-      }
-    }
-      
-    hCorrelMatrix->SetMaximum(1); 
-    hCorrelMatrix->SetMinimum(-1); 
-
-    // set the axis labels
-    SetHMatrixLabels(hCorrelMatrix);
-
-    if (!QuietMode) {
-      CanCorrelMatrix->cd(1);
-      hCorrelMatrix->Draw("colz");
-      hCorrelMatrix->GetZaxis()->SetLabelSize(0.02);
-      DrawStructLinesOnHMatrix(hCorrelMatrix);
-    }
-  }
-}
-
-//////////////////////////////////////////////
-void BookEigenValues()
-{
-  // EigenValues histogram
-  hEigenVal = new TH1F ("hEigenVal","Eigen values",
-			BigVector.GetNoElements(), 
-			0.5, 
-			BigVector.GetNoElements()+0.5);
-  hEigenVal->SetXTitle("eigenvalue");
-
-  if (GetPrintLevel()>=1) 
-    std::cout << " <ea> Defining histogram of eigen values with " <<  hEigenVal->GetNbinsX() << " bins " << std::endl;
-  // Storing eigen values in histogram bins
-  for (int i=0; i<BigVector.GetNoElements(); i++) {
-    hEigenVal->SetBinContent(i+1,EigenVal(i));
-  }
-  if (!QuietMode) {
-    CanDiagonalBase->cd(1);
-    hEigenVal->Draw();
-    gPad->SetLogy(1);
-    gPad->SetGridx(1);
-  }
-  return;
-}
-
-//////////////////////////////////////////////
-void BookBigVector()
-{
-  // store the big vector in a histogram
-  hBigVector = new TH1F ("hBigVector","Big vector",
-			    BigVector.GetNoElements(), 
-			    0.5, 
-			    BigVector.GetNoElements()+0.5);
-  hBigVector->SetXTitle("dof");
-  for (int i=0; i<BigVector.GetNoElements(); i++) {
-    hBigVector->SetBinContent(i+1,BigVector(i));
-  }
-
-  // keep it in a histogram
-  hBigVector_b = new TH1F ("hBigVector_b","Residuals vector in diagonal base",
-			    BigVector.GetNoElements(), 
-			    0.5, 
-			    BigVector.GetNoElements()+0.5);
-  hBigVector_b->SetXTitle("mode");
-  for (int i=0; i<BigVector_b.GetNoElements(); i++) {
-    hBigVector_b->SetBinContent(i+1,BigVector_b(i));
-  }
-  if (!QuietMode) {
-    CanDiagonalBase->cd(3);
-    hBigVector_b->Draw();
-  }
-
-  return;
-}
-
-//////////////////////////////////////////////
-void BookRawAlignCorr()
-{
-  // Book a histogram for alignment corrections in the modules base using all modes (no weak mode removal yet)
-  if (GetPrintLevel()>=5) std::cout << " <ea> -- SolveInDiagonalBase -- booking histogram for alignment corrections in modules base " << std::endl;
-  hAliCorrRaw = new TH1F ("hdaAliCorrRaw","Alignment corrections",
-			  BigVector.GetNoElements(), 
-			  0.5, 
-			  BigVector.GetNoElements()+0.5);
-  hAliCorrRaw->SetXTitle("dof");
-  for (int i=0; i<AlignCorrRaw.GetNoElements(); i++) {
-    hAliCorrRaw->SetBinContent(i+1,AlignCorrRaw(i));
-  }
-  SetXAxisLabels(hAliCorrRaw);
-  if (GetPrintLevel()>=5) std::cout << " <ea> -- SolveInDiagonalBase -- Alignment corrections histogram successfully booked and filled -> going to plot" << std::endl;
-  if (!QuietMode) {
-    CanAlignCorr->cd(1);
-    hAliCorrRaw->Draw();
-    DrawStructLines(hAliCorrRaw,CanAlignCorr,1);
-  }
-
-
-  // Histogram of alignment corrections in diagonal base, all modes included (no weak mode removal yet)
-  hAliCorrRaw_b = new TH1F ("hdbAliCorrRaw","#delta b  (align. corr. in diag. base, all modes included)",
-			    BigVector.GetNoElements(), 
-			    0.5, 
-			    BigVector.GetNoElements()+0.5);
-  hAliCorrRaw_b->SetXTitle("mode");
-  if (GetPrintLevel()>=5) 
-    std::cout << " <ea> Defining histogram of raw alignment corrections in diagonal base with  " 
-	 <<  hAliCorrRaw_b->GetNbinsX() << " bins " << std::endl;
-  
-  // strore alignment corrections in the daigonal base in the ad-hochistogram
-  for (int i=0; i<AlignCorrRaw_b.GetNoElements(); i++) {
-    hAliCorrRaw_b->SetBinContent(i+1,AlignCorrRaw_b(i));
-  }
-  
-  if (!QuietMode) {
-    CanDiagonalBase->cd(2);
-    hAliCorrRaw_b->Draw();
-  }
-  if (GetPrintLevel()>=5) std::cout << " <ea> -- SolveInDiagonalBase -- Histogram of raw alignment correction in base b successcully booked ! " << std::endl;
-
-  return;
-}
-
-//////////////////////////////////////////////
-void MatrixAndVectorPreConditioning()
-{
-  // this function takes the input matrix and vector and transfer them 
-  // into the BigVector and BigMatrix used for solving. The conditioning depends
-  // on the user selected options (Level2->Level1, sct only, etc...)
-  
-  if (SolveWholeID) {
-    // there is nothing to do...
-  }
-  
-  DetectNullEigenValues();
-
-  // Sove a la LocalX2
-  if (SolveLocalX2Style) PrepareLocalX2(); 
-
-  // scale angle units from rad to mrad (or whatever scale is used)
-  if ((AngleUnitFactor != 1.)
-      && (UseRx || UseRy || UseRz) // and a rotational dof is used 
-      ) ChangeAngleUnits();
-
-  // Perform actions to enable the sofmodecut
-  if (UseSoftModeCut) PrepareSoftModeCut(); 
- 
-  if (GetPrintLevel()>=1) std::cout << " <ea> -- PreConditioning -- completed " << std::endl;
-  //
-  return;
-}
-
-//////////////////////////////////////////////
-void PrepareLocalX2()
-{
-  // this function prepares the solving a la local X2
-  // It makes the matrix block diagonal. No action is needed on the big vector
-  // No eigenvalues need to be removed
-  
-  if (GetPrintLevel()>=1) std::cout << " <ea> ** PrepareLocalX2 ** Start " << std::endl;
-  //
-  SetWeakModeRemovalStrategy(1);
-  SetNModesToRemove(0);   
-
-  // The matrix has to be block diagonal in blocs on Ndof x Ndof (where Ndof is DOF per structure)
-  for (int i=0; i < BigMatrix.GetNrows(); i++) {
-    for (int j=0; j < BigMatrix.GetNcols(); j++) {
-      if (GetStructID(i) != GetStructID(j)) { // if Dof correspond to different structures
-	BigMatrix(i,j) = 0.;
-      }
-    }
-  }
-
-  //
-  if (GetPrintLevel()>=1) std::cout << " <ea> ** PrepareLocalX2 ** Completed " << std::endl;
-  return;
-}
-
-//////////////////////////////////////////////
-Int_t GetStructID(Int_t DofID)
-{
-  // given an identifier of a DOF it returns the structure to which it belongs
-
-  //Int_t StructID = DofID/GetNdofPerStruct();
-  //Int_t StructID = DofID/6;
-  Int_t StructID = DofBelongsToStruct[DofID];
-
-  return StructID;
-}
-
-//////////////////////////////////////////////
-void PrepareSoftModeCut()
-{
-  // this function prepares the soft mode cut. It affects the big matrix before the diagonalization.
-  // It has to add a term to the diagonal elements of the big matrix that accounts for the limit of the 
-  // modules movements: translations and rotations
-  
-  if (GetPrintLevel()>=1) std::cout << " <ea> ** PrepareSoftModeCut ** Start " << std::endl;
-  //
-  
-  TVectorD sofmodecutVec(BigMatrix.GetNrows());
-  std::cout << "Bigmatrix before softmodecut" << std::endl;
-  std::cout << "98x98:" << BigMatrix[98][98] << std::endl;
-
-  for(int i =0; i <BigMatrix.GetNrows(); i++){
-    
-  	TString tmpname = StructureName[DofBelongsToStruct[i]]->Data();
-	std::cout << sct_ec_Rz_smc << std::endl;
-  	if(tmpname.Contains("SCT")==1){
-  		if(tmpname.Contains("EC")==1){
-		  if(DoFType[i]==5)
-		    if(sct_ec_Rz_smc!=0.)
-		      sofmodecutVec[i] = 2./(sct_ec_Rz_smc*sct_ec_Rz_smc);
-		}
-	}
-  }
-  std::cout << GetScaleFactor () << std::endl;
-  for(int i =0; i <BigMatrix.GetNrows(); i++){
-    BigMatrix[i][i]+=(sofmodecutVec[i]/GetScaleFactor());
-  }
-  std::cout << "Bigmatrix after softmodecut" << std::endl;
-  std::cout << "98x98:" << BigMatrix[98][98] << std::endl;
-  if (GetPrintLevel()>=1) std::cout << " <ea> ** PrepareSoftModeCut ** Completed " << std::endl;
-  return;
-}
-
-//////////////////////////////////////////////
-void SolveInDiagonalBase()
-{
-  ///////////////////////////////////////
-  // Eigen values and vectors analisys
-  ///////////////////////////////////////
-  TStopwatch *DiagTime = new TStopwatch();  DiagTime->Start();
-  
-  if (GetPrintLevel()>=1) std::cout << " <ea> -- SolveInDiagonalBase -- Starting ... " << std::endl;
-  
-  // The following lines of code deal with the diagonalization and extracting the eigen values and eigen
-  // vectors. This is needed if one reads the raw big matrix and big vectors. The proccess can be speed up
-  // if the eigen values and eigen vectors from a previous solving are read as input. In the later case the 
-  // diagonalization step can be avoided
-  if (GetPrintLevel()>=3) 
-    std::cout << " <ea> ** SolveInDiagonalBase ** Diagonilizing BigMatrix... " << std::endl; std::cout << std::flush;
-  TMatrixDEigen EigenMatrixBase = TMatrixDEigen(BigMatrix); 
-  if (GetPrintLevel()>=3) 
-    std::cout << " <ea> ** SolveInDiagonalBase ** Diagonilization completed " << std::endl;  
-  
-  // - So... first extract the matrix that changes the base from a (structures) to b (diagonal)
-  // or the eigen vectors matrix
-  ChangeOfBaseMatrix.ResizeTo(BigMatrix.GetNrows(),BigMatrix.GetNcols());
-  ChangeOfBaseMatrix = EigenMatrixBase.GetEigenVectors();
-  if (GetPrintLevel()>=5) {
-    std::cout << " ++ <ea> ----------- Change of Base matrix ++ " << std::endl;
-    ChangeOfBaseMatrix.Print();
-    std::cout << " ++ <ea> ----- EO -- Change of Base Matrix ++ " << std::endl;
-  }
-  
-  // Once the matrix has been diagonalized, first thing to do, before any operation is
-  // to extract the eigenvalues and the eigen vectors (change of base matrix)
-  EigenVal.ResizeTo(BigVector.GetNoElements());
-  EigenVal = EigenMatrixBase.GetEigenValuesRe();
-  if (GetPrintLevel()>=5) {
-    std::cout << " <ea> ----- Diagonalization fo the big matrix. Printing eigen values ----- " << std::endl;    
-    EigenVal.Print();
-    std::cout << " <ea> ----- EO Eigen Values ----- " << std::endl;
-    std::cout << std::endl;
-  }
-  
-  // Flip the matrix to link it with increasing order eigen values
-  // ROOT returns the eigen values in decreasing order... we want 
-  // them in increasing order... so flip the vector and the matrix
-  // flip eigen value vactor
-  EigenVal = Flip(EigenVal);
-  if (GetPrintLevel()>=1) {
-    std::cout << " <ea> ----- Diagonalization fo the big matrix. Printing eigen values after flippling ----- " << std::endl;    
-    EigenVal.Print();
-    std::cout << " <ea> ----- EO Eigen Values after flipping ----- " << std::endl;
-    std::cout << std::endl;
-  }
-  BookEigenValues(); // book and draw eigen values histogram
-
-  // flip eigen matrix
-  ChangeOfBaseMatrix = Flip(ChangeOfBaseMatrix);
-  if (GetPrintLevel()>=5) {
-    std::cout << std::endl << " ++ <ea> -------- Change of base matrix after flipping ++ " << std::endl;
-    ChangeOfBaseMatrix.Print();
-    std::cout << std::endl << " ++ <ea> -- EO -- Change of base matrix after flipping ++ " << std::endl;
-  }  
-  
-  // the transposed of the change of base matrix is also needed
-  TMatrixD ChangeOfBaseMatrix_T(TMatrixD::kTransposed, ChangeOfBaseMatrix); 
-  if (GetPrintLevel()>=7) {
-    std::cout << std::endl << " ++ <ea> Change of base matrix transposed ++ " << std::endl;
-    ChangeOfBaseMatrix_T.Print();
-  }
-
-  /////////////////////////////////////////////////////
-  // Big matrix in the diagonal base and its inverse
-  /////////////////////////////////////////////////////
-  if (GetPrintLevel()>=8) 
-    std::cout << " ++ <ea> Inverting big matrix in diagonal base M_b^-1 ++ " << std::endl;
-  BigMatrix_b.ResizeTo(BigMatrix.GetNrows(),BigMatrix.GetNcols());  
-  BigMatrix_b.Zero();
-  
-  TMatrixD BigMatrix_b_Inv;
-  BigMatrix_b_Inv.ResizeTo(BigMatrix.GetNrows(),BigMatrix.GetNcols()); 
-  BigMatrix_b_Inv.Zero();
-
-  for (int i=0; i<EigenVal.GetNoElements(); i++) {
-    BigMatrix_b(i,i) = EigenVal(i);  // just in case it has been flipped
-    BigMatrix_b_Inv(i,i) = 1./EigenVal(i);   // The inversion of the diagonal matrix is obvious:
-  }
-  if (GetPrintLevel()>=8) {
-    std::cout << " ++ <ea> ----------- The big matrix in the diagonal base M_b ++ " << std::endl;
-    BigMatrix_b.Print();
-    std::cout << " ++ <ea> ----- EO -- The big matrix in the diagonal base M_b ++ " << std::endl;
-
-    std::cout << " ++ <ea> ----------- Inverse of the big matrix in the diagonal base (M_b^-1) ++ " << std::endl;
-    BigMatrix_b_Inv.Print();
-    std::cout << " ++ <ea> ----- EO -- Inverse of the big matrix in the diagonal base (M_b^-1) ++ " << std::endl;
-  }
-
-
-  // Before extracting the alignment corrections one needs to compute the big vector in
-  // the diagonale base:
-  
-  // Now... compute the bigvector in the new base (nu_b)
-  BigVector_b.ResizeTo(BigVector.GetNoElements());
-  BigVector_b = ChangeOfBaseMatrix_T*BigVector;
-  if (GetPrintLevel()>=5) {
-    std::cout << " ++ <ea> -------------- BigVector in diagonal base (b) -------- " << std::endl;
-    BigVector_b.Print();
-    std::cout << " ++ <ea> ----- EO ----- BigVector in diagonal base (b) -------- " << std::endl;
-  }
-
-  BookBigVector();
-
-  //
-  // Fianlly compute the alignment corrections in the diagonal base (b)
-  // this is without any mode cut at all.
-  if (GetPrintLevel()>=5) std::cout << " <ea> -- SolveInDiagonalBase -- Computing alignment corrections in the diagonal base " << std::endl;
-  AlignCorrRaw_b.ResizeTo(BigVector.GetNoElements());
-  AlignCorrRaw_b = BigMatrix_b_Inv*BigVector_b;
-  AlignCorrRaw_b *= -1;
-  if (GetPrintLevel()>=5) {
-    std::cout << " ++ <ea> ---------------- Raw Alignment corrections from matrix diagonalization (all modes included, diagonal base) ----- " << std::endl;
-    //PrintAlignmentCorrections(db_AlignCorrRaw);
-    AlignCorrRaw_b.Print();
-    std::cout << " ++ <ea> ------ EO ------ Raw Alignment corrections from matrix diagonalization (all modes included, diagonal base) ----- " << std::endl;
-  }
-
-
-  ////////////////////////////////
-  // Alignment correction
-  ////////////////////////////////
-  // Last but not least: compute alignment corrections in the physical modules base 
-  if (GetPrintLevel()>=5) std::cout << " <ea> -- SolveInDiagonalBase -- computing alignment corrections in modules base " << std::endl;
-  AlignCorrRaw.ResizeTo(BigVector.GetNoElements());
-  AlignCorrRaw = ChangeOfBaseMatrix*AlignCorrRaw_b;
-  if (GetPrintLevel()>=5) {
-    std::cout << " ++ <ea> --------------- Alignment corrections from matrix diagonalization (all modes included)" << std::endl;
-    //PrintAlignmentCorrections(AlignCorrRaw);
-    AlignCorrRaw.Print();
-    std::cout << " ++ <ea> ------ EO ----- Alignment corrections from matrix diagonalization (all modes included)" << std::endl;
-  }
-
-  BookRawAlignCorr();
-
-  // So far mark all modes as used
-  InitUsedEigenModesFlag();
-
-  ///////////
-  // timing
-  DiagTime->Stop();
-  if (GetPrintLevel()>=1) {
-    std::cout << " <ea> Diagonalization solving time: ";
-    DiagTime->Print();
-    std::cout << std::endl;
-  }
-
-  if (GetPrintLevel()>=1) std::cout << " <ea> -- SolveInDiagonalBase -- Completed " << std::endl;
-
-  return;
-}
-
-//////////////////////////////////////////////
-void SolveWithWeakModeRemoval()
-{
-  ///////////////////////////////////////
-  // Remove weak modes
-  ///////////////////////////////////////
-
-  if (GetPrintLevel()>=1) std::cout << " <ea> -- SolveWithWeakModeRemoval -- Starting... " << std::endl;
-
-  //
-  // set vectors size
-  AlignCorr.ResizeTo(BigVector.GetNoElements());
-  AlignCorr_b.ResizeTo(BigVector.GetNoElements());
-  AlignCorrError_b.ResizeTo(BigVector.GetNoElements());
-
-  // and filled them with the raw values
-  AlignCorr = AlignCorrRaw;
-  AlignCorr_b = AlignCorrRaw_b;
-
-  // get weak mode removal strategy
-  Int_t Strategy = GetWeakModeRemovalStrategy();
-  Int_t NEigenRemoved = 0;  // so far ... no modes removed
-
-  //----
-  // No weak modes removal
-  if (Strategy == 0) {
-    // nothing to do
-    if (GetPrintLevel()>=1) {
-      std::cout << " <ea> -- Weak mode removal -- user wants to keep all modes. None removed " <<std::endl << std::endl;
-    }
-  }
-
-  //----
-  // fixed number of modes removed
-  if (Strategy == 1) {
-    int ModesToRemove = GetNModesToRemove();
-    int LastModeToRemove = ModesToRemove;
-    for (int mode=0; mode < LastModeToRemove; mode++) {
-      NEigenRemoved++;
-      AlignCorr_b(mode) = 0;
-      AlignCorrError_b(mode) = 0;
-      SetFlagForUsedEigenMode(mode, kFALSE);
-      if (GetPrintLevel()>=1) {
-	std::cout << " <ea> -- Weak mode removal -- user wants to remove mode " << mode << std::endl;
-      }
-    }
-  }  
-
-  //----
-  // removing weak modes because users wants to remove them
-  if (Strategy == 4) {
-    SetFlagForUsedEigenMode(0, kFALSE);
-    SetFlagForUsedEigenMode(1, kFALSE);
-    SetFlagForUsedEigenMode(2, kFALSE);
-    SetFlagForUsedEigenMode(3, kFALSE);
-    //SetFlagForUsedEigenMode(4, kFALSE);
-    //SetFlagForUsedEigenMode(5, kFALSE);
-    SetFlagForUsedEigenMode(6, kFALSE);
-    SetFlagForUsedEigenMode(7, kFALSE);
-    //    SetFlagForUsedEigenMode(106, kFALSE);
-    //    SetFlagForUsedEigenMode(166, kFALSE);
-  }
-
-
-  /////////////////////////////////////////////////////////////////
-  // Now once the weak modes have been removed... carry on with the solving
-  /////////////////////////////////////////////////////////////////
-  if (GetPrintLevel()>=5) {
-    std::cout << " <ea> -- Weak mode removal COMPLETED -- strategy " << Strategy << " removes " << NEigenRemoved << " modes " << std::endl << std::endl;
-    std::cout << " <ea> ------ Alignment corrections in diagonal base after weak mode removal ------" << std::endl;
-    PrintAlignmentCorrections(AlignCorr_b);
-    std::cout << " <ea> ------ EO Alignment corrections in diagonal base after WMremoval ------" << std::endl;
-  }
-
-  // Once the weak modes have been removed according to the chosen strategy
-  // compute again tha alignment corrections in the modules base
-  ComputeAlignCorr(); 
-
-  // Alignment correction errors
-  ComputeAlignCorrErrors();
-
-  // Histogram booking for the alignment corrections, errors, covariance matrix and mode corrections
-  BookAliCorrHistos();
-  BookAliCorrErrHistos();
-  BookAliCorrPullHistos();
-  BookBigMatrixInvHisto();
-  BookCorrelMatrixHisto();
-  BookModeCorrections();
-  BookDofCorrections();
-
-  if (GetPrintLevel()>=1) std::cout << " <ea> -- SolveWithWeakModeRemoval -- Completed... " << std::endl;
-
-
-  return;
-}
-
-//////////////////////////////////////////////
-void ComputeAlignCorr() 
-{
-  ////////////////////////////////
-  // Alignment correction 
-  ////////////////////////////////
-  if (GetPrintLevel()>=7) std::cout << " <ea> ** ComputeAlignCorr **  Start. " << std::endl;
-
-  // just make sure that rejected modes are not in
-  for (Int_t imode=0; imode < AlignCorr_b.GetNoElements(); imode++) { 
-    if (!IsEigenModeUsed(imode)) {
-      AlignCorr_b(imode) = 0;
-      AlignCorrError_b(imode) = 0;
-    }
-  }
-
-  AlignCorr = ChangeOfBaseMatrix*AlignCorr_b;
-
-  if (GetPrintLevel()>=1) {
-    std::cout << " <ea> ------ Alignment corrections in the modules base after weak mode removal ------" << std::endl;
-    PrintAlignmentCorrections(AlignCorr);
-    std::cout << " <ea> ------ EO Alignment corrections in the modules base after WMremoval ------" << std::endl;
-  }
-
-  if (GetPrintLevel()>=7) std::cout << " <ea> ** ComputeAlignCorr **  Completed " << std::endl;
-  return;
-}
-
-//////////////////////////////////////////////
-void ComputeAlignCorrErrors() 
-{
-  ////////////////////////////////
-  // Alignment correction errors
-  ////////////////////////////////
-  if (GetPrintLevel()>=1) std::cout << std::endl <<" <ea> computing alignment correction errors. Start. " << std::endl;
-  
-  // first compute the alignment correction errors in the diagonal base
-  // these are the 1/sqrt(eigenval)
-  AlignCorrError_b.ResizeTo(BigVector.GetNoElements());
-  AlignCorrError_b = EigenVal;
-  AlignCorrError_b *= 2; // to get the right size of the errors
-  AlignCorrError_b *= GetScaleFactor();
-  AlignCorrError_b.Abs(); // just in case
-  AlignCorrError_b.Invert();
-  AlignCorrError_b.Sqrt();  // Now all the errors are computed but.... lets switch off those not used
-  for (Int_t imode=0; imode < AlignCorr_b.GetNoElements(); imode++) { 
-    if (!IsEigenModeUsed(imode)) {
-      AlignCorrError_b(imode) = 0;
-    }
-  }
-  if (GetPrintLevel()>=7) {
-    std::cout << " ++ <ea> Alignment corrections errors in diagonal base base" << std::endl;
-    PrintAlignmentCorrections(AlignCorrError_b);
-    std::cout << std::endl;
-  }
-
-  //////////////////////////////////////////////
-  // Now compute the errors in the modules base
-  //////////////////////////////////////////////
-
-  // rough calculation which is not fully correct
-  AlignCorrError.ResizeTo(BigVector.GetNoElements());
-  AlignCorrError = ChangeOfBaseMatrix*AlignCorrError_b;
-  
-  // correct way to compute the errors
-  if (1==1) {
-    if (GetPrintLevel()>=1) std::cout << " <ea> computing alignment correction errors with correct method... " << std::endl;
-    // The above calculation is just wrong
-    // one needs to compute the inverse matrix: 
-
-    // but before that let's compute all the relevant quantities as
-    // M^-1 = U D^-1 U+
-    
-    //TMatrixD BigMatrix_b_Inv = BigMatrix_b;
-    TMatrixDSym BigMatrix_b_Inv;
-    BigMatrix_b_Inv.ResizeTo(EigenVal.GetNoElements(),EigenVal.GetNoElements());
-    BigMatrix_b_Inv.Zero();
-
-    for (int i=0; i<EigenVal.GetNoElements(); i++) {
-      if (IsEigenModeUsed(i)) { 
-      	BigMatrix_b_Inv(i,i) = 1./EigenVal(i);  
-      }  
-    }
-    if (GetPrintLevel()>=9) {
-      std::cout << " <ea> -- START --- BigMatrix_b^-1 -----------------------------" << std::endl;
-      BigMatrix_b_Inv.Print();
-      std::cout << " <ea> --  END  --- BigMatrix_b^-1 -----------------------------" << std::endl;
-    } 
- 
-    BigMatrix_Inv.ResizeTo(BigMatrix.GetNrows(),BigMatrix.GetNcols());
-    BigMatrix_Inv.Zero();
-    if (GetPrintLevel()>=7) std::cout << " <ea> -- multipliying matrices M_inv =  U * Mb_inv * U^T)  --" << std::endl;
-   
-    BigMatrix_Inv=BigMatrix_b_Inv.Similarity(ChangeOfBaseMatrix);
-    
-    if (GetPrintLevel()>=8) {
-      std::cout << " <ea> -- START --- BigMatrix^-1 -----------------------------" << std::endl;
-      BigMatrix_Inv.Print();
-      std::cout << " <ea> --  END  --- BigMatrix^-1 -----------------------------" << std::endl;
-    }  
-
-    for (Int_t i=0; i < AlignCorr.GetNoElements(); i++) {
-      AlignCorrError(i) = sqrt(2*BigMatrix_Inv(i,i)/GetScaleFactor());
-    }
-  }// end of correct method
-
-  if (GetPrintLevel()>=1) {
-    std::cout << " ++ <ea> Alignment corrections errors in modules base" << std::endl;
-    PrintAlignmentCorrections(AlignCorrError);
-  }
-
-  if (GetPrintLevel()>=1) std::cout << " <ea> computing alignment correction errors. Completed. " << std::endl;
-  return;
-}
-
-//////////////////////////////////////////////
-TVectorD Flip(const TVectorD &inVec)
-{
-  if (GetPrintLevel()>=5) 
-    std::cout << " <ea>  flipping vector of size " << inVec.GetNoElements() << std::endl;
-  
-  TVectorD AuxVec(inVec);
-    
-  for (int i=0, j=AuxVec.GetNoElements()-1; i<AuxVec.GetNoElements(); i++, j--) {
-    AuxVec(j) = inVec(i);
-  }
-
-  return AuxVec;
-}
-
-//////////////////////////////////////////////
-TMatrixD Flip(const TMatrixD &inMat)
-{
-  if (GetPrintLevel()>=5) 
-    std::cout << " <ea>  flipping matrix of size " 
-	 << inMat.GetNrows() << " x " << inMat.GetNcols() << std::endl;
-  
-  TMatrixD AuxMat(inMat);
-
-  int k;
-  // columns
-  for (int i=0;  i<inMat.GetNrows(); i++) {
-    for (int j=0; j<inMat.GetNrows(); j++) {
-      k = (inMat.GetNrows()-1) - j;
-      AuxMat(i,k) = inMat(i,j);
-    }
-  }
-
-  return AuxMat;
-}
-
-//////////////////////////////////////////////
-void InitUsedEigenModesFlag()
-{
-  // At initilization mark them all as used
-  for (Int_t i=0; i<BigVector.GetNoElements(); i++) {
-    UsedEigenMode[i] = kTRUE;
-  }
-}
-
-//////////////////////////////////////////////
-void SetFlagForUsedEigenMode(Int_t ix, Bool_t EVused)
-{
-  UsedEigenMode[ix] = EVused;
-  return;
-}
-
-//////////////////////////////////////////////
-Int_t GetNUsedDof()
-{
-  Int_t n=0;
-  for (Int_t i=0; i<GetNdof(); i++) {
-    if (IsEigenModeUsed(i)) n++;
-  }
-  return n;
-}
-
-//////////////////////////////////////////////
-Bool_t IsEigenModeUsed(Int_t ix)
-{
-  return UsedEigenMode[ix];
-}
-
-//////////////////////////////////////////////
-void SetNofStructures(int nstruct)
-{
-  NofAlignableStructures = nstruct;
-
-  return;
-}
-
-//////////////////////////////////////////////
-Int_t GetNdofPerStruct()
-{
-  return NdofPerStruct;
-}
-
-//////////////////////////////////////////////
-Int_t GetNEigenPerCanvas()
-{
-  Int_t n = AlignCorr.GetNoElements();
-
-  //if (n>4) n=4;
-  if (n>6) n=6;
-
-  return n;
-}
-
-//////////////////////////////////////////////
-Int_t GetNEigenCanvas()
-{
-  // to define how many canvas are needed
-  Int_t Ncanvas = 1;
-  Int_t HistosPerCanvas = GetNEigenPerCanvas();
-
-  Ncanvas = BigVector.GetNoElements() / HistosPerCanvas;
-  if ((BigVector.GetNoElements()%HistosPerCanvas)>0) Ncanvas++;
-
-  return Ncanvas;
-}
-
-//////////////////////////////////////////////
-Int_t GetNdof()
-{
-  return BigVector.GetNoElements();
-}
-
-//////////////////////////////////////////////
-void DivideEigenCanvas(TCanvas *EigCan)
-{
-
-  switch (GetNEigenPerCanvas()){
-  case 4: 
-    EigCan->Divide(2,2);
-    break;
-  case 6: 
-    EigCan->Divide(2,3);
-    break;
-  case 12: 
-    EigCan->Divide(3,4);
-    break;
-  case 24: 
-    EigCan->Divide(6,4);
-    break;
-  default:
-    EigCan->Divide(5,5);
-  }
-
-  return;
-}
-
-//////////////////////////////////////////////
-void SetActiveNdof(Bool_t WhatTx, Bool_t WhatTy, Bool_t WhatTz, Bool_t WhatRx, Bool_t WhatRy, Bool_t WhatRz)
-{
-  UseTx = WhatTx;
-  UseTy = WhatTy;
-  UseTz = WhatTz;
-  UseRx = WhatRx;
-  UseRy = WhatRy;
-  UseRz = WhatRz;
-  
-  return;
-}
-
-//////////////////////////////////////////////
-void SetDoFTypes()
-{
-  if (GetPrintLevel()>=10) std::cout << " <ea> setting DoF types. Start " << std::endl;
-  //
-  DoFType.ResizeTo(BigVector.GetNoElements()); // first set the right dimension for the vector
-  
-  // default (Tx, Ty, Tz, Rx, Ry, Rz)
-  for (int i=0; i<BigVector.GetNoElements(); i++) {
-    DoFType[i] = i%6;
-  }
-  //
-  if (DoFs.GetNoElements() != 0) {
-    for (int i=0; i<BigVector.GetNoElements(); i++) {
-      DoFType[i] = DoFs[i]; // save the DOF type from what was read in the file
-    }
-  }
-  //
-  if (GetPrintLevel()>10) {
-    std::cout << " <ea> ------- printing DoFTypes: size " 
-	      << DoFType.GetNoElements() << " ------- " << std::endl; 
-        for (int i=0; i < DoFType.GetNoElements(); i++) {
-      std::cout << " id = " << i << " Type = " << DoFType[i] << " (" <<  DofName[(int) DoFType[i]] <<") " << endl;
-    }
-    std::cout << " <ea> ------------ EO DoFType ------------ " << std::endl; 
-    std::cout << std::endl;
-  }
-  
-  if (GetPrintLevel()>=10) std::cout << " <ea> setting DoF types. Completed " << std::endl;
-  // 
-  return;
-}
-
-
-//////////////////////////////////////////////
-void BookAliCorrHistos()
-{
-  if (GetPrintLevel()>=3) std::cout << " <ea> Booking histograms for the alignment corrections... start " << std::endl;
-  
-  // 
-  // Histogram of alignment corrections in diagonal base, after weak mode removal.
-  hAliCorr_b = new TH1F ("hAliCorr_b","#delta b  (align. corr. in diag. base, after mode cut)",
-			 BigVector.GetNoElements(), 
-			 0.5, 
-			 BigVector.GetNoElements()+0.5);
-  hAliCorr_b->SetXTitle("mode");
-  hAliCorr_b->SetLineColor(kRed);
-  hAliCorr_b->SetFillStyle(3001);
-  hAliCorr_b->SetFillColor(kRed);
-  if (GetPrintLevel()>=7) 
-    std::cout << " <ea> Defining histogram of alignment corrections in diagonal base with  " 
-	 <<  hAliCorr_b->GetNbinsX() << " bins " << std::endl;
-  
-  // strore alignment corrections in the daigonal base in the ad-hoc histogram
-  for (int i=0; i<AlignCorr_b.GetNoElements(); i++) {
-    hAliCorr_b->SetBinContent(i+1,AlignCorr_b(i));
-  }
-  
-  if (!QuietMode) {
-    CanDiagonalBase->cd(2);
-    hAliCorr_b->Draw("same");
-  }
-
-  // Book a histogram for alignment corrections in the modules base using after weak mode removal
-  // Corrections in the module (structure frame)
-  // All corrections (tx, ty, tz, rx...) are included in this plot
-  hAliCorr = new TH1F ("hAliCorr","Alignment corrections",
-		       BigVector.GetNoElements(), 
-		       0.5, 
-		       BigVector.GetNoElements()+0.5);
-  hAliCorr->SetXTitle("dof");
-  hAliCorr->SetLineColor(kRed);
-  hAliCorr->SetFillStyle(3001);
-  hAliCorr->SetFillColor(kRed);
-  SetXAxisLabels(hAliCorr);
-
-  for (int i=0; i<AlignCorr.GetNoElements(); i++) {
-    hAliCorr->SetBinContent(i+1,AlignCorr(i));
-  }
-  if (!QuietMode) { // draw histogram on thre same frame
-    CanAlignCorr->cd(1);
-    hAliCorr->Draw("same");
-  }
-
-  if (GetPrintLevel()>=7) std::cout << "   <ea> Booking histograms for the corrections 1 by 1 (ie Tx for all) ... " << std::endl;
-
-  Int_t NStruct = GetNStruct();
-  if (GetPrintLevel()>=3) std::cout << "   <ea> ** BookAliCorrHistos**  booking histos for " << NStruct << " structures" << std::endl;
-
-  // compute the bins for the histrograms showing the projections
-  Int_t xBins = NStruct/3;
-  if (xBins<11) xBins = 11;
-  
-  HistoBins HistLimits;
-  
-  // Histogram just for the Tx
-  if (GetPrintLevel()>=9) std::cout << "   <ea> Booking histograms for the Tx corrections " << std::endl;
-  if (hTxAliCorr == NULL) 
-    hTxAliCorr = new TH1F("hTxAliCorr","Tx alignment corrections",
-			  NStruct, 0.5, NStruct+0.5);
-  hTxAliCorr->SetYTitle("Tx (mm)");
-  //hTxAliCorr->SetXTitle("Structure id.");
-  SetXAxisStructures(hTxAliCorr);
-  hTxAliCorr->SetLineWidth(2);
-  hTxAliCorr->SetMarkerStyle(20);
-  
-  
-  // Histogram just for the Ty
-  if (GetPrintLevel()>=9) std::cout << "   <ea> Booking histograms for the Ty corrections " << std::endl;
-  if (hTyAliCorr == NULL) 
-    hTyAliCorr = new TH1F("hTyAliCorr","Ty alignment corrections",
-			  NStruct, 0.5, NStruct+0.5);
-  hTyAliCorr->SetYTitle("Ty (mm)");
-  //hTyAliCorr->SetXTitle("Structure id.");
-  SetXAxisStructures(hTyAliCorr);
-  hTyAliCorr->SetLineWidth(2);
-  hTyAliCorr->SetMarkerStyle(20);
-  
-  // Histogram just for the Tz
-  if (GetPrintLevel()>=9) std::cout << "   <ea> Booking histograms for the Tz corrections " << std::endl;
-  if (hTzAliCorr == NULL) 
-    hTzAliCorr = new TH1F("hTzAliCorr","Tz alignment corrections",
-			  NStruct, 0.5, NStruct+0.5);
-  hTzAliCorr->SetYTitle("Tz (mm)");
-  //hTzAliCorr->SetXTitle("Structure id.");
-  SetXAxisStructures(hTzAliCorr);
-  hTzAliCorr->SetLineWidth(2);
-  hTzAliCorr->SetMarkerStyle(20);
-  
-  // Histogram just for the Rx
-  if (GetPrintLevel()>=9) std::cout << "   <ea> Booking histograms for the Rx corrections " << std::endl;
-  if (hRxAliCorr == NULL) 
-    hRxAliCorr = new TH1F("hRxAliCorr","Rx alignment corrections",
-			  NStruct, 0.5, NStruct+0.5);
-  hRxAliCorr->SetYTitle("Rx (mrad)");
-  //hRxAliCorr->SetXTitle("Structure id.");
-  SetXAxisStructures(hRxAliCorr);
-  hRxAliCorr->SetLineWidth(2);
-  hRxAliCorr->SetMarkerStyle(20);
-
-  // Histogram just for the Ry
-  if (GetPrintLevel()>=9) std::cout << "   <ea> Booking histograms for the Ry corrections " << std::endl;
-  if (hRyAliCorr == NULL) 
-    hRyAliCorr = new TH1F("hRyAliCorr","Ry alignment corrections",
-			NStruct, 0.5, NStruct+0.5);
-  hRyAliCorr->SetYTitle("Ry (mrad)");
-  //hRyAliCorr->SetXTitle("Structure id.");
-  SetXAxisStructures(hRyAliCorr);
-  hRyAliCorr->SetLineWidth(2);
-  hRyAliCorr->SetMarkerStyle(20);
-
-  // Histogram just for the Rz
-  if (GetPrintLevel()>=9) std::cout << "   <ea> Booking histograms for the Rz corrections " << std::endl;
-  if (hRzAliCorr == NULL) 
-    hRzAliCorr = new TH1F("hRzAliCorr","Rz alignment corrections",
-			  NStruct, 0.5, NStruct+0.5);
-  hRzAliCorr->SetYTitle("Rz (mrad)");
-  //hRzAliCorr->SetXTitle("Structure id.");
-  SetXAxisStructures(hRzAliCorr);
-  hRzAliCorr->SetLineWidth(2);
-  hRzAliCorr->SetMarkerStyle(20);
-
-
-  //------------------------------------------
-  // Fill the histograms of correction by dof
-  Int_t jdof = 0; // counter of the current real dof
-  double thisDoFType;
-  for (Int_t istruct=0; istruct< GetNStruct(); istruct++) { // looping over all structures
-    // Each structure has 6 dof maximum. If less are used, jump those unused and print those used
-    for (Int_t index=0; index < 6; index++) { // looping over all possible dofs
-
-      if (index == DoFType(jdof)) {
-	thisDoFType =  DoFType(jdof);
-	if (thisDoFType == DoFTx) {
-	  hTxAliCorr->SetBinContent(istruct+1,AlignCorr(jdof));
-	  hTxAliCorr->SetBinError(istruct+1,AlignCorrError(jdof));
-	}
-	if (thisDoFType == DoFTy) {
-	  hTyAliCorr->SetBinContent(istruct+1,AlignCorr(jdof));
-	  hTyAliCorr->SetBinError(istruct+1,AlignCorrError(jdof));
-	}
-	if (thisDoFType == DoFTz) {
-	  hTzAliCorr->SetBinContent(istruct+1,AlignCorr(jdof));
-	  hTzAliCorr->SetBinError(istruct+1,AlignCorrError(jdof));
-	}
-	if (thisDoFType == DoFRx) {
-	  hRxAliCorr->SetBinContent(istruct+1,AlignCorr(jdof));
-	  hRxAliCorr->SetBinError(istruct+1,AlignCorrError(jdof));
-	}
-	if (thisDoFType == DoFRy) {
-	  hRyAliCorr->SetBinContent(istruct+1,AlignCorr(jdof));
-	  hRyAliCorr->SetBinError(istruct+1,AlignCorrError(jdof));
-	}
-	if (thisDoFType == DoFRz) {
-	  hRzAliCorr->SetBinContent(istruct+1,AlignCorr(jdof));
-	  hRzAliCorr->SetBinError(istruct+1,AlignCorrError(jdof));
-	}
-	jdof++;
-      } // end of good dof type
-    } // end of loop on indices
-  } // end of loop on structures
-  
-
-  // Next step: create the projection histograms of correction by dof
-  // Tx
-  HistLimits = GetHistoLimits(hTxAliCorr);
-  hTxAliCorr->SetMaximum(HistLimits.max);
-  hTxAliCorr->SetMinimum(HistLimits.min);
-  hTxAliCorrProj = new TH1F("hTxAliCorrProj","Tx alignment corrections", xBins, HistLimits.min, HistLimits.max); 
-  hTxAliCorrProj->SetXTitle("Tx (mm)");
-  // Ty
-  HistLimits = GetHistoLimits(hTyAliCorr);
-  hTyAliCorr->SetMaximum(HistLimits.max);
-  hTyAliCorr->SetMinimum(HistLimits.min);
-  hTyAliCorrProj = new TH1F("hTyAliCorrProj","Ty alignment corrections", xBins, HistLimits.min, HistLimits.max); 
-  hTyAliCorrProj->SetXTitle("Ty (mm)");
-  // Tz
-  HistLimits = GetHistoLimits(hTzAliCorr);
-  hTzAliCorr->SetMaximum(HistLimits.max);
-  hTzAliCorr->SetMinimum(HistLimits.min);
-  hTzAliCorrProj = new TH1F("hTzAliCorrProj","Tz alignment corrections", xBins, HistLimits.min, HistLimits.max); 
-  hTzAliCorrProj->SetXTitle("Tz (mm)");
-  // Rx
-  HistLimits = GetHistoLimits(hRxAliCorr);
-  hRxAliCorr->SetMaximum(HistLimits.max);
-  hRxAliCorr->SetMinimum(HistLimits.min);
-  hRxAliCorrProj = new TH1F("hRxAliCorrProj","Rx alignment corrections", xBins, HistLimits.min, HistLimits.max); 
-  hRxAliCorrProj->SetXTitle("Rx (mrad)");
-  // Ry
-  HistLimits = GetHistoLimits(hRyAliCorr);
-  hRyAliCorr->SetMaximum(HistLimits.max);
-  hRyAliCorr->SetMinimum(HistLimits.min);
-  hRyAliCorrProj = new TH1F("hRyAliCorrProj","Ry alignment corrections", xBins, HistLimits.min, HistLimits.max); 
-  hRyAliCorrProj->SetXTitle("Ry (mrad)");
-  // Rz
-  HistLimits = GetHistoLimits(hRzAliCorr);
-  hRzAliCorr->SetMaximum(HistLimits.max);
-  hRzAliCorr->SetMinimum(HistLimits.min);
-  hRzAliCorrProj = new TH1F("hRzAliCorrProj","Rz alignment corrections", xBins, HistLimits.min, HistLimits.max); 
-  hRzAliCorrProj->SetXTitle("Rz (mrad)");
-  
-
-  // Now... once projection histograms are created with the right range, then fill them
-  for (Int_t idof=0; idof < GetNdof(); idof++) {
-    thisDoFType =  DoFType(idof);
-    if (thisDoFType == DoFTx) hTxAliCorrProj->Fill(AlignCorr(idof));
-    if (thisDoFType == DoFTy) hTyAliCorrProj->Fill(AlignCorr(idof));
-    if (thisDoFType == DoFTz) hTzAliCorrProj->Fill(AlignCorr(idof));
-    if (thisDoFType == DoFRx) hRxAliCorrProj->Fill(AlignCorr(idof));
-    if (thisDoFType == DoFRy) hRyAliCorrProj->Fill(AlignCorr(idof));
-    if (thisDoFType == DoFRz) hRzAliCorrProj->Fill(AlignCorr(idof));
-  }
-
-  /////////////////
-  // Now plot the histograms
-  CAliCorrDof->cd(1);
-  if (UseTx) {hTxAliCorr->Draw(); gPad->SetGridx(1); gPad->SetGridy(1);}
-  
-  CAliCorrDof->cd(2);
-  if (UseTy) {hTyAliCorr->Draw(); gPad->SetGridx(1); gPad->SetGridy(1);}
-
-  CAliCorrDof->cd(3);
-  if (UseTz) {hTzAliCorr->Draw(); gPad->SetGridx(1); gPad->SetGridy(1);}
-
-  CAliCorrDof->cd(4);
-  if (UseRx) {hRxAliCorr->Draw(); gPad->SetGridx(1); gPad->SetGridy(1);}
-
-  CAliCorrDof->cd(5);
-  if (UseRy) {hRyAliCorr->Draw(); gPad->SetGridx(1); gPad->SetGridy(1);}
-
-  CAliCorrDof->cd(6);
-  if (UseRz) {hRzAliCorr->Draw();  gPad->SetGridx(1); gPad->SetGridy(1);}
-
-  // 
-  TCanvas *CAliCorrProj = new TCanvas("AliCorrProj", "jacobana: Alignment corrections projected by dof ", 1200, 800);
-  CAliCorrProj->Divide(3,2);
-
-  CAliCorrProj->cd(1);
-  if (UseTx) {hTxAliCorrProj->Draw(); gPad->SetGridx(1);}
-
-  CAliCorrProj->cd(2);
-  if (UseTy) {hTyAliCorrProj->Draw(); gPad->SetGridx(1);}
-
-  CAliCorrProj->cd(3);
-  if (UseTz) {hTzAliCorrProj->Draw(); gPad->SetGridx(1);}
-
-  CAliCorrProj->cd(4);
-  if (UseRx) {hRxAliCorrProj->Draw(); gPad->SetGridx(1);}
-
-  CAliCorrProj->cd(5);
-  if (UseRy) {hRyAliCorrProj->Draw(); gPad->SetGridx(1);}
-
-  CAliCorrProj->cd(6);
-  if (UseRz) {hRzAliCorrProj->Draw(); gPad->SetGridx(1);}
-
-  if (GetPrintLevel()>=3) std::cout << " <ea> Booking histograms for the alignment corrections... completed " << std::endl;
-  return;
-}
-
-//////////////////////////////////////////////
-void BookAliCorrErrHistos()
-{
-  if (GetPrintLevel()>=3) std::cout << " <ea> Booking histograms for the alignment corrections... start " << std::endl;
-  
-  // 
-  // Histogram of alignment corrections in diagonal base, after weak mode removal.
-  hAliCorrErr_b = new TH1F ("hAliCorrErr_b","Errors of #delta b  (errors of align. corr. in diag. base, after mode cut)",
-			 BigVector.GetNoElements(), 
-			 0.5, 
-			 BigVector.GetNoElements()+0.5);
-  hAliCorrErr_b->SetXTitle("mode");
-  hAliCorrErr_b->SetLineColor(kRed);
-  hAliCorrErr_b->SetFillStyle(3001);
-  hAliCorrErr_b->SetFillColor(kRed);
-  if (GetPrintLevel()>=7) 
-    std::cout << " <ea> Defining histogram of alignment corrections errors in diagonal base with  " 
-	 <<  hAliCorrErr_b->GetNbinsX() << " bins " << std::endl;
-  
-  // strore alignment corrections in the daigonal base in the ad-hoc histogram
-  for (int i=0; i<AlignCorrError_b.GetNoElements(); i++) {
-    hAliCorrErr_b->SetBinContent(i+1,AlignCorrError_b(i));
-  }
-  if (!QuietMode) {
-    CanDiagonalBase->cd(4);
-    hAliCorrErr_b->Draw();
-  }
-
-  // 
-  // Histogram of alignment corrections in module base, after weak mode removal.
-  hAliCorrErr = new TH1F ("hAliCorrErr","Errors of #delta a  (errors of align. corr., after mode cut)",
-			 BigVector.GetNoElements(), 
-			 0.5, 
-			 BigVector.GetNoElements()+0.5);
-  hAliCorrErr->SetXTitle("dof");
-  hAliCorrErr->SetLineColor(kOrange+1);
-  hAliCorrErr->SetFillStyle(3001);
-  hAliCorrErr->SetFillColor(kOrange+1);
-  SetXAxisLabels(hAliCorrErr);
-  if (GetPrintLevel()>=7) 
-    std::cout << " <ea> Defining histogram of alignment corrections errors in module base with  " 
-	 <<  hAliCorrErr->GetNbinsX() << " bins " << std::endl;
-  
-  // strore alignment corrections in the daigonal base in the ad-hoc histogram
-  for (int i=0; i<AlignCorrError.GetNoElements(); i++) {
-    hAliCorrErr->SetBinContent(i+1,AlignCorrError(i));
-  }
-  if (!QuietMode) {
-    // draw it twice
-    // - in the diagonal base plots
-    CanDiagonalBase->cd(5);
-    hAliCorrErr->Draw();
-    // - in alignment corr. errors
-    CanAlignCorrErr->cd(1);
-    hAliCorrErr->Draw();
-    DrawStructLines(hAliCorrErr,CanAlignCorrErr,1);
-  }
-
-  return;
-}
-
-//////////////////////////////////////////////
-void BookAliCorrPullHistos()
-{
-  if (GetPrintLevel()>=0) std::cout << " <ea> Booking histograms for the alignment corrections pulls... start " << std::endl;
-  
-  // 
-  // Histogram of alignment corrections in diagonal base, after weak mode removal.
-  hAliCorrPull_b = new TH1F ("hAliCorrPull_b","Pull of #delta b  (Pulls of align. corr. in diag. base)",
-			 BigVector.GetNoElements(), 
-			 0.5, 
-			 BigVector.GetNoElements()+0.5);
-  hAliCorrPull_b->SetXTitle("mode");
-  hAliCorrPull_b->SetLineColor(kRed);
-  hAliCorrPull_b->SetFillStyle(3001);
-  hAliCorrPull_b->SetFillColor(kRed);
-  if (GetPrintLevel()>=0) 
-    std::cout << " <ea> Defining histogram of alignment correction pulls in diagonal base with  " 
-	 <<  hAliCorrPull_b->GetNbinsX() << " bins " << std::endl;
-  
-  // strore alignment corrections in the daigonal base in the ad-hoc histogram
-  for (int i=0; i<AlignCorrError_b.GetNoElements(); i++) {
-    float pullvalue = 0;
-    if (IsEigenModeUsed(i)) pullvalue = AlignCorr_b(i)/AlignCorrError_b(i);
-    hAliCorrPull_b->SetBinContent(i+1, pullvalue);
-  }
-
-  if (!QuietMode) {
-    if (GetPrintLevel()>=0) std::cout << " <ea> drawing alignment corrections pulls..." << std::endl;
-    CanDiagonalBase->cd(6);
-    hAliCorrPull_b->Draw();
-  }
-
-  /*
-    // Salva: from copy paste: needs to define the new histogram, fill it and draw it.
-  // 
-  // Histogram of alignment corrections in module base, after weak mode removal.
-  hAliCorrErr = new TH1F ("hAliCorrErr","Errors of #delta a  (errors of align. corr., after mode cut)",
-			 BigVector.GetNoElements(), 
-			 0.5, 
-			 BigVector.GetNoElements()+0.5);
-  hAliCorrErr->SetXTitle("dof");
-  hAliCorrErr->SetLineColor(kOrange+1);
-  hAliCorrErr->SetFillStyle(3001);
-  hAliCorrErr->SetFillColor(kOrange+1);
-  SetXAxisLabels(hAliCorrErr);
-  if (GetPrintLevel()>=7) 
-    std::cout << " <ea> Defining histogram of alignment corrections errors in module base with  " 
-	 <<  hAliCorrErr->GetNbinsX() << " bins " << std::endl;
-  
-  // strore alignment corrections in the daigonal base in the ad-hoc histogram
-  for (int i=0; i<AlignCorrError.GetNoElements(); i++) {
-    hAliCorrErr->SetBinContent(i+1,AlignCorrError(i));
-  }
-  if (!QuietMode) {
-    // draw it twice
-    // - in the diagonal base plots
-    CanDiagonalBase->cd(5);
-    hAliCorrErr->Draw();
-    // - in alignment corr. errors
-    CanAlignCorrErr->cd(1);
-    hAliCorrErr->Draw();
-    DrawStructLines(hAliCorrErr,CanAlignCorrErr,1);
-  }
-  */
-
-  return;
-}
-
-//////////////////////////////////////////////
-void BookModeCorrections()
-{
-  if (GetPrintLevel()>=3) 
-    std::cout << " <ea> -- BookModeCorrections -- starting " << std::endl << std::endl;
-  // book the histograms on the
-  char nameh1[80];
-  char nameh2[80];
-  Float_t factor = 1.;
-  
-  for(int icol=0; icol<ChangeOfBaseMatrix.GetNcols(); icol++) {    
-    if (GetPrintLevel()>=9) std::cout << "   doing mode " << icol+1 << "/" << ChangeOfBaseMatrix.GetNcols() << std::endl;
-    sprintf(nameh1,"hModeCorr_%d",icol+1);
-    sprintf(nameh2,"Mode %d Correction",icol+1);
-    hModCorr[icol] = new TH1F(nameh1, nameh2,
-			     ChangeOfBaseMatrix.GetNrows(), 
-			     0.5, 
-			     ChangeOfBaseMatrix.GetNrows()+0.5);
-    
-    if (AlignCorr.GetNoElements()<= 186) {
-      SetXAxisLabels(hModCorr[icol]);
-    }
-    hModCorr[icol]->SetXTitle("d.o.f.");
-    for(int irow=0; irow<ChangeOfBaseMatrix.GetNrows(); irow++) {
-      //      factor = (IsTranslation(irow)) ? 1. : Rad2mRad; // Print mrad for the angles 
-      hModCorr[icol]->SetBinContent(irow+1, ChangeOfBaseMatrix(irow,icol)*AlignCorrRaw_b(icol)*factor);
-    }
-  }  
-
-
-  if (!QuietMode && PlotEigenVecs){
-
-    // set color of mode corrections histograms
-    SetColorsOfModeCorrHists();
-
-    // Now Plot the eigen vectors histograms in several pages (i.e. canvas)
-    // 6 histos per canvas 
-    Int_t HistosPerCanvas = GetNEigenPerCanvas();
-    Int_t Ncanvas = GetNEigenCanvas(); 
-    
-    if (Ncanvas>40) {
-      Ncanvas = 40;
-      if (GetPrintLevel()>=1)
-	  std::cout << " <ea> -- BookModeCorrections -- WARNING too many canvas' --> Limited to "<< Ncanvas << std::endl;
-    }
-
-    const Int_t nc = Ncanvas;
-    TCanvas *CanModeCorr[nc];
-    Int_t FirstEigenVec=0;
-    Int_t LastEigenVec=-1;
-    char cname1[80];
-    char cname2[80];
-    Int_t ipad=0;
-
-    // loop to create canvases
-    for (Int_t icanvas=0; icanvas < Ncanvas; icanvas++) {
-      FirstEigenVec = LastEigenVec+1;
-      LastEigenVec = FirstEigenVec+HistosPerCanvas-1;
-      sprintf(cname1,"ModCorr_%d_%d",FirstEigenVec+1,LastEigenVec+1);
-      sprintf(cname2,"Mode corrections: %d -> %d ",FirstEigenVec+1,LastEigenVec+1);
-      CanModeCorr[icanvas] = new TCanvas(cname1, cname2, 1000, 880);
-      DivideEigenCanvas(CanModeCorr[icanvas]);
-    }
-    
-    // loop to plot histograms
-    FirstEigenVec=0;
-    LastEigenVec=-1;
-    for (Int_t icanvas=0; icanvas < Ncanvas; icanvas++) {
-      FirstEigenVec = LastEigenVec+1;
-      LastEigenVec = FirstEigenVec+HistosPerCanvas-1;
-      if (LastEigenVec >= BigVector.GetNoElements()) LastEigenVec = BigVector.GetNoElements()-1; 
-      ipad = 0; 
-      for (Int_t iev=FirstEigenVec; iev<=LastEigenVec; iev++) {
-	ipad++;
-	CanModeCorr[icanvas]->cd(ipad); 
-	hModCorr[iev]->SetYTitle("mm or mrad");
-	hModCorr[iev]->Draw();
-	DrawStructLines(hModCorr[iev],CanModeCorr[icanvas],ipad);
-	gPad->Update();
-      }
-    }
-  }
-
-  if (true) {
-    // draw all mode corrections in top of each other (in a stack)
-    // open a canvas
-    TCanvas *CanSumCorr = new TCanvas("SumCorr", "Sum of alignment corrections");
-    CanSumCorr->cd(1);
-    // book a histogram that helps as frame // hAliCorr->GetXaxis()->GetXmax()
-    HistoBins HistLimits = GetHistoLimits(hAliCorr);
-    TH2F *hisFrame = new TH2F("hisFrame","Sum of alignment corrections",
-    			      hModCorr[0]->GetNbinsX(),
-			      0.,
-    			      hModCorr[0]->GetNbinsX(),
-    			      1,
-    			      HistLimits.min,
-    			      HistLimits.max); 
-    SetXAxisLabels(hisFrame, true); 
-
-    // stack all used mode corrections. Each mode with a different color for easy diagnostic
-    THStack *hstack = new THStack("hstack","Sum of alignment corrections");
-    Int_t ModeLow = GetNdof(); // Lowest mode used 
-    for (int i=0; i<GetNdof(); i++) {
-      if (IsEigenModeUsed(i)) {
-	if (i<ModeLow) ModeLow = i;
-	// ModesUsed++;
-	// Color_i = (int) (51+ModesUsed*ColorStep)-1;
-	// if (Color_i>100) Color_i = 100;
-	hstack->Add(hModCorr[i]);
-	if (GetPrintLevel()>=8) {
-	  std::cout << " <ea> hstack = " << hstack->GetTitle() << " after stacking " << i << " nmodes" << std::endl;
-	  std::cout << "      --> hModCorr["<<i<<"] ("<< hModCorr[i]->GetTitle() << " bin #1 has content:" << hModCorr[i]->GetBinContent(1) << std::endl;
-	}
-      }
-    }
-    // plot
-    gStyle->SetNumberContours(100);
-    hisFrame->GetZaxis()->SetRangeUser(ModeLow,GetNdof());
-    hisFrame->Fill(0.,0.);
-    hisFrame->Draw("colz");
-    hstack->Draw("same"); // this needs to be fixed --> there is a mismatch of bin numbers
-
-    gPad->Update();
-    TPaletteAxis *zPalette = (TPaletteAxis*)hisFrame->GetListOfFunctions()->FindObject("palette");
-    zPalette->SetX1NDC(0.92);
-    zPalette->SetX2NDC(0.95);
-    zPalette->SetLabelSize(0.03);
-    zPalette->Draw();
-    gPad->SetGridx(1);
-    gPad->SetGridy(1);
-  }
-  if (GetPrintLevel()>=3) 
-    std::cout << " <ea> -- BookModeCorrections -- completed " << std::endl << std::endl;
-  return;
-}
-
-//////////////////////////////////////////////
-void SetColorsOfModeCorrHists()
-{
-  float ColorStep = 50./(GetNUsedDof()-1);  // there are 50 colors
-  Int_t Color_i = 0;
-  Int_t ModesUsed = 0;
-
-  for (int i=0; i<GetNdof(); i++) {
-    if (IsEigenModeUsed(i)) {
-      // Modes which are used are filled with a color
-      ModesUsed++;
-      Color_i = (int) (51+ModesUsed*ColorStep)-1;
-      if (Color_i>100) Color_i = 100;  // in case of overflow
-      hModCorr[i]->SetLineColor(1);
-      hModCorr[i]->SetFillColor(Color_i);
-      hModCorr[i]->SetFillStyle(1001);
-    }
-    else {
-      // Modes not used are colored in gray
-      hModCorr[i]->SetLineColor(1);
-      hModCorr[i]->SetFillColor(kGray+1);
-      hModCorr[i]->SetFillStyle(1001);	
-    }
-  }
-
-  return;
-}
-
-//////////////////////////////////////////////
-void BookDofCorrections()
-{
-  if (GetPrintLevel()>=3) 
-    std::cout << " <ea> -- BookDofCorrections -- starting " << std::endl << std::endl;
-  // book the histograms on the
-  char nameh1[80];
-  char nameh2[80];
-  Float_t factor = 1.;
-  Double_t ThisDofType;
-
-  // book the histograms with the dof corrections
-  for(int idof=0; idof<GetNdof(); idof++) {    
-    if (GetPrintLevel()>=9) std::cout << "   doing dof " << idof+1 << "/" << GetNdof() << std::endl;
-    ThisDofType = DoFType(idof); 
-    sprintf(nameh1,"hDofCorr_%d",idof+1);
-    //    sprintf(nameh2,"Dof %d: corr. mode by mode: %s %s",
-    //	    idof+1, StructureName[DofBelongsToStruct[idof]]->Data(), DofName[(int) ThisDofType]->Data()); 
-    sprintf(nameh2,"Dof %d: corr. mode by mode: %s %s",
-	    idof+1, StructureName[DofBelongsToStruct[idof]]->Data(), DofName[(int) ThisDofType].Data()); 
-    hDofCorr[idof] = new TH1F(nameh1, nameh2, GetNdof(), 0.5, GetNdof()+0.5);
-    hDofCorr[idof]->SetXTitle("mode");
-    hDofCorr[idof]->SetLineColor(kRed);
-    hDofCorr[idof]->SetFillStyle(3001);	
-    hDofCorr[idof]->SetFillColor(kRed);	
-
-    // now create the integral histogram
-    sprintf(nameh1,"hDofIntegral_%d",idof+1);
-    sprintf(nameh2,"Dof %d: integral of corrections mode by mode: %s %s",
-	    idof+1, StructureName[DofBelongsToStruct[idof]]->Data(), DofName[(int) ThisDofType].Data());
-    hDofIntegral[idof] = new TH1F(nameh1, nameh2, GetNdof(), 0.5, GetNdof()+0.5);
-    hDofIntegral[idof]->SetXTitle("mode");
-    
-    hDofIntegral[idof]->SetLineColor(1);
-    hDofIntegral[idof]->SetFillColor(kGray);
-    hDofIntegral[idof]->SetFillStyle(1001);	
-
-    // fill the histograms
-    for(int imode=0; imode<GetNdof(); imode++) {
-      if (IsEigenModeUsed(imode)) {
-	//      factor = (IsTranslation(irow)) ? 1. : Rad2mRad; // Print mrad for the angles 
-	hDofCorr[idof]->SetBinContent(imode+1, ChangeOfBaseMatrix(idof,imode)*AlignCorrRaw_b(imode)*factor);
-      }
-      else {
-	hDofCorr[idof]->SetBinContent(imode+1, 0.);
-      }
-      // fill the integral
-      hDofIntegral[idof]->SetBinContent(imode+1, 
-					hDofIntegral[idof]->GetBinContent(imode)+
-					hDofCorr[idof]->GetBinContent(imode+1));    
-    }
-  }  
-
-  // once finished, change the limits for nicer presentation
-  HistoBins HistLimits;
-  for (int idof=0; idof < GetNdof(); idof++) {
-    HistLimits = GetHistoLimits(hDofCorr[idof], hDofIntegral[idof]);
-    hDofIntegral[idof]->SetMaximum(HistLimits.max);
-    hDofIntegral[idof]->SetMinimum(HistLimits.min);
-  }
-
-  // draw histograms
-  if (!QuietMode && PlotEigenVecs){
-    // Now Plot the eigen vectors histograms in several pages (i.e. canvas)
-    // 6 histos per canvas 
-    Int_t HistosPerCanvas = GetNEigenPerCanvas();
-    Int_t Ncanvas = GetNEigenCanvas(); 
-    
-    if (Ncanvas>40) {
-      Ncanvas = 40;
-      if (GetPrintLevel()>=1)
-	  std::cout << " <ea> -- BookModeCorrections -- WARNING too many canvas' --> Limited to "<< Ncanvas << std::endl;
-    }
-
-    const Int_t nc = Ncanvas;
-    TCanvas *CanModeCorr[nc];
-    Int_t FirstEigenVec=0;
-    Int_t LastEigenVec=-1;
-    char cname1[80];
-    char cname2[80];
-    Int_t ipad=0;
-
-    // loop to create canvases
-    for (Int_t icanvas=0; icanvas < Ncanvas; icanvas++) {
-      FirstEigenVec = LastEigenVec+1;
-      LastEigenVec = FirstEigenVec+HistosPerCanvas-1;
-      sprintf(cname1,"DofCorr_%d_%d",FirstEigenVec+1,LastEigenVec+1);
-      sprintf(cname2,"Dof corrections: %d -> %d (%s)",FirstEigenVec+1,LastEigenVec+1,StructureName[DofBelongsToStruct[FirstEigenVec]]->Data());
-      CanModeCorr[icanvas] = new TCanvas(cname1, cname2, 1000, 880);
-      DivideEigenCanvas(CanModeCorr[icanvas]);
-    }
-
-    // loop to plot histograms
-    FirstEigenVec=0;
-    LastEigenVec=-1;
-    for (Int_t icanvas=0; icanvas < Ncanvas; icanvas++) {
-      FirstEigenVec = LastEigenVec+1;
-      LastEigenVec = FirstEigenVec+HistosPerCanvas-1;
-      if (LastEigenVec >= BigVector.GetNoElements()) LastEigenVec = BigVector.GetNoElements()-1; 
-      ipad = 0; 
-      for (Int_t iev=FirstEigenVec; iev<=LastEigenVec; iev++) {
-	ipad++;
-	CanModeCorr[icanvas]->cd(ipad); 
-	hDofIntegral[iev]->SetYTitle("mrad");
-	if (IsTranslation(iev))	hDofIntegral[iev]->SetYTitle("mm");
-	hDofIntegral[iev]->Draw();
-	hDofCorr[iev]->Draw("same");
-	gPad->SetGridx(1);
-	gPad->SetGridy(1);
-      }
-    }
-  }
-
-  if (GetPrintLevel()>=3) 
-    std::cout << " <ea> -- BookDofCorrections -- completed " << std::endl << std::endl;
-  return;
-}
-
-//////////////////////////////////////////////
-void ChangeAngleUnits()
-{
-  if (GetPrintLevel()>=1) 
-    std::cout << " <ea> ------ ChangeAngleUnit ---- starts ---- with AngleUnitFactor= " << AngleUnitFactor << std::endl;
-
-  Double_t Factor = 1.;
-
-  // first change the matrix elements
-  for (Int_t i=0; i<BigMatrix.GetNrows(); i++) {
-
-    for (Int_t j=0; j<BigMatrix.GetNcols(); j++) {
-      Factor = 1.;
-      if (IsRotation(i)) Factor *= AngleUnitFactor; 
-      if (IsRotation(j)) Factor *= AngleUnitFactor; 
-
-      if (Factor != 1.) {
-	Double_t NewValue = Factor * BigMatrix(i,j);
-
-	if (GetPrintLevel()>=8) 
-	  std::cout << " <ea> BigMatrix(" << i << "," <<j <<") = " << BigMatrix(i,j) 
-		    << " * " << Factor << " = " << NewValue << std::endl;	
-
-	BigMatrix(i,j) = NewValue;
-      } 
-    }
-  }
-  // first change the vector elements
-  for (Int_t i=0; i<BigVector.GetNoElements(); i++) {
-    Factor = 1.;
-    if (IsRotation(i)) Factor *= AngleUnitFactor; 
-    if (Factor != 1.) {
-      Double_t NewValue = Factor * BigVector(i);
-      
-      if (GetPrintLevel()>=8) 
-	std::cout << " <ea> BigVector(" << i << ") = " << BigVector(i) 
-		  << " * " << Factor << " = " << NewValue << std::endl;	
-      
-      BigVector(i) = NewValue;
-    }
-  }
-  if (GetPrintLevel()>=1) 
-    std::cout << " <ea> ------ ChangeAngleUnit ---- completed ... " << std::endl;
-}
-
-// //////////////////////////////////////////////
-void PrintAlignmentCorrections(const TVectorD &PrVec)
-{
-  //
-  Int_t NStruct = GetNStruct();
-  if (GetPrintLevel()>=1) {  
-    std::cout << " <ea> Number of structures: " << NStruct << std::endl;
-  }
-
-  // declare a summary
-  Double_t Summary[6];
-  for (int i=0; i<6; i++) {
-    Summary[i]=0.;
-  }
-
-  Float_t factor = 1.;
-  Bool_t PrintVal;
-  Int_t idof = 0;
-
-  std::cout << "  +---------------+-------------------------------------------------------------+ " << std::endl;
-  std::cout << "  |   structure   |   Tx         Ty        Tz        Rx         Ry        Rz     |" << std::endl;
-  std::cout << "  +---------------+-------------------------------------------------------------+ " << std::endl;
-  for (Int_t istruct=0; istruct< GetNStruct(); istruct++) { // looping over all possible dofs
-    // std::cout << "  |  " << setw(5) << istruct << "  | ";
-    
-    // print structure name
-    if (istruct < GetNMaxStructures()) {
-      if (StructureName[istruct] != NULL) {
-	std::cout << "  | " <<  setw(12) << StructureName[istruct]->Data() << "  | ";
-      }
-      else {
-	std::cout << "  |  " << setw(12) << istruct << "  | "; 
-      }
-    }
-        
-    // Each structure has 6 dof maximum. If less are used, jump those unused and print those used
-    for (Int_t index=0; index < 6; index++) { 
-      
-      // this depends on the angle units //factor = (IsTranslation(iDof)) ? 1. : Rad2mRad; // Print mrad for the angles 
-      factor = 1.;
-
-      PrintVal = false;
-      if (index == DoFType(idof)) PrintVal = true; 
-      
-      if (GetPrintLevel()>=9) {
-	std::cout << std::endl
-		  << " --> struct= " << istruct 
-		  << "   dof within struct " << index 
-		  << "   is used ? " << PrintVal
-		  << "   Dof in vector is " << idof
-		  << "   factor: " << factor 
-		  << "   ouput-> ";
-      }
-      if (PrintVal) { 
-	// std::cout << setw(7) << PrVec(i)*factor << "  ";
-	std::cout << setw(8) << setprecision(3) << PrVec(idof)*factor << "  ";
-	Summary[index] += PrVec(idof)*factor;
-	idof++;
-      }
-      else {
-	std::cout << "   --     ";
-      }
-    }
-    std::cout << std::endl;
-  }
-  std::cout << "  +---------------+-------------------------------------------------------------+ " << std::endl;
-  std::cout << "  +   all sum     + ";
-  //  for (int i=0; i<GetNdofPerStruct(); i++) {
-  for (int i=0; i<6; i++) {
-    PrintVal = false;
-    if (i == 0 && UseTx) PrintVal = true;
-    if (i == 1 && UseTy) PrintVal = true; 
-    if (i == 2 && UseTz) PrintVal = true; 
-    if (i == 3 && UseRx) PrintVal = true; 
-    if (i == 4 && UseRy) PrintVal = true; 
-    if (i == 5 && UseRz) PrintVal = true; 
-    //    factor = (i<3) ? 1. : 1000.; // imprimim mrad per als angles
-    // std::cout << setw(7) << setprecision(4) << Summary[i]*factor << "  ";
-    if (PrintVal) { 
-      std::cout << setw(7) << setprecision(4) << Summary[i] << "  ";
-    }
-    else {
-      std::cout << "   --      ";
-    }
-  }
-  std::cout << std::endl;
-  std::cout << "  +   average     + ";
-  for (int i=0; i<GetNdofPerStruct(); i++) {
-    //    factor = (i<3) ? 1. : 1000.; // imprimim mrad per als angles
-    // std::cout << setw(7) << setprecision(4) << Summary[i]*factor << "  ";
-    std::cout << setw(7) << setprecision(4) << Summary[i]/NStruct << "  ";
-  }
-  std::cout << std::endl;
-  std::cout << "  +---------------+-------------------------------------------------------------+ " << std::endl;
-  std::cout << std::endl;
-}
-
-////////////////////////////////////////////
-void ExtractName(unsigned long long id, int n){
-
-  // extracting name of the structures
-  if (GetPrintLevel()>=8) std::cout << " <ea> ExtractName <ea> extracting structure names -- START -- " << std::endl;
-  if (GetPrintLevel()>=8) std::cout << "                       id = " << std::hex << id << std::dec << "  n= " << n << std::endl;
-  int id32 = (id >> 32);
-  if (GetPrintLevel()>=8) std::cout << "                     id32 = " << std::hex << id32 << std::dec << "  n= " << n << std::endl;
-  
-
-  // find out the detector type
-  int det = (id32 >> 27);
-  if (GetPrintLevel()>=8) std::cout << "                     det = " << std::hex << det << std::dec << "  n= " << n << std::endl;
-  if (GetPrintLevel()>=8) std::cout << " Detector : " << det << std::endl;
-
-  // find out the barrel or encap value
-  // posible "bec" values
-  // 0: ecc, 1: barrel, 2: eca (3 in TRT \277?) 
-  int bec = 0;
-  bec = (id >> 57) & 3;
-  if ( det == PIX) bec = (id32 >> 24) & 3;
-  //  int bec = (id >> 57) & 3; // for unsigned long long
-  if (GetPrintLevel()>=8) std::cout << "      Bec : " << bec << std::endl;
-
-
-  // extract layer number
-  int lay = 0;
-  if (det == PIX) {
-    // lay = (id32 >> 23) & 3;
-    lay = (id32 >> 22) & 3;
-  }
-  else {
-    // lay = (id >> 21) & 15;
-    lay = (id >> 56) & 15;
-  }
-  if (GetPrintLevel()>=8) std::cout << "    Layer : " << lay << std::endl;
-  
-
-  // Define the string to keep the Structure Name
-  TString StructName;
-
-  // Posible "det" values
-  // 0: Pixel, 1: SCT, 2: TRT
-  if(det==0)
-  	StructName += "PIX";
-  else if(det==1)
-  	StructName += "SCT";
-  else
-  	StructName += "TRT";
-
-
-  if(bec == 0){
-    if (det==2)
-      StructName += "-ECA"; // bec=0 TRT ECA
-    else
-      StructName += "-ECC"; // bec=0 SCT and PIX ECC
-  }
-  else if (bec == 1)
-    StructName += "-BAR";
-  else{
-    if(det==2)
-      StructName += "-ECC"; // bec=3 TRT ECC
-    else
-      StructName += "-ECA"; // bec=2 SCT and PIX ECA
-  }
-  if(bec==1)
-  	StructName += "-l";
-  else
-  	StructName += "-d";
-  StructName += lay;
-  //StructName += "\\n";
-
-  // reset what it was done... and start again
-  StructName.Clear();
-  // form the names: detector
-  if (det== PIX) {
-    StructName += "PIX"; 
-    if (bec == 1) StructName += "ECA";
-    if (bec == 2) StructName += "BAR";
-    if (bec == 3) StructName += "ECC";
-
-    // add layer naumber  
-    // pixel barrel starts at layer 0 (which has lay=1), all ids are shifted by one.
-    // pixel barrel end cap disks ids are correct
-    if ( bec == 2) { // barrel
-      StructName += lay - 1;
-    }
-    else { // end-caps
-      StructName += lay;      
-    }
-
-    // IBL
-    if (bec == 2 && lay==0) {
-      StructName.Clear();
-      StructName += "PIX-IBL";
-    }
-  }
-
-  if (det==1) StructName += "SCT"; 
-  if (det==2) StructName += "TRT"; 
-
-  // Special cases
-  // level 1
-  if (NumberOfPIXStruct==1 && NumberOfSCTStruct==3 && NumberOfTRTStruct==3) {
-    // main
-    if (det == PIX) StructName = "PIX";
-    if (det == SCT) StructName = "SCT";
-    if (det == TRT) StructName = "TRT";
-    // barrel-ecc
-    if (det == SCT | det == TRT ) {
-      if(bec == 0){
-	if (det == TRT)
-	  StructName += "-ECA"; // bec=0 TRT ECA
-	else
-	  StructName += "-ECC"; // bec=0 SCT and PIX ECC
-      }
-      else if (bec == 1)
-  	StructName += "-BAR";
-      else{
-	if (det == TRT)
-	  StructName += "-ECC"; // bec=3 TRT ECC
-	else
-	  StructName += "-ECA"; // bec=2 SCT and PIX ECA
-      }
-    }
-  }
-
-  // if there are only 3 TRT structures. Most likely are the barrel and endcaps
-  if (NumberOfPIXStruct!=1 && NumberOfSCTStruct!=3 && NumberOfTRTStruct==3) {
-    if (det == TRT) {
-      StructName = "TRT";
-      if (bec == 1) StructName += "-BAR";
-      if (bec == 0) StructName += "-ECA"; // bec=0 TRT ECA
-      if (bec == 3) StructName += "-ECC"; // bec=0 TRT ECA
-    }
-  } // special case: 3 structures TRT
-
-  // if there are only 2 SCT and 3 TRT structures. Most likely the two SCT are the and endcaps and the SCT barrel was not aligned
-  if (NumberOfSCTStruct==2 && NumberOfTRTStruct==3) {
-    if (det == SCT) {
-      StructName = "SCT";
-      if (bec == 1) StructName += "-BAR";
-      if (bec == 0) StructName += "-ECC"; 
-      if (bec == 2) StructName += "-ECA"; 
-    }
-    if (det == TRT) {
-      StructName = "TRT";
-      if (bec == 1) StructName += "-BAR";
-      if (bec == 0) StructName += "-ECA"; // bec=0 TRT ECA
-      if (bec == 3) StructName += "-ECC"; // bec=0 TRT ECA
-    }
-  } // special case: 3 structures TRT
-
-  // if there is only one pixel structure it is probably the pixel level 1
-  if (NumberOfPIXStruct==1 ){
-    if (det == PIX) {
-      StructName = "PIX";
-    }
-  }
-  // level 11 pixels
-  if (NumberOfPIXStruct==2 && NumberOfSCTStruct==0 && NumberOfTRTStruct== 0 ){
-    if (det == PIX) {
-      // IBL
-      if (bec == 2 && lay==0) {
-	StructName.Clear();
-	StructName += "PIX-IBL";
-      } 
-      else {
-	StructName.Clear();
-	StructName += "PIX";
-      }
-    }
-  }
-  
-  //
-  StructureName[n] = new TString(StructName);
-
-  if (GetPrintLevel()>=8) cout << " <ea> structure " << n << " has label " << StructureName[n]->Data() << endl;
-  if (GetPrintLevel()>=8) std::cout << " <ea> ExtractName <ea> extracting structure names -- COMPLETED -- " << std::endl;
-
-  return;
-}
-
-////////////////////////////////////////////
-void FindDetectorType(unsigned long long id, int n, int dofid)
-{
-
-  //int det = (id >> 27);
-  int det = (id >> 59);  // for unsigned long long
-  // 0: Pixel, 1: SCT, 2: TRT
-  if (GetPrintLevel()>=5)
-  	cout << "Detector : " << det << endl;
-  //int bec = (id >> 25) & 3;
-  int bec = (id >> 57) & 3; // for unsigned long long
-  // In TRT: 0: eca, 1: barrel, 3: ecc 
-  // In Pix and SCT: 0: ecc, 1: barrel, 2: eca 
-  if (GetPrintLevel()>=5)
-	cout << "     Bec : " << bec << endl;
-  int lay;
-  if (det==0)
-  	lay = (id >> 23) & 3;
-  else
-    lay = (id >> 21) & 15;
-  if (GetPrintLevel()>=5)
-    cout << "       Layer : " << lay << endl;
-  
-  TString StructName;
-  if(det==0)
-  	StructName += "PIX";
-  else if(det==1)
-  	StructName += "SCT";
-  else
-  	StructName += "TRT";
-
-  if(bec == 0)
-  	StructName += "-ECA";
-  else if (bec == 1)
-  	StructName += "-BAR";
-  else
-  	StructName += "-ECC";
-
-  if(bec==1)
-  	StructName += "-l";
-  else
-  	StructName += "-d";
-  StructName += lay;
-
-  StructDetec[n] = det; // store the detector type identifier
-  DofBelongsToStruct[dofid] = n;
-
-  return;
-}
-///////////////////////////////////////////////
-void SetNofStructuresPerDetec()
-{
-  for (Int_t i=0; i<GetNStruct(); i++) {
-    if (StructDetec[i] == PIX) NumberOfPIXStruct++;
-    if (StructDetec[i] == SCT) NumberOfSCTStruct++;
-    if (StructDetec[i] == TRT) NumberOfTRTStruct++;
-  }
-
-  if (GetPrintLevel()>=5) {
-    cout << " <ea> Number and type of the structures " << endl;
-    cout << "        PIX " << NumberOfPIXStruct << endl
-	 << "        SCT " << NumberOfSCTStruct << endl 
-	 << "        TRT " << NumberOfTRTStruct << endl;
-  }
-  return;
-}
-///////////////////////////////////////////////
-HistoBins GetHistoLimits(TH1F *hist)
-{
-  HistoBins thisHlimit;
-  thisHlimit.max = hist->GetMaximum();
-  thisHlimit.min = hist->GetMinimum(); 
-
-  float Largest = TMath::Abs(thisHlimit.max);
-  if (TMath::Abs(thisHlimit.min) > Largest) Largest = TMath::Abs(thisHlimit.min); 
-
-  if (Largest < 0.001) Largest = 0.001;
-
-  // make ranges symmetric
-  thisHlimit.max =  Largest;
-  thisHlimit.min = -Largest;
-
-  //increment the ranges a bit
-  float delta = (thisHlimit.max - thisHlimit.min)*0.10; // 
-  thisHlimit.max += delta; 
-  thisHlimit.min -= delta; 
-
-  if (GetPrintLevel()>=9) {
-    cout << " <ea> GetHistoLimits <ea> Histogram Limits for histo : "
-	 << hist->GetTitle() 
-	 << " = " << thisHlimit.min 
-	 << " --> " << thisHlimit.max << endl;
-  }
-  return thisHlimit;
-}
-///////////////////////////////////////////////
-HistoBins GetHistoLimits(TH1F *hist1, TH1F *hist2)
-{
-  HistoBins thisHlimit;
-  thisHlimit.max = hist1->GetMaximum();
-  thisHlimit.min = hist1->GetMinimum(); 
-
-  if (hist2 != NULL) {
-    if (hist2->GetMaximum() > hist1->GetMaximum())   thisHlimit.max = hist2->GetMaximum();
-    if (hist2->GetMinimum() < hist1->GetMinimum())   thisHlimit.min = hist2->GetMinimum();
-  }
-
-  float Largest = TMath::Abs(thisHlimit.max);
-  if (TMath::Abs(thisHlimit.min) > Largest) Largest = TMath::Abs(thisHlimit.min); 
-
-  // make ranges symmetric
-  thisHlimit.max =  Largest;
-  thisHlimit.min = -Largest;
-
-  //increment the ranges a bit
-  float delta = (thisHlimit.max - thisHlimit.min)*0.10; // 
-  thisHlimit.max += delta; 
-  thisHlimit.min -= delta; 
-
-  if (GetPrintLevel()>=9) {
-    cout << " <ea> GetHistoLimits <ea> Histogram Limits for histo : "
-	 << hist1->GetTitle() 
-	 << " = " << thisHlimit.min 
-	 << " --> " << thisHlimit.max << endl;
-  }
-  return thisHlimit;
-}
-
-/////////////////////////////////////////////////////////////////
-void SetHitCut(float hitcut){
-	HitCut = hitcut;
-	}
-	
-/////////////////////////////////////////////////////////////////
-float GetHitCut(){
-	return HitCut;
-	}
-	
-/////////////////////////////////////////////////////////////////
-void RemoveRows(){
-  
-  // the idea is to remove those structures with too few hits
-  // keep iterating till no structure with fewer hits than required is found.
-  // **  rows to be removed are already flagged in RowsUsed **
-  // removing by blocks of consecutive bad rows.
-  while(true){
-    int low_index = -1;
-    int up_index = -1;
-    bool set_low = false;
-    bool set_up = false;
-    for( int i=0; i<RowsUsed.GetNoElements(); i++){
-      if(RowsUsed[i]==0 && !set_low){
-	low_index = i;
-	set_low = true;
-      }
-      if(RowsUsed[i]==1 && low_index<i && low_index!=-1 && !set_up){
-	up_index = i-1;
-	set_up = true;
-      }
-      if(i==RowsUsed.GetNoElements()-1 && !set_up){
-	up_index = i;
-	set_up = true;
-      }
-      if (low_index!=-1 && up_index!=-1){
-	cout << " <ea> RemoveRows <ea> Removing rows/columns between: " << low_index << " to " << up_index << endl;
-	RemoveVectorRows(low_index,up_index,RowsUsed);
-	RemoveVectorRows(low_index,up_index,BigVector);
-	RemoveVectorRows(low_index,up_index,DoFs);
-	RemoveVectorRows(low_index,up_index,Identifiers);
-	RemoveMatrixRows(low_index,up_index,BigMatrix);
-	break;	
-      }
-    } // end loop on rows
-
-    // count the number of structures with too few hits (actully per row, but if a row has too few hits, 
-    // all the rows of that structure have too few hits
-    int nZeros = 0;
-    for (int i=0; i<RowsUsed.GetNoElements(); i++){
-      if(RowsUsed[i]==0) nZeros++;
-    }
-    if (nZeros == 0) break;
-  }
-  return;
-}
-				
-/////////////////////////////////////////////////////////////////
-void RemoveVectorRows(int lwb, int upb, TVectorD& Vector){
-	TVectorT<double> VectorUp;
-	TVectorT<double> VectorDown;
-	if(GetPrintLevel()>6){
-		cout << "Original Vector: " << endl;
-		Vector.Print();
-	}
-	if(lwb!=0){
-		VectorUp.ResizeTo(lwb);
-		VectorUp = Vector.GetSub(0,lwb-1);
-		if(GetPrintLevel()>6){
-			cout << "Up Vector: " << endl;
-			VectorUp.Print();
-		}
-	}
-	
-	if(upb!=Vector.GetNoElements()-1){
-		VectorDown.ResizeTo(Vector.GetNoElements()-upb-1);
-		VectorDown = Vector.GetSub(upb+1,Vector.GetNoElements()-1);
-		if(GetPrintLevel()>6){
-			cout << "Down Vector: " << endl;
-			VectorDown.Print();
-		}
-	}
-	
-	Vector.ResizeTo(VectorUp.GetNoElements()+VectorDown.GetNoElements());
-	if(lwb!=0) Vector.SetSub(0,VectorUp);
-	if(upb!=Vector.GetNoElements()-1) Vector.SetSub(lwb,VectorDown);
-	if(GetPrintLevel()>6){
-		cout << "New Vector: " << endl;
-		Vector.Print();
-	}
-}	
-
-/////////////////////////////////////////////////////////////////
-void RemoveMatrixRows(int lwb, int upb, TMatrixDSym& SymMatrix){
-	TMatrixT<double> MatrixUpLeft;
-	TMatrixT<double> MatrixUpRight;
-	TMatrixT<double> MatrixDownLeft;
-	TMatrixT<double> MatrixDownRight;
-	TMatrixT<double> Matrix = (TMatrixT<double>) SymMatrix;
-	if(lwb!=0){
-		MatrixUpLeft.ResizeTo(lwb,lwb);
-		MatrixUpLeft = Matrix.GetSub(0,lwb-1,0,lwb-1);
-	}
-	if(lwb!=0 && upb!=Matrix.GetNrows()-1){
-		MatrixUpRight.ResizeTo(lwb,Matrix.GetNcols()-upb-1);
-		MatrixUpRight = Matrix.GetSub(0,lwb-1,upb+1,Matrix.GetNcols()-1);
-	
-		MatrixDownLeft.ResizeTo(Matrix.GetNrows()-upb-1,lwb);
-		MatrixDownLeft = Matrix.GetSub(upb+1, Matrix.GetNrows()-1,0,lwb-1);
-	}
-	if(upb!=Matrix.GetNrows()-1){
-		MatrixDownRight.ResizeTo(Matrix.GetNrows()-upb-1,Matrix.GetNcols()-upb-1);
-		MatrixDownRight = Matrix.GetSub(upb+1, Matrix.GetNrows()-1,upb+1, Matrix.GetNcols()-1);
-	}
-	SymMatrix.ResizeTo(MatrixUpLeft.GetNrows()+MatrixDownLeft.GetNrows(),MatrixUpLeft.GetNcols()+MatrixUpRight.GetNcols());
-	if(lwb!=0){
-		SymMatrix.SetSub(0,0,MatrixUpLeft);
-	}
-	if(lwb!=0 && upb!=Matrix.GetNrows()-1){
-		SymMatrix.SetSub(0,lwb,MatrixUpRight);
-		SymMatrix.SetSub(lwb,0,MatrixDownLeft);
-	}
-	if(upb!=Matrix.GetNrows()-1){
-		SymMatrix.SetSub(lwb,lwb,MatrixDownRight);
-	
-	}
-}	
-		
-/////////////////////////////////////////////////////////////////       	
-void DrawStructLines(TH1F *hist, TCanvas *can, int c){
-  int tmpdof=0;
-  
-  TLine myline(0,0,1,1);
-  myline.SetLineColor(1);
-  myline.SetLineStyle(2);
-  for (int i=0; i<GetNdof(); i++){
-    if (DoFs[i]<tmpdof){
-      double xline = hist->GetXaxis()->GetBinUpEdge(i);
-      double gap = hist->GetMaximum()-hist->GetMinimum(); 
-      double ymin = hist->GetMinimum() - 0.05*gap;
-      double ymax = hist->GetMaximum() + 0.05*gap;
-      can->cd(c);
-      myline.DrawLine(xline, ymin, xline, ymax);
-      if (GetPrintLevel()>=10) {
-	std::cout << " <ea> drawlines -- hist: " << hist->GetTitle() 
-		  << "  X0,y0, --> x1,y1: " << xline << " " << ymin << " ---> " << xline << " " << ymax << std::endl;
-      }
-    }
-    tmpdof = DoFs[i];
-  }
-  return;
-}		
-
-/////////////////////////////////////////////////////////////////       	
-void DrawStructLinesOnHMatrix(TH2F *hist)
-{
-  TLine myline(0,0,1,1);
-  myline.SetLineColor(1);
-  myline.SetLineStyle(1);
-
-  double xmin, xmax;
-  double ymin, ymax;
-
-  // X axis lines
-  int tmpdof=0;  
-  for (int i=0; i<GetNdof(); i++){
-    if (DoFs[i]<tmpdof){
-      xmin = hist->GetXaxis()->GetBinUpEdge(i);
-      xmax = xmin;
-      ymin = hist->GetYaxis()->GetXmin();
-      ymax = hist->GetYaxis()->GetXmax();
-      myline.DrawLine(xmin, ymin, xmax, ymax);
-      if (GetPrintLevel()>=10) {
-	std::cout << " <ea> drawlines -- hist: " << hist->GetTitle() 
-		  << "  X0,y0, --> x1,y1: " << xmin << " " << ymin << " ---> " << xmax << " " << ymax << std::endl;
-      }
-    }
-    tmpdof = DoFs[i];
-  }
-
-  // Y axis lines
-  tmpdof = DoFRz;
-  int thisdof;
-  for (int i=0; i<GetNdof(); i++){
-    thisdof = GetNdof()-1-i;
-    if (DoFs[thisdof]>tmpdof){ // when dof changes --> we are in a new structure
-      xmin = hist->GetXaxis()->GetXmin();
-      xmax = hist->GetXaxis()->GetXmax();
-      ymin = hist->GetYaxis()->GetBinUpEdge(i);
-      ymax = ymin;
-      myline.DrawLine(xmin, ymin, xmax, ymax);
-      if (GetPrintLevel()>=10) {
-	std::cout << " <ea> drawlines -- hist: " << hist->GetTitle() 
-		  << "  X0,y0, --> x1,y1: " << xmin << " " << ymin << " ---> " << xmax << " " << ymax 
-		  << "   i= " << i << "  dof:" << DoFs[i] << "  (" << DofName[(int) DoFs[i]] <<")" << std::endl;
-	  
-      }
-    }
-    tmpdof = DoFs[thisdof];
-  }
-  return;
-}		
-
-//////////////////////////////////////////////
-void SetXAxisLabels(TH1F *histo)
-{
-  // Set the DOF names in the X axis labels
-
-  if (GetPrintLevel()>=8) {
-    std::cout << " <ea> Setting labels for histogram: '" << histo->GetTitle() << "' "<< std::endl;
-  }
-
-  Int_t Nbins = histo->GetNbinsX();
-  histo->GetXaxis()->SetLabelSize(0.03);
-  if (Nbins < 18) histo->GetXaxis()->SetLabelSize(0.04);
-  if (Nbins < 12) histo->GetXaxis()->SetLabelSize(0.05);
-
-  Double_t ThisDofType;
-  TString thisdofname("dofname");
-
- for (int idof=0; idof<Nbins; idof++) {
-    ThisDofType = DoFType(idof);
-    thisdofname.Clear();
-    thisdofname.Append(StructureName[GetStructID(idof)]->Data());
-    thisdofname.Append("_");
-    thisdofname.Append(DofName[(int) ThisDofType].Data());
-    if (GetPrintLevel()>=8) {
-      std::cout << " dof " << idof << " belongs to structure " << GetStructID(idof)
-		<< " (" << StructureName[GetStructID(idof)]->Data() <<") " 
-		<< "  type= " << DofName[(int) ThisDofType].Data() 
-		<< "  label = " <<  thisdofname.Data() << endl;
-    }
-    histo->GetXaxis()->SetBinLabel(idof+1, thisdofname.Data());
-  }
-
-  if (GetPrintLevel()>=8) {
-    std::cout << " <ea> Histogram: '" << histo->GetTitle() << "' has brand new X axis labels. Action completed " << std::endl;
-  }
-  return;
-}
-
-//////////////////////////////////////////////
-void SetXAxisLabels(TH2F *histo, Bool_t nameonlyfirstofeachstruct)
-{
-  // Set the DOF names in the X axis labels
-
-  if (GetPrintLevel()>=10) std::cout << " <ea> -- SetXAxisLabels -- Setting labels for histogram: " << histo->GetTitle()<< std::endl;
-
-  Int_t Nbins = histo->GetNbinsX();
-  if (GetPrintLevel()>=10) {
-    std::cout << " <ea>  -- SetXAxisLabels -- histogram has " << Nbins << " bins in X "<< std::endl;
-  }
-
-  histo->GetXaxis()->SetLabelSize(0.02);
-
-  Double_t ThisDofType;
-  TString thisdofname("dofname");
-  Bool_t  setlabelname = true;
-  Int_t   currentstruct = -1;
-
-  for (int idof=0; idof<Nbins; idof++) {
-    if (GetPrintLevel()>=10)  std::cout << " <ea>  -- SetXAxisLabels -- loop on bins -- dealing with bin: " << idof << std::endl;
-    ThisDofType = DoFType(idof);
-    thisdofname.Clear();
-    thisdofname.Append(StructureName[GetStructID(idof)]->Data());
-    thisdofname.Append("_");
-    thisdofname.Append(DofName[(int) ThisDofType].Data());
-    if (GetPrintLevel()>=8) {
-      std::cout << " dof " << idof << " belongs to structure " << GetStructID(idof)
-		<< " (" << StructureName[GetStructID(idof)]->Data() <<") " 
-		<< "  type= " << DofName[(int) ThisDofType].Data() 
-		<< "  label = " <<  thisdofname.Data() << endl;
-    }
-
-    if (nameonlyfirstofeachstruct) {
-      setlabelname = false ; // flag this bin not to be labelled
-      if (GetStructID(idof)!= currentstruct){
-	// update currentstruct
-	currentstruct = GetStructID(idof);
-	setlabelname = true; // flag this bin to be labelled
-      }
-    }
-
-    if (setlabelname) {
-      histo->GetXaxis()->SetBinLabel(idof+1, thisdofname.Data());
-    }
-    else {
-      // set it to blank
-      histo->GetXaxis()->SetBinLabel(idof+1," ");
-    }
-  }
-
-  if (GetPrintLevel()>=8) {
-    std::cout << " <ea> Histogram: '" << histo->GetTitle() << "' has brand new X axis labels. Action completed " << std::endl;
-  }
-  return;
-}
-
-//////////////////////////////////////////////
-void SetHMatrixLabels(TH2F *histo)
-{
-  // Set the DOF names in the X and Y axis labels in bigmatrix like histograms
-
-  if (GetPrintLevel()>=8) {
-    std::cout << " <ea> -- SetHMatrixLabels -- Setting labels for histogram: '" << histo->GetTitle() << "' "<< std::endl;
-  }
-
-  Int_t Nbins = histo->GetNbinsX();
-  if (GetPrintLevel()>=8) {
-    std::cout << " <ea>  -- SetHMatrixLabels -- histogram has " << Nbins << " bins in X "<< std::endl;
-  }
-
-  histo->GetXaxis()->SetLabelSize(0.04);
-  histo->GetXaxis()->SetLabelSize(0.04);
-
-  TString thisbinname("binname");
-  Int_t   currentstruct = -1;
-  Int_t   firstbin = 0;
-  Int_t   lastbin = 0;
-  Double_t ThisDofType;
-
-  
-  // dealing with X axis bins
-  if (Nbins < 12) {
-    // if there are few bins, one can use the full name
-    histo->GetXaxis()->SetLabelSize(0.03);
-    for (int idof=0; idof<Nbins; idof++) {
-      ThisDofType = DoFType(idof);
-      thisbinname.Clear();
-      thisbinname.Append(StructureName[GetStructID(idof)]->Data());
-      thisbinname.Append("_");
-      thisbinname.Append(DofName[(int) ThisDofType].Data());
-      histo->GetXaxis()->SetBinLabel(idof+1, thisbinname.Data());
-    }
-  }
-  else {
-    // when there are many structures best is to label them once
-    for (int idof=0; idof<Nbins; idof++) {
-      if (GetPrintLevel()>=10)  std::cout << " <ea>  -- SetHMatrixLabels -- loop on X bins -- dealing with bin: " << idof << std::endl;
-      if (GetStructID(idof) != currentstruct || idof==0 || idof == Nbins-1) {
-	if (idof == 0) firstbin = idof;
-	lastbin = idof;
-	// one has moved to the bins of the following structure
-	// set now the name of the previous structure
-	int inbin = (lastbin+firstbin)/2;
-	if (idof>0) histo->GetXaxis()->SetBinLabel(inbin, thisbinname.Data());
-	if (GetPrintLevel()>=10)  std::cout << " <ea>  -- SetHMatrixLabels -- new structure found! structure = " << GetStructID(idof) << std::endl;
-	currentstruct = GetStructID(idof);
-	firstbin = idof;
-      } 
-      thisbinname.Clear();
-      thisbinname.Append(StructureName[GetStructID(idof)]->Data());
-      if (GetPrintLevel()>=8) {
-	std::cout << " dof " << idof << " belongs to structure " << GetStructID(idof)
-		  << " (" << StructureName[GetStructID(idof)]->Data() <<") " 
-		  << "  label = " <<  thisbinname.Data() << endl;
-      }
-      // in principle the bin name is set to blank
-      histo->GetXaxis()->SetBinLabel(idof+1,"");
-    }
-  }
-
-  currentstruct = -1; // reset the structure
-  // dealing with Y axis bins
-  if (Nbins < 12) {
-    // if there are few bins, one can use the full name for each dof
-    histo->GetYaxis()->SetLabelSize(0.025);
-    for (int idof=Nbins-1; idof>=0; idof--) {
-      ThisDofType = DoFType(idof);
-      thisbinname.Clear();
-      thisbinname.Append(StructureName[GetStructID(idof)]->Data());
-      thisbinname.Append("_");
-      thisbinname.Append(DofName[(int) ThisDofType].Data());
-      histo->GetYaxis()->SetBinLabel(Nbins-idof, thisbinname.Data());
-    }
-  }
-  else {
-    // when there are many structures best is to label them once
-    for (int idof=Nbins-1; idof>=0; idof--) {
-      if (GetPrintLevel()>=10)  std::cout << " <ea>  -- SetHMatrixLabels -- loop on Y bins -- dealing with bin: " << idof << std::endl;
-      if (GetStructID(Nbins-idof) != currentstruct || idof==0 || idof == Nbins-1) {
-	if (idof == Nbins-1) lastbin = idof;
-	firstbin = idof;
-	// one has moved to the bins of the following structure
-	// set now the name of the previous structure
-	int inbin = (lastbin+firstbin)/2+1;
-	if (idof!= Nbins-1) histo->GetYaxis()->SetBinLabel(inbin, thisbinname.Data());
-	if (GetPrintLevel()>=10)  std::cout << " <ea>  -- SetHMatrixLabels -- new structure found! structure = " << GetStructID(Nbins-idof) 
-					    << " (" << StructureName[GetStructID(Nbins-idof)]->Data() <<") " << std::endl;
-	currentstruct = GetStructID(Nbins-idof);
-	lastbin = idof;
-      } 
-      thisbinname.Clear();
-      thisbinname.Append(StructureName[GetStructID(Nbins-idof)]->Data());
-      if (GetPrintLevel()>=10) {
-	std::cout << "       dof " << idof << " belongs to structure " << GetStructID(Nbins-idof)
-		  << " (" << StructureName[GetStructID(Nbins-idof)]->Data() <<") " 
-		  << "  label = " <<  thisbinname.Data() << endl;
-      }
-      // in principle the bin name is set to blank
-      histo->GetYaxis()->SetBinLabel(idof+1,"");
-    }
-  }
-
-
-
-  if (GetPrintLevel()>=8) {
-    std::cout << " <ea> Histogram: '" << histo->GetTitle() << "' has brand new X axis labels. Action completed " << std::endl;
-  }
-}
-
-//////////////////////////////////////////////
-void SetXAxisStructures(TH1F *histo)
-{
-  // Set the Structure names in the X axis labels
-
-  if (GetPrintLevel()>=8) {
-    std::cout << " <ea> Setting labels for histogram: '" << histo->GetTitle() << "' "<< std::endl;
-  }
-
-  Int_t Nbins = histo->GetNbinsX();
-  histo->GetXaxis()->SetLabelSize(0.05);
-
-  for (int i=0; i<Nbins; i++) {
-    histo->GetXaxis()->SetBinLabel(i+1,StructureName[i]->Data());
-  }
-
-  if (GetPrintLevel()>=8) {
-    std::cout << " <ea> Histogram: '" << histo->GetTitle() << "' has brand new X axis labels. Action completed " << std::endl;
-  }
-}
-
-///////////////////////////////////////////////////////////////
-Bool_t IsTranslation(int i)
-{
-  bool istrans = false;
-  if ((int) DoFType(i) == DoFTx) istrans = true;
-  if ((int) DoFType(i) == DoFTy) istrans = true;
-  if ((int) DoFType(i) == DoFTz) istrans = true;
-  return istrans;
-}	
-
-///////////////////////////////////////////////////////////////
-void DetectNullEigenValues()
-{
-  // the goal is to identify Null elenemts in the diagonal and to replace them with very small values
-  for (int i=0; i< BigMatrix.GetNcols(); i++) {
-    if (BigMatrix[i][i] == 0) {
-      std::cout << " ZERO en i= " << i << std::endl;
-      BigMatrix[i][i] = ZeroEquivalent;
-    }
-  }
-
-  return;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/IBLvTemp.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/IBLvTemp.C
deleted file mode 100644
index 22393decd571a426cad2effaabb7c4372040dfab..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/IBLvTemp.C
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// 
-// ROOT macro to draw the IBL vs the temperature
-//
-#include <iostream>
-#include "TCanvas.h"
-#include "TGraphErrors.h"
-#include "TH1F.h"
-
-
-TCanvas *CanSagittavTemp, *CanIBLNHitsvTemp, *CanIBLFHitsvTemp;
-struct RangeOfHist {
-  float UpperValue;
-  float LowerValue;
-};
-
-RangeOfHist getRange(const std::vector<float>&, float gapfactor = 0.05);
-//
-//-------------------------------------------------
-//
-void IBLvTemp()
-{
-  // load values
-  std::vector<float> IBLTemp, IBLSagitta, IBLSagittaError, NIDCosmic, NIBLHits, FractionIBLHits;
-
-  // +20 C modules (+15C set point)
-  IBLTemp.push_back(15);
-  IBLSagitta.push_back(-2.4); IBLSagittaError.push_back(11.1);
-  NIDCosmic.push_back(308881);
-  NIBLHits.push_back(4801);
-
-  //+12 C modules (+7C set point)
-  IBLTemp.push_back(7);
-  IBLSagitta.push_back(45.0); IBLSagittaError.push_back(10.3);
-  NIDCosmic.push_back(255922);
-  NIBLHits.push_back(5506);
-
-  //  0 C
-  IBLTemp.push_back(0);
-  IBLSagitta.push_back(101.9); IBLSagittaError.push_back(10.8);
-  NIDCosmic.push_back(250644);
-  NIBLHits.push_back(5427);
-
-  // -12C
-  IBLTemp.push_back(-10);
-  IBLSagitta.push_back(148.0); IBLSagittaError.push_back(8.9);
-  NIDCosmic.push_back(366804);
-  NIBLHits.push_back(7889);
-
-  // -15C
-  IBLTemp.push_back(-15);
-  IBLSagitta.push_back(208.5); IBLSagittaError.push_back(7.7);
-  NIDCosmic.push_back(457588);
-  NIBLHits.push_back(9187);
-  
-  // -20C
-  IBLTemp.push_back(-20);
-  IBLSagitta.push_back(238.9); IBLSagittaError.push_back(5.6);
-  NIDCosmic.push_back(977508);
-  NIBLHits.push_back(19540);
-  
-  // work out IBL hits per trigger
-  for (int i=0; i< (int) IBLTemp.size(); i++) {
-    FractionIBLHits.push_back(100 * NIBLHits.at(i)/NIDCosmic.at(i));
-  }
-
-  // find the ranges:
-  RangeOfHist myRange = getRange(IBLTemp);
-  float UpperTemp = myRange.UpperValue;
-  float LowerTemp = myRange.LowerValue;
-
-  myRange = getRange(IBLSagitta);
-  float UpperSagitta = myRange.UpperValue;
-  float LowerSagitta = myRange.LowerValue;
-
-  myRange = getRange(NIBLHits);
-  float UpperNHits = myRange.UpperValue;
-  float LowerNHits = myRange.LowerValue;
-
-  myRange = getRange(FractionIBLHits, 1.10);
-  float UpperFHits = myRange.UpperValue;
-  float LowerFHits = 0;
-
-  ///////////////////////////////////////
-  // Create the frames
-  ///////////////////////////////////////
-  TH1F* FrameSagitta = new TH1F("hSagitta","M9 data: IBL stave sagitta vs temperature", 100, LowerTemp, UpperTemp);  
-  FrameSagitta->SetXTitle("Average module temperature [C]");
-  FrameSagitta->SetYTitle("Sagitta [#mum]");
-  FrameSagitta->SetMaximum(UpperSagitta);
-  FrameSagitta->SetMinimum(LowerSagitta);
-  FrameSagitta->SetStats(kFALSE);
-  // fake histogram to be like empty
-  for (int bin=1; bin <= FrameSagitta->GetNbinsX(); bin++){
-    FrameSagitta->SetBinContent(bin, LowerSagitta -1);
-  } 
-
-  TH1F* FrameNhits = new TH1F("hNhits","Collected IBL hits per temperature point", 100, LowerTemp, UpperTemp);  
-  FrameNhits->SetXTitle("Set point temperature [C]");
-  FrameNhits->SetYTitle("Number of hits");
-  FrameNhits->SetMaximum(UpperNHits);
-  FrameNhits->SetMinimum(LowerNHits);
-  FrameNhits->SetStats(kFALSE);
-  // fake histogram to be like empty
-  for (int bin=1; bin <= FrameNhits->GetNbinsX(); bin++){
-    FrameNhits->SetBinContent(bin, LowerNHits -1);
-  } 
-
-  TH1F* FrameFHits = new TH1F("hFHits","Fraction of IBL hits per IDCosmics and temperature point", 100, LowerTemp, UpperTemp);  
-  FrameFHits->SetXTitle("Average module temperature [C]");
-  FrameFHits->SetYTitle("Fraction of IBL hits [%]");
-  FrameFHits->SetMaximum(UpperFHits);
-  FrameFHits->SetMinimum(LowerFHits);
-  FrameFHits->SetStats(kFALSE);
-  // fake histogram to be like empty
-  for (int bin=1; bin <= FrameNhits->GetNbinsX(); bin++){
-    FrameFHits->SetBinContent(bin, LowerNHits -1);
-  } 
-
-  ///////////////////////////////////////
-  // create the TgraphErrors
-  ///////////////////////////////////////
-  TGraphErrors *Graph_IBLSagitta = new TGraphErrors();
-  Graph_IBLSagitta->SetMarkerStyle(20);
-  Graph_IBLSagitta->SetMarkerSize(1.5);
-  Graph_IBLSagitta->SetMarkerColor(kBlue);
-  Graph_IBLSagitta->SetLineColor(Graph_IBLSagitta->GetMarkerColor());
-  Graph_IBLSagitta->SetLineWidth(2);
-  Graph_IBLSagitta->SetTitle(FrameSagitta->GetTitle());
-  for (int i=0; i < (int) IBLTemp.size(); i++) {
-    Graph_IBLSagitta->SetPoint(i, IBLTemp.at(i), IBLSagitta.at(i));
-    Graph_IBLSagitta->SetPointError(i, 0.1, IBLSagittaError.at(i));
-  }
-
-  TGraphErrors* Graph_IBLNhits = new TGraphErrors();
-  Graph_IBLNhits->SetMarkerStyle(20);
-  Graph_IBLNhits->SetMarkerSize(1.5);
-  Graph_IBLNhits->SetMarkerColor(kBlue);
-  Graph_IBLNhits->SetLineColor(Graph_IBLNhits->GetMarkerColor());
-  Graph_IBLNhits->SetLineWidth(2);
-  Graph_IBLNhits->SetTitle(FrameSagitta->GetTitle());
-  for (int i=0; i < (int) IBLTemp.size(); i++) {
-    Graph_IBLNhits->SetPoint(i, IBLTemp.at(i), NIBLHits.at(i));
-  }
-
-  TGraphErrors* Graph_IBLFHits = new TGraphErrors();
-  Graph_IBLFHits->SetMarkerStyle(20);
-  Graph_IBLFHits->SetMarkerSize(1.5);
-  Graph_IBLFHits->SetMarkerColor(kGreen+2);
-  Graph_IBLFHits->SetLineColor(Graph_IBLFHits->GetMarkerColor());
-  Graph_IBLFHits->SetLineWidth(2);
-  Graph_IBLFHits->SetTitle(FrameSagitta->GetTitle());
-  for (int i=0; i < (int) IBLTemp.size(); i++) {
-    Graph_IBLFHits->SetPoint(i, IBLTemp.at(i), FractionIBLHits.at(i));
-  }
-
-  ///////////////////////////////////////
-  // create canvas and draw
-  ///////////////////////////////////////
-  CanSagittavTemp = new TCanvas("cansagitavtemp","IBL sagitta vs temperature",900,600);
-  FrameSagitta->Draw();
-  Graph_IBLSagitta->Draw("LP");
-  gPad->SetGridx(1);
-  gPad->SetGridy(1);
-  Graph_IBLSagitta->Fit("pol1");
-  CanSagittavTemp->Print("IBLSagittaVsTemp.png");
-  Graph_IBLSagitta->Print();
-
-  // create canvas and draw
-  CanIBLNHitsvTemp = new TCanvas("canIBLNhitsvtemp","Collected IBL hits per temperature point",900,600);
-  FrameNhits->Draw();
-  Graph_IBLNhits->Draw("LP");
-  gPad->SetGridx(1);
-  gPad->SetGridy(1);
-  CanIBLNHitsvTemp->Print("IBLNHitsVsTemp.png");
-
-  // fraction of hits
-  CanIBLFHitsvTemp = new TCanvas("canIBLFHitsvtemp","Fraction of IBL hits per IDCosmic and temperature point",900,600);
-  FrameFHits->Draw();
-  Graph_IBLFHits->Draw("LP");
-  gPad->SetGridx(1);
-  gPad->SetGridy(1);
-  CanIBLFHitsvTemp->Print("IBLFHitsVsTemp.png");
-
-  return;
-}
-//
-//-------------------------------------------------
-//
-RangeOfHist getRange(const std::vector<float>& ListOfValues, float gapfactor)
-{
-  RangeOfHist myRange;
-  
-  myRange.LowerValue = ListOfValues.at(0);
-  myRange.UpperValue = ListOfValues.at(0);
-
-  for (int i=1; i< (int) ListOfValues.size(); i++) {
-    if ( ListOfValues.at(i) < myRange.LowerValue) myRange.LowerValue =  ListOfValues.at(i); 
-    if ( ListOfValues.at(i) > myRange.UpperValue) myRange.UpperValue =  ListOfValues.at(i); 
-  }
-
-  float delta = gapfactor * (myRange.UpperValue -  myRange.LowerValue);
-
-  myRange.LowerValue -= delta;
-  myRange.UpperValue += delta;
-
-  std::cout <<  myRange.LowerValue << " -> " << myRange.UpperValue << std::endl;
-  
-  return myRange;
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/MagnitudeEvolution.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/MagnitudeEvolution.h
deleted file mode 100644
index e47ea62042531054bb1c5477a377a9dc05f872c5..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/MagnitudeEvolution.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/////////////////////////// 
-// MagnitudeEvolution
-///////////////////////////
-//
-#ifndef MagnitudeEvolution_H
-#define MagnitudeEvolution_H
-
-//// includes ////
-#include <iostream>
-#include <fstream>
-#include <vector>
-#include <string>
-
-//// ROOT includes ////
-#include "TArrow.h"
-#include "TCanvas.h"
-#include "TColor.h"
-#include "TDatime.h"
-#include "TF1.h"
-#include "TFile.h"
-#include "TGraphErrors.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TH3F.h"
-#include "TLine.h"
-#include "TMultiGraph.h"
-#include "TPad.h"
-#include "TString.h"
-#include "TStyle.h"
-#include "TText.h"
-#include "TSystem.h"
-
-//// ATLAS includes ////
-#include "include/AtlasLabels.C"
-#include "include/AtlasStyle.C"
-#include "include/AtlasUtils.C"
-
-//// parameters ////
-#define NIBLSTAVES 0
-#define MINENTRIES 36
-#define MINENTRIESINBIN 12
-#define MINGOODPOINTS 8
-#define FITTYPE 6
-#define RUNNUMBEREXTRACTIONMODE 0
-#define RMSFACTOR 1.5  // factor used in the residuals Gaussian fit to limit the range (in units of RMS)
-
-const bool FULLOUTPUT= false;
-const bool USEPLANARONLY = true;
-const bool LUMIBLOCKANALYSIS = false;
-const bool ITER3ANALYSIS = true;
-const int  REBINFACTOR = 2; // 100; // LumiBlock rebinning factor for the residuals vs LumiBlock histograms
-const bool WRITETEXTOUTPUT = true;
-const bool REGENERATEAFTERALIGMENTMONITORINGFILE = false;
-
-//const TString me_trackCollection("AlignTracks_all");
-//const TString me_trackCollection("InDetTrackParticles_AlignSel");
-//const TString me_trackCollection("ExtendedTracks_alignSelection");
-const TString me_trackCollection("ExtendedTracks_all");
-TString me_outputFolder;
-TString me_beforeAlignmentHistosFolder;
-TString me_afterAlignmentHistosFolder;
-TString me_HOSTNAME;
-
-const double z_fix = 366.5; // Stave fixing screw position [mm]
-float xmax = 0.3;
-float xmin = -xmax;
-
-const double me_bowingRangeInPlots = 18.; //12.; 30. //in microns
-
-const float me_systUncertaintyBowing = 0.255; // systematic uncertainty on the bowing measurements (in microns)
-
-const int me_colorForIBL = kAzure-1;
-const int me_colorForStaves = kOrange+5;
-
-//// variables ////
-std::ofstream me_outputTextFile;
-std::ofstream me_outputTextFileTimeFormat;
-std::vector<TString> me_iter0MonitoringFileList;
-std::vector<TString> me_iter3MonitoringFileList;
-std::vector<int> me_runNumber;
-std::vector<int> me_iter3runNumber; // as there is one file per LB group, then for each iter3 file, the run number is kept
-std::vector<TDatime> me_runDateTime;
-std::vector<TString> me_listOfDataProjects;
-std::vector<TString> me_listOfDataStreams;
-
-// initial or before alignment (Iter0)
-std::vector<int>   me_bowingMagnitudeStave; // per run, and keep the stave result
-std::vector<float> me_bowingMagnitudeValue;
-std::vector<float> me_bowingMagnitudeError;
-std::vector<float> me_bowingBaseLineValue;
-std::vector<float> me_bowingBaseLineError;
-
-// final or after alignment (Iter3)
-std::vector<float> me_bowingMagnitudeValue_AfterAlignment;
-
-// initial or before alignment (Iter0)
-TFile* me_currentMonitoringFile;
-TH1F*  me_h_IBLmeanResPerRing[NIBLSTAVES+1]; // one per stave plus another one for all
-TH1F*  me_h_bowingMagnitudeEvolution[NIBLSTAVES+1];
-std::vector<TH1F*> me_h_bowingMagnitudePerLB[NIBLSTAVES+1];
-TH2F*  me_h_bowingMagnitudePerStaveAndLB;
-TH1F*  me_h_bowingBaseLineEvolution[NIBLSTAVES+1];
-
-TH1F* me_h_deltaBxPerStave;
-
-std::vector<TH1F*>  me_h_bowingMagnitudePerStave; 
-std::vector<TH1F*>  me_h_bowingBaseLinePerStave; 
-
-// final or after alignment (Iter3)
-TH1F* me_h_bowingMagnitudeEvolution_AfterAlignment[NIBLSTAVES+1];
-
-
-
-//// prototypes ////
-TString       ME_chainAfterAlignmentMonitoringFiles(int);
-void          ME_clear (); 
-void          ME_computeDeltaBx (int);
-void          ME_conditioningStaveSummaryHisto ();
-void          ME_drawEvolInTimeFormat();
-//int           ME_extractRunNumber (int);
-void          ME_finalize ();
-bool          ME_fitBowingMagnitude (TH1F*, int, int, int lumiblockid = -1, TString theSuffix="");
-bool          ME_fitResidualsDistribution (TH1F*, int);
-TH3F*         ME_get3DHistoResidualsVsEtaAndLB (int, int);
-float         ME_getBowingMagFor2015SpecialRuns (int);
-TH1F*         ME_getHistoResidualsVsEtaAtLB (TH3F*, int, int, int, int);
-TH1F*         ME_getIBLMeanResPerRing (TH3F*, int, int);
-TH3F*         ME_getIBLResiduals3DHisto (int); 
-TString       ME_getIter0MonitoringFilesChain (TString, int);
-void          ME_getIter3MonitoringFiles (TString, int);
-int           ME_getLatestTier0ProcessingID(TString, TString);
-void          ME_getMonitoringFileList ();
-TDatime       ME_getRunDateTime (TString);
-void          ME_goodbye ();
-void          ME_init ();
-TString       ME_iter3FolderName (TString, TString, TString, TString, int);
-void          ME_iter3Analysis_PrepareHistos();
-void          ME_loop ();
-void          ME_performLumiBlockAnalysis (int);
-void          ME_performIter3Analysis (int);
-void          ME_plotDeltaBx ();
-void          ME_plotEvolutionHistos ();
-void          ME_plotHistosPerStave ();
-void          ME_prepareBeforeAlignmentHistosFolder ();
-void          ME_prepareAfterAlignmentHistosFolder ();
-void          ME_prepareEvolutionHistos ();
-void          ME_prepareHistosPerStave ();
-void          ME_prepareMagVsLBhisto (TH3F*, int, int);
-void          ME_prepareLoop ();
-void          ME_prepareOutputFolder ();
-void          ME_prepareOutputTextFile ();
-void          ME_preparePalette (float, float);
-void          ME_prepareStaveSummaryHisto (TH3F*, int);
-void          ME_processFile (int);
-bool          ME_runIsGood (int);
-bool          ME_runIsInSpecialTreatment2015RunList (int);
-void          ME_welcomeLogo ();
-void          ME_writeOutputTextFile();
-
-//// imported from BowingFit.cxx by PFButti ////
-TGraphErrors* ConvertHistoInGraph(const TH1F* histo);
-//TGraphErrors* MakeStaveFit(TFile* OutFile,TH1D* histo,string name,string title,string path,int type,bool renormalised)
-bool MakeStaveFit (TGraphErrors*, int);
-
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/ModuleAlignDraw.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/ModuleAlignDraw.C
deleted file mode 100644
index af025ae1d9c3b4c68c36ff5f52b9e5e37ae03804..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/ModuleAlignDraw.C
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//
-// StaveDraw.C
-//
-#include "TCanvas.h"
-#include "TFile.h"
-#include "TGaxis.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TLegend.h"
-#include "TTree.h"
-#include "TPad.h"
-#include "TProfile.h"
-#include "TString.h"
-#include "TStyle.h"
-
-#include "iostream"
-enum {PIX=1, SCT=2, TRT=3};
-#define Ndofs 6
-TString dofName[Ndofs] = {"Tx", "Ty", "Tz", "Rx", "Ry", "Rz"};
-TString unitsName[Ndofs] = {"[mm]", "[mm]", "[mm]", "[mrad]", "[mrad]", "[mrad]"};
-
-float ComputeTz(int detec, int layer, double ring);
-float ComputeEta(int detec, int ring);
-//values
-double tx, ty, tz;
-double rx, ry, rz;
-// errors
-double etx, ety, etz;
-double erx, ery, erz;
-
-
-float UpperRing = 9;
-float LowerRing = -10;
-float NRings = 20;
-
-void ModuleAlignDraw(char nname[80]=NULL,Int_t DetType= 1, Int_t Layer= 0, float UserRange =-1)
-{
-  int Sectors=0;
-  float MaxT = -1;
-  int PrintLevel = 3;
-  gStyle->SetCanvasColor(kWhite);  
-  gStyle->SetPadColor(kWhite);
-  gStyle->SetFrameFillColor(kWhite);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetPadRightMargin(0.15);
-
-
-  char tname[80];
-  enum {TX=0, TY=1, TZ=2, RX=3, RY=4, RZ=5};
-
-  if (PrintLevel>=3) std::cout << " -- ModuleAlignDraw -- opening input file " << nname << std::endl;
-  if (nname == NULL) sprintf(nname,"ComparePositions.root");
-
-  TFile* f0 = new TFile(nname);
-  if (PrintLevel>=3) std::cout << " -- ModuleAlignDraw -- input file opened " << nname << std::endl;
-
-  Float_t TransMax = 0.30;
-  if (MaxT>0) TransMax = MaxT;
-  Float_t TransMin = -TransMax;
-
- 
-  Float_t TransScaleFactor = 1.;
-  Float_t RotScaleFactor = 0.1;
-
-  Float_t RotMax = TransMax/RotScaleFactor;
-  Float_t RotMin = -RotMax;
-
-  // sort out the detector type
-  if (DetType<=0) {std::cout << " -- StaveDraw -- unknown detector type: " << DetType << std::endl; return;}
-
-  // sort out the layer
-  if (Layer<0) Layer = 0;
-  if (DetType == PIX && Layer>3) Layer = 3;
-  if (DetType == SCT && Layer>3) Layer = 3;
- 
-  // sort out the stave for pixels
-  if (Sectors<0) Sectors = 0;
-  if (DetType == PIX && Layer==0) Sectors = 13; // IBL
-  if (DetType == PIX && Layer==1) Sectors = 21;
-  if (DetType == PIX && Layer==2) Sectors = 37;
-  if (DetType == PIX && Layer==3) Sectors = 51;
-  if (DetType == PIX && Layer==0) {
-    UpperRing = 9;
-    LowerRing = -10;
-    NRings = 20;
-  }
-  if (DetType == PIX && Layer>0) {
-    UpperRing = 6;
-    LowerRing = -6;
-    NRings = 13;
-  }
-
-  // sort out the stave for the SCT
-  if (DetType == SCT && Layer==0) Sectors = 31;
-  if (DetType == SCT && Layer==1) Sectors = 39;
-  if (DetType == SCT && Layer==2) Sectors = 47;
-  if (DetType == SCT && Layer==3) Sectors = 51;
-
-  if (DetType == SCT) {
-    UpperRing = 5;
-    LowerRing = -6;
-    NRings = 12;
-  }
-
-  // TRT 
-  if (DetType == TRT) {
-    // as there is only one ring, the 3 layers are drawn in the same histogram
-    Sectors = 32;
-  }
-
-  TString hName, hTitle;
-  TString AxisTitle;
-
-  TH2F* hAlignCorrectionsMap[Ndofs];
-  TProfile* hAlignCorrStaveProfile[Ndofs];
-  // now let's create the alignment corrections maps:
-  for (int dof=0; dof < Ndofs; dof++) {
-    hName.Clear();
-    hName.Append("hAlignCorrMap");
-    hName.Append(dofName[dof].Data());
-    hTitle.Clear();
-    if (DetType == PIX && Layer==0) hTitle.Append("IBL ");
-    if (DetType == PIX && Layer >0) hTitle.Append("PIX Layer ");
-    if (DetType == SCT) hTitle.Append("SCT Layer ");
-    if (DetType == TRT) hTitle.Append("TRT Barrel ");
-    if (!(DetType == PIX && Layer==0)) hTitle += Layer;
-    hTitle.Append(": ");
-    hTitle.Append(dofName[dof].Data());
-    hTitle.Append(" corrections");
-
-    if (DetType == PIX | DetType == SCT) 
-      hAlignCorrectionsMap[dof] = new TH2F (hName.Data(), hTitle.Data(), NRings, LowerRing-0.5, UpperRing+0.5, Sectors, -0.5, Sectors-0.5);
-    if (DetType == TRT) 
-      hAlignCorrectionsMap[dof] = new TH2F (hName.Data(), hTitle.Data(), Sectors, -0.5, Sectors-0.5, 3, -0.5, 2.5); // sectors and layers
-
-    hAlignCorrectionsMap[dof]->SetStats(false);
-    hAlignCorrectionsMap[dof]->SetXTitle("#eta ring");
-    hAlignCorrectionsMap[dof]->SetYTitle("#phi sector");
-    if (DetType == SCT) { // set bin labels
-      TString BinName;
-      int thislabel = -6;
-      for (int bin=1; bin<=  hAlignCorrectionsMap[dof]->GetNbinsX(); bin++){
-	BinName.Clear(); 
-	BinName += thislabel++;
-	if (thislabel == 0) thislabel++;
-	hAlignCorrectionsMap[dof]->GetXaxis()->SetBinLabel(bin, BinName.Data());
-      }
-    }
-    if (DetType == TRT) {
-      hAlignCorrectionsMap[dof]->SetXTitle("#phi sector");
-      hAlignCorrectionsMap[dof]->SetYTitle("#layer");
-    }      
-    
-    // create stave profiles
-    hName.Append("_prof");
-    hTitle.Append(" profile");
-    if (DetType == PIX | DetType == SCT) 
-      hAlignCorrStaveProfile[dof] = new TProfile(hName.Data(), hTitle.Data(), NRings, LowerRing-0.5, UpperRing+0.5);
-    if (DetType == TRT) 
-      hAlignCorrStaveProfile[dof] = new TProfile (hName.Data(), hTitle.Data(), Sectors, -0.5, Sectors-0.5); // sectors and layers
-    hAlignCorrStaveProfile[dof]->SetMarkerStyle(20);
-    hAlignCorrStaveProfile[dof]->SetStats(false);
-    hAlignCorrStaveProfile[dof]->SetXTitle("#eta ring");
-    AxisTitle.Clear();
-    AxisTitle += dofName[dof];
-    AxisTitle += " ";
-    AxisTitle += unitsName[dof];
-    hAlignCorrStaveProfile[dof]->SetYTitle(AxisTitle.Data());
-  }
-
-  TTree* Corrections = (TTree *) f0->Get("Corrections"); 
-  double AlignCorrValues[6];
-  double AlignCorrErrors[6];
-  int type, bec, layer, sector, ring;
-  Corrections->SetBranchAddress("type",  &type); 
-  Corrections->SetBranchAddress("bec",   &bec); 
-  Corrections->SetBranchAddress("layer", &layer); 
-  Corrections->SetBranchAddress("sector",&sector); 
-  Corrections->SetBranchAddress("ring",  &ring); 
-  Corrections->SetBranchAddress("tx",    &AlignCorrValues[0]);
-  Corrections->SetBranchAddress("ty",    &AlignCorrValues[1]);
-  Corrections->SetBranchAddress("tz",    &AlignCorrValues[2]);
-  Corrections->SetBranchAddress("rx",    &AlignCorrValues[3]);
-  Corrections->SetBranchAddress("ry",    &AlignCorrValues[4]);
-  Corrections->SetBranchAddress("rz",    &AlignCorrValues[5]);
-  Corrections->SetBranchAddress("etx",   &AlignCorrErrors[0]);
-  Corrections->SetBranchAddress("ety",   &AlignCorrErrors[1]);
-  Corrections->SetBranchAddress("etz",   &AlignCorrErrors[2]);
-  Corrections->SetBranchAddress("erx",   &AlignCorrErrors[3]);
-  Corrections->SetBranchAddress("ery",   &AlignCorrErrors[4]);
-  Corrections->SetBranchAddress("erz",   &AlignCorrErrors[5]);
-
-  int NAlignedStruct = Corrections->GetEntries();
-  if (PrintLevel >= 3) std::cout << " -- ModuleAlingDraw -- Number of aligned structures: " << NAlignedStruct << std::endl;
-
-  for (int i=0; i < NAlignedStruct; i++) {
-    Corrections->GetEntry(i);
-    if (PrintLevel >= 5) std::cout << " -- ModuleAlingDraw -- looping on all structures: structure: " << i 
-				   <<  "  detector: " << type 
-				   <<  "  bec: " << bec 
-				   <<  "  layer: " << layer 
-				   << std::endl;
-    if (type == DetType) { // is this entry for the detector we are asking ?
-      if ( bec == 0) { // this is in the barrel 
-	if (DetType == PIX | DetType == SCT) { // PIX and SCT are filled in one way, while TRT in another
-	  if (layer == Layer) { // is for the same layer ?
-	    float LogicEtaRing = ComputeEta(DetType, ring);
-	    for (int dof = 0; dof < Ndofs; dof++) { // loop on all dofs
-	      hAlignCorrectionsMap[dof]->Fill(LogicEtaRing, sector, AlignCorrValues[dof]);
-	      // to set the error... it's a bit tricky
-	      int thebin = hAlignCorrectionsMap[dof]->FindBin(LogicEtaRing, sector);
-	      hAlignCorrectionsMap[dof]->SetBinError(thebin,AlignCorrErrors[dof]); 
-
-	      if (PrintLevel >= 5) std::cout << "    -- ModuleAlingDraw -- " << dofName[dof].Data() << " = " << AlignCorrValues[dof]
-					     << " thebin: " << thebin 
-					     << " Error: " << AlignCorrErrors[dof]
-					     << std::endl;
-	      // fill the profile
-	      hAlignCorrStaveProfile[dof]->Fill(LogicEtaRing, AlignCorrValues[dof]); 
-	    }
-	  }
-	} // PIX and SCT
-	if (DetType == TRT) { // filling TRT
-	  for (int dof = 0; dof < Ndofs; dof++) { // loop on all dofs
-	    hAlignCorrectionsMap[dof]->Fill(sector, layer, AlignCorrValues[dof]);
-	  }
-	}
-      }
-    }
-  } 
-
-  // Now histograms are filled. First thing, make sure range is symmetric
-  // and set the Z axis title
-  for (int dof = 0; dof < Ndofs; dof++) { // loop on all dofs
-    // axis title
-    AxisTitle.Clear();
-    AxisTitle += dofName[dof];
-    if (dof < 3) AxisTitle.Append(" [mm]");
-    if (dof >=3) AxisTitle.Append(" [mrad]");
-    hAlignCorrectionsMap[dof]->GetZaxis()->SetTitle(AxisTitle.Data()); 
-    // range
-    float maxValue = hAlignCorrectionsMap[dof]->GetMaximum();
-    float minValue = hAlignCorrectionsMap[dof]->GetMinimum();
-
-    if (fabs(maxValue)>fabs(minValue)) { maxValue = fabs(maxValue); minValue = -maxValue;}
-    if (fabs(minValue)>fabs(maxValue)) { maxValue = fabs(minValue); minValue = -maxValue;}
-
-    if (UserRange>0) {
-      maxValue=  UserRange;
-      minValue= -UserRange;
-    }
-
-    // check gap
-    if (maxValue-minValue < 0.001) { maxValue = 0.001; minValue = -maxValue;}
-    hAlignCorrectionsMap[dof]->SetMaximum(maxValue);
-    hAlignCorrectionsMap[dof]->SetMinimum(minValue);
-  }
-
-  std::cout << " -- ModuleAlignDraw -- Drawing alignment corrections maps for type " << DetType << " layer: " << Layer << std::endl; 
-  // Now let's print all the histograms and save it in a file
-  TCanvas* cAlignCorrectionsMap[Ndofs];
-
-  for (int dof=0; dof < Ndofs; dof++) {
-    hName.Clear();
-    hName.Append("cAlignCorrMap_");
-    hName.Append(dofName[dof].Data());
-
-    cAlignCorrectionsMap[dof] = new TCanvas (hName.Data(), hAlignCorrectionsMap[dof]->GetTitle(), 900, 650);
-    hAlignCorrectionsMap[dof]->Draw("colz");
-
-    // output file:
-    hTitle.Clear();
-    if (DetType == PIX && Layer==0) hTitle.Append("IBL_");
-    if (DetType == PIX && Layer >0) hTitle.Append("PIX_Layer_");
-    if (DetType == SCT) hTitle.Append("SCT_Layer_");
-    if (!(DetType == PIX && Layer==0)) hTitle += Layer;
-    if (DetType == TRT) {
-      hTitle.Clear();
-      hTitle.Append("TRT_Barrel_");
-    }
-    hTitle.Append(dofName[dof].Data());
-    hTitle.Append("_map.png");
-    
-    cAlignCorrectionsMap[dof]->Print(hTitle.Data());
-  }
-
-  // test compute Tz and eta of the center of each IBL module
-  std::vector<float> ringID, ringEta;
-  for (int ring = -10; ring <=9; ring++) {
-    float thisZ =  ComputeTz(PIX, 0, (double) ring);
-    float thistheta = atan(33.45/thisZ); if (thistheta <0) thistheta += M_PI;
-    float thiseta = -log(tan(thistheta/2));
-    std::cout << " ring :" << ring << "  thisZ = " << thisZ << "  theta " << thistheta << "  eta " << thiseta << std::endl;
-    ringID.push_back((float)ring);
-    ringEta.push_back((float)thiseta);
-  }
-  
-  //
-  // draw the profiles 
-  //
-  TCanvas* cAlignCorrectionsProf[Ndofs];
-  for (int dof=0; dof < Ndofs; dof++) {
-    hName.Clear();
-    hName.Append("cAlignCorrProf_");
-    hName.Append(dofName[dof].Data());
-
-    cAlignCorrectionsProf[dof] = new TCanvas (hName.Data(), hAlignCorrectionsMap[dof]->GetTitle(), 900, 650);
-    hAlignCorrStaveProfile[dof]->Draw();
-
-    hTitle.Clear();
-    if (DetType == PIX && Layer==0) hTitle.Append("IBL_");
-    if (DetType == PIX && Layer >0) hTitle.Append("PIX_Layer_");
-    if (DetType == SCT) hTitle.Append("SCT_Layer_");
-    if (!(DetType == PIX && Layer==0)) hTitle += Layer;
-    if (DetType == TRT) {
-      hTitle.Clear();
-      hTitle.Append("TRT_Barrel_");
-    }
-    hTitle.Append(dofName[dof].Data());
-    hTitle.Append("_prof.png");
-    
-
-    cAlignCorrectionsProf[dof]->Print(hTitle.Data());    
-    
-  }
-
-
-
-  return;
-
-}
-/////////////////////////////////////////////////////
-float ComputeTz(int detec, int Layer, double ring)
-{
-  bool debug = false;
-  if (debug) std::cout << " -- ComputeTz -- for ring " << ring << " -- START -- " << std::endl; 
-  float zpos = ring*20;
-  if (detec == PIX) { 
-    if (Layer == 0) { // IBL modules 
-      // loop on ring till the desired one:
-      zpos = -330; // far left edge
-      float gap = 40; // 40 mm is the length of a planar module, 20 of a 3D one
-      for (int i=-10; i <= ring; i++) {
-	gap = 40; // refresh
-	if ((-10 <= i) && (i <= -7)) gap = 20; // 3D modules 
-	if ((6  <= i) && (i <=  9)) gap = 20; // 3D modules 
-	zpos += gap;
-	if (debug) std::cout << " ring " << i << " gap = " << gap << "  new zpos: " << zpos << std::endl;
-      }
-    }
-    if (Layer > 0) { // Pixel modules 
-      // loop on ring till the desired one:
-      zpos = -441; // far left edge
-      float gap = 63; // 63 mm is the length of a pixel module
-      for (int i=-6; i <= ring; i++) {
-	zpos += gap;
-	if (debug) std::cout << " ring " << i << " gap = " << gap << "  new zpos: " << zpos << std::endl;
-      }
-    }
-  }
-  if (debug) std::cout << " -- ComputeTz -- ring: " << ring << "  Tz= " << zpos << std::endl;
- 
-  return zpos;
-}
-/////////////////////////////////////////////////////
-float ComputeEta(int detec, int ring)
-{
-  // for pixel an dIBL, nothing to do:
-  if (detec == PIX) return ring;
-
-  // for SCT: negaive ring -> fine
-  if (detec == SCT && ring < 0) return ring;
-
-  // for SCT: positive ring -> subtract 1
-  if (detec == SCT && ring > 0) return ring-1;
-
-  return 0;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/Monitor.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/Monitor.cc
deleted file mode 100644
index 7fe578535f46e69239fabe7839a70858430fe820..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/Monitor.cc
+++ /dev/null
@@ -1,944 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-///////////////////////////////////////////////////
-#include <include/Monitor.h>
-#include <include/style.cc>
-#include <macros/residuals.cc>
-#include <macros/hits.cc>
-#include <macros/hitCorrelations.cc>
-#include <macros/hitsPerLayer.cc>
-#include <macros/pixelHitmap.cc>
-#include <macros/sctBarrelHitmap.cc>
-#include <macros/sctECHitmap.cc>
-#include <macros/pixelResiduals.cc>
-#include <macros/sct_trt_Residuals.cc>
-#include <macros/pixelBarrelRes.cc>
-#include <macros/pixelBarrelResVsPt.cc>
-#include <macros/pixelECRes.cc>
-#include <macros/pixelECResVsPt.cc>
-#include <macros/sctBarrelRes.cc>
-#include <macros/sctBarrelResVsPt.cc>
-#include <macros/sctECRes.cc>
-#include <macros/sctECResVsPt.cc>
-#include <macros/pixelResmaps.cc>
-#include <macros/sctBarrelResmaps.cc>
-#include <macros/sctECResmaps.cc>
-#include <macros/trkParameters.cc>
-#include <macros/trkMomentum.cc>
-#include <macros/errD0.cc>
-#include <macros/errD0vsPhi.cc>
-#include <macros/errPt.cc>
-#include <macros/errPhi0.cc>
-#include <macros/errCotTheta.cc>
-#include <macros/errZ0.cc>
-#include <macros/CosmicSegments.cc>
-#include <macros/SymmetricYaxis.cc>
-//=====================================================================
-//
-//  monitor
-//
-//=====================================================================
-
-void Monitor(TString inputFileName, TString inputFirstTrackCollection, TString inputSecondTrackCollection) {
-    
-    gROOT->SetBatch(kTRUE);
-    AtlasStyle = false;
-    normalizePlots = false;
-    showFits = true;
-    PrintLevel = 3;
-    
-    FileName = inputFileName;
-    FirstTrackCollection = inputFirstTrackCollection;
-    SecondTrackCollection = inputSecondTrackCollection;
-    CosmicSegmentsCollection = ""; //"Tracks_NoTriggerSelection";
-    
-    cout << "File selected: " << FileName << endl;
-    cout << "Track collection 1: " << FirstTrackCollection << endl;
-    if (SecondTrackCollection != "") cout << "Track collection 2: " << SecondTrackCollection << endl;
-    if (CosmicSegmentsCollection != "") 	cout << " Cosmic Segments collection " << CosmicSegmentsCollection.Data() << endl;
-    
-    
-    if (!OpenFile()) return;
-    setStyle();
-    cout << " <Monitor> calling fillSummary() " << endl;
-    fillSummary();
-    cout << " <Monitor> calling drawPlots() " << endl;
-    drawPlots();
-    cout << " <Monitor> calling printPS() " << endl;
-    printPS();
-    
-    return;
-}
-
-///////////////////////////////////////////////////////////////////
-bool OpenFile(){
-    cout << "Opening file" << endl;
-    file = new TFile(FileName);
-    TDirectory *IDAlignMonDir = file->GetDirectory("IDAlignMon");
-    TString tmpName;
-    tmpName = "IDAlignMon/"+FirstTrackCollection;
-    TDirectory *FirstTrkSelDir = file->GetDirectory(tmpName);
-    tmpName = "IDAlignMon/"+SecondTrackCollection;
-    TDirectory *SecondTrkSelDir = file->GetDirectory(tmpName);
-    
-    if (IDAlignMonDir==NULL) {
-        cout << "Error opening file!!" << endl;
-        return false;
-    }
-    if  (FirstTrkSelDir==NULL) {
-        cout << "Error opening track collection " <<  FirstTrackCollection << endl;
-        return false;
-    }
-    if  (SecondTrkSelDir==NULL) {
-        cout << "Error opening track collection " <<  SecondTrackCollection << endl;
-        return false;
-    }
-    cout << "File opened successfully." << endl;
-    return true;
-}
-
-///////////////////////////////////////////////////////////////////
-void drawPlots(){
-    bool printprogressreport = true;
-    
-    if (PrintLevel>0) printprogressreport = true;
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling:  residuals(" << FirstTrackCollection << "); " << endl;
-    residuals(FirstTrackCollection);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling:  hits(" << FirstTrackCollection
-        << ", " << SecondTrackCollection << "); " << endl;
-    hits(FirstTrackCollection, SecondTrackCollection);
-    
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling:  hitCorrelations(" << FirstTrackCollection
-        << ", " << SecondTrackCollection << "); " << endl;
-    hitCorrelations(FirstTrackCollection,SecondTrackCollection);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelHitMaps(" << FirstTrackCollection <<") " << endl;
-    cPIXHitMap1 = new TCanvas("cPIXHitMap1","Pixel Hitmaps 1",CanvasSizeX6[0],CanvasSizeX6[1]);
-    pixelHitmaps(FirstTrackCollection,cPIXHitMap1,"");
-    
-    if (SecondTrackCollection != "") {
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelHitMaps(" << SecondTrackCollection <<")  " << endl;
-        cPIXHitMap2 = new TCanvas("cPIXHitMap2","Pixel Hitmaps 2",CanvasSizeX6[0],CanvasSizeX6[1]);
-        pixelHitmaps(SecondTrackCollection,cPIXHitMap2,"");
-    }
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelHitMap(" << FirstTrackCollection <<") " << endl;
-    cSCTHitMapBa1 = new TCanvas("cSCTHitMapBa1","SCT Barrel Hitmaps 1",CanvasSizeX6[0],CanvasSizeX6[1]);
-    sctBarrelHitmap(FirstTrackCollection,cSCTHitMapBa1,"");
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelHitMap(" << SecondTrackCollection <<") " << endl;
-        cSCTHitMapBa2 = new TCanvas("cSCTHitMapBa2","SCT Barrel Hitmaps 2",CanvasSizeX6[0],CanvasSizeX6[1]);
-        sctBarrelHitmap(SecondTrackCollection,cSCTHitMapBa2,"");
-    }
-        
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctHitMapEC(" << FirstTrackCollection <<") " << endl;
-    cSCTHitMapEC1[0] = new TCanvas("cSCTHitMapECA_1","SCT Hitmaps ECA 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                   CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECHitmap(FirstTrackCollection,0,cSCTHitMapEC1[0]);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctHitMapEC(" << FirstTrackCollection <<") " << endl;
-    cSCTHitMapEC1[1] = new TCanvas("cSCTHitMapECC_1","SCT Hitmaps ECC 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                   CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECHitmap(FirstTrackCollection,1,cSCTHitMapEC1[1]);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctHitMapEC(" << SecondTrackCollection <<") " << endl;
-        cSCTHitMapEC2[0] = new TCanvas("cSCTHitMapECA_2","SCT Hitmaps ECA 2",CanvasSizeX9[0],CanvasSizeX9[1],
-                                   CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECHitmap(SecondTrackCollection,0,cSCTHitMapEC2[0]);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctHitMapEC(" << SecondTrackCollection <<") " << endl;
-        cSCTHitMapEC2[1] = new TCanvas("cSCTHitMapECC_2","SCT Hitmaps ECC 2",CanvasSizeX9[0],CanvasSizeX9[1],
-                                   CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECHitmap(SecondTrackCollection,1,cSCTHitMapEC2[1]);
-    }
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: hitsPerLayer(" << FirstTrackCollection << ", " << SecondTrackCollection <<") " << endl;
-    hitsPerLayer(FirstTrackCollection,SecondTrackCollection);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResiduals(" << FirstTrackCollection << ") " << endl;
-    cPixRes_1 = new TCanvas("PixResiduals_1","Pixel Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-    pixelResiduals(FirstTrackCollection, cPixRes_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResiduals(" << SecondTrackCollection << ") " << endl;
-        cPixRes_2 = new TCanvas("PixResiduals_2","Pixel Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-        pixelResiduals(SecondTrackCollection, cPixRes_2);
-    }
-    
-    // cPixRes_3 = new TCanvas("PixResiduals_3","Pixel Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-    // pixelResiduals(FirstTrackCollection, cPixRes_3, SecondTrackCollection);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sct_trt_Residuals(" << FirstTrackCollection << ") " << endl;
-    cSctTRTRes_1 = new TCanvas("cSctTRTRes_1","SCT & TRT Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-    sct_trt_Residuals(FirstTrackCollection, cSctTRTRes_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResiduals(" << SecondTrackCollection << ") " << endl;
-        cSctTRTRes_2 = new TCanvas("cSctTRTRes_2","SCT & TRT Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-        sct_trt_Residuals(SecondTrackCollection, cSctTRTRes_2);
-    }
-    
-    // cSctTRTRes_3 = new TCanvas("cSctTRTRes_3","SCT & TRT Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-    // sct_trt_Residuals(FirstTrackCollection, cSctTRTRes_3, SecondTrackCollection);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelBarrelResiduals(" << FirstTrackCollection << ") " << endl;
-    cPIXBarrelRes_1 = new TCanvas("cPIXBarrelRes_1","Pixel Barrel Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-    pixelBarrelResiduals(FirstTrackCollection, cPIXBarrelRes_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelBarrelResiduals(" << SecondTrackCollection << ") " << endl;
-        cPIXBarrelRes_2 = new TCanvas("cPIXBarrelRes_2","Pixel Barrel Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-        pixelBarrelResiduals(SecondTrackCollection, cPIXBarrelRes_2);
-    }
-    
-    // cPIXBarrelRes_3 = new TCanvas("cPIXBarrelRes_3","Pixel Barrel Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-    // pixelBarrelResiduals(FirstTrackCollection, cPIXBarrelRes_3, SecondTrackCollection);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelBarrelResidualsVsPt(" << FirstTrackCollection << ") " << endl;
-    cPIXBarrelResVsPt_1 = new TCanvas("cPIXBarrelResVsPt_1","Pixel Barrel Residuals vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-    pixelBarrelResidualsVsPt(FirstTrackCollection, cPIXBarrelResVsPt_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelBarrelResidualsVsPt(" << SecondTrackCollection << ") " << endl;
-        cPIXBarrelResVsPt_2 = new TCanvas("cPIXBarrelResVsPt_2","Pixel Barrel Residuals vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-        pixelBarrelResidualsVsPt(SecondTrackCollection, cPIXBarrelResVsPt_2);
-    }
-    
-    // cPIXBarrelResVsPt_3 = new TCanvas("cPIXBarrelResVsPt_3","Pixel Barrel Residuals vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-    // pixelBarrelResidualsVsPt(FirstTrackCollection, cPIXBarrelResVsPt_3, SecondTrackCollection);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelECResiduals(" << FirstTrackCollection << ") " << endl;
-    cPIXECARes_1 = new TCanvas("cPIXECARes_1","Pixel Endcap A Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-    pixelECResiduals(FirstTrackCollection, 0, cPIXECARes_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelECResiduals(" << SecondTrackCollection << ") " << endl;
-        cPIXECARes_2 = new TCanvas("cPIXECARes_2","Pixel Endcap A Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-        pixelECResiduals(SecondTrackCollection, 0, cPIXECARes_2);
-    }
-    
-    // cPIXECARes_3 = new TCanvas("cPIXECARes_3","Pixel Endcap A Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-    // pixelECResiduals(FirstTrackCollection, 0, cPIXECARes_3, SecondTrackCollection);
-    
-    if (false) {
-        cPIXECCRes_1 = new TCanvas("cPIXECCRes_1","Pixel Endcap C Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-        pixelECResiduals(FirstTrackCollection, 1, cPIXECCRes_1);
-        if (SecondTrackCollection !=""){
-            cPIXECCRes_2 = new TCanvas("cPIXECCRes_2","Pixel Endcap C Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-            pixelECResiduals(SecondTrackCollection, 1, cPIXECCRes_2);
-        }
-        if (SecondTrackCollection !=""){
-            cPIXECCRes_3 = new TCanvas("cPIXECCRes_3","Pixel Endcap C Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-            pixelECResiduals(FirstTrackCollection, 1, cPIXECCRes_3, SecondTrackCollection);
-        }
-        if (SecondTrackCollection !=""){
-        cPIXECAResVsPt_1 = new TCanvas("cPIXECAResVsPt_1","Pixel Endcap A Residuals Vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-        pixelECResidualsVsPt(FirstTrackCollection, 0, cPIXECAResVsPt_1);
-        }
-        if (SecondTrackCollection !=""){
-            cPIXECAResVsPt_2 = new TCanvas("cPIXECAResVsPt_2","Pixel Endcap A Residuals Vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-            pixelECResidualsVsPt(SecondTrackCollection, 0, cPIXECAResVsPt_2);
-        }
-        if (SecondTrackCollection !=""){
-            cPIXECAResVsPt_3 = new TCanvas("cPIXECAResVsPt_3","Pixel Endcap A Residuals Vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-            pixelECResidualsVsPt(FirstTrackCollection, 0, cPIXECAResVsPt_3, SecondTrackCollection);
-        }
-        cPIXECCResVsPt_1 = new TCanvas("cPIXECCResVsPt_1","Pixel Endcap C Residuals Vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-        pixelECResidualsVsPt(FirstTrackCollection, 1, cPIXECCResVsPt_1);
-        if (SecondTrackCollection !=""){
-            cPIXECCResVsPt_2 = new TCanvas("cPIXECCResVsPt_2","Pixel Endcap C Residuals Vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-            pixelECResidualsVsPt(SecondTrackCollection, 1, cPIXECCResVsPt_2);
-        }
-        if (SecondTrackCollection !=""){
-            cPIXECCResVsPt_3 = new TCanvas("cPIXECCResVsPt_3","Pixel Endcap C Residuals Vs Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-            pixelECResidualsVsPt(FirstTrackCollection, 1, cPIXECCResVsPt_3, SecondTrackCollection);
-        }
-    }
-    
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResiduals(" << FirstTrackCollection << ") " << endl;
-    cSCTBarrelRes_1 = new TCanvas("cSCTBarrelRes_1","SCT Barrel Residuals",CanvasSizeX4[0],CanvasSizeX4[1]);
-    sctBarrelResiduals(FirstTrackCollection, cSCTBarrelRes_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResiduals(" << SecondTrackCollection << ") " << endl;
-        cSCTBarrelRes_2 = new TCanvas("cSCTBarrelRes_2","SCT Barrel Residuals",CanvasSizeX4[0],CanvasSizeX4[1]);
-        sctBarrelResiduals(SecondTrackCollection, cSCTBarrelRes_2);
-    }
-    
-    // cSCTBarrelRes_3 = new TCanvas("cSCTBarrelRes_3","SCT Barrel Residuals",CanvasSizeX4[0],CanvasSizeX4[1]);
-    // sctBarrelResiduals(FirstTrackCollection, cSCTBarrelRes_3, SecondTrackCollection);
-    
-    if (false) {
-        cSCTBarrelResVsPt_1 = new TCanvas("cSCTBarrelResVsPt_1","SCT Barrel Residuals vs Pt",CanvasSizeX4[0],CanvasSizeX4[1]);
-        sctBarrelResidualsVsPt(FirstTrackCollection, cSCTBarrelResVsPt_1);
-        if (SecondTrackCollection !=""){
-            cSCTBarrelResVsPt_2 = new TCanvas("cSCTBarrelResVsPt_2","SCT Barrel Residuals vs Pt",CanvasSizeX4[0],CanvasSizeX4[1]);
-            sctBarrelResidualsVsPt(SecondTrackCollection, cSCTBarrelResVsPt_2);
-        }
-        if (SecondTrackCollection !=""){
-            cSCTBarrelResVsPt_3 = new TCanvas("cSCTBarrelResVsPt_3","SCT Barrel Residuals vs Pt",CanvasSizeX4[0],CanvasSizeX4[1]);
-            sctBarrelResidualsVsPt(FirstTrackCollection, cSCTBarrelResVsPt_3, SecondTrackCollection);
-        }
-        cSCTECARes_1 = new TCanvas("cSCTECARes_1","SCT Endcap A Residuals", CanvasSizeX9[0],CanvasSizeX9[1],
-                                   CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResiduals(FirstTrackCollection, 0, cSCTECARes_1);
-        if (SecondTrackCollection !=""){
-            cSCTECARes_2 = new TCanvas("cSCTECARes_2","SCT Endcap A Residuals", CanvasSizeX9[0],CanvasSizeX9[1],
-                                       CanvasSizeX9[2], CanvasSizeX9[3]);
-            sctECResiduals(SecondTrackCollection, 0, cSCTECARes_2);
-        }
-        if (SecondTrackCollection !=""){
-            cSCTECARes_3 = new TCanvas("cSCTECARes_3","SCT Endcap A Residuals", CanvasSizeX9[0],CanvasSizeX9[1],
-                                       CanvasSizeX9[2], CanvasSizeX9[3]);
-            sctECResiduals(FirstTrackCollection, 0, cSCTECARes_3, SecondTrackCollection);
-        }
-        cSCTECCRes_1 = new TCanvas("cSCTECCRes_1","SCT Endcap C Residuals", CanvasSizeX9[0],CanvasSizeX9[1],
-                                   CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResiduals(FirstTrackCollection, 1, cSCTECCRes_1);
-        if (SecondTrackCollection !=""){
-            cSCTECCRes_2 = new TCanvas("cSCTECCRes_2","SCT Endcap C Residuals", CanvasSizeX9[0],CanvasSizeX9[1],
-                                       CanvasSizeX9[2], CanvasSizeX9[3]);
-            sctECResiduals(SecondTrackCollection, 1, cSCTECCRes_2);
-        }
-        if (SecondTrackCollection !=""){
-            cSCTECCRes_3 = new TCanvas("cSCTECCRes_3","SCT Endcap C Residuals", CanvasSizeX9[0],CanvasSizeX9[1],
-                                       CanvasSizeX9[2], CanvasSizeX9[3]);
-            sctECResiduals(FirstTrackCollection, 1, cSCTECCRes_3, SecondTrackCollection);
-        }
-        cSCTECAResVsPt_1 = new TCanvas("cSCTECAResVsPt_1","SCT Endcap A Residuals Vs Pt", CanvasSizeX9[0],CanvasSizeX9[1],
-                                       CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResidualsVsPt(FirstTrackCollection, 0, cSCTECAResVsPt_1);
-        if (SecondTrackCollection !=""){
-            cSCTECAResVsPt_2 = new TCanvas("cSCTECAResVsPt_2","SCT Endcap A Residuals Vs Pt", CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-            sctECResidualsVsPt(SecondTrackCollection, 0, cSCTECAResVsPt_2);
-        }
-        if (SecondTrackCollection !=""){
-            cSCTECAResVsPt_3 = new TCanvas("cSCTECAResVsPt_3","SCT Endcap A Residuals Vs Pt", CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-            sctECResidualsVsPt(FirstTrackCollection, 0, cSCTECAResVsPt_3, SecondTrackCollection);
-        }
-        cSCTECCResVsPt_1 = new TCanvas("cSCTECCResVsPt_1","SCT Endcap C Residuals Vs Pt", CanvasSizeX9[0],CanvasSizeX9[1],
-                                       CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResidualsVsPt(FirstTrackCollection, 1, cSCTECCResVsPt_1);
-        if (SecondTrackCollection !=""){
-            cSCTECCResVsPt_2 = new TCanvas("cSCTECCResVsPt_2","SCT Endcap C Residuals Vs Pt", CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-            sctECResidualsVsPt(SecondTrackCollection, 1, cSCTECCResVsPt_2);
-        }
-        if (SecondTrackCollection !=""){
-            cSCTECCResVsPt_3 = new TCanvas("cSCTECCResVsPt_3","SCT Endcap C Residuals Vs Pt", CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-            sctECResidualsVsPt(FirstTrackCollection, 1, cSCTECCResVsPt_3, SecondTrackCollection);
-        }
-    }
-    
-    // PIX Residual maps -  First track collection
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResmaps(" << FirstTrackCollection << ") --> local x mean " << endl;
-    cPIXMeanPhiResMap_1 = new TCanvas("cPIXMeanPhiResMap_1","Pixel Mean local x Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                      CanvasSizeX9[2], CanvasSizeX9[3]);
-    pixelResmaps(FirstTrackCollection,cPIXMeanPhiResMap_1,true,false,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResmaps(" << FirstTrackCollection << ") --> local x RMS" << endl;
-    cPIXRMSPhiResMap_1 = new TCanvas("cPIXRMSPhiResMap_1","Pixel RMS local x Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                     CanvasSizeX9[2], CanvasSizeX9[3]);
-    pixelResmaps(FirstTrackCollection,cPIXRMSPhiResMap_1,true,true,25);
-    
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResmaps(" << FirstTrackCollection << ") --> local y mean " << endl;
-    cPIXMeanEtaResMap_1 = new TCanvas("cPIXMeanEtaResMap_1","Pixel Mean local Y Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                      CanvasSizeX9[2], CanvasSizeX9[3]);
-    pixelResmaps(FirstTrackCollection,cPIXMeanEtaResMap_1,false,false,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResmaps(" << FirstTrackCollection << ") --> local y RMS " << endl;
-    cPIXRMSEtaResMap_1 = new TCanvas("cPIXRMSEtaResMap_1","Pixel RMS localy Residual maps 2",CanvasSizeX9[0],CanvasSizeX9[1],
-                                     CanvasSizeX9[2], CanvasSizeX9[3]);
-    pixelResmaps(FirstTrackCollection,cPIXRMSEtaResMap_1,false,true,50);
-    
-    // PIX Residual maps -  Second track collection
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResmaps(" << SecondTrackCollection << ") --> local x mean " << endl;
-        cPIXMeanPhiResMap_2 = new TCanvas("cPIXMeanPhiResMap_2","Pixel Mean Phi Residual maps 2",CanvasSizeX9[0],CanvasSizeX9[1],
-                                      CanvasSizeX9[2], CanvasSizeX9[3]);
-        pixelResmaps(SecondTrackCollection,cPIXMeanPhiResMap_2,true,false,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResmaps(" << SecondTrackCollection << ") --> local x RMS " << endl;
-        cPIXRMSPhiResMap_2 = new TCanvas("cPIXRMSPhiResMap_2","Pixel RMS Phi Residual maps 2",CanvasSizeX9[0],CanvasSizeX9[1],
-                                     CanvasSizeX9[2], CanvasSizeX9[3]);
-        pixelResmaps(SecondTrackCollection,cPIXRMSPhiResMap_2,true,true,25);
-    }
-    
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResmaps(" << SecondTrackCollection << ") --> local y mean " << endl;
-        cPIXMeanEtaResMap_2 = new TCanvas("cPIXMeanEtaResMap_2","Pixel Mean local y Residual maps 2",CanvasSizeX9[0],CanvasSizeX9[1],
-                                      CanvasSizeX9[2], CanvasSizeX9[3]);
-        pixelResmaps(SecondTrackCollection,cPIXMeanEtaResMap_2,false,false,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: pixelResmaps(" << SecondTrackCollection << ") --> local y RMS " << endl;
-        cPIXRMSEtaResMap_2 = new TCanvas("cPIXRMSEtaResMap_2","Pixel RMS localy Residual maps 2",CanvasSizeX9[0],CanvasSizeX9[1],
-                                     CanvasSizeX9[2], CanvasSizeX9[3]);
-        pixelResmaps(SecondTrackCollection,cPIXRMSEtaResMap_2,false,true,50);
-    }
-    
-    
-    
-    // SCT Residual maps -  First track collection
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << FirstTrackCollection << ") --> EndCap C side 0 mean " << endl;
-    cSCTECCMeanSide0ResMap_1 = new TCanvas("cSCTECCMeanSide0ResMap_1","SCT ECC Mean Side0 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECResmaps(FirstTrackCollection,cSCTECCMeanSide0ResMap_1,true,false,false,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << FirstTrackCollection << ") --> EndCap C side 0 RMS " << endl;
-    cSCTECCRMSSide0ResMap_1 = new TCanvas("cSCTECCRMSSide0ResMap_1","SCT ECC RMS Side0 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                          CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECResmaps(FirstTrackCollection,cSCTECCRMSSide0ResMap_1,true,false,true,25);
-    
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << FirstTrackCollection << ") --> EndCap C side 1 mean " << endl;
-    cSCTECCMeanSide1ResMap_1 = new TCanvas("cSCTECCMeanSide1ResMap_1","SCT ECC Mean Side1 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECResmaps(FirstTrackCollection,cSCTECCMeanSide1ResMap_1,true,true,false,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << FirstTrackCollection << ") --> EndCap C side 1 RMS " << endl;
-    cSCTECCRMSSide1ResMap_1 = new TCanvas("cSCTECCRMSSide1ResMap_1","SCT ECC RMS Side1 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                          CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECResmaps(FirstTrackCollection,cSCTECCRMSSide1ResMap_1,true,true,true,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResmaps(" << FirstTrackCollection << ") --> Barrel side 0 mean " << endl;
-    cSCTBaMeanSide0ResMap_1 = new TCanvas("cSCTBaMeanSide0ResMap_1","SCT Barrel Mean Side0 Residual maps 1",CanvasSizeX4[0],CanvasSizeX4[1]);
-    sctBarrelResmaps(FirstTrackCollection,cSCTBaMeanSide0ResMap_1,false,false,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResmaps(" << FirstTrackCollection << ") --> Barrel side 0 RMS " << endl;
-    cSCTBaRMSSide0ResMap_1 = new TCanvas("cSCTBaRMSSide0ResMap_1","SCT Barrel RMS Side0 Residual maps 1",CanvasSizeX4[0],CanvasSizeX4[1]);
-    sctBarrelResmaps(FirstTrackCollection,cSCTBaRMSSide0ResMap_1,false,true,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResmaps(" << FirstTrackCollection << ") --> Barrel side 1 mean " << endl;
-    cSCTBaMeanSide1ResMap_1 = new TCanvas("cSCTBaMeanSide1ResMap_1","SCT Barrel Mean Side1 Residual maps 1",CanvasSizeX4[0],CanvasSizeX4[1]);
-    sctBarrelResmaps(FirstTrackCollection,cSCTBaMeanSide1ResMap_1,true,false,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResmaps(" << FirstTrackCollection << ") --> Barrel side 1 RMS " << endl;
-    cSCTBaRMSSide1ResMap_1 = new TCanvas("cSCTBaRMSSide1ResMap_1","SCT Barrel RMS Side1 Residual maps 1",CanvasSizeX4[0],CanvasSizeX4[1]);
-    sctBarrelResmaps(FirstTrackCollection,cSCTBaRMSSide1ResMap_1,true,true,25);
-    
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << FirstTrackCollection << ") --> EndCap A side 0 mean " << endl;
-    cSCTECAMeanSide0ResMap_1 = new TCanvas("cSCTECAMeanSide0ResMap_1","SCT ECA Mean Side0 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECResmaps(FirstTrackCollection,cSCTECAMeanSide0ResMap_1,false,false,false,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << FirstTrackCollection << ") --> EndCap A side 0 RMS " << endl;
-    cSCTECARMSSide0ResMap_1 = new TCanvas("cSCTECARMSSide0ResMap_1","SCT ECA RMS Side0 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                          CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECResmaps(FirstTrackCollection,cSCTECARMSSide0ResMap_1,false,false,true,25);
-    
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << FirstTrackCollection << ") --> EndCap A side 1 mean " << endl;
-    cSCTECAMeanSide1ResMap_1 = new TCanvas("cSCTECAMeanSide1ResMap_1","SCT ECA Mean Side1 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECResmaps(FirstTrackCollection,cSCTECAMeanSide1ResMap_1,false,true,false,25);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << FirstTrackCollection << ") --> EndCap A side 1 RMS " << endl;
-    cSCTECARMSSide1ResMap_1 = new TCanvas("cSCTECARMSSide1ResMap_1","SCT ECA RMS Side1 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                          CanvasSizeX9[2], CanvasSizeX9[3]);
-    sctECResmaps(FirstTrackCollection,cSCTECARMSSide1ResMap_1,false,true,true,25);
-    
-    
-    // SCT Residual maps -  Second track collection
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << SecondTrackCollection << ") --> EndCap C side 0 mean " << endl;
-        cSCTECCMeanSide0ResMap_2 = new TCanvas("cSCTECCMeanSide0ResMap_2","SCT ECC Mean Side0 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResmaps(SecondTrackCollection,cSCTECCMeanSide0ResMap_2,true,false,false,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << SecondTrackCollection << ") --> EndCap C side 0 RMS " << endl;
-        cSCTECCRMSSide0ResMap_2 = new TCanvas("cSCTECCRMSSide0ResMap_2","SCT ECC RMS Side0 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                          CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResmaps(SecondTrackCollection,cSCTECCRMSSide0ResMap_2,true,false,true,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << SecondTrackCollection << ") --> EndCap C side 1 mean " << endl;
-        cSCTECCMeanSide1ResMap_2 = new TCanvas("cSCTECCMeanSide1ResMap_2","SCT ECC Mean Side1 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResmaps(SecondTrackCollection,cSCTECCMeanSide1ResMap_2,true,true,false,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << SecondTrackCollection << ") --> EndCap C side 1 RMS " << endl;
-        cSCTECCRMSSide1ResMap_2 = new TCanvas("cSCTECCRMSSide1ResMap_2","SCT ECC RMS Side1 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                          CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResmaps(SecondTrackCollection,cSCTECCRMSSide1ResMap_2,true,true,true,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResmaps(" << SecondTrackCollection << ") --> Barrel side 0 mean " << endl;
-        cSCTBaMeanSide0ResMap_2 = new TCanvas("cSCTBaMeanSide0ResMap_2","SCT Barrel Mean Side0 Residual maps 1",CanvasSizeX4[0],CanvasSizeX4[1]);
-        sctBarrelResmaps(SecondTrackCollection,cSCTBaMeanSide0ResMap_2,false,false,25);
-    }
-        
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResmaps(" << SecondTrackCollection << ") --> Barrel side 0 RMS " << endl;
-        cSCTBaRMSSide0ResMap_2 = new TCanvas("cSCTBaRMSSide0ResMap_2","SCT Barrel RMS Side0 Residual maps 1",CanvasSizeX4[0],CanvasSizeX4[1]);
-        sctBarrelResmaps(SecondTrackCollection,cSCTBaRMSSide0ResMap_2,false,true,25);
-    }
-        
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResmaps(" << SecondTrackCollection << ") --> Barrel side 1 mean " << endl;
-        cSCTBaMeanSide1ResMap_2 = new TCanvas("cSCTBaMeanSide1ResMap_2","SCT Barrel Mean Side1 Residual maps 1",CanvasSizeX4[0],CanvasSizeX4[1]);
-        sctBarrelResmaps(SecondTrackCollection,cSCTBaMeanSide1ResMap_2,true,false,25);
-    }
-        
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctBarrelResmaps(" << SecondTrackCollection << ") --> Barrel side 1 RMS " << endl;
-        cSCTBaRMSSide1ResMap_2 = new TCanvas("cSCTBaRMSSide1ResMap_2","SCT Barrel RMS Side1 Residual maps 1",CanvasSizeX4[0],CanvasSizeX4[1]);
-        sctBarrelResmaps(SecondTrackCollection,cSCTBaRMSSide1ResMap_2,true,true,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << SecondTrackCollection << ") --> EndCap A side 0 mean " << endl;
-        cSCTECAMeanSide0ResMap_2 = new TCanvas("cSCTECAMeanSide0ResMap_2","SCT ECA Mean Side0 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResmaps(SecondTrackCollection,cSCTECAMeanSide0ResMap_2,true,false,false,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << SecondTrackCollection << ") --> EndCap A side 0 RMS " << endl;
-        cSCTECARMSSide0ResMap_2 = new TCanvas("cSCTECARMSSide0ResMap_2","SCT ECA RMS Side0 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                          CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResmaps(SecondTrackCollection,cSCTECARMSSide0ResMap_2,false,false,true,25);
-    }
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << SecondTrackCollection << ") --> EndCap A side 1 mean " << endl;
-        cSCTECAMeanSide1ResMap_2 = new TCanvas("cSCTECAMeanSide1ResMap_2","SCT ECA Mean Side1 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                           CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResmaps(SecondTrackCollection,cSCTECAMeanSide1ResMap_2,false,true,false,25);
-    }
-        
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: sctECResmaps(" << SecondTrackCollection << ") --> EndCap A side 1 RMS " << endl;
-        cSCTECARMSSide1ResMap_2 = new TCanvas("cSCTECARMSSide1ResMap_2","SCT ECA RMS Side1 Residual maps 1",CanvasSizeX9[0],CanvasSizeX9[1],
-                                          CanvasSizeX9[2], CanvasSizeX9[3]);
-        sctECResmaps(SecondTrackCollection,cSCTECARMSSide1ResMap_2,false,true,true,25);
-    }
-    
-    //////////////////////////////////
-    // Track parameters
-    //////////////////////////////////
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: trkParameters(" << FirstTrackCollection << ") " << endl;
-    cTrkParameters_1 = new TCanvas("cTrkParameters_1","Track Parameters",CanvasSizeX6[0],CanvasSizeX6[1]);
-    trkParameters(FirstTrackCollection, cTrkParameters_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: trkParameters(" << SecondTrackCollection << ") " << endl;
-        cTrkParameters_2 = new TCanvas("cTrkParameters_2","Track Parameters",CanvasSizeX6[0],CanvasSizeX6[1]);
-        trkParameters(SecondTrackCollection, cTrkParameters_2);
-    }
-    
-    // 	cTrkParameters_3 = new TCanvas("cTrkParameters_3","Track Parameters",CanvasSizeX6[0],CanvasSizeX6[1]);
-    //	trkParameters(FirstTrackCollection, cTrkParameters_3, SecondTrackCollection);
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: trkMomentum(" << FirstTrackCollection << ") " << endl;
-    cTrkMomentum_1 = new TCanvas("cTrkMomentum_1","Track Momentum",CanvasSizeX6[0],CanvasSizeX6[1]);
-    trkMomentum(FirstTrackCollection, cTrkMomentum_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: trkMomentum(" << SecondTrackCollection << ") " << endl;
-        cTrkMomentum_2 = new TCanvas("cTrkMomentum_2","Track Momentum",CanvasSizeX6[0],CanvasSizeX6[1]);
-        trkMomentum(SecondTrackCollection, cTrkMomentum_2);
-    }
-    
-    // cTrkMomentum_3 = new TCanvas("cTrkMomentum_3","Track Momentum",CanvasSizeX6[0],CanvasSizeX6[1]);
-    // trkMomentum(FirstTrackCollection, cTrkMomentum_3, SecondTrackCollection);
-    
-    
-    if (printprogressreport) cout << " <Monitor> <drawPlots> calling: errD0(" << FirstTrackCollection << ") " << endl;
-    cErrD0_1 = new TCanvas("cErrD0_1","Error D0",CanvasSizeX6[0],CanvasSizeX6[1]);
-    errD0(FirstTrackCollection, cErrD0_1);
-    
-    if (SecondTrackCollection !=""){
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: errD0(" << SecondTrackCollection << ") " << endl;
-        cErrD0_2 = new TCanvas("cErrD0_2","Error D0",CanvasSizeX6[0],CanvasSizeX6[1]);
-        errD0(SecondTrackCollection, cErrD0_2);
-    }
-    
-    // cErrD0_3 = new TCanvas("cErrD0_3","Error D0",CanvasSizeX6[0],CanvasSizeX6[1]);
-    // errD0(FirstTrackCollection, cErrD0_3, SecondTrackCollection);
-    
-    if (false) {
-        cErrD0VsPhi0_1 = new TCanvas("cErrD0VsPhi0_1","Error D0 Vs Phi0",CanvasSizeX6[0],CanvasSizeX6[1]);
-        errD0VsPhi0(FirstTrackCollection, cErrD0VsPhi0_1);
-        if (SecondTrackCollection !=""){
-            cErrD0VsPhi0_2 = new TCanvas("cErrD0VsPhi0_2","Error D0 Vs Phi0",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errD0VsPhi0(SecondTrackCollection, cErrD0VsPhi0_2);
-        }
-        if (SecondTrackCollection !=""){
-            cErrD0VsPhi0_3 = new TCanvas("cErrD0VsPhi0_3","Error D0 Vs Phi0",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errD0VsPhi0(FirstTrackCollection, cErrD0VsPhi0_3, SecondTrackCollection);
-        }
-        cErrPt_1 = new TCanvas("cErrPt_1","Error Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-        errPt(FirstTrackCollection, cErrPt_1);
-        if (SecondTrackCollection !=""){
-            cErrPt_2 = new TCanvas("cErrPt_2","Error Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errPt(SecondTrackCollection, cErrPt_2);
-        }
-        if (SecondTrackCollection !=""){
-            cErrPt_3 = new TCanvas("cErrPt_3","Error Pt",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errPt(FirstTrackCollection, cErrPt_3, SecondTrackCollection);
-        }
-        cErrPhi0_1 = new TCanvas("cErrPhi0_1","Error Phi0",CanvasSizeX6[0],CanvasSizeX6[1]);
-        errPhi0(FirstTrackCollection, cErrPhi0_1);
-        if (SecondTrackCollection !=""){
-            cErrPhi0_2 = new TCanvas("cErrPhi0_2","Error Phi0",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errPhi0(SecondTrackCollection, cErrPhi0_2);
-        }
-        if (SecondTrackCollection !=""){
-            cErrPhi0_3 = new TCanvas("cErrPhi0_3","Error Phi0",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errPhi0(FirstTrackCollection, cErrPhi0_3, SecondTrackCollection);
-        }
-        cErrCotTheta_1 = new TCanvas("cErrCotTheta_1","Error Cot Theta",CanvasSizeX6[0],CanvasSizeX6[1]);
-        errCotTheta(FirstTrackCollection, cErrCotTheta_1);
-        if (SecondTrackCollection !=""){
-            cErrCotTheta_2 = new TCanvas("cErrCotTheta_2","Error Cot Theta",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errCotTheta(SecondTrackCollection, cErrCotTheta_2);
-        }
-        if (SecondTrackCollection !=""){
-            cErrCotTheta_3 = new TCanvas("cErrCotTheta_3","Error Cot Theta",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errCotTheta(FirstTrackCollection, cErrCotTheta_3, SecondTrackCollection);
-        }
-        cErrZ0_1 = new TCanvas("cErrZ0_1","Error Z0",CanvasSizeX6[0],CanvasSizeX6[1]);
-        errZ0(FirstTrackCollection, cErrZ0_1);
-        if (SecondTrackCollection !=""){
-            cErrZ0_2 = new TCanvas("cErrZ0_2","Error Z0",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errZ0(SecondTrackCollection, cErrZ0_2);
-        }
-        if (SecondTrackCollection !=""){
-            cErrZ0_3 = new TCanvas("cErrZ0_3","Error Z0",CanvasSizeX6[0],CanvasSizeX6[1]);
-            errZ0(FirstTrackCollection, cErrZ0_3, SecondTrackCollection);
-        }
-    }
-    
-    /////////////
-    // cosmic ray segments
-    if (iCosmics) {
-        if (printprogressreport) cout << " <Monitor> <drawPlots> calling: CosmicSegments(" << FirstTrackCollection << ") " << endl;
-        cCosmicSegments[0] = new TCanvas("cCosmicSegmentsHits","Hits of cosmic rays segments", CanvasSizeX6[0],CanvasSizeX6[1]);
-        cCosmicSegments[1] = new TCanvas("cCosmicSegmentsUpperTrkPar","Cosmic Rays Upper segment: Trk pars", CanvasSizeX6[0],CanvasSizeX6[1]);
-        cCosmicSegments[2] = new TCanvas("cCosmicSegmentsLowerTrkPar","Cosmic Rays Lower segment: Trk pars", CanvasSizeX6[0],CanvasSizeX6[1]);
-        cCosmicSegments[3] = new TCanvas("cCosmicSegmentsDeltaTrkPar","Cosmic Rays segment: delta Trk pars", CanvasSizeX6[0],CanvasSizeX6[1]);
-        cCosmicSegments[4] = new TCanvas("cCosmicSegmentsDeltaTrkParVsPt","Cosmic Rays segment: delta Trk pars vs pt", CanvasSizeX6[0],CanvasSizeX6[1]);
-        //TString segmentcollection = "AlignTracks_NoTriggerSelection";
-        CosmicSegments(CosmicSegmentsCollection, cCosmicSegments);
-    }
-    
-    return;
-}
-
-void fillSummary(){
-    TString tmpName;
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/GenericTracks/ntracks";
-    iEvents = (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    if(PrintLevel>1) cout << "Events: " << iEvents << endl;
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/GenericTracks/Nhits_per_track";
-    iTracks_1 = (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    if(PrintLevel>1) cout << "Tracks 1: " << iTracks_1 << endl;
-    if (SecondTrackCollection != "") {
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/GenericTracks/Nhits_per_track";
-        iTracks_2 = (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        if(PrintLevel>1) cout << "Tracks 2: " << iTracks_2 << endl;
-    }
-    
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/pix_ecc_residualx";
-    iPixelHits_1 =  (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/pix_eca_residualx";
-    iPixelHits_1 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/pix_b_residualx";
-    iPixelHits_1 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    if(PrintLevel>1) cout << "PIX Hits 1: " << iPixelHits_1 << endl;
-    if (SecondTrackCollection != "") {
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/pix_ecc_residualx";
-        iPixelHits_2 =  (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/pix_eca_residualx";
-        iPixelHits_2 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/pix_b_residualx";
-        iPixelHits_2 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        if(PrintLevel>1) cout << "PIX Hits 2: " << iPixelHits_2<< endl;
-    }
-    
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/sct_ecc_residualx";
-    iSCTHits_1 =  (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/sct_eca_residualx";
-    iSCTHits_1 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/sct_b_residualx";
-    iSCTHits_1 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    if(PrintLevel>1) cout << "SCT Hits 1: " << iSCTHits_1 << endl;
-    if (SecondTrackCollection != "") {
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/sct_ecc_residualx";
-        iSCTHits_2 =  (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/sct_eca_residualx";
-        iSCTHits_2 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/sct_b_residualx";
-        iSCTHits_2 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        if(PrintLevel>1) cout << "SCT Hits 2: " << iSCTHits_2 << endl;
-    }
-    
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/trt_ec_residualR_Endcap_A";
-    iTRTHits_1 =  (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/trt_ec_residualR_Endcap_C";
-    iTRTHits_1 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    tmpName = "IDAlignMon/"+FirstTrackCollection+"/Residuals/trt_b_residualR";
-    iTRTHits_1 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-    if(PrintLevel>1) cout << "TRT Hits 1: " << iTRTHits_1 << endl;
-    if (SecondTrackCollection != "") {
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/trt_ec_residualR_Endcap_A";
-        iTRTHits_2 =  (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/trt_ec_residualR_Endcap_C";
-        iTRTHits_2 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        tmpName = "IDAlignMon/"+SecondTrackCollection+"/Residuals/trt_b_residualR";
-        iTRTHits_2 += (int)((TH1F*)file->Get(tmpName))->GetEntries();
-        if(PrintLevel>1) cout << "TRT Hits 2: " << iTRTHits_2 << endl;
-    }
-    iHits_1 = iPixelHits_1 + iSCTHits_1 + iTRTHits_1;
-    iHits_2 = iPixelHits_2 + iSCTHits_2 + iTRTHits_2;
-    
-    
-    if(FileName.Contains("CosmicsBField")){
-        aSetup = "Cosmics BField";
-        iCosmics = true;
-        iBField = 2.0;
-    }
-    else if (FileName.Contains("CosmicsNoBField")) {
-        aSetup = "Cosmics w/0 BField";
-        iCosmics = true;
-        iBField = 0;
-    }
-    else if (FileName.Contains("Collision")){
-        aSetup = "Collisions";
-        iCosmics = false;
-        iBField = 2.0;
-    }
-    else {
-        aSetup = "Unknown";
-        iCosmics = false;
-        iBField = 2.0;
-    }
-    
-    
-    if(PrintLevel>1) cout << "Setup: " << aSetup << endl;
-    iCosmics = true;
-    if(PrintLevel>1) cout << "Cosmics?: " << iCosmics << " --- FORCED --- Salva --- " <<  endl;
-    tmpName = FileName(FileName.Index("Iter")+4);
-    IterNumber = tmpName.Atoi();
-    if(PrintLevel>1) cout << "Iteration: " << IterNumber << endl;
-    
-}
-
-
-///////////////////////////////////////////////////////////////////
-void printPS(){
-    cout << endl << endl << " <Monitor> <printPs> Storing the plots in a ps file..." << endl;
-    TString psname, command;
-    psname = FileName(0,FileName.Length()-12)+"_plots.pdf";
-    psname = "monitor.pdf";
-    TCanvas c0("c0","c0",CanvasSizeX6[0],CanvasSizeX6[1]);
-    command = psname+"[";
-    c0.Print(command);
-    if (cInfoRes)             {cInfoRes->Print(psname); cout << " <printPS> include canvas \"cInfoRes\" " << endl;}
-    if (cHits)                {cHits->Print(psname); cout << " <printPS> include canvas \"cHits\" " << endl;}
-    if (cHitCorr)		  {cHitCorr->Print(psname); cout << " <printPS> include canvas \"cHitCorr\" " << endl;}
-    if (cHitsPerLayer)	  {cHitsPerLayer->Print(psname); cout << " <printPS> include canvas \"cHitsPerLayer\" " << endl;}
-    
-    if (cPIXHitMap)		  {cPIXHitMap->Print(psname); cout << " <printPS> include canvas \"cPIXHitMap\" " << endl;}
-    if (cPIXHitMap1)	  {cPIXHitMap1->Print(psname); cout << " <printPS> include canvas \"cPIXHitMap1\" " << endl;}
-    if (cPIXHitMap2)	  {cPIXHitMap2->Print(psname); cout << " <printPS> include canvas \"cPIXHitMap2\" " << endl;}
-    
-    if (cSCTHitMapEC[1])      {cSCTHitMapEC[1]->Print(psname); cout << " <printPS> include canvas \"cSCTHitMapEC[1]\" " << endl;}
-    if (cSCTHitMapBa)	  {cSCTHitMapBa->Print(psname); cout << " <printPS> include canvas \"cSCTHitMapBA\" " << endl;}
-    if (cSCTHitMapEC[0])      {cSCTHitMapEC[0]->Print(psname); cout << " <printPS> include canvas \"cSCTHitMapEC[0]\" " << endl;}
-    
-    if (cSCTHitMapEC1[1])     cSCTHitMapEC1[1]->Print(psname);
-    if (cSCTHitMapBa1)		  cSCTHitMapBa1->Print(psname);
-    if (cSCTHitMapEC1[0])     cSCTHitMapEC1[0]->Print(psname);
-    
-    if (cSCTHitMapEC2[1])     cSCTHitMapEC2[1]->Print(psname);
-    if (cSCTHitMapBa2)	  cSCTHitMapBa2->Print(psname);
-    if (cSCTHitMapEC2[0])     cSCTHitMapEC2[0]->Print(psname);
-    
-    
-    if (cPixRes)			  cPixRes->Print(psname);
-    if (cPixRes_1)            cPixRes_1->Print(psname);
-    if (cPixRes_2)            cPixRes_2->Print(psname);
-    if (cPixRes_3)            cPixRes_3->Print(psname);
-    
-    if (cSctTRTRes)           cSctTRTRes->Print(psname);
-    if (cSctTRTRes_1)         cSctTRTRes_1->Print(psname);
-    if (cSctTRTRes_2)         cSctTRTRes_2->Print(psname);
-    if (cSctTRTRes_3)         cSctTRTRes_3->Print(psname);
-    
-    if (cPIXBarrelRes)        cPIXBarrelRes->Print(psname);
-    if (cPIXBarrelRes_1)      cPIXBarrelRes_1->Print(psname);
-    if (cPIXBarrelRes_2)      cPIXBarrelRes_2->Print(psname);
-    if (cPIXBarrelRes_3)      cPIXBarrelRes_3->Print(psname);
-    
-    if (cPIXBarrelResVsPt)    cPIXBarrelResVsPt->Print(psname);
-    if (cPIXBarrelResVsPt_1)  cPIXBarrelResVsPt_1->Print(psname);
-    if (cPIXBarrelResVsPt_2)  cPIXBarrelResVsPt_2->Print(psname);
-    if (cPIXBarrelResVsPt_3)  cPIXBarrelResVsPt_3->Print(psname);
-    
-    
-    if (cPIXECRes)   	      cPIXECRes->Print(psname);
-    if (cPIXECResVsPt)   	  cPIXECResVsPt->Print(psname);
-    if (cPIXECCRes_1)         cPIXECCRes_1->Print(psname);
-    if (cPIXECCRes_2)         cPIXECCRes_2->Print(psname);
-    if (cPIXECCRes_3)         cPIXECCRes_3->Print(psname);
-    if (cPIXECCResVsPt_1)     cPIXECCResVsPt_1->Print(psname);
-    if (cPIXECCResVsPt_2)     cPIXECCResVsPt_2->Print(psname);
-    if (cPIXECCResVsPt_3)     cPIXECCResVsPt_3->Print(psname);
-    
-    if (cPIXECARes_1)         cPIXECARes_1->Print(psname);
-    if (cPIXECARes_2)         cPIXECARes_2->Print(psname);
-    if (cPIXECARes_3)         cPIXECARes_3->Print(psname);
-    if (cPIXECAResVsPt_1)     cPIXECAResVsPt_1->Print(psname);
-    if (cPIXECAResVsPt_2)     cPIXECAResVsPt_2->Print(psname);
-    if (cPIXECAResVsPt_3)     cPIXECAResVsPt_3->Print(psname);
-    
-    
-    if (cSCTBarrelRes)        cSCTBarrelRes->Print(psname);
-    if (cSCTBarrelRes_1)      cSCTBarrelRes_1->Print(psname);
-    if (cSCTBarrelRes_2)      cSCTBarrelRes_2->Print(psname);
-    if (cSCTBarrelRes_3)      cSCTBarrelRes_3->Print(psname);
-    
-    if (cSCTBarrelResVsPt)    cSCTBarrelResVsPt->Print(psname);
-    if (cSCTBarrelResVsPt_1)  cSCTBarrelResVsPt_1->Print(psname);
-    if (cSCTBarrelResVsPt_2)  cSCTBarrelResVsPt_2->Print(psname);
-    if (cSCTBarrelResVsPt_3)  cSCTBarrelResVsPt_3->Print(psname);
-    
-    if (cSCTECRes)   	      cSCTECRes->Print(psname);
-    if (cSCTECARes_1)         cSCTECARes_1->Print(psname);
-    if (cSCTECARes_2)         cSCTECARes_2->Print(psname);
-    if (cSCTECARes_3)         cSCTECARes_3->Print(psname);
-    if (cSCTECCRes_1)         cSCTECCRes_1->Print(psname);
-    if (cSCTECCRes_2)         cSCTECCRes_2->Print(psname);
-    if (cSCTECCRes_3)         cSCTECCRes_3->Print(psname);
-    
-    if (cSCTECResVsPt)   	  cSCTECResVsPt->Print(psname);
-    if (cSCTECAResVsPt_1)     cSCTECAResVsPt_1->Print(psname);
-    if (cSCTECAResVsPt_2)     cSCTECAResVsPt_2->Print(psname);
-    if (cSCTECAResVsPt_3)     cSCTECAResVsPt_3->Print(psname);
-    if (cSCTECCResVsPt_1)     cSCTECCResVsPt_1->Print(psname);
-    if (cSCTECCResVsPt_2)     cSCTECCResVsPt_2->Print(psname);
-    if (cSCTECCResVsPt_3)     cSCTECCResVsPt_3->Print(psname);
-    
-    if (cPIXResMap)		  cPIXResMap->Print(psname);
-    if (cPIXMeanPhiResMap_1)  {cPIXMeanPhiResMap_1->Print(psname); cout << " <printPS> include canvas \"cPIXMeanPhiResMap_1\" " << endl;}
-    if (cPIXRMSPhiResMap_1)   {cPIXRMSPhiResMap_1->Print(psname); cout << " <printPS> include canvas \"cPIXRMSPhiResMap_1\" " << endl;}
-    if (cPIXMeanEtaResMap_1)  {cPIXMeanEtaResMap_1->Print(psname); cout << " <printPS> include canvas \"cPIXMeanEtaResMap_1\" " << endl;}
-    if (cPIXRMSEtaResMap_1)   {cPIXRMSEtaResMap_1->Print(psname); cout << " <printPS> include canvas \"cPIXRMSEtaResMap_1\" " << endl;}
-    
-    if (cPIXMeanPhiResMap_2)  {cPIXMeanPhiResMap_2->Print(psname);  cout << " <printPS> include canvas \"cPIXMeanPhiResMap_2\" " << endl;}
-    if (cPIXRMSPhiResMap_2)   {cPIXRMSPhiResMap_2->Print(psname);   cout << " <printPS> include canvas \"cPIXRMSPhiResMap_2\" " << endl;}
-    if (cPIXMeanEtaResMap_2)  {cPIXMeanEtaResMap_2->Print(psname); cout << " <printPS> include canvas \"cPIXMeanEtaResMap_2\" " << endl;}
-    if (cPIXRMSEtaResMap_2)   {cPIXRMSEtaResMap_2->Print(psname); cout << " <printPS> include canvas \"cPIXRMSEtaResMap_2\" " << endl;}
-    
-    
-    if (cSCTBaResMap)	       {cSCTBaResMap->Print(psname); cout << " <printPS> include canvas \"cSCTBarResMap\" " << endl;}
-    if (cSCTResMapEC)  	       {cSCTResMapEC->Print(psname); cout << " <printPS> include canvas \"cSCTResMapEC\" " << endl;}
-    if (cSCTECCMeanSide0ResMap_1)  {cSCTECCMeanSide0ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTECCMeanSide0ResMap_1\" " << endl;}
-    if (cSCTECCRMSSide0ResMap_1)   {cSCTECCRMSSide0ResMap_1->Print(psname);  cout << " <printPS> include canvas \"cSCTECCRMSSide0ResMap_1\" " << endl;}
-    if (cSCTECCMeanSide1ResMap_1)  {cSCTECCMeanSide1ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTECCMeanSide1ResMap_1\" " << endl;}
-    if (cSCTECCRMSSide1ResMap_1)   {cSCTECCRMSSide1ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTECCRMSSid10ResMap_1\" " << endl;}
-    if (cSCTBaMeanSide0ResMap_1)   {cSCTBaMeanSide0ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTBaMeanSide0ResMap_1\" " << endl;}
-    if (cSCTBaRMSSide0ResMap_1)    {cSCTBaRMSSide0ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTBaRMSSide0ResMap_1\" " << endl;}
-    if (cSCTBaMeanSide1ResMap_1)   {cSCTBaMeanSide1ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTBaMeanSide1ResMap_1\" " << endl;}
-    if (cSCTBaRMSSide1ResMap_1)    {cSCTBaRMSSide1ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTBaRMSSide1ResMap_1\" " << endl;}
-    if (cSCTECAMeanSide0ResMap_1)  {cSCTECAMeanSide0ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTECAMeanSide0ResMap_1\" " << endl;}
-    if (cSCTECARMSSide0ResMap_1)   {cSCTECARMSSide0ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTECARMSSide0ResMap_1\" " << endl;}
-    if (cSCTECAMeanSide1ResMap_1)  {cSCTECAMeanSide1ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTECAMeanSide1ResMap_1\" " << endl;}
-    if (cSCTECARMSSide1ResMap_1)   {cSCTECARMSSide1ResMap_1->Print(psname); cout << " <printPS> include canvas \"cSCTECARMSSide1ResMap_1\" " << endl;}
-    
-    if (cSCTECCMeanSide0ResMap_2)  {cSCTECCMeanSide0ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTECCMeanSide0ResMap_2\" " << endl;}
-    if (cSCTECCRMSSide0ResMap_2)   {cSCTECCRMSSide0ResMap_2->Print(psname);  cout << " <printPS> include canvas \"cSCTECCRMSSide0ResMap_2\" " << endl;}
-    if (cSCTECCMeanSide1ResMap_2)  {cSCTECCMeanSide1ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTECCMeanSide1ResMap_2\" " << endl;}
-    if (cSCTECCRMSSide1ResMap_2)   {cSCTECCRMSSide1ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTECCRMSSid10ResMap_2\" " << endl;}
-    if (cSCTBaMeanSide0ResMap_2)   {cSCTBaMeanSide0ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTBaMeanSide0ResMap_2\" " << endl;}
-    if (cSCTBaRMSSide0ResMap_2)    {cSCTBaRMSSide0ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTBaRMSSide0ResMap_2\" " << endl;}
-    if (cSCTBaMeanSide1ResMap_2)   {cSCTBaMeanSide1ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTBaMeanSide1ResMap_2\" " << endl;}
-    if (cSCTBaRMSSide1ResMap_2)    {cSCTBaRMSSide1ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTBaRMSSide1ResMap_2\" " << endl;}
-    if (cSCTECAMeanSide0ResMap_2)  {cSCTECAMeanSide0ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTECAMeanSide0ResMap_2\" " << endl;}
-    if (cSCTECARMSSide0ResMap_2)   {cSCTECARMSSide0ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTECARMSSide0ResMap_2\" " << endl;}
-    if (cSCTECAMeanSide1ResMap_2)  {cSCTECAMeanSide1ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTECAMeanSide1ResMap_2\" " << endl;}
-    if (cSCTECARMSSide1ResMap_2)   {cSCTECARMSSide1ResMap_2->Print(psname); cout << " <printPS> include canvas \"cSCTECARMSSide1ResMap_2\" " << endl;}
-    
-    
-    if (cTrkParameters)       cTrkParameters->Print(psname);
-    if (cTrkParameters_1)     cTrkParameters_1->Print(psname);
-    if (cTrkParameters_2)     cTrkParameters_2->Print(psname);
-    if (cTrkParameters_3)     cTrkParameters_3->Print(psname);
-    
-    if (cTrkMomentum)       cTrkMomentum->Print(psname);
-    if (cTrkMomentum_1)     cTrkMomentum_1->Print(psname);
-    if (cTrkMomentum_2)     cTrkMomentum_2->Print(psname);
-    if (cTrkMomentum_3)     cTrkMomentum_3->Print(psname);
-    
-    if (cErrD0)       cErrD0->Print(psname);
-    if (cErrD0_1)     cErrD0_1->Print(psname);
-    if (cErrD0_2)     cErrD0_2->Print(psname);
-    if (cErrD0_3)     cErrD0_3->Print(psname);
-    
-    if (cErrD0VsPhi0)       cErrD0VsPhi0->Print(psname);
-    if (cErrD0VsPhi0_1)     cErrD0VsPhi0_1->Print(psname);
-    if (cErrD0VsPhi0_2)     cErrD0VsPhi0_2->Print(psname);
-    if (cErrD0VsPhi0_3)     cErrD0VsPhi0_3->Print(psname);
-    
-    if (cErrPt)       cErrPt->Print(psname);
-    if (cErrPt_1)     cErrPt_1->Print(psname);
-    if (cErrPt_2)     cErrPt_2->Print(psname);
-    if (cErrPt_3)     cErrPt_3->Print(psname);
-    
-    if (cErrPhi0)       cErrPhi0->Print(psname);
-    if (cErrPhi0_1)     cErrPhi0_1->Print(psname);
-    if (cErrPhi0_2)     cErrPhi0_2->Print(psname);
-    if (cErrPhi0_3)     cErrPhi0_3->Print(psname);
-    
-    if (cErrCotTheta)       cErrCotTheta->Print(psname);
-    if (cErrCotTheta_1)     cErrCotTheta_1->Print(psname);
-    if (cErrCotTheta_2)     cErrCotTheta_2->Print(psname);
-    if (cErrCotTheta_3)     cErrCotTheta_3->Print(psname);
-    
-    if (cErrZ0)       cErrZ0->Print(psname);
-    if (cErrZ0_1)     cErrZ0_1->Print(psname);
-    if (cErrZ0_2)     cErrZ0_2->Print(psname);
-    if (cErrZ0_3)     cErrZ0_3->Print(psname);
-    
-    if (cCosmicSegments[0]) {cCosmicSegments[0]->Print(psname); cout << " <printPS> include canvas \"cCosmicSegments:Hits\" " << endl;}
-    if (cCosmicSegments[1]) {cCosmicSegments[1]->Print(psname); cout << " <printPS> include canvas \"cCosmicSegments:Upper\" " << endl;}
-    if (cCosmicSegments[2]) {cCosmicSegments[2]->Print(psname); cout << " <printPS> include canvas \"cCosmicSegments:Lower\" " << endl;}
-    if (cCosmicSegments[3]) {cCosmicSegments[3]->Print(psname); cout << " <printPS> include canvas \"cCosmicSegments:Delta\" " << endl;}
-    if (cCosmicSegments[4]) {cCosmicSegments[4]->Print(psname); cout << " <printPS> include canvas \"cCosmicSegments:DeltaVsPt\" " << endl;}
-    
-    command = psname + "]";
-    c0.Print(command);
-    // Compress it!
-    command = ".!gzip -f " + psname;
-    // gROOT->ProcessLine(command);
-    
-    cout << " - Plots stored successfully!" << endl;
-    
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/StaveDraw.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/StaveDraw.C
deleted file mode 100644
index 9c672b6f837aeedfeb54d557ea69b04b29786fbf..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/StaveDraw.C
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//
-// StaveDraw.C
-//
-#include "TCanvas.h"
-#include "TFile.h"
-#include "TGaxis.h"
-#include "TGraphErrors.h"
-#include "TH1F.h"
-#include "TLegend.h"
-#include "TTree.h"
-#include "TString.h"
-#include "TStyle.h"
-
-#include "iostream"
-enum {PIX=1, SCT=2};
-
-float ComputeTz(int detec, int layer, double ring);
-
-void StaveDraw(TString nname,Int_t DetType= 1, Int_t layer= 0, Int_t sector= 0, float MaxT=-1)
-{
-  int PrintLevel = 3;
-  gStyle->SetCanvasColor(kWhite);  
-  gStyle->SetPadColor(kWhite);
-  gStyle->SetFrameFillColor(kWhite);
-  gStyle->SetFrameBorderMode(0);
-
-  int rings = 0; //  number of rings
-
-
-  char tname[80];
-  enum {TX=0, TY=1, TZ=2, RX=3, RY=4, RZ=5};
-
-  if (PrintLevel>=3) std::cout << " -- StaveDraw -- opening input file " << nname << std::endl;
-  //sprintf(nname,"ComparePositions.root");
-
-  TFile* f0 = new TFile(nname.Data());
-  if (PrintLevel>=3) std::cout << " -- StaveDraw -- input file opened " << nname << std::endl;
-
-  Float_t TransMax = 0.30;
-  if (MaxT>0) TransMax = MaxT;
-  Float_t TransMin = -TransMax;
-
- 
-  Float_t TransScaleFactor = 1.;
-  Float_t RotScaleFactor = 0.1;
-
-  Float_t RotMax = TransMax/RotScaleFactor;
-  Float_t RotMin = -RotMax;
-
-  // sort out the detector type
-  if (DetType<=0) {std::cout << " -- StaveDraw -- unknown detector type: " << DetType << std::endl; return;}
-
-  // sort out the layer
-  if (layer<0) layer = 0;
-  if (DetType == PIX && layer>3) layer = 3;
-  if (DetType == SCT && layer>3) layer = 3;
- 
-  // sort out the stave for pixels
-  if (sector<0) sector = 0;
-  if (DetType == PIX && layer==0 && sector>13) sector = 13; // IBL
-  if (DetType == PIX && layer==1 && sector>21) sector = 21;
-  if (DetType == PIX && layer==2 && sector>37) sector = 37;
-  if (DetType == PIX && layer==3 && sector>51) sector = 51;
-  
-  // sort out the stave for the SCT
-  if (DetType == SCT && layer==0 && sector>31) sector = 31;
-  if (DetType == SCT && layer==1 && sector>39) sector = 39;
-  if (DetType == SCT && layer==2 && sector>47) sector = 47;
-  if (DetType == SCT && layer==3 && sector>51) sector = 51;
-
-  if (DetType == PIX && layer ==0) rings = 20;
-  if (DetType == PIX && layer > 0) rings = 13;
-  if (DetType == SCT) rings = 12;
-
-  // colorins
-  Int_t RzColor = kAzure-1;
-  Int_t TxColor = kRed+1;
-  Int_t TyColor = kRed-2;
-  Int_t TzColor = kRed-1;
-
-  std::cout << " -- StaveDraw -- Drawing modules type " << DetType 
-	    << " in layer " << layer 
-	    << " and sector " << sector  
-	    << std::endl;
-
-  // 
-  TString OutputName;
-  if (DetType == PIX && layer==0) OutputName.Append("IBL");
-  if (DetType == PIX && layer >0) OutputName.Append("PIX_Layer_");
-  if (DetType == SCT) OutputName.Append("SCT_Layer_");
-
-  if (!(DetType == PIX && layer==0)) OutputName += layer;
-
-  OutputName.Append("_Stave_");
-  OutputName += sector;
-
-  OutputName.Append(".png");
-  if (PrintLevel>=3) std::cout << " -- StaveDraw -- output file name:" <<OutputName.Data() << std::endl;
-  //
-
-  // 
-  TH1F* hAliCorr;
-  TTree* Corrections = (TTree *) f0->Get("Corrections"); 
-  TCanvas *cAliCorr = new TCanvas ("cAliCorr","Alignment corrections per stave", 1);
-  
-  if (DetType == PIX && layer == 0 ) { // IBL 
-    sprintf(tname,"IBL corrections stave %d", sector);
-    hAliCorr = new TH1F ("hAliCorr",tname,13,-340,340);
-  } 
-  if (DetType == PIX && layer >0 ) { // pixel 
-    sprintf(tname,"PIX corrections layer %d stave %d",layer, sector);
-    hAliCorr = new TH1F ("hAliCorr",tname,13,-440,440);
-  } 
-  if (DetType == SCT) {
-    sprintf(tname,"SCT corrections layer %d sector %d",layer, sector);
-    hAliCorr = new TH1F ("hAliCorr",tname,12,-800,800);
-    // change the range
-    TransMax = 0.30;
-    TransMin = -TransMax;
-  }
-  hAliCorr->SetStats(0);
-  hAliCorr->GetYaxis()->SetLabelColor(TxColor);
-  hAliCorr->GetYaxis()->SetTitleColor(TxColor);
-  hAliCorr->GetYaxis()->SetAxisColor(TxColor);
-  hAliCorr->GetYaxis()->SetRangeUser(TransMin,TransMax);
-  hAliCorr->SetXTitle("Global Z (mm)");
-  hAliCorr->SetYTitle("Local Translations (mm)");
-
-  hAliCorr->Draw();
-
-  //
-  TGaxis *axis = new TGaxis(hAliCorr->GetXaxis()->GetXmax(), TransMin,
-			    hAliCorr->GetXaxis()->GetXmax(), TransMax,
-			    RotMin, RotMax,510,"+L");
-  
-  axis->SetTitle("Local rotations (mrad)");
-  axis->SetLabelSize(hAliCorr->GetYaxis()->GetLabelSize());
-  axis->SetTitleFont(hAliCorr->GetYaxis()->GetTitleFont());
-  axis->SetTitleSize(hAliCorr->GetYaxis()->GetTitleSize());
-  axis->SetTitleColor(RzColor);
-  axis->SetLineColor(RzColor);
-  axis->SetLabelColor(RzColor);
-  axis->Draw();
-
-  char SelectionName[80];
-  char VariablesName[80];
-  sprintf(SelectionName,"type==%d && bec==0 && layer==%d && sector==%d",DetType, layer, sector);
-  Bool_t doPlot = true;
-
-  // legend
-  TLegend *Rotllo = new TLegend(0.30, 0.75, 0.41, 0.87);
-  Rotllo->SetFillStyle(1001);
-  Rotllo->SetFillColor(10);
-  char LegendText[80];
-
-  // Points with errors
-  TGraphErrors* dofcor[6];
-
-
-  for (Int_t idof=0; idof<6; idof++){
-    if (idof == TX) {
-      sprintf(VariablesName,"%f*tx:ComputeTz(%d,%d,ring):etx",TransScaleFactor,DetType,layer);
-      doPlot = false;
-      Corrections->SetMarkerColor(TxColor);
-      Corrections->SetMarkerStyle(20);
-      sprintf(LegendText,"Tx");
-    }
-    if (idof == TY) {
-      sprintf(VariablesName,"%f*ty:ComputeTz(%d,%d,ring):ety",TransScaleFactor,DetType,layer);
-      doPlot = false;
-      Corrections->SetMarkerColor(TyColor);
-      Corrections->SetMarkerStyle(28);
-      sprintf(LegendText,"Ty");
-    }
-    if (idof == TZ) {
-      sprintf(VariablesName,"%f*tz:ComputeTz(%d,%d,ring):etz",TransScaleFactor,DetType,layer);
-      doPlot = true;
-      Corrections->SetMarkerColor(TzColor);
-      Corrections->SetMarkerStyle(26);
-      sprintf(LegendText,"Tz");
-    }
-    if (idof == RX) {
-      sprintf(VariablesName,"%f*rx:ring",RotScaleFactor);
-      doPlot = false;
-      Corrections->SetMarkerColor(TzColor);
-      sprintf(LegendText,"Rx");
-    }
-    if (idof == RY) {
-      sprintf(VariablesName,"%f*ry:ComputeTz(%d,%d,ring)",RotScaleFactor,DetType,layer);
-      doPlot = false;
-      Corrections->SetMarkerStyle(kOpenCircle);
-      Corrections->SetMarkerColor(RzColor);
-      sprintf(LegendText,"Ry");
-    }
-    if (idof == RZ) {
-      sprintf(VariablesName,"%f*rz:ComputeTz(%d,%d,ring):erz/10",RotScaleFactor,DetType,layer);
-      doPlot = false;
-      Corrections->SetMarkerColor(RzColor);
-      Corrections->SetMarkerStyle(20);
-      sprintf(LegendText,"Rz (E/10)");
-    }
-    //
-    if (doPlot) {
-      Corrections->Draw(VariablesName,SelectionName,"goff");
-      Rotllo->AddEntry(Corrections->Clone(),LegendText,"p");
-      //static TGraphErrors dofcor(rings,Corrections->GetV2(),Corrections->GetV1(),0,Corrections->GetV3());
-      dofcor[idof] = new TGraphErrors(rings,Corrections->GetV2(),Corrections->GetV1(),0,Corrections->GetV3());
-      if (true) {
-	dofcor[idof]->SetMarkerStyle(Corrections->GetMarkerStyle());
-	dofcor[idof]->SetMarkerColor(Corrections->GetMarkerColor());
-	dofcor[idof]->SetLineColor(Corrections->GetMarkerColor());
-	dofcor[idof]->Draw("p same");
-	dofcor[idof]->Print();
-      }
-    }
-  }
-
-  Rotllo->Draw();    
-  gPad->SetGridy(1);
-  cAliCorr->Print(OutputName.Data());
-}
-
-float ComputeTz(int detec, int layer, double ring)
-{
-  bool debug = false;
-  if (debug) std::cout << " -- ComputeTz -- for ring " << ring << " -- START -- " << std::endl; 
-  float zpos = ring*20;
-  if (detec == PIX) { 
-    if (layer == 0) { // IBL modules 
-      // loop on ring till the desired one:
-      zpos = -330; // far left edge
-      float gap = 40; // 40 mm is the length of a planar module, 20 of a 3D one
-      for (int i=-10; i <= ring; i++) {
-	gap = 40; // refresh
-	if ((-10 <= i) && (i <= -7)) gap = 20; // 3D modules 
-	if ((6  <= i) && (i <=  9)) gap = 20; // 3D modules 
-	zpos += gap;
-	if (debug) std::cout << " ring " << i << " gap = " << gap << "  new zpos: " << zpos << std::endl;
-      }
-    }
-    if (layer > 0) { // Pixel modules 
-      // loop on ring till the desired one:
-      zpos = -441; // far left edge
-      float gap = 63; // 63 mm is the length of a pixel module
-      for (int i=-6; i <= ring; i++) {
-	zpos += gap;
-	if (debug) std::cout << " ring " << i << " gap = " << gap << "  new zpos: " << zpos << std::endl;
-      }
-    }
-  }
-  if (debug) std::cout << " -- ComputeTz -- ring: " << ring << "  Tz= " << zpos << std::endl;
- 
-  return zpos;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/drawEvolution.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/drawEvolution.py
deleted file mode 100755
index 9c332e9e8842368e7d54c574a4172fd0c521f2df..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/drawEvolution.py
+++ /dev/null
@@ -1,224 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-psname = "ConstantsEvolution.pdf"
-
-def drawCorr(detector, labelList, drawErrors=False, drawLine=True, drawingDOF=-1):
-    debug = False
-    NullCanvas = initPsFile()
-    Canvases = []
-    Histos = []
-
-    if (debug): print " -- drawCorr -- calling d_utils.drawAllCorr(",detector,")"
-    tmpCan = d_utils.drawAllCorr(detector)
-    Canvases.append(tmpCan)
-
-    tmpCan, tmpGraph = d_utils.drawCorrVsHits(detector)
-    Canvases.append(tmpCan)
-    Histos.append(tmpGraph)
-
-    if (True): print " -- drawCorr -- calling d_utils.drawCorrEvolution for drawingDOF=",drawingDOF
-    d_utils.drawCorrEvolution(detector, labelList, drawErrors, drawLine, drawingDOF, 2 ) # add dof number -->plot only that dof
-    #tmpCan = d_utils.OLD_drawCorrEvolution(detector, labelList, drawErrors, drawLine, drawingDOF ) # add dof number -->plot only that dof
-    Canvases.append(tmpCan)
-
-    if len(detector[0].ReturnPixelBarrelModules())>0:
-        tmpCan, tmpGraph = d_utils.drawPixBarrelCorrDistributions(detector)
-        Canvases.append(tmpCan)
-        Histos.append(tmpGraph)
-        
-    if len(detector[0].ReturnSctBarrelModules()):
-        tmpCan, tmpGraph = d_utils.drawSctBarrelCorrDistributions(detector)
-        Canvases.append(tmpCan)
-        Histos.append(tmpGraph)
-        
-#   
-#   if level == 3:
-#       #Canvases.append(drawStaves(detector))
-#       tmpCan, tmpGraph = drawL3CorrVsHits(detector,1,None)
-#       Canvases.append(tmpCan)
-#       Histos.append(tmpGraph)
-#       #tmpCan, tmpGraph = drawL3CorrVsHits(detector,1,0)
-#       #Canvases.append(tmpCan)
-#       #Histos.append(tmpGraph)
-#       #if detector[0].HasEndcaps():
-#       #   tmpCan, tmpGraph = drawL3CorrVsHits(detector,1,-1)
-#       #   Canvases.append(tmpCan)
-#       #   Histos.append(tmpGraph)
-#       #   tmpCan, tmpGraph = drawL3CorrVsHits(detector,1,1)
-#       #   Canvases.append(tmpCan)
-#       #   Histos.append(tmpGraph)
-#   
-#       #tmpCan, tmpGraph = drawL3CorrVsHits(detector,2,None)
-#       #Canvases.append(tmpCan)
-#       #Histos.append(tmpGraph)
-#       tmpCan, tmpGraph = drawL3CorrVsHits(detector,2,0)
-#       Canvases.append(tmpCan)
-#       Histos.append(tmpGraph)
-#       #if detector[0].HasEndcaps():
-#   
-#   if level == 3:
-#       #Canvases.append(drawStaves(detector))
-#       tmpCan, tmpGraph = drawL3CorrVsHits(detector,1,None)
-#       Canvases.append(tmpCan)
-#       Histos.append(tmpGraph)
-#       #tmpCan, tmpGraph = drawL3CorrVsHits(detector,1,0)
-#       #Canvases.append(tmpCan)
-#       #Histos.append(tmpGraph)
-#       #if detector[0].HasEndcaps():
-#       #   tmpCan, tmpGraph = drawL3CorrVsHits(detector,1,-1)
-#       #   Canvases.append(tmpCan)
-#       #   Histos.append(tmpGraph)
-#       #   tmpCan, tmpGraph = drawL3CorrVsHits(detector,1,1)
-#       #   Canvases.append(tmpCan)
-#       #   Histos.append(tmpGraph)
-#   
-#       #tmpCan, tmpGraph = drawL3CorrVsHits(detector,2,None)
-#       #Canvases.append(tmpCan)
-#       #Histos.append(tmpGraph)
-#       tmpCan, tmpGraph = drawL3CorrVsHits(detector,2,0)
-#       Canvases.append(tmpCan)
-#       Histos.append(tmpGraph)
-#       #if detector[0].HasEndcaps():
-#       #   tmpCan, tmpGraph = drawL3CorrVsHits(detector,2,-1)
-#       #   Canvases.append(tmpCan)
-#       #   Histos.append(tmpGraph)
-#       #   tmpCan, tmpGraph = drawL3CorrVsHits(detector,2,1)
-#       #   Canvases.append(tmpCan)
-#       #   Histos.append(tmpGraph)
-    
-    for canvas in Canvases:
-        canvas.Print(psname)
-
-
-    closePsFile(NullCanvas)
-    
-    return Canvases, Histos
-    
-def initPsFile():
-    NullCanvas = TCanvas()
-    NullCanvas.Print(psname+"[")
-    return NullCanvas
-    
-def closePsFile(NullCanvas):
-    NullCanvas.Print(psname+"]")    
-    
-def wait():
-    rep = ''
-    while not rep in [ 'q', 'Q' ]:
-        rep = raw_input( 'enter "q" to quit: ' )
-        if 1 < len(rep):
-            rep = rep[0]
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-    print " == optparsing == start == "
-    from optparse import OptionParser
-    parser = OptionParser()
-    #parser.add_option("--TrackSegments", dest="inputTrackSegments", help="Do track segment matching plots", action="store_true",default=False)
-    parser.add_option("--inputFiles", dest="inputLogFiles", help="In the case you want to use a specific set of initial constants write here the absolute path to the alignlogfile", default="")
-    parser.add_option("--fileLabels", dest="inputFileLabels", help="Label to be given to each file. Defaults are: Iter0, Iter1, ...", default="")
-    parser.add_option("--drawErrors", dest="inputDrawErrors", help="Constants evolution plot without errors", action="store_true", default=False)
-    parser.add_option("--dof", dest="inputDof", help="User may select a given dof (0=Tx, 1=Ty, 2=Tz, 3=Rx, 4=Ry, 5=Rz, 6=Bx. -1 = from Tx to Rz (no Bx)", default=-1)
-    parser.add_option("--SaveData", dest="inputSaveData", help="Define which of the input files is saved in the ntuple and txt file. Default the accumulative one", default = -1)
-    parser.add_option("--noLine", dest="inputDrawLine", help="Draw a line conecting the points of the same structure", action="store_false", default=True)
-    parser.add_option("--noEndCaps", dest="inputUseEndCaps", help="remove the end caps from the plots", action="store_false", default=True)
-    parser.add_option("--noBarrels", dest="inputUseBarrels", help="remove the barrel parts from the plots", action="store_false", default=True)
-    
-    (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-    print " == optparsing == completed == "
-    return config
-
-##########################################################
-#             Main code                                  #
-##########################################################
-
-if __name__ == '__main__':
-    import sys
-    
-    print " == drawEvolution == start == "
-    config = optParsing()
-
-    import os   
-    import imp
-    from ROOT import *
-    gROOT.SetBatch()
-
-    fileList = config.inputLogFiles
-    fileListGiven = True
-    if (len(fileList)>0): 
-        #print " == drawEvolution == fileList == ",fileList, " len= ", len(fileList)
-        fileList = fileList.split()
-        # print " == drawEvolution == filelist == ",fileList
-    else:
-        # print " == drawEvolution == NO fileList == "
-        fileListGiven = False
-
-    labelList = config.inputFileLabels
-    labelsListGiven = True
-    if (len(labelList)>0): 
-        #print " == drawEvolution == labelList == ",labelList, " len= ", len(labelList)
-        labelList = labelList.split()
-        #print " == drawEvolution == LabelList == ",labelList
-    else:
-        #print " == drawEvolution == NO labelList == "
-        labelsListGiven = False
-
-    userSaveData = int(config.inputSaveData)
-    userDOF = int(config.inputDof)
-    
-    global TestUseBarrel
-    TestUseBarrel = config.inputUseBarrels
-
-    ###############################    
-    #import file and draw utilities    
-    #
-    f_utils = imp.load_source('readConstants', 'include/fileutils.py')
-    d_utils = imp.load_source('rootSetup', 'include/drawutils.py')
-    d_utils.rootSetup() 
-    #s_utils = imp.load_source('', 'include/settings.py')
-    
-    if (len(sys.argv)==1 and not fileListGiven):
-        detector = {}
-        detector[0] = f_utils.readConstants("alignlogfile.txt")             
-    else:
-        if (not fileListGiven): 
-            print " -- old method --" 
-            fileList = sys.argv[1:]
-        #print " fileList = ",fileList 
-        detector = {}
-        i = 0
-        for file in fileList:
-            if (labelsListGiven):                
-                print " == drawEvolution == file:", i, " --> ", file, "[",labelList[i],"]"
-            else:
-                print " == drawEvolution == file:", i, " --> ", file
-
-            detector[i] = f_utils.readConstants(file, config.inputUseBarrels, config.inputUseEndCaps)
-            i = i+1
-
-    #
-    gStyle.SetTitleYOffset(2.4)
-    # create a final detector set for storing the accumulated values
-    inewdet = len(detector)
-    detector[inewdet] = detector[inewdet-1]
-    if (userSaveData < 0): userSaveData = inewdet 
-    if (True): print " == drawEvolution == new detector[",inewdet,"] created for the accumulation"
-
-    C,H = drawCorr(detector, labelList, config.inputDrawErrors, config.inputDrawLine, userDOF)
-
-    if (True): print " == drawEvolution == saving detector[",userSaveData,"]"
-    f_utils.writeCorr("alignment.txt",detector[userSaveData])
-    f_utils.saveConstants(detector[userSaveData],"output.root")
-    
-    wait()
-    print " == drawEvolution == completed == "
-
-
-
-    
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasLabels.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasLabels.C
deleted file mode 100644
index 039363354bd01d0c980ae4ca8a45feaefadcb183..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasLabels.C
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "AtlasLabels.h"
-
-#include "TLatex.h"
-#include "TLine.h"
-#include "TPave.h"
-#include "TPad.h"
-#include "TMarker.h"
-
-
-void ATLASLabel(Double_t x,Double_t y,const char* text,Color_t color) 
-{
-  TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.SetTextFont(72);
-  l.SetTextColor(color);
-
-  double delx = 0.115*696*gPad->GetWh()/(472*gPad->GetWw());
-
-  l.DrawLatex(x,y,"ATLAS");
-  if (text) {
-    TLatex p; 
-    p.SetNDC();
-    p.SetTextFont(42);
-    p.SetTextColor(color);
-    p.DrawLatex(x+delx,y,text);
-    //    p.DrawLatex(x,y,"#sqrt{s}=900GeV");
-  }
-}
-
-
-void ATLASLabelOld(Double_t x,Double_t y,bool Preliminary,Color_t color) 
-{
-  TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.SetTextFont(72);
-  l.SetTextColor(color);
-  l.DrawLatex(x,y,"ATLAS");
-  if (Preliminary) {
-    TLatex p; 
-    p.SetNDC();
-    p.SetTextFont(42);
-    p.SetTextColor(color);
-    p.DrawLatex(x+0.115,y,"Preliminary");
-  }
-}
-
-
-
-void ATLASVersion(const char* version,Double_t x,Double_t y,Color_t color) 
-{
-
-  if (version) {
-    char versionString[100];
-    sprintf(versionString,"Version %s",version);
-    TLatex l;
-    l.SetTextAlign(22); 
-    l.SetTextSize(0.04); 
-    l.SetNDC();
-    l.SetTextFont(72);
-    l.SetTextColor(color);
-    l.DrawLatex(x,y,versionString);
-  }
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasLabels.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasLabels.h
deleted file mode 100644
index 255658d633005d433869f47d6699e8f4117ba2bd..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasLabels.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//
-//   @file    AtlasLabels.h         
-//   
-//   @author M.Sutton
-// 
-//
-//   $Id: AtlasLabels.h, v0.0   Thu 25 Mar 2010 10:34:20 CET $
-
-
-#ifndef __ATLASLABELS_H
-#define __ATLASLABELS_H
-
-#include "Rtypes.h"
-
-void ATLASLabel(Double_t x,Double_t y,const char* text=NULL,Color_t color=1); 
-
-void ATLASLabelOld(Double_t x,Double_t y,bool Preliminary=false,Color_t color=1); 
-
-void ATLASVersion(const char* version=NULL,Double_t x=0.88,Double_t y=0.975,Color_t color=1); 
-
-#endif // __ATLASLABELS_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasStyle.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasStyle.C
deleted file mode 100644
index 7d4f3e2d7da6e025f6c944b1eb4fd70860a2e464..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasStyle.C
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//
-// ATLAS Style, based on a style file from BaBar
-//
-
-#include <iostream>
-
-#include "AtlasStyle.h"
-
-#include "TROOT.h"
-
-void SetAtlasStyle ()
-{
-  static TStyle* atlasStyle = 0;
-  std::cout << "\nApplying ATLAS style settings...\n" << std::endl ;
-  if ( atlasStyle==0 ) atlasStyle = AtlasStyle();
-  gROOT->SetStyle("ATLAS");
-  gROOT->ForceStyle();
-}
-
-TStyle* AtlasStyle() 
-{
-  TStyle *atlasStyle = new TStyle("ATLAS","Atlas style");
-
-  // use plain black on white colors
-  Int_t icol=0; // WHITE
-  atlasStyle->SetFrameBorderMode(icol);
-  atlasStyle->SetFrameFillColor(icol);
-  atlasStyle->SetCanvasBorderMode(icol);
-  atlasStyle->SetCanvasColor(icol);
-  atlasStyle->SetPadBorderMode(icol);
-  atlasStyle->SetPadColor(icol);
-  atlasStyle->SetStatColor(icol);
-  //atlasStyle->SetFillColor(icol); // don't use: white fill color for *all* objects
-
-  // set the paper & margin sizes
-  atlasStyle->SetPaperSize(20,26);
-
-  // set margin sizes
-  atlasStyle->SetPadTopMargin(0.05);
-  atlasStyle->SetPadRightMargin(0.05);
-  atlasStyle->SetPadBottomMargin(0.16);
-  atlasStyle->SetPadLeftMargin(0.16);
-
-  // set title offsets (for axis label)
-  atlasStyle->SetTitleXOffset(1.4);
-  atlasStyle->SetTitleYOffset(1.4);
-
-  // use large fonts
-  //Int_t font=72; // Helvetica italics
-  Int_t font=42; // Helvetica
-  Double_t tsize=0.05;
-  atlasStyle->SetTextFont(font);
-
-  atlasStyle->SetTextSize(tsize);
-  atlasStyle->SetLabelFont(font,"x");
-  atlasStyle->SetTitleFont(font,"x");
-  atlasStyle->SetLabelFont(font,"y");
-  atlasStyle->SetTitleFont(font,"y");
-  atlasStyle->SetLabelFont(font,"z");
-  atlasStyle->SetTitleFont(font,"z");
-  
-  atlasStyle->SetLabelSize(tsize,"x");
-  atlasStyle->SetTitleSize(tsize,"x");
-  atlasStyle->SetLabelSize(tsize,"y");
-  atlasStyle->SetTitleSize(tsize,"y");
-  atlasStyle->SetLabelSize(tsize,"z");
-  atlasStyle->SetTitleSize(tsize,"z");
-
-  // use bold lines and markers
-  atlasStyle->SetMarkerStyle(20);
-  atlasStyle->SetMarkerSize(1.2);
-  atlasStyle->SetHistLineWidth(2.);
-  atlasStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
-
-  // get rid of X error bars 
-  //atlasStyle->SetErrorX(0.001);
-  // get rid of error bar caps
-  atlasStyle->SetEndErrorSize(0.);
-
-  // do not display any of the standard histogram decorations
-  atlasStyle->SetOptTitle(0);
-  //atlasStyle->SetOptStat(1111);
-  atlasStyle->SetOptStat(0);
-  //atlasStyle->SetOptFit(1111);
-  atlasStyle->SetOptFit(0);
-
-  // put tick marks on top and RHS of plots
-  atlasStyle->SetPadTickX(1);
-  atlasStyle->SetPadTickY(1);
-
-
-  return atlasStyle;
-
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasStyle.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasStyle.h
deleted file mode 100644
index 64d9787b370815b539e77ee2af772fe3ed8097c6..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasStyle.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//
-//   @file    AtlasStyle.h         
-//   
-//            ATLAS Style, based on a style file from BaBar
-//
-//
-//   @author M.Sutton
-// 
-//
-//   $Id: AtlasStyle.h, v0.0   Thu 25 Mar 2010 10:34:20 CET $
-
-#ifndef  __ATLASSTYLE_H
-#define __ATLASSTYLE_H
-
-#include "TStyle.h"
-
-void SetAtlasStyle();
-
-TStyle* AtlasStyle(); 
-
-#endif // __ATLASSTYLE_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasUtils.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasUtils.C
deleted file mode 100644
index dd95e9b859e984bbb83c4ddeb8a3834799653cb4..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasUtils.C
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-#include <iostream>
-#include <cmath>
-
-#include "AtlasUtils.h"
-
-#include "TLine.h"
-#include "TLatex.h"
-#include "TMarker.h"
-#include "TPave.h"
-#include "TH1.h"
-
-void ATLAS_LABEL(Double_t x,Double_t y,Color_t color) 
-{
-  TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.SetTextFont(72);
-  l.SetTextColor(color);
-  l.DrawLatex(x,y,"ATLAS");
-}
-
-TGraphErrors* myTGraphErrorsDivide(TGraphErrors* g1,TGraphErrors* g2) {
- 
-  const Int_t debug=0; 
-
-  if (!g1) printf("**myTGraphErrorsDivide: g1 does not exist !  \n"); 
-  if (!g2) printf("**myTGraphErrorsDivide: g2 does not exist !  \n"); 
-  
-  if (!g1 or !g2){
-    return nullptr;
-  }
-
-  Int_t n1=g1->GetN();
-  Int_t n2=g2->GetN();
-
-  if (n1!=n2) {
-   printf("**myTGraphErrorsDivide: vector do not have same number of entries !  \n"); 
-  }
-
-  TGraphErrors* g3= new TGraphErrors();
-
-  Double_t  x1=0., y1=0., x2=0., y2=0.;
-  Double_t dx1=0.,dy1=0.,       dy2=0.;
-
-  Int_t iv=0;
-  for (Int_t i1=0; i1<n1; i1++) {
-   for (Int_t i2=0; i2<n2; i2++) {
-     //if (debug) printf("**myTGraphErrorsDivide: %d  %d !  \n",i1,i2);
-
-    g1->GetPoint(i1,x1,y1);
-    g2->GetPoint(i2,x2,y2);
-    if (x1!=x2) {
-      //printf("**myTGraphErrorsDivide: %d x1!=x2  %f %f  !  \n",iv,x1,x2);
-    }else{
-      //if (debug) printf("**myTGraphErrorsDivide: %d x1=x2  %f %f  !  \n",iv,x1,x2);
-     dx1  = g1->GetErrorX(i1);
-     if (y1!=0) dy1  = g1->GetErrorY(i1)/y1;
-     if (y2!=0) dy2  = g2->GetErrorY(i2)/y2;
-   
-     if (debug)
-      printf("**myTGraphErrorsDivide: %d x1=%f x2=%f y1=%f y2=%f  \n",iv,x1,x2,y1,y2);
-
-     if (y2!=0.) g3->SetPoint(iv, x1,y1/y2);
-     else        g3->SetPoint(iv, x1,y2);
-   
-     Double_t e=0.;
-     if (y1!=0 && y2!=0) e=std::sqrt(dy1*dy1+dy2*dy2)*(y1/y2); 
-     g3->SetPointError(iv,dx1,e);
-
-
-     if (debug) {
-       //Double_t g3y, g3x,g3e;
-       //g3->GetPoint(iv, g3y,g3x);
-       //g3e=g3->GetErrorY(iv);
-       //printf("%d g3y= %f g3e=%f  \n",iv,g3y,g3e);
-     }
-     iv++;
-    }
-    //    printf("**myTGraphErrorsDivide: ...next  \n");
-   }
-  }  
-  return g3;
-
-}
-
-
-TGraphAsymmErrors* myTGraphErrorsDivide(TGraphAsymmErrors* g1,TGraphAsymmErrors* g2) {
-
-  const Int_t debug=0; 
-
-  TGraphAsymmErrors* g3= new TGraphAsymmErrors();
-  Int_t n1=g1->GetN();
-  Int_t n2=g2->GetN();
-
-  if (n1!=n2) {
-    printf(" vectors do not have same number of entries !  \n");
-   return g3;
-  }
-
-  Double_t   x1=0.,   y1=0., x2=0., y2=0.;
-  Double_t dx1h=0., dx1l=0.;
-  Double_t dy1h=0., dy1l=0.;
-  Double_t dy2h=0., dy2l=0.;
-
-  Double_t* X1 = g1->GetX();
-  Double_t* Y1 = g1->GetY();
-  Double_t* EXhigh1 = g1->GetEXhigh();
-  Double_t* EXlow1 =  g1->GetEXlow();
-  Double_t* EYhigh1 = g1->GetEYhigh();
-  Double_t* EYlow1 =  g1->GetEYlow();
-
-  Double_t* X2 = g2->GetX();
-  Double_t* Y2 = g2->GetY();
-  Double_t* EXhigh2 = g2->GetEXhigh();
-  Double_t* EXlow2 =  g2->GetEXlow();
-  Double_t* EYhigh2 = g2->GetEYhigh();
-  Double_t* EYlow2 =  g2->GetEYlow();
-
-  for (Int_t i=0; i<g1->GetN(); i++) {
-    g1->GetPoint(i,x1,y1);
-    g2->GetPoint(i,x2,y2);
-    dx1h  = EXhigh1[i];
-    dx1l  = EXlow1[i];
-    if (y1!=0.) dy1h  = EYhigh1[i]/y1;
-    else        dy1h  = 0.;
-    if (y2!=0.) dy2h  = EYhigh2[i]/y2;
-    else        dy2h  = 0.;
-    if (y1!=0.) dy1l  = EYlow1 [i]/y1;
-    else        dy1l  = 0.;
-    if (y2!=0.) dy2l  = EYlow2 [i]/y2;
-    else        dy2l  = 0.;
-   
-    //if (debug)
-    //printf("%d x1=%f x2=%f y1=%f y2=%f  \n",i,x1,x2,y1,y2);
-    if (debug)
-      printf("%d dy1=%f %f dy2=%f %f sqrt= %f %f \n",i,dy1l,dy1h,dy2l,dy2h,
-	     std::sqrt(dy1l*dy1l+dy2l*dy2l), std::sqrt(dy1h*dy1h+dy2h*dy2h));
-
-    if (y2!=0.) g3->SetPoint(i, x1,y1/y2);
-    else       g3->SetPoint(i, x1,y2);
-    Double_t el=0.; Double_t eh=0.;
-
-    if (y1!=0. && y2!=0.) el=std::sqrt(dy1l*dy1l+dy2l*dy2l)*(y1/y2);
-    if (y1!=0. && y2!=0.) eh=std::sqrt(dy1h*dy1h+dy2h*dy2h)*(y1/y2);
-
-    if (debug) printf("dx1h=%f  dx1l=%f  el=%f  eh=%f \n",dx1h,dx1l,el,eh);
-    g3->SetPointError(i,dx1h,dx1l,el,eh);
-
-  }  
-  return g3;
-
-}
-
-
-
-TGraphAsymmErrors* myMakeBand(TGraphErrors* g0, TGraphErrors* g1,TGraphErrors* g2) {
-  // default is g0
-    //const Int_t debug=0;
-
-  TGraphAsymmErrors* g3= new TGraphAsymmErrors();
-
-  Double_t  x1=0., y1=0., x2=0., y2=0., y0=0, x3=0.;
-  //Double_t dx1=0.;
-  Double_t dum;
-  for (Int_t i=0; i<g1->GetN(); i++) {
-    g0->GetPoint(i, x1,y0);
-    g1->GetPoint(i, x1,y1);
-    g2->GetPoint(i, x1,y2);
-
-    // if (y1==0) y1=1;
-    //if (y2==0) y2=1;
-
-    if (i==g1->GetN()-1) x2=x1;
-    else                 g2->GetPoint(i+1,x2,dum);
-
-    if (i==0)            x3=x1;
-    else                 g2->GetPoint(i-1,x3,dum);
-
-    Double_t tmp=y2;
-    if (y1<y2) {y2=y1; y1=tmp;}
-    //Double_t y3=1.;
-    Double_t y3=y0;
-    g3->SetPoint(i,x1,y3);
-
-    Double_t binwl=(x1-x3)/2.;
-    Double_t binwh=(x2-x1)/2.;
-    if (binwl==0.)  binwl= binwh;
-    if (binwh==0.)  binwh= binwl;
-    g3->SetPointError(i,binwl,binwh,(y3-y2),(y1-y3));
-
-  }
-  return g3;
-
-}
-
-void myAddtoBand(TGraphErrors* g1, TGraphAsymmErrors* g2) {
-
-  Double_t  x1=0., y1=0.,  y2=0., y0=0;
-  //Double_t dx1=0.;
-  //Double_t dum;
-
-  if (g1->GetN()!=g2->GetN())
-    std::cout << " graphs have not the same # of elements " << std::endl;
-
-  Double_t* EYhigh = g2-> GetEYhigh();
-  Double_t* EYlow  = g2-> GetEYlow();
-
-  for (Int_t i=0; i<g1->GetN(); i++) {
-    g1->GetPoint(i, x1,y1);
-    g2->GetPoint(i, x1,y2);
-    
-    if ( y1==0 || y2==0 ) { 
-      std::cerr << "check these points very carefully : myAddtoBand() : point " << i << std::endl;  
-    }
-    //    if (y1==0) y1=1;
-    //    if (y2==0) y2=1;
-
-    //    if (i==g1->GetN()-1) x2=x1;
-    //    else                 g2->GetPoint(i+1,x2,dum);
-    //    if (i==0)            x3=x1;
-    //    else                 g2->GetPoint(i-1,x3,dum);
-
-    Double_t eyh=0., eyl=0.;
-    //if (y1<y2) {y2=y1; y1=tmp;}
-    //Double_t y3=1.;
-
-    //printf("%d: y1=%f y2=%f Eyhigh= %f Eylow= %f \n",i,y1,y2,EYhigh[i],EYlow[i]);
-
-    y0=y1-y2;
-    if (y0!=0) {
-     if (y0>0){
-      eyh=EYhigh[i];
-      eyh=std::sqrt(eyh*eyh+y0*y0);
-      //printf("high: %d: y0=%f eyh=%f  \n",i,y0,eyh);
-      g2->SetPointEYhigh(i,eyh);
-     } else {
-      eyl=EYlow[i];
-      eyl=std::sqrt(eyl*eyl+y0*y0);
-      // printf("low: %d: y0=%f eyl=%f  \n",i,y0,eyl);
-      g2->SetPointEYlow (i,eyl);
-     }
-    }
-  }
-  return;
-
-}
-
-TGraphErrors* TH1TOTGraph(TH1 *h1){
-
-
-  if (!h1){
-    std::cout << "TH1TOTGraph: histogram not found !" << std::endl;
-    return nullptr;
-  }
-
- TGraphErrors* g1= new TGraphErrors();
-
- Double_t x, y, ex, ey;
- for (Int_t i=1 ; i<=h1->GetNbinsX(); i++) {
-   y=h1->GetBinContent(i);
-   ey=h1->GetBinError(i);
-   x=h1->GetBinCenter(i);
-   ex=h1->GetBinWidth(i);
-   
-  //   cout << " x,y = " << x << " " << y << " ex,ey = " << ex << " " << ey << endl;
-
-   g1->SetPoint(i-1,x,y);
-   g1->SetPointError(i-1,ex,ey);
-
- }
-
- //g1->Print();
-
- return g1;
-}
-
-void myText(Double_t x,Double_t y,Color_t color, const char *text) {
-
-  //Double_t tsize=0.05;
-  TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.SetTextColor(color);
-  l.DrawLatex(x,y,text);
-}
-
-
-void myTextMatthias(Double_t x,Double_t y, Double_t tsize, Color_t color, const char *text) {
-  
-  //Double_t tsize=0.05;
-  TLatex l; //l.SetTextAlign(12);
-  l.SetTextSize(tsize);
-  l.SetNDC();
-  l.SetTextColor(color);
-  l.DrawLatex(x,y,text);
-}
-
-void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,const char *text) 
-{
-
-  Double_t tsize=0.06;
-
-  TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.DrawLatex(x,y,text);
-
-  Double_t y1=y-0.25*tsize;
-  Double_t y2=y+0.25*tsize;
-  Double_t x2=x-0.3*tsize;
-  Double_t x1=x2-boxsize;
-
-  printf("x1= %f x2= %f y1= %f y2= %f \n",x1,x2,y1,y2);
-
-  TPave *mbox= new TPave(x1,y1,x2,y2,0,"NDC");
-
-  mbox->SetFillColor(mcolor);
-  mbox->SetFillStyle(1001);
-  mbox->Draw();
-
-  TLine mline;
-  mline.SetLineWidth(4);
-  mline.SetLineColor(1);
-  mline.SetLineStyle(1);
-  Double_t y_new=(y1+y2)/2.;
-  mline.DrawLineNDC(x1,y_new,x2,y_new);
-
-}
-
-
-void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle, const char *text,Float_t msize) 
-{
-  Double_t tsize=0.06;
-  TMarker *marker = new TMarker(x-(0.4*tsize),y,8);
-  marker->SetMarkerColor(color);  marker->SetNDC();
-  marker->SetMarkerStyle(mstyle);
-  marker->SetMarkerSize(msize);
-  marker->Draw();
-
-  TLatex l; l.SetTextAlign(12); 
-  l.SetTextSize(msize/35); 
-  l.SetNDC();
-  l.DrawLatex(x,y,text);
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasUtils.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasUtils.h
deleted file mode 100644
index b96af52ef2a553144c42e48c1184ac9c6ca1aff1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasUtils.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//
-//   @file    AtlasUtils.h         
-//   
-//
-//   @author M.Sutton
-// 
-//
-//   $Id: AtlasUtils.h, v0.0   Thu 25 Mar 2010 10:34:20 CET $
-
-
-#ifndef __ATLASUTILS_H
-#define __ATLASUTILS_H
-
-#include "TGraphErrors.h"
-#include "TGraphAsymmErrors.h"
-
-void ATLAS_LABEL(Double_t x,Double_t y,Color_t color=1); 
-
-TGraphErrors* myTGraphErrorsDivide(TGraphErrors* g1,TGraphErrors* g2);
-
-TGraphAsymmErrors* myTGraphErrorsDivide(TGraphAsymmErrors* g1,TGraphAsymmErrors* g2);
-
-TGraphAsymmErrors* myMakeBand(TGraphErrors* g0, TGraphErrors* g1,TGraphErrors* g2);
-
-void myAddtoBand(TGraphErrors* g1, TGraphAsymmErrors* g2);
-
-TGraphErrors* TH1TOTGraph(TH1 *h1);
-
-void myText(Double_t x,Double_t y,Color_t color,const char *text);
-
-void myTextMatthias(Double_t x,Double_t y, Double_t tsize, Color_t color,const char *text);
-
-void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,const char *text);
-
-void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,const char *text,Float_t msize=2.); 
-
-#endif // __ATLASUTILS_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/EigenAna.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/EigenAna.h
deleted file mode 100644
index 47eb834906428b0e707011e643f11d6a09c90b2a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/EigenAna.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef __jacobana__
-#define __jacobana__
-////////////////////////////////////////////////////
-// includes
-/////////////
-//
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-#include "TROOT.h"
-#include "TSystem.h"
-#include "TStyle.h"
-#include "TVectorD.h"
-#include "TStopwatch.h"
-#include "TF1.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "THStack.h"
-#include "TGaxis.h"
-#include "TCanvas.h"
-#include "TMatrixDEigen.h"
-#include "TMatrixTSparse.h"
-#include "TFile.h"
-#include "TDirectoryFile.h"
-#include "TPaletteAxis.h"
-#include "TLine.h"
-#include "TText.h"
-
-#ifndef ROOT_TString
-#include "TString.h"
-#endif
-
-////////////////////////////////////////////////////
-// variables
-/////////////
-//
-TString *DirName;
-TString *InputTFileName;
-//
-TFile *InputTFile; // The actual TFile where the matrix, vector, ... are stored.
-
-// 
-Double_t m_ScaleFactor;
-
-TMatrixDSym BigMatrix;
-TMatrixD BigMatrix_Inv;  // its inverse for error calculation
-TVectorD BigVector;   // in the modules base
-TVectorD BigVector_b;  // in the diagonal base
-
-TMatrixD BigMatrix_b;   // big matrix in diagonal base (diagonal matrix)
-TVectorD EigenVal;        // vector of eigen values
-
-TVectorD RowsUsed;
-TVectorD Identifiers;
-TVectorD DoFs;
-TMatrixD ChangeOfBaseMatrix; 
-
-TVectorD AlignCorrRaw; // Raw align corrections in the modules base (all modes included, i.e. without mode cut)
-TVectorD AlignCorrRaw_b; // Raw align corrections in the diagonal base (all modes included, i.e. without mode cut)
-
-TVectorD AlignCorr; // Align corrections in the modules base (after mode cut)
-TVectorD AlignCorr_b; // Align corrections in the diagonal base (after mode cut)
-
-TVectorD AlignCorrError;    // vector of error of the alignment corrections in the modules base
-TVectorD AlignCorrError_b;    // vector of error of the alignment corrections in the diagonal base
-
-TVectorD DoFType; 
-//
-// structures
-const Int_t NMaxStruct = 3568; // Level 3: modules in the SCT Barrel
-Bool_t UsedEigenMode[NMaxStruct*6];
-Int_t  NofAlignableStructures;
-short  NdofPerStruct=6;
-
-//
-const Double_t ZeroEquivalent = 1.E-20;
-const Double_t InfEquivalent = 1.E+20;
-//
-typedef Int_t StatusCode;
-enum {SUCCESS=0, FAILURE=1};
-enum {DoFTx=0, DoFTy=1, DoFTz=2, DoFRx=3, DoFRy=4, DoFRz=5};
-enum {PIX=0, SCT=1, TRT=2};
-
-//
-Double_t AngleUnitFactor = 0.001; // use mradians
-//
-short PrintLevel;
-//
-// solving options
-TString *SolveOptions;
-Bool_t SolveWholeID;
-Bool_t SolveLocalX2Style = false; // matrix conditioning to make it like local X2
-Bool_t QuietMode = false ;
-Bool_t PlotEigenVecs = false;
-Bool_t UseSoftModeCut = false;  // If true a soft mode cut is add to the big matrix
-Bool_t DoSolving = true;       // If true solve the matrices, if false just read and do the preconditioning
-Bool_t NewAlign = false;
-Bool_t UseTFileInput = true;
-
-Float_t HitCut;
-// weak modes
-Int_t NModesToRemove;    // number of modes to remove in case of fixed number of modes removal 
-Int_t WeakModeStrategy;  // which weak mode strategy to use
-Float_t PullLimit;       // Cut in the pull of eigenvalues
-
-// indicate which degree of freedom is in use
-Bool_t UseTx, UseTy, UseTz, UseRx, UseRy, UseRz;
-// basic dof names (for printing and human readable)
-TString DofName[6] = {"Tx", "Ty", "Tz", "Rx", "Ry", "Rz"};
-TString *StructureName[NMaxStruct];
-
-Int_t StructDetec[NMaxStruct];
-Int_t DofBelongsToStruct[NMaxStruct*6];
-Int_t NumberOfPIXStruct=0;
-Int_t NumberOfSCTStruct=0;
-Int_t NumberOfTRTStruct=0;
-
-
-// Canvas
-TCanvas *CanDiagonalBase;
-TCanvas *CanAlignCorr;
-TCanvas *CanAlignCorrErr;
-TCanvas *CanBigMatrix;
-TCanvas *CanBigMatrixInv;
-TCanvas *CanCorrelMatrix;
-TCanvas *CAliCorrDof;
-
-
-// soft mode cut variables
-float sct_ec_Rz_smc = 1.;
-/////////////////////
-// histograming
-/////////////////////
-TFile *EAHistFile;
-TDirectoryFile *EAHistDir;
-//
-TH1F *hEigenVal;  // histogram of eigen values
-TH1F *hBigVector;   // histogram of the big vector in the modules base
-TH1F *hBigVector_b;    // histogram of the big vector in the diagonal base
-TH1F *hAliCorrRaw; // histogram of the alignment correction in the modules base and including all mode
-TH1F *hAliCorrRaw_b;  // same as above but in diagonal base 
-
-TH1F *hAliCorr;  // histogram of the alignment correction in the modules base after the mode cut
-TH1F *hAliCorr_b; // same as above but in diagonal base 
-
-TH1F *hAliCorrErr;  // histogram of the alignment correction error in the modules base after the mode cut
-TH1F *hAliCorrErr_b; // same as above but in diagonal base 
-
-TH1F *hAliCorrPull_b; // pull of the alignment corrections in the diagonal base
-
-TH1F * hTxAliCorr;
-TH1F * hTyAliCorr;
-TH1F * hTzAliCorr;
-TH1F * hRxAliCorr;
-TH1F * hRyAliCorr;
-TH1F * hRzAliCorr;
-
-TH1F * hTxAliCorrProj;
-TH1F * hTyAliCorrProj;
-TH1F * hTzAliCorrProj;
-TH1F * hRxAliCorrProj;
-TH1F * hRyAliCorrProj;
-TH1F * hRzAliCorrProj;
-
-TH1F *hModCorr[NMaxStruct*6];
-TH1F *hDofCorr[NMaxStruct*6];
-TH1F *hDofIntegral[NMaxStruct*6];
-
-TH2F* hBigMatrixInv; 
-
-struct HistoBins{
-      Float_t min;
-      Float_t max;
-      Int_t bins;
-};
-
-TLine *line;
-////////////////////////////////////////////////////
-// prototypes
-/////////////
-//
-StatusCode  EigenAna_init(const char*);
-void        EigenAna_operate();
-void        EigenAna_end();
-//
-void        BookAliCorrHistos();
-void        BookAliCorrErrHistos();
-void        BookAliCorrPullHistos();
-void        BookBigMatrixHisto();
-void        BookBigMatrixInvHisto();
-void        BookCorrelMatrixHisto();
-void        BookDofCorrections();
-void        BookEigenValues();
-void        BookBigVector();
-void        BookModeCorrections();
-void        BookRawAlignCorr();
-void        ChangeAngleUnits();
-void        ComputeAlignCorr();
-void        ComputeAlignCorrErrors();
-void        DetectNullEigenValues();
-void        DivideEigenCanvas(TCanvas *);
-void	    DrawStructLines(TH1F *hist, TCanvas *can, int c);
-void        DrawStructLinesOnHMatrix (TH2F *hist);
-void	    ExtractName(unsigned long long, int);
-void        FindDetectorType(unsigned long long, int, int);
-TVectorD    Flip(const TVectorD &);
-TMatrixD    Flip(const TMatrixD &);
-HistoBins   GetHistoLimits(TH1F*);
-HistoBins   GetHistoLimits(TH1F* hist1, TH1F* hist2);
-float	    GetHitCut ();
-Int_t       GetNdofPerStruct ();
-Int_t       GetNdof ();
-Int_t       GetNEigenCanvas ();
-Int_t       GetNEigenPerCanvas();
-Int_t       GetNMaxStructures();
-Int_t       GetNModesToRemove();
-Int_t       GetNStruct();
-Int_t       GetNUsedDof();
-Int_t       GetPrintLevel();
-Float_t     GetPullLimit();
-Int_t       GetStructID(Int_t);
-Int_t       GetWeakModeRemovalStrategy();
-void        HandleSolveOptions();
-void        InitUsedEigenModesFlag();
-void        InitGraphicsStyle();
-void        InitOutputFile();
-Bool_t      IsEigenModeUsed(int);
-Bool_t      IsTranslation (int);
-void        MatrixAndVectorPreConditioning();
-void        OpenCanvas ();
-void        PrepareLocalX2 ();
-void        PrepareSoftModeCut ();
-void        PrintAlignmentCorrections (const TVectorD&);
-StatusCode  ReadTFile ();
-void	    RemoveRows ();
-void	    RemoveMatrixRows (int, int, TMatrixDSym&);
-void	    RemoveVectorRows (int, int, TVectorD&);
-void        SetActiveNdof(Bool_t, Bool_t, Bool_t, Bool_t, Bool_t, Bool_t);
-void        SetColorsOfModeCorrHists ();
-void        SetScaleFactor(double myscale);
-void        SetDirectory(const char*);
-void        SetDoFTypes();
-void        SetFlagForUsedEigenMode(Int_t, Bool_t);
-void	    SetHitCut(float);
-void        SetNModesToRemove(int);
-void        SetNofStructures(int);
-void        SetNofStructuresPerDetec();
-void        SetPrintLevel(Int_t);
-void        SetPullLimit(Float_t);
-void        SetWeakModeRemovalStrategy(int);
-void        SetXAxisLabels(TH1F*);
-void        SetXAxisLabels(TH2F *histo, Bool_t nameonlyfirstofeachstruct = false);
-void        SetXAxisStructures(TH1F*);
-void        SetHMatrixLabels (TH2F*);
-void        SolveInDiagonalBase();
-void        SolveWithWeakModeRemoval();
-//
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/Monitor.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/Monitor.h
deleted file mode 100644
index e9b54850987c68a07346551feb07276a598cae15..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/Monitor.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include <TString.h>
-#include <TFile.h>
-#include <TDirectory.h>
-#include <TColor.h>
-#include <TLatex.h>
-#include <TCanvas.h>
-#include <TLegend.h>
-#include <TPolyLine.h>
-#include <TPaletteAxis.h>
-#include <TMath.h>
-#include <TH1.h>
-#include <TF1.h>
-#include <TH2.h>
-#include <TH3.h>
-#include <TProfile.h>
-#include <stdio.h>
-#include <iostream>
-#include <iomanip>
-
-// Global variables
-bool AtlasStyle;
-bool normalizePlots;
-bool showFits;
-int PrintLevel;
-TString FirstTrackCollection ="";
-TString SecondTrackCollection ="";
-TString CosmicSegmentsCollection = "";
-TString FileName ="";
-TFile *file;
-TDirectory *IDAlignMonDir;
-TDirectory *FirstTrkSelDir;
-TDirectory *SecondTrkSelDir;
-
-Int_t font = 42;
-// Canvas sizes
-const Int_t CanvasSizeX2[4] = {0,10,700,300};
-const Int_t CanvasSizeX3[2] = {1180,400};
-const Int_t CanvasSizeX4[2] = {1024,768};
-const Int_t CanvasSizeX6[2] = {1150,700};
-const Int_t CanvasSizeX9[4] = {0,450,925,700};
-
-// Colors
-Color_t ColorForFirst;
-Color_t ColorForSecond;
-
-// Summary
-TString aSetup;
-bool iCosmics;
-Float_t iBField;
-Int_t iEvents;
-Int_t iTracks_1;
-Int_t iTracks_2;
-Int_t IterNumber;
-Int_t iHits_1,iPixelHits_1,iSCTHits_1,iTRTHits_1;
-Int_t iHits_2,iPixelHits_2,iSCTHits_2,iTRTHits_2;
-// Canvas
-TCanvas *cInfoRes;
-TCanvas *cHits;
-TCanvas *cHitCorr;
-TCanvas *cHitsPerLayer;
-TCanvas *cPIXHitMap;
-TCanvas *cPIXHitMap1;
-TCanvas *cPIXHitMap2;
-TCanvas *cPixRes;
-TCanvas *cPixRes_1;
-TCanvas *cPixRes_2;
-TCanvas *cPixRes_3;
-TCanvas *cSctTRTRes;
-TCanvas *cSctTRTRes_1;
-TCanvas *cSctTRTRes_2;
-TCanvas *cSctTRTRes_3;
-TCanvas *cSCTHitMapBa;
-TCanvas *cSCTHitMapBa1;
-TCanvas *cSCTHitMapBa2;
-TCanvas *cSCTHitMapEC[2];
-TCanvas *cSCTHitMapEC1[2];
-TCanvas *cSCTHitMapEC2[2];
-TCanvas *cPIXBarrelRes;
-TCanvas *cPIXBarrelRes_1;
-TCanvas *cPIXBarrelRes_2;
-TCanvas *cPIXBarrelRes_3;
-TCanvas *cPIXBarrelResVsPt;
-TCanvas *cPIXBarrelResVsPt_1;
-TCanvas *cPIXBarrelResVsPt_2;
-TCanvas *cPIXBarrelResVsPt_3;
-TCanvas *cPIXECRes;
-TCanvas *cPIXECARes_1;
-TCanvas *cPIXECARes_2;
-TCanvas *cPIXECARes_3;
-TCanvas *cPIXECCRes_1;
-TCanvas *cPIXECCRes_2;
-TCanvas *cPIXECCRes_3;
-TCanvas *cPIXECResVsPt;
-TCanvas *cPIXECAResVsPt_1;
-TCanvas *cPIXECAResVsPt_2;
-TCanvas *cPIXECAResVsPt_3;
-TCanvas *cPIXECCResVsPt_1;
-TCanvas *cPIXECCResVsPt_2;
-TCanvas *cPIXECCResVsPt_3;
-TCanvas *cSCTBarrelRes;
-TCanvas *cSCTBarrelRes_1;
-TCanvas *cSCTBarrelRes_2;
-TCanvas *cSCTBarrelRes_3;
-TCanvas *cSCTBarrelResVsPt;
-TCanvas *cSCTBarrelResVsPt_1;
-TCanvas *cSCTBarrelResVsPt_2;
-TCanvas *cSCTBarrelResVsPt_3;
-TCanvas *cSCTECRes;
-TCanvas *cSCTECARes_1;
-TCanvas *cSCTECARes_2;
-TCanvas *cSCTECARes_3;
-TCanvas *cSCTECCRes_1;
-TCanvas *cSCTECCRes_2;
-TCanvas *cSCTECCRes_3;
-TCanvas *cSCTECResVsPt;
-TCanvas *cSCTECAResVsPt_1;
-TCanvas *cSCTECAResVsPt_2;
-TCanvas *cSCTECAResVsPt_3;
-TCanvas *cSCTECCResVsPt_1;
-TCanvas *cSCTECCResVsPt_2;
-TCanvas *cSCTECCResVsPt_3;
-TCanvas *cPIXResMap;
-TCanvas *cPIXRMSPhiResMap_1;
-TCanvas *cPIXMeanPhiResMap_1; 
-TCanvas *cPIXRMSEtaResMap_1;
-TCanvas *cPIXMeanEtaResMap_1; 
-TCanvas *cPIXRMSPhiResMap_2;
-TCanvas *cPIXMeanPhiResMap_2;
-TCanvas *cPIXRMSEtaResMap_2;
-TCanvas *cPIXMeanEtaResMap_2;
-TCanvas *cSCTBaResMap;
-TCanvas *cSCTBaRMSSide0ResMap_1;
-TCanvas *cSCTBaMeanSide0ResMap_1; 
-TCanvas *cSCTBaRMSSide1ResMap_1;
-TCanvas *cSCTBaMeanSide1ResMap_1; 
-TCanvas *cSCTBaRMSSide0ResMap_2;
-TCanvas *cSCTBaMeanSide0ResMap_2;
-TCanvas *cSCTBaRMSSide1ResMap_2;
-TCanvas *cSCTBaMeanSide1ResMap_2;
-
-TCanvas *cSCTResMapEC;
-TCanvas *cSCTECCRMSSide0ResMap_1;
-TCanvas *cSCTECCRMSSide1ResMap_1;
-TCanvas *cSCTECCMeanSide0ResMap_1;
-TCanvas *cSCTECCMeanSide1ResMap_1;
-TCanvas *cSCTECARMSSide0ResMap_1;
-TCanvas *cSCTECARMSSide1ResMap_1;
-TCanvas *cSCTECAMeanSide0ResMap_1;
-TCanvas *cSCTECAMeanSide1ResMap_1;
-TCanvas *cSCTECCRMSSide0ResMap_2;
-TCanvas *cSCTECCRMSSide1ResMap_2;
-TCanvas *cSCTECCMeanSide0ResMap_2;
-TCanvas *cSCTECCMeanSide1ResMap_2;
-TCanvas *cSCTECARMSSide0ResMap_2;
-TCanvas *cSCTECARMSSide1ResMap_2;
-TCanvas *cSCTECAMeanSide0ResMap_2;
-TCanvas *cSCTECAMeanSide1ResMap_2;
-
-TCanvas *cTrkParameters;
-TCanvas *cTrkParameters_1;
-TCanvas *cTrkParameters_2;
-TCanvas *cTrkParameters_3;
-
-TCanvas *cTrkMomentum;
-TCanvas *cTrkMomentum_1;
-TCanvas *cTrkMomentum_2;
-TCanvas *cTrkMomentum_3;
-
-TCanvas *cErrD0;
-TCanvas *cErrD0_1;
-TCanvas *cErrD0_2;
-TCanvas *cErrD0_3;
-
-TCanvas *cErrD0VsPhi0;
-TCanvas *cErrD0VsPhi0_1;
-TCanvas *cErrD0VsPhi0_2;
-TCanvas *cErrD0VsPhi0_3;
-
-TCanvas *cErrPt;
-TCanvas *cErrPt_1;
-TCanvas *cErrPt_2;
-TCanvas *cErrPt_3;
-
-TCanvas *cErrPhi0;
-TCanvas *cErrPhi0_1;
-TCanvas *cErrPhi0_2;
-TCanvas *cErrPhi0_3;
-
-TCanvas *cErrCotTheta;
-TCanvas *cErrCotTheta_1;
-TCanvas *cErrCotTheta_2;
-TCanvas *cErrCotTheta_3;
-
-TCanvas *cErrZ0;
-TCanvas *cErrZ0_1;
-TCanvas *cErrZ0_2;
-TCanvas *cErrZ0_3;
-
-TCanvas *cCosmicSegments[5];
-
-//void Monitor(TString inputFileName="",TString inputFirstTrackCollection="ExtendedTracks_all",TString inputSecondTrackCollection="AlignTracks_all");
-//void Monitor(TString inputFileName="",TString inputFirstTrackCollection="ExtendedTracks_alignSelection",TString inputSecondTrackCollection="AlignTracks_all");
-void Monitor(TString inputFileName="",TString inputFirstTrackCollection="AlignTracks_all",TString inputSecondTrackCollection="");
-bool OpenFile();
-void setStyle();
-void ScalePlots(Int_t position = 0);
-void setTitleFont(Int_t font=62);
-void setTitleSize(double x2Size = 0.90);
-void ForceStyle(TH1F* histoIn1D);
-void SetHistoAtt(TH1 *histo);
-void SetHistoAtt(TH2 *histo);
-int locateColor(const int ncols, float min, float max, float cont);
-void draw_sct_ec_modules(TH2F *histo, int disc);
-void draw_pixel_ec_modules(TH1F *histo);
-void draw_sct_ec_modules(TH2F *histo, int disc);
-void draw_wheel_frame(TString name, float minrange, float maxrange);
-void SetZAxisTitle(TH2F *histo2D,
-	                 Float_t X1=0.82, Float_t X2=0.89,
-	                 Float_t Y1=0.1, Float_t Y2=0.87);
-	                 
-void moveTPaveStats(TH2F* histoIn2D);
-void fillSummary();
-void drawPlots();
-void residuals(TString trkCol);
-void hits(TString trkCol_1, TString trkCol_2);
-void hitCorrelations(TString trkCol_1, TString trkCol_2);
-void pixelHitmaps(TString TrkCol, TString DrawOptions="");
-void pixelHitmaps(TString TrkCol, TCanvas *cPIXHitMap, TString DrawOptions="");
-void sctBarrelHitmap(TString TrkCol, TCanvas *cSCTHitMapBa,	TString DrawOptions ="");
-void sctBarrelHitmap(TString TrkCol, TString DrawOptions ="");
-void sctBarrelHitmap(TString TrkCol);
-void sctECHitmap(TString TrkCol, int ec, TCanvas *cSCTHitMapEC);
-void sctECHitmap(TString TrkCol, int ec);
-void SCTMaps_SetXaxisLabels(TH2F *histoMap);
-
-void draw_pixel_ec_modules(TH1F *histo);
-void hitsPerLayer(TString trkCol_1, TString trkCol_2); 
-void pixelResiduals(TString trkCol);
-void pixelResiduals(TString trkCol, TString trkCol2);
-void pixelResiduals(TString trkCol, TCanvas *cPixRes);
-void pixelResiduals(TString trkCol, TCanvas *cPixRes, TString trkCol2);
-void sct_trt_Residuals(TString trkCol);
-void sct_trt_Residuals(TString trkCol, TString trkCol2);
-void sct_trt_Residuals(TString trkCol, TCanvas *cPixRes);
-void sct_trt_Residuals(TString trkCol, TCanvas *cPixRes, TString trkCol2);
-void pixelBarrelResiduals(TString trkCol);
-void pixelBarrelResiduals(TString trkCol, TString trkCol2);
-void pixelBarrelResiduals(TString trkCol, TCanvas *cPixRes);
-void pixelBarrelResiduals(TString trkCol, TCanvas *cPixRes, TString trkCol2);
-void pixelBarrelResiduals(TString trkCol);
-void pixelBarrelResidualsVsPt(TString trkCol, TString trkCol2);
-void pixelBarrelResidualsVsPt(TString trkCol, TCanvas *cPIXBarrelRes);
-void pixelBarrelResidualsVsPt(TString trkCol, TCanvas *cPIXBarrelRes, TString trkCol2);
-void pixelBarrelResidualsVsPt(TString trkCol);
-void pixelECResiduals(TString trkCol, bool ec);
-void pixelECResiduals(TString trkCol, bool ec, TString trkCol2);
-void pixelECResiduals(TString trkCol, bool ec, TCanvas *cPIXECRes);
-void pixelECResiduals(TString trkCol, bool ec, TCanvas *cPIXECRes, TString trkCol2);
-void pixelECResidualsVsPt(TString trkCol, bool ec);
-void pixelECResidualsVsPt(TString trkCol, bool ec, TString trkCol2);
-void pixelECResidualsVsPt(TString trkCol, bool ec, TCanvas *cPIXECResVsPt);
-void pixelECResidualsVsPt(TString trkCol, bool ec, TCanvas *cPIXECResVsPt, TString trkCol2);
-void sctBarrelResiduals(TString trkCol);
-void sctBarrelResiduals(TString trkCol, TString trkCol2);
-void sctBarrelResiduals(TString trkCol, TCanvas *cPixRes);
-void sctBarrelResiduals(TString trkCol, TCanvas *cPixRes, TString trkCol2);
-void sctBarrelResiduals(TString trkCol);
-void sctBarrelResidualsVsPt(TString trkCol, TString trkCol2);
-void sctBarrelResidualsVsPt(TString trkCol, TCanvas *cPIXBarrelRes);
-void sctBarrelResidualsVsPt(TString trkCol, TCanvas *cPIXBarrelRes, TString trkCol2);
-void sctBarrelResidualsVsPt(TString trkCol);
-void sctECResiduals(TString trkCol, bool ec);
-void sctECResiduals(TString trkCol, bool ec, TString trkCol2);
-void sctECResiduals(TString trkCol, bool ec, TCanvas *cSCTECRes);
-void sctECResiduals(TString trkCol, bool ec, TCanvas *cSCTECRes, TString trkCol2);
-void sctECResidualsVsPt(TString trkCol, bool ec);
-void sctECResidualsVsPt(TString trkCol, bool ec, TString trkCol2);
-void sctECResidualsVsPt(TString trkCol, bool ec, TCanvas *cSCTECResVsPt);
-void sctECResidualsVsPt(TString trkCol, bool ec, TCanvas *cSCTECResVsPt, TString trkCol2);
-void pixelResmaps(TString TrkCol, bool isXres, bool isRMS, float range = 50);
-void pixelResmaps(TString TrkCol, TCanvas *cPIXResMap, bool isXres, bool isRMS, float range = 50);
-void sctBarrelResmaps(TString TrkCol, bool side, bool isRMS, float range = 50);
-void sctBarrelResmaps(TString TrkCol, TCanvas *cSCTBaResMap, bool side, bool isRMS, float range = 50);
-void sctECResmaps(TString TrkCol, bool ec, bool side, bool isRMS, float range);
-void sctECResmaps(TString TrkCol, TCanvas *cSCTResMapEC, bool ec, bool side, bool isRMS, float range);
-void trkParameters(TString trkCol);
-void trkParameters(TString trkCol, TString trkCol2);
-void trkParameters(TString trkCol, TCanvas *cTrkParameters);
-void trkParameters(TString trkCol, TCanvas *cTrkParameters, TString trkCol2);
-
-void trkMomentum(TString trkCol);
-void trkMomentum(TString trkCol, TString trkCol2);
-void trkMomentum(TString trkCol, TCanvas *cTrkMomentum);
-void trkMomentum(TString trkCol, TCanvas *cTrkMomentum, TString trkCol2);
-
-void errD0(TString trkCol);
-void errD0(TString trkCol, TString trkCol2);
-void errD0(TString trkCol, TCanvas *cErrD0);
-void errD0(TString trkCol, TCanvas *cErrD0, TString trkCol2);
-
-void errD0VsPhi0(TString trkCol);
-void errD0VsPhi0(TString trkCol, TString trkCol2);
-void errD0VsPhi0(TString trkCol, TCanvas *cErrD0VsPhi0);
-void errD0VsPhi0(TString trkCol, TCanvas *cErrD0VsPhi0, TString trkCol2);
-
-void errPt(TString trkCol);
-void errPt(TString trkCol, TString trkCol2);
-void errPt(TString trkCol, TCanvas *cErrPt);
-void errPt(TString trkCol, TCanvas *cErrPt, TString trkCol2);
-
-void errPhi0(TString trkCol);
-void errPhi0(TString trkCol, TString trkCol2);
-void errPhi0(TString trkCol, TCanvas *cErrPhi0);
-void errPhi0(TString trkCol, TCanvas *cErrPhi0, TString trkCol2);
-
-void errCotTheta(TString trkCol);
-void errCotTheta(TString trkCol, TString trkCol2);
-void errCotTheta(TString trkCol, TCanvas *cErrCotTheta);
-void errCotTheta(TString trkCol, TCanvas *cErrCotTheta, TString trkCol2);
-
-void errZ0(TString trkCol);
-void errZ0(TString trkCol, TString trkCol2);
-void errZ0(TString trkCol, TCanvas *cErrZ0);
-void errZ0(TString trkCol, TCanvas *cErrZ0, TString trkCol2);
-
-void CosmicSegments(TString trkCol);
-void CosmicSegments(TString trkCol, TCanvas *myCanvas[]);
-void CosmicSegments(TString trkCol_1, TCanvas *myCanvas[], TString trkCol_2);
-
-void SymmetricYaxis(TProfile *myHist, bool IncludingErrors, bool AroundZero);
-
-void printPS();
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/drawutils.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/drawutils.py
deleted file mode 100644
index 4d680b00746dbe67453b3523d78559e5f9122153..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/drawutils.py
+++ /dev/null
@@ -1,903 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-def rootSetup():
-    from ROOT import gStyle
-    gStyle.SetStatColor(0)
-    gStyle.SetFillColor(38)
-    gStyle.SetCanvasColor(0)
-    gStyle.SetPadColor(0)
-    gStyle.SetPadBorderMode(0)
-    gStyle.SetCanvasBorderMode(0)
-    gStyle.SetFrameBorderMode(0)
-    gStyle.SetOptStat(1110)
-    gStyle.SetStatH(0.3)
-    gStyle.SetStatW(0.3)
-    
-    gStyle.SetTitleFillColor(0)
-    #gStyle.SetTitleY(1.)
-    #gStyle.SetTitleX(.1)
-    gStyle.SetTitleBorderSize(0)
-    gStyle.SetHistLineWidth(2)
-    gStyle.SetFrameFillColor(0)
-    #gStyle.SetLineWidth(2)
-    #gStyle.SetTitleColor(0)
-    #gStyle.SetTitleColor(1)
-    gStyle.SetLabelSize(0.05,"x")
-    gStyle.SetLabelSize(0.05,"y")
-    gStyle.SetLabelOffset(0.02,"y")
-    gStyle.SetTitleOffset(1.8,"y")
-    gStyle.SetTitleSize(0.04,"y")
-    gStyle.SetPadRightMargin(0.02)
-    gStyle.SetPadLeftMargin(0.14) # Used to be 0.20 --> Salva
-    gStyle.SetPadBottomMargin(0.14)
-
-
-def  AutoColors(NFiles):
-    Colors = {}
-    doDebug = False
-
-    #import settings.py
-    #import imp
-    #s_utils = imp.load_source('init', 'include/settings.py')
-    #print " xxxyyyzzz ", s_utils.TestUseBarrel
-    
-    if NFiles > 2:
-        ColorStep = 50./(NFiles-1)
-    Color_i = 0;
-    
-    if NFiles is 1:
-        Colors[0] = 920+3 #kGray
-    
-    elif NFiles is 2:
-        Colors[0] = 632+1 #kRed+1
-        Colors[1] = 920+3 #kGray+3
-
-    elif NFiles is 3:
-        Colors[0] = 632+1 #kRed+1
-        Colors[1] = 920+2 #kGray+2
-        Colors[2] = 860+1 #kAzure+1
-
-    elif NFiles is 4:
-        if (True):
-            Colors[0] = 616 # IBL
-            Colors[1] = 1   # Pixel 
-            Colors[2] = 632 # SCT
-            Colors[3] = 416 # TRT
-        else:
-            Colors[0] = 629 # SCT
-            Colors[1] = 801   
-            Colors[2] = 398 # TRT
-            Colors[3] = 813 
-            
-    elif NFiles is 8:
-        Colors[0] = 616 #kMagenta+2     #IBL
-        Colors[1] = 1 #kBlack           #Pixel
-        Colors[2] = 632 #kRed           #SCT
-        Colors[3] = 629 #kRed+2
-        Colors[4] = 801 #kOrange+7
-        Colors[5] = 416 #          #TRT
-        Colors[6] = 398 
-        Colors[7] = 813 
-
-    elif NFiles > 3:
-        for i in range(0,NFiles):
-            Color_i = int(51+i*ColorStep)
-            if Color_i>100:
-                Color_i = 100
-            #print " - color - File ", i,  " --> color ",Color_i
-            Colors[i] = Color_i
-        Colors[1] = 1    
-            
-    if (doDebug):        
-        for i in range(NFiles):
-            print " color ",i,"=", Colors[i]
-
-    return Colors
-
-def drawAllCorr(detector):
-    from ROOT import TCanvas
-    from ROOT import TH1F
-    from ROOT import gPad
-    debug = False
-
-    if (debug): print " -- drawAllCorr -- starting for detector = ",detector
-    showErrors = True
-    Alldetector = TCanvas("AlignmentCorrections(All)","Alignment Corrections (All)")
-    Alldetector.Divide(3,2)
-    AllCorrections = {}
-    yrange = [0,0,0,0,0,0]
-    if (debug): print " -- drawAllCorr -- finding out histogram ranges... "
-    for i in range(6):
-        if (debug): print "  -- drawAllCorr -- extracting range for dof:",i
-        for det in detector:
-            for bin in range(detector[det].nModules()):
-                #print " ** drawutils ** drawAllCorr ** det:",det,"  nModules = ",detector[det].nModules()
-                if abs(detector[det].GetModule(bin).GetDoF(i)[1])>yrange[i]:
-                    yrange[i] = abs(detector[det].GetModule(bin).GetDoF(i)[1])
-        yrange[i] *= 1.1
-        
-    if (debug): print " -- drawAllCorr -- finding out colors ..."
-    Color = AutoColors(len(detector))
-    for det in detector:
-        for i in range(6):
-            Alldetector.cd(i+1)
-            AllCorrections[det]={}
-            name, value = detector[det].GetModule(0).GetDoF(i)
-            hname = 'All_%s_corrections_%d' % (name,det)
-            htitle = 'All %s Corrections_%d' % (name,det)
-            AllCorrections[det][name] = TH1F(hname,htitle, detector[det].nModules(),0,detector[det].nModules())
-            if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx':
-                AllCorrections[det][name].SetYTitle("mm")
-            else:
-                AllCorrections[det][name].SetYTitle("mrad")
-                
-            for bin in range(detector[det].nModules()):
-                AllCorrections[det][name].SetBinContent(bin+1,detector[det].GetModule(bin).GetDoF(i)[1])
-                if showErrors:
-                    AllCorrections[det][name].SetBinError(bin+1,detector[det].GetModule(bin).GetDoFError(i)[1])
-
-                if detector[det].nModules()<35:
-                    AllCorrections[det][name].GetXaxis().SetBinLabel(bin+1,detector[det].GetModule(bin).GetName())
-                    
-            #AllCorrections[det][name].SetMarkerStyle(20)
-            AllCorrections[det][name].SetMarkerColor(Color[det])
-            AllCorrections[det][name].SetLineColor(Color[det])
-            AllCorrections[det][name].SetFillColor(Color[det])
-            AllCorrections[det][name].SetFillStyle(1001)
-
-            AllCorrections[det][name].SetStats(False)
-            if det==0:
-                AllCorrections[det][name].GetYaxis().SetRangeUser(-yrange[i],yrange[i])
-                AllCorrections[det][name].DrawCopy()                        
-            else:
-                AllCorrections[det][name].DrawCopy('same')
-
-            gPad.SetGridx()
-            gPad.SetGridy() 
-            gPad.Update()
-    return Alldetector
-
-#############################################################
-def OLD_drawCorrEvolution(detector, labelList, drawErrors=False, drawLine=True, whichdof=-1):
-    from ROOT import TCanvas
-    from ROOT import TH1F
-    from ROOT import gPad
-    from ROOT import TLegend
-
-    doDebug = True
-    showErrors = True
-    drawAllDofs = True
-    nUsedDofs = 6
-    if (whichdof != -1):
-        drawAllDofs = False 
-        if (whichdof > 5): nUsedDofs = 7 # 7/oct/2015 with the BowX we may have up to 7 dofs. Unless stated draw the ordinary 6.
-
-    lowerDof = 0;
-    upperDof = 5;
-
-    if (not drawAllDofs):
-        lowerDof = whichdof
-        upperDof = whichdof
-    
-    # a canvas for all dofs
-    ThisCanvas = TCanvas("AlignmentCorrectionsEvol","Evolution of alignment corrections (All)")
-    if (drawAllDofs): ThisCanvas.Divide(3,2)
-
-    
-    hCorrectionsEvol = {}
-    hCorrectionsEvolStruct={}
-    yrange = [0.002,0.002,0.002,0.01,0.01,0.01, 0.002] # minimum is 0.001 (mm or mrad)
-    # here detector = num of iterations
-    numOfIterations = len(detector)
-    if (doDebug): print " numOfIterations=", numOfIterations
-    numOfAlignableStruct = detector[0].nModules()
-    if (doDebug): print " numOfAlignableStructe=", numOfAlignableStruct
-    EvolColor = AutoColors(numOfAlignableStruct)    
-   
-
-    # find out range
-    #for i in range(lowerDof, upperDof):
-    for i in range (nUsedDofs):
-        for iter in range(numOfIterations):
-            for bin in range(detector[iter].nModules()):
-                thisValue = abs(detector[iter].GetModule(bin).GetDoF(i)[1])+ detector[iter].GetModule(bin).GetDoFError(i)[1]
-                if abs(thisValue)>yrange[i]:
-                    yrange[i] = thisValue
-        yrange[i] *= 1.025
-        if (doDebug): print " dof=",i," --> range: ",yrange[i]
-
-    # maximum range
-    maxTransRange = 0.100
-    if (yrange[0]> maxTransRange): yrange[0] = maxTransRange       
-    if (yrange[1]> maxTransRange): yrange[1] = maxTransRange       
-    if (yrange[2]> maxTransRange): yrange[2] = maxTransRange       
-    #yrange[0] = 0.04
-    #yrange[1] = 0.04
-        
-    # Tx and Ty should have the same range
-    if (yrange[0] > yrange[1]): 
-        yrange[1] = yrange[0]
-    else:
-        yrange[0] = yrange[1]    
-    # Tz range should be as minimum as Tx and Ty
-    if (yrange[2] < yrange[0]): yrange[2] = yrange[0]    
-
-    # Rx and Ry should have the same range
-    if (yrange[3] > yrange[4]): 
-        yrange[4] = yrange[3]
-    else:
-        yrange[3] = yrange[4]   
-    # Rz range should be as minimum as Rx and Ry
-    #if (yrange[5] < yrange[3]): yrange[5] = yrange[3]    
-
-    # prepare the legend
-    myLegend = TLegend(0.65,0.65,0.92,0.92)
-    
-    # loop dof by dof (Tx, Ty...) and fill a polyline with teh corrections for each iteration
-    if (doDebug): 
-        print " ** drawCorrEvolution ** lowerDof=", lowerDof, "  upperDof = ", upperDof
-    #for dof in range(nUsedDofs):
-    for dof in range(lowerDof, upperDof+1):
-        if (doDebug): 
-            print " ** drawCorrEvolution ** going to draw dof=", dof
-        ThisCanvas.cd()
-        if (drawAllDofs): 
-            ThisCanvas.cd(dof+1)
-            
-        name = detector[0].GetModule(0).GetDoF(dof)[0]
-        hname = 'Dof_%s_corrections_Evol' % (name)
-        htitle = 'Corrections evolution for %s' % (name)
-        if (doDebug): 
-            print " ** drawCorrEvolution ** dof=", dof, " hname  = ", hname
-            print "                     htitle = ", htitle
-        # this histogram is the main frame
-        hCorrectionsEvol[dof] = TH1F(hname, htitle, numOfIterations-1, -0.5, numOfIterations*1.-1.5)
-        # set the x axis labels
-        if (numOfIterations > 12):
-            hCorrectionsEvol[dof].GetXaxis().SetLabelSize(0.03)
-            hCorrectionsEvol[dof].GetXaxis().SetBit(18)
-        for iter in range(numOfIterations-1): # -1 do not include the total sum in the plot
-            hCorrectionsEvol[dof].GetXaxis().SetBinLabel(iter+1,'Iter_%d' % (iter))
-            if (len(labelList)>iter): # use label given by user
-                hCorrectionsEvol[dof].GetXaxis().SetBinLabel(iter+1,labelList[iter])
-        # label Y axis
-        if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx':
-            hCorrectionsEvol[dof].SetYTitle("mm")
-        else:
-            hCorrectionsEvol[dof].SetYTitle("mrad")
-        hCorrectionsEvol[dof].GetYaxis().SetRangeUser(-yrange[dof],yrange[dof])
-        hCorrectionsEvol[dof].SetStats(False)
-        hCorrectionsEvol[dof].DrawCopy()
-        gPad.SetGridx()
-        gPad.SetGridy()
-
-    #once the frame is plotted, loop on every structure and fill a histogram and draw it
-        print "  .. dealing with", name, "corrections .. with range for this dof: (",dof,")   range: +-",yrange[dof]
-        print " ** ==> numOfAlignableStruct = ",numOfAlignableStruct
-        for struct in range(numOfAlignableStruct):
-        #for struct in range(0,2):
-            if (doDebug): print " >> looping on struct:", struct
-            hCorrectionsEvolStruct[dof]={}
-            hname = 'Dof_%s_corrections_Evol_struct_%d' % (name, struct)
-            htitle = 'Corrections evolution for structure %s (struct %d)' % (name, struct)
-            hCorrectionsEvolStruct[dof][struct] = TH1F(hname, htitle, numOfIterations, -0.5, numOfIterations*1.-0.5)
-            hCorrectionsEvolStruct[dof][struct].SetLineColor(EvolColor[struct])
-            hCorrectionsEvolStruct[dof][struct].SetStats(False)
-            # once the histogram is created, fill it with the corrections of each iteration
-            accumvalue=0
-            for iter in range(numOfIterations-1): # -1 to account for the overall integration
-                value = detector[iter].GetModule(struct).GetDoF(dof)[1]
-                accumvalue = accumvalue+value
-                # if (doDebug): print " dof:",dof, "  struct:",struct,"  iter:",iter,"  delta=",value
-                hCorrectionsEvolStruct[dof][struct].SetBinContent(iter+1, value)
-                # if (doDebug): print "hCorrectionsEvolStruct[",dof,"][",struct,"].SetBinContent(",iter+1,",", value,")" 
-                if (drawErrors): hCorrectionsEvolStruct[dof][struct].SetBinError(iter+1, detector[iter].GetModule(struct).GetDoFError(dof)[1])
-                # now draw the corrections for this structure
-            if (doDebug): print "Accumulated", hname, ":", accumvalue
-            # store the accumulated    
-            if (dof == 0): detector[numOfIterations-1].GetModule(struct).setTx(accumvalue)
-            if (dof == 1): detector[numOfIterations-1].GetModule(struct).setTy(accumvalue)
-            if (dof == 2): detector[numOfIterations-1].GetModule(struct).setTz(accumvalue)
-            if (dof == 3): detector[numOfIterations-1].GetModule(struct).setRx(accumvalue)
-            if (dof == 4): detector[numOfIterations-1].GetModule(struct).setRy(accumvalue)
-            if (dof == 5): detector[numOfIterations-1].GetModule(struct).setRz(accumvalue)
-            if (dof == 6): detector[numOfIterations-1].GetModule(struct).setBx(accumvalue)
-            if (drawErrors): 
-                hCorrectionsEvolStruct[dof][struct].SetFillColor(EvolColor[struct])
-                hCorrectionsEvolStruct[dof][struct].SetFillStyle(3354)
-                # hCorrectionsEvolStruct[dof][struct].DrawCopy('same e3')
-                # --> original hCorrectionsEvolStruct[dof][struct].DrawCopy('same e3')
-                hCorrectionsEvolStruct[dof][struct].SetMarkerStyle(20)
-                hCorrectionsEvolStruct[dof][struct].SetMarkerSize(0.5)
-                hCorrectionsEvolStruct[dof][struct].SetMarkerColor(EvolColor[struct])
-                hCorrectionsEvolStruct[dof][struct].DrawCopy('same p e3 x0')
-                for iter in range(numOfIterations-1):
-                    hCorrectionsEvolStruct[dof][struct].SetBinError(iter+1, 0)
-                hCorrectionsEvolStruct[dof][struct].SetFillStyle(0)
-                hCorrectionsEvolStruct[dof][struct].DrawCopy('same l')
-
-            else:
-                myOption = "same"
-                if (drawLine): 
-                    myOption += " l"
-                else:
-                    myOption += " p"
-                    hCorrectionsEvolStruct[dof][struct].SetMarkerStyle(20)
-                    hCorrectionsEvolStruct[dof][struct].SetMarkerColor(EvolColor[struct])
-                        
-                hCorrectionsEvolStruct[dof][struct].DrawCopy(myOption)
-            gPad.Update()
-            if (dof == nUsedDofs-1 and False): 
-                myLegend.AddEntry(hCorrectionsEvolStruct[dof][struct],detector[0].GetModule(struct).GetName(), "l")
-                myLegend.Draw()
-                gPad.Update()    
-        
-    return ThisCanvas
-
-#######################################################################
-# new version of the drawCorrEvolution
-#############################################################
-def drawCorrEvolution(detector, labelList, drawErrors=False, drawLine=True, whichdof=-1, outputFormat=1):
-    from ROOT import TCanvas
-    from ROOT import TH1F
-    from ROOT import gPad
-    from ROOT import TLegend
-    from ROOT import TLine
-    import time
-    import os
-    #check with environment variable if server runs as local test 
-    runLocalTest = False
-    try:
-        runLocalTest = os.getenv('RUNLOCALTEST', False)
-    except:
-        runLocalTest = False
-
-    doDebug = True
-    showErrors = True
-    drawAllDofs = True
-    nUsedDofs = 7
-
-    if (whichdof != -1):
-        drawAllDofs = False 
-        if (whichdof > 5): nUsedDofs = 7 # 7/oct/2015 with the BowX we may have up to 7 dofs. Unless stated draw the ordinary 6.
-
-    lowerDof = 0;
-    upperDof = 6;
-
-    if (not drawAllDofs):
-        lowerDof = whichdof
-        upperDof = whichdof
-
-    # output formats
-    ALLINONE = 1
-    ONEBYONE = 2
-    SPLITBYSTRUCT = 3
-
-    Alldetector = {} # list of canvas 
-    finalName = ["","","","","","",""] #name of the output files
-
-    gridALLENTRIES = 1
-    gridNEWRUN = 2
-    xGridType = gridNEWRUN
-    
-    #    
-    pathfiles = "."
-    if (runLocalTest): 
-        pathfiles = "/Users/martis/projectes/atlas/alineament/webmonitoringtest/InDetAlignmentWebMonitor/trunk/WebPage/constant/"
-
-    plotfile = {}
-
-    rootSetup()
-    
-    # -- start the body of the code --
-    if (doDebug):    
-        print "\n -- drawCorrEvolution -- START -- \n"
-        print "              runLocalTest= ",runLocalTest
-        print "                 pathfiles= ",pathfiles
-        print "              outputFormat= ",outputFormat
-        
-    
-    # list of the histograms 
-    hCorrectionsEvol = {}
-    hCorrectionsEvolStruct={}
-    # min axis range for each dof
-    #         Tx     Ty     Tz     Rx    Ry    Rz    Bx
-    yrange = [0.002, 0.002, 0.002, 0.01, 0.01, 0.01, 0.002] # minimum is 0.001 (mm or mrad)
-
-    # here detector = num of iterations
-    numberOfSamples = len(detector)
-    if (doDebug): print " -- drawCorrEvolution -- numberOfSamples=", numberOfSamples
-    numOfAlignableStruct = detector[0].nModules()
-    if (doDebug): print " numOfAlignableStructe=", numOfAlignableStruct
-    EvolColor = AutoColors(numOfAlignableStruct)    
-   
-    # a canvas for all dofs
-    ThisCanvas = TCanvas("AlignmentCorrectionsEvol","Evolution of alignment corrections (All)",920,600)
-    if (drawAllDofs and outputFormat == ALLINONE): ThisCanvas.Divide(3,2)
-
-        
-    # find out range
-    #for i in range(lowerDof, upperDof):
-    for i in range (nUsedDofs):
-        for iter in range(numberOfSamples):
-            for bin in range(detector[iter].nModules()):
-                thisValue = abs(detector[iter].GetModule(bin).GetDoF(i)[1])+ detector[iter].GetModule(bin).GetDoFError(i)[1]
-                if abs(thisValue)>yrange[i]:
-                    yrange[i] = thisValue
-        yrange[i] *= 1.025
-        if (doDebug): print " dof=",i," --> range: ",yrange[i]
-
-    #        
-    #  --- Y range of the plots --- cap the drawing range 
-    # maximum range
-    maxTransRange = 0.100
-    if (yrange[0]> maxTransRange): yrange[0] = maxTransRange       
-    if (yrange[1]> maxTransRange): yrange[1] = maxTransRange       
-    if (yrange[2]> maxTransRange): yrange[2] = maxTransRange       
-    if (yrange[6]> maxTransRange): yrange[6] = maxTransRange #Bx       
-            
-    # Tx and Ty should have the same range
-    if (yrange[0] > yrange[1]): 
-        yrange[1] = yrange[0]
-    else:
-        yrange[0] = yrange[1]    
-    # Tz range should be as minimum as Tx and Ty
-    if (yrange[2] < yrange[0]): yrange[2] = yrange[0]    
-
-    #Bx range --> keep it independent
-                
-    # Rx and Ry should have the same range
-    if (yrange[3] > yrange[4]): 
-        yrange[4] = yrange[3]
-    else:
-        yrange[3] = yrange[4]  
-         
-    # Rz keep it independent
-
-
-    #yrange[0] = 0.004
-    yrange[1] = 0.0065
-    #yrange[2] = 0.040
-    #yrange[3] = 0.04
-    #yrange[4] = 0.04
-    #yrange[5] = 0.06
-    yrange[6] = 0.0025
-
-    #
-    # prepare the legend
-    #
-    myLegend = TLegend(0.80,0.85,0.99,0.99)
-    myLegend.SetFillColor(0) # white
-    # and a line to split the runs if xGridType = gridNEWRUN
-    myGridLine = TLine()
-    myGridLine.SetLineStyle(3);
-    
-    # loop dof by dof (Tx, Ty...) and fill a polyline with teh corrections for each iteration
-    if (doDebug): 
-        print " -- drawCorrEvolution -- going to draw form lowerDof=", lowerDof, " to upperDof = ", upperDof
-        
-    #for dof in range(nUsedDofs):
-    for dof in range(lowerDof, upperDof+1):
-    #for dof in range(lowerDof, 6):
-        # extract dof name
-        name = detector[0].GetModule(0).GetDoF(dof)[0]
-        if (doDebug): 
-            print "\n -- drawCorrEvolution -- going to draw dof= %d (%s)" %(dof,name)
-
-        #dealing with canvases
-        if (outputFormat == ALLINONE):   
-            ThisCanvas.cd()
-            if (drawAllDofs): 
-                ThisCanvas.cd(dof+1)
-        if (outputFormat == ONEBYONE):  
-            Alldetector[dof] = {}
-            Alldetector[dof] = TCanvas("AlignCorrectionsEvol_%s" %(name), "Alignment_corrections_evolution_%s" %(name), 920, 600)
-            print " -- drawCorrEvolution -- new canvas declared %s" %Alldetector[dof].GetName()
-        if (outputFormat == SPLITBYSTRUCT): 
-            Alldetector[dof] = {}
-            Alldetector[dof] = TCanvas("AlignCorrectionsEvol_%s_byDOF" %(name), "Alignment_corrections_evolution_%s_byDOF" %(name), 920, 600)
-            if (numOfAlignableStruct >= 15):
-                Alldetector[dof].Divide(5,3)
-                print " -- drawCorrEvolution -- Divide (5x3)"
-            print " -- drawCorrEvolution -- new canvas declared %s for %d structures" %(Alldetector[dof].GetName(), numOfAlignableStruct)
-
-        # prepare the histogram that will store the corrections 
-        hname = 'Dof_%s_corrections_Evol' % (name)
-        htitle = 'Evolution of %s corrections' % (name)
-        htitle = 'Evolution of d%s/dLB corrections' % (name)
-        if (doDebug): 
-            print " -- drawCorrEvolution -- dof= %d  hname= %s" %(dof, hname)
-            print "                                 htitle= ", htitle
-
-        # build the histogram that is the main frame to plot the corrections for this dof (evolution of dof for each sample)
-        hCorrectionsEvol[dof] = TH1F(hname, htitle, numberOfSamples-1, -0.5, numberOfSamples*1.-1.5) # the last sample is the accumulation
-
-        # set the x axis labels
-        hCorrectionsEvol[dof].GetXaxis().SetLabelSize(0.05)
-        if (numberOfSamples > 8): # this is in case there are too many
-            hCorrectionsEvol[dof].GetXaxis().SetLabelSize(0.04)
-            hCorrectionsEvol[dof].GetXaxis().SetBit(18)
-            if (numberOfSamples > 16): # reduce further the size
-                hCorrectionsEvol[dof].GetXaxis().SetLabelSize(0.03)
-            if (numberOfSamples > 24): # reduce further the size
-                hCorrectionsEvol[dof].GetXaxis().SetLabelSize(0.02)
-        hCorrectionsEvol[dof].GetXaxis().SetLabelSize(0.05)
-        hCorrectionsEvol[dof].GetYaxis().SetLabelSize(0.05)
-            
-        for iter in range(numberOfSamples): 
-            hCorrectionsEvol[dof].GetXaxis().SetBinLabel(iter+1,'Iter_%d' % (iter))
-            if (len(labelList)>iter): # use label given by user
-                hCorrectionsEvol[dof].GetXaxis().SetBinLabel(iter+1,labelList[iter])
-
-        # label of the Y axis
-        if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx':
-            hCorrectionsEvol[dof].SetYTitle("mm")
-            hCorrectionsEvol[dof].SetYTitle("dTy/dLB [mm/25LB]")
-        else:
-            hCorrectionsEvol[dof].SetYTitle("mrad")
-
-        # set the range     
-        hCorrectionsEvol[dof].GetYaxis().SetRangeUser(-yrange[dof],yrange[dof])
-        hCorrectionsEvol[dof].SetStats(False)
-        # going to draw the frame 
-        # -be ware, in case of drawing by structure need to change to the right pad
-        if (outputFormat == ALLINONE or outputFormat == ONEBYONE):
-            hCorrectionsEvol[dof].DrawCopy()
-            gPad.SetGridy()
-            if (xGridType == gridALLENTRIES): gridPad.SetGridx()
-
-            
-        # draw the frame
-        #hCorrectionsEvol[dof].DrawCopy()
-        #gPad.SetGridx()
-        #gPad.SetGridy()
-
-        #
-        # once the frame is plotted, loop on every structure and fill a histogram and draw it
-        #
-        if (doDebug):
-            print "  -- drawCorrEvolution --  dealing with", name, "corrections. Y range for this dof: (",dof,")   range: +-",yrange[dof]
-            print "                           reminder: numOfAlignableStruct = ",numOfAlignableStruct
-
-        #for struct in range(numOfAlignableStruct):
-        for struct in range(2):
-            if (doDebug and False): print " >> looping on struct:", struct
-            if (outputFormat == SPLITBYSTRUCT): 
-                Alldetector[dof].cd(struct+1)
-                # then draw frame
-                hCorrectionsEvol[dof].DrawCopy()
-                gPad.SetGridy()
-                if (xGridType == gridALLENTRIES): gridPad.SetGridx()
-            hCorrectionsEvolStruct[dof]={}
-            hname = 'Dof_%s_corrections_Evol_struct_%d' % (name, struct)
-            htitle = 'Corrections evolution for structure %s (struct %d)' % (name, struct)
-            hCorrectionsEvolStruct[dof][struct] = TH1F(hname, htitle, numberOfSamples-1, -0.5, numberOfSamples*1.-1.5) # last point is for the accumulation --> do not show
-            #print " -- drawCorrEvolution -- hCorrectionsEvolStruct has ",hCorrectionsEvolStruct[dof][struct].GetNbinsX(), ' bins in X'
-            hCorrectionsEvolStruct[dof][struct].SetLineColor(EvolColor[struct])
-            hCorrectionsEvolStruct[dof][struct].SetStats(False)
-            # once the histogram is created, fill it with the corrections of each iteration
-
-            currentLabel = "000000" # dummy value
-            for iterval in range(numberOfSamples):  
-                value = detector[iterval].GetModule(struct).GetDoF(dof)[1]
-
-                # derivatives
-                if (iterval == 0): value = 0
-                if (iterval>0): value = (detector[iterval].GetModule(struct).GetDoF(dof)[1] - detector[iterval-1].GetModule(struct).GetDoF(dof)[1])
-                print " iterval ", iterval, "   dx=", value, "   +-",detector[iterval].GetModule(struct).GetDoFError(dof)[1]
-                hCorrectionsEvolStruct[dof][struct].SetBinContent(iterval+1, value)
-                if (drawErrors): hCorrectionsEvolStruct[dof][struct].SetBinError(iterval+1, detector[iterval].GetModule(struct).GetDoFError(dof)[1])
-                # check the label in case it needs to be marked
-                if (xGridType == gridNEWRUN and len(labelList)>0 and iterval < len(labelList)):
-                    thisLabel = labelList[iterval]
-                    if (thisLabel != currentLabel and "LB" in thisLabel):
-                        # new run found
-                        currentLabel = thisLabel
-                        #print " thisLabel = ", thisLabel,"  iterval = ",iterval  
-                        myGridLine.DrawLine(iterval, -yrange[dof], iterval, yrange[dof])
-                
-            # now draw the corrections for this structure
-            if (drawErrors): 
-                hCorrectionsEvolStruct[dof][struct].SetFillColor(EvolColor[struct])
-                hCorrectionsEvolStruct[dof][struct].SetFillStyle(3354)
-                # hCorrectionsEvolStruct[dof][struct].DrawCopy('same e3')
-                # --> original hCorrectionsEvolStruct[dof][struct].DrawCopy('same e3')
-                hCorrectionsEvolStruct[dof][struct].SetMarkerStyle(20)
-                hCorrectionsEvolStruct[dof][struct].SetMarkerSize(0.5)
-                hCorrectionsEvolStruct[dof][struct].SetMarkerColor(EvolColor[struct])
-                hCorrectionsEvolStruct[dof][struct].DrawCopy('same p e3 x0')
-                for iterval in range(numberOfSamples):
-                    hCorrectionsEvolStruct[dof][struct].SetBinError(iterval+1, 0)
-                hCorrectionsEvolStruct[dof][struct].SetFillStyle(0)
-                hCorrectionsEvolStruct[dof][struct].DrawCopy('l x0 e3 same')
-
-            else:
-                myOption = "same"
-                if (drawLine): 
-                    myOption += " l"
-                else:
-                    myOption += " p"
-                    hCorrectionsEvolStruct[dof][struct].SetMarkerStyle(20)
-                    hCorrectionsEvolStruct[dof][struct].SetMarkerColor(EvolColor[struct])
-                        
-                hCorrectionsEvolStruct[dof][struct].DrawCopy(myOption)
-            gPad.Update()
-            #if (dof == 0 and True): 
-            if (True): 
-                if (dof==0): myLegend.AddEntry(hCorrectionsEvolStruct[dof][struct],detector[0].GetModule(struct).GetName(), "l")
-                myLegend.Draw()
-                gPad.Update()    
-
-        t = time.time()
-        finalName[dof] = "%f_evolution_%s" %(t, name)
-        gPad.Update()
-        if (outputFormat == ONEBYONE or outputFormat == SPLITBYSTRUCT):
-            #print " -- drawCorrEvol -- saving plots from ONEBYONE " 
-            Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".png", "png")
-            Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".pdf", "pdf")
-            #Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".root", "root")
-            #Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".C", "C")
-
-    if (outputFormat == ALLINONE):
-        #print " -- drawCorrEvol -- saving plots from ALLINONE " 
-        t = time.time()
-        myFinalName = "%f_evolution_dofs" %(t)
-        ThisCanvas.SaveAs(pathfiles+myFinalName + ".png","png")
-        ThisCanvas.SaveAs(pathfiles+myFinalName + ".pdf","pdf")
-        plotfile['png']={0:myFinalName + ".png"}
-        plotfile['pdf']={0:myFinalName + ".pdf"}
-        
-    if (outputFormat == ONEBYONE or outputFormat == SPLITBYSTRUCT):            
-        plotfile['png']={0:finalName[0] + ".png", 1:finalName[1] + ".png", 2:finalName[2] + ".png", 3:finalName[3] + ".png", 4:finalName[4] + ".png", 5:finalName[5] + ".png", 6:finalName[6] + ".png"}
-        plotfile['pdf']={0:finalName[0] + ".pdf", 1:finalName[1] + ".pdf", 2:finalName[2] + ".pdf", 3:finalName[3] + ".pdf", 4:finalName[4] + ".pdf", 5:finalName[5] + ".pdf", 6:finalName[6] + ".pdf"}
-
-    #return plotfile
-    return ThisCanvas
-
-#######################################################################
-def drawCorrVsHits(detector):
-    from ROOT import TCanvas
-    from ROOT import TGraph
-    from array import array
-    from ROOT import gPad
-    CorrVsHits = TCanvas("CorrVsHits", "Alignment Corrections vs hits")
-    CorrVsHits.Divide(3,2)
-    hCorrVsHits = {}
-    Color = AutoColors(len(detector))
-    for det in detector:
-        hCorrVsHits[det] = {}
-        for i in range(6):
-            CorrVsHits.cd(i+1)
-            name, value = detector[det].GetModule(0).GetDoF(i)
-            hname = 'CorrVsHits_%s_corrections_%d' % (name,det)
-            htitle = '%s Corrections vs hits_%d' % (name,det)
-            xpoints = []
-            ypoints = []
-            for j in range(detector[det].nModules()):
-                xpoints.append(detector[det].GetModule(j).Hits)
-                ypoints.append(detector[det].GetModule(j).GetDoF(i)[1])
-            x = array("f",xpoints)
-            y = array("f",ypoints)
-            hCorrVsHits[det][name] = TGraph(detector[det].nModules(),x,y)
-            hCorrVsHits[det][name].SetTitle(htitle)
-            hCorrVsHits[det][name].GetXaxis().SetTitle("Hits per module")
-            hCorrVsHits[det][name].GetYaxis().SetTitle(name)
-            if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx':
-                hCorrVsHits[det][name].GetYaxis().SetTitle(name+" (mm)")
-            else:
-                hCorrVsHits[det][name].GetYaxis().SetTitle(name+" (mrad)")
-            hCorrVsHits[det][name].SetMarkerStyle(4)
-            hCorrVsHits[det][name].SetMarkerSize(0.5)
-            hCorrVsHits[det][name].SetMarkerColor(Color[det])
-            if det==0:
-                hCorrVsHits[det][name].Draw("Ap")
-            else:
-                hCorrVsHits[det][name].Draw("psame")
-            gPad.SetGridx()
-            gPad.SetGridy()
-            gPad.SetLogx()
-    CorrVsHits.Update()
-    return CorrVsHits, hCorrVsHits  
-    
-def drawPixBarrelCorrDistributions(detector):
-    from ROOT import TCanvas
-    from ROOT import TH1F
-    from ROOT import gPad
-    PixBarrelCorrDistributions = TCanvas("PixBarrelCorrDistributions","Pixel Barrel Corrections Distributions")
-    PixBarrelCorrDistributions.Divide(3,2)
-    hPixBarrelCorrDistributions = {}
-    detname = "Pixel Barrel"
-    Color = AutoColors(len(detector))
-    for d in detector:
-        hPixBarrelCorrDistributions[d] = {}
-        for i in range(6):
-            PixBarrelCorrDistributions.cd(i+1)
-            name, value = detector[d].GetModule(0).GetDoF(i)
-            hname = '%s_%sCorrections_%d' % (detname,name,d)
-            htitle = '%s %s Corrections' % (detname,name)
-            if name is 'Tx':
-                hPixBarrelCorrDistributions[d][name] = TH1F(hname,htitle,50,-0.005,0.005)
-            elif name is 'Ty':
-                hPixBarrelCorrDistributions[d][name] = TH1F(hname,htitle,50,-0.02,0.02)
-            else:
-                hPixBarrelCorrDistributions[d][name] = TH1F(hname,htitle,50,-0.25,0.25)
-            if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx':
-                hPixBarrelCorrDistributions[d][name].GetXaxis().SetTitle(name+" (mm)")
-            else:
-                hPixBarrelCorrDistributions[d][name].GetXaxis().SetTitle(name+" (mrad)")    
-            
-            hPixBarrelCorrDistributions[d][name].GetYaxis().SetTitle("Modules")
-            hPixBarrelCorrDistributions[d][name].SetLineColor(Color[d])
-            for module in detector[d].ReturnPixelBarrelModules():
-                hPixBarrelCorrDistributions[d][name].Fill(module.GetDoF(i)[1])
-            if d == 0:
-                hPixBarrelCorrDistributions[d][name].Draw()
-            else:
-                hPixBarrelCorrDistributions[d][name].Draw("Same")   
-            gPad.SetGridx()
-            gPad.SetGridy()
-    PixBarrelCorrDistributions.Update()
-    return PixBarrelCorrDistributions, hPixBarrelCorrDistributions  
-    
-def drawSctBarrelCorrDistributions(detector):
-    from ROOT import TCanvas
-    from ROOT import TH1F
-    from ROOT import gPad
-    SctBarrelCorrDistributions = TCanvas("SctBarrelCorrDistributions","SCT Barrel Corrections Distributions")
-    SctBarrelCorrDistributions.Divide(3,2)
-    hSctBarrelCorrDistributions = {}
-    detname = "SCT Barrel"
-    Color = AutoColors(len(detector))
-    for d in detector:
-        hSctBarrelCorrDistributions[d] = {}
-        for i in range(6):
-            SctBarrelCorrDistributions.cd(i+1)
-            name, value = detector[d].GetModule(0).GetDoF(i)
-            hname = '%s_%sCorrections_%d' % (detname,name,d)
-            htitle = '%s %s Corrections' % (detname,name)
-            if name is 'Tx':
-                hSctBarrelCorrDistributions[d][name] = TH1F(hname,htitle,50,-0.005,0.005)
-            elif name is 'Ty':
-                hSctBarrelCorrDistributions[d][name] = TH1F(hname,htitle,50,-0.1,0.1)
-            else:
-                hSctBarrelCorrDistributions[d][name] = TH1F(hname,htitle,50,-0.25,0.25)
-            if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx':
-                hSctBarrelCorrDistributions[d][name].GetXaxis().SetTitle(name+" (mm)")
-            else:
-                hSctBarrelCorrDistributions[d][name].GetXaxis().SetTitle(name+" (mrad)")    
-            
-            hSctBarrelCorrDistributions[d][name].GetYaxis().SetTitle("Modules")
-            hSctBarrelCorrDistributions[d][name].SetLineColor(Color[d])
-            for module in detector[d].ReturnSctBarrelModules():
-                hSctBarrelCorrDistributions[d][name].Fill(module.GetDoF(i)[1])
-            if d == 0:
-                hSctBarrelCorrDistributions[d][name].Draw()
-            else:
-                hSctBarrelCorrDistributions[d][name].Draw("Same")   
-            gPad.SetGridx()
-            gPad.SetGridy()
-    SctBarrelCorrDistributions.Update()
-    return SctBarrelCorrDistributions, hSctBarrelCorrDistributions
-        
-def drawL3CorrVsHits(detector,det,bec):
-    from ROOT import TCanvas
-    from ROOT import TGraph
-    from array import array
-    from ROOT import gPad       
-    if det == 1:
-        if bec == None:
-            detname = "PIX"
-        elif bec == 0:
-            detname = "PIXBarrel"
-        elif bec == -1:
-            detname = "PIXECC"
-        elif bec == 1:
-            detname = "PIXECA"
-        
-    elif det == 2:
-        if bec == None:
-            detname = "SCT"
-        elif bec == 0:
-            detname = "SCTBarrel"
-        elif bec == -1:
-            detname = "SCTECC"
-        elif bec == 1:
-            detname = "SCTECA"
-        
-    L3CorrVsHits = TCanvas(detname+"CorrVsHits", detname+" Alignment Corrections vs hits")
-    L3CorrVsHits.Divide(3,2)
-    hCorrVsHits = {}
-    Color = AutoColors(len(detector))
-    for d in detector:
-        hCorrVsHits[d] = {}
-        for i in range(6):
-            L3CorrVsHits.cd(i+1)
-            name, value = detector[d].GetModule(0).GetDoF(i)
-            hname = '%s_CorrVsHits_%s_corrections' % (detname,name)
-            htitle = '%s %s Corrections vs hits' % (detname,name)
-            xpoints = []
-            ypoints = []
-            for j in detector[d].ReturnModules(det,bec):
-                xpoints.append(detector[d].GetModule(j).Hits)
-                ypoints.append(detector[d].GetModule(j).GetDoF(i)[1])
-            x = array("f",xpoints)
-            y = array("f",ypoints)
-            hCorrVsHits[d][name] = TGraph(len(x),x,y)
-            hCorrVsHits[d][name].SetTitle(htitle)
-            hCorrVsHits[d][name].GetXaxis().SetTitle("Hits per module")
-            hCorrVsHits[d][name].GetYaxis().SetTitle(name)
-            if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx':
-                hCorrVsHits[d][name].GetYaxis().SetTitle(name+" (mm)")
-            else:
-                hCorrVsHits[d][name].GetYaxis().SetTitle(name+" (mrad)")
-            hCorrVsHits[d][name].SetMarkerStyle(4)
-            hCorrVsHits[d][name].SetMarkerSize(0.5)
-            hCorrVsHits[d][name].SetMarkerColor(Color[d])
-            if d == 0:
-                hCorrVsHits[d][name].Draw("Ap")
-            else:
-                hCorrVsHits[d][name].Draw("Ap")
-            
-            gPad.SetGridx()
-            gPad.SetGridy()
-    L3CorrVsHits.Update()
-    return L3CorrVsHits, hCorrVsHits    
-    
-    
-def drawStavePlots(detector,det):   
-    from ROOT import TCanvas
-    from ROOT import TH1F
-    from ROOT import gPad
-    StavePlots = {}
-    if det == 1:
-        Lay = [0,1,2]
-        Phi = [22,38,52]
-        detname = "PIX"
-    if det == 2:
-        Lay = [0,1,2,3]
-        Phi = [32,40,48,56]
-        detname = "SCT"
-    ncanvas = 0
-    for lay in Lay:
-        for phi in range(Phi[lay]):
-            StavePlots[ncanvas] = TCanvas("Stave%sPlots_L%d_Phi%d" %(detname, lay,phi),"Stave Plots %s L%d Phi%d" %(detname,lay,phi))
-            StavePlots[ncanvas].Divide(3,2)
-            stavemodules = detector.ReturnModules(det,0,lay,phi)
-            hStaveCorrections = {}
-            for i in range(6):
-                StavePlots[ncanvas].cd(i+1)
-                name, value = detector.GetModule(0).GetDoF(i)
-                hname = 'Stave_%s_L%d_Phi%d_%s_corrections' % (detname,lay,phi,name)
-                htitle = 'Stave %s L%d Phi%d %s Corrections' % (detname,lay,phi,name)
-                hStaveCorrections[name] = TH1F(hname,htitle, len(stavemodules),0,len(stavemodules))
-                if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx':
-                    hStaveCorrections[name].SetYTitle("mm")
-                else:
-                    hStaveCorrections[name].SetYTitle("mrad")
-                bin = 1
-                for mod in stavemodules:
-                    hStaveCorrections[name].SetBinContent(bin,detector.GetModule(mod).GetDoF(i)[1])
-                    bin = bin+1
-    
-                #hStaveCorrections[name].Draw()
-                XAxis = hStaveCorrections[name].GetXaxis()
-                XAxis.CenterLabels()
-                bin = 1
-                for mod in stavemodules:
-                    XAxis.SetBinLabel(bin,str(detector.GetModule(mod).Eta))
-                    bin = bin + 1
-                hStaveCorrections[name].SetStats(False)
-                hStaveCorrections[name].DrawCopy()
-                gPad.SetGridx()
-                gPad.SetGridy()
-            ncanvas = ncanvas + 1
-    return StavePlots
-    
-def drawStaves(detector):
-    StavePlots = []
-    if detector.CountModules(1,0) > 0:
-        StavePlots.append(drawStavePlots(detector,1))
-    if detector.CountModules(2,0) > 0:
-        StavePlots.append(drawStavePlots(detector,2))
-    return StavePlots   
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/fileutils.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/fileutils.py
deleted file mode 100644
index f3c7268aaca1a964f8662c40d2a3af9c2692cd9f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/fileutils.py
+++ /dev/null
@@ -1,231 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-DoFStrings = ['Tx','Ty','Tz','Rx','Ry','Rz','Bx']
-OutputLevel = 1
-
-runWebMonitor = False
-runLocalTest = False
-    
-def openFile(file):
-    try:
-        file = open(file)               # open file
-    except:
-        print "The file ", file, "doesn't exist"
-    else:
-        return file.read()
-    
-def writeCorr(outputfile, detector):
-    alignOutput = open(outputfile,'w')
-    text = "%6s %6s %6s %6s %6s %6s %6s %12s %12s %12s %12s %12s %12s %12s\n" % ("module",
-    "Level","Det","Bec","Lay","Phi","Eta","Tx","Ty","Tz","Rx","Ry","Rz","Hits")
-    alignOutput.write(text)
-    alignOutput.write(detector.PrintValues())
-    
-        
-    alignOutput.close()
-    
-def readConstants(file, useBarrels=True,  useEndCaps=True):
-    import imp
-    #print " <fileutils.readconstants> runWebMonitor=",runWebMonitor, "   runLocalTest = ", runLocalTest
-    #from module import Module
-    #from module import Detector
-    if (runWebMonitor):
-        if (runLocalTest):
-            m_utils = imp.load_source('Module', '/Users/martis/projectes/atlas/alineament/webmonitoringtest/InDetAlignmentWebMonitor/trunk/WebPage/plot/module.py')
-            m_utils = imp.load_source('Detector', '/Users/martis/projectes/atlas/alineament/webmonitoringtest/InDetAlignmentWebMonitor/trunk/WebPage/plot/module.py')
-        else:
-            m_utils = imp.load_source('Module', '/var/vhost/atlas-alignment/secure/plot/module.py')
-            m_utils = imp.load_source('Detector', '/var/vhost/atlas-alignment/secure/plot/module.py')
-    else:
-        m_utils = imp.load_source('Module', 'include/moduleutils.py')
-        m_utils = imp.load_source('Detector', 'include/moduleutils.py')   
-
-    alignText = openFile(file).splitlines()
-    # initialize variables
-    level, det, bec, layer, phi, eta = -999,-999,-999,-999,-999,-999
-    Tx, Ty, Tz, Rx, Ry, Rz = 0,0,0,0,0,0
-    counter = -1
-    detector = m_utils.Detector()
-    takeThisModule = True
-
-    # print " useBarrels= ", not useBarrels
-    
-    for line in alignText:
-        if "Alignment parameters for module" in line:
-            line = line[33:]
-            takeThisModule = True
-            # reinitialize variables for each module
-            Tx, Ty, Tz, Rx, Ry, Rz = 0,0,0,0,0,0
-            ETx, ETy, ETz, ERx, ERy, ERz = 0,0,0,0,0,0
-            Bx = 0 # IBL bowX degree of freedom
-            EBx = 0
-            
-            if ("EndCap" in line and not useEndCaps):
-                takeThisModule = False
-                print " ** readConstants ** ** WARNING ** ** EndCap found ** ==> ", line 
-
-            if ((not ("EndCap" in line) and (not useBarrels)) ):
-                takeThisModule = False
-                print " ** readConstants ** ** WARNING ** ** Barrel part found ** ==> ", line 
-
-            if takeThisModule:
-                counter = counter +1
-                detector.addModule(m_utils.Module(counter,line))
-                    
-        elif "Number of hits seen" in line:
-            if (counter >= 0):
-                line = line[25:]
-                detector.GetModule(counter).setHits(int(line))
-        elif "Number of tracks passing" in line:
-            if (counter >= 0):
-                line = line[25:]
-                #print " In Ntracks --> counter:", counter, "  Ntracks: ",line 
-                detector.GetModule(counter).setTracks(int(line))
-        elif "total time spent in solve" in line:
-            #print " ** readConstants ** ** WARNING ** ** DISCARDING REST OF THE FILE ** after counter ", counter 
-            break
-        else:
-            if "Number of hits too small" in line:
-                detector.GetModule(counter).setHits(0)
-            if (takeThisModule):
-                if "Trans" in line or "Rot" in line or "Bow" in line:
-                    if "TransX" in line:
-                        Tx = float(line[10:23])
-                        detector.GetModule(counter).setTx(Tx)
-                        ETx = float(line[27:])
-                        detector.GetModule(counter).setETx(ETx)
-                        # if (counter < 10): print " Tx: ", Tx,"  ETx: ", ETx
-                    elif "TransY" in line:
-                        Ty = float(line[10:23])
-                        detector.GetModule(counter).setTy(Ty)
-                        ETy = float(line[27:])
-                        detector.GetModule(counter).setETy(ETy)
-                    elif "TransZ" in line:
-                        Tz = float(line[10:23])
-                        detector.GetModule(counter).setTz(Tz)
-                        ETz = float(line[27:])
-                        detector.GetModule(counter).setETz(ETz)
-                    elif "RotX" in line:
-                        Rx = float(line[10:23])
-                        detector.GetModule(counter).setRx(1000*Rx)
-                        ERx = float(line[27:])
-                        detector.GetModule(counter).setERx(1000*ERx)
-                    elif "RotY" in line:
-                        Ry = float(line[10:23])
-                        detector.GetModule(counter).setRy(1000*Ry)
-                        ERy = float(line[27:])
-                        detector.GetModule(counter).setERy(1000*ERy)
-                    elif "RotZ" in line:
-                        Rz = float(line[10:23])
-                        detector.GetModule(counter).setRz(1000*Rz)
-                        ERz = float(line[27:])
-                        detector.GetModule(counter).setERz(1000*ERz)
-                    elif "BowX" in line:
-                        Bx = float(line[10:23])
-                        detector.GetModule(counter).setBx(Bx)
-                        EBx = float(line[27:])
-                        detector.GetModule(counter).setEBx(EBx)
-                        print " -----> ",Bx
-
-    #print " ** reading input file. Counter = ", counter
-    if OutputLevel > 0:
-        detector.PrintValues()
-    return detector
-
-def saveConstants(detector,file):
-    from ROOT import TFile
-    from ROOT import TTree
-    from ROOT import gROOT
-    from ROOT import AddressOf
-    f = TFile(file,'RECREATE')
-    t = TTree('Corrections','Corrections')
-    
-    gROOT.ProcessLine(\
-        "struct MyStruct{\
-            Int_t index;\
-            Int_t type;\
-            Int_t bec;\
-            Int_t layer;\
-            Int_t sector;\
-            Int_t ring;\
-            Int_t hits;\
-            Double_t tx;\
-            Double_t ty;\
-            Double_t tz;\
-            Double_t rx;\
-            Double_t ry;\
-            Double_t rz;\
-            Double_t etx;\
-            Double_t ety;\
-            Double_t etz;\
-            Double_t erx;\
-            Double_t ery;\
-            Double_t erz;\
-        };")
-    from ROOT import MyStruct
-    # Create branches in the tree
-    s = MyStruct()
-    t.Branch('index',AddressOf(s,'index'),'index/I')
-    t.Branch('type',AddressOf(s,'type'),'type/I')
-    t.Branch('bec',AddressOf(s,'bec'),'bec/I')
-    t.Branch('layer',AddressOf(s,'layer'),'layer/I')
-    t.Branch('sector',AddressOf(s,'sector'),'sector/I')
-    t.Branch('ring',AddressOf(s,'ring'),'ring/I')
-    t.Branch('hits',AddressOf(s,'hits'),'hits/I')
-    t.Branch('tx',AddressOf(s,'tx'),'tx/D')
-    t.Branch('ty',AddressOf(s,'ty'),'ty/D')
-    t.Branch('tz',AddressOf(s,'tz'),'tz/D')
-    t.Branch('rx',AddressOf(s,'rx'),'rx/D')
-    t.Branch('ry',AddressOf(s,'ry'),'ry/D')
-    t.Branch('rz',AddressOf(s,'rz'),'rz/D')
-    t.Branch('etx',AddressOf(s,'etx'),'etx/D')
-    t.Branch('ety',AddressOf(s,'ety'),'ety/D')
-    t.Branch('etz',AddressOf(s,'etz'),'etz/D')
-    t.Branch('erx',AddressOf(s,'erx'),'erx/D')
-    t.Branch('ery',AddressOf(s,'ery'),'ery/D')
-    t.Branch('erz',AddressOf(s,'erz'),'erz/D')
-    t.SetMarkerStyle(20)
-    #print detector
-    for i in range(detector.nModules()):
-        detector.GetModule(i)
-        s.index = i
-        if "Pixel" in detector.GetModule(i).Det:
-            det = 1
-        elif "SCT" in detector.GetModule(i).Det:
-            det = 2
-        elif "TRT" in detector.GetModule(i).Det:
-            det = 3
-        else:
-            det = 0
-        s.type = det
-        
-        if "Barrel" in detector.GetModule(i).BarrelEC:
-            bec = 0
-        elif "EndCapA" in detector.GetModule(i).BarrelEC or "EndcapA" in detector.GetModule(i).BarrelEC:
-            bec = -1
-        elif "EndCapC" in detector.GetModule(i).BarrelEC or "EndcapC" in detector.GetModule(i).BarrelEC:
-            bec = 1
-        else:
-            bec = 999
-        s.bec = bec 
-        s.layer = int(detector.GetModule(i).Layer)
-        s.sector = int(detector.GetModule(i).PhiModule)
-        s.ring = int(detector.GetModule(i).EtaModule)
-        s.hits = int(detector.GetModule(i).Hits)
-        s.tx = detector.GetModule(i).Tx
-        s.ty = detector.GetModule(i).Ty
-        s.tz = detector.GetModule(i).Tz
-        s.rx = detector.GetModule(i).Rx
-        s.ry = detector.GetModule(i).Ry
-        s.rz = detector.GetModule(i).Rz
-        s.bx = detector.GetModule(i).Bx
-        s.etx = detector.GetModule(i).ETx
-        s.ety = detector.GetModule(i).ETy
-        s.etz = detector.GetModule(i).ETz
-        s.erx = detector.GetModule(i).ERx
-        s.ery = detector.GetModule(i).ERy
-        s.erz = detector.GetModule(i).ERz
-        s.ebx = detector.GetModule(i).EBx
-        t.Fill()
-    f.Write()
-    f.Close()
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/moduleutils.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/moduleutils.py
deleted file mode 100644
index 62d844c4116cc540720c021b26a25cd5fb80e4c1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/moduleutils.py
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-class Module:
-    def __init__(self, index, FullName):
-        self.index = index
-        self.FullName = FullName
-        self.Tx = 0
-        self.Ty = 0
-        self.Tz = 0
-        self.Rx = 0
-        self.Ry = 0
-        self.Rz = 0
-        self.Bx = 0
-        self.ETx = 0
-        self.ETy = 0
-        self.ETz = 0
-        self.ERx = 0
-        self.ERy = 0
-        self.ERz = 0
-        self.EBx = 0
-        self.Hits = 0
-        self.Tracks = 0
-        self.Det = "None"
-        self.PhiStave = "999"
-        self.Layer = "999"
-        self.Halfshell = "999"
-        self.PhiModule = "999"
-        self.EtaModule = "999"
-        self.BarrelEC = "None"
-        
-        self.ExtractInfo(self.FullName)
-    
-    
-    def ExtractInfo(self,FullName):
-        split = FullName.split('/')
-        if len(split) is 1:
-            # Level 1 has different handling :(
-            split = FullName.split(' ')
-            self.Det = split[0]
-            if "Barrel" in FullName:
-                self.BarrelEC = split[1]
-            elif "EndCap" in FullName:
-                self.BarrelEC = split[1]+split[2]
-            elif "Pixel" in FullName:
-                self.BarrelEC = "All"
-        else:
-            self.Det = split[0]
-        
-        if "Barrel" in FullName or "Endcap" in FullName:
-            self.BarrelEC = split[1]
-        if "Layer" in FullName or "Disk" in FullName:
-            tmpname = split[2]
-            self.Layer = tmpname[tmpname.find("_")+1:]
-        if "PhiStave" in FullName:
-            tmpname = split[3]
-            self.PhiStave = tmpname[tmpname.find("_")+1:]
-        if "Phi" in FullName:
-            tmpname = split[3]
-            self.PhiModule = tmpname[tmpname.find("_")+1:]
-        if "Eta" in FullName:
-            tmpname = split[4]
-            self.EtaModule = tmpname[tmpname.find("_")+1:]
-
-        # TRT case
-        if "TRT" in FullName:
-            thissplit = FullName.split('/')
-            known = 0
-            if (len(thissplit)>2): 
-                indices = thissplit[2].split('_')
-                known = 1
-            if ("Barrel" in FullName and known == 1): 
-                self.BarrelEC = thissplit[1] # barrel
-                self.EtaModule = 0 # no barrel ring segmentation
-                self.Layer = indices[3]
-                self.PhiModule = indices[2]
-                #print " Full Name = ",FullName,split,indices
-             
-            
-    def __str__(self):
-        info = """Module Corrections, index: %d,  Name: %s\n
-%20s %20s %20s %20s %20s %20s %20s \n       
-%20s %20s %20s %20s %20s %20s
-
-        """ % (self.index, str(self.FullName),
-        "Det: " + self.Det, "BarrelEC: " + self.BarrelEC, " Layer: " + str(self.Layer), " PhiStave: "+ str(self.PhiStave), " HalfShell: "+self.Halfshell, " PhiModule: "+str(self.PhiModule), " EtaModule: "+ str(self.EtaModule), 
-        "Tx: "+str(self.Tx)[:10]+ " mm","Ty: "+str(self.Ty)[:10]+ " mm","Tz: "+str(self.Tz)[:10]+ " mm",
-        "Rx: "+str(self.Rx)[:10]+ " mrad","Ry: "+str(self.Ry)[:10]+ " mrad","Rz: "+str(self.Rz)[:10]+ " mrad")
-        return info
-    
-    def PrintValues(self):
-    #   info = "%6s %6s %6s %6s %6s %6s %6s %12s %12s %12s %12s %12s %12s %12s\n" % (str(self.index),
-        info = "%s %s %s %s %s %s %s %s %s\n" % (str(self.index),                                   
-        str(self.Tx)[:12],str(self.Ty)[:12],str(self.Tz)[:12],
-        str(self.Rx)[:12],str(self.Ry)[:12],str(self.Rz)[:12],
-        str(self.Bx)[:12],str(self.Hits))
-        return info
-        
-        
-    def setTx(self, Tx):
-        self.Tx = Tx
-    def setTy(self, Ty):
-        self.Ty = Ty
-    def setTz(self, Tz):
-        self.Tz = Tz
-    def setRx(self, Rx):
-        self.Rx = Rx
-    def setRy(self, Ry):
-        self.Ry = Ry
-    def setRz(self, Rz):
-        self.Rz = Rz
-    def setBx(self, Bx):
-        self.Bx = Bx
-    def setETx(self, ETx):
-        self.ETx = ETx
-    def setETy(self, ETy):
-        self.ETy = ETy
-    def setETz(self, ETz):
-        self.ETz = ETz
-    def setERx(self, ERx):
-        self.ERx = ERx
-    def setERy(self, ERy):
-        self.ERy = ERy
-    def setERz(self, ERz):
-        self.ERz = ERz
-    def setEBx(self, EBx):
-        self.EBx = EBx
-        
-    def setHits(self,hits):
-        self.Hits = hits
-        
-    def setTracks(self, tracks):
-        self.Tracks = tracks
-        
-    def GetDoF(self, DoF):
-        if DoF == 0:
-            return "Tx",self.Tx
-        elif DoF == 1:
-            return "Ty",self.Ty
-        elif DoF == 2:
-            return "Tz",self.Tz
-        elif DoF == 3:
-            return "Rx",self.Rx
-        elif DoF == 4:
-            return "Ry",self.Ry
-        elif DoF == 5:
-            return "Rz",self.Rz
-        elif DoF == 6:
-            return "Bx",self.Bx
-        else:
-            return "Unknown", 0
-            
-    def GetDoFError(self, DoF):
-        if DoF == 0:
-            return "ETx",self.ETx
-        elif DoF == 1:
-            return "ETy",self.ETy
-        elif DoF == 2:
-            return "ETz",self.ETz
-        elif DoF == 3:
-            return "ERx",self.ERx
-        elif DoF == 4:
-            return "ERy",self.ERy
-        elif DoF == 5:
-            return "ERz",self.ERz
-        elif DoF == 6:
-            return "EBx",self.EBx
-        else:
-            return "Unknown", 0
-
-    def GetName(self):
-        return self.FullName
-    def GetDet(self):
-        return self.Det 
-    def GetBarrelEC(self):
-        return self.BarrelEC
-    def GetLayer(self):
-        return self.Layer
-class Detector:
-    def __init__(self):
-        self.det = {}
-    def __str__(self):
-        info = ""
-        for i in range(self.nModules()):
-            info = info + 140*"-"+"\n"+ self.GetModule(i).__str__()+"\n"
-        return info
-            
-    def addModule(self,Module):
-        index = Module.index
-        self.det[index]=Module
-    
-    def nModules(self):
-        return len(self.det)
-    
-    def GetModule(self,index):
-        return self.det[index]
-            
-    def PrintValues(self):
-        values = ""
-        for i in range(self.nModules()):
-            values = values+self.GetModule(i).PrintValues()
-        return values
-        
-    def ReturnPixelBarrelModules(self,layer=-1):
-        modlist = []
-        for i in self.det:
-            if "Pixel" in self.det[i].GetDet() and "Barrel" in self.det[i].GetBarrelEC():
-                if layer is -1:
-                    modlist.append(self.det[i])
-                else:
-                    if self.det[i].GetLayer() is layer:
-                        modlist.append(self.det[i])
-        return modlist
-        
-    def ReturnSctBarrelModules(self,layer=-1):
-        modlist = []
-        for i in self.det:
-            if "SCT" in self.det[i].GetDet() and "Barrel" in self.det[i].GetBarrelEC():
-                if layer is -1:
-                    modlist.append(self.det[i])
-                else:
-                    if self.det[i].GetLayer() is layer:
-                        modlist.append(self.det[i])
-        return modlist
-if __name__ == '__main__':
-    a = Module(0,"Pixel/Barrel/Layer_1/PhiStave_0")
-    det = Detector()
-    det.addModule(a)
-
-    print det.nModules()
-    print det
-    print det.GetModule(0)
-
-    
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/style.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/style.cc
deleted file mode 100755
index e7ba1f57e01b3f88e6edb8575c4e951d6b454ba8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/style.cc
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include <TROOT.h>
-#include <TStyle.h>
-#include <TGaxis.h>
-#include <TPaveText.h>
-#include <TPaveStats.h>
-
-const Int_t NContLevels = 50;
-Int_t RM_ColorIndex[NContLevels];
-float RM_Levels[NContLevels];
-const int iNPIX_Layers = 3;
-const int iNPIX_Discs = 3;
-const int iNSCT_Layers = 4;
-const int iNSCT_Discs = 9;
-
-void setStyle() {
-	if (AtlasStyle) {
-		gROOT->SetStyle("ATLAS");
-		ColorForSecond = kRed;
-		ColorForFirst	= kGray;
-		// Extra options to the ATLAS Style
-		Float_t jsize = 0.04;
-	
-		gStyle->SetLabelSize(jsize,"x");
-		gStyle->SetLabelSize(jsize,"y");
-		gStyle->SetLabelSize(jsize-0.01,"z");
-	
-		gStyle->SetTitleSize(jsize,"x");	
-		gStyle->SetTitleSize(jsize,"y");
-		gStyle->SetTitleSize(jsize,"z");
-		gStyle->SetTextFont(42);
-	
-		gStyle->SetStripDecimals(false);		
-		TGaxis::SetMaxDigits(4);
-		gStyle->SetPalette(1);
-	}
-	else{
-	 // Default options
-	 	ColorForSecond = kRed;
-		ColorForFirst	= kGray;
-		Float_t isize = 0.04;
-		font = 42;
-
-		gStyle->SetOptStat(111110);
-
-		gStyle->SetCanvasColor(kWhite);	
-		gStyle->SetCanvasBorderMode(0);
-		gStyle->SetCanvasBorderSize(0);
-
-		gStyle->SetPadBorderMode(0);
-
-		gStyle->SetLabelFont(font,"X");
-		gStyle->SetLabelFont(font,"Y");
-		gStyle->SetLabelFont(font,"Z");
-		gStyle->SetLabelSize(isize,"x");
-		gStyle->SetLabelSize(isize,"y");
-		gStyle->SetLabelSize(isize-0.01,"z");
-
-		gStyle->SetTitleFont(font,"x");
-		gStyle->SetTitleFont(font,"y");
-		gStyle->SetTitleFont(font,"z");
-		gStyle->SetTitleSize(isize,"x");	
-		gStyle->SetTitleSize(isize,"y");
-		gStyle->SetTitleSize(isize,"z");
-		gStyle->SetTitleYOffset(1.5);
-
-		gStyle->SetOptFit(0);
-
-		gStyle->SetStatW(0.3);
-		//	gStyle->SetStatH(0.15);
-		gStyle->SetStatColor(kWhite);	
-		gStyle->SetStatFont(font);
-		gStyle->SetStatFontSize(isize);
-		// gStyle->SetStatStyle(0); // to view data behind box too!
-		// gStyle->SetStatBorderSize(0);	 // remove shade from stat box
-	
-		gStyle->SetStripDecimals(false);
-		TGaxis::SetMaxDigits(4);
-
-		gStyle->SetTextFont(font);
-
-		gStyle->SetFrameBorderMode(0);
-
-		gStyle->SetPalette(1);
-
-		gStyle->SetPaintTextFormat("g");
-
-		gStyle->SetPadLeftMargin(0.12);
-		gStyle->SetPadRightMargin(0.10);
-		gStyle->SetPadTopMargin(0.12);
-		// gStyle->SetPadBottomMargin(0.15);
-	}
-	
-	gROOT->ForceStyle();
-}
-
-
-void ScalePlots(Int_t position) {
-	if (normalizePlots) {
-		TLatex *t2 = new TLatex();
-		Char_t name[150];
-		t2->SetNDC();
-		t2->SetTextFont(font);
-		t2->SetTextSize(0.08);
-		t2->SetTextAlign(12);
-		t2->SetTextSize(0.035);
-		t2->SetTextColor(kRed);
-		sprintf(name,"Normalized plots");
-		if(!AtlasStyle){
-			if (position==0) {
-				t2->SetTextAngle(270);
-				t2->DrawLatex(0.93,0.37,name);
-			}
-			else
-				t2->DrawLatex(0.3,0.91,name);
-		}
-		else {
-			if (position==0) {
-				t2->SetTextAngle(270);
-				t2->DrawLatex(0.97,0.47,name);
-			}
-			else
-				t2->DrawLatex(0.3,0.91,name);
-		}
-	}
-}
-
-//=====================================================================
-//  setTitleFont()
-//=====================================================================
-void setTitleFont(Int_t font) {
-  if (!AtlasStyle) {
-    gPad->Update();
-    TPaveText *pt = (TPaveText*)(gPad->GetPrimitive("title"));
-    pt->SetTextFont(font);
-    pt->SetTextSize(0.04);
-    gPad->Modified();
-  }
-}
-
-void setTitleSize(double x2Size) {
-	if (!AtlasStyle) {
-		gPad->Update();
-		TPaveText *pt = (TPaveText*)(gPad->GetPrimitive("title"));
-		pt->SetX2NDC(x2Size);
-		gPad->Modified();
-	}
-}
-
-//=====================================================================
-//  ForceStyle()
-//=====================================================================
-void ForceStyle(TH1F* histoIn1D) {
-	histoIn1D->GetXaxis()->SetLabelFont(42);
-	histoIn1D->GetXaxis()->SetTitleFont(42);
-	histoIn1D->GetYaxis()->SetLabelFont(42);
-	histoIn1D->GetYaxis()->SetTitleFont(42);
-	histoIn1D->GetYaxis()->SetTitleOffset(1.5);
-}
-
-/////////////////////////////
-void SetHistoAtt(TH1 *histo){
-  ///////////////////////////// 
-  histo->SetStats(kFALSE);  
-  histo->GetXaxis()->SetLabelSize(0.03);
-  histo->GetXaxis()->SetTitleSize(0.04);
-  histo->GetYaxis()->SetLabelSize(0.03);
-  histo->GetYaxis()->SetTitleSize(0.04);
-  histo->GetZaxis()->SetLabelSize(0.03);
-}
-
-void SetHistoAtt(TH2 *histo){
-  ///////////////////////////// 
-  histo->SetStats(kFALSE);  
-  histo->GetXaxis()->SetLabelSize(0.03);
-  histo->GetXaxis()->SetTitleSize(0.04);
-  histo->GetYaxis()->SetLabelSize(0.03);
-  histo->GetYaxis()->SetTitleSize(0.04);
-  histo->GetZaxis()->SetLabelSize(0.03);
-}
-
-//=====================================================================
-//  moveTPaveStats()
-//=====================================================================
-void moveTPaveStats(TH2F* histoIn2D) {
-  if (!AtlasStyle) {
-    TPaveStats *st1 = (TPaveStats*)histoIn2D->FindObject("stats"); 
-    st1->SetX1NDC(0.56); //new x start position
-    st1->SetX2NDC(0.89); //new x start position
-    st1->SetY1NDC(0.80); //new y end position
-    st1->SetOptStat(1110);
-    st1->Draw();
-  }
-}
-
-
-
-/////////////////////////////////////////////////////////////////////
-int locateColor(const int ncols, float min, float max, float cont){
-  /////////////////////////////////////////////////////////////////////
-  float val[100];
-  float step = (max-min)/ncols;
-
-  val[0] = min + step/2;
-  for(int i=1; i<ncols; i++)
-    val[i] = val[i-1] + step;
-
-  if(cont<=val[0])
-    return 0;
-  else if(cont >= val[ncols-1])
-    return ncols-1;
-  else{
-    for(int i=1; i<ncols; i++){
-      if(cont>=val[i-1] && cont<val[i]){
-		return i;
-      }    
-    }
-  }
-  return 0;
-}
-
-void SetZAxisTitle(TH2F *histo2D,
-	                 Float_t X1, Float_t X2,
-	                 Float_t Y1, Float_t Y2) {
-	
-	// moving the color scale
-	gPad->Update();
-	TPaletteAxis *palette = (TPaletteAxis*)histo2D->GetListOfFunctions()->FindObject("palette");
-	palette->SetX1NDC(X1);
-	palette->SetX2NDC(X2);
-	palette->SetY1NDC(Y1);
-	palette->SetY2NDC(Y2);
-	gPad->Modified();
-	
-	TLatex *t = new TLatex();
-	t->SetNDC();
-	t->SetTextFont(font);
-	t->SetTextSize(0.041);
-	t->DrawLatex(X1-0.01,0.90,"res (#mum)");
-	
-	return;
-}
-
-void draw_pixel_ec_modules(TH1F *histo){
-  //////////////////////////////////////////////////////
-  const int npixmods=48;  
-  const float min = histo->GetMinimum();
-  const float max = histo->GetMaximum();
-
-  TPolyLine *p[npixmods];
-  double x[5], y[5];
-
-  const float phistep = 2*TMath::Pi()/npixmods;
-  const float inr =  5; 
-  const float our = 10; 
-
-  for(int i=0; i<npixmods; i++){
-    for(int j=0; j<5; j++){
-      x[j]=0;
-      y[j]=0;
-    }
-
-    float phi = -i*phistep;
-
-    x[0] = inr*cos(phi-phistep/2);
-    x[1] = inr*cos(phi+phistep/2);
-    x[2] = our*cos(phi+phistep/2);
-    x[3] = our*cos(phi-phistep/2);
-    x[4] = inr*cos(phi-phistep/2);
-
-    y[0] = inr*sin(phi-phistep/2);
-    y[1] = inr*sin(phi+phistep/2);
-    y[2] = our*sin(phi+phistep/2);
-    y[3] = our*sin(phi-phistep/2);
-    y[4] = inr*sin(phi-phistep/2);
-
-    int col_index = locateColor(gStyle->GetNumberOfColors(), 
-				min, max, 
-				histo->GetBinContent(i+1));
-    p[i] = new TPolyLine(5,x,y);
-    p[i]->SetFillColor(gStyle->GetColorPalette(col_index));
-  }
-
-  for(int i=0; i<npixmods; i++)
-    p[i]->Draw("Fsame");
-  setTitleFont(font);
-
-}
-
-void SCTMaps_SetXaxisLabels(TH2F *histoMap)
-{
-  for (Int_t bin=1; bin<= histoMap->GetNbinsX(); bin++) {
-    if (bin== 1) histoMap->GetXaxis()->SetBinLabel(bin,"-6");   
-    if (bin== 2) histoMap->GetXaxis()->SetBinLabel(bin,"-5");   
-    if (bin== 3) histoMap->GetXaxis()->SetBinLabel(bin,"-4");   
-    if (bin== 4) histoMap->GetXaxis()->SetBinLabel(bin,"-3");   
-    if (bin== 5) histoMap->GetXaxis()->SetBinLabel(bin,"-2");   
-    if (bin== 6) histoMap->GetXaxis()->SetBinLabel(bin,"-1");   
-    if (bin== 7) histoMap->GetXaxis()->SetBinLabel(bin,"1");   
-    if (bin== 8) histoMap->GetXaxis()->SetBinLabel(bin,"2");   
-    if (bin== 9) histoMap->GetXaxis()->SetBinLabel(bin,"3");   
-    if (bin==10) histoMap->GetXaxis()->SetBinLabel(bin,"4");   
-    if (bin==11) histoMap->GetXaxis()->SetBinLabel(bin,"5");   
-    if (bin==12) histoMap->GetXaxis()->SetBinLabel(bin,"6");   
-  }
-  return;
-}
-
-void draw_sct_ec_modules(TH2F *histo, int disc) {
-//////////////////////////////////////////////////////
-  /*  Number of rings (i.e, module type) in each disk. 
-      Values mean:
-      1 : outers
-      2 : outers + middles
-      3 : outers + middles + inners       
-  */
-
-  const int nrings[9]={2,3,3,3,3,3,2,2,1};
-  
-  // number of modules in each ring
-  const int nmods[3]={52,40,40};
-
-  float inner_radius[3]={ 7.5, 4.9, 3.4};
-  float outer_radius[3]={10.0, 7.4, 4.8};
-  // the one before the last wheel has short middle modules
-  if (disc==7) {
-    inner_radius[1]=6.0;
-  }
-
-  TPolyLine *p[52];
-  double x[5], y[5];
-
-  const float min = histo->GetMinimum();
-  const float max = histo->GetMaximum();
-
-  // loop in rings within disk
-  for(int ring=0; ring<nrings[disc]; ring++){    
-    
-    const float phistep = 2*TMath::Pi()/nmods[ring];
-    const float inr = inner_radius[ring]; 
-    const float our = outer_radius[ring]; 
-
-    // loop in modules within ring
-    for(int mod=0; mod<nmods[ring]; mod++){
-
-      for(int j=0; j<5; j++){
-	x[j]=0;
-	y[j]=0;
-      }
-
-      // clockwise if looking z-axis into the page
-      float phi = -mod*phistep; 
-      
-      x[0] = inr*cos(phi-phistep/2);
-      x[1] = inr*cos(phi+phistep/2);
-      x[2] = our*cos(phi+phistep/2);
-      x[3] = our*cos(phi-phistep/2);
-      x[4] = inr*cos(phi-phistep/2);
-      
-      y[0] = inr*sin(phi-phistep/2);
-      y[1] = inr*sin(phi+phistep/2);
-      y[2] = our*sin(phi+phistep/2);
-      y[3] = our*sin(phi-phistep/2);
-      y[4] = inr*sin(phi-phistep/2);
-
-      int col_index = locateColor(gStyle->GetNumberOfColors(), 
-      				  min, max, 
-				  histo->GetBinContent(ring+1,mod+1));
-      p[mod] = new TPolyLine(5,x,y);
-      if( histo->GetBinContent(ring+1,mod+1)> -1000000) p[mod]->SetFillColor(gStyle->GetColorPalette(col_index));
-      else  p[mod]->SetFillColor(kBlack);
-     
-      if (false) {
-	cout << " -- draw_sct_ec_modules -- disk: " << disc << "  ring: " << ring << "  module: " << mod << "   Entries: " <<  histo->GetBinContent(ring+1,mod+1) << endl;
-      }
-
-    } // end loop in modules
-
-    for(int mod=0; mod<nmods[ring]; mod++)
-      p[mod]->Draw("Fsame");
-      
-  } // end loop in rings
-
-  return;
-}
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/CosmicSegments.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/CosmicSegments.cc
deleted file mode 100644
index 88206fa4af1df0e0c8c4650a0e111636e16c6aca..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/CosmicSegments.cc
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void CosmicSegments(TString trkCol){
-	pixelResiduals(trkCol, NULL, "");
-}
-
-void CosmicSegments(TString trkCol, TCanvas *myCanvas[]){
-	CosmicSegments(trkCol, myCanvas, "");
-}
-
-void CosmicSegments(TString trkCol_1, TCanvas *myCanvas[], TString trkCol_2) {
-  cout << " <CosmicSegments> collections: " << trkCol_1.Data() << endl;
-  
-  TString histname;
-  TH1F* myHisto;
-  TH2F* myHisto2D;
-  TProfile *myProfile;
-
-  std::vector <TString> TrackCollection;
-  if (trkCol_1 != "") TrackCollection.push_back(trkCol_1);
-  if (trkCol_2 != "") TrackCollection.push_back(trkCol_2);
-  if (myCanvas[0] != NULL) myCanvas[0]->Divide(3,2);
-  if (myCanvas[1] != NULL) myCanvas[1]->Divide(3,2);
-  if (myCanvas[2] != NULL) myCanvas[2]->Divide(3,2);
-  if (myCanvas[3] != NULL) myCanvas[3]->Divide(3,2);
-  if (myCanvas[4] != NULL) myCanvas[4]->Divide(3,2);
-
-
-  for (int i=0; i < (int) TrackCollection.size(); i++) {
-
-    // silicon hits
-    myCanvas[0]->cd(i*3+1);
-    // check if pixel histos exist
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/nhits_pixUp";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("Pixel hits"); 
-      myHisto->DrawCopy();
-    }
-    else {// in older version pix and sct hist were not there
-      myCanvas[0]->cd(i*3+2);
-      histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/nhits_siUp";
-      cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-      myHisto = (TH1F*)file->Get(histname);
-      if (myHisto != NULL) {
-	myHisto->GetXaxis()->SetTitle("Hits in silicon"); 
-	myHisto->DrawCopy();
-      }
-    }
-
-    // SCT hits
-    myCanvas[0]->cd(i*3+2);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/nhits_sctUp";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("SCT hits"); 
-      myHisto->DrawCopy();
-    }
-
-    // TRT hits
-    myCanvas[0]->cd(i*3+3);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/nhits_trtUp";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("Hits in TRT"); 
-      myHisto->DrawCopy();
-    }
-
-    // pix hits in low segment
-    myCanvas[0]->cd(i*3+4);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/nhits_pixLow";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("Hits in silicon"); 
-      myHisto->DrawCopy();
-    }
-    else {
-      // silicon hits
-      myCanvas[0]->cd(i*3+5);
-      histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/nhits_siLow";
-      cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-      myHisto = (TH1F*)file->Get(histname);
-      if (myHisto != NULL) {
-	myHisto->GetXaxis()->SetTitle("Hits in silicon"); 
-	myHisto->DrawCopy();
-      }
-    }
-
-    // SCT hits
-    myCanvas[0]->cd(i*3+5);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/nhits_sctLow";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("SCT hits"); 
-      myHisto->DrawCopy();
-    }
-
-    // TRT hits
-    myCanvas[0]->cd(i*3+6);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/nhits_trtLow";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("Hits in TRT"); 
-      myHisto->DrawCopy();
-    }
-
-    ///////////////////////////////////////
-    // Upper segments track parameters
-    ///////////////////////////////////////
-    myCanvas[1]->cd(i*3+1);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Upper_d0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("d_{0} [mm]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[1]->cd(i*3+2);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Upper_z0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("z_{0} [mm]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[1]->cd(i*3+3);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Upper_phi0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#phi_{0} [rad]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[1]->cd(i*3+4);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Upper_eta0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#eta"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[1]->cd(i*3+5);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Upper_qOverPt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("q/p_{T} [GeV^{-1}]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[1]->cd(i*3+6);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Upper_Pt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("p_{T} [GeV]"); 
-      myHisto->DrawCopy();
-    }
-
-
-    // Lower segments track parameters
-    myCanvas[2]->cd(i*3+1);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Lower_d0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("d_{0} [mm]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[2]->cd(i*3+2);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Lower_z0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("z_{0} [mm]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[2]->cd(i*3+3);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Lower_phi0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#phi_{0} [rad]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[2]->cd(i*3+4);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Lower_eta0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#eta"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[2]->cd(i*3+5);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Lower_qOverPt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("q/p_{T} [GeV^{-1}]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[2]->cd(i*3+6);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/Lower_Pt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("p_{T} [GeV]"); 
-      myHisto->DrawCopy();
-    }
-
-
-    // Delta = Upper-lower segments track parameters
-    myCanvas[3]->cd(i*3+1);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_d0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#Delta d_{0} [mm]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[3]->cd(i*3+2);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_z0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#Delta z_{0} [mm]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[3]->cd(i*3+3);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_phi0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#Delta #phi_{0} [rad]"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[3]->cd(i*3+4);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_eta0";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#Delta #eta"); 
-      myHisto->DrawCopy();
-    }
-
-    myCanvas[3]->cd(i*3+5);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_pt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#Delta p_{T} [GeV]"); 
-      myHisto->DrawCopy();
-    }
-
-    // Delta vs pt = Upper-lower segments track parameters vs Pt
-    myCanvas[4]->cd(i*3+1);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_d0VsPt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto2D = (TH2F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto2D->GetXaxis()->SetTitle("Track p_{T} [GeV]"); 
-      myHisto2D->GetYaxis()->SetTitle("#Delta d_{0} [mm]"); 
-      // myHisto2D->DrawCopy("colz");
-      myProfile = myHisto2D->ProfileX();
-      SymmetricYaxis(myProfile, true, true);
-      myProfile->SetStats(kFALSE);
-      myProfile->SetMarkerStyle(20);
-      myProfile->GetYaxis()->SetTitle("#Delta d_{0} [mm]"); 
-      myProfile->DrawCopy();
-      gPad->SetGridx();
-      gPad->SetGridy();
-    }
-
-    myCanvas[4]->cd(i*3+2);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_z0VsPt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto2D = (TH2F*)file->Get(histname);
-    if (myHisto2D != NULL) {
-      myHisto2D->GetXaxis()->SetTitle("Track p_{T} [GeV]"); 
-      myHisto2D->GetYaxis()->SetTitle("#Delta z_{0} [mm]"); 
-      //      myHisto2D->DrawCopy("colz");
-      myProfile = myHisto2D->ProfileX();
-      SymmetricYaxis(myProfile, true, true);
-      myProfile->SetStats(kFALSE);
-      myProfile->SetMarkerStyle(20);
-      myProfile->GetYaxis()->SetTitle("#Delta z_{0} [mm]"); 
-      myProfile->DrawCopy();
-      gPad->SetGridx();
-      gPad->SetGridy();
-    }
-
-    myCanvas[4]->cd(i*3+3);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_phi0VsPt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto2D = (TH2F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto2D->GetXaxis()->SetTitle("Track p_{T} [GeV]"); 
-      myHisto2D->GetYaxis()->SetTitle("#Delta #phi_{0} [rad]"); 
-      myHisto2D->DrawCopy("colz");
-      myProfile = myHisto2D->ProfileX();
-      SymmetricYaxis(myProfile, true, true);
-      myProfile->GetYaxis()->SetTitle("#Delta #phi_{0} [rad]"); 
-      myProfile->SetStats(kFALSE);
-      myProfile->SetMarkerStyle(20);
-      myProfile->DrawCopy();
-      gPad->SetGridx();
-      gPad->SetGridy();
-    }
-
-    myCanvas[4]->cd(i*3+4);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/delta_eta0VsPt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto2D = (TH2F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto2D->GetXaxis()->SetTitle("Track p_{T} [GeV]"); 
-      myHisto2D->GetXaxis()->SetTitle("#Delta #eta"); 
-      myHisto2D->DrawCopy("colz");
-      myProfile = myHisto2D->ProfileX();
-      SymmetricYaxis(myProfile, true, true);
-      myProfile->SetStats(kFALSE);
-      myProfile->GetYaxis()->SetTitle("#Delta #eta"); 
-      myProfile->SetMarkerStyle(20);
-      myProfile->DrawCopy();
-      gPad->SetGridx();
-      gPad->SetGridy();
-    }
-
-    myCanvas[4]->cd(i*3+5);
-    histname = "IDAlignMon/"+TrackCollection.at(i)+"/TrackSegments/reldelta_pt";
-    cout << " Histname ("<< i <<") = " << histname.Data() << endl;
-    myHisto = (TH1F*)file->Get(histname);
-    if (myHisto != NULL) {
-      myHisto->GetXaxis()->SetTitle("#Delta p_{T} [relative]"); 
-      myHisto->DrawCopy();
-      gPad->SetGridx();
-      gPad->SetGridy();
-    }
-
-
-
-  }
-  
-  return;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/SymmetricYaxis.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/SymmetricYaxis.cc
deleted file mode 100644
index 06a34ac1099cb516c376da1f18dc62313e41487e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/SymmetricYaxis.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//
-// Macro that makes the range of a hisogram symmetric
-//
-void SymmetricYaxis(TProfile *myHist, bool IncludingErrors, bool AroundZero)
-{
-  double CurrentMax = -99999999.; // initialization to a silly value
-  double CurrentMin =  99999999.;
-  double FinalMax, FinalMin;
-  double thismax, thismin;
-  for (int bin=1; bin<= myHist->GetNbinsX(); bin++){
-    thismax = myHist->GetBinContent(bin);
-    thismin = thismax;
-
-    if (IncludingErrors) thismax += myHist->GetBinError(bin);
-    if (IncludingErrors) thismin -= myHist->GetBinError(bin);
-
-    if (thismax > CurrentMax) CurrentMax = thismax;
-    if (thismin < CurrentMin) CurrentMin = thismin;
-  }
-
-  // cout << " <SymmetricYaxis> " << CurrentMax << " --> " << CurrentMin << endl;
-  double gap = CurrentMax - CurrentMin;
-  
-  if (AroundZero) {
-    CurrentMax += 0.05*gap;
-    CurrentMin -= 0.05*gap;
-    // cout << " <SymmetricYaxis> " << CurrentMax << " --> " << CurrentMin << endl;
-    double absoluteMax = fabs(CurrentMax);
-    if (fabs(CurrentMin)> absoluteMax) absoluteMax = fabs(CurrentMin);
-    FinalMax =  absoluteMax;
-    FinalMin = -absoluteMax;
-  }
-  else {
-    double average = (CurrentMax+ CurrentMin)/2;
-    FinalMax = average+0.55*gap;
-    FinalMin = average-0.55*gap;
-  }
-
-  // cout << " <SymmetricYaxis> Final " << FinalMin << " --> " << FinalMax << endl;
-  myHist->SetMaximum(FinalMax);
-  myHist->SetMinimum(FinalMin);
-
-  return;
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errCotTheta.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errCotTheta.cc
deleted file mode 100644
index 6113c8ee08fbc5aacde5162e1e8c61083d9bbf86..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errCotTheta.cc
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void errCotTheta(TString trkCol){
-	errCotTheta(trkCol, 0, "");
-}
-
-void errCotTheta(TString trkCol, TString trkCol2){
-	errCotTheta(trkCol, 0, trkCol2);
-}
-
-void errCotTheta(TString trkCol, TCanvas *cErrCotTheta){
-	errCotTheta(trkCol, cErrCotTheta, "");
-}
-
-void errCotTheta(TString trkCol, TCanvas *cErrCotTheta, TString trkCol2) {
-	gStyle->SetOptStat(0);
-
-	TH1F *hErrCotTheta0;
-	TProfile *hErrCotTheta0VsEta;
-	TProfile *hErrCotTheta0VsPt;
-	TProfile *hErrCotTheta0VsP;
-	TProfile *hErrCotTheta0VsPhi0;
-	//TProfile *hErrCotTheta0VsD0;
-	TH1F *hErrCotTheta0_2;
-	TProfile *hErrCotTheta0VsEta_2;
-	TProfile *hErrCotTheta0VsPt_2;
-	TProfile *hErrCotTheta0VsP_2;
-	TProfile *hErrCotTheta0VsPhi0_2;
-	//TProfile *hErrCotTheta0VsD0_2;
-	
-	cout << " Error CotTheta vs track parameters..." << endl;
-	
-	TString histname;
-	Color_t Color;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	if(!cErrCotTheta)
-		cErrCotTheta = new TCanvas("cErrCotTheta","Error Phi0",
-							CanvasSizeX6[0],CanvasSizeX6[1]);
-							
-	cErrCotTheta->Divide(3,2);
-
-	cErrCotTheta->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errCotTheta";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrCotTheta0 = (TH1F*)file->Get(histname);
-	hErrCotTheta0->SetTitle("Cot Theta Error");
-	hErrCotTheta0->GetXaxis()->SetTitle("#sigma (cot(#theta))");
-	hErrCotTheta0->GetYaxis()->SetTitle("Tracks");
-	hErrCotTheta0->SetLineColor(Color+2);
-	hErrCotTheta0->SetFillColor(Color);
-	hErrCotTheta0->SetFillStyle(3001);
-	hErrCotTheta0->SetMinimum(0.);
-	if (normalizePlots) hErrCotTheta0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrCotTheta0->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errCotTheta";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrCotTheta0_2 = (TH1F*)file->Get(histname);	
-		hErrCotTheta0_2->SetLineColor(ColorForSecond+2);
-		hErrCotTheta0_2->SetFillColor(ColorForSecond);
-		hErrCotTheta0_2->SetLineWidth(1);
-		hErrCotTheta0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrCotTheta0_2->Scale(1./(float)iEvents);
-		hErrCotTheta0_2->DrawCopy("histsame");
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrCotTheta->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errCotThetaVsEta";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrCotTheta0VsEta =((TH2D*)file->Get(histname))->ProfileX();
-	hErrCotTheta0VsEta->SetTitle("#sigma (cot(#theta)) vs #eta");
-	hErrCotTheta0VsEta->GetXaxis()->SetTitle("#eta");
-	hErrCotTheta0VsEta->GetYaxis()->SetTitle("#sigma (cot(#theta))");
-	hErrCotTheta0VsEta->SetLineColor(Color+2);
-	hErrCotTheta0VsEta->SetFillColor(Color);
-	hErrCotTheta0VsEta->SetFillStyle(3001);
-	hErrCotTheta0VsEta->SetMinimum(0.);
-	if (normalizePlots) hErrCotTheta0VsEta->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrCotTheta0VsEta->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errCotThetaVsEta";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrCotTheta0VsEta_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrCotTheta0VsEta_2->SetLineColor(ColorForSecond+2);
-		hErrCotTheta0VsEta_2->SetFillColor(ColorForSecond);
-		hErrCotTheta0VsEta_2->SetLineWidth(1);
-		hErrCotTheta0VsEta_2->SetFillStyle(3001);
-		if (normalizePlots) hErrCotTheta0VsEta_2->Scale(1./(float)iEvents);
-		hErrCotTheta0VsEta_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-	
-	cErrCotTheta->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errCotThetaVsPt";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrCotTheta0VsPt = ((TH2D*)file->Get(histname))->ProfileX();
-	hErrCotTheta0VsPt->SetTitle("#sigma (cot(#theta)) vs pT");
-	hErrCotTheta0VsPt->GetXaxis()->SetTitle("pT (GeV)");
-	hErrCotTheta0VsPt->GetYaxis()->SetTitle("#sigma (cot(#theta))");
-	hErrCotTheta0VsPt->SetLineColor(Color+2);
-	hErrCotTheta0VsPt->SetFillColor(Color);
-	hErrCotTheta0VsPt->SetFillStyle(3001);
-	hErrCotTheta0VsPt->SetMinimum(0.);
-	if (normalizePlots) hErrCotTheta0VsPt->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrCotTheta0VsPt->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errCotThetaVsPt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrCotTheta0VsPt_2 =((TH2D*)file->Get(histname))->ProfileX();
-		hErrCotTheta0VsPt_2->SetLineColor(ColorForSecond+2);
-		hErrCotTheta0VsPt_2->SetFillColor(ColorForSecond);
-		hErrCotTheta0VsPt_2->SetLineWidth(1);
-		hErrCotTheta0VsPt_2->SetFillStyle(3001);
-		if (normalizePlots) hErrCotTheta0VsPt_2->Scale(1./(float)iEvents);
-		hErrCotTheta0VsPt_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrCotTheta->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errCotThetaVsP";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrCotTheta0VsP = ((TH2D*)file->Get(histname))->ProfileX();
-	//gPad->SetLogy();
-	hErrCotTheta0VsP->SetTitle("#sigma (cot(#theta)) vs p");
-	hErrCotTheta0VsP->GetXaxis()->SetTitle("p (GeV)");
-	hErrCotTheta0VsP->GetYaxis()->SetTitle("#sigma (cot(#theta))");
-	hErrCotTheta0VsP->SetLineColor(Color+2);
-	hErrCotTheta0VsP->SetFillColor(Color);
-	hErrCotTheta0VsP->SetFillStyle(3001);
-	hErrCotTheta0VsP->SetMinimum(0.);
-	if (normalizePlots) hErrCotTheta0VsP->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrCotTheta0VsP->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errCotThetaVsP";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrCotTheta0VsP_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrCotTheta0VsP_2->SetLineColor(ColorForSecond+2);
-		hErrCotTheta0VsP_2->SetFillColor(ColorForSecond);
-		hErrCotTheta0VsP_2->SetLineWidth(1);
-		hErrCotTheta0VsP_2->SetFillStyle(3001);
-		if (normalizePlots) hErrCotTheta0VsP_2->Scale(1./(float)iEvents);
-		hErrCotTheta0VsP_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrCotTheta->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errCotThetaVsPhi";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrCotTheta0VsPhi0 = ((TH2D*)file->Get(histname))->ProfileX();
-	//gPad->SetLogy();
-	hErrCotTheta0VsPhi0->SetTitle("#sigma (cot(#theta)) vs #phi0");
-	hErrCotTheta0VsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-	hErrCotTheta0VsPhi0->GetYaxis()->SetTitle("#sigma (cot(#theta))");
-	hErrCotTheta0VsPhi0->SetLineColor(Color+2);
-	hErrCotTheta0VsPhi0->SetFillColor(Color);
-	hErrCotTheta0VsPhi0->SetFillStyle(3001);
-	hErrCotTheta0VsPhi0->SetMinimum(0.);
-	if (normalizePlots) hErrCotTheta0VsPhi0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrCotTheta0VsPhi0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errCotThetaVsPhi";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrCotTheta0VsPhi0_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrCotTheta0VsPhi0_2->SetLineColor(ColorForSecond+2);
-		hErrCotTheta0VsPhi0_2->SetFillColor(ColorForSecond);
-		hErrCotTheta0VsPhi0_2->SetLineWidth(1);
-		hErrCotTheta0VsPhi0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrCotTheta0VsPhi0_2->Scale(1./(float)iEvents);
-		hErrCotTheta0VsPhi0_2->DrawCopy("same");
-	}
-
-	
-
-	//
-	// -----------------------------------------------------------------
-	//
-/*
-	cErrCotTheta->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errCotThetaVsD0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrCotTheta0VsD0 = (TH1F*)file->Get(histname);	
-	hErrCotTheta0VsD0->SetTitle("#sigma (cot(#theta)) vs d0");
-	hErrCotTheta0VsD0->GetXaxis()->SetTitle("#sigma (cot(#theta)) vs d0");
-	hErrCotTheta0VsD0->GetYaxis()->SetTitle("#sigma (cot(#theta))");
-	hErrCotTheta0VsD0->SetLineColor(Color+2);
-	hErrCotTheta0VsD0->SetFillColor(Color);
-	hErrCotTheta0VsD0->SetFillStyle(3001);
-	if (normalizePlots) hErrCotTheta0VsD0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrCotTheta0VsD0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errCotThetaVsD0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrCotTheta0VsD0_2 = (TH1F*)file->Get(histname);	
-		hErrCotTheta0VsD0_2->SetLineColor(ColorForSecond+2);
-		hErrCotTheta0VsD0_2->SetFillColor(ColorForSecond);
-		hErrCotTheta0VsD0_2->SetLineWidth(1);
-		hErrCotTheta0VsD0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrCotTheta0VsD0_2->Scale(1./(float)iEvents);
-		hErrCotTheta0VsD0_2->DrawCopy("same");
-	}
-
-
-*/
-	cErrCotTheta->Update();
-	gStyle->SetOptStat(111110);
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errD0.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errD0.cc
deleted file mode 100644
index 62247a12a3772b4714192281467007dd4170ab35..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errD0.cc
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void errD0(TString trkCol){
-	errD0(trkCol, 0, "");
-}
-
-void errD0(TString trkCol, TString trkCol2){
-	errD0(trkCol, 0, trkCol2);
-}
-
-void errD0(TString trkCol, TCanvas *cErrD0){
-	errD0(trkCol, cErrD0, "");
-}
-
-void errD0(TString trkCol, TCanvas *cErrD0, TString trkCol2) {
-	gStyle->SetOptStat(0);
-	TH1F *hErrD0;
-	TH2D *hTemp;
-	TProfile *hErrD0VsEta;
-	TProfile *hErrD0VsPt;
-	TProfile *hErrD0VsP;
-	TProfile *hErrD0VsPhi0;
-	//TProfile *hErrD0VsD0;
-	TH1F *hErrD0_2;
-	TProfile *hErrD0VsEta_2;
-	TProfile *hErrD0VsPt_2;
-	TProfile *hErrD0VsP_2;
-	TProfile *hErrD0VsPhi0_2;
-	//TProfile *hErrD0VsD0_2;
-	cout << " Error d0..." << endl;
-	
-	TString histname;
-	Color_t Color;
-	bool IsHistogramMissing =false;
-	int  missinghistopad = 0;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	if(!cErrD0)
-		cErrD0 = new TCanvas("cErrD0","Error D0",
-							CanvasSizeX6[0],CanvasSizeX6[1]);
-							
-	cErrD0->Divide(3,2);
-
-	cErrD0->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0";
-	if(PrintLevel>0) cout << " <errD0> Plotting Histogram: " << histname << endl;
-	hErrD0 = (TH1F*)file->Get(histname);
-	if (hErrD0 != NULL ) {
-	  hErrD0->SetTitle("D0 err");
-	  hErrD0->GetXaxis()->SetTitle("#sigma (d0) (mm)");
-	  hErrD0->GetYaxis()->SetTitle("Tracks");
-	  hErrD0->SetLineColor(Color+2);
-	  hErrD0->SetFillColor(Color);
-	  hErrD0->SetFillStyle(3001);
-	  hErrD0->SetMinimum(0.);
-	  if (normalizePlots) hErrD0->Scale(1./(float)iEvents);
-	  if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	  hErrD0->DrawCopy("hist");
-	  setTitleFont(font);
-	  ScalePlots();
-
-	  if(trkCol2 !=""){
-	    histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0";
-	    if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	    hErrD0_2 = (TH1F*)file->Get(histname);	
-	    hErrD0_2->SetLineColor(ColorForSecond+2);
-	    hErrD0_2->SetFillColor(ColorForSecond);
-	    hErrD0_2->SetLineWidth(1);
-	    hErrD0_2->SetFillStyle(3001);
-	    if (normalizePlots) hErrD0_2->Scale(1./(float)iEvents);
-	    hErrD0_2->DrawCopy("histsame");
-	  }
-	}
-	else {
-	  if (!IsHistogramMissing) {
-	    IsHistogramMissing = true;
-	    missinghistopad = 1;
-	  } 
-	}
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrD0->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsEta";
-	hTemp = NULL;
-	hTemp = (TH2D*)file->Get(histname);
-	if (hTemp != NULL) {
-	  hTemp->Print();
-	  hErrD0VsEta = hTemp->ProfileX();
-	  hErrD0VsEta->SetTitle("#sigma(d0) vs #eta");
-	  hErrD0VsEta->GetXaxis()->SetTitle("#eta");
-	  hErrD0VsEta->GetYaxis()->SetTitle("#sigma(d0) (mm)");
-	  hErrD0VsEta->SetLineColor(Color+2);
-	  hErrD0VsEta->SetFillColor(Color);
-	  hErrD0VsEta->SetFillStyle(3001);
-	  hErrD0VsEta->SetMinimum(0.);
-	  if (normalizePlots) hErrD0VsEta->Scale(1./(float)iEvents);
-	  if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	  hErrD0VsEta->DrawCopy("");
-	  setTitleFont(font);
-	  ScalePlots();
-	  if(trkCol2 !=""){
-	    histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsEta";
-	    if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	    hErrD0VsEta_2 = ((TH2D*)file->Get(histname))->ProfileX();
-	    hErrD0VsEta_2->SetLineColor(ColorForSecond+2);
-	    hErrD0VsEta_2->SetFillColor(ColorForSecond);
-	    hErrD0VsEta_2->SetLineWidth(1);
-	    hErrD0VsEta_2->SetFillStyle(3001);
-	    if (normalizePlots) hErrD0VsEta_2->Scale(1./(float)iEvents);
-	    hErrD0VsEta_2->DrawCopy("same");
-	  }
-	}
-	else {
-	  if (!IsHistogramMissing) {
-	    IsHistogramMissing = true;
-	    missinghistopad = 2;
-	  } 
-	}
-	  //
-	// -----------------------------------------------------------------
-	//
-	
-	cErrD0->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsPt";
-	hTemp = NULL;
-	hTemp = (TH2D*)file->Get(histname);
-	if (hTemp != NULL) {
-	  if(PrintLevel>0) cout << " <errD0> Plotting Histogram: " << histname << endl;
-	  hErrD0VsPt = hTemp->ProfileX();
-	  hErrD0VsPt->SetTitle("#sigma(d0) vs pT");
-	  hErrD0VsPt->GetXaxis()->SetTitle("pT (GeV)");
-	  hErrD0VsPt->GetYaxis()->SetTitle("#sigma(d0 (mm)");
-	  hErrD0VsPt->SetLineColor(Color+2);
-	  hErrD0VsPt->SetFillColor(Color);
-	  hErrD0VsPt->SetFillStyle(3001);
-	  hErrD0VsPt->SetMinimum(0.);
-	  if (normalizePlots) hErrD0VsPt->Scale(1./(float)iEvents);
-	  if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	  hErrD0VsPt->DrawCopy("");
-	  setTitleFont(font);
-	  ScalePlots();
-	  if(trkCol2 !=""){
-	    histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsPt";
-	    if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	    hErrD0VsPt_2 =((TH2D*)file->Get(histname))->ProfileX();
-	    hErrD0VsPt_2->SetLineColor(ColorForSecond+2);
-	    hErrD0VsPt_2->SetFillColor(ColorForSecond);
-	    hErrD0VsPt_2->SetLineWidth(1);
-	    hErrD0VsPt_2->SetFillStyle(3001);
-	    if (normalizePlots) hErrD0VsPt_2->Scale(1./(float)iEvents);
-	    hErrD0VsPt_2->DrawCopy("same");
-	  }
-	}
-	else {
-	  if (!IsHistogramMissing) {
-	    IsHistogramMissing = true;
-	    missinghistopad = 3;
-	  } 
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrD0->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsP";
-	hTemp = NULL;
-	hTemp = (TH2D*)file->Get(histname);
-	if (hTemp != NULL) {
-	  if(PrintLevel>0) cout << " <errD0> Plotting Histogram: " << histname << endl;
-	  hErrD0VsP = hTemp->ProfileX();
-	  hErrD0VsP->SetTitle("#sigma(d0) vs p");
-	  hErrD0VsP->GetXaxis()->SetTitle("p (GeV)");
-	  hErrD0VsP->GetYaxis()->SetTitle("#sigma(d0 (mm)");
-	  hErrD0VsP->SetLineColor(Color+2);
-	  hErrD0VsP->SetFillColor(Color);
-	  hErrD0VsP->SetFillStyle(3001);
-	  hErrD0VsP->SetMinimum(0.);
-	  if (normalizePlots) hErrD0VsP->Scale(1./(float)iEvents);
-	  if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	  hErrD0VsP->DrawCopy("");
-	  setTitleFont(font);
-	  ScalePlots();
-	  if(trkCol2 !=""){
-	    histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsP";
-	    if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	    hErrD0VsP_2 = ((TH2D*)file->Get(histname))->ProfileX();
-	    hErrD0VsP_2->SetLineColor(ColorForSecond+2);
-	    hErrD0VsP_2->SetFillColor(ColorForSecond);
-	    hErrD0VsP_2->SetLineWidth(1);
-	    hErrD0VsP_2->SetFillStyle(3001);
-	    if (normalizePlots) hErrD0VsP_2->Scale(1./(float)iEvents);
-	    hErrD0VsP_2->DrawCopy("same");
-	  }
-	}
-	else {
-	  if (!IsHistogramMissing) {
-	    IsHistogramMissing = true;
-	    missinghistopad = 4;
-	  } 
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrD0->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsPhi";
-	hTemp = NULL;
-	hTemp = (TH2D*)file->Get(histname);
-	if (hTemp != NULL) {
-	  if(PrintLevel>0) cout << " <errD0> Plotting Histogram: " << histname << endl;
-	  hErrD0VsPhi0 = hTemp->ProfileX();
-	  hErrD0VsPhi0->SetTitle("#sigma(d0) vs #phi0");
-	  hErrD0VsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-	  hErrD0VsPhi0->GetYaxis()->SetTitle("#sigma(d0 (mm)");
-	  hErrD0VsPhi0->SetLineColor(Color+2);
-	  hErrD0VsPhi0->SetFillColor(Color);
-	  hErrD0VsPhi0->SetFillStyle(3001);
-	  hErrD0VsPhi0->SetMinimum(0.);
-	  if (normalizePlots) hErrD0VsPhi0->Scale(1./(float)iEvents);
-	  if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	  hErrD0VsPhi0->DrawCopy("");
-	  setTitleFont(font);
-	  ScalePlots();
-	  if(trkCol2 !=""){
-	    histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsPhi";
-	    if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	    hErrD0VsPhi0_2 = ((TH2D*)file->Get(histname))->ProfileX();
-	    hErrD0VsPhi0_2->SetLineColor(ColorForSecond+2);
-	    hErrD0VsPhi0_2->SetFillColor(ColorForSecond);
-	    hErrD0VsPhi0_2->SetLineWidth(1);
-	    hErrD0VsPhi0_2->SetFillStyle(3001);
-	    if (normalizePlots) hErrD0VsPhi0_2->Scale(1./(float)iEvents);
-	    hErrD0VsPhi0_2->DrawCopy("same");
-	  }
-	}
-	else {
-	  if (!IsHistogramMissing) {
-	    IsHistogramMissing = true;
-	    missinghistopad = 5;
-	  } 
-	}
- 
-
-	//
-	// -----------------------------------------------------------------
-	//
-/*
-	cErrD0->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsD0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrD0VsD0 = (TH1F*)file->Get(histname);	
-	hErrD0VsD0->SetTitle("#sigma(d0) vs d0");
-	hErrD0VsD0->GetXaxis()->SetTitle("#sigma(d0) vs d0");
-	hErrD0VsD0->GetYaxis()->SetTitle("#sigma(d0 (mm)");
-	hErrD0VsD0->SetLineColor(Color+2);
-	hErrD0VsD0->SetFillColor(Color);
-	hErrD0VsD0->SetFillStyle(3001);
-	if (normalizePlots) hErrD0VsD0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrD0VsD0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsD0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrD0VsD0_2 = (TH1F*)file->Get(histname);	
-		hErrD0VsD0_2->SetLineColor(ColorForSecond+2);
-		hErrD0VsD0_2->SetFillColor(ColorForSecond);
-		hErrD0VsD0_2->SetLineWidth(1);
-		hErrD0VsD0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrD0VsD0_2->Scale(1./(float)iEvents);
-		hErrD0VsD0_2->DrawCopy("same");
-	}
-
-
-*/
-	cErrD0->Update();
-	gStyle->SetOptStat(111110);
-
-	// if some histo is missing
-	if (IsHistogramMissing) {
-	    TH1F* hBlank = new TH1F ("hBlank"," ",1, 0., 1.);
-	    cErrD0->cd(missinghistopad);
-	    hBlank->SetMaximum(1.);
-	    hBlank->SetMinimum(-1.);
-	    hBlank->Draw();
-	    TText myWarning;
-	    myWarning.DrawText(0., 0., " errD0.cc PROBLEMS. PLEASE CHECK ");	    
-	}
-	return;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errD0vsPhi.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errD0vsPhi.cc
deleted file mode 100644
index 628b88521be06be2624e3760e1536755b21552f9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errD0vsPhi.cc
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void errD0VsPhi0(TString trkCol){
-	errD0VsPhi0(trkCol, 0, "");
-}
-
-void errD0VsPhi0(TString trkCol, TString trkCol2){
-	errD0VsPhi0(trkCol, 0, trkCol2);
-}
-
-void errD0VsPhi0(TString trkCol, TCanvas *cErrD0VsPhi0){
-	errD0VsPhi0(trkCol, cErrD0VsPhi0, "");
-}
-
-void errD0VsPhi0(TString trkCol, TCanvas *cErrD0VsPhi0, TString trkCol2) {
-	gStyle->SetOptStat(0);
-	TProfile *hErrD0VsPhi0;
-	TProfile *hErrD0VsPhi0VsPhi0Ba;
-	TProfile *hErrD0VsPhi0VsPhi0ECC;
-	TProfile *hErrD0VsPhi0VsPhi0ECA;
-
-	TProfile *hErrD0VsPhi0_2;
-	TProfile *hErrD0VsPhi0VsPhi0Ba_2;
-	TProfile *hErrD0VsPhi0VsPhi0ECC_2;
-	TProfile *hErrD0VsPhi0VsPhi0ECA_2;
-	cout << " Error d0 vs Phi..." << endl;
-	
-	TString histname;
-	Color_t Color;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	if(!cErrD0VsPhi0)
-		cErrD0VsPhi0 = new TCanvas("cErrD0VsPhi0","Error D0 vs Phi0'",
-							CanvasSizeX4[0],CanvasSizeX4[1]);
-							
-	cErrD0VsPhi0->Divide(2,2);
-
-	cErrD0VsPhi0->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsPhi";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrD0VsPhi0 =((TH2D*)file->Get(histname))->ProfileX();
-	hErrD0VsPhi0->SetTitle("D0 err vs Phi0");
-	hErrD0VsPhi0->GetXaxis()->SetTitle("Phi0 (rad)");
-	hErrD0VsPhi0->GetYaxis()->SetTitle("#sigma (d0) (mm)");
-	hErrD0VsPhi0->SetLineColor(Color+2);
-	hErrD0VsPhi0->SetFillColor(Color);
-	hErrD0VsPhi0->SetFillStyle(3001);
-	hErrD0VsPhi0->SetMinimum(0.);
-	if (normalizePlots) hErrD0VsPhi0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrD0VsPhi0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsPhi";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrD0VsPhi0_2 =((TH2D*)file->Get(histname))->ProfileX();
-		hErrD0VsPhi0_2->SetLineColor(ColorForSecond+2);
-		hErrD0VsPhi0_2->SetFillColor(ColorForSecond);
-		hErrD0VsPhi0_2->SetLineWidth(1);
-		hErrD0VsPhi0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrD0VsPhi0_2->Scale(1./(float)iEvents);
-		hErrD0VsPhi0_2->DrawCopy("same");
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrD0VsPhi0->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsPhiBarrel";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrD0VsPhi0VsPhi0Ba =((TH2D*)file->Get(histname))->ProfileX();
-	hErrD0VsPhi0VsPhi0Ba->SetTitle("D0 err vs Phi0 (Barrel)");
-	hErrD0VsPhi0VsPhi0Ba->GetXaxis()->SetTitle("Phi0 (rad)");
-	hErrD0VsPhi0VsPhi0Ba->GetYaxis()->SetTitle("#sigma (d0) (mm)");
-	hErrD0VsPhi0VsPhi0Ba->SetLineColor(Color+2);
-	hErrD0VsPhi0VsPhi0Ba->SetFillColor(Color);
-	hErrD0VsPhi0VsPhi0Ba->SetFillStyle(3001);
-	hErrD0VsPhi0VsPhi0Ba->SetMinimum(0.);
-	if (normalizePlots) hErrD0VsPhi0VsPhi0Ba->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrD0VsPhi0VsPhi0Ba->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsPhiBarrel";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrD0VsPhi0VsPhi0Ba_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrD0VsPhi0VsPhi0Ba_2->SetLineColor(ColorForSecond+2);
-		hErrD0VsPhi0VsPhi0Ba_2->SetFillColor(ColorForSecond);
-		hErrD0VsPhi0VsPhi0Ba_2->SetLineWidth(1);
-		hErrD0VsPhi0VsPhi0Ba_2->SetFillStyle(3001);
-		if (normalizePlots) hErrD0VsPhi0VsPhi0Ba_2->Scale(1./(float)iEvents);
-		hErrD0VsPhi0VsPhi0Ba_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-	
-	cErrD0VsPhi0->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsPhiECC";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrD0VsPhi0VsPhi0ECC = ((TH2D*)file->Get(histname))->ProfileX();
-	hErrD0VsPhi0VsPhi0ECC->SetTitle("D0 err vs Phi0 (ECC)");
-	hErrD0VsPhi0VsPhi0ECC->GetXaxis()->SetTitle("Phi0 (rad)");
-	hErrD0VsPhi0VsPhi0ECC->GetYaxis()->SetTitle("#sigma (d0) (mm)");
-	hErrD0VsPhi0VsPhi0ECC->SetLineColor(Color+2);
-	hErrD0VsPhi0VsPhi0ECC->SetFillColor(Color);
-	hErrD0VsPhi0VsPhi0ECC->SetFillStyle(3001);
-	hErrD0VsPhi0VsPhi0ECC->SetMinimum(0.);
-	if (normalizePlots) hErrD0VsPhi0VsPhi0ECC->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrD0VsPhi0VsPhi0ECC->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsPhiECC";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrD0VsPhi0VsPhi0ECC_2 =((TH2D*)file->Get(histname))->ProfileX();
-		hErrD0VsPhi0VsPhi0ECC_2->SetLineColor(ColorForSecond+2);
-		hErrD0VsPhi0VsPhi0ECC_2->SetFillColor(ColorForSecond);
-		hErrD0VsPhi0VsPhi0ECC_2->SetLineWidth(1);
-		hErrD0VsPhi0VsPhi0ECC_2->SetFillStyle(3001);
-		if (normalizePlots) hErrD0VsPhi0VsPhi0ECC_2->Scale(1./(float)iEvents);
-		hErrD0VsPhi0VsPhi0ECC_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrD0VsPhi0->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errD0VsPhiECA";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrD0VsPhi0VsPhi0ECA = ((TH2D*)file->Get(histname))->ProfileX();
-	hErrD0VsPhi0VsPhi0ECA->SetTitle("D0 err vs Phi0 (ECA)");
-	hErrD0VsPhi0VsPhi0ECA->GetXaxis()->SetTitle("Phi0 (rad)");
-	hErrD0VsPhi0VsPhi0ECA->GetYaxis()->SetTitle("#sigma (d0) (mm)");
-	hErrD0VsPhi0VsPhi0ECA->SetLineColor(Color+2);
-	hErrD0VsPhi0VsPhi0ECA->SetFillColor(Color);
-	hErrD0VsPhi0VsPhi0ECA->SetFillStyle(3001);
-	hErrD0VsPhi0VsPhi0ECA->SetMinimum(0.);
-	if (normalizePlots) hErrD0VsPhi0VsPhi0ECA->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrD0VsPhi0VsPhi0ECA->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errD0VsPhiECA";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrD0VsPhi0VsPhi0ECA_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrD0VsPhi0VsPhi0ECA_2->SetLineColor(ColorForSecond+2);
-		hErrD0VsPhi0VsPhi0ECA_2->SetFillColor(ColorForSecond);
-		hErrD0VsPhi0VsPhi0ECA_2->SetLineWidth(1);
-		hErrD0VsPhi0VsPhi0ECA_2->SetFillStyle(3001);
-		if (normalizePlots) hErrD0VsPhi0VsPhi0ECA_2->Scale(1./(float)iEvents);
-		hErrD0VsPhi0VsPhi0ECA_2->DrawCopy("same");
-	}
-	
-	
-	cErrD0VsPhi0->Update();
-	gStyle->SetOptStat(111110);
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errPhi0.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errPhi0.cc
deleted file mode 100644
index a61ebfa82fb235a4a01f9e442738f2106ebafead..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errPhi0.cc
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void errPhi0(TString trkCol){
-	errPhi0(trkCol, 0, "");
-}
-
-void errPhi0(TString trkCol, TString trkCol2){
-	errPhi0(trkCol, 0, trkCol2);
-}
-
-void errPhi0(TString trkCol, TCanvas *cErrPhi0){
-	errPhi0(trkCol, cErrPhi0, "");
-}
-
-void errPhi0(TString trkCol, TCanvas *cErrPhi0, TString trkCol2) {
-	gStyle->SetOptStat(0);
-
-	TH1F *hErrPhi0;
-	TProfile *hErrPhi0VsEta;
-	TProfile *hErrPhi0VsPt;
-	TProfile *hErrPhi0VsP;
-	TProfile *hErrPhi0VsPhi0;
-	//TProfile *hErrPhi0VsD0;
-	TH1F *hErrPhi0_2;
-	TProfile *hErrPhi0VsEta_2;
-	TProfile *hErrPhi0VsPt_2;
-	TProfile *hErrPhi0VsP_2;
-	TProfile *hErrPhi0VsPhi0_2;
-	//TProfile *hErrPhi0VsD0_2;
-	cout << " Track Parameters..." << endl;
-	
-	TString histname;
-	Color_t Color;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	if(!cErrPhi0)
-		cErrPhi0 = new TCanvas("cErrPhi0","Error Phi0",
-							CanvasSizeX6[0],CanvasSizeX6[1]);
-							
-	cErrPhi0->Divide(3,2);
-
-	cErrPhi0->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPhi0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0 = (TH1F*)file->Get(histname);
-	hErrPhi0->SetTitle("Phi0 Error");
-	hErrPhi0->GetXaxis()->SetTitle("#sigma (#phi0) (rad)");
-	hErrPhi0->GetYaxis()->SetTitle("Tracks");
-	hErrPhi0->SetLineColor(Color+2);
-	hErrPhi0->SetFillColor(Color);
-	hErrPhi0->SetFillStyle(3001);
-	hErrPhi0->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPhi0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0_2 = (TH1F*)file->Get(histname);	
-		hErrPhi0_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0_2->SetFillColor(ColorForSecond);
-		hErrPhi0_2->SetLineWidth(1);
-		hErrPhi0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0_2->Scale(1./(float)iEvents);
-		hErrPhi0_2->DrawCopy("histsame");
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrPhi0->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPhi0VsEta";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsEta =((TH2D*)file->Get(histname))->ProfileX();
-	hErrPhi0VsEta->SetTitle("#sigma(#phi0) vs #eta");
-	hErrPhi0VsEta->GetXaxis()->SetTitle("#eta");
-	hErrPhi0VsEta->GetYaxis()->SetTitle("#sigma (#phi0) (rad)");
-	hErrPhi0VsEta->SetLineColor(Color+2);
-	hErrPhi0VsEta->SetFillColor(Color);
-	hErrPhi0VsEta->SetFillStyle(3001);
-	hErrPhi0VsEta->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0VsEta->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsEta->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPhi0VsEta";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsEta_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPhi0VsEta_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsEta_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsEta_2->SetLineWidth(1);
-		hErrPhi0VsEta_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsEta_2->Scale(1./(float)iEvents);
-		hErrPhi0VsEta_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-	
-	cErrPhi0->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPhi0VsPt";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsPt = ((TH2D*)file->Get(histname))->ProfileX();
-	hErrPhi0VsPt->SetTitle("#sigma(#phi0) vs pT");
-	hErrPhi0VsPt->GetXaxis()->SetTitle("pT (GeV)");
-	hErrPhi0VsPt->GetYaxis()->SetTitle("#sigma (#phi0) (rad)");
-	hErrPhi0VsPt->SetLineColor(Color+2);
-	hErrPhi0VsPt->SetFillColor(Color);
-	hErrPhi0VsPt->SetFillStyle(3001);
-	hErrPhi0VsPt->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0VsPt->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsPt->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPhi0VsPt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsPt_2 =((TH2D*)file->Get(histname))->ProfileX();
-		hErrPhi0VsPt_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsPt_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsPt_2->SetLineWidth(1);
-		hErrPhi0VsPt_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsPt_2->Scale(1./(float)iEvents);
-		hErrPhi0VsPt_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrPhi0->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPhi0VsP";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsP = ((TH2D*)file->Get(histname))->ProfileX();
-	//gPad->SetLogy();
-	hErrPhi0VsP->SetTitle("#sigma(#phi0) vs p");
-	hErrPhi0VsP->GetXaxis()->SetTitle("p (GeV)");
-	hErrPhi0VsP->GetYaxis()->SetTitle("#sigma (#phi0) (rad)");
-	hErrPhi0VsP->SetLineColor(Color+2);
-	hErrPhi0VsP->SetFillColor(Color);
-	hErrPhi0VsP->SetFillStyle(3001);
-	hErrPhi0VsP->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0VsP->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsP->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPhi0VsP";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsP_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPhi0VsP_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsP_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsP_2->SetLineWidth(1);
-		hErrPhi0VsP_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsP_2->Scale(1./(float)iEvents);
-		hErrPhi0VsP_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrPhi0->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPhi0VsPhi0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsPhi0 = ((TH2D*)file->Get(histname))->ProfileX();
-	//gPad->SetLogy();
-	hErrPhi0VsPhi0->SetTitle("#sigma(#phi0) vs #phi0");
-	hErrPhi0VsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-	hErrPhi0VsPhi0->GetYaxis()->SetTitle("#sigma (#phi0) (rad)");
-	hErrPhi0VsPhi0->SetLineColor(Color+2);
-	hErrPhi0VsPhi0->SetFillColor(Color);
-	hErrPhi0VsPhi0->SetFillStyle(3001);
-	hErrPhi0VsPhi0->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0VsPhi0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsPhi0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPhi0VsPhi0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsPhi0_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPhi0VsPhi0_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsPhi0_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsPhi0_2->SetLineWidth(1);
-		hErrPhi0VsPhi0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsPhi0_2->Scale(1./(float)iEvents);
-		hErrPhi0VsPhi0_2->DrawCopy("same");
-	}
-
-	
-
-	//
-	// -----------------------------------------------------------------
-	//
-/*
-	cErrPhi0->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPhi0VsD0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsD0 = (TH1F*)file->Get(histname);	
-	hErrPhi0VsD0->SetTitle("#sigma(#phi0) vs d0");
-	hErrPhi0VsD0->GetXaxis()->SetTitle("#sigma(#phi0) vs d0");
-	hErrPhi0VsD0->GetYaxis()->SetTitle("#sigma (#phi0) (rad)");
-	hErrPhi0VsD0->SetLineColor(Color+2);
-	hErrPhi0VsD0->SetFillColor(Color);
-	hErrPhi0VsD0->SetFillStyle(3001);
-	if (normalizePlots) hErrPhi0VsD0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsD0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPhi0VsD0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsD0_2 = (TH1F*)file->Get(histname);	
-		hErrPhi0VsD0_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsD0_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsD0_2->SetLineWidth(1);
-		hErrPhi0VsD0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsD0_2->Scale(1./(float)iEvents);
-		hErrPhi0VsD0_2->DrawCopy("same");
-	}
-
-
-*/
-	cErrPhi0->Update();
-	gStyle->SetOptStat(111110);
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errPt.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errPt.cc
deleted file mode 100644
index 16ab22d2e9ebae186ab14338173668c492e77fd6..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errPt.cc
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void errPt(TString trkCol){
-	errPt(trkCol, 0, "");
-}
-
-void errPt(TString trkCol, TString trkCol2){
-	errPt(trkCol, 0, trkCol2);
-}
-
-void errPt(TString trkCol, TCanvas *cErrPt){
-	errPt(trkCol, cErrPt, "");
-}
-
-void errPt(TString trkCol, TCanvas *cErrPt, TString trkCol2) {
-	gStyle->SetOptStat(0);
-
-	TH1F *hErrPt;
-	TProfile *hErrPtVsEta;
-	TProfile *hErrPtVsPt;
-	//TProfile *hErrPtVsP;
-	TProfile *hErrPtVsPhi0;
-	//TProfile *hErrPtVsD0;
-	TH1F *hErrPt_2;
-	TProfile *hErrPtVsEta_2;
-	TProfile *hErrPtVsPt_2;
-	//TProfile *hErrPtVsP_2;
-	TProfile *hErrPtVsPhi0_2;
-	//TProfile *hErrPtVsD0_2;
-	cout << " Track Parameters..." << endl;
-	
-	TString histname;
-	Color_t Color;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	if(!cErrPt)
-		cErrPt = new TCanvas("cErrPt","Error Pt",
-							CanvasSizeX6[0],CanvasSizeX6[1]);
-							
-	cErrPt->Divide(3,2);
-
-	cErrPt->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPt";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPt = (TH1F*)file->Get(histname);
-	hErrPt->SetTitle("Pt err");
-	hErrPt->GetXaxis()->SetTitle("#sigma (pT) (GeV)");
-	hErrPt->GetYaxis()->SetTitle("Tracks");
-	hErrPt->SetLineColor(Color+2);
-	hErrPt->SetFillColor(Color);
-	hErrPt->SetFillStyle(3001);
-	hErrPt->SetMinimum(0.);
-	if (normalizePlots) hErrPt->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPt->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPt_2 = (TH1F*)file->Get(histname);	
-		hErrPt_2->SetLineColor(ColorForSecond+2);
-		hErrPt_2->SetFillColor(ColorForSecond);
-		hErrPt_2->SetLineWidth(1);
-		hErrPt_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPt_2->Scale(1./(float)iEvents);
-		hErrPt_2->DrawCopy("histsame");
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrPt->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPtVsEta";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPtVsEta =((TH2D*)file->Get(histname))->ProfileX();
-	hErrPtVsEta->SetTitle("#sigma(pT) vs #eta");
-	hErrPtVsEta->GetXaxis()->SetTitle("#eta");
-	hErrPtVsEta->GetYaxis()->SetTitle("#sigma(pT) (GeV)");
-	hErrPtVsEta->SetLineColor(Color+2);
-	hErrPtVsEta->SetFillColor(Color);
-	hErrPtVsEta->SetFillStyle(3001);
-	hErrPtVsEta->SetMinimum(0.);
-	if (normalizePlots) hErrPtVsEta->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPtVsEta->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPtVsEta";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPtVsEta_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPtVsEta_2->SetLineColor(ColorForSecond+2);
-		hErrPtVsEta_2->SetFillColor(ColorForSecond);
-		hErrPtVsEta_2->SetLineWidth(1);
-		hErrPtVsEta_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPtVsEta_2->Scale(1./(float)iEvents);
-		hErrPtVsEta_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-	
-	cErrPt->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPtVsPt";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPtVsPt = ((TH2D*)file->Get(histname))->ProfileX();
-	hErrPtVsPt->SetTitle("#sigma(pT) vs pT");
-	hErrPtVsPt->GetXaxis()->SetTitle("pT (GeV)");
-	hErrPtVsPt->GetYaxis()->SetTitle("#sigma(pT) (GeV)");
-	hErrPtVsPt->SetLineColor(Color+2);
-	hErrPtVsPt->SetFillColor(Color);
-	hErrPtVsPt->SetFillStyle(3001);
-	hErrPtVsPt->SetMinimum(0.);
-	if (normalizePlots) hErrPtVsPt->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPtVsPt->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPtVsPt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPtVsPt_2 =((TH2D*)file->Get(histname))->ProfileX();
-		hErrPtVsPt_2->SetLineColor(ColorForSecond+2);
-		hErrPtVsPt_2->SetFillColor(ColorForSecond);
-		hErrPtVsPt_2->SetLineWidth(1);
-		hErrPtVsPt_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPtVsPt_2->Scale(1./(float)iEvents);
-		hErrPtVsPt_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-/*
-	cErrPt->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPtVsP";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPtVsP = ((TH2D*)file->Get(histname))->ProfileX();
-	//gPad->SetLogy();
-	hErrPtVsP->SetTitle("#sigma(pT) vs p");
-	hErrPtVsP->GetXaxis()->SetTitle("p (GeV)");
-	hErrPtVsP->GetYaxis()->SetTitle("#sigma(pT) (GeV)");
-	hErrPtVsP->SetLineColor(Color+2);
-	hErrPtVsP->SetFillColor(Color);
-	hErrPtVsP->SetFillStyle(3001);
-	hErrPtVsP->SetMinimum(0.);
-	if (normalizePlots) hErrPtVsP->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPtVsP->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPtVsP";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPtVsP_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPtVsP_2->SetLineColor(ColorForSecond+2);
-		hErrPtVsP_2->SetFillColor(ColorForSecond);
-		hErrPtVsP_2->SetLineWidth(1);
-		hErrPtVsP_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPtVsP_2->Scale(1./(float)iEvents);
-		hErrPtVsP_2->DrawCopy("same");
-	}
-	*/
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrPt->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPtVsPhi0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPtVsPhi0 = ((TH2D*)file->Get(histname))->ProfileX();
-	//gPad->SetLogy();
-	hErrPtVsPhi0->SetTitle("#sigma(pT) vs #phi0");
-	hErrPtVsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-	hErrPtVsPhi0->GetYaxis()->SetTitle("#sigma(pT) (GeV)");
-	hErrPtVsPhi0->SetLineColor(Color+2);
-	hErrPtVsPhi0->SetFillColor(Color);
-	hErrPtVsPhi0->SetFillStyle(3001);
-	hErrPtVsPhi0->SetMinimum(0.);
-	if (normalizePlots) hErrPtVsPhi0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPtVsPhi0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPtVsPhi0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPtVsPhi0_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPtVsPhi0_2->SetLineColor(ColorForSecond+2);
-		hErrPtVsPhi0_2->SetFillColor(ColorForSecond);
-		hErrPtVsPhi0_2->SetLineWidth(1);
-		hErrPtVsPhi0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPtVsPhi0_2->Scale(1./(float)iEvents);
-		hErrPtVsPhi0_2->DrawCopy("same");
-	}
-
-	
-
-	//
-	// -----------------------------------------------------------------
-	//
-/*
-	cErrPt->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errPtVsD0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPtVsD0 = (TH1F*)file->Get(histname);	
-	hErrPtVsD0->SetTitle("#sigma(pT) vs d0");
-	hErrPtVsD0->GetXaxis()->SetTitle("#sigma(pT) vs d0");
-	hErrPtVsD0->GetYaxis()->SetTitle("#sigma(pT) (GeV)");
-	hErrPtVsD0->SetLineColor(Color+2);
-	hErrPtVsD0->SetFillColor(Color);
-	hErrPtVsD0->SetFillStyle(3001);
-	if (normalizePlots) hErrPtVsD0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPtVsD0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errPtVsD0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPtVsD0_2 = (TH1F*)file->Get(histname);	
-		hErrPtVsD0_2->SetLineColor(ColorForSecond+2);
-		hErrPtVsD0_2->SetFillColor(ColorForSecond);
-		hErrPtVsD0_2->SetLineWidth(1);
-		hErrPtVsD0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPtVsD0_2->Scale(1./(float)iEvents);
-		hErrPtVsD0_2->DrawCopy("same");
-	}
-
-
-*/
-	cErrPt->Update();
-	gStyle->SetOptStat(111110);
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errZ0.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errZ0.cc
deleted file mode 100644
index 428a2f2c6a6aa8e3a352d12cfd1679c1ab39bc2e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/errZ0.cc
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void errZ0(TString trkCol){
-	errZ0(trkCol, 0, "");
-}
-
-void errZ0(TString trkCol, TString trkCol2){
-	errZ0(trkCol, 0, trkCol2);
-}
-
-void errZ0(TString trkCol, TCanvas *cErrZ0){
-	errZ0(trkCol, cErrZ0, "");
-}
-
-void errZ0(TString trkCol, TCanvas *cErrZ0, TString trkCol2) {
-	gStyle->SetOptStat(0);
-
-	TH1F *hErrPhi0;
-	TProfile *hErrPhi0VsEta;
-	TProfile *hErrPhi0VsPt;
-	TProfile *hErrPhi0VsP;
-	TProfile *hErrPhi0VsPhi0;
-	//TProfile *hErrPhi0VsD0;
-	TH1F *hErrPhi0_2;
-	TProfile *hErrPhi0VsEta_2;
-	TProfile *hErrPhi0VsPt_2;
-	TProfile *hErrPhi0VsP_2;
-	TProfile *hErrPhi0VsPhi0_2;
-	//TProfile *hErrPhi0VsD0_2;
-	cout << " Error Z0 vs track parameters..." << endl;
-	
-	TString histname;
-	Color_t Color;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	if(!cErrZ0)
-		cErrZ0 = new TCanvas("cErrZ0","Error Z0",
-							CanvasSizeX6[0],CanvasSizeX6[1]);
-							
-	cErrZ0->Divide(3,2);
-
-	cErrZ0->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errZ0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0 = (TH1F*)file->Get(histname);
-	hErrPhi0->SetTitle("Z0 Error");
-	hErrPhi0->GetXaxis()->SetTitle("#sigma (z0) (mm)");
-	hErrPhi0->GetYaxis()->SetTitle("Tracks");
-	hErrPhi0->SetLineColor(Color+2);
-	hErrPhi0->SetFillColor(Color);
-	hErrPhi0->SetFillStyle(3001);
-	hErrPhi0->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errZ0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0_2 = (TH1F*)file->Get(histname);	
-		hErrPhi0_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0_2->SetFillColor(ColorForSecond);
-		hErrPhi0_2->SetLineWidth(1);
-		hErrPhi0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0_2->Scale(1./(float)iEvents);
-		hErrPhi0_2->DrawCopy("histsame");
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrZ0->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errZ0VsEta";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsEta =((TH2D*)file->Get(histname))->ProfileX();
-	hErrPhi0VsEta->SetTitle("#sigma(z0) vs #eta");
-	hErrPhi0VsEta->GetXaxis()->SetTitle("#eta");
-	hErrPhi0VsEta->GetYaxis()->SetTitle("#sigma (z0) (mm)");
-	hErrPhi0VsEta->SetLineColor(Color+2);
-	hErrPhi0VsEta->SetFillColor(Color);
-	hErrPhi0VsEta->SetFillStyle(3001);
-	hErrPhi0VsEta->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0VsEta->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsEta->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errZ0VsEta";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsEta_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPhi0VsEta_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsEta_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsEta_2->SetLineWidth(1);
-		hErrPhi0VsEta_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsEta_2->Scale(1./(float)iEvents);
-		hErrPhi0VsEta_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-	
-	cErrZ0->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errZ0VsPt";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsPt = ((TH2D*)file->Get(histname))->ProfileX();
-	hErrPhi0VsPt->SetTitle("#sigma(z0) vs pT");
-	hErrPhi0VsPt->GetXaxis()->SetTitle("pT (GeV)");
-	hErrPhi0VsPt->GetYaxis()->SetTitle("#sigma (z0) (mm)");
-	hErrPhi0VsPt->SetLineColor(Color+2);
-	hErrPhi0VsPt->SetFillColor(Color);
-	hErrPhi0VsPt->SetFillStyle(3001);
-	hErrPhi0VsPt->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0VsPt->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsPt->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errZ0VsPt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsPt_2 =((TH2D*)file->Get(histname))->ProfileX();
-		hErrPhi0VsPt_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsPt_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsPt_2->SetLineWidth(1);
-		hErrPhi0VsPt_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsPt_2->Scale(1./(float)iEvents);
-		hErrPhi0VsPt_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrZ0->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errZ0VsP";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsP = ((TH2D*)file->Get(histname))->ProfileX();
-	//gPad->SetLogy();
-	hErrPhi0VsP->SetTitle("#sigma(z0) vs p");
-	hErrPhi0VsP->GetXaxis()->SetTitle("p (GeV)");
-	hErrPhi0VsP->GetYaxis()->SetTitle("#sigma (z0) (mm)");
-	hErrPhi0VsP->SetLineColor(Color+2);
-	hErrPhi0VsP->SetFillColor(Color);
-	hErrPhi0VsP->SetFillStyle(3001);
-	hErrPhi0VsP->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0VsP->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsP->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errZ0VsP";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsP_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPhi0VsP_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsP_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsP_2->SetLineWidth(1);
-		hErrPhi0VsP_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsP_2->Scale(1./(float)iEvents);
-		hErrPhi0VsP_2->DrawCopy("same");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cErrZ0->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errZ0VsPhi0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsPhi0 = ((TH2D*)file->Get(histname))->ProfileX();
-	//gPad->SetLogy();
-	hErrPhi0VsPhi0->SetTitle("#sigma(z0) vs #phi0");
-	hErrPhi0VsPhi0->GetXaxis()->SetTitle("#phi0 (rad)");
-	hErrPhi0VsPhi0->GetYaxis()->SetTitle("#sigma (z0) (mm)");
-	hErrPhi0VsPhi0->SetLineColor(Color+2);
-	hErrPhi0VsPhi0->SetFillColor(Color);
-	hErrPhi0VsPhi0->SetFillStyle(3001);
-	hErrPhi0VsPhi0->SetMinimum(0.);
-	if (normalizePlots) hErrPhi0VsPhi0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsPhi0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errZ0VsPhi0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsPhi0_2 = ((TH2D*)file->Get(histname))->ProfileX();
-		hErrPhi0VsPhi0_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsPhi0_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsPhi0_2->SetLineWidth(1);
-		hErrPhi0VsPhi0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsPhi0_2->Scale(1./(float)iEvents);
-		hErrPhi0VsPhi0_2->DrawCopy("same");
-	}
-
-	
-
-	//
-	// -----------------------------------------------------------------
-	//
-/*
-	cErrZ0->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/errZ0VsD0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hErrPhi0VsD0 = (TH1F*)file->Get(histname);	
-	hErrPhi0VsD0->SetTitle("#sigma(z0) vs d0");
-	hErrPhi0VsD0->GetXaxis()->SetTitle("#sigma(z0) vs d0");
-	hErrPhi0VsD0->GetYaxis()->SetTitle("#sigma (z0) (mm)");
-	hErrPhi0VsD0->SetLineColor(Color+2);
-	hErrPhi0VsD0->SetFillColor(Color);
-	hErrPhi0VsD0->SetFillStyle(3001);
-	if (normalizePlots) hErrPhi0VsD0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hErrPhi0VsD0->DrawCopy("");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/errZ0VsD0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hErrPhi0VsD0_2 = (TH1F*)file->Get(histname);	
-		hErrPhi0VsD0_2->SetLineColor(ColorForSecond+2);
-		hErrPhi0VsD0_2->SetFillColor(ColorForSecond);
-		hErrPhi0VsD0_2->SetLineWidth(1);
-		hErrPhi0VsD0_2->SetFillStyle(3001);
-		if (normalizePlots) hErrPhi0VsD0_2->Scale(1./(float)iEvents);
-		hErrPhi0VsD0_2->DrawCopy("same");
-	}
-
-
-*/
-	cErrZ0->Update();
-	gStyle->SetOptStat(111110);
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hitCorrelations.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hitCorrelations.cc
deleted file mode 100644
index 6bd2a33aa041b040bb08eef7f1aec0c5966c2d14..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hitCorrelations.cc
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void hitCorrelations(TString TrkCol_1,TString TrkCol_2) {
-	TH2F *hPixelVSSCT;
-	TH2F *hPixelVSSCT2;
-	TH2F *hPixelEta;
-	TH2F *hPixelEta2;
-	TH2F *hSCTEta;
-	TH2F *hSCTEta2;
-	TString histname, histtitle;
-	bool somethingwasplotted = false;
-	cout << " <hitCorrelations> plotting more hits information..." << endl;
-
-	cHitCorr = new TCanvas("TracksHits2","More Hits information",CanvasSizeX6[0],CanvasSizeX6[1]);
-	cHitCorr->Divide(3,2);
-	
-	cHitCorr->cd(1);
-	histname = "IDAlignMon/"+TrkCol_1+"/GenericTracks/PIXvSCTHits";
-	if(PrintLevel>0) cout << " <hitCorrelations> Plotting Histogram: " << histname << endl;
-	hPixelVSSCT = (TH2F*)file->Get(histname);
-	if (hPixelVSSCT != NULL) {
-	  histtitle = TrkCol_1.Data();
-	  histtitle += ": Hits on track";
-	  hPixelVSSCT->SetTitle(histtitle.Data());
-	  hPixelVSSCT->GetXaxis()->SetTitle("SCT Hits on track");
-	  hPixelVSSCT->GetYaxis()->SetTitle("Pixel Hits on track");
-	  hPixelVSSCT->Draw("COLZ");
-	  if (!AtlasStyle) {
-	    gPad->SetGridx();
-	    gPad->SetGridy();
-	  }
-	  gPad->SetLogz();
-	  cHitCorr->Update();
-	  moveTPaveStats(hPixelVSSCT);
-	  setTitleFont(font);
-	  ScalePlots(1);
-	  if (normalizePlots) hPixelVSSCT->Scale(1./(float)iEvents);
-	  somethingwasplotted = true;
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-	
-    cHitCorr->cd(4);
-    if (TrkCol_2 !="") {
-        histname = "IDAlignMon/"+TrkCol_2+"/GenericTracks/PIXvSCTHits";
-	    if(PrintLevel>0) cout << " <hitCorrelations> Plotting Histogram: " << histname << endl;
-	    hPixelVSSCT2 = (TH2F*)file->Get(histname);
-	    if (hPixelVSSCT2 != NULL) {
-          histtitle = TrkCol_2.Data();
-	      histtitle += ": Hits on track";
-	      hPixelVSSCT2->SetTitle(histtitle.Data());
-	      hPixelVSSCT2->GetXaxis()->SetTitle("SCT Hits on track");
-	      hPixelVSSCT2->GetYaxis()->SetTitle("Pixel Hits on track");
-	      hPixelVSSCT2 ->Draw("COLZ");
-	      if (!AtlasStyle) {
-	        gPad->SetGridx();
-	        gPad->SetGridy();
-	      }
-	      gPad->SetLogz();
-	      cHitCorr->Update();
-	      moveTPaveStats(hPixelVSSCT2);
-	      setTitleFont(font);
-	      ScalePlots(1);
-	      if (normalizePlots) hPixelVSSCT2->Scale(1./(float)iEvents);
-	      somethingwasplotted = true;
-	    }
-    }
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cHitCorr->cd(2);
-	histname = "IDAlignMon/"+TrkCol_1+"/GenericTracks/PIXHitsvEta";
-	if(PrintLevel>0) cout << " <hitCorrelations> Plotting Histogram: " << histname << endl;
-	hPixelEta = (TH2F*)file->Get(histname);
-	if (hPixelEta != NULL) {
-	  histtitle = TrkCol_1.Data();
-	  histtitle += ": Pixel hits vs Track #eta";
-	  hPixelEta->SetTitle(histtitle.Data());
-	  hPixelEta->GetXaxis()->SetTitle("#eta");
-	  hPixelEta->GetYaxis()->SetTitle("Pixel Hits on track");
-	  hPixelEta->Draw("COLZ");
-	  if (!AtlasStyle) {
-	    gPad->SetGridx();
-	    gPad->SetGridy();
-	  }
-	  gPad->SetLogz();
-	  cHitCorr->Update();
-	  moveTPaveStats(hPixelEta);
-	  setTitleFont(font);
-	  ScalePlots(1);
-	  if (normalizePlots) hPixelEta->Scale(1./(float)iEvents);
-	  somethingwasplotted = true;
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-	
-    cHitCorr->cd(5);
-    if (TrkCol_2 !="") {
-	   histname = "IDAlignMon/"+TrkCol_2+"/GenericTracks/PIXHitsvEta";
-	   if(PrintLevel>0) cout << " <hitsCorrelation> Plotting Histogram: " << histname << endl;
-	   hPixelEta2 = (TH2F*)file->Get(histname);
-	   if (hPixelEta2 != NULL) {
-	     histtitle = TrkCol_2.Data();
-         histtitle += ": Pixel hits vs Track #eta";
-         hPixelEta2->SetTitle(histtitle.Data());
-	     hPixelEta2->GetXaxis()->SetTitle("#eta");
-         hPixelEta2->GetYaxis()->SetTitle("Pixel Hits on track");
-	     hPixelEta2->Draw("COLZ");
-	     if (!AtlasStyle) {
-	       gPad->SetGridx();
-	       gPad->SetGridy();
-	     }
-	     gPad->SetLogz();
-	     cHitCorr->Update();
-	     moveTPaveStats(hPixelEta2);
-	     setTitleFont(font);
-	     ScalePlots(1);
-	     if (normalizePlots) hPixelEta2->Scale(1./(float)iEvents);
-           somethingwasplotted = true;
-	   }
-    }
-
-	cHitCorr->cd(3);
-	histname = "IDAlignMon/"+TrkCol_1+"/GenericTracks/SCTHitsvEta";
-	if(PrintLevel>0) cout << " <hitsCorrelation> Plotting Histogram: " << histname << endl;
-	hSCTEta = (TH2F*)file->Get(histname);
-	if (hSCTEta != NULL) {
-	  histtitle = TrkCol_1.Data();
-	  histtitle += ": SCT hits vs Track #eta";
-	  hSCTEta->SetTitle(histtitle.Data());
-	  hSCTEta->GetXaxis()->SetTitle("#eta");
-	  hSCTEta->GetYaxis()->SetTitle("SCT Hits on track");
-	  hSCTEta->Draw("COLZ");
-	  if (!AtlasStyle) {
-	    gPad->SetGridx();
-	    gPad->SetGridy();
-	  }
-	  gPad->SetLogz();
-	  cHitCorr->Update();
-	  moveTPaveStats(hSCTEta);
-	  setTitleFont(font);
-	  ScalePlots(1);
-	  if (normalizePlots) hSCTEta->Scale(1./(float)iEvents);
-	  somethingwasplotted = true;
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-    cHitCorr->cd(6);
-    if (TrkCol_2 !="") {
-	  histname = "IDAlignMon/"+TrkCol_2+"/GenericTracks/SCTHitsvEta";
-	  if(PrintLevel>0) cout << " <hitsCorrelation> Plotting Histogram: " << histname << endl;
-	    hSCTEta2 = (TH2F*)file->Get(histname);
-	    if (hSCTEta2 != NULL) {
-	      histtitle = TrkCol_2.Data();
-	      histtitle += ": SCT hits vs Track #eta";
-	      hSCTEta2->SetTitle(histtitle.Data());
-	      hSCTEta2->GetXaxis()->SetTitle("#eta");
-	      hSCTEta2->GetYaxis()->SetTitle("SCT Hits on track");
-	      hSCTEta2->Draw("COLZ");
-	      if (!AtlasStyle) {
-	        gPad->SetGridx();
-	        gPad->SetGridy();
-	      }
-	      gPad->SetLogz();
-	      cHitCorr->Update();
-	      moveTPaveStats(hSCTEta2);
-	      setTitleFont(font);
-	      ScalePlots(1);
-	      if (normalizePlots) hSCTEta2->Scale(1./(float)iEvents);
-	        somethingwasplotted = true;
-	      }
-    }
-
-	// if no histogram was found draw a blank
-	if (!somethingwasplotted) {
-	  TH1F* hBlank = new TH1F ("hBlank"," ",1, 0., 1.);
-	  cHitCorr->cd(1);
-	  hBlank->SetMaximum(1.);
-	  hBlank->SetMinimum(-1.);
-	  hBlank->Draw();
-	  TText myWarning;
-	  myWarning.DrawText(0., 0., " hitsCorrelation.cc NOTHING DRAWN. PLEASE CHECK ");
-	  
-	}
-	
-	return;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hits.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hits.cc
deleted file mode 100755
index 78d49beb9bd98423bce337b82d27633389f03588..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hits.cc
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void hits(TString trkCol_1, TString trkCol_2)
-{
-    
-    TH1F *hTracks;
-    TH1F *hTracks3;
-    TH1F *hnPixelhits;
-    TH1F *hnPixelhits2;
-    TH1F *hnSCThits;
-    TH1F *hnSCThits2;
-    TH1F *hnhits;
-    TH1F *hnhits2;
-    TH1F *hntrthits;
-    TH1F *hntrthits2;
-    TH1F *hnhitsevent;
-    TH1F *hnhitsevent2;
-    
-    float ent1, mean1;
-    float ent2, mean2;
-    int TracksWithoutPixelHits2, TracksWithoutSCTHits2, TracksWithouttrtHits2;
-    TString histname;
-    Char_t name[40];
-    cout << " <hits> Track and Hit information..." << endl;
-    
-    cHits = new TCanvas("TracksHits","Tracks and Hits information",CanvasSizeX6[0],CanvasSizeX6[1]);
-    cHits->Divide(3,2);
-    
-    
-    cHits->cd(1);
-    
-    histname = "IDAlignMon/"+trkCol_1+"/GenericTracks/ntracks";
-    if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-    hTracks = (TH1F*)file->Get(histname);
-    hTracks->SetTitle("Reco Tracks");
-    hTracks->GetXaxis()->SetTitle("Tracks per event");
-    hTracks->GetYaxis()->SetTitle("Entries");
-    if (normalizePlots) hTracks->Scale(1./(float)iEvents);
-    if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-    hTracks->SetLineColor(ColorForFirst+2);
-    hTracks->SetLineWidth(1);
-    hTracks->SetFillColor(ColorForFirst);
-    hTracks->SetFillStyle(3001);
-    hTracks->SetStats(kFALSE);
-    hTracks->SetTitle("Tracks per event");
-    hTracks ->DrawCopy("hist");
-    ScalePlots();
-    ent1 = hTracks->GetEntries();
-    mean1 = hTracks->GetMean();
-    
-    if (trkCol_2 !=""){
-        histname = "IDAlignMon/"+trkCol_2+"/GenericTracks/ntracks";
-        if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-        hTracks3 = (TH1F*)file->Get(histname);
-        hTracks3->SetLineColor(ColorForSecond);
-        hTracks3->SetLineWidth(1);
-        hTracks3->SetFillColor(ColorForSecond-9);
-        hTracks3->SetFillStyle(3001);
-        if (normalizePlots) hTracks3->Scale(1./(float)iEvents);
-        hTracks3 ->DrawCopy("same");
-        ent2 = hTracks3->GetEntries();
-        mean2 = hTracks3->GetMean();
-    
-    
-        if (hTracks->GetMaximum() < hTracks3->GetMaximum()) {
-            hTracks->GetYaxis()->SetRangeUser(0,hTracks3->GetMaximum()*1.1);
-            hTracks->DrawCopy("hist");
-            hTracks3->DrawCopy("same");
-        }
-    }
-    
-    setTitleFont(font);
-    
-    TLegend *leg0 = new TLegend(0.74,0.75,0.98,0.86);
-    sprintf(name,"mean: %2.2f",mean1);
-    leg0->AddEntry(hTracks,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"mean:% 2.2f",mean2);
-        leg0->AddEntry(hTracks3,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.47,0.89,0.98,1.0);
-    sprintf(name,"%s (%2.1fk)", trkCol_1.Data(), float(iTracks_1)/1000);
-    leg0->AddEntry(hTracks,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"%s (%2.1fk)", trkCol_2.Data(), float(iTracks_2)/1000);
-        leg0->AddEntry(hTracks3,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    
-    //
-    // -----------------------------------------------------------------
-    //
-    
-    cHits->cd(2);
-    histname = "IDAlignMon/"+trkCol_1+"/GenericTracks/Nhits_per_track";
-    if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-    
-    hnhits = (TH1F*)file->Get(histname);
-    if (normalizePlots) hnhits->Scale(1./(float)iEvents);
-    if (!AtlasStyle) {
-        gPad->SetGridy();
-        gPad->SetGridx();
-    }
-    hnhits->SetTitle("Hits on track");
-    hnhits->GetXaxis()->SetTitle("Hits on track");
-    hnhits->GetYaxis()->SetTitle("Entries");
-    hnhits->SetLineColor(ColorForFirst+2);
-    hnhits->SetLineWidth(1);
-    hnhits->SetFillColor(ColorForFirst);
-    hnhits->SetFillStyle(3001);
-    hnhits->SetStats(kFALSE);
-    hnhits->DrawCopy("hist");
-    setTitleFont(font);
-    ScalePlots();
-    setTitleFont(font);
-    ScalePlots();
-    ent1 = hnhits->GetEntries();
-    mean1 = hnhits->GetMean();
-    
-    
-    
-    if (trkCol_2 !=""){
-        histname = "IDAlignMon/"+trkCol_2+"/GenericTracks/Nhits_per_track";
-        if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-        
-        
-        hnhits2 = (TH1F*)file->Get(histname);
-        hnhits2->SetLineColor(ColorForSecond);
-        hnhits2->SetLineWidth(1);
-        hnhits2->SetFillColor(ColorForSecond-9);
-        hnhits2->SetFillStyle(3001);
-        if (normalizePlots) hnhits2->Scale(1./(float)iEvents);
-        hnhits2->DrawCopy("same");
-        ent2 = hnhits2->GetEntries();
-        mean2 = hnhits2->GetMean();
-        
-        if (hnhits->GetMaximum() < hnhits2->GetMaximum()) {
-            hnhits->GetYaxis()->SetRangeUser(0,1.05*hnhits2->GetMaximum());
-            hnhits->DrawCopy("hist");
-            hnhits2->DrawCopy("same");
-        }
-    }
-    
-    leg0 = new TLegend(0.74,0.75,0.98,0.86);
-    sprintf(name,"mean: %2.2f",mean1);
-    leg0->AddEntry(hnhits,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"mean:% 2.2f",mean2);
-        leg0->AddEntry(hnhits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.47,0.89,0.98,1.0);
-    sprintf(name,"%s (%2.1fk)", trkCol_1.Data(), float(iTracks_1)/1000);
-    leg0->AddEntry(hnhits,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"%s (%2.1fk)", trkCol_2.Data(), float(iTracks_2)/1000);
-        leg0->AddEntry(hnhits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-
-    
-    //
-    // -----------------------------------------------------------------
-    //
-    
-    cHits->cd(3);
-    histname = "IDAlignMon/"+trkCol_1+"/GenericTracks/Nhits_per_event";
-    if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-    
-    hnhitsevent = (TH1F*)file->Get(histname);
-    if (normalizePlots) hnhitsevent->Scale(1./(float)iEvents);
-    if (!AtlasStyle) {
-        gPad->SetGridy();
-        gPad->SetGridx();
-    }
-    hnhitsevent->SetTitle("Hits on event");
-    hnhitsevent->GetXaxis()->SetTitle("Hits on event");
-    hnhitsevent->GetYaxis()->SetTitle("Entries");
-    hnhitsevent->SetLineColor(ColorForFirst+2);
-    hnhitsevent->SetLineWidth(1);
-    hnhitsevent->SetFillColor(ColorForFirst);
-    hnhitsevent->SetFillStyle(3001);
-    hnhitsevent->SetStats(kFALSE);
-    hnhitsevent->DrawCopy("hist");
-    setTitleFont(font);
-    ScalePlots();
-    setTitleFont(font);
-    ScalePlots();
-    ent1 = hnhitsevent->GetEntries();
-    mean1 = hnhitsevent->GetMean();
-    
-    
-    if (trkCol_2 !=""){
-        histname = "IDAlignMon/"+trkCol_2+"/GenericTracks/Nhits_per_event";
-        if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-        
-        
-        hnhitsevent2 = (TH1F*)file->Get(histname);
-        hnhitsevent2->SetLineColor(ColorForSecond);
-        hnhitsevent2->SetLineWidth(1);
-        hnhitsevent2->SetFillColor(ColorForSecond-9);
-        hnhitsevent2->SetFillStyle(3001);
-        if (normalizePlots) hnhitsevent2->Scale(1./(float)iEvents);
-        hnhitsevent2->DrawCopy("same");
-        ent2 = hnhitsevent2->GetEntries();
-        mean2 = hnhitsevent2->GetMean();
-        
-        if (hnhitsevent->GetMaximum() < hnhitsevent2->GetMaximum()) {
-            hnhitsevent->GetYaxis()->SetRangeUser(0,1.05*hnhitsevent2->GetMaximum());
-            hnhitsevent->DrawCopy("hist");
-            hnhitsevent2->DrawCopy("same");
-        }
-    }
-    
-    leg0 = new TLegend(0.74,0.75,0.98,0.86);
-    sprintf(name,"mean: %2.2f",mean1);
-    leg0->AddEntry(hnhitsevent,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"mean:% 2.2f",mean2);
-        leg0->AddEntry(hnhitsevent2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.47,0.89,0.98,1.0);
-    sprintf(name,"%s (%2.1fk)", trkCol_1.Data(), float(iTracks_1)/1000);
-    leg0->AddEntry(hnhitsevent,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"%s (%2.1fk)", trkCol_2.Data(), float(iTracks_2)/1000);
-        leg0->AddEntry(hnhitsevent2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    //
-    // -----------------------------------------------------------------
-    //
-    
-    cHits->cd(4);
-    histname = "IDAlignMon/"+trkCol_1+"/GenericTracks/Npixhits_per_track";
-    if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-    
-    hnPixelhits = (TH1F*)file->Get(histname);
-    hnPixelhits->SetTitle("Pixel Hits on track");
-    hnPixelhits->GetXaxis()->SetTitle("Pixel Hits on track");
-    hnPixelhits->GetYaxis()->SetTitle("Entries");
-    if (normalizePlots) hnPixelhits->Scale(1./(float)iEvents);
-    if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-    hnPixelhits->SetLineColor(ColorForFirst+2);
-    hnPixelhits->SetLineWidth(1);
-    hnPixelhits->SetFillColor(ColorForFirst);
-    hnPixelhits->SetFillStyle(3001);
-    int TracksWithoutPixelHits = (int)hnPixelhits->GetBinContent(1);
-    hnPixelhits->SetBinContent(1,0.0);
-    hnPixelhits->SetStats(kFALSE);
-    ForceStyle(hnPixelhits);
-    hnPixelhits->DrawCopy("hist");
-    ScalePlots();
-    ent1 = hnPixelhits->GetEntries();
-    mean1 = hnPixelhits->GetMean();
-    
-    
-    if (trkCol_2 !=""){
-        histname = "IDAlignMon/"+trkCol_2+"/GenericTracks/Npixhits_per_track";
-        if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-        
-        
-        hnPixelhits2 = (TH1F*)file->Get(histname);
-        hnPixelhits2->SetLineColor(ColorForSecond);
-        hnPixelhits2->SetLineWidth(1);
-        hnPixelhits2->SetFillColor(ColorForSecond-9);
-        hnPixelhits2->SetFillStyle(3001);
-        TracksWithoutPixelHits2 = (int)hnPixelhits2->GetBinContent(1);
-        hnPixelhits2->SetBinContent(1,0.0);
-        if (normalizePlots) hnPixelhits2->Scale(1./(float)iEvents);
-        hnPixelhits2 ->DrawCopy("same");
-        ent2 = hnPixelhits2->GetEntries();
-        mean2 = hnPixelhits2->GetMean();
-        
-        if (hnPixelhits->GetMaximum() < hnPixelhits2->GetMaximum()) {
-            hnPixelhits->GetYaxis()->SetRangeUser(0,1.05*hnPixelhits2->GetMaximum());
-            hnPixelhits->DrawCopy("hist");
-            hnPixelhits2->DrawCopy("same");
-        }
-    }
-    
-    setTitleFont(font);
-    
-    leg0 = new TLegend(0.47,0.89,0.98,1.0);
-    sprintf(name,"%s (%2.1fk)", trkCol_1.Data(), float(iTracks_1)/1000);
-    leg0->AddEntry(hnPixelhits,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"%s (%2.1fk)", trkCol_2.Data(), float(iTracks_2)/1000);
-        leg0->AddEntry(hnPixelhits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.55,0.75,0.98,0.86);
-    sprintf(name,"trks w/o hits: %d",TracksWithoutPixelHits);
-    leg0->AddEntry(hnPixelhits,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"trks w/o hits: %d",TracksWithoutPixelHits2);
-        leg0->AddEntry(hnPixelhits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.74,0.61,0.98,0.72);
-    sprintf(name,"mean: %2.2f",mean1);
-    leg0->AddEntry(hnPixelhits,name,"L");
-    if (trkCol_2 !=""){
-        sprintf(name,"mean:% 2.2f",mean2);
-        leg0->AddEntry(hnPixelhits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-
-    
-    //
-    // -----------------------------------------------------------------
-    //
-    
-    cHits->cd(5);
-    histname = "IDAlignMon/"+trkCol_1+"/GenericTracks/Nscthits_per_track";
-    if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-    hnSCThits = (TH1F*)file->Get(histname);
-    if (normalizePlots) hnSCThits->Scale(1./(float)iEvents);
-    if (!AtlasStyle) {
-        gPad->SetGridy();
-        gPad->SetGridx();
-    }
-    hnSCThits->SetTitle("SCT Hits on track");
-    hnSCThits->GetXaxis()->SetTitle("SCT Hits on track");
-    hnSCThits->GetYaxis()->SetTitle("Entries");
-    hnSCThits->SetLineColor(ColorForFirst+2);
-    hnSCThits->SetLineWidth(1);
-    hnSCThits->SetFillColor(ColorForFirst);
-    hnSCThits->SetFillStyle(3001);
-    int TracksWithoutSCTHits = (int)hnSCThits->GetBinContent(1);
-    hnSCThits->SetBinContent(1,0.0);
-    hnSCThits->SetStats(kFALSE);
-    ForceStyle(hnSCThits);
-    hnSCThits->DrawCopy("hist");
-    setTitleFont(font);
-    ScalePlots();
-    ent1 = hnSCThits->GetEntries();
-    mean1 = hnSCThits->GetMean();
-
-    if (trkCol_2 !=""){
-        histname = "IDAlignMon/"+trkCol_2+"/GenericTracks/Nscthits_per_track";
-        if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-        
-        hnSCThits2 = (TH1F*)file->Get(histname);
-        hnSCThits2->SetLineColor(ColorForSecond);
-        hnSCThits2->SetLineWidth(1);
-        hnSCThits2->SetFillColor(ColorForSecond-9);
-        hnSCThits2->SetFillStyle(3001);
-        TracksWithoutSCTHits2 = (int)hnSCThits2->GetBinContent(1);
-        hnSCThits2->SetBinContent(1,0.0);
-        if (normalizePlots) hnSCThits2->Scale(1./(float)iEvents);
-        hnSCThits2->DrawCopy("same");
-        ent2 = hnSCThits2->GetEntries();
-        mean2 = hnSCThits2->GetMean();
-        
-        if (hnSCThits->GetMaximum() < hnSCThits2->GetMaximum()) {
-            hnSCThits->GetYaxis()->SetRangeUser(0,1.05*hnSCThits2->GetMaximum());
-            hnSCThits->DrawCopy("hist");
-            hnSCThits2->DrawCopy("same");
-        }
-    }
-    setTitleFont(font);
-    
-    
-    leg0 = new TLegend(0.47,0.89,0.98,1.0);
-    sprintf(name,"%s (%2.1fk)", trkCol_1.Data(), float(iTracks_1)/1000);
-    leg0->AddEntry(hnSCThits,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"%s (%2.1fk)", trkCol_2.Data(), float(iTracks_2)/1000);
-        leg0->AddEntry(hnSCThits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.60,0.75,0.98,0.86);
-    sprintf(name,"trks w/o hits: %d",TracksWithoutSCTHits);
-    leg0->AddEntry(hnSCThits,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"trks w/o hits: %d",TracksWithoutSCTHits2);
-        leg0->AddEntry(hnSCThits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.74,0.61,0.98,0.72);
-    sprintf(name,"mean: %2.2f",mean1);
-    leg0->AddEntry(hnSCThits,name,"L");
-    if (trkCol_2 !=""){
-        sprintf(name,"mean:% 2.2f",mean2);
-        leg0->AddEntry(hnSCThits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    //
-    // -----------------------------------------------------------------
-    //
-    
-    cHits->cd(6);
-    histname = "IDAlignMon/"+trkCol_1+"/GenericTracks/Ntrthits_per_track";
-    if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-    
-    hntrthits = (TH1F*)file->Get(histname);
-    if (normalizePlots) hntrthits->Scale(1./(float)iEvents);
-    if (!AtlasStyle) {
-        gPad->SetGridy();
-        gPad->SetGridx();
-    }
-    hntrthits->SetTitle("TRT Hits on track");
-    hntrthits->GetXaxis()->SetTitle("TRT Hits on track");
-    hntrthits->GetYaxis()->SetTitle("Entries");
-    int TracksWithouttrtHits = (int)hntrthits->GetBinContent(1);
-    hntrthits->SetBinContent(1,0.0);
-    hntrthits->SetLineColor(ColorForFirst+2);
-    hntrthits->SetLineWidth(1);
-    hntrthits->SetFillColor(ColorForFirst);
-    hntrthits->SetFillStyle(3001);
-    hntrthits->SetStats(kFALSE);
-    hntrthits->DrawCopy("hist");
-    setTitleFont(font);
-    ScalePlots();
-    setTitleFont(font);
-    ScalePlots();
-    ent1 = hntrthits->GetEntries();
-    mean1 = hntrthits->GetMean();
-
-    if (trkCol_2 !=""){
-        histname = "IDAlignMon/"+trkCol_2+"/GenericTracks/Ntrthits_per_track";
-        if(PrintLevel>0) cout << " <hits> Plotting Histogram: " << histname << endl;
-        
-        hntrthits2 = (TH1F*)file->Get(histname);
-        hntrthits2->SetLineColor(ColorForSecond);
-        hntrthits2->SetLineWidth(1);
-        hntrthits2->SetFillColor(ColorForSecond-9);
-        hntrthits2->SetFillStyle(3001);
-        TracksWithouttrtHits2 = (int)hntrthits2->GetBinContent(1);
-        hntrthits2->SetBinContent(1,0.0);
-        if (normalizePlots) hntrthits2->Scale(1./(float)iEvents);
-        hntrthits2->DrawCopy("same");
-        ent2 = hntrthits2->GetEntries();
-        mean2 = hntrthits2->GetMean();
-        
-        if (hntrthits->GetMaximum() < hntrthits2->GetMaximum()) {
-            hntrthits->GetYaxis()->SetRangeUser(0,1.05*hntrthits2->GetMaximum());
-            hntrthits->DrawCopy("hist");
-            hntrthits2->DrawCopy("same");
-        }
-    }
-    
-    leg0 = new TLegend(0.47,0.89,0.98,1.0);
-    sprintf(name,"%s (%2.1fk)", trkCol_1.Data(), float(iTracks_1)/1000);
-    leg0->AddEntry(hntrthits,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"%s (%2.1fk)", trkCol_2.Data(), float(iTracks_2)/1000);
-        leg0->AddEntry(hntrthits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.55,0.75,0.98,0.86);
-    sprintf(name,"trks w/o hits: %d",TracksWithouttrtHits);
-    if (trkCol_2 != "") {
-        leg0->AddEntry(hntrthits,name,"L");
-        sprintf(name,"trks w/o hits: %d",TracksWithouttrtHits2);
-        leg0->AddEntry(hntrthits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    leg0 = new TLegend(0.74,0.61,0.98,0.72);
-    sprintf(name,"mean: %2.2f",mean1);
-    leg0->AddEntry(hntrthits,name,"L");
-    if (trkCol_2 != "") {
-        sprintf(name,"mean:% 2.2f",mean2);
-        leg0->AddEntry(hntrthits2,name,"L");
-    }
-    leg0->SetTextSize(0.035);
-    leg0->SetFillColor(kWhite);
-    leg0->Draw();
-    
-    return;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hitsPerLayer.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hitsPerLayer.cc
deleted file mode 100755
index 3b1dd0aa658098ad63ae1f98ad7f2a5117467aee..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/hitsPerLayer.cc
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void hitsPerLayer(TString TrkCol_1, TString TrkCol_2) {
-	TH1F * hHitsPerLayerEndcapATrkCol1;
-	TH1F * hHitsPerLayerBarrelTrkCol1; 
-	TH1F * hHitsPerLayerEndcapCTrkCol1;
-	TH1F * hHitsPerLayerEndcapATrkCol2;
-	TH1F * hHitsPerLayerBarrelTrkCol2; 
-	TH1F * hHitsPerLayerEndcapCTrkCol2;
-	TString histname;
-	TString histtitle;
-	
-	cout << " <hitsPerLayer> Hits per layer..." << endl;
- 
-	cHitsPerLayer = new TCanvas("HitsPerLayer","Hits per layer",CanvasSizeX6[0],CanvasSizeX6[1]);
-	cHitsPerLayer->Divide(3,2);
-
-	cHitsPerLayer->cd(1);
-		
-	histname = "IDAlignMon/"+TrkCol_1+"/HitEfficiencies/measurements_vs_layer_ecc";
-	if(PrintLevel>0) cout << " <hitsPerLayer> Plotting Histogram: " << histname << endl;
-	hHitsPerLayerEndcapCTrkCol1 = (TH1F*)file->Get(histname);
-	histtitle.Clear();
-	histtitle += TrkCol_1.Data();
-	histtitle += " Hits per disk (ECC)";
-	hHitsPerLayerEndcapCTrkCol1->SetTitle(histtitle.Data());
-	if (normalizePlots) hHitsPerLayerEndcapCTrkCol1->Scale(1./(float)iEvents);
-	hHitsPerLayerEndcapCTrkCol1->SetStats(false);
-	hHitsPerLayerEndcapCTrkCol1->GetXaxis()->SetTitle("EndCap C Disk");
-	hHitsPerLayerEndcapCTrkCol1->GetXaxis()->SetTitleOffset(1.3);
-	hHitsPerLayerEndcapCTrkCol1->GetYaxis()->SetTitle("Hits");
-	hHitsPerLayerEndcapCTrkCol1->SetLineColor(kGray+2);
-	hHitsPerLayerEndcapCTrkCol1->SetLineWidth(2);
-	hHitsPerLayerEndcapCTrkCol1->Draw("hist");
-	if (!AtlasStyle) {
-		gPad->SetGridy();
-		gPad->SetGridx();
-	}	
-	setTitleFont(font);
-	ScalePlots();
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cHitsPerLayer->cd(2);
-    histname = "IDAlignMon/"+TrkCol_1+"/HitEfficiencies/measurements_vs_layer_barrel";
-    if(PrintLevel>0) cout << " <hitsPerLayer> Plotting Histogram: " << histname << endl;
-    hHitsPerLayerBarrelTrkCol1 = (TH1F*)file->Get(histname);
-    histtitle.Clear();
-    histtitle += TrkCol_1.Data();
-    histtitle += " Hits per barrel layer";
-    hHitsPerLayerBarrelTrkCol1->SetTitle(histtitle.Data());
-    if (normalizePlots) hHitsPerLayerBarrelTrkCol1->Scale(1./(float)iEvents);
-    hHitsPerLayerBarrelTrkCol1->SetStats(false);
-    hHitsPerLayerBarrelTrkCol1->GetXaxis()->SetTitle("Barrel Layer");
-    hHitsPerLayerBarrelTrkCol1->GetYaxis()->SetTitleOffset(2.0);
-    hHitsPerLayerBarrelTrkCol1->GetYaxis()->SetTitle("Hits");
-    hHitsPerLayerBarrelTrkCol1->SetLineColor(kGray+2);
-    hHitsPerLayerBarrelTrkCol1->SetLineWidth(2);
-    hHitsPerLayerBarrelTrkCol1->Draw("hist");
-    if (!AtlasStyle) {
-        gPad->SetGridy();
-        gPad->SetGridx();
-    }
-    setTitleFont(font);
-    ScalePlots();
-
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cHitsPerLayer->cd(3);
-	histname = "IDAlignMon/"+TrkCol_1+"/HitEfficiencies/measurements_vs_layer_eca";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hHitsPerLayerEndcapATrkCol1 = (TH1F*)file->Get(histname);
-	histtitle.Clear();
-	histtitle += TrkCol_1.Data();
-	histtitle += " Hits per disk (ECA)";
-	hHitsPerLayerEndcapATrkCol1->SetTitle(histtitle.Data());
-	if (normalizePlots) hHitsPerLayerEndcapATrkCol1->Scale(1./(float)iEvents);
-	hHitsPerLayerEndcapATrkCol1->SetStats(false);
-	hHitsPerLayerEndcapATrkCol1->GetXaxis()->SetTitle("EndCapA Disk");
-	hHitsPerLayerEndcapATrkCol1->GetXaxis()->SetTitleOffset(1.3);
-	hHitsPerLayerEndcapATrkCol1->GetYaxis()->SetTitle("Hits");
-	hHitsPerLayerEndcapATrkCol1->SetLineColor(kGray+2);
-	hHitsPerLayerEndcapATrkCol1->SetLineWidth(2);
-	hHitsPerLayerEndcapATrkCol1->Draw("hist");
-	if (!AtlasStyle) {
-		gPad->SetGridy();
-		gPad->SetGridx();
-	}
-	setTitleFont(font);
-	ScalePlots();
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-
-      cHitsPerLayer->cd(4);
-      if (TrkCol_2 !=""){
-	  histname = "IDAlignMon/"+TrkCol_2+"/HitEfficiencies/measurements_vs_layer_ecc";
-	  if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	  hHitsPerLayerEndcapCTrkCol2 = (TH1F*)file->Get(histname);
-	  histtitle.Clear();
-	  histtitle += TrkCol_2.Data();
-	  histtitle += " Hits per disk (ECC)";
-	  hHitsPerLayerEndcapCTrkCol2->SetTitle(histtitle.Data());
-	  if (normalizePlots) hHitsPerLayerEndcapCTrkCol2->Scale(1./(float)iEvents);
-	  hHitsPerLayerEndcapCTrkCol2->SetStats(false);
-	  hHitsPerLayerEndcapCTrkCol2->GetXaxis()->SetTitle(" EndCapC Disk");
-	  hHitsPerLayerEndcapCTrkCol2->GetXaxis()->SetTitleOffset(1.3);
-	  hHitsPerLayerEndcapCTrkCol2->GetYaxis()->SetTitle("Hits");
-	  hHitsPerLayerEndcapCTrkCol2->SetLineColor(kRed);
-	  hHitsPerLayerEndcapCTrkCol2->SetLineWidth(2);
-	  hHitsPerLayerEndcapCTrkCol2->Draw("hist");
-	  if (!AtlasStyle) {
-        gPad->SetGridy();
-		gPad->SetGridx();
-	  }
-	  setTitleFont(font);
-	  ScalePlots();
-    }
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-      cHitsPerLayer->cd(5);
-      if (TrkCol_2 !=""){
-	  histname = "IDAlignMon/"+TrkCol_2+"/HitEfficiencies/measurements_vs_layer_barrel";
-	  if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	  hHitsPerLayerBarrelTrkCol2 = (TH1F*)file->Get(histname);
-	  histtitle.Clear();
-	  histtitle += TrkCol_2.Data();
-	  histtitle += " Hits per barrel layer";
-	  hHitsPerLayerBarrelTrkCol2->SetTitle(histtitle.Data());
-	  if (normalizePlots) hHitsPerLayerBarrelTrkCol2->Scale(1./(float)iEvents);
-	  hHitsPerLayerBarrelTrkCol2->SetStats(false);
-	  hHitsPerLayerBarrelTrkCol2->GetXaxis()->SetTitle("Barrel Layer");
-	  hHitsPerLayerBarrelTrkCol2->GetYaxis()->SetTitle("Hits");
-	  hHitsPerLayerBarrelTrkCol2->SetLineColor(kRed);
-	  hHitsPerLayerBarrelTrkCol2->SetLineWidth(2);
-	  hHitsPerLayerBarrelTrkCol2->Draw("hist");
-	  if (!AtlasStyle) {
-		gPad->SetGridy();
-		gPad->SetGridx();
-	  }
-	  setTitleFont(font);
-	  ScalePlots();
-    }
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cHitsPerLayer->cd(6);
-    if(TrkCol_2 !=""){
-	  histname = "IDAlignMon/"+TrkCol_2+"/HitEfficiencies/measurements_vs_layer_eca";
-	  if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	  hHitsPerLayerEndcapATrkCol2 = (TH1F*)file->Get(histname);
-	  histtitle.Clear();
-	  histtitle += TrkCol_2.Data();
-	  histtitle += " Hits per disk (ECA)";
-	  hHitsPerLayerEndcapATrkCol2->SetTitle(histtitle.Data());
-	  if (normalizePlots) hHitsPerLayerEndcapATrkCol2->Scale(1./(float)iEvents);
-	  hHitsPerLayerEndcapATrkCol2->SetStats(false);
-	  hHitsPerLayerEndcapATrkCol2->GetXaxis()->SetTitle("EndCapA Disk");
-	  hHitsPerLayerEndcapATrkCol2->GetXaxis()->SetTitleOffset(1.3);
-	  hHitsPerLayerEndcapATrkCol2->GetYaxis()->SetTitle("Hits");
-	  hHitsPerLayerEndcapATrkCol2->SetLineColor(kRed);
-	  hHitsPerLayerEndcapATrkCol2->SetLineWidth(2);
-	  hHitsPerLayerEndcapATrkCol2->Draw("hist");
-	  if (!AtlasStyle) {
-		gPad->SetGridy();
-		gPad->SetGridx();
-	  }
-	  setTitleFont(font);
-	  ScalePlots();
-    }
-
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelBarrelRes.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelBarrelRes.cc
deleted file mode 100644
index 5895650688eda373309ab5a21f18fb0d100e32e9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelBarrelRes.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void pixelBarrelResiduals(TString trkCol){
-	pixelBarrelResiduals(trkCol, 0, "");
-}
-
-void pixelBarrelResiduals(TString trkCol, TString trkCol2){
-	pixelBarrelResiduals(trkCol, 0, trkCol2);
-}
-
-void pixelBarrelResiduals(TString trkCol, TCanvas *cPIXBarrelRes){
-	pixelBarrelResiduals(trkCol, cPIXBarrelRes, "");
-}
-
-void pixelBarrelResiduals(TString trkCol, TCanvas *cPIXBarrelRes, TString trkCol2) {
-	TH1F *hPIXPhiBarrelRes[3];
-	TH1F *hPIXEtaBarrelRes[3];
-	
-	TH1F *hPIXPhiBarrelRes_2[3];
-	TH1F *hPIXEtaBarrelRes_2[3];
-	
-	TString histname, histtitle;
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cPIXBarrelRes){
-		cPIXBarrelRes = new TCanvas("cPIXBarrelRes","PIX Barrel Residuals per Layer",
-			      CanvasSizeX6[0],CanvasSizeX6[1]);
-	}
-	cPIXBarrelRes->Divide(3,2);
-	for(int layer=0; layer<3; layer++){
-		cPIXBarrelRes->cd(layer+1);
-		
-		histname = "IDAlignMon/"+trkCol+"/Residuals/pix_b";
-		histname += layer;
-		histname += "_biased_residualx";
-		if(PrintLevel>0) cout << " <pixelBarrelRes> Plotting Histogram: " << histname << endl;
-		hPIXPhiBarrelRes[layer] = (TH1F*)file->Get(histname);	
-
-		if (hPIXPhiBarrelRes[layer] == NULL) { // check if histogram exists
-		  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-		  return;
-		}
-
-		histtitle.Clear();
-		histtitle += trkCol.Data();
-		histtitle += ": Pixel Barrel L";
-		histtitle += layer;
-		histtitle += " local x residuals";
-		hPIXPhiBarrelRes[layer]->SetTitle(histtitle.Data());
-		hPIXPhiBarrelRes[layer]->GetXaxis()->SetTitle("Residuals [mm]");
-		hPIXPhiBarrelRes[layer]->GetYaxis()->SetTitle("Entries");
-		hPIXPhiBarrelRes[layer]->SetLineColor(Color+2);
-		hPIXPhiBarrelRes[layer]->SetFillColor(Color);
-		hPIXPhiBarrelRes[layer]->SetLineWidth(1);
-		hPIXPhiBarrelRes[layer]->SetFillStyle(3001);
-		if (normalizePlots) hPIXPhiBarrelRes[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hPIXPhiBarrelRes[layer]->DrawCopy("hist");
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_b";
-			histname += layer;
-			histname += "_biased_residualx";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			hPIXPhiBarrelRes_2[layer] = (TH1F*)file->Get(histname);	
-			hPIXPhiBarrelRes_2[layer]->SetLineColor(ColorForSecond+2);
-			hPIXPhiBarrelRes_2[layer]->SetFillColor(ColorForSecond);
-			hPIXPhiBarrelRes_2[layer]->SetLineWidth(1);
-			hPIXPhiBarrelRes_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hPIXPhiBarrelRes_2[layer]->Scale(1./(float)iEvents);
-			hPIXPhiBarrelRes_2[layer]->DrawCopy("histsame");
-		}
-		
-		
-		cPIXBarrelRes->cd(layer+4);
-		
-		histname = "IDAlignMon/"+trkCol+"/Residuals/pix_b";
-		histname += layer;
-		histname += "_biased_residualy";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPIXEtaBarrelRes[layer] = (TH1F*)file->Get(histname);
-		histtitle.Clear();
-		histtitle += trkCol.Data();
-		histtitle += ": Pixel Barrel L";
-		histtitle += layer;
-		histtitle += " local y residuals";
-		hPIXEtaBarrelRes[layer]->SetTitle(histtitle.Data());
-		hPIXEtaBarrelRes[layer]->GetXaxis()->SetTitle("Residuals [mm]");
-		hPIXEtaBarrelRes[layer]->GetYaxis()->SetTitle("Entries");
-		hPIXEtaBarrelRes[layer]->SetLineColor(Color+2);
-		hPIXEtaBarrelRes[layer]->SetFillColor(Color);
-		hPIXEtaBarrelRes[layer]->SetLineWidth(1);
-		hPIXEtaBarrelRes[layer]->SetFillStyle(3001);
-		if (normalizePlots) hPIXEtaBarrelRes[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hPIXEtaBarrelRes[layer]->DrawCopy("hist");
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_b";
-			histname += layer;
-			histname += "_biased_residualy";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			hPIXEtaBarrelRes_2[layer] = (TH1F*)file->Get(histname);	
-			hPIXEtaBarrelRes_2[layer]->SetLineColor(ColorForSecond+2);
-			hPIXEtaBarrelRes_2[layer]->SetFillColor(ColorForSecond);
-			hPIXEtaBarrelRes_2[layer]->SetLineWidth(1);
-			hPIXEtaBarrelRes_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hPIXEtaBarrelRes_2[layer]->Scale(1./(float)iEvents);
-			hPIXEtaBarrelRes_2[layer]->DrawCopy("histsame");
-		}
-		
-	}
-
-
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelBarrelResVsPt.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelBarrelResVsPt.cc
deleted file mode 100644
index fd8612f638e5258bde4819f42f76ec387fcdd6bf..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelBarrelResVsPt.cc
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void pixelBarrelResidualsVsPt(TString trkCol){
-	pixelBarrelResidualsVsPt(trkCol, 0, "");
-}
-
-void pixelBarrelResidualsVsPt(TString trkCol, TString trkCol2){
-	pixelBarrelResidualsVsPt(trkCol, 0, trkCol2);
-}
-
-void pixelBarrelResidualsVsPt(TString trkCol, TCanvas *cPIXBarrelResVsPt){
-	pixelBarrelResidualsVsPt(trkCol, cPIXBarrelResVsPt, "");
-}
-
-void pixelBarrelResidualsVsPt(TString trkCol, TCanvas *cPIXBarrelResVsPt, TString trkCol2) {
-	TProfile *hPIXPhiBarrelResVsPt[3];
-	TProfile *hPIXEtaBarrelResVsPt[3];
-	
-	TProfile *hPIXPhiBarrelResVsPt_2[3];
-	TProfile *hPIXEtaBarrelResVsPt_2[3];
-	
-	float ProfEtaMax = 0;
-	float max,min;
-   	float ProfPhiMax = 0;
-   	
-	TH2F *tempHist;
-	TString histname, histtitle;
-	Color_t Color;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " <pixelBarrelResVsPt> Residuals..." << endl;
-	if (!cPIXBarrelResVsPt){
-		cPIXBarrelResVsPt = new TCanvas("cPIXBarrelResVsPt","PIX Barrel Residuals per Layer",
-			      CanvasSizeX6[0],CanvasSizeX6[1]);
-	}
-	cPIXBarrelResVsPt->Divide(3,2);
-	for(int layer=0; layer<3; layer++){
-		cPIXBarrelResVsPt->cd(layer+1);
-		
-		histname = "IDAlignMon/"+trkCol+"/Residuals/pix_b";
-		histname += layer;
-		histname += "_biased_residualx_pt";
-		// histname += "_unbiased_residualx_pt";
-		if(PrintLevel>0) cout << " <pixelBarrelResVsPt> Plotting Histogram: " << histname << endl;
-		tempHist = (TH2F*)file->Get(histname);
-
-		if (tempHist == NULL) { // check if histogram exists
-		  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-		  return;
-		}
-
-		hPIXPhiBarrelResVsPt[layer] = tempHist->ProfileX();	
-		histtitle.Clear();
-		histtitle = trkCol.Data();
-		histtitle += ": Pixel barrel L";
-		histtitle += layer;
-		histtitle += " Local x residuals Vs p_{T}";
-		hPIXPhiBarrelResVsPt[layer]->SetTitle(histtitle.Data());
-		hPIXPhiBarrelResVsPt[layer]->GetXaxis()->SetTitle("Track qp_{T} [GeV]");
-		hPIXPhiBarrelResVsPt[layer]->GetYaxis()->SetTitle("Local x residuals [mm]");
-		hPIXPhiBarrelResVsPt[layer]->SetLineColor(Color+2);
-		hPIXPhiBarrelResVsPt[layer]->SetFillColor(Color);
-		hPIXPhiBarrelResVsPt[layer]->SetLineWidth(1);
-		hPIXPhiBarrelResVsPt[layer]->SetFillStyle(3001);
-		if (normalizePlots) hPIXPhiBarrelResVsPt[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hPIXPhiBarrelResVsPt[layer]->SetStats(false);
-		hPIXPhiBarrelResVsPt[layer]->DrawCopy();
-		max = fabs(hPIXPhiBarrelResVsPt[layer]->GetMaximum());
-		min = fabs(hPIXPhiBarrelResVsPt[layer]->GetMinimum());
-		if(ProfPhiMax<max) ProfPhiMax = max;
-		if(ProfPhiMax<min) ProfPhiMax = min;
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_b";
-			histname += layer;
-			histname += "_biased_residualx_pt";
-			// histname += "_residualx_pt";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			tempHist = (TH2F*)file->Get(histname);
-		    hPIXPhiBarrelResVsPt_2[layer] = tempHist->ProfileX();	
-			hPIXPhiBarrelResVsPt_2[layer]->SetLineColor(ColorForSecond+2);
-			hPIXPhiBarrelResVsPt_2[layer]->SetFillColor(ColorForSecond);
-			hPIXPhiBarrelResVsPt_2[layer]->SetLineWidth(1);
-			hPIXPhiBarrelResVsPt_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hPIXPhiBarrelResVsPt_2[layer]->Scale(1./(float)iEvents);
-			hPIXPhiBarrelResVsPt_2[layer]->DrawCopy("same");
-			max = fabs(hPIXPhiBarrelResVsPt_2[layer]->GetMaximum());
-			min = fabs(hPIXPhiBarrelResVsPt_2[layer]->GetMinimum());
-			if(ProfPhiMax<max) ProfPhiMax = max;
-			if(ProfPhiMax<min) ProfPhiMax = min;
-		}
-		
-		
-		cPIXBarrelResVsPt->cd(layer+4);
-		
-		histname = "IDAlignMon/"+trkCol+"/Residuals/pix_b";
-		histname += layer;
-		histname += "_biased_residualy_pt";
-		//histname += "_residualy_pt";
-		if(PrintLevel>0) cout << " <pixelBarrelResVsPt> Plotting Histogram: " << histname << endl;
-		tempHist = (TH2F*)file->Get(histname);
-		hPIXEtaBarrelResVsPt[layer] = tempHist->ProfileX();
-		histtitle.Clear();
-		histtitle = trkCol.Data();
-		histtitle += ": Pixel barrel L";
-		histtitle += layer;
-		histtitle += " Local y residuals Vs p_{T}";
-		hPIXEtaBarrelResVsPt[layer]->SetTitle(histtitle.Data());
-		hPIXEtaBarrelResVsPt[layer]->GetXaxis()->SetTitle("Track qp_{T} [GeV]");
-		hPIXEtaBarrelResVsPt[layer]->GetYaxis()->SetTitle("Local y residuals [mm]");
-		hPIXEtaBarrelResVsPt[layer]->SetLineColor(Color+2);
-		hPIXEtaBarrelResVsPt[layer]->SetFillColor(Color);
-		hPIXEtaBarrelResVsPt[layer]->SetLineWidth(1);
-		hPIXEtaBarrelResVsPt[layer]->SetFillStyle(3001);
-		if (normalizePlots) hPIXEtaBarrelResVsPt[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hPIXEtaBarrelResVsPt[layer]->DrawCopy();
-		max = fabs(hPIXEtaBarrelResVsPt[layer]->GetMaximum());
-		min = fabs(hPIXEtaBarrelResVsPt[layer]->GetMinimum());
-		if(ProfEtaMax<max) ProfEtaMax = max;
-		if(ProfEtaMax<min) ProfEtaMax = min;
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_b";
-			histname += layer;
-			histname += "_biased_residualy_pt";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			tempHist = (TH2F*)file->Get(histname);
-			hPIXEtaBarrelResVsPt_2[layer] = tempHist->ProfileX();	
-			hPIXEtaBarrelResVsPt_2[layer]->SetLineColor(ColorForSecond+2);
-			hPIXEtaBarrelResVsPt_2[layer]->SetFillColor(ColorForSecond);
-			hPIXEtaBarrelResVsPt_2[layer]->SetLineWidth(1);
-			hPIXEtaBarrelResVsPt_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hPIXEtaBarrelResVsPt_2[layer]->Scale(1./(float)iEvents);
-			hPIXEtaBarrelResVsPt_2[layer]->DrawCopy("same");
-			max = fabs(hPIXEtaBarrelResVsPt_2[layer]->GetMaximum());
-			min = fabs(hPIXEtaBarrelResVsPt_2[layer]->GetMinimum());
-			if(ProfEtaMax<max) ProfEtaMax = max;
-			if(ProfEtaMax<min) ProfEtaMax = min;
-		}
-		
-	}
-	for(int layer=0; layer<3; layer++){
-		hPIXPhiBarrelResVsPt[layer]->SetMaximum(ProfPhiMax*1.1);
-		hPIXPhiBarrelResVsPt[layer]->SetMinimum(-ProfPhiMax*1.1);
-		hPIXEtaBarrelResVsPt[layer]->SetMaximum(ProfEtaMax*1.1);
-		hPIXEtaBarrelResVsPt[layer]->SetMinimum(-ProfEtaMax*1.1);
-
-	}
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelECRes.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelECRes.cc
deleted file mode 100644
index 6b07386eb4979c59e5758282ddb7aabe8411c9a8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelECRes.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void pixelECResiduals(TString trkCol, bool ec){
-	pixelECResiduals(trkCol, ec, 0, "");
-}
-
-void pixelECResiduals(TString trkCol, bool ec, TString trkCol2){
-	pixelECResiduals(trkCol, ec, 0, trkCol2);
-}
-
-void pixelECResiduals(TString trkCol, bool ec, TCanvas *cPIXECRes){
-	pixelECResiduals(trkCol, ec, cPIXECRes, "");
-}
-
-void pixelECResiduals(TString trkCol, bool ec, TCanvas *cPIXECRes, TString trkCol2) {
-	TH1F *hPIXPhiECRes[3];
-	TH1F *hPIXEtaECRes[3];
-	
-	TH1F *hPIXPhiECRes_2[3];
-	TH1F *hPIXEtaECRes_2[3];
-	
-	TString histname, histtitle;
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cPIXECRes){
-		if(!ec)
-			cPIXECRes = new TCanvas("cPIXECRes","PIX Endcap A Residuals per Layer",
-			      CanvasSizeX6[0],CanvasSizeX6[1]);
-		else
-			cPIXECRes = new TCanvas("cPIXECRes","PIX Endcap C Residuals per Layer",
-			      CanvasSizeX6[0],CanvasSizeX6[1]);
-			
-	}
-	cPIXECRes->Divide(3,2);
-	for(int layer=0; layer<3; layer++){
-		cPIXECRes->cd(layer+1);
-		
-		if(!ec)
-			histname = "IDAlignMon/"+trkCol+"/Residuals/pix_eca_d";
-		else
-			histname = "IDAlignMon/"+trkCol+"/Residuals/pix_ecc_d";
-		histname += layer;
-		histname += "_biased_residualx";
-		// histname += "_residualx";
-		if(PrintLevel>0) cout << " <pixelECRes> Plotting Histogram: " << histname << endl;
-		hPIXPhiECRes[layer] = (TH1F*)file->Get(histname);
-
-		if ( hPIXPhiECRes[layer] == NULL) { // check if histogram exists
-		  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-		  return;
-		}
-	
-		histtitle = trkCol.Data();
-		if(ec)
-		  histtitle += " PIX ECC D";
-		else
-		  histtitle += " PIX ECA D";
-		histtitle += layer;
-		histtitle += " local x residuals";
-
-		hPIXPhiECRes[layer]->SetTitle(histtitle.Data());
-		hPIXPhiECRes[layer]->GetXaxis()->SetTitle("Local x residuals [mm]");
-		hPIXPhiECRes[layer]->GetYaxis()->SetTitle("Entries");
-		hPIXPhiECRes[layer]->SetLineColor(Color+2);
-		hPIXPhiECRes[layer]->SetFillColor(Color);
-		hPIXPhiECRes[layer]->SetLineWidth(1);
-		hPIXPhiECRes[layer]->SetFillStyle(3001);
-		if (normalizePlots) hPIXPhiECRes[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hPIXPhiECRes[layer]->DrawCopy("hist");
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			if(!ec)
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_eca_d";
-			else
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_ecc_d";
-			histname += layer;
-			histname += "_biased_residualx";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			hPIXPhiECRes_2[layer] = (TH1F*)file->Get(histname);	
-			hPIXPhiECRes_2[layer]->SetLineColor(ColorForSecond+2);
-			hPIXPhiECRes_2[layer]->SetFillColor(ColorForSecond);
-			hPIXPhiECRes_2[layer]->SetLineWidth(1);
-			hPIXPhiECRes_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hPIXPhiECRes_2[layer]->Scale(1./(float)iEvents);
-			hPIXPhiECRes_2[layer]->DrawCopy("histsame");
-		}
-		
-		
-		cPIXECRes->cd(layer+4);
-		if(!ec)
-			histname = "IDAlignMon/"+trkCol+"/Residuals/pix_eca_d";
-		else
-			histname = "IDAlignMon/"+trkCol+"/Residuals/pix_ecc_d";
-		histname += layer;
-		histname += "_biased_residualy";
-		//histname += "_residualy";
-		if(PrintLevel>0) cout << " <pixelECRes> Plotting Histogram: " << histname << endl;
-		hPIXEtaECRes[layer] = (TH1F*)file->Get(histname);
-		histtitle = trkCol.Data();
-		if(ec)
-		  histtitle += " PIX ECC D";
-		else
-		  histtitle += " PIX ECA D";
-		histtitle += layer;
-		histtitle += " local x residuals";
-
-		hPIXEtaECRes[layer]->SetTitle(histtitle.Data());
-		hPIXEtaECRes[layer]->GetXaxis()->SetTitle("Local y Residuals (mm)");
-		hPIXEtaECRes[layer]->GetYaxis()->SetTitle("Entries");
-		hPIXEtaECRes[layer]->SetLineColor(Color+2);
-		hPIXEtaECRes[layer]->SetFillColor(Color);
-		hPIXEtaECRes[layer]->SetLineWidth(1);
-		hPIXEtaECRes[layer]->SetFillStyle(3001);
-		if (normalizePlots) hPIXEtaECRes[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hPIXEtaECRes[layer]->DrawCopy("hist");
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			if(!ec)
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_eca_d";
-			else
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_ecc_d";
-			histname += layer;
-			histname += "_residualy";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			hPIXEtaECRes_2[layer] = (TH1F*)file->Get(histname);	
-			hPIXEtaECRes_2[layer]->SetLineColor(ColorForSecond+2);
-			hPIXEtaECRes_2[layer]->SetFillColor(ColorForSecond);
-			hPIXEtaECRes_2[layer]->SetLineWidth(1);
-			hPIXEtaECRes_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hPIXEtaECRes_2[layer]->Scale(1./(float)iEvents);
-			hPIXEtaECRes_2[layer]->DrawCopy("histsame");
-		}
-		
-	}
-
-
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelECResVsPt.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelECResVsPt.cc
deleted file mode 100644
index e0545089d3aa3ba236dd0083d70d3da721f227fc..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelECResVsPt.cc
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void pixelECResidualsVsPt(TString trkCol, bool ec){
-	pixelECResidualsVsPt(trkCol, ec, 0, "");
-}
-
-void pixelECResidualsVsPt(TString trkCol, bool ec, TString trkCol2){
-	pixelECResidualsVsPt(trkCol, ec, 0, trkCol2);
-}
-
-void pixelECResidualsVsPt(TString trkCol, bool ec, TCanvas *cPIXECResVsPt){
-	pixelECResidualsVsPt(trkCol, ec, cPIXECResVsPt, "");
-}
-
-void pixelECResidualsVsPt(TString trkCol, bool ec, TCanvas *cPIXECResVsPt, TString trkCol2) {
-	TProfile *hPIXPhiECResVsPt[3];
-	TProfile *hPIXEtaECResVsPt[3];
-	
-	TProfile *hPIXPhiECResVsPt_2[3];
-	TProfile *hPIXEtaECResVsPt_2[3];
-	
-	TH2F *tempHist;
-	float ProfEtaMax = 0;
-	float max,min;
-   	float ProfPhiMax = 0;
-   	
-	TString histname;
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cPIXECResVsPt){
-		if(!ec)
-			cPIXECResVsPt = new TCanvas("cPIXECResVsPt","PIX Endcap A Residuals per Layer",
-			      CanvasSizeX6[0],CanvasSizeX6[1]);
-		else
-			cPIXECResVsPt = new TCanvas("cPIXECResVsPt","PIX Endcap C Residuals per Layer",
-			      CanvasSizeX6[0],CanvasSizeX6[1]);
-			
-	}
-	cPIXECResVsPt->Divide(3,2);
-	for(int layer=0; layer<3; layer++){
-		cPIXECResVsPt->cd(layer+1);
-		
-		if(!ec)
-			histname = "IDAlignMon/"+trkCol+"/Residuals/pix_eca_d";
-		else
-			histname = "IDAlignMon/"+trkCol+"/Residuals/pix_ecc_d";
-		histname += layer;
-		histname += "_biased_residualx_pt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		tempHist = (TH2F*)file->Get(histname);
-		hPIXPhiECResVsPt[layer] = tempHist->ProfileX();	
-		if(!ec)
-			sprintf(name,"Pixel Endcap A D%d #phi Residuals Vs Pt ",layer);
-		else
-			sprintf(name,"Pixel Endcap C D%d #phi Residuals Vs Pt",layer);
-		hPIXPhiECResVsPt[layer]->SetTitle(name);
-		hPIXPhiECResVsPt[layer]->GetXaxis()->SetTitle("qPt (GeV)");
-		hPIXPhiECResVsPt[layer]->GetYaxis()->SetTitle("#phi Residuals (mm)");
-		hPIXPhiECResVsPt[layer]->SetLineColor(Color+2);
-		hPIXPhiECResVsPt[layer]->SetFillColor(Color);
-		hPIXPhiECResVsPt[layer]->SetLineWidth(1);
-		hPIXPhiECResVsPt[layer]->SetFillStyle(3001);
-		if (normalizePlots) hPIXPhiECResVsPt[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hPIXPhiECResVsPt[layer]->DrawCopy();
-		max = fabs(hPIXPhiECResVsPt[layer]->GetMaximum());
-		min = fabs(hPIXPhiECResVsPt[layer]->GetMinimum());
-		if(ProfPhiMax<max) ProfPhiMax = max;
-		if(ProfPhiMax<min) ProfPhiMax = min;
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			if(!ec)
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_eca_d";
-			else
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_ecc_d";
-			histname += layer;
-			histname += "_biased_residualx_pt";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			tempHist = (TH2F*)file->Get(histname);
-			hPIXPhiECResVsPt_2[layer] = tempHist->ProfileX();	
-			hPIXPhiECResVsPt_2[layer]->SetLineColor(ColorForSecond+2);
-			hPIXPhiECResVsPt_2[layer]->SetFillColor(ColorForSecond);
-			hPIXPhiECResVsPt_2[layer]->SetLineWidth(1);
-			hPIXPhiECResVsPt_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hPIXPhiECResVsPt_2[layer]->Scale(1./(float)iEvents);
-			hPIXPhiECResVsPt_2[layer]->DrawCopy("same");
-			max = fabs(hPIXPhiECResVsPt_2[layer]->GetMaximum());
-			min = fabs(hPIXPhiECResVsPt_2[layer]->GetMinimum());
-			if(ProfPhiMax<max) ProfPhiMax = max;
-			if(ProfPhiMax<min) ProfPhiMax = min;
-		}
-		
-		
-		cPIXECResVsPt->cd(layer+4);
-		if(!ec)
-			histname = "IDAlignMon/"+trkCol+"/Residuals/pix_eca_d";
-		else
-			histname = "IDAlignMon/"+trkCol+"/Residuals/pix_ecc_d";
-		histname += layer;
-		histname += "_biased_residualy_pt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		tempHist = (TH2F*)file->Get(histname);
-		hPIXEtaECResVsPt[layer] = tempHist->ProfileX();	
-		if(!ec)
-			sprintf(name,"Pixel Endcap A D%d #eta Residuals Vs Pt",layer);
-		else
-			sprintf(name,"Pixel Endcap C D%d #eta Residuals Vs Pt",layer);
-		hPIXEtaECResVsPt[layer]->SetTitle(name);
-		hPIXEtaECResVsPt[layer]->GetXaxis()->SetTitle("qPt (GeV)");
-		hPIXEtaECResVsPt[layer]->GetYaxis()->SetTitle("#eta Residuals (mm)");
-		hPIXEtaECResVsPt[layer]->SetLineColor(Color+2);
-		hPIXEtaECResVsPt[layer]->SetFillColor(Color);
-		hPIXEtaECResVsPt[layer]->SetLineWidth(1);
-		hPIXEtaECResVsPt[layer]->SetFillStyle(3001);
-		if (normalizePlots) hPIXEtaECResVsPt[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hPIXEtaECResVsPt[layer]->DrawCopy();
-		max = fabs(hPIXEtaECResVsPt[layer]->GetMaximum());
-		min = fabs(hPIXEtaECResVsPt[layer]->GetMinimum());
-		if(ProfEtaMax<max) ProfEtaMax = max;
-		if(ProfEtaMax<min) ProfEtaMax = min;
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			if(!ec)
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_eca_d";
-			else
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_ecc_d";
-			histname += layer;
-			histname += "_biased_residualy_pt";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			tempHist = (TH2F*)file->Get(histname);
-			hPIXEtaECResVsPt_2[layer] = tempHist->ProfileX();	
-			hPIXEtaECResVsPt_2[layer]->SetLineColor(ColorForSecond+2);
-			hPIXEtaECResVsPt_2[layer]->SetFillColor(ColorForSecond);
-			hPIXEtaECResVsPt_2[layer]->SetLineWidth(1);
-			hPIXEtaECResVsPt_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hPIXEtaECResVsPt_2[layer]->Scale(1./(float)iEvents);
-			hPIXEtaECResVsPt_2[layer]->DrawCopy("same");
-			max = fabs(hPIXEtaECResVsPt_2[layer]->GetMaximum());
-			min = fabs(hPIXEtaECResVsPt_2[layer]->GetMinimum());
-			if(ProfEtaMax<max) ProfEtaMax = max;
-			if(ProfEtaMax<min) ProfEtaMax = min;
-		}
-		
-	}
-	for(int layer=0; layer<3; layer++){
-		hPIXPhiECResVsPt[layer]->SetMaximum(ProfPhiMax*1.1);
-		hPIXPhiECResVsPt[layer]->SetMinimum(-ProfPhiMax*1.1);
-		hPIXEtaECResVsPt[layer]->SetMaximum(ProfEtaMax*1.1);
-		hPIXEtaECResVsPt[layer]->SetMinimum(-ProfEtaMax*1.1);
-	}
-
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelHitmap.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelHitmap.cc
deleted file mode 100644
index ff89e7611ff42cf4a08462653e6bbe6c5b0fbee4..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelHitmap.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void pixelHitmaps(TString TrkCol, TString DrawOptions){
-	pixelHitmaps(TrkCol, 0, DrawOptions);
-}
-
-void pixelHitmaps(TString TrkCol, TCanvas *cPIXHitMap, TString DrawOptions){
-	if(!cPIXHitMap)
-		cPIXHitMap = new TCanvas("cPIXHitMap","Pixel Hitmap",
-						 CanvasSizeX9[0], CanvasSizeX9[1],
-						 CanvasSizeX9[2], CanvasSizeX9[3]);
-
-	const int iNPIX_Layers = 3;
-	const int iNPIX_Discs	= 3;
-	
-	bool setCommonMax = true;
-	TString histname;
-	Char_t name[100];
-	gStyle->SetPadRightMargin(0.15);
-	gStyle->SetPadLeftMargin(0.08);
-	gStyle->SetPadTopMargin(0.12);
-	gROOT->ForceStyle();
-
-	//---------------------------------------------------- 
-	// option handling
-	//----------------------------------------------------
-	DrawOptions.ToLower();
-	bool NoText = DrawOptions.Contains("notext");
-	NoText ? cout << " <pixelHitmaps> Hitmaps..." << endl : cout << " Hitmaps (with entries)..." << endl;
-	
-	TString title;
-	int maxx;
-	int maxb[3];
-	
-	////////////////////
-	// PIX			//
-	////////////////////
-	
-	TH2F *hPixBa[3];
-	TH1F *hPixEc[2][3];
-	TH2F *tempHist;
-	cPIXHitMap->Divide(3,3);
-
-	//------------
-	// Barrel
-	//------------
-	cout << "	 - Pixel Barrel..." << endl;
-
-	maxx=0;
-	for(int layer = 0; layer<iNPIX_Layers; layer++){
-		histname = "IDAlignMon/"+TrkCol+"/HitEfficiencies/measurements_vs_Eta_Phi_pix_b";
-		histname += layer;
-		hPixBa[layer] = (TH2F*)file->Get(histname); 
-		maxb[layer] = (int) hPixBa[layer]->GetBinContent(hPixBa[layer]->GetMaximumBin());
-		maxx = maxb[layer]>maxx ? maxb[layer] : maxx;
-		SetHistoAtt(hPixBa[layer]);
-	}
-
-	for(int layer=0; layer<iNPIX_Layers; layer++){
-		cPIXHitMap->cd(layer+1+3);
-		if(setCommonMax) hPixBa[layer]->SetMaximum(maxx);
-		sprintf(name,"Hitmap %s - Pixel Barrel Layer %d", TrkCol.Data(), layer);
-		hPixBa[layer]->SetTitle(name);
-		hPixBa[layer]->GetYaxis()->SetTitleOffset(1.0);
-		NoText ? hPixBa[layer]->Draw("colz") : hPixBa[layer]->Draw("colztext");
-		gPad->Update();
-		setTitleFont(font);
-	}
-	
-	//------------
-	// Endcaps
-	//------------
-	cout << "	 - Pixel EndCaps..." << endl;
-	for(int ec=0; ec<2; ec++){
-		maxx=0;
-		for(int disc=0; disc<iNPIX_Discs; disc++){
-			if(ec==0) histname = "IDAlignMon/"+TrkCol+"/HitEfficiencies/measurements_vs_Eta_Phi_pix_eca";
-			else histname = "IDAlignMon/"+TrkCol+"/HitEfficiencies/measurements_vs_Eta_Phi_pix_ecc";
-			tempHist = (TH2F*)file->Get(histname); 
-			hPixEc[ec][disc] =(TH1F*)tempHist->ProjectionY("_py",disc+1,disc+1);
-	
-			maxb[disc] = (int) hPixEc[ec][disc]->GetBinContent(hPixEc[ec][disc]->GetMaximumBin());
-			maxx = maxb[disc]>maxx ? maxb[disc] : maxx;
-		}
-	}
-
-	/* Box filled in white to hide histogram. Could not get rif off this since 
-		 a TH2F needs to be drawn afterwards with chopt_z option for the 
-		 color palette to be created. Tried to draw in a pad and then 
-		 superimpose the "box" histo but then any pointer to the original 
-		 TPaletteAxis gets of course deleted. Changing the range in x-axis to make 
-		 "disappear" the visible entries ends with the same feature.
-	*/
-
-	TBox *blank = new TBox(-10,-10, 10,-8);
-	blank->SetFillColor(kWhite);
-	
-	for(int ec=0; ec<2; ec++){
-		for(int disc=0; disc<iNPIX_Discs; disc++){
-	if(!ec) cPIXHitMap->cd(iNPIX_Discs*ec+disc+1);
-	else cPIXHitMap->cd(iNPIX_Discs*ec+disc+1+3);
-	
-	// get histograms
-	if(ec==0) histname = "IDAlignMon/"+TrkCol+"/HitEfficiencies/measurements_vs_Eta_Phi_pix_eca";
-	else histname = "IDAlignMon/"+TrkCol+"/HitEfficiencies/measurements_vs_Eta_Phi_pix_ecc";
-
-	tempHist = (TH2F*)file->Get(histname); 
-	hPixEc[ec][disc] =(TH1F*)tempHist->ProjectionY("_py",disc+1,disc+1);
-
-	// create fake histogram just for axes and color palette
-	sprintf(name,"Hitmap %s - Pixel EndCapC disk %d", TrkCol.Data(), disc);
-	if(!ec) sprintf(name,"Hitmap %s - Pixel EndCapA disk %d", TrkCol.Data(), disc);
-	TH2F *box = new TH2F(name, name, 100, -10, 10, 100, -10, 10);
-	box->SetStats(kFALSE);
-	for(int bin=1; bin<=hPixEc[ec][disc]->GetNbinsX(); bin++)
-		box->SetBinContent(bin, 1, hPixEc[ec][disc]->GetBinContent(bin));
-	if(setCommonMax) {box->SetMaximum(maxx);	
-		box->SetMinimum(0); 
-	}
-	box->GetXaxis()->SetLabelColor(kWhite);
-	box->GetYaxis()->SetLabelColor(kWhite);
-	box->GetYaxis()->SetTitle("Y axis");
-	box->GetXaxis()->SetTitle("X axis");
-	box->GetYaxis()->SetTitleOffset(0.8);
-	box->Draw("colz");
-	blank->Draw();
-	gPad->RedrawAxis();
-	hPixEc[ec][disc]->SetMaximum(maxx);
-	hPixEc[ec][disc]->SetMinimum(0); 
-	draw_pixel_ec_modules(hPixEc[ec][disc]);
-
-	setTitleFont(font);
-	gPad->Update();
-		}
-	}
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResiduals.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResiduals.cc
deleted file mode 100644
index d267acd63def38507af6f548836d91a7c62474dd..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResiduals.cc
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void pixelResiduals(TString trkCol){
-	pixelResiduals(trkCol, 0, "");
-}
-
-void pixelResiduals(TString trkCol, TString trkCol2){
-	pixelResiduals(trkCol, 0, trkCol2);
-}
-
-void pixelResiduals(TString trkCol, TCanvas *cPixRes){
-	pixelResiduals(trkCol, cPixRes, "");
-}
-
-void pixelResiduals(TString trkCol, TCanvas *cPixRes, TString trkCol2) {
-	TH1F *hPixel_TrkPhiRes;
-	TH1F *hPixel_TrkEtaRes;
-	TH1F *hPixel_EndCapATrkPhiRes;
-	TH1F *hPixel_EndCapATrkEtaRes;
-	TH1F *hPixel_EndCapCTrkPhiRes;
-	TH1F *hPixel_EndCapCTrkEtaRes;
-	
-	TH1F *hPixel_TrkPhiRes_2;
-	TH1F *hPixel_TrkEtaRes_2;
-	TH1F *hPixel_EndCapATrkPhiRes_2;
-	TH1F *hPixel_EndCapATrkEtaRes_2;
-	TH1F *hPixel_EndCapCTrkPhiRes_2;
-	TH1F *hPixel_EndCapCTrkEtaRes_2;
-	
-	TString histname;
-	TString histtitle;
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cPixRes){
-		cPixRes = new TCanvas("PixResiduals","All Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-	}
-	cPixRes->Divide(3,2);
-	
-	cPixRes->cd(2);
-	
-	histname = "IDAlignMon/"+trkCol+"/Residuals/pix_b_biasedresidualx";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hPixel_TrkPhiRes = (TH1F*)file->Get(histname);	
-
-	if (hPixel_TrkPhiRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": Pixel Barrel. Biased Residuals local x";
-	hPixel_TrkPhiRes->SetTitle(histtitle.Data());
-	hPixel_TrkPhiRes->GetXaxis()->SetTitle("Local x residuals (mm)");
-	hPixel_TrkPhiRes->GetYaxis()->SetTitle("Entries");
-	hPixel_TrkPhiRes->SetLineColor(Color+2);
-	hPixel_TrkPhiRes->SetFillColor(Color);
-	hPixel_TrkPhiRes->SetLineWidth(1);
-	hPixel_TrkPhiRes->SetFillStyle(3001);
-	if (normalizePlots) hPixel_TrkPhiRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hPixel_TrkPhiRes->GetMean()!=0.0) {
-	 hPixel_TrkPhiRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_b_biasedresidualx";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixel_TrkPhiRes_2 = (TH1F*)file->Get(histname);	
-		hPixel_TrkPhiRes_2->SetLineColor(ColorForSecond+2);
-		hPixel_TrkPhiRes_2->SetFillColor(ColorForSecond);
-		hPixel_TrkPhiRes_2->SetLineWidth(1);
-		hPixel_TrkPhiRes_2->SetFillStyle(3001);
-		if (normalizePlots) hPixel_TrkPhiRes_2->Scale(1./(float)iEvents);
-		hPixel_TrkPhiRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hPixel_TrkPhiRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"Pixel Barrel");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cPixRes->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/pix_b_biasedresidualy";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hPixel_TrkEtaRes = (TH1F*)file->Get(histname);	
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": Pixel Barrel. Biased Residuals local y";
-	hPixel_TrkEtaRes->SetTitle(histtitle.Data());
-	hPixel_TrkEtaRes->GetXaxis()->SetTitle("Local y residuals (mm)");
-	hPixel_TrkEtaRes->GetYaxis()->SetTitle("Entries");
-	hPixel_TrkEtaRes->SetLineColor(Color+2);
-	hPixel_TrkEtaRes->SetLineWidth(1);
-	hPixel_TrkEtaRes->SetFillColor(Color);
-	hPixel_TrkEtaRes->SetFillStyle(3001);
-	if (normalizePlots) hPixel_TrkEtaRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hPixel_TrkEtaRes->GetMean()!=0.0) {
-	 hPixel_TrkEtaRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_b_biasedresidualy";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixel_TrkEtaRes_2 = (TH1F*)file->Get(histname);	
-		hPixel_TrkEtaRes_2->SetLineColor(ColorForSecond+2);
-		hPixel_TrkEtaRes_2->SetFillColor(ColorForSecond);
-		hPixel_TrkEtaRes_2->SetLineWidth(1);
-		hPixel_TrkEtaRes_2->SetFillStyle(3001);
-		if (normalizePlots) hPixel_TrkEtaRes_2->Scale(1./(float)iEvents);
-		hPixel_TrkEtaRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hPixel_TrkEtaRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"Pixel Barrel");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cPixRes->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/pix_eca_biased_residualx";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	
-	hPixel_EndCapATrkPhiRes = (TH1F*)file->Get(histname);	
-	if (hPixel_EndCapATrkPhiRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": Pixel ECA. Biased Residuals local x";
-	hPixel_EndCapATrkPhiRes->SetTitle(histtitle.Data());
-	hPixel_EndCapATrkPhiRes->GetXaxis()->SetTitle("Local x residuals (mm)");
-	hPixel_EndCapATrkPhiRes->GetYaxis()->SetTitle("Entries");
-	hPixel_EndCapATrkPhiRes->SetLineColor(Color+2);
-	hPixel_EndCapATrkPhiRes->SetFillColor(Color);
-	hPixel_EndCapATrkPhiRes->SetLineWidth(1);
-	hPixel_EndCapATrkPhiRes->SetFillStyle(3001);
-	if (normalizePlots) hPixel_EndCapATrkPhiRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hPixel_EndCapATrkPhiRes->GetMean()!=0.0) {
-	 hPixel_EndCapATrkPhiRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_eca_biased_residualx";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixel_EndCapATrkPhiRes_2 = (TH1F*)file->Get(histname);	
-		hPixel_EndCapATrkPhiRes_2->SetLineColor(ColorForSecond+2);
-		hPixel_EndCapATrkPhiRes_2->SetFillColor(ColorForSecond);
-		hPixel_EndCapATrkPhiRes_2->SetLineWidth(1);
-		hPixel_EndCapATrkPhiRes_2->SetFillStyle(3001);
-		if (normalizePlots) hPixel_EndCapATrkPhiRes_2->Scale(1./(float)iEvents);
-		hPixel_EndCapATrkPhiRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hPixel_EndCapATrkPhiRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"Pixel ECA");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-	 
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cPixRes->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/pix_eca_biased_residualy";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hPixel_EndCapATrkEtaRes = (TH1F*)file->Get(histname);	
-	if (hPixel_EndCapATrkPhiRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": Pixel ECA. Biased Residuals local y";
-	hPixel_EndCapATrkEtaRes->SetTitle(histtitle.Data());
-	hPixel_EndCapATrkEtaRes->GetXaxis()->SetTitle("Local y residuals (mm)");
-	hPixel_EndCapATrkEtaRes->GetYaxis()->SetTitle("Entries");
-	hPixel_EndCapATrkEtaRes->SetLineColor(Color+2);
-	hPixel_EndCapATrkEtaRes->SetFillColor(Color);
-	hPixel_EndCapATrkEtaRes->SetLineWidth(1);
-	hPixel_EndCapATrkEtaRes->SetFillStyle(3001);
-	if (normalizePlots) hPixel_EndCapATrkEtaRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hPixel_EndCapATrkEtaRes->GetMean()!=0.0) {
-	 hPixel_EndCapATrkEtaRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_eca_biased_residualy";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixel_EndCapATrkEtaRes_2 = (TH1F*)file->Get(histname);	
-		hPixel_EndCapATrkEtaRes_2->SetLineColor(ColorForSecond+2);
-		hPixel_EndCapATrkEtaRes_2->SetFillColor(ColorForSecond);
-		hPixel_EndCapATrkEtaRes_2->SetLineWidth(1);
-		hPixel_EndCapATrkEtaRes_2->SetFillStyle(3001);
-		if (normalizePlots) hPixel_EndCapATrkEtaRes_2->Scale(1./(float)iEvents);
-		hPixel_EndCapATrkEtaRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hPixel_EndCapATrkEtaRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"Pixel EndCap A");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cPixRes->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/pix_ecc_biased_residualx";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hPixel_EndCapCTrkPhiRes = (TH1F*)file->Get(histname);	
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": Pixel ECC. Biased Residuals local x";
-	hPixel_EndCapCTrkPhiRes->SetTitle(histtitle.Data());
-	hPixel_EndCapCTrkPhiRes->GetXaxis()->SetTitle("Local x residuals (mm)");
-	hPixel_EndCapCTrkPhiRes->GetYaxis()->SetTitle("Entries");
-	hPixel_EndCapCTrkPhiRes->SetLineColor(Color+2);
-	hPixel_EndCapCTrkPhiRes->SetFillColor(Color);
-	hPixel_EndCapCTrkPhiRes->SetLineWidth(1);
-	hPixel_EndCapCTrkPhiRes->SetFillStyle(3001);
-	if (normalizePlots) hPixel_EndCapCTrkPhiRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hPixel_EndCapCTrkPhiRes->GetMean()!=0.0) {
-	 hPixel_EndCapCTrkPhiRes->DrawCopy("hist");	
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_ecc_biased_residualx";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixel_EndCapCTrkPhiRes_2 = (TH1F*)file->Get(histname);	
-		hPixel_EndCapCTrkPhiRes_2->SetLineColor(ColorForSecond+2);
-		hPixel_EndCapCTrkPhiRes_2->SetFillColor(ColorForSecond);
-		hPixel_EndCapCTrkPhiRes_2->SetLineWidth(1);
-		hPixel_EndCapCTrkPhiRes_2->SetFillStyle(3001);
-		if (normalizePlots) hPixel_EndCapCTrkPhiRes_2->Scale(1./(float)iEvents);
-		hPixel_EndCapCTrkPhiRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hPixel_EndCapCTrkPhiRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"Pixel EndCap C");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cPixRes->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/pix_ecc_biased_residualy";
-	if(PrintLevel>0) cout << " <pixelResiduals> Plotting Histogram: " << histname << endl;
-	hPixel_EndCapCTrkEtaRes = (TH1F*)file->Get(histname);	
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": Pixel ECC. Biased Residuals local y";
-	hPixel_EndCapCTrkEtaRes->SetTitle(histtitle.Data());
-	hPixel_EndCapCTrkEtaRes->GetXaxis()->SetTitle("Local y residuals (mm)");
-	hPixel_EndCapCTrkEtaRes->GetYaxis()->SetTitle("Entries");
-	hPixel_EndCapCTrkEtaRes->SetLineColor(Color+2);
-	hPixel_EndCapCTrkEtaRes->SetFillColor(Color);
-	hPixel_EndCapCTrkEtaRes->SetLineWidth(1);
-	hPixel_EndCapCTrkEtaRes->SetFillStyle(3001);
-	if (normalizePlots) hPixel_EndCapCTrkEtaRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	cout << " point 1" << endl;
-	if (hPixel_EndCapCTrkEtaRes->GetMean()!=0.0) {
-	 hPixel_EndCapCTrkEtaRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/pix_ecc_biased_residualy";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixel_EndCapCTrkEtaRes_2 = (TH1F*)file->Get(histname);	
-		hPixel_EndCapCTrkEtaRes_2->SetLineColor(ColorForSecond+2);
-		hPixel_EndCapCTrkEtaRes_2->SetFillColor(ColorForSecond);
-		hPixel_EndCapCTrkEtaRes_2->SetLineWidth(1);
-		hPixel_EndCapCTrkEtaRes_2->SetFillStyle(3001);
-		if (normalizePlots) hPixel_EndCapCTrkEtaRes_2->Scale(1./(float)iEvents);
-		hPixel_EndCapCTrkEtaRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hPixel_EndCapCTrkEtaRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"SCT EndCap C");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-	
-	return;
-
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResmaps.BAK b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResmaps.BAK
deleted file mode 100644
index 83b0e10515fbd244007fe871a4162fa7d849da36..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResmaps.BAK
+++ /dev/null
@@ -1,299 +0,0 @@
-const Int_t NContLevels = 50;
-Int_t RM_ColorIndex[NContLevels];
-float RM_Levels[NContLevels];
-const int iNPIX_Layers = 3;
-const int iNPIX_Discs = 3;
-
-void pixelResmaps(TString TrkCol, float isXres, float isRMS, float range){
-	pixelResmaps(TrkCol, 0, isXres, isRMS, range);
-}
-
-void pixelResmaps(TString TrkCol, TCanvas *cPIXResMap, float isXres, float isRMS, float range){
-	if(!cPIXResMap)
-		cPIXResMap = new TCanvas("cPIXResMap","Pixel Resmap",
-						 CanvasSizeX9[0], CanvasSizeX9[1],
-						 CanvasSizeX9[2], CanvasSizeX9[3]);
-						 
-	
-	
-	TString histname;
-	TString name;
-	gStyle->SetPadRightMargin(0.15);
-	gStyle->SetPadLeftMargin(0.08);
-	gStyle->SetPadTopMargin(0.12);
-	gROOT->ForceStyle();
-
-
-	TString title;
-	
-	////////////////////
-	// PIX			//
-	////////////////////
-	
-	TH3F *hPixResBa3D[iNPIX_Layers];
-	TH2F *hResMapBa[iNPIX_Layers];
-//	TH1D *hTmp;
-	
-	cPIXResMap->Divide(3,3);
-	//------------
-	// Barrel
-	//------------
-	cout << "	 - Pixel Barrel..." << endl;
-
-// 	double Mean=0;
-// 	double RMS=0;
-	for(int layer = 0; layer<iNPIX_Layers; layer++){
-		histname = "IDAlignMon/"+TrkCol+"/Residuals/pix_b";
-		histname += layer;
-		if(isXres)
-			histname += "_biased_xresvsmodetaphi_3d";
-		else
-			histname += "_biased_yresvsmodetaphi_3d";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixResBa3D[layer] = (TH3F*)file->Get(histname); 
-		if(TrkCol == FirstTrackCollection)
-			name = "TrkCol1 - ";
-		else
-			name = "TrkCol2 - ";
-		if(isXres)
-			name += "#phi ";
-		else
-			name += "#eta ";
-		if(isRMS)
-			name += "Residual RMS map - ";
-		else
-			name += "Residual Mean map - ";
-		
-		name+="Pixel Barrel Layer ";
-		name+=layer;
-		hResMapBa[layer] = new TH2F(name,name,hPixResBa3D[layer]->GetXaxis()->GetNbins(), 
-										 hPixResBa3D[layer]->GetXaxis()->GetXmin(),
-										 hPixResBa3D[layer]->GetXaxis()->GetXmax(),
-										 hPixResBa3D[layer]->GetYaxis()->GetNbins(), 
-										 hPixResBa3D[layer]->GetYaxis()->GetXmin(),
-										 hPixResBa3D[layer]->GetYaxis()->GetXmax());
-		for(int i = 1; i<=hPixResBa3D[layer]->GetXaxis()->GetNbins();i++){
-			for(int j = 1; j<=hPixResBa3D[layer]->GetYaxis()->GetNbins();j++){
-				//hTmp = new TH1D("tmphist","tmphist",hPixResBa3D[layer]->GetZaxis()->GetNbins(),
-				//									hPixResBa3D[layer]->GetZaxis()->GetXmin(),
-				//						 				hPixResBa3D[layer]->GetZaxis()->GetXmax());
-				//for(int k = 1; k<=hPixResBa3D[layer]->GetZaxis()->GetNbins();k++)
-					//hTmp->SetBinContent(k,hPixResBa3D[layer]->GetBinContent(i,j,k));
-				//hTmp = hPixResBa3D[layer]->ProjectionZ("_z",i,i,j,j);
-				if(isRMS)	
-					hResMapBa[layer]->SetBinContent(i,j,1000.*hPixResBa3D[layer]->ProjectionZ("_z",i,i,j,j)->GetRMS());
-				else
-					hResMapBa[layer]->SetBinContent(i,j,1000.*hPixResBa3D[layer]->ProjectionZ("_z",i,i,j,j)->GetMean());
-				
-// 				hTmp->Fit("gaus","Q");
-// 				if(hTmp->GetFunction("gaus")){
-// 	 				Mean = hTmp->GetFunction("gaus")->GetParameter("Mean");
-// 					 	RMS = hTmp->GetFunction("gaus")->GetParameter("RMS");					  
-// 				}
-// 				else{
-// 					Mean = -999;
-// 					RMS = -999;
-// 				}
-				//if(isRMS)	
-				//	hResMapBa[layer]->SetBinContent(i,j,1000.*hTmp->GetRMS());
-				//else
-				//	hResMapBa[layer]->SetBinContent(i,j,1000.*hTmp->GetMean());
-				
-				//hTmp = 0;
-			}
-		}
-		cPIXResMap->cd(layer+4);
-		hResMapBa[layer]->SetStats(kFALSE);
-      	hResMapBa[layer]->GetXaxis()->SetTitle("eta/ring");
-      	hResMapBa[layer]->GetYaxis()->SetTitle("phi/stave");
-      	hResMapBa[layer]->SetMaximum(range);
-     	hResMapBa[layer]->SetMinimum(-range);
-     	if(isRMS)
-     		hResMapBa[layer]->SetMinimum(0);
-		hResMapBa[layer]->Draw("colz");
-	}	
-	
-	// Endcap A
-	
-	TH2F *hPixResECA2D[iNPIX_Discs];
-	TH1F *hResMapECA[iNPIX_Discs];
-
-	
-	for (int disc = 0; disc < iNPIX_Discs; disc++){
-		histname = "IDAlignMon/"+TrkCol+"/Residuals/pix_eca_d";
-		histname += disc;
-		if(isXres)
-			histname += "_biased_xresvsmodphi_2d";
-		else
-			histname += "_biased_yresvsmodphi_2d";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixResECA2D[disc] = (TH2F*)file->Get(histname); 
-		if(TrkCol == FirstTrackCollection)
-			name = "TrkCol1 - ";
-		else
-			name = "TrkCol2 - ";
-		if(isXres)
-			name += "#phi ";
-		else
-			name += "#eta ";
-		if(isRMS)
-			name += "Residual RMS map - ";
-		else
-			name += "Residual Mean map - ";
-		
-		name+="Pixel ECA Disk ";
-		name+=disc;
-		hResMapECA[disc] = new TH1F(name+"Plot",name,hPixResECA2D[disc]->GetXaxis()->GetNbins(), 
-										 hPixResECA2D[disc]->GetXaxis()->GetXmin(),
-										 hPixResECA2D[disc]->GetXaxis()->GetXmax());
-								
-		for(int i = 1; i<=hPixResECA2D[disc]->GetXaxis()->GetNbins();i++){
-			//hTmp = new TH1F("tmphist","tmphist",hPixResECA2D[disc]->GetYaxis()->GetNbins(),
-			//										hPixResECA2D[disc]->GetYaxis()->GetXmin(),
-			//							 				hPixResECA2D[disc]->GetYaxis()->GetXmax());
-			//for(int k = 1; k<=hPixResECA2D[disc]->GetYaxis()->GetNbins();k++)
-			//	hTmp->SetBinContent(k,hPixResECA2D[disc]->GetBinContent(i,k));
-// 				hTmp->Fit("gaus","Q");
-// 				if(hTmp->GetFunction("gaus")){
-// 	 				Mean = hTmp->GetFunction("gaus")->GetParameter("Mean");
-// 					 	RMS = hTmp->GetFunction("gaus")->GetParameter("RMS");					  
-// 				}
-// 				else{
-// 					Mean = -999;
-// 					RMS = -999;
-// 				}
-			
-			if(isRMS)	
-				hResMapECA[disc]->SetBinContent(i,1000.*hPixResECA2D[disc]->ProjectionY("_py",i,i)->GetRMS());
-			else
-				hResMapECA[disc]->SetBinContent(i,1000.*hPixResECA2D[disc]->ProjectionY("_py",i,i)->GetMean());
-			
-			//delete hTmp;
-		}
-		cPIXResMap->cd(disc+1);
-		hResMapECA[disc]->SetStats(kFALSE);
-      	hResMapECA[disc]->SetMaximum(range);
-     	hResMapECA[disc]->SetMinimum(-range);
-     	if(isRMS)
-     		hResMapECA[disc]->SetMinimum(0);
-     	TBox *blank = new TBox(-10,-10, 10, 9.85);
-	  	blank->SetFillColor(kWhite);
-		if(isRMS)
-			draw_wheel_frame(name,0,range);
-		else
-			draw_wheel_frame(name,-range,range);
-		blank->Draw();
-		gPad->SetRightMargin(0.20);
-		gPad->SetLeftMargin(0.15);
-		gPad->RedrawAxis();
-		gPad->Update();
-		setTitleFont(font);
-		gPad->RedrawAxis();
-		draw_pixel_ec_modules(hResMapECA[disc]);
-     }		
-     
-     
-     // Endcap C
-	
-	TH2F *hPixResECC2D[iNPIX_Discs];
-	TH1F *hResMapECC[iNPIX_Discs];
-
-	
-	for (int disc = 0; disc < iNPIX_Discs; disc++){
-		histname = "IDAlignMon/"+TrkCol+"/Residuals/pix_ecc_d";
-		histname += disc;
-		if(isXres)
-			histname += "_biased_xresvsmodphi_2d";
-		else
-			histname += "_biased_yresvsmodphi_2d";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixResECC2D[disc] = (TH2F*)file->Get(histname); 
-		if(TrkCol == FirstTrackCollection)
-			name = "TrkCol1 - ";
-		else
-			name = "TrkCol2 - ";
-		if(isXres)
-			name += "#phi ";
-		else
-			name += "#eta ";
-		if(isRMS)
-			name += "Residual RMS map - ";
-		else
-			name += "Residual Mean map - ";
-		
-		name+="Pixel ECC Disk ";
-		name+=disc;
-		hResMapECC[disc] = new TH1F(name+"Plot",name,hPixResECC2D[disc]->GetXaxis()->GetNbins(), 
-										 hPixResECC2D[disc]->GetXaxis()->GetXmin(),
-										 hPixResECC2D[disc]->GetXaxis()->GetXmax());
-								
-		for(int i = 1; i<=hPixResECC2D[disc]->GetXaxis()->GetNbins();i++){
-//			hTmp = new TH1F("tmphist","tmphist",hPixResECC2D[disc]->GetYaxis()->GetNbins(),
-//													hPixResECC2D[disc]->GetYaxis()->GetXmin(),
-//										 				hPixResECC2D[disc]->GetYaxis()->GetXmax());
-//			for(int k = 1; k<=hPixResECC2D[disc]->GetYaxis()->GetNbins();k++)
-//				hTmp->SetBinContent(k,hPixResECC2D[disc]->GetBinContent(i,k));
-// 				hTmp->Fit("gaus","Q");
-// 				if(hTmp->GetFunction("gaus")){
-// 	 				Mean = hTmp->GetFunction("gaus")->GetParameter("Mean");
-// 					 	RMS = hTmp->GetFunction("gaus")->GetParameter("RMS");					  
-// 				}
-// 				else{
-// 					Mean = -999;
-// 					RMS = -999;
-// 				}
-
-			if(isRMS)	
-				hResMapECC[disc]->SetBinContent(i,1000.*hPixResECC2D[disc]->ProjectionY("_py",i,i)->GetRMS());
-			else
-				hResMapECC[disc]->SetBinContent(i,1000.*hPixResECC2D[disc]->ProjectionY("_py",i,i)->GetMean());
-			
-//			delete hTmp;
-		}
-		cPIXResMap->cd(disc+7);
-		hResMapECC[disc]->SetStats(kFALSE);
-      	hResMapECC[disc]->SetMaximum(range);
-     	hResMapECC[disc]->SetMinimum(-range);
-     	if(isRMS)
-     		hResMapECC[disc]->SetMinimum(0);
-     	TBox *blank = new TBox(-10,-10, 10, 9.85);
-	  	blank->SetFillColor(kWhite);
-		if(isRMS)
-			draw_wheel_frame(name,0,range);
-		else
-			draw_wheel_frame(name,-range,range);
-		blank->Draw();
-		gPad->SetRightMargin(0.20);
-		gPad->SetLeftMargin(0.15);
-		gPad->RedrawAxis();
-		gPad->Update();
-		setTitleFont(font);
-		gPad->RedrawAxis();
-		draw_pixel_ec_modules(hResMapECC[disc]);
-     }	
-}
-
-//=====================================================================
-// draw_wheel_frame()
-//=====================================================================
-void draw_wheel_frame(TString name, float minrange, float maxrange) {
-  TH2F *PixFrame = new TH2F(name, name, 100, -10, 10, 100, -10, 10);
-  PixFrame->SetStats(kFALSE);
-  PixFrame->Fill(-5,5,maxrange);
-  PixFrame->Fill(5,-5,minrange);
-  // PixFrame->GetXaxis()->SetAxisColor(kWhite);
-  // PixFrame->GetYaxis()->SetAxisColor(kWhite);
-  PixFrame->GetZaxis()->SetLabelSize(0.035);  
-  PixFrame->GetXaxis()->SetLabelColor(kWhite);
-  PixFrame->GetYaxis()->SetLabelColor(kWhite);
-  PixFrame->GetYaxis()->SetTitle("Y axis");
-  PixFrame->GetXaxis()->SetTitle("X axis");
-  PixFrame->GetYaxis()->SetTitleOffset(0.8);
-  PixFrame->SetContour(NContLevels);
-  PixFrame->SetMaximum(maxrange);
-  PixFrame->SetMinimum(minrange);
-  PixFrame->Draw("colz");
-  SetZAxisTitle(PixFrame);
-
-  gPad->Update();
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResmaps.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResmaps.cc
deleted file mode 100644
index 3845d256320c0d022b0eeaa38e8e87226e03a214..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/pixelResmaps.cc
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void pixelResmaps(TString TrkCol, bool isXres, bool isRMS, float range){
-	pixelResmaps(TrkCol, 0, isXres, isRMS, range);
-}
-
-void pixelResmaps(TString TrkCol, TCanvas *cPIXResMap, bool isXres, bool isRMS, float range){
-	if(!cPIXResMap)
-		cPIXResMap = new TCanvas("cPIXResMap","Pixel Resmap",
-						 CanvasSizeX9[0], CanvasSizeX9[1],
-						 CanvasSizeX9[2], CanvasSizeX9[3]);
-						 
-	
-	
-	TString histname;
-	TString name;
-	gStyle->SetPadRightMargin(0.15);
-	gStyle->SetPadLeftMargin(0.08);
-	gStyle->SetPadTopMargin(0.12);
-	gROOT->ForceStyle();
-
-
-	TString title;
-	
-	////////////////////
-	// PIX			//
-	////////////////////
-	
-	TH3F *hPixResBa3D[iNPIX_Layers];
-	TH2F *hResMapBa[iNPIX_Layers];
-	
-	cPIXResMap->Divide(3,3);
-	//------------
-	// Barrel
-	//------------
-	cout << "	 - Pixel Barrel..." << endl;
-
-	for(int layer = 0; layer<iNPIX_Layers; layer++){
-		histname = "IDAlignMon/"+TrkCol+"/Residuals/pix_b";
-		histname += layer;
-		if(isXres)
-			histname += "_biased_xresvsmodetaphi_3d";
-		else
-			histname += "_biased_yresvsmodetaphi_3d";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixResBa3D[layer] = (TH3F*)file->Get(histname); 
-
-		if ( hPixResBa3D[layer] == NULL) { // check if histogram exists
-		  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-		  return;
-		}
-
-		if(TrkCol == FirstTrackCollection) {
-		  name = TrkCol.Data();
-		  name +=": "; 
-		}
-		else {
-		  name = SecondTrackCollection.Data();
-		}
-		if(isXres)
-			name += "local x ";
-		else
-			name += "local y ";
-		if(isRMS)
-			name += "Residual RMS map - ";
-		else
-			name += "Residual Mean map - ";
-		
-		name+="Pixel Barrel Layer ";
-		name+=layer;
-		hResMapBa[layer] = new TH2F(name,name,hPixResBa3D[layer]->GetXaxis()->GetNbins(), 
-										 hPixResBa3D[layer]->GetXaxis()->GetXmin(),
-										 hPixResBa3D[layer]->GetXaxis()->GetXmax(),
-										 hPixResBa3D[layer]->GetYaxis()->GetNbins(), 
-										 hPixResBa3D[layer]->GetYaxis()->GetXmin(),
-										 hPixResBa3D[layer]->GetYaxis()->GetXmax());
-		for(int i = 1; i<=hPixResBa3D[layer]->GetXaxis()->GetNbins();i++){
-			for(int j = 1; j<=hPixResBa3D[layer]->GetYaxis()->GetNbins();j++){
-				if(isRMS)	
-					hResMapBa[layer]->SetBinContent(i,j,1000.*hPixResBa3D[layer]->ProjectionZ(histname+"_zrms",i,i,j,j)->GetRMS());
-				else
-					hResMapBa[layer]->SetBinContent(i,j,1000.*hPixResBa3D[layer]->ProjectionZ(histname+"_zmean",i,i,j,j)->GetMean());
-			}
-		}
-		cPIXResMap->cd(layer+4);
-		hResMapBa[layer]->SetStats(kFALSE);
-      	hResMapBa[layer]->GetXaxis()->SetTitle("eta/ring");
-      	hResMapBa[layer]->GetYaxis()->SetTitle("phi/stave");
-      	hResMapBa[layer]->SetMaximum(range);
-     	hResMapBa[layer]->SetMinimum(-range);
-     	if(isRMS)
-     		hResMapBa[layer]->SetMinimum(0);
-		hResMapBa[layer]->Draw("colz");
-	}	
-	
-	// Endcap A
-	
-	TH2F *hPixResECA2D[iNPIX_Discs];
-	TH1F *hResMapECA[iNPIX_Discs];
-
-	
-	for (int disc = 0; disc < iNPIX_Discs; disc++){
-		histname = "IDAlignMon/"+TrkCol+"/Residuals/pix_eca_d";
-		histname += disc;
-		if(isXres)
-			histname += "_biased_xresvsmodphi_2d";
-		else
-			histname += "_biased_yresvsmodphi_2d";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixResECA2D[disc] = (TH2F*)file->Get(histname);
-		name = TrkCol.Data();
-		name += ": ";
-		if(isXres)
-			name += "local x ";
-		else
-			name += "local y ";
-		if(isRMS)
-			name += "Residual RMS map - ";
-		else
-			name += "Residual Mean map - ";
-		
-		name+="Pixel ECA Disk ";
-		name+=disc;
-		hResMapECA[disc] = new TH1F(name+"Plot",name,hPixResECA2D[disc]->GetXaxis()->GetNbins(), 
-										 hPixResECA2D[disc]->GetXaxis()->GetXmin(),
-										 hPixResECA2D[disc]->GetXaxis()->GetXmax());
-								
-		for(int i = 1; i<=hPixResECA2D[disc]->GetXaxis()->GetNbins();i++){
-			if(isRMS)	
-				hResMapECA[disc]->SetBinContent(i,1000.*hPixResECA2D[disc]->ProjectionY("_py",i,i)->GetRMS());
-			else
-				hResMapECA[disc]->SetBinContent(i,1000.*hPixResECA2D[disc]->ProjectionY("_py",i,i)->GetMean());
-		}
-		cPIXResMap->cd(disc+1);
-		hResMapECA[disc]->SetStats(kFALSE);
-      	hResMapECA[disc]->SetMaximum(range);
-     	hResMapECA[disc]->SetMinimum(-range);
-     	if(isRMS)
-     		hResMapECA[disc]->SetMinimum(0);
-     	TBox *blank = new TBox(-10,-10, 10, 9.85);
-	  	blank->SetFillColor(kWhite);
-		if(isRMS)
-			draw_wheel_frame(name,0,range);
-		else
-			draw_wheel_frame(name,-range,range);
-		blank->Draw();
-		gPad->SetRightMargin(0.20);
-		gPad->SetLeftMargin(0.15);
-		gPad->RedrawAxis();
-		gPad->Update();
-		setTitleFont(font);
-		gPad->RedrawAxis();
-		draw_pixel_ec_modules(hResMapECA[disc]);
-     }		
-     
-     
-     // Endcap C
-	
-	TH2F *hPixResECC2D[iNPIX_Discs];
-	TH1F *hResMapECC[iNPIX_Discs];
-
-	
-	for (int disc = 0; disc < iNPIX_Discs; disc++){
-		histname = "IDAlignMon/"+TrkCol+"/Residuals/pix_ecc_d";
-		histname += disc;
-		if(isXres)
-			histname += "_biased_xresvsmodphi_2d";
-		else
-			histname += "_biased_yresvsmodphi_2d";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hPixResECC2D[disc] = (TH2F*)file->Get(histname); 
-		name = TrkCol.Data();
-		name += ": ";
-		if(isXres)
-			name += "#local x ";
-		else
-			name += "#local y ";
-		if(isRMS)
-			name += "Residual RMS map - ";
-		else
-			name += "Residual Mean map - ";
-		
-		name+="Pixel ECC Disk ";
-		name+=disc;
-		hResMapECC[disc] = new TH1F(name+"Plot",name,hPixResECC2D[disc]->GetXaxis()->GetNbins(), 
-										 hPixResECC2D[disc]->GetXaxis()->GetXmin(),
-										 hPixResECC2D[disc]->GetXaxis()->GetXmax());
-								
-		for(int i = 1; i<=hPixResECC2D[disc]->GetXaxis()->GetNbins();i++){
-			if(isRMS)	
-				hResMapECC[disc]->SetBinContent(i,1000.*hPixResECC2D[disc]->ProjectionY("_py",i,i)->GetRMS());
-			else
-				hResMapECC[disc]->SetBinContent(i,1000.*hPixResECC2D[disc]->ProjectionY("_py",i,i)->GetMean());
-		}
-		cPIXResMap->cd(disc+7);
-		hResMapECC[disc]->SetStats(kFALSE);
-      	hResMapECC[disc]->SetMaximum(range);
-     	hResMapECC[disc]->SetMinimum(-range);
-     	if(isRMS)
-     		hResMapECC[disc]->SetMinimum(0);
-     	TBox *blank = new TBox(-10,-10, 10, 9.85);
-	  	blank->SetFillColor(kWhite);
-		if(isRMS)
-			draw_wheel_frame(name,0,range);
-		else
-			draw_wheel_frame(name,-range,range);
-		blank->Draw();
-		gPad->SetRightMargin(0.20);
-		gPad->SetLeftMargin(0.15);
-		gPad->RedrawAxis();
-		gPad->Update();
-		setTitleFont(font);
-		gPad->RedrawAxis();
-		draw_pixel_ec_modules(hResMapECC[disc]);
-     }	
-}
-
-//=====================================================================
-// draw_wheel_frame()
-//=====================================================================
-void draw_wheel_frame(TString name, float minrange, float maxrange) {
-  TH2F *PixFrame = new TH2F(name, name, 100, -10, 10, 100, -10, 10);
-  PixFrame->SetStats(kFALSE);
-  PixFrame->Fill(-5,5,maxrange);
-  PixFrame->Fill(5,-5,minrange);
-  // PixFrame->GetXaxis()->SetAxisColor(kWhite);
-  // PixFrame->GetYaxis()->SetAxisColor(kWhite);
-  PixFrame->GetZaxis()->SetLabelSize(0.035);  
-  PixFrame->GetXaxis()->SetLabelColor(kWhite);
-  PixFrame->GetYaxis()->SetLabelColor(kWhite);
-  PixFrame->GetYaxis()->SetTitle("Y axis");
-  PixFrame->GetXaxis()->SetTitle("X axis");
-  PixFrame->GetYaxis()->SetTitleOffset(0.8);
-  PixFrame->SetContour(NContLevels);
-  PixFrame->SetMaximum(maxrange);
-  PixFrame->SetMinimum(minrange);
-  PixFrame->Draw("colz");
-  SetZAxisTitle(PixFrame);
-
-  gPad->Update();
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/residuals.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/residuals.cc
deleted file mode 100644
index da720d9ad36d1334d24adbf2e539826fd9da83fd..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/residuals.cc
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void residuals(TString trkCol) {
-	cout << " <residuals> Summary table and Residuals..." << endl;
-
-	TH1F *hSCTBa_Res;
-	TH1F *hPixelBa_Res;
-	TH1F *hTRTBa_Res;
-	TString histname;
-	
-	cInfoRes = new TCanvas("GlobalResiduals","Global Residuals",CanvasSizeX4[0],CanvasSizeX4[1]);
-	cInfoRes->Divide(2,2);
-
-	cInfoRes->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/sct_b_residualx";
-	if(PrintLevel>0) cout << " <residual> Plotting Histogram: " << histname << endl;
-	
-	hSCTBa_Res = (TH1F*)file->Get(histname);
-	hSCTBa_Res->SetTitle("SCT barrel residuals");
-	hSCTBa_Res->GetXaxis()->SetTitle("Residuals [mm]");
-	hSCTBa_Res->GetYaxis()->SetTitle("Entries");
-	hSCTBa_Res->SetLineColor(ColorForFirst+2);
-	hSCTBa_Res->SetLineWidth(1);
-	hSCTBa_Res->SetFillColor(ColorForFirst);
-	hSCTBa_Res->SetFillStyle(3001);
-	if (normalizePlots) hSCTBa_Res->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hSCTBa_Res->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();	
-   
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cInfoRes->cd(3);
-  	histname = "IDAlignMon/"+trkCol+"/Residuals/pix_b_residualx";
-	if(PrintLevel>0) cout << " <residuals> Plotting Histogram: " << histname << endl;
-	hPixelBa_Res = (TH1F*)file->Get(histname);
-	hPixelBa_Res->SetTitle("Pixel barrel local x residuals");
-	hPixelBa_Res->GetXaxis()->SetTitle("Local x residuals [mm]");
-	hPixelBa_Res->GetYaxis()->SetTitle("Entries");
-	hPixelBa_Res->SetLineColor(ColorForFirst+2);
-	hPixelBa_Res->SetLineWidth(1);
-	hPixelBa_Res->SetFillColor(ColorForFirst);
-	hPixelBa_Res->SetFillStyle(3001);
-	if (normalizePlots) hPixelBa_Res->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-		gPad->SetGridy();
-		gPad->SetGridx();
-	}
-	  hPixelBa_Res->DrawCopy("hist");
-	  setTitleFont(font);
-	  ScalePlots();
-   
-	//
-	// -----------------------------------------------------------------
-	//
-	cInfoRes->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/trt_b_residualR";
-	if(PrintLevel>0) cout << " <residuals> Plotting Histogram: " << histname << endl;
-	
-	hTRTBa_Res = (TH1F*)file->Get(histname);
-	hTRTBa_Res->SetTitle("TRT barrel residuals");
-	hTRTBa_Res->GetXaxis()->SetTitle("TRT residuals [mm]");
-	hTRTBa_Res->GetYaxis()->SetTitle("Entries");
-	hTRTBa_Res->SetLineColor(ColorForFirst+2);
-	hTRTBa_Res->SetLineWidth(1);
-	hTRTBa_Res->SetFillColor(ColorForFirst);
-	hTRTBa_Res->SetFillStyle(3001);
-	if (normalizePlots) hTRTBa_Res->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-		gPad->SetGridy();
-		gPad->SetGridx();
-	}
-	hTRTBa_Res->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-   
-	// SUMMARY
-	cInfoRes->cd(1);
-	TLine *TLineBorder;
-	TLineBorder = new TLine(0.02,0.98,0.98,0.98);
-	TLineBorder->SetLineColor(kRed);
-	TLineBorder->Draw();
-	TLineBorder = new TLine(0.02,0.02,0.98,0.02);
-	TLineBorder->SetLineColor(kRed);
-	TLineBorder->Draw();
-	TLineBorder = new TLine(0.02,0.98,0.02,0.02);
-	TLineBorder->SetLineColor(kRed);
-	TLineBorder->Draw();
-	TLineBorder = new TLine(0.98,0.98,0.98,0.02);
-	TLineBorder->SetLineColor(kRed);
-	TLineBorder->Draw();
-
-  	TString name;
-	TLatex *t = new TLatex();
-	t->SetNDC();
-	t->SetTextFont(font);
-	t->SetTextSize(0.05);
-	t->SetTextAlign(12);
-	
-	t->DrawLatex(0.08,0.90,aSetup);
-	t->SetTextSize(0.035);
-
-	//sprintf(name,"%s",aSim);
-	//if (iCosmics) t->DrawLatex(0.8,0.83,name);
-	//else t->DrawLatex(0.8,0.90,name);
-
-	TLine *line1;
-	line1 = new TLine(0.06,0.87,0.95,0.87);
-	line1->Draw();
-
-	// Information
-	t->SetTextSize(0.035);
-	name = "Iteration: ";
-	name+=IterNumber;
-	t->DrawLatex(0.08,0.82,name);
-	
-	name = "Events: ";
-	name += iEvents;
-	t->DrawLatex(0.08,0.78,name);
-	name = "Track Collection 1 (#color[920-2]{gray}): " +  FirstTrackCollection;
-	t->DrawLatex(0.08,0.74,name);
-	name = "Tracks: ";
-	name += iTracks_1;
-	t->DrawLatex(0.08,0.70,name);
-	name = " - Total hits: ";
-	name += iHits_1;
-	t->DrawLatex(0.08,0.66,name);
-	name = " -- Pixel hits: ";
-	name += iPixelHits_1;
-	t->DrawLatex(0.08,0.62,name);
-	name = " -- SCT hits: ";
-	name += iSCTHits_1;
-	t->DrawLatex(0.08,0.58,name);
-	name = " -- TRT hits: ";
-	name += iTRTHits_1;
-	t->DrawLatex(0.08,0.54,name);
-	name = "Track Collection 2 (#color[632]{red}): " + SecondTrackCollection;
-	t->DrawLatex(0.08,0.50,name);
-	name = "Tracks: ";
-	name += iTracks_2;
-	t->DrawLatex(0.08,0.46,name);
-	name = " - Total hits: ";
-	name += iHits_2;
-	t->DrawLatex(0.08,0.42,name);
-	name = " -- Pixel hits: ";
-	name += iPixelHits_2;
-	t->DrawLatex(0.08,0.38,name);
-	name = " -- SCT hits: ";
-	name += iSCTHits_2;
-	t->DrawLatex(0.08,0.34,name);
-	name = " -- TRT hits: ";
-	name += iTRTHits_2;
-	t->DrawLatex(0.08,0.30,name);
-
-	
-	if (iBField!=999) {
-	  name = "B Field: ";
-	  name += iBField;
-	  name += " Tesla";
-	  t->DrawLatex(0.08,0.07,name);
-	}
-
-
-	cInfoRes->Update();
-	
-  
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelHitmap.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelHitmap.cc
deleted file mode 100644
index af6605b4c20d7be053e59f0886058a945aa10b66..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelHitmap.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sctBarrelHitmap(TString TrkCol){
-	sctBarrelHitmap(TrkCol, 0, "");
-}
-void sctBarrelHitmap(TString TrkCol, TString DrawOptions){
-	sctBarrelHitmap(TrkCol, 0, DrawOptions);
-}
-
-void sctBarrelHitmap(TString TrkCol, TCanvas *cSCTHitMapBa,	TString DrawOptions){
-	cout << cSCTHitMapBa << endl;
-	TH2F *hTmpHist;
-	TH2F *hSctBa[4];
-	TString histname;
-	bool setCommonMax = true;
-	const int iNSCT_Layers = 4;
-	Char_t name[100];
-	int maxx[2];
-	int maxb[4];
-	DrawOptions.ToLower();
-	bool NoText = DrawOptions.Contains("notext");
-
-	if(!cSCTHitMapBa)
-		cSCTHitMapBa = new TCanvas("cSCTHitMapBa","Hit Map of SCT Barrel",
-						CanvasSizeX4[0],CanvasSizeX4[1]);
-
-	//------------
-	// Barrel
-	//------------
-	cout << "	 - SCT Barrel..." << endl;
-	
-	// Module physical axis in Z (to be drawn on top along graphics X)
-	TGaxis *ATLZaxis[4]; 
-	TGaxis *ATLPhiaxis[4]; 
-	
-	maxx[0]=0;
-	for(int layer = 0; layer<iNSCT_Layers; layer++){
-		histname = "IDAlignMon/"+TrkCol+"/HitEfficiencies/measurements_vs_Eta_Phi_sct_b";
-		histname +=layer;		
-		if(PrintLevel>0) cout << " <sctBarrelHitmap> Plotting Histogram: " << histname << endl;
-		hTmpHist = (TH2F*)file->Get(histname); 
-		hSctBa[layer] = (TH2F*)hTmpHist->Clone("hSctBa");
-		hSctBa[layer]->SetBins(12,-5.5,6.5,hTmpHist->GetNbinsY(),hTmpHist->GetYaxis()->GetXmin(),hTmpHist->GetYaxis()->GetXmax());
-		for(int ybin=1; ybin<=hSctBa[layer]->GetNbinsY(); ybin++){
-			for(int xbin=1; xbin<=hSctBa[layer]->GetNbinsX(); xbin++){
-				if(xbin<7)
-					hSctBa[layer]->SetBinContent(xbin, ybin, hTmpHist->GetBinContent(xbin, ybin));
-				else
-					hSctBa[layer]->SetBinContent(xbin, ybin, hTmpHist->GetBinContent(xbin+1, ybin));
-			}
-		}
-		SCTMaps_SetXaxisLabels(hSctBa[layer]);
-		maxb[layer] = (int)hSctBa[layer]->GetBinContent(hSctBa[layer]->GetMaximumBin());
-		maxx[0] = maxb[layer]>maxx[0] ? maxb[layer] : maxx[0];
-		SetHistoAtt(hSctBa[layer]);
-		sprintf(name,"Hitmap %s - SCT Barrel Layer %d", TrkCol.Data(), layer);
-	
-		hSctBa[layer]->SetTitle(name);
-		hSctBa[layer]->GetYaxis()->SetTitleOffset(1.0);
-		hSctBa[layer]->GetXaxis()->SetLabelSize(0.04);
-		hSctBa[layer]->SetXTitle("ring");
-		hSctBa[layer]->SetYTitle("sector");
-		
-		
-	}
-
-	cSCTHitMapBa->Divide(2,2);
-	for(int layer=0; layer<iNSCT_Layers; layer++){
-		cSCTHitMapBa->cd(layer+1);
-		if(setCommonMax) hSctBa[layer]->SetMaximum(maxx[0]);	
-		NoText ? hSctBa[layer]->Draw("colz") : hSctBa[layer]->Draw("colztext");
-
-		// Z axis on top (only for histos with 12 bins) 
-		
-		if (hSctBa[layer]->GetNbinsX()==12) {
-			ATLZaxis[layer] = new TGaxis(-5.5,31.5,6.5,31.5,-800,800,510,"-");
-			ATLZaxis[layer]->SetName("Z");
-			if (layer == 0) {ATLZaxis[layer]->SetY1(31.5);ATLZaxis[layer]->SetY2(31.5);}
-			if (layer == 1) {ATLZaxis[layer]->SetY1(39.5);ATLZaxis[layer]->SetY2(39.5);}
-			if (layer == 2) {ATLZaxis[layer]->SetY1(47.5);ATLZaxis[layer]->SetY2(47.5);}
-			if (layer == 3) {ATLZaxis[layer]->SetY1(55.5);ATLZaxis[layer]->SetY2(55.5);}
-			ATLZaxis[layer]->SetLabelSize(hSctBa[layer]->GetYaxis()->GetLabelSize());
-			ATLZaxis[layer]->SetLabelOffset(0.0);
-			ATLZaxis[layer]->SetLabelFont(hSctBa[layer]->GetXaxis()->GetLabelFont());
-			ATLZaxis[layer]->SetTitleSize(hSctBa[layer]->GetXaxis()->GetTitleSize());
-			ATLZaxis[layer]->SetTitleFont(hSctBa[layer]->GetXaxis()->GetTitleFont());
-			ATLZaxis[layer]->SetTitle(" z (mm)");
-			ATLZaxis[layer]->Draw();
-		}
-		// moving the color scale
-		gPad->Update();
-		TPaletteAxis *palette = 
-	(TPaletteAxis*)hSctBa[layer]->GetListOfFunctions()->FindObject("palette");
-		palette->SetX1NDC(0.935);
-		palette->SetX2NDC(0.965);
-		palette->SetY1NDC(0.1);
-		palette->SetY2NDC(0.75);
-		gPad->Modified();
-		// Phi axis on the right 
-		ATLPhiaxis[layer] = new TGaxis(6.5,-0.5,6.5,31.5,0.,360.,510,"+L");
-		ATLPhiaxis[layer]->SetName("Z");
-		if (layer == 0) {ATLPhiaxis[layer]->SetY2(31.5);}
-		if (layer == 1) {ATLPhiaxis[layer]->SetY2(39.5);}
-		if (layer == 2) {ATLPhiaxis[layer]->SetY2(47.5);}
-		if (layer == 3) {ATLPhiaxis[layer]->SetY2(55.5);}
-		ATLPhiaxis[layer]->SetLabelSize(hSctBa[layer]->GetYaxis()->GetLabelSize());
-		ATLPhiaxis[layer]->SetLabelOffset(0.0);
-		ATLPhiaxis[layer]->SetLabelFont(hSctBa[layer]->GetXaxis()->GetLabelFont());
-		ATLPhiaxis[layer]->SetTitleSize(hSctBa[layer]->GetXaxis()->GetTitleSize());
-		ATLPhiaxis[layer]->SetTitleFont(hSctBa[layer]->GetXaxis()->GetTitleFont());
-		ATLPhiaxis[layer]->SetTitle("#phi (deg)");
-		ATLPhiaxis[layer]->SetLabelOffset(0.01);
-		ATLPhiaxis[layer]->Draw();
-	
-	}
-		
-	
-}
-
-
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelRes.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelRes.cc
deleted file mode 100644
index d2fb1f0881cbac8f00bb9aee1439c09c657fa443..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelRes.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sctBarrelResiduals(TString trkCol){
-	sctBarrelResiduals(trkCol, 0, "");
-}
-
-void sctBarrelResiduals(TString trkCol, TString trkCol2){
-	sctBarrelResiduals(trkCol, 0, trkCol2);
-}
-
-void sctBarrelResiduals(TString trkCol, TCanvas *cSCTBarrelRes){
-	sctBarrelResiduals(trkCol, cSCTBarrelRes, "");
-}
-
-void sctBarrelResiduals(TString trkCol, TCanvas *cSCTBarrelRes, TString trkCol2) {
-  constexpr size_t nLayers{4};
-	TH1F *hSCTBarrelRes[nLayers];
-	TH1F *hSCTBarrelRes_2[nLayers];
-	
-	TString histname, histtitle;
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cSCTBarrelRes){
-		cSCTBarrelRes = new TCanvas("cSCTBarrelRes","SCT Barrel Residuals per Layer",
-			      CanvasSizeX4[0],CanvasSizeX4[1]);
-	}
-	cSCTBarrelRes->Divide(2,2);
-	for(int layer=0; layer<nLayers; layer++){
-		cSCTBarrelRes->cd(layer+1);
-		
-		histname = "IDAlignMon/"+trkCol+"/Residuals/sct_b";
-		histname += layer;
-		histname += "_biased_residualx";
-		if(PrintLevel>0) cout << " <sctBarrelRes> Plotting Histogram: " << histname << endl;
-		hSCTBarrelRes[layer] = (TH1F*)file->Get(histname);
-
-		if ( hSCTBarrelRes[layer] == NULL) { // check if histogram exists
-		  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-		  return;
-		}
-	
-	
-		histtitle.Clear();
-		histtitle += trkCol.Data();
-		histtitle += ": SCT Barrel L";
-		histtitle += layer;
-		histtitle += " residuals";
-		hSCTBarrelRes[layer]->SetTitle(histtitle.Data());
-		hSCTBarrelRes[layer]->GetXaxis()->SetTitle("Residuals [mm]");
-		hSCTBarrelRes[layer]->GetYaxis()->SetTitle("Entries");
-		hSCTBarrelRes[layer]->SetLineColor(Color+2);
-		hSCTBarrelRes[layer]->SetFillColor(Color);
-		hSCTBarrelRes[layer]->SetLineWidth(1);
-		hSCTBarrelRes[layer]->SetFillStyle(3001);
-		if (normalizePlots) hSCTBarrelRes[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hSCTBarrelRes[layer]->DrawCopy("hist");
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_b";
-			histname += layer;
-			histname += "_biased_residualx";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			hSCTBarrelRes_2[layer] = (TH1F*)file->Get(histname);	
-			hSCTBarrelRes_2[layer]->SetLineColor(ColorForSecond+2);
-			hSCTBarrelRes_2[layer]->SetFillColor(ColorForSecond);
-			hSCTBarrelRes_2[layer]->SetLineWidth(1);
-			hSCTBarrelRes_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hSCTBarrelRes_2[layer]->Scale(1./(float)iEvents);
-			hSCTBarrelRes_2[layer]->DrawCopy("histsame");
-		}
-			
-	}
-
-
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelResVsPt.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelResVsPt.cc
deleted file mode 100644
index 4d733b773af513d8d233fba4d08e19e805f28499..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelResVsPt.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sctBarrelResidualsVsPt(TString trkCol){
-	sctBarrelResidualsVsPt(trkCol, 0, "");
-}
-
-void sctBarrelResidualsVsPt(TString trkCol, TString trkCol2){
-	sctBarrelResidualsVsPt(trkCol, 0, trkCol2);
-}
-
-void sctBarrelResidualsVsPt(TString trkCol, TCanvas *cSCTBarrelResVsPt){
-	sctBarrelResidualsVsPt(trkCol, cSCTBarrelResVsPt, "");
-}
-
-void sctBarrelResidualsVsPt(TString trkCol, TCanvas *cSCTBarrelResVsPt, TString trkCol2) {
-  constexpr size_t nLayers{4};
-	TProfile *hSCTBarrelResVsPt[nLayers];
-	TProfile *hSCTBarrelResVsPt_2[nLayers];
-	
-	float ProfMax = 0;
-	float max,min;
-   	
-	TH2F *tempHist;
-	TString histname;
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cSCTBarrelResVsPt){
-		cSCTBarrelResVsPt = new TCanvas("cSCTBarrelResVsPt","SCT Barrel Residuals per Layer",
-			      CanvasSizeX4[0],CanvasSizeX4[1]);
-	}
-	cSCTBarrelResVsPt->Divide(2,2);
-	for(int layer=0; layer<nLayers; layer++){
-		cSCTBarrelResVsPt->cd(layer+1);
-		
-		histname = "IDAlignMon/"+trkCol+"/Residuals/sct_b";
-		histname += layer;
-		histname += "_biased_residualx_pt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		tempHist = (TH2F*)file->Get(histname);
-		hSCTBarrelResVsPt[layer] = tempHist->ProfileX();	
-		sprintf(name,"SCT Barrel L%d Residuals Vs Pt",layer);
-		hSCTBarrelResVsPt[layer]->SetTitle(name);
-		hSCTBarrelResVsPt[layer]->GetXaxis()->SetTitle("Track qPt(GeV)");
-		hSCTBarrelResVsPt[layer]->GetYaxis()->SetTitle("Residuals (mm)");
-		hSCTBarrelResVsPt[layer]->SetLineColor(Color+2);
-		hSCTBarrelResVsPt[layer]->SetFillColor(Color);
-		hSCTBarrelResVsPt[layer]->SetLineWidth(1);
-		hSCTBarrelResVsPt[layer]->SetFillStyle(3001);
-		if (normalizePlots) hSCTBarrelResVsPt[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hSCTBarrelResVsPt[layer]->DrawCopy();
-		max = fabs(hSCTBarrelResVsPt[layer]->GetMaximum());
-		min = fabs(hSCTBarrelResVsPt[layer]->GetMinimum());
-		if(ProfMax<max) ProfMax = max;
-		if(ProfMax<min) ProfMax = min;
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_b";
-			histname += layer;
-			histname += "_biased_residualx_pt";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			tempHist = (TH2F*)file->Get(histname);
-		    hSCTBarrelResVsPt_2[layer] = tempHist->ProfileX();	
-			hSCTBarrelResVsPt_2[layer]->SetLineColor(ColorForSecond+2);
-			hSCTBarrelResVsPt_2[layer]->SetFillColor(ColorForSecond);
-			hSCTBarrelResVsPt_2[layer]->SetLineWidth(1);
-			hSCTBarrelResVsPt_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hSCTBarrelResVsPt_2[layer]->Scale(1./(float)iEvents);
-			hSCTBarrelResVsPt_2[layer]->DrawCopy("same");
-			max = fabs(hSCTBarrelResVsPt_2[layer]->GetMaximum());
-			min = fabs(hSCTBarrelResVsPt_2[layer]->GetMinimum());
-			if(ProfMax<max) ProfMax = max;
-			if(ProfMax<min) ProfMax = min;
-		}
-		
-	}
-	for(int layer=0; layer<4; layer++){
-		hSCTBarrelResVsPt[layer]->SetMaximum(ProfMax*1.1);
-		hSCTBarrelResVsPt[layer]->SetMinimum(-ProfMax*1.1);
-	}
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelResmaps.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelResmaps.cc
deleted file mode 100644
index 0a3e8bb6d387a999a9be21b9f66b8e2303e8be04..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelResmaps.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sctBarrelResmaps(TString TrkCol, bool side, bool isRMS, float range){
-	sctBarrelResmaps(TrkCol, 0, side, isRMS, range);
-}
-
-void sctBarrelResmaps(TString TrkCol, TCanvas *cSCTBaResMap, bool side, bool isRMS, float range){
-  if(!cSCTBaResMap)
-    cSCTBaResMap = new TCanvas("cSCTBaResMap","SCT Barrel Resmap",
-			       CanvasSizeX4[0], CanvasSizeX4[1]);
-  
-  
-  
-  TString histname;
-  TString name;
-  gStyle->SetPadRightMargin(0.15);
-  gStyle->SetPadLeftMargin(0.08);
-  gStyle->SetPadTopMargin(0.12);
-  gROOT->ForceStyle();
-  
-  
-  TString title;
-  
-  ////////////////////
-  // SCT Barrel     //
-  ////////////////////
-  
-  TH3F *hSCTResBa3D[iNSCT_Layers];
-  TH2F *hResMapBa[iNSCT_Layers];
-  TGaxis *ATLZaxis[iNSCT_Layers];
-  TGaxis *ATLPhiaxis[iNSCT_Layers];
-  cSCTBaResMap->Divide(2,2);
-  //------------
-  // Barrel
-  //------------
-  cout << "	 - Sct Barrel..." << endl;
-  
-  for(int layer = 0; layer<iNSCT_Layers; layer++){
-    histname = "IDAlignMon/"+TrkCol+"/Residuals/sct_b";
-    histname += layer;
-    if(side)
-      histname += "_s1_biased_xresvsmodetaphi_3d";
-    else
-      histname += "_s0_biased_xresvsmodetaphi_3d";
-    if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-    hSCTResBa3D[layer] = (TH3F*)file->Get(histname); 
-
-    if (hSCTResBa3D[layer] == NULL) {// check if histogram exists
-      std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-      return;
-    }
-
-    name.Clear();
-    name = TrkCol.Data();
-    name += ": ";
-    name+="SCT Barrel Layer ";
-    name+=layer;
-    if(side)
-      name += "Side 1 ";
-    else
-      name += "Side 0 ";
-    if(isRMS)
-      name += "Residual RMS map - ";
-    else
-      name += "Residual Mean map - ";
-    
-    hResMapBa[layer] = new TH2F(name,name,hSCTResBa3D[layer]->GetXaxis()->GetNbins()-1, 
-				hSCTResBa3D[layer]->GetXaxis()->GetXmin()+1,
-				hSCTResBa3D[layer]->GetXaxis()->GetXmax(),
-				hSCTResBa3D[layer]->GetYaxis()->GetNbins(), 
-				hSCTResBa3D[layer]->GetYaxis()->GetXmin(),
-				hSCTResBa3D[layer]->GetYaxis()->GetXmax());
-    for(int i = 1; i<=hSCTResBa3D[layer]->GetXaxis()->GetNbins();i++){
-      for(int j = 1; j<=hSCTResBa3D[layer]->GetYaxis()->GetNbins();j++){
-	if(i<7){
-	  if(isRMS)	
-	    hResMapBa[layer]->SetBinContent(i,j,1000.*hSCTResBa3D[layer]->ProjectionZ("_z",i,i,j,j)->GetRMS());
-	  else
-	    hResMapBa[layer]->SetBinContent(i,j,1000.*hSCTResBa3D[layer]->ProjectionZ("_z",i,i,j,j)->GetMean());
-	}
-	else if (i>7){
-	  if(isRMS)	
-	    hResMapBa[layer]->SetBinContent(i-1,j,1000.*hSCTResBa3D[layer]->ProjectionZ("_z",i,i,j,j)->GetRMS());
-	  else
-	    hResMapBa[layer]->SetBinContent(i-1,j,1000.*hSCTResBa3D[layer]->ProjectionZ("_z",i,i,j,j)->GetMean());
-	}
-	
-      }
-    }
-    cSCTBaResMap->cd(layer+1);
-    hResMapBa[layer]->SetStats(kFALSE);
-    hResMapBa[layer]->GetXaxis()->SetTitle("eta/ring");
-    hResMapBa[layer]->GetYaxis()->SetTitle("phi/stave");
-    hResMapBa[layer]->SetMaximum(range);
-    hResMapBa[layer]->SetMinimum(-range);
-    SCTMaps_SetXaxisLabels(hResMapBa[layer]);
-    if(isRMS)
-      hResMapBa[layer]->SetMinimum(0);
-    hResMapBa[layer]->Draw("colz");
-    // Z axis on top (only for histos with 12 bins) 
-    
-    
-		ATLZaxis[layer] = new TGaxis(-5.5,31.5,6.5,31.5,-800,800,510,"-");
-		ATLZaxis[layer]->SetName("Z");
-		if (layer == 0) {ATLZaxis[layer]->SetY1(31.5);ATLZaxis[layer]->SetY2(31.5);}
-		if (layer == 1) {ATLZaxis[layer]->SetY1(39.5);ATLZaxis[layer]->SetY2(39.5);}
-		if (layer == 2) {ATLZaxis[layer]->SetY1(47.5);ATLZaxis[layer]->SetY2(47.5);}
-		if (layer == 3) {ATLZaxis[layer]->SetY1(55.5);ATLZaxis[layer]->SetY2(55.5);}
-		ATLZaxis[layer]->SetLabelSize(hResMapBa[layer]->GetYaxis()->GetLabelSize());
-		ATLZaxis[layer]->SetLabelOffset(0.0);
-		ATLZaxis[layer]->SetLabelFont(hResMapBa[layer]->GetXaxis()->GetLabelFont());
-		ATLZaxis[layer]->SetTitleSize(hResMapBa[layer]->GetXaxis()->GetTitleSize());
-		ATLZaxis[layer]->SetTitleFont(hResMapBa[layer]->GetXaxis()->GetTitleFont());
-		ATLZaxis[layer]->SetTitle(" z (mm)");
-		ATLZaxis[layer]->Draw();
-		
-		// moving the color scale
-		gPad->Update();
-		TPaletteAxis *palette = 
-	(TPaletteAxis*)hResMapBa[layer]->GetListOfFunctions()->FindObject("palette");
-		palette->SetX1NDC(0.935);
-		palette->SetX2NDC(0.965);
-		palette->SetY1NDC(0.1);
-		palette->SetY2NDC(0.75);
-		gPad->Modified();
-		// Phi axis on the right 
-		ATLPhiaxis[layer] = new TGaxis(6.5,-0.5,6.5,31.5,0.,360.,510,"+L");
-		ATLPhiaxis[layer]->SetName("Z");
-		if (layer == 0) {ATLPhiaxis[layer]->SetY2(31.5);}
-		if (layer == 1) {ATLPhiaxis[layer]->SetY2(39.5);}
-		if (layer == 2) {ATLPhiaxis[layer]->SetY2(47.5);}
-		if (layer == 3) {ATLPhiaxis[layer]->SetY2(55.5);}
-		ATLPhiaxis[layer]->SetLabelSize(hResMapBa[layer]->GetYaxis()->GetLabelSize());
-		ATLPhiaxis[layer]->SetLabelOffset(0.0);
-		ATLPhiaxis[layer]->SetLabelFont(hResMapBa[layer]->GetXaxis()->GetLabelFont());
-		ATLPhiaxis[layer]->SetTitleSize(hResMapBa[layer]->GetXaxis()->GetTitleSize());
-		ATLPhiaxis[layer]->SetTitleFont(hResMapBa[layer]->GetXaxis()->GetTitleFont());
-		ATLPhiaxis[layer]->SetTitle("#phi (deg)");
-		ATLPhiaxis[layer]->SetLabelOffset(0.01);
-		ATLPhiaxis[layer]->Draw();
-
-		
-	}	
-	
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECHitmap.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECHitmap.cc
deleted file mode 100644
index 55be524aa2690145043bb2403557ca7a207c8b05..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECHitmap.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sctECHitmap(TString TrkCol, int ec){
-	sctECHitmap(TrkCol, ec, 0);
-}
-
-void sctECHitmap(TString TrkCol, int ec,TCanvas *cSCTHitMapEC){
-  TH3F *hTmpHist[2];
-  TH2F *hSctEc[2][9];
-  TString histname;
-  TString title;
-  bool setCommonMax = true;
-  const int iNSCT_Discs  = 9;
-  
-  Char_t name[100];
-  int maxx[2];
-  int maxb[9];
-  
-  //------------
-  // Endcaps
-  //------------
-  cout << "   - SCT EndCaps..." << endl;
-  if(!cSCTHitMapEC){
-    if(!ec)
-      cSCTHitMapEC = new TCanvas("cSCTHitMapECA","SCT Endcap A Hitmap",CanvasSizeX9[0],CanvasSizeX9[1],
-				 CanvasSizeX9[2], CanvasSizeX9[3]);
-    else
-      cSCTHitMapEC = new TCanvas("cSCTHitMapECC","SCT Endcap C Hitmap",CanvasSizeX9[0],CanvasSizeX9[1],
-				 CanvasSizeX9[2], CanvasSizeX9[3]);
-  }
-  cSCTHitMapEC->Divide(3,3);
-  // get histograms and determine maximum
-  maxx[ec]=0;
-  
-  for(int disc=0; disc<iNSCT_Discs; disc++){
-    if(!ec) histname = "IDAlignMon/"+TrkCol+ "/Residuals/sct_eca_d";
-    else histname = "IDAlignMon/"+TrkCol+ "/Residuals/sct_ecc_d";
-    histname += disc;
-    histname += "_s0_biased_xresvsmodetaphi_3d";
-    if(PrintLevel>0) cout << " <sctECHitmap> Plotting Histogram: " << histname << endl;
-    hTmpHist[0] = (TH3F*)file->Get(histname); 
-
-    if (hTmpHist[0] == NULL) { // check if histogram exists
-      std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-      return;
-    }
-
-    if(!ec) histname = "IDAlignMon/"+TrkCol+ "/Residuals/sct_eca_d";
-    else histname = "IDAlignMon/"+TrkCol+ "/Residuals/sct_ecc_d";
-    histname += disc;
-    histname += "_s1_biased_xresvsmodetaphi_3d";
-    if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-    hTmpHist[1] = (TH3F*)file->Get(histname); 
-    if(TrkCol == FirstTrackCollection){
-			if (!ec) sprintf(name,"HitmapECASCTDisc%dTrkCol_1",disc);
-			else sprintf(name,"HitmapECCSCTDisc%dTrkCol_1",disc);
-			}
-		else{
-			if (!ec) sprintf(name,"HitmapECASCTD%dTrkCol_2",disc);
-			else sprintf(name,"HitmapECCSCTDisc%dTrkCol_2",disc);
-		}
-		hSctEc[ec][disc] = new TH2F(name,name,hTmpHist[0]->GetNbinsX(), hTmpHist[0]->GetXaxis()->GetXmin(),hTmpHist[0]->GetXaxis()->GetXmax(),
-											  hTmpHist[0]->GetNbinsY(), hTmpHist[0]->GetYaxis()->GetXmin(),hTmpHist[0]->GetYaxis()->GetXmax());
-		
-		for(int xbins = 1; xbins<=hTmpHist[0]->GetNbinsX(); xbins++){
-			for(int ybins = 1; ybins<=hTmpHist[0]->GetNbinsY(); ybins++){
-				int hits = 0;
-				for (int zbins = 1; zbins<=hTmpHist[0]->GetNbinsZ(); zbins++){
-					hits += (int)hTmpHist[0]->GetBinContent(xbins,ybins,zbins) + 
-							(int)hTmpHist[1]->GetBinContent(xbins,ybins,zbins);
-				}
-				hSctEc[ec][disc]->SetBinContent(xbins,ybins,hits);
-			}
-		}
-		hTmpHist[0]=0;
-		hTmpHist[1]=0;
-	maxb[disc] = (int) hSctEc[ec][disc]->GetBinContent(hSctEc[ec][disc]->GetMaximumBin());
-	maxx[ec] = maxb[disc]>maxx[ec] ? maxb[disc] : maxx[ec];
-	}
-	// loop in discs
-	for(int disc=0; disc<iNSCT_Discs; disc++){
-	  sprintf(name,"Hitmap ECC SCT Disc %d %s",disc, TrkCol.Data());
-	  if (!ec) sprintf(name,"Hitmap ECA SCT Disc %d %s",disc, TrkCol.Data());
-		TH2F *boxsct = new TH2F(name, name, 156, -10, 10, 100, -10, 10);
-		boxsct->SetStats(kFALSE);
-		for(int bx=1; bx<=hSctEc[ec][disc]->GetNbinsX(); bx++)      	
-			for(int by=1; by<=hSctEc[ec][disc]->GetNbinsY(); by++)
-				boxsct->SetBinContent(50+bx, 50+by, hSctEc[ec][disc]->GetBinContent(bx,by));
-		if(setCommonMax){
-			boxsct->SetMaximum(maxx[ec]);
-			hSctEc[ec][disc]->SetMaximum(maxx[ec]);
-	  	}
-		TBox *blanksct = new TBox(-10,-10, 10, 9.85);
-		blanksct->SetFillColor(kWhite);
-		cSCTHitMapEC->cd(disc+1);
-		boxsct->GetXaxis()->SetLabelColor(kWhite);
-		boxsct->GetYaxis()->SetLabelColor(kWhite);
-		boxsct->GetYaxis()->SetTitle("Y axis");
-		boxsct->GetXaxis()->SetTitle("X axis");
-		boxsct->GetYaxis()->SetTitleOffset(0.8);
-		boxsct->Draw("colz");
-		blanksct->Draw();
-		gPad->RedrawAxis();
-		draw_sct_ec_modules(hSctEc[ec][disc], disc);
-		setTitleFont(font);
-		gPad->Update();
-			     
-    }
-	return;
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECRes.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECRes.cc
deleted file mode 100644
index c654bfe655b80ff87bf3a80518b8514a08218343..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECRes.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sctECResiduals(TString trkCol, bool ec){
-	sctECResiduals(trkCol, ec, 0, "");
-}
-
-void sctECResiduals(TString trkCol, bool ec, TString trkCol2){
-	sctECResiduals(trkCol, ec, 0, trkCol2);
-}
-
-void sctECResiduals(TString trkCol, bool ec, TCanvas *cSCTECRes){
-	sctECResiduals(trkCol, ec, cSCTECRes, "");
-}
-
-void sctECResiduals(TString trkCol, bool ec, TCanvas *cSCTECRes, TString trkCol2) {
-	TH1F *hSCTRes[9];
-	TH1F *hSCTRes_2[9];
-
-	
-	TString histname;
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cSCTECRes){
-		if(!ec)
-			cSCTECRes = new TCanvas("cSCTECRes","SCT Endcap A Residuals per Layer",
-			      		CanvasSizeX9[0],CanvasSizeX9[1],
-				    	CanvasSizeX9[2], CanvasSizeX9[3]);
-		else
-			cSCTECRes = new TCanvas("cSCTECRes","SCT Endcap C Residuals per Layer",
-			      		CanvasSizeX9[0],CanvasSizeX9[1],
-				  		CanvasSizeX9[2], CanvasSizeX9[3]);
-			
-	}
-	cSCTECRes->Divide(3,3);
-	for(int layer=0; layer<9; layer++){
-		cSCTECRes->cd(layer+1);
-		
-		if(!ec)
-			histname = "IDAlignMon/"+trkCol+"/Residuals/sct_eca_d";
-		else
-			histname = "IDAlignMon/"+trkCol+"/Residuals/sct_ecc_d";
-		histname += layer;
-		histname += "_biased_residualx";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hSCTRes[layer] = (TH1F*)file->Get(histname);	
-		if(!ec)
-			sprintf(name,"SCT Endcap A D%d Residuals (mm)",layer);
-		else
-			sprintf(name,"SCT Endcap C D%d Residuals (mm)",layer);
-		hSCTRes[layer]->SetTitle(name);
-		hSCTRes[layer]->GetXaxis()->SetTitle("Residuals (mm)");
-		hSCTRes[layer]->GetYaxis()->SetTitle("Entries");
-		hSCTRes[layer]->SetLineColor(Color+2);
-		hSCTRes[layer]->SetFillColor(Color);
-		hSCTRes[layer]->SetLineWidth(1);
-		hSCTRes[layer]->SetFillStyle(3001);
-		if (normalizePlots) hSCTRes[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hSCTRes[layer]->DrawCopy("hist");
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			if(!ec)
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_eca_d";
-			else
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_ecc_d";
-			histname += layer;
-			histname += "_biased_residualx";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			hSCTRes_2[layer] = (TH1F*)file->Get(histname);	
-			hSCTRes_2[layer]->SetLineColor(ColorForSecond+2);
-			hSCTRes_2[layer]->SetFillColor(ColorForSecond);
-			hSCTRes_2[layer]->SetLineWidth(1);
-			hSCTRes_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hSCTRes_2[layer]->Scale(1./(float)iEvents);
-			hSCTRes_2[layer]->DrawCopy("histsame");
-		}
-	}		
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECResVsPt.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECResVsPt.cc
deleted file mode 100644
index 93d24beecd5afea04dbe5315034ded61cdac79b1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECResVsPt.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sctECResidualsVsPt(TString trkCol, bool ec){
-	sctECResidualsVsPt(trkCol, ec, 0, "");
-}
-
-void sctECResidualsVsPt(TString trkCol, bool ec, TString trkCol2){
-	sctECResidualsVsPt(trkCol, ec, 0, trkCol2);
-}
-
-void sctECResidualsVsPt(TString trkCol, bool ec, TCanvas *cSCTECResVsPt){
-	sctECResidualsVsPt(trkCol, ec, cSCTECResVsPt, "");
-}
-
-void sctECResidualsVsPt(TString trkCol, bool ec, TCanvas *cSCTECResVsPt, TString trkCol2) {
-	TProfile *hSCTECResVsPt[9];
-	TProfile *hSCTECResVsPt_2[9];
-	TH2F *tempHist;
-	float max,min;
-   	float ProfMax = 0;
-   	
-	TString histname;
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cSCTECResVsPt){
-		if(!ec)
-			cSCTECResVsPt = new TCanvas("cSCTECResVsPt","SCT Endcap A Residuals per Layer",
-			      				CanvasSizeX9[0],CanvasSizeX9[1],
-				    			CanvasSizeX9[2], CanvasSizeX9[3]);
-		else
-			cSCTECResVsPt = new TCanvas("cSCTECResVsPt","SCT Endcap C Residuals per Layer",
-			     			 	CanvasSizeX9[0],CanvasSizeX9[1],
-				    			CanvasSizeX9[2], CanvasSizeX9[3]);
-			
-	}
-	cSCTECResVsPt->Divide(3,3);
-	for(int layer=0; layer<9; layer++){
-		cSCTECResVsPt->cd(layer+1);
-		
-		if(!ec)
-			histname = "IDAlignMon/"+trkCol+"/Residuals/sct_eca_d";
-		else
-			histname = "IDAlignMon/"+trkCol+"/Residuals/sct_ecc_d";
-		histname += layer;
-		histname += "_biased_residualx_pt";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		tempHist = (TH2F*)file->Get(histname);
-		hSCTECResVsPt[layer] = tempHist->ProfileX();	
-		if(!ec)
-			sprintf(name,"SCT Endcap A D%d Residuals Vs Pt ",layer);
-		else
-			sprintf(name,"SCT Endcap C D%d Residuals Vs Pt",layer);
-		hSCTECResVsPt[layer]->SetTitle(name);
-		hSCTECResVsPt[layer]->GetXaxis()->SetTitle("qPt (GeV)");
-		hSCTECResVsPt[layer]->GetYaxis()->SetTitle("Residuals (mm)");
-		hSCTECResVsPt[layer]->SetLineColor(Color+2);
-		hSCTECResVsPt[layer]->SetFillColor(Color);
-		hSCTECResVsPt[layer]->SetLineWidth(1);
-		hSCTECResVsPt[layer]->SetFillStyle(3001);
-		if (normalizePlots) hSCTECResVsPt[layer]->Scale(1./(float)iEvents);
-		if (!AtlasStyle) {
-		 gPad->SetGridy();
-		 gPad->SetGridx();
-		}
-		hSCTECResVsPt[layer]->DrawCopy();
-		max = fabs(hSCTECResVsPt[layer]->GetMaximum());
-		min = fabs(hSCTECResVsPt[layer]->GetMinimum());
-		if(ProfMax<max) ProfMax = max;
-		if(ProfMax<min) ProfMax = min;
-		setTitleFont(font);
-		ScalePlots();
-		setTitleSize(0.67);
-		if(trkCol2 !=""){
-			if(!ec)
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_eca_d";
-			else
-				histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_ecc_d";
-			histname += layer;
-			histname += "_biased_residualx_pt";
-	
-			if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-			tempHist = (TH2F*)file->Get(histname);
-			hSCTECResVsPt_2[layer] = tempHist->ProfileX();	
-			hSCTECResVsPt_2[layer]->SetLineColor(ColorForSecond+2);
-			hSCTECResVsPt_2[layer]->SetFillColor(ColorForSecond);
-			hSCTECResVsPt_2[layer]->SetLineWidth(1);
-			hSCTECResVsPt_2[layer]->SetFillStyle(3001);
-			if (normalizePlots) hSCTECResVsPt_2[layer]->Scale(1./(float)iEvents);
-			hSCTECResVsPt_2[layer]->DrawCopy("same");
-			max = fabs(hSCTECResVsPt_2[layer]->GetMaximum());
-			min = fabs(hSCTECResVsPt_2[layer]->GetMinimum());
-			if(ProfMax<max) ProfMax = max;
-			if(ProfMax<min) ProfMax = min;
-		}
-	
-	}
-	
-	for(int layer=0; layer<9; layer++){
-		hSCTECResVsPt[layer]->SetMaximum(ProfMax*1.1);
-		hSCTECResVsPt[layer]->SetMinimum(-ProfMax*1.1);
-	}
-
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECResmaps.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECResmaps.cc
deleted file mode 100644
index 8f8dc947d7a729d46995820d1bdec9424181288f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctECResmaps.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sctECResmaps(TString TrkCol, bool ec, bool side, bool isRMS, float range){
-	sctECResmaps(TrkCol, 0, ec, side, isRMS, range);
-}
-
-void sctECResmaps(TString TrkCol, TCanvas *cSCTResMapEC, bool ec, bool side, bool isRMS, float range){
-	
-	if(!cSCTResMapEC){
-    	if(!ec)
-			cSCTResMapEC = new TCanvas("cSCTResMapECA","SCT Endcap A Residual map",CanvasSizeX9[0],CanvasSizeX9[1],
-				       CanvasSizeX9[2], CanvasSizeX9[3]);
-		else
-			cSCTResMapEC = new TCanvas("cSCTResMapECC","SCT Endcap C Residual map",CanvasSizeX9[0],CanvasSizeX9[1],
-				       CanvasSizeX9[2], CanvasSizeX9[3]);
-	}
-	
-	TString histname;
-	TString name;
-	gStyle->SetPadRightMargin(0.15);
-	gStyle->SetPadLeftMargin(0.08);
-	gStyle->SetPadTopMargin(0.12);
-	gROOT->ForceStyle();
-
-
-	TString title;
-	
-	////////////////////
-	// SCT EC     //
-	////////////////////
-	
-	TH3F *hSCTResEC3D[iNSCT_Discs];
-	TH2F *hSCTResEC2D[iNSCT_Discs];
-	
-	cSCTResMapEC->Divide(3,3);
-	
-	
-	cout << " <sctECResmaps>  - Sct Endcap";
-	if(ec) cout << " C" << endl;
-	else cout << " A" << endl;
-
-	for(int disc = 0; disc<iNSCT_Discs; disc++){
-		histname = "IDAlignMon/"+TrkCol+"/Residuals/sct_";
-		if(ec) histname+="ecc_d";
-		else histname+="eca_d";
-		histname += disc;
-		if(side)
-			histname += "_s1_biased_xresvsmodetaphi_3d";
-		else
-			histname += "_s0_biased_xresvsmodetaphi_3d";
-		if(PrintLevel>0) cout << " <sctECResmaps> Plotting Histogram: " << histname << endl;
-		hSCTResEC3D[disc] = (TH3F*)file->Get(histname); 
-
-		if ( hSCTResEC3D[disc] == NULL) { // check if histogram exists
-		  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-		  return;
-		}
-
-		name = TrkCol.Data();
-		name += ": ";
-
-		if(ec) name+="SCT ECC Disc ";
-		else name+="SCT ECA Disc ";
-		name+=disc;
-
-		if(side)
-			name += "Side 1 ";
-		else
-			name += "Side 0 ";
-		if(isRMS)
-			name += "Residual RMS map - ";
-		else
-			name += "Residual Mean map - ";
-		
-
-		hSCTResEC2D[disc] = new TH2F(name+"Plot",name,hSCTResEC3D[disc]->GetXaxis()->GetNbins(), 
-										 hSCTResEC3D[disc]->GetXaxis()->GetXmin(),
-										 hSCTResEC3D[disc]->GetXaxis()->GetXmax(),
-										 hSCTResEC3D[disc]->GetYaxis()->GetNbins(), 
-										 hSCTResEC3D[disc]->GetYaxis()->GetXmin(),
-										 hSCTResEC3D[disc]->GetYaxis()->GetXmax());
-		for(int i = 1; i<=hSCTResEC3D[disc]->GetXaxis()->GetNbins();i++){
-			for(int j = 1; j<=hSCTResEC3D[disc]->GetYaxis()->GetNbins();j++){
-				if(isRMS)	
-					hSCTResEC2D[disc]->SetBinContent(i,j,1000.*hSCTResEC3D[disc]->ProjectionZ("_z",i,i,j,j)->GetRMS());
-				else
-					hSCTResEC2D[disc]->SetBinContent(i,j,1000.*hSCTResEC3D[disc]->ProjectionZ("_z",i,i,j,j)->GetMean());
-			}		
-		}
-		
-		hSCTResEC2D[disc]->SetContour(NContLevels);
-	    hSCTResEC2D[disc]->SetMaximum(range);
-	    if(isRMS)
-     		hSCTResEC2D[disc]->SetMinimum(0);
-	    else 
-	    	hSCTResEC2D[disc]->SetMinimum(-range);
-	    hSCTResEC2D[disc]->SetStats(kFALSE);
-		cSCTResMapEC->cd(disc+1);
-		TBox *blank = new TBox(-10,-10, 10, 9.85);
-	    blank->SetFillColor(kWhite);
-		draw_wheel_frame(name,-range,range);
-
-	    blank->Draw();
-	    gPad->SetRightMargin(0.20);
-	    gPad->SetLeftMargin(0.15);
-	    gPad->RedrawAxis();
-	    gPad->Update();
-	    setTitleFont(font);
-	    draw_sct_ec_modules(hSCTResEC2D[disc], disc);
-	    
-	}	
-	
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sct_trt_Residuals.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sct_trt_Residuals.cc
deleted file mode 100644
index 7e3a59381f067c1de1367d3545f1f8c6513b112a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sct_trt_Residuals.cc
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void sct_trt_Residuals(TString trkCol){
-	sct_trt_Residuals(trkCol, 0, "");
-}
-
-void sct_trt_Residuals(TString trkCol, TString trkCol2){
-	sct_trt_Residuals(trkCol, 0, trkCol2);
-}
-
-void sct_trt_Residuals(TString trkCol, TCanvas *cSctTRTRes){
-	sct_trt_Residuals(trkCol, cSctTRTRes, "");
-}
-
-void sct_trt_Residuals(TString trkCol, TCanvas *cSctTRTRes, TString trkCol2) {
-	TH1F *hSCT_TrkRes;
-	TH1F *hSCT_EndCapATrkRes;
-	TH1F *hSCT_EndCapCTrkRes;
-	
-	TH1F *hTRT_TrkRes;
-	TH1F *hTRT_EndCapATrkRes;
-	TH1F *hTRT_EndCapCTrkRes;
-
-	TH1F *hSCT_TrkRes_2;
-	TH1F *hSCT_EndCapATrkRes_2;
-	TH1F *hSCT_EndCapCTrkRes_2;
-	
-	TH1F *hTRT_TrkRes_2;
-	TH1F *hTRT_EndCapATrkRes_2;
-	TH1F *hTRT_EndCapCTrkRes_2;
-	
-	TString histname;
-	TString histtitle;
-
-	Color_t Color;
-	Char_t name[100];
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	cout << " Residuals..." << endl;
-	if (!cSctTRTRes){
-		cSctTRTRes = new TCanvas("SctTRTResiduals","SCT and TRT Residuals",CanvasSizeX6[0],CanvasSizeX6[1]);
-	}
-	cSctTRTRes->Divide(3,2);
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cSctTRTRes->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/sct_ecc_biased_residualx";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hSCT_EndCapCTrkRes = (TH1F*)file->Get(histname);
-	if (hSCT_EndCapCTrkRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": SCT ECC: Biased Residuals";
-	hSCT_EndCapCTrkRes->SetTitle(histtitle.Data());
-	hSCT_EndCapCTrkRes->GetXaxis()->SetTitle("Residuals [mm]");
-	hSCT_EndCapCTrkRes->GetYaxis()->SetTitle("Entries");
-	hSCT_EndCapCTrkRes->SetLineColor(Color+2);
-	hSCT_EndCapCTrkRes->SetFillColor(Color);
-	hSCT_EndCapCTrkRes->SetLineWidth(1);
-	hSCT_EndCapCTrkRes->SetFillStyle(3001);
-	if (normalizePlots) hSCT_EndCapCTrkRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hSCT_EndCapCTrkRes->GetMean()!=0.0) {
-	 hSCT_EndCapCTrkRes->DrawCopy("hist");	
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_ecc_biased_residualx";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hSCT_EndCapCTrkRes_2 = (TH1F*)file->Get(histname);	
-		hSCT_EndCapCTrkRes_2->SetLineColor(ColorForSecond+2);
-		hSCT_EndCapCTrkRes_2->SetFillColor(ColorForSecond);
-		hSCT_EndCapCTrkRes_2->SetLineWidth(1);
-		hSCT_EndCapCTrkRes_2->SetFillStyle(3001);
-		if (normalizePlots) hSCT_EndCapCTrkRes_2->Scale(1./(float)iEvents);
-		hSCT_EndCapCTrkRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hSCT_EndCapCTrkRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"SCT EndCap C");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-
-	cSctTRTRes->cd(2);
-	
-	histname = "IDAlignMon/"+trkCol+"/Residuals/sct_b_biasedresidualx";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hSCT_TrkRes = (TH1F*)file->Get(histname);	
-	if (hSCT_TrkRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": SCT Barrel: Biased Residuals";
-	hSCT_TrkRes->SetTitle(histtitle.Data());
-	hSCT_TrkRes->GetXaxis()->SetTitle("Residuals [mm]");
-	hSCT_TrkRes->GetYaxis()->SetTitle("Entries");
-	hSCT_TrkRes->SetLineColor(Color+2);
-	hSCT_TrkRes->SetFillColor(Color);
-	hSCT_TrkRes->SetLineWidth(1);
-	hSCT_TrkRes->SetFillStyle(3001);
-	if (normalizePlots) hSCT_TrkRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hSCT_TrkRes->GetMean()!=0.0) {
-	 hSCT_TrkRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_b_biasedresidualx";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hSCT_TrkRes_2 = (TH1F*)file->Get(histname);	
-		hSCT_TrkRes_2->SetLineColor(ColorForSecond+2);
-		hSCT_TrkRes_2->SetFillColor(ColorForSecond);
-		hSCT_TrkRes_2->SetLineWidth(1);
-		hSCT_TrkRes_2->SetFillStyle(3001);
-		if (normalizePlots) hSCT_TrkRes_2->Scale(1./(float)iEvents);
-		hSCT_TrkRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hSCT_TrkRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"SCT Barrel");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-	
-	cSctTRTRes->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/sct_eca_biased_residualx";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	
-	hSCT_EndCapATrkRes = (TH1F*)file->Get(histname);	
-	if (hSCT_EndCapATrkRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": SCT ECA: Biased Residuals";
-	hSCT_EndCapATrkRes->SetTitle(histtitle.Data());
-	hSCT_EndCapATrkRes->GetXaxis()->SetTitle("Residuals [mm]");
-	hSCT_EndCapATrkRes->GetYaxis()->SetTitle("Entries");
-	hSCT_EndCapATrkRes->SetLineColor(Color+2);
-	hSCT_EndCapATrkRes->SetFillColor(Color);
-	hSCT_EndCapATrkRes->SetLineWidth(1);
-	hSCT_EndCapATrkRes->SetFillStyle(3001);
-	if (normalizePlots) hSCT_EndCapATrkRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hSCT_EndCapATrkRes->GetMean()!=0.0) {
-	 hSCT_EndCapATrkRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/sct_eca_biased_residualx";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hSCT_EndCapATrkRes_2 = (TH1F*)file->Get(histname);	
-		hSCT_EndCapATrkRes_2->SetLineColor(ColorForSecond+2);
-		hSCT_EndCapATrkRes_2->SetFillColor(ColorForSecond);
-		hSCT_EndCapATrkRes_2->SetLineWidth(1);
-		hSCT_EndCapATrkRes_2->SetFillStyle(3001);
-		if (normalizePlots) hSCT_EndCapATrkRes_2->Scale(1./(float)iEvents);
-		hSCT_EndCapATrkRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hSCT_EndCapATrkRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"SCT ECA");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-	 
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-	
-	cSctTRTRes->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/trt_ec_residualR_Endcap_C";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTRT_EndCapCTrkRes = (TH1F*)file->Get(histname);	
-	if (hTRT_EndCapCTrkRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": TRT ECC: Unbiased Residuals";
-	hTRT_EndCapCTrkRes->SetTitle(histtitle.Data());
-	hTRT_EndCapCTrkRes->GetXaxis()->SetTitle("Residuals [mm]");
-	hTRT_EndCapCTrkRes->GetYaxis()->SetTitle("Entries");
-	hTRT_EndCapCTrkRes->SetLineColor(Color+2);
-	hTRT_EndCapCTrkRes->SetFillColor(Color);
-	hTRT_EndCapCTrkRes->SetLineWidth(1);
-	hTRT_EndCapCTrkRes->SetFillStyle(3001);
-	if (normalizePlots) hTRT_EndCapCTrkRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hTRT_EndCapCTrkRes->GetMean()!=0.0) {
-	 hTRT_EndCapCTrkRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/trt_ec_residualR_Endcap_C";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTRT_EndCapCTrkRes_2 = (TH1F*)file->Get(histname);	
-		hTRT_EndCapCTrkRes_2->SetLineColor(ColorForSecond+2);
-		hTRT_EndCapCTrkRes_2->SetFillColor(ColorForSecond);
-		hTRT_EndCapCTrkRes_2->SetLineWidth(1);
-		hTRT_EndCapCTrkRes_2->SetFillStyle(3001);
-		if (normalizePlots) hTRT_EndCapCTrkRes_2->Scale(1./(float)iEvents);
-		hTRT_EndCapCTrkRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hTRT_EndCapCTrkRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"TRT EndCap C");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-	
-	cSctTRTRes->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/trt_b_residualR";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTRT_TrkRes = (TH1F*)file->Get(histname);	
-	if (hTRT_TrkRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": TRT Barrel: Unbiased Residuals";
-	hTRT_TrkRes->SetTitle(histtitle.Data());
-	hTRT_TrkRes->GetXaxis()->SetTitle("Residuals [mm]");
-	hTRT_TrkRes->GetYaxis()->SetTitle("Entries");
-	hTRT_TrkRes->SetLineColor(Color+2);
-	hTRT_TrkRes->SetLineWidth(1);
-	hTRT_TrkRes->SetFillColor(Color);
-	hTRT_TrkRes->SetFillStyle(3001);
-	if (normalizePlots) hTRT_TrkRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hTRT_TrkRes->GetMean()!=0.0) {
-	 hTRT_TrkRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/trt_b_residualR";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTRT_TrkRes_2 = (TH1F*)file->Get(histname);	
-		hTRT_TrkRes_2->SetLineColor(ColorForSecond+2);
-		hTRT_TrkRes_2->SetFillColor(ColorForSecond);
-		hTRT_TrkRes_2->SetLineWidth(1);
-		hTRT_TrkRes_2->SetFillStyle(3001);
-		if (normalizePlots) hTRT_TrkRes_2->Scale(1./(float)iEvents);
-		hTRT_TrkRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hTRT_TrkRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"TRT Barrel");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-
-	cSctTRTRes->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/Residuals/trt_ec_residualR_Endcap_A";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTRT_EndCapATrkRes = (TH1F*)file->Get(histname);	
-	if (hTRT_EndCapATrkRes == NULL) { // check if histogram exists
-	  std::cout << " <sctECHitmap> ** ERROR ** histogram " << histname << " is NOT AVAILABLE " << std::endl;
-	  return;
-	}
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": TRT ECA: Unbiased Residuals";
-	hTRT_EndCapATrkRes->SetTitle(histtitle.Data());
-	hTRT_EndCapATrkRes->GetXaxis()->SetTitle("Residuals [mm]");
-	hTRT_EndCapATrkRes->GetYaxis()->SetTitle("Entries");
-	hTRT_EndCapATrkRes->SetLineColor(Color+2);
-	hTRT_EndCapATrkRes->SetFillColor(Color);
-	hTRT_EndCapATrkRes->SetLineWidth(1);
-	hTRT_EndCapATrkRes->SetFillStyle(3001);
-	if (normalizePlots) hTRT_EndCapATrkRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) {
-	 gPad->SetGridy();
-	 gPad->SetGridx();
-	}
-	if (hTRT_EndCapATrkRes->GetMean()!=0.0) {
-	 hTRT_EndCapATrkRes->DrawCopy("hist");
-	 setTitleFont(font);
-	 ScalePlots();
-	 setTitleSize(0.67);
-	 if(trkCol2 !=""){
-	 	histname = "IDAlignMon/"+trkCol2+"/Residuals/trt_ec_residualR_Endcap_A";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTRT_EndCapATrkRes_2 = (TH1F*)file->Get(histname);	
-		hTRT_EndCapATrkRes_2->SetLineColor(ColorForSecond+2);
-		hTRT_EndCapATrkRes_2->SetFillColor(ColorForSecond);
-		hTRT_EndCapATrkRes_2->SetLineWidth(1);
-		hTRT_EndCapATrkRes_2->SetFillStyle(3001);
-		if (normalizePlots) hTRT_EndCapATrkRes_2->Scale(1./(float)iEvents);
-		hTRT_EndCapATrkRes_2->DrawCopy("histsame");
-		}
-	}
-	else {
-	 hTRT_EndCapATrkRes->Delete();
-	 TLatex *t = new TLatex();
-	 t->SetNDC();
-	 t->SetTextFont(42);
-	 t->SetTextColor(kRed);
-	 t->SetTextSize(0.06);
-	 t->SetTextAngle(25);
-	 sprintf(name,"TRT EndCap A");
-	 t->DrawLatex(0.3,0.5,name);
-	 sprintf(name,"no processed");
-	 t->DrawLatex(0.33,0.44,name);
-
-	 TLine *TLineBorder;
-	 TLineBorder = new TLine(0.05,0.90,0.92,0.90);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.10,0.92,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.05,0.90,0.05,0.10);
-	 TLineBorder->Draw();
-	 TLineBorder = new TLine(0.92,0.90,0.92,0.10);
-	 TLineBorder->Draw();
-	}
-
-	
-
-	
-	return;
-
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/trkMomentum.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/trkMomentum.cc
deleted file mode 100644
index 096172a0d901a0716de7a24a35ba305049c00e00..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/trkMomentum.cc
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void trkMomentum(TString trkCol){
-	trkMomentum(trkCol, 0, "");
-}
-
-void trkMomentum(TString trkCol, TString trkCol2){
-	trkMomentum(trkCol, 0, trkCol2);
-}
-
-void trkMomentum(TString trkCol, TCanvas *cTrkMomentum){
-	trkMomentum(trkCol, cTrkMomentum, "");
-}
-
-void trkMomentum(TString trkCol, TCanvas *cTrkMomentum, TString trkCol2) {
-
-
-	TH1F *hTrkPt;
-	TH1F *hTrk_PtRes;
-	TH1F *hTrk_PtResOverP;
-	TH1F *hTrk_Pt_n;
-	TH1F *hTrk_Pt_p;
-	TH1F *hTrk_Pt_diff;
-	TH1F *hTrkPt_2;
-	TH1F *hTrk_PtRes_2;
-	TH1F *hTrk_PtResOverP_2;
-	TH1F *hTrk_Pt_n_2;
-	TH1F *hTrk_Pt_p_2;
-	TH1F *hTrk_Pt_diff_2;
-	cout << " Track Parameters..." << endl;
-	
-	TString histname;
-	TString histtitle;
-
-	Color_t Color;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	if(!cTrkMomentum)
-		cTrkMomentum = new TCanvas("cTrkMomentum","Track Momentum",
-							CanvasSizeX6[0],CanvasSizeX6[1]);
-							
-	cTrkMomentum->Divide(3,2);
-
-	cTrkMomentum->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/pT";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrkPt = (TH1F*)file->Get(histname);
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": p_{T}";
-	hTrkPt->SetTitle(histtitle.Data());
-	hTrkPt->GetXaxis()->SetTitle("p_{T} [GeV]");
-	hTrkPt->GetYaxis()->SetTitle("Tracks");
-	hTrkPt->SetLineColor(Color+2);
-	hTrkPt->SetFillColor(Color);
-	hTrkPt->SetFillStyle(3001);
-	hTrkPt->SetMinimum(0.);
-	if (normalizePlots) hTrkPt->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrkPt->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/pT";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrkPt_2 = (TH1F*)file->Get(histname);	
-		hTrkPt_2->SetLineColor(ColorForSecond+2);
-		hTrkPt_2->SetFillColor(ColorForSecond);
-		hTrkPt_2->SetLineWidth(1);
-		hTrkPt_2->SetFillStyle(3001);
-		if (normalizePlots) hTrkPt_2->Scale(1./(float)iEvents);
-		hTrkPt_2->DrawCopy("histsame");
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkMomentum->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/pTRes";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_PtRes = (TH1F*)file->Get(histname);
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": p_{T} resolution";
-	hTrk_PtRes->SetTitle(histtitle.Data());
-	hTrk_PtRes->GetXaxis()->SetTitle("p_{T} resol. [GeV]");
-	hTrk_PtRes->GetYaxis()->SetTitle("Tracks");
-	hTrk_PtRes->SetLineColor(Color+2);
-	hTrk_PtRes->SetFillColor(Color);
-	hTrk_PtRes->SetFillStyle(3001);
-	hTrk_PtRes->SetMinimum(0.);
-	hTrk_PtRes->GetXaxis()->SetRangeUser(0.,0.15);
-	if (normalizePlots) hTrk_PtRes->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_PtRes->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/pTRes";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_PtRes_2 = (TH1F*)file->Get(histname);	
-		hTrk_PtRes_2->SetLineColor(ColorForSecond+2);
-		hTrk_PtRes_2->SetFillColor(ColorForSecond);
-		hTrk_PtRes_2->SetLineWidth(1);
-		hTrk_PtRes_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_PtRes_2->Scale(1./(float)iEvents);
-		hTrk_PtRes_2->DrawCopy("histsame");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkMomentum->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/pTResOverP";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_PtResOverP = (TH1F*)file->Get(histname);
-	hTrk_PtResOverP->SetTitle("Trk pT Res Over P");
-	hTrk_PtResOverP->GetXaxis()->SetTitle("pT resol. over P");
-	hTrk_PtResOverP->GetYaxis()->SetTitle("Tracks");
-	hTrk_PtResOverP->SetLineColor(Color+2);
-	hTrk_PtResOverP->SetFillColor(Color);
-	hTrk_PtResOverP->SetFillStyle(3001);
-	hTrk_PtResOverP->SetMinimum(0.);
-	if (normalizePlots) hTrk_PtResOverP->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_PtResOverP->DrawCopy("hist");
-	hTrk_PtResOverP->GetXaxis()->SetRangeUser(0.,5E-3);
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/pTResOverP";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_PtResOverP_2 = (TH1F*)file->Get(histname);	
-		hTrk_PtResOverP_2->SetLineColor(ColorForSecond+2);
-		hTrk_PtResOverP_2->SetFillColor(ColorForSecond);
-		hTrk_PtResOverP_2->SetLineWidth(1);
-		hTrk_PtResOverP_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_PtResOverP_2->Scale(1./(float)iEvents);
-		hTrk_PtResOverP_2->DrawCopy("histsame");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkMomentum->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/pT_p";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_Pt_p = (TH1F*)file->Get(histname);
-	//gPad->SetLogy();
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": p_{T} (positive particles)";
-	hTrk_Pt_p->SetTitle(histtitle.Data());
-	hTrk_Pt_p->GetXaxis()->SetTitle("p_{T} [GeV]");
-	hTrk_Pt_p->GetYaxis()->SetTitle("Tracks");
-	hTrk_Pt_p->SetLineColor(Color+2);
-	hTrk_Pt_p->SetFillColor(Color);
-	hTrk_Pt_p->SetFillStyle(3001);
-	hTrk_Pt_p->SetMinimum(0.);
-	if (normalizePlots) hTrk_Pt_p->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_Pt_p->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/pT_p";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_Pt_p_2 = (TH1F*)file->Get(histname);	
-		hTrk_Pt_p_2->SetLineColor(ColorForSecond+2);
-		hTrk_Pt_p_2->SetFillColor(ColorForSecond);
-		hTrk_Pt_p_2->SetLineWidth(1);
-		hTrk_Pt_p_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_Pt_p_2->Scale(1./(float)iEvents);
-		hTrk_Pt_p_2->DrawCopy("histsame");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkMomentum->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/pT_n";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_Pt_n = (TH1F*)file->Get(histname);
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": p_{T} (negative particles)";
-	hTrk_Pt_n->SetTitle(histtitle.Data());
-	hTrk_Pt_n->GetXaxis()->SetTitle("p_{T} [GeV]");
-	hTrk_Pt_n->GetYaxis()->SetTitle("Tracks");
-	hTrk_Pt_n->SetLineColor(Color+2);
-	hTrk_Pt_n->SetFillColor(Color);
-	hTrk_Pt_n->SetFillStyle(3001);
-	if (normalizePlots) hTrk_Pt_n->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_Pt_n->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/pT_n";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_Pt_n_2 = (TH1F*)file->Get(histname);	
-		hTrk_Pt_n_2->SetLineColor(ColorForSecond+2);
-		hTrk_Pt_n_2->SetFillColor(ColorForSecond);
-		hTrk_Pt_n_2->SetLineWidth(1);
-		hTrk_Pt_n_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_Pt_n_2->Scale(1./(float)iEvents);
-		hTrk_Pt_n_2->DrawCopy("histsame");
-	}
-
-	
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkMomentum->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/pT_diff";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_Pt_diff = (TH1F*)file->Get(histname);	
-	hTrk_Pt_diff->SetTitle("Difference Neg-Pos Tracks Vs P_{T}");
-	hTrk_Pt_diff->GetXaxis()->SetTitle("p_{T} [GeV]");
-	hTrk_Pt_diff->GetYaxis()->SetTitle("Tracks");
-	hTrk_Pt_diff->SetLineColor(Color+2);
-	hTrk_Pt_diff->SetFillColor(Color);
-	hTrk_Pt_diff->SetFillStyle(3001);
-	if (normalizePlots) hTrk_Pt_diff->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_Pt_diff->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/pT_diff";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_Pt_diff_2 = (TH1F*)file->Get(histname);	
-		hTrk_Pt_diff_2->SetLineColor(ColorForSecond+2);
-		hTrk_Pt_diff_2->SetFillColor(ColorForSecond);
-		hTrk_Pt_diff_2->SetLineWidth(1);
-		hTrk_Pt_diff_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_Pt_diff_2->Scale(1./(float)iEvents);
-		hTrk_Pt_diff_2->DrawCopy("histsame");
-	}
-
-
-
-	cTrkMomentum->Update();
-
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/trkParameters.cc b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/trkParameters.cc
deleted file mode 100644
index 4491e0822206e76bc8426a881da6ea28fdfd7a10..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/trkParameters.cc
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-void trkParameters(TString trkCol){
-	trkParameters(trkCol, 0, "");
-}
-
-void trkParameters(TString trkCol, TString trkCol2){
-	trkParameters(trkCol, 0, trkCol2);
-}
-
-void trkParameters(TString trkCol, TCanvas *cTrkParameters){
-	trkParameters(trkCol, cTrkParameters, "");
-}
-
-void trkParameters(TString trkCol, TCanvas *cTrkParameters, TString trkCol2) {
-
-
-	TH1F *hTrk_d0;
-	TH1F *hTrk_z0;
-	TH1F *hTrk_phi0;
-	TH1F *hTrk_Pt;
-	TH1F *hTrk_eta;
-	TH1F *hTrk_chi2;
-	TH1F *hTrk_d0_2;
-	TH1F *hTrk_z0_2;
-	TH1F *hTrk_phi0_2;
-	TH1F *hTrk_Pt_2;
-	TH1F *hTrk_eta_2;
-	TH1F *hTrk_chi2_2;
-	cout << " Track Parameters..." << endl;
-	
-	TString histname;
-	TString histtitle;
-	Color_t Color;
-	if (trkCol == FirstTrackCollection) Color = ColorForFirst;
-	else Color = ColorForSecond;
-	
-	if(!cTrkParameters)
-		cTrkParameters = new TCanvas("cTrkParameters","Track Parameters",
-							CanvasSizeX6[0],CanvasSizeX6[1]);
-							
-	cTrkParameters->Divide(3,2);
-
-	cTrkParameters->cd(1);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/d0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_d0 = (TH1F*)file->Get(histname);
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": d_{0}";
-	hTrk_d0->SetTitle(histtitle.Data());
-	hTrk_d0->GetXaxis()->SetTitle("d_{0} (mm)");
-	hTrk_d0->GetYaxis()->SetTitle("Tracks");
-	hTrk_d0->SetLineColor(Color+2);
-	hTrk_d0->SetFillColor(Color);
-	hTrk_d0->SetFillStyle(3001);
-	hTrk_d0->SetMinimum(0.);
-	if (normalizePlots) hTrk_d0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_d0->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/d0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_d0_2 = (TH1F*)file->Get(histname);	
-		hTrk_d0_2->SetLineColor(ColorForSecond+2);
-		hTrk_d0_2->SetFillColor(ColorForSecond);
-		hTrk_d0_2->SetLineWidth(1);
-		hTrk_d0_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_d0_2->Scale(1./(float)iEvents);
-		hTrk_d0_2->DrawCopy("histsame");
-	}
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkParameters->cd(2);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/z0";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_z0 = (TH1F*)file->Get(histname);
-	hTrk_z0->SetTitle("Trk Parameter: z_{0}");
-	hTrk_z0->GetXaxis()->SetTitle("z_{0} (mm)");
-	hTrk_z0->GetYaxis()->SetTitle("Tracks");
-	hTrk_z0->SetLineColor(Color+2);
-	hTrk_z0->SetFillColor(Color);
-	hTrk_z0->SetFillStyle(3001);
-	hTrk_z0->SetMinimum(0.);
-	if (normalizePlots) hTrk_z0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_z0->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/z0";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_z0_2 = (TH1F*)file->Get(histname);	
-		hTrk_z0_2->SetLineColor(ColorForSecond+2);
-		hTrk_z0_2->SetFillColor(ColorForSecond);
-		hTrk_z0_2->SetLineWidth(1);
-		hTrk_z0_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_z0_2->Scale(1./(float)iEvents);
-		hTrk_z0_2->DrawCopy("histsame");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkParameters->cd(3);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/phi";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_phi0 = (TH1F*)file->Get(histname);
-	hTrk_phi0->SetTitle("Trk Parameter: #phi_{0}");
-	hTrk_phi0->GetXaxis()->SetTitle("#phi_{0} (rad)");
-	hTrk_phi0->GetYaxis()->SetTitle("Tracks");
-	hTrk_phi0->SetLineColor(Color+2);
-	hTrk_phi0->SetFillColor(Color);
-	hTrk_phi0->SetFillStyle(3001);
-	hTrk_phi0->SetMinimum(0.);
-	if (normalizePlots) hTrk_phi0->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_phi0->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/phi";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_phi0_2 = (TH1F*)file->Get(histname);	
-		hTrk_phi0_2->SetLineColor(ColorForSecond+2);
-		hTrk_phi0_2->SetFillColor(ColorForSecond);
-		hTrk_phi0_2->SetLineWidth(1);
-		hTrk_phi0_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_phi0_2->Scale(1./(float)iEvents);
-		hTrk_phi0_2->DrawCopy("histsame");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkParameters->cd(4);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/eta";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_eta = (TH1F*)file->Get(histname);
-	hTrk_eta->SetTitle("Trk Parameter: #eta");
-	hTrk_eta->GetXaxis()->SetTitle("#eta = -ln (tan(#theta/2))");
-	hTrk_eta->GetYaxis()->SetTitle("Tracks");
-	hTrk_eta->SetLineColor(Color+2);
-	hTrk_eta->SetFillColor(Color);
-	hTrk_eta->SetFillStyle(3001);
-	hTrk_eta->SetMinimum(0.);
-	if (normalizePlots) hTrk_eta->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_eta->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/eta";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_eta_2 = (TH1F*)file->Get(histname);	
-		hTrk_eta_2->SetLineColor(ColorForSecond+2);
-		hTrk_eta_2->SetFillColor(ColorForSecond);
-		hTrk_eta_2->SetLineWidth(1);
-		hTrk_eta_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_eta_2->Scale(1./(float)iEvents);
-		hTrk_eta_2->DrawCopy("histsame");
-	}
-	
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkParameters->cd(5);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/pT";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_Pt = (TH1F*)file->Get(histname);
-	gPad->SetLogy();
-	histtitle.Clear();
-	histtitle += trkCol.Data();
-	histtitle += ": P_{T}";
-	hTrk_Pt->SetTitle(histtitle.Data());
-	hTrk_Pt->GetXaxis()->SetTitle("P_{T} (GeV)");
-	hTrk_Pt->GetYaxis()->SetTitle("Tracks");
-	hTrk_Pt->SetLineColor(Color+2);
-	hTrk_Pt->SetFillColor(Color);
-	hTrk_Pt->SetFillStyle(3001);
-	if (normalizePlots) hTrk_Pt->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_Pt->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/pT";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_Pt_2 = (TH1F*)file->Get(histname);	
-		hTrk_Pt_2->SetLineColor(ColorForSecond+2);
-		hTrk_Pt_2->SetFillColor(ColorForSecond);
-		hTrk_Pt_2->SetLineWidth(1);
-		hTrk_Pt_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_Pt_2->Scale(1./(float)iEvents);
-		hTrk_Pt_2->DrawCopy("histsame");
-	}
-
-	
-
-	//
-	// -----------------------------------------------------------------
-	//
-
-	cTrkParameters->cd(6);
-	histname = "IDAlignMon/"+trkCol+"/GenericTracks/chi2oDoF";
-	if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-	hTrk_chi2 = (TH1F*)file->Get(histname);	
-	hTrk_chi2->SetTitle("Chi2");
-	hTrk_chi2->GetXaxis()->SetTitle("Chi2");
-	hTrk_chi2->GetYaxis()->SetTitle("Tracks");
-	hTrk_chi2->SetLineColor(Color+2);
-	hTrk_chi2->SetFillColor(Color);
-	hTrk_chi2->SetFillStyle(3001);
-	if (normalizePlots) hTrk_chi2->Scale(1./(float)iEvents);
-	if (!AtlasStyle) { gPad->SetGridy(); gPad->SetGridx(); }
-	hTrk_chi2->DrawCopy("hist");
-	setTitleFont(font);
-	ScalePlots();
-	if(trkCol2 !=""){
-		histname = "IDAlignMon/"+trkCol2+"/GenericTracks/chi2oDoF";
-		if(PrintLevel>0) cout << "Plotting Histogram: " << histname << endl;
-		hTrk_chi2_2 = (TH1F*)file->Get(histname);	
-		hTrk_chi2_2->SetLineColor(ColorForSecond+2);
-		hTrk_chi2_2->SetFillColor(ColorForSecond);
-		hTrk_chi2_2->SetLineWidth(1);
-		hTrk_chi2_2->SetFillStyle(3001);
-		if (normalizePlots) hTrk_chi2_2->Scale(1./(float)iEvents);
-		hTrk_chi2_2->DrawCopy("histsame");
-	}
-
-
-
-	cTrkParameters->Update();
-
-}
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/reweight.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/reweight.C
deleted file mode 100644
index fd035d4f290f36e742064cfdeffcc60dc7857ab0..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/reweight.C
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TFile.h"
-#include <string>
-#include <cstdio>
-#include "TCanvas.h"
-#include "TString.h"
-#include "TProfile2D.h"
-#include <iostream>
-
-
-
-
-
-void reweight(const std::string  & mcname, const std::string  & dtname)
-{
-
-  TFile *mcfile = new TFile(mcname.c_str());
-  TFile *dtfile = new TFile(dtname.c_str());
-
-  std::string histoName("trk_pT_vs_eta");
-  std::string path("IDAlignMon/ExtendedTracks_noTrigSel_15GeV/GenericTracks/");
-  std::string hh = path + histoName;
-  std::cout << "name " << hh << std::endl;
-
-  TH2F * mchisto = (TH2F*) mcfile->GetObjectUnchecked( hh.c_str() );
-  TH2F * dthisto = (TH2F*) dtfile->GetObjectUnchecked( hh.c_str() );
-
-
-
-  //  
-  // 
-  int nbins = mchisto->GetNbinsX();
-  TH1D*  mcp = mchisto->ProjectionX("mcp", nbins-10, nbins+10);
-  TH1D*  dtp = dthisto->ProjectionX("dtp", nbins-10, nbins+10);
-
-  TProfile*   mcpp = mchisto->ProfileX("mcpp", nbins-10, nbins+10);
-  TProfile*   dtpp = dthisto->ProfileX("dtpp", nbins-10, nbins+10);
-
-
-  mcp->Scale(1./mcp->Integral());
-  dtp->Scale(1./dtp->Integral());
-
-  dtp->SetLineColor(kRed);
-  mcp->Draw("histo");
-  dtp->Draw("histo same");
-
-  TCanvas *Bpm_canvas = new TCanvas("Bpm_fit","Bpm_fit", 2);
-  dtpp->SetLineColor(kRed);
-  mcpp->Draw("histo");
-  dtpp->Draw("histo same");
-
-
-  TH2F * weight = (TH2F*) mchisto->Clone();
-
-  for (int ix = 0; ix < mchisto->GetNbinsX()+1; ix++){
-    for(int iy = 0; iy < mchisto->GetNbinsY()+1; iy++){
-
-      double mcbin = mchisto->GetBinContent(ix,iy);
-      double dtbin = dthisto->GetBinContent(ix,iy);
-      if ( mcbin != 0 ) weight->SetBinContent( ix, iy, dtbin / mcbin );
-      else              weight->SetBinContent( ix, iy, 0 );
-    }
-  }
-
-  TH1D* wp = weight->ProjectionX("wp", nbins-1, nbins+1);
-  wp->Scale(wp->Integral());
-  wp->Draw();
- 
-  TFile *wfile = new TFile("hWeight.root", "recreate");
-  weight->Write();
-
-  return;
-
-
-
-
-
-}
diff --git a/InnerDetector/InDetSimUtils/TRT_TR_Process/CMakeLists.txt b/InnerDetector/InDetSimUtils/TRT_TR_Process/CMakeLists.txt
index 749dee2d9eac93d1d87a7f470c820a5683b86ef2..ad2c594752b7b0fb429f5bac1778a8d884e69bd0 100644
--- a/InnerDetector/InDetSimUtils/TRT_TR_Process/CMakeLists.txt
+++ b/InnerDetector/InDetSimUtils/TRT_TR_Process/CMakeLists.txt
@@ -19,6 +19,7 @@ atlas_add_library( TRT_TR_Process
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    LINK_LIBRARIES ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib IdDictDetDescr G4AtlasInterfaces GeoMaterial2G4 GeoModelInterfaces PathResolver RDBAccessSvcLib )
+set_target_properties( TRT_TR_Process PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/LArCalorimeter/LArCabling/CMakeLists.txt b/LArCalorimeter/LArCabling/CMakeLists.txt
index 27fcd2119103aafb94fad2b9084ea2e468807806..ca26f13931a2f2ef7bb4ec16e6c2fc352915d000 100644
--- a/LArCalorimeter/LArCabling/CMakeLists.txt
+++ b/LArCalorimeter/LArCabling/CMakeLists.txt
@@ -30,4 +30,6 @@ atlas_install_runtime( share/FEBtoRODfred_v10.data )
 
 if( NOT SIMULATIONBASE AND NOT GENERATIONBASE )
   atlas_add_test( LArCablingConfig    SCRIPT python -m LArCabling.LArCablingConfig POST_EXEC_SCRIPT nopost.sh )
+  atlas_add_test( LArIdCablingTest SCRIPT python -m LArCabling.LArIdCablingTest POST_EXEC_SCRIPT noerror.sh )
+  atlas_add_test( LArIdCablingTestSC SCRIPT python -m LArCabling.LArIdCablingTest --SC POST_EXEC_SCRIPT noerror.sh )
 endif()
diff --git a/LArCalorimeter/LArCabling/python/LArIdCablingTest.py b/LArCalorimeter/LArCabling/python/LArIdCablingTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..07cb1ee0045934c844cb8a560d3e38851545587b
--- /dev/null
+++ b/LArCalorimeter/LArCabling/python/LArIdCablingTest.py
@@ -0,0 +1,67 @@
+
+#Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+from AthenaConfiguration.ComponentFactory import CompFactory
+
+def LArIdCablingTestCfg(flags,isSC=False):
+    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
+    result=LArGMCfg(flags)
+
+    if isSC:
+        #Setup SuperCell cabling
+        from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg
+        result.merge(LArOnOffIdMappingSCCfg(flags))
+    else:
+        #Setup regular cabling
+        from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
+        result.merge(LArOnOffIdMappingCfg(flags))
+
+    result.addEventAlgo(CompFactory.LArIdCablingTest("LArIdCablingTest",isSC=isSC, 
+                                                     CablingKey= "LArOnOffIdMapSC" if isSC else "LArOnOffIdMap",
+                                                     ))
+    return result
+
+
+if __name__=="__main__":
+    import sys,argparse
+    parser= argparse.ArgumentParser()
+    parser.add_argument("--loglevel", default=None, help="logging level (ALL, VERBOSE, DEBUG,INFO, WARNING, ERROR, or FATAL")
+    parser.add_argument("-r","--runnumber",default=0x7fffffff, type=int, help="run number to query the DB")
+    parser.add_argument("-d","--database",default="LAR_ONL", help="Database name or sqlite file name")
+    parser.add_argument("--SC", action='store_true', help="Work on SuperCells")
+
+    (args,leftover)=parser.parse_known_args(sys.argv[1:])
+
+    if len(leftover)>0:
+        print("ERROR, unhandled argument(s):",leftover)
+        sys.exit(-1)
+    
+    from AthenaConfiguration.AllConfigFlags import initConfigFlags
+    flags=initConfigFlags()
+
+    flags.Input.isMC = False
+    flags.IOVDb.DatabaseInstance="CONDBR2"
+    flags.LAr.doAlign=False
+    flags.Input.RunNumbers=[args.runnumber]
+    flags.IOVDb.GlobalTag="CONDBR2-ES1PA-2023-02"
+    from AthenaConfiguration.TestDefaults import defaultGeometryTags
+    flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
+    flags.lock()
+
+    isSC=args.SC 
+
+    from AthenaConfiguration.MainServicesConfig import MainServicesCfg
+    cfg=MainServicesCfg(flags)
+    #MC Event selector since we have no input data file
+    from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
+    cfg.merge(McEventSelectorCfg(flags,
+                                 EventsPerRun      = 1,
+                                 FirstEvent        = 1,
+                                 InitialTimeStamp  = 0,
+                                 TimeStampInterval = 1))
+
+
+
+
+    cfg.merge(LArIdCablingTestCfg(flags,isSC))
+    cfg.getService("MessageSvc").errorLimit=5000000
+    cfg.run(1)
diff --git a/LArCalorimeter/LArCabling/src/LArIdCablingTest.cxx b/LArCalorimeter/LArCabling/src/LArIdCablingTest.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..d3df6ed4289cfa7c8cdacc7b1d67399634f3de70
--- /dev/null
+++ b/LArCalorimeter/LArCabling/src/LArIdCablingTest.cxx
@@ -0,0 +1,132 @@
+/*
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "LArIdCablingTest.h"
+#include "LArIdentifier/LArOnline_SuperCellID.h"
+#include "LArIdentifier/LArOnlineID.h"
+#include "CaloIdentifier/CaloCell_ID.h"
+#include "CaloIdentifier/CaloCell_SuperCell_ID.h"
+
+
+LArIdCablingTest::~LArIdCablingTest() = default;
+
+
+StatusCode LArIdCablingTest::initialize() {
+
+  ATH_MSG_INFO ( "initialize()" );
+  if (m_isSC && m_cablingKey.key()=="LArOnOffIdMap") {
+    ATH_MSG_ERROR("Unexpected cabling key for SuperCellCase, found " <<  m_cablingKey);
+  }
+  
+  ATH_CHECK(m_cablingKey.initialize());
+
+  return StatusCode::SUCCESS;
+}
+
+
+StatusCode LArIdCablingTest::execute() {
+
+  SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
+  const LArOnOffIdMapping* cabling=(*cablingHdl);
+
+  const LArOnlineID_Base* larOnlineID;
+  if (m_isSC) {
+    const LArOnline_SuperCellID* ll;
+    ATH_CHECK(detStore()->retrieve(ll, "LArOnline_SuperCellID"));
+    larOnlineID = ll;
+    ATH_MSG_DEBUG("Found the LArOnlineID helper");
+
+  } else {  // m_isSC
+    const LArOnlineID* ll;
+    ATH_CHECK(detStore()->retrieve(ll, "LArOnlineID"));
+    larOnlineID = ll;
+    ATH_MSG_DEBUG(" Found the LArOnlineID helper. ");
+  }
+
+  const CaloCell_Base_ID* caloId;
+  if (m_isSC) {
+    const CaloCell_SuperCell_ID* cs;
+    ATH_CHECK(detStore()->retrieve(cs, "CaloCell_SuperCell_ID"));
+    caloId = cs;
+  } else {  // m_isSC
+    const CaloCell_ID* cc;
+    ATH_CHECK(detStore()->retrieve(cc, "CaloCell_ID"));
+    caloId = cc;
+  }
+
+  unsigned nConnected = 0;
+  std::array<unsigned,2> nEMECIW{0,0};
+  std::array<unsigned,2> nEMECOW{0,0};
+  std::array<unsigned,2> nBarrel{0,0}; 
+  std::array<unsigned,2> nHEC{0,0};
+  std::array<unsigned,2> nFCAL{0,0};
+
+
+
+  for ( const HWIdentifier chid : larOnlineID->channel_range()) {
+    if (!cabling->isOnlineConnected(chid)) continue;
+    ++nConnected;
+    const Identifier id=cabling->cnvToIdentifier(chid);
+    if (!id.is_valid()) {
+      ATH_MSG_ERROR("Invalid offline id for online id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " <<  larOnlineID->channel_name(chid));
+    }
+    else {
+      std::string subdet="Unkown";
+      int posneg=larOnlineID->pos_neg(chid);
+      if (caloId->is_em_barrel(id)) {subdet="Barrel"; ++nBarrel[posneg];}
+      if (caloId->is_em_endcap_inner(id)) {subdet="EMECIW"; ++nEMECIW[posneg];}
+      if (caloId->is_em_endcap_outer(id)) {subdet="EMECOW"; ++nEMECOW[posneg];}
+      if (caloId->is_hec(id)) {subdet="HEC"; ++nHEC[posneg];}
+      if (caloId->is_fcal(id)) {subdet="FCAL"; ++nFCAL[posneg];}
+
+      ATH_MSG_DEBUG("Channel 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
+                                                  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec <<  "   " << subdet);
+      if (larOnlineID->isEMBchannel(chid) != caloId->is_em_barrel(id)) {
+        ATH_MSG_ERROR("isEMB mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
+                                                  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
+                                                  << larOnlineID->isEMBchannel(chid) << " / ofl " << caloId->is_em_barrel(id));
+      }
+      if (larOnlineID->isEMECIW(chid) != caloId->is_em_endcap_inner(id)) {
+        ATH_MSG_ERROR("isEMECIW mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
+                                                     << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
+                                                     << larOnlineID->isEMECIW(chid) << " / ofl " << caloId->is_em_endcap_inner(id));
+      }
+      if (larOnlineID->isEMECOW(chid) != caloId->is_em_endcap_outer(id)) {
+        ATH_MSG_ERROR("isEMECOW mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
+                                                     << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
+                                                     << larOnlineID->isEMECOW(chid) << " / ofl " << caloId->is_em_endcap_outer(id));
+      }
+      if (larOnlineID->isHECchannel(chid) != caloId->is_hec(id)) {
+        ATH_MSG_ERROR("isHEC mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
+                                                  << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
+                                                  << larOnlineID->isHECchannel(chid) << " / ofl " << caloId->is_hec(id));
+      }
+      if (larOnlineID->isFCALchannel(chid) != caloId->is_fcal(id)) {
+        ATH_MSG_ERROR("isFCAL mismatch online Id 0x" << std::hex << chid.get_identifier32().get_compact() << std::dec << " " << larOnlineID->channel_name(chid)
+                                                   << " offline id 0x" << std::hex << id.get_identifier32().get_compact() << std::dec << " onl "
+                                                   << larOnlineID->isFCALchannel(chid) << "/ ofl" << caloId->is_fcal(id));
+      }
+
+    
+    }//end if connected
+  } //end loop over online identifiers
+
+  if (m_isSC) {
+    ATH_MSG_INFO("checked " << nConnected << " super-cell channels.");
+  } else {
+    ATH_MSG_INFO("checked " << nConnected << " regular channels.");
+  }
+  ATH_MSG_INFO("Number of channels A/C side:");
+  ATH_MSG_INFO("Barrel " << nBarrel[0] << "/" << nBarrel[1]);
+  if ( nBarrel[0] != nBarrel[1]) ATH_MSG_ERROR("MISMATCH!");
+  ATH_MSG_INFO("EMECOW " << nEMECIW[0] << "/" << nEMECIW[1]);
+  if (nEMECIW[0]!=nEMECIW[1]) ATH_MSG_ERROR("MISMATCH!");
+  ATH_MSG_INFO("EMECIW " << nEMECOW[0] << "/" << nEMECOW[1]);
+  if (nEMECOW[0]!=nEMECOW[1]) ATH_MSG_ERROR("MISMATCH!");
+  ATH_MSG_INFO("HEC " << nHEC[0] << "/" << nHEC[1]);
+  if (nHEC[0]!=nHEC[1]) ATH_MSG_ERROR("MISMATCH!");
+  ATH_MSG_INFO("FCAL " << nFCAL[0] << "/" << nFCAL[1]);
+  if (nFCAL[0]!=nFCAL[1]) ATH_MSG_ERROR("MISMATCH!");
+  return StatusCode::SUCCESS;
+}
diff --git a/LArCalorimeter/LArCabling/src/LArIdCablingTest.h b/LArCalorimeter/LArCabling/src/LArIdCablingTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3b5e9d6fe433156bb9b13c8f92cdc0d6746b11c
--- /dev/null
+++ b/LArCalorimeter/LArCabling/src/LArIdCablingTest.h
@@ -0,0 +1,32 @@
+//Dear emacs, this is -*-c++-*-
+/*
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#ifndef LARIDCABLINGTEST_H
+#define LARIDCABLINGTEST_H
+
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/ReadCondHandleKey.h"
+#include "LArCabling/LArOnOffIdMapping.h"
+
+class LArIdCablingTest : public AthAlgorithm 
+{
+public:
+
+  using AthAlgorithm::AthAlgorithm;
+  
+  ~LArIdCablingTest();
+
+  virtual StatusCode initialize() final;
+  virtual StatusCode execute() final;
+
+private:
+  SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap"};
+
+  Gaudi::Property<bool>m_isSC{this,"isSC",false};
+
+};
+
+#endif
diff --git a/LArCalorimeter/LArCabling/src/components/LArCabling_entries.cxx b/LArCalorimeter/LArCabling/src/components/LArCabling_entries.cxx
index 47380b3beee8331ebdb761ec09104f50e5bfefec..44808acd943b72114f2520b1733e3bd03ecd322b 100644
--- a/LArCalorimeter/LArCabling/src/components/LArCabling_entries.cxx
+++ b/LArCalorimeter/LArCabling/src/components/LArCabling_entries.cxx
@@ -1,4 +1,5 @@
 #include "LArCabling/LArHVCablingSimTool.h"
-
+#include "../LArIdCablingTest.h"
 
 DECLARE_COMPONENT( LArHVCablingSimTool )
+DECLARE_COMPONENT( LArIdCablingTest )
\ No newline at end of file
diff --git a/LArCalorimeter/LArG4/LArG4Barrel/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4Barrel/CMakeLists.txt
index 2e4bbd5d9d7e583913bd568579725cff5baa616d..52c8f12834bc857383ea93b2bcc74b9250705acf 100644
--- a/LArCalorimeter/LArG4/LArG4Barrel/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4Barrel/CMakeLists.txt
@@ -19,5 +19,6 @@ atlas_add_library( LArG4Barrel
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} LArG4Code CaloG4SimLib StoreGateLib
                    PRIVATE_LINK_LIBRARIES AthenaKernel GaudiKernel LArG4RunControl LArHV PathResolver )
+set_target_properties( LArG4Barrel PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_install_python_modules( python/*.py )
diff --git a/LArCalorimeter/LArG4/LArG4Code/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4Code/CMakeLists.txt
index c175f03db78dc95ee3af554fd6d77f7a30e3fcf0..4e3d772a88d3ada962711c4d9a02b15c8ff956e9 100644
--- a/LArCalorimeter/LArG4/LArG4Code/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4Code/CMakeLists.txt
@@ -23,6 +23,7 @@ atlas_add_library( LArG4Code
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasDetDescr CaloSimEvent LArGeoCode LArSimEvent CaloG4SimLib G4AtlasToolsLib StoreGateLib GaudiKernel
                    PRIVATE_LINK_LIBRARIES CaloIdentifier AthenaKernel CxxUtils MCTruth )
+set_target_properties( LArG4Code PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_dictionary( LArG4CodeEnums
                       LArG4Code/LArG4EnumDefs.h
diff --git a/LArCalorimeter/LArG4/LArG4EC/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4EC/CMakeLists.txt
index e526a8976a3555e73474de3a25699dd49cd03e06..9437549a1c4d5a1b30e33740a78bc0ba54c7a714 100644
--- a/LArCalorimeter/LArG4/LArG4EC/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4EC/CMakeLists.txt
@@ -21,5 +21,6 @@ atlas_add_library( LArG4EC
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} GeoSpecialShapes LArG4Code LArGeoCode CaloG4SimLib StoreGateLib
                    ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} GeoModelUtilities GaudiKernel LArG4RunControl LArHV PathResolver GeoModelInterfaces RDBAccessSvcLib )
+set_target_properties( LArG4EC PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_install_python_modules( python/*.py )
diff --git a/LArCalorimeter/LArG4/LArG4FCAL/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FCAL/CMakeLists.txt
index 0ed14ec13949b4a985bec3d81f16a91f36fe19b0..e25257af063841b41cd7c6fe2120880a4ea9b5a6 100644
--- a/LArCalorimeter/LArG4/LArG4FCAL/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4FCAL/CMakeLists.txt
@@ -14,5 +14,6 @@ atlas_add_library( LArG4FCAL
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} AthenaKernel CaloG4SimLib GaudiKernel GeoModelInterfaces LArG4Code LArHV LArReadoutGeometry PathResolver RDBAccessSvcLib StoreGateLib )
+set_target_properties( LArG4FCAL PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt
index b1dae0aac097137d5af32274de85774e923c2539..75c4bfae5539e883f12a8b41ad392c07d8bf6ca4 100644
--- a/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt
@@ -15,3 +15,4 @@ atlas_add_library( LArG4FastSimSvc
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel )
+set_target_properties( LArG4FastSimSvc PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt
index 6745ea648385023170f4723045a198e3ac21a43d..11056af7c887cbb91137f278fa988f7780bc1779 100644
--- a/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt
@@ -16,6 +16,7 @@ atlas_add_library( LArG4FastSimulation
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEOMODEL_LIBRARIES} GaudiKernel StoreGateLib GeoSpecialShapes LArG4Code LArReadoutGeometry LArSimEvent G4AtlasToolsLib GeoPrimitives LArG4ShowerLibSvcLib RDBAccessSvcLib GeoModelInterfaces GeoModelUtilities)
+set_target_properties( LArG4FastSimulation PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
index 9add4a0a06f74aed8a344ee5b17f01be1cab32a7..d4fc43d47ff420e7aed619cb1a6c01e2ab606f9c 100644
--- a/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
@@ -20,6 +20,7 @@ atlas_add_library( LArG4GenShowerLibLib
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES AthenaBaseComps AthContainers AtlasHepMCLib GaudiKernel G4AtlasToolsLib LArG4Code
                    PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} GeneratorObjects GeoModelInterfaces LArG4ShowerLib )
+set_target_properties( LArG4GenShowerLibLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( LArG4GenShowerLib
                    src/components/*.cxx
@@ -27,6 +28,7 @@ atlas_add_library( LArG4GenShowerLib
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES LArG4GenShowerLibLib )
+set_target_properties( LArG4GenShowerLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_dictionary( LArG4GenShowerLibDict
                       LArG4GenShowerLib/LArG4GenShowerLibDict.h
diff --git a/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
index 3004ca9ed017cc71901dbf3cf2252a3a47951cd8..bdcc104b82859a3ec0244ecf7e4da7f3bba4766b 100644
--- a/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
@@ -21,4 +21,5 @@ atlas_add_library( LArG4H6SD
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}  ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} GaudiKernel CaloG4SimLib CaloSimEvent AthenaBaseComps AthenaKernel StoreGateLib GeoModelUtilities Identifier GeneratorObjects LArG4Code LArG4RunControl LArG4TBSimEvent LArReadoutGeometry LArSimEvent G4AtlasInterfaces G4AtlasToolsLib SimHelpers HitManagement MCTruth TBEvent PathResolver GeoModelInterfaces RDBAccessSvcLib )
+set_target_properties( LArG4H6SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
diff --git a/LArCalorimeter/LArG4/LArG4HEC/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4HEC/CMakeLists.txt
index fedd25574f46a3447e6818a15b35cc766520476b..35015ee11f4da32d296aaac887922b1b9c099514 100644
--- a/LArCalorimeter/LArG4/LArG4HEC/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4HEC/CMakeLists.txt
@@ -20,6 +20,7 @@ atlas_add_library( LArG4HEC
                    PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps LArG4Code LArReadoutGeometry CaloG4SimLib GeoModelInterfaces StoreGateLib ${CORAL_LIBRARIES} AthenaKernel GaudiKernel LArG4RunControl LArHV RDBAccessSvcLib )
+set_target_properties( LArG4HEC PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 
 atlas_install_python_modules( python/*.py )
diff --git a/LArCalorimeter/LArG4/LArG4SD/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4SD/CMakeLists.txt
index 2ee6e6f1e885306f9f485490041b2549fa797677..503cd8e2768295e2d5f838d4ae84df61cee0760c 100644
--- a/LArCalorimeter/LArG4/LArG4SD/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4SD/CMakeLists.txt
@@ -19,6 +19,7 @@ atlas_add_library( LArG4SD
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CaloG4SimLib GaudiKernel LArG4Code )
+set_target_properties( LArG4SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_test( LArG4SDToolConfig_test
                 SCRIPT test/LArG4SDToolConfig_test.py
diff --git a/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt
index 5c67f3f62b695e44f2004fc48922c614595ace1e..20056b896b54d4a00280eab830c15e51d7a618fe 100644
--- a/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt
@@ -20,4 +20,5 @@ atlas_add_library( LArG4ShowerLib
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES AthContainers LArG4Code AtlasHepMCLib
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} )
+set_target_properties( LArG4ShowerLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
diff --git a/LArCalorimeter/LArG4/LArG4ShowerLibSvc/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4ShowerLibSvc/CMakeLists.txt
index aa46b55a483313acc00b533f0ecf72fe2c6d9fce..21e927a2c0cb56cb027b35fd6c481ee74e0cb957 100644
--- a/LArCalorimeter/LArG4/LArG4ShowerLibSvc/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4ShowerLibSvc/CMakeLists.txt
@@ -12,6 +12,7 @@ atlas_add_library( LArG4ShowerLibSvcLib
                    INTERFACE
                    PUBLIC_HEADERS LArG4ShowerLibSvc
                    LINK_LIBRARIES GaudiKernel LArG4Code AthenaBaseComps )
+set_target_properties( LArG4ShowerLibSvcLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Component(s) in the package:
 atlas_add_library( LArG4ShowerLibSvc
@@ -21,3 +22,4 @@ atlas_add_library( LArG4ShowerLibSvc
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEANT4_LIBRARIES} LArG4ShowerLibSvcLib AthenaKernel LArG4ShowerLib PathResolver )
+set_target_properties( LArG4ShowerLibSvc PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/MagneticField/MagFieldUtils/CMakeLists.txt b/MagneticField/MagFieldUtils/CMakeLists.txt
index 5e0b823313de092b690a52ea3fbf5bd3ce99485c..d7d9b470c3488c4cc0b54041bba7d2a63df0ed33 100644
--- a/MagneticField/MagFieldUtils/CMakeLists.txt
+++ b/MagneticField/MagFieldUtils/CMakeLists.txt
@@ -16,3 +16,4 @@ atlas_add_library( MagFieldUtils
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel MagFieldConditions MagFieldInterfaces StoreGateLib )
+set_target_properties( MagFieldUtils PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonStationTypeBuilder.cxx b/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonStationTypeBuilder.cxx
index 9957f1493f4a74163c5c67299647d658060d2b2d..169bf04c4285dbe0fa67952e3e14e6a16ae2cf8f 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonStationTypeBuilder.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonStationTypeBuilder.cxx
@@ -2473,8 +2473,11 @@ void Muon::MuonStationTypeBuilder::printVolumeBounds(std::string comment, const
 
     const Trk::SimplePolygonBrepVolumeBounds* spb =
         dynamic_cast<const Trk::SimplePolygonBrepVolumeBounds*>(&volBounds);
-    ATH_MSG_DEBUG("SimplePolygonBrep bounds: number of vertices:"
-                  << spb->xyVertices().size());
+    if (spb){
+      ATH_MSG_DEBUG("SimplePolygonBrep bounds: number of vertices:"
+		    << spb->xyVertices().size());
+      return;
+    }
 }
 
 double Muon::MuonStationTypeBuilder::envelopeThickness(const Trk::VolumeBounds& volBounds) const {
diff --git a/MuonSpectrometer/MuonG4/MuonG4SD/CMakeLists.txt b/MuonSpectrometer/MuonG4/MuonG4SD/CMakeLists.txt
index 184834a7e774f7b7e4a5a234256e3cfbad3332d1..180e9772895e15fac0c1f3660bbbf3f1cc2be97d 100644
--- a/MuonSpectrometer/MuonG4/MuonG4SD/CMakeLists.txt
+++ b/MuonSpectrometer/MuonG4/MuonG4SD/CMakeLists.txt
@@ -17,6 +17,7 @@ atlas_add_library( MuonG4SDLib
                    NO_PUBLIC_HEADERS MuonG4SD
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib GeoPrimitives GaudiKernel MuonSimEvent G4AtlasToolsLib MCTruth MuonIdHelpersLib)
+set_target_properties( MuonG4SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Component(s) in the package:
 atlas_add_library( MuonG4SD
@@ -25,6 +26,7 @@ atlas_add_library( MuonG4SD
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} MuonG4SDLib StoreGateLib GeoPrimitives GaudiKernel MuonSimEvent G4AtlasToolsLib MCTruth )
+set_target_properties( MuonG4SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Helper function setting up the tests in the package:
 function( _add_test name )
diff --git a/Simulation/AtlasGeant4/CMakeLists.txt b/Simulation/AtlasGeant4/CMakeLists.txt
index 37ee2c43cd421f739dc449ee9488ff2f4290e673..4aa34097ee4fea42b3b801058ddc14d4c997cdd9 100644
--- a/Simulation/AtlasGeant4/CMakeLists.txt
+++ b/Simulation/AtlasGeant4/CMakeLists.txt
@@ -155,9 +155,10 @@ atlas_add_library( AtlasGeant4Lib
                    SHARED
                    NO_PUBLIC_HEADERS
                    LINK_LIBRARIES ${AtlasGeant4_TARGET_OBJECTS} )
-
+set_target_properties( AtlasGeant4Lib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Primary "big" component composed of all library/component OBJECT libs
 atlas_add_component( AtlasGeant4
                      dummy.cc
                      LINK_LIBRARIES "-Wl,--exclude-libs,ALL" ${AtlasGeant4Component_TARGET_OBJECTS} ${AtlasGeant4_TARGET_OBJECTS} )
+set_target_properties( AtlasGeant4 PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt
index c5d385a0eccd71184bece3ddfc6fc9594f4b688a..4268da90cdceb9ed5aeec1b7226320f631d7f496 100644
--- a/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( G4AtlasAlgLib
                      INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
 
                      LINK_LIBRARIES ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel CxxUtils GaudiKernel G4AtlasInterfaces SGTools StoreGateLib EventInfo GeneratorObjects GeoModelInterfaces HepMC_InterfacesLib ISF_InterfacesLib MCTruthBaseLib )
+set_target_properties( G4AtlasAlgLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Component(s) in the package:
 atlas_add_library( G4AtlasAlg
@@ -26,6 +27,7 @@ atlas_add_library( G4AtlasAlg
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel CxxUtils GaudiKernel G4AtlasInterfaces G4AtlasAlgLib SGTools StoreGateLib EventInfo GeneratorObjects MCTruthBaseLib )
+set_target_properties( G4AtlasAlg PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py
diff --git a/Simulation/G4Atlas/G4AtlasInterfaces/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasInterfaces/CMakeLists.txt
index a83257fe233b62a4407e15f32d118c3f43c808fb..7fcd9fab84baa19188de20b4cbc9c8949a49de75 100644
--- a/Simulation/G4Atlas/G4AtlasInterfaces/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasInterfaces/CMakeLists.txt
@@ -17,3 +17,4 @@ atlas_add_library( G4AtlasInterfaces
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel )
 
+set_target_properties( G4AtlasInterfaces PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Atlas/G4AtlasServices/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasServices/CMakeLists.txt
index 9e83e1d7ea0907b657a79a5296c3ababd69f992c..1a9aa3a4cccbc0b5c61abf83bfd23d5a44e4ce8b 100644
--- a/Simulation/G4Atlas/G4AtlasServices/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasServices/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_add_library( G4AtlasServices
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} ${ROOT_LIBRARIES}
 		     GaudiKernel AthenaBaseComps 
 		     G4AtlasInterfaces G4AtlasToolsLib G4PhysicsLists PathResolver MagFieldElements MagFieldInterfaces)
+set_target_properties( G4AtlasServices PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 #test G4AtlasFieldServices
 atlas_add_test( G4AtlasFieldServices_test
diff --git a/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt
index 9872e4aa7372b5b0da0c87bfe463ac654cc7325f..364b5930619ee93dd892cb1ba3d3274766f9c755 100644
--- a/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt
@@ -15,6 +15,7 @@ atlas_add_library( G4AtlasTests
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}  ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} AthenaBaseComps GaudiKernel CaloDetDescrLib CaloIdentifier CaloSimEvent AthenaKernel StoreGateLib GeoAdaptors GeoPrimitives Identifier xAODEventInfo ALFA_SimEv LUCID_SimEvent ZDC_SimEvent ZdcIdentifier GeneratorObjects InDetSimEvent LArSimEvent MuonReadoutGeometry MuonIdHelpersLib MuonSimEvent McParticleEvent G4AtlasToolsLib MCTruth HitManagement TileDetDescr TileIdentifier TileSimEvent TrackRecordLib )
+set_target_properties( G4AtlasTests PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt
index 0ad896b599e611293aca1c3c975b43cbf15389b8..3c392c7bab8ba100f162c8bba41758ef70319d2d 100644
--- a/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt
@@ -22,12 +22,15 @@ atlas_add_library( G4AtlasToolsLib
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${TBB_LIBRARIES} AthenaBaseComps G4AtlasInterfaces SubDetectorEnvelopesLib
                    PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} CxxUtils GaudiKernel )
+set_target_properties( G4AtlasToolsLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
+
 
 atlas_add_library( G4AtlasTools
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES G4AtlasToolsLib)
+set_target_properties( G4AtlasTools PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 #testing just the simulation parts, no forward detectors or region
 atlas_add_test( G4GeometryToolConfig_Simtest
diff --git a/Simulation/G4Extensions/Charginos/CMakeLists.txt b/Simulation/G4Extensions/Charginos/CMakeLists.txt
index 757c12bfa6fb1770416687780070c4bfac782d15..6d1a2339b057fdb5f886b896a377e9bea5ea261e 100644
--- a/Simulation/G4Extensions/Charginos/CMakeLists.txt
+++ b/Simulation/G4Extensions/Charginos/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( Charginos
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps G4AtlasInterfaces CxxUtils)
+set_target_properties( Charginos PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Extensions/ExtraParticles/CMakeLists.txt b/Simulation/G4Extensions/ExtraParticles/CMakeLists.txt
index 4b3512703a2a1195c33a6f79acbc2cb8236790aa..80e7717ea040d7fed5d4f79abf77f5d72b90c024 100644
--- a/Simulation/G4Extensions/ExtraParticles/CMakeLists.txt
+++ b/Simulation/G4Extensions/ExtraParticles/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( ExtraParticles
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps G4AtlasInterfaces )
+set_target_properties( ExtraParticles PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt b/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt
index 02efc14bafc21f9c029f19ee42bec47c8e6a2ed4..b4e41db4b200ebd826b30a3901124abb279a7da5 100644
--- a/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( G4CosmicFilter
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib GaudiKernel G4AtlasInterfaces G4AtlasToolsLib MCTruth TrackRecordLib )
+set_target_properties( G4CosmicFilter PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt b/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt
index ee19750341133771c69185271519bae2601ea920..a9974e8abccc092ddb75acaa90ceaf768b453831 100644
--- a/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt
@@ -26,3 +26,4 @@ atlas_add_library( G4ExternalDecay
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${PYTHIA8_LIBRARIES} ${LHAPDF_LIBRARIES} ${GEANT4_LIBRARIES} Pythia8_iLib ${extra_libs}
                    PRIVATE_LINK_LIBRARIES AtlasHepMCLib )
+set_target_properties( G4ExternalDecay PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Extensions/G4ExtraProcesses/CMakeLists.txt b/Simulation/G4Extensions/G4ExtraProcesses/CMakeLists.txt
index 486955cdb9e98d1b613183c211a76e033879a9a0..f947de29bfe45cfcfa9380e0f203d07a95c6174d 100644
--- a/Simulation/G4Extensions/G4ExtraProcesses/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4ExtraProcesses/CMakeLists.txt
@@ -16,6 +16,7 @@ atlas_add_library( G4ExtraProcesses
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} GaudiKernel AthenaBaseComps G4AtlasInterfaces )
+set_target_properties( G4ExtraProcesses PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Extensions/G4HitFilter/CMakeLists.txt b/Simulation/G4Extensions/G4HitFilter/CMakeLists.txt
index f57b80af9a69586e68db420c532228c2b5e58f69..74a4ef4d5f93e9297b4f89db38ea7b2b27cc98b9 100644
--- a/Simulation/G4Extensions/G4HitFilter/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4HitFilter/CMakeLists.txt
@@ -18,3 +18,4 @@ atlas_add_library( G4HitFilter
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel CaloSimEvent AthenaBaseComps StoreGateLib LUCID_SimEvent InDetSimEvent LArSimEvent MuonSimEvent G4AtlasInterfaces G4AtlasToolsLib TileSimEvent )
+set_target_properties( G4HitFilter PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Extensions/G4ScoringProcess/CMakeLists.txt b/Simulation/G4Extensions/G4ScoringProcess/CMakeLists.txt
index 8cc274167a907eac05556bd960636c94f8bcd090..08d4383442c98ad68da4f4164e18ed7cae5fc3a2 100644
--- a/Simulation/G4Extensions/G4ScoringProcess/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4ScoringProcess/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( G4ScoringProcess
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps G4AtlasInterfaces )
+set_target_properties( G4ScoringProcess PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Extensions/Gauginos/CMakeLists.txt b/Simulation/G4Extensions/Gauginos/CMakeLists.txt
index 8b8248e3cbcc7eb082af9b5889b171f1772f9d34..8a30ccf720b86266d5fcb697103e460306deda54 100644
--- a/Simulation/G4Extensions/Gauginos/CMakeLists.txt
+++ b/Simulation/G4Extensions/Gauginos/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( Gauginos
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel G4AtlasInterfaces CxxUtils )
+set_target_properties( Gauginos PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Extensions/Monopole/CMakeLists.txt b/Simulation/G4Extensions/Monopole/CMakeLists.txt
index d079e817c6785d7acb488fe961ce6cab75ad45c4..6f72ffbb795b794e64464c32efca5281e2e6035f 100644
--- a/Simulation/G4Extensions/Monopole/CMakeLists.txt
+++ b/Simulation/G4Extensions/Monopole/CMakeLists.txt
@@ -15,6 +15,7 @@ atlas_add_library( Monopole
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps CxxUtils G4AtlasInterfaces )
+set_target_properties( Monopole PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Extensions/Quirks/CMakeLists.txt b/Simulation/G4Extensions/Quirks/CMakeLists.txt
index 6cfc53e828ad389365cada5f384a3ca32f32566d..6f37e251ab95c9a1fc8d9d9cd55efa48058423aa 100644
--- a/Simulation/G4Extensions/Quirks/CMakeLists.txt
+++ b/Simulation/G4Extensions/Quirks/CMakeLists.txt
@@ -16,6 +16,7 @@ atlas_add_library( Quirks
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils GaudiKernel AthenaBaseComps G4AtlasInterfaces G4AtlasToolsLib )
+set_target_properties( Quirks PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Extensions/RHadrons/CMakeLists.txt b/Simulation/G4Extensions/RHadrons/CMakeLists.txt
index 20cfe5df3f96814704c8cea8081a326df505131a..426231dee5b52494e5fb10f929780d896c85dead 100644
--- a/Simulation/G4Extensions/RHadrons/CMakeLists.txt
+++ b/Simulation/G4Extensions/RHadrons/CMakeLists.txt
@@ -17,6 +17,7 @@ if( NOT GENERATIONBASE )
                        NO_PUBLIC_HEADERS
                        PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                        PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps CxxUtils G4AtlasInterfaces G4AtlasToolsLib G4ExternalDecay SimHelpers TruthUtils)
+    set_target_properties( RHadrons PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 endif()
 
 # Install files from the package:
diff --git a/Simulation/G4Extensions/Sleptons/CMakeLists.txt b/Simulation/G4Extensions/Sleptons/CMakeLists.txt
index 27b2b48bdfc9c927c26746484e1e3179fa6fdfc7..223d14ef4884b99466fcd1ec8a004b9abc563a7c 100644
--- a/Simulation/G4Extensions/Sleptons/CMakeLists.txt
+++ b/Simulation/G4Extensions/Sleptons/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( Sleptons
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps G4AtlasInterfaces CxxUtils )
+set_target_properties( Sleptons PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Sim/G4HiveEx/CMakeLists.txt b/Simulation/G4Sim/G4HiveEx/CMakeLists.txt
index bdd89ec17de503d3ee4b79184040cfa86ea68d66..20e8cb3354491a47c3407c79c306f93d60d9ccd1 100644
--- a/Simulation/G4Sim/G4HiveEx/CMakeLists.txt
+++ b/Simulation/G4Sim/G4HiveEx/CMakeLists.txt
@@ -15,3 +15,4 @@ atlas_add_library( G4HiveEx
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel AthenaBaseComps CxxUtils GeneratorObjects )
+set_target_properties( G4HiveEx PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Sim/MCTruth/CMakeLists.txt b/Simulation/G4Sim/MCTruth/CMakeLists.txt
index bc80ad0670746bcc980b3c67d81cb90ba9c80bcf..3585d2984d148715558cff6558fc87a13cc4fb33 100644
--- a/Simulation/G4Sim/MCTruth/CMakeLists.txt
+++ b/Simulation/G4Sim/MCTruth/CMakeLists.txt
@@ -19,3 +19,4 @@ atlas_add_library( MCTruth
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib TruthUtils AthenaKernel GeneratorObjects
                    PRIVATE_LINK_LIBRARIES ISF_Event SimHelpers )
+set_target_properties( MCTruth PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt
index 34943ed4bd794267acd6f0d5408db9fe961a539e..11b4f77974434550605aad168d7ac225fc40557c 100644
--- a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt
+++ b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt
@@ -20,12 +20,14 @@ atlas_add_library( MCTruthBaseLib
                    G4AtlasInterfaces MCTruth SimHelpers ISF_InterfacesLib
                    AtlasDetDescr ISF_Geant4Event TruthUtils
                  )
+set_target_properties( MCTruthBaseLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library(MCTruthBase
                   src/components/*.cxx
                   OBJECT
                   NO_PUBLIC_HEADERS
                   PRIVATE_LINK_LIBRARIES MCTruthBaseLib)
+set_target_properties( MCTruthBase PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Sim/SimHelpers/CMakeLists.txt b/Simulation/G4Sim/SimHelpers/CMakeLists.txt
index b1bf5620e6a9448857f0a24e85da543b1d542d64..edda86dcd52c49e492be4e578e2d22d74d044f44 100644
--- a/Simulation/G4Sim/SimHelpers/CMakeLists.txt
+++ b/Simulation/G4Sim/SimHelpers/CMakeLists.txt
@@ -19,3 +19,4 @@ atlas_add_library( SimHelpers
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel StoreGateLib )
 
+set_target_properties( SimHelpers PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt b/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
index bbfa7299072374bcd83899a132ea40d92a76f240..970d68b4cdf4808b5d8cae5095c3012a38afc0e5 100644
--- a/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( G4DebuggingHelperLib
                    PUBLIC_HEADERS G4DebuggingTools
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} )
+set_target_properties( G4DebuggingHelperLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( G4DebuggingTools
                    src/*.cxx
@@ -28,6 +29,7 @@ atlas_add_library( G4DebuggingTools
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} 
                                           GaudiKernel AthenaBaseComps StoreGateLib xAODEventInfo G4AtlasInterfaces GeoPrimitives
                                           G4AtlasToolsLib MCTruth MCTruthBaseLib SimHelpers G4DebuggingHelperLib )
+set_target_properties( G4DebuggingTools PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Utilities/G4PhysicsLists/CMakeLists.txt b/Simulation/G4Utilities/G4PhysicsLists/CMakeLists.txt
index 3b27aac15cdd3c60f9d16cef0ee280925cb9eb64..d549dd7a8fbacd255d27140aeceaec8c8e70afe8 100644
--- a/Simulation/G4Utilities/G4PhysicsLists/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4PhysicsLists/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_add_library( G4PhysicsLists
   ${CMAKE_CURRENT_SOURCE_DIR}/src/hadronicVariations
   LINK_LIBRARIES ${GEANT4_LIBRARIES}
   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} GaudiKernel )
+set_target_properties( G4PhysicsLists PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_runtime( share/biasValues.txt )
diff --git a/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt b/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt
index 689c434ab3aea8c4fa7726ccb44565b156452330..e74f99275d5c6b52211eb40f98d2916b4f44b366 100644
--- a/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt
@@ -15,9 +15,11 @@ atlas_add_library( G4ProfilingToolsLib
                    LINK_LIBRARIES G4AtlasToolsLib
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEANT4_LIBRARIES} AthenaBaseComps GaudiKernel G4AtlasToolsLib )
+set_target_properties( G4ProfilingToolsLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( G4ProfilingTools
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES G4ProfilingToolsLib )
+set_target_properties( G4ProfilingTools PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Utilities/G4StepLimitation/CMakeLists.txt b/Simulation/G4Utilities/G4StepLimitation/CMakeLists.txt
index 5f5888f85609b30eacf4578dc05789a13b382ec2..f5a29234ffce0bd45b9e33b2cf198e3771937fa2 100644
--- a/Simulation/G4Utilities/G4StepLimitation/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4StepLimitation/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( G4StepLimitation
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps G4AtlasInterfaces )
+set_target_properties( G4StepLimitation PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Utilities/G4UserActions/CMakeLists.txt b/Simulation/G4Utilities/G4UserActions/CMakeLists.txt
index 831a0d028085fe21a3ac140277426d67cbec4872..198f614866267fb24ba79c1a36ea8824c034bdf2 100644
--- a/Simulation/G4Utilities/G4UserActions/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4UserActions/CMakeLists.txt
@@ -20,6 +20,7 @@ atlas_add_library( G4UserActions
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib GaudiKernel G4AtlasInterfaces G4AtlasToolsLib EventInfo InDetSimEvent MuonSimEvent MCTruth MCTruthBaseLib SimHelpers TrackWriteFastSimLib PathResolver G4DebuggingHelperLib)
+set_target_properties( G4UserActions PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Utilities/Geo2G4/CMakeLists.txt b/Simulation/G4Utilities/Geo2G4/CMakeLists.txt
index 69d4900922d409fcbdadb3299e598426ee424f50..b3b21d94e97dd87a1580acb3f2ce7ffc1c59839a 100644
--- a/Simulation/G4Utilities/Geo2G4/CMakeLists.txt
+++ b/Simulation/G4Utilities/Geo2G4/CMakeLists.txt
@@ -20,12 +20,14 @@ atlas_add_library( Geo2G4Lib
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GEOMODEL_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel G4AtlasInterfaces G4AtlasToolsLib GeoModelUtilities GeoPrimitives
                    PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils GeoSpecialShapes SimHelpers GeoMaterial2G4 AthenaKernel GeoModelInterfaces StoreGateLib )
+set_target_properties( Geo2G4Lib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( Geo2G4
                    src/components/*.cxx
                    OBJECT
                    NO_PUBLIC_HEADERS
                    PRIVATE_LINK_LIBRARIES Geo2G4Lib ) 
+set_target_properties( Geo2G4 PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt b/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt
index c2d9c8fd892fa24e8f64a866f4c57fcc16b8b4a3..7ca779f25071f0f3839f6f707bbdbd3f0cfa1b30 100644
--- a/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt
+++ b/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt
@@ -15,3 +15,4 @@ atlas_add_library( GeoMaterial2G4
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaBaseComps
                    PRIVATE_LINK_LIBRARIES CxxUtils GeoModelUtilities )
+set_target_properties( GeoMaterial2G4 PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt b/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt
index 506efb8a5d62ce74d2f31b7f20d1a7fc2c989c60..971454dded48da42f4cf276120346b1330b83a54 100644
--- a/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt
+++ b/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt
@@ -20,12 +20,14 @@ atlas_add_library( TrackWriteFastSimLib
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} StoreGateLib G4AtlasToolsLib TrackRecordLib
                    PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} GaudiKernel G4AtlasInterfaces MCTruth )
+set_target_properties( TrackWriteFastSimLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library(TrackWriteFastSim
                   src/components/*.cxx
                   OBJECT
                   NO_PUBLIC_HEADERS
                   PRIVATE_LINK_LIBRARIES TrackWriteFastSimLib )
+set_target_properties( TrackWriteFastSim PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt
index 0f7585e3b377bf27483c3415ff87529b40148fba..fe3fa661fa801be2b5411646c229bd35c2bc5d16 100644
--- a/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt
@@ -24,6 +24,7 @@ atlas_add_library( ISF_Services
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS}  ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEANT4_LIBRARIES} AtlasHepMCLib ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} GaudiKernel BarcodeInterfacesLib CaloIdentifier CaloSimEvent AthenaBaseComps StoreGateLib SubDetectorEnvelopesLib AtlasDetDescr GeneratorObjects InDetSimEvent MuonSimEvent G4AtlasInterfaces MCTruth SimHelpers ISF_Event ISF_HepMC_Interfaces ISF_InterfacesLib TileSimEvent PmbCxxUtils TruthUtils )
+set_target_properties( ISF_Services PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Tests in the package:
 atlas_add_test( InputConverter_test
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
index 1d053da0ff249c5a171cc189212958e09c52a158..0c60fc6d39743d2046cd3a4cd888b2683580c1f9 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
@@ -33,6 +33,7 @@ atlas_add_library( ISF_FastCaloSimParametrizationLib
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel AtlasHepMCLib BarcodeEventLib CaloDetDescrLib CaloInterfaceLib CxxUtils GaudiKernel ISF_FastCaloSimEvent ISF_InterfacesLib LArElecCalib LArReadoutGeometry StoreGateLib TrkEventPrimitives TrkExInterfaces TrkParameters
                    PRIVATE_LINK_LIBRARIES CaloGeoHelpers xAODCaloEvent G4AtlasToolsLib MCTruth)
+set_target_properties( ISF_FastCaloSimParametrizationLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( ISF_FastCaloSimParametrization
                    src/*.cxx
@@ -41,6 +42,7 @@ atlas_add_library( ISF_FastCaloSimParametrization
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaPoolUtilities AtlasHepMCLib CaloDetDescrLib CaloEvent CaloGeoHelpers CaloIdentifier CaloDetDescrUtils CxxUtils GaudiKernel GeneratorObjects GeoModelInterfaces GeoPrimitives ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces ISF_FastCaloSimParametrizationLib ISF_InterfacesLib LArSimEvent NavFourMom StoreGateLib TileConditionsLib TileDetDescr TileSimEvent TrackRecordLib TrkExInterfaces TrkGeometry TrkMaterialOnTrack TrkParameters TrkSurfaces xAODCaloEvent G4AtlasToolsLib MCTruth)
+set_target_properties( ISF_FastCaloSimParametrization PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Code in this file makes heavy use of eigen and runs orders of magnitude
 # more slowly without optimization.  So force this to be optimized even
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/CMakeLists.txt
index 8309abddd495b31bd011445bdf85afc221fb25e5..0fb9a6448617be0b077f96eab08ea894c61b6156 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/CMakeLists.txt
@@ -19,6 +19,7 @@ atlas_add_library( ISF_FastCaloSimSD
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib GaudiKernel G4AtlasInterfaces G4AtlasToolsLib CaloDetDescrLib CaloIdentifier GeneratorObjects LArG4Code ISF_FastCaloSimEvent Identifier TileG4InterfacesLib )
+set_target_properties( ISF_FastCaloSimSD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt
index ae5299b990183a930c2963e39dedba5f8608b54d..3027265ed91266fc1000c17f3c125d3d431a43ff 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt
@@ -30,6 +30,7 @@ atlas_add_library( ISF_FastCaloSimServices
   GeneratorObjects ISF_Event ISF_FastCaloSimEvent
   ISF_FastCaloSimInterfaces ISF_FastCaloSimParametrizationLib PathResolver
   ${_linkLibraries} )
+set_target_properties( ISF_FastCaloSimServices PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt
index b14d9198227ede322fe429cd23d53982afac94c0..cbf7c12ef386d74ae6804a24434d4901e7a6f42b 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt
@@ -16,3 +16,4 @@ atlas_add_library( ISF_FatrasToolsG4
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}  ${GEANT4_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES}  ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} AthenaBaseComps AthenaKernel BarcodeEventLib CxxUtils GaudiKernel ISF_Event ISF_FatrasInterfaces TrkEventPrimitives StoreGateLib ISF_InterfacesLib ISF_Geant4ToolsLib TrkGeometry TruthUtils )
+set_target_properties( ISF_FatrasToolsG4 PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonServices/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonServices/CMakeLists.txt
index c5f8c9e6a3f2d05418194791a57f3effa62d2cc0..053982734291de944a97f228b83a1153bcbfde4f 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonServices/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonServices/CMakeLists.txt
@@ -18,3 +18,4 @@ atlas_add_library( ISF_Geant4CommonServices
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps AtlasDetDescr ISF_Event ISF_InterfacesLib SubDetectorEnvelopesLib )
+set_target_properties( ISF_Geant4CommonServices PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/CMakeLists.txt
index 75605b721856dfec076b8d0de3f2f7c5c77fd194..65dc22fe4e47ff1b1f101275f3c61e0949bdc228 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/CMakeLists.txt
@@ -12,6 +12,7 @@ atlas_add_library( ISF_Geant4CommonTools
                    src/*.cxx
                    src/components/*.cxx
                    PRIVATE_LINK_LIBRARIES GaudiKernel AthenaBaseComps ISF_Event ISF_InterfacesLib G4AtlasToolsLib )
+set_target_properties( ISF_Geant4CommonTools PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt
index fe762aee538ec1329d90bc2efef816f1a02dbdff..0c9675aff09823dc4d3d81e15624c1b96bed27ca 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt
@@ -25,6 +25,7 @@ atlas_add_library( ISF_Geant4Event
                    ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib
                    ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} ISF_Event
                    ISF_InterfacesLib SimHelpers GeoPrimitives MCTruth TruthUtils )
+set_target_properties( ISF_Geant4Event PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 #atlas_add_test(SOURCES
 #               INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/CMakeLists.txt
index 1a0172662f975d22ad2feb320a2af2950a3c348c..42e8ae21ca25d0cddcc49da0a14899549d509899 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( ISF_Geant4Services
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaBaseComps StoreGateLib G4AtlasInterfaces ISF_Event ISF_InterfacesLib )
+set_target_properties( ISF_Geant4Services PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt
index 9ce216b16fa65ea51132c2b6ebddd4c8d8636c96..20387b78c9e8cf7bffa9162092b770a2e436f7d2 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt
@@ -14,6 +14,7 @@ atlas_add_library( ISF_Geant4ToolsLib
                    INTERFACE
                    PUBLIC_HEADERS ISF_Geant4Tools
                    LINK_LIBRARIES CxxUtils GaudiKernel G4AtlasAlgLib )
+set_target_properties( ISF_Geant4ToolsLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Component(s) in the package:
 atlas_add_library( ISF_Geant4Tools
@@ -23,6 +24,7 @@ atlas_add_library( ISF_Geant4Tools
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} ${TBB_LIBRARIES} AthenaKernel GaudiKernel G4AtlasInterfaces AthenaBaseComps StoreGateLib AtlasDetDescr GeneratorObjects G4AtlasToolsLib G4AtlasAlgLib MCTruth ISF_Event ISF_InterfacesLib ISF_Geant4Event ISF_Geant4ToolsLib )
+set_target_properties( ISF_Geant4Tools PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/SimuJobTransforms/python/G4Optimizations.py b/Simulation/SimuJobTransforms/python/G4Optimizations.py
index e100c0a06ad6188e3f8613a20f6b1dd5a7a0ca66..b2dabcc586470932898624eda7299c6092e8bb79 100644
--- a/Simulation/SimuJobTransforms/python/G4Optimizations.py
+++ b/Simulation/SimuJobTransforms/python/G4Optimizations.py
@@ -32,6 +32,12 @@ def enableG4Optimizations(flags):
     flags.Sim.G4Commands+=["/process/em/UseGeneralProcess true"]
     flags.Sim.OptionalUserActionList += ['G4UserActions.G4UserActionsConfig.FixG4CreatorProcessToolCfg']
 
+    # Energy Loss fluctuation OFF
+    # Switch off the Energy loss fluctuation process
+    # More info: https://its.cern.ch/jira/browse/ATLASSIM-6995
+    flags.Sim.G4Commands+=["/process/eLoss/fluct false"]
+
+
     # Activate the Woodcock Tracking in the EMEC
     # Please note that the Woodcock tracking enables
     # the G4GammaGeneralProcess therefore the FixG4CreatorProcessTool
diff --git a/TestBeam/TBDetDescrCnv/CMakeLists.txt b/TestBeam/TBDetDescrCnv/CMakeLists.txt
index 7898252610097fe9725eec6034a91714c8b457e2..0eaa4fedeadfbded22d394347dcce3bb78be52b1 100644
--- a/TestBeam/TBDetDescrCnv/CMakeLists.txt
+++ b/TestBeam/TBDetDescrCnv/CMakeLists.txt
@@ -14,6 +14,7 @@ atlas_add_library( TBDetDescrCnv
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} DetDescrCnvSvcLib GaudiKernel StoreGateLib GeoPrimitives TBDetDescr AthenaKernel )
+set_target_properties( TBDetDescrCnv PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt
index 5d9c7dc13155a7d44c06869e163a4827c87b6fd8..35200501be8529a7f75f45f59a1622b99ad3e399 100644
--- a/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_add_library( CombinedScintillator
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} CaloIdentifier StoreGateLib GaudiKernel G4AtlasToolsLib GeoMaterial2G4 GeoModelInterfaces TileSimEvent )
+set_target_properties( CombinedScintillator PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_runtime( share/combinedscintillator.dtd share/combinedscintillator.xml )
diff --git a/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt
index da4db2268e61de2c7fc81755682f78f6529e5056..8c0a71b66eb3e4ebe2d9986bc2b85effd2bea843 100644
--- a/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_add_library( DeadMaterial
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} StoreGateLib GaudiKernel G4AtlasToolsLib GeoMaterial2G4 GeoModelInterfaces )
+set_target_properties( DeadMaterial PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_runtime( share/deadmaterial.dtd share/deadmaterial.xml )
diff --git a/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt
index 14afbd359b59fe7f7914f63f9605861477cc1e5f..e670527a2d5f6adea20335d0f12511e57577bc8f 100644
--- a/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_add_library( LarCrate
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} StoreGateLib GaudiKernel G4AtlasToolsLib GeoMaterial2G4 GeoModelInterfaces )
+set_target_properties( LarCrate PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_runtime( share/larcrate.dtd share/larcrate.xml share/material.dtd share/Tile_materials.xml share/LArCrate_materials.xml )
diff --git a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/CMakeLists.txt
index 316d561b20d1f5cf07dd9c067e78dcb298f57eab..784e5ac7342a799fc1250fee82ee06b55e1e4da5 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/CMakeLists.txt
@@ -18,6 +18,7 @@ atlas_add_library( MinBiasScintillator
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CaloDetDescrLib CaloIdentifier StoreGateLib GaudiKernel G4AtlasToolsLib TileSimEvent )
+set_target_properties( MinBiasScintillator PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt
index 6c0d80e496e63dd25be3dd4b2ef69c0cab832770..aa54c9bb927c3c755a6ed7ec482160f15de2a133 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_add_library( MuonWall
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} CaloIdentifier StoreGateLib GaudiKernel G4AtlasToolsLib GeoModelInterfaces GeoMaterial2G4 TileSimEvent )
+set_target_properties( MuonWall PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt
index bb4f505969eb490ded349a7005d307c0144fd6b4..4c6a4dbf26545e459e3b0432aedbf6cfff9f598f 100644
--- a/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt
@@ -21,6 +21,7 @@ atlas_add_library( PhantomCalorimeter
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} CaloIdentifier StoreGateLib GaudiKernel G4AtlasToolsLib GeoMaterial2G4 GeoModelInterfaces TileSimEvent )
+set_target_properties( PhantomCalorimeter PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_runtime( share/phantombarrel.dtd share/phantombarrel.xml share/TileAncillary.mac share/phantomvis.mac )
diff --git a/TileCalorimeter/TileG4/TileG4Interfaces/CMakeLists.txt b/TileCalorimeter/TileG4/TileG4Interfaces/CMakeLists.txt
index fe6701505f8234f19c6d8571e97eb3d8566e6b4e..70b39d7eed9a111d3626b81a860f93a1dba19b95 100644
--- a/TileCalorimeter/TileG4/TileG4Interfaces/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileG4Interfaces/CMakeLists.txt
@@ -12,3 +12,4 @@ atlas_add_library( TileG4InterfacesLib
                    PUBLIC_HEADERS TileG4Interfaces
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} GaudiKernel Identifier )
+set_target_properties( TileG4InterfacesLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
diff --git a/TileCalorimeter/TileG4/TileGeoG4Calib/CMakeLists.txt b/TileCalorimeter/TileG4/TileGeoG4Calib/CMakeLists.txt
index 1f6aa3c05f4ef751b730967d980b11abc3489e2f..fa9623a428960d6906f503898037105d8541f70c 100644
--- a/TileCalorimeter/TileG4/TileGeoG4Calib/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileGeoG4Calib/CMakeLists.txt
@@ -19,6 +19,7 @@ atlas_add_library( TileGeoG4Calib
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} CaloG4SimLib CaloIdentifier CaloSimEvent CxxUtils StoreGateLib GeoModelInterfaces GeoModelUtilities GaudiKernel G4AtlasToolsLib MCTruth TileDetDescr TileGeoG4SDLib TileG4InterfacesLib TileSimEvent TileSimUtilsLib PathResolver )
+set_target_properties( TileGeoG4Calib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/TileCalorimeter/TileG4/TileGeoG4SD/CMakeLists.txt b/TileCalorimeter/TileG4/TileGeoG4SD/CMakeLists.txt
index c32f15abb3a338c9bc9c257754aa17049a559fdb..1b7371fc24b6e87b6287f6149c213906442bf014 100644
--- a/TileCalorimeter/TileG4/TileGeoG4SD/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileGeoG4SD/CMakeLists.txt
@@ -20,6 +20,7 @@ atlas_add_library( TileGeoG4SDLib
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} G4AtlasToolsLib TileDetDescr TileSimEvent TileG4InterfacesLib
                    PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloIdentifier CxxUtils GeoModelInterfaces GeoModelUtilities GaudiKernel PathResolver StoreGateLib CaloDetDescrLib TileGeoModelLib )
+set_target_properties( TileGeoG4SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 atlas_add_library( TileGeoG4SD
                    src/components/*.cxx
@@ -27,6 +28,7 @@ atlas_add_library( TileGeoG4SD
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES TileGeoG4SDLib )
+set_target_properties( TileGeoG4SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Tracking/Acts/ActsGeantFollowing/CMakeLists.txt b/Tracking/Acts/ActsGeantFollowing/CMakeLists.txt
index e7bdf017d3da5d4c08324336d6456e5379d1852e..a73b45a2606a9b0114d3818efc4f2b155f204d96 100644
--- a/Tracking/Acts/ActsGeantFollowing/CMakeLists.txt
+++ b/Tracking/Acts/ActsGeantFollowing/CMakeLists.txt
@@ -34,6 +34,7 @@ atlas_add_library( ActsGeantFollowing
                      TrkExInterfaces
                      TrkParameters
                      TrkSurfaces)       
+set_target_properties( ActsGeantFollowing PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/Tracking/TrkG4Components/TrkG4UserActions/CMakeLists.txt b/Tracking/TrkG4Components/TrkG4UserActions/CMakeLists.txt
index 9c4567075034572b34055558a4db7d0d47cc00de..edb0b57624247621cfafc84017f8ba1d269e3ebf 100644
--- a/Tracking/TrkG4Components/TrkG4UserActions/CMakeLists.txt
+++ b/Tracking/TrkG4Components/TrkG4UserActions/CMakeLists.txt
@@ -16,6 +16,7 @@ atlas_add_library( TrkG4UserActions
                    NO_PUBLIC_HEADERS
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel G4AtlasToolsLib TrkDetDescrInterfaces TrkGeometry TrkMaterialOnTrack TrkParameters CxxUtils StoreGateLib GeoPrimitives SimHelpers TrkSurfaces TrkExInterfaces TrkExUtils TrkValInterfaces )
+set_target_properties( TrkG4UserActions PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Trigger/TrigHypothesis/TrigTrackingHypo/python/IDCalibHypoConfig.py b/Trigger/TrigHypothesis/TrigTrackingHypo/python/IDCalibHypoConfig.py
index e2a2827633b797870198f9af4238c608fd8fc625..20d8eaa2c91155dff9651204e8ca6c2bb162684f 100644
--- a/Trigger/TrigHypothesis/TrigTrackingHypo/python/IDCalibHypoConfig.py
+++ b/Trigger/TrigHypothesis/TrigTrackingHypo/python/IDCalibHypoConfig.py
@@ -1,20 +1,20 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
+
+import re
 
 from AthenaCommon.Logging import logging
 from AthenaConfiguration.ComponentFactory import CompFactory
 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
 
 def createIDCalibHypoAlg(flags, name):
-    # Setup the hypothesis algorithm
-    theHypo = CompFactory.IDCalibHypoAlg(name)
-    
-    # monioring
-    monTool = GenericMonitoringTool(flags, "IM_MonTool"+name)
-    monTool.defineHistogram('pt', type='TH1F', path='EXPERT', title="p_{T};p_{T} [GeV];Nevents", xbins=50, xmin=0, xmax=100) 
-    #
-    monTool.HistPath = 'IDCalibHypoAlg'
-    theHypo.MonTool = monTool
+    # Monitoring
+    monTool = GenericMonitoringTool(flags, "IM_MonTool"+name,
+                                    HistPath = 'IDCalibHypoAlg')
+    monTool.defineHistogram('pt', type='TH1F', path='EXPERT', title="p_{T};p_{T} [GeV];Nevents", xbins=50, xmin=0, xmax=100)
 
+    # Setup the hypothesis algorithm
+    theHypo = CompFactory.IDCalibHypoAlg(name,
+                                         MonTool = monTool)
     return theHypo
 
 
@@ -31,21 +31,14 @@ def IDCalibHypoToolFromDict( chainDict ):
     else:
         log.error("chainName not in chain dictionary")
 
-    tool = CompFactory.IDCalibHypoTool(name)
-
     # set thresholds
-    import re
     m = re.search(r'trk(\d+)',[ cpart['hypo'] for cpart in cparts ][0])
     threshold = m.group(1)
 
     mult = [ cpart['multiplicity'] for cpart in cparts ][0]
     thresholds = [ float(threshold) for x in range(0,int(mult)) ]
-    strThr = ""
-    for THR in thresholds:
-        strThr += str(THR)+", "
-        
-    log.info("Threshold Values are: %s",strThr)
-
-    tool.cutTrackPtGeV = thresholds
+    log.debug("Threshold values are: %s", ", ".join(str(THR) for THR in thresholds))
 
+    tool = CompFactory.IDCalibHypoTool(name,
+                                       cutTrackPtGeV = thresholds)
     return tool
diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py
index 7e6ca84ca8bc833045a1db8717a3947900417204..986d3cb6dbd20e9995daa1eb71a3b7b8a69f03ea 100644
--- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py
+++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py
@@ -18,10 +18,6 @@ def mongroupsCfg(moniAccess, data_type):
         # need request new mongroup in the future for bootstrap photon (like "shifter_bsphoton")
         monitoring_photon = list(filter(lambda x: ('HLT_g' in x), shifter_eg))
         monitoring_bootstrap = {
-                'HLT_g25_medium_L1EM20VH' : 'HLT_g25_loose_L1EM20VH',
-                'HLT_g35_medium_L1EM20VH' : 'HLT_g25_loose_L1EM20VH',
-                'HLT_g22_tight_L1EM15VHI' : 'HLT_g20_tight_L1EM15VHI',
-                'HLT_g50_loose_L1EM20VH'  : 'HLT_g25_loose_L1EM20VH',
                 'HLT_g22_tight_L1eEM18M'  : 'HLT_g20_tight_L1eEM18M',
                 'HLT_g25_medium_L1eEM24L' : 'HLT_g25_loose_L1eEM24L',
                 'HLT_g35_medium_L1eEM24L' : 'HLT_g25_loose_L1eEM24L',
@@ -34,16 +30,16 @@ def mongroupsCfg(moniAccess, data_type):
 
         t0_tp = moniAccess.monitoredChains(signatures="egammaMon", monLevels=["t0_tp"])
         validationTP_electron_eEM = list(filter(lambda x: ('L1eEM' in x), t0_tp ))
-        validation_electron = [ 'HLT_e5_etcut_L1EM3', 'HLT_e5_lhtight_noringer_L1EM3', 'HLT_e60_etcut_L1EM22VHI', 'HLT_e26_etcut_L1EM22VHI','HLT_e300_etcut_L1EM22VHI']
+        validation_electron = ['HLT_e25_etcut_L1eEM18M','HLT_e60_etcut_L1eEM26M','HLT_e100_etcut_L1eEM26M']
         validation_jpsi = list(filter(lambda x: ('_L1JPSI' in x), shifter_topo ))
-        validationTP_jpsiee = ['HLT_e5_lhtight_L1EM3']
+        validationTP_jpsiee = ['HLT_e10_lhvloose_L1eEM9']
 
         monitoring_topo = []
         mongroups = { 
                 'monitoring_electron'           : monitoring_electron,
                 'monitoring_photon'             : monitoring_photon,
                 'monitoring_bootstrap'          : monitoring_bootstrap,
-                'monitoringTP_electron'         : monitoringTP_electron,
+                'monitoringTP_electron'         : monitoringTP_electron + ['HLT_e26_lhtight_L1eEM26M','HLT_e28_lhtight_L1eEM26M','HLT_e30_lhvloose_L1eEM26M','HLT_e60_lhvloose_L1eEM26M'],
                 'monitoring_tags'               : monitoring_tags,
                 'monitoring_topo'               : monitoring_topo,
                 'validationTP_electron_eEM'     : validationTP_electron_eEM,
@@ -67,9 +63,9 @@ def mongroupsCfg(moniAccess, data_type):
                 mongroups['monitoring_bootstrap_hi']    = monitoring_bootstrap_hi
 
         elif data_type is DQDataType.Cosmics:
-                monitoring_electron_cosmic=['HLT_e5_etcut_L1EM3']
-                monitoring_photon_cosmic=['HLT_g3_etcut_LArPEB_L1EM3']
-                monitoring_bootstrap_cosmic = {'HLT_g3_etcut_LArPEB_L1EM3' : 'HLT_g3_etcut_LArPEB_L1EM3'}
+                monitoring_electron_cosmic=['HLT_e5_etcut_L1eEM5']
+                monitoring_photon_cosmic=['HLT_g3_etcut_LArPEB_L1eEM5']
+                monitoring_bootstrap_cosmic = {'HLT_g3_etcut_LArPEB_L1eEM5' : 'HLT_g3_etcut_LArPEB_L1eEM5'}
 
                 mongroups['monitoring_electron_cosmic']  = monitoring_electron_cosmic
                 mongroups['monitoring_photon_cosmic']    = monitoring_photon_cosmic
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt b/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt
index 4f0bbb6e7ea9a267228f0feb127a8548e794d438..3413092099cfa646458b083723b3eb19686396f7 100644
--- a/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt
+++ b/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt
@@ -15,5 +15,4 @@ atlas_add_component( TrigT1CTMonitoring
    LINK_LIBRARIES ${COOL_LIBRARIES} AthenaBaseComps AthenaMonitoringKernelLib AthenaMonitoringLib AthenaPoolUtilities xAODEventInfo GaudiKernel MuonDigitContainer MuonRDO MuonTrigCoinData TrigConfData TrigConfInterfaces TrigConfL1Data TrigT1Interfaces TrigT1Result )
 
 # Install files from the package:
-atlas_install_scripts( scripts/*.py )
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/CheckItemDeadtimes.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/CheckItemDeadtimes.py
deleted file mode 100755
index 5e8e49f0551ac8279bd006d4e7696aeb89aefe7d..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/CheckItemDeadtimes.py
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-import os, sys, getopt, math
-import CoolHelper
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                this printout"
-    print "  --refItem  <i1>                       item to be used for deadtime calc"
-    print "  --testItem <i2>                       item to be tested against reference item deadtime"
-    print "  --grl <grl>                           GRL to be used" 
-
-try:
-    longopts=['grl=','help','testItem=','refItem=']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-grlFile=''
-refItem=''
-testItem=''
-orbitFreq = 40.0790e6 / 3564.
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--refItem':
-        refItem = str(a)
-    if o == '--testItem':
-        testItem = str(a)
-    if o == '--grl':
-        grlFile = str(a)
-
-if (not grlFile or not refItem or not testItem) : 
-    usage()
-    sys.exit(2)
-
-splitList = grlFile.split('.')
-fileName = 'DummyName'
-for label in splitList:
-    if 'period' in label: fileName = label
-
-itemList = [refItem, testItem]
-# ## Needed to correct ROOT behavior; see below
-# CWD = os.getcwd()
-import ROOT
-# ## Importing gSystem may change the current directory to one of the
-# ## command-line arguments; chdir to original directory to have
-# ## predictable behavior
-# os.chdir(CWD)
-# ## Import the ROOT library for reading han results
-ROOT.gSystem.Load('libGoodRunsListsLib')
-from ROOT import Root
-
-refFractions = []
-testFractions = []
-refRates = []
-testRates = []
-
-## read the goodrunslist xml file(s)
-reader = Root.TGoodRunsListReader(grlFile)
-#reader.AddXMLFile('LumiRangeCollectionB.xml')
-reader.Interpret()
-grl = reader.GetMergedGoodRunsList()
-goodruns = grl.GetGoodRuns()
-for rr in goodruns:
-    rr.Summary()
-    runNum = int(rr.GetRunNumber())
-    TAPs = CoolHelper.readLvl1Counters(runNum, itemList, "TAP")
-    TAVs = CoolHelper.readLvl1Counters(runNum, itemList, "TAV")
-    tapTurns = CoolHelper.readLvl1Turns(runNum, "TAP")
-    lbDictRefTAP = TAPs[refItem]
-    lbDictRefTAV = TAVs[refItem]
-    for testLb in lbDictRefTAP.keys():
-        if not grl.HasRunLumiBlock(runNum,testLb): continue
-        liveFrac = 100.
-        N = lbDictRefTAP[testLb]
-        errorDown = float(N) - 0.5*ROOT.TMath.ChisquareQuantile(0.1586555,2.*float(N))
-        errorUp = 0.5*ROOT.TMath.ChisquareQuantile(1.-0.1586555,2.*(float(N)+1.)) - float(N)
-        if N: liveFrac = (100.*float(lbDictRefTAV[testLb])/float(N))
-#        else: print "ZERO!!"
-        if N:
-            fracErrorUp = errorUp/float(N) * liveFrac
-            fracErrorDown = errorDown/float(N) * liveFrac
-        else:
-            fracErrorUp = 0.
-            fracErrorDown = 0.
-        refFractions.append(liveFrac)
-        refRates.append( float(N) / float(tapTurns[testLb]) * orbitFreq)
-
-    lbDictTestTAP = TAPs[testItem]
-    lbDictTestTAV = TAVs[testItem]
-    for testLb in lbDictTestTAP.keys():
-        if not grl.HasRunLumiBlock(runNum,testLb): continue
-        liveFrac = 100.
-        N = lbDictTestTAP[testLb]
-        if N: liveFrac = (100.*float(lbDictTestTAV[testLb])/float(N))
-        testFractions.append(liveFrac)
-        testRates.append( float(N) / float(tapTurns[testLb]) * orbitFreq)
-
-tfile = ROOT.TFile(fileName + "_livefractions.root","recreate")
-refHist = ROOT.TH1F("ReferenceItem_"+refItem,"Live fraction versus LB;Lumi blocks (a.u.);Live fraction AV/AP ( % )", len(refFractions),-0.5,float(len(refFractions)-0.5))
-testHist = ROOT.TH1F("TestItem_"+testItem,"Live fraction versus LB;Lumi blocks (a.u.);Live fraction ( % )", len(testFractions),-0.5,float(len(testFractions)-0.5))
-diffHist = ROOT.TH1F("Difference","Live fraction difference "+refItem+" - "+testItem+" versus LB;Lumi blocks (a.u.);#Delta live fraction ( % )", len(testFractions),-0.5,float(len(testFractions)-0.5))
-refRateHist = ROOT.TH1F("RateReferenceItem_"+refItem,"Rate versus LB;Lumi blocks (a.u.);AP Rate ( Hz )", len(testFractions),-0.5,float(len(testFractions)-0.5))
-testRateHist = ROOT.TH1F("RateTestItem_"+testItem,"Rate versus LB;Lumi blocks (a.u.);Rate ( Hz )", len(testFractions),-0.5,float(len(testFractions)-0.5))
-
-cc = 0
-for ref in refFractions: 
-    #print ref,testFractions[cc]
-    refHist.Fill(cc,ref)
-    testHist.Fill(cc,testFractions[cc])
-    diffHist.Fill(cc,ref-testFractions[cc])
-    refRateHist.Fill(cc,refRates[cc])
-    testRateHist.Fill(cc,testRates[cc])
-    cc += 1
-
-c = ROOT.TCanvas("LiveFractions","",1200,750)
-c.Divide(1,3)
-c.cd(1)
-refHist.SetStats(0)
-refHist.SetLineColor(46)
-refHist.GetXaxis().SetTitleOffset(0.8)
-refHist.GetXaxis().SetTitleSize(0.07)
-refHist.GetXaxis().SetLabelSize(0.06)
-refHist.GetYaxis().SetTitleOffset(0.5)
-refHist.GetYaxis().SetTitleSize(0.08)
-refHist.GetYaxis().SetLabelSize(0.06)
-refHist.SetMinimum(-5.)
-refHist.SetMaximum(160.)
-refHist.Draw("hist")
-testHist.SetLineColor(38)
-testHist.Draw("hist same")
-
-leg1 = ROOT.TLegend(0.7,0.7,1. - ROOT.gPad.GetRightMargin(),1. - ROOT.gPad.GetTopMargin());
-leg1.SetFillStyle(0);
-leg1.SetLineWidth(1);
-leg1.AddEntry(refHist,refItem,"l");
-leg1.AddEntry(testHist,testItem,"l");
-leg1.Draw("same")
-c.cd(2)
-diffHist.SetMinimum(-15.)
-diffHist.SetMaximum(15.)
-diffHist.SetStats(0)
-diffHist.GetXaxis().SetTitleOffset(0.8)
-diffHist.GetXaxis().SetTitleSize(0.07)
-diffHist.GetXaxis().SetLabelSize(0.06)
-diffHist.GetYaxis().SetTitleOffset(0.5)
-diffHist.GetYaxis().SetTitleSize(0.08)
-diffHist.GetYaxis().SetLabelSize(0.06)
-diffHist.Draw("hist")
-pad=c.cd(3)
-pad.SetLogy()
-maxRef = refRateHist.GetMaximum()
-maxTest = testRateHist.GetMaximum()
-max = maxRef
-if maxTest > max: max = maxTest
-refRateHist.SetMaximum(max*1.7)
-refRateHist.SetStats(0)
-refRateHist.SetLineColor(46)
-refRateHist.GetXaxis().SetTitleOffset(0.8)
-refRateHist.GetXaxis().SetTitleSize(0.07)
-refRateHist.GetXaxis().SetLabelSize(0.06)
-refRateHist.GetYaxis().SetTitleOffset(0.5)
-refRateHist.GetYaxis().SetTitleSize(0.08)
-refRateHist.GetYaxis().SetLabelSize(0.06)
-refRateHist.Draw("hist")
-testRateHist.SetLineColor(38)
-testRateHist.Draw("hist same")
-
-refHist.Write()
-testHist.Write()
-diffHist.Write()
-c.Write()
-
-c.Print(fileName + "_livefractions.gif")
-
-tfile.Close()
-
-
-
-# Add gif print, 1D hist of livefrac differences
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/CoolHelper.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/CoolHelper.py
deleted file mode 100644
index f1197bd72fc6af19ac007ce645039310c7d79df0..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/CoolHelper.py
+++ /dev/null
@@ -1,740 +0,0 @@
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-import sys, os
-from PyCool import cool,coral
-from CoolConvUtilities import AtlCoolTool
-from AtlDataSummary.AtlDataSumLumiData import LumiBCIDData
-from AtlDataSummary.AtlDataSumIOV import IOVTime, IOVRange
-# import AtlDataSummary.AtlDataSumIOV
-from AtlDataSummary.AtlDataSumLumiBCID import BCIDHandler
-from AtlDataSummary.AtlDataSumLumi import LumiHandler
-
-def openDb(MONP = False, TDAQ = False):
-# get database service and open database
-    dbSvc=cool.DatabaseSvcFactory.databaseService()
-    schemaName = "COMP200"
-    if MONP : schemaName = "MONP200"
-    accountName = "ATLAS_COOLONL_TRIGGER"
-    if TDAQ : accountName = "ATLAS_COOLONL_TDAQ"
-    # Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-    # see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-    connName="oracle://ATLAS_COOLPROD/"+accountName # aka. schema 
-    dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-    dbpw = None
-    dbuser = None
-    # Get username and password by parsing authentication XML file
-    authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-    authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-    for entry in authenticationList:
-        if entry.attributes["name"].value == connName:
-            parameters = entry.getElementsByTagName("parameter")
-            # Set username and password from authentication parameters
-            for parameter in parameters:
-                if parameter.attributes["name"].value == "user":
-                    dbuser = parameter.attributes["value"].value
-                elif parameter.attributes["name"].value == "password":
-                    dbpw = parameter.attributes["value"].value
-    dbstring="oracle://ATLAS_COOLPROD;schema="+accountName+";dbname="+schemaName+";user="+dbuser+";password="+dbpw
-    #olddbstring="oracle://ATLAS_COOLPROD;schema="+accountName+";dbname="+schemaName+";user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-
-    try:
-        db=dbSvc.openDatabase(dbstring,False)
-    except Exception,e:
-        print e
-        sys.exit(-1)
-
-    return db
-
-def readLvl1TotalRate(run):
-    
-    """ Read global L1A counter and turn counter, return dict indexed by LB, each value is a pair of (counter,turncounter) """
-
-    counts = {}
-    db = openDb()
-    fname='/TRIGGER/LVL1/CTPCORELBDATA'
-    if not db.existsFolder(fname) :
-        print "Folder",fname,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-    folder=db.getFolder(fname)
-    try:
-        itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            lb = int(obj.since() & 0xffff)
-            payload=obj.payload()
-            counter = payload['GlobalL1AcceptCounter']
-            turnCounter = payload['GlobalL1AcceptTurnCounter']
-            counts[lb] = (counter,turnCounter)
-        itr.close()
-    except Exception,e:
-        print "Reading data from",fname,"failed:",e
-    return counts
-
-def readLvl1Turns(run, label):
-    
-    """ Read turn counters needed for rate calculations, return vector indexed by LB """
-
-    payloadName = ''
-    TBPTurns = {}
-    if label == 'TBP': payloadName = 'BeforePrescale'
-    if label == 'TAP': payloadName = 'AfterPrescale'
-    if label == 'TAV': payloadName = 'L1Accept'
-    if not payloadName :
-        print "Invalid label",label," / valid values are 'TBP','TAP','TAV'"
-        sys.exit(-1)
-
-    db = openDb()
-    fname='/TRIGGER/LVL1/CTPCORELBDATA'
-    if not db.existsFolder(fname) :
-        print "Folder",fname,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-    folder=db.getFolder(fname)
-    try:
-        itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            lb = int(obj.since() & 0xffff)
-            payload=obj.payload()
-            TBPTurns[lb] = payload[payloadName + 'TurnCounter']
-            
-        itr.close()
-    except Exception,e:
-        print "Reading data from",fname,"failed:",e
-    return TBPTurns
-
-def readBunchGroupKeys(run, debug = False):
-    
-    """ Read bunch group configuration keys from COOL """
-
-    db = openDb()
-
-    bgKeys = []    
-    bgkey_fname='/TRIGGER/LVL1/BunchGroupKey'
-    if not db.existsFolder(bgkey_fname) :
-        print "Folder",bgkey_fname,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-    folder=db.getFolder(bgkey_fname)
-    try:
-        itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            payload=obj.payload()
-            bgKeys.append(int(payload['Lvl1BunchGroupConfigurationKey']))
-        itr.close()
-    except Exception,e:
-        print "Reading data from",bgkey_fname,"failed:",e
-
-    if debug : print "Run",run,"bg keys",bgKeys
-    return bgKeys
-
-def readBunchGroupDescription(run,debug = False):
-
-    """ read bunch group description (names and item to bunch group mapping) from COOL """
-
-    bgNames = []
-    bgItemMap = {}
-    itemNames = readLvl1ItemNames(run)
-
-    db = openDb()
-
-    bgdesc_fname='/TRIGGER/LVL1/BunchGroupDescription'    
-    if not db.existsFolder(bgdesc_fname) :
-        print "Folder",bgdesc_fname,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-
-    folder=db.getFolder(bgdesc_fname)
-    bgMap = []
-    try:
-        itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            lb = int(obj.since() & 0xffff)
-            payload=obj.payload()
-            bgNames.append(str(payload['BunchGroup0']))
-            bgNames.append(str(payload['BunchGroup1']))
-            bgNames.append(str(payload['BunchGroup2']))
-            bgNames.append(str(payload['BunchGroup3']))
-            bgNames.append(str(payload['BunchGroup4']))
-            bgNames.append(str(payload['BunchGroup5']))
-            bgNames.append(str(payload['BunchGroup6']))
-            bgNames.append(str(payload['BunchGroup7']))
-            bgMap = payload['ItemToBunchGroupMap']
-
-        itr.close()
-    except Exception,e:
-        print "Reading data from",bgkey_fname,"failed:",e
-        
-    for n in range(len(bgNames)):
-        if debug : print "BG",n,":",bgNames[n]
-    ctpId = 0
-    for ii in range(len(bgMap)):
-        bitCode = ''
-        bgItemMap[itemNames[ctpId]] = int(bgMap[ii])
-        ctpId += 1
-        for bit in range(7,-1,-1):
-            if (bgMap[ii]>>bit & 1) : bitCode += '1'
-            else : bitCode += '0'
-        if debug : print "Item",ii,"BG Code",bitCode
-    return bgNames, bgItemMap
-
-def extractBcids(mask, bgFullContent):
-
-    """ Given a list of item names, generate a list of BCIDs during which the item can fire, return dict mapping LBs to BCIDs """
-
-    bcidList = {}
-    for lb in bgFullContent.keys():
-        bunchGroupBcidList = bgFullContent[lb]
-        crossings = []
-        bunchGroupsToCheck = []
-        for nn in range(8):
-            if (mask >> nn) & 0x1:
-                bunchGroupsToCheck.append(nn)
-        for bx in range(3564):
-            foundOverlap = True
-            for nn in bunchGroupsToCheck:
-                if not foundOverlap:
-                    continue
-                if not bx in bunchGroupBcidList[nn]:
-                    foundOverlap = False
-                    
-            if foundOverlap:
-                crossings.append(bx)
-        bcidList[lb] = crossings
-
-    return bcidList
-
-def readBunchGroupContent(run, debug = False):
-
-    """ Read full bunch group content from COOL """
-
-    bgFullContent = {}
-
-    db = openDb()
-
-    bgcont_fname='/TRIGGER/LVL1/BunchGroupContent'
-    if not db.existsFolder(bgcont_fname) :
-        print "Folder",bgcont_fname,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-
-    folder=db.getFolder(bgcont_fname)
-    try:
-        index = 0
-        itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            lb= int(obj.since() & 0xffff)
-            if debug : print "LB",lb
-            bgList = []
-            for _ in range(8): bgList.append([])
-            payload=obj.payload()
-            bgcont = payload['BunchCode']
-            for bcid in range(3564): 
-                for bgrp in range(8):
-                    if(bgcont[bcid]>>bgrp & 1): bgList[bgrp].append(bcid)
-                    ++index
-                    for grp in range(8):
-                        pass
-                        # print "BG",grp,"size :",len(bgList[grp])
-                        for grp in range(8):
-                            pass
-                            # print "BG",grp,":",bgList[grp]
-            bgFullContent[lb] = bgList
-
-        itr.close()
-    except Exception,e:
-        print "Reading data from",bgcont_fname,"failed:",e
-
-    return bgFullContent
-
-def readLvl1ItemNames(run):
-
-    """ Read LVL1 menu and extract item names indexed by their CTP ID """
-
-    db = openDb()
-
-    itemNames=[""]*256
-    lvl1menu_foldername='/TRIGGER/LVL1/Menu'
-    if not db.existsFolder(lvl1menu_foldername) :
-        print "Folder",lvl1menu_foldername,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-    folder=db.getFolder(lvl1menu_foldername)
-    try:
-        itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            itemNo=obj.channelId()
-            payload=obj.payload()
-            itemNames[itemNo] = payload['ItemName']
-        itr.close()
-    except Exception,e:
-        print "Reading data from",lvl1menu_foldername,"failed:",e
-
-    return itemNames
-
-def readLvl1Prescales(run, itemList):
-
-    """ Read LVL1 prescales from COOL for the whole run, return dict indexed by item name, value is a list of prescales per LB """
-
-    # first get item names mapped to CTP IDs
-    itemNames = readLvl1ItemNames(run)
-    itemIDs = []
-    id = 0
-    for name in itemNames:        
-        if name in itemList:
-            itemIDs.append(id)
-        id += 1
-    # now construct channels we want to read
-    channels = cool.ChannelSelection(cool.ChannelSelection.channelBeforeSince)
-    for id in itemIDs:
-        channels.addChannel(id)
-
-    Prescales = {}
-    db = openDb()
-    foldername='/TRIGGER/LVL1/Prescales'
-    if not db.existsFolder(foldername) :
-        print "Folder",foldername,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-
-    folder=db.getFolder(foldername)
-    try:
-        itr=folder.browseObjects(run << 32,(run+1) << 32,channels)
-        while itr.goToNext():
-            obj=itr.currentRef()
-            lb = int(obj.since() & 0xffff)
-            itemNo=obj.channelId()
-            if not itemNo in itemIDs: continue
-            payload=obj.payload()            
-            try:
-                Prescales[itemNames[itemNo]][lb] = int(payload['Lvl1Prescale'])
-            except KeyError:
-                newDict = {}
-                Prescales[itemNames[itemNo]] = newDict
-                Prescales[itemNames[itemNo]][lb] = int(payload['Lvl1Prescale'])
-        itr.close()
-        return Prescales
-    except Exception,e:
-        print "Reading data from",foldername,"failed:",e
-
-def readLvl1Counters(run, itemList, label):
-
-    """ Read LVL1 item rates from COOL for the whole run, return dict indexed by item name, value is a list of rates per LB """
-
-    # first get item names mapped to CTP IDs
-    itemNames = readLvl1ItemNames(run)
-    itemIDs = []
-    id = 0
-    for name in itemNames:        
-        if name in itemList:
-            itemIDs.append(id)
-        id += 1
-        
-    payloadName = ''
-    if label == 'TBP': payloadName = 'BeforePrescale'
-    if label == 'TAP': payloadName = 'AfterPrescale'
-    if label == 'TAV': payloadName = 'L1Accept'
-    if not payloadName :
-        print "Invalid label",label," / valid values are 'TBP','TAP','TAV'"
-        sys.exit(-1)
-
-    # now construct channels we want to read
-    channels = cool.ChannelSelection(cool.ChannelSelection.channelBeforeSince)
-    for id in itemIDs:
-        channels.addChannel(id)
-
-    TBPCounts={}
-#    LBs = []
-
-    db = openDb()
-
-    lvl1counters_foldername='/TRIGGER/LUMI/LVL1COUNTERS'
-    if not db.existsFolder(lvl1counters_foldername) :
-        print "Folder",lvl1counters_foldername,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-
-    folder=db.getFolder(lvl1counters_foldername)
-    try:
-        itr=folder.browseObjects(run << 32,(run+1) << 32,channels)
-        while itr.goToNext():
-            obj=itr.currentRef()
-            lb = int(obj.since() & 0xffff)
-            itemNo=obj.channelId()
-#            if not lb in LBs : LBs.append(lb)
-            if not itemNo in itemIDs: continue
-            payload=obj.payload()            
-            try:
-                TBPCounts[itemNames[itemNo]][lb] = int(payload[payloadName])
-            except KeyError:
-                newDict = {}
-                TBPCounts[itemNames[itemNo]] = newDict
-                TBPCounts[itemNames[itemNo]][lb] = int(payload[payloadName])
-
-        itr.close()
-        return TBPCounts
-
-    except Exception,e:
-        print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-def getLumiCalibFunction(tnow, channel):
-    import struct
-    db = openDb(False,True)
-    # gets the calibration function and parameters
-    fcal=db.getFolder("/TDAQ/OLC/CALIBRATIONS")
-    objcal=fcal.findObject(tnow,channel)
-    plcal=objcal.payload()
-    numOfPar = plcal["NumOfParameters"]
-    functionType = plcal["Function"]
-    muToLumi =  plcal["MuToLumi"]
-    blob=cool.Blob64k()
-    blob=plcal["Parameters"]
-    s=blob.read()
-    parVec=[]
-    for i in range(0,len(blob),4):
-        parVec.append(struct.unpack('f',s[i:i+4])[0])
-    db.closeDatabase()
-    return functionType,muToLumi,numOfPar,parVec
-
-def calibrateLumi(raw,cType,nPar,parVec):
-  import math
-# performs the same calibration as the OLC
-  cal=-1.0
-  if cType == "Polynomial":
-    nrange=parVec[0]
-    for i in range(int(nrange)):
-      rmin=parVec[i+1]
-      rmax=parVec[i+2]
-      a=[parVec[i+3]]
-      a.append(parVec[i+4])
-      a.append(parVec[i+5])
-      a.append(parVec[i+6])
-      a.append(parVec[i+7])
-      a.append(parVec[i+8])
-      if raw<rmax and raw>=rmin:
-          cal=0.0
-          for k in range(6):
-            cal=cal+a[k]*pow(raw,k)
-  elif cType == "Logarithm":
-      try:
-          cal=-parVec[0]*math.log(1.0-raw)
-      except ValueError:
-          print "ValueError: raw",raw
-          cal = 0
-  elif cType == "None":
-    print 'Warning: calibration type is None - normally should not get here...'
-    return 1
-  else:
-    print 'Unknown calibration type ',cType
-    sys.exit()
-  return cal
-
-def readReadyForPhysics(run):
-    """ Read ready-for-physics flag for the given run. Return dictionary indexed by LB number, Bool flag to indicate ready-for-physics flag """
-
-    db = openDb(False,True)
-    foldername = "/TDAQ/RunCtrl/DataTakingMode"
-    if not db.existsFolder(foldername) :
-        print "Folder",foldername,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-    folder=db.getFolder(foldername)
-    lbList = {}
-    try:
-        itr=folder.browseObjects(run<<32, (run<<32)+0xFFFFFFFF ,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            payload=obj.payload()
-            lb = int(obj.since() & 0xffff)
-            ready = payload['ReadyForPhysics']
-            lbList[lb] = bool(ready)
-        itr.close()
-    except Exception,e:
-        print "Reading data from",foldername,"failed:",e
-    db.closeDatabase()
-    return lbList
-
-def readLhcFillNumber(run):
-    """ Read LHC fill number for this run """
-
-    fillList = []
-    startRun, stopRun = runStartStopTime(run)
-    startTime = IOVTime(timerunlb=startRun, timebased=True)
-    endTime = IOVTime(timerunlb=stopRun, timebased=True) 
-    iovrange = IOVRange(starttime = startTime, endtime = endTime)
-
-    lhcfolder = '/LHC/DCS/FILLSTATE'
-    # Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-    # see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-    connName="oracle://ATLAS_COOLPROD/ATLAS_COOLOFL_DCS" # the old online one: ATLAS_COOLONL_DCS is not in this file 
-    dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-    dbpw = None
-    dbuser = None
-    # Get username and password by parsing authentication XML file
-    authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-    authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-    for entry in authenticationList:
-        if entry.attributes["name"].value == connName:
-            parameters = entry.getElementsByTagName("parameter")
-            # Set username and password from authentication parameters
-            for parameter in parameters:
-                if parameter.attributes["name"].value == "user":
-                    dbuser = parameter.attributes["value"].value
-                elif parameter.attributes["name"].value == "password":
-                    dbpw = parameter.attributes["value"].value
-    dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200;user="+dbuser+";password="+dbpw
-    #olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_DCS;dbname=COMP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-
-    try:
-        dbSvc=cool.DatabaseSvcFactory.databaseService()
-        db=dbSvc.openDatabase(dbstring,False)
-    except Exception,e:
-        print e
-        sys.exit(-1)
-
-    folder = db.getFolder(lhcfolder)
-    itr = folder.browseObjects(iovrange.startTime.time, iovrange.endTime.time, cool.ChannelSelection.all())
-    while itr.goToNext():
-        obj = itr.currentRef()
-        fillNumber = obj.payload()['FillNumber']
-        stable = obj.payload()['StableBeams']
-
-        # Protection against bogus values
-        if fillNumber == None or stable == None:
-            print 'Fill number or stable flag is NULL for',iovrange
-            fillNumber = 0
-        else:
-            if stable and fillNumber not in fillList:
-                print "run",run,"fill",fillNumber
-                fillList.append(fillNumber)
-
-    db.closeDatabase()
-    return fillList
-
-
-
-def readLumiBCID(run):
-    """ Read luminosity per BCID from COOL """
-    
-    lbTimes = getLbTimes(run)
-    startRun, stopRun = runStartStopTime(run)
-    startTime = IOVTime(timerunlb=startRun, timebased=True)
-    endTime = IOVTime(timerunlb=stopRun, timebased=True) 
-    iovrange = IOVRange(starttime = startTime, endtime = endTime)
-    bh = BCIDHandler()
-    bh.lumiChan = 101
-    if run > 170000: bh.lumiChan = 201
-    bh.loadBCIDData(iovrange)    
-    calType,muToLumi,calNumOfPar,calParVec = getLumiCalibFunction(startRun, bh.lumiChan)
-
-#    lh = LumiHandler()
-#    lh.loadLumiData(iovrange)
-
-    lbList = dict()
-    for key in bh.bcidDict.keys():
-        if bh.bcidDict[key].runLB.lb == 0: continue
-        bcidDico = {}
-        duration = (lbTimes[bh.bcidDict[key].runLB.lb][1] - lbTimes[bh.bcidDict[key].runLB.lb][0]) / 1e9
-        # fix this
-        for bcid in bh.bcidDict[key].rawLumi.keys():
-            calibLumi = muToLumi * calibrateLumi(bh.bcidDict[key].rawLumi[bcid],calType,calNumOfPar,calParVec)
-#            print "LB",bh.bcidDict[key].runLB.lb,"BCID",bcid,"mu",calibLumi/muToLumi
-#            calibLumi = calibrateLumi(bh.bcidDict[key].rawLumi[bcid],calType,calNumOfPar,calParVec)
-#            bh.bcidDict[key].rawLumi[bcid] = calibLumi
-#            if bcid == 1: print "Cal",calibLumi
-            bcidDico[bcid] = (calibLumi * duration,calibLumi/muToLumi)
-        lbList[bh.bcidDict[key].runLB.lb] = bcidDico
-
-    return lbList
-
-def readBunchCurrents(run, bcidList):
-
-    """ Read bunch currents for the given run, beam, and BCID list. Bunch groups might change on LB change, hence the BCID list must be a dictionary keyed by LB numbers, values are BCIDs"""
-
-    lbDict1 = {}
-    lbDict2 = {}
-#    db = openDb(True,True)
-#    lbTimes = getLbTimes(run)
-    startRun, stopRun = runStartStopTime(run)
-
-    startTime = IOVTime(timerunlb=startRun, timebased=True)
-    endTime = IOVTime(timerunlb=stopRun, timebased=True) 
-    iovrange = IOVRange(starttime = startTime, endtime = endTime)
-    bh = BCIDHandler()
-    bh.loadBCIDData(iovrange)
-
-    # the BCID list is keyed by the first LB at which the BCID list was
-    # valid, hence have to figure out here the largest LB in the bcidList
-    # that is <= the current LB 
-    for key in bh.bcidDict.keys():       
-        latestLb = 0
-        for lb in bcidList.keys():
-            if bh.bcidDict[key].runLB.lb >= lb and lb > latestLb:
-                latestLb = lb
-
-        # beam 1
-        bunchCurrents1 = 0.
-        for bcid in bh.bcidDict[key].b1Curr.keys():
-            # account for the BCT phase set up wrongly, hence try also BCID+1, -1
-            if bcid in bcidList[latestLb]:
-                bunchCurrents1 = bunchCurrents1 + bh.bcidDict[key].b1Curr[bcid]
-            elif (bcid+1) in bcidList[latestLb]:
-                bunchCurrents1 = bunchCurrents1 + bh.bcidDict[key].b1Curr[bcid]
-            elif (bcid-1) in bcidList[latestLb]:
-                bunchCurrents1 = bunchCurrents1 + bh.bcidDict[key].b1Curr[bcid]
-        lbDict1[bh.bcidDict[key].runLB.lb] = bunchCurrents1
-
-        # beam 2
-        bunchCurrents2 = 0.
-        for bcid in bh.bcidDict[key].b2Curr.keys():
-            # account for the BCT phase set up wrongly, hence try also BCID+1, -1
-            if bcid in bcidList[latestLb]:
-                bunchCurrents2 = bunchCurrents2 + bh.bcidDict[key].b2Curr[bcid]
-            elif (bcid+1) in bcidList[latestLb]:
-                bunchCurrents2 = bunchCurrents2 + bh.bcidDict[key].b2Curr[bcid]
-            elif (bcid-1) in bcidList[latestLb]:
-                bunchCurrents2 = bunchCurrents2 + bh.bcidDict[key].b2Curr[bcid]
-        lbDict2[bh.bcidDict[key].runLB.lb] = bunchCurrents2
-
-#       print bh.bcidDict[key].runLB.lb,":",bh.bcidDict[key].specLumi
-#        print bh.bcidDict[key].runLB.lb,":",bh.bcidDict[key].b2Curr
-
-    return (lbDict1,lbDict2)
-
-
-#     bcidData = LumiBCIDData()
-#     folder=db.getFolder(foldername)
-#     try:
-#         itr=folder.browseObjects(startRun,stopRun,cool.ChannelSelection.all())
-#         while itr.goToNext() :
-#             bcidData.clear()
-#             obj=itr.currentRef()
-#             # channel 1 is fast BCT
-#             if not obj.channelId() == 1: continue
-#             payload=obj.payload()
-#             lbCool = payload['RunLB'] & 0xffff
-#             if lbCool == 0: continue
-#             bcidData.fillCurrents(payload)
-#             latestLb = 1
-#             for lb in bcidList.keys():
-#                 if lbCool >= lb:
-#                     latestLb = lb
-
-
-#             if lbCool == 200:
-#                 print bcidData.b1Curr
-#             bunchCurrents1 = 0.
-#             for bcid in bcidData.b1Curr.keys():
-#                 # account for the BCT phase set up wrongly, hence try also BCID+1, -1
-#                 if bcid in bcidList[latestLb]:
-#                     bunchCurrents1 = bunchCurrents1 + bcidData.b1Curr[bcid]
-#                 if (bcid+1) in bcidList[latestLb]:
-#                     bunchCurrents1 = bunchCurrents1 + bcidData.b1Curr[bcid]
-#                 if (bcid-1) in bcidList[latestLb]:
-#                     bunchCurrents1 = bunchCurrents1 + bcidData.b1Curr[bcid]
-#             lbDict1[lbCool] = bunchCurrents1
-#             bunchCurrents2 = 0.
-#             #print bcidData.b2Curr
-#             for bcid in bcidData.b2Curr.keys():
-#                 # account for the BCT phase set up wrongly, hence try also BCID+1, -1
-#                 if bcid in bcidList[latestLb]:
-#                     bunchCurrents2 = bunchCurrents2 + bcidData.b2Curr[bcid]
-#                 if (bcid+1) in bcidList[latestLb]:
-#                     bunchCurrents2 = bunchCurrents2 + bcidData.b2Curr[bcid]
-#                 if (bcid-1) in bcidList[latestLb]:
-#                     bunchCurrents2 = bunchCurrents2 + bcidData.b2Curr[bcid]
-#             lbDict2[lbCool] = bunchCurrents2
-
-
-#         itr.close()
-#     except Exception,e:
-#         print "Reading data from",foldername,"failed:",e
-
-def runStartStopTime(run):
-    
-    """ Retrieve start and stop time of the given run """
-    db = openDb(False,True)
-    foldername = "/TDAQ/RunCtrl/EOR_Params"
-    if not db.existsFolder(foldername) :
-        print "Folder",foldername,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-
-    folder=db.getFolder(foldername)
-    try:
-        itr=folder.browseObjects(run<<32, (run<<32)+0xFFFFFFFF ,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            payload=obj.payload()
-            runCool = payload['RunNumber']
-            startTime = payload['SORTime']
-            stopTime = payload['EORTime']
-#            print "Searched run",run,"found run",runCool,"start",startTime,"stop",stopTime
-        itr.close()
-    except Exception,e:
-        print "Reading data from",foldername,"failed:",e
-
-    db.closeDatabase()
-    return startTime, stopTime
-
-def runLbToTime(run,lb):
-
-    """ Convert Run-LB pair to start-endtime pair """
-
-    db = openDb()
-    start = 0
-    end = 0
-    foldername='/TRIGGER/LUMI/LBLB'
-    if not db.existsFolder(foldername) :
-        print "Folder",foldername,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-
-    folder=db.getFolder(foldername)
-    try:
-        itr=folder.browseObjects((run << 32)+lb,(run << 32)+lb,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            payload=obj.payload()
-            start = payload['StartTime']
-            end = payload['EndTime']
-            
-        itr.close()
-    except Exception,e:
-        print "Reading data from",foldername,"failed:",e
-
-    return (start, end)
-
-def getLbTimes(run):
-
-    """ For given run return all  start-endtime pairs in a dict, indexed by lumi block """
-
-    db = openDb()
-    lbDict = {}
-    foldername='/TRIGGER/LUMI/LBLB'
-    if not db.existsFolder(foldername) :
-        print "Folder",foldername,"not found"
-        db.closeDatabase()
-        sys.exit(-1)
-
-    folder=db.getFolder(foldername)
-    try:
-        itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-        while itr.goToNext() :
-            obj=itr.currentRef()
-            payload=obj.payload()
-            since = int(obj.since() & 0xffff)
-            start = payload['StartTime']
-            end = payload['EndTime']
-            lbDict[since] = (start, end)
-        itr.close()
-    except Exception,e:
-        print "Reading data from",foldername,"failed:",e
-
-    db.closeDatabase()
-    return lbDict
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/GetItemOutput.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/GetItemOutput.py
deleted file mode 100755
index 3862015a5362756e828a29b790114da5bb6685d2..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/GetItemOutput.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-import os, sys, getopt, math
-import CoolHelper
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                this printout"
-    print "  --itemList i1,i2                      list of items"
-    print "  --grl <grl>                           GRL to be used" 
-    print "  --verbose                             print run/LB with non-zero item count" 
-
-try:
-    longopts=['grl=','help','itemList=', 'verbose']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-grlFile=''
-itemList=[]
-verbose=False
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--itemList':
-        ilist = str(a).split(',')
-        itemList = [i for i in ilist if i]
-    if o == '--grl':
-        grlFile = str(a)
-    if o == '--verbose':
-        verbose = True
-
-if (not itemList or not grlFile) : 
-    usage()
-    sys.exit(2)
-
-import ROOT
-ROOT.gSystem.Load('libGoodRunsListsLib')
-from ROOT import Root
-
-itemCounts = {}
-## read the goodrunslist xml file(s)
-reader = Root.TGoodRunsListReader(grlFile)
-#reader.AddXMLFile('LumiRangeCollectionB.xml')
-reader.Interpret()
-grl = reader.GetMergedGoodRunsList()
-goodruns = grl.GetGoodRuns()
-for rr in goodruns:
-    #rr.Summary()
-    runNum = int(rr.GetRunNumber())
-    TAVs = CoolHelper.readLvl1Counters(runNum, itemList, "TAV")
-    for name in itemList:    
-        lbDictRefTAV = TAVs[name]
-        itemCountsPerRun = 0
-        for testLb in lbDictRefTAV.keys():
-            if not grl.HasRunLumiBlock(runNum,testLb): continue
-            try:
-                itemCounts[name] += lbDictRefTAV[testLb]
-                itemCountsPerRun += lbDictRefTAV[testLb]
-            except KeyError:
-                itemCounts[name] = int(0)
-                itemCounts[name] += lbDictRefTAV[testLb]
-                itemCountsPerRun += lbDictRefTAV[testLb]
-
-        if verbose and itemCountsPerRun:
-            print "Run",runNum,"triggers",name,itemCountsPerRun
-                
-for name in itemList:
-    print "Item",name,"triggers",itemCounts[name]
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/README.txt b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/README.txt
deleted file mode 100644
index ad29cb68ace3735b5ef29bb5d6f72e589ec67265..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/README.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-
-====================================================
-=  Reading and plotting LB and L1CT COOL data
-= 
-=  October 20, 2009 -- Feb 2010 L1CT crew
-=
-=  Contacts: 
-=       Johan.Lundberg@cern.ch, David.Berge@cern.ch
-====================================================
-
-setup script for point 1:
--------------------------
-    setup_l1ct_python.sh    
-    
-    source it, or just set up an offline release (required for Cool etc)
-    with . offline_setup.sh    
-
-Generic
--------
-
-    l1ct_lb2time.py    (map lumiblock->time and time->lb)
-    busy_cool_reader.py (busy display)
-
-Reading l1 rates
-----------------
-
-    cool_read_lvl1rates.py
-    fillLVL1histograms.py
-
-Reading and plotting Counter Rates as function of run,lb,counter,bcid,...
--------------------------------------------------------------------------
-
-    ctpin_cool_reader.py
-    ctpin_cool_plot.py
-
-    ctpmon_cool_reader.py
-    ctpmon_cool_plot.py
-
-    busy_cool_reader.py
-    busy_cool_plot.py     
-
-Reading configuration
----------------------
-
-  Ctpin Signal configuration:
-
-    ctpin_readconfig.py
-
-  Examine Threshold/Counter configuration (CTPIN and CTPMON)
-
-    l1ct_read_counter_conf.py
-
-
-helper modules:
----------------
-    l1ctpy.py      (common)
-    ctpin_py.py    (ctpin)
-    ctpmon_py.py   (ctpmon)
-    busy_py.py     (busy)
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ReadLumiBcid.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ReadLumiBcid.py
deleted file mode 100755
index db881d089ba216df4aae0bdff09fd103aaf8f769..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ReadLumiBcid.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-import sys,getopt,os, math
-from PyCool import cool,coral
-from ROOT import TH1F, TH1D,TFile, TProfile, TObject, TGraph
-import CoolHelper
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                         this printout"
-    print "  --run <runNo>                  run number"
-
-try:
-    longopts=['run=','help']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-run=int(-1)
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--run':
-        run = int(a)
-
-if (run == -1) : 
-    usage()
-    sys.exit(2)
-
-lbList = CoolHelper.readLumiBCID(run)
-fileName = "BcidLumi_Run"
-fileName += str(run)
-fileName += ".root"
-hAll = TH1F("TotalLumi","Total raw lumi;BCID;Lumi",3564,-0.5,3563.5)
-histList = []
-for lb in lbList.keys():
-    hName = "Lumi_lb"
-    hName += str(int(lb))
-    hTitle = "Raw lumi LB "
-    hTitle += str(int(lb))
-    hTitle += ";BCID;Lumi"
-    h = TH1F(hName,hTitle,3564,-0.5,3563.5)
-    for bcid in lbList[lb].keys():
-        hAll.Fill(bcid,lbList[lb][bcid])
-        h.Fill(bcid,lbList[lb][bcid])
-    histList.append(h)
-
-tfile = TFile(fileName,"recreate")
-hAll.Write()
-for h in histList:
-    h.Write()
-tfile.Close()
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ReadPbmCounters.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ReadPbmCounters.py
deleted file mode 100755
index ec9753d2a50c2f29231e1aca4d0f4b0f95143682..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ReadPbmCounters.py
+++ /dev/null
@@ -1,350 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-import sys,getopt,os, math
-from PyCool import cool,coral
-from ROOT import TH1F, TH1D,TFile, TProfile, TObject, TGraph
-import CoolHelper
-
-def decodeBlob(blob, index = 0):
-    # one block in the blob is 3*3564 long; 3564 is the number of BCIDs,
-    # for each BCID, we have a 24-bit counter, which is stored as 3
-    # separate bytes...
-    startIndex = index * (3*3564)
-    stopIndex = (index+1) * (3*3564)
-    returnList = []
-    byteNum = int(0)
-    counter = int(0)
-    for id in range(startIndex,stopIndex):
-        byte = blob[id]
-        counter |= (byte << (byteNum%3)*8)
-        if (byteNum%3) == 2:
-            returnList.append(counter)
-            counter = int(0)
-        byteNum += 1
-    return returnList
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                         this printout"
-    print "  --run <runNo>                  run number"
-    print "  --lb <lb1>-<lb2>               LB range"
-    print "  --trig                         flag to read trigger counters, too"
-    print "  --dtLb                         store all deadtimes per LB, else only combined high/low priorities will be stored per LB"
-
-try:
-    longopts=['run=','help','lb=','trig','dtLb']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-lbList=[]
-run=int(-1)
-doTrig = False
-doDtLb = False
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o in ('-t','--trig'):
-        doTrig = True
-    if o in ('-d','--dtLb'):
-        doDtLb = True
-    if o == '--run':
-        run = int(a)
-    if o == '--lb':
-            list1 = str(a).split('-')
-            if len(list1) > 1 : lbList += range(int(list1[0]),int(list1[1])+1)
-            else : lbList.append(int(list1[0]))
-
-if (run == -1 or len(lbList) == 0) : 
-    usage()
-    sys.exit(2)
-
-# get database service and open database
-dbSvc=cool.DatabaseSvcFactory.databaseService()
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user="+dbuser+";password="+dbpw
-#olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-
-try:
-    db=dbSvc.openDatabase(dbstring,False)
-except Exception,e:
-    print e
-    sys.exit(-1)
-
-foldername='/TRIGGER/LUMI/PerBcidDeadtime'
-if not db.existsFolder(foldername) :
-    print "Folder",foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-    
-pr0 = TProfile("LowPriority","Low priority deadtime fraction;BCID;Veto fraction",3564,-0.5,3563.5,0.,1.0,"s")
-pr1 = TProfile("HighPriority","High priority deadtime fraction;BCID;Veto fraction",3564,-0.5,3563.5,0.,1.0,"s")
-pr2 = TProfile("DtDaq","DAQ deadtime fraction;BCID;Veto fraction",3564,-0.5,3563.5,0.,1.0,"s")
-pr3 = TProfile("DtSimple","Simple deadtime fraction;BCID;Veto fraction",3564,-0.5,3563.5,0.,1.0,"s")
-pr4 = TProfile("DtHighPriority","High priority deadtime fraction;BCID;Veto fraction",3564,-0.5,3563.5,0.,1.0,"s")
-pr5 = TProfile("L1A","L1A rate;BCID;Rate ( Hz )",3564,-0.5,3563.5,"s")
-if doTrig:
-    pr6 =  TH1F("TAP0","TAP0 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr7 =  TH1F("TAP1","TAP1 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr8 =  TH1F("TAP2","TAP2 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr9 =  TH1F("TAP3","TAP3 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr10 = TH1F("TAP4","TAP4 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr11 = TH1F("TAP5","TAP5 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr12 = TH1F("TAV0","TAV0 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr13 = TH1F("TAV1","TAV1 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr14 = TH1F("TAV2","TAV2 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr15 = TH1F("TAV3","TAV3 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr16 = TH1F("TAV4","TAV4 counts;BCID;# Triggers",3564,-0.5,3563.5)
-    pr17 = TH1F("TAV5","TAV5 counts;BCID;# Triggers",3564,-0.5,3563.5)
-
-# now get physics bunch group
-bgKeys = CoolHelper.readBunchGroupKeys(run)
-bgNames, bgItemMap = CoolHelper.readBunchGroupDescription(run)
-bgFullContent = CoolHelper.readBunchGroupContent(run)
-bcidList = CoolHelper.extractBcids(bgItemMap['L1_EM10'], bgFullContent)
-bb = TH1F("PhysicsBunchgroup","Physics bunch group;BCID;a.u.",3564,-0.5,3563.5)
-testLb = 0
-for lb in bcidList.keys():
-    if lb > testLb:
-        testLb = lb
-for bcid in bcidList[testLb]:
-    bb.Fill(bcid,1)
-
-lbHistList = []
-
-folder=db.getFolder(foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    lbNum = 1
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        lb=(obj.since() & 0xffff)
-        turnCount = payload["TurnCounter"]
-        blobLow = payload["LowPriority"]
-        blobHigh = payload["HighPriority"]
-        if lb in lbList:
-            print "LB count",lbNum,"/",len(lbList)
-            lbNum += 1
-            hName = "HighPriority_lb"
-            hName += str(int(lb))
-            lbHist = TH1F(hName,"High priority deadtime fraction;BCID;Veto fraction",3564,-0.5,3563.5)
-            lbHistList.append(lbHist)
-            bcidDeadLow = decodeBlob(blobLow)
-            bcidDeadHigh = decodeBlob(blobHigh)
-            for bcid in range(3564):
-                pr0.Fill(bcid, float(bcidDeadLow[bcid]) / float(turnCount) )
-                pr1.Fill(bcid, float(bcidDeadHigh[bcid]) / float(turnCount) )
-                lbHist.Fill(bcid,float(bcidDeadHigh[bcid]) / float(turnCount))
-    itr.close()
-except Exception,e:
-    print "Reading data from",foldername,"failed:",e
-
-db.closeDatabase()
-
-####################################
-# < --
-# now read further trigger counters
-
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=MONP200;user="+dbuser+";password="+dbpw
-#dear user - why not dbname=COMP200? 
-#olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=MONP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-#dbstring = "TRIG_PIT/MONP200"
-try:
-    db=dbSvc.openDatabase(dbstring,False)
-except Exception,e:
-    print e
-    sys.exit(-1)
-
-foldername='/TRIGGER/LVL1/PerBcidCounters'
-if not db.existsFolder(foldername) :
-    print "Folder",foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-
-folder=db.getFolder(foldername)
-try: 
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    lbNum = 1
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        lb=(obj.since() & 0xffff)
-        turnCount = payload["TurnCounter"]
-        blobL1A = payload["L1A"]
-        blob1 = payload["DT2"]
-        blob2 = payload["DT3"]
-        blob3 = payload["DT4"]
-        if doTrig:
-            blob4 = payload["TrigA0"]
-            blob5 = payload["TrigA1"]
-            blob6 = payload["TrigA2"]
-            blob7 = payload["TrigB0"]
-            blob8 = payload["TrigB1"]
-            blob9 = payload["TrigB2"]
-
-        if lb in lbList:
-            print "LB count",lbNum,"/",len(lbList)
-            lbNum += 1
-            if doDtLb:
-                hName = "DtDaq_lb"
-                hName += str(int(lb))
-                hTitle = "DAQ deadtime fraction LB "
-                hTitle += str(int(lb))
-                hTitle += ";BCID;Veto fraction"
-                lbHistDT2 = TH1F(hName,hTitle,3564,-0.5,3563.5)
-                lbHistList.append(lbHistDT2)
-                hName = "DtSimple_lb"
-                hName += str(int(lb))
-                hTitle = "Simple deadtime fraction LB "
-                hTitle += str(int(lb))
-                hTitle += ";BCID;Veto fraction"
-                lbHistDT3 = TH1F(hName,hTitle,3564,-0.5,3563.5)
-                lbHistList.append(lbHistDT3)
-                hName = "DtHighPriority_lb"
-                hName += str(int(lb))
-                hTitle = "High priority deadtime fraction LB "
-                hTitle += str(int(lb))
-                hTitle += ";BCID;Veto fraction"
-                lbHistDT4 = TH1F(hName,hTitle,3564,-0.5,3563.5)
-                lbHistList.append(lbHistDT4)
-
-            bcidL1A = decodeBlob(blobL1A)
-            bcidDT2 = decodeBlob(blob1)
-            bcidDT3 = decodeBlob(blob2)
-            bcidDT4 = decodeBlob(blob3)
-            if doTrig:
-                bcidTrigTAP0 = decodeBlob(blob4,0)
-                bcidTrigTAP1 = decodeBlob(blob4,1)
-                bcidTrigTAP2 = decodeBlob(blob5,0)
-                bcidTrigTAP3 = decodeBlob(blob5,1)
-                bcidTrigTAP4 = decodeBlob(blob6,0)
-                bcidTrigTAP5 = decodeBlob(blob6,1)
-                bcidTrigTAV0 = decodeBlob(blob7,0)
-                bcidTrigTAV1 = decodeBlob(blob7,1)
-                bcidTrigTAV2 = decodeBlob(blob8,0)
-                bcidTrigTAV3 = decodeBlob(blob8,1)
-                bcidTrigTAV4 = decodeBlob(blob9,0)
-                bcidTrigTAV5 = decodeBlob(blob9,1)
-            for bcid in range(3564):
-                pr2.Fill(bcid,float(bcidDT2[bcid]) / float(turnCount))
-                pr3.Fill(bcid,float(bcidDT3[bcid]) / float(turnCount))
-                pr4.Fill(bcid,float(bcidDT4[bcid]) / float(turnCount))
-                pr5.Fill(bcid,float(bcidL1A[bcid]) / float(turnCount) * 11246.)
-
-                if doDtLb:
-                    lbHistDT2.Fill(bcid,float(bcidDT2[bcid]) / float(turnCount))
-                    lbHistDT3.Fill(bcid,float(bcidDT3[bcid]) / float(turnCount))
-                    lbHistDT4.Fill(bcid,float(bcidDT4[bcid]) / float(turnCount))
-
-                if doTrig:
-                    pr6.Fill(bcid,bcidTrigTAP0[bcid])
-                    pr7.Fill(bcid,bcidTrigTAP1[bcid])
-                    pr8.Fill(bcid,bcidTrigTAP2[bcid])
-                    pr9.Fill(bcid,bcidTrigTAP3[bcid])
-                    pr10.Fill(bcid,bcidTrigTAP4[bcid])
-                    pr11.Fill(bcid,bcidTrigTAP5[bcid])
-                    pr12.Fill(bcid,bcidTrigTAV0[bcid])
-                    pr13.Fill(bcid,bcidTrigTAV1[bcid])
-                    pr14.Fill(bcid,bcidTrigTAV2[bcid])
-                    pr15.Fill(bcid,bcidTrigTAV3[bcid])
-                    pr16.Fill(bcid,bcidTrigTAV4[bcid])
-                    pr17.Fill(bcid,bcidTrigTAV5[bcid])
-
-    itr.close()
-except Exception,e:
-    print "Reading data from",foldername,"failed:",e
-db.closeDatabase()
-
-fileName = "PerBcidMon_Run"
-fileName += str(run)
-fileName += ".root"
-tfile = TFile(fileName,"recreate")
-pr0.Write()
-pr1.Write()
-pr2.Write()
-pr3.Write()
-pr4.Write()
-pr5.Write()
-if doTrig:
-    pr6.Write()
-    pr7.Write()
-    pr8.Write()
-    pr9.Write()
-    pr10.Write()
-    pr11.Write()
-    pr12.Write()
-    pr13.Write()
-    pr14.Write()
-    pr15.Write()
-    pr16.Write()
-    pr17.Write()
-subdir = tfile.mkdir("LbHists")
-subdir.cd()
-for h in lbHistList:
-    h.Write()
-
-tfile.cd()
-bb.Write()
-tfile.Close()
-
-#            bcidDeadLow = []
-#            bcidDeadHigh = []
-#            print "Found lb",lb,turnCount,"turns",len(blobHigh),"bytes in blob"
-#            byteNum = int(0)
-#            counter = int(0)
-#            for byte in blobLow:
-#                counter |= (byte << (byteNum%3)*8)
-#                if (byteNum%3) == 2:
-#                    bcidDeadLow.append(counter)
-##                    bcidDeadLow.append(float(counter) / float(turnCount))
-#                    counter = int(0)
-#                byteNum += 1
-
-#            byteNum = int(0)
-#            counter = int(0)
-#            for byte in blobHigh:
-#                counter |= (byte << (byteNum%3)*8)
-#                if (byteNum%3) == 2:
-#                    bcidDeadHigh.append(float(counter) / float(turnCount))
-#                    counter = int(0)
-#                byteNum += 1
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_cool_plot.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_cool_plot.py
deleted file mode 100755
index 7aac9cc05a7d3a3acba5a2d04e4362bc8c8b27c4..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_cool_plot.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# L1CT crew, Johan.Lundberg@cern.ch, CERN, 2009
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " Make and draw CTPMON cool histograms "
-    print " "
-    print " Mandatory: "
-    print "  --inputfile | -i <filename>      A .py.obj with parsed cool data"    
-    print " "
-    print " Switches: "
-    print " "
-    print "  --outbase | -o <outname>    filename base for output files"     
-    print "  --nodraw <options (read busy_cool_reader.py for info.)> "
-
-try:
-    longopts=['inputfile=','i=','help','text','nodrawHist'
-              'outbase=','nodraw=']
-    opts,args=getopt.getopt(sys.argv[1:],'i:o:',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-fname=""
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o in ('--inputfile','-i'):
-        fname=a
-if not fname:
-    usage()
-    sys.exit(2)
-
-## read file
-
-import busy_py
-busy_py.plotfile(fname,opts)
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_cool_reader.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_cool_reader.py
deleted file mode 100755
index 9689b7eb864c1a56214f36f23ed25a42e220e00d..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_cool_reader.py
+++ /dev/null
@@ -1,308 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " From COOL database, read busy information for specified"
-    print " lumi blocks"
-    print " "
-    print " Mandatory: "
-    print "  --run <runNo>              run number (single number), eg 131740"    
-    print " Note: If no run number is given, last run from cool is used."
-    print " "
-    print " Optional: "
-    print "  --lb <lb ranges>           lumi block(s)"
-    print "       (default='-', all lumiblocks) "
-    print "  --counters <names for busy objects>"
-    print "                             Supports comma separated Regular expressions for names"
-    print "       (default is to show all information ) "
-    print ""
-    print "  --overflows   allow inclusion of overflow information"
-    print "  --keepnames   do not use _lable records as names for rates"
-    print "  "
-    print "  --maxbins <nbins> Average records to limit the number of histogram bins."
-    print "                    Default is 400. Set to 0 for unlimited"
-    print "  "
-    print "  --nofillHist               do not Fill histograms"
-    print "  --nodrawHist               do not Draw histograms"
-    print "  --outbase | -o <filename>  Output base name "
-    print "       (default='busy_', note: _<runNo>.<extensions> are added)"
-    print " "
-    print "  --nodraw <opt1,opt2,...>"
-    print "    where opt: Log           don't draw Log plots"
-    print "               Lin           don't draw Lin plots"
-    print "               LB1D          don't draw 1D LB plots"
-    print ""
-    print "  --norunname                don't add run number to filenames"
-    print ""
-    print "  --dbid                     cool dbid for the rates information"
-    print "  --dbidLumi                 cool dbid for the Lumi information"
-    print " "
-    print " Text output controls:"
-    print "  --verbose                  Do print text results"
-    print "  --textsum                  verbose, without per-counter information"
-    print " "
-    print " "
-    print " Range specifications:"
-    print "   <lumiblockNo> and <counterNo> can be specified as single "
-    print "   numbers, or ranges like this: "
-    print "      syntax:  1,3,10-13   gives:   1,3,10,11,12,13 "
-    print "      syntax:  3,10-       gives:   3,10... "
-    print "      syntax:  50,-10      gives:   ...10,50      "
-    print "      syntax:  -           gives:   all  "
-    print "   for lumiblocks only: "  
-    print "      syntax:  L5          gives:   5 latest  "
-    print " "
-
-print "busy cool reader"
-try:
-    longopts=['norunname','run=','lb=','counters=',
-              'help','verbose','textsum','maxbins=','dbid=',
-              'outbase=','nofillHist','nodrawHist','keepnames','overflows']
-    opts,args=getopt.getopt(sys.argv[1:],'h',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-
-
-import l1ctpy
-# defaults:
-OPT={}
-OPT["--run"]=int(-1)
-OPT["--counters"]=['core_moni','ctpmi','out']
-OPT["--lb"]=l1ctpy.text_to_ranges("-"); 
-OPT["--maxbins"]=400
-OPT["--bcids"]=None
-OPT["--verbose"]=False
-OPT["--nofillHist"]=False
-OPT["--nodrawHist"]=False
-OPT["--textsum"]=False
-OPT["--keepnames"]=False
-OPT["--overflows"]=False
-OPT["--filename"]="busy_"
-OPT["--nodraw"]=""
-
-OPT["--dbid"]=l1ctpy.get_dbid_MONP()
-OPT["--dbidLumi"]=l1ctpy.get_dbid_COMP()
-
-OPT['--norunname'] = False
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--lb':                 
-        OPT["--lb"]=l1ctpy.text_to_ranges(a)
-    if o == '--outbase':                 
-        OPT["--filename"]=str(a)
-    if o == '--counters':
-        OPT["--counters"]=a.split(',')
-    if o == '--maxbins':
-        OPT["--maxbins"]=int(a)
-    if o in ['--dbid','--dbidLumi','--run']:
-        OPT[o]=a
-    if o == '--textsum':
-        OPT["--textsum"] = True
-        OPT["--verbose"] = True
-    if o == '--nofillHist':                 
-        OPT["--nofillHist"] = True
-        OPT["--nodrawHist"] = True
-    if o == '--nodraw':                 
-        OPT["--nodraw"] = OPT["--nodraw"] + str(a)
-    if o in ['--verbose',"--nodrawHist",'--keepnames','--overflows','--norunname']:
-        OPT[o]= True
-
-try:
-    OPT["--run"]=int(OPT["--run"])
-
-    if OPT["--run"] < 1:
-        print "No run specified, finding last run from cool"
-        OPT["--run"]=l1ctpy.get_current_run()
-except BaseException,e:
-    usage()
-    print e
-    raise ValueError("You must specify a single run number, not:",OPT["--run"])
-
-if not OPT['--norunname'] :
-    OPT["--filename"]+=str(OPT["--run"])
-    
-#+-------------------------------------------
-# Open databases and get the required folders
-#+-------------------------------------------
-
-busyRatefolder=l1ctpy.getCoolFolder(OPT["--dbid"] ,'/TRIGGER/LVL1/BUSYRATES')
-busyConffolder=l1ctpy.getCoolFolder(OPT["--dbid"] ,'/TRIGGER/LVL1/BUSYCONF')
-lbfolder=l1ctpy.getCoolFolder(OPT['--dbidLumi'] ,'/TRIGGER/LUMI/LBLB')
-
-
-LBs,TimeRanges=l1ctpy.getLbTimesMulti(lbfolder,OPT["--run"],OPT["--lb"])
-
-print OPT
-l1ctpy.showlbandtime(LBs,OPT)
-
-#+-------------------------------------------
-# Counter names
-#+-------------------------------------------
-
-import numpy
-
-dbstring=l1ctpy.get_dbid_MONP()
-
-# define a counter database. These are used directly as field names
-# (as defined in schema) , retrieved from cool
-counterdb=[]
-myspec = busyRatefolder.payloadSpecification()
-for x in reversed(myspec):    
-    # the name is called like this just to be able to use some
-    # methods developed for CTPIN and CTPMON
-    # if this is a label, skip it
-    if '_label' in x.name():
-        continue
-    tmp={}
-    tmp['CounterNr']=-1
-    tmp['ThresholdName']=x.name()
-    if not OPT['--overflows']:
-        if 'overflow' in x.name():
-            continue
-    counterdb.append(tmp)
-
-l1ctpy.filter_and_add_counternames(counterdb,OPT)
-
-
-
-
-#+--------------------------------------------
-# Define and apply a blob calculator function
-#+--------------------------------------------
-
-OPT['--RateTitle']='Run '+str(OPT["--run"])+ " : Busy Counter Rates, %" 
-
-import busy_py
-
-blobcalc=busy_py.ReadBusyRecord_detailed_Factory(OPT["--countersnames"],OPT["--verbose"])
-inTimeRanges,rates=busy_py.getBusyrates(busyRatefolder,TimeRanges,blobcalc)
-
-print "Read ",len(rates),"busy Rate records."
-
-if len(rates)<1:
-    print "No data found. Try a different run or a bigger LB range"
-    sys.exit(1)
-
-if OPT["--maxbins"]>0:
-    print "Averaging to limit the time bins to", OPT["--maxbins"]
-    inTimeRanges,rates=busy_py.timeAverage(inTimeRanges,rates,OPT["--maxbins"])
-
-#$for b in inTimeRanges:
-#$    print " TimeRange:",1e-9*b[0]-t0,1e-9*b[1]-t0," Duration",int(1e-9*(b[1]-b[0])) 
-
-
-#+------------------------------------
-# Modify the lables, some records have their lables in cool: 
-#+------------------------------------
-
-print "Selected Busy Counters are:", OPT["--countersnames"]
-
-busyCfg={}
-if not OPT["--keepnames"]:
-    #+-------------------------------------------
-    # Read the busy configuration, names and enabled:on/off
-    #+-------------------------------------------
-    try:
-        from PyCool import cool 
-        lbROV0=cool.ValidityKey((OPT["--run"]<<32)+2)   # lb 2 ->
-    #    lbROV1=cool.ValidityKey((OPT["--run"]+1)<<32-1) # lb 3
-        Cobj=busyConffolder.browseObjects(lbROV0,lbROV0,cool.ChannelSelection.all())
-        for tCobj in Cobj:
-            b={}
-            x=tCobj.payload()
-            b['identifier']=x["identifier"]
-            b['busyEnabled']=x["busyEnabled"]
-            b['description']=x["description"]
-            busyCfg[x["identifier"]]=b
-
-        # take info from anywhere in the run 
-        t0=TimeRanges[0][0] #first time
-        t1=TimeRanges[-1][1] #last time
-
-        obj=busyRatefolder.browseObjects(t0,t1,cool.ChannelSelection.all())
-        # get the first record:
-        obj.goToNext()
-
-        o=obj.currentRef()           # TODO: catch problems here
-        pl=o.payload()
-
-        # there's a record called the same as our current record, but with
-        # '_rate' replaced with '_label', we add that to the
-        # current name
-        for i,n in enumerate(OPT["--countersnames"]) :
-            lablecandidate=n
-            if lablecandidate in busyCfg:
-                newname=(busyCfg[lablecandidate]["description"]).strip()
-                if not busyCfg[lablecandidate]["busyEnabled"]:
-                    newname="(out:"+newname+")"
-                print "replacing name",OPT["--countersnames"][i],' with ',newname
-                OPT["--countersnames"][i]=newname
-                continue
-            lablecandidate=n.replace('_rate','_label')
-            if n == lablecandidate :
-                continue
-            if lablecandidate in pl:
-                newname=(pl[lablecandidate]).strip()
-                print "replacing name",OPT["--countersnames"][i],' with ',newname
-                OPT["--countersnames"][i]=newname
-
-    except BaseException,e:
-        print "No busy conf record found, going on without it (",e,")"
-
-if busyCfg:
-    print "Read ",len(busyCfg)," config objects"
-
-#+------------------------------------
-# find out which lb is in which monitoring block
-#+------------------------------------
-print "finding lb matches"
-lbmatches=[]
-for tt in inTimeRanges:
-    lbmatches.append(busy_py.compareranges(LBs,TimeRanges,tt))
-
-inblockLBs=[]
-for tt in inTimeRanges:
-#    print " data time range",tt
-#    print " in terms of lb: ",busy_py.time2lb(LBs,TimeRanges,tt)
-    inblockLBs.append(busy_py.time2lb(LBs,TimeRanges,tt))
-
-#+------------------------------------
-# Print to screen
-#+------------------------------------
-if OPT["--verbose"]:
-    #+------------------------------------
-    # find out which monitoring block is at what lb
-    #+------------------------------------
-    busy_py.showresults(inTimeRanges,rates,inblockLBs,OPT["--counters"],None,OPT["--textsum"])
-
-#+------------------------------------
-#+ Write output to python file
-#+------------------------------------
-print "making output python file"
-busy_py.savefile(OPT,inTimeRanges,rates,lbmatches,inblockLBs)
-
-#+------------------------------------
-#+ Fill histograms and make plots if requested
-#+------------------------------------
-print "making plots"
-if not OPT["--nofillHist"]:
-    busy_py.plot(OPT,inTimeRanges,rates,lbmatches,inblockLBs,opts)
-    
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_py.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_py.py
deleted file mode 100644
index 340444fbc06cc1777a1fa4ca403fc05bc2fc0daa..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/busy_py.py
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-if __name__ == "__main__":
-    print "Warning:"
-    print "   The busy_py module is meant to be executed."
-    print "      try busy_cool_reader.py "
-    print "       or busy_cool_plot.py "
-
-# this makes it easy to move functions and constants
-# from here to l1ctpy
-from l1ctpy import *
-
-#+================================================================
-#+
-#+ BUSY specific functions for reading and parsing data
-#+
-#+ Note, most is als used for CTPIN data
-#+
-#+================================================================
-
-#+ -------------------------------------------------------------
-#+ Factory function, returns full information for the specified ranges.
-#+ produced function Returns a list 
-#+   index goes over the selected conters
-def ReadBusyRecord_detailed_Factory(counters,verbose=False):
-    import struct
-    if verbose:
-        print "Contructing record calculator for:"
-        print "  counters   : ",counters
-    if(len(counters)<1):
-        raise ValueError("can't handle empty counter range")
-    def Record_calc(payload,downscaling=1.0):
-        " Reads a record at given counter. Returns selected counter values. "
-        # output vector of empty vectors
-        record=[]        
-        for counter in counters:
-            record.append(payload[counter])
-        return record
-    return Record_calc
-
-
-#+ -------------------------------------------------------------
-#+ returns requested rates 
-#+ times should be a list of (start,stop) time tuples, eg from getLbTimes
-#+ Output is a list of (start,stop) tuples for the record ROVs
-#+ and the correspondig output from the record calculator
-#+  when strict=True accept only records completely within
-#+  the lb range 
-def getBusyrates(folder,times,recordcalc,strict=True):
-    from PyCool import cool
-    records=[]
-    StopTimes=[]
-    StartTimes=[]        
-    oldpersentage=""
-    for t,t_i in zip(times,range(len(times))):
-        dir(cool)
-        dir(folder)
-        obj=folder.browseObjects(t[0],t[1],cool.ChannelSelection.all())
-        persentage=((100.0*(t_i+1))/len(times))//10
-        if not persentage == oldpersentage:
-            print 'reading counter records, %3.0f %%' % (100*(t_i+1)/len(times))
-            oldpersentage=persentage
-        for o in obj:
-            payload=o.payload()
-            starttime=o.since()
-            if starttime in StartTimes :
-                pass
-            else:
-                if strict:
-                    if starttime<times[0][0] or o.until()>times[-1][1]:
-                        continue
-                StartTimes.append(starttime)
-                StopTimes.append(o.until())                
-                thissum=recordcalc(payload)
-                records.append(thissum)             
-    return zip(StartTimes,StopTimes),records
-
-#+================================================================
-#+
-#+ BUSY specific functions for saving, loading, histogramming 
-#+ and drawing record data
-#+
-#+================================================================
-
-#+ -------------------------------------------------------------
-#+ Display BUSY cool data as returned by getINrates
-#+ inblockLBs should of the format returned by time2lb()
-def showresults(inTimeRanges,rates,inblockLBs,counters,textsum=False,textbc=False):
-    import operator
-    print "printing results:" 
-    for tt,rr,busy_i in zip(inTimeRanges,rates,range(len(rates))):
-        print "counter data time range: ",tt ," seconds: ", '%.1f' % ((tt[1]-tt[0])*1e-9)
-        print "in terms of Lumiblocks:", '%.1f' % inblockLBs[busy_i][0] ,'to', '%.1f' % inblockLBs[busy_i][1]
-        sums=map(lambda _:0,rr)
-        for r,i in zip(rr,range(len(rr))):
-            sums[i]=reduce(operator.add,r)
-            if not textsum:
-                if textbc:
-                    print "  counter:",counters[i],", rate: ",r
-                print "  counter:",counters[i],", sum:  ",sums[i]
-        print "    total:", reduce(operator.add,sums)
-
-#+ -------------------------------------------------------------
-#+ Same the results of the record reading to a python picke object file
-#+ OPT should contains some fields, read below.
-def savefile(OPT,inTimeRanges,rates,lbmatches,inblockLBs):
-    import pickle
-    try:
-        fname=OPT["--filename"] + '_py.obj'
-        dumpfile=open(fname,'w')
-        contents={}
-        contents['inTimeRanges']=inTimeRanges
-        contents['rates']=rates
-        contents['lbmatches']=lbmatches
-        contents['inblockLBs']=inblockLBs
-        contents['OPT']=OPT
-        pickle.dump(contents,dumpfile)
-        dumpfile.close()
-        print "Saved results to:",fname
-    except:
-        print "File save failed. Filename:",fname
-
-
-#+ -------------------------------------------------------------
-#+ Histogram and plot the contents of a saved python pickle file
-#  options:
-#    print "  --outbase | -o <outname>  path base for output files"     
-#    print "  --nodraw                    make histograms, do not draw"
-#    print "  --verbose                   Display full data"
-def plotfile(fname,opts=[[0,0]]):
-    import pickle
-    dumpfile=open(fname,'r')
-    contents=pickle.load(dumpfile)
-    inTimeRanges=contents['inTimeRanges']
-    rates=contents['rates']
-    lbmatches=contents['lbmatches']
-    OPT=contents['OPT']
-    inblockLBs=contents['inblockLBs']
-    dumpfile.close()
-    OPT["--nodrawhist"]=False
-    OPT["--nomakehist"]=False
-    for o,a in opts:
-        if o in ('--nodrawHist'):
-            OPT["--nodrawHist"]=True
-        if o in ('--outbase','-o'):
-            OPT["--filename"]=a
-        if o in ('--text'):
-            OPT["--text"]=True
-
-    if "text" in OPT:
-        OPT["--textbc"]=True
-        showresults(inTimeRanges,rates,inblockLBs,OPT["--counters"],OPT["--textsum"])
-    
-    plot(OPT,inTimeRanges,rates,lbmatches,inblockLBs,opts)
-    
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/check_ctp_deadtime.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/check_ctp_deadtime.py
deleted file mode 100755
index dc5fd94ad9bc83a9572cd6d25784a6a862ece3b3..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/check_ctp_deadtime.py
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-import sys,getopt,os
-from PyCool import cool,coral
-from CoolConvUtilities import AtlCoolTool
-from ROOT import TH1F, TFile, TProfile, TObject, TGraph, gROOT
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help        this printout"
-    print "  --run <runNo> run number"
-    print "  --file <name> Input file"
-
-
-try:
-    longopts=['run=','file=','help']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-lbList={}
-run=int(-1)
-inFile=''
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--run':
-        run = int(a)
-    if o == '--file':
-        inFile = str(a)
-
-if (run == -1 or inFile == '') : 
-    usage()
-    sys.exit(2)
-
-# get database service and open database
-dbSvc=cool.DatabaseSvcFactory.databaseService()
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user="+dbuser+";password="+dbpw
-#olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-
-try:
-    db=dbSvc.openDatabase(dbstring,False)
-except Exception,e:
-    print e
-    sys.exit(-1)
-
-lbDurations = TH1F("lbDurations",";LB Duration (s);Entries",10*40,100,140)
-
-# set folders all run-event index
-# AthenaAttributeList as type 0, CondAttributeList collection as type 1
-# timestamp for folders bit 1
-
-lblb_foldername='/TRIGGER/LUMI/LBLB'
-
-if not db.existsFolder(lblb_foldername) :
-    print "Folder",lblb_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-         
-folder=db.getFolder(lblb_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        lb=int(obj.since() & 0xffff)
-        # only accept lumi blocks at least 20 seconds long
-        if (long(payload['EndTime']) - long(payload['StartTime'])) > 20e9 :
-            lbList[lb] = [long(payload['StartTime']), long(payload['EndTime'])]
-            lbDurations.Fill((long(payload['EndTime'])-long(payload['StartTime']))/1e9)
-            startString = AtlCoolTool.time.ctime(payload['StartTime']/1E9)
-            endString = AtlCoolTool.time.ctime(payload['EndTime']/1E9)
-
-            print "LB",lb,"duration",(long(payload['EndTime'])-long(payload['StartTime']))/1e9,startString,endString
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-#print lbList
-
-db.closeDatabase()
-
-tagComm = TFile(inFile,'read')
-gROOT.cd()
-tree = tagComm.Get('POOLCollectionTree')
-
-br1 = tree.GetBranch('LumiBlockN')
-br2 = tree.GetBranch('EventTime')
-br3 = tree.GetBranch('EventTimeNanoSec')
-
-deltaTStart = TH1F("deltaTStart",";#DeltaT (ms);Events",1000, 0, 2000)
-deltaTStop = TH1F("deltaTStop",";#DeltaT (ms);Events",1000, 0, 2000)
-
-lbWiseHists = {}
-for event in range(tree.GetEntries()):
-#for event in range(500000):
-    if not event%100000: print "Event",event
-    br1.GetEntry(event)
-    br2.GetEntry(event)
-    br3.GetEntry(event)
-    sec = br2.GetLeaf('EventTime').GetValue()
-    nsec = br3.GetLeaf('EventTimeNanoSec').GetValue()
-    eventTime = long(sec*1e9 + nsec)
-    lumiBlock = int(br1.GetLeaf('LumiBlockN').GetValue())
-    try:
-        start = lbList[lumiBlock][0]
-        end = lbList[lumiBlock][1]
-        deltaTStart.Fill((eventTime-start)/1e6)
-        deltaTStop.Fill((end-eventTime)/1e6)
-        try:
-            lbWiseHists[lumiBlock].Fill((eventTime-start)/1e6)            
-        except KeyError:
-            lbWiseHists[lumiBlock] = TH1F("deltaTStart_lb" + str(lumiBlock),";#DeltaT (ms);Events",1000, 0, 2000)
-            lbWiseHists[lumiBlock].Fill((eventTime-start)/1e6)            
-    except KeyError:
-        pass
-
-ofile = TFile("outfile.root","recreate")
-deltaTStart.Write()
-deltaTStop.Write()
-lbDurations.Write()
-for index in lbWiseHists: lbWiseHists[index].Write()
-ofile.Close()
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_plot_lvl1rates.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_plot_lvl1rates.py
deleted file mode 100755
index eec6f4ccd7a7534ec32d6c7a8593ba7aec71fc1f..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_plot_lvl1rates.py
+++ /dev/null
@@ -1,496 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# L1CT crew, Johan.Lundberg@cern.ch, CERN, 2010
-#
-# Reads histogram created by cool_read_lvl1rates.py
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " --counters List,Of,Regular,Expressions    To force exact match, "
-    print "                                           use something like L1_EM3$ " 
-
-    print " --vetos list,Of,Regular,Expressions       Excluded after matched by --counters pattern"
-    print " --norunname                               no run name for output plot"
-    print " --outbase                                 base name for plot file name"
-    print " --maxcurves (default 10)                  maximum number of curves per plot" 
-    print " --maxpads (default 5)                     skip all pads after maxpad"
-    print " --oneplot                                 force all curves to go into one single plot"
-    print " --lb lumiblock range                                  "
-    print " --TAV --TAP --TBP                         show only one of TAV,TAP,TBP"
-    print " --magnitudes X                            number of magnitudes shown (max*10**-X -> min)"
-    print " --forcetitle text                         Set plot tile to this"        
-    print " "
-    print " Mandatory: "
-    print "  --inputfile | -i <filename>              A .root file "    
-    print " --timeshift hours                         shift times [to change timezone] "
-    print " "
-    print " example: "
-    print " cool_read_lvl1rates.py --run 152166 --fillHist"
-    print " cool_plot_lvl1rates.py -i RUN_152166_hist.root --counters MBTS_1$,L1_LUCID_A$,L1_EM3$,ZDC_A$ --TAV --outbase TAV --forcetitle 'L1 TAV Item rates [Hz]'"
-    
-
-    
-try:
-    longopts=['inputfile=','i=','help','counters=','vetos=','maxcurves=','oneplot',
-              'outbase=','norunname','maxpads=','magnitudes=','forcetitle=','lb=','TAV','TAP','TBP']
-    opts,args=getopt.getopt(sys.argv[1:],'i:o:',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-# root is silly as usual and tries to read argv for whatever and gives warnings
-sys.argv[1:]=[]
-
-fname=""
-vetos=[]
-patterns=["TAV"]
-import l1ctpy
-maxcurves=10
-maxpads=5
-skipcurves=0
-lbrange='-'
-prepattern=""
-BaseName="L1_Items_"
-DoRunName=True
-oneplot=False
-magnitudes=3.5 # orders of magnitude in each plot
-forcetitle=False
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o in ('--inputfile','-i'):
-        fname=a
-    if o in ('--vetos'):
-        vetos=l1ctpy.text_to_ranges(a)
-        vetos=l1ctpy.expandlist(vetos,0,256-1)
-    if o in ('--counters'):
-        patterns=l1ctpy.text_to_ranges(a)
-        patterns=l1ctpy.expandlist(patterns,0,256-1)
-    if o in ('--maxcurves'):
-        maxcurves=int(a)
-    if o in ('--maxpads'):
-        maxpads=int(a)
-    if o in ('--skipcurves'):
-        skipcurves=int(a)
-    if o in ('--outbase'):
-        BaseName=str(a)
-    if o in '--lb' :
-        lbrange=a
-    if o in '--norunname' :
-        DoRunName=0
-    if o in '--TAP' :
-        prepattern="TAP"
-    if o in '--TAV' :
-        prepattern="TAV"
-    if o in '--TBP' :
-        prepattern="TBP"
-    if o in '--oneplot' :
-        oneplot=True
-    if o in '--magnitudes' :
-        magnitudes=float(a)
-    if o in '--forcetitle' :
-        forcetitle=a
-
-if oneplot:
-    maxpads=1
-    maxcurves=1e9
-        
-if not fname:
-    usage()
-    sys.exit(2)
-
-## read file
-lbrange=l1ctpy.text_to_ranges(lbrange)
-if len(lbrange)>1:
-    print "sorry, can not treat composit LB range :",lbrange
-    sys.exit(1)
-
-
-import ROOT
-ROOT.gStyle.SetFrameFillColor(0);
-#ROOT.gStyle.SetFillColor(2);
-ROOT.gROOT.ForceStyle();
-ROOT.gStyle.SetOptStat(0);
-
-#fname='RUN_149158_hist.root'
-
-ROOT.gStyle.SetCanvasBorderMode(0);
-#ROOT.gStyle.BorderColor(1);
-ROOT.gStyle.SetOptTitle(1);
-ROOT.gStyle.SetTitleBorderSize(0)
-ROOT.gStyle.SetTitleFillColor(0)
-
-    
-# find run number
-f = ROOT.TFile(fname)
-runhist=f.FindObjectAny("RunNR")
-runnr=int(0.1+runhist.Integral())
-
-#print runnr
-
-# make full list of root histograms
-
-histos=set()
-for thisdir in f.GetListOfKeys():
-    try:
-        for i in f.GetDirectory(thisdir.GetName()).GetListOfKeys():
-#            histos.add(thisdir.GetName()+"/"+i.GetName())
-            histos.add(i.GetName())                
-    except AttributeError:
-        pass
-
-histos=list(histos)
-histos.sort()
-#print histos
-#print patterns
-newpat=[]
-for p in patterns:
-    if p:
-        newpat.append(prepattern+".*"+p)
-patterns=newpat
-
-def finditems(histos,patterns,vetos):
-    import re
-    import operator
-    myvetos=vetos+['TimeGraph']
-    def selector(x):
-        return (re.match('.*ctpid.*Item_L1.*',x) and
-                max(map(lambda thisrule :bool(re.match(".*"+thisrule+".*",x)),patterns)) and not
-                max(map(lambda thisrule :bool(re.match(".*"+thisrule+".*",x)),myvetos)))
-    out=filter(selector , histos)    
-    return filter(selector, out)
-
-
-# sort all histograms base on their maximum bin content
-#print histos
-#print patterns
-histos=finditems(histos,patterns,vetos)
-
-    
-def sortkey(thisname):
-    thisobj=f.FindObjectAny(thisname)
-    if 'ROOT.TH' in str(thisobj):
-#        print "For curve: ", thisobj.GetName(), " peak rate :", thisobj.GetBinContent(thisobj.GetMaximumBin()), "at lb", thisobj.GetXaxis().GetBinCenter(thisobj.GetMaximumBin())
-        return [str(thisobj)[:9],-thisobj.GetBinContent(thisobj.GetMaximumBin())]
-    
-    else:
-        return [str(thisobj)[:9],-thisobj.GetMaximum()]
-
-histos.sort(key=sortkey)
-
-import math
-
-def find_groupcurves():
-    istart=0
-    i=istart
-    selected=[]
-    for itm in histos:
-        if i == istart:
-            scalemax=0
-            scalemin=1e15
-        thisobj=f.FindObjectAny(itm)
-        if 'ROOT.TH' in str(thisobj):
-            i+=1
-            this_scalemax=thisobj.GetBinContent(thisobj.GetMaximumBin())
-            forcenewscale=0
-            print "Considering: %-40s min %.1e max %.1e " % (thisobj.GetName(), this_scalemax, scalemax)
-            if this_scalemax == 0 :
-                print "skipping",thisobj.GetName()
-                break
-            if scalemax and this_scalemax < scalemax/1e1:
-                forcenewscale=1
-            scalemax=max(scalemax,this_scalemax)
-            if (i-istart)>=maxcurves or forcenewscale:
-                scalemin=min(scalemin,thisobj.GetMinimum())
-                scalemin=min(scalemin,scalemax*.1)    
-                scalemax=scalemax*1.07
-                scalemin=max(scalemin*.9,scalemax*math.pow(10,-magnitudes))
-                scalemax=max(scalemax,11*scalemin)
-
-                if oneplot and selected:
-                    selected[0][1]=i; #[[selected[0][0] ,i,scalemin,selected[0][3]]]                   
-                else:
-                    selected.append([istart ,i,scalemin,scalemax])
-                    istart=i
-                
-
-    return selected
-
-groupcurves= find_groupcurves()
-#print groupcurves
-
-if (maxpads>0):
-    groupcurves=groupcurves[:maxpads]
-#groupcurves=groupcurves[:5]
-iloop=0
-thisname=BaseName
-if DoRunName:
-    thisname+=str(runnr)
-
-c1=ROOT.TCanvas(thisname, thisname,100,100,900,260*max(1,len(groupcurves)))
-c1.SetRightMargin(0.00)
-c1.SetLeftMargin(0.1)
-c1.SetTopMargin(0.15)
-c1.Divide(1,len(groupcurves),0.00,0.05)
-#$,0.1,0.2)
-#print len(groupcurves)
-#sys.exit()
-legends=[]
-
-c1.cd(0)
-def cleanstrlist(inlist):
-    return str(inlist).replace("'.*",'').replace(".*'",'').replace('[','').replace(']','').replace("'",'')
-
-if forcetitle:
-    titlename=forcetitle
-else:
-    titlename="   L1 Item Rates: "+cleanstrlist(patterns)
-if vetos:
-    titlename+=" (skipping: "
-    titlename+=cleanstrlist(vetos)
-    titlename+=")"
-if groupcurves:
-    ypoint=1-0.08/len(groupcurves)
-    fudgedown=(min(5,len(groupcurves)))
-else:
-    ypoint=0
-    fudgedown=1
-mytext=ROOT.TLatex(.02,ypoint,titlename)
-mytext.SetTextSize(3.5*.027/fudgedown)
-mytext.SetNDC()
-mytext.Draw()
-
-def refill_to_timescale(inhist):
-
-
-    timelb=f.FindObjectAny("LumiBlocks")                
-                        
-    nbins=timelb.GetNbinsX()
-    if not nbins == inhist.GetNbinsX():
-        print "Sorry, Time axis does not have the same number of bins as lb axis" 
-        sys.exit(1)
-
-    import random
-    randname="%x"%int(1e10*random.uniform(0,1))
-    outhisttime=timelb.Clone()    
-    outhisttime.SetName(randname)
-    outhisttime.SetTitle(inhist.GetTitle())
-    for i in range(nbins+1):
-        outhisttime.SetBinContent(i,inhist.GetBinContent(i))
-
-    return outhisttime
-
-timelb=f.FindObjectAny("LumiBlocks")
-lbaxis=range(1,1+timelb.GetNbinsX())
-timeaxis=[]
-root_axis=timelb.GetXaxis()
-for i in lbaxis:
-    timeaxis.append(root_axis.GetBinLowEdge(i))
-#    print root_axis.GetBinLowEdge(i)
-
-#print groupcurves
-
-lbrange=l1ctpy.expandlist(lbrange,1,lbaxis[-1])
-#print lbrange
-# # Work out LB axis ranges in terms of time:
-
-timelow=timeaxis[0]         # default is to cover the whole range
-timehigh=timeaxis[-1]
-
-lbrange=[lbrange[0],lbrange[-1]]
-#print lbrange
-import time
-if lbrange[0]:
-    for t,l in zip(timeaxis,lbaxis):
-        if l<=lbrange[0]:
-            timelow=t
-        else:
-            break
-if lbrange[1]:
-    for t,l in zip(timeaxis,lbaxis):
-        if lbrange[1]==l:
-            timehigh=t
-            break
-
-#print timelow,timehigh
-#print lbrange
-#if timelow: print time.localtime(timelow)
-#if timehigh: print time.localtime(timehigh)
-
-#sys.exit()
-#groupcurves=[[0, 9, 6.4990850753784185e-04, 80.990850753784187]]
-
-
-memkeep=[]
-for istart,istop,scalemin,scalemax in groupcurves:
-
-    iloop+=1
-    first=1
-#    c1=ROOT.TCanvas(thisname, thisname,100,100,900,300)
-    c1.cd(iloop)
-    c1.SetLogy()
-    c1.SetTopMargin(0.08)
-
-#    ROOT.gStyle.SetLabelFont(63);
-#    ROOT.gROOT.ForceStyle()
-
-    ROOT.gPad.SetBottomMargin(0.13)
-    ROOT.gPad.SetLeftMargin(0.05)
-    ROOT.gPad.SetRightMargin(0.25)
-    ROOT.gPad.SetTopMargin(0.1)
-    #    ROOT.gPad.SetTopMargin(0.0)
-    #if iloop==1 and first==1:
-    #
-    #        ROOT.gPad.SetBottomMargin(0)
-    ROOT.gPad.SetLogy(1)
-    tleg=ROOT.TLegend(0.76,0.15,1,0.95)
-    tleg.SetFillStyle(0)
-    tleg.SetBorderSize(0)
-    legends.append(tleg)
-    plotstyles=[]
-    # thick color style bgcolor bcstyle
-
-    i=0
-    icount=0
-    for itm in histos:
-        baseplot=None
-    #    print itm
-        thisobj=f.FindObjectAny(itm)
-        if 'ROOT.TH' in str(thisobj):
-
-            thisobj=refill_to_timescale(thisobj)
-            memkeep.append(thisobj)
-                        
-            icount+=1
-            if icount<=istart:
-                i=0
-                first=1
-                continue
-            #print thisobj.GetTitle()
-            plotstring="_"
-            thisobj.SetStats(0)
-            if i==6:
-                i+=1
-            lw=2+((i+2)%2)
-            lc=1+((i)%9)
-            ls=1
-            thisobj.SetFillStyle(0)
-            if 1:
-                if lc == 5:
-                    lc=14
-                ls=1+int((i/6))
-                if not i == 0 and lc == 1:
-                    lc=32
-                if not (i)%3 :            
-                    if not i:
-                        thisobj.SetFillStyle(1001)
-                        thisobj.SetFillColor(lc)
-                        lw=lw/2
-                        ls=1
-                    elif not i%2 :
-                        pass
-                    #thisobj.SetFillStyle(3115)
-                    else:
-                        lw=lw/2
-                        thisobj.SetFillStyle(3004+(i%5)%2)
-                        thisobj.SetFillColor(lc)
-                        ls=1
-
-                if ls==1 and i>1:
-                    lw=1
-                    
-                if thisobj.GetFillStyle()>0:
-                    ls=1
-                    lw=1
-                
-#                print ls,lw,thisobj.GetFillStyle()
-                thisobj.SetLineWidth(lw)
-                thisobj.SetLineColor(lc)
-                thisobj.SetLineStyle(ls)
-                
-#                if thisobj.GetFillStyle()>3000:
-#                    thisobj.SetLineStyle(0)
-#                    thisobj.SetLineWidth(0)
-
-
-            i+=1
-
-            if first:
-
-                baseplot=thisobj.Clone("hejsan")
-                baseplot.Reset()
-                baseplot.Clear()
-                baseplot.SetMaximum(scalemax)
-                baseplot.SetMinimum(scalemin)
-                #baseplot.GetXaxis().SetRangeUser(160, 250);
-                baseplot.GetXaxis().SetLabelSize(.08)
-
-                # convert number of seconds [in terms of localtime] to number of seconds
-                # in UTC:
-                import time
-                # NOTE - this gives a DT time that is only correct up to the hour::min, not the time and date
-                DT=(time.mktime(time.gmtime(int(timelow))[0:-1]+(-1,))-int(timelow))
-                print "applying time zone and daylight time diff:",DT," seconds"
-
-                
-                baseplot.GetXaxis().SetTimeOffset(ROOT.gStyle.GetTimeOffset()+DT)
-                baseplot.GetXaxis().SetLabelSize(.07)
-                baseplot.GetYaxis().SetLabelSize(.07)
-                baseplot.GetXaxis().SetLabelOffset(.02)
-                baseplot.GetYaxis().SetLabelOffset(.00)
-                baseplot.GetYaxis().SetTitle("")
-                baseplot.GetXaxis().SetTitle("UTC Time")
-                baseplot.GetXaxis().SetTitleOffset(1)
-                baseplot.GetXaxis().SetTitleSize(.06)
-                baseplot.GetYaxis().SetTitleOffset(.0)
-                baseplot.SetTitle("")
-                baseplot.GetXaxis().SetRangeUser(timelow,timehigh);
-                # baseplot.GetXaxis().SetRangeUser(160, 250);
-                baseplot.DrawCopy("")
-#                if iloop==1:
-                l1ctpy.drawaxis_timeLB(baseplot,timeaxis,lbaxis,1,1.7)
-                                
-            thisobj.GetXaxis().SetRangeUser(timelow,timehigh);
-            thisobj.Draw("same")
-
-
-            nicetitle=thisobj.GetTitle()
-            nicetitle=nicetitle[(3+nicetitle.rfind('L1_')):]    
-            thisfs=thisobj.GetFillStyle()
-            # workaround for bug in root painting mode (for no x-display)
-            if thisfs>1000:
-                tleg.AddEntry(thisobj,nicetitle,"F")
-            else:
-                tleg.AddEntry(thisobj,nicetitle,"L")
-            first=0
-            if icount==istop:
-                tleg.Draw()
-                c1.SetLogy(1)
-                
-                legends.append(mytext)
-
-                break
-
-if not groupcurves:
-    ROOT.gPad.SetBottomMargin(0.13)
-    ROOT.gPad.SetLeftMargin(0.05)
-    ROOT.gPad.SetRightMargin(0.25)
-    ROOT.gPad.SetTopMargin(0.1)
-    h=ROOT.TH1F()
-    h.Draw("A")
-    tl=ROOT.TLatex(0.2,0.2,"sorry - no data")
-    tl.Draw()
-
-c1.Print(thisname+".png")            
-            
-        #for thisobj in f.FindObject(thisdir.GetName).GetListOfKeys():
-        #    print thisobj.GetName()
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_livetime.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_livetime.py
deleted file mode 100755
index ea7f9c4ff4ebd5ff2297c403ea9464776ca0a322..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_livetime.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-# TODO: check for overflows of counters!
-# TODO: option to print out counters instead of rates
-
-import sys,getopt,os
-from PyCool import cool,coral
-from CoolConvUtilities import AtlCoolTool
-from ROOT import TH1F, TFile, TProfile, TObject, TGraph
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                this printout"
-    print "  --run <runNo>                         run number"
-    print "  --lb <lb1>-<lb2>,<lb3>-<lb4>,         Range of LBs"
-
-
-try:
-    longopts=['run=','lb=','item=','help']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-lbList=[]
-run=int(-1)
-liveTime = 0
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--run':
-        run = int(a)
-    if o == '--lb':
-        list1 = str(a).split(',')
-        for i in list1:
-            list2 = i.split('-')
-            if len(list2) > 1 : lbList += range(int(list2[0]),int(list2[1])+1)
-            else : lbList.append(int(list2[0]))
-
-if (run == -1) : 
-    usage()
-    sys.exit(2)
-
-# get database service and open database
-dbSvc=cool.DatabaseSvcFactory.databaseService()
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user="+dbuser+";password="+dbpw
-#olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-
-try:
-    db=dbSvc.openDatabase(dbstring,False)
-except Exception,e:
-    print e
-    sys.exit(-1)
-
-# set folders all run-event index
-# AthenaAttributeList as type 0, CondAttributeList collection as type 1
-# timestamp for folders bit 1
-
-lblb_foldername='/TRIGGER/LUMI/LBLB'
-
-if not db.existsFolder(lblb_foldername) :
-    print "Folder",lblb_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-         
-folder=db.getFolder(lblb_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        lb=(obj.since() & 0xffff)
-
-        if lb in lbList:
-            liveTime += 1e-9*(payload['EndTime'] - payload['StartTime'])
-            
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-print "Live time",liveTime,"s"
-
-db.closeDatabase()
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_lvl1rates.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_lvl1rates.py
deleted file mode 100755
index b4e1ac5f3d82b8edb11194c7caf24781d1075713..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_lvl1rates.py
+++ /dev/null
@@ -1,486 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-# TODO: check for overflows of counters!
-# TODO: option to print out counters instead of rates
-
-import sys,getopt,os, math
-from PyCool import cool,coral
-from CoolConvUtilities import AtlCoolTool
-from ROOT import TH1F, TH1D,TFile, TProfile, TObject, TGraph
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                this printout"
-    print "  --run <runNo>                         run number"
-    print "  --item <name>                         item name - 'ALL' for all items"
-    print "  --itemList <i1>,<i2>,...              comma separated list of item names"
-    print "  --ctpid <id>                          use ctpid of item instead of name - '-1' for all items"
-    print "  --ctpidRange <i1>-<i2>,<i3>-<i4>      range of ctpids "
-    print "  --enabledItems                        print all items enabled at L1"
-    print "  --printNumbers                        print number of triggers"
-    print "  --printRates                          print trigger rates"
-    print "  --printSummary                        just print summary per item"
-    print "  --fillHist                            fill histograms of rate vs. LB"
-
-    print "  example for making a plot: "
-    print "   cool_read_lvl1rates.py --run 152166 --fillHist"
-    print "   cool_plot_lvl1rates.py -i RUN_152166_hist.root --counters MBTS_1$,L1_LUCID_A$,L1_EM3$,ZDC_A$ --TAV --outbase TAV"
-
-try:
-    longopts=['run=','ctpid=','item=','help','printNumbers','printRates','itemList=','ctpidRange=','fillHist','printSummary','enabledItems']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-lb1=int(0)
-lb2=int(0)
-debug=bool(False)
-ctpid=int(-2)
-ctpidRange=[]
-itemName="ALL"
-itemList=[]
-run=int(-1)
-printRates=False
-printNumbers=False
-fillHist=False
-printSummary=False
-orbitFreq = 40.0790e6 / 3564.
-enabledItems = False
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--run':
-        run = int(a)
-    if o == '--item':
-        itemName = str(a)
-    if o == '--itemList':
-        itemName = ''
-        itemList = str(a).split(',')
-    if o == '--ctpid':                 
-        itemName = ''
-        ctpid = int(a)
-    if o == '--ctpidRange':
-        itemName = ''
-        list1 = str(a).split(',')
-        for i in list1:
-            list2 = i.split('-')
-            ctpidRange += range(int(list2[0]),int(list2[1])+1)
-    if o == '--printNumbers':
-        printNumbers = True
-    if o == '--printRates':
-        printRates = True
-    if o == '--printSummary':
-        printSummary = True
-    if o == '--fillHist':
-        fillHist = True
-    if o == '--enabledItems':
-        enabledItems = True
-
-if not printSummary and not printRates and not printNumbers:
-    printSummary = True
-
-if (run == -1) : 
-    usage()
-    sys.exit(2)
-
-if printNumbers and printRates :
-    print "Both arguments 'printNumbers' and 'printRates' given, print only rates"
-    printNumbers = False
-
-    print
-    print "------------------------------------"
-    print "Run",run
-    print "------------------------------------"
-    print
-
-# get database service and open database
-dbSvc=cool.DatabaseSvcFactory.databaseService()
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user="+dbuser+";password="+dbpw
-#olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-#dbstring="sqlite://;schema=/afs/cern.ch/user/b/berge/trash/ctp.LBData.1190647872.sqlitefile.db;dbname=L1CTCOOL"
-
-try:
-    db=dbSvc.openDatabase(dbstring,False)
-    if (debug) : print "Opened database",dbstring
-except Exception,e:
-    print e
-    sys.exit(-1)
-
-# set folders all run-event index
-# AthenaAttributeList as type 0, CondAttributeList collection as type 1
-# timestamp for folders bit 1
-
-lvl1counters_foldername='/TRIGGER/LUMI/LVL1COUNTERS'
-lvl1menu_foldername='/TRIGGER/LVL1/Menu'
-lvl1lbdata_foldername='/TRIGGER/LVL1/CTPCORELBDATA'
-lblb_foldername='/TRIGGER/LUMI/LBLB'
-l1ps_fname = '/TRIGGER/LVL1/Prescales'
-
-if not db.existsFolder(lvl1counters_foldername) :
-    print "Folder",lvl1counters_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lvl1menu_foldername) :
-    print "Folder",lvl1menu_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lvl1lbdata_foldername) :
-    print "Folder",lvl1lbdata_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lblb_foldername) :
-    print "Folder",lblb_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(l1ps_fname) :
-    print "Folder",l1ps_fname,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-         
-items=[""]*256
-L1As=[]
-L1ATurns=[]
-TAVs=[]
-TAPs=[]
-TBPs=[]
-TAVsOl=[]
-TAPsOl=[]
-TBPsOl=[]
-TAVTurns=[]
-TAPTurns=[]
-TBPTurns=[]
-LBs=[]
-startTimes=[]
-endTimes=[]
-l1ps_dict={}
-
-folder=db.getFolder(lvl1menu_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        itemNo=obj.channelId()
-        payload=obj.payload()
-        items[itemNo] = payload['ItemName']
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1menu_foldername,"failed:",e
- 
-folder=db.getFolder(lvl1lbdata_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        L1As.append(payload['GlobalL1AcceptCounter'])
-        L1ATurns.append(payload['GlobalL1AcceptTurnCounter'])
-        TAVTurns.append(payload['L1AcceptTurnCounter'])
-        TAPTurns.append(payload['AfterPrescaleTurnCounter'])
-        TBPTurns.append(payload['BeforePrescaleTurnCounter'])
-            
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-folder=db.getFolder(lblb_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        startTimes.append(payload['StartTime'])
-        endTimes.append(payload['EndTime'])
-            
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-
-
-
-
-
-
-#starttimes=ROOT.TH1D("LB_start","LB_start",len(LBs),LBs[0]-0.5,LBs[-1]+0.5)
-#stoptimes=ROOT.TH1D("LB_stop","LB_stop",len(LBs),LBs[0]-0.5,LBs[-1]+0.5)
-#dttimes=ROOT.TH1D("LB_dt","LB_dt",len(LBs),LBs[0]-0.5,LBs[-1]+0.5)
-#centertimes=ROOT.TH1D("LB_center","LB_center",len(LBs),LBs[0]-0.5,LBs[-1]+0.5)
-
-
-
-
-
-
-
-
-folder=db.getFolder(l1ps_fname)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    lb = 0
-    while itr.goToNext():
-        obj=itr.currentRef()
-        lb=(obj.since() & 0xffff)
-        itemNo=obj.channelId()
-        payload=obj.payload()
-        ps=payload['Lvl1Prescale']
-        try :
-            l1ps_dict[lb][itemNo] = ps            
-        except KeyError:
-            l1ps_dict[lb] = 256*[-1]
-            l1ps_dict[lb][itemNo] = ps
-except Exception,e:
-    print "Reading data from",l1ps_fname,"failed:",e
-
-folder=db.getFolder(lvl1counters_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    lb = 0
-    counter = 0
-    oldItem = -1
-    while itr.goToNext():
-        obj=itr.currentRef()
-        lb=(obj.since() & 0xffff)
-        itemNo=obj.channelId()
-        if (oldItem == -1 or itemNo == 0) :
-            tavs=[]
-            TAVs.append(tavs)
-            tbps=[]
-            TBPs.append(tbps)
-            taps=[]
-            TAPs.append(taps)            
-
-            tavsol=[]
-            TAVsOl.append(tavsol)
-            tbpsol=[]
-            TBPsOl.append(tbpsol)
-            tapsol=[]
-            TAPsOl.append(tapsol)            
-
-            LBs.append(lb)
-
-        if (oldItem != itemNo) :
-            counter = 0
-        else :
-            counter += 1
-
-        payload=obj.payload()            
-        TAVs[counter].append(int(payload['L1Accept']))
-        TBPs[counter].append(int(payload['BeforePrescale']))
-        TAPs[counter].append(int(payload['AfterPrescale']))
-        TAVsOl[counter].append(bool(payload['L1AcceptOverflow']))
-        TBPsOl[counter].append(bool(payload['BeforePrescaleOverflow']))
-        TAPsOl[counter].append(bool(payload['AfterPrescaleOverflow']))
-
-        'L1AcceptOverflow'
-        oldItem = itemNo
-        
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-
-if (len(L1As) != len(endTimes)) :
-    print "Problem: length of L1A vector (",len(L1As),") not equal length of time vector (",len(endTimes),")"
-
-if (fillHist) :
-    fileName = "RUN_" + str(run) + "_hist.root"
-    histFile = TFile(fileName,"RECREATE")
-    histFile.mkdir("TAV")
-    histFile.mkdir("TAP")
-    histFile.mkdir("TBP")
-
-    def makeHist(label,name,LB_list) :
-        histFile.cd(label)
-        hist = TH1F( label + "_" + name, name + " " + label + " rate;LB number;Rate ( Hz )", len(LB_list), LB_list[0]-0.5, LB_list[-1]+0.5 )
-        graph = TGraph(len(LB_list))
-        graph.SetName(label + "_" + name + "_TimeGraph")
-        return (hist, graph)
-
-    histFile.cd()
-    hTotalTbp = TProfile( "AverageTbpRatePerItem", "TBP Rates per Item, averaged over the whole run; CTP ID;Rate ( Hz )", 256, -0.5, 255.5)
-    hTotalTap = TProfile( "AverageTapRatePerItem", "TAP Rates per Item, averaged over the whole run; CTP ID;Rate ( Hz )", 256, -0.5, 255.5)
-    hTotalTav = TProfile( "AverageTavRatePerItem", "TAV Rates per Item, averaged over the whole run; CTP ID;Rate ( Hz )", 256, -0.5, 255.5)
-    hL1a = TH1F( "GlobalL1ARate", "Global L1A rate;LB number;Rate ( Hz )", len(LBs), LBs[0]-0.5, LBs[-1]+0.5 )
-    for i in range(0,len(L1As)) :
-        rate2=float(L1As[i]) / float(L1ATurns[i]) * orbitFreq
-        err_rate2 = math.sqrt(L1As[i])  / float(L1ATurns[i]) * orbitFreq
-        hL1a.SetBinContent(LBs[i],rate2)
-        hL1a.SetBinError(LBs[i],err_rate2)
-
-if( printSummary ) :
-    print "-----------------------------------------------------------------------------------------------------------------------------------------"
-    if printNumbers :
-        print '%30s %12s %20s %20s %20s %20s' % ("Item","ctpid", "L1A[#]","TAV[#]", "TAP[#]", "TBP[#]" )            
-    else :
-        print '%30s %12s %20s %20s %20s %20s' % ("Item","ctpid", "L1A[Hz]","TAV[Hz]", "TAP[Hz]", "TBP[Hz]" )            
-    print "-----------------------------------------------------------------------------------------------------------------------------------------"
-
-for j in range(0,len(items)) :
-    doContinue = 0
-    if ( itemName == "ALL" ) : doContinue += 1
-    elif (itemName != '' and items[j] == itemName) : doContinue += 1
-    elif ( ctpid==-1 ) : doContinue += 1
-    elif ( ctpid>-1 and j == ctpid ) : doContinue += 1
-    elif ( items[j] in itemList ) : doContinue += 1
-    elif ( j in ctpidRange ) : doContinue += 1
-    if (enabledItems) :
-        doContinue = 0
-        for key in l1ps_dict.keys():
-            if(l1ps_dict[key][j] > 0) : doContinue += 1
-
-    if( doContinue == 0 ) : continue
-
-    if (fillHist) :
-        # create Hists
-        histName = "ctpid_" + str(j)
-        if items[j] != "" : histName += "_Item_" + items[j]
-        else : histName = str(j)
-        hTav, gTav = makeHist("TAV",histName,LBs)
-        hTap, gTap = makeHist("TAP",histName,LBs)
-        hTbp, gTbp = makeHist("TBP",histName,LBs)
-
-    if( not printSummary and (printNumbers or printRates) ) :
-        print ""
-        print "Item",items[j]," ( ctpid",j,")"
-        print "-----------------------------------------------------------------------------------------------------------------------------------------"
-        if printNumbers :
-            print '%5.5s %20s %25s %18s %10s %13s %12s %12s %12s' % ("LB No","Start time", "End time", "Length[s]", "L1A[#]","L1A[Hz]","TAV[#]", "TAP[#]", "TBP[#]" )            
-        else :
-            print '%5.5s %20s %25s %18s %10s %13s %12s %12s %12s' % ("LB No","Start time", "End time", "Length[s]", "L1A[#]","L1A[Hz]","TAV[Hz]", "TAP[Hz]", "TBP[Hz]" )
-        print "-----------------------------------------------------------------------------------------------------------------------------------------"
-
-    totalTBP=int(0)
-    totalTAP=int(0)
-    totalTAV=int(0)
-    totalLength=0.0
-    totalTurns=0
-    totalL1As=0
-    for i in range(0,len(L1As)) :
-        lbSec = 1e-9*(endTimes[i] + startTimes[i]) / 2
-        length = 1e-9*(endTimes[i] - startTimes[i])
-        start = AtlCoolTool.time.ctime(startTimes[i]/1E9)
-        end = AtlCoolTool.time.ctime(endTimes[i]/1E9)
-
-# do this only for the TBP
-# import math
-# rate3=-math.log10(1.-(float(TAVs[i][j]) / float(TAVTurns[i]))) * orbitFreq / 60E-27
-
-        rate2=float(L1As[i]) / float(L1ATurns[i]) * orbitFreq
-        rate3=float(TAVs[i][j]) / float(TAVTurns[i]) * orbitFreq
-        rate4=float(TAPs[i][j]) / float(TAPTurns[i]) * orbitFreq
-        rate5=float(TBPs[i][j]) / float(TBPTurns[i]) * orbitFreq
-        err_rate3=math.sqrt(float(TAVs[i][j])) / float(TAVTurns[i]) * orbitFreq
-        err_rate4=math.sqrt(float(TAPs[i][j])) / float(TAPTurns[i]) * orbitFreq
-        err_rate5=math.sqrt(float(TBPs[i][j])) / float(TBPTurns[i]) * orbitFreq
-        totalTBP += TBPs[i][j]
-        totalTAP += TAPs[i][j]
-        totalTAV += TAVs[i][j]
-        totalL1As += L1As[i]
-        totalLength += length
-        totalTurns += float(TAVTurns[i])
-        if TBPsOl[i][j] :
-            over="<-- Overflow!"
-        else :
-            over=""
-
-        if (fillHist) :
-            hTav.SetBinContent(LBs[i],rate3)
-            hTav.SetBinError(LBs[i],err_rate3)
-            hTap.SetBinContent(LBs[i],rate4)
-            hTap.SetBinError(LBs[i],err_rate4)
-            hTbp.SetBinContent(LBs[i],rate5)
-            hTbp.SetBinError(LBs[i],err_rate5)
-            #hTav.Fill(LBs[i],rate3)
-            #hTap.Fill(LBs[i],rate4)
-            #hTbp.Fill(LBs[i],rate5)
-            gTav.SetPoint(i,lbSec,rate3)
-            gTap.SetPoint(i,lbSec,rate4)
-            gTbp.SetPoint(i,lbSec,rate5)
-
-            hTotalTbp.Fill(j,rate5)
-            hTotalTap.Fill(j,rate4)
-            hTotalTav.Fill(j,rate3)
-
-        enabledAndPrint = (not enabledItems)
-        if (enabledItems) :
-            for pp in l1ps_dict.keys():
-                if(pp <= LBs[i]): lb = pp
-            if(l1ps_dict[lb][j] > 0) :
-                enabledAndPrint = True
-        if((enabledItems and enabledAndPrint) or (not enabledItems)) :
-            if not printSummary and printRates :
-                print '%4d %27.26s %27.27s %9.2f %10d %13.2f %12.2f %12.2f %12.2f %13s' % (LBs[i], start, end, length, L1As[i], rate2, rate3, rate4, rate5,over)
-            elif not printSummary and printNumbers :
-                print '%4d %27.26s %27.27s %9.2f %10d %13.2f %12.0f %12.0f %12.0f %13s' % (LBs[i], start, end, length, L1As[i], rate2, TAVs[i][j], TAPs[i][j], TBPs[i][j],over)
-
-    if( not printSummary and (printNumbers or printRates) ) :
-        print "-----------------------------------------------------------------------------------------------------------------------------------------"
-
-    if printSummary:
-        if printNumbers :
-            print '%30s %12d %20d %20d %20d %20d' % (items[j],j,totalL1As,totalTAV,totalTAP,totalTBP )
-        else :
-            print '%30s %12d %20.2f %20.2f %20.2f %20.2f' % (items[j],j,float(totalL1As)/totalTurns*orbitFreq,float(totalTAV)/totalTurns*orbitFreq,float(totalTAP)/totalTurns*orbitFreq,float(totalTBP)/totalTurns*orbitFreq )
-    
-    # here make sure histograms are written properly
-
-    if (fillHist) :
-        histFile.cd("TAV")
-        gTav.Write("",TObject.kOverwrite)
-        histFile.cd("TAP")
-        gTap.Write("",TObject.kOverwrite)
-        histFile.cd("TBP")
-        gTbp.Write("",TObject.kOverwrite)
-        histFile.Write("",TObject.kOverwrite)
-
-db.closeDatabase()
-
-
-import numpy
-def rootarray(inp):
-    return numpy.array(inp, dtype=numpy.double)
-
-
-if (fillHist) : 
-    histFile.cd("")
-    alltimes=startTimes+[endTimes[-1]]
-    # scale to seconds:
-    alltimes=map(lambda x:x/1e9,alltimes)
-    times_lb=TH1D("LumiBlocks","exact lb at time",len(LBs),rootarray(alltimes))
-    for t,b in zip(alltimes,LBs):
-        times_lb.Fill(t+0.1,b)
-    times_lb.GetXaxis().SetTimeDisplay(1);
-    times_lb.GetXaxis().SetTimeFormat("%H:%M");        
-    times_lb.Write()
-
-
-    
-    RunNR=TH1D("RunNR","RunNR",1,0,1);
-    RunNR.Fill(0.5,run)
-    RunNR.Write()
-    histFile.Close()
-
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_lvl1rates_get_lumi.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_lvl1rates_get_lumi.py
deleted file mode 100755
index 540d7c07375960a549a988b8d9d8fc73e6a889cf..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/cool_read_lvl1rates_get_lumi.py
+++ /dev/null
@@ -1,527 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-# TODO: check for overflows of counters!
-# TODO: option to print out counters instead of rates
-
-import sys,getopt,os
-from PyCool import cool,coral
-from CoolConvUtilities import AtlCoolTool
-from ROOT import TH1F, TFile, TProfile, TObject
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                this printout"
-    print "  --run <runNo>                         run number"
-    print "  --item <name>                         item name - 'ALL' for all items"
-    print "  --itemList <i1>,<i2>,...              comma separated list of item names"
-    print "  --ctpid <id>                          use ctpid of item instead of name - '-1' for all items"
-    print "  --ctpidRange <i1>-<i2>,<i3>-<i4>      range of ctpids "
-    print "  --enabledItems                        print all items enabled at L1"
-    print "  --printNumbers                        print number of triggers"
-    print "  --printRates                          print trigger rates"
-    print "  --printSummary                        just print summary per item"
-    print "  --fillHist                            fill histograms of rate vs. LB"
-    print "  --bunches <n>                         number of bunches (default=1)"
-
-try:
-    longopts=['run=','ctpid=','item=','help','printNumbers','printRates','itemList=','ctpidRange=','fillHist','printSummary','enabledItems','bunches=']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-n_bunches=1.0
-
-lb1=int(0)
-lb2=int(0)
-debug=bool(False)
-ctpid=int(-2)
-ctpidRange=[]
-itemName="ALL"
-itemList=[]
-run=int(-1)
-printRates=False
-printNumbers=False
-fillHist=False
-printSummary=False
-orbitFreq = 40.0790e6 / 3564.
-enabledItems = False
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--run':
-        run = int(a)
-    if o == '--item':
-        itemName = str(a)
-    if o == '--itemList':
-        itemName = ''
-        itemList = str(a).split(',')
-    if o == '--ctpid':                 
-        itemName = ''
-        ctpid = int(a)
-    if o == '--ctpidRange':
-        itemName = ''
-        list1 = str(a).split(',')
-        for i in list1:
-            list2 = i.split('-')
-            ctpidRange += range(int(list2[0]),int(list2[1])+1)
-    if o == '--printNumbers':
-        printNumbers = True
-    if o == '--printRates':
-        printRates = True
-    if o == '--printSummary':
-        printSummary = True
-    if o == '--fillHist':
-        fillHist = True
-    if o == '--enabledItems':
-        enabledItems = True
-    if o == '--bunches':
-        n_bunches = int(a)
-
-print "number of bunches: ",n_bunches
-
-if not printSummary and not printRates and not printNumbers:
-    printSummary = True
-
-if (run == -1) : 
-    usage()
-    sys.exit(2)
-
-if printNumbers and printRates :
-    print "Both arguments 'printNumbers' and 'printRates' given, print only rates"
-    printNumbers = False
-
-    print
-    print "------------------------------------"
-    print "Run",run
-    print "------------------------------------"
-    print
-
-# get database service and open database
-dbSvc=cool.DatabaseSvcFactory.databaseService()
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user="+dbuser+";password="+dbpw
-#olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-#dbstring="sqlite://;schema=/afs/cern.ch/user/b/berge/trash/ctp.LBData.1190647872.sqlitefile.db;dbname=L1CTCOOL"
-
-try:
-    db=dbSvc.openDatabase(dbstring,False)
-    if (debug) : print "Opened database",dbstring
-except Exception,e:
-    print e
-    sys.exit(-1)
-
-# set folders all run-event index
-# AthenaAttributeList as type 0, CondAttributeList collection as type 1
-# timestamp for folders bit 1
-
-lvl1counters_foldername='/TRIGGER/LUMI/LVL1COUNTERS'
-lvl1menu_foldername='/TRIGGER/LVL1/Menu'
-lvl1lbdata_foldername='/TRIGGER/LVL1/CTPCORELBDATA'
-lblb_foldername='/TRIGGER/LUMI/LBLB'
-l1ps_fname = '/TRIGGER/LVL1/Prescales'
-
-if not db.existsFolder(lvl1counters_foldername) :
-    print "Folder",lvl1counters_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lvl1menu_foldername) :
-    print "Folder",lvl1menu_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lvl1lbdata_foldername) :
-    print "Folder",lvl1lbdata_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lblb_foldername) :
-    print "Folder",lblb_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(l1ps_fname) :
-    print "Folder",l1ps_fname,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-         
-items=[""]*256
-L1As=[]
-L1ATurns=[]
-TAVs=[]
-TAPs=[]
-TBPs=[]
-TAVsOl=[]
-TAPsOl=[]
-TBPsOl=[]
-TAVTurns=[]
-TAPTurns=[]
-TBPTurns=[]
-LBs=[]
-startTimes=[]
-endTimes=[]
-l1ps_dict={}
-
-folder=db.getFolder(lvl1menu_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        itemNo=obj.channelId()
-        payload=obj.payload()
-        items[itemNo] = payload['ItemName']
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1menu_foldername,"failed:",e
- 
-folder=db.getFolder(lvl1lbdata_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        L1As.append(payload['GlobalL1AcceptCounter'])
-        L1ATurns.append(payload['GlobalL1AcceptTurnCounter'])
-        TAVTurns.append(payload['L1AcceptTurnCounter'])
-        TAPTurns.append(payload['AfterPrescaleTurnCounter'])
-        TBPTurns.append(payload['BeforePrescaleTurnCounter'])
-            
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-folder=db.getFolder(lblb_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        startTimes.append(payload['StartTime'])
-        endTimes.append(payload['EndTime'])
-            
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-folder=db.getFolder(l1ps_fname)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    lb = 0
-    while itr.goToNext():
-        obj=itr.currentRef()
-        lb=(obj.since() & 0xffff)
-        itemNo=obj.channelId()
-        payload=obj.payload()
-        ps=payload['Lvl1Prescale']
-        try :
-            l1ps_dict[lb][itemNo] = ps            
-        except KeyError:
-            l1ps_dict[lb] = 256*[-1]
-            l1ps_dict[lb][itemNo] = ps
-except Exception,e:
-    print "Reading data from",l1ps_fname,"failed:",e
-
-folder=db.getFolder(lvl1counters_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    lb = 0
-    counter = 0
-    oldItem = -1
-    while itr.goToNext():
-        obj=itr.currentRef()
-        lb=(obj.since() & 0xffff)
-        itemNo=obj.channelId()
-        if (oldItem == -1 or itemNo == 0) :
-            tavs=[]
-            TAVs.append(tavs)
-            tbps=[]
-            TBPs.append(tbps)
-            taps=[]
-            TAPs.append(taps)            
-
-            tavsol=[]
-            TAVsOl.append(tavsol)
-            tbpsol=[]
-            TBPsOl.append(tbpsol)
-            tapsol=[]
-            TAPsOl.append(tapsol)            
-
-            LBs.append(lb)
-
-        if (oldItem != itemNo) :
-            counter = 0
-        else :
-            counter += 1
-
-        payload=obj.payload()            
-        TAVs[counter].append(int(payload['L1Accept']))
-        TBPs[counter].append(int(payload['BeforePrescale']))
-        TAPs[counter].append(int(payload['AfterPrescale']))
-        TAVsOl[counter].append(bool(payload['L1AcceptOverflow']))
-        TBPsOl[counter].append(bool(payload['BeforePrescaleOverflow']))
-        TAPsOl[counter].append(bool(payload['AfterPrescaleOverflow']))
-
-        'L1AcceptOverflow'
-        oldItem = itemNo
-        
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-
-if (len(L1As) != len(endTimes)) :
-    print "Problem: length of L1A vector (",len(L1As),") not equal length of time vector (",len(endTimes),")"
-
-if (fillHist) :
-    fileName = "RUN_" + str(run) + "_hist.root"
-    histFile = TFile(fileName,"RECREATE")
-    histFile.mkdir("TAV")
-    histFile.mkdir("TAP")
-    histFile.mkdir("TBP")
-
-    def makeHist(label,name,LB_list) :
-        histFile.cd(label)
-        hist = TH1F( label + "_" + name, name + " " + label + " rate;LB number;lumi", len(LB_list), LB_list[0]-0.5, LB_list[-1]+0.5 )
-        return hist
-
-    def makeHistTime(label,name,LB_list) :
-        histFile.cd(label)
-        hist = TH1F( label + "_" + name, name + " " + label + " rate;LB number;lumi", len(LB_list), LB_list[0]-0.5, LB_list[-1]+0.5 )
-        return hist
-
-    def makeHistFreq(label,name,LB_list) :
-        histFile.cd(label)
-        hist = TH1F( label + "_" + name, name + " " + label + " rate;LB number;Rate (Hz)", len(LB_list), LB_list[0]-0.5, LB_list[-1]+0.5 )
-        return hist
-
-    def makeHistCounts(label,name,LB_list) :
-        histFile.cd(label)
-        hist = TH1F( label + "_" + name, name + " " + label + " counts;LB number;Counts", len(LB_list), LB_list[0]-0.5, LB_list[-1]+0.5 )
-        return hist
-
-
-    def makeHistBUNCH(label,name) :
-        histFile.cd(label)
-        hist = TH1F( label + "_" + name, name + " " + label + " rate;LB number;number of bunches", 10000 , 0 , 4000 )
-        return hist
-
-
-    histFile.cd()
-    hTotalTbp = TProfile( "AverageTbpRatePerItem", "TBP Rates per Item, averaged over the whole run; CTP ID;Rate ( Hz )", 256, -0.5, 255.5)
-    hTotalTap = TProfile( "AverageTapRatePerItem", "TAP Rates per Item, averaged over the whole run; CTP ID;Rate ( Hz )", 256, -0.5, 255.5)
-    hTotalTav = TProfile( "AverageTavRatePerItem", "TAV Rates per Item, averaged over the whole run; CTP ID;Rate ( Hz )", 256, -0.5, 255.5)
-    hL1a = TH1F( "GlobalL1ARate", "Global L1A rate;LB number;Rate ( Hz )", len(LBs), LBs[0]-0.5, LBs[-1]+0.5 )
-    for i in range(0,len(L1As)) :
-        rate2=float(L1As[i]) / float(L1ATurns[i]) * orbitFreq
-        hL1a.Fill(LBs[i],rate2)
-
-if( printSummary ) :
-    print "-----------------------------------------------------------------------------------------------------------------------------------------"
-    if printNumbers :
-        print '%30s %12s %20s %20s %20s %20s' % ("Item","ctpid", "L1A[#]","TAV[#]", "TAP[#]", "TBP[#]" )            
-    else :
-        print '%30s %12s %20s %20s %20s %20s' % ("Item","ctpid", "L1A[Hz]","TAV[Hz]", "TAP[Hz]", "TBP[Hz]" )            
-    print "-----------------------------------------------------------------------------------------------------------------------------------------"
-
-if (fillHist) :
-    hTavHC= makeHistFreq("TAV","HitCount",LBs)
-    hTapHC= makeHistFreq("TAP","HitCount",LBs)
-    hTbpHC= makeHistFreq("TBP","HitCount",LBs)
-    hBunches = makeHistBUNCH("","bunches")
-    hBunches.Fill(n_bunches*1.0)
-
-for j in range(0,len(items)) :
-    doContinue = 0
-    if ( itemName == "ALL" ) : doContinue += 1
-    elif (itemName != '' and items[j] == itemName) : doContinue += 1
-    elif ( ctpid==-1 ) : doContinue += 1
-    elif ( ctpid>-1 and j == ctpid ) : doContinue += 1
-    elif ( items[j] in itemList ) : doContinue += 1
-    elif ( j in ctpidRange ) : doContinue += 1
-    if (enabledItems) :
-        doContinue = 0
-        for key in l1ps_dict.keys():
-            if(l1ps_dict[key][j] > 0) : doContinue += 1
-
-    if( doContinue == 0 ) : continue
-
-    if (fillHist) :
-        # create Hists
-        histName = ""
-        #ctpid_" + str(j)
-        if items[j] != "" : histName += "Item_" + items[j]
-        else : histName = str(j)
-
-
-        hTav = makeHist("TAV",histName,LBs)
-        hTap = makeHist("TAP",histName,LBs)
-        hTbp = makeHist("TBP",histName,LBs)
-
-        hTavTurns= makeHistTime("TAV",histName+"Time",LBs)
-        hTapTurns= makeHistTime("TAP",histName+"Time",LBs)
-        hTbpTurns= makeHistTime("TBP",histName+"Time",LBs)
-
-        hTavCounts= makeHistCounts("TAV",histName+"RawCounts",LBs)
-        hTapCounts= makeHistCounts("TAP",histName+"RawCounts",LBs)
-        hTbpCounts= makeHistCounts("TBP",histName+"RawCounts",LBs)
-
-
-    if( not printSummary and (printNumbers or printRates) ) :
-        print ""
-        print "Item",items[j]," ( ctpid",j,")"
-        print "-----------------------------------------------------------------------------------------------------------------------------------------"
-        if printNumbers :
-            print '%5.5s %20s %25s %18s %10s %13s %12s %12s %12s' % ("LB No","Start time", "End time", "Length[s]", "L1A[#]","L1A[Hz]","TAV[#]", "TAP[#]", "TBP[#]" )            
-        else :
-            print '%5.5s %20s %25s %18s %10s %13s %12s %12s %12s' % ("LB No","Start time", "End time", "Length[s]", "L1A[#]","L1A[Hz]","TAV[Hz]", "TAP[Hz]", "TBP[Hz]" )
-        print "-----------------------------------------------------------------------------------------------------------------------------------------"
-
-    totalTBP=int(0)
-    totalTAP=int(0)
-    totalTAV=int(0)
-    totalLength=0.0
-    totalTurns=0
-    totalL1As=0
-    for i in range(0,len(L1As)) :
-        length = 1e-9*(endTimes[i] - startTimes[i])
-        start = AtlCoolTool.time.ctime(startTimes[i]/1E9)
-        end = AtlCoolTool.time.ctime(endTimes[i]/1E9)
-
-        import math
-
-        ####### luminosity zero counting method ##########
-        ##################################################
-        # this is based on the level one trigger item
-        # L1_MBTS_1_Col, this item fires only if there is
-        # a paired bptx trigger and if at least one
-        # MBTS counter is aboave threshold
-        sigma_inel = 52.7e-27
-        orbit_frequency = 40.0790e6 / 3564.
-        eff = 1.
-        #        n_bunches = 2.
-
-        def countrate(CNT,TRNS):            
-            MBTS_trigger_counts = CNT   # float(TBPs[i][j])
-            orbits_counts       = TRNS  # float(TBPTurns[i])
-            total_number_of_bunches = n_bunches*orbits_counts
-            non_interacting_bunches = total_number_of_bunches - MBTS_trigger_counts
-            mu = -(1./eff)*math.log(non_interacting_bunches/total_number_of_bunches)
-            event_per_sec = mu*n_bunches*orbit_frequency
-            lumi = event_per_sec / sigma_inel
-            return lumi
-
-        def errorrate(CNT,TRNS):
-            MBTS_trigger_counts_error = math.sqrt(CNT)   # float(TBPs[i][j])
-            MBTS_trigger_counts = CNT   # float(TBPs[i][j])
-            orbits_counts       = TRNS  # float(TBPTurns[i])
-            total_number_of_bunches = n_bunches*orbits_counts
-            non_interacting_bunches = total_number_of_bunches - MBTS_trigger_counts
-            mu_error = -(1./eff)*1/(non_interacting_bunches/total_number_of_bunches)*1./total_number_of_bunches*MBTS_trigger_counts_error
-            event_per_sec_error = mu_error*n_bunches*orbit_frequency
-            lumi_error = event_per_sec_error / sigma_inel
-            return lumi_error
-            
-        
-        rate3 = countrate(float(TAVs[i][j]),float(TAVTurns[i]))    
-        rate4 = countrate(float(TAPs[i][j]),float(TAPTurns[i]))    
-        rate5 = countrate(float(TBPs[i][j]),float(TBPTurns[i]))    
-
-        rate3_error = errorrate(float(TAVs[i][j]),float(TAVTurns[i]))    
-        rate4_error = errorrate(float(TAPs[i][j]),float(TAPTurns[i]))    
-        rate5_error = errorrate(float(TBPs[i][j]),float(TBPTurns[i]))    
-
-        if 'MBTSA' in  histName or 'MBTSC' in histName:
-#            print "adding in HC"
-            hTavHC.Fill(LBs[i],(float(TAVs[i][j]))/(TAVTurns[i]*n_bunches/orbit_frequency))
-            hTapHC.Fill(LBs[i],(float(TAPs[i][j]))/(TAPTurns[i]*n_bunches/orbit_frequency))
-            hTbpHC.Fill(LBs[i],(float(TBPs[i][j]))/(TBPTurns[i]*n_bunches/orbit_frequency))
-
-        
-        #print ", lumi = ", rate5                         
-
-        ###################
-
-        totalTBP += TBPs[i][j]
-        totalTAP += TAPs[i][j]
-        totalTAV += TAVs[i][j]
-        totalL1As += L1As[i]
-        totalLength += length
-        totalTurns += float(TAVTurns[i])
-        if TBPsOl[i][j] :
-            over="<-- Overflow!"
-        else :
-            over=""
-
-        if (fillHist) :
-
-            hTav.Fill(LBs[i],rate3)
-            hTap.Fill(LBs[i],rate4)
-            hTbp.Fill(LBs[i],rate5)
-            #####################################
-            # fill histogram errors
-            #####################################
-            hTav.SetBinError(hTav.FindBin(LBs[i]),rate3_error)
-            hTap.SetBinError(hTap.FindBin(LBs[i]),rate4_error)
-            hTbp.SetBinError(hTbp.FindBin(LBs[i]),rate5_error)
-
-
-            hTavTurns.Fill(LBs[i],(float(TAVTurns[i]))/orbitFreq)
-            hTapTurns.Fill(LBs[i],(float(TAPTurns[i]))/orbitFreq)
-            hTbpTurns.Fill(LBs[i],(float(TBPTurns[i]))/orbitFreq)
-
-            hTavCounts.Fill(LBs[i],(float(TAVs[i][j])))
-            hTapCounts.Fill(LBs[i],(float(TAPs[i][j])))
-            hTbpCounts.Fill(LBs[i],(float(TBPs[i][j])))
-
-            hTotalTav.Fill(j,rate3)
-            hTotalTap.Fill(j,rate4)
-            hTotalTbp.Fill(j,rate5)
-
-
-        enabledAndPrint = (not enabledItems)
-        if (enabledItems) :
-            for pp in l1ps_dict.keys():
-                if(pp <= LBs[i]): lb = pp
-            if(l1ps_dict[lb][j] > 0) :
-                enabledAndPrint = True
-        if((enabledItems and enabledAndPrint) or (not enabledItems)) :
-            if not printSummary and printRates :
-                print '%4d %27.26s %27.27s %9.2f %10d %13.2f %12.2f %12.2f %12.2f %13s' % (LBs[i], start, end, length, L1As[i], rate2, rate3, rate4, rate5,over)
-            elif not printSummary and printNumbers :
-                print '%4d %27.26s %27.27s %9.2f %10d %13.2f %12.0f %12.0f %12.0f %13s' % (LBs[i], start, end, length, L1As[i], rate2, TAVs[i][j], TAPs[i][j], TBPs[i][j],over)
-
-    if( not printSummary and (printNumbers or printRates) ) :
-        print "-----------------------------------------------------------------------------------------------------------------------------------------"
-
-    if printSummary:
-        if printNumbers :
-            print '%30s %12d %20d %20d %20d %20d' % (items[j],j,totalL1As,totalTAV,totalTAP,totalTBP )
-        else :
-            print '%30s %12d %20.2f %20.2f %20.2f %20.2f' % (items[j],j,float(totalL1As)/totalTurns*orbitFreq,float(totalTAV)/totalTurns*orbitFreq,float(totalTAP)/totalTurns*orbitFreq,float(totalTBP)/totalTurns*orbitFreq )
-    
-    # here make sure histograms are written properly
-    if (fillHist) :
-        histFile.Write("",TObject.kOverwrite)
-
-db.closeDatabase()
-
-if (fillHist) : 
-    histFile.Close()
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_cool_plot.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_cool_plot.py
deleted file mode 100755
index 7d72e1fd5a0153db84c2b6db320c6c71fc965617..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_cool_plot.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# L1CT crew, Johan.Lundberg@cern.ch, CERN, 2009
-
-# Note, we use busy_py.py
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " Make and draw CTPMON cool histograms "
-    print " "
-    print " Mandatory: "
-    print "  --inputfile | -i <filename>      A .py.obj with parsed cool data"    
-    print " "
-    print " Switches: "
-    print " "
-    print "  --outbase | -o <outname>    filename base for output files"     
-    print "  --nodraw= <for options, look at ctpin_cool_reader.py>"
-
-try:
-    longopts=['inputfile=','i=','help','text','nodraw='
-              'outbase=']
-    opts,args=getopt.getopt(sys.argv[1:],'i:o:',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-fname=""
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o in ('--inputfile','-i'):
-        fname=a
-if not fname:
-    usage()
-    sys.exit(2)
-
-## read file
-
-import ctpin_py
-ctpin_py.plotfile(fname,opts)
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_cool_reader.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_cool_reader.py
deleted file mode 100755
index 7afd526a0161b9ec8d22f6f0f6bcd5f5e7123392..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_cool_reader.py
+++ /dev/null
@@ -1,237 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " From COOL database, read rates for specified combination of"
-    print " lumi blocks and CTPIN counter IDs."
-    print " "
-    print " Mandatory: "
-    print "  --run <runNo>              run number (single number), eg 131740"    
-    print " Note: If no run number is given, we try to read current runNr from"
-    print " IS at point 1. Requires the current tdaq software setup."
-    print " "
-    print " Optional: "
-    print "  --lb <lb ranges>           lumi block(s)"
-    print "       (default='-', all lumiblocks) "
-    print "       Read below on how to specify ranges"
-    print " "
-    print "   --counters <counter ranges> CTPIN counter nr(s)"
-    print "             Can use comma separated Regular expressions for names"
-    print "       (default='MBTS') "
-    print ""
-    print "  --maxbins <nbins> Average records to limit the number of histogram bins."
-    print "                    Default is 400. Set to 0 for unlimited"
-    print "  --maxzscale <number>       max z (color) scale range (default 200)"
-
-    print ""
-    print "  --nofillHist                 Fill histograms"
-    print "  --nodrawHist                 Fill and Draw histograms"
-    print "  --outbase | -o <filename>  Output base name "
-    print "       (default='CTPIN_', note: _<runNo>.<extensions> are added)"
-    print " "
-    print "  --nodraw <opt1,opt2,...>"
-    print "    where opt: Log           don't draw Log plots"
-    print "               Lin           don't draw Lin plots"
-    print "               LB1D          don't draw 1D LB plots"
-    print ""
-    print "  --norunname                don't add run number to filenames"
-    print ""
-    print "  --dbid                     cool dbid for the rates information"
-    print "  --dbidLumi                 cool dbid for the Lumi information"
-    print " "
-    print " Text output controls:"
-    print "  --verbose                  Do print text results"
-    print "  --textsum                  verbose, without per-counter information"
-    print " "
-    print " "
-    print " Range specifications:"
-    print "   <lumiblockNo> and <counterNo> can be specified as single "
-    print "   numbers, or ranges like this: "
-    print "      syntax:  1,3,10-13   gives:   1,3,10,11,12,13 "
-    print "      syntax:  3,10-       gives:   3,10... "
-    print "      syntax:  50,-10      gives:   ...10,50      "
-    print "      syntax:  -           gives:   all  "
-    print "   for lumiblocks only: "  
-    print "      syntax:  L5          gives:   5 latest lumiblocks "
-    print " "
-
-print "CTPIN cool reader"
-try:
-    longopts=['norunname','run=','lb=','counters=','maxzscale=',
-              'help','verbose','textbc','textsum','maxbins=','dbid=',
-              'outbase=','nofillHist','nodraw=','nodrawHist']
-    opts,args=getopt.getopt(sys.argv[1:],'h',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-
-import l1ctpy
-
-# defaults:
-OPT={}
-OPT["--run"]=int(-1)
-OPT["--counters"]=['MBTS']
-OPT["--bcids"]=None
-OPT["--lb"]=l1ctpy.text_to_ranges('-')
-OPT["--maxbins"]=400
-OPT["--verbose"]=False
-OPT["--nofillHist"]=False
-OPT["--nodrawHist"]=False
-OPT["--textsum"]=False
-OPT["--filename"]="CTPIN_"
-
-OPT["--dbid"]=l1ctpy.get_dbid_MONP()
-OPT["--dbidLumi"]=l1ctpy.get_dbid_COMP()
-
-OPT["--nodraw"]=""
-
-OPT['--norunname'] = False
-OPT['--maxzscale'] = ''
-#1000
-
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--lb':                 
-        OPT["--lb"]=l1ctpy.text_to_ranges(a)
-    if o == '--outbase':                 
-        OPT["--filename"]=str(a)
-    if o == '--counters':
-        OPT["--counters"]=l1ctpy.text_to_ranges(a)
-        OPT["--counters"]=l1ctpy.expandlist(OPT["--counters"],0,678-1)
-    if o == '--maxbins':
-        OPT["--maxbins"]=int(a)
-    if o in ['--dbid','--dbidLumi','--run']:
-        OPT[o]=a
-    if o == '--textsum':
-        OPT["--textsum"] = True
-        OPT["--verbose"] = True
-    if o in ['--verbose',"--nofillHist","--nodrawHist",'--keepnames','--overflows','--norunname']:
-        OPT[o]= True
-    if o == '--nodraw':
-        OPT["--nodraw"]=OPT["--nodraw"]+str(a)
-    if o == "--maxzscale":
-        OPT["--maxzscale"]=a    
-
-
-try:
-    OPT["--run"]=int(OPT["--run"])
-
-except BaseException,e:
-    usage()
-    print e
-    raise ValueError("You must specify a single run number, not:",OPT["--run"])
-
-if OPT["--run"] < 1:
-    print "No run specified, finding last run nr from cool"
-    OPT["--run"]=l1ctpy.get_current_run()
-
-if OPT["--run"] < 1:
-    print "no run nr. exit"
-    sys.exit(1)
-    
-if not OPT['--norunname']:
-    OPT["--filename"]+=str(OPT["--run"])    
-
-    
-#+-------------------------------------------
-# Open databases and get the required folders
-#+-------------------------------------------
-
-print "Run:                         ",OPT["--run"]
-print "Opening db ",OPT["--dbid"]
-
-ctpinRatefolder=l1ctpy.getCoolFolder(OPT["--dbid"] ,'/TRIGGER/LVL1/CTPINRATES')
-lbfolder=l1ctpy.getCoolFolder(OPT['--dbidLumi'] ,'/TRIGGER/LUMI/LBLB')
-
-LBs,TimeRanges=l1ctpy.getLbTimesMulti(lbfolder,OPT["--run"],OPT["--lb"])
-
-l1ctpy.showlbandtime(LBs,OPT)
-
-#+-------------------------------------------
-# Counter names
-#+-------------------------------------------
-
-import numpy
-
-ROV1=(OPT["--run"]<<32)+1; 
-pattern='.*'
-CounterType='CTPIN'
-dbstring=l1ctpy.get_dbid_MONP()
-counterdb=l1ctpy.getcounterConfig(dbstring,ROV1,ROV1,pattern,CounterType)
-l1ctpy.filter_and_add_counternames(counterdb,OPT)    
-
-#+------------------------------------
-# Define and apply a blob calculator function
-#+------------------------------------
-
-import ctpin_py
-
-OPT['--RateTitle']='Run '+str(OPT["--run"])+ " : CTPIN Counter Rates, Hz"
-
-blobcalc=ctpin_py.ReadInBlob_detailed_Factory(OPT["--counters"],OPT["--verbose"])
-inTimeRanges,rates=ctpin_py.getINrates(ctpinRatefolder,TimeRanges,blobcalc)
-
-#for r in rates:
-#    print r
-
-print "Read ",len(rates),"ctpin Rate blobs."
-
-if len(rates)<1:
-        print "No data found. Try a different run or a bigger LB range"
-        sys.exit(1)
-
-if OPT["--maxbins"]>0:
-    print "Averaging to limit the time bins to", OPT["--maxbins"]
-    inTimeRanges,rates=l1ctpy.timeAverage(inTimeRanges,rates,OPT["--maxbins"])
-
-
-#+------------------------------------
-# find out which monitoring block is at what lb
-#+------------------------------------
-inblockLBs=[]
-for tt in inTimeRanges:
-    inblockLBs.append(l1ctpy.time2lb(LBs,TimeRanges,tt))
-
-#+------------------------------------
-# find out which lb is in which monitoring block
-#+------------------------------------
-lbmatches=[]
-for tt in inTimeRanges:
-    lbmatches.append(l1ctpy.compareranges(LBs,TimeRanges,tt))
-
-import busy_py
-
-#+------------------------------------
-# Print to screen
-#+------------------------------------
-if OPT["--verbose"]:
-    busy_py.showresults(inTimeRanges,rates,inblockLBs,OPT["--counters"],OPT["--bcids"],OPT["--textsum"],OPT["--textbc"])
-
-#+------------------------------------
-#+ Write output to python file
-#+------------------------------------
-busy_py.savefile(OPT,inTimeRanges,rates,lbmatches,inblockLBs)
-
-#+------------------------------------
-#+ Fill histograms and make plots if requested
-#+------------------------------------
-if not OPT["--nofillHist"]:
-    busy_py.plot(OPT,inTimeRanges,rates,lbmatches,inblockLBs,opts)
-    
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_py.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_py.py
deleted file mode 100644
index 9718896b4a457c18c28dd17d2d0411666ad53372..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_py.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-if __name__ == "__main__":
-    print "Warning:"
-    print "   The ctpin_py module is meant to be executed."
-    print "      try ctpin_cool_reader.py "
-    print "       or ctpin_cool_plot.py "
-
-# this makes it easy to move functions and constants
-# from here to l1ctpy
-from l1ctpy import *
-
-# note, we use also busy_py.py 
-# for most things and rededine only a few methods
-from busy_py import *
-
-#+================================================================
-#+
-#+ CTPIN specific functions for reading and parsing blob data
-#+
-#+================================================================
-
-#+ -------------------------------------------------------------
-#+ Factory function, returns full information for the specified ranges.
-#+ produced function Returns a list 
-#+   index goes over the selected conters
-def ReadInBlob_detailed_Factory(counters=range(768),verbose=False):
-    import struct
-    if verbose:
-        print "Contructing blob calculator for:"
-        print "  counters   : ",counters
-    if(len(counters)<1):
-        raise ValueError("can't handle empty counter range")
-    def Blobcalc(blob,downscaling=1.0):
-        " Reads a  blob at given counter. Returns selected counter values. "
-        # output vector of empty vectors
-        sums=[]        
-        for counter in counters:
-            indx=(counter)*4            
-            blob.seek(indx)
-            sums.append(struct.unpack('<f',blob.read(4)))
-        return sums
-    return Blobcalc
-
-
-#+ -------------------------------------------------------------
-#+ returns requested rates 
-#+ times should be a list of (start,stop) time tuples, eg from getLbTimes
-#+ Output is a list of (start,stop) tuples for the blob ROVs
-#+ and the correspondig output from the blob calculator
-def getINrates(folder,times,blobcalc):
-    from PyCool import cool
-    blobs=[]
-    StopTimes=[]
-    StartTimes=[]        
-    oldpersentage=""
-    for t,t_i in zip(times,range(len(times))):
-        dir(cool)
-        dir(folder)
-        obj=folder.browseObjects(t[0],t[1],cool.ChannelSelection.all())
-        persentage='reading CTPIN blobs, %3.0f %%' % (100*(t_i+1)/len(times))
-        if not persentage == oldpersentage:
-            print persentage
-            oldpersentage=persentage
-        for o in obj:
-            payload=o.payload()
-            starttime=o.since()
-            if starttime in StartTimes :
-                pass
-            else:
-                StartTimes.append(starttime)
-                StopTimes.append(o.until())
-                of=payload["Overflows"]
-                pe=payload["ParityErrors"]
-                # parity is expert stuff only - not all clients
-                # compute their parity
-                if (False): 
-                    # one bit per cable. Eg. cable 1 and 2 gives 0x6 
-                    if of : print "****Error, overflows:   7:0x%x,8:0x%x,9:0x%x"% (pe&15,(pe>>4)&15,(pe>>8)&15)
-                    if pe : print "****Error, parityErrors: 7:0x%x,8:0x%x,9:0x%x"% (pe&15,(pe>>4)&15,(pe>>8)&15)
-                thissum=blobcalc(payload["Rates"],1.0)
-                blobs.append(thissum)             
-    return zip(StartTimes,StopTimes),blobs
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_readconfig.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_readconfig.py
deleted file mode 100755
index 6c34427bb0dcf23b6e16b132ff46e7549b981b4c..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpin_readconfig.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-#!/bin/env python2.5
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " From COOL DB, read ctpin input signal configuration"
-    print " for specified Run, and lumiblock"
-    print " "
-    print " Mandatory: "
-    print "  --run <runNo>              run number (single number), eg 123212"    
-    print " "
-    print " Optional: "
-    print "  --lb <lb ranges>           lumi block (single number)"
-    print "       (default='1', first) "
-    print "  --names <signalnames>      regular expression"
-    print " "
-    
-try:
-    longopts=['run=','lb=','names=',
-              'help','verbose']
-    opts,args=getopt.getopt(sys.argv[1:],'h',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2) 
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-
-# defaults:
-OPT={}
-OPT["--run"]=int(-1)
-OPT["--lb"]=1 
-OPT["--verbose"]=False
-OPT["--names"]=".*"
- 
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o in OPT:
-        OPT[o] = a
-    if o == '--verbose':                 
-        OPT["verbose"] = True
-
-try:
-    OPT["--run"]=int(OPT["--run"])
-    OPT["--lb"]=int(OPT["--lb"])
-    if OPT["--run"] < 1:
-        raise ValueError()
-except ValueError:
-    usage()
-    print "Error: You must specify a single run number, not:",OPT["--run"]
-    sys.exit(2)
-
-
-import l1ctpy
-from PyCool import cool
-import ctpmon_py as ctpcl
-import re
-
-pattern=".*%s.*" % OPT["--names"]
-
-dbstring=l1ctpy.get_dbid_MONP()
-ROV1=(OPT["--run"]<<32)+OPT["--lb"];
-numfound={}
-for foldertype in ['/TRIGGER/LVL1/CTPINSIGNALS','/TRIGGER/LVL1/CTPINSIGNALSMBTS']:
-
-    folder=ctpcl.getCoolFolder(dbstring,foldertype)
-    objs=folder.browseObjects(ROV1,ROV1,cool.ChannelSelection.all())
-
-    signals=[]
-    for obj in objs:
-        payload=obj.payload()
-        name=payload["Name"]
-        if re.match(pattern,name,re.IGNORECASE):
-            pl={}
-            for it in folder.payloadSpecification():
-                pl[it.name()]=(payload[it.name()])
-            signals.append(pl)
-
-    # defin sort order
-    def sortkey(sig):
-        return [sig["Slot"],sig["Connector"],sig["FirstBit"],sig]
-
-    
-    if signals:
-        signals.sort(key=sortkey)
-        for p in signals:
-            print "======== %40s : %s" % ( foldertype, p['Name'])
-            for it in folder.payloadSpecification():
-                print it.name(), " ", p[it.name()]
-    numfound[foldertype]=len(signals)
-
-print "-------------------------------------------------------------------"
-print "Number of found signals for pattern",OPT["--names"],"run:",OPT["--run"]," lb:",OPT["--lb"]
-for x in numfound:
-    print "%40s :"%x, numfound[x]
-
-
-
-
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_cool_plot.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_cool_plot.py
deleted file mode 100755
index ab7844b4ca4c4577bde7d599d938d9b19250060a..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_cool_plot.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# L1CT crew, Johan.Lundberg@cern.ch, CERN, 2009
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " Make and draw CTPMON cool histograms "
-    print " "
-    print " Mandatory: "
-    print "  --inputfile | -i <filename>      A .py.obj with parsed cool data"    
-    print " "
-    print " Switches: "
-    print "  --text                      Display input data data"
-    print " "
-    print "  --outbase | -o <outname>    filename base for output files"     
-    print "  --nodrawHist                make histograms, do not draw"
-    print "  "
-    print "  --nodraw <opt1,opt2,...>"
-    print "    where opt: Log            don't draw Log plots"
-    print "               Lin            don't draw Lin plots"
-    print "               LB1D           don't draw 1D LB plots"
-    print "               allBCID        don't draw one BCID plot per counter"
-
-
-try:
-    longopts=['inputfile=','i=','help','text','nodraw='
-              'outbase=']
-    opts,args=getopt.getopt(sys.argv[1:],'i:o:',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-fname=""
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o in ('--inputfile','-i'):
-        fname=a
-if not fname:
-    usage()
-    sys.exit(2)
-
-## read file
-
-import ctpmon_py
-ctpmon_py.plotfile(fname,opts)
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_cool_reader.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_cool_reader.py
deleted file mode 100755
index 37e6bebbe6de026d37de1033fcede8a3b2ad8721..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_cool_reader.py
+++ /dev/null
@@ -1,327 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " From COOL database, read rates for specified combination of"
-    print " lumi blocks and CTPMON counter IDs."
-    print " "
-    print "  --run <runNo>              run number (single number), eg 134967"    
-    print " "
-    print " Note: If no run number is given. Find last run in cool (not always ATLAS partition)"
-    print " "
-    print "  --lb <lb ranges>           lumi block(s)"
-    print "       (default='L5',  - last 5 lumiblock only) "
-    print "  --counters <counter ranges> CTPMON counter nr(s)"
-    print "       (default='MBTS') "
-    print "    Can use comma separated Regular expressions for names"
-    print " "
-    print "  --bcid <bcid ranges>       bc id ranges"
-    print "       (default='1') "
-    print " "
-    print "  --nofillHist               don't fill histograms"
-    print "  --nodrawHist               don't fill and Draw histograms"
-    print "  --rootbatch                run root in batch mode (no windows)"
-    print " "
-    print "  --norunname                don't add run number to filenames"
-    print ""
-    print "  --bcidpattern              print beam bcidpattern:"
-    print "                             for beam1, for beam2, and colliding bunches "
-    print "         note: recommended to use '--bcid -' to consider all possible bunch numbers"
-    print " "
-    print "  --nodraw <opt1,opt2,...>"
-    print "    where opt: Log           don't draw Log plots"
-    print "               Lin           don't draw Lin plots"
-    print "               LB1D          don't draw 1D LB plots"
-    print "               allBCID       don't draw one BCID plot per counter"
-    print ""
-    print "  --maxzscale <number>       max z (color) scale range (default:auto)"
-    print ""
-    print "  --outbase | -o <filename>  Output base name "
-    print "       (default='CTPMON_', note: _<runNo>.<extensions> are added)"
-    print " "
-    print " Text output controls:"
-    print "  --verbose                  Do print text results"
-    print "  --textbc                   Do print per-bunch information"
-    print "  --textsum                  verbose, without per-counter information"
-    print " "
-    print " Range specifications:"
-    print "   <lumiblockNo> and <counterNo> and <bcID> can be specified as single "
-    print "   numbers, or ranges like this: "
-    print "      syntax:  1,3,10-13   gives:   1,3,10,11,12,13 "
-    print "      syntax:  3,10-       gives:   3,10... "
-    print "      syntax:  50,-10      gives:   ...10,50      "
-    print "      syntax:  -           gives:   all  "
-    print "   in addition, for lumiblocks only: "  
-    print "      syntax:  L5          gives:   5 latest  "
-    print " "
-try:
-    longopts=['norunname','run=','lb=','counters=','bcid=',
-              'help','verbose','textbc','textsum','maxzscale=',
-              'outbase=','nodraw=','nofillHist','nodrawHist','nobatch','bcidpattern']
-    opts,args=getopt.getopt(sys.argv[1:],'h',longopts)
-except getopt.GetoptError,e:
-    print "Option parsing error:"
-    usage()
-    sys.exit(2)
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-
-sys.argv[1:]=[] #prevent root to interpret command line parameters
-import l1ctpy
-# defaults:
-OPT={}
-OPT["--run"]=int(-1)
-OPT["--counters"]=["MBTS"]
-OPT["--bcids"]=[1]
-OPT["--lb"]=l1ctpy.text_to_ranges('L5')
-OPT["--verbose"]=False
-OPT["--textbc"]=False
-OPT["--nofillHist"]=False
-OPT["--nodrawHist"]=False
-OPT["--nodraw"]=""
-OPT["--textsum"]=False
-OPT["--filename"]="CTPMON_"
-OPT['--norunname'] = False
-OPT['--nobatch'] = False
-OPT['--bcidpattern'] = False
-OPT['--maxzscale'] = ''
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--run':
-        OPT["--run"] = a
-    if o == '--lb':                 
-        OPT["--lb"]=l1ctpy.text_to_ranges(a)
-    if o == '--outbase':                 
-        OPT["--filename"]=str(a)
-    if o == '--counters':
-        OPT["--counters"]=l1ctpy.text_to_ranges(a)
-        OPT["--counters"]=l1ctpy.expandlist(OPT["--counters"],0,160-1)
-    if o == '--bcid':
-        OPT["--bcids"]=l1ctpy.text_to_ranges(a)
-        OPT["--bcids"]=l1ctpy.expandlist(OPT["--bcids"],0,3564-1)
-    if o == '--textsum':
-        OPT["--textsum"] = True
-        OPT["--verbose"] = True
-    if o == '--textbc':
-        OPT["--textbc"] = True
-        OPT["--verbose"] = True
-    if o in ['--bcidpattern','--verbose','--nofillHist',"--nodrawHist",'--norunname','--nobatch']:
-        OPT[o] = True
-    if o == "--nodraw":
-        OPT["--nodraw"]=OPT["--nodraw"]+str(a)
-    if o == "--maxzscale":
-        OPT["--maxzscale"]=a    
-
-try:
-    OPT["--run"]=int(OPT["--run"])
-
-    if OPT["--run"] < 1:
-        print "No run specified. Finding last run in cool"
-        OPT["--run"]=l1ctpy.get_current_run()
-except BaseException,e:
-    usage()
-    print e
-    raise ValueError("You must specify a single run number, not:",OPT["--run"])
-
-
-if not OPT['--norunname'] :
-    OPT["--filename"]+=str(OPT["--run"])
-    
-#
-
-OPT['--RateTitle']='Run '+str(OPT["--run"])+ " : CTPMON Counter Rates, Hz"
-# print "WARN, rate in terms of rates"
-# OPT['--RateTitle']='Run '+str(OPT["--run"])+ " : CTPMON Counts"
-
-#print "Options:",OPT
-    
-import ctpmon_py
-
-#+-------------------------------------------
-# Open databases and get the required folders
-#+-------------------------------------------
-
-ctpmonfolder=ctpmon_py.getCoolFolder(ctpmon_py.get_dbid_MONP(),'/TRIGGER/LVL1/CTPMONDATA')
-lbfolder=ctpmon_py.getCoolFolder(ctpmon_py.get_dbid_COMP(),'/TRIGGER/LUMI/LBLB')
-
-LBs,TimeRanges=ctpmon_py.getLbTimesMulti(lbfolder,OPT["--run"],OPT["--lb"])
-
-l1ctpy.showlbandtime(LBs,OPT)
-
-#+-------------------------------------------
-# Counter names
-#+-------------------------------------------
-
-import numpy
-
-ROV1=(OPT["--run"]<<32)+1; 
-pattern='.*'
-CounterType='CTPMON'
-dbstring=l1ctpy.get_dbid_MONP()
-counterdb=l1ctpy.getcounterConfig(dbstring,ROV1,ROV1,pattern,CounterType)
-l1ctpy.backport_counternames(counterdb)
-l1ctpy.filter_and_add_counternames(counterdb,OPT)
-
-#+------------------------------------
-# Define and apply a blob calculator function
-#+------------------------------------
-
-#print "-----------------------------"
-#print OPT["--counters"]
-#print "-----------------------------"
-
-blobcalc=ctpmon_py.ReadMonBlob_detailed_Factory(OPT["--counters"],OPT["--bcids"],OPT["--verbose"])
-monTimeRanges,rates=ctpmon_py.getMONrates(ctpmonfolder,TimeRanges,blobcalc)
-
-print "Read ",len(rates),"monitoring blobs."
-if len(rates)<1:
-    print "No data found. Try a different run or a bigger LB range"
-    sys.exit(1)
-
-#newnames=[]
-#
-#f#o x in  OPT["--countersnames"]:
-#    x=x.replace('MBTS_','Cell ')
-#    x=x.replace('BPTX0','Beam 1')
-#    x=x.replace('BPTX1','Beam 2')
-#    newnames.append(x)#
-#
-#OPT["--countersnames"]=newnames
-#
-#f#or x in OPT["--countersnames"]:
-# #   print x
-#sys.exit()
-#
-    
-#+------------------------------------
-# find out which monitoring block is at what lb
-#+------------------------------------
-monblockLBs=[]
-for tt in monTimeRanges:
-    monblockLBs.append(ctpmon_py.time2lb(LBs,TimeRanges,tt))
-
-#+------------------------------------
-# find out which lb is in which monitoring block
-#+------------------------------------
-lbmatches=[]
-for tt in monTimeRanges:
-    lbmatches.append(ctpmon_py.compareranges(LBs,TimeRanges,tt))
-
-#+------------------------------------
-# Print to screen
-#+------------------------------------
-if OPT["--verbose"]:
-    ctpmon_py.showresults(monTimeRanges,rates,monblockLBs,OPT["--counters"],OPT["--bcids"],OPT["--textsum"],OPT["--textbc"])
-
-
-#OPT['--general_minimum']=1e-3
-#+------------------------------------
-#+ Write output to python file
-#+------------------------------------
-ctpmon_py.savefile(OPT,monTimeRanges,rates,lbmatches,monblockLBs)
-
-def boolify(vector,threshold=10000):
-    return map(lambda _ : 1 if _>threshold else 0,vector)
-
-def boolcoinsidence(vector1,vector2):
-    return map(lambda a,b : 1 if (a and b) else 0,vector1,vector2)
-
-def getfilled(bcidc,vector1):
-    results=[]    
-    for i,v in enumerate(vector1):
-        if v:
-            results.append(bcidc[i])
-    return results
-
-#Print bcid pattern
-def showBCIDS(monTimeRanges,rates,monblockLBs,counters,bcids):
-    bptx0_filled=[]
-    bptx1_filled=[]
-    bptxB_filled=[]
-    starttime=0
-    startlb=0
-    import time
-    import operator
-    print ">Bunch pattern for RUN: ", OPT['--run'] 
-#    print "bunch list: ",bcids
-    for tt,rr,ctpmon_i in zip(monTimeRanges,rates,range(len(rates))):
-
-        bptx0_filled_old=bptx0_filled;
-        bptx1_filled_old=bptx1_filled;
-        bptxB_filled_old=bptxB_filled;
-            
-#        starttime=time.ctime(tt[0]/1e9)
-        stoptime =time.ctime(tt[1]/1e9)
-#        print "CTPMON data time range: ",starttime,stoptime," seconds: ", '%.1f' % ((tt[1]-tt[0])*1e-9)
-       
-        bptxindex0=-1
-        bptxindex1=-1
-        for i,thisname in enumerate(OPT["--countersnames"]):
-            if 'BPTX0' in  thisname:
-                bptxindex0=i
-            if 'BPTX1' in  thisname:
-                bptxindex1=i
-
-        if bptxindex0<0 or         bptxindex1<0 :
-            print "can not look at filling scheme if both bptx is not there"
-            break
-
-        bptx0=boolify(rr[bptxindex0])
-        bptx1=boolify(rr[bptxindex1])
-        bptxB=boolcoinsidence(bptx0,bptx1)
-#        print bptx0
-#        print bptx1
-#        print bptx_both
-        bptx0_filled=getfilled(OPT["--bcids"],bptx0)
-        bptx1_filled=getfilled(OPT["--bcids"],bptx1)
-        bptxB_filled=getfilled(OPT["--bcids"],bptxB)
-
-        if  (bptx0_filled_old!=bptx0_filled or
-             bptx1_filled_old!=bptx1_filled or 
-             bptxB_filled_old!=bptxB_filled ) or starttime==0 :
-
-            duration=0
-            if starttime != 0:
-                duration = tt[1]-starttime
-                print '>End of record: record length was [s] ',(tt[0]-starttime)/1e9
-                print ">-----------------------------------------"
-                print ">Update at: ",time.ctime(tt[0]/1e9)
-            else:
-                print ">-----------------------------------------"
-                print ">First record at: ",time.ctime(tt[0]/1e9)
-
-            print ">Record start in terms of Lumiblocks:", '%.1f' % monblockLBs[ctpmon_i][0]
-            # ,'to', '%.1f' % monblockLBs[ctpmon_i][1]        
-            print ">#Beam1:",len(bptx0_filled)," #Beam2:", len(bptx1_filled), " #Coincidence: ",len(bptxB_filled)
-            print "> Beam1:       ",bptx0_filled
-            print "> Beam2:       ", bptx1_filled
-            print "> Coincidence: ",bptxB_filled        
-
-            if starttime == 0:
-                starttime=tt[0]
-if OPT['--bcidpattern']:
-    showBCIDS(monTimeRanges,rates,monblockLBs,OPT["--counters"],OPT["--bcids"])
-
-#+------------------------------------
-#+ Fill histograms and make plots if requested
-#+------------------------------------
-if not OPT["--nofillHist"]:
-#    ctpmon_py.plot(OPT,monblockLBs,rates,lbmatches,monblockLBs,opts)
-    ctpmon_py.plot(OPT,monTimeRanges,rates,lbmatches,monblockLBs,opts)
-
-    
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_py.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_py.py
deleted file mode 100644
index 42ae2fa47a27ec3affad4a647620a0e4320e6db8..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/ctpmon_py.py
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-if __name__ == "__main__":
-    print "Warning:"
-    print "   The ctpmon_py module is meant to be executed."
-    print "      try ctpmon_cool_reader.py "
-    print "       or ctpmon_cool_plot.py "
-
-# this makes it easy to move functions and constants
-# from here to l1ctpy
-from l1ctpy import *
-
-#+================================================================
-#+
-#+ CTPMON specific functions for reading and parsing blob data
-#+
-#+================================================================
-
-
-#+ -------------------------------------------------------------
-#+ Factory function, returns full information for the specified ranges.
-#+ produced function Returns a list of lists (a matrix)
-#+   first index goes over the selected ptcs
-#+   seconds index goes over the selected bunches
-def ReadMonBlob_detailed_Factory(ptcs=range(160),bunches=range(3564),verbose=False):
-    if verbose:
-        print "Contructing blob calculator for:"
-        print "  ptcs   : ",ptcs
-        print "  bunches: ",bunches
-    if(len(ptcs)<1):
-        raise ValueError("can't handle empty counter range")
-    def Blobcalc(blob,downscaling=1.0):
-        " Reads a monitoring CTPMON blob at given ptc and bunch.\
-          Returns all counter values. "      
-        # output vector of empty vectors
-        sums=map(lambda _: [] ,ptcs)
-
-        i=0
-        for ptc in ptcs:
-            for bunch in bunches:
-                indx=(ptc*3564+bunch)*4
-                blob.seek(indx)
-                here=sums[i]
-                sums[i].append((1.0/downscaling)*IntegerDecode(blob.read(4)))
-            i+=1                     
-        return sums
-    return Blobcalc
-
-#+ -------------------------------------------------------------
-#+ returns requested rates 
-#+ times should be a list of (start,stop) time tuples, eg from getLbTimes
-#+ Output is a list of (start,stop) tuples for the CTPMON blob ROVs
-#+ and the correspondig output from the blob calculator
-def getMONrates(monfolder,times,blobcalc):
-    from PyCool import cool
-    blobs=[]
-    StopTimes=[]
-    StartTimes=[]        
-    oldpersentage=""
-    for t,t_i in zip(times,range(len(times))):
-        dir(cool)
-        dir(monfolder)
-        obj=monfolder.browseObjects(t[0],t[1],cool.ChannelSelection.all())
-        persentage='reading CTPMON blobs, %3.0f %%' % (100*(t_i+1)/len(times))
-        if not persentage == oldpersentage:
-            print persentage
-            oldpersentage=persentage
-        for o in obj:
-            payload=o.payload()
-            starttime=o.since()
-            if starttime in StartTimes :
-                pass
-            else:
-                StartTimes.append(starttime)
-                StopTimes.append(o.until())           
-                turnnr=payload["TurnNumber"]
-                errorbits=payload["ErrorBits"]
-                if errorbits>0:
-                    print "****Error, non zero errorbits:",errorbits
-                livetime=turnnr/ORBIT_FREQUENCY
-                thissum=blobcalc(payload["CounterBlob"],livetime)
-#                thissum=blobcalc(payload["CounterBlob"],1)
-                blobs.append(thissum)             
-    return zip(StartTimes,StopTimes),blobs
-#print "WARNING WARNING -- CTPMON IS IN TERMS OF COUNTS NOW"
-
-
-#+================================================================
-#+
-#+ CTPMON specific functions for saving, loading, histogramming 
-#+ and drawing blob data
-#+
-#+================================================================
-
-#+ -------------------------------------------------------------
-#+ Display CTPMON cool data as returned by getMONrates
-#+ monblockLBs should of the format returned by time2lb()
-def showresults(monTimeRanges,rates,monblockLBs,counters,bcids,textsum=False,textbc=False):
-    import operator
-    print "printing results:" 
-    print "bunch list: ",bcids
-    for tt,rr,ctpmon_i in zip(monTimeRanges,rates,range(len(rates))):
-        print "CTPMON data time range: ",tt ," seconds: ", '%.1f' % ((tt[1]-tt[0])*1e-9)
-        print "in terms of Lumiblocks:", '%.1f' % monblockLBs[ctpmon_i][0] ,'to', '%.1f' % monblockLBs[ctpmon_i][1]
-        sums=map(lambda _:0,rr)
-        for r,i in zip(rr,range(len(rr))):
-            sums[i]=reduce(operator.add,r)
-            if not textsum:
-                if textbc:
-                    print "  counter:",counters[i],", rate: ",r
-                print "  counter:",counters[i],", sum:  ",sums[i]
-        print "    total:", reduce(operator.add,sums)
-
-#+ -------------------------------------------------------------
-#+ Same the results of the blob reading to a python picke object file
-#+ OPT should contains some fields, read below.
-def savefile(OPT,monTimeRanges,rates,lbmatches,monblockLBs):
-    import pickle
-    try:
-        fname=OPT["--filename"] + '_py.obj'
-        dumpfile=open(fname,'w')
-        contents={}
-        contents['monTimeRanges']=monTimeRanges
-        contents['rates']=rates
-        contents['lbmatches']=lbmatches
-        contents['monblockLBs']=monblockLBs
-        contents['OPT']=OPT
-        pickle.dump(contents,dumpfile)
-        dumpfile.close()
-        print "Saved results to:",fname
-    except:
-        print "File save failed. Filename:",fname
-
-
-#+ -------------------------------------------------------------
-#+ Histogram and plot the contents of a saved python pickle file
-#  options:
-#    print "  --outbase | -o <outname>  path base for output files"     
-#    print "  --nodraw                    make histograms, do not draw"
-#    print "  --verbose                   Display full data"
-def plotfile(fname,opts=[[0,0]]):
-    import pickle
-    dumpfile=open(fname,'r')
-    contents=pickle.load(dumpfile)
-    monTimeRanges=contents['monTimeRanges']
-    rates=contents['rates']
-    lbmatches=contents['lbmatches']
-    OPT=contents['OPT']
-    monblockLBs=contents['monblockLBs']
-    dumpfile.close()
-    OPT["--drawhist"]=True
-    OPT["--makehist"]=True
-    OPT["--nodraw"]='no'
-    for o,a in opts:
-        if o in ('--nodraw'):
-            OPT["--drawhist"]=False
-        if o in ('--outbase','-o'):
-            OPT["--filename"]=a
-        if o in ('--text'):
-            OPT["--text"]=True
-        if o in ('--nodraw'):
-            OPT["--nodraw"]=OPT["--nodraw"]+str(a)
-
-    if "text" in OPT:
-        OPT["--textbc"]=True
-        showresults(monTimeRanges,rates,monblockLBs,OPT["--counters"],OPT["--bcids"],OPT["--textsum"],OPT["--textbc"])
-    
-    plot(OPT,monTimeRanges,rates,lbmatches,monblockLBs,opts)
-    
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/fillLVL1histograms.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/fillLVL1histograms.py
deleted file mode 100755
index 4278eab36e1a8ef531ee413406a0d94e2b347bed..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/fillLVL1histograms.py
+++ /dev/null
@@ -1,297 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-# set the folder description for the trigger schema (not set by default)
-
-import sys,getopt,os
-from PyCool import cool,coral
-import ROOT
-from ROOT import TCanvas, TH1F, TFile
-
-try:
-    longopts=['cooldb=','r=','help']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    print e
-    print "Wrong option"
-    sys.exit(-1)
-
-lb1=int(0)
-lb2=int(0)
-debug=bool(False)
-
-for o,a in opts:
-    if (o=='--r'): run=int(a)
-
-print
-print "------------------------------------"
-print "Run",run
-print "------------------------------------"
-print
-
-# get database service and open database
-dbSvc=cool.DatabaseSvcFactory.databaseService()
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user="+dbuser+";password="+dbpw
-#olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-
-try:
-    db=dbSvc.openDatabase(dbstring,False)
-    if (debug) : print "Opened database",dbstring
-except Exception,e:
-    print e
-    sys.exit(-1)
-
-# set folders all run-event index
-# AthenaAttributeList as type 0, CondAttributeList collection as type 1
-# timestamp for folders bit 1
-
-# LVL1 trigger counters for each trigger item, before and after pre-scales,
-# and after veto (deadtime, busy, etc.). For each counter there is an overflow flag. Indexed by run-LB
-lvl1counters_foldername='/TRIGGER/LUMI/LVL1COUNTERS'
-# VL1 menu items, indexed by run-LB.
-lvl1menu_foldername='/TRIGGER/LVL1/Menu'
-lvl1lbdata_foldername='/TRIGGER/LVL1/CTPCORELBDATA'
-# Information on start-end time of luminoisty blocks, indexed by run-LB.
-lblb_foldername='/TRIGGER/LUMI/LBLB'
-lvl1lbcoreinput_foldername='/TRIGGER/LVL1/CTPCOREINPUTS'
-if not db.existsFolder(lvl1counters_foldername) :
-    print "Folder",lvl1counters_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lvl1menu_foldername) :
-    print "Folder",lvl1menu_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lvl1lbdata_foldername) :
-    print "Folder",lvl1lbdata_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lblb_foldername) :
-    print "Folder",lblb_foldername,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(lvl1lbcoreinput_foldername) :
-    print "Folder",lvl1lbcoreinput_foldername,"notfound"
-    db.closeDatabase()
-    sys.exit(-1)
-
-
-items=[""]*256
-L1As=[]
-L1ATurns=[]
-TAVs=[]
-TAPs=[]
-TBPs=[]
-startTimes=[]
-endTimes=[]
-PITs=[]
-folder=db.getFolder(lvl1menu_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        itemNo=obj.channelId()
-        payload=obj.payload()
-        items[itemNo] = payload['ItemName']
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1menu_foldername,"failed:",e
-
-if len(items) != 256 :
-    print "Number of items should be 256, instead ", len(items), "items found"
-
- 
-folder=db.getFolder(lvl1lbdata_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        L1As.append(payload['GlobalL1AcceptCounter'])
-        L1ATurns.append(payload['GlobalL1AcceptTurnCounter'])
-            
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-folder=db.getFolder(lblb_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        startTimes.append(payload['StartTime'])
-        endTimes.append(payload['EndTime'])
-            
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-folder=db.getFolder(lvl1counters_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    lb = 0
-    oldItem = -1
-    while itr.goToNext():
-        obj=itr.currentRef()
-        itemNo=obj.channelId()
-        if (oldItem == -1 or itemNo == 0) :
-            tavs=[]
-            TAVs.append(tavs)
-            tbps=[]
-            TBPs.append(tbps)
-            taps=[]
-            TAPs.append(taps)            
-        if (oldItem != itemNo) :
-            lb = 0
-        else :
-            lb += 1
-        payload=obj.payload()            
-        TAVs[lb].append(int(payload['L1Accept']))
-        TBPs[lb].append(int(payload['BeforePrescale']))
-        TAPs[lb].append(int(payload['AfterPrescale']))
-        oldItem = itemNo
-        
-    itr.close()
-except Exception,e:
-    print "Reading data from",lvl1lbdata_foldername,"failed:",e
-
-folder=db.getFolder(lvl1lbcoreinput_foldername)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    lb = 0
-    oldItem = -1
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        itemNo=obj.channelId()
-        if (oldItem == -1 or itemNo == 0) :
-            pits=[]
-            PITs.append(pits)
-        if (oldItem != itemNo) :
-            lb = 0
-        else :
-            lb += 1
-        payload=obj.payload()
-        PITs[lb].append(int(payload['PIT_TriggerInput']))
-        oldItem = itemNo
-        
-    itr.close()
-
-
-except Exception,e:
-    print "Reading data from",lvl1lbcoreinput_foldername,"failed:",e
-
-if (len(L1As) != len(endTimes)) :
-    print "Problem: length of L1A vector (",len(L1As),") not equal length of time vector (",len(endTimes),")"
-
-
-#----------------------------------------------------------------
-# calculate the lumi block length and the L1A rate
-#----------------------------------------------------------------
-L1Arate=[]
-length=[]
-LB = 0
-for i in range(0,len(L1As)) :
-    length.append(1e-9*(endTimes[i] - startTimes[i]))
-    rate1=float(L1As[i]) / float(L1ATurns[i]) * 11246.0
-    L1Arate.append(float(L1As[i]) / length[i])
-    LB += 1
-
-#----------------------------------------------------------------
-# calculate the rates per Lumi block and per item
-#----------------------------------------------------------------
-TAVrate=[]
-TAPrate=[]
-TBPrate=[]
-for j in range(0,len(items)) :
-    tavrate=[]
-    taprate=[]
-    tbprate=[]
-    for i in range(0,len(L1As)) :
-        tavrate.append(float(TAVs[i][j]) / length[i])
-        taprate.append(float(TAPs[i][j]) / length[i])
-        tbprate.append(float(TBPs[i][j]) / length[i])
-    TAVrate.append(tavrate)
-    TAPrate.append(taprate)
-    TBPrate.append(tbprate)
-
-#----------------------------------------------------------------
-# calculate PITs rates per Lumi block
-#----------------------------------------------------------------
-PITrate=[]
-for j in range(0,159) :
-    pitrate=[]
-    for i in range(0,len(L1As)) :
-        pitrate.append(float(PITs[i][j]) / length[i])
-    PITrate.append(pitrate)
-
-#-----------------------------------------------------------------
-# helper function to fill histograms  
-#-----------------------------------------------------------------
-def makeHist(name, title, Ytitle, file, vect, dir, nbins, xmin, xmax) :
-
-    histFile = TFile(fileName,"UPDATE")
-    htest = TH1F( name, title, nbins, xmin, xmax )
-    for j in range(0, nbins) :
-        htest.SetBinContent(j+1, vect[j])
-    htest.SetXTitle("Luminosity Block")
-    htest.SetYTitle(Ytitle)
-    histFile.Cd(dir)    
-    htest.Write()
-    histFile.Close()
-#-----------------------------------------------------------------
-#-----------------------------------------------------------------
-
-fileName = "RUN_" + str(run) + "_hist.root"
-histFile = TFile(fileName,"RECREATE")
-histFile.mkdir("TAV")
-histFile.mkdir("TAP")
-histFile.mkdir("TBP")
-histFile.mkdir("PIT")
-histFile.Close()
-name ="h_LB_duration"
-title = "luminosity block duration"
-makeHist(str(name), str(title), "Time [s]",fileName, length, str(), int(LB), int(1), int(LB+1))
-name ="h_L1A_rate"
-title = "L1A rate vs luminosity block"
-makeHist(str(name), str(title), "Rate [Hz]",fileName, L1Arate, str(), int(LB), int(1), int(LB+1))
-for i in range(0, len(items)) :
-    if (len(items[i]) == 0) :
-        continue
-        if (TBPrate[i] == 0) :
-            print "item #",i,"has no item name but has a rate different than zero! skipping it"
-    name = "h_tav_"+items[i]
-    title = items[i] + " TAV rate vs luminosity block"
-    makeHist(str(name), str(title), "Rate [Hz]", str(histFile), TAVrate[i], str("TAV"), int(LB), int(1), int(LB+1))
-    name = "h_tap_"+items[i]
-    title = items[i] + " TAP rate vs luminosity block"
-    makeHist(str(name), str(title), "Rate [Hz]", str(histFile), TAPrate[i], str("TAP"), int(LB), int(1), int(LB+1))
-    name = "h_tbp_"+items[i]
-    title = items[i] + " TBP rate vs luminosity block"
-    makeHist(str(name), str(title), "Rate [Hz]", str(histFile), TBPrate[i], str("TBP"), int(LB), int(1), int(LB+1))
-
-for i in range(0, 159) :
-    name = "h_pit"+str(i)
-    title = "PIT item "+str(i)+" rate vs luminosity block"
-    makeHist(str(name), str(title), "Rate [Hz]", str(histFile), PITrate[i], str("PIT"), int(LB), int(1), int(LB+1))
-
-print "luminosity blocks: ", len(L1As)
-db.closeDatabase()
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_RunStatus.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_RunStatus.py
deleted file mode 100755
index f8a86ae41794303168e6103043ffdb252a4be818..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_RunStatus.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-##
-## Central Trigger Crew, Johan Lundberg, 2009
-#
-# Get Partition name and running status: CleanStop, Stop or not stopped
-# ---------------------------------------------------------------------
-#
-# arguments: any number of run numbers
-
-import l1ctpy
-
-run=0
-
-
-def get_partition_name(runnr):
-   try:
-      from PyCool import cool
-      import time
-      folder=l1ctpy.getCoolFolder(l1ctpy.get_dbid_TDAQ_COMP(),'/TDAQ/RunCtrl/EventCounters')
-      
-      ROV1=cool.ValidityKey((run<<32)+1)
-      ROV2=ROV1
-      #
-      objs=list(folder.browseObjects(ROV1,ROV2,cool.ChannelSelection.all()))
-      return objs[0].payload()["PartitionName"]      
-   except IndexError:
-      return ""
-#   except BaseException,e:    
-#      print "Exception: ",e,type(e)
-   return ""
-
-def get_partition_ongoing(runnr):
-   try:
-      from PyCool import cool
-      import time
-      folder=l1ctpy.getCoolFolder(l1ctpy.get_dbid_TDAQ_COMP(),'/TDAQ/RunCtrl/EOR_Params')
-      
-      ROV1=cool.ValidityKey((run<<32)+1)
-      ROV2=ROV1
-      #
-      objs=list(folder.browseObjects(ROV1,ROV2,cool.ChannelSelection.all()))
-
-      if objs[0].payload()["CleanStop"] :
-          return "CleanStop"
-      else:
-          return "NotCleanStop"      
-   except IndexError:
-      return ""
-#   except BaseException,e:      
-#      print "Exception: ",e
-   return ""
-
-
-import sys
-firstarg=1
-for r in sys.argv[1:]:
-    run=int(r)
-    print run, get_partition_name(run), get_partition_ongoing(run)
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_lb2time.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_lb2time.py
deleted file mode 100755
index bddb61ae3ca876be5d59d002b22752a352aa96a2..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_lb2time.py
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " From COOL database, read lumiblock times and write a root file"
-    print " with a histogram with N bin per second, filled with interpolated"
-    print " lumiblock number."
-    print " Example, a value of 15.9 is at the end of lumiblock 15"
-    print " the interpolation is linear in time within each lumi block"
-    
-    print ""
-    print "  --run <runNo>              run number (single number), eg 134967"    
-    print "  --dt seconds               time granularity of time->lb map "    
-    print " "
-    print "  --since_runstart           subtract start of first lb from all times"
-    print " "
-    print "  --outbase | -o <filename>  Output base name "
-    print "       (default='CTPMON_', note: _<runNo>.<extensions> are added)"
-    print " "
-    print "  --list                     print the lb times and exit."
-    print "  --summary                  Short summary and exit. "
-try:
-    longopts=['norunname','run=','dt=','counters=','bcid=','summary',
-              'help','verbose','textbc','textsum','list',
-              'outbase=','nodraw=','nofillHist','nodrawHist','nobatch']
-    opts,args=getopt.getopt(sys.argv[1:],'h',longopts)
-except getopt.GetoptError,e:
-    print "Option parsing error:"
-    usage()
-    sys.exit(2)
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-
-import l1ctpy
-# defaults:
-OPT={}
-OPT["--run"]=int(-1)
-OPT["--summary"]=False
-OPT["--list"]=False
-OPT["--verbose"]=False
-OPT["--filename"]="LBINTERP_"
-OPT['--norunname'] = False
-OPT["--dt"]=1
-OPT["--lb"]=l1ctpy.text_to_ranges('-')
-OPT['--since_runstart']=0
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--run':
-        OPT["--run"] = a
-    if o == '--dt':
-        OPT["--dt"] = float(a)
-    if o == '--since_runstart':
-        OPT['--since_runstart']=1
-    if o == '--outbase':                 
-        OPT["--filename"]=str(a)
-    if o == '--summary':                 
-        OPT["--summary"]=True
-    if o == '--list':                 
-        OPT["--list"]=True
-
-try:
-    OPT["--run"]=int(OPT["--run"])
-
-    if OPT["--run"] < 1:
-        print "No run specified. Finding last run in cool"
-        OPT["--run"]=l1ctpy.get_current_run()
-except BaseException,e:
-    usage()
-    print e
-    raise ValueError("You must specify a single run number, not:",OPT["--run"])
-
-
-if not OPT['--norunname'] :
-    OPT["--filename"]+=str(OPT["--run"])
-    
-
-OPT['--RateTitle']='Run '+str(OPT["--run"])+ " : CTPMON Counter Rates, Hz"
-
-if  OPT['--verbose'] :
-    print "Options:",OPT
-    
-import l1ctpy
-
-#+-------------------------------------------
-# Open databases and get the required folders
-#+-------------------------------------------
-lbfolder=l1ctpy.getCoolFolder(l1ctpy.get_dbid_COMP(),'/TRIGGER/LUMI/LBLB')
-LBs,TimeRanges=l1ctpy.getLbTimesMulti(lbfolder,OPT["--run"],OPT["--lb"])
-
-
-monblockLBs=[]
-monTimeRanges0=TimeRanges[0]
-monTimeRangeslast=TimeRanges[-1][0]
-
-if OPT['--list']:
-    import time
-
-    print "lumiblocks:"
-    for l,t in zip(LBs,TimeRanges):
-        print "%4d:  %20s -- %20s" % ( l , time.asctime(time.localtime(t[0]/1e9)),time.asctime(time.localtime(t[1]/1e9)))
-
-if OPT['--list'] or  OPT['--summary']:
-    ## NOTE! do not change the format returned by --summary, it is used
-    ## by some bash scripts
-    print len(LBs), int(TimeRanges[0][0]/1e9),int(TimeRanges[-1][-1]/1e9) 
-    sys.exit()
-    
-monTimeRanges=[];
-m=monTimeRanges0
-#print m
-duration=OPT["--dt"] # i second
-
-m=(m[0],m[0]+duration*1e9) # 10 seconds
-print "building time vector"
-while m[0]<monTimeRangeslast+duration*1000*1e9:
-    monTimeRanges.append(m);
-    #print m[0]/1.e18
-    m=(m[1],m[1]+duration*1e9) # 
-
-print "matching lumi blocks for",len(monTimeRanges),"time entries"
-for tt in monTimeRanges:
-    monblockLBs.append(l1ctpy.time2lb(LBs,TimeRanges,tt))
-
-times=[]
-lbs=[]
-for i,tt in enumerate(monTimeRanges):
-    times.append(tt[0]*1e-9)
-    lbs.append(monblockLBs[i][0])
-
-for i in range(len(lbs)-1):
-    if lbs[i+1]<=lbs[i]:
-        lbs[i+1]=lbs[i]+1e-7;
-
-#print LBs
-
-print "writing root file"
-import ROOT
-import numpy
-
-def rootarray(inp):
-    return numpy.array(inp, dtype=numpy.double)
-
-if OPT['--since_runstart']:
-    firsttime=TimeRanges[0][0]
-else:
-    firsttime=0
-TimeRanges=map(lambda x: [(x[0]-firsttime)*1e-9,(x[1]-firsttime)*1e-9], TimeRanges)
-
-alltimes=[]
-for i,t in enumerate(TimeRanges):
-    alltimes.append(t[0])
-alltimes.append(TimeRanges[-1][1])
-
-starttimes=ROOT.TH1D("LB_start","LB_start",len(LBs),LBs[0]-0.5,LBs[-1]+0.5)
-stoptimes=ROOT.TH1D("LB_stop","LB_stop",len(LBs),LBs[0]-0.5,LBs[-1]+0.5)
-dttimes=ROOT.TH1D("LB_dt","LB_dt",len(LBs),LBs[0]-0.5,LBs[-1]+0.5)
-centertimes=ROOT.TH1D("LB_center","LB_center",len(LBs),LBs[0]-0.5,LBs[-1]+0.5)
-
-times_lb=ROOT.TH1D("exact_lb_at_time","exact lb at time",len(LBs),rootarray(alltimes))
-
-times_lb_elapsed=ROOT.TH1D("exact_lb_at_elapsed_time_sec","exact lb at elapsed time [s]",len(LBs),rootarray(alltimes))
-
-for i,t in enumerate(TimeRanges):
-    starttimes.Fill(LBs[i],TimeRanges[i][0])
-    stoptimes.Fill(LBs[i],TimeRanges[i][1])
-    dttimes.Fill(LBs[i],TimeRanges[i][1]-TimeRanges[i][0])
-    centertimes.Fill(LBs[i],0.5*(TimeRanges[i][1]+TimeRanges[i][0]))
-    times_lb.Fill(0.5*(TimeRanges[i][1]+TimeRanges[i][0]),LBs[i])
-    times_lb_elapsed.Fill(0.5*(alltimes[i]+alltimes[i+1]),LBs[i])
-
-# print monblockLBs
-outfile=ROOT.TFile(OPT['--filename']+".root","recreate");
-time2lbHist=ROOT.TH1D(str("time2lb"),str(""),len(lbs)-1,rootarray(lbs))
-
-for i,tt in enumerate(times):
-    time2lbHist.SetBinContent(i,tt)
-
-time2lbHist.Write()
-starttimes.Write()
-stoptimes.Write()
-dttimes.Write()
-centertimes.Write()
-times_lb.Write()
-times_lb_elapsed.Write()
-
-outfile.Close()
-print "wrote root file. Done."
-
-
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_read_counter_conf.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_read_counter_conf.py
deleted file mode 100755
index 3924bc02d38ce0932fe47ffec7bd6b927133d12d..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_read_counter_conf.py
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-#!/bin/env python2.5
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-import sys,getopt,os
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                   this printout"
-    print " "
-    print " From COOL DB, read ctpin input signal configuration"
-    print " for specified Run, and lumiblock"
-    print " "
-    print " Mandatory: "
-    print "  --run <runNo>              run number (single number), eg 135254"
-    print " "
-    print " Optional: "
-    print "  --lb <lb ranges>           lumi block (single number)"
-    print "       (default='1', first) "
-    print "  --names <signalnames>      regular expression"
-    print "  --sumtable                 print only: connector,cable,type,name"
-    print "  --sumtablereg              print regular expressions for matching each cable"
-    
-try:
-    longopts=['run=','lb=','names=','sumtable','sumtablereg',
-              'help','verbose']
-    opts,args=getopt.getopt(sys.argv[1:],'h',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2) 
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-
-# defaults:
-OPT={}
-OPT["--run"]=int(-1)
-OPT["--lb"]=1 
-OPT["--verbose"]=False
-OPT["--names"]=".*"
-OPT["--sumtable"]=False
-OPT["--sumtablereg"]=False
- 
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o in OPT:
-        OPT[o] = a
-    if o == '--verbose':                 
-        OPT["verbose"] = True
-    if o == '--sumtable':                 
-        OPT["--sumtable"] = True
-    if o == '--sumtablereg':                 
-        OPT["--sumtablereg"] = True
-
-try:
-    OPT["--run"]=int(OPT["--run"])
-    OPT["--lb"]=int(OPT["--lb"])
-    if OPT["--run"] < 1:
-        raise ValueError()
-except ValueError:
-    usage()
-    print "Error: You must specify a single run number, not:",OPT["--run"]
-    sys.exit(2)
-
-
-import l1ctpy
-from PyCool import cool
-import ctpmon_py as ctpcl
-import re
-
-pattern=".*%s.*" % OPT["--names"]
-
-dbstring=l1ctpy.get_dbid_MONP()
-ROV1=(OPT["--run"]<<32)+OPT["--lb"];
-numfound={}
-
-coutner='.*'
-CounterType='.*'
-
-signals=l1ctpy.getcounterConfig(dbstring,ROV1,ROV1,pattern,CounterType)
-
-# display signals:
-if signals:
-    realkeys = signals[0].keys() 
-    for p in signals:
-        if "CounterName" in realkeys and p["CounterName"]:
-            p["DisplayName"]=p["CounterName"]
-        else:
-            p["DisplayName"]=p["ThresholdName"]
-    if OPT["--sumtable"]:
-        for p in signals:
-            print p["CtpinSlot"]," ",p["CtpinConnector"], " ", p['DisplayName']," ", p['CounterType']
-            
-    elif OPT["--sumtablereg"]:
-        first=1
-        lastcabcon=''
-        currentstring=""
-        for p in signals:
-            cabcon="%s %s %s " % ( p["CounterType"],p["CtpinSlot"], str(p["CtpinConnector"]))
-            if not lastcabcon == cabcon:
-                print currentstring
-                currentstring=""
-                lastcabcon=cabcon
-                currentstring=cabcon
-            else:
-                currentstring=currentstring+str(",")
-            currentstring=currentstring+str("^%s$"%p['DisplayName'])
-        if currentstring:
-            print currentstring
-        print ""
-    else:
-        for p in signals:
-            print "======== %40s : Monitor: %d" % ( p['DisplayName'], p['CounterNr'])
-            for it in sorted(realkeys):
-                print it, " ", p[it]
-                numfound=len(signals)
-
-
-if not ( OPT["--sumtable"] or OPT["--sumtablereg"]):
-    print "-------------------------------------------------------------------"
-    print "Number of found signals for pattern",OPT["--names"],"run:",OPT["--run"]," lb:",OPT["--lb"] ," is %40s"% numfound
-
-
-    
-
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_runNr.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_runNr.py
deleted file mode 100755
index 3fb5176c12a8d502ffd156a89c21fb4e4ef37421..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ct_runNr.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-##
-## Central Trigger Crew, Johan Lundberg, 2009
-#
-# get current run number or list of latest run numbers from cool
-# ----------------------
-#
-# optional arguments MAXRUNS MAXDAYS
-#
-# Maxruns is the maximum number of runs to return
-#
-# maxdays is the maximum number of days (from today) to search
-#
-# default is 1 1
-
-import l1ctpy
-
-maxruns=1
-maxdays=1
-
-import sys
-firstarg=1
-verbose=0
-if len(sys.argv)>1:
-    maxruns=int(sys.argv[firstarg])
-if len(sys.argv)>2:
-    maxdays=int(sys.argv[firstarg+1])
-
-
-R=l1ctpy.get_current_runs(maxdays,maxruns)
-
-print " "
-print "RUNS:",
-for r in R:
-    print r,
-
-
-
-
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ctpy.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ctpy.py
deleted file mode 100644
index 9bc4efc00f668e7bfae6d7d2c83eb73b4e084f48..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/l1ctpy.py
+++ /dev/null
@@ -1,1418 +0,0 @@
-#!/bin/env python2.5
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-#
-# Level 1 Central Trigger crew,
-# Johan.Lundberg@cern.ch, CERN, 2009
-
-import os
-
-#os.environ['CORAL_DBLOOKUP_PATH']='/atlas/db/.adm/coral/'
-#os.environ['CORAL_AUTH_PATH']='/atlas/db/.adm/coral/'
-
-ORBIT_FREQUENCY = 40.0790e6 / 3564.
-
-#+================================================================
-#+
-#+ Generic utility functions
-#+
-#+================================================================
-
-_COOLDBOWNER='' 
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=DBNAME;user="+dbuser+";password="+dbpw
-#old_COOLDB="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=DBNAME;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-
-def get_dbid_MONP(owner=False):
-   if owner:
-       print "NO OWNER ACCOUNT IMPLEMENTED"
-       return _COOLDBOWNER.replace("DBNAME","MONP200")
-   else:
-       return _COOLDB.replace("DBNAME","MONP200")
-
-def get_dbid_COMP(owner=False):
-   if owner:
-       print "NO OWNER ACCOUNT IMPLEMENTED"
-       return _COOLDBOWNER.replace("DBNAME","COMP200")
-   else:
-       return _COOLDB.replace("DBNAME","COMP200")
-   
-
-def get_dbid_TDAQ_COMP(owner=False):
-   # Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-   # see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-   connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-   dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-   dbpw = None
-   dbuser = None
-   # Get username and password by parsing authentication XML file
-   authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-   authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-   for entry in authenticationList:
-      if entry.attributes["name"].value == connName:
-         parameters = entry.getElementsByTagName("parameter")
-         # Set username and password from authentication parameters
-         for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-               dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-               dbpw = parameter.attributes["value"].value
-   _COOLDB="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=DBNAME;user="+dbuser+";password="+dbpw
-   #old_COOLDB="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TDAQ;dbname=DBNAME;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-   if owner:
-       print "NO OWNER ACCOUNT IMPLEMENTED"
-       return _COOLDBOWNER.replace("DBNAME","COMP200")
-   else:
-       return _COOLDB.replace("DBNAME","COMP200")
-   
-
-#+-----------------------------------------------
-#+ convert text to range list 
-def text_to_ranges(instr):
-    # from the string, make a list of positive numbers
-    # comma separated numbers go in directly
-    # ranges are written with - and adds to the list [start,stop] points
-    # open ended itevals are allowed, example
-    #   1,2,3,10-12        ->  [ 1,2,3,[10,12] ]
-    #   1,2,3,10-          ->  [ 1,2,3,[10,None] ]
-    #   1,2,3,-10          ->  [ 1,2,3,[None,10] ]
-    output=[]
-    for j in instr.split(","):
-        try:
-            o=j.split("-")
-            if len(o) == 1:
-                output.append(int(o[0]))
-            else:
-                a=0
-                b=0
-                if not o[0]:
-                    a=None
-                else:
-                    a=int(o[0])
-                if not o[1]:
-                    b=None
-                else:
-                    b=int(o[1])
-                output.append([a,b])
-        # things we do not get we put there unparsed
-        except ValueError:
-            output.append(j)
-    return output        
-
-#+-----------------------------------------------
-#+ expand list of ranges sort + unique
-def expandlist(inp,min,max):    
-    out=[]
-    # make a vector of empty vectors 
-    for b in inp:
-        if str(b) == b:
-            out.append(b)
-        else:
-            try:
-                x0=b[0]
-                x1=b[1]
-                if x0 == None:
-                    x0=min
-                if x1 == None:
-                    x1=max
-            except TypeError:
-                x0=b
-                x1=b        
-            if x1>max or x0<min:
-                raise ValueError("Range",b," not in permitted range ",min,max)
-            map(out.append,range(x0,x1+1))
-    out=list(set(out))
-    out.sort()
-    for x in out:
-        if str(x) == x:
-            continue
-        if x<min or x>max :
-            raise ValueError("Range value ",x," not in permitted range ",min,max)
-    return out
-
-
-#+ -------------------------------------------------------------
-#+ Returns specified cool folder or folderset
-def getCoolFolder(dbname,foldername):
-    try:
-        from PyCool import cool
-        dbSvc=cool.DatabaseSvcFactory.databaseService()
-        db=dbSvc.openDatabase(dbname)
-        try:
-            fldr=db.getFolderSet(foldername)
-        except RuntimeError:
-            fldr=db.getFolder(foldername)
-        return fldr
-    except Exception,e:
-        print('Problem opening database or folder',e)
-        raise e
-
-#+ -------------------------------------------------------------
-#+ Lists contents of a cool folder or folderset
-def ListFolder(infolder):
-    print("list for folder:",infolder)
-    try:
-        myspec = infolder.payloadSpecification();
-        for myit in myspec:
-            print("Record name:",myit.name()," type:",myit.storageType().name())
-    except AttributeError,e:
-        for x in infolder.listFolders() :
-            print '   subfolder: ',x
-
-
-
-#+-------------------------------------------------------------
-#+ Show what run and LB and optionally what blob times are to be loaded
-def showlbandtime(LBs,OPT):
-    print "Run:                         ",OPT["--run"]
-    print "Lumiblock limits requested:  ",OPT["--lb"],
-    if 'L' in str(OPT['--lb']):
-        print " ( L<X> means last <X> lumiblocks )"
-    else:
-        print ""
-    
-        print "Selected ",len(LBs),"lumiblocks."
-        if OPT["--verbose"]:
-            for a,b in zip(LBs,TimeRanges):
-                print "    Lumiblock :",a,"  TimeRange:",b
-                
-
-#+-------------------------------------------------------------
-#+ Convert a 4 byte string to an integer (small endian)
-def IntegerDecode(ivbytes):        
-    # for small endian:
-    d,c,b,a=map(ord,list(ivbytes))
-    return a*2**24 + b*2**16 + c*2**8 + d
-
-
-#+-------------------------------------------------------------
-#+ make blob out of a vector of numbers
-#+ For the packing option, read help(struct)
-def blob_pack(numbers,packopts='<f'):
-    import struct
-    return ''.join(map(lambda j : struct.pack(packopts,j) , numbers))
-
-#+-------------------------------------------------------------
-#+ vector of numbers from blob 
-#+ For the unpacking option, read help(struct)
-def blob_unpack(blob,packopts='<f'):
-    import struct
-    packlength=len(struct.pack(packopts,3.14))
-    result=[]
-    for i in range(0,len(blob),packlength):
-        i2=i+packlength        
-        result.append(struct.unpack(packopts,blob[i:i2])[0])
-    return result
-
-#+ -----------------------------------------------------------
-#+ applying time zone and daylight time diff
-#+
-
-def local2utcDT(intime):
-   import time   
-   return (time.mktime(time.gmtime(int(intime))[0:-1]+(-1,))-int(intime))
-
-
-
-#+================================================================
-#+
-#+ Generic Cool Reading helper functions
-#+ Developed for ctpmon
-#+
-#+================================================================
-
-#+ -------------------------------------------------------------
-#+ Get a list of lumiblocks and a _list_ of (start,stop) times 
-#+ for the specified rangelist
-#+    rangelist is a list of lumi block ranges. A range
-#+    is either a number, a [start,stop] pair or a string starting with L,
-#+    for example L32, expands to the last 32 lumiblocks of the run
-#+
-#+ return list of lbs, and a list of start,stoptimes
-#+
-def getLbTimesMulti(lbfolder,run,rangelist):
-    LBs=[]
-    Times=[]
-    for r in rangelist:
-        # letter L
-        if str(r).find("L") >= 0:
-            xxx=r.replace("L","")
-            selection=int(xxx)
-            T1=1
-            T2=None
-            a,b=getLbTimes(lbfolder,run,T1,T2)
-            a=a[-selection:]
-            b=b[-selection:]
-            map(LBs.append,a)
-            map(Times.append,b)
-            continue
-        T1=r
-        T2=r
-        try:
-            T1=r[0]
-            T2=r[1]
-        except TypeError:
-            pass
-        if T1 == None:
-            T1=1     # first LB is 1
-        a,b=getLbTimes(lbfolder,run,T1,T2)
-        map(LBs.append,a)
-        map(Times.append,b)
-    return LBs,Times
-
-
-
-#+ -------------------------------------------------------------
-#+ Get a list of lumiblocks one pair of start,stop times
-#+                                   lb values are inclusive
-def getLbTimes(lbfolder,run,lbstart=1,lbstop=None):
-    from PyCool import cool
-    if lbstart < 1 :        
-        raise ValueError("error: lbstart must be >=1 , not:",lbstart)        
-    import operator
-    ROV1=(run << 32)+lbstart
-    if lbstop == None:
-        ROV2=((run+1) << 32)
-    else:
-        if lbstop < 1 :        
-            raise ValueError("error: lbstop must be >=1 or None, not:",lbstop)        
-        ROV2=(run << 32)+lbstop
-        
-    # find out the found Lumiblock numbers
-    objs=list(lbfolder.browseObjects(ROV1,ROV2,cool.ChannelSelection.all()))
-    LBs=[]
-    starttimes=[]
-    stoptimes=[]    
-    for obj in objs:
-        payload=obj.payload()
-        starttimes.append(payload["StartTime"])
-        stoptimes.append(payload["EndTime"])
-        LBs.append(lbstart)
-        lbstart+=1
-    
-    return LBs,zip(starttimes,stoptimes)
-
-
-
-
-#+ -------------------------------------------------------------
-#+ for the input blob times, find how much of each lumiblock is contained
-#+ returns a list of (luminumber,fraction) tuples
-def compareranges(lbs,lbtimes,input_times):
-    lllist=[]
-    for ll,tt in zip(lbs,lbtimes):
-        duration=tt[1]-tt[0]
-        startol=tt[0]
-        stopol=tt[1]
-        if startol<input_times[0]:
-            startol=input_times[0]
-        if stopol>input_times[1]:
-            stopol=input_times[1]
-        fraction=(stopol-startol)/(1.0*duration)
-        if fraction<0:
-            fraction=0
-        lllist.append((ll,fraction))
-    return lllist
-
-#+ -------------------------------------------------------------
-#+ convert times [start,stop] into an approximate lumiblock scale
-def time2lb(lbs,lbtimes,tin):
-    maxlb=max(lbs)
-    lbsEnd=map(lambda x:x+1 if not x==maxlb else x+0.999,lbs)
-    lumiaxis=[]
-    timeaxis=[]
-    for a,b,c in zip(lbs,lbsEnd,lbtimes):
-        lumiaxis.append(a)
-        lumiaxis.append(b)
-        timeaxis.append(c[0])
-        timeaxis.append(c[1])    
-    def tinterp(tmpval):
-        outp=lumiaxis[0]
-        if tmpval>=timeaxis[-1]:
-            return lumiaxis[-1]
-        if tmpval<=timeaxis[0]:
-            return lumiaxis[0]
-        for l,t,i in zip(lumiaxis,timeaxis,range(len(timeaxis))):
-            if i+1 == len(timeaxis):
-                # the end
-                continue
-            if tmpval>=timeaxis[i] and tmpval<=timeaxis[i+1]  :
-                if timeaxis[i+1] == timeaxis[i]:
-                    fract=0
-                else:
-                    fract=(tmpval-t)/(1.0*timeaxis[i+1]-timeaxis[i])
-                    if lumiaxis[i+1] == lumiaxis[i]:
-                        outp=lumiaxis[i]
-                    else:
-                        outp=l+fract*(lumiaxis[i+1]-lumiaxis[i])/(1.0*lumiaxis[i+1]-lumiaxis[i])
-                break
-        return outp        
-    return tinterp(tin[0]),tinterp(tin[1])
-
-
-
-
-
-
-
-
-#+-----------------------------------------------------
-#+ get the configuration of counters
-#
-def getcounterConfig(dbstring,ROV1,ROV2,pattern='.*',CounterType='.*'):
-    from PyCool import cool
-    import re
-    folder=getCoolFolder(dbstring,'/TRIGGER/LVL1/CTPInMonitoringMapping')
-    objs=folder.browseObjects(ROV1,ROV2,cool.ChannelSelection.all())
-    counters=[]
-    for obj in objs:
-        payload=obj.payload()
-        name=payload["ThresholdName"]
-        if re.match(CounterType,payload["CounterType"],re.IGNORECASE) and re.match(pattern,name,re.IGNORECASE):
-            pl={}
-            CounterNr=obj.channelId()
-            if payload["CounterType"] == 'CTPMON' :
-                CounterNr-=4*3*64
-            pl['CounterNr']=CounterNr
-            for it in folder.payloadSpecification():                
-                pl[it.name()]=(payload[it.name()])
-            counters.append(pl)
-    if counters:
-        def sortkey(sig):
-            return [sig['CounterType'],sig["CtpinSlot"],sig["CtpinConnector"],sig["ThresholdBitStart"],sig['ThresholdActive'],sig]
-        counters.sort(key=sortkey)
-
-    def namesorthelper(inpname):
-        name=inpname.rstrip('0123456789')
-        rest=inpname.lstrip(name)
-        number="____"+rest
-        try:
-            number=(int(rest))
-        except:
-            pass
-        return name, number
-        
-    counters.sort(key=lambda k: [k['CounterType'],k['CtpinSlot'],k['CtpinConnector'],namesorthelper(k['ThresholdName'])])
-
-    return counters
-
-
-#def findCounternumbers(NameList,CounterType=CTPIN,):
-    
-def set_rate_palette(dolog=False):
-
-    import sys
-    sys.argv[1:]=[]
-    import ROOT
-    import numpy
-
-    def rootarray(inp):
-        return numpy.array(inp, dtype=numpy.double)
-
-    NRGBs = 6;
-    NCont = 255;
-    if(dolog):    
-       stops = rootarray([0., 0.39 ,  0.53 ,  0.7275 ,  0.89 ,  1.0])
-    else:
-       stops = rootarray([0, 0.02, 0.06, 0.15, 0.30 ,1.0])
-       stops = rootarray([0, 0.15, 0.30, 0.50, 0.70 ,1.0])
-    red   = rootarray([1, 0.50, 0.87, 1.00, 0.51 ,0])
-    green = rootarray([1,  0.75, 1.00, 0.20, 0.00 ,0])
-    blue  = rootarray([1,  0.90, 0.12, 0.00, 0.00 ,0])
-    ROOT.gStyle.SetNumberContours(NCont);
-    ROOT.TColor.CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
-    ROOT.gStyle.SetLabelFont(63);
-    ROOT.gROOT.ForceStyle()
-
-def get_current_run_IS(is_partName='ATLAS'):
-   number=-2
-   try:
-      import ispy
-
-      is_partition = ispy.IPCPartition(is_partName)
-      oo=ispy.ISObject(is_partition, 'RunParams.SOR_RunParams','RunParams')
-      oo.checkout()
-      number=oo.run_number;
-   except:
-      raise RuntimeError("Error: To get the current RUN number from IS, you must setup the proper ONLINE environment (at Point 1)")
-   return number
-
-
-def get_current_runs(historical_days=5,historical_maxruns=1):
-   final=[]
-   try:
-      from PyCool import cool
-      import time
-      SOR_fld=getCoolFolder(get_dbid_COMP(),'/TRIGGER/LUMI/LBTIME')
-      ROV1=1e9*(time.time()-historical_days*24*3600)
-      ROV1=cool.ValidityKey(ROV1)
-      ROV2=cool.ValidityKeyMax
-      #
-      objs=list(SOR_fld.browseObjects(ROV1,ROV2,cool.ChannelSelection.all()))
-
-      runs=map(lambda x:x.get().payload()["Run"] ,objs)
-      runs=sorted(list(set(runs)))
-      runs.reverse()
-      i=0
-
-      for x in runs:
-         i+=1
-         final.append(int(x))
-         if i >= historical_maxruns:
-            break
-   except BaseException,e:      
-      print "Exception trying to find Run numbers:",e
-   return final
-
-def get_current_run():
-   run=get_current_runs(1,1)
-   if run :
-      run=run[0]
-   else:
-      run=-1  
-   return run
-
-def backport_counternames(counterdb):
-   if counterdb:
-      for i in range(len(counterdb)):
-         c=counterdb[i]
-         if not 'CounterName' in c or not c['CounterName'].strip():
-            c['CounterName']=c['ThresholdName']+"_nr"+str(c['CounterNr'])
-            counterdb[i]=c
-
-#+ Operates on counters listen in OPT["--counters"]
-#+ and adds OPT["--countersnames"]
-#+ based on counters database (as returned by l1ctpy.getcounterConfig)
-def filter_and_add_counternames(counterdb,OPT):
-    if counterdb:       
-        ## first make and add CounterName for old entris without it
-        ## filter on counter names
-        def counterselector(c):
-            import re
-            if c['CounterNr'] in OPT["--counters"]:
-                return True
-            for patt in OPT["--counters"]:
-                try:
-                    int(patt)
-                except:
-#                    if patt=='-':
-#                        return True
-                    if ('CounterName' in c and (re.match(str('.*'+patt+'.*'),c['CounterName'],re.IGNORECASE)) or
-                        re.match(str('.*'+patt+'.*'),c['ThresholdName'],re.IGNORECASE) ):
-                       return True
-            return False
-        counterdb=filter(counterselector,counterdb)
-
-        if not counterdb:
-            print "no counters matched. bye"
-            import sys
-            sys.exit(2)
-
-        OPT["--counters"]=[]
-        OPT["--countersnames"]=[]
-        for x in counterdb:
-            OPT["--counters"].append(x['CounterNr'])
-            if 'CounterName' in x:
-               OPT["--countersnames"].append(x['CounterName'])
-            else:
-               OPT["--countersnames"].append(x['ThresholdName'])
-    else:
-        print "No counters names found, using numbers"
-        counterdb=OPT["--counters"]
-        OPT["--counters"]=[]
-        OPT["--countersnames"]=[]
-        for x in counterdb:
-            OPT["--counters"].append(int(x))
-            OPT["--countersnames"].append(str('cntr:')+str(x))
-
-
-# write root object (for example canvas) to open root file
-def rootWrite(myTobject,newname):
-   oldname=myTobject.GetName()
-   myTobject.SetName("canvas_"+newname)
-   myTobject.Write()
-   myTobject.SetName(oldname)
-
-# Draw LB numbers on top of the histogram
-# timeaxis must be the x axis of h, and lbaxis have the same length 
-def drawaxis_timeLB(h,timeaxis,lbaxis,log=False,fontfactor=1):
-   import sys
-   sys.argv[1:]=[]
-   import ROOT
-
-   h.GetXaxis().SetTitle("LB");
-   h.GetXaxis().SetTitle("UTC Time");
-   h.GetXaxis().SetTimeDisplay(1);
-   h.GetXaxis().SetTimeFormat("%H:%M"); 
-   h.GetXaxis().SetLabelSize(20*fontfactor);
-
-   ROOT.gPad.Update()
-   ohigh=ROOT.gPad.GetUymax()
-   olow=ROOT.gPad.GetUymin()
-
-   log=ROOT.gPad.GetLogy()
-   if not 'TH2' in str(type(h)):
-      ohigh=h.GetMaximum()
-      olow=h.GetMinimum()
-   if(log):
-      import math
-      y = (math.pow(10,math.log10(ohigh) + 0.021*(math.log10(ohigh)-math.log10(olow))))
-   else:
-      y = (ohigh + 0.022*(ohigh-olow))
-
-   dy=y-ohigh
-
-   h.GetXaxis()
-   t=ROOT.TText();
-   t.SetTextSize(0.03*fontfactor);
-
-   rangemax=ROOT.gPad.GetUxmax()
-   rangemin=ROOT.gPad.GetUxmin()
-   #print rangemin,rangemax
-   ilow=len(timeaxis)+1
-   ihigh=0
-   for i,tt in enumerate(timeaxis):
-      if tt>=rangemin and tt<=rangemax :
-         ilow=min(ilow,i)
-         ihigh=max(ihigh,i)
-#   print ilow,ihigh
-   timeaxis=timeaxis[ilow:ihigh+1]
-   lbaxis=lbaxis[ilow:ihigh+1]
-   
-   x=min(timeaxis)-0.02 * (max(timeaxis)-min(timeaxis))
-   t.SetTextAlign(31);
-   t.DrawText(x,y,str("LB:"));
-
-   t.SetTextAngle(90);
-   t.SetTextAlign(12);
-
-   # convert to UTC time - NB! this adjusts the time offset to effectively convert local time to UTC (not pretty but leaving as is... /CO)
-   h.GetXaxis().SetTimeOffset(ROOT.gStyle.GetTimeOffset()+local2utcDT(timeaxis[0]))
-   h.GetXaxis().SetTimeFormat("%H:%M")
-
-   #Number of uniq lbs
-   nlb=len(sorted(list(set(map(lambda x:int(x),lbaxis)))))
-   ntics=35
-   divs=1
-   if nlb>50:
-       divs=2
-   if nlb>100:
-       divs=5
-   if nlb>300:
-       divs=10
-
-   lastlb=0
-   lasttime=0
-   olddv=0
-   started=0
-
-   # find out where to place the last lb label (always drawn)
-#   lastindex=0
-#   for ll in range(h.GetNbinsX()-1):
-#       if int(lbaxis[ll]) != int(lbaxis[ll+1]) :
-#           lastindex=ll+1
-#   finallb=int(lbaxis[lastindex])
-#   finaltime=timeaxis[lastindex]
-
-   finallb=int(lbaxis[-1])
-   finaltime=timeaxis[-1]
-
-#   print "final: ",finallb
-
-   # draw lb lables as often as they fit in
-   # but limited to the 'divs' modulo (eg print on multiples of 10) 
-   t.DrawText(finaltime,y,str(finallb));
-        
-   for ll in range(len(lbaxis)):
-       nextlb=int(lbaxis[ll]) 
-       dv=divs*(nextlb//divs)
-       nexttime=(timeaxis[ll]) 
-       i=nextlb-lastlb
-       dt=min(nexttime-lasttime,1.5*(finaltime-nexttime))
-
-       x = timeaxis[ll]#h.GetXaxis().GetBinCenter(ll+1);
-
-       if not started and nextlb>0:                
-           t.DrawText(x,y,str(int(lbaxis[ll]))); ## first LB
-           started=1
-           lastlb=nextlb
-           lasttime=nexttime
-           continue
-       if dt<(timeaxis[-1]-timeaxis[0])/(ntics): continue
-       if not i :continue
-       if(olddv != dv):
-           t.DrawText(x,y,str(dv));
-           lastlb=nextlb
-           lasttime=nexttime
-           odldv=dv
-
-
-
-
-def timeAverage(inTimeRanges,rates,numbins):
-    import numpy
-    import operator
-    factor=len(inTimeRanges)//numbins
-    if(factor<2):
-        return inTimeRanges,rates
-    
-    newT=[]
-    newR=[]
-    tmpR=list(rates[0])
-    tmpT=list(inTimeRanges[0])
-    totTime=0
-    def clearRate(R):
-        for k in len(R):
-            R[k]=R[k]*0
-    for ilong,t in enumerate(inTimeRanges):
-        i=int(ilong)
-        thisTime=(t[1]-t[0])
-        totTime=totTime+thisTime
-
-        tmpR=numpy.array(rates[i])*thisTime + numpy.array(tmpR)
-
-        #print 'iii ' ,i        
-        if (i%factor==0) or (i+1) == len(inTimeRanges):
-            #print 'iiiiiiix ' ,i
-            # divide by total time integrated normalize away the time
-            tmpR=map(lambda aa:aa/totTime,tmpR)
-            # set end time to the end of this record
-            tmpT[1]=t[1]
-            newT.append(list(tmpT))
-            newR.append(list(tmpR))
-            #newT=[inTimeRanges[i][0],inTimeRanges[i][0]]
-            # let the next one just continue from where we are
-            tmpT[0]=tmpT[1]
-            totTime=0
-    return newT,newR
-
-
-# Draws an axis maching that of the input histogram, + space at the edges.
-# (done my a 2d histogram, matching the dimensions of the input 1d or 2d histogram
-# but with additional space outside the axis edges )
-# example (inhist,0.1,0.1,0.1,0.1) adds 10% of padding on each side
-def drawspaceaxis(inhist,xlow=0,xhigh=0,ylow=0,yhigh=0):               
-   import sys
-   sys.argv[1:]=[]
-   import ROOT
-   import numpy
-   newxmin=inhist.GetXaxis().GetBinLowEdge(1)
-   newxmax=inhist.GetXaxis().GetBinUpEdge(inhist.GetNbinsX())
-   newymin=0
-   newymax=0
-
-   numybins=inhist.GetNbinsY()
-   numxbins=inhist.GetNbinsX()
-   if 'TH1' in str(type(inhist)):
-      newymin=inhist.GetMinimum()
-      newymax=inhist.GetMaximum()
-   else:
-      newymin=inhist.GetYaxis().GetBinLowEdge(1)
-      newymax=inhist.GetYaxis().GetBinUpEdge(inhist.GetNbinsY())
-
-   
-   newxmin,newxmax = newxmin-(newxmax-newxmin)*xlow, newxmax+(newxmax-newxmin)*xlow
-   newymin,newymax = newymin-(newymax-newymin)*ylow, newymax+(newymax-newymin)*yhigh              
-
-#   tmp2d = ROOT.TH1F(hex(int(1e10*(numpy.random.uniform())))[2:],"",2,newxmin,newxmax)
-   tmp2d = ROOT.TH2F(hex(int(1e10*(numpy.random.uniform())))[2:],"",numybins,newxmin,newxmax,numybins,newymin,newymax)
-   
-   tmp2d.SetTitle(inhist.GetTitle()) 
-   tmp2d.SetMaximum(inhist.GetMaximum())
-   tmp2d.SetMinimum(inhist.GetMinimum())
-   tmp2d.DrawCopy("A")
-   inhist.DrawCopy("AXIS same")
-   return tmp2d
-
-#+ -------------------------------------------------------------
-#+ Histogram, plot and save BUSY,CTPIN or CTPMON cool data as returned by getXXXrates
-#+ inblockLBs should of the format returned by time2lb()
-#+ OPT should contains som options about what should be done, read code...
-def plot(OPT,inTimeRanges,rates,lbmatches,inblockLBs,opts=[[0,0]],picformat='.png'):
-
-    def setzscale(histo,OPT,scaledown=1.0):
-#       maxval=histo.GetMaximum()
-       maxval=(histo.GetBinContent(histo.GetMaximumBin()))
-       if '--maxzscale' in OPT:
-          try:
-             maxvallim=((1/scaledown)*float(OPT['--maxzscale']))
-             if maxval>maxvallim:
-                maxval=maxvallim
-          except ValueError:
-             pass
-#       minval=(histo.GetBinContent(histo.GetMinimumBin()))
-       minval=histo.GetMinimum()
-       maxval=maxval+0.01*(maxval-minval)
-#       minimum=histo.GetMinimum()
-       if maxval<=(minval) :
-          maxval=((minval)+1e-6)*1.01 
-       histo.SetMaximum(maxval)
-       if maxval<=(minval*10.01) :
-          histo.SetMinimum(maxval/10.1)
-
-#          minimum=histo.GetMinimum()
-#          if minimum > histo.GetMaximum() :
-#             histo.SetMaximum(minimum*1.5+10) 
-
-    def setzscaleautomin(histo,OPT=None,scaledown=1.0):
-       # loop all bins, find smallest non-zero bin
-       # and set zscale to that
-       smallest=histo.GetBinContent(histo.GetMaximumBin())
-       if(smallest<1e-3):
-          histo.SetMinimum(1e-3)
-       else:
-          nbins=histo.GetNbinsZ()*histo.GetNbinsY()*histo.GetNbinsX()
-          for b in range(nbins):
-             thisv=histo.GetBinContent(b)
-             if thisv >1e-4:
-                smallest=min(thisv,smallest)
-          maxval=histo.GetBinContent(histo.GetMaximumBin())          
-          minval=0.98*smallest
-          #-0.02*(maxval-smallest)
-          if(minval<=1e-4):
-             minval=1e-4
-          histo.SetMinimum(minval)
-          
-
-#    print "WARNIN WARNING, COUNTS IN TERMS OF COUNTS"
-#    rateunit="COUNTS"
-    rateunit="Rate /Hz"
-    print "filling histograms for run: " + str(OPT["--run"])
-    basename=str(OPT["--filename"])+str("_")
-    for o,a in opts:
-        if o in ('-h','--help'):
-            usage()
-            sys.exit(0)
-        if o == '--verbose':                 
-            OPT["--verbose"] = True
-            OPT["--textsum"] = True
-            OPT["--verbose"] = True
-    import l1ctpy
-    import numpy
-
-    # root batch mode isdefault
-    if not '--nobatch' in OPT:
-       OPT['--nobatch']=False
-    if not OPT['--nobatch']:                   
-       import sys
-       sys.argv.append( '-b' )
-
-    import sys
-    sys.argv[1:]=[]
-    import ROOT
-
-    ###################################
-    def makeaxis(inRanges):
-        out_ax=set()
-        map(lambda x:out_ax.add(1.0*x[0]), inRanges)
-        map(lambda x:out_ax.add(1.0*x[1]), inRanges)
-        out_ax=sorted(list(out_ax))
-        return out_ax
-
-    def drawExactSame(hh):
-       hh.Draw("same hist E0")
-#       hh.Draw("same P0")
-    def drawExact(hh):
-       hh.Draw("hist E0")
-#       hh.Draw("same P0")
-
-    
-
-    timeaxis=makeaxis(inTimeRanges)
-    # ns->seconds
-
-    ## print "NOTE, LB AxIS MODE"
-    timeaxis=numpy.multiply(timeaxis,1e-9)
-    timeDiffUnixToROOT = (365*25+6)*24*3600 # number of seconds from Jan 1, 1970, 00:00:00 to Jan 1, 1995, 00:00:00 (6 leap years)
-    timeaxis=numpy.subtract(timeaxis,timeDiffUnixToROOT)
-
-    #print "LB AXIS"
-    #timeaxis=makeaxis(inblockLBs)
-    #print "LB AXIS"
-
-    lbaxis=makeaxis(inblockLBs)
-
-
-    
-#    print "LB AXIS"
-#    timeflow_ax=lbaxis
-    timeflow_ax=timeaxis
-
-    timeflow_ax.sort()
-
-    #    ROOT.gStyle.SetPalette(16)
-    ROOT.gStyle.SetOptStat(0);
-    ROOT.gStyle.SetOptTitle(1);
-    ROOT.gStyle.SetTitleBorderSize(0)
-    ROOT.gStyle.SetTitleFillColor(0)
-
-    fname=basename + '.root'
-    histFile = ROOT.TFile(fname,"RECREATE")
-
-    l1ctpy.set_rate_palette()
-
-    # make an array, and add one more entry at the end (end+1)
-    def rootarray(inp):
-        inp=list(inp)
-        inp.append(inp[-1]+1)
-        return numpy.array(inp, dtype=numpy.double)
-
-    timeflow_ax_r=rootarray(timeflow_ax)
-    counteraxis_r=rootarray(range(len(OPT["--counters"])))
-
-    ### rate vs lb
-    lbtotals=ROOT.TH1D(str("lb_total"),str(""),len(timeflow_ax_r)-1,timeflow_ax_r)
-    lbtotals.GetYaxis().SetTitle(OPT["--RateTitle"]);
-    lbtotals.SetLineColor(2)
-    lbtotals.SetFillColor(11)
-    lbtotals.SetFillStyle(1000)
-    setzscaleautomin(lbtotals,OPT)
-    setzscale(lbtotals,OPT)
-#    lbtotals.SetMinimum(0)
-
-
-    ### rate for lumiblock vs counter
-    lbcounters=ROOT.TH2D(str("lb2d"),str(""),len(timeflow_ax_r)-1,timeflow_ax_r,len(counteraxis_r)-1,counteraxis_r)
-
-    lbcounters.GetYaxis().SetTitle("");
-
-    lbcounters1d=[]
-    for c,nme in zip(OPT["--counters"],OPT["--countersnames"]):
-        h=ROOT.TH1D(nme,nme,len(timeflow_ax_r)-1,timeflow_ax_r)
-        h.GetYaxis().SetTitle(OPT["--RateTitle"]);
-        h.GetXaxis().SetTitle("Time");
-        lbcounters1d.append(h)
-            #a lists of 1d histograms, one for each counter
-
-    if not OPT["--bcids"]:
-        OPT["--bcids"]=None
-
-    if OPT["--bcids"]:
-        print "selected number of bcids: ", len(OPT["--bcids"])
-        bcidaxis_r=rootarray(range(OPT["--bcids"][0],1+OPT["--bcids"][-1]))
-        #print bcidaxis_r
-        bcidcounters1d=[]
-        bcidcounters2d=[]
-
-        ## For each counter, a plot Rate vs Bunch
-        for c,nme in zip(OPT["--counters"],OPT["--countersnames"]):
-            h=ROOT.TH1D(nme+str('bcid'),nme,len(bcidaxis_r)-1,bcidaxis_r)
-            h.GetYaxis().SetTitle(rateunit);
-            h.GetXaxis().SetTitle("Bunch Id");
-            h.GetYaxis().SetTitleOffset(1.7)
-            bcidcounters1d.append(h)
-            h.GetXaxis().SetLabelSize(20);
-
-        #For each counter, a plot BCID(Y) vs LB(X)
-        for c,nme in zip(OPT["--counters"],OPT["--countersnames"]):
-            h=ROOT.TH2D(nme+str('bcid_Time'),nme,len(timeflow_ax_r)-1,timeflow_ax_r,len(bcidaxis_r)-1,bcidaxis_r)
-            h.GetXaxis().SetTitle("");
-            h.GetYaxis().SetTitle("Bunch Id");
-            h.GetYaxis().SetTitleOffset(1.7)
-            bcidcounters2d.append(h)
-
-#            h.GetXaxis().SetLabelSize(20);
-
-        ### rate for bcid vs counter
-        bccounters=ROOT.TH2D(str("bc2d"),OPT["--RateTitle"],len(bcidaxis_r)-1,bcidaxis_r,len(counteraxis_r)-1,counteraxis_r)
-        bccounters.GetXaxis().SetTitle("Bunch ID");
-        bccounters.GetYaxis().SetTitle(); # counter nr
-        bccounters.GetXaxis().SetLabelSize(20);
-
-        ## rate vs bcid
-        bcidtotals=ROOT.TH1D(str("bc_total"),str(""),len(bcidaxis_r)-1,bcidaxis_r)
-        bcidtotals.GetXaxis().SetTitle("Bunch ID");
-        bcidtotals.GetYaxis().SetTitle(OPT["--RateTitle"]);
-        bcidtotals.GetYaxis().SetTitleOffset(1.4)
-        bcidtotals.SetLineColor(2)
-        bcidtotals.SetFillColor(11)
-        bcidtotals.SetFillStyle(1000)
-        setzscaleautomin(bcidtotals,OPT)
-        setzscale(bcidtotals,OPT)
-
-#        bcidtotals.SetMinimum(0)
-        bcidtotals.GetXaxis().SetLabelSize(20);
-
-    # works both with the ctpin, ctpmon and busy data
-    def fillresults(rates,timewise_ax,timewise_ax_widths,counters,textsum=False,filltotals=True,bcids=None):
-         ## Note: Totals is the max of all used
-         if len(rates) != len(timewise_ax):
-            raise RuntimeError('Rates and (time) axis not of same size')
-       
-         totaltimeax=sum(timewise_ax_widths)*1.0
-         for tt,rr,busy_i in zip(timewise_ax,rates,range(len(rates))):
-             ## bunch (center value) for use with filling
-             fillb=tt
-             per_time_scalefactor=timewise_ax_widths[busy_i]/totaltimeax
-             sums=map(lambda _:0,rr)
-             for i,sums in enumerate(rr):   # loop over counters
-                 try:
-                     try:
-                         value=float(sums)
-                     except TypeError,e:                     
-                         value=numpy.sum(sums)
-                 except ValueError:
-                     value=ord(sums)
-
-# NOTE: plots which do NOT have a time scale must be filled with COUNTS, not rate
-# then divide with the total time 
-                     
-                 lbcounters.Fill(fillb,i+0.1,value)
-                 lbcounters.SetBinError(lbcounters.FindBin(fillb,0,0),1e-12);
-                 lbcounters1d[i].Fill(fillb,value)
-                 lbcounters1d[i].SetBinError(lbcounters1d[i].FindBin(fillb,0,0),1e-12);
-                 if bcids:
-                     try:
-                         for rateloop,thisbc in zip(sums,bcids):  # loop over bcid
-                             bccounters.Fill(thisbc+0.1,i+0.1,(1.0*rateloop)*per_time_scalefactor)                     ## Do it here ,timewise_ax_widths
-                             bccounters.SetBinError(bccounters.FindBin(thisbc+0.1,0,0),1e-12);
-                             bcidcounters1d[i].Fill(thisbc+0.1,(1.0*rateloop)*per_time_scalefactor)                    ## Do it here ,timewise_ax_widths
-                             bcidcounters1d[i].SetBinError(bcidcounters1d[i].FindBin(thisbc+0.1,0,0),1e-12);
-                             #                    bccounters.Fill(thisbc+0.1,counters[i]+0.1,(1.0*rateloop))
-                             bcidtotals.Fill(thisbc+0.1,(1.0*rateloop)*per_time_scalefactor)                           ## Do it here ,timewise_ax_widths
-                             bcidtotals.SetBinError(bcidtotals.FindBin(thisbc+0.1,0,0),1e-12);
-
-                             bcidcounters2d[i].Fill(fillb,thisbc+0.1,(1.0*rateloop))
-
-
-                     except BaseException,e:
-                         print "Some type of error with this container ",e
-
-                     
-
-
-    blobcenters=[]
-
-#1e-9*
-    
-#    timeax_centers=map(lambda t:1e-9*0.5*(t[0]+t[1]), inTimeRanges)
-#    print "WARNING LB MODE"
-#    timeax_centers=map(lambda t:0.5*(t[0]+t[1]), inTimeRanges)
-    timeax_centers=map(lambda t:1e-9*0.5*(t[0]+t[1]), inTimeRanges)
-    timeax_widths=map(lambda t:1e-9*(t[1]-t[0]), inTimeRanges)
-#    timeax_widths=map(lambda t:1, inTimeRanges)
-    fillresults(rates,timeax_centers,timeax_widths,OPT["--counters"],OPT["--textsum"],True,OPT["--bcids"])
-#%    fillresults(rates,timeflow_ax,OPT["--counters"],OPT["--textsum"],True,OPT["--bcids"])
-
-    histFile.Write()
-    print "Saved histograms to:",fname
-    
-    if not OPT["--nodrawHist"] :
-
-        general_minimum=.01
-        if "--general_minimum" in OPT:
-           general_minimum=OPT["--general_minimum"]
-
-        print "drawing plots for run: " + str(OPT["--run"]) + str(' ')+str(int(1+max(lbaxis)-min(lbaxis))) + str(' lumiblocks')
-
-        if OPT["--bcids"]:
-            for hh,h_i in zip(bcidcounters1d,range(len(bcidcounters1d))):
-                hh.SetLineWidth(2)
-                hh.SetMarkerStyle(0)
-                hh.SetLineStyle(1+(h_i)%3)
-                hh.SetLineColor(1+(h_i)%7)
-                hh.SetLineWidth(2+((h_i)%3))
-                hh.SetMarkerColor(1+((h_i)%7))
-                hh.SetMarkerSize(.3*(2+(h_i+2)%6))
-                hh.SetMarkerStyle(1+(h_i+3)%5)
-##                hh.SetMinimum(1e-5)
-                setzscaleautomin(hh,OPT)
-                if "--general_minimum" in OPT:
-                   hh.SetMinimum(OPT["--general_minimum"])
-                setzscale(hh,OPT)
-#                setzscaleautomin(hh)
-#                hh.SetMaximum(hh.GetMaximum()+1e-4)
-
-        for hh,h_i in zip(lbcounters1d,range(len(lbcounters1d))):
-            hh.SetLineWidth(2)
-            hh.SetMarkerStyle(0)
-            hh.SetLineStyle(1+(h_i)%3)
-            hh.SetLineColor(1+(h_i)%7)
-            hh.SetLineWidth(2+((h_i)%3))
-            hh.SetMarkerColor(1+((h_i)%7))
-            hh.SetMarkerSize(.2*(2+(h_i+2)%6))
-            hh.SetMarkerStyle(1+(h_i+3)%5)    
-            #hh.SetMinimum(general_minimum)
-            #hh.SetMaximum(hh.GetMaximum()+1e-4)
-            setzscaleautomin(hh,OPT)
-            if "--general_minimum" in OPT:
-               hh.SetMinimum(OPT["--general_minimum"])
-            setzscale(hh,OPT)
-
-
-        title=str(OPT["--run"])
-
-        def setmargins(canvas):
-            canvas.SetRightMargin(.12)
-            canvas.SetLeftMargin(.20)
-            canvas.SetTopMargin(.22)
-            canvas.SetBottomMargin(.15)
-
-        def setmargins2d(canvas):
-            canvas.SetRightMargin(.12)
-            canvas.SetLeftMargin(.20)
-            canvas.SetTopMargin(.17)
-            canvas.SetBottomMargin(.15)
-
-        def makecanvas(title):
-            canvas=ROOT.TCanvas(str(numpy.random.uniform()),title,50,50,1000,700) 
-            canvas.SetFillStyle(0)
-            canvas.SetFillColor(0)
-            canvas.SetBorderSize(0);
-            setmargins(canvas)
-            return canvas
-
-        def makecanvas2d(canvas,numlab=0):
-            scalefactor=1
-            numfits=45
-            if numlab>numfits:
-               scalefactor=1+(numlab-numfits)/(numfits*1.0)
-            canvas=ROOT.TCanvas(str(numpy.random.uniform()),title,50,50,1000,700);
-            canvas.SetFillStyle(0)
-            canvas.SetFillColor(0)
-            canvas.SetBorderSize(0);
-            setmargins2d(canvas)
-            canvas.SetTopMargin(.17/scalefactor**.5)
-            canvas.SetRightMargin(.12*(scalefactor**.5))
-            canvas.SetLeftMargin(.20/(scalefactor**.5))
-#            canvas.SetBottomMargin(.15/scalefactor)
-            if scalefactor>1.1:
-               canvas.SetCanvasSize(int(1000),int(700*scalefactor))
-            
-            return canvas
-
-        ylablesize=1.6 / (10+len(OPT["--countersnames"]))
-        if ylablesize>0.05: ylablesize=0.05
-
-        #############################################################
-
-        for dolog in [False,True]:
-            canvas1d=makecanvas(title) 
-            canvas1d.cd()
-            setmargins(canvas1d)
-
-            plotmax=0
-            plotmin=150
-            for hh in lbcounters1d:
-                if hh.GetMaximum() > plotmax: plotmax = hh.GetMaximum()
-                if hh.GetMinimum() < plotmin: plotmin = hh.GetMinimum()
-            plotmax=plotmax*1.03+1e-4
-
-#            lbtotals.SetMaximum(plotmax)
-#            setzscaleautomin(lbtotals,OPT)
-            lbtotals.SetMaximum(plotmax+1e-8)
-            lbtotals.SetMinimum(plotmin*0.99+1e-9)
-
-            drawExact(lbtotals)
-
-            plotleg=ROOT.TLegend(0,.83,1,1)
-            plotleg.SetNColumns(1+len(OPT["--counters"])//4)
-            plotleg.SetFillStyle(0)
-            plotleg.SetBorderSize(0);
-            plotleg.Draw()
-
-            lbtotals.SetLineColor(0)
-
-            for hh,h_i in zip(lbcounters1d,range(len(lbcounters1d))):
-                drawExactSame(hh)
-                #.Draw("same hist P0")
-                #hh.Draw("same hist E0")
-                plotleg.AddEntry(hh,str(OPT["--countersnames"][h_i]),"lp")
-
-
-#            lbtotals.SetMinimum(0)
-            plotleg.Draw()
-
-#            lbtotals.SetMaximum(plotmax)
-#            lbtotals.SetMinimum(general_minimum*(-1+2*dolog))
-#            plotleg.Draw()
-
-            canvas1d.SetLogy(dolog)
-            drawaxis_timeLB(lbtotals,timeaxis,lbaxis,dolog)
-            if not 'LB1D' in OPT['--nodraw']:
-                if dolog and not 'Log' in OPT['--nodraw']:
-                   canvas1d.Print(basename+str("lb_log"+str(picformat)))
-                   rootWrite(canvas1d,basename+str("lb_log"))
-                if not dolog and not 'Lin' in OPT['--nodraw']:
-                   canvas1d.Print(basename+str("lb"+str(picformat)))
-                   rootWrite(canvas1d,basename+str("lb"))
-
-        canvas2dlog=makecanvas2d(title,len(OPT["--countersnames"]))
-        canvas2dlog.cd()        
-        canvas2dlog.SetLogz(False)
-        setzscaleautomin(lbcounters,OPT)
-        if "--general_minimum" in OPT:
-           lbcounters.SetMinimum(OPT["--general_minimum"])
-        setzscale(lbcounters,OPT)
-
-#        lbcounters.SetMinimum(0)
-#        lbcounters.SetMaximum(plotmax)
-
-
-
-# this is a way to hardcode ctpmon max scale
-#        if 'CTPMON' in basename:           
-
-        if 'CTPMON' in basename:           
-           setzscale(lbcounters,OPT)
-        else:
-           if 'BUSY' in basename or 'busy' in basename:
-              lbcounters.SetMaximum(100);
-              lbcounters.SetMinimum(0.);
-
-        lbcounters.SetFillColor(1);
-
-
-        for i,name in enumerate(OPT["--countersnames"]):
-            lbcounters.GetYaxis().SetBinLabel(i+1,name)            
-            lbcounters.GetYaxis().SetTitleOffset(1.4)
-            lbcounters.GetYaxis().SetLabelSize(ylablesize)
-            if OPT["--bcids"]:
-                bccounters.GetYaxis().SetBinLabel(i+1,name)
-                bccounters.GetYaxis().SetTitleOffset(1.4)
-                bccounters.GetYaxis().SetLabelSize(ylablesize)
-
-        lbcounters.SetTitle(OPT["--RateTitle"])
-        lbcounters.Draw("colz")
-
-        drawaxis_timeLB(lbcounters,timeaxis,lbaxis)
-
-        if not 'Lin' in OPT['--nodraw']:
-           canvas2dlog.Print(basename+str("lb_2D"+str(picformat)))
-           rootWrite(canvas2dlog,basename+str("lb_2D"))
-
-        ###########################
-
-        canvas2d=canvas2dlog# ;#makecanvas(title) 
-#        canvas2d.cd()
-
-#        setzscaleautomin(lbcounters,OPT)
-#        if "--general_minimum" in OPT:
-#           lbcounters.SetMinimum(OPT["--general_minimum"])
-#        setzscale(lbcounters,OPT)                           
-
-
-#        lbcounters.SetMinimum(general_minimum)
-#        lbcounters.SetMaximum(plotmax)
-        if 'BUSY' in basename or 'busy' in basename:
-           lbcounters.SetMaximum(100);
-           lbcounters.SetMinimum(0.1);
-        else:
-           setzscaleautomin(lbcounters,OPT)
-        if 'CTPMON' in basename or 'CTPIN' in basename:
-           setzscale(lbcounters,OPT)
-                   
-        set_rate_palette(1)
-        canvas2d.SetLogz(True)
-        lbcounters.Draw("colz")
-#        canvas2d.Print(basename+str("lb_2D_log.eps"))
-        drawaxis_timeLB(lbcounters,timeaxis,lbaxis)
-        if not 'Log' in OPT['--nodraw']:
-           canvas2d.Print(basename+str("lb_2D_log"+str(picformat)))
-           rootWrite(canvas2d,basename+str("lb_2D_log"))
-
-        if OPT["--bcids"]:
-            canvas2dlog=makecanvas2d(title,len(OPT["--countersnames"]))
-
-            canvas2dlog.cd()
-            set_rate_palette(0)
-            canvas2dlog.SetLogz(False)
-
-            setzscaleautomin(bccounters,OPT)
-#            bccounters.SetMinimum(1e-4)
-            setzscale(bccounters,OPT)
-
-               
-            bccounters.GetYaxis().SetTitle(''); # Counter names
-
-            drawspaceaxis(bccounters,0.02,0.02,0.02,0.02)
-#            bccounters.Draw("AXIS same")
-            bccounters.Draw("colz same")
-            if not 'Lin' in OPT['--nodraw']:
-               canvas2dlog.Print(basename+str("bcid_2D"+str(picformat)))
-               rootWrite(canvas2dlog,basename+str("bcid_2D"))
-            set_rate_palette(1)
-            canvas2dlog.SetLogz(True)
-            if not 'Log' in OPT['--nodraw']:
-               canvas2dlog.Print(basename+str("bcid_2D_log"+str(picformat)))
-               rootWrite(canvas2dlog,basename+str("bcid_2D_log"))
-
-            if not 'allBCID' in OPT['--nodraw']:
-              for hh,h_i in zip(bcidcounters2d,range(len(bcidcounters1d))):
-                 canvas2d=canvas2dlog
-                 setzscaleautomin(hh,OPT)
-                             #hh.SetMinimum(1e-9)
-                 #hh.SetMinimum(general_minimum+1e-6)
-                 set_rate_palette(1)
-                 setzscale(hh,OPT)
-
-                 canvas2d.SetLogz(True)
-                 hh.Draw("colz")
-                 drawaxis_timeLB(hh,timeaxis,lbaxis,True)
-                 tmpax2=drawspaceaxis(hh,0.02,0.02,0.02,0.02)
-                 hh.Draw("colz same")
-                 drawaxis_timeLB(hh,timeaxis,lbaxis,True)
-                 rootWrite(canvas2d,basename+str("lb_2D_bcid_")+OPT["--countersnames"][h_i]+"_log")
-                 canvas2d.Print(basename+str("lb_2D_bcid_")+OPT["--countersnames"][h_i]+"_log"+str(picformat))
-
-
-                 #################
-
-#                 canvas2d.SetLogz(True)
-#                 drawaxis_timeLB(hh,timeaxis,lbaxis,True)
-#                 canvas2d.Update()
-                 canvas2d.SetLogz(False)
-                 tmpax=drawspaceaxis(hh,0.02,0.02,0.02,0.02)
-                 hh.Draw("colz same")
-                 drawaxis_timeLB(hh,timeaxis,lbaxis)
-                 rootWrite(canvas2d,basename+str("lb_2D_bcid_")+OPT["--countersnames"][h_i]+"_lin")
-                 canvas2d.Print(basename+str("lb_2D_bcid_")+OPT["--countersnames"][h_i]+"_lin"+str(picformat))
-
-                 ## log
-
-                 
-            ###################################################
-
-            if True:
-
-               canvas1d=makecanvas(title) 
-               canvas1d.cd()
-               setmargins(canvas1d)
-
-               setzscaleautomin(bcidtotals,OPT)
-               setzscale(bcidtotals,OPT)
-
-#               drawExact(bcidtotals)
-               drawspaceaxis(bcidtotals,0.02,0.02,0.02,0.02)
-               drawExactSame(bcidtotals)
-
-#               drawExact(bcidtotals)
-
-   #            bcidtotals.Draw()
-
-               plotleg=ROOT.TLegend(0,.83,1,1)
-               plotleg.AddEntry(bcidtotals,"total","F")
-               plotleg.SetNColumns(1+len(OPT["--counters"])//4)
-               plotleg.SetFillStyle(0)
-               plotleg.SetBorderSize(0);
-               plotleg.Draw()
-
-               plotmax=bcidtotals.GetMaximum()+1e-4
-               plotmin=bcidtotals.GetMinimum()
-               canvas1d.SetLogy(False)
-               plotleg.Draw()
-
-#               if "--general_minimum" in OPT:
-#                  bcidtotals.SetMinimum(OPT["--general_minimum"])
-
-               if not 'Lin' in OPT['--nodraw']:
-                  canvas1d.Print(basename+str("bcid_sum"+str(picformat)))
-                  rootWrite(canvas1d,basename+str("bcid_sum"))
-
-               canvas1d.SetLogy(True)
-
-               setzscaleautomin(bcidtotals)
-#               bcidtotals.SetMinimum(1e-5)
-               if "--general_minimum" in OPT:
-                  bcidtotals.SetMinimum(OPT["--general_minimum"])
-
-               bcidtotals.SetMaximum(bcidtotals.GetBinContent(bcidtotals.GetMaximumBin())+1e-4)
-               plotleg.Draw()
-               if not 'Log' in OPT['--nodraw']:
-                  canvas1d.Print(basename+str("bcid_sum_log"+str(picformat)))
-                  rootWrite(canvas1d,basename+str("bcid_sum_log"))
-       #        canvas1d.Print(basename+str("bcid_sum_log.eps"))
-
-               bcidtotals.SetLineColor(0)
-
-#               setzscaleautomin(bcidtotals)
-#               bcidtotals.SetMinimum(0)
-               plotleg.Draw()
-
-               canvas1di=makecanvas(title) 
-               canvas1di.cd()
-               setmargins(canvas1di)
-
-               if not 'allBCID' in OPT['--nodraw']:
-                  for hh,h_i in zip(bcidcounters1d,range(len(bcidcounters1d))):
-                      canvas1d.cd()
-                      plotleg.AddEntry(hh,str(OPT["--countersnames"][h_i]),"lp")
-                      hh.Draw("hist same")
-
-                      canvas1di.cd()
-
-                      lc=hh.GetLineColor()
-                      lw=hh.GetLineWidth()
-                      ls=hh.GetLineStyle()
-                      lfs=hh.GetFillStyle()
-                      lfc=hh.GetFillColor()
-                      
-                      hh.SetLineWidth(3)
-                      hh.SetLineColor(1)
-                      hh.SetLineStyle(1)
-                      hh.SetFillColor(2)
-                      hh.SetFillStyle(1000)
-                      
-                      ms=hh.GetMarkerStyle()
-                      hh.SetMarkerStyle(0)
-                      drawspaceaxis(hh,0.02,0.02,0.02,0.02)
-                      drawExactSame(hh)
-
-#                      hh.Draw("hist")
-                      canvas1di.SetLogy(0)
-                      if not 'Lin' in OPT['--nodraw']:
-                         canvas1di.Print(basename+str("bcid_"+OPT["--countersnames"][h_i]+"_"+str(picformat)))
-                         #rootWrite(canvas1di,basename+str("bcid_"+OPT["--countersnames"][h_i]))
-                      #hh.SetMinimum(hh.GetMinimum()+1e-6)
-                      #if (hh.GetMaximum()<12*hh.GetMinimum()):
-                      #   hh.SetMaximum(12*hh.GetMinimum())
-                      
-                      canvas1di.SetLogy(1)
-                      if not 'Log' in OPT['--nodraw']:
-                         canvas1di.Print(basename+str("bcid_"+OPT["--countersnames"][h_i]+"_log"+str(picformat)))
-                         #rootWrite(canvas1di,basename+str("bcid_"+OPT["--countersnames"][h_i]+'_log'))
-
-                      hh.SetLineWidth(lw)
-                      hh.SetLineColor(lc)
-                      hh.SetLineStyle(ls)
-                      hh.SetFillStyle(lfs)
-                      hh.SetFillColor(lfc)
-                      hh.SetMarkerStyle(ms)
-
-               canvas1d.SetLogy(False)
-               bcidtotals.SetMaximum(bcidtotals.GetMaximum()*1.05+1e-4)
-               plotleg.Draw()
-               if not 'Lin' in OPT['--nodraw']:
-                  canvas1d.Print(basename+str("bcid"+str(picformat)))
-                  #rootWrite(canvas1d,basename+str("bcid_"))
-
-               if not 'Log' in OPT['--nodraw']:
-                  canvas1d.SetLogy(True)
-#                  bcidtotals.SetMinimum(1e-5)
-                  if "--general_minimum" in OPT:
-                     bcidtotals.SetMinimum(OPT["--general_minimum"])
-#                     bcidtotals.SetMaximum(bcidtotals.GetMaximum()+1e-4)
-                     plotleg.Draw()
-                  canvas1d.Print(basename+str("bcid_log"+str(picformat)))
-                  #rootWrite(canvas1d,basename+str("bcid_log"))
-     
-
-    histFile.Close()
-
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/read_bunchgroups.py b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/read_bunchgroups.py
deleted file mode 100755
index 18f816658041c79d724999946ed25e00665015e9..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/read_bunchgroups.py
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-
-import sys,getopt,os
-from PyCool import cool,coral
-from CoolConvUtilities import AtlCoolTool
-from ROOT import TH1F, TFile, TProfile, TObject, TGraph
-
-def usage():
-    print "%s" % sys.argv[0]
-    print "  --help                                this printout"
-    print "  --run <runNo>                         run number"
-    print "  --fillHist                            fill histograms with bunch groups"
-    print "  --printBcids                          prit list of BCIDs per bunch group"
-
-
-try:
-    longopts=['run=','printBcids','fillHist','help']
-    opts,args=getopt.getopt(sys.argv[1:],'',longopts)
-except getopt.GetoptError,e:
-    usage()
-    sys.exit(2)
-
-run=-1
-fillHist=False
-printBcids=True
-
-for o,a in opts:
-    if o in ('-h','--help'):
-        usage()
-        sys.exit(0)
-    if o == '--run':
-        run = int(a)
-    if o == '--fillHist':
-        fillHist = True
-    if o == '--printBcids':
-        printBcids = True
-
-if (run == -1) : 
-    usage()
-    sys.exit(2)
-
-
-# get database service and open database
-dbSvc=cool.DatabaseSvcFactory.databaseService()
-# Get user and passwd from coral auth file - see: https://its.cern.ch/jira/browse/ATR-25572
-# see this package in case the following doesn't work for you: Database/ConnectionManagement/AtlasAuthentication/data/dblookup.xml
-connName="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_TRIGGER" # aka. schema
-dbauthPath=os.environ.get('CORAL_AUTH_PATH')
-dbpw = None
-dbuser = None
-# Get username and password by parsing authentication XML file
-authenticationXmlDoc = minidom.parse(dbauthPath + "authentication.xml")
-authenticationList = authenticationXmlDoc.getElementsByTagName("connection")
-for entry in authenticationList:
-    if entry.attributes["name"].value == connName:
-        parameters = entry.getElementsByTagName("parameter")
-        # Set username and password from authentication parameters
-        for parameter in parameters:
-            if parameter.attributes["name"].value == "user":
-                dbuser = parameter.attributes["value"].value
-            elif parameter.attributes["name"].value == "password":
-                dbpw = parameter.attributes["value"].value
-dbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user="+dbuser+";password="+dbpw
-#olddbstring="oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200;user=ATLAS_COOL_READER;password=PAssWDusedTObeHEREinPLAINtext"
-#dbstring="sqlite://;schema=/afs/cern.ch/user/b/berge/trash/ctp.LBData.1190647872.sqlitefile.db;dbname=L1CTCOOL"
-
-try:
-    db=dbSvc.openDatabase(dbstring,False)
-except Exception,e:
-    print e
-    sys.exit(-1)
-
-bgkey_fname='/TRIGGER/LVL1/BunchGroupKey'
-bgcont_fname='/TRIGGER/LVL1/BunchGroupContent'
-bgdesc_fname='/TRIGGER/LVL1/BunchGroupDescription'
-
-if not db.existsFolder(bgkey_fname) :
-    print "Folder",bgkey_fname,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(bgcont_fname) :
-    print "Folder",bgcont_fname,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-if not db.existsFolder(bgdesc_fname) :
-    print "Folder",bgdesc_fname,"not found"
-    db.closeDatabase()
-    sys.exit(-1)
-
-bgkeys = []
-folder=db.getFolder(bgkey_fname)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        bgkeys.append(payload['Lvl1BunchGroupConfigurationKey'])
-    itr.close()
-except Exception,e:
-    print "Reading data from",bgkey_fname,"failed:",e
-
-print "Run",run,"bg keys",bgkeys
-
-bgNames = []
-bgMap = []
-folder=db.getFolder(bgdesc_fname)
-try:
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        obj=itr.currentRef()
-        payload=obj.payload()
-        bgNames.append(str(payload['BunchGroup0']))
-        bgNames.append(str(payload['BunchGroup1']))
-        bgNames.append(str(payload['BunchGroup2']))
-        bgNames.append(str(payload['BunchGroup3']))
-        bgNames.append(str(payload['BunchGroup4']))
-        bgNames.append(str(payload['BunchGroup5']))
-        bgNames.append(str(payload['BunchGroup6']))
-        bgNames.append(str(payload['BunchGroup7']))
-        bgMap = payload['ItemToBunchGroupMap']
-
-    itr.close()
-except Exception,e:
-    print "Reading data from",bgkey_fname,"failed:",e
-
-for n in range(len(bgNames)):
-    print "BG",n,":",bgNames[n]
-for ii in range(len(bgMap)):
-    bitCode = ''
-    for bit in range(7,-1,-1):
-        if (bgMap[ii]>>bit & 1) : bitCode += '1'
-        else : bitCode += '0'
-    print "Item",ii,"BG Code",bitCode
-
-folder=db.getFolder(bgcont_fname)
-try:
-    index = 0
-    itr=folder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
-    while itr.goToNext() :
-        bgList = []
-        for _ in range(8): bgList.append([])
-        obj=itr.currentRef()
-        payload=obj.payload()
-        bgcont = payload['BunchCode']
-        for bcid in range(3564): 
-            for bgrp in range(8):
-                if(bgcont[bcid]>>bgrp & 1): bgList[bgrp].append(bcid)
-        print "BG key",bgkeys[index]
-        ++index
-        for grp in range(8):
-            print "BG",grp,"size :",len(bgList[grp])
-        for grp in range(8):
-            print "BG",grp,":",bgList[grp]
-
-    itr.close()
-except Exception,e:
-    print "Reading data from",bgcont_fname,"failed:",e
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/setup_l1ct_python.sh b/Trigger/TrigT1/TrigT1CTMonitoring/scripts/setup_l1ct_python.sh
deleted file mode 100644
index d8b34c581a48de3f2a0cab02362f00073271c218..0000000000000000000000000000000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/scripts/setup_l1ct_python.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-# source this file
-
-# Required for IS python bindings only,
-# echo setup setup tdaq 03
-# . /sw/tdaq/setup/setup_tdaq-02-00-03.sh
-
-echo setting up offline
-if [ -d /sw/atlas/cmtsite/ ] ; then
-    echo 'using point 1 setup script'
-    source /sw/atlas/cmtsite/setup.sh -tag=15.5.1,setup
-else
-    source ~/cmthome/setup.sh -tag=15.5.1,setup
-fi
-
-echo setting up python includes 
-export PYTHONPATH=$PYTHONPATH:`pwd`
-export PATH=$PATH:`pwd`
-
-echo setup of aliases, must contain pointers to the used databases
-export CORAL_DBLOOKUP_PATH=/atlas/db/.adm/coral/:"$CORAL_DBLOOKUP_PATH"
-export CORAL_AUTH_PATH=/atlas/db/.adm/coral/:"$CORAL_DBLOOKUP_PATH"
-    
-echo "CORAL_DBLOOKUP_PATH = $CORAL_DBLOOKUP_PATH "
-echo "CORAL_AUTH_PATH     = $CORAL_AUTH_PATH     "
-
diff --git a/Trigger/TrigT1/TrigT1CaloMonitoring/src/GfexSimMonitorAlgorithm.cxx b/Trigger/TrigT1/TrigT1CaloMonitoring/src/GfexSimMonitorAlgorithm.cxx
index b0cb0dbd3f74280624773b150b1d2a817743a602..dbb1cb2e30f82795282874c2ee6a4c246fcdd96f 100644
--- a/Trigger/TrigT1/TrigT1CaloMonitoring/src/GfexSimMonitorAlgorithm.cxx
+++ b/Trigger/TrigT1/TrigT1CaloMonitoring/src/GfexSimMonitorAlgorithm.cxx
@@ -97,14 +97,14 @@ StatusCode GfexSimMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
     compareJetRoI("gLJ",m_data_gFexJet,m_simu_gFexJet,ctx,true);
     compareJetRoI("gJ",m_data_gFexBlock,m_simu_gFexBlock,ctx,true);
     compareJetRoI("gLJRho",m_data_gFexRho,m_simu_gFexRho,ctx);
-    compareGlobalRoI("gTEJWOJ",m_data_gScalarEJwoj,m_simu_gScalarEJwoj,ctx);
+    compareGlobalRoI("gTEJWOJ",m_data_gScalarEJwoj,m_simu_gScalarEJwoj,ctx,0xff000fff); // wont compare MET value in scalarE tob
     compareGlobalRoI("gXEJWOJ",m_data_gMETComponentsJwoj,m_simu_gMETComponentsJwoj,ctx);
     compareGlobalRoI("gXEJWOJ",m_data_gMHTComponentsJwoj,m_simu_gMHTComponentsJwoj,ctx);
     compareGlobalRoI("gXEJWOJ",m_data_gMSTComponentsJwoj,m_simu_gMSTComponentsJwoj,ctx);
     compareGlobalRoI("gXENC",m_data_gMETComponentsNoiseCut,m_simu_gMETComponentsNoiseCut,ctx);
     compareGlobalRoI("gXERHO",m_data_gMETComponentsRms,m_simu_gMETComponentsRms,ctx);
-    compareGlobalRoI("gTENC",m_data_gScalarENoiseCut,m_simu_gScalarENoiseCut,ctx);
-    compareGlobalRoI("gTERHO",m_data_gScalarERms,m_simu_gScalarERms,ctx);
+    compareGlobalRoI("gTENC",m_data_gScalarENoiseCut,m_simu_gScalarENoiseCut,ctx,0xff000fff);
+    compareGlobalRoI("gTERHO",m_data_gScalarERms,m_simu_gScalarERms,ctx,0xff000fff);
 
     return StatusCode::SUCCESS;
 }
@@ -199,7 +199,7 @@ bool GfexSimMonitorAlgorithm::compareJetRoI(const std::string& label,
 bool GfexSimMonitorAlgorithm::compareGlobalRoI(const std::string& label,
                                             const SG::ReadHandleKey<xAOD::gFexGlobalRoIContainer>& tobs1Key,
                                             const SG::ReadHandleKey<xAOD::gFexGlobalRoIContainer>& tobs2Key,
-                                            const EventContext& ctx) const {
+                                            const EventContext& ctx, uint32_t tobMask) const {
     SG::ReadHandle<xAOD::gFexGlobalRoIContainer> tobs1Cont{tobs1Key, ctx};
     if(!tobs1Cont.isValid()) {
         return false;
@@ -215,30 +215,22 @@ bool GfexSimMonitorAlgorithm::compareGlobalRoI(const std::string& label,
 
 
     bool mismatches = (tobs1Cont->size()!=tobs2Cont->size());
-    //bool mismatchesExlStatusAndSat = mismatches;
 
     for(const auto tob1 : *tobs1Cont) {
         bool isMatched = false;
-        bool isPartMatched = false;
-        auto word1 = tob1->word();
+        uint32_t word1 = tob1->word()&tobMask;
         auto gfex1 = tob1->globalType();
         for (auto tob2 : *tobs2Cont) {
             if(gfex1 == tob2->globalType()) {
-                if(word1 == tob2->word()) {
+                if(word1 == (tob2->word()&tobMask)) {
                     isMatched = true;
                     break;
-                } else if( (word1&0x7CFFFFFF) == (tob2->word()&0x7CFFFFFF) ) {
-                    // matches after ignore saturation bit (31st bit) and status bits (24th and 25 bit)
-                    isPartMatched=true;
                 }
             }
 
         }
         if(!isMatched) {
             mismatches = true;
-            if(!isPartMatched) {
-                //mismatchesExlStatusAndSat = true;
-            }
         }
         tobMismatched = (isMatched) ? 0 : 100; //100*(!isMatched && !isPartMatched); - commented out. Is from when was treating part-matches as matches
         fill("mismatches",eventType,Signature,tobMismatched);
diff --git a/Trigger/TrigT1/TrigT1CaloMonitoring/src/GfexSimMonitorAlgorithm.h b/Trigger/TrigT1/TrigT1CaloMonitoring/src/GfexSimMonitorAlgorithm.h
index 45f0cd9705f89979d9e0cbb64bf07d0b236c36fd..bca707a592c77ad7de3b1e1ed64d3856d6acb467 100644
--- a/Trigger/TrigT1/TrigT1CaloMonitoring/src/GfexSimMonitorAlgorithm.h
+++ b/Trigger/TrigT1/TrigT1CaloMonitoring/src/GfexSimMonitorAlgorithm.h
@@ -26,7 +26,7 @@ class GfexSimMonitorAlgorithm : public AthMonitorAlgorithm {
 
     bool compareJetRoI(const std::string& label, const SG::ReadHandleKey<xAOD::gFexJetRoIContainer>& tobs1Key, const SG::ReadHandleKey<xAOD::gFexJetRoIContainer>& tobs2Key, const EventContext& ctx, bool simReady=false) const;
 
-    bool compareGlobalRoI(const std::string& label, const SG::ReadHandleKey<xAOD::gFexGlobalRoIContainer>& tobs1Key, const SG::ReadHandleKey<xAOD::gFexGlobalRoIContainer>& tobs2Key, const EventContext& ctx) const;
+    bool compareGlobalRoI(const std::string& label, const SG::ReadHandleKey<xAOD::gFexGlobalRoIContainer>& tobs1Key, const SG::ReadHandleKey<xAOD::gFexGlobalRoIContainer>& tobs2Key, const EventContext& ctx, uint32_t tobMask=0xffffffff) const;
 
     // map hold the binlabels (in form of LBN:FirstEventNum) to use for each lb
     mutable std::map<int,std::string> m_firstEvents ATLAS_THREAD_SAFE;
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
index cb3b23d05e361de26f1c79ceac94c2d12dfe5cb3..878163521dd00e64eb0424e055be74df119e889f 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
@@ -4030,10 +4030,10 @@ HLT_e17_lhmedium_ivarloose_tau25_mediumRNN_tracktwoMVA_03dRAB_L1eEM18M_2eTAU20M_
     4: 1
     5: 1
   stepFeatures:
-    0: 16
-    1: 13
-    2: 17
-    3: 13
+    0: 15
+    1: 12
+    2: 16
+    3: 12
     4: 4
     5: 1
 HLT_e17_lhmedium_tau25_mediumRNN_tracktwoMVA_xe50_cell_03dRAB_L1EM15VHI_2TAU12IM_XE35:
@@ -4062,10 +4062,10 @@ HLT_e17_lhmedium_tau25_mediumRNN_tracktwoMVA_xe50_cell_03dRAB_L1eEM18M_2eTAU20M_
     4: 1
     5: 1
   stepFeatures:
-    0: 13
-    1: 13
-    2: 17
-    3: 13
+    0: 12
+    1: 12
+    2: 16
+    3: 12
     4: 4
     5: 1
 HLT_e20_etcut_L1eEM18M:
@@ -20255,15 +20255,15 @@ HLT_j80c_020jvt_j55c_020jvt_j28c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bdl1d77_
 ? HLT_j80c_020jvt_j55c_020jvt_j28c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bdl1d77_pf_ftf_presel2c20XX2c20b85_L1jJ85p0ETA21_3jJ40p0ETA25_cTAU20M_2cTAU12M
 : eventCount: 6
   stepCounts:
-    0: 11
-    1: 8
-    2: 6
+    0: 12
+    1: 9
+    2: 7
     3: 6
   stepFeatures:
-    0: 55
-    1: 40
-    2: 121
-    3: 15
+    0: 60
+    1: 45
+    2: 137
+    3: 16
 HLT_j80c_020jvt_j55c_020jvt_j28c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bdl1d77_pf_ftf_presel2c20XX2c20b90_L1MU8F_2J15_J20:
   eventCount: 4
   stepCounts:
@@ -22107,10 +22107,10 @@ HLT_mu14_ivarloose_tau25_mediumRNN_tracktwoMVA_03dRAB_L1MU8F_cTAU20M_3jJ30:
     2: 7
     3: 7
   stepFeatures:
-    0: 23
-    1: 22
-    2: 19
-    3: 19
+    0: 25
+    1: 24
+    2: 20
+    3: 20
     4: 5
 HLT_mu14_ivarloose_tau35_mediumRNN_tracktwoMVA_03dRAB_L1MU8F_TAU20IM:
   eventCount: 0
@@ -22128,16 +22128,16 @@ HLT_mu14_ivarloose_tau35_mediumRNN_tracktwoMVA_03dRAB_L1MU8F_TAU20IM:
 HLT_mu14_ivarloose_tau35_mediumRNN_tracktwoMVA_03dRAB_L1MU8F_cTAU30M:
   eventCount: 0
   stepCounts:
-    0: 7
-    1: 6
-    2: 6
-    3: 6
+    0: 8
+    1: 7
+    2: 7
+    3: 7
   stepFeatures:
-    0: 17
-    1: 16
-    2: 14
-    3: 14
-    4: 4
+    0: 21
+    1: 20
+    2: 17
+    3: 17
+    4: 5
 HLT_mu14_mu14_idperf_50invmAB130_L12MU8F:
   eventCount: 0
 HLT_mu14_mu14_idtp_idZmumu_L12MU8F:
@@ -24043,47 +24043,47 @@ HLT_mu24_ivarmedium_tau35_mediumRNN_tracktwoMVA_probe_03dRAB_L1MU18VFCH:
 HLT_mu24_ivarmedium_tau35_mediumRNN_tracktwoMVA_probe_L1cTAU30M_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
-    0: 4
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu24_ivarmedium_tau35_mediumRNN_tracktwoMVA_probe_L1cTAU30M_03dRAB_L1MU18VFCH:
   eventCount: 0
   stepCounts:
-    0: 4
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu24_ivarmedium_tau40_mediumRNN_tracktwoMVA_probe_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
@@ -24131,47 +24131,47 @@ HLT_mu24_ivarmedium_tau40_mediumRNN_tracktwoMVA_probe_03dRAB_L1MU18VFCH:
 HLT_mu24_ivarmedium_tau40_mediumRNN_tracktwoMVA_probe_L1cTAU35M_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
-    0: 3
-    1: 2
-    2: 2
-    3: 2
-    4: 2
-    5: 2
-    6: 2
-    7: 2
-    8: 2
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 2
-    2: 2
-    3: 2
-    4: 2
-    5: 2
-    6: 2
-    7: 2
-    8: 2
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu24_ivarmedium_tau40_mediumRNN_tracktwoMVA_probe_L1cTAU35M_03dRAB_L1MU18VFCH:
   eventCount: 0
   stepCounts:
-    0: 3
-    1: 2
-    2: 2
-    3: 2
-    4: 2
-    5: 2
-    6: 2
-    7: 2
-    8: 2
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 2
-    2: 2
-    3: 2
-    4: 2
-    5: 2
-    6: 2
-    7: 2
-    8: 2
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu24_ivarmedium_tau60_mediumRNN_tracktwoLLP_probe_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
@@ -26171,53 +26171,53 @@ HLT_mu26_ivarmedium_tau30_mediumRNN_tracktwoMVA_probe_L1cTAU20M_03dRAB_L1MU18VFC
 HLT_mu26_ivarmedium_tau30_mediumRNN_tracktwoMVA_probe_L1cTAU30M_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
-    0: 4
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu26_ivarmedium_tau30_mediumRNN_tracktwoMVA_probe_L1cTAU30M_03dRAB_L1MU18VFCH:
   eventCount: 0
   stepCounts:
-    0: 4
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
-HLT_mu26_ivarmedium_tau35_mediumRNN_tracktwoMVA_probe_03dRAB_L1MU14FCH:
-  eventCount: 0
-  stepCounts:
-    0: 3
-    1: 2
-    2: 2
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
+HLT_mu26_ivarmedium_tau35_mediumRNN_tracktwoMVA_probe_03dRAB_L1MU14FCH:
+  eventCount: 0
+  stepCounts:
+    0: 3
+    1: 2
+    2: 2
     3: 2
     4: 2
     5: 2
@@ -26259,47 +26259,47 @@ HLT_mu26_ivarmedium_tau35_mediumRNN_tracktwoMVA_probe_03dRAB_L1MU18VFCH:
 HLT_mu26_ivarmedium_tau35_mediumRNN_tracktwoMVA_probe_L1cTAU30M_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
-    0: 4
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu26_ivarmedium_tau35_mediumRNN_tracktwoMVA_probe_L1cTAU30M_03dRAB_L1MU18VFCH:
   eventCount: 0
   stepCounts:
-    0: 4
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 3
-    2: 3
-    3: 3
-    4: 3
-    5: 3
-    6: 3
-    7: 3
-    8: 3
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu26_ivarmedium_tau40_mediumRNN_tracktwoMVA_probe_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
@@ -26347,47 +26347,47 @@ HLT_mu26_ivarmedium_tau40_mediumRNN_tracktwoMVA_probe_03dRAB_L1MU18VFCH:
 HLT_mu26_ivarmedium_tau40_mediumRNN_tracktwoMVA_probe_L1cTAU35M_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
-    0: 3
-    1: 2
-    2: 2
-    3: 2
-    4: 2
-    5: 2
-    6: 2
-    7: 2
-    8: 2
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 2
-    2: 2
-    3: 2
-    4: 2
-    5: 2
-    6: 2
-    7: 2
-    8: 2
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu26_ivarmedium_tau40_mediumRNN_tracktwoMVA_probe_L1cTAU35M_03dRAB_L1MU18VFCH:
   eventCount: 0
   stepCounts:
-    0: 3
-    1: 2
-    2: 2
-    3: 2
-    4: 2
-    5: 2
-    6: 2
-    7: 2
-    8: 2
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
   stepFeatures:
     0: 7
-    1: 2
-    2: 2
-    3: 2
-    4: 2
-    5: 2
-    6: 2
-    7: 2
-    8: 2
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+    5: 4
+    6: 4
+    7: 4
+    8: 4
 HLT_mu26_ivarmedium_tau60_mediumRNN_tracktwoLLP_probe_03dRAB_L1MU14FCH:
   eventCount: 0
   stepCounts:
@@ -28432,11 +28432,11 @@ HLT_noalg_L1XE55:
 HLT_noalg_L1XE60:
   eventCount: 6
 HLT_noalg_L1cTAU20M:
-  eventCount: 18
+  eventCount: 19
 HLT_noalg_L1cTAU30M:
-  eventCount: 14
+  eventCount: 17
 HLT_noalg_L1cTAU35M:
-  eventCount: 14
+  eventCount: 17
 HLT_noalg_L1eEM12L:
   eventCount: 7
 HLT_noalg_L1eEM18L:
@@ -28524,7 +28524,7 @@ HLT_noalg_L1jJ30:
 HLT_noalg_L1jJ40:
   eventCount: 20
 HLT_noalg_L1jJ40p30ETA49:
-  eventCount: 2
+  eventCount: 7
 HLT_noalg_L1jJ50:
   eventCount: 20
 HLT_noalg_L1jJ500:
@@ -28534,7 +28534,7 @@ HLT_noalg_L1jJ50p30ETA49:
 HLT_noalg_L1jJ60:
   eventCount: 17
 HLT_noalg_L1jJ60p30ETA49:
-  eventCount: 1
+  eventCount: 2
 HLT_noalg_L1jJ90:
   eventCount: 15
 HLT_noalg_L1jJ90p30ETA49:
@@ -28630,10 +28630,10 @@ HLT_tau0_mediumRNN_tracktwoMVA_tau0_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_10DR
     3: 9
     4: 1
   stepFeatures:
-    0: 50
-    1: 50
-    2: 50
-    3: 50
+    0: 54
+    1: 54
+    2: 54
+    3: 54
     4: 10
 HLT_tau0_mediumRNN_tracktwoMVA_tau0_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_4DR28-eTAU30eTAU20-jJ55:
   eventCount: 1
@@ -28644,10 +28644,10 @@ HLT_tau0_mediumRNN_tracktwoMVA_tau0_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_4DR2
     3: 10
     4: 1
   stepFeatures:
-    0: 54
-    1: 54
-    2: 54
-    3: 54
+    0: 60
+    1: 60
+    2: 60
+    3: 60
     4: 10
 HLT_tau0_mediumRNN_tracktwoMVA_tau0_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_4DR32-eTAU30eTAU20-jJ55:
   eventCount: 1
@@ -28658,10 +28658,10 @@ HLT_tau0_mediumRNN_tracktwoMVA_tau0_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_4DR3
     3: 10
     4: 1
   stepFeatures:
-    0: 54
-    1: 54
-    2: 54
-    3: 54
+    0: 60
+    1: 60
+    2: 60
+    3: 60
     4: 10
 HLT_tau0_mediumRNN_tracktwoMVA_tau0_mediumRNN_tracktwoMVA_03dRAB_L14jJ30p0ETA24_0DETA24-eTAU30eTAU12:
   eventCount: 1
@@ -28736,16 +28736,16 @@ HLT_tau0_mediumRNN_tracktwoMVA_tau0_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TAU1
 HLT_tau0_mediumRNN_tracktwoMVA_tau0_mediumRNN_tracktwoMVA_03dRAB_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
   eventCount: 1
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
     4: 1
   stepFeatures:
-    0: 44
-    1: 44
-    2: 44
-    3: 44
+    0: 53
+    1: 53
+    2: 53
+    3: 53
     4: 8
 HLT_tau0_ptonly_L1TAU60:
   eventCount: 5
@@ -30054,30 +30054,30 @@ HLT_tau20_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1jXE110:
 HLT_tau20_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_02dRAB10_L1cTAU20M_DR-eTAU20eTAU12-jJ40:
   eventCount: 1
   stepCounts:
-    0: 13
-    1: 13
-    2: 13
-    3: 13
+    0: 14
+    1: 14
+    2: 14
+    3: 14
     4: 1
   stepFeatures:
-    0: 82
-    1: 82
-    2: 82
-    3: 82
+    0: 89
+    1: 89
+    2: 89
+    3: 89
     4: 7
 HLT_tau20_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB10_L1cTAU20M_DR-eTAU20eTAU12-jJ40:
   eventCount: 1
   stepCounts:
-    0: 13
-    1: 13
-    2: 13
-    3: 13
+    0: 14
+    1: 14
+    2: 14
+    3: 14
     4: 1
   stepFeatures:
-    0: 82
-    1: 82
-    2: 82
-    3: 82
+    0: 89
+    1: 89
+    2: 89
+    3: 89
     4: 7
 HLT_tau20_perf_tracktwoMVA_L1TAU8:
   eventCount: 16
@@ -30390,19 +30390,19 @@ HLT_tau25_idperf_tracktwoMVA_L1TAU12IM:
     3: 27
     4: 27
 HLT_tau25_idperf_tracktwoMVA_L1cTAU20M:
-  eventCount: 18
+  eventCount: 19
   stepCounts:
-    0: 18
-    1: 18
-    2: 18
-    3: 18
-    4: 18
+    0: 19
+    1: 19
+    2: 19
+    3: 19
+    4: 19
   stepFeatures:
-    0: 33
-    1: 33
-    2: 33
-    3: 33
-    4: 33
+    0: 38
+    1: 38
+    2: 38
+    3: 38
+    4: 38
 HLT_tau25_idperf_tracktwoMVA_L1eTAU20:
   eventCount: 19
   stepCounts:
@@ -30426,11 +30426,11 @@ HLT_tau25_idperf_tracktwoMVA_L1eTAU20M:
     3: 19
     4: 19
   stepFeatures:
-    0: 58
-    1: 58
-    2: 58
-    3: 58
-    4: 58
+    0: 54
+    1: 54
+    2: 54
+    3: 54
+    4: 54
 HLT_tau25_idperf_tracktwoMVA_L1jTAU20:
   eventCount: 19
   stepCounts:
@@ -30498,17 +30498,17 @@ HLT_tau25_mediumRNN_trackLRT_L1TAU12IM:
     2: 27
     3: 5
 HLT_tau25_mediumRNN_trackLRT_L1cTAU20M:
-  eventCount: 4
+  eventCount: 5
   stepCounts:
-    0: 18
-    1: 18
-    2: 18
-    3: 4
+    0: 19
+    1: 19
+    2: 19
+    3: 5
   stepFeatures:
-    0: 33
-    1: 33
-    2: 33
-    3: 4
+    0: 38
+    1: 38
+    2: 38
+    3: 5
 HLT_tau25_mediumRNN_trackLRT_L1eTAU20:
   eventCount: 5
   stepCounts:
@@ -30538,16 +30538,16 @@ HLT_tau25_mediumRNN_tracktwoLLP_L1TAU12IM:
 HLT_tau25_mediumRNN_tracktwoLLP_L1cTAU20M:
   eventCount: 5
   stepCounts:
-    0: 18
-    1: 18
-    2: 18
-    3: 18
+    0: 19
+    1: 19
+    2: 19
+    3: 19
     4: 5
   stepFeatures:
-    0: 33
-    1: 33
-    2: 33
-    3: 33
+    0: 38
+    1: 38
+    2: 38
+    3: 38
     4: 5
 HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM:
   eventCount: 3
@@ -30566,16 +30566,16 @@ HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM:
 HLT_tau25_mediumRNN_tracktwoMVA_L1cTAU20M:
   eventCount: 3
   stepCounts:
-    0: 18
-    1: 18
-    2: 18
-    3: 18
+    0: 19
+    1: 19
+    2: 19
+    3: 19
     4: 3
   stepFeatures:
-    0: 33
-    1: 33
-    2: 33
-    3: 33
+    0: 38
+    1: 38
+    2: 38
+    3: 38
     4: 3
 HLT_tau25_mediumRNN_tracktwoMVA_L1eTAU20:
   eventCount: 3
@@ -30600,10 +30600,10 @@ HLT_tau25_mediumRNN_tracktwoMVA_L1eTAU20M:
     3: 19
     4: 3
   stepFeatures:
-    0: 58
-    1: 58
-    2: 58
-    3: 58
+    0: 54
+    1: 54
+    2: 54
+    3: 54
     4: 3
 HLT_tau25_mediumRNN_tracktwoMVA_L1jTAU20:
   eventCount: 3
@@ -30790,10 +30790,10 @@ HLT_tau25_mediumRNN_tracktwoMVA_L1jTAU20:
     1: 80
     2: 298
     3: 27
-    4: 27
-    5: 27
-    6: 27
-    7: 27
+    4: 32
+    5: 32
+    6: 32
+    7: 32
     8: 3
 ? HLT_tau25_mediumRNN_tracktwoMVA_probe_L1eTAU12_j65c_020jvt_j40c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_j20c_020jvt_bgn185_pf_ftf_presel3c20XX1c20bgtwo85_L1jJ85p0ETA21_3jJ40p0ETA25
 : eventCount: 3
@@ -31370,16 +31370,16 @@ HLT_tau25_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1jXE110:
 HLT_tau25_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_02dRAB10_L1cTAU20M_DR-eTAU20eTAU12-jJ40:
   eventCount: 1
   stepCounts:
-    0: 13
-    1: 13
-    2: 13
-    3: 13
+    0: 14
+    1: 14
+    2: 14
+    3: 14
     4: 1
   stepFeatures:
-    0: 80
-    1: 80
-    2: 80
-    3: 80
+    0: 87
+    1: 87
+    2: 87
+    3: 87
     4: 6
 HLT_tau25_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1DR-TAU20ITAU12I-J25:
   eventCount: 1
@@ -31398,16 +31398,16 @@ HLT_tau25_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1DR-TAU20I
 HLT_tau25_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
   eventCount: 1
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
     4: 1
   stepFeatures:
-    0: 44
-    1: 44
-    2: 44
-    3: 44
+    0: 53
+    1: 53
+    2: 53
+    3: 53
     4: 8
 ? HLT_tau25_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_4j20c_020jvt_SHARED_j20c_020jvt_bgn185_pf_ftf_L1TAU20IM_2TAU12IM_4J12p0ETA25
 : eventCount: 1
@@ -31503,15 +31503,15 @@ HLT_tau25_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1DR-TAU20I
 HLT_tau25_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
   eventCount: 0
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 41
-    1: 41
-    2: 41
-    3: 41
+    0: 50
+    1: 50
+    2: 50
+    3: 50
     4: 6
 HLT_tau25_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM_4J12p0ETA25:
   eventCount: 0
@@ -31543,16 +31543,16 @@ HLT_tau25_perf_tracktwoMVA_L1TAU12IM:
 HLT_tau25_perf_tracktwoMVA_L1cTAU20M:
   eventCount: 12
   stepCounts:
-    0: 18
-    1: 18
-    2: 18
-    3: 18
+    0: 19
+    1: 19
+    2: 19
+    3: 19
     4: 12
   stepFeatures:
-    0: 33
-    1: 33
-    2: 33
-    3: 33
+    0: 38
+    1: 38
+    2: 38
+    3: 38
     4: 17
 HLT_tau25_perf_tracktwoMVA_L1eTAU20:
   eventCount: 13
@@ -31577,10 +31577,10 @@ HLT_tau25_perf_tracktwoMVA_L1eTAU20M:
     3: 19
     4: 13
   stepFeatures:
-    0: 58
-    1: 58
-    2: 58
-    3: 58
+    0: 54
+    1: 54
+    2: 54
+    3: 54
     4: 21
 HLT_tau25_perf_tracktwoMVA_L1jTAU20:
   eventCount: 14
@@ -31893,19 +31893,19 @@ HLT_tau30_idperf_tracktwoMVA_tau20_idperf_tracktwoMVA_03dRAB30_L1DR-TAU20ITAU12I
     3: 25
     4: 25
 HLT_tau30_idperf_tracktwoMVA_tau20_idperf_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
-  eventCount: 8
+  eventCount: 10
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
-    4: 8
+    0: 10
+    1: 10
+    2: 10
+    3: 10
+    4: 10
   stepFeatures:
-    0: 44
-    1: 44
-    2: 44
-    3: 44
-    4: 44
+    0: 53
+    1: 53
+    2: 53
+    3: 53
+    4: 53
 HLT_tau30_idperf_tracktwoMVA_tau20_idperf_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM_4J12p0ETA25:
   eventCount: 7
   stepCounts:
@@ -31943,19 +31943,19 @@ HLT_tau30_idperf_tracktwoMVA_tau20_idperf_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM_
 ? HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_4j20c_020jvt_SHARED_j20c_020jvt_bgn185_pf_ftf_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55
 : eventCount: 1
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
     4: 1
     5: 1
     6: 1
     7: 1
   stepFeatures:
-    0: 44
-    1: 44
-    2: 44
-    3: 44
+    0: 53
+    1: 53
+    2: 53
+    3: 53
     4: 8
     5: 2
     6: 10
@@ -31991,30 +31991,30 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1DR-TAU20I
 HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20:
   eventCount: 1
   stepCounts:
-    0: 10
-    1: 10
-    2: 10
-    3: 10
+    0: 11
+    1: 11
+    2: 11
+    3: 11
     4: 1
   stepFeatures:
-    0: 47
-    1: 47
-    2: 47
-    3: 47
+    0: 56
+    1: 56
+    2: 56
+    3: 56
     4: 8
 HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
   eventCount: 1
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
     4: 1
   stepFeatures:
-    0: 44
-    1: 44
-    2: 44
-    3: 44
+    0: 53
+    1: 53
+    2: 53
+    3: 53
     4: 8
 HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1jJ85p0ETA21_3jJ40p0ETA25:
   eventCount: 1
@@ -32053,19 +32053,19 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_j20c_020jvt
 ? HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_j20c_020jvt_bgn185_pf_ftf_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55
 : eventCount: 1
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
     4: 1
     5: 1
     6: 1
     7: 1
   stepFeatures:
-    0: 44
-    1: 44
-    2: 44
-    3: 44
+    0: 53
+    1: 53
+    2: 53
+    3: 53
     4: 8
     5: 1
     6: 5
@@ -32079,10 +32079,10 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_10
     3: 9
     4: 1
   stepFeatures:
-    0: 47
-    1: 47
-    2: 47
-    3: 47
+    0: 51
+    1: 51
+    2: 51
+    3: 51
     4: 8
 HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_4DR28-eTAU30eTAU20-jJ55:
   eventCount: 1
@@ -32093,10 +32093,10 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_4D
     3: 10
     4: 1
   stepFeatures:
-    0: 51
-    1: 51
-    2: 51
-    3: 51
+    0: 57
+    1: 57
+    2: 57
+    3: 57
     4: 8
 HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_4DR32-eTAU30eTAU20-jJ55:
   eventCount: 1
@@ -32107,10 +32107,10 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L12cTAU20M_4D
     3: 10
     4: 1
   stepFeatures:
-    0: 51
-    1: 51
-    2: 51
-    3: 51
+    0: 57
+    1: 57
+    2: 57
+    3: 57
     4: 8
 HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L14jJ30p0ETA24_0DETA24-eTAU30eTAU12:
   eventCount: 1
@@ -32205,41 +32205,55 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU20M_cTA
     3: 11
     4: 1
   stepFeatures:
-    0: 65
-    1: 55
-    2: 55
-    3: 55
+    0: 73
+    1: 63
+    2: 63
+    3: 63
     4: 9
 ? HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU20M_cTAU12M_4jJ30p0ETA24_0DETA24_10DPHI99-eTAU30eTAU12
 : eventCount: 1
   stepCounts:
-    0: 11
-    1: 11
-    2: 11
-    3: 11
+    0: 12
+    1: 12
+    2: 12
+    3: 12
     4: 1
   stepFeatures:
-    0: 65
-    1: 55
-    2: 55
-    3: 55
+    0: 76
+    1: 66
+    2: 66
+    3: 66
     4: 9
 ? HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU20M_cTAU12M_4jJ30p0ETA24_0DETA24_4DPHI99-eTAU30eTAU12
 : eventCount: 1
   stepCounts:
-    0: 11
-    1: 11
-    2: 11
-    3: 11
+    0: 12
+    1: 12
+    2: 12
+    3: 12
     4: 1
   stepFeatures:
-    0: 65
-    1: 55
-    2: 55
-    3: 55
+    0: 76
+    1: 66
+    2: 66
+    3: 66
     4: 9
 ? HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU20M_cTAU12M_4jJ30p0ETA24_0DETA24_4DPHI99-eTAU30eTAU20
 : eventCount: 1
+  stepCounts:
+    0: 12
+    1: 12
+    2: 12
+    3: 12
+    4: 1
+  stepFeatures:
+    0: 76
+    1: 66
+    2: 66
+    3: 66
+    4: 9
+HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU30M_2cTAU20M:
+  eventCount: 1
   stepCounts:
     0: 11
     1: 11
@@ -32247,12 +32261,12 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU20M_cTA
     3: 11
     4: 1
   stepFeatures:
-    0: 65
-    1: 55
-    2: 55
-    3: 55
-    4: 9
-HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU30M_2cTAU20M:
+    0: 56
+    1: 56
+    2: 56
+    3: 56
+    4: 8
+HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU30M_2cTAU20M_4jJ30p0ETA25:
   eventCount: 1
   stepCounts:
     0: 10
@@ -32261,24 +32275,10 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU30M_2cT
     3: 10
     4: 1
   stepFeatures:
-    0: 47
-    1: 47
-    2: 47
-    3: 47
-    4: 8
-HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1cTAU30M_2cTAU20M_4jJ30p0ETA25:
-  eventCount: 1
-  stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
-    4: 1
-  stepFeatures:
-    0: 44
-    1: 44
-    2: 44
-    3: 44
+    0: 53
+    1: 53
+    2: 53
+    3: 53
     4: 8
 HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1jJ85p0ETA21_3jJ40p0ETA25:
   eventCount: 1
@@ -32310,15 +32310,15 @@ HLT_tau30_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1DR-TAU20I
 HLT_tau30_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
   eventCount: 0
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 41
-    1: 41
-    2: 41
-    3: 41
+    0: 50
+    1: 50
+    2: 50
+    3: 50
     4: 6
 HLT_tau30_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM_4J12p0ETA25:
   eventCount: 0
@@ -32348,19 +32348,19 @@ HLT_tau35_idperf_tracktwoMVA_L1TAU20IM:
     3: 18
     4: 18
 HLT_tau35_idperf_tracktwoMVA_L1cTAU30M:
-  eventCount: 14
+  eventCount: 17
   stepCounts:
-    0: 14
-    1: 14
-    2: 14
-    3: 14
-    4: 14
+    0: 17
+    1: 17
+    2: 17
+    3: 17
+    4: 17
   stepFeatures:
-    0: 22
-    1: 22
-    2: 22
-    3: 22
-    4: 22
+    0: 28
+    1: 28
+    2: 28
+    3: 28
+    4: 28
 HLT_tau35_idperf_tracktwoMVA_L1eTAU30:
   eventCount: 17
   stepCounts:
@@ -32434,16 +32434,16 @@ HLT_tau35_mediumRNN_tracktwoMVA_L1TAU20IM:
 HLT_tau35_mediumRNN_tracktwoMVA_L1cTAU30M:
   eventCount: 2
   stepCounts:
-    0: 14
-    1: 14
-    2: 14
-    3: 14
+    0: 17
+    1: 17
+    2: 17
+    3: 17
     4: 2
   stepFeatures:
-    0: 22
-    1: 22
-    2: 22
-    3: 22
+    0: 28
+    1: 28
+    2: 28
+    3: 28
     4: 2
 HLT_tau35_mediumRNN_tracktwoMVA_L1eTAU30:
   eventCount: 2
@@ -32588,7 +32588,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe100_pfopufit_L1XE55:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe100_pfopufit_L1gXEJWOJ100:
   eventCount: 0
   stepCounts:
-    0: 3
+    0: 4
     1: 1
     2: 1
     3: 1
@@ -32604,7 +32604,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe100_pfopufit_L1gXEJWOJ100:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe100_pfopufit_L1gXEJWOJ110:
   eventCount: 0
   stepCounts:
-    0: 3
+    0: 4
     1: 1
     2: 1
     3: 1
@@ -32620,7 +32620,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe100_pfopufit_L1gXEJWOJ110:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe100_pfopufit_L1jXE100:
   eventCount: 0
   stepCounts:
-    0: 3
+    0: 4
     1: 1
     2: 1
     3: 1
@@ -32636,7 +32636,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe100_pfopufit_L1jXE100:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe100_pfopufit_L1jXE110:
   eventCount: 0
   stepCounts:
-    0: 3
+    0: 4
     1: 1
     2: 1
     3: 1
@@ -32684,7 +32684,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe90_pfopufit_L1XE55:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe90_pfopufit_L1gXEJWOJ100:
   eventCount: 0
   stepCounts:
-    0: 3
+    0: 4
     1: 2
     2: 2
     3: 2
@@ -32700,7 +32700,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe90_pfopufit_L1gXEJWOJ100:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe90_pfopufit_L1gXEJWOJ110:
   eventCount: 0
   stepCounts:
-    0: 3
+    0: 4
     1: 2
     2: 2
     3: 2
@@ -32716,7 +32716,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe90_pfopufit_L1gXEJWOJ110:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe90_pfopufit_L1jXE100:
   eventCount: 0
   stepCounts:
-    0: 3
+    0: 4
     1: 2
     2: 2
     3: 2
@@ -32732,7 +32732,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe90_pfopufit_L1jXE100:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe65_cell_xe90_pfopufit_L1jXE110:
   eventCount: 0
   stepCounts:
-    0: 3
+    0: 4
     1: 2
     2: 2
     3: 2
@@ -32780,7 +32780,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1XE55:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1gXEJWOJ100:
   eventCount: 0
   stepCounts:
-    0: 2
+    0: 3
     1: 1
     2: 1
     3: 1
@@ -32796,7 +32796,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1gXEJWOJ100:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1gXEJWOJ110:
   eventCount: 0
   stepCounts:
-    0: 2
+    0: 3
     1: 1
     2: 1
     3: 1
@@ -32812,7 +32812,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1gXEJWOJ110:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1jXE100:
   eventCount: 0
   stepCounts:
-    0: 2
+    0: 3
     1: 1
     2: 1
     3: 1
@@ -32828,7 +32828,7 @@ HLT_tau35_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1jXE100:
 HLT_tau35_mediumRNN_tracktwoMVA_probe_xe75_cell_xe100_pfopufit_L1jXE110:
   eventCount: 0
   stepCounts:
-    0: 2
+    0: 3
     1: 1
     2: 1
     3: 1
@@ -32857,15 +32857,15 @@ HLT_tau35_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1DR-TAU20I
 HLT_tau35_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
   eventCount: 0
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 42
-    1: 42
-    2: 42
-    3: 42
+    0: 51
+    1: 51
+    2: 51
+    3: 51
     4: 7
 HLT_tau35_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM_4J12p0ETA25:
   eventCount: 0
@@ -32907,6 +32907,19 @@ HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1DR-TAU20I
     3: 19
     4: 3
 HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30MeTAU20M:
+  eventCount: 0
+  stepCounts:
+    0: 11
+    1: 11
+    2: 11
+    3: 11
+  stepFeatures:
+    0: 51
+    1: 51
+    2: 51
+    3: 51
+    4: 5
+HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30MeTAU20M-jJ55:
   eventCount: 0
   stepCounts:
     0: 10
@@ -32914,25 +32927,25 @@ HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2
     2: 10
     3: 10
   stepFeatures:
-    0: 42
-    1: 42
-    2: 42
-    3: 42
+    0: 48
+    1: 48
+    2: 48
+    3: 48
     4: 5
-HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30MeTAU20M-jJ55:
+HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20:
   eventCount: 0
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 11
+    1: 11
+    2: 11
+    3: 11
   stepFeatures:
-    0: 39
-    1: 39
-    2: 39
-    3: 39
+    0: 51
+    1: 51
+    2: 51
+    3: 51
     4: 5
-HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20:
+HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
   eventCount: 0
   stepCounts:
     0: 10
@@ -32940,23 +32953,10 @@ HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2
     2: 10
     3: 10
   stepFeatures:
-    0: 42
-    1: 42
-    2: 42
-    3: 42
-    4: 5
-HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
-  eventCount: 0
-  stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
-  stepFeatures:
-    0: 39
-    1: 39
-    2: 39
-    3: 39
+    0: 48
+    1: 48
+    2: 48
+    3: 48
     4: 5
 HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM:
   eventCount: 0
@@ -32987,28 +32987,28 @@ HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TA
 HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB_L1cTAU30M_2cTAU20M:
   eventCount: 0
   stepCounts:
-    0: 10
-    1: 10
-    2: 10
-    3: 10
+    0: 11
+    1: 11
+    2: 11
+    3: 11
   stepFeatures:
-    0: 42
-    1: 42
-    2: 42
-    3: 42
+    0: 51
+    1: 51
+    2: 51
+    3: 51
     4: 5
 HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB_L1cTAU30M_2cTAU20M_4jJ30p0ETA25:
   eventCount: 0
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 39
-    1: 39
-    2: 39
-    3: 39
+    0: 48
+    1: 48
+    2: 48
+    3: 48
     4: 5
 HLT_tau35_perf_tracktwoMVA_L1TAU20IM:
   eventCount: 10
@@ -33025,19 +33025,19 @@ HLT_tau35_perf_tracktwoMVA_L1TAU20IM:
     3: 18
     4: 11
 HLT_tau35_perf_tracktwoMVA_L1cTAU30M:
-  eventCount: 10
+  eventCount: 12
   stepCounts:
-    0: 14
-    1: 14
-    2: 14
-    3: 14
-    4: 10
-  stepFeatures:
-    0: 22
-    1: 22
-    2: 22
-    3: 22
+    0: 17
+    1: 17
+    2: 17
+    3: 17
     4: 12
+  stepFeatures:
+    0: 28
+    1: 28
+    2: 28
+    3: 28
+    4: 15
 HLT_tau35_perf_tracktwoMVA_L1eTAU30:
   eventCount: 13
   stepCounts:
@@ -33464,15 +33464,15 @@ HLT_tau40_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1DR-TAU20I
 HLT_tau40_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55:
   eventCount: 0
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 41
-    1: 41
-    2: 41
-    3: 41
+    0: 50
+    1: 50
+    2: 50
+    3: 50
     4: 6
 HLT_tau40_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM_4J12p0ETA25:
   eventCount: 0
@@ -33503,28 +33503,28 @@ HLT_tau40_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_03dRAB_L1TAU25IM_2TA
 HLT_tau40_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_03dRAB_L1cTAU35M_2cTAU30M:
   eventCount: 0
   stepCounts:
-    0: 7
-    1: 7
-    2: 7
-    3: 7
+    0: 9
+    1: 9
+    2: 9
+    3: 9
   stepFeatures:
-    0: 30
-    1: 30
-    2: 30
-    3: 30
+    0: 38
+    1: 38
+    2: 38
+    3: 38
     4: 3
 HLT_tau40_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_03dRAB_L1cTAU35M_2cTAU30M_2jJ55_3jJ50:
   eventCount: 0
   stepCounts:
-    0: 7
-    1: 7
-    2: 7
-    3: 7
+    0: 9
+    1: 9
+    2: 9
+    3: 9
   stepFeatures:
-    0: 30
-    1: 30
-    2: 30
-    3: 30
+    0: 38
+    1: 38
+    2: 38
+    3: 38
     4: 3
 HLT_tau40_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_03dRAB_L1eTAU35M_2eTAU30M:
   eventCount: 0
@@ -33566,51 +33566,51 @@ HLT_tau50_mediumRNN_tracktwoMVA_xe80_pfopufit_xe50_cell_L1XE55:
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_pfopufit_xe50_cell_L1gXEJWOJ100:
   eventCount: 0
   stepCounts:
-    0: 8
-    1: 8
-    2: 8
-    3: 8
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 13
-    1: 13
-    2: 13
-    3: 13
+    0: 15
+    1: 15
+    2: 15
+    3: 15
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_pfopufit_xe50_cell_L1gXEJWOJ110:
   eventCount: 0
   stepCounts:
-    0: 6
-    1: 6
-    2: 6
-    3: 6
-  stepFeatures:
     0: 8
     1: 8
     2: 8
     3: 8
+  stepFeatures:
+    0: 10
+    1: 10
+    2: 10
+    3: 10
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_pfopufit_xe50_cell_L1jXE100:
   eventCount: 0
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 13
-    1: 13
-    2: 13
-    3: 13
+    0: 14
+    1: 14
+    2: 14
+    3: 14
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_pfopufit_xe50_cell_L1jXE110:
   eventCount: 0
   stepCounts:
-    0: 7
-    1: 7
-    2: 7
-    3: 7
+    0: 8
+    1: 8
+    2: 8
+    3: 8
   stepFeatures:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_tcpufit_xe50_cell_L1XE50:
   eventCount: 0
   stepCounts:
@@ -33638,51 +33638,51 @@ HLT_tau50_mediumRNN_tracktwoMVA_xe80_tcpufit_xe50_cell_L1XE55:
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_tcpufit_xe50_cell_L1gXEJWOJ100:
   eventCount: 0
   stepCounts:
-    0: 8
-    1: 8
-    2: 8
-    3: 8
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 13
-    1: 13
-    2: 13
-    3: 13
+    0: 15
+    1: 15
+    2: 15
+    3: 15
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_tcpufit_xe50_cell_L1gXEJWOJ110:
   eventCount: 0
   stepCounts:
-    0: 6
-    1: 6
-    2: 6
-    3: 6
-  stepFeatures:
     0: 8
     1: 8
     2: 8
     3: 8
+  stepFeatures:
+    0: 10
+    1: 10
+    2: 10
+    3: 10
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_tcpufit_xe50_cell_L1jXE100:
   eventCount: 0
   stepCounts:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
   stepFeatures:
-    0: 13
-    1: 13
-    2: 13
-    3: 13
+    0: 14
+    1: 14
+    2: 14
+    3: 14
 HLT_tau50_mediumRNN_tracktwoMVA_xe80_tcpufit_xe50_cell_L1jXE110:
   eventCount: 0
   stepCounts:
-    0: 7
-    1: 7
-    2: 7
-    3: 7
+    0: 8
+    1: 8
+    2: 8
+    3: 8
   stepFeatures:
-    0: 9
-    1: 9
-    2: 9
-    3: 9
+    0: 10
+    1: 10
+    2: 10
+    3: 10
 HLT_tau60_mediumRNN_tracktwoLLP_probe_xe65_cell_xe100_pfopufit_L1XE50:
   eventCount: 0
   stepCounts:
@@ -34328,10 +34328,10 @@ HLT_tau60_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_xe50_cell_03dRAB_L1e
     2: 9
     3: 9
   stepFeatures:
-    0: 38
-    1: 38
-    2: 38
-    3: 38
+    0: 37
+    1: 37
+    2: 37
+    3: 37
     4: 2
 HLT_tau80_idperf_trackLRT_L1TAU60:
   eventCount: 5
diff --git a/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref b/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref
index 964f046eddb7604568d46f8ed37e5b6879edc539..4cf2a54fe0bd8327d6621479412c4a4bbc984652 100644
--- a/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref
+++ b/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref
@@ -7130,7 +7130,11 @@ HLT_j45f_L1J15p31ETA49:
   stepFeatures:
     0: 1
 HLT_j45f_L1jJ40p30ETA49:
-  eventCount: 0
+  eventCount: 1
+  stepCounts:
+    0: 1
+  stepFeatures:
+    0: 1
 HLT_j460_L1J100:
   eventCount: 0
 HLT_j460_L1jJ160:
@@ -10298,17 +10302,17 @@ HLT_noalg_L1jJ30:
 HLT_noalg_L1jJ40:
   eventCount: 15
 HLT_noalg_L1jJ40p30ETA49:
-  eventCount: 2
+  eventCount: 6
 HLT_noalg_L1jJ50:
   eventCount: 13
 HLT_noalg_L1jJ500:
   eventCount: 0
 HLT_noalg_L1jJ50p30ETA49:
-  eventCount: 3
+  eventCount: 5
 HLT_noalg_L1jJ60:
   eventCount: 5
 HLT_noalg_L1jJ60p30ETA49:
-  eventCount: 2
+  eventCount: 3
 HLT_noalg_L1jJ90:
   eventCount: 3
 HLT_noalg_L1jJ90p30ETA49:
diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Dev_fork_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Dev_fork_build.py
deleted file mode 100755
index 3a9ed5920467d68256a7527b7df7f5da62854fee..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Dev_fork_build.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
-
-# art-description: athenaHLT test of the Dev_pp_run3_v1 menu with multiple forks
-# art-type: build
-# art-include: main/Athena
-# art-include: 24.0/Athena
-
-from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
-
-ex = ExecStep.ExecStep()
-ex.type = 'athenaHLT'
-ex.job_options = 'TriggerJobOpts.runHLT'
-ex.input = 'data'
-ex.forks = 8
-ex.threads = 1
-ex.concurrent_events = 1
-ex.flags = ['Trigger.triggerMenuSetup="Dev_pp_run3_v1_TriggerValidation_prescale"',
-            'Trigger.doLVL1=True']
-
-test = Test.Test()
-test.art_type = 'build'
-test.exec_steps = [ex]
-test.check_steps = CheckSteps.default_check_steps(test)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt
index b26ba22218403415b2c5df12d0bb3d573dec2935..ee86a0afee05e2df7c0db19f5ef04eda8f56d9c8 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt
+++ b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt
@@ -64,7 +64,7 @@ function( atlas_test_hlt_trigger_menu menu )
    atlas_add_test( "HLT_${menu}"
       SCRIPT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_HLTmenu.py Trigger.triggerMenuSetup=${menu} ${extra_args}
       PRIVATE_WORKING_DIRECTORY
-      PROPERTIES TIMEOUT 1200
+      PROPERTIES TIMEOUT 500
       POST_EXEC_SCRIPT "check_log.py --errors --config checklogTriggerTest.conf ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/unitTestRun_HLT_${menu}/HLT_${menu}.log" )
 endfunction()
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CalibCosmicMon/EnhancedBiasChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CalibCosmicMon/EnhancedBiasChainConfiguration.py
index d1f6a2b4537ee5cf4dd621aeaba7b543ee70aeea..7ee07c4fe35da93dedfe71c5e2463ce0762b3019 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CalibCosmicMon/EnhancedBiasChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CalibCosmicMon/EnhancedBiasChainConfiguration.py
@@ -13,6 +13,7 @@ log = logging.getLogger(__name__)
 l1seeds = { 'low'  : \
                ['L1_2eEM9',\
                 'L1_eEM12L',\
+                "L1_eTAU20",\
                 #'L1_EM12_XS20',\
                 'L1_jJ40p30ETA49',\
                 'L1_JPSI-1M5-eEM15',\
@@ -37,23 +38,19 @@ l1seeds = { 'low'  : \
                 'L1_cTAU30M_2cTAU20M_DR-eTAU30eTAU20',\
                 'L1_DY-BOX-2MU5VF',\
                 'L1_DY-BOX-2MU3VF',\
-                'L1_eEM18M_2eTAU20M_jJ55_3jJ30',\
                 #'L1_EM15_XS30',\
                 'L1_eEM18L',\
                 'L1_eEM24L',\
-                'L1_HT190-jJ40s5pETA21',\
+                'L1_gXEJWOJ100',\
                 'L1_jJ60p30ETA49',\
                 'L1_jJ80p0ETA25_2jJ40p30ETA49',\
                 'L1_J50',\
                 'L1_jJ90_DETA20-jJ90J',\
                 'L1_LFV-MU5VF',\
-                'L1_jMJJ-500-NFF',\
                 'L1_MU5VF_J40',\
-                'L1_MU8F_eTAU20M',\
+                'L1_MU8F_eTAU30M',\
                 #'L1_MU5VF_J20',\
                 #'L1_MU5VF_J30p0ETA49_2J20p0ETA49',\
-                'L1_eTAU30M_2eTAU20M_jJ55_2jJ50_3jJ30',\
-                'L1_eTAU30M_2eTAU20M_jXE70',\
                 'L1_eTAU60',\
                 #'L1_XE35',
                 'L1_jXE70',
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Menu/Physics_pp_run3_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Menu/Physics_pp_run3_v1.py
index 7224bb2ffadf5a94240f37eb78c501aa44780c13..ba328d69306780ddfcc2ee00f0237b894ad2df75 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Menu/Physics_pp_run3_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Menu/Physics_pp_run3_v1.py
@@ -1602,7 +1602,7 @@ def setupMenu(menu_name):
         # HH4b primaries
         # Muon+jet legacy seeded, backup for L1Topo muon-in-jet
         ChainProp(name='HLT_j75c_020jvt_j50c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bgn277_pf_ftf_presel2c20XX2c20bgtwo85_L1MU8F_2jJ40_jJ50', l1SeedThresholds=['FSNOSEED']*5, stream=[PhysicsStream], groups=PrimaryPhIGroup+MultiBjetGroup),
-        ChainProp(name='HLT_j75c_020jvt_j50c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bgn280_pf_ftf_presel2c20XX2c20bgtwo85_L1MU8F_2jJ40_jJ50', l1SeedThresholds=['FSNOSEED']*5, stream=['VBFDelayed'], groups=PrimaryPhIGroup+MultiBjetGroup),
+        ChainProp(name='HLT_j75c_020jvt_j50c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bgn280_pf_ftf_presel2c20XX2c20bgtwo85_L1MU8F_2jJ40_jJ50', l1SeedThresholds=['FSNOSEED']*5, stream=[PhysicsStream], groups=PrimaryPhIGroup+MultiBjetGroup),
 
         # Phase I inputs GN2
         #  Single b-jet
@@ -1653,7 +1653,7 @@ def setupMenu(menu_name):
         # 2b asymmetric b-jet pt for VBFDelayed
         ChainProp(name='HLT_j75c_020jvt_j50c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bgn277_pf_ftf_presel2c20XX2c20bgtwo85_L1jJ85p0ETA21_3jJ40p0ETA25', l1SeedThresholds=['FSNOSEED']*5, stream=[PhysicsStream], monGroups=['idMon:t0'], groups=PrimaryPhIGroup+MultiBjetGroup),
         # 2b asymmetric b-jet pt for with looser b-tagging (ATR-28870)
-        ChainProp(name='HLT_j75c_020jvt_j50c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bgn280_pf_ftf_presel2c20XX2c20bgtwo85_L1jJ85p0ETA21_3jJ40p0ETA25', l1SeedThresholds=['FSNOSEED']*5, stream=['VBFDelayed'], monGroups=['idMon:t0'], groups=PrimaryPhIGroup+MultiBjetGroup),
+        ChainProp(name='HLT_j75c_020jvt_j50c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bgn280_pf_ftf_presel2c20XX2c20bgtwo85_L1jJ85p0ETA21_3jJ40p0ETA25', l1SeedThresholds=['FSNOSEED']*5, stream=[PhysicsStream], monGroups=['idMon:t0'], groups=PrimaryPhIGroup+MultiBjetGroup),
         # Candidates for allhad ttbar delayed stream
         ChainProp(name='HLT_5j35c_020jvt_j25c_020jvt_SHARED_j25c_020jvt_bgn260_pf_ftf_presel5c25XXc25bgtwo85_L14jJ40', l1SeedThresholds=['FSNOSEED']*3, stream=[PhysicsStream], groups=PrimaryPhIGroup+MultiBjetGroup),
         ChainProp(name='HLT_5j45c_020jvt_j25c_020jvt_SHARED_j25c_020jvt_bgn260_pf_ftf_presel5c25XXc25bgtwo85_L14jJ40', l1SeedThresholds=['FSNOSEED']*3, stream=[PhysicsStream], groups=PrimaryPhIGroup+MultiBjetGroup),
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/L1CaloThresholdMapping.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/L1CaloThresholdMapping.py
index c224798a42bc82b203688d2f8b3ed4d459b3e5d2..69a5a618c0e212259378bc87939ec15c45d58f55 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/L1CaloThresholdMapping.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/L1CaloThresholdMapping.py
@@ -62,6 +62,7 @@ threshold_mapping = {
         140:138,
         160:158,
         180:197,
+        # Must be 400 to ensure threshold can be passed
         500:400,
     },
     'CjJ': { # 0ETA2[1,3,5]
@@ -76,12 +77,12 @@ threshold_mapping = {
     },
     'FjJ': { # 30ETA49
         15:15,
-        20:26,
-        40:53,
-        50:41,
-        60:61,
-        90:101,
-        125:152,
+        20:20,
+        40:26,
+        50:32,
+        60:49,
+        90:83,
+        125:134,
     },
     'gJ':
     {
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py
index 89cd3cd59e05096b27f05ae87c86b9f47aa24137..4e3bf1c7ce32e8bc98362ec63501e608157f0ba2 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py
@@ -364,9 +364,9 @@ class L1Config_eTAU:
     # BDT eTAU score cuts
     # 12 bits (0 - 4095), BDT > 4 * threshold -> pass
     # CAREFUL!! THE THRESHOLDS HERE ARE MULTIPLIED BY 4 IN THE eFEX FIRMWARE!
-    BDT_fw_loose = 130
-    BDT_fw_medium = 200
-    BDT_fw_tight = 224
+    BDT_fw_loose = 221
+    BDT_fw_medium = 224
+    BDT_fw_tight = 225
 
     # RHad isolation cuts
     # 8 bits (0 - 255), rHad > threshold -> pass
@@ -460,7 +460,7 @@ class L1Config_cTAU:
     eTAU_rCoreMin_WP_fw_loose: eTAUWP = eTAUWP.NoSelection
     eTAU_rHadMin_WP_fw_loose: eTAUWP = eTAUWP.NoSelection
 
-    isolation_fw_medium: int = 410
+    isolation_fw_medium: int = 358
     isolation_jTAUCoreScale_fw_medium: int = 0
     eTAU_rCoreMin_WP_fw_medium: eTAUWP = eTAUWP.NoSelection
     eTAU_rHadMin_WP_fw_medium: eTAUWP = eTAUWP.NoSelection
@@ -472,27 +472,27 @@ class L1Config_cTAU:
 
     # Dedicated M thresholds for the primary items:
     #cTAU12M (Medium12)
-    isolation_fw_medium12: int = 620 + 870
-    isolation_jTAUCoreScale_fw_medium12: int = 870
+    isolation_fw_medium12: int = 400
+    isolation_jTAUCoreScale_fw_medium12: int = 0
     eTAU_rCoreMin_WP_fw_medium12: eTAUWP = eTAUWP.Loose
     eTAU_rHadMin_WP_fw_medium12: eTAUWP = eTAUWP.NoSelection
 
     #cTAU20M (Medium20)
-    isolation_fw_medium20: int = 620 + 870
-    isolation_jTAUCoreScale_fw_medium20: int = 870
+    isolation_fw_medium20: int = 600 + 600
+    isolation_jTAUCoreScale_fw_medium20: int = 600
     eTAU_rCoreMin_WP_fw_medium20: eTAUWP = eTAUWP.Loose
     eTAU_rHadMin_WP_fw_medium20: eTAUWP = eTAUWP.NoSelection
 
     #cTAU30M (Medium30)
-    isolation_fw_medium30: int = 500 + 870
-    isolation_jTAUCoreScale_fw_medium30: int = 870
+    isolation_fw_medium30: int = 500 + 600
+    isolation_jTAUCoreScale_fw_medium30: int = 600
     eTAU_rCoreMin_WP_fw_medium30: eTAUWP = eTAUWP.Medium
     eTAU_rHadMin_WP_fw_medium30: eTAUWP = eTAUWP.NoSelection
 
     #cTAU35M (Medium35)
-    isolation_fw_medium35: int = 385 + 500
-    isolation_jTAUCoreScale_fw_medium35: int = 500
-    eTAU_rCoreMin_WP_fw_medium35: eTAUWP = eTAUWP.Tight
+    isolation_fw_medium35: int = 450 + 450
+    isolation_jTAUCoreScale_fw_medium35: int = 450
+    eTAU_rCoreMin_WP_fw_medium35: eTAUWP = eTAUWP.Medium
     eTAU_rHadMin_WP_fw_medium35: eTAUWP = eTAUWP.NoSelection
 
     def __post_init__(self):